This commit is contained in:
van
2026-04-21 23:37:18 +08:00
parent a10d561fcb
commit de335831d4
7 changed files with 102 additions and 36 deletions

View File

@@ -113,11 +113,15 @@ public class WxSendGoofishNotifyClient {
private static String buildContent(String orderNo, String eventType, String source, String message) {
StringBuilder sb = new StringBuilder();
sb.append("【闲鱼订单】").append(orderNo != null ? orderNo : "-").append("\n");
if (StringUtils.hasText(eventType)) {
sb.append(eventType);
}
if (StringUtils.hasText(source)) {
sb.append(" | ").append(source);
String typeLabel = humanEventType(eventType);
String srcLabel = humanSource(source);
if (StringUtils.hasText(typeLabel)) {
sb.append(typeLabel);
if (StringUtils.hasText(srcLabel)) {
sb.append(" · ").append(srcLabel);
}
} else if (StringUtils.hasText(srcLabel)) {
sb.append(srcLabel);
}
sb.append("\n");
if (StringUtils.hasText(message)) {
@@ -130,6 +134,50 @@ public class WxSendGoofishNotifyClient {
return s;
}
/** 企微展示用,与库内 event_type 枚举一致 */
private static String humanEventType(String eventType) {
if (!StringUtils.hasText(eventType)) {
return "";
}
switch (eventType.trim()) {
case "ORDER_SYNC":
return "订单同步";
case "LOGISTICS_SYNC":
return "物流同步";
case "SHIP":
return "发货";
default:
return eventType.trim();
}
}
/** 企微展示用,与库内 source 一致 */
private static String humanSource(String source) {
if (!StringUtils.hasText(source)) {
return "";
}
switch (source.trim()) {
case "LIST_UPSERT":
return "列表拉单写入";
case "NOTIFY_UPSERT":
return "推送回调写入";
case "LIST":
return "列表摘要";
case "DETAIL_REFRESH":
return "详情刷新";
case "NOTIFY":
return "推送";
case "REDIS_WAYBILL":
return "Redis 运单";
case "AUTO_SHIP":
return "自动发货";
case "JD_LOGISTICS_PUSH":
return "京东物流扫描";
default:
return source.trim();
}
}
/**
* 逗号或 | 分隔的 UserID → 企微 API 要求的 user1|user2
*/