Commit 011edd3d by yangyang

车辆轨迹(内蒙)

parent 678ade42
......@@ -4,10 +4,13 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.founder.commonutils.model.newPublicEntity.SkTrail;
import com.founder.commonutils.model.nmDataEntity.ParamsEntity.FaceRxbdSearchParam;
import com.founder.commonutils.model.nmDataEntity.ResultEntity.MyRyGjxx;
import com.founder.commonutils.model.nmDataEntity.ResultEntity.MySjGjxx;
import com.founder.commonutils.model.vo.response.SkTrailVO;
import com.founder.commonutils.util.DateUtil;
import com.founder.commonutils.util.HttpClient;
import com.founder.commonutils.util.TokenUtils;
import com.founder.publicapi.mapper.oracleXzxtMapper.SysDictitemMapper;
import com.founder.publicapi.service.SkPointlocationService;
import org.apache.commons.lang.StringUtils;
......@@ -393,6 +396,103 @@ public class InterfaceAPI {
return listResult;
}
// 紫光
public List<SkTrailVO> getClgjZg(HttpServletRequest request,String objectValue, String startDate,
String endDate,
@RequestParam(value = "page",
defaultValue = "1") int page,
@RequestParam(value = "rows",
defaultValue = "1000") int rows) {
List<SkTrailVO> listResult = new ArrayList<>();
List<SkTrail> points = new ArrayList<>();
//循环请求
Boolean flag=true;
int pageNo = 200;
int currentPageTotal=0;//当前页返回的结果总数
while (flag) {
try {
// 接口调用
String token = TokenUtils.getYtgsToken();
Map herders = new HashMap();
JSONObject jsonObjectParams = new JSONObject();
String[] device_type = {"6","20"};
jsonObjectParams.put("page_num",page);
jsonObjectParams.put("page_size",pageNo);
jsonObjectParams.put("recognition_type",1);
jsonObjectParams.put("plate_no",objectValue);
jsonObjectParams.put("start_time",DateUtil.getTimeStamp(startDate));
jsonObjectParams.put("end_time",DateUtil.getTimeStamp(endDate));
jsonObjectParams.put("device_type",device_type);
// 设置请求的header参数
herders.put("Authorization", token);
herders.put("Content-Type", "application/json");
String url = "http://26.7.9.56:11125/api/mg/v1/base-search/vehicle/tollgate/record/with-total";
String jsonObjectStr = JSONObject.toJSONString(jsonObjectParams);
System.out.println("车辆轨迹查询入参:--------"+jsonObjectStr);
String resultString = null;
resultString = HttpClient.doPostJson(url, herders, jsonObjectStr);
if (null != resultString) { // 如果返回结果不为空
JSONObject result = JSONObject.parseObject(resultString);
String errCode = result.getString("error_code");
if ("0000000000".equals(errCode)) {
JSONObject jsonArrayData = result.getJSONObject("data");
JSONArray jsonArray = jsonArrayData.getJSONArray("data");
currentPageTotal = jsonArray.size();
if (null != jsonArray && jsonArray.size() > 0) {
for (Object o : jsonArray) {
JSONObject jsonObject = (JSONObject) o;
String deviceId = jsonObject.getString("device_id");
String deviceName = jsonObject.getString("device_name");
String longitude = jsonObject.getString("longitude");
String latitude = jsonObject.getString("latitude");
if(StringUtils.isBlank(longitude)){ // 经度为空过滤掉
continue;
}
String date = jsonObject.getString("pass_time_desc");
String farImg = jsonObject.getString("storage_url_plate_fid");
String nearImg = jsonObject.getString("storage_url_distant_shot_fid");
// 返回处理
SkTrail skTrailDa = new SkTrail();
skTrailDa.setDeviceid(deviceId);
skTrailDa.setFarimglist(farImg);
skTrailDa.setNearimglist(nearImg);
skTrailDa.setX(longitude);
skTrailDa.setY(latitude);
skTrailDa.setAddress(deviceName);
skTrailDa.setTime(DateUtil.getTimeStamp(date));
skTrailDa.setDate(date);
skTrailDa.setObjecttype("kkgj");
skTrailDa.setObjectname("卡口轨迹");
skTrailDa.setObjectvalue(objectValue);
skTrailDa.setStatus("1");
points.add(skTrailDa);
}
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
if (currentPageTotal < pageNo) {//每页的总数大于当前页返回的总数,退出循环,d当期页的总数大于分页数,说明其接口无分页
flag = false;
} else if (currentPageTotal == pageNo) {//当前页等于总页数,则循环请求
++page;
}
}
if(points.size()>0){
points = points.stream().sorted(Comparator.comparing(SkTrail::getDate).reversed()).collect(Collectors.toList());
SkTrailVO skTrailVO = new SkTrailVO();
skTrailVO.setObjectvalue(objectValue);
skTrailVO.setObjecttype("kkgj");
skTrailVO.setObjectname("卡口轨迹");
skTrailVO.setKssj(startDate);
skTrailVO.setJssj(endDate);
skTrailVO.setPoints(points);
listResult.add(skTrailVO);
}
return listResult;
}
/**
* 获取基站轨迹信息
*
......
......@@ -242,7 +242,7 @@ public class SkTrailController extends ApiController implements ExcelControllerI
}else if(sktrailParam.getLikeField().equals("jdgj")){
list = interfaceAPI.getJdXx(sktrailParam.getLikeValue(),sktrailParam.getKssj(),sktrailParam.getJssj(),request,sktrailParam.getPage(),sktrailParam.getPageSize());
}else if(sktrailParam.getLikeField().equals("kkgj")){
list = interfaceAPI.getClgj(request,sktrailParam.getLikeValue(),sktrailParam.getKssj(),sktrailParam.getJssj(),sktrailParam.getPage(),sktrailParam.getPageSize());
list = interfaceAPI.getClgjZg(request,sktrailParam.getLikeValue(),sktrailParam.getKssj(),sktrailParam.getJssj(),sktrailParam.getPage(),sktrailParam.getPageSize());
}else if(sktrailParam.getLikeField().equals("jzgj")){
list = interfaceAPI.getJzgj(request,sktrailParam.getLikeValue(),sktrailParam.getKssj(),sktrailParam.getJssj(),sktrailParam.getPage(),sktrailParam.getPageSize());
}
......
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