Commit d3724e4a authored by 王东's avatar 王东

调整指标计算目标表

parent 27f0539e
......@@ -37,14 +37,14 @@ from (
,businessNatureCode as businessNatureCode -- 业务来源
,netPremium as netPremium -- 不含税保费
,policyNo as policyNo -- 保单号
,'bd' as flag -- 保单或批单标记
,proctime as proctime
,case
when LEFT(productCode,2) = '05' and (newPolicyFlag = '1' or autoTransrenewFlag = '1' or autoTransrenewFlag = '4' or transferPolicyFlag = '1' or transrenewFlag = '1' or transrenewFlag ='4') then '1'
when LEFT(productCode,2) <> '05' and (newPolicyFlag = '0' or autoTransrenewFlag = '1' or autoTransrenewFlag = '4' or transferPolicyFlag = '2' or transrenewFlag = '1' ) then '1'
else '0' end as xxzflag -- 新续转标记 1是0否
,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
from ZB_ODS.ZB_SOURCE_RMQ_POLICY_SIT.POLICY -- 保单业务数据
where `uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
......@@ -59,14 +59,14 @@ from (
,businessNatureCode as businessNatureCode -- 业务来源
,plpEndorse.staCurPremiumVariation as netPremium -- 不含税保费 ??
,endorseNo as policyNo -- 批单号
,'pd' as flag -- 保单或批单标记
,proctime as proctime
,case
when LEFT(productCode,2) = '05' and (newPolicyFlag = '1' or autoTransrenewFlag = '1' or autoTransrenewFlag = '4' or transferPolicyFlag = '1' or transrenewFlag = '1' or transrenewFlag ='4') then '1'
when LEFT(productCode,2) <> '05' and (newPolicyFlag = '0' or autoTransrenewFlag = '1' or autoTransrenewFlag = '4' or transferPolicyFlag = '2' or transrenewFlag = '1' ) then '1'
else '0' end as xxzflag -- 新续转标记 1是0否
,recordClerkCode as recordClerkCode -- 14 归属业务员ID
,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 `uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
......
......@@ -2,8 +2,6 @@
insert into ZB_ODS.ZB_ODS_KAFKA.LPDATA
select
,s1.businessOffice as `COMCODE` --
,t1.COMNAME as `COMNAME` --
,t1.LEVEL1COMCODE as `LEVEL1COMCODE` --
......@@ -22,73 +20,51 @@ select
,t4.CODEDESC as `businessNatureName` --
,s1.businessChannelCode as `chnl` -- 业务渠道
,t2.NEWCHNLTYPEDESC as `chnlname` --
,s1.netPremium as `cost` -- 不含税保费
,s1.policyNo as `no` -- 保单号
,s1.xxzflag as xxzflag -- 新续转标记 1是0否
,s1.recordClerkCode as `id` -- 14 归属业务员ID
,s1.recordClerkName as `name` -- 15 归属业务员名称
,s1.cladate as `cladate` -- 立案日期
,s1.setdate as `setdate` -- 结案日期/估损调整日期
,s1.cost as `cost` -- 已决赔款金额/估损提转差
,s1.lossamout as `lossamout` -- 估损金额
,s1.flag as `flag` -- 类型
,s1.claimno as `claimno` -- 赔案号
,s1.no as `no` -- 保单号
from (
select
机构
险种
业务来源
渠道
立案日期
估损调整日期
估损提转差
估损金额
类型
赔案号
保单号
,businessOffice as businessOffice -- 保单归属机构代码
,productCode as productCode -- 险种代码
,businessChannelCode as businessChannelCode -- 业务渠道
,businessOffice as businessOffice -- 机构
,productCode as productCode -- 险种
,businessNatureCode as businessNatureCode -- 业务来源
,netPremium as netPremium -- 不含税保费
,policyNo as policyNo -- 保单号
,'bd' as flag -- 保单或批单标记
,businessChannelCode as businessChannelCode -- 渠道
,cladate as cladate -- 立案日期
,setdate as setdate -- 结案日期
,cost as cost -- 已决赔款金额
,lossamout as lossamout -- 估损金额
,flag as flag -- 类型
,claimno as claimno -- 赔案号
,no as no -- 保单号
,proctime as proctime
,case
when LEFT(productCode,2) = '05' and (newPolicyFlag = '1' or autoTransrenewFlag = '1' or autoTransrenewFlag = '4' or transferPolicyFlag = '1' or transrenewFlag = '1' or transrenewFlag ='4') then '1'
when LEFT(productCode,2) <> '05' and (newPolicyFlag = '0' or autoTransrenewFlag = '1' or autoTransrenewFlag = '4' or transferPolicyFlag = '2' or transrenewFlag = '1' ) then '1'
else '0' end as xxzflag -- 新续转标记 1是0否
,recordClerkCode as recordClerkCode -- 14 归属业务员ID
,recordClerkName as recordClerkName -- 15 归属业务员名称
,ROW_NUMBER() OVER(PARTITION BY policyNo,businessOffice,netPremium ORDER BY uwConclueDate DESC) as rownum
from ZB_ODS.ZB_SOURCE_RMQ_POLICY_SIT.POLICY -- 保单业务数据
where `uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
from ZB_ODS.ZB_SOURCE_KAFKA_YJPK.YJPK -- 保单业务数据
union all
select
LongTimeToStringUDF(policyCreatDate,'yyyyMMdd') as uwConclueDate -- 核保通过时间 ??
,LongTimeToStringUDF(endorseEffectiveTime,'yyyyMMdd') as startTime -- 起保时间
,businessOffice as businessOffice -- 保单归属机构代码
,productCode as productCode -- 险种代码
,businessChannelCode as businessChannelCode -- 业务渠道
,businessOffice as businessOffice -- 机构
,productCode as productCode -- 险种
,businessNatureCode as businessNatureCode -- 业务来源
,plpEndorse.staCurPremiumVariation as netPremium -- 不含税保费 ??
,endorseNo as policyNo -- 批单号
,'pd' as flag -- 保单或批单标记
,businessChannelCode as businessChannelCode -- 渠道
,cladate as cladate -- 立案日期
,setdate as setdate -- 估损调整日期
,cost as cost -- 估损提转差
,lossamout as lossamout -- 估损金额
,flag as flag -- 类型
,claimno as claimno -- 赔案号
,no as no -- 保单号
,proctime as proctime
,case
when LEFT(productCode,2) = '05' and (newPolicyFlag = '1' or autoTransrenewFlag = '1' or autoTransrenewFlag = '4' or transferPolicyFlag = '1' or transrenewFlag = '1' or transrenewFlag ='4') then '1'
when LEFT(productCode,2) <> '05' and (newPolicyFlag = '0' or autoTransrenewFlag = '1' or autoTransrenewFlag = '4' or transferPolicyFlag = '2' or transrenewFlag = '1' ) then '1'
else '0' end as xxzflag -- 新续转标记 1是0否
,recordClerkCode as recordClerkCode -- 14 归属业务员ID
,recordClerkName as recordClerkName -- 15 归属业务员名称
,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 `uwConclueDate` = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
from ZB_ODS.ZB_SOURCE_KAFKA_WJPK.WJPK -- 批单业务数据
) 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