package com.skyline.electricity.controller; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.skyline.electricity.pojo.Position; import com.skyline.electricity.pojo.Properties; import com.skyline.electricity.uwbentity.Positions; import org.springframework.stereotype.*; import org.springframework.beans.factory.annotation.*; import com.skyline.electricity.entity.*; import com.skyline.electricity.service.*; import java.text.*; import org.springframework.web.client.*; import org.springframework.http.client.*; import java.nio.charset.*; import org.springframework.http.converter.*; import com.vividsolutions.jts.io.*; import cn.hutool.json.*; import org.springframework.util.*; import com.alibaba.fastjson.*; import com.vividsolutions.jts.geom.*; import org.springframework.http.*; import io.swagger.annotations.*; import org.springframework.web.bind.annotation.*; import com.skyline.electricity.timer.*; import com.skyline.electricity.utils.*; import org.springframework.beans.*; import java.util.*; import java.util.function.*; import java.util.stream.*; import com.skyline.electricity.pojo.*; import com.skyline.electricity.uwbentity.*; import org.slf4j.*; @Controller @RequestMapping({ "/remote" }) @Api("基于Swagger的电力区域报警系统") @CrossOrigin public class RemoteController { private static final Logger log; @Autowired private DetectService detectService; @Autowired private ConfigInfo configInfo; @Autowired private InfoSynchService infoSynchService; GeometryFactory geometryFactory; WKTReader reader; SimpleDateFormat sdf; public RemoteController() { this.geometryFactory = new GeometryFactory(); this.reader = new WKTReader(this.geometryFactory); this.sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); } @RequestMapping(value = { "/getMultiPersonlocations" }, method = { RequestMethod.POST }) @ApiOperation("远程调用多个人员定位接口获取定位信息并将其融合") @ResponseBody public Object getMultiPersonlocations(final String shopId, final String modId, final String modKey, final Integer pageNum, final Integer pageSize, int value) { final RestTemplate restTemplate = new RestTemplate((ClientHttpRequestFactory)new HttpsClientRequestFactory()); restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); final String poly1 = this.configInfo.getHydrogen_station(); final String poly2 = this.configInfo.getQjgl(); final String poly3 = this.configInfo.getSmjs(); final String poly4 = this.configInfo.getPd6(); final Map judgemap1 = new HashMap(); final Map judgemap2 = new HashMap(); final Map judgemap3 = new HashMap(); final Map judgemap4 = new HashMap(); Polygon polygon1 = null; Polygon polygon2 = null; Polygon polygon3 = null; Polygon polygon4 = null; try { polygon1 = (Polygon)this.reader.read("POLYGON((" + poly1 + "))"); polygon2 = (Polygon)this.reader.read("POLYGON((" + poly2 + "))"); polygon3 = (Polygon)this.reader.read("POLYGON((" + poly3 + "))"); polygon4 = (Polygon)this.reader.read("POLYGON((" + poly4 + "))"); judgemap1.put("polygon", polygon1.toString()); judgemap2.put("polygon", polygon2.toString()); judgemap3.put("polygon", polygon3.toString()); judgemap4.put("polygon", polygon4.toString()); } catch (Exception e) { e.printStackTrace(); } final Map params1 = new HashMap(); final Map params2 = new HashMap(); params2.put("modId", modId); params2.put("modKey", modKey); params2.put("pageNum", pageNum); params2.put("pageSize", pageSize); params2.put("attrIndex", "time"); params2.put("type", "interval"); params2.put("value", value); final HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); final cn.hutool.json.JSONObject jsonObject = JSONUtil.parseFromMap((Map)params2); final HttpEntity httpEntity = (HttpEntity)new HttpEntity((Object)jsonObject, (MultiValueMap)headers); final ResponseEntity responseEntity1 = (ResponseEntity)restTemplate.postForEntity(this.configInfo.getGPS_EntityList() + "?apikey=" + this.configInfo.getApikey(), (Object)httpEntity, (Class)String.class, new Object[0]); final String body1 = (String)responseEntity1.getBody(); final JSONObject jsonObjectResult1 = JSONObject.parseObject(body1); final JSONObject object1 = (JSONObject)jsonObjectResult1.get((Object)"data"); final JSONArray jsonArray1 = (JSONArray)object1.get((Object)"list"); final List list1 = (List)jsonArray1.toJavaList((Class)PersonPosition.class); params1.put("shopId", shopId); final List idList = (List)this.infoSynchService.selectAllUserIds(); final StringBuffer stringBuffer = new StringBuffer(); for (int i = 0; i < idList.size(); ++i) { if (i != idList.size() - 1) { stringBuffer.append(idList.get(i) + ","); } else { stringBuffer.append(idList.get(i)); } } params1.put("userIds", stringBuffer.toString().trim()); final HttpHeaders headers2 = new HttpHeaders(); headers2.setContentType(MediaType.APPLICATION_JSON); final cn.hutool.json.JSONObject jsonObject2 = JSONUtil.parseFromMap((Map)params1); final HttpEntity httpEntity2 = (HttpEntity)new HttpEntity((Object)jsonObject2, (MultiValueMap)headers2); final Iterator pit = list1.iterator(); while (pit.hasNext()) { final PersonPosition p = pit.next(); p.setAlitude("1.2"); p.setType("GPS"); String compoint = null; if (p.getLongitude() != null && p.getLatitude() != null) { compoint = p.getLongitude() + " " + p.getLatitude(); Point point = null; try { if (compoint == null) { continue; } point = (Point)this.reader.read("POINT("+ compoint + ")"); judgemap1.put("point", point.toString()); judgemap2.put("point", point.toString()); judgemap3.put("point", point.toString()); judgemap4.put("point", point.toString()); final boolean flag1 = this.detectService.judge((Map)judgemap3).equals("t"); final boolean mark1 = Double.parseDouble(p.getAlitude()) > this.configInfo.getSmjs_startaltitude() && Double.parseDouble(p.getAlitude()) < this.configInfo.getSmjs_startaltitude() && flag1; final boolean flag2 = this.detectService.judge((Map)judgemap4).equals("t"); final boolean mark2 = Double.parseDouble(p.getAlitude()) > this.configInfo.getPd6_startaltitude() && Double.parseDouble(p.getAlitude()) < this.configInfo.getPd6_endaltitude() && flag2; if (!this.detectService.judge((Map)judgemap1).equals("t") && !this.detectService.judge((Map)judgemap2).equals("t") && !mark1 && !mark2) { continue; } pit.remove(); } catch (Exception e2) { e2.printStackTrace(); } } else { pit.remove(); } } final ResponseEntity responseEntity2 = (ResponseEntity)restTemplate.postForEntity(this.configInfo.getUWB_MultiPersonlocations()+ "?apikey=" + this.configInfo.getApikey(), (Object)httpEntity2, (Class)String.class, new Object[0]); RemoteController.log.info("httpenity"+ httpEntity2); final String body2 = (String)responseEntity2.getBody(); final JSONObject jsonObjectResult2 = JSONObject.parseObject(body2); final JSONArray jsonArray2 = (JSONArray)jsonObjectResult2.get((Object)"data"); List list2 = null; if (jsonArray2 != null) { list2 = (List)jsonArray2.toJavaList((Class)UWBHistoryLocation.class); final Iterator it = list2.iterator(); while (it.hasNext()) { final UWBHistoryLocation uwb = it.next(); if (String.valueOf(uwb.getPosition().getLatitude()) != null && String.valueOf(uwb.getPosition().getLongitude()) != null) { final String compoint2 = uwb.getPosition().getLatitude()+ " " + uwb.getPosition().getLongitude(); final String[] newpoint = this.detectService.transLocation(compoint2).split(" "); final String transpoint = newpoint[0]+ " " + newpoint[1]; Point point2 = null; try { point2 = (Point)this.reader.read("POINT("+ transpoint + ")"); judgemap1.put("point", point2.toString()); judgemap2.put("point", point2.toString()); judgemap3.put("point", point2.toString()); judgemap4.put("point", point2.toString()); } catch (Exception e3) { e3.printStackTrace(); } final boolean flag3 = this.detectService.judge((Map)judgemap1).equals("f"); final boolean flag4 = this.detectService.judge((Map)judgemap2).equals("f"); final boolean flag5 = this.detectService.judge((Map)judgemap3).equals("f"); final boolean flag6 = this.detectService.judge((Map)judgemap4).equals("f"); if (uwb.getPosition() != null || !flag3 || !flag4 || !flag5 || !flag6) { continue; } it.remove(); } } } for (int j = 0; j < list2.size(); ++j) { final PersonPosition p2 = new PersonPosition(); p2.setType("UWB"); p2.setUserId(list2.get(j).getUser().getUserId()); p2.setUserName(list2.get(j).getUser().getUserName()); p2.setShopId(list2.get(j).getShopId()); p2.setEvents(list2.get(j).getEvents()); final String compoint2 = list2.get(j).getPosition().getLatitude()+ " " + list2.get(j).getPosition().getLongitude(); final String[] point3 = this.detectService.transLocation(compoint2).split(" "); p2.setLongitude(point3[0]); p2.setLatitude(point3[1]); p2.setAlitude(String.valueOf(list2.get(j).getPosition().getZ())); p2.setTime(String.valueOf(list2.get(j).getTimestamp())); p2.setMobile(list2.get(j).getUser().getMobile()); p2.setEmail(list2.get(j).getUser().getEmail()); list1.add(p2); } final List newList = new ArrayList(); for (final PersonPosition personPosition : list1) { if (personPosition.getType().equals("UWB")) { newList.add(personPosition); } } for (int k = 0; k < list1.size(); ++k) { boolean flag7 = false; for (int l = 0; l < newList.size(); ++l) { if (newList.get(l).getUserId().equals(list1.get(k).getUserId())) { flag7 = true; } } if (!flag7) { newList.add(list1.get(k)); } } final Map map = new HashMap(); map.put("list", newList); return map; } @RequestMapping(value = { "/getRTCMultiPersonlocations" }, method = { RequestMethod.POST }) @ApiOperation("从缓存获取人员信息") @ResponseBody public Object getRTCMultiPersonlocations(final String shopId, final String modId, final String modKey, final Integer pageNum, final Integer pageSize, int value) { final Map map = new HashMap(); List newList = new ArrayList(); if (SchedulerTask.personlocationentity != null) { newList = SchedulerTask.personlocationentity; map.put("list", newList); return map; } final Object object = this.getMultiPersonlocations(shopId, modId, modKey, pageNum, pageSize, value); return object; } @RequestMapping(value = { "/getPersonlocation" }, method = { RequestMethod.POST }) @ApiOperation("远程调用单个人员定位接口获取定位信息并将其融合") @ResponseBody public Object getPersonlocations(final String shopId, final String modId, final String modKey, final Integer pageNum, final Integer pageSize, final String entityId, int value) { final RestTemplate restTemplate = new RestTemplate((ClientHttpRequestFactory)new HttpsClientRequestFactory()); restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); final String poly1 = this.configInfo.getHydrogen_station(); final String poly2 = this.configInfo.getQjgl(); final String poly3 = this.configInfo.getSmjs(); final String poly4 = this.configInfo.getPd6(); final Map judgemap1 = new HashMap(); final Map judgemap2 = new HashMap(); final Map judgemap3 = new HashMap(); final Map judgemap4 = new HashMap(); Polygon polygon1 = null; Polygon polygon2 = null; Polygon polygon3 = null; Polygon polygon4 = null; try { polygon1 = (Polygon)this.reader.read("POLYGON(("+ poly1 + "))"); polygon2 = (Polygon)this.reader.read("POLYGON((" + poly2 + "))"); polygon3 = (Polygon)this.reader.read("POLYGON((" + poly3 + "))"); polygon4 = (Polygon)this.reader.read("POLYGON((" + poly4 +"))"); judgemap1.put("polygon", polygon1.toString()); judgemap2.put("polygon", polygon2.toString()); judgemap3.put("polygon", polygon3.toString()); judgemap4.put("polygon", polygon4.toString()); } catch (Exception e) { e.printStackTrace(); } final Map params1 = new HashMap(); final Map params2 = new HashMap(); params2.put("modId", modId); params2.put("modKey", modKey); params2.put("entityId", entityId); params2.put("pageNum", pageNum); params2.put("pageSize", pageSize); params2.put("value", value); final HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); final cn.hutool.json.JSONObject jsonObject = JSONUtil.parseFromMap((Map)params2); final HttpEntity httpEntity = (HttpEntity)new HttpEntity((Object)jsonObject, (MultiValueMap)headers); final ResponseEntity responseEntity1 = (ResponseEntity)restTemplate.postForEntity(this.configInfo.getGPS_EntityList()+ "?apikey=" + this.configInfo.getApikey(), (Object)httpEntity, (Class)String.class, new Object[0]); final String body1 = (String)responseEntity1.getBody(); final JSONObject jsonObjectResult1 = JSONObject.parseObject(body1); final JSONObject object1 = (JSONObject)jsonObjectResult1.get((Object)"data"); final JSONArray jsonArray1 = (JSONArray)object1.get((Object)"list"); final List list1 = (List)jsonArray1.toJavaList((Class)PersonPosition.class); params1.put("shopId", shopId); params1.put("userId", entityId); final Iterator pit = list1.iterator(); while (pit.hasNext()) { final PersonPosition p = pit.next(); String compoint = null; if (p.getLongitude() != null && p.getLatitude() != null) { compoint = p.getLongitude()+ " " + p.getLatitude(); } if (compoint != null) { Point point = null; try { if (compoint == null) { continue; } point = (Point)this.reader.read("POINT("+ compoint + ")"); judgemap1.put("point", point.toString()); judgemap2.put("point", point.toString()); judgemap3.put("point", point.toString()); judgemap4.put("point", point.toString()); final boolean flag1 = this.detectService.judge((Map)judgemap3).equals("t"); final boolean mark1 = Double.parseDouble(p.getAlitude()) > this.configInfo.getSmjs_startaltitude() && Double.parseDouble(p.getAlitude()) < this.configInfo.getSmjs_startaltitude() && flag1; final boolean flag2 = this.detectService.judge((Map)judgemap4).equals("t"); final boolean mark2 = Double.parseDouble(p.getAlitude()) > this.configInfo.getPd6_startaltitude() && Double.parseDouble(p.getAlitude()) < this.configInfo.getPd6_endaltitude() && flag2; if (!this.detectService.judge((Map)judgemap1).equals("t") && !this.detectService.judge((Map)judgemap2).equals("t") && !mark1 && !mark2) { continue; } pit.remove(); } catch (Exception e2) { e2.printStackTrace(); } } else { if (p.getLongitude() != null && p.getLatitude() != null && p.getAlitude() != null) { continue; } pit.remove(); } } final ResponseEntity responseEntity2 = (ResponseEntity)restTemplate.getForEntity(this.configInfo.getUWB_Personlocation()+ "?apikey="+ this.configInfo.getApikey()+ "&shopId={shopId}&userId={userId}", (Class)String.class, (Map)params1); final String body2 = (String)responseEntity2.getBody(); final JSONObject jsonObjectResult2 = JSONObject.parseObject(body2); final JSONArray jsonArray2 = (JSONArray)jsonObjectResult2.get((Object)"data"); final List list2 = (List)jsonArray2.toJavaList((Class)UWBHistoryInfo.class); final Iterator it = list2.iterator(); while (it.hasNext()) { final UWBHistoryInfo uwb = it.next(); String compoint2 = null; if (uwb.getPositions() != null) { compoint2 = uwb.getPositions().get(0).getPosition().getLatitude()+ " "+ uwb.getPositions().get(0).getPosition().getLatitude(); final String[] newpoint = this.detectService.transLocation(compoint2).split(" "); final String transpoint = newpoint[0]+ " " + newpoint[1]; Point point2 = null; try { point2 = (Point)this.reader.read("POINT(" + transpoint + ")"); judgemap1.put("point", point2.toString()); judgemap2.put("point", point2.toString()); judgemap3.put("point", point2.toString()); judgemap4.put("point", point2.toString()); } catch (Exception e3) { e3.printStackTrace(); } final boolean flag3 = this.detectService.judge((Map)judgemap1).equals("f"); final boolean flag4 = this.detectService.judge((Map)judgemap2).equals("f"); final boolean flag5 = this.detectService.judge((Map)judgemap3).equals("f"); final boolean flag6 = this.detectService.judge((Map)judgemap4).equals("f"); if (!flag3 || !flag4 || !flag5 || !flag6) { continue; } it.remove(); } else { it.remove(); } } for (int i = 0; i < list2.size(); ++i) { final PersonPosition p2 = new PersonPosition(); p2.setUserId(list2.get(i).getUserId()); p2.setUserName(list2.get(i).getUserName()); p2.setEvents(list2.get(i).getPositions().get(0).getEvents()); final String compoint3 = list2.get(i).getPositions().get(i).getPosition().getLatitude()+ " " + list2.get(i).getPositions().get(i).getPosition().getLongitude(); final String[] point3 = this.detectService.transLocation(compoint3).split(" "); p2.setLongitude(point3[0]); p2.setLatitude(point3[1]); p2.setAlitude(String.valueOf(list2.get(i).getPositions().get(i).getPosition().getZ())); p2.setTime(String.valueOf(list2.get(i).getPositions().get(i).getTimestamp())); list1.add(p2); } final Map map = new HashMap(); map.put("list", list1); return map; } @RequestMapping(value = { "/getPersonlocationMQ" }, method = { RequestMethod.POST }) @ApiOperation("远程调用单个人员定位接口获取定位信息并将其融合") @ResponseBody public Object getPersonlocationMQ(final String shopId, final String modId, final String modKey, final Integer pageNum, final Integer pageSize, final String entityId, int value,List listMQ) { final RestTemplate restTemplate = new RestTemplate((ClientHttpRequestFactory)new HttpsClientRequestFactory()); restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); final String poly1 = this.configInfo.getHydrogen_station(); final String poly2 = this.configInfo.getQjgl(); final String poly3 = this.configInfo.getSmjs(); final String poly4 = this.configInfo.getPd6(); final Map judgemap1 = new HashMap(); final Map judgemap2 = new HashMap(); final Map judgemap3 = new HashMap(); final Map judgemap4 = new HashMap(); Polygon polygon1 = null; Polygon polygon2 = null; Polygon polygon3 = null; Polygon polygon4 = null; try { polygon1 = (Polygon)this.reader.read("POLYGON(("+ poly1 + "))"); polygon2 = (Polygon)this.reader.read("POLYGON((" + poly2 + "))"); polygon3 = (Polygon)this.reader.read("POLYGON((" + poly3 + "))"); polygon4 = (Polygon)this.reader.read("POLYGON((" + poly4 +"))"); judgemap1.put("polygon", polygon1.toString()); judgemap2.put("polygon", polygon2.toString()); judgemap3.put("polygon", polygon3.toString()); judgemap4.put("polygon", polygon4.toString()); } catch (Exception e) { e.printStackTrace(); } final Map params1 = new HashMap(); final Map params2 = new HashMap(); params2.put("modId", modId); params2.put("modKey", modKey); params2.put("entityId", entityId); params2.put("pageNum", pageNum); params2.put("pageSize", pageSize); params2.put("value", value); final HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); final cn.hutool.json.JSONObject jsonObject = JSONUtil.parseFromMap((Map)params2); // final HttpEntity httpEntity = (HttpEntity)new HttpEntity((Object)jsonObject, (MultiValueMap)headers); // // final ResponseEntity responseEntity1 = (ResponseEntity)restTemplate.postForEntity(this.configInfo.getGPS_EntityList()+ "?apikey=" + this.configInfo.getApikey(), (Object)httpEntity, (Class)String.class, new Object[0]); // final String body1 = (String)responseEntity1.getBody(); // final JSONObject jsonObjectResult1 = JSONObject.parseObject(body1); // final JSONObject object1 = (JSONObject)jsonObjectResult1.get((Object)"data"); // final JSONArray jsonArray1 = (JSONArray)object1.get((Object)"list"); final List list1 = listMQ ; params1.put("shopId", shopId); params1.put("userId", entityId); final Iterator pit = list1.iterator(); while (pit.hasNext()) { final PersonPosition p = pit.next(); String compoint = null; if (p.getLongitude() != null && p.getLatitude() != null) { compoint = p.getLongitude()+ " " + p.getLatitude(); } if (compoint != null) { Point point = null; try { if (compoint == null) { continue; } point = (Point)this.reader.read("POINT("+ compoint + ")"); judgemap1.put("point", point.toString()); judgemap2.put("point", point.toString()); judgemap3.put("point", point.toString()); judgemap4.put("point", point.toString()); final boolean flag1 = this.detectService.judge((Map)judgemap3).equals("t"); final boolean mark1 = Double.parseDouble(p.getAlitude()) > this.configInfo.getSmjs_startaltitude() && Double.parseDouble(p.getAlitude()) < this.configInfo.getSmjs_startaltitude() && flag1; final boolean flag2 = this.detectService.judge((Map)judgemap4).equals("t"); final boolean mark2 = Double.parseDouble(p.getAlitude()) > this.configInfo.getPd6_startaltitude() && Double.parseDouble(p.getAlitude()) < this.configInfo.getPd6_endaltitude() && flag2; if (!this.detectService.judge((Map)judgemap1).equals("t") && !this.detectService.judge((Map)judgemap2).equals("t") && !mark1 && !mark2) { continue; } pit.remove(); } catch (Exception e2) { e2.printStackTrace(); } } else { if (p.getLongitude() != null && p.getLatitude() != null && p.getAlitude() != null) { continue; } pit.remove(); } } // final ResponseEntity responseEntity2 = (ResponseEntity)restTemplate.getForEntity(this.configInfo.getUWB_Personlocation()+ "?apikey="+ this.configInfo.getApikey()+ "&shopId={shopId}&userId={userId}", (Class)String.class, (Map)params1); // final String body2 = (String)responseEntity2.getBody(); // final JSONObject jsonObjectResult2 = JSONObject.parseObject(body2); // final JSONArray jsonArray2 = (JSONArray)jsonObjectResult2.get((Object)"data"); // final List list2 = (List)jsonArray2.toJavaList((Class)UWBHistoryInfo.class); // final Iterator it = list2.iterator(); // while (it.hasNext()) { // final UWBHistoryInfo uwb = it.next(); // String compoint2 = null; // if (uwb.getPositions() != null) { // compoint2 = uwb.getPositions().get(0).getPosition().getLatitude()+ " "+ uwb.getPositions().get(0).getPosition().getLatitude(); // final String[] newpoint = this.detectService.transLocation(compoint2).split(" "); // final String transpoint = newpoint[0]+ " " + newpoint[1]; // Point point2 = null; // try { // point2 = (Point)this.reader.read("POINT(" + transpoint + ")"); // judgemap1.put("point", point2.toString()); // judgemap2.put("point", point2.toString()); // judgemap3.put("point", point2.toString()); // judgemap4.put("point", point2.toString()); // } // catch (Exception e3) { // e3.printStackTrace(); // } // final boolean flag3 = this.detectService.judge((Map)judgemap1).equals("f"); // final boolean flag4 = this.detectService.judge((Map)judgemap2).equals("f"); // final boolean flag5 = this.detectService.judge((Map)judgemap3).equals("f"); // final boolean flag6 = this.detectService.judge((Map)judgemap4).equals("f"); // if (!flag3 || !flag4 || !flag5 || !flag6) { // continue; // } // it.remove(); // } // else { // it.remove(); // } // } // for (int i = 0; i < list2.size(); ++i) { // final PersonPosition p2 = new PersonPosition(); // p2.setUserId(list2.get(i).getUserId()); // p2.setUserName(list2.get(i).getUserName()); // p2.setEvents(list2.get(i).getPositions().get(0).getEvents()); // final String compoint3 = list2.get(i).getPositions().get(i).getPosition().getLatitude()+ " " + list2.get(i).getPositions().get(i).getPosition().getLongitude(); // final String[] point3 = this.detectService.transLocation(compoint3).split(" "); // p2.setLongitude(point3[0]); // p2.setLatitude(point3[1]); // p2.setAlitude(String.valueOf(list2.get(i).getPositions().get(i).getPosition().getZ())); // p2.setTime(String.valueOf(list2.get(i).getPositions().get(i).getTimestamp())); // list1.add(p2); // } final Map map = new HashMap(); map.put("list", list1); return map; } @RequestMapping(value = { "/getHistorylocationByName" }, method = { RequestMethod.POST }) @ApiOperation("远程调用单个人员历史轨迹接口获取相关信息并将其融合(输入姓名)") @ResponseBody public Object getHistorylocationByName(final String shopId, final String username, final long startTime, final long endTime, final String modId, final String modKey, final String order, final Integer pageNum, final Integer pageSize) throws Exception { final RestTemplate restTemplate = new RestTemplate((ClientHttpRequestFactory)new HttpsClientRequestFactory()); restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); final String poly1 = this.configInfo.getHydrogen_station(); final String poly2 = this.configInfo.getQjgl(); final String poly3 = this.configInfo.getSmjs(); final String poly4 = this.configInfo.getPd6(); final Polygon polygon1 = (Polygon)this.reader.read("POLYGON(("+ poly1+ "))"); final Polygon polygon2 = (Polygon)this.reader.read("POLYGON((" + poly2 + "))"); final Polygon polygon3 = (Polygon)this.reader.read("POLYGON((" +poly3 + "))"); final Polygon polygon4 = (Polygon)this.reader.read("POLYGON((" +poly4 + "))"); final Map params1 = new HashMap(); final Map params2 = new HashMap(); final Map map1 = new HashMap(); final Map map2 = new HashMap(); final Map map3 = new HashMap(); final Map map4 = new HashMap(); final String userId = this.infoSynchService.selectIdByName(username); final List hisInfo = new ArrayList(); params2.put("entityId", userId); params2.put("beginTime", this.sdf.format(new Date(startTime))); params2.put("endTime", this.sdf.format(new Date(endTime))); params2.put("modId", modId); params2.put("modKey", modKey); params2.put("order", order); params2.put("pageNum", pageNum); params2.put("pageSize", pageSize); final HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON_UTF8); final cn.hutool.json.JSONObject jsonObject = JSONUtil.parseFromMap((Map)params2); final HttpEntity httpEntity = (HttpEntity)new HttpEntity((Object)jsonObject, (MultiValueMap)headers); final String start_time = this.sdf.format(new Date(startTime)); final String end_time = this.sdf.format(new Date(endTime)); final List timeList = Timeutils.getIntervalTimeList(start_time, end_time, 1440); final List hpList = new ArrayList(); final List testlist = new ArrayList(); for (int j = 0; j < timeList.size(); j +=2) { params1.put("userId", userId); params1.put("shopId", shopId); params1.put("startTime", timeList.get(j)); params1.put("endTime", timeList.get(j + 1)); final ResponseEntity responseEntity1 = (ResponseEntity)restTemplate.getForEntity(this.configInfo.getUWB_Historylocation() + "?apikey=" + this.configInfo.getApikey() + "&userId={userId}&shopId={shopId}&startTime={startTime}&endTime={endTime}", (Class)String.class, (Map)params1); final String body1 = (String)responseEntity1.getBody(); final JSONObject jsonObjectResult1 = JSONObject.parseObject(body1); //System.out.println(jsonObjectResult1.get((Object)"data")); if (jsonObjectResult1 != null) { final JSONArray jsonArray1 = (JSONArray)jsonObjectResult1.get((Object)"data"); final List list1 = (List)jsonArray1.toJavaList((Class)UWBHistoryInfo.class); List positionsList = new ArrayList(); if (list1.size() > 0) { positionsList = (List)list1.get(0).getPositions(); RemoteController.log.info("这里是未消减过的uwb数据"+ positionsList.toString()); } for (int i = 0; i < positionsList.size(); ++i) { final HistoryPosition hp = new HistoryPosition(); hp.setEntityId(list1.get(0).getUserId()); hp.setUserName(list1.get(0).getUserName()); hp.setTimestamp(this.sdf.format(positionsList.get(i).getTimestamp())); if (String.valueOf(positionsList.get(i).getPosition().getLatitude()) != null && String.valueOf(positionsList.get(i).getPosition().getLongitude()) != null) { final String uwbpoint = positionsList.get(i).getPosition().getLatitude()+ " " + positionsList.get(i).getPosition().getLongitude(); final String newpoint = this.detectService.transLocation(uwbpoint); final String[] array = newpoint.split(" "); hp.setAltitude(String.valueOf(positionsList.get(i).getPosition().getZ())); hp.setLatitude(array[1]); hp.setLongitude(array[0]); try { final Point point = (Point)this.reader.read("POINT("+ newpoint + ")"); map1.put("polygon", polygon1.toString()); map2.put("polygon", polygon2.toString()); map3.put("polygon", polygon3.toString()); map4.put("polygon", polygon4.toString()); map1.put("point", point.toString()); map2.put("point", point.toString()); map3.put("point", point.toString()); map4.put("point", point.toString()); } catch (Exception e) { e.printStackTrace(); } final String flag1 = this.detectService.judge((Map)map1); final String flag2 = this.detectService.judge((Map)map2); final String flag3 = this.detectService.judge((Map)map3); final String flag4 = this.detectService.judge((Map)map4); testlist.add(hp); if (flag1.equals("t") || flag2.equals("t") || flag3.equals("t") || flag4.equals("t")) { hpList.add(hp); } } } } } RemoteController.log.info("这里转换过的原始全uwp数据"+ testlist.toString()); RemoteController.log.info("这里是过滤过的uwp数据" + hpList.toString()); final Properties properties = new Properties(); properties.setZwww("arr"); properties.setAcftype("A320"); properties.setARR("ZWWW"); properties.setDEPA("ZGGG"); properties.setHEIGHT("3740"); properties.setType("route"); properties.setCOMPANY("TERRA"); final com.skyline.electricity.pojo.Positions positions = new com.skyline.electricity.pojo.Positions(); positions.setCartographicDegrees((List)new ArrayList()); final Polyline polyline = new Polyline(); polyline.setPositions(positions); final Color color1 = new Color(); final Color color2 = new Color(); final Color color3 = new Color(); final Color color4 = new Color(); final Offset offset = new Offset(); final List cartesian2 = new ArrayList(); cartesian2.add(16.0); cartesian2.add(-32.0); offset.setCartesian2(cartesian2); final Label label = new Label(); final List fillcolor = new ArrayList(); fillcolor.add(255.0); fillcolor.add(0.0); fillcolor.add(0.0); fillcolor.add(255.0); final List backlist = new ArrayList(); backlist.add(0.0); backlist.add(0.0); backlist.add(0.0); backlist.add(255.0); final List pcolor = new ArrayList(); pcolor.add(255.0); pcolor.add(255.0); pcolor.add(255.0); pcolor.add(255.0); final List outline = new ArrayList(); outline.add(255.0); outline.add(255.0); outline.add(255.0); outline.add(255.0); color1.setRgba(fillcolor); color2.setRgba(backlist); color3.setRgba(outline); color4.setRgba(pcolor); label.setBackgroundColor(color2); label.setFillcolor(color1); label.setOutlineColor(color2); label.setFont("14px Arial"); label.setHorizontalOrigin("LEFT"); label.setOutlineWidth(1); label.setPixelOffset(offset); label.setScale(1.0); label.setShow(false); label.setShowBackground(true); label.setStyle("FILL"); label.setText("JYH1051"); label.setVerticalOrigin("BOTTOM"); final PolylineOutline polylineOutline = new PolylineOutline(); polylineOutline.setOutlineColor(color3); polylineOutline.setOutlineWidth(0); polylineOutline.setColor(color4); final Material material = new Material(); material.setPolylineOutline(polylineOutline); final Path path = new Path(); path.setMaterial(material); path.setResolution(100); path.setWidth(3); path.setLeadTime(0); path.setTrailTime(1000); path.setShow(true); final BillBoard billboard = new BillBoard(); billboard.setScale(1.5); billboard.setImage("../img/人员2.png"); final CZML czml = new CZML(); czml.setId("document"); czml.setName("XJMHHISTORYDATA"); czml.setVersion("1.0"); hisInfo.add(czml); final ResponseEntity responseEntity2 = (ResponseEntity)restTemplate.postForEntity(this.configInfo.getGPS_Historylocation()+ "?apikey=" + this.configInfo.getApikey(), (Object)httpEntity, (Class)String.class, new Object[0]); final String body2 = (String)responseEntity2.getBody(); final JSONObject jsonObjectResult2 = JSONObject.parseObject(body2); //System.out.println(jsonObjectResult2.get((Object)"data")); final JSONObject object = (JSONObject)jsonObjectResult2.get((Object)"data"); if (object != null) { final JSONArray jsonArray2 = (JSONArray)object.get((Object)"statisticList"); final List list2 = (List)jsonArray2.toJavaList((Class)HistoryPosition.class); RemoteController.log.info("这里是未消减过的gps数据"+ list2.toString()); for (final HistoryPosition h : list2) { try { h.setTimestamp(this.sdf.format(this.sdf.parse(h.getTimestamp()))); } catch (Exception e2) { e2.printStackTrace(); } h.setAltitude("1.2"); if (h.getLongitude() != null && h.getLatitude() != null) { final String compoint = h.getLongitude()+ " " + h.getLatitude(); try { final Point point2 = (Point)this.reader.read("POINT("+ compoint+ ")"); map1.put("polygon", polygon1.toString()); map2.put("polygon", polygon2.toString()); map3.put("polygon", polygon3.toString()); map4.put("polygon", polygon4.toString()); map1.put("point", point2.toString()); map2.put("point", point2.toString()); map3.put("point", point2.toString()); map4.put("point", point2.toString()); final String flag5 = this.detectService.judge((Map)map1); final String flag6 = this.detectService.judge((Map)map2); final String flag7 = this.detectService.judge((Map)map3); final String flag8 = this.detectService.judge((Map)map4); if (!flag5.equals("f") || !flag6.equals("f") || !flag7.equals("f") || !flag8.equals("f")) { continue; } hpList.add(h); } catch (Exception e3) { e3.printStackTrace(); } } } } final Set set = new HashSet(); RemoteController.log.info("这里是总共的数据"+ hpList.toString()); set.addAll(hpList); final List newHpList = new ArrayList(set); //Collections.sort(newHpList, (Comparator)new RemoteController.RemoteController$1(this)); sort(newHpList); RemoteController.log.info("这里是排序过后的总共的数据"+ newHpList.toString()); final List entireList = new ArrayList(); final Iterator eit = newHpList.iterator(); int pointcount = 0; final HistoryPosition hisp = newHpList.get(0); while (eit.hasNext()) { final HistoryPosition e4 = eit.next(); if (Math.abs(Double.parseDouble(e4.getLatitude()) - Double.parseDouble(hisp.getLatitude())) > 8.0E-5 || Math.abs(Double.parseDouble(e4.getLongitude()) - Double.parseDouble(hisp.getLongitude())) > 8.0E-5) { if (e4.getSatelliteNum() != null && pointcount != 3) { ++pointcount; eit.remove(); } else { BeanUtils.copyProperties((Object)e4, (Object)hisp); } } else { BeanUtils.copyProperties((Object)e4, (Object)hisp); } if (pointcount == 3) { pointcount = 0; } } for (int k = 0; k < newHpList.size(); ++k) { if (k < newHpList.size() - 1) { final double timediff = (double)(this.sdf.parse(newHpList.get(k+ 1).getTimestamp()).getTime() - this.sdf.parse(newHpList.get(k).getTimestamp()).getTime()); if (timediff > 1000.0) { for (int l = 0; l < timediff / 1000.0; ++l) { final HistoryPosition hp2 = new HistoryPosition(); BeanUtils.copyProperties((Object)newHpList.get(k), (Object)hp2); final String newTime = this.sdf.format(this.sdf.parse(hp2.getTimestamp()).getTime()+ 1000 * l); hp2.setTimestamp(newTime); entireList.add(hp2); } } else { entireList.add(newHpList.get(k)); } } else { entireList.add(newHpList.get(k)); } } //Collections.sort(entireList, (Comparator)new RemoteController.RemoteController$2(this)); sort(entireList); RemoteController.log.info("这里是最终的数据"+ entireList.toString()); final HistoryRoute historyRoute = new HistoryRoute(); final List cartographicDegrees = new ArrayList(); final Position position = new Position(); RemoteController.log.info("这里是最终的数据" + entireList.size()); for (int l = 0; l < entireList.size(); ++l) { try { historyRoute.setId(entireList.get(l).getEntityId()); position.setInterpolationDegree("3"); position.setInterpolationAlgorithm("HERMITE"); Date date1 = null; Date date2 = null; date1 = this.sdf.parse(entireList.get(0).getTimestamp()); date2 = this.sdf.parse(entireList.get(l).getTimestamp()); final double timediff2 = (double)((date2.getTime() - date1.getTime()) / 1000L); cartographicDegrees.add(timediff2); cartographicDegrees.add(Double.parseDouble(entireList.get(l).getLongitude())); cartographicDegrees.add(Double.parseDouble(entireList.get(l).getLatitude())); if (entireList.get(l).getAltitude() != null && !entireList.get(l).getAltitude().equals("")) { cartographicDegrees.add(Double.parseDouble(entireList.get(l).getAltitude())); } if (l == entireList.size() - 1) { final StringBuffer stringBuffer = new StringBuffer(this.sdf.format(date1).replaceAll(" ", "T")); stringBuffer.append("Z"); final StringBuffer stringBuffer2 = new StringBuffer(this.sdf.format(this.sdf.parse(entireList.get(entireList.size() - 1).getTimestamp())).replaceAll(" ", "T")); stringBuffer2.append("Z"); position.setCartographicDegrees((List)cartographicDegrees); historyRoute.setName(username); position.setEpoch(stringBuffer.toString()); historyRoute.setDescription("

History

"); historyRoute.setProperties(properties); historyRoute.setAvailability((Object)stringBuffer+ "/" + (Object)stringBuffer2); historyRoute.setPolyline(polyline); historyRoute.setModel(null); historyRoute.setBillboard(billboard); historyRoute.setLabel(label); historyRoute.setPath(path); historyRoute.setPosition(position); } } catch (Exception e5) { e5.printStackTrace(); } } hisInfo.add(historyRoute); return hisInfo; } private void sort(List list){ Collections.sort(list,new Comparator() { @Override public int compare(HistoryPosition h1, HistoryPosition h2) { return h1.getTimestamp().compareTo(h2.getTimestamp()); } }); } @RequestMapping(value = { "/getMultiHistorylocationByName" }, method = { RequestMethod.POST }) @ApiOperation("远程调用多个人员历史轨迹接口获取相关信息并将其融合(输入姓名)") @ResponseBody public Object getMultiHistorylocationByName(final String shopId, final long startTime, final long endTime, final String modId, final String modKey, final String order, final Integer pageNum, final Integer pageSize, final String... usernames) throws Exception { final RestTemplate restTemplate = new RestTemplate((ClientHttpRequestFactory)new HttpsClientRequestFactory()); restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); final String poly1 = this.configInfo.getHydrogen_station(); final String poly2 = this.configInfo.getQjgl(); final String poly3 = this.configInfo.getSmjs(); final String poly4 = this.configInfo.getPd6(); final Map params1 = new HashMap(); final Map params2 = new HashMap(); final Map map1 = new HashMap(); final Map map2 = new HashMap(); final Map map3 = new HashMap(); final Map map4 = new HashMap(); final List userIds = new ArrayList(); for (int i = 0; i < usernames.length; ++i) { userIds.add(this.infoSynchService.selectIdByName(usernames[i])); } final List hisInfo = new ArrayList(); final HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON_UTF8); final Properties properties = new Properties(); properties.setZwww("arr"); properties.setAcftype("A320"); properties.setARR("ZWWW"); properties.setDEPA("ZGGG"); properties.setHEIGHT("3740"); properties.setType("route"); properties.setCOMPANY("TERRA"); final com.skyline.electricity.pojo.Positions positions = new com.skyline.electricity.pojo.Positions(); positions.setCartographicDegrees((List)new ArrayList()); final Polyline polyline = new Polyline(); polyline.setPositions(positions); final Color color1 = new Color(); final Color color2 = new Color(); final Color color3 = new Color(); final Color color4 = new Color(); final Offset offset = new Offset(); final List cartesian2 = new ArrayList(); cartesian2.add(16.0); cartesian2.add(-32.0); offset.setCartesian2(cartesian2); final Label label = new Label(); final List fillcolor = new ArrayList(); fillcolor.add(255.0); fillcolor.add(0.0); fillcolor.add(0.0); fillcolor.add(255.0); final List backlist = new ArrayList(); backlist.add(0.0); backlist.add(0.0); backlist.add(0.0); backlist.add(255.0); final List pcolor = new ArrayList(); pcolor.add(255.0); pcolor.add(255.0); pcolor.add(255.0); pcolor.add(255.0); final List outline = new ArrayList(); outline.add(255.0); outline.add(255.0); outline.add(255.0); outline.add(255.0); color1.setRgba(fillcolor); color2.setRgba(backlist); color3.setRgba(outline); color4.setRgba(pcolor); label.setBackgroundColor(color2); label.setFillcolor(color1); label.setOutlineColor(color2); label.setFont("14px Arial"); label.setHorizontalOrigin("LEFT"); label.setOutlineWidth(1); label.setPixelOffset(offset); label.setScale(1.0); label.setShow(false); label.setShowBackground(true); label.setStyle("FILL"); label.setText("JYH1051"); label.setVerticalOrigin("BOTTOM"); final PolylineOutline polylineOutline = new PolylineOutline(); polylineOutline.setOutlineColor(color3); polylineOutline.setOutlineWidth(0); polylineOutline.setColor(color4); final Material material = new Material(); material.setPolylineOutline(polylineOutline); final Path path = new Path(); path.setMaterial(material); path.setResolution(100); path.setWidth(3); path.setLeadTime(0); path.setTrailTime(1000); path.setShow(true); final BillBoard billboard = new BillBoard(); billboard.setScale(1.5); billboard.setImage("../img/人员2.png"); final CZML czml = new CZML(); czml.setId("document"); czml.setName("XJMHHISTORYDATA"); czml.setVersion("1.0"); hisInfo.add(czml); final String start_time = this.sdf.format(new Date(startTime)); final String end_time = this.sdf.format(new Date(endTime)); final List timeList = Timeutils.getIntervalTimeList(start_time, end_time, 1440); JSONArray jsonArray2 = null; for (int x = 0; x < userIds.size(); ++x) { final List templist = new ArrayList(); for (int j = 0; j < timeList.size(); j +=2) { params1.put("userId", userIds.get(x)); params1.put("shopId", shopId); params1.put("startTime", timeList.get(j)); params1.put("endTime", timeList.get(j+ 1)); final ResponseEntity responseEntity1 = (ResponseEntity)restTemplate.getForEntity(this.configInfo.getUWB_Historylocation()+ "?apikey=" + this.configInfo.getApikey() + "&userId={userId}&shopId={shopId}&startTime={startTime}&endTime={endTime}", (Class)String.class, (Map)params1); final String body1 = (String)responseEntity1.getBody(); final JSONObject jsonObjectResult1 = JSONObject.parseObject(body1); final JSONArray jsonArray3 = (JSONArray)jsonObjectResult1.get((Object)"data"); if (jsonArray3.size() > 0) { final List list1 = (List)jsonArray3.toJavaList((Class)UWBHistoryInfo.class); List positionsList = new ArrayList(); if (list1.size() > 0) { positionsList = (List)list1.get(0).getPositions(); for (int k = 0; k < positionsList.size(); ++k) { final HistoryPosition hp = new HistoryPosition(); hp.setEntityId(list1.get(0).getUserId()); hp.setUserName(list1.get(0).getUserName()); hp.setTimestamp(this.sdf.format(positionsList.get(k).getTimestamp())); final String uwbpoint = positionsList.get(k).getPosition().getLatitude()+ " " + positionsList.get(k).getPosition().getLongitude(); final String newpoint = this.detectService.transLocation(uwbpoint); final String[] array = newpoint.split(" "); hp.setAltitude(String.valueOf(positionsList.get(k).getPosition().getZ())); hp.setLatitude(array[1]); hp.setLongitude(array[0]); try { final Point point = (Point)this.reader.read("POINT(" + newpoint + ")"); final Polygon polygon1 = (Polygon)this.reader.read("POLYGON(("+ poly1 +"))"); final Polygon polygon2 = (Polygon)this.reader.read("POLYGON((" + poly2 +"))"); final Polygon polygon3 = (Polygon)this.reader.read("POLYGON((" + poly3 + "))"); final Polygon polygon4 = (Polygon)this.reader.read("POLYGON((" + poly4 + "))"); map1.put("polygon", polygon1.toString()); map2.put("polygon", polygon2.toString()); map3.put("polygon", polygon3.toString()); map4.put("polygon", polygon4.toString()); map1.put("point", point.toString()); map2.put("point", point.toString()); map3.put("point", point.toString()); map4.put("point", point.toString()); } catch (Exception e) { e.printStackTrace(); } final String flag1 = this.detectService.judge((Map)map1); final String flag2 = this.detectService.judge((Map)map2); final String flag3 = this.detectService.judge((Map)map3); final String flag4 = this.detectService.judge((Map)map4); if (flag1.equals("t") || flag2.equals("t") || flag3.equals("t") || flag4.equals("t")) { templist.add(hp); } } } } } params2.put("entityId", userIds.get(x)); params2.put("beginTime", this.sdf.format(new Date(startTime))); params2.put("endTime", this.sdf.format(new Date(endTime))); params2.put("modId", modId); params2.put("modKey", modKey); params2.put("order", order); params2.put("pageNum", pageNum); params2.put("pageSize", pageSize); final cn.hutool.json.JSONObject jsonObject = JSONUtil.parseFromMap((Map)params2); final HttpEntity httpEntity = (HttpEntity)new HttpEntity((Object)jsonObject, (MultiValueMap)headers); final ResponseEntity responseEntity2 = (ResponseEntity)restTemplate.postForEntity(this.configInfo.getGPS_Historylocation() + "?apikey=" + this.configInfo.getApikey(), (Object)httpEntity, (Class)String.class, new Object[0]); final String body2 = (String)responseEntity2.getBody(); final JSONObject jsonObjectResult2 = JSONObject.parseObject(body2); final JSONObject object = (JSONObject)jsonObjectResult2.get((Object)"data"); jsonArray2 = (JSONArray)object.get((Object)"statisticList"); if (jsonArray2.size() > 0) { final List list2 = (List)jsonArray2.toJavaList((Class)HistoryPosition.class); for (final HistoryPosition h : list2) { try { h.setTimestamp(this.sdf.format(this.sdf.parse(h.getTimestamp()))); } catch (Exception e2) { e2.printStackTrace(); } h.setAltitude("1.2"); final String compoint = h.getLongitude()+ " " + h.getLatitude(); try { final Point point2 = (Point)this.reader.read("POINT(" + compoint+ ")"); final Polygon polygon5 = (Polygon)this.reader.read("POLYGON((" + poly1 + "))"); final Polygon polygon6 = (Polygon)this.reader.read("POLYGON((" + poly2 + "))"); final Polygon polygon7 = (Polygon)this.reader.read("POLYGON((" + poly3 + "))"); final Polygon polygon8 = (Polygon)this.reader.read("POLYGON((" + poly4 + "))"); map1.put("polygon", polygon5.toString()); map2.put("polygon", polygon6.toString()); map3.put("polygon", polygon7.toString()); map4.put("polygon", polygon8.toString()); map1.put("point", point2.toString()); map2.put("point", point2.toString()); map3.put("point", point2.toString()); map4.put("point", point2.toString()); } catch (Exception e3) { e3.printStackTrace(); } final String flag5 = this.detectService.judge((Map)map1); final String flag6 = this.detectService.judge((Map)map2); final String flag7 = this.detectService.judge((Map)map3); final String flag8 = this.detectService.judge((Map)map4); if (flag5.equals("f") && flag6.equals("f") && flag7.equals("f") && flag8.equals("f")) { templist.add(h); } } } //Collections.sort(templist, (Comparator)new RemoteController.RemoteController$3(this)); sort(templist); final List entireList = new ArrayList(); for (int k = 0; k < templist.size(); ++k) { if (k < entireList.size() - 1) { final double timediff = (double)(this.sdf.parse(templist.get(k+ 1).getTimestamp()).getTime() - this.sdf.parse(templist.get(k).getTimestamp()).getTime()); if (timediff > 1000.0) { for (int l = 0; l < timediff / 1000.0; ++l) { final HistoryPosition hp2 = new HistoryPosition(); BeanUtils.copyProperties((Object)templist.get(k), (Object)hp2); final String newTime = this.sdf.format(this.sdf.parse(hp2.getTimestamp()).getTime()+ 1000 * l); hp2.setTimestamp(newTime); entireList.add(hp2); } } else { entireList.add(templist.get(k)); } } else { entireList.add(templist.get(k)); } } //Collections.sort(entireList, (Comparator)new RemoteController.RemoteController$4(this)); sort(entireList); final HistoryRoute historyRoute = new HistoryRoute(); final List cartographicDegrees = new ArrayList(); final Position position = new Position(); for (int l = 0; l < entireList.size(); ++l) { try { historyRoute.setId(entireList.get(l).getEntityId()); position.setInterpolationDegree("3"); position.setInterpolationAlgorithm("HERMITE"); Date date1 = null; Date date2 = null; date1 = this.sdf.parse(entireList.get(0).getTimestamp()); date2 = this.sdf.parse(entireList.get(l).getTimestamp()); final double timediff2 = (double)((date2.getTime() - date1.getTime()) / 1000L); cartographicDegrees.add(timediff2); cartographicDegrees.add(Double.parseDouble(entireList.get(l).getLongitude())); cartographicDegrees.add(Double.parseDouble(entireList.get(l).getLatitude())); if (entireList.get(l).getAltitude() != null && !entireList.get(l).getAltitude().equals("")) { cartographicDegrees.add(Double.parseDouble(entireList.get(l).getAltitude())); } if (l == templist.size() - 1) { final StringBuffer stringBuffer = new StringBuffer(this.sdf.format(date1).replaceAll(" ", "T")); stringBuffer.append("Z"); final StringBuffer stringBuffer2 = new StringBuffer(this.sdf.format(this.sdf.parse(entireList.get(entireList.size() - 1).getTimestamp())).replaceAll(" ", "T")); stringBuffer2.append("Z"); position.setCartographicDegrees((List)cartographicDegrees); historyRoute.setName(this.infoSynchService.selectNameById((String)userIds.get(x))); position.setEpoch(stringBuffer.toString()); historyRoute.setDescription("

History

"); historyRoute.setProperties(properties); historyRoute.setAvailability((Object)stringBuffer+ "/" + (Object)stringBuffer2); historyRoute.setPolyline(polyline); historyRoute.setModel(null); historyRoute.setBillboard(billboard); historyRoute.setLabel(label); historyRoute.setPath(path); historyRoute.setPosition(position); } } catch (Exception e4) { e4.printStackTrace(); } } hisInfo.add(historyRoute); } return hisInfo; } @RequestMapping(value = { "/oldgetHistorylocation" }, method = { RequestMethod.POST }) @ApiOperation("远程调用单个人员历史轨迹接口获取相关信息并将其融合(未补点)") @ResponseBody public Object oldgetHistorylocation(final String shopId, final String userId, final long startTime, final long endTime, final String modId, final String modKey, final String order, final Integer pageNum, final Integer pageSize) throws Exception { final RestTemplate restTemplate = new RestTemplate((ClientHttpRequestFactory)new HttpsClientRequestFactory()); restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); final String poly1 = this.configInfo.getHydrogen_station(); final String poly2 = this.configInfo.getQjgl(); final String poly3 = this.configInfo.getSmjs(); final String poly4 = this.configInfo.getPd6(); final Map params1 = new HashMap(); final Map params2 = new HashMap(); final Map map1 = new HashMap(); final Map map2 = new HashMap(); final Map map3 = new HashMap(); final Map map4 = new HashMap(); final List hisInfo = new ArrayList(); params2.put("entityId", userId); params2.put("beginTime", this.sdf.format(new Date(startTime))); params2.put("endTime", this.sdf.format(new Date(endTime))); params2.put("modId", modId); params2.put("modKey", modKey); params2.put("order", order); params2.put("pageNum", pageNum); params2.put("pageSize", pageSize); final HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON_UTF8); final cn.hutool.json.JSONObject jsonObject = JSONUtil.parseFromMap((Map)params2); final HttpEntity httpEntity = (HttpEntity)new HttpEntity((Object)jsonObject, (MultiValueMap)headers); final String start_time = this.sdf.format(new Date(startTime)); final String end_time = this.sdf.format(new Date(endTime)); final List timeList = Timeutils.getIntervalTimeList(start_time, end_time, 1440); final List hpList = new ArrayList(); for (int j = 0; j < timeList.size(); j +=2) { params1.put("userId", userId); params1.put("shopId", shopId); params1.put("startTime", timeList.get(j)); params1.put("endTime", timeList.get(j+ 1)); final ResponseEntity responseEntity1 = (ResponseEntity)restTemplate.getForEntity(this.configInfo.getUWB_Historylocation()+ "?apikey=" + this.configInfo.getApikey() + "&userId={userId}&shopId={shopId}&startTime={startTime}&endTime={endTime}", (Class)String.class, (Map)params1); final String body1 = (String)responseEntity1.getBody(); final JSONObject jsonObjectResult1 = JSONObject.parseObject(body1); final JSONArray jsonArray1 = (JSONArray)jsonObjectResult1.get((Object)"data"); if (jsonArray1.size() > 0) { final List list1 = (List)jsonArray1.toJavaList((Class)UWBHistoryInfo.class); List positionsList = new ArrayList(); if (list1.size() > 0) { positionsList = (List)list1.get(0).getPositions(); } for (int i = 0; i < positionsList.size(); ++i) { final HistoryPosition hp = new HistoryPosition(); hp.setEntityId(list1.get(0).getUserId()); hp.setUserName(list1.get(0).getUserName()); hp.setTimestamp(this.sdf.format(positionsList.get(i).getTimestamp())); final String uwbpoint = positionsList.get(i).getPosition().getLatitude()+ " " + positionsList.get(i).getPosition().getLongitude(); final String newpoint = this.detectService.transLocation(uwbpoint); final String[] array = newpoint.split(" "); hp.setAltitude(String.valueOf(positionsList.get(i).getPosition().getZ())); hp.setLatitude(array[1]); hp.setLongitude(array[0]); try { final Point point = (Point)this.reader.read("POINT(" + newpoint + ")"); final Polygon polygon1 = (Polygon)this.reader.read("POLYGON((" + poly1 + "))"); final Polygon polygon2 = (Polygon)this.reader.read("POLYGON((" + poly2 + "))"); final Polygon polygon3 = (Polygon)this.reader.read("POLYGON((" +poly3 + "))"); final Polygon polygon4 = (Polygon)this.reader.read("POLYGON((" + poly4 + "))"); map1.put("polygon", polygon1.toString()); map2.put("polygon", polygon2.toString()); map3.put("polygon", polygon3.toString()); map4.put("polygon", polygon4.toString()); map1.put("point", point.toString()); map2.put("point", point.toString()); map3.put("point", point.toString()); map4.put("point", point.toString()); } catch (Exception e) { e.printStackTrace(); } final String flag1 = this.detectService.judge((Map)map1); final String flag2 = this.detectService.judge((Map)map2); final String flag3 = this.detectService.judge((Map)map3); final String flag4 = this.detectService.judge((Map)map4); if (flag1.equals("t") || flag2.equals("t") || flag3.equals("t") || flag4.equals("t")) { hpList.add(hp); } } } } final Properties properties = new Properties(); properties.setZwww("arr"); properties.setAcftype("A320"); properties.setARR("ZWWW"); properties.setDEPA("ZGGG"); properties.setHEIGHT("3740"); properties.setType("route"); properties.setCOMPANY("TERRA"); final com.skyline.electricity.pojo.Positions positions = new com.skyline.electricity.pojo.Positions(); positions.setCartographicDegrees((List)new ArrayList()); final Polyline polyline = new Polyline(); polyline.setPositions(positions); final Color color1 = new Color(); final Color color2 = new Color(); final Color color3 = new Color(); final Color color4 = new Color(); final Offset offset = new Offset(); final List cartesian2 = new ArrayList(); cartesian2.add(16.0); cartesian2.add(-32.0); offset.setCartesian2(cartesian2); final Label label = new Label(); final List fillcolor = new ArrayList(); fillcolor.add(255.0); fillcolor.add(0.0); fillcolor.add(0.0); fillcolor.add(255.0); final List backlist = new ArrayList(); backlist.add(0.0); backlist.add(0.0); backlist.add(0.0); backlist.add(255.0); final List pcolor = new ArrayList(); pcolor.add(255.0); pcolor.add(255.0); pcolor.add(255.0); pcolor.add(255.0); final List outline = new ArrayList(); outline.add(255.0); outline.add(255.0); outline.add(255.0); outline.add(255.0); color1.setRgba(fillcolor); color2.setRgba(backlist); color3.setRgba(outline); color4.setRgba(pcolor); label.setBackgroundColor(color2); label.setFillcolor(color1); label.setOutlineColor(color2); label.setFont("14px Arial"); label.setHorizontalOrigin("LEFT"); label.setOutlineWidth(1); label.setPixelOffset(offset); label.setScale(1.0); label.setShow(false); label.setShowBackground(true); label.setStyle("FILL"); label.setText("JYH1051"); label.setVerticalOrigin("BOTTOM"); final PolylineOutline polylineOutline = new PolylineOutline(); polylineOutline.setOutlineColor(color3); polylineOutline.setOutlineWidth(0); polylineOutline.setColor(color4); final Material material = new Material(); material.setPolylineOutline(polylineOutline); final Path path = new Path(); path.setMaterial(material); path.setResolution(100); path.setWidth(3); path.setLeadTime(0); path.setTrailTime(1000); path.setShow(true); final BillBoard billboard = new BillBoard(); billboard.setScale(1.5); billboard.setImage("../img/人员2.png"); final CZML czml = new CZML(); czml.setId("document"); czml.setName("XJMHHISTORYDATA"); czml.setVersion("1.0"); hisInfo.add(czml); final ResponseEntity responseEntity2 = (ResponseEntity)restTemplate.postForEntity(this.configInfo.getGPS_Historylocation()+ "?apikey=" + this.configInfo.getApikey(), (Object)httpEntity, (Class)String.class, new Object[0]); final String body2 = (String)responseEntity2.getBody(); final JSONObject jsonObjectResult2 = JSONObject.parseObject(body2); final JSONObject object = (JSONObject)jsonObjectResult2.get((Object)"data"); final JSONArray jsonArray2 = (JSONArray)object.get((Object)"statisticList"); if (jsonArray2.size() > 0) { final List list2 = (List)jsonArray2.toJavaList((Class)HistoryPosition.class); for (final HistoryPosition h : list2) { try { h.setTimestamp(this.sdf.format(this.sdf.parse(h.getTimestamp()))); } catch (Exception e2) { e2.printStackTrace(); } h.setAltitude("1.2"); final String compoint = h.getLongitude()+ " " + h.getLatitude(); try { final Point point2 = (Point)this.reader.read("POINT(" + compoint+ ")"); final Polygon polygon5 = (Polygon)this.reader.read("POLYGON((" + poly1 + "))"); final Polygon polygon6 = (Polygon)this.reader.read("POLYGON((" + poly2 + "))"); final Polygon polygon7 = (Polygon)this.reader.read("POLYGON((" + poly3 + "))"); final Polygon polygon8 = (Polygon)this.reader.read("POLYGON((" + poly4 + "))"); map1.put("polygon", polygon5.toString()); map2.put("polygon", polygon6.toString()); map3.put("polygon", polygon7.toString()); map4.put("polygon", polygon8.toString()); map1.put("point", point2.toString()); map2.put("point", point2.toString()); map3.put("point", point2.toString()); map4.put("point", point2.toString()); } catch (Exception e3) { e3.printStackTrace(); } final String flag5 = this.detectService.judge((Map)map1); final String flag6 = this.detectService.judge((Map)map2); final String flag7 = this.detectService.judge((Map)map3); final String flag8 = this.detectService.judge((Map)map4); if (flag5.equals("f") && flag6.equals("f") && flag7.equals("f") && flag8.equals("f")) { hpList.add(h); } } } final Set set = new HashSet(); set.addAll(hpList); final List newHpList = new ArrayList(set); //Collections.sort(newHpList, (Comparator)new RemoteController.RemoteController$5(this)); sort(newHpList); final HistoryRoute historyRoute = new HistoryRoute(); final List cartographicDegrees = new ArrayList(); final Position position = new Position(); for (int k = 0; k < newHpList.size(); ++k) { try { historyRoute.setId(newHpList.get(k).getEntityId()); position.setInterpolationDegree("3"); position.setInterpolationAlgorithm("HERMITE"); Date date1 = null; Date date2 = null; date1 = this.sdf.parse(newHpList.get(0).getTimestamp()); date2 = this.sdf.parse(newHpList.get(k).getTimestamp()); final double timediff = (double)((date2.getTime() - date1.getTime()) / 1000L); cartographicDegrees.add(timediff); cartographicDegrees.add(Double.parseDouble(newHpList.get(k).getLongitude())); cartographicDegrees.add(Double.parseDouble(newHpList.get(k).getLatitude())); if (newHpList.get(k).getAltitude() != null && !newHpList.get(k).getAltitude().equals("")) { cartographicDegrees.add(Double.parseDouble(newHpList.get(k).getAltitude())); } if (k == newHpList.size() - 1) { final StringBuffer stringBuffer = new StringBuffer(this.sdf.format(date1).replaceAll(" ", "T")); stringBuffer.append("Z"); final StringBuffer stringBuffer2 = new StringBuffer(this.sdf.format(this.sdf.parse(newHpList.get(newHpList.size() - 1).getTimestamp())).replaceAll(" ", "T")); stringBuffer2.append("Z"); position.setCartographicDegrees((List)cartographicDegrees); historyRoute.setName(newHpList.get(k).getUserName()); position.setEpoch(stringBuffer.toString()); historyRoute.setDescription("

History

"); historyRoute.setProperties(properties); historyRoute.setAvailability((Object)stringBuffer+ "/" + (Object)stringBuffer2); historyRoute.setPolyline(polyline); historyRoute.setModel(null); historyRoute.setBillboard(billboard); historyRoute.setLabel(label); historyRoute.setPath(path); historyRoute.setPosition(position); } } catch (Exception e4) { e4.printStackTrace(); } } hisInfo.add(historyRoute); return hisInfo; } @RequestMapping(value = { "/getHistorylocation" }, method = { RequestMethod.POST }) @ApiOperation("远程调用单个人员历史轨迹接口获取相关信息并将其融合(输入ID)") @ResponseBody public Object getHistorylocation(final String shopId, final String userId, final long startTime, final long endTime, final String modId, final String modKey, final String order, final Integer pageNum, final Integer pageSize) throws Exception { final RestTemplate restTemplate = new RestTemplate((ClientHttpRequestFactory)new HttpsClientRequestFactory()); restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); final String poly1 = this.configInfo.getHydrogen_station(); final String poly2 = this.configInfo.getQjgl(); final String poly3 = this.configInfo.getSmjs(); final String poly4 = this.configInfo.getPd6(); final Map params1 = new HashMap(); final Map params2 = new HashMap(); final Map map1 = new HashMap(); final Map map2 = new HashMap(); final Map map3 = new HashMap(); final Map map4 = new HashMap(); final List hisInfo = new ArrayList(); params2.put("entityId", userId); params2.put("beginTime", this.sdf.format(new Date(startTime))); params2.put("endTime", this.sdf.format(new Date(endTime))); params2.put("modId", modId); params2.put("modKey", modKey); params2.put("order", order); params2.put("pageNum", pageNum); params2.put("pageSize", pageSize); final HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON_UTF8); final cn.hutool.json.JSONObject jsonObject = JSONUtil.parseFromMap((Map)params2); final HttpEntity httpEntity = (HttpEntity)new HttpEntity((Object)jsonObject, (MultiValueMap)headers); final String start_time = this.sdf.format(new Date(startTime)); final String end_time = this.sdf.format(new Date(endTime)); final List timeList = Timeutils.getIntervalTimeList(start_time, end_time, 1440); final List hpList = new ArrayList(); for (int j = 0; j < timeList.size(); j +=2) { params1.put("userId", userId); params1.put("shopId", shopId); params1.put("startTime", timeList.get(j)); params1.put("endTime", timeList.get(j+ 1)); final ResponseEntity responseEntity1 = (ResponseEntity)restTemplate.getForEntity(this.configInfo.getUWB_Historylocation()+ "?apikey=" + this.configInfo.getApikey() + "&userId={userId}&shopId={shopId}&startTime={startTime}&endTime={endTime}", (Class)String.class, (Map)params1); final String body1 = (String)responseEntity1.getBody(); final JSONObject jsonObjectResult1 = JSONObject.parseObject(body1); if (jsonObjectResult1 != null) { final JSONArray jsonArray1 = (JSONArray)jsonObjectResult1.get((Object)"data"); final List list1 = (List)jsonArray1.toJavaList((Class)UWBHistoryInfo.class); List positionsList = new ArrayList(); if (list1.size() > 0) { positionsList = (List)list1.get(0).getPositions(); } for (int i = 0; i < positionsList.size(); ++i) { final HistoryPosition hp = new HistoryPosition(); hp.setEntityId(list1.get(0).getUserId()); hp.setUserName(list1.get(0).getUserName()); hp.setTimestamp(this.sdf.format(positionsList.get(i).getTimestamp())); final String uwbpoint = positionsList.get(i).getPosition().getLatitude()+ " " + positionsList.get(i).getPosition().getLongitude(); final String newpoint = this.detectService.transLocation(uwbpoint); final String[] array = newpoint.split(" "); hp.setAltitude(String.valueOf(positionsList.get(i).getPosition().getZ())); hp.setLatitude(array[1]); hp.setLongitude(array[0]); try { final Point point = (Point)this.reader.read("POINT("+ newpoint + ")"); final Polygon polygon1 = (Polygon)this.reader.read("POLYGON((" + poly1 + "))"); final Polygon polygon2 = (Polygon)this.reader.read("POLYGON((" + poly2 + "))"); final Polygon polygon3 = (Polygon)this.reader.read("POLYGON((" +poly3 + "))"); final Polygon polygon4 = (Polygon)this.reader.read("POLYGON((" +poly4 + "))"); map1.put("polygon", polygon1.toString()); map2.put("polygon", polygon2.toString()); map3.put("polygon", polygon3.toString()); map4.put("polygon", polygon4.toString()); map1.put("point", point.toString()); map2.put("point", point.toString()); map3.put("point", point.toString()); map4.put("point", point.toString()); } catch (Exception e) { e.printStackTrace(); } final String flag1 = this.detectService.judge((Map)map1); final String flag2 = this.detectService.judge((Map)map2); final String flag3 = this.detectService.judge((Map)map3); final String flag4 = this.detectService.judge((Map)map4); if (flag1.equals("t") || flag2.equals("t") || flag3.equals("t") || flag4.equals("t")) { hpList.add(hp); } } } } final Properties properties = new Properties(); properties.setZwww("arr"); properties.setAcftype("A320"); properties.setARR("ZWWW"); properties.setDEPA("ZGGG"); properties.setHEIGHT("3740"); properties.setType("route"); properties.setCOMPANY("TERRA"); final com.skyline.electricity.pojo.Positions positions = new com.skyline.electricity.pojo.Positions(); positions.setCartographicDegrees((List)new ArrayList()); final Polyline polyline = new Polyline(); polyline.setPositions(positions); final Color color1 = new Color(); final Color color2 = new Color(); final Color color3 = new Color(); final Color color4 = new Color(); final Offset offset = new Offset(); final List cartesian2 = new ArrayList(); cartesian2.add(16.0); cartesian2.add(-32.0); offset.setCartesian2(cartesian2); final Label label = new Label(); final List fillcolor = new ArrayList(); fillcolor.add(255.0); fillcolor.add(0.0); fillcolor.add(0.0); fillcolor.add(255.0); final List backlist = new ArrayList(); backlist.add(0.0); backlist.add(0.0); backlist.add(0.0); backlist.add(255.0); final List pcolor = new ArrayList(); pcolor.add(255.0); pcolor.add(255.0); pcolor.add(255.0); pcolor.add(255.0); final List outline = new ArrayList(); outline.add(255.0); outline.add(255.0); outline.add(255.0); outline.add(255.0); color1.setRgba(fillcolor); color2.setRgba(backlist); color3.setRgba(outline); color4.setRgba(pcolor); label.setBackgroundColor(color2); label.setFillcolor(color1); label.setOutlineColor(color2); label.setFont("14px Arial"); label.setHorizontalOrigin("LEFT"); label.setOutlineWidth(1); label.setPixelOffset(offset); label.setScale(1.0); label.setShow(false); label.setShowBackground(true); label.setStyle("FILL"); label.setText("JYH1051"); label.setVerticalOrigin("BOTTOM"); final PolylineOutline polylineOutline = new PolylineOutline(); polylineOutline.setOutlineColor(color3); polylineOutline.setOutlineWidth(0); polylineOutline.setColor(color4); final Material material = new Material(); material.setPolylineOutline(polylineOutline); final Path path = new Path(); path.setMaterial(material); path.setResolution(100); path.setWidth(3); path.setLeadTime(0); path.setTrailTime(1000); path.setShow(true); final BillBoard billboard = new BillBoard(); billboard.setScale(1.5); billboard.setImage("../img/人员2.png"); final CZML czml = new CZML(); czml.setId("document"); czml.setName("XJMHHISTORYDATA"); czml.setVersion("1.0"); hisInfo.add(czml); final ResponseEntity responseEntity2 = (ResponseEntity)restTemplate.postForEntity(this.configInfo.getGPS_Historylocation()+ "?apikey=" + this.configInfo.getApikey(), (Object)httpEntity, (Class)String.class, new Object[0]); final String body2 = (String)responseEntity2.getBody(); final JSONObject jsonObjectResult2 = JSONObject.parseObject(body2); final JSONObject object = (JSONObject)jsonObjectResult2.get((Object)"data"); if (object != null) { final JSONArray jsonArray2 = (JSONArray)object.get((Object)"statisticList"); final List list2 = (List)jsonArray2.toJavaList((Class)HistoryPosition.class); for (final HistoryPosition h : list2) { try { h.setTimestamp(this.sdf.format(this.sdf.parse(h.getTimestamp()))); } catch (Exception e2) { e2.printStackTrace(); } h.setAltitude("1.2"); final String compoint = h.getLongitude() + " " + h.getLatitude(); try { final Point point2 = (Point)this.reader.read("POINT(" + compoint + ")"); final Polygon polygon5 = (Polygon)this.reader.read("POLYGON((" + poly1 + "))"); final Polygon polygon6 = (Polygon)this.reader.read("POLYGON((" + poly2 + "))"); final Polygon polygon7 = (Polygon)this.reader.read("POLYGON((" + poly3 + "))"); final Polygon polygon8 = (Polygon)this.reader.read("POLYGON((" + poly4 + "))"); map1.put("polygon", polygon5.toString()); map2.put("polygon", polygon6.toString()); map3.put("polygon", polygon7.toString()); map4.put("polygon", polygon8.toString()); map1.put("point", point2.toString()); map2.put("point", point2.toString()); map3.put("point", point2.toString()); map4.put("point", point2.toString()); } catch (Exception e3) { e3.printStackTrace(); } final String flag5 = this.detectService.judge((Map)map1); final String flag6 = this.detectService.judge((Map)map2); final String flag7 = this.detectService.judge((Map)map3); final String flag8 = this.detectService.judge((Map)map4); if (flag5.equals("f") && flag6.equals("f") && flag7.equals("f") && flag8.equals("f")) { hpList.add(h); } } } final Set set = new HashSet(); set.addAll(hpList); final List newHpList = new ArrayList(set); //Collections.sort(newHpList, (Comparator)new RemoteController.RemoteController$6(this)); sort(newHpList); final List entireList = new ArrayList(); for (int k = 0; k < newHpList.size(); ++k) { if (k < newHpList.size() - 1) { final double timediff = (double)(this.sdf.parse(newHpList.get(k+ 1).getTimestamp()).getTime() - this.sdf.parse(newHpList.get(k).getTimestamp()).getTime()); if (timediff > 1000.0) { for (int l = 0; l < timediff / 1000.0; ++l) { final HistoryPosition hp2 = new HistoryPosition(); BeanUtils.copyProperties((Object)newHpList.get(k), (Object)hp2); final String newTime = this.sdf.format(this.sdf.parse(hp2.getTimestamp()).getTime()+ 1000 * l); hp2.setTimestamp(newTime); entireList.add(hp2); } } else { entireList.add(newHpList.get(k)); } } else { entireList.add(newHpList.get(k)); } } //Collections.sort(entireList, (Comparator)new RemoteController.RemoteController$7(this)); sort(entireList); final HistoryRoute historyRoute = new HistoryRoute(); final List cartographicDegrees = new ArrayList(); final Position position = new Position(); for (int l = 0; l < entireList.size(); ++l) { try { historyRoute.setId(entireList.get(l).getEntityId()); position.setInterpolationDegree("3"); position.setInterpolationAlgorithm("HERMITE"); Date date1 = null; Date date2 = null; date1 = this.sdf.parse(entireList.get(0).getTimestamp()); date2 = this.sdf.parse(entireList.get(l).getTimestamp()); final double timediff2 = (double)((date2.getTime() - date1.getTime()) / 1000L); cartographicDegrees.add(timediff2); cartographicDegrees.add(Double.parseDouble(entireList.get(l).getLongitude())); cartographicDegrees.add(Double.parseDouble(entireList.get(l).getLatitude())); if (entireList.get(l).getAltitude() != null && !entireList.get(l).getAltitude().equals("")) { cartographicDegrees.add(Double.parseDouble(entireList.get(l).getAltitude())); } if (l == newHpList.size() - 1) { final StringBuffer stringBuffer = new StringBuffer(this.sdf.format(date1).replaceAll(" ", "T")); stringBuffer.append("Z"); final StringBuffer stringBuffer2 = new StringBuffer(this.sdf.format(this.sdf.parse(entireList.get(entireList.size() - 1).getTimestamp())).replaceAll(" ", "T")); stringBuffer2.append("Z"); position.setCartographicDegrees((List)cartographicDegrees); historyRoute.setName(this.infoSynchService.selectNameById(userId)); position.setEpoch(stringBuffer.toString()); historyRoute.setDescription("

History

"); historyRoute.setProperties(properties); historyRoute.setAvailability((Object)stringBuffer+ "/" + (Object)stringBuffer2); historyRoute.setPolyline(polyline); historyRoute.setModel(null); historyRoute.setBillboard(billboard); historyRoute.setLabel(label); historyRoute.setPath(path); historyRoute.setPosition(position); } } catch (Exception e4) { e4.printStackTrace(); } } hisInfo.add(historyRoute); return hisInfo; } @RequestMapping(value = { "/getMultiHistorylocation" }, method = { RequestMethod.POST }) @ApiOperation("远程调用多个人员历史轨迹接口获取相关信息并将其融合(输入ID)") @ResponseBody public Object getMultiHistorylocation(final String shopId, final long startTime, final long endTime, final String modId, final String modKey, final String order, final Integer pageNum, final Integer pageSize, final String... userIds) throws Exception { final RestTemplate restTemplate = new RestTemplate((ClientHttpRequestFactory)new HttpsClientRequestFactory()); restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); final String poly1 = this.configInfo.getHydrogen_station(); final String poly2 = this.configInfo.getQjgl(); final String poly3 = this.configInfo.getSmjs(); final String poly4 = this.configInfo.getPd6(); final Map params1 = new HashMap(); final Map params2 = new HashMap(); final Map map1 = new HashMap(); final Map map2 = new HashMap(); final Map map3 = new HashMap(); final Map map4 = new HashMap(); final List hisInfo = new ArrayList(); final HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON_UTF8); final Properties properties = new Properties(); properties.setZwww("arr"); properties.setAcftype("A320"); properties.setARR("ZWWW"); properties.setDEPA("ZGGG"); properties.setHEIGHT("3740"); properties.setType("route"); properties.setCOMPANY("TERRA"); final com.skyline.electricity.pojo.Positions positions = new com.skyline.electricity.pojo.Positions(); positions.setCartographicDegrees((List)new ArrayList()); final Polyline polyline = new Polyline(); polyline.setPositions(positions); final Color color1 = new Color(); final Color color2 = new Color(); final Color color3 = new Color(); final Color color4 = new Color(); final Offset offset = new Offset(); final List cartesian2 = new ArrayList(); cartesian2.add(16.0); cartesian2.add(-32.0); offset.setCartesian2(cartesian2); final Label label = new Label(); final List fillcolor = new ArrayList(); fillcolor.add(255.0); fillcolor.add(0.0); fillcolor.add(0.0); fillcolor.add(255.0); final List backlist = new ArrayList(); backlist.add(0.0); backlist.add(0.0); backlist.add(0.0); backlist.add(255.0); final List pcolor = new ArrayList(); pcolor.add(255.0); pcolor.add(255.0); pcolor.add(255.0); pcolor.add(255.0); final List outline = new ArrayList(); outline.add(255.0); outline.add(255.0); outline.add(255.0); outline.add(255.0); color1.setRgba(fillcolor); color2.setRgba(backlist); color3.setRgba(outline); color4.setRgba(pcolor); label.setBackgroundColor(color2); label.setFillcolor(color1); label.setOutlineColor(color2); label.setFont("14px Arial"); label.setHorizontalOrigin("LEFT"); label.setOutlineWidth(1); label.setPixelOffset(offset); label.setScale(1.0); label.setShow(false); label.setShowBackground(true); label.setStyle("FILL"); label.setText("JYH1051"); label.setVerticalOrigin("BOTTOM"); final PolylineOutline polylineOutline = new PolylineOutline(); polylineOutline.setOutlineColor(color3); polylineOutline.setOutlineWidth(0); polylineOutline.setColor(color4); final Material material = new Material(); material.setPolylineOutline(polylineOutline); final Path path = new Path(); path.setMaterial(material); path.setResolution(100); path.setWidth(3); path.setLeadTime(0); path.setTrailTime(1000); path.setShow(true); final BillBoard billboard = new BillBoard(); billboard.setScale(1.5); billboard.setImage("../img/人员2.png"); final CZML czml = new CZML(); czml.setId("document"); czml.setName("XJMHHISTORYDATA"); czml.setVersion("1.0"); hisInfo.add(czml); final String start_time = this.sdf.format(new Date(startTime)); final String end_time = this.sdf.format(new Date(endTime)); final List timeList = Timeutils.getIntervalTimeList(start_time, end_time, 1440); JSONArray jsonArray2 = null; for (int x = 0; x < userIds.length; ++x) { final List templist = new ArrayList(); for (int j = 0; j < timeList.size(); j +=2) { params1.put("userId", userIds[x]); params1.put("shopId", shopId); params1.put("startTime", timeList.get(j)); params1.put("endTime", timeList.get(j+ 1)); final ResponseEntity responseEntity1 = (ResponseEntity)restTemplate.getForEntity(this.configInfo.getUWB_Historylocation()+ "?apikey="+ this.configInfo.getApikey()+ "&userId={userId}&shopId={shopId}&startTime={startTime}&endTime={endTime}", (Class)String.class, (Map)params1); final String body1 = (String)responseEntity1.getBody(); final JSONObject jsonObjectResult1 = JSONObject.parseObject(body1); final JSONArray jsonArray3 = (JSONArray)jsonObjectResult1.get((Object)"data"); if (jsonArray3.size() > 0) { final List list1 = (List)jsonArray3.toJavaList((Class)UWBHistoryInfo.class); List positionsList = new ArrayList(); if (list1.size() > 0) { positionsList = (List)list1.get(0).getPositions(); for (int i = 0; i < positionsList.size(); ++i) { final HistoryPosition hp = new HistoryPosition(); hp.setEntityId(list1.get(0).getUserId()); hp.setUserName(list1.get(0).getUserName()); hp.setTimestamp(this.sdf.format(positionsList.get(i).getTimestamp())); final String uwbpoint = positionsList.get(i).getPosition().getLatitude()+ " " + positionsList.get(i).getPosition().getLongitude(); final String newpoint = this.detectService.transLocation(uwbpoint); final String[] array = newpoint.split(" "); hp.setAltitude(String.valueOf(positionsList.get(i).getPosition().getZ())); hp.setLatitude(array[1]); hp.setLongitude(array[0]); try { final Point point = (Point)this.reader.read("POINT(" + newpoint + ")"); final Polygon polygon1 = (Polygon)this.reader.read("POLYGON(("+ poly1 + "))"); final Polygon polygon2 = (Polygon)this.reader.read("POLYGON((" + poly2 + "))"); final Polygon polygon3 = (Polygon)this.reader.read("POLYGON((" + poly3 + "))"); final Polygon polygon4 = (Polygon)this.reader.read("POLYGON((" + poly4 + "))"); map1.put("polygon", polygon1.toString()); map2.put("polygon", polygon2.toString()); map3.put("polygon", polygon3.toString()); map4.put("polygon", polygon4.toString()); map1.put("point", point.toString()); map2.put("point", point.toString()); map3.put("point", point.toString()); map4.put("point", point.toString()); } catch (Exception e) { e.printStackTrace(); } final String flag1 = this.detectService.judge((Map)map1); final String flag2 = this.detectService.judge((Map)map2); final String flag3 = this.detectService.judge((Map)map3); final String flag4 = this.detectService.judge((Map)map4); if (flag1.equals("t") || flag2.equals("t") || flag3.equals("t") || flag4.equals("t")) { templist.add(hp); } } } } } params2.put("entityId", userIds[x]); params2.put("beginTime", this.sdf.format(new Date(startTime))); params2.put("endTime", this.sdf.format(new Date(endTime))); params2.put("modId", modId); params2.put("modKey", modKey); params2.put("order", order); params2.put("pageNum", pageNum); params2.put("pageSize", pageSize); final cn.hutool.json.JSONObject jsonObject = JSONUtil.parseFromMap((Map)params2); final HttpEntity httpEntity = (HttpEntity)new HttpEntity((Object)jsonObject, (MultiValueMap)headers); final ResponseEntity responseEntity2 = (ResponseEntity)restTemplate.postForEntity(this.configInfo.getGPS_Historylocation()+ "?apikey=" + this.configInfo.getApikey(), (Object)httpEntity, (Class)String.class, new Object[0]); final String body2 = (String)responseEntity2.getBody(); final JSONObject jsonObjectResult2 = JSONObject.parseObject(body2); final JSONObject object = (JSONObject)jsonObjectResult2.get((Object)"data"); jsonArray2 = (JSONArray)object.get((Object)"statisticList"); if (jsonArray2.size() > 0) { final List list2 = (List)jsonArray2.toJavaList((Class)HistoryPosition.class); for (final HistoryPosition h : list2) { try { h.setTimestamp(this.sdf.format(this.sdf.parse(h.getTimestamp()))); } catch (Exception e2) { e2.printStackTrace(); } h.setAltitude("1.2"); final String compoint = h.getLongitude() + " " + h.getLatitude(); try { final Point point2 = (Point)this.reader.read("POINT(" + compoint + ")"); final Polygon polygon5 = (Polygon)this.reader.read("POLYGON((" + poly1 + "))"); final Polygon polygon6 = (Polygon)this.reader.read("POLYGON((" + poly2 +"))"); final Polygon polygon7 = (Polygon)this.reader.read("POLYGON((" + poly3 + "))"); final Polygon polygon8 = (Polygon)this.reader.read("POLYGON((" + poly4 + "))"); map1.put("polygon", polygon5.toString()); map2.put("polygon", polygon6.toString()); map3.put("polygon", polygon7.toString()); map4.put("polygon", polygon8.toString()); map1.put("point", point2.toString()); map2.put("point", point2.toString()); map3.put("point", point2.toString()); map4.put("point", point2.toString()); } catch (Exception e3) { e3.printStackTrace(); } final String flag5 = this.detectService.judge((Map)map1); final String flag6 = this.detectService.judge((Map)map2); final String flag7 = this.detectService.judge((Map)map3); final String flag8 = this.detectService.judge((Map)map4); if (flag5.equals("f") && flag6.equals("f") && flag7.equals("f") && flag8.equals("f")) { templist.add(h); } } } //Collections.sort(templist, (Comparator)new RemoteController.RemoteController$8(this)); sort(templist); final List entireList = new ArrayList(); for (int i = 0; i < templist.size(); ++i) { if (i < templist.size() - 1) { final double timediff = (double)(this.sdf.parse(templist.get(i+ 1).getTimestamp()).getTime() - this.sdf.parse(templist.get(i).getTimestamp()).getTime()); if (timediff > 1000.0) { for (int k = 0; k < timediff / 1000.0; ++k) { final HistoryPosition hp2 = new HistoryPosition(); BeanUtils.copyProperties((Object)templist.get(i), (Object)hp2); final String newTime = this.sdf.format(this.sdf.parse(hp2.getTimestamp()).getTime()+ 1000 * k); hp2.setTimestamp(newTime); entireList.add(hp2); } } else { entireList.add(templist.get(i)); } } else { entireList.add(templist.get(i)); } } //Collections.sort(entireList, (Comparator)new RemoteController.RemoteController$9(this)); sort(entireList); final HistoryRoute historyRoute = new HistoryRoute(); final List cartographicDegrees = new ArrayList(); final Position position = new Position(); for (int k = 0; k < entireList.size(); ++k) { try { historyRoute.setId(entireList.get(k).getEntityId()); position.setInterpolationDegree("3"); position.setInterpolationAlgorithm("HERMITE"); Date date1 = null; Date date2 = null; date1 = this.sdf.parse(entireList.get(0).getTimestamp()); date2 = this.sdf.parse(entireList.get(k).getTimestamp()); final double timediff2 = (double)((date2.getTime() - date1.getTime()) / 1000L); cartographicDegrees.add(timediff2); cartographicDegrees.add(Double.parseDouble(entireList.get(k).getLongitude())); cartographicDegrees.add(Double.parseDouble(entireList.get(k).getLatitude())); if (entireList.get(k).getAltitude() != null && !entireList.get(k).getAltitude().equals("")) { cartographicDegrees.add(Double.parseDouble(entireList.get(k).getAltitude())); } if (k == templist.size() - 1) { final StringBuffer stringBuffer = new StringBuffer(this.sdf.format(date1).replaceAll(" ", "T")); stringBuffer.append("Z"); final StringBuffer stringBuffer2 = new StringBuffer(this.sdf.format(this.sdf.parse(entireList.get(entireList.size() - 1).getTimestamp())).replaceAll(" ", "T")); stringBuffer2.append("Z"); position.setCartographicDegrees((List)cartographicDegrees); historyRoute.setName(this.infoSynchService.selectNameById(userIds[x])); position.setEpoch(stringBuffer.toString()); historyRoute.setDescription("

History

"); historyRoute.setProperties(properties); historyRoute.setAvailability((Object)stringBuffer+ "/" + (Object)stringBuffer2); historyRoute.setPolyline(polyline); historyRoute.setModel(null); historyRoute.setBillboard(billboard); historyRoute.setLabel(label); historyRoute.setPath(path); historyRoute.setPosition(position); } } catch (Exception e4) { e4.printStackTrace(); } } hisInfo.add(historyRoute); } return hisInfo; } @RequestMapping(value = { "/getConfigInfo" }, method = { RequestMethod.POST }) @ApiOperation("获取配置信息") @ResponseBody public Object getConfigInfo() { final Map configinfo = new HashMap(); configinfo.put("coUrl", this.configInfo.getCoUrl()); configinfo.put("imUrl", this.configInfo.getImUrl()); configinfo.put("secret", this.configInfo.getSecret()); configinfo.put("appid", this.configInfo.getAppid()); configinfo.put("tenantId", this.configInfo.getTenantId()); configinfo.put("recipients", this.configInfo.getRecipients()); configinfo.put("shopId", this.configInfo.getShopId()); configinfo.put("modId", this.configInfo.getModId()); configinfo.put("modKey", this.configInfo.getModKey()); configinfo.put("value", this.configInfo.getTimevalue()); configinfo.put("pageNum", this.configInfo.getPageNum()); configinfo.put("pageSize", this.configInfo.getPageSize()); configinfo.put("server_url", this.configInfo.getServer_url()); configinfo.put("iam_url", this.configInfo.getIam_url()); configinfo.put("userInfo_url", this.configInfo.getUserInfo_url()); configinfo.put("safeSystem_ip", this.configInfo.getSafeSystem_ip()); configinfo.put("device_ip", this.configInfo.getDevice_ip()); configinfo.put("token_url", this.configInfo.getToken_url()); configinfo.put("dzzzUrl", this.configInfo.getDzzzUrl()); return configinfo; } @RequestMapping(value = { "/getAllHistorylocation" }, method = { RequestMethod.POST }) @ApiOperation("远程调用所有人员历史轨迹接口获取相关信息并将其融合") @ResponseBody public Object getAllHistorylocation(final String shopId, final long startTime, final long endTime, final String modId, final String modKey, final String order, final Integer pageNum, final Integer pageSize) { final RestTemplate restTemplate = new RestTemplate((ClientHttpRequestFactory)new HttpsClientRequestFactory()); restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); final String poly = "116.768862568095 39.4800165229045,116.770425297759 39.4792480492903,116.770535145313 39.4795398900634,116.76908945345 39.4803175443171,116.768862568095 39.4800165229045"; final Map params1 = new HashMap(); final Map params2 = new HashMap(); final Map map = new HashMap(); final List hisInfo = new ArrayList(); final Properties properties = new Properties(); properties.setZwww("arr"); properties.setAcftype("A320"); properties.setARR("ZWWW"); properties.setDEPA("ZGGG"); properties.setHEIGHT("3740"); properties.setType("route"); properties.setCOMPANY("TERRA"); final com.skyline.electricity.pojo.Positions positions = new com.skyline.electricity.pojo.Positions(); positions.setCartographicDegrees((List)new ArrayList()); final Polyline polyline = new Polyline(); polyline.setPositions(positions); final Color color1 = new Color(); final Color color2 = new Color(); final Color color3 = new Color(); final Color color4 = new Color(); final Offset offset = new Offset(); final List cartesian2 = new ArrayList(); cartesian2.add(16.0); cartesian2.add(-32.0); offset.setCartesian2(cartesian2); final Label label = new Label(); final List fillcolor = new ArrayList(); fillcolor.add(255.0); fillcolor.add(0.0); fillcolor.add(0.0); fillcolor.add(255.0); final List backlist = new ArrayList(); backlist.add(0.0); backlist.add(0.0); backlist.add(0.0); backlist.add(255.0); final List pcolor = new ArrayList(); pcolor.add(255.0); pcolor.add(255.0); pcolor.add(255.0); pcolor.add(255.0); final List outline = new ArrayList(); outline.add(255.0); outline.add(255.0); outline.add(255.0); outline.add(255.0); color1.setRgba(fillcolor); color2.setRgba(backlist); color3.setRgba(outline); color4.setRgba(pcolor); label.setBackgroundColor(color2); label.setFillcolor(color1); label.setOutlineColor(color2); label.setFont("14px Arial"); label.setHorizontalOrigin("LEFT"); label.setOutlineWidth(1); label.setPixelOffset(offset); label.setScale(1.0); label.setShow(false); label.setShowBackground(true); label.setStyle("FILL"); label.setText("JYH1051"); label.setVerticalOrigin("BOTTOM"); final PolylineOutline polylineOutline = new PolylineOutline(); polylineOutline.setOutlineColor(color3); polylineOutline.setOutlineWidth(0); polylineOutline.setColor(color4); final Material material = new Material(); material.setPolylineOutline(polylineOutline); final Path path = new Path(); path.setMaterial(material); path.setResolution(100); path.setWidth(3); path.setLeadTime(0); path.setTrailTime(1000); path.setShow(true); final BillBoard billboard = new BillBoard(); billboard.setScale(1.5); billboard.setImage("../img/人员2.png"); final CZML czml = new CZML(); czml.setId("document"); czml.setName("XJMHHISTORYDATA"); czml.setVersion("1.0"); hisInfo.add(czml); params2.put("beginTime", this.sdf.format(new Date(startTime))); params2.put("endTime", this.sdf.format(new Date(endTime))); params2.put("modId", modId); params2.put("modKey", modKey); params2.put("order", order); params2.put("pageNum", pageNum); params2.put("pageSize", pageSize); final HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON_UTF8); final cn.hutool.json.JSONObject jsonObject = JSONUtil.parseFromMap((Map)params2); final HttpEntity httpEntity = (HttpEntity)new HttpEntity((Object)jsonObject, (MultiValueMap)headers); final ResponseEntity responseEntity2 = (ResponseEntity)restTemplate.postForEntity("https://10.69.206.70:10443/restapi/iot/iotinfomgr/entity/history?apikey=DekzQC2WsKvVQl6CyWlYFp8ZaAf5AFzw", (Object)httpEntity, (Class)String.class, new Object[0]); final String body2 = (String)responseEntity2.getBody(); final JSONObject jsonObjectResult2 = JSONObject.parseObject(body2); final JSONObject object = (JSONObject)jsonObjectResult2.get((Object)"data"); final JSONArray jsonArray2 = (JSONArray)object.get((Object)"statisticList"); final List list2 = (List)jsonArray2.toJavaList((Class)HistoryPosition.class); //final Map> hmap = list2.stream().collect((Collector>>)Collectors.groupingBy((Function)HistoryPosition::getEntityId)); Map> hmap =new HashMap<>(); for(HistoryPosition hp : list2) { map.put(hp.getEntityId(), hp); } final List entityIds = new ArrayList(); final String start_time = this.sdf.format(new Date(startTime)); final String end_time = this.sdf.format(new Date(endTime)); final List timeList = Timeutils.getIntervalTimeList(start_time, end_time, 1440); for (int i = 0; i < list2.size(); ++i) { if (!entityIds.contains(list2.get(i).getEntityId())) { entityIds.add(list2.get(i).getEntityId()); } } for (int x = 0; x < entityIds.size(); ++x) { final List templist = new ArrayList(); final List list3 = hmap.get(entityIds.get(x)); final HistoryRoute historyRoute = new HistoryRoute(); final List cartographicDegrees = new ArrayList(); final Position position = new Position(); for (final HistoryPosition h : list3) { try { h.setTimestamp(this.sdf.format(this.sdf.parse(h.getTimestamp()))); } catch (Exception e) { e.printStackTrace(); } h.setAltitude("1.2"); final String compoint = h.getLongitude()+ " " + h.getLatitude(); try { final Point point = (Point)this.reader.read("POINT(" + compoint + ")"); final Polygon polygon = (Polygon)this.reader.read("POLYGON((" + poly + "))"); map.put("polygon", polygon.toString()); map.put("point", point.toString()); } catch (Exception e2) { e2.printStackTrace(); } final String flag = this.detectService.judge((Map)map); if (flag.equals("f")) { templist.add(h); } } for (int j = 0; j < timeList.size(); j += 2) { params1.put("userId", entityIds.get(x)); params1.put("shopId", shopId); params1.put("startTime", timeList.get(j)); params1.put("endTime", timeList.get(j+ 1)); final ResponseEntity responseEntity3 = (ResponseEntity)restTemplate.getForEntity("https://10.69.206.70:10443/restapi/iot/iotlocationas/gethistorylocation?apikey=KWrgSTHd36CHMa3wlNSECTkckMntDK6U&userId={userId}&shopId={shopId}&startTime={startTime}&endTime={endTime}", (Class)String.class, (Map)params1); final String body3 = (String)responseEntity3.getBody(); final JSONObject jsonObjectResult3 = JSONObject.parseObject(body3); final JSONArray jsonArray3 = (JSONArray)jsonObjectResult3.get((Object)"data"); final List list4 = (List)jsonArray3.toJavaList((Class)UWBHistoryInfo.class); List positionsList = new ArrayList(); if (list4.size() > 0) { positionsList = (List)list4.get(0).getPositions(); } for (int k = 0; k < positionsList.size(); ++ k) { final HistoryPosition hp = new HistoryPosition(); hp.setEntityId(list4.get(0).getUserId()); hp.setUserName(list4.get(0).getUserName()); hp.setTimestamp(this.sdf.format(positionsList.get(k).getTimestamp())); final String uwbpoint = positionsList.get(k).getPosition().getLatitude()+ " " + positionsList.get(k).getPosition().getLongitude(); final String newpoint = this.detectService.transLocation(uwbpoint); final String[] array = newpoint.split(" "); hp.setAltitude(String.valueOf(positionsList.get(k).getPosition().getZ())); hp.setLatitude(array[1]); hp.setLongitude(array[0]); try { final Point point2 = (Point)this.reader.read("POINT(" + newpoint +")"); final Polygon polygon2 = (Polygon)this.reader.read("POLYGON((" +poly + "))"); map.put("polygon", polygon2.toString()); map.put("point", point2.toString()); } catch (Exception e3) { e3.printStackTrace(); } final String flag2 = this.detectService.judge((Map)map); if (flag2.equals("t")) { templist.add(hp); } } } //Collections.sort(templist, (Comparator)new RemoteController.RemoteController$10(this)); sort(templist); for (int j = 0; j < templist.size(); ++j) { try { historyRoute.setId(templist.get(j).getEntityId()); position.setInterpolationDegree("3"); position.setInterpolationAlgorithm("HERMITE"); Date date1 = null; Date date2 = null; date1 = this.sdf.parse(templist.get(0).getTimestamp()); date2 = this.sdf.parse(templist.get(j).getTimestamp()); final double timediff = (double)((date2.getTime() - date1.getTime()) / 1000L); cartographicDegrees.add(timediff); cartographicDegrees.add(Double.parseDouble(templist.get(j).getLongitude())); cartographicDegrees.add(Double.parseDouble(templist.get(j).getLatitude())); if (templist.get(j).getAltitude() != null && !templist.get(j).getAltitude().equals("")) { cartographicDegrees.add(Double.parseDouble(templist.get(j).getAltitude())); } if (j == templist.size() - 1) { final StringBuffer stringBuffer = new StringBuffer(this.sdf.format(date1).replaceAll(" ", "T")); stringBuffer.append("Z"); final StringBuffer stringBuffer2 = new StringBuffer(this.sdf.format(this.sdf.parse(templist.get(templist.size() - 1).getTimestamp())).replaceAll(" ", "T")); stringBuffer2.append("Z"); position.setCartographicDegrees((List)cartographicDegrees); historyRoute.setName(templist.get(j).getUserName()); position.setEpoch(stringBuffer.toString()); historyRoute.setDescription("

History

"); historyRoute.setProperties(properties); historyRoute.setAvailability((Object)stringBuffer + "/" + (Object)stringBuffer2); historyRoute.setPolyline(polyline); historyRoute.setModel(null); historyRoute.setBillboard(billboard); historyRoute.setLabel(label); historyRoute.setPath(path); historyRoute.setPosition(position); } } catch (Exception e4) { e4.printStackTrace(); } } hisInfo.add(historyRoute); } return hisInfo; } @RequestMapping(value = { "/sendMessageToUWB" }, method = { RequestMethod.POST }) @ApiOperation("sendMessageToUWB") @ResponseBody public Object sendMessageToUWB(final String shopId, final String userIds, final Integer messageVibrate, final String instructionType) { final RestTemplate restTemplate = new RestTemplate((ClientHttpRequestFactory)new HttpsClientRequestFactory()); restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); final String uwbUrl = this.configInfo.getDevice_ip() + "/restapi/iot/iotlocationas/sendMessage"; final HttpHeaders uwb_header = new HttpHeaders(); uwb_header.setContentType(MediaType.APPLICATION_JSON_UTF8); final Map uwbMap = new HashMap(); uwbMap.put("shopId", shopId); uwbMap.put("userIds", userIds); uwbMap.put("messageVibrate", messageVibrate); uwbMap.put("instructionType", instructionType); final cn.hutool.json.JSONObject jsonObject = JSONUtil.parseFromMap((Map)uwbMap); final HttpEntity httpEntity = (HttpEntity)new HttpEntity((Object)jsonObject, (MultiValueMap)uwb_header); final ResponseEntity responseEntity = (ResponseEntity)restTemplate.postForEntity(uwbUrl+ "?apikey=" + this.configInfo.getApikey(), (Object)httpEntity, (Class)String.class, new Object[0]); return responseEntity.getBody(); } @RequestMapping(value = { "/getMultiYQPersonlocations" }, method = { RequestMethod.POST }) @ApiOperation("远程调用多个人员定位接口获取定位信息") @ResponseBody public Object getMultiYQPersonlocations(final String shopId, final String modId, final String modKey, final Integer pageNum, final Integer pageSize, int value) { final List yqlist = this.getFencePositionYQ(); final List> judgemapList = new ArrayList>(); final RestTemplate restTemplate = new RestTemplate((ClientHttpRequestFactory)new HttpsClientRequestFactory()); restTemplate.getMessageConverters().set(1, new StringHttpMessageConverter(StandardCharsets.UTF_8)); Map judgemap = null; try { for (int i = 0; i < yqlist.size(); ++i) { judgemap = new HashMap(); final Polygon polygon = (Polygon)this.reader.read("POLYGON((" + yqlist.get(i).getFenceposition() + "))"); judgemap.put("polygon", polygon.toString()); judgemapList.add(judgemap); } } catch (Exception e) { e.printStackTrace(); } final Map params1 = new HashMap(); final Map params2 = new HashMap(); params2.put("modId", modId); params2.put("modKey", modKey); params2.put("pageNum", pageNum); params2.put("pageSize", pageSize); params2.put("attrIndex", "time"); params2.put("type", "interval"); params2.put("value", value); final HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.APPLICATION_JSON); final cn.hutool.json.JSONObject jsonObject = JSONUtil.parseFromMap((Map)params2); final HttpEntity httpEntity = (HttpEntity)new HttpEntity((Object)jsonObject, (MultiValueMap)headers); final ResponseEntity responseEntity1 = (ResponseEntity)restTemplate.postForEntity(this.configInfo.getGPS_EntityList()+ "?apikey=" + this.configInfo.getApikey(), (Object)httpEntity, (Class)String.class, new Object[0]); final String body1 = (String)responseEntity1.getBody(); final JSONObject jsonObjectResult1 = JSONObject.parseObject(body1); final JSONObject object1 = (JSONObject)jsonObjectResult1.get((Object)"data"); final JSONArray jsonArray1 = (JSONArray)object1.get((Object)"list"); final List list1 = (List)jsonArray1.toJavaList((Class)PersonPosition.class); params1.put("shopId", shopId); final List idList = (List)this.infoSynchService.selectAllUserIds(); final StringBuffer stringBuffer = new StringBuffer(); for (int j = 0; j < idList.size(); ++j) { if (j != idList.size() - 1) { stringBuffer.append(idList.get(j) + ","); } else { stringBuffer.append(idList.get(j)); } } params1.put("userIds", stringBuffer.toString().trim()); final HttpHeaders headers2 = new HttpHeaders(); headers2.setContentType(MediaType.APPLICATION_JSON); final cn.hutool.json.JSONObject jsonObject2 = JSONUtil.parseFromMap((Map)params1); final HttpEntity httpEntity2 = (HttpEntity)new HttpEntity((Object)jsonObject2, (MultiValueMap)headers2); RemoteController.log.info("gps前" + yqlist.toString()); final Iterator pit = list1.iterator(); while (pit.hasNext()) { final PersonPosition p = pit.next(); p.setAlitude("1.2"); p.setType("GPS"); String compoint = null; try { if (p.getTime() == null) { continue; } final String currentTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()).toString(); final Date now = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(currentTime); final long long1 = Long.parseLong(p.getTime()); final long l = (now.getTime() - long1) / 1000L / 60L; if (l > 5L) { continue; } if (p.getLongitude() != null && p.getLatitude() != null) { compoint = p.getLongitude() + " " + p.getLatitude(); p.getTime(); Point point = null; if (compoint == null) { continue; } point = (Point)this.reader.read("POINT(" + compoint + ")"); for (int k = 0; k < judgemapList.size(); ++ k) { judgemapList.get(k).put("point", point.toString()); } for (int k = 0; k < judgemapList.size(); ++k) { judgemap = judgemapList.get(k); final boolean flag = this.detectService.judge((Map)judgemap).equals("t"); RemoteController.log.info("位置判断结果" + flag + ":" + judgemap.toString()); final Double a = Double.parseDouble(yqlist.get(k).getYqHeight().split("-")[0]); final Double b = Double.parseDouble(yqlist.get(k).getYqHeight().split("-")[1]); final boolean mark = Double.parseDouble(p.getAlitude()) > a && Double.parseDouble(p.getAlitude()) < b && flag; if (mark) { final int count = yqlist.get(k).getPersoncount()+ 1; yqlist.get(k).setPersoncount(count); final List userids = yqlist.get(k).getUserids(); userids.add(p.getUserId()); yqlist.get(k).setUserids(userids); } if (this.detectService.judge((Map)judgemap).equals("t") || mark) { pit.remove(); } } } else { pit.remove(); } } catch (Exception e2) { e2.printStackTrace(); } } RemoteController.log.info("gps后"+ yqlist.toString()); final ResponseEntity responseEntity2 = (ResponseEntity)restTemplate.postForEntity(this.configInfo.getUWB_MultiPersonlocations()+ "?apikey=" + this.configInfo.getApikey(), (Object)httpEntity2, (Class)String.class, new Object[0]); RemoteController.log.info(httpEntity2.toString()); final String body2 = (String)responseEntity2.getBody(); final JSONObject jsonObjectResult2 = JSONObject.parseObject(body2); final JSONArray jsonArray2 = (JSONArray)jsonObjectResult2.get((Object)"data"); List list2 = null; if (jsonArray2 != null) { list2 = (List)jsonArray2.toJavaList((Class)UWBHistoryLocation.class); for (final UWBHistoryLocation uwb : list2) { if (String.valueOf(uwb.getPosition().getLatitude()) != null && String.valueOf(uwb.getPosition().getLongitude()) != null) { final String compoint2 = uwb.getPosition().getLatitude()+ " " + uwb.getPosition().getLongitude(); final String transpoint = this.detectService.transLocation(compoint2); Point point2 = null; try { point2 = (Point)this.reader.read("POINT(" + transpoint + ")"); for (int m = 0; m < judgemapList.size(); ++m) { judgemapList.get(m).put("point", point2.toString()); } } catch (Exception e3) { e3.printStackTrace(); } for (int m = 0; m < judgemapList.size(); ++m) { final boolean flag2 = this.detectService.judge((Map)judgemapList.get(m)).equals("t"); RemoteController.log.info(""+ flag2 + yqlist.get(m).getFenceName()); final Double a2 = Double.parseDouble(yqlist.get(m).getYqHeight().split("-")[0]); final Double b2 = Double.parseDouble(yqlist.get(m).getYqHeight().split("-")[1]); final boolean mark2 = uwb.getPosition().getZ() > a2 && uwb.getPosition().getZ() < b2 && flag2; if (mark2) { final User user = uwb.getUser(); final List list3 = yqlist.get(m).getUserids(); if (!list3.contains(user.getUserId())) { final int count2 = yqlist.get(m).getPersoncount()+ 1; yqlist.get(m).setPersoncount(count2); list3.add(user.getUserId()); } } } } } } RemoteController.log.info("uwb后" + yqlist.toString()); final Map map = new HashMap(); map.put("yq", yqlist); RemoteController.log.info("map" + map.toString()); return map; } private List getFencePositionYQ() { final List yqList = new ArrayList(); final FencePositionYQ yq11 = new FencePositionYQ(); yq11.setFenceName(this.configInfo.getYqName11()); yq11.setYqLevel(this.configInfo.getYqLevel11()); yq11.setYqHeight(this.configInfo.getYqHeight11()); yq11.setFenceposition(this.configInfo.getYqFenceposition11()); yq11.setUserids(new ArrayList()); final FencePositionYQ yq12 = new FencePositionYQ(); yq12.setFenceName(this.configInfo.getYqName12()); yq12.setYqLevel(this.configInfo.getYqLevel12()); yq12.setYqHeight(this.configInfo.getYqHeight12()); yq12.setFenceposition(this.configInfo.getYqFenceposition12()); yq12.setUserids(new ArrayList()); final FencePositionYQ yq13 = new FencePositionYQ(); yq13.setFenceName(this.configInfo.getYqName13()); yq13.setYqLevel(this.configInfo.getYqLevel13()); yq13.setYqHeight(this.configInfo.getYqHeight13()); yq13.setFenceposition(this.configInfo.getYqFenceposition13()); yq13.setUserids(new ArrayList()); final FencePositionYQ yq14 = new FencePositionYQ(); yq14.setFenceName(this.configInfo.getYqName14()); yq14.setYqLevel(this.configInfo.getYqLevel14()); yq14.setYqHeight(this.configInfo.getYqHeight14()); yq14.setFenceposition(this.configInfo.getYqFenceposition14()); yq14.setUserids(new ArrayList()); final FencePositionYQ yq15 = new FencePositionYQ(); yq15.setFenceName(this.configInfo.getYqName15()); yq15.setYqLevel(this.configInfo.getYqLevel15()); yq15.setYqHeight(this.configInfo.getYqHeight15()); yq15.setFenceposition(this.configInfo.getYqFenceposition15()); yq15.setUserids(new ArrayList()); final FencePositionYQ yq16 = new FencePositionYQ(); yq16.setFenceName(this.configInfo.getYqName16()); yq16.setYqLevel(this.configInfo.getYqLevel16()); yq16.setYqHeight(this.configInfo.getYqHeight16()); yq16.setFenceposition(this.configInfo.getYqFenceposition16()); yq16.setUserids(new ArrayList()); yqList.add(yq11); yqList.add(yq12); yqList.add(yq13); yqList.add(yq14); yqList.add(yq15); yqList.add(yq16); return yqList; } static { log = LoggerFactory.getLogger((Class)RemoteController.class); } }