Files
Neo-ZQYY/docs/prd/Neo_Specs/review-audit/P9-NS1-12.md
Neo 6f8f12314f 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>
2026-04-06 00:03:48 +08:00

69 lines
2.7 KiB
Markdown
Raw Permalink 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.
# P9→NS1/RNS1 缺失项 #12客户服务记录页的月度统计汇总展示
## 简要结论
- 状态:✅ 已解决
- 风险等级:🟡 低
- 月度统计汇总已完整实现:后端返回 `month_count`/`month_hours`,前端展示为三栏统计条(本月服务次数/服务时长/关系指数),含月份切换器和格式化展示。
## 详细审查
### 审查范围
- `apps/backend/app/schemas/xcx_customers.py``CustomerRecordsResponse` schema
- `apps/backend/app/services/customer_service.py``get_customer_records()` 实现
- `apps/miniprogram/miniprogram/pages/customer-service-records/customer-service-records.wxml` — 月度统计区域
- `apps/miniprogram/miniprogram/pages/customer-service-records/customer-service-records.ts` — 数据处理
### 发现
1. **后端:月度统计数据已实现**
- `CustomerRecordsResponse``month_count: int``month_hours: float`
- `get_customer_records()` 调用 `_get_month_aggregation()` 计算当月汇总(非分页子集)
- 返回 `total_service_count`(跨月累计)
2. **前端:月度统计展示已完整实现**
- 月份切换器(上月/下月箭头 + 月份标签)
- 三栏统计条:
- 本月服务:`monthCount`(如 "3次"
- 服务时长:`monthHours`(如 "12.5h"),蓝色高亮
- 关系指数:`monthRelation`(如 "0.85"),橙色高亮
- 使用 `formatCount()``formatHours()` 格式化函数
- 月份切换时重新请求 API`loadMonthRecords()`
3. **月份切换交互已实现**
- `onPrevMonth()` / `onNextMonth()` 切换月份
- 边界控制:`canPrev`/`canNext` 禁用按钮
- 切换时显示 loading 状态
### 证据
前端月度统计展示:
```html
<view class="month-summary">
<view class="summary-item">
<text class="summary-label">本月服务</text>
<text class="summary-value">{{fmt.safe(monthCount)}}</text>
</view>
<view class="summary-divider"></view>
<view class="summary-item">
<text class="summary-label">服务时长</text>
<text class="summary-value value-primary">{{fmt.safe(monthHours)}}</text>
</view>
<view class="summary-divider"></view>
<view class="summary-item">
<text class="summary-label">关系指数</text>
<text class="summary-value value-warning">{{fmt.safe(monthRelation)}}</text>
</view>
</view>
```
后端月度汇总查询:
```python
month_count, month_hours = _get_month_aggregation(
conn, site_id, customer_id, year, month, table
)
```
### 建议(如未完全解决)
无重大缺失。可考虑的微调:
- `monthRelation`(关系指数)当前前端硬编码为 `'0.85'`,后端 `CustomerRecordsResponse` 中无 `relation_index` 字段返回,需确认数据源