2 Commits 93a3b44396 ... 5e38ed9819

Author SHA1 Message Date
  “lqy 5e38ed9819 Merge remote-tracking branch 'origin/master' 3 weeks ago
  “lqy 2bd84f33df 2.25代码提交 3 weeks ago

+ 4 - 0
mjava-huagao/src/main/java/com/malk/huagao/entity/KdYdMaterial.java

@@ -37,6 +37,10 @@ public class KdYdMaterial implements Serializable {
 
     private String jbdw;
 
+    private String ksrq;
+
+    private String jzrq;
+
     private String ssxl;
 
     private String jx;

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

@@ -149,6 +149,7 @@ private YdHuaGaoService ydHuaGaoService;
     }
 //    @Scheduled(fixedRate = 5 * 60 * 1000)
 //    @Scheduled(cron = "0 0/15 * * * ?")
+//@Scheduled(cron = "0/1 * * * * ?")
     public void synckdYdMaterial() {
         log.info("定时同步-物料信息");
         try {

+ 6 - 4
mjava-huagao/src/main/java/com/malk/huagao/service/impl/KdYdCustomerReferrerServiceImpl.java

@@ -18,6 +18,7 @@ import com.malk.utils.UtilMap;
 import lombok.extern.slf4j.Slf4j;
 import org.slf4j.MDC;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import java.util.HashMap;
@@ -38,7 +39,8 @@ public class KdYdCustomerReferrerServiceImpl extends ServiceImpl<KdYdCustomerRef
     private YDClient ydClient;
     @Autowired
     private KdYdCustomerReferrerMapper kdYdCustomerReferrerMapper;
-
+    @Value(value = "${kd.host}")
+    private String kdHost;
     @Override
     public Map<String, Object> insertCustomerReferrer(Map map) {
         Map<String, Object> result = new HashMap<>();
@@ -62,7 +64,7 @@ public class KdYdCustomerReferrerServiceImpl extends ServiceImpl<KdYdCustomerRef
                 formParams.put("jsons", jsonStr);
 
                 System.out.println("====" + formParams);
-                HttpResponse response = HttpRequest.post("http://113.45.187.194:70/xk/dyzn/WsBasedyzn.asmx/")
+                HttpResponse response = HttpRequest.post(kdHost+"/xk/dyzn/WsBasedyzn.asmx/")
                         .headerMap(headers, true)
                         .form(formParams)
                         .timeout(30000)  // 30秒超时
@@ -118,13 +120,13 @@ public class KdYdCustomerReferrerServiceImpl extends ServiceImpl<KdYdCustomerRef
             System.out.println("formParams====" + formParams);
             HttpResponse response = null;
             if ("add".equals(action)) {
-                response = HttpRequest.post("http://113.45.187.194:70/xk/dyzn/WsBasedyzn.asmx/hgdjydtbcreatecusttjr")
+                response = HttpRequest.post(kdHost+"/xk/dyzn/WsBasedyzn.asmx/hgdjydtbcreatecusttjr")
                         .headerMap(headers, true)
                         .form(formParams)
                         .timeout(30000)  // 30秒超时
                         .execute();
             } else {
-                response = HttpRequest.post("http://113.45.187.194:70/xk/dyzn/WsBasedyzn.asmx/")
+                response = HttpRequest.post(kdHost+"/xk/dyzn/WsBasedyzn.asmx/")
                         .headerMap(headers, true)
                         .form(formParams)
                         .timeout(30000)  // 30秒超时

+ 6 - 2
mjava-huagao/src/main/java/com/malk/huagao/service/impl/KdYdCustomerServiceImpl.java

@@ -73,7 +73,7 @@ public class KdYdCustomerServiceImpl extends ServiceImpl<KdYdCustomerMapper, KdY
                 formParams.put("jsons", jsonStr);
 
                 System.out.println("====" + formParams);
-                HttpResponse response = HttpRequest.post(kdHost+"/xk/dyzn/WsBasedyzn.asmx/")//todo 待完善接口
+                HttpResponse response = HttpRequest.post(kdHost+"/xk/dyzn/WsBasedyzn.asmx/hgdjydtbdeletecust")
                         .headerMap(headers, true)
                         .form(formParams)
                         .timeout(30000)  // 30秒超时
@@ -121,6 +121,9 @@ public class KdYdCustomerServiceImpl extends ServiceImpl<KdYdCustomerMapper, KdY
             String xsy = cleanEmployeeField(UtilMap.getString(formData, "employeeField_lqanqe6n"));
             String jsbb = UtilMap.getString(formData, "selectField_mfxrryt0");
             String khyxj = UtilMap.getString(formData, "numberField_mfxs7rd3");
+            if (khyxj == null || khyxj.trim().isEmpty()) {
+                khyxj = "1";
+            }
             String qyxygl = UtilMap.getString(formData, "radioField_mfxs7rd2");
             String mrsl = UtilMap.getString(formData, "selectField_mfxrryt3");
             String sfl = UtilMap.getString(formData, "selectField_mfxrryt2");
@@ -157,6 +160,7 @@ public class KdYdCustomerServiceImpl extends ServiceImpl<KdYdCustomerMapper, KdY
             customData.put("sfl", sfl);
             customData.put("sfjtkh", sfjtkh);
             customData.put("dyjtkh", dyjtkh);
+            System.out.println("====="+customData);
             // 处理子表数据
             List<Map<String, Object>> contactList = new ArrayList<>();
             List<Map> tableField = (List<Map>) formData.get("tableField_mfkks8ww");
@@ -187,7 +191,6 @@ public class KdYdCustomerServiceImpl extends ServiceImpl<KdYdCustomerMapper, KdY
 
                 // 将联系人列表添加到主数据
                 customData.put("contactList", contactList);
-
                 Map<String, String> headers = new HashMap<>();
                 headers.put("Content-Type", "application/x-www-form-urlencoded");
 
@@ -197,6 +200,7 @@ public class KdYdCustomerServiceImpl extends ServiceImpl<KdYdCustomerMapper, KdY
 // 构建form参数
                 Map<String, Object> formParams = new HashMap<>();
                 formParams.put("jsons", jsonStr);
+                log.info("请求参数:" + formParams);
 // 发送请求
                 HttpResponse response = null;
                 if ("add".equals(action)) {

+ 7 - 4
mjava-huagao/src/main/java/com/malk/huagao/service/impl/KdYdDeliveryServiceImpl.java

@@ -22,6 +22,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringEscapeUtils;
 import org.slf4j.MDC;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 import java.math.BigDecimal;
@@ -48,6 +49,8 @@ public class KdYdDeliveryServiceImpl extends ServiceImpl<KdYdDeliveryMapper, KdY
     private KdYdDeliveryMapper kdYdDeliveryMapper;
     @Autowired
     private KdYdDeliveryDetailMapper kdYdDeliveryDetailMapper;
+    @Value(value = "${kd.host}")
+    private String kdHost;
 
     @Override
     public Map<String, Object> insertDelivery(Map map) {
@@ -71,7 +74,7 @@ public class KdYdDeliveryServiceImpl extends ServiceImpl<KdYdDeliveryMapper, KdY
                 String jsonStr = JSON.toJSONString(result);
                 formParams.put("jsons", jsonStr);
 
-                HttpResponse response = HttpRequest.post("http://113.45.187.194:70/xk/dyzn/WsBasedyzn.asmx/hgdjydtbdeletefhtzd")
+                HttpResponse response = HttpRequest.post(kdHost+"/xk/dyzn/WsBasedyzn.asmx/hgdjydtbdeletefhtzd")
                         .headerMap(headers, true)
                         .form(formParams)
                         .timeout(30000)  // 30秒超时
@@ -205,17 +208,17 @@ public class KdYdDeliveryServiceImpl extends ServiceImpl<KdYdDeliveryMapper, KdY
 // 构建form参数
             Map<String, Object> formParams = new HashMap<>();
             formParams.put("jsons", jsonStr);
-            System.out.println("formParams==="+formParams);
+            log.info("请求参数:" + formParams);
 // 发送请求
             HttpResponse response = null;
             if ("add".equals(action)) {
-                response = HttpRequest.post("http://113.45.187.194:70/xk/dyzn/WsBasedyzn.asmx/hgdjydtbcreatefhtzd")
+                response = HttpRequest.post(kdHost+"/xk/dyzn/WsBasedyzn.asmx/hgdjydtbcreatefhtzd")
                         .headerMap(headers, true)
                         .form(formParams)
                         .timeout(30000)  // 30秒超时
                         .execute();
             } else {
-                response = HttpRequest.post("http://113.45.187.194:70/xk/dyzn/WsBasedyzn.asmx/")
+                response = HttpRequest.post(kdHost+"/xk/dyzn/WsBasedyzn.asmx/")
                         .headerMap(headers, true)
                         .form(formParams)
                         .timeout(30000)  // 30秒超时

+ 1 - 0
mjava-huagao/src/main/java/com/malk/huagao/service/impl/KdYdMaterialServiceImpl.java

@@ -270,6 +270,7 @@ public class KdYdMaterialServiceImpl extends ServiceImpl<KdYdMaterialMapper, KdY
                     updateFormData.put("textField_mejl9nrs", jx);
                     updateFormData.put("dateField_ml4ikfa0", kssj);
                     updateFormData.put("dateField_ml4ikfa1", jzsj);
+                    updateFormData.put("textField_mfxbtce6", sjzt);
 
                     if (sd != null) {
                         updateFormData.put("numberField_mfxbtceb", sd);

+ 24 - 20
mjava-huagao/src/main/java/com/malk/huagao/service/impl/KdYdOrderServiceImpl.java

@@ -22,9 +22,11 @@ import com.malk.server.dingtalk.DDR_New;
 import com.malk.service.aliwork.YDClient;
 import com.malk.utils.UtilHttp;
 import com.malk.utils.UtilMap;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang3.StringUtils;
 import org.slf4j.MDC;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 
@@ -45,6 +47,7 @@ import java.util.*;
  * @since 2025-10-15
  */
 @Service
+@Slf4j
 public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder> implements IKdYdOrderService {
     @Autowired
     private YDClient ydClient;
@@ -54,7 +57,8 @@ public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder
     private KdYdOrderDetailMapper kdYdOrderDetailMapper;
     @Autowired
     private KdYdOrderPaymentMapper kdYdOrderPaymentMapper;
-
+    @Value(value = "${kd.host}")
+    private String kdHost;
 
     @Override
     public Map<String, Object> insertkdYdOrder(Map map) {
@@ -79,7 +83,7 @@ public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder
                 formParams.put("jsons", jsonStr);
 
                 System.out.println("====" + formParams);
-                HttpResponse response = HttpRequest.post("http://113.45.187.194:70/xk/dyzn/WsBasedyzn.asmx/hgdjydtbdeletexsdd")
+                HttpResponse response = HttpRequest.post(kdHost+"/xk/dyzn/WsBasedyzn.asmx/hgdjydtbdeletexsdd")
                         .headerMap(headers, true)
                         .form(formParams)
                         .timeout(30000)  // 30秒超时
@@ -107,7 +111,7 @@ public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder
                 String jsonStr = JSON.toJSONString(result);
                 System.out.println("==" + jsonStr);
                 formParams.put("jsons", jsonStr);
-                HttpResponse response = HttpRequest.post("http://113.45.187.194:70/xk/dyzn/WsBasedyzn.asmx/hgdjydtbExcuteOperationxsdd")
+                HttpResponse response = HttpRequest.post(kdHost+"/xk/dyzn/WsBasedyzn.asmx/hgdjydtbExcuteOperationxsdd")
                         .headerMap(headers, true)
                         .form(formParams)
                         .timeout(30000)  // 30秒超时
@@ -252,6 +256,7 @@ public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder
                     int detailId = i + 1;
 
                     String sfys = safeGetString(row, "radioField_mhiui6v7");
+//                    String sjyskzfh = safeGetString(row, "radioField_ml7hg2oi");
                     String gldh = safeGetString(row, "textField_mhiui6va");
                     BigDecimal ysbl = toBigDecimal(UtilMap.getString(row, "numberField_mhiui6v6"));
                     BigDecimal ysje = toBigDecimal(UtilMap.getString(row, "numberField_mhiui6v8"));
@@ -260,6 +265,7 @@ public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder
 
                     table2Map.put("detailId", detailId);
                     table2Map.put("sfys", sfys);
+//                    table2Map.put("sjyskzfh", sjyskzfh);
                     table2Map.put("gldh", gldh);
                     table2Map.put("ysbl", ysbl);
                     table2Map.put("ysje", ysje);
@@ -309,16 +315,17 @@ public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder
 // 构建form参数
             Map<String, Object> formParams = new HashMap<>();
             formParams.put("jsons", jsonStr);
+            log.info("请求参数:" + formParams);
 // 发送请求
             HttpResponse response = null;
             if ("add".equals(actionType)) {
-                response = HttpRequest.post("http://113.45.187.194:70/xk/dyzn/WsBasedyzn.asmx/hgdjydtbxsdd")
+                response = HttpRequest.post(kdHost+"/xk/dyzn/WsBasedyzn.asmx/hgdjydtbxsdd")
                         .headerMap(headers, true)
                         .form(formParams)
                         .timeout(30000)  // 30秒超时
                         .execute();
             } else {
-                response = HttpRequest.post("http://113.45.187.194:70/xk/dyzn/WsBasedyzn.asmx/hgdjydtbupdatexsdd")
+                response = HttpRequest.post(kdHost+"/xk/dyzn/WsBasedyzn.asmx/hgdjydtbupdatexsdd")
                         .headerMap(headers, true)
                         .form(formParams)
                         .timeout(30000)  // 30秒超时
@@ -326,6 +333,7 @@ public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder
             }
 
             String responseBody = response.body();
+            log.info("Response Body: " + responseBody);
             try {
                 // 一行代码提取
                 String jdbh = JSON.parseArray(responseBody)
@@ -413,13 +421,13 @@ public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder
             }
 
             // 4. 获取客户现有信息
-            Map customerData = list.get(0);
+            Map customerData = (Map) list.get(0).get("formData");
             Double historicalAmount = UtilMap.getDouble(customerData, "numberField_mjm9k35k");
-            String dddateTimestampStr = UtilMap.getString(customerData, "dateField_mjqkkcsg");
-            String sfdateTimestampStr = UtilMap.getString(customerData, "dateField_mjm9k35l");
+            Long dddateTimestampStr = UtilMap.getLong(customerData, "dateField_mjqkkcsg");
+            Long sfdateTimestampStr = UtilMap.getLong(customerData, "dateField_mjm9k35l");
 
             // 参数校验
-            if (dddateTimestampStr == null || dddateTimestampStr.trim().isEmpty()) {
+            if (dddateTimestampStr == null) {
                 throw new RuntimeException("最后成交日期不能为空");
             }
 
@@ -439,14 +447,10 @@ public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder
                     ", 总金额=" + totalAmount);
 
             // 6. 时间戳转换
-            long dddateTimestamp = Long.parseLong(dddateTimestampStr.trim());
             long currentTimestamp = System.currentTimeMillis();
-            long sfdateTimestamp = (sfdateTimestampStr != null && !sfdateTimestampStr.trim().isEmpty())
-                    ? Long.parseLong(sfdateTimestampStr.trim()) : 0;
-
             // 计算时间差(天数)
-            long currentToDdDays = (currentTimestamp - dddateTimestamp) / (1000 * 60 * 60 * 24);
-            long sfToDdDays = (sfdateTimestamp > 0) ? (sfdateTimestamp - dddateTimestamp) / (1000 * 60 * 60 * 24) : 0;
+            long currentToDdDays = (currentTimestamp - dddateTimestampStr) / (1000 * 60 * 60 * 24);
+            long sfToDdDays = (sfdateTimestampStr > 0) ? (sfdateTimestampStr - dddateTimestampStr) / (1000 * 60 * 60 * 24) : 0;
 
             System.out.println("时间计算:当前时间-" + timestampToDateString(String.valueOf(currentTimestamp)) +
                     ", 成交日期-" + timestampToDateString(dddateTimestampStr) +
@@ -454,8 +458,8 @@ public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder
                     ", 公海-成交相差=" + sfToDdDays + "天");
 
             String ghcDateTimestamp = null;
-            String selectFieldValue = "";
-            String khsx = "";
+            String selectFieldValue = UtilMap.getString(customerData, "selectField_l3nrjuq0");
+            String khsx = UtilMap.getString(customerData, "selectField_mjsco9d4");
 
 // 1. 设置客户属性(单独判断)
             if (totalAmount >= 75000 && sfToDdDays <= 180) {
@@ -465,7 +469,7 @@ public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder
 // 2. 第一个条件:当前时间-成交日期<90天 且 总金额>0 且 公海日期-成交日期≈180天
             if (currentToDdDays < 90 && totalAmount > 0 && Math.abs(sfToDdDays - 180) <= 1) {
                 // 在成交日期上加90天
-                ghcDateTimestamp = String.valueOf(calculateTimestamp(sfdateTimestamp, 90));
+                ghcDateTimestamp = String.valueOf(calculateTimestamp(sfdateTimestampStr, 90));
                 selectFieldValue = "半年金额不足";
                 System.out.println("条件1触发:公海池时间设为成交日期+90天=" +
                         timestampToDateString(ghcDateTimestamp));
@@ -473,7 +477,7 @@ public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder
 // 3. 第二个条件:总金额≥7.5万 且 公海日期-成交日期≤180天
             else if (totalAmount >= 75000 && sfToDdDays <= 180) {
                 // 在成交日期上加180天
-                ghcDateTimestamp = String.valueOf(calculateTimestamp(sfdateTimestamp, 180));
+                ghcDateTimestamp = String.valueOf(calculateTimestamp(sfdateTimestampStr, 180));
                 selectFieldValue = "半年金额不足";
                 System.out.println("条件2触发:公海池时间设为成交日期+180天=" +
                         timestampToDateString(ghcDateTimestamp));
@@ -487,7 +491,7 @@ public class KdYdOrderServiceImpl extends ServiceImpl<KdYdOrderMapper, KdYdOrder
             else {
                 if (totalAmount > 0) {
                     // 基础情况:金额大于0
-                    ghcDateTimestamp = String.valueOf(calculateTimestamp(sfdateTimestamp, 90));
+                    ghcDateTimestamp = String.valueOf(calculateTimestamp(sfdateTimestampStr, 90));
                     selectFieldValue = "半年金额不足";
                     System.out.println("基础情况:金额大于0,公海池时间+90天=" +
                             timestampToDateString(ghcDateTimestamp));

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

@@ -267,6 +267,7 @@ public class KdYdOutboundServiceImpl extends ServiceImpl<KdYdOutboundMapper, KdY
                     // 添加主表字段
                     updateMap.put("dateField_krbgloam", safeConvertDateTimeToString(tableItem.get("dateTime")));
                     updateMap.put("textField_krnn5bmr", String.valueOf(tableItem.get("xsDept")));
+                    updateMap.put("textField_ml4qflc0", String.valueOf(tableItem.get("kdgs")));
                     updateMap.put("textField_mhjxw689", String.valueOf(tableItem.get("fhDept")));
                     updateMap.put("textField_mhjxw686", String.valueOf(tableItem.get("cgy")));
                     updateMap.put("selectField_mejowmna", String.valueOf(tableItem.get("djlx")));

+ 18 - 0
mjava-huagao/src/main/java/com/malk/huagao/service/impl/YdHuaGaoServiceImpl.java

@@ -944,6 +944,24 @@ public class YdHuaGaoServiceImpl implements YdHuaGaoService {
                 updateFormData.put("textField_mhabp7y0", sdbb);
                 updateFormData.put("textField_mfxbtcdr", chlb);
                 updateFormData.put("textField_mfxbtce5", xsy);
+                updateFormData.put("textField_mfxbtce6", sjzt);
+
+                updateFormData.put("dateField_ml4ikfa0",
+                        kdYdMaterial.getKsrq() != null && !kdYdMaterial.getKsrq().trim().isEmpty() ?
+                                java.time.LocalDate.parse(kdYdMaterial.getKsrq().trim())
+                                        .atStartOfDay(java.time.ZoneId.systemDefault())
+                                        .toInstant()
+                                        .toEpochMilli() :
+                                null
+                );
+                updateFormData.put("dateField_ml4ikfa1",
+                        kdYdMaterial.getJzrq() != null && !kdYdMaterial.getJzrq().trim().isEmpty() ?
+                                java.time.LocalDate.parse(kdYdMaterial.getJzrq().trim())
+                                        .atStartOfDay(java.time.ZoneId.systemDefault())
+                                        .toInstant()
+                                        .toEpochMilli() :
+                                null
+                );
 
                 //确保金额字段保留两位小数
                 if (xsjzj != null) {