feat(backend): 新增 /dashboard/user-operations 人员操作统计接口

- add_task_record 补 action_type=record 日志,使上传备注可统计到人
- get_user_operations 按人聚合 接收(receive)/转交(complete)/上传备注(record) 次数,时间筛选,中文名映射
- 复用 get_display_names,不新增数据库字段
This commit is contained in:
2026-08-28 13:14:09 +08:00
parent dd14185ab4
commit b85188e625
3 changed files with 94 additions and 0 deletions

View File

@ -1049,6 +1049,16 @@ async def add_task_record(
db.add(record)
await db.flush()
# 🔧 操作日志:记录一次「上传备注」操作(供人员操作统计)
if current_user:
from app.models.task_log import TaskLog
db.add(TaskLog(
task_id=task_id,
operator_id=current_user.get("username") or current_user.get("sub") or "",
action_type="record",
remark=f"上传备注: {(data.remark or '')[:100]}",
))
# 🚀 留言通知:给任务当前负责人发送提醒(不给自己发)
if (
current_user