优化
This commit is contained in:
+7
@@ -57,6 +57,13 @@ public class InternalWarehouseController {
|
||||
return ApiResponse.success(service.activeDomesticWarehouses());
|
||||
}
|
||||
|
||||
@GetMapping("/order-catalog")
|
||||
public ApiResponse<java.util.List<WarehouseApplicationService.WarehouseCatalogItem>> orderCatalog(
|
||||
@RequestHeader(value="X-Internal-Service-Token", required=false) String token) {
|
||||
verifyToken(token);
|
||||
return ApiResponse.success(service.activeOrderCatalog());
|
||||
}
|
||||
|
||||
@GetMapping("/shared-overseas")
|
||||
public ApiResponse<List<SharedOverseasWarehouseResponse>> sharedOverseasWarehouses(
|
||||
@RequestHeader(value="X-Internal-Service-Token", required=false) String token) {
|
||||
|
||||
@@ -68,6 +68,16 @@ public class WarehouseRepository {
|
||||
.orderByAsc(WarehouseEntity::getId));
|
||||
}
|
||||
|
||||
public List<WarehouseEntity> findAllActive(long tenantId) {
|
||||
return warehouses.selectList(new LambdaQueryWrapper<WarehouseEntity>()
|
||||
.eq(WarehouseEntity::getTenantId, tenantId)
|
||||
.eq(WarehouseEntity::getStatus, "ACTIVE")
|
||||
.in(WarehouseEntity::getWarehouseType, List.of("DOMESTIC", "FBA", "OVERSEAS"))
|
||||
.orderByAsc(WarehouseEntity::getWarehouseType)
|
||||
.orderByAsc(WarehouseEntity::getWarehouseName)
|
||||
.orderByAsc(WarehouseEntity::getId));
|
||||
}
|
||||
|
||||
public boolean existsCode(long tenantId, String code, Long excludedId) {
|
||||
return warehouses.selectCount(new LambdaQueryWrapper<WarehouseEntity>()
|
||||
.eq(WarehouseEntity::getTenantId, tenantId)
|
||||
|
||||
@@ -105,6 +105,16 @@ public class WarehouseApplicationService {
|
||||
.toList();
|
||||
}
|
||||
|
||||
public List<WarehouseCatalogItem> activeOrderCatalog() {
|
||||
return repository.findAllActive(WarehouseSaveNormalizer.PUBLIC_TENANT_ID).stream()
|
||||
.map(value -> new WarehouseCatalogItem(value.getId(), value.getWarehouseCode(),
|
||||
value.getWarehouseName(), value.getWarehouseType(), value.getCountryCode()))
|
||||
.toList();
|
||||
}
|
||||
|
||||
public record WarehouseCatalogItem(Long id, String warehouseCode, String warehouseName,
|
||||
String warehouseType, String countryCode) { }
|
||||
|
||||
public List<SharedOverseasWarehouseResponse> activeSharedOverseasWarehouses() {
|
||||
return repository.findActiveByType(WarehouseSaveNormalizer.PUBLIC_TENANT_ID,
|
||||
WarehouseSaveNormalizer.TYPE_OVERSEAS)
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
openapi: 3.0.3
|
||||
info:
|
||||
title: Warehouse internal order catalog
|
||||
version: 1.0.0
|
||||
paths:
|
||||
/internal/warehouses/order-catalog:
|
||||
get:
|
||||
summary: 查询订单可引用的启用公共仓库目录
|
||||
description: 仅供订单服务解析旧系统导入文件;返回国内、FBA 和海外仓,不经公网网关暴露。
|
||||
security:
|
||||
- internalServiceToken: []
|
||||
responses:
|
||||
'200': {description: 返回仓库 ID、编码、名称、类型和国家编码}
|
||||
components:
|
||||
securitySchemes:
|
||||
internalServiceToken:
|
||||
type: apiKey
|
||||
in: header
|
||||
name: X-Internal-Service-Token
|
||||
Reference in New Issue
Block a user