This commit is contained in:
wujinliang
2026-09-18 11:41:04 +08:00
parent 263068ac85
commit 1fc3e04723
38 changed files with 378 additions and 61 deletions
@@ -124,8 +124,8 @@ class InboundMeasurementServiceTest {
}
@Test
void locksCalculationStrategyOnlyAfterCustomerConfirmationAndLoadingCompletion() {
InboundOrderEntity inbound = inbound("LOADED");
void locksCalculationStrategyAsSoonAsCustomerConfirmsFee() {
InboundOrderEntity inbound = inbound("WAIT_SPLIT");
InboundFeeEntity fee = new InboundFeeEntity();
fee.setCustomerConfirmedAt(LocalDateTime.now());
when(repository.lockInbound(1L, 10L)).thenReturn(inbound);
@@ -134,7 +134,7 @@ class InboundMeasurementServiceTest {
assertThatThrownBy(() -> service.updateCalculationStrategy(1L, 10L,
new InboundMeasurementRequests.UpdateCalculationStrategyRequest(30L, 5, "ACTUAL", null)))
.isInstanceOf(BizException.class)
.hasMessageContaining("客户已确认且该票已装柜完成");
.hasMessageContaining("客户已确认费用");
verify(repository, never()).lockMeasurement(anyLong(), anyLong(), anyLong());
}
@@ -245,6 +245,23 @@ class InboundMeasurementServiceTest {
verify(repository, never()).updateInbound(any());
}
@Test
void detailReportsCustomerFeeConfirmationForTheMeasurementLock() {
InboundOrderEntity inbound = inbound("WAIT_SPLIT");
InboundMeasurementEntity measurement = new InboundMeasurementEntity();
measurement.setId(30L);
InboundFeeEntity fee = new InboundFeeEntity();
fee.setCustomerConfirmedAt(LocalDateTime.now());
when(repository.findInbound(1L, 10L)).thenReturn(inbound);
when(repository.findLatestMeasurement(1L, 10L)).thenReturn(measurement);
when(repository.listWeights(1L, 10L)).thenReturn(List.of());
when(pricingRepository.findLatestFee(1L, 10L)).thenReturn(fee);
InboundMeasurementResponses.Detail result = service.detail(1L, 10L);
assertThat(result.customerFeeConfirmed()).isTrue();
}
@Test
void detailReportsOrderContractNotReadyInsteadOfExposingDownstreamBadRequest() {
InboundOrderEntity inbound = inbound("MEASURE_PENDING");