| | |
| | | */ |
| | | @Override |
| | | public ResultUtil grabOrder(Integer orderId, Integer uid) throws Exception { |
| | | OrderPrivateCar orderPrivateCar1 = orderPrivateCarService.selectById(orderId); |
| | | if(null != orderPrivateCar1 && orderPrivateCar1.getType() == 3 && orderPrivateCar1.getState() != 1&& orderPrivateCar1.getState() != 11){ |
| | | return ResultUtil.error("订单已被抢了"); |
| | | } |
| | | OrderTaxi orderTaxi = null; |
| | | if(null != orderPrivateCar1 && orderPrivateCar1.getType() == 3 && orderPrivateCar1.getState() == 1&& orderPrivateCar1.getState() == 11){ |
| | | orderPrivateCarService.deleteById(orderId); |
| | | OrderTaxi orderTaxi1 = setOrderTaxi(orderPrivateCar1); |
| | | this.insert(orderTaxi1); |
| | | orderTaxi = orderTaxi1; |
| | | OrderTaxi orderTaxi = this.selectById(orderId); |
| | | if(null != orderTaxi && orderTaxi.getType() == 2){ |
| | | if(orderTaxi.getState() != 1){ |
| | | return ResultUtil.error("订单已被抢了"); |
| | | } |
| | | }else{ |
| | | orderTaxi = this.selectById(orderId); |
| | | OrderPrivateCar orderPrivateCar1 = orderPrivateCarService.selectById(orderId); |
| | | if(null != orderPrivateCar1 && orderPrivateCar1.getType() == 3 && orderPrivateCar1.getState() != 1&& orderPrivateCar1.getState() != 11){ |
| | | return ResultUtil.error("订单已被抢了"); |
| | | } |
| | | orderTaxi = null; |
| | | if(null != orderPrivateCar1 && orderPrivateCar1.getType() == 3 && (orderPrivateCar1.getState() == 1|| orderPrivateCar1.getState() == 11)){ |
| | | orderPrivateCarService.deleteById(orderId); |
| | | OrderTaxi orderTaxi1 = setOrderTaxi(orderPrivateCar1); |
| | | this.insert(orderTaxi1); |
| | | orderTaxi = orderTaxi1; |
| | | } |
| | | } |
| | | if(null == orderTaxi){ |
| | | return ResultUtil.error("订单已被抢了"); |
| | | } |
| | | |
| | | |
| | | //处理摆渡车的情况 |
| | | if(orderTaxi.getType() == 2){ |
| | |
| | | // } |
| | | |
| | | // 是否推广订单 |
| | | Integer promotion = isPromotion(orderTaxi.getUserId()); |
| | | Integer promotion = isPromotion(orderTaxi.getUserId(), driver.getPlaceOfEmployment()); |
| | | if(promotion!=null){ |
| | | orderTaxi.setPromotion(2); |
| | | Driver driver1 = driverService.selectById(promotion); |
| | |
| | | orderTaxi.setTravelId(travelItinerary); |
| | | }else{ |
| | | //改派抢单 |
| | | Company company1 = companyService.selectById(driver.getCompanyId()); |
| | | //中台修改订单状态 |
| | | ModifyTravelItineraryRequest request1 = new ModifyTravelItineraryRequest(); |
| | | request1.setOrderId(orderTaxi.getTravelId()); |
| | | request1.setStatus(orderTaxi.getState()); |
| | | request1.setDriverId(driver.getEmpId().toString()); |
| | | if(2 == orderTaxi.getPromotion()){ |
| | | Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId()); |
| | | request1.setPromoterId(driver1.getEmpId().toString()); |
| | | if(ToolUtil.isNotEmpty(orderTaxi.getTravelId())){ |
| | | Company company1 = companyService.selectById(driver.getCompanyId()); |
| | | //中台修改订单状态 |
| | | ModifyTravelItineraryRequest request1 = new ModifyTravelItineraryRequest(); |
| | | request1.setOrderId(orderTaxi.getTravelId()); |
| | | request1.setStatus(orderTaxi.getState()); |
| | | request1.setDriverId(driver.getEmpId().toString()); |
| | | if(2 == orderTaxi.getPromotion()){ |
| | | Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId()); |
| | | request1.setPromoterId(driver1.getEmpId().toString()); |
| | | } |
| | | request1.setSupplierShopId(company1.getEnterCode()); |
| | | OrderUtil.modifyTravelItinerary(request1); |
| | | } |
| | | request1.setSupplierShopId(company1.getEnterCode()); |
| | | OrderUtil.modifyTravelItinerary(request1); |
| | | } |
| | | this.updateById(orderTaxi); |
| | | |
| | |
| | | |
| | | return ResultUtil.success(orderTaxi.getId()); |
| | | } |
| | | private Integer isPromotion(Integer userId){ |
| | | private Integer isPromotion(Integer userId, String code){ |
| | | UserInfo userInfo = userInfoMapper.selectById(userId); |
| | | if(userInfo.getBindDriverId()!=null && userInfo.getBindExpireDate().getTime()<=System.currentTimeMillis()){ |
| | | String registAreaCode = userInfo.getRegistAreaCode(); |
| | | TDriverPromotionActivity tDriverPromotionActivity = driverPromotionActivityService.selectOne(new EntityWrapper<TDriverPromotionActivity>().eq("state",1).eq("districtCode", registAreaCode).ge("startTime", new Date()).lt("endTime", new Date()).last("AND FIND_IN_SET(" + 1 + ", bizType) limit 1")); |
| | | TDriverPromotionActivity tDriverPromotionActivity = driverPromotionActivityService.selectOne(new EntityWrapper<TDriverPromotionActivity>().eq("state",1) |
| | | .eq("districtCode", code).le("startTime", new Date()).ge("endTime", new Date()).last("AND FIND_IN_SET(" + 2 + ", bizType) limit 1")); |
| | | if(tDriverPromotionActivity!=null){ |
| | | return userInfo.getBindDriverId(); |
| | | } |
| | |
| | | orderTaxi.setOrderType(orderPrivateCar.getOrderType()); |
| | | orderTaxi.setOrderSource(orderPrivateCar.getOrderSource()); |
| | | orderTaxi.setIsDelete(1); |
| | | orderTaxi.setIsReassign(1); |
| | | return orderTaxi; |
| | | } |
| | | |
| | |
| | | orderTaxi.setStartServiceTime(date); |
| | | orderTaxi.setBoardingTime(date); |
| | | |
| | | String value = (String) redisTemplate.opsForValue().get("DRIVER" + uid); |
| | | String value = (String) redisTemplate.opsForValue().get("dache:DRIVER" + uid); |
| | | if (ToolUtil.isNotEmpty(value)) { |
| | | String[] split = value.split(","); |
| | | Map<String, String> geocode1 = gdMapGeocodingUtil.geocode(split[0], split[1]); |
| | |
| | | } |
| | | this.updateById(orderTaxi); |
| | | |
| | | Driver driver = driverService.selectById(orderTaxi.getDriverId()); |
| | | Company company = companyService.selectById(driver.getCompanyId()); |
| | | //中台修改订单状态 |
| | | ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); |
| | | request.setOrderId(orderTaxi.getTravelId()); |
| | | request.setStatus(orderTaxi.getState()); |
| | | request.setDriverId(driver.getEmpId().toString()); |
| | | if(2 == orderTaxi.getPromotion()){ |
| | | Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId()); |
| | | request.setPromoterId(driver1.getEmpId().toString()); |
| | | if(ToolUtil.isNotEmpty(orderTaxi.getTravelId())){ |
| | | Driver driver = driverService.selectById(orderTaxi.getDriverId()); |
| | | Company company = companyService.selectById(driver.getCompanyId()); |
| | | //中台修改订单状态 |
| | | ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); |
| | | request.setOrderId(orderTaxi.getTravelId()); |
| | | request.setStatus(orderTaxi.getState()); |
| | | request.setDriverId(driver.getEmpId().toString()); |
| | | if(2 == orderTaxi.getPromotion()){ |
| | | Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId()); |
| | | request.setPromoterId(driver1.getEmpId().toString()); |
| | | } |
| | | request.setSupplierShopId(company.getEnterCode()); |
| | | OrderUtil.modifyTravelItinerary(request); |
| | | } |
| | | request.setSupplierShopId(company.getEnterCode()); |
| | | OrderUtil.modifyTravelItinerary(request); |
| | | |
| | | // TODO: 2020/6/5 推送状态 |
| | | new Thread(new Runnable() { |
| | |
| | | this.updateById(orderTaxi); |
| | | |
| | | Driver driver = driverService.selectById(orderTaxi.getDriverId()); |
| | | Company company = companyService.selectById(driver.getCompanyId()); |
| | | //中台修改订单状态 |
| | | ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); |
| | | request.setOrderId(orderTaxi.getTravelId()); |
| | | request.setStatus(orderTaxi.getState()); |
| | | request.setDriverId(driver.getEmpId().toString()); |
| | | if(2 == orderTaxi.getPromotion()){ |
| | | Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId()); |
| | | request.setPromoterId(driver1.getEmpId().toString()); |
| | | if(ToolUtil.isNotEmpty(orderTaxi.getTravelId())){ |
| | | Company company = companyService.selectById(driver.getCompanyId()); |
| | | //中台修改订单状态 |
| | | ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); |
| | | request.setOrderId(orderTaxi.getTravelId()); |
| | | request.setStatus(orderTaxi.getState()); |
| | | request.setDriverId(driver.getEmpId().toString()); |
| | | if(2 == orderTaxi.getPromotion()){ |
| | | Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId()); |
| | | request.setPromoterId(driver1.getEmpId().toString()); |
| | | } |
| | | request.setSupplierShopId(company.getEnterCode()); |
| | | OrderUtil.modifyTravelItinerary(request); |
| | | } |
| | | request.setSupplierShopId(company.getEnterCode()); |
| | | OrderUtil.modifyTravelItinerary(request); |
| | | |
| | | //回滚司机状态为空闲 |
| | | driver.setState(2); |
| | |
| | | this.updateById(orderTaxi); |
| | | |
| | | Driver driver = driverService.selectById(orderTaxi.getDriverId()); |
| | | Company company1 = companyService.selectById(driver.getCompanyId()); |
| | | //中台修改订单状态 |
| | | ModifyTravelItineraryRequest request1 = new ModifyTravelItineraryRequest(); |
| | | request1.setOrderId(orderTaxi.getTravelId()); |
| | | request1.setStatus(orderTaxi.getState()); |
| | | request1.setDriverId(driver.getEmpId().toString()); |
| | | if(2 == orderTaxi.getPromotion()){ |
| | | Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId()); |
| | | request1.setPromoterId(driver1.getEmpId().toString()); |
| | | if(ToolUtil.isNotEmpty(orderTaxi.getTravelId())){ |
| | | Company company1 = companyService.selectById(driver.getCompanyId()); |
| | | //中台修改订单状态 |
| | | ModifyTravelItineraryRequest request1 = new ModifyTravelItineraryRequest(); |
| | | request1.setOrderId(orderTaxi.getTravelId()); |
| | | request1.setStatus(orderTaxi.getState()); |
| | | request1.setDriverId(driver.getEmpId().toString()); |
| | | if(2 == orderTaxi.getPromotion()){ |
| | | Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId()); |
| | | request1.setPromoterId(driver1.getEmpId().toString()); |
| | | } |
| | | request1.setSupplierShopId(company1.getEnterCode()); |
| | | OrderUtil.modifyTravelItinerary(request1); |
| | | } |
| | | request1.setSupplierShopId(company1.getEnterCode()); |
| | | OrderUtil.modifyTravelItinerary(request1); |
| | | |
| | | //回滚司机状态为空闲 |
| | | driver.setState(2); |