Skip to main content

7-发票规则配置

概览

目录:doc/product/financial/rules

该模块将发票风控的规则逻辑结构化为 JSON,便于在元数据服务中统一管理、启停与审计。

  • 规则定义:rules/fin_invoice.json

发票实体规则组

文件:rules/fin_invoice.json

该文件通过一组规则描述了税法风险、内部控制风险与行为风险,作用在不同的实体范围上(如 fin_invoicesfin_expensesfin_behavior)。

完整 JSON:

[
{
"ruleType": "tax",
"code": "fin_tax_invoice_rate_not_allowed",
"name": "发票税率不在允许范围",
"description": "发票税率不在公司支持的合法税率列表内时判定为税法风险。",
"scopeType": "entity",
"scopeKey": "fin_invoices",
"enabled": true,
"predicate": {
"type": "comparison",
"field": "fin_invoices.tax_rate",
"op": "not_in",
"value": [0.01, 0.03, 0.06, 0.09, 0.13]
}
},
{
"ruleType": "tax",
"code": "fin_tax_invoice_amount_vs_tax_too_high",
"name": "税额超过金额与最高税率的合理区间",
"description": "当税额大于不含税金额乘以策略配置的最高税率时,判定为税额异常的税法风险。",
"scopeType": "entity",
"scopeKey": "fin_invoices",
"enabled": true,
"predicate": {
"type": "comparison",
"field": "fin_invoices.tax_amount",
"op": "gt",
"value": {
"type": "expression",
"expr": "#fin_invoices.amount_excl_tax * #fin_policy.max_tax_rate"
}
}
},
{
"ruleType": "tax",
"code": "fin_tax_invoice_type_not_allowed",
"name": "发票类型不在合法类型白名单内",
"description": "当发票类型不在合法类型白名单内时,判定为税法合规风险。",
"scopeType": "entity",
"scopeKey": "fin_invoices",
"enabled": true,
"predicate": {
"type": "comparison",
"field": "fin_invoices.invoice_type",
"op": "not_in",
"value": [
"special",
"normal",
"e_invoice"
]
}
},
{
"ruleType": "tax",
"code": "fin_tax_buyer_tax_id_missing",
"name": "购方税号缺失",
"description": "购方税号为空时,判定为税号信息不完整的税法风险。",
"scopeType": "entity",
"scopeKey": "fin_invoices",
"enabled": true,
"predicate": {
"type": "comparison",
"field": "fin_invoices.buyer_tax_id",
"op": "is_null"
}
},
{
"ruleType": "internal",
"code": "fin_internal_invoice_amount_over_policy_limit",
"name": "单张发票金额超过内部单票上限",
"description": "当发票不含税金额大于内部策略配置的单票金额上限时,判定为内控风险。",
"scopeType": "entity",
"scopeKey": "fin_invoices",
"enabled": true,
"predicate": {
"type": "comparison",
"field": "fin_invoices.amount_excl_tax",
"op": "gt",
"value": {
"type": "field",
"path": "fin_policy.single_invoice_max_amount"
}
}
},
{
"ruleType": "internal",
"code": "fin_internal_invoice_amount_in_sensitive_range",
"name": "发票金额落在敏感区间",
"description": "当发票金额落在策略配置的敏感区间(例如招待费灰区)时,判定为内控关注项。",
"scopeType": "entity",
"scopeKey": "fin_invoices",
"enabled": true,
"predicate": {
"type": "comparison",
"field": "fin_invoices.amount_excl_tax",
"op": "between",
"value": [
{
"type": "field",
"path": "fin_policy.sensitive_amount_min"
},
{
"type": "field",
"path": "fin_policy.sensitive_amount_max"
}
]
}
},
{
"ruleType": "internal",
"code": "fin_internal_supplier_invoice_count_30d_over_limit",
"name": "同一供应商30天内发票数量超阈值",
"description": "同一供应商在最近30天内的发票数量超过策略阈值时,判定为集中采购/拆分报销等内控风险。",
"scopeType": "entity",
"scopeKey": "fin_invoices",
"enabled": true,
"predicate": {
"type": "comparison",
"field": "fin_invoice.seller_invoice_count_30d",
"op": "gte",
"value": {
"type": "field",
"path": "fin_policy.seller_invoice_count_30d_threshold"
}
}
},
{
"ruleType": "internal",
"code": "fin_internal_invoice_goods_name_suspicious",
"name": "发票商品名称包含敏感关键词",
"description": "发票商品名称包含敏感关键词(如礼品、烟酒等)时,判定为费用属性可疑的内控风险。",
"scopeType": "entity",
"scopeKey": "fin_invoices",
"enabled": true,
"predicate": {
"type": "comparison",
"field": "fin_invoice.goods_name",
"op": "ilike",
"value": "%礼品%"
}
},
{
"ruleType": "internal",
"code": "fin_internal_invoice_currency_not_local",
"name": "发票币种非本位币",
"description": "发票币种不为公司本位币(如CNY)时,标记为需要人工关注的内控项。",
"scopeType": "entity",
"scopeKey": "fin_invoices",
"enabled": true,
"predicate": {
"type": "comparison",
"field": "fin_invoices.currency",
"op": "ne",
"value": "CNY"
}
},
{
"ruleType": "internal",
"code": "fin_internal_expense_occurred_after_submit",
"name": "费用发生日期晚于报销提交日期",
"description": "当费用发生时间晚于报销单提交时间时,判定为流程异常的内控风险。",
"scopeType": "entity",
"scopeKey": "fin_expenses",
"enabled": false,
"predicate": {
"type": "comparison",
"field": "fin_expense.occurred_at",
"op": "gt",
"value": {
"type": "field",
"path": "fin_expense.submitted_at"
}
}
},
{
"ruleType": "behavior",
"code": "fin_behavior_employee_30d_amount_over_limit",
"name": "员工30天内报销总额超过策略上限",
"description": "员工在近30天内的累计报销金额超过策略配置的个人上限时,判定为行为风险。",
"scopeType": "entity",
"scopeKey": "fin_behavior",
"enabled": false,
"predicate": {
"type": "comparison",
"field": "fin_behavior.emp_30d_amount",
"op": "gt",
"value": {
"type": "field",
"path": "fin_policy.emp_30d_amount_max"
}
}
},
{
"ruleType": "behavior",
"code": "fin_behavior_employee_30d_vs_dept_ratio_high",
"name": "员工30天报销金额显著高于部门平均",
"description": "员工近30天报销金额与部门人均报销金额的比值超过阈值(如2倍)时,判定为行为风险。",
"scopeType": "entity",
"scopeKey": "fin_expenses",
"enabled": false,
"predicate": {
"type": "comparison",
"field": "fin_behavior.emp_30d_vs_dept_avg",
"op": "gt",
"value": 2.0
}
},
{
"ruleType": "behavior",
"code": "fin_behavior_employee_30d_invoice_count_over_limit",
"name": "员工30天发票数量过多",
"description": "员工近30天关联的发票数量超过策略配置阈值时,判定为频次异常的行为风险。",
"scopeType": "entity",
"scopeKey": "fin_expenses",
"enabled": false,
"predicate": {
"type": "comparison",
"field": "fin_behavior.emp_30d_invoice_count",
"op": "gt",
"value": {
"type": "field",
"path": "fin_policy.emp_30d_invoice_count_threshold"
}
}
}
]

在初始化脚本 doc/product/financial/init/init.py 中,init_rules 会批量读取上述 JSON,并通过元数据服务接口完成规则的落地。权限策略部分见独立文档《发票权限策略》。