创新生态移动端看板数据对齐+御和泰销售预警明细、新零售订单明细报表开发
This commit is contained in:
parent
30c1766af4
commit
20d271a167
@ -12,6 +12,7 @@
|
||||
<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_stat_exception_rate_d.sql" dialect="MySQL" />
|
||||
<file url="file://$PROJECT_DIR$/dw/dwd/dwd_innoveco_order_info_d.sql" dialect="MySQL" />
|
||||
<file url="file://$PROJECT_DIR$/dw/dws/dws_business_bill_m.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" />
|
||||
@ -32,6 +33,7 @@
|
||||
<file url="file://$PROJECT_DIR$/finereport/xiazuan/3_property/2_报事情况报表.sql" dialect="MySQL" />
|
||||
<file url="file://$PROJECT_DIR$/finereport/xiazuan/3_property/4_投诉明细.sql" dialect="MySQL" />
|
||||
<file url="file://$PROJECT_DIR$/finereport/xiazuan/4_engine/1_异常抬杆下钻明细.sql" dialect="MySQL" />
|
||||
<file url="file://$PROJECT_DIR$/finereport/xiazuan/6_innovation/新零售订单明细.sql" dialect="MySQL" />
|
||||
<file url="PROJECT" dialect="MySQL" />
|
||||
</component>
|
||||
</project>
|
@ -188,4 +188,269 @@ FROM T1
|
||||
SELECT
|
||||
CONCAT(assessment_occupany_rate,'%') AS 完成率
|
||||
FROM dws_point_occupancy_rate_summary_all
|
||||
WHERE ym = '${REPLACE(p_ym,"-","")}'
|
||||
WHERE ym = '${REPLACE(p_ym,"-","")}'
|
||||
|
||||
|
||||
|
||||
|
||||
-- ======================================
|
||||
-- report_1_空间运营_new
|
||||
-- ======================================
|
||||
|
||||
SELECT
|
||||
organ_name
|
||||
,assessment_occupany_rate AS 出租率
|
||||
,total_occupany_rate
|
||||
,ROW_NUMBER() OVER (ORDER BY assessment_occupany_rate ${IF(p_kj = "低于50%","ASC","DESC")}) AS 序号
|
||||
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
|
||||
${IF(LEN(p_area)>0,"comm_name", "organ_name")} AS organ_name
|
||||
,assessment_occupany_rate AS assessment_occupany_rate
|
||||
,total_occupany_rate as total_occupany_rate
|
||||
FROM dw.dws_point_occupancy_rate_summary_project
|
||||
WHERE 1=1
|
||||
AND assessment_occupany_rate IS NOT NULL
|
||||
AND ym = DATE_FORMAT(CURDATE(),'%Y%m')
|
||||
${IF(LEN(p_area)>0," AND organ_code IN ('"+JOINARRAY(p_area,"','")+"')", "")}
|
||||
${if(left(fine_role,2)=="项目","and comm_name = '"+GETUSERDEPARTMENTS(3)+"'","")}
|
||||
)T
|
||||
ORDER BY assessment_occupany_rate ${IF(p_kj = "低于50%","ASC","DESC")}
|
||||
LIMIT 5
|
||||
|
||||
|
||||
|
||||
-- ======================================
|
||||
-- 新零售
|
||||
-- ======================================
|
||||
|
||||
SELECT
|
||||
T1.organ_comm_name AS organ_name
|
||||
,T1.FINISH_RATE AS 销售完成率
|
||||
,T1.sale_target / 10000 AS sale_target
|
||||
,T1.sale_amt / 10000 AS sale_amt
|
||||
,ROW_NUMBER() OVER (ORDER BY T1.FINISH_RATE ${IF(p_xls = "低于50%","ASC","DESC")}) AS 序号
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
-- B.organ_code
|
||||
-- ,B.organ_name
|
||||
-- ,B.comm_id
|
||||
-- ,B.comm_name
|
||||
${IF(LEN(p_area)>0,"B.comm_name", "B.organ_name")} AS organ_comm_name
|
||||
-- ,SUM(B.sale_target) AS sale_target
|
||||
,SUM(IFNULL(A.sale_amt,0)) + SUM(IFNULL(B.sale_fact,0)) AS sale_amt
|
||||
,SUM(IFNULL(B.sale_target,0)) AS sale_target
|
||||
,CASE WHEN SUM(IFNULL(B.sale_target,0)) = 0 THEN 0
|
||||
ELSE SUM(IFNULL(A.sale_amt,0)) + SUM(IFNULL(B.sale_fact,0)) / SUM(IFNULL
|
||||
(B.sale_target,0))
|
||||
END AS FINISH_RATE -- 销售完成率
|
||||
FROM
|
||||
(
|
||||
select
|
||||
organ_code
|
||||
,organ_name
|
||||
,comm_id
|
||||
,comm_name
|
||||
,sum(case when create_ym = '202406' then 0 else sale_amt end) sale_amt -- 202406填报数据为线下+线下,所以不取线上数据
|
||||
from dw.dws_innoveco_new_retail_m
|
||||
where create_ym = '${REPLACE(p_ym,"-","")}'
|
||||
group by
|
||||
organ_code
|
||||
,organ_name
|
||||
,comm_id
|
||||
,comm_name
|
||||
)A
|
||||
RIGHT JOIN
|
||||
(
|
||||
SELECT
|
||||
organ_code
|
||||
,organ_name
|
||||
,comm_id
|
||||
,comm_name
|
||||
,SUM(IFNULL(index_retail_target,0))*10000 AS sale_target
|
||||
,SUM(index_retail_fact)*10000 AS sale_fact
|
||||
FROM dw.ods_innoveco_offlinesales
|
||||
WHERE `year_month` = '${REPLACE(p_ym,"-","")}'
|
||||
GROUP BY
|
||||
organ_code
|
||||
,organ_name
|
||||
,comm_id
|
||||
,comm_name
|
||||
)B
|
||||
ON A.organ_code = B.organ_code
|
||||
AND A.comm_id = B.comm_id
|
||||
WHERE 1=1
|
||||
${IF(LEN(p_area)>0," AND B.organ_code IN ('"+JOINARRAY(p_area,"','")+"')", "")}
|
||||
${if(left(fine_role,2)=="项目","and B.comm_name = '"+GETUSERDEPARTMENTS(3)+"'","")}
|
||||
GROUP BY
|
||||
${IF(LEN(p_area)>0,"B.comm_name", "B.organ_name")}
|
||||
)T1
|
||||
ORDER BY T1.FINISH_RATE ${IF(p_xls = "低于50%","ASC","DESC")}
|
||||
LIMIT 5
|
||||
|
||||
|
||||
-- ======================================
|
||||
-- 小悦到家
|
||||
-- ======================================
|
||||
SELECT
|
||||
T1.organ_comm_name AS organ_name
|
||||
,T1.FINISH_RATE AS 销售完成率
|
||||
,T1.sale_target AS sale_target
|
||||
,T1.sale_amt AS sale_amt
|
||||
,ROW_NUMBER() OVER (ORDER BY T1.FINISH_RATE ${IF(p_xydj = "低于50%","ASC","DESC")}) AS 序号
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
${IF(LEN(p_area)>0,"A.comm_name", "A.organ_name")} AS organ_comm_name
|
||||
,SUM(B.sale_target) AS sale_target
|
||||
,SUM(A.sale_amt) + SUM(B.sale_fact) AS sale_amt
|
||||
,CASE WHEN SUM(B.sale_target) = 0 THEN 0
|
||||
ELSE IFNULL((SUM(A.sale_amt) + SUM(B.sale_fact)) / SUM(B.sale_target),0) END AS FINISH_RATE
|
||||
FROM
|
||||
(
|
||||
select
|
||||
organ_code
|
||||
,organ_name
|
||||
,comm_id
|
||||
,comm_name
|
||||
,sum(case when create_ym = '202406' then 0 else xydj_amt end) sale_amt -- 202406填报数据为线下+线下,所以不取线上数据
|
||||
from dws_innoveco_new_retail_m
|
||||
where create_ym = '${REPLACE(p_ym,"-","")}'
|
||||
group by
|
||||
organ_code
|
||||
,organ_name
|
||||
,comm_id
|
||||
,comm_name
|
||||
)A
|
||||
LEFT JOIN
|
||||
(
|
||||
SELECT
|
||||
organ_code
|
||||
,organ_name
|
||||
,comm_id
|
||||
,comm_name
|
||||
,SUM(IFNULL(index_xiaoyuedj_target,0)) AS sale_target
|
||||
,SUM(index_xiaoyuedj_fact) AS sale_fact
|
||||
FROM ods_innoveco_offlinesales
|
||||
WHERE `year_month` = '${REPLACE(p_ym,"-","")}'
|
||||
GROUP BY
|
||||
organ_code
|
||||
,organ_name
|
||||
,comm_id
|
||||
,comm_name
|
||||
)B
|
||||
ON A.organ_code = B.organ_code
|
||||
AND A.comm_id = B.comm_id
|
||||
WHERE 1=1
|
||||
${IF(LEN(p_area)>0," AND A.organ_code IN ('"+JOINARRAY(p_area,"','")+"')", "")}
|
||||
${if(left(fine_role,2)=="项目","and B.comm_name = '"+GETUSERDEPARTMENTS(3)+"'","")}
|
||||
GROUP BY
|
||||
${IF(LEN(p_area)>0,"A.comm_name", "A.organ_name")}
|
||||
)T1
|
||||
ORDER BY T1.FINISH_RATE ${IF(p_xydj = "低于50%","ASC","DESC")}
|
||||
LIMIT 5
|
||||
;
|
||||
|
||||
-- ======================================
|
||||
-- 御和泰
|
||||
-- ======================================
|
||||
SELECT
|
||||
T1.organ_comm_name AS organ_name
|
||||
,T1.FINISH_RATE AS 销售完成率
|
||||
,T1.sale_target / 10000 AS sale_target
|
||||
,T1.sale_amt / 10000 AS sale_amt
|
||||
,ROW_NUMBER() OVER (ORDER BY T1.FINISH_RATE ${IF(p_yht = "低于50%","ASC","DESC")}) AS 序号
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
|
||||
${IF(LEN(p_area)>0,"A.comm_name", "A.organ_name")} AS organ_comm_name
|
||||
,SUM(B.sale_target) AS sale_target
|
||||
,IFNULL(SUM(A.sale_amt) + SUM(B.sale_fact),0) AS sale_amt
|
||||
,CASE WHEN SUM(B.sale_target) = 0 THEN 0
|
||||
ELSE IFNULL(SUM(A.sale_amt) + SUM(B.sale_fact),0) / SUM(B.sale_target) END AS FINISH_RATE
|
||||
FROM
|
||||
(
|
||||
select
|
||||
organ_code
|
||||
,organ_name
|
||||
,comm_id
|
||||
,comm_name
|
||||
,sum(case when create_ym = '202406' then 0 else yht_amt end) sale_amt -- 202406填报数据为线下+线下,所以不取线上数据
|
||||
from dws_innoveco_new_retail_m
|
||||
where create_ym = '${REPLACE(p_ym,"-","")}'
|
||||
group by
|
||||
organ_code
|
||||
,organ_name
|
||||
,comm_id
|
||||
,comm_name
|
||||
)A
|
||||
LEFT JOIN
|
||||
(
|
||||
SELECT
|
||||
organ_code
|
||||
,organ_name
|
||||
,comm_id
|
||||
,comm_name
|
||||
,SUM(IFNULL(index_yuhetai_target,0))*10000 AS sale_target
|
||||
,SUM(index_yuhetai_fact)*10000 AS sale_fact
|
||||
FROM ods_innoveco_offlinesales
|
||||
WHERE `year_month` = '${REPLACE(p_ym,"-","")}'
|
||||
GROUP BY
|
||||
organ_code
|
||||
,organ_name
|
||||
,comm_id
|
||||
,comm_name
|
||||
)B
|
||||
ON A.organ_code = B.organ_code
|
||||
AND A.comm_id = B.comm_id
|
||||
WHERE 1=1
|
||||
${IF(LEN(p_area)>0," AND A.organ_code IN ('"+JOINARRAY(p_area,"','")+"')", "")}
|
||||
${if(left(fine_role,2)=="项目","and B.comm_name = '"+GETUSERDEPARTMENTS(3)+"'","")}
|
||||
GROUP BY
|
||||
${IF(LEN(p_area)>0,"A.comm_name", "A.organ_name")}
|
||||
)T1
|
||||
ORDER BY T1.FINISH_RATE ${IF(p_yht = "低于50%","ASC","DESC")}
|
||||
LIMIT 5
|
||||
|
||||
|
||||
|
||||
WITH T1 AS (
|
||||
select
|
||||
organ_code,
|
||||
organ_name,
|
||||
sum(yht_amt)/10000 sale_amt
|
||||
from dws_innoveco_new_retail_m
|
||||
where create_ym = '${REPLACE(p_ym,"-","")}'
|
||||
group by organ_code,organ_name
|
||||
),T2 AS (
|
||||
SELECT
|
||||
organ_code,organ_name,
|
||||
SUM(IFNULL(index_yuhetai_target,0)) AS sale_target,
|
||||
SUM(index_xiaoyuedj_fact) AS sale_fact
|
||||
FROM ods_innoveco_offlinesales
|
||||
WHERE `year_month` = '${REPLACE(p_ym,"-","")}'
|
||||
GROUP BY organ_code,organ_name
|
||||
),T3 AS (
|
||||
SELECT
|
||||
T1.organ_code,
|
||||
T1.organ_name,
|
||||
T2.sale_target,
|
||||
(T1.sale_amt + T2.sale_fact) AS sale_amt,
|
||||
IFNULL((T1.sale_amt + T2.sale_fact) / T2.sale_target,0) AS 销售完成率
|
||||
FROM T1 LEFT JOIN T2 ON T1.organ_code = T2.organ_code
|
||||
)
|
||||
SELECT
|
||||
ROW_NUMBER() OVER (ORDER BY 销售完成率 ${IF(p_yht = "低于50%","ASC","DESC")}) AS 序号,
|
||||
organ_code,
|
||||
organ_name,
|
||||
sale_target,
|
||||
sale_amt,
|
||||
销售完成率
|
||||
FROM T3
|
||||
WHERE 1=1
|
||||
${IF(p_yht = "低于50%","AND 销售完成率 <= 0.5","AND 销售完成率 >= 0.5")}
|
||||
ORDER BY 销售完成率 ${IF(p_yht = "低于50%","ASC","DESC")}
|
63
finereport/xiazuan/6_innovation/御和泰销售预警明细.sql
Normal file
63
finereport/xiazuan/6_innovation/御和泰销售预警明细.sql
Normal file
@ -0,0 +1,63 @@
|
||||
-- 【1_report_御和泰销售情况】
|
||||
|
||||
|
||||
SELECT
|
||||
T1.organ_name AS ORGAN_NAME
|
||||
,T1.comm_name AS COMM_NAME
|
||||
,T1.FINISH_RATE AS FINISH_RATE
|
||||
,T1.sale_target AS SALE_TARGET
|
||||
,T1.sale_amt AS SALE_AMT
|
||||
,ROW_NUMBER() OVER (ORDER BY T1.FINISH_RATE DESC) AS RK
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
|
||||
A.comm_name
|
||||
,A.organ_name
|
||||
,SUM(B.sale_target) AS sale_target
|
||||
,IFNULL(SUM(A.sale_amt) + SUM(B.sale_fact),0) AS sale_amt
|
||||
,CASE WHEN SUM(B.sale_target) = 0 THEN 0
|
||||
ELSE IFNULL(SUM(A.sale_amt) + SUM(B.sale_fact),0) / SUM(B.sale_target) END AS FINISH_RATE
|
||||
FROM
|
||||
(
|
||||
select
|
||||
organ_code
|
||||
,organ_name
|
||||
,comm_id
|
||||
,comm_name
|
||||
,sum(case when create_ym = '202406' then 0 else yht_amt end) sale_amt -- 202406填报数据为线下+线下,所以不取线上数据
|
||||
from dw.dws_innoveco_new_retail_m -- 新零售月汇总
|
||||
where create_ym = '${REPLACE(p_ym,"-","")}'
|
||||
group by
|
||||
organ_code
|
||||
,organ_name
|
||||
,comm_id
|
||||
,comm_name
|
||||
)A
|
||||
LEFT JOIN
|
||||
(
|
||||
SELECT
|
||||
organ_code
|
||||
,organ_name
|
||||
,comm_id
|
||||
,comm_name
|
||||
,SUM(IFNULL(index_yuhetai_target,0))*10000 AS sale_target
|
||||
,SUM(index_yuhetai_fact)*10000 AS sale_fact
|
||||
FROM dw.ods_innoveco_offlinesales
|
||||
WHERE `year_month` = '${REPLACE(p_ym,"-","")}'
|
||||
GROUP BY
|
||||
organ_code
|
||||
,organ_name
|
||||
,comm_id
|
||||
,comm_name
|
||||
)B
|
||||
ON A.organ_code = B.organ_code
|
||||
AND A.comm_id = B.comm_id
|
||||
WHERE 1=1
|
||||
${IF(LEN(p_area)>0," AND A.organ_code IN ('"+JOINARRAY(p_area,"','")+"')", "")}
|
||||
${if(left(fine_role,2)=="项目","and B.comm_name = '"+GETUSERDEPARTMENTS(3)+"'","")}
|
||||
GROUP BY
|
||||
A.comm_name
|
||||
,A.organ_name
|
||||
)T1
|
||||
|
65
finereport/xiazuan/6_innovation/新零售订单明细.sql
Normal file
65
finereport/xiazuan/6_innovation/新零售订单明细.sql
Normal file
@ -0,0 +1,65 @@
|
||||
-- ======================================
|
||||
-- 1_report_新零售订单明细
|
||||
-- ======================================
|
||||
|
||||
SELECT
|
||||
T3.organ_code AS organ_code
|
||||
,T3.organ_name AS organ_name
|
||||
,T3.comm_id AS comm_id
|
||||
,T3.comm_name AS comm_name
|
||||
,T2.categoryLevel1 AS categoryLevel1-- 品类名称
|
||||
,T2.goodsTitle AS goodsTitle -- 商品名称
|
||||
,substr(T1.createTime,1,10) AS createTime -- 创建时间
|
||||
,COUNT(T1.orderNo) AS orderNum -- 订单数量
|
||||
,SUM(IFNULL(T1.salePrice,0)) - SUM(IFNULL(T1.refundCash,0)) AS AMOUNT-- 金额
|
||||
,ROW_NUMBER() over (ORDER BY COUNT(T1.orderNo)) AS RK
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
orderNo -- 订单号
|
||||
,vid
|
||||
,vidName -- 项目名称
|
||||
,salePrice -- 销售价格
|
||||
,refundCash -- 退款金额
|
||||
,createTime -- 创建时间
|
||||
FROM dw.dwd_innoveco_order_info_d -- 订单信息
|
||||
WHERE 1=1
|
||||
${IF(LEN(p_startdate)>0,"AND createTime LIKE '"+FORMAT(p_startdate,"yyyy-MM")+"%'","")}
|
||||
|
||||
)T1
|
||||
LEFT JOIN
|
||||
(
|
||||
SELECT
|
||||
categoryLevel1 -- 品类名称
|
||||
,skuNum -- 商品数量
|
||||
,orderNo -- 订单号
|
||||
,goodsTitle -- 商品名称
|
||||
FROM dw.dwd_innoveco_order_item_d -- 订单项信息
|
||||
)T2
|
||||
ON T1.orderNo = T2.orderNo
|
||||
RIGHT JOIN
|
||||
(
|
||||
SELECT
|
||||
-- DISTINCT
|
||||
organ_code
|
||||
, organ_name
|
||||
, comm_id
|
||||
, comm_name
|
||||
, weim_comm_id
|
||||
FROM dw.dim_organ_mapping
|
||||
)T3
|
||||
ON T1.vid = T3.weim_comm_id
|
||||
WHERE T3.comm_id IS NOT NULL
|
||||
AND T1.createTime is not null
|
||||
${IF(LEN(p_cate)>0," AND T2.categoryLevel1 IN ('"+JOINARRAY(p_cate,"','")+"')", "")}
|
||||
${IF(LEN(p_good)>0," AND T2.goodsTitle IN ('"+JOINARRAY(p_good,"','")+"')", "")}
|
||||
${IF(LEN(p_area)>0," AND T3.organ_code IN ('"+JOINARRAY(p_area,"','")+"')", "")}
|
||||
${if(left(fine_role,2)=="项目","and T3.comm_name = '"+GETUSERDEPARTMENTS(3)+"'","")}
|
||||
GROUP BY
|
||||
T3.organ_code
|
||||
,T3.organ_name
|
||||
,T3.comm_id
|
||||
,T3.comm_name
|
||||
,T2.categoryLevel1
|
||||
,T2.goodsTitle
|
||||
,substr(T1.createTime,1,10)
|
Loading…
Reference in New Issue
Block a user