Files
ruoyi-vue-pro/docs/education/migration/issues/EDU-027-native-mall-trade-order.md

4.7 KiB
Raw Blame History

EDU-027 — Activate native Mall Trade order core

  • Status: done — tenant-owned order core, native APIs/UI, RBAC, and PostgreSQL evidence delivered
  • Type: native module takeover / order lifecycle / tenant isolation
  • Phase: 5 / commercialization foundation
  • Blockers: EDU-020, EDU-024, EDU-025, EDU-026, PostgreSQL Flyway

Problem

RuoYi Vue Pro already provides the normalized Trade order aggregate, cart and price orchestration, Pay/Product/Promotion/Member composition, administrator order/config controllers, jobs, permissions, and Vben pages. The Server dependency was disabled and its core data objects inherited only BaseDO. Rebuilding orders inside Education would create a second commerce ledger and duplicate native payment, member, catalog, and coupon boundaries.

Legacy orders cannot be copied safely from terminal payment aggregates or display-only product rows. Native Trade requires verified Member identities, SPU/SKU line items, price allocation, delivery mode, payment linkage, status history, and promotion state that those projections do not contain.

Delivered contract

  • yudao-server activates yudao-module-trade; native TradeOrderApiImpl is now authoritative and the temporary Promotion fallback from EDU-026 is removed.
  • Existing /trade/order, /trade/config, /app-api/trade/order, and /app-api/trade/cart contracts remain owned by Trade. Education adds no shadow order or cart API. This slice proves the administrator order/config interface and core persistence; it does not yet claim successful app checkout.
  • TradeOrderDO, TradeOrderItemDO, TradeOrderLogDO, TradeConfigDO, and CartDO extend TenantBaseDO, so their native mapper/service access participates in framework tenant injection.
  • V4390 mounts the existing order and trade-config Vben pages below an Education 交易中心 with the exact native query/update/pick-up/config permissions.
  • Deferred after-sale, delivery-master-data, and brokerage tables are not silently activated. V4390 rejects any pre-existing version of those tables until a dedicated tenant-safe slice owns their schema and UI.

Database contract

V4390 creates tenant-scoped PostgreSQL tables:

  • trade_config
  • trade_cart
  • trade_order
  • trade_order_item
  • trade_order_log

All use (tenant_id,id) ownership keys and explicitly named identity sequences. Order Item → Order/Cart/Product and Order Log → Order references are tenant-qualified. Cart → Product, Order → Pay Order, and Order → Promotion Coupon references are also tenant-qualified. Checks enforce native order/type/terminal/delivery/refund/cancel/log enums, amount/count bounds, payment/cancel/delivery shapes, after-sale reference shape, and one active config per tenant. Indexes match administrator paging, member history, cart selection, auto-cancel/receive jobs, order details, and log history.

V4390 seeds menu IDs 69606967 for the Trade root, order page, config page, and exact five controller permissions.

Legacy data decision

The native Trade ledger starts empty. V4390 does not fabricate line items from Pay totals, guess tenant/member/SPU/SKU links, translate terminal statuses into a richer order lifecycle, or attach historical coupons and refunds without reviewed source identities. A later import slice requires an explicit reconciliation contract and quarantine path.

Verification

  • The focused Trade tenant contract proves all five activated records inherit TenantBaseDO.
  • The focused V4390 Flyway scenario proves same IDs can exist across tenants, cross-tenant Cart/Order Item references fail, invalid cancel/config states fail, five explicit sequences exist, exact menus/permissions are installed, core global-table adoption fails closed, and deferred Trade tables fail closed.
  • The full PostgreSQL Flyway suite passes with 46 scenarios through V4390.
  • mvn -pl yudao-server -am -DskipTests compile succeeds with Product, Promotion, and Trade enabled.
  • The existing Vben order/config pages pass the web app typecheck and scoped lint/format checks.

Explicitly open

  • Native after-sale, delivery express/template/pick-up-store, and brokerage persistence/UI require later tenant-safe slices.
  • Normal checkout still invokes native Promotion discount and reward lookups whose tables are deferred, and special orders require additional Promotion families. V4390 therefore does not claim end-to-end purchase creation, seckill, bargain, combination, point, discount, or reward orders.
  • Legacy order import, automatic education-entitlement fulfillment, refund-driven revocation, and production reconciliation/runbooks remain separate work.
  • Target-environment role grants, scheduled-job deployment, and browser/API smoke evidence remain operational work.