记得上下班打卡 | git大法好,push需谨慎

Commit 44065b25 authored by 姜秀龙's avatar 姜秀龙

完善 修改快递单号

parent b3a940a1
......@@ -219,6 +219,16 @@ public class GoblinMailTrackServiceImpl implements IGoblinMailTrackService {
log.warn("[mailTrack] callback missing mailId, nu={}", push.getLastResult().getNu());
return resp;
}
// 改单号后 mailId 不变,旧订阅仍可能推送:仅接受与当前 mailNo 一致的推送
String pushNu = push.getLastResult() != null ? push.getLastResult().getNu() : null;
GoblinMailVo currentMail = findMail(orderId, mailId);
if (currentMail != null && StringUtils.isNotBlank(currentMail.getMailNo())
&& StringUtils.isNotBlank(pushNu)
&& !currentMail.getMailNo().trim().equalsIgnoreCase(pushNu.trim())) {
log.warn("[mailTrack] callback mailNo mismatch, ignore. mailId={}, currentMailNo={}, pushNu={}",
mailId, currentMail.getMailNo(), pushNu);
return resp;
}
GoblinMailTrackCache cache = redisUtils.getMailTrackCache(mailId);
if (cache == null) {
cache = newEmptyCache(orderId, mailId);
......
......@@ -948,6 +948,8 @@ public class GoblinStoreOrderServiceImpl implements IGoblinStoreOrderService {
)
);
if (cached != null) {
// 改单号后清掉旧轨迹,避免旧订阅推送与新单号互相覆盖;旧推送由回调 mailNo 校验丢弃
redisUtils.delMailTrackCache(mailId);
goblinMailTrackService.initAndSubscribeAsync(orderId, mailId, cached.getMailNo(),
cached.getLogisticsCode(), cached.getLogisticsCompany());
}
......
......@@ -1588,6 +1588,13 @@ public class GoblinRedisUtils {
return (GoblinMailTrackCache) obj;
}
public void delMailTrackCache(String mailId) {
if (!StringUtils.hasText(mailId)) {
return;
}
redisUtil.del(GoblinRedisConst.REDIS_GOBLIN_MAIL_TRACK.concat(mailId));
}
// 获取 订单相关vo
public GoblinStoreOrderVo getGoblinOrder(String orderId) {
String redisKey = GoblinRedisConst.REDIS_GOBLIN_ORDER.concat(orderId);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment