锁定异常账户流水与账户事实一致性
This commit is contained in:
@@ -28,6 +28,11 @@ class FakeStaffIdentityRepository:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class FakeAbnormalAccountBaselineService:
|
||||||
|
def apply(self, staff_id_card, abnormal_accounts):
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
def test_generate_statements_should_include_seeded_samples_before_noise_when_rule_plan_exists():
|
def test_generate_statements_should_include_seeded_samples_before_noise_when_rule_plan_exists():
|
||||||
"""存在规则命中计划时,生成流水必须先混入被选中的命中样本。"""
|
"""存在规则命中计划时,生成流水必须先混入被选中的命中样本。"""
|
||||||
file_service = FileService(staff_identity_repository=FakeStaffIdentityRepository())
|
file_service = FileService(staff_identity_repository=FakeStaffIdentityRepository())
|
||||||
@@ -371,6 +376,51 @@ def test_get_bank_statement_should_preserve_abnormal_account_mask_no():
|
|||||||
assert any(item["accountMaskNo"] == "6222000000000002" for item in abnormal_statements)
|
assert any(item["accountMaskNo"] == "6222000000000002" for item in abnormal_statements)
|
||||||
|
|
||||||
|
|
||||||
|
def test_get_bank_statement_should_only_use_abnormal_account_numbers_from_file_record():
|
||||||
|
file_service = FileService(
|
||||||
|
staff_identity_repository=FakeStaffIdentityRepository(),
|
||||||
|
abnormal_account_baseline_service=FakeAbnormalAccountBaselineService(),
|
||||||
|
)
|
||||||
|
statement_service = StatementService(file_service=file_service)
|
||||||
|
|
||||||
|
response = file_service.fetch_inner_flow(
|
||||||
|
{
|
||||||
|
"groupId": 1001,
|
||||||
|
"customerNo": "customer_abnormal_statement_consistency",
|
||||||
|
"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"]
|
||||||
|
record.abnormal_accounts = [
|
||||||
|
{
|
||||||
|
"account_no": "6222000000000099",
|
||||||
|
"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",
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
result = statement_service.get_bank_statement(
|
||||||
|
{"groupId": 1001, "logId": log_id, "pageNow": 1, "pageSize": 500}
|
||||||
|
)
|
||||||
|
abnormal_numbers = {
|
||||||
|
item["accountMaskNo"]
|
||||||
|
for item in result["data"]["bankStatementList"]
|
||||||
|
if "销户" in item["userMemo"] or "异常账户" in item["userMemo"]
|
||||||
|
}
|
||||||
|
|
||||||
|
assert abnormal_numbers == {"6222000000000099"}
|
||||||
|
|
||||||
|
|
||||||
def test_generate_statements_should_stay_within_single_employee_scope_per_log_id():
|
def test_generate_statements_should_stay_within_single_employee_scope_per_log_id():
|
||||||
"""同一 logId 的流水只能落在 FileRecord 绑定的员工及亲属身份证内。"""
|
"""同一 logId 的流水只能落在 FileRecord 绑定的员工及亲属身份证内。"""
|
||||||
file_service = FileService(staff_identity_repository=FakeStaffIdentityRepository())
|
file_service = FileService(staff_identity_repository=FakeStaffIdentityRepository())
|
||||||
|
|||||||
Reference in New Issue
Block a user