fix(firstleg): freeze customs receipt after broker submission
This commit is contained in:
+3
@@ -205,6 +205,9 @@ public class ContainerCustomsService {
|
||||
if (container == null || !DECLARING.equals(container.status()) || source.frozenAt() == null) {
|
||||
throw conflict("当前客户资料不在报关中冻结版本");
|
||||
}
|
||||
if (mapper.brokerSubmittedAt(container.id()) != null) {
|
||||
throw conflict("客户确认回执已发送给报关行,不可再修改回执");
|
||||
}
|
||||
CompletionRow completion = mapper.lockCompletion(documentId);
|
||||
CustomsFileClient.Metadata metadata = upload(source.tenantId(), RECEIPT_FILE_TYPE, Long.toString(container.loadingPlanId()), operatorId, file);
|
||||
long completionId;
|
||||
|
||||
+12
@@ -274,6 +274,18 @@ class ContainerCustomsServiceTest {
|
||||
verifyNoInteractions(files);
|
||||
}
|
||||
|
||||
@Test void receiptCannotBeReplacedAfterBrokerSubmission(){
|
||||
var source=document(1L);when(mapper.document(1L)).thenReturn(source);
|
||||
when(mapper.claimCommand(anyLong(),eq(5L),eq("UPLOAD_COMPLETION_1"),eq("broker-sent-key"),anyString())).thenReturn(1);
|
||||
when(mapper.lockContainerById(2L)).thenReturn(container(ContainerCustomsService.DECLARING,4));
|
||||
when(mapper.lockDocument(1L)).thenReturn(source);
|
||||
when(mapper.brokerSubmittedAt(2L)).thenReturn(java.time.LocalDateTime.now());
|
||||
var file=new MockMultipartFile("file","result.bin","application/octet-stream",new byte[]{1});
|
||||
assertThatThrownBy(()->service.uploadCompletion(1L,5L,"admin","broker-sent-key",0,file))
|
||||
.isInstanceOf(BizException.class).hasMessageContaining("不可再修改回执");
|
||||
verifyNoInteractions(files);
|
||||
}
|
||||
|
||||
@Test void receiptReplaySucceedsAndDoesNotCompleteContainer(){
|
||||
var source=document(1L);
|
||||
var declaring=container(ContainerCustomsService.DECLARING,3);
|
||||
|
||||
Reference in New Issue
Block a user