| | |
| | | toLonLat = fromLonLat; |
| | | } |
| | | } |
| | | System.err.println("======服务里程======"+sum); |
| | | if(counts < 5){ |
| | | |
| | | //存储轨迹 |
| | | // 将数据存储到文件中 |
| | | 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(); |
| | | //计算里程 |
| | | //5分钟 |
| | | if(counts > 60){ |
| | | orderPrivateCar.setMileage(sum); |
| | | orderPrivateCar.setIsAbnormal(0); |
| | | }else{ |
| | | //获取预估里程,使用预估里程作为行驶里程计算金额 |
| | | String origins = orderPrivateCar.getStartLon() + "," + orderPrivateCar.getStartLat(); |
| | | String destination = orderPrivateCar.getEndLon() + "," + orderPrivateCar.getEndLat(); |
| | | Map<String, String> distance = gdMapElectricFenceUtil.getDistance(origins, destination, 1); |
| | | String distance1 = distance.get("distance"); |
| | | orderPrivateCar.setMileage(Double.valueOf(distance1)); |
| | | orderPrivateCar.setIsAbnormal(1); |
| | | // 将数据存储到文件中 |
| | | 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(); |
| | | } |
| | | break; |
| | | } |