fix(customs): keep declaration pending while exceptions remain

This commit is contained in:
2026-09-30 11:48:14 +08:00
parent 6731be1a6b
commit c7f880300c
4 changed files with 49 additions and 4 deletions
@@ -428,8 +428,11 @@ public class ContainerCustomsService {
if (mapper.insertClearanceResult(resultId, batch.id(), batch.customsContainerId(), type, resultStatus,
batch.customsEntryNo(), request.occurredAt(), trim(request.resolution()), request.evidenceFileId(),
operatorId, operatorName, null) != 1) throw conflict("海关结果保存失败");
if ("OPEN".equals(resultStatus)) mapper.markDeclarationResultPending(batch.id());
else mapper.closeDeclarationBatch(batch.id());
if ("OPEN".equals(resultStatus) || mapper.openClearanceResultCount(batch.id()) > 0) {
mapper.markDeclarationResultPending(batch.id());
} else {
mapper.closeDeclarationBatch(batch.id());
}
ContainerRow container = mapper.lockContainerById(batch.customsContainerId());
if (container != null) history(container, "RECORD_CUSTOMS_CLEARANCE_RESULT", container.status(), container.status(), type, operatorId, operatorName);
completeCommand(operatorId, action, key, resultId);