Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dataquality_doc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
CI / CD Analytics
Repository Analytics
Value Stream Analytics
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
王东
dataquality_doc
Commits
1f72aecc
Commit
1f72aecc
authored
Aug 04, 2022
by
胡涛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
指标统计sql脚本
parent
3df96b96
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
44 deletions
+70
-44
ZB_ODS/DDL元数据/POLICY.sql
ZB_ODS/DDL元数据/POLICY.sql
+1
-0
ZB_ODS/ZB_ODS_CBDATA.sql
ZB_ODS/ZB_ODS_CBDATA.sql
+69
-44
No files found.
ZB_ODS/DDL元数据/POLICY.sql
View file @
1f72aecc
...
@@ -12,6 +12,7 @@ POLICY_PLCSOLUTION_PLCCOMMISSIONDETAIL
...
@@ -12,6 +12,7 @@ POLICY_PLCSOLUTION_PLCCOMMISSIONDETAIL
来源:
来源:
{
{
"sigAndStaExchangeRate"
:
1
,
"policyCreatDate"
:
1642142368422
,
"policyCreatDate"
:
1642142368422
,
"endorseNo"
:
null
,
-- 1 批单号
"endorseNo"
:
null
,
-- 1 批单号
"policyNo"
:
"6605212022411424000406"
,
-- 2 保单号
"policyNo"
:
"6605212022411424000406"
,
-- 2 保单号
...
...
ZB_ODS/ZB_ODS_CBDATA.sql
View file @
1f72aecc
...
@@ -8,6 +8,57 @@
...
@@ -8,6 +8,57 @@
-- 2、汇率换算 = 承保保费 * sigAndStaExchangeRate (汇率)
-- 2、汇率换算 = 承保保费 * sigAndStaExchangeRate (汇率)
-- 备注:批单不用计算,sta开头得字段是被转过汇率得
-- 备注:批单不用计算,sta开头得字段是被转过汇率得
-- 条件: 车险 或 (非车险 并且 plcSolution.plcCoins.plcCoinsBasicInformation.coinsIdentity(共保我方) =1)
-- 条件: 车险 或 (非车险 并且 plcSolution.plcCoins.plcCoinsBasicInformation.coinsIdentity(共保我方) =1)
CREATE
TEMPORARY
VIEW
VIEW_HIS_CBDATA
AS
select
LongTimeToStringUDF
(
uwConclueDate
,
'yyyyMMdd'
)
as
uwConclueDate
-- 核保通过时间
,
LongTimeToStringUDF
(
startTime
,
'yyyyMMdd'
)
as
startTime
-- 起保时间
,
businessOffice
as
businessOffice
-- 保单归属机构代码
,
productCode
as
productCode
-- 险种代码
,
businessChannelCode
as
businessChannelCode
-- 业务渠道
,
businessNatureCode
as
businessNatureCode
-- 业务来源
,
cast
(
netPremium
as
decimal
(
18
,
2
))
*
cast
(
sigAndStaExchangeRate
as
decimal
(
18
,
2
))
*
(
case
when
JsonValueUDF
(
plcSolution
[
1
].
plcCoins
,
'plcCoinsBasicInformation.coinsRate'
)
is
null
then
1
else
cast
(
JsonValueUDF
(
plcSolution
[
1
].
plcCoins
,
'plcCoinsBasicInformation.coinsRate'
)
AS
decimal
(
18
,
2
)
)
end
)
as
netPremium
-- 不含税保费
,
policyNo
as
policyNo
-- 保单号
,
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'
)
and
(
LEFT
(
productCode
,
2
)
=
'05'
or
(
LEFT
(
productCode
,
2
)
<>
'05'
and
JsonValueUDF
(
plcSolution
[
1
].
plcCoins
,
'plcCoinsBasicInformation.coinsIdentity'
)
=
'1'
))
union
all
select
LongTimeToStringUDF
(
uwConclueDate
,
'yyyyMMdd'
)
as
uwConclueDate
-- 核保通过时间 ??
,
LongTimeToStringUDF
(
endorseEffectiveTime
,
'yyyyMMdd'
)
as
startTime
-- 起保时间
,
businessOffice
as
businessOffice
-- 保单归属机构代码
,
productCode
as
productCode
-- 险种代码
,
businessChannelCode
as
businessChannelCode
-- 业务渠道
,
businessNatureCode
as
businessNatureCode
-- 业务来源
,
cast
(
plpEndorse
.
staCurPremiumVariation
as
decimal
(
18
,
2
))
*
(
case
when
JsonValueUDF
(
plcSolution
[
1
].
plcCoins
,
'plcCoinsBasicInformation.coinsRate'
)
is
null
then
1
else
cast
(
JsonValueUDF
(
plcSolution
[
1
].
plcCoins
,
'plcCoinsBasicInformation.coinsRate'
)
AS
decimal
(
18
,
2
)
)
end
)
as
netPremium
-- 不含税保费 ??
,
endorseNo
as
policyNo
-- 批单号
,
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'
)
and
(
LEFT
(
productCode
,
2
)
=
'05'
or
(
LEFT
(
productCode
,
2
)
<>
'05'
and
JsonValueUDF
(
plcSolution
[
1
].
plcCoins
,
'plcCoinsBasicInformation.coinsIdentity'
)
=
'1'
))
;
insert
into
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
insert
into
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
select
select
...
@@ -31,55 +82,14 @@ select
...
@@ -31,55 +82,14 @@ select
,
t2
.
NEWCHNLTYPEDESC
as
`chnlname`
--
,
t2
.
NEWCHNLTYPEDESC
as
`chnlname`
--
,
s1
.
businessNatureCode
as
`businessNatureCode`
-- 业务来源
,
s1
.
businessNatureCode
as
`businessNatureCode`
-- 业务来源
,
t4
.
CODEDESC
as
`businessNatureName`
--
,
t4
.
CODEDESC
as
`businessNatureName`
--
,
s1
.
netPremium
as
`cost`
-- 不含税保费
,
cast
(
s1
.
netPremium
as
varchar
)
as
`cost`
-- 不含税保费
,
s1
.
policyNo
as
`no`
-- 保单号
,
s1
.
policyNo
as
`no`
-- 保单号
,
s1
.
xxzflag
as
xxzflag
-- 新续转标记 1是0否
,
s1
.
xxzflag
as
xxzflag
-- 新续转标记 1是0否
,
s1
.
recordClerkCode
as
`id`
-- 14 归属业务员ID
,
s1
.
recordClerkCode
as
`id`
-- 14 归属业务员ID
,
s1
.
recordClerkName
as
`name`
-- 15 归属业务员名称
,
s1
.
recordClerkName
as
`name`
-- 15 归属业务员名称
,
cast
(
s1
.
fcxgbwfbfxs
as
varchar
)
as
fcxgbwfbfxs
-- 非车险共保我方保费系数
from
(
from
(
select
select
*
from
VIEW_HIS_CBDATA
LongTimeToStringUDF
(
policyCreatDate
,
'yyyyMMdd'
)
as
uwConclueDate
-- 核保通过时间
,
LongTimeToStringUDF
(
startTime
,
'yyyyMMdd'
)
as
startTime
-- 起保时间
,
businessOffice
as
businessOffice
-- 保单归属机构代码
,
productCode
as
productCode
-- 险种代码
,
businessChannelCode
as
businessChannelCode
-- 业务渠道
,
businessNatureCode
as
businessNatureCode
-- 业务来源
,
netPremium
as
netPremium
-- 不含税保费
,
policyNo
as
policyNo
-- 保单号
,
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_UAT
.
POLICY
-- 保单业务数据
where
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
union
all
select
LongTimeToStringUDF
(
policyCreatDate
,
'yyyyMMdd'
)
as
uwConclueDate
-- 核保通过时间 ??
,
LongTimeToStringUDF
(
endorseEffectiveTime
,
'yyyyMMdd'
)
as
startTime
-- 起保时间
,
businessOffice
as
businessOffice
-- 保单归属机构代码
,
productCode
as
productCode
-- 险种代码
,
businessChannelCode
as
businessChannelCode
-- 业务渠道
,
businessNatureCode
as
businessNatureCode
-- 业务来源
,
plpEndorse
.
staCurPremiumVariation
as
netPremium
-- 不含税保费 ??
,
endorseNo
as
policyNo
-- 批单号
,
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_UAT
.
ENDOR
-- 批单业务数据
where
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
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
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
...
@@ -90,3 +100,18 @@ left join ZB_ODS.ZB_ODS_MYSQL.CD_BUSINESSNATURE for system_time as of s1.proctim
...
@@ -90,3 +100,18 @@ left join ZB_ODS.ZB_ODS_MYSQL.CD_BUSINESSNATURE for system_time as of s1.proctim
uwConclueDate
startTime
businessOffice
productCode
businessChannelCode
businessNatureCode
netPremium
policyNo
xxzflag
recordClerkCode
recordClerkName
flag
proctime
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment