feat: 本体字段治理与风险规则模板执行器重构
- 新增本体字段注册表与字段治理审计脚本 - 重构风险规则模板执行器、DSL 验证与清单分类器 - 完善票据夹服务与差旅请求详情页交互 - 优化趋势图表与总览页数据展示 - 增强报销平台风险分级与模拟公司筛选 - 补充本体字段、风险规则生成与票据夹服务测试覆盖
This commit is contained in:
@@ -74,6 +74,58 @@ test('claim mapper falls back to employee name for legacy profile lookup', () =>
|
||||
assert.equal(request.profileEmployeeId, 'Legacy Alice')
|
||||
})
|
||||
|
||||
test('claim mapper keeps low reimbursement risk as low risk instead of medium', () => {
|
||||
const riskMessage = '票据商品或服务描述较笼统,建议审批人核对真实用途和明细清单。'
|
||||
const request = mapExpenseClaimToRequest({
|
||||
id: 'claim-low-risk-1',
|
||||
claim_no: 'RE-LOW-RISK-1',
|
||||
employee_name: 'Alice',
|
||||
department_name: 'Finance',
|
||||
expense_type: 'travel',
|
||||
reason: 'Trip',
|
||||
location: 'Shanghai',
|
||||
amount: 354,
|
||||
invoice_count: 1,
|
||||
occurred_at: '2026-02-20T00:00:00.000Z',
|
||||
created_at: '2026-06-03T04:22:16.000Z',
|
||||
updated_at: '2026-06-03T04:25:48.000Z',
|
||||
status: 'draft',
|
||||
approval_stage: WAIT_SUBMIT,
|
||||
risk_flags_json: [
|
||||
{
|
||||
source: 'submission_review',
|
||||
hit_source: 'rule_center',
|
||||
severity: 'low',
|
||||
action: 'warning',
|
||||
label: '差旅票据服务内容笼统低风险',
|
||||
message: riskMessage,
|
||||
risk_domain: 'invoice',
|
||||
visibility_scope: 'submitter',
|
||||
actionability: 'fixable_by_submitter',
|
||||
business_stage: 'reimbursement'
|
||||
}
|
||||
],
|
||||
items: [
|
||||
{
|
||||
id: 'item-low-risk-train',
|
||||
item_date: '2026-02-20',
|
||||
item_type: 'train_ticket',
|
||||
item_reason: '武汉-上海',
|
||||
item_location: '',
|
||||
item_amount: 354,
|
||||
invoice_id: 'claim-low-risk-1/item-low-risk-train/train.pdf'
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
assert.equal(request.riskTone, 'low')
|
||||
assert.equal(request.riskLabel, '低风险')
|
||||
assert.equal(request.riskSummary, riskMessage)
|
||||
assert.equal(request.expenseItems[0].riskTone, 'low')
|
||||
assert.equal(request.expenseItems[0].riskLabel, '低风险')
|
||||
assert.equal(request.expenseItems[0].riskText, riskMessage)
|
||||
})
|
||||
|
||||
test('application claims are mapped as application documents', () => {
|
||||
const request = mapExpenseClaimToRequest({
|
||||
id: 'claim-application-1',
|
||||
|
||||
Reference in New Issue
Block a user