- 系统配置管理模块 (Config) - 内容管理模块 (Banner, Promotion) - 测评管理模块 (Type, Question, Category, Mapping, Conclusion) - 用户管理模块 (User) - 订单管理模块 (Order) - 规划师管理模块 (Planner) - 分销管理模块 (InviteCode, Commission, Withdrawal) - 数据统计仪表盘模块 (Dashboard) - 权限控制集成 - 服务注册配置 全部381个测试通过
307 lines
14 KiB
Markdown
307 lines
14 KiB
Markdown
# Implementation Plan: Admin Business Modules
|
||
|
||
## Overview
|
||
|
||
本实现计划将后台管理系统业务模块分解为可执行的开发任务。基于 .NET 10 + SQL Server 2022 技术栈,在现有 MiAssessment.Admin.Business 项目基础上扩展7个核心业务模块。
|
||
|
||
## Tasks
|
||
|
||
- [x] 1. 项目基础设施搭建
|
||
- [x] 1.1 创建业务实体类 (Entities)
|
||
- 在 MiAssessment.Admin.Business/Entities 目录下创建所有业务实体类
|
||
- 包括: Config, Banner, Promotion, AssessmentType, Question, ReportCategory, QuestionCategoryMapping, ReportConclusion, User, Order, Planner, PlannerBooking, InviteCode, Commission, Withdrawal
|
||
- 每个实体类映射到对应的数据库表
|
||
- _Requirements: 1.1-1.7, 2.1-2.8, 3.1-3.6, 4.1-4.7, 5.1-5.7, 6.1-6.6, 7.1-7.6, 8.1-8.5, 9.1-9.7, 10.1-10.6, 11.1-11.6, 12.1-12.6, 13.1-13.6, 14.1-14.7, 15.1-15.7, 16.1-16.8_
|
||
|
||
- [x] 1.2 扩展 AdminBusinessDbContext
|
||
- 在 AdminBusinessDbContext 中添加所有业务实体的 DbSet
|
||
- 配置实体映射和索引
|
||
- _Requirements: 所有模块_
|
||
|
||
- [x] 1.3 创建通用模型和基础类
|
||
- 创建 PagedRequest, PagedResult, ApiResponse, UpdateStatusRequest, UpdateSortRequest 等通用模型
|
||
- 创建 ErrorCodes 错误码常量类
|
||
- 创建 BusinessException 业务异常类
|
||
- _Requirements: 所有模块_
|
||
|
||
- [x] 2. 系统配置管理模块
|
||
- [x] 2.1 实现 ConfigService
|
||
- 创建 IConfigService 接口和 ConfigService 实现
|
||
- 实现 GetConfigListAsync, GetConfigByKeyAsync, UpdateConfigAsync, ValidateConfigValueAsync 方法
|
||
- 实现配置值验证逻辑(价格、佣金比例)
|
||
- _Requirements: 1.1, 1.2, 1.3, 1.4, 1.5, 1.7_
|
||
|
||
- [x] 2.2 编写 ConfigService 属性测试
|
||
- **Property 6: Config Value Validation**
|
||
- **Property 17: Config Update Timestamp**
|
||
- **Validates: Requirements 1.3, 1.4, 1.7**
|
||
|
||
- [x] 2.3 实现 ConfigController
|
||
- 创建 ConfigController 控制器
|
||
- 实现 GetList, Update, GetByKey 接口
|
||
- _Requirements: 1.1-1.7_
|
||
|
||
- [x] 3. 内容管理模块 - 轮播图
|
||
- [x] 3.1 实现 ContentService - Banner 部分
|
||
- 创建 IContentService 接口和 ContentService 实现
|
||
- 实现 Banner 相关方法: GetBannerListAsync, CreateBannerAsync, UpdateBannerAsync, DeleteBannerAsync, UpdateBannerStatusAsync, UpdateBannerSortAsync
|
||
- 实现 LinkType 验证逻辑
|
||
- _Requirements: 2.1, 2.2, 2.3, 2.4, 2.5, 2.6, 2.7, 2.8_
|
||
|
||
- [x] 3.2 编写 Banner 属性测试
|
||
- **Property 1: Soft Delete Behavior**
|
||
- **Property 4: Sorting Correctness**
|
||
- **Property 7: Banner Link Type Validation**
|
||
- **Validates: Requirements 2.1, 2.3, 2.4, 2.5, 2.7**
|
||
|
||
- [x] 3.3 实现 ContentController - Banner 部分
|
||
- 创建 ContentController 控制器
|
||
- 实现 Banner 相关接口: banner/getList, banner/create, banner/update, banner/delete, banner/updateStatus, banner/updateSort
|
||
- _Requirements: 2.1-2.8_
|
||
|
||
- [x] 4. 内容管理模块 - 宣传图
|
||
- [x] 4.1 实现 ContentService - Promotion 部分
|
||
- 扩展 ContentService 实现 Promotion 相关方法
|
||
- 实现 GetPromotionListAsync, CreatePromotionAsync, UpdatePromotionAsync, DeletePromotionAsync, UpdatePromotionStatusAsync
|
||
- _Requirements: 3.1, 3.2, 3.3, 3.4, 3.5, 3.6_
|
||
|
||
- [x] 4.2 编写 Promotion 属性测试
|
||
- **Property 2: Status Update Persistence**
|
||
- **Validates: Requirements 3.5**
|
||
|
||
- [x] 4.3 实现 ContentController - Promotion 部分
|
||
- 扩展 ContentController 实现 Promotion 相关接口
|
||
- 实现 promotion/getList, promotion/create, promotion/update, promotion/delete, promotion/updateStatus
|
||
- _Requirements: 3.1-3.6_
|
||
|
||
- [x] 5. Checkpoint - 内容管理模块完成
|
||
- Ensure all tests pass, ask the user if questions arise.
|
||
|
||
- [x] 6. 测评管理模块 - 测评类型
|
||
- [x] 6.1 实现 AssessmentService - Type 部分
|
||
- 创建 IAssessmentService 接口和 AssessmentService 实现
|
||
- 实现 GetTypeListAsync, CreateTypeAsync, UpdateTypeAsync, DeleteTypeAsync
|
||
- 实现 Code 唯一性验证
|
||
- _Requirements: 4.1, 4.2, 4.3, 4.4, 4.5, 4.6, 4.7_
|
||
|
||
- [x] 6.2 编写 AssessmentType 属性测试
|
||
- **Property 8: Unique Constraint Enforcement (Code)**
|
||
- **Validates: Requirements 4.3**
|
||
|
||
- [x] 6.3 实现 AssessmentController - Type 部分
|
||
- 创建 AssessmentController 控制器
|
||
- 实现 type/getList, type/create, type/update, type/delete 接口
|
||
- _Requirements: 4.1-4.7_
|
||
|
||
- [x] 7. 测评管理模块 - 题库
|
||
- [x] 7.1 实现 AssessmentService - Question 部分
|
||
- 扩展 AssessmentService 实现 Question 相关方法
|
||
- 实现 GetQuestionListAsync, CreateQuestionAsync, UpdateQuestionAsync, DeleteQuestionAsync, BatchImportQuestionsAsync
|
||
- 实现 QuestionNo 唯一性验证(同一 AssessmentTypeId 内)
|
||
- _Requirements: 5.1, 5.2, 5.3, 5.4, 5.5, 5.6, 5.7_
|
||
|
||
- [x] 7.2 编写 Question 属性测试
|
||
- **Property 5: Required Field Validation**
|
||
- **Property 8: Unique Constraint Enforcement (QuestionNo)**
|
||
- **Validates: Requirements 5.2, 5.3**
|
||
|
||
- [x] 7.3 实现 AssessmentController - Question 部分
|
||
- 扩展 AssessmentController 实现 Question 相关接口
|
||
- 实现 question/getList, question/create, question/update, question/delete, question/batchImport
|
||
- _Requirements: 5.1-5.7_
|
||
|
||
- [x] 8. 测评管理模块 - 报告分类
|
||
- [x] 8.1 实现 AssessmentService - Category 部分
|
||
- 扩展 AssessmentService 实现 Category 相关方法
|
||
- 实现 GetCategoryTreeAsync, CreateCategoryAsync, UpdateCategoryAsync, DeleteCategoryAsync
|
||
- 实现树形结构构建和删除约束检查
|
||
- _Requirements: 6.1, 6.2, 6.3, 6.4, 6.5, 6.6_
|
||
|
||
- [x] 8.2 编写 Category 属性测试
|
||
- **Property 9: Tree Structure Correctness**
|
||
- **Property 18: Category Deletion Constraint**
|
||
- **Validates: Requirements 6.1, 6.5, 6.6**
|
||
|
||
- [x] 8.3 实现 AssessmentController - Category 部分
|
||
- 扩展 AssessmentController 实现 Category 相关接口
|
||
- 实现 category/getTree, category/create, category/update, category/delete
|
||
- _Requirements: 6.1-6.6_
|
||
|
||
- [x] 9. 测评管理模块 - 题目分类映射
|
||
- [x] 9.1 实现 AssessmentService - Mapping 部分
|
||
- 扩展 AssessmentService 实现 Mapping 相关方法
|
||
- 实现 GetMappingsByQuestionAsync, GetMappingsByCategoryAsync, BatchUpdateMappingsAsync
|
||
- 实现原子性批量更新
|
||
- _Requirements: 7.1, 7.2, 7.3, 7.4, 7.5, 7.6_
|
||
|
||
- [x] 9.2 编写 Mapping 属性测试
|
||
- **Property 10: Mapping Relationship Bidirectionality**
|
||
- **Property 11: Batch Operation Atomicity**
|
||
- **Validates: Requirements 7.1, 7.2, 7.6**
|
||
|
||
- [x] 9.3 实现 AssessmentController - Mapping 部分
|
||
- 扩展 AssessmentController 实现 Mapping 相关接口
|
||
- 实现 mapping/getByQuestion, mapping/getByCategory, mapping/batchUpdate
|
||
- _Requirements: 7.1-7.6_
|
||
|
||
- [x] 10. 测评管理模块 - 报告结论
|
||
- [x] 10.1 实现 AssessmentService - Conclusion 部分
|
||
- 扩展 AssessmentService 实现 Conclusion 相关方法
|
||
- 实现 GetConclusionListAsync, CreateConclusionAsync, UpdateConclusionAsync, DeleteConclusionAsync
|
||
- _Requirements: 8.1, 8.2, 8.3, 8.4, 8.5_
|
||
|
||
- [x] 10.2 实现 AssessmentController - Conclusion 部分
|
||
- 扩展 AssessmentController 实现 Conclusion 相关接口
|
||
- 实现 conclusion/getList, conclusion/create, conclusion/update, conclusion/delete
|
||
- _Requirements: 8.1-8.5_
|
||
|
||
- [x] 11. Checkpoint - 测评管理模块完成
|
||
- Ensure all tests pass, ask the user if questions arise.
|
||
|
||
- [x] 12. 用户管理模块
|
||
- [x] 12.1 实现 UserBusinessService
|
||
- 扩展现有 UserBusinessService
|
||
- 实现 GetUserListAsync, GetUserDetailAsync, UpdateUserStatusAsync, UpdateUserLevelAsync, ExportUsersAsync
|
||
- 实现多条件筛选和分页
|
||
- _Requirements: 9.1, 9.2, 9.3, 9.4, 9.5, 9.6, 9.7_
|
||
|
||
- [x] 12.2 编写 User 属性测试
|
||
- **Property 3: Pagination Correctness**
|
||
- **Validates: Requirements 9.1**
|
||
|
||
- [x] 12.3 实现 UserController
|
||
- 扩展现有 UserController
|
||
- 实现 getList, getDetail, updateStatus, updateLevel, export 接口
|
||
- _Requirements: 9.1-9.7_
|
||
|
||
- [x] 13. 订单管理模块
|
||
- [x] 13.1 实现 OrderService
|
||
- 创建 IOrderService 接口和 OrderService 实现
|
||
- 实现 GetOrderListAsync, GetOrderDetailAsync, RefundAsync
|
||
- 实现退款状态流转和验证逻辑
|
||
- _Requirements: 10.1, 10.2, 10.3, 10.4, 10.5, 10.6, 11.1, 11.2, 11.3, 11.4, 11.5, 11.6_
|
||
|
||
- [x] 13.2 编写 Order 属性测试
|
||
- **Property 12: Refund Status Transitions**
|
||
- **Validates: Requirements 11.1, 11.2, 11.3, 11.4**
|
||
|
||
- [x] 13.3 实现 OrderController
|
||
- 创建 OrderController 控制器
|
||
- 实现 getList, getDetail, refund, export 接口
|
||
- _Requirements: 10.1-10.6, 11.1-11.6_
|
||
|
||
- [x] 14. Checkpoint - 用户和订单模块完成
|
||
- Ensure all tests pass, ask the user if questions arise.
|
||
|
||
- [x] 15. 规划师管理模块
|
||
- [x] 15.1 实现 PlannerService
|
||
- 创建 IPlannerService 接口和 PlannerService 实现
|
||
- 实现 Planner 相关方法: GetPlannerListAsync, CreatePlannerAsync, UpdatePlannerAsync, DeletePlannerAsync, UpdatePlannerStatusAsync, UpdatePlannerSortAsync
|
||
- 实现 Booking 相关方法: GetBookingListAsync, GetBookingDetailAsync, UpdateBookingStatusAsync
|
||
- _Requirements: 12.1, 12.2, 12.3, 12.4, 12.5, 12.6, 13.1, 13.2, 13.3, 13.4, 13.5, 13.6_
|
||
|
||
- [x] 15.2 实现 PlannerController
|
||
- 创建 PlannerController 控制器
|
||
- 实现 Planner 接口: getList, create, update, delete, updateStatus, updateSort
|
||
- 实现 Booking 接口: booking/getList, booking/getDetail, booking/updateStatus, booking/export
|
||
- _Requirements: 12.1-12.6, 13.1-13.6_
|
||
|
||
- [x] 16. 分销管理模块 - 邀请码
|
||
- [x] 16.1 实现 DistributionService - InviteCode 部分
|
||
- 创建 IDistributionService 接口和 DistributionService 实现
|
||
- 实现 GetInviteCodeListAsync, GenerateInviteCodesAsync, AssignInviteCodesAsync
|
||
- 实现唯一邀请码生成算法(5位大写字母)
|
||
- _Requirements: 14.1, 14.2, 14.3, 14.4, 14.5, 14.6, 14.7_
|
||
|
||
- [x] 16.2 编写 InviteCode 属性测试
|
||
- **Property 13: Invite Code Generation Uniqueness**
|
||
- **Validates: Requirements 14.3, 14.4**
|
||
|
||
- [x] 16.3 实现 DistributionController - InviteCode 部分
|
||
- 创建 DistributionController 控制器
|
||
- 实现 inviteCode/getList, inviteCode/generate, inviteCode/assign, inviteCode/export
|
||
- _Requirements: 14.1-14.7_
|
||
|
||
- [x] 17. 分销管理模块 - 佣金记录
|
||
- [x] 17.1 实现 DistributionService - Commission 部分
|
||
- 扩展 DistributionService 实现 Commission 相关方法
|
||
- 实现 GetCommissionListAsync, GetCommissionDetailAsync, GetCommissionStatisticsAsync
|
||
- 实现佣金统计计算
|
||
- _Requirements: 15.1, 15.2, 15.3, 15.4, 15.5, 15.6, 15.7_
|
||
|
||
- [x] 17.2 编写 Commission 属性测试
|
||
- **Property 14: Commission Statistics Accuracy**
|
||
- **Validates: Requirements 15.6**
|
||
|
||
- [x] 17.3 实现 DistributionController - Commission 部分
|
||
- 扩展 DistributionController 实现 Commission 相关接口
|
||
- 实现 commission/getList, commission/getDetail, commission/getStatistics, commission/export
|
||
- _Requirements: 15.1-15.7_
|
||
|
||
- [x] 18. 分销管理模块 - 提现审核
|
||
- [x] 18.1 实现 DistributionService - Withdrawal 部分
|
||
- 扩展 DistributionService 实现 Withdrawal 相关方法
|
||
- 实现 GetWithdrawalListAsync, GetWithdrawalDetailAsync, ApproveWithdrawalAsync, RejectWithdrawalAsync, CompleteWithdrawalAsync
|
||
- 实现提现状态流转和余额回滚逻辑
|
||
- _Requirements: 16.1, 16.2, 16.3, 16.4, 16.5, 16.6, 16.7, 16.8_
|
||
|
||
- [x] 18.2 编写 Withdrawal 属性测试
|
||
- **Property 15: Withdrawal Status Transitions**
|
||
- **Validates: Requirements 16.4, 16.5, 16.6, 16.7**
|
||
|
||
- [x] 18.3 实现 DistributionController - Withdrawal 部分
|
||
- 扩展 DistributionController 实现 Withdrawal 相关接口
|
||
- 实现 withdrawal/getList, withdrawal/getDetail, withdrawal/approve, withdrawal/reject, withdrawal/complete, withdrawal/export
|
||
- _Requirements: 16.1-16.8_
|
||
|
||
- [x] 19. Checkpoint - 分销管理模块完成
|
||
- Ensure all tests pass, ask the user if questions arise.
|
||
|
||
- [x] 20. 数据统计仪表盘模块
|
||
- [x] 20.1 实现 DashboardService
|
||
- 扩展现有 DashboardService
|
||
- 实现 GetOverviewAsync, GetTrendsAsync, GetPendingItemsAsync
|
||
- 实现统计数据计算和趋势数据生成
|
||
- _Requirements: 17.1, 17.2, 17.3, 17.4, 17.5_
|
||
|
||
- [x] 20.2 实现 DashboardController
|
||
- 扩展现有 DashboardController
|
||
- 实现 getOverview, getTrends, getPendingItems 接口
|
||
- _Requirements: 17.1-17.5_
|
||
|
||
- [x] 21. 权限控制集成
|
||
- [x] 21.1 定义业务模块权限
|
||
- 在权限系统中注册业务模块权限
|
||
- 定义权限: config, content, assessment, user, order, planner, distribution
|
||
- 定义权限粒度: view, create, update, delete
|
||
- _Requirements: 18.3, 18.4, 18.5_
|
||
|
||
- [x] 21.2 编写权限控制属性测试
|
||
- **Property 16: Authorization Enforcement**
|
||
- **Validates: Requirements 18.2**
|
||
|
||
- [x] 21.3 应用权限控制到所有控制器
|
||
- 在所有业务控制器方法上添加 [RequirePermission] 特性
|
||
- 配置权限检查中间件
|
||
- _Requirements: 18.1, 18.2_
|
||
|
||
- [x] 22. 服务注册和依赖注入配置
|
||
- [x] 22.1 配置服务注册
|
||
- 在 ServiceCollectionExtensions 中注册所有业务服务
|
||
- 配置 AutoMapper 映射
|
||
- 配置 FluentValidation 验证器
|
||
- _Requirements: 所有模块_
|
||
|
||
- [x] 23. Final Checkpoint - 全部模块完成
|
||
- Ensure all tests pass, ask the user if questions arise.
|
||
|
||
## Notes
|
||
|
||
- All tasks are required for comprehensive testing
|
||
- Each task references specific requirements for traceability
|
||
- Checkpoints ensure incremental validation
|
||
- Property tests validate universal correctness properties
|
||
- Unit tests validate specific examples and edge cases
|
||
- 所有接口采用 RPC 风格,仅使用 GET 和 POST 请求
|
||
- 实体类需要与现有数据库表结构保持一致
|