四大业务指标完成情况填报表+巡查完成率数据不一致问题排查

This commit is contained in:
yangkunan 2024-07-24 22:31:22 +08:00
parent fad549827a
commit b0f855b9e9
7 changed files with 208 additions and 5 deletions

View File

@ -28,5 +28,17 @@
</jdbc-additional-properties> </jdbc-additional-properties>
<working-dir>$ProjectFileDir$</working-dir> <working-dir>$ProjectFileDir$</working-dir>
</data-source> </data-source>
<data-source source="LOCAL" name="ERP生产" uuid="8e22d468-e317-4547-adf7-224e09817883">
<driver-ref>sqlserver.ms</driver-ref>
<synchronize>true</synchronize>
<jdbc-driver>com.microsoft.sqlserver.jdbc.SQLServerDriver</jdbc-driver>
<jdbc-url>jdbc:sqlserver://172.18.96.4:1433</jdbc-url>
<jdbc-additional-properties>
<property name="com.intellij.clouds.kubernetes.db.host.port" />
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
<property name="com.intellij.clouds.kubernetes.db.container.port" />
</jdbc-additional-properties>
<working-dir>$ProjectFileDir$</working-dir>
</data-source>
</component> </component>
</project> </project>

View File

@ -5,6 +5,7 @@
<file url="file://$PROJECT_DIR$/dw/dim/dim_business_contract_type_d.sql" dialect="MySQL" /> <file url="file://$PROJECT_DIR$/dw/dim/dim_business_contract_type_d.sql" dialect="MySQL" />
<file url="file://$PROJECT_DIR$/dw/dim/dim_engine_equipment_d.sql" dialect="MySQL" /> <file url="file://$PROJECT_DIR$/dw/dim/dim_engine_equipment_d.sql" dialect="MySQL" />
<file url="file://$PROJECT_DIR$/dw/dim/dim_project_base_info_d.sql" dialect="MySQL" /> <file url="file://$PROJECT_DIR$/dw/dim/dim_project_base_info_d.sql" dialect="MySQL" />
<file url="file://$PROJECT_DIR$/dw/dwd/dwd_engine_equipment_inspection_task_d.sql" dialect="MySQL" />
<file url="file://$PROJECT_DIR$/dw/dwd/dwd_engine_equipment_status_d.sql" dialect="MySQL" /> <file url="file://$PROJECT_DIR$/dw/dwd/dwd_engine_equipment_status_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" />
@ -12,6 +13,8 @@
<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" />
<file url="file://$PROJECT_DIR$/finereport/kanban/pc/工程.sql" dialect="MySQL" /> <file url="file://$PROJECT_DIR$/finereport/kanban/pc/工程.sql" dialect="MySQL" />
<file url="file://$PROJECT_DIR$/finereport/kanban/pc/总裁.sql" dialect="MySQL" />
<file url="file://$PROJECT_DIR$/finereport/tianbao/6_innovation/多经四大业务指标完成情况填报表.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/2_operation/项目明细弹窗.sql" dialect="MySQL" />

View File

@ -9,3 +9,6 @@ select
, TaskStatue -- 任务状态 , TaskStatue -- 任务状态
from ods_erp_tb_eq_flow_task_inspection_d from ods_erp_tb_eq_flow_task_inspection_d
where IsClose = 0 where IsClose = 0
-- and CommId = '214309'
-- and TaskEndTime <= DATE_SUB(CURDATE(),INTERVAL 1 SECOND)
-- and TaskEndTime>='2024-07-01'

View File

@ -84,8 +84,8 @@ where 1=1
${IF(LEN(p_ym)>0," AND right(list_ym,2) ='" +right(p_ym,2) + "'","")} ${IF(LEN(p_ym)>0," AND right(list_ym,2) ='" +right(p_ym,2) + "'","")}
and MeterType in ('水表','电表') and MeterType in ('水表','电表')
order by list_ym asc order by list_ym asc
;
-- ----------------------------------------------------------------------------------------------------------
-- 设备巡查 -- 设备巡查
select select
${IF(LEN(p_area)>0,"organ_code, organ_name, comm_id code, comm_name name,","organ_code code, organ_name name,")} ${IF(LEN(p_area)>0,"organ_code, organ_name, comm_id code, comm_name name,","organ_code code, organ_name name,")}
@ -99,6 +99,65 @@ where 1=1
${IF(LEN(p_ym)>0," AND task_ym ='" + left(p_ym,4) + right(p_ym,2) + "'","")} ${IF(LEN(p_ym)>0," AND task_ym ='" + left(p_ym,4) + right(p_ym,2) + "'","")}
SELECT
SUM(task_finish_num) / sum(task_num)
FROM dws_engine_equipment_inspect_task_m
where task_ym = '202407';
-- 【erp设备巡检完成率】
select
SUM() AS
,SUM() AS
from
(
select
CommId
,count(0)
,sum(case when TaskStatue=2 then 1 else 0 end)
-- select *
from Tb_Eq_Flow_Task_Inspection where IsClose = 0
and TaskEndTime>='2024-07-01'
and TaskEndTime<='2024-07-23 23:59:59'
-- and TaskStatue='2'
and IsClose=0 group by CommId
)t
;
-- ods
SELECT
count(1) as total_task
,sum(case when TaskStatue = 2 then 1 else 0 end) as finish_task
-- ,sum(case when TaskStatue = 2 then 1 else 0 end) / count(1) as finish_task_rate
-- select *
from dw.ods_erp_tb_eq_flow_task_inspection_d
where IsClose = 0
and TaskEndTime>='2024-07-01'
and TaskEndTime<= '2024-07-23 23:59:59'
-- AND TaskStatue = '2'
and TaskEndTime<= DATE_SUB(CURDATE(),INTERVAL 1 SECOND)
;
-- dwd
select
sum(case when TaskStatue = 2 then 1 else 0 end) task_finish_num
, count(*) task_num
from dw.dwd_engine_equipment_inspection_task_d a
join (select distinct organ_code, organ_name, comm_id, comm_name from dw.dim_organ_mapping where comm_id is not null) b
on a.CommId = b.comm_id
where TaskEndTime <= DATE_SUB(CURDATE(),INTERVAL 1 SECOND)
and TaskEndTime>='2024-07-01'
;
-- 59180 - 59134
-- ---------------------------------------------------------------------------------------------------------------
-- 水电收缴率 -- 水电收缴率
select select
@ -110,7 +169,6 @@ where ParentCostCode = '0008'
-- 异常抬杆 -- 异常抬杆
select select
organ_code , organ_name organ_code , organ_name
, sum(manualOutNum) manualOutNum , sum(manualOutNum) manualOutNum

View File

@ -15,3 +15,39 @@ ${if(len(organ)=0,"","and organ_code = '"+organ+"'")}
and left(ym,4) = '2024' and left(ym,4) = '2024'
group by ym group by ym
order by ym asc order by ym asc
-- 【设备巡检】
-- 【old】
select
sum(task_finish_num)
, sum(task_num)
, sum(task_finish_num) / sum(task_num) inspection_finish_rate
FROM dws_engine_equipment_inspect_task_m
where task_ym = date_format(current_date(),'%Y%m')
${if(len(organ)=0,"","and organ_code = '"+organ+"'")}
;
-- 【new】
select
comm_id
,comm_name
,task_ym
sum(task_finish_num) / sum(task_num) as inspection_finish_rate
FROM dws_engine_equipment_inspect_task_m
where task_ym = date_format(current_date(),'%Y%m')
group by
comm_id
,comm_name
,task_ym
;
${if(len(organ)=0,"","and organ_code = '"+organ+"'")}
.select(task_finish_num) / .select(task_num)

View File

@ -0,0 +1,85 @@
drop table if exists dw.ods_innoveco_metrics_finish_d;
CREATE TABLE IF NOT EXISTS dw.ods_innoveco_metrics_finish_d (
id INT AUTO_INCREMENT PRIMARY KEY COMMENT '自增id'
,ym VARCHAR(50) COMMENT '年月'
,organ_code VARCHAR(50) COMMENT '片区ID'
,organ_name VARCHAR(50) COMMENT '片区名称'
,business_type VARCHAR(50) COMMENT '业务类型'
,revenue_type VARCHAR(50) COMMENT '收入类型'
,revenue_value DECIMAL(16,2) COMMENT '收入值'
,update_time datetime COMMENT '更新时间'
,update_user VARCHAR(100) COMMENT '更新人'
)COMMENT = '多经四大业务指标完成情况填报表'
;
truncate table dw.ods_innoveco_metrics_finish_d;
select
id -- 自增id'
,ym -- 年月'
,organ_code
,organ_name -- 片区'
,business_type -- 业务类型'
,revenue_type -- 收入'
,revenue_value -- 收入值'
,update_user
,update_time
from dw.ods_innoveco_metrics_finish_d
;
-- 【tianbao_innoveco_input】
select
id -- 自增id'
,ym -- 年月'
,organ_name -- 片区'
,business_type -- 业务类型'
,revenue_type -- 收入'
,revenue_value -- 收入值'
from dw.ods_innoveco_metrics_finish_d
where ym = '${p_ym}'
;
-- 【erp_片区】
SELECT
organ_code
,organ_name
FROM
(
SELECT DISTINCT
organ_code AS organ_code
,organ_name AS organ_name
, CASE
WHEN organ_code = '0102' THEN 1 -- 成都片区
WHEN organ_code = '0101' THEN 2 -- 乐山片区
WHEN organ_code = '0115' THEN 3 -- 眉山片区
WHEN organ_code = '0120' THEN 4 -- 攀西片区
WHEN organ_code = '0106' THEN 5 -- 长春片区
WHEN organ_code = '0109' THEN 6 -- 大湾片区
WHEN organ_code = '0108' THEN 7 -- 商写片区
WHEN organ_code = '0116' THEN 8 -- 川东北片区
WHEN organ_code = '0103' THEN 9 -- 库尔勒片区
WHEN organ_code = '0117' THEN 10 -- 乌鲁木齐片区
WHEN organ_code = '0118' THEN 11 -- 喀什片区
WHEN organ_code = '0114' THEN 13 -- 雅华片区
else 999
END AS RK
FROM dim_organ_mapping
where organ_code is not null
and organ_code <> '0121'
UNION
SELECT
DISTINCT
cx_oragan_code AS organ_code
, cx_oragan_name AS organ_name
, 14 AS RK
FROM dim_organ_mapping
where cx_oragan_code = '6001'
)T
ORDER BY T.RK;

View File

@ -25,3 +25,9 @@
| 214351002 | 【成都】港基·叠香庄园 | | 214351002 | 【成都】港基·叠香庄园 |
| 214350002 | 【成都】翰香府 | | 214350002 | 【成都】翰香府 |
【创新四大业务指标完成情况 新增片区如下】 2024-07-24
| 片区id | 片区 |
|------|----------|
| 6001 | 资阳佳美|