diff --git a/src/main/java/com/xkrs/unionpay/controller/UnionpayController.java b/src/main/java/com/xkrs/unionpay/controller/UnionpayController.java index dd97ea4..1613eea 100644 --- a/src/main/java/com/xkrs/unionpay/controller/UnionpayController.java +++ b/src/main/java/com/xkrs/unionpay/controller/UnionpayController.java @@ -9,6 +9,8 @@ import com.google.zxing.qrcode.QRCodeWriter; import com.xkrs.unionpay.bean.DemoBase; import com.xkrs.unionpay.service.UnionpayService; import com.xkrs.unionpay.util.AcpService; +import com.xkrs.unionpay.util.LogUtil; +import com.xkrs.unionpay.util.SDKConfig; import com.xkrs.unionpay.util.SDKConstants; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -38,6 +40,7 @@ public class UnionpayController { @Resource private UnionpayService unionpayService; + @RequestMapping("/pay") public void pay(HttpServletResponse response) throws Exception{ String qrCode=unionpayService.pay(DemoBase.getOrderId(),"200"); @@ -83,7 +86,8 @@ public class UnionpayController { Hashtable hints = new Hashtable(); - hints.put(EncodeHintType.CHARACTER_SET, "utf-8"); // 内容所使用字符集编码 + // 内容所使用字符集编码 + hints.put(EncodeHintType.CHARACTER_SET, "utf-8"); BitMatrix bitMatrix = new MultiFormatWriter().encode(content, BarcodeFormat.QR_CODE, 200, 200, hints); @@ -100,6 +104,7 @@ public class UnionpayController { MatrixToImageWriter.writeToStream(bitMatrix,"png",outputStream);*/ } + @RequestMapping("/notify") public void hello2(HttpServletRequest request, HttpServletResponse response) throws Exception{ Map result=new HashMap<>(); diff --git a/src/main/java/com/xkrs/unionpay/service/impl/UnionpayServiceImpl.java b/src/main/java/com/xkrs/unionpay/service/impl/UnionpayServiceImpl.java index ad3f6da..cac22ae 100644 --- a/src/main/java/com/xkrs/unionpay/service/impl/UnionpayServiceImpl.java +++ b/src/main/java/com/xkrs/unionpay/service/impl/UnionpayServiceImpl.java @@ -67,12 +67,12 @@ public class UnionpayServiceImpl implements UnionpayService { if (AcpService.validate(rspData, DemoBase.encoding)) { LogUtil.writeLog("验证签名成功"); String respCode = rspData.get("respCode"); - if (("00").equals(respCode)) { System.out.println("受理成功"); //TODO qrCode=rspData.get("qrCode"); + System.out.println("---------" + qrCode); } else { //其他应答码为失败请排查原因或做失败处理 //TODO diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 4c53332..6650003 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -144,7 +144,7 @@ acpsdk.ifValidateCNName=false acpsdk.ifValidateRemoteCert=false #后台通知地址,填写接收银联后台通知的地址,必须外网能访问 -acpsdk.backUrl=http://222.222.222.222:8080/ACPSample_QRC/backRcvResponse +acpsdk.backUrl=http://8.136.100.69:6801/ACPSample_QRC/backRcvResponse #前台通知地址,填写处理银联前台通知的地址,必须外网能访问(二维码产品用不到) acpsdk.frontUrl=http://localhost:8080/ACPSample_QRC/frontRcvResponse