1
This commit is contained in:
@@ -84,10 +84,10 @@ public class GoofishOrderChangeLogger {
|
||||
|
||||
List<String> orderParts = new ArrayList<>();
|
||||
if (!Objects.equals(b.orderStatus, a.orderStatus)) {
|
||||
orderParts.add("订单状态 " + str(b.orderStatus) + "→" + str(a.orderStatus));
|
||||
orderParts.add("订单状态 " + GoofishStatusLabels.orderStatusChange(b.orderStatus, a.orderStatus));
|
||||
}
|
||||
if (!Objects.equals(b.refundStatus, a.refundStatus)) {
|
||||
orderParts.add("退款状态 " + str(b.refundStatus) + "→" + str(a.refundStatus));
|
||||
orderParts.add("退款状态 " + GoofishStatusLabels.refundStatusChange(b.refundStatus, a.refundStatus));
|
||||
}
|
||||
if (!orderParts.isEmpty()) {
|
||||
append(afterRow.getId(), afterRow.getAppKey(), afterRow.getOrderNo(), TYPE_ORDER, source,
|
||||
|
||||
@@ -143,15 +143,17 @@ public class GoofishOrderPipeline {
|
||||
if (existingBeforeUpdate == null) {
|
||||
goofishOrderChangeLogger.append(loaded.getId(), loaded.getAppKey(), loaded.getOrderNo(),
|
||||
GoofishOrderChangeLogger.TYPE_ORDER, upsertSource,
|
||||
"新订单入库,订单状态 " + loaded.getOrderStatus() + ",退款状态 " + loaded.getRefundStatus());
|
||||
"新订单入库,订单状态 " + GoofishStatusLabels.orderStatusHuman(loaded.getOrderStatus())
|
||||
+ ",退款状态 " + GoofishStatusLabels.refundStatusHuman(loaded.getRefundStatus()));
|
||||
return;
|
||||
}
|
||||
if (!Objects.equals(existingBeforeUpdate.getOrderStatus(), upsertPayload.getOrderStatus())
|
||||
|| !Objects.equals(existingBeforeUpdate.getRefundStatus(), upsertPayload.getRefundStatus())) {
|
||||
goofishOrderChangeLogger.append(loaded.getId(), loaded.getAppKey(), loaded.getOrderNo(),
|
||||
GoofishOrderChangeLogger.TYPE_ORDER, upsertSource,
|
||||
"订单状态 " + existingBeforeUpdate.getOrderStatus() + "→" + upsertPayload.getOrderStatus()
|
||||
+ ";退款状态 " + existingBeforeUpdate.getRefundStatus() + "→" + upsertPayload.getRefundStatus());
|
||||
"订单状态 " + GoofishStatusLabels.orderStatusChange(existingBeforeUpdate.getOrderStatus(), upsertPayload.getOrderStatus())
|
||||
+ ";退款状态 " + GoofishStatusLabels.refundStatusChange(
|
||||
existingBeforeUpdate.getRefundStatus(), upsertPayload.getRefundStatus()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.ruoyi.jarvis.service.goofish;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 闲管家开放平台:订单状态、退款状态中文说明(与 Apifox 订单列表 schema 一致)
|
||||
*/
|
||||
public final class GoofishStatusLabels {
|
||||
|
||||
private static final Map<Integer, String> ORDER = new HashMap<>();
|
||||
private static final Map<Integer, String> REFUND = new HashMap<>();
|
||||
|
||||
static {
|
||||
ORDER.put(11, "待付款");
|
||||
ORDER.put(12, "待发货");
|
||||
ORDER.put(21, "已发货");
|
||||
ORDER.put(22, "已完成");
|
||||
ORDER.put(23, "已退款");
|
||||
ORDER.put(24, "已关闭");
|
||||
REFUND.put(0, "未申请退款");
|
||||
REFUND.put(1, "待商家处理");
|
||||
REFUND.put(2, "待买家退货");
|
||||
REFUND.put(3, "待商家收货");
|
||||
REFUND.put(4, "退款关闭");
|
||||
REFUND.put(5, "退款成功");
|
||||
REFUND.put(6, "已拒绝退款");
|
||||
REFUND.put(8, "待确认退货地址");
|
||||
}
|
||||
|
||||
private GoofishStatusLabels() {
|
||||
}
|
||||
|
||||
/** 仅中文;未知时返回 null */
|
||||
public static String orderStatusLabel(Integer s) {
|
||||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
return ORDER.get(s);
|
||||
}
|
||||
|
||||
/** 仅中文;未知时返回 null */
|
||||
public static String refundStatusLabel(Integer s) {
|
||||
if (s == null) {
|
||||
return null;
|
||||
}
|
||||
return REFUND.get(s);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于日志/企微:优先中文,未知时带码便于排查
|
||||
*/
|
||||
public static String orderStatusHuman(Integer s) {
|
||||
String t = orderStatusLabel(s);
|
||||
if (t != null) {
|
||||
return t;
|
||||
}
|
||||
if (s == null) {
|
||||
return "—";
|
||||
}
|
||||
return "未识别状态(" + s + ")";
|
||||
}
|
||||
|
||||
public static String refundStatusHuman(Integer s) {
|
||||
String t = refundStatusLabel(s);
|
||||
if (t != null) {
|
||||
return t;
|
||||
}
|
||||
if (s == null) {
|
||||
return "—";
|
||||
}
|
||||
return "未识别状态(" + s + ")";
|
||||
}
|
||||
|
||||
/**
|
||||
* 变化摘要:A→B,两边均为人话
|
||||
*/
|
||||
public static String orderStatusChange(Integer from, Integer to) {
|
||||
return orderStatusHuman(from) + " → " + orderStatusHuman(to);
|
||||
}
|
||||
|
||||
public static String refundStatusChange(Integer from, Integer to) {
|
||||
return refundStatusHuman(from) + " → " + refundStatusHuman(to);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user