51feae55ba
- 后端:FastAPI + SQLAlchemy + Alembic,7 张核心表迁移成功 - 前端:Next.js 16 + TailwindCSS 4 + 三端布局(投资人/创始人/Admin) - 数据库:PostgreSQL 16,7 张核心实体表(tenants/users/companies/monthly_reports/health_scores/risk_events/audit_logs) - Docker:docker-compose.yml + 前后端 Dockerfile - 测试:健康检查 4 个测试全部 GREEN - 文档:README/run.md/AGENTS.md/docs 体系完整
148 lines
6.4 KiB
Markdown
148 lines
6.4 KiB
Markdown
# 任务清单 (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`
|
||
- [ ] `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 1:MVP 核心功能
|
||
|
||
### T1.1 认证与权限
|
||
- [ ] `backend/app/models/user.py`(User + Role + Tenant)
|
||
- [ ] `backend/app/routers/auth.py`(登录 / 注册 / refresh token)
|
||
- [ ] `backend/app/core/security.py`(JWT + 密码哈希)
|
||
- [ ] `backend/app/core/permissions.py`(角色级 + 字段级权限中间件)
|
||
- [ ] `backend/tests/test_auth.py`(RED)
|
||
- [ ] `frontend/src/app/login/page.tsx`
|
||
- [ ] `frontend/src/lib/auth.ts`(token 管理 + 自动刷新)
|
||
- 验证:登录 → 获取 token → 访问受保护 API
|
||
|
||
### T1.2 企业档案管理
|
||
- [ ] `backend/app/models/company.py`(CompanyProfile)
|
||
- [ ] `backend/app/routers/companies.py`(CRUD + 筛选)
|
||
- [ ] `backend/app/schemas/company.py`(Pydantic schema)
|
||
- [ ] `backend/tests/test_companies.py`(RED)
|
||
- [ ] `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.py`(MonthlyReport + ReportItem)
|
||
- [ ] `backend/app/routers/reports.py`(提交 / 查看 / AI 解析)
|
||
- [ ] `backend/app/services/ai_parser.py`(月报 AI 解析服务)
|
||
- [ ] `backend/app/schemas/report.py`
|
||
- [ ] `backend/tests/test_reports.py`(RED)
|
||
- [ ] `frontend/src/app/(founder)/reports/submit/page.tsx`(创始人提交月报)
|
||
- [ ] `frontend/src/app/(investor)/reports/page.tsx`(投资人查看月报)
|
||
- 验证:创始人提交月报 → AI 解析 → 投资人查看摘要
|
||
|
||
### T1.4 健康度评分
|
||
- [ ] `backend/app/models/health_score.py`(HealthScore + ScoreItem)
|
||
- [ ] `backend/app/services/health_calculator.py`(财务 + 经营 + AI+ 专项)
|
||
- [ ] `backend/app/routers/health.py`(查询 / 重算)
|
||
- [ ] `backend/tests/test_health.py`(RED)
|
||
- [ ] `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.py`(RED)
|
||
- [ ] `frontend/src/app/(investor)/page.tsx`(驾驶舱首页)
|
||
- [ ] `frontend/src/components/dashboard/HealthDistribution.tsx`
|
||
- [ ] `frontend/src/components/dashboard/RiskSummary.tsx`
|
||
- [ ] `frontend/src/components/dashboard/AIWeeklyBrief.tsx`
|
||
- 验证:登录后看到驾驶舱,数据来自后端
|
||
|
||
### T1.6 风险预警
|
||
- [ ] `backend/app/models/risk.py`(RiskEvent + Evidence)
|
||
- [ ] `backend/app/services/risk_engine.py`(指标越界检测引擎)
|
||
- [ ] `backend/app/routers/risks.py`(列表 / 处理 / 关闭)
|
||
- [ ] `backend/tests/test_risks.py`(RED)
|
||
- [ ] `frontend/src/app/(investor)/risks/page.tsx`(风险工作台)
|
||
- [ ] `frontend/src/components/risk/RiskCard.tsx` + `RiskTimeline.tsx`
|
||
- 验证:指标越界 → 自动生成风险 → 工作台展示 → 处理闭环
|
||
|
||
### T1.7 投后报告
|
||
- [ ] `backend/app/services/report_generator.py`(AI 报告生成)
|
||
- [ ] `backend/app/routers/reports_export.py`(PDF 导出)
|
||
- [ ] `backend/tests/test_report_export.py`(RED)
|
||
- [ ] `frontend/src/app/(investor)/reports/view/[id]/page.tsx`
|
||
- 验证:选择企业 → 生成报告 → 导出 PDF
|
||
|
||
### T1.8 移动端适配
|
||
- [ ] 投资人端响应式:< md Sidebar 折叠为抽屉
|
||
- [ ] 创始人端移动布局:卡片流 + 底部导航
|
||
- [ ] AI Copilot 浮动对话窗口(底部抽屉式)
|
||
- [ ] 风险预警 toast 推送
|
||
- 验证:Chrome DevTools 移动端模拟,三端布局正常
|
||
|
||
---
|
||
|
||
## 依赖关系
|
||
|
||
```
|
||
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.5(DB 依赖 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 周 |
|