fix(firstleg): serialize concurrent customs start replay

This commit is contained in:
2026-08-28 22:44:37 +08:00
parent f53ff76143
commit 1e389d95dd
2 changed files with 69 additions and 1 deletions
@@ -149,12 +149,12 @@ public class ContainerCustomsService {
@Transactional
public ContainerView start(long planId, long operatorId, String operatorName, String key, ActionRequest request) {
ContainerRow current = ensure(planId);
String action = "START_CONTAINER_CUSTOMS_" + planId;
if(!request.confirm())throw bad("请确认开始整柜报关");
String requestHash = hash(action, request.expectedVersion(), request.confirm(), request.remark());
CommandRow replay = claim(operatorId, action, key, requestHash);
if (replay != null) return platformView(planId);
ensure(planId);
ContainerRow locked = mapper.lockContainer(planId);
if (locked == null || !READY.equals(locked.status())) throw conflict("当前柜报关资料尚未齐全或已开始报关");
if (!Objects.equals(locked.version(), request.expectedVersion())) throw concurrent();