From fdd54735e5040f3fbb40c8e5e4d66d4c16b0fd7a Mon Sep 17 00:00:00 2001 From: XinYi Song <2037158277@qq.com> Date: Thu, 30 Dec 2021 10:11:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BA=86=E9=93=B6=E8=81=94?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E7=9A=84=E4=BB=A3=E7=A0=81=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E6=94=B9=E4=BA=86=E9=85=8D=E7=BD=AE=E6=96=87?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xkrs/unionpay/controller/UnionpayController.java | 7 ++++++- .../xkrs/unionpay/service/impl/UnionpayServiceImpl.java | 2 +- src/main/resources/application.properties | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) 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