Commit 73222504 authored by 王东's avatar 王东

指标计算承保字段调整

parent d6e5f2e0
......@@ -8,17 +8,17 @@ from ODS.SOURCE_KAFKA_REGIST_PRD.REGIST s1 -- topic ClaimCase
;
-- 记录消费数据总量
insert into ODS.ODS_REDIS.SET_VARCHAR
select
CONCAT('MQ_REGIST/', LEFT(DataAccRegistUDF( date_time,'get'),10)) as `key` ,
DataAccRegistUDF( date_time,'get') as val
from (
select
DATE_FORMAT(LOCALTIMESTAMP,'yyyy-MM-dd HH:mm:ss') as date_time -- 批单累加器 yyyy-MM-dd:num
from ODS.SOURCE_KAFKA_REGIST_PRD.REGIST
-- 在select与where条件中同时调用该参数 acc,会执行两次UDF函数 ,所以通过定义函数记录该参数 DataAccEndorLogUDF
where LEFT(DataAccRegistUDF( DATE_FORMAT(LOCALTIMESTAMP,'yyyy-MM-dd HH:mm:ss'),'set'),10) <> 'xxxx-xx-xx' -- 将该参数保留
) s1
;
\ No newline at end of file
--
-- -- 记录消费数据总量
-- insert into ODS.ODS_REDIS.SET_VARCHAR
-- select
-- CONCAT('MQ_REGIST/', LEFT(DataAccRegistUDF( date_time,'get'),10)) as `key` ,
-- DataAccRegistUDF( date_time,'get') as val
-- from (
-- select
-- DATE_FORMAT(LOCALTIMESTAMP,'yyyy-MM-dd HH:mm:ss') as date_time -- 批单累加器 yyyy-MM-dd:num
-- from ODS.SOURCE_KAFKA_REGIST_PRD.REGIST
-- -- 在select与where条件中同时调用该参数 acc,会执行两次UDF函数 ,所以通过定义函数记录该参数 DataAccEndorLogUDF
-- where LEFT(DataAccRegistUDF( DATE_FORMAT(LOCALTIMESTAMP,'yyyy-MM-dd HH:mm:ss'),'set'),10) <> 'xxxx-xx-xx' -- 将该参数保留
-- ) s1
-- ;
\ No newline at end of file
......@@ -259,6 +259,58 @@ from (
;
-- 县支
insert into ZB_DM.ZB_DM_REDIS.SET_VARCHAR
select
CONCAT('bigcteambd/',s1.`uwConclueDate`,'/',s1.`group_com`) as `key`
,topNUDF(
CONCAT('bigcteambd/',s1.`uwConclueDate`,'/',s1.`group_com`)
,`cost`
,concat(
'com' ,':' ,`com` ,','
,'comname' ,':' ,`comname` ,','
,'city' ,':' ,`city` ,','
,'cityname' ,':' ,`cityname` ,','
,'country' ,':' ,`country` ,','
,'countryname' ,':' ,`countryname` ,','
,'team' ,':' ,`team` ,','
,'teamname' ,':' ,`teamname` ,','
,'risk' ,':' ,`risk` ,','
,'riskname' ,':' ,`riskname` ,','
,'chnl' ,':' ,`chnl` ,','
,'chnlname' ,':' ,`chnlname` ,','
,'cost' ,':' ,`cost` ,','
,'no' ,':' ,`no`
)
,20
,s1.`uwConclueDate`
) as `val`
from (
select
d1.`uwConclueDate` as `uwConclueDate`
,d1.`LEVEL3COMCODE` as `group_com`
,d1.`LEVEL1COMCODE` as `com`
,d1.`LEVEL1COMDESC` as `comname`
,d1.`LEVEL2COMCODE` as `city`
,d1.`LEVEL2COMDESC` as `cityname`
,d1.`LEVEL3COMCODE` as `country`
,d1.`LEVEL3COMDESC` as `countryname`
,d1.`LEVEL4COMCODE` as `team`
,d1.`LEVEL4COMDESC` as `teamname`
,d1.`risk` as `risk`
,d1.`riskname` as `riskname`
,d1.`chnl` as `chnl`
,d1.`chnlname` as `chnlname`
,cast(d1.`cost` as varchar) as `cost`
,d1.`no` as `no`
from ZB_ODS.ZB_ODS_KAFKA.CBDATA d1
where d1.`COMNAME` is not null
and d1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and left(d1.risk,2) ='05'
) s1
;
-- ZB_DM_FCXCBDD ZB_DM_非车险承保大单
-- bigfcbd/日期
......@@ -395,4 +447,57 @@ from (
and left(d1.risk,2) <>'05'
) s1
;
-- 县支
insert into ZB_DM.ZB_DM_REDIS.SET_VARCHAR
select
CONCAT('bigfcteambd/',s1.`uwConclueDate`,'/',s1.`group_com`) as `key`
,topNUDF(
CONCAT('bigfcteambd/',s1.`uwConclueDate`,'/',s1.`group_com`)
,`cost`
,concat(
'com' ,':' ,`com` ,','
,'comname' ,':' ,`comname` ,','
,'city' ,':' ,`city` ,','
,'cityname' ,':' ,`cityname` ,','
,'country' ,':' ,`country` ,','
,'countryname' ,':' ,`countryname` ,','
,'team' ,':' ,`team` ,','
,'teamname' ,':' ,`teamname` ,','
,'risk' ,':' ,`risk` ,','
,'riskname' ,':' ,`riskname` ,','
,'chnl' ,':' ,`chnl` ,','
,'chnlname' ,':' ,`chnlname` ,','
,'cost' ,':' ,`cost` ,','
,'no' ,':' ,`no`
)
,20
,s1.`uwConclueDate`
) as `val`
from (
select
d1.`uwConclueDate` as `uwConclueDate`
,d1.`LEVEL3COMCODE` as `group_com`
,d1.`LEVEL1COMCODE` as `com`
,d1.`LEVEL1COMDESC` as `comname`
,d1.`LEVEL2COMCODE` as `city`
,d1.`LEVEL2COMDESC` as `cityname`
,d1.`LEVEL3COMCODE` as `country`
,d1.`LEVEL3COMDESC` as `countryname`
,d1.`LEVEL4COMCODE` as `team`
,d1.`LEVEL4COMDESC` as `teamname`
,d1.`risk` as `risk`
,d1.`riskname` as `riskname`
,d1.`chnl` as `chnl`
,d1.`chnlname` as `chnlname`
,cast(d1.`cost` as varchar) as `cost`
,d1.`no` as `no`
from ZB_ODS.ZB_ODS_KAFKA.CBDATA d1
where d1.`COMNAME` is not null
and d1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and left(d1.risk,2) <>'05'
) s1
;
\ No newline at end of file
......@@ -1522,175 +1522,175 @@ where s1.`COMNAME` is not null
and left(s1.`startTime`,8) = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
;
-- 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.`LEVEL1COMCODE`)
,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.`LEVEL2COMCODE`)
,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.`LEVEL3COMCODE`)
,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.`LEVEL4COMCODE`)
,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_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.`LEVEL1COMCODE`)
,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.`LEVEL2COMCODE`)
,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.`LEVEL3COMCODE`)
,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.`LEVEL4COMCODE`)
,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'
;
\ No newline at end of file
-- -- 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.`LEVEL1COMCODE`)
-- ,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.`LEVEL2COMCODE`)
-- ,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.`LEVEL3COMCODE`)
-- ,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.`LEVEL4COMCODE`)
-- ,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_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.`LEVEL1COMCODE`)
-- ,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.`LEVEL2COMCODE`)
-- ,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.`LEVEL3COMCODE`)
-- ,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.`LEVEL4COMCODE`)
-- ,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'
-- ;
\ No newline at end of file
-- ZB_DM_CBXZ ZB_DM_承保新增
-- ZB_DM_JRQDNDQQIBBF_CAR ZB_DM_今日签单今年待起保保费(车险)
-- key:allcarqdbf/日期
-- 1、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 2、起保日期小于等于今年
-- 3、险种代码前两位为05
-- sumZBUDF 数据累加 入参(key String ,cost String , date String)
-- sumZBUDF 通过date自动清除前一天数据,key为当前数据唯一主键,cost为需要累加的数据值
-- 总公司
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 LEFT(s1.`risk`,2)='05'
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and left(s1.`startTime`,4) <= DATE_FORMAT(LOCALTIMESTAMP,'yyyy')
;
-- 分公司
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.`LEVEL1COMCODE`)
,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 LEFT(s1.`risk`,2)='05'
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and left(s1.`startTime`,4) <= DATE_FORMAT(LOCALTIMESTAMP,'yyyy')
;
-- 中支
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.`LEVEL2COMCODE`)
,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 LEFT(s1.`risk`,2)='05'
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and left(s1.`startTime`,4) <= DATE_FORMAT(LOCALTIMESTAMP,'yyyy')
;
-- 县支
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.`LEVEL3COMCODE`)
,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 LEFT(s1.`risk`,2)='05'
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and left(s1.`startTime`,4) <= DATE_FORMAT(LOCALTIMESTAMP,'yyyy')
;
-- 团队
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT('teamcarqdbf/',s1.`uwConclueDate`) as `key`
,s1.`LEVEL4COMCODE` as `hkey`
,cast(sumZBUDF(
CONCAT('teamcarqdbf/',s1.`uwConclueDate`,s1.`LEVEL4COMCODE`)
,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 LEFT(s1.`risk`,2)='05'
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and left(s1.`startTime`,4) <= DATE_FORMAT(LOCALTIMESTAMP,'yyyy')
;
-- ZB_DM_JRQDNDQQIBBF_NOCAR ZB_DM_今日签单今年待起保保费(非车险)
-- key:allnocarqdbf/日期
-- 1、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 2、起保日期小于等于今年
-- 3、险种代码前两位不为05
-- sumZBUDF 数据累加 入参(key String ,cost String , date String)
-- sumZBUDF 通过date自动清除前一天数据,key为当前数据唯一主键,cost为需要累加的数据值
-- 总公司
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 LEFT(s1.`risk`,2)<>'05'
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and left(s1.`startTime`,4) <= DATE_FORMAT(LOCALTIMESTAMP,'yyyy')
;
-- 分公司
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.`LEVEL1COMCODE`)
,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 LEFT(s1.`risk`,2)<>'05'
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and left(s1.`startTime`,4) <= DATE_FORMAT(LOCALTIMESTAMP,'yyyy')
;
-- 中支
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.`LEVEL2COMCODE`)
,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 LEFT(s1.`risk`,2)<>'05'
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and left(s1.`startTime`,4) <= DATE_FORMAT(LOCALTIMESTAMP,'yyyy')
;
-- 县支
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.`LEVEL3COMCODE`)
,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 LEFT(s1.`risk`,2)<>'05'
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and left(s1.`startTime`,4) <= DATE_FORMAT(LOCALTIMESTAMP,'yyyy')
;
-- 团队
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT('teamnocarqdbf/',s1.`uwConclueDate`) as `key`
,s1.`LEVEL4COMCODE` as `hkey`
,cast(sumZBUDF(
CONCAT('teamnocarqdbf/',s1.`uwConclueDate`,s1.`LEVEL4COMCODE`)
,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 LEFT(s1.`risk`,2)<>'05'
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and left(s1.`startTime`,4) <= DATE_FORMAT(LOCALTIMESTAMP,'yyyy')
;
-- ZB_DM_JRQDXNDBF ZB_DM_今日签单下年度待起保保费
-- key:allnextyearqbbf/日期
-- 1、核保日期或者核批完成日期(yyyyMMdd)等于今日
-- 2、起保日期大于今年
-- sumZBUDF 数据累加 入参(key String ,cost String , date String)
-- sumZBUDF 通过date自动清除前一天数据,key为当前数据唯一主键,cost为需要累加的数据值
-- 总公司
insert into ZB_DM.ZB_DM_REDIS.SET_DECIMAL
select
CONCAT('allnextyearqbbf/',s1.`uwConclueDate`) as `key`
,cast (sumZBUDF(
CONCAT('allnextyearqbbf/',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.`startTime`,4) = DATE_FORMAT(TIMESTAMPADD(YEAR,1,LOCALTIMESTAMP),'yyyy')
;
-- 分公司
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT('provnextyearqbbf/',s1.`uwConclueDate`) as `key`
,s1.`LEVEL1COMCODE` as `hkey`
,cast (sumZBUDF(
CONCAT('provnextyearqbbf/',s1.`uwConclueDate`,s1.`LEVEL1COMCODE`)
,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 LEFT(s1.`risk`,2)<>'05'
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and left(s1.`startTime`,4) = DATE_FORMAT(TIMESTAMPADD(YEAR,1,LOCALTIMESTAMP),'yyyy')
;
-- 中支
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT('citynextyearqbbf/',s1.`uwConclueDate`) as `key`
,s1.`LEVEL2COMCODE` as `hkey`
,cast (sumZBUDF(
CONCAT('citynextyearqbbf/',s1.`uwConclueDate`,s1.`LEVEL2COMCODE`)
,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 LEFT(s1.`risk`,2)<>'05'
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and left(s1.`startTime`,4) = DATE_FORMAT(TIMESTAMPADD(YEAR,1,LOCALTIMESTAMP),'yyyy')
;
-- 县支
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT('countrynextyearqbbf/',s1.`uwConclueDate`) as `key`
,s1.`LEVEL3COMCODE` as `hkey`
,cast (sumZBUDF(
CONCAT('countrynextyearqbbf/',s1.`uwConclueDate`,s1.`LEVEL3COMCODE`)
,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 LEFT(s1.`risk`,2)<>'05'
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and left(s1.`startTime`,4) = DATE_FORMAT(TIMESTAMPADD(YEAR,1,LOCALTIMESTAMP),'yyyy')
;
-- 团队
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT('teamnextyearqdbf/',s1.`uwConclueDate`) as `key`
,s1.`LEVEL4COMCODE` as `hkey`
,cast(sumZBUDF(
CONCAT('teamnextyearqdbf/',s1.`uwConclueDate`,s1.`LEVEL4COMCODE`)
,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 LEFT(s1.`risk`,2)<>'05'
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and left(s1.`startTime`,4) = DATE_FORMAT(TIMESTAMPADD(YEAR,1,LOCALTIMESTAMP),'yyyy')
;
[
{
"com": "44030000",
"no": "6605212022440314004622",
"riskname": "0521-机动车综合商业险",
"cost": "72696.8600",
"chnlname": "个代",
"comname": "深圳分公司",
"risk": "0521",
"chnl": "08"
},
{
"com": "31000000",
"no": "6605212022310110020835",
"riskname": "0521-机动车综合商业险",
"cost": "51719.4900",
"chnlname": "网销",
"comname": "上海分公司",
"risk": "0521",
"chnl": "15"
},
{
"com": "44030000",
"no": "6605312022440311000668",
"riskname": "0531-新能源汽车商业保险",
"cost": "45809.1100",
"chnlname": "个代",
"comname": "深圳分公司",
"risk": "0531",
"chnl": "08"
},
{
"com": "31000000",
"no": "6605212022310061001503",
"riskname": "0521-机动车综合商业险",
"cost": "45086.0600",
"chnlname": "车行",
"comname": "上海分公司",
"risk": "0521",
"chnl": "06"
},
{
"com": "34000000",
"no": "6605212022340322008660",
"riskname": "0521-机动车综合商业险",
"cost": "44089.2800",
"chnlname": "互动",
"comname": "安徽省分公司",
"risk": "0521",
"chnl": "03"
},
{
"com": "34000000",
"no": "6605212022340322008661",
"riskname": "0521-机动车综合商业险",
"cost": "44089.2800",
"chnlname": "互动",
"comname": "安徽省分公司",
"risk": "0521",
"chnl": "03"
},
{
"com": "44030000",
"no": "6605212022440311007664",
"riskname": "0521-机动车综合商业险",
"cost": "43329.1400",
"chnlname": "个代",
"comname": "深圳分公司",
"risk": "0521",
"chnl": "08"
},
{
"com": "34000000",
"no": "6605212022341125005814",
"riskname": "0521-机动车综合商业险",
"cost": "39408.0000",
"chnlname": "个代",
"comname": "安徽省分公司",
"risk": "0521",
"chnl": "08"
},
{
"com": "31000000",
"no": "6605312022310105008999",
"riskname": "0531-新能源汽车商业保险",
"cost": "37797.9400",
"chnlname": "车行",
"comname": "上海分公司",
"risk": "0531",
"chnl": "06"
},
{
"com": "31000000",
"no": "6605312022310083001041",
"riskname": "0531-新能源汽车商业保险",
"cost": "36859.2300",
"chnlname": "车行",
"comname": "上海分公司",
"risk": "0531",
"chnl": "06"
},
{
"com": "31000000",
"no": "6605212022310083012898",
"riskname": "0521-机动车综合商业险",
"cost": "34986.8700",
"chnlname": "车行",
"comname": "上海分公司",
"risk": "0521",
"chnl": "06"
},
{
"com": "44000000",
"no": "6605212022440112002883",
"riskname": "0521-机动车综合商业险",
"cost": "34540.2400",
"chnlname": "银保",
"comname": "广东省分公司",
"risk": "0521",
"chnl": "07"
},
{
"com": "13000000",
"no": "6605212022130461003029",
"riskname": "0521-机动车综合商业险",
"cost": "32326.3500",
"chnlname": "个代",
"comname": "河北省分公司",
"risk": "0521",
"chnl": "08"
},
{
"com": "13000000",
"no": "6605212022130461003028",
"riskname": "0521-机动车综合商业险",
"cost": "32326.3500",
"chnlname": "个代",
"comname": "河北省分公司",
"risk": "0521",
"chnl": "08"
},
{
"com": "37000000",
"no": "6605212022370725006713",
"riskname": "0521-机动车综合商业险",
"cost": "31857.2300",
"chnlname": "互动",
"comname": "山东省分公司",
"risk": "0521",
"chnl": "03"
},
{
"com": "34000000",
"no": "6605212022340322008648",
"riskname": "0521-机动车综合商业险",
"cost": "31852.4000",
"chnlname": "互动",
"comname": "安徽省分公司",
"risk": "0521",
"chnl": "03"
},
{
"com": "37000000",
"no": "6605212022371524003793",
"riskname": "0521-机动车综合商业险",
"cost": "31580.9300",
"chnlname": "个代",
"comname": "山东省分公司",
"risk": "0521",
"chnl": "08"
},
{
"com": "35000000",
"no": "6605212022350195000840",
"riskname": "0521-机动车综合商业险",
"cost": "30649.7100",
"chnlname": "个代",
"comname": "福建分公司",
"risk": "0521",
"chnl": "08"
},
{
"com": "23000000",
"no": "6605212022230399004261",
"riskname": "0521-机动车综合商业险",
"cost": "30518.9100",
"chnlname": "银保",
"comname": "黑龙江分公司",
"risk": "0521",
"chnl": "07"
},
{
"com": "34000000",
"no": "6605212022341250006855",
"riskname": "0521-机动车综合商业险",
"cost": "30289.1500",
"com": "52000000",
"country": "52017000",
"no": "6627022022520170001908",
"cost": "283.0300",
"city": "52019900",
"cityname": "贵阳市中心支公司",
"countryname": "贵阳市观山湖区支公司",
"comname": "贵州分公司",
"team": "5201703002",
"chnl": "03",
"riskname": "27020004-机动车驾乘人员团体意外伤害保险",
"chnlname": "互动",
"comname": "安徽省分公司",
"risk": "0521",
"chnl": "03"
"risk": "27020004",
"teamname": "贵阳市观山湖区支公司互动渠道收展一部"
},
{
"com": "52000000",
"country": "52017000",
"no": "6602972022520170000032",
"cost": "9.4400",
"city": "52019900",
"cityname": "贵阳市中心支公司",
"countryname": "贵阳市观山湖区支公司",
"comname": "贵州分公司",
"team": "5201700001",
"chnl": "12",
"riskname": "02970002-家用燃气综合保险(B)",
"chnlname": "政保",
"risk": "02970002",
"teamname": "贵阳市观山湖区支公司政保团队"
},
{
"com": "52000000",
"country": "52017000",
"no": "6602972022520170000033",
"cost": "9.4400",
"city": "52019900",
"cityname": "贵阳市中心支公司",
"countryname": "贵阳市观山湖区支公司",
"comname": "贵州分公司",
"team": "5201700001",
"chnl": "12",
"riskname": "02970002-家用燃气综合保险(B)",
"chnlname": "政保",
"risk": "02970002",
"teamname": "贵阳市观山湖区支公司政保团队"
}
]
\ No newline at end of file
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