Commit 9cd5bde4 by caojingji

添加线程调取轨迹数据添加数据库中

parent 40b2aaaa
......@@ -5,16 +5,13 @@ import com.alibaba.fastjson.JSONObject;
import com.founder.interservice.service.IphoneTrackService;
import com.founder.interservice.util.DateUtil;
import com.founder.interservice.util.PropertieUtil;
import org.apache.http.client.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
@Component
......@@ -72,6 +69,7 @@ public class GetTrackTest {
String jssjNew = DateUtil.convertDateToString(calendar2.getTime());
PropertieUtil.writeProperties("trackDate.properties","kssj",kssjNew);
PropertieUtil.writeProperties("trackDate.properties","jssj",jssjNew);
PropertieUtil.writeProperties("trackDate.properties","sjhms",sjhmStr);
}catch (Exception e){
e.printStackTrace();
}
......
......@@ -268,8 +268,8 @@ public class IphoneTrackServiceImpl implements IphoneTrackService {
List<Track> tracks = data.subList(start, end); //从fromIndex(包含),到toIndex(不包含)
List<Track> paramTracks = new ArrayList<Track>();
for (Track track : tracks ) {
Track pTrack = new Track();
track.setId(track.getAddress()+track.getJ()+track.getW());
Track pTrack = new Track();
pTrack.setAddress(track.getAddress());
pTrack.setObjectvalue(track.getObjectvalue());
pTrack.setTimestamp(track.getTimestamp());
......
......@@ -3,7 +3,6 @@ package com.founder.interservice.tracktraveltogether.service.impl;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.founder.interservice.model.AutoTbStRy;
import com.founder.interservice.regionalanalysis.model.RegionalTaskResult;
import com.founder.interservice.regionalanalysis.model.RegionalTaskResultDetail;
import com.founder.interservice.service.IphoneTrackService;
import com.founder.interservice.tracktraveltogether.model.TogetherTaskResult;
......@@ -19,6 +18,8 @@ import org.springframework.data.jpa.domain.Specification;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import javax.persistence.criteria.*;
import java.util.ArrayList;
import java.util.Arrays;
......@@ -32,6 +33,7 @@ import java.util.List;
* @CreateDate: 2018-08-22 16:46
* @Version: 1.0
*/
@Transactional
@Component
@Async
public class TogetherScheduledService {
......@@ -112,8 +114,14 @@ public class TogetherScheduledService {
r.setXXZJBH(KeyUtil.getUniqueKey("TT"));
r.setDjsj(new Date());
}
taskResultRepository.save(taskResults);
getAndSaveRydetail(taskResults);
TogetherTaskResult param = new TogetherTaskResult();
param.setTaskId(task.getTaskId());
Example<TogetherTaskResult> example = Example.of(param);
List<TogetherTaskResult> results = taskResultRepository.findAll(example);
if(results == null || results.isEmpty()){
taskResultRepository.save(taskResults);
getAndSaveRydetail(taskResults);
}
}
}
}catch (Exception e){
......@@ -124,57 +132,61 @@ public class TogetherScheduledService {
/**
* 拿取到伴随的结果后 使用第四个接口调取关联数据
*/
public void getAndSaveRydetail(List<TogetherTaskResult> resultsList) throws Exception {
if (resultsList != null && !resultsList.isEmpty()) {
for (TogetherTaskResult result : resultsList) {
String objType = result.getObjectType();
String objValue = result.getObjectValue();
String objName = result.getObjectTypeName();
if (objValue != null && !"".equals(objValue)) {
//MAC地址、用户名、淘宝旺旺号不去调取关联数据,其它类型都使用第四个接口调取
if (!Arrays.asList("4329", "4342","45282").contains(objType)) {
JSONObject jsonObj = iphoneTrackService.getObjectRelationAll(objValue);//使用网安第三个接口调取关联数据
if (jsonObj != null && !jsonObj.isEmpty()) { //说明根节点是身份证号
RegionalTaskResultDetail detail = new RegionalTaskResultDetail();
detail.setTaskResultId(result.getXXZJBH());
detail.setXXZJBH(KeyUtil.getUniqueKey("EDZ"));
detail.setObjectType(objType);
detail.setObjectValue(objValue);
detail.setObjectTypeName(objName);
String objType2 = jsonObj.getString("objType");
String objValue2 = jsonObj.getString("objValue");
if("1".equals(objType2) && !objValue2.isEmpty()){
detail.setZjlxCode("004");
detail.setZjlx("身份证号");
detail.setZjhm(objValue2);
detail = getEdzxxForSfzh(detail); //获取二代证信息
//根据身份证判断是否存在 如果存在更新 不存在新增
RegionalTaskResultDetail param = new RegionalTaskResultDetail();
param.setObjectType(objType);
param.setObjectValue(objValue);
boolean isExist = togetherService.togetherDetailIsExist(param);
if (!isExist) {
togetherService.saveTogetherDetail(detail);
} else {
togetherService.updateTogetherDetail(detail);
}
}else if(Arrays.asList("20","4394","3996","6003").contains(objType2)){
//手机号码
detail.setSjhm(objValue2);
RegionalTaskResultDetail param = new RegionalTaskResultDetail();
param.setObjectType(objType);
param.setObjectValue(objValue);
boolean isExist = togetherService.togetherDetailIsExist(param);
if (!isExist) {
togetherService.saveTogetherDetail(detail);
} else {
togetherService.updateTogetherDetail(detail);
public void getAndSaveRydetail(List<TogetherTaskResult> resultsList){
try{
if (resultsList != null && !resultsList.isEmpty()) {
for (TogetherTaskResult result : resultsList) {
String objType = result.getObjectType();
String objValue = result.getObjectValue();
String objName = result.getObjectTypeName();
if (objValue != null && !"".equals(objValue)) {
//MAC地址、用户名、淘宝旺旺号不去调取关联数据,其它类型都使用第四个接口调取
if (!Arrays.asList("4329", "4342","45282").contains(objType)) {
JSONObject jsonObj = iphoneTrackService.getObjectRelationAll(objValue);//使用网安第三个接口调取关联数据
if (jsonObj != null && !jsonObj.isEmpty()) { //说明根节点是身份证号
RegionalTaskResultDetail detail = new RegionalTaskResultDetail();
detail.setTaskResultId(result.getXXZJBH());
detail.setXXZJBH(KeyUtil.getUniqueKey("EDZ"));
detail.setObjectType(objType);
detail.setObjectValue(objValue);
detail.setObjectTypeName(objName);
String objType2 = jsonObj.getString("objType");
String objValue2 = jsonObj.getString("objValue");
if("1".equals(objType2) && !objValue2.isEmpty()){
detail.setZjlxCode("004");
detail.setZjlx("身份证号");
detail.setZjhm(objValue2);
detail = getEdzxxForSfzh(detail); //获取二代证信息
//根据身份证判断是否存在 如果存在更新 不存在新增
RegionalTaskResultDetail param = new RegionalTaskResultDetail();
param.setObjectType(objType);
param.setObjectValue(objValue);
boolean isExist = togetherService.togetherDetailIsExist(param);
if (!isExist) {
togetherService.saveTogetherDetail(detail);
} else {
togetherService.updateTogetherDetail(detail);
}
}else if(Arrays.asList("20","4394","3996","6003").contains(objType2)){
//手机号码
detail.setSjhm(objValue2);
RegionalTaskResultDetail param = new RegionalTaskResultDetail();
param.setObjectType(objType);
param.setObjectValue(objValue);
boolean isExist = togetherService.togetherDetailIsExist(param);
if (!isExist) {
togetherService.saveTogetherDetail(detail);
} else {
togetherService.updateTogetherDetail(detail);
}
}
}
}
}
}
}
}catch (Exception e){
e.printStackTrace();
}
}
......
kssj=2019-02-01
jssj=2019-02-05
sjhms=15129457465,15129457465,15129457465
\ No newline at end of file
sjhms=864552034163647
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment