WorkCamera/.kiro/specs/work-camera-2.0.1/tasks.md
2026-01-05 23:58:56 +08:00

8.7 KiB
Raw Blame History

Implementation Plan: 随工水印相机 2.0.1 客户端

Overview

基于现有的 WinForms + .NET 8 客户端项目,实现主页界面、工作记录管理、月报表功能,所有导出操作在客户端本地执行。

Tasks

  • 1. 项目基础设施搭建

    • 1.1 创建 Models 层数据模型
      • 创建 WorkRecordDto、MonthlyReportDto、StatisticsDto、ExportProgress、AppConfig 等模型类
      • 创建 API 响应包装类 ApiResponse、PagedResult
      • Requirements: 2.5, 7.3
    • 1.2 创建 Services 层接口定义
      • 定义 IApiService、IExportService、IImageService、IConfigService、ILogService 接口
      • Requirements: 6.3, 6.4, 10.3, 11.2, 12.2, 12.3
    • 1.3 实现 ConfigService 配置服务
      • 实现配置文件的读取和保存JSON 格式)
      • 实现登录凭证的加密存储
      • Requirements: 10.1, 12.1, 12.2
    • 1.4 编写 ConfigService 属性测试
      • Property 12: 配置持久化
      • Validates: Requirements 12.2
    • 1.5 实现 LogService 日志服务
      • 实现日志记录Info、Error、Warn
      • 实现日志文件按日期分割
      • 实现日志导出功能
      • Requirements: 12.3, 12.4
    • 1.6 编写 LogService 属性测试
      • Property 13: 日志记录
      • Validates: Requirements 12.3
  • 2. API 通信服务实现

    • 2.1 实现 ApiService 基础功能
      • 实现 HttpClient 封装,支持 Token 认证
      • 实现请求重试机制(最多 3 次)
      • 实现 Token 自动刷新逻辑
      • Requirements: 10.3, 10.4, 11.2
    • 2.2 编写 ApiService 属性测试
      • Property 10: Token 自动刷新
      • Property 11: 请求重试机制
      • Validates: Requirements 10.3, 11.2
    • 2.3 实现 ApiService 业务接口
      • 实现登录接口 LoginAsync
      • 实现统计接口 GetStatisticsAsync
      • 实现工作记录 CRUD 接口
      • 实现月报表查询接口
      • 实现月份图片列表接口
      • Requirements: 1.2, 2.2, 4.7, 5.2, 7.2, 9.1
  • 3. Checkpoint - 基础服务完成

    • 确保所有测试通过,如有问题请询问用户
  • 4. 图片服务实现

    • 4.1 实现 ImageService 下载功能
      • 实现单图下载 DownloadImageAsync
      • 实现批量并发下载 DownloadImagesAsync使用 SemaphoreSlim 控制并发)
      • Requirements: 6.4, 9.2
    • 4.2 编写 ImageService 并发下载属性测试
      • Property 7: 并发下载控制
      • Validates: Requirements 6.4
    • 4.3 实现 ImageService 图片处理功能
      • 实现图片压缩 CompressImage使用 SixLabors.ImageSharp
      • 实现图片缩放 ResizeImage
      • Requirements: 6.7
  • 5. 导出服务实现

    • 5.1 实现 ExportService 工作记录导出
      • 实现分页获取数据逻辑
      • 实现图片下载和临时存储
      • 实现 Excel 生成(使用 EPPlus
      • 实现图片嵌入 Excel水平排列100x60 像素)
      • 实现进度回调和取消支持
      • Requirements: 6.1, 6.2, 6.3, 6.5, 6.6, 6.7, 6.8, 6.9
    • 5.2 编写 ExportService 属性测试
      • Property 5: 导出数据完整性
      • Property 6: 分页数据获取
      • Property 8: Excel 图片布局
      • Validates: Requirements 6.1, 6.2, 6.3, 6.6, 6.7
    • 5.3 实现 ExportService 月报表导出
      • 实现月报表 Excel 生成
      • Requirements: 8.1, 8.2
    • 5.4 实现 ExportService 照片 ZIP 下载
      • 实现按目录结构下载图片
      • 实现 ZIP 打包(使用 System.IO.Compression
      • 实现进度回调和取消支持
      • Requirements: 9.1, 9.2, 9.3, 9.4, 9.5, 9.6
    • 5.5 编写 ExportService ZIP 目录结构属性测试
      • Property 9: ZIP 目录结构
      • Validates: Requirements 9.2, 9.3
  • 6. Checkpoint - 服务层完成

    • 确保所有测试通过,如有问题请询问用户
  • 7. 主页界面实现

    • 7.1 创建 MainForm 主页窗体
      • 设计统计信息面板布局
      • 设计功能入口按钮布局
      • Requirements: 1.1
    • 7.2 实现 MainForm 功能逻辑
      • 实现统计数据加载和显示
      • 实现导航到工作记录、月报表、数据迁移界面
      • 实现错误处理和重试
      • Requirements: 1.2, 1.3, 1.4, 1.5, 1.6
  • 8. 图片查看器实现

    • 8.1 创建 ImageViewerForm 图片查看器窗体
      • 设计图片显示区域
      • 设计导航按钮(上一张、下一张)
      • Requirements: 3.3
    • 8.2 实现 ImageViewerForm 功能逻辑
      • 实现图片加载和显示
      • 实现图片轮播切换(左右箭头、循环)
      • 实现图片缩放(鼠标滚轮)
      • 实现图片拖拽移动
      • Requirements: 3.4, 3.5, 3.6
    • 8.3 编写图片轮播索引属性测试
      • Property 2: 图片轮播索引边界
      • Validates: Requirements 3.6
  • 9. 工作记录管理界面实现

    • 9.1 创建 WorkRecordForm 工作记录窗体
      • 设计查询条件面板
      • 设计数据列表DataGridView
      • 设计工具栏按钮
      • 设计分页控件
      • Requirements: 2.1, 2.4
    • 9.2 实现 WorkRecordForm 查询功能
      • 实现查询条件绑定
      • 实现查询和重置
      • 实现分页加载
      • Requirements: 2.2, 2.3, 2.4
    • 9.3 实现 WorkRecordForm 列表显示
      • 实现数据绑定和显示
      • 实现多图缩略图显示(最多 3 张 + 徽章)
      • 实现多选功能
      • Requirements: 2.5, 3.1, 3.2
    • 9.4 编写图片显示数量属性测试
      • Property 1: 图片显示数量限制
      • Validates: Requirements 3.1, 3.2
    • 9.5 实现 WorkRecordForm 导出功能
      • 实现导出全部
      • 实现导出所选
      • 实现进度显示和取消
      • Requirements: 6.1, 6.2, 6.8, 6.9, 6.10
  • 10. 工作记录编辑功能实现

    • 10.1 创建 WorkRecordEditForm 编辑弹窗
      • 设计表单布局(所有可编辑字段)
      • 设计图片上传区域
      • Requirements: 4.3
    • 10.2 实现 WorkRecordEditForm 图片上传功能
      • 实现拖拽上传
      • 实现点击选择多文件
      • 实现图片预览
      • 实现图片删除
      • 实现数量限制(最多 15 张,单张 10MB
      • Requirements: 4.4, 4.5, 4.6
    • 10.3 编写图片上传数量属性测试
      • Property 3: 图片上传数量限制
      • Property 4: 图片删除后列表更新
      • Validates: Requirements 4.5, 4.6
    • 10.4 实现 WorkRecordEditForm 表单提交
      • 实现新增记录
      • 实现编辑记录
      • 实现表单验证
      • 实现错误处理
      • Requirements: 4.1, 4.2, 4.7, 4.8
    • 10.5 实现 WorkRecordForm 删除功能
      • 实现删除确认对话框
      • 实现删除 API 调用
      • 实现错误处理
      • Requirements: 5.1, 5.2, 5.3
  • 11. Checkpoint - 工作记录功能完成

    • 确保所有测试通过,如有问题请询问用户
  • 12. 月报表界面实现

    • 12.1 创建 MonthReportForm 月报表窗体
      • 设计查询条件面板(人员名称、月份)
      • 设计数据列表
      • 设计工具栏按钮
      • Requirements: 7.1
    • 12.2 实现 MonthReportForm 查询功能
      • 实现查询和重置
      • 实现数据显示
      • Requirements: 7.2, 7.3
    • 12.3 实现 MonthReportForm 导出功能
      • 实现 Excel 导出
      • 实现照片 ZIP 下载
      • 实现进度显示和取消
      • Requirements: 8.1, 8.2, 8.3, 9.1, 9.5, 9.6, 9.7
  • 13. 通用功能实现

    • 13.1 实现登录状态管理
      • 实现记住登录功能
      • 实现自动登录
      • 实现登录失效提示
      • Requirements: 10.1, 10.2, 10.4
    • 13.2 实现网络异常处理
      • 实现网络断开检测和提示
      • 实现断点续传支持
      • Requirements: 11.1, 11.3
    • 13.3 创建 SettingsForm 设置界面
      • 设计设置项布局
      • 实现设置保存
      • Requirements: 12.1, 12.2
  • 14. 后端 API 支持

    • 14.1 实现统计接口
      • 创建 /api/workrecord/statistics 接口
      • 返回本月记录数、图片数、人员数、今日新增、总量、待迁移数
      • Requirements: 1.2
    • 14.2 实现月份图片列表接口
      • 创建 /api/workrecord/monthImages 接口
      • 返回指定月份的所有图片 URL 及相关信息
      • Requirements: 9.1
  • 15. Final Checkpoint - 全部功能完成

    • 确保所有测试通过
    • 进行集成测试
    • 如有问题请询问用户

Notes

  • All tasks are required for complete implementation
  • 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
  • 使用 C# / .NET 8 开发
  • 使用 EPPlus 生成 Excel
  • 使用 SixLabors.ImageSharp 处理图片
  • 使用 System.IO.Compression 打包 ZIP