广州市综治平台后端
zhouxiantao
9 days ago 93430938a25ab3d4e218a2198ae1b24a516f6382
freat:粤政易相关代码
5 files added
16 files modified
1932 ■■■■■ changed files
dyh-service/dyh-base/src/main/java/cn/huge/base/common/utils/DateUtils.java 14 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/controller/web/CaseInfoWebController.java 23 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/controller/web/CaseTaskWebController.java 107 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/CaseInfoMapper.java 8 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/CaseTaskMapper.java 48 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseAssistApplyMapper.xml 54 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseDismissMapper.xml 25 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseInfoMapper.xml 41 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseReturnMapper.xml 54 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseSuperviseMapper.xml 58 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseTaskMapper.xml 741 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseWindupApplyMapper.xml 54 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/domain/dto/CaseRegisterDTO.java 4 ●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/domain/dto/CaseStatisticsBaseDTO.java 27 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/domain/dto/CaseWorkStatisticsBaseDTO.java 43 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/domain/dto/CaseWorkStatisticsTimeDTO.java 28 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/domain/dto/CaseYbCountDTO.java 40 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/domain/dto/FrontPageListAllDTO.java 78 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseInfoService.java 172 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseTaskService.java 39 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/utils/StatisticsTimeUtils.java 274 ●●●●● patch | view | raw | blame | history
dyh-service/dyh-base/src/main/java/cn/huge/base/common/utils/DateUtils.java
@@ -988,6 +988,20 @@
        }
        return 0;
    }
    /**
     * 获取两个时间的天数差
     * */
    public static Integer getDifferDay(Date time1,Date time2){
        if(ObjectUtils.isNotEmpty(time1) && ObjectUtils.isNotEmpty(time2)){
            long day = 1000 * 60 * 60 * 24;
            long differ = time1.getTime() - time2.getTime();
            long housr = differ / day;
            Integer diffDay = Integer.valueOf(String.valueOf(housr));
            return Math.abs(diffDay);
        }
        return 0;
    }
}
/**
 * -------------------_ooOoo_-------------------
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/controller/web/CaseInfoWebController.java
@@ -1091,6 +1091,29 @@
    }
    /**
     * 工作统计
     *
     * @return Object
     * @url {ctx}/api/web/caseInfo/workStatistics
     * @CurrentUser String userId
     */
    @GetMapping("/workStatistics")
    public Object workStatistics(@CurrentUser String userId) {
        try {
            Map<String, Object> terms = getParameterAll();
            //统计类型 1-个人,2-单位
            String workType = request.getParameter("workType");
            if (ObjectUtils.isNotEmpty(workType)) {
                terms.put("workType", workType);
            }
            return ReturnSucUtils.getRepInfo("处理成功", service.workStatistics(terms, userId));
        } catch (Exception e) {
            log.error("Controller接口[CaseInfoWebController.workStatistics]请求异常:" + e, e);
            return ReturnFailUtils.getRepInfo();
        }
    }
    /**
     * 解纷态势
     *
     * @return Object
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/controller/web/CaseTaskWebController.java
@@ -387,6 +387,107 @@
    }
    /**
     * 设置请求参数
     * */
    private void setRequestParam(Map<String, Object> terms) {
        String caseType = request.getParameter("caseType");
        if (StringUtils.isNotBlank(caseType)){
            terms.put("caseType", caseType);
        }
        String plaintiffs = request.getParameter("plaintiffs");
        if (StringUtils.isNotBlank(plaintiffs)){
            terms.put("plaintiffs", plaintiffs);
        }
        String defendants = request.getParameter("defendants");
        if (StringUtils.isNotBlank(defendants)){
            terms.put("defendants", defendants);
        }
        String canal = request.getParameter("canal");
        if (StringUtils.isNotBlank(canal)){
            terms.put("canal", canal);
        }
        String caseStatus = request.getParameter("caseStatus");
        if (StringUtils.isNotBlank(caseStatus)){
            terms.put("caseStatus", caseStatus);
        }
        String caseLevel = request.getParameter("caseLevel");
        if (StringUtils.isNotBlank(caseLevel)){
            terms.put("caseLevel", caseLevel);
        }
        String mediResult = request.getParameter("mediResult");
        if (StringUtils.isNotBlank(mediResult)){
            terms.put("mediResult", mediResult);
        }
        String handleTimeStart = request.getParameter("handleTimeStart");
        String handleTimeEnd = request.getParameter("handleTimeEnd");
        if (StringUtils.isNotBlank(handleTimeStart) && StringUtils.isNotBlank(handleTimeEnd)){
            terms.put("handleTimeStart", handleTimeStart);
            terms.put("handleTimeEnd", handleTimeEnd);
        }
    }
    /**
     * web端-工作台-查询全部待办任务
     *
     * @param page      页码
     * @param size      每页数量
     * @param status    状态,1:待分派,2:已分派
     * @param sortType  排序方式(1:正序;2:倒序)
     * @param sortColmn 排序字段(1:流转时间;2:分派时限/分派时间;3:事项等级;4:督办次数)
     * @return
     * @url {ctx}/api/web/caseTask/pageMyTaskAll
     */
    @GetMapping("/pageMyTaskAll")
    public Object pageMyTaskAll(@RequestParam(value = "page") int page, @RequestParam(value = "size") int size,
                                @RequestParam(value = "status") int status, @CurrentUser String userId,
                                @RequestParam(value = "sortType") int sortType, @RequestParam(value = "sortColmn") int sortColmn) {
        try {
            // 条件
            Map<String, Object> terms = Maps.newHashMap();
            CtUserDTO loginUser = custClient.clientGetUserAll(userId);
            terms.put("candeUnitId", loginUser.getUnitId());
            terms.put("status", status);
            String partyName = request.getParameter("partyName");
            if (StringUtils.isNotBlank(partyName)){
                terms.put("partyName", partyName);
            }
            setRequestParam(terms);
            // 排序
            Sort sort = Sort.by(Sort.Direction.DESC, "t1.create_time");;
            PageRequest pageRequest = PageRequest.of(page - 1, size, sort);
            return ReturnSucUtils.getRepInfo(service.pageMyTaskAll(pageRequest, terms));
        } catch (Exception e) {
            log.error("Controller接口[CaseTaskWebController.pageMyTaskAll]请求异常:"+e, e);
            return ReturnFailUtils.getRepInfo();
        }
    }
    /**
     * web端-工作台-已办数量统计
     * @url {ctx}/api/web/caseTask/countYbTaskAll
     */
    @GetMapping("/countYbTaskAll")
    public Object countYbTaskAll(@RequestParam(value = "status") int status,@CurrentUser String userId) {
        try {
            // 条件
            Map<String, Object> terms = Maps.newHashMap();
            String partyName = request.getParameter("partyName");
            if (StringUtils.isNotBlank(partyName)){
                terms.put("partyName", partyName);
            }
            setRequestParam(terms);
            CtUserDTO loginUser = custClient.clientGetUserAll(userId);
            terms.put("candeUnitId", loginUser.getUnitId());
            terms.put("status", status);
            return ReturnSucUtils.getRepInfo(service.countYbTaskAll(terms));
        } catch (Exception e) {
            log.error("Controller接口[CaseTaskWebController.countYbTaskAll]请求异常:"+e, e);
            return ReturnFailUtils.getRepInfo();
        }
    }
    /**
     * web端-工作台-查询待办任务-分派任务
     *
     * @param page      页码
@@ -430,6 +531,7 @@
                terms.put("handleUnitId", loginUser.getUnitId());
            }
            terms.put("status", status);
            setRequestParam(terms);
            // 排序
            Sort sort = null;
            String sortName = null;
@@ -659,6 +761,7 @@
            if (StringUtils.isNotBlank(partyName)) {
                terms.put("partyName", partyName);
            }
            setRequestParam(terms);
            CtUserDTO loginUser = custClient.clientGetUserAll(userId);
            // 不予受理,查询case_dismiss表
            if (status == 3) {
@@ -717,7 +820,7 @@
                terms.put("mediatorType", mediatorType);
                terms.put("mediatorId", loginUser.getId());
            }
            setRequestParam(terms);
            // 排序
            Sort sort = null;
            String sortName = null;
@@ -880,6 +983,7 @@
            if (StringUtils.isNotBlank(partyName)) {
                terms.put("partyName", partyName);
            }
            setRequestParam(terms);
            Sort sort = null;
            String sortName = null;
            switch (type) {
@@ -1055,6 +1159,7 @@
            }
            Sort sort = null;
            String sortName = null;
            setRequestParam(terms);
            switch (sortColmn) {
                case 1:
                    sortName = "t1.sup_time";
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/CaseInfoMapper.java
@@ -235,4 +235,12 @@
     */
    List<CaseStatisticsTypeDTO> countByCanalSecond(@Param("terms") Map<String, Object> terms);
    /**
     * 工作统计按时间分组
     *
     * @param terms 包含统计条件的键值对,如时间范围
     * @return 返回一个对象,包含基础的案例统计数据
     */
    List<CaseWorkStatisticsTimeDTO> workStatisticsTime(@Param("terms") Map<String, Object> terms);
}
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/CaseTaskMapper.java
@@ -79,6 +79,18 @@
    FrontPageCountDTO countTaskList(@Param("terms") Map<String, Object> terms);
    /**
     * 全部查询
     * */
    List<FrontPageListAllDTO> pageMyTaskAll(@Param("page") PageRequest page, @Param("terms") Map<String, Object> terms);
    /**
     * 全部查询统计
     * @param terms 条件
     * @return long
     */
    long countMyTaskAll(@Param("terms") Map<String, Object> terms);
    /**
     * 首页-待/已分派条件统计
     * @param terms 条件
     * @return long
@@ -191,4 +203,40 @@
    int deleteCaseTaskByCaseId(@Param("caseId") String caseId,@Param("updateTime") Date updateTime);
    /**
     * 已办事项-已分派
     * @param terms 条件
     * @return long
     */
    long countYbDispatch(@Param("terms") Map<String, Object> terms);
    /**
     * 已办事项-已分派
     * @param terms 条件
     * @return long
     */
    long countYbAccept(@Param("terms") Map<String, Object> terms);
    /**
     * 已办事项-已分派
     * @param terms 条件
     * @return long
     */
    long countYbClosed(@Param("terms") Map<String, Object> terms);
    /**
     * 已办事项-已审核数量
     * @param terms 条件
     * @return long
     */
    long countYbAudit(@Param("terms") Map<String, Object> terms);
    /**
     * 已办事项-督办数量
     * @param terms 条件
     * @return long
     */
    long countYbSupervise(@Param("terms") Map<String, Object> terms);
}
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseAssistApplyMapper.xml
@@ -304,8 +304,33 @@
            and (DATE_FORMAT(t1.apply_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.timeStart}
            and DATE_FORMAT(t1.apply_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.timeEnd})
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <if test="terms.partyName != null and terms.partyName !=''">
            and concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%')
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.caseType != null and terms.caseType !=''">
            and t2.case_type = #{terms.caseType}
        </if>
        <if test="terms.plaintiffs != null and terms.plaintiffs !=''">
            and t2.plaintiffs like concat('%', #{terms.plaintiffs}, '%')
        </if>
        <if test="terms.defendants != null and terms.defendants !=''">
            and t2.defendants like concat('%', #{terms.defendants}, '%')
        </if>
        <if test="terms.canal != null and terms.canal !=''">
            and t2.canal = #{terms.canal}
        </if>
        <if test="terms.caseStatus != null and terms.caseStatus !=''">
            and t2.status = #{terms.caseStatus}
        </if>
        <if test="terms.caseLevel != null and terms.caseLevel !=''">
            and t2.case_level = #{terms.caseLevel}
        </if>
        <if test="terms.mediResult != null and terms.mediResult !=''">
            and t3.medi_result = #{terms.mediResult}
        </if>
    </select>
    <!--  首页-待审核分页查询  -->
@@ -324,8 +349,33 @@
            and (DATE_FORMAT(t1.apply_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.timeStart}
            and DATE_FORMAT(t1.apply_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.timeEnd})
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <if test="terms.partyName != null and terms.partyName !=''">
            and concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%')
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.caseType != null and terms.caseType !=''">
            and t2.case_type = #{terms.caseType}
        </if>
        <if test="terms.plaintiffs != null and terms.plaintiffs !=''">
            and t2.plaintiffs like concat('%', #{terms.plaintiffs}, '%')
        </if>
        <if test="terms.defendants != null and terms.defendants !=''">
            and t2.defendants like concat('%', #{terms.defendants}, '%')
        </if>
        <if test="terms.canal != null and terms.canal !=''">
            and t2.canal = #{terms.canal}
        </if>
        <if test="terms.caseStatus != null and terms.caseStatus !=''">
            and t2.status = #{terms.caseStatus}
        </if>
        <if test="terms.caseLevel != null and terms.caseLevel !=''">
            and t2.case_level = #{terms.caseLevel}
        </if>
        <if test="terms.mediResult != null and terms.mediResult !=''">
            and t3.medi_result = #{terms.mediResult}
        </if>
        <if test="page.sort != null">
            <foreach collection="page.sort" item="s" index="index" separator="," open="order by ">
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseDismissMapper.xml
@@ -192,9 +192,34 @@
                and (DATE_FORMAT(t1.dis_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.disTimeStart}
                and DATE_FORMAT(t1.dis_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.disTimeEnd})
            </if>
            <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
                and (DATE_FORMAT(t1.dis_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
                and DATE_FORMAT(t1.dis_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
            </if>
            <if test="terms.partyName != null and terms.partyName !=''">
                and concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%')
            </if>
            <if test="terms.caseType != null and terms.caseType !=''">
                and t2.case_type = #{terms.caseType}
            </if>
            <if test="terms.plaintiffs != null and terms.plaintiffs !=''">
                and t2.plaintiffs like concat('%', #{terms.plaintiffs}, '%')
            </if>
            <if test="terms.defendants != null and terms.defendants !=''">
                and t2.defendants like concat('%', #{terms.defendants}, '%')
            </if>
            <if test="terms.canal != null and terms.canal !=''">
                and t2.canal = #{terms.canal}
            </if>
            <if test="terms.caseStatus != null and terms.caseStatus !=''">
                and t2.status = #{terms.caseStatus}
            </if>
            <if test="terms.caseLevel != null and terms.caseLevel !=''">
                and t2.case_level = #{terms.caseLevel}
            </if>
            <if test="terms.mediResult != null and terms.mediResult !=''">
                and t3.medi_result = #{terms.mediResult}
            </if>
        </if>
    </sql>
    <!--  首页-不予受理条件统计  -->
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseInfoMapper.xml
@@ -1463,4 +1463,45 @@
            a.canal_second
    </select>
    <!--  统计分析(基础)  -->
    <select id="workStatisticsTime" resultType="cn.huge.module.cases.domain.dto.CaseWorkStatisticsTimeDTO">
        SELECT
        count(1) as totalNum,
        sum(case when b.medi_result = '22_00025-1' and a.info_process = 3 then 1 else 0 end) as resolveNum,
        sum(case when a.info_process <![CDATA[ < ]]> 3 then 1 else 0 end) as resolveingNum,
        sum(case when b.medi_result = '22_00025-2' and a.info_process = 3 then 1 else 0 end) as unResolveNum,
        sum(case when a.case_level = 1 then 1 else 0 end) as oneLevelNum,
        sum(case when a.case_level = 2 then 1 else 0 end) as twoLevelNum,
        sum(case when a.case_level = 3 then 1 else 0 end) as threeLevelNum,
        sum(case when a.info_process <![CDATA[ < ]]> 3 then 1 else 0 end) as processNum,
        sum(case when a.info_process = 3 then 1 else 0 end) as finishNum,
        <if test='terms.selectTimeType != null and terms.selectTimeType =="1"'>
            DATE_FORMAT(a.create_time, '%Y-%m-%d') AS dayStr,
            DATE_FORMAT(a.create_time, '%Y-%m') AS monthStr,
            DATE_FORMAT(a.create_time, '%Y') AS year_str,
        </if>
        <if test='terms.selectTimeType != null and terms.selectTimeType =="2"'>
            DATE_FORMAT(b.close_time, '%Y-%m-%d') AS dayStr,
            DATE_FORMAT(b.close_time, '%Y-%m') AS monthStr,
            DATE_FORMAT(b.close_time, '%Y') AS year_str,
        </if>
        sum(case when a.info_process = 4 then 1 else 0 end) as rejectNum
        FROM
        dyh_case_info a
        inner JOIN dyh_case_info_unfold b on a.id = b.id
        LEFT JOIN dyh_ct_unit c ON b.belong_unit_id = c.id
        <include refid="where-part-all"/>
        <if test='terms.timeType != null and terms.timeType =="3"'>
            GROUP BY year_str
        </if>
        <if test='terms.timeType != null and terms.timeType =="2"'>
            GROUP BY monthStr
        </if>
        <if test='terms.timeType != null and terms.timeType =="1"'>
            GROUP BY dayStr
        </if>
    </select>
</mapper>
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseReturnMapper.xml
@@ -304,8 +304,33 @@
            and (DATE_FORMAT(t1.return_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.timeStart}
            and DATE_FORMAT(t1.return_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.timeEnd})
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <if test="terms.partyName != null and terms.partyName !=''">
            and concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%')
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.caseType != null and terms.caseType !=''">
            and t2.case_type = #{terms.caseType}
        </if>
        <if test="terms.plaintiffs != null and terms.plaintiffs !=''">
            and t2.plaintiffs like concat('%', #{terms.plaintiffs}, '%')
        </if>
        <if test="terms.defendants != null and terms.defendants !=''">
            and t2.defendants like concat('%', #{terms.defendants}, '%')
        </if>
        <if test="terms.canal != null and terms.canal !=''">
            and t2.canal = #{terms.canal}
        </if>
        <if test="terms.caseStatus != null and terms.caseStatus !=''">
            and t2.status = #{terms.caseStatus}
        </if>
        <if test="terms.caseLevel != null and terms.caseLevel !=''">
            and t2.case_level = #{terms.caseLevel}
        </if>
        <if test="terms.mediResult != null and terms.mediResult !=''">
            and t3.medi_result = #{terms.mediResult}
        </if>
    </select>
@@ -325,8 +350,33 @@
            and (DATE_FORMAT(t1.return_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.timeStart}
            and DATE_FORMAT(t1.return_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.timeEnd})
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <if test="terms.partyName != null and terms.partyName !=''">
            and concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%')
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.caseType != null and terms.caseType !=''">
            and t2.case_type = #{terms.caseType}
        </if>
        <if test="terms.plaintiffs != null and terms.plaintiffs !=''">
            and t2.plaintiffs like concat('%', #{terms.plaintiffs}, '%')
        </if>
        <if test="terms.defendants != null and terms.defendants !=''">
            and t2.defendants like concat('%', #{terms.defendants}, '%')
        </if>
        <if test="terms.canal != null and terms.canal !=''">
            and t2.canal = #{terms.canal}
        </if>
        <if test="terms.caseStatus != null and terms.caseStatus !=''">
            and t2.status = #{terms.caseStatus}
        </if>
        <if test="terms.caseLevel != null and terms.caseLevel !=''">
            and t2.case_level = #{terms.caseLevel}
        </if>
        <if test="terms.mediResult != null and terms.mediResult !=''">
            and t3.medi_result = #{terms.mediResult}
        </if>
        <if test="page.sort != null">
            <foreach collection="page.sort" item="s" index="index" separator="," open="order by ">
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseSuperviseMapper.xml
@@ -318,9 +318,17 @@
        <if test="terms.type != 3">
            and t1.quilt_unit_id = #{terms.quiltUnitId}
            and t1.sup_status = #{terms.supStatus}
            <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
                and (DATE_FORMAT(t1.reply_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
                and DATE_FORMAT(t1.reply_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
            </if>
        </if>
        <if test="terms.type == 3">
            and t1.sup_unit_id = #{terms.supUnitId}
            <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
                and (DATE_FORMAT(t1.sup_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
                and DATE_FORMAT(t1.sup_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
            </if>
        </if>
        <if test="terms.timeStart != null and terms.timeStart !='' and terms.timeEnd != null and terms.timeEnd !=''">
            and (DATE_FORMAT(t1.create_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.timeStart}
@@ -328,6 +336,27 @@
        </if>
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.caseType != null and terms.caseType !=''">
            and t2.case_type = #{terms.caseType}
        </if>
        <if test="terms.plaintiffs != null and terms.plaintiffs !=''">
            and t2.plaintiffs like concat('%', #{terms.plaintiffs}, '%')
        </if>
        <if test="terms.defendants != null and terms.defendants !=''">
            and t2.defendants like concat('%', #{terms.defendants}, '%')
        </if>
        <if test="terms.canal != null and terms.canal !=''">
            and t2.canal = #{terms.canal}
        </if>
        <if test="terms.caseStatus != null and terms.caseStatus !=''">
            and t2.status = #{terms.caseStatus}
        </if>
        <if test="terms.caseLevel != null and terms.caseLevel !=''">
            and t2.case_level = #{terms.caseLevel}
        </if>
        <if test="terms.mediResult != null and terms.mediResult !=''">
            and t3.medi_result = #{terms.mediResult}
        </if>
    </select>
@@ -346,9 +375,17 @@
        <if test="terms.type != 3">
            and t1.quilt_unit_id = #{terms.quiltUnitId}
            and t1.sup_status = #{terms.supStatus}
            <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
                and (DATE_FORMAT(t1.reply_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
                and DATE_FORMAT(t1.reply_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
            </if>
        </if>
        <if test="terms.type == 3">
            and t1.sup_unit_id = #{terms.supUnitId}
            <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
                and (DATE_FORMAT(t1.sup_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
                and DATE_FORMAT(t1.sup_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
            </if>
        </if>
        <if test="terms.timeStart != null and terms.timeStart !='' and terms.timeEnd != null and terms.timeEnd !=''">
            and (DATE_FORMAT(t1.create_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.timeStart}
@@ -357,6 +394,27 @@
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.caseType != null and terms.caseType !=''">
            and t2.case_type = #{terms.caseType}
        </if>
        <if test="terms.plaintiffs != null and terms.plaintiffs !=''">
            and t2.plaintiffs like concat('%', #{terms.plaintiffs}, '%')
        </if>
        <if test="terms.defendants != null and terms.defendants !=''">
            and t2.defendants like concat('%', #{terms.defendants}, '%')
        </if>
        <if test="terms.canal != null and terms.canal !=''">
            and t2.canal = #{terms.canal}
        </if>
        <if test="terms.caseStatus != null and terms.caseStatus !=''">
            and t2.status = #{terms.caseStatus}
        </if>
        <if test="terms.caseLevel != null and terms.caseLevel !=''">
            and t2.case_level = #{terms.caseLevel}
        </if>
        <if test="terms.mediResult != null and terms.mediResult !=''">
            and t3.medi_result = #{terms.mediResult}
        </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}
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseTaskMapper.xml
@@ -408,7 +408,28 @@
                and DATE_FORMAT(t1.handle_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
            </if>
            <if test="terms.partyName != null and terms.partyName !=''">
                and concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%')
                and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
            </if>
            <if test="terms.caseType != null and terms.caseType !=''">
                and t2.case_type = #{terms.caseType}
            </if>
            <if test="terms.plaintiffs != null and terms.plaintiffs !=''">
                and t2.plaintiffs like concat('%', #{terms.plaintiffs}, '%')
            </if>
            <if test="terms.defendants != null and terms.defendants !=''">
                and t2.defendants like concat('%', #{terms.defendants}, '%')
            </if>
            <if test="terms.canal != null and terms.canal !=''">
                and t2.canal = #{terms.canal}
            </if>
            <if test="terms.caseStatus != null and terms.caseStatus !=''">
                and t2.status = #{terms.caseStatus}
            </if>
            <if test="terms.caseLevel != null and terms.caseLevel !=''">
                and t2.case_level = #{terms.caseLevel}
            </if>
            <if test="terms.mediResult != null and terms.mediResult !=''">
                and t3.medi_result = #{terms.mediResult}
            </if>
            <if test="terms.status == 2">
                and t1.handle_result in (0, 1, 2)
@@ -548,7 +569,28 @@
                and DATE_FORMAT(t1.handle_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
            </if>
            <if test="terms.partyName != null and terms.partyName !=''">
                and concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%')
                and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
            </if>
            <if test="terms.caseType != null and terms.caseType !=''">
                and t2.case_type = #{terms.caseType}
            </if>
            <if test="terms.plaintiffs != null and terms.plaintiffs !=''">
                and t2.plaintiffs like concat('%', #{terms.plaintiffs}, '%')
            </if>
            <if test="terms.defendants != null and terms.defendants !=''">
                and t2.defendants like concat('%', #{terms.defendants}, '%')
            </if>
            <if test="terms.canal != null and terms.canal !=''">
                and t2.canal = #{terms.canal}
            </if>
            <if test="terms.caseStatus != null and terms.caseStatus !=''">
                and t2.status = #{terms.caseStatus}
            </if>
            <if test="terms.caseLevel != null and terms.caseLevel !=''">
                and t2.case_level = #{terms.caseLevel}
            </if>
            <if test="terms.mediResult != null and terms.mediResult !=''">
                and t3.medi_result = #{terms.mediResult}
            </if>
        </if>
    </sql>
@@ -606,6 +648,10 @@
                and (DATE_FORMAT(t1.create_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.createTimeStart}
                and DATE_FORMAT(t1.create_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.createTimeEnd})
            </if>
            <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
                and (DATE_FORMAT(t1.handle_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
                and DATE_FORMAT(t1.handle_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
            </if>
            <if test="terms.partyName != null and terms.partyName !=''">
                and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
            </if>
@@ -614,6 +660,27 @@
            </if>
            <if test='terms.mediatorType != null and terms.mediatorType =="2"'>
                and t3.mediator_id is null
            </if>
            <if test="terms.caseType != null and terms.caseType !=''">
                and t2.case_type = #{terms.caseType}
            </if>
            <if test="terms.plaintiffs != null and terms.plaintiffs !=''">
                and t2.plaintiffs like concat('%', #{terms.plaintiffs}, '%')
            </if>
            <if test="terms.defendants != null and terms.defendants !=''">
                and t2.defendants like concat('%', #{terms.defendants}, '%')
            </if>
            <if test="terms.canal != null and terms.canal !=''">
                and t2.canal = #{terms.canal}
            </if>
            <if test="terms.caseStatus != null and terms.caseStatus !=''">
                and t2.status = #{terms.caseStatus}
            </if>
            <if test="terms.caseLevel != null and terms.caseLevel !=''">
                and t2.case_level = #{terms.caseLevel}
            </if>
            <if test="terms.mediResult != null and terms.mediResult !=''">
                and t3.medi_result = #{terms.mediResult}
            </if>
        </if>
    </sql>
@@ -882,4 +949,674 @@
    <update id="deleteCaseTaskByCaseId">
        update dyh_case_task set delete_status = 1,update_time = #{updateTime} where case_id = #{caseId}
    </update>
    <sql id="where-select-task-all">
        <if test="terms != null">
            <if test="terms.caseType != null and terms.caseType !=''">
                and t2.case_type = #{terms.caseType}
            </if>
            <if test="terms.plaintiffs != null and terms.plaintiffs !=''">
                and t2.plaintiffs like concat('%', #{terms.plaintiffs}, '%')
            </if>
            <if test="terms.defendants != null and terms.defendants !=''">
                and t2.defendants like concat('%', #{terms.defendants}, '%')
            </if>
            <if test="terms.canal != null and terms.canal !=''">
                and t2.canal = #{terms.canal}
            </if>
            <if test="terms.caseStatus != null and terms.caseStatus !=''">
                and t2.status = #{terms.caseStatus}
            </if>
            <if test="terms.caseLevel != null and terms.caseLevel !=''">
                and t2.case_level = #{terms.caseLevel}
            </if>
            <if test="terms.mediResult != null and terms.mediResult !=''">
                and t3.medi_result = #{terms.mediResult}
            </if>
        </if>
    </sql>
    <sql id="select-task-all">
        SELECT
        t1.id as ownerId, t1.case_id as caseId, t3.is_risk as isRisk,
        <if test="terms.status != null and terms.status ==1">
            t1.create_time as turnaroundTime,
        </if>
        <if test="terms.status != null and terms.status ==2">
            t1.handle_time as turnaroundTime,
        </if>
        t1.expire_time as timeLimit,
        t2.case_level as caseGrade, t2.canal_name as caseSource, concat_ws('', ifnull(t2.case_type_first_name, ''), '/' , ifnull(t2.case_type_name, '')) as caseType,
        concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, '')) as plaintiffs,
        concat_ws('', ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) as defendants,
        (select count(1) from dyh_case_supervise where case_id = t1.case_id and sup_status = 0) as superviseCount,
        '' as taskType,
        <if test="terms.status != null and terms.status ==1">
            '待分派' as taskTypeName
        </if>
        <if test="terms.status != null and terms.status ==2">
            '已分派' as taskTypeName
        </if>
        FROM
        dyh_case_task t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        (t1.node_id = 'ZJ_DFP' or  t1.node_id = 'QJ_DFP' or  t1.node_id = 'SJ_DFP' or  t1.node_id = 'DFP')
        and t1.case_task_type = 1
        and t2.delete_status = 0
        and t1.status = #{terms.status}
        <if test="terms.status != null and terms.status ==1">
            and t1.cande_unit_id = #{terms.candeUnitId}
        </if>
        <if test="terms.status != null and terms.status ==2">
            and t1.handle_unit_id = #{terms.candeUnitId}
        </if>
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.handle_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.handle_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        UNION ALL
        SELECT
        t1.id as ownerId, t1.case_id as caseId, t3.is_risk as isRisk,
        <if test="terms.status != null and terms.status ==1">
            t1.create_time as turnaroundTime,
        </if>
        <if test="terms.status != null and terms.status ==2">
            t1.handle_time as turnaroundTime,
        </if>
        t1.expire_time as timeLimit,
        t2.case_level as caseGrade, t2.canal_name as caseSource, concat_ws('', ifnull(t2.case_type_first_name, ''), '/' , ifnull(t2.case_type_name, '')) as caseType,
        concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, '')) as plaintiffs,
        concat_ws('', ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) as defendants,
        (select count(1) from dyh_case_supervise where case_id = t1.case_id and sup_status = 0) as superviseCount,
        '' as taskType,
        <if test="terms.status != null and terms.status ==1">
            '待受理' as taskTypeName
        </if>
        <if test="terms.status != null and terms.status ==2">
            '已受理' as taskTypeName
        </if>
        FROM
        dyh_case_task t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        (t1.node_id = 'ZJ_DSL' or t1.node_id = 'QJ_DSL' or t1.node_id = 'SJ_DSL' or t1.node_id = 'DSL')
        and t2.delete_status = 0
        and t1.status = 1
        <if test="terms.status != null and terms.status ==1">
            and t1.cande_unit_id = #{terms.candeUnitId}
        </if>
        <if test="terms.status != null and terms.status ==2">
            and t1.handle_unit_id = #{terms.candeUnitId}
        </if>
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.handle_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.handle_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        <if test="terms.status != null and terms.status ==2">
            UNION ALL
            SELECT
            t1.case_task_id as ownerId, t1.case_id as caseId, t3.is_risk as isRisk,
            t1.dis_time as turnaroundTime,
            null as timeLimit,
            t2.case_level as caseGrade, t2.canal_name as caseSource, concat_ws('', ifnull(t2.case_type_first_name, ''), '/' , ifnull(t2.case_type_name, '')) as caseType,
            concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, '')) as plaintiffs,
            concat_ws('', ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) as defendants,
            (select count(1) from dyh_case_supervise where case_id = t1.case_id and sup_status = 0) as superviseCount,
            '' as taskType,
            '不已受理' as taskTypeName
            FROM
            dyh_case_dismiss t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
            where t2.delete_status = 0
            and t1.dis_unit_id = #{terms.candeUnitId}
            <if test="terms.partyName != null and terms.partyName !=''">
                and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
            </if>
            <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
                and (DATE_FORMAT(t1.dis_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
                and DATE_FORMAT(t1.dis_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
            </if>
            <include refid="where-select-task-all"/>
        </if>
        <if test="terms.status != null and terms.status ==1">
            UNION ALL
            SELECT
            t1.id as ownerId, t1.case_id as caseId, t3.is_risk as isRisk,
            t1.create_time as turnaroundTime,
            t1.expire_time as timeLimit,
            t2.case_level as caseGrade, t2.canal_name as caseSource, concat_ws('', ifnull(t2.case_type_first_name, ''), '/' , ifnull(t2.case_type_name, '')) as caseType,
            concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, '')) as plaintiffs,
            concat_ws('', ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) as defendants,
            (select count(1) from dyh_case_supervise where case_id = t1.case_id and sup_status = 0) as superviseCount,
            'sxbl' as taskType,
            '办理中' as taskTypeName
            FROM
            dyh_case_task t1 left join dyh_case_info t2 on t1.case_id = t2.id
            left join dyh_case_info_unfold t3 on t1.case_id = t3.id
            where
            t1.node_id = 'BLFK'
            and t1.status = 1
            and t2.delete_status = 0
            and t1.cande_unit_id = #{terms.candeUnitId}
            <if test="terms.partyName != null and terms.partyName !=''">
                and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
            </if>
            <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
                and (DATE_FORMAT(t1.handle_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
                and DATE_FORMAT(t1.handle_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
            </if>
            <include refid="where-select-task-all"/>
            UNION ALL
            SELECT
            t1.case_task_id as ownerId, t1.case_id as caseId, t3.is_risk as isRisk,
            t1.apply_time as turnaroundTime,
            null as timeLimit,
            t2.case_level as caseGrade, t2.canal_name as caseSource, concat_ws('', ifnull(t2.case_type_first_name, ''), '/' , ifnull(t2.case_type_name, '')) as caseType,
            concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, '')) as plaintiffs,
            concat_ws('', ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) as defendants,
            (select count(1) from dyh_case_supervise where case_id = t2.id and sup_status = 0) as superviseCount,
            'sxbl' as taskType,
            '结案申请' as taskTypeName
            FROM dyh_case_windup_apply t1 left join dyh_case_info t2 on t1.case_id = t2.id
            left join dyh_case_info_unfold t3 on t3.id = t2.id
            where
            t1.apply_status = 0
            and t2.delete_status = 0
            and (t1.apply_unit_id = #{terms.candeUnitId} or t3.assist_unit_id like concat('%', #{terms.candeUnitId}, '%'))
            <if test="terms.partyName != null and terms.partyName !=''">
                and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
            </if>
            <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
                and (DATE_FORMAT(t1.apply_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
                and DATE_FORMAT(t1.apply_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
            </if>
            <include refid="where-select-task-all"/>
        </if>
        <if test="terms.status != null and terms.status ==2">
            UNION ALL
            SELECT
            t3.case_task_id as ownerId, t1.id as caseId, t2.is_risk as isRisk,
            t2.close_time as turnaroundTime,
            null as timeLimit,
            t1.case_level as caseGrade, t1.canal_name as caseSource, concat_ws('', ifnull(t1.case_type_first_name, ''), '/' , ifnull(t1.case_type_name, '')) as caseType,
            concat_ws('', ifnull(t1.plaintiffs, ''), ifnull(t1.pagents, '')) as plaintiffs,
            concat_ws('', ifnull(t1.defendants, ''), ifnull(t1.dagents, '')) as defendants,
            (select count(1) from dyh_case_supervise where case_id = t1.id and sup_status = 0) as superviseCount,
            'sxbl' as taskType,
            '已结案' as taskTypeName
            from dyh_case_info t1
            left join dyh_case_info_unfold t2 on t1.id = t2.id
            left join dyh_case_windup_apply t3 on t1.id = t3.case_id
            where t1.process in (5, 6)
            and t1.delete_status = 0
            and (t2.mediate_unit_id = #{terms.candeUnitId} or t2.assist_unit_id like concat('%', #{terms.candeUnitId}, '%'))
            <if test="terms.partyName != null and terms.partyName !=''">
                and (concat_ws('', ifnull(t1.plaintiffs, ''), ifnull(t1.pagents, ''), ifnull(t1.defendants, ''), ifnull(t1.dagents, '')) like concat('%', #{terms.partyName}, '%') or t1.case_ref like concat('%', #{terms.partyName}, '%'))
            </if>
            <if test="terms.caseType != null and terms.caseType !=''">
                and t1.case_type = #{terms.caseType}
            </if>
            <if test="terms.plaintiffs != null and terms.plaintiffs !=''">
                and t1.plaintiffs like concat('%', #{terms.plaintiffs}, '%')
            </if>
            <if test="terms.defendants != null and terms.defendants !=''">
                and t1.defendants like concat('%', #{terms.defendants}, '%')
            </if>
            <if test="terms.canal != null and terms.canal !=''">
                and t1.canal = #{terms.canal}
            </if>
            <if test="terms.caseStatus != null and terms.caseStatus !=''">
                and t1.status = #{terms.caseStatus}
            </if>
            <if test="terms.caseLevel != null and terms.caseLevel !=''">
                and t1.case_level = #{terms.caseLevel}
            </if>
            <if test="terms.mediResult != null and terms.mediResult !=''">
                and t2.medi_result = #{terms.mediResult}
            </if>
            <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
                and (DATE_FORMAT(t2.close_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
                and DATE_FORMAT(t2.close_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
            </if>
        </if>
        UNION ALL
        SELECT
        t1.case_task_id as ownerId, t1.case_id as caseId,t3.is_risk as isRisk,
        <if test="terms.status != null and terms.status ==1">
            t1.return_time as turnaroundTime,
        </if>
        <if test="terms.status != null and terms.status ==2">
            t1.audit_time as turnaroundTime,
        </if>
        null as timeLimit,
        t2.case_level as caseGrade, t2.canal_name as caseSource, concat_ws('', ifnull(t2.case_type_first_name, ''), '/' , ifnull(t2.case_type_name, '')) as caseType,
        concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, '')) as plaintiffs, concat_ws('', ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) as defendants,
        (select count(1) from dyh_case_supervise where case_id = t1.case_id and sup_status = 0) as superviseCount,
        'htsh' as taskType,
        <if test="terms.status != null and terms.status ==1">
            '待审核' as taskTypeName
        </if>
        <if test="terms.status != null and terms.status ==2">
            '已审核' as taskTypeName
        </if>
        FROM
        dyh_case_return t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        t1.delete_status = 0
        <if test="terms.status != null and terms.status ==1">
            and t1.return_status = 0
        </if>
        <if test="terms.status != null and terms.status ==2">
            and t1.return_status = 1
        </if>
        and t1.audit_unit_id = #{terms.candeUnitId}
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        UNION ALL
        SELECT t1.case_task_id as ownerId, t1.case_id as caseId,t3.is_risk as isRisk,
        <if test="terms.status != null and terms.status ==1">
            t1.appear_time as turnaroundTime,
        </if>
        <if test="terms.status != null and terms.status ==2">
            t1.audit_time as turnaroundTime,
        </if>
        null as timeLimit,
        t2.case_level as caseGrade, t2.canal_name as caseSource, concat_ws('', ifnull(t2.case_type_first_name, ''), '/' , ifnull(t2.case_type_name, '')) as caseType,
        concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, '')) as plaintiffs, concat_ws('', ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) as defendants,
        (select count(1) from dyh_case_supervise where case_id = t1.case_id and sup_status = 0) as superviseCount,
        'sbsh' as taskType,
        <if test="terms.status != null and terms.status ==1">
            '待审核' as taskTypeName
        </if>
        <if test="terms.status != null and terms.status ==2">
            '已审核' as taskTypeName
        </if>
        FROM
        dyh_case_appear t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        t1.delete_status = 0
        <if test="terms.status != null and terms.status ==1">
            and t1.apply_status = 0
        </if>
        <if test="terms.status != null and terms.status ==2">
            and t1.apply_status = 1
        </if>
        and t1.audit_unit_id = #{terms.candeUnitId}
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        UNION ALL
        SELECT t1.case_task_id as ownerId, t1.case_id as caseId,t3.is_risk as isRisk,
        <if test="terms.status != null and terms.status ==1">
            t1.apply_time as turnaroundTime,
        </if>
        <if test="terms.status != null and terms.status ==2">
            t1.audit_time as turnaroundTime,
        </if>
        null as timeLimit,
        t2.case_level as caseGrade, t2.canal_name as caseSource,
        concat_ws('', ifnull(t2.case_type_first_name, ''), '/' , ifnull(t2.case_type_name, '')) as caseType, concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, '')) as plaintiffs,
        concat_ws('', ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) as defendants,
        (select count(1) from dyh_case_supervise where case_id = t1.case_id and sup_status = 0) as superviseCount,
        'jash' as taskType,
        <if test="terms.status != null and terms.status ==1">
            '待审核' as taskTypeName
        </if>
        <if test="terms.status != null and terms.status ==2">
            '已审核' as taskTypeName
        </if>
        FROM
        dyh_case_windup_apply t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        t1.delete_status = 0
        <if test="terms.status != null and terms.status ==1">
            and t1.apply_status = 0
        </if>
        <if test="terms.status != null and terms.status ==2">
            and t1.apply_status = 1
        </if>
        and t1.audit_unit_id = #{terms.candeUnitId}
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        UNION ALL
        SELECT t1.id as ownerId, t1.case_id as CaseId, t3.is_risk as isRisk,
        <if test="terms.status != null and terms.status ==1">
            t1.apply_time as turnaroundTime,
        </if>
        <if test="terms.status != null and terms.status ==2">
            t1.audit_time as turnaroundTime,
        </if>
        null as timeLimit,
        t2.case_level as caseGrade, t2.canal_name as caseSource, concat_ws('', ifnull(t2.case_type_first_name, ''), '/' , ifnull(t2.case_type_name, '')) as caseType,
        concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, '')) as plaintiffs, concat_ws('', ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) as defendants,
        (select count(1) from dyh_case_supervise where case_id = t1.case_id and sup_status = 0) as superviseCount,
        'lhczsh' as taskType,
        <if test="terms.status != null and terms.status ==1">
            '待审核' as taskTypeName
        </if>
        <if test="terms.status != null and terms.status ==2">
            '已审核' as taskTypeName
        </if>
        FROM
        dyh_case_assist_apply t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        t1.delete_status = 0
        <if test="terms.status != null and terms.status ==1">
            and t1.apply_status = 0
        </if>
        <if test="terms.status != null and terms.status ==2">
            and t1.apply_status = 1
        </if>
        and t1.audit_unit_id = #{terms.candeUnitId}
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        UNION ALL
        SELECT t1.id as ownerId, t1.case_id as caseId,t3.is_risk as isRisk,
        <if test="terms.status != null and terms.status ==1">
            t1.sup_time as turnaroundTime,
        </if>
        <if test="terms.status != null and terms.status ==2">
            t1.reply_time as turnaroundTime,
        </if>
        DATEADD(hour, t1.reply_term, t1.sup_time) as timeLimit,
        t2.case_level as caseGrade, t2.canal_name as caseSource,
        concat_ws('', ifnull(t2.case_type_first_name, ''), '/' , ifnull(t2.case_type_name, '')) as caseType, concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, '')) as plaintiffs,
        concat_ws('', ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) as defendants,
        0 as superviseCount,
        '' as taskType,
        '督办' as taskTypeName
        FROM
        dyh_case_supervise t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        t1.delete_status = 0
        <if test="terms.status != null and terms.status ==1">
            and t1.sup_status = 0
        </if>
        <if test="terms.status != null and terms.status ==2">
            and t1.sup_status = 1
        </if>
        and t1.quilt_unit_id = #{terms.candeUnitId}
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.reply_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.reply_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        <if test="terms.status != null and terms.status ==2">
            UNION ALL
            SELECT t1.id as ownerId, t1.case_id as caseId,t3.is_risk as isRisk,
            t1.sup_time as turnaroundTime,
            DATEADD(hour, t1.reply_term, t1.sup_time) as timeLimit,
            t2.case_level as caseGrade, t2.canal_name as caseSource,
            concat_ws('', ifnull(t2.case_type_first_name, ''), '/' , ifnull(t2.case_type_name, '')) as caseType, concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, '')) as plaintiffs,
            concat_ws('', ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) as defendants,
            0 as superviseCount,
            '' as taskType,
            '督办' as taskTypeName
            FROM
            dyh_case_supervise t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
            where
            t1.delete_status = 0
            and t1.sup_unit_id = #{terms.candeUnitId}
            <if test="terms.partyName != null and terms.partyName !=''">
                and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
            </if>
            <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
                and (DATE_FORMAT(t1.sup_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
                and DATE_FORMAT(t1.sup_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
            </if>
            <include refid="where-select-task-all"/>
        </if>
    </sql>
    <select id="pageMyTaskAll" resultType="cn.huge.module.cases.domain.dto.FrontPageListAllDTO">
        select * from
        (<include refid="select-task-all"/>) t where 1=1
        order by isnull(t.turnaroundTime), t.turnaroundTime desc
        limit #{page.offset}, #{page.size}
    </select>
    <select id="countMyTaskAll" resultType="java.lang.Long">
        select count(1) from
        (<include refid="select-task-all"/>) t
    </select>
    <select id="countYbDispatch" resultType="java.lang.Long">
        select count(1) from
        (SELECT
        t1.id as ownerId, t1.case_id as caseId
        FROM
        dyh_case_task t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        (t1.node_id = 'ZJ_DFP' or  t1.node_id = 'QJ_DFP' or  t1.node_id = 'SJ_DFP' or  t1.node_id = 'DFP')
        and t1.case_task_type = 1
        and t2.delete_status = 0
        and t1.status = #{terms.status}
        and t1.handle_unit_id = #{terms.candeUnitId}
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.handle_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.handle_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        ) t
    </select>
    <select id="countYbAccept" resultType="java.lang.Long">
        select count(1) from
        (SELECT
        t1.id as ownerId, t1.case_id as caseId
        FROM
        dyh_case_task t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        (t1.node_id = 'ZJ_DSL' or t1.node_id = 'QJ_DSL' or t1.node_id = 'SJ_DSL' or t1.node_id = 'DSL')
        and t2.delete_status = 0
        and t1.status = 1
        and t1.handle_unit_id = #{terms.candeUnitId}
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.handle_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.handle_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        UNION ALL
        SELECT
        t1.case_task_id as ownerId, t1.case_id as caseId
        FROM
        dyh_case_dismiss t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where t2.delete_status = 0
        and t1.dis_unit_id = #{terms.candeUnitId}
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.dis_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.dis_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        ) t
    </select>
    <select id="countYbClosed" resultType="java.lang.Long">
        select count(1) from
        (SELECT
        t3.case_task_id as ownerId, t1.id as caseId
        from dyh_case_info t1
        left join dyh_case_info_unfold t2 on t1.id = t2.id
        left join dyh_case_windup_apply t3 on t1.id = t3.case_id
        where t1.process in (5, 6)
        and t1.delete_status = 0
        and (t2.mediate_unit_id = #{terms.candeUnitId} or t2.assist_unit_id like concat('%', #{terms.candeUnitId}, '%'))
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t1.plaintiffs, ''), ifnull(t1.pagents, ''), ifnull(t1.defendants, ''), ifnull(t1.dagents, '')) like concat('%', #{terms.partyName}, '%') or t1.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t2.close_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t2.close_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <if test="terms.caseType != null and terms.caseType !=''">
            and t1.case_type = #{terms.caseType}
        </if>
        <if test="terms.plaintiffs != null and terms.plaintiffs !=''">
            and t1.plaintiffs like concat('%', #{terms.plaintiffs}, '%')
        </if>
        <if test="terms.defendants != null and terms.defendants !=''">
            and t1.defendants like concat('%', #{terms.defendants}, '%')
        </if>
        <if test="terms.canal != null and terms.canal !=''">
            and t1.canal = #{terms.canal}
        </if>
        <if test="terms.caseStatus != null and terms.caseStatus !=''">
            and t1.status = #{terms.caseStatus}
        </if>
        <if test="terms.caseLevel != null and terms.caseLevel !=''">
            and t1.case_level = #{terms.caseLevel}
        </if>
        <if test="terms.mediResult != null and terms.mediResult !=''">
            and t2.medi_result = #{terms.mediResult}
        </if>
        ) t
    </select>
    <select id="countYbAudit" resultType="java.lang.Long">
        select count(1) from
        (
        SELECT
        t1.case_task_id as ownerId, t1.case_id as caseId
        FROM
        dyh_case_return t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        t1.delete_status = 0
        and t1.return_status = 1
        and t1.audit_unit_id = #{terms.candeUnitId}
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        UNION ALL
        SELECT t1.case_task_id as ownerId, t1.case_id as caseId
        FROM
        dyh_case_appear t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        t1.delete_status = 0
        and t1.apply_status = 1
        and t1.audit_unit_id = #{terms.candeUnitId}
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        UNION ALL
        SELECT t1.case_task_id as ownerId, t1.case_id as caseId
        FROM
        dyh_case_windup_apply t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        t1.delete_status = 0
        and t1.apply_status = 1
        and t1.audit_unit_id = #{terms.candeUnitId}
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        UNION ALL
        SELECT t1.id as ownerId, t1.case_id as CaseId
        FROM
        dyh_case_assist_apply t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        t1.delete_status = 0
        and t1.apply_status = 1
        and t1.audit_unit_id = #{terms.candeUnitId}
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        ) t
    </select>
    <select id="countYbSupervise" resultType="java.lang.Long">
        select count(1) from
        (
        SELECT t1.id as ownerId, t1.case_id as caseId
        FROM
        dyh_case_supervise t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        t1.delete_status = 0
        and t1.sup_status = 1
        and t1.quilt_unit_id = #{terms.candeUnitId}
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.reply_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.reply_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        UNION ALL
        SELECT t1.id as ownerId, t1.case_id as caseId
        FROM
        dyh_case_supervise t1 left join dyh_case_info t2 on t1.case_id = t2.id left join dyh_case_info_unfold t3 on t2.id = t3.id
        where
        t1.delete_status = 0
        and t1.sup_unit_id = #{terms.candeUnitId}
        <if test="terms.partyName != null and terms.partyName !=''">
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.sup_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.sup_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <include refid="where-select-task-all"/>
        ) t
    </select>
</mapper> 
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/dao/mapper/xml/CaseWindupApplyMapper.xml
@@ -336,8 +336,33 @@
            and (DATE_FORMAT(t1.apply_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.timeStart}
            and DATE_FORMAT(t1.apply_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.timeEnd})
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <if test="terms.partyName != null and terms.partyName !=''">
            and concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%')
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.caseType != null and terms.caseType !=''">
            and t2.case_type = #{terms.caseType}
        </if>
        <if test="terms.plaintiffs != null and terms.plaintiffs !=''">
            and t2.plaintiffs like concat('%', #{terms.plaintiffs}, '%')
        </if>
        <if test="terms.defendants != null and terms.defendants !=''">
            and t2.defendants like concat('%', #{terms.defendants}, '%')
        </if>
        <if test="terms.canal != null and terms.canal !=''">
            and t2.canal = #{terms.canal}
        </if>
        <if test="terms.caseStatus != null and terms.caseStatus !=''">
            and t2.status = #{terms.caseStatus}
        </if>
        <if test="terms.caseLevel != null and terms.caseLevel !=''">
            and t2.case_level = #{terms.caseLevel}
        </if>
        <if test="terms.mediResult != null and terms.mediResult !=''">
            and t3.medi_result = #{terms.mediResult}
        </if>
    </select>
    <!--  首页-待审核分页查询  -->
@@ -357,8 +382,33 @@
            and (DATE_FORMAT(t1.apply_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.timeStart}
            and DATE_FORMAT(t1.apply_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.timeEnd})
        </if>
        <if test="terms.handleTimeStart != null and terms.handleTimeStart !='' and terms.handleTimeEnd != null and terms.handleTimeEnd !=''">
            and (DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ >= ]]> #{terms.handleTimeStart}
            and DATE_FORMAT(t1.audit_time,'%Y-%m-%d') <![CDATA[ <= ]]> #{terms.handleTimeEnd})
        </if>
        <if test="terms.partyName != null and terms.partyName !=''">
            and concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%')
            and (concat_ws('', ifnull(t2.plaintiffs, ''), ifnull(t2.pagents, ''), ifnull(t2.defendants, ''), ifnull(t2.dagents, '')) like concat('%', #{terms.partyName}, '%') or t2.case_ref like concat('%', #{terms.partyName}, '%'))
        </if>
        <if test="terms.caseType != null and terms.caseType !=''">
            and t2.case_type = #{terms.caseType}
        </if>
        <if test="terms.plaintiffs != null and terms.plaintiffs !=''">
            and t2.plaintiffs like concat('%', #{terms.plaintiffs}, '%')
        </if>
        <if test="terms.defendants != null and terms.defendants !=''">
            and t2.defendants like concat('%', #{terms.defendants}, '%')
        </if>
        <if test="terms.canal != null and terms.canal !=''">
            and t2.canal = #{terms.canal}
        </if>
        <if test="terms.caseStatus != null and terms.caseStatus !=''">
            and t2.status = #{terms.caseStatus}
        </if>
        <if test="terms.caseLevel != null and terms.caseLevel !=''">
            and t2.case_level = #{terms.caseLevel}
        </if>
        <if test="terms.mediResult != null and terms.mediResult !=''">
            and t3.medi_result = #{terms.mediResult}
        </if>
        <if test="page.sort != null">
            <foreach collection="page.sort" item="s" index="index" separator="," open="order by ">
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/domain/dto/CaseRegisterDTO.java
@@ -58,5 +58,9 @@
     * 纠纷任务编号
     * */
    private String caseTaskId;
    /**
     * 承办部门
     * */
    private String mediateUnitName;
}
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/domain/dto/CaseStatisticsBaseDTO.java
@@ -10,24 +10,29 @@
@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 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 oneLevelNum=0;//1级事件数量
    private Integer twoLevelNum=0;//2级事件数量
    private Integer threeLevelNum=0;//3级事件数量
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/domain/dto/CaseWorkStatisticsBaseDTO.java
New file
@@ -0,0 +1,43 @@
package cn.huge.module.cases.domain.dto;
import lombok.Data;
import java.util.List;
/**
 * @author zhouxiantao
 * @create 2025-04-22 15:11
 */
@Data
public class CaseWorkStatisticsBaseDTO {
    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 toDayTotalNum=0;//今日新增总记录数
    private Integer toDayProcessNum=0;//今日新增化解中数
    private Integer toDayRejectNum=0;//今日新增不予受理数量
    private Integer toDayFinishNum=0;//今日新增已结案数量
    private String momType;//0-不显示,1-月环比,2-年环比
    private String momTotalRate;//总记录数(月环比)
    private String yoyTotalRate;//总记录数(月同比)
    private String momProcessRate;//化解中数量(月环比)
    private String yoyProcessRate;//化解中数量(月同比)
    private String momRejectRate;//不予受理数量(月环比)
    private String yoyRejectRate;//不予受理数量(月同比)
    private String momFinishNumRate;//已结案数量(月环比)
    private String yoyFinishNumRate;//已结案数量(月同比)
    private String momResolveRate;//化解成功率(月环比)
    private String yoyResolveRate;//化解成功率(月环比)
    private List<CaseStatisticsTypeDTO> typeList;//纠纷类型集合
    private List<CaseWorkStatisticsTimeDTO> timeList;//时间集合
}
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/domain/dto/CaseWorkStatisticsTimeDTO.java
New file
@@ -0,0 +1,28 @@
package cn.huge.module.cases.domain.dto;
import lombok.Data;
/**
 * @author zhouxiantao
 * @create 2025-04-23 11:03
 */
@Data
public class CaseWorkStatisticsTimeDTO {
    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 String dayStr;//天字符串(yyyy-mm-dd)
    private String monthStr;//月字符串(yyyy-mm)
    private String yearStr;//年字符串(yyyy)
    private String timeStr;//前端展示使用
    private String timeAllStr;//前端展示使用(全部展示)
    private Integer sort;//排序
}
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/domain/dto/CaseYbCountDTO.java
New file
@@ -0,0 +1,40 @@
package cn.huge.module.cases.domain.dto;
import lombok.Data;
/**
 * @author zhouxiantao
 * @create 2025-05-21 15:12
 */
@Data
public class CaseYbCountDTO {
    /**
     * 全部已办数量
     * */
    private Long allYbTask;
    /**
     * 已合并数量
     * */
    private Long ybMerge;
    /**
     * 已分派数量
     * */
    private Long ybDispatch;
    /**
     * 受理数量
     * */
    private Long ybAccept;
    /**
     * 已结案数量
     * */
    private Long ybClosed;
    /**
     * 已审核数量
     * */
    private Long ybAudit;
    /**
     * 督办数量
     * */
    private Long ybSupervise;
}
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/domain/dto/FrontPageListAllDTO.java
New file
@@ -0,0 +1,78 @@
package cn.huge.module.cases.domain.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
/**
 * @author zhouxiantao
 * @create 2025-04-15 15:55
 */
@Data
public class FrontPageListAllDTO {
    /**
     * 所属业务表编号
     */
    private String ownerId;
    /**
     * 纠纷信息ID
     */
    private String caseId;
    /**
     * 风险案件标签,0:非风险案件,1:风险案件
     */
    private String isRisk;
    /**
     * 流转时间
     */
    @JsonFormat(pattern="yyyy-MM-dd HH:mm", timezone="GMT+8")
    private Date turnaroundTime;
    /**
     * 分派时限
     */
    @JsonFormat(pattern="yyyy-MM-dd HH:mm", timezone="GMT+8")
    private Date timeLimit;
    /**
     * 事项等级
     */
    private Integer caseGrade;
    /**
     * 事项来源
     */
    private String caseSource;
    /**
     * 纠纷类型
     */
    private String caseType;
    /**
     * 申请方
     */
    private String plaintiffs;
    /**
     * 被申请方
     */
    private String defendants;
    /**
     * 督办次数
     */
    private int superviseCount;
    /**
     * 类型编码
     * */
    private String taskType;
    /**
     * 类型名称
     * */
    private String taskTypeName;
}
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseInfoService.java
@@ -16,6 +16,7 @@
import cn.huge.module.cases.domain.po.*;
import cn.huge.module.cases.domain.vo.CaseVo;
import cn.huge.module.cases.domain.vo.GenerateQrCodeRequestVo;
import cn.huge.module.cases.utils.StatisticsTimeUtils;
import cn.huge.module.client.api.impl.CustClientImpl;
import cn.huge.module.client.api.impl.SysClientImpl;
import cn.huge.module.client.api.impl.UtilsClientImpl;
@@ -1418,6 +1419,19 @@
        terms.put("areaType", areaType);
        // 调用统计调解过程的方法
        CaseStatisticsBaseDTO caseStatisticsBaseDTO = statisticsProcess(terms);
        //当日新增
        Map<String, Object> toDayTerms = new HashMap<>();
        toDayTerms.putAll(terms);
        String toDayStr = DateUtils.DateToString(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD);
        toDayTerms.put("createStart", toDayStr + " 00:00:00");
        toDayTerms.put("createEnd", toDayStr + " 23:59:59");
        CaseStatisticsBaseDTO toDayBaseDTO = mapper.statisticsBase(toDayTerms);
        caseStatisticsBaseDTO.setToDayTotalNum(toDayBaseDTO.getTotalNum());
        caseStatisticsBaseDTO.setToDayProcessNum(toDayBaseDTO.getProcessNum());
        caseStatisticsBaseDTO.setToDayRejectNum(toDayBaseDTO.getRejectNum());
        caseStatisticsBaseDTO.setToDayFinishNum(toDayBaseDTO.getFinishNum());
        //区域数据统计
        List<CaseStatisticsAreaDTO> caseStatisticsAreaDTOS = new ArrayList<>();
        if (!isLast) {
@@ -1692,6 +1706,164 @@
        return caseStatisticsTypeDTOS;
    }
    /**
     * 工作统计
     */
    public CaseWorkStatisticsBaseDTO workStatistics(Map<String, Object> terms, String userId) throws IOException {
        CaseWorkStatisticsBaseDTO caseWorkStatisticsBaseDTO = new CaseWorkStatisticsBaseDTO();
        terms.put("statistics", "1");
        //根据用户筛选区域范围
        CtUnitDTO ctUnitDTO = custClient.getUnitByUserId(userId);
        //目前没有村居数据,所以单位等级是4的也归集到3里面
        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());
        }
        terms.put("workUserId", userId);
        String areaType = "1";
        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";
        }
        terms.put("areaType", areaType);
        CaseStatisticsBaseDTO caseStatisticsBaseDTO = mapper.statisticsBase(terms);
        Integer baseTotalNum = dellNull(caseStatisticsBaseDTO.getResolveNum()) + dellNull(caseStatisticsBaseDTO.getUnResolveNum()) + dellNull(caseStatisticsBaseDTO.getResolveingNum());
        Integer resolveTotalNum = dellNull(caseStatisticsBaseDTO.getResolveNum()) + dellNull(caseStatisticsBaseDTO.getUnResolveNum());
        caseStatisticsBaseDTO.setResolveRate(BigDecimalUtil.integerDivideDelZero(caseStatisticsBaseDTO.getResolveNum() * 100, resolveTotalNum, 1));
        caseStatisticsBaseDTO.setUnResolveRate(BigDecimalUtil.integerDivideDelZero(caseStatisticsBaseDTO.getUnResolveNum() * 100, resolveTotalNum, 1));
        caseStatisticsBaseDTO.setResolveingRate(BigDecimalUtil.integerDivideDelZero(caseStatisticsBaseDTO.getResolveingNum() * 100, baseTotalNum, 1));
        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));
        //当日新增
        Map<String, Object> toDayTerms = new HashMap<>();
        toDayTerms.putAll(terms);
        String toDayStr = DateUtils.DateToString(DateUtils.getNowDate(), DateUtils.YYYY_MM_DD);
        toDayTerms.put("createStart", toDayStr + " 00:00:00");
        toDayTerms.put("createEnd", toDayStr + " 23:59:59");
        CaseStatisticsBaseDTO toDayBaseDTO = mapper.statisticsBase(toDayTerms);
        caseStatisticsBaseDTO.setToDayTotalNum(toDayBaseDTO.getTotalNum());
        caseStatisticsBaseDTO.setToDayProcessNum(toDayBaseDTO.getProcessNum());
        caseStatisticsBaseDTO.setToDayRejectNum(toDayBaseDTO.getRejectNum());
        caseStatisticsBaseDTO.setToDayFinishNum(toDayBaseDTO.getFinishNum());
        BeanUtils.copyProperties(caseStatisticsBaseDTO, caseWorkStatisticsBaseDTO);
        //按时间统计
        Date startDate = null;
        Date endDate = null;
        if(ObjectUtils.isNotEmpty(terms.get("createStart"))){
            String startTime = terms.get("createStart").toString();
            String endTime = terms.get("createEnd").toString();
            startDate = DateUtils.StringToDate(startTime, "yyyy-MM-dd HH:mm:ss");
            endDate = DateUtils.StringToDate(endTime, "yyyy-MM-dd HH:mm:ss");
            terms.put("selectTimeType","1");
        }else if(ObjectUtils.isNotEmpty(terms.get("closeStart"))){
            String startTime = terms.get("closeStart").toString();
            String endTime = terms.get("closeEnd").toString();
            startDate = DateUtils.StringToDate(startTime, "yyyy-MM-dd HH:mm:ss");
            endDate = DateUtils.StringToDate(endTime, "yyyy-MM-dd HH:mm:ss");
            terms.put("selectTimeType","2");
        }
        List<CaseWorkStatisticsTimeDTO> resultTimeDTOs = new ArrayList<>();
        if(ObjectUtils.isNotEmpty(startDate)){
            String spanType = StatisticsTimeUtils.spanTime(startDate, endDate);
            terms.put("timeType", spanType);
            List<CaseWorkStatisticsTimeDTO> caseWorkStatisticsTimeDTOs = mapper.workStatisticsTime(terms);
            resultTimeDTOs = StatisticsTimeUtils.dellStatisticsTime(caseWorkStatisticsTimeDTOs, startDate, endDate, spanType);
        }
        caseWorkStatisticsBaseDTO.setTimeList(resultTimeDTOs);
        //环比和同比
        if(StatisticsTimeUtils.isStartAndEndOfMonth(startDate, endDate)){
            caseWorkStatisticsBaseDTO.setMomType("1");
            Map<String, Object> momthTerms = new HashMap<>();
            momthTerms.putAll(terms);
            momthTerms.put("createStart", StatisticsTimeUtils.getMomStartDate(startDate) + " 00:00:00");
            momthTerms.put("createEnd", StatisticsTimeUtils.getMomEndDate(startDate) + " 23:59:59");
            CaseStatisticsBaseDTO momBaseDTO = mapper.statisticsBase(momthTerms);
            caseWorkStatisticsBaseDTO.setMomTotalRate(StatisticsTimeUtils.calculateMomGrowthRate(caseStatisticsBaseDTO.getTotalNum(),momBaseDTO.getTotalNum()));
            caseWorkStatisticsBaseDTO.setMomProcessRate(StatisticsTimeUtils.calculateMomGrowthRate(caseStatisticsBaseDTO.getProcessNum(),momBaseDTO.getProcessNum()));
            caseWorkStatisticsBaseDTO.setMomRejectRate(StatisticsTimeUtils.calculateMomGrowthRate(caseStatisticsBaseDTO.getRejectNum(),momBaseDTO.getRejectNum()));
            caseWorkStatisticsBaseDTO.setMomFinishNumRate(StatisticsTimeUtils.calculateMomGrowthRate(caseStatisticsBaseDTO.getFinishNum(),momBaseDTO.getFinishNum()));
            Integer momResolveTotalNum = dellNull(momBaseDTO.getResolveNum()) + dellNull(momBaseDTO.getUnResolveNum());
            momBaseDTO.setResolveRate(BigDecimalUtil.integerDivideDelZero(momBaseDTO.getResolveNum() * 100, momResolveTotalNum, 1));
            caseWorkStatisticsBaseDTO.setMomResolveRate(StatisticsTimeUtils.calculateMomGrowthRate(caseStatisticsBaseDTO.getResolveRate(),momBaseDTO.getResolveRate()));
            momthTerms.put("createStart", StatisticsTimeUtils.getYoyDate(startDate) + " 00:00:00");
            momthTerms.put("createEnd", StatisticsTimeUtils.getYoyDate(endDate) + " 23:59:59");
            CaseStatisticsBaseDTO yoyBaseDTO = mapper.statisticsBase(momthTerms);
            caseWorkStatisticsBaseDTO.setYoyTotalRate(StatisticsTimeUtils.calculateMomGrowthRate(caseStatisticsBaseDTO.getTotalNum(),yoyBaseDTO.getTotalNum()));
            caseWorkStatisticsBaseDTO.setYoyProcessRate(StatisticsTimeUtils.calculateMomGrowthRate(caseStatisticsBaseDTO.getProcessNum(),yoyBaseDTO.getProcessNum()));
            caseWorkStatisticsBaseDTO.setYoyRejectRate(StatisticsTimeUtils.calculateMomGrowthRate(caseStatisticsBaseDTO.getRejectNum(),yoyBaseDTO.getRejectNum()));
            caseWorkStatisticsBaseDTO.setYoyFinishNumRate(StatisticsTimeUtils.calculateMomGrowthRate(caseStatisticsBaseDTO.getFinishNum(),yoyBaseDTO.getFinishNum()));
            Integer yoyResolveTotalNum = dellNull(yoyBaseDTO.getResolveNum()) + dellNull(yoyBaseDTO.getUnResolveNum());
            yoyBaseDTO.setResolveRate(BigDecimalUtil.integerDivideDelZero(yoyBaseDTO.getResolveNum() * 100, yoyResolveTotalNum, 1));
            caseWorkStatisticsBaseDTO.setYoyResolveRate(StatisticsTimeUtils.calculateMomGrowthRate(caseStatisticsBaseDTO.getResolveRate(),yoyBaseDTO.getResolveRate()));
        }else if(StatisticsTimeUtils.isStartAndEndOfYear(startDate, endDate)){
            caseWorkStatisticsBaseDTO.setMomType("2");
            Map<String, Object> momthTerms = new HashMap<>();
            momthTerms.putAll(terms);
            momthTerms.put("createStart", StatisticsTimeUtils.getYoyDate(startDate) + " 00:00:00");
            momthTerms.put("createEnd", StatisticsTimeUtils.getYoyDate(endDate) + " 23:59:59");
            CaseStatisticsBaseDTO yoyBaseDTO = mapper.statisticsBase(momthTerms);
            caseWorkStatisticsBaseDTO.setYoyTotalRate(StatisticsTimeUtils.calculateMomGrowthRate(caseStatisticsBaseDTO.getTotalNum(),yoyBaseDTO.getTotalNum()));
            caseWorkStatisticsBaseDTO.setYoyProcessRate(StatisticsTimeUtils.calculateMomGrowthRate(caseStatisticsBaseDTO.getProcessNum(),yoyBaseDTO.getProcessNum()));
            caseWorkStatisticsBaseDTO.setYoyRejectRate(StatisticsTimeUtils.calculateMomGrowthRate(caseStatisticsBaseDTO.getRejectNum(),yoyBaseDTO.getRejectNum()));
            caseWorkStatisticsBaseDTO.setYoyFinishNumRate(StatisticsTimeUtils.calculateMomGrowthRate(caseStatisticsBaseDTO.getFinishNum(),yoyBaseDTO.getFinishNum()));
            Integer yoyResolveTotalNum = dellNull(yoyBaseDTO.getResolveNum()) + dellNull(yoyBaseDTO.getUnResolveNum());
            yoyBaseDTO.setResolveRate(BigDecimalUtil.integerDivideDelZero(yoyBaseDTO.getResolveNum() * 100, yoyResolveTotalNum, 1));
            caseWorkStatisticsBaseDTO.setYoyResolveRate(StatisticsTimeUtils.calculateMomGrowthRate(caseStatisticsBaseDTO.getResolveRate(),yoyBaseDTO.getResolveRate()));
        }else{
            caseWorkStatisticsBaseDTO.setMomType("0");
        }
        //纠纷类型统计
        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);
        }
        caseWorkStatisticsBaseDTO.setTypeList(typeList);
        return caseWorkStatisticsBaseDTO;
    }
    public Map<String, String> getArea() {
        Map<String, String> map = new HashMap<>();
        map.put("越秀区", "2");
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/service/CaseTaskService.java
@@ -1135,6 +1135,45 @@
            throw new ServiceException("CaseTaskService.getCountList", e);
        }
    }
    /**
     * 首页-查询全部待办任务
     *
     * @param page  分页对象
     * @param terms 条件
     * @return Page
     */
    public Page<FrontPageListAllDTO> pageMyTaskAll(PageRequest page, Map<String, Object> terms) {
        try {
            long total = mapper.countMyTaskAll(terms);
            List<FrontPageListAllDTO> frontPageListFPDTOList = mapper.pageMyTaskAll(page, terms);
            return new PageImpl<FrontPageListAllDTO>(frontPageListFPDTOList, page, total);
        } catch (Exception e) {
            log.error("[CaseTaskService.pageMyTaskAll]调用失败,异常信息:" + e, e);
            throw new ServiceException("pageMyTaskAll.pageMyTaskFp", e);
        }
    }
    /**
     * 已办事项-数量
     * @param terms 条件
     */
    public CaseYbCountDTO countYbTaskAll(Map<String, Object> terms) {
        CaseYbCountDTO caseYbCountDTO = new CaseYbCountDTO();
        long ybDispatch = mapper.countYbDispatch(terms);
        long ybAccept = mapper.countYbAccept(terms);
        long ybClosed = mapper.countYbClosed(terms);
        long ybAudit = mapper.countYbAudit(terms);
        long ybSupervise = mapper.countYbSupervise(terms);
        caseYbCountDTO.setYbDispatch(ybDispatch);
        caseYbCountDTO.setYbAccept(ybAccept);
        caseYbCountDTO.setYbClosed(ybClosed);
        caseYbCountDTO.setYbAudit(ybAudit);
        caseYbCountDTO.setYbSupervise(ybSupervise);
        caseYbCountDTO.setYbMerge(0L);
        caseYbCountDTO.setAllYbTask(ybDispatch+ybAccept+ybClosed+ybAudit+ybSupervise);
        return caseYbCountDTO;
    }
    /**
     * 首页-查询待办任务-待/已分派
dyh-service/dyh-mediate/src/main/java/cn/huge/module/cases/utils/StatisticsTimeUtils.java
New file
@@ -0,0 +1,274 @@
package cn.huge.module.cases.utils;
import cn.huge.base.common.utils.DateUtils;
import cn.huge.base.common.utils.ObjectUtils;
import cn.huge.module.cases.domain.dto.CaseWorkStatisticsTimeDTO;
import com.alibaba.fastjson.JSON;
import java.time.*;
import java.time.format.DateTimeFormatter;
import java.time.temporal.TemporalAdjusters;
import java.util.*;
/**
 * 工作统计-时间计算类
 * @author zhouxiantao
 * @create 2025-04-23 11:48
 */
public class StatisticsTimeUtils {
    /**
     * 判断两个时间 1-按日统计,2-按月统计,3-按年统计
     * */
    public static String spanTime(Date startDate, Date endDate){
        Integer differDay = DateUtils.getDifferDay(startDate, endDate);
        if(differDay <= 31){
            return "1";
        }else if(differDay > 31 && differDay <= 365){
            return "2";
        }else if(differDay > 365){
            return "3";
        }
        return null;
    }
    /**
     * 填补缺少的时间
     * */
    public static List<CaseWorkStatisticsTimeDTO> dellStatisticsTime(List<CaseWorkStatisticsTimeDTO> caseWorkStatisticsTimeDTOS, Date startDate, Date endDate,String type) {
        List<CaseWorkStatisticsTimeDTO> resultList = new ArrayList<>();
        if("1".equals(type)){
            Integer differDay = DateUtils.getDifferDay(startDate, endDate);
            DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
            LocalDate startLocalDate = startDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
            LocalDate endLocalDate = endDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
            // 生成所有在 startDate 和 endDate 范围内的日期
            Set<LocalDate> allDatesInRange = new HashSet<>();
            LocalDate currentDate = startLocalDate;
            while (!currentDate.isAfter(endLocalDate)) {
                allDatesInRange.add(currentDate);
                currentDate = currentDate.plusDays(1);
            }
            // 将 caseWorkStatisticsTimeDTOs 中的日期转换为 LocalDate 并存储在 map 中
            Map<LocalDate, CaseWorkStatisticsTimeDTO> existingDatesMap = new HashMap<>();
            for (CaseWorkStatisticsTimeDTO dto : caseWorkStatisticsTimeDTOS) {
                LocalDate date = LocalDate.parse(dto.getDayStr(), formatter);
                existingDatesMap.put(date, dto);
            }
            // 确保每个日期都在范围内
            for (LocalDate date : allDatesInRange) {
                if (existingDatesMap.containsKey(date)) {
                    CaseWorkStatisticsTimeDTO caseWorkStatisticsTimeDTO = existingDatesMap.get(date);
                    String[] split = caseWorkStatisticsTimeDTO.getDayStr().split("-");
                    caseWorkStatisticsTimeDTO.setTimeStr(split[2]+"日");
                    caseWorkStatisticsTimeDTO.setTimeAllStr(split[0]+"年"+split[1]+"月"+split[2]+"日");
                    int i = Integer.valueOf(split[1]) * 100 + Integer.valueOf(split[2]);
                    caseWorkStatisticsTimeDTO.setSort(i);
                    resultList.add(caseWorkStatisticsTimeDTO);
                } else {
                    String format = date.format(formatter);
                    String[] split = format.split("-");
                    CaseWorkStatisticsTimeDTO caseWorkStatisticsTimeDTO = new CaseWorkStatisticsTimeDTO();
                    caseWorkStatisticsTimeDTO.setTimeStr(split[2]+"日");
                    caseWorkStatisticsTimeDTO.setTimeAllStr(split[0]+"年"+split[1]+"月"+split[2]+"日");
                    int i = Integer.valueOf(split[1]) * 100 + Integer.valueOf(split[2]);
                    caseWorkStatisticsTimeDTO.setSort(i);
                    resultList.add(caseWorkStatisticsTimeDTO);
                }
            }
            if(differDay <=7){
                Collections.sort(resultList, (o1, o2) -> Integer.compare(o1.getSort(), o2.getSort()));
               return resultList;
            }else{
                List<CaseWorkStatisticsTimeDTO> result1List = new ArrayList<>();
                Map<String, List<CaseWorkStatisticsTimeDTO>> stringListMap = groupByWeek(caseWorkStatisticsTimeDTOS);
                for (String week : stringListMap.keySet()) {
                    String[] split = week.split("=");
                    String[] startTime = split[0].split("-");
                    String[] endTime = split[1].split("-");
                    CaseWorkStatisticsTimeDTO caseWorkStatisticsTimeDTO = new CaseWorkStatisticsTimeDTO();
                    List<CaseWorkStatisticsTimeDTO> caseWorkStatisticsTimeDTOS1 = stringListMap.get(week);
                    for (CaseWorkStatisticsTimeDTO workStatisticsTimeDTO : caseWorkStatisticsTimeDTOS1) {
                        caseWorkStatisticsTimeDTO.setTotalNum(caseWorkStatisticsTimeDTO.getTotalNum()+workStatisticsTimeDTO.getTotalNum());
                        caseWorkStatisticsTimeDTO.setProcessNum(caseWorkStatisticsTimeDTO.getProcessNum()+workStatisticsTimeDTO.getProcessNum());
                        caseWorkStatisticsTimeDTO.setFinishNum(caseWorkStatisticsTimeDTO.getFinishNum()+workStatisticsTimeDTO.getFinishNum());
                        caseWorkStatisticsTimeDTO.setRejectNum(caseWorkStatisticsTimeDTO.getRejectNum()+workStatisticsTimeDTO.getRejectNum());
                        caseWorkStatisticsTimeDTO.setResolveNum(caseWorkStatisticsTimeDTO.getResolveNum()+workStatisticsTimeDTO.getResolveNum());
                        caseWorkStatisticsTimeDTO.setUnResolveNum(caseWorkStatisticsTimeDTO.getUnResolveNum()+workStatisticsTimeDTO.getUnResolveNum());
                        caseWorkStatisticsTimeDTO.setResolveingNum(caseWorkStatisticsTimeDTO.getResolveingNum()+workStatisticsTimeDTO.getResolveingNum());
                    }
                    caseWorkStatisticsTimeDTO.setTimeStr(startTime[2]+"-"+endTime[2]+"日");
                    caseWorkStatisticsTimeDTO.setTimeAllStr(startTime[0]+"年"+startTime[1]+"月"+startTime[2]+"-"+endTime[2]+"日");
                    int i = Integer.valueOf(startTime[1]) * 100 + Integer.valueOf(startTime[2]);
                    caseWorkStatisticsTimeDTO.setSort(i);
                    result1List.add(caseWorkStatisticsTimeDTO);
                }
                Collections.sort(result1List, (o1, o2) -> Integer.compare(o1.getSort(), o2.getSort()));
                return result1List;
            }
        }else if("2".equals(type)){
            int startYear = DateUtils.getYear(startDate);
            int endYear = DateUtils.getYear(endDate);
            int startMonth = DateUtils.getMonth(startDate);
            int endMonth = DateUtils.getMonth(endDate);
            Integer minMonth = startYear * 100 + startMonth;
            Integer maxMonth = endYear * 100 + endMonth;
            List<String> monthList = new ArrayList<>();
            Map<String, CaseWorkStatisticsTimeDTO> existingDatesMap = new HashMap<>();
            for (CaseWorkStatisticsTimeDTO caseWorkStatisticsTimeDTO : caseWorkStatisticsTimeDTOS) {
                existingDatesMap.put(caseWorkStatisticsTimeDTO.getMonthStr(), caseWorkStatisticsTimeDTO);
                monthList.add(caseWorkStatisticsTimeDTO.getMonthStr());
            }
            for (int i = minMonth; i <= maxMonth; i++){
                Integer year = i / 100;
                Integer month = i % 100;
                if(month == 0 || month > 12){
                    continue;
                }
                String timeStr = year+"-"+month;
                if(!monthList.contains(timeStr)){
                    CaseWorkStatisticsTimeDTO caseWorkStatisticsTimeDTO = new CaseWorkStatisticsTimeDTO();
                    caseWorkStatisticsTimeDTO.setTimeStr(month+"月");
                    caseWorkStatisticsTimeDTO.setTimeAllStr(year+"年"+month+"月");
                    caseWorkStatisticsTimeDTO.setSort(i);
                    resultList.add(caseWorkStatisticsTimeDTO);
                }else{
                    CaseWorkStatisticsTimeDTO caseWorkStatisticsTimeDTO = existingDatesMap.get(timeStr);
                    caseWorkStatisticsTimeDTO.setTimeStr(month+"月");
                    caseWorkStatisticsTimeDTO.setTimeAllStr(year+"年"+month+"月");
                    caseWorkStatisticsTimeDTO.setSort(i);
                    resultList.add(caseWorkStatisticsTimeDTO);
                }
            }
        }else {
            int minYear = DateUtils.getYear(startDate);
            int maxYear = DateUtils.getYear(endDate);
            List<String> yearList = new ArrayList<>();
            Map<String, CaseWorkStatisticsTimeDTO> existingDatesMap = new HashMap<>();
            for (CaseWorkStatisticsTimeDTO caseWorkStatisticsTimeDTO : caseWorkStatisticsTimeDTOS) {
                caseWorkStatisticsTimeDTO.setTimeStr(caseWorkStatisticsTimeDTO.getYearStr());
                existingDatesMap.put(caseWorkStatisticsTimeDTO.getYearStr(), caseWorkStatisticsTimeDTO);
                yearList.add(caseWorkStatisticsTimeDTO.getYearStr());
            }
            for (int i = minYear; i <= maxYear; i++){
                String timeStr = String.valueOf(i);
                if(!yearList.contains(timeStr)){
                    CaseWorkStatisticsTimeDTO caseWorkStatisticsTimeDTO = new CaseWorkStatisticsTimeDTO();
                    caseWorkStatisticsTimeDTO.setTimeStr(timeStr+"年");
                    caseWorkStatisticsTimeDTO.setTimeAllStr(timeStr+"年");
                    caseWorkStatisticsTimeDTO.setSort(i);
                    resultList.add(caseWorkStatisticsTimeDTO);
                }else{
                    CaseWorkStatisticsTimeDTO caseWorkStatisticsTimeDTO = existingDatesMap.get(timeStr);
                    caseWorkStatisticsTimeDTO.setTimeStr(timeStr+"年");
                    caseWorkStatisticsTimeDTO.setTimeAllStr(timeStr+"年");
                    caseWorkStatisticsTimeDTO.setSort(i);
                    resultList.add(caseWorkStatisticsTimeDTO);
                }
            }
        }
        Collections.sort(resultList, (o1, o2) -> Integer.compare(o1.getSort(), o2.getSort()));
        return resultList;
    }
    /**
     * 按周进行分组
     * */
    public static Map<String, List<CaseWorkStatisticsTimeDTO>> groupByWeek(List<CaseWorkStatisticsTimeDTO> caseWorkStatisticsTimeDTOs) {
        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        Map<String, List<CaseWorkStatisticsTimeDTO>> weeklyGroups = new HashMap<>();
        for (CaseWorkStatisticsTimeDTO dto : caseWorkStatisticsTimeDTOs) {
            LocalDate date = LocalDate.parse(dto.getDayStr(), formatter);
            LocalDate startOfWeek = date.with(TemporalAdjusters.previousOrSame(DayOfWeek.MONDAY));
            LocalDate endOfWeek = date.with(TemporalAdjusters.nextOrSame(DayOfWeek.SUNDAY));
            String weekKey = startOfWeek.format(formatter) + "=" + endOfWeek.format(formatter);
            weeklyGroups.computeIfAbsent(weekKey, k -> new ArrayList<>()).add(dto);
        }
        // 对每个周组内的记录按时间从小到大排序
        for (List<CaseWorkStatisticsTimeDTO> group : weeklyGroups.values()) {
            group.sort(Comparator.comparing(CaseWorkStatisticsTimeDTO::getDayStr));
        }
        System.out.println(JSON.toJSONString(weeklyGroups));
        return weeklyGroups;
    }
    public static boolean isStartAndEndOfYear(Date startDate, Date endDate) {
        LocalDate startLocalDate = startDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
        LocalDate endLocalDate = endDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
        // 判断 startDate 是否是某一年的第一天
        boolean isStartDateFirstDay = startLocalDate.equals(startLocalDate.with(TemporalAdjusters.firstDayOfYear()));
        // 判断 endDate 是否是某一年的最后一天
        boolean isEndDateLastDay = endLocalDate.equals(endLocalDate.with(TemporalAdjusters.lastDayOfYear()));
        return isStartDateFirstDay && isEndDateLastDay && startLocalDate.getYear() == endLocalDate.getYear();
    }
    public static boolean isStartAndEndOfMonth(Date startDate, Date endDate) {
        LocalDate startLocalDate = startDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
        LocalDate endLocalDate = endDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
        // 判断 startDate 是否是某个月的第一天
        boolean isStartDateFirstDay = startLocalDate.equals(startLocalDate.with(TemporalAdjusters.firstDayOfMonth()));
        // 判断 endDate 是否是某个月的最后一天
        boolean isEndDateLastDay = endLocalDate.equals(endLocalDate.with(TemporalAdjusters.lastDayOfMonth()));
        return isStartDateFirstDay && isEndDateLastDay && startLocalDate.getMonthValue() == endLocalDate.getMonthValue() && startLocalDate.getYear() == endLocalDate.getYear();
    }
    /**
     * 获取时间的上个月开始时间
     * */
    public static String getMomStartDate(Date startDate) {
        LocalDate startLocalDate = startDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
        YearMonth lastMonth = YearMonth.from(startLocalDate).minusMonths(1);
        LocalDate firstDayOfLastMonth = lastMonth.atDay(1);
        Date from = Date.from(firstDayOfLastMonth.atStartOfDay(ZoneId.systemDefault()).toInstant());
        String time = DateUtils.DateToString(from, DateUtils.YYYY_MM_DD);
        return time;
    }
    /**
     * 获取时间的上个月结束时间
     * */
    public static String getMomEndDate(Date startDate) {
        LocalDate startLocalDate = startDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate();
        YearMonth lastMonth = YearMonth.from(startLocalDate).minusMonths(1);
        LocalDate lastDayOfLastMonth = lastMonth.atEndOfMonth();
        Date from = Date.from(lastDayOfLastMonth.atTime(23, 59, 59).atZone(ZoneId.systemDefault()).toInstant());
        String time = DateUtils.DateToString(from, DateUtils.YYYY_MM_DD);
        return time;
    }
    /**
     * 获取时间的去年的时间
     * */
    public static String getYoyDate(Date startDate) {
        LocalDateTime startDateTime = startDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime();
        LocalDateTime lastYearSameDateTime = startDateTime.minusYears(1);
        Date from = Date.from(lastYearSameDateTime.atZone(ZoneId.systemDefault()).toInstant());
        String time = DateUtils.DateToString(from, DateUtils.YYYY_MM_DD);
        return time;
    }
    public static String calculateMomGrowthRate(int currentMonthValue, int previousMonthValue) {
        if (previousMonthValue == 0) {
            return "0";
        }
        double rate = ((double) (currentMonthValue - previousMonthValue) / previousMonthValue) * 100;
        return String.format("%.1f", rate);
    }
    public static String calculateMomGrowthRate(String currentStr, String previousStr) {
        if(ObjectUtils.isEmpty(currentStr)){
            return "0";
        }
        double previousMonthValue = 0;
        if(ObjectUtils.isNotEmpty(previousStr) && !"null".equals(previousStr)){
            previousMonthValue = Double.valueOf(previousStr);
        }
        double currentMonthValue = Double.valueOf(currentStr);
        if(currentMonthValue == 0){
            return "0";
        }
        double rate = ((double) (currentMonthValue - previousMonthValue) / previousMonthValue) * 100;
        return String.format("%.1f", rate);
    }
}