ソースを参照

Merge remote-tracking branch 'origin/master'

lfx 3 週間 前
コミット
5cdc859a76
共有36 個のファイルを変更した2733 個の追加445 個の削除を含む
  1. 1 1
      mjava-fenggefushi/src/main/java/com/malk/fenggefushi/controller/HeiHuOrderController.java
  2. 4 4
      mjava-fenggefushi/src/main/java/com/malk/fenggefushi/service/Impl/HeiHuOrderServiceImpl.java
  3. 12 0
      mjava-fenggefushi/src/main/java/com/malk/fenggefushi/test/test.java
  4. 1 1
      mjava-fenggefushi/src/main/resources/application.yml
  5. 122 32
      mjava-huagao/src/main/java/com/malk/huagao/controller/HgEqbController.java
  6. 245 20
      mjava-huagao/src/main/java/com/malk/huagao/controller/KdYdCustomerController.java
  7. 88 0
      mjava-huagao/src/main/java/com/malk/huagao/controller/QccController.java
  8. 4 1
      mjava-huagao/src/main/java/com/malk/huagao/schedule/KdScheduleTask.java
  9. 2 2
      mjava-huagao/src/main/java/com/malk/huagao/schedule/YdScheduleTask.java
  10. 13 0
      mjava-huagao/src/main/java/com/malk/huagao/service/QccService.java
  11. 2 0
      mjava-huagao/src/main/java/com/malk/huagao/service/YdHuaGaoService.java
  12. 5 3
      mjava-huagao/src/main/java/com/malk/huagao/service/impl/KdHuaGaoServiceImpl.java
  13. 123 24
      mjava-huagao/src/main/java/com/malk/huagao/service/impl/KdYdDeliveryServiceImpl.java
  14. 58 57
      mjava-huagao/src/main/java/com/malk/huagao/service/impl/KdYdOrderServiceImpl.java
  15. 2 0
      mjava-huagao/src/main/java/com/malk/huagao/service/impl/KdYdOutboundServiceImpl.java
  16. 457 0
      mjava-huagao/src/main/java/com/malk/huagao/service/impl/QccServiceImpl.java
  17. 8 1
      mjava-huagao/src/main/java/com/malk/huagao/service/impl/YdHuaGaoServiceImpl.java
  18. 9 1
      mjava-huagao/src/main/resources/application-dev.yml
  19. 6 1
      mjava-huagao/src/main/resources/application-prod.yml
  20. 6 1
      mjava-huagao/src/main/resources/application-prod2.yml
  21. 31 0
      mjava-junengtai/src/main/java/com/malk/junengtai/controller/PurchaseController.java
  22. 38 0
      mjava-ounuo/src/main/java/com/malk/tuosi/config/AsyncConfig.java
  23. 785 271
      mjava-ounuo/src/main/java/com/malk/tuosi/schedule/ScheduleTask.java
  24. 3 1
      mjava-ounuo/src/main/java/com/malk/tuosi/service/TBService.java
  25. 29 1
      mjava-ounuo/src/main/java/com/malk/tuosi/service/impl/TbServiceImpl.java
  26. 1 1
      mjava-qiwang/src/main/java/com/malk/qiwang/Controller/InvoiceLibraryController.java
  27. 42 5
      mjava-qiwang/src/main/java/com/malk/qiwang/Controller/QiWangController.java
  28. 65 10
      mjava-qiwang/src/main/java/com/malk/qiwang/Service/impl/InvoiceLibraryServiceImpl.java
  29. 4 0
      mjava-qiwang/src/main/java/com/malk/qiwang/entity/InvoiceLibrary.java
  30. 5 0
      mjava-zhiwei/pom.xml
  31. 12 1
      mjava-zhiwei/src/main/java/com/malk/zhiwei/schedule/ScheduleTask.java
  32. 9 0
      mjava-zhiwei/src/main/java/com/malk/zhiwei/service/ZwService.java
  33. 353 5
      mjava-zhiwei/src/main/java/com/malk/zhiwei/service/impl/ZwServiceImpl.java
  34. 58 0
      mjava-zhiwei/src/main/java/com/malk/zhiwei/test/DingTalkUtil.java
  35. 129 0
      mjava-zhiwei/src/main/java/com/malk/zhiwei/test/test.java
  36. 1 1
      mjava-zhongche/src/main/resources/application.yml

+ 1 - 1
mjava-fenggefushi/src/main/java/com/malk/fenggefushi/controller/HeiHuOrderController.java

@@ -96,7 +96,7 @@ public class HeiHuOrderController {
     /*todo:定时抓取采购订单*/
     @SneakyThrows
     @PostMapping("/test12")
-    @Scheduled(cron = "0 */5 * * * ?")
+//    @Scheduled(cron = "0 */5 * * * ?")
     McR purchaseSchedule(){
         List<Map<String, Object>> dataList = huOrderService.queryAllPurchase();
 

+ 4 - 4
mjava-fenggefushi/src/main/java/com/malk/fenggefushi/service/Impl/HeiHuOrderServiceImpl.java

@@ -1404,7 +1404,7 @@ public class HeiHuOrderServiceImpl implements HeiHuOrderService {
                                     List<Map> sonList = ydService.queryDetails(YDParam.builder()
                                             .appType(ydConf.getAppType()).systemToken(ydConf.getSystemToken())
                                             .formInstanceId(UtilMap.getString(oldDataList.get(0),"textField_mmx9gycu"))
-                                            .formUuid("FORM-3A54B12BE3D241218A75242B935F2987YWV2")
+                                            .formUuid("FORM-6B1ADCF1439442448E90B9D46548319440Y5")
                                             .tableFieldId("tableField_ml6g7k5d")
                                             .build());
                                     if (ObjectUtil.isNotNull(sonList) && sonList.size() > 0){
@@ -1419,7 +1419,7 @@ public class HeiHuOrderServiceImpl implements HeiHuOrderService {
                                     List<Map> sonFaxList = ydService.queryDetails(YDParam.builder()
                                             .appType(ydConf.getAppType()).systemToken(ydConf.getSystemToken())
                                             .formInstanceId(UtilMap.getString(oldDataList.get(0),"textField_mmx9gycu"))
-                                            .formUuid("FORM-3A54B12BE3D241218A75242B935F2987YWV2")
+                                            .formUuid("FORM-6B1ADCF1439442448E90B9D46548319440Y5")
                                             .tableFieldId("tableField_ml7ch2pj")
                                             .build());
                                     if (ObjectUtil.isNotNull(sonFaxList) && sonFaxList.size() > 0){
@@ -1466,7 +1466,7 @@ public class HeiHuOrderServiceImpl implements HeiHuOrderService {
                             String userId = getDDToken(purchaserName);
                             ydClient.operateData(YDParam.builder()
                                     .appType(ydConf.getAppType()).systemToken(ydConf.getSystemToken())
-                                    .formUuid("FORM-3A54B12BE3D241218A75242B935F2987YWV2")  // 高毛利率使用原表单
+                                    .formUuid("FORM-6B1ADCF1439442448E90B9D46548319440Y5")  // 高毛利率使用原表单
                                     .userId(userId)
                                     .formDataJson(JSON.toJSONString(formdataHigh))
                                     .build(), YDConf.FORM_OPERATION.start).toString();
@@ -1509,7 +1509,7 @@ public class HeiHuOrderServiceImpl implements HeiHuOrderService {
                             // ========== 修改点9:如果低毛利率需要不同表单,可以在这里修改formUuid ==========
                             ydClient.operateData(YDParam.builder()
                                     .appType(ydConf.getAppType()).systemToken(ydConf.getSystemToken())
-                                    .formUuid("FORM-3A54B12BE3D241218A75242B935F2987YWV2")  // 如果需要不同流程,替换这里的UUID
+                                    .formUuid("FORM-6B1ADCF1439442448E90B9D46548319440Y5")  // 如果需要不同流程,替换这里的UUID
                                     .userId(userId)
                                     .formDataJson(JSON.toJSONString(formdataLow))
                                     .build(), YDConf.FORM_OPERATION.start).toString();

+ 12 - 0
mjava-fenggefushi/src/main/java/com/malk/fenggefushi/test/test.java

@@ -460,6 +460,18 @@ public class test {
         return McR.success();
     }
 
+    /*发起流程*/
+    @PostMapping("/test87")
+    McR test87(){
+        ydClient.operateData(YDParam.builder()
+                .appType(ydConf.getAppType()).systemToken(ydConf.getSystemToken())
+                .formUuid("FORM-3A54B12BE3D241218A75242B935F2987YWV2")
+                .userId("3320511511-1158713155")
+                .formDataJson(JSON.toJSONString(""))
+                .build(), YDConf.FORM_OPERATION.start).toString();
+        return McR.success();
+    }
+
 
 
 }

+ 1 - 1
mjava-fenggefushi/src/main/resources/application.yml

@@ -1,3 +1,3 @@
 spring:
   profiles:
-    active: prod
+    active: dev

+ 122 - 32
mjava-huagao/src/main/java/com/malk/huagao/controller/HgEqbController.java

@@ -10,11 +10,16 @@ import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.HttpHeaders;
+import org.springframework.http.HttpStatus;
 import org.springframework.http.MediaType;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.mvc.method.annotation.StreamingResponseBody;
 
 import java.io.IOException;
+import java.io.InputStream;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
 import java.nio.file.Files;
 import java.nio.file.Path;
 import java.nio.file.Paths;
@@ -80,48 +85,133 @@ public class HgEqbController {
 
         return McR.success();
     }
-
     @GetMapping("/files/{fileId}")
-    public ResponseEntity<Resource> getFileResource(
+    public ResponseEntity<StreamingResponseBody> getFileResource(
             @PathVariable String fileId,
-            @RequestParam(defaultValue = "download") String option) throws IOException {
+            @RequestParam(defaultValue = "download") String option) {
 
-        // 根据fileId获取实际文件路径,这里简化处理,实际可能需要从数据库查询
-        Path filePath = Paths.get(fileStoragePath).resolve(fileId).normalize();
+        long startTime = System.currentTimeMillis();
+        log.info("文件请求: fileId={}, option={}", fileId, option);
 
-        // 检查文件是否存在
-        if (!Files.exists(filePath)) {
-            return ResponseEntity.notFound().build();
-        }
+        try {
+            Path filePath = Paths.get(fileStoragePath).resolve(fileId).normalize();
+            if (!Files.exists(filePath)) {
+                log.warn("文件不存在: {}", fileId);
+                return ResponseEntity.notFound().build();
+            }
 
-        // 创建Resource对象
-        Resource resource =  new UrlResource(filePath.toUri());
+            long fileSize = Files.size(filePath);
+            String fileName = filePath.getFileName().toString();
+
+            long MAX_PREVIEW_SIZE = 50 * 1024 * 1024;
+            if ("preview".equalsIgnoreCase(option) && fileSize > MAX_PREVIEW_SIZE) {
+                log.warn("预览文件过大: fileId={}, size={}MB", fileId, String.format("%.2f", fileSize / 1024.0 / 1024.0));
+                return ResponseEntity.status(HttpStatus.PAYLOAD_TOO_LARGE).build();
+            }
 
-        // 根据选项设置响应头
-        HttpHeaders headers = new HttpHeaders();
-        if ("preview".equalsIgnoreCase(option)) {
-            // 预览模式 - 尝试确定内容类型
+            HttpHeaders headers = new HttpHeaders();
             String contentType = Files.probeContentType(filePath);
-            // 强制修正 PDF 的 Content-Type
-            if (filePath.toString().toLowerCase().endsWith(".pdf")) {
-                contentType = "application/pdf";
-            } else if (contentType == null) {
-                contentType = "application/octet-stream";
+            // ✅ 修复:参数顺序正确 (字符串, 字符集)
+            String encodedFileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8.name()).replaceAll("\\+", "%20");
+
+            if (fileName.toLowerCase().endsWith(".pdf")) contentType = "application/pdf";
+            else if (fileName.toLowerCase().endsWith(".jpg") || fileName.toLowerCase().endsWith(".jpeg")) contentType = "image/jpeg";
+            else if (fileName.toLowerCase().endsWith(".png")) contentType = "image/png";
+            else if (fileName.toLowerCase().endsWith(".gif")) contentType = "image/gif";
+            else if (fileName.toLowerCase().endsWith(".mp4")) contentType = "video/mp4";
+            else if (fileName.toLowerCase().endsWith(".mp3")) contentType = "audio/mpeg";
+            else if (fileName.toLowerCase().endsWith(".txt")) contentType = "text/plain";
+            else if (contentType == null) contentType = "application/octet-stream";
+
+            if ("preview".equalsIgnoreCase(option)) {
+                headers.setContentType(MediaType.parseMediaType(contentType));
+                headers.add("Content-Disposition", "inline; filename=\"" + encodedFileName + "\"; filename*=UTF-8''" + encodedFileName);
+                headers.add("X-Content-Type-Options", "nosniff");
+                headers.add("Cache-Control", "max-age=300");
+            } else {
+                headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
+                headers.add("Content-Disposition", "attachment; filename=\"" + encodedFileName + "\"; filename*=UTF-8''" + encodedFileName);
+                headers.add("Accept-Ranges", "bytes");
+                headers.add("Cache-Control", "no-cache");
             }
-            headers.setContentType(MediaType.parseMediaType(contentType));
-            headers.add("Content-Disposition", "inline; filename=\"" + resource.getFilename() + "\"");
-            headers.add("X-Content-Type-Options", "nosniff"); // 防止浏览器忽略 Content-Type
-        } else {
-            // 下载模式 - 默认处理
-            headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
-            headers.add("Content-Disposition", "attachment; filename=\"" + resource.getFilename() + "\"");
-        }
+            headers.add("Access-Control-Allow-Origin", "*");
+
+            StreamingResponseBody responseBody = outputStream -> {
+                try (InputStream inputStream = Files.newInputStream(filePath)) {
+                    byte[] buffer = new byte[8192];
+                    int bytesRead;
+                    long totalWritten = 0;
+                    while ((bytesRead = inputStream.read(buffer)) != -1) {
+                        try {
+                            outputStream.write(buffer, 0, bytesRead);
+                            outputStream.flush();
+                            totalWritten += bytesRead;
+                        } catch (IOException e) {
+                            if (e.getMessage() != null && (e.getMessage().toLowerCase().contains("broken pipe") || e.getMessage().contains("断开的管道"))) {
+                                log.warn("客户端断开: fileId={}, 已传输={}MB", fileId, String.format("%.2f", totalWritten / 1024.0 / 1024.0));
+                                return;
+                            }
+                            throw e;
+                        }
+                    }
+                    log.info("文件传输完成: fileId={}, size={}MB, 耗时={}ms", fileId, String.format("%.2f", fileSize / 1024.0 / 1024.0), System.currentTimeMillis() - startTime);
+                } catch (IOException e) {
+                    if (e.getMessage() != null && (e.getMessage().toLowerCase().contains("broken pipe") || e.getMessage().contains("断开的管道"))) {
+                        log.warn("客户端断开: fileId={}", fileId);
+                        return;
+                    }
+                    throw e;
+                }
+            };
 
-        return ResponseEntity.ok()
-                .headers(headers)
-                .contentLength(resource.contentLength())
-                .body(resource);
+            return ResponseEntity.ok().headers(headers).contentLength(fileSize).body(responseBody);
+
+        } catch (Exception e) {
+            log.error("文件服务异常: fileId={}", fileId, e);
+            return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
+        }
     }
+//    @GetMapping("/files/{fileId}")
+//    public ResponseEntity<Resource> getFileResource(
+//            @PathVariable String fileId,
+//            @RequestParam(defaultValue = "download") String option) throws IOException {
+//
+//        // 根据fileId获取实际文件路径,这里简化处理,实际可能需要从数据库查询
+//        Path filePath = Paths.get(fileStoragePath).resolve(fileId).normalize();
+//
+//        // 检查文件是否存在
+//        if (!Files.exists(filePath)) {
+//            return ResponseEntity.notFound().build();
+//        }
+//
+//        // 创建Resource对象
+//        Resource resource =  new UrlResource(filePath.toUri());
+//
+//        // 根据选项设置响应头
+//        HttpHeaders headers = new HttpHeaders();
+//        if ("preview".equalsIgnoreCase(option)) {
+//            // 预览模式 - 尝试确定内容类型
+//            String contentType = Files.probeContentType(filePath);
+//            // 强制修正 PDF 的 Content-Type
+//            if (filePath.toString().toLowerCase().endsWith(".pdf")) {
+//                contentType = "application/pdf";
+//            } else if (contentType == null) {
+//                contentType = "application/octet-stream";
+//            }
+//            headers.setContentType(MediaType.parseMediaType(contentType));
+//            headers.add("Content-Disposition", "inline; filename=\"" + resource.getFilename() + "\"");
+//            headers.add("X-Content-Type-Options", "nosniff"); // 防止浏览器忽略 Content-Type
+//        } else {
+//            // 下载模式 - 默认处理
+//            headers.setContentType(MediaType.APPLICATION_OCTET_STREAM);
+//            headers.add("Content-Disposition", "attachment; filename=\"" + resource.getFilename() + "\"");
+//        }
+//
+//        return ResponseEntity.ok()
+//                .headers(headers)
+//                .contentLength(resource.contentLength())
+//                .body(resource);
+//    }
 
     /**
      * 检查并清理过期事件

+ 245 - 20
mjava-huagao/src/main/java/com/malk/huagao/controller/KdYdCustomerController.java

@@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.malk.huagao.service.IKdYdCustomerService;
 import com.malk.huagao.service.IKdYdZpService;
+import com.malk.huagao.service.KdHuaGaoService;
 import com.malk.huagao.service.YdHuaGaoService;
 import com.malk.server.aliwork.YDConf;
 import com.malk.server.aliwork.YDParam;
@@ -34,6 +35,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.time.LocalDate;
 import java.time.ZoneId;
 import java.util.*;
@@ -69,14 +72,62 @@ public class KdYdCustomerController {
     private DDConf ddConf;
     @Autowired
     private YDService ydService;
-
+    @Autowired
+    private KdHuaGaoService kdHuaGaoService;
     @PostMapping("/test")
     public McR sendGroupMsg(@RequestBody JSONObject param) {
         log.info("推送消息:{}", param);
-        McException.assertParamException_Null(param, "msgParam", "msgKey", "openConversationId", "robotCode", "coolAppCode");
-        Map map = ddClientExtension.sendGroupMessages(ddClient.getAccessToken(), param.getJSONObject("msgParam"), param.getString("msgKey"), param.getString("openConversationId")
-                , param.getString("robotCode"), param.getString("coolAppCode"));
-        return McR.success(map);
+//        McException.assertParamException_Null(param, "msgParam", "msgKey", "openConversationId", "robotCode", "coolAppCode");
+//        Map map = ddClientExtension.sendGroupMessages(ddClient.getAccessToken(), param.getJSONObject("msgParam"), param.getString("msgKey"), param.getString("openConversationId")
+//                , param.getString("robotCode"), param.getString("coolAppCode"));
+        kdHuaGaoService.syncPendingProducts();
+        return McR.success();
+    }
+    @PostMapping("/test35")
+    McR test21(@RequestBody Map data) {
+        MDC.put("MDC_KEY_PID", "1003");
+        String formInstId = (String) data.get("formInstanceId");
+        DDR_New ddrNew = ydClient.queryData(YDParam.builder()
+                .formInstId(formInstId)
+                .build(), YDConf.FORM_QUERY.retrieve_id);
+        Map formData = ddrNew.getFormData();
+        String djlx = UtilMap.getString(formData, "multiSelectField_mso35h9i");
+        System.out.println("==="+djlx);
+        return McR.success(formData);
+    }
+
+    public static void main(String[] args) throws ParseException {
+
+// 原始数据
+        List<String> zklxList = Arrays.asList("001", "003");
+        int num1 = 10;
+        int num2 = 20;
+
+// 创建目标数组
+        JSONArray targetArray = new JSONArray();
+
+// 方式1:按索引逐个添加
+        JSONObject obj1 = new JSONObject();
+        obj1.put("FNumber", zklxList.get(0));
+        obj1.put("num", num1);
+        targetArray.add(obj1);
+
+        JSONObject obj2 = new JSONObject();
+        obj2.put("FNumber", zklxList.get(1));
+        obj2.put("num", num2);
+        targetArray.add(obj2);
+
+// 组装到最终对象
+        JSONObject finalData = new JSONObject();
+        finalData.put("FZKLX", targetArray);
+        System.out.println(finalData);
+        System.out.println(finalData.toJSONString());
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        Date date = sdf.parse("2026-08-01");
+        Calendar calendar = Calendar.getInstance();
+        calendar.set(2026, 7, 1);  // 8月 = 7(月份从0开始)
+
+        System.out.println(calendar.getTimeInMillis());
     }
     @PostMapping("/test33")
     public McR test18(@RequestBody Map data) {
@@ -182,21 +233,21 @@ public class KdYdCustomerController {
             long days = (releaseTime - now + dayMillis - 1) / dayMillis;
 
             String msg = null;
-            if ("未成交".equals(type)) {
-                msg = khmc + " 客户近三个月内未成交,还剩 " + days + " 天即将释放到公海";
-            } else if ("半年金额不足".equals(type)) {
-                msg = khmc + " 客户近半年内成交未达到7.5w,还剩 " + days + " 天即将释放到公海";
-            } else if ("一年金额不足".equals(type)) {
-                msg = khmc + " 客户近一年内成交未达到15w,还剩 " + days + " 天即将释放到公海";
-            }
-
-            if (msg != null) {
-                try {
-                    sendDdMsg(accessToken, agentId, sqr, msg);
-                } catch (Exception e) {
-                    log.warn("发送钉钉提醒失败,formInstanceId={},原因:{}", formInstanceId, e.getMessage());
-                }
-            }
+//            if ("未成交".equals(type)) {
+//                msg = khmc + " 客户近三个月内未成交,还剩 " + days + " 天即将释放到公海";
+//            } else if ("半年金额不足".equals(type)) {
+//                msg = khmc + " 客户近半年内成交未达到7.5w,还剩 " + days + " 天即将释放到公海";
+//            } else if ("一年金额不足".equals(type)) {
+//                msg = khmc + " 客户近一年内成交未达到15w,还剩 " + days + " 天即将释放到公海";
+//            }
+//
+//            if (msg != null) {
+//                try {
+//                    sendDdMsg(accessToken, agentId, sqr, msg);
+//                } catch (Exception e) {
+//                    log.warn("发送钉钉提醒失败,formInstanceId={},原因:{}", formInstanceId, e.getMessage());
+//                }
+//            }
         }
 
         // ========== 批量释放(微调:增加批次间隔) ==========
@@ -251,6 +302,180 @@ public class KdYdCustomerController {
         log.info("处理完成,查询 {} 条,到期释放 {} 条", list.size(), totalSuccess);
         return McR.success("处理完成,查询 " + list.size() + " 条,到期释放 " + totalSuccess + " 条");
     }
+
+    @PostMapping("/test34")
+    public McR sendReleaseNotice() throws ParseException {
+        MDC.put("MDC_KEY_PID", "1003");
+
+        final int maxRetry = 3;
+        final long retryInterval = 2000L;
+        final String formUuid = "FORM-F79B680547674A6BBD11C0D511E3C14B28FY";
+        final String noticeUrl = "https://crycnl.aliwork.com/APP_VQDMMWS6OR1VHL8VMFD3/submission/FORM-9F03E175B6A44A1A961E00D2A1FFED05ON7C";
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+        Date date = sdf.parse("2026-08-01");
+        List<Map> list = null;
+        for (int attempt = 1; attempt <= maxRetry; attempt++) {
+            try {
+                list = ydService.queryFormData_all(
+                        YDParam.builder()
+                                .formUuid(formUuid)
+                                .searchFieldJson(JSONObject.toJSONString(Arrays.asList(
+//                                        new YDSearch("dateField_mjm9k35l", System.currentTimeMillis(),
+                                        new YDSearch("dateField_mjm9k35l", date.getTime(),
+                                                "DateField", YDSearch.Type.DATE_FIELD, YDSearch.Operator.LE),
+//                                                        new YDSearch("textField_mjm9k35n", "666",
+//                                                "TextField", YDSearch.Type.TEXT_FIELD, YDSearch.Operator.EQ),
+                                        new YDSearch("radioField_mru0o7u6", "是",
+                                                "RadioField", YDSearch.Type.RADIO_FIELD, YDSearch.Operator.EQ)
+                                )))
+                                .build()
+                );
+                break;
+            } catch (Exception e) {
+                log.warn("查询公海预警数据第 {} 次失败:{}", attempt, e.getMessage());
+                if (attempt == maxRetry) {
+                    return McR.errorParam("查询公海预警数据失败:" + e.getMessage());
+                }
+                if (!waitForRetry(retryInterval)) {
+                    return McR.errorParam("查询公海预警数据被中断");
+                }
+            }
+        }
+
+        if (list == null || list.isEmpty()) {
+            return McR.success("无待通知数据");
+        }
+
+        Set<String> userIds = new LinkedHashSet<>();
+        for (Map item : list) {
+            userIds.addAll(parseUserIds(item.get("employeeField_mjm9k35m_id")));
+        }
+        if (userIds.isEmpty()) {
+            return McR.success("查询 " + list.size() + " 条数据,未找到可通知人员");
+        }
+
+        String accessToken = null;
+        for (int attempt = 1; attempt <= maxRetry; attempt++) {
+            try {
+                accessToken = ddClient.getAccessToken();
+                break;
+            } catch (Exception e) {
+                log.warn("获取钉钉 accessToken 第 {} 次失败:{}", attempt, e.getMessage());
+                if (attempt == maxRetry) {
+                    return McR.errorParam("获取钉钉 accessToken 失败:" + e.getMessage());
+                }
+                if (!waitForRetry(retryInterval)) {
+                    return McR.errorParam("获取钉钉 accessToken 被中断");
+                }
+            }
+        }
+
+        int successCount = 0;
+        int failureCount = 0;
+        for (String userId : userIds) {
+            boolean sent = false;
+            for (int attempt = 1; attempt <= maxRetry; attempt++) {
+                try {
+                    sendDdLinkMsg(accessToken, ddConf.getAgentId(), userId,
+                            "流入公海预警", "还有1天流入公海,点击查看客户详情", noticeUrl);
+                    sent = true;
+                    successCount++;
+                    break;
+                } catch (Exception e) {
+                    log.warn("发送公海预警通知第 {} 次失败,原因:{}", attempt, e.getMessage());
+                    if (attempt < maxRetry && !waitForRetry(retryInterval)) {
+                        break;
+                    }
+                }
+            }
+            if (!sent) {
+                failureCount++;
+            }
+        }
+
+        log.info("公海预警通知完成,查询 {} 条,人员 {} 人,成功 {} 人,失败 {} 人",
+                list.size(), userIds.size(), successCount, failureCount);
+        return McR.success("处理完成,查询 " + list.size() + " 条,人员 " + userIds.size()
+                + " 人,成功 " + successCount + " 人,失败 " + failureCount + " 人");
+    }
+
+    private Set<String> parseUserIds(Object value) {
+        Set<String> userIds = new LinkedHashSet<>();
+        if (value == null) {
+            return userIds;
+        }
+
+        if (value instanceof Collection) {
+            for (Object item : (Collection) value) {
+                String userId = String.valueOf(item);
+                if (StringUtils.isNotBlank(userId) && !"null".equals(userId)) {
+                    userIds.add(userId);
+                }
+            }
+            return userIds;
+        }
+
+        String text = String.valueOf(value);
+        try {
+            JSONArray array = JSON.parseArray(text);
+            if (array != null) {
+                for (Object item : array) {
+                    String userId = String.valueOf(item);
+                    if (StringUtils.isNotBlank(userId) && !"null".equals(userId)) {
+                        userIds.add(userId);
+                    }
+                }
+                return userIds;
+            }
+        } catch (Exception ignored) {
+            // Some responses return a single user ID instead of a JSON array.
+        }
+
+        if (StringUtils.isNotBlank(text) && !"null".equals(text)) {
+            userIds.add(text);
+        }
+        return userIds;
+    }
+
+    private boolean waitForRetry(long interval) {
+        try {
+            Thread.sleep(interval);
+            return true;
+        } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
+            return false;
+        }
+    }
+
+    private void sendDdLinkMsg(String accessToken, Number agentId, String userId,
+                               String title, String text, String messageUrl) {
+        Map<String, Object> query = new HashMap<>();
+        query.put("access_token", accessToken);
+
+        Map<String, Object> link = new HashMap<>();
+        link.put("messageUrl", messageUrl);
+        link.put("picUrl", "1");
+        link.put("title", title);
+        link.put("text", text);
+
+        Map<String, Object> msg = new HashMap<>();
+        msg.put("msgtype", "link");
+        msg.put("link", link);
+
+        Map<String, Object> body = new HashMap<>();
+        body.put("agent_id", agentId);
+        body.put("userid_list", userId);
+        body.put("msg", msg);
+
+        String response = UtilHttp.doPost(
+                "https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2",
+                null, query, body);
+        JSONObject result = JSON.parseObject(response);
+        if (result == null || result.getIntValue("errcode") != 0) {
+            throw new IllegalStateException("钉钉接口返回失败:" + response);
+        }
+    }
+
     @PostMapping("/test32")
     McR test13(@RequestBody Map data) {
         MDC.put("MDC_KEY_PID", "1003");

+ 88 - 0
mjava-huagao/src/main/java/com/malk/huagao/controller/QccController.java

@@ -0,0 +1,88 @@
+package com.malk.huagao.controller;
+
+import com.malk.huagao.config.QccProperties;
+import com.malk.huagao.service.QccService;
+import com.malk.server.common.McR;
+import lombok.extern.slf4j.Slf4j;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.RequestParam;
+
+import java.util.Map;
+
+@Slf4j
+@RestController
+@RequestMapping("/hg")
+public class QccController {
+    @Autowired
+    private QccService qccService;
+
+    @Autowired
+    private QccProperties qccProperties;
+
+    @PostMapping("/qccYida")
+    public McR qccYida(@RequestBody Map<String, Object> request,
+                       @RequestHeader(value = "X-Internal-Token", required = false) String internalToken) {
+        MDC.put("MDC_KEY_PID", "1003");
+//        authorize(internalToken);
+        String keyword = requiredKeyword(request == null ? null : request.get("keyword"));
+        String currentFormInstanceId = request == null || request.get("currentFormInstanceId") == null
+                ? null : String.valueOf(request.get("currentFormInstanceId"));
+        return McR.success(qccService.searchInternalCustomer(keyword, currentFormInstanceId));
+    }
+
+    @GetMapping("/qcc/fuzzy-search")
+    public McR fuzzySearch(@RequestParam String searchKey,
+                           @RequestParam(required = false, defaultValue = "1") Integer pageIndex
+//                           @RequestHeader(value = "X-Internal-Token", required = false) String internalToken
+                           )
+    {
+//        authorize(internalToken);
+        if (pageIndex == null || pageIndex < 1) {
+            return McR.errorParam("pageIndex 必须大于 0");
+        }
+        return McR.success(qccService.fuzzySearch(requiredKeyword(searchKey), pageIndex));
+    }
+
+    @GetMapping("/qccCreditCodeQuery")
+    public McR creditCodeQuery(@RequestParam String searchKey) {
+        return McR.success(qccService.creditCodeQuery(requiredKeyword(searchKey)));
+    }
+
+    @GetMapping("/qcc/enterprise-verify")
+    public McR enterpriseVerify(@RequestParam String searchKey,
+                                @RequestHeader(value = "X-Internal-Token", required = false) String internalToken) {
+//        authorize(internalToken);
+        return McR.success(qccService.verifyEnterprise(requiredKeyword(searchKey)));
+    }
+
+    private void authorize(String internalToken) {
+        if (isBlank(qccProperties.getInternalToken())) {
+            throw new IllegalStateException("企查查内部调用令牌未配置");
+        }
+        if (!qccProperties.getInternalToken().equals(internalToken)) {
+            throw new SecurityException("无权调用企业信息查询服务");
+        }
+    }
+
+    private String requiredKeyword(Object value) {
+        String keyword = value == null ? "" : String.valueOf(value).trim();
+        if (keyword.isEmpty()) {
+            throw new IllegalArgumentException("企业名称或统一社会信用代码不能为空");
+        }
+        if (keyword.length() > 100) {
+            throw new IllegalArgumentException("查询关键词不能超过 100 个字符");
+        }
+        return keyword;
+    }
+
+    private boolean isBlank(String value) {
+        return value == null || value.trim().isEmpty();
+    }
+}

+ 4 - 1
mjava-huagao/src/main/java/com/malk/huagao/schedule/KdScheduleTask.java

@@ -32,9 +32,12 @@ public class KdScheduleTask {
     }
 
     //每周六 18:00定时处理待处理品数据
-    @Scheduled(cron = "0 0 18 * * 6")
+    @Scheduled(cron = "0 8 18 * * 6")
+//    @Scheduled(cron = "0 6 15 * * *")
     public void syncPendingProducts(){
+        log.info("开始同步待处理商品数据");
         kdHuaGaoService.syncPendingProducts();
+        log.info("完成同步待处理商品数据");
     }
 
     //每天00:00定时同步生产退料明细

+ 2 - 2
mjava-huagao/src/main/java/com/malk/huagao/schedule/YdScheduleTask.java

@@ -48,7 +48,7 @@ private YdHuaGaoService ydHuaGaoService;
         }
     }
     //定时客户流入公海池
-    @Scheduled(cron = "0 0 4 * * ?")
+    @Scheduled(cron = "0 0 7 * * ?")
     public void synckdlrgh() {
         log.info("定时同步-客户流入公海池信息");
         try {
@@ -58,7 +58,7 @@ private YdHuaGaoService ydHuaGaoService;
             log.error("【客户流入公海池信息同步任务】执行过程中发生严重错误", e);
         }
     }
-//    @Scheduled(cron = "0 0 2 * * ?")
+    @Scheduled(cron = "0 0 6 * * ?")
     public void synckdndrq() {
         log.info("定时同步-年度日期信息");
         try {

+ 13 - 0
mjava-huagao/src/main/java/com/malk/huagao/service/QccService.java

@@ -0,0 +1,13 @@
+package com.malk.huagao.service;
+
+import java.util.Map;
+
+public interface QccService {
+    Map<String, Object> searchInternalCustomer(String keyword, String currentFormInstanceId);
+
+    Map<String, Object> fuzzySearch(String searchKey, Integer pageIndex);
+
+    Map<String, Object> creditCodeQuery(String searchKey);
+
+    Map<String, Object> verifyEnterprise(String searchKey);
+}

+ 2 - 0
mjava-huagao/src/main/java/com/malk/huagao/service/YdHuaGaoService.java

@@ -33,4 +33,6 @@ public interface YdHuaGaoService {
     McR synckdlrgh();
 
     McR synckdndrq();
+
+
 }

+ 5 - 3
mjava-huagao/src/main/java/com/malk/huagao/service/impl/KdHuaGaoServiceImpl.java

@@ -698,10 +698,11 @@ public class KdHuaGaoServiceImpl implements KdHuaGaoService {
         int month = today.getMonthValue();//当前月份
         WeekFields weekFields = WeekFields.of(Locale.getDefault());
         int weekOfMonth = today.get(weekFields.weekOfMonth());//当前日期是当月的第几周
+//        int weekOfMonth = 2;
 
-        /*int year = 2025;//获取当前年份
-        int month = 12;//当前月份
-        int weekOfMonth = 4;//当前日期是当月的第几周*/
+//        int year = 2026;//获取当前年份
+//        int month = 2;//当前月份
+//        int weekOfMonth = 1;//当前日期是当月的第几周
 
         DDR_New ddrNew = new DDR_New();
         int pageSize = 100;
@@ -726,6 +727,7 @@ public class KdHuaGaoServiceImpl implements KdHuaGaoService {
             }
         }while (ddrNew.getPageNumber() * pageSize < ddrNew.getTotalCount());
 
+        System.out.println("list数量"+list.size());
         //删除宜搭历史最新库存信息
         List<Map> data = (List<Map>) ydClient.queryData(YDParam.builder()
                 .formUuid("FORM-BC40899D61134DDFB80E6C693E9EA930Y6NW")

+ 123 - 24
mjava-huagao/src/main/java/com/malk/huagao/service/impl/KdYdDeliveryServiceImpl.java

@@ -140,7 +140,7 @@ public class KdYdDeliveryServiceImpl extends ServiceImpl<KdYdDeliveryMapper, KdY
             String bzfs = UtilMap.getString(formData, "selectField_mf6a0h5y");
             String hqdmb = UtilMap.getString(formData, "selectField_mg4hjsig");
             String bz = UtilMap.getString(formData, "textareaField_mejnamfb");
-            String ckddh = UtilMap.getString(formData, "textField_mqg2b2g5");
+//            String ckddh = UtilMap.getString(formData, "textField_mqg2b2g5");
 //            LocalDateTime hhsj = parseTimestamp(UtilMap.getString(formData, "dateField_mf6a0h67"));
             LocalDateTime hhsj = Optional.ofNullable(
                             parseTimestamp(UtilMap.getString(formData, "dateField_mf6a0h67"))
@@ -183,6 +183,7 @@ public class KdYdDeliveryServiceImpl extends ServiceImpl<KdYdDeliveryMapper, KdY
                     String mdh = safeGetString(item, "textField_mf6a0h6y");
                     String sku = safeGetString(item, "textField_mqg2b2g6");
                     String skuh = safeGetString(item, "textField_mqg2p1zi");
+                    String xfckdh = safeGetString(item, "textField_mqg2b2g5");
                     LocalDateTime yhrq = parseTimestamp(safeGetString(item, "dateField_mejnamfo"));
 
                     table1Map.put("wlbm", wlbm);
@@ -205,6 +206,7 @@ public class KdYdDeliveryServiceImpl extends ServiceImpl<KdYdDeliveryMapper, KdY
                     table1Map.put("sjdz", sjdz);
                     table1Map.put("zbq", zbq);
                     table1Map.put("kddh", kddh);
+                    table1Map.put("xfckdh", xfckdh);
                     table1Map.put("mdh", mdh);
 
                     deliveryList.add(table1Map);
@@ -217,7 +219,7 @@ public class KdYdDeliveryServiceImpl extends ServiceImpl<KdYdDeliveryMapper, KdY
             deliveryData.put("djlx", djlx);
             deliveryData.put("orderId", orderId);
             deliveryData.put("rq", rq);
-            deliveryData.put("ckddh", ckddh);
+//            deliveryData.put("ckddh", ckddh);
             deliveryData.put("kh", kh);
             deliveryData.put("jsbb", jsbb);
             deliveryData.put("djbh", djbh);
@@ -368,47 +370,135 @@ public class KdYdDeliveryServiceImpl extends ServiceImpl<KdYdDeliveryMapper, KdY
         // 解析关联字段 JSON
         List<Map> sealjsonlist = parseJsonList(glbdjson);
 
-
         // 获取原表单的子表数据
         List<Map> tableField = UtilMap.getList(formData1, "tableField_mejnamfd");
         if (tableField == null || tableField.isEmpty()) {
             return;
         }
 
-        // 按 dz 分组
-        Map<String, List<Map>> groupedByDz = new LinkedHashMap<>();
+        // ========== 判断是否需要按 textField_mqg2b2g5 额外拆分 ==========
+        boolean hasMatchKey = false;
+        for (Map item : tableField) {
+            String matchKey = UtilMap.getString(item, "textField_mqg2b2g5");
+            if (matchKey != null && !matchKey.trim().isEmpty()) {
+                hasMatchKey = true;
+                break;
+            }
+        }
+
+        // 分组逻辑:先按地址分组
+        Map<String, List<Map>> groupedByAddress = new LinkedHashMap<>();
         for (Map item : tableField) {
             String dz = UtilMap.getString(item, "textareaField_mf6a0h5e");
             if (dz == null) dz = "";
-            groupedByDz.computeIfAbsent(dz, k -> new ArrayList<>()).add(item);
+            groupedByAddress.computeIfAbsent(dz, k -> new ArrayList<>()).add(item);
         }
 
-        // 对每个 dz 分组,创建一条新表单
-        for (Map.Entry<String, List<Map>> entry : groupedByDz.entrySet()) {
-            String dz = entry.getKey();
-            List<Map> subTableRows = entry.getValue();
+        // 最终要处理的分组数据
+        List<List<Map>> finalGroups = new ArrayList<>();
+
+        for (Map.Entry<String, List<Map>> entry : groupedByAddress.entrySet()) {
+            List<Map> rows = entry.getValue();
+
+            // 检查这个地址下是否有 textField_mqg2b2g5 非空
+            boolean addressHasMatchKey = false;
+            for (Map item : rows) {
+                String matchKey = UtilMap.getString(item, "textField_mqg2b2g5");
+                if (matchKey != null && !matchKey.trim().isEmpty()) {
+                    addressHasMatchKey = true;
+                    break;
+                }
+            }
+
+            if (!addressHasMatchKey) {
+                // 所有行都没有 textField_mqg2b2g5:整批作为一组
+                finalGroups.add(rows);
+            } else {
+                // 有 textField_mqg2b2g5:按数量 1:2 配对
+                List<Map> nonEmptyRows = new ArrayList<>();
+                List<Map> emptyRows = new ArrayList<>();
+
+                for (Map row : rows) {
+                    String matchKey = UtilMap.getString(row, "textField_mqg2b2g5");
+                    if (matchKey != null && !matchKey.trim().isEmpty()) {
+                        nonEmptyRows.add(row);
+                    } else {
+                        emptyRows.add(row);
+                    }
+                }
+
+                // 按数量排序(从小到大)
+                nonEmptyRows.sort((a, b) -> {
+                    int aNum = getIntValue(a, "numberField_mejnamfl");
+                    int bNum = getIntValue(b, "numberField_mejnamfl");
+                    return Integer.compare(aNum, bNum);
+                });
+                emptyRows.sort((a, b) -> {
+                    int aNum = getIntValue(a, "numberField_mejnamfl");
+                    int bNum = getIntValue(b, "numberField_mejnamfl");
+                    return Integer.compare(aNum, bNum);
+                });
+
+                // 用 Set 记录已匹配的空值行
+                Set<Integer> usedEmptyIndex = new HashSet<>();
+
+                // 遍历非空行,找数量为其 2 倍的空值行配对
+                for (Map nonEmptyRow : nonEmptyRows) {
+                    int nonEmptyNum = getIntValue(nonEmptyRow, "numberField_mejnamfl");
+                    List<Map> pair = new ArrayList<>();
+                    pair.add(nonEmptyRow);
+
+                    boolean matched = false;
+                    for (int i = 0; i < emptyRows.size(); i++) {
+                        if (usedEmptyIndex.contains(i)) continue;
+                        int emptyNum = getIntValue(emptyRows.get(i), "numberField_mejnamfl");
+                        // 非空行数量 × 2 = 空值行数量
+                        if (emptyNum == 2 * nonEmptyNum) {
+                            pair.add(emptyRows.get(i));
+                            usedEmptyIndex.add(i);
+                            matched = true;
+                            break;
+                        }
+                    }
+
+                    finalGroups.add(pair);
 
+                    // 如果没有匹配到,记录日志(异常情况)
+                    if (!matched) {
+                        log.warn("未找到数量为 {} 的2倍的空值行进行配对", nonEmptyNum);
+                    }
+                }
+
+                // 处理剩余未匹配的空值行(如果有)
+                for (int i = 0; i < emptyRows.size(); i++) {
+                    if (!usedEmptyIndex.contains(i)) {
+                        List<Map> single = new ArrayList<>();
+                        single.add(emptyRows.get(i));
+                        finalGroups.add(single);
+                        log.warn("剩余未匹配的空值行,数量={}", getIntValue(emptyRows.get(i), "numberField_mejnamfl"));
+                    }
+                }
+            }
+        }
+
+        // 遍历每个分组,创建新表单
+        for (List<Map> subTableRows : finalGroups) {
             // 构建新子表数据
             List<Map> newSubTable = new ArrayList<>();
             for (Map row : subTableRows) {
                 newSubTable.add(new HashMap<>(row));
             }
 
-            // 构建新表单的formData
             HashMap<String, Object> updateMap = new HashMap<>();
 
-            // 1. 首先复制原表单的所有主表数据
             for (Object obj : formData1.entrySet()) {
                 Map.Entry<String, Object> formEntry = (Map.Entry<String, Object>) obj;
                 String key = formEntry.getKey();
                 Object value = formEntry.getValue();
 
-                // 跳过不需要特殊处理的子表字段
                 if ("tableField_mejnamfd".equals(key)) {
                     continue;
                 }
-
-                // 跳过需要特殊处理的主表关联字段
                 if (key.equals("associationFormField_mejmml36_id") ||
                         key.equals("associationFormField_mfavc4ve_id") ||
                         key.equals("associationFormField_mk0gzflu_id") ||
@@ -419,27 +509,23 @@ public class KdYdDeliveryServiceImpl extends ServiceImpl<KdYdDeliveryMapper, KdY
                         key.equals("serialNumberField_mheazm7w")) {
                     continue;
                 }
-
-                // 复制其他字段
                 updateMap.put(key, value);
             }
 
-            // 2. 添加需要特殊处理的主表字段
             updateMap.put("associationFormField_mejmml36", sealjsonlist);
-//            updateMap.put("associationFormField_mfavc4ve", khjsonlist);
             updateMap.put("associationFormField_mk0gzflu", Arrays.asList(getfhdAss(fhtzd, formInstId)));
             updateMap.put("employeeField_krbgloal", sqr);
             updateMap.put("employeeField_mejnamf3", xsy);
             updateMap.put("employeeField_mmsna3tn", xszg);
             updateMap.put("employeeField_mmsna3tm", zssj);
             updateMap.put("textField_mjzk47so", fhtzd);
-            // 3. 添加处理后的子表数据
             updateMap.put("tableField_mejnamfd", newSubTable);
+
             String sqrid = sqr.substring(2, sqr.length() - 2);
             String xszgid = xszg.substring(2, xszg.length() - 2);
             String finalId = (sqrid == null || sqrid.trim().isEmpty()) ? xszgid : sqrid;
             System.out.println("sqrid==" + sqrid);
-            // 创建新表单实例
+
             try {
                 retryOperateData(
                         YDParam.builder()
@@ -449,12 +535,11 @@ public class KdYdDeliveryServiceImpl extends ServiceImpl<KdYdDeliveryMapper, KdY
                                 .build(),
                         YDConf.FORM_OPERATION.create
                 );
-
             } catch (Exception e) {
-                log.error("创建新单据失败,dz=" + dz, e);
+                log.error("创建新单据失败", e);
             }
             try {
-                Thread.sleep(3000);
+                Thread.sleep(6000);
             } catch (InterruptedException e) {
                 Thread.currentThread().interrupt();
                 log.error("线程被中断", e);
@@ -462,6 +547,20 @@ public class KdYdDeliveryServiceImpl extends ServiceImpl<KdYdDeliveryMapper, KdY
         }
     }
 
+    /**
+     * 安全获取 Map 中的整数值
+     */
+    private int getIntValue(Map map, String key) {
+        Object obj = map.get(key);
+        if (obj == null) return 0;
+        try {
+            return Integer.parseInt(String.valueOf(obj));
+        } catch (NumberFormatException e) {
+            return 0;
+        }
+    }
+
+
     // 工具方法:安全解析 JSON 列表(处理宜搭返回的带引号字符串)
     private List<Map> parseJsonList(String jsonStr) {
         if (jsonStr == null || "null".equals(jsonStr) || jsonStr.isEmpty()) {

+ 58 - 57
mjava-huagao/src/main/java/com/malk/huagao/service/impl/KdYdOrderServiceImpl.java

@@ -205,6 +205,10 @@ public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder
                     String wlbm = safeGetString(item, "textField_mfbx1pqt");
 //                    String wlbm = "010101010003";
                     String wlmc = safeGetString(item, "textField_mfbx1pqs");
+                    String zklx1 = safeGetString(item, "selectField_mssmufw9");
+                    String zklx2 = safeGetString(item, "selectField_mssmufwb");
+                    BigDecimal zkje1 = toBigDecimal(safeGetString(item, "numberField_mssmufwa"));
+                    BigDecimal zkje2 = toBigDecimal(safeGetString(item, "numberField_mssmufwc"));
 //                    String kzfh = safeGetString1(item, "radioField_mqyje8pg");
                     String sku = safeGetString(item, "textField_mqg2b2g6");
                     String tcfpfs = safeGetString(item, "textField_mpqmsz2q");
@@ -231,7 +235,12 @@ public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder
                     BigDecimal xsjzj = toBigDecimal(safeGetString(item, "numberField_mfbx1pr0"));
                     String zmzs = safeGetString(item, "textField_mfxv2vgv");
 
+
                     // 设置明细字段
+                    table1Map.put("zklx1", zklx1);
+                    table1Map.put("zkje1", zkje1);
+                    table1Map.put("zklx2", zklx2);
+                    table1Map.put("zkje2", zkje2);
                     table1Map.put("detailId", detailId);
                     table1Map.put("wlbm", wlbm);
                     table1Map.put("sku", sku);
@@ -396,6 +405,7 @@ public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder
         try {
             String formInstId = UtilMap.getString(map, "formInstId");
             String khbm = UtilMap.getString(map, "khbm");
+            String Type = UtilMap.getString(map, "type"); // 新增参数:add 或 update
 
             // 参数校验
             if (StringUtils.isBlank(formInstId)) {
@@ -404,6 +414,9 @@ public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder
             if (StringUtils.isBlank(khbm)) {
                 throw new RuntimeException("客户编号不能为空");
             }
+            if (StringUtils.isBlank(Type)) {
+                throw new RuntimeException("操作类型不能为空,请传 add 或 update");
+            }
 
             // 1. 查询订单详情
             DDR_New ddrNew = retryQueryData(YDParam.builder()
@@ -416,6 +429,7 @@ public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder
 
             Map formData1 = ddrNew.getFormData();
             String ddje = UtilMap.getString(formData1, "numberField_mfxv2vgj");
+            String lsddje = UtilMap.getString(formData1, "numberField_ms4hecbw");
             Long zhcjrq = UtilMap.getLong(formData1, "dateField_mejowmnb");
 
             // 订单金额校验
@@ -428,8 +442,6 @@ public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder
             try {
                 orderAmount = Double.parseDouble(ddje);
                 orderAmount = Math.round(orderAmount * 100.0) / 100.0;
-
-                // 订单金额合理性校验
                 if (orderAmount < 0) {
                     throw new RuntimeException("订单金额不能为负数: " + orderAmount);
                 }
@@ -437,9 +449,29 @@ public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder
                 throw new RuntimeException("订单金额格式错误: " + ddje, e);
             }
 
-            System.out.println("订单信息:订单ID=" + formInstId +
-                    ", 订单金额=" + orderAmount +
-                    ", 客户编号=" + khbm);
+            // ========== 核心:根据操作类型计算差额 ==========
+            Double diff = 0.0;
+            Double oldAmount = 0.0;
+
+            if ("add".equals(Type)) {
+                // 新增:累加全部订单金额
+                diff = orderAmount;
+                System.out.println("新增订单,累加金额: " + diff);
+            } else if ("update".equals(Type)) {
+                // 修改:计算差额(新金额 - 旧金额)
+                if (StringUtils.isNotBlank(lsddje)) {
+                    try {
+                        oldAmount = Double.parseDouble(lsddje);
+                        oldAmount = Math.round(oldAmount * 100.0) / 100.0;
+                    } catch (NumberFormatException e) {
+                        oldAmount = 0.0;
+                    }
+                }
+                diff = orderAmount - oldAmount;
+                System.out.println("修改订单,旧金额: " + oldAmount + ", 新金额: " + orderAmount + ", 差额: " + diff);
+            } else {
+                throw new RuntimeException("无效的操作类型: " + Type + ",请传 add 或 update");
+            }
 
             // 3. 查询客户历史信息
             Object result = retryQueryData(YDParam.builder()
@@ -459,11 +491,12 @@ public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder
                 throw new RuntimeException("未找到客户信息,客户编号:" + khbm);
             }
 
-            // 4. 获取客户现有信息并进行数据完整性校验
+            // 4. 获取客户现有信息
             Map customerData = (Map) list.get(0).get("formData");
             Double historicalAmount = UtilMap.getDouble(customerData, "numberField_mjm9k35k");
             Long dddateTimestampStr = UtilMap.getLong(customerData, "dateField_mjqkkcsg");
             Long sfdateTimestampStr = UtilMap.getLong(customerData, "dateField_mjm9k35l");
+            Long annualResetTimestamp = UtilMap.getLong(customerData, "dateField_mjz31qkm");
             String originalSelectFieldValue = UtilMap.getString(customerData, "selectField_l3nrjuq0");
             String originalKhsx = UtilMap.getString(customerData, "selectField_mjsco9d4");
 
@@ -473,13 +506,10 @@ public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder
             }
 
             if (historicalAmount == null) {
-                // 历史金额为null时,记录错误日志并抛出异常,避免错误清零
-                System.err.println("严重错误:未能获取到客户历史金额,客户编号:" + khbm +
-                        ",返回数据:" + JSONObject.toJSONString(customerData));
-                throw new RuntimeException("无法获取客户历史金额,客户编号:" + khbm + ",请检查数据完整性");
+                historicalAmount = 0.0;
             }
 
-            // 记录更新前的数据快照,便于问题追踪
+            // 记录更新前的数据快照
             System.out.println("更新前数据快照:客户编号=" + khbm +
                     ", 历史金额=" + historicalAmount +
                     ", 最后成交日期=" + timestampToDateString(dddateTimestampStr) +
@@ -487,32 +517,14 @@ public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder
                     ", 销售属性=" + originalKhsx +
                     ", 选择字段=" + originalSelectFieldValue);
 
-            // 5. 金额计算和校验
+            // 5. 金额计算
             historicalAmount = Math.round(historicalAmount * 100.0) / 100.0;
-            Double totalAmount = orderAmount + historicalAmount;
+            Double totalAmount = historicalAmount + diff;
             totalAmount = Math.round(totalAmount * 100.0) / 100.0;
 
-            // 金额变化监控:检测异常的大幅减少
-            if (totalAmount < historicalAmount && totalAmount < historicalAmount * 0.5) {
-                String errorMsg = String.format(
-                        "警告:金额异常减少!客户编号=%s, 订单金额=%.2f, 原历史金额=%.2f, 新总金额=%.2f, 减少比例=%.2f%%",
-                        khbm, orderAmount, historicalAmount, totalAmount,
-                        (historicalAmount - totalAmount) / historicalAmount * 100
-                );
-                System.err.println(errorMsg);
-                // 根据业务需求决定是否抛出异常
-                // throw new RuntimeException(errorMsg);
-            }
-
-            // 订单金额为0时的特殊处理:保持原金额不变
-            if (orderAmount == 0 && historicalAmount > 0) {
-                System.out.println("订单金额为0,保持原累计金额不变:" + historicalAmount);
-                totalAmount = historicalAmount;
-            }
-
-            System.out.println("金额计算:订单金额=" + orderAmount +
-                    ", 历史金额=" + historicalAmount +
-                    ", 总金额=" + totalAmount);
+            System.out.println("金额计算:历史金额=" + historicalAmount +
+                    ", 差额=" + diff +
+                    ", 新总金额=" + totalAmount);
 
             // 6. 时间计算
             long currentTimestamp = System.currentTimeMillis();
@@ -537,29 +549,27 @@ public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder
 
             // 业务规则判断
             if (currentToDdDays < 90 && totalAmount > 0 && Math.abs(sfToDdDays - 180) <= 1) {
-                // 条件1:在成交日期上加90天
                 ghcDateTimestamp = String.valueOf(calculateTimestamp(sfdateTimestampStr, 90));
                 selectFieldValue = "半年金额不足";
                 System.out.println("条件1触发:公海池时间设为成交日期+90天=" +
                         timestampToDateString(ghcDateTimestamp));
             } else if (totalAmount >= 75000 && sfToDdDays <= 180) {
-                // 条件2:在成交日期上加180天
                 ghcDateTimestamp = String.valueOf(calculateTimestamp(sfdateTimestampStr, 180));
                 selectFieldValue = "半年金额不足";
                 System.out.println("条件2触发:公海池时间设为成交日期+180天=" +
                         timestampToDateString(ghcDateTimestamp));
             } else if (totalAmount < 150000 && sfToDdDays > 180) {
-                // 条件3:设置一年金额不足,但不设置公海池日期
                 selectFieldValue = "一年金额不足";
                 System.out.println("条件3触发:金额<15万且公海日期>180天,设置一年金额不足");
-            } else if (totalAmount > 150000) {
-                // 【新增】总金额大于15万:释放公海池日期设为成交日期的下一年第一天
-                ghcDateTimestamp = getNextYearFirstDay(dddateTimestampStr);
+            } else if (totalAmount >= 150000) {
+                if (annualResetTimestamp == null || annualResetTimestamp <= 0) {
+                    throw new RuntimeException("年度重置日期不能为空,客户编号:" + khbm);
+                }
+
+                ghcDateTimestamp = String.valueOf(annualResetTimestamp);
                 selectFieldValue = "金额充足";
-                System.out.println("条件4触发:总金额>15万,公海池时间设为成交日期下一年第一天=" +
-                        timestampToDateString(ghcDateTimestamp));
+                khsx = "自行开发";
             } else {
-                // 其他情况
                 if (totalAmount > 0) {
                     ghcDateTimestamp = String.valueOf(calculateTimestamp(sfdateTimestampStr, 90));
                     selectFieldValue = "半年金额不足";
@@ -574,13 +584,13 @@ public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder
                 }
             }
 
-            // 8. 构建更新数据(只更新需要变更的字段)
+            // 8. 构建更新数据
             Map<String, Object> formData = new HashMap<>();
 
             // 必须更新的字段
-            formData.put("dateField_mjm9k35j", zhcjrq);  // 最后成交日期
-            formData.put("numberField_mjm9k35k", totalAmount);       // 累计金额
-            formData.put("selectField_mjsco9d4", khsx);              // 销售属性
+            formData.put("dateField_mjm9k35j", zhcjrq);
+            formData.put("numberField_mjm9k35k", totalAmount);
+            formData.put("selectField_mjsco9d4", khsx);
 
             // 条件更新:只在有值时才更新 selectField
             if (selectFieldValue != null && !selectFieldValue.isEmpty()) {
@@ -592,7 +602,6 @@ public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder
 
             // 条件更新:只在明确需要变更公海池日期时才更新
             if (ghcDateTimestamp != null) {
-                // 只有当新值与旧值不同时才更新
                 String newDateStr = timestampToDateString(ghcDateTimestamp);
                 String oldDateStr = sfdateTimestampStr != null ? timestampToDateString(String.valueOf(sfdateTimestampStr)) : "空";
                 if (!newDateStr.equals(oldDateStr)) {
@@ -602,21 +611,13 @@ public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder
                     System.out.println("公海池日期未变化,跳过更新:" + newDateStr);
                 }
             } else {
-                // 不设置该字段,upsert操作会保持原值不变
                 System.out.println("公海池日期无需变更,保持原值:" +
                         (sfdateTimestampStr != null ? timestampToDateString(String.valueOf(sfdateTimestampStr)) : "空"));
             }
 
-            // 9. 数据变更前最终校验
-            if (totalAmount == 0 && historicalAmount > 0) {
-                System.err.println("警告:即将把客户金额从 " + historicalAmount + " 更新为 0,请确认业务逻辑!");
-                // 可选:根据业务需求决定是否继续执行
-                // throw new RuntimeException("金额异常清零,操作已阻止");
-            }
-
             System.out.println("最终更新数据:" + JSONObject.toJSONString(formData));
 
-            // 10. 执行更新操作(retryOperateData已内置重试功能)
+            // 9. 执行更新操作
             retryOperateData(YDParam.builder()
                     .formUuid("FORM-F79B680547674A6BBD11C0D511E3C14B28FY")
                     .appType("APP_VQDMMWS6OR1VHL8VMFD3")

+ 2 - 0
mjava-huagao/src/main/java/com/malk/huagao/service/impl/KdYdOutboundServiceImpl.java

@@ -163,6 +163,7 @@ public class KdYdOutboundServiceImpl extends ServiceImpl<KdYdOutboundMapper, KdY
 //                        tablemap.put("textField_mg34txgm", String.valueOf(tableItem.get("djbh")));
                         tablemap.put("textField_mejnamff", String.valueOf(item1.get("wlbm")));
                         tablemap.put("textField_mejnamfg", String.valueOf(item1.get("wlmc")));
+                        tablemap.put("textField_mszue0v2", String.valueOf(item1.get("ddbh")));
                         tablemap.put("textField_mg34txh1", String.valueOf(item1.get("tpsb")));
                         tablemap.put("textField_mejnamfh", String.valueOf(item1.get("ggxh")));
                         tablemap.put("textField_mejnamfk", String.valueOf(item1.get("kcdw")));
@@ -211,6 +212,7 @@ public class KdYdOutboundServiceImpl extends ServiceImpl<KdYdOutboundMapper, KdY
                                         xlhMap.put("textField_mf6a0h6w", item);
                                         xlhMap.put("textField_mjqst61l", String.valueOf(item1.get("wlbm")));
                                         xlhMap.put("textField_mjqst61m", String.valueOf(item1.get("ggxh")));
+                                        xlhMap.put("textField_mt2qky5r", String.valueOf(item1.get("ddbh")));
                                         return xlhMap;
                                     })
                                     .collect(Collectors.toList());

File diff suppressed because it is too large
+ 457 - 0
mjava-huagao/src/main/java/com/malk/huagao/service/impl/QccServiceImpl.java


+ 8 - 1
mjava-huagao/src/main/java/com/malk/huagao/service/impl/YdHuaGaoServiceImpl.java

@@ -1829,7 +1829,14 @@ public class YdHuaGaoServiceImpl implements YdHuaGaoService {
         log.info("共查询到 {} 条待处理单据", list.size());
 
         for (Map item : list) {
+            String warningType = UtilMap.getString(item, "selectField_l3nrjuq0");
+
+            if ("金额充足".equals(warningType)) {
+                log.info("客户金额充足,跳过公海释放,等待年度周期重置");
+                continue;
+            }
             long releaseTime = UtilMap.getLong(item, "dateField_mjm9k35l");
+
             if (releaseTime <= 0) {
                 log.warn("释放日期为空,跳过:{}", item);
                 continue;
@@ -1982,7 +1989,7 @@ public class YdHuaGaoServiceImpl implements YdHuaGaoService {
 
         Map<String, Object> upData = new HashMap<>();
         upData.put("dateField_mjm9k35j", endTime);
-        upData.put("dateField_mjqkkcsg", endTime);
+//        upData.put("dateField_mjqkkcsg", endTime);
         upData.put("numberField_mjm9k35k", 0);
         upData.put("selectField_l3nrjuq0", "未成交");
         upData.put("dateField_mjz31qkm", ndTime);

+ 9 - 1
mjava-huagao/src/main/resources/application-dev.yml

@@ -67,7 +67,8 @@ kingdee:
   # X-KDApi-RequestTimeout: 120
 
 eqb:
-  downloadFilePath: C:\\Users\\EDY\\Desktop\\项目\\华高\\电子签\\files\\
+#  downloadFilePath: C:\\Users\\EDY\\Desktop\\项目\\华高\\电子签\\files\\
+  downloadFilePath: C:\\Users\\EDY\\Desktop\\project\\qw\\files\\
 #  signatoryPsnId: c3fb35cb7e574baf97ed9f8917c6327b #签署人 陈伟东
   signatoryPsnId: 95945af8f0864d15bf186e7808693176 #签署人 俞静妙
 
@@ -75,6 +76,13 @@ eqb:
 kd:
   host: http://61.174.28.154:70
 
+qcc:
+#  app-key: dcc6bcfcb0044118a4dbc4cceeea5c3f
+#  secret-key: 360728C4193C9D1C3C6E124A9EFE21EC
+  app-key: 35066921c79446428b8e92b91253ed3c
+  secret-key: 06680586605BCCADDE0C831704E199E9
+  internal-token: 2bc819d8290f478b8ea4d22460c63fe5
+
 
 
 

+ 6 - 1
mjava-huagao/src/main/resources/application-prod.yml

@@ -73,4 +73,9 @@ eqb:
 
 #金蝶方开发服务
 kd:
-  host: http://172.16.24.173:70
+  host: http://172.16.24.173:70
+
+qcc:
+  app-key: dcc6bcfcb0044118a4dbc4cceeea5c3f
+  secret-key: 360728C4193C9D1C3C6E124A9EFE21EC
+  internal-token: 2bc819d8290f478b8ea4d22460c63fe5

+ 6 - 1
mjava-huagao/src/main/resources/application-prod2.yml

@@ -74,4 +74,9 @@ eqb:
 
 #金蝶方开发服务
 kd:
-  host: http://172.16.24.173:70
+  host: http://172.16.24.173:70
+
+qcc:
+  app-key: dcc6bcfcb0044118a4dbc4cceeea5c3f
+  secret-key: 360728C4193C9D1C3C6E124A9EFE21EC
+  internal-token: 2bc819d8290f478b8ea4d22460c63fe5

+ 31 - 0
mjava-junengtai/src/main/java/com/malk/junengtai/controller/PurchaseController.java

@@ -1,8 +1,14 @@
 package com.malk.junengtai.controller;
 
 import com.malk.junengtai.service.PurchaseService;
+import com.malk.server.aliwork.YDConf;
+import com.malk.server.aliwork.YDParam;
+import com.malk.server.aliwork.YDSearch;
 import com.malk.server.common.McException;
 import com.malk.server.common.McR;
+import com.malk.service.aliwork.YDClient;
+import com.malk.service.dingtalk.DDClient;
+import com.malk.service.dingtalk.DDClient_Notice;
 import com.malk.utils.UtilMap;
 import com.malk.utils.UtilServlet;
 import lombok.SneakyThrows;
@@ -11,6 +17,8 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.Collections;
+import java.util.HashMap;
 import java.util.Map;
 
 @RestController
@@ -20,6 +28,13 @@ public class PurchaseController {
     @Autowired
     private PurchaseService purchaseService;
 
+    @Autowired
+    private DDClient_Notice ddClientNotice;
+    @Autowired
+    private DDClient ddClient;
+    @Autowired
+    private YDClient ydClient;
+
     /*todo:手动同步档案表*/
     @SneakyThrows
     @PostMapping("/synchronizedArchiveTable")
@@ -75,4 +90,20 @@ public class PurchaseController {
         return McR.success(purchaseService.pickingList(body));
     }
 
+    @PostMapping("/test")
+    public McR test(){
+
+        HashMap msg = new HashMap();
+        msg.put("msgtype","link");
+        HashMap linkMap  = new HashMap();
+        linkMap.put("picUrl", "https://www.aliwork.com/");
+        linkMap.put("messageUrl", "https://www.aliwork.com/");
+        linkMap.put("text", "出库单:" + "21434"+"出库未生效请检查!");
+        linkMap.put("title", "《出库接口超时》");
+        msg.put("link",linkMap);
+        ddClientNotice.sendNotification(ddClient.getAccessToken(), Collections.singletonList("33205115111170152911"),null,false,msg);
+
+        return McR.success("接口通畅");
+    }
+
 }

+ 38 - 0
mjava-ounuo/src/main/java/com/malk/tuosi/config/AsyncConfig.java

@@ -0,0 +1,38 @@
+package com.malk.tuosi.config;
+
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+//import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+import java.util.concurrent.Executor;
+import java.util.concurrent.ThreadPoolExecutor;
+
+@Configuration
+public class AsyncConfig {
+    @Bean("businessTaskExecutor")
+    public Executor businessTaskExecutor() {
+        ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+        // 核心线程数(即使空闲也会保留)
+        executor.setCorePoolSize(5);
+
+        // 最大线程数(队列满后可扩容到此值)
+        executor.setMaxPoolSize(20);
+
+        // 任务队列容量(缓冲等待执行的任务)
+        executor.setQueueCapacity(100);
+
+        // 线程名前缀(便于日志排查)
+        executor.setThreadNamePrefix("async-task-");
+
+        // 拒绝策略(当队列和线程池都满时如何处理新任务)
+        executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
+
+        // 线程空闲超时时间(秒),超过此时间非核心线程会被回收
+//        executor.setKeepAliveSeconds(60);
+
+        // 初始化线程池(必须调用!)
+        executor.initialize();
+        return executor;
+    }
+}

File diff suppressed because it is too large
+ 785 - 271
mjava-ounuo/src/main/java/com/malk/tuosi/schedule/ScheduleTask.java


+ 3 - 1
mjava-ounuo/src/main/java/com/malk/tuosi/service/TBService.java

@@ -18,7 +18,9 @@ public interface TBService {
     McR OuNuoXinAccessToken() throws JsonProcessingException;
 
    /*TODO:接收TB推送的数据*/
-    McR tbTaskUpdate(Map body) throws JsonProcessingException;
+    McR tbTaskUpdate_A(Map body) throws JsonProcessingException;//TODO:原始方法
+
+    McR tbTaskUpdate(Map body) throws JsonProcessingException;//TODO:异步执行
 
     /*TODO:钉盘文件上传接口*/
     McR uploadKnowledge(String pathName,String fileName,String fileType) throws JsonProcessingException;

+ 29 - 1
mjava-ounuo/src/main/java/com/malk/tuosi/service/impl/TbServiceImpl.java

@@ -22,6 +22,7 @@ import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import lombok.var;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Service;
 import org.springframework.web.bind.annotation.RequestBody;
 
@@ -79,12 +80,37 @@ public class TbServiceImpl implements TBService {
     }
 
     /*TODO:接收TB推送的数据*/
+
+    //TODO:异步执行
+
+    // 耗时操作必须放在独立方法上(不能和 Controller 在同一个类!)
+    @Async("businessTaskExecutor") // 指定线程池
+    public McR tbTaskUpdate(Map body) throws JsonProcessingException{
+        try {
+            // 模拟耗时操作(实际替换为你的业务)
+//            Thread.sleep(50000); // 50秒
+
+
+            tbTaskUpdate_A(body);
+
+        } catch (Exception e) {
+            // ⚠ 异步任务异常不会抛到 Controller,必须自己处理!
+            log.error("异步业务执行失败, 宜搭前端传参{}", body, e);
+            // 可选:发送告警、存入重试队列等
+        }
+        return McR.success();
+    }
+
+
+    //TODO:原始方法
     @SneakyThrows
     @Override
-    public McR tbTaskUpdate(Map body) throws JsonProcessingException {
+    public McR tbTaskUpdate_A(Map body) throws JsonProcessingException {
+        log.info("----开始接收webhook----");
         String s = JSON.toJSONString(body);
         JSONObject jsonObject = JSON.parseObject(s);
         String event = jsonObject.getString("event");
+        log.info("event:{}",event);
         //一层过滤:过滤事件[任务自定义字段更新事件]
         if (event.equals("v3.task.customfield.update")){
             JSONObject data = jsonObject.getJSONObject("data");
@@ -248,7 +274,9 @@ public class TbServiceImpl implements TBService {
                 }
             }
         } else if (event.equals("v3.task.create")) {
+            log.info("---更新任务确认---");
             JSONObject data = jsonObject.getJSONObject("data");
+            log.info("data:{}",data);
             String sfcId = data.getString("sfcId");
             if (sfcId.equals("6878b3c0669d175c3c6bc679") || sfcId.equals("6878b3ceb5ffcf500365d17a") || sfcId.equals("6878b3d8f40485da4c5f99a2")
                 || sfcId.equals("6878b39a27ae5f3cac355fb9") || sfcId.equals("6878b3a4090e6872fd6b78c6") || sfcId.equals("6878b3ad9e17ac8a027c6d37")

+ 1 - 1
mjava-qiwang/src/main/java/com/malk/qiwang/Controller/InvoiceLibraryController.java

@@ -52,7 +52,7 @@ public class InvoiceLibraryController {
     @Autowired
     private InvoiceLibraryMapper baseMapper;
     private static final String url = "http://47.103.203.2:9092/qiwang/";
-// private static final String url = "http://410a09c5.r39.cpolar.top/qiwang/"
+// private static final String url = "http://14e9f775.r39.cpolar.top";
 //员工报销
     @PostMapping("/invoiceLibrary")
     public McR test(@RequestBody Map map)  {

+ 42 - 5
mjava-qiwang/src/main/java/com/malk/qiwang/Controller/QiWangController.java

@@ -84,8 +84,11 @@ public class QiWangController {
         String processInstanceId = UtilMap.getString(map, "processInstanceId");
 
 //         获取审批实例信息
-        Map processInstance = ddClientWorkflow.getProcessInstanceId(ddClient.getAccessToken(), processInstanceId);
-        System.out.println("processInstance====" + processInstance);
+        Map processInstance = ddClientWorkflow.getProcessInstanceId(
+                ddClient.getAccessToken(), processInstanceId);
+//        System.out.println("processInstance====" + processInstance);
+        String businessId = (String) processInstance.get("businessId");
+        System.out.println(businessId);
 //
 //        if (Objects.nonNull(processInstance)) {
 //            List<Map> formComponentValues = (List<Map>) processInstance.get("formComponentValues");
@@ -439,10 +442,43 @@ public McR test4(@RequestBody Map map) {
         List<McInvoiceDto> result = invoices.stream().map(item -> {
             Map prop = UtilMap.getMap(UtilMap.getMap(item, "SingleInvoiceInfos"), UtilMap.getString(item, "SubType"));
 
-            List<Map<String, Object>> vatInvoiceItemInfos = UtilMap.getList(prop, "VatInvoiceItemInfos");
+//            List<Map<String, Object>> vatInvoiceItemInfos = UtilMap.getList(prop, "VatInvoiceItemInfos");
+//            if (!vatInvoiceItemInfos.isEmpty()) {
+//                String taxRate = UtilMap.getString(vatInvoiceItemInfos.get(0), "TaxRate");
+//                System.out.println("TaxRate: " + taxRate); // 输出: 9%
+//            }
+
+            String taxRate = null;
+//            List<Map<String, Object>> vatInvoiceItemInfos = UtilMap.getList(prop, "VatInvoiceItemInfos");
+            // 优先使用 VatInvoiceItemInfos,如果为空则使用 VatElectronicItems
+            List<Map<String, Object>> vatInvoiceItemInfos =
+                    UtilMap.getList(prop, "VatInvoiceItemInfos") != null && !UtilMap.getList(prop, "VatInvoiceItemInfos").isEmpty()
+                            ? UtilMap.getList(prop, "VatInvoiceItemInfos")
+                            : UtilMap.getList(prop, "VatElectronicItems");
+//            if (!vatInvoiceItemInfos.isEmpty()) {
+//                 taxRate = UtilMap.getString(vatInvoiceItemInfos.get(0), "TaxRate");
+//            }
             if (!vatInvoiceItemInfos.isEmpty()) {
-                String taxRate = UtilMap.getString(vatInvoiceItemInfos.get(0), "TaxRate");
-                System.out.println("TaxRate: " + taxRate); // 输出: 9%
+                String originalTaxRate = UtilMap.getString(vatInvoiceItemInfos.get(0), "TaxRate");
+
+                // 判断是否为有效数字(包括带%号的格式,如"9%")
+                if (StringUtils.isNotBlank(originalTaxRate)) {
+                    // 移除百分号并尝试解析为数字
+                    String cleanedTaxRate = originalTaxRate.replace("%", "").trim();
+                    try {
+                        // 尝试转换为数字
+                        new BigDecimal(cleanedTaxRate);
+                        taxRate = originalTaxRate; // 保持原值(可能带%)
+                    } catch (NumberFormatException e) {
+                        // 如果不是数字(如"不征税"、"免税"等),赋值为"0"
+                        taxRate = "0";
+                        log.debug("税率格式异常,原始值: {}, 已设置为0", originalTaxRate);
+                    }
+                } else {
+                    taxRate = "0";
+                }
+            } else {
+                taxRate = "0";
             }
             System.out.println("prop====="+prop);
             String no=UtilMap.getString(prop, "Number");
@@ -482,6 +518,7 @@ public McR test4(@RequestBody Map map) {
             McInvoiceDto invoiceDto = McInvoiceDto.builder()
                     .name(UtilMap.getString(item, "SubTypeDescription"))
                     .kindName(kind)
+                    .taxRate(taxRate)
                     .kind(UtilMap.getInt(item, "Type"))
                     .code(UtilMap.getString(prop, "Code"))
                     .serial(UtilMap.getString(prop, "Number"))

+ 65 - 10
mjava-qiwang/src/main/java/com/malk/qiwang/Service/impl/InvoiceLibraryServiceImpl.java

@@ -120,6 +120,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
             }
 
             String userId = (String) processInstance.get("originatorUserId");
+            String businessId = (String) processInstance.get("businessId");
             log.info("审批人ID: {}", userId);
 
             List<Map> formComponentValues = (List<Map>) processInstance.get("formComponentValues");
@@ -264,6 +265,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 // 保存基础报销记录(无发票)
                                 InvoiceLibrary baseInvoice = new InvoiceLibrary();
                                 baseInvoice.setOaId(processInstanceId);
+                                baseInvoice.setBusinessId(businessId);
                                 baseInvoice.setOaStatus("0");
                                 baseInvoice.setInvoiceStatus("0");
                                 baseInvoice.setDep(cdbm != null && StringUtils.isNotBlank(cdbm) ? cdbm : (bm != null ? bm : ""));
@@ -279,6 +281,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 baseInvoice.setTaxAmount(null);
                                 baseInvoice.setTotalAmount(null);
                                 baseInvoice.setBuyerName("");
+                                baseInvoice.setUserId(userId);
                                 baseInvoice.setBuyerTaxId("");
                                 baseInvoice.setSellerName("");
                                 baseInvoice.setSellerTaxId("");
@@ -326,7 +329,8 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                             JSONArray resultArray = jsonObject.getJSONArray("result");
 
                                             if (resultArray != null && !resultArray.isEmpty()) {
-                                                JSONObject invoice = resultArray.getJSONObject(0);
+                                                for (int invoiceIndex = 0; invoiceIndex < resultArray.size(); invoiceIndex++) {
+                                                JSONObject invoice = resultArray.getJSONObject(invoiceIndex);
                                                 String invoiceNumber = invoice.getString("serial") != null ? invoice.getString("serial") : "";
                                                 String buyerTaxId = invoice.getString("buyerTaxId") != null ? invoice.getString("buyerTaxId") : "";
                                                 String buyerName = invoice.getString("buyerName") != null ? invoice.getString("buyerName") : "";
@@ -394,6 +398,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                                     invoiceNumberList.add(invoiceNumber);
                                                     invoiceNumberToFileName.put(invoiceNumber, fileName);
                                                 }
+                                                }
                                             }
                                         }
                                     } catch (Exception e) {
@@ -431,7 +436,8 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                             JSONArray resultArray = jsonObject.getJSONArray("result");
 
                                             if (resultArray != null && !resultArray.isEmpty()) {
-                                                JSONObject invoice = resultArray.getJSONObject(0);
+                                                for (int invoiceIndex = 0; invoiceIndex < resultArray.size(); invoiceIndex++) {
+                                                JSONObject invoice = resultArray.getJSONObject(invoiceIndex);
                                                 String invoiceNumber = invoice.getString("serial") != null ? invoice.getString("serial") : "";
                                                 String buyerTaxId = invoice.getString("buyerTaxId") != null ? invoice.getString("buyerTaxId") : "";
                                                 String buyerName = invoice.getString("buyerName") != null ? invoice.getString("buyerName") : "";
@@ -485,6 +491,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                                     invoiceNumberList.add(invoiceNumber);
                                                     invoiceNumberToFileName.put(invoiceNumber, fileName);
                                                 }
+                                                }
                                             }
                                         }
                                     } catch (Exception e) {
@@ -550,6 +557,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
 
                             InvoiceLibrary invoiceLibrary = new InvoiceLibrary();
                             invoiceLibrary.setOaId(processInstanceId);
+                            invoiceLibrary.setBusinessId(businessId);
                             invoiceLibrary.setInvoiceCode(invoice.getString("code") != null ? invoice.getString("code") : "");
                             invoiceLibrary.setInvoiceNumber(invoice.getString("serial") != null ? invoice.getString("serial") : "");
                             invoiceLibrary.setInvoiceType(invoice.getString("kindName") != null ? invoice.getString("kindName") : "");
@@ -573,6 +581,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                             invoiceLibrary.setOaStatus("0");
                             invoiceLibrary.setNote(bz != null ? bz : "");
                             invoiceLibrary.setFormName("员工费用报销");
+                            invoiceLibrary.setUserId(userId);
                             invoiceLibrary.setPaySubject(fkzhxx != null ? fkzhxx : "");
                             invoiceLibrary.setPayAccount(fkzh != null ? fkzh : "");
                             invoiceLibrary.setBankName(yhqc != null ? yhqc : "");
@@ -639,6 +648,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
 
                                     InvoiceLibrary sharedInvoice = new InvoiceLibrary();
                                     sharedInvoice.setOaId(processInstanceId);
+                                    sharedInvoice.setBusinessId(businessId);
                                     sharedInvoice.setOaStatus("0");
                                     sharedInvoice.setInvoiceStatus("0");
                                     sharedInvoice.setDep(cdbm != null && StringUtils.isNotBlank(cdbm) ? cdbm : (bm != null ? bm : ""));
@@ -648,6 +658,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                     sharedInvoice.setAmount(null);
                                     sharedInvoice.setTaxAmount(null);
                                     sharedInvoice.setTotalAmount(null);
+                                    sharedInvoice.setUserId(userId);
                                     sharedInvoice.setFormName("员工费用报销");
                                     sharedInvoice.setPaySubject(fkzhxx != null ? fkzhxx : "");
                                     sharedInvoice.setPayAccount(fkzh != null ? fkzh : "");
@@ -1094,6 +1105,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
             }
 
             String userId = (String) processInstance.get("originatorUserId");
+            String businessId = (String) processInstance.get("businessId");
             log.info("审批人ID: {}", userId);
 
             List<Map> formComponentValues = (List<Map>) processInstance.get("formComponentValues");
@@ -1238,6 +1250,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 // 保存基础报销记录(无发票)
                                 InvoiceLibrary baseInvoice = new InvoiceLibrary();
                                 baseInvoice.setOaId(processInstanceId);
+                                baseInvoice.setBusinessId(businessId);
                                 baseInvoice.setOaStatus("0");
                                 baseInvoice.setInvoiceStatus("0");
                                 baseInvoice.setDep(cdbm != null && StringUtils.isNotBlank(cdbm) ? cdbm : (bm != null ? bm : ""));
@@ -1256,6 +1269,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 baseInvoice.setBuyerTaxId("");
                                 baseInvoice.setSellerName("");
                                 baseInvoice.setSellerTaxId("");
+                                baseInvoice.setUserId(userId);
                                 baseInvoice.setFormName("付款申请");
                                 baseInvoice.setPaySubject(fkzhxx != null ? fkzhxx : "");
                                 baseInvoice.setPayAccount(fkzh != null ? fkzh : "");
@@ -1300,7 +1314,8 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                             JSONArray resultArray = jsonObject.getJSONArray("result");
 
                                             if (resultArray != null && !resultArray.isEmpty()) {
-                                                JSONObject invoice = resultArray.getJSONObject(0);
+                                                for (int invoiceIndex = 0; invoiceIndex < resultArray.size(); invoiceIndex++) {
+                                                JSONObject invoice = resultArray.getJSONObject(invoiceIndex);
                                                 String invoiceNumber = invoice.getString("serial") != null ? invoice.getString("serial") : "";
                                                 String buyerTaxId = invoice.getString("buyerTaxId") != null ? invoice.getString("buyerTaxId") : "";
                                                 String buyerName = invoice.getString("buyerName") != null ? invoice.getString("buyerName") : "";
@@ -1368,6 +1383,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                                     invoiceNumberList.add(invoiceNumber);
                                                     invoiceNumberToFileName.put(invoiceNumber, fileName);
                                                 }
+                                                }
                                             }
                                         }
                                     } catch (Exception e) {
@@ -1405,7 +1421,8 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                             JSONArray resultArray = jsonObject.getJSONArray("result");
 
                                             if (resultArray != null && !resultArray.isEmpty()) {
-                                                JSONObject invoice = resultArray.getJSONObject(0);
+                                                for (int invoiceIndex = 0; invoiceIndex < resultArray.size(); invoiceIndex++) {
+                                                JSONObject invoice = resultArray.getJSONObject(invoiceIndex);
                                                 String invoiceNumber = invoice.getString("serial") != null ? invoice.getString("serial") : "";
                                                 String buyerTaxId = invoice.getString("buyerTaxId") != null ? invoice.getString("buyerTaxId") : "";
                                                 String buyerName = invoice.getString("buyerName") != null ? invoice.getString("buyerName") : "";
@@ -1459,6 +1476,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                                     invoiceNumberList.add(invoiceNumber);
                                                     invoiceNumberToFileName.put(invoiceNumber, fileName);
                                                 }
+                                                }
                                             }
                                         }
                                     } catch (Exception e) {
@@ -1524,6 +1542,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
 
                             InvoiceLibrary invoiceLibrary = new InvoiceLibrary();
                             invoiceLibrary.setOaId(processInstanceId);
+                            invoiceLibrary.setBusinessId(businessId);
                             invoiceLibrary.setInvoiceCode(invoice.getString("code") != null ? invoice.getString("code") : "");
                             invoiceLibrary.setInvoiceNumber(invoice.getString("serial") != null ? invoice.getString("serial") : "");
                             invoiceLibrary.setInvoiceType(invoice.getString("kindName") != null ? invoice.getString("kindName") : "");
@@ -1545,6 +1564,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                             invoiceLibrary.setSellerName(invoice.getString("sellerName") != null ? invoice.getString("sellerName") : "");
                             invoiceLibrary.setSellerTaxId(invoice.getString("sellerTaxId") != null ? invoice.getString("sellerTaxId") : "");
                             invoiceLibrary.setOaStatus("0");
+                            invoiceLibrary.setUserId(userId);
                             invoiceLibrary.setNote(bz != null ? bz : "");
                             invoiceLibrary.setFormName("付款申请");
                             invoiceLibrary.setPaySubject(fkzhxx != null ? fkzhxx : "");
@@ -1613,6 +1633,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
 
                                     InvoiceLibrary sharedInvoice = new InvoiceLibrary();
                                     sharedInvoice.setOaId(processInstanceId);
+                                    sharedInvoice.setBusinessId(businessId);
                                     sharedInvoice.setOaStatus("0");
                                     sharedInvoice.setInvoiceStatus("0");
                                     sharedInvoice.setDep(cdbm != null && StringUtils.isNotBlank(cdbm) ? cdbm : (bm != null ? bm : ""));
@@ -1622,6 +1643,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                     sharedInvoice.setAmount(null);
                                     sharedInvoice.setTaxAmount(null);
                                     sharedInvoice.setTotalAmount(null);
+                                    sharedInvoice.setUserId(userId);
                                     sharedInvoice.setFormName("付款申请");
                                     sharedInvoice.setPaySubject(fkzhxx != null ? fkzhxx : "");
                                     sharedInvoice.setPayAccount(fkzh != null ? fkzh : "");
@@ -1712,6 +1734,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
             }
 
             String userId = (String) processInstance.get("originatorUserId");
+            String businessId = (String) processInstance.get("businessId");
             log.info("审批人ID: {}", userId);
 
             List<Map> formComponentValues = (List<Map>) processInstance.get("formComponentValues");
@@ -1855,6 +1878,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 // 保存基础报销记录(无发票)
                                 InvoiceLibrary baseInvoice = new InvoiceLibrary();
                                 baseInvoice.setOaId(processInstanceId);
+                                baseInvoice.setBusinessId(businessId);
                                 baseInvoice.setOaStatus("0");
                                 baseInvoice.setInvoiceStatus("0");
                                 baseInvoice.setDep(cdbm != null && StringUtils.isNotBlank(cdbm) ? cdbm : (bm != null ? bm : ""));
@@ -1870,6 +1894,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 baseInvoice.setTaxAmount(null);
                                 baseInvoice.setTotalAmount(null);
                                 baseInvoice.setBuyerName("");
+                                baseInvoice.setUserId(userId);
                                 baseInvoice.setBuyerTaxId("");
                                 baseInvoice.setSellerName("");
                                 baseInvoice.setSellerTaxId("");
@@ -1917,7 +1942,8 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                             JSONArray resultArray = jsonObject.getJSONArray("result");
 
                                             if (resultArray != null && !resultArray.isEmpty()) {
-                                                JSONObject invoice = resultArray.getJSONObject(0);
+                                                for (int invoiceIndex = 0; invoiceIndex < resultArray.size(); invoiceIndex++) {
+                                                JSONObject invoice = resultArray.getJSONObject(invoiceIndex);
                                                 String invoiceNumber = invoice.getString("serial") != null ? invoice.getString("serial") : "";
                                                 String buyerTaxId = invoice.getString("buyerTaxId") != null ? invoice.getString("buyerTaxId") : "";
                                                 String buyerName = invoice.getString("buyerName") != null ? invoice.getString("buyerName") : "";
@@ -1985,6 +2011,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                                     invoiceNumberList.add(invoiceNumber);
                                                     invoiceNumberToFileName.put(invoiceNumber, fileName);
                                                 }
+                                                }
                                             }
                                         }
                                     } catch (Exception e) {
@@ -2022,7 +2049,8 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                             JSONArray resultArray = jsonObject.getJSONArray("result");
 
                                             if (resultArray != null && !resultArray.isEmpty()) {
-                                                JSONObject invoice = resultArray.getJSONObject(0);
+                                                for (int invoiceIndex = 0; invoiceIndex < resultArray.size(); invoiceIndex++) {
+                                                JSONObject invoice = resultArray.getJSONObject(invoiceIndex);
                                                 String invoiceNumber = invoice.getString("serial") != null ? invoice.getString("serial") : "";
                                                 String buyerTaxId = invoice.getString("buyerTaxId") != null ? invoice.getString("buyerTaxId") : "";
                                                 String buyerName = invoice.getString("buyerName") != null ? invoice.getString("buyerName") : "";
@@ -2076,6 +2104,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                                     invoiceNumberList.add(invoiceNumber);
                                                     invoiceNumberToFileName.put(invoiceNumber, fileName);
                                                 }
+                                                }
                                             }
                                         }
                                     } catch (Exception e) {
@@ -2141,6 +2170,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
 
                             InvoiceLibrary invoiceLibrary = new InvoiceLibrary();
                             invoiceLibrary.setOaId(processInstanceId);
+                            invoiceLibrary.setBusinessId(businessId);
                             invoiceLibrary.setInvoiceCode(invoice.getString("code") != null ? invoice.getString("code") : "");
                             invoiceLibrary.setInvoiceNumber(invoice.getString("serial") != null ? invoice.getString("serial") : "");
                             invoiceLibrary.setInvoiceType(invoice.getString("kindName") != null ? invoice.getString("kindName") : "");
@@ -2162,6 +2192,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                             invoiceLibrary.setSellerName(invoice.getString("sellerName") != null ? invoice.getString("sellerName") : "");
                             invoiceLibrary.setSellerTaxId(invoice.getString("sellerTaxId") != null ? invoice.getString("sellerTaxId") : "");
                             invoiceLibrary.setOaStatus("0");
+                            invoiceLibrary.setUserId(userId);
                             invoiceLibrary.setNote(bz != null ? bz : "");
                             invoiceLibrary.setFormName("合作商付款申请");
                             invoiceLibrary.setPaySubject(fkzhxx != null ? fkzhxx : "");
@@ -2230,6 +2261,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
 
                                     InvoiceLibrary sharedInvoice = new InvoiceLibrary();
                                     sharedInvoice.setOaId(processInstanceId);
+                                    sharedInvoice.setBusinessId(businessId);
                                     sharedInvoice.setOaStatus("0");
                                     sharedInvoice.setInvoiceStatus("0");
                                     sharedInvoice.setDep(cdbm != null && StringUtils.isNotBlank(cdbm) ? cdbm : (bm != null ? bm : ""));
@@ -2239,6 +2271,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                     sharedInvoice.setAmount(null);
                                     sharedInvoice.setTaxAmount(null);
                                     sharedInvoice.setTotalAmount(null);
+                                    sharedInvoice.setUserId(userId);
                                     sharedInvoice.setFormName("合作商付款申请");
                                     sharedInvoice.setPaySubject(fkzhxx != null ? fkzhxx : "");
                                     sharedInvoice.setPayAccount(fkzh != null ? fkzh : "");
@@ -2329,6 +2362,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
             }
 
             String userId = (String) processInstance.get("originatorUserId");
+            String businessId = (String) processInstance.get("businessId");
             log.info("审批人ID: {}", userId);
 
             List<Map> formComponentValues = (List<Map>) processInstance.get("formComponentValues");
@@ -2472,6 +2506,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 // 保存基础报销记录(无发票)
                                 InvoiceLibrary baseInvoice = new InvoiceLibrary();
                                 baseInvoice.setOaId(processInstanceId);
+                                baseInvoice.setBusinessId(businessId);
                                 baseInvoice.setOaStatus("0");
                                 baseInvoice.setInvoiceStatus("0");
                                 baseInvoice.setDep(cdbm != null && StringUtils.isNotBlank(cdbm) ? cdbm : (bm != null ? bm : ""));
@@ -2484,6 +2519,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 baseInvoice.setInvoiceNumber("");
                                 baseInvoice.setInvoiceType("");
                                 baseInvoice.setAmount(null);
+                                baseInvoice.setUserId(userId);
                                 baseInvoice.setTaxAmount(null);
                                 baseInvoice.setTotalAmount(null);
                                 baseInvoice.setBuyerName("");
@@ -2534,7 +2570,8 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                             JSONArray resultArray = jsonObject.getJSONArray("result");
 
                                             if (resultArray != null && !resultArray.isEmpty()) {
-                                                JSONObject invoice = resultArray.getJSONObject(0);
+                                                for (int invoiceIndex = 0; invoiceIndex < resultArray.size(); invoiceIndex++) {
+                                                JSONObject invoice = resultArray.getJSONObject(invoiceIndex);
                                                 String invoiceNumber = invoice.getString("serial") != null ? invoice.getString("serial") : "";
                                                 String buyerTaxId = invoice.getString("buyerTaxId") != null ? invoice.getString("buyerTaxId") : "";
                                                 String buyerName = invoice.getString("buyerName") != null ? invoice.getString("buyerName") : "";
@@ -2602,6 +2639,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                                     invoiceNumberList.add(invoiceNumber);
                                                     invoiceNumberToFileName.put(invoiceNumber, fileName);
                                                 }
+                                                }
                                             }
                                         }
                                     } catch (Exception e) {
@@ -2639,7 +2677,8 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                             JSONArray resultArray = jsonObject.getJSONArray("result");
 
                                             if (resultArray != null && !resultArray.isEmpty()) {
-                                                JSONObject invoice = resultArray.getJSONObject(0);
+                                                for (int invoiceIndex = 0; invoiceIndex < resultArray.size(); invoiceIndex++) {
+                                                JSONObject invoice = resultArray.getJSONObject(invoiceIndex);
                                                 String invoiceNumber = invoice.getString("serial") != null ? invoice.getString("serial") : "";
                                                 String buyerTaxId = invoice.getString("buyerTaxId") != null ? invoice.getString("buyerTaxId") : "";
                                                 String buyerName = invoice.getString("buyerName") != null ? invoice.getString("buyerName") : "";
@@ -2693,6 +2732,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                                     invoiceNumberList.add(invoiceNumber);
                                                     invoiceNumberToFileName.put(invoiceNumber, fileName);
                                                 }
+                                                }
                                             }
                                         }
                                     } catch (Exception e) {
@@ -2758,6 +2798,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
 
                             InvoiceLibrary invoiceLibrary = new InvoiceLibrary();
                             invoiceLibrary.setOaId(processInstanceId);
+                            invoiceLibrary.setBusinessId(businessId);
                             invoiceLibrary.setInvoiceCode(invoice.getString("code") != null ? invoice.getString("code") : "");
                             invoiceLibrary.setInvoiceNumber(invoice.getString("serial") != null ? invoice.getString("serial") : "");
                             invoiceLibrary.setInvoiceType(invoice.getString("kindName") != null ? invoice.getString("kindName") : "");
@@ -2780,6 +2821,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                             invoiceLibrary.setSellerTaxId(invoice.getString("sellerTaxId") != null ? invoice.getString("sellerTaxId") : "");
                             invoiceLibrary.setOaStatus("0");
                             invoiceLibrary.setNote(bz != null ? bz : "");
+                            invoiceLibrary.setUserId(userId);
                             invoiceLibrary.setFormName("合作商报销申请");
                             invoiceLibrary.setPaySubject(fkzhxx != null ? fkzhxx : "");
                             invoiceLibrary.setPayAccount(fkzh != null ? fkzh : "");
@@ -2847,6 +2889,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
 
                                     InvoiceLibrary sharedInvoice = new InvoiceLibrary();
                                     sharedInvoice.setOaId(processInstanceId);
+                                    sharedInvoice.setBusinessId(businessId);
                                     sharedInvoice.setOaStatus("0");
                                     sharedInvoice.setInvoiceStatus("0");
                                     sharedInvoice.setDep(cdbm != null && StringUtils.isNotBlank(cdbm) ? cdbm : (bm != null ? bm : ""));
@@ -2856,6 +2899,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                     sharedInvoice.setAmount(null);
                                     sharedInvoice.setTaxAmount(null);
                                     sharedInvoice.setTotalAmount(null);
+                                    sharedInvoice.setUserId(userId);
                                     sharedInvoice.setFormName("合作商报销申请");
                                     sharedInvoice.setPaySubject(fkzhxx != null ? fkzhxx : "");
                                     sharedInvoice.setPayAccount(fkzh != null ? fkzh : "");
@@ -2947,6 +2991,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
             }
 
             String userId = (String) processInstance.get("originatorUserId");
+            String businessId = (String) processInstance.get("businessId");
             log.info("审批人ID: {}", userId);
 
             List<Map> formComponentValues = (List<Map>) processInstance.get("formComponentValues");
@@ -3090,6 +3135,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 // 保存基础报销记录(无发票)
                                 InvoiceLibrary baseInvoice = new InvoiceLibrary();
                                 baseInvoice.setOaId(processInstanceId);
+                                baseInvoice.setBusinessId(businessId);
                                 baseInvoice.setOaStatus("0");
                                 baseInvoice.setInvoiceStatus("0");
                                 baseInvoice.setDep(cdbm != null && StringUtils.isNotBlank(cdbm) ? cdbm : (bm != null ? bm : ""));
@@ -3108,6 +3154,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                 baseInvoice.setBuyerTaxId("");
                                 baseInvoice.setSellerName("");
                                 baseInvoice.setSellerTaxId("");
+                                baseInvoice.setUserId(userId);
                                 baseInvoice.setFormName("出差费用报销");
                                 baseInvoice.setPaySubject(fkzhxx != null ? fkzhxx : "");
                                 baseInvoice.setPayAccount(fkzh != null ? fkzh : "");
@@ -3152,7 +3199,8 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                             JSONArray resultArray = jsonObject.getJSONArray("result");
 
                                             if (resultArray != null && !resultArray.isEmpty()) {
-                                                JSONObject invoice = resultArray.getJSONObject(0);
+                                                for (int invoiceIndex = 0; invoiceIndex < resultArray.size(); invoiceIndex++) {
+                                                JSONObject invoice = resultArray.getJSONObject(invoiceIndex);
                                                 String invoiceNumber = invoice.getString("serial") != null ? invoice.getString("serial") : "";
                                                 String buyerTaxId = invoice.getString("buyerTaxId") != null ? invoice.getString("buyerTaxId") : "";
                                                 String buyerName = invoice.getString("buyerName") != null ? invoice.getString("buyerName") : "";
@@ -3220,6 +3268,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                                     invoiceNumberList.add(invoiceNumber);
                                                     invoiceNumberToFileName.put(invoiceNumber, fileName);
                                                 }
+                                                }
                                             }
                                         }
                                     } catch (Exception e) {
@@ -3257,7 +3306,8 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                             JSONArray resultArray = jsonObject.getJSONArray("result");
 
                                             if (resultArray != null && !resultArray.isEmpty()) {
-                                                JSONObject invoice = resultArray.getJSONObject(0);
+                                                for (int invoiceIndex = 0; invoiceIndex < resultArray.size(); invoiceIndex++) {
+                                                JSONObject invoice = resultArray.getJSONObject(invoiceIndex);
                                                 String invoiceNumber = invoice.getString("serial") != null ? invoice.getString("serial") : "";
                                                 String buyerTaxId = invoice.getString("buyerTaxId") != null ? invoice.getString("buyerTaxId") : "";
                                                 String buyerName = invoice.getString("buyerName") != null ? invoice.getString("buyerName") : "";
@@ -3311,6 +3361,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                                     invoiceNumberList.add(invoiceNumber);
                                                     invoiceNumberToFileName.put(invoiceNumber, fileName);
                                                 }
+                                                }
                                             }
                                         }
                                     } catch (Exception e) {
@@ -3376,6 +3427,8 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
 
                             InvoiceLibrary invoiceLibrary = new InvoiceLibrary();
                             invoiceLibrary.setOaId(processInstanceId);
+                            invoiceLibrary.setBusinessId(businessId);
+                            invoiceLibrary.setUserId(userId);
                             invoiceLibrary.setInvoiceCode(invoice.getString("code") != null ? invoice.getString("code") : "");
                             invoiceLibrary.setInvoiceNumber(invoice.getString("serial") != null ? invoice.getString("serial") : "");
                             invoiceLibrary.setInvoiceType(invoice.getString("kindName") != null ? invoice.getString("kindName") : "");
@@ -3465,6 +3518,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
 
                                     InvoiceLibrary sharedInvoice = new InvoiceLibrary();
                                     sharedInvoice.setOaId(processInstanceId);
+                                    sharedInvoice.setBusinessId(businessId);
                                     sharedInvoice.setOaStatus("0");
                                     sharedInvoice.setInvoiceStatus("0");
                                     sharedInvoice.setDep(cdbm != null && StringUtils.isNotBlank(cdbm) ? cdbm : (bm != null ? bm : ""));
@@ -3474,6 +3528,7 @@ public class InvoiceLibraryServiceImpl extends ServiceImpl<InvoiceLibraryMapper,
                                     sharedInvoice.setAmount(null);
                                     sharedInvoice.setTaxAmount(null);
                                     sharedInvoice.setTotalAmount(null);
+                                    sharedInvoice.setUserId(userId);
                                     sharedInvoice.setFormName("出差费用报销");
                                     sharedInvoice.setPaySubject(fkzhxx != null ? fkzhxx : "");
                                     sharedInvoice.setPayAccount(fkzh != null ? fkzh : "");

+ 4 - 0
mjava-qiwang/src/main/java/com/malk/qiwang/entity/InvoiceLibrary.java

@@ -157,4 +157,8 @@ public class InvoiceLibrary implements Serializable {
 
     //共享税率
     private String sharedRate;
+    //用户ID
+    private String userId;
+    //审批编号
+    private String businessId;
 }

+ 5 - 0
mjava-zhiwei/pom.xml

@@ -60,6 +60,11 @@
             <artifactId>gson</artifactId>
             <version>2.8.0</version>
         </dependency>
+        <dependency>
+            <groupId>com.fasterxml.jackson.core</groupId>
+            <artifactId>jackson-databind</artifactId>
+            <version>2.15.2</version>
+        </dependency>
     </dependencies>
 
     <build>

+ 12 - 1
mjava-zhiwei/src/main/java/com/malk/zhiwei/schedule/ScheduleTask.java

@@ -157,10 +157,21 @@ public class ScheduleTask {
 
     //客户同步
     @SneakyThrows
-//    @Scheduled(cron ="0 0 3 * * ?")
+    @Scheduled(cron ="0 0 3 * * ?")
     @PostMapping("/customer")
     public void customer(){
         zwService.customer();
     }
 
+
+    //跟进时间统计
+    @SneakyThrows
+    @Scheduled(cron = "0 0 10 * * ?")   // 每天10点执行
+    @PostMapping("/kehugenjin")
+    public void kehugenjin(){
+//        zwService.kehugenjin();
+//        zwService.customerfollow_up();
+        zwService.kehugenjinxin();
+    }
+
 }

+ 9 - 0
mjava-zhiwei/src/main/java/com/malk/zhiwei/service/ZwService.java

@@ -44,4 +44,13 @@ public interface ZwService {
     //同步客户
     void customer() throws JsonProcessingException;
 
+    //客户跟进(卡片发送)
+    void kehugenjin() throws JsonProcessingException;
+
+    //客户跟进(消息通知)
+    void customerfollow_up() throws JsonProcessingException;
+
+    //客户跟进(卡片推送) 根据销售订单
+    void kehugenjinxin() throws JsonProcessingException;
+
 }

+ 353 - 5
mjava-zhiwei/src/main/java/com/malk/zhiwei/service/impl/ZwServiceImpl.java

@@ -5,19 +5,25 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
 import com.google.gson.Gson;
+import com.google.gson.JsonArray;
 import com.google.gson.JsonObject;
 import com.kingdee.bos.webapi.entity.IdentifyInfo;
 import com.kingdee.bos.webapi.entity.RepoRet;
 import com.kingdee.bos.webapi.sdk.K3CloudApi;
 import com.malk.server.aliwork.YDConf;
 import com.malk.server.aliwork.YDParam;
+import com.malk.server.common.McException;
 import com.malk.server.common.McR;
 import com.malk.server.common.VenR;
 import com.malk.server.dingtalk.DDConf;
 import com.malk.server.dingtalk.DDR;
 import com.malk.service.aliwork.YDClient;
 import com.malk.service.dingtalk.DDClient;
+import com.malk.service.dingtalk.DDClient_Extension;
 import com.malk.utils.PublicUtil;
 import com.malk.utils.UtilHttp;
 import com.malk.utils.UtilMap;
@@ -30,10 +36,18 @@ import lombok.SneakyThrows;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.web.bind.annotation.RequestBody;
 
+import java.text.SimpleDateFormat;
+import java.time.Instant;
+import java.time.LocalDate;
+import java.time.ZoneId;
+import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.stream.Collectors;
 
+import com.malk.zhiwei.test.DingTalkUtil;
+
 @Service
 @Slf4j
 public class ZwServiceImpl implements ZwService {
@@ -256,7 +270,7 @@ public class ZwServiceImpl implements ZwService {
         BillQuery billQuery = new BillQuery();
         billQuery.setFormId("BD_MATERIAL");//产品信息
         //编码 名称 规格型号 旧物料编码 物料分组 物料属性 基本单位 长 宽 高 体积 面积 密度 标准工时
-        billQuery.setFieldKeys("FCreateOrgId.FNumber,FApproveDate,FNumber,FName,FSpecification,FOldNumber,FMaterialGroup,FErpClsID,FBaseUnitId,FLENGTH,FWIDTH,FHEIGHT,FVOLUME,F_UNW_Qty_r03,F_UNW_Qty_6yt,FPerUnitStandHour");
+        billQuery.setFieldKeys("FCreateOrgId.FNumber,FApproveDate,FNumber,FName,FSpecification,FOldNumber,FMaterialGroup.FName,FErpClsID.FName,FBaseUnitId,FLENGTH,FWIDTH,FHEIGHT,FVOLUME,F_UNW_Qty_r03,F_UNW_Qty_6yt,FPerUnitStandHour");
         List<Map> filterString = new ArrayList<>();
         filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FApproveDate","265",3,"","","0"));//审核日期在今天之前N天以后
         filterString.add(UtilMap.map("FieldName, Compare, Value, Left, Right, Logic","FCreateOrgId.FNumber","67","101","","","0"));//创建组织为101 研发中心
@@ -274,8 +288,8 @@ public class ZwServiceImpl implements ZwService {
             String name = item.getString("FName");
             String spec = item.getString("FSpecification");
             String oldNumber = item.getString("FOldNumber");
-            Integer materialGroup = item.getInteger("FMaterialGroup");
-            String erpClsId = item.getString("FErpClsID");
+            Integer materialGroup = item.getInteger("FMaterialGroup.FName");
+            String erpClsId = item.getString("FErpClsID.FName");
             Integer baseUnitId = item.getInteger("FBaseUnitId");
             Double length = item.getDouble("FLENGTH");
             Double width = item.getDouble("FWIDTH");
@@ -958,6 +972,306 @@ public class ZwServiceImpl implements ZwService {
         log.info("客户已同步");
     }
 
+    @SneakyThrows
+    @Override
+    public void kehugenjin() throws JsonProcessingException {
+        //todo:1、遍历客户查询对应的系统创建的跟进时间
+        List<Map> list  = (List<Map>) ydClient.queryData(YDParam.builder()
+                        .formUuid("FORM-CF2DBE5A6A5941739BF7A05C82B361C48V5J")
+                        .build()
+                ,YDConf.FORM_QUERY.retrieve_list).getData();
+        ObjectMapper mapper = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT);
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        long time1;//最后跟进时间
+        long time2;//跟进时间
+        long now = System.currentTimeMillis();
+        long tenDaysMillis = 10L * 24 * 3600 * 1000; // 10天毫秒数
+        for (Map li : list){
+            Object formDataObj = li.get("formData");
+            JsonNode formData = mapper.readTree(mapper.writeValueAsString(formDataObj)); // 统一转JsonNode
+            // 提取日期字段并转为可读格式
+            time1 = formData.get("dateField_l3tw3kfn").asLong();
+            System.out.println("最后跟进时间: " + sdf.format(new Date(time1)));
+            if(formData.has("dateField_mouumxhe")){
+                time2 = formData.get("dateField_mouumxhe").asLong();
+                System.out.println("跟进时间: " + sdf.format(new Date(time2)));
+            }else {//todo:2、超过10天,跟进时间字段没有值的话就发送通知给负责人和协同人
+                System.out.println("跟进时间字段为空");
+                // 检查是否超过10天
+                long diff = now - time1;
+                if (diff > tenDaysMillis) {
+                    log.info("{},超过10天未填写跟进时间,发送通知",formData.get("textField_lqanqe6j"));
+                    // 获取负责人ID和协同人ID
+                    String responsiblePerson = getEmployeeId(formData, "employeeField_lqanqe6n_id");
+                    System.out.println("负责人:" + responsiblePerson);
+                    String collaborator = getEmployeeId(formData, "employeeField_lqanqe6o_id");
+                    System.out.println("协同人:" + collaborator);
+                    //todo:3、组装数据卡片推送
+                    JSONObject cardData = new JSONObject();
+                    System.out.println("customer:" +formData.get("textField_lqanqe6j") );
+                    cardData.put("customer", formData.get("textField_lqanqe6j").asText());//客户
+                    cardData.put("hangye", formData.get("selectField_lqanqe6t").asText());//行业
+                    cardData.put("fuzeren", DingTalkUtil.getUserName(responsiblePerson));//负责人
+                    cardData.put("xiezuoren", DingTalkUtil.getUserName(collaborator));//协同人
+                    cardData.put("link","https://yae2gb.aliwork.com/APP_G0JV4FGIR0EOSBD0K7XV/formDetail/FORM-CF2DBE5A6A5941739BF7A05C82B361C48V5J?formInstId="+formData.get("textField_mo82diej"));//链接
+                    JSONObject message = new JSONObject();
+                    message.put("cardData", cardData);
+                    message.put("outTrackId", String.valueOf(System.currentTimeMillis()));
+                    message.put("openSpaceId", "dtv1.card//IM_ROBOT." + collaborator);//IM机器人单聊(协同人)
+                    message.put("cardTemplateId", "bcaaaf36-32a3-405b-b7a4-940f3dd846aa.schema");
+                    message.put("robotCode", "ding2ru5r5d2vtaqf67m");
+                    createAndDeliverCard(message);//调用卡片推送
+
+                } else {
+                    log.info("10天内未填写,暂不通知");
+                }
+            }
+            System.out.println("-----------------------------------");
+        }
+    }
+
+    @Override
+    public void customerfollow_up() throws JsonProcessingException {
+        //todo:1、遍历客户查询对应的系统创建的跟进时间
+        List<Map> list  = (List<Map>) ydClient.queryData(YDParam.builder()
+                        .formUuid("FORM-CF2DBE5A6A5941739BF7A05C82B361C48V5J")
+                        .build()
+                ,YDConf.FORM_QUERY.retrieve_list).getData();
+        ObjectMapper mapper = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT);
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        long time1;//最后跟进时间
+        long time2;//跟进时间
+        long now = System.currentTimeMillis();
+        long tenDaysMillis = 10L * 24 * 3600 * 1000; // 10天毫秒数
+        for (Map li : list){
+            Object formDataObj = li.get("formData");
+            JsonNode formData = mapper.readTree(mapper.writeValueAsString(formDataObj)); // 统一转JsonNode
+            // 提取日期字段并转为可读格式
+            time1 = formData.get("dateField_l3tw3kfn").asLong();
+            System.out.println("最后跟进时间: " + sdf.format(new Date(time1)));
+            if(formData.has("dateField_mouumxhe")){
+                time2 = formData.get("dateField_mouumxhe").asLong();
+                System.out.println("跟进时间: " + sdf.format(new Date(time2)));
+            }else {//todo:2、超过10天,跟进时间字段没有值的话就发送通知给负责人和协同人
+                System.out.println("跟进时间字段为空");
+                // 检查是否超过10天
+                long diff = now - time1;
+                if (diff > tenDaysMillis) {
+                    log.info("{},超过10天未填写跟进时间,发送通知",formData.get("textField_lqanqe6j"));
+                    // 获取负责人ID和协同人ID
+                    String responsiblePerson = getEmployeeId(formData, "employeeField_lqanqe6n_id");
+                    System.out.println("负责人:" + responsiblePerson);
+                    String collaborator = getEmployeeId(formData, "employeeField_lqanqe6o_id");
+                    System.out.println("协同人:" + collaborator);
+
+
+                    HashMap param = new HashMap();
+                    param.put("access_token",ddClient.getAccessToken());
+                    HashMap body = new HashMap();
+                    body.put("agent_id", 4457395865L);
+                    body.put("userid_list", collaborator);//加上负责人
+                    // 构建 msg 对象
+                    HashMap<String, Object> msg = new HashMap<>();
+                    msg.put("msgtype", "link");
+                    // text 部分(注意:原 JSON 中同时包含 text 和 link,这里按原样保留)
+                    HashMap<String, String> text = new HashMap<>();
+                    text.put("content", "请及时跟进客户");
+                    msg.put("text", text);
+                    // link 部分
+                    HashMap<String, String> link = new HashMap<>();
+                    link.put("picUrl", "https://wwww.baidu.com");
+                    link.put("messageUrl", "https://yae2gb.aliwork.com/APP_G0JV4FGIR0EOSBD0K7XV/formDetail/FORM-CF2DBE5A6A5941739BF7A05C82B361C48V5J?formInstId=" + formData.get("textField_mo82diej"));
+                    link.put("text", "10天内未跟进,请及时跟进" + formData.get("textField_lqanqe6j"));
+                    link.put("title", "[请跟进客户]");
+                    msg.put("link", link);
+                    body.put("msg", msg);
+                    String doPost = UtilHttp.doPost("https://oapi.dingtalk.com/topapi/message/corpconversation/asyncsend_v2", null, param, body);
+                    System.out.println("[返回结果:]" + doPost);
+                } else {
+                    log.info("10天内未填写,暂不通知");
+                }
+            }
+        }
+
+
+    }
+
+    @SneakyThrows
+    @Override
+    public void kehugenjinxin() throws JsonProcessingException {
+        //todo:①、查询下销售订单中有多少的客户,需要去重计数下(分页查询下)
+        String instanceId = "FORM-7B112A3733EC412FB27D56D8AC242E5BHIL4";
+        YDParam ydParam = YDParam.builder().formUuid(instanceId).build();
+        ydParam.setPageSize(1);
+        long totalCount = ydClient.queryData(ydParam, YDConf.FORM_QUERY.retrieve_search_form).getTotalCount();
+
+        // 定义去重集合(LinkedHashSet保证插入顺序)
+        Set<String> uniqueCustomerSet = new LinkedHashSet<>();
+        ydParam.setCurrentPage(1);
+        ydParam.setPageSize(100);
+        for (int page = 1; page <= (Math.ceil(totalCount / 100)!=0?Math.ceil(totalCount / 100):1) + 1; page++) {
+            List<Map> dataList = new ArrayList<>();
+            ydParam.setCurrentPage(page);
+            dataList.addAll((List<Map>) ydClient.queryData(ydParam, YDConf.FORM_QUERY.retrieve_search_form).getData());
+            for (Map li :dataList){
+                Map map = (Map)li.get("formData");
+                String kehu = map.get("textField_mniksrqb").toString();
+                System.out.println("客户:" + kehu);
+                uniqueCustomerSet.add(kehu);   // Set自动去重
+            }
+        }
+
+
+
+        //todo:②、查询下客户信息表
+        String instanceId_A = "FORM-A4C9F5F35B48419A9C607D3408ECAB02A7FL";
+        YDParam ydParam_A = YDParam.builder().formUuid(instanceId_A).build();
+        ydParam_A.setPageSize(1);
+        long totalCount_A = ydClient.queryData(ydParam_A, YDConf.FORM_QUERY.retrieve_search_form).getTotalCount();
+        ydParam_A.setCurrentPage(1);
+        ydParam_A.setPageSize(100);
+        for (int page = 1; page <= (Math.ceil(totalCount_A / 100)!=0?Math.ceil(totalCount_A / 100):1) + 1; page++) {
+            List<Map> dataList = new ArrayList<>();
+            ydParam_A.setCurrentPage(page);
+            dataList.addAll((List<Map>) ydClient.queryData(ydParam_A, YDConf.FORM_QUERY.retrieve_search_form).getData());
+            ObjectMapper mapper = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT);
+            for (Map li :dataList){
+                Object formDataObj = li.get("formData");
+                JsonNode formData = mapper.readTree(mapper.writeValueAsString(formDataObj)); // 统一转JsonNode
+
+                Map map = (Map)li.get("formData");
+                String IStixing = map.get("selectField_mp3r6ad3").toString();//是否已经发送提醒
+                String ISpush = map.get("selectField_mp3s339j").toString();//是否推送公海池
+                String kehu = map.get("textField_lqanqe6j").toString();
+                String hangye = map.get("selectField_lqanqe6t").toString();
+                String responsiblePerson = getEmployeeId(formData, "employeeField_lqanqe6n_id");
+                System.out.println("负责人:" + responsiblePerson);
+                String collaborator = getEmployeeId(formData, "employeeField_lqanqe6o_id");
+                System.out.println("协同人:" + collaborator);
+        //todo:③、是否是成交客户
+                if (uniqueCustomerSet.contains(kehu)) {
+                    // 成交客户:不做任何处理
+                    continue;
+                }
+                // 非成交客户:需要检查以客户表单中的跟进时间为基准,往后3周内是否有第三个表单的提交记录
+                Object genjinObj = map.get("dateField_l3tw3kfn");
+                if (genjinObj == null) continue;
+                LocalDate followUpDate;
+                long timestamp = Long.parseLong(genjinObj.toString());
+                followUpDate = Instant.ofEpochMilli(timestamp).atZone(ZoneId.systemDefault()).toLocalDate();
+                // 检查第三个表单中是否有 [跟进时间, 跟进时间+3周] 内的记录
+                boolean hasRecordIn3Weeks = checkCustomerFollowUpRecord(kehu, followUpDate, followUpDate.plusWeeks(3));
+                if (!hasRecordIn3Weeks) {
+                    //发送提醒(注意:只发送一次提醒所以提前判断)
+                    if("否".equals(IStixing)) {
+                        //todo:3、组装数据卡片推送
+                        JSONObject cardData = new JSONObject();
+                        cardData.put("customer", kehu);//客户
+                        cardData.put("hangye", hangye);//行业
+                        cardData.put("fuzeren", DingTalkUtil.getUserName(responsiblePerson));//负责人
+                        cardData.put("xiezuoren", DingTalkUtil.getUserName(collaborator));//协同人
+                        cardData.put("link", "https://yae2gb.aliwork.com/APP_G0JV4FGIR0EOSBD0K7XV/formDetail/FORM-FORM-A4C9F5F35B48419A9C607D3408ECAB02A7FL?formInstId=" + map.get("textField_mo82diej").toString());//链接
+                        /*协同人*/
+                        JSONObject message = new JSONObject();
+                        message.put("cardData", cardData);
+                        message.put("outTrackId", String.valueOf(System.currentTimeMillis()));
+                        message.put("openSpaceId", "dtv1.card//IM_ROBOT." + collaborator);//IM机器人单聊(协同人)
+                        message.put("cardTemplateId", "bcaaaf36-32a3-405b-b7a4-940f3dd846aa.schema");
+                        message.put("robotCode", "ding2ru5r5d2vtaqf67m");
+                        createAndDeliverCard(message);//调用卡片推送
+                        /*负责人*/
+                        JSONObject message_A = new JSONObject();
+                        message_A.put("cardData", cardData);
+                        message_A.put("outTrackId", String.valueOf(System.currentTimeMillis()));
+                        message_A.put("openSpaceId", "dtv1.card//IM_ROBOT." + responsiblePerson);//IM机器人单聊(负责人)
+                        message_A.put("cardTemplateId", "bcaaaf36-32a3-405b-b7a4-940f3dd846aa.schema");
+                        message_A.put("robotCode", "ding2ru5r5d2vtaqf67m");
+                        createAndDeliverCard(message_A);//调用卡片推送
+                        /*更新已提醒字段*/
+                        ydClient.operateData(YDParam.builder()
+                                .appType("APP_G0JV4FGIR0EOSBD0K7XV")
+                                .systemToken("F2766O91DH8WNHHUD63KBDP3B5GE234U4ZSBMBS1")
+                                .formInstanceId(map.get("textField_mo82diej").toString())
+                                .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("selectField_mp3r6ad3","是")))
+                                .build(), YDConf.FORM_OPERATION.update);
+                    }
+                    boolean hasRecordIn4Weeks = checkCustomerFollowUpRecord(kehu, followUpDate, followUpDate.plusWeeks(4));
+                    if (!hasRecordIn4Weeks) {
+                        // 4周仍无跟进 → 推送公海池
+                           if("否".equals(ISpush)){
+                           ydClient.operateData(YDParam.builder()
+                                   .appType("APP_G0JV4FGIR0EOSBD0K7XV")
+                                   .systemToken("F2766O91DH8WNHHUD63KBDP3B5GE234U4ZSBMBS1")
+                                   .formInstanceId(map.get("textField_mo82diej").toString())
+                                   .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("employeeField_lqanqe6n, selectField_mp3s339j","","是")))
+                                   .build(), YDConf.FORM_OPERATION.update);//删除负责人信息
+                           log.info("{},客户4周内未跟进客户,已推送到公海池",kehu);
+                       }
+                    }
+                }
+
+
+            }
+        }
+
+
+
+    }
+
+    /**
+     * 检查指定客户在第三个表单 FORM-16B6995591BA44FFAB07D6115E27F8C3JWXV 中,
+     * 是否在 [startDate, endDate] 范围内有提交记录
+     * @param customerName 客户名称
+     * @param startDate 开始日期(包含)
+     * @param endDate 结束日期(包含)
+     * @return true-存在记录,false-不存在
+     */
+    private boolean checkCustomerFollowUpRecord(String customerName, LocalDate startDate, LocalDate endDate) {
+        // todo: 请根据实际 API 实现查询逻辑
+        // 示例:构造查询参数查询表单 FORM-16B6995591BA44FFAB07D6115E27F8C3JWXV
+        // 过滤条件:客户名字段等于 customerName,提交日期字段 >= startDate 且 <= endDate
+        // 如果查询结果条数 > 0 则返回 true,否则返回 false
+        boolean panduan = false;
+        boolean IShanyou = false;//true——有跟进记录  false——无跟进记录
+        LocalDate currentDate = LocalDate.now(); // 获取当前系统日期
+        String instanceId_B = "FORM-16B6995591BA44FFAB07D6115E27F8C3JWXV";
+        YDParam ydParam_B = YDParam.builder().formUuid(instanceId_B).build();
+        ydParam_B.setPageSize(1);
+        long totalCount_B = ydClient.queryData(ydParam_B, YDConf.FORM_QUERY.retrieve_search_form).getTotalCount();
+        ydParam_B.setCurrentPage(1);
+        ydParam_B.setPageSize(100);
+        for (int page = 1; page <= (Math.ceil(totalCount_B / 100) != 0 ? Math.ceil(totalCount_B / 100) : 1) + 1; page++) {
+            List<Map> dataList = new ArrayList<>();
+            ydParam_B.setCurrentPage(page);
+            dataList.addAll((List<Map>) ydClient.queryData(ydParam_B, YDConf.FORM_QUERY.retrieve_search_form).getData());
+            for (Map li : dataList) {
+                Map map = (Map) li.get("formData");
+                String kehuName = map.get("textField_lqbo4rw0").toString();
+                if(kehuName.contains(customerName)){
+                    Object dateObj = map.get("dateField_lqbo4rw1"); // 需要替换为实际字段名
+                    LocalDate recordDate;
+                    long timestamp = Long.parseLong(dateObj.toString());
+                    recordDate = Instant.ofEpochMilli(timestamp).atZone(ZoneId.systemDefault()).toLocalDate();
+                    // 判断是否在 [startDate, endDate] 区间内(包含边界)
+                    if (!recordDate.isBefore(startDate) && !recordDate.isAfter(endDate)) {
+                        panduan =true;
+                        IShanyou = true;
+                        return panduan; // 找到一条记录即满足条件
+                    }else {
+
+                    }
+                }
+            }
+        }
+        /*虽然没有提交跟进 但是在规定周内,则不需要返回true      超过规定时间内则返回false*/
+        if(!IShanyou){
+            if (!currentDate.isBefore(startDate) && !currentDate.isAfter(endDate)){
+                panduan = true;
+            }
+        }
+        return panduan;
+    }
+
 
     private McR saveToAudit(String formid, Object object) throws Exception {
         JSONObject resultObj = new JSONObject();
@@ -1005,8 +1319,8 @@ public class ZwServiceImpl implements ZwService {
     /*TODO:钉钉获取应用token*/
     public McR Accesstoken() throws JsonProcessingException{
         HashMap body = new HashMap();
-        body.put("appKey","dinga81qkwb0sqxqnviw");
-        body.put("appSecret","IvePeLbMMxAzIr228RaGcOxgSSOuJ0trbenX3BbahjeLFA2YeaFv0W9F_6Ar5G0P");
+        body.put("appKey","ding2ru5r5d2vtaqf67m");
+        body.put("appSecret","nuxuhb23-XX26_P5fP8Kbv43R3SzCiEhxkt4hQ_p44XA8r6hR3UkgLrTeXxRH_RA");
         String doGet = UtilHttp.doPost("https://oapi.dingtalk.com/v1.0/oauth2/accessToken", null, null,body);
         JSONObject jsonObject = JSONObject.parseObject(doGet);
         String accessToken = jsonObject.getString("access_token");
@@ -1014,4 +1328,38 @@ public class ZwServiceImpl implements ZwService {
         return McR.success(accessToken);
     }
 
+    /**
+     * 从JsonNode中获取员工ID(取数组第一个值)
+     */
+    private String getEmployeeId(JsonNode formData, String fieldName) {
+        JsonNode node = formData.get(fieldName);
+        if (node != null && node.isArray() && node.size() > 0) {
+            return node.get(0).asText();
+        }
+        // 如果没有_id字段,尝试取名字字段
+        String nameField = fieldName.replace("_id", "");
+        JsonNode nameNode = formData.get(nameField);
+        if (nameNode != null && nameNode.isArray() && nameNode.size() > 0) {
+            return nameNode.get(0).asText();
+        }
+        return null;
+    }
+
+    @Autowired
+    private DDClient_Extension ddClientExtension;
+    /*群消息卡片推送*/
+    public McR createAndDeliverCard(@RequestBody JSONObject param){
+        log.info("推送消息:{}",param);
+        McException.assertParamException_Null(param,"cardData","outTrackId","openSpaceId","robotCode","cardTemplateId");
+        Map<String,Object> data = new HashMap();
+        data.put("imRobotOpenDeliverModel", UtilMap.map("robotCode, spaceType",param.getString("robotCode"),"IM_ROBOT"));
+        data.put("imRobotOpenSpaceModel",UtilMap.map("supportForward",true));
+        if(param.containsKey("extInfo")){
+            data.putAll(param.getJSONObject("extInfo"));
+        }
+        Map map = ddClientExtension.createAndDeliverCards(ddClient.getAccessToken(),param.getString("cardTemplateId"),param.getString("outTrackId"),
+                UtilMap.map("cardParamMap",param.getJSONObject("cardData")),param.getString("openSpaceId"),data);
+        return McR.success(map);
+    }
+
 }

+ 58 - 0
mjava-zhiwei/src/main/java/com/malk/zhiwei/test/DingTalkUtil.java

@@ -0,0 +1,58 @@
+package com.malk.zhiwei.test;
+
+import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.HashMap;
+
+import com.malk.server.common.McR;
+import com.malk.server.common.VenR;
+import com.malk.utils.UtilHttp;
+import com.malk.zhiwei.service.impl.ZwServiceImpl;
+
+public class DingTalkUtil {
+    private static final String API_URL = "https://oapi.dingtalk.com/topapi/v2/user/get";
+    private static final String TOKEN;
+
+    static {
+        try {
+            TOKEN = Accesstoken();
+        } catch (JsonProcessingException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    private static final ObjectMapper mapper = new ObjectMapper();
+
+    /*根据钉钉userid获取用户名称*/
+    public static String getUserName(String userid) throws Exception {
+        HashMap param = new HashMap();
+        param.put("access_token",Accesstoken());
+        HashMap body = new HashMap();
+        body.put("userid",userid);
+        String doPost = UtilHttp.doPost("https://oapi.dingtalk.com/topapi/v2/user/get", null, param, body);
+        JSONObject json = JSONObject.parseObject(doPost);
+        String name = json.getJSONObject("result").getString("name");
+        return name;
+    }
+
+    /*TODO:钉钉获取应用token*/
+    public static String Accesstoken() throws JsonProcessingException {
+        HashMap param = new HashMap();
+        param.put("appkey","ding2ru5r5d2vtaqf67m");
+        param.put("appsecret","nuxuhb23-XX26_P5fP8Kbv43R3SzCiEhxkt4hQ_p44XA8r6hR3UkgLrTeXxRH_RA");
+        String doGet = UtilHttp.doGet("https://oapi.dingtalk.com/gettoken", null, param);
+        JSONObject jsonObject = JSONObject.parseObject(doGet);
+        String accessToken = jsonObject.getString("access_token");
+        return accessToken;
+//        return null;
+    }
+
+
+}
+

+ 129 - 0
mjava-zhiwei/src/main/java/com/malk/zhiwei/test/test.java

@@ -0,0 +1,129 @@
+package com.malk.zhiwei.test;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.malk.server.aliwork.YDConf;
+import com.malk.server.aliwork.YDParam;
+import com.malk.server.common.McR;
+import com.malk.server.dingtalk.DDConf;
+import com.malk.service.aliwork.YDClient;
+import com.malk.service.dingtalk.DDClient;
+import com.malk.utils.UtilMap;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+@RestController
+@Slf4j
+@RequestMapping("/test")
+public class test {
+    @Autowired
+    private YDClient ydClient;
+    @Autowired
+    private DDClient ddClient;
+    @Autowired
+    private YDConf ydConf;
+
+    @Autowired
+    private DDConf ddConf;
+
+    /*获取群会话id*/
+    @PostMapping("/card/test")
+    McR cardtest(@RequestBody String body){
+        System.out.println("回调参数:" + body);
+        return McR.success();
+    }
+
+    /*更新主表字段*/
+    @PostMapping("/test11")
+    McR Test24(){
+        ydClient.operateData(YDParam.builder()
+                .appType("APP_G0JV4FGIR0EOSBD0K7XV")
+                .systemToken("F2766O91DH8WNHHUD63KBDP3B5GE234U4ZSBMBS1")
+                .formInstanceId("FINST-80G666714X45PCA2KHKIN9XE01SD2JR2QVAOMA9")
+                .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("employeeField_lqanqe6n", "")))
+                .build(), YDConf.FORM_OPERATION.update);//textField_luaxcrqi  账号
+        return McR.success();
+    }
+
+    /*删除数据*/
+    @PostMapping("/test12")
+    McR test12(){
+        ydClient.operateData(YDParam.builder()
+                .appType("APP_G0JV4FGIR0EOSBD0K7XV")
+                .systemToken("F2766O91DH8WNHHUD63KBDP3B5GE234U4ZSBMBS1")
+                .formInstanceId("FINST-2MA66S71WCV55DBJIBQ01AX1AJMG2C2EW2CPMLO")
+                .build(), YDConf.FORM_OPERATION.delete);
+        return McR.success();
+    }
+
+    /*创建数据*/
+    @PostMapping("/test13")
+    McR test13(){
+//        Map data = (Map) ydClient.queryData(YDParam.builder().formInstId("FINST-XRE66CA1R6O5EDVJLW1VU8Q77Y973BL2U96PML8H")
+//                .appType(ydConf.getAppType()).systemToken(ydConf.getSystemToken())
+//                .userId(ddConf.getOperator()).build(), YDConf.FORM_QUERY.retrieve_id).getFormData();
+//        String sc = "textField_lqanqe6j, employeeField_lqanqe6n, employeeField_lqanqe6o, departmentSelectField_lympbaya, selectField_lqanqe6t, selectField_mnft99uc, selectField_mnft99ud, selectField_mnft99ue, textField_mn2k7pjl, textField_llujklkq";//客户名称 负责人 协作人 负责人部门 所属行业 收款条件 事业部 终端 直接客户税号 纳税人识别号
+        String sc = "textField_mniksrqb";
+        String kehumingcheng = "益童航模玩具公司";
+//
+//        String employeeFieldLqanqe6n = data.get("employeeField_lqanqe6n").toString();
+//        JSONArray fuzeren = JSONArray.parseArray(employeeFieldLqanqe6n);
+//
+//        String employeeFieldLqanqe6o = data.get("employeeField_lqanqe6o").toString();
+//        JSONArray xiezuoren = JSONArray.parseArray(employeeFieldLqanqe6o);
+//
+//        String departmentSelectFieldLympbaya = data.get("departmentSelectField_lympbaya").toString();
+//        JSONArray fuzerenbumen = JSONArray.parseArray(departmentSelectFieldLympbaya);
+//
+//        String suoshuhangye = data.get("employeeField_lqanqe6n").toString();
+//        String shoukuantiaojian = data.get("employeeField_lqanqe6n").toString();
+//        String shiyebu = data.get("selectField_mnft99ud").toString();
+//        String zhongduan = data.get("selectField_mnft99ue").toString();
+//        String zhijiekehushuihao = data.get("textField_mn2k7pjl").toString();
+//        String nashuirenshibiehao = data.get("textField_llujklkq").toString();
+
+        Map formData = UtilMap.map(sc,kehumingcheng);
+        ydClient.operateData(YDParam.builder()
+                .formUuid("FORM-7B112A3733EC412FB27D56D8AC242E5BHIL4")
+                .formDataJson(JSONObject.toJSONString(formData))
+                .build(), YDConf.FORM_OPERATION.create).toString();
+        return McR.success();
+    }
+
+
+    /*批量更新数据*/
+    @PostMapping("/test14")
+    McR test14(){
+        String instanceId_A = "FORM-A4C9F5F35B48419A9C607D3408ECAB02A7FL";
+        YDParam ydParam_A = YDParam.builder().formUuid(instanceId_A).build();
+        ydParam_A.setPageSize(1);
+        long totalCount_A = ydClient.queryData(ydParam_A, YDConf.FORM_QUERY.retrieve_search_form).getTotalCount();
+        ydParam_A.setCurrentPage(1);
+        ydParam_A.setPageSize(100);
+        for (int page = 1; page <= (Math.ceil(totalCount_A / 100)!=0?Math.ceil(totalCount_A / 100):1) + 1; page++) {
+            List<Map> dataList = new ArrayList<>();
+            ydParam_A.setCurrentPage(page);
+            dataList.addAll((List<Map>) ydClient.queryData(ydParam_A, YDConf.FORM_QUERY.retrieve_search_form).getData());
+            ObjectMapper mapper = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT);
+            for (Map li : dataList) {
+                String formInstanceId = li.get("formInstanceId").toString();
+                ydClient.operateData(YDParam.builder()
+                        .appType("APP_G0JV4FGIR0EOSBD0K7XV")
+                        .systemToken("F2766O91DH8WNHHUD63KBDP3B5GE234U4ZSBMBS1")
+                        .formInstanceId(formInstanceId)
+                        .updateFormDataJson(JSONObject.toJSONString(UtilMap.map("textField_mo82diej", formInstanceId)))
+                        .build(), YDConf.FORM_OPERATION.update);
+            }
+        }
+        return McR.success();
+    }
+
+
+}

+ 1 - 1
mjava-zhongche/src/main/resources/application.yml

@@ -1,6 +1,6 @@
 spring:
   profiles:
-    active: prod
+    active: dev
   servlet:
     multipart:
       max-file-size: 100MB