Commit d6d5c7da authored by 王东's avatar 王东

指标计算承保字段调整

parent 029e1efd
...@@ -126,5 +126,5 @@ left join ( ...@@ -126,5 +126,5 @@ left join (
on s1.`no` = s2.BUSINESSNO on s1.`no` = s2.BUSINESSNO
and s1.COMCODE = s2.COMCODE and s1.COMCODE = s2.COMCODE
and cast(s1.cost as decimal(18,0)) = cast(s2.BAOFEI as decimal(18,0)) and cast(s1.cost as decimal(18,0)) = cast(s2.BAOFEI as decimal(18,0))
where s2.BUSINESSNO is null where s2.BUSINESSNO is null
; ;
\ No newline at end of file
...@@ -119,6 +119,7 @@ select ...@@ -119,6 +119,7 @@ select
from ( from (
select * from ZB_CK.ZB_CK_ORACLE_ANAQUERY.WEB_REALTIME_BUSINESS_INFO select * from ZB_CK.ZB_CK_ORACLE_ANAQUERY.WEB_REALTIME_BUSINESS_INFO
where UNDERWRITEENDDATE like concat(DATE_FORMAT(TIMESTAMPADD(DAY,-1,LOCALTIMESTAMP),'yyyy-MM-dd'),'%') where UNDERWRITEENDDATE like concat(DATE_FORMAT(TIMESTAMPADD(DAY,-1,LOCALTIMESTAMP),'yyyy-MM-dd'),'%')
and LOADDATE like concat(DATE_FORMAT(TIMESTAMPADD(DAY,-1,LOCALTIMESTAMP),'yyyy-MM-dd'),'%')
) s2 ) s2
left join ( left join (
select * from ZB_CK.ZB_CK_MYSQL.KAFKA_CBDATA select * from ZB_CK.ZB_CK_MYSQL.KAFKA_CBDATA
...@@ -126,6 +127,8 @@ left join ( ...@@ -126,6 +127,8 @@ left join (
) s1 ) s1
on s1.`no` = s2.BUSINESSNO on s1.`no` = s2.BUSINESSNO
and s1.COMCODE = s2.COMCODE and s1.COMCODE = s2.COMCODE
and cast(s1.cost as decimal(18,0)) = cast(s2.BAOFEI as decimal(18,0)) and cast(s1.cost as decimal(18,2)) - cast(s2.BAOFEI as decimal(18,2)) between -0.1 and 0.1
where s1.`no` is null where s1.`no` is null
and cast(s2.BAOFEI as decimal(18,2)) > 0
; ;
...@@ -28,5 +28,6 @@ create table LPDATA( ...@@ -28,5 +28,6 @@ create table LPDATA(
`flag` String ,-- 类型 `flag` String ,-- 类型
`claimno` String ,-- 赔案号 `claimno` String ,-- 赔案号
`no` String ,-- 保单号 `no` String ,-- 保单号
log_time String
) )
; ;
\ No newline at end of file
...@@ -71,7 +71,7 @@ from ( ...@@ -71,7 +71,7 @@ from (
) )
end end
) as decimal (30,4)) as `cost` -- 不含税保费 ) as decimal (30,4)) as `cost` -- 不含税保费
,case when policyNo is not null then policyNo else businessNo end as `no` -- 保单号 ,COALESCE(policyNo,businessNo) 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'
when LEFT(productCode,2) <> '05' and (newPolicyFlag = '0' or autoTransrenewFlag = '1' or autoTransrenewFlag = '4' or transferPolicyFlag = '2' or transrenewFlag = '1' ) then '1' when LEFT(productCode,2) <> '05' and (newPolicyFlag = '0' or autoTransrenewFlag = '1' or autoTransrenewFlag = '4' or transferPolicyFlag = '2' or transrenewFlag = '1' ) then '1'
...@@ -115,7 +115,7 @@ from ( ...@@ -115,7 +115,7 @@ from (
) )
end end
) as decimal (30,4)) as `cost` -- 不含税保费 ) as decimal (30,4)) as `cost` -- 不含税保费
,case when endorseNo is not null then endorseNo else businessNo end as `no` -- 批单号 ,COALESCE(endorseNo,businessNo) 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'
when LEFT(productCode,2) <> '05' and (newPolicyFlag = '0' or autoTransrenewFlag = '1' or autoTransrenewFlag = '4' or transferPolicyFlag = '2' or transrenewFlag = '1' ) then '1' when LEFT(productCode,2) <> '05' and (newPolicyFlag = '0' or autoTransrenewFlag = '1' or autoTransrenewFlag = '4' or transferPolicyFlag = '2' or transrenewFlag = '1' ) then '1'
...@@ -134,8 +134,6 @@ left join ZB_ODS.ZB_ODS_MYSQL.CD_COM_ALL for system_time as of s1.proctime as t1 ...@@ -134,8 +134,6 @@ left join ZB_ODS.ZB_ODS_MYSQL.CD_COM_ALL for system_time as of s1.proctime as t1
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_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_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 left join ZB_ODS.ZB_ODS_MYSQL.CD_BUSINESSNATURE for system_time as of s1.proctime as t4 on s1.businessNatureCode = t4.CODE
-- 数据查重 入参:md5 出参:boolean 如果存在 返回true
where DuplicateCheckingUDF(MD5(ConcatObjUDF(`no`,businessOffice,`cost`))) is not true
; ;
......
...@@ -29,6 +29,8 @@ select ...@@ -29,6 +29,8 @@ select
,s1.flag as `flag` -- 类型 ,s1.flag as `flag` -- 类型
,s1.claimno as `claimno` -- 赔案号 ,s1.claimno as `claimno` -- 赔案号
,s1.`no` as `no` -- 保单号 ,s1.`no` as `no` -- 保单号
,DATE_FORMAT(LOCALTIMESTAMP,'yyyy-MM-dd HH:mm:ss') as log_time
from ( from (
select select
businessOffice as businessOffice -- 机构 businessOffice as businessOffice -- 机构
...@@ -39,7 +41,7 @@ from ( ...@@ -39,7 +41,7 @@ from (
,replace(setdate,'-','') as setdate -- 结案日期 ,replace(setdate,'-','') as setdate -- 结案日期
,settledamount as settledamount -- 已决赔款金额 ,settledamount as settledamount -- 已决赔款金额
,lossamout as lossamout -- 估损金额 ,lossamout as lossamout -- 估损金额
,flag as flag -- 类型 ,'yj' as flag -- 类型
,claimno as claimno -- 赔案号 ,claimno as claimno -- 赔案号
,`no` as `no` -- 保单号 ,`no` as `no` -- 保单号
,proctime as proctime ,proctime as proctime
...@@ -56,7 +58,9 @@ from ( ...@@ -56,7 +58,9 @@ from (
,replace(setdate,'-','') as setdate -- 估损调整日期 ,replace(setdate,'-','') as setdate -- 估损调整日期
,settledamount as settledamount -- 估损提转差 ,settledamount as settledamount -- 估损提转差
,lossamout as lossamout -- 估损金额 ,lossamout as lossamout -- 估损金额
,flag as flag -- 类型 ,case when flag = 'wj' then 'wj'
when flag = 'yjwj' then 'yjwj'
else 'wj' end as flag -- 类型
,claimno as claimno -- 赔案号 ,claimno as claimno -- 赔案号
,`no` as `no` -- 保单号 ,`no` as `no` -- 保单号
,proctime as proctime ,proctime as proctime
......
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