feat(server): 报销单输出工号/邮箱并扩展申请人邮箱前缀匹配

- ExpenseClaimRead 新增 employee_no/employee_email 字段,ExpenseClaim 模型补对应只读属性
- expense_claim_access_policy 在姓名匹配未果时,按 candidate@% 邮箱前缀匹配 Employee.email,命中唯一记录即返回
- test_backend_pagination/test_expense_claim_service 补充工号/邮箱字段断言与邮箱前缀匹配用例
- 更新公司通信费报销规则表
This commit is contained in:
caoxiaozhu
2026-06-22 15:55:48 +08:00
parent 1b04ee1c4c
commit aa965da69d
6 changed files with 70 additions and 0 deletions

View File

@@ -509,6 +509,20 @@ class ExpenseClaimAccessPolicy:
if employee is not None:
return employee
for candidate in normalized_candidates:
if self.is_email_like(candidate):
continue
matches = list(
self.db.scalars(
select(Employee)
.options(*load_options)
.where(func.lower(Employee.email).like(f"{candidate.lower()}@%"))
.limit(2)
).all()
)
if len(matches) == 1:
return matches[0]
for candidate in normalized_candidates:
matches = list(
self.db.scalars(