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,73 @@
# P9→NS1/RNS1 缺失项 #4备注 AI 评分的星级展示规范
## 简要结论
- 状态:⚠️ 部分解决
- 风险等级:🟠 中
- `star-rating` 组件已实现0-10 分→0-5 星,支持半星),设计规范文档已定义评分展示规范,但客户详情页备注区域未使用该组件,后端备注 API 未返回 `ai_score` 字段。
## 详细审查
### 审查范围
- `apps/miniprogram/miniprogram/components/star-rating/` — 星级评分组件
- `apps/backend/app/services/customer_service.py``_build_notes()` 实现
- `apps/backend/app/schemas/xcx_customers.py``CustomerNote` schema
- `apps/miniprogram/miniprogram/pages/customer-detail/customer-detail.wxml` — 备注区域
- `docs/miniprogram-dev/design-system/DISPLAY-STANDARDS-2.md` — 评分展示规范
### 发现
1. **组件层star-rating 已完整实现**
- 接收 `score`0-10内部转换为 0-5 星,支持半星
- 使用 TDesign `t-rate` 组件渲染,金黄色(`#fbbf24`
- 支持只读模式
2. **设计规范:评分展示规范已定义**
- `DISPLAY-STANDARDS-2.md` 第 8 节定义了:
- 分制约定(后端 0-10 分UI 0-5 星)
- 展示场景(任务卡片、备注满意度等)
- 半星映射规则(`scoreToHalfStar()`
- 未评分态处理(`score=0/null/undefined` → 展示 `--`
3. **后端:备注 API 未返回 ai_score**
- `_build_notes()` 查询 `biz.notes` 表,只返回 `id``tag_label``created_at``content`
- `CustomerNote` schema 无 `ai_score` / `score` 字段
- 数据库 `biz.notes` 表是否有 `ai_score` 列未确认
4. **前端:备注区域未使用 star-rating 组件**
- `customer-detail.wxml` 备注列表只展示 `tagLabel``createdAt``content`
-`<star-rating>` 组件引用
- `customer-detail.json` 未注册 `star-rating` 组件(需确认)
### 证据
后端 `_build_notes()` 无 score 字段:
```python
return [
{
"id": r[0],
"tag_label": r[1] or "",
"created_at": r[2].isoformat() if r[2] else "",
"content": r[3] or "",
# 缺少 ai_score / score 字段
}
for r in rows
]
```
前端备注展示无星级:
```html
<view class="note-item" wx:for="{{sortedNotes}}" wx:key="id">
<view class="note-top">
<text class="note-author">{{item.tagLabel}}</text>
<text class="note-time">{{item.createdAt}}</text>
</view>
<text class="note-content">{{item.content}}</text>
<!-- 缺少 <star-rating score="{{item.score}}" /> -->
</view>
```
### 建议(如未完全解决)
1. **后端**`_build_notes()` 查询中增加 `ai_score` 字段(如 `biz.notes` 表有该列)
2. **Schema**`CustomerNote` 添加 `score: int | None = None`
3. **前端**:备注卡片中添加 `<star-rating score="{{item.score}}" size="32rpx" />`,未评分时展示 `--`
4. **tooltip**P9 定义的评分说明 tooltip 需额外实现(小程序原生不支持 tooltip可用长按弹窗替代