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
71122f5b
Commit
71122f5b
authored
Aug 26, 2022
by
胡涛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
指标统计sql脚本
parent
46de46a2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
644 additions
and
0 deletions
+644
-0
ZB_DM/承保指标/今日签单/ZB_DM_今日签单(合并).sql
ZB_DM/承保指标/今日签单/ZB_DM_今日签单(合并).sql
+644
-0
No files found.
ZB_DM/承保指标/今日签单/ZB_DM_今日签单(合并).sql
0 → 100644
View file @
71122f5b
-- ZB_DM_JRQDBF_HB ZB_DM_今日签单合并
-- step1:
-- 团队汇总
CREATE
TEMPORARY
VIEW
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
AS
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
.
`risk`
as
`risk`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
from
(
select
*
,
ROW_NUMBER
()
OVER
(
PARTITION
BY
`no`
,
`COMCODE`
,
`cost`
ORDER
BY
`uwConclueDate`
DESC
)
as
rownum
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
,
s1
.
`LEVEL2COMCODE`
,
s1
.
`LEVEL3COMCODE`
,
s1
.
`LEVEL4COMCODE`
,
s1
.
`startTime`
,
s1
.
`risk`
;
-- ZB_DM_JRQDBF ZB_DM_今日签单保费
-- key:allqdbf/日期
-- 1、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 总公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_DECIMAL
select
CONCAT
(
'allqdbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
;
-- 分公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'provqdbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL1COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
;
-- 中支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'cityqdbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL2COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL2COMCODE`
;
-- 县支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'countryqdbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL3COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL3COMCODE`
;
-- 团队
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'teamqdbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL4COMCODE`
as
`hkey`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
;
-- ZB_DM_JRQDJNQBBF ZB_DM_今日签单今年待起保保费
-- key:allqbbf/日期
-- 1、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 2、起保时间小于等于当年
-- 总公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_DECIMAL
select
CONCAT
(
'allqbbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
where
left
(
s1
.
`startTime`
,
4
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
)
group
by
s1
.
`uwConclueDate`
;
-- 分公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'provqbbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL1COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
where
left
(
s1
.
`startTime`
,
4
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
)
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
;
-- 中支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'cityqbbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL2COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
where
left
(
s1
.
`startTime`
,
4
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
)
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL2COMCODE`
;
-- 县支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'countryqbbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL3COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
where
left
(
s1
.
`startTime`
,
4
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
)
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL3COMCODE`
;
-- 团队
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'teamqbbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL4COMCODE`
as
`hkey`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
where
left
(
s1
.
`startTime`
,
4
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyy'
)
;
-- ZB_DM_JRQDJDMQBBF ZB_DM_今日签单季度末待起保保费
-- key:allquarterqdbf
-- 1、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 2、起保时间小于等于当季度
-- 总公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_DECIMAL
select
CONCAT
(
'allquarterqdbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
-- 核保时间在今天并且起保时间的月份小于等于季度。
where
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`
;
-- 分公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'provquarterqdbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL1COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
-- 核保时间在今天并且起保时间的月份小于等于季度。
where
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`
;
-- 中支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'cityquarterqdbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL2COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
-- 核保时间在今天并且起保时间的月份小于等于季度。
where
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
.
`LEVEL2COMCODE`
;
-- 县支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'countyquarterqdbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL3COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
-- 核保时间在今天并且起保时间的月份小于等于季度。
where
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
.
`LEVEL3COMCODE`
;
-- 团队
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'teamquarterqdbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL4COMCODE`
as
`hkey`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
-- 核保时间在今天并且起保时间的月份小于等于季度。
where
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
;
-- ZB_DM_JRQDYDQQBBF ZB_DM_今日签单月底前起保保费
-- key:allmonthqbbf/日期
-- 1、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 2、起保时间小于等于当月
-- 总公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_DECIMAL
select
CONCAT
(
'allmonthqbbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
where
left
(
s1
.
`startTime`
,
6
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMM'
)
group
by
s1
.
`uwConclueDate`
;
-- 分公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'provmonthqbbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL1COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
where
left
(
s1
.
`startTime`
,
6
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMM'
)
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
;
-- 中支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'citymonthqbbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL2COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
where
left
(
s1
.
`startTime`
,
6
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMM'
)
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL2COMCODE`
;
-- 县支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'countrymonthqbbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL3COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
where
left
(
s1
.
`startTime`
,
6
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMM'
)
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL3COMCODE`
;
-- 团队
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'teammonthqbbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL4COMCODE`
as
`hkey`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
where
left
(
s1
.
`startTime`
,
6
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMM'
)
;
-- ZB_DM_JRQDJRQBBF ZB_DM_今日签单今日待起保保费
-- key:alldayqdbf/日期
-- 1、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 2、起保时间小于等于当日
-- 总公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_DECIMAL
select
CONCAT
(
'alldayqdbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
where
left
(
s1
.
`startTime`
,
8
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
group
by
s1
.
`uwConclueDate`
;
-- 分公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'provdayqdbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL1COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
where
left
(
s1
.
`startTime`
,
8
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
;
-- 中支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'citydayqdbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL2COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
where
left
(
s1
.
`startTime`
,
8
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL2COMCODE`
;
-- 县支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'countrydayqdbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL3COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
where
left
(
s1
.
`startTime`
,
8
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL3COMCODE`
;
-- 团队
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'teamdayqdbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL4COMCODE`
as
`hkey`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
where
left
(
s1
.
`startTime`
,
8
)
<=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
;
-- ZB_DM_QDBF_CAR/ZB_DM_车险今日签单保费
-- key:allcarqbbf/日期
-- 1、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 2、车险
-- 总公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_DECIMAL
select
CONCAT
(
'allcarqdbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
where
left
(
s1
.
risk
,
2
)
=
'05'
group
by
s1
.
`uwConclueDate`
;
-- 分公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'provcarqdbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL1COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
where
left
(
s1
.
risk
,
2
)
=
'05'
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
;
-- 中支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'citycarqdbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL2COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
where
left
(
s1
.
risk
,
2
)
=
'05'
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL2COMCODE`
;
-- 县支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'countycarqdbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL3COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
where
left
(
s1
.
risk
,
2
)
=
'05'
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL3COMCODE`
;
-- 团队
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'teamcarqdbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL4COMCODE`
as
`hkey`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
where
left
(
s1
.
risk
,
2
)
=
'05'
;
-- ZB_DM_QDBF_NOCAR/ZB_DM_非车险今日签单保费
-- key:allnocarqbbf/日期
-- 1、日期:核保日期或者核批完成日期(yyyyMMdd)
-- 2、非车险
-- 总公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
SET_DECIMAL
select
CONCAT
(
'allnocarqdbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
where
left
(
s1
.
risk
,
2
)
<>
'05'
group
by
s1
.
`uwConclueDate`
;
-- 分公司
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'provnocarqdbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL1COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
where
left
(
s1
.
risk
,
2
)
<>
'05'
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
;
-- 中支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'citynocarqdbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL2COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
where
left
(
s1
.
risk
,
2
)
<>
'05'
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL2COMCODE`
;
-- 县支
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'countynocarqdbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL3COMCODE`
as
`hkey`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
where
left
(
s1
.
risk
,
2
)
<>
'05'
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL3COMCODE`
;
-- 团队
insert
into
ZB_DM
.
ZB_DM_REDIS
.
HSET_DECIMAL
select
CONCAT
(
'teamnocarqdbf/'
,
s1
.
`uwConclueDate`
)
as
`key`
,
s1
.
`LEVEL4COMCODE`
as
`hkey`
,
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
))
as
`val`
from
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
s1
where
left
(
s1
.
risk
,
2
)
<>
'05'
;
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