Skip to main content

21. Design Mini Logistics Platform

01 Understanding the Problem

1.1 Functional Requirements

info

从核心角色出发,定义系统功能需求.

Starting from the goals of core user roles, define the functional requirements of the system.

  • Seller
    • Create shipping orders to the Platform's Warehouse (bulk select orders, create based on item numbers and size)
    • Receive shipping label of carrier like USPS
    • Check the logistics status of shipping orders 查看发货单的物流状态
    • Money/Discount/Payment/Settlement
      • Manage payment methods, view settlement records (e.g., shipping fees deducted), apply platform-provided discounts
    • Dispute/Rating
  • Buyer
    • Track the logistics status of shipping orders
    • Get notification of shipping status changes
    • View Invoice
    • Dispute/Customer Support Service
  • Warehouse
    • Receive and store items from sellers (record, validate and update inventory)
    • Validate shipping orders, like item quantity, item condition, shipping address etc.
    • Sort items for outbound shipping 出库分拣
    • Shipping through USPS and other carriers
    • Monitor warehouse operations (e.g., order processing efficiency, inventory accuracy) and resolve warehouse-related exceptions
  • Platform
    • Provide API interface for Seller and Buyer to connect the system
    • Return/Refund
    • Money Reconciliation 资金对账
    • Clearing and Settlement System (Who Gets What, When and How to Pay) 清分和结算系统
    • Notify Seller and Buyer of shipping status changes
    • Monitor system operation status to ensure high availability 监控系统运行状态,确保高可用性
    • Metrics and Analytics
      • User: Dispute rate, misdelivery rate, user feedback 争议率、错发率、用户反馈
      • System: Success rate, latency, error rate
    • Deal with disputes between buyers and sellers
    • Integrate with logistics carrier systems (e.g., USPS) for shipping label generation, tracking data
    • Shipping fee rules/discounts/payment
    • Address validation, normalization, and management

1.2 Non-Functional Requirements

  • 数据一致性
    • 跨模块数据(如订单状态与库存数量、物流轨迹与账单金额)需保持实时一致,通过分布式事务或最终一致性机制(如消息队列重试 + 补偿逻辑),避免出现 “订单已发货但库存未扣减”“物流显示签收但账单未生成” 等矛盾场景。关键数据(如库存、结算金额)的变更需记录版本日志,支持回溯校验。
  • 可靠性与可用性
    • 系统需保证 99.9% 以上的可用性,核心物流节点(如订单状态同步、库存更新)不出现单点故障,通过数据实时备份和故障自动切换机制,避免因系统中断导致物流停滞。
  • 性能与响应速度
    • 关键操作(创建发货单、物流状态查询)响应时间不超过 1 秒,支持日均 10 万级订单处理量,在促销等高峰时段可弹性扩容,确保批量订单分拣、物流轨迹同步不延迟。
  • 数据安全与权限控制
    • 买卖双方地址、支付信息等敏感数据全程加密存储和传输,通过角色权限隔离(如卖家仅能查看自身订单、仓库无权修改结算数据)防止信息泄露,同时保留关键操作日志用于追溯。
  • Usability 易用性
    • 系统界面应简洁直观,支持多语言,降低使用门槛和培训成本

03 Propose High-Level Design

3.1 Role-based Swimlane Diagram 角色泳道图