包含多个会话的累积代码变更: - 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>
74 lines
3.8 KiB
Markdown
74 lines
3.8 KiB
Markdown
# P7→NS1/RNS1 缺失项 #3:定档折算惩罚的展示格式
|
||
|
||
## 简要结论
|
||
- 状态:⚠️ 部分解决
|
||
- 风险等级:🟠 中
|
||
- 后端已返回 `service_hours`(折算后)和 `service_hours_raw`(折算前)两个字段,前端 performance-records 页面已实现折前/折后对比展示,DISPLAY-STANDARDS.md 已定义课时展示规范。但 P7 AC6 要求的"120分钟(定档折算30分钟)"格式未被采用,实际使用的是"2.0h(折后 2.5h)"格式,且 performance 概览页未展示折算信息。
|
||
|
||
## 详细审查
|
||
|
||
### 审查范围
|
||
- `apps/backend/app/services/performance_service.py` — `compute_summary()` 和 `group_records_by_date()`
|
||
- `apps/backend/app/schemas/xcx_performance.py` — `RecordsSummary` 中的 `total_hours_raw`
|
||
- `apps/miniprogram/miniprogram/pages/performance-records/performance-records.wxml` — 折算展示
|
||
- `docs/miniprogram-dev/design-system/DISPLAY-STANDARDS.md` — §2 课时展示规范
|
||
|
||
### 发现
|
||
|
||
1. **后端数据已完整**:
|
||
- `fdw_queries.get_service_records()` 返回 `service_hours`(`income_seconds / 3600.0`)和 `service_hours_raw`(`real_use_seconds / 3600.0`)
|
||
- `compute_summary()` 计算 `total_hours` 和 `total_hours_raw`
|
||
- `RecordsSummary` schema 包含 `total_hours: float` 和 `total_hours_raw: float`
|
||
|
||
2. **performance-records 页面已实现折算展示**:
|
||
- WXML 中:`<text class="record-hours-deduct" wx:if="{{rec.hoursRaw && rec.hoursRaw !== rec.hours}}">折前 {{fmt.hours(rec.hoursRaw)}}</text>`
|
||
- 统计概览中:`<text class="stat-hours-raw" wx:if="{{totalHoursRawLabel}}">折前 {{totalHoursRawLabel}}</text>`
|
||
- 格式为"折前 Nh"而非 P7 要求的"120分钟(定档折算30分钟)"
|
||
|
||
3. **DISPLAY-STANDARDS.md 已定义规范**:
|
||
- §2.1 规则总表:`带折算备注 | 实际h(折后 原始h) | 2.0h(折后 2.5h)`
|
||
- §2.3 折算标注字段约定:`hours`(折算后)、`hoursRaw`(折算前),仅当两者不同时展示括号备注
|
||
|
||
4. **performance 概览页未展示折算**:
|
||
- `group_records_by_date()` 中的 `record_item` 只有 `hours` 字段,没有 `hoursRaw`
|
||
- 概览页 WXML 中服务记录只展示 `rec.hours`,无折算信息
|
||
|
||
5. **格式差异**:
|
||
- P7 AC6 要求:"120分钟(定档折算30分钟)"(分钟单位,括号内说明折算量)
|
||
- 实际实现:"2.0h(折后 2.5h)"(小时单位,括号内展示折前原始值)
|
||
- performance-records 实际使用:"折前 2.5h"(无括号,前缀"折前")
|
||
|
||
### 证据
|
||
|
||
```python
|
||
# performance_service.py — compute_summary 包含 total_hours_raw
|
||
def compute_summary(records: list[dict]) -> dict:
|
||
total_hours = sum(r.get("service_hours", 0.0) for r in records)
|
||
total_hours_raw = sum(r.get("service_hours_raw", 0.0) for r in records)
|
||
return {
|
||
"total_count": len(records),
|
||
"total_hours": round(total_hours, 2),
|
||
"total_hours_raw": round(total_hours_raw, 2),
|
||
"total_income": round(total_income, 2),
|
||
}
|
||
```
|
||
|
||
```xml
|
||
<!-- performance-records.wxml — 折算展示 -->
|
||
<text class="record-hours">{{fmt.hours(rec.hours)}}</text>
|
||
<text class="record-hours-deduct"
|
||
wx:if="{{rec.hoursRaw && rec.hoursRaw !== rec.hours}}">
|
||
折前 {{fmt.hours(rec.hoursRaw)}}
|
||
</text>
|
||
```
|
||
|
||
```markdown
|
||
<!-- DISPLAY-STANDARDS.md §2.1 -->
|
||
| 带折算备注 | `实际h(折后 原始h)` | `2.0h(折后 2.5h)` |
|
||
```
|
||
|
||
### 建议
|
||
1. **统一展示格式**:当前 performance-records 页面使用"折前 Xh"格式,与 DISPLAY-STANDARDS.md 定义的"实际h(折后 原始h)"格式不一致,需统一
|
||
2. **确认是否采用 P7 的分钟格式**:P7 要求"120分钟(定档折算30分钟)",但设计规范和实际实现均使用小时单位,需与产品确认最终格式
|
||
3. **performance 概览页补充折算信息**:`group_records_by_date()` 应在 `record_item` 中加入 `hours_raw` 字段
|