| | |
| | | toLonLat = fromLonLat; |
| | | } |
| | | } |
| | | System.err.println("======服务里程======"+sum); |
| | | orderPrivateCar.setMileage(sum); |
| | | |
| | | //存储轨迹 |
| | | // 将数据存储到文件中 |
| | | File file = new File(filePath + orderId + "_" + 1 + ".txt"); |
| | | if(!file.exists()){ |
| | |
| | | out.write(JSON.toJSONString(orderPositions)); |
| | | out.flush(); |
| | | out.close(); |
| | | |
| | | |
| | | |
| | | //获取预估里程,使用预估里程作为行驶里程计算金额 |
| | | 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); |
| | |
| | | this.updateById(orderPrivateCar); |
| | | return true;//第一条数据不作处理,直接存储 |
| | | } |
| | | Map<String, String> distance = gdMapElectricFenceUtil.getDistance(now, old, 0);//直线距离 |
| | | Map<String, Double> distance = GeodesyUtil.getDistance(now, old);//直线距离 |
| | | if(null != distance){ |
| | | String distance1 = distance.get("distance"); |
| | | if(Double.valueOf(distance1) > 50 && orderPrivateCar.getState()==5/* && orderPosition.getInsertTime().getTime()>=orderPrivateCar.getBoardingTime().getTime()*/){//大于50米表示在移动 |
| | | Double distance1 = distance.get("WGS84"); |
| | | if(distance1 > 50 && orderPrivateCar.getState()==5){//大于50米表示在移动 |
| | | orderPrivateCar.setMileage(new BigDecimal(orderPrivateCar.getMileage()).add(new BigDecimal(distance1)).setScale(2, BigDecimal.ROUND_HALF_EVEN).doubleValue()); |
| | | this.updateById(orderPrivateCar); |
| | | return true; |