Files
SuperBizAgent-java/openspec/changes/phase-1-infrastructure/tasks.md
T
zhuyongxin 60be51f4a5 docs: 重构文档结构,分离学习笔记和 MVP 架构设计
**变更概述:**
- 将 MVP 架构设计文档独立到项目根目录 `mvp/`
- 整理 `docs/` 为纯学习和分析文档目录
- 按类型分类:learning(学习)、analysis(分析)、reports(报告)、guides(指南)

**目录结构:**
```
mvp/                          # MVP 架构设计(独立)
├── README.md                 # 数据库设计总览
├── architecture/             # 架构文档
│   ├── agent-architecture-mvp.md
│   ├── implementation-plan.md
│   └── ...
└── tables/                   # 数据表设计

docs/                         # 学习和分析文档
├── learning/                 # 学习笔记(00-08 编号)
├── analysis/                 # 分析笔记 + 重构计划
├── reports/                  # 临时报告
└── guides/                   # 指南文档
```

**详细变更:**
- docs/README.md → mvp/README.md(数据库设计入口)
- docs/architecture/ → mvp/architecture/(架构设计)
- docs/tables/ → mvp/tables/(数据表设计)
- docs/学习笔记-*.md → docs/learning/07-*.md, 08-*.md
- docs/项目学习路径.md → docs/learning/00-*.md
- docs/功能分析报告.md → docs/analysis/
- docs/修复报告-*.md → docs/reports/
- docs/日志配置*.md → docs/guides/ 或 docs/reports/
- docs/design/ → docs/analysis/(问题分析和重构计划)
2026-06-23 14:14:51 +08:00

2.3 KiB

Phase 1 Infrastructure - Tasks

1. 数据库与依赖

  • 1.1 添加依赖到 pom.xml (spring-boot-starter-data-jpa, mysql-connector-j, flyway-core, spring-boot-starter-data-redis)
  • 1.2 创建 Flyway 迁移脚本 V001__create_diagnosis_record.sql
  • 1.3 创建 Flyway 迁移脚本 V002__create_case_library.sql
  • 1.4 创建 Flyway 迁移脚本 V003__create_api_document.sql
  • 1.5 配置 MySQL + Redis + Flyway (application.yml)

2. JPA 实体与 Repository

  • 2.1 创建 JPA 实体类 DiagnosisRecord
  • 2.2 创建 JPA 实体类 CaseLibrary
  • 2.3 创建 JPA 实体类 ApiDocument
  • 2.4 创建 DiagnosisRecordRepository 接口
  • 2.5 创建 CaseLibraryRepository 接口
  • 2.6 创建 ApiDocumentRepository 接口
  • 2.7 Repository 单元测试 (DiagnosisRecordRepositoryTest)
  • 2.8 Repository 单元测试 (CaseLibraryRepositoryTest)
  • 2.9 Repository 单元测试 (ApiDocumentRepositoryTest)

3. 会话管理

  • 3.1 创建 SessionManager 接口
  • 3.2 创建 SessionContext 数据类
  • 3.3 创建 ToolCall 数据类
  • 3.4 创建 RedisSessionManager 实现
  • 3.5 创建 SessionConfiguration 配置类
  • 3.6 Redis 会话管理单元测试 (RedisSessionManagerTest)

4. 代码结构重构

  • 4.1 包名重构 (org.example → com.superbiz.agent)
  • 4.2 分层结构优化 (controller/service/repository/domain/tool/config/exception)
  • 4.3 创建 DTO 类 (DiagnosisRequest, DiagnosisResponse, DocumentUploadRequest, DocumentQueryResponse, Result)

5. 文档管理服务

  • 5.1 创建 TextExtractor 服务 (支持 .txt, .md, .docx, .pdf)
  • 5.2 文档分块服务 (DocumentChunkService, chunk_size=500, overlap=50)
  • 5.3 文档上传接口 (DocumentController#upload, DocumentService#uploadDocument)
  • 5.4 文档查询接口 (DocumentController#query, DocumentService#queryDocuments)
  • 5.5 文档删除接口 (DocumentController#delete, DocumentService#deleteDocument)
  • 5.6 混合检索工具 (DocumentSearchTool: 精确匹配 + 语义检索 + RRF 融合)
  • 5.7 文档管理集成测试 (DocumentIntegrationTest)

6. 全局完善

  • 6.1 统一异常处理 (GlobalExceptionHandler, SessionNotFoundException, DocumentProcessException)
  • 6.2 Docker Compose 配置 (MySQL + Redis + Milvus)
  • 6.3 更新 README.md (Phase 1 安装说明与本地开发指南)