fix(overseas): repair pallet transitions and transfer queries

This commit is contained in:
2026-09-29 14:18:20 +08:00
parent 875d2497f4
commit 8df0f4e823
11 changed files with 114 additions and 31 deletions
@@ -26,6 +26,32 @@ class HttpPalletPhysicalGatewayTest {
ReflectionTestUtils.setField(gateway, "internalToken", "test-token");
}
@Test
void applyPreservesBusinessConflictInsteadOfReportingMissingTransition() {
server.expect(requestTo("http://warehouse/internal/v1/pda-pallet-transitions/30"))
.andRespond(withSuccess("""
{"code":"A0409","message":"Pallet version changed","data":null}
""", MediaType.APPLICATION_JSON));
var pallet = new PalletPhysicalGateway.PalletReference(30L, "PAL-1", 88L, 40L, "IDLE", "XLX1", 2);
assertThatThrownBy(() -> gateway.apply(88L, pallet, "OCCUPIED", 40L, "key", "swap"))
.isInstanceOf(com.baiyue.common.core.exception.BizException.class)
.hasMessageContaining("Pallet version changed");
server.verify();
}
@Test
void compensationBusinessFailureIsNotReportedAsSuccess() {
server.expect(requestTo("http://warehouse/internal/v1/pda-pallet-transitions/30/key/compensate"))
.andRespond(withSuccess("""
{"code":"A0409","message":"Pallet changed after operation","data":null}
""", MediaType.APPLICATION_JSON));
var transition = new PalletPhysicalGateway.Transition("key", 30L, "PAL-1", 88L,
"IDLE", "OCCUPIED", 40L, 40L, 2, 3, "APPLIED", false);
assertThatThrownBy(() -> gateway.compensate(88L, transition))
.isInstanceOf(com.baiyue.common.core.exception.BizException.class);
server.verify();
}
@Test
void resolveMapsBusinessNotFoundEnvelopeToStableNotFound() {
server.expect(requestTo("http://warehouse/internal/v1/warehouse-pallets/resolve/MISSING"))