339 lines
11 KiB
Python
339 lines
11 KiB
Python
from datetime import datetime, timedelta
|
|
from typing import Dict, List, Optional
|
|
|
|
|
|
DEFAULT_LARGE_TRANSACTION_THRESHOLDS = {
|
|
"SINGLE_TRANSACTION_AMOUNT": 1111,
|
|
"CUMULATIVE_TRANSACTION_AMOUNT": 50000001,
|
|
"ANNUAL_TURNOVER": 50000001,
|
|
"LARGE_CASH_DEPOSIT": 2000001,
|
|
"FREQUENT_CASH_DEPOSIT": 5,
|
|
"FREQUENT_TRANSFER": 100001,
|
|
}
|
|
|
|
IDENTITY_POOL = {
|
|
"staff_primary": {
|
|
"name": "模型测试员工",
|
|
"id_card": "330101198801010011",
|
|
"account": "6222024000000001",
|
|
},
|
|
"family_primary": {
|
|
"name": "模型测试家属",
|
|
"id_card": "330101199001010022",
|
|
"account": "6222024000000002",
|
|
},
|
|
"staff_secondary": {
|
|
"name": "模型二测试员工",
|
|
"id_card": "330101198802020033",
|
|
"account": "6222024000000003",
|
|
},
|
|
"family_secondary": {
|
|
"name": "模型二测试家属",
|
|
"id_card": "330101199202020044",
|
|
"account": "6222024000000004",
|
|
},
|
|
}
|
|
|
|
IDENTITY_CARD_POOL = tuple(identity["id_card"] for identity in IDENTITY_POOL.values())
|
|
|
|
REFERENCE_NOW = datetime(2026, 3, 18, 9, 0, 0)
|
|
|
|
|
|
def _format_datetime(value: datetime) -> str:
|
|
return value.strftime("%Y-%m-%d %H:%M:%S")
|
|
|
|
|
|
def _format_date(value: datetime) -> str:
|
|
return value.strftime("%Y-%m-%d")
|
|
|
|
|
|
def _build_statement(
|
|
group_id: int,
|
|
log_id: int,
|
|
*,
|
|
trx_datetime: datetime,
|
|
cret_no: str,
|
|
customer_name: str,
|
|
user_memo: str,
|
|
cash_type: str,
|
|
dr_amount: float = 0.0,
|
|
cr_amount: float = 0.0,
|
|
le_name: str = "模型测试主体",
|
|
account_mask_no: str = "6222024999999999",
|
|
customer_account_mask_no: str = "9558800000000001",
|
|
bank_comments: str = "",
|
|
customer_bank: str = "",
|
|
) -> Dict:
|
|
trans_amount = round(dr_amount if dr_amount > 0 else cr_amount, 2)
|
|
balance_amount = round(80000000 + cr_amount - dr_amount, 2)
|
|
|
|
return {
|
|
"accountId": 0,
|
|
"accountMaskNo": account_mask_no,
|
|
"accountingDate": _format_date(trx_datetime),
|
|
"accountingDateId": int(trx_datetime.strftime("%Y%m%d")),
|
|
"archivingFlag": 0,
|
|
"attachments": 0,
|
|
"balanceAmount": balance_amount,
|
|
"bank": "ZJRCU",
|
|
"bankComments": bank_comments,
|
|
"bankStatementId": 0,
|
|
"bankTrxNumber": "",
|
|
"batchId": log_id,
|
|
"cashType": cash_type,
|
|
"commentsNum": 0,
|
|
"crAmount": round(cr_amount, 2),
|
|
"createDate": _format_datetime(REFERENCE_NOW),
|
|
"createdBy": "902001",
|
|
"cretNo": cret_no,
|
|
"currency": "CNY",
|
|
"customerAccountMaskNo": customer_account_mask_no,
|
|
"customerBank": customer_bank,
|
|
"customerId": -1,
|
|
"customerName": customer_name,
|
|
"customerReference": "",
|
|
"downPaymentFlag": 0,
|
|
"drAmount": round(dr_amount, 2),
|
|
"exceptionType": "",
|
|
"groupId": group_id,
|
|
"internalFlag": 0,
|
|
"leId": 16308,
|
|
"leName": le_name,
|
|
"overrideBsId": 0,
|
|
"paymentMethod": "",
|
|
"sourceCatalogId": 0,
|
|
"split": 0,
|
|
"subBankstatementId": 0,
|
|
"toDoFlag": 0,
|
|
"transAmount": trans_amount,
|
|
"transFlag": "P" if dr_amount > 0 else "R",
|
|
"transTypeId": 0,
|
|
"transformAmount": 0,
|
|
"transformCrAmount": 0,
|
|
"transformDrAmount": 0,
|
|
"transfromBalanceAmount": 0,
|
|
"trxBalance": 0,
|
|
"trxDate": _format_datetime(trx_datetime),
|
|
"uploadSequnceNumber": 0,
|
|
"userMemo": user_memo,
|
|
}
|
|
|
|
|
|
def build_large_transaction_seed_statements(
|
|
group_id: int,
|
|
log_id: int,
|
|
primary_enterprise_name: Optional[str] = None,
|
|
primary_account_no: Optional[str] = None,
|
|
) -> List[Dict]:
|
|
le_name = primary_enterprise_name or "模型测试主体"
|
|
account_no = primary_account_no or "6222024999999999"
|
|
|
|
statements: List[Dict] = []
|
|
|
|
statements.extend([
|
|
_build_statement(
|
|
group_id,
|
|
log_id,
|
|
trx_datetime=REFERENCE_NOW - timedelta(days=9, hours=1),
|
|
cret_no=IDENTITY_POOL["staff_primary"]["id_card"],
|
|
customer_name="杭州贝壳房地产经纪有限公司",
|
|
user_memo="购买房产首付款",
|
|
cash_type="对公转账",
|
|
dr_amount=680000.0,
|
|
le_name=le_name,
|
|
account_mask_no=account_no,
|
|
customer_account_mask_no="6222024555500001",
|
|
),
|
|
_build_statement(
|
|
group_id,
|
|
log_id,
|
|
trx_datetime=REFERENCE_NOW - timedelta(days=8, hours=2),
|
|
cret_no=IDENTITY_POOL["family_primary"]["id_card"],
|
|
customer_name="兰溪星耀汽车销售服务有限公司",
|
|
user_memo="购车首付款",
|
|
cash_type="对公转账",
|
|
dr_amount=380000.0,
|
|
le_name=le_name,
|
|
account_mask_no=account_no,
|
|
customer_account_mask_no="6222024555500002",
|
|
),
|
|
_build_statement(
|
|
group_id,
|
|
log_id,
|
|
trx_datetime=REFERENCE_NOW - timedelta(days=7, hours=1),
|
|
cret_no=IDENTITY_POOL["staff_secondary"]["id_card"],
|
|
customer_name="国家金库兰溪市中心支库",
|
|
user_memo="个人所得税税款",
|
|
cash_type="税务缴款",
|
|
dr_amount=126000.0,
|
|
le_name=le_name,
|
|
account_mask_no=account_no,
|
|
customer_account_mask_no="6222024555500003",
|
|
),
|
|
_build_statement(
|
|
group_id,
|
|
log_id,
|
|
trx_datetime=REFERENCE_NOW - timedelta(days=6, hours=3),
|
|
cret_no=IDENTITY_POOL["family_secondary"]["id_card"],
|
|
customer_name="兰溪市税务局",
|
|
user_memo="房产税务缴税",
|
|
cash_type="税务缴款",
|
|
dr_amount=88000.0,
|
|
le_name=le_name,
|
|
account_mask_no=account_no,
|
|
customer_account_mask_no="6222024555500004",
|
|
),
|
|
_build_statement(
|
|
group_id,
|
|
log_id,
|
|
trx_datetime=REFERENCE_NOW - timedelta(days=5, hours=2),
|
|
cret_no=IDENTITY_POOL["staff_secondary"]["id_card"],
|
|
customer_name="浙江远望贸易有限公司",
|
|
user_memo="经营往来收入",
|
|
cash_type="对公转账",
|
|
cr_amount=18800000.0,
|
|
le_name=le_name,
|
|
account_mask_no=account_no,
|
|
customer_account_mask_no="6222024666600001",
|
|
),
|
|
_build_statement(
|
|
group_id,
|
|
log_id,
|
|
trx_datetime=REFERENCE_NOW - timedelta(days=5, hours=1),
|
|
cret_no=IDENTITY_POOL["staff_secondary"]["id_card"],
|
|
customer_name="浙江远望贸易有限公司",
|
|
user_memo="项目回款收入",
|
|
cash_type="对公转账",
|
|
cr_amount=20800000.0,
|
|
le_name=le_name,
|
|
account_mask_no=account_no,
|
|
customer_account_mask_no="6222024666600001",
|
|
),
|
|
_build_statement(
|
|
group_id,
|
|
log_id,
|
|
trx_datetime=REFERENCE_NOW - timedelta(days=4, hours=4),
|
|
cret_no=IDENTITY_POOL["staff_secondary"]["id_card"],
|
|
customer_name="浙江远望贸易有限公司",
|
|
user_memo="业务合作收入",
|
|
cash_type="对公转账",
|
|
cr_amount=20700000.0,
|
|
le_name=le_name,
|
|
account_mask_no=account_no,
|
|
customer_account_mask_no="6222024666600001",
|
|
),
|
|
_build_statement(
|
|
group_id,
|
|
log_id,
|
|
trx_datetime=datetime(2026, 3, 10, 9, 0, 0),
|
|
cret_no=IDENTITY_POOL["staff_primary"]["id_card"],
|
|
customer_name="",
|
|
user_memo="现金存款",
|
|
cash_type="现金存款",
|
|
cr_amount=3000000.0,
|
|
le_name=le_name,
|
|
account_mask_no=account_no,
|
|
),
|
|
_build_statement(
|
|
group_id,
|
|
log_id,
|
|
trx_datetime=datetime(2026, 3, 10, 9, 30, 0),
|
|
cret_no=IDENTITY_POOL["staff_primary"]["id_card"],
|
|
customer_name="",
|
|
user_memo="ATM现金存款",
|
|
cash_type="现金存款",
|
|
cr_amount=3100000.0,
|
|
le_name=le_name,
|
|
account_mask_no=account_no,
|
|
),
|
|
_build_statement(
|
|
group_id,
|
|
log_id,
|
|
trx_datetime=datetime(2026, 3, 10, 10, 0, 0),
|
|
cret_no=IDENTITY_POOL["staff_primary"]["id_card"],
|
|
customer_name="",
|
|
user_memo="自助存款现金存入",
|
|
cash_type="现金存款",
|
|
cr_amount=3200000.0,
|
|
le_name=le_name,
|
|
account_mask_no=account_no,
|
|
),
|
|
_build_statement(
|
|
group_id,
|
|
log_id,
|
|
trx_datetime=datetime(2026, 3, 10, 10, 30, 0),
|
|
cret_no=IDENTITY_POOL["staff_primary"]["id_card"],
|
|
customer_name="",
|
|
user_memo="CRS存款",
|
|
cash_type="现金存款",
|
|
cr_amount=3300000.0,
|
|
le_name=le_name,
|
|
account_mask_no=account_no,
|
|
),
|
|
_build_statement(
|
|
group_id,
|
|
log_id,
|
|
trx_datetime=datetime(2026, 3, 10, 11, 0, 0),
|
|
cret_no=IDENTITY_POOL["staff_primary"]["id_card"],
|
|
customer_name="",
|
|
user_memo="本行ATM存款",
|
|
cash_type="现金存款",
|
|
cr_amount=3400000.0,
|
|
le_name=le_name,
|
|
account_mask_no=account_no,
|
|
),
|
|
_build_statement(
|
|
group_id,
|
|
log_id,
|
|
trx_datetime=datetime(2026, 3, 10, 11, 30, 0),
|
|
cret_no=IDENTITY_POOL["staff_primary"]["id_card"],
|
|
customer_name="",
|
|
user_memo="柜面现金存款",
|
|
cash_type="现金存款",
|
|
cr_amount=3500000.0,
|
|
le_name=le_name,
|
|
account_mask_no=account_no,
|
|
),
|
|
_build_statement(
|
|
group_id,
|
|
log_id,
|
|
trx_datetime=REFERENCE_NOW - timedelta(days=3, hours=1),
|
|
cret_no=IDENTITY_POOL["staff_secondary"]["id_card"],
|
|
customer_name="异地转账平台",
|
|
user_memo="手机银行转账",
|
|
cash_type="转账支出",
|
|
dr_amount=12000000.0,
|
|
le_name=le_name,
|
|
account_mask_no=account_no,
|
|
customer_account_mask_no="6222024777700001",
|
|
),
|
|
_build_statement(
|
|
group_id,
|
|
log_id,
|
|
trx_datetime=REFERENCE_NOW - timedelta(days=3, hours=2),
|
|
cret_no=IDENTITY_POOL["staff_secondary"]["id_card"],
|
|
customer_name="跨行转账中心",
|
|
user_memo="对外转账",
|
|
cash_type="转账支出",
|
|
dr_amount=10000000.0,
|
|
le_name=le_name,
|
|
account_mask_no=account_no,
|
|
customer_account_mask_no="6222024777700002",
|
|
),
|
|
_build_statement(
|
|
group_id,
|
|
log_id,
|
|
trx_datetime=REFERENCE_NOW - timedelta(days=2, hours=5),
|
|
cret_no=IDENTITY_POOL["staff_secondary"]["id_card"],
|
|
customer_name="跨境转账服务平台",
|
|
user_memo="网银转账",
|
|
cash_type="转账支出",
|
|
dr_amount=9000000.0,
|
|
le_name=le_name,
|
|
account_mask_no=account_no,
|
|
customer_account_mask_no="6222024777700003",
|
|
),
|
|
])
|
|
|
|
return statements
|