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
7f31c91b
Commit
7f31c91b
authored
Aug 26, 2022
by
胡涛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
指标统计sql脚本
parent
71122f5b
Changes
11
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
586 additions
and
0 deletions
+586
-0
ZB_DM/承保指标/new分业务来源/ZB_DM_分业务来源合并_NEW.sql
ZB_DM/承保指标/new分业务来源/ZB_DM_分业务来源合并_NEW.sql
+0
-0
ZB_DM/承保指标/new分渠道/ZB_DM_分渠道保费合并_NEW.sql
ZB_DM/承保指标/new分渠道/ZB_DM_分渠道保费合并_NEW.sql
+139
-0
ZB_DM/承保指标/new分险类/ZB_DM_分险类保费合并_NEW.sql
ZB_DM/承保指标/new分险类/ZB_DM_分险类保费合并_NEW.sql
+134
-0
ZB_DM/承保指标/new团队汇总结果/ZB_DM_团队汇总结果_归属业务人员.sql
ZB_DM/承保指标/new团队汇总结果/ZB_DM_团队汇总结果_归属业务人员.sql
+54
-0
ZB_DM/承保指标/new团队汇总结果/ZB_DM_团队汇总结果_新续转.sql
ZB_DM/承保指标/new团队汇总结果/ZB_DM_团队汇总结果_新续转.sql
+53
-0
ZB_DM/承保指标/new团队汇总结果/ZB_DM_团队汇总结果_车险.sql
ZB_DM/承保指标/new团队汇总结果/ZB_DM_团队汇总结果_车险.sql
+54
-0
ZB_DM/承保指标/new归属业务人员/ZB_DM_归属业务人员当日签单保费排名.sql
ZB_DM/承保指标/new归属业务人员/ZB_DM_归属业务人员当日签单保费排名.sql
+0
-0
ZB_DM/承保指标/new新续转/ZB_DM_新续转保单合并_NEW.sql
ZB_DM/承保指标/new新续转/ZB_DM_新续转保单合并_NEW.sql
+0
-0
ZB_DM/承保指标/new车险/ZB_DM_车险合并_NEW.sql
ZB_DM/承保指标/new车险/ZB_DM_车险合并_NEW.sql
+0
-0
ZB_DM/承保指标/new非车险/ZB_DM_非车险合并_NEW.sql
ZB_DM/承保指标/new非车险/ZB_DM_非车险合并_NEW.sql
+0
-0
ZB_DM/承保指标/非车险/ZB_DM_承保非车险(合并).sql
ZB_DM/承保指标/非车险/ZB_DM_承保非车险(合并).sql
+152
-0
No files found.
ZB_DM/承保指标/new分业务来源/ZB_DM_分业务来源合并_NEW.sql
0 → 100644
View file @
7f31c91b
This diff is collapsed.
Click to expand it.
ZB_DM/承保指标/new分渠道/ZB_DM_分渠道保费合并_NEW.sql
0 → 100644
View file @
7f31c91b
-- ZB_DM_FQDBF_HB_NEW ZB_DM_分渠道保费合并_NEW
-- step1:
-- 团队汇总
CREATE
TEMPORARY
VIEW
VIEW_ZB_DM_FQDBF_HB_NEW_TUANDUI
AS
SELECT
a1
.
`uwConclueDate`
as
`uwConclueDate`
,
a1
.
`LEVEL1COMCODE`
as
`LEVEL1COMCODE`
,
a1
.
`LEVEL2COMCODE`
as
`LEVEL2COMCODE`
,
a1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
a1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
a1
.
`startTime`
as
`startTime`
,
a1
.
`chnl`
as
`chnl`
,
a1
.
`cost`
+
if
(
t1
.
cost
is
null
,
0
,
cast
(
t1
.
cost
as
decimal
(
18
,
2
)))
as
`cost`
from
(
SELECT
s1
.
`uwConclueDate`
as
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
as
`LEVEL1COMCODE`
,
s1
.
`LEVEL2COMCODE`
as
`LEVEL2COMCODE`
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
s1
.
`startTime`
as
`startTime`
,
s1
.
`chnl`
as
`chnl`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
,
max
(
s1
.
proctime
)
as
proctime
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'
)
and
LongTimeToStringUDF
(
s1
.
log_time
,
'yyyyMMdd HH'
)
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd HH'
)
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
,
s1
.
`LEVEL2COMCODE`
,
s1
.
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
,
s1
.
`startTime`
,
s1
.
`chnl`
)
a1
left
join
ZB_DM
.
ZB_DM_MYSQL
.
TEAM_CHNL
for
system_time
as
of
a1
.
proctime
as
t1
on
a1
.
`uwConclueDate`
=
t1
.
`uwConclueDate`
and
a1
.
`LEVEL4COMCODE`
=
t1
.
`LEVEL4COMCODE`
and
a1
.
`startTime`
=
t1
.
`startTime`
and
a1
.
`chnl`
=
t1
.
`chnl`
;
-- ZB_DM_FQDBF ZB_DM_分渠道保费
-- chnlbf/日期/00000000 渠道代码
-- 1、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 2、起保时间小于等于当年
-- 总公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'chnlbf/'
,
s1
.
`uwConclueDate`
,
'/00000000'
)
as
`key`
,
s1
.
`chnl`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_FQDBF_HB_NEW_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`chnl`
;
-- 分公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'chnlbf/'
,
s1
.
`uwConclueDate`
,
'/'
,
s1
.
`LEVEL1COMCODE`
)
as
`key`
,
s1
.
`chnl`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_FQDBF_HB_NEW_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`chnl`
,
s1
.
`LEVEL1COMCODE`
;
-- 中支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'citychnlbf/'
,
s1
.
`uwConclueDate`
,
'/'
,
s1
.
`LEVEL2COMCODE`
)
as
`key`
,
s1
.
`chnl`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_FQDBF_HB_NEW_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`chnl`
,
s1
.
`LEVEL2COMCODE`
;
-- 县支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'countrychnlbf/'
,
s1
.
`uwConclueDate`
,
'/'
,
s1
.
`LEVEL3COMCODE`
)
as
`key`
,
s1
.
`chnl`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_FQDBF_HB_NEW_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`chnl`
,
s1
.
`LEVEL3COMCODE`
;
-- 团队
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'teamchnlbf/'
,
s1
.
`uwConclueDate`
,
'/'
,
s1
.
`LEVEL4COMCODE`
)
as
`key`
,
s1
.
`chnl`
as
`hkey`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
from
VIEW_ZB_DM_FQDBF_HB_NEW_TUANDUI
s1
;
\ No newline at end of file
ZB_DM/承保指标/new分险类/ZB_DM_分险类保费合并_NEW.sql
0 → 100644
View file @
7f31c91b
-- ZB_DM_FXLBF_HB_NEW ZB_DM_分险类保费合并_NEW
-- step1:
-- 团队汇总
CREATE
TEMPORARY
VIEW
VIEW_ZB_DM_FXLBF_HB_NEW_TUANDUI
AS
SELECT
a1
.
`uwConclueDate`
as
`uwConclueDate`
,
a1
.
`classcode`
as
`classcode`
,
a1
.
`LEVEL1COMCODE`
as
`LEVEL1COMCODE`
,
a1
.
`LEVEL2COMCODE`
as
`LEVEL2COMCODE`
,
a1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
a1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
a1
.
`startTime`
as
`startTime`
,
a1
.
`cost`
+
if
(
t1
.
cost
is
null
,
0
,
cast
(
t1
.
cost
as
decimal
(
18
,
2
)))
as
`cost`
from
(
SELECT
s1
.
`uwConclueDate`
as
`uwConclueDate`
,
s1
.
`classcode`
as
`classcode`
,
s1
.
`LEVEL1COMCODE`
as
`LEVEL1COMCODE`
,
s1
.
`LEVEL2COMCODE`
as
`LEVEL2COMCODE`
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
s1
.
`startTime`
as
`startTime`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
,
max
(
s1
.
proctime
)
as
proctime
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'
)
and
LongTimeToStringUDF
(
s1
.
log_time
,
'yyyyMMdd HH'
)
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd HH'
)
group
by
s1
.
`uwConclueDate`
,
s1
.
`classcode`
,
s1
.
`LEVEL1COMCODE`
,
s1
.
`LEVEL2COMCODE`
,
s1
.
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
,
s1
.
`startTime`
)
a1
left
join
ZB_DM
.
ZB_DM_MYSQL
.
TEAM_CLASSCODE
for
system_time
as
of
a1
.
proctime
as
t1
on
a1
.
`uwConclueDate`
=
t1
.
`uwConclueDate`
and
a1
.
`LEVEL4COMCODE`
=
t1
.
`LEVEL4COMCODE`
and
a1
.
`startTime`
=
t1
.
`startTime`
and
a1
.
`classcode`
=
t1
.
`classcode`
;
-- ZB_DM_FXLBF ZB_DM_分险类保费
-- allxlbf/日期 险类代码
-- 1、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 2、起保时间小于等于当年
--总公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'allxlbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`classcode`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_FXLBF_HB_NEW_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`classcode`
;
-- 分公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'provxlbf/'
,
s1
.
`uwConclueDate`
,
'/'
,
s1
.
`LEVEL1COMCODE`
)
as
`key`
,
s1
.
`classcode`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_FXLBF_HB_NEW_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`classcode`
,
s1
.
`LEVEL1COMCODE`
;
-- 中支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'cityxlbf/'
,
s1
.
`uwConclueDate`
,
'/'
,
s1
.
`LEVEL2COMCODE`
)
as
`key`
,
s1
.
`classcode`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_FXLBF_HB_NEW_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`classcode`
,
s1
.
`LEVEL2COMCODE`
;
-- 县支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'countryxlbf/'
,
s1
.
`uwConclueDate`
,
'/'
,
s1
.
`LEVEL3COMCODE`
)
as
`key`
,
s1
.
`classcode`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_FXLBF_HB_NEW_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`classcode`
,
s1
.
`LEVEL3COMCODE`
;
-- 团队
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'teamxlbf/'
,
s1
.
`uwConclueDate`
,
'/'
,
s1
.
`LEVEL4COMCODE`
)
as
`key`
,
s1
.
`classcode`
as
`hkey`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
from
VIEW_ZB_DM_FXLBF_HB_NEW_TUANDUI
s1
;
\ No newline at end of file
ZB_DM/承保指标/new团队汇总结果/ZB_DM_团队汇总结果_归属业务人员.sql
0 → 100644
View file @
7f31c91b
-- ZB_DM_TEAM_GSYWRNQNBFPM ZB_DM_团队汇总结果_归属业务人员
-- step1:
-- 团队汇总
INSERT
INTO
ZB_DM
.
ZB_DM_MYSQL
.
TEAM_GSYWRNQNBFPM
select
a1
.
`uwConclueDate`
as
`uwConclueDate`
,
a1
.
`LEVEL1COMCODE`
as
`LEVEL1COMCODE`
,
a1
.
`LEVEL2COMCODE`
as
`LEVEL2COMCODE`
,
a1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
a1
.
`startTime`
as
`startTime`
,
a1
.
`id`
as
`id`
,
a1
.
`name`
as
`name`
,
cast
(
a1
.
`cost`
+
if
(
t1
.
cost
is
null
,
0
,
cast
(
t1
.
cost
as
decimal
(
18
,
2
)))
as
varchar
)
as
`cost`
,
a1
.
`log_time`
as
`log_time`
from
(
SELECT
s1
.
`uwConclueDate`
as
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
as
`LEVEL1COMCODE`
,
s1
.
`LEVEL2COMCODE`
as
`LEVEL2COMCODE`
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`startTime`
as
`startTime`
,
s1
.
`id`
as
`id`
,
s1
.
`name`
as
`name`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
,
cast
(
DateTimeToLongUDF
(
tumble_end
(
s1
.
row_time
,
interval
'1'
hour
)
)
as
varchar
)
as
`log_time`
,
max
(
s1
.
proctime
)
as
proctime
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
s1
where
`COMNAME`
is
not
null
and
LEFT
(
`uwConclueDate`
,
8
)
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
,
s1
.
`LEVEL2COMCODE`
,
s1
.
`LEVEL3COMCODE`
,
s1
.
`startTime`
,
s1
.
`id`
,
s1
.
`name`
,
tumble
(
s1
.
row_time
,
interval
'1'
hour
)
)
a1
left
join
ZB_DM
.
ZB_DM_MYSQL
.
TEAM_GSYWRNQNBFPM
for
system_time
as
of
a1
.
proctime
as
t1
on
a1
.
`uwConclueDate`
=
t1
.
`uwConclueDate`
and
a1
.
`LEVEL3COMCODE`
=
t1
.
`LEVEL3COMCODE`
and
a1
.
`startTime`
=
t1
.
`startTime`
and
a1
.
`id`
=
t1
.
`id`
and
a1
.
`name`
=
t1
.
`name`
;
ZB_DM/承保指标/new团队汇总结果/ZB_DM_团队汇总结果_新续转.sql
0 → 100644
View file @
7f31c91b
-- ZB_DM_TEAM_XXZFLAG ZB_DM_团队汇总结果_新续转
-- step1:
-- 团队汇总
INSERT
INTO
ZB_DM
.
ZB_DM_MYSQL
.
TEAM_XXZFLAG
select
a1
.
`uwConclueDate`
as
`uwConclueDate`
,
a1
.
`LEVEL1COMCODE`
as
`LEVEL1COMCODE`
,
a1
.
`LEVEL2COMCODE`
as
`LEVEL2COMCODE`
,
a1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
a1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
a1
.
`startTime`
as
`startTime`
,
a1
.
`xxzflag`
as
`xxzflag`
,
cast
(
a1
.
`cost`
+
if
(
t1
.
cost
is
null
,
0
,
cast
(
t1
.
cost
as
decimal
(
18
,
2
)))
as
varchar
)
as
`cost`
,
a1
.
`log_time`
as
`log_time`
from
(
SELECT
s1
.
`uwConclueDate`
as
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
as
`LEVEL1COMCODE`
,
s1
.
`LEVEL2COMCODE`
as
`LEVEL2COMCODE`
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
as
`LEVEL4COMCODE`
,
s1
.
`startTime`
as
`startTime`
,
s1
.
`xxzflag`
as
`xxzflag`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
,
cast
(
DateTimeToLongUDF
(
tumble_end
(
s1
.
row_time
,
interval
'1'
hour
)
)
as
varchar
)
as
`log_time`
,
max
(
s1
.
proctime
)
as
proctime
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
s1
where
`COMNAME`
is
not
null
and
LEFT
(
`uwConclueDate`
,
8
)
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
,
s1
.
`LEVEL2COMCODE`
,
s1
.
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
,
s1
.
`startTime`
,
s1
.
`xxzflag`
,
tumble
(
s1
.
row_time
,
interval
'1'
hour
)
)
a1
left
join
ZB_DM
.
ZB_DM_MYSQL
.
TEAM_XXZFLAG
for
system_time
as
of
a1
.
proctime
as
t1
on
a1
.
`uwConclueDate`
=
t1
.
`uwConclueDate`
and
a1
.
`LEVEL4COMCODE`
=
t1
.
`LEVEL4COMCODE`
and
a1
.
`startTime`
=
t1
.
`startTime`
and
a1
.
`xxzflag`
=
t1
.
`xxzflag`
;
ZB_DM/承保指标/new团队汇总结果/ZB_DM_团队汇总结果_车险.sql
0 → 100644
View file @
7f31c91b
-- ZB_DM_TEAM_CAR ZB_DM_团队汇总结果_车险
-- step1:
-- 团队汇总
INSERT
INTO
ZB_DM
.
ZB_DM_MYSQL
.
TEAM_CAR
select
a1
.
`uwConclueDate`
as
`uwConclueDate`
,
a1
.
`LEVEL1COMCODE`
as
`LEVEL1COMCODE`
,
a1
.
`LEVEL2COMCODE`
as
`LEVEL2COMCODE`
,
a1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
a1
.
`startTime`
as
`startTime`
,
a1
.
`risk`
as
`risk`
,
a1
.
`chnl`
as
`chnl`
,
cast
(
a1
.
`cost`
+
if
(
t1
.
cost
is
null
,
0
,
cast
(
t1
.
cost
as
decimal
(
18
,
2
)))
as
varchar
)
as
`cost`
,
a1
.
`log_time`
as
`log_time`
from
(
SELECT
s1
.
`uwConclueDate`
as
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
as
`LEVEL1COMCODE`
,
s1
.
`LEVEL2COMCODE`
as
`LEVEL2COMCODE`
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
,
s1
.
`startTime`
as
`startTime`
,
s1
.
`risk`
as
`risk`
,
s1
.
`chnl`
as
`chnl`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
,
cast
(
DateTimeToLongUDF
(
tumble_end
(
s1
.
row_time
,
interval
'1'
hour
)
)
as
varchar
)
as
`log_time`
,
max
(
s1
.
proctime
)
as
proctime
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
s1
where
`COMNAME`
is
not
null
and
LEFT
(
`uwConclueDate`
,
8
)
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
,
s1
.
`LEVEL2COMCODE`
,
s1
.
`LEVEL3COMCODE`
,
s1
.
`startTime`
,
s1
.
`risk`
,
s1
.
`chnl`
,
tumble
(
s1
.
row_time
,
interval
'1'
hour
)
)
a1
left
join
ZB_DM
.
ZB_DM_MYSQL
.
TEAM_CAR
for
system_time
as
of
a1
.
proctime
as
t1
on
a1
.
`uwConclueDate`
=
t1
.
`uwConclueDate`
and
a1
.
`LEVEL3COMCODE`
=
t1
.
`LEVEL3COMCODE`
and
a1
.
`startTime`
=
t1
.
`startTime`
and
a1
.
`risk`
=
t1
.
`risk`
and
a1
.
`chnl`
=
t1
.
`chnl`
;
ZB_DM/承保指标/new归属业务人员/ZB_DM_归属业务人员当日签单保费排名.sql
0 → 100644
View file @
7f31c91b
This diff is collapsed.
Click to expand it.
ZB_DM/承保指标/new新续转/ZB_DM_新续转保单合并_NEW.sql
0 → 100644
View file @
7f31c91b
This diff is collapsed.
Click to expand it.
ZB_DM/承保指标/new车险/ZB_DM_车险合并_NEW.sql
0 → 100644
View file @
7f31c91b
This diff is collapsed.
Click to expand it.
ZB_DM/承保指标/new非车险/ZB_DM_非车险合并_NEW.sql
0 → 100644
View file @
7f31c91b
This diff is collapsed.
Click to expand it.
ZB_DM/承保指标/非车险/ZB_DM_承保非车险(合并).sql
View file @
7f31c91b
...
...
@@ -191,4 +191,155 @@ from (
,
d1
.
`risk`
)
s1
;
-- 总公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_VARCHAR
select
CONCAT
(
'bigfcbd/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
CastToJsonArrayUDF
(
listagg
(
concat
(
'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
VIEW_ZB_DM_NOCAR_HB
d1
where
LEFT
(
d1
.
`risk`
,
2
)
<>
'05'
)
c1
where
c1
.
rownum
<=
20
)
s1
group
by
s1
.
`uwConclueDate`
;
-- 分公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_VARCHAR
select
CONCAT
(
'bigfccitybd/'
,
s1
.
`uwConclueDate`
,
'/'
,
s1
.
`group_com`
)
as
`key`
,
CastToJsonArrayUDF
(
listagg
(
concat
(
'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
VIEW_ZB_DM_NOCAR_HB
d1
where
LEFT
(
d1
.
`risk`
,
2
)
<>
'05'
)
c1
where
c1
.
rownum
<=
20
)
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`group_com`
;
-- 中支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_VARCHAR
select
CONCAT
(
'bigfccountrybd/'
,
s1
.
`uwConclueDate`
,
'/'
,
s1
.
`group_com`
)
as
`key`
,
CastToJsonArrayUDF
(
listagg
(
concat
(
'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
VIEW_ZB_DM_NOCAR_HB
d1
where
LEFT
(
d1
.
`risk`
,
2
)
<>
'05'
)
c1
where
c1
.
rownum
<=
20
)
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`group_com`
;
\ No newline at end of file
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