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

148 lines
6.6 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.
# 任务清单 (2-task)
> 粒度:每个任务 2-5 分钟
> 状态标记:[ ] 待办 / [~] 进行中 / [x] 完成 / [!] 阻塞
---
## Phase 0:项目骨架
### T0.1 项目目录结构
- [x] 创建 `frontend/` `backend/` `docs/daily/` `docs/decisions/` 目录
- [x] 创建 `.gitignore`Python + Node + IDE + .env
- [x] 创建 `.env.example`
- 验证:目录结构正确
### T0.2 后端项目初始化
- [x] `backend/pyproject.toml`FastAPI + SQLAlchemy + Alembic + Pydantic + pytest
- [x] `backend/app/__init__.py`
- [x] `backend/app/main.py`FastAPI app 实例 + 健康检查 `/health`
- [x] `backend/app/core/config.py`(环境变量配置)
- [x] `backend/app/core/database.py`SQLAlchemy engine + session
- [x] `backend/tests/__init__.py`
- [x] `backend/tests/test_health.py`4 个测试全部 GREEN
- 验证:`pytest tests/test_health.py -v` → 4 passed
### T0.3 前端项目初始化
- [x] `npx create-next-app@latest frontend`TypeScript + TailwindCSS 4 + App Router
- [x] 安装 lucide-react + recharts + sonner + radix-ui + cva + clsx + tailwind-merge
- [x] 配置 `globals.css`oklch 色彩、系统字体、`--radius: 0.625rem`、打印样式)
- [x] 创建三端布局:`(investor)` 路由组 + `founder/` + `admin/` 目录
- [x] 创建共享组件:`LoadingSpinner` / `EmptyState` / `HealthScoreBadge`
- [x] 创建 `lib/utils.ts`cn 函数)+ `lib/api.ts`API 客户端)
- 验证:`pnpm build` → 8 路由全部构建成功
### T0.4 Docker Compose 开发环境
- [x] `docker-compose.yml`PostgreSQL 16 + Redis 7 + Ollama
- [x] `backend/Dockerfile`
- [x] `frontend/Dockerfile`
- [x] `docker-compose.dev.yml`(开发覆盖:挂载源码 + hot reload
- 验证:`docker compose up -d` 全部 healthy
### T0.5 数据库迁移基座
- [x] `backend/alembic.ini`
- [x] `backend/alembic/` 初始化
- [x] 首个 migration:创建 7 张核心表(tenants/users/companies/monthly_reports/health_scores/risk_events/audit_logs
- 验证:`alembic upgrade head` 成功,`\dt` 显示 8 张表
---
## Phase 1MVP 核心功能
### T1.1 认证与权限
- [x] `backend/app/models/user.py`User + Role + Tenant
- [x] `backend/app/routers/auth.py`(登录 / 注册 / refresh token
- [x] `backend/app/core/security.py`JWT + 密码哈希)
- [ ] `backend/app/core/permissions.py`(角色级 + 字段级权限中间件)
- [x] `backend/tests/test_auth.py`11 tests GREEN
- [x] `frontend/src/app/login/page.tsx`(登录表单 + AuthProvider
- [x] `frontend/src/lib/auth-context.tsx`token 管理 + 自动恢复)
- 验证:登录 → 获取 token → 访问受保护 API ✅
### T1.2 企业档案管理
- [x] `backend/app/models/company.py`CompanyProfile
- [x] `backend/app/routers/companies.py`CRUD + 筛选 + 分页)
- [x] `backend/app/schemas/company.py`Pydantic schema
- [x] `backend/tests/test_companies.py`11 tests GREEN
- [x] `frontend/src/app/(investor)/companies/page.tsx`(列表 + 搜索 + 分页)
- [x] `frontend/src/app/(investor)/companies/[id]/page.tsx`(详情页)
- [ ] `frontend/src/components/company/CompanyCard.tsx`(独立组件抽取)
- 验证:创建企业 → 列表显示 → 详情页可访问 ✅
### T1.3 月报管理 + AI 解析
- [x] `backend/app/models/report.py`MonthlyReport
- [x] `backend/app/routers/reports.py`CRUD + 提交)
- [x] `backend/app/services/ai_parser.py`(千问 LLM 流式解析)
- [x] `backend/app/schemas/report.py`
- [x] `backend/tests/test_reports.py`7 tests GREEN
- [x] `frontend/src/app/(founder)/reports/submit/page.tsx`(创始人提交月报)
- [x] `frontend/src/app/(investor)/reports/page.tsx`(投资人查看月报)
- [x] `frontend/src/app/(investor)/reports/[id]/page.tsx`AI 解析页 SSE 流式)
- 验证:CRUD + 提交 + AI 解析 ✅
### T1.4 健康度评分
- [x] `backend/app/models/health_score.py`HealthScore
- [x] `backend/app/services/health_calculator.py`(四维评分:财务/经营/AI商业化/AI成本)
- [x] `backend/app/routers/dashboard.py`(聚合查询 + 评分列表)
- [x] `backend/tests/test_dashboard.py`4 tests GREEN+ `test_health_calculator.py`8 tests GREEN
- [x] `frontend/src/components/health/HealthGauge.tsx`(仪表盘组件)
- [x] `frontend/src/components/health/HealthRadar.tsx`(雷达图组件)
- [x] `frontend/src/components/health/HealthTrend.tsx`(趋势 sparkline
- 验证:自动算分 + 图表 ✅
### T1.5 投资机构驾驶舱
- [x] `backend/app/routers/dashboard.py`(聚合数据接口)
- [x] `backend/tests/test_dashboard.py`4 tests GREEN
- [x] `frontend/src/app/(investor)/dashboard/page.tsx`(驾驶舱首页 KPI + 概览)
- [x] `frontend/src/components/dashboard/HealthDistribution.tsx`
- [x] `frontend/src/components/dashboard/RiskSummary.tsx`
- [ ] `frontend/src/components/dashboard/AIWeeklyBrief.tsx`
- 验证:驾驶舱 + 高级组件 ✅ / AI 周报待实现
### T1.6 风险预警
- [x] `backend/app/models/risk.py`RiskEvent
- [x] `backend/app/services/risk_engine.py`(指标越界检测引擎,6 条规则)
- [x] `backend/app/routers/risks.py`(列表 / 更新 / 删除)
- [x] `backend/tests/test_risks.py`6 tests GREEN+ `test_risk_engine.py`8 tests GREEN
- [x] `frontend/src/app/(investor)/risks/page.tsx`(风险工作台)
- [ ] `frontend/src/components/risk/RiskCard.tsx` + `RiskTimeline.tsx`
- 验证:CRUD + 状态流转 + 自动检测 ✅
### T1.7 投后报告
- [x] `backend/app/routers/reports_export.py`(报告汇总 + JSON 导出)
- [x] `backend/tests/test_report_export.py`3 tests GREEN
- [ ] `frontend/src/app/(investor)/reports/view/[id]/page.tsx`(前端报告查看页)
- 验证:API 导出 ✅ / 前端报告页待实现
### T1.8 移动端适配
- [x] 投资人端响应式:< md Sidebar 折叠为顶部 Header(已有)
- [ ] 创始人端移动布局:卡片流 + 底部导航
- [x] 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 周 |