实现结果总览排除可疑预警

This commit is contained in:
wjj
2026-07-09 14:49:02 +08:00
parent 9c02812675
commit 3f3e9268f2
22 changed files with 1549 additions and 32 deletions

View File

@@ -55,6 +55,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
from ccdi_bank_statement_tag_result
where project_id = #{projectId}
and bank_statement_id is not null
and not exists (
select 1
from ccdi_project_risk_exclusion ex
where ex.project_id = ccdi_bank_statement_tag_result.project_id
and ex.rule_code = ccdi_bank_statement_tag_result.rule_code
and ex.exclusion_type = 'STATEMENT'
and ex.bank_statement_id = ccdi_bank_statement_tag_result.bank_statement_id
)
and bank_statement_id IN
<foreach collection="bankStatementIds" item="item" open="(" separator="," close=")">
#{item}

View File

@@ -79,6 +79,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
on dept.dept_id = coalesce(direct_staff.dept_id, statement_staff.dept_id, family_staff.dept_id)
where tr.project_id = #{projectId}
and coalesce(direct_staff.id_card, statement_staff.id_card, family_staff.id_card) is not null
and not exists (
select 1
from ccdi_project_risk_exclusion ex
where ex.project_id = tr.project_id
and ex.rule_code = tr.rule_code
and (
(ex.exclusion_type = 'STATEMENT'
and ex.bank_statement_id = tr.bank_statement_id)
or (ex.exclusion_type = 'OBJECT'
and ex.staff_id_card = coalesce(direct_staff.id_card, statement_staff.id_card, family_staff.id_card))
)
)
</sql>
<delete id="deleteByProjectId">

View File

@@ -187,6 +187,18 @@
on relation.person_id = family_staff.id_card
where tr.project_id = #{projectId}
and coalesce(direct_staff.id_card, statement_staff.id_card, family_staff.id_card) is not null
and not exists (
select 1
from ccdi_project_risk_exclusion ex
where ex.project_id = tr.project_id
and ex.rule_code = tr.rule_code
and (
(ex.exclusion_type = 'STATEMENT'
and ex.bank_statement_id = tr.bank_statement_id)
or (ex.exclusion_type = 'OBJECT'
and ex.staff_id_card = coalesce(direct_staff.id_card, statement_staff.id_card, family_staff.id_card))
)
)
</sql>
<sql id="employeeRiskAggregateSql">
@@ -662,6 +674,14 @@
and trim(bs.CUSTOMER_ACCOUNT_NAME) != ''
and counter_intermediary.name = trim(bs.CUSTOMER_ACCOUNT_NAME)
where trim(ifnull(bs.LE_ACCOUNT_NAME, '')) != trim(ifnull(bs.CUSTOMER_ACCOUNT_NAME, ''))
and not exists (
select 1
from ccdi_project_risk_exclusion ex
where ex.project_id = tr.project_id
and ex.rule_code = tr.rule_code
and ex.exclusion_type = 'STATEMENT'
and ex.bank_statement_id = tr.bank_statement_id
)
union all
@@ -689,6 +709,14 @@
and tr.object_type = 'EXTERNAL_CERT_NO'
and tr.object_key = subject.cert_no
and tr.model_code in <include refid="externalModelCodeFilterSql"/>
where not exists (
select 1
from ccdi_project_risk_exclusion ex
where ex.project_id = tr.project_id
and ex.rule_code = tr.rule_code
and ex.exclusion_type = 'OBJECT'
and ex.staff_id_card = subject.cert_no
)
</sql>
<sql id="externalPersonAggregateSql">
@@ -972,6 +1000,14 @@
from ccdi_bank_statement_tag_result tr
where tr.project_id = #{query.projectId}
and tr.bank_statement_id is not null
and not exists (
select 1
from ccdi_project_risk_exclusion ex
where ex.project_id = tr.project_id
and ex.rule_code = tr.rule_code
and ex.exclusion_type = 'STATEMENT'
and ex.bank_statement_id = tr.bank_statement_id
)
<if test="query.modelCode != null and query.modelCode != ''">
and tr.model_code = #{query.modelCode}
</if>
@@ -1213,6 +1249,14 @@
where model_filter.project_id = #{query.projectId}
and model_filter.bank_statement_id = final_result.bankStatementId
and model_filter.model_code = #{query.modelCode}
and not exists (
select 1
from ccdi_project_risk_exclusion ex
where ex.project_id = model_filter.project_id
and ex.rule_code = model_filter.rule_code
and ex.exclusion_type = 'STATEMENT'
and ex.bank_statement_id = model_filter.bank_statement_id
)
)
</if>
</sql>
@@ -1305,6 +1349,14 @@
from ccdi_bank_statement_tag_result tr
where tr.project_id = #{query.projectId}
and tr.bank_statement_id is not null
and not exists (
select 1
from ccdi_project_risk_exclusion ex
where ex.project_id = tr.project_id
and ex.rule_code = tr.rule_code
and ex.exclusion_type = 'STATEMENT'
and ex.bank_statement_id = tr.bank_statement_id
)
group by tr.bank_statement_id
) tag_result on tag_result.bank_statement_id = final_result.bankStatementId
<include refid="suspiciousTransactionFilterSql"/>
@@ -1534,6 +1586,7 @@
<select id="selectPersonAnalysisObjectRows" resultType="com.ruoyi.ccdi.project.domain.vo.CcdiProjectPersonAnalysisObjectRecordVO">
select
max(tr.model_code) as modelCode,
tr.rule_code as ruleCode,
coalesce(max(staff.name), max(relation.relation_name), max(tr.object_key), max(tr.object_type)) as title,
max(case
when tr.object_type = 'STAFF_ID_CARD' then '员工对象'
@@ -1550,6 +1603,14 @@
and tr.object_key = relation.relation_cert_no
where tr.project_id = #{projectId}
and tr.bank_statement_id is null
and not exists (
select 1
from ccdi_project_risk_exclusion ex
where ex.project_id = tr.project_id
and ex.rule_code = tr.rule_code
and ex.exclusion_type = 'OBJECT'
and ex.staff_id_card = #{staffIdCard}
)
and (
tr.object_key = #{staffIdCard}
or exists (

View File

@@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.ccdi.project.mapper.CcdiProjectRiskExclusionMapper">
<resultMap id="CcdiProjectRiskExclusionMap"
type="com.ruoyi.ccdi.project.domain.entity.CcdiProjectRiskExclusion">
<id property="id" column="id"/>
<result property="projectId" column="project_id"/>
<result property="staffIdCard" column="staff_id_card"/>
<result property="ruleCode" column="rule_code"/>
<result property="exclusionType" column="exclusion_type"/>
<result property="bankStatementId" column="bank_statement_id"/>
<result property="excludeReason" column="exclude_reason"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="remark" column="remark"/>
</resultMap>
<insert id="upsertExclusion">
insert into ccdi_project_risk_exclusion (
project_id, staff_id_card, rule_code, exclusion_type, bank_statement_id,
exclude_reason, create_by, create_time, update_by, update_time, remark
) values (
#{exclusion.projectId}, #{exclusion.staffIdCard}, #{exclusion.ruleCode},
#{exclusion.exclusionType}, #{exclusion.bankStatementId}, #{exclusion.excludeReason},
#{exclusion.createBy}, #{exclusion.createTime}, #{exclusion.updateBy},
#{exclusion.updateTime}, #{exclusion.remark}
)
on duplicate key update
exclude_reason = values(exclude_reason),
update_by = values(update_by),
update_time = values(update_time),
remark = values(remark)
</insert>
<select id="countExistingRiskHit" resultType="int">
select count(1)
from ccdi_bank_statement_tag_result tr
where tr.project_id = #{exclusion.projectId}
and tr.rule_code = #{exclusion.ruleCode}
<choose>
<when test="exclusion.exclusionType == 'STATEMENT'">
and tr.bank_statement_id = #{exclusion.bankStatementId}
</when>
<otherwise>
and (
tr.object_key = #{exclusion.staffIdCard}
or exists (
select 1
from ccdi_bank_statement bs
where bs.bank_statement_id = tr.bank_statement_id
and bs.cret_no = #{exclusion.staffIdCard}
)
or exists (
select 1
from ccdi_staff_fmy_relation relation
where relation.status = 1
and relation.person_id = #{exclusion.staffIdCard}
and relation.relation_cert_no = tr.object_key
)
or exists (
select 1
from ccdi_staff_fmy_relation relation
inner join ccdi_bank_statement bs
on bs.cret_no = relation.relation_cert_no
where relation.status = 1
and relation.person_id = #{exclusion.staffIdCard}
and bs.bank_statement_id = tr.bank_statement_id
)
)
</otherwise>
</choose>
</select>
</mapper>