This commit is contained in:
Van0313
2025-06-19 00:11:59 +08:00
parent 97e62eda54
commit 6105e963fa

View File

@@ -132,6 +132,7 @@ public class JDUtil {
//京粉链接 //京粉链接
private final HashMap<String, String> productWithJF = new HashMap<>(); private final HashMap<String, String> productWithJF = new HashMap<>();
// 构造函数中注入StringRedisTemplate // 构造函数中注入StringRedisTemplate
@Autowired @Autowired
public JDUtil(JDOrderRepository jdOrderRepository, StringRedisTemplate redisTemplate, OrderRowRepository orderRowRepository, WXUtil wxUtil, OrderUtil orderUtil, DeepSeekClientUtil deepSeekClientUtil, CommentRepository commentRepository, GPTClientUtil gptClientUtil) { public JDUtil(JDOrderRepository jdOrderRepository, StringRedisTemplate redisTemplate, OrderRowRepository orderRowRepository, WXUtil wxUtil, OrderUtil orderUtil, DeepSeekClientUtil deepSeekClientUtil, CommentRepository commentRepository, GPTClientUtil gptClientUtil) {
@@ -145,7 +146,8 @@ public class JDUtil {
this.gptClientUtil = gptClientUtil; this.gptClientUtil = gptClientUtil;
handleProductWithJF(); handleProductWithJF();
} }
private void handleProductWithJF(){
private void handleProductWithJF() {
productWithJF.put("ZQD130F-EB130", "https://u.jd.com/3GPePLu"); productWithJF.put("ZQD130F-EB130", "https://u.jd.com/3GPePLu");
productWithJF.put("ZQD130F-EB130B", "https://u.jd.com/3gPeGf6"); productWithJF.put("ZQD130F-EB130B", "https://u.jd.com/3gPeGf6");
productWithJF.put("ZQD180F-EB200", "https://u.jd.com/3OPe8m7"); productWithJF.put("ZQD180F-EB200", "https://u.jd.com/3OPe8m7");
@@ -956,7 +958,7 @@ public class JDUtil {
result.append(" ").append(skuName).append(" 礼金创建成功\n"); result.append(" ").append(skuName).append(" 礼金创建成功\n");
if (giftKey == null) { if (giftKey == null) {
result.append(" ").append(skuName).append(" 礼金创建失败但是转链成功\n"); result.append(" ").append(skuName).append(" 礼金创建失败但是转链成功\n");
}else { } else {
// 将开通成功的怼进去redis 做一个定时调度去扫描如果礼金今天会过期就发送通知需要判断是自营还是poppop礼金有效期是7天 // 将开通成功的怼进去redis 做一个定时调度去扫描如果礼金今天会过期就发送通知需要判断是自营还是poppop礼金有效期是7天
saveGiftCouponToRedis(skuId, giftKey, skuName, owner); saveGiftCouponToRedis(skuId, giftKey, skuName, owner);
} }
@@ -978,10 +980,11 @@ public class JDUtil {
cacheMap.remove("finalWenAn" + wxid); cacheMap.remove("finalWenAn" + wxid);
} }
} }
/* /*
将礼金信息写入 Redis **/ 将礼金信息写入 Redis **/
public void saveGiftCouponToRedis(String skuId, String giftKey, String skuName, String owner) { public void saveGiftCouponToRedis(String skuId, String giftKey, String skuName, String owner) {
String key = "gift_coupon:" + skuId ; String key = "gift_coupon:" + skuId;
String hashKey = giftKey; String hashKey = giftKey;
LocalDateTime expireTime = LocalDateTime.now().plus(owner.equals("g") ? 0 : 7, ChronoUnit.DAYS); LocalDateTime expireTime = LocalDateTime.now().plus(owner.equals("g") ? 0 : 7, ChronoUnit.DAYS);
@@ -994,6 +997,7 @@ public class JDUtil {
// 存入 Redis Hash // 存入 Redis Hash
redisTemplate.opsForHash().put(key, hashKey, JSON.toJSONString(data)); redisTemplate.opsForHash().put(key, hashKey, JSON.toJSONString(data));
} }
/** /**
* 处理用户输入的推广方案内容 * 处理用户输入的推广方案内容
* *
@@ -2067,7 +2071,7 @@ public class JDUtil {
public LocalDate getDateFromLD(String dateStr) { public LocalDate getDateFromLD(String dateStr) {
logger.info("开始解析日期 {}", dateStr); logger.info("开始解析日期 {}", dateStr);
if (dateStr.equals("昨天")){ if (dateStr.equals("昨天")) {
return getEffectiveToday().minusDays(1).toLocalDate(); return getEffectiveToday().minusDays(1).toLocalDate();
} }
// 定义支持的日期格式 // 定义支持的日期格式
@@ -2169,7 +2173,8 @@ public class JDUtil {
// 发送详细订单列表 // 发送详细订单列表
StringBuilder detailBuilder = new StringBuilder(); StringBuilder detailBuilder = new StringBuilder();
for (JDOrder order : sortedOrders) { for (JDOrder order : sortedOrders) {
detailBuilder.append("单:").append(order.getRemark() != null ? order.getRemark() : "未提供").append("\n型号").append(order.getModelNumber() != null ? order.getModelNumber() : "未提供").append("\n下单付款").append(order.getPaymentAmount() != null ? String.format("%.2f", order.getPaymentAmount()) : "0.00").append("").append("\n后返金额").append(order.getRebateAmount() != null ? String.format("%.2f", order.getRebateAmount()) : "0.00").append("").append("\n地址").append(order.getAddress() != null ? order.getAddress() : "未提供").append("\n物流链接\n").append(order.getLogisticsLink() != null ? order.getLogisticsLink() : "").append("\n────────────\n"); detailBuilder.append("单:").append(order.getRemark() != null ? order.getRemark() : "未提供")
.append("\n备注").append(order.getStatus() != null ? order.getStatus() : " ").append("\n型号").append(order.getModelNumber() != null ? order.getModelNumber() : "未提供").append("\n下单付款").append(order.getPaymentAmount() != null ? String.format("%.2f", order.getPaymentAmount()) : "0.00").append("").append("\n后返金额").append(order.getRebateAmount() != null ? String.format("%.2f", order.getRebateAmount()) : "0.00").append("").append("\n地址").append(order.getAddress() != null ? order.getAddress() : "未提供").append("\n物流链接\n").append(order.getLogisticsLink() != null ? order.getLogisticsLink() : "").append("\n────────────\n");
} }
// 发送详细订单消息 // 发送详细订单消息
@@ -2206,7 +2211,7 @@ public class JDUtil {
} }
} }
batchSb.append(jdOrder.getRemark()).append("\t").append(jdOrder.getOrderId()).append("\t").append(DateUtil.dateToStr(jdOrder.getOrderTime(), "yyyy-MM-dd")).append("\t").append(jdOrder.getModelNumber()).append("\t").append(jdOrder.getAddress()).append("\t").append(jdOrder.getLogisticsLink()).append("\t\t").append(jdOrder.getBuyer()).append("\t").append(jdOrder.getPaymentAmount()).append("\t").append(jdOrder.getRebateAmount()).append("\t").append(distributionMark2).append("\n"); batchSb.append(jdOrder.getRemark()).append("\t").append(jdOrder.getOrderId()).append("\t").append(DateUtil.dateToStr(jdOrder.getOrderTime(), "yyyy-MM-dd")).append("\t").append(jdOrder.getModelNumber()).append("\t").append(jdOrder.getAddress()).append("\t").append(jdOrder.getLogisticsLink()).append("\t\t").append(jdOrder.getBuyer()).append("\t").append(jdOrder.getPaymentAmount()).append("\t").append(jdOrder.getRebateAmount()).append("\t").append(distributionMark2).append("\t").append(jdOrder.getStatus()).append("\n");
} }
// 发送每批次的订单信息 // 发送每批次的订单信息