fix(acceptance): enforce immutable confirmed fees
This commit is contained in:
+20
@@ -474,6 +474,26 @@ class CarrierScheduleQueryServiceTest {
|
||||
verify(repository).updateState(before, 3, 7L, "admin");
|
||||
}
|
||||
|
||||
@Test
|
||||
void manualActualFactRejectsCurrentOrEarlierBusinessNodeBeforeWritingFact() {
|
||||
CarrierScheduleQueryEntity task = task(0, 3);
|
||||
task.setStatus("READY"); task.setLatestStandardNode("AT_ORIGIN_PORT");
|
||||
task.setLatestNodeObservedAt(NOW.minusHours(1));
|
||||
when(repository.lock(1L)).thenReturn(task);
|
||||
|
||||
assertThatThrownBy(() -> service.addManualNode(1L, 7L, "admin", "manual-same-1",
|
||||
new ManualNodeRequest(3, "AT_ORIGIN_PORT", NOW, null, NOW,
|
||||
"CNSZX", "深圳", "重复当前节点")))
|
||||
.isInstanceOf(BizException.class).hasMessageContaining("按业务顺序向后推进");
|
||||
assertThatThrownBy(() -> service.addManualNode(1L, 7L, "admin", "manual-earlier-1",
|
||||
new ManualNodeRequest(3, "DEPARTED_WAREHOUSE", NOW, null, NOW,
|
||||
"CNSZX", "深圳", "补录更早节点")))
|
||||
.isInstanceOf(BizException.class).hasMessageContaining("按业务顺序向后推进");
|
||||
|
||||
verify(repository, never()).insertIfAbsent(any(CarrierScheduleNodeFactEntity.class));
|
||||
verify(repository, never()).updateState(any(), any(Integer.class), anyLong(), anyString());
|
||||
}
|
||||
|
||||
@Test
|
||||
void holdIsPersistedAsSeparateImmutableExceptionFact() {
|
||||
CarrierScheduleQueryEntity task = task(0, 1);
|
||||
|
||||
@@ -461,7 +461,6 @@ class FbaPricingServiceTest {
|
||||
inbound.setProcessStatus("WAIT_SPLIT");
|
||||
inbound.setFeeStatus("SENT");
|
||||
InboundFeeEntity current = savedFee("SENT");
|
||||
current.setCustomerConfirmedAt(NOW.minusHours(1));
|
||||
AtomicReference<InboundFeeEntity> inserted = new AtomicReference<>();
|
||||
when(repository.findInbound(TENANT, INBOUND)).thenReturn(inbound);
|
||||
when(repository.findLatestFee(TENANT, INBOUND)).thenReturn(current);
|
||||
@@ -531,10 +530,10 @@ class FbaPricingServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisplayName("客户已确认且装柜完成时拒绝平台再次修改")
|
||||
@DisplayName("客户确认后即拒绝平台再次修改")
|
||||
void rejectsAdjustmentAfterCustomerConfirmation() {
|
||||
InboundPricingEntity inbound = inbound("10", "1");
|
||||
inbound.setProcessStatus("LOADED");
|
||||
inbound.setProcessStatus("WAIT_SPLIT");
|
||||
InboundFeeEntity current = savedFee("SENT");
|
||||
current.setCustomerConfirmedAt(NOW);
|
||||
when(repository.findInbound(TENANT, INBOUND)).thenReturn(inbound);
|
||||
|
||||
Reference in New Issue
Block a user