Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
messageflow
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
虞诚毅
messageflow
Commits
cfaf3818
Commit
cfaf3818
authored
Aug 02, 2018
by
shentao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2018/8/2 平台选配调整
parent
51394b16
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
131 deletions
+26
-131
src/main/java/com/zhiwei/messageflow/ES4RedisTask.java
+0
-0
src/main/java/com/zhiwei/messageflow/ES4RedisThread.java
+0
-130
src/main/java/com/zhiwei/messageflow/config/BossZhipingChannelList.java
+17
-0
src/main/java/com/zhiwei/messageflow/es/service/impl/NoiseProcessingServiceImpl.java
+8
-1
src/main/java/com/zhiwei/messageflow/mongo/bean/KeywordNew.java
+1
-0
No files found.
src/main/java/com/zhiwei/messageflow/ES4RedisTask.java
View file @
cfaf3818
This diff is collapsed.
Click to expand it.
src/main/java/com/zhiwei/messageflow/ES4RedisThread.java
deleted
100644 → 0
View file @
51394b16
package
com
.
zhiwei
.
messageflow
;
import
java.io.IOException
;
import
java.util.List
;
import
java.util.Timer
;
import
java.util.TimerTask
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
com.fasterxml.jackson.core.JsonParseException
;
import
com.fasterxml.jackson.databind.JsonMappingException
;
import
com.zhiwei.messageflow.mongo.bean.Project
;
public
class
ES4RedisThread
extends
Thread
{
private
final
static
Logger
log
=
LoggerFactory
.
getLogger
(
ES4RedisThread
.
class
);
// 线程
private
Thread
t
;
// 线程名
private
String
threadName
;
// 项目
private
Project
project
;
// 平台列表
private
List
<
String
>
platformNames
;
private
ES4RedisTask
es4RedisTask
;
// 单个平台单个关键词组每次查询数量
private
static
final
int
count
=
300
;
// private static final int max_Thread_num = 40;
// private static int Thread_num = 0;
// private static final int max_Running_num = 3;
// private static Integer Running_num = 0;
// private static List<String> ThreadList = new ArrayList<>();
public
ES4RedisThread
(
String
name
,
Project
project
,
List
<
String
>
platformNames
,
ES4RedisTask
es4RedisTask
)
{
threadName
=
name
;
this
.
project
=
project
;
this
.
platformNames
=
platformNames
;
this
.
es4RedisTask
=
es4RedisTask
;
}
public
ES4RedisThread
()
{
}
public
static
ES4RedisThread
getThread
(
String
name
,
Project
project
,
List
<
String
>
platformNames
,
ES4RedisTask
es4RedisTask
)
{
ES4RedisThread
es4RedisThread
=
new
ES4RedisThread
(
name
,
project
,
platformNames
,
es4RedisTask
);
return
es4RedisThread
;
}
public
void
start
()
{
// 线程开始
log
.
info
(
"Starting {}"
,
threadName
);
if
(
t
==
null
)
{
t
=
new
Thread
(
this
,
threadName
);
// 通知执行run方法
t
.
start
();
}
// 超时控制器
Timer
timer
=
new
Timer
();
timer
.
schedule
(
new
TimerTask
()
{
@Override
public
void
run
()
{
// 超时则线程中止
if
(
t
.
isAlive
())
{
t
.
interrupt
();
log
.
warn
(
"{}项目超时线程状态:{}"
,
project
.
getProjectName
(),
t
.
isInterrupted
());
}
}
},
49
*
1000L
);
}
@SuppressWarnings
(
"static-access"
)
@Override
public
void
run
()
{
try
{
Thread
.
sleep
(
10L
);
// 超时控制器
// Timer timer = new Timer();
// timer.schedule(new TimerTask() {
// @Override
// public void run() {
// // 超时则线程中止
// Thread.currentThread().interrupted();
// log.warn("{}项目超时", project.getProjectName());
// }
// }, 49 * 1000L);
// 程序运行
log
.
info
(
"Running {}"
,
threadName
);
// 该项目执行消息流获取
boolean
flag
=
es4RedisTask
.
ES4Redis
(
project
,
platformNames
,
count
);
if
(!
flag
)
{
// 程序执行出现异常则线程中止
// timer.cancel();
Thread
.
currentThread
().
interrupted
();
log
.
error
(
"{}项目出现异常,线程状态:{}"
,
project
.
getProjectName
(),
Thread
.
currentThread
().
isInterrupted
());
}
// else
// // 程序正常执行完毕,关闭超时控制器
// timer.cancel();
}
catch
(
JsonParseException
e
)
{
e
.
printStackTrace
();
}
catch
(
JsonMappingException
e
)
{
e
.
printStackTrace
();
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
catch
(
InterruptedException
e
)
{
e
.
printStackTrace
();
}
finally
{
// 线程退出
log
.
info
(
"Thread {} exiting."
,
threadName
);
}
}
}
\ No newline at end of file
src/main/java/com/zhiwei/messageflow/config/BossZhipingChannelList.java
0 → 100644
View file @
cfaf3818
package
com
.
zhiwei
.
messageflow
.
config
;
import
java.util.Arrays
;
import
java.util.List
;
public
class
BossZhipingChannelList
{
public
static
final
List
<
String
>
BOSSZPLIST
=
Arrays
.
asList
(
"人民日报"
,
"人民网"
,
"新华社"
,
"中新社"
,
"光明日报"
,
"光明网"
,
"中央人民广播电台"
,
"36氪"
,
"Techweb网"
,
"中国网"
,
"新京报网"
,
"新京报"
,
"法晚网"
,
"法制晚报"
,
"中国青年报"
,
"中青在线"
,
"经济生活网"
,
"经济日报"
,
"中国经济网"
,
"央视网"
,
"国际在线"
,
"京报网"
,
"北晨网"
,
"北京日报"
,
"北京青年报"
,
"北青网"
,
"北京晚报"
,
"北京晨报"
,
"上观新闻"
,
"解放日报"
,
"文汇报"
,
"新民晚报"
,
"新民网"
,
"文汇网"
,
"界面新闻"
,
"澎湃新闻"
,
"新闻晨报网"
,
"新闻晨报"
,
"南方网"
,
"奥一网"
,
"南方日报"
,
"南方都市报"
,
"21世纪经济报道"
,
"南方周末"
,
"金羊网"
,
"羊城晚报"
,
"四川在线"
,
"华西都市网"
,
"封面新闻"
,
"四川日报网"
,
"四川日报"
,
"成都商报"
,
"成都晚报"
,
"红星新闻"
,
"四川新闻网"
,
"现代快报网"
,
"现代快报"
,
"晚报"
,
"金陵晚报网"
,
"扬子晚报网"
,
"扬子晚报"
,
"今晚网"
,
"今晚报"
,
"三秦都市报"
,
"三秦网"
,
"钱江晚报"
,
"浙江24小时"
,
"腾讯科技"
,
"搜狐科技"
,
"凤凰科技"
,
"网易科技"
,
"新浪科技"
,
"好奇心日报"
,
"36Kr"
,
"虎嗅"
,
"钛媒体"
,
"AI财经社"
,
"腾讯财经"
,
"搜狐财经"
,
"凤凰财经"
,
"网易财经"
,
"新浪财经"
,
"财经网"
,
"财新网"
,
"Techweb"
,
"DoNews"
,
"亿欧网"
,
"投资界"
,
"ifanr"
,
"中国政府网"
,
"人社部"
,
"民政部"
,
"司法部"
,
"商务部"
,
"国家广电总局"
,
"国家市场监督管理总局"
,
"中国人民银行"
,
"教育部"
,
"科技部"
,
"工信部"
,
"公安部"
,
"国家知识产权局"
,
"首都之窗"
,
"天津政务网"
,
"中国上海"
,
"江苏省政府"
,
"四川省政府"
,
"广东省政府"
,
"浙江省政府"
,
"重庆市政府"
);
}
src/main/java/com/zhiwei/messageflow/es/service/impl/NoiseProcessingServiceImpl.java
View file @
cfaf3818
...
...
@@ -636,7 +636,11 @@ public class NoiseProcessingServiceImpl implements NoiseProcessingService {
String
text
=
map
.
get
(
"text"
)
!=
null
?
map
.
get
(
"text"
).
toString
()
:
null
;
String
roottext
=
map
.
get
(
"roottext"
)
!=
null
?
map
.
get
(
"roottext"
).
toString
()
:
null
;
String
username
=
map
.
get
(
"username"
)
!=
null
?
map
.
get
(
"username"
).
toString
()
:
null
;
boolean
isnoise
=
false
;
if
(
null
==
username
)
{
return
isnoise
;
}
if
(
noiseRules
!=
null
)
{
for
(
NoiseRule
n
:
noiseRules
)
{
/**
...
...
@@ -983,8 +987,11 @@ public class NoiseProcessingServiceImpl implements NoiseProcessingService {
String
text
=
map
.
get
(
"title"
)
!=
null
?
map
.
get
(
"title"
).
toString
()
:
null
;
String
roottext
=
map
.
get
(
"content"
)
!=
null
?
map
.
get
(
"content"
).
toString
()
:
null
;
String
username
=
map
.
get
(
"source"
)
!=
null
?
map
.
get
(
"source"
).
toString
()
:
null
;
boolean
isnoise
=
false
;
if
(
null
==
username
)
{
return
isnoise
;
}
if
(
noiseRules
!=
null
)
{
for
(
NoiseRule
n
:
noiseRules
)
{
/**
...
...
src/main/java/com/zhiwei/messageflow/mongo/bean/KeywordNew.java
View file @
cfaf3818
...
...
@@ -21,4 +21,5 @@ public class KeywordNew {
private
String
submitter
;
private
long
createAt
;
private
Boolean
isUsed
;
private
List
<
String
>
ptList
;
//平台列表
}
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