2.5 KiB
头程订单一期 / First-leg Order Phase 1
数据库归属 / Database ownership
baiyue_order:订单主数据、货物、收发货快照、目的仓快照、内部备注、状态历史和事务发件箱。 / Order master data, cargo, sender/receiver and destination snapshots, internal notes, status history, and transactional outbox.baiyue_firstleg:头程履约任务、指派历史与事件消费幂等。 / First-leg fulfillment tasks, assignment history, and event-consumer idempotency.- 两个服务仅通过
tenant_id + order_id + order_no逻辑关联,不建立跨库外键。 / Services use logicaltenant_id + order_id + order_noreferences and never create cross-database foreign keys.
接口隔离 / API separation
- 商户端
/api/merchant/v1/orders/first-leg:草稿、编辑、提交、查询、详情、取消。 / Merchant draft, edit, submit, query, detail, and cancel APIs. - 平台端
/api/platform/v1/orders/first-leg:租户订单查询、详情、审核、驳回、受理、取消、开始处理、完成、内部备注。 / Platform tenant query, detail, review, rejection, acceptance, cancellation, processing, completion, and internal notes. - 平台指派
/api/platform/v1/first-leg/tasks/{taskId}/assignment。 / Platform fulfillment assignment.
商户接口要求 appCode=MERCHANT,租户来自 JWT。平台接口要求 appCode=PLATFORM,并显式传入目标 tenantId;所有服务层 SQL 都带租户条件。
Merchant APIs require appCode=MERCHANT and derive the tenant from JWT. Platform APIs require appCode=PLATFORM and an explicit target tenantId; every service query includes the tenant predicate.
状态与审计 / State and audit
主流程为 DRAFT → SUBMITTED → APPROVED → ACCEPTED → PROCESSING → COMPLETED,驳回路径为 SUBMITTED → REJECTED → DRAFT,处理前可取消。状态变化追加写入 ord_order_status_history;创建、提交、审核、驳回、受理、取消、状态推进、备注和指派使用 @BusinessAudit 记录。
The main flow is DRAFT → SUBMITTED → APPROVED → ACCEPTED → PROCESSING → COMPLETED; rejection follows SUBMITTED → REJECTED → DRAFT, and cancellation is permitted before processing. Status changes append to ord_order_status_history; key operations use @BusinessAudit.
验证 / Verification
mvn -pl order,firstleg -am -DskipTests clean compile
已通过 Java 17 干净编译。 / Verified with a clean Java 17 compilation.