新增征信维护查询与接口

This commit is contained in:
wkc
2026-03-24 09:13:08 +08:00
parent c22e379334
commit 155adbee7b
6 changed files with 339 additions and 1 deletions

View File

@@ -0,0 +1,86 @@
<?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.info.collection.mapper.CcdiCreditInfoQueryMapper">
<select id="selectCreditInfoPage" resultType="com.ruoyi.info.collection.domain.vo.CreditInfoListVO">
SELECT
s.staff_id,
s.name,
s.id_card,
d.dept_name,
debt_agg.query_date,
IFNULL(debt_agg.debt_count, 0) AS debt_count,
IFNULL(debt_agg.debt_total_amount, 0) AS debt_total_amount,
IFNULL(neg.civil_cnt, 0) AS civil_cnt,
IFNULL(neg.enforce_cnt, 0) AS enforce_cnt,
IFNULL(neg.adm_cnt, 0) AS adm_cnt
FROM ccdi_base_staff s
LEFT JOIN sys_dept d ON s.dept_id = d.dept_id
LEFT JOIN (
SELECT
person_id,
MAX(query_date) AS query_date,
COUNT(*) AS debt_count,
SUM(debt_total_amount) AS debt_total_amount
FROM ccdi_debts_info
GROUP BY person_id
) debt_agg ON debt_agg.person_id = s.id_card
LEFT JOIN ccdi_credit_negative_info neg ON neg.person_id = s.id_card
<where>
<if test="query != null and query.name != null and query.name != ''">
AND s.name LIKE CONCAT('%', #{query.name}, '%')
</if>
<if test="query != null and query.staffId != null and query.staffId != ''">
AND CAST(s.staff_id AS CHAR) = #{query.staffId}
</if>
<if test="query != null and query.idCard != null and query.idCard != ''">
AND s.id_card LIKE CONCAT('%', #{query.idCard}, '%')
</if>
<if test="query != null and query.maintained == '1'">
AND (debt_agg.person_id IS NOT NULL OR neg.person_id IS NOT NULL)
</if>
<if test="query != null and query.maintained == '0'">
AND debt_agg.person_id IS NULL
AND neg.person_id IS NULL
</if>
</where>
ORDER BY debt_agg.query_date DESC, s.staff_id DESC
</select>
<select id="selectCreditInfoSummaryByPersonId" resultType="com.ruoyi.info.collection.domain.vo.CreditInfoListVO">
SELECT
s.staff_id,
s.name,
s.id_card,
d.dept_name,
debt_agg.query_date,
IFNULL(debt_agg.debt_count, 0) AS debt_count,
IFNULL(debt_agg.debt_total_amount, 0) AS debt_total_amount,
IFNULL(neg.civil_cnt, 0) AS civil_cnt,
IFNULL(neg.enforce_cnt, 0) AS enforce_cnt,
IFNULL(neg.adm_cnt, 0) AS adm_cnt
FROM ccdi_base_staff s
LEFT JOIN sys_dept d ON s.dept_id = d.dept_id
LEFT JOIN (
SELECT
person_id,
MAX(query_date) AS query_date,
COUNT(*) AS debt_count,
SUM(debt_total_amount) AS debt_total_amount
FROM ccdi_debts_info
GROUP BY person_id
) debt_agg ON debt_agg.person_id = s.id_card
LEFT JOIN ccdi_credit_negative_info neg ON neg.person_id = s.id_card
WHERE s.id_card = #{personId}
LIMIT 1
</select>
<select id="selectLatestQueryDate" resultType="java.time.LocalDate">
SELECT MAX(query_date)
FROM ccdi_debts_info
WHERE person_id = #{personId}
</select>
</mapper>

View File

@@ -0,0 +1,38 @@
<?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.info.collection.mapper.CcdiCreditNegativeInfoMapper">
<resultMap id="CcdiCreditNegativeInfoResultMap" type="com.ruoyi.info.collection.domain.CcdiCreditNegativeInfo">
<id property="negativeId" column="negative_id"/>
<result property="personId" column="person_id"/>
<result property="personName" column="person_name"/>
<result property="queryDate" column="query_date"/>
<result property="civilCnt" column="civil_cnt"/>
<result property="enforceCnt" column="enforce_cnt"/>
<result property="admCnt" column="adm_cnt"/>
<result property="civilLmt" column="civil_lmt"/>
<result property="enforceLmt" column="enforce_lmt"/>
<result property="admLmt" column="adm_lmt"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<select id="selectByPersonId" resultMap="CcdiCreditNegativeInfoResultMap">
SELECT
negative_id, person_id, person_name, query_date, civil_cnt, enforce_cnt, adm_cnt,
civil_lmt, enforce_lmt, adm_lmt, create_by, create_time, update_by, update_time
FROM ccdi_credit_negative_info
WHERE person_id = #{personId}
LIMIT 1
</select>
<delete id="deleteByPersonId">
DELETE FROM ccdi_credit_negative_info
WHERE person_id = #{personId}
</delete>
</mapper>

View File

@@ -0,0 +1,50 @@
<?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.info.collection.mapper.CcdiDebtsInfoMapper">
<resultMap id="CcdiDebtsInfoResultMap" type="com.ruoyi.info.collection.domain.CcdiDebtsInfo">
<id property="debtId" column="debt_id"/>
<result property="personId" column="person_id"/>
<result property="personName" column="person_name"/>
<result property="queryDate" column="query_date"/>
<result property="debtMainType" column="debt_main_type"/>
<result property="debtSubType" column="debt_sub_type"/>
<result property="creditorType" column="creditor_type"/>
<result property="debtName" column="debt_name"/>
<result property="principalBalance" column="principal_balance"/>
<result property="debtTotalAmount" column="debt_total_amount"/>
<result property="debtStatus" column="debt_status"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
</resultMap>
<select id="selectByPersonId" resultMap="CcdiDebtsInfoResultMap">
SELECT
debt_id, person_id, person_name, query_date, debt_main_type, debt_sub_type, creditor_type,
debt_name, principal_balance, debt_total_amount, debt_status, create_by, create_time, update_by, update_time
FROM ccdi_debts_info
WHERE person_id = #{personId}
ORDER BY debt_id ASC
</select>
<delete id="deleteByPersonId">
DELETE FROM ccdi_debts_info
WHERE person_id = #{personId}
</delete>
<insert id="insertBatch">
INSERT INTO ccdi_debts_info
(person_id, person_name, query_date, debt_main_type, debt_sub_type, creditor_type,
debt_name, principal_balance, debt_total_amount, debt_status, create_by, create_time, update_by, update_time)
VALUES
<foreach collection="list" item="item" separator=",">
(#{item.personId}, #{item.personName}, #{item.queryDate}, #{item.debtMainType}, #{item.debtSubType}, #{item.creditorType},
#{item.debtName}, #{item.principalBalance}, #{item.debtTotalAmount}, #{item.debtStatus}, #{item.createBy}, NOW(), #{item.updateBy}, NOW())
</foreach>
</insert>
</mapper>