feat(phase3): connect PDA settlement to real child orders
This commit is contained in:
@@ -63,6 +63,7 @@ CREATE TABLE IF NOT EXISTS ord_order_fulfillment_split (
|
||||
id BIGINT UNSIGNED NOT NULL COMMENT '拆分台账ID',
|
||||
tenant_id BIGINT UNSIGNED NOT NULL,
|
||||
parent_order_id BIGINT UNSIGNED NOT NULL,
|
||||
source_order_id BIGINT UNSIGNED NOT NULL COMMENT '本次实际消费的主订单或余量子订单ID',
|
||||
child_order_id BIGINT UNSIGNED NOT NULL,
|
||||
split_role VARCHAR(12) NOT NULL COMMENT '本台账子片:LOADED或REMAINDER',
|
||||
loading_plan_id BIGINT UNSIGNED NULL COMMENT 'Firstleg装柜计划逻辑ID',
|
||||
@@ -84,6 +85,7 @@ CREATE TABLE IF NOT EXISTS ord_order_fulfillment_split (
|
||||
UNIQUE KEY uk_order_split_idempotency (tenant_id, parent_order_id, idempotency_key, split_role),
|
||||
UNIQUE KEY uk_order_split_child (tenant_id, child_order_id),
|
||||
KEY idx_order_split_parent (tenant_id, parent_order_id, created_at, id),
|
||||
KEY idx_order_split_source (tenant_id, source_order_id, split_role),
|
||||
KEY idx_order_split_container (tenant_id, container_booking_id, created_at, id),
|
||||
CONSTRAINT fk_order_split_parent FOREIGN KEY (parent_order_id) REFERENCES ord_order(id),
|
||||
CONSTRAINT fk_order_split_child FOREIGN KEY (child_order_id) REFERENCES ord_order(id),
|
||||
|
||||
@@ -118,6 +118,12 @@ DELIMITER ;
|
||||
CALL phase3_order_add_column('ord_order_fulfillment_split','split_role',"VARCHAR(12) NOT NULL DEFAULT 'LOADED' COMMENT 'LOADED或REMAINDER'");
|
||||
CALL phase3_order_add_column('ord_order_fulfillment_split','source_order_id','BIGINT UNSIGNED NULL COMMENT ''实际被消费的来源订单ID''');
|
||||
CALL phase3_order_add_column('ord_order_fulfillment_split','request_hash',"CHAR(64) NULL COMMENT '请求内容SHA-256;存量记录允许为空'");
|
||||
-- 存量空来源必须先由发布前数据核对补齐;P0 契约不允许继续写无来源台账。
|
||||
ALTER TABLE ord_order_fulfillment_split
|
||||
MODIFY source_order_id BIGINT UNSIGNED NOT NULL COMMENT '实际被消费的来源订单ID',
|
||||
MODIFY request_hash CHAR(64) NOT NULL COMMENT '请求内容SHA-256';
|
||||
CALL phase3_order_add_index('ord_order_fulfillment_split','idx_order_split_source',
|
||||
'KEY `idx_order_split_source` (`tenant_id`,`source_order_id`,`split_role`)');
|
||||
|
||||
DROP PROCEDURE IF EXISTS phase3_order_drop_split_index;
|
||||
DELIMITER $$
|
||||
|
||||
@@ -274,6 +274,58 @@ components:
|
||||
scheme: bearer
|
||||
bearerFormat: JWT
|
||||
schemas:
|
||||
FulfillmentSplitQuantityLine:
|
||||
type: object
|
||||
required: [sourceDetailId, packageCount]
|
||||
properties:
|
||||
sourceDetailId: {type: integer, format: int64, minimum: 1}
|
||||
packageCount: {type: integer, minimum: 1}
|
||||
FulfillmentSplitCreateRequest:
|
||||
type: object
|
||||
required: [tenantId, parentOrderId, sourceOrderId, loadingPlanId, containerBookingId,
|
||||
sourcePackageCount, loadedPackageCount, remainingPackageCount, idempotencyKey, lines]
|
||||
properties:
|
||||
tenantId: {type: integer, format: int64, minimum: 1}
|
||||
parentOrderId: {type: integer, format: int64, minimum: 1}
|
||||
sourceOrderId: {type: integer, format: int64, minimum: 1}
|
||||
loadingPlanId: {type: integer, format: int64, minimum: 1}
|
||||
containerBookingId: {type: integer, format: int64, minimum: 1}
|
||||
sourcePackageCount: {type: integer, minimum: 1}
|
||||
loadedPackageCount: {type: integer, minimum: 1}
|
||||
remainingPackageCount: {type: integer, minimum: 0}
|
||||
expectedParentVersion: {type: integer, minimum: 0, description: 可选;省略时仍在父订单行锁下串行拆分}
|
||||
idempotencyKey: {type: string, minLength: 1, maxLength: 128}
|
||||
operationId: {type: string, maxLength: 64}
|
||||
operatorName: {type: string, maxLength: 64}
|
||||
lines:
|
||||
type: array
|
||||
minItems: 1
|
||||
items: {$ref: '#/components/schemas/FulfillmentSplitQuantityLine'}
|
||||
FulfillmentSplitChild:
|
||||
type: object
|
||||
properties:
|
||||
orderId: {type: integer, format: int64}
|
||||
orderNo: {type: string}
|
||||
splitSequence: {type: integer, minimum: 1}
|
||||
splitRole: {type: string, enum: [LOADED, REMAINDER]}
|
||||
packageCount: {type: integer, minimum: 1}
|
||||
sourceOrderId: {type: integer, format: int64}
|
||||
loadingPlanId: {type: integer, format: int64}
|
||||
containerBookingId: {type: integer, format: int64}
|
||||
FulfillmentSplitResponse:
|
||||
type: object
|
||||
properties:
|
||||
parentOrderId: {type: integer, format: int64}
|
||||
parentOrderNo: {type: string}
|
||||
parentVersion: {type: integer, minimum: 0}
|
||||
loadedChild: {$ref: '#/components/schemas/FulfillmentSplitChild'}
|
||||
remainderChild: {$ref: '#/components/schemas/FulfillmentSplitChild', nullable: true}
|
||||
sourcePackageCount: {type: integer, minimum: 1}
|
||||
loadedPackageCount: {type: integer, minimum: 1}
|
||||
remainingPackageCount: {type: integer, minimum: 0}
|
||||
loadingPlanId: {type: integer, format: int64}
|
||||
containerBookingId: {type: integer, format: int64}
|
||||
idempotencyKey: {type: string}
|
||||
PricingTaxMode:
|
||||
type: string
|
||||
enum: [TAX_INCLUDED, TAX_EXCLUDED]
|
||||
@@ -334,6 +386,11 @@ components:
|
||||
orderNo: {type: string}
|
||||
pricingTaxMode: {$ref: '#/components/schemas/PricingTaxMode'}
|
||||
parameters:
|
||||
InternalToken:
|
||||
name: X-Internal-Service-Token
|
||||
in: header
|
||||
required: true
|
||||
schema: {type: string, minLength: 1}
|
||||
UnifiedKeyword:
|
||||
name: keyword
|
||||
in: query
|
||||
|
||||
Reference in New Issue
Block a user