Explorar o código

Merge remote-tracking branch 'origin/master'

wangjun hai 3 semanas
pai
achega
43abe4fd63

+ 25 - 5
code/jyyy/nckd-jimin-jyyy-fi/src/main/java/nckd/jimin/jyyy/fi/webapi/SRMSynPayApiPlugin.java

@@ -79,7 +79,24 @@ public class SRMSynPayApiPlugin implements Serializable {
             responseData = synDailyLoanBill(dailyLoanBills);
         }
 
-        return returnResult("0", "成功", responseData);
+        String code = "0";
+        String msg = "同步成功";
+        if(responseData.size() > 0){
+            for(int i = 0; i < responseData.size(); i++){
+                JSONObject response  = responseData.getJSONObject(i);
+
+                String srmBillNo = response.getString("SRMBillNo");
+                String status = response.getString("status");
+                String message = response.getString("status");
+
+                if(!"0".equals(status)){
+                    code = "1";
+                    msg = "同步失败";
+                }
+            }
+        }
+
+        return returnResult(code, msg, responseData);
     }
 
     /**
@@ -147,7 +164,7 @@ public class SRMSynPayApiPlugin implements Serializable {
             returnMessage = "请检查以下参数 SRM单号、srmUrl、事由、申请部门、申请人职位、制单人、经办人 是否为空!";
             return buildReturnData(code, srmBillNo, returnMessage, null, null, null);
         } else if("XM".equals(billType)){
-            if(StringUtils.isEmpty(project) || StringUtils.isEmpty(contract)){
+            if(StringUtils.isEmpty(project)){
                 returnMessage = "项目类付款,请检查以下参数 项目编码、合同编码 是否为空!";
                 return buildReturnData(code, srmBillNo, returnMessage, null, null, null);
             }
@@ -697,7 +714,7 @@ public class SRMSynPayApiPlugin implements Serializable {
         String position = inputData.getString("position");//职位
         String biller = inputData.getString("biller");//制单人工号
 
-        if(StringUtils.isEmpty(srmBillNo) || StringUtils.isEmpty(srmUrl) || StringUtils.isEmpty(cause) || StringUtils.isEmpty(contract)
+        if(StringUtils.isEmpty(srmBillNo) || StringUtils.isEmpty(srmUrl) || StringUtils.isEmpty(cause)
                 || StringUtils.isEmpty(orgUnit) || StringUtils.isEmpty(position) || StringUtils.isEmpty(biller) || StringUtils.isEmpty(applier)){
             returnMessage = "请检查以下参数 SRM单号、srmUrl、合同编码、事由、申请部门、申请人职位、制单人、经办人 是否为空!";
             return buildReturnData(code, srmBillNo, returnMessage, null, null, null);
@@ -755,8 +772,11 @@ public class SRMSynPayApiPlugin implements Serializable {
         }
 
         //合同台账
-        qFilter = new QFilter("contractcode", QCP.equals, contract);
-        DynamicObject contractInfo = BusinessDataServiceHelper.loadSingle("er_contractbill", qFilter.toArray());
+        DynamicObject contractInfo = null;
+        if(!StringUtils.isEmpty(contract)) {
+            qFilter = new QFilter("contractcode", QCP.equals, contract);
+            contractInfo = BusinessDataServiceHelper.loadSingle("er_contractbill", qFilter.toArray());
+        }
 
         //单据类型
         DynamicObject billTypeInfo = CommonHelperUtils.queryBaseDynamicObject("bos_billtype", "number", "er_prepaybill_BT_S");