fix(firstleg): load container overview transport history

This commit is contained in:
2026-08-31 12:39:24 +08:00
parent 942dbace19
commit 314ce09b5d
3 changed files with 27 additions and 3 deletions
@@ -43,7 +43,8 @@ class ContainerOverviewSqlContractTest {
.getAnnotation(Select.class).value());
assertThat(sql)
.contains("fl_loading_plan_history", "action_type='UPDATE_PRELOAD_TRANSPORT'")
.contains("before_snapshot", "after_snapshot", "operation_reason")
.contains("before_snapshot", "after_snapshot", "operation_reason", "history.created_at")
.doesNotContain("history.occurred_at")
.doesNotContain("fl_container_transport_history");
}
@@ -78,6 +78,29 @@ class ContainerOverviewServiceTest {
});
}
@Test void overviewAllowsDraftContainerWithoutReleasedBookingOrPhysicalContainerNumber() {
ContainerBookingEntity booking = new ContainerBookingEntity();
booking.setId(41L);
booking.setCabinetNo("CAB-260830-0017");
booking.setContainerNo(null);
booking.setOceanBookingId(null);
booking.setVersion(0);
when(containers.find(41L)).thenReturn(booking);
when(mapper.documents(41L)).thenReturn(java.util.List.of());
when(mapper.exceptions(41L)).thenReturn(java.util.List.of());
when(mapper.transport(41L)).thenReturn(java.util.List.of());
var overview = service.overview(41L);
assertThat(overview.container().cabinetNo()).isEqualTo("CAB-260830-0017");
assertThat(overview.container().containerNo()).isNull();
assertThat(overview.container().version()).isZero();
assertThat(overview.loadingPlanId()).isNull();
assertThat(overview.pda()).isNull();
assertThat(overview.documents()).isEmpty();
assertThat(overview.timeline()).isEmpty();
}
@Test void downloadsOnlyActivePhotoOwnedByContainerLoadingPlan() {
ContainerBookingEntity booking = new ContainerBookingEntity(); booking.setId(41L);
when(containers.find(41L)).thenReturn(booking);