feat(backend): 产品列表返回当前人滞留时长 active_duration_hours

- ProductResponse 增加 active_duration_hours(小时) 字段
- get_all_products 批量计算每个产品活跃任务(WIP/PENDING)最早接手时间到现在的时长
- 复用 get_people_workload 相同的北京时间口径,前端无需额外请求
This commit is contained in:
2026-08-28 10:46:10 +08:00
parent 620df5ce11
commit 90d615cbb0
2 changed files with 31 additions and 0 deletions

View File

@ -61,6 +61,8 @@ class ProductResponse(BaseModel):
latest_record_has_images: bool = False
latest_record_assignee_id: str | None = None # 🔧 最新记录操作人(消除并发张冠李戴)
latest_record_assignee_name: str | None = None
# 🔧 当前人滞留时长 — 活跃任务(WIP/PENDING)最早接手时间到现在的时长(小时)
active_duration_hours: float | None = None
model_config = {"from_attributes": True}