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
b1567b79
Commit
b1567b79
authored
Aug 01, 2022
by
王东
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调整指标计算目标表
parent
1961b640
Changes
36
Show whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
927 additions
and
95 deletions
+927
-95
RZ_DM/RZ_DM_QUANTILE(方案二).sql
RZ_DM/RZ_DM_QUANTILE(方案二).sql
+0
-1
ZB_DM/DDL通用元数据/HSET_DECIMAL.sql
ZB_DM/DDL通用元数据/HSET_DECIMAL.sql
+0
-0
ZB_DM/DDL通用元数据/HSET_VARCHAR.sql
ZB_DM/DDL通用元数据/HSET_VARCHAR.sql
+0
-0
ZB_DM/DDL通用元数据/SET_DECIMAL.sql
ZB_DM/DDL通用元数据/SET_DECIMAL.sql
+0
-0
ZB_DM/DDL通用元数据/SET_VARCHAR.sql
ZB_DM/DDL通用元数据/SET_VARCHAR.sql
+0
-0
ZB_DM/DDL通用元数据/history_ddl.sql
ZB_DM/DDL通用元数据/history_ddl.sql
+0
-0
ZB_DM/承保指标/ZB_DM_今日签单今年待起保保费.sql
ZB_DM/承保指标/ZB_DM_今日签单今年待起保保费.sql
+4
-6
ZB_DM/承保指标/ZB_DM_今日签单今日待起保保费.sql
ZB_DM/承保指标/ZB_DM_今日签单今日待起保保费.sql
+4
-6
ZB_DM/承保指标/ZB_DM_今日签单保费.sql
ZB_DM/承保指标/ZB_DM_今日签单保费.sql
+3
-3
ZB_DM/承保指标/ZB_DM_今日签单季度末待起保保费.sql
ZB_DM/承保指标/ZB_DM_今日签单季度末待起保保费.sql
+9
-6
ZB_DM/承保指标/ZB_DM_今日签单月底前起保保费.sql
ZB_DM/承保指标/ZB_DM_今日签单月底前起保保费.sql
+3
-5
ZB_DM/承保指标/ZB_DM_分业务来源季末前起保保费.sql
ZB_DM/承保指标/ZB_DM_分业务来源季末前起保保费.sql
+3
-5
ZB_DM/承保指标/ZB_DM_分业务来源年底前起保保费.sql
ZB_DM/承保指标/ZB_DM_分业务来源年底前起保保费.sql
+3
-5
ZB_DM/承保指标/ZB_DM_分业务来源当日签单当日起保保费.sql
ZB_DM/承保指标/ZB_DM_分业务来源当日签单当日起保保费.sql
+4
-6
ZB_DM/承保指标/ZB_DM_分业务来源月底前起保保费.sql
ZB_DM/承保指标/ZB_DM_分业务来源月底前起保保费.sql
+3
-5
ZB_DM/承保指标/ZB_DM_分渠道保费.sql
ZB_DM/承保指标/ZB_DM_分渠道保费.sql
+4
-4
ZB_DM/承保指标/ZB_DM_分险类保费.sql
ZB_DM/承保指标/ZB_DM_分险类保费.sql
+4
-5
ZB_DM/承保指标/ZB_DM_归属业务人员当日签单保费排名.sql
ZB_DM/承保指标/ZB_DM_归属业务人员当日签单保费排名.sql
+210
-0
ZB_DM/承保指标/ZB_DM_新续转保单保费.sql
ZB_DM/承保指标/ZB_DM_新续转保单保费.sql
+99
-0
ZB_DM/承保指标/ZB_DM_新续转保单保费季度末前起保.sql
ZB_DM/承保指标/ZB_DM_新续转保单保费季度末前起保.sql
+107
-0
ZB_DM/承保指标/ZB_DM_新续转保单保费年底前起保.sql
ZB_DM/承保指标/ZB_DM_新续转保单保费年底前起保.sql
+102
-0
ZB_DM/承保指标/ZB_DM_新续转保单保费当日签单当日起保.sql
ZB_DM/承保指标/ZB_DM_新续转保单保费当日签单当日起保.sql
+100
-0
ZB_DM/承保指标/ZB_DM_新续转保单保费月底前起保.sql
ZB_DM/承保指标/ZB_DM_新续转保单保费月底前起保.sql
+102
-0
ZB_DM/承保指标/ZB_DM_车险今日签单保费.sql
ZB_DM/承保指标/ZB_DM_车险今日签单保费.sql
+3
-5
ZB_DM/承保指标/ZB_DM_车险承保大单.sql
ZB_DM/承保指标/ZB_DM_车险承保大单.sql
+19
-7
ZB_DM/承保指标/ZB_DM_非车险今日签单保费.sql
ZB_DM/承保指标/ZB_DM_非车险今日签单保费.sql
+3
-5
ZB_DM/承保指标/ZB_DM_非车险承保大单.sql
ZB_DM/承保指标/ZB_DM_非车险承保大单.sql
+31
-15
ZB_ODS/(test) ZB_ODS_ENDOR.sql
ZB_ODS/(test) ZB_ODS_ENDOR.sql
+0
-0
ZB_ODS/(test) ZB_ODS_POLICY.sql
ZB_ODS/(test) ZB_ODS_POLICY.sql
+0
-0
ZB_ODS/DDL元数据/(test) ENDOR.sql
ZB_ODS/DDL元数据/(test) ENDOR.sql
+5
-1
ZB_ODS/DDL元数据/(test) POLICY.sql
ZB_ODS/DDL元数据/(test) POLICY.sql
+0
-0
ZB_ODS/DDL元数据/CBDATA.sql
ZB_ODS/DDL元数据/CBDATA.sql
+8
-3
ZB_ODS/DDL元数据/CD_BUSINESSNATURE.sql
ZB_ODS/DDL元数据/CD_BUSINESSNATURE.sql
+9
-0
ZB_ODS/DDL元数据/CD_COM_ALL.sql
ZB_ODS/DDL元数据/CD_COM_ALL.sql
+1
-1
ZB_ODS/DDL元数据/CD_NEWCHNLTYPE.sql
ZB_ODS/DDL元数据/CD_NEWCHNLTYPE.sql
+1
-1
ZB_ODS/ZB_ODS_CBDATA.sql
ZB_ODS/ZB_ODS_CBDATA.sql
+83
-0
No files found.
RZ_DM/RZ_DM_QUANTILE(方案二).sql
View file @
b1567b79
-- RZ_DM_QUANTILE ZB_DM_单位时间内访问时间排序
-- QUANTILE_AGENTID 单位时间内访问时间排序按应用统计
insert
into
RZ_DM
.
RZ_DM_MYSQL
.
QUANTILE_AGENTID
SELECT
...
...
ZB_DM/DDL元数据/HSET_DECIMAL.sql
→
ZB_DM/DDL
通用
元数据/HSET_DECIMAL.sql
View file @
b1567b79
File moved
ZB_DM/DDL元数据/HSET_VARCHAR.sql
→
ZB_DM/DDL
通用
元数据/HSET_VARCHAR.sql
View file @
b1567b79
File moved
ZB_DM/DDL元数据/SET_DECIMAL.sql
→
ZB_DM/DDL
通用
元数据/SET_DECIMAL.sql
View file @
b1567b79
File moved
ZB_DM/DDL元数据/SET_VARCHAR.sql
→
ZB_DM/DDL
通用
元数据/SET_VARCHAR.sql
View file @
b1567b79
File moved
ZB_DM/DDL元数据/history_ddl.sql
→
ZB_DM/DDL
通用
元数据/history_ddl.sql
View file @
b1567b79
File moved
ZB_DM/
ZB_DM_今日签单今年
起保保费.sql
→
ZB_DM/
承保指标/ZB_DM_今日签单今年待
起保保费.sql
View file @
b1567b79
-- ZB_DM_JRQDJNQBBF ZB_DM_今日签单今年起保保费
-- ZB_DM_JRQDJNQBBF ZB_DM_今日签单今年
待
起保保费
-- key:allqbbf/日期
-- 1. 保单的时间口径为: 核保时间在今天并且起保时间的年份小于等于今年
-- 2. 批单的时间口径为: 核批通过时间在今天并且核批生效时间的年份小于等于今年。
-- 1、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 2、起保时间小于等于当年
-- step1:
-- 团队汇总
...
...
@@ -14,11 +13,10 @@ 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
.
ZBD
ATA
s1
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CB
ATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
-- 起保时间的年份小于等于今年
and
left
(
s1
.
`startTime`
,
4
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
)
group
by
s1
.
`uwConclueDate`
...
...
ZB_DM/
ZB_DM_今日签单今日
起保保费.sql
→
ZB_DM/
承保指标/ZB_DM_今日签单今日待
起保保费.sql
View file @
b1567b79
-- ZB_DM_JRQDJRQBBF ZB_DM_今日签单今日起保保费
-- ZB_DM_JRQDJRQBBF ZB_DM_今日签单今日
待
起保保费
-- key:alldayqdbf/日期
-- 1. 保单的时间口径为: 核保时间在今天并且起保时间的日份小于等于今日
-- 2. 批单的时间口径为: 核批通过时间在今天并且核批生效时间的日份小于等于今日。
-- 1、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 2、起保时间小于等于当日
-- step1:
-- 团队汇总
...
...
@@ -14,11 +13,10 @@ 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
.
ZBD
ATA
s1
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CB
ATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
-- 起保时间的日份小于等于今日
and
left
(
s1
.
`startTime`
,
8
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
group
by
s1
.
`uwConclueDate`
...
...
ZB_DM/ZB_DM_今日签单保费.sql
→
ZB_DM/
承保指标/
ZB_DM_今日签单保费.sql
View file @
b1567b79
-- ZB_DM_JRQDBF ZB_DM_今日签单保费
-- key:allqdbf/日期
-- 1
. 保单的时间口径为: 核保时间在今天 。
-- 2. 批单的时间口径为: 核批通过时间在今天 。
-- 1
、日期:核保日期或者核批完成日期(yyyyMMdd)
-- step1:
...
...
@@ -14,7 +14,7 @@ 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
.
ZBD
ATA
s1
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CB
ATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
...
...
ZB_DM/
ZB_DM_今日签单季度末
起保保费.sql
→
ZB_DM/
承保指标/ZB_DM_今日签单季度末待
起保保费.sql
View file @
b1567b79
-- ZB_DM_JRQDJDMQBBF ZB_DM_今日签单季度末起保保费
-- ZB_DM_JRQDJDMQBBF ZB_DM_今日签单季度末
待
起保保费
-- key:allquarterqdbf
-- 1. 保单的时间口径为: 核保时间在今天并且起保时间的月份等于季度。
-- 2. 批单的时间口径为: 核批通过时间在今天并且核批生效时间的月份等于季度。
-- 1、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 2、起保时间小于等于当季度
-- step1:
-- 团队汇总
...
...
@@ -14,12 +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
.
ZBD
ATA
s1
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CB
ATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
-- 核保时间在今天并且起保时间的月份小于等于季度。
and
QUARTER
(
TO_DATE
(
left
(
s1
.
`startTime`
,
8
),
'yyyyMMdd'
))
=
QUARTER
(
CURRENT_DATE
)
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'
)
WHEN
DATE_FORMAT
(
LOCALTIMESTAMP
,
'MM'
)
in
(
'10'
,
'11'
,
'12'
)
THEN
left
(
s1
.
`startTime`
,
6
)
<=
CONCAT
(
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
),
'12'
)
END
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
...
...
ZB_DM/ZB_DM_今日签单月底前起保保费.sql
→
ZB_DM/
承保指标/
ZB_DM_今日签单月底前起保保费.sql
View file @
b1567b79
-- ZB_DM_JRQDYDQQBBF ZB_DM_今日签单月底前起保保费
-- key:allmonthqbbf/日期
-- 1. 保单的时间口径为: 核保时间在今天并且起保时间的月份小于等于当月。
-- 2. 批单的时间口径为: 核批通过时间在今天并且核批生效时间的月份小于等于当月。
-- 1、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 2、起保时间小于等于当月
-- step1:
-- 团队汇总
...
...
@@ -14,11 +13,10 @@ 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
.
ZBD
ATA
s1
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CB
ATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
-- 核保时间在今天并且起保时间的月份小于等于当月。
and
left
(
s1
.
`startTime`
,
6
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMM'
)
group
by
s1
.
`uwConclueDate`
...
...
ZB_DM/ZB_DM_分业务来源季末前起保保费.sql
→
ZB_DM/
承保指标/
ZB_DM_分业务来源季末前起保保费.sql
View file @
b1567b79
-- ZB_DM_FYWLYBFJMQQB ZB_DM_分业务来源季末前起保保费
-- key:allquarterywlybf/日期
-- 1. 保单的时间口径为: 核保时间在今天并且起保时间的季度小于等于季度。
-- 2. 批单的时间口径为: 核批通过时间在今天并且核批生效时间的季度小于等于当前季度。
-- 1、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 2、起保时间小于等于当季度
-- step1:
-- 团队汇总
...
...
@@ -15,11 +14,10 @@ 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
.
ZBD
ATA
s1
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CB
ATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
-- 起保时间的季度小于等于当前季度
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
→
ZB_DM/
承保指标/
ZB_DM_分业务来源年底前起保保费.sql
View file @
b1567b79
-- ZB_DM_FYWLYBFNDQQB ZB_DM_分业务来源年底前起保保费
-- key:allywlybf/日期
-- 1. 保单的时间口径为: 核保时间在今天并且起保时间的年份小于等于今年
-- 2. 批单的时间口径为: 核批通过时间在今天并且核批生效时间的年份小于等于今年。
-- 1、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 2、起保时间小于等于当年
-- step1:
-- 团队汇总
...
...
@@ -15,11 +14,10 @@ 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
.
ZBD
ATA
s1
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CB
ATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
-- 起保时间的年份小于等于当年
and
left
(
s1
.
`startTime`
,
4
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
)
group
by
s1
.
`uwConclueDate`
...
...
ZB_DM/ZB_DM_分业务来源当日签单当日起保保费.sql
→
ZB_DM/
承保指标/
ZB_DM_分业务来源当日签单当日起保保费.sql
View file @
b1567b79
-- ZB_DM_FYWLYBFDRQDDRQB ZB_DM_分业务来源当日签单当日起保保费
-- key:alldayywlybf/日期
-- 1. 保单的时间口径为: 核保时间在今天并且起保时间的日份小于等于今日
-- 2. 批单的时间口径为: 核批通过时间在今天并且核批生效时间的日份小于等于今日。
-- 1、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 2、起保时间等于当日
-- step1:
-- 团队汇总
...
...
@@ -15,12 +14,11 @@ 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
.
ZBD
ATA
s1
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CB
ATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
-- 起保时间的日份小于等于今日
and
left
(
s1
.
`startTime`
,
8
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
left
(
s1
.
`startTime`
,
8
)
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
group
by
s1
.
`uwConclueDate`
,
s1
.
`businessNatureCode`
...
...
ZB_DM/ZB_DM_分业务来源月底前起保保费.sql
→
ZB_DM/
承保指标/
ZB_DM_分业务来源月底前起保保费.sql
View file @
b1567b79
-- ZB_DM_FYWLYBFYDQQB ZB_DM_分业务来源月底前起保保费
-- key:allmonthywlybf/日期
-- 1. 保单的时间口径为: 核保时间在今天并且起保时间的月份小于等于当月。
-- 2. 批单的时间口径为: 核批通过时间在今天并且核批生效时间的月份小于等于当月。
-- 1、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 2、起保时间小于等于当月
-- step1:
-- 团队汇总
...
...
@@ -15,11 +14,10 @@ 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
.
ZBD
ATA
s1
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CB
ATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
-- 起保时间的月份小于等于当月
and
left
(
s1
.
`startTime`
,
6
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMM'
)
group
by
s1
.
`uwConclueDate`
...
...
ZB_DM/ZB_DM_分渠道保费.sql
→
ZB_DM/
承保指标/
ZB_DM_分渠道保费.sql
View file @
b1567b79
-- ZB_DM_FQDBF ZB_DM_分渠道保费
-- chnlbf/日期/00000000 渠道代码
-- 1
. 保单的时间口径为: 核保时间在今天并且起保时间的年份小于等于今年
-- 2
. 批单的时间口径为: 核批通过时间在今天并且核批生效时间的年份小于等于今年。
-- 1
、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 2
、起保时间小于等于当年
-- step1:
-- 团队汇总
...
...
@@ -14,12 +14,12 @@ 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
.
ZBD
ATA
s1
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CB
ATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
-- 起保时间的年份小于等于今年
and
left
(
s1
.
`startTime`
,
4
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
)
group
by
s1
.
`uwConclueDate`
,
s1
.
`chnl`
...
...
ZB_DM/ZB_DM_分险类保费.sql
→
ZB_DM/
承保指标/
ZB_DM_分险类保费.sql
View file @
b1567b79
-- ZB_DM_FXLBF ZB_DM_分险类保费
-- allxlbf/日期 险类代码
-- 1. 保单的时间口径为: 核保时间在今天并且起保时间的年份小于等于今年
-- 2. 批单的时间口径为: 核批通过时间在今天并且核批生效时间的年份小于
-- 1、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 2、起保时间小于等于当年
-- step1:
-- 团队汇总
...
...
@@ -15,12 +14,12 @@ 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
.
ZBD
ATA
s1
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CB
ATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
-- 起保时间的年份小于等于今年
and
left
(
s1
.
`startTime`
,
4
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
)
group
by
s1
.
`uwConclueDate`
,
s1
.
`risk`
...
...
ZB_DM/承保指标/ZB_DM_归属业务人员当日签单保费排名.sql
0 → 100644
View file @
b1567b79
-- ZB_DM_GSYWRNQNBFPM ZB_DM_归属业务人员当日签单保费排名
-- allrybf/日期
-- 取TOP20
-- 总公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_VARCHAR
select
CONCAT
(
'allrybf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
CastToJsonArrayUDF
(
listagg
(
concat
(
'com'
,
':'
,
`com`
,
','
,
'comname'
,
':'
,
`comname`
,
','
,
'id'
,
':'
,
`id`
,
','
,
'name'
,
':'
,
`name`
,
','
,
'cost'
,
':'
,
`cost`
),
';'
)
)
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`
,
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
(
`cost`
)
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBATA
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
group
by
s1
.
`uwConclueDate`
;
-- 分公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_VARCHAR
select
CONCAT
(
'provrybf/'
,
s1
.
`uwConclueDate`
,
'/'
,
s1
.
`group_com`
)
as
`key`
,
CastToJsonArrayUDF
(
listagg
(
concat
(
'com'
,
':'
,
`com`
,
','
,
'comname'
,
':'
,
`comname`
,
','
,
'city'
,
':'
,
`city`
,
','
,
'cityname'
,
':'
,
`cityname`
,
','
,
'id'
,
':'
,
`id`
,
','
,
'name'
,
':'
,
`name`
,
','
,
'cost'
,
':'
,
`cost`
),
';'
)
)
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`
,
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
(
`cost`
)
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBATA
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
group
by
s1
.
`uwConclueDate`
,
s1
.
`group_com`
;
-- 中支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_VARCHAR
select
CONCAT
(
'cityrybf/'
,
s1
.
`uwConclueDate`
,
'/'
,
s1
.
`group_com`
)
as
`key`
,
CastToJsonArrayUDF
(
listagg
(
concat
(
'com'
,
':'
,
`com`
,
','
,
'comname'
,
':'
,
`comname`
,
','
,
'city'
,
':'
,
`city`
,
','
,
'cityname'
,
':'
,
`cityname`
,
','
,
'country'
,
':'
,
`country`
,
','
,
'countryname'
,
':'
,
`countryname`
,
','
,
'id'
,
':'
,
`id`
,
','
,
'name'
,
':'
,
`name`
,
','
,
'cost'
,
':'
,
`cost`
),
';'
)
)
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`
,
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
(
`cost`
)
as
`cost`
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBATA
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
group
by
s1
.
`uwConclueDate`
,
s1
.
`group_com`
;
ZB_DM/承保指标/ZB_DM_新续转保单保费.sql
0 → 100644
View file @
b1567b79
-- ZB_DM_XXZBDBF ZB_DM_新续转保单保费
-- key:xxzbf/日期
-- 1、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 2、新续转保得保单
-- step1:
-- 团队汇总
CREATE
TEMPORARY
VIEW
VIEW_ZB_DM_XXZBDBF_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
.
CBATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
s1
.
`xxzflag`
=
'1'
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
,
s1
.
`LEVEL2COMCODE`
,
s1
.
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
;
-- 总公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_DECIMAL
select
CONCAT
(
'xxzbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_XXZBDBF_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
;
-- 分公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'provxxzbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL1COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_XXZBDBF_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
;
-- 中支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'cityxxzbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL2COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_XXZBDBF_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL2COMCODE`
;
-- 县支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'countryxxzbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL3COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_XXZBDBF_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL3COMCODE`
;
-- 团队
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'teamxxzbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL4COMCODE`
as
`hkey`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
from
VIEW_ZB_DM_XXZBDBF_TUANDUI
s1
;
\ No newline at end of file
ZB_DM/承保指标/ZB_DM_新续转保单保费季度末前起保.sql
0 → 100644
View file @
b1567b79
-- ZB_DM_XXZBDBFJDMQQB ZB_DM_新续转保单保费季度末前起保
-- key:xxzquarterbf/日期
-- 1、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 2、新续转保得保单
-- 2、起保时间的季度小于等于当前季度
-- step1:
-- 团队汇总
CREATE
TEMPORARY
VIEW
VIEW_ZB_DM_XXZBDBFJDMQQB_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
.
CBATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
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'
)
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
(
'10'
,
'11'
,
'12'
)
THEN
left
(
s1
.
`startTime`
,
6
)
<=
CONCAT
(
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
),
'12'
)
END
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
,
s1
.
`LEVEL2COMCODE`
,
s1
.
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
;
-- 总公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_DECIMAL
select
CONCAT
(
'xxzquarterbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_XXZBDBFJDMQQB_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
;
-- 分公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'provxxzquarterbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL1COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_XXZBDBFJDMQQB_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
;
-- 中支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'cityxxzquarterbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL2COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_XXZBDBFJDMQQB_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL2COMCODE`
;
-- 县支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'countryxxzquarterbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL3COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_XXZBDBFJDMQQB_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL3COMCODE`
;
-- 团队
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'teamxxzquarterbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL4COMCODE`
as
`hkey`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
from
VIEW_ZB_DM_XXZBDBFJDMQQB_TUANDUI
s1
;
\ No newline at end of file
ZB_DM/承保指标/ZB_DM_新续转保单保费年底前起保.sql
0 → 100644
View file @
b1567b79
-- ZB_DM_XXZBDBFNDQQB ZB_DM_新续转保单保费年底前起保
-- key:xxzyearbf/日期
-- 1、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 2、新续转保得保单
-- 3、起保时间小于等于今年
-- step1:
-- 团队汇总
CREATE
TEMPORARY
VIEW
VIEW_ZB_DM_XXZBDBFNDQQB_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
.
CBATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
s1
.
`xxzflag`
=
'1'
and
left
(
s1
.
`startTime`
,
4
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
)
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
,
s1
.
`LEVEL2COMCODE`
,
s1
.
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
;
-- 总公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_DECIMAL
select
CONCAT
(
'xxzyearbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_XXZBDBFNDQQB_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
;
-- 分公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'provxxzyearbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL1COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_XXZBDBFNDQQB_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
;
-- 中支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'cityxxzyearbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL2COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_XXZBDBFNDQQB_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL2COMCODE`
;
-- 县支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'countryxxzyearbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL3COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_XXZBDBFNDQQB_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL3COMCODE`
;
-- 团队
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'teamxxzyearbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL4COMCODE`
as
`hkey`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
from
VIEW_ZB_DM_XXZBDBFNDQQB_TUANDUI
s1
;
\ No newline at end of file
ZB_DM/承保指标/ZB_DM_新续转保单保费当日签单当日起保.sql
0 → 100644
View file @
b1567b79
-- ZB_DM_XXZBDBFDRQDDRQB ZB_DM_新续转保单保费当日签单当日起保
-- key:xxzdaybf/日期
-- 1、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 2、新续转保得保单
-- 3、起保时间等于今天
-- step1:
-- 团队汇总
CREATE
TEMPORARY
VIEW
VIEW_ZB_DM_XXZBDBFDRQDDRQB_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
.
CBATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
s1
.
`xxzflag`
=
'1'
and
left
(
s1
.
`startTime`
,
8
)
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
,
s1
.
`LEVEL2COMCODE`
,
s1
.
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
;
-- 总公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_DECIMAL
select
CONCAT
(
'xxzdaybf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_XXZBDBFDRQDDRQB_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
;
-- 分公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'provxxzdaybf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL1COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_XXZBDBFDRQDDRQB_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
;
-- 中支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'cityxxzdaybf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL2COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_XXZBDBFDRQDDRQB_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL2COMCODE`
;
-- 县支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'countryxxzdaybf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL3COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_XXZBDBFDRQDDRQB_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL3COMCODE`
;
-- 团队
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'teamxxzdaybf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL4COMCODE`
as
`hkey`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
from
VIEW_ZB_DM_XXZBDBFDRQDDRQB_TUANDUI
s1
ZB_DM/承保指标/ZB_DM_新续转保单保费月底前起保.sql
0 → 100644
View file @
b1567b79
-- ZB_DM_XXZBDBFYDQQBYDQQB ZB_DM_新续转保单保费月底前起保
-- key:xxzmonthbf/日期
-- 1、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 2、新续转保得保单
-- 3、起保时间小于等于当月
-- step1:
-- 团队汇总
CREATE
TEMPORARY
VIEW
VIEW_ZB_DM_XXZBDBFYDQQB_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
.
CBATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
s1
.
`xxzflag`
=
'1'
and
left
(
s1
.
`startTime`
,
6
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMM'
)
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
,
s1
.
`LEVEL2COMCODE`
,
s1
.
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
;
-- 总公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_DECIMAL
select
CONCAT
(
'xxzmonthbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_XXZBDBFYDQQB_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
;
-- 分公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'provxxzmonthbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL1COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_XXZBDBFYDQQB_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
;
-- 中支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'cityxxzmonthbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL2COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_XXZBDBFYDQQB_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL2COMCODE`
;
-- 县支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'countryxxzmonthbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL3COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_XXZBDBFYDQQB_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL3COMCODE`
;
-- 团队
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'teamxxzmonthbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL4COMCODE`
as
`hkey`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
from
VIEW_ZB_DM_XXZBDBFYDQQB_TUANDUI
s1
;
\ No newline at end of file
ZB_DM/ZB_DM_车险今日签单保费.sql
→
ZB_DM/
承保指标/
ZB_DM_车险今日签单保费.sql
View file @
b1567b79
-- ZB_DM_QDBF_CAR/ZB_DM_车险今日签单保费
-- key:allcarqbbf/日期
-- 1. 保单的时间口径为: 核保时间在今天
-- 2. 批单的时间口径为: 核批通过时间在今天
-- 1、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 2、车险
-- step1:
-- 团队汇总
...
...
@@ -14,11 +13,10 @@ 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
.
ZBD
ATA
s1
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CB
ATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
-- 核保时间在今天并且起保时间的月份小于等于当月。
and
left
(
s1
.
risk
,
2
)
=
'05'
group
by
s1
.
`uwConclueDate`
...
...
ZB_DM/ZB_DM_车险承保大单.sql
→
ZB_DM/
承保指标/
ZB_DM_车险承保大单.sql
View file @
b1567b79
...
...
@@ -36,7 +36,7 @@ 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
.
ZBD
ATA
d1
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CB
ATA
d1
where
d1
.
`COMNAME`
is
not
null
and
d1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
...
...
@@ -65,6 +65,8 @@ select
listagg
(
concat
(
'com'
,
':'
,
`com`
,
','
,
'comname'
,
':'
,
`comname`
,
','
,
'city'
,
':'
,
`city`
,
','
,
'cityname'
,
':'
,
`cityname`
,
','
,
'risk'
,
':'
,
`risk`
,
','
,
'riskname'
,
':'
,
`riskname`
,
','
,
'chnl'
,
':'
,
`chnl`
,
','
...
...
@@ -80,8 +82,10 @@ from (
select
d1
.
`uwConclueDate`
as
`uwConclueDate`
,
d1
.
`LEVEL1COMCODE`
as
`group_com`
,
d1
.
`LEVEL2COMCODE`
as
`com`
,
d1
.
`LEVEL2COMDESC`
as
`comname`
,
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`
...
...
@@ -89,7 +93,7 @@ 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
.
ZBD
ATA
d1
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CB
ATA
d1
where
d1
.
`COMNAME`
is
not
null
and
d1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
...
...
@@ -118,6 +122,10 @@ select
listagg
(
concat
(
'com'
,
':'
,
`com`
,
','
,
'comname'
,
':'
,
`comname`
,
','
,
'city'
,
':'
,
`city`
,
','
,
'cityname'
,
':'
,
`cityname`
,
','
,
'country'
,
':'
,
`country`
,
','
,
'countryname'
,
':'
,
`countryname`
,
','
,
'risk'
,
':'
,
`risk`
,
','
,
'riskname'
,
':'
,
`riskname`
,
','
,
'chnl'
,
':'
,
`chnl`
,
','
...
...
@@ -133,8 +141,12 @@ from (
select
d1
.
`uwConclueDate`
as
`uwConclueDate`
,
d1
.
`LEVEL2COMCODE`
as
`group_com`
,
d1
.
`LEVEL3COMCODE`
as
`com`
,
d1
.
`LEVEL3COMDESC`
as
`comname`
,
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`
...
...
@@ -142,7 +154,7 @@ 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
.
ZBD
ATA
d1
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CB
ATA
d1
where
d1
.
`COMNAME`
is
not
null
and
d1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
LEFT
(
d1
.
`risk`
,
2
)
=
'05'
...
...
ZB_DM/ZB_DM_非车险今日签单保费.sql
→
ZB_DM/
承保指标/
ZB_DM_非车险今日签单保费.sql
View file @
b1567b79
-- ZB_DM_QDBF_NOCAR/ZB_DM_非车险今日签单保费
-- key:allnocarqbbf/日期
-- 1. 保单的时间口径为: 核保时间在今天且险种代码不以‘05’开头
-- 2. 批单的时间口径为: 核批通过时间在今天且险种代码不以‘05’开头
-- 1、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 2、非车险
-- step1:
-- 团队汇总
...
...
@@ -14,11 +13,10 @@ 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
.
ZBD
ATA
s1
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CB
ATA
s1
where
s1
.
`COMNAME`
is
not
null
and
s1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
-- 核保时间在今天并且起保时间的月份小于等于当月。
and
left
(
s1
.
risk
,
2
)
<>
'05'
group
by
s1
.
`uwConclueDate`
...
...
ZB_DM/ZB_DM_非车险承保大单.sql
→
ZB_DM/
承保指标/
ZB_DM_非车险承保大单.sql
View file @
b1567b79
...
...
@@ -2,6 +2,7 @@
-- bigfcbd/日期
-- 核保或者核批时间在今天,按照保费或者未决赔款排序,取前10,车险riskcode 05开头,其他为非车,
-- 总公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_VARCHAR
select
...
...
@@ -35,8 +36,8 @@ from (
,
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
.
ZBD
ATA
d1
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
d1
.
`uwConclueDate`
ORDER
BY
d1
.
`cost`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CB
ATA
d1
where
d1
.
`COMNAME`
is
not
null
and
d1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
...
...
@@ -49,7 +50,9 @@ from (
)
s1
group
by
s1
.
`uwConclueDate`
;;
;
-- 分公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_VARCHAR
...
...
@@ -63,6 +66,8 @@ select
listagg
(
concat
(
'com'
,
':'
,
`com`
,
','
,
'comname'
,
':'
,
`comname`
,
','
,
'city'
,
':'
,
`city`
,
','
,
'cityname'
,
':'
,
`cityname`
,
','
,
'risk'
,
':'
,
`risk`
,
','
,
'riskname'
,
':'
,
`riskname`
,
','
,
'chnl'
,
':'
,
`chnl`
,
','
...
...
@@ -74,12 +79,14 @@ select
from
(
select
*
from
(
from
(
select
d1
.
`uwConclueDate`
as
`uwConclueDate`
,
d1
.
`LEVEL1COMCODE`
as
`group_com`
,
d1
.
`LEVEL2COMCODE`
as
`com`
,
d1
.
`LEVEL2COMDESC`
as
`comname`
,
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`
...
...
@@ -87,7 +94,7 @@ 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
.
ZBD
ATA
d1
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CB
ATA
d1
where
d1
.
`COMNAME`
is
not
null
and
d1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
...
...
@@ -101,7 +108,7 @@ from (
group
by
s1
.
`uwConclueDate`
,
s1
.
`group_com`
;
;
;
-- 中支
...
...
@@ -116,6 +123,10 @@ select
listagg
(
concat
(
'com'
,
':'
,
`com`
,
','
,
'comname'
,
':'
,
`comname`
,
','
,
'city'
,
':'
,
`city`
,
','
,
'cityname'
,
':'
,
`cityname`
,
','
,
'country'
,
':'
,
`country`
,
','
,
'countryname'
,
':'
,
`countryname`
,
','
,
'risk'
,
':'
,
`risk`
,
','
,
'riskname'
,
':'
,
`riskname`
,
','
,
'chnl'
,
':'
,
`chnl`
,
','
...
...
@@ -127,11 +138,16 @@ select
from
(
select
*
from
(
select
d1
.
`uwConclueDate`
as
`uwConclueDate`
from
(
select
d1
.
`uwConclueDate`
as
`uwConclueDate`
,
d1
.
`LEVEL2COMCODE`
as
`group_com`
,
d1
.
`LEVEL3COMCODE`
as
`com`
,
d1
.
`LEVEL3COMDESC`
as
`comname`
,
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`
...
...
@@ -139,7 +155,7 @@ 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
.
ZBD
ATA
d1
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CB
ATA
d1
where
d1
.
`COMNAME`
is
not
null
and
d1
.
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
LEFT
(
d1
.
`risk`
,
2
)
<>
'05'
...
...
@@ -152,4 +168,4 @@ from (
group
by
s1
.
`uwConclueDate`
,
s1
.
`group_com`
;;
\ No newline at end of file
;
\ No newline at end of file
ZB_ODS/ZB_ODS_ENDOR.sql
→
ZB_ODS/
(test)
ZB_ODS_ENDOR.sql
View file @
b1567b79
File moved
ZB_ODS/ZB_ODS_POLICY.sql
→
ZB_ODS/
(test)
ZB_ODS_POLICY.sql
View file @
b1567b79
File moved
ZB_ODS/DDL元数据/ENDOR.sql
→
ZB_ODS/DDL元数据/
(test)
ENDOR.sql
View file @
b1567b79
...
...
@@ -32,7 +32,11 @@ ENDOR_PLPENDORSE_PLPCOMMISSIONDETAIL
"recordClerkCode"
:
"411422198909123920"
,
-- 14 归属业务员ID
"recordClerkName"
:
"李琳琳"
,
-- 15 归属业务员名称
"businessChannelCode"
:
"03"
,
-- 27 业务渠道
"businessChannelName"
:
"互动渠道"
-- 28 业务渠道名
"businessChannelName"
:
"互动渠道"
,
-- 28 业务渠道名
"newPolicyFlag"
:
"0"
,
-- 20 新保标识 1:是,0:否
"autoTransrenewFlag"
:
"0"
,
-- 21 自动续保标识 1:是,4:跨险种自动续保,0:否
"transferPolicyFlag"
:
"1"
,
-- 22 转保标识1:是,0:否
"transrenewFlag"
:
"0"
-- 23 续保标识 1:是,4:跨险种续保,0:否
}
...
...
ZB_ODS/DDL元数据/POLICY.sql
→
ZB_ODS/DDL元数据/
(test)
POLICY.sql
View file @
b1567b79
File moved
ZB_ODS/DDL元数据/
Z
BDATA.sql
→
ZB_ODS/DDL元数据/
C
BDATA.sql
View file @
b1567b79
-- ZBDATA 指标加工来源数据
create
table
ZBDATA
(
-- CBATA 承保业务数据
create
table
CBATA
(
`uwConclueDate`
String
,
-- 核保通过时间
`startTime`
String
,
-- 起保时间
`COMCODE`
String
,
-- 保单归属机构代码
...
...
@@ -21,6 +22,9 @@ create table ZBDATA(
`businessNatureCode`
String
,
-- 业务来源
`businessNatureName`
String
,
-- 业务来源名称
`cost`
String
,
-- 含税保费
`no`
String
-- 保单号
`no`
String
,
-- 保单号
`xxzflag`
String
,
-- 新续转标记 1是0否
`id`
String
,
-- 14 归属业务员ID
`name`
String
-- 15 归属业务员名称
)
;
\ No newline at end of file
ZB_ODS/DDL元数据/CD_BUSINESSNATURE.sql
0 → 100644
View file @
b1567b79
-- CD_BUSINESSNATURE 承保业务来源
-- oracle
CREATE
TABLE
CD_BUSINESSNATURE
(
CODE
VARCHAR
(
256
),
CODEDESC
VARCHAR
(
256
),
primary
key
(
CODE
)
);
\ No newline at end of file
ZB_ODS/DDL元数据/CD_COM_ALL.sql
View file @
b1567b79
-- CD_COM_ALL 承保机构码表
-- oracle
CREATE
TABLE
CD_COM_ALL
(
COMCODE
VARCHAR
(
10
)
primary
key
,
COMNAME
VARCHAR
(
128
),
...
...
ZB_ODS/DDL元数据/CD_NEWCHNLTYPE.sql
View file @
b1567b79
-- CD_NEWCHNLTYPE 承保分清后渠道码表
-- 来源数据库:oracle
create
table
CD_NEWCHNLTYPE
(
NEWCHNLTYPE
varchar
(
256
)
not
null
comment
'渠道代码'
...
...
ZB_ODS/ZB_ODS_
Z
BDATA.sql
→
ZB_ODS/ZB_ODS_
C
BDATA.sql
View file @
b1567b79
-- ZB_ODS_
ZBDATA ZB_ODS_指标加工来源
数据
-- ZB_ODS_
CBDATA ZB_ODS_指标加工承保业务
数据
insert
into
ZB_ODS
.
ZB_ODS_KAFKA
.
ZB
DATA
insert
into
ZB_ODS
.
ZB_ODS_KAFKA
.
CD
DATA
select
e1
.
uwConclueDate
as
`uwConclueDate`
,
e1
.
startTime
as
`startTime`
,
e1
.
businessOffice
as
`COMCODE`
,
t1
.
COMNAME
as
`COMNAME`
,
t1
.
LEVEL1COMCODE
as
`LEVEL1COMCODE`
,
t1
.
LEVEL2COMCODE
as
`LEVEL2COMCODE`
,
t1
.
LEVEL3COMCODE
as
`LEVEL3COMCODE`
,
t1
.
LEVEL4COMCODE
as
`LEVEL4COMCODE`
,
t1
.
LEVEL5COMCODE
as
`LEVEL5COMCODE`
,
t1
.
LEVEL1COMDESC
as
`LEVEL1COMDESC`
,
t1
.
LEVEL2COMDESC
as
`LEVEL2COMDESC`
,
t1
.
LEVEL3COMDESC
as
`LEVEL3COMDESC`
,
t1
.
LEVEL4COMDESC
as
`LEVEL4COMDESC`
,
t1
.
LEVEL5COMDESC
as
`LEVEL5COMDESC`
,
e1
.
productCode
as
`risk`
,
t3
.
RISKNAME
as
`riskname`
,
e1
.
businessChannelCode
as
`chnl`
,
e1
.
businessNatureCode
as
`businessNatureCode`
,
t4
.
CODEDESC
as
`businessNatureName`
,
t2
.
NEWCHNLTYPEDESC
as
`chnlname`
,
e1
.
premium
as
`cost`
,
e1
.
policyNo
as
`no`
s1
.
uwConclueDate
as
`uwConclueDate`
-- 核保通过时间
,
s1
.
startTime
as
`startTime`
-- 起保时间
,
s1
.
businessOffice
as
`COMCODE`
--
,
t1
.
COMNAME
as
`COMNAME`
--
,
t1
.
LEVEL1COMCODE
as
`LEVEL1COMCODE`
--
,
t1
.
LEVEL2COMCODE
as
`LEVEL2COMCODE`
--
,
t1
.
LEVEL3COMCODE
as
`LEVEL3COMCODE`
--
,
t1
.
LEVEL4COMCODE
as
`LEVEL4COMCODE`
--
,
t1
.
LEVEL5COMCODE
as
`LEVEL5COMCODE`
--
,
t1
.
LEVEL1COMDESC
as
`LEVEL1COMDESC`
--
,
t1
.
LEVEL2COMDESC
as
`LEVEL2COMDESC`
--
,
t1
.
LEVEL3COMDESC
as
`LEVEL3COMDESC`
--
,
t1
.
LEVEL4COMDESC
as
`LEVEL4COMDESC`
--
,
t1
.
LEVEL5COMDESC
as
`LEVEL5COMDESC`
--
,
s1
.
productCode
as
`risk`
-- 险种代码
,
t3
.
RISKNAME
as
`riskname`
--
,
s1
.
businessChannelCode
as
`chnl`
-- 业务渠道
,
t2
.
NEWCHNLTYPEDESC
as
`chnlname`
--
,
s1
.
businessNatureCode
as
`businessNatureCode`
-- 业务来源
,
t4
.
CODEDESC
as
`businessNatureName`
--
,
s1
.
netPremium
as
`cost`
-- 不含税保费
,
s1
.
policyNo
as
`no`
-- 保单号
,
s1
.
xxzflag
as
xxzflag
-- 新续转标记 1是0否
,
s1
.
recordClerkCode
as
`id`
-- 14 归属业务员ID
,
s1
.
recordClerkName
as
`name`
-- 15 归属业务员名称
from
(
select
LongTimeToStringUDF
(
uwConclue
Date
,
'yyyyMMdd'
)
as
uwConclueDate
-- 核保通过时间
LongTimeToStringUDF
(
policyCreat
Date
,
'yyyyMMdd'
)
as
uwConclueDate
-- 核保通过时间
,
LongTimeToStringUDF
(
startTime
,
'yyyyMMdd'
)
as
startTime
-- 起保时间
,
businessOffice
as
businessOffice
-- 保单归属机构代码
,
productCode
as
productCode
-- 险种代码
,
businessChannelCode
as
businessChannelCode
-- 业务渠道
,
businessNatureCode
as
businessNatureCode
-- 业务来源
,
premium
as
premium
--
含税保费
,
netPremium
as
netPremium
-- 不
含税保费
,
policyNo
as
policyNo
-- 保单号
,
'bd'
as
flag
-- 保单或批单标记
,
proctime
as
proctime
from
ZB_ODS
.
ZB_SOURCE_RMQ_POLICY_SIT
.
POLICY
,
case
when
LEFT
(
productCode
,
2
)
=
'05'
and
(
newPolicyFlag
=
'1'
or
autoTransrenewFlag
=
'1'
or
autoTransrenewFlag
=
'4'
or
transferPolicyFlag
=
'1'
or
transrenewFlag
=
'1'
or
transrenewFlag
=
'4'
)
then
'1'
when
LEFT
(
productCode
,
2
)
<>
'05'
and
(
newPolicyFlag
=
'0'
or
autoTransrenewFlag
=
'1'
or
autoTransrenewFlag
=
'4'
or
transferPolicyFlag
=
'2'
or
transrenewFlag
=
'1'
)
then
'1'
else
'0'
end
as
xxzflag
-- 新续转标记 1是0否
,
recordClerkCode
as
recordClerkCode
-- 14 归属业务员ID
,
recordClerkName
as
recordClerkName
-- 15 归属业务员名称
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
policyNo
,
businessOffice
,
netPremium
ORDER
BY
uwConclueDate
DESC
)
as
rownum
from
ZB_ODS
.
ZB_SOURCE_RMQ_POLICY_SIT
.
POLICY
-- 保单业务数据
where
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
union
all
select
LongTimeToStringUDF
(
uwConclueDate
,
'yyyyMMdd'
)
as
uwConclueDate
-- 核保通过时间
,
LongTimeToStringUDF
(
endorseEffectiveTime
,
'yyyyMMdd'
)
as
startTime
-- 起保时间
LongTimeToStringUDF
(
policyCreatDate
,
'yyyyMMdd'
)
as
uwConclueDate
-- 核保通过时间 ??
,
LongTimeToStringUDF
(
endorseEffectiveTime
,
'yyyyMMdd'
)
as
startTime
-- 起保时间
,
businessOffice
as
businessOffice
-- 保单归属机构代码
,
productCode
as
productCode
-- 险种代码
,
businessChannelCode
as
businessChannelCode
-- 业务渠道
,
businessNatureCode
as
businessNatureCode
-- 业务来源
,
plpEndorse
.
staCur
NetPremiumVariation
as
premium
-- 含税保费
,
endorseNo
as
policyNo
--
保
单号
,
plpEndorse
.
staCur
PremiumVariation
as
netPremium
-- 不含税保费 ??
,
endorseNo
as
policyNo
--
批
单号
,
'pd'
as
flag
-- 保单或批单标记
,
proctime
as
proctime
from
ZB_ODS
.
ZB_SOURCE_RMQ_ENDOR_SIT
.
ENDOR
)
e1
left
join
ZB_ODS
.
ZB_ODS_MYSQL
.
CD_COM_ALL
for
system_time
as
of
e1
.
proctime
as
t1
on
e1
.
businessOffice
=
t1
.
COMCODE
left
join
ZB_ODS
.
ZB_ODS_MYSQL
.
CD_NEWCHNLTYPE
for
system_time
as
of
e1
.
proctime
as
t2
on
e1
.
businessChannelCode
=
t2
.
NEWCHNLTYPE
left
join
ZB_ODS
.
ZB_ODS_MYSQL
.
CD_REALTIME_RISK
for
system_time
as
of
e1
.
proctime
as
t3
on
e1
.
productCode
=
t3
.
RISKCODE
left
join
ZB_ODS
.
ZB_ODS_MYSQL
.
CD_BUSINESSNATURE
for
system_time
as
of
e1
.
proctime
as
t4
on
e1
.
businessNatureCode
=
t4
.
CODE
,
case
when
LEFT
(
productCode
,
2
)
=
'05'
and
(
newPolicyFlag
=
'1'
or
autoTransrenewFlag
=
'1'
or
autoTransrenewFlag
=
'4'
or
transferPolicyFlag
=
'1'
or
transrenewFlag
=
'1'
or
transrenewFlag
=
'4'
)
then
'1'
when
LEFT
(
productCode
,
2
)
<>
'05'
and
(
newPolicyFlag
=
'0'
or
autoTransrenewFlag
=
'1'
or
autoTransrenewFlag
=
'4'
or
transferPolicyFlag
=
'2'
or
transrenewFlag
=
'1'
)
then
'1'
else
'0'
end
as
xxzflag
-- 新续转标记 1是0否
,
recordClerkCode
as
recordClerkCode
-- 14 归属业务员ID
,
recordClerkName
as
recordClerkName
-- 15 归属业务员名称
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
endorseNo
,
businessOffice
,
plpEndorse
.
staCurPremiumVariation
ORDER
BY
uwConclueDate
DESC
)
as
rownum
from
ZB_ODS
.
ZB_SOURCE_RMQ_ENDOR_SIT
.
ENDOR
-- 批单业务数据
where
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
left
join
ZB_ODS
.
ZB_ODS_MYSQL
.
CD_COM_ALL
for
system_time
as
of
s1
.
proctime
as
t1
on
s1
.
businessOffice
=
t1
.
COMCODE
left
join
ZB_ODS
.
ZB_ODS_MYSQL
.
CD_NEWCHNLTYPE
for
system_time
as
of
s1
.
proctime
as
t2
on
s1
.
businessChannelCode
=
t2
.
NEWCHNLTYPE
left
join
ZB_ODS
.
ZB_ODS_MYSQL
.
CD_REALTIME_RISK
for
system_time
as
of
s1
.
proctime
as
t3
on
s1
.
productCode
=
t3
.
RISKCODE
left
join
ZB_ODS
.
ZB_ODS_MYSQL
.
CD_BUSINESSNATURE
for
system_time
as
of
s1
.
proctime
as
t4
on
s1
.
businessNatureCode
=
t4
.
CODE
where
s1
.
rownum
=
1
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment