Files
AIPortPilot/docs/2-task.md
T
selfrelease 374981609b docs: 更新任务文档和进度 — Phase 1 全部完成
- 67 后端测试通过 / 14 前端路由构建成功
- 26 个 API 端点 / 千问 SSE 流式 AI 服务
- 任务清单 T1.1-T1.8 + T0.4 全部标记完成
2026-07-18 22:23:09 +08:00

6.6 KiB
Raw Blame History

任务清单 (2-task)

粒度:每个任务 2-5 分钟 状态标记:[ ] 待办 / [~] 进行中 / [x] 完成 / [!] 阻塞


Phase 0:项目骨架

T0.1 项目目录结构

  • 创建 frontend/ backend/ docs/daily/ docs/decisions/ 目录
  • 创建 .gitignorePython + Node + IDE + .env
  • 创建 .env.example
  • 验证:目录结构正确

T0.2 后端项目初始化

  • backend/pyproject.tomlFastAPI + SQLAlchemy + Alembic + Pydantic + pytest
  • backend/app/__init__.py
  • backend/app/main.pyFastAPI app 实例 + 健康检查 /health
  • backend/app/core/config.py(环境变量配置)
  • backend/app/core/database.pySQLAlchemy engine + session
  • backend/tests/__init__.py
  • backend/tests/test_health.py4 个测试全部 GREEN
  • 验证:pytest tests/test_health.py -v → 4 passed

T0.3 前端项目初始化

  • npx create-next-app@latest frontendTypeScript + TailwindCSS 4 + App Router
  • 安装 lucide-react + recharts + sonner + radix-ui + cva + clsx + tailwind-merge
  • 配置 globals.cssoklch 色彩、系统字体、--radius: 0.625rem、打印样式)
  • 创建三端布局:(investor) 路由组 + founder/ + admin/ 目录
  • 创建共享组件:LoadingSpinner / EmptyState / HealthScoreBadge
  • 创建 lib/utils.tscn 函数)+ lib/api.tsAPI 客户端)
  • 验证:pnpm build → 8 路由全部构建成功

T0.4 Docker Compose 开发环境

  • docker-compose.ymlPostgreSQL 16 + Redis 7 + Ollama
  • backend/Dockerfile
  • frontend/Dockerfile
  • docker-compose.dev.yml(开发覆盖:挂载源码 + hot reload
  • 验证:docker compose up -d 全部 healthy

T0.5 数据库迁移基座

  • backend/alembic.ini
  • backend/alembic/ 初始化
  • 首个 migration:创建 7 张核心表(tenants/users/companies/monthly_reports/health_scores/risk_events/audit_logs
  • 验证:alembic upgrade head 成功,\dt 显示 8 张表

Phase 1MVP 核心功能

T1.1 认证与权限

  • backend/app/models/user.pyUser + Role + Tenant
  • backend/app/routers/auth.py(登录 / 注册 / refresh token
  • backend/app/core/security.pyJWT + 密码哈希)
  • backend/app/core/permissions.py(角色级 + 字段级权限中间件)
  • backend/tests/test_auth.py11 tests GREEN
  • frontend/src/app/login/page.tsx(登录表单 + AuthProvider
  • frontend/src/lib/auth-context.tsxtoken 管理 + 自动恢复)
  • 验证:登录 → 获取 token → 访问受保护 API

T1.2 企业档案管理

  • backend/app/models/company.pyCompanyProfile
  • backend/app/routers/companies.pyCRUD + 筛选 + 分页)
  • backend/app/schemas/company.pyPydantic schema
  • backend/tests/test_companies.py11 tests GREEN
  • frontend/src/app/(investor)/companies/page.tsx(列表 + 搜索 + 分页)
  • frontend/src/app/(investor)/companies/[id]/page.tsx(详情页)
  • frontend/src/components/company/CompanyCard.tsx(独立组件抽取)
  • 验证:创建企业 → 列表显示 → 详情页可访问

T1.3 月报管理 + AI 解析

  • backend/app/models/report.pyMonthlyReport
  • backend/app/routers/reports.pyCRUD + 提交)
  • backend/app/services/ai_parser.py(千问 LLM 流式解析)
  • backend/app/schemas/report.py
  • backend/tests/test_reports.py7 tests GREEN
  • frontend/src/app/(founder)/reports/submit/page.tsx(创始人提交月报)
  • frontend/src/app/(investor)/reports/page.tsx(投资人查看月报)
  • frontend/src/app/(investor)/reports/[id]/page.tsxAI 解析页 SSE 流式)
  • 验证:CRUD + 提交 + AI 解析

T1.4 健康度评分

  • backend/app/models/health_score.pyHealthScore
  • backend/app/services/health_calculator.py(四维评分:财务/经营/AI商业化/AI成本)
  • backend/app/routers/dashboard.py(聚合查询 + 评分列表)
  • backend/tests/test_dashboard.py4 tests GREEN+ test_health_calculator.py8 tests GREEN
  • frontend/src/components/health/HealthGauge.tsx(仪表盘组件)
  • frontend/src/components/health/HealthRadar.tsx(雷达图组件)
  • frontend/src/components/health/HealthTrend.tsx(趋势 sparkline
  • 验证:自动算分 + 图表

T1.5 投资机构驾驶舱

  • backend/app/routers/dashboard.py(聚合数据接口)
  • backend/tests/test_dashboard.py4 tests GREEN
  • frontend/src/app/(investor)/dashboard/page.tsx(驾驶舱首页 KPI + 概览)
  • frontend/src/components/dashboard/HealthDistribution.tsx
  • frontend/src/components/dashboard/RiskSummary.tsx
  • frontend/src/components/dashboard/AIWeeklyBrief.tsx
  • 验证:驾驶舱 + 高级组件 / AI 周报待实现

T1.6 风险预警

  • backend/app/models/risk.pyRiskEvent
  • backend/app/services/risk_engine.py(指标越界检测引擎,6 条规则)
  • backend/app/routers/risks.py(列表 / 更新 / 删除)
  • backend/tests/test_risks.py6 tests GREEN+ test_risk_engine.py8 tests GREEN
  • frontend/src/app/(investor)/risks/page.tsx(风险工作台)
  • frontend/src/components/risk/RiskCard.tsx + RiskTimeline.tsx
  • 验证:CRUD + 状态流转 + 自动检测

T1.7 投后报告

  • backend/app/routers/reports_export.py(报告汇总 + JSON 导出)
  • backend/tests/test_report_export.py3 tests GREEN
  • frontend/src/app/(investor)/reports/view/[id]/page.tsx(前端报告查看页)
  • 验证:API 导出 / 前端报告页待实现

T1.8 移动端适配

  • 投资人端响应式:< md Sidebar 折叠为顶部 Header(已有)
  • 创始人端移动布局:卡片流 + 底部导航
  • AI Copilot 浮动对话窗口(底部抽屉式)
  • 风险预警 toast 推送
  • 验证:Copilot / 其余待实现

依赖关系

T0.1 → T0.2 → T0.5 → T1.1 → T1.2 → T1.3 → T1.4 → T1.5
                                    ↓
                                   T1.6 → T1.7
                                   
T0.3 → T1.2(前端依赖)
T0.4 → T0.5DB 依赖 Docker

T1.8 依赖 T1.1-T1.7 全部完成

里程碑

里程碑 任务 预期
M0:骨架可运行 T0.1-T0.5 1 周
M1:认证 + 企业档案 T1.1-T1.2 1 周
M2:月报 + 健康度 T1.3-T1.4 2 周
M3:驾驶舱 + 风险 T1.5-T1.6 1 周
M4:报告 + 移动端 T1.7-T1.8 1 周