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
245b7344
Commit
245b7344
authored
Aug 11, 2022
by
王东
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
指标计算承保字段调整
parent
89b8b438
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
48 deletions
+51
-48
RZ_DM/RZ_DM_QUANTILE.sql
RZ_DM/RZ_DM_QUANTILE.sql
+8
-8
ZB_ODS/DDL元数据/CBDATA.sql
ZB_ODS/DDL元数据/CBDATA.sql
+3
-1
ZB_ODS/ZB_ODS_CBDATA.sql
ZB_ODS/ZB_ODS_CBDATA.sql
+40
-39
No files found.
RZ_DM/RZ_DM_QUANTILE.sql
View file @
245b7344
...
@@ -28,10 +28,10 @@ from(
...
@@ -28,10 +28,10 @@ from(
LongTimeToStringUDF
(
d1
.
endTime
,
'yyyy-MM-dd HH:mm'
)
>=
DATE_FORMAT
(
TIMESTAMPADD
(
MINUTE
,
-
1
,
LOCALTIMESTAMP
),
'yyyy-MM-dd HH:mm'
)
LongTimeToStringUDF
(
d1
.
endTime
,
'yyyy-MM-dd HH:mm'
)
>=
DATE_FORMAT
(
TIMESTAMPADD
(
MINUTE
,
-
1
,
LOCALTIMESTAMP
),
'yyyy-MM-dd HH:mm'
)
and
LongTimeToStringUDF
(
d1
.
endTime
,
'yyyy-MM-dd HH:mm'
)
<
DATE_FORMAT
(
TIMESTAMPADD
(
MINUTE
,
+
1
,
LOCALTIMESTAMP
),
'yyyy-MM-dd HH:mm'
)
and
LongTimeToStringUDF
(
d1
.
endTime
,
'yyyy-MM-dd HH:mm'
)
<
DATE_FORMAT
(
TIMESTAMPADD
(
MINUTE
,
+
1
,
LOCALTIMESTAMP
),
'yyyy-MM-dd HH:mm'
)
and
d1
.
status
=
'200'
and
d1
.
status
=
'200'
and
LEF
T
(
d1
.
`rpc`
,
3
)
not
in
(
'.js'
)
and
RIGH
T
(
d1
.
`rpc`
,
3
)
not
in
(
'.js'
)
and
LEF
T
(
d1
.
`rpc`
,
4
)
not
in
(
'.jpg'
,
'.ico'
,
'.css'
,
'.ttf'
,
'.png'
,
'.PNG'
,
'.JPG'
,
'.txt'
,
'.mp4'
,
'.mp3'
,
'.pdf'
,
'.dwr'
)
and
RIGH
T
(
d1
.
`rpc`
,
4
)
not
in
(
'.jpg'
,
'.ico'
,
'.css'
,
'.ttf'
,
'.png'
,
'.PNG'
,
'.JPG'
,
'.txt'
,
'.mp4'
,
'.mp3'
,
'.pdf'
,
'.dwr'
)
and
LEF
T
(
d1
.
`rpc`
,
5
)
not
in
(
'.json'
,
'.html'
,
'.less'
,
'.jpeg'
)
and
RIGH
T
(
d1
.
`rpc`
,
5
)
not
in
(
'.json'
,
'.html'
,
'.less'
,
'.jpeg'
)
and
LEF
T
(
d1
.
`rpc`
,
6
)
not
in
(
'.woff2'
)
and
RIGH
T
(
d1
.
`rpc`
,
6
)
not
in
(
'.woff2'
)
group
by
group
by
d1
.
`applicationName`
d1
.
`applicationName`
,
d1
.
`agentId`
,
d1
.
`agentId`
...
@@ -66,10 +66,10 @@ from(
...
@@ -66,10 +66,10 @@ from(
LongTimeToStringUDF
(
d1
.
endTime
,
'yyyy-MM-dd HH:mm'
)
>=
DATE_FORMAT
(
TIMESTAMPADD
(
MINUTE
,
-
1
,
LOCALTIMESTAMP
),
'yyyy-MM-dd HH:mm'
)
LongTimeToStringUDF
(
d1
.
endTime
,
'yyyy-MM-dd HH:mm'
)
>=
DATE_FORMAT
(
TIMESTAMPADD
(
MINUTE
,
-
1
,
LOCALTIMESTAMP
),
'yyyy-MM-dd HH:mm'
)
and
LongTimeToStringUDF
(
d1
.
endTime
,
'yyyy-MM-dd HH:mm'
)
<
DATE_FORMAT
(
TIMESTAMPADD
(
MINUTE
,
+
1
,
LOCALTIMESTAMP
),
'yyyy-MM-dd HH:mm'
)
and
LongTimeToStringUDF
(
d1
.
endTime
,
'yyyy-MM-dd HH:mm'
)
<
DATE_FORMAT
(
TIMESTAMPADD
(
MINUTE
,
+
1
,
LOCALTIMESTAMP
),
'yyyy-MM-dd HH:mm'
)
and
d1
.
status
=
'200'
and
d1
.
status
=
'200'
and
LEF
T
(
d1
.
`rpc`
,
3
)
not
in
(
'.js'
)
and
RIGH
T
(
d1
.
`rpc`
,
3
)
not
in
(
'.js'
)
and
LEF
T
(
d1
.
`rpc`
,
4
)
not
in
(
'.jpg'
,
'.ico'
,
'.css'
,
'.ttf'
,
'.png'
,
'.PNG'
,
'.JPG'
,
'.txt'
,
'.mp4'
,
'.mp3'
,
'.pdf'
,
'.dwr'
)
and
RIGH
T
(
d1
.
`rpc`
,
4
)
not
in
(
'.jpg'
,
'.ico'
,
'.css'
,
'.ttf'
,
'.png'
,
'.PNG'
,
'.JPG'
,
'.txt'
,
'.mp4'
,
'.mp3'
,
'.pdf'
,
'.dwr'
)
and
LEF
T
(
d1
.
`rpc`
,
5
)
not
in
(
'.json'
,
'.html'
,
'.less'
,
'.jpeg'
)
and
RIGH
T
(
d1
.
`rpc`
,
5
)
not
in
(
'.json'
,
'.html'
,
'.less'
,
'.jpeg'
)
and
LEF
T
(
d1
.
`rpc`
,
6
)
not
in
(
'.woff2'
)
and
RIGH
T
(
d1
.
`rpc`
,
6
)
not
in
(
'.woff2'
)
group
by
group
by
d1
.
`applicationName`
d1
.
`applicationName`
,
CONCAT
(
LongTimeToStringUDF
(
cast
(
d1
.
endTime
as
bigint
)
+
60000
,
'yyyy-MM-dd HH:mm'
),
':00'
)
,
CONCAT
(
LongTimeToStringUDF
(
cast
(
d1
.
endTime
as
bigint
)
+
60000
,
'yyyy-MM-dd HH:mm'
),
':00'
)
...
...
ZB_ODS/DDL元数据/CBDATA.sql
View file @
245b7344
...
@@ -17,11 +17,13 @@ create table CBDATA(
...
@@ -17,11 +17,13 @@ create table CBDATA(
`LEVEL5COMDESC`
String
,
-- 五级名称
`LEVEL5COMDESC`
String
,
-- 五级名称
`risk`
String
,
-- 险种代码
`risk`
String
,
-- 险种代码
`riskname`
String
,
-- 险种代码名称
`riskname`
String
,
-- 险种代码名称
`classcode`
String
,
-- 险类代码
`classname`
String
,
--险类代码名称
`chnl`
String
,
-- 业务渠道
`chnl`
String
,
-- 业务渠道
`chnlname`
String
,
-- 业务渠道名称
`chnlname`
String
,
-- 业务渠道名称
`businessNatureCode`
String
,
-- 业务来源
`businessNatureCode`
String
,
-- 业务来源
`businessNatureName`
String
,
-- 业务来源名称
`businessNatureName`
String
,
-- 业务来源名称
`cost`
String
,
--
含税保费
`cost`
String
,
--
不含税转汇率保费
`no`
String
,
-- 保单号
`no`
String
,
-- 保单号
`xxzflag`
String
,
-- 新续转标记 1是0否
`xxzflag`
String
,
-- 新续转标记 1是0否
`id`
String
,
-- 14 归属业务员ID
`id`
String
,
-- 14 归属业务员ID
...
...
ZB_ODS/ZB_ODS_CBDATA.sql
View file @
245b7344
...
@@ -8,8 +8,39 @@
...
@@ -8,8 +8,39 @@
-- 2、汇率换算 = 承保保费 * sigAndStaExchangeRate (汇率)
-- 2、汇率换算 = 承保保费 * sigAndStaExchangeRate (汇率)
-- 备注:批单不用计算,sta开头得字段是被转过汇率得
-- 备注:批单不用计算,sta开头得字段是被转过汇率得
-- 条件: 车险 或 (非车险 并且 plcSolution[1].plcCoins.plcCoinsBasicInformation[1].coinsIdentity(共保我方) =1)
-- 条件: 车险 或 (非车险 并且 plcSolution[1].plcCoins.plcCoinsBasicInformation[1].coinsIdentity(共保我方) =1)
CREATE
TEMPORARY
VIEW
VIEW_HIS_CBDATA
AS
select
insert
into
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
select
s1
.
uwConclueDate
as
`uwConclueDate`
-- 核保通过时间
,
s1
.
startTime
as
`startTime`
-- 起保时间
,
s1
.
businessOffice
as
`COMCODE`
--
,
t1
.
COMNAME
as
`COMNAME`
--
,
t1
.
LEVEL1COMCODE
as
`LEVEL1COMCODE`
--
,
t1
.
LEVEL2COMCODE
as
`LEVEL2COMCODE`
--
,
t1
.
LEVEL3COMCODE
as
`LEVEL3COMCODE`
--
,
t1
.
LEVEL4COMCODE
as
`LEVEL4COMCODE`
--
,
t1
.
LEVEL5COMCODE
as
`LEVEL5COMCODE`
--
,
t1
.
LEVEL1COMDESC
as
`LEVEL1COMDESC`
--
,
t1
.
LEVEL2COMDESC
as
`LEVEL2COMDESC`
--
,
t1
.
LEVEL3COMDESC
as
`LEVEL3COMDESC`
--
,
t1
.
LEVEL4COMDESC
as
`LEVEL4COMDESC`
--
,
t1
.
LEVEL5COMDESC
as
`LEVEL5COMDESC`
--
,
s1
.
productCode
as
`risk`
-- 险种代码
,
t3
.
RISKNAME
as
`riskname`
--
,
t3
.
CLASSCODE
as
`classcode`
-- 险类代码
,
t3
.
CLASSNAME
as
`classname`
--
,
s1
.
businessChannelCode
as
`chnl`
-- 业务渠道
,
t2
.
NEWCHNLTYPEDESC
as
`chnlname`
--
,
s1
.
businessNatureCode
as
`businessNatureCode`
-- 业务来源
,
t4
.
CODEDESC
as
`businessNatureName`
--
,
cast
(
s1
.
netPremium
as
varchar
)
as
`cost`
-- 不含税保费
,
s1
.
policyNo
as
`no`
-- 保单号
,
s1
.
xxzflag
as
xxzflag
-- 新续转标记 1是0否
,
s1
.
recordClerkCode
as
`id`
-- 14 归属业务员ID
,
s1
.
recordClerkName
as
`name`
-- 15 归属业务员名称
from
(
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
-- 保单归属机构代码
...
@@ -28,7 +59,7 @@ CREATE TEMPORARY VIEW VIEW_HIS_CBDATA AS
...
@@ -28,7 +59,7 @@ CREATE TEMPORARY VIEW VIEW_HIS_CBDATA AS
,
recordClerkCode
as
recordClerkCode
-- 14 归属业务员ID
,
recordClerkCode
as
recordClerkCode
-- 14 归属业务员ID
,
recordClerkName
as
recordClerkName
-- 15 归属业务员名称
,
recordClerkName
as
recordClerkName
-- 15 归属业务员名称
,
'bd'
as
flag
-- 保单或批单标记
,
'bd'
as
flag
-- 保单或批单标记
,
proctime
as
proctime
-- ,ROW_NUMBER() OVER(PARTITION BY policyNo,businessOffice,netPremium ORDER BY uwConclueDate DESC) as rownum
,
proctime
as
proctime
from
ZB_ODS
.
ZB_SOURCE_RMQ_POLICY_SIT
.
POLICY
-- 保单业务数据
from
ZB_ODS
.
ZB_SOURCE_RMQ_POLICY_SIT
.
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
JsonValueUDF
(
plcSolution
[
1
].
plcCoins
,
'plcCoinsBasicInformation[1].coinsIdentity'
)
=
'1'
))
...
@@ -54,45 +85,15 @@ CREATE TEMPORARY VIEW VIEW_HIS_CBDATA AS
...
@@ -54,45 +85,15 @@ CREATE TEMPORARY VIEW VIEW_HIS_CBDATA AS
,
recordClerkName
as
recordClerkName
-- 15 归属业务员名称
,
recordClerkName
as
recordClerkName
-- 15 归属业务员名称
,
'pd'
as
flag
-- 保单或批单标记
,
'pd'
as
flag
-- 保单或批单标记
,
proctime
as
proctime
,
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
-- 批单业务数据
from
ZB_ODS
.
ZB_SOURCE_RMQ_ENDOR_SIT
.
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
JsonValueUDF
(
plcSolution
[
1
].
plcCoins
,
'plcCoinsBasicInformation[1].coinsIdentity'
)
=
'1'
))
;
insert
into
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
)
s1
select
s1
.
uwConclueDate
as
`uwConclueDate`
-- 核保通过时间
,
s1
.
startTime
as
`startTime`
-- 起保时间
,
s1
.
businessOffice
as
`COMCODE`
--
,
t1
.
COMNAME
as
`COMNAME`
--
,
t1
.
LEVEL1COMCODE
as
`LEVEL1COMCODE`
--
,
t1
.
LEVEL2COMCODE
as
`LEVEL2COMCODE`
--
,
t1
.
LEVEL3COMCODE
as
`LEVEL3COMCODE`
--
,
t1
.
LEVEL4COMCODE
as
`LEVEL4COMCODE`
--
,
t1
.
LEVEL5COMCODE
as
`LEVEL5COMCODE`
--
,
t1
.
LEVEL1COMDESC
as
`LEVEL1COMDESC`
--
,
t1
.
LEVEL2COMDESC
as
`LEVEL2COMDESC`
--
,
t1
.
LEVEL3COMDESC
as
`LEVEL3COMDESC`
--
,
t1
.
LEVEL4COMDESC
as
`LEVEL4COMDESC`
--
,
t1
.
LEVEL5COMDESC
as
`LEVEL5COMDESC`
--
,
s1
.
productCode
as
`risk`
-- 险种代码
,
t3
.
RISKNAME
as
`riskname`
--
,
s1
.
businessChannelCode
as
`chnl`
-- 业务渠道
,
t2
.
NEWCHNLTYPEDESC
as
`chnlname`
--
,
s1
.
businessNatureCode
as
`businessNatureCode`
-- 业务来源
,
t4
.
CODEDESC
as
`businessNatureName`
--
,
cast
(
s1
.
netPremium
as
varchar
)
as
`cost`
-- 不含税保费
,
s1
.
policyNo
as
`no`
-- 保单号
,
s1
.
xxzflag
as
xxzflag
-- 新续转标记 1是0否
,
s1
.
recordClerkCode
as
`id`
-- 14 归属业务员ID
,
s1
.
recordClerkName
as
`name`
-- 15 归属业务员名称
from
VIEW_HIS_CBDATA
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
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
-- where s1.rownum = 1
;
;
...
...
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