实现突然销户打标规则
This commit is contained in:
@@ -1211,6 +1211,60 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
) t
|
||||
</select>
|
||||
|
||||
<select id="selectSuddenAccountClosureObjects" resultMap="BankTagObjectHitResultMap">
|
||||
select
|
||||
'STAFF_ID_CARD' AS objectType,
|
||||
t.objectKey AS objectKey,
|
||||
CONCAT(
|
||||
'账户', t.accountNo,
|
||||
'于', DATE_FORMAT(t.invalidDate, '%Y-%m-%d'),
|
||||
'销户,销户前30天内最后交易日', DATE_FORMAT(t.lastTxDate, '%Y-%m-%d'),
|
||||
',累计交易金额', CAST(t.windowTotalAmount AS CHAR),
|
||||
'元,单笔最大金额', CAST(t.windowMaxSingleAmount AS CHAR),
|
||||
'元'
|
||||
) AS reasonDetail
|
||||
from (
|
||||
select
|
||||
staff.id_card AS objectKey,
|
||||
ai.account_no AS accountNo,
|
||||
ai.invalid_date AS invalidDate,
|
||||
max(tx.txDate) AS lastTxDate,
|
||||
round(sum(tx.tradeAmount), 2) AS windowTotalAmount,
|
||||
round(max(tx.tradeAmount), 2) AS windowMaxSingleAmount
|
||||
from ccdi_account_info ai
|
||||
inner join ccdi_base_staff staff
|
||||
on staff.id_card = ai.owner_id
|
||||
inner join (
|
||||
select
|
||||
trim(bs.LE_ACCOUNT_NO) AS accountNo,
|
||||
COALESCE(
|
||||
STR_TO_DATE(LEFT(TRIM(bs.TRX_DATE), 19), '%Y-%m-%d %H:%i:%s'),
|
||||
STR_TO_DATE(LEFT(TRIM(bs.TRX_DATE), 10), '%Y-%m-%d')
|
||||
) AS txDate,
|
||||
GREATEST(IFNULL(bs.AMOUNT_DR, 0), IFNULL(bs.AMOUNT_CR, 0)) AS tradeAmount
|
||||
from ccdi_bank_statement bs
|
||||
where bs.project_id = #{projectId}
|
||||
and trim(IFNULL(bs.LE_ACCOUNT_NO, '')) != ''
|
||||
) tx
|
||||
on tx.accountNo = trim(ai.account_no)
|
||||
where ai.owner_type = 'EMPLOYEE'
|
||||
and ai.status = 2
|
||||
and ai.invalid_date is not null
|
||||
and tx.txDate >= DATE_SUB(ai.invalid_date, INTERVAL 30 DAY)
|
||||
and tx.txDate < ai.invalid_date
|
||||
group by staff.id_card, ai.account_no, ai.invalid_date
|
||||
) t
|
||||
</select>
|
||||
|
||||
<select id="selectDormantAccountLargeActivationObjects" resultMap="BankTagObjectHitResultMap">
|
||||
select
|
||||
'STAFF_ID_CARD' AS objectType,
|
||||
'' AS objectKey,
|
||||
'占位SQL,待补充真实规则' AS reasonDetail
|
||||
from ccdi_bank_statement bs
|
||||
where 1 = 0
|
||||
</select>
|
||||
|
||||
<select id="selectLargeStockTradingStatements" resultMap="BankTagStatementHitResultMap">
|
||||
select
|
||||
bs.bank_statement_id AS bankStatementId,
|
||||
|
||||
Reference in New Issue
Block a user