fix: 移除批量发布任务中未使用的成败计数变量

This commit is contained in:
2026-10-09 13:45:04 +08:00
parent aa87168437
commit 7fa0729722
@@ -70,18 +70,6 @@ public class PddGoodsPublishJobRunnerImpl implements PddGoodsPublishJobRunner {
}
List<PddGoodsPublishJobItemPO> items = jobItemMapper.selectList(qw);
int success = job.getSuccessCount() == null ? 0 : job.getSuccessCount();
int fail = onlyFailed ? 0 : (job.getFailCount() == null ? 0 : job.getFailCount());
if (onlyFailed) {
// 重试失败项:先把失败数扣回,下面按结果重算
fail = 0;
success = (job.getTotalCount() == null ? 0 : job.getTotalCount())
- items.size();
if (success < 0) {
success = 0;
}
}
for (PddGoodsPublishJobItemPO item : items) {
item.setStatus(PddGoodsPublishJobItemPO.STATUS_RUNNING);
item.setErrorMessage(null);
@@ -90,7 +78,6 @@ public class PddGoodsPublishJobRunnerImpl implements PddGoodsPublishJobRunner {
PddGoodsPublishDraftPO draft = draftMapper.selectById(item.getDraftId());
if (draft == null || !companyId.equals(draft.getCompanyId())) {
markItemFailed(item, "草稿不存在");
fail++;
continue;
}
draft.setStatus(PddGoodsPublishDraftPO.STATUS_PUBLISHING);
@@ -109,7 +96,6 @@ public class PddGoodsPublishJobRunnerImpl implements PddGoodsPublishJobRunner {
item.setErrorMessage(null);
jobItemMapper.updateById(item);
// status / commitId / goodsId 由 publish(systemDraftId) 回写
success++;
} catch (Exception e) {
String msg = e.getMessage() == null ? "发布失败" : e.getMessage();
if (msg.length() > 900) {
@@ -119,7 +105,6 @@ public class PddGoodsPublishJobRunnerImpl implements PddGoodsPublishJobRunner {
draft.setStatus(PddGoodsPublishDraftPO.STATUS_FAILED);
draft.setLastError(msg);
draftMapper.updateById(draft);
fail++;
log.warn("publish desk job item failed jobId={} draftId={}", jobId, item.getDraftId(), e);
}
}