fix: restore overseas list queries and identifiers

This commit is contained in:
2026-09-07 12:30:17 +08:00
parent 30e883fe0c
commit fcf1771967
19 changed files with 93 additions and 33 deletions
@@ -0,0 +1,16 @@
package com.baiyue.lastleg;
import com.baiyue.lastleg.delivery.dto.DeliveryRequests;
import com.baiyue.lastleg.inboundplan.dto.InboundPlanRequests;
import org.junit.jupiter.api.Test;
import org.springframework.beans.BeanUtils;
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
class QueryBindingContractTest {
@Test
void mvcQueryRecordsExposeOneResolvableConstructor() {
assertDoesNotThrow(() -> BeanUtils.getResolvableConstructor(DeliveryRequests.Query.class));
assertDoesNotThrow(() -> BeanUtils.getResolvableConstructor(InboundPlanRequests.Query.class));
}
}
@@ -34,7 +34,7 @@ class MerchantDeliveryControllerTest {
private final DeliveryTransferService service = mock(DeliveryTransferService.class);
private final MerchantDeliveryController controller = controller();
private final DeliveryRequests.Query query = new DeliveryRequests.Query(
1, 20, null, null, null, null, null, null, null, null, null, null);
1, 20, null, null, null, null, null, null, null, null, null, null, null);
@Test
void fixedRoutesUseIndependentListAndCreatePermissionsWithoutCustomerParameter() throws Exception {
@@ -41,7 +41,7 @@ class InboundPlanControllerTest {
@Test
void platformPageAllowsAllCustomersWhenCustomerIdIsOmitted() {
InboundPlanRequests.Query query = new InboundPlanRequests.Query(1, 20, null, null, null,
null, null, null, null, null, null, null, null);
null, null, null, null, null, null, null, null, null);
when(service.page(null, query)).thenReturn(new PageResult<>(List.of(), 1, 20, 0, 0));
controller.page(platform(), null, query);
@@ -45,7 +45,7 @@ class InboundPlanPaginationTest {
@Test
void pagesAtLineGranularityAndPassesTenantAndAllFiltersToDatabase() {
InboundPlanRequests.Query query = new InboundPlanRequests.Query(2, 10, "LIP", "IN-1",
"PENDING_ASSIGNMENT", null, null, "ONT", "ONT8", "UNAPPOINTED", "UNSCHEDULED",
null, "PENDING_ASSIGNMENT", null, null, "ONT", "ONT8", "UNAPPOINTED", "UNSCHEDULED",
LocalDateTime.of(2026, 8, 1, 0, 0), LocalDateTime.of(2026, 8, 31, 23, 59));
InboundPlanListResponse row = new InboundPlanListResponse(9007199254740993L, 2L, "LIP2", "100",
3L, "IN-1", "FIRST_LEG", "W1", "ONT", "安大略仓", "ONT8", "客户A", 10,
@@ -78,7 +78,7 @@ class InboundPlanPaginationTest {
}
private static InboundPlanRequests.Query query(long page, long size) {
return new InboundPlanRequests.Query(page, size, null, null, null, null, null,
return new InboundPlanRequests.Query(page, size, null, null, null, null, null, null,
null, null, null, null, null, null);
}
}
@@ -151,7 +151,7 @@ class InboundPlanServiceTest {
@Test
void rejectsReversedInboundPlanDateRange() {
InboundPlanRequests.Query query = new InboundPlanRequests.Query(1, 20, null, null, null, null,
null, null, null, null, null, LocalDateTime.of(2026, 8, 20, 0, 0),
null, null, null, null, null, null, LocalDateTime.of(2026, 8, 20, 0, 0),
LocalDateTime.of(2026, 8, 19, 0, 0));
assertThrows(ResponseStatusException.class, () -> service.page("100", query));
@@ -87,6 +87,8 @@ class LocalLooseboardServiceTest {
assertEquals("SHARED_TRUCK", detail.summary().transportMode());
verify(lastlegOrders).insert(org.mockito.ArgumentMatchers.<LastlegOrder>argThat(value ->
"LOCAL_LOOSEBOARD".equals(value.getOrderType())
&& value.getSourceOrderNo().equals("LB-WH-20260901-000001")
&& value.getInboundCode() == null
&& "LOCAL_LOOSEBOARD:PENDING_ACCEPTANCE".equals(value.getSubOrderStatus())));
verify(histories).insert(org.mockito.ArgumentMatchers.<LocalLooseboardHistory>argThat(value ->
"CREATE".equals(value.getOperationType())));
@@ -60,7 +60,7 @@ class MerchantOverseasCustomerApiContractTest {
LocalLooseboardRequests.MerchantQuery looseboardQuery = new LocalLooseboardRequests.MerchantQuery(1, 20,
null, null, null, null, null, null);
InboundPlanRequests.Query inboundQuery = new InboundPlanRequests.Query(1, 20, null, null, null,
null, null, null, null, null, null, null, null);
null, null, null, null, null, null, null, null, null);
looseboard.page(merchant, looseboardQuery);
inbound.page(merchant, inboundQuery);
@@ -28,6 +28,8 @@ class RelabelContractTest {
void schemasDefineRelabelApplicationItemsAndHistoryContracts() throws Exception {
String baseline = Files.readString(Path.of("src/main/resources/db/lastleg.sql"), StandardCharsets.UTF_8).toLowerCase();
String migration = Files.readString(Path.of("..", "scripts", "db", "incremental.sql"), StandardCharsets.UTF_8).toLowerCase();
String deployment = Files.readString(Path.of("..", "deploy", "sql", "海外区域统一增量-MySQL8.sql"),
StandardCharsets.UTF_8).toLowerCase();
for (String schema : new String[] { baseline, migration }) {
assertTrue(schema.contains("ll_relabel_application"));
assertTrue(schema.contains("ll_relabel_item"));
@@ -36,6 +38,13 @@ class RelabelContractTest {
assertTrue(schema.contains("idempotency_key"));
assertTrue(schema.contains("request_hash"));
}
for (String schema : new String[] { baseline, migration, deployment }) {
assertTrue(schema.contains("ll_relabel_item"));
assertTrue(schema.contains("remark"));
assertTrue(schema.contains("carton_mark"));
assertTrue(schema.contains("fba_carton_mark"));
assertTrue(schema.contains("destination_warehouse_id"));
}
}
@Test
@@ -32,6 +32,7 @@ import java.util.List;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
@@ -99,9 +100,9 @@ class RelabelApplicationServiceTest {
assertEquals("RELABEL:PENDING_PROCESSING", tailOrder.getValue().getSubOrderStatus());
assertEquals("CUSTOMER", tailOrder.getValue().getSourceRegion());
assertTrue(tailOrder.getValue().getOrderNo().matches("RL-WH-\\d{8}-\\d{6}"));
assertEquals(tailOrder.getValue().getInboundCode() + ":WH-1", tailOrder.getValue().getSourceInboundId());
assertEquals(tailOrder.getValue().getInboundCode(), application.getValue().getRelabelNo());
assertTrue(tailOrder.getValue().getInboundCode().startsWith("RL-"));
assertNull(tailOrder.getValue().getInboundCode());
assertEquals(application.getValue().getRelabelNo() + ":WH-1", tailOrder.getValue().getSourceInboundId());
assertEquals(tailOrder.getValue().getRelabelOrderNo(), application.getValue().getRelabelNo());
assertEquals(10, tailOrder.getValue().getPackageCount());
assertEquals(6, application.getValue().getNotifiedPackageCount());
assertEquals("SKU-A", relabelItem.getValue().getSkuCode());
@@ -28,6 +28,7 @@ import java.time.LocalDateTime;
import java.math.BigDecimal;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertThrows;
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.mockito.ArgumentMatchers.any;
@@ -306,6 +307,31 @@ class LastlegOrderServiceTest {
assertEquals(List.of("INBOUND-2", "INBOUND-3"), result.records().get(0).palletMergeInboundNos());
}
@Test
void pageDoesNotExposeBusinessOrderNumbersAsInboundCodes() {
LastlegOrder relabel = order(11L, "100", "PENDING_ASSIGNMENT", null);
relabel.setOrderType("RELABEL_APPLICATION");
relabel.setInboundCode("RL-WH-20260906-701570");
LastlegOrder looseboard = order(12L, "100", "PENDING_ASSIGNMENT", null);
looseboard.setOrderType("LOCAL_LOOSEBOARD");
looseboard.setInboundCode("LB-WH-20260906-187457");
LastlegOrder firstleg = order(13L, "100", "PENDING_ASSIGNMENT", null);
firstleg.setOrderType("FIRST_LEG");
firstleg.setInboundCode("NYEXX2609060063");
var resultPage = new com.baomidou.mybatisplus.extension.plugins.pagination.Page<LastlegOrder>(1, 10);
resultPage.setRecords(List.of(relabel, looseboard, firstleg));
resultPage.setTotal(3);
when(orders.selectPage(any(), any())).thenReturn(resultPage);
var query = new LastlegOrderRequests.Query(1L, 10L, null, null, null, null,
null, null, null, null, null, null, null, null, null, null);
var result = service.page(null, query);
assertNull(result.records().get(0).inboundCode());
assertNull(result.records().get(1).inboundCode());
assertEquals("NYEXX2609060063", result.records().get(2).inboundCode());
}
@Test
void holdingBeforeInboundPersistsTheOrderMarkerAndOperationRemark() {
LastlegOrder order = order(11L, "100", "PENDING_INBOUND", null);