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
3fe7c8f2
Commit
3fe7c8f2
authored
Aug 25, 2022
by
王东
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
指标计算承保字段调整
parent
6782baee
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
187 deletions
+19
-187
ZB_DM/承保指标/new今日签单/ZB_DM_今日签单(合并).sql
ZB_DM/承保指标/new今日签单/ZB_DM_今日签单(合并).sql
+5
-179
ZB_DM/承保指标/new团队汇总结果/ZB_DM_团队汇总结果.sql
ZB_DM/承保指标/new团队汇总结果/ZB_DM_团队汇总结果.sql
+3
-3
ZB_ODS/DDL元数据/CBDATA.sql
ZB_ODS/DDL元数据/CBDATA.sql
+3
-1
ZB_ODS/ZB_ODS_CBDATA.sql
ZB_ODS/ZB_ODS_CBDATA.sql
+8
-4
No files found.
ZB_DM/承保指标/今日签单/ZB_DM_今日签单(合并).sql
→
ZB_DM/承保指标/
new
今日签单/ZB_DM_今日签单(合并).sql
View file @
3fe7c8f2
-- ZB_DM_JRQDBF_HB ZB_DM_今日签单合并
-- step1:
-- 团队汇总
CREATE
TEMPORARY
VIEW
VIEW_ZB_DM_JRQDBF_HB_TUANDUI
AS
SELECT
s1
.
`uwConclueDate`
as
`uwConclueDate`
SELECT
s1
.
`uwConclueDate`
as
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
as
`LEVEL1COMCODE`
,
s1
.
`LEVEL2COMCODE`
as
`LEVEL2COMCODE`
,
s1
.
`LEVEL3COMCODE`
as
`LEVEL3COMCODE`
...
...
@@ -13,16 +12,10 @@ SELECT s1.`uwConclueDate` as `uwConclueDate`
,
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
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
and
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
group
by
s1
.
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
...
...
@@ -474,171 +467,4 @@ 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'
;
ZB_DM/承保指标/new团队汇总结果/ZB_DM_团队汇总结果.sql
View file @
3fe7c8f2
...
...
@@ -4,7 +4,7 @@
-- step1:
-- 团队汇总
CREATE
TEMPORARY
VIEW
ZB_DM
.
ZB_DM_MYSQL
.
T
DHZ
AS
CREATE
TEMPORARY
VIEW
ZB_DM
.
ZB_DM_MYSQL
.
T
EAM
AS
SELECT
s1
.
`uwConclueDate`
as
`uwConclueDate`
,
s1
.
`LEVEL1COMCODE`
as
`LEVEL1COMCODE`
...
...
@@ -16,7 +16,7 @@ SELECT
,
s1
.
`chnl`
as
`chnl`
,
s1
.
`businessNatureCode`
as
`businessNatureCode`
,
sum
(
cast
(
s1
.
`cost`
as
DECIMAL
(
18
,
2
)))
as
`cost`
,
DATE_FORMAT
(
tumble_end
(
s1
.
row_time
,
interval
'1'
minute
)
,
'yyyy-MM-dd HH:mm:ss'
)
as
`log_time`
,
DATE_FORMAT
(
tumble_end
(
s1
.
row_time
,
interval
'1'
hour
)
,
'yyyy-MM-dd HH:mm:ss'
)
as
`log_time`
from
(
select
*
...
...
@@ -24,7 +24,7 @@ from (
from
ZB_ODS
.
ZB_ODS_KAFKA
.
CBDATA
where
`COMNAME`
is
not
null
and
`uwConclueDate`
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
LEFT
(
`uwConclueDate`
,
8
)
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
)
s1
where
s1
.
rownum
=
1
group
by
...
...
ZB_ODS/DDL元数据/CBDATA.sql
View file @
3fe7c8f2
...
...
@@ -27,6 +27,7 @@ create table CBDATA(
`no`
String
,
-- 保单号
`xxzflag`
String
,
-- 新续转标记 1是0否
`id`
String
,
-- 14 归属业务员ID
`name`
String
-- 15 归属业务员名称
`name`
String
,
-- 15 归属业务员名称
log_time
String
)
;
\ No newline at end of file
ZB_ODS/ZB_ODS_CBDATA.sql
View file @
3fe7c8f2
...
...
@@ -39,10 +39,11 @@ select
,
s1
.
xxzflag
as
xxzflag
-- 新续转标记 1是0否
,
s1
.
recordClerkCode
as
`id`
-- 14 归属业务员ID
,
s1
.
recordClerkName
as
`name`
-- 15 归属业务员名称
,
s1
.
log_time
as
log_time
from
(
select
LongTimeToStringUDF
(
uwConclueDate
,
'yyyyMMdd'
)
as
uwConclueDate
-- 核保通过时间
,
LongTimeToStringUDF
(
startTime
,
'yyyyMMdd'
)
as
startTime
-- 起保时间
LongTimeToStringUDF
(
uwConclueDate
,
'yyyyMMdd
HH:mm:ss
'
)
as
uwConclueDate
-- 核保通过时间
,
LongTimeToStringUDF
(
startTime
,
'yyyyMMdd
HH:mm:ss
'
)
as
startTime
-- 起保时间
,
businessOffice
as
businessOffice
-- 保单归属机构代码
,
productCode
as
productCode
-- 险种代码
,
businessChannelCode
as
businessChannelCode
-- 业务渠道
...
...
@@ -63,6 +64,7 @@ from (
,
recordClerkName
as
recordClerkName
-- 15 归属业务员名称
,
'bd'
as
flag
-- 保单或批单标记
,
proctime
as
proctime
,
uwConclueDate
as
log_time
from
ODS
.
ODS_KAFKA
.
POLICY
-- 保单业务数据
where
LongTimeToStringUDF
(
uwConclueDate
,
'yyyyMMdd'
)
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
(
...
...
@@ -75,8 +77,8 @@ from (
)
union
all
select
LongTimeToStringUDF
(
uwConclueDate
,
'yyyyMMdd
'
)
as
uwConclueDate
-- 核保通过时间 ??
,
LongTimeToStringUDF
(
plpEndorse
.
endorseEffectiveTime
,
'yyyyMMdd'
)
as
startTime
-- 起保时间
LongTimeToStringUDF
(
uwConclueDate
,
'yyyyMMdd
HH:mm:ss'
)
as
uwConclueDate
-- 核保通过时间 ??
,
LongTimeToStringUDF
(
plpEndorse
.
endorseEffectiveTime
,
'yyyyMMdd
HH:mm:ss
'
)
as
startTime
-- 起保时间
,
businessOffice
as
businessOffice
-- 保单归属机构代码
,
productCode
as
productCode
-- 险种代码
,
businessChannelCode
as
businessChannelCode
-- 业务渠道
...
...
@@ -97,6 +99,8 @@ from (
,
recordClerkName
as
recordClerkName
-- 15 归属业务员名称
,
'pd'
as
flag
-- 保单或批单标记
,
proctime
as
proctime
,
uwConclueDate
as
log_time
from
ODS
.
ODS_KAFKA
.
ENDOR
-- 批单业务数据
where
LongTimeToStringUDF
(
uwConclueDate
,
'yyyyMMdd'
)
=
DATE_FORMAT
(
LOCALTIMESTAMP
,
'yyyyMMdd'
)
and
(
...
...
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