Commit 2ab22ee2 authored by 胡涛's avatar 胡涛

指标统计sql脚本

parent da67f973
...@@ -12,7 +12,7 @@ select ...@@ -12,7 +12,7 @@ select
,coinsCode as coinsCode ,coinsCode as coinsCode
,coinsLinkCode as coinsLinkCode ,coinsLinkCode as coinsLinkCode
,JsonGetCoinsRateUDF(plcSolution[1].plcCoins.plcLinkBasicInformat,'coinsLinkCode',coinsLinkCode) as LinkCoinsRate ,JsonGetCoinsRateUDF(plcSolution[1].plcCoins.plcLinkBasicInformat,'coinsLinkCode',coinsLinkCode) as LinkCoinsRate
,sonGetCoinsRateUDF(plcSolution[1].plcCoins.plcCoinsBasicInformation,'coinsCode',coinsCode) as CoinsCoinsRate ,JsonGetCoinsRateUDF(plcSolution[1].plcCoins.plcCoinsBasicInformation,'coinsCode',coinsCode) as CoinsCoinsRate
,endorseNo as endorseNo -- 批单号 ,endorseNo as endorseNo -- 批单号
,newPolicyFlag as newPolicyFlag ,newPolicyFlag as newPolicyFlag
,autoTransrenewFlag as autoTransrenewFlag ,autoTransrenewFlag as autoTransrenewFlag
...@@ -23,6 +23,9 @@ select ...@@ -23,6 +23,9 @@ select
,log_time as log_time ,log_time as log_time
,endorsePolicyTime as long_endorsePolicyTime ,endorsePolicyTime as long_endorsePolicyTime
,endorseTime as long_endorseTime ,endorseTime as long_endorseTime
,plcSolution[1].plcCoins as plcSolution_plcCoins ,ConcatObjUDF(
from ODS.ODS_KAFKA.ENDOR 'plcLinkBasicInformat:',plcSolution[1].plcCoins.plcLinkBasicInformat ,
',plcCoinsBasicInformation:',plcSolution[1].plcCoins.plcCoinsBasicInformation
) as plcSolution_plcCoins
from ZB_ODS.ZB_ODS_KAFKA.ENDOR
-- where LongTimeToStringUDF(uwConclueDate,'yyyyMMdd') between '20220831' and '20220902' -- where LongTimeToStringUDF(uwConclueDate,'yyyyMMdd') between '20220831' and '20220902'
\ No newline at end of file
...@@ -11,8 +11,8 @@ select ...@@ -11,8 +11,8 @@ select
,sigAndStaExchangeRate as sigAndStaExchangeRate ,sigAndStaExchangeRate as sigAndStaExchangeRate
,coinsCode as coinsCode ,coinsCode as coinsCode
,coinsLinkCode as coinsLinkCode ,coinsLinkCode as coinsLinkCode
,JsonGetCoinsRateUDF(plcSolution[1].plcCoins.plcLinkBasicInformat,'coinsLinkCode',coinsLinkCode) as LinkCoinsRate ,JsonGetCoinsRateUDF(plcSolution[1].plcCoins.plcLinkBasicInformat,'coinsLinkCode',coinsLinkCode) as LinkCoinsRate
,sonGetCoinsRateUDF(plcSolution[1].plcCoins.plcCoinsBasicInformation,'coinsCode',coinsCode) as CoinsCoinsRate ,JsonGetCoinsRateUDF(plcSolution[1].plcCoins.plcCoinsBasicInformation,'coinsCode',coinsCode) as CoinsCoinsRate
,policyNo as policyNo -- 保单号 ,policyNo as policyNo -- 保单号
,newPolicyFlag as newPolicyFlag ,newPolicyFlag as newPolicyFlag
,autoTransrenewFlag as autoTransrenewFlag ,autoTransrenewFlag as autoTransrenewFlag
...@@ -23,8 +23,10 @@ select ...@@ -23,8 +23,10 @@ select
,log_time as log_time ,log_time as log_time
,signDate as long_signDate ,signDate as long_signDate
,startTime as long_startTime ,startTime as long_startTime
,plcSolution[1].plcCoins as plcSolution_plcCoins ,ConcatObjUDF(
'plcLinkBasicInformat:',plcSolution[1].plcCoins.plcLinkBasicInformat ,
from ODS.ODS_KAFKA.POLICY -- 保单业务数据 ',plcCoinsBasicInformation:',plcSolution[1].plcCoins.plcCoinsBasicInformation
) as plcSolution_plcCoins
from ZB_ODS.ZB_ODS_KAFKA.POLICY -- 保单业务数据
; ;
...@@ -49,7 +49,7 @@ from ( ...@@ -49,7 +49,7 @@ from (
,productCode as productCode -- 险种代码 ,productCode as productCode -- 险种代码
,businessChannelCode as businessChannelCode -- 业务渠道 ,businessChannelCode as businessChannelCode -- 业务渠道
,businessNatureCode as businessNatureCode -- 业务来源 ,businessNatureCode as businessNatureCode -- 业务来源
,cast(netPremium as decimal(18,4)) ,cast(cast(netPremium as decimal(18,4))
* cast(sigAndStaExchangeRate as decimal(18,4)) * cast(sigAndStaExchangeRate as decimal(18,4))
*( *(
case case
...@@ -70,7 +70,7 @@ from ( ...@@ -70,7 +70,7 @@ from (
end end
) )
end end
) as `cost` -- 不含税保费 ) as decimal (18,4)) as `cost` -- 不含税保费
,policyNo as `no` -- 保单号 ,policyNo as `no` -- 保单号
,case ,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 = '1' or autoTransrenewFlag = '1' or autoTransrenewFlag = '4' or transferPolicyFlag = '1' or transrenewFlag = '1' or transrenewFlag ='4') then '1'
...@@ -80,7 +80,7 @@ from ( ...@@ -80,7 +80,7 @@ from (
,mainSalesmanName as `name` -- 15 归属业务员名称 ,mainSalesmanName as `name` -- 15 归属业务员名称
,'bd' as `flag` -- 保单或批单标记 ,'bd' as `flag` -- 保单或批单标记
,proctime as proctime ,proctime as proctime
from ODS.ODS_KAFKA.POLICY -- 保单业务数据 from ZB_ODS.ZB_ODS_KAFKA.POLICY -- 保单业务数据
where LongTimeToStringUDF(signDate,'yyyyMMdd') = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd') where LongTimeToStringUDF(signDate,'yyyyMMdd') = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and cast(netPremium as decimal(18,2)) <> 0 and cast(netPremium as decimal(18,2)) <> 0
...@@ -93,7 +93,7 @@ from ( ...@@ -93,7 +93,7 @@ from (
,productCode as productCode -- 险种代码 ,productCode as productCode -- 险种代码
,businessChannelCode as businessChannelCode -- 业务渠道 ,businessChannelCode as businessChannelCode -- 业务渠道
,businessNatureCode as businessNatureCode -- 业务来源 ,businessNatureCode as businessNatureCode -- 业务来源
,cast(plpEndorse.netPremiumVariation as decimal(18,4)) ,cast(cast(plpEndorse.netPremiumVariation as decimal(18,4))
* cast(sigAndStaExchangeRate as decimal(18,4)) * cast(sigAndStaExchangeRate as decimal(18,4))
*( *(
case case
...@@ -114,7 +114,7 @@ from ( ...@@ -114,7 +114,7 @@ from (
end end
) )
end end
) as `cost` -- 不含税保费 ) as decimal (18,4)) as `cost` -- 不含税保费
,endorseNo as `no` -- 批单号 ,endorseNo as `no` -- 批单号
,case ,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 = '1' or autoTransrenewFlag = '1' or autoTransrenewFlag = '4' or transferPolicyFlag = '1' or transrenewFlag = '1' or transrenewFlag ='4') then '1'
...@@ -125,7 +125,7 @@ from ( ...@@ -125,7 +125,7 @@ from (
,'pd' as `flag` -- 保单或批单标记 ,'pd' as `flag` -- 保单或批单标记
,proctime as proctime ,proctime as proctime
from ODS.ODS_KAFKA.ENDOR -- 批单业务数据 from ZB_ODS.ZB_ODS_KAFKA.ENDOR -- 批单业务数据
where LongTimeToStringUDF(endorsePolicyTime,'yyyyMMdd') = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd') where LongTimeToStringUDF(endorsePolicyTime,'yyyyMMdd') = DATE_FORMAT(LOCALTIMESTAMP,'yyyyMMdd')
and cast(plpEndorse.netPremiumVariation as decimal(18,4)) <> 0 and cast(plpEndorse.netPremiumVariation as decimal(18,4)) <> 0
......
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