feat(order): formalize domestic order export contract

This commit is contained in:
2026-09-01 20:48:44 +08:00
parent 94c67b5c51
commit 858061452c
5 changed files with 313 additions and 0 deletions
@@ -0,0 +1,17 @@
-- Order 导出权限初始化源;由统一增量合并后在 IAM 数据库执行。
USE baiyue_iam;
INSERT INTO iam_permission
(id, tenant_id, app_code, permission_type, parent_id, permission_code, permission_name,
route_path, http_method, sort_no, status, deleted)
VALUES
(5102026, 0, 'PLATFORM', 'BUTTON', 5102010, 'platform:order:export', '导出订单列表',
NULL, NULL, 120, 'ACTIVE', 0)
ON DUPLICATE KEY UPDATE
permission_name = VALUES(permission_name), parent_id = VALUES(parent_id),
sort_no = VALUES(sort_no), status = 'ACTIVE', deleted = 0;
INSERT INTO iam_role_permission (role_id, permission_id, tenant_id)
SELECT role_id, 5102026, 0
FROM (SELECT 4000001 AS role_id UNION ALL SELECT 4000003 AS role_id) roles
ON DUPLICATE KEY UPDATE tenant_id = VALUES(tenant_id);
@@ -6,6 +6,28 @@ info:
security:
- bearerAuth: []
paths:
/internal/exports/v1/DOMESTIC_WAREHOUSE_ORDER_LIST/batches:
post:
security: []
summary: File 异步导出中心分页读取国内仓订单
description: >-
仅接受内部服务令牌。selectedOrderNos 非空时忽略查询筛选并严格按所选业务订单号导出;
selectedOrderNos 为空时按与平台统一订单列表一致的筛选条件导出全部匹配记录,page/size 不属于请求参数。
Provider 只返回结构化数据,不生成文件;调用方创建 File 任务时 exportType 固定为
DOMESTIC_WAREHOUSE_ORDER_LIST、format 固定为 XLSX,并需要 platform:order:export。
parameters:
- name: X-Internal-Service-Token
in: header
required: true
schema: {type: string, minLength: 32}
requestBody:
required: true
content:
application/json:
schema: {$ref: '#/components/schemas/DomesticWarehouseOrderExportBatchRequest'}
responses:
'200': {description: 返回固定列定义、当前批数据、游标与首批总数}
'403': {description: 内部服务令牌无效}
/api/merchant/v1/orders/first-leg/addresses:
get:
summary: 查询当前客户下单地址簿
@@ -486,6 +508,51 @@ components:
scheme: bearer
bearerFormat: JWT
schemas:
DomesticWarehouseOrderExportBatchRequest:
type: object
required: [taskId, tenantId, appCode, requestedBy, dispatchVersion, parameters, limit]
properties:
taskId: {type: string, pattern: '^[1-9][0-9]*$'}
tenantId: {type: string, enum: ['0'], description: 平台导出固定为0}
appCode: {type: string, enum: [PLATFORM]}
requestedBy: {type: string, pattern: '^[1-9][0-9]*$'}
dispatchVersion: {type: integer, minimum: 1}
parameters: {$ref: '#/components/schemas/DomesticWarehouseOrderExportParameters'}
cursor: {type: string, nullable: true}
snapshotToken: {type: string, nullable: true, maxLength: 512}
limit: {type: integer, minimum: 1, maximum: 500}
DomesticWarehouseOrderExportParameters:
type: object
description: >-
selectedOrderNos 非空时仅导出所选订单;为空或省略时使用其余筛选字段导出全量匹配结果。
筛选字段与 GET /api/platform/v1/orders 一致,但不得传 page、size。
properties:
selectedOrderNos:
type: array
maxItems: 5000
uniqueItems: true
items: {type: string, minLength: 1, maxLength: 64}
tenantId: {type: string, pattern: '^[1-9][0-9]*$'}
keyword: {type: string, maxLength: 64}
orderNo: {type: string, maxLength: 64}
mainStatus: {type: string, enum: [PENDING_REVIEW, WAIT_MEASURE, INBOUNDED, WAIT_SPLIT, LOADING, LOADED, DELIVERED]}
customerId: {type: string, pattern: '^[1-9][0-9]*$'}
receivingWarehouseId: {type: string, pattern: '^[1-9][0-9]*$'}
destinationWarehouseId: {type: string, pattern: '^[1-9][0-9]*$'}
inboundCode: {type: string, maxLength: 64}
internalOrderStatus: {type: string, maxLength: 32}
expectedArrivalDate: {type: string, format: date}
feeReviewStatus: {type: string, enum: [UNRECORDED, PENDING, APPROVED, REJECTED]}
channelName: {type: string, maxLength: 128}
containerNo: {type: string, maxLength: 64}
cabinetNo: {type: string, maxLength: 64}
sailingDate: {type: string, format: date}
loaded: {type: boolean}
fullContainer: {type: boolean}
measurementReviewStatus: {type: string, enum: [UNRECORDED, PENDING, APPROVED, REJECTED]}
fbaCode: {type: string, maxLength: 64}
createdFrom: {type: string, format: date-time}
createdTo: {type: string, format: date-time}
TenantOrderStatisticsResponse:
type: object
required: [tenantId, totalSubmittedOrders, currentMonthSubmittedOrders, monthStart, nextMonthStart, zoneId, asOf]