Преглед изворни кода

fix:“优化调用支付接口失败的返回结果”

soobin пре 1 година
родитељ
комит
bb096e871b
1 измењених фајлова са 50 додато и 1 уклоњено
  1. 50 1
      src/main/java/com/szwl/controller/TOrderController.java

+ 50 - 1
src/main/java/com/szwl/controller/TOrderController.java

@@ -235,8 +235,14 @@ public class TOrderController {
         JSONObject acctSplitBunch = new JSONObject();
         if(StringUtils.isNotEmpty(payPlatform)&&payPlatform.equals("1")){
             acctSplitBunch = getAcctSplitBunch(proportion, price, companyType);
+            if (!(acctSplitBunch.size() > 0)) {
+                return JsonMessage.error("设备商家未注册结算账号");
+            }
         } else {
             altInfo = getAltInfo(proportion, price);
+            if (!(altInfo.size() > 0)) {
+                return JsonMessage.error("设备商家未注册结算账号");
+            }
         }
 
         String orderNo = sn;
@@ -500,9 +506,15 @@ public class TOrderController {
         // 汇付分账明细参数
         JSONObject acctSplitBunch = new JSONObject();
         if(StringUtils.isNotEmpty(payPlatform)&&payPlatform.equals("1")){
-      acctSplitBunch = getAcctSplitBunch(proportion, price, companyType);
+            acctSplitBunch = getAcctSplitBunch(proportion, price, companyType);
+            if (!(acctSplitBunch.size() > 0)) {
+                return JsonMessage.error("设备商家未注册结算账号");
+            }
         } else {
             altInfo = getAltInfo(proportion, price);
+            if (!(altInfo.size() > 0)) {
+                return JsonMessage.error("设备商家未注册结算账号");
+            }
         }
 
 
@@ -750,8 +762,14 @@ public class TOrderController {
         JSONObject acctSplitBunch = new JSONObject();
         if(StringUtils.isNotEmpty(payPlatform)&&payPlatform.equals("1")){
             acctSplitBunch = getAcctSplitBunch(proportion, price, companyType);
+            if (!(acctSplitBunch.size() > 0)) {
+                return JsonMessage.error("设备商家未注册结算账号");
+            }
         } else {
             altInfo = getAltInfo(proportion, price);
+            if (!(altInfo.size() > 0)) {
+                return JsonMessage.error("设备商家未注册结算账号");
+            }
         }
 
 
@@ -1170,8 +1188,14 @@ public class TOrderController {
         JSONObject acctSplitBunch = new JSONObject();
         if(StringUtils.isNotEmpty(payPlatform)&&payPlatform.equals("1")){
             acctSplitBunch = getAcctSplitBunch(proportion, price, companyType);
+            if (!(acctSplitBunch.size() > 0)) {
+                return JsonMessage.error("设备商家未注册结算账号");
+            }
         } else {
             altInfo = getAltInfo(proportion, price);
+            if (!(altInfo.size() > 0)) {
+                return JsonMessage.error("设备商家未注册结算账号");
+            }
         }
 
 
@@ -1639,8 +1663,14 @@ public class TOrderController {
         JSONObject acctSplitBunch = new JSONObject();
         if(StringUtils.isNotEmpty(payPlatform)&&payPlatform.equals("1")){
             acctSplitBunch = getAcctSplitBunch(proportion, price, companyType);
+            if (!(acctSplitBunch.size() > 0)) {
+                return JsonMessage.error("设备商家未注册结算账号");
+            }
         } else {
             altInfo = getAltInfo(proportion, price);
+            if (!(altInfo.size() > 0)) {
+                return JsonMessage.error("设备商家未注册结算账号");
+            }
         }
         String orderNo1 = sn1;
         String productDesc = "";
@@ -3205,6 +3235,9 @@ public class TOrderController {
 
                 // 汇聚平台
                 selfMch = R.getDataIfSuccess(szwlFeign.getMch(String.valueOf(proportion.getAdminId())));
+                if (selfMch == null) {
+                    return altInfo;
+                }
                 selfJson = new JSONObject();
                 selfJson.put("altMchNo", selfMch.getAltMchNo());
                 selfJson.put("altAmount", selfAmount.toString());
@@ -3221,6 +3254,9 @@ public class TOrderController {
                 // 汇聚平台
                 agencyMch = R.getDataIfSuccess(szwlFeign.getMch(String.valueOf(proportion.getAgencyId())));
                 selfMch = R.getDataIfSuccess(szwlFeign.getMch(String.valueOf(proportion.getAdminId())));
+                if (selfMch == null || agencyMch == null) {
+                    return altInfo;
+                }
                 if(!(agencyProportion.compareTo(refuseAmount) == 0||agencyProportion==null)){
                     // 一级分销获得利润
                     agencyAmount = cutPrice.multiply(agencyProportion.divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_DOWN);
@@ -3254,6 +3290,10 @@ public class TOrderController {
                 merchantMch = R.getDataIfSuccess(szwlFeign.getMch(String.valueOf(proportion.getMerchantId())));
 
                 selfMch = R.getDataIfSuccess(szwlFeign.getMch(String.valueOf(proportion.getAdminId())));
+
+                if (selfMch == null || agencyMch == null || merchantMch == null) {
+                    return altInfo;
+                }
                 if(!(agencyProportion.compareTo(refuseAmount) == 0||agencyProportion==null)){
                     // 代理分销获得利润
                     agencyAmount = cutPrice.multiply(agencyProportion.divide(new BigDecimal(100))).setScale(2, RoundingMode.HALF_DOWN);
@@ -3342,6 +3382,9 @@ public class TOrderController {
                 // 汇付平台
                 // 商家汇付信息:agencyHuifu
                 selfHuifu = R.getDataIfSuccess(szwlFeign.getHuifuId(proportion.getAdminId()));
+                if (selfHuifu == null) {
+                    return acctSplitBunch;
+                }
                 // 公司平台分销
                 adminJson = new JSONObject();
                 adminJson.put("div_amt", adminAmount.toString());
@@ -3373,6 +3416,9 @@ public class TOrderController {
                 // 汇付平台
                 selfHuifu = R.getDataIfSuccess(szwlFeign.getHuifuId(proportion.getAdminId()));
                 agencyHuifu = R.getDataIfSuccess(szwlFeign.getHuifuId(proportion.getAgencyId()));
+                if (selfHuifu == null || agencyHuifu == null) {
+                    return acctSplitBunch;
+                }
                 // 公司平台分销
                 adminJson = new JSONObject();
                 adminJson.put("div_amt", adminAmount.toString());
@@ -3414,6 +3460,9 @@ public class TOrderController {
                 selfHuifu = R.getDataIfSuccess(szwlFeign.getHuifuId(proportion.getAdminId()));
                 agencyHuifu = R.getDataIfSuccess(szwlFeign.getHuifuId(proportion.getAgencyId()));
                 merchantHuifu = R.getDataIfSuccess(szwlFeign.getHuifuId(proportion.getMerchantId()));
+                if (selfHuifu == null || agencyHuifu == null || merchantHuifu == null) {
+                    return acctSplitBunch;
+                }
                 // 公司平台分销
                 adminJson = new JSONObject();
                 adminJson.put("div_amt", adminAmount.toString());