| | |
| | | @Autowired |
| | | private ITaxiCardService taxiCardService; |
| | | |
| | | @Autowired |
| | | private ITaxiCardPaymentService taxiCardPaymentService; |
| | | |
| | | |
| | | @Autowired |
| | | private IUserUserService userUserService; |
| | | |
| | |
| | | if (null == orderTaxi) { |
| | | return ResultUtil.error("获取数据失败,订单信息有误"); |
| | | } |
| | | if (orderTaxi.getState() == 5) { |
| | | return ResultUtil.error("订单已开始服务,不能取消订单"); |
| | | } |
| | | if (orderTaxi.getState() == 6 || orderTaxi.getState() == 7 || orderTaxi.getState() == 8 || orderTaxi.getState() == 9) { |
| | | return ResultUtil.error("订单已完成,不能取消订单"); |
| | | } |
| | | if (orderTaxi.getState() == 10) { |
| | | return ResultUtil.error("订单已被取消,不能重复操作"); |
| | | } |
| | | double amount = 0; |
| | | OpenCity openCity = openCityService.openCity1(orderTaxi.getStartLon().toString(), orderTaxi.getStartLat().toString()); |
| | | CancleOrder query = cancleOrderService.query(orderTaxi.getOrderType(), 2, openCity.getId()); |
| | |
| | | // return ResultUtil.error("司机已到达预约点,取消会产生一定的费用"); |
| | | // } |
| | | if (orderTaxi.getState() >= 5 && orderTaxi.getState() != 11) { |
| | | return ResultUtil.error("取消订单失败,不合法的操作"); |
| | | return ResultUtil.error("订单已取消,请刷新页面"); |
| | | } |
| | | if (null == orderTaxi.getDriverId()) {//没有接单的情况 |
| | | if (orderTaxi.getType() == 2) {//摆渡车 |
| | |
| | | orderCancelService.saveData(orderPrivateCar1.getId(), 1, "无司机接单", "无司机接单", null, null, 2, 1, uid); |
| | | orderPrivateCar1.setState(10); |
| | | orderPrivateCarService.updateById(orderPrivateCar1); |
| | | |
| | | Driver driver1 = null; |
| | | Company company = null; |
| | | //中台修改订单状态 |
| | | ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); |
| | | request.setOrderId(orderPrivateCar1.getTravelId()); |
| | | request.setStatus(orderPrivateCar1.getState()); |
| | | if (null != orderPrivateCar1.getDriverId()) { |
| | | driver1 = driverService.selectById(orderPrivateCar1.getDriverId()); |
| | | company = companyService.selectById(driver1.getCompanyId()); |
| | | request.setDriverId(driver1.getEmpId().toString()); |
| | | request.setSupplierShopId(company.getEnterCode()); |
| | | } |
| | | if (2 == orderPrivateCar1.getPromotion()) { |
| | | Driver driver2 = driverService.selectById(orderPrivateCar1.getPromotionDriverId()); |
| | | request.setPromoterId(driver2.getEmpId().toString()); |
| | | } |
| | | OrderUtil.modifyTravelItinerary(request); |
| | | } |
| | | List<OrderTaxi> list1 = this.selectList(new EntityWrapper<OrderTaxi>().eq("type", 2).eq("crossCityOrderId", orderTaxi.getCrossCityOrderId()).eq("place", orderTaxi.getPlace())); |
| | | for (OrderTaxi orderTaxi1 : list1) { |
| | | orderCancelService.saveData(orderTaxi1.getId(), 2, "无司机接单", "无司机接单", null, null, 2, 1, uid); |
| | | orderTaxi1.setState(10); |
| | | this.updateById(orderTaxi1); |
| | | |
| | | Driver driver1 = null; |
| | | Company company = null; |
| | | //中台修改订单状态 |
| | | ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); |
| | | request.setOrderId(orderTaxi1.getTravelId()); |
| | | request.setStatus(orderTaxi1.getState()); |
| | | if (null != orderTaxi1.getDriverId()) { |
| | | driver1 = driverService.selectById(orderTaxi1.getDriverId()); |
| | | company = companyService.selectById(driver1.getCompanyId()); |
| | | request.setDriverId(driver1.getEmpId().toString()); |
| | | request.setSupplierShopId(company.getEnterCode()); |
| | | } |
| | | if (2 == orderTaxi1.getPromotion()) { |
| | | Driver driver2 = driverService.selectById(orderTaxi1.getPromotionDriverId()); |
| | | request.setPromoterId(driver2.getEmpId().toString()); |
| | | } |
| | | OrderUtil.modifyTravelItinerary(request); |
| | | } |
| | | } else { |
| | | integer = orderCancelService.saveData(id, 2, "无司机接单", "无司机接单", null, null, 2, 1, uid); |
| | | orderTaxi.setState(10); |
| | | this.updateById(orderTaxi); |
| | | |
| | | Driver driver1 = null; |
| | | Company company = null; |
| | | //中台修改订单状态 |
| | | ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); |
| | | request.setOrderId(orderTaxi.getTravelId()); |
| | | request.setStatus(orderTaxi.getState()); |
| | | if (null != orderTaxi.getDriverId()) { |
| | | driver1 = driverService.selectById(orderTaxi.getDriverId()); |
| | | company = companyService.selectById(driver1.getCompanyId()); |
| | | request.setDriverId(driver1.getEmpId().toString()); |
| | | request.setSupplierShopId(company.getEnterCode()); |
| | | } |
| | | if (2 == orderTaxi.getPromotion()) { |
| | | Driver driver2 = driverService.selectById(orderTaxi.getPromotionDriverId()); |
| | | request.setPromoterId(driver2.getEmpId().toString()); |
| | | } |
| | | OrderUtil.modifyTravelItinerary(request); |
| | | } |
| | | } else { |
| | | OpenCity openCity = openCityService.openCity1(orderTaxi.getStartLon().toString(), orderTaxi.getStartLat().toString()); |
| | |
| | | } |
| | | this.deleteTask(id);//删除定时任务 |
| | | |
| | | Driver driver1 = null; |
| | | Company company = null; |
| | | //中台修改订单状态 |
| | | ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); |
| | | request.setOrderId(orderTaxi.getTravelId()); |
| | | request.setStatus(orderTaxi.getState()); |
| | | if (null != orderTaxi.getDriverId()) { |
| | | driver1 = driverService.selectById(orderTaxi.getDriverId()); |
| | | company = companyService.selectById(driver1.getCompanyId()); |
| | | request.setDriverId(driver1.getEmpId().toString()); |
| | | request.setSupplierShopId(company.getEnterCode()); |
| | | if(ToolUtil.isNotEmpty(orderTaxi.getTravelId())){ |
| | | Driver driver1 = null; |
| | | Company company = null; |
| | | //中台修改订单状态 |
| | | ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); |
| | | request.setOrderId(orderTaxi.getTravelId()); |
| | | request.setStatus(orderTaxi.getState()); |
| | | if (null != orderTaxi.getDriverId()) { |
| | | driver1 = driverService.selectById(orderTaxi.getDriverId()); |
| | | company = companyService.selectById(driver1.getCompanyId()); |
| | | request.setDriverId(driver1.getEmpId().toString()); |
| | | request.setSupplierShopId(company.getEnterCode()); |
| | | } |
| | | if (2 == orderTaxi.getPromotion()) { |
| | | Driver driver2 = driverService.selectById(orderTaxi.getPromotionDriverId()); |
| | | request.setPromoterId(driver2.getEmpId().toString()); |
| | | } |
| | | OrderUtil.modifyTravelItinerary(request); |
| | | } |
| | | if (2 == orderTaxi.getPromotion()) { |
| | | Driver driver2 = driverService.selectById(orderTaxi.getPromotionDriverId()); |
| | | request.setPromoterId(driver2.getEmpId().toString()); |
| | | } |
| | | OrderUtil.modifyTravelItinerary(request); |
| | | |
| | | new Thread(new Runnable() { |
| | | @Override |
| | |
| | | return ResultUtil.error("取消订单失败,订单信息有误", ""); |
| | | } |
| | | if (orderTaxi.getState() != 12) { |
| | | return ResultUtil.error("取消订单失败,不合法的操作", ""); |
| | | return ResultUtil.error("订单已取消,请刷新页面", ""); |
| | | } |
| | | OrderCancel orderCancel = null; |
| | | if (null == cancleId) { |
| | |
| | | orderTaxi.setBindId(""); |
| | | this.updateById(orderTaxi); |
| | | |
| | | Driver driver = null; |
| | | Company company = null; |
| | | //中台修改订单状态 |
| | | ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); |
| | | request.setOrderId(orderTaxi.getTravelId()); |
| | | request.setStatus(orderTaxi.getState()); |
| | | if (null != orderTaxi.getDriverId()) { |
| | | driver = driverService.selectById(orderTaxi.getDriverId()); |
| | | company = companyService.selectById(driver.getCompanyId()); |
| | | request.setDriverId(driver.getEmpId().toString()); |
| | | request.setSupplierShopId(company.getEnterCode()); |
| | | if(ToolUtil.isNotEmpty(orderTaxi.getTravelId())){ |
| | | Driver driver = null; |
| | | Company company = null; |
| | | //中台修改订单状态 |
| | | ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); |
| | | request.setOrderId(orderTaxi.getTravelId()); |
| | | request.setStatus(orderTaxi.getState()); |
| | | if (null != orderTaxi.getDriverId()) { |
| | | driver = driverService.selectById(orderTaxi.getDriverId()); |
| | | company = companyService.selectById(driver.getCompanyId()); |
| | | request.setDriverId(driver.getEmpId().toString()); |
| | | request.setSupplierShopId(company.getEnterCode()); |
| | | } |
| | | if (2 == orderTaxi.getPromotion()) { |
| | | Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId()); |
| | | request.setPromoterId(driver1.getEmpId().toString()); |
| | | } |
| | | OrderUtil.modifyTravelItinerary(request); |
| | | } |
| | | if (2 == orderTaxi.getPromotion()) { |
| | | Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId()); |
| | | request.setPromoterId(driver1.getEmpId().toString()); |
| | | } |
| | | OrderUtil.modifyTravelItinerary(request); |
| | | |
| | | orderCancel.setState(2); |
| | | orderCancel.setPayType(3); |
| | |
| | | orderTaxi.setState(8); |
| | | orderTaxi.setPayType(3); |
| | | orderTaxi.setPayMoney(orderMoney); |
| | | orderTaxi.setPayTime(new Date()); |
| | | |
| | | //处理优惠券和红包 |
| | | if (null != userCouponRecord) { |
| | |
| | | return ResultUtil.error("订单不在待支付状态,不允许支付", ""); |
| | | } |
| | | Integer uid = orderTaxi.getUserId(); |
| | | Double orderMoney = orderTaxi.getOrderMoney(); |
| | | Double orderMoney = (1 == orderTaxi.getAbnormal() ? orderTaxi.getOrderMoney() : orderTaxi.getResponsibilityMoney().doubleValue()); |
| | | UserInfo userInfo = userInfoService.selectById(uid); |
| | | ResultUtil resultUtil = ResultUtil.success(new Object()); |
| | | orderTaxi.setCouponMoney(0D);//初始化历史数据 |
| | |
| | | // resultUtil = payMoneyUtil.weixinpay("完成订单", "", orderId + "_2_" + UUIDUtil.getRandomCode(5), orderMoney.toString(), "/base/wxPayOrderTaxi", app, userInfo.getAppletsOpenId()); |
| | | |
| | | Driver driver = driverService.selectById(orderTaxi.getDriverId()); |
| | | if(ToolUtil.isEmpty(orderTaxi.getTravelId())){ |
| | | Company company = companyService.selectById(driver.getCompanyId()); |
| | | //调三方订单中心创建行程单 |
| | | CreateTravelItineraryRequest request = new CreateTravelItineraryRequest(); |
| | | request.setOrderNo("TA" + orderTaxi.getId()); |
| | | request.setCustomerId(userInfo.getOnconUUID()); |
| | | request.setDriverId(driver.getEmpId().toString()); |
| | | request.setSupplierShopId(company.getEnterCode()); |
| | | if(orderTaxi.getPromotion() !=null && 2 == orderTaxi.getPromotion()){ |
| | | Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId()); |
| | | request.setPromoterId(driver1.getEmpId().toString()); |
| | | } |
| | | request.setServiceType(2); |
| | | String travelItinerary = OrderUtil.createTravelItinerary(request); |
| | | orderTaxi.setTravelId(travelItinerary); |
| | | |
| | | //创建订单 |
| | | //中台修改订单状态 |
| | | ModifyTravelItineraryRequest request1 = new ModifyTravelItineraryRequest(); |
| | | request1.setOrderId(orderTaxi.getTravelId()); |
| | | request1.setStatus(orderTaxi.getState()); |
| | | if (null != orderTaxi.getDriverId()) { |
| | | request1.setDriverId(driver.getEmpId().toString()); |
| | | request1.setSupplierShopId(company.getEnterCode()); |
| | | } |
| | | if (2 == orderTaxi.getPromotion()) { |
| | | Driver driver2 = driverService.selectById(orderTaxi.getPromotionDriverId()); |
| | | request1.setPromoterId(driver2.getEmpId().toString()); |
| | | } |
| | | OrderUtil.modifyTravelItinerary(request1); |
| | | } |
| | | |
| | | |
| | | if(null == orderTaxi.getIsCreated() || 0 == orderTaxi.getIsCreated()){ |
| | | //调用中台创建订单及拉起支付接口 |
| | | TradeOrderCreateData tradeOrderCreateData = new TradeOrderCreateData(); |
| | |
| | | } |
| | | goodsInfo.add(goodsInfoRequest); |
| | | tradeOrderCreateData.setGoodsInfo(goodsInfo); |
| | | TradeOrderCreate tradeOrderCreate = OrderUtil.tradeOrderCreate1(tradeOrderCreateData); |
| | | TradeOrderCreate tradeOrderCreate = OrderUtil.tradeOrderCreate1(tradeOrderCreateData, orderTaxi.getRecoveryOrder()); |
| | | PayInfo payInfo = tradeOrderCreate.getPayInfo(); |
| | | if(!"000000".equals(payInfo.getRetCode())){ |
| | | return ResultUtil.error(payInfo.getRetMsg()); |
| | |
| | | } |
| | | goodsInfo.add(goodsInfoRequest); |
| | | tradePayOff1Data.setGoodsInfo(goodsInfo); |
| | | PayInfo payInfo = OrderUtil.tradePayOff1(tradePayOff1Data); |
| | | PayInfo payInfo = OrderUtil.tradePayOff1(tradePayOff1Data, orderTaxi.getRecoveryOrder()); |
| | | if(!"000000".equals(payInfo.getRetCode())){ |
| | | return ResultUtil.error(payInfo.getRetMsg()); |
| | | } |
| | |
| | | orderTaxi.setState(8); |
| | | orderTaxi.setPayType(3); |
| | | orderTaxi.setPayMoney(orderMoney); |
| | | orderTaxi.setPayTime(new Date()); |
| | | |
| | | //处理优惠券和红包 |
| | | if (null != userCouponRecord) { |
| | |
| | | //添加收入 |
| | | Map<String, Object> map = incomeService.saveIncome(orderTaxi.getId(), 2, orderTaxi.getOrderMoney()); |
| | | orderTaxi.setSplitAllocation(JSON.toJSONString(map)); |
| | | |
| | | this.updateAllColumnById(orderTaxi); |
| | | promotion(orderTaxi.getId()); |
| | | |
| | | // TODO: 2020/5/24 这里需要给司机和用户推送订单状态 |
| | | new Thread(new Runnable() { |
| | |
| | | if (orderMoney == 0) { |
| | | return ResultUtil.error("请使用余额支付"); |
| | | } |
| | | orderTaxi.setPayTime(new Date()); |
| | | Double payMoney = orderTaxi.getOrderMoney(); |
| | | Integer integer = paymentRecordService.saveData(1, orderTaxi.getUserId(), 1, orderId, 2, 4, orderMoney, "", 1); |
| | | resultUtil = appOrderController.placeAnOrder(new BigDecimal(orderMoney), 4, orderId, 9, integer); |
| | | |
| | | } |
| | | |
| | | this.updateAllColumnById(orderTaxi); |
| | | if(payType!=3){ |
| | | this.updateAllColumnById(orderTaxi); |
| | | } |
| | | |
| | | return resultUtil; |
| | | } |
| | | |
| | |
| | | orderTaxi.setDiscountMoney(0D); |
| | | orderTaxi.setPayMoney(orderTaxi.getOrderMoney()); |
| | | orderTaxi.setState(8); |
| | | orderTaxi.setPayTime(new Date()); |
| | | this.updateById(orderTaxi); |
| | | |
| | | new Thread(new Runnable() { |
| | |
| | | if (Integer.valueOf(String.valueOf(map.get("state"))) == 11) { |
| | | map.put("state", map.get("oldState")); |
| | | } |
| | | |
| | | if (Integer.valueOf(String.valueOf(map.get("state"))) == 7 && (map.get("responsibilityType") == null || Integer.valueOf(String.valueOf(map.get("responsibilityType"))) < 4)) { |
| | | map.put("appealButton", 1); |
| | | } |
| | | |
| | | if (map.get("abnormalIntro") != null) { |
| | | map.put("appealStatus", 1); |
| | | } |
| | |
| | | OpenCity openCity = openCityService.openCity1(orderTaxi.getStartLon().toString(), orderTaxi.getStartLat().toString()); |
| | | List<PushOrder> querys = pushOrderService.querys(null, 2, openCity.getId());//获取需要推送的次数 |
| | | int time = 0; |
| | | for (int i = 1; i <= querys.size() + 5; i++) { |
| | | for (int i = 1; i <= querys.size() + 15; i++) { |
| | | int finalI = i; |
| | | PushOrder pushOrder = querys.stream().filter(s -> s.getType() == (finalI <= 3 ? finalI : 3)).findFirst().orElse(null); |
| | | time += pushOrder.getPushTime() * 1000; |
| | |
| | | orderTaxi.setState(8); |
| | | orderTaxi.setPayType(type); |
| | | orderTaxi.setPayMoney(query.getAmount()); |
| | | orderTaxi.setPayTime(new Date()); |
| | | |
| | | UserInfo userInfo = userInfoService.selectById(orderTaxi.getUserId()); |
| | | OpenCity openCity = openCityService.openCity1(orderTaxi.getStartLon().toString(), orderTaxi.getStartLat().toString()); |
| | |
| | | orderTaxi.setTelX(""); |
| | | this.updateById(orderTaxi); |
| | | |
| | | Driver driver = null; |
| | | Company company = null; |
| | | //中台修改订单状态 |
| | | ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); |
| | | request.setOrderId(orderTaxi.getTravelId()); |
| | | request.setStatus(orderTaxi.getState()); |
| | | if (null != orderTaxi.getDriverId()) { |
| | | driver = driverService.selectById(orderTaxi.getDriverId()); |
| | | company = companyService.selectById(driver.getCompanyId()); |
| | | request.setDriverId(driver.getEmpId().toString()); |
| | | request.setSupplierShopId(company.getEnterCode()); |
| | | if(ToolUtil.isNotEmpty(orderTaxi.getTravelId())){ |
| | | Driver driver = null; |
| | | Company company = null; |
| | | //中台修改订单状态 |
| | | ModifyTravelItineraryRequest request = new ModifyTravelItineraryRequest(); |
| | | request.setOrderId(orderTaxi.getTravelId()); |
| | | request.setStatus(orderTaxi.getState()); |
| | | if (null != orderTaxi.getDriverId()) { |
| | | driver = driverService.selectById(orderTaxi.getDriverId()); |
| | | company = companyService.selectById(driver.getCompanyId()); |
| | | request.setDriverId(driver.getEmpId().toString()); |
| | | request.setSupplierShopId(company.getEnterCode()); |
| | | } |
| | | if (2 == orderTaxi.getPromotion()) { |
| | | Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId()); |
| | | request.setPromoterId(driver1.getEmpId().toString()); |
| | | } |
| | | OrderUtil.modifyTravelItinerary(request); |
| | | } |
| | | if (2 == orderTaxi.getPromotion()) { |
| | | Driver driver1 = driverService.selectById(orderTaxi.getPromotionDriverId()); |
| | | request.setPromoterId(driver1.getEmpId().toString()); |
| | | } |
| | | OrderUtil.modifyTravelItinerary(request); |
| | | |
| | | query.setState(2); |
| | | query.setCode(order_id); |
| | |
| | | OpenCity openCity = openCityService.openCity1(orderTaxi.getStartLon().toString(), orderTaxi.getStartLat().toString()); |
| | | List<PushOrder> querys = pushOrderService.querys(null, 2, openCity.getId());//获取需要推送的次数 |
| | | //整轮派单结束,若无司机接单,系统自动增加派单5轮,若增加5轮后任无司机接单,则系统结束派单,乘客端显示无司机接单、是否再次打车 |
| | | for (int i = 1; i <= querys.size() + 5; i++) { |
| | | int finalI = i; |
| | | PushOrder pushOrder = querys.stream().filter(s -> s.getType() == (finalI <= 3 ? finalI : 3)).findFirst().orElse(null); |
| | | System.out.println("pushOrder:" + pushOrder); |
| | | //获取空闲司机 |
| | | List<Driver> list = driverService.queryIdleDriver(2, orderTaxi.getStartLon(), orderTaxi.getStartLat(), pushOrder.getPushDistance(), null);//所有附近空闲司机 |
| | | if (list.size() > 0) { |
| | | double driverProportion = pushOrder.getDriverProportion() / 100;//推送占比计算成小数 |
| | | int lastIndex = Double.valueOf(list.size() * driverProportion).intValue();//计算占比转成整数(下标截取) |
| | | lastIndex = lastIndex == 0 ? list.size() : lastIndex; |
| | | list = list.subList(0, lastIndex);//获取空闲司机中占比数据 |
| | | for (Driver driver : list) {//开始进行推送 |
| | | //查询是否在限制推单范围内 |
| | | boolean bo = false; |
| | | for (Integer integer : integers) { |
| | | if (integer.compareTo(driver.getId()) == 0) { |
| | | bo = true; |
| | | break; |
| | | int num = 0; |
| | | for (int j = 0; j < 6; j++) { |
| | | Boolean push = false; |
| | | for (int i = 1; i <= querys.size(); i++) { |
| | | num++; |
| | | int finalI = i; |
| | | PushOrder pushOrder = querys.stream().filter(s -> s.getType() == (finalI <= 3 ? finalI : 3)).findFirst().orElse(null); |
| | | System.out.println("pushOrder:" + pushOrder); |
| | | //获取空闲司机 |
| | | List<Driver> list = driverService.queryIdleDriver(2, orderTaxi.getStartLon(), orderTaxi.getStartLat(), pushOrder.getPushDistance(), null);//所有附近空闲司机 |
| | | //随机排序 |
| | | Collections.shuffle(list); |
| | | if (list.size() > 0) { |
| | | double driverProportion = pushOrder.getDriverProportion() / 100;//推送占比计算成小数 |
| | | int lastIndex = Double.valueOf(list.size() * driverProportion).intValue();//计算占比转成整数(下标截取) |
| | | lastIndex = lastIndex == 0 ? list.size() : lastIndex; |
| | | list = list.subList(0, lastIndex);//获取空闲司机中占比数据 |
| | | for (Driver driver : list) {//开始进行推送 |
| | | //查询是否在限制推单范围内 |
| | | boolean bo = false; |
| | | for (Integer integer : integers) { |
| | | if (integer.compareTo(driver.getId()) == 0) { |
| | | bo = true; |
| | | break; |
| | | } |
| | | } |
| | | if (bo) { |
| | | continue; |
| | | } |
| | | pushUtil.pushOrderState(2, driver.getId(), orderTaxi.getId(), 2, orderTaxi.getState(), pushOrder.getPushTime()); |
| | | } |
| | | if (bo) { |
| | | continue; |
| | | } |
| | | pushUtil.pushOrderState(2, driver.getId(), orderTaxi.getId(), 2, orderTaxi.getState(), pushOrder.getPushTime()); |
| | | } |
| | | Thread.sleep(pushOrder.getPushTime() * 1000);//设置等待时间 |
| | | OrderPrivateCar orderTaxi1 = orderPrivateCarService.selectById(orderTaxi.getId()); |
| | | Integer state = orderTaxi1.getState(); |
| | | if (state != 1) { |
| | | push = true; |
| | | break; |
| | | } |
| | | if (num == 18 && state == 1) { |
| | | orderTaxi1.setState(10); |
| | | orderPrivateCarService.updateById(orderTaxi1); |
| | | pushUtil.pushEndPush(1, orderTaxi.getUserId(), orderTaxi.getId(), 2, 1); |
| | | orderIds.remove(orderTaxi.getId()); |
| | | } |
| | | } |
| | | Thread.sleep(pushOrder.getPushTime() * 1000);//设置等待时间 |
| | | OrderTaxi orderTaxi1 = OrderTaxiServiceImpl.this.selectById(orderTaxi.getId()); |
| | | Integer state = orderTaxi1.getState(); |
| | | if (state != 1) { |
| | | if(push){ |
| | | break; |
| | | } |
| | | if (i == querys.size() + 5 && state == 1) { |
| | | pushUtil.pushEndPush(1, orderTaxi.getUserId(), orderTaxi.getId(), 2); |
| | | orderIds.remove(orderTaxi.getId()); |
| | | } |
| | | } |
| | | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | UserInfo userInfo = userInfoService.selectById(orderTaxi.getUserId()); |
| | | if (orderTaxi.getPromotionDriverId() != null) { |
| | | String registAreaCode = userInfo.getRegistAreaCode(); |
| | | TDriverPromotionActivity tDriverPromotionActivity = driverPromotionActivityService.selectOne(new EntityWrapper<TDriverPromotionActivity>().eq("districtCode", registAreaCode).ge("startTime", new Date()).lt("endTime", new Date()).last("AND FIND_IN_SET(" + 2 + ", bizType) limit 1")); |
| | | TDriverPromotionActivity tDriverPromotionActivity = driverPromotionActivityService.selectOne(new EntityWrapper<TDriverPromotionActivity>().eq("districtCode", registAreaCode).le("startTime", new Date()).ge("endTime", new Date()).last("AND FIND_IN_SET(" + 2 + ", bizType) limit 1")); |
| | | if (tDriverPromotionActivity != null) { |
| | | Double payMoney = orderTaxi.getPayMoney(); |
| | | BigDecimal bigDecimal = tDriverPromotionActivity.getCommissionRatio().divide(new BigDecimal(100), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(payMoney)).setScale(2, RoundingMode.HALF_UP); |
| | | orderTaxi.setPromotionDriverId(userInfo.getBindDriverId()); |
| | | orderTaxi.setPromotionMoney(bigDecimal); |
| | | orderTaxi.setPromotionActivityId(tDriverPromotionActivity.getId()); |
| | | orderTaxi.setSuccessTime(new Date()); |
| | | this.baseMapper.updateById(orderTaxi); |
| | | } |
| | | } |