yeguodong 3 tuần trước cách đây
mục cha
commit
f1b9c3d250
1 tập tin đã thay đổi với 22 bổ sung19 xóa
  1. 22 19
      src/main/java/cn/hnthyy/thmz/service/pay/NongPayService.java

+ 22 - 19
src/main/java/cn/hnthyy/thmz/service/pay/NongPayService.java

@@ -136,22 +136,26 @@ public class NongPayService {
         String extParam = (String) body.get("extParam");
         String state = (String) body.get("state");
         if("2".equals(state)) {
-            JSONObject extraParam = JSONObject.parseObject(extParam);
-            List<MzDepositFile> mzDepositFiles = new ArrayList<>();
-            MzDepositFile mzDepositFile = new MzDepositFile();
-            mzDepositFile.setChequeType("O");
-            mzDepositFile.setPsordnum(payOrderId);
-            mzDepositFile.setAgtordnum(channelOrderNo);
-            mzDepositFile.setAmount(new BigDecimal(extraParam.getString("amount")));
-            mzDepositFile.setTraceNo(mchOrderNo);
-            mzDepositFile.setTransDate(successTime);
-            mzDepositFiles.add(mzDepositFile);
-            MzDepositFileVo mzDepositFileVo = new MzDepositFileVo();
-            mzDepositFileVo.setPatientId(extraParam.getString("patientId"));
-            mzDepositFileVo.setTimes(Integer.valueOf(extraParam.getString("times")));
-            mzDepositFileVo.setReceiptNo(1);
-            mzDepositFileVo.setMzDepositFiles(mzDepositFiles);
-            mzChargeDetailService.chargeFee(mzDepositFileVo, "0.0.0.0", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ7XCJ1c2VySWRDb2RlXCI6XCI5OTk5OVwiLFwidXNlckNvZGVcIjpcIjk5OTk5XCIsXCJ1c2VyTmFtZVwiOlwi6Ieq5YqpXCJ9IiwiaXNzIjoidGh5eV9tel9zeXN0ZW0iLCJleHAiOjQxMDA2ODgwMDB9.9TcU-LPMyFVHifXuW8-lhjlVn5g8_YTukc_ds3iH73A");
+            try {
+                JSONObject extraParam = JSONObject.parseObject(extParam);
+                List<MzDepositFile> mzDepositFiles = new ArrayList<>();
+                MzDepositFile mzDepositFile = new MzDepositFile();
+                mzDepositFile.setChequeType("O");
+                mzDepositFile.setPsordnum(payOrderId);
+                mzDepositFile.setAgtordnum(channelOrderNo);
+                mzDepositFile.setAmount(new BigDecimal(extraParam.getString("amount")));
+                mzDepositFile.setTraceNo(mchOrderNo);
+                mzDepositFile.setTransDate(successTime);
+                mzDepositFiles.add(mzDepositFile);
+                MzDepositFileVo mzDepositFileVo = new MzDepositFileVo();
+                mzDepositFileVo.setPatientId(extraParam.getString("patientId"));
+                mzDepositFileVo.setTimes(Integer.valueOf(extraParam.getString("times")));
+                mzDepositFileVo.setReceiptNo(1);
+                mzDepositFileVo.setMzDepositFiles(mzDepositFiles);
+                mzChargeDetailService.chargeFee(mzDepositFileVo, "0.0.0.0", "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ7XCJ1c2VySWRDb2RlXCI6XCI5OTk5OVwiLFwidXNlckNvZGVcIjpcIjk5OTk5XCIsXCJ1c2VyTmFtZVwiOlwi6Ieq5YqpXCJ9IiwiaXNzIjoidGh5eV9tel9zeXN0ZW0iLCJleHAiOjQxMDA2ODgwMDB9.9TcU-LPMyFVHifXuW8-lhjlVn5g8_YTukc_ds3iH73A");
+            } catch (NumberFormatException e) {
+                e.printStackTrace();
+            }
             return "success";
         } else {
             return "fail";
@@ -162,10 +166,9 @@ public class NongPayService {
 
     public static void main(String[] args) {
         Map<String, String> body = new HashMap<>();
-        String notifyUrl = "https://hadln.net:20443/mz/thmz/NongPay/notifyCodeImg";
+        String notifyUrl = "{\"patientId\":\"2007028086\",\"times\":2,\"amount\":596}";
         body.put("notifyUrl", notifyUrl);
         System.out.println("生成的notifyUrl: " + notifyUrl);
-        System.out.println("body中的notifyUrl: " + body.get("notifyUrl"));
-        System.out.println(notifyUrl.equals(body.get("https: //hadln.net:20443/mz/thmz/NongPay/notifyCodeImg")));
+        System.out.println(JSONObject.parseObject(notifyUrl));
     }
 }