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
Show whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
328 additions
and
184 deletions
+328
-184
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
+20
-15
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
+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
+10
-4
ZB_DM/承保指标/ZB_DM_分险类保费.sql
ZB_DM/承保指标/ZB_DM_分险类保费.sql
+22
-15
ZB_DM/承保指标/ZB_DM_归属业务人员当日签单保费排名.sql
ZB_DM/承保指标/ZB_DM_归属业务人员当日签单保费排名.sql
+42
-32
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
+10
-4
ZB_DM/承保指标/ZB_DM_车险今日签单保费.sql
ZB_DM/承保指标/ZB_DM_车险今日签单保费.sql
+12
-5
ZB_DM/承保指标/ZB_DM_车险承保大单.sql
ZB_DM/承保指标/ZB_DM_车险承保大单.sql
+40
-28
ZB_DM/承保指标/ZB_DM_非车险今日签单保费.sql
ZB_DM/承保指标/ZB_DM_非车险今日签单保费.sql
+12
-5
ZB_DM/承保指标/ZB_DM_非车险承保大单.sql
ZB_DM/承保指标/ZB_DM_非车险承保大单.sql
+38
-26
No files found.
ZB_DM/承保指标/ZB_DM_今日签单今年待起保保费.sql
View file @
9c6e3688
...
@@ -13,10 +13,16 @@ SELECT
...
@@ -13,10 +13,16 @@ SELECT
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
s1
from
(
where
select
s1
.
`COMNAME`
is
not
null
*
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
,
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'
)
and
left
(
s1
.
`startTime`
,
4
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
)
group
by
group
by
s1
.
`uwConclueDate`
s1
.
`uwConclueDate`
...
...
ZB_DM/承保指标/ZB_DM_今日签单今日待起保保费.sql
View file @
9c6e3688
...
@@ -13,10 +13,16 @@ SELECT
...
@@ -13,10 +13,16 @@ SELECT
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
s1
from
(
where
select
s1
.
`COMNAME`
is
not
null
*
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
,
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'
)
and
left
(
s1
.
`startTime`
,
8
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
group
by
group
by
s1
.
`uwConclueDate`
s1
.
`uwConclueDate`
...
...
ZB_DM/承保指标/ZB_DM_今日签单保费.sql
View file @
9c6e3688
...
@@ -7,23 +7,28 @@
...
@@ -7,23 +7,28 @@
-- step1:
-- step1:
-- 团队汇总
-- 团队汇总
CREATE
TEMPORARY
VIEW
VIEW_ZB_DM_JRQDBF_TUANDUI
AS
CREATE
TEMPORARY
VIEW
VIEW_ZB_DM_JRQDBF_TUANDUI
AS
SELECT
SELECT
s1
.
`uwConclueDate`
as
`uwConclueDate`
s1
.
`uwConclueDate`
as
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
as
`LEVEL1COMCODE`
,
s1
.
`LEVEL1COMCODE`
as
`LEVEL1COMCODE`
,
s1
.
`LEVEL2COMCODE`
as
`LEVEL2COMCODE`
,
s1
.
`LEVEL2COMCODE`
as
`LEVEL2COMCODE`
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
(
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
s1
select
where
*
s1
.
`COMNAME`
is
not
null
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`uwConclueDate`
DESC
)
as
rownum
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
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
group
by
s1
.
`uwConclueDate`
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
,
s1
.
`LEVEL1COMCODE`
,
s1
.
`LEVEL2COMCODE`
,
s1
.
`LEVEL2COMCODE`
,
s1
.
`LEVEL3COMCODE`
,
s1
.
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
,
s1
.
`LEVEL4COMCODE`
;
;
-- 总公司
-- 总公司
...
...
ZB_DM/承保指标/ZB_DM_今日签单季度末待起保保费.sql
View file @
9c6e3688
...
@@ -13,10 +13,16 @@ SELECT
...
@@ -13,10 +13,16 @@ SELECT
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
s1
from
(
where
select
s1
.
`COMNAME`
is
not
null
*
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
,
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'
)
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
(
'04'
,
'05'
,
'06'
)
THEN
left
(
s1
.
`startTime`
,
6
)
<=
CONCAT
(
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
),
'06'
)
...
@@ -99,7 +105,7 @@ select
...
@@ -99,7 +105,7 @@ select
'teamquarterqdbf/'
'teamquarterqdbf/'
,
s1
.
`uwConclueDate`
,
s1
.
`uwConclueDate`
)
as
`key`
)
as
`key`
,
s1
.
`LEVEL
1
COMCODE`
as
`hkey`
,
s1
.
`LEVEL
4
COMCODE`
as
`hkey`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
from
VIEW_ZB_DM_JRQDJDMQBBF_TUANDUI
s1
from
VIEW_ZB_DM_JRQDJDMQBBF_TUANDUI
s1
;
;
...
...
ZB_DM/承保指标/ZB_DM_今日签单月底前起保保费.sql
View file @
9c6e3688
...
@@ -13,10 +13,16 @@ SELECT
...
@@ -13,10 +13,16 @@ SELECT
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
s1
from
(
where
select
s1
.
`COMNAME`
is
not
null
*
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
,
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'
)
and
left
(
s1
.
`startTime`
,
6
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMM'
)
group
by
group
by
s1
.
`uwConclueDate`
s1
.
`uwConclueDate`
...
@@ -94,7 +100,7 @@ select
...
@@ -94,7 +100,7 @@ select
'teammonthqbbf/'
'teammonthqbbf/'
,
s1
.
`uwConclueDate`
,
s1
.
`uwConclueDate`
)
as
`key`
)
as
`key`
,
s1
.
`LEVEL
1
COMCODE`
as
`hkey`
,
s1
.
`LEVEL
4
COMCODE`
as
`hkey`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
from
VIEW_ZB_DM_JRQDYDQQBBF_TUANDUI
s1
from
VIEW_ZB_DM_JRQDYDQQBBF_TUANDUI
s1
;
;
...
...
ZB_DM/承保指标/ZB_DM_分业务来源季末前起保保费.sql
View file @
9c6e3688
...
@@ -14,10 +14,16 @@ SELECT
...
@@ -14,10 +14,16 @@ SELECT
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
s1
from
(
where
select
s1
.
`COMNAME`
is
not
null
*
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
,
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'
)
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
(
'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'
)
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,10 +14,16 @@ SELECT
...
@@ -14,10 +14,16 @@ SELECT
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
s1
from
(
where
select
s1
.
`COMNAME`
is
not
null
*
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
,
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'
)
and
left
(
s1
.
`startTime`
,
4
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
)
group
by
group
by
s1
.
`uwConclueDate`
s1
.
`uwConclueDate`
...
...
ZB_DM/承保指标/ZB_DM_分业务来源当日签单当日起保保费.sql
View file @
9c6e3688
...
@@ -14,10 +14,16 @@ SELECT
...
@@ -14,10 +14,16 @@ SELECT
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
s1
from
(
where
select
s1
.
`COMNAME`
is
not
null
*
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
,
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'
)
and
left
(
s1
.
`startTime`
,
8
)
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
group
by
group
by
s1
.
`uwConclueDate`
s1
.
`uwConclueDate`
...
...
ZB_DM/承保指标/ZB_DM_分业务来源月底前起保保费.sql
View file @
9c6e3688
...
@@ -14,10 +14,16 @@ SELECT
...
@@ -14,10 +14,16 @@ SELECT
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
s1
from
(
where
select
s1
.
`COMNAME`
is
not
null
*
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
,
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'
)
and
left
(
s1
.
`startTime`
,
6
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMM'
)
group
by
group
by
s1
.
`uwConclueDate`
s1
.
`uwConclueDate`
...
...
ZB_DM/承保指标/ZB_DM_分渠道保费.sql
View file @
9c6e3688
...
@@ -14,10 +14,16 @@ SELECT
...
@@ -14,10 +14,16 @@ SELECT
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
s1
from
(
where
select
s1
.
`COMNAME`
is
not
null
*
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
,
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'
)
and
left
(
s1
.
`startTime`
,
4
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
)
group
by
group
by
...
...
ZB_DM/承保指标/ZB_DM_分险类保费.sql
View file @
9c6e3688
...
@@ -8,21 +8,27 @@
...
@@ -8,21 +8,27 @@
CREATE
TEMPORARY
VIEW
VIEW_ZB_DM_FXLBF_TUANDUI
AS
CREATE
TEMPORARY
VIEW
VIEW_ZB_DM_FXLBF_TUANDUI
AS
SELECT
SELECT
s1
.
`uwConclueDate`
as
`uwConclueDate`
s1
.
`uwConclueDate`
as
`uwConclueDate`
,
s1
.
`
risk`
as
`risk
`
,
s1
.
`
classcode`
as
`classcode
`
,
s1
.
`LEVEL1COMCODE`
as
`LEVEL1COMCODE`
,
s1
.
`LEVEL1COMCODE`
as
`LEVEL1COMCODE`
,
s1
.
`LEVEL2COMCODE`
as
`LEVEL2COMCODE`
,
s1
.
`LEVEL2COMCODE`
as
`LEVEL2COMCODE`
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
s1
from
(
where
select
s1
.
`COMNAME`
is
not
null
*
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
,
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'
)
and
left
(
s1
.
`startTime`
,
4
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
)
group
by
group
by
s1
.
`uwConclueDate`
s1
.
`uwConclueDate`
,
s1
.
`
risk
`
,
s1
.
`
classcode
`
,
s1
.
`LEVEL1COMCODE`
,
s1
.
`LEVEL1COMCODE`
,
s1
.
`LEVEL2COMCODE`
,
s1
.
`LEVEL2COMCODE`
,
s1
.
`LEVEL3COMCODE`
,
s1
.
`LEVEL3COMCODE`
...
@@ -36,12 +42,12 @@ select
...
@@ -36,12 +42,12 @@ select
'allxlbf/'
'allxlbf/'
,
s1
.
`uwConclueDate`
,
s1
.
`uwConclueDate`
)
as
`key`
)
as
`key`
,
s1
.
`
risk`
as
`hkey`
,
s1
.
`
classcode`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_FXLBF_TUANDUI
s1
from
VIEW_ZB_DM_FXLBF_TUANDUI
s1
group
by
group
by
s1
.
`uwConclueDate`
s1
.
`uwConclueDate`
,
s1
.
`
risk
`
,
s1
.
`
classcode
`
;
;
...
@@ -53,12 +59,12 @@ select
...
@@ -53,12 +59,12 @@ select
,
s1
.
`uwConclueDate`
,
s1
.
`uwConclueDate`
,
'/'
,
s1
.
`LEVEL1COMCODE`
,
'/'
,
s1
.
`LEVEL1COMCODE`
)
as
`key`
)
as
`key`
,
s1
.
`
risk`
as
`hkey`
,
s1
.
`
classcode`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_FXLBF_TUANDUI
s1
from
VIEW_ZB_DM_FXLBF_TUANDUI
s1
group
by
group
by
s1
.
`uwConclueDate`
s1
.
`uwConclueDate`
,
s1
.
`
risk
`
,
s1
.
`
classcode
`
,
s1
.
`LEVEL1COMCODE`
,
s1
.
`LEVEL1COMCODE`
;
;
...
@@ -70,12 +76,12 @@ select
...
@@ -70,12 +76,12 @@ select
,
s1
.
`uwConclueDate`
,
s1
.
`uwConclueDate`
,
'/'
,
s1
.
`LEVEL2COMCODE`
,
'/'
,
s1
.
`LEVEL2COMCODE`
)
as
`key`
)
as
`key`
,
s1
.
`
risk`
as
`hkey`
,
s1
.
`
classcode`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_FXLBF_TUANDUI
s1
from
VIEW_ZB_DM_FXLBF_TUANDUI
s1
group
by
group
by
s1
.
`uwConclueDate`
s1
.
`uwConclueDate`
,
s1
.
`
risk
`
,
s1
.
`
classcode
`
,
s1
.
`LEVEL2COMCODE`
,
s1
.
`LEVEL2COMCODE`
;
;
...
@@ -87,12 +93,12 @@ select
...
@@ -87,12 +93,12 @@ select
,
s1
.
`uwConclueDate`
,
s1
.
`uwConclueDate`
,
'/'
,
s1
.
`LEVEL3COMCODE`
,
'/'
,
s1
.
`LEVEL3COMCODE`
)
as
`key`
)
as
`key`
,
s1
.
`
risk`
as
`hkey`
,
s1
.
`
classcode`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_FXLBF_TUANDUI
s1
from
VIEW_ZB_DM_FXLBF_TUANDUI
s1
group
by
group
by
s1
.
`uwConclueDate`
s1
.
`uwConclueDate`
,
s1
.
`
risk
`
,
s1
.
`
classcode
`
,
s1
.
`LEVEL3COMCODE`
,
s1
.
`LEVEL3COMCODE`
;
;
...
@@ -104,7 +110,7 @@ select
...
@@ -104,7 +110,7 @@ select
,
s1
.
`uwConclueDate`
,
s1
.
`uwConclueDate`
,
'/'
,
s1
.
`LEVEL4COMCODE`
,
'/'
,
s1
.
`LEVEL4COMCODE`
)
as
`key`
)
as
`key`
,
s1
.
`
risk`
as
`hkey`
,
s1
.
`
classcode`
as
`hkey`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
from
VIEW_ZB_DM_FXLBF_TUANDUI
s1
from
VIEW_ZB_DM_FXLBF_TUANDUI
s1
;
;
\ No newline at end of file
ZB_DM/承保指标/ZB_DM_归属业务人员当日签单保费排名.sql
View file @
9c6e3688
...
@@ -3,6 +3,34 @@
...
@@ -3,6 +3,34 @@
-- allrybf/日期
-- allrybf/日期
-- 取TOP20
-- 取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
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_VARCHAR
select
select
...
@@ -16,7 +44,7 @@ select
...
@@ -16,7 +44,7 @@ select
,
'comname'
,
':'
,
`comname`
,
','
,
'comname'
,
':'
,
`comname`
,
','
,
'id'
,
':'
,
`id`
,
','
,
'id'
,
':'
,
`id`
,
','
,
'name'
,
':'
,
`name`
,
','
,
'name'
,
':'
,
`name`
,
','
,
'cost'
,
':'
,
`cost`
,
'cost'
,
':'
,
cast
(
s1
.
`cost`
AS
VARCHAR
)
),
';'
)
),
';'
)
)
as
`val`
)
as
`val`
from
(
from
(
...
@@ -30,7 +58,7 @@ from (
...
@@ -30,7 +58,7 @@ from (
,
d1
.
`LEVEL1COMDESC`
as
`comname`
,
d1
.
`LEVEL1COMDESC`
as
`comname`
,
d1
.
`id`
as
`id`
,
d1
.
`id`
as
`id`
,
d1
.
`name`
as
`name`
,
d1
.
`name`
as
`name`
,
cast
(
d1
.
`cost`
AS
VARCHAR
)
as
`cost`
,
d1
.
`cost`
as
`cost`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`uwConclueDate`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`uwConclueDate`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
from
(
from
(
select
select
...
@@ -40,10 +68,7 @@ from (
...
@@ -40,10 +68,7 @@ from (
,
`id`
as
`id`
,
`id`
as
`id`
,
`name`
as
`name`
,
`name`
as
`name`
,
sum
(
cast
(
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
,
sum
(
cast
(
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
from
VIEW_ZB_DM_GSYWRNQNBFPM
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
group
by
group
by
`uwConclueDate`
`uwConclueDate`
,
`LEVEL1COMCODE`
,
`LEVEL1COMCODE`
...
@@ -53,10 +78,7 @@ from (
...
@@ -53,10 +78,7 @@ from (
)
d1
)
d1
)
c1
)
c1
where
c1
.
rownum
<=
20
where
c1
.
rownum
<=
20
ORDER
by
)
s1
c1
.
`cost`
asc
)
s1
group
by
group
by
s1
.
`uwConclueDate`
s1
.
`uwConclueDate`
;
;
...
@@ -64,7 +86,7 @@ group by
...
@@ -64,7 +86,7 @@ group by
-- 分公司
-- 分公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
H
SET_VARCHAR
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_VARCHAR
select
select
CONCAT
(
CONCAT
(
'provrybf/'
'provrybf/'
...
@@ -79,7 +101,7 @@ select
...
@@ -79,7 +101,7 @@ select
,
'cityname'
,
':'
,
`cityname`
,
','
,
'cityname'
,
':'
,
`cityname`
,
','
,
'id'
,
':'
,
`id`
,
','
,
'id'
,
':'
,
`id`
,
','
,
'name'
,
':'
,
`name`
,
','
,
'name'
,
':'
,
`name`
,
','
,
'cost'
,
':'
,
`cost`
,
'cost'
,
':'
,
cast
(
s1
.
`cost`
AS
VARCHAR
)
),
';'
)
),
';'
)
)
as
`val`
)
as
`val`
from
(
from
(
...
@@ -95,7 +117,7 @@ from (
...
@@ -95,7 +117,7 @@ from (
,
d1
.
`LEVEL2COMDESC`
as
`cityname`
,
d1
.
`LEVEL2COMDESC`
as
`cityname`
,
d1
.
`id`
as
`id`
,
d1
.
`id`
as
`id`
,
d1
.
`name`
as
`name`
,
d1
.
`name`
as
`name`
,
cast
(
d1
.
`cost`
AS
VARCHAR
)
as
`cost`
,
d1
.
`cost`
as
`cost`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`uwConclueDate`
,
d1
.
`LEVEL1COMCODE`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`uwConclueDate`
,
d1
.
`LEVEL1COMCODE`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
from
(
from
(
select
select
...
@@ -107,10 +129,7 @@ from (
...
@@ -107,10 +129,7 @@ from (
,
`id`
as
`id`
,
`id`
as
`id`
,
`name`
as
`name`
,
`name`
as
`name`
,
sum
(
cast
(
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
,
sum
(
cast
(
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
from
VIEW_ZB_DM_GSYWRNQNBFPM
a1
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
group
by
group
by
`uwConclueDate`
`uwConclueDate`
,
`LEVEL1COMCODE`
,
`LEVEL1COMCODE`
...
@@ -122,10 +141,7 @@ from (
...
@@ -122,10 +141,7 @@ from (
)
d1
)
d1
)
c1
)
c1
where
c1
.
rownum
<=
20
where
c1
.
rownum
<=
20
ORDER
by
)
s1
c1
.
`cost`
asc
)
s1
group
by
group
by
s1
.
`uwConclueDate`
s1
.
`uwConclueDate`
,
s1
.
`group_com`
,
s1
.
`group_com`
...
@@ -133,7 +149,7 @@ group by
...
@@ -133,7 +149,7 @@ group by
-- 中支
-- 中支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
H
SET_VARCHAR
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_VARCHAR
select
select
CONCAT
(
CONCAT
(
'cityrybf/'
'cityrybf/'
...
@@ -150,7 +166,7 @@ select
...
@@ -150,7 +166,7 @@ select
,
'countryname'
,
':'
,
`countryname`
,
','
,
'countryname'
,
':'
,
`countryname`
,
','
,
'id'
,
':'
,
`id`
,
','
,
'id'
,
':'
,
`id`
,
','
,
'name'
,
':'
,
`name`
,
','
,
'name'
,
':'
,
`name`
,
','
,
'cost'
,
':'
,
`cost`
,
'cost'
,
':'
,
cast
(
s1
.
`cost`
AS
VARCHAR
)
),
';'
)
),
';'
)
)
as
`val`
)
as
`val`
from
(
from
(
...
@@ -168,7 +184,7 @@ from (
...
@@ -168,7 +184,7 @@ from (
,
d1
.
`LEVEL3COMDESC`
as
`countryname`
,
d1
.
`LEVEL3COMDESC`
as
`countryname`
,
d1
.
`id`
as
`id`
,
d1
.
`id`
as
`id`
,
d1
.
`name`
as
`name`
,
d1
.
`name`
as
`name`
,
cast
(
d1
.
`cost`
AS
VARCHAR
)
as
`cost`
,
d1
.
`cost`
as
`cost`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`uwConclueDate`
,
d1
.
`LEVEL2COMCODE`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`uwConclueDate`
,
d1
.
`LEVEL2COMCODE`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
from
(
from
(
select
select
...
@@ -182,10 +198,7 @@ from (
...
@@ -182,10 +198,7 @@ from (
,
`id`
as
`id`
,
`id`
as
`id`
,
`name`
as
`name`
,
`name`
as
`name`
,
sum
(
cast
(
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
,
sum
(
cast
(
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
from
VIEW_ZB_DM_GSYWRNQNBFPM
a1
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
group
by
group
by
`uwConclueDate`
`uwConclueDate`
,
`LEVEL1COMCODE`
,
`LEVEL1COMCODE`
...
@@ -199,10 +212,7 @@ from (
...
@@ -199,10 +212,7 @@ from (
)
d1
)
d1
)
c1
)
c1
where
c1
.
rownum
<=
20
where
c1
.
rownum
<=
20
ORDER
by
)
s1
c1
.
`cost`
asc
)
s1
group
by
group
by
s1
.
`uwConclueDate`
s1
.
`uwConclueDate`
,
s1
.
`group_com`
,
s1
.
`group_com`
...
...
ZB_DM/承保指标/ZB_DM_新续转保单保费.sql
View file @
9c6e3688
...
@@ -13,10 +13,16 @@ SELECT
...
@@ -13,10 +13,16 @@ SELECT
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
s1
from
(
where
select
s1
.
`COMNAME`
is
not
null
*
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
,
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
s1
.
`xxzflag`
=
'1'
group
by
group
by
s1
.
`uwConclueDate`
s1
.
`uwConclueDate`
...
...
ZB_DM/承保指标/ZB_DM_新续转保单保费季度末前起保.sql
View file @
9c6e3688
...
@@ -15,10 +15,16 @@ SELECT
...
@@ -15,10 +15,16 @@ SELECT
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
s1
from
(
where
select
s1
.
`COMNAME`
is
not
null
*
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
,
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
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'
)
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
...
@@ -14,10 +14,16 @@ SELECT
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
s1
from
(
where
select
s1
.
`COMNAME`
is
not
null
*
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
,
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
s1
.
`xxzflag`
=
'1'
and
left
(
s1
.
`startTime`
,
4
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
)
and
left
(
s1
.
`startTime`
,
4
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
)
...
...
ZB_DM/承保指标/ZB_DM_新续转保单保费当日签单当日起保.sql
View file @
9c6e3688
...
@@ -14,10 +14,16 @@ SELECT
...
@@ -14,10 +14,16 @@ SELECT
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
s1
from
(
where
select
s1
.
`COMNAME`
is
not
null
*
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
,
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
s1
.
`xxzflag`
=
'1'
and
left
(
s1
.
`startTime`
,
8
)
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
left
(
s1
.
`startTime`
,
8
)
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
...
...
ZB_DM/承保指标/ZB_DM_新续转保单保费月底前起保.sql
View file @
9c6e3688
...
@@ -14,10 +14,16 @@ SELECT
...
@@ -14,10 +14,16 @@ SELECT
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
s1
from
(
where
select
s1
.
`COMNAME`
is
not
null
*
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
,
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
s1
.
`xxzflag`
=
'1'
and
left
(
s1
.
`startTime`
,
6
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMM'
)
and
left
(
s1
.
`startTime`
,
6
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMM'
)
...
...
ZB_DM/承保指标/ZB_DM_车险今日签单保费.sql
View file @
9c6e3688
...
@@ -13,10 +13,16 @@ SELECT
...
@@ -13,10 +13,16 @@ SELECT
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
s1
from
(
where
select
s1
.
`COMNAME`
is
not
null
*
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
,
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'
and
left
(
s1
.
risk
,
2
)
=
'05'
group
by
group
by
s1
.
`uwConclueDate`
s1
.
`uwConclueDate`
...
@@ -94,7 +100,7 @@ select
...
@@ -94,7 +100,7 @@ select
'teamcarqdbf/'
'teamcarqdbf/'
,
s1
.
`uwConclueDate`
,
s1
.
`uwConclueDate`
)
as
`key`
)
as
`key`
,
s1
.
`LEVEL
1
COMCODE`
as
`hkey`
,
s1
.
`LEVEL
4
COMCODE`
as
`hkey`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
from
VIEW_ZB_DM_QDBF_CAR_TUANDUI
s1
from
VIEW_ZB_DM_QDBF_CAR_TUANDUI
s1
;
;
\ No newline at end of file
ZB_DM/承保指标/ZB_DM_车险承保大单.sql
View file @
9c6e3688
...
@@ -2,6 +2,38 @@
...
@@ -2,6 +2,38 @@
-- bigcbd/日期
-- bigcbd/日期
-- 核保或者核批时间在今天,按照保费或者未决赔款排序,取前10,车险riskcode 05开头,其他为非车,
-- 核保或者核批时间在今天,按照保费或者未决赔款排序,取前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
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_VARCHAR
select
select
...
@@ -17,7 +49,7 @@ select
...
@@ -17,7 +49,7 @@ select
,
'riskname'
,
':'
,
`riskname`
,
','
,
'riskname'
,
':'
,
`riskname`
,
','
,
'chnl'
,
':'
,
`chnl`
,
','
,
'chnl'
,
':'
,
`chnl`
,
','
,
'chnlname'
,
':'
,
`chnlname`
,
','
,
'chnlname'
,
':'
,
`chnlname`
,
','
,
'cost'
,
':'
,
`cost`
,
','
,
'cost'
,
':'
,
cast
(
`cost`
as
varchar
)
,
','
,
'no'
,
':'
,
`no`
,
'no'
,
':'
,
`no`
),
';'
)
),
';'
)
)
as
`val`
)
as
`val`
...
@@ -36,17 +68,10 @@ from (
...
@@ -36,17 +68,10 @@ from (
,
d1
.
`cost`
as
`cost`
,
d1
.
`cost`
as
`cost`
,
d1
.
`no`
as
`no`
,
d1
.
`no`
as
`no`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`uwConclueDate`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`uwConclueDate`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
d1
from
VIEW_ZB_DM_CXCBDD
d1
where
d1
.
`COMNAME`
is
not
null
and
d1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
LEFT
(
d1
.
`risk`
,
2
)
=
'05'
)
c1
)
c1
where
c1
.
rownum
<=
20
where
c1
.
rownum
<=
20
ORDER
by
)
s1
c1
.
`cost`
asc
)
s1
group
by
group
by
s1
.
`uwConclueDate`
s1
.
`uwConclueDate`
;
;
...
@@ -71,7 +96,7 @@ select
...
@@ -71,7 +96,7 @@ select
,
'riskname'
,
':'
,
`riskname`
,
','
,
'riskname'
,
':'
,
`riskname`
,
','
,
'chnl'
,
':'
,
`chnl`
,
','
,
'chnl'
,
':'
,
`chnl`
,
','
,
'chnlname'
,
':'
,
`chnlname`
,
','
,
'chnlname'
,
':'
,
`chnlname`
,
','
,
'cost'
,
':'
,
`cost`
,
','
,
'cost'
,
':'
,
cast
(
`cost`
as
varchar
)
,
','
,
'no'
,
':'
,
`no`
,
'no'
,
':'
,
`no`
),
';'
)
),
';'
)
)
as
`val`
)
as
`val`
...
@@ -93,17 +118,10 @@ from (
...
@@ -93,17 +118,10 @@ from (
,
d1
.
`cost`
as
`cost`
,
d1
.
`cost`
as
`cost`
,
d1
.
`no`
as
`no`
,
d1
.
`no`
as
`no`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`LEVEL1COMCODE`
,
d1
.
`uwConclueDate`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`LEVEL1COMCODE`
,
d1
.
`uwConclueDate`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
d1
from
VIEW_ZB_DM_CXCBDD
d1
where
d1
.
`COMNAME`
is
not
null
and
d1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
LEFT
(
d1
.
`risk`
,
2
)
=
'05'
)
c1
)
c1
where
c1
.
rownum
<=
20
where
c1
.
rownum
<=
20
ORDER
by
)
s1
c1
.
`cost`
asc
)
s1
group
by
group
by
s1
.
`uwConclueDate`
s1
.
`uwConclueDate`
,
s1
.
`group_com`
,
s1
.
`group_com`
...
@@ -130,7 +148,7 @@ select
...
@@ -130,7 +148,7 @@ select
,
'riskname'
,
':'
,
`riskname`
,
','
,
'riskname'
,
':'
,
`riskname`
,
','
,
'chnl'
,
':'
,
`chnl`
,
','
,
'chnl'
,
':'
,
`chnl`
,
','
,
'chnlname'
,
':'
,
`chnlname`
,
','
,
'chnlname'
,
':'
,
`chnlname`
,
','
,
'cost'
,
':'
,
`cost`
,
','
,
'cost'
,
':'
,
cast
(
`cost`
as
varchar
)
,
','
,
'no'
,
':'
,
`no`
,
'no'
,
':'
,
`no`
),
';'
)
),
';'
)
)
as
`val`
)
as
`val`
...
@@ -154,15 +172,9 @@ from (
...
@@ -154,15 +172,9 @@ from (
,
d1
.
`cost`
as
`cost`
,
d1
.
`cost`
as
`cost`
,
d1
.
`no`
as
`no`
,
d1
.
`no`
as
`no`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`LEVEL2COMCODE`
,
d1
.
`uwConclueDate`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`LEVEL2COMCODE`
,
d1
.
`uwConclueDate`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
d1
from
VIEW_ZB_DM_CXCBDD
d1
where
d1
.
`COMNAME`
is
not
null
and
d1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
LEFT
(
d1
.
`risk`
,
2
)
=
'05'
)
c1
)
c1
where
c1
.
rownum
<=
20
where
c1
.
rownum
<=
20
ORDER
by
c1
.
`cost`
asc
)
s1
)
s1
group
by
group
by
s1
.
`uwConclueDate`
s1
.
`uwConclueDate`
...
...
ZB_DM/承保指标/ZB_DM_非车险今日签单保费.sql
View file @
9c6e3688
...
@@ -13,10 +13,16 @@ SELECT
...
@@ -13,10 +13,16 @@ SELECT
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
s1
from
(
where
select
s1
.
`COMNAME`
is
not
null
*
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
,
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'
and
left
(
s1
.
risk
,
2
)
<>
'05'
group
by
group
by
s1
.
`uwConclueDate`
s1
.
`uwConclueDate`
...
@@ -94,7 +100,7 @@ select
...
@@ -94,7 +100,7 @@ select
'teamnocarqdbf/'
'teamnocarqdbf/'
,
s1
.
`uwConclueDate`
,
s1
.
`uwConclueDate`
)
as
`key`
)
as
`key`
,
s1
.
`LEVEL
1
COMCODE`
as
`hkey`
,
s1
.
`LEVEL
4
COMCODE`
as
`hkey`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
from
VIEW_ZB_DM_QDBF_NOCAR_TUANDUI
s1
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 @@
...
@@ -3,6 +3,38 @@
-- 核保或者核批时间在今天,按照保费或者未决赔款排序,取前10,车险riskcode 05开头,其他为非车,
-- 核保或者核批时间在今天,按照保费或者未决赔款排序,取前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
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_VARCHAR
select
select
...
@@ -18,7 +50,7 @@ select
...
@@ -18,7 +50,7 @@ select
,
'riskname'
,
':'
,
`riskname`
,
','
,
'riskname'
,
':'
,
`riskname`
,
','
,
'chnl'
,
':'
,
`chnl`
,
','
,
'chnl'
,
':'
,
`chnl`
,
','
,
'chnlname'
,
':'
,
`chnlname`
,
','
,
'chnlname'
,
':'
,
`chnlname`
,
','
,
'cost'
,
':'
,
`cost`
,
','
,
'cost'
,
':'
,
cast
(
`cost`
as
varchar
)
,
','
,
'no'
,
':'
,
`no`
,
'no'
,
':'
,
`no`
),
';'
)
),
';'
)
)
as
`val`
)
as
`val`
...
@@ -37,16 +69,9 @@ from (
...
@@ -37,16 +69,9 @@ from (
,
d1
.
`cost`
as
`cost`
,
d1
.
`cost`
as
`cost`
,
d1
.
`no`
as
`no`
,
d1
.
`no`
as
`no`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`uwConclueDate`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`uwConclueDate`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
d1
from
VIEW_ZB_DM_FCXCBDD
d1
where
d1
.
`COMNAME`
is
not
null
and
d1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
LEFT
(
d1
.
`risk`
,
2
)
<>
'05'
)
c1
)
c1
where
c1
.
rownum
<=
20
where
c1
.
rownum
<=
20
ORDER
by
c1
.
`cost`
asc
)
s1
)
s1
group
by
group
by
s1
.
`uwConclueDate`
s1
.
`uwConclueDate`
...
@@ -72,7 +97,7 @@ select
...
@@ -72,7 +97,7 @@ select
,
'riskname'
,
':'
,
`riskname`
,
','
,
'riskname'
,
':'
,
`riskname`
,
','
,
'chnl'
,
':'
,
`chnl`
,
','
,
'chnl'
,
':'
,
`chnl`
,
','
,
'chnlname'
,
':'
,
`chnlname`
,
','
,
'chnlname'
,
':'
,
`chnlname`
,
','
,
'cost'
,
':'
,
`cost`
,
','
,
'cost'
,
':'
,
cast
(
`cost`
as
varchar
)
,
','
,
'no'
,
':'
,
`no`
,
'no'
,
':'
,
`no`
),
';'
)
),
';'
)
)
as
`val`
)
as
`val`
...
@@ -94,16 +119,9 @@ from (
...
@@ -94,16 +119,9 @@ from (
,
d1
.
`cost`
as
`cost`
,
d1
.
`cost`
as
`cost`
,
d1
.
`no`
as
`no`
,
d1
.
`no`
as
`no`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`LEVEL1COMCODE`
,
d1
.
`uwConclueDate`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`LEVEL1COMCODE`
,
d1
.
`uwConclueDate`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
d1
from
VIEW_ZB_DM_FCXCBDD
d1
where
d1
.
`COMNAME`
is
not
null
and
d1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
LEFT
(
d1
.
`risk`
,
2
)
<>
'05'
)
c1
)
c1
where
c1
.
rownum
<=
20
where
c1
.
rownum
<=
20
ORDER
by
c1
.
`cost`
asc
)
s1
)
s1
group
by
group
by
s1
.
`uwConclueDate`
s1
.
`uwConclueDate`
...
@@ -131,7 +149,7 @@ select
...
@@ -131,7 +149,7 @@ select
,
'riskname'
,
':'
,
`riskname`
,
','
,
'riskname'
,
':'
,
`riskname`
,
','
,
'chnl'
,
':'
,
`chnl`
,
','
,
'chnl'
,
':'
,
`chnl`
,
','
,
'chnlname'
,
':'
,
`chnlname`
,
','
,
'chnlname'
,
':'
,
`chnlname`
,
','
,
'cost'
,
':'
,
`cost`
,
','
,
'cost'
,
':'
,
cast
(
`cost`
as
varchar
)
,
','
,
'no'
,
':'
,
`no`
,
'no'
,
':'
,
`no`
),
';'
)
),
';'
)
)
as
`val`
)
as
`val`
...
@@ -155,15 +173,9 @@ from (
...
@@ -155,15 +173,9 @@ from (
,
d1
.
`cost`
as
`cost`
,
d1
.
`cost`
as
`cost`
,
d1
.
`no`
as
`no`
,
d1
.
`no`
as
`no`
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`LEVEL2COMCODE`
,
d1
.
`uwConclueDate`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`LEVEL2COMCODE`
,
d1
.
`uwConclueDate`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
d1
from
VIEW_ZB_DM_FCXCBDD
d1
where
d1
.
`COMNAME`
is
not
null
and
d1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
LEFT
(
d1
.
`risk`
,
2
)
<>
'05'
)
c1
)
c1
where
c1
.
rownum
<=
20
where
c1
.
rownum
<=
20
ORDER
by
c1
.
`cost`
asc
)
s1
)
s1
group
by
group
by
s1
.
`uwConclueDate`
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