feat: 数字员工财务报告体系与定时提醒及看板快照调度
- 新增数字员工财务报告生成、邮件投递与渲染调度器 - 引入员工画像扫描调度与定时提醒任务 - 完善财务看板快照、排行口径与部门人员占比计算 - 优化数字员工工作看板仪表盘与技能目录 - 增强前端总览页图表、工作台摘要与顶部导航栏交互 - 新增差旅申请规划推动提醒与报销创建会话状态管理 - 补充财务报告、看板调度、数字员工工作记录测试覆盖
This commit is contained in:
@@ -157,3 +157,92 @@ def test_digital_employee_dashboard_keeps_empty_payload_without_fake_data() -> N
|
||||
assert dashboard.totals["totalRuns"] == 0
|
||||
assert dashboard.daily_work
|
||||
assert dashboard.task_distribution == []
|
||||
|
||||
|
||||
def test_digital_employee_dashboard_counts_finance_dashboard_snapshots() -> None:
|
||||
now = datetime.now(UTC)
|
||||
|
||||
with build_session() as db:
|
||||
db.add(
|
||||
AgentRun(
|
||||
run_id="run-finance-snapshot-001",
|
||||
agent="hermes",
|
||||
source="schedule",
|
||||
user_id="digital_employee",
|
||||
status="succeeded",
|
||||
route_json={"task_type": "finance_dashboard_snapshot"},
|
||||
result_summary="finance dashboard snapshot generated",
|
||||
started_at=now - timedelta(minutes=3),
|
||||
finished_at=now - timedelta(minutes=2),
|
||||
tool_calls=[
|
||||
AgentToolCall(
|
||||
run_id="run-finance-snapshot-001",
|
||||
tool_type="database",
|
||||
tool_name="digital_employee.finance_dashboard.snapshot",
|
||||
request_json={"task_type": "finance_dashboard_snapshot"},
|
||||
response_json={
|
||||
"summary": {
|
||||
"finance_snapshot_count": 1,
|
||||
"reimbursement_count": 534,
|
||||
}
|
||||
},
|
||||
status="succeeded",
|
||||
duration_ms=1200,
|
||||
created_at=now - timedelta(minutes=3),
|
||||
)
|
||||
],
|
||||
)
|
||||
)
|
||||
db.commit()
|
||||
|
||||
dashboard = DigitalEmployeeDashboardService(db).build_dashboard(days=7)
|
||||
|
||||
assert dashboard.totals["financeDashboardSnapshots"] == 1
|
||||
assert dashboard.totals["businessOutputs"] == 1
|
||||
assert dashboard.daily_work[-1]["financeDashboardSnapshots"] == 1
|
||||
assert dashboard.task_distribution[0]["taskType"] == "finance_dashboard_snapshot"
|
||||
|
||||
|
||||
def test_digital_employee_dashboard_counts_reminder_outputs() -> None:
|
||||
now = datetime.now(UTC)
|
||||
|
||||
with build_session() as db:
|
||||
db.add(
|
||||
AgentRun(
|
||||
run_id="run-reminder-scan-001",
|
||||
agent="hermes",
|
||||
source="schedule",
|
||||
user_id="digital_employee",
|
||||
status="succeeded",
|
||||
route_json={"task_type": "digital_employee_reminder_scan"},
|
||||
result_summary="reminder scan generated",
|
||||
started_at=now - timedelta(minutes=3),
|
||||
finished_at=now - timedelta(minutes=2),
|
||||
tool_calls=[
|
||||
AgentToolCall(
|
||||
run_id="run-reminder-scan-001",
|
||||
tool_type="database",
|
||||
tool_name="digital_employee.reminder.scan",
|
||||
request_json={"task_type": "digital_employee_reminder_scan"},
|
||||
response_json={
|
||||
"summary": {
|
||||
"recipient_count": 3,
|
||||
"reminder_count": 8,
|
||||
"approval_pending_count": 2,
|
||||
}
|
||||
},
|
||||
status="succeeded",
|
||||
duration_ms=900,
|
||||
created_at=now - timedelta(minutes=3),
|
||||
)
|
||||
],
|
||||
)
|
||||
)
|
||||
db.commit()
|
||||
|
||||
dashboard = DigitalEmployeeDashboardService(db).build_dashboard(days=7)
|
||||
|
||||
assert dashboard.totals["reminders"] == 8
|
||||
assert dashboard.totals["businessOutputs"] == 8
|
||||
assert dashboard.daily_work[-1]["reminders"] == 8
|
||||
assert dashboard.task_distribution[0]["taskType"] == "digital_employee_reminder_scan"
|
||||
|
||||
Reference in New Issue
Block a user