fix(firstleg): load container overview transport history
This commit is contained in:
@@ -12,11 +12,11 @@ import java.util.List;
|
|||||||
JSON_UNQUOTE(JSON_EXTRACT(history.after_snapshot,'$.voyageNo')) afterVoyageNo,
|
JSON_UNQUOTE(JSON_EXTRACT(history.after_snapshot,'$.voyageNo')) afterVoyageNo,
|
||||||
history.operation_id operationId,history.operation_reason reason,
|
history.operation_id operationId,history.operation_reason reason,
|
||||||
history.operator_id operatorId,history.operator_name operatorName,
|
history.operator_id operatorId,history.operator_name operatorName,
|
||||||
history.occurred_at createdAt
|
history.created_at createdAt
|
||||||
FROM fl_loading_plan_history history
|
FROM fl_loading_plan_history history
|
||||||
JOIN fl_loading_plan plan ON plan.id=history.loading_plan_id
|
JOIN fl_loading_plan plan ON plan.id=history.loading_plan_id
|
||||||
WHERE plan.container_booking_id=#{id} AND history.action_type='UPDATE_PRELOAD_TRANSPORT'
|
WHERE plan.container_booking_id=#{id} AND history.action_type='UPDATE_PRELOAD_TRANSPORT'
|
||||||
ORDER BY history.occurred_at,history.id
|
ORDER BY history.created_at,history.id
|
||||||
""") List<TransportRow> transport(@Param("id") long id);
|
""") List<TransportRow> transport(@Param("id") long id);
|
||||||
@Select("SELECT id,action,reason,operator_id operatorId,operator_name operatorName,occurred_at occurredAt,request_hash requestHash FROM fl_container_exception_history WHERE container_booking_id=#{id} ORDER BY occurred_at,id") List<ExceptionRow> exceptions(@Param("id") long id);
|
@Select("SELECT id,action,reason,operator_id operatorId,operator_name operatorName,occurred_at occurredAt,request_hash requestHash FROM fl_container_exception_history WHERE container_booking_id=#{id} ORDER BY occurred_at,id") List<ExceptionRow> exceptions(@Param("id") long id);
|
||||||
@Insert("INSERT INTO fl_container_exception_history(id,container_booking_id,action,reason,operator_id,operator_name,operation_id,request_hash,occurred_at) VALUES(#{id},#{bookingId},#{action},#{reason},#{operatorId},#{operatorName},#{operationId},#{requestHash},CURRENT_TIMESTAMP(3))") int insertException(@Param("id") long id,@Param("bookingId") long bookingId,@Param("action") String action,@Param("reason") String reason,@Param("operatorId") long operatorId,@Param("operatorName") String operatorName,@Param("operationId") String operationId,@Param("requestHash") String requestHash);
|
@Insert("INSERT INTO fl_container_exception_history(id,container_booking_id,action,reason,operator_id,operator_name,operation_id,request_hash,occurred_at) VALUES(#{id},#{bookingId},#{action},#{reason},#{operatorId},#{operatorName},#{operationId},#{requestHash},CURRENT_TIMESTAMP(3))") int insertException(@Param("id") long id,@Param("bookingId") long bookingId,@Param("action") String action,@Param("reason") String reason,@Param("operatorId") long operatorId,@Param("operatorName") String operatorName,@Param("operationId") String operationId,@Param("requestHash") String requestHash);
|
||||||
|
|||||||
+2
-1
@@ -43,7 +43,8 @@ class ContainerOverviewSqlContractTest {
|
|||||||
.getAnnotation(Select.class).value());
|
.getAnnotation(Select.class).value());
|
||||||
assertThat(sql)
|
assertThat(sql)
|
||||||
.contains("fl_loading_plan_history", "action_type='UPDATE_PRELOAD_TRANSPORT'")
|
.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");
|
.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() {
|
@Test void downloadsOnlyActivePhotoOwnedByContainerLoadingPlan() {
|
||||||
ContainerBookingEntity booking = new ContainerBookingEntity(); booking.setId(41L);
|
ContainerBookingEntity booking = new ContainerBookingEntity(); booking.setId(41L);
|
||||||
when(containers.find(41L)).thenReturn(booking);
|
when(containers.find(41L)).thenReturn(booking);
|
||||||
|
|||||||
Reference in New Issue
Block a user