diff --git a/.idea/dataSources.xml b/.idea/dataSources.xml
index 02e1a61..3a8ea2e 100644
--- a/.idea/dataSources.xml
+++ b/.idea/dataSources.xml
@@ -40,5 +40,17 @@
$ProjectFileDir$
+
+ mysql.8
+ true
+ com.mysql.cj.jdbc.Driver
+ jdbc:mysql://172.18.1.100:3306
+
+
+
+
+
+ $ProjectFileDir$
+
\ No newline at end of file
diff --git a/.idea/sqldialects.xml b/.idea/sqldialects.xml
index 0dfa1b4..42cee4a 100644
--- a/.idea/sqldialects.xml
+++ b/.idea/sqldialects.xml
@@ -3,15 +3,20 @@
+
+
+
+
+
diff --git a/finereport/kanban/mobile/工程_mobile.sql b/finereport/kanban/mobile/工程_mobile.sql
new file mode 100644
index 0000000..e69de29
diff --git a/finereport/kanban/mobile/法务_mobile.sql b/finereport/kanban/mobile/法务_mobile.sql
new file mode 100644
index 0000000..e69de29
diff --git a/finereport/kanban/mobile/物业_mobile.sql b/finereport/kanban/mobile/物业_mobile.sql
new file mode 100644
index 0000000..e69de29
diff --git a/finereport/kanban/mobile/财务_mobile.sql b/finereport/kanban/mobile/财务_mobile.sql
new file mode 100644
index 0000000..e69de29
diff --git a/finereport/kanban/mobile/运营_mobile.sql b/finereport/kanban/mobile/运营_mobile.sql
new file mode 100644
index 0000000..e69de29
diff --git a/finereport/kanban/pc/人力.sql b/finereport/kanban/pc/人力.sql
new file mode 100644
index 0000000..e69de29
diff --git a/finereport/kanban/pc/创新生态.sql b/finereport/kanban/pc/创新生态.sql
new file mode 100644
index 0000000..2c20f53
--- /dev/null
+++ b/finereport/kanban/pc/创新生态.sql
@@ -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
+;
+
diff --git a/finereport/kanban/pc/商业.sql b/finereport/kanban/pc/商业.sql
new file mode 100644
index 0000000..7107868
--- /dev/null
+++ b/finereport/kanban/pc/商业.sql
@@ -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))
+
+-- 欠缴 / 应缴
\ No newline at end of file
diff --git a/finereport/kanban/pc/法务.sql b/finereport/kanban/pc/法务.sql
new file mode 100644
index 0000000..e69de29
diff --git a/finereport/kanban/pc/财务.sql b/finereport/kanban/pc/财务.sql
new file mode 100644
index 0000000..e69de29
diff --git a/finereport/kanban/pc/运营.sql b/finereport/kanban/pc/运营.sql
new file mode 100644
index 0000000..e69de29
diff --git a/finereport/tianbao/6_innovation/多经四大业务指标完成情况填报表.sql b/finereport/tianbao/6_innovation/多经四大业务指标完成情况填报表.sql
index 362cf6a..f1b6b3f 100644
--- a/finereport/tianbao/6_innovation/多经四大业务指标完成情况填报表.sql
+++ b/finereport/tianbao/6_innovation/多经四大业务指标完成情况填报表.sql
@@ -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;
diff --git a/finereport/xiazuan/2_operation/1_计划运营情况.sql b/finereport/xiazuan/2_operation/1_计划运营情况.sql
new file mode 100644
index 0000000..e69de29
diff --git a/finereport/xiazuan/2_operation/4_接房入住情况.sql b/finereport/xiazuan/2_operation/4_接房入住情况.sql
new file mode 100644
index 0000000..e69de29
diff --git a/finereport/xiazuan/3_property/2_报事情况报表.sql b/finereport/xiazuan/3_property/2_报事情况报表.sql
new file mode 100644
index 0000000..e69de29
diff --git a/finereport/xiazuan/3_property/3_飞检得分明细.sql b/finereport/xiazuan/3_property/3_飞检得分明细.sql
new file mode 100644
index 0000000..e69de29
diff --git a/finereport/xiazuan/6_innovation/1_新零售订单明细_片区.sql b/finereport/xiazuan/6_innovation/1_新零售订单明细_片区.sql
new file mode 100644
index 0000000..e69de29
diff --git a/finereport/xiazuan/6_innovation/2_新零售订单明细_品类.sql b/finereport/xiazuan/6_innovation/2_新零售订单明细_品类.sql
new file mode 100644
index 0000000..e69de29
diff --git a/finereport/xiazuan/6_innovation/3_新零售销售预警明细.sql b/finereport/xiazuan/6_innovation/3_新零售销售预警明细.sql
new file mode 100644
index 0000000..e69de29
diff --git a/finereport/xiazuan/6_innovation/4_小悦到家服务销售明细.sql b/finereport/xiazuan/6_innovation/4_小悦到家服务销售明细.sql
new file mode 100644
index 0000000..e69de29
diff --git a/finereport/xiazuan/6_innovation/5_多经合同到期情况.sql b/finereport/xiazuan/6_innovation/5_多经合同到期情况.sql
new file mode 100644
index 0000000..e69de29
diff --git a/finereport/xiazuan/7_business/1_出租率明细报表.sql b/finereport/xiazuan/7_business/1_出租率明细报表.sql
new file mode 100644
index 0000000..b9ab7e9
--- /dev/null
+++ b/finereport/xiazuan/7_business/1_出租率明细报表.sql
@@ -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
\ No newline at end of file
diff --git a/finereport/xiazuan/8_legal/1_法务应收款智能报表.sql b/finereport/xiazuan/8_legal/1_法务应收款智能报表.sql
new file mode 100644
index 0000000..e69de29
diff --git a/finereport/xiazuan/8_legal/2_移交数据明细报表.sql b/finereport/xiazuan/8_legal/2_移交数据明细报表.sql
new file mode 100644
index 0000000..e69de29
diff --git a/映射表规范.md b/映射表规范.md
index 707ffef..bf7fe09 100644
--- a/映射表规范.md
+++ b/映射表规范.md
@@ -28,6 +28,7 @@
【创新四大业务指标完成情况 新增片区如下】 2024-07-24
-| 片区id | 片区 |
-|------|----------|
-| 6001 | 资阳佳美|
+| 片区id | 片区 |
+|------|------|
+| 6001 | 资阳佳美 |
+| 6002 | 总部职能 |