调整流水打标规则口径
This commit is contained in:
@@ -388,11 +388,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
staff.id_card AS idCard,
|
||||
SUM(IFNULL(bs.AMOUNT_DR, 0) + IFNULL(bs.AMOUNT_CR, 0)) AS annualAmount
|
||||
from ccdi_bank_statement bs
|
||||
inner join (
|
||||
select
|
||||
max(COALESCE(
|
||||
STR_TO_DATE(LEFT(TRIM(anchor_bs.TRX_DATE), 19), '%Y-%m-%d %H:%i:%s'),
|
||||
STR_TO_DATE(LEFT(TRIM(anchor_bs.TRX_DATE), 10), '%Y-%m-%d')
|
||||
)) AS anchorDate
|
||||
from ccdi_bank_statement anchor_bs
|
||||
where anchor_bs.project_id = #{projectId}
|
||||
) project_anchor on project_anchor.anchorDate is not null
|
||||
inner join ccdi_base_staff staff on staff.id_card = bs.cret_no
|
||||
where bs.project_id = #{projectId}
|
||||
and IFNULL(bs.LE_ACCOUNT_NAME, '') <> IFNULL(bs.CUSTOMER_ACCOUNT_NAME, '')
|
||||
and <include refid="financialProductExclusionPredicate"/>
|
||||
and STR_TO_DATE(LEFT(TRIM(bs.TRX_DATE), 10), '%Y-%m-%d') >= DATE_SUB(CURDATE(), INTERVAL 12 MONTH)
|
||||
and 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')
|
||||
) >= DATE_SUB(project_anchor.anchorDate, INTERVAL 12 MONTH)
|
||||
group by staff.id_card
|
||||
having SUM(IFNULL(bs.AMOUNT_DR, 0) + IFNULL(bs.AMOUNT_CR, 0)) > #{threshold}
|
||||
) t
|
||||
@@ -541,11 +553,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
max(IFNULL(bs.LE_ACCOUNT_NAME, '')) AS personName,
|
||||
ROUND(SUM(GREATEST(IFNULL(bs.AMOUNT_DR, 0), IFNULL(bs.AMOUNT_CR, 0))), 2) AS annualAmount
|
||||
from ccdi_bank_statement bs
|
||||
inner join (
|
||||
select
|
||||
max(COALESCE(
|
||||
STR_TO_DATE(LEFT(TRIM(anchor_bs.TRX_DATE), 19), '%Y-%m-%d %H:%i:%s'),
|
||||
STR_TO_DATE(LEFT(TRIM(anchor_bs.TRX_DATE), 10), '%Y-%m-%d')
|
||||
)) AS anchorDate
|
||||
from ccdi_bank_statement anchor_bs
|
||||
where anchor_bs.project_id = #{projectId}
|
||||
) project_anchor on project_anchor.anchorDate is not null
|
||||
where bs.project_id = #{projectId}
|
||||
and <include refid="externalPersonPredicateSql"/>
|
||||
and GREATEST(IFNULL(bs.AMOUNT_DR, 0), IFNULL(bs.AMOUNT_CR, 0)) > 0
|
||||
and <include refid="financialProductExclusionPredicate"/>
|
||||
and STR_TO_DATE(LEFT(TRIM(bs.TRX_DATE), 10), '%Y-%m-%d') >= DATE_SUB(CURDATE(), INTERVAL 12 MONTH)
|
||||
and 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')
|
||||
) >= DATE_SUB(project_anchor.anchorDate, INTERVAL 12 MONTH)
|
||||
group by bs.cret_no
|
||||
having ROUND(SUM(GREATEST(IFNULL(bs.AMOUNT_DR, 0), IFNULL(bs.AMOUNT_CR, 0))), 2) > #{threshold}
|
||||
) t
|
||||
@@ -775,12 +799,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
CONCAT(
|
||||
'摘要/对手命中赌博敏感词,摘要“', IFNULL(bs.USER_MEMO, ''),
|
||||
'”,对手方“', IFNULL(bs.CUSTOMER_ACCOUNT_NAME, ''),
|
||||
'”,支出金额 ', CAST(IFNULL(bs.AMOUNT_DR, 0) AS CHAR), ' 元'
|
||||
'”,支出金额 ', CAST(IFNULL(bs.AMOUNT_DR, 0) AS CHAR),
|
||||
' 元,达到敏感交易最低金额 200 元'
|
||||
) AS reasonDetail
|
||||
from ccdi_bank_statement bs
|
||||
inner join ccdi_base_staff staff on staff.id_card = bs.cret_no
|
||||
where bs.project_id = #{projectId}
|
||||
and IFNULL(bs.AMOUNT_DR, 0) > 0
|
||||
and IFNULL(bs.AMOUNT_DR, 0) >= 200
|
||||
and (
|
||||
IFNULL(bs.USER_MEMO, '') REGEXP '游戏|抖币|体彩|福彩|彩票|赌博|赌球|下注|投注|球赛投注|外围|博彩|六合|时时彩|赛车|赌场|筹码|盘口|返水|洗码|庄家|闲家|百家乐|斗牛|炸金花|牌九|麻将|捕鱼|电子游艺|VIP666|USDT下注'
|
||||
or IFNULL(bs.CUSTOMER_ACCOUNT_NAME, '') REGEXP '游戏|抖币|体彩|福彩|彩票|赌博|赌球|下注|投注|球赛投注|外围|博彩|六合|时时彩|赛车|赌场|筹码|盘口|返水|洗码|庄家|闲家|百家乐|斗牛|炸金花|牌九|麻将|捕鱼|电子游艺|VIP666|USDT下注'
|
||||
@@ -796,12 +821,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
'外部人员“', IFNULL(bs.LE_ACCOUNT_NAME, ''),
|
||||
'”摘要/对手方命中疑似赌博关键词,摘要“', IFNULL(bs.USER_MEMO, ''),
|
||||
'”,对手方“', IFNULL(bs.CUSTOMER_ACCOUNT_NAME, ''),
|
||||
'”,交易金额 ', CAST(GREATEST(IFNULL(bs.AMOUNT_DR, 0), IFNULL(bs.AMOUNT_CR, 0)) AS CHAR), ' 元'
|
||||
'”,交易金额 ', CAST(GREATEST(IFNULL(bs.AMOUNT_DR, 0), IFNULL(bs.AMOUNT_CR, 0)) AS CHAR),
|
||||
' 元,达到敏感交易最低金额 200 元'
|
||||
) AS reasonDetail
|
||||
from ccdi_bank_statement bs
|
||||
where bs.project_id = #{projectId}
|
||||
and <include refid="externalPersonPredicateSql"/>
|
||||
and GREATEST(IFNULL(bs.AMOUNT_DR, 0), IFNULL(bs.AMOUNT_CR, 0)) > 0
|
||||
and GREATEST(IFNULL(bs.AMOUNT_DR, 0), IFNULL(bs.AMOUNT_CR, 0)) >= 200
|
||||
and (
|
||||
IFNULL(bs.USER_MEMO, '') REGEXP '游戏|抖币|体彩|福彩|彩票|赌博|赌球|下注|投注|球赛投注|外围|博彩|六合|时时彩|赛车|赌场|筹码|盘口|返水|洗码|庄家|闲家|百家乐|斗牛|炸金花|牌九|麻将|牌局|捕鱼|电子游艺|VIP666|USDT下注'
|
||||
or IFNULL(bs.CUSTOMER_ACCOUNT_NAME, '') REGEXP '游戏|抖币|体彩|福彩|彩票|赌博|赌球|下注|投注|球赛投注|外围|博彩|六合|时时彩|赛车|赌场|筹码|盘口|返水|洗码|庄家|闲家|百家乐|斗牛|炸金花|牌九|麻将|牌局|捕鱼|电子游艺|VIP666|USDT下注'
|
||||
@@ -1152,7 +1178,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
CONCAT(
|
||||
'物业缴费金额 ', CAST(trade.amountDr AS CHAR),
|
||||
' 元,对手方“', IFNULL(trade.customerAccountName, ''),
|
||||
'”,证件号 ', trade.personId, ' 名下无房产登记'
|
||||
'”,证件号 ', trade.personId, ' 名下无匹配房产登记'
|
||||
) AS reasonDetail
|
||||
from (
|
||||
select
|
||||
@@ -1161,14 +1187,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
bs.group_id AS groupId,
|
||||
bs.batch_id AS logId,
|
||||
IFNULL(bs.AMOUNT_DR, 0) AS amountDr,
|
||||
bs.CUSTOMER_ACCOUNT_NAME AS customerAccountName
|
||||
bs.CUSTOMER_ACCOUNT_NAME AS customerAccountName,
|
||||
bs.USER_MEMO AS userMemo
|
||||
from ccdi_bank_statement bs
|
||||
inner join ccdi_base_staff staff on staff.id_card = bs.cret_no
|
||||
where bs.project_id = #{projectId}
|
||||
and IFNULL(bs.AMOUNT_DR, 0) > 0
|
||||
and (
|
||||
IFNULL(bs.USER_MEMO, '') REGEXP '物业|物业费|管理费|物业服务|综合服务'
|
||||
or IFNULL(bs.CUSTOMER_ACCOUNT_NAME, '') REGEXP '物业|小区|花园|苑|中心|大厦|业委会|业主委员会|置业|房地产|服务中心|管理处|社区'
|
||||
IFNULL(bs.USER_MEMO, '') REGEXP '物业|物管|业委会|业主委员会|维修基金|住宅专项维修资金|房屋维修资金'
|
||||
or IFNULL(bs.CUSTOMER_ACCOUNT_NAME, '') REGEXP '物业|物管|业委会|业主委员会|维修基金|住宅专项维修资金|房屋维修资金'
|
||||
)
|
||||
|
||||
union all
|
||||
@@ -1179,26 +1206,39 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
bs.group_id AS groupId,
|
||||
bs.batch_id AS logId,
|
||||
IFNULL(bs.AMOUNT_DR, 0) AS amountDr,
|
||||
bs.CUSTOMER_ACCOUNT_NAME AS customerAccountName
|
||||
bs.CUSTOMER_ACCOUNT_NAME AS customerAccountName,
|
||||
bs.USER_MEMO AS userMemo
|
||||
from ccdi_bank_statement bs
|
||||
inner join ccdi_staff_fmy_relation relation on relation.relation_cert_no = bs.cret_no
|
||||
where bs.project_id = #{projectId}
|
||||
and relation.status = 1
|
||||
and IFNULL(bs.AMOUNT_DR, 0) > 0
|
||||
and (
|
||||
IFNULL(bs.USER_MEMO, '') REGEXP '物业|物业费|管理费|物业服务|综合服务'
|
||||
or IFNULL(bs.CUSTOMER_ACCOUNT_NAME, '') REGEXP '物业|小区|花园|苑|中心|大厦|业委会|业主委员会|置业|房地产|服务中心|管理处|社区'
|
||||
IFNULL(bs.USER_MEMO, '') REGEXP '物业|物管|业委会|业主委员会|维修基金|住宅专项维修资金|房屋维修资金'
|
||||
or IFNULL(bs.CUSTOMER_ACCOUNT_NAME, '') REGEXP '物业|物管|业委会|业主委员会|维修基金|住宅专项维修资金|房屋维修资金'
|
||||
)
|
||||
) trade
|
||||
left join (
|
||||
select distinct
|
||||
asset.person_id AS personId
|
||||
asset.person_id AS personId,
|
||||
asset.asset_name AS assetName
|
||||
from ccdi_asset_info asset
|
||||
where asset.asset_main_type = '房产'
|
||||
and asset.asset_sub_type = '住宅'
|
||||
and asset.asset_status = '正常'
|
||||
and trim(IFNULL(asset.asset_name, '')) != ''
|
||||
) asset
|
||||
on asset.personId = trade.personId
|
||||
and (
|
||||
(
|
||||
trim(IFNULL(trade.customerAccountName, '')) != ''
|
||||
and IFNULL(trade.customerAccountName, '') LIKE concat('%', asset.assetName, '%')
|
||||
)
|
||||
or (
|
||||
trim(IFNULL(trade.userMemo, '')) != ''
|
||||
and IFNULL(trade.userMemo, '') LIKE concat('%', asset.assetName, '%')
|
||||
)
|
||||
)
|
||||
where asset.personId is null
|
||||
</select>
|
||||
|
||||
|
||||
@@ -152,6 +152,49 @@ class CcdiBankTagAnalysisMapperXmlTest {
|
||||
assertTrue(!selectSql.contains("social_credit_code = bs"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void gamblingSensitiveKeywordRules_shouldIgnoreSmallAmountTransactions() throws Exception {
|
||||
String xml = readXml(RESOURCE);
|
||||
String staffSelectSql = extractSelectSql(xml, "selectGamblingSensitiveKeywordStatements");
|
||||
String externalSelectSql = extractSelectSql(xml, "selectExternalGamblingMemoStatements");
|
||||
|
||||
assertTrue(staffSelectSql.contains("IFNULL(bs.AMOUNT_DR, 0) >= 200"));
|
||||
assertTrue(staffSelectSql.contains("达到敏感交易最低金额 200 元"));
|
||||
assertTrue(externalSelectSql.contains(
|
||||
"GREATEST(IFNULL(bs.AMOUNT_DR, 0), IFNULL(bs.AMOUNT_CR, 0)) >= 200"
|
||||
));
|
||||
assertTrue(externalSelectSql.contains("达到敏感交易最低金额 200 元"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void annualTurnoverRules_shouldUseProjectStatementDateAsOneYearAnchor() throws Exception {
|
||||
String xml = readXml(RESOURCE);
|
||||
String staffSelectSql = extractSelectSql(xml, "selectAnnualTurnoverObjects");
|
||||
String externalSelectSql = extractSelectSql(xml, "selectExternalAnnualTurnoverObjects");
|
||||
|
||||
assertTrue(staffSelectSql.contains("project_anchor.anchorDate"));
|
||||
assertTrue(staffSelectSql.contains("DATE_SUB(project_anchor.anchorDate, INTERVAL 12 MONTH)"));
|
||||
assertFalse(staffSelectSql.contains("CURDATE()"));
|
||||
assertTrue(externalSelectSql.contains("project_anchor.anchorDate"));
|
||||
assertTrue(externalSelectSql.contains("DATE_SUB(project_anchor.anchorDate, INTERVAL 12 MONTH)"));
|
||||
assertFalse(externalSelectSql.contains("CURDATE()"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void propertyFeeMismatchRule_shouldUseReasonablePropertyKeywordsAndAssetNameMatching() throws Exception {
|
||||
String xml = readXml(RESOURCE);
|
||||
String selectSql = extractSelectSql(xml, "selectPropertyFeeRegistrationMismatchStatements");
|
||||
|
||||
assertTrue(selectSql.contains("物业|物管|业委会|业主委员会|维修基金|住宅专项维修资金|房屋维修资金"));
|
||||
assertFalse(selectSql.contains("中心"));
|
||||
assertFalse(selectSql.contains("社区"));
|
||||
assertFalse(selectSql.contains("大厦"));
|
||||
assertTrue(selectSql.contains("asset.asset_name AS assetName"));
|
||||
assertTrue(selectSql.contains("trade.customerAccountName"));
|
||||
assertTrue(selectSql.contains("trade.userMemo"));
|
||||
assertTrue(selectSql.contains("名下无匹配房产登记"));
|
||||
}
|
||||
|
||||
@Test
|
||||
void withdrawCntObjectRule_shouldUseRealSqlAndKeepObjectHitFields() throws Exception {
|
||||
String xml = readXml(RESOURCE);
|
||||
|
||||
Reference in New Issue
Block a user