From babe687679a7f17300cd065e4a7b54a3cb203950 Mon Sep 17 00:00:00 2001 From: van Date: Wed, 22 Apr 2026 00:55:51 +0800 Subject: [PATCH] 1 --- .../service/impl/LogisticsServiceImpl.java | 46 ++++++------------- 1 file changed, 15 insertions(+), 31 deletions(-) diff --git a/ruoyi-system/src/main/java/com/ruoyi/jarvis/service/impl/LogisticsServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/jarvis/service/impl/LogisticsServiceImpl.java index 423f684..76a36b6 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/jarvis/service/impl/LogisticsServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/jarvis/service/impl/LogisticsServiceImpl.java @@ -821,37 +821,10 @@ public class LogisticsServiceImpl implements ILogisticsService { */ private boolean sendEnterprisePushNotification(JDOrder order, String waybillNo, boolean logisticsLinkUpdated, String oldLogisticsLink, String newLogisticsLink) { try { - // 构建推送消息内容 - StringBuilder pushContent = new StringBuilder(); - - // 第一行:分销标识(如 F-闲鱼) String distributionMark = order.getDistributionMark() != null ? order.getDistributionMark() : "未知"; - pushContent.append(distributionMark).append("\n"); - String thirdPartyOrderNo = order.getThirdPartyOrderNo(); - if (thirdPartyOrderNo != null && !thirdPartyOrderNo.trim().isEmpty()) { - pushContent.append("第三方单号:").append(thirdPartyOrderNo.trim()).append("\n"); - } - String modelStr = order.getModelNumber() != null ? order.getModelNumber() : "无"; String addressStr = order.getAddress() != null ? order.getAddress() : "无"; - pushContent.append("型号:").append(modelStr).append("\n"); - pushContent.append("收货地址:").append(addressStr).append("\n"); - - // 如果物流链接已更新,在推送消息中说明 - if (logisticsLinkUpdated && newLogisticsLink != null && !newLogisticsLink.trim().isEmpty()) { - pushContent.append("【物流链接已更新】").append("\n"); - pushContent.append("新物流链接:").append(newLogisticsLink.trim()).append("\n"); - if (oldLogisticsLink != null && !oldLogisticsLink.trim().isEmpty()) { - pushContent.append("旧物流链接:").append(oldLogisticsLink.trim()).append("\n"); - } - pushContent.append("\n"); - } - - // 运单号(首段:冒号后多行留白再写单号,便于复制) - pushContent.append("运单号:").append("\n").append("\n").append("\n").append("\n").append(waybillNo).append("\n\n\n"); - // 闲鱼自动发货段:运单号紧跟在冒号后同一行 - pushContent.append("闲鱼自动发货:").append("\n"); String goofishOrderNo; if (thirdPartyOrderNo != null && !thirdPartyOrderNo.trim().isEmpty()) { goofishOrderNo = thirdPartyOrderNo.trim(); @@ -860,11 +833,22 @@ public class LogisticsServiceImpl implements ILogisticsService { } else { goofishOrderNo = "无"; } + + if (logisticsLinkUpdated && newLogisticsLink != null && !newLogisticsLink.trim().isEmpty()) { + logger.info("物流链接已更新(正文仅发闲鱼自动发货块) - 订单ID: {}, 新链接: {}", + order.getId(), newLogisticsLink.trim()); + } + + // 企微正文仅「闲鱼自动发货」固定版式;title 置空,整段写入 text + StringBuilder pushContent = new StringBuilder(); + pushContent.append("闲鱼自动发货:").append("\n"); pushContent.append("单号:").append(goofishOrderNo).append("\n"); pushContent.append("型号:").append(modelStr).append("\n"); pushContent.append("收货地址:").append(addressStr).append("\n"); pushContent.append("运单号:").append(waybillNo).append("\n"); - + + String fullText = pushContent.toString(); + boolean useGoofishWecom = erpGoofishOrderService.hasLinkedGoofishOrder(order.getId()) || (distributionMark != null && distributionMark.contains("闲鱼")); if (useGoofishWecom) { @@ -872,7 +856,7 @@ public class LogisticsServiceImpl implements ILogisticsService { logger.info("闲鱼关联或分销含「闲鱼」:尝试企微闲鱼自建应用 - 订单ID: {}, 分销标识: {}, 接收人: {}", order.getId(), distributionMark, StringUtils.hasText(touserGoofish) ? touserGoofish : "(jarvis.wecom.goofish-notify-touser)"); - if (wxSendGoofishNotifyClient.pushGoofishAgentText(touserGoofish, "JD物流信息推送", pushContent.toString())) { + if (wxSendGoofishNotifyClient.pushGoofishAgentText(touserGoofish, "", fullText)) { logger.info("企微闲鱼应用推送成功 - 订单ID: {}, 订单号: {}, waybill_no: {}", order.getId(), order.getOrderId(), waybillNo); return true; @@ -883,8 +867,8 @@ public class LogisticsServiceImpl implements ILogisticsService { // 调用企业微信推送接口(PDD 自建应用) JSONObject pushParam = new JSONObject(); - pushParam.put("title", "JD物流信息推送"); - pushParam.put("text", pushContent.toString()); + pushParam.put("title", ""); + pushParam.put("text", fullText); // 根据分销标识获取接收人列表 String touser = getTouserByDistributionMark(distributionMark);