修改提交
This commit is contained in:
+1
-1
@@ -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 {
|
||||
|
||||
+1
-1
@@ -40,7 +40,7 @@ class InboundPlanControllerTest {
|
||||
|
||||
@Test
|
||||
void platformPageAllowsAllCustomersWhenCustomerIdIsOmitted() {
|
||||
InboundPlanRequests.Query query = new InboundPlanRequests.Query(1, 20, null, null, null,
|
||||
InboundPlanRequests.Query query = new InboundPlanRequests.Query(1, 20, 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));
|
||||
|
||||
|
||||
+2
-2
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -150,7 +150,7 @@ class InboundPlanServiceTest {
|
||||
|
||||
@Test
|
||||
void rejectsReversedInboundPlanDateRange() {
|
||||
InboundPlanRequests.Query query = new InboundPlanRequests.Query(1, 20, null, null, null, null,
|
||||
InboundPlanRequests.Query query = new InboundPlanRequests.Query(1, 20, null, null, null, null, null,
|
||||
null, null, null, null, null, LocalDateTime.of(2026, 8, 20, 0, 0),
|
||||
LocalDateTime.of(2026, 8, 19, 0, 0));
|
||||
|
||||
|
||||
+1
-1
@@ -59,7 +59,7 @@ class MerchantOverseasCustomerApiContractTest {
|
||||
AuthenticatedUser merchant = user(101L, "MERCHANT");
|
||||
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,
|
||||
InboundPlanRequests.Query inboundQuery = new InboundPlanRequests.Query(1, 20, null, null, null, null,
|
||||
null, null, null, null, null, null, null, null);
|
||||
|
||||
looseboard.page(merchant, looseboardQuery);
|
||||
|
||||
+33
-14
@@ -16,6 +16,11 @@ import com.baiyue.lastleg.relabel.mapper.RelabelItemMapper;
|
||||
import com.baiyue.lastleg.relabel.mapper.RelabelStatusHistoryMapper;
|
||||
import com.baiyue.lastleg.service.LastlegOrderNoGenerator;
|
||||
import com.baiyue.lastleg.wallet.WalletCommandOutboxService;
|
||||
import com.baiyue.lastleg.inventory.command.service.InventoryCommandService;
|
||||
import com.baiyue.lastleg.inventory.entity.InventoryBalance;
|
||||
import com.baiyue.lastleg.inventory.entity.InventoryPosition;
|
||||
import com.baiyue.lastleg.inventory.mapper.InventoryBalanceMapper;
|
||||
import com.baiyue.lastleg.inventory.mapper.InventoryPositionMapper;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.jupiter.api.Test;
|
||||
@@ -50,6 +55,9 @@ class RelabelApplicationServiceTest {
|
||||
@Mock LastlegOrderMapper orders;
|
||||
@Mock LastlegOrderStatusHistoryMapper orderHistories;
|
||||
@Mock WalletCommandOutboxService walletCommands;
|
||||
@Mock InventoryCommandService inventoryCommands;
|
||||
@Mock InventoryBalanceMapper inventoryBalances;
|
||||
@Mock InventoryPositionMapper inventoryPositions;
|
||||
@Spy LastlegOrderNoGenerator orderNoGenerator = new LastlegOrderNoGenerator();
|
||||
|
||||
private RelabelApplicationService service;
|
||||
@@ -64,8 +72,19 @@ class RelabelApplicationServiceTest {
|
||||
ReflectionTestUtils.setField(service, "orderHistories", orderHistories);
|
||||
ReflectionTestUtils.setField(service, "orderNoGenerator", orderNoGenerator);
|
||||
ReflectionTestUtils.setField(service, "walletCommands", walletCommands);
|
||||
ReflectionTestUtils.setField(service, "inventoryCommands", inventoryCommands);
|
||||
ReflectionTestUtils.setField(service, "inventoryBalances", inventoryBalances);
|
||||
ReflectionTestUtils.setField(service, "inventoryPositions", inventoryPositions);
|
||||
ReflectionTestUtils.setField(service, "objectMapper", mapper());
|
||||
lenient().when(walletCommands.publish(any(), any(Long.class), any(), any(), any(), any(), any(Long.class))).thenReturn("wallet-event-1");
|
||||
lenient().when(inventoryPositions.findTenantPosition(any(), any())).thenAnswer(invocation -> {
|
||||
InventoryPosition value = new InventoryPosition(); value.setId(invocation.getArgument(1));
|
||||
value.setBalanceId(101L); value.setAvailablePackages(100L); return value;
|
||||
});
|
||||
InventoryBalance balance = new InventoryBalance(); balance.setId(101L); balance.setCustomerId("10001");
|
||||
balance.setOverseasWarehouseId("WH-1"); balance.setInboundOrderId(301L); balance.setInboundOrderNo("IN-1");
|
||||
balance.setInboundCode("CODE-1"); balance.setSkuCode("SKU-A"); balance.setProductNameZh("Chinese name");
|
||||
lenient().when(inventoryBalances.selectById(any(Long.class))).thenReturn(balance);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -129,17 +148,17 @@ class RelabelApplicationServiceTest {
|
||||
RelabelRequests.Create request = new RelabelRequests.Create("CUSTOMER-1", "WH-1",
|
||||
LocalDateTime.of(2026, 8, 20, 10, 0), "Li", "13800000000", BigDecimal.ONE, null, "key-marks",
|
||||
List.of(attachedItem));
|
||||
RelabelApplication persisted = application(11L, "FBR-1", "100", "key-files", null,
|
||||
RelabelApplication persisted = application(11L, "FBR-1", "10001", "key-files", null,
|
||||
RelabelApplicationService.PENDING_PROCESSING);
|
||||
persisted.setLastlegOrderId(21L); persisted.setItemCount(1); persisted.setTotalPackageCount(2);
|
||||
persisted.setNotifiedPackageCount(2);
|
||||
when(applications.findNo(eq("100"), any())).thenReturn(persisted);
|
||||
when(applications.findNo(eq("10001"), any())).thenReturn(persisted);
|
||||
when(items.selectList(any())).thenReturn(List.of(item(31L, 11L, "SKU-A", 2, 2)));
|
||||
when(histories.selectList(any())).thenReturn(List.of());
|
||||
when(orders.selectById(21L)).thenReturn(order(21L, "100", "LMO-RELABEL-1",
|
||||
when(orders.selectById(21L)).thenReturn(order(21L, "10001", "LMO-RELABEL-1",
|
||||
RelabelApplicationService.PENDING_PROCESSING));
|
||||
|
||||
service.create("100", "operator-1", request);
|
||||
service.create("10001", "operator-1", request);
|
||||
|
||||
ArgumentCaptor<RelabelItem> saved = ArgumentCaptor.forClass(RelabelItem.class);
|
||||
verify(items).insert(saved.capture());
|
||||
@@ -149,10 +168,10 @@ class RelabelApplicationServiceTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void createGroupsCartonsIntoOneTailOrderPerDestinationWarehouse() {
|
||||
void createKeepsOneOperationWarehouseWhenItemsHaveDifferentFbaDestinations() {
|
||||
RelabelRequests.Item west = carton("SKU-A", "BOX-1", "FBA-1", "ONT8");
|
||||
RelabelRequests.Item east = carton("SKU-B", "BOX-2", "FBA-2", "ABE8");
|
||||
RelabelRequests.Create request = new RelabelRequests.Create("CUSTOMER-1", null,
|
||||
RelabelRequests.Create request = new RelabelRequests.Create("CUSTOMER-1", "WH-1",
|
||||
LocalDateTime.of(2026, 8, 20, 10, 0), "Li", "13800000000", BigDecimal.ONE, null, "key-multi",
|
||||
List.of(west, east));
|
||||
RelabelApplication persisted = application(11L, "FBR-1", "10001", "key-multi", null,
|
||||
@@ -167,10 +186,9 @@ class RelabelApplicationServiceTest {
|
||||
service.create("10001", "operator-1", request);
|
||||
|
||||
ArgumentCaptor<LastlegOrder> created = ArgumentCaptor.forClass(LastlegOrder.class);
|
||||
verify(orders, times(2)).insert(created.capture());
|
||||
assertEquals(List.of("ONT8", "ABE8"), created.getAllValues().stream()
|
||||
.map(LastlegOrder::getOverseasWarehouseId).toList());
|
||||
assertTrue(created.getAllValues().stream().allMatch(value -> value.getPackageCount() == 1));
|
||||
verify(orders).insert(created.capture());
|
||||
assertEquals("WH-1", created.getValue().getOverseasWarehouseId());
|
||||
assertEquals(2, created.getValue().getPackageCount());
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -189,7 +207,7 @@ class RelabelApplicationServiceTest {
|
||||
@Test
|
||||
void createAllowsCartonWithoutSku() {
|
||||
RelabelRequests.Item withoutSku = carton(null, "BOX-NO-SKU", "FBA-NO-SKU", "ONT8");
|
||||
RelabelRequests.Create request = new RelabelRequests.Create("CUSTOMER-NO-SKU", null,
|
||||
RelabelRequests.Create request = new RelabelRequests.Create("CUSTOMER-NO-SKU", "WH-1",
|
||||
LocalDateTime.of(2026, 9, 10, 10, 0), "Li", "13800000000", BigDecimal.ONE,
|
||||
null, "key-no-sku", List.of(withoutSku));
|
||||
RelabelApplication persisted = application(11L, "FBR-1", "10001", "key-no-sku", null,
|
||||
@@ -314,9 +332,10 @@ class RelabelApplicationServiceTest {
|
||||
|
||||
private static RelabelRequests.Item carton(String sku, String cartonMark, String fbaCartonMark,
|
||||
String destinationWarehouseId) {
|
||||
return new RelabelRequests.Item(sku, null, null, null, "Chinese name", 1, 1,
|
||||
"SHP-1", null, sku + "-NEW", null, null, null, null, null,
|
||||
cartonMark, fbaCartonMark, destinationWarehouseId);
|
||||
long positionId = "ABE8".equals(destinationWarehouseId) ? 202L : 201L;
|
||||
return new RelabelRequests.Item(101L, positionId, 301L, sku, null, null, null,
|
||||
"Chinese name", 1, 1, "SHP-1", null, sku + "-NEW", null, null,
|
||||
null, null, null, cartonMark, fbaCartonMark, destinationWarehouseId);
|
||||
}
|
||||
|
||||
private static RelabelApplication application(long id, String no, String customerId, String key, String requestHash,
|
||||
|
||||
+4
@@ -22,6 +22,10 @@ class LastlegSecurityContractTest {
|
||||
"CREATE TABLE IF NOT EXISTS ll_security_projection",
|
||||
"PRIMARY KEY (aggregate_type,aggregate_id)", "aggregate_version BIGINT",
|
||||
"permission_version BIGINT", "roles_json JSON", "authorities_json JSON");
|
||||
assertThat(baseline).contains("table_name='ll_security_projection' AND column_name='roles_json'",
|
||||
"table_name='ll_security_projection' AND column_name='authorities_json'",
|
||||
"UPDATE ll_security_projection SET roles_json=JSON_ARRAY() WHERE roles_json IS NULL",
|
||||
"UPDATE ll_security_projection SET authorities_json=JSON_ARRAY() WHERE authorities_json IS NULL");
|
||||
for (String sql : new String[]{baseline, migration}) {
|
||||
assertThat(sql).contains("('USER','1000001',0,'ACTIVE',0,JSON_ARRAY(),JSON_ARRAY(),0",
|
||||
"('AUTHORIZATION','1000001',0,NULL,0,JSON_ARRAY(),JSON_ARRAY(),0",
|
||||
|
||||
Reference in New Issue
Block a user