接通Mock随机命中流水生成链路

This commit is contained in:
wkc
2026-03-20 14:48:02 +08:00
parent 5d03811d49
commit e97055379c
3 changed files with 92 additions and 6 deletions

View File

@@ -5,7 +5,7 @@ import uuid
from datetime import datetime, timedelta
from services.statement_rule_samples import (
build_large_transaction_seed_statements,
build_seed_statements_for_rule_plan,
resolve_identity_cards,
)
@@ -144,14 +144,21 @@ class StatementService:
"""生成指定数量的流水记录。"""
primary_enterprise_name, primary_account_no = self._resolve_primary_binding(log_id)
record = self.file_service.get_file_record(log_id) if self.file_service is not None else None
rule_plan = {
"large_transaction_hit_rules": (
list(record.large_transaction_hit_rules) if record is not None else []
),
"phase1_hit_rules": list(record.phase1_hit_rules) if record is not None else [],
}
if record is not None and record.staff_id_card:
allowed_identity_cards = tuple([record.staff_id_card, *record.family_id_cards])
else:
allowed_identity_cards = resolve_identity_cards(log_id)
rng = random.Random(f"statement:{log_id}")
seeded_statements = build_large_transaction_seed_statements(
seeded_statements = build_seed_statements_for_rule_plan(
group_id=group_id,
log_id=log_id,
rule_plan=rule_plan,
primary_enterprise_name=primary_enterprise_name,
primary_account_no=primary_account_no,
staff_id_card=record.staff_id_card if record is not None else None,