feat: 新增风险图谱算法与系统仪表盘及操作反馈体系
后端新增风险图谱算法模块、风险观察与反馈服务、规则 DSL 校验器和可解释性引擎,完善系统仪表盘和财务仪表盘统计, 优化 agent 运行和编排执行链路,清理旧开发文档,前端新增 系统趋势、负载热力图等多种仪表盘图表组件,完善操作反馈 对话框和工作台日期选择器,优化报销创建和审批详情交互, 补充单元测试覆盖。
This commit is contained in:
@@ -0,0 +1,203 @@
|
||||
{
|
||||
"schema_version": "2.0",
|
||||
"rule_code": "risk.application.marketing_without_campaign",
|
||||
"name": "市场推广费无活动申请",
|
||||
"description": "市场活动、投放、展会等推广费用,缺少已审批的活动申请或投放方案。",
|
||||
"enabled": true,
|
||||
"requires_attachment": false,
|
||||
"risk_dimension": "expense_control_demo",
|
||||
"risk_category": "申请前置",
|
||||
"ontology_signal": "application_required",
|
||||
"evaluator": "template_rule",
|
||||
"template_key": "keyword_match_v1",
|
||||
"finance_rule_code": "expense.application.policy",
|
||||
"finance_rule_sheet": "费用申请前置规则",
|
||||
"business_stage": [
|
||||
"reimbursement"
|
||||
],
|
||||
"expense_types": [
|
||||
"marketing"
|
||||
],
|
||||
"budget_required": true,
|
||||
"applies_to": {
|
||||
"domains": [
|
||||
"expense"
|
||||
],
|
||||
"expense_types": [
|
||||
"marketing"
|
||||
],
|
||||
"business_stages": [
|
||||
"reimbursement"
|
||||
]
|
||||
},
|
||||
"inputs": {
|
||||
"fields": [
|
||||
{
|
||||
"key": "claim.amount",
|
||||
"label": "报销金额",
|
||||
"type": "number",
|
||||
"source": "claim"
|
||||
},
|
||||
{
|
||||
"key": "claim.expense_type",
|
||||
"label": "费用类型",
|
||||
"type": "enum",
|
||||
"source": "claim"
|
||||
},
|
||||
{
|
||||
"key": "application.id",
|
||||
"label": "申请单",
|
||||
"type": "text",
|
||||
"source": "application"
|
||||
},
|
||||
{
|
||||
"key": "material.plan_uploaded",
|
||||
"label": "方案已上传",
|
||||
"type": "boolean",
|
||||
"source": "material"
|
||||
}
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"template_key": "keyword_match_v1",
|
||||
"field_keys": [
|
||||
"claim.amount",
|
||||
"claim.expense_type",
|
||||
"claim.department_name",
|
||||
"claim.reason",
|
||||
"item.item_reason",
|
||||
"application.id",
|
||||
"application.status",
|
||||
"application.approved_amount",
|
||||
"application.expense_type",
|
||||
"application.department_name",
|
||||
"material.plan_uploaded"
|
||||
],
|
||||
"search_fields": [
|
||||
"claim.reason",
|
||||
"item.item_reason",
|
||||
"claim.expense_type"
|
||||
],
|
||||
"keywords": [
|
||||
"市场推广",
|
||||
"活动申请",
|
||||
"投放方案"
|
||||
],
|
||||
"condition_summary": "市场推广费报销缺少活动申请或方案时触发。",
|
||||
"finance_rule_code": "expense.application.policy",
|
||||
"finance_rule_sheet": "费用申请前置规则",
|
||||
"business_stage": [
|
||||
"reimbursement"
|
||||
],
|
||||
"expense_types": [
|
||||
"marketing"
|
||||
],
|
||||
"budget_required": true
|
||||
},
|
||||
"outcomes": {
|
||||
"pass": {
|
||||
"severity": "none",
|
||||
"action": "continue"
|
||||
},
|
||||
"fail": {
|
||||
"severity": "medium",
|
||||
"action": "manual_review",
|
||||
"risk_score": 50
|
||||
}
|
||||
},
|
||||
"metadata": {
|
||||
"owner": "风控与审计部",
|
||||
"stability": "platform",
|
||||
"source_ref": "费用管控 Demo 风险规则库",
|
||||
"created_at": "2026-05-30T00:00:00Z",
|
||||
"created_by": "system",
|
||||
"risk_score": 50,
|
||||
"risk_level": "medium",
|
||||
"rule_title": "市场推广费无活动申请",
|
||||
"finance_rule_code": "expense.application.policy",
|
||||
"finance_rule_sheet": "费用申请前置规则",
|
||||
"business_stage": [
|
||||
"reimbursement"
|
||||
],
|
||||
"expense_types": [
|
||||
"marketing"
|
||||
],
|
||||
"budget_required": true,
|
||||
"risk_level_label": "中风险",
|
||||
"risk_score_model": "risk_score_v3",
|
||||
"risk_score_detail": {
|
||||
"score": 50,
|
||||
"level": "medium",
|
||||
"level_label": "中风险",
|
||||
"model": "risk_score_v3",
|
||||
"weights": {
|
||||
"impact": 0.35,
|
||||
"certainty": 0.25,
|
||||
"evidence": 0.15,
|
||||
"exception": 0.1,
|
||||
"action": 0.1,
|
||||
"sensitivity": 0.05
|
||||
},
|
||||
"components": {
|
||||
"impact": 48,
|
||||
"certainty": 58,
|
||||
"evidence": 62,
|
||||
"exception": 35,
|
||||
"action": 35,
|
||||
"sensitivity": 45
|
||||
},
|
||||
"calibration": {
|
||||
"raw_score": 50,
|
||||
"rules": []
|
||||
},
|
||||
"ai_evidence": {},
|
||||
"basis": {
|
||||
"template_key": "keyword_match_v1",
|
||||
"field_count": 11,
|
||||
"condition_count": 0,
|
||||
"expense_category": null,
|
||||
"expense_category_label": "申请前置",
|
||||
"requires_attachment": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"severity": "medium",
|
||||
"risk_score": 50,
|
||||
"risk_level": "medium",
|
||||
"risk_level_label": "中风险",
|
||||
"risk_score_detail": {
|
||||
"score": 50,
|
||||
"level": "medium",
|
||||
"level_label": "中风险",
|
||||
"model": "risk_score_v3",
|
||||
"weights": {
|
||||
"impact": 0.35,
|
||||
"certainty": 0.25,
|
||||
"evidence": 0.15,
|
||||
"exception": 0.1,
|
||||
"action": 0.1,
|
||||
"sensitivity": 0.05
|
||||
},
|
||||
"components": {
|
||||
"impact": 48,
|
||||
"certainty": 58,
|
||||
"evidence": 62,
|
||||
"exception": 35,
|
||||
"action": 35,
|
||||
"sensitivity": 45
|
||||
},
|
||||
"calibration": {
|
||||
"raw_score": 50,
|
||||
"rules": []
|
||||
},
|
||||
"ai_evidence": {},
|
||||
"basis": {
|
||||
"template_key": "keyword_match_v1",
|
||||
"field_count": 11,
|
||||
"condition_count": 0,
|
||||
"expense_category": null,
|
||||
"expense_category_label": "申请前置",
|
||||
"requires_attachment": false
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
{
|
||||
"schema_version": "2.0",
|
||||
"rule_code": "risk.budget.available_balance_insufficient",
|
||||
"name": "预算可用余额不足",
|
||||
"description": "提交后预算余额为负,或当前可用预算不足以覆盖本次申请/报销金额。",
|
||||
"enabled": true,
|
||||
"requires_attachment": false,
|
||||
"risk_dimension": "expense_control_demo",
|
||||
"risk_category": "预算管控",
|
||||
"ontology_signal": "budget_over_limit",
|
||||
"evaluator": "template_rule",
|
||||
"template_key": "keyword_match_v1",
|
||||
"finance_rule_code": "budget.execution.policy",
|
||||
"finance_rule_sheet": "预算执行规则",
|
||||
"business_stage": [
|
||||
"expense_application",
|
||||
"reimbursement",
|
||||
"budget_execution"
|
||||
],
|
||||
"expense_types": [
|
||||
"travel",
|
||||
"hotel",
|
||||
"transport",
|
||||
"meal",
|
||||
"meeting",
|
||||
"marketing",
|
||||
"office",
|
||||
"training",
|
||||
"software",
|
||||
"communication",
|
||||
"welfare"
|
||||
],
|
||||
"budget_required": true,
|
||||
"applies_to": {
|
||||
"domains": [
|
||||
"expense"
|
||||
],
|
||||
"expense_types": [
|
||||
"travel",
|
||||
"hotel",
|
||||
"transport",
|
||||
"meal",
|
||||
"meeting",
|
||||
"marketing",
|
||||
"office",
|
||||
"training",
|
||||
"software",
|
||||
"communication",
|
||||
"welfare"
|
||||
],
|
||||
"business_stages": [
|
||||
"expense_application",
|
||||
"reimbursement",
|
||||
"budget_execution"
|
||||
]
|
||||
},
|
||||
"inputs": {
|
||||
"fields": [
|
||||
{
|
||||
"key": "claim.amount",
|
||||
"label": "报销金额",
|
||||
"type": "number",
|
||||
"source": "claim"
|
||||
},
|
||||
{
|
||||
"key": "claim.expense_type",
|
||||
"label": "费用类型",
|
||||
"type": "enum",
|
||||
"source": "claim"
|
||||
},
|
||||
{
|
||||
"key": "budget.available_amount",
|
||||
"label": "预算可用金额",
|
||||
"type": "number",
|
||||
"source": "budget"
|
||||
},
|
||||
{
|
||||
"key": "budget.status",
|
||||
"label": "预算状态",
|
||||
"type": "enum",
|
||||
"source": "budget"
|
||||
}
|
||||
]
|
||||
},
|
||||
"params": {
|
||||
"template_key": "keyword_match_v1",
|
||||
"field_keys": [
|
||||
"claim.amount",
|
||||
"claim.expense_type",
|
||||
"claim.department_name",
|
||||
"claim.reason",
|
||||
"item.item_reason",
|
||||
"budget.line_id",
|
||||
"budget.available_amount",
|
||||
"budget.used_rate",
|
||||
"budget.status",
|
||||
"budget.department_name",
|
||||
"budget.quarter",
|
||||
"budget.project_code"
|
||||
],
|
||||
"search_fields": [
|
||||
"claim.reason",
|
||||
"item.item_reason",
|
||||
"claim.expense_type"
|
||||
],
|
||||
"keywords": [
|
||||
"预算不足",
|
||||
"可用余额不足",
|
||||
"超预算"
|
||||
],
|
||||
"condition_summary": "预算可用金额小于本次金额时触发。",
|
||||
"finance_rule_code": "budget.execution.policy",
|
||||
"finance_rule_sheet": "预算执行规则",
|
||||
"business_stage": [
|
||||
"expense_application",
|
||||
"reimbursement",
|
||||
"budget_execution"
|
||||
],
|
||||
"expense_types": [
|
||||
"travel",
|
||||
"hotel",
|
||||
"transport",
|
||||
"meal",
|
||||
"meeting",
|
||||
"marketing",
|
||||
"office",
|
||||
"training",
|
||||
"software",
|
||||
"communication",
|
||||
"welfare"
|
||||
],
|
||||
"budget_required": true
|
||||
},
|
||||
"outcomes": {
|
||||
"pass": {
|
||||
"severity": "none",
|
||||
"action": "continue"
|
||||
},
|
||||
"fail": {
|
||||
"severity": "high",
|
||||
"action": "manual_review",
|
||||
"risk_score": 88
|
||||
}
|
||||
},
|
||||
"metadata": {
|
||||
"owner": "风控与审计部",
|
||||
"stability": "platform",
|
||||
"source_ref": "费用管控 Demo 风险规则库",
|
||||
"created_at": "2026-05-30T00:00:00Z",
|
||||
"created_by": "system",
|
||||
"risk_score": 88,
|
||||
"risk_level": "high",
|
||||
"rule_title": "预算可用余额不足",
|
||||
"finance_rule_code": "budget.execution.policy",
|
||||
"finance_rule_sheet": "预算执行规则",
|
||||
"business_stage": [
|
||||
"expense_application",
|
||||
"reimbursement",
|
||||
"budget_execution"
|
||||
],
|
||||
"expense_types": [
|
||||
"travel",
|
||||
"hotel",
|
||||
"transport",
|
||||
"meal",
|
||||
"meeting",
|
||||
"marketing",
|
||||
"office",
|
||||
"training",
|
||||
"software",
|
||||
"communication",
|
||||
"welfare"
|
||||
],
|
||||
"budget_required": true
|
||||
},
|
||||
"severity": "high",
|
||||
"risk_score": 88,
|
||||
"risk_level": "high"
|
||||
}
|
||||
Reference in New Issue
Block a user