Commit 65f446ea authored by 王东's avatar 王东

指标计算承保字段调整

parent 796681e1
......@@ -3,7 +3,17 @@
-- step1:
-- 团队汇总
CREATE TEMPORARY VIEW VIEW_ZB_DM_JRQDBF_HB_TUANDUI AS
SELECT
select
a1.`uwConclueDate`
,a1.`LEVEL1COMCODE`
,a1.`LEVEL2COMCODE`
,a1.`LEVEL3COMCODE`
,a1.`LEVEL4COMCODE`
,a1.`startTime`
,a1.`risk`
,a1.`cost` + if(t1.cost is null ,0,cast(t1.cost as decimal(18,2)))
from (
SELECT
s1.`uwConclueDate` as `uwConclueDate`
, s1.`LEVEL1COMCODE` as `LEVEL1COMCODE`
, s1.`LEVEL2COMCODE` as `LEVEL2COMCODE`
......@@ -11,22 +21,14 @@ SELECT
, s1.`LEVEL4COMCODE` as `LEVEL4COMCODE`
, s1.`startTime` as `startTime`
, s1.`risk` as `risk`
, sum(cast(s1.`cost` as DECIMAL(18, 2)) + if(t1.`cost` is null,0, cast(t1.`cost` as DECIMAL(18, 2)))) as `cost`
from ZB_ODS.ZB_ODS_KAFKA.CBDATA s1
left join ZB_DM.ZB_DM_MYSQL.TEAM_RISK for system_time as of s1.proctime as t1
on s1.`uwConclueDate` = t1.`uwConclueDate`
and s1.`LEVEL1COMCODE` = t1.`LEVEL1COMCODE`
and s1.`LEVEL2COMCODE` = t1.`LEVEL2COMCODE`
and s1.`LEVEL3COMCODE` = t1.`LEVEL3COMCODE`
and s1.`LEVEL4COMCODE` = t1.`LEVEL4COMCODE`
and s1.`startTime` = t1.`startTime`
and s1.`risk` = t1.`risk`
and LongTimeToStringUDF(t1.log_time,'yyyyMMdd HH') = DATE_FORMAT(timestampadd(HOUR,-1,LOCALTIMESTAMP),'yyyyMMdd HH')
where
, sum(cast(s1.`cost` as DECIMAL(18, 2))) as `cost`
, max(s1.proctime) as proctime
from ZB_ODS.ZB_ODS_KAFKA.CBDATA s1
where
s1.`COMNAME` is not null
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and LongTimeToStringUDF(s1.log_time,'yyyyMMdd HH') = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd HH')
group by
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and LongTimeToStringUDF(s1.log_time,'yyyyMMdd HH') = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd HH')
group by
s1.`uwConclueDate`
, s1.`LEVEL1COMCODE`
, s1.`LEVEL2COMCODE`
......@@ -34,6 +36,17 @@ group by
, s1.`LEVEL4COMCODE`
, s1.`startTime`
, s1.`risk`
)a1
left join ZB_DM.ZB_DM_MYSQL.TEAM_RISK for system_time as of s1.proctime as t1
on s1.`uwConclueDate` = t1.`uwConclueDate`
and s1.`LEVEL1COMCODE` = t1.`LEVEL1COMCODE`
and s1.`LEVEL2COMCODE` = t1.`LEVEL2COMCODE`
and s1.`LEVEL3COMCODE` = t1.`LEVEL3COMCODE`
and s1.`LEVEL4COMCODE` = t1.`LEVEL4COMCODE`
and s1.`startTime` = t1.`startTime`
and s1.`risk` = t1.`risk`
and LongTimeToStringUDF(t1.log_time,'yyyyMMdd HH') = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd HH')
;
-- ZB_DM_JRQDBF ZB_DM_今日签单保费
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment