补充异常账户规则样本生成器
This commit is contained in:
@@ -4,6 +4,7 @@ StatementService 主绑定注入测试
|
||||
|
||||
from collections import Counter, defaultdict
|
||||
|
||||
import services.statement_rule_samples as statement_rule_samples
|
||||
from services.file_service import FileService
|
||||
from services.statement_service import StatementService
|
||||
from services.statement_rule_samples import (
|
||||
@@ -234,6 +235,47 @@ def test_generate_statements_should_follow_rule_hit_plan_from_file_record():
|
||||
assert not any("购汇" in item["userMemo"] for item in statements)
|
||||
|
||||
|
||||
def test_sudden_account_closure_samples_should_stay_within_30_days_before_invalid_date():
|
||||
statements = statement_rule_samples.build_sudden_account_closure_samples(
|
||||
group_id=1000,
|
||||
log_id=20001,
|
||||
account_fact={
|
||||
"account_no": "6222000000000001",
|
||||
"owner_id_card": "320101199001010030",
|
||||
"account_name": "测试员工工资卡",
|
||||
"status": 2,
|
||||
"effective_date": "2024-01-01",
|
||||
"invalid_date": "2026-03-20",
|
||||
},
|
||||
le_name="测试主体",
|
||||
)
|
||||
|
||||
assert statements
|
||||
assert all("6222000000000001" == item["accountMaskNo"] for item in statements)
|
||||
assert all("2026-02-18" <= item["trxDate"][:10] < "2026-03-20" for item in statements)
|
||||
|
||||
|
||||
def test_dormant_account_large_activation_samples_should_exceed_threshold_after_6_months():
|
||||
statements = statement_rule_samples.build_dormant_account_large_activation_samples(
|
||||
group_id=1000,
|
||||
log_id=20001,
|
||||
account_fact={
|
||||
"account_no": "6222000000000002",
|
||||
"owner_id_card": "320101199001010030",
|
||||
"account_name": "测试员工工资卡",
|
||||
"status": 1,
|
||||
"effective_date": "2025-01-01",
|
||||
"invalid_date": None,
|
||||
},
|
||||
le_name="测试主体",
|
||||
)
|
||||
|
||||
assert statements
|
||||
assert min(item["trxDate"][:10] for item in statements) >= "2025-07-01"
|
||||
assert sum(item["drAmount"] + item["crAmount"] for item in statements) >= 500000
|
||||
assert max(item["drAmount"] + item["crAmount"] for item in statements) >= 100000
|
||||
|
||||
|
||||
def test_generate_statements_should_stay_within_single_employee_scope_per_log_id():
|
||||
"""同一 logId 的流水只能落在 FileRecord 绑定的员工及亲属身份证内。"""
|
||||
file_service = FileService(staff_identity_repository=FakeStaffIdentityRepository())
|
||||
|
||||
Reference in New Issue
Block a user