From c490640493f04e2ed0fc5c4c8fbc92ebdd4d5380 Mon Sep 17 00:00:00 2001
From: xusd <330628789@qq.com>
Date: Tue, 24 Jun 2025 21:06:48 +0800
Subject: [PATCH] Merge branch 'gzdyh_prod'

---
 dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dto/CtUnitTreeDTO.java                         |    1 
 dyh-service/dyh-mediate/src/main/java/cn/huge/module/analysis/controller/AnalysisWebController.java     |    5 
 dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtAccountService.java                  |    6 
 dyh-service/dyh-mediate/src/main/java/cn/huge/module/analysis/dao/mapper/xml/AnalysisMapper.xml         |  505 ++++++++++----
 dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseTaskService.java                 |   49 +
 dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/controller/web/CaseTaskWebController.java    |   76 ++
 dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/domain/dto/CaseStatisticsBaseDTO.java        |   44 
 dyh-service/dyh-cust/src/main/java/cn/huge/module/client/api/impl/SysClientImpl.java                    |    6 
 dyh-service/dyh-mediate/src/main/java/cn/huge/module/analysis/domain/dto/TimeoutTaskInfoDTO.java        |    1 
 dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/controller/web/CaseInfoWebController.java    |  104 +--
 sql/20250620.sql                                                                                        |   17 
 dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseInfoMapper.xml            |   41 
 dyh-service/dyh-disp/src/main/resources/config/application.yml                                          |    4 
 dyh-service/dyh-mediate/src/main/java/cn/huge/module/casebook/controller/web/CaseBookWebController.java |    1 
 dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseInfoService.java                 |  612 +++++++----------
 dyh-service/dyh-mediate/src/main/java/cn/huge/module/casebook/service/CasebookInfoService.java          |    4 
 dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseEvaluateService.java             |   26 
 dyh-service/dyh-sys/src/main/resources/config/application.yml                                           |    4 
 dyh-service/dyh-base/src/main/java/cn/huge/module/mediate/constant/CaseBaseConstsEnum.java              |    3 
 dyh-service/dyh-cust/src/main/java/cn/huge/module/utils/TreeUtils.java                                  |   47 +
 dyh-service/dyh-mediate/src/main/resources/config/application.yml                                       |    4 
 dyh-service/dyh-mediate/src/main/java/cn/huge/module/flow/service/FlowInfoService.java                  |    2 
 dyh-service/dyh-sys/src/main/java/cn/huge/module/timer/GridCityCaseTimer.java                           |  371 +++++-----
 dyh-service/dyh-utils/src/main/java/cn/huge/module/mediate/utils/CaseNoUtils.java                       |   24 
 24 files changed, 1,077 insertions(+), 880 deletions(-)

diff --git a/dyh-service/dyh-base/src/main/java/cn/huge/module/mediate/constant/CaseBaseConstsEnum.java b/dyh-service/dyh-base/src/main/java/cn/huge/module/mediate/constant/CaseBaseConstsEnum.java
index 7f73de0..81ef5eb 100644
--- a/dyh-service/dyh-base/src/main/java/cn/huge/module/mediate/constant/CaseBaseConstsEnum.java
+++ b/dyh-service/dyh-base/src/main/java/cn/huge/module/mediate/constant/CaseBaseConstsEnum.java
@@ -25,7 +25,8 @@
     CASE_CANAL_SECOND_4("22_00003-4", "人民调解"),
     CASE_CANAL_SECOND_5("22_00003-5", "劳动争议"),
     CASE_CANAL_SECOND_6("22_00003-6", "信访"),
-
+    CASE_CANAL_SECOND_7("22_00003-7", "专项治理"),
+    CASE_CANAL_SECOND_8("22_00003-8", "部门排查"),
     /**
      * 来访形式,24_00002-1:来访,24_00002-2:线上,24_00002-3:排查
      */
diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/client/api/impl/SysClientImpl.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/client/api/impl/SysClientImpl.java
index e3f2fa1..c2343a4 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/client/api/impl/SysClientImpl.java
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/client/api/impl/SysClientImpl.java
@@ -91,6 +91,12 @@
                 if (item.isLastOrgRole() && item.getRoleName().contains("调度干部")) {
                     BeanUtils.copyProperties(item, nowRoleDTO);
                 }
+                if (item.isLastOrgRole() && item.getRoleCode().equals("22_00024-2")) {
+                    BeanUtils.copyProperties(item, nowRoleDTO);
+                }
+//                if (item.isLastOrgRole() && item.getRoleName().contains("领导")) {
+//                    BeanUtils.copyProperties(item, nowRoleDTO);
+//                }
                 if (item.getRoleName().contains("(M)")) {
                     BeanUtils.copyProperties(item, roleDTO);
                 }
diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dto/CtUnitTreeDTO.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dto/CtUnitTreeDTO.java
index 0be3a84..32174d9 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dto/CtUnitTreeDTO.java
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/dto/CtUnitTreeDTO.java
@@ -14,5 +14,6 @@
     private String label;//对象名称
     private String parentId;//父类ID
     private Boolean checkable;
+    private Double sort;//排序
     private List<CtUnitTreeDTO> children;//子类集合
 }
diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtAccountService.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtAccountService.java
index da0c79b..27e7c43 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtAccountService.java
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/ctuser/service/CtAccountService.java
@@ -626,7 +626,7 @@
         } else if (parts.length >= 4) {
             return parts[0] + parts[1] + parts[2] + "-" + parts[3];
         } else if (parts.length >= 5) {
-            return parts[0] + parts[1] + parts[2] + "-" + parts[3]+"-" + parts[4];
+            return parts[0] + parts[1] + parts[2] + "-" + parts[3] + "-" + parts[4];
         } else {
             return input; // 或抛出异常
         }
@@ -674,7 +674,7 @@
         GridUserRoleVo gridUserRoleVo = new GridUserRoleVo();
         gridUserRoleVo.setUserId(userId);
         GridUserRoleDTO userRoleDTO = sysClient.getUserRoleList(gridUserRoleVo);
-        if (StringUtils.isEmpty(userRoleDTO.getRoleName()) || !userRoleDTO.getRoleName().contains("(M)")) {
+        if (StringUtils.isEmpty(userRoleDTO.getRoleName()) || (!userRoleDTO.getRoleName().contains("(M)") && !userRoleDTO.getRoleName().contains("领导") && !userRoleDTO.getRoleName().contains("调度干部"))) {
             return ReturnFailUtils.getRepInfo("该用户没有矛调系统的权限");
         }
         CtUserole ctUserole = new CtUserole();
@@ -730,7 +730,7 @@
             switch (grade) {
                 case 1:
                     //市级级
-                    ctUnit.setLevel(grade );
+                    ctUnit.setLevel(grade);
                     ctUnit.setUnitGrade(grade);
                     ctUnit.setUnitType(UserBaseConsts.UNIT_TYPE_102);
                     ctUnit.setParentId("2024000000000001");
diff --git a/dyh-service/dyh-cust/src/main/java/cn/huge/module/utils/TreeUtils.java b/dyh-service/dyh-cust/src/main/java/cn/huge/module/utils/TreeUtils.java
index 2fd2b10..f262adb 100644
--- a/dyh-service/dyh-cust/src/main/java/cn/huge/module/utils/TreeUtils.java
+++ b/dyh-service/dyh-cust/src/main/java/cn/huge/module/utils/TreeUtils.java
@@ -4,9 +4,7 @@
 import cn.huge.module.ctuser.dto.CtUnitTreeDTO;
 import org.apache.commons.collections.CollectionUtils;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
 
 /**
  * @author zhouxiantao
@@ -60,20 +58,22 @@
         List<CtUnitTreeDTO> termsList = new ArrayList<>();
         if(ObjectUtils.isNotEmpty(termsSet)){
             for (CtUnitTreeDTO selectTermDTO : termsSet) {
-                termsList.add(selectTermDTO);
-            }
-            termsList.sort((o1, o2)->{
-                String s1 = o1.getValue().replaceAll("[^0-9]", "");
+                String s1 = selectTermDTO.getValue().replaceAll("[^0-9]", "");
                 if(ObjectUtils.isEmpty(s1)){
                     s1 = "0";
                 }
-                String s2 = o2.getValue().replaceAll("[^0-9]", "");
-                if(ObjectUtils.isEmpty(s2)){
-                    s2 = "0";
-                }
                 Double totalScore1 = Double.valueOf(s1);
-                Double totalScore2 = Double.valueOf(s2);
-                if(totalScore1 < totalScore2) {
+                selectTermDTO.setSort(totalScore1);
+                String area = getArea(selectTermDTO.getLabel());
+                if(ObjectUtils.isNotEmpty(area)){
+                    selectTermDTO.setSort(Double.valueOf(area));
+                }
+                termsList.add(selectTermDTO);
+            }
+            termsList.sort((o1, o2)->{
+                Double totalScore1 = o1.getSort();
+                Double totalScore2 = o2.getSort();
+                if(totalScore1 > totalScore2) {
                     return 1;
                 }else if (totalScore1.equals(totalScore2)) {
                     return 0;
@@ -85,4 +85,25 @@
         return termsList;
     }
 
+    public static String getArea(String areaName) {
+        Map<String, String> map = new HashMap<>();
+        map.put("越秀区", "2");
+        map.put("海珠区", "3");
+        map.put("荔湾区", "4");
+        map.put("天河区", "5");
+        map.put("白云区", "6");
+        map.put("黄埔区", "7");
+        map.put("花都区", "8");
+        map.put("番禺区", "9");
+        map.put("南沙区", "10");
+        map.put("从化区", "11");
+        map.put("增城区", "12");
+        for (String s : map.keySet()) {
+            if(areaName.contains(s)){
+                return map.get(s);
+            }
+        }
+        return null;
+    }
+
 }
diff --git a/dyh-service/dyh-disp/src/main/resources/config/application.yml b/dyh-service/dyh-disp/src/main/resources/config/application.yml
index d7e0351..60b0e37 100644
--- a/dyh-service/dyh-disp/src/main/resources/config/application.yml
+++ b/dyh-service/dyh-disp/src/main/resources/config/application.yml
@@ -3,8 +3,8 @@
   profiles:
     active:
 #      - dev
-#      - test
-      - prod
+      - test
+#      - prod
 
   devtools:
     restart:
diff --git a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/analysis/controller/AnalysisWebController.java b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/analysis/controller/AnalysisWebController.java
index ba4ae6d..b15d77a 100644
--- a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/analysis/controller/AnalysisWebController.java
+++ b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/analysis/controller/AnalysisWebController.java
@@ -205,6 +205,11 @@
         if (StringUtils.isNotBlank(assistUnitId)){
             terms.put("assistUnitId", assistUnitId);
         }
+        //任务是否完成
+        String taskStatus = request.getParameter("taskStatus");
+        if (StringUtils.isNotBlank(taskStatus)){
+            terms.put("taskStatus", taskStatus);
+        }
         return terms;
     }
     /**
diff --git a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/analysis/dao/mapper/xml/AnalysisMapper.xml b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/analysis/dao/mapper/xml/AnalysisMapper.xml
index b174179..41c8515 100644
--- a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/analysis/dao/mapper/xml/AnalysisMapper.xml
+++ b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/analysis/dao/mapper/xml/AnalysisMapper.xml
@@ -29,13 +29,14 @@
                 t1.road,
             </if>
             <if test="terms.queRoad != null and terms.queRoad !=''">
-                (case when t1.village_name = '' or t1.village_name is null then '本级' else t1.village_name end)as groupName,
+                (case when t1.village_name = '' or t1.village_name is null then '本级' else t1.village_name end)as
+                groupName,
                 t1.village as groupCode,
                 t1.village,
             </if>
-<!--            <if test="terms.unitIds != null and terms.unitIds !=''">-->
-<!--                t1.unit_name as groupName,-->
-<!--            </if>-->
+            <!--            <if test="terms.unitIds != null and terms.unitIds !=''">-->
+            <!--                t1.unit_name as groupName,-->
+            <!--            </if>-->
         </if>
     </sql>
 
@@ -54,9 +55,9 @@
             <if test="terms.queRoad != null and terms.queRoad !=''">
                 (case when t1.village = '' or t1.village is null then '本级' else t1.village end)
             </if>
-<!--            <if test="terms.unitIds != null and terms.unitIds !=''">-->
-<!--                t1.id-->
-<!--            </if>-->
+            <!--            <if test="terms.unitIds != null and terms.unitIds !=''">-->
+            <!--                t1.id-->
+            <!--            </if>-->
         </if>
     </sql>
 
@@ -101,16 +102,20 @@
             <if test="terms.unitIds != null and terms.unitIds !=''">
                 and t1.id in(${terms.unitIds})
             </if>
+
         </if>
     </sql>
 
     <!--  统计任务平均时长  -->
     <select id="statisticsAVG" resultType="cn.huge.module.analysis.domain.dto.AvgDurationDTO">
-        select AVG(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') and t2.status = 2 then ROUND(DATEDIFF(SECOND, t2.create_time, t2.handle_time) / 3600.0, 2) end) as fp,
-            AVG(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL')  and t2.status = 2 then ROUND(DATEDIFF(SECOND, t2.create_time, t2.handle_time) / 3600.0, 2) end) as sl,
-            AVG(case when (t2.node_id = 'BLFK' and t2.status = '2') and t2.status = 2 then ROUND(DATEDIFF(SECOND, t2.create_time, t2.handle_time) / 3600.0, 2) end) as blz
-            from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.handle_unit_id
-                left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
+        select AVG(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id =
+        'DFP') and t2.status = 2 then ROUND(DATEDIFF(SECOND, t2.create_time, t2.handle_time) / 3600.0, 2) end) as fp,
+        AVG(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL')
+        and t2.status = 2 then ROUND(DATEDIFF(SECOND, t2.create_time, t2.handle_time) / 3600.0, 2) end) as sl,
+        AVG(case when (t2.node_id = 'BLFK' and t2.status = '2') and t2.status = 2 then ROUND(DATEDIFF(SECOND,
+        t2.create_time, t2.handle_time) / 3600.0, 2) end) as blz
+        from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.handle_unit_id
+        left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
         where
         t1.delete_status = 0
         and t2.delete_status = 0
@@ -122,29 +127,59 @@
     <select id="statisticsGroupAVG" resultType="cn.huge.module.analysis.domain.dto.AvgDurationGroupDTO">
         select
         <include refid="selectPart"/>
-        AVG(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') and t2.status = 2 then ROUND(DATEDIFF(SECOND, t2.create_time, t2.handle_time) / 3600.0, 2) end) as fp,
-        count(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') and t2.status = 2 then t2.id end) as fps,
-        AVG(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL')  and t2.status = 2 then ROUND(DATEDIFF(SECOND, t2.create_time, t2.handle_time) / 3600.0, 2) end) as sl,
-        count(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL')  and t2.status = 2 then t2.id end) as sls,
-        AVG(case when (t2.node_id = 'BLFK' and t2.status = '2') and t2.status = 2 then ROUND(DATEDIFF(SECOND, t2.create_time, t2.handle_time) / 3600.0, 2) end) as blz,
+        AVG(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP')
+        and t2.status = 2 then ROUND(DATEDIFF(SECOND, t2.create_time, t2.handle_time) / 3600.0, 2) end) as fp,
+        count(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP')
+        and t2.status = 2 then t2.id end) as fps,
+        AVG(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL')
+        and t2.status = 2 then ROUND(DATEDIFF(SECOND, t2.create_time, t2.handle_time) / 3600.0, 2) end) as sl,
+        count(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL')
+        and t2.status = 2 then t2.id end) as sls,
+        AVG(case when (t2.node_id = 'BLFK' and t2.status = '2') and t2.status = 2 then ROUND(DATEDIFF(SECOND,
+        t2.create_time, t2.handle_time) / 3600.0, 2) end) as blz,
         count(case when (t2.node_id = 'BLFK' and t2.status = '2') and t2.status = 2 then t2.id end) as bls
         from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.handle_unit_id
-            left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
+        left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
         where
         t1.delete_status = 0
         and t2.delete_status = 0
         and t3.delete_status = 0
         <include refid="statisticsAVG-wherePart"/>
-        group by <include refid="groupPart"/>
+        group by
+        <include refid="groupPart"/>
     </select>
 
     <!--  分组统计任务  -->
     <select id="statisticsQuantity" resultType="cn.huge.module.analysis.domain.dto.StatisticsGroupDTO">
         select
-        count(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) then t2.id end) as fpcs,
-        count(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL') and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) then t2.id end) as slcs
+        <if test="terms.taskStatus != null and terms.taskStatus == 1 ">
+            count(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP')
+            and ((t2.overtime_status = 1 and t2.status = 2)) then t2.id end) as
+            fpcs,
+            count(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL')
+            and ((t2.overtime_status = 1 and t2.status = 2)) then t2.id end) as
+            slcs
+        </if>
+        <if test="terms.taskStatus != null and terms.taskStatus == 0">
+            count(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP')
+            and ((sysdate > expire_time and t2.status = 1)) then t2.id end) as
+            fpcs,
+            count(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL')
+            and ((sysdate > expire_time and t2.status = 1)) then t2.id end) as
+            slcs
+        </if>
+        <if test="terms.taskStatus == null or terms.taskStatus ==''">
+            count(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP')
+            and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) then t2.id end) as
+            fpcs,
+            count(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL')
+            and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) then t2.id end) as
+            slcs
+        </if>
+
+
         from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id
-            left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
+        left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
         where
         t1.delete_status = 0
         and t2.delete_status = 0
@@ -155,10 +190,14 @@
     <!--  首页-统计超时任务  -->
     <select id="homeStatisticsQuantity" resultType="cn.huge.module.analysis.domain.dto.StatisticsGroupDTO">
         select
-        count(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) then t2.id end) as fpcs,
-        count(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL') and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) then t2.id end) as slcs
+        count(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP')
+        and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) then t2.id end) as
+        fpcs,
+        count(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL')
+        and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) then t2.id end) as
+        slcs
         from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id
-            left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
+        left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
         where
         t1.delete_status = 0
         and t2.delete_status = 0
@@ -212,7 +251,8 @@
         from
         (
         select ROUND(DATEDIFF(SECOND, t2.appear_time, t2.audit_time) / 3600.0, 2) as usetime_hour
-        from dyh_ct_unit t1 left join dyh_case_appear t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on t2.case_id = t3.id
+        from dyh_ct_unit t1 left join dyh_case_appear t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on
+        t2.case_id = t3.id
         where t2.apply_status = 1
         <if test="terms != null">
             <if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''">
@@ -223,7 +263,8 @@
         </if>
         union all
         select ROUND(DATEDIFF(SECOND, t2.apply_time, t2.audit_time) / 3600.0, 2) as usetime_hour
-        from dyh_ct_unit t1 left join dyh_case_assist_apply t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on t2.case_id = t3.id
+        from dyh_ct_unit t1 left join dyh_case_assist_apply t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on
+        t2.case_id = t3.id
         where t2.apply_status = 1
         <if test="terms != null">
             <if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''">
@@ -234,7 +275,8 @@
         </if>
         union all
         select ROUND(DATEDIFF(SECOND, t2.return_time, t2.audit_time) / 3600.0, 2) as usetime_hour
-        from dyh_ct_unit t1 left join dyh_case_return t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on t2.case_id = t3.id
+        from dyh_ct_unit t1 left join dyh_case_return t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on
+        t2.case_id = t3.id
         where t2.return_status = 1
         <if test="terms != null">
             <if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''">
@@ -245,7 +287,8 @@
         </if>
         union all
         select ROUND(DATEDIFF(SECOND, t2.apply_time, t2.audit_time) / 3600.0, 2) as usetime_hour
-        from dyh_ct_unit t1 left join dyh_case_windup_apply t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on t2.case_id = t3.id
+        from dyh_ct_unit t1 left join dyh_case_windup_apply t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on
+        t2.case_id = t3.id
         where t2.apply_status = 1
         <if test="terms != null">
             <if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''">
@@ -261,12 +304,14 @@
     <select id="statisticsApplyGroup" resultType="cn.huge.module.analysis.domain.dto.AvgDurationGroupDTO">
         select
         <include refid="selectPart"/>
-               avg(usetime_hour) as sp,
-                count(distinct ownerId) as sps
+        avg(usetime_hour) as sp,
+        count(distinct ownerId) as sps
         from
         (
-        select ROUND(DATEDIFF(SECOND, t2.appear_time, t2.audit_time) / 3600.0, 2) as usetime_hour, t2.id as ownerId, t1.*
-        from dyh_ct_unit t1 left join dyh_case_appear t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on t2.case_id = t3.id
+        select ROUND(DATEDIFF(SECOND, t2.appear_time, t2.audit_time) / 3600.0, 2) as usetime_hour, t2.id as ownerId,
+        t1.*
+        from dyh_ct_unit t1 left join dyh_case_appear t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on
+        t2.case_id = t3.id
         where t2.apply_status = 1 and t2.audit_time != t2.appear_time
         <if test="terms != null">
             <if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''">
@@ -277,7 +322,8 @@
         </if>
         union all
         select ROUND(DATEDIFF(SECOND, t2.apply_time, t2.audit_time) / 3600.0, 2) as usetime_hour, t2.id as ownerId, t1.*
-        from dyh_ct_unit t1 left join dyh_case_assist_apply t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on t2.case_id = t3.id
+        from dyh_ct_unit t1 left join dyh_case_assist_apply t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on
+        t2.case_id = t3.id
         where t2.apply_status = 1 and t2.audit_time != t2.apply_time
         <if test="terms != null">
             <if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''">
@@ -287,8 +333,10 @@
             <include refid="statisticsApplyAVG-wherePart"/>
         </if>
         union all
-        select ROUND(DATEDIFF(SECOND, t2.return_time, t2.audit_time) / 3600.0, 2) as usetime_hour, t2.id as ownerId, t1.*
-        from dyh_ct_unit t1 left join dyh_case_return t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on t2.case_id = t3.id
+        select ROUND(DATEDIFF(SECOND, t2.return_time, t2.audit_time) / 3600.0, 2) as usetime_hour, t2.id as ownerId,
+        t1.*
+        from dyh_ct_unit t1 left join dyh_case_return t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on
+        t2.case_id = t3.id
         where t2.return_status = 1 and t2.audit_time!= t2.return_time
         <if test="terms != null">
             <if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''">
@@ -299,7 +347,8 @@
         </if>
         union all
         select ROUND(DATEDIFF(SECOND, t2.apply_time, t2.audit_time) / 3600.0, 2) as usetime_hour, t2.id as ownerId, t1.*
-        from dyh_ct_unit t1 left join dyh_case_windup_apply t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on t2.case_id = t3.id
+        from dyh_ct_unit t1 left join dyh_case_windup_apply t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on
+        t2.case_id = t3.id
         where t2.apply_status = 1 and t2.audit_time != t2.apply_time
         <if test="terms != null">
             <if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''">
@@ -309,7 +358,8 @@
             <include refid="statisticsApplyAVG-wherePart"/>
         </if>
         ) t1
-        group by <include refid="groupPart"/>
+        group by
+        <include refid="groupPart"/>
     </select>
 
     <!-- 条件 -->
@@ -354,12 +404,14 @@
         <if test="terms.unitIds != null and terms.unitIds !=''">
             and t1.id in(${terms.unitIds})
         </if>
+
     </sql>
 
     <!--  统计督办平均时长  -->
     <select id="statisticsSuperviseAVG" resultType="cn.huge.module.analysis.domain.dto.AvgDurationDTO">
         select AVG(ROUND(DATEDIFF(SECOND, t2.sup_time, t2.reply_time) / 3600.0, 2)) as db
-        from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id left join dyh_case_info t3 on t2.case_id = t3.id
+        from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id left join dyh_case_info t3 on
+        t2.case_id = t3.id
         where
         <include refid="statisticsSuperviseAVG-wherePart"/>
         and t2.sup_status = 1
@@ -367,20 +419,34 @@
 
     <!--  分组统计督办平均时长  -->
     <select id="statisticsSuperviseGroup" resultType="cn.huge.module.analysis.domain.dto.AvgDurationGroupDTO">
-        select <include refid="selectPart"/>
-               AVG(ROUND(DATEDIFF(SECOND, t2.sup_time, t2.reply_time) / 3600.0, 2)) as db, count(case when sup_status = 1 then t2.id end ) as hfs
-        from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id left join dyh_case_info t3 on t2.case_id = t3.id
+        select
+        <include refid="selectPart"/>
+        AVG(ROUND(DATEDIFF(SECOND, t2.sup_time, t2.reply_time) / 3600.0, 2)) as db, count(case when sup_status = 1 then
+        t2.id end ) as hfs
+        from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id left join dyh_case_info t3 on
+        t2.case_id = t3.id
         where
         <include refid="statisticsSuperviseAVG-wherePart"/>
         and t2.sup_status = 1
-        group by <include refid="groupPart"/>
+        group by
+        <include refid="groupPart"/>
     </select>
 
     <!--  分组查询超时数量  -->
     <select id="statisticsSuperviseQuantity" resultType="cn.huge.module.analysis.domain.dto.StatisticsGroupDTO">
         select
-            count(case when ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1')) then t2.id end) as dbcs
-        from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id left join dyh_case_info t3 on t2.case_id = t3.id
+        <if test="terms.taskStatus != null and terms.taskStatus == 1 ">
+            count(case when (t2.overtime_status = '1') then t2.id end) as dbcs
+        </if>
+        <if test="terms.taskStatus != null and terms.taskStatus == 0">
+            count(case when (sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) then t2.id end) as dbcs
+        </if>
+        <if test="terms.taskStatus == null or terms.taskStatus ==''">
+            count(case when ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or
+            (t2.overtime_status = '1')) then t2.id end) as dbcs
+        </if>
+        from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id left join dyh_case_info t3 on
+        t2.case_id = t3.id
         where
         <include refid="statisticsSuperviseAVG-wherePart"/>
     </select>
@@ -388,14 +454,17 @@
     <!--  首页-查询超时数量  -->
     <select id="homeStatisticsSuperviseQuantity" resultType="cn.huge.module.analysis.domain.dto.StatisticsGroupDTO">
         select
-        count(case when ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1')) then t2.id end) as dbcs
-        from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id left join dyh_case_info t3 on t2.case_id = t3.id
+        count(case when ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or
+        (t2.overtime_status = '1')) then t2.id end) as dbcs
+        from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id left join dyh_case_info t3 on
+        t2.case_id = t3.id
         where
         <include refid="statisticsSuperviseAVG-wherePart"/>
     </select>
 
     <!--  统计重复来访案件数量  -->
-    <select id="countRepeatedCases" resultType="cn.huge.module.analysis.domain.dto.CountRepeateDto" parameterType="cn.huge.module.analysis.domain.vo.CountRepeateVo">
+    <select id="countRepeatedCases" resultType="cn.huge.module.analysis.domain.dto.CountRepeateDto"
+            parameterType="cn.huge.module.analysis.domain.vo.CountRepeateVo">
         WITH RepeatedPersons AS (
         SELECT true_name, mobile, certi_no
         FROM gzdyh_test.dyh_case_person
@@ -408,7 +477,8 @@
         MinCaseIds AS (
         SELECT rp.true_name, rp.mobile, rp.certi_no, MIN(p.case_id) as min_case_id
         FROM RepeatedPersons rp
-        JOIN gzdyh_test.dyh_case_person p ON rp.true_name = p.true_name AND rp.mobile = p.mobile AND rp.certi_no = p.certi_no
+        JOIN gzdyh_test.dyh_case_person p ON rp.true_name = p.true_name AND rp.mobile = p.mobile AND rp.certi_no =
+        p.certi_no
         GROUP BY rp.true_name, rp.mobile, rp.certi_no
         ),
         FilteredCases AS (
@@ -478,15 +548,15 @@
             GROUP BY case_type_first_name
         </if>
         <if test="groupByArea != null and groupByArea != ''">
-<!--            AND road_name is not NULL-->
+            <!--            AND road_name is not NULL-->
             GROUP BY area_name
         </if>
         <if test="groupByRoad != null and groupByRoad != ''">
-<!--            AND road_name is not NULL-->
+            <!--            AND road_name is not NULL-->
             GROUP BY road_name
         </if>
         <if test="groupByTime != null and groupByTime != ''">
-            GROUP BY  groupByType
+            GROUP BY groupByType
         </if>
     </select>
 
@@ -495,31 +565,51 @@
         select
         COUNT(1)
         from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id
-            left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
+        left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
         where
         t1.delete_status = 0
         and t2.delete_status = 0
         and t3.delete_status = 0
         <include refid="statisticsAVG-wherePart"/>
-        and (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1))
+        and (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP')
+        <if test="terms.taskStatus != null and terms.taskStatus == 1 ">
+            and (t2.overtime_status = 1 and t2.status = 2)
+        </if>
+        <if test="terms.taskStatus != null and terms.taskStatus == 0">
+            and (sysdate > expire_time and t2.status = 1)
+        </if>
+        <if test="terms.taskStatus == null or terms.taskStatus ==''">
+            and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1))
+        </if>
     </select>
 
     <!--  查询分派超时案件  -->
     <select id="listFPQuantity" resultType="cn.huge.module.analysis.domain.dto.TimeoutTaskInfoDTO">
-        select t2.case_id as caseId, t2.id as caseTaskId, t2.create_time as turnaroundTime, t2.node_name as nodeName, (case t2.status when 1 then 0 when 2 then 1 end) as taskStatus,
-        (case t2.status when 2 then t2.overtime_hour when 1 then DATEDIFF(hh, t2.expire_time, sysdate) end) as timeLimit,
+        select t2.case_id as caseId, t2.id as caseTaskId, t2.create_time as turnaroundTime, t2.node_name as nodeName,
+        (case t2.status when 1 then 0 when 2 then 1 end) as taskStatus,
+        (case t2.status when 2 then t2.overtime_hour when 1 then DATEDIFF(hh, t2.expire_time, sysdate) end) as
+        timeLimit,
         t3.case_level as caseGrade, t3.canal_name as caseSource, t4.mediator as mediator, t3.status_name as statusName,
         concat_ws('', ifnull(t3.case_type_first_name, ''), '/' , ifnull(t3.case_type_name, '')) as caseType,
         concat(t3.que_area_name, t3.que_road_name) as queAddress, t2.cande_unit_name as candeUnitName,
         (select count(1) from dyh_case_supervise where case_id = t2.case_id) as superviseCount
         from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id
-            left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
+        left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
         where
         t1.delete_status = 0
         and t2.delete_status = 0
         and t3.delete_status = 0
         <include refid="statisticsAVG-wherePart"/>
-        and (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1))
+        and (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP')
+        <if test="terms.taskStatus != null and terms.taskStatus == 1 ">
+            and (t2.overtime_status = 1 and t2.status = 2)
+        </if>
+        <if test="terms.taskStatus != null and terms.taskStatus == 0">
+            and (sysdate > expire_time and t2.status = 1)
+        </if>
+        <if test="terms.taskStatus == null or terms.taskStatus ==''">
+            and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1))
+        </if>
         <if test="page.sort != null">
             <foreach collection="page.sort" item="s" index="index" separator="," open="order by ">
                 isnull(${s.property}), ${s.property} ${s.direction}
@@ -536,7 +626,7 @@
         select
         COUNT(1)
         from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id
-            left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
+        left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
         where
         t1.delete_status = 0
         and t2.delete_status = 0
@@ -544,19 +634,29 @@
         <include refid="statisticsAVG-wherePart"/>
         and
         (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL')
-          and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1) )
+        <if test="terms.taskStatus != null and terms.taskStatus == 1 ">
+            and (t2.overtime_status = 1 and t2.status = 2)
+        </if>
+        <if test="terms.taskStatus != null and terms.taskStatus == 0">
+            and (sysdate > expire_time and t2.status = 1)
+        </if>
+        <if test="terms.taskStatus == null or terms.taskStatus ==''">
+            and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1))
+        </if>
     </select>
 
     <!--  查询受理超时案件  -->
     <select id="listSLQuantity" resultType="cn.huge.module.analysis.domain.dto.TimeoutTaskInfoDTO">
-        select t2.case_id as caseId, t2.id as caseTaskId,t2.create_time as turnaroundTime, t2.node_name as nodeName, (case t2.status when 1 then 0 when 2 then 1 end) as taskStatus,
-        (case t2.status when 2 then t2.overtime_hour when 1 then DATEDIFF(hh, t2.expire_time, sysdate) end) as timeLimit,
+        select t2.case_id as caseId, t2.id as caseTaskId,t2.create_time as turnaroundTime, t2.node_name as nodeName,
+        (case t2.status when 1 then 0 when 2 then 1 end) as taskStatus,
+        (case t2.status when 2 then t2.overtime_hour when 1 then DATEDIFF(hh, t2.expire_time, sysdate) end) as
+        timeLimit,
         t3.case_level as caseGrade, t3.canal_name as caseSource, t4.mediator as mediator, t3.status_name as statusName,
         concat_ws('', ifnull(t3.case_type_first_name, ''), '/' , ifnull(t3.case_type_name, '')) as caseType,
         concat(t3.que_area_name, t3.que_road_name) as queAddress, t2.cande_unit_name as candeUnitName,
         (select count(1) from dyh_case_supervise where case_id = t2.case_id) as superviseCount
         from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id
-            left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
+        left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
         where
         t1.delete_status = 0
         and t2.delete_status = 0
@@ -564,7 +664,15 @@
         <include refid="statisticsAVG-wherePart"/>
         and
         (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL')
-          and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1))
+        <if test="terms.taskStatus != null and terms.taskStatus == 1 ">
+            and (t2.overtime_status = 1 and t2.status = 2)
+        </if>
+        <if test="terms.taskStatus != null and terms.taskStatus == 0">
+            and (sysdate > expire_time and t2.status = 1)
+        </if>
+        <if test="terms.taskStatus == null or terms.taskStatus ==''">
+            and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1))
+        </if>
         <if test="page.sort != null">
             <foreach collection="page.sort" item="s" index="index" separator="," open="order by ">
                 isnull(${s.property}), ${s.property} ${s.direction}
@@ -581,25 +689,42 @@
         select
         COUNT(1)
         from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id
-            left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
+        left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
         where
         <include refid="statisticsSuperviseAVG-wherePart"/>
-        and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1'))
+        <if test="terms.taskStatus != null and terms.taskStatus == 1 ">
+            and  (t2.overtime_status = '1')
+        </if>
+        <if test="terms.taskStatus != null and terms.taskStatus == 0">
+            and (sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0)
+        </if>
+        <if test="terms.taskStatus == null or terms.taskStatus ==''">
+            and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1'))
+        </if>
     </select>
 
     <!--  查询督办超时案件  -->
     <select id="listDBQuantity" resultType="cn.huge.module.analysis.domain.dto.TimeoutTaskInfoDTO">
         select t2.case_id as caseId, t2.sup_time as turnaroundTime, '督办回复' as nodeName, t2.sup_status as taskStatus,
-        (case t2.sup_status when 1 then t2.overtime_hour when 0 then DATEDIFF(hh, DATEADD(hour, t2.reply_term, t2.sup_time), sysdate) end) as timeLimit,
-               t3.case_level as caseGrade,t3.canal_name as caseSource, t4.mediator as mediator, t3.status_name as statusName,
-               concat_ws('', ifnull(t3.case_type_first_name, ''), '/' , ifnull(t3.case_type_name, '')) as caseType,
-            concat(t3.que_area_name, t3.que_road_name) as queAddress, t2.quilt_unit_name as candeUnitName,
-            (select count(1) from dyh_case_supervise where case_id = t2.case_id) as superviseCount
+        (case t2.sup_status when 1 then t2.overtime_hour when 0 then DATEDIFF(hh, DATEADD(hour, t2.reply_term,
+        t2.sup_time), sysdate) end) as timeLimit,
+        t3.case_level as caseGrade,t3.canal_name as caseSource, t4.mediator as mediator, t3.status_name as statusName,
+        concat_ws('', ifnull(t3.case_type_first_name, ''), '/' , ifnull(t3.case_type_name, '')) as caseType,
+        concat(t3.que_area_name, t3.que_road_name) as queAddress, t2.quilt_unit_name as candeUnitName,
+        (select count(1) from dyh_case_supervise where case_id = t2.case_id) as superviseCount
         from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id
-            left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
+        left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
         where
         <include refid="statisticsSuperviseAVG-wherePart"/>
-        and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1'))
+        <if test="terms.taskStatus != null and terms.taskStatus == 1 ">
+            and  (t2.overtime_status = '1')
+        </if>
+        <if test="terms.taskStatus != null and terms.taskStatus == 0">
+            and (sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0)
+        </if>
+        <if test="terms.taskStatus == null or terms.taskStatus ==''">
+            and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1'))
+        </if>
         <if test="page.sort != null">
             <foreach collection="page.sort" item="s" index="index" separator="," open="order by ">
                 isnull(${s.property}), ${s.property} ${s.direction}
@@ -615,60 +740,97 @@
     <select id="countAllQuantity" resultType="java.lang.Long">
         select sum(zs)
         from(
-            select
-                COUNT(1) as zs
-            from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id
-                                left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
-            where
-                t1.delete_status = 0
-              and t2.delete_status = 0
-              and t3.delete_status = 0
-                <include refid="statisticsAVG-wherePart"/>
-              and((t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP')
-                or (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL'))
-              and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1))
-            union
-            select
-                COUNT(1) as zs
-            from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id
-                                left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
-            where
+        select
+        COUNT(1) as zs
+        from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id
+        left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
+        where
+        t1.delete_status = 0
+        and t2.delete_status = 0
+        and t3.delete_status = 0
+        <include refid="statisticsAVG-wherePart"/>
+        and((t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP')
+        or (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL'))
+        <if test="terms.taskStatus != null and terms.taskStatus == 1 ">
+            and (t2.overtime_status = 1 and t2.status = 2)
+        </if>
+        <if test="terms.taskStatus != null and terms.taskStatus == 0">
+            and (sysdate > expire_time and t2.status = 1)
+        </if>
+        <if test="terms.taskStatus == null or terms.taskStatus ==''">
+            and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1))
+        </if>
+        union
+        select
+        COUNT(1) as zs
+        from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id
+        left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
+        where
         <include refid="statisticsSuperviseAVG-wherePart"/>
-            and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1'))
-        )
+        <if test="terms.taskStatus != null and terms.taskStatus == 1 ">
+            and (t2.overtime_status = '1')
+        </if>
+        <if test="terms.taskStatus != null and terms.taskStatus == 0">
+            and (sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0)
+        </if>
+        <if test="terms.taskStatus == null or terms.taskStatus ==''">
+            and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status =
+            '1'))
+        </if>)
     </select>
 
     <!--  查询督办超时案件  -->
     <select id="listAllQuantity" resultType="cn.huge.module.analysis.domain.dto.TimeoutTaskInfoDTO">
         select * from(
-            select t2.case_id as caseId, t2.id as caseTaskId, t2.create_time as turnaroundTime, t2.node_name as nodeName, (case t2.status when 1 then 0 when 2 then 1 end) as taskStatus,
-            (case t2.status when 2 then t2.overtime_hour when 1 then DATEDIFF(hh, t2.expire_time, sysdate) end) as timeLimit,
-            t3.case_level as caseGrade, t3.canal_name as caseSource, t4.mediator as mediator, t3.status_name as statusName,
-            concat_ws('', ifnull(t3.case_type_first_name, ''), '/' , ifnull(t3.case_type_name, '')) as caseType,
-            concat(t3.que_area_name, t3.que_road_name) as queAddress, t2.cande_unit_name as candeUnitName,
-            (select count(1) from dyh_case_supervise where case_id = t2.case_id) as superviseCount
-            from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id
-                left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
-            where
-            t1.delete_status = 0
-            and t2.delete_status = 0
-            and t3.delete_status = 0
-            <include refid="statisticsAVG-wherePart"/>
-            and ((t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP')
-                or (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL'))
+        select t2.case_id as caseId, t2.id as caseTaskId, t2.create_time as turnaroundTime, t2.node_name as nodeName,
+        (case t2.status when 1 then 0 when 2 then 1 end) as taskStatus,
+        (case t2.status when 2 then t2.overtime_hour when 1 then DATEDIFF(hh, t2.expire_time, sysdate) end) as
+        timeLimit,
+        t3.case_level as caseGrade, t3.canal_name as caseSource, t4.mediator as mediator, t3.status_name as statusName,
+        concat_ws('', ifnull(t3.case_type_first_name, ''), '/' , ifnull(t3.case_type_name, '')) as caseType,
+        concat(t3.que_area_name, t3.que_road_name) as queAddress, t2.cande_unit_name as candeUnitName,
+        (select count(1) from dyh_case_supervise where case_id = t2.case_id) as superviseCount
+        from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id
+        left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
+        where
+        t1.delete_status = 0
+        and t2.delete_status = 0
+        and t3.delete_status = 0
+        <include refid="statisticsAVG-wherePart"/>
+        and ((t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP')
+        or (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL'))
+        <if test="terms.taskStatus != null and terms.taskStatus == 1 ">
+            and (t2.overtime_status = 1 and t2.status = 2)
+        </if>
+        <if test="terms.taskStatus != null and terms.taskStatus == 0">
+            and (sysdate > expire_time and t2.status = 1)
+        </if>
+        <if test="terms.taskStatus == null or terms.taskStatus ==''">
             and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1))
-            union all
-            select t2.case_id as caseId, null as caseTaskId, t2.sup_time as turnaroundTime, '督办回复' as nodeName, t2.sup_status as taskStatus,
-            (case t2.sup_status when 1 then t2.overtime_hour when 0 then DATEDIFF(hh, DATEADD(hour, t2.reply_term, t2.sup_time), sysdate) end) as timeLimit,
-            t3.case_level as caseGrade,t3.canal_name as caseSource, t4.mediator as mediator, t3.status_name as statusName,
-            concat_ws('', ifnull(t3.case_type_first_name, ''), '/' , ifnull(t3.case_type_name, '')) as caseType,
-            concat(t3.que_area_name, t3.que_road_name) as queAddress, t2.quilt_unit_name as candeUnitName,
-            (select count(1) from dyh_case_supervise where case_id = t2.case_id) as superviseCount
-            from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id
-                left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
-            where
-            <include refid="statisticsSuperviseAVG-wherePart"/>
-            and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1'))
+        </if>
+        union all
+        select t2.case_id as caseId, null as caseTaskId, t2.sup_time as turnaroundTime, '督办回复' as nodeName,
+        t2.sup_status as taskStatus,
+        (case t2.sup_status when 1 then t2.overtime_hour when 0 then DATEDIFF(hh, DATEADD(hour, t2.reply_term,
+        t2.sup_time), sysdate) end) as timeLimit,
+        t3.case_level as caseGrade,t3.canal_name as caseSource, t4.mediator as mediator, t3.status_name as statusName,
+        concat_ws('', ifnull(t3.case_type_first_name, ''), '/' , ifnull(t3.case_type_name, '')) as caseType,
+        concat(t3.que_area_name, t3.que_road_name) as queAddress, t2.quilt_unit_name as candeUnitName,
+        (select count(1) from dyh_case_supervise where case_id = t2.case_id) as superviseCount
+        from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id
+        left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id
+        where
+        <include refid="statisticsSuperviseAVG-wherePart"/>
+        <if test="terms.taskStatus != null and terms.taskStatus == 1 ">
+            and (t2.overtime_status = '1')
+        </if>
+        <if test="terms.taskStatus != null and terms.taskStatus == 0">
+            and (sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0)
+        </if>
+        <if test="terms.taskStatus == null or terms.taskStatus ==''">
+            and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status =
+            '1'))
+        </if>
         )
         <if test="page.sort != null">
             <foreach collection="page.sort" item="s" index="index" separator="," open="order by ">
@@ -679,6 +841,7 @@
             order by isnull(t2.sup_time), t2.sup_time desc
         </if>
         limit #{page.offset}, #{page.size}
+
     </select>
 
     <sql id="statisticsCirculation-wherePart">
@@ -730,18 +893,19 @@
         count(distinct case when t3.zxsl_status = 1 then t4.id end) as zxsl,
         count(distinct case when t3.zxsl_status = 0 and (t4.node_id = 'JAGD' or t4.node_id = 'BLFK'
         or t4.node_id = 'JASH' or t4.node_id = 'JASH_EJ' or t4.node_id = 'JASH_YJ') then t4.id end) as lzsl,
---         count(distinct case when t3.zxsl_status = 0 and (((t4.node_id = 'ZJ_DFP' or t4.node_id = 'QJ_DFP'
---         or t4.node_id = 'SJ_DFP' or t4.node_id = 'DFP' or t4.node_id = 'QJ_DSL' or t4.node_id = 'SJ_DSL'
---         or t4.node_id = 'DSL' or t4.node_id = 'ZJ_DSL')and t4.handle_result !=3)
---         or t4.node_id = 'SJ_SBSH'
---         or t4.node_id = 'SJ_HTSH' or t4.node_id = 'QJ_HTSH' or t4.node_id = 'QJ_SBSH' or t4.node_id = 'ZJ_HTSH'
---         or t4.node_id = 'JASQ' or t4.node_id = 'HTSH'
---         ) then t4.id end) as lzz,
+        -- count(distinct case when t3.zxsl_status = 0 and (((t4.node_id = 'ZJ_DFP' or t4.node_id = 'QJ_DFP'
+        -- or t4.node_id = 'SJ_DFP' or t4.node_id = 'DFP' or t4.node_id = 'QJ_DSL' or t4.node_id = 'SJ_DSL'
+        -- or t4.node_id = 'DSL' or t4.node_id = 'ZJ_DSL')and t4.handle_result !=3)
+        -- or t4.node_id = 'SJ_SBSH'
+        -- or t4.node_id = 'SJ_HTSH' or t4.node_id = 'QJ_HTSH' or t4.node_id = 'QJ_SBSH' or t4.node_id = 'ZJ_HTSH'
+        -- or t4.node_id = 'JASQ' or t4.node_id = 'HTSH'
+        -- ) then t4.id end) as lzz,
         count(distinct case when (t3.zxsl_status = 0 and (t4.node_id = 'ZJ_DFP' or t4.node_id = 'QJ_DFP'
         or t4.node_id = 'SJ_DFP' or t4.node_id = 'DFP' or t4.node_id = 'QJ_DSL' or t4.node_id = 'SJ_DSL'
         or t4.node_id = 'DSL' or t4.node_id = 'ZJ_DSL')and t4.handle_result =3) then t4.id end) as bysl
         from
-        dyh_ct_unit t1 left join dyh_case_info_unfold t2 on t2.belong_unit_id = t1.id left join dyh_case_info t3 on t2.id = t3.id
+        dyh_ct_unit t1 left join dyh_case_info_unfold t2 on t2.belong_unit_id = t1.id left join dyh_case_info t3 on
+        t2.id = t3.id
         left join(SELECT case_id, node_id, create_time, cande_unit_id, id, status,handle_result
         FROM (
         SELECT case_id, node_id, create_time, cande_unit_id, id, status,handle_result,
@@ -752,7 +916,8 @@
         group by s.case_id) t4 on t2.id = t4.case_id
         where t1.delete_status = 0 and t3.delete_status = 0
         <include refid="statisticsCirculation-wherePart"/>
-        group by <include refid="groupPart"/>
+        group by
+        <include refid="groupPart"/>
     </select>
 
     <!-- 分组查询字段 -->
@@ -829,10 +994,10 @@
                 village as code,
                 'queVillage' as region
             </if>
-<!--            <if test="terms.unitIds != null and terms.unitIds !=''">-->
-<!--                unit_name as name,-->
-<!--                id as code-->
-<!--            </if>-->
+            <!--            <if test="terms.unitIds != null and terms.unitIds !=''">-->
+            <!--                unit_name as name,-->
+            <!--                id as code-->
+            <!--            </if>-->
         </if>
         from dyh_ct_unit
         where
@@ -863,12 +1028,14 @@
         <if test="terms.unitIds != null and terms.unitIds !=''">
             and id in(${terms.unitIds})
         </if>
-        group by <include refid="groupALLPart"/>
+        group by
+        <include refid="groupALLPart"/>
     </select>
 
     <!--  查询下属所有属地  -->
     <select id="listSubordinateTerritory" resultType="string">
-        select <include refid="selectALLPart"/>
+        select
+        <include refid="selectALLPart"/>
         from dyh_ct_unit
         where
         delete_status = 0
@@ -898,22 +1065,21 @@
         <if test="terms.unitIds != null and terms.unitIds !=''">
             and id in(${terms.unitIds})
         </if>
-        group by <include refid="groupALLPart"/>
+        group by
+        <include refid="groupALLPart"/>
     </select>
 
     <!--  获取所有下属组织包括自己  -->
     <select id="getAllParentUnit" resultType="string">
         SELECT id
-        FROM dyh_ct_unit
-        START WITH id = #{unitId}
+        FROM dyh_ct_unit START WITH id = #{unitId}
         CONNECT BY PRIOR id = parent_id;
     </select>
 
     <!--  获取所有下属组织包括自己  -->
     <select id="getAllDeptParentUnit" resultType="string">
         SELECT id
-        FROM dyh_ct_unit
-                 START WITH id = #{unitId}
+        FROM dyh_ct_unit START WITH id = #{unitId}
         CONNECT BY PRIOR id = parent_id and unit_type != 101 and unit_type != 103;
     </select>
 
@@ -946,11 +1112,11 @@
                 t3.village as code,
                 'queVillage' as region,
             </if>
-<!--            <if test="terms.unitIds != null and terms.unitIds !=''">-->
-<!--                (case when t3.unit_name = '' or t3.unit_name is null then '本级' else t3.unit_name end)as name,-->
-<!--                t3.id as code,-->
-<!--                'unitId' as region,-->
-<!--            </if>-->
+            <!--            <if test="terms.unitIds != null and terms.unitIds !=''">-->
+            <!--                (case when t3.unit_name = '' or t3.unit_name is null then '本级' else t3.unit_name end)as name,-->
+            <!--                t3.id as code,-->
+            <!--                'unitId' as region,-->
+            <!--            </if>-->
         </if>
         count(distinct t1.id) as total
         FROM dyh_case_info t1 left join dyh_case_info_unfold t2 on t1.id = t2.id
@@ -995,7 +1161,7 @@
                 and t2.mediate_unit_id = #{terms.mediateUnitId}
             </if>
             <if test="terms.assistUnitId != null and terms.assistUnitId !=''">
-                and t2.assist_unit_id  = #{terms.assistUnitId}
+                and t2.assist_unit_id = #{terms.assistUnitId}
             </if>
         </if>
         group by
@@ -1027,8 +1193,8 @@
         FROM dyh_case_info t1 left join dyh_case_info_unfold t2 on t1.id = t2.id
         left join dyh_ct_unit t3 on t2.belong_unit_id = t3.id
         where t1.delete_status = 0
-          and t3.delete_status = 0
-          and t2.is_risk = 1
+        and t3.delete_status = 0
+        and t2.is_risk = 1
         <if test="terms != null">
             <if test="terms.queProv != null and terms.queProv !=''">
                 and t3.prov = #{terms.queProv}
@@ -1066,7 +1232,7 @@
                 and t2.mediate_unit_id = #{terms.mediateUnitId}
             </if>
             <if test="terms.assistUnitId != null and terms.assistUnitId !=''">
-                and t2.assist_unit_id  = #{terms.assistUnitId}
+                and t2.assist_unit_id = #{terms.assistUnitId}
             </if>
         </if>
         group by t1.case_type_first_name order by count(t1.case_type_first_name) desc limit 3
@@ -1076,7 +1242,7 @@
     <select id="getZZZXUnitId" resultType="string">
         select id from dyh_ct_unit
         where delete_status = 0
-          and (unit_type = 101 or unit_type = 103)
+        and (unit_type = 101 or unit_type = 103)
         <if test="terms.queProv != null and terms.queProv !=''">
             and prov = #{terms.queProv}
         </if>
@@ -1110,8 +1276,10 @@
         and t2.delete_status = 0
         and t3.delete_status = 0
         <include refid="statisticsAVG-wherePart"/>
-        and (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1))
-        group by <include refid="groupPart"/>
+        and (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') and
+        ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1))
+        group by
+        <include refid="groupPart"/>
         order by quantity asc
     </select>
 
@@ -1128,8 +1296,10 @@
         and t3.delete_status = 0
         <include refid="statisticsAVG-wherePart"/>
         and
-        (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL') and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1) )
-        group by <include refid="groupPart"/>
+        (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL') and
+        ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1) )
+        group by
+        <include refid="groupPart"/>
         order by quantity asc
     </select>
 
@@ -1143,7 +1313,8 @@
         where
         <include refid="statisticsSuperviseAVG-wherePart"/>
         and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1'))
-        group by <include refid="groupPart"/>
+        group by
+        <include refid="groupPart"/>
         order by quantity asc
     </select>
 
@@ -1167,7 +1338,8 @@
         and((t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP')
         or (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL'))
         and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1))
-        group by <include refid="groupPart"/>
+        group by
+        <include refid="groupPart"/>
         union all
         select
         <include refid="selectPart"/>
@@ -1177,8 +1349,10 @@
         where
         <include refid="statisticsSuperviseAVG-wherePart"/>
         and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1'))
-        group by <include refid="groupPart"/>
-        )t1 group by <include refid="groupPart"/>
+        group by
+        <include refid="groupPart"/>
+        )t1 group by
+        <include refid="groupPart"/>
         order by quantity asc
     </select>
 
@@ -1249,7 +1423,8 @@
         select
         count(1)
         from
-        dyh_ct_unit t1 left join dyh_case_info_unfold t2 on t2.belong_unit_id = t1.id left join dyh_case_info t3 on t2.id = t3.id
+        dyh_ct_unit t1 left join dyh_case_info_unfold t2 on t2.belong_unit_id = t1.id left join dyh_case_info t3 on
+        t2.id = t3.id
         left join(SELECT case_id, node_id, create_time, cande_unit_id, id, status,handle_result
         FROM (
         SELECT case_id, node_id, create_time, cande_unit_id, id, status,handle_result,
@@ -1268,7 +1443,8 @@
         <if test="terms.caseStatus != null and terms.caseStatus == 3">
             and t3.zxsl_status = 0
             and ((t4.node_id in ('ZJ_DFP', 'QJ_DFP', 'SJ_DFP', 'DFP', 'QJ_DSL', 'SJ_DSL', 'DSL', 'ZJ_DSL')
-            and t4.handle_result !=3) or t4.node_id in ('SJ_SBSH', 'SJ_HTSH', 'QJ_HTSH', 'QJ_SBSH', 'ZJ_HTSH', 'JASQ', 'HTSH'))
+            and t4.handle_result !=3) or t4.node_id in ('SJ_SBSH', 'SJ_HTSH', 'QJ_HTSH', 'QJ_SBSH', 'ZJ_HTSH', 'JASQ',
+            'HTSH'))
         </if>
         <if test="terms.caseStatus != null and terms.caseStatus == 4">
             and t3.zxsl_status = 0
@@ -1280,7 +1456,8 @@
 
     <select id="listStatisticsCirculation" resultMap="dataResult-CasePageDTO">
         select
-        t3.id, t3.status,t3.status_name,t3.canal,t3.canal_name,t3.canal_second,t3.canal_second_name,t3.case_level,t3.case_type,
+        t3.id,
+        t3.status,t3.status_name,t3.canal,t3.canal_name,t3.canal_second,t3.canal_second_name,t3.case_level,t3.case_type,
         t3.case_type_name,t3.case_type_first_name,t3.input_unit_id,t3.input_unit_name,t3.create_time,t3.plaintiffs,t3.defendants,
         IF(t1.city_name is null,t3.que_city_name,t1.city_name) as que_city_name,
         IF(t1.area_name is null,t3.que_area_name,t1.area_name) as que_area_name,
@@ -1292,7 +1469,8 @@
         t2.assist_unit_name,t2.close_time,t2.agree_type,t2.agree_type_name,t2.agree_content,t2.windup_content,
         t4.id
         from
-        dyh_ct_unit t1 left join dyh_case_info_unfold t2 on t2.belong_unit_id = t1.id left join dyh_case_info t3 on t2.id = t3.id
+        dyh_ct_unit t1 left join dyh_case_info_unfold t2 on t2.belong_unit_id = t1.id left join dyh_case_info t3 on
+        t2.id = t3.id
         left join(SELECT case_id, node_id, create_time, cande_unit_id, id, status,handle_result
         FROM (
         SELECT case_id, node_id, create_time, cande_unit_id, id, status,handle_result,
@@ -1311,7 +1489,8 @@
         <if test="terms.caseStatus != null and terms.caseStatus == 3">
             and t3.zxsl_status = 0
             and ((t4.node_id in ('ZJ_DFP', 'QJ_DFP', 'SJ_DFP', 'DFP', 'QJ_DSL', 'SJ_DSL', 'DSL', 'ZJ_DSL')
-            and t4.handle_result !=3) or t4.node_id in ('SJ_SBSH', 'SJ_HTSH', 'QJ_HTSH', 'QJ_SBSH', 'ZJ_HTSH', 'JASQ', 'HTSH'))
+            and t4.handle_result !=3) or t4.node_id in ('SJ_SBSH', 'SJ_HTSH', 'QJ_HTSH', 'QJ_SBSH', 'ZJ_HTSH', 'JASQ',
+            'HTSH'))
         </if>
         <if test="terms.caseStatus != null and terms.caseStatus == 4">
             and t3.zxsl_status = 0
diff --git a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/analysis/domain/dto/TimeoutTaskInfoDTO.java b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/analysis/domain/dto/TimeoutTaskInfoDTO.java
index 57b4810..1c7fc93 100644
--- a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/analysis/domain/dto/TimeoutTaskInfoDTO.java
+++ b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/analysis/domain/dto/TimeoutTaskInfoDTO.java
@@ -64,6 +64,7 @@
      */
     private String superviseCount;
 
+
     /**
      * 超时节点
      */
diff --git a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/casebook/controller/web/CaseBookWebController.java b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/casebook/controller/web/CaseBookWebController.java
index 6ee0023..e64c289 100644
--- a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/casebook/controller/web/CaseBookWebController.java
+++ b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/casebook/controller/web/CaseBookWebController.java
@@ -19,6 +19,7 @@
 import org.springframework.data.domain.Sort;
 import org.springframework.web.bind.annotation.*;
 
+import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 import java.util.Map;
diff --git a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/casebook/service/CasebookInfoService.java b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/casebook/service/CasebookInfoService.java
index 11dbc7e..6d7262b 100644
--- a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/casebook/service/CasebookInfoService.java
+++ b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/casebook/service/CasebookInfoService.java
@@ -1666,6 +1666,10 @@
                 caseInfo.setCaseNo(utilsClient.createCaseNo(ctUnitDTO.getArea()));
                 caseInfo.setCreateTime(nowDate);
                 caseInfo.setUpdateTime(nowDate);
+                if (caseInfo.getCanal().equals(CaseBaseConstsEnum.CASE_CANAL_3.getIndex())) {
+                    caseInfo.setCanalSecond(CaseBaseConstsEnum.CASE_CANAL_SECOND_8.getIndex());
+                    caseInfo.setCanalSecondName(CaseBaseConstsEnum.CASE_CANAL_SECOND_8.getDes());
+                }
                 caseInfoList.add(caseInfo);
 
                 // 保存所有当事人
diff --git a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/controller/web/CaseInfoWebController.java b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/controller/web/CaseInfoWebController.java
index 131ce94..d173558 100644
--- a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/controller/web/CaseInfoWebController.java
+++ b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/controller/web/CaseInfoWebController.java
@@ -173,6 +173,12 @@
             terms.put("mediator", mediator);
         }
 
+        //经办人ID
+        String systemSource = request.getParameter("systemSource");
+        if (StringUtils.isNotBlank(systemSource)) {
+            terms.put("systemSource", systemSource);
+        }
+
         String peopleNum = request.getParameter("peopleNum");
         if (StringUtils.isNotBlank(peopleNum)) {
             String[] split = peopleNum.split("-");
@@ -1324,83 +1330,41 @@
             // 查询类型 1-本系统,2-12345,3-人民调解,4-信访,5-劳动仲裁,6-非警务纠纷
             String ledgerType = request.getParameter("ledgerType");
 
-            if("1".equals(ledgerType)){
-                terms.put("canalList", Arrays.asList("22_00001-1","22_00001-2","22_00001-3"));
-            }else if("2".equals(ledgerType)){
-                terms.put("canal", "22_00001-4");
-                terms.put("canalSecond", "22_00003-3");
-                terms.put("canalSecondNot", "22_00003-2");
-            }else if("6".equals(ledgerType)){
-                terms.put("canal", "22_00001-4");
-                terms.put("canalSecond", "22_00003-4");
-                terms.put("canalSecondNot", "22_00003-2");
-            }else if("4".equals(ledgerType)){
-                terms.put("canal", "22_00001-4");
-                terms.put("canalSecond", "22_00003-6");
-                terms.put("canalSecondNot", "22_00003-2");
-            }else if("5".equals(ledgerType)){
-                terms.put("canal", "22_00001-4");
-                terms.put("canalSecond", "22_00003-5");
-                terms.put("canalSecondNot", "22_00003-2");
-            }else if("3".equals(ledgerType)){
-                terms.put("canal", "22_00001-4");
-                terms.put("canalSecond", "22_00003-1");
-                terms.put("canalSecondNot", "22_00003-2");
-            }else{
-                terms.put("canalSecondAll", "22_00003-2");
+            //所有表里面的数据都是本系统,其他的后续会新建表存储
+            if(ObjectUtils.isNotEmpty(ledgerType) && !"1".equals(ledgerType)){
+                terms.put("canal", "-1");
             }
-            return ReturnSucUtils.getRepInfo("处理成功", service.ledger(terms, userId));
+            return ReturnSucUtils.getRepInfo("处理成功", service.ledger(terms, userId, ledgerType));
         } catch (Exception e) {
             log.error("Controller接口[CaseInfoWebController.ledger]请求异常:" + e, e);
             return ReturnFailUtils.getRepInfo();
         }
     }
-    // /**
-    //  * 解纷态势
-    //  *
-    //  * @return Object
-    //  * @url {ctx}/api/web/caseInfo/ledger
-    //  * @CurrentUser String userId
-    //  */
-    // @GetMapping("/ledger")
-    // public Object ledger(@CurrentUser String userId) {
-    //     try {
-    //         Map<String, Object> terms = getParameterAll();
-    //         // 查询类型 1-本系统,2-12345,3-人民调解,4-信访,5-劳动仲裁,6-非警务纠纷
-    //         String ledgerType = request.getParameter("ledgerType");
-    //
-    //         if("1".equals(ledgerType)){
-    //             terms.put("canalList", Arrays.asList("22_00001-1","22_00001-2","22_00001-3"));
-    //         }else if("2".equals(ledgerType)){
-    //             terms.put("canal", "22_00001-4");
-    //             terms.put("canalSecond", "22_00003-3");
-    //             terms.put("canalSecondNot", "22_00003-2");
-    //         }else if("3".equals(ledgerType)){
-    //             terms.put("canal", "22_00001-4");
-    //             terms.put("canalSecond", "22_00003-4");
-    //             terms.put("canalSecondNot", "22_00003-2");
-    //         }else if("4".equals(ledgerType)){
-    //             terms.put("canal", "22_00001-4");
-    //             terms.put("canalSecond", "22_00003-6");
-    //             terms.put("canalSecondNot", "22_00003-2");
-    //         }else if("5".equals(ledgerType)){
-    //             terms.put("canal", "22_00001-4");
-    //             terms.put("canalSecond", "22_00003-5");
-    //             terms.put("canalSecondNot", "22_00003-2");
-    //         }else if("6".equals(ledgerType)){
-    //             terms.put("canal", "22_00001-4");
-    //             terms.put("canalSecond", "22_00003-1");
-    //             terms.put("canalSecondNot", "22_00003-2");
-    //         }else{
-    //             terms.put("canalSecondAll", "22_00003-2");
-    //         }
-    //         return ReturnSucUtils.getRepInfo("处理成功", service.ledger(terms, userId));
-    //     } catch (Exception e) {
-    //         log.error("Controller接口[CaseInfoWebController.ledger]请求异常:" + e, e);
-    //         return ReturnFailUtils.getRepInfo();
-    //     }
-    // }
 
+    /**
+     * 解纷态势
+     *
+     * @return Object
+     * @url {ctx}/api/web/caseInfo/ledgerCount
+     * @CurrentUser String userId
+     */
+    @GetMapping("/ledgerCount")
+    public Object ledgerCount(@CurrentUser String userId) {
+        try {
+            Map<String, Object> terms = getParameterAll();
+            // 查询类型 1-本系统,2-12345,3-人民调解,4-信访,5-劳动仲裁,6-非警务纠纷
+            String ledgerType = request.getParameter("ledgerType");
+
+            //所有表里面的数据都是本系统,其他的后续会新建表存储
+            if(ObjectUtils.isNotEmpty(ledgerType) && !"1".equals(ledgerType)){
+                terms.put("canal", "-1");
+            }
+            return ReturnSucUtils.getRepInfo("处理成功", service.ledgerCount(terms, userId));
+        } catch (Exception e) {
+            log.error("Controller接口[CaseInfoWebController.ledger]请求异常:" + e, e);
+            return ReturnFailUtils.getRepInfo();
+        }
+    }
 
     /**
      * 查询重复事项
diff --git a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/controller/web/CaseTaskWebController.java b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/controller/web/CaseTaskWebController.java
index 74ebc7c..b41d9ab 100644
--- a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/controller/web/CaseTaskWebController.java
+++ b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/controller/web/CaseTaskWebController.java
@@ -525,6 +525,13 @@
                 terms.put("partyName", partyName);
             }
             CtUserDTO loginUser = custClient.clientGetUserAll(userId);
+            CtUnitDTO unitById = custClient.getUnitById(loginUser.getUnitId());
+            //如果是政法委,赋予综治中心查看案件的权限,政法委不接收案子处理,只负责指导,所以可以直接赋予
+            if (201 == unitById.getUnitType()) {
+                CtUnitDTO bjZzzx = custClient.getBjZzzx(unitById.getId());
+                if (bjZzzx != null)
+                    loginUser.setUnitId(bjZzzx.getId());
+            }
             if (status == 1) {
                 terms.put("candeUnitId", loginUser.getUnitId());
             } else {
@@ -615,6 +622,13 @@
                 terms.put("partyName", partyName);
             }
             CtUserDTO loginUser = custClient.clientGetUserAll(userId);
+            CtUnitDTO unitById = custClient.getUnitById(loginUser.getUnitId());
+            //如果是政法委,赋予综治中心查看案件的权限,政法委不接收案子处理,只负责指导,所以可以直接赋予
+            if (201 == unitById.getUnitType()) {
+                CtUnitDTO bjZzzx = custClient.getBjZzzx(unitById.getId());
+                if (bjZzzx != null)
+                    loginUser.setUnitId(bjZzzx.getId());
+            }
             if (status == 1) {
                 terms.put("candeUnitId", loginUser.getUnitId());
             } else {
@@ -763,6 +777,13 @@
             }
             setRequestParam(terms);
             CtUserDTO loginUser = custClient.clientGetUserAll(userId);
+            CtUnitDTO unitById = custClient.getUnitById(loginUser.getUnitId());
+            //如果是政法委,赋予综治中心查看案件的权限,政法委不接收案子处理,只负责指导,所以可以直接赋予
+            if (201 == unitById.getUnitType()) {
+                CtUnitDTO bjZzzx = custClient.getBjZzzx(unitById.getId());
+                if (bjZzzx != null)
+                    loginUser.setUnitId(bjZzzx.getId());
+            }
             // 不予受理,查询case_dismiss表
             if (status == 3) {
                 terms.put("disUnitId", loginUser.getUnitId());
@@ -813,10 +834,17 @@
             }
             terms.put("caseTaskType", caseTaskType);
             CtUserDTO loginUser = custClient.clientGetUserAll(userId);
+            CtUnitDTO unitById = custClient.getUnitById(loginUser.getUnitId());
+            //如果是政法委,赋予综治中心查看案件的权限,政法委不接收案子处理,只负责指导,所以可以直接赋予
+            if (201 == unitById.getUnitType()) {
+                CtUnitDTO bjZzzx = custClient.getBjZzzx(unitById.getId());
+                if (bjZzzx != null)
+                    loginUser.setUnitId(bjZzzx.getId());
+            }
             terms.put("candeUnitId", loginUser.getUnitId());
 
             String mediatorType = request.getParameter("mediatorType");
-            if(ObjectUtils.isNotEmpty(mediatorType)){
+            if (ObjectUtils.isNotEmpty(mediatorType)) {
                 terms.put("mediatorType", mediatorType);
                 terms.put("mediatorId", loginUser.getId());
             }
@@ -894,6 +922,13 @@
                 terms.put("partyName", partyName);
             }
             CtUserDTO loginUser = custClient.clientGetUserAll(userId);
+            CtUnitDTO unitById = custClient.getUnitById(loginUser.getUnitId());
+            //如果是政法委,赋予综治中心查看案件的权限,政法委不接收案子处理,只负责指导,所以可以直接赋予
+            if (201 == unitById.getUnitType()) {
+                CtUnitDTO bjZzzx = custClient.getBjZzzx(unitById.getId());
+                if (bjZzzx != null)
+                    loginUser.setUnitId(bjZzzx.getId());
+            }
             if (caseTaskType == 1) {
                 terms.put("applyUnitId", loginUser.getUnitId());
             } else {
@@ -1043,6 +1078,13 @@
             }
             PageRequest pageRequest = PageRequest.of(page - 1, size, sort);
             CtUserDTO loginUser = custClient.clientGetUserAll(userId);
+            CtUnitDTO unitById = custClient.getUnitById(loginUser.getUnitId());
+            //如果是政法委,赋予综治中心查看案件的权限,政法委不接收案子处理,只负责指导,所以可以直接赋予
+            if (201 == unitById.getUnitType()) {
+                CtUnitDTO bjZzzx = custClient.getBjZzzx(unitById.getId());
+                if (bjZzzx != null)
+                    loginUser.setUnitId(bjZzzx.getId());
+            }
             terms.put("auditUnitId", loginUser.getUnitId());
             terms.put("applyStatus", status);
             return ReturnSucUtils.getRepInfo(service.pageMyTaskSh(pageRequest, type, terms));
@@ -1121,6 +1163,13 @@
             }
             PageRequest pageRequest = PageRequest.of(page - 1, size, sort);
             CtUserDTO loginUser = custClient.clientGetUserAll(userId);
+            CtUnitDTO unitById = custClient.getUnitById(loginUser.getUnitId());
+            //如果是政法委,赋予综治中心查看案件的权限,政法委不接收案子处理,只负责指导,所以可以直接赋予
+            if (201 == unitById.getUnitType()) {
+                CtUnitDTO bjZzzx = custClient.getBjZzzx(unitById.getId());
+                if (bjZzzx != null)
+                    loginUser.setUnitId(bjZzzx.getId());
+            }
             terms.put("applyUnitId", loginUser.getUnitId());
             return ReturnSucUtils.getRepInfo(service.pageMyTaskShWSQD(pageRequest, terms));
         } catch (Exception e) {
@@ -1196,6 +1245,13 @@
             }
             PageRequest pageRequest = PageRequest.of(page - 1, size, sort);
             CtUserDTO loginUser = custClient.clientGetUserAll(userId);
+            CtUnitDTO unitById = custClient.getUnitById(loginUser.getUnitId());
+            //如果是政法委,赋予综治中心查看案件的权限,政法委不接收案子处理,只负责指导,所以可以直接赋予
+            if (201 == unitById.getUnitType()) {
+                CtUnitDTO bjZzzx = custClient.getBjZzzx(unitById.getId());
+                if (bjZzzx != null)
+                    loginUser.setUnitId(bjZzzx.getId());
+            }
             Page<FrontPageListDTO> frontPageListDTOPage = null;
             if (StringUtils.isNotBlank(loginUser.getUnitId())) {
                 terms.put("type", status);
@@ -1446,6 +1502,13 @@
             }
 
             CtUserDTO loginUser = custClient.clientGetUserAll(userId);
+            CtUnitDTO unitById = custClient.getUnitById(loginUser.getUnitId());
+            //如果是政法委,赋予综治中心查看案件的权限,政法委不接收案子处理,只负责指导,所以可以直接赋予
+            if (201 == unitById.getUnitType()) {
+                CtUnitDTO bjZzzx = custClient.getBjZzzx(unitById.getId());
+                if (bjZzzx != null)
+                    loginUser.setUnitId(bjZzzx.getId());
+            }
             terms.put("handleUnitId", loginUser.getUnitId());
             // 排序
             Sort sort = null;
@@ -1593,22 +1656,23 @@
 
     /**
      * 测试接口
-     * @url {ctx}/api/web/caseTask/test
+     *
      * @return Object
+     * @url {ctx}/api/web/caseTask/test
      */
     @GetMapping("/test")
     public Object test(@RequestParam(value = "caseId") String caseId,
-                              @RequestParam(value = "oldTaskId") String oldTaskId, @RequestParam(value = "newTaskId") String newTaskId,
-                              @RequestParam(value = "oldProcess") String oldProcess,@RequestParam(value = "newProcess") String newProcess,
+                       @RequestParam(value = "oldTaskId") String oldTaskId, @RequestParam(value = "newTaskId") String newTaskId,
+                       @RequestParam(value = "oldProcess") String oldProcess, @RequestParam(value = "newProcess") String newProcess,
                        @RequestParam(value = "ownerIds") String ownerIds, @RequestParam(value = "userId") String userId,
                        @RequestParam(value = "handleStatus") String handleStatus) {
         try {
             CaseTask oldTask = null;
-            if(StringUtils.isNotBlank(oldTaskId)){
+            if (StringUtils.isNotBlank(oldTaskId)) {
                 oldTask = service.getById(oldTaskId);
             }
             CaseTask newTask = null;
-            if(StringUtils.isNotBlank(newTaskId)){
+            if (StringUtils.isNotBlank(newTaskId)) {
                 newTask = service.getById(newTaskId);
             }
             List<String> ownerIdList = Arrays.asList(ownerIds.split(","));
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 c746303..69d7b7a 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
@@ -411,22 +411,6 @@
                 <if test="terms.mediatorId != null and terms.mediatorId !=''">
                     and b.mediator_id = #{terms.mediatorId}
                 </if>
-                <if test="terms.visitTimeStart != null and terms.visitTimeStart !='' and terms.visitTimeEnd != null and terms.visitTimeEnd !=''">
-                    and (DATE_FORMAT(a.visit_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ >= ]]> #{terms.visitTimeStart}
-                    and DATE_FORMAT(a.visit_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ <= ]]> #{terms.visitTimeEnd})
-                </if>
-                <if test="terms.createStart != null and terms.createStart !='' and terms.createEnd != null and terms.createEnd !=''">
-                    and (DATE_FORMAT(a.create_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ >= ]]> #{terms.createStart}
-                    and DATE_FORMAT(a.create_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ <= ]]> #{terms.createEnd})
-                </if>
-                <if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''">
-                    and (DATE_FORMAT(b.close_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ >= ]]> #{terms.closeStart}
-                    and DATE_FORMAT(b.close_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ <= ]]> #{terms.closeEnd})
-                </if>
-                <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.queCity != null and terms.queCity !="" and terms.statistics != null and terms.areaType == "1"'>
                     and (b.belong_unit_id is not null and c.city = #{terms.queCity}
                     <if test="terms.unitGrades != null and terms.unitGrades.size > 0">
@@ -573,6 +557,25 @@
                 </if>
                 <if test="terms.agreeType != null and terms.agreeType !=''">
                     and b.agree_type = #{terms.agreeType}
+                </if>
+                <if test="terms.systemSource != null and terms.systemSource !=''">
+                    and b.sys_source = #{terms.systemSource}
+                </if>
+                <if test="terms.visitTimeStart != null and terms.visitTimeStart !='' and terms.visitTimeEnd != null and terms.visitTimeEnd !=''">
+                    and (DATE_FORMAT(a.visit_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ >= ]]> #{terms.visitTimeStart}
+                    and DATE_FORMAT(a.visit_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ <= ]]> #{terms.visitTimeEnd})
+                </if>
+                <if test="terms.createStart != null and terms.createStart !='' and terms.createEnd != null and terms.createEnd !=''">
+                    and (a.create_time <![CDATA[ >= ]]> #{terms.createStart}
+                    and a.create_time <![CDATA[ <= ]]> #{terms.createEnd})
+                </if>
+                <if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''">
+                    and (DATE_FORMAT(b.close_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ >= ]]> #{terms.closeStart}
+                    and DATE_FORMAT(b.close_time,'%Y-%m-%d %H:%i:%s') <![CDATA[ <= ]]> #{terms.closeEnd})
+                </if>
+                <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>
             </where>
         </if>
@@ -1121,7 +1124,11 @@
                 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
+        sum(case when a.info_process = 3 and b.medi_result = '22_00025-2' then 1 else 0 end) as failNum,
+        sum(case when a.canal_second = '22_00003-8' then 1 else 0 end) as bmpcNum,
+        sum(case when a.canal_second = '22_00003-2' then 1 else 0 end) as wgpcNum,
+        sum(case when a.canal_second = '22_00003-1' then 1 else 0 end) as fjwjfNum,
+        sum(case when a.canal_second = '22_00003-7' then 1 else 0 end) as zxjfNum
         FROM
         dyh_case_info a
         inner JOIN dyh_case_info_unfold b on a.id = b.id
diff --git a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/domain/dto/CaseStatisticsBaseDTO.java b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/domain/dto/CaseStatisticsBaseDTO.java
index 419b3f0..4b4617d 100644
--- a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/domain/dto/CaseStatisticsBaseDTO.java
+++ b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/domain/dto/CaseStatisticsBaseDTO.java
@@ -1,6 +1,8 @@
 package cn.huge.module.cases.domain.dto;
 
 import lombok.Data;
+
+import java.util.ArrayList;
 import java.util.List;
 
 /**
@@ -10,28 +12,32 @@
 @Data
 public class CaseStatisticsBaseDTO {
     private Integer totalNum=0;//总记录数
-     private Integer processNum=0;//办理中数量
-     private Integer finishNum=0;//已结案数量
-     private Integer rejectNum=0;//不予受理数量
-     private Integer resolveNum=0;//化解成功数量
-     private String resolveRate;//化解成功率
-     private Integer unResolveNum=0;//化解不成功数量
-     private String unResolveRate;//化解不成功率
-     private Integer resolveingNum=0;//化解中数量
-     private String resolveingRate;//化解中率
-//    private Integer rejectNum=0;//不予受理数量
+    // private Integer processNum=0;//办理中数量
+    // private Integer finishNum=0;//已结案数量
+    // private Integer rejectNum=0;//不予受理数量
+    // private Integer resolveNum=0;//化解成功数量
+    // private String resolveRate;//化解成功率
+    // private Integer unResolveNum=0;//化解不成功数量
+    // private String unResolveRate;//化解不成功率
+    // private Integer resolveingNum=0;//化解中数量
+    // private String resolveingRate;//化解中率
+    private Integer rejectNum=0;//不予受理数量
     private String rejectRate;//不予受理率
-//    private Integer processNum=0;//化解中数量
+    private Integer processNum=0;//化解中数量
     private String processRate;//化解中率
-//    private Integer finishNum=0;//化解成功数量
+    private Integer finishNum=0;//化解成功数量
     private String finishRate;//化解成功率
     private Integer failNum=0;//化解不成功数量
     private String failRate;//化解不成功率
 
-    private Integer toDayTotalNum=0;//今日新增总记录数
-    private Integer toDayProcessNum=0;//今日新增化解中数
-    private Integer toDayRejectNum=0;//今日新增不予受理数量
-    private Integer toDayFinishNum=0;//今日新增已结案数量
+    private Integer bmpcNum;//部门排查
+    private String bmpcCode="22_00003-8";//部门排查编码
+    private Integer wgpcNum;//网格排查
+    private String wgpcCode="22_00003-2";//网格排查编码
+    private Integer fjwjfNum;//非警务纠纷
+    private String fjwjfCode="22_00003-1";//非警务纠纷编码
+    private Integer zxjfNum;//专项纠纷
+    private String zxjfCode="22_00003-7";//专项纠纷编码
 
     private Integer oneLevelNum=0;//1级事件数量
     private Integer twoLevelNum=0;//2级事件数量
@@ -48,7 +54,7 @@
     private CaseStatisticsSourceDTO oneSecondSource;//非警务纠纷
     private CaseStatisticsSourceDTO twoSecondSource;//12345
     private CaseStatisticsSourceDTO threeSecondSource;//网格上报
-    private List<CaseStatisticsTypeDTO> typeList;//纠纷类型集合
+    private List<CaseStatisticsTypeDTO> typeList = new ArrayList<>();//纠纷类型集合
 
     private List<CasePageDTO> caseList;//案件集合(实时动态)
 
@@ -66,8 +72,8 @@
     private String xfRate;//信访占比
     private Integer ldzcNum=0;//劳动仲裁数
     private String ldzcRate;//劳动仲裁占比
-    private Integer fjwjfNum=0;//非警务纠纷数
-    private String fjwjfRate;//非警务纠纷占比
+    private Integer tzfjwjfNum=0;//非警务纠纷数
+    private String tzfjwjfRate;//非警务纠纷占比
 
 //    private Integer allNum=0;//全部数
 //    private Integer sysNum=0;//本系统数
diff --git a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseEvaluateService.java b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseEvaluateService.java
index c9329ce..460b21e 100644
--- a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseEvaluateService.java
+++ b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseEvaluateService.java
@@ -266,7 +266,7 @@
             Date nowDate = DateUtils.getNowDate();
             // 查询当事人评价任务
             QueryWrapper<CaseTask> caseTaskQueryWrapper = new QueryWrapper<>();
-            caseTaskQueryWrapper.in("case_id", idList).eq("node_id", FlowNodeEnum.FLOW_NODE_DSRPJ.getIndex());
+            caseTaskQueryWrapper.in("case_id", idList).eq("node_id", FlowNodeEnum.FLOW_NODE_DSRPJ.getIndex()).orderByDesc("create_time");
             List<CaseTask> dsrpjCaseTaskList = caseTaskService.list(caseTaskQueryWrapper);
             for(CaseTask dsrpjCaseTask: dsrpjCaseTaskList){
                 // 完成当前当事人评价节点任务
@@ -285,14 +285,19 @@
                 CaseTask jagdCaseTask = new CaseTask();
                 jagdCaseTask.setId(utilsClient.getNewTimeId());
                 jagdCaseTask.setCaseId(dsrpjCaseTask.getCaseId());
-                jagdCaseTask.setFlowableId(jagdFlowNode.getFlowableId());
-                jagdCaseTask.setProcessInstanceId(jagdFlowNode.getProcessInstanceId());
-                jagdCaseTask.setProcessTaskId(jagdFlowNode.getProcessTaskId());
-                jagdCaseTask.setNodeType(jagdFlowNode.getNodeType());
-                jagdCaseTask.setNodeId(jagdFlowNode.getNodeId());
-                jagdCaseTask.setNodeName(jagdFlowNode.getNodeName());
-                jagdCaseTask.setFlowId(jagdFlowNode.getFlowId());
-                jagdCaseTask.setNodeShowName(jagdFlowNode.getNodeShowName());
+                if(jagdFlowNode!=null){
+                    jagdCaseTask.setFlowableId(jagdFlowNode.getFlowableId());
+                    jagdCaseTask.setProcessInstanceId(jagdFlowNode.getProcessInstanceId());
+                    jagdCaseTask.setProcessTaskId(jagdFlowNode.getProcessTaskId());
+                    jagdCaseTask.setNodeType(jagdFlowNode.getNodeType());
+                    jagdCaseTask.setNodeId(jagdFlowNode.getNodeId());
+                    jagdCaseTask.setNodeName(jagdFlowNode.getNodeName());
+                    jagdCaseTask.setFlowId(jagdFlowNode.getFlowId());
+                    jagdCaseTask.setNodeShowName(jagdFlowNode.getNodeShowName());
+                    if (jagdFlowNode.getExpire() != 0) {
+                        jagdCaseTask.setExpireTime(syHolidayService.getExpiryDay(nowDate, jagdFlowNode.getExpire()));
+                    }
+                }
                 jagdCaseTask.setCaseTaskType(CaseTaskConsts.CASE_TASK_TYPE_1);
                 // 任务所属单位:结案申请组织
                 caseTaskQueryWrapper.clear();
@@ -306,9 +311,6 @@
                 jagdCaseTask.setReadStatus(CaseTaskConsts.READ_STATUS_0);
                 jagdCaseTask.setStatus(CaseTaskConsts.TASK_STATUS_2);
                 // 任务处理时限
-                if (jagdFlowNode.getExpire() != 0) {
-                    jagdCaseTask.setExpireTime(syHolidayService.getExpiryDay(nowDate, jagdFlowNode.getExpire()));
-                }
                 jagdCaseTask.setHandleUnitId(jasqCaseTaskList.get(0).getHandleUnitId());
                 jagdCaseTask.setHandleUnitName(jasqCaseTaskList.get(0).getHandleUnitName());
                 jagdCaseTask.setHandleDeptId(jasqCaseTaskList.get(0).getHandleDeptId());
diff --git a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseInfoService.java b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseInfoService.java
index bd84d87..aa55dba 100644
--- a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseInfoService.java
+++ b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseInfoService.java
@@ -311,13 +311,19 @@
             generateQrCodeRequestVo.setBusinessSource("02");
             generateQrCodeRequestVo.setGenerateUnifiedCode(true);
             generateQrCodeRequestVo.setInfoSource("03");
-            String area = this.formatGridCode(ctUnitDTO.getArea());
+            log.info("xsdgridCode:{}",registerSaveDTO.getQueArea());
+            String area = this.formatGridCode(registerSaveDTO.getQueArea());
+            log.info("xsdgridCode:{}",area);
             generateQrCodeRequestVo.setGridCode(area);
             caseInfo.setCaseRef(sysClient.getCaseRefByGenerateQrCode(generateQrCodeRequestVo));
             // 获取调解案号
             caseInfo.setCaseNo(utilsClient.createCaseNo(ctUnitDTO.getArea()));
             caseInfo.setVisitWay(CaseBaseConstsEnum.getVisitWayByCanal(caseInfo.getCanal()).getIndex());
             caseInfo.setVisitWayName(CaseBaseConstsEnum.getVisitWayByCanal(caseInfo.getCanal()).getDes());
+            if (caseInfo.getCanal().equals(CaseBaseConstsEnum.CASE_CANAL_3.getIndex())) {
+                caseInfo.setCanalSecond(CaseBaseConstsEnum.CASE_CANAL_SECOND_8.getIndex());
+                caseInfo.setCanalSecondName(CaseBaseConstsEnum.CASE_CANAL_SECOND_8.getDes());
+            }
             //默认小程序可见
             if (ObjectUtils.isNotEmpty(caseInfo.getCanal())) {
                 if (CaseBaseConstsEnum.CASE_CANAL_1.getIndex().equals(caseInfo.getCanal())) {
@@ -1135,7 +1141,7 @@
         }
         if (ObjectUtils.isNotEmpty(content)) {
             for (CasePageDTO casePageDTO : content) {
-                if (CaseBaseConstsEnum.CASE_CANAL_4.getIndex().equals(casePageDTO.getCanal())) {
+                if (StringUtils.isNotEmpty(casePageDTO.getCanalSecondName())) {
                     casePageDTO.setCanalName(casePageDTO.getCanalName() + "-" + casePageDTO.getCanalSecondName());
                 }
                 StringBuffer sb = new StringBuffer();
@@ -1308,10 +1314,10 @@
         return new PageImpl<CasePageDTO>(content, page, total);
     }
 
-        /**
+    /**
      * 统计调解过程
      * 计算案件的调解过程相关统计数据,包括不予受理率、化解中率、化解成功率、化解不成功率等
-     * 
+     *
      * @param terms 统计条件
      * @return 包含调解过程统计数据的DTO对象
      */
@@ -1324,15 +1330,15 @@
         caseStatisticsBaseDTO.setFailRate(BigDecimalUtil.integerDivideDelZero(caseStatisticsBaseDTO.getFailNum() * 100, baseTotalNum, 1));
         // 如果 baseTotalNum为0 设置 总数为0
         caseStatisticsBaseDTO.setTotalNum(baseTotalNum);
-        
+
         Integer levelTotalNum = caseStatisticsBaseDTO.getOneLevelNum() + caseStatisticsBaseDTO.getTwoLevelNum() + caseStatisticsBaseDTO.getThreeLevelNum();
         caseStatisticsBaseDTO.setOneLevelRate(BigDecimalUtil.integerDivideDelZero(caseStatisticsBaseDTO.getOneLevelNum() * 100, levelTotalNum, 1));
         caseStatisticsBaseDTO.setTwoLevelRate(BigDecimalUtil.integerDivideDelZero(caseStatisticsBaseDTO.getTwoLevelNum() * 100, levelTotalNum, 1));
         caseStatisticsBaseDTO.setThreeLevelRate(BigDecimalUtil.integerDivideDelZero(caseStatisticsBaseDTO.getThreeLevelNum() * 100, levelTotalNum, 1));
-        
+
         return caseStatisticsBaseDTO;
     }
-    
+
 
     /**
      * 纠纷态势
@@ -1498,29 +1504,8 @@
             }
             areaTotal = areaTotal + caseStatisticsAreaDTO.getCaseNum();
 
-            //本及:承办单位是本及和没有承办单位并且没有下级区域编码
-//            if(ObjectUtils.isEmpty(caseStatisticsAreaDTO.getAreaCode()) || unitGrades.contains(caseStatisticsAreaDTO.getUnitGrade())){
-//                allArea.setCaseNum(dellNull(caseStatisticsAreaDTO.getCaseNum()) + dellNull(allArea.getCaseNum()));
-//                allArea.setResolveNum(dellNull(caseStatisticsAreaDTO.getResolveNum()) + dellNull(allArea.getResolveNum()));
-//                allArea.setUnResolveNum(dellNull(caseStatisticsAreaDTO.getUnResolveNum()) + dellNull(allArea.getUnResolveNum()));
-//                allArea.setResolveingNum(dellNull(caseStatisticsAreaDTO.getResolveingNum()) + dellNull(allArea.getResolveingNum()));
-//            }else{
-//                areaList.add(caseStatisticsAreaDTO);
-//                areaCodeList.add(caseStatisticsAreaDTO.getAreaCode());
-//            }
         }
         areaList.add(allArea);
-//        if ("1".equals(areaType)) {
-//            Map<String, String> area = getArea();
-//            for (String areaName : area.keySet()) {
-//                if (!areaNames.contains(areaName)) {
-//                    CaseStatisticsAreaDTO areaChild = new CaseStatisticsAreaDTO();
-//                    areaChild.setAreaCode(area.get(areaName));
-//                    areaChild.setAreaName(areaName);
-//                    areaList.add(areaChild);
-//                }
-//            }
-//        }
 
         List<QueAreaDTO> queArea = listAreaByType(areaCode);
         log.info("listAreaByType {}", JSON.toJSONString(queArea));
@@ -1559,12 +1544,6 @@
             } else {
                 otherCaseNum = otherCaseNum + dellNull(caseStatisticsTypeDTO.getCaseNum());
             }
-//            if (i > 5) {
-//                otherCaseNum = otherCaseNum + dellNull(caseStatisticsTypeDTO.getCaseNum());
-//            } else {
-//                typeList.add(caseStatisticsTypeDTO);
-//            }
-
         }
         for (CaseStatisticsTypeDTO caseStatisticsTypeDTO : typeList) {
             caseStatisticsTypeDTO.setCaseRate(BigDecimalUtil.integerDivideDelZero(caseStatisticsTypeDTO.getCaseNum() * 100, typeTotalNum, 1));
@@ -2292,34 +2271,220 @@
         return caseOverviewDetailDTOs;
     }
 
-    public CaseStatisticsBaseDTO ledger(Map<String, Object> terms, String userId) throws IOException {
-        // 备份原始的类型筛选条件,用于后续恢复
-        Map<String, Object> originalTypeTerms = new HashMap<>();
-        if (terms.containsKey("canal")) {
-            originalTypeTerms.put("canal", terms.get("canal"));
+    public CaseStatisticsBaseDTO ledger(Map<String, Object> terms, String userId,String ledgerType) throws IOException {
+        terms.put("statistics", "1");
+
+        CtUnitDTO ctUnitDTO = null;
+        if (ObjectUtils.isNotEmpty(userId)) {
+            ctUnitDTO = custClient.getUnitByUserId(userId);
         }
-        if (terms.containsKey("canalSecond")) {
-            originalTypeTerms.put("canalSecond", terms.get("canalSecond"));
-        }
-        if (terms.containsKey("canalList")) {
-            originalTypeTerms.put("canalList", terms.get("canalList"));
-        }
-        if (terms.containsKey("canalSecondNot")) {
-            originalTypeTerms.put("canalSecondNot", terms.get("canalSecondNot"));
-        }
-        if (terms.containsKey("canalSecondAll")) {
-            originalTypeTerms.put("canalSecondAll", terms.get("canalSecondAll"));
+        String areaCode = null;
+        //目前没有村居数据,所以单位等级是4的也归集到3里面
+        if (ObjectUtils.isNotEmpty(ctUnitDTO)) {
+            if (ctUnitDTO.getUnitGrade().equals(1)) {
+                terms.put("queCity", ctUnitDTO.getCity());
+            } else if (ctUnitDTO.getUnitGrade().equals(2)) {
+                terms.put("queArea", ctUnitDTO.getArea());
+            } else if (ctUnitDTO.getUnitGrade().equals(3)) {
+                terms.put("queRoad", ctUnitDTO.getRoad());
+            } else if (ctUnitDTO.getUnitGrade().equals(4)) {
+                terms.put("queVillage", ctUnitDTO.getVillage());
+            }
         }
 
-        // 临时移除类型筛选条件,以便 statistics 获取全量数据
-        terms.remove("canal");
-        terms.remove("canalSecond");
-        terms.remove("canalList");
-        terms.remove("canalSecondNot");
-        terms.remove("canalSecondAll");
+        //目前没有村居,所以区和街道进来都是按街道展示
+        String areaType = null;
+        String childAreaType = null;
+        List<Integer> unitGrades = new ArrayList<>();
+        List<Integer> childUnitGrades = new ArrayList<>();
+        String childUnitGradeStr = null;
+        String unitGradeStr = null;
+        Boolean isLast = false;
+        if (ObjectUtils.isNotEmpty(terms.get("queVillage"))) {
+            terms.remove("queArea");
+            terms.remove("queCity");
+            terms.remove("queRoad");
+            areaType = "4";
+            childAreaType = "5";
+            areaCode = terms.get("queVillage") + "";
+            unitGrades.add(4);
+            childUnitGrades.add(5);
+            childUnitGradeStr = "5";
+            unitGradeStr = "4";
+            isLast = true;
+        } else if (ObjectUtils.isNotEmpty(terms.get("queRoad"))) {
+            terms.remove("queArea");
+            terms.remove("queCity");
+            areaType = "3";
+            childAreaType = "4";
+            areaCode = terms.get("queRoad") + "";
+            unitGrades.add(3);
+            childUnitGrades.add(4);
+            childUnitGradeStr = "4";
+            unitGradeStr = "3";
+        } else if (ObjectUtils.isNotEmpty(terms.get("queArea"))) {
+            terms.remove("queCity");
+            areaType = "2";
+            childAreaType = "3";
+            areaCode = terms.get("queArea") + "";
+            unitGrades.add(2);
+            childUnitGrades.add(3);
+            childUnitGrades.add(4);
+            childUnitGradeStr = "3,4";
+            unitGradeStr = "2";
+        } else {
+            areaType = "1";
+            childAreaType = "2";
+            unitGrades.add(1);
+            childUnitGrades.add(2);
+            childUnitGrades.add(3);
+            childUnitGrades.add(4);
+            if (ObjectUtils.isNotEmpty(ctUnitDTO)) {
+                areaCode = ctUnitDTO.getCity();
+            } else {
+                areaCode = "440100";
+            }
+            childUnitGradeStr = "2,3,4";
+            unitGradeStr = "1";
+        }
+        //基础数据统计
+        terms.put("areaType", areaType);
+        // 调用统计调解过程的方法
+        CaseStatisticsBaseDTO caseStatisticsBaseDTO = new CaseStatisticsBaseDTO();
+        List<String> areaCodeList = new ArrayList<>();
+        List<CaseStatisticsAreaDTO> areaList = new ArrayList<>();
 
+        //本系统或者全部的时候才去查询数据
+        if(ObjectUtils.isEmpty(ledgerType) || "1".equals(ledgerType)){
+            caseStatisticsBaseDTO = statisticsProcess(terms);
+
+            //区域数据统计
+            List<CaseStatisticsAreaDTO> caseStatisticsAreaDTOS = new ArrayList<>();
+            if (!isLast) {
+                terms.put("areaType", childAreaType);
+                terms.put("unitGrades", childUnitGrades);
+                caseStatisticsAreaDTOS = mapper.statisticsArea(terms);
+                if (ObjectUtils.isEmpty(caseStatisticsAreaDTOS)) {
+                    caseStatisticsAreaDTOS = new ArrayList<>();
+                } else {
+                    for (CaseStatisticsAreaDTO caseStatisticsAreaDTO : caseStatisticsAreaDTOS) {
+                        caseStatisticsAreaDTO.setAreaType(childAreaType);
+                        caseStatisticsAreaDTO.setUnitGrades(childUnitGradeStr);
+                        if ("4".equals(childAreaType)) {
+                            caseStatisticsAreaDTO.setQueVillage(caseStatisticsAreaDTO.getAreaCode());
+                        } else if ("3".equals(childAreaType)) {
+                            caseStatisticsAreaDTO.setQueRoad(caseStatisticsAreaDTO.getAreaCode());
+                        } else if ("2".equals(childAreaType)) {
+                            caseStatisticsAreaDTO.setQueArea(caseStatisticsAreaDTO.getAreaCode());
+                        }
+                    }
+                }
+            }
+
+            //本级区数据
+            terms.put("areaType", areaType);
+            terms.put("unitGrades", unitGrades);
+            List<CaseStatisticsAreaDTO> allAreas = mapper.statisticsArea(terms);
+            CaseStatisticsAreaDTO allArea = new CaseStatisticsAreaDTO();
+            if (ObjectUtils.isNotEmpty(allAreas)) {
+                allArea = allAreas.get(0);
+            }
+            terms.remove("unitGrades");
+            allArea.setAreaName("本级");
+            allArea.setAreaCode("0");
+            allArea.setAreaType(areaType);
+            allArea.setUnitGrades(unitGradeStr);
+            if (ObjectUtils.isNotEmpty(terms.get("queVillage"))) {
+                allArea.setQueVillage(terms.get("queVillage") + "");
+            }
+            if (ObjectUtils.isNotEmpty(terms.get("queRoad"))) {
+                allArea.setQueRoad(terms.get("queRoad") + "");
+            }
+            if (ObjectUtils.isNotEmpty(terms.get("queArea"))) {
+                allArea.setQueArea(terms.get("queArea") + "");
+            }
+            if (ObjectUtils.isNotEmpty(terms.get("queCity"))) {
+                allArea.setQueCity(terms.get("queCity") + "");
+            }
+
+            List<String> areaNames = new ArrayList<>();//为兼容白云区数据
+            Integer areaTotal = allArea.getCaseNum();
+            for (CaseStatisticsAreaDTO caseStatisticsAreaDTO : caseStatisticsAreaDTOS) {
+                areaNames.add(caseStatisticsAreaDTO.getAreaName());
+                if (ObjectUtils.isEmpty(caseStatisticsAreaDTO.getAreaCode())) {
+                    allArea.setCaseNum(dellNull(caseStatisticsAreaDTO.getCaseNum()) + dellNull(allArea.getCaseNum()));
+                    allArea.setResolveNum(dellNull(caseStatisticsAreaDTO.getResolveNum()) + dellNull(allArea.getResolveNum()));
+                    allArea.setUnResolveNum(dellNull(caseStatisticsAreaDTO.getUnResolveNum()) + dellNull(allArea.getUnResolveNum()));
+                    allArea.setResolveingNum(dellNull(caseStatisticsAreaDTO.getResolveingNum()) + dellNull(allArea.getResolveingNum()));
+                    allArea.setRejectNum(dellNull(caseStatisticsAreaDTO.getRejectNum()) + dellNull(allArea.getRejectNum()));
+                } else {
+                    areaList.add(caseStatisticsAreaDTO);
+                    areaCodeList.add(caseStatisticsAreaDTO.getAreaCode());
+                }
+                areaTotal = areaTotal + caseStatisticsAreaDTO.getCaseNum();
+
+            }
+            areaList.add(allArea);
+
+            //纠纷类型统计
+            List<CaseStatisticsTypeDTO> caseStatisticsTypeDTOS = mapper.statisticsTypeFirst(terms);
+            if (ObjectUtils.isNotEmpty(caseStatisticsTypeDTOS)) {
+                sortType(caseStatisticsTypeDTOS);
+            }
+            Integer typeTotalNum = 0;
+            Integer otherCaseNum = 0;
+            int i = 1;
+            List<CaseStatisticsTypeDTO> typeList = new ArrayList<>();
+            for (CaseStatisticsTypeDTO caseStatisticsTypeDTO : caseStatisticsTypeDTOS) {
+                typeTotalNum = typeTotalNum + dellNull(caseStatisticsTypeDTO.getCaseNum());
+                if (i < 6 && !"其他".equals(caseStatisticsTypeDTO.getCaseTypeName())) {
+                    typeList.add(caseStatisticsTypeDTO);
+                    i++;
+                } else {
+                    otherCaseNum = otherCaseNum + dellNull(caseStatisticsTypeDTO.getCaseNum());
+                }
+            }
+            for (CaseStatisticsTypeDTO caseStatisticsTypeDTO : typeList) {
+                caseStatisticsTypeDTO.setCaseRate(BigDecimalUtil.integerDivideDelZero(caseStatisticsTypeDTO.getCaseNum() * 100, typeTotalNum, 1));
+            }
+            if (otherCaseNum > 0) {
+                CaseStatisticsTypeDTO caseStatisticsTypeDTO = new CaseStatisticsTypeDTO();
+                caseStatisticsTypeDTO.setCaseTypeName("其他");
+                caseStatisticsTypeDTO.setCaseNum(otherCaseNum);
+                caseStatisticsTypeDTO.setCaseRate(BigDecimalUtil.integerDivideDelZero(caseStatisticsTypeDTO.getCaseNum() * 100, typeTotalNum, 1));
+                typeList.add(caseStatisticsTypeDTO);
+                caseStatisticsBaseDTO.setTypeList(typeList);
+            }
+        }
+
+        List<QueAreaDTO> queArea = listAreaByType(areaCode);
+        log.info("listAreaByType {}", JSON.toJSONString(queArea));
+        for (QueAreaDTO caseAreaDTO : queArea) {
+            if (!areaCodeList.contains(caseAreaDTO.getAreaCode())) {
+                CaseStatisticsAreaDTO areaChild = new CaseStatisticsAreaDTO();
+                areaChild.setAreaCode(caseAreaDTO.getAreaCode());
+                areaChild.setAreaName(caseAreaDTO.getAreaName());
+                areaChild.setCaseNum(0);
+                areaChild.setResolveNum(0);
+                areaChild.setUnResolveNum(0);
+                areaChild.setResolveingNum(0);
+                areaList.add(areaChild);
+            }
+        }
+
+        if (ObjectUtils.isNotEmpty(areaList)) {
+            sortArea(areaList);
+        }
+
+        caseStatisticsBaseDTO.setAreaList(areaList);
+
+
+        return caseStatisticsBaseDTO;
+    }
+
+    public CaseStatisticsBaseDTO ledgerCount(Map<String, Object> terms, String userId) throws IOException {
         // 获取全量基础统计数据
-        CaseStatisticsBaseDTO statistics = statistics(terms, userId);
+        CaseStatisticsBaseDTO statistics = new CaseStatisticsBaseDTO();
 
         terms.put("statistics", "1");
         //根据用户筛选区域范围
@@ -2356,316 +2521,40 @@
         terms.remove("canalSecond");
         terms.remove("canal");
         terms.put("areaType", areaType);
-        terms.put("canalList", Arrays.asList("22_00001-1", "22_00001-2", "22_00001-3"));
         CaseStatisticsBaseDTO caseStatisticsBaseDTO1 = mapper.statisticsBase(terms);
         statistics.setSysNum(caseStatisticsBaseDTO1.getTotalNum());
-        terms.remove("canalList");
-        terms.put("canal", "22_00001-4");
-        terms.put("canalSecond", "22_00003-3");
-        CaseStatisticsBaseDTO caseStatisticsBaseDTO2 = mapper.statisticsBase(terms);
-        statistics.setOttffNum(caseStatisticsBaseDTO2.getTotalNum());
-        terms.put("canalSecond", "22_00003-4");
-        CaseStatisticsBaseDTO caseStatisticsBaseDTO3 = mapper.statisticsBase(terms);
-        statistics.setRmtjNum(caseStatisticsBaseDTO3.getTotalNum());
-        terms.put("canalSecond", "22_00003-6");
-        CaseStatisticsBaseDTO caseStatisticsBaseDTO4 = mapper.statisticsBase(terms);
-        statistics.setXfNum(caseStatisticsBaseDTO4.getTotalNum());
-        terms.put("canalSecond", "22_00003-5");
-        CaseStatisticsBaseDTO caseStatisticsBaseDTO5 = mapper.statisticsBase(terms);
-        statistics.setLdzcNum(caseStatisticsBaseDTO5.getTotalNum());
-        terms.put("canalSecond", "22_00003-1");
-        CaseStatisticsBaseDTO caseStatisticsBaseDTO6 = mapper.statisticsBase(terms);
-        statistics.setFjwjfNum(caseStatisticsBaseDTO6.getTotalNum());
 
-        // 重新计算纠纷类型统计,基于用户选择的类型
-        terms.remove("canalSecond");
-        terms.remove("canal");
-        terms.remove("canalList");
-        terms.remove("canalSecondNot");
-        terms.remove("canalSecondAll");
-
-        // 恢复所有原始类型筛选条件进行纠纷类型统计
-        for (String key : originalTypeTerms.keySet()) {
-            terms.put(key, originalTypeTerms.get(key));
-        }
-        
-        // 调用统计调解过程的方法
-        CaseStatisticsBaseDTO processStats = statisticsProcess(terms);
-        
-        // 将调解过程统计数据合并到统计结果中
-        statistics.setTotalNum(processStats.getTotalNum());
-        statistics.setRejectNum(processStats.getRejectNum());
-        statistics.setProcessNum(processStats.getProcessNum());
-        statistics.setFinishNum(processStats.getFinishNum());
-        statistics.setFailNum(processStats.getFailNum());
-        statistics.setRejectRate(processStats.getRejectRate());
-        statistics.setProcessRate(processStats.getProcessRate());
-        statistics.setFinishRate(processStats.getFinishRate());
-        statistics.setFailRate(processStats.getFailRate());
-        // 重新获取纠纷类型统计(基于完整的选择类型条件)
-        List<CaseStatisticsTypeDTO> caseStatisticsTypeDTOS = mapper.statisticsTypeFirst(terms);
-
-        if (ObjectUtils.isNotEmpty(caseStatisticsTypeDTOS)) {
-            sortType(caseStatisticsTypeDTOS);
-        }
-        Integer typeTotalNum = 0;
-        Integer otherCaseNum = 0;
-        int i = 1;
-        List<CaseStatisticsTypeDTO> typeList = new ArrayList<>();
-        for (CaseStatisticsTypeDTO caseStatisticsTypeDTO : caseStatisticsTypeDTOS) {
-            typeTotalNum = typeTotalNum + dellNull(caseStatisticsTypeDTO.getCaseNum());
-            if (i < 6 && !"其他".equals(caseStatisticsTypeDTO.getCaseTypeName())) {
-                typeList.add(caseStatisticsTypeDTO);
-                i++;
-            } else {
-                otherCaseNum = otherCaseNum + dellNull(caseStatisticsTypeDTO.getCaseNum());
-            }
-        }
-        for (CaseStatisticsTypeDTO caseStatisticsTypeDTO : typeList) {
-            caseStatisticsTypeDTO.setCaseRate(BigDecimalUtil.integerDivideDelZero(caseStatisticsTypeDTO.getCaseNum() * 100, typeTotalNum, 1));
-        }
-        if (otherCaseNum > 0) {
-            CaseStatisticsTypeDTO caseStatisticsTypeDTO = new CaseStatisticsTypeDTO();
-            caseStatisticsTypeDTO.setCaseTypeName("其他");
-            caseStatisticsTypeDTO.setCaseNum(otherCaseNum);
-            caseStatisticsTypeDTO.setCaseRate(BigDecimalUtil.integerDivideDelZero(caseStatisticsTypeDTO.getCaseNum() * 100, typeTotalNum, 1));
-            typeList.add(caseStatisticsTypeDTO);
-        }
-        statistics.setTypeList(typeList);
+//        terms.remove("canalList");
+//        terms.put("canal", "22_00001-4");
+//        terms.put("canalSecond", "22_00003-3");
+//        CaseStatisticsBaseDTO caseStatisticsBaseDTO2 = mapper.statisticsBase(terms);
+//        statistics.setOttffNum(caseStatisticsBaseDTO2.getTotalNum());
+//        terms.put("canalSecond", "22_00003-4");
+//        CaseStatisticsBaseDTO caseStatisticsBaseDTO3 = mapper.statisticsBase(terms);
+//        statistics.setRmtjNum(caseStatisticsBaseDTO3.getTotalNum());
+//        terms.put("canalSecond", "22_00003-6");
+//        CaseStatisticsBaseDTO caseStatisticsBaseDTO4 = mapper.statisticsBase(terms);
+//        statistics.setXfNum(caseStatisticsBaseDTO4.getTotalNum());
+//        terms.put("canalSecond", "22_00003-5");
+//        CaseStatisticsBaseDTO caseStatisticsBaseDTO5 = mapper.statisticsBase(terms);
+//        statistics.setLdzcNum(caseStatisticsBaseDTO5.getTotalNum());
+//        terms.put("canalSecond", "22_00003-1");
+//        CaseStatisticsBaseDTO caseStatisticsBaseDTO6 = mapper.statisticsBase(terms);
+//        statistics.setTzfjwjfNum(caseStatisticsBaseDTO6.getTotalNum());
 
         // 根据原始类型筛选条件计算总数和比率
         // 注意:比率计算应该始终基于所有类型的总数,而不是选择的特定类型数量
-        Integer allNum = statistics.getSysNum() + statistics.getOttffNum() + statistics.getRmtjNum() + statistics.getXfNum() + statistics.getLdzcNum() + statistics.getFjwjfNum();
+        Integer allNum = statistics.getSysNum() + statistics.getOttffNum() + statistics.getRmtjNum() + statistics.getXfNum() + statistics.getLdzcNum() + statistics.getTzfjwjfNum();
 
         statistics.setSysRate(BigDecimalUtil.integerDivideDelZero(statistics.getSysNum() * 100, allNum, 1));
         statistics.setOttffRate(BigDecimalUtil.integerDivideDelZero(statistics.getOttffNum() * 100, allNum, 1));
         statistics.setRmtjRate(BigDecimalUtil.integerDivideDelZero(statistics.getRmtjNum() * 100, allNum, 1));
         statistics.setXfRate(BigDecimalUtil.integerDivideDelZero(statistics.getXfNum() * 100, allNum, 1));
         statistics.setLdzcRate(BigDecimalUtil.integerDivideDelZero(statistics.getLdzcNum() * 100, allNum, 1));
-        statistics.setFjwjfRate(BigDecimalUtil.integerDivideDelZero(statistics.getFjwjfNum() * 100, allNum, 1));
+        statistics.setTzfjwjfRate(BigDecimalUtil.integerDivideDelZero(statistics.getTzfjwjfNum() * 100, allNum, 1));
         statistics.setAllNum(allNum);
-
-        // 重新计算地区统计(areaList),基于用户选择的类型
-        // 清除之前的筛选条件
-        terms.remove("canal");
-        terms.remove("canalSecond");
-        terms.remove("canalList");
-        terms.remove("canalSecondNot");
-        terms.remove("canalSecondAll");
-
-        // 恢复所有原始类型筛选条件进行地区统计
-        for (String key : originalTypeTerms.keySet()) {
-            terms.put(key, originalTypeTerms.get(key));
-        }
-
-        // 从原有逻辑中获取区域相关变量
-        String childAreaType = null;
-        List<Integer> childUnitGrades = new ArrayList<>();
-        String childUnitGradeStr = null;
-        String unitGradeStr = null;
-        Boolean isLast = false;
-        List<Integer> unitGrades = new ArrayList<>();
-
-        if (ObjectUtils.isNotEmpty(terms.get("queVillage"))) {
-            childAreaType = "5";
-            childUnitGrades.add(5);
-            childUnitGradeStr = "5";
-            unitGradeStr = "4";
-            unitGrades.add(4);
-            isLast = true;
-        } else if (ObjectUtils.isNotEmpty(terms.get("queRoad"))) {
-            childAreaType = "4";
-            childUnitGrades.add(4);
-            childUnitGradeStr = "4";
-            unitGradeStr = "3";
-            unitGrades.add(3);
-        } else if (ObjectUtils.isNotEmpty(terms.get("queArea"))) {
-            childAreaType = "3";
-            childUnitGrades.add(3);
-            childUnitGrades.add(4);
-            childUnitGradeStr = "3,4";
-            unitGradeStr = "2";
-            unitGrades.add(2);
-        } else {
-            childAreaType = "2";
-            childUnitGrades.add(2);
-            childUnitGrades.add(3);
-            childUnitGrades.add(4);
-            childUnitGradeStr = "2,3,4";
-            unitGradeStr = "1";
-            unitGrades.add(1);
-        }
-
-        // 重新计算地区统计
-        List<CaseStatisticsAreaDTO> areaStatistics = new ArrayList<>();
-        if (!isLast) {
-            terms.put("areaType", childAreaType);
-            terms.put("unitGrades", childUnitGrades);
-            areaStatistics = mapper.statisticsArea(terms);
-            if (ObjectUtils.isEmpty(areaStatistics)) {
-                areaStatistics = new ArrayList<>();
-            } else {
-                for (CaseStatisticsAreaDTO areaDTO : areaStatistics) {
-                    areaDTO.setAreaType(childAreaType);
-                    areaDTO.setUnitGrades(childUnitGradeStr);
-                    if ("4".equals(childAreaType)) {
-                        areaDTO.setQueVillage(areaDTO.getAreaCode());
-                    } else if ("3".equals(childAreaType)) {
-                        areaDTO.setQueRoad(areaDTO.getAreaCode());
-                    } else if ("2".equals(childAreaType)) {
-                        areaDTO.setQueArea(areaDTO.getAreaCode());
-                    }
-                }
-            }
-        }
-
-        // 本级区数据
-        terms.put("areaType", areaType);
-        terms.put("unitGrades", unitGrades);
-        List<CaseStatisticsAreaDTO> allAreas = mapper.statisticsArea(terms);
-        CaseStatisticsAreaDTO allArea = new CaseStatisticsAreaDTO();
-        if (ObjectUtils.isNotEmpty(allAreas)) {
-            allArea = allAreas.get(0);
-        }
-        terms.remove("unitGrades");
-        allArea.setAreaName("本级");
-        allArea.setAreaCode("0");
-        allArea.setAreaType(areaType);
-        allArea.setUnitGrades(unitGradeStr);
-        if (ObjectUtils.isNotEmpty(terms.get("queVillage"))) {
-            allArea.setQueVillage(terms.get("queVillage") + "");
-        }
-        if (ObjectUtils.isNotEmpty(terms.get("queRoad"))) {
-            allArea.setQueRoad(terms.get("queRoad") + "");
-        }
-        if (ObjectUtils.isNotEmpty(terms.get("queArea"))) {
-            allArea.setQueArea(terms.get("queArea") + "");
-        }
-        if (ObjectUtils.isNotEmpty(terms.get("queCity"))) {
-            allArea.setQueCity(terms.get("queCity") + "");
-        }
-
-        List<String> areaCodeList = new ArrayList<>();
-        List<CaseStatisticsAreaDTO> areaList = new ArrayList<>();
-        for (CaseStatisticsAreaDTO areaDTO : areaStatistics) {
-            if (ObjectUtils.isEmpty(areaDTO.getAreaCode())) {
-                allArea.setCaseNum(dellNull(areaDTO.getCaseNum()) + dellNull(allArea.getCaseNum()));
-                allArea.setResolveNum(dellNull(areaDTO.getResolveNum()) + dellNull(allArea.getResolveNum()));
-                allArea.setUnResolveNum(dellNull(areaDTO.getUnResolveNum()) + dellNull(allArea.getUnResolveNum()));
-                allArea.setResolveingNum(dellNull(areaDTO.getResolveingNum()) + dellNull(allArea.getResolveingNum()));
-                allArea.setRejectNum(dellNull(areaDTO.getRejectNum()) + dellNull(allArea.getRejectNum()));
-            } else {
-                areaList.add(areaDTO);
-                areaCodeList.add(areaDTO.getAreaCode());
-            }
-        }
-        areaList.add(allArea);
-
-        // 添加没有数据的区域(数量为0)
-        String areaCode = null;
-        if (ObjectUtils.isNotEmpty(terms.get("queVillage"))) {
-            areaCode = terms.get("queVillage") + "";
-        } else if (ObjectUtils.isNotEmpty(terms.get("queRoad"))) {
-            areaCode = terms.get("queRoad") + "";
-        } else if (ObjectUtils.isNotEmpty(terms.get("queArea"))) {
-            areaCode = terms.get("queArea") + "";
-        } else {
-            areaCode = terms.get("queCity") != null ? terms.get("queCity") + "" : "440100";
-        }
-
-        List<QueAreaDTO> queArea = listAreaByType(areaCode);
-        for (QueAreaDTO caseAreaDTO : queArea) {
-            if (!areaCodeList.contains(caseAreaDTO.getAreaCode())) {
-                CaseStatisticsAreaDTO areaChild = new CaseStatisticsAreaDTO();
-                areaChild.setAreaCode(caseAreaDTO.getAreaCode());
-                areaChild.setAreaName(caseAreaDTO.getAreaName());
-                areaChild.setCaseNum(0);
-                areaChild.setResolveNum(0);
-                areaChild.setUnResolveNum(0);
-                areaChild.setResolveingNum(0);
-                areaList.add(areaChild);
-            }
-        }
-
-        if (ObjectUtils.isNotEmpty(areaList)) {
-            sortArea(areaList);
-        }
-
-        // 更新statistics中的areaList
-        statistics.setAreaList(areaList);
-
         return statistics;
     }
-
-    // public CaseStatisticsBaseDTO ledger(Map<String, Object> terms, String userId) throws IOException {
-    //     CaseStatisticsBaseDTO statistics = statistics(terms, userId);
-    //
-    //     terms.put("statistics", "1");
-    //     //根据用户筛选区域范围
-    //     CtUnitDTO ctUnitDTO = custClient.getUnitByUserId(userId);
-    //     //目前没有村居数据,所以单位等级是4的也归集到3里面
-    //     String areaType = null;
-    //     terms.remove("unitGrade");
-    //     terms.remove("canal");
-    //     if (ctUnitDTO.getUnitGrade().equals(1)) {
-    //         terms.put("queCity", ctUnitDTO.getCity());
-    //     } else if (ctUnitDTO.getUnitGrade().equals(2)) {
-    //         terms.put("queArea", ctUnitDTO.getArea());
-    //     } else if (ctUnitDTO.getUnitGrade().equals(3)) {
-    //         terms.put("queRoad", ctUnitDTO.getRoad());
-    //     } else if (ctUnitDTO.getUnitGrade().equals(4)) {
-    //         terms.put("queVillage", ctUnitDTO.getRoad());
-    //     }
-    //     if (ObjectUtils.isNotEmpty(terms.get("queVillage"))) {
-    //         terms.remove("queArea");
-    //         terms.remove("queCity");
-    //         terms.remove("queRoad");
-    //         areaType = "4";
-    //     } else if (ObjectUtils.isNotEmpty(terms.get("queRoad"))) {
-    //         terms.remove("queArea");
-    //         terms.remove("queCity");
-    //         areaType = "3";
-    //     } else if (ObjectUtils.isNotEmpty(terms.get("queArea"))) {
-    //         terms.remove("queCity");
-    //         areaType = "2";
-    //     } else {
-    //         areaType = "1";
-    //     }
-    //     //基础数据统计
-    //     terms.remove("canalSecond");
-    //     terms.remove("canal");
-    //     terms.put("areaType", areaType);
-    //     terms.put("canalList", Arrays.asList("22_00001-1", "22_00001-2", "22_00001-3"));
-    //     CaseStatisticsBaseDTO caseStatisticsBaseDTO1 = mapper.statisticsBase(terms);
-    //     statistics.setSysNum(caseStatisticsBaseDTO1.getTotalNum());
-    //     terms.remove("canalList");
-    //     terms.put("canal", "22_00001-4");
-    //     terms.put("canalSecond", "22_00003-3");
-    //     CaseStatisticsBaseDTO caseStatisticsBaseDTO2 = mapper.statisticsBase(terms);
-    //     statistics.setOttffNum(caseStatisticsBaseDTO2.getTotalNum());
-    //     terms.put("canalSecond", "22_00003-4");
-    //     CaseStatisticsBaseDTO caseStatisticsBaseDTO3 = mapper.statisticsBase(terms);
-    //     statistics.setRmtjNum(caseStatisticsBaseDTO3.getTotalNum());
-    //     terms.put("canalSecond", "22_00003-6");
-    //     CaseStatisticsBaseDTO caseStatisticsBaseDTO4 = mapper.statisticsBase(terms);
-    //     statistics.setXfNum(caseStatisticsBaseDTO4.getTotalNum());
-    //     terms.put("canalSecond", "22_00003-5");
-    //     CaseStatisticsBaseDTO caseStatisticsBaseDTO5 = mapper.statisticsBase(terms);
-    //     statistics.setLdzcNum(caseStatisticsBaseDTO5.getTotalNum());
-    //     terms.put("canalSecond", "22_00003-1");
-    //     CaseStatisticsBaseDTO caseStatisticsBaseDTO6 = mapper.statisticsBase(terms);
-    //     statistics.setFjwjfNum(caseStatisticsBaseDTO6.getTotalNum());
-    //
-    //     Integer allNum = statistics.getSysNum() + statistics.getOttffNum() + statistics.getRmtjNum() + statistics.getXfNum() + statistics.getLdzcNum() + statistics.getFjwjfNum();
-    //     statistics.setSysRate(BigDecimalUtil.integerDivideDelZero(statistics.getSysNum() * 100, allNum, 1));
-    //     statistics.setOttffRate(BigDecimalUtil.integerDivideDelZero(statistics.getOttffNum() * 100, allNum, 1));
-    //     statistics.setRmtjRate(BigDecimalUtil.integerDivideDelZero(statistics.getRmtjNum() * 100, allNum, 1));
-    //     statistics.setXfRate(BigDecimalUtil.integerDivideDelZero(statistics.getXfNum() * 100, allNum, 1));
-    //     statistics.setLdzcRate(BigDecimalUtil.integerDivideDelZero(statistics.getLdzcNum() * 100, allNum, 1));
-    //     statistics.setFjwjfRate(BigDecimalUtil.integerDivideDelZero(statistics.getFjwjfNum() * 100, allNum, 1));
-    //     statistics.setAllNum(allNum);
-    //     return statistics;
-    // }
 
     /**
      * 按系列案编号查询
@@ -2717,9 +2606,9 @@
             } else {
                 terms.put("queryType", 3);
             }
-            log.info("xsd:{}",terms);
+            log.info("xsd:{}", terms);
             CtUnitDTO ctUnitDTO = mapper.getUnitByGridCode(terms);
-            log.info("xsd:ctUnitDTO{}",ctUnitDTO);
+            log.info("xsd:ctUnitDTO{}", ctUnitDTO);
             if (ObjectUtils.isNotEmpty(ctUnitDTO)) {
                 if (StringUtils.isNotBlank(ctUnitDTO.getCity()) && StringUtils.isNotBlank(ctUnitDTO.getCityName())) {
                     registerSaveDTO.setQueCity(ctUnitDTO.getCity());
@@ -2807,11 +2696,12 @@
 
                 // 获取调解案号
                 caseInfo.setCaseNo(utilsClient.createCaseNo(ctUnitDTO.getArea()));
-                caseInfo.setVisitWay(CaseBaseConstsEnum.VISIT_WAY_3.getIndex());
-                caseInfo.setVisitWayName(CaseBaseConstsEnum.VISIT_WAY_3.getDes());
-                caseInfo.setCanal(CaseBaseConstsEnum.CASE_CANAL_4.getIndex());
-                caseInfo.setCanalName(CaseBaseConstsEnum.CASE_CANAL_4.getDes());
-
+                caseInfo.setVisitWay(CaseBaseConstsEnum.VISIT_WAY_4.getIndex());
+                caseInfo.setVisitWayName(CaseBaseConstsEnum.VISIT_WAY_4.getDes());
+                if (StringUtils.isEmpty(caseInfo.getCanal())) {
+                    caseInfo.setCanal(CaseBaseConstsEnum.CASE_CANAL_4.getIndex());
+                    caseInfo.setCanalName(CaseBaseConstsEnum.CASE_CANAL_4.getDes());
+                }
                 caseInfo.setCaseLevel(3);
 //                //获取一级类型
 //                SyCause syCause = sysClient.getParentCaseTypeById(caseInfo.getCaseType());
@@ -2827,9 +2717,9 @@
                 }
                 //todo case_title生成、经纬度转换
                 caseInfo.setInputWay(CaseBaseConsts.INPUT_WAY_1);
-                if(registerSaveDTO.getCreateTime()!=null){
+                if (registerSaveDTO.getCreateTime() != null) {
                     caseInfo.setCreateTime(registerSaveDTO.getCreateTime());
-                }else {
+                } else {
                     caseInfo.setCreateTime(nowDate);
                 }
 
diff --git a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseTaskService.java b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseTaskService.java
index fbd1ff1..75ebe25 100644
--- a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseTaskService.java
+++ b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseTaskService.java
@@ -420,11 +420,17 @@
                         sl.setName("自行受理");
                         buttonList.add(sl);
                         buttonList.add(jb);
-                        buttonList.add(bysl);
                         buttonList.add(xqcl);
                         CtUnitDTO ctUnitDTO = custClient.getUnitByUserId(userId);
                         if (UserBaseConsts.UNIT_GRADE_1 != ctUnitDTO.getUnitGrade()) {
                             buttonList.add(sb);
+                        }
+                        if (bysl.getName().equals("不予受理")) {
+                            buttonList.add(bysl);
+                        } else {
+                            if (UserBaseConsts.UNIT_GRADE_2 == ctUnitDTO.getUnitGrade()) {
+                                buttonList.add(bysl);
+                            }
                         }
                     }
                     // 待受理节点
@@ -645,6 +651,14 @@
                     lfdj.setNodeShowName("自行排查");
                     lfdj.setHandleUserName(caseInfo.getInputUserName());
                     lfdj.setHandleUnitName(caseInfo.getInputUnitName());
+                    if(CaseBaseConstsEnum.CASE_CANAL_SECOND_2.getIndex().equals(caseInfo.getCanalSecond())){
+                        lfdj.setHandleUserName("系统自动获取");
+                        lfdj.setHandleUnitName(caseInfo.getCanalSecondName());
+                    }
+                    if(CaseBaseConstsEnum.CASE_CANAL_SECOND_7.getIndex().equals(caseInfo.getCanalSecond())){
+                        lfdj.setHandleUserName("系统自动获取");
+                        lfdj.setHandleUnitName(caseInfo.getCanalSecondName());
+                    }
                 }
                 if (CaseBaseConstsEnum.CASE_CANAL_4.getIndex().equals(caseInfo.getCanal())) {
                     lfdj.setNodeShowName("协同推送");
@@ -1531,7 +1545,7 @@
             dispCaseBaseDTO.setCaseId(caseInfo.getId());
             if ("22_00003-1".equals(caseInfo.getCanalSecond())) {
                 dispCaseBaseDTO.setIsQu(1);
-            }else {
+            } else {
                 dispCaseBaseDTO.setIsQu(0);
             }
             CaseDispBaseDTO caseDispBaseDTO = dispClient.sysDisp(dispCaseBaseDTO);
@@ -2038,8 +2052,13 @@
             CaseInfo caseInfo = caseInfoService.getCaseInfo(dslCaseTask.getCaseId());
             CaseInfo caseInfoPO = new CaseInfo();
             caseInfoPO.setId(dslCaseTask.getCaseId());
-            caseInfoPO.setStatus(CaseStatusBaseConstsEnum.CASE_STATUS_3.getIndex());
-            caseInfoPO.setStatusName(CaseStatusBaseConstsEnum.CASE_STATUS_3.getDes());
+            if (flowOperation == FlowableConsts.OPERATION_jb_zzzx) {
+                caseInfoPO.setStatus(CaseStatusBaseConstsEnum.CASE_STATUS_1.getIndex());
+                caseInfoPO.setStatusName(CaseStatusBaseConstsEnum.CASE_STATUS_1.getDes());
+            } else {
+                caseInfoPO.setStatus(CaseStatusBaseConstsEnum.CASE_STATUS_3.getIndex());
+                caseInfoPO.setStatusName(CaseStatusBaseConstsEnum.CASE_STATUS_3.getDes());
+            }
             caseInfoPO.setProcess(CaseProcessBaseConstsEnum.getByStatus(caseInfoPO.getStatus()).getIndex());
             caseInfoPO.setProcessName(CaseProcessBaseConstsEnum.getByStatus(caseInfoPO.getStatus()).getDes());
             caseInfoPO.setInfoProcess(CaseInfoProcessBaseConstsEnum.getByProcess(caseInfoPO.getProcess()).getIndex());
@@ -2469,8 +2488,12 @@
             ThreadPoolUtils.executor(new AsynUpdateCaseEventNode(jasqCaseTask.getCaseId(), blfkCaseTaskPO,
                     jasqCaseTask, GridEnum.getCatByTaskNode(blfkCaseTask.getNodeId()), GridEnum.EVENT_FLOW_7.getIndex(),
                     ownerIdList, loginUser.getId(), 0, GridEnum.EVENT_PROCESS_STATUS_1.getIndex()));
-            // 化解成功,自动结案审核通过
-            if (MediResultBaseConstsEnum.MEDI_RESULT_1.getIndex().equals(caseWindupApply.getMediResult())) {
+            // 1、如果是综治中心自己结案,就直接结案
+            // 2、交办案件,如果不是,不管成功与否,就审核,审核部门为当前提交部门对应的综治中心
+            // 3、自行受理,直接结案
+            CaseInfo caseInfo = caseInfoService.getById(jasqCaseTask.getCaseId());
+            // 判断是否自行受理
+            if (CaseBaseConsts.ZXSL_STATUS_1 == caseInfo.getZxslStatus()) {
                 // 完成当前结案申请工作流节点任务,走结案审核任务
                 FlowNode jashFlowNode = flowInfoService.completeTask(jasqCaseTask.getFlowableId(), jasqCaseTask.getProcessTaskId(),
                         FlowableConsts.OPERATION_forward, userId);
@@ -2612,7 +2635,7 @@
                     mapper.insert(jagdCaseTask);
                     // 完成结案归档工作流节点任务,结束流程
                     log.info("xsd:结案归档");
-                    CaseInfo caseInfo = caseInfoService.getById(caseWindupApply.getCaseId());
+                    caseInfo = caseInfoService.getById(caseWindupApply.getCaseId());
                     Date createTime = caseInfo.getCreateTime();
                     // 创建 2025年4月30日 的日期对象
                     SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
@@ -2664,14 +2687,16 @@
                 caseInfoUnfoldPO.setCloseTime(nowDate);
                 caseInfoUnfoldPO.setUpdateTime(nowDate);
                 caseInfoUnfoldService.updateCaseInfoUnfold(caseInfoUnfoldPO);
-            } else {// 化解不成功
+            } else {// 不是自行受理
                 // 完成当前结案申请工作流节点任务
                 FlowNode jashFlowNode = flowInfoService.completeTask(jasqCaseTask.getFlowableId(), jasqCaseTask.getProcessTaskId(),
                         FlowableConsts.OPERATION_forward, userId);
-                // 判断是否自行受理
-                CaseInfo caseInfo = caseInfoService.getById(jasqCaseTask.getCaseId());
-                if (CaseBaseConsts.ZXSL_STATUS_1 == caseInfo.getZxslStatus()) {
-                    // 自行受理,自行完成结案审核节点,直接进入下一个节点
+
+                //判断是否是综治中心
+                String unitId = loginUser.getUnitId();
+                CtUnitDTO unitById = custClient.getUnitById(unitId);
+                if (unitById != null && 101 == unitById.getUnitType()) {
+                    // 是综治中心,自行完成结案审核节点,直接进入下一个节点
                     // 新建并自动完成结案审核任务
                     CaseTask jashCaseTask = new CaseTask();
                     jashCaseTask.setId(utilsClient.getNewTimeId());
diff --git a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/flow/service/FlowInfoService.java b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/flow/service/FlowInfoService.java
index 41afe2a..d146108 100644
--- a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/flow/service/FlowInfoService.java
+++ b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/flow/service/FlowInfoService.java
@@ -234,8 +234,8 @@
             return flowNode;
         }catch (Exception e){
             log.error("service方法[FlowInfoService.completeByTaskId]调用异常:"+e, e);
-            throw new ServiceException("FlowInfoService.completeByTaskId", e);
         }
+        return null;
     }
 
     /**
diff --git a/dyh-service/dyh-mediate/src/main/resources/config/application.yml b/dyh-service/dyh-mediate/src/main/resources/config/application.yml
index 8e57553..d7f1f8e 100644
--- a/dyh-service/dyh-mediate/src/main/resources/config/application.yml
+++ b/dyh-service/dyh-mediate/src/main/resources/config/application.yml
@@ -3,8 +3,8 @@
   profiles:
     active:
 #      - dev
-#        - test
-        - prod
+        - test
+#        - prod
 
   devtools:
     restart:
diff --git a/dyh-service/dyh-sys/src/main/java/cn/huge/module/timer/GridCityCaseTimer.java b/dyh-service/dyh-sys/src/main/java/cn/huge/module/timer/GridCityCaseTimer.java
index 2442725..a21f981 100644
--- a/dyh-service/dyh-sys/src/main/java/cn/huge/module/timer/GridCityCaseTimer.java
+++ b/dyh-service/dyh-sys/src/main/java/cn/huge/module/timer/GridCityCaseTimer.java
@@ -73,6 +73,7 @@
         Date nowDate = DateUtils.getNowDate();
         List<String> canalSecondList = new ArrayList<>();
         canalSecondList.add("12");
+        canalSecondList.add("13");
         canalSecondList.add("07");
         // 获取东八区的当前时间
         ZonedDateTime now = ZonedDateTime.now(TARGET_ZONE);
@@ -147,7 +148,7 @@
                                 String fxdj = "";
                                 String zrmj = "";
                                 String zrga = "";
-                                String jyff="";
+                                String jyff = "";
                                 String tcr = "";
                                 String tcqk = "";
                                 String tcjg = "";
@@ -155,101 +156,93 @@
                                 String certiNo = "";
                                 String plaintiffs = "";
                                 String phone = "";
-                                if ("07".equals(canalSecond)) {
-                                    if (StringUtils.isNotBlank(gridCaseInfoDTO.getLinkman())) {
-                                        uploadPolice = AesUtils.decrypt(gridCaseInfoDTO.getLinkman(), "W90akz7tA7tyMn5tNTynG69YM2E8jGfF");
-                                    }
-                                    if (StringUtils.isNotBlank(gridCaseInfoDTO.getContactTel())) {
-                                        uploadPolicePhone = AesUtils.decrypt(gridCaseInfoDTO.getContactTel(), "W90akz7tA7tyMn5tNTynG69YM2E8jGfF");
-                                    }
-                                } else if ("12".equals(canalSecond)) {
-                                    if (StringUtils.isNotBlank(gridCaseInfoDTO.getLinkman())) {
-                                        uploadPolice = AesUtils.decrypt(gridCaseInfoDTO.getLinkman(), "W90akz7tA7tyMn5tNTynG69YM2E8jGfF");
-                                    }
-                                    if (StringUtils.isNotBlank(gridCaseInfoDTO.getContactTel())) {
-                                        uploadPolicePhone = AesUtils.decrypt(gridCaseInfoDTO.getContactTel(), "W90akz7tA7tyMn5tNTynG69YM2E8jGfF");
-                                    }
-                                    try {
-                                        if (StringUtils.isNotBlank(gridCaseInfoDTO.getExtInfo())) {
-                                            JSONObject jsonObject = JSON.parseObject(gridCaseInfoDTO.getExtInfo());
-                                            zrga = jsonObject.get("tcdwMc").toString();
-                                            zrmj = jsonObject.get("zrmj").toString();
-                                            fxdj = jsonObject.get("fxdj").toString();
-                                            jfmc = jsonObject.get("jfmc").toString();
-                                            registerSaveDTO.setGridHandle(zrga + "--" + zrmj);
-                                        }
-                                    } catch (Exception e) {
-                                        log.error("解析extInfo失败,事件id:{" + gridCaseInfoDTO.getId() + "}; 解析内容:" + gridCaseInfoDTO.getExtInfo() + "失败原因:" + e.getMessage());
-                                    }
-                                    try {
-                                        if (StringUtils.isNotBlank(gridCaseInfoDTO.getExtInfoTcqk())) {
-                                            List<Map<String, Object>> expInfoTcqkMapList = JSON.parseObject(gridCaseInfoDTO.getExtInfoTcqk(),
-                                                    new TypeReference<List<Map<String, Object>>>() {
-                                                    });
-                                            for (Map expInfoMap : expInfoTcqkMapList) {
-                                                tcr = expInfoMap.get("tcr").toString();
-                                                tcqk = expInfoMap.get("tcqk").toString();
-                                                tcjg = expInfoMap.get("tcjgMc").toString();
-                                                tcfa = expInfoMap.get("tcfa").toString();
-                                            }
-                                        }
-                                    } catch (Exception e) {
-                                        log.error("解析extInfo失败,事件id:{" + gridCaseInfoDTO.getId() + "}; 解析内容:" + gridCaseInfoDTO.getExtInfo() + "失败原因:" + e.getMessage());
-                                    }
-                                    registerSaveDTO.setTcqk(uploadPolice+" -- "+uploadPolicePhone+" -- "+fxdj+" -- "+zrmj+" -- "+tcr+" -- "+tcfa+" -- "+tcqk);
-                                    try {
-                                        if (StringUtils.isNotBlank(gridCaseInfoDTO.getExtInfoRisk())) {
-                                            List<Map<String, Object>> expInfoMapList = JSON.parseObject(gridCaseInfoDTO.getExtInfoRisk(),
-                                                    new TypeReference<List<Map<String, Object>>>() {
-                                                    });
-                                            List<CasePersonDTO> casePersonDTOList = new ArrayList<>();
-                                            for (Map expInfoMap : expInfoMapList) {
-                                                CasePersonDTO casePersonDTO = new CasePersonDTO();
-                                                String name = "";
-                                                certiNo = "";
-                                                String mobile = "";
-                                                if (StringUtils.isNotBlank(expInfoMap.get("cardNumber").toString())) {
-                                                    certiNo = expInfoMap.get("cardNumber").toString();
-                                                }
-                                                if (StringUtils.isNotBlank(expInfoMap.get("name").toString())) {
-                                                    name = expInfoMap.get("name").toString();
-                                                }
-                                                if (StringUtils.isNotBlank(expInfoMap.get("contactPhone").toString())) {
-                                                    mobile = expInfoMap.get("contactPhone").toString();
-                                                }
-                                                casePersonDTO.setMobile(mobile);
-                                                casePersonDTO.setTrueName(name);
-                                                casePersonDTO.setCertiNo(certiNo);
-                                                casePersonDTOList.add(casePersonDTO);
-                                                gridEvent.setCertiNo(certiNo);
 
-                                                if (StringUtils.isNotBlank(plaintiffs)) {
-                                                    if (!plaintiffs.contains(name))
-                                                        plaintiffs = plaintiffs + "," + name;
-                                                } else {
-                                                    plaintiffs = name;
-                                                }
-                                                if (StringUtils.isNotBlank(phone)) {
-                                                    if (!phone.contains(mobile))
-                                                        phone = phone + "," + mobile;
-                                                } else {
-                                                    phone = mobile;
-                                                }
-                                                if (StringUtils.isNotBlank(gridEvent.getCertiNo())) {
-                                                    gridEvent.setCertiNo(gridEvent.getCertiNo() + "," + certiNo);
-                                                } else {
-                                                    gridEvent.setCertiNo(certiNo);
-                                                }
-                                            }
-                                            registerSaveDTO.setPersonList(casePersonDTOList);
-                                        }
-                                    } catch (Exception e) {
-                                        log.error("解析extInfo失败,事件id:{" + gridCaseInfoDTO.getId() + "}; 解析内容:" + gridCaseInfoDTO.getExtInfo() + "失败原因:" + e.getMessage());
+                                if (StringUtils.isNotBlank(gridCaseInfoDTO.getLinkman())) {
+                                    uploadPolice = AesUtils.decrypt(gridCaseInfoDTO.getLinkman(), "W90akz7tA7tyMn5tNTynG69YM2E8jGfF");
+                                }
+                                if (StringUtils.isNotBlank(gridCaseInfoDTO.getContactTel())) {
+                                    uploadPolicePhone = AesUtils.decrypt(gridCaseInfoDTO.getContactTel(), "W90akz7tA7tyMn5tNTynG69YM2E8jGfF");
+                                }
+                                try {
+                                    if (StringUtils.isNotBlank(gridCaseInfoDTO.getExtInfo())) {
+                                        JSONObject jsonObject = JSON.parseObject(gridCaseInfoDTO.getExtInfo());
+                                        zrga = jsonObject.get("tcdwMc").toString();
+                                        zrmj = jsonObject.get("zrmj").toString();
+                                        fxdj = jsonObject.get("fxdj").toString();
+                                        jfmc = jsonObject.get("jfmc").toString();
+                                        registerSaveDTO.setGridHandle(zrga + "--" + zrmj);
                                     }
+                                } catch (Exception e) {
+                                    log.error("解析extInfo失败,事件id:{" + gridCaseInfoDTO.getId() + "}; 解析内容:" + gridCaseInfoDTO.getExtInfo() + "失败原因:" + e.getMessage());
+                                }
+                                try {
+                                    if (StringUtils.isNotBlank(gridCaseInfoDTO.getExtInfoTcqk())) {
+                                        List<Map<String, Object>> expInfoTcqkMapList = JSON.parseObject(gridCaseInfoDTO.getExtInfoTcqk(),
+                                                new TypeReference<List<Map<String, Object>>>() {
+                                                });
+                                        for (Map expInfoMap : expInfoTcqkMapList) {
+                                            tcr = expInfoMap.get("tcr").toString();
+                                            tcqk = expInfoMap.get("tcqk").toString();
+                                            tcjg = expInfoMap.get("tcjgMc").toString();
+                                            tcfa = expInfoMap.get("tcfa").toString();
+                                        }
+                                    }
+                                } catch (Exception e) {
+                                    log.error("解析extInfo失败,事件id:{" + gridCaseInfoDTO.getId() + "}; 解析内容:" + gridCaseInfoDTO.getExtInfo() + "失败原因:" + e.getMessage());
+                                }
+                                registerSaveDTO.setTcqk(uploadPolice + " -- " + uploadPolicePhone + " -- " + fxdj + " -- " + zrmj + " -- " + tcr + " -- " + tcfa + " -- " + tcqk);
+                                try {
+                                    if (StringUtils.isNotBlank(gridCaseInfoDTO.getExtInfoRisk())) {
+                                        List<Map<String, Object>> expInfoMapList = JSON.parseObject(gridCaseInfoDTO.getExtInfoRisk(),
+                                                new TypeReference<List<Map<String, Object>>>() {
+                                                });
+                                        List<CasePersonDTO> casePersonDTOList = new ArrayList<>();
+                                        for (Map expInfoMap : expInfoMapList) {
+                                            CasePersonDTO casePersonDTO = new CasePersonDTO();
+                                            String name = "";
+                                            certiNo = "";
+                                            String mobile = "";
+                                            if (StringUtils.isNotBlank(expInfoMap.get("cardNumber").toString())) {
+                                                certiNo = expInfoMap.get("cardNumber").toString();
+                                            }
+                                            if (StringUtils.isNotBlank(expInfoMap.get("name").toString())) {
+                                                name = expInfoMap.get("name").toString();
+                                            }
+                                            if (StringUtils.isNotBlank(expInfoMap.get("contactPhone").toString())) {
+                                                mobile = expInfoMap.get("contactPhone").toString();
+                                            }
+                                            casePersonDTO.setMobile(mobile);
+                                            casePersonDTO.setTrueName(name);
+                                            casePersonDTO.setCertiNo(certiNo);
+                                            casePersonDTOList.add(casePersonDTO);
+                                            gridEvent.setCertiNo(certiNo);
+
+                                            if (StringUtils.isNotBlank(plaintiffs)) {
+                                                if (!plaintiffs.contains(name))
+                                                    plaintiffs = plaintiffs + "," + name;
+                                            } else {
+                                                plaintiffs = name;
+                                            }
+                                            if (StringUtils.isNotBlank(phone)) {
+                                                if (!phone.contains(mobile))
+                                                    phone = phone + "," + mobile;
+                                            } else {
+                                                phone = mobile;
+                                            }
+                                            if (StringUtils.isNotBlank(gridEvent.getCertiNo())) {
+                                                gridEvent.setCertiNo(gridEvent.getCertiNo() + "," + certiNo);
+                                            } else {
+                                                gridEvent.setCertiNo(certiNo);
+                                            }
+                                        }
+                                        registerSaveDTO.setPersonList(casePersonDTOList);
+                                    }
+                                } catch (Exception e) {
+                                    log.error("解析extInfo失败,事件id:{" + gridCaseInfoDTO.getId() + "}; 解析内容:" + gridCaseInfoDTO.getExtInfo() + "失败原因:" + e.getMessage());
                                 }
                                 registerSaveDTO.setId(IdUtils.getNewTimeId());
                                 BeanUtils.copyProperties(gridCaseInfoDTO, gridEvent);
-                                registerSaveDTO.setCreateTime(DateUtils.StringToDate(gridCaseInfoDTO.getCreateTime(),"yyyy-MM-dd HH:mm:ss"));
+                                registerSaveDTO.setCreateTime(DateUtils.StringToDate(gridCaseInfoDTO.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
                                 gridEvent.setLinkman(uploadPolice);
                                 gridEvent.setSystemId(gridCaseInfoDTO.getSystemId());
                                 gridEvent.setContactTel(uploadPolicePhone);
@@ -261,9 +254,18 @@
                                 log.info("xsd保存事件:{}" + gridEvent);
                                 //设置二级事件来源
                                 if (canalSecond.equals("12")) {
+                                    registerSaveDTO.setCanal(CaseBaseConstsEnum.CASE_CANAL_4.getIndex());
+                                    registerSaveDTO.setCanalName(CaseBaseConstsEnum.CASE_CANAL_4.getDes());
                                     registerSaveDTO.setCanalSecond(CaseBaseConstsEnum.CASE_CANAL_SECOND_1.getIndex());
                                     registerSaveDTO.setCanalSecondName(CaseBaseConstsEnum.CASE_CANAL_SECOND_1.getDes());
+                                } else if (canalSecond.equals("13")) {
+                                    registerSaveDTO.setCanal(CaseBaseConstsEnum.CASE_CANAL_3.getIndex());
+                                    registerSaveDTO.setCanalName(CaseBaseConstsEnum.CASE_CANAL_3.getDes());
+                                    registerSaveDTO.setCanalSecond(CaseBaseConstsEnum.CASE_CANAL_SECOND_7.getIndex());
+                                    registerSaveDTO.setCanalSecondName(CaseBaseConstsEnum.CASE_CANAL_SECOND_7.getDes());
                                 } else {
+                                    registerSaveDTO.setCanal(CaseBaseConstsEnum.CASE_CANAL_3.getIndex());
+                                    registerSaveDTO.setCanalName(CaseBaseConstsEnum.CASE_CANAL_3.getDes());
                                     registerSaveDTO.setCanalSecond(CaseBaseConstsEnum.CASE_CANAL_SECOND_2.getIndex());
                                     registerSaveDTO.setCanalSecondName(CaseBaseConstsEnum.CASE_CANAL_SECOND_2.getDes());
                                 }
@@ -320,7 +322,6 @@
                                 registerSaveDTO.setPhone(phone);
                                 String dyhUnitId = gridCaseTaskService.getGridUnitIdByUnitId(gridCode);
                                 if (StringUtils.isNotBlank(dyhUnitId)) {
-                                    registerSaveDTO.setWantUnitId(dyhUnitId);
                                 } else {
                                     log.info("网格组织查询不到对应组织:" + gridCode);
                                 }
@@ -352,7 +353,7 @@
         if (parts.length == 3) {
             return parts[0] + parts[1] + parts[2];
         } else if (parts.length >= 4) {
-            return parts[0] + parts[1] + parts[2]+"-"+parts[3];
+            return parts[0] + parts[1] + parts[2] + "-" + parts[3];
         } else {
             return input; // 或抛出异常
         }
@@ -368,6 +369,7 @@
         Date nowDate = DateUtils.getNowDate();
         List<String> canalSecondList = new ArrayList<>();
         canalSecondList.add("12");
+        canalSecondList.add("13");
         canalSecondList.add("07");
         log.info("startTime:" + startTime);
         log.info("endTime:" + endTime);
@@ -430,7 +432,7 @@
                                 String fxdj = "";
                                 String zrmj = "";
                                 String zrga = "";
-                                String jyff="";
+                                String jyff = "";
                                 String tcr = "";
                                 String tcqk = "";
                                 String tcjg = "";
@@ -438,100 +440,92 @@
                                 String certiNo = "";
                                 String plaintiffs = "";
                                 String phone = "";
-                                if ("07".equals(canalSecond)) {
-                                    if (StringUtils.isNotBlank(gridCaseInfoDTO.getLinkman())) {
-                                        uploadPolice = AesUtils.decrypt(gridCaseInfoDTO.getLinkman(), "W90akz7tA7tyMn5tNTynG69YM2E8jGfF");
-                                    }
-                                    if (StringUtils.isNotBlank(gridCaseInfoDTO.getContactTel())) {
-                                        uploadPolicePhone = AesUtils.decrypt(gridCaseInfoDTO.getContactTel(), "W90akz7tA7tyMn5tNTynG69YM2E8jGfF");
-                                    }
-                                } else if ("12".equals(canalSecond)) {
-                                    if (StringUtils.isNotBlank(gridCaseInfoDTO.getLinkman())) {
-                                        uploadPolice = AesUtils.decrypt(gridCaseInfoDTO.getLinkman(), "W90akz7tA7tyMn5tNTynG69YM2E8jGfF");
-                                    }
-                                    if (StringUtils.isNotBlank(gridCaseInfoDTO.getContactTel())) {
-                                        uploadPolicePhone = AesUtils.decrypt(gridCaseInfoDTO.getContactTel(), "W90akz7tA7tyMn5tNTynG69YM2E8jGfF");
-                                    }
-                                    try {
-                                        if (StringUtils.isNotBlank(gridCaseInfoDTO.getExtInfo())) {
-                                            JSONObject jsonObject = JSON.parseObject(gridCaseInfoDTO.getExtInfo());
-                                            zrga = jsonObject.get("tcdwMc").toString();
-                                            zrmj = jsonObject.get("zrmj").toString();
-                                            fxdj = jsonObject.get("fxdj").toString();
-                                            jfmc = jsonObject.get("jfmc").toString();
-                                            registerSaveDTO.setGridHandle(zrga + "--" + zrmj);
-                                        }
-                                    } catch (Exception e) {
-                                        log.error("解析extInfo失败,事件id:{" + gridCaseInfoDTO.getId() + "}; 解析内容:" + gridCaseInfoDTO.getExtInfo() + "失败原因:" + e.getMessage());
-                                    }
-                                    try {
-                                        if (StringUtils.isNotBlank(gridCaseInfoDTO.getExtInfoTcqk())) {
-                                            List<Map<String, Object>> expInfoTcqkMapList = JSON.parseObject(gridCaseInfoDTO.getExtInfoTcqk(),
-                                                    new TypeReference<List<Map<String, Object>>>() {
-                                                    });
-                                            for (Map expInfoMap : expInfoTcqkMapList) {
-                                                tcr = expInfoMap.get("tcr").toString();
-                                                tcqk = expInfoMap.get("tcqk").toString();
-                                                tcjg = expInfoMap.get("tcjgMc").toString();
-                                                tcfa = expInfoMap.get("tcfa").toString();
-                                            }
-                                        }
-                                    } catch (Exception e) {
-                                        log.error("解析extInfo失败,事件id:{" + gridCaseInfoDTO.getId() + "}; 解析内容:" + gridCaseInfoDTO.getExtInfo() + "失败原因:" + e.getMessage());
-                                    }
-                                    registerSaveDTO.setTcqk(uploadPolice+" -- "+uploadPolicePhone+" -- "+fxdj+" -- "+zrmj+" -- "+tcr+" -- "+tcfa+" -- "+tcqk);
-                                    try {
-                                        if (StringUtils.isNotBlank(gridCaseInfoDTO.getExtInfoRisk())) {
-                                            List<Map<String, Object>> expInfoMapList = JSON.parseObject(gridCaseInfoDTO.getExtInfoRisk(),
-                                                    new TypeReference<List<Map<String, Object>>>() {
-                                                    });
-                                            List<CasePersonDTO> casePersonDTOList = new ArrayList<>();
-                                            for (Map expInfoMap : expInfoMapList) {
-                                                CasePersonDTO casePersonDTO = new CasePersonDTO();
-                                                String name = "";
-                                                certiNo = "";
-                                                String mobile = "";
-                                                if (StringUtils.isNotBlank(expInfoMap.get("cardNumber").toString())) {
-                                                    certiNo = expInfoMap.get("cardNumber").toString();
-                                                }
-                                                if (StringUtils.isNotBlank(expInfoMap.get("name").toString())) {
-                                                    name = expInfoMap.get("name").toString();
-                                                }
-                                                if (StringUtils.isNotBlank(expInfoMap.get("contactPhone").toString())) {
-                                                    mobile = expInfoMap.get("contactPhone").toString();
-                                                }
-                                                casePersonDTO.setMobile(mobile);
-                                                casePersonDTO.setTrueName(name);
-                                                casePersonDTO.setCertiNo(certiNo);
-                                                casePersonDTOList.add(casePersonDTO);
-                                                gridEvent.setCertiNo(certiNo);
 
-                                                if (StringUtils.isNotBlank(plaintiffs)) {
-                                                    if (!plaintiffs.contains(name))
-                                                        plaintiffs = plaintiffs + "," + name;
-                                                } else {
-                                                    plaintiffs = name;
-                                                }
-                                                if (StringUtils.isNotBlank(phone)) {
-                                                    if (!phone.contains(mobile))
-                                                        phone = phone + "," + mobile;
-                                                } else {
-                                                    phone = mobile;
-                                                }
-                                                if (StringUtils.isNotBlank(gridEvent.getCertiNo())) {
-                                                    gridEvent.setCertiNo(gridEvent.getCertiNo() + "," + certiNo);
-                                                } else {
-                                                    gridEvent.setCertiNo(certiNo);
-                                                }
-                                            }
-                                            registerSaveDTO.setPersonList(casePersonDTOList);
-                                        }
-                                    } catch (Exception e) {
-                                        log.error("解析extInfo失败,事件id:{" + gridCaseInfoDTO.getId() + "}; 解析内容:" + gridCaseInfoDTO.getExtInfo() + "失败原因:" + e.getMessage());
+                                if (StringUtils.isNotBlank(gridCaseInfoDTO.getLinkman())) {
+                                    uploadPolice = AesUtils.decrypt(gridCaseInfoDTO.getLinkman(), "W90akz7tA7tyMn5tNTynG69YM2E8jGfF");
+                                }
+                                if (StringUtils.isNotBlank(gridCaseInfoDTO.getContactTel())) {
+                                    uploadPolicePhone = AesUtils.decrypt(gridCaseInfoDTO.getContactTel(), "W90akz7tA7tyMn5tNTynG69YM2E8jGfF");
+                                }
+                                try {
+                                    if (StringUtils.isNotBlank(gridCaseInfoDTO.getExtInfo())) {
+                                        JSONObject jsonObject = JSON.parseObject(gridCaseInfoDTO.getExtInfo());
+                                        zrga = jsonObject.get("tcdwMc").toString();
+                                        zrmj = jsonObject.get("zrmj").toString();
+                                        fxdj = jsonObject.get("fxdj").toString();
+                                        jfmc = jsonObject.get("jfmc").toString();
+                                        registerSaveDTO.setGridHandle(zrga + "--" + zrmj);
                                     }
+                                } catch (Exception e) {
+                                    log.error("解析extInfo失败,事件id:{" + gridCaseInfoDTO.getId() + "}; 解析内容:" + gridCaseInfoDTO.getExtInfo() + "失败原因:" + e.getMessage());
+                                }
+                                try {
+                                    if (StringUtils.isNotBlank(gridCaseInfoDTO.getExtInfoTcqk())) {
+                                        List<Map<String, Object>> expInfoTcqkMapList = JSON.parseObject(gridCaseInfoDTO.getExtInfoTcqk(),
+                                                new TypeReference<List<Map<String, Object>>>() {
+                                                });
+                                        for (Map expInfoMap : expInfoTcqkMapList) {
+                                            tcr = expInfoMap.get("tcr").toString();
+                                            tcqk = expInfoMap.get("tcqk").toString();
+                                            tcjg = expInfoMap.get("tcjgMc").toString();
+                                            tcfa = expInfoMap.get("tcfa").toString();
+                                        }
+                                    }
+                                } catch (Exception e) {
+                                    log.error("解析extInfo失败,事件id:{" + gridCaseInfoDTO.getId() + "}; 解析内容:" + gridCaseInfoDTO.getExtInfo() + "失败原因:" + e.getMessage());
+                                }
+                                registerSaveDTO.setTcqk(uploadPolice + " -- " + uploadPolicePhone + " -- " + fxdj + " -- " + zrmj + " -- " + tcr + " -- " + tcfa + " -- " + tcqk);
+                                try {
+                                    if (StringUtils.isNotBlank(gridCaseInfoDTO.getExtInfoRisk())) {
+                                        List<Map<String, Object>> expInfoMapList = JSON.parseObject(gridCaseInfoDTO.getExtInfoRisk(),
+                                                new TypeReference<List<Map<String, Object>>>() {
+                                                });
+                                        List<CasePersonDTO> casePersonDTOList = new ArrayList<>();
+                                        for (Map expInfoMap : expInfoMapList) {
+                                            CasePersonDTO casePersonDTO = new CasePersonDTO();
+                                            String name = "";
+                                            certiNo = "";
+                                            String mobile = "";
+                                            if (StringUtils.isNotBlank(expInfoMap.get("cardNumber").toString())) {
+                                                certiNo = expInfoMap.get("cardNumber").toString();
+                                            }
+                                            if (StringUtils.isNotBlank(expInfoMap.get("name").toString())) {
+                                                name = expInfoMap.get("name").toString();
+                                            }
+                                            if (StringUtils.isNotBlank(expInfoMap.get("contactPhone").toString())) {
+                                                mobile = expInfoMap.get("contactPhone").toString();
+                                            }
+                                            casePersonDTO.setMobile(mobile);
+                                            casePersonDTO.setTrueName(name);
+                                            casePersonDTO.setCertiNo(certiNo);
+                                            casePersonDTOList.add(casePersonDTO);
+                                            gridEvent.setCertiNo(certiNo);
+
+                                            if (StringUtils.isNotBlank(plaintiffs)) {
+                                                if (!plaintiffs.contains(name))
+                                                    plaintiffs = plaintiffs + "," + name;
+                                            } else {
+                                                plaintiffs = name;
+                                            }
+                                            if (StringUtils.isNotBlank(phone)) {
+                                                if (!phone.contains(mobile))
+                                                    phone = phone + "," + mobile;
+                                            } else {
+                                                phone = mobile;
+                                            }
+                                            if (StringUtils.isNotBlank(gridEvent.getCertiNo())) {
+                                                gridEvent.setCertiNo(gridEvent.getCertiNo() + "," + certiNo);
+                                            } else {
+                                                gridEvent.setCertiNo(certiNo);
+                                            }
+                                        }
+                                        registerSaveDTO.setPersonList(casePersonDTOList);
+                                    }
+                                } catch (Exception e) {
+                                    log.error("解析extInfo失败,事件id:{" + gridCaseInfoDTO.getId() + "}; 解析内容:" + gridCaseInfoDTO.getExtInfo() + "失败原因:" + e.getMessage());
                                 }
                                 registerSaveDTO.setId(IdUtils.getNewTimeId());
-                                registerSaveDTO.setCreateTime(DateUtils.StringToDate(gridCaseInfoDTO.getCreateTime(),"yyyy-MM-dd HH:mm:ss"));
+                                registerSaveDTO.setCreateTime(DateUtils.StringToDate(gridCaseInfoDTO.getCreateTime(), "yyyy-MM-dd HH:mm:ss"));
                                 BeanUtils.copyProperties(gridCaseInfoDTO, gridEvent);
                                 gridEvent.setSystemId(gridCaseInfoDTO.getSystemId());
                                 gridEvent.setLinkman(uploadPolice);
@@ -544,9 +538,18 @@
                                 log.info("xsd保存事件:{}" + gridEvent);
                                 //设置二级事件来源
                                 if (canalSecond.equals("12")) {
+                                    registerSaveDTO.setCanal(CaseBaseConstsEnum.CASE_CANAL_4.getIndex());
+                                    registerSaveDTO.setCanalName(CaseBaseConstsEnum.CASE_CANAL_4.getDes());
                                     registerSaveDTO.setCanalSecond(CaseBaseConstsEnum.CASE_CANAL_SECOND_1.getIndex());
                                     registerSaveDTO.setCanalSecondName(CaseBaseConstsEnum.CASE_CANAL_SECOND_1.getDes());
+                                } else if (canalSecond.equals("13")) {
+                                    registerSaveDTO.setCanal(CaseBaseConstsEnum.CASE_CANAL_3.getIndex());
+                                    registerSaveDTO.setCanalName(CaseBaseConstsEnum.CASE_CANAL_3.getDes());
+                                    registerSaveDTO.setCanalSecond(CaseBaseConstsEnum.CASE_CANAL_SECOND_7.getIndex());
+                                    registerSaveDTO.setCanalSecondName(CaseBaseConstsEnum.CASE_CANAL_SECOND_7.getDes());
                                 } else {
+                                    registerSaveDTO.setCanal(CaseBaseConstsEnum.CASE_CANAL_3.getIndex());
+                                    registerSaveDTO.setCanalName(CaseBaseConstsEnum.CASE_CANAL_3.getDes());
                                     registerSaveDTO.setCanalSecond(CaseBaseConstsEnum.CASE_CANAL_SECOND_2.getIndex());
                                     registerSaveDTO.setCanalSecondName(CaseBaseConstsEnum.CASE_CANAL_SECOND_2.getDes());
                                 }
diff --git a/dyh-service/dyh-sys/src/main/resources/config/application.yml b/dyh-service/dyh-sys/src/main/resources/config/application.yml
index 1966af6..f1b17fc 100644
--- a/dyh-service/dyh-sys/src/main/resources/config/application.yml
+++ b/dyh-service/dyh-sys/src/main/resources/config/application.yml
@@ -3,8 +3,8 @@
   profiles:
     active:
 #      - dev
-#        - test
-        - prod
+        - test
+#        - prod
 
   devtools:
     restart:
diff --git a/dyh-service/dyh-utils/src/main/java/cn/huge/module/mediate/utils/CaseNoUtils.java b/dyh-service/dyh-utils/src/main/java/cn/huge/module/mediate/utils/CaseNoUtils.java
index 7fdb613..f8c8433 100644
--- a/dyh-service/dyh-utils/src/main/java/cn/huge/module/mediate/utils/CaseNoUtils.java
+++ b/dyh-service/dyh-utils/src/main/java/cn/huge/module/mediate/utils/CaseNoUtils.java
@@ -19,17 +19,17 @@
     /**
      * 常量前缀
      */
-    public static String CASE_NO_SIGN_TH = "天河调";
-    public static String CASE_NO_SIGN_HZ = "海珠调";
-    public static String CASE_NO_SIGN_LW = "荔湾调";
-    public static String CASE_NO_SIGN_YX = "越秀调";
-    public static String CASE_NO_SIGN_PY = "番禺调";
-    public static String CASE_NO_SIGN_HD = "花都调";
-    public static String CASE_NO_SIGN_BY = "粤云调";
-    public static String CASE_NO_SIGN_NS = "南沙调";
-    public static String CASE_NO_SIGN_HP = "黄埔调";
-    public static String CASE_NO_SIGN_ZC = "增城调";
-    public static String CASE_NO_SIGN_CH = "从化调";
+    public static String CASE_NO_SIGN_TH = "穗天综调";
+    public static String CASE_NO_SIGN_HZ = "穗海综调";
+    public static String CASE_NO_SIGN_LW = "穗荔综调";
+    public static String CASE_NO_SIGN_YX = "穗越综调";
+    public static String CASE_NO_SIGN_PY = "穗番综调";
+    public static String CASE_NO_SIGN_HD = "穗花综调";
+    public static String CASE_NO_SIGN_BY = "穗云综调";
+    public static String CASE_NO_SIGN_NS = "穗南综调";
+    public static String CASE_NO_SIGN_HP = "穗埔综调";
+    public static String CASE_NO_SIGN_ZC = "穗增综调";
+    public static String CASE_NO_SIGN_CH = "穗从综调";
     public static String CASE_NO_SIGN_GZ = "粤调";
 
     /**
@@ -136,7 +136,7 @@
         StringBuffer caseNoSign = new StringBuffer();
         // 设置年号
         int year = DateUtils.getYear(DateUtils.getNowDate());
-        caseNoSign.append("(").append(year).append(")");
+        caseNoSign.append(year);
         if (GzRegionBaseEnum.AREA_1.getIndex().equals(area)){
             caseNoSign.append(CASE_NO_SIGN_TH);
         }else if (GzRegionBaseEnum.AREA_2.getIndex().equals(area)){
diff --git a/sql/20250620.sql b/sql/20250620.sql
new file mode 100644
index 0000000..9a90e48
--- /dev/null
+++ b/sql/20250620.sql
@@ -0,0 +1,17 @@
+#添加索引
+CREATE INDEX idx_canal ON "HUGETEST".dyh_case_info(canal);
+CREATE INDEX idx_case_ref ON "HUGETEST".dyh_case_info(case_ref);
+CREATE INDEX idx_case_type ON "HUGETEST".dyh_case_info(case_type);
+CREATE INDEX idx_area_road_village ON "HUGETEST".dyh_case_info(que_area, que_road, que_village);
+CREATE INDEX idx_source ON "HUGETEST".dyh_case_info(source);
+CREATE INDEX idx_input_unit_id ON "HUGETEST".dyh_case_info(input_unit_id);
+CREATE INDEX idx_status ON "HUGETEST".dyh_case_info(status);
+CREATE INDEX idx_process ON "HUGETEST".dyh_case_info(process);
+
+CREATE INDEX idx_belong_unit_id ON "HUGETEST".dyh_case_info_unfold(belong_unit_id);
+CREATE INDEX idx_mediate_unit_id ON "HUGETEST".dyh_case_info_unfold(mediate_unit_id);
+CREATE INDEX idx_medi_result ON "HUGETEST".dyh_case_info_unfold(medi_result);
+
+CREATE INDEX idx_unit_grade ON "HUGETEST".dyh_ct_unit(unit_grade);
+CREATE INDEX idx_unit_type ON "HUGETEST".dyh_ct_unit(unit_type);
+CREATE INDEX idx_area_road_village ON "HUGETEST".dyh_ct_unit(area, road, village);

--
Gitblit v1.8.0