| | |
| | | } |
| | | } |
| | | }).start(); |
| | | // OrderPosition orderPosition = new OrderPosition(); |
| | | // orderPosition.setOrderId(orderId); |
| | | // orderPosition.setOrderType(1); |
| | | // orderPosition.setDriverId(orderPrivateCar.getDriverId()); |
| | | // orderPosition.setLat(lat.toString()); |
| | | // orderPosition.setLon(lon.toString()); |
| | | // orderPosition.setAltitude("0"); |
| | | // orderPosition.setDirectionAngle("0"); |
| | | // //先计算里程,在存储最新位置 |
| | | // orderPosition.setInsertTime(new Date()); |
| | | // //将数据存储到文件中 |
| | | // List<OrderPosition> orderPositions = orderPositionService.queryPosition(orderPosition.getOrderId(), orderPosition.getOrderType()); |
| | | // File file = new File(filePath + orderPosition.getOrderId() + "_" + orderPosition.getOrderType() + ".txt"); |
| | | // if(!file.exists()){ |
| | | // file.getParentFile().mkdirs(); |
| | | // file.createNewFile(); |
| | | // } |
| | | // //写入相应的文件 |
| | | // PrintWriter out = new PrintWriter(new FileWriter(file)); |
| | | // orderPositions.add(orderPosition); |
| | | // out.write(JSON.toJSONString(orderPositions)); |
| | | // out.flush(); |
| | | // out.close(); |
| | | break; |
| | | case 6://结束服务(专车可以返回继续服务)不修改状态 |
| | | orderPrivateCar.setGetoffLon(lon); |
| | |
| | | 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); |
| | |
| | | @Override |
| | | public ResultUtil confirmFees(Integer orderId, Integer type, Double parkingFee, Double crossingFee) throws Exception { |
| | | OrderPrivateCar orderPrivateCar = this.selectById(orderId); |
| | | if(orderPrivateCar.getState() != 5){ |
| | | return ResultUtil.error("异常操作,请刷新订单"); |
| | | } |
| | | if(orderPrivateCar.getArriveTime()==null){ |
| | | orderPrivateCar.setArriveTime(orderPrivateCar.getStartServiceTime()); |
| | | } |
| | |
| | | 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; |