128 lines
2.2 KiB
Markdown
128 lines
2.2 KiB
Markdown
|
|
# SERVICE_MAP(服务编排总图)
|
|||
|
|
|
|||
|
|
## 设计原则
|
|||
|
|
- 所有业务必须通过 Service 层
|
|||
|
|
- Controller 不允许直接操作数据库
|
|||
|
|
- 一个业务 = 一条 Service Flow
|
|||
|
|
- 服务调用必须遵循 STATE_MACHINE 定义的状态流转
|
|||
|
|
- 涉及收费的业务必须接入 BILLING 系统
|
|||
|
|
- 所有接口必须经过权限校验
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## 1. 功能开通闭环(收费核心)
|
|||
|
|
|
|||
|
|
Flow:
|
|||
|
|
Frontend
|
|||
|
|
→ FeatureController.openFeature
|
|||
|
|
→ FeatureService.checkAccess
|
|||
|
|
→ PaymentService.createPayment
|
|||
|
|
→ PaymentCallbackService.confirm
|
|||
|
|
→ FeatureService.activateFeature
|
|||
|
|
→ PermissionService.grant
|
|||
|
|
→ BillingService.record
|
|||
|
|
→ Response
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## 2. 多商户订单闭环
|
|||
|
|
|
|||
|
|
Flow:
|
|||
|
|
Frontend
|
|||
|
|
→ OrderController.create
|
|||
|
|
→ OrderService.createOrder
|
|||
|
|
→ OrderService.splitByMerchant
|
|||
|
|
→ InventoryService.lockStock
|
|||
|
|
→ OrderRepository.save
|
|||
|
|
→ Response
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## 3. 订单履约闭环
|
|||
|
|
|
|||
|
|
Flow:
|
|||
|
|
OrderService.confirm
|
|||
|
|
→ ShipmentService.createShipment
|
|||
|
|
→ OrderService.updateStatus
|
|||
|
|
→ NotificationService.send
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## 4. 结算闭环
|
|||
|
|
|
|||
|
|
Flow:
|
|||
|
|
Scheduler / Manual Trigger
|
|||
|
|
→ SettlementService.calculate
|
|||
|
|
→ SettlementService.generateBill
|
|||
|
|
→ PaymentService.payout
|
|||
|
|
→ BillingService.record
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## 5. 权限校验闭环(所有接口必须经过)
|
|||
|
|
|
|||
|
|
Flow:
|
|||
|
|
Request
|
|||
|
|
→ AuthMiddleware
|
|||
|
|
→ PermissionService.check
|
|||
|
|
→ Controller
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## 6. 商户管理闭环
|
|||
|
|
|
|||
|
|
Flow:
|
|||
|
|
Frontend
|
|||
|
|
→ MerchantController.create
|
|||
|
|
→ MerchantService.register
|
|||
|
|
→ VerificationService.verify
|
|||
|
|
→ RBACService.assignRole
|
|||
|
|
→ Response
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## 7. 店铺管理闭环
|
|||
|
|
|
|||
|
|
Flow:
|
|||
|
|
Frontend
|
|||
|
|
→ StoreController.create
|
|||
|
|
→ StoreService.createStore
|
|||
|
|
→ ProductService.setupProducts
|
|||
|
|
→ InventoryService.initializeInventory
|
|||
|
|
→ Response
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## 8. 商户数据与分析闭环
|
|||
|
|
|
|||
|
|
Flow:
|
|||
|
|
Scheduler / Manual Trigger
|
|||
|
|
→ AnalyticsService.collectData
|
|||
|
|
→ ReportService.generateReport
|
|||
|
|
→ NotificationService.sendReport
|
|||
|
|
→ Response
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## 9. 多商户库存同步闭环
|
|||
|
|
|
|||
|
|
Flow:
|
|||
|
|
Merchant Portal
|
|||
|
|
→ InventoryController.sync
|
|||
|
|
→ InventorySyncService.syncMerchantInventory
|
|||
|
|
→ InventoryService.updateStock
|
|||
|
|
→ ProductService.updateProductStatus
|
|||
|
|
→ Response
|
|||
|
|
|
|||
|
|
---
|
|||
|
|
|
|||
|
|
## 10. 异常处理闭环
|
|||
|
|
|
|||
|
|
Flow:
|
|||
|
|
Frontend / System
|
|||
|
|
→ ExceptionController.handle
|
|||
|
|
→ ExceptionService.process
|
|||
|
|
→ NotificationService.alert
|
|||
|
|
→ SettlementService.adjust
|
|||
|
|
→ Response
|