From f4e5da604604308b9f754de7e863c180fcedd8c9 Mon Sep 17 00:00:00 2001 From: xusd <330628789@qq.com> Date: Tue, 24 Jun 2025 21:03:12 +0800 Subject: [PATCH] fix:超时办件优化 --- dyh-service/dyh-mediate/src/main/java/cn/huge/module/analysis/dao/mapper/xml/AnalysisMapper.xml | 505 ++++++++++++++++++++++++++++++++++++++------------------ 1 files changed, 342 insertions(+), 163 deletions(-) diff --git a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/analysis/dao/mapper/xml/AnalysisMapper.xml b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/analysis/dao/mapper/xml/AnalysisMapper.xml index b174179..41c8515 100644 --- a/dyh-service/dyh-mediate/src/main/java/cn/huge/module/analysis/dao/mapper/xml/AnalysisMapper.xml +++ b/dyh-service/dyh-mediate/src/main/java/cn/huge/module/analysis/dao/mapper/xml/AnalysisMapper.xml @@ -29,13 +29,14 @@ t1.road, </if> <if test="terms.queRoad != null and terms.queRoad !=''"> - (case when t1.village_name = '' or t1.village_name is null then '本级' else t1.village_name end)as groupName, + (case when t1.village_name = '' or t1.village_name is null then '本级' else t1.village_name end)as + groupName, t1.village as groupCode, t1.village, </if> -<!-- <if test="terms.unitIds != null and terms.unitIds !=''">--> -<!-- t1.unit_name as groupName,--> -<!-- </if>--> + <!-- <if test="terms.unitIds != null and terms.unitIds !=''">--> + <!-- t1.unit_name as groupName,--> + <!-- </if>--> </if> </sql> @@ -54,9 +55,9 @@ <if test="terms.queRoad != null and terms.queRoad !=''"> (case when t1.village = '' or t1.village is null then '本级' else t1.village end) </if> -<!-- <if test="terms.unitIds != null and terms.unitIds !=''">--> -<!-- t1.id--> -<!-- </if>--> + <!-- <if test="terms.unitIds != null and terms.unitIds !=''">--> + <!-- t1.id--> + <!-- </if>--> </if> </sql> @@ -101,16 +102,20 @@ <if test="terms.unitIds != null and terms.unitIds !=''"> and t1.id in(${terms.unitIds}) </if> + </if> </sql> <!-- 统计任务平均时长 --> <select id="statisticsAVG" resultType="cn.huge.module.analysis.domain.dto.AvgDurationDTO"> - select AVG(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') and t2.status = 2 then ROUND(DATEDIFF(SECOND, t2.create_time, t2.handle_time) / 3600.0, 2) end) as fp, - AVG(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL') and t2.status = 2 then ROUND(DATEDIFF(SECOND, t2.create_time, t2.handle_time) / 3600.0, 2) end) as sl, - AVG(case when (t2.node_id = 'BLFK' and t2.status = '2') and t2.status = 2 then ROUND(DATEDIFF(SECOND, t2.create_time, t2.handle_time) / 3600.0, 2) end) as blz - from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.handle_unit_id - left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id + select AVG(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = + 'DFP') and t2.status = 2 then ROUND(DATEDIFF(SECOND, t2.create_time, t2.handle_time) / 3600.0, 2) end) as fp, + AVG(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL') + and t2.status = 2 then ROUND(DATEDIFF(SECOND, t2.create_time, t2.handle_time) / 3600.0, 2) end) as sl, + AVG(case when (t2.node_id = 'BLFK' and t2.status = '2') and t2.status = 2 then ROUND(DATEDIFF(SECOND, + t2.create_time, t2.handle_time) / 3600.0, 2) end) as blz + from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.handle_unit_id + left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id where t1.delete_status = 0 and t2.delete_status = 0 @@ -122,29 +127,59 @@ <select id="statisticsGroupAVG" resultType="cn.huge.module.analysis.domain.dto.AvgDurationGroupDTO"> select <include refid="selectPart"/> - AVG(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') and t2.status = 2 then ROUND(DATEDIFF(SECOND, t2.create_time, t2.handle_time) / 3600.0, 2) end) as fp, - count(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') and t2.status = 2 then t2.id end) as fps, - AVG(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL') and t2.status = 2 then ROUND(DATEDIFF(SECOND, t2.create_time, t2.handle_time) / 3600.0, 2) end) as sl, - count(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL') and t2.status = 2 then t2.id end) as sls, - AVG(case when (t2.node_id = 'BLFK' and t2.status = '2') and t2.status = 2 then ROUND(DATEDIFF(SECOND, t2.create_time, t2.handle_time) / 3600.0, 2) end) as blz, + AVG(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') + and t2.status = 2 then ROUND(DATEDIFF(SECOND, t2.create_time, t2.handle_time) / 3600.0, 2) end) as fp, + count(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') + and t2.status = 2 then t2.id end) as fps, + AVG(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL') + and t2.status = 2 then ROUND(DATEDIFF(SECOND, t2.create_time, t2.handle_time) / 3600.0, 2) end) as sl, + count(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL') + and t2.status = 2 then t2.id end) as sls, + AVG(case when (t2.node_id = 'BLFK' and t2.status = '2') and t2.status = 2 then ROUND(DATEDIFF(SECOND, + t2.create_time, t2.handle_time) / 3600.0, 2) end) as blz, count(case when (t2.node_id = 'BLFK' and t2.status = '2') and t2.status = 2 then t2.id end) as bls from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.handle_unit_id - left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id + left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id where t1.delete_status = 0 and t2.delete_status = 0 and t3.delete_status = 0 <include refid="statisticsAVG-wherePart"/> - group by <include refid="groupPart"/> + group by + <include refid="groupPart"/> </select> <!-- 分组统计任务 --> <select id="statisticsQuantity" resultType="cn.huge.module.analysis.domain.dto.StatisticsGroupDTO"> select - count(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) then t2.id end) as fpcs, - count(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL') and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) then t2.id end) as slcs + <if test="terms.taskStatus != null and terms.taskStatus == 1 "> + count(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') + and ((t2.overtime_status = 1 and t2.status = 2)) then t2.id end) as + fpcs, + count(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL') + and ((t2.overtime_status = 1 and t2.status = 2)) then t2.id end) as + slcs + </if> + <if test="terms.taskStatus != null and terms.taskStatus == 0"> + count(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') + and ((sysdate > expire_time and t2.status = 1)) then t2.id end) as + fpcs, + count(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL') + and ((sysdate > expire_time and t2.status = 1)) then t2.id end) as + slcs + </if> + <if test="terms.taskStatus == null or terms.taskStatus ==''"> + count(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') + and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) then t2.id end) as + fpcs, + count(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL') + and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) then t2.id end) as + slcs + </if> + + from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id - left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id + left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id where t1.delete_status = 0 and t2.delete_status = 0 @@ -155,10 +190,14 @@ <!-- 首页-统计超时任务 --> <select id="homeStatisticsQuantity" resultType="cn.huge.module.analysis.domain.dto.StatisticsGroupDTO"> select - count(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) then t2.id end) as fpcs, - count(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL') and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) then t2.id end) as slcs + count(case when (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') + and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) then t2.id end) as + fpcs, + count(case when (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL') + and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) then t2.id end) as + slcs from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id - left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id + left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id where t1.delete_status = 0 and t2.delete_status = 0 @@ -212,7 +251,8 @@ from ( select ROUND(DATEDIFF(SECOND, t2.appear_time, t2.audit_time) / 3600.0, 2) as usetime_hour - from dyh_ct_unit t1 left join dyh_case_appear t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on t2.case_id = t3.id + from dyh_ct_unit t1 left join dyh_case_appear t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on + t2.case_id = t3.id where t2.apply_status = 1 <if test="terms != null"> <if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''"> @@ -223,7 +263,8 @@ </if> union all select ROUND(DATEDIFF(SECOND, t2.apply_time, t2.audit_time) / 3600.0, 2) as usetime_hour - from dyh_ct_unit t1 left join dyh_case_assist_apply t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on t2.case_id = t3.id + from dyh_ct_unit t1 left join dyh_case_assist_apply t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on + t2.case_id = t3.id where t2.apply_status = 1 <if test="terms != null"> <if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''"> @@ -234,7 +275,8 @@ </if> union all select ROUND(DATEDIFF(SECOND, t2.return_time, t2.audit_time) / 3600.0, 2) as usetime_hour - from dyh_ct_unit t1 left join dyh_case_return t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on t2.case_id = t3.id + from dyh_ct_unit t1 left join dyh_case_return t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on + t2.case_id = t3.id where t2.return_status = 1 <if test="terms != null"> <if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''"> @@ -245,7 +287,8 @@ </if> union all select ROUND(DATEDIFF(SECOND, t2.apply_time, t2.audit_time) / 3600.0, 2) as usetime_hour - from dyh_ct_unit t1 left join dyh_case_windup_apply t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on t2.case_id = t3.id + from dyh_ct_unit t1 left join dyh_case_windup_apply t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on + t2.case_id = t3.id where t2.apply_status = 1 <if test="terms != null"> <if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''"> @@ -261,12 +304,14 @@ <select id="statisticsApplyGroup" resultType="cn.huge.module.analysis.domain.dto.AvgDurationGroupDTO"> select <include refid="selectPart"/> - avg(usetime_hour) as sp, - count(distinct ownerId) as sps + avg(usetime_hour) as sp, + count(distinct ownerId) as sps from ( - select ROUND(DATEDIFF(SECOND, t2.appear_time, t2.audit_time) / 3600.0, 2) as usetime_hour, t2.id as ownerId, t1.* - from dyh_ct_unit t1 left join dyh_case_appear t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on t2.case_id = t3.id + select ROUND(DATEDIFF(SECOND, t2.appear_time, t2.audit_time) / 3600.0, 2) as usetime_hour, t2.id as ownerId, + t1.* + from dyh_ct_unit t1 left join dyh_case_appear t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on + t2.case_id = t3.id where t2.apply_status = 1 and t2.audit_time != t2.appear_time <if test="terms != null"> <if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''"> @@ -277,7 +322,8 @@ </if> union all select ROUND(DATEDIFF(SECOND, t2.apply_time, t2.audit_time) / 3600.0, 2) as usetime_hour, t2.id as ownerId, t1.* - from dyh_ct_unit t1 left join dyh_case_assist_apply t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on t2.case_id = t3.id + from dyh_ct_unit t1 left join dyh_case_assist_apply t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on + t2.case_id = t3.id where t2.apply_status = 1 and t2.audit_time != t2.apply_time <if test="terms != null"> <if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''"> @@ -287,8 +333,10 @@ <include refid="statisticsApplyAVG-wherePart"/> </if> union all - select ROUND(DATEDIFF(SECOND, t2.return_time, t2.audit_time) / 3600.0, 2) as usetime_hour, t2.id as ownerId, t1.* - from dyh_ct_unit t1 left join dyh_case_return t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on t2.case_id = t3.id + select ROUND(DATEDIFF(SECOND, t2.return_time, t2.audit_time) / 3600.0, 2) as usetime_hour, t2.id as ownerId, + t1.* + from dyh_ct_unit t1 left join dyh_case_return t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on + t2.case_id = t3.id where t2.return_status = 1 and t2.audit_time!= t2.return_time <if test="terms != null"> <if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''"> @@ -299,7 +347,8 @@ </if> union all select ROUND(DATEDIFF(SECOND, t2.apply_time, t2.audit_time) / 3600.0, 2) as usetime_hour, t2.id as ownerId, t1.* - from dyh_ct_unit t1 left join dyh_case_windup_apply t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on t2.case_id = t3.id + from dyh_ct_unit t1 left join dyh_case_windup_apply t2 on t1.id = t2.audit_unit_id left join dyh_case_info t3 on + t2.case_id = t3.id where t2.apply_status = 1 and t2.audit_time != t2.apply_time <if test="terms != null"> <if test="terms.closeStart != null and terms.closeStart !='' and terms.closeEnd != null and terms.closeEnd !=''"> @@ -309,7 +358,8 @@ <include refid="statisticsApplyAVG-wherePart"/> </if> ) t1 - group by <include refid="groupPart"/> + group by + <include refid="groupPart"/> </select> <!-- 条件 --> @@ -354,12 +404,14 @@ <if test="terms.unitIds != null and terms.unitIds !=''"> and t1.id in(${terms.unitIds}) </if> + </sql> <!-- 统计督办平均时长 --> <select id="statisticsSuperviseAVG" resultType="cn.huge.module.analysis.domain.dto.AvgDurationDTO"> select AVG(ROUND(DATEDIFF(SECOND, t2.sup_time, t2.reply_time) / 3600.0, 2)) as db - from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id left join dyh_case_info t3 on t2.case_id = t3.id + from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id left join dyh_case_info t3 on + t2.case_id = t3.id where <include refid="statisticsSuperviseAVG-wherePart"/> and t2.sup_status = 1 @@ -367,20 +419,34 @@ <!-- 分组统计督办平均时长 --> <select id="statisticsSuperviseGroup" resultType="cn.huge.module.analysis.domain.dto.AvgDurationGroupDTO"> - select <include refid="selectPart"/> - AVG(ROUND(DATEDIFF(SECOND, t2.sup_time, t2.reply_time) / 3600.0, 2)) as db, count(case when sup_status = 1 then t2.id end ) as hfs - from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id left join dyh_case_info t3 on t2.case_id = t3.id + select + <include refid="selectPart"/> + AVG(ROUND(DATEDIFF(SECOND, t2.sup_time, t2.reply_time) / 3600.0, 2)) as db, count(case when sup_status = 1 then + t2.id end ) as hfs + from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id left join dyh_case_info t3 on + t2.case_id = t3.id where <include refid="statisticsSuperviseAVG-wherePart"/> and t2.sup_status = 1 - group by <include refid="groupPart"/> + group by + <include refid="groupPart"/> </select> <!-- 分组查询超时数量 --> <select id="statisticsSuperviseQuantity" resultType="cn.huge.module.analysis.domain.dto.StatisticsGroupDTO"> select - count(case when ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1')) then t2.id end) as dbcs - from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id left join dyh_case_info t3 on t2.case_id = t3.id + <if test="terms.taskStatus != null and terms.taskStatus == 1 "> + count(case when (t2.overtime_status = '1') then t2.id end) as dbcs + </if> + <if test="terms.taskStatus != null and terms.taskStatus == 0"> + count(case when (sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) then t2.id end) as dbcs + </if> + <if test="terms.taskStatus == null or terms.taskStatus ==''"> + count(case when ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or + (t2.overtime_status = '1')) then t2.id end) as dbcs + </if> + from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id left join dyh_case_info t3 on + t2.case_id = t3.id where <include refid="statisticsSuperviseAVG-wherePart"/> </select> @@ -388,14 +454,17 @@ <!-- 首页-查询超时数量 --> <select id="homeStatisticsSuperviseQuantity" resultType="cn.huge.module.analysis.domain.dto.StatisticsGroupDTO"> select - count(case when ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1')) then t2.id end) as dbcs - from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id left join dyh_case_info t3 on t2.case_id = t3.id + count(case when ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or + (t2.overtime_status = '1')) then t2.id end) as dbcs + from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id left join dyh_case_info t3 on + t2.case_id = t3.id where <include refid="statisticsSuperviseAVG-wherePart"/> </select> <!-- 统计重复来访案件数量 --> - <select id="countRepeatedCases" resultType="cn.huge.module.analysis.domain.dto.CountRepeateDto" parameterType="cn.huge.module.analysis.domain.vo.CountRepeateVo"> + <select id="countRepeatedCases" resultType="cn.huge.module.analysis.domain.dto.CountRepeateDto" + parameterType="cn.huge.module.analysis.domain.vo.CountRepeateVo"> WITH RepeatedPersons AS ( SELECT true_name, mobile, certi_no FROM gzdyh_test.dyh_case_person @@ -408,7 +477,8 @@ MinCaseIds AS ( SELECT rp.true_name, rp.mobile, rp.certi_no, MIN(p.case_id) as min_case_id FROM RepeatedPersons rp - JOIN gzdyh_test.dyh_case_person p ON rp.true_name = p.true_name AND rp.mobile = p.mobile AND rp.certi_no = p.certi_no + JOIN gzdyh_test.dyh_case_person p ON rp.true_name = p.true_name AND rp.mobile = p.mobile AND rp.certi_no = + p.certi_no GROUP BY rp.true_name, rp.mobile, rp.certi_no ), FilteredCases AS ( @@ -478,15 +548,15 @@ GROUP BY case_type_first_name </if> <if test="groupByArea != null and groupByArea != ''"> -<!-- AND road_name is not NULL--> + <!-- AND road_name is not NULL--> GROUP BY area_name </if> <if test="groupByRoad != null and groupByRoad != ''"> -<!-- AND road_name is not NULL--> + <!-- AND road_name is not NULL--> GROUP BY road_name </if> <if test="groupByTime != null and groupByTime != ''"> - GROUP BY groupByType + GROUP BY groupByType </if> </select> @@ -495,31 +565,51 @@ select COUNT(1) from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id - left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id + left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id where t1.delete_status = 0 and t2.delete_status = 0 and t3.delete_status = 0 <include refid="statisticsAVG-wherePart"/> - and (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) + and (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') + <if test="terms.taskStatus != null and terms.taskStatus == 1 "> + and (t2.overtime_status = 1 and t2.status = 2) + </if> + <if test="terms.taskStatus != null and terms.taskStatus == 0"> + and (sysdate > expire_time and t2.status = 1) + </if> + <if test="terms.taskStatus == null or terms.taskStatus ==''"> + and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) + </if> </select> <!-- 查询分派超时案件 --> <select id="listFPQuantity" resultType="cn.huge.module.analysis.domain.dto.TimeoutTaskInfoDTO"> - select t2.case_id as caseId, t2.id as caseTaskId, t2.create_time as turnaroundTime, t2.node_name as nodeName, (case t2.status when 1 then 0 when 2 then 1 end) as taskStatus, - (case t2.status when 2 then t2.overtime_hour when 1 then DATEDIFF(hh, t2.expire_time, sysdate) end) as timeLimit, + select t2.case_id as caseId, t2.id as caseTaskId, t2.create_time as turnaroundTime, t2.node_name as nodeName, + (case t2.status when 1 then 0 when 2 then 1 end) as taskStatus, + (case t2.status when 2 then t2.overtime_hour when 1 then DATEDIFF(hh, t2.expire_time, sysdate) end) as + timeLimit, t3.case_level as caseGrade, t3.canal_name as caseSource, t4.mediator as mediator, t3.status_name as statusName, concat_ws('', ifnull(t3.case_type_first_name, ''), '/' , ifnull(t3.case_type_name, '')) as caseType, concat(t3.que_area_name, t3.que_road_name) as queAddress, t2.cande_unit_name as candeUnitName, (select count(1) from dyh_case_supervise where case_id = t2.case_id) as superviseCount from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id - left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id + left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id where t1.delete_status = 0 and t2.delete_status = 0 and t3.delete_status = 0 <include refid="statisticsAVG-wherePart"/> - and (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) + and (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') + <if test="terms.taskStatus != null and terms.taskStatus == 1 "> + and (t2.overtime_status = 1 and t2.status = 2) + </if> + <if test="terms.taskStatus != null and terms.taskStatus == 0"> + and (sysdate > expire_time and t2.status = 1) + </if> + <if test="terms.taskStatus == null or terms.taskStatus ==''"> + and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) + </if> <if test="page.sort != null"> <foreach collection="page.sort" item="s" index="index" separator="," open="order by "> isnull(${s.property}), ${s.property} ${s.direction} @@ -536,7 +626,7 @@ select COUNT(1) from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id - left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id + left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id where t1.delete_status = 0 and t2.delete_status = 0 @@ -544,19 +634,29 @@ <include refid="statisticsAVG-wherePart"/> and (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL') - and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1) ) + <if test="terms.taskStatus != null and terms.taskStatus == 1 "> + and (t2.overtime_status = 1 and t2.status = 2) + </if> + <if test="terms.taskStatus != null and terms.taskStatus == 0"> + and (sysdate > expire_time and t2.status = 1) + </if> + <if test="terms.taskStatus == null or terms.taskStatus ==''"> + and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) + </if> </select> <!-- 查询受理超时案件 --> <select id="listSLQuantity" resultType="cn.huge.module.analysis.domain.dto.TimeoutTaskInfoDTO"> - select t2.case_id as caseId, t2.id as caseTaskId,t2.create_time as turnaroundTime, t2.node_name as nodeName, (case t2.status when 1 then 0 when 2 then 1 end) as taskStatus, - (case t2.status when 2 then t2.overtime_hour when 1 then DATEDIFF(hh, t2.expire_time, sysdate) end) as timeLimit, + select t2.case_id as caseId, t2.id as caseTaskId,t2.create_time as turnaroundTime, t2.node_name as nodeName, + (case t2.status when 1 then 0 when 2 then 1 end) as taskStatus, + (case t2.status when 2 then t2.overtime_hour when 1 then DATEDIFF(hh, t2.expire_time, sysdate) end) as + timeLimit, t3.case_level as caseGrade, t3.canal_name as caseSource, t4.mediator as mediator, t3.status_name as statusName, concat_ws('', ifnull(t3.case_type_first_name, ''), '/' , ifnull(t3.case_type_name, '')) as caseType, concat(t3.que_area_name, t3.que_road_name) as queAddress, t2.cande_unit_name as candeUnitName, (select count(1) from dyh_case_supervise where case_id = t2.case_id) as superviseCount from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id - left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id + left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id where t1.delete_status = 0 and t2.delete_status = 0 @@ -564,7 +664,15 @@ <include refid="statisticsAVG-wherePart"/> and (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL') - and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) + <if test="terms.taskStatus != null and terms.taskStatus == 1 "> + and (t2.overtime_status = 1 and t2.status = 2) + </if> + <if test="terms.taskStatus != null and terms.taskStatus == 0"> + and (sysdate > expire_time and t2.status = 1) + </if> + <if test="terms.taskStatus == null or terms.taskStatus ==''"> + and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) + </if> <if test="page.sort != null"> <foreach collection="page.sort" item="s" index="index" separator="," open="order by "> isnull(${s.property}), ${s.property} ${s.direction} @@ -581,25 +689,42 @@ select COUNT(1) from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id - left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id + left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id where <include refid="statisticsSuperviseAVG-wherePart"/> - and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1')) + <if test="terms.taskStatus != null and terms.taskStatus == 1 "> + and (t2.overtime_status = '1') + </if> + <if test="terms.taskStatus != null and terms.taskStatus == 0"> + and (sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) + </if> + <if test="terms.taskStatus == null or terms.taskStatus ==''"> + and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1')) + </if> </select> <!-- 查询督办超时案件 --> <select id="listDBQuantity" resultType="cn.huge.module.analysis.domain.dto.TimeoutTaskInfoDTO"> select t2.case_id as caseId, t2.sup_time as turnaroundTime, '督办回复' as nodeName, t2.sup_status as taskStatus, - (case t2.sup_status when 1 then t2.overtime_hour when 0 then DATEDIFF(hh, DATEADD(hour, t2.reply_term, t2.sup_time), sysdate) end) as timeLimit, - t3.case_level as caseGrade,t3.canal_name as caseSource, t4.mediator as mediator, t3.status_name as statusName, - concat_ws('', ifnull(t3.case_type_first_name, ''), '/' , ifnull(t3.case_type_name, '')) as caseType, - concat(t3.que_area_name, t3.que_road_name) as queAddress, t2.quilt_unit_name as candeUnitName, - (select count(1) from dyh_case_supervise where case_id = t2.case_id) as superviseCount + (case t2.sup_status when 1 then t2.overtime_hour when 0 then DATEDIFF(hh, DATEADD(hour, t2.reply_term, + t2.sup_time), sysdate) end) as timeLimit, + t3.case_level as caseGrade,t3.canal_name as caseSource, t4.mediator as mediator, t3.status_name as statusName, + concat_ws('', ifnull(t3.case_type_first_name, ''), '/' , ifnull(t3.case_type_name, '')) as caseType, + concat(t3.que_area_name, t3.que_road_name) as queAddress, t2.quilt_unit_name as candeUnitName, + (select count(1) from dyh_case_supervise where case_id = t2.case_id) as superviseCount from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id - left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id + left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id where <include refid="statisticsSuperviseAVG-wherePart"/> - and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1')) + <if test="terms.taskStatus != null and terms.taskStatus == 1 "> + and (t2.overtime_status = '1') + </if> + <if test="terms.taskStatus != null and terms.taskStatus == 0"> + and (sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) + </if> + <if test="terms.taskStatus == null or terms.taskStatus ==''"> + and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1')) + </if> <if test="page.sort != null"> <foreach collection="page.sort" item="s" index="index" separator="," open="order by "> isnull(${s.property}), ${s.property} ${s.direction} @@ -615,60 +740,97 @@ <select id="countAllQuantity" resultType="java.lang.Long"> select sum(zs) from( - select - COUNT(1) as zs - from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id - left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id - where - t1.delete_status = 0 - and t2.delete_status = 0 - and t3.delete_status = 0 - <include refid="statisticsAVG-wherePart"/> - and((t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') - or (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL')) - and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) - union - select - COUNT(1) as zs - from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id - left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id - where + select + COUNT(1) as zs + from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id + left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id + where + t1.delete_status = 0 + and t2.delete_status = 0 + and t3.delete_status = 0 + <include refid="statisticsAVG-wherePart"/> + and((t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') + or (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL')) + <if test="terms.taskStatus != null and terms.taskStatus == 1 "> + and (t2.overtime_status = 1 and t2.status = 2) + </if> + <if test="terms.taskStatus != null and terms.taskStatus == 0"> + and (sysdate > expire_time and t2.status = 1) + </if> + <if test="terms.taskStatus == null or terms.taskStatus ==''"> + and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) + </if> + union + select + COUNT(1) as zs + from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id + left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id + where <include refid="statisticsSuperviseAVG-wherePart"/> - and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1')) - ) + <if test="terms.taskStatus != null and terms.taskStatus == 1 "> + and (t2.overtime_status = '1') + </if> + <if test="terms.taskStatus != null and terms.taskStatus == 0"> + and (sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) + </if> + <if test="terms.taskStatus == null or terms.taskStatus ==''"> + and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = + '1')) + </if>) </select> <!-- 查询督办超时案件 --> <select id="listAllQuantity" resultType="cn.huge.module.analysis.domain.dto.TimeoutTaskInfoDTO"> select * from( - select t2.case_id as caseId, t2.id as caseTaskId, t2.create_time as turnaroundTime, t2.node_name as nodeName, (case t2.status when 1 then 0 when 2 then 1 end) as taskStatus, - (case t2.status when 2 then t2.overtime_hour when 1 then DATEDIFF(hh, t2.expire_time, sysdate) end) as timeLimit, - t3.case_level as caseGrade, t3.canal_name as caseSource, t4.mediator as mediator, t3.status_name as statusName, - concat_ws('', ifnull(t3.case_type_first_name, ''), '/' , ifnull(t3.case_type_name, '')) as caseType, - concat(t3.que_area_name, t3.que_road_name) as queAddress, t2.cande_unit_name as candeUnitName, - (select count(1) from dyh_case_supervise where case_id = t2.case_id) as superviseCount - from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id - left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id - where - t1.delete_status = 0 - and t2.delete_status = 0 - and t3.delete_status = 0 - <include refid="statisticsAVG-wherePart"/> - and ((t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') - or (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL')) + select t2.case_id as caseId, t2.id as caseTaskId, t2.create_time as turnaroundTime, t2.node_name as nodeName, + (case t2.status when 1 then 0 when 2 then 1 end) as taskStatus, + (case t2.status when 2 then t2.overtime_hour when 1 then DATEDIFF(hh, t2.expire_time, sysdate) end) as + timeLimit, + t3.case_level as caseGrade, t3.canal_name as caseSource, t4.mediator as mediator, t3.status_name as statusName, + concat_ws('', ifnull(t3.case_type_first_name, ''), '/' , ifnull(t3.case_type_name, '')) as caseType, + concat(t3.que_area_name, t3.que_road_name) as queAddress, t2.cande_unit_name as candeUnitName, + (select count(1) from dyh_case_supervise where case_id = t2.case_id) as superviseCount + from dyh_ct_unit t1 left join dyh_case_task t2 on t1.id = t2.cande_unit_id + left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id + where + t1.delete_status = 0 + and t2.delete_status = 0 + and t3.delete_status = 0 + <include refid="statisticsAVG-wherePart"/> + and ((t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') + or (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL')) + <if test="terms.taskStatus != null and terms.taskStatus == 1 "> + and (t2.overtime_status = 1 and t2.status = 2) + </if> + <if test="terms.taskStatus != null and terms.taskStatus == 0"> + and (sysdate > expire_time and t2.status = 1) + </if> + <if test="terms.taskStatus == null or terms.taskStatus ==''"> and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) - union all - select t2.case_id as caseId, null as caseTaskId, t2.sup_time as turnaroundTime, '督办回复' as nodeName, t2.sup_status as taskStatus, - (case t2.sup_status when 1 then t2.overtime_hour when 0 then DATEDIFF(hh, DATEADD(hour, t2.reply_term, t2.sup_time), sysdate) end) as timeLimit, - t3.case_level as caseGrade,t3.canal_name as caseSource, t4.mediator as mediator, t3.status_name as statusName, - concat_ws('', ifnull(t3.case_type_first_name, ''), '/' , ifnull(t3.case_type_name, '')) as caseType, - concat(t3.que_area_name, t3.que_road_name) as queAddress, t2.quilt_unit_name as candeUnitName, - (select count(1) from dyh_case_supervise where case_id = t2.case_id) as superviseCount - from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id - left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id - where - <include refid="statisticsSuperviseAVG-wherePart"/> - and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1')) + </if> + union all + select t2.case_id as caseId, null as caseTaskId, t2.sup_time as turnaroundTime, '督办回复' as nodeName, + t2.sup_status as taskStatus, + (case t2.sup_status when 1 then t2.overtime_hour when 0 then DATEDIFF(hh, DATEADD(hour, t2.reply_term, + t2.sup_time), sysdate) end) as timeLimit, + t3.case_level as caseGrade,t3.canal_name as caseSource, t4.mediator as mediator, t3.status_name as statusName, + concat_ws('', ifnull(t3.case_type_first_name, ''), '/' , ifnull(t3.case_type_name, '')) as caseType, + concat(t3.que_area_name, t3.que_road_name) as queAddress, t2.quilt_unit_name as candeUnitName, + (select count(1) from dyh_case_supervise where case_id = t2.case_id) as superviseCount + from dyh_ct_unit t1 left join dyh_case_supervise t2 on t1.id = t2.quilt_unit_id + left join dyh_case_info t3 on t2.case_id = t3.id left join dyh_case_info_unfold t4 on t3.id = t4.id + where + <include refid="statisticsSuperviseAVG-wherePart"/> + <if test="terms.taskStatus != null and terms.taskStatus == 1 "> + and (t2.overtime_status = '1') + </if> + <if test="terms.taskStatus != null and terms.taskStatus == 0"> + and (sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) + </if> + <if test="terms.taskStatus == null or terms.taskStatus ==''"> + and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = + '1')) + </if> ) <if test="page.sort != null"> <foreach collection="page.sort" item="s" index="index" separator="," open="order by "> @@ -679,6 +841,7 @@ order by isnull(t2.sup_time), t2.sup_time desc </if> limit #{page.offset}, #{page.size} + </select> <sql id="statisticsCirculation-wherePart"> @@ -730,18 +893,19 @@ count(distinct case when t3.zxsl_status = 1 then t4.id end) as zxsl, count(distinct case when t3.zxsl_status = 0 and (t4.node_id = 'JAGD' or t4.node_id = 'BLFK' or t4.node_id = 'JASH' or t4.node_id = 'JASH_EJ' or t4.node_id = 'JASH_YJ') then t4.id end) as lzsl, --- count(distinct case when t3.zxsl_status = 0 and (((t4.node_id = 'ZJ_DFP' or t4.node_id = 'QJ_DFP' --- or t4.node_id = 'SJ_DFP' or t4.node_id = 'DFP' or t4.node_id = 'QJ_DSL' or t4.node_id = 'SJ_DSL' --- or t4.node_id = 'DSL' or t4.node_id = 'ZJ_DSL')and t4.handle_result !=3) --- or t4.node_id = 'SJ_SBSH' --- or t4.node_id = 'SJ_HTSH' or t4.node_id = 'QJ_HTSH' or t4.node_id = 'QJ_SBSH' or t4.node_id = 'ZJ_HTSH' --- or t4.node_id = 'JASQ' or t4.node_id = 'HTSH' --- ) then t4.id end) as lzz, + -- count(distinct case when t3.zxsl_status = 0 and (((t4.node_id = 'ZJ_DFP' or t4.node_id = 'QJ_DFP' + -- or t4.node_id = 'SJ_DFP' or t4.node_id = 'DFP' or t4.node_id = 'QJ_DSL' or t4.node_id = 'SJ_DSL' + -- or t4.node_id = 'DSL' or t4.node_id = 'ZJ_DSL')and t4.handle_result !=3) + -- or t4.node_id = 'SJ_SBSH' + -- or t4.node_id = 'SJ_HTSH' or t4.node_id = 'QJ_HTSH' or t4.node_id = 'QJ_SBSH' or t4.node_id = 'ZJ_HTSH' + -- or t4.node_id = 'JASQ' or t4.node_id = 'HTSH' + -- ) then t4.id end) as lzz, count(distinct case when (t3.zxsl_status = 0 and (t4.node_id = 'ZJ_DFP' or t4.node_id = 'QJ_DFP' or t4.node_id = 'SJ_DFP' or t4.node_id = 'DFP' or t4.node_id = 'QJ_DSL' or t4.node_id = 'SJ_DSL' or t4.node_id = 'DSL' or t4.node_id = 'ZJ_DSL')and t4.handle_result =3) then t4.id end) as bysl from - dyh_ct_unit t1 left join dyh_case_info_unfold t2 on t2.belong_unit_id = t1.id left join dyh_case_info t3 on t2.id = t3.id + dyh_ct_unit t1 left join dyh_case_info_unfold t2 on t2.belong_unit_id = t1.id left join dyh_case_info t3 on + t2.id = t3.id left join(SELECT case_id, node_id, create_time, cande_unit_id, id, status,handle_result FROM ( SELECT case_id, node_id, create_time, cande_unit_id, id, status,handle_result, @@ -752,7 +916,8 @@ group by s.case_id) t4 on t2.id = t4.case_id where t1.delete_status = 0 and t3.delete_status = 0 <include refid="statisticsCirculation-wherePart"/> - group by <include refid="groupPart"/> + group by + <include refid="groupPart"/> </select> <!-- 分组查询字段 --> @@ -829,10 +994,10 @@ village as code, 'queVillage' as region </if> -<!-- <if test="terms.unitIds != null and terms.unitIds !=''">--> -<!-- unit_name as name,--> -<!-- id as code--> -<!-- </if>--> + <!-- <if test="terms.unitIds != null and terms.unitIds !=''">--> + <!-- unit_name as name,--> + <!-- id as code--> + <!-- </if>--> </if> from dyh_ct_unit where @@ -863,12 +1028,14 @@ <if test="terms.unitIds != null and terms.unitIds !=''"> and id in(${terms.unitIds}) </if> - group by <include refid="groupALLPart"/> + group by + <include refid="groupALLPart"/> </select> <!-- 查询下属所有属地 --> <select id="listSubordinateTerritory" resultType="string"> - select <include refid="selectALLPart"/> + select + <include refid="selectALLPart"/> from dyh_ct_unit where delete_status = 0 @@ -898,22 +1065,21 @@ <if test="terms.unitIds != null and terms.unitIds !=''"> and id in(${terms.unitIds}) </if> - group by <include refid="groupALLPart"/> + group by + <include refid="groupALLPart"/> </select> <!-- 获取所有下属组织包括自己 --> <select id="getAllParentUnit" resultType="string"> SELECT id - FROM dyh_ct_unit - START WITH id = #{unitId} + FROM dyh_ct_unit START WITH id = #{unitId} CONNECT BY PRIOR id = parent_id; </select> <!-- 获取所有下属组织包括自己 --> <select id="getAllDeptParentUnit" resultType="string"> SELECT id - FROM dyh_ct_unit - START WITH id = #{unitId} + FROM dyh_ct_unit START WITH id = #{unitId} CONNECT BY PRIOR id = parent_id and unit_type != 101 and unit_type != 103; </select> @@ -946,11 +1112,11 @@ t3.village as code, 'queVillage' as region, </if> -<!-- <if test="terms.unitIds != null and terms.unitIds !=''">--> -<!-- (case when t3.unit_name = '' or t3.unit_name is null then '本级' else t3.unit_name end)as name,--> -<!-- t3.id as code,--> -<!-- 'unitId' as region,--> -<!-- </if>--> + <!-- <if test="terms.unitIds != null and terms.unitIds !=''">--> + <!-- (case when t3.unit_name = '' or t3.unit_name is null then '本级' else t3.unit_name end)as name,--> + <!-- t3.id as code,--> + <!-- 'unitId' as region,--> + <!-- </if>--> </if> count(distinct t1.id) as total FROM dyh_case_info t1 left join dyh_case_info_unfold t2 on t1.id = t2.id @@ -995,7 +1161,7 @@ and t2.mediate_unit_id = #{terms.mediateUnitId} </if> <if test="terms.assistUnitId != null and terms.assistUnitId !=''"> - and t2.assist_unit_id = #{terms.assistUnitId} + and t2.assist_unit_id = #{terms.assistUnitId} </if> </if> group by @@ -1027,8 +1193,8 @@ FROM dyh_case_info t1 left join dyh_case_info_unfold t2 on t1.id = t2.id left join dyh_ct_unit t3 on t2.belong_unit_id = t3.id where t1.delete_status = 0 - and t3.delete_status = 0 - and t2.is_risk = 1 + and t3.delete_status = 0 + and t2.is_risk = 1 <if test="terms != null"> <if test="terms.queProv != null and terms.queProv !=''"> and t3.prov = #{terms.queProv} @@ -1066,7 +1232,7 @@ and t2.mediate_unit_id = #{terms.mediateUnitId} </if> <if test="terms.assistUnitId != null and terms.assistUnitId !=''"> - and t2.assist_unit_id = #{terms.assistUnitId} + and t2.assist_unit_id = #{terms.assistUnitId} </if> </if> group by t1.case_type_first_name order by count(t1.case_type_first_name) desc limit 3 @@ -1076,7 +1242,7 @@ <select id="getZZZXUnitId" resultType="string"> select id from dyh_ct_unit where delete_status = 0 - and (unit_type = 101 or unit_type = 103) + and (unit_type = 101 or unit_type = 103) <if test="terms.queProv != null and terms.queProv !=''"> and prov = #{terms.queProv} </if> @@ -1110,8 +1276,10 @@ and t2.delete_status = 0 and t3.delete_status = 0 <include refid="statisticsAVG-wherePart"/> - and (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) - group by <include refid="groupPart"/> + and (t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') and + ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) + group by + <include refid="groupPart"/> order by quantity asc </select> @@ -1128,8 +1296,10 @@ and t3.delete_status = 0 <include refid="statisticsAVG-wherePart"/> and - (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL') and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1) ) - group by <include refid="groupPart"/> + (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL') and + ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1) ) + group by + <include refid="groupPart"/> order by quantity asc </select> @@ -1143,7 +1313,8 @@ where <include refid="statisticsSuperviseAVG-wherePart"/> and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1')) - group by <include refid="groupPart"/> + group by + <include refid="groupPart"/> order by quantity asc </select> @@ -1167,7 +1338,8 @@ and((t2.node_id = 'ZJ_DFP' or t2.node_id = 'QJ_DFP' or t2.node_id = 'SJ_DFP' or t2.node_id = 'DFP') or (t2.node_id = 'ZJ_DSL' or t2.node_id = 'QJ_DSL' or t2.node_id = 'SJ_DSL' or t2.node_id = 'DSL')) and ((t2.overtime_status = 1 and t2.status = 2) or (sysdate > expire_time and t2.status = 1)) - group by <include refid="groupPart"/> + group by + <include refid="groupPart"/> union all select <include refid="selectPart"/> @@ -1177,8 +1349,10 @@ where <include refid="statisticsSuperviseAVG-wherePart"/> and ((sysdate > DATEADD(hour, t2.reply_term, t2.sup_time) and t2.sup_status = 0) or (t2.overtime_status = '1')) - group by <include refid="groupPart"/> - )t1 group by <include refid="groupPart"/> + group by + <include refid="groupPart"/> + )t1 group by + <include refid="groupPart"/> order by quantity asc </select> @@ -1249,7 +1423,8 @@ select count(1) from - dyh_ct_unit t1 left join dyh_case_info_unfold t2 on t2.belong_unit_id = t1.id left join dyh_case_info t3 on t2.id = t3.id + dyh_ct_unit t1 left join dyh_case_info_unfold t2 on t2.belong_unit_id = t1.id left join dyh_case_info t3 on + t2.id = t3.id left join(SELECT case_id, node_id, create_time, cande_unit_id, id, status,handle_result FROM ( SELECT case_id, node_id, create_time, cande_unit_id, id, status,handle_result, @@ -1268,7 +1443,8 @@ <if test="terms.caseStatus != null and terms.caseStatus == 3"> and t3.zxsl_status = 0 and ((t4.node_id in ('ZJ_DFP', 'QJ_DFP', 'SJ_DFP', 'DFP', 'QJ_DSL', 'SJ_DSL', 'DSL', 'ZJ_DSL') - and t4.handle_result !=3) or t4.node_id in ('SJ_SBSH', 'SJ_HTSH', 'QJ_HTSH', 'QJ_SBSH', 'ZJ_HTSH', 'JASQ', 'HTSH')) + and t4.handle_result !=3) or t4.node_id in ('SJ_SBSH', 'SJ_HTSH', 'QJ_HTSH', 'QJ_SBSH', 'ZJ_HTSH', 'JASQ', + 'HTSH')) </if> <if test="terms.caseStatus != null and terms.caseStatus == 4"> and t3.zxsl_status = 0 @@ -1280,7 +1456,8 @@ <select id="listStatisticsCirculation" resultMap="dataResult-CasePageDTO"> select - t3.id, t3.status,t3.status_name,t3.canal,t3.canal_name,t3.canal_second,t3.canal_second_name,t3.case_level,t3.case_type, + t3.id, + t3.status,t3.status_name,t3.canal,t3.canal_name,t3.canal_second,t3.canal_second_name,t3.case_level,t3.case_type, t3.case_type_name,t3.case_type_first_name,t3.input_unit_id,t3.input_unit_name,t3.create_time,t3.plaintiffs,t3.defendants, IF(t1.city_name is null,t3.que_city_name,t1.city_name) as que_city_name, IF(t1.area_name is null,t3.que_area_name,t1.area_name) as que_area_name, @@ -1292,7 +1469,8 @@ t2.assist_unit_name,t2.close_time,t2.agree_type,t2.agree_type_name,t2.agree_content,t2.windup_content, t4.id from - dyh_ct_unit t1 left join dyh_case_info_unfold t2 on t2.belong_unit_id = t1.id left join dyh_case_info t3 on t2.id = t3.id + dyh_ct_unit t1 left join dyh_case_info_unfold t2 on t2.belong_unit_id = t1.id left join dyh_case_info t3 on + t2.id = t3.id left join(SELECT case_id, node_id, create_time, cande_unit_id, id, status,handle_result FROM ( SELECT case_id, node_id, create_time, cande_unit_id, id, status,handle_result, @@ -1311,7 +1489,8 @@ <if test="terms.caseStatus != null and terms.caseStatus == 3"> and t3.zxsl_status = 0 and ((t4.node_id in ('ZJ_DFP', 'QJ_DFP', 'SJ_DFP', 'DFP', 'QJ_DSL', 'SJ_DSL', 'DSL', 'ZJ_DSL') - and t4.handle_result !=3) or t4.node_id in ('SJ_SBSH', 'SJ_HTSH', 'QJ_HTSH', 'QJ_SBSH', 'ZJ_HTSH', 'JASQ', 'HTSH')) + and t4.handle_result !=3) or t4.node_id in ('SJ_SBSH', 'SJ_HTSH', 'QJ_HTSH', 'QJ_SBSH', 'ZJ_HTSH', 'JASQ', + 'HTSH')) </if> <if test="terms.caseStatus != null and terms.caseStatus == 4"> and t3.zxsl_status = 0 -- Gitblit v1.8.0