Commit efe96155 authored by 王东's avatar 王东

指标计算承保字段调整

parent 6e5689cc
...@@ -4,6 +4,8 @@ ENDOR ...@@ -4,6 +4,8 @@ ENDOR
ENDOR_PLPENDORSE ENDOR_PLPENDORSE
ENDOR_PLPENDORSE_PLPCOMMISSIONDETAIL ENDOR_PLPENDORSE_PLPCOMMISSIONDETAIL
ENDOR_PLCSOLUTION ENDOR_PLCSOLUTION
ENDOR_PLCSOLUTION_PLCCOINS
ENDOR_PLCSOLUTION_PLCCOINS_PLCCOINSBASICINFORMATION
来源: 来源:
{ {
...@@ -26,13 +28,12 @@ ENDOR_PLCSOLUTION ...@@ -26,13 +28,12 @@ ENDOR_PLCSOLUTION
}> }>
}, },
plcSolution array<row{ plcSolution array<row{
plcCoins String --String类型 该对象部分参数在某些数据中可能不存在 自定义函数 JsonValuUDF读取 plcCoins row( --String类型 该对象部分参数在某些数据中可能不存在 自定义函数 JsonValuUDF读取
-- plcCoins{ plcCoinsBasicInformation array<row(
-- plcCoinsBasicInformation { coinsRate -- 非车险共保比例
-- coinsRate -- 非车险共保比例 coinsIdentity -- 共保我方标记 = 1 时共保我方
-- coinsIdentity -- 共保我方标记 = 1 时共保我方 )>
-- } )
-- }
}>, }>,
recordClerkCode String , -- 14 归属业务员ID recordClerkCode String , -- 14 归属业务员ID
recordClerkName String , -- 15 归属业务员名称 recordClerkName String , -- 15 归属业务员名称
......
...@@ -7,11 +7,12 @@ POLICY_PLCPUBLICINSURANT ...@@ -7,11 +7,12 @@ POLICY_PLCPUBLICINSURANT
POLICY_PLCSOLUTION POLICY_PLCSOLUTION
POLICY_PLCSOLUTION_PLCRATION POLICY_PLCSOLUTION_PLCRATION
POLICY_PLCSOLUTION_PLCCOINS POLICY_PLCSOLUTION_PLCCOINS
POLICY_PLCSOLUTION_PLCCOINS_PLCCOINSBASICINFORMATION
POLICY_PLCSOLUTION_PLCCOMMISSIONDETAIL POLICY_PLCSOLUTION_PLCCOMMISSIONDETAIL
-- 来源: -- 来源:
{ (
sigAndStaExchangeRate String , -- 费率 sigAndStaExchangeRate String , -- 费率
policyCreatDate String , policyCreatDate String ,
endorseNo String , -- 1 批单号 endorseNo String , -- 1 批单号
...@@ -26,7 +27,7 @@ POLICY_PLCSOLUTION_PLCCOMMISSIONDETAIL ...@@ -26,7 +27,7 @@ POLICY_PLCSOLUTION_PLCCOMMISSIONDETAIL
endTime String , -- 10 终保时间 endTime String , -- 10 终保时间
netPremium String , -- 11 不含税保费 netPremium String , -- 11 不含税保费
premium String , -- 12 含税保费 premium String , -- 12 含税保费
plcCar05 row{ plcCar05 row(
licensePlateNo String , -- 13 车牌号 licensePlateNo String , -- 13 车牌号
frameNo String , -- 14 车架号 frameNo String , -- 14 车架号
vehiclecode String , -- 15 行业车型代码 vehiclecode String , -- 15 行业车型代码
...@@ -36,33 +37,33 @@ POLICY_PLCSOLUTION_PLCCOMMISSIONDETAIL ...@@ -36,33 +37,33 @@ POLICY_PLCSOLUTION_PLCCOMMISSIONDETAIL
carKindName String , -- 30 车辆种类名称 carKindName String , -- 30 车辆种类名称
carUserNatureCode String , -- 31 车辆使用性质代码 carUserNatureCode String , -- 31 车辆使用性质代码
carUserNature String -- 32 车辆使用性质名称 carUserNature String -- 32 车辆使用性质名称
}, ),
plcApplicant array<row{ plcApplicant array<row(
customerName String -- 18 投保人名称 customerName String -- 18 投保人名称
}>, )>,
plcPublicInsurant array<row{ plcPublicInsurant array<row(
customerName String -- 19 被保人名称 customerName String -- 19 被保人名称
}>, )>,
newPolicyFlag String , -- 20 新保标识 1:是,0:否 newPolicyFlag String , -- 20 新保标识 1:是,0:否
autoTransrenewFlag String , -- 21 自动续保标识 1:是,4:跨险种自动续保,0:否 autoTransrenewFlag String , -- 21 自动续保标识 1:是,4:跨险种自动续保,0:否
transferPolicyFlag String , -- 22 转保标识1:是,0:否 transferPolicyFlag String , -- 22 转保标识1:是,0:否
transrenewFlag String , -- 23 续保标识 1:是,4:跨险种续保,0:否 transrenewFlag String , -- 23 续保标识 1:是,4:跨险种续保,0:否
plcSolution array<row{ plcSolution array<row(
PlcRation row{ PlcRation row(
artifSelfPricesRat String -- 24 自主定价系数 artifSelfPricesRat String -- 24 自主定价系数
}, ),
plcCoins String --String类型 该对象部分参数在某些数据中可能不存在 自定义函数 JsonValuUDF读取 plcCoins row( --String类型 该对象部分参数在某些数据中可能不存在 自定义函数 JsonValuUDF读取
-- plcCoinsBasicInformation { plcCoinsBasicInformation array<row(
-- coinsRate -- 非车险共保比例 coinsRate -- 非车险共保比例
-- coinsIdentity -- 共保我方标记 = 1 时共保我方 coinsIdentity -- 共保我方标记 = 1 时共保我方
-- } )>
}, ),
plcCommissionDetail array<row{ plcCommissionDetail array<row(
agentFee String , -- 36 份额含税手续费 agentFee String , -- 36 份额含税手续费
agentNetFee String -- 37 份额不含税手续费 agentNetFee String -- 37 份额不含税手续费
}> )>
}>, )>,
saleaman String , -- 25 代理机构代码 saleaman String , -- 25 代理机构代码
saleamanName String , -- 26 代理机构名称 saleamanName String , -- 26 代理机构名称
businessChannelCode String , -- 27 业务渠道 businessChannelCode String , -- 27 业务渠道
...@@ -72,4 +73,4 @@ POLICY_PLCSOLUTION_PLCCOMMISSIONDETAIL ...@@ -72,4 +73,4 @@ POLICY_PLCSOLUTION_PLCCOMMISSIONDETAIL
staCurAmount String , -- 38 保险金额 staCurAmount String , -- 38 保险金额
staCurTaxFee String -- 39 税 staCurTaxFee String -- 39 税
} )
\ No newline at end of file \ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
-- 备注:只有在非车险共保我方保费时存在系数得字段 -- 备注:只有在非车险共保我方保费时存在系数得字段
-- 2、汇率换算 = 承保保费 * sigAndStaExchangeRate (汇率) -- 2、汇率换算 = 承保保费 * sigAndStaExchangeRate (汇率)
-- 备注:批单不用计算,sta开头得字段是被转过汇率得 -- 备注:批单不用计算,sta开头得字段是被转过汇率得
-- 条件: 车险 或 (非车险 并且 plcSolution[1].plcCoins.plcCoinsBasicInformation[1].coinsIdentity(共保我方) =1) -- 3、条件: 车险 或 (非车险 并且 plcSolution[1].plcCoins.plcCoinsBasicInformation[1].coinsIdentity(共保我方) =1)
insert into ZB_ODS.ZB_ODS_KAFKA.CBDATA insert into ZB_ODS.ZB_ODS_KAFKA.CBDATA
...@@ -40,16 +40,19 @@ select ...@@ -40,16 +40,19 @@ select
,s1.recordClerkCode as `id` -- 14 归属业务员ID ,s1.recordClerkCode as `id` -- 14 归属业务员ID
,s1.recordClerkName as `name` -- 15 归属业务员名称 ,s1.recordClerkName as `name` -- 15 归属业务员名称
from ( from (
select select
LongTimeToStringUDF(uwConclueDate,'yyyyMMdd') as uwConclueDate -- 核保通过时间 LongTimeToStringUDF(uwConclueDate,'yyyyMMdd') as uwConclueDate -- 核保通过时间
,LongTimeToStringUDF(startTime,'yyyyMMdd') as startTime -- 起保时间 ,LongTimeToStringUDF(startTime,'yyyyMMdd') as startTime -- 起保时间
,businessOffice as businessOffice -- 保单归属机构代码 ,businessOffice as businessOffice -- 保单归属机构代码
,productCode as productCode -- 险种代码 ,productCode as productCode -- 险种代码
,businessChannelCode as businessChannelCode -- 业务渠道 ,businessChannelCode as businessChannelCode -- 业务渠道
,businessNatureCode as businessNatureCode -- 业务来源 ,businessNatureCode as businessNatureCode -- 业务来源
,cast(netPremium as decimal(18,2)) * cast(sigAndStaExchangeRate as decimal(18,2))*(case when JsonValueUDF(plcSolution[1].plcCoins,'plcCoinsBasicInformation[1].coinsRate') is null then 1 ,cast(netPremium as decimal(18,2)) * cast(sigAndStaExchangeRate as decimal(18,2))*(
else cast(JsonValueUDF(plcSolution[1].plcCoins,'plcCoinsBasicInformation[1].coinsRate') AS decimal(18,2) ) case
end ) when plcSolution[1].plcCoins.plcCoinsBasicInformation is null then 1
else cast(plcSolution[1].plcCoins.plcCoinsBasicInformation[1].coinsRate AS decimal(18,2) )
end
)
as netPremium -- 不含税保费 as netPremium -- 不含税保费
,policyNo as policyNo -- 保单号 ,policyNo as policyNo -- 保单号
,case ,case
...@@ -62,19 +65,28 @@ select ...@@ -62,19 +65,28 @@ select
,proctime as proctime ,proctime as proctime
from ODS.ODS_KAFKA.POLICY -- 保单业务数据 from ODS.ODS_KAFKA.POLICY -- 保单业务数据
where LongTimeToStringUDF(uwConclueDate,'yyyyMMdd') = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd') 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')) and (
LEFT(productCode,2) = '05'
or (
LEFT(productCode,2) <> '05'
and plcSolution[1].plcCoins.plcCoinsBasicInformation is not null
and plcSolution[1].plcCoins.plcCoinsBasicInformation[1].coinsIdentity = '1'
)
)
union all union all
select select
LongTimeToStringUDF(uwConclueDate,'yyyyMMdd') as uwConclueDate -- 核保通过时间 ?? LongTimeToStringUDF(uwConclueDate,'yyyyMMdd') as uwConclueDate -- 核保通过时间 ??
,LongTimeToStringUDF(endorseEffectiveTime,'yyyyMMdd') as startTime -- 起保时间 ,LongTimeToStringUDF(plpEndorse.endorseEffectiveTime,'yyyyMMdd') as startTime -- 起保时间
,businessOffice as businessOffice -- 保单归属机构代码 ,businessOffice as businessOffice -- 保单归属机构代码
,productCode as productCode -- 险种代码 ,productCode as productCode -- 险种代码
,businessChannelCode as businessChannelCode -- 业务渠道 ,businessChannelCode as businessChannelCode -- 业务渠道
,businessNatureCode as businessNatureCode -- 业务来源 ,businessNatureCode as businessNatureCode -- 业务来源
,cast(plpEndorse.staCurPremiumVariation as decimal(18,2)) *(case when JsonValueUDF(plcSolution[1].plcCoins,'plcCoinsBasicInformation[1].coinsRate') is null then 1 ,cast(plpEndorse.staCurPremiumVariation as decimal(18,2)) *(
else cast(JsonValueUDF(plcSolution[1].plcCoins,'plcCoinsBasicInformation[1].coinsRate') AS decimal(18,2) ) case
end ) when plcSolution[1].plcCoins.plcCoinsBasicInformation is null then 1
else cast(plcSolution[1].plcCoins.plcCoinsBasicInformation[1].coinsRate AS decimal(18,2) )
end
)
as netPremium -- 不含税保费 ?? as netPremium -- 不含税保费 ??
,endorseNo as policyNo -- 批单号 ,endorseNo as policyNo -- 批单号
,case ,case
...@@ -85,9 +97,16 @@ select ...@@ -85,9 +97,16 @@ select
,recordClerkName as recordClerkName -- 15 归属业务员名称 ,recordClerkName as recordClerkName -- 15 归属业务员名称
,'pd' as flag -- 保单或批单标记 ,'pd' as flag -- 保单或批单标记
,proctime as proctime ,proctime as proctime
from ODS.ODS_KAKFA.ENDOR -- 批单业务数据 from ODS.ODS_KAFKA.ENDOR -- 批单业务数据
where LongTimeToStringUDF(uwConclueDate,'yyyyMMdd') = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd') 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')) and (
LEFT(productCode,2) = '05'
or (
LEFT(productCode,2) <> '05'
and plcSolution[1].plcCoins.plcCoinsBasicInformation is not null
and plcSolution[1].plcCoins.plcCoinsBasicInformation[1].coinsIdentity = '1'
)
)
) 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_COM_ALL for system_time as of s1.proctime as t1 on s1.businessOffice = t1.COMCODE
......
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