Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
bi-report
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
data
bi-report
Commits
7365fd13
Commit
7365fd13
authored
May 01, 2020
by
赵建伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
upadte codes
parent
89888c6c
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
327 additions
and
18 deletions
+327
-18
workspace.xml
.idea/workspace.xml
+11
-7
workspace.xml
lib/java/bi-report-service/.idea/workspace.xml
+5
-2
EmailServiceImpl.java
...ei/data/gateway/server/service/impl/EmailServiceImpl.java
+1
-1
demo.sql
sqls/demo/demo.sql
+292
-8
demo_bak.sql
sqls/demo/demo_bak.sql
+18
-0
No files found.
.idea/workspace.xml
View file @
7365fd13
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"ChangeListManager"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"18c38e3b-9b7f-4a3f-b141-edcb320b1d24"
name=
"Default Changelist"
comment=
""
/>
<list
default=
"true"
id=
"18c38e3b-9b7f-4a3f-b141-edcb320b1d24"
name=
"Default Changelist"
comment=
""
>
<change
afterPath=
"$PROJECT_DIR$/sqls/demo/demo_bak.sql"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/sqls/demo/demo.sql"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/sqls/demo/demo.sql"
afterDir=
"false"
/>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
<option
name=
"HIGHLIGHT_NON_ACTIVE_CHANGELIST"
value=
"false"
/>
<option
name=
"HIGHLIGHT_NON_ACTIVE_CHANGELIST"
value=
"false"
/>
...
@@ -58,17 +61,13 @@
...
@@ -58,17 +61,13 @@
<property
name=
"WebServerToolWindowFactoryState"
value=
"false"
/>
<property
name=
"WebServerToolWindowFactoryState"
value=
"false"
/>
<property
name=
"aspect.path.notification.shown"
value=
"true"
/>
<property
name=
"aspect.path.notification.shown"
value=
"true"
/>
<property
name=
"ignore_missing_gitignore"
value=
"true"
/>
<property
name=
"ignore_missing_gitignore"
value=
"true"
/>
<property
name=
"last_opened_file_path"
value=
"$PROJECT_DIR$"
/>
<property
name=
"last_opened_file_path"
value=
"$PROJECT_DIR$
/sqls/demo
"
/>
<property
name=
"project.structure.last.edited"
value=
"Global Libraries"
/>
<property
name=
"project.structure.last.edited"
value=
"Global Libraries"
/>
<property
name=
"project.structure.proportion"
value=
"0.0"
/>
<property
name=
"project.structure.proportion"
value=
"0.0"
/>
<property
name=
"project.structure.side.proportion"
value=
"0.2"
/>
<property
name=
"project.structure.side.proportion"
value=
"0.2"
/>
<property
name=
"settings.editor.selected.configurable"
value=
"File.Encoding"
/>
<property
name=
"settings.editor.selected.configurable"
value=
"File.Encoding"
/>
</component>
</component>
<component
name=
"RecentsManager"
>
<component
name=
"RecentsManager"
>
<key
name=
"CopyFile.RECENT_KEYS"
>
<recent
name=
"$PROJECT_DIR$/lib/shell"
/>
<recent
name=
"$PROJECT_DIR$/jobs/demo"
/>
</key>
<key
name=
"MoveFile.RECENT_KEYS"
>
<key
name=
"MoveFile.RECENT_KEYS"
>
<recent
name=
"$PROJECT_DIR$/sqls/demo_param"
/>
<recent
name=
"$PROJECT_DIR$/sqls/demo_param"
/>
<recent
name=
"$PROJECT_DIR$/sqls/demo"
/>
<recent
name=
"$PROJECT_DIR$/sqls/demo"
/>
...
@@ -76,6 +75,11 @@
...
@@ -76,6 +75,11 @@
<recent
name=
"$PROJECT_DIR$/lib/python"
/>
<recent
name=
"$PROJECT_DIR$/lib/python"
/>
<recent
name=
"$PROJECT_DIR$/lib/shell"
/>
<recent
name=
"$PROJECT_DIR$/lib/shell"
/>
</key>
</key>
<key
name=
"CopyFile.RECENT_KEYS"
>
<recent
name=
"$PROJECT_DIR$/sqls/demo"
/>
<recent
name=
"$PROJECT_DIR$/lib/shell"
/>
<recent
name=
"$PROJECT_DIR$/jobs/demo"
/>
</key>
</component>
</component>
<component
name=
"RunManager"
>
<component
name=
"RunManager"
>
<configuration
default=
"true"
type=
"ClojureREPL"
factoryName=
"Local"
activateToolWindowBeforeRun=
"false"
>
<configuration
default=
"true"
type=
"ClojureREPL"
factoryName=
"Local"
activateToolWindowBeforeRun=
"false"
>
...
@@ -120,7 +124,7 @@
...
@@ -120,7 +124,7 @@
<workItem
from=
"1588154352798"
duration=
"195000"
/>
<workItem
from=
"1588154352798"
duration=
"195000"
/>
<workItem
from=
"1588220085338"
duration=
"7993000"
/>
<workItem
from=
"1588220085338"
duration=
"7993000"
/>
<workItem
from=
"1588248522289"
duration=
"2820000"
/>
<workItem
from=
"1588248522289"
duration=
"2820000"
/>
<workItem
from=
"1588344251422"
duration=
"
1793
000"
/>
<workItem
from=
"1588344251422"
duration=
"
2995
000"
/>
</task>
</task>
<task
id=
"LOCAL-00001"
summary=
"add init codes."
>
<task
id=
"LOCAL-00001"
summary=
"add init codes."
>
<created>
1587723565207
</created>
<created>
1587723565207
</created>
...
...
lib/java/bi-report-service/.idea/workspace.xml
View file @
7365fd13
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"ChangeListManager"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"73604af3-3cbc-41f8-9a5f-e6a14a2ada76"
name=
"Default Changelist"
comment=
"add"
/>
<list
default=
"true"
id=
"73604af3-3cbc-41f8-9a5f-e6a14a2ada76"
name=
"Default Changelist"
comment=
"add"
>
<change
afterPath=
"$PROJECT_DIR$/../../../sqls/demo/demo_bak.sql"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/../../../sqls/demo/demo.sql"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/../../../sqls/demo/demo.sql"
afterDir=
"false"
/>
</list>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
<option
name=
"HIGHLIGHT_NON_ACTIVE_CHANGELIST"
value=
"false"
/>
<option
name=
"HIGHLIGHT_NON_ACTIVE_CHANGELIST"
value=
"false"
/>
...
@@ -216,7 +219,7 @@
...
@@ -216,7 +219,7 @@
<workItem
from=
"1588148891822"
duration=
"2318000"
/>
<workItem
from=
"1588148891822"
duration=
"2318000"
/>
<workItem
from=
"1588152718016"
duration=
"1463000"
/>
<workItem
from=
"1588152718016"
duration=
"1463000"
/>
<workItem
from=
"1588154601852"
duration=
"28557000"
/>
<workItem
from=
"1588154601852"
duration=
"28557000"
/>
<workItem
from=
"1588344252163"
duration=
"
3401
000"
/>
<workItem
from=
"1588344252163"
duration=
"
4375
000"
/>
</task>
</task>
<servers
/>
<servers
/>
</component>
</component>
...
...
lib/java/bi-report-service/service-server/src/main/java/com/gmei/data/gateway/server/service/impl/EmailServiceImpl.java
View file @
7365fd13
...
@@ -66,7 +66,7 @@ public class EmailServiceImpl implements EmailService {
...
@@ -66,7 +66,7 @@ public class EmailServiceImpl implements EmailService {
String
fileNameSrc
=
name
+
"-"
+
DateUtils
.
getCurrentDateSimpleStr
()
+
".xlsx"
;
String
fileNameSrc
=
name
+
"-"
+
DateUtils
.
getCurrentDateSimpleStr
()
+
".xlsx"
;
FileSystemResource
file
=
new
FileSystemResource
(
new
File
(
filePath
+
fileNameSrc
));
FileSystemResource
file
=
new
FileSystemResource
(
new
File
(
filePath
+
fileNameSrc
));
helper
.
addAttachment
(
fileName
,
file
);
helper
.
addAttachment
(
fileName
,
file
);
helper
.
addAttachment
(
MimeUtility
.
encodeWord
(
file
.
getFilename
(),
"utf-8"
,
"B"
),
file
);
//
helper.addAttachment(MimeUtility.encodeWord(file.getFilename(),"utf-8","B"), file);
mailSender
.
send
(
message
);
mailSender
.
send
(
message
);
logger
.
info
(
"带附件的邮件已经发送。"
);
logger
.
info
(
"带附件的邮件已经发送。"
);
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
...
sqls/demo/demo.sql
View file @
7365fd13
SELECT
partition_date
SELECT
`日期`
,
`设备类型`
,
`活跃类型`
,
`渠道`
,
`美购详情页浏览pv`
,(
`加购物车点击pv`
+
`评价列表页点击pv`
+
`立即支付点击pv`
+
`私信及电话咨询pv`
+
`选择美购项目点击pv`
+
`机构主页点击pv`
+
`机构的其他美购点击pv`
+
`推荐美购点击pv`
+
`收藏点击pv`
+
`右上角购物车点击pv`
+
`医生主页点击pv`
+
`分享点击pv`
+
`机构导航点击pv`
)
as
`美购详情页分发pv加总`
,
concat
(
round
((
`加购物车点击pv`
+
`评价列表页点击pv`
+
`立即支付点击pv`
+
`私信及电话咨询pv`
+
`选择美购项目点击pv`
+
`机构主页点击pv`
+
`机构的其他美购点击pv`
+
`推荐美购点击pv`
+
`收藏点击pv`
+
`右上角购物车点击pv`
+
`医生主页点击pv`
+
`分享点击pv`
+
`机构导航点击pv`
)
/
`美购详情页浏览pv`
*
100
,
4
),
'%'
)
as
`美购详情页分发pv占比加总`
,
`加购物车点击pv`
,
concat
(
round
(
`加购物车点击pv`
/
`美购详情页浏览pv`
*
100
,
4
),
'%'
)
as
`加购物车点击pv占比`
,
`评价列表页点击pv`
,
concat
(
round
(
`评价列表页点击pv`
/
`美购详情页浏览pv`
*
100
,
4
),
'%'
)
as
`评价列表页点击pv占比`
,
`立即支付点击pv`
,
concat
(
round
(
`立即支付点击pv`
/
`美购详情页浏览pv`
*
100
,
4
),
'%'
)
as
`立即支付点击pv占比`
,
`私信及电话咨询pv`
,
concat
(
round
(
`私信及电话咨询pv`
/
`美购详情页浏览pv`
*
100
,
4
),
'%'
)
as
`私信及电话咨询pv占比`
,
`选择美购项目点击pv`
,
concat
(
round
(
`选择美购项目点击pv`
/
`美购详情页浏览pv`
*
100
,
4
),
'%'
)
as
`选择美购项目点击pv占比`
,
`机构主页点击pv`
,
concat
(
round
(
`机构主页点击pv`
/
`美购详情页浏览pv`
*
100
,
4
),
'%'
)
as
`机构主页点击pv占比`
,
`机构的其他美购点击pv`
,
concat
(
round
(
`机构的其他美购点击pv`
/
`美购详情页浏览pv`
*
100
,
4
),
'%'
)
as
`机构的其他美购点击pv占比`
,
`推荐美购点击pv`
,
concat
(
round
(
`推荐美购点击pv`
/
`美购详情页浏览pv`
*
100
,
4
),
'%'
)
as
`推荐美购点击pv占比`
,
`收藏点击pv`
,
concat
(
round
(
`收藏点击pv`
/
`美购详情页浏览pv`
*
100
,
4
),
'%'
)
as
`收藏点击pv占比`
,
`右上角购物车点击pv`
,
concat
(
round
(
`右上角购物车点击pv`
/
`美购详情页浏览pv`
*
100
,
4
),
'%'
)
as
`右上角购物车点击pv占比`
,
`医生主页点击pv`
,
concat
(
round
(
`医生主页点击pv`
/
`美购详情页浏览pv`
*
100
,
4
),
'%'
)
as
`医生主页点击pv占比`
,
`分享点击pv`
,
concat
(
round
(
`分享点击pv`
/
`美购详情页浏览pv`
*
100
,
4
),
'%'
)
as
`分享点击pv占比`
,
`机构导航点击pv`
,
concat
(
round
(
`机构导航点击pv`
/
`美购详情页浏览pv`
*
100
,
4
),
'%'
)
as
`机构导航点击pv占比`
FROM
(
SELECT
t1
.
partition_date
as
`日期`
,
t1
.
device_type
as
`设备类型`
,
t1
.
active_type
as
`活跃类型`
,
t2
.
channel
as
`渠道`
,
count
(
case
when
type
=
'美购详情页'
then
cl_id
end
)
as
`美购详情页浏览pv`
,
count
(
case
when
type
=
'加购物车'
then
cl_id
end
)
as
`加购物车点击pv`
,
count
(
case
when
type
=
'评价列表页'
then
cl_id
end
)
as
`评价列表页点击pv`
,
count
(
case
when
type
=
'立即支付'
then
cl_id
end
)
as
`立即支付点击pv`
,
count
(
case
when
type
=
'私信及电话咨询'
then
cl_id
end
)
as
`私信及电话咨询pv`
,
count
(
case
when
type
=
'选择美购项目'
then
cl_id
end
)
as
`选择美购项目点击pv`
,
count
(
case
when
type
=
'机构主页'
then
cl_id
end
)
as
`机构主页点击pv`
,
count
(
case
when
type
=
'机构的其他美购'
then
cl_id
end
)
as
`机构的其他美购点击pv`
,
count
(
case
when
type
=
'推荐美购'
then
cl_id
end
)
as
`推荐美购点击pv`
,
count
(
case
when
type
=
'收藏'
then
cl_id
end
)
as
`收藏点击pv`
,
count
(
case
when
type
=
'右上角购物车'
then
cl_id
end
)
as
`右上角购物车点击pv`
,
count
(
case
when
type
=
'医生主页'
then
cl_id
end
)
as
`医生主页点击pv`
,
count
(
case
when
type
=
'分享'
then
cl_id
end
)
as
`分享点击pv`
,
count
(
case
when
type
=
'机构导航'
then
cl_id
end
)
as
`机构导航点击pv`
FROM
(
SELECT
click
.
partition_date
,
click
.
cl_id
,
click
.
type
,
mas
.
active_type
,
mas
.
device_type
,
mas
.
channel
FROM
(
--浏览需要去掉疑似机构刷量的设备
SELECT
pv
.
partition_date
as
partition_date
,
pv
.
cl_id
as
cl_id
,
type
FROM
(
SELECT
partition_date
,
cl_id
,
'美购详情页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'page_view'
)
pv
LEFT
JOIN
(
-- 去掉疑似机构刷量的PV和UV
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_day
WHERE
partition_date
>=
'20180402'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
UNION
ALL
SELECT
cl_id
FROM
online
.
ml_hospital_spam_pv_month
WHERE
partition_date
>=
'20171101'
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
pv_ratio
>=
0
.
95
)
spam_pv
on
pv
.
cl_id
=
spam_pv
.
cl_id
WHERE
spam_pv
.
cl_id
IS
NULL
UNION
ALL
SELECT
partition_date
,
cl_id
,
'加购物车'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'welfare_multiattribute_click_add'
UNION
ALL
SELECT
partition_date
,
cl_id
,
'右上角购物车'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_navbar_cart'
UNION
ALL
--点击查看更多评论
SELECT
partition_date
,
cl_id
,
'评价列表页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_comment'
UNION
ALL
--点击外显的评价标签
SELECT
partition_date
,
cl_id
,
'评价列表页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'service_comment_click_tag'
UNION
ALL
--点击外显的日记卡片
SELECT
partition_date
,
cl_id
,
'评价列表页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'welfare_detail_comment_click_diary_card'
UNION
ALL
SELECT
partition_date
,
cl_id
,
'立即支付'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'welfare_multiattribute_click_buy'
UNION
ALL
--点击选择更美项目
SELECT
partition_date
,
cl_id
,
'选择美购项目'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_button'
AND
params
[
'button_name'
]
=
'sku_choose'
UNION
ALL
--7.22新版本--点击外露的美购项目
SELECT
partition_date
,
cl_id
,
'选择美购项目'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_button'
AND
params
[
'button_name'
]
=
'service_sku'
UNION
ALL
--7.22新版本--点击查看更多
SELECT
partition_date
,
cl_id
,
'选择美购项目'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_button'
AND
params
[
'button_name'
]
=
'sku_all'
UNION
ALL
--点击私信按钮
SELECT
partition_date
,
cl_id
,
'私信及电话咨询'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_message'
UNION
ALL
--7.20之后灰度上线的快捷咨询按钮和预约面诊按钮
SELECT
partition_date
,
cl_id
,
'私信及电话咨询'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_button'
AND
params
[
'button_name'
]
in
(
'question_tag'
,
'appointment'
)
UNION
ALL
--点击机构下面的在线咨询和电话咨询
SELECT
partition_date
,
cl_id
,
'私信及电话咨询'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_curearea_contact'
AND
params
[
'connect_type'
]
in
(
'onlineconsult'
,
'phone'
)
UNION
ALL
SELECT
partition_date
,
cl_id
,
'机构主页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_curearea'
AND
params
[
'cure_type'
]
=
'organization'
UNION
ALL
SELECT
partition_date
,
cl_id
,
'机构的其他美购'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_seller_service_item'
UNION
ALL
SELECT
partition_date
,
cl_id
,
'机构导航'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_address'
UNION
ALL
SELECT
partition_date
,
cl_id
,
'推荐美购'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_card'
AND
params
[
'card_content_type'
]
=
'service'
AND
params
[
'tab_name'
]
=
'推荐'
UNION
ALL
SELECT
partition_date
,
cl_id
,
'收藏'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'on_click_favor'
AND
params
[
'favor_type'
]
=
'service'
AND
params
[
'motion'
]
=
'do'
UNION
ALL
SELECT
partition_date
,
cl_id
,
'医生主页'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
--AND page_name = 'welfare_detail'
AND
action
=
'welfare_detail_click_curearea'
AND
params
[
'cure_type'
]
=
'doctor'
UNION
ALL
SELECT
partition_date
,
cl_id
,
'分享'
as
type
FROM
online
.
bl_hdfs_maidian_updates
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
page_name
=
'welfare_detail'
AND
action
=
'page_click_share'
)
click
JOIN
(
SELECT
partition_date
,
device_os_type
AS
device_type
,
device_os_type
AS
device_type
,
CASE
WHEN
active_type
=
'4'
THEN
'老活'
,
CASE
WHEN
active_type
=
'4'
THEN
'老活跃设备'
WHEN
active_type
IN
(
'1'
,
'2'
)
THEN
'新增'
END
AS
active_type
WHEN
active_type
IN
(
'1'
,
'2'
)
THEN
'新增设备'
END
AS
active_type
,
array
(
CASE
WHEN
tmp
.
time
=
'AI'
THEN
'AI'
ELSE
'其他'
END
,
'合计'
)
as
channel
,
device_id
,
device_id
FROM
online
.
ml_device_day_active_status
FROM
online
.
ml_device_day_active_status
WHERE
partition_date
between
'20200401'
and
'20200408'
LEFT
JOIN
(
SELECT
phone
,
time
FROM
offline
.
tmp_zhx_20191227
WHERE
flag
=
'0204_danlei_channel'
)
tmp
on
first_channel_source_type
=
tmp
.
phone
WHERE
partition_date
>=
regexp_replace
((
current_date
-
interval
'90'
day
),
'-'
,
''
)
AND
partition_date
<
regexp_replace
((
current_date
),
'-'
,
''
)
AND
active_type
IN
(
'1'
,
'2'
,
'4'
)
AND
active_type
IN
(
'1'
,
'2'
,
'4'
)
AND
first_channel_source_type
not
IN
(
'yqxiu1'
,
'yqxiu2'
,
'yqxiu3'
,
'yqxiu4'
,
'yqxiu5'
,
'mxyc1'
,
'mxyc2'
,
'mxyc3'
AND
first_channel_source_type
not
IN
(
'yqxiu1'
,
'yqxiu2'
,
'yqxiu3'
,
'yqxiu4'
,
'yqxiu5'
,
'mxyc1'
,
'mxyc2'
,
'mxyc3'
,
'wanpu'
,
'jinshan'
,
'jx'
,
'maimai'
,
'zhuoyi'
,
'huatian'
,
'suopingjingling'
,
'mocha'
,
'mizhe'
,
'meika'
,
'lamabang'
,
'wanpu'
,
'jinshan'
,
'jx'
,
'maimai'
,
'zhuoyi'
,
'huatian'
,
'suopingjingling'
,
'mocha'
,
'mizhe'
,
'meika'
,
'lamabang'
...
@@ -12,6 +289,14 @@ WHERE partition_date between '20200401' and '20200408'
...
@@ -12,6 +289,14 @@ WHERE partition_date between '20200401' and '20200408'
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei
'
)
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei'
,
''
,
'unknown
'
)
AND
first_channel_source_type
not
LIKE
'promotion
\_
jf
\_
%'
AND
first_channel_source_type
not
LIKE
'promotion
\_
jf
\_
%'
limit
10
)
mas
\ No newline at end of file
ON
click
.
cl_id
=
mas
.
device_id
AND
click
.
partition_date
=
mas
.
partition_date
)
t1
LATERAL
VIEW
explode
(
t1
.
channel
)
t2
AS
channel
GROUP
BY
t1
.
partition_date
,
t1
.
device_type
,
t1
.
active_type
,
t2
.
channel
)
T1
ORDER
BY
`日期`
desc
,
`设备类型`
,
`活跃类型`
,
`渠道`
sqls/demo/demo_bak.sql
0 → 100644
View file @
7365fd13
SELECT
partition_date
,
device_os_type
AS
device_type
,
CASE
WHEN
active_type
=
'4'
THEN
'老活'
WHEN
active_type
IN
(
'1'
,
'2'
)
THEN
'新增'
END
AS
active_type
,
device_id
FROM
online
.
ml_device_day_active_status
WHERE
partition_date
between
'20200401'
and
'20200408'
AND
active_type
IN
(
'1'
,
'2'
,
'4'
)
AND
first_channel_source_type
not
IN
(
'yqxiu1'
,
'yqxiu2'
,
'yqxiu3'
,
'yqxiu4'
,
'yqxiu5'
,
'mxyc1'
,
'mxyc2'
,
'mxyc3'
,
'wanpu'
,
'jinshan'
,
'jx'
,
'maimai'
,
'zhuoyi'
,
'huatian'
,
'suopingjingling'
,
'mocha'
,
'mizhe'
,
'meika'
,
'lamabang'
,
'js-az1'
,
'js-az2'
,
'js-az3'
,
'js-az4'
,
'js-az5'
,
'jfq-az1'
,
'jfq-az2'
,
'jfq-az3'
,
'jfq-az4'
,
'jfq-az5'
,
'toufang1'
,
'toufang2'
,
'toufang3'
,
'toufang4'
,
'toufang5'
,
'toufang6'
,
'TF-toufang1'
,
'TF-toufang2'
,
'TF-toufang3'
,
'TF-toufang4'
,
'TF-toufang5'
,
'tf-toufang1'
,
'tf-toufang2'
,
'tf-toufang3'
,
'tf-toufang4'
,
'tf-toufang5'
,
'benzhan'
,
'promotion_aso100'
,
'promotion_qianka'
,
'promotion_xiaoyu'
,
'promotion_dianru'
,
'promotion_malioaso'
,
'promotion_malioaso-shequ'
,
'promotion_shike'
,
'promotion_julang_jl03'
,
'promotion_zuimei'
)
AND
first_channel_source_type
not
LIKE
'promotion
\_
jf
\_
%'
limit
10
\ 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