1
This commit is contained in:
@@ -4,7 +4,8 @@ import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
* 企微分享链物流任务 wecom_share_link_logistics_job
|
||||
* 企微分享链物流任务 wecom_share_link_logistics_job。
|
||||
* 状态含 CANCELLED:不再参与对账入队与队列扫描(订单取消等场景)。
|
||||
*/
|
||||
public class WeComShareLinkLogisticsJob extends BaseEntity {
|
||||
|
||||
|
||||
@@ -25,4 +25,6 @@ public interface WeComShareLinkLogisticsJobMapper {
|
||||
* 仅 {@code create_time} 在最近一个月内的记录,避免扫到过旧历史。
|
||||
*/
|
||||
List<WeComShareLinkLogisticsJob> selectJobsNeedingQueueReconcile(@Param("limit") int limit);
|
||||
|
||||
int deleteByJobKey(@Param("jobKey") String jobKey);
|
||||
}
|
||||
|
||||
@@ -472,6 +472,11 @@ public class LogisticsServiceImpl implements ILogisticsService {
|
||||
logger.warn("adhoc 入队跳过:jobKey 或 trackingUrl 为空");
|
||||
return;
|
||||
}
|
||||
WeComShareLinkLogisticsJob row = weComShareLinkLogisticsJobMapper.selectByJobKey(job.getJobKey().trim());
|
||||
if (row != null && "CANCELLED".equalsIgnoreCase(row.getStatus())) {
|
||||
logger.info("adhoc 入队跳过:任务已取消 jobKey={}", job.getJobKey());
|
||||
return;
|
||||
}
|
||||
int attempts = job.getScanAttempts() != null ? job.getScanAttempts() : 0;
|
||||
rightPushAdhocQueueJson(job.getJobKey().trim(), attempts, job.getTrackingUrl().trim(),
|
||||
job.getUserRemark(), job.getTouserPush(), job.getFromUserName());
|
||||
@@ -561,6 +566,13 @@ public class LogisticsServiceImpl implements ILogisticsService {
|
||||
String touser = o.getString("touser");
|
||||
String jobKey = o.getString("jobKey");
|
||||
int attempts = o.getIntValue("attempts");
|
||||
if (StringUtils.hasText(jobKey)) {
|
||||
WeComShareLinkLogisticsJob row = weComShareLinkLogisticsJobMapper.selectByJobKey(jobKey.trim());
|
||||
if (row == null || "CANCELLED".equalsIgnoreCase(row.getStatus())) {
|
||||
logger.info("adhoc 队列项跳过(任务已删除或已取消扫描) jobKey={} rowNull={}", jobKey, row == null);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
AdhocTryResult tr = tryAdhocShareLinkOnce(url, remark, touser, null);
|
||||
if (tr.needsRequeue) {
|
||||
int nextAttempts = attempts + 1;
|
||||
|
||||
@@ -78,4 +78,8 @@
|
||||
order by id asc
|
||||
limit #{limit}
|
||||
</select>
|
||||
|
||||
<delete id="deleteByJobKey">
|
||||
delete from wecom_share_link_logistics_job where job_key = #{jobKey}
|
||||
</delete>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user