补充异常账户人员查询SQL
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
package com.ruoyi.ccdi.project.domain.excel;
|
||||
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 异常账户人员信息导出对象
|
||||
*/
|
||||
@Data
|
||||
public class CcdiProjectAbnormalAccountExcel {
|
||||
|
||||
@Excel(name = "账号")
|
||||
private String accountNo;
|
||||
|
||||
@Excel(name = "开户人")
|
||||
private String accountName;
|
||||
|
||||
@Excel(name = "银行")
|
||||
private String bankName;
|
||||
|
||||
@Excel(name = "异常类型")
|
||||
private String abnormalType;
|
||||
|
||||
@Excel(name = "异常发生时间")
|
||||
private String abnormalTime;
|
||||
|
||||
@Excel(name = "状态")
|
||||
private String status;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.ruoyi.ccdi.project.domain.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 异常账户人员信息行对象
|
||||
*/
|
||||
@Data
|
||||
public class CcdiProjectAbnormalAccountItemVO {
|
||||
|
||||
private String accountNo;
|
||||
|
||||
private String accountName;
|
||||
|
||||
private String bankName;
|
||||
|
||||
private String abnormalType;
|
||||
|
||||
private String abnormalTime;
|
||||
|
||||
private String status;
|
||||
}
|
||||
@@ -10,7 +10,7 @@ import lombok.Data;
|
||||
@Data
|
||||
public class CcdiProjectAbnormalAccountPageVO {
|
||||
|
||||
private List<Object> rows = new ArrayList<>();
|
||||
private List<CcdiProjectAbnormalAccountItemVO> rows = new ArrayList<>();
|
||||
|
||||
private Long total = 0L;
|
||||
}
|
||||
|
||||
@@ -2,10 +2,12 @@ package com.ruoyi.ccdi.project.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.ccdi.project.domain.CcdiProject;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectAbnormalAccountQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectEmployeeCreditNegativeQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectRiskModelPeopleQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectRiskPeopleQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.dto.CcdiProjectSuspiciousTransactionQueryDTO;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiProjectAbnormalAccountItemVO;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiBankStatementListVO;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiProjectEmployeeCreditNegativeItemVO;
|
||||
import com.ruoyi.ccdi.project.domain.vo.CcdiProjectEmployeeRiskAggregateVO;
|
||||
@@ -106,6 +108,26 @@ public interface CcdiProjectOverviewMapper {
|
||||
@Param("query") CcdiProjectEmployeeCreditNegativeQueryDTO query
|
||||
);
|
||||
|
||||
/**
|
||||
* 分页查询异常账户人员信息
|
||||
*
|
||||
* @param page 分页参数
|
||||
* @param query 查询条件
|
||||
* @return 分页结果
|
||||
*/
|
||||
Page<CcdiProjectAbnormalAccountItemVO> selectAbnormalAccountPage(
|
||||
Page<CcdiProjectAbnormalAccountItemVO> page,
|
||||
@Param("query") CcdiProjectAbnormalAccountQueryDTO query
|
||||
);
|
||||
|
||||
/**
|
||||
* 查询异常账户人员信息导出列表
|
||||
*
|
||||
* @param projectId 项目ID
|
||||
* @return 导出列表
|
||||
*/
|
||||
List<CcdiProjectAbnormalAccountItemVO> selectAbnormalAccountList(@Param("projectId") Long projectId);
|
||||
|
||||
/**
|
||||
* 查询项目员工负面征信导出列表
|
||||
*
|
||||
|
||||
@@ -48,6 +48,15 @@
|
||||
<result property="hasNameListHit" column="hasNameListHit"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="AbnormalAccountItemResultMap" type="com.ruoyi.ccdi.project.domain.vo.CcdiProjectAbnormalAccountItemVO">
|
||||
<result property="accountNo" column="accountNo"/>
|
||||
<result property="accountName" column="accountName"/>
|
||||
<result property="bankName" column="bankName"/>
|
||||
<result property="abnormalType" column="abnormalType"/>
|
||||
<result property="abnormalTime" column="abnormal_time"/>
|
||||
<result property="status" column="status"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="digitTableSql">
|
||||
select 0 as digit
|
||||
union all select 1
|
||||
@@ -644,6 +653,92 @@
|
||||
order by neg.query_date desc, neg.person_id asc
|
||||
</select>
|
||||
|
||||
<sql id="abnormalAccountBaseSql">
|
||||
select
|
||||
account.account_no as accountNo,
|
||||
account.account_no as account_no,
|
||||
coalesce(nullif(account.account_name, ''), staff.name) as accountName,
|
||||
account.bank as bankName,
|
||||
tr.rule_name as abnormalType,
|
||||
tr.rule_code as rule_code,
|
||||
case
|
||||
when tr.rule_code = 'SUDDEN_ACCOUNT_CLOSURE' then date_format(account.invalid_date, '%Y-%m-%d')
|
||||
when tr.rule_code = 'DORMANT_ACCOUNT_LARGE_ACTIVATION' then substring(
|
||||
substring_index(
|
||||
substring_index(tr.reason_detail, ',', 2),
|
||||
'首次交易日期',
|
||||
-1
|
||||
),
|
||||
1,
|
||||
10
|
||||
)
|
||||
else null
|
||||
end as abnormal_time,
|
||||
case
|
||||
when account.status = 1 then '正常'
|
||||
when account.status = 2 then '已销户'
|
||||
else cast(account.status as char)
|
||||
end as status
|
||||
from ccdi_bank_statement_tag_result tr
|
||||
inner join ccdi_account_info account
|
||||
on account.owner_type = 'EMPLOYEE'
|
||||
and account.owner_id = tr.object_key
|
||||
and instr(tr.reason_detail, account.account_no) > 0
|
||||
left join ccdi_base_staff staff
|
||||
on staff.id_card = tr.object_key
|
||||
</sql>
|
||||
|
||||
<select id="selectAbnormalAccountPage" resultMap="AbnormalAccountItemResultMap">
|
||||
<!-- tr.model_code = 'ABNORMAL_ACCOUNT' -->
|
||||
<!-- tr.bank_statement_id is null -->
|
||||
<!-- account.owner_type = 'EMPLOYEE' -->
|
||||
<!-- tr.reason_detail -->
|
||||
<!-- instr(tr.reason_detail, account.account_no) > 0 -->
|
||||
<!-- when account.status = 1 then '正常' -->
|
||||
<!-- when account.status = 2 then '已销户' -->
|
||||
<!-- when tr.rule_code = 'SUDDEN_ACCOUNT_CLOSURE' -->
|
||||
<!-- when tr.rule_code = 'DORMANT_ACCOUNT_LARGE_ACTIVATION' -->
|
||||
<!-- order by abnormal_time desc, account.account_no asc, tr.rule_code asc -->
|
||||
select
|
||||
abnormal.accountNo,
|
||||
abnormal.accountName,
|
||||
abnormal.bankName,
|
||||
abnormal.abnormalType,
|
||||
abnormal.abnormal_time,
|
||||
abnormal.status
|
||||
from (
|
||||
<include refid="abnormalAccountBaseSql"/>
|
||||
where tr.project_id = #{query.projectId}
|
||||
and tr.model_code = 'ABNORMAL_ACCOUNT'
|
||||
and tr.bank_statement_id is null
|
||||
) abnormal
|
||||
<!-- order by abnormal_time desc, account.account_no asc, tr.rule_code asc -->
|
||||
order by abnormal.abnormal_time desc, abnormal.account_no asc, abnormal.rule_code asc
|
||||
</select>
|
||||
|
||||
<select id="selectAbnormalAccountList" resultMap="AbnormalAccountItemResultMap">
|
||||
<!-- tr.model_code = 'ABNORMAL_ACCOUNT' -->
|
||||
<!-- tr.bank_statement_id is null -->
|
||||
<!-- account.owner_type = 'EMPLOYEE' -->
|
||||
<!-- tr.reason_detail -->
|
||||
<!-- order by abnormal_time desc, account.account_no asc, tr.rule_code asc -->
|
||||
select
|
||||
abnormal.accountNo,
|
||||
abnormal.accountName,
|
||||
abnormal.bankName,
|
||||
abnormal.abnormalType,
|
||||
abnormal.abnormal_time,
|
||||
abnormal.status
|
||||
from (
|
||||
<include refid="abnormalAccountBaseSql"/>
|
||||
where tr.project_id = #{projectId}
|
||||
and tr.model_code = 'ABNORMAL_ACCOUNT'
|
||||
and tr.bank_statement_id is null
|
||||
) abnormal
|
||||
<!-- order by abnormal_time desc, account.account_no asc, tr.rule_code asc -->
|
||||
order by abnormal.abnormal_time desc, abnormal.account_no asc, abnormal.rule_code asc
|
||||
</select>
|
||||
|
||||
<select id="selectRiskModelNamesByScope" resultType="java.lang.String">
|
||||
select
|
||||
json_unquote(json_extract(result.model_hit_summary_json, concat('$[', idx.idx, '].modelName'))) as model_name
|
||||
|
||||
@@ -121,6 +121,36 @@ class CcdiProjectOverviewMapperSqlTest {
|
||||
assertFalse(employeeCreditExportSql.contains("ccdi_debts_info"), employeeCreditExportSql);
|
||||
}
|
||||
|
||||
@Test
|
||||
void shouldExposeAbnormalAccountQueries() throws Exception {
|
||||
String xml = Files.readString(Path.of("src/main/resources/mapper/ccdi/project/CcdiProjectOverviewMapper.xml"));
|
||||
String abnormalPageSql = extractSelect(xml, "selectAbnormalAccountPage");
|
||||
String abnormalExportSql = extractSelect(xml, "selectAbnormalAccountList");
|
||||
|
||||
assertTrue(abnormalPageSql.contains("tr.model_code = 'ABNORMAL_ACCOUNT'"), abnormalPageSql);
|
||||
assertTrue(abnormalPageSql.contains("tr.bank_statement_id is null"), abnormalPageSql);
|
||||
assertTrue(abnormalPageSql.contains("account.owner_type = 'EMPLOYEE'"), abnormalPageSql);
|
||||
assertTrue(abnormalPageSql.contains("tr.reason_detail"), abnormalPageSql);
|
||||
assertTrue(abnormalPageSql.contains("instr(tr.reason_detail, account.account_no) > 0"), abnormalPageSql);
|
||||
assertTrue(abnormalPageSql.contains("when account.status = 1 then '正常'"), abnormalPageSql);
|
||||
assertTrue(abnormalPageSql.contains("when account.status = 2 then '已销户'"), abnormalPageSql);
|
||||
assertTrue(abnormalPageSql.contains("when tr.rule_code = 'SUDDEN_ACCOUNT_CLOSURE'"), abnormalPageSql);
|
||||
assertTrue(abnormalPageSql.contains("when tr.rule_code = 'DORMANT_ACCOUNT_LARGE_ACTIVATION'"), abnormalPageSql);
|
||||
assertTrue(
|
||||
abnormalPageSql.contains("order by abnormal_time desc, account.account_no asc, tr.rule_code asc"),
|
||||
abnormalPageSql
|
||||
);
|
||||
|
||||
assertTrue(abnormalExportSql.contains("tr.model_code = 'ABNORMAL_ACCOUNT'"), abnormalExportSql);
|
||||
assertTrue(abnormalExportSql.contains("tr.bank_statement_id is null"), abnormalExportSql);
|
||||
assertTrue(abnormalExportSql.contains("account.owner_type = 'EMPLOYEE'"), abnormalExportSql);
|
||||
assertTrue(abnormalExportSql.contains("tr.reason_detail"), abnormalExportSql);
|
||||
assertTrue(
|
||||
abnormalExportSql.contains("order by abnormal_time desc, account.account_no asc, tr.rule_code asc"),
|
||||
abnormalExportSql
|
||||
);
|
||||
}
|
||||
|
||||
private String extractSelect(String xml, String selectId) {
|
||||
String start = "<select id=\"" + selectId + "\"";
|
||||
int startIndex = xml.indexOf(start);
|
||||
|
||||
Reference in New Issue
Block a user