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
9c6e3688
Commit
9c6e3688
authored
Aug 12, 2022
by
胡涛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
指标统计sql脚本
parent
d32251d3
Changes
21
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
577 additions
and
433 deletions
+577
-433
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
+22
-17
ZB_DM/承保指标/ZB_DM_今日签单季度末待起保保费.sql
ZB_DM/承保指标/ZB_DM_今日签单季度末待起保保费.sql
+11
-5
ZB_DM/承保指标/ZB_DM_今日签单月底前起保保费.sql
ZB_DM/承保指标/ZB_DM_今日签单月底前起保保费.sql
+12
-6
ZB_DM/承保指标/ZB_DM_分业务来源季末前起保保费.sql
ZB_DM/承保指标/ZB_DM_分业务来源季末前起保保费.sql
+10
-4
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
+11
-5
ZB_DM/承保指标/ZB_DM_分渠道保费.sql
ZB_DM/承保指标/ZB_DM_分渠道保费.sql
+11
-5
ZB_DM/承保指标/ZB_DM_分险类保费.sql
ZB_DM/承保指标/ZB_DM_分险类保费.sql
+23
-16
ZB_DM/承保指标/ZB_DM_归属业务人员当日签单保费排名.sql
ZB_DM/承保指标/ZB_DM_归属业务人员当日签单保费排名.sql
+177
-167
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
+10
-4
ZB_DM/承保指标/ZB_DM_新续转保单保费当日签单当日起保.sql
ZB_DM/承保指标/ZB_DM_新续转保单保费当日签单当日起保.sql
+10
-4
ZB_DM/承保指标/ZB_DM_新续转保单保费月底前起保.sql
ZB_DM/承保指标/ZB_DM_新续转保单保费月底前起保.sql
+10
-4
ZB_DM/承保指标/ZB_DM_车险今日签单保费.sql
ZB_DM/承保指标/ZB_DM_车险今日签单保费.sql
+12
-5
ZB_DM/承保指标/ZB_DM_车险承保大单.sql
ZB_DM/承保指标/ZB_DM_车险承保大单.sql
+143
-131
ZB_DM/承保指标/ZB_DM_非车险今日签单保费.sql
ZB_DM/承保指标/ZB_DM_非车险今日签单保费.sql
+13
-6
ZB_DM/承保指标/ZB_DM_非车险承保大单.sql
ZB_DM/承保指标/ZB_DM_非车险承保大单.sql
+38
-26
No files found.
ZB_DM/承保指标/ZB_DM_今日签单今年待起保保费.sql
View file @
9c6e3688
...
...
@@ -13,11 +13,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
.
CBDATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
left
(
s1
.
`startTime`
,
4
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
)
from
(
select
*
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`uwConclueDate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
and
left
(
s1
.
`startTime`
,
4
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
)
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
...
...
ZB_DM/承保指标/ZB_DM_今日签单今日待起保保费.sql
View file @
9c6e3688
...
...
@@ -13,10 +13,16 @@ 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
.
CBDATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
from
(
select
*
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`uwConclueDate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
and
left
(
s1
.
`startTime`
,
8
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
group
by
s1
.
`uwConclueDate`
...
...
ZB_DM/承保指标/ZB_DM_今日签单保费.sql
View file @
9c6e3688
...
...
@@ -7,23 +7,28 @@
-- step1:
-- 团队汇总
CREATE
TEMPORARY
VIEW
VIEW_ZB_DM_JRQDBF_TUANDUI
AS
SELECT
s1
.
`uwConclueDate`
as
`uwConclueDate`
,
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
.
CBDATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
,
s1
.
`LEVEL2COMCODE`
,
s1
.
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
SELECT
s1
.
`uwConclueDate`
as
`uwConclueDate`
,
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
(
select
*
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`uwConclueDate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
,
s1
.
`LEVEL2COMCODE`
,
s1
.
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
;
-- 总公司
...
...
ZB_DM/承保指标/ZB_DM_今日签单季度末待起保保费.sql
View file @
9c6e3688
...
...
@@ -13,10 +13,16 @@ 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
.
CBDATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
from
(
select
*
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`uwConclueDate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
-- 核保时间在今天并且起保时间的月份小于等于季度。
and
CASE
WHEN
DATE_FORMAT
(
LOCALTIMESTAMP
,
'MM'
)
in
(
'01'
,
'02'
,
'03'
)
THEN
left
(
s1
.
`startTime`
,
6
)
<=
CONCAT
(
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
),
'03'
)
WHEN
DATE_FORMAT
(
LOCALTIMESTAMP
,
'MM'
)
in
(
'04'
,
'05'
,
'06'
)
THEN
left
(
s1
.
`startTime`
,
6
)
<=
CONCAT
(
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
),
'06'
)
...
...
@@ -99,7 +105,7 @@ select
'teamquarterqdbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL
1
COMCODE`
as
`hkey`
,
s1
.
`LEVEL
4
COMCODE`
as
`hkey`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
from
VIEW_ZB_DM_JRQDJDMQBBF_TUANDUI
s1
;
...
...
ZB_DM/承保指标/ZB_DM_今日签单月底前起保保费.sql
View file @
9c6e3688
...
...
@@ -13,11 +13,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
.
CBDATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
left
(
s1
.
`startTime`
,
6
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMM'
)
from
(
select
*
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`uwConclueDate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
and
left
(
s1
.
`startTime`
,
6
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMM'
)
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
...
...
@@ -94,7 +100,7 @@ select
'teammonthqbbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL
1
COMCODE`
as
`hkey`
,
s1
.
`LEVEL
4
COMCODE`
as
`hkey`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
from
VIEW_ZB_DM_JRQDYDQQBBF_TUANDUI
s1
;
...
...
ZB_DM/承保指标/ZB_DM_分业务来源季末前起保保费.sql
View file @
9c6e3688
...
...
@@ -14,10 +14,16 @@ 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
.
CBDATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
from
(
select
*
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`uwConclueDate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
and
CASE
WHEN
DATE_FORMAT
(
LOCALTIMESTAMP
,
'MM'
)
in
(
'01'
,
'02'
,
'03'
)
THEN
left
(
s1
.
`startTime`
,
6
)
<=
CONCAT
(
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
),
'03'
)
WHEN
DATE_FORMAT
(
LOCALTIMESTAMP
,
'MM'
)
in
(
'04'
,
'05'
,
'06'
)
THEN
left
(
s1
.
`startTime`
,
6
)
<=
CONCAT
(
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
),
'06'
)
WHEN
DATE_FORMAT
(
LOCALTIMESTAMP
,
'MM'
)
in
(
'07'
,
'08'
,
'09'
)
THEN
left
(
s1
.
`startTime`
,
6
)
<=
CONCAT
(
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
),
'09'
)
...
...
ZB_DM/承保指标/ZB_DM_分业务来源年底前起保保费.sql
View file @
9c6e3688
...
...
@@ -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
.
CBDATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
left
(
s1
.
`startTime`
,
4
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
)
from
(
select
*
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`uwConclueDate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
and
left
(
s1
.
`startTime`
,
4
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
)
group
by
s1
.
`uwConclueDate`
,
s1
.
`businessNatureCode`
...
...
ZB_DM/承保指标/ZB_DM_分业务来源当日签单当日起保保费.sql
View file @
9c6e3688
...
...
@@ -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
.
CBDATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
left
(
s1
.
`startTime`
,
8
)
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
from
(
select
*
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`uwConclueDate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
and
left
(
s1
.
`startTime`
,
8
)
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
group
by
s1
.
`uwConclueDate`
,
s1
.
`businessNatureCode`
...
...
ZB_DM/承保指标/ZB_DM_分业务来源月底前起保保费.sql
View file @
9c6e3688
...
...
@@ -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
.
CBDATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
left
(
s1
.
`startTime`
,
6
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMM'
)
from
(
select
*
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`uwConclueDate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
and
left
(
s1
.
`startTime`
,
6
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMM'
)
group
by
s1
.
`uwConclueDate`
,
s1
.
`businessNatureCode`
...
...
ZB_DM/承保指标/ZB_DM_分渠道保费.sql
View file @
9c6e3688
...
...
@@ -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
.
CBDATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
left
(
s1
.
`startTime`
,
4
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
)
from
(
select
*
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`uwConclueDate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
and
left
(
s1
.
`startTime`
,
4
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
)
group
by
s1
.
`uwConclueDate`
...
...
ZB_DM/承保指标/ZB_DM_分险类保费.sql
View file @
9c6e3688
...
...
@@ -8,21 +8,27 @@
CREATE
TEMPORARY
VIEW
VIEW_ZB_DM_FXLBF_TUANDUI
AS
SELECT
s1
.
`uwConclueDate`
as
`uwConclueDate`
,
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
.
CBDATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
left
(
s1
.
`startTime`
,
4
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
)
from
(
select
*
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`uwConclueDate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
and
left
(
s1
.
`startTime`
,
4
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
)
group
by
s1
.
`uwConclueDate`
,
s1
.
`
risk
`
,
s1
.
`
classcode
`
,
s1
.
`LEVEL1COMCODE`
,
s1
.
`LEVEL2COMCODE`
,
s1
.
`LEVEL3COMCODE`
...
...
@@ -36,12 +42,12 @@ select
'allxlbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`
risk`
as
`hkey`
,
s1
.
`
classcode`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_FXLBF_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`
risk
`
,
s1
.
`
classcode
`
;
...
...
@@ -53,12 +59,12 @@ select
,
s1
.
`uwConclueDate`
,
'/'
,
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_FXLBF_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`
risk
`
,
s1
.
`
classcode
`
,
s1
.
`LEVEL1COMCODE`
;
...
...
@@ -70,12 +76,12 @@ select
,
s1
.
`uwConclueDate`
,
'/'
,
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_FXLBF_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`
risk
`
,
s1
.
`
classcode
`
,
s1
.
`LEVEL2COMCODE`
;
...
...
@@ -87,12 +93,12 @@ select
,
s1
.
`uwConclueDate`
,
'/'
,
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_FXLBF_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`
risk
`
,
s1
.
`
classcode
`
,
s1
.
`LEVEL3COMCODE`
;
...
...
@@ -104,7 +110,7 @@ select
,
s1
.
`uwConclueDate`
,
'/'
,
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_FXLBF_TUANDUI
s1
;
\ No newline at end of file
ZB_DM/承保指标/ZB_DM_归属业务人员当日签单保费排名.sql
View file @
9c6e3688
...
...
@@ -3,60 +3,82 @@
-- allrybf/日期
-- 取TOP20
-- step1:
-- 去重
CREATE
TEMPORARY
VIEW
VIEW_ZB_DM_GSYWRNQNBFPM
AS
select
*
from
(
select
d1
.
`uwConclueDate`
as
`uwConclueDate`
,
d1
.
`LEVEL1COMCODE`
as
`LEVEL1COMCODE`
,
d1
.
`LEVEL1COMDESC`
as
`LEVEL1COMDESC`
,
d1
.
`LEVEL2COMCODE`
as
`LEVEL2COMCODE`
,
d1
.
`LEVEL2COMDESC`
as
`LEVEL2COMDESC`
,
d1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
d1
.
`LEVEL3COMDESC`
as
`LEVEL3COMDESC`
,
d1
.
`id`
as
`id`
,
d1
.
`name`
as
`name`
,
d1
.
`cost`
as
`cost`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`uwConclueDate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
d1
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
;
-- 总公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_VARCHAR
select
CONCAT
(
'allrybf/'
'allrybf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
CastToJsonArrayUDF
(
)
as
`key`
,
CastToJsonArrayUDF
(
listagg
(
concat
(
'com'
,
':'
,
`com`
,
','
,
'comname'
,
':'
,
`comname`
,
','
,
'id'
,
':'
,
`id`
,
','
,
'name'
,
':'
,
`name`
,
','
,
'cost'
,
':'
,
`cost`
),
';'
)
'com'
,
':'
,
`com`
,
','
,
'comname'
,
':'
,
`comname`
,
','
,
'id'
,
':'
,
`id`
,
','
,
'name'
,
':'
,
`name`
,
','
,
'cost'
,
':'
,
cast
(
s1
.
`cost`
AS
VARCHAR
)
),
';'
)
)
as
`val`
from
(
select
*
from
(
select
d1
.
`uwConclueDate`
as
`uwConclueDate`
,
d1
.
`LEVEL1COMCODE`
as
`group_com`
,
d1
.
`LEVEL1COMCODE`
as
`com`
,
d1
.
`LEVEL1COMDESC`
as
`comname`
,
d1
.
`id`
as
`id`
,
d1
.
`name`
as
`name`
,
cast
(
d1
.
`cost`
AS
VARCHAR
)
as
`cost`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`uwConclueDate`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
from
(
select
`uwConclueDate`
as
`uwConclueDate`
,
`LEVEL1COMCODE`
as
`LEVEL1COMCODE`
,
`LEVEL1COMDESC`
as
`LEVEL1COMDESC`
,
`id`
as
`id`
,
`name`
as
`name`
,
sum
(
cast
(
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
group
by
`uwConclueDate`
,
`LEVEL1COMCODE`
,
`LEVEL1COMDESC`
,
`id`
,
`name`
)
d1
)
c1
where
c1
.
rownum
<=
20
ORDER
by
c1
.
`cost`
asc
)
s1
select
*
from
(
select
d1
.
`uwConclueDate`
as
`uwConclueDate`
,
d1
.
`LEVEL1COMCODE`
as
`group_com`
,
d1
.
`LEVEL1COMCODE`
as
`com`
,
d1
.
`LEVEL1COMDESC`
as
`comname`
,
d1
.
`id`
as
`id`
,
d1
.
`name`
as
`name`
,
d1
.
`cost`
as
`cost`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`uwConclueDate`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
from
(
select
`uwConclueDate`
as
`uwConclueDate`
,
`LEVEL1COMCODE`
as
`LEVEL1COMCODE`
,
`LEVEL1COMDESC`
as
`LEVEL1COMDESC`
,
`id`
as
`id`
,
`name`
as
`name`
,
sum
(
cast
(
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
VIEW_ZB_DM_GSYWRNQNBFPM
group
by
`uwConclueDate`
,
`LEVEL1COMCODE`
,
`LEVEL1COMDESC`
,
`id`
,
`name`
)
d1
)
c1
where
c1
.
rownum
<=
20
)
s1
group
by
s1
.
`uwConclueDate`
;
...
...
@@ -64,147 +86,135 @@ group by
-- 分公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
H
SET_VARCHAR
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_VARCHAR
select
CONCAT
(
'provrybf/'
'provrybf/'
,
s1
.
`uwConclueDate`
,
'/'
,
s1
.
`group_com`
)
as
`key`
,
CastToJsonArrayUDF
(
)
as
`key`
,
CastToJsonArrayUDF
(
listagg
(
concat
(
'com'
,
':'
,
`com`
,
','
,
'comname'
,
':'
,
`comname`
,
','
,
'city'
,
':'
,
`city`
,
','
,
'cityname'
,
':'
,
`cityname`
,
','
,
'id'
,
':'
,
`id`
,
','
,
'name'
,
':'
,
`name`
,
','
,
'cost'
,
':'
,
`cost`
),
';'
)
)
as
`val`
'com'
,
':'
,
`com`
,
','
,
'comname'
,
':'
,
`comname`
,
','
,
'city'
,
':'
,
`city`
,
','
,
'cityname'
,
':'
,
`cityname`
,
','
,
'id'
,
':'
,
`id`
,
','
,
'name'
,
':'
,
`name`
,
','
,
'cost'
,
':'
,
cast
(
s1
.
`cost`
AS
VARCHAR
)
),
';'
)
)
as
`val`
from
(
select
*
from
(
select
d1
.
`uwConclueDate`
as
`uwConclueDate`
,
d1
.
`LEVEL1COMCODE`
as
`group_com`
,
d1
.
`LEVEL1COMCODE`
as
`com`
,
d1
.
`LEVEL1COMDESC`
as
`comname`
,
d1
.
`LEVEL2COMCODE`
as
`city`
,
d1
.
`LEVEL2COMDESC`
as
`cityname`
,
d1
.
`id`
as
`id`
,
d1
.
`name`
as
`name`
,
cast
(
d1
.
`cost`
AS
VARCHAR
)
as
`cost`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`uwConclueDate`
,
d1
.
`LEVEL1COMCODE`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
from
(
select
`uwConclueDate`
as
`uwConclueDate`
,
`LEVEL1COMCODE`
as
`LEVEL1COMCODE`
,
`LEVEL1COMDESC`
as
`LEVEL1COMDESC`
,
`LEVEL2COMCODE`
as
`LEVEL2COMCODE`
,
`LEVEL2COMDESC`
as
`LEVEL2COMDESC`
,
`id`
as
`id`
,
`name`
as
`name`
,
sum
(
cast
(
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
group
by
`uwConclueDate`
,
`LEVEL1COMCODE`
,
`LEVEL1COMDESC`
,
`LEVEL2COMCODE`
,
`LEVEL2COMDESC`
,
`id`
,
`name`
)
d1
)
c1
where
c1
.
rownum
<=
20
ORDER
by
c1
.
`cost`
asc
)
s1
select
*
from
(
select
d1
.
`uwConclueDate`
as
`uwConclueDate`
,
d1
.
`LEVEL1COMCODE`
as
`group_com`
,
d1
.
`LEVEL1COMCODE`
as
`com`
,
d1
.
`LEVEL1COMDESC`
as
`comname`
,
d1
.
`LEVEL2COMCODE`
as
`city`
,
d1
.
`LEVEL2COMDESC`
as
`cityname`
,
d1
.
`id`
as
`id`
,
d1
.
`name`
as
`name`
,
d1
.
`cost`
as
`cost`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`uwConclueDate`
,
d1
.
`LEVEL1COMCODE`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
from
(
select
`uwConclueDate`
as
`uwConclueDate`
,
`LEVEL1COMCODE`
as
`LEVEL1COMCODE`
,
`LEVEL1COMDESC`
as
`LEVEL1COMDESC`
,
`LEVEL2COMCODE`
as
`LEVEL2COMCODE`
,
`LEVEL2COMDESC`
as
`LEVEL2COMDESC`
,
`id`
as
`id`
,
`name`
as
`name`
,
sum
(
cast
(
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
VIEW_ZB_DM_GSYWRNQNBFPM
a1
group
by
`uwConclueDate`
,
`LEVEL1COMCODE`
,
`LEVEL1COMDESC`
,
`LEVEL2COMCODE`
,
`LEVEL2COMDESC`
,
`id`
,
`name`
)
d1
)
c1
where
c1
.
rownum
<=
20
)
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`group_com`
,
s1
.
`group_com`
;
-- 中支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
H
SET_VARCHAR
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_VARCHAR
select
CONCAT
(
'cityrybf/'
'cityrybf/'
,
s1
.
`uwConclueDate`
,
'/'
,
s1
.
`group_com`
)
as
`key`
,
CastToJsonArrayUDF
(
)
as
`key`
,
CastToJsonArrayUDF
(
listagg
(
concat
(
'com'
,
':'
,
`com`
,
','
,
'comname'
,
':'
,
`comname`
,
','
,
'city'
,
':'
,
`city`
,
','
,
'cityname'
,
':'
,
`cityname`
,
','
,
'country'
,
':'
,
`country`
,
','
,
'countryname'
,
':'
,
`countryname`
,
','
,
'id'
,
':'
,
`id`
,
','
,
'name'
,
':'
,
`name`
,
','
,
'cost'
,
':'
,
`cost`
),
';'
)
'com'
,
':'
,
`com`
,
','
,
'comname'
,
':'
,
`comname`
,
','
,
'city'
,
':'
,
`city`
,
','
,
'cityname'
,
':'
,
`cityname`
,
','
,
'country'
,
':'
,
`country`
,
','
,
'countryname'
,
':'
,
`countryname`
,
','
,
'id'
,
':'
,
`id`
,
','
,
'name'
,
':'
,
`name`
,
','
,
'cost'
,
':'
,
cast
(
s1
.
`cost`
AS
VARCHAR
)
),
';'
)
)
as
`val`
from
(
select
*
from
(
select
d1
.
`uwConclueDate`
as
`uwConclueDate`
,
d1
.
`LEVEL2COMCODE`
as
`group_com`
,
d1
.
`LEVEL1COMCODE`
as
`com`
,
d1
.
`LEVEL1COMDESC`
as
`comname`
,
d1
.
`LEVEL2COMCODE`
as
`city`
,
d1
.
`LEVEL2COMDESC`
as
`cityname`
,
d1
.
`LEVEL3COMCODE`
as
`country`
,
d1
.
`LEVEL3COMDESC`
as
`countryname`
,
d1
.
`id`
as
`id`
,
d1
.
`name`
as
`name`
,
cast
(
d1
.
`cost`
AS
VARCHAR
)
as
`cost`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`uwConclueDate`
,
d1
.
`LEVEL2COMCODE`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
from
(
select
`uwConclueDate`
as
`uwConclueDate`
,
`LEVEL1COMCODE`
as
`LEVEL1COMCODE`
,
`LEVEL1COMDESC`
as
`LEVEL1COMDESC`
,
`LEVEL2COMCODE`
as
`LEVEL2COMCODE`
,
`LEVEL2COMDESC`
as
`LEVEL2COMDESC`
,
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
`LEVEL3COMDESC`
as
`LEVEL3COMDESC`
,
`id`
as
`id`
,
`name`
as
`name`
,
sum
(
cast
(
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
group
by
`uwConclueDate`
,
`LEVEL1COMCODE`
,
`LEVEL1COMDESC`
,
`LEVEL2COMCODE`
,
`LEVEL2COMDESC`
,
`LEVEL3COMCODE`
,
`LEVEL3COMDESC`
,
`id`
,
`name`
)
d1
)
c1
where
c1
.
rownum
<=
20
ORDER
by
c1
.
`cost`
asc
)
s1
select
*
from
(
select
d1
.
`uwConclueDate`
as
`uwConclueDate`
,
d1
.
`LEVEL2COMCODE`
as
`group_com`
,
d1
.
`LEVEL1COMCODE`
as
`com`
,
d1
.
`LEVEL1COMDESC`
as
`comname`
,
d1
.
`LEVEL2COMCODE`
as
`city`
,
d1
.
`LEVEL2COMDESC`
as
`cityname`
,
d1
.
`LEVEL3COMCODE`
as
`country`
,
d1
.
`LEVEL3COMDESC`
as
`countryname`
,
d1
.
`id`
as
`id`
,
d1
.
`name`
as
`name`
,
d1
.
`cost`
as
`cost`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`uwConclueDate`
,
d1
.
`LEVEL2COMCODE`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
from
(
select
`uwConclueDate`
as
`uwConclueDate`
,
`LEVEL1COMCODE`
as
`LEVEL1COMCODE`
,
`LEVEL1COMDESC`
as
`LEVEL1COMDESC`
,
`LEVEL2COMCODE`
as
`LEVEL2COMCODE`
,
`LEVEL2COMDESC`
as
`LEVEL2COMDESC`
,
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
`LEVEL3COMDESC`
as
`LEVEL3COMDESC`
,
`id`
as
`id`
,
`name`
as
`name`
,
sum
(
cast
(
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
VIEW_ZB_DM_GSYWRNQNBFPM
a1
group
by
`uwConclueDate`
,
`LEVEL1COMCODE`
,
`LEVEL1COMDESC`
,
`LEVEL2COMCODE`
,
`LEVEL2COMDESC`
,
`LEVEL3COMCODE`
,
`LEVEL3COMDESC`
,
`id`
,
`name`
)
d1
)
c1
where
c1
.
rownum
<=
20
)
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`group_com`
,
s1
.
`group_com`
;
ZB_DM/承保指标/ZB_DM_新续转保单保费.sql
View file @
9c6e3688
...
...
@@ -13,11 +13,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
.
CBDATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
s1
.
`xxzflag`
=
'1'
from
(
select
*
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`uwConclueDate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
and
s1
.
`xxzflag`
=
'1'
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
...
...
ZB_DM/承保指标/ZB_DM_新续转保单保费季度末前起保.sql
View file @
9c6e3688
...
...
@@ -15,10 +15,16 @@ 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
.
CBDATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
from
(
select
*
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`uwConclueDate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
and
s1
.
`xxzflag`
=
'1'
-- 起保时间的季度小于等于当前季度
and
CASE
WHEN
DATE_FORMAT
(
LOCALTIMESTAMP
,
'MM'
)
in
(
'01'
,
'02'
,
'03'
)
THEN
left
(
s1
.
`startTime`
,
6
)
<=
CONCAT
(
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
),
'03'
)
...
...
ZB_DM/承保指标/ZB_DM_新续转保单保费年底前起保.sql
View file @
9c6e3688
...
...
@@ -14,10 +14,16 @@ 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
.
CBDATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
from
(
select
*
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`uwConclueDate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
and
s1
.
`xxzflag`
=
'1'
and
left
(
s1
.
`startTime`
,
4
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
)
...
...
ZB_DM/承保指标/ZB_DM_新续转保单保费当日签单当日起保.sql
View file @
9c6e3688
...
...
@@ -14,10 +14,16 @@ 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
.
CBDATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
from
(
select
*
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`uwConclueDate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
and
s1
.
`xxzflag`
=
'1'
and
left
(
s1
.
`startTime`
,
8
)
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
...
...
ZB_DM/承保指标/ZB_DM_新续转保单保费月底前起保.sql
View file @
9c6e3688
...
...
@@ -14,10 +14,16 @@ 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
.
CBDATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
from
(
select
*
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`uwConclueDate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
and
s1
.
`xxzflag`
=
'1'
and
left
(
s1
.
`startTime`
,
6
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMM'
)
...
...
ZB_DM/承保指标/ZB_DM_车险今日签单保费.sql
View file @
9c6e3688
...
...
@@ -13,10 +13,16 @@ 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
.
CBDATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
from
(
select
*
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`uwConclueDate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
and
left
(
s1
.
risk
,
2
)
=
'05'
group
by
s1
.
`uwConclueDate`
...
...
@@ -94,7 +100,7 @@ select
'teamcarqdbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL
1
COMCODE`
as
`hkey`
,
s1
.
`LEVEL
4
COMCODE`
as
`hkey`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
from
VIEW_ZB_DM_QDBF_CAR_TUANDUI
s1
;
\ No newline at end of file
ZB_DM/承保指标/ZB_DM_车险承保大单.sql
View file @
9c6e3688
...
...
@@ -2,52 +2,77 @@
-- bigcbd/日期
-- 核保或者核批时间在今天,按照保费或者未决赔款排序,取前10,车险riskcode 05开头,其他为非车,
-- 车险去重
CREATE
TEMPORARY
VIEW
VIEW_ZB_DM_CXCBDD
AS
select
*
from
(
select
`uwConclueDate`
as
`uwConclueDate`
,
`LEVEL1COMCODE`
as
`LEVEL1COMCODE`
,
`LEVEL1COMDESC`
as
`LEVEL1COMDESC`
,
`LEVEL2COMCODE`
as
`LEVEL2COMCODE`
,
`LEVEL2COMDESC`
as
`LEVEL2COMDESC`
,
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
`LEVEL3COMDESC`
as
`LEVEL3COMDESC`
,
`risk`
as
`risk`
,
`riskname`
as
`riskname`
,
`chnl`
as
`chnl`
,
`chnlname`
as
`chnlname`
,
cast
(
`cost`
as
decimal
(
18
,
2
))
as
`cost`
,
`no`
as
`no`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`uwConclueDate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
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
select
CONCAT
(
'bigcbd/'
'bigcbd/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
CastToJsonArrayUDF
(
)
as
`key`
,
CastToJsonArrayUDF
(
listagg
(
concat
(
'com'
,
':'
,
`com`
,
','
,
'comname'
,
':'
,
`comname`
,
','
,
'risk'
,
':'
,
`risk`
,
','
,
'riskname'
,
':'
,
`riskname`
,
','
,
'chnl'
,
':'
,
`chnl`
,
','
,
'chnlname'
,
':'
,
`chnlname`
,
','
,
'cost'
,
':'
,
`cost`
,
','
,
'no'
,
':'
,
`no`
),
';'
)
)
as
`val`
'com'
,
':'
,
`com`
,
','
,
'comname'
,
':'
,
`comname`
,
','
,
'risk'
,
':'
,
`risk`
,
','
,
'riskname'
,
':'
,
`riskname`
,
','
,
'chnl'
,
':'
,
`chnl`
,
','
,
'chnlname'
,
':'
,
`chnlname`
,
','
,
'cost'
,
':'
,
cast
(
`cost`
as
varchar
)
,
','
,
'no'
,
':'
,
`no`
),
';'
)
)
as
`val`
from
(
select
*
from
(
select
d1
.
`uwConclueDate`
as
`uwConclueDate`
,
d1
.
`LEVEL1COMCODE`
as
`com`
,
d1
.
`LEVEL1COMDESC`
as
`comname`
,
d1
.
`risk`
as
`risk`
,
d1
.
`riskname`
as
`riskname`
,
d1
.
`chnl`
as
`chnl`
,
d1
.
`chnlname`
as
`chnlname`
,
d1
.
`cost`
as
`cost`
,
d1
.
`no`
as
`no`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`uwConclueDate`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
d1
where
d1
.
`COMNAME`
is
not
null
and
d1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
LEFT
(
d1
.
`risk`
,
2
)
=
'05'
)
c1
where
c1
.
rownum
<=
20
ORDER
by
c1
.
`cost`
asc
)
s1
group
by
select
*
from
(
select
d1
.
`uwConclueDate`
as
`uwConclueDate`
,
d1
.
`LEVEL1COMCODE`
as
`com`
,
d1
.
`LEVEL1COMDESC`
as
`comname`
,
d1
.
`risk`
as
`risk`
,
d1
.
`riskname`
as
`riskname`
,
d1
.
`chnl`
as
`chnl`
,
d1
.
`chnlname`
as
`chnlname`
,
d1
.
`cost`
as
`cost`
,
d1
.
`no`
as
`no`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`uwConclueDate`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
from
VIEW_ZB_DM_CXCBDD
d1
)
c1
where
c1
.
rownum
<=
20
)
s1
group
by
s1
.
`uwConclueDate`
;
...
...
@@ -55,58 +80,51 @@ group by
-- 分公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_VARCHAR
select
select
CONCAT
(
'bigccitybd/'
'bigccitybd/'
,
s1
.
`uwConclueDate`
,
'/'
,
s1
.
`group_com`
)
as
`key`
,
CastToJsonArrayUDF
(
)
as
`key`
,
CastToJsonArrayUDF
(
listagg
(
concat
(
'com'
,
':'
,
`com`
,
','
,
'comname'
,
':'
,
`comname`
,
','
,
'city'
,
':'
,
`city`
,
','
,
'cityname'
,
':'
,
`cityname`
,
','
,
'risk'
,
':'
,
`risk`
,
','
,
'riskname'
,
':'
,
`riskname`
,
','
,
'chnl'
,
':'
,
`chnl`
,
','
,
'chnlname'
,
':'
,
`chnlname`
,
','
,
'cost'
,
':'
,
`cost`
,
','
,
'no'
,
':'
,
`no`
),
';'
)
)
as
`val`
'com'
,
':'
,
`com`
,
','
,
'comname'
,
':'
,
`comname`
,
','
,
'city'
,
':'
,
`city`
,
','
,
'cityname'
,
':'
,
`cityname`
,
','
,
'risk'
,
':'
,
`risk`
,
','
,
'riskname'
,
':'
,
`riskname`
,
','
,
'chnl'
,
':'
,
`chnl`
,
','
,
'chnlname'
,
':'
,
`chnlname`
,
','
,
'cost'
,
':'
,
cast
(
`cost`
as
varchar
)
,
','
,
'no'
,
':'
,
`no`
),
';'
)
)
as
`val`
from
(
select
*
from
(
select
d1
.
`uwConclueDate`
as
`uwConclueDate`
,
d1
.
`LEVEL1COMCODE`
as
`group_com`
,
d1
.
`LEVEL1COMCODE`
as
`com`
,
d1
.
`LEVEL1COMDESC`
as
`comname`
,
d1
.
`LEVEL2COMCODE`
as
`city`
,
d1
.
`LEVEL2COMDESC`
as
`cityname`
,
d1
.
`risk`
as
`risk`
,
d1
.
`riskname`
as
`riskname`
,
d1
.
`chnl`
as
`chnl`
,
d1
.
`chnlname`
as
`chnlname`
,
d1
.
`cost`
as
`cost`
,
d1
.
`no`
as
`no`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`LEVEL1COMCODE`
,
d1
.
`uwConclueDate`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
d1
where
d1
.
`COMNAME`
is
not
null
and
d1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
LEFT
(
d1
.
`risk`
,
2
)
=
'05'
)
c1
where
c1
.
rownum
<=
20
ORDER
by
c1
.
`cost`
asc
)
s1
group
by
select
*
from
(
select
d1
.
`uwConclueDate`
as
`uwConclueDate`
,
d1
.
`LEVEL1COMCODE`
as
`group_com`
,
d1
.
`LEVEL1COMCODE`
as
`com`
,
d1
.
`LEVEL1COMDESC`
as
`comname`
,
d1
.
`LEVEL2COMCODE`
as
`city`
,
d1
.
`LEVEL2COMDESC`
as
`cityname`
,
d1
.
`risk`
as
`risk`
,
d1
.
`riskname`
as
`riskname`
,
d1
.
`chnl`
as
`chnl`
,
d1
.
`chnlname`
as
`chnlname`
,
d1
.
`cost`
as
`cost`
,
d1
.
`no`
as
`no`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`LEVEL1COMCODE`
,
d1
.
`uwConclueDate`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
from
VIEW_ZB_DM_CXCBDD
d1
)
c1
where
c1
.
rownum
<=
20
)
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`group_com`
,
s1
.
`group_com`
;
...
...
@@ -118,54 +136,48 @@ select
,
s1
.
`uwConclueDate`
,
'/'
,
s1
.
`group_com`
)
as
`key`
,
CastToJsonArrayUDF
(
,
CastToJsonArrayUDF
(
listagg
(
concat
(
'com'
,
':'
,
`com`
,
','
,
'comname'
,
':'
,
`comname`
,
','
,
'city'
,
':'
,
`city`
,
','
,
'cityname'
,
':'
,
`cityname`
,
','
,
'country'
,
':'
,
`country`
,
','
,
'countryname'
,
':'
,
`countryname`
,
','
,
'risk'
,
':'
,
`risk`
,
','
,
'riskname'
,
':'
,
`riskname`
,
','
,
'chnl'
,
':'
,
`chnl`
,
','
,
'chnlname'
,
':'
,
`chnlname`
,
','
,
'cost'
,
':'
,
`cost`
,
','
,
'no'
,
':'
,
`no`
),
';'
)
)
as
`val`
'com'
,
':'
,
`com`
,
','
,
'comname'
,
':'
,
`comname`
,
','
,
'city'
,
':'
,
`city`
,
','
,
'cityname'
,
':'
,
`cityname`
,
','
,
'country'
,
':'
,
`country`
,
','
,
'countryname'
,
':'
,
`countryname`
,
','
,
'risk'
,
':'
,
`risk`
,
','
,
'riskname'
,
':'
,
`riskname`
,
','
,
'chnl'
,
':'
,
`chnl`
,
','
,
'chnlname'
,
':'
,
`chnlname`
,
','
,
'cost'
,
':'
,
cast
(
`cost`
as
varchar
)
,
','
,
'no'
,
':'
,
`no`
),
';'
)
)
as
`val`
from
(
select
*
from
(
select
d1
.
`uwConclueDate`
as
`uwConclueDate`
,
d1
.
`LEVEL2COMCODE`
as
`group_com`
,
d1
.
`LEVEL1COMCODE`
as
`com`
,
d1
.
`LEVEL1COMDESC`
as
`comname`
,
d1
.
`LEVEL2COMCODE`
as
`city`
,
d1
.
`LEVEL2COMDESC`
as
`cityname`
,
d1
.
`LEVEL3COMCODE`
as
`country`
,
d1
.
`LEVEL3COMDESC`
as
`countryname`
,
d1
.
`risk`
as
`risk`
,
d1
.
`riskname`
as
`riskname`
,
d1
.
`chnl`
as
`chnl`
,
d1
.
`chnlname`
as
`chnlname`
,
d1
.
`cost`
as
`cost`
,
d1
.
`no`
as
`no`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`LEVEL2COMCODE`
,
d1
.
`uwConclueDate`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
d1
where
d1
.
`COMNAME`
is
not
null
and
d1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
LEFT
(
d1
.
`risk`
,
2
)
=
'05'
)
c1
where
c1
.
rownum
<=
20
ORDER
by
c1
.
`cost`
asc
)
s1
select
*
from
(
select
d1
.
`uwConclueDate`
as
`uwConclueDate`
,
d1
.
`LEVEL2COMCODE`
as
`group_com`
,
d1
.
`LEVEL1COMCODE`
as
`com`
,
d1
.
`LEVEL1COMDESC`
as
`comname`
,
d1
.
`LEVEL2COMCODE`
as
`city`
,
d1
.
`LEVEL2COMDESC`
as
`cityname`
,
d1
.
`LEVEL3COMCODE`
as
`country`
,
d1
.
`LEVEL3COMDESC`
as
`countryname`
,
d1
.
`risk`
as
`risk`
,
d1
.
`riskname`
as
`riskname`
,
d1
.
`chnl`
as
`chnl`
,
d1
.
`chnlname`
as
`chnlname`
,
d1
.
`cost`
as
`cost`
,
d1
.
`no`
as
`no`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`LEVEL2COMCODE`
,
d1
.
`uwConclueDate`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
from
VIEW_ZB_DM_CXCBDD
d1
)
c1
where
c1
.
rownum
<=
20
)
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`group_com`
,
s1
.
`group_com`
;
ZB_DM/承保指标/ZB_DM_非车险今日签单保费.sql
View file @
9c6e3688
...
...
@@ -13,11 +13,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
.
CBDATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
left
(
s1
.
risk
,
2
)
<>
'05'
from
(
select
*
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`uwConclueDate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
and
left
(
s1
.
risk
,
2
)
<>
'05'
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
...
...
@@ -94,7 +100,7 @@ select
'teamnocarqdbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL
1
COMCODE`
as
`hkey`
,
s1
.
`LEVEL
4
COMCODE`
as
`hkey`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
from
VIEW_ZB_DM_QDBF_NOCAR_TUANDUI
s1
;
\ No newline at end of file
ZB_DM/承保指标/ZB_DM_非车险承保大单.sql
View file @
9c6e3688
...
...
@@ -3,6 +3,38 @@
-- 核保或者核批时间在今天,按照保费或者未决赔款排序,取前10,车险riskcode 05开头,其他为非车,
-- 非车险去重
CREATE
TEMPORARY
VIEW
VIEW_ZB_DM_FCXCBDD
AS
select
*
from
(
select
`uwConclueDate`
as
`uwConclueDate`
,
`LEVEL1COMCODE`
as
`LEVEL1COMCODE`
,
`LEVEL1COMDESC`
as
`LEVEL1COMDESC`
,
`LEVEL2COMCODE`
as
`LEVEL2COMCODE`
,
`LEVEL2COMDESC`
as
`LEVEL2COMDESC`
,
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
`LEVEL3COMDESC`
as
`LEVEL3COMDESC`
,
`risk`
as
`risk`
,
`riskname`
as
`riskname`
,
`chnl`
as
`chnl`
,
`chnlname`
as
`chnlname`
,
cast
(
`cost`
as
decimal
(
18
,
2
))
as
`cost`
,
`no`
as
`no`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`uwConclueDate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
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
...
...
@@ -18,7 +50,7 @@ select
,
'riskname'
,
':'
,
`riskname`
,
','
,
'chnl'
,
':'
,
`chnl`
,
','
,
'chnlname'
,
':'
,
`chnlname`
,
','
,
'cost'
,
':'
,
`cost`
,
','
,
'cost'
,
':'
,
cast
(
`cost`
as
varchar
)
,
','
,
'no'
,
':'
,
`no`
),
';'
)
)
as
`val`
...
...
@@ -37,16 +69,9 @@ from (
,
d1
.
`cost`
as
`cost`
,
d1
.
`no`
as
`no`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`uwConclueDate`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
d1
where
d1
.
`COMNAME`
is
not
null
and
d1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
LEFT
(
d1
.
`risk`
,
2
)
<>
'05'
from
VIEW_ZB_DM_FCXCBDD
d1
)
c1
where
c1
.
rownum
<=
20
ORDER
by
c1
.
`cost`
asc
)
s1
group
by
s1
.
`uwConclueDate`
...
...
@@ -72,7 +97,7 @@ select
,
'riskname'
,
':'
,
`riskname`
,
','
,
'chnl'
,
':'
,
`chnl`
,
','
,
'chnlname'
,
':'
,
`chnlname`
,
','
,
'cost'
,
':'
,
`cost`
,
','
,
'cost'
,
':'
,
cast
(
`cost`
as
varchar
)
,
','
,
'no'
,
':'
,
`no`
),
';'
)
)
as
`val`
...
...
@@ -94,16 +119,9 @@ from (
,
d1
.
`cost`
as
`cost`
,
d1
.
`no`
as
`no`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`LEVEL1COMCODE`
,
d1
.
`uwConclueDate`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
d1
where
d1
.
`COMNAME`
is
not
null
and
d1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
LEFT
(
d1
.
`risk`
,
2
)
<>
'05'
from
VIEW_ZB_DM_FCXCBDD
d1
)
c1
where
c1
.
rownum
<=
20
ORDER
by
c1
.
`cost`
asc
)
s1
group
by
s1
.
`uwConclueDate`
...
...
@@ -131,7 +149,7 @@ select
,
'riskname'
,
':'
,
`riskname`
,
','
,
'chnl'
,
':'
,
`chnl`
,
','
,
'chnlname'
,
':'
,
`chnlname`
,
','
,
'cost'
,
':'
,
`cost`
,
','
,
'cost'
,
':'
,
cast
(
`cost`
as
varchar
)
,
','
,
'no'
,
':'
,
`no`
),
';'
)
)
as
`val`
...
...
@@ -155,15 +173,9 @@ from (
,
d1
.
`cost`
as
`cost`
,
d1
.
`no`
as
`no`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`LEVEL2COMCODE`
,
d1
.
`uwConclueDate`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
d1
where
d1
.
`COMNAME`
is
not
null
and
d1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
LEFT
(
d1
.
`risk`
,
2
)
<>
'05'
from
VIEW_ZB_DM_FCXCBDD
d1
)
c1
where
c1
.
rownum
<=
20
ORDER
by
c1
.
`cost`
asc
)
s1
group
by
s1
.
`uwConclueDate`
...
...
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