Commit c30d73ef by libin

解析网安返回数据工具修改,返回结果排序方法修改。

parent 7bc7b0ab
......@@ -575,9 +575,12 @@ 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());
String objectValue=trackParam.getObjectValue();
String IMSI=translateToIMSI(objectValue,trackParam.getObjectType());
if(StringUtils.isEmpty(IMSI)){
throw new InterServiceException(ResultEnum.TASK_SEND_ERROR);
}else{
trackParam.setObjectValue(IMSI);
}
taskId = trackTogetherService.sendTrackTogetherTask(trackParam); //发送任务 并且得到任务编号
if(!StringUtil.ckeckEmpty(taskId) && !taskId.startsWith("R") && !"null".equals(taskId)){
......@@ -585,6 +588,7 @@ public class TrackTogetherContoller {
}else{
throw new InterServiceException(ResultEnum.TASK_SEND_ERROR);
}
trackParam.setObjectValue(objectValue);
trackParam.setProgress("0");
trackParam.setState("QUEUEING");
trackParam.setFsrJh(fsrjh);
......@@ -619,7 +623,7 @@ public class TrackTogetherContoller {
return trackTogetherService.tjhmTogether(entity);
}
private String translateToIMSI(String num,String type){
public String translateToIMSI(String num,String type){
String imsi="";
if("4314".equals(type)){
imsi=num;
......
package com.founder.interservice.tracktraveltogether.service.impl;
import com.alibaba.fastjson.JSON;
import com.founder.interservice.VO.ResultMap;
import com.founder.interservice.exception.InterServiceException;
import com.founder.interservice.enums.ResultEnum;
......@@ -545,36 +546,26 @@ public class TrackTogetherServiceImpl implements TrackTogetherService {
}
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;
}
}
List<Long> timeList=new ArrayList<>();
for(Map<String,String> imsiM:allIMSI){
String time=imsiM.get("time");
Long timeL=Long.parseLong(time);
timeList.add(timeL);
}
int index=0;
Long time0=timeList.get(0);
for(int i=0;i<timeList.size();i++){
Long time=timeList.get(i);
if(time>time0){
time0=time;
index=i;
}
});
}
imsi=allIMSI.get(index).get("IMSI");
} catch (Exception e) {
e.printStackTrace();
imsi=allIMSI.get(0).get("IMSI");
}
imsi=allIMSI.get(0).get("IMSI");
}
return imsi;
}
......
......@@ -135,7 +135,7 @@ public class WaBigDataParseUtil {
List<Relation> result=new ArrayList<>();
if(!StringUtils.isEmpty(jsonResult)&&jsonResult.startsWith("{")){
JSONObject jsonObject=JSON.parseObject(jsonResult);
if(jsonObject!=null && "OK".equals(jsonObject.getString("status"))) {
if(jsonObject!=null && "OK".equals(jsonObject.getString("status").toUpperCase())) {
JSONArray data = jsonObject.getJSONArray("results");
if (data != null && !data.isEmpty()) {
Iterator iterator=data.iterator();
......
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