| | |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.DistancematrixVo; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.FleetEngineUtil; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.GoogleMapUtil; |
| | | import com.stylefeng.guns.modular.system.util.GoogleMap.ReverseGeocodeVo; |
| | | import com.stylefeng.guns.modular.system.util.quartz.QuartzUtil; |
| | | import com.stylefeng.guns.modular.system.util.quartz.jobs.OrderTimeOutJob; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | |
| | | @Override |
| | | public synchronized ResultUtil grabOrder(Integer orderId, Integer uid, Integer language) throws Exception { |
| | | OrderPrivateCar orderPrivateCar = this.selectById(orderId); |
| | | String tripId = redisUtil.getValue("trip" + orderPrivateCar.getUserId()); |
| | | //处理摆渡车的情况 |
| | | if(orderPrivateCar.getType() == 2){ |
| | | //查看用户下的摆渡车是否已被人抢了 |
| | |
| | | String value = redisUtil.getValue("DRIVER" + driver.getId()); |
| | | if(ToolUtil.isNotEmpty(value)) { |
| | | String[] split = value.split(","); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderPrivateCar.getStartLat(), orderPrivateCar.getStartLon(), Double.valueOf(split[1]), Double.valueOf(split[0])); |
| | | DistancematrixVo distancematrix = GoogleMapUtil.getDistancematrix(orderPrivateCar.getStartLat(), orderPrivateCar.getStartLon(), Double.valueOf(split[1]), Double.valueOf(split[0]), tripId); |
| | | //超时时间 |
| | | long timeOut = System.currentTimeMillis() + (distancematrix.getDuration() * 1000); |
| | | orderPrivateCar.setEstimateArriveTime(new Date(timeOut)); |
| | |
| | | * @throws Exception |
| | | */ |
| | | @Override |
| | | public ResultUtil process(Integer orderId, Integer state, Double lon, Double lat, String address,String phone, Integer language, Integer uid) throws Exception { |
| | | public ResultUtil process(Integer orderId, Integer state, Double lon, Double lat,String phone, Integer language, Integer uid) throws Exception { |
| | | OrderPrivateCar orderPrivateCar = this.selectById(orderId); |
| | | String tripId = redisUtil.getValue("trip" + orderPrivateCar.getUserId()); |
| | | ReverseGeocodeVo reverseGeocode = GoogleMapUtil.getReverseGeocode(lat, lon, tripId); |
| | | if(null == reverseGeocode){ |
| | | return ResultUtil.error(language == 1 ? "无效的经纬度" : language == 2 ? "Invalid longitude and latitude" : "Longitude et latitude non valides"); |
| | | } |
| | | String address = reverseGeocode.getAddress(); |
| | | if(!uid.equals(orderPrivateCar.getDriverId())){ |
| | | return ResultUtil.error(language == 1 ? "操作失败,请刷新订单" : language == 2 ? "Operation failed, please refresh the order" : "L’opération a échoué, veuillez actualiser la commande"); |
| | | } |