Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
searchhotcrawler
Overview
Overview
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
zhiwei
searchhotcrawler
Commits
15c8f6d1
Commit
15c8f6d1
authored
May 04, 2018
by
zhiwei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
推送时间修改
parent
58bf7554
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
5 deletions
+11
-5
src/main/java/com/zhiwei/searchhotcrawler/run/HotSearchRun.java
+1
-1
src/main/java/com/zhiwei/searchhotcrawler/timer/SendWeiboHotSearchRun.java
+5
-3
src/main/java/com/zhiwei/searchhotcrawler/timer/SendZhihuHotSearchRun.java
+5
-1
No files found.
src/main/java/com/zhiwei/searchhotcrawler/run/HotSearchRun.java
View file @
15c8f6d1
...
...
@@ -16,7 +16,7 @@ public class HotSearchRun {
private
ScheduledExecutorService
scheduExec
;
public
HotSearchRun
()
{
this
.
scheduExec
=
Executors
.
newScheduledThreadPool
(
1
);
this
.
scheduExec
=
Executors
.
newScheduledThreadPool
(
4
);
}
public
void
showTimer
()
{
...
...
src/main/java/com/zhiwei/searchhotcrawler/timer/SendWeiboHotSearchRun.java
View file @
15c8f6d1
...
...
@@ -20,21 +20,23 @@ public class SendWeiboHotSearchRun extends Thread{
@Override
public
void
run
()
{
List
<
DBObject
>
list
=
weiboHotSearchDAO
.
getWeiboHotOneHour
();
Calendar
calendar
=
Calendar
.
getInstance
();
int
hour
=
calendar
.
get
(
Calendar
.
HOUR_OF_DAY
);
System
.
out
.
println
(
"微博推送,当前系统时间为:"
+
hour
);
if
(
hour
>
6
&&
hour
<
23
){
List
<
DBObject
>
list
=
weiboHotSearchDAO
.
getWeiboHotOneHour
();
if
(
list
!=
null
&&
list
.
size
()>
0
){
for
(
DBObject
weibo
:
list
){
String
title
=
weibo
.
get
(
"name"
).
toString
();
String
time
=
TimeParse
.
dateFormartString
((
Date
)
weibo
.
get
(
"time"
),
"yyyy-MM-dd HH:mm:ss"
);
String
url
=
weibo
.
get
(
"url"
).
toString
();
if
(
calendar
.
get
(
Calendar
.
HOUR_OF_DAY
)
>
6
&&
calendar
.
get
(
Calendar
.
HOUR_OF_DAY
)
<
23
){
sendTemplateByUserIds
(
title
,
time
,
url
);
}
}
}
else
{
sendTemplateByUserIds
(
"最近一小时无数据"
,
TimeParse
.
dateFormartString
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
),
null
);
}
}
}
/**
* @Title: sendTemplateByUserIds
...
...
src/main/java/com/zhiwei/searchhotcrawler/timer/SendZhihuHotSearchRun.java
View file @
15c8f6d1
...
...
@@ -19,8 +19,11 @@ public class SendZhihuHotSearchRun extends Thread{
private
ZhihuHotSearchDAO
zhihuHotSearchDAO
=
new
ZhihuHotSearchDAO
();
@Override
public
void
run
()
{
List
<
DBObject
>
list
=
zhihuHotSearchDAO
.
getZhiHuHotSearch
();
Calendar
calendar
=
Calendar
.
getInstance
();
int
hour
=
calendar
.
get
(
Calendar
.
HOUR_OF_DAY
);
System
.
out
.
println
(
"知乎推送,当前系统时间为:"
+
hour
);
if
(
hour
>
6
&&
hour
<
23
){
List
<
DBObject
>
list
=
zhihuHotSearchDAO
.
getZhiHuHotSearch
();
if
(
list
!=
null
&&
list
.
size
()>
0
){
for
(
DBObject
zhihu
:
list
){
String
title
=
zhihu
.
get
(
"display_query"
).
toString
();
...
...
@@ -34,6 +37,7 @@ public class SendZhihuHotSearchRun extends Thread{
sendTemplateByUserIds
(
"最近一小时无数据"
,
TimeParse
.
dateFormartString
(
new
Date
(),
"yyyy-MM-dd HH:mm:ss"
),
null
);
}
}
}
/**
* @Title: sendTemplateByUserIds
...
...
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