|
|
@@ -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));
|