修复Mock流水按数据库员工及亲属绑定身份证
This commit is contained in:
@@ -34,11 +34,33 @@ IDENTITY_POOL = {
|
||||
},
|
||||
}
|
||||
|
||||
IDENTITY_SCOPES = {
|
||||
"primary": {
|
||||
"staff": IDENTITY_POOL["staff_primary"],
|
||||
"family": IDENTITY_POOL["family_primary"],
|
||||
},
|
||||
"secondary": {
|
||||
"staff": IDENTITY_POOL["staff_secondary"],
|
||||
"family": IDENTITY_POOL["family_secondary"],
|
||||
},
|
||||
}
|
||||
|
||||
IDENTITY_CARD_POOL = tuple(identity["id_card"] for identity in IDENTITY_POOL.values())
|
||||
|
||||
REFERENCE_NOW = datetime(2026, 3, 18, 9, 0, 0)
|
||||
|
||||
|
||||
def resolve_identity_scope(log_id: int) -> Dict[str, Dict[str, str]]:
|
||||
"""按 logId 稳定选择单个员工域。"""
|
||||
return IDENTITY_SCOPES["primary"] if log_id % 2 == 1 else IDENTITY_SCOPES["secondary"]
|
||||
|
||||
|
||||
def resolve_identity_cards(log_id: int) -> tuple:
|
||||
"""返回指定 logId 允许出现的证件号集合(员工本人及家属)。"""
|
||||
identity_scope = resolve_identity_scope(log_id)
|
||||
return tuple(identity["id_card"] for identity in identity_scope.values())
|
||||
|
||||
|
||||
def _format_datetime(value: datetime) -> str:
|
||||
return value.strftime("%Y-%m-%d %H:%M:%S")
|
||||
|
||||
@@ -124,9 +146,17 @@ def build_large_transaction_seed_statements(
|
||||
log_id: int,
|
||||
primary_enterprise_name: Optional[str] = None,
|
||||
primary_account_no: Optional[str] = None,
|
||||
staff_id_card: Optional[str] = None,
|
||||
family_id_cards: Optional[List[str]] = None,
|
||||
) -> List[Dict]:
|
||||
le_name = primary_enterprise_name or "模型测试主体"
|
||||
account_no = primary_account_no or "6222024999999999"
|
||||
identity_scope = resolve_identity_scope(log_id)
|
||||
staff_identity = identity_scope["staff"]
|
||||
family_identity = identity_scope["family"]
|
||||
selected_staff_id_card = staff_id_card or staff_identity["id_card"]
|
||||
selected_family_id_cards = list(family_id_cards or [family_identity["id_card"]])
|
||||
primary_family_id_card = selected_family_id_cards[0] if selected_family_id_cards else selected_staff_id_card
|
||||
|
||||
statements: List[Dict] = []
|
||||
|
||||
@@ -135,7 +165,7 @@ def build_large_transaction_seed_statements(
|
||||
group_id,
|
||||
log_id,
|
||||
trx_datetime=REFERENCE_NOW - timedelta(days=9, hours=1),
|
||||
cret_no=IDENTITY_POOL["staff_primary"]["id_card"],
|
||||
cret_no=selected_staff_id_card,
|
||||
customer_name="杭州贝壳房地产经纪有限公司",
|
||||
user_memo="购买房产首付款",
|
||||
cash_type="对公转账",
|
||||
@@ -148,7 +178,7 @@ def build_large_transaction_seed_statements(
|
||||
group_id,
|
||||
log_id,
|
||||
trx_datetime=REFERENCE_NOW - timedelta(days=8, hours=2),
|
||||
cret_no=IDENTITY_POOL["family_primary"]["id_card"],
|
||||
cret_no=primary_family_id_card,
|
||||
customer_name="兰溪星耀汽车销售服务有限公司",
|
||||
user_memo="购车首付款",
|
||||
cash_type="对公转账",
|
||||
@@ -161,7 +191,7 @@ def build_large_transaction_seed_statements(
|
||||
group_id,
|
||||
log_id,
|
||||
trx_datetime=REFERENCE_NOW - timedelta(days=7, hours=1),
|
||||
cret_no=IDENTITY_POOL["staff_secondary"]["id_card"],
|
||||
cret_no=selected_staff_id_card,
|
||||
customer_name="国家金库兰溪市中心支库",
|
||||
user_memo="个人所得税税款",
|
||||
cash_type="税务缴款",
|
||||
@@ -174,7 +204,7 @@ def build_large_transaction_seed_statements(
|
||||
group_id,
|
||||
log_id,
|
||||
trx_datetime=REFERENCE_NOW - timedelta(days=6, hours=3),
|
||||
cret_no=IDENTITY_POOL["family_secondary"]["id_card"],
|
||||
cret_no=primary_family_id_card,
|
||||
customer_name="兰溪市税务局",
|
||||
user_memo="房产税务缴税",
|
||||
cash_type="税务缴款",
|
||||
@@ -187,7 +217,7 @@ def build_large_transaction_seed_statements(
|
||||
group_id,
|
||||
log_id,
|
||||
trx_datetime=REFERENCE_NOW - timedelta(days=5, hours=2),
|
||||
cret_no=IDENTITY_POOL["staff_secondary"]["id_card"],
|
||||
cret_no=selected_staff_id_card,
|
||||
customer_name="浙江远望贸易有限公司",
|
||||
user_memo="经营往来收入",
|
||||
cash_type="对公转账",
|
||||
@@ -200,7 +230,7 @@ def build_large_transaction_seed_statements(
|
||||
group_id,
|
||||
log_id,
|
||||
trx_datetime=REFERENCE_NOW - timedelta(days=5, hours=1),
|
||||
cret_no=IDENTITY_POOL["staff_secondary"]["id_card"],
|
||||
cret_no=selected_staff_id_card,
|
||||
customer_name="浙江远望贸易有限公司",
|
||||
user_memo="项目回款收入",
|
||||
cash_type="对公转账",
|
||||
@@ -213,7 +243,7 @@ def build_large_transaction_seed_statements(
|
||||
group_id,
|
||||
log_id,
|
||||
trx_datetime=REFERENCE_NOW - timedelta(days=4, hours=4),
|
||||
cret_no=IDENTITY_POOL["staff_secondary"]["id_card"],
|
||||
cret_no=selected_staff_id_card,
|
||||
customer_name="浙江远望贸易有限公司",
|
||||
user_memo="业务合作收入",
|
||||
cash_type="对公转账",
|
||||
@@ -226,7 +256,7 @@ def build_large_transaction_seed_statements(
|
||||
group_id,
|
||||
log_id,
|
||||
trx_datetime=datetime(2026, 3, 10, 9, 0, 0),
|
||||
cret_no=IDENTITY_POOL["staff_primary"]["id_card"],
|
||||
cret_no=selected_staff_id_card,
|
||||
customer_name="",
|
||||
user_memo="现金存款",
|
||||
cash_type="现金存款",
|
||||
@@ -238,7 +268,7 @@ def build_large_transaction_seed_statements(
|
||||
group_id,
|
||||
log_id,
|
||||
trx_datetime=datetime(2026, 3, 10, 9, 30, 0),
|
||||
cret_no=IDENTITY_POOL["staff_primary"]["id_card"],
|
||||
cret_no=selected_staff_id_card,
|
||||
customer_name="",
|
||||
user_memo="ATM现金存款",
|
||||
cash_type="现金存款",
|
||||
@@ -250,7 +280,7 @@ def build_large_transaction_seed_statements(
|
||||
group_id,
|
||||
log_id,
|
||||
trx_datetime=datetime(2026, 3, 10, 10, 0, 0),
|
||||
cret_no=IDENTITY_POOL["staff_primary"]["id_card"],
|
||||
cret_no=selected_staff_id_card,
|
||||
customer_name="",
|
||||
user_memo="自助存款现金存入",
|
||||
cash_type="现金存款",
|
||||
@@ -262,7 +292,7 @@ def build_large_transaction_seed_statements(
|
||||
group_id,
|
||||
log_id,
|
||||
trx_datetime=datetime(2026, 3, 10, 10, 30, 0),
|
||||
cret_no=IDENTITY_POOL["staff_primary"]["id_card"],
|
||||
cret_no=selected_staff_id_card,
|
||||
customer_name="",
|
||||
user_memo="CRS存款",
|
||||
cash_type="现金存款",
|
||||
@@ -274,7 +304,7 @@ def build_large_transaction_seed_statements(
|
||||
group_id,
|
||||
log_id,
|
||||
trx_datetime=datetime(2026, 3, 10, 11, 0, 0),
|
||||
cret_no=IDENTITY_POOL["staff_primary"]["id_card"],
|
||||
cret_no=selected_staff_id_card,
|
||||
customer_name="",
|
||||
user_memo="本行ATM存款",
|
||||
cash_type="现金存款",
|
||||
@@ -286,7 +316,7 @@ def build_large_transaction_seed_statements(
|
||||
group_id,
|
||||
log_id,
|
||||
trx_datetime=datetime(2026, 3, 10, 11, 30, 0),
|
||||
cret_no=IDENTITY_POOL["staff_primary"]["id_card"],
|
||||
cret_no=selected_staff_id_card,
|
||||
customer_name="",
|
||||
user_memo="柜面现金存款",
|
||||
cash_type="现金存款",
|
||||
@@ -298,7 +328,7 @@ def build_large_transaction_seed_statements(
|
||||
group_id,
|
||||
log_id,
|
||||
trx_datetime=REFERENCE_NOW - timedelta(days=3, hours=1),
|
||||
cret_no=IDENTITY_POOL["staff_secondary"]["id_card"],
|
||||
cret_no=selected_staff_id_card,
|
||||
customer_name="异地转账平台",
|
||||
user_memo="手机银行转账",
|
||||
cash_type="转账支出",
|
||||
@@ -311,7 +341,7 @@ def build_large_transaction_seed_statements(
|
||||
group_id,
|
||||
log_id,
|
||||
trx_datetime=REFERENCE_NOW - timedelta(days=3, hours=2),
|
||||
cret_no=IDENTITY_POOL["staff_secondary"]["id_card"],
|
||||
cret_no=selected_staff_id_card,
|
||||
customer_name="跨行转账中心",
|
||||
user_memo="对外转账",
|
||||
cash_type="转账支出",
|
||||
@@ -324,7 +354,7 @@ def build_large_transaction_seed_statements(
|
||||
group_id,
|
||||
log_id,
|
||||
trx_datetime=REFERENCE_NOW - timedelta(days=2, hours=5),
|
||||
cret_no=IDENTITY_POOL["staff_secondary"]["id_card"],
|
||||
cret_no=selected_staff_id_card,
|
||||
customer_name="跨境转账服务平台",
|
||||
user_memo="网银转账",
|
||||
cash_type="转账支出",
|
||||
|
||||
Reference in New Issue
Block a user