Commit 1961b640 authored by 王东's avatar 王东

调整指标计算目标表

parent 68f08927
...@@ -8,17 +8,22 @@ CREATE TEMPORARY VIEW VIEW_RZ_DM_QUANTILE AS ...@@ -8,17 +8,22 @@ CREATE TEMPORARY VIEW VIEW_RZ_DM_QUANTILE AS
SELECT SELECT
d1.`applicationname` as `applicationname` d1.`applicationname` as `applicationname`
,d1.`agentid` as `agentid` ,d1.`agentid` as `agentid`
,concat(LongTimeToStringUDF(s1.endTime,'yyyy-MM-dd HH:mm'),":00" ) as `time` ,concat(LongTimeToStringUDF(cast(d1.endTime as bigint)*60000,'yyyy-MM-dd HH:mm'),":00" ) as `time`
,d1.`elapsed` as `elapsed` ,d1.`elapsed` as `elapsed`
,ROW_NUMBER() OVER(PARTITION BY ,ROW_NUMBER() OVER(PARTITION BY
d1.`applicationname` d1.`applicationname`
,d1.`agentid` ,d1.`agentid`
,concat(LongTimeToStringUDF(s1.endTime,'yyyy-MM-dd HH:mm'),":00" ) ,concat(LongTimeToStringUDF(cast(d1.endTime as bigint)*60000,'yyyy-MM-dd HH:mm'),":00" )
ORDER BY d1.`elapsed` ASC ORDER BY d1.`elapsed` ASC
) AS rownum ) AS rownum
from RZ_ODS.RZ_ODS_KAFKA_RZ.RZDATA d1 from RZ_ODS.RZ_ODS_KAFKA_RZ.RZDATA d1
where where
LongTimeToStringUDF(s1.endTime,'yyyy-MM-dd HH:mm:ss') > DATEFORMAT(TIMESTAMPADD(HOUR,-1,LOCALTIMESTAMP),'yyyy-MM-dd HH:mm:ss') LongTimeToStringUDF(d1.endTime,'yyyy-MM-dd HH:mm') > DATEFORMAT(TIMESTAMPADD(MINUTE,-3,LOCALTIMESTAMP),'yyyy-MM-dd HH:mm')
and d1.status = '200'
and LEFT(d1.`rpc`,3) not in ('.js')
and LEFT(d1.`rpc`,4) not in ('.jpg','.ico','.css','.ttf','.png','.PNG','.JPG','.txt','.mp4','.mp3','.pdf','.dwr')
and LEFT(d1.`rpc`,5) not in ('.json','.html','.less','.jpeg')
and LEFT(d1.`rpc`,6) not in ('.woff2')
; ;
...@@ -51,18 +56,23 @@ from( ...@@ -51,18 +56,23 @@ from(
select select
d1.`applicationname` as `applicationname` d1.`applicationname` as `applicationname`
,d1.`agentid` as `agentid` ,d1.`agentid` as `agentid`
,concat(LongTimeToStringUDF(s1.endTime,'yyyy-MM-dd HH:mm'),":00" ) as `time` ,oncat(LongTimeToStringUDF(cast(s1.endTime as bigint)*60000,'yyyy-MM-dd HH:mm'),":00" ) as `time`
,CEIL(count(1)*0.5 ) as `num50` ,CEIL(count(1)*0.5 ) as `num50`
,CEIL(count(1)*0.75 ) as `num75` ,CEIL(count(1)*0.75 ) as `num75`
,CEIL(count(1)*0.95 ) as `num95` ,CEIL(count(1)*0.95 ) as `num95`
,CEIL(count(1)*0.99 ) as `num99` ,CEIL(count(1)*0.99 ) as `num99`
from RZ_ODS.RZ_ODS_KAFKA_RZ.RZDATA d1 from RZ_ODS.RZ_ODS_KAFKA_RZ.RZDATA d1
where where
LongTimeToStringUDF(s1.endTime,'yyyy-MM-dd HH:mm:ss') > DATEFORMAT(TIMESTAMPADD(HOUR,-1,LOCALTIMESTAMP),'yyyy-MM-dd HH:mm:ss') LongTimeToStringUDF(d1.endTime,'yyyy-MM-dd HH:mm') > DATEFORMAT(TIMESTAMPADD(MINUTE,-3,LOCALTIMESTAMP),'yyyy-MM-dd HH:mm')
and d1.status = '200'
and LEFT(d1.`rpc`,3) not in ('.js')
and LEFT(d1.`rpc`,4) not in ('.jpg','.ico','.css','.ttf','.png','.PNG','.JPG','.txt','.mp4','.mp3','.pdf','.dwr')
and LEFT(d1.`rpc`,5) not in ('.json','.html','.less','.jpeg')
and LEFT(d1.`rpc`,6) not in ('.woff2')
group by group by
d1.`applicationname` as `applicationname` d1.`applicationname` as `applicationname`
,d1.`agentid` as `agentid` ,d1.`agentid` as `agentid`
,concat(LongTimeToStringUDF(s1.endTime,'yyyy-MM-dd HH:mm'),":00" ) as `time` ,oncat(LongTimeToStringUDF(cast(s1.endTime as bigint)*60000,'yyyy-MM-dd HH:mm'),":00" ) as `time`
) c1 ) c1
left join VIEW_RZ_DM_QUANTILE v1 left join VIEW_RZ_DM_QUANTILE v1
on c1.`applicationname` = c2.`applicationname` on c1.`applicationname` = c2.`applicationname`
......
-- RZ_DM_QUANTILE ZB_DM_单位时间内访问时间排序
-- QUANTILE_AGENTID 单位时间内访问时间排序按应用统计
insert into RZ_DM.RZ_DM_MYSQL.QUANTILE_AGENTID
SELECT
s1.`applicationname` as `applicationname`
,s1.`agentid` as `agentid`
,s1.`time` as `time`
,SPLIT_INDEX(s1.`quantile`,';',0) as `quantile50`
,SPLIT_INDEX(s1.`quantile`,';',1) as `quantile75`
,SPLIT_INDEX(s1.`quantile`,';',2) as `quantile95`
,SPLIT_INDEX(s1.`quantile`,';',3) as `quantile99`
,cast(DateTimeToLongUDF() as varchar) as `createtime`
from(
select
c1.`applicationname` as `applicationname`
,c1.`agentid` as `agentid`
,c1.`time` as `time`
,CastToTagIndexUDF(c1.`lists`) as `quantile` -- 自定义数组排序函数
from (
select
d1.`applicationName` as `applicationname`
,d1.`agentId` as `agentid`
,CONCAT(LongTimeToStringUDF(cast(d1.endTime as bigint)+60000,'yyyy-MM-dd HH:mm'),':00' ) as `time`
,LISTAGG(d1.`elapsed`,';') as `lists` -- 拼接
from RZ_ODS.RZ_ODS_KAFKA.RZDATA d1
where
LongTimeToStringUDF(d1.endTime,'yyyy-MM-dd HH:mm') >= DATE_FORMAT(TIMESTAMPADD(MINUTE,-1,LOCALTIMESTAMP),'yyyy-MM-dd HH:mm')
and LongTimeToStringUDF(d1.endTime,'yyyy-MM-dd HH:mm') < DATE_FORMAT(TIMESTAMPADD(MINUTE,+1,LOCALTIMESTAMP),'yyyy-MM-dd HH:mm')
and d1.status = '200'
and LEFT(d1.`rpc`,3) not in ('.js')
and LEFT(d1.`rpc`,4) not in ('.jpg','.ico','.css','.ttf','.png','.PNG','.JPG','.txt','.mp4','.mp3','.pdf','.dwr')
and LEFT(d1.`rpc`,5) not in ('.json','.html','.less','.jpeg')
and LEFT(d1.`rpc`,6) not in ('.woff2')
group by
d1.`applicationName`
,d1.`agentId`
,CONCAT(LongTimeToStringUDF(cast(d1.endTime as bigint)+60000,'yyyy-MM-dd HH:mm'),':00' )
) c1
) s1
;
-- QUANTILE_APP 单位时间内访问时间排序按集群统计
insert into RZ_DM.RZ_DM_MYSQL.QUANTILE_APP
SELECT
s1.`applicationname` as `applicationname`
,s1.`time` as `time`
,SPLIT_INDEX(s1.`quantile`,';',0) as `quantile50`
,SPLIT_INDEX(s1.`quantile`,';',1) as `quantile75`
,SPLIT_INDEX(s1.`quantile`,';',2) as `quantile95`
,SPLIT_INDEX(s1.`quantile`,';',3) as `quantile99`
,cast(DateTimeToLongUDF() as varchar) as `createtime`
from(
select
c1.`applicationname` as `applicationname`
,c1.`time` as `time`
,CastToTagIndexUDF(c1.`lists`) as `quantile`
from (
select
d1.`applicationName` as `applicationname`
,CONCAT(LongTimeToStringUDF(cast(d1.endTime as bigint)+60000,'yyyy-MM-dd HH:mm'),':00' ) as `time`
,LISTAGG(d1.`elapsed`,';') as `lists` -- 拼接
from RZ_ODS.RZ_ODS_KAFKA.RZDATA d1
where
LongTimeToStringUDF(d1.endTime,'yyyy-MM-dd HH:mm') >= DATE_FORMAT(TIMESTAMPADD(MINUTE,-1,LOCALTIMESTAMP),'yyyy-MM-dd HH:mm')
and LongTimeToStringUDF(d1.endTime,'yyyy-MM-dd HH:mm') < DATE_FORMAT(TIMESTAMPADD(MINUTE,+1,LOCALTIMESTAMP),'yyyy-MM-dd HH:mm')
and d1.status = '200'
and LEFT(d1.`rpc`,3) not in ('.js')
and LEFT(d1.`rpc`,4) not in ('.jpg','.ico','.css','.ttf','.png','.PNG','.JPG','.txt','.mp4','.mp3','.pdf','.dwr')
and LEFT(d1.`rpc`,5) not in ('.json','.html','.less','.jpeg')
and LEFT(d1.`rpc`,6) not in ('.woff2')
group by
d1.`applicationName`
,CONCAT(LongTimeToStringUDF(cast(d1.endTime as bigint)+60000,'yyyy-MM-dd HH:mm'),':00' )
) c1
) s1
;
...@@ -8,7 +8,7 @@ CREATE TEMPORARY VIEW VIEW_RZ_DM_RUNSTATUS AS ...@@ -8,7 +8,7 @@ CREATE TEMPORARY VIEW VIEW_RZ_DM_RUNSTATUS AS
,s1.agentid as `agentid` ,s1.agentid as `agentid`
,s1.endpoint as `endpoint` ,s1.endpoint as `endpoint`
,s1.rpc as `rpc` ,s1.rpc as `rpc`
,concat(LongTimeToStringUDF(s1.endTime,'yyyy-MM-dd HH:mm'),":00" ) as `time` ,concat(LongTimeToStringUDF(cast(s1.endTime as bigint)*60000,'yyyy-MM-dd HH:mm'),":00" ) as `time`
,AVG(s1.elapsed ) as `averageelapsed` ,AVG(s1.elapsed ) as `averageelapsed`
,sum(1) as `total` ,sum(1) as `total`
,sum(if(s1.status = '200',1,0)) as `suctotal` ,sum(if(s1.status = '200',1,0)) as `suctotal`
...@@ -16,13 +16,14 @@ CREATE TEMPORARY VIEW VIEW_RZ_DM_RUNSTATUS AS ...@@ -16,13 +16,14 @@ CREATE TEMPORARY VIEW VIEW_RZ_DM_RUNSTATUS AS
,DateTimeToLongUDF() as `createtime` ,DateTimeToLongUDF() as `createtime`
from RZ_ODS.RZ_ODS_KAFKA_RZ.RZDATA s1 from RZ_ODS.RZ_ODS_KAFKA_RZ.RZDATA s1
where where
LongTimeToStringUDF(s1.endTime,'yyyy-MM-dd HH:mm:ss') > DATEFORMAT(TIMESTAMPADD(HOUR,-1,LOCALTIMESTAMP),'yyyy-MM-dd HH:mm:ss') LongTimeToStringUDF(s1.endTime,'yyyy-MM-dd HH:mm') > DATEFORMAT(TIMESTAMPADD(MINUTE,-3,LOCALTIMESTAMP),'yyyy-MM-dd HH:mm')
group by group by
s1.applicationname s1.applicationname
,s1.agentid ,s1.agentid
,s1.endpoint ,s1.endpoint
,s1.rpc ,s1.rpc
,concat(LongTimeToStringUDF(s1.endTime,'yyyy-MM-dd HH:mm'),":00" ) ,concat(LongTimeToStringUDF(cast(s1.endTime as bigint)*60000,'yyyy-MM-dd HH:mm'),":00" )
;
-- RZ_DM_RUNSTATUS_URL RZ_DM_访问次数按地址统计 -- RZ_DM_RUNSTATUS_URL RZ_DM_访问次数按地址统计
insert into RZ_DM.RZ_DM_MYSQL.RZDATARZ_DM_RUNSTATUS_URL insert into RZ_DM.RZ_DM_MYSQL.RZDATARZ_DM_RUNSTATUS_URL
......
-- RZ_DM_QUANTILE_AGENTID ZB_DM_单位时间内访问时间排序按应用统计 -- QUANTILE_AGENTID 单位时间内访问时间排序按应用统计
create table RZ_DM_QUANTILE_AGENTID( create table QUANTILE_AGENTID(
`applicationname` String , -- 部署集群 tag `applicationname` String primary, -- 部署集群 tag
`agentid` String , -- 应用系统 `agentid` String primary, -- 应用系统
`time` String , -- 接口访问结束时间 主键 来源为源数据 `time` String primary, -- 接口访问结束时间 主键 来源为源数据
`quantile50` String , -- 分位值50 `quantile50` String , -- 分位值50
`quantile75` String , -- 分位值75 `quantile75` String , -- 分位值75
`quantile95` String , -- 分位值95 `quantile95` String , -- 分位值95
`quantile99` String , -- 分位值99 `quantile99` String , -- 分位值99
`createtime` Long -- 创建时间 `createtime` String -- 创建时间
) )
\ No newline at end of file
-- RZ_DM_QUANTILE_APP ZB_DM_单位时间内访问时间排序按集群统计 -- QUANTILE_APP 单位时间内访问时间排序按集群统计
create table RZ_DM_QUANTILE_APP( create table QUANTILE_APP(
`applicationname` String , -- 部署集群 tag `applicationname` String primary, -- 部署集群 tag
`time` String , -- 接口访问结束时间 主键 来源为源数据 `time` String primary, -- 接口访问结束时间 主键 来源为源数据
`quantile50` String , -- 分位值50 `quantile50` String , -- 分位值50
`quantile75` String , -- 分位值75 `quantile75` String , -- 分位值75
`quantile95` String , -- 分位值95 `quantile95` String , -- 分位值95
`quantile99` String , -- 分位值99 `quantile99` String , -- 分位值99
`createtime` Long -- 创建时间 `createtime` String -- 创建时间
) )
\ No newline at end of file
-- RZ_DM_RUNSTATUS_AGENTID RZ_DM_访问次数按应用统计 -- RUNSTATUS_AGENTID 访问次数按应用统计
create table RZ_DM_RUNSTATUS_AGENTID( create table RUNSTATUS_AGENTID(
`applicationname` String , -- 部署集群 `applicationname` String primary, -- 部署集群
`agentid` String , -- 应用系统 `agentid` String primary, -- 应用系统
`time` String , -- 接口访问结束时间 主键 来源为源数据endTime精确到分的值 `time` String primary, -- 接口访问结束时间 主键 来源为源数据endTime精确到分的值
`averageelapsed` String , -- 接口平均响应时间 `averageelapsed` String , -- 接口平均响应时间
`total` String , -- 接口访问总计 `total` String , -- 接口访问总计
`suctotal` String , -- 访问成功统计 `suctotal` String , -- 访问成功统计
`errortotal` String , -- 访问失败统计 `errortotal` String , -- 访问失败统计
`createtime` Long -- 创建时间 `createtime` String -- 创建时间
) )
; ;
\ No newline at end of file
-- RZ_DM_RUNSTATUS_APP RZ_DM_访问次数按集群统计 -- RUNSTATUS_APP 访问次数按集群统计
create table RZ_DM_RUNSTATUS_APP( create table RUNSTATUS_APP(
`applicationname` String , -- 部署集群 `applicationname` String primary, -- 部署集群
`time` String , -- 接口访问结束时间 主键 来源为源数据endTime精确到分的值 `time` String primary, -- 接口访问结束时间 主键 来源为源数据endTime精确到分的值
`averageelapsed` String , -- 接口平均响应时间 `averageelapsed` String , -- 接口平均响应时间
`total` String , -- 接口访问总计 `total` String , -- 接口访问总计
`suctotal` String , -- 访问成功统计 `suctotal` String , -- 访问成功统计
`errortotal` String , -- 访问失败统计 `errortotal` String , -- 访问失败统计
`createtime` Long -- 创建时间 `createtime` String -- 创建时间
) )
; ;
\ No newline at end of file
-- RZ_DM_RUNSTATUS_URL RZ_DM_访问次数按地址统计 -- RUNSTATUS_URL 访问次数按地址统计
create table RZ_DM_RUNSTATUS_URL( create table RUNSTATUS_URL(
applicationname String primary, -- 部署集群
applicationname String , -- 部署集群 agentid String primary, -- 应用系统
agentid String , -- 应用系统 endpoint String primary, -- 服务地址
endpoint String , -- 服务地址 rpc String primary, -- 接口地址
rpc String , -- 接口地址
time String , -- 接口访问结束时间 主键 来源为源数据endTime精确到分的值 time String , -- 接口访问结束时间 主键 来源为源数据endTime精确到分的值
averageelapsed String , -- 接口平均响应时间 averageelapsed String , -- 接口平均响应时间
total String , -- 接口访问总计 total String , -- 接口访问总计
suctotal String , -- 访问成功统计 suctotal String , -- 访问成功统计
errortotal String , -- 访问失败统计 errortotal String , -- 访问失败统计
createtime Long -- 创建时间 createtime String -- 创建时间
) )
; ;
\ No newline at end of file
-- ZB_DM_PROVXLBF ZB_DM_分公司分险类保费 -- HSET_DECIMAL HSET格式DECIMAL数值存储
create table ZB_DM_PROVXLBF( create table HSET_DECIMAL(
`key` varchar(256) , `key` varchar(256) ,
`hkey` varchar(256) , `hkey` varchar(256) ,
`val` decimal(18,2) , `val` decimal(18,2) ,
......
-- ZB_DM_PROVQDBF ZB_DM_分公司今日签单保费 -- HSET_VARCHAR HSET格式VARCHAR字符存储
create table ZB_DM_PROVQDBF( create table HSET_VARCHAR(
`key` varchar(256) , `key` varchar(256) ,
`hkey` varchar(256) , `hkey` varchar(256) ,
`val` decimal(18,2) , `val` varchar(256) ,
primary key (`key`) primary key (`key`)
); );
\ No newline at end of file
-- ZB_DM_CHNLBF_FEN ZB_DM_分公司分渠道保费 -- SET_DECIMAL SET格式DECIMAL数值存储
create table ZB_DM_CHNLBF_FEN( create table SET_DECIMAL(
`key` varchar(256) , `key` varchar(256) ,
`hkey` varchar(256) ,
`val` decimal(18,2) , `val` decimal(18,2) ,
primary key (`key`) primary key (`key`)
......
-- ZB_DM_BIGCBD ZB_DM_总公司车险承保大单 -- SET_VARCHAR SET格式VARCHAR字符存储
create table ZB_DM_BIGCBD( create table SET_VARCHAR(
`key` varchar(256) , `key` varchar(256) ,
`val` varchar(1000), `val` varchar(256) ,
primary key (`key`) primary key (`key`)
)
; );
\ No newline at end of file \ No newline at end of file
-- ZB_DM_PROVQBBF ZB_DM_分公司今日签单今年起保保费
create table ZB_DM_PROVQBBF(
`key` varchar(256) ,
`hkey` varchar(256) ,
`val` decimal(18,2) ,
primary key (`key`)
);
\ No newline at end of file
-- ZB_DM_PROVDAYQBBF ZB_DM_分公司今日签单今日起保保费
create table ZB_DM_PROVDAYQBBF(
`key` varchar(256) ,
`hkey` varchar(256),
`val` decimal(18,2),
primary key (`key`)
)
;
\ No newline at end of file
-- ZB_DM_PROVMONTHQBBF ZB_DM_分公司今日签单月底前起保保费
create table ZB_DM_PROVMONTHQBBF(
`key` varchar(256) ,
`hkey` varchar(256) ,
`val` decimal(18,2) ,
primary key (`key`)
);
\ No newline at end of file
-- ZB_DM_PROVQUARTERYWLYBF ZB_DM_分公司分业务来源季末前起保保费
create table ZB_DM_PROVQUARTERYWLYBF(
`key` varchar(256) ,
`hkey` varchar(256),
`val` decimal(18,2),
primary key (`key`)
)
;
\ No newline at end of file
-- ZB_DM_PROVYWLYBF ZB_DM_分公司分业务来源年底前起保保费
create table ZB_DM_PROVYWLYBF(
`key` varchar(256) ,
`hkey` varchar(256),
`val` decimal(18,2),
primary key (`key`)
)
;
\ No newline at end of file
-- ZB_DM_PROVDAYYWLYBF ZB_DM_分公司分业务来源当日签单当日起保保费
create table ZB_DM_PROVDAYYWLYBF(
`key` varchar(256) ,
`hkey` varchar(256),
`val` decimal(18,2),
primary key (`key`)
)
;
\ No newline at end of file
-- ZB_DM_PROVMONTHYWLYBF ZB_DM_分公司分业务来源月底前起保保费
create table ZB_DM_PROVMONTHYWLYBF(
`key` varchar(256) ,
`hkey` varchar(256),
`val` decimal(18,2),
primary key (`key`)
)
;
\ No newline at end of file
-- ZB_DM_BIGCCITYBD ZB_DM_分公司车险承保大单
create table ZB_DM_BIGCCITYBD (
`key` varchar(256) ,
`val` varchar(1000) ,
primary key (`key`)
)
;
\ No newline at end of file
-- ZB_DM_BIGFCCITYBD ZB_DM_分公司非车险承保大单
create table ZB_DM_BIGFCCITYBD(
`key` varchar(256) ,
`val` varchar(1000) ,
primary key (`key`)
);
\ No newline at end of file
-- ZB_DM_ALLQBBF ZB_DM_总公司今日签单今年起保保费
create table ZB_DM_ALLQBBF(
`key` varchar(256) ,
`val` decimal(18,2),
primary key (`key`)
)
;
\ No newline at end of file
-- ZB_DM_ALLDAYQBBF ZB_DM_总公司今日签单今日起保保费
create table ZB_DM_ALLDAYQBBF(
`key` varchar(256) ,
`val` decimal(18,2),
primary key (`key`)
)
;
\ No newline at end of file
-- ZB_DM_ALLQDBF ZB_DM_总公司今日签单保费
create table ZB_DM_ALLQDBF(
`key` varchar(256) ,
`val` decimal(18,2),
primary key (`key`)
)
;
\ No newline at end of file
-- ZB_DM_ALLMONTHQBBF ZB_DM_总公司今日签单月底前起保保费
create table ZB_DM_ALLMONTHQBBF(
`key` varchar(256) ,
`val` decimal(18,2),
primary key (`key`)
)
;
\ No newline at end of file
-- ZB_DM_ALLQUARTERYWLYBF ZB_DM_总公司分业务来源季末前起保保费
create table ZB_DM_ALLQUARTERYWLYBF(
`key` varchar(256) ,
`hkey` varchar(256),
`val` decimal(18,2),
primary key (`key`)
)
;
\ No newline at end of file
-- ZB_DM_ALLYWLYBF ZB_DM_总公司分业务来源年底前起保保费
create table ZB_DM_ALLYWLYBF(
`key` varchar(256) ,
`hkey` varchar(256),
`val` decimal(18,2),
primary key (`key`)
)
;
\ No newline at end of file
-- ZB_DM_ALLDAYYWLYBF ZB_DM_总公司分业务来源当日签单当日起保保费
create table ZB_DM_ALLDAYYWLYBF(
`key` varchar(256) ,
`hkey` varchar(256),
`val` decimal(18,2),
primary key (`key`)
)
;
\ No newline at end of file
-- ZB_DM_ALLMONTHYWLYBF ZB_DM_总公司分业务来源月底前起保保费
create table ZB_DM_ALLMONTHYWLYBF(
`key` varchar(256) ,
`hkey` varchar(256),
`val` decimal(18,2),
primary key (`key`)
)
;
\ No newline at end of file
-- ZB_DM_CHNLBF ZB_DM_总公司分渠道保费
create table ZB_DM_CHNLBF(
`key` varchar(256) ,
`hkey` varchar(256),
`val` decimal(18,2),
primary key (`key`)
)
;
\ No newline at end of file
-- ZB_DM_ALLXLBF ZB_DM_总公司分险类保费
create table ZB_DM_ALLXLBF(
`key` varchar(256) ,
`hkey` varchar(256),
`val` decimal(18,2),
primary key (`key`)
)
;
\ No newline at end of file
-- ZB_DM_BIGFCBD ZB_DM_总公司非车险承保大单
create table ZB_DM_BIGCBD(
`key` varchar(256) ,
`val` varchar(1000),
primary key (`key`)
)
;
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -31,7 +31,7 @@ group by ...@@ -31,7 +31,7 @@ group by
-- 总公司 -- 总公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_ALLQBBF insert into ZB_DM.ZB_DM_REDIS.SET_DECIMAL
select select
CONCAT( CONCAT(
'allqbbf/' 'allqbbf/'
...@@ -44,7 +44,7 @@ group by ...@@ -44,7 +44,7 @@ group by
; ;
-- 分公司 -- 分公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVQBBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIAML
select select
CONCAT( CONCAT(
'provqbbf/' 'provqbbf/'
...@@ -59,7 +59,7 @@ group by ...@@ -59,7 +59,7 @@ group by
; ;
-- 中支 -- 中支
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVQBBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIAML
select select
CONCAT( CONCAT(
'cityqbbf/' 'cityqbbf/'
...@@ -75,7 +75,7 @@ group by ...@@ -75,7 +75,7 @@ group by
-- 县支 -- 县支
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVQBBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIAML
select select
CONCAT( CONCAT(
'countryqbbf/' 'countryqbbf/'
...@@ -91,7 +91,7 @@ group by ...@@ -91,7 +91,7 @@ group by
-- 团队 -- 团队
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVQBBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIAML
select select
CONCAT( CONCAT(
'teamqbbf/' 'teamqbbf/'
......
...@@ -31,7 +31,7 @@ group by ...@@ -31,7 +31,7 @@ group by
-- 总公司 -- 总公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_ALLDAYQBBF insert into ZB_DM.ZB_DM_REDIS.SET_DECIMAL
select select
CONCAT( CONCAT(
'alldayqdbf/' 'alldayqdbf/'
...@@ -44,7 +44,7 @@ group by ...@@ -44,7 +44,7 @@ group by
; ;
-- 分公司 -- 分公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVDAYQBBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'provdayqdbf/' 'provdayqdbf/'
...@@ -59,7 +59,7 @@ group by ...@@ -59,7 +59,7 @@ group by
; ;
-- 中支 -- 中支
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVDAYQBBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'citydayqdbf/' 'citydayqdbf/'
...@@ -75,7 +75,7 @@ group by ...@@ -75,7 +75,7 @@ group by
-- 县支 -- 县支
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVDAYQBBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'countrydayqdbf/' 'countrydayqdbf/'
...@@ -91,7 +91,7 @@ group by ...@@ -91,7 +91,7 @@ group by
-- 团队 -- 团队
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVDAYQBBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'teamdayqdbf/' 'teamdayqdbf/'
......
...@@ -27,7 +27,7 @@ group by ...@@ -27,7 +27,7 @@ group by
; ;
-- 总公司 -- 总公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_ALLQDBF insert into ZB_DM.ZB_DM_REDIS.SET_DECIMAL
select select
CONCAT( CONCAT(
'allqdbf/' 'allqdbf/'
...@@ -40,7 +40,7 @@ group by ...@@ -40,7 +40,7 @@ group by
; ;
-- 分公司 -- 分公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVQDBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'provqdbf/' 'provqdbf/'
...@@ -56,7 +56,7 @@ group by ...@@ -56,7 +56,7 @@ group by
-- 中支 -- 中支
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVQDBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'cityqdbf/' 'cityqdbf/'
...@@ -71,7 +71,7 @@ group by ...@@ -71,7 +71,7 @@ group by
; ;
-- 县支 -- 县支
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVQDBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'countryqdbf/' 'countryqdbf/'
...@@ -86,7 +86,7 @@ group by ...@@ -86,7 +86,7 @@ group by
; ;
-- 团队 -- 团队
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVQDBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'teamqdbf/' 'teamqdbf/'
......
-- ZB_DM_JRQDJDMQBBF ZB_DM_今日签单季度末起保保费
-- key:allquarterqdbf
-- 1. 保单的时间口径为: 核保时间在今天并且起保时间的月份等于季度。
-- 2. 批单的时间口径为: 核批通过时间在今天并且核批生效时间的月份等于季度。
-- step1:
-- 团队汇总
CREATE TEMPORARY VIEW VIEW_ZB_DM_JRQDJDMQBBF_TUANDUI AS
SELECT
s1.`uwConclueDate` as `uwConclueDate`
,s1.`LEVEL1COMCODE` as `LEVEL1COMCODE`
,s1.`LEVEL2COMCODE` as `LEVEL2COMCODE`
,s1.`LEVEL3COMCODE` as `LEVEL3COMCODE`
,s1.`LEVEL4COMCODE` as `LEVEL4COMCODE`
,sum(cast(s1.`cost` as DECIMAL(18,2))) as `cost`
from ZB_ODS.ZB_ODS_KAFKA.ZBDATA s1
where
s1.`COMNAME` is not null
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
-- 核保时间在今天并且起保时间的月份小于等于季度。
and QUARTER(TO_DATE(left(s1.`startTime`, 8), 'yyyyMMdd')) = QUARTER(CURRENT_DATE)
group by
s1.`uwConclueDate`
,s1.`LEVEL1COMCODE`
,s1.`LEVEL2COMCODE`
,s1.`LEVEL3COMCODE`
,s1.`LEVEL4COMCODE`
;
-- 总公司
insert into ZB_DM.ZB_DM_REDIS.SET_DECIMAL
select
CONCAT(
'allquarterqdbf/'
,s1.`uwConclueDate`
) as `key`
,sum(cast(s1.`cost` as DECIMAL(18,2))) as `val`
from VIEW_ZB_DM_JRQDJDMQBBF_TUANDUI s1
group by
s1.`uwConclueDate`
;
-- 分公司
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT(
'provquarterqdbf/'
,s1.`uwConclueDate`
) as `key`
,s1.`LEVEL1COMCODE` as `hkey`
,sum(cast(s1.`cost` as DECIMAL(18,2))) as `val`
from VIEW_ZB_DM_JRQDJDMQBBF_TUANDUI s1
group by
s1.`uwConclueDate`
,s1.`LEVEL1COMCODE`
;
-- 中支
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT(
'cityquarterqdbf/'
,s1.`uwConclueDate`
) as `key`
,s1.`LEVEL2COMCODE` as `hkey`
,sum(cast(s1.`cost` as DECIMAL(18,2))) as `val`
from VIEW_ZB_DM_JRQDJDMQBBF_TUANDUI s1
group by
s1.`uwConclueDate`
,s1.`LEVEL2COMCODE`
;
-- 县支
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT(
'countyquarterqdbf/'
,s1.`uwConclueDate`
) as `key`
,s1.`LEVEL3COMCODE` as `hkey`
,sum(cast(s1.`cost` as DECIMAL(18,2))) as `val`
from VIEW_ZB_DM_JRQDJDMQBBF_TUANDUI s1
group by
s1.`uwConclueDate`
,s1.`LEVEL3COMCODE`
;
-- 团队
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT(
'teamquarterqdbf/'
,s1.`uwConclueDate`
) as `key`
,s1.`LEVEL1COMCODE` as `hkey`
,cast(s1.`cost` as DECIMAL(18,2)) as `val`
from VIEW_ZB_DM_JRQDJDMQBBF_TUANDUI s1
;
...@@ -30,7 +30,7 @@ group by ...@@ -30,7 +30,7 @@ group by
-- 总公司 -- 总公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_ALLMONTHQBBF insert into ZB_DM.ZB_DM_REDIS.SET_DECIMAL
select select
CONCAT( CONCAT(
'allmonthqbbf/' 'allmonthqbbf/'
...@@ -43,7 +43,7 @@ group by ...@@ -43,7 +43,7 @@ group by
; ;
-- 分公司 -- 分公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVMONTHQBBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'provmonthqbbf/' 'provmonthqbbf/'
...@@ -58,7 +58,7 @@ group by ...@@ -58,7 +58,7 @@ group by
; ;
-- 中支 -- 中支
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVMONTHQBBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'citymonthqbbf/' 'citymonthqbbf/'
...@@ -74,7 +74,7 @@ group by ...@@ -74,7 +74,7 @@ group by
-- 县支 -- 县支
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVMONTHQBBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'countrymonthqbbf/' 'countrymonthqbbf/'
...@@ -90,7 +90,7 @@ group by ...@@ -90,7 +90,7 @@ group by
-- 团队 -- 团队
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVMONTHQBBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'teammonthqbbf/' 'teammonthqbbf/'
......
...@@ -37,7 +37,7 @@ group by ...@@ -37,7 +37,7 @@ group by
-- 总公司 -- 总公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_ALLQUARTERYWLYBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'allquarterywlybf/' 'allquarterywlybf/'
...@@ -52,7 +52,7 @@ group by ...@@ -52,7 +52,7 @@ group by
; ;
-- 分公司 -- 分公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVQUARTERYWLYBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'provquarterywlybf/' 'provquarterywlybf/'
...@@ -71,7 +71,7 @@ group by ...@@ -71,7 +71,7 @@ group by
-- 中支 -- 中支
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVQUARTERYWLYBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'cityquarterywlybf/' 'cityquarterywlybf/'
...@@ -90,7 +90,7 @@ group by ...@@ -90,7 +90,7 @@ group by
-- 县支 -- 县支
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVQUARTERYWLYBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'countryquarterywlybf/' 'countryquarterywlybf/'
...@@ -109,7 +109,7 @@ group by ...@@ -109,7 +109,7 @@ group by
-- 团队 -- 团队
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVQUARTERYWLYBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'teamquarterywlybf/' 'teamquarterywlybf/'
......
...@@ -33,7 +33,7 @@ group by ...@@ -33,7 +33,7 @@ group by
-- 总公司 -- 总公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_ALLYWLYBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'allywlybf/' 'allywlybf/'
...@@ -48,7 +48,7 @@ group by ...@@ -48,7 +48,7 @@ group by
; ;
-- 分公司 -- 分公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVYWLYBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'provywlybf/' 'provywlybf/'
...@@ -67,7 +67,7 @@ group by ...@@ -67,7 +67,7 @@ group by
-- 中支 -- 中支
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVYWLYBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'cityywlybf/' 'cityywlybf/'
...@@ -86,7 +86,7 @@ group by ...@@ -86,7 +86,7 @@ group by
-- 县支 -- 县支
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVYWLYBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'countryywlybf/' 'countryywlybf/'
...@@ -105,7 +105,7 @@ group by ...@@ -105,7 +105,7 @@ group by
-- 团队 -- 团队
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVYWLYBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'teamywlybf/' 'teamywlybf/'
......
...@@ -33,7 +33,7 @@ group by ...@@ -33,7 +33,7 @@ group by
-- 总公司 -- 总公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_ALLDAYYWLYBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'alldayywlybf/' 'alldayywlybf/'
...@@ -48,7 +48,7 @@ group by ...@@ -48,7 +48,7 @@ group by
; ;
-- 分公司 -- 分公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVDAYYWLYBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'provdayywlybf/' 'provdayywlybf/'
...@@ -67,7 +67,7 @@ group by ...@@ -67,7 +67,7 @@ group by
-- 中支 -- 中支
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVDAYYWLYBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'citydayywlybf/' 'citydayywlybf/'
...@@ -86,7 +86,7 @@ group by ...@@ -86,7 +86,7 @@ group by
-- 县支 -- 县支
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVDAYYWLYBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'countrydayywlybf/' 'countrydayywlybf/'
...@@ -105,7 +105,7 @@ group by ...@@ -105,7 +105,7 @@ group by
-- 团队 -- 团队
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVDAYYWLYBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'teamdayywlybf/' 'teamdayywlybf/'
......
...@@ -33,7 +33,7 @@ group by ...@@ -33,7 +33,7 @@ group by
-- 总公司 -- 总公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_ALLMONTHYWLYBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'allmonthywlybf/' 'allmonthywlybf/'
...@@ -48,7 +48,7 @@ group by ...@@ -48,7 +48,7 @@ group by
; ;
-- 分公司 -- 分公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVMONTHYWLYBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'provmonthywlybf/' 'provmonthywlybf/'
...@@ -67,7 +67,7 @@ group by ...@@ -67,7 +67,7 @@ group by
-- 中支 -- 中支
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVMONTHYWLYBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'citymonthywlybf/' 'citymonthywlybf/'
...@@ -86,7 +86,7 @@ group by ...@@ -86,7 +86,7 @@ group by
-- 县支 -- 县支
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVMONTHYWLYBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'countrymonthywlybf/' 'countrymonthywlybf/'
...@@ -105,7 +105,7 @@ group by ...@@ -105,7 +105,7 @@ group by
-- 团队 -- 团队
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVMONTHYWLYBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'teammonthywlybf/' 'teammonthywlybf/'
......
...@@ -31,7 +31,7 @@ group by ...@@ -31,7 +31,7 @@ group by
-- 总公司 -- 总公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_CHNLBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'chnlbf/' 'chnlbf/'
...@@ -48,7 +48,7 @@ group by ...@@ -48,7 +48,7 @@ group by
; ;
-- 分公司 -- 分公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_CHNLBF_FEN insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'chnlbf/' 'chnlbf/'
...@@ -66,7 +66,7 @@ group by ...@@ -66,7 +66,7 @@ group by
-- 中支 -- 中支
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_CHNLBF_FEN insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'citychnlbf/' 'citychnlbf/'
...@@ -85,7 +85,7 @@ group by ...@@ -85,7 +85,7 @@ group by
-- 县支 -- 县支
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_CHNLBF_FEN insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'countrychnlbf/' 'countrychnlbf/'
...@@ -104,7 +104,7 @@ group by ...@@ -104,7 +104,7 @@ group by
-- 团队 -- 团队
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_CHNLBF_FEN insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'teamchnlbf/' 'teamchnlbf/'
......
...@@ -31,7 +31,7 @@ group by ...@@ -31,7 +31,7 @@ group by
; ;
--总公司 --总公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_ALLXLBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'allxlbf/' 'allxlbf/'
...@@ -47,7 +47,7 @@ group by ...@@ -47,7 +47,7 @@ group by
; ;
-- 分公司 -- 分公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVXLBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'provxlbf/' 'provxlbf/'
...@@ -64,7 +64,7 @@ group by ...@@ -64,7 +64,7 @@ group by
; ;
-- 中支 -- 中支
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVXLBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'cityxlbf/' 'cityxlbf/'
...@@ -81,7 +81,7 @@ group by ...@@ -81,7 +81,7 @@ group by
; ;
-- 县支 -- 县支
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVXLBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'countryxlbf/' 'countryxlbf/'
...@@ -98,7 +98,7 @@ group by ...@@ -98,7 +98,7 @@ group by
; ;
-- 团队 -- 团队
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVXLBF insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select select
CONCAT( CONCAT(
'teamxlbf/' 'teamxlbf/'
......
-- ZB_DM_QDBF_CAR/ZB_DM_车险今日签单保费
-- key:allcarqbbf/日期
-- 1. 保单的时间口径为: 核保时间在今天
-- 2. 批单的时间口径为: 核批通过时间在今天
-- step1:
-- 团队汇总
CREATE TEMPORARY VIEW VIEW_ZB_DM_QDBF_CAR_TUANDUI AS
SELECT
s1.`uwConclueDate` as `uwConclueDate`
,s1.`LEVEL1COMCODE` as `LEVEL1COMCODE`
,s1.`LEVEL2COMCODE` as `LEVEL2COMCODE`
,s1.`LEVEL3COMCODE` as `LEVEL3COMCODE`
,s1.`LEVEL4COMCODE` as `LEVEL4COMCODE`
,sum(cast(s1.`cost` as DECIMAL(18,2))) as `cost`
from ZB_ODS.ZB_ODS_KAFKA.ZBDATA s1
where
s1.`COMNAME` is not null
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
-- 核保时间在今天并且起保时间的月份小于等于当月。
and left(s1.risk,2) ='05'
group by
s1.`uwConclueDate`
,s1.`LEVEL1COMCODE`
,s1.`LEVEL2COMCODE`
,s1.`LEVEL3COMCODE`
,s1.`LEVEL4COMCODE`
;
-- 总公司
insert into ZB_DM.ZB_DM_REDIS.SET_DECIMAL
select
CONCAT(
'allcarqdbf/'
,s1.`uwConclueDate`
) as `key`
,sum(cast(s1.`cost` as DECIMAL(18,2))) as `val`
from VIEW_ZB_DM_QDBF_CAR_TUANDUI s1
group by
s1.`uwConclueDate`
;
-- 分公司
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT(
'provcarqdbf/'
,s1.`uwConclueDate`
) as `key`
,s1.`LEVEL1COMCODE` as `hkey`
,sum(cast(s1.`cost` as DECIMAL(18,2))) as `val`
from VIEW_ZB_DM_QDBF_CAR_TUANDUI s1
group by
s1.`uwConclueDate`
,s1.`LEVEL1COMCODE`
;
-- 中支
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT(
'citycarqdbf/'
,s1.`uwConclueDate`
) as `key`
,s1.`LEVEL2COMCODE` as `hkey`
,sum(cast(s1.`cost` as DECIMAL(18,2))) as `val`
from VIEW_ZB_DM_QDBF_CAR_TUANDUI s1
group by
s1.`uwConclueDate`
,s1.`LEVEL2COMCODE`
;
-- 县支
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT(
'countycarqdbf/'
,s1.`uwConclueDate`
) as `key`
,s1.`LEVEL3COMCODE` as `hkey`
,sum(cast(s1.`cost` as DECIMAL(18,2))) as `val`
from VIEW_ZB_DM_QDBF_CAR_TUANDUI s1
group by
s1.`uwConclueDate`
,s1.`LEVEL3COMCODE`
;
-- 团队
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT(
'teamcarqdbf/'
,s1.`uwConclueDate`
) as `key`
,s1.`LEVEL1COMCODE` as `hkey`
,cast(s1.`cost` as DECIMAL(18,2)) as `val`
from VIEW_ZB_DM_QDBF_CAR_TUANDUI s1
;
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
-- 核保或者核批时间在今天,按照保费或者未决赔款排序,取前10,车险riskcode 05开头,其他为非车, -- 核保或者核批时间在今天,按照保费或者未决赔款排序,取前10,车险riskcode 05开头,其他为非车,
-- 总公司 -- 总公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_BIGCBD insert into ZB_DM.ZB_DM_REDIS.SET_VARCHAR
select select
CONCAT( CONCAT(
'bigcbd/' 'bigcbd/'
...@@ -54,7 +54,7 @@ group by ...@@ -54,7 +54,7 @@ group by
-- 分公司 -- 分公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_BIGCCITYBD insert into ZB_DM.ZB_DM_REDIS.SET_VARCHAR
select select
CONCAT( CONCAT(
'bigccitybd/' 'bigccitybd/'
...@@ -107,7 +107,7 @@ group by ...@@ -107,7 +107,7 @@ group by
-- 中支 -- 中支
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_BIGCCITYBD insert into ZB_DM.ZB_DM_REDIS.SET_VARCHAR
select select
CONCAT( CONCAT(
'bigccountrybd/' 'bigccountrybd/'
......
-- ZB_DM_QDBF_NOCAR/ZB_DM_非车险今日签单保费
-- key:allnocarqbbf/日期
-- 1. 保单的时间口径为: 核保时间在今天且险种代码不以‘05’开头
-- 2. 批单的时间口径为: 核批通过时间在今天且险种代码不以‘05’开头
-- step1:
-- 团队汇总
CREATE TEMPORARY VIEW VIEW_ZB_DM_QDBF_NOCAR_TUANDUI AS
SELECT
s1.`uwConclueDate` as `uwConclueDate`
,s1.`LEVEL1COMCODE` as `LEVEL1COMCODE`
,s1.`LEVEL2COMCODE` as `LEVEL2COMCODE`
,s1.`LEVEL3COMCODE` as `LEVEL3COMCODE`
,s1.`LEVEL4COMCODE` as `LEVEL4COMCODE`
,sum(cast(s1.`cost` as DECIMAL(18,2))) as `cost`
from ZB_ODS.ZB_ODS_KAFKA.ZBDATA s1
where
s1.`COMNAME` is not null
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
-- 核保时间在今天并且起保时间的月份小于等于当月。
and left(s1.risk,2) <>'05'
group by
s1.`uwConclueDate`
,s1.`LEVEL1COMCODE`
,s1.`LEVEL2COMCODE`
,s1.`LEVEL3COMCODE`
,s1.`LEVEL4COMCODE`
;
-- 总公司
insert into ZB_DM.ZB_DM_REDIS.SET_DECIMAL
select
CONCAT(
'allnocarqdbf/'
,s1.`uwConclueDate`
) as `key`
,sum(cast(s1.`cost` as DECIMAL(18,2))) as `val`
from VIEW_ZB_DM_QDBF_NOCAR_TUANDUI s1
group by
s1.`uwConclueDate`
;
-- 分公司
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT(
'provnocarqdbf/'
,s1.`uwConclueDate`
) as `key`
,s1.`LEVEL1COMCODE` as `hkey`
,sum(cast(s1.`cost` as DECIMAL(18,2))) as `val`
from VIEW_ZB_DM_QDBF_NOCAR_TUANDUI s1
group by
s1.`uwConclueDate`
,s1.`LEVEL1COMCODE`
;
-- 中支
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT(
'citynocarqdbf/'
,s1.`uwConclueDate`
) as `key`
,s1.`LEVEL2COMCODE` as `hkey`
,sum(cast(s1.`cost` as DECIMAL(18,2))) as `val`
from VIEW_ZB_DM_QDBF_NOCAR_TUANDUI s1
group by
s1.`uwConclueDate`
,s1.`LEVEL2COMCODE`
;
-- 县支
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT(
'countynocarqdbf/'
,s1.`uwConclueDate`
) as `key`
,s1.`LEVEL3COMCODE` as `hkey`
,sum(cast(s1.`cost` as DECIMAL(18,2))) as `val`
from VIEW_ZB_DM_QDBF_NOCAR_TUANDUI s1
group by
s1.`uwConclueDate`
,s1.`LEVEL3COMCODE`
;
-- 团队
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT(
'teamnocarqdbf/'
,s1.`uwConclueDate`
) as `key`
,s1.`LEVEL1COMCODE` as `hkey`
,cast(s1.`cost` as DECIMAL(18,2)) as `val`
from VIEW_ZB_DM_QDBF_NOCAR_TUANDUI s1
;
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
-- 核保或者核批时间在今天,按照保费或者未决赔款排序,取前10,车险riskcode 05开头,其他为非车, -- 核保或者核批时间在今天,按照保费或者未决赔款排序,取前10,车险riskcode 05开头,其他为非车,
-- 总公司 -- 总公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_BIGFCBD insert into ZB_DM.ZB_DM_REDIS.SET_VARCHAR
select select
CONCAT( CONCAT(
'bigfcbd/' 'bigfcbd/'
...@@ -52,7 +52,7 @@ group by ...@@ -52,7 +52,7 @@ group by
;; ;;
-- 分公司 -- 分公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_BIGFCCITYBD insert into ZB_DM.ZB_DM_REDIS.SET_VARCHAR
select select
CONCAT( CONCAT(
'bigfccitybd/' 'bigfccitybd/'
...@@ -105,7 +105,7 @@ group by ...@@ -105,7 +105,7 @@ group by
-- 中支 -- 中支
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_BIGFCCITYBD insert into ZB_DM.ZB_DM_REDIS.SET_VARCHAR
select select
CONCAT( CONCAT(
'bigfccountrybd/' 'bigfccountrybd/'
......
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