Commit 245b7344 authored by 王东's avatar 王东

指标计算承保字段调整

parent 89b8b438
......@@ -28,10 +28,10 @@ from(
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')
and RIGHT(d1.`rpc`,3) not in ('.js')
and RIGHT(d1.`rpc`,4) not in ('.jpg','.ico','.css','.ttf','.png','.PNG','.JPG','.txt','.mp4','.mp3','.pdf','.dwr')
and RIGHT(d1.`rpc`,5) not in ('.json','.html','.less','.jpeg')
and RIGHT(d1.`rpc`,6) not in ('.woff2')
group by
d1.`applicationName`
,d1.`agentId`
......@@ -66,10 +66,10 @@ from(
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')
and RIGHT(d1.`rpc`,3) not in ('.js')
and RIGHT(d1.`rpc`,4) not in ('.jpg','.ico','.css','.ttf','.png','.PNG','.JPG','.txt','.mp4','.mp3','.pdf','.dwr')
and RIGHT(d1.`rpc`,5) not in ('.json','.html','.less','.jpeg')
and RIGHT(d1.`rpc`,6) not in ('.woff2')
group by
d1.`applicationName`
,CONCAT(LongTimeToStringUDF(cast(d1.endTime as bigint)+60000,'yyyy-MM-dd HH:mm'),':00' )
......
......@@ -17,11 +17,13 @@ create table CBDATA(
`LEVEL5COMDESC` String ,-- 五级名称
`risk` String ,-- 险种代码
`riskname` String ,-- 险种代码名称
`classcode` String ,-- 险类代码
`classname` String ,--险类代码名称
`chnl` String ,-- 业务渠道
`chnlname` String ,-- 业务渠道名称
`businessNatureCode` String ,-- 业务来源
`businessNatureName` String ,-- 业务来源名称
`cost` String ,-- 含税保费
`cost` String ,-- 不含税转汇率保费
`no` String , -- 保单号
`xxzflag` String , -- 新续转标记 1是0否
`id` String , -- 14 归属业务员ID
......
......@@ -8,8 +8,39 @@
-- 2、汇率换算 = 承保保费 * sigAndStaExchangeRate (汇率)
-- 备注:批单不用计算,sta开头得字段是被转过汇率得
-- 条件: 车险 或 (非车险 并且 plcSolution[1].plcCoins.plcCoinsBasicInformation[1].coinsIdentity(共保我方) =1)
CREATE TEMPORARY VIEW VIEW_HIS_CBDATA AS
select
insert into ZB_ODS.ZB_ODS_KAFKA.CBDATA
select
s1.uwConclueDate as `uwConclueDate` -- 核保通过时间
,s1.startTime as `startTime` -- 起保时间
,s1.businessOffice as `COMCODE` --
,t1.COMNAME as `COMNAME` --
,t1.LEVEL1COMCODE as `LEVEL1COMCODE` --
,t1.LEVEL2COMCODE as `LEVEL2COMCODE` --
,t1.LEVEL3COMCODE as `LEVEL3COMCODE` --
,t1.LEVEL4COMCODE as `LEVEL4COMCODE` --
,t1.LEVEL5COMCODE as `LEVEL5COMCODE` --
,t1.LEVEL1COMDESC as `LEVEL1COMDESC` --
,t1.LEVEL2COMDESC as `LEVEL2COMDESC` --
,t1.LEVEL3COMDESC as `LEVEL3COMDESC` --
,t1.LEVEL4COMDESC as `LEVEL4COMDESC` --
,t1.LEVEL5COMDESC as `LEVEL5COMDESC` --
,s1.productCode as `risk` -- 险种代码
,t3.RISKNAME as `riskname` --
,t3.CLASSCODE as `classcode` -- 险类代码
,t3.CLASSNAME as `classname` --
,s1.businessChannelCode as `chnl` -- 业务渠道
,t2.NEWCHNLTYPEDESC as `chnlname` --
,s1.businessNatureCode as `businessNatureCode` -- 业务来源
,t4.CODEDESC as `businessNatureName` --
,cast(s1.netPremium as varchar) as `cost` -- 不含税保费
,s1.policyNo as `no` -- 保单号
,s1.xxzflag as xxzflag -- 新续转标记 1是0否
,s1.recordClerkCode as `id` -- 14 归属业务员ID
,s1.recordClerkName as `name` -- 15 归属业务员名称
from (
select
LongTimeToStringUDF(uwConclueDate,'yyyyMMdd') as uwConclueDate -- 核保通过时间
,LongTimeToStringUDF(startTime,'yyyyMMdd') as startTime -- 起保时间
,businessOffice as businessOffice -- 保单归属机构代码
......@@ -28,7 +59,7 @@ CREATE TEMPORARY VIEW VIEW_HIS_CBDATA AS
,recordClerkCode as recordClerkCode -- 14 归属业务员ID
,recordClerkName as recordClerkName -- 15 归属业务员名称
,'bd' as flag -- 保单或批单标记
,proctime as proctime-- ,ROW_NUMBER() OVER(PARTITION BY policyNo,businessOffice,netPremium ORDER BY uwConclueDate DESC) as rownum
,proctime as proctime
from ZB_ODS.ZB_SOURCE_RMQ_POLICY_SIT.POLICY -- 保单业务数据
where LongTimeToStringUDF(uwConclueDate,'yyyyMMdd') = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and (LEFT(productCode,2) = '05' or (LEFT(productCode,2) <> '05' and JsonValueUDF(plcSolution[1].plcCoins,'plcCoinsBasicInformation[1].coinsIdentity') = '1'))
......@@ -54,45 +85,15 @@ CREATE TEMPORARY VIEW VIEW_HIS_CBDATA AS
,recordClerkName as recordClerkName -- 15 归属业务员名称
,'pd' as flag -- 保单或批单标记
,proctime as proctime
-- ,ROW_NUMBER() OVER(PARTITION BY endorseNo,businessOffice,plpEndorse.staCurPremiumVariation ORDER BY uwConclueDate DESC) as rownum
from ZB_ODS.ZB_SOURCE_RMQ_ENDOR_SIT.ENDOR -- 批单业务数据
where LongTimeToStringUDF(uwConclueDate,'yyyyMMdd') = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and (LEFT(productCode,2) = '05' or (LEFT(productCode,2) <> '05' and JsonValueUDF(plcSolution[1].plcCoins,'plcCoinsBasicInformation[1].coinsIdentity') = '1'))
;
insert into ZB_ODS.ZB_ODS_KAFKA.CBDATA
select
s1.uwConclueDate as `uwConclueDate` -- 核保通过时间
,s1.startTime as `startTime` -- 起保时间
,s1.businessOffice as `COMCODE` --
,t1.COMNAME as `COMNAME` --
,t1.LEVEL1COMCODE as `LEVEL1COMCODE` --
,t1.LEVEL2COMCODE as `LEVEL2COMCODE` --
,t1.LEVEL3COMCODE as `LEVEL3COMCODE` --
,t1.LEVEL4COMCODE as `LEVEL4COMCODE` --
,t1.LEVEL5COMCODE as `LEVEL5COMCODE` --
,t1.LEVEL1COMDESC as `LEVEL1COMDESC` --
,t1.LEVEL2COMDESC as `LEVEL2COMDESC` --
,t1.LEVEL3COMDESC as `LEVEL3COMDESC` --
,t1.LEVEL4COMDESC as `LEVEL4COMDESC` --
,t1.LEVEL5COMDESC as `LEVEL5COMDESC` --
,s1.productCode as `risk` -- 险种代码
,t3.RISKNAME as `riskname` --
,s1.businessChannelCode as `chnl` -- 业务渠道
,t2.NEWCHNLTYPEDESC as `chnlname` --
,s1.businessNatureCode as `businessNatureCode` -- 业务来源
,t4.CODEDESC as `businessNatureName` --
,cast(s1.netPremium as varchar) as `cost` -- 不含税保费
,s1.policyNo as `no` -- 保单号
,s1.xxzflag as xxzflag -- 新续转标记 1是0否
,s1.recordClerkCode as `id` -- 14 归属业务员ID
,s1.recordClerkName as `name` -- 15 归属业务员名称
from VIEW_HIS_CBDATA s1
) s1
left join ZB_ODS.ZB_ODS_MYSQL.CD_COM_ALL for system_time as of s1.proctime as t1 on s1.businessOffice = t1.COMCODE
left join ZB_ODS.ZB_ODS_MYSQL.CD_NEWCHNLTYPE for system_time as of s1.proctime as t2 on s1.businessChannelCode = t2.NEWCHNLTYPE
left join ZB_ODS.ZB_ODS_MYSQL.CD_REALTIME_RISK for system_time as of s1.proctime as t3 on s1.productCode = t3.RISKCODE
left join ZB_ODS.ZB_ODS_MYSQL.CD_BUSINESSNATURE for system_time as of s1.proctime as t4 on s1.businessNatureCode = t4.CODE
-- where s1.rownum = 1
;
......
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