This commit is contained in:
van
2026-04-03 17:48:33 +08:00
parent fa7e26cf6e
commit 3e37587074
5 changed files with 19 additions and 4 deletions

View File

@@ -35,7 +35,7 @@ public interface ILogisticsService {
void pushShareLinkJobToRedis(WeComShareLinkLogisticsJob job);
/**
* 扫描落库表中仍待处理的任务({@code create_time} 一个月内),在限频下补入 Redis(覆盖纯 SQL 补录、Redis 曾丢失等),避免仅靠企微回调入队
* 扫描落库表中仍待处理的任务(含 {@code ABANDONED},对账时会重置计数后再入队;仅 {@code create_time} 一个月内),在限频下补入 Redis。
*
* @return 本次获得限频锁并成功推入队列的条数
*/

View File

@@ -497,7 +497,21 @@ public class LogisticsServiceImpl implements ILogisticsService {
continue;
}
try {
pushShareLinkJobToRedis(job);
WeComShareLinkLogisticsJob toEnqueue = job;
if ("ABANDONED".equalsIgnoreCase(job.getStatus())) {
String prev = StringUtils.hasText(job.getLastNote()) ? job.getLastNote() : "";
if (prev.length() > 400) {
prev = prev.substring(0, 400) + "";
}
String note = "requeue_after_abandon|" + prev;
weComShareLinkLogisticsJobMapper.updateByJobKey(job.getJobKey().trim(), "WAITING", note, 0, null);
toEnqueue = weComShareLinkLogisticsJobMapper.selectByJobKey(job.getJobKey().trim());
if (toEnqueue == null) {
stringRedisTemplate.delete(lockKey);
continue;
}
}
pushShareLinkJobToRedis(toEnqueue);
pushed++;
} catch (Exception e) {
try {