This commit is contained in:
van
2026-04-11 00:48:37 +08:00
parent fed0158444
commit 5205d8c155
8 changed files with 111 additions and 12 deletions

View File

@@ -45,6 +45,9 @@ public interface IErpGoofishOrderService {
/** 京东物流服务在写 Redis / 企微货主推送后、触发闲鱼同步前记一笔source=JD_LOGISTICS_PUSH。 */
void traceJdLogisticsPushForGoofish(Long jdOrderId, String waybillNo, String summary);
/** 是否存在关联本京东单的闲管家订单(用于物流企微走闲鱼自建应用)。 */
boolean hasLinkedGoofishOrder(Long jdOrderId);
/** 订单状态 / 物流 / 发货 变更日志(新→旧) */
List<ErpGoofishOrderEventLog> listEventLogsByOrderId(Long orderId);

View File

@@ -28,7 +28,9 @@ public class GoofishOrderChangeLogger {
public static final String TYPE_LOGISTICS = "LOGISTICS_SYNC";
public static final String TYPE_SHIP = "SHIP";
/** 京东物流扫描服务Redis + 企微货主推送链路(见 LogisticsServiceImpl不再二次走 wxSend 闲鱼应用避免重复打扰 */
/**
* 京东物流扫描:货主通知已由 LogisticsServiceImpl 走闲鱼自建应用或 PDD此处仅落库避免再调 wxSend 重复推送。
*/
public static final String SOURCE_JD_LOGISTICS_PUSH = "JD_LOGISTICS_PUSH";
@Resource

View File

@@ -171,6 +171,17 @@ public class ErpGoofishOrderServiceImpl implements IErpGoofishOrderService {
}
}
@Override
public boolean hasLinkedGoofishOrder(Long jdOrderId) {
if (jdOrderId == null) {
return false;
}
ErpGoofishOrder query = new ErpGoofishOrder();
query.setJdOrderId(jdOrderId);
List<ErpGoofishOrder> list = erpGoofishOrderMapper.selectList(query);
return list != null && !list.isEmpty();
}
@Override
public void traceJdLogisticsPushForGoofish(Long jdOrderId, String waybillNo, String summary) {
if (jdOrderId == null || goofishOrderChangeLogger == null) {

View File

@@ -9,6 +9,7 @@ import com.ruoyi.jarvis.mapper.WeComShareLinkLogisticsJobMapper;
import com.ruoyi.jarvis.service.IErpGoofishOrderService;
import com.ruoyi.jarvis.service.ILogisticsService;
import com.ruoyi.jarvis.service.IJDOrderService;
import com.ruoyi.jarvis.wecom.WxSendGoofishNotifyClient;
import com.ruoyi.system.service.ISysConfigService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -85,6 +86,9 @@ public class LogisticsServiceImpl implements ILogisticsService {
@Resource
private IErpGoofishOrderService erpGoofishOrderService;
@Resource
private WxSendGoofishNotifyClient wxSendGoofishNotifyClient;
@PostConstruct
public void init() {
@@ -847,8 +851,23 @@ public class LogisticsServiceImpl implements ILogisticsService {
// 运单号
pushContent.append("运单号:").append("\n").append("\n").append("\n").append("\n").append(waybillNo).append("\n");
// 调用企业微信推送接口
boolean useGoofishWecom = erpGoofishOrderService.hasLinkedGoofishOrder(order.getId())
|| (distributionMark != null && distributionMark.contains("闲鱼"));
if (useGoofishWecom) {
String touserGoofish = getTouserByDistributionMark(distributionMark);
String fullText = "JD物流信息推送\n" + pushContent;
logger.info("闲鱼关联或分销含「闲鱼」:尝试企微闲鱼自建应用 - 订单ID: {}, 分销标识: {}, 接收人: {}",
order.getId(), distributionMark,
StringUtils.hasText(touserGoofish) ? touserGoofish : "(jarvis.wecom.goofish-notify-touser)");
if (wxSendGoofishNotifyClient.pushGoofishAgentText(touserGoofish, fullText)) {
logger.info("企微闲鱼应用推送成功 - 订单ID: {}, 订单号: {}, waybill_no: {}",
order.getId(), order.getOrderId(), waybillNo);
return true;
}
logger.warn("企微闲鱼应用推送失败或未配置 wxSend回退 PDD 通道 - 订单ID: {}", order.getId());
}
// 调用企业微信推送接口PDD 自建应用)
JSONObject pushParam = new JSONObject();
pushParam.put("title", "JD物流信息推送");
pushParam.put("text", pushContent.toString());