Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
bigdatainterservice
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
曹鹏
bigdatainterservice
Commits
053e7f81
Commit
053e7f81
authored
May 16, 2019
by
caoyin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master' into master_local
parents
d0c2e96a
37d55dd9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
55 deletions
+37
-55
src/main/java/com/founder/interservice/regionalanalysis/service/impl/ScheduledService.java
+37
-55
No files found.
src/main/java/com/founder/interservice/regionalanalysis/service/impl/ScheduledService.java
View file @
053e7f81
...
...
@@ -9,10 +9,9 @@ import com.founder.interservice.regionalanalysis.model.RegionalTaskResultDetail;
import
com.founder.interservice.regionalanalysis.repository.RegionalTaskRepository
;
import
com.founder.interservice.regionalanalysis.repository.RegionalTaskResultRepository
;
import
com.founder.interservice.regionalanalysis.service.RegionalAnalysisService
;
import
com.founder.interservice.service.
IphoneTrack
Service
;
import
com.founder.interservice.service.
PushWaData
Service
;
import
com.founder.interservice.util.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Scheduled
;
...
...
@@ -32,19 +31,14 @@ import java.util.*;
@Async
public
class
ScheduledService
{
@Value
(
value
=
"${wabigdata.regionalAnalysisTaskStatus.url}"
)
private
String
REGIONAL_ANALYSIS_TASK_STATUS
;
//获取任务状态
@Value
(
value
=
"${wabigdata.regionalAnalysisTaskInfo.url}"
)
private
String
REGIONAL_ANALYSIS_TASK_INFO
;
//获取任务结果
@Autowired
private
PushWaDataService
pushWaDataService
;
@Autowired
private
RegionalAnalysisService
regionalAnalysisService
;
@Autowired
private
RegionalTaskRepository
regionalTaskRepository
;
@Autowired
private
RegionalTaskResultRepository
taskResultRepository
;
@Autowired
private
IphoneTrackService
iphoneTrackService
;
//调取网安数据接口
/**
*
...
...
@@ -76,17 +70,14 @@ public class ScheduledService {
System
.
out
.
println
(
"taskList====================================="
+
taskList
);
if
(
taskList
!=
null
&&
!
taskList
.
isEmpty
()){
String
taskId
=
null
,
progress
=
null
,
state
=
null
,
result
=
null
;
Map
<
String
,
String
>
taskMap
=
null
;
for
(
RegionalTask
task:
taskList
)
{
taskId
=
task
.
getTaskId
();
//查询比对结果状态
taskMap
=
queryTaskStates
(
taskId
);
taskMap
=
this
.
queryTaskStates
(
taskId
);
progress
=
taskMap
.
get
(
"progress"
);
state
=
taskMap
.
get
(
"state"
);
if
(
"1"
.
equals
(
progress
)
&&
"FINISHED"
.
equals
(
state
)){
String
info_url
=
REGIONAL_ANALYSIS_TASK_INFO
+
"&taskId="
+
taskId
;
String
taskInfoResult
=
HttpUtil
.
getWaData
(
info_url
);
//String taskInfoResult = "{\"results\":[],\"status\":\"ok\"}";
String
taskInfoResult
=
pushWaDataService
.
getRegionalTaskInfo
(
taskId
);
//调取结果成功 然后将结果保存入库
if
(!
taskInfoResult
.
startsWith
(
"Rate"
)){
if
(
null
!=
taskInfoResult
&&
taskInfoResult
.
startsWith
(
"{"
)){
...
...
@@ -103,6 +94,30 @@ public class ScheduledService {
}
/**
* 调用新版接口获取任务状态
* @param taskId
* @return
*/
public
Map
<
String
,
String
>
queryTaskStates
(
String
taskId
){
JSONObject
jsonObject
=
null
;
String
progress
=
null
,
state
=
null
;
Map
<
String
,
String
>
map
=
new
HashMap
();
String
result
=
pushWaDataService
.
pushTaskStatus
(
taskId
,
0
);
if
(
null
!=
result
&&
result
.
startsWith
(
"{"
)){
jsonObject
=
JSONObject
.
parseObject
(
result
);
}
if
(
jsonObject
!=
null
){
JSONObject
JSONObjectData
=
jsonObject
.
getJSONObject
(
"data"
);
progress
=
JSONObjectData
.
getString
(
"progress"
);
//进度
state
=
JSONObjectData
.
getString
(
"state"
);
//状态
}
map
.
put
(
"progress"
,
progress
);
map
.
put
(
"state"
,
state
);
return
map
;
}
/**
* 第二步,调取标识号的关联信息
* 1.将比对碰撞首次调取标识号成功的任务过滤出来即状态位为FINISHED的
* 2.开启新线程调取标识号的关联数据
...
...
@@ -123,9 +138,6 @@ public class ScheduledService {
return
criteriaQuery
.
getRestriction
();
}
});
System
.
out
.
println
(
"开始查询ddddd============================================================"
);
System
.
out
.
println
(
taskList
);
if
(
taskList
!=
null
&&
!
taskList
.
isEmpty
()){
for
(
RegionalTask
task:
taskList
)
{
List
<
RegionalTaskResult
>
taskResults
=
taskResultRepository
.
findAllByTaskId
(
task
.
getTaskId
());
...
...
@@ -138,14 +150,6 @@ public class ScheduledService {
e
.
printStackTrace
();
}
}
/**
* 通过区域碰撞的结果 使用第四个接口调取关联数据
*/
...
...
@@ -159,8 +163,13 @@ public class ScheduledService {
if
(
objValue
!=
null
&&
!
""
.
equals
(
objValue
))
{
//MAC地址、用户名、淘宝旺旺号不去调取关联数据,其它类型都使用第四个接口调取
if
(!
Arrays
.
asList
(
"4329"
,
"4342"
,
"45282"
).
contains
(
objType
))
{
JSONObject
jsonObj
=
iphoneTrackService
.
getObjectRelationAll
(
objValue
);
//使用网安第三个接口调取关联数据
if
(
jsonObj
!=
null
&&
!
jsonObj
.
isEmpty
())
{
//说明根节点是身份证号
JSONObject
jsonObj
=
null
;
String
relationAll
=
pushWaDataService
.
pushRelationAll
(
DateUtil
.
getYYYYMMDDHHMM
(),
DateUtil
.
getYYYYMMDDHHMM
(),
"admin"
,
objValue
,
3
);
if
(
null
!=
relationAll
&&
relationAll
.
startsWith
(
"{"
)){
JSONObject
json
=
JSONObject
.
parseObject
(
relationAll
);
jsonObj
=
json
.
getJSONObject
(
"data"
);
}
if
(
jsonObj
!=
null
&&
!
jsonObj
.
isEmpty
())
{
RegionalTaskResultDetail
detail
=
new
RegionalTaskResultDetail
();
detail
.
setTaskResultId
(
result
.
getXXZJBH
());
detail
.
setXXZJBH
(
KeyUtil
.
getUniqueKey
(
"EDZ"
));
...
...
@@ -235,7 +244,7 @@ public class ScheduledService {
public
void
getAndSaveInfo
(
String
taskInfoResult
,
RegionalTask
task
)
throws
RuntimeException
{
try
{
JSONObject
o
=
JSONObject
.
parseObject
(
taskInfoResult
);
JSONArray
jsonArray
=
o
.
getJSONArray
(
"results"
);
JSONArray
jsonArray
=
o
.
getJSON
Object
(
"data"
).
getJSON
Array
(
"results"
);
if
(
jsonArray
!=
null
&&
jsonArray
.
size
()
>
0
){
List
<
RegionalTaskResult
>
taskResults
=
jsonArray
.
toJavaList
(
RegionalTaskResult
.
class
);
taskResults
=
removeDuplicate
(
taskResults
);
...
...
@@ -260,33 +269,6 @@ public class ScheduledService {
}
}
/**
* 查询任务状态
* @param taskId
* @return
*/
public
Map
<
String
,
String
>
queryTaskStates
(
String
taskId
){
JSONObject
jsonObject
=
null
;
String
progress
=
null
,
state
=
null
;
Map
<
String
,
String
>
map
=
new
HashMap
();
String
status_url
=
REGIONAL_ANALYSIS_TASK_STATUS
+
"&taskId="
+
taskId
;
String
result
=
HttpUtil
.
getWaData
(
status_url
);
//String statusStr = "{\"progress\":0.8,\"state\":\"TIMEOUT\"}";
if
(
null
!=
result
&&
result
.
startsWith
(
"{"
)){
jsonObject
=
JSONObject
.
parseObject
(
result
);
}
if
(
jsonObject
!=
null
){
progress
=
jsonObject
.
getString
(
"progress"
);
//进度
state
=
jsonObject
.
getString
(
"state"
);
//状态
}
map
.
put
(
"progress"
,
progress
);
map
.
put
(
"state"
,
state
);
return
map
;
}
/**
* 去除重复数据
* @param list
...
...
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