fix(booking): allow release without estimated arrival

This commit is contained in:
2026-10-22 16:43:46 +08:00
parent c385b7543b
commit 9e0266b7c3
4 changed files with 24 additions and 3 deletions
@@ -231,6 +231,26 @@ class OceanBookingServiceTest {
verify(repository, times(1)).transition(1L, "DRAFT", "RELEASED", 3, 9L, "admin");
}
/** 不录预计到港仍可放舱,其余资料及附件门禁保持有效。 */
@Test
void releasesWithoutEstimatedArrival() {
stubMasterData();
OceanBookingEntity draft = completeBooking("DRAFT", 3);
OceanBookingEntity released = completeBooking("RELEASED", 4);
draft.setEstimatedArrivalAt(null);
released.setEstimatedArrivalAt(null);
when(repository.find(1L)).thenReturn(draft, released);
when(repository.parties(1L)).thenReturn(parties());
when(repository.requirements(1L)).thenReturn(List.of(requirement()));
when(repository.transition(1L, "DRAFT", "RELEASED", 3, 9L, "admin")).thenReturn(1);
Detail result = service.release(1L, 9L, "admin", "release-no-arrival", new ReleaseRequest(3, "确认放舱"));
assertThat(result.oceanBooking().getStatus()).isEqualTo("RELEASED");
assertThat(result.oceanBooking().getEstimatedArrivalAt()).isNull();
verify(documents).requireActiveValidDocument(draft);
}
@Test
void rejectsCarrierSnapshotMismatchAndUnassociatedBookingAgent() {
stubMasterData();