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
e2d42a35
Commit
e2d42a35
authored
Aug 02, 2019
by
libin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加对手机号等信息的时空伴随功能
parent
8d0262e9
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
236 additions
and
5 deletions
+236
-5
src/main/java/com/founder/interservice/tracktraveltogether/controller/TrackTogetherContoller.java
+14
-0
src/main/java/com/founder/interservice/tracktraveltogether/service/TrackTogetherService.java
+2
-0
src/main/java/com/founder/interservice/tracktraveltogether/service/impl/TrackTogetherServiceImpl.java
+66
-4
src/main/java/com/founder/interservice/util/WaBigDataParseUtil.java
+154
-0
src/main/webapp/WEB-INF/jsp/gjbs/Insert.jsp
+0
-1
No files found.
src/main/java/com/founder/interservice/tracktraveltogether/controller/TrackTogetherContoller.java
View file @
e2d42a35
...
...
@@ -575,6 +575,10 @@ public class TrackTogetherContoller {
Date
jssj
=
endTime
.
contains
(
" "
)
?
DateUtil
.
convertStringToDateTime
(
endTime
)
:
DateUtil
.
convertStringToDate
(
endTime
);
trackParam
.
setEndTime
(
jssj
);
trackParam
.
setDjsj
(
new
Date
());
String
IMSI
=
translateToIMSI
(
trackParam
.
getObjectValue
(),
trackParam
.
getObjectType
());
if
(
StringUtils
.
isEmpty
(
IMSI
)){
throw
new
InterServiceException
(
ResultEnum
.
TASK_SEND_ERROR
);
}
taskId
=
trackTogetherService
.
sendTrackTogetherTask
(
trackParam
);
//发送任务 并且得到任务编号
if
(!
StringUtil
.
ckeckEmpty
(
taskId
)
&&
!
taskId
.
startsWith
(
"R"
)
&&
!
"null"
.
equals
(
taskId
)){
trackParam
.
setTaskId
(
taskId
);
...
...
@@ -615,5 +619,15 @@ public class TrackTogetherContoller {
return
trackTogetherService
.
tjhmTogether
(
entity
);
}
private
String
translateToIMSI
(
String
num
,
String
type
){
String
imsi
=
""
;
if
(
"4314"
.
equals
(
type
)){
imsi
=
num
;
}
else
{
imsi
=
trackTogetherService
.
getIMSIFromNum
(
num
);
}
return
imsi
;
}
}
src/main/java/com/founder/interservice/tracktraveltogether/service/TrackTogetherService.java
View file @
e2d42a35
...
...
@@ -53,4 +53,6 @@ public interface TrackTogetherService {
public
ResultMap
tjryTogether
(
RegionalTaskResultDetail
entity
);
public
ResultMap
tjhmTogether
(
RegionalTaskResultDetail
entity
);
public
String
getIMSIFromNum
(
String
num
);
}
src/main/java/com/founder/interservice/tracktraveltogether/service/impl/TrackTogetherServiceImpl.java
View file @
e2d42a35
...
...
@@ -9,6 +9,7 @@ import com.founder.interservice.mapper.xzxt.RegionalTaskResultDetailMapper;
import
com.founder.interservice.mapper.xzxt.RegionalTaskResultMapper
;
import
com.founder.interservice.mapper.xzxt.TogetherTaskResultMapper
;
import
com.founder.interservice.mapper.xzxt.TrackTogetherMapper
;
import
com.founder.interservice.model.Relation
;
import
com.founder.interservice.model.TbStAsj
;
import
com.founder.interservice.regionalanalysis.model.RegionalTaskResultDetail
;
import
com.founder.interservice.tracktraveltogether.model.TogetherTaskResult
;
...
...
@@ -19,6 +20,7 @@ import com.founder.interservice.tracktraveltogether.service.TrackTogetherService
import
com.founder.interservice.util.HttpClient
;
import
com.founder.interservice.util.HttpUtil
;
import
com.founder.interservice.util.StringUtil
;
import
com.founder.interservice.util.WaBigDataParseUtil
;
import
org.apache.commons.collections.map.HashedMap
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
...
...
@@ -29,12 +31,10 @@ import org.springframework.data.domain.Sort;
import
org.springframework.data.jpa.domain.Specification
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.StringUtils
;
import
javax.persistence.criteria.*
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
/**
* @ClassName: TrackTogetherServiceImpl
...
...
@@ -51,6 +51,8 @@ public class TrackTogetherServiceImpl implements TrackTogetherService {
private
String
TOGETHER_TASK_URL
;
@Value
(
value
=
"${map.url}"
)
private
String
mapUrl
;
@Value
(
value
=
"${wabigdata.objectrelation.url}"
)
private
String
objectRelationUrl
;
@Autowired
private
TrackTogetherTaskRepository
taskRepository
;
...
...
@@ -516,4 +518,64 @@ public class TrackTogetherServiceImpl implements TrackTogetherService {
}
return
resultMap
;
}
@Override
public
String
getIMSIFromNum
(
String
num
)
{
String
imsi
=
""
;
String
url
=
objectRelationUrl
+
"&objectValue="
+
num
;
String
result
=
HttpUtil
.
getWaData
(
url
);
List
<
Map
<
String
,
String
>>
allIMSI
=
new
ArrayList
<>();
if
(!
StringUtils
.
isEmpty
(
result
)){
List
<
Relation
>
relationList
=
WaBigDataParseUtil
.
parseRelation
(
result
);
if
(
relationList
!=
null
&&
!
relationList
.
isEmpty
()){
for
(
Relation
relation:
relationList
){
String
type
=
relation
.
getObjecttotype
();
String
value
=
relation
.
getObjecttovalue
();
String
relatedTime
=
relation
.
getTimestamp
();
if
(
"4314"
.
equals
(
type
)){
Map
<
String
,
String
>
imsiNum
=
new
HashMap
<>();
if
(!
StringUtils
.
isEmpty
(
value
)){
imsiNum
.
put
(
"IMSI"
,
value
);
imsiNum
.
put
(
"time"
,
relatedTime
);
allIMSI
.
add
(
imsiNum
);
}
}
}
}
}
if
(!
allIMSI
.
isEmpty
()){
try
{
allIMSI
.
sort
(
new
Comparator
<
Map
<
String
,
String
>>()
{
@Override
public
int
compare
(
Map
<
String
,
String
>
o1
,
Map
<
String
,
String
>
o2
)
{
if
(
o1
==
null
&&
o2
==
null
){
return
0
;
}
else
if
(
o1
==
null
&&
o2
!=
null
){
return
1
;
}
else
if
(
o1
!=
null
&&
o2
==
null
){
return
-
1
;
}
else
{
String
time1
=
o1
.
get
(
"time"
);
String
time2
=
o2
.
get
(
"time"
);
if
(
StringUtils
.
isEmpty
(
time1
)
&&
StringUtils
.
isEmpty
(
time2
)){
return
0
;
}
else
if
(
StringUtils
.
isEmpty
(
time1
)
&&
!
StringUtils
.
isEmpty
(
time2
)){
return
1
;
}
else
if
(!
StringUtils
.
isEmpty
(
time1
)
&&
StringUtils
.
isEmpty
(
time2
)){
return
-
1
;
}
else
{
Long
time1L
=
Long
.
parseLong
(
time1
);
Long
time2L
=
Long
.
parseLong
(
time2
);
return
time1L
-
time1L
>
0
?-
1
:
1
;
}
}
}
});
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
imsi
=
allIMSI
.
get
(
0
).
get
(
"IMSI"
);
}
return
imsi
;
}
}
src/main/java/com/founder/interservice/util/WaBigDataParseUtil.java
0 → 100644
View file @
e2d42a35
package
com
.
founder
.
interservice
.
util
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.founder.interservice.model.Relation
;
import
com.founder.interservice.model.Track
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.util.StringUtils
;
import
java.util.*
;
/**
* 解析网安返回数据工具。
*/
public
class
WaBigDataParseUtil
{
private
static
Logger
logger
=
LoggerFactory
.
getLogger
(
WaBigDataParseUtil
.
class
);
/**
* 解析网安全部关联关系功能
* @param jsonResult
* @return 返回以objType为key,objValue为值的键值对列表,包含所有节点。
*/
public
static
List
<
Map
<
String
,
String
>>
parseRelationAll
(
String
jsonResult
){
List
<
Map
<
String
,
String
>>
result
=
new
ArrayList
<>();
if
(!
StringUtils
.
isEmpty
(
jsonResult
)&&
jsonResult
.
startsWith
(
"{"
))
{
try
{
JSONObject
jsonObject
=
JSON
.
parseObject
(
jsonResult
);
if
(
jsonObject
!=
null
&&
jsonObject
.
getBoolean
(
"success"
))
{
JSONObject
data
=
jsonObject
.
getJSONObject
(
"data"
);
if
(
data
!=
null
)
{
result
=
parseRelationAll
(
data
);
}
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
return
result
;
}
/**
* 解析网安轨迹返回数据,获取经纬度信息
* @param trackJson 网安经纬度接口返回结果
* @return
*/
public
static
List
<
Track
>
parseTrackJwdPoint
(
String
trackJson
)
{
List
<
Track
>
jwdPoints
=
new
ArrayList
<>();
JSONObject
jsonObject
=
JSON
.
parseObject
(
trackJson
);
if
(
jsonObject
.
getBoolean
(
"success"
)){
JSONArray
data
=
jsonObject
.
getJSONArray
(
"data"
);
if
(
data
!=
null
&&!
data
.
isEmpty
()){
Iterator
iterator
=
data
.
iterator
();
while
(
iterator
.
hasNext
()){
Object
o
=
iterator
.
next
();
logger
.
info
(
"track data object:"
+
JSON
.
toJSONString
(
o
));
JSONObject
job
=(
JSONObject
)
o
;
Double
j
=
job
.
getDouble
(
"j"
);
Double
w
=
job
.
getDouble
(
"w"
);
//jwdPoints.add(jwd);
Track
track
=
new
Track
();
track
.
setBase
(
job
.
getString
(
"base"
));
track
.
setAddress
(
job
.
getString
(
"address"
));
track
.
setJ
(
Double
.
toString
(
job
.
getDouble
(
"j"
)));
track
.
setW
(
Double
.
toString
(
job
.
getDouble
(
"w"
)));
track
.
setObjecttype
(
job
.
getString
(
"objectType"
));
track
.
setObjecttypename
(
job
.
getString
(
"objectTypeName"
));
track
.
setObjectvalue
(
job
.
getString
(
"objectValue"
));
track
.
setSourcename
(
job
.
getString
(
"sourceName"
));
track
.
setSource
(
job
.
getString
(
"source"
));
track
.
setSource_md5
(
job
.
getString
(
"source_md5"
));
track
.
setTimestamp
(
job
.
getLongValue
(
"timestamp"
));
jwdPoints
.
add
(
track
);
logger
.
info
(
"track jwd:"
+
JSON
.
toJSONString
(
track
));
}
}
}
return
jwdPoints
;
}
/**
* 解析网安relation接口返回数据
* @param jsonResult
* @return
*/
public
static
List
<
Relation
>
parseRelation
(
String
jsonResult
){
List
<
Relation
>
result
=
new
ArrayList
<>();
if
(!
StringUtils
.
isEmpty
(
jsonResult
)&&
jsonResult
.
startsWith
(
"{"
)){
JSONObject
jsonObject
=
JSON
.
parseObject
(
jsonResult
);
if
(
jsonObject
!=
null
&&
jsonObject
.
getBoolean
(
"success"
))
{
JSONArray
data
=
jsonObject
.
getJSONArray
(
"data"
);
if
(
data
!=
null
&&
!
data
.
isEmpty
())
{
Iterator
iterator
=
data
.
iterator
();
while
(
iterator
.
hasNext
()){
JSONObject
job
=(
JSONObject
)
iterator
.
next
();
if
(
job
!=
null
){
Relation
relation
=
new
Relation
();
relation
.
setObjecttovalue
(
job
.
getString
(
"objectToValue"
));
relation
.
setObjectfromvalue
(
job
.
getString
(
"objectFromValue"
));
relation
.
setObjecttotypename
(
job
.
getString
(
"objectToTypeName"
));
relation
.
setObjectfromtypename
(
job
.
getString
(
"objectFromTypeName"
));
relation
.
setObjecttotype
(
job
.
getString
(
"objectToType"
));
relation
.
setObjectfromtype
(
job
.
getString
(
"objectFromType"
));
relation
.
setRelativetype
(
job
.
getString
(
"relativeType"
));
relation
.
setRelativetypename
(
job
.
getString
(
"relativeTypeName"
));
relation
.
setSourcename
(
job
.
getString
(
"sourceName"
));
relation
.
setSource
(
job
.
getString
(
"source"
));
relation
.
setSource_md5
(
job
.
getString
(
"source_md5"
));
relation
.
setTimestamp
(
job
.
getString
(
"timestamp"
));
relation
.
setFirst_timestamp
(
job
.
getString
(
"first_timestamp"
));
relation
.
setCount
(
job
.
getString
(
"count"
));
result
.
add
(
relation
);
}
}
}
}
}
return
result
;
}
private
static
List
<
Map
<
String
,
String
>>
parseRelationAll
(
JSONObject
data
){
List
<
Map
<
String
,
String
>>
result
=
new
ArrayList
<>();
if
(
data
!=
null
){
String
objType
=
data
.
getString
(
"objType"
);
String
objValue
=
data
.
getString
(
"objValue"
);
JSONArray
children
=
data
.
getJSONArray
(
"children"
);
Map
<
String
,
String
>
map
=
new
HashMap
<>();
if
(!
StringUtils
.
isEmpty
(
objValue
)){
map
.
put
(
objType
,
objValue
);
result
.
add
(
map
);
}
if
(
children
!=
null
&&
!
children
.
isEmpty
()){
Iterator
iterator
=
children
.
iterator
();
while
(
iterator
.
hasNext
()){
JSONObject
subdata
=(
JSONObject
)
iterator
.
next
();
List
<
Map
<
String
,
String
>>
subResult
=
parseRelationAll
(
subdata
);
result
.
addAll
(
subResult
);
}
}
else
{
return
result
;
}
}
return
result
;
}
}
src/main/webapp/WEB-INF/jsp/gjbs/Insert.jsp
View file @
e2d42a35
...
...
@@ -40,7 +40,6 @@
<input type = "hidden" name="yhCate" id = "yhCate" value="00" />
<input type = "hidden" name="projectName" id = "projectName" value="00" />
<fieldset>
<legend>采集时空伴随任务信息 </legend>
<table class="sp_table" width="100%">
<tbody>
<tr>
...
...
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