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
8b912371
Commit
8b912371
authored
Aug 03, 2020
by
马黎滨
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'mlbWork' into 'master'
微博话题采集修复 See merge request
!13
parents
7e9c499e
a7b132df
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
13 deletions
+15
-13
src/main/java/com/zhiwei/searchhotcrawler/util/TipsUtils.java
+15
-13
No files found.
src/main/java/com/zhiwei/searchhotcrawler/util/TipsUtils.java
View file @
8b912371
...
...
@@ -25,31 +25,33 @@ public class TipsUtils {
HotSearchListDAO
hotSearchListDAO
=
new
HotSearchListDAO
();
//获取数据库最后一条数据判断该程序几分钟没有采集到数据
Date
lastTime
=
hotSearchListDAO
.
getLastTimeByType
(
type
);
if
(
time
.
getTime
()
-
lastTime
.
getTime
()
>
timeDifference
){
if
(!
typeTips
.
containsKey
(
type
)){
if
(
lastTime
!=
null
)
{
if
(
time
.
getTime
()
-
lastTime
.
getTime
()
>
timeDifference
)
{
if
(!
typeTips
.
containsKey
(
type
))
{
//发送预警
String
crawlerContent
=
String
.
format
(
"%s数据采集异常"
,
type
);
// QYWechatUtil.send(key, QYWechatUtil.MSGTYPE_TEXT, crawlerContent,
// null, null);
System
.
out
.
println
(
crawlerContent
);
String
crawlerContent
=
String
.
format
(
"%s数据采集异常"
,
type
);
QYWechatUtil
.
send
(
key
,
QYWechatUtil
.
MSGTYPE_TEXT
,
crawlerContent
,
null
,
null
);
}
typeTips
.
put
(
type
,
time
);
}
typeTips
.
put
(
type
,
time
);
}
}
//数据采集恢复发送通知
public
static
void
recoveryTips
(
String
type
,
Date
time
){
if
(
typeTips
.
containsKey
(
type
)){
if
(
typeTips
.
containsKey
(
type
))
{
//最后一次未采集到数据的时间
Date
lastTime
=
typeTips
.
get
(
type
);
//两者比较,相差10分钟以上认为恢复采集
if
(
time
.
getTime
()
-
lastTime
.
getTime
()
>
timeDifference
){
if
(
lastTime
!=
null
)
{
if
(
time
.
getTime
()
-
lastTime
.
getTime
()
>
timeDifference
)
{
typeTips
.
remove
(
type
);
//发送恢复通知
String
crawlerContent
=
String
.
format
(
"%s数据采集恢复正常"
,
type
);
//
QYWechatUtil.send(key, QYWechatUtil.MSGTYPE_TEXT, crawlerContent,
//
null, null);
System
.
out
.
println
(
crawlerContent
);
String
crawlerContent
=
String
.
format
(
"%s数据采集恢复正常"
,
type
);
QYWechatUtil
.
send
(
key
,
QYWechatUtil
.
MSGTYPE_TEXT
,
crawlerContent
,
null
,
null
);
}
}
}
}
...
...
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