| | |
| | | Driver driver = driverService.selectById(uid); |
| | | orderLogistics.setDriverId(uid); |
| | | orderLogistics.setCarId(driver.getCarId()); |
| | | orderLogistics.setCompanyId(driver.getFranchiseeId() != null && driver.getFranchiseeId() != 0 ? driver.getFranchiseeId() : ( |
| | | driver.getCompanyId() != null && driver.getCompanyId() != 0 ? driver.getCompanyId() : 1)); |
| | | orderLogistics.setCompanyId(driver.getCompanyId()); |
| | | orderLogistics.setState(2); |
| | | orderLogistics.setSnatchOrderTime(new Date()); |
| | | if(!StringUtils.hasLength(orderLogistics.getTripId())){ |
| | |
| | | } |
| | | }else{ |
| | | //开始修改行程数据 |
| | | boolean updateTrip = fleetEngineUtil.updateTrip(null, car.getVehicleId(), null, orderLogistics.getTripId(), null, null, null, null); |
| | | boolean updateTrip = fleetEngineUtil.updateTrip(null, car.getVehicleId(), null, orderLogistics.getTripId(), null, null, null, null, orderLogistics.getId(), 4); |
| | | if(!updateTrip){ |
| | | for (int i = 0; i < 5; i++) { |
| | | updateTrip = fleetEngineUtil.updateTrip(null, car.getVehicleId(), null, orderLogistics.getTripId(), null, null, null, null); |
| | | updateTrip = fleetEngineUtil.updateTrip(null, car.getVehicleId(), null, orderLogistics.getTripId(), null, null, null, null, orderLogistics.getId(), 4); |
| | | if(updateTrip){ |
| | | break; |
| | | } |
| | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, ""); |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, ""); |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, "", "driver"); |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, "", "driver"); |
| | | } |
| | | }).start(); |
| | | Integer language1 = userInfoMapper.selectById(orderLogistics.getUserId()).getLanguage(); |
| | |
| | | tripStatus = "ENROUTE_TO_DROPOFF"; |
| | | break; |
| | | case 6://结束服务 |
| | | if(null == lon || null == lat){ |
| | | return ResultUtil.error(language == 1 ? "无效的经纬度" : language == 2 ? "Invalid longitude and latitude" : "Longitude et latitude non valides"); |
| | | } |
| | | orderLogistics.setGetoffLon(lon); |
| | | orderLogistics.setGetoffLat(lat); |
| | | orderLogistics.setGetoffAddress(address); |
| | |
| | | //修改行程数据 |
| | | if(ToolUtil.isNotEmpty(tripStatus)){ |
| | | Car car = carService.selectById(orderLogistics.getCarId()); |
| | | boolean updateTrip = fleetEngineUtil.updateTrip(tripStatus, car.getVehicleId(), null, orderLogistics.getTripId(), null, null, null, null); |
| | | boolean updateTrip = fleetEngineUtil.updateTrip(tripStatus, car.getVehicleId(), null, orderLogistics.getTripId(), null, null, null, null, orderLogistics.getId(), 4); |
| | | if(!updateTrip){ |
| | | for (int i = 0; i < 5; i++) { |
| | | updateTrip = fleetEngineUtil.updateTrip(tripStatus, car.getVehicleId(), null, orderLogistics.getTripId(), null, null, null, null); |
| | | updateTrip = fleetEngineUtil.updateTrip(tripStatus, car.getVehicleId(), null, orderLogistics.getTripId(), null, null, null, null, orderLogistics.getId(), 4); |
| | | if(updateTrip){ |
| | | break; |
| | | } |
| | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, ""); |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, ""); |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, "", "driver"); |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, "", "driver"); |
| | | } |
| | | }).start(); |
| | | |
| | |
| | | Driver driver = driverService.selectById(uid); |
| | | orderLogistics.setDriverId(uid); |
| | | orderLogistics.setCarId(driver.getCarId()); |
| | | orderLogistics.setCompanyId(driver.getFranchiseeId() != null && driver.getFranchiseeId() != 0 ? driver.getFranchiseeId() : ( |
| | | driver.getCompanyId() != null && driver.getCompanyId() != 0 ? driver.getCompanyId() : 1)); |
| | | orderLogistics.setCompanyId(driver.getCompanyId()); |
| | | orderLogistics.setState(2); |
| | | Date date = new Date(); |
| | | orderLogistics.setSnatchOrderTime(date); |
| | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, ""); |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, ""); |
| | | pushUtil.pushOrderState(1, orderLogistics.getUserId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, "", "driver"); |
| | | pushUtil.pushOrderState(2, orderLogistics.getDriverId(), orderLogistics.getId(), orderLogistics.getType(), orderLogistics.getState(), 0, "", "driver"); |
| | | } |
| | | }).start(); |
| | | Integer language1 = userInfoMapper.selectById(orderLogistics.getUserId()).getLanguage(); |
| | |
| | | //修改google地图行程终点 |
| | | Car car = carService.selectById(orderLogistics.getCarId()); |
| | | boolean updateTrip = fleetEngineUtil.updateTrip(null, car.getVehicleId(), null, orderLogistics.getTripId(), |
| | | null, null, orderLogistics.getEndLat().toString(), orderLogistics.getEndLon().toString()); |
| | | null, null, orderLogistics.getEndLat().toString(), orderLogistics.getEndLon().toString(), orderLogistics.getId(), 4); |
| | | if(!updateTrip){ |
| | | for (int i = 0; i < 5; i++) { |
| | | updateTrip = fleetEngineUtil.updateTrip(null, car.getVehicleId(), null, orderLogistics.getTripId(), |
| | | null, null, orderLogistics.getEndLat().toString(), orderLogistics.getEndLon().toString()); |
| | | null, null, orderLogistics.getEndLat().toString(), orderLogistics.getEndLon().toString(), orderLogistics.getId(), 4); |
| | | if(updateTrip){ |
| | | break; |
| | | } |
| | |
| | | */ |
| | | public OrderLogistics setMoney(OrderLogistics orderLogistics, Double parkingFee, Double crossingFee) throws Exception { |
| | | Map<String, Object> query1 = systemPriceMapper.query(orderLogistics.getCompanyId(), 4, orderLogistics.getServerCarModelId()); |
| | | if(null == query1){ |
| | | throw new RuntimeException("请先添加计费规则"); |
| | | } |
| | | //开始根据不同的方式计算金额 |
| | | double amount = 0; |
| | | JSONObject jsonObject = JSON.parseObject(query1.get("content").toString()); |
| | |
| | | if(orderLogistics.getArriveTime()==null){ |
| | | orderLogistics.setArriveTime(orderLogistics.getStartServiceTime()); |
| | | } |
| | | |
| | | //使用原始里程计算费用 |
| | | orderLogistics = this.setMoney(orderLogistics, 0D, 0D);//计算费用 |
| | | Double mileage = orderLogistics.getMileage(); |
| | | Double orderMoney1 = orderLogistics.getOrderMoney(); |
| | | //使用预估里程计算费用 |
| | | Double startLat = orderLogistics.getStartLat(); |
| | | Double startLon = orderLogistics.getStartLon(); |
| | | Double getoffLon = orderLogistics.getGetoffLon(); |
| | | Double getoffLat = orderLogistics.getGetoffLat(); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(startLat, startLon, getoffLat, getoffLon, orderLogistics.getTripId()); |
| | | orderLogistics.setMileage(distancematrix.getDistance().doubleValue()); |
| | | orderLogistics = this.setMoney(orderLogistics, 0D, 0D); |
| | | Double orderMoney2 = orderLogistics.getOrderMoney(); |
| | | //如果原始金额小于预估金额,且比例小于95%,则使用预估金额 |
| | | if(orderMoney1.compareTo(orderMoney2) >= 0 || orderMoney1 / orderMoney2 >= 0.95){ |
| | | //原始金额大于预估金额或者比例大于0.95,则使用原始里程重新计算费用 |
| | | orderLogistics.setMileage(mileage); |
| | | orderLogistics = this.setMoney(orderLogistics, 0D, 0D);//计算费用 |
| | | } |
| | | |
| | | orderLogistics.setPayManner(type); |
| | | orderLogistics.setParkMoney(null == parkingFee ? 0D : parkingFee); |
| | | orderLogistics.setRoadTollMoney(null == crossingFee ? 0D : crossingFee); |
| | |
| | | orderLogistics.setState(7); |
| | | } |
| | | |
| | | Map<String, String> map = chinaMobileUtil.midAxbUnBindSend(orderLogistics.getBindId(),orderLogistics.getTelX()); |
| | | if(String.valueOf(map.get("code")).equals("200")){ |
| | | orderLogistics.setTelX(""); |
| | | orderLogistics.setBindId(""); |
| | | } |
| | | // Map<String, String> map = chinaMobileUtil.midAxbUnBindSend(orderLogistics.getBindId(),orderLogistics.getTelX()); |
| | | // if(String.valueOf(map.get("code")).equals("200")){ |
| | | // orderLogistics.setTelX(""); |
| | | // orderLogistics.setBindId(""); |
| | | // } |
| | | this.updateById(orderLogistics); |
| | | //修改行程数据 |
| | | Car car = carService.selectById(orderLogistics.getCarId()); |
| | | boolean updateTrip = fleetEngineUtil.updateTrip("COMPLETE", car.getVehicleId(), null, orderLogistics.getTripId(), null, null, null, null); |
| | | boolean updateTrip = fleetEngineUtil.updateTrip("COMPLETE", car.getVehicleId(), null, orderLogistics.getTripId(), null, null, null, null, orderLogistics.getId(), 4); |
| | | if(!updateTrip){ |
| | | for (int i = 0; i < 5; i++) { |
| | | updateTrip = fleetEngineUtil.updateTrip("COMPLETE", car.getVehicleId(), null, orderLogistics.getTripId(), null, null, null, null); |
| | | updateTrip = fleetEngineUtil.updateTrip("COMPLETE", car.getVehicleId(), null, orderLogistics.getTripId(), null, null, null, null, orderLogistics.getId(), 4); |
| | | if(updateTrip){ |
| | | orderLogistics.setIsover(1); |
| | | this.updateById(orderLogistics); |
| | |
| | | try { |
| | | Thread.sleep(3000L); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | }else{ |
| | |
| | | try { |
| | | Thread.sleep(3000L); |
| | | } catch (InterruptedException e) { |
| | | throw new RuntimeException(e); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |
| | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | | public void run() { |
| | | pushUtil.pushOrderState(1, finalOrderTaxi.getUserId(), finalOrderTaxi.getId(), 4, finalOrderTaxi.getState(), 0, ""); |
| | | pushUtil.pushOrderState(2, finalOrderTaxi.getDriverId(), finalOrderTaxi.getId(), 4, finalOrderTaxi.getState(), 0, ""); |
| | | pushUtil.pushOrderState(1, finalOrderTaxi.getUserId(), finalOrderTaxi.getId(), 4, finalOrderTaxi.getState(), 0, "", "driver"); |
| | | pushUtil.pushOrderState(2, finalOrderTaxi.getDriverId(), finalOrderTaxi.getId(), 4, finalOrderTaxi.getState(), 0, "", "driver"); |
| | | } |
| | | }).start(); |
| | | return ResultUtil.success(); |