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
c237079f
Commit
c237079f
authored
Aug 15, 2022
by
胡涛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
指标统计sql脚本
parent
9c6e3688
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
179 additions
and
118 deletions
+179
-118
ZB_DM/理赔指标/ZB_DM_分渠道已决赔款.sql
ZB_DM/理赔指标/ZB_DM_分渠道已决赔款.sql
+11
-5
ZB_DM/理赔指标/ZB_DM_分渠道未决赔款.sql
ZB_DM/理赔指标/ZB_DM_分渠道未决赔款.sql
+11
-5
ZB_DM/理赔指标/ZB_DM_分险类已决赔款.sql
ZB_DM/理赔指标/ZB_DM_分险类已决赔款.sql
+22
-15
ZB_DM/理赔指标/ZB_DM_分险类未决赔款.sql
ZB_DM/理赔指标/ZB_DM_分险类未决赔款.sql
+23
-16
ZB_DM/理赔指标/ZB_DM_已决赔款.sql
ZB_DM/理赔指标/ZB_DM_已决赔款.sql
+11
-5
ZB_DM/理赔指标/ZB_DM_未决赔款.sql
ZB_DM/理赔指标/ZB_DM_未决赔款.sql
+10
-4
ZB_DM/理赔指标/ZB_DM_车险未决大单.sql
ZB_DM/理赔指标/ZB_DM_车险未决大单.sql
+43
-33
ZB_DM/理赔指标/ZB_DM_非车险未决大单.sql
ZB_DM/理赔指标/ZB_DM_非车险未决大单.sql
+48
-35
No files found.
ZB_DM/理赔指标/ZB_DM_分渠道已决赔款.sql
View file @
c237079f
...
...
@@ -14,11 +14,17 @@ SELECT
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
LPDATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`flag`
=
'yj'
and
LEFT
(
s1
.
`setdate`
,
8
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
from
(
select
*
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`setdate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
LPDATA
where
`COMNAME`
is
not
null
and
LEFT
(
`setdate`
,
8
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
and
s1
.
`flag`
=
'yj'
group
by
s1
.
`setdate`
,
s1
.
`chnl`
...
...
ZB_DM/理赔指标/ZB_DM_分渠道未决赔款.sql
View file @
c237079f
...
...
@@ -14,11 +14,17 @@ SELECT
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
LPDATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`flag`
=
'wj'
and
LEFT
(
s1
.
`setdate`
,
8
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
from
(
select
*
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`setdate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
LPDATA
where
`COMNAME`
is
not
null
and
LEFT
(
`setdate`
,
8
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
and
s1
.
`flag`
=
'wj'
group
by
s1
.
`setdate`
,
s1
.
`chnl`
...
...
ZB_DM/理赔指标/ZB_DM_分险类已决赔款.sql
View file @
c237079f
...
...
@@ -8,20 +8,26 @@
CREATE
TEMPORARY
VIEW
VIEW_ZB_DM_FXLYJPK_TUANDUI
AS
SELECT
s1
.
`setdate`
as
`setdate`
,
s1
.
`
risk`
as
`risk
`
,
s1
.
`
classcode`
as
`classcode
`
,
s1
.
`LEVEL1COMCODE`
as
`LEVEL1COMCODE`
,
s1
.
`LEVEL2COMCODE`
as
`LEVEL2COMCODE`
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
LPDATA
s1
where
s1
.
`COMNAME`
is
not
null
from
(
select
*
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`setdate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
LPDATA
where
`COMNAME`
is
not
null
and
LEFT
(
`setdate`
,
8
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
and
s1
.
`flag`
=
'yj'
and
LEFT
(
s1
.
`setdate`
,
8
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
group
by
s1
.
`setdate`
,
s1
.
`
risk
`
,
s1
.
`
classcode
`
,
s1
.
`LEVEL1COMCODE`
,
s1
.
`LEVEL2COMCODE`
,
s1
.
`LEVEL3COMCODE`
...
...
@@ -35,12 +41,12 @@ select
'allyjxlbf/'
,
s1
.
`setdate`
)
as
`key`
,
s1
.
`
risk
`
as
`hkey`
,
s1
.
`
classcode
`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_FXLYJPK_TUANDUI
s1
group
by
s1
.
`setdate`
,
s1
.
`
risk
`
,
s1
.
`
classcode
`
;
...
...
@@ -52,12 +58,12 @@ select
,
s1
.
`setdate`
,
'/'
,
s1
.
`LEVEL1COMCODE`
)
as
`key`
,
s1
.
`
risk
`
as
`hkey`
,
s1
.
`
classcode
`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_FXLYJPK_TUANDUI
s1
group
by
s1
.
`setdate`
,
s1
.
`
risk
`
,
s1
.
`
classcode
`
,
s1
.
`LEVEL1COMCODE`
;
...
...
@@ -69,12 +75,12 @@ select
,
s1
.
`setdate`
,
'/'
,
s1
.
`LEVEL2COMCODE`
)
as
`key`
,
s1
.
`
risk
`
as
`hkey`
,
s1
.
`
classcode
`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_FXLYJPK_TUANDUI
s1
group
by
s1
.
`setdate`
,
s1
.
`
risk
`
,
s1
.
`
classcode
`
,
s1
.
`LEVEL2COMCODE`
;
...
...
@@ -86,12 +92,12 @@ select
,
s1
.
`setdate`
,
'/'
,
s1
.
`LEVEL3COMCODE`
)
as
`key`
,
s1
.
`
risk
`
as
`hkey`
,
s1
.
`
classcode
`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_FXLYJPK_TUANDUI
s1
group
by
s1
.
`setdate`
,
s1
.
`
risk
`
,
s1
.
`
classcode
`
,
s1
.
`LEVEL3COMCODE`
;
...
...
@@ -103,7 +109,7 @@ select
,
s1
.
`setdate`
,
'/'
,
s1
.
`LEVEL4COMCODE`
)
as
`key`
,
s1
.
`
risk
`
as
`hkey`
,
s1
.
`
classcode
`
as
`hkey`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
from
VIEW_ZB_DM_FXLYJPK_TUANDUI
s1
;
\ No newline at end of file
ZB_DM/理赔指标/ZB_DM_分险类未决赔款.sql
View file @
c237079f
...
...
@@ -8,20 +8,26 @@
CREATE
TEMPORARY
VIEW
VIEW_ZB_DM_FXLWJPK_TUANDUI
AS
SELECT
s1
.
`setdate`
as
`setdate`
,
s1
.
`
risk`
as
`risk
`
,
s1
.
`
classcode`
as
`classcode
`
,
s1
.
`LEVEL1COMCODE`
as
`LEVEL1COMCODE`
,
s1
.
`LEVEL2COMCODE`
as
`LEVEL2COMCODE`
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
LPDATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`flag`
=
'wj'
and
LEFT
(
s1
.
`setdate`
,
8
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
from
(
select
*
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`setdate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
LPDATA
where
`COMNAME`
is
not
null
and
LEFT
(
`setdate`
,
8
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
and
s1
.
`flag`
=
'wj'
group
by
s1
.
`setdate`
,
s1
.
`
risk
`
,
s1
.
`
classcode
`
,
s1
.
`LEVEL1COMCODE`
,
s1
.
`LEVEL2COMCODE`
,
s1
.
`LEVEL3COMCODE`
...
...
@@ -35,12 +41,12 @@ select
'allwjxlbf/'
,
s1
.
`setdate`
)
as
`key`
,
s1
.
`
risk`
as
`hkey`
,
s1
.
`
classcode`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_FXLWJPK_TUANDUI
s1
group
by
s1
.
`setdate`
,
s1
.
`
risk
`
,
s1
.
`
classcode
`
;
...
...
@@ -52,12 +58,12 @@ select
,
s1
.
`setdate`
,
'/'
,
s1
.
`LEVEL1COMCODE`
)
as
`key`
,
s1
.
`
risk`
as
`hkey`
,
s1
.
`
classcode`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_FXLWJPK_TUANDUI
s1
group
by
s1
.
`setdate`
,
s1
.
`
risk
`
,
s1
.
`
classcode
`
,
s1
.
`LEVEL1COMCODE`
;
...
...
@@ -69,12 +75,12 @@ select
,
s1
.
`setdate`
,
'/'
,
s1
.
`LEVEL2COMCODE`
)
as
`key`
,
s1
.
`
risk`
as
`hkey`
,
s1
.
`
classcode`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_FXLWJPK_TUANDUI
s1
group
by
s1
.
`setdate`
,
s1
.
`
risk
`
,
s1
.
`
classcode
`
,
s1
.
`LEVEL2COMCODE`
;
...
...
@@ -86,12 +92,12 @@ select
,
s1
.
`setdate`
,
'/'
,
s1
.
`LEVEL3COMCODE`
)
as
`key`
,
s1
.
`
risk`
as
`hkey`
,
s1
.
`
classcode`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_FXLWJPK_TUANDUI
s1
group
by
s1
.
`setdate`
,
s1
.
`
risk
`
,
s1
.
`
classcode
`
,
s1
.
`LEVEL3COMCODE`
;
...
...
@@ -103,7 +109,7 @@ select
,
s1
.
`setdate`
,
'/'
,
s1
.
`LEVEL4COMCODE`
)
as
`key`
,
s1
.
`
risk`
as
`hkey`
,
s1
.
`
classcode`
as
`hkey`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
from
VIEW_ZB_DM_FXLWJPK_TUANDUI
s1
;
\ No newline at end of file
ZB_DM/理赔指标/ZB_DM_已决赔款.sql
View file @
c237079f
...
...
@@ -14,11 +14,17 @@ SELECT
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
LPDATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`flag`
=
'yj'
and
LEFT
(
s1
.
`setdate`
,
8
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
from
(
select
*
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`setdate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
LPDATA
where
`COMNAME`
is
not
null
and
LEFT
(
`setdate`
,
8
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
and
s1
.
`flag`
=
'yj'
group
by
s1
.
`setdate`
,
s1
.
`LEVEL1COMCODE`
...
...
ZB_DM/理赔指标/ZB_DM_未决赔款.sql
View file @
c237079f
...
...
@@ -14,11 +14,17 @@ SELECT
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
LPDATA
s1
where
s1
.
`COMNAME`
is
not
null
from
(
select
*
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`setdate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
LPDATA
where
`COMNAME`
is
not
null
and
LEFT
(
`setdate`
,
8
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
and
s1
.
`flag`
=
'wj'
and
LEFT
(
s1
.
`setdate`
,
8
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
group
by
s1
.
`setdate`
,
s1
.
`LEVEL1COMCODE`
...
...
ZB_DM/理赔指标/ZB_DM_车险未决大单.sql
View file @
c237079f
...
...
@@ -2,6 +2,40 @@
-- bigclpbdt/日期
-- 估损调整日期在今天,按照估损金额排序,取前20,车险riskcode 05开头,其他为非车,
-- 去重
CREATE
TEMPORARY
VIEW
VIEW_ZB_DM_CXWJDD
AS
select
*
from
(
select
`setdate`
as
`setdate`
,
`LEVEL1COMCODE`
as
`LEVEL1COMCODE`
,
`LEVEL1COMDESC`
as
`LEVEL1COMDESC`
,
`LEVEL2COMDESC`
as
`LEVEL2COMDESC`
,
`LEVEL2COMCODE`
as
`LEVEL2COMCODE`
,
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
`LEVEL3COMDESC`
as
`LEVEL3COMDESC`
,
`no`
as
`no`
,
`claimno`
as
`claimno`
,
`cost`
as
`cost`
,
cast
(
`lossamout`
as
decimal
(
18
,
2
))
as
`lossamout`
,
`risk`
as
`risk`
,
`riskname`
as
`riskname`
,
`chnl`
as
`chnl`
,
`chnlname`
as
`chnlname`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`setdate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
LPDATA
where
`COMNAME`
is
not
null
and
`flag`
=
'wj'
and
LEFT
(
`setdate`
,
8
)
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
and
LEFT
(
s1
.
`risk`
,
2
)
=
'05'
;
-- 总公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_VARCHAR
select
...
...
@@ -15,7 +49,7 @@ select
,
'maincom'
,
':'
,
s1
.
`maincom`
,
','
,
'no'
,
':'
,
s1
.
`no`
,
','
,
'claimno'
,
':'
,
s1
.
`claimno`
,
','
,
'cost'
,
':'
,
s1
.
`cost`
,
','
,
'cost'
,
':'
,
cast
(
s1
.
`cost`
as
varchar
)
,
','
,
'comname'
,
':'
,
s1
.
`comname`
,
','
,
'chnl'
,
':'
,
s1
.
`chnl`
,
','
,
'mainkey'
,
':'
,
s1
.
`mainkey`
,
','
...
...
@@ -35,24 +69,16 @@ from (
,
d1
.
`LEVEL1COMCODE`
as
`maincom`
,
d1
.
`no`
as
`no`
,
d1
.
`claimno`
as
`claimno`
,
d1
.
`
cost`
as
`cost`
,
d1
.
`
lossamout`
as
`cost`
,
d1
.
`chnl`
as
`chnl`
,
d1
.
`chnlname`
as
`chnlname`
,
CONCAT
(
d1
.
`LEVEL1COMCODE`
,
'/'
,
d1
.
`claimno`
,
'/'
,
d1
.
`no`
)
as
`mainkey`
,
d1
.
`risk`
as
`risk`
,
d1
.
`riskname`
as
`riskname`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`setdate`
ORDER
BY
d1
.
`lossamout`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
LPDATA
d1
where
d1
.
`COMNAME`
is
not
null
and
d1
.
`flag`
=
'wj'
and
LEFT
(
d1
.
`setdate`
,
8
)
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
LEFT
(
d1
.
`risk`
,
2
)
=
'05'
from
VIEW_ZB_DM_CXWJDD
d1
)
c1
where
c1
.
rownum
<=
20
ORDER
by
c1
.
`cost`
asc
)
s1
group
by
s1
.
`setdate`
...
...
@@ -76,7 +102,7 @@ select
,
'cityname'
,
':'
,
s1
.
`cityname`
,
','
,
'no'
,
':'
,
s1
.
`no`
,
','
,
'claimno'
,
':'
,
s1
.
`claimno`
,
','
,
'cost'
,
':'
,
s1
.
`cost`
,
','
,
'cost'
,
':'
,
cast
(
s1
.
`cost`
as
varchar
)
,
','
,
'comname'
,
':'
,
s1
.
`comname`
,
','
,
'chnl'
,
':'
,
s1
.
`chnl`
,
','
,
'mainkey'
,
':'
,
s1
.
`mainkey`
,
','
...
...
@@ -99,24 +125,16 @@ from (
,
d1
.
`LEVEL2COMCODE`
as
`cityname`
,
d1
.
`no`
as
`no`
,
d1
.
`claimno`
as
`claimno`
,
d1
.
`
cost`
as
`cost`
,
d1
.
`
lossamout`
as
`cost`
,
d1
.
`chnl`
as
`chnl`
,
d1
.
`chnlname`
as
`chnlname`
,
CONCAT
(
d1
.
`LEVEL1COMCODE`
,
'/'
,
d1
.
`claimno`
,
'/'
,
d1
.
`no`
)
as
`mainkey`
,
d1
.
`risk`
as
`risk`
,
d1
.
`riskname`
as
`riskname`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`LEVEL1COMCODE`
,
d1
.
`setdate`
ORDER
BY
d1
.
`lossamout`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
LPDATA
d1
where
d1
.
`COMNAME`
is
not
null
and
d1
.
`flag`
=
'wj'
and
LEFT
(
d1
.
`setdate`
,
8
)
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
LEFT
(
d1
.
`risk`
,
2
)
=
'05'
from
VIEW_ZB_DM_CXWJDD
d1
)
c1
where
c1
.
rownum
<=
20
ORDER
by
c1
.
`cost`
asc
)
s1
group
by
s1
.
`setdate`
...
...
@@ -142,7 +160,7 @@ select
,
'countryname'
,
':'
,
s1
.
`countryname`
,
','
,
'no'
,
':'
,
s1
.
`no`
,
','
,
'claimno'
,
':'
,
s1
.
`claimno`
,
','
,
'cost'
,
':'
,
s1
.
`cost`
,
','
,
'cost'
,
':'
,
cast
(
s1
.
`cost`
as
varchar
)
,
','
,
'comname'
,
':'
,
s1
.
`comname`
,
','
,
'chnl'
,
':'
,
s1
.
`chnl`
,
','
,
'mainkey'
,
':'
,
s1
.
`mainkey`
,
','
...
...
@@ -167,24 +185,16 @@ from (
,
d1
.
`LEVEL3COMDESC`
as
`countryname`
,
d1
.
`no`
as
`no`
,
d1
.
`claimno`
as
`claimno`
,
d1
.
`
cost`
as
`cost`
,
d1
.
`
lossamout`
as
`cost`
,
d1
.
`chnl`
as
`chnl`
,
d1
.
`chnlname`
as
`chnlname`
,
CONCAT
(
d1
.
`LEVEL1COMCODE`
,
'/'
,
d1
.
`claimno`
,
'/'
,
d1
.
`no`
)
as
`mainkey`
,
d1
.
`risk`
as
`risk`
,
d1
.
`riskname`
as
`riskname`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`LEVEL2COMCODE`
,
d1
.
`setdate`
ORDER
BY
d1
.
`lossamout`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
LPDATA
d1
where
d1
.
`COMNAME`
is
not
null
and
d1
.
`flag`
=
'wj'
and
LEFT
(
d1
.
`setdate`
,
8
)
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
LEFT
(
d1
.
`risk`
,
2
)
=
'05'
from
VIEW_ZB_DM_CXWJDD
d1
)
c1
where
c1
.
rownum
<=
20
ORDER
by
c1
.
`cost`
asc
)
s1
group
by
s1
.
`setdate`
...
...
ZB_DM/理赔指标/ZB_DM_非车险未决大单.sql
View file @
c237079f
...
...
@@ -2,6 +2,43 @@
-- bigfclpbdt/日期
-- 估损调整日期在今天,按照估损金额排序,取前20,车险riskcode 05开头,其他为非车,
-- 去重
CREATE
TEMPORARY
VIEW
VIEW_ZB_DM_FCXWJDD
AS
select
*
from
(
select
`setdate`
as
`setdate`
,
`LEVEL1COMCODE`
as
`LEVEL1COMCODE`
,
`LEVEL1COMDESC`
as
`LEVEL1COMDESC`
,
`LEVEL2COMDESC`
as
`LEVEL2COMDESC`
,
`LEVEL2COMCODE`
as
`LEVEL2COMCODE`
,
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
`LEVEL3COMDESC`
as
`LEVEL3COMDESC`
,
`no`
as
`no`
,
`claimno`
as
`claimno`
,
`cost`
as
`cost`
,
cast
(
`lossamout`
as
decimal
(
18
,
2
))
as
`lossamout`
,
`risk`
as
`risk`
,
`riskname`
as
`riskname`
,
`chnl`
as
`chnl`
,
`chnlname`
as
`chnlname`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`setdate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
LPDATA
where
`COMNAME`
is
not
null
and
`flag`
=
'wj'
and
LEFT
(
`setdate`
,
8
)
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
and
LEFT
(
s1
.
`risk`
,
2
)
<>
'05'
;
-- 总公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_VARCHAR
select
...
...
@@ -15,7 +52,7 @@ select
,
'maincom'
,
':'
,
s1
.
`maincom`
,
','
,
'no'
,
':'
,
s1
.
`no`
,
','
,
'claimno'
,
':'
,
s1
.
`claimno`
,
','
,
'cost'
,
':'
,
s1
.
`cost`
,
','
,
'cost'
,
':'
,
cast
(
s1
.
`cost`
as
varchar
)
,
','
,
'comname'
,
':'
,
s1
.
`comname`
,
','
,
'chnl'
,
':'
,
s1
.
`chnl`
,
','
,
'mainkey'
,
':'
,
s1
.
`mainkey`
,
','
...
...
@@ -35,24 +72,16 @@ from (
,
d1
.
`LEVEL1COMCODE`
as
`maincom`
,
d1
.
`no`
as
`no`
,
d1
.
`claimno`
as
`claimno`
,
d1
.
`
cost`
as
`cost`
,
d1
.
`
lossamout`
as
`cost`
,
d1
.
`chnl`
as
`chnl`
,
d1
.
`chnlname`
as
`chnlname`
,
CONCAT
(
d1
.
`LEVEL1COMCODE`
,
'/'
,
d1
.
`claimno`
,
'/'
,
d1
.
`no`
)
as
`mainkey`
,
d1
.
`risk`
as
`risk`
,
d1
.
`riskname`
as
`riskname`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`setdate`
ORDER
BY
d1
.
`lossamout`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
LPDATA
d1
where
d1
.
`COMNAME`
is
not
null
and
d1
.
`flag`
=
'wj'
and
LEFT
(
d1
.
`setdate`
,
8
)
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
LEFT
(
d1
.
`risk`
,
2
)
<>
'05'
from
VIEW_ZB_DM_FCXWJDD
d1
)
c1
where
c1
.
rownum
<=
20
ORDER
by
c1
.
`cost`
asc
)
s1
group
by
s1
.
`setdate`
...
...
@@ -64,7 +93,7 @@ group by
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_VARCHAR
select
CONCAT
(
'bigcitylpbdt/'
'big
f
citylpbdt/'
,
s1
.
`setdate`
,
'/'
,
s1
.
`group_com`
)
as
`key`
...
...
@@ -76,7 +105,7 @@ select
,
'cityname'
,
':'
,
s1
.
`cityname`
,
','
,
'no'
,
':'
,
s1
.
`no`
,
','
,
'claimno'
,
':'
,
s1
.
`claimno`
,
','
,
'cost'
,
':'
,
s1
.
`cost`
,
','
,
'cost'
,
':'
,
cast
(
s1
.
`cost`
as
varchar
)
,
','
,
'comname'
,
':'
,
s1
.
`comname`
,
','
,
'chnl'
,
':'
,
s1
.
`chnl`
,
','
,
'mainkey'
,
':'
,
s1
.
`mainkey`
,
','
...
...
@@ -99,24 +128,16 @@ from (
,
d1
.
`LEVEL2COMCODE`
as
`cityname`
,
d1
.
`no`
as
`no`
,
d1
.
`claimno`
as
`claimno`
,
d1
.
`
cost`
as
`cost`
,
d1
.
`
lossamout`
as
`cost`
,
d1
.
`chnl`
as
`chnl`
,
d1
.
`chnlname`
as
`chnlname`
,
CONCAT
(
d1
.
`LEVEL1COMCODE`
,
'/'
,
d1
.
`claimno`
,
'/'
,
d1
.
`no`
)
as
`mainkey`
,
d1
.
`risk`
as
`risk`
,
d1
.
`riskname`
as
`riskname`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`LEVEL1COMCODE`
,
d1
.
`setdate`
ORDER
BY
d1
.
`lossamout`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
LPDATA
d1
where
d1
.
`COMNAME`
is
not
null
and
d1
.
`flag`
=
'wj'
and
LEFT
(
d1
.
`setdate`
,
8
)
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
LEFT
(
d1
.
`risk`
,
2
)
<>
'05'
from
VIEW_ZB_DM_FCXWJDD
d1
)
c1
where
c1
.
rownum
<=
20
ORDER
by
c1
.
`cost`
asc
)
s1
group
by
s1
.
`setdate`
...
...
@@ -128,7 +149,7 @@ group by
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_VARCHAR
select
CONCAT
(
'bigcountrylpbdt/'
'big
f
countrylpbdt/'
,
s1
.
`setdate`
,
'/'
,
s1
.
`group_com`
)
as
`key`
...
...
@@ -142,7 +163,7 @@ select
,
'countryname'
,
':'
,
s1
.
`countryname`
,
','
,
'no'
,
':'
,
s1
.
`no`
,
','
,
'claimno'
,
':'
,
s1
.
`claimno`
,
','
,
'cost'
,
':'
,
s1
.
`cost`
,
','
,
'cost'
,
':'
,
cast
(
s1
.
`cost`
as
varchar
)
,
','
,
'comname'
,
':'
,
s1
.
`comname`
,
','
,
'chnl'
,
':'
,
s1
.
`chnl`
,
','
,
'mainkey'
,
':'
,
s1
.
`mainkey`
,
','
...
...
@@ -167,24 +188,16 @@ from (
,
d1
.
`LEVEL3COMDESC`
as
`countryname`
,
d1
.
`no`
as
`no`
,
d1
.
`claimno`
as
`claimno`
,
d1
.
`
cost`
as
`cost`
,
d1
.
`
lossamout`
as
`cost`
,
d1
.
`chnl`
as
`chnl`
,
d1
.
`chnlname`
as
`chnlname`
,
CONCAT
(
d1
.
`LEVEL1COMCODE`
,
'/'
,
d1
.
`claimno`
,
'/'
,
d1
.
`no`
)
as
`mainkey`
,
d1
.
`risk`
as
`risk`
,
d1
.
`riskname`
as
`riskname`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`LEVEL2COMCODE`
,
d1
.
`setdate`
ORDER
BY
d1
.
`lossamout`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
LPDATA
d1
where
d1
.
`COMNAME`
is
not
null
and
d1
.
`flag`
=
'wj'
and
LEFT
(
d1
.
`setdate`
,
8
)
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
LEFT
(
d1
.
`risk`
,
2
)
<>
'05'
from
VIEW_ZB_DM_FCXWJDD
d1
)
c1
where
c1
.
rownum
<=
20
ORDER
by
c1
.
`cost`
asc
)
s1
group
by
s1
.
`setdate`
...
...
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