feat(selfop): sync versioned owner and product directories

This commit is contained in:
2026-10-14 16:15:39 +08:00
parent 2b3b13913b
commit d311d9dc8d
47 changed files with 803 additions and 66 deletions
@@ -3965,3 +3965,37 @@ CREATE TABLE IF NOT EXISTS ll_cargo_discard_photo (
UNIQUE KEY uk_cargo_discard_photo_file (file_id),
KEY idx_cargo_discard_photo_application (customer_id, application_id, pallet_no)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE ll_selfop_owner (
id BIGINT NOT NULL COMMENT '主键',
run_id BIGINT NOT NULL COMMENT '完整资料采集版本',
source_account VARCHAR(64) COLLATE utf8mb4_bin NOT NULL COMMENT '来源账号',
customer_code VARCHAR(64) COLLATE utf8mb4_bin NOT NULL COMMENT '领星货主编码',
customer_name VARCHAR(255) NULL COMMENT '领星货主名称',
source_status VARCHAR(32) NULL COMMENT '来源启停状态',
observed_at_utc DATETIME(6) NOT NULL COMMENT '资料观测时间',
PRIMARY KEY (id),
UNIQUE KEY uk_selfop_owner_version (run_id,source_account,customer_code),
KEY idx_selfop_owner_lookup (source_account,customer_code,run_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='自营领星货主资料版本';
CREATE TABLE ll_selfop_product (
id BIGINT NOT NULL COMMENT '主键',
run_id BIGINT NOT NULL COMMENT '完整资料采集版本',
source_account VARCHAR(64) COLLATE utf8mb4_bin NOT NULL COMMENT '来源账号',
customer_code VARCHAR(64) COLLATE utf8mb4_bin NOT NULL COMMENT '领星货主编码',
sku_code VARCHAR(128) COLLATE utf8mb4_bin NOT NULL COMMENT '货主商品编码',
product_name VARCHAR(255) NULL COMMENT '商品名称',
declared_length DECIMAL(24,6) NULL COMMENT '商品资料长度',
declared_width DECIMAL(24,6) NULL COMMENT '商品资料宽度',
declared_height DECIMAL(24,6) NULL COMMENT '商品资料高度',
declared_size_unit VARCHAR(32) NULL COMMENT '商品资料尺寸单位',
measured_length DECIMAL(24,6) NULL COMMENT '仓库实测长度',
measured_width DECIMAL(24,6) NULL COMMENT '仓库实测宽度',
measured_height DECIMAL(24,6) NULL COMMENT '仓库实测高度',
measured_size_unit VARCHAR(32) NULL COMMENT '仓库实测尺寸单位',
observed_at_utc DATETIME(6) NOT NULL COMMENT '资料观测时间',
PRIMARY KEY (id),
UNIQUE KEY uk_selfop_product_version (run_id,source_account,customer_code,sku_code),
KEY idx_selfop_product_lookup (source_account,customer_code,sku_code,run_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='自营领星商品资料版本';
@@ -0,0 +1,33 @@
CREATE TABLE ll_selfop_owner (
id BIGINT NOT NULL COMMENT '主键',
run_id BIGINT NOT NULL COMMENT '完整资料采集版本',
source_account VARCHAR(64) COLLATE utf8mb4_bin NOT NULL COMMENT '来源账号',
customer_code VARCHAR(64) COLLATE utf8mb4_bin NOT NULL COMMENT '领星货主编码',
customer_name VARCHAR(255) NULL COMMENT '领星货主名称',
source_status VARCHAR(32) NULL COMMENT '来源启停状态',
observed_at_utc DATETIME(6) NOT NULL COMMENT '资料观测时间',
PRIMARY KEY (id),
UNIQUE KEY uk_selfop_owner_version (run_id,source_account,customer_code),
KEY idx_selfop_owner_lookup (source_account,customer_code,run_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='自营领星货主资料版本';
CREATE TABLE ll_selfop_product (
id BIGINT NOT NULL COMMENT '主键',
run_id BIGINT NOT NULL COMMENT '完整资料采集版本',
source_account VARCHAR(64) COLLATE utf8mb4_bin NOT NULL COMMENT '来源账号',
customer_code VARCHAR(64) COLLATE utf8mb4_bin NOT NULL COMMENT '领星货主编码',
sku_code VARCHAR(128) COLLATE utf8mb4_bin NOT NULL COMMENT '货主商品编码',
product_name VARCHAR(255) NULL COMMENT '商品名称',
declared_length DECIMAL(24,6) NULL COMMENT '商品资料长度',
declared_width DECIMAL(24,6) NULL COMMENT '商品资料宽度',
declared_height DECIMAL(24,6) NULL COMMENT '商品资料高度',
declared_size_unit VARCHAR(32) NULL COMMENT '商品资料尺寸单位',
measured_length DECIMAL(24,6) NULL COMMENT '仓库实测长度',
measured_width DECIMAL(24,6) NULL COMMENT '仓库实测宽度',
measured_height DECIMAL(24,6) NULL COMMENT '仓库实测高度',
measured_size_unit VARCHAR(32) NULL COMMENT '仓库实测尺寸单位',
observed_at_utc DATETIME(6) NOT NULL COMMENT '资料观测时间',
PRIMARY KEY (id),
UNIQUE KEY uk_selfop_product_version (run_id,source_account,customer_code,sku_code),
KEY idx_selfop_product_lookup (source_account,customer_code,sku_code,run_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='自营领星商品资料版本';
@@ -132,7 +132,7 @@ components:
exclusiveGrantId: { type: string, maxLength: 128 }
Operation:
type: string
enum: [WAREHOUSES, OUTBOUND_QUERY, OUTBOUND_LOCATE, OUTBOUND_DETAIL, PRODUCT_INVENTORY]
enum: [WAREHOUSES, OUTBOUND_QUERY, OUTBOUND_LOCATE, OUTBOUND_DETAIL, PRODUCT_INVENTORY, CUSTOMERS, PRODUCTS]
AuthorizationRequest:
type: object
required: [context, operation, requestHash]
@@ -21,6 +21,31 @@ info:
重试沿既有POST sync-tasks,action=RETRY/requestKey/warehouseCode/taskNo/reason,使用独立sync权限并最终复核资格。
security: [{bearerAuth: []}]
paths:
/api/platform/v1/last-leg/self-operated-analytics/owner-directory:
get:
summary: 完整资料批次中的客户名称与编码
description: 仅平台且须 platform:self-operated-analytics:list。按账号和 queryAsOf 选择最近完整发布的 MASTER_DATA 资料版本;不调用领星,不限制为当前仓有销量的客户。未同步返回空数组,缺失名称返回 null。
parameters:
- {$ref: '#/components/parameters/sourceAccount'}
- {$ref: '#/components/parameters/warehouseCode'}
- {$ref: '#/components/parameters/salesRunId'}
- {$ref: '#/components/parameters/inventoryRunId'}
- {$ref: '#/components/parameters/salesScopeHash'}
- {$ref: '#/components/parameters/inventoryScopeHash'}
- {$ref: '#/components/parameters/queryAsOf'}
responses:
'200':
description: 统一 ApiResponse
content:
application/json:
schema:
type: object
properties:
code: {type: string}
message: {type: string}
data: {type: array, items: {$ref: '#/components/schemas/OwnerOption'}}
'401': {description: 缺少可信认证身份}
'403': {description: 非平台身份或缺少只读权限}
/api/platform/v1/last-leg/self-operated-analytics/dashboard:
get:
summary: 单仓固定版本经营总览
@@ -482,6 +507,7 @@ components:
DashboardRankingItem:
type: object
properties:
customerName: {type: string, nullable: true, description: queryAsOf 时可见的完整资料批次中的货主名称}
customerCode: {type: string}
sku: {type: string}
productName: {type: string, nullable: true}
@@ -603,6 +629,7 @@ components:
SalesSummary:
type: object
properties:
customerName: {type: string, nullable: true, description: queryAsOf 时可见的完整资料批次中的货主名称}
sourceAccount: {type: string, nullable: true}
warehouseCode: {type: string, nullable: true}
customerCode: {type: string, nullable: true}
@@ -721,7 +748,7 @@ components:
taskNo: {type: string, nullable: true}
attemptNo: {type: integer, nullable: true}
status: {type: string, nullable: true}
phase: {type: string, nullable: true}
phase: {type: string, nullable: true, description: 资料同步使用 CUSTOMERS / PRODUCTS;其他阶段不变}
executionPurpose: {type: string, nullable: true}
startedAt: {type: string, format: date-time, nullable: true}
finishedAt: {type: string, format: date-time, nullable: true}
@@ -745,7 +772,7 @@ components:
elapsedSeconds: {type: string, nullable: true, description: 自创建起的累计秒数,含排队和重试;活动任务截止本次读取,终态任务截止任务最后更新时间;不是单次执行耗时}
taskNo: {type: string, nullable: true}
taskType: {type: string, nullable: true}
dataFamily: {type: string, nullable: true}
dataFamily: {type: string, nullable: true, description: OUTBOUND / INVENTORY / MASTER_DATA(账号资料)}
warehouseCode: {type: string, nullable: true}
taskRole: {type: string, nullable: true}
executionPurpose: {type: string, nullable: true}
@@ -814,7 +841,7 @@ components:
properties:
warehouseCode: {type: string, nullable: true}
warehouseName: {type: string, nullable: true}
dataFamily: {type: string, nullable: true}
dataFamily: {type: string, nullable: true, description: OUTBOUND / INVENTORY / MASTER_DATA(账号资料)}
executionEnabled: {type: boolean, nullable: true}
publicationEnabled: {type: boolean, nullable: true}
disabledReason: {type: string, nullable: true}
@@ -861,7 +888,7 @@ components:
countBasis: {type: string, nullable: true}
attemptNo: {type: string, nullable: true}
scanRound: {type: string, nullable: true}
phase: {type: string, nullable: true}
phase: {type: string, nullable: true, description: 资料同步使用 CUSTOMERS / PRODUCTS;其他阶段不变}
completed: {type: string, nullable: true}
total: {type: string, nullable: true}
totalKnown: {type: boolean, nullable: true}