修正异常账户流水返回账号覆盖

This commit is contained in:
wkc
2026-03-31 20:58:44 +08:00
parent 09b4cfe3c4
commit 5de46eabc5
4 changed files with 102 additions and 2 deletions

View File

@@ -311,6 +311,66 @@ def test_generate_statements_should_follow_abnormal_account_rule_plan_from_file_
assert any("销户" in item["userMemo"] or "异常账户" in item["userMemo"] for item in statements)
def test_get_bank_statement_should_preserve_abnormal_account_mask_no():
file_service = FileService(staff_identity_repository=FakeStaffIdentityRepository())
statement_service = StatementService(file_service=file_service)
response = file_service.fetch_inner_flow(
{
"groupId": 1001,
"customerNo": "customer_abnormal_api",
"dataChannelCode": "test_code",
"requestDateId": 20240101,
"dataStartDateId": 20240101,
"dataEndDateId": 20240131,
"uploadUserId": 902001,
}
)
log_id = response["data"][0]
record = file_service.file_records[log_id]
record.abnormal_account_hit_rules = [
"SUDDEN_ACCOUNT_CLOSURE",
"DORMANT_ACCOUNT_LARGE_ACTIVATION",
]
record.abnormal_accounts = [
{
"account_no": "6222000000000001",
"owner_id_card": record.staff_id_card,
"account_name": "测试员工工资卡",
"status": 2,
"effective_date": "2024-01-01",
"invalid_date": "2026-03-20",
"rule_code": "SUDDEN_ACCOUNT_CLOSURE",
},
{
"account_no": "6222000000000002",
"owner_id_card": record.staff_id_card,
"account_name": "测试员工工资卡",
"status": 1,
"effective_date": "2025-01-01",
"invalid_date": None,
"rule_code": "DORMANT_ACCOUNT_LARGE_ACTIVATION",
},
]
response = statement_service.get_bank_statement(
{
"groupId": 1001,
"logId": log_id,
"pageNow": 1,
"pageSize": 500,
}
)
statements = response["data"]["bankStatementList"]
abnormal_statements = [
item for item in statements if "销户" in item["userMemo"] or "激活" in item["userMemo"]
]
assert abnormal_statements
assert any(item["accountMaskNo"] == "6222000000000001" for item in abnormal_statements)
assert any(item["accountMaskNo"] == "6222000000000002" for item in abnormal_statements)
def test_generate_statements_should_stay_within_single_employee_scope_per_log_id():
"""同一 logId 的流水只能落在 FileRecord 绑定的员工及亲属身份证内。"""
file_service = FileService(staff_identity_repository=FakeStaffIdentityRepository())