四大业务指标完成情况填报表优化+出租率数据异常排查
This commit is contained in:
parent
c71620b936
commit
b47163472f
@ -40,5 +40,17 @@
|
||||
</jdbc-additional-properties>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
<data-source source="LOCAL" name="BS生产" uuid="9fa5f892-0d22-41eb-a346-02d5e4aa0610">
|
||||
<driver-ref>mysql.8</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>com.mysql.cj.jdbc.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mysql://172.18.1.100:3306</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>
|
||||
</project>
|
@ -3,15 +3,20 @@
|
||||
<component name="SqlDialectMappings">
|
||||
<file url="file://$PROJECT_DIR$/dw/dim/dim_building_info_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_business_room_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/dwd/dwd_business_contract_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/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_inspect_task_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$/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/kanban/pc/总裁.sql" dialect="MySQL" />
|
||||
<file url="file://$PROJECT_DIR$/finereport/tianbao/6_innovation/多经四大业务指标完成情况填报表.sql" dialect="MySQL" />
|
||||
|
0
finereport/kanban/mobile/工程_mobile.sql
Normal file
0
finereport/kanban/mobile/工程_mobile.sql
Normal file
0
finereport/kanban/mobile/法务_mobile.sql
Normal file
0
finereport/kanban/mobile/法务_mobile.sql
Normal file
0
finereport/kanban/mobile/物业_mobile.sql
Normal file
0
finereport/kanban/mobile/物业_mobile.sql
Normal file
0
finereport/kanban/mobile/财务_mobile.sql
Normal file
0
finereport/kanban/mobile/财务_mobile.sql
Normal file
0
finereport/kanban/mobile/运营_mobile.sql
Normal file
0
finereport/kanban/mobile/运营_mobile.sql
Normal file
0
finereport/kanban/pc/人力.sql
Normal file
0
finereport/kanban/pc/人力.sql
Normal file
72
finereport/kanban/pc/创新生态.sql
Normal file
72
finereport/kanban/pc/创新生态.sql
Normal file
@ -0,0 +1,72 @@
|
||||
-- 【report_指标卡_填报】
|
||||
|
||||
SELECT
|
||||
-- 收入汇总费用
|
||||
SUM(CASE WHEN business_type = '收入' THEN COALESCE(revenue_value,0) ELSE 0 END) as revenue_value -- 四大业务收入
|
||||
,SUM(CASE WHEN revenue_type = '附属' AND business_type = '收入' THEN COALESCE(revenue_value,0) ELSE 0 END) AS revenue_value_1 -- 空间运营收入
|
||||
,SUM(CASE WHEN revenue_type = '拎包' AND business_type = '收入' THEN COALESCE(revenue_value,0) ELSE 0 END) AS revenue_value_2 -- 美居收入
|
||||
,SUM(CASE WHEN revenue_type = '创新' AND business_type = '收入' THEN COALESCE(revenue_value,0) ELSE 0 END) AS revenue_value_3 -- 新零售收入
|
||||
,SUM(CASE WHEN revenue_type = '资产' AND business_type = '收入' THEN COALESCE(revenue_value,0) ELSE 0 END) AS revenue_value_4 -- 资产出租收入
|
||||
|
||||
-- 收入完成率
|
||||
,CASE WHEN SUM(CASE WHEN business_type = '目标' THEN COALESCE(revenue_value,0) ELSE 0 END) = 0 THEN 0
|
||||
ELSE SUM(CASE WHEN business_type = '收入' THEN COALESCE(revenue_value,0) ELSE 0 END)
|
||||
/ SUM(CASE WHEN business_type = '目标' THEN COALESCE(revenue_value,0) ELSE 0 END)
|
||||
END AS finish_rate -- 四大业务收入完成率
|
||||
|
||||
,CASE WHEN SUM(CASE WHEN revenue_type = '附属' AND business_type = '目标' THEN COALESCE(revenue_value,0) ELSE 0 END) = 0 THEN 0
|
||||
ELSE SUM(CASE WHEN revenue_type = '附属' AND business_type = '收入' THEN COALESCE(revenue_value,0) ELSE 0 END)
|
||||
/ SUM(CASE WHEN revenue_type = '附属' AND business_type = '目标' THEN COALESCE(revenue_value,0) ELSE 0 END)
|
||||
END AS finish_rate_1 -- 空间运营收入完成率
|
||||
|
||||
,CASE WHEN SUM(CASE WHEN revenue_type = '拎包' AND business_type = '目标' THEN COALESCE(revenue_value,0) ELSE 0 END) = 0 THEN 0
|
||||
ELSE SUM(CASE WHEN revenue_type = '拎包' AND business_type = '收入' THEN COALESCE(revenue_value,0) ELSE 0 END)
|
||||
/ SUM(CASE WHEN revenue_type = '拎包' AND business_type = '目标' THEN COALESCE(revenue_value,0) ELSE 0 END)
|
||||
END AS finish_rate_2 -- 美居收入完成率
|
||||
|
||||
,CASE WHEN SUM(CASE WHEN revenue_type = '创新' AND business_type = '目标' THEN COALESCE(revenue_value,0) ELSE 0 END) = 0 THEN 0
|
||||
ELSE SUM(CASE WHEN revenue_type = '创新' AND business_type = '收入' THEN COALESCE(revenue_value,0) ELSE 0 END)
|
||||
/ SUM(CASE WHEN revenue_type = '创新' AND business_type = '目标' THEN COALESCE(revenue_value,0) ELSE 0 END)
|
||||
END AS finish_rate_3 -- 新零售收入完成率
|
||||
|
||||
,CASE WHEN SUM(CASE WHEN revenue_type = '资产' AND business_type = '目标' THEN COALESCE(revenue_value,0) ELSE 0 END) = 0 THEN 0
|
||||
ELSE SUM(CASE WHEN revenue_type = '资产' AND business_type = '收入' THEN COALESCE(revenue_value,0) ELSE 0 END)
|
||||
/ SUM(CASE WHEN revenue_type = '资产' AND business_type = '目标' THEN COALESCE(revenue_value,0) ELSE 0 END)
|
||||
END AS finish_rate_4 -- 资产出租收入完成率
|
||||
|
||||
FROM dw.ods_innoveco_metrics_finish_d
|
||||
WHERE business_type in('收入','目标') -- 业务类型
|
||||
AND YM = '${p_ym}'
|
||||
${IF(LEN(p_area)>0," AND organ_code IN ('"+JOINARRAY(p_area,"','")+"')", "")}
|
||||
;
|
||||
|
||||
|
||||
-- report_指标卡
|
||||
|
||||
|
||||
WITH T1 AS (/*各类别应收与实收*/
|
||||
SELECT
|
||||
index_type,
|
||||
SUM(IFNULL(index_receivable,0)) AS 应收金额,
|
||||
SUM(IFNULL(index_receipts,0)) AS 实收金额
|
||||
FROM ods_caiwu_profit
|
||||
WHERE 1=1
|
||||
-- AND `year_month` = '${REPLACE(p_ym,"-","")}'
|
||||
-- ${IF(LEN(p_area)>0," AND organ_code IN ('"+JOINARRAY(p_area,"','")+"')", "")}
|
||||
-- ${IF(LEN(p_prgject)>0," AND comm_id IN ('"+JOINARRAY(p_prgject,"','")+"')", "")}
|
||||
GROUP BY index_type
|
||||
)
|
||||
SELECT
|
||||
SUM(CASE WHEN index_type = '附属资源/空间运营' THEN 实收金额 ELSE 0 END) AS 空间运营实收,
|
||||
SUM(CASE WHEN index_type = '附属资源/空间运营' THEN 实收金额 / 应收金额 ELSE 0 END) AS 空间运营完成率,
|
||||
SUM(CASE WHEN index_type = '美居' THEN 实收金额 ELSE 0 END) AS 美居实收,
|
||||
SUM(CASE WHEN index_type = '美居' THEN 实收金额 / 应收金额 ELSE 0 END) AS 美居完成率,
|
||||
SUM(CASE WHEN index_type = '社商/新零售' THEN 实收金额 ELSE 0 END) AS 新零售实收,
|
||||
SUM(CASE WHEN index_type = '社商/新零售' THEN 实收金额 / 应收金额 ELSE 0 END) AS 新零售完成率,
|
||||
SUM(CASE WHEN index_type = '资产运营/资产租售' THEN 实收金额 ELSE 0 END) AS 资产出租实收,
|
||||
SUM(CASE WHEN index_type = '资产运营/资产租售' THEN 实收金额 / 应收金额 ELSE 0 END) AS 资产出租完成率,
|
||||
SUM(实收金额) AS 全部实收,
|
||||
IFNULL(SUM(实收金额) / SUM(应收金额),0) AS 完成率
|
||||
FROM T1
|
||||
;
|
||||
|
71
finereport/kanban/pc/商业.sql
Normal file
71
finereport/kanban/pc/商业.sql
Normal file
@ -0,0 +1,71 @@
|
||||
-- 【出租率】
|
||||
|
||||
|
||||
SELECT
|
||||
`type`
|
||||
, sum(lease_area)/sum(construction_area) rent_rate
|
||||
FROM dws_business_rent_rate_d
|
||||
${if(len(project) == 0,"","where project_id in (" + project + ")")}
|
||||
group by `type`
|
||||
|
||||
|
||||
|
||||
-- 【出租面积】
|
||||
|
||||
SELECT
|
||||
project_id
|
||||
, project_name
|
||||
, `type`
|
||||
, construction_area/10000 construction_area -- 建筑面积
|
||||
, lease_area/10000 lease_area
|
||||
, lease_area/construction_area rent_rate
|
||||
|
||||
SELECT
|
||||
sum(lease_area ) as lease_area -- 出租面积
|
||||
,sum(construction_area) as construction_area -- 建筑面积
|
||||
, sum(lease_area ) / sum(construction_area) as rate
|
||||
FROM dw.dws_business_rent_rate_d
|
||||
where lease_end_date >= '2024-07-25' -- 合同结束时间
|
||||
and lease_start_date <= '2024-07-25'
|
||||
|
||||
;
|
||||
|
||||
|
||||
|
||||
|
||||
${if(len(project) == 0,"","where project_id in (" + project + ")")}
|
||||
|
||||
;
|
||||
-- 出租率计算: sum(出租面积.select(lease_area))/sum(出租面积.select(construction_area)) -- 正确值: 33.45%
|
||||
|
||||
|
||||
|
||||
-- 【收款金额】
|
||||
SELECT
|
||||
sum(received_money) 实收金额
|
||||
,sum(current_sure_money) 收款金额
|
||||
,sum(received_money) / sum(current_sure_money) rate
|
||||
|
||||
,sum(areare_money) as areare_money
|
||||
,sum(current_sure_money) as current_sure_money
|
||||
|
||||
,sum(areare_money) / sum(current_sure_money) as rate1
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
project_id
|
||||
, project_name
|
||||
, accrual_month
|
||||
, current_sure_money/10000 current_sure_money -- 收款金额 收款金额
|
||||
, received_money/10000 received_money -- 实收金额
|
||||
, areare_money/10000 areare_money -- 欠收金额
|
||||
FROM dws_business_bill_m
|
||||
where left(accrual_month,7) = '2024-06'
|
||||
-- ${if(len(project) == 0,"","and project_id in (" + project + ")")}
|
||||
)T
|
||||
|
||||
-- 收缴率 64.8 截至 24
|
||||
|
||||
-- sum(收款金额.select(received_money))/sum(收款金额.select(current_sure_money))
|
||||
|
||||
-- 欠缴 / 应缴
|
0
finereport/kanban/pc/法务.sql
Normal file
0
finereport/kanban/pc/法务.sql
Normal file
0
finereport/kanban/pc/财务.sql
Normal file
0
finereport/kanban/pc/财务.sql
Normal file
0
finereport/kanban/pc/运营.sql
Normal file
0
finereport/kanban/pc/运营.sql
Normal file
@ -56,17 +56,17 @@ FROM
|
||||
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 = '0102' THEN 2 -- 成都片区
|
||||
WHEN organ_code = '0101' THEN 3 -- 乐山片区
|
||||
WHEN organ_code = '0115' THEN 4 -- 眉山片区
|
||||
WHEN organ_code = '0120' THEN 5 -- 攀西片区
|
||||
WHEN organ_code = '0106' THEN 6 -- 长春片区
|
||||
WHEN organ_code = '0109' THEN 7 -- 大湾片区
|
||||
WHEN organ_code = '0108' THEN 8 -- 商写片区
|
||||
WHEN organ_code = '0116' THEN 9 -- 川东北片区
|
||||
WHEN organ_code = '0103' THEN 10 -- 库尔勒片区
|
||||
WHEN organ_code = '0117' THEN 11 -- 乌鲁木齐片区
|
||||
WHEN organ_code = '0118' THEN 12 -- 喀什片区
|
||||
WHEN organ_code = '0114' THEN 13 -- 雅华片区
|
||||
else 999
|
||||
END AS RK
|
||||
@ -78,8 +78,10 @@ SELECT
|
||||
DISTINCT
|
||||
cx_oragan_code AS organ_code
|
||||
, cx_oragan_name AS organ_name
|
||||
, 14 AS RK
|
||||
,CASE WHEN cx_oragan_code = '6002' THEN 1
|
||||
WHEN cx_oragan_code = '6001' THEN 14
|
||||
END AS RK
|
||||
FROM dim_organ_mapping
|
||||
where cx_oragan_code = '6001'
|
||||
where cx_oragan_code in('6001','6002')
|
||||
)T
|
||||
ORDER BY T.RK;
|
||||
|
0
finereport/xiazuan/2_operation/1_计划运营情况.sql
Normal file
0
finereport/xiazuan/2_operation/1_计划运营情况.sql
Normal file
0
finereport/xiazuan/2_operation/4_接房入住情况.sql
Normal file
0
finereport/xiazuan/2_operation/4_接房入住情况.sql
Normal file
0
finereport/xiazuan/3_property/2_报事情况报表.sql
Normal file
0
finereport/xiazuan/3_property/2_报事情况报表.sql
Normal file
0
finereport/xiazuan/3_property/3_飞检得分明细.sql
Normal file
0
finereport/xiazuan/3_property/3_飞检得分明细.sql
Normal file
0
finereport/xiazuan/6_innovation/1_新零售订单明细_片区.sql
Normal file
0
finereport/xiazuan/6_innovation/1_新零售订单明细_片区.sql
Normal file
0
finereport/xiazuan/6_innovation/2_新零售订单明细_品类.sql
Normal file
0
finereport/xiazuan/6_innovation/2_新零售订单明细_品类.sql
Normal file
0
finereport/xiazuan/6_innovation/3_新零售销售预警明细.sql
Normal file
0
finereport/xiazuan/6_innovation/3_新零售销售预警明细.sql
Normal file
0
finereport/xiazuan/6_innovation/4_小悦到家服务销售明细.sql
Normal file
0
finereport/xiazuan/6_innovation/4_小悦到家服务销售明细.sql
Normal file
0
finereport/xiazuan/6_innovation/5_多经合同到期情况.sql
Normal file
0
finereport/xiazuan/6_innovation/5_多经合同到期情况.sql
Normal file
31
finereport/xiazuan/7_business/1_出租率明细报表.sql
Normal file
31
finereport/xiazuan/7_business/1_出租率明细报表.sql
Normal file
@ -0,0 +1,31 @@
|
||||
-- 【dic_项目】
|
||||
|
||||
SELECT DISTINCT
|
||||
project_id AS 项目id,
|
||||
project_name AS 项目名称
|
||||
FROM dws_business_rent_rate_d
|
||||
WHERE 1=1
|
||||
${IF(LEN(p_type)>0,"AND type IN ('"+JOINARRAY(p_type,"','")+"')","")}
|
||||
|
||||
|
||||
-- 【dic_业态】
|
||||
|
||||
SELECT DISTINCT
|
||||
type AS 业态
|
||||
FROM dws_business_rent_rate_d
|
||||
|
||||
|
||||
-- 【report_1_指标卡】
|
||||
|
||||
SELECT
|
||||
project_name AS 项目,
|
||||
COUNT(project_id) AS 资产数量,
|
||||
SUM(IFNULL(construction_area,0)) AS 资产面积,
|
||||
SUM(IFNULL(lease_area,0)) AS 已出租面积
|
||||
FROM dws_business_rent_rate_d T1
|
||||
WHERE 1=1
|
||||
${IF(LEN(p_startdate)>0,"AND T1.lease_start_date <= '"+FORMAT(p_startdate,"yyyy-MM-dd 00:00:00")+"'","")}
|
||||
${IF(LEN(p_enddate)>0,"AND T1.lease_end_date >= '"+FORMAT(p_enddate,"yyyy-MM-dd 00:00:00")+"'","")}
|
||||
${IF(LEN(p_type)>0," AND T1.type IN ('"+JOINARRAY(p_type,"','")+"')", "")}
|
||||
${IF(LEN(p_project)>0," AND T1.project_id IN ('"+JOINARRAY(p_project,"','")+"')", "")}
|
||||
GROUP BY project_name
|
0
finereport/xiazuan/8_legal/1_法务应收款智能报表.sql
Normal file
0
finereport/xiazuan/8_legal/1_法务应收款智能报表.sql
Normal file
0
finereport/xiazuan/8_legal/2_移交数据明细报表.sql
Normal file
0
finereport/xiazuan/8_legal/2_移交数据明细报表.sql
Normal file
Loading…
Reference in New Issue
Block a user