feat: 报销审批流重构与管家计划全链路贯通

- 重构报销状态注册表、审批流路由与平台风险标记
- 完善管家意图规划器与模型计划构建器全链路
- 新增 OCR Worker 脚本、数据库会话管理与通知状态
- 优化文档中心、日志视图、预算中心与员工管理交互
- 增强工作台摘要、图标资源与全局主题样式
- 补充审批路由、状态注册、OCR 服务与管家规划器测试覆盖
This commit is contained in:
caoxiaozhu
2026-06-06 17:19:07 +08:00
parent f60cebadb8
commit e124e4bbcb
162 changed files with 9161 additions and 1941 deletions

View File

@@ -693,6 +693,66 @@ def test_user_agent_application_submit_blocks_duplicate_business_time() -> None:
assert second_response.draft_payload is None
def test_user_agent_application_submit_blocks_overlapping_travel_dates() -> None:
session_factory = build_session_factory()
with session_factory() as db:
existing_claim = ExpenseClaim(
id="application-overlap-1",
claim_no="AP-202606050001-OVERLAP",
employee_name="pytest",
department_name="技术部",
expense_type="travel_application",
reason="支撑国网部署",
location="北京",
amount=Decimal("2700.00"),
currency="CNY",
invoice_count=0,
occurred_at=datetime(2026, 6, 5, tzinfo=UTC),
status="submitted",
approval_stage="直属领导审批",
risk_flags_json=[
{
"source": "application_detail",
"business_stage": "expense_application",
"application_detail": {
"application_type": "差旅费用申请",
"time": "2026-06-05 至 2026-06-07",
"location": "北京",
"reason": "支撑国网部署",
},
}
],
)
db.add(existing_claim)
db.commit()
response = build_application_user_agent_response(
db,
"确认提交",
context_overrides={
"manager_name": "向万红",
"application_preview": {
"fields": {
"applicationType": "差旅费用申请",
"time": "2026-06-06 至 2026-06-08",
"location": "北京",
"reason": "支撑国网仿生产部署",
"days": "3天",
"transportMode": "火车",
"amount": "2700元",
}
},
},
)
claims = db.query(ExpenseClaim).filter(ExpenseClaim.claim_no.like("AP-%")).all()
assert len(claims) == 1
assert "已存在申请单" in response.answer
assert "系统没有重复创建" in response.answer
assert existing_claim.claim_no in response.answer
assert response.draft_payload is None
def test_user_agent_application_edit_resubmits_returned_application_claim() -> None:
session_factory = build_session_factory()
with session_factory() as db: