2 Commit-ok cf6d00fdd3 ... f7e9162c9b

Szerző SHA1 Üzenet Dátum
  “lqy f7e9162c9b Merge remote-tracking branch 'origin/master' 3 hete%!(EXTRA string=óta)
  “lqy bb95184382 1.12礼林代码提交 3 hete%!(EXTRA string=óta)

+ 81 - 42
mjava-lilin/src/main/java/com/malk/lilin/Service/impl/LiLinServiceImpl.java

@@ -159,7 +159,7 @@ public class LiLinServiceImpl implements LiLinService {
                             List<Map> xmdata = (List<Map>) ydClient.queryData(
                                     YDParam.builder()
                                             .formUuid("FORM-FFA52F0206684931A0F18C00C2C937EAAVI5")
-                                            .searchFieldJson(JSONObject.toJSONString(UtilMap.map("textField_m9awsc29, aa", xmbh,"")))
+                                            .searchFieldJson(JSONObject.toJSONString(UtilMap.map("textField_m9awsc29, aa", xmbh, "")))
                                             .build(),
                                     YDConf.FORM_QUERY.retrieve_list_all
                             ).getData();
@@ -301,7 +301,7 @@ public class LiLinServiceImpl implements LiLinService {
                                 boolean isEmptyExisting = existingValue == null ||
                                         (existingValue instanceof String && ((String) existingValue).trim().isEmpty());
                                 boolean hasValidNewValue = newValue != null &&
-                                        (! (newValue instanceof String) || !((String) newValue).trim().isEmpty());
+                                        (!(newValue instanceof String) || !((String) newValue).trim().isEmpty());
 
                                 if (isEmptyExisting && hasValidNewValue) {
                                     existingItem.put(field, newValue);
@@ -391,7 +391,7 @@ public class LiLinServiceImpl implements LiLinService {
         int pageNow = 1;
         bankMap.put("pageSize", 10);
         bankMap.put("pageNow", pageNow);
-        String bankResult=UtilHttp.doGet("https://x.xencio.com/c4c3/api/bank/searchBranch",jzHeader,bankMap);
+        String bankResult = UtilHttp.doGet("https://x.xencio.com/c4c3/api/bank/searchBranch", jzHeader, bankMap);
 
         JSONObject jsonResponse = JSONObject.parseObject(bankResult);
 
@@ -472,6 +472,7 @@ public class LiLinServiceImpl implements LiLinService {
         String response = UtilHttp.doPost(url, headers, null, null, mapAll);//批量制单
         log.info("response:{}", response);
     }
+
     @Async
     @Override
     public McR lilinZD(Map<String, Object> map) throws IOException {
@@ -534,14 +535,20 @@ public class LiLinServiceImpl implements LiLinService {
 
             for (Map<String, Object> row : tableField) {
                 String instructionId = String.valueOf(row.get("textField_mdnuob9a")); // 子表电子凭证号
-                String xmmc = String.valueOf(row.get("textField_m9lfmh1o")); // 项目名称
-                String xmbh = String.valueOf(row.get("textField_m9lfmh1p")); // 项目编号
+                String projectInfo = String.valueOf(row.get("textField_m9lfmh1o")); // 项目名称
+                String projectCode = String.valueOf(row.get("textField_m9lfmh1p")); // 项目编号
+                String businessSegment = String.valueOf(row.get("selectField_mkash8u9")); // 板块名称
+                String businessProjectStatus = String.valueOf(row.get("selectField_mkash8ua")); // 项目状态
                 String payAmount = String.valueOf(row.get("numberField_m8yf6gn1")); // 子表金额
+                String projectManager = String.valueOf(row.get("employeeField_m9lfmh1r")).replace("[\"", "").replace("\"]", "").trim(); // 项目负责人
 
                 // 构建 projectInfo
-                String projectInfo = xmbh + "-" + xmmc;
                 Map<String, Object> metaJson1 = new HashMap<>();
                 metaJson1.put("projectInfo", projectInfo);
+                metaJson1.put("businessSegment", businessSegment);
+                metaJson1.put("businessProjectStatus", businessProjectStatus);
+                metaJson1.put("projectManager", projectManager);
+                metaJson1.put("projectCode", projectCode);
                 String metaJson = JSON.toJSONString(metaJson1);
 
                 // 组装请求参数
@@ -586,12 +593,19 @@ public class LiLinServiceImpl implements LiLinService {
             // 不是物流付款单:使用主表字段,发起一次支付
             String instructionId = String.valueOf(data.get("serialNumberField_m9ze3rjd")); // 主表电子凭证号
             String payAmount = String.valueOf(data.get("numberField_m9ze3rk4")); // 主表金额
-            String xmbh = String.valueOf(data.get("textField_madmzxce"));
-            String xmmc = String.valueOf(data.get("textField_mayubz25"));
-            String projectInfo = xmbh + "-" + xmmc;
+            String projectManager = String.valueOf(data.get("employeeField_mi647wos")).replace("[\"", "").replace("\"]", "").trim(); // 项目负责人
+            String projectCode = String.valueOf(data.get("textField_madmzxce"));
+            String businessSegment = String.valueOf(data.get("selectField_mjqhty52")); // 业务板块
+            String businessProjectStatus = String.valueOf(data.get("selectField_m9ks0c66")); // 项目状态
+            String projectInfo = String.valueOf(data.get("textField_mayubz25"));
+//            String projectInfo = xmbh + "-" + xmmc;
 
             Map<String, Object> metaJson1 = new HashMap<>();
             metaJson1.put("projectInfo", projectInfo);
+            metaJson1.put("businessSegment", businessSegment);
+            metaJson1.put("businessProjectStatus", businessProjectStatus);
+            metaJson1.put("projectManager", projectManager);
+            metaJson1.put("projectCode", projectCode);
             String metaJson = JSON.toJSONString(metaJson1);
 
             Map<String, Object> mapAll = new HashMap<>();
@@ -634,7 +648,6 @@ public class LiLinServiceImpl implements LiLinService {
     }
 
 
-
     @Override
     public McR lilinJG(Map<String, Object> map) throws IOException {
         // 1. 查询所有需要处理的单据(状态为“已审批待付款”或“已审批部分付款”)
@@ -741,8 +754,8 @@ public class LiLinServiceImpl implements LiLinService {
                         } else {
                             bankTrxTime = 0L; // 空字符串时设为0
                         }
-                         zfqk = "P0000".equals(code) ? "支付成功" : "支付异常";
-                         message = dataObj != null ? dataObj.getString("message") : "";
+                        zfqk = "P0000".equals(code) ? "支付成功" : "支付异常";
+                        message = dataObj != null ? dataObj.getString("message") : "";
 
 //                        long bankTrxTime = dataObj != null ? LocalDateTime.parse(dataObj.getString("bankTrxTime"), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))
 //                                .atZone(ZoneId.systemDefault()).toInstant().toEpochMilli() : 0L;
@@ -871,11 +884,11 @@ public class LiLinServiceImpl implements LiLinService {
     @Override
     public McR lilinLS(Map<String, Object> map) {
         List<String> khdaList = Arrays.asList(
-                "1001260509024819590","121911279910703",
-                "1001260509424880696","931004010000963305",
-                "1001260509324868573","440382314019",
-                "1001260509324808614","31050161373600008173",
-                "1001260509424865022","1001260509300324484",
+                "1001260509024819590", "121911279910703",
+                "1001260509424880696", "931004010000963305",
+                "1001260509324868573", "440382314019",
+                "1001260509324808614", "31050161373600008173",
+                "1001260509424865022", "1001260509300324484",
                 "1001260509300325413"
         );
 
@@ -1071,7 +1084,7 @@ public class LiLinServiceImpl implements LiLinService {
                                         .formUuid("FORM-E18CC7F3495B45BB852CB386F325BF03IAS3")
                                         .appType("APP_RPH7R3LF3SMXLRDY1ZJW")
                                         .systemToken("7M866K91D4LVACB4EADAZ5UJG7IN3OGA33WAMNT")
-                                        .searchCondition(JSON.toJSONString(UtilMap.map("textField_m8sjaafp, aa", customerName,"")))
+                                        .searchCondition(JSON.toJSONString(UtilMap.map("textField_m8sjaafp, aa", customerName, "")))
                                         .build(),
                                 YDConf.FORM_QUERY.retrieve_list_all
                         ).getData();
@@ -1087,7 +1100,7 @@ public class LiLinServiceImpl implements LiLinService {
                                     break;
                                 }
                             }
-                        }else{
+                        } else {
                             khaccountName = customerName;
                         }
 
@@ -1117,7 +1130,7 @@ public class LiLinServiceImpl implements LiLinService {
                                     Arrays.asList(getkhAss(khaccountName, khformInstanceId)));
                             formData.put("textField_m9i9k5cj", khaccountbh);
                         }
-                            formData.put("textField_mbh8usao", khaccountName);
+                        formData.put("textField_mbh8usao", khaccountName);
 
                         // 提交创建流程
                         ydClient.operateData(
@@ -1345,6 +1358,10 @@ public class LiLinServiceImpl implements LiLinService {
             Map<String, Object> mapItem = new HashMap<>();
             mapItem.put("id", item.getInteger("id"));
             mapItem.put("projectInfo", item.getString("projectInfo"));
+            mapItem.put("businessSegment", item.getString("businessSegment"));
+            mapItem.put("businessProjectStatus", item.getString("businessProjectStatus"));
+            mapItem.put("projectManager", item.getString("projectManager"));
+            mapItem.put("projectCode", item.getString("projectCode"));
             result.add(mapItem);
         }
 
@@ -1367,6 +1384,7 @@ public class LiLinServiceImpl implements LiLinService {
         // 返回结果(可附加统计)
         return McR.success(result);
     }
+
     // 构建“以产定销”类型的数据(来自 tableField1)
     private Map<String, Object> buildItemForChanXiao(Map<String, Object> row,
                                                      int index,
@@ -1374,18 +1392,23 @@ public class LiLinServiceImpl implements LiLinService {
                                                      String transFlag,
                                                      String catalogName) {
         Map<String, Object> item = new HashMap<>();
-        item.put("itemIndex", index + 1);
 
         // amount 取 numberField_md5e3oib
         BigDecimal amount = getAmountFromMap(row, "numberField_mfq6budd");
-        item.put("amount", amount != null ? amount.doubleValue() : 0.0);
-
         // projectInfo = textField_md5e3oih + "-" + textField_md5e3oig
-        String part1 = getStringValue(row, "textField_md5e3oih");
-        String part2 = getStringValue(row, "textField_md5e3oig");
-        String projectInfo = (part1 != null ? part1 : "") + "-" + (part2 != null ? part2 : "");
+        String projectCode = getStringValue(row, "textField_md5e3oih");
+        String businessSegment = getStringValue(row, "selectField_mkamgsc7");
+        String businessProjectStatus = getStringValue(row, "selectField_mkamgsc5");
+        String projectManager = getStringValue(row, "employeeField_mkamgscb").replace("[\"", "").replace("\"]", "").trim();
+        String projectInfo = getStringValue(row, "textField_md5e3oig");
+//        String projectInfo = (part1 != null ? part1 : "") + "-" + (part2 != null ? part2 : "");
+        item.put("itemIndex", index + 1);
+        item.put("amount", amount != null ? amount.doubleValue() : 0.0);
         item.put("projectInfo", projectInfo);
-
+        item.put("projectCode", projectCode);
+        item.put("businessSegment", businessSegment);
+        item.put("businessProjectStatus", businessProjectStatus);
+        item.put("projectManager", projectManager);
         item.put("userMemo", userMemo);
         item.put("trxFlag", transFlag);
         item.put("catalogName", catalogName);
@@ -1400,24 +1423,29 @@ public class LiLinServiceImpl implements LiLinService {
                                                      String transFlag,
                                                      String catalogName) {
         Map<String, Object> item = new HashMap<>();
-        item.put("itemIndex", index + 1);
 
+        String projectCode = getStringValue(row, "textField_m9i9k5cl");
+        String projectInfo = getStringValue(row, "textField_m8yedujm");
+//        String projectInfo = (part1 != null ? part1 : "") + "-" + (part2 != null ? part2 : "");
+        String businessSegment = getStringValue(row, "selectField_mjqhty52");
+        String businessProjectStatus = getStringValue(row, "selectField_m9ks0c66");
+        String projectManager = getStringValue(row, "employeeField_m8yedujw").replace("[\"", "").replace("\"]", "").trim();
         // amount 取 numberField_m9u2a5tf
         BigDecimal amount = getAmountFromMap(row, "numberField_m9u2a5tf");
+        item.put("itemIndex", index + 1);
         item.put("amount", amount != null ? amount.doubleValue() : 0.0);
-
-        // projectInfo = textField_m9i9k5cl + "-" + textField_m8yedujm
-        String part1 = getStringValue(row, "textField_m9i9k5cl");
-        String part2 = getStringValue(row, "textField_m8yedujm");
-        String projectInfo = (part1 != null ? part1 : "") + "-" + (part2 != null ? part2 : "");
         item.put("projectInfo", projectInfo);
-
+        item.put("projectCode", projectCode);
+        item.put("businessSegment", businessSegment);
+        item.put("businessProjectStatus", businessProjectStatus);
+        item.put("projectManager", projectManager);
         item.put("userMemo", userMemo);
         item.put("trxFlag", transFlag);
         item.put("catalogName", catalogName);
 
         return item;
     }
+
     @Override
     public McR taskPLJG() {
         List<Map> list = (List<Map>) ydClient.queryData(YDParam.builder()
@@ -1428,6 +1456,7 @@ public class LiLinServiceImpl implements LiLinService {
                                 "SelectField",
                                 YDSearch.Type.RADIO_FIELD,
                                 YDSearch.Operator.EQ)
+//                        new YDSearch("radioField_mimhsd0h", "否", "是否创建付款通知", YDSearch.Type.RADIO_FIELD, YDSearch.Operator.EQ)
                 )))
                 .build(), YDConf.FORM_QUERY.retrieve_list_all).getData();
 //        List<Map> list = (List<Map>) ydClient.queryData(YDParam.builder()
@@ -1492,7 +1521,7 @@ public class LiLinServiceImpl implements LiLinService {
                 String toAccountCode = getStringValue(data, "textField_m9ze3rjs"); // 收款账号
                 String toAccountName = getStringValue(data, "textField_m9ze3rjl"); // 收款户名
 
-                List<String> sqr =UtilMap.getList(data, "employeeField_madmj9kw_id");// 申请人
+                List<String> sqr = UtilMap.getList(data, "employeeField_madmj9kw_id");// 申请人
                 String fklsh = getStringValue(data, "textField_ma13ih7u"); // 付款流程编号
                 String toBank = getStringValue(data, "textField_m9ze3rjr"); // 收款银行支行
                 String cghtbh = getStringValue(data, "textField_madmzxcf"); // 采购合同编号
@@ -1563,8 +1592,8 @@ public class LiLinServiceImpl implements LiLinService {
                 // 构建目标数据
                 Map<String, Object> formData = new HashMap<>();
                 formData.put("tableField_ma13k7v1", updateList);
-                formData.put("dateField_me2m2oeu",  data.get("dateField_me2m3mmd"));
-                formData.put("selectField_megv3ask",  "接口创建");
+                formData.put("dateField_me2m2oeu", data.get("dateField_me2m3mmd"));
+                formData.put("selectField_megv3ask", "接口创建");
                 formData.put("numberField_mac3ccn8", PayAmount);
                 formData.put("textField_mdsk7rlm", mainInstructionId); // 主流水号用于去重
                 formData.put("employeeField_m8yf6gkl", Arrays.asList("275412081437800471"));
@@ -1580,13 +1609,22 @@ public class LiLinServiceImpl implements LiLinService {
 //                                "textField_mdsk7rlm", mainInstructionId, "付款通知单流水号", YDSearch.Type.TEXT_FIELD, YDSearch.Operator.EQ))))
 //                        .formDataJson(JSONObject.toJSONString(formData))
 //                        .build(), YDConf.FORM_OPERATION.upsert);
-                ydClient.operateData(YDParam.builder()
-                        .formUuid("FORM-6B8A683A23524D3596C8C6CA13327EF3552K")
-                        .formDataJson(JSON.toJSONString(formData))
+                try {
+//                    ydClient.operateData(YDParam.builder()
+//                            .formInstId(formInstanceId)
+//                            .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("radioField_mimhsd0h","是")))
+//                            .build(), YDConf.FORM_OPERATION.update);
+                    ydClient.operateData(YDParam.builder()
+                            .formUuid("FORM-6B8A683A23524D3596C8C6CA13327EF3552K")
+                            .formDataJson(JSON.toJSONString(formData))
 //                        .userId("275412081437800471")
-                        .build(), YDConf.FORM_OPERATION.create);
+                            .build(), YDConf.FORM_OPERATION.create);
+
+                    log.info("成功插入新数据:mainInstructionId={}, 付款类型={}", mainInstructionId, fklx);
+                } catch (Exception e) {
+                    log.info("处理单据异常:mainInstructionId={}, error={}", mainInstructionId, e.getMessage(), e);
+                }
 
-                log.info("成功插入新数据:mainInstructionId={}, 付款类型={}", mainInstructionId, fklx);
 
             } catch (Exception e) {
                 log.error("处理单据时发生异常", e);
@@ -1595,6 +1633,7 @@ public class LiLinServiceImpl implements LiLinService {
 
         return McR.success();
     }
+
     @Async
     @Override
     public McR lilinBatchUpdate(Map<String, Object> map) throws IOException {