Files
Neo-ZQYY/docs/audit/changes/2026-03-24__perf-page-data-fix.md
Neo 14a12342b5 chore(audit): 补追 96 份未入仓审计孤本 — 覆盖 2026-02-26 ~ 2026-04-08
这些审计记录原本堆积在 docs/audit/changes/changes/ 嵌套误产物目录下(由开发机迁移
79d3c2e 前后的不明批量操作产生)。由于同期 .gitignore 屏蔽了 docs/audit/ 全目录,
它们从未入过 git 任何分支 history。删除即永久丢失。

按 docs/specs/audit-gap-recovery/tasks.md 阶段 1 执行,将全部 96 份 D 类孤本
(主目录无同名、git history 亦无记录)复制到 docs/audit/changes/ 主目录入仓。

涵盖主题: P1-P18 全栈集成 / 多模块累积变更 / ETL bug 修复 / 业务日切 /
   召回与任务引擎改造 / 租户管理与审批 / 董事会财务 / 客户与助教详情 /
   DDL 基线合并 / Kiro 到 Claude Code 迁移

阶段 2(B 类内容漂移 1 份)和阶段 4(嵌套目录删除)独立推进。

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-20 06:35:42 +08:00

56 lines
3.9 KiB
Markdown
Raw 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.
# 变更审计记录:绩效页数据正确性修复
| 字段 | 值 |
|------|-----|
| 日期 | 2026-03-24 18:19:34 |
| Prompt-ID | P20260324-180413 |
| Session-ID | 02057e57 |
| Session 路径 | docs/audit/session_logs/2026-03/24/56_df6dc5a7_123842 |
## 操作摘要
修复绩效页PERF-1多个字段数据不正确的问题当前档位费率显示客户收费标准而非助教到手单价、下一阶段费率/小时数/奖金全为 0、收入明细缺少激励课和 Top3 销冠奖项。涉及 `fdw_queries.py` SQL 查询扩展和 `performance_service.py` 业务逻辑重写。
## 变更文件
| 文件 | 变更类型 |
|------|----------|
| `apps/backend/app/services/fdw_queries.py` | 修改 |
| `apps/backend/app/services/performance_service.py` | 修改 |
## 本次对话文件变更
### 新增文件
- `docs/audit/prompt_logs/prompt_log_20260324_180413.md`
- `docs/audit/session_logs/2026-03/24/56_df6dc5a7_123842/main_01_02057e57.md`
- `docs/audit/session_logs/2026-03/24/56_df6dc5a7_123842/sub_01_02057e57.md`
- `docs/audit/session_logs/2026-03/24/57_5d61a787_175819/main_01_b8040cd9.md`
- `docs/audit/session_logs/2026-03/24/57_5d61a787_175819/sub_01_02057e57.md`
## 改动注解
### `apps/backend/app/services/fdw_queries.py`
- 变更类型:修改
- 原始原因绩效页收入明细需要奖金拆分top_rank_bonus、recharge_commission、other_bonus和当前档位抽成参数base_deduction、bonus_deduction_ratio`get_salary_calc()` 未查询这些字段
- 思路分析:在 `get_salary_calc()` 的 SQL SELECT 中追加 5 个字段top_rank_bonus、recharge_commission、other_bonus、base_deduction、bonus_deduction_ratio均来自 `app.v_dws_assistant_salary_calc` 视图已有列。返回 dict 增加对应键值,保持与现有字段相同的 float 转换 + None 默认值模式
- 修改结果:`performance_service.py` 可获取奖金拆分数据和抽成参数,用于计算助教到手单价和收入明细展示。影响范围:仅 `get_salary_calc()` 的调用方(`performance_service.get_overview()``task_manager`
### `apps/backend/app/services/performance_service.py`
- 变更类型:修改
- 原始原因:绩效页 6 个数据错误——(1) currentTier 费率显示客户收费标准而非助教到手单价 (2) nextTier 费率全为 0 (3) upgradeHoursNeeded 为 0 (4) upgradeBonus 为 0 (5) 收入明细只显示有数据项,缺少激励课和 Top3 销冠奖 (6) total_bonus=600 未在明细中展示
- 思路分析:
- **到手单价计算**:基础课到手 = 客户价 - base_deduction球房提成固定额激励课到手 = 客户价 × (1 - bonus_deduction_ratio)(球房提成比例)。从 `get_salary_calc()` 新增的 base_deduction/bonus_deduction_ratio 字段获取
- **档位进度**:新增调用 `fdw_queries.get_performance_tiers()` 读取 `cfg_performance_tier` 配置表,遍历找到当前档和下一档,计算 upgradeHoursNeeded = next_tier.min_hours - total_hoursupgradeBonus = 升档后抽成降低的节省额。逻辑复用自 `task_manager._build_performance_summary`
- **收入明细**`_build_income_items()` 改为始终显示 3 项基础课、激励课、Top3 销冠奖),即使金额为 0。Top3 销冠奖为 0 时 desc 显示"继续努力"。新增 top_rank_bonus 参数
- 修改结果绩效页所有字段数据正确——currentTier basicRate=80/incentiveRate=95nextTier basicRate=90/incentiveRate=114upgradeHoursNeeded=12.91upgradeBonus=1200incomeItems 含 3 项基础课¥8,567.20 + 激励课¥0.00 + Top3 销冠奖¥600.00)。影响范围:仅 PERF-1 概览接口 `GET /api/xcx/performance`
## 合规检查
| 检查项 | 状态 |
|--------|------|
| 新增迁移 SQL | 无 |
| DDL 基线更新 | 不适用 |
| OpenAPI Spec 同步 | 不适用(接口签名未变,仅响应数据值修正) |
| BD 手册更新 | 不适用(未新增表/字段) |
| 文档同步 | ✅ 已更新 AI_CHANGELOG |