1
This commit is contained in:
@@ -821,37 +821,10 @@ public class LogisticsServiceImpl implements ILogisticsService {
|
|||||||
*/
|
*/
|
||||||
private boolean sendEnterprisePushNotification(JDOrder order, String waybillNo, boolean logisticsLinkUpdated, String oldLogisticsLink, String newLogisticsLink) {
|
private boolean sendEnterprisePushNotification(JDOrder order, String waybillNo, boolean logisticsLinkUpdated, String oldLogisticsLink, String newLogisticsLink) {
|
||||||
try {
|
try {
|
||||||
// 构建推送消息内容
|
|
||||||
StringBuilder pushContent = new StringBuilder();
|
|
||||||
|
|
||||||
// 第一行:分销标识(如 F-闲鱼)
|
|
||||||
String distributionMark = order.getDistributionMark() != null ? order.getDistributionMark() : "未知";
|
String distributionMark = order.getDistributionMark() != null ? order.getDistributionMark() : "未知";
|
||||||
pushContent.append(distributionMark).append("\n");
|
|
||||||
|
|
||||||
String thirdPartyOrderNo = order.getThirdPartyOrderNo();
|
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 modelStr = order.getModelNumber() != null ? order.getModelNumber() : "无";
|
||||||
String addressStr = order.getAddress() != null ? order.getAddress() : "无";
|
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;
|
String goofishOrderNo;
|
||||||
if (thirdPartyOrderNo != null && !thirdPartyOrderNo.trim().isEmpty()) {
|
if (thirdPartyOrderNo != null && !thirdPartyOrderNo.trim().isEmpty()) {
|
||||||
goofishOrderNo = thirdPartyOrderNo.trim();
|
goofishOrderNo = thirdPartyOrderNo.trim();
|
||||||
@@ -860,11 +833,22 @@ public class LogisticsServiceImpl implements ILogisticsService {
|
|||||||
} else {
|
} else {
|
||||||
goofishOrderNo = "无";
|
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(goofishOrderNo).append("\n");
|
||||||
pushContent.append("型号:").append(modelStr).append("\n");
|
pushContent.append("型号:").append(modelStr).append("\n");
|
||||||
pushContent.append("收货地址:").append(addressStr).append("\n");
|
pushContent.append("收货地址:").append(addressStr).append("\n");
|
||||||
pushContent.append("运单号:").append(waybillNo).append("\n");
|
pushContent.append("运单号:").append(waybillNo).append("\n");
|
||||||
|
|
||||||
|
String fullText = pushContent.toString();
|
||||||
|
|
||||||
boolean useGoofishWecom = erpGoofishOrderService.hasLinkedGoofishOrder(order.getId())
|
boolean useGoofishWecom = erpGoofishOrderService.hasLinkedGoofishOrder(order.getId())
|
||||||
|| (distributionMark != null && distributionMark.contains("闲鱼"));
|
|| (distributionMark != null && distributionMark.contains("闲鱼"));
|
||||||
if (useGoofishWecom) {
|
if (useGoofishWecom) {
|
||||||
@@ -872,7 +856,7 @@ public class LogisticsServiceImpl implements ILogisticsService {
|
|||||||
logger.info("闲鱼关联或分销含「闲鱼」:尝试企微闲鱼自建应用 - 订单ID: {}, 分销标识: {}, 接收人: {}",
|
logger.info("闲鱼关联或分销含「闲鱼」:尝试企微闲鱼自建应用 - 订单ID: {}, 分销标识: {}, 接收人: {}",
|
||||||
order.getId(), distributionMark,
|
order.getId(), distributionMark,
|
||||||
StringUtils.hasText(touserGoofish) ? touserGoofish : "(jarvis.wecom.goofish-notify-touser)");
|
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: {}",
|
logger.info("企微闲鱼应用推送成功 - 订单ID: {}, 订单号: {}, waybill_no: {}",
|
||||||
order.getId(), order.getOrderId(), waybillNo);
|
order.getId(), order.getOrderId(), waybillNo);
|
||||||
return true;
|
return true;
|
||||||
@@ -883,8 +867,8 @@ public class LogisticsServiceImpl implements ILogisticsService {
|
|||||||
|
|
||||||
// 调用企业微信推送接口(PDD 自建应用)
|
// 调用企业微信推送接口(PDD 自建应用)
|
||||||
JSONObject pushParam = new JSONObject();
|
JSONObject pushParam = new JSONObject();
|
||||||
pushParam.put("title", "JD物流信息推送");
|
pushParam.put("title", "");
|
||||||
pushParam.put("text", pushContent.toString());
|
pushParam.put("text", fullText);
|
||||||
|
|
||||||
// 根据分销标识获取接收人列表
|
// 根据分销标识获取接收人列表
|
||||||
String touser = getTouserByDistributionMark(distributionMark);
|
String touser = getTouserByDistributionMark(distributionMark);
|
||||||
|
|||||||
Reference in New Issue
Block a user