fix(firstleg): serialize concurrent customs start replay
This commit is contained in:
+1
-1
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user