Commit d8e1a640 authored by 胡涛's avatar 胡涛

指标计算(函数自增)sql脚本

parent d9aa22fb
...@@ -117,95 +117,10 @@ from ( ...@@ -117,95 +117,10 @@ from (
) s1 ) s1
; ;
-- ZB_DM_CAR_HB ZB_DM_承保车险合并
-- ZB_DM_QDBF_CAR/ZB_DM_车险今日签单保费
-- key:allcarqbbf/日期
-- 1、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 2、车险
-- 总公司
insert into ZB_DM.ZB_DM_REDIS.SET_DECIMAL
select
CONCAT('allcarqdbf/',s1.`uwConclueDate`) as `key`
,cast (sumZBUDF(
CONCAT('allcarqdbf/',s1.`uwConclueDate`)
,s1.`cost`
,s1.`uwConclueDate`
) as decimal (18,2)) as `val`
from ZB_ODS.ZB_ODS_KAFKA.CBDATA s1
where s1.`COMNAME` is not null
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and left(s1.risk,2) ='05'
;
-- 分公司
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT('provcarqdbf/',s1.`uwConclueDate`) as `key`
,s1.`LEVEL1COMCODE` as `hkey`
,cast (sumZBUDF(
CONCAT('provcarqdbf/',s1.`uwConclueDate`)
,s1.`cost`
,s1.`uwConclueDate`
) as decimal (18,2)) as `val`
from ZB_ODS.ZB_ODS_KAFKA.CBDATA s1
where s1.`COMNAME` is not null
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and left(s1.risk,2) ='05'
;
-- 中支
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT('citycarqdbf/',s1.`uwConclueDate`) as `key`
,s1.`LEVEL2COMCODE` as `hkey`
,cast (sumZBUDF(
CONCAT('citycarqdbf/',s1.`uwConclueDate`)
,s1.`cost`
,s1.`uwConclueDate`
) as decimal (18,2)) as `val`
from ZB_ODS.ZB_ODS_KAFKA.CBDATA s1
where s1.`COMNAME` is not null
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and left(s1.risk,2) ='05'
;
-- 县支
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT('countycarqdbf/',s1.`uwConclueDate`) as `key`
,s1.`LEVEL3COMCODE` as `hkey`
,cast (sumZBUDF(
CONCAT('countycarqdbf/',s1.`uwConclueDate`)
,s1.`cost`
,s1.`uwConclueDate`
) as decimal (18,2)) as `val`
from ZB_ODS.ZB_ODS_KAFKA.CBDATA s1
where s1.`COMNAME` is not null
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and left(s1.risk,2) ='05'
;
-- 团队
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT('teamcarqdbf/',s1.`uwConclueDate`) as `key`
,s1.`LEVEL4COMCODE` as `hkey`
,cast (sumZBUDF(
CONCAT('countycarqdbf/',s1.`uwConclueDate`)
,s1.`cost`
,s1.`uwConclueDate`
) as decimal (18,2)) as `val`
from ZB_ODS.ZB_ODS_KAFKA.CBDATA s1
where s1.`COMNAME` is not null
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and left(s1.risk,2) ='05'
;
-- ZB_DM_CXCBDD ZB_DM_车险承保大单 -- ZB_DM_CXCBDD ZB_DM_车险承保大单
...@@ -344,96 +259,6 @@ from ( ...@@ -344,96 +259,6 @@ from (
; ;
-- ZB_DM_NOCAR_HB ZB_DM_承保非车险合并
-- ZB_DM_QDBF_NOCAR/ZB_DM_非车险今日签单保费
-- key:allnocarqbbf/日期
-- 1、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 2、非车险
-- 总公司
insert into ZB_DM.ZB_DM_REDIS.SET_DECIMAL
select
CONCAT('allnocarqdbf/',s1.`uwConclueDate`) as `key`
,cast (sumZBUDF(
CONCAT('allnocarqdbf/',s1.`uwConclueDate`)
,s1.`cost`
,s1.`uwConclueDate`
) as decimal (18,2)) as `val`
from ZB_ODS.ZB_ODS_KAFKA.CBDATA s1
where s1.`COMNAME` is not null
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and left(s1.risk,2) <> '05'
;
-- 分公司
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT('provnocarqdbf/',s1.`uwConclueDate`) as `key`
,s1.`LEVEL1COMCODE` as `hkey`
,cast (sumZBUDF(
CONCAT('provnocarqdbf/',s1.`uwConclueDate`)
,s1.`cost`
,s1.`uwConclueDate`
) as decimal (18,2)) as `val`
from ZB_ODS.ZB_ODS_KAFKA.CBDATA s1
where s1.`COMNAME` is not null
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and left(s1.risk,2) <> '05'
;
-- 中支
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT('citynocarqdbf/',s1.`uwConclueDate`) as `key`
,s1.`LEVEL2COMCODE` as `hkey`
,cast (sumZBUDF(
CONCAT('citynocarqdbf/',s1.`uwConclueDate`)
,s1.`cost`
,s1.`uwConclueDate`
) as decimal (18,2)) as `val`
from ZB_ODS.ZB_ODS_KAFKA.CBDATA s1
where s1.`COMNAME` is not null
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and left(s1.risk,2) <> '05'
;
-- 县支
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT('countynocarqdbf/',s1.`uwConclueDate`) as `key`
,s1.`LEVEL3COMCODE` as `hkey`
,cast (sumZBUDF(
CONCAT('countynocarqdbf/',s1.`uwConclueDate`)
,s1.`cost`
,s1.`uwConclueDate`
) as decimal (18,2)) as `val`
from ZB_ODS.ZB_ODS_KAFKA.CBDATA s1
where s1.`COMNAME` is not null
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and left(s1.risk,2) <> '05'
;
-- 团队
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT('teamnocarqdbf/',s1.`uwConclueDate`) as `key`
,s1.`LEVEL4COMCODE` as `hkey`
,cast (sumZBUDF(
CONCAT('countynocarqdbf/',s1.`uwConclueDate`)
,s1.`cost`
,s1.`uwConclueDate`
) as decimal (18,2)) as `val`
from ZB_ODS.ZB_ODS_KAFKA.CBDATA s1
where s1.`COMNAME` is not null
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and left(s1.risk,2) <> '05'
;
-- ZB_DM_FCXCBDD ZB_DM_非车险承保大单 -- ZB_DM_FCXCBDD ZB_DM_非车险承保大单
-- bigfcbd/日期 -- bigfcbd/日期
......
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