| | |
| | | |
| | | // 结束服务时查询轨迹,计算距离 |
| | | Driver driver = driverService.selectById(orderPrivateCar.getDriverId()); |
| | | String tid = gdFalconUtil.selectTerminal(driver.getPhone()); |
| | | String result = gdFalconUtil.selectTrack(tid, orderPrivateCar.getTrackId(),1); |
| | | |
| | | JSONObject jsonObject = JSONObject.parseObject(result); |
| | | JSONArray tracks = jsonObject.getJSONArray("tracks"); |
| | | Integer counts = jsonObject.getInteger("counts"); |
| | | JSONArray points = new JSONArray(); |
| | | // 如果一单轨迹点数大于999,需进行分页查询,将所有的点查询出 |
| | | if(counts > 999){ |
| | | int i = counts%999; |
| | | for (int j = 1; j < i + 1; j++) { |
| | | String res = gdFalconUtil.selectTrack(tid, orderPrivateCar.getTrackId(),1); |
| | | JSONObject jsonObject1 = JSONObject.parseObject(res); |
| | | JSONArray tracks1 = jsonObject1.getJSONArray("tracks"); |
| | | Object ob = tracks1.get(0); |
| | | double sum = 0; |
| | | try { |
| | | String tid = gdFalconUtil.selectTerminal(driver.getPhone()); |
| | | String result = gdFalconUtil.selectTrack(tid, orderPrivateCar.getTrackId(),1); |
| | | |
| | | JSONObject jsonObject = JSONObject.parseObject(result); |
| | | JSONArray tracks = jsonObject.getJSONArray("tracks"); |
| | | Integer counts = jsonObject.getInteger("counts"); |
| | | JSONArray points = new JSONArray(); |
| | | // 如果一单轨迹点数大于999,需进行分页查询,将所有的点查询出 |
| | | if(counts > 999){ |
| | | int i = counts%999; |
| | | for (int j = 1; j < i + 1; j++) { |
| | | String res = gdFalconUtil.selectTrack(tid, orderPrivateCar.getTrackId(),1); |
| | | JSONObject jsonObject1 = JSONObject.parseObject(res); |
| | | JSONArray tracks1 = jsonObject1.getJSONArray("tracks"); |
| | | Object ob = tracks1.get(0); |
| | | String obs = JSONObject.toJSONString(ob); |
| | | JSONObject object = JSONObject.parseObject(obs); |
| | | JSONArray point = object.getJSONArray("points"); |
| | | points.addAll(point); |
| | | } |
| | | } |
| | | // 轨迹点数小于999,一页查询出即可 |
| | | if(counts > 0 && counts < 999){ |
| | | Object ob = tracks.get(0); |
| | | String obs = JSONObject.toJSONString(ob); |
| | | JSONObject object = JSONObject.parseObject(obs); |
| | | JSONArray point = object.getJSONArray("points"); |
| | | points.addAll(point); |
| | | } |
| | | } |
| | | // 轨迹点数小于999,一页查询出即可 |
| | | if(counts > 0 && counts < 999){ |
| | | Object ob = tracks.get(0); |
| | | String obs = JSONObject.toJSONString(ob); |
| | | JSONObject object = JSONObject.parseObject(obs); |
| | | JSONArray point = object.getJSONArray("points"); |
| | | points.addAll(point); |
| | | } |
| | | |
| | | System.out.println("轨迹坐标点=====:"+points); |
| | | String toLonLat = ""; |
| | | double sum = 0; |
| | | List<OrderPosition> orderPositions = new ArrayList<>(); |
| | | for (Object o : points) { |
| | | String s = JSONObject.toJSONString(o); |
| | | JSONObject obj = JSONObject.parseObject(s); |
| | | String fromLonLat = obj.getString("location"); |
| | | String[] split = fromLonLat.split(","); |
| | | Long locatetime = obj.getLong("locatetime"); |
| | | Date date = new Date(locatetime); |
| | | if(date.after(orderPrivateCar.getStartServiceTime()) && date.before(orderPrivateCar.getEndServiceTime())){ |
| | | // 封装定位文件里的单个定位对象 |
| | | OrderPosition orderPosition = new OrderPosition(); |
| | | orderPosition.setOrderId(orderId); |
| | | orderPosition.setOrderType(1); |
| | | orderPosition.setDriverId(orderPrivateCar.getDriverId()); |
| | | orderPosition.setLat(split[1]); |
| | | orderPosition.setLon(split[0]); |
| | | orderPosition.setAltitude("0"); |
| | | orderPosition.setDirectionAngle("0"); |
| | | //先计算里程,在存储最新位置 |
| | | orderPosition.setInsertTime(new Date()); |
| | | orderPositions.add(orderPosition); |
| | | |
| | | String toLonLat = ""; |
| | | List<OrderPosition> orderPositions = new ArrayList<>(); |
| | | for (Object o : points) { |
| | | String s = JSONObject.toJSONString(o); |
| | | JSONObject obj = JSONObject.parseObject(s); |
| | | String fromLonLat = obj.getString("location"); |
| | | String[] split = fromLonLat.split(","); |
| | | Long locatetime = obj.getLong("locatetime"); |
| | | Date date = new Date(locatetime); |
| | | if(date.after(orderPrivateCar.getStartServiceTime()) && date.before(orderPrivateCar.getEndServiceTime())){ |
| | | // 封装定位文件里的单个定位对象 |
| | | OrderPosition orderPosition = new OrderPosition(); |
| | | orderPosition.setOrderId(orderId); |
| | | orderPosition.setOrderType(1); |
| | | orderPosition.setDriverId(orderPrivateCar.getDriverId()); |
| | | orderPosition.setLat(split[1]); |
| | | orderPosition.setLon(split[0]); |
| | | orderPosition.setAltitude("0"); |
| | | orderPosition.setDirectionAngle("0"); |
| | | //先计算里程,在存储最新位置 |
| | | orderPosition.setInsertTime(new Date()); |
| | | orderPositions.add(orderPosition); |
| | | if(StringUtils.hasLength(fromLonLat) && StringUtils.hasLength(toLonLat)){ |
| | | String[] from = fromLonLat.split(","); |
| | | String[] to = toLonLat.split(","); |
| | | GlobalCoordinates source = new GlobalCoordinates(Double.valueOf(from[1]), Double.valueOf(from[0])); |
| | | GlobalCoordinates target = new GlobalCoordinates(Double.valueOf(to[1]), Double.valueOf(to[0])); |
| | | double WGS84 = getDistanceMeter(source, target, Ellipsoid.WGS84); |
| | | sum += WGS84; |
| | | } |
| | | toLonLat = fromLonLat; |
| | | } |
| | | } |
| | | |
| | | //存储轨迹 |
| | | // 将数据存储到文件中 |
| | | File file = new File(filePath + orderId + "_" + 1 + ".txt"); |
| | | if(!file.exists()){ |
| | | file.getParentFile().mkdirs(); |
| | | file.createNewFile(); |
| | | } |
| | | //写入相应的文件 |
| | | PrintWriter out = new PrintWriter(new FileWriter(file)); |
| | | out.write(JSON.toJSONString(orderPositions)); |
| | | out.flush(); |
| | | out.close(); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | System.err.println("查询高德轨迹出错,使用本地轨迹计算"); |
| | | List<OrderPosition> list = orderPositionService.queryPosition(orderId, 1); |
| | | String fromLonLat = ""; |
| | | for (OrderPosition orderPosition : list) { |
| | | String toLonLat = orderPosition.getLon() + "," + orderPosition.getLat(); |
| | | if(StringUtils.hasLength(fromLonLat) && StringUtils.hasLength(toLonLat)){ |
| | | String[] from = fromLonLat.split(","); |
| | | String[] to = toLonLat.split(","); |
| | | GlobalCoordinates source = new GlobalCoordinates(Double.valueOf(from[1]), Double.valueOf(from[0])); |
| | | GlobalCoordinates target = new GlobalCoordinates(Double.valueOf(to[1]), Double.valueOf(to[0])); |
| | | double WGS84 = getDistanceMeter(source, target, Ellipsoid.WGS84); |
| | | System.err.println("WGS84坐标系计算结果:"+WGS84 + "米"); |
| | | sum += WGS84; |
| | | } |
| | | toLonLat = fromLonLat; |
| | | fromLonLat = toLonLat; |
| | | } |
| | | } |
| | | |
| | | //存储轨迹 |
| | | // 将数据存储到文件中 |
| | | File file = new File(filePath + orderId + "_" + 1 + ".txt"); |
| | | if(!file.exists()){ |
| | | file.getParentFile().mkdirs(); |
| | | file.createNewFile(); |
| | | } |
| | | //写入相应的文件 |
| | | PrintWriter out = new PrintWriter(new FileWriter(file)); |
| | | out.write(JSON.toJSONString(orderPositions)); |
| | | out.flush(); |
| | | out.close(); |
| | | |
| | | orderPrivateCar.setMileage(sum); |
| | | orderPrivateCar.setIsAbnormal(0); |
| | | |
| | | //获取预估里程,使用预估里程作为行驶里程计算金额 |
| | | // String origins = orderPrivateCar.getStartLon() + "," + orderPrivateCar.getStartLat(); |
| | | // String destination = orderPrivateCar.getGetoffLon() + "," + orderPrivateCar.getGetoffLat(); |
| | | // Map<String, String> distance = gdMapElectricFenceUtil.getDistance(origins, destination, 1); |
| | | // Double distance1 = Double.valueOf(distance.get("distance")); |
| | | // if(distance1 - sum > 1000){ |
| | | // orderPrivateCar.setMileage(distance1); |
| | | // orderPrivateCar.setIsAbnormal(1); |
| | | // }else{ |
| | | // orderPrivateCar.setMileage(sum); |
| | | // orderPrivateCar.setIsAbnormal(0); |
| | | // } |
| | | break; |
| | | } |
| | | this.updateById(orderPrivateCar); |
| | |
| | | JSONObject data = jsonObject.getJSONObject("data"); |
| | | String status = data.getString("status"); |
| | | |
| | | gdInterfaceService.saveData("https://restapi.amap.com/v4/geofence/meta", "创建电子围栏"); |
| | | // gdInterfaceService.saveData("https://restapi.amap.com/v4/geofence/meta", "创建电子围栏"); |
| | | |
| | | // if(status.equals("0")){//创建成功 |
| | | // GDFence gdFence = new GDFence(); |
| | |
| | | JSONObject jsonObject = JSON.parseObject(forObject); |
| | | JSONObject data = jsonObject.getJSONObject("data"); |
| | | |
| | | gdInterfaceService.saveData("https://restapi.amap.com/v4/geofence/meta", "查询电子围栏"); |
| | | // gdInterfaceService.saveData("https://restapi.amap.com/v4/geofence/meta", "查询电子围栏"); |
| | | |
| | | if(ToolUtil.isNotEmpty(center)){//圆形电子围栏 |
| | | JSONArray rs_list = data.getJSONArray("rs_list"); |
| | |
| | | JSONArray rs_list = data.getJSONArray("rs_list"); |
| | | jsonArray.addAll(rs_list); |
| | | |
| | | gdInterfaceService.saveData("https://restapi.amap.com/v4/geofence/meta", "查询电子围栏"); |
| | | // gdInterfaceService.saveData("https://restapi.amap.com/v4/geofence/meta", "查询电子围栏"); |
| | | |
| | | //判断是否有分页 |
| | | int total_record = data.getIntValue("total_record"); |
| | |
| | | String s = restTemplate.patchForObject(url, formEntity, String.class); |
| | | System.out.println(s); |
| | | |
| | | gdInterfaceService.saveData("https://restapi.amap.com/v4/geofence/meta", "更新电子围栏"); |
| | | // gdInterfaceService.saveData("https://restapi.amap.com/v4/geofence/meta", "更新电子围栏"); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | System.out.println("检测:" + forObject); |
| | | |
| | | gdInterfaceService.saveData("https://restapi.amap.com/v4/geofence/status", "电子围栏监控"); |
| | | // gdInterfaceService.saveData("https://restapi.amap.com/v4/geofence/status", "电子围栏监控"); |
| | | return ids; |
| | | } |
| | | |
| | |
| | | restTemplate.delete("https://restapi.amap.com/v4/geofence/meta?key={1}&gid={2}", key, gid); |
| | | System.out.println("删除:" ); |
| | | |
| | | gdInterfaceService.saveData("https://restapi.amap.com/v4/geofence/meta", "删除电子围栏"); |
| | | // gdInterfaceService.saveData("https://restapi.amap.com/v4/geofence/meta", "删除电子围栏"); |
| | | |
| | | return true; |
| | | } |
| | |
| | | JSONObject jsonObject = JSON.parseObject(forObject); |
| | | String status = jsonObject.getString("status"); |
| | | |
| | | gdInterfaceService.saveData("https://restapi.amap.com/v3/distance", "查询两点间的距离"); |
| | | // gdInterfaceService.saveData("https://restapi.amap.com/v3/distance", "查询两点间的距离"); |
| | | |
| | | if(status.equals("1")){ |
| | | JSONArray results = jsonObject.getJSONArray("results"); |
| | |
| | | JSONObject jsonObject = JSON.parseObject(forObject); |
| | | String status = jsonObject.getString("status"); |
| | | |
| | | gdInterfaceService.saveData("https://restapi.amap.com/v3/direction/driving", "获取路径规划"); |
| | | // gdInterfaceService.saveData("https://restapi.amap.com/v3/direction/driving", "获取路径规划"); |
| | | |
| | | if(status.equals("1")){ |
| | | JSONObject route = jsonObject.getJSONObject("route"); |
| | |
| | | String status = jsonObject.getString("status"); |
| | | List<String> list = new ArrayList<>(); |
| | | |
| | | gdInterfaceService.saveData("https://restapi.amap.com/v3/geocode/geo", "行政区域转经纬度"); |
| | | // gdInterfaceService.saveData("https://restapi.amap.com/v3/geocode/geo", "行政区域转经纬度"); |
| | | |
| | | if(status.equals("1")){ |
| | | JSONArray geocodes = jsonObject.getJSONArray("geocodes"); |
| | |
| | | JSONObject jsonObject = JSON.parseObject(forObject); |
| | | Map<String, String> map = new HashMap<>(); |
| | | |
| | | gdInterfaceService.saveData("https://restapi.amap.com/v3/geocode/regeo", "经纬度转行政区域"); |
| | | // gdInterfaceService.saveData("https://restapi.amap.com/v3/geocode/regeo", "经纬度转行政区域"); |
| | | |
| | | if(jsonObject.getString("status").equals("1")){ |
| | | JSONObject regeocode = jsonObject.getJSONObject("regeocode"); |
| | |
| | | package com.stylefeng.guns.modular.system.util; |
| | | |
| | | |
| | | import cn.hutool.http.HttpRequest; |
| | | import cn.hutool.http.HttpUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | |
| | | Double Speed = 0D; |
| | | if(orderPositions != null && orderPositions.size() > 1){ |
| | | Map<String, String> distance = gdMapElectricFenceUtil.getDistance(orderPositions.get(orderPositions.size() - 1).getLon() + "," + orderPositions.get(orderPositions.size() - 1).getLat(), |
| | | orderPositions.get(orderPositions.size() - 0).getLon() + "," + orderPositions.get(orderPositions.size() - 0).getLat(), 0); |
| | | orderPositions.get(orderPositions.size() - 1).getLon() + "," + orderPositions.get(orderPositions.size() - 1).getLat(), 0); |
| | | Speed = distance != null ? Double.valueOf(distance.get("distance")) / 1000 : 0D; |
| | | } |
| | | Integer state = 4; |
| | |
| | | header.put("Accept", "*/*"); |
| | | header.put("Accept-Encoding", "gzip"); |
| | | header.put("Accept-Charset", "utf-8"); |
| | | String result = null; |
| | | try { |
| | | result = httpClientUtil.pushHttpRequset("POST", path + "ministryOfTransport/positionDriver", map, header,"form").toString(); |
| | | HttpRequest post = HttpUtil.createPost(path + "ministryOfTransport/positionDriver"); |
| | | post.header("Connection", "keep-alive"); |
| | | post.header("Content-Type", "application/x-www-form-urlencoded"); |
| | | post.header("Accept", "*/*"); |
| | | post.header("Accept-Encoding", "gzip"); |
| | | post.header("Accept-Charset", "utf-8"); |
| | | post.body(JSON.toJSONString(map)); |
| | | post.execute(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | System.err.println("-----------------------------驾驶员定位信息------------------------:" + result); |
| | | } |
| | | |
| | | |
| | |
| | | Double Speed = 0D; |
| | | if(orderPositions != null && orderPositions.size() > 1){ |
| | | Map<String, String> distance = gdMapElectricFenceUtil.getDistance(orderPositions.get(orderPositions.size() - 1).getLon() + "," + orderPositions.get(orderPositions.size() - 1).getLat(), |
| | | orderPositions.get(orderPositions.size() - 0).getLon() + "," + orderPositions.get(orderPositions.size() - 0).getLat(), 0); |
| | | orderPositions.get(orderPositions.size() - 1).getLon() + "," + orderPositions.get(orderPositions.size() - 1).getLat(), 0); |
| | | Speed = distance != null ? Double.valueOf(distance.get("distance")) / 1000 : 0D; |
| | | } |
| | | Integer state = 4; |
| | |
| | | jsonObject.put("OrderId", orderNum);//订单编号(非营运状态下填"0") |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("positionVehicle", jsonObject.toJSONString()); |
| | | Map<String, String> header = new HashMap<>(); |
| | | header.put("Connection", "keep-alive"); |
| | | header.put("Content-Type", "application/x-www-form-urlencoded"); |
| | | header.put("Accept", "*/*"); |
| | | header.put("Accept-Encoding", "gzip"); |
| | | header.put("Accept-Charset", "utf-8"); |
| | | String result = null; |
| | | try { |
| | | result = httpClientUtil.pushHttpRequset("POST", path + "ministryOfTransport/positionVehicle", map, header,"form").toString(); |
| | | HttpRequest post = HttpUtil.createPost(path + "ministryOfTransport/positionVehicle"); |
| | | post.header("Connection", "keep-alive"); |
| | | post.header("Content-Type", "application/x-www-form-urlencoded"); |
| | | post.header("Accept", "*/*"); |
| | | post.header("Accept-Encoding", "gzip"); |
| | | post.header("Accept-Charset", "utf-8"); |
| | | post.body(JSON.toJSONString(map)); |
| | | post.execute(); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | System.err.println("----------------------------车辆定位信息---------------------------:" + result); |
| | | } |
| | | |
| | | |
| | |
| | | import com.stylefeng.guns.modular.system.model.OrderPosition; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.HttpEntity; |
| | |
| | | */ |
| | | @Component |
| | | public class PushUtil { |
| | | |
| | | private Logger log = LoggerFactory.getLogger(PushUtil.class); |
| | | |
| | | @Autowired |
| | | private RestTemplate internalRestTemplate; |
| | |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | log.error(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | |
| | |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | log.error(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | |
| | |
| | | //计算预计距离和剩余时间 |
| | | String value = redisUtil.getValue("DRIVER" + String.valueOf(driverId)); |
| | | if(null == value || "".equals(value)){ |
| | | System.err.println("司机没有上传位置信息"); |
| | | // System.err.println("司机没有上传位置信息"); |
| | | return; |
| | | } |
| | | |
| | |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | log.error(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | |
| | |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | log.error(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | |
| | |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | log.error(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | |
| | |
| | | JSONObject data = jsonObject.getJSONObject("data"); |
| | | String status = data.getString("status"); |
| | | |
| | | gdInterfaceService.saveData("https://restapi.amap.com/v4/geofence/meta", "创建电子围栏"); |
| | | // gdInterfaceService.saveData("https://restapi.amap.com/v4/geofence/meta", "创建电子围栏"); |
| | | |
| | | // if(status.equals("0")){//创建成功 |
| | | // GDFence gdFence = new GDFence(); |
| | |
| | | JSONObject jsonObject = JSON.parseObject(forObject); |
| | | JSONObject data = jsonObject.getJSONObject("data"); |
| | | |
| | | gdInterfaceService.saveData("https://restapi.amap.com/v4/geofence/meta", "查询电子围栏"); |
| | | // gdInterfaceService.saveData("https://restapi.amap.com/v4/geofence/meta", "查询电子围栏"); |
| | | |
| | | if(ToolUtil.isNotEmpty(center)){//圆形电子围栏 |
| | | JSONArray rs_list = data.getJSONArray("rs_list"); |
| | |
| | | JSONArray rs_list = data.getJSONArray("rs_list"); |
| | | jsonArray.addAll(rs_list); |
| | | |
| | | gdInterfaceService.saveData("https://restapi.amap.com/v4/geofence/meta", "查询电子围栏"); |
| | | // gdInterfaceService.saveData("https://restapi.amap.com/v4/geofence/meta", "查询电子围栏"); |
| | | |
| | | //判断是否有分页 |
| | | int total_record = data.getIntValue("total_record"); |
| | |
| | | String s = restTemplate.patchForObject(url, formEntity, String.class); |
| | | System.out.println(s); |
| | | |
| | | gdInterfaceService.saveData("https://restapi.amap.com/v4/geofence/meta", "更新电子围栏"); |
| | | // gdInterfaceService.saveData("https://restapi.amap.com/v4/geofence/meta", "更新电子围栏"); |
| | | } |
| | | |
| | | |
| | |
| | | } |
| | | System.out.println("检测:" + forObject); |
| | | |
| | | gdInterfaceService.saveData("https://restapi.amap.com/v4/geofence/status", "电子围栏监控"); |
| | | // gdInterfaceService.saveData("https://restapi.amap.com/v4/geofence/status", "电子围栏监控"); |
| | | return ids; |
| | | } |
| | | |
| | |
| | | restTemplate.delete("https://restapi.amap.com/v4/geofence/meta?key={1}&gid={2}", key, gid); |
| | | System.out.println("删除:" ); |
| | | |
| | | gdInterfaceService.saveData("https://restapi.amap.com/v4/geofence/meta", "删除电子围栏"); |
| | | // gdInterfaceService.saveData("https://restapi.amap.com/v4/geofence/meta", "删除电子围栏"); |
| | | |
| | | return true; |
| | | } |
| | |
| | | JSONObject jsonObject = JSON.parseObject(forObject); |
| | | String status = jsonObject.getString("status"); |
| | | |
| | | gdInterfaceService.saveData("https://restapi.amap.com/v3/distance", "查询两点间的距离"); |
| | | // gdInterfaceService.saveData("https://restapi.amap.com/v3/distance", "查询两点间的距离"); |
| | | |
| | | if(status.equals("1")){ |
| | | JSONArray results = jsonObject.getJSONArray("results"); |
| | |
| | | JSONObject jsonObject = JSON.parseObject(forObject); |
| | | String status = jsonObject.getString("status"); |
| | | |
| | | gdInterfaceService.saveData("https://restapi.amap.com/v3/direction/driving", "获取路径规划"); |
| | | // gdInterfaceService.saveData("https://restapi.amap.com/v3/direction/driving", "获取路径规划"); |
| | | |
| | | if(status.equals("1")){ |
| | | JSONObject route = jsonObject.getJSONObject("route"); |
| | |
| | | String status = jsonObject.getString("status"); |
| | | List<String> list = new ArrayList<>(); |
| | | |
| | | gdInterfaceService.saveData("https://restapi.amap.com/v3/geocode/geo", "行政区域转经纬度"); |
| | | // gdInterfaceService.saveData("https://restapi.amap.com/v3/geocode/geo", "行政区域转经纬度"); |
| | | |
| | | if(status.equals("1")){ |
| | | JSONArray geocodes = jsonObject.getJSONArray("geocodes"); |
| | |
| | | String status = jsonObject.getString("status"); |
| | | List<String> list = new ArrayList<>(); |
| | | |
| | | gdInterfaceService.saveData("https://restapi.amap.com/v3/geocode/geo", "行政区域转经纬度"); |
| | | // gdInterfaceService.saveData("https://restapi.amap.com/v3/geocode/geo", "行政区域转经纬度"); |
| | | |
| | | if(status.equals("1")){ |
| | | JSONArray geocodes = jsonObject.getJSONArray("geocodes"); |
| | |
| | | JSONObject jsonObject = JSON.parseObject(forObject); |
| | | Map<String, String> map = new HashMap<>(); |
| | | |
| | | gdInterfaceService.saveData("https://restapi.amap.com/v3/geocode/regeo", "经纬度转行政区域"); |
| | | // gdInterfaceService.saveData("https://restapi.amap.com/v3/geocode/regeo", "经纬度转行政区域"); |
| | | |
| | | if(jsonObject.getString("status").equals("1")){ |
| | | JSONObject regeocode = jsonObject.getJSONObject("regeocode"); |
| | |
| | | import com.stylefeng.guns.modular.specialTrain.server.IOrderPrivateCarService; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | | import com.stylefeng.guns.modular.taxi.service.IOrderTaxiService; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpEntity; |
| | | import org.springframework.http.HttpHeaders; |
| | |
| | | */ |
| | | @Component |
| | | public class PushUtil { |
| | | |
| | | private Logger log = LoggerFactory.getLogger(PushUtil.class); |
| | | |
| | | @Autowired |
| | | private RestTemplate internalRestTemplate; |
| | |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | log.error(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | |
| | |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | log.error(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | |
| | |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | log.error(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | |
| | |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | log.error(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | |
| | |
| | | String s = internalRestTemplate.postForObject("http://zuul-gateway/netty/sendMsgToClient",requestEntity , String.class); |
| | | JSONObject jsonObject1 = JSON.parseObject(s, JSONObject.class); |
| | | if(jsonObject1.getIntValue("code") != 200){ |
| | | System.err.println(jsonObject1.getString("msg")); |
| | | log.error(jsonObject1.getString("msg")); |
| | | } |
| | | } |
| | | |