Files
makemd/docs/01_Architecture/SERVICE_MAP.md
wurenzhi 5cfd0c4c89 feat: 实现服务层核心功能与文档更新
refactor(ProductService): 修复createProduct方法和其他方法错误
fix(InventoryAgingService): 修复AGING_THRESHOLD_DAYS引用问题
fix(InventoryService): 修复predictSKUDemand方法
refactor(ChatBotController): 从tsoa风格改为Express风格
fix(CommandCenterController): 修复类型问题
fix(AdAutoService): 修复stock可能为undefined的问题
docs: 更新SERVICE_MAP、DOMAIN_MODEL等架构文档
chore: 启动前端服务(运行在http://localhost:8000)
2026-03-18 12:35:52 +08:00

128 lines
2.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 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