Compare commits
2 Commits
de335831d4
...
a7068053e1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a7068053e1 | ||
|
|
babe687679 |
@@ -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,19 +833,48 @@ public class LogisticsServiceImpl implements ILogisticsService {
|
||||
} else {
|
||||
goofishOrderNo = "无";
|
||||
}
|
||||
pushContent.append("单号:").append(goofishOrderNo).append("\n");
|
||||
pushContent.append("型号:").append(modelStr).append("\n");
|
||||
pushContent.append("收货地址:").append(addressStr).append("\n");
|
||||
pushContent.append("运单号:").append(waybillNo).append("\n");
|
||||
|
||||
|
||||
boolean useGoofishWecom = erpGoofishOrderService.hasLinkedGoofishOrder(order.getId())
|
||||
|| (distributionMark != null && distributionMark.contains("闲鱼"));
|
||||
|
||||
String fullText;
|
||||
if (useGoofishWecom) {
|
||||
// 闲鱼:仅「闲鱼自动发货」块,便于复制到平台
|
||||
StringBuilder goofish = new StringBuilder();
|
||||
goofish.append("闲鱼自动发货:").append("\n");
|
||||
goofish.append("单号:").append(goofishOrderNo).append("\n");
|
||||
goofish.append("型号:").append(modelStr).append("\n");
|
||||
goofish.append("收货地址:").append(addressStr).append("\n");
|
||||
goofish.append("运单号:").append(waybillNo).append("\n");
|
||||
fullText = goofish.toString();
|
||||
} else {
|
||||
// 非闲鱼:沿用京东物流信息完整版式(与历史 PDD 通道一致),不出现「闲鱼自动发货」
|
||||
StringBuilder std = new StringBuilder();
|
||||
std.append("JD物流信息推送").append("\n");
|
||||
std.append(distributionMark).append("\n");
|
||||
if (thirdPartyOrderNo != null && !thirdPartyOrderNo.trim().isEmpty()) {
|
||||
std.append("第三方单号:").append(thirdPartyOrderNo.trim()).append("\n");
|
||||
}
|
||||
std.append("型号:").append(modelStr).append("\n");
|
||||
std.append("收货地址:").append(addressStr).append("\n");
|
||||
if (logisticsLinkUpdated && newLogisticsLink != null && !newLogisticsLink.trim().isEmpty()) {
|
||||
std.append("【物流链接已更新】").append("\n");
|
||||
std.append("新物流链接:").append(newLogisticsLink.trim()).append("\n");
|
||||
if (oldLogisticsLink != null && !oldLogisticsLink.trim().isEmpty()) {
|
||||
std.append("旧物流链接:").append(oldLogisticsLink.trim()).append("\n");
|
||||
}
|
||||
std.append("\n");
|
||||
}
|
||||
std.append("运单号:").append("\n").append("\n").append("\n").append("\n").append(waybillNo).append("\n");
|
||||
fullText = std.toString();
|
||||
}
|
||||
|
||||
if (useGoofishWecom) {
|
||||
String touserGoofish = getTouserByDistributionMark(distributionMark);
|
||||
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 +885,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);
|
||||
|
||||
Reference in New Issue
Block a user