feat: 累积功能变更 — 聊天集成、租户管理、小程序更新、ETL 增强、迁移脚本

包含多个会话的累积代码变更:
- backend: AI 聊天服务、触发器调度、认证增强、WebSocket、调度器最小间隔
- admin-web: ETL 状态页、任务管理、调度配置、登录优化
- miniprogram: 看板页面、聊天集成、UI 组件、导航更新
- etl: DWS 新任务(finance_area_daily/board_cache)、连接器增强
- tenant-admin: 项目初始化
- db: 19 个迁移脚本(etl_feiqiu 11 + zqyy_app 8)
- packages/shared: 枚举和工具函数更新
- tools: 数据库工具、报表生成、健康检查
- docs: PRD/架构/部署/合约文档更新

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Neo
2026-04-06 00:03:48 +08:00
parent 70324d8542
commit 6f8f12314f
515 changed files with 76604 additions and 7456 deletions

View File

@@ -0,0 +1,67 @@
# P9→NS1/RNS1 缺失项 #11助教详情页历史月份统计的图表展示
## 简要结论
- 状态:⚠️ 部分解决
- 风险等级:🟠 中
- 历史月份统计已实现为表格形式6 个月数据,含客户数/回访召回/业绩时长/工资),但非 P9 定义的折线图/柱状图可视化形式。
## 详细审查
### 审查范围
- `apps/backend/app/schemas/xcx_coaches.py``HistoryMonth` schema
- `apps/backend/app/services/coach_service.py``_build_history_months()` 实现
- `apps/miniprogram/miniprogram/pages/coach-detail/coach-detail.wxml` — 历史月份区域
- `apps/miniprogram/miniprogram/pages/coach-detail/coach-detail.ts` — 数据绑定
### 发现
1. **后端:数据已完整实现**
- `HistoryMonth` schema 含:`month``estimated``customers``hours``salary``callback_done``recall_done`
- `_build_history_months()` 查询最近 6 个月数据:
- 工时/工资:`fdw_queries.get_salary_calc_multi_months()`
- 客户数:`fdw_queries.get_monthly_customer_count()`
- 回访/召回完成数:`biz.coach_tasks` 聚合
- 本月标记 `estimated=True`
- 格式化:`"22人"``"87.5h"``"¥6,950"`
2. **前端:表格展示已实现**
- 5 列表格:月份 / 服务客户 / 访/召完成 / 业绩时长 / 工资
- 本月行高亮(`history-row-current`+ "预估"标签
- 本月业绩时长蓝色(`text-primary`)、工资绿色(`text-success`
3. **缺失的图表可视化**
- P9 定义了折线图/柱状图展示趋势,当前仅为纯表格
- 无数据趋势可视化(如工时趋势折线、工资柱状图)
- 小程序环境下图表实现需要 `wx-canvas` 或第三方图表库
### 证据
前端表格展示:
```html
<view class="history-table">
<view class="history-thead">
<text class="history-th history-th-left">月份</text>
<text class="history-th">服务客户</text>
<text class="history-th">访/召完成</text>
<text class="history-th">业绩时长</text>
<text class="history-th">工资</text>
</view>
<view class="history-row {{index === 0 ? 'history-row-current' : ''}}"
wx:for="{{historyMonths}}" wx:key="month">
<view class="history-td history-td-left">
<text>{{item.month}}</text>
<text class="history-est" wx:if="{{item.estimated}}">预估</text>
</view>
<text class="history-td">{{fmt.safe(item.customers)}}</text>
<text class="history-td">{{fmt.safe(item.callbackDone)}} | {{fmt.safe(item.recallDone)}}</text>
<text class="history-td">{{fmt.safe(item.hours)}}</text>
<text class="history-td">{{fmt.safe(item.salary)}}</text>
</view>
</view>
```
### 建议(如未完全解决)
1. **短期**:表格形式已满足数据展示需求,可作为 MVP
2. **中期**在表格上方添加迷你折线图sparkline展示工时/工资趋势
3. **长期**:引入 `wx-charts``echarts-for-weixin` 实现完整图表
4. **注意**:前端 `historyMonths` 当前使用 mock 数据(空字符串),需确认 API 数据已正确绑定