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,10 +114,16 @@ public class TogetherScheduledService {
r.setXXZJBH(KeyUtil.getUniqueKey("TT"));
r.setDjsj(new Date());
}
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){
throw new RuntimeException(e);
}
......@@ -124,7 +132,8 @@ public class TogetherScheduledService {
/**
* 拿取到伴随的结果后 使用第四个接口调取关联数据
*/
public void getAndSaveRydetail(List<TogetherTaskResult> resultsList) throws Exception {
public void getAndSaveRydetail(List<TogetherTaskResult> resultsList){
try{
if (resultsList != null && !resultsList.isEmpty()) {
for (TogetherTaskResult result : resultsList) {
String objType = result.getObjectType();
......@@ -176,6 +185,9 @@ public class TogetherScheduledService {
}
}
}
}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