报事关闭率逻辑优化

This commit is contained in:
yangkunan 2024-07-29 18:50:08 +08:00
parent dd57251f66
commit 1e62c20766
3 changed files with 24 additions and 1 deletions

View File

@ -15,6 +15,7 @@
<file url="file://$PROJECT_DIR$/dw/dws/dws_business_rent_rate_d.sql" dialect="MySQL" /> <file url="file://$PROJECT_DIR$/dw/dws/dws_business_rent_rate_d.sql" dialect="MySQL" />
<file url="file://$PROJECT_DIR$/dw/dws/dws_engine_equipment_in_good_d.sql" dialect="MySQL" /> <file url="file://$PROJECT_DIR$/dw/dws/dws_engine_equipment_in_good_d.sql" dialect="MySQL" />
<file url="file://$PROJECT_DIR$/dw/dws/dws_engine_equipment_inspect_task_m.sql" dialect="MySQL" /> <file url="file://$PROJECT_DIR$/dw/dws/dws_engine_equipment_inspect_task_m.sql" dialect="MySQL" />
<file url="file://$PROJECT_DIR$/dw/dws/dws_estate_incident_info_m.sql" dialect="MySQL" />
<file url="file://$PROJECT_DIR$/dw/dws/dws_finance_fees_serial_m.sql" dialect="MySQL" /> <file url="file://$PROJECT_DIR$/dw/dws/dws_finance_fees_serial_m.sql" dialect="MySQL" />
<file url="file://$PROJECT_DIR$/dw/ods/ods_cost_budget_data_d.sql" dialect="Oracle" /> <file url="file://$PROJECT_DIR$/dw/ods/ods_cost_budget_data_d.sql" dialect="Oracle" />
<file url="file://$PROJECT_DIR$/finereport/kanban/mobile/创新生态_mobile.sql" dialect="MySQL" /> <file url="file://$PROJECT_DIR$/finereport/kanban/mobile/创新生态_mobile.sql" dialect="MySQL" />
@ -26,6 +27,7 @@
<file url="file://$PROJECT_DIR$/finereport/xiazuan/2_operation/住服比异常项目.sql" dialect="MySQL" /> <file url="file://$PROJECT_DIR$/finereport/xiazuan/2_operation/住服比异常项目.sql" dialect="MySQL" />
<file url="file://$PROJECT_DIR$/finereport/xiazuan/2_operation/计划到期明细.sql" dialect="MySQL" /> <file url="file://$PROJECT_DIR$/finereport/xiazuan/2_operation/计划到期明细.sql" dialect="MySQL" />
<file url="file://$PROJECT_DIR$/finereport/xiazuan/2_operation/项目明细弹窗.sql" dialect="MySQL" /> <file url="file://$PROJECT_DIR$/finereport/xiazuan/2_operation/项目明细弹窗.sql" dialect="MySQL" />
<file url="file://$PROJECT_DIR$/finereport/xiazuan/3_property/2_报事情况报表.sql" dialect="MySQL" />
<file url="PROJECT" dialect="MySQL" /> <file url="PROJECT" dialect="MySQL" />
</component> </component>
</project> </project>

View File

@ -5,7 +5,7 @@ select
, b.comm_name , b.comm_name
, date_format(a.IncidentDate,'%Y%m') incident_ym , date_format(a.IncidentDate,'%Y%m') incident_ym
, count(*) incident_num , count(*) incident_num
, sum(case when ifnull(a.CloseTime,0)=0 then 1 else 0 end) incident_close_num , sum(case when ifnull(a.CloseTime,0)=0 then 0 else 1 end) incident_close_num
, sum(case when a.IsClose=0 and CloseTime is null and a.MainEndDate is null then 1 else 0 end) processing_incident_num , sum(case when a.IsClose=0 and CloseTime is null and a.MainEndDate is null then 1 else 0 end) processing_incident_num
, sum(case when a.CloseTime is null and MainEndDate is not null then 1 else 0 end) completed_not_close_incident_num , sum(case when a.CloseTime is null and MainEndDate is not null then 1 else 0 end) completed_not_close_incident_num
, sum(case when timestampdiff(hour,a.ForwardDateTime, a.IncidentDate)>2 then 1 else 0 end) response_timeout_incident_num , sum(case when timestampdiff(hour,a.ForwardDateTime, a.IncidentDate)>2 then 1 else 0 end) response_timeout_incident_num
@ -17,6 +17,7 @@ select
, sum(case when a.DelayHours is not null then 1 else 0 end) delay_incident_num , sum(case when a.DelayHours is not null then 1 else 0 end) delay_incident_num
, sum(case when a.IsTouSu = 1 then 1 else 0 end) tousu_incident_num , sum(case when a.IsTouSu = 1 then 1 else 0 end) tousu_incident_num
, sum(case when a.IsClose=1 and a.IsTouSu = 1 then 1 else 0 end) tousu_close_incident_num , sum(case when a.IsClose=1 and a.IsTouSu = 1 then 1 else 0 end) tousu_close_incident_num
, sum(case when ifnull(MainEndDate,'') = '' and IFNULL(CloseTime,'') = '' AND IsClose = 0 then 1 else 0 end) indeal_incident_num
from dwd_estate_incident_info_d a from dwd_estate_incident_info_d a
inner join (select distinct organ_code, organ_name, comm_id, comm_name from dim_organ_mapping) b inner join (select distinct organ_code, organ_name, comm_id, comm_name from dim_organ_mapping) b
on a.CommID = b.comm_id on a.CommID = b.comm_id

View File

@ -0,0 +1,20 @@
-- ======================================
-- report_5_完成率
-- ======================================
SELECT
organ_code AS id,
organ_name AS ,
SUM(IFNULL(incident_num,0)) AS ,
IFNULL((SUM(IFNULL(response_timely_incident_num,0)) / SUM(IFNULL(incident_num,0))),0) AS ,
IFNULL((SUM(IFNULL(completed_incident_num,0)) / SUM(IFNULL(incident_num,0))),0) AS ,
IFNULL((SUM(IFNULL(follow_up_incident_num,0)) / SUM(IFNULL(incident_num,0))),0) AS 访,
IFNULL((SUM(IFNULL(incident_close_num,0)) / SUM(IFNULL(incident_num,0))),0) AS ,
case when (sum(incident_num) - sum(indeal_incident_num)) = 0 THEN 0
else sum(incident_close_num) / (sum(incident_num) - sum(indeal_incident_num))
end AS
FROM dw.dws_estate_incident_info_m T1
WHERE 1=1
${IF(LEN(p_startdate)>0,"AND T1.incident_ym = '"+FORMAT(CONCATENATE(p_startdate,"-01"),"yyyyMM")+"'","")}
${IF(LEN(p_area)>0," AND T1.organ_code IN ('"+p_area+"')", "")}
GROUP BY organ_code,organ_name