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
31c6cb65
Commit
31c6cb65
authored
Jul 31, 2020
by
马黎滨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
预警打印
parent
56a2d38e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
4 deletions
+25
-4
src/main/java/com/zhiwei/searchhotcrawler/util/TipsUtils.java
+25
-4
No files found.
src/main/java/com/zhiwei/searchhotcrawler/util/TipsUtils.java
View file @
31c6cb65
...
@@ -29,8 +29,9 @@ public class TipsUtils {
...
@@ -29,8 +29,9 @@ public class TipsUtils {
if
(!
typeTips
.
containsKey
(
type
)){
if
(!
typeTips
.
containsKey
(
type
)){
//发送预警
//发送预警
String
crawlerContent
=
String
.
format
(
"%s数据采集异常"
,
type
);
String
crawlerContent
=
String
.
format
(
"%s数据采集异常"
,
type
);
QYWechatUtil
.
send
(
key
,
QYWechatUtil
.
MSGTYPE_TEXT
,
crawlerContent
,
// QYWechatUtil.send(key, QYWechatUtil.MSGTYPE_TEXT, crawlerContent,
null
,
null
);
// null, null);
System
.
out
.
println
(
crawlerContent
);
}
}
typeTips
.
put
(
type
,
time
);
typeTips
.
put
(
type
,
time
);
}
}
...
@@ -46,9 +47,29 @@ public class TipsUtils {
...
@@ -46,9 +47,29 @@ public class TipsUtils {
typeTips
.
remove
(
type
);
typeTips
.
remove
(
type
);
//发送恢复通知
//发送恢复通知
String
crawlerContent
=
String
.
format
(
"%s数据采集恢复正常"
,
type
);
String
crawlerContent
=
String
.
format
(
"%s数据采集恢复正常"
,
type
);
QYWechatUtil
.
send
(
key
,
QYWechatUtil
.
MSGTYPE_TEXT
,
crawlerContent
,
// QYWechatUtil.send(key, QYWechatUtil.MSGTYPE_TEXT, crawlerContent,
null
,
null
);
// null, null);
System
.
out
.
println
(
crawlerContent
);
}
}
}
}
}
}
/**
* 从String类型中截取出热度值
* @param hotCountString
* @return
*/
public
static
Integer
getHotCount
(
String
hotCountString
){
Integer
count
;
if
(
hotCountString
.
contains
(
"万"
)){
hotCountString
=
hotCountString
.
replaceAll
(
"万.*"
,
""
).
trim
();
count
=
(
int
)(
Double
.
parseDouble
(
hotCountString
)*
10000
);
}
else
if
(
hotCountString
.
contains
(
"亿"
)){
hotCountString
=
hotCountString
.
replaceAll
(
"亿.*"
,
""
).
trim
();
count
=
(
int
)(
Double
.
parseDouble
(
hotCountString
)*
10000000
);
}
else
{
count
=
(
int
)(
Double
.
parseDouble
(
hotCountString
));
}
return
count
;
}
}
}
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