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

调整指标计算目标表

parent 68f08927
......@@ -8,17 +8,22 @@ CREATE TEMPORARY VIEW VIEW_RZ_DM_QUANTILE AS
SELECT
d1.`applicationname` as `applicationname`
,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`
,ROW_NUMBER() OVER(PARTITION BY
d1.`applicationname`
,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
) AS rownum
from RZ_ODS.RZ_ODS_KAFKA_RZ.RZDATA d1
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(
select
d1.`applicationname` as `applicationname`
,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.75 ) as `num75`
,CEIL(count(1)*0.95 ) as `num95`
,CEIL(count(1)*0.99 ) as `num99`
from RZ_ODS.RZ_ODS_KAFKA_RZ.RZDATA d1
where
LongTimeToStringUDF(s1.endTime,'yyyy-MM-dd HH:mm:ss') > DATEFORMAT(TIMESTAMPADD(HOUR,-1,LOCALTIMESTAMP),'yyyy-MM-dd HH:mm:ss')
where
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
d1.`applicationname` as `applicationname`
,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
left join VIEW_RZ_DM_QUANTILE v1
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
,s1.agentid as `agentid`
,s1.endpoint as `endpoint`
,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`
,sum(1) as `total`
,sum(if(s1.status = '200',1,0)) as `suctotal`
......@@ -16,13 +16,14 @@ CREATE TEMPORARY VIEW VIEW_RZ_DM_RUNSTATUS AS
,DateTimeToLongUDF() as `createtime`
from RZ_ODS.RZ_ODS_KAFKA_RZ.RZDATA s1
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
s1.applicationname
,s1.agentid
,s1.endpoint
,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_访问次数按地址统计
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(
`applicationname` String , -- 部署集群 tag
`agentid` String , -- 应用系统
`time` String , -- 接口访问结束时间 主键 来源为源数据
create table QUANTILE_AGENTID(
`applicationname` String primary, -- 部署集群 tag
`agentid` String primary, -- 应用系统
`time` String primary, -- 接口访问结束时间 主键 来源为源数据
`quantile50` String , -- 分位值50
`quantile75` String , -- 分位值75
`quantile95` String , -- 分位值95
`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(
`applicationname` String , -- 部署集群 tag
`time` String , -- 接口访问结束时间 主键 来源为源数据
create table QUANTILE_APP(
`applicationname` String primary, -- 部署集群 tag
`time` String primary, -- 接口访问结束时间 主键 来源为源数据
`quantile50` String , -- 分位值50
`quantile75` String , -- 分位值75
`quantile95` String , -- 分位值95
`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 , -- 部署集群
`agentid` String , -- 应用系统
`time` String , -- 接口访问结束时间 主键 来源为源数据endTime精确到分的值
`applicationname` String primary, -- 部署集群
`agentid` String primary, -- 应用系统
`time` String primary, -- 接口访问结束时间 主键 来源为源数据endTime精确到分的值
`averageelapsed` String , -- 接口平均响应时间
`total` String , -- 接口访问总计
`suctotal` 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 , -- 部署集群
`time` String , -- 接口访问结束时间 主键 来源为源数据endTime精确到分的值
`applicationname` String primary, -- 部署集群
`time` String primary, -- 接口访问结束时间 主键 来源为源数据endTime精确到分的值
`averageelapsed` String , -- 接口平均响应时间
`total` String , -- 接口访问总计
`suctotal` 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(
applicationname String , -- 部署集群
agentid String , -- 应用系统
endpoint String , -- 服务地址
rpc String , -- 接口地址
create table RUNSTATUS_URL(
applicationname String primary, -- 部署集群
agentid String primary, -- 应用系统
endpoint String primary, -- 服务地址
rpc String primary, -- 接口地址
time String , -- 接口访问结束时间 主键 来源为源数据endTime精确到分的值
averageelapsed String , -- 接口平均响应时间
total String , -- 接口访问总计
suctotal String , -- 访问成功统计
errortotal String , -- 访问失败统计
createtime Long -- 创建时间
createtime String -- 创建时间
)
;
\ No newline at end of file
-- ZB_DM_PROVXLBF ZB_DM_分公司分险类保费
create table ZB_DM_PROVXLBF(
-- HSET_DECIMAL HSET格式DECIMAL数值存储
create table HSET_DECIMAL(
`key` varchar(256) ,
`hkey` varchar(256) ,
`val` decimal(18,2) ,
......
-- ZB_DM_PROVQDBF ZB_DM_分公司今日签单保费
create table ZB_DM_PROVQDBF(
-- HSET_VARCHAR HSET格式VARCHAR字符存储
create table HSET_VARCHAR(
`key` varchar(256) ,
`hkey` varchar(256) ,
`val` decimal(18,2) ,
`val` varchar(256) ,
primary key (`key`)
);
\ No newline at end of file
-- ZB_DM_CHNLBF_FEN ZB_DM_分公司分渠道保费
create table ZB_DM_CHNLBF_FEN(
-- SET_DECIMAL SET格式DECIMAL数值存储
create table SET_DECIMAL(
`key` varchar(256) ,
`hkey` varchar(256) ,
`val` decimal(18,2) ,
primary key (`key`)
......
-- ZB_DM_BIGCBD ZB_DM_总公司车险承保大单
create table ZB_DM_BIGCBD(
-- SET_VARCHAR SET格式VARCHAR字符存储
create table SET_VARCHAR(
`key` varchar(256) ,
`val` varchar(1000),
`val` varchar(256) ,
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
-- 总公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_ALLQBBF
insert into ZB_DM.ZB_DM_REDIS.SET_DECIMAL
select
CONCAT(
'allqbbf/'
......@@ -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
CONCAT(
'provqbbf/'
......@@ -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
CONCAT(
'cityqbbf/'
......@@ -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
CONCAT(
'countryqbbf/'
......@@ -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
CONCAT(
'teamqbbf/'
......
......@@ -6,60 +6,60 @@
-- step1:
-- 团队汇总
CREATE TEMPORARY VIEW VIEW_ZB_DM_JRQDJRQBBF_TUANDUI AS
SELECT
CREATE TEMPORARY VIEW VIEW_ZB_DM_JRQDJRQBBF_TUANDUI AS
SELECT
s1.`uwConclueDate` as `uwConclueDate`
,s1.`LEVEL1COMCODE` as `LEVEL1COMCODE`
,s1.`LEVEL2COMCODE` as `LEVEL2COMCODE`
,s1.`LEVEL3COMCODE` as `LEVEL3COMCODE`
,s1.`LEVEL4COMCODE` as `LEVEL4COMCODE`
,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
where
s1.`COMNAME` is not null
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
-- 起保时间的日份小于等于今日
and left(s1.`startTime`,8) <= DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
group by
group by
s1.`uwConclueDate`
,s1.`LEVEL1COMCODE`
,s1.`LEVEL2COMCODE`
,s1.`LEVEL3COMCODE`
,s1.`LEVEL4COMCODE`
,s1.`LEVEL1COMCODE`
,s1.`LEVEL2COMCODE`
,s1.`LEVEL3COMCODE`
,s1.`LEVEL4COMCODE`
;
-- 总公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_ALLDAYQBBF
select
insert into ZB_DM.ZB_DM_REDIS.SET_DECIMAL
select
CONCAT(
'alldayqdbf/'
,s1.`uwConclueDate`
) as `key`
,sum(cast(s1.`cost` as DECIMAL(18,2))) as `val`
) as `key`
,sum(cast(s1.`cost` as DECIMAL(18,2))) as `val`
from VIEW_ZB_DM_JRQDJRQBBF_TUANDUI s1
group by
group by
s1.`uwConclueDate`
;
-- 分公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVDAYQBBF
select
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT(
'provdayqdbf/'
,s1.`uwConclueDate`
) as `key`
,s1.`LEVEL1COMCODE` as `hkey`
,sum(cast(s1.`cost` as DECIMAL(18,2))) as `val`
,s1.`LEVEL1COMCODE` as `hkey`
,sum(cast(s1.`cost` as DECIMAL(18,2))) as `val`
from VIEW_ZB_DM_JRQDJRQBBF_TUANDUI s1
group by
s1.`uwConclueDate`
,s1.`LEVEL1COMCODE`
group by
s1.`uwConclueDate`
,s1.`LEVEL1COMCODE`
;
-- 中支
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVDAYQBBF
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT(
'citydayqdbf/'
......@@ -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
CONCAT(
'countrydayqdbf/'
......@@ -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
CONCAT(
'teamdayqdbf/'
......
......@@ -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
CONCAT(
'allqdbf/'
......@@ -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
CONCAT(
'provqdbf/'
......@@ -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
CONCAT(
'cityqdbf/'
......@@ -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
CONCAT(
'countryqdbf/'
......@@ -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
CONCAT(
'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
-- 总公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_ALLMONTHQBBF
insert into ZB_DM.ZB_DM_REDIS.SET_DECIMAL
select
CONCAT(
'allmonthqbbf/'
......@@ -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
CONCAT(
'provmonthqbbf/'
......@@ -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
CONCAT(
'citymonthqbbf/'
......@@ -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
CONCAT(
'countrymonthqbbf/'
......@@ -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
CONCAT(
'teammonthqbbf/'
......
......@@ -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
CONCAT(
'allquarterywlybf/'
......@@ -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
CONCAT(
'provquarterywlybf/'
......@@ -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
CONCAT(
'cityquarterywlybf/'
......@@ -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
CONCAT(
'countryquarterywlybf/'
......@@ -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
CONCAT(
'teamquarterywlybf/'
......
......@@ -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
CONCAT(
'allywlybf/'
......@@ -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
CONCAT(
'provywlybf/'
......@@ -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
CONCAT(
'cityywlybf/'
......@@ -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
CONCAT(
'countryywlybf/'
......@@ -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
CONCAT(
'teamywlybf/'
......
......@@ -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
CONCAT(
'alldayywlybf/'
......@@ -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
CONCAT(
'provdayywlybf/'
......@@ -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
CONCAT(
'citydayywlybf/'
......@@ -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
CONCAT(
'countrydayywlybf/'
......@@ -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
CONCAT(
'teamdayywlybf/'
......
......@@ -6,68 +6,68 @@
-- step1:
-- 团队汇总
CREATE TEMPORARY VIEW VIEW_ZB_DM_FYWLYBFYDQQB_TUANDUI AS
SELECT
CREATE TEMPORARY VIEW VIEW_ZB_DM_FYWLYBFYDQQB_TUANDUI AS
SELECT
s1.`uwConclueDate` as `uwConclueDate`
,s1.`businessNatureCode` as `businessNatureCode`
,s1.`LEVEL1COMCODE` as `LEVEL1COMCODE`
,s1.`LEVEL2COMCODE` as `LEVEL2COMCODE`
,s1.`LEVEL3COMCODE` as `LEVEL3COMCODE`
,s1.`LEVEL4COMCODE` as `LEVEL4COMCODE`
,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
where
s1.`COMNAME` is not null
and s1.`uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
-- 起保时间的月份小于等于当月
and left(s1.`startTime`,6) <= DATE_FORMAT(LOCALTIMESTAMP,'yyyyMM')
group by
group by
s1.`uwConclueDate`
,s1.`businessNatureCode`
,s1.`LEVEL1COMCODE`
,s1.`LEVEL2COMCODE`
,s1.`LEVEL3COMCODE`
,s1.`LEVEL4COMCODE`
,s1.`businessNatureCode`
,s1.`LEVEL1COMCODE`
,s1.`LEVEL2COMCODE`
,s1.`LEVEL3COMCODE`
,s1.`LEVEL4COMCODE`
;
-- 总公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_ALLMONTHYWLYBF
select
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT(
'allmonthywlybf/'
,s1.`uwConclueDate`
) as `key`
,s1.`businessNatureCode` as `hkey`
,sum(cast(s1.`cost` as DECIMAL(18,2))) as `val`
,sum(cast(s1.`cost` as DECIMAL(18,2))) as `val`
from VIEW_ZB_DM_FYWLYBFYDQQB_TUANDUI s1
group by
group by
s1.`uwConclueDate`
,s1.`businessNatureCode`
;
-- 分公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVMONTHYWLYBF
select
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT(
'provmonthywlybf/'
,s1.`uwConclueDate`
,'/'
,s1.`LEVEL1COMCODE`
) as `key`
,s1.`businessNatureCode` as `hkey`
,sum(cast(s1.`cost` as DECIMAL(18,2))) as `val`
,s1.`businessNatureCode` as `hkey`
,sum(cast(s1.`cost` as DECIMAL(18,2))) as `val`
from VIEW_ZB_DM_FYWLYBFYDQQB_TUANDUI s1
group by
group by
s1.`uwConclueDate`
,s1.`businessNatureCode`
,s1.`LEVEL1COMCODE`
,s1.`LEVEL1COMCODE`
;
-- 中支
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_PROVMONTHYWLYBF
insert into ZB_DM.ZB_DM_REDIS.HSET_DECIMAL
select
CONCAT(
'citymonthywlybf/'
......@@ -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
CONCAT(
'countrymonthywlybf/'
......@@ -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
CONCAT(
'teammonthywlybf/'
......
......@@ -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
CONCAT(
'chnlbf/'
......@@ -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
CONCAT(
'chnlbf/'
......@@ -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
CONCAT(
'citychnlbf/'
......@@ -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
CONCAT(
'countrychnlbf/'
......@@ -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
CONCAT(
'teamchnlbf/'
......
......@@ -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
CONCAT(
'allxlbf/'
......@@ -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
CONCAT(
'provxlbf/'
......@@ -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
CONCAT(
'cityxlbf/'
......@@ -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
CONCAT(
'countryxlbf/'
......@@ -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
CONCAT(
'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 @@
-- 核保或者核批时间在今天,按照保费或者未决赔款排序,取前10,车险riskcode 05开头,其他为非车,
-- 总公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_BIGCBD
insert into ZB_DM.ZB_DM_REDIS.SET_VARCHAR
select
CONCAT(
'bigcbd/'
......@@ -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
CONCAT(
'bigccitybd/'
......@@ -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
CONCAT(
'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 @@
-- 核保或者核批时间在今天,按照保费或者未决赔款排序,取前10,车险riskcode 05开头,其他为非车,
-- 总公司
insert into ZB_DM.ZB_DM_REDIS.ZB_DM_BIGFCBD
insert into ZB_DM.ZB_DM_REDIS.SET_VARCHAR
select
CONCAT(
'bigfcbd/'
......@@ -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
CONCAT(
'bigfccitybd/'
......@@ -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
CONCAT(
'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