From 3feed5879e5a9b794862bf46d38c7f66cfe41d50 Mon Sep 17 00:00:00 2001
From: xusd <330628789@qq.com>
Date: Wed, 25 Jun 2025 21:36:08 +0800
Subject: [PATCH] feature:增加市民编号,增加AI问答

---
 dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseInfoMapper.xml |  101 +++++++++++++++++++++++++++++++++++---------------
 1 files changed, 70 insertions(+), 31 deletions(-)

diff --git a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseInfoMapper.xml b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseInfoMapper.xml
index 45a367f..10fe974 100644
--- a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseInfoMapper.xml
+++ b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseInfoMapper.xml
@@ -139,7 +139,10 @@
     <!-- 表 -->
     <sql id='table-name'>dyh_case_info</sql>
     <sql id="column-part-all">
-        a.id,
+        a
+        .
+        id
+        ,
         a.status,
         a.status_name,
         a.canal,
@@ -187,7 +190,8 @@
     </sql>
     <!-- 字段 -->
     <sql id="column-part">
-        id,
+        id
+        ,
         case_title,
         case_ref,
         case_level,
@@ -392,7 +396,8 @@
                 </if>
                 <if test="terms.caseTypeFirstList != null and terms.caseTypeFirstList.size > 0">
                     and a.case_type_first in
-                    <foreach collection="terms.caseTypeFirstList" item="caseTypeFirst" index="index" open="(" separator="," close=")">
+                    <foreach collection="terms.caseTypeFirstList" item="caseTypeFirst" index="index" open="("
+                             separator="," close=")">
                         #{caseTypeFirst}
                     </foreach>
                 </if>
@@ -415,7 +420,8 @@
                     and (b.belong_unit_id is not null and c.city = #{terms.queCity}
                     <if test="terms.unitGrades != null and terms.unitGrades.size > 0">
                         and c.unit_grade in
-                        <foreach collection="terms.unitGrades" item="unitGrade" index="index" open="(" separator="," close=")">
+                        <foreach collection="terms.unitGrades" item="unitGrade" index="index" open="(" separator=","
+                                 close=")">
                             #{unitGrade}
                         </foreach>
                     </if>
@@ -430,7 +436,8 @@
                                  close=")">
                             #{unitGrade}
                         </foreach>
-                    </if>)
+                    </if>
+                    )
                     or (b.belong_unit_id is null and a.que_city = #{terms.queCity})
                     )
                 </if>
@@ -438,7 +445,8 @@
                     and (b.belong_unit_id is not null and c.area = #{terms.queArea}
                     <if test="terms.unitGrades != null and terms.unitGrades.size > 0">
                         and c.unit_grade in
-                        <foreach collection="terms.unitGrades" item="unitGrade" index="index" open="(" separator="," close=")">
+                        <foreach collection="terms.unitGrades" item="unitGrade" index="index" open="(" separator=","
+                                 close=")">
                             #{unitGrade}
                         </foreach>
                     </if>
@@ -448,7 +456,8 @@
                     and ((b.belong_unit_id is not null and c.area = #{terms.queArea}
                     <if test="terms.unitGrades != null and terms.unitGrades.size > 0">
                         and c.unit_grade in
-                        <foreach collection="terms.unitGrades" item="unitGrade" index="index" open="(" separator="," close=")">
+                        <foreach collection="terms.unitGrades" item="unitGrade" index="index" open="(" separator=","
+                                 close=")">
                             #{unitGrade}
                         </foreach>
                     </if>
@@ -461,7 +470,8 @@
                     and (b.belong_unit_id is not null and c.road = #{terms.queRoad}
                     <if test="terms.unitGrades != null and terms.unitGrades.size > 0">
                         and c.unit_grade in
-                        <foreach collection="terms.unitGrades" item="unitGrade" index="index" open="(" separator="," close=")">
+                        <foreach collection="terms.unitGrades" item="unitGrade" index="index" open="(" separator=","
+                                 close=")">
                             #{unitGrade}
                         </foreach>
                     </if>
@@ -472,7 +482,8 @@
                     and ((b.belong_unit_id is not null and c.road = #{terms.queRoad}
                     <if test="terms.unitGrades != null and terms.unitGrades.size > 0">
                         and c.unit_grade in
-                        <foreach collection="terms.unitGrades" item="unitGrade" index="index" open="(" separator="," close=")">
+                        <foreach collection="terms.unitGrades" item="unitGrade" index="index" open="(" separator=","
+                                 close=")">
                             #{unitGrade}
                         </foreach>
                     </if>
@@ -483,7 +494,8 @@
                     and (b.belong_unit_id is not null and c.village = #{terms.queVillage}
                     <if test="terms.unitGrades != null and terms.unitGrades.size > 0">
                         and c.unit_grade in
-                        <foreach collection="terms.unitGrades" item="unitGrade" index="index" open="(" separator="," close=")">
+                        <foreach collection="terms.unitGrades" item="unitGrade" index="index" open="(" separator=","
+                                 close=")">
                             #{unitGrade}
                         </foreach>
                     </if>
@@ -576,6 +588,9 @@
                 <if test="terms.fileStart != null and terms.fileStart !='' and terms.fileEnd != null and terms.fileEnd !=''">
                     and (DATE_FORMAT(b.file_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ >= ]]> #{terms.fileStart}
                     and DATE_FORMAT(b.file_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ <= ]]> #{terms.fileEnd})
+                </if>
+                <if test="terms.cityCode != null and terms.cityCode !=''">
+                    and e.citizen_event_code = #{terms.cityCode}
                 </if>
             </where>
         </if>
@@ -962,7 +977,8 @@
 
     <select id="pageTermsCaseRegister" resultType="cn.huge.module.cases.domain.dto.CaseRegisterDTO">
         SELECT
-        t1.id as caseId,t1.create_time as createTime,t1.input_user_name as inputUserName,t1.status_name as statusName,t1.case_level as
+        t1.id as caseId,t1.create_time as createTime,t1.input_user_name as inputUserName,t1.status_name as
+        statusName,t1.case_level as
         caseLevel,t1.canal_name as canalName,
         t1.case_type_first_name as caseTypeFirstName,t1.case_type_name as caseTypeName,t1.plaintiffs as
         plaintiffs,t1.defendants as defendants,t2.medi_result_name as mediResultName,
@@ -986,7 +1002,7 @@
     </select>
 
 
-    <select id="countTermsCaseRegister" resultType="java.lang.Long" >
+    <select id="countTermsCaseRegister" resultType="java.lang.Long">
         SELECT
         count(t1.id)
         FROM
@@ -1001,6 +1017,9 @@
         from
         dyh_case_info a LEFT JOIN dyh_case_info_unfold b on a.id = b.id
         LEFT JOIN dyh_ct_unit c ON b.belong_unit_id = c.id
+        <if test="terms.cityCode != null and terms.cityCode !=''">
+            left join dyh_th_grid_citizen_event e on e.case_id = a.id
+        </if>
         <include refid="where-part-all"/>
     </select>
 
@@ -1012,6 +1031,9 @@
         dyh_case_info a LEFT JOIN dyh_case_info_unfold b on a.id = b.id
         LEFT JOIN dyh_ct_unit c ON b.belong_unit_id = c.id
         left join (select id ,case_id from dyh_case_task group by case_id) d on a.id = d.case_id
+        <if test="terms.cityCode != null and terms.cityCode !=''">
+            left join dyh_th_grid_citizen_event d on d.case_id = a.id
+        </if>
         <include refid="where-part-all"/>
         <if test="page.sort != null">
             <foreach collection="page.sort" item="s" index="index" separator="," open="order by ">
@@ -1066,16 +1088,20 @@
     <select id="statisticsArea" resultType="cn.huge.module.cases.domain.dto.CaseStatisticsAreaDTO">
         SELECT
         <if test='terms.areaType == null or terms.areaType =="1"'>
-            IF(c.city is null,a.que_city,c.city) as areaCode,IF(c.city_name is null,a.que_city_name,c.city_name) as areaName,
+            IF(c.city is null,a.que_city,c.city) as areaCode,IF(c.city_name is null,a.que_city_name,c.city_name) as
+            areaName,
         </if>
         <if test='terms.areaType != null and terms.areaType =="2"'>
-            IF(c.area is null,a.que_area,c.area) as areaCode,IF(c.area_name is null,a.que_area_name,c.area_name) as areaName,
+            IF(c.area is null,a.que_area,c.area) as areaCode,IF(c.area_name is null,a.que_area_name,c.area_name) as
+            areaName,
         </if>
         <if test='terms.areaType != null and terms.areaType =="3"'>
-            IF(c.road is null,a.que_road,c.road) as areaCode,IF(c.road_name is null,a.que_road_name,c.road_name) as areaName,
+            IF(c.road is null,a.que_road,c.road) as areaCode,IF(c.road_name is null,a.que_road_name,c.road_name) as
+            areaName,
         </if>
         <if test='terms.areaType != null and terms.areaType =="4"'>
-            IF(c.village is null,a.que_village,c.village) as areaCode,IF(c.village_name is null,a.que_village_name,c.village_name) as areaName,
+            IF(c.village is null,a.que_village,c.village) as areaCode,IF(c.village_name is
+            null,a.que_village_name,c.village_name) as areaName,
         </if>
         c.unit_grade as unitGrade,
         count(1) as caseNum,
@@ -1121,7 +1147,7 @@
         sum(case when a.case_level = 2 then 1 else 0 end) as twoLevelNum,
         sum(case when a.case_level = 3 then 1 else 0 end) as threeLevelNum,
         sum(case when a.info_process = 2 then 1
-                when a.info_process = 1 then 1   else 0 end) as processNum,
+        when a.info_process = 1 then 1 else 0 end) as processNum,
         sum(case when a.info_process = 3 and b.medi_result = '22_00025-1' then 1 else 0 end) as finishNum,
         sum(case when a.info_process = 4 then 1 else 0 end) as rejectNum,
         sum(case when a.info_process = 3 and b.medi_result = '22_00025-2' then 1 else 0 end) as failNum,
@@ -1278,14 +1304,20 @@
         <if test='terms.areaType != null and terms.areaType =="4"'>
             ifnull(t2.village_name, '本级') as areaName,ifnull(t2.village, '1') as areaCode,
         </if>
-        count(distinct case when (t1.node_id = 'DSRPJ' or t1.node_id = 'JAGD' or t1.node_id = 'ZJ_DFP' or t1.node_id = 'QJ_DFP'
-        or t1.node_id = 'SJ_DFP' or t1.node_id = 'DFP' or t1.node_id = 'ZJ_DSL' or t1.node_id = 'QJ_DSL' or t1.node_id = 'SJ_DSL'
-        or  t1.node_id = 'DSL' or t1.node_id = 'QJ_SBSH' or t1.node_id = 'SJ_SBSH' or t1.node_id = 'HTSH' or t1.node_id = 'ZJ_HTSH'
+        count(distinct case when (t1.node_id = 'DSRPJ' or t1.node_id = 'JAGD' or t1.node_id = 'ZJ_DFP' or t1.node_id =
+        'QJ_DFP'
+        or t1.node_id = 'SJ_DFP' or t1.node_id = 'DFP' or t1.node_id = 'ZJ_DSL' or t1.node_id = 'QJ_DSL' or t1.node_id =
+        'SJ_DSL'
+        or t1.node_id = 'DSL' or t1.node_id = 'QJ_SBSH' or t1.node_id = 'SJ_SBSH' or t1.node_id = 'HTSH' or t1.node_id =
+        'ZJ_HTSH'
         or t1.node_id = 'QJ_HTSH' or t1.node_id = 'SJ_HTSH')then t1.id end) as flowAllNum,
-        count(distinct case when (t1.node_id = 'ZJ_DFP' or t1.node_id = 'QJ_DFP' or t1.node_id = 'SJ_DFP' or t1.node_id = 'DFP') then t1.id end) as flowJbNum,
-        count(distinct case when (t1.node_id = 'ZJ_DSL' or t1.node_id = 'QJ_DSL' or t1.node_id = 'SJ_DSL' or  t1.node_id = 'DSL') then t1.id end) as flowSlNum,
+        count(distinct case when (t1.node_id = 'ZJ_DFP' or t1.node_id = 'QJ_DFP' or t1.node_id = 'SJ_DFP' or t1.node_id
+        = 'DFP') then t1.id end) as flowJbNum,
+        count(distinct case when (t1.node_id = 'ZJ_DSL' or t1.node_id = 'QJ_DSL' or t1.node_id = 'SJ_DSL' or t1.node_id
+        = 'DSL') then t1.id end) as flowSlNum,
         count(distinct case when (t1.node_id = 'QJ_SBSH' or t1.node_id = 'SJ_SBSH') then t1.id end) as flowSbNum,
-        count(distinct case when (t1.node_id = 'HTSH' or t1.node_id = 'ZJ_HTSH' or t1.node_id = 'QJ_HTSH' or t1.node_id = 'SJ_HTSH') then t1.id end) as flowHtNum,
+        count(distinct case when (t1.node_id = 'HTSH' or t1.node_id = 'ZJ_HTSH' or t1.node_id = 'QJ_HTSH' or t1.node_id
+        = 'SJ_HTSH') then t1.id end) as flowHtNum,
         count(distinct case when (t1.node_id = 'DSRPJ' or t1.node_id = 'JAGD') then t1.id end) as flowBjNum
         from
         (SELECT case_id, node_id, handle_time, create_time, cande_unit_id, id, status
@@ -1296,9 +1328,11 @@
         where status = 2 or (status = 1 and (node_id = 'DSRPJ' or node_id = 'JAGD'))
         ) s
         WHERE rn = 1 AND ((DATE_FORMAT(s.handle_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.startDate}
-        and DATE_FORMAT(s.handle_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.endDate}) OR DATE_FORMAT(s.create_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.startDate}
+        and DATE_FORMAT(s.handle_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.endDate}) OR
+        DATE_FORMAT(s.create_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.startDate}
         and DATE_FORMAT(s.create_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.endDate}) group by s.case_id) t1
-        left join dyh_ct_unit t2 on (t1.cande_unit_id = t2.id) or (t1.cande_unit_id is null and t2.id = (select mediate_unit_id from dyh_case_info_unfold where id = t1.case_id))
+        left join dyh_ct_unit t2 on (t1.cande_unit_id = t2.id) or (t1.cande_unit_id is null and t2.id = (select
+        mediate_unit_id from dyh_case_info_unfold where id = t1.case_id))
         <where>
             <if test="terms.queCity != null and terms.queCity !=''">
                 and t2.city = #{terms.queCity}
@@ -1362,7 +1396,8 @@
         </if>
         count(distinct case when t2.info_process = 1 or t2.info_process = 2 then t2.id end) as sourceHjzNum,
         count(distinct case when t2.info_process = 3 and t3.medi_result = '22_00025-1' then t2.id end) as sourceHjcgNum,
-        count(distinct case when t2.info_process = 3 and t3.medi_result = '22_00025-2' then t2.id end) as sourceHjbcgNum,
+        count(distinct case when t2.info_process = 3 and t3.medi_result = '22_00025-2' then t2.id end) as
+        sourceHjbcgNum,
         count(distinct case when t2.info_process = 4 then t2.id end) as sourceByslNum
         from (SELECT case_id, node_id, create_time, cande_unit_id, id, status,handle_result
         FROM (
@@ -1370,7 +1405,8 @@
         ROW_NUMBER() OVER (PARTITION BY case_id ORDER BY node_type desc, create_time DESC) AS rn
         FROM dyh_case_task where node_id != 'DSRPJ' and delete_status = 0
         ) s
-        WHERE rn = 1 group by s.case_id)t1 left join dyh_case_info t2 on t2.id = t1.case_id left join dyh_case_info_unfold t3 on t2.id = t3.id
+        WHERE rn = 1 group by s.case_id)t1 left join dyh_case_info t2 on t2.id = t1.case_id left join
+        dyh_case_info_unfold t3 on t2.id = t3.id
         left join dyh_ct_unit t4 on t3.belong_unit_id = t4.id
         <where>
             and t2.delete_status = 0 and t4.delete_status = 0
@@ -1453,21 +1489,24 @@
     </select>
 
     <update id="deleteCaseById">
-        update dyh_case_info set delete_status = 1,update_time = #{updateTime} where id = #{id}
+        update dyh_case_info
+        set delete_status = 1,
+            update_time   = #{updateTime}
+        where id = #{id}
     </update>
 
     <!-- 统计指定canal值下按canal_second分组的案件数量 -->
     <select id="countByCanalSecond" resultType="cn.huge.module.cases.domain.dto.CaseStatisticsTypeDTO">
         SELECT
-            a.canal_second as caseType,
-            COUNT(*) as caseNum
+        a.canal_second as caseType,
+        COUNT(*) as caseNum
         FROM
         dyh_case_info a
         inner JOIN dyh_case_info_unfold b on a.id = b.id
         LEFT JOIN dyh_ct_unit c ON b.belong_unit_id = c.id
         <include refid="where-part-all"/>
         GROUP BY
-            a.canal_second
+        a.canal_second
     </select>
 
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0