新增明细表
This commit is contained in:
parent
c22268c7eb
commit
5ad4765d31
@ -26,6 +26,7 @@
|
|||||||
<file url="file://$PROJECT_DIR$/dw/dws/dws_innoveco_new_retail_m.sql" dialect="MySQL" />
|
<file url="file://$PROJECT_DIR$/dw/dws/dws_innoveco_new_retail_m.sql" dialect="MySQL" />
|
||||||
<file url="file://$PROJECT_DIR$/dw/dws/dws_law_not_tran_payment_m.sql" dialect="MySQL" />
|
<file url="file://$PROJECT_DIR$/dw/dws/dws_law_not_tran_payment_m.sql" dialect="MySQL" />
|
||||||
<file url="file://$PROJECT_DIR$/dw/dws/dws_law_tran_coll_d.sql" dialect="MySQL" />
|
<file url="file://$PROJECT_DIR$/dw/dws/dws_law_tran_coll_d.sql" dialect="MySQL" />
|
||||||
|
<file url="file://$PROJECT_DIR$/dw/dws/dws_operation_subcompany_plan_level_d.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" />
|
||||||
<file url="file://$PROJECT_DIR$/finereport/kanban/mobile/物业_mobile.sql" dialect="MySQL" />
|
<file url="file://$PROJECT_DIR$/finereport/kanban/mobile/物业_mobile.sql" dialect="MySQL" />
|
||||||
@ -38,6 +39,7 @@
|
|||||||
<file url="file://$PROJECT_DIR$/finereport/tianbao/6_innovation/多经四大业务指标完成情况填报表.sql" dialect="MySQL" />
|
<file url="file://$PROJECT_DIR$/finereport/tianbao/6_innovation/多经四大业务指标完成情况填报表.sql" dialect="MySQL" />
|
||||||
<file url="file://$PROJECT_DIR$/finereport/tianbao/EARLY_WARNING/看板数据预警-项目维度.sql" dialect="MySQL" />
|
<file url="file://$PROJECT_DIR$/finereport/tianbao/EARLY_WARNING/看板数据预警-项目维度.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" />
|
<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="file://$PROJECT_DIR$/finereport/xiazuan/3_property/2_报事情况报表.sql" dialect="MySQL" />
|
||||||
@ -48,6 +50,7 @@
|
|||||||
<file url="file://$PROJECT_DIR$/finereport/xiazuan/6_innovation/7_空间运营出租率明细.sql" dialect="MySQL" />
|
<file url="file://$PROJECT_DIR$/finereport/xiazuan/6_innovation/7_空间运营出租率明细.sql" dialect="MySQL" />
|
||||||
<file url="file://$PROJECT_DIR$/finereport/xiazuan/6_innovation/9_多径回款情况.sql" dialect="MySQL" />
|
<file url="file://$PROJECT_DIR$/finereport/xiazuan/6_innovation/9_多径回款情况.sql" dialect="MySQL" />
|
||||||
<file url="file://$PROJECT_DIR$/finereport/xiazuan/6_innovation/新零售订单明细.sql" dialect="MySQL" />
|
<file url="file://$PROJECT_DIR$/finereport/xiazuan/6_innovation/新零售订单明细.sql" dialect="MySQL" />
|
||||||
|
<file url="file://$PROJECT_DIR$/finereport/问题修复/计划到期明细组织架构为空.sql" dialect="MySQL" />
|
||||||
<file url="file://$PROJECT_DIR$/finereport/预警/片区预警数据.sql" dialect="MySQL" />
|
<file url="file://$PROJECT_DIR$/finereport/预警/片区预警数据.sql" dialect="MySQL" />
|
||||||
<file url="file://$PROJECT_DIR$/finereport/预警/项目预警数据.sql" dialect="MySQL" />
|
<file url="file://$PROJECT_DIR$/finereport/预警/项目预警数据.sql" dialect="MySQL" />
|
||||||
<file url="PROJECT" dialect="MySQL" />
|
<file url="PROJECT" dialect="MySQL" />
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
select
|
select
|
||||||
left(a.start_date,7) ym
|
left(a.end_date,7) ym
|
||||||
, b.subcompanyid1 subcompanyid
|
, b.subcompanyid1 subcompanyid
|
||||||
, c.subcompanyname
|
, c.subcompanyname
|
||||||
, c.supsubcomid
|
, c.supsubcomid
|
||||||
@ -7,7 +7,7 @@ select
|
|||||||
, count(*) plan_num
|
, count(*) plan_num
|
||||||
, count(plan_name) plan_adjust_num
|
, count(plan_name) plan_adjust_num
|
||||||
, sum(case when plan_status = 2 then 1 else 0 end) plan_cancel_num
|
, sum(case when plan_status = 2 then 1 else 0 end) plan_cancel_num
|
||||||
, sum(case when plan_status = 6 then 1 else 0 end) plan_exempt_assess_num
|
, sum(case when plan_status = 7 then 1 else 0 end) plan_exempt_assess_num
|
||||||
, sum(case when plan_status = 4 then 1 else 0 end) plan_incomplete_num
|
, sum(case when plan_status = 4 then 1 else 0 end) plan_incomplete_num
|
||||||
, sum(case when left(start_date,7) = left(input_date,7) then 1 else 0 end) plan_thism_num
|
, sum(case when left(start_date,7) = left(input_date,7) then 1 else 0 end) plan_thism_num
|
||||||
, sum(case when plan_status = 0 then 1 else 0 end) plan_in_progress_num
|
, sum(case when plan_status = 0 then 1 else 0 end) plan_in_progress_num
|
||||||
@ -33,8 +33,9 @@ from (
|
|||||||
on b.subcompanyid1 = c.id
|
on b.subcompanyid1 = c.id
|
||||||
left join (select distinct plan_name from dwd_operations_plan_adjust_info_d) d
|
left join (select distinct plan_name from dwd_operations_plan_adjust_info_d) d
|
||||||
on a.id = d.plan_name
|
on a.id = d.plan_name
|
||||||
|
WHERE left(a.end_date,7) = '2024-09'
|
||||||
group by
|
group by
|
||||||
left(a.start_date,7)
|
left(a.end_date,7)
|
||||||
, b.subcompanyid1
|
, b.subcompanyid1
|
||||||
, c.subcompanyname
|
, c.subcompanyname
|
||||||
, c.supsubcomid
|
, c.supsubcomid
|
||||||
|
105
finereport/xiazuan/2_operation/未完成计划明细.sql
Normal file
105
finereport/xiazuan/2_operation/未完成计划明细.sql
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
-- *****************************
|
||||||
|
-- 创建人员: 杨坤安
|
||||||
|
-- 创建时间:
|
||||||
|
-- 功能描述: 未完成计划明细
|
||||||
|
-- *****************************
|
||||||
|
|
||||||
|
with one_to_many AS(
|
||||||
|
SELECT
|
||||||
|
a.username AS username -- 用户名
|
||||||
|
,SUBSTRING_INDEX(SUBSTRING_INDEX(a.mang_project, ',',b.help_topic_id + 1),',',-1) AS mang_project -- 管理项目名
|
||||||
|
FROM ods_one_to_many_perm a
|
||||||
|
JOIN mysql.help_topic b
|
||||||
|
on b.help_topic_id < (LENGTH(a.mang_project) - length(replace(a.mang_project,',','')) + 1)
|
||||||
|
WHERE a.username = '${fine_username}'
|
||||||
|
)
|
||||||
|
select
|
||||||
|
${if(len(p_area) == 0,"c.organ_name","c.comm_name")} as p_area
|
||||||
|
,c.oa_comm_id as oa_comm_id -- oa项目id
|
||||||
|
,c.oa_comm_name as oa_comm_name -- oa项目名称
|
||||||
|
,c.oa_organ_code as oa_organ_code -- oa片区id
|
||||||
|
,c.oa_organ_name as oa_organ_name -- oa片区名称
|
||||||
|
,c.organ_code as organ_code -- erp片区编码
|
||||||
|
,c.organ_name as organ_name -- erp片区名称
|
||||||
|
,c.comm_id as comm_id -- erp项目id
|
||||||
|
,c.comm_name as comm_name -- erp项目名称
|
||||||
|
,b.subcompanyid1 as subcompanyid1 -- 公司id
|
||||||
|
,a.plan_name as plan_name -- 计划名称
|
||||||
|
,a.eval_criteria as plan_desc -- 计划内容
|
||||||
|
,a.plan_level as plan_level -- 计划等级
|
||||||
|
,left(a.start_date,7) as ym -- 计划开始年月
|
||||||
|
,a.start_dt as start_dt -- 计划开始时
|
||||||
|
,a.end_date as end_date -- 计划结束时间
|
||||||
|
,a.finish_date as finish_date -- 计划完成时间
|
||||||
|
,a.input_date as input_date -- 计划录入时间
|
||||||
|
,a.day_diff as day_diff -- 距离计划结束天数
|
||||||
|
,a.responsible_person1 as responsible_person1 -- 责任人编码
|
||||||
|
,b.lastname as executor_name -- 责任人名称
|
||||||
|
,d.lastname AS lastname -- 执行人
|
||||||
|
,left(a.end_ym,7) as end_ym -- 计划结束年月
|
||||||
|
from
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
concat(left(trim(start_date),5),lpad(substring_index(substring_index(trim(start_date),'-',2),'-',-1),2,0),right(trim(start_date),3)) as start_date
|
||||||
|
,a.start_date as start_dt -- 计划开始时间
|
||||||
|
,a.plan_level -- 计划等级
|
||||||
|
,jt.responsible_person1 -- 责任人
|
||||||
|
,a.plan_status -- 计划状态
|
||||||
|
,a.input_date -- 录入时间
|
||||||
|
,a.end_date -- 计划结束时间
|
||||||
|
,a.plan_name -- 计划名称
|
||||||
|
,concat(left(trim(end_date),5),lpad(substring_index(substring_index(trim(end_date),'-',2),'-',-1),2,0),right(trim(end_date),3)) as end_ym
|
||||||
|
,a.finish_date -- 完成时间
|
||||||
|
,TO_DAYS(a.end_date) - TO_DAYS(curdate()) AS day_diff
|
||||||
|
,a.eval_criteria -- 评价标准
|
||||||
|
,a.executor -- 执行人
|
||||||
|
FROM dw.dwd_operations_plan_info_d a,
|
||||||
|
JSON_TABLE (
|
||||||
|
cast( CONCAT( '["', REPLACE ( responsible_person1, ',', '","' ), '"]' ) AS json ),
|
||||||
|
"$[*]" COLUMNS ( responsible_person1 INT PATH "$" )
|
||||||
|
) AS jt
|
||||||
|
WHERE a.plan_status = '4'
|
||||||
|
)a
|
||||||
|
left join
|
||||||
|
(
|
||||||
|
select
|
||||||
|
id
|
||||||
|
,subcompanyid1 -- 公司id
|
||||||
|
,lastname -- 执行人
|
||||||
|
from dw.ods_oa_hrmresource_d
|
||||||
|
|
||||||
|
)b
|
||||||
|
on a.responsible_person1 = b.id
|
||||||
|
left join
|
||||||
|
(
|
||||||
|
select
|
||||||
|
distinct
|
||||||
|
organ_code -- erp片区id
|
||||||
|
,organ_name -- erp片区名称
|
||||||
|
,comm_id -- erp项目id
|
||||||
|
,comm_name -- erp项目名称
|
||||||
|
,oa_organ_code -- oa片区id
|
||||||
|
,oa_organ_name -- oa片区名称
|
||||||
|
,oa_comm_id -- oa项目id
|
||||||
|
,oa_comm_name -- oa项目名称
|
||||||
|
from dim_organ_mapping -- 组织结构映射维度表
|
||||||
|
-- where comm_id is not null
|
||||||
|
)c
|
||||||
|
on b.subcompanyid1 = c.oa_comm_id
|
||||||
|
left join
|
||||||
|
(
|
||||||
|
select
|
||||||
|
id
|
||||||
|
,subcompanyid1 -- 公司id
|
||||||
|
,lastname -- 执行人
|
||||||
|
from dw.ods_oa_hrmresource_d
|
||||||
|
|
||||||
|
)d
|
||||||
|
on a.executor = d.id
|
||||||
|
where 1 = 1
|
||||||
|
${if(len(p_startdate) == 0,"","and left(a.end_ym,7) = '" + p_startdate + "'")}
|
||||||
|
${IF(LEN(p_area)!=0," and organ_code IN ('"+p_area+"')","")}
|
||||||
|
-- ${if(left(fine_role,2)=="项目","and comm_name = '"+GETUSERDEPARTMENTS(3)+"'","")}
|
||||||
|
AND CASE WHEN (SELECT mang_project FROM ods_one_to_many_perm WHERE username = '${fine_username}' AND mang_organ IS NULL) IS NOT NULL
|
||||||
|
THEN comm_name IN (SELECT mang_project FROM one_to_many WHERE username = '${fine_username}')
|
||||||
|
ELSE ${if(left(fine_role,2)=="项目","comm_name = '"+GETUSERDEPARTMENTS(3)+"'","1=1")} END
|
@ -5,7 +5,18 @@
|
|||||||
-- 目 录: xianzuan>2_运营>计划到期明细.fvs
|
-- 目 录: xianzuan>2_运营>计划到期明细.fvs
|
||||||
-- ****************************************
|
-- ****************************************
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- 【数据集: report_计划到期】
|
-- 【数据集: report_计划到期】
|
||||||
|
with one_to_many AS(
|
||||||
|
SELECT
|
||||||
|
a.username AS username -- 用户名
|
||||||
|
,SUBSTRING_INDEX(SUBSTRING_INDEX(a.mang_project, ',',b.help_topic_id + 1),',',-1) AS mang_project -- 管理项目名
|
||||||
|
FROM ods_one_to_many_perm a
|
||||||
|
JOIN mysql.help_topic b
|
||||||
|
on b.help_topic_id < (LENGTH(a.mang_project) - length(replace(a.mang_project,',','')) + 1)
|
||||||
|
WHERE a.username = '${fine_username}'
|
||||||
|
)
|
||||||
select
|
select
|
||||||
${if(len(p_area) == 0,"c.organ_name","c.comm_name")} as p_area
|
${if(len(p_area) == 0,"c.organ_name","c.comm_name")} as p_area
|
||||||
,c.oa_comm_id as oa_comm_id -- oa项目id
|
,c.oa_comm_id as oa_comm_id -- oa项目id
|
||||||
@ -28,6 +39,7 @@ select
|
|||||||
,a.day_diff as day_diff -- 距离计划结束天数
|
,a.day_diff as day_diff -- 距离计划结束天数
|
||||||
,a.responsible_person1 as responsible_person1 -- 责任人编码
|
,a.responsible_person1 as responsible_person1 -- 责任人编码
|
||||||
,b.lastname as executor_name -- 责任人名称
|
,b.lastname as executor_name -- 责任人名称
|
||||||
|
,d.lastname AS lastname -- 执行人
|
||||||
,left(a.end_ym,7) as end_ym -- 计划结束年月
|
,left(a.end_ym,7) as end_ym -- 计划结束年月
|
||||||
from
|
from
|
||||||
(
|
(
|
||||||
@ -44,15 +56,16 @@ from
|
|||||||
,a.finish_date -- 完成时间
|
,a.finish_date -- 完成时间
|
||||||
,TO_DAYS(a.end_date) - TO_DAYS(curdate()) AS day_diff
|
,TO_DAYS(a.end_date) - TO_DAYS(curdate()) AS day_diff
|
||||||
,a.eval_criteria -- 评价标准
|
,a.eval_criteria -- 评价标准
|
||||||
|
,a.executor -- 执行人
|
||||||
FROM dw.dwd_operations_plan_info_d a,
|
FROM dw.dwd_operations_plan_info_d a,
|
||||||
JSON_TABLE (
|
JSON_TABLE (
|
||||||
cast( CONCAT( '["', REPLACE ( responsible_person1, ',', '","' ), '"]' ) AS json ),
|
cast( CONCAT( '["', REPLACE ( responsible_person1, ',', '","' ), '"]' ) AS json ),
|
||||||
"$[*]" COLUMNS ( responsible_person1 INT PATH "$" )
|
"$[*]" COLUMNS ( responsible_person1 INT PATH "$" )
|
||||||
) AS jt
|
) AS jt
|
||||||
-- WHERE TO_DAYS(a.end_date) - TO_DAYS(curdate()) <= 3
|
-- WHERE TO_DAYS(a.end_date) - TO_DAYS(curdate()) <= 3
|
||||||
-- AND TO_DAYS(a.end_date) - TO_DAYS(curdate()) >= 1
|
-- AND TO_DAYS(a.end_date) - TO_DAYS(curdate()) >= 1
|
||||||
where a.end_date > date_format(CURDATE() - INTERVAL 3 day,'%Y-%m-%d')
|
where a.end_date > date_format(CURDATE() - INTERVAL 3 day,'%Y-%m-%d')
|
||||||
and a.end_date <= date_format(CURDATE(),'%Y-%m-%d')
|
and a.end_date <= date_format(CURDATE(),'%Y-%m-%d')
|
||||||
)a
|
)a
|
||||||
left join
|
left join
|
||||||
(
|
(
|
||||||
@ -64,25 +77,39 @@ from
|
|||||||
|
|
||||||
)b
|
)b
|
||||||
on a.responsible_person1 = b.id
|
on a.responsible_person1 = b.id
|
||||||
|
left join
|
||||||
|
(
|
||||||
|
select
|
||||||
|
distinct
|
||||||
|
organ_code -- erp片区id
|
||||||
|
,organ_name -- erp片区名称
|
||||||
|
,comm_id -- erp项目id
|
||||||
|
,comm_name -- erp项目名称
|
||||||
|
,oa_organ_code -- oa片区id
|
||||||
|
,oa_organ_name -- oa片区名称
|
||||||
|
,oa_comm_id -- oa项目id
|
||||||
|
,oa_comm_name -- oa项目名称
|
||||||
|
from dim_organ_mapping -- 组织结构映射维度表
|
||||||
|
-- where comm_id is not null
|
||||||
|
)c
|
||||||
|
on b.subcompanyid1 = c.oa_comm_id
|
||||||
left join
|
left join
|
||||||
(
|
(
|
||||||
select
|
select
|
||||||
distinct
|
id
|
||||||
organ_code -- erp片区id
|
,subcompanyid1 -- 公司id
|
||||||
,organ_name -- erp片区名称
|
,lastname -- 执行人
|
||||||
,comm_id -- erp项目id
|
from dw.ods_oa_hrmresource_d
|
||||||
,comm_name -- erp项目名称
|
|
||||||
,oa_organ_code -- oa片区id
|
)d
|
||||||
,oa_organ_name -- oa片区名称
|
on a.executor = d.id
|
||||||
,oa_comm_id -- oa项目id
|
where 1 = 1
|
||||||
,oa_comm_name -- oa项目名称
|
|
||||||
from dim_organ_mapping -- 组织结构映射维度表
|
|
||||||
where comm_id is not null
|
|
||||||
)c
|
|
||||||
on b.subcompanyid1 = c.oa_comm_id
|
|
||||||
where 1 = 1
|
|
||||||
${if(len(p_startdate) == 0,"","and left(a.end_ym,7) = '" + p_startdate + "'")}
|
${if(len(p_startdate) == 0,"","and left(a.end_ym,7) = '" + p_startdate + "'")}
|
||||||
${IF(LEN(p_area)!=0," and organ_code IN ('"+p_area+"')","")}
|
${IF(LEN(p_area)!=0," and organ_code IN ('"+p_area+"')","")}
|
||||||
|
-- ${if(left(fine_role,2)=="项目","and comm_name = '"+GETUSERDEPARTMENTS(3)+"'","")}
|
||||||
|
AND CASE WHEN (SELECT mang_project FROM ods_one_to_many_perm WHERE username = '${fine_username}' AND mang_organ IS NULL) IS NOT NULL
|
||||||
|
THEN comm_name IN (SELECT mang_project FROM one_to_many WHERE username = '${fine_username}')
|
||||||
|
ELSE ${if(left(fine_role,2)=="项目","comm_name = '"+GETUSERDEPARTMENTS(3)+"'","1=1")} END
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
32
finereport/xiazuan/权责亏损项目明细.sql
Normal file
32
finereport/xiazuan/权责亏损项目明细.sql
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
with one_to_many AS(
|
||||||
|
SELECT
|
||||||
|
a.username AS username -- 用户名
|
||||||
|
,SUBSTRING_INDEX(SUBSTRING_INDEX(a.mang_project, ',',b.help_topic_id + 1),',',-1) AS mang_project -- 管理项目名
|
||||||
|
FROM ods_one_to_many_perm a
|
||||||
|
JOIN mysql.help_topic b
|
||||||
|
on b.help_topic_id < (LENGTH(a.mang_project) - length(replace(a.mang_project,',','')) + 1)
|
||||||
|
WHERE a.username = '${fine_username}'
|
||||||
|
)
|
||||||
|
SELECT
|
||||||
|
organ_code -- erp片区code
|
||||||
|
,organ_name -- erp片区名称
|
||||||
|
,comm_id -- 项目id
|
||||||
|
,comm_name -- 项目名称
|
||||||
|
,index_income_target -- 收入目标
|
||||||
|
,index_income_fact -- 收入完成
|
||||||
|
,income_completion_rate -- 完成率
|
||||||
|
,index_cost_target -- 成本目标
|
||||||
|
,index_cost_fact -- 成本完成
|
||||||
|
,cost_completion_rate -- 完成率
|
||||||
|
,index_profit_target -- 利润目标
|
||||||
|
,index_profit_fact -- 利润完成
|
||||||
|
,profit_completion_rate -- 完成率
|
||||||
|
,index_market_target -- 市扩目标
|
||||||
|
,index_market_fact -- 市扩完成
|
||||||
|
,market_completion_rate -- 完成率
|
||||||
|
from ods_caiwu_feecollection
|
||||||
|
where category = '物业'
|
||||||
|
and index_profit_fact < 0
|
||||||
|
${IF(LEN(p_startdate)>0," AND yr_month ='" + p_startdate + "'","and yr_month = '2024-06' ")}
|
||||||
|
${if(len(p_area) == 0,"","and organ_code in ('" + p_area + "')")}
|
||||||
|
${IF(LEN(p_shop)!=0," and comm_name IN ('"+JOINARRAY(p_shop,"','")+"')","")}
|
90
finereport/问题修复/计划到期明细组织架构为空.sql
Normal file
90
finereport/问题修复/计划到期明细组织架构为空.sql
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
SELECT
|
||||||
|
c.organ_name
|
||||||
|
,c.comm_name
|
||||||
|
,c.oa_comm_id as oa_comm_id -- oa项目id
|
||||||
|
,c.oa_comm_name as oa_comm_name -- oa项目名称
|
||||||
|
,c.oa_organ_code as oa_organ_code -- oa片区id
|
||||||
|
,c.oa_organ_name as oa_organ_name -- oa片区名称
|
||||||
|
,c.organ_code as organ_code -- erp片区编码
|
||||||
|
,c.organ_name as organ_name -- erp片区名称
|
||||||
|
,c.comm_id as comm_id -- erp项目id
|
||||||
|
,c.comm_name as comm_name -- erp项目名称
|
||||||
|
,b.subcompanyid1 as subcompanyid1 -- 公司id
|
||||||
|
,a.plan_name as plan_name -- 计划名称
|
||||||
|
,a.eval_criteria as plan_desc -- 计划内容
|
||||||
|
,a.plan_level as plan_level -- 计划等级
|
||||||
|
,left(a.start_date,7) as ym -- 计划开始年月
|
||||||
|
,a.start_dt as start_dt -- 计划开始时
|
||||||
|
,a.end_date as end_date -- 计划结束时间
|
||||||
|
,a.finish_date as finish_date -- 计划完成时间
|
||||||
|
,a.input_date as input_date -- 计划录入时间
|
||||||
|
,a.day_diff as day_diff -- 距离计划结束天数
|
||||||
|
,a.responsible_person1 as responsible_person1 -- 责任人编码
|
||||||
|
,b.lastname as executor_name -- 责任人名称
|
||||||
|
,left(a.end_ym,7) as end_ym -- 计划结束年月
|
||||||
|
from
|
||||||
|
(
|
||||||
|
SELECT
|
||||||
|
concat(left(trim(start_date),5),lpad(substring_index(substring_index(trim(start_date),'-',2),'-',-1),2,0),right(trim(start_date),3)) as start_date
|
||||||
|
,a.start_date as start_dt -- 计划开始时间
|
||||||
|
,a.plan_level -- 计划等级
|
||||||
|
,jt.responsible_person1 -- 责任人
|
||||||
|
,a.plan_status -- 计划状态
|
||||||
|
,a.input_date -- 录入时间
|
||||||
|
,a.end_date -- 计划结束时间
|
||||||
|
,a.plan_name -- 计划名称
|
||||||
|
,concat(left(trim(end_date),5),lpad(substring_index(substring_index(trim(end_date),'-',2),'-',-1),2,0),right(trim(end_date),3)) as end_ym
|
||||||
|
,a.finish_date -- 完成时间
|
||||||
|
,TO_DAYS(a.end_date) - TO_DAYS(curdate()) AS day_diff
|
||||||
|
,a.eval_criteria -- 评价标准
|
||||||
|
FROM dw.dwd_operations_plan_info_d a,
|
||||||
|
JSON_TABLE (
|
||||||
|
cast( CONCAT( '["', REPLACE ( responsible_person1, ',', '","' ), '"]' ) AS json ),
|
||||||
|
"$[*]" COLUMNS ( responsible_person1 INT PATH "$" )
|
||||||
|
) AS jt
|
||||||
|
-- WHERE TO_DAYS(a.end_date) - TO_DAYS(curdate()) <= 3
|
||||||
|
-- AND TO_DAYS(a.end_date) - TO_DAYS(curdate()) >= 1
|
||||||
|
where a.end_date > date_format(CURDATE() - INTERVAL 3 day,'%Y-%m-%d')
|
||||||
|
and a.end_date <= date_format(CURDATE(),'%Y-%m-%d')
|
||||||
|
)a
|
||||||
|
left join
|
||||||
|
(
|
||||||
|
select
|
||||||
|
id
|
||||||
|
,subcompanyid1 -- 公司id
|
||||||
|
,lastname -- 执行人
|
||||||
|
from dw.ods_oa_hrmresource_d
|
||||||
|
|
||||||
|
)b
|
||||||
|
on a.responsible_person1 = b.id
|
||||||
|
left join
|
||||||
|
(
|
||||||
|
select
|
||||||
|
distinct
|
||||||
|
organ_code -- erp片区id
|
||||||
|
,organ_name -- erp片区名称
|
||||||
|
,comm_id -- erp项目id
|
||||||
|
,comm_name -- erp项目名称
|
||||||
|
,oa_organ_code -- oa片区id
|
||||||
|
,oa_organ_name -- oa片区名称
|
||||||
|
,oa_comm_id -- oa项目id
|
||||||
|
,oa_comm_name -- oa项目名称
|
||||||
|
from dim_organ_mapping -- 组织结构映射维度表
|
||||||
|
-- WHERE oa_comm_id = '610'
|
||||||
|
WHERE oa_organ_code = '610'
|
||||||
|
-- where comm_id is not null
|
||||||
|
)c
|
||||||
|
on b.subcompanyid1 = c.oa_comm_id
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
select
|
||||||
|
id
|
||||||
|
,subcompanyid1 -- 公司id
|
||||||
|
,lastname -- 执行人
|
||||||
|
from dw.ods_oa_hrmresource_d
|
||||||
|
WHERE ods_oa_hrmresource_d.subcompanyid1 = '610';
|
Loading…
Reference in New Issue
Block a user