fix: harden smart loading push idempotency

This commit is contained in:
2026-08-15 12:39:30 +08:00
parent 0ddffeddc8
commit 5b8e7d6989
2 changed files with 29 additions and 4 deletions
@@ -252,9 +252,13 @@ public class SmartLoadingService {
try {
if (repository.push(planId, key, request.expectedVersion(), operatorId, operatorName) != 1) throw conflict("装柜计划已被并发修改");
} catch (DuplicateKeyException e) { throw conflict("幂等键已用于其他推送"); }
history(planId, null, "PUSH_PRELOAD", "EDITING", "EDITING", key,
json(values("version", request.expectedVersion())),
json(values("requestHash", requestHash)), operatorId, operatorName);
try {
history(planId, null, "PUSH_PRELOAD", "EDITING", "EDITING", key,
json(values("version", request.expectedVersion())),
json(values("requestHash", requestHash)), operatorId, operatorName);
} catch (DuplicateKeyException exception) {
throw conflict("Idempotency-Key已用于不同推送请求");
}
LoadingPlanEntity pushed = repository.plan(planId);
loadingModelBridge.bindAllocatedBeforeLoading(planId, operatorId, operatorName, key);
loadingPickService.beginIfReady(pushed.getContainerBookingId(), operatorId, operatorName);