优化
This commit is contained in:
+14
@@ -4,6 +4,7 @@ import com.baiyue.common.core.api.ResultCode;
|
||||
import com.baiyue.common.core.exception.BizException;
|
||||
import com.baiyue.warehouse.dto.WarehouseDetailResponse;
|
||||
import com.baiyue.warehouse.dto.OverseasPartnerWarehouseResponse;
|
||||
import com.baiyue.warehouse.dto.SharedOverseasWarehouseResponse;
|
||||
import com.baiyue.warehouse.entity.WarehouseEntity;
|
||||
import com.baiyue.warehouse.service.WarehouseApplicationService;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
@@ -83,4 +84,17 @@ class InternalWarehouseControllerTest {
|
||||
assertThat(response.data()).containsExactly(option);
|
||||
verify(service).activeOverseasPartners();
|
||||
}
|
||||
|
||||
@Test
|
||||
void exposesSharedOverseasReceivingDirectoryOnlyWithInternalToken() {
|
||||
var warehouse = new SharedOverseasWarehouseResponse(200003L, "US-LAX-01",
|
||||
"洛杉矶海外仓", "US", "ACTIVE");
|
||||
when(service.activeSharedOverseasWarehouse(200003L)).thenReturn(warehouse);
|
||||
|
||||
assertThat(controller.sharedOverseasWarehouse(INTERNAL_TOKEN, 200003L).data())
|
||||
.isEqualTo(warehouse);
|
||||
assertThatThrownBy(() -> controller.sharedOverseasWarehouse("bad", 200003L))
|
||||
.isInstanceOf(BizException.class);
|
||||
verify(service).activeSharedOverseasWarehouse(200003L);
|
||||
}
|
||||
}
|
||||
|
||||
+6
-2
@@ -109,7 +109,7 @@ class WarehouseSchemaContractTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldSeedReceivingCapabilityForDomesticOperatingWarehouses() throws IOException {
|
||||
void shouldSeedReceivingCapabilityForFixedOperatingWarehouses() throws IOException {
|
||||
String masterData = read("warehouse-public-master-data.sql");
|
||||
String unified = Files.readString(Path.of("..", "deploy", "sql", "头程数据库统一增量-MySQL8.sql"));
|
||||
|
||||
@@ -117,7 +117,11 @@ class WarehouseSchemaContractTest {
|
||||
assertThat(sql)
|
||||
.contains("193000000000200001,'RECEIVING','头程收货',1")
|
||||
.contains("193000000000200002,'RECEIVING','头程收货',1")
|
||||
.contains("国内固定作业仓收货能力写入校验失败")
|
||||
.contains("193000000000400003,0,193000000000200003,'RECEIVING','海外收货',1")
|
||||
.contains("'洛杉矶仓海外接柜入仓收货能力'")
|
||||
.contains("193000000000400004,0,193000000000200004,'RECEIVING','海外收货',1")
|
||||
.contains("'纽约仓海外接柜入仓收货能力'")
|
||||
.contains("固定平台作业仓收货能力写入校验失败")
|
||||
.contains("warehouse.warehouse_type = 'FBA'")
|
||||
.contains("FBA公共地址不得创建平台作业能力");
|
||||
}
|
||||
|
||||
+19
@@ -149,4 +149,23 @@ class WarehouseApplicationServiceTest {
|
||||
.containsExactly(tuple(2L, "US-PARTNER-LAX", "洛杉矶合作仓", "US"));
|
||||
verify(repository).findActiveByType(0L, "OVERSEAS_PARTNER");
|
||||
}
|
||||
|
||||
@Test
|
||||
void exposesOnlyActiveSharedOverseasWarehousesWithReceivingCapability() {
|
||||
WarehouseEntity receiving = new WarehouseEntity();
|
||||
receiving.setId(3L); receiving.setWarehouseCode("US-LAX-01");
|
||||
receiving.setWarehouseName("洛杉矶海外仓"); receiving.setCountryCode("US");
|
||||
receiving.setWarehouseType("OVERSEAS"); receiving.setStatus("ACTIVE");
|
||||
ServiceCapabilityEntity capability = new ServiceCapabilityEntity();
|
||||
capability.setCapabilityCode("RECEIVING"); capability.setEnabled(true);
|
||||
when(repository.findActiveByType(0L, "OVERSEAS")).thenReturn(java.util.List.of(receiving));
|
||||
when(repository.findOwned(0L, 3L)).thenReturn(receiving);
|
||||
when(repository.findCapabilities(0L, 3L)).thenReturn(java.util.List.of(capability));
|
||||
|
||||
assertThat(service.activeSharedOverseasWarehouses())
|
||||
.extracting("warehouseId", "warehouseCode", "status")
|
||||
.containsExactly(tuple(3L, "US-LAX-01", "ACTIVE"));
|
||||
assertThat(service.activeSharedOverseasWarehouse(3L).warehouseName())
|
||||
.isEqualTo("洛杉矶海外仓");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,38 @@ SELECT COUNT(*) AS fixed_platform_address_count
|
||||
AND address.deleted = 0
|
||||
AND warehouse.deleted = 0;
|
||||
|
||||
SELECT COUNT(*) AS fixed_platform_receiving_capability_count
|
||||
FROM wh_service_capability capability
|
||||
WHERE capability.tenant_id = 0
|
||||
AND capability.warehouse_id IN (
|
||||
193000000000200001, 193000000000200002,
|
||||
193000000000200003, 193000000000200004
|
||||
)
|
||||
AND capability.capability_code = 'RECEIVING'
|
||||
AND capability.enabled = 1
|
||||
AND capability.deleted = 0;
|
||||
|
||||
SELECT COUNT(*) AS overseas_receiving_capability_violations
|
||||
FROM wh_service_capability capability
|
||||
WHERE capability.tenant_id = 0
|
||||
AND (
|
||||
(capability.id = 193000000000400003
|
||||
AND (capability.warehouse_id <> 193000000000200003
|
||||
OR capability.capability_code <> 'RECEIVING'
|
||||
OR capability.capability_name <> '海外收货'
|
||||
OR capability.description <> '洛杉矶仓海外接柜入仓收货能力'
|
||||
OR capability.enabled <> 1
|
||||
OR capability.deleted <> 0))
|
||||
OR
|
||||
(capability.id = 193000000000400004
|
||||
AND (capability.warehouse_id <> 193000000000200004
|
||||
OR capability.capability_code <> 'RECEIVING'
|
||||
OR capability.capability_name <> '海外收货'
|
||||
OR capability.description <> '纽约仓海外接柜入仓收货能力'
|
||||
OR capability.enabled <> 1
|
||||
OR capability.deleted <> 0))
|
||||
);
|
||||
|
||||
SELECT COUNT(*) AS fba_public_warehouse_count
|
||||
FROM wh_warehouse
|
||||
WHERE tenant_id = 0
|
||||
|
||||
@@ -111,8 +111,11 @@ assert.doesNotMatch(sql, /contact_name\s*=\s*VALUES\(contact_name\)/)
|
||||
assert.doesNotMatch(sql, /contact_phone\s*=\s*VALUES\(contact_phone\)/)
|
||||
assert.doesNotMatch(sql, /contact_email\s*=\s*VALUES\(contact_email\)/)
|
||||
assert.doesNotMatch(sql, /remark\s*=\s*VALUES\(remark\)/)
|
||||
assert.match(sql, /国内固定作业仓必须启用收货能力/)
|
||||
assert.match(sql, /四个固定平台作业仓必须启用收货能力/)
|
||||
assert.match(sql, /INSERT INTO wh_service_capability[\s\S]+?'RECEIVING'/i)
|
||||
assert.match(sql, /193000000000400003,0,193000000000200003,'RECEIVING','海外收货',1,'16:00:00',[\s\S]*?'洛杉矶仓海外接柜入仓收货能力'/)
|
||||
assert.match(sql, /193000000000400004,0,193000000000200004,'RECEIVING','海外收货',1,'16:00:00',[\s\S]*?'纽约仓海外接柜入仓收货能力'/)
|
||||
assert.match(sql, /warehouse_id IN \(193000000000200001,193000000000200002,193000000000200003,193000000000200004\)[\s\S]*?<> 4 THEN[\s\S]*?固定平台作业仓收货能力写入校验失败/)
|
||||
const fbaBlock = sql.slice(sql.indexOf('CREATE TEMPORARY TABLE tmp_wh_fba_public_master_data'))
|
||||
assert.doesNotMatch(fbaBlock, /INSERT INTO wh_service_capability/i)
|
||||
assert.match(sql, /FBA公共主数据地址种子ID与既有数据冲突/)
|
||||
|
||||
Reference in New Issue
Block a user