| | |
| | | import com.stylefeng.guns.modular.system.model.vo.UnPayOrderVO; |
| | | import com.stylefeng.guns.modular.system.service.*; |
| | | import com.stylefeng.guns.modular.system.util.*; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.OrderUtil; |
| | | import com.stylefeng.guns.modular.system.util.qianyuntong.model.*; |
| | | import com.stylefeng.guns.modular.system.warpper.*; |
| | | import com.stylefeng.guns.modular.taxi.dao.OrderTaxiMapper; |
| | | import com.stylefeng.guns.modular.taxi.model.OrderTaxi; |
| | |
| | | |
| | | @Autowired |
| | | private IDriverServiceService driverServiceService; |
| | | |
| | | |
| | | @Autowired |
| | | private TAbnormalPayOrderMapper abnormalPayOrderMapper; |
| | | |
| | |
| | | @Autowired |
| | | private ITaxiCardService taxiCardService; |
| | | |
| | | @Autowired |
| | | private ITaxiCardPaymentService taxiCardPaymentService; |
| | | |
| | | |
| | | @Autowired |
| | | private IUserUserService userUserService; |
| | | |
| | |
| | | |
| | | @Value("${callbackPath}") |
| | | private String callbackPath; |
| | | |
| | | |
| | | |
| | | |
| | | @Autowired |
| | | private TDriverPromotionActivityService driverPromotionActivityService; |
| | | |
| | | /** |
| | | * 出租车下单操作 |
| | | * |
| | |
| | | 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) {//摆渡车 |
| | |
| | | this.updateById(orderTaxi); |
| | | } |
| | | this.deleteTask(id);//删除定时任务 |
| | | |
| | | 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); |
| | | } |
| | | |
| | | 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.setTelX(""); |
| | | orderTaxi.setBindId(""); |
| | | this.updateById(orderTaxi); |
| | | |
| | | 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); |
| | | } |
| | | |
| | | orderCancel.setState(2); |
| | | orderCancel.setPayType(3); |
| | |
| | | orderTaxi.setState(8); |
| | | orderTaxi.setPayType(3); |
| | | orderTaxi.setPayMoney(orderMoney); |
| | | orderTaxi.setPayTime(new Date()); |
| | | |
| | | //处理优惠券和红包 |
| | | if (null != userCouponRecord) { |
| | |
| | | |
| | | @Override |
| | | @Transactional(propagation = Propagation.REQUIRES_NEW) |
| | | public ResultUtil payTaxiOrder1(Integer payType, Integer orderId, Integer objectId, Integer objectType, Integer type) throws Exception { |
| | | public ResultUtil payTaxiOrder1(Integer payType, Integer orderId, Integer objectId, Integer objectType, Integer type, String path, String ip) throws Exception { |
| | | OrderTaxi orderTaxi = this.selectById(orderId); |
| | | if (orderTaxi.getState() == 8 || orderTaxi.getState() == 9) { |
| | | return ResultUtil.error("订单已完成支付,不允许重复支付", ""); |
| | |
| | | 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);//初始化历史数据 |
| | |
| | | if (orderMoney == 0) { |
| | | return ResultUtil.error("请使用余额支付"); |
| | | } |
| | | String app = type == 1 ? "APP" : "JSAPI"; |
| | | resultUtil = payMoneyUtil.weixinpay("完成订单", "", orderId + "_2_" + UUIDUtil.getRandomCode(5), orderMoney.toString(), "/base/wxPayOrderTaxi", app, userInfo.getAppletsOpenId()); |
| | | // String app = type == 1 ? "APP" : "JSAPI"; |
| | | // 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(); |
| | | tradeOrderCreateData.setTreatShopId(driver.getEmpId().toString()); |
| | | //追缴单不要分账 |
| | | if(0 == orderTaxi.getRecoveryOrder()){ |
| | | tradeOrderCreateData.setField1("{\"profitSharing\":\"1\",\"isPromote\":\"" + (orderTaxi.getPromotion() == 2 ? 1 : 0) + "\"}"); |
| | | }else{ |
| | | tradeOrderCreateData.setField1("{\"profitSharing\":\"0\",\"isPromote\":\"0\"}"); |
| | | } |
| | | tradeOrderCreateData.setCharge(new BigDecimal(orderMoney)); |
| | | tradeOrderCreateData.setOrderId(orderTaxi.getTravelId()); |
| | | tradeOrderCreateData.setOrderNo("TA" + orderTaxi.getId()); |
| | | tradeOrderCreateData.setCustomerId(userInfo.getOnconUUID()); |
| | | tradeOrderCreateData.setPartnerPayId(orderTaxi.getTravelId()); |
| | | tradeOrderCreateData.setTotalFee(Double.valueOf(orderMoney * 100).intValue() + ""); |
| | | tradeOrderCreateData.setOrderDesc("完成订单"); |
| | | tradeOrderCreateData.setRetUrl(path); |
| | | tradeOrderCreateData.setClientIp(ip); |
| | | |
| | | List<GoodsInfoRequest> goodsInfo = new ArrayList<>(); |
| | | GoodsInfoRequest goodsInfoRequest = new GoodsInfoRequest(); |
| | | goodsInfoRequest.setSubOpenId(userInfo.getAppletsOpenId()); |
| | | if(0 == orderTaxi.getRecoveryOrder()){ |
| | | goodsInfoRequest.setProfitSharing("1"); |
| | | }else{ |
| | | goodsInfoRequest.setProfitSharing("0"); |
| | | } |
| | | goodsInfo.add(goodsInfoRequest); |
| | | tradeOrderCreateData.setGoodsInfo(goodsInfo); |
| | | TradeOrderCreate tradeOrderCreate = OrderUtil.tradeOrderCreate1(tradeOrderCreateData, orderTaxi.getRecoveryOrder()); |
| | | PayInfo payInfo = tradeOrderCreate.getPayInfo(); |
| | | if(!"000000".equals(payInfo.getRetCode())){ |
| | | return ResultUtil.error(payInfo.getRetMsg()); |
| | | } |
| | | orderTaxi.setIsCreated(1); |
| | | resultUtil = ResultUtil.success(payInfo.getData().getRedirectUrl()); |
| | | }else{ |
| | | //拉起支付 |
| | | TradePayOff1Data tradePayOff1Data = new TradePayOff1Data(); |
| | | tradePayOff1Data.setPartnerPayId(orderTaxi.getTravelId()); |
| | | tradePayOff1Data.setTotalFee(Double.valueOf(orderMoney * 100).intValue() + ""); |
| | | tradePayOff1Data.setRetUrl(path); |
| | | tradePayOff1Data.setClientIp(ip); |
| | | tradePayOff1Data.setOrderDesc("完成订单"); |
| | | List<GoodsInfoRequest> goodsInfo = new ArrayList<>(); |
| | | GoodsInfoRequest goodsInfoRequest = new GoodsInfoRequest(); |
| | | goodsInfoRequest.setSubOpenId(userInfo.getAppletsOpenId()); |
| | | if(0 == orderTaxi.getRecoveryOrder()){ |
| | | goodsInfoRequest.setProfitSharing("1"); |
| | | }else{ |
| | | goodsInfoRequest.setProfitSharing("0"); |
| | | } |
| | | goodsInfo.add(goodsInfoRequest); |
| | | tradePayOff1Data.setGoodsInfo(goodsInfo); |
| | | PayInfo payInfo = OrderUtil.tradePayOff1(tradePayOff1Data, orderTaxi.getRecoveryOrder()); |
| | | if(!"000000".equals(payInfo.getRetCode())){ |
| | | return ResultUtil.error(payInfo.getRetMsg()); |
| | | } |
| | | resultUtil = ResultUtil.success(payInfo.getData().getRedirectUrl()); |
| | | } |
| | | |
| | | paymentRecordService.saveData(1, orderTaxi.getUserId(), 1, orderId, 2, 1, orderMoney, "", 1);//添加预支付数据 |
| | | } |
| | | if (payType == 2) {//支付宝支付 |
| | |
| | | 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){ |
| | | |
| | | if (map.get("abnormalIntro") != null) { |
| | | map.put("appealStatus", 1); |
| | | } |
| | | String driverId = (String) redisTemplate.opsForValue().get("DEVICE_" + map.get("driverId")); |
| | |
| | | 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; |
| | |
| | | //计算预计距离和剩余时间 |
| | | String value = null; |
| | | if (null != orderTaxi.getDriverId()) { |
| | | value = (String) redisTemplate.opsForValue().get("DRIVER" + orderTaxi.getDriverId()); |
| | | value = (String) redisTemplate.opsForValue().get("dache:DRIVER" + orderTaxi.getDriverId()); |
| | | if (null == value || "".equals(value)) { |
| | | System.err.println("司机没有上传位置信息"); |
| | | |
| | |
| | | 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); |
| | | |
| | | 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); |
| | | } |
| | | |
| | | query.setState(2); |
| | | query.setCode(order_id); |
| | | paymentRecordService.updateById(query); |
| | |
| | | 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(); |
| | | } |
| | |
| | | @Override |
| | | public void addAppeal(Integer uid, Integer orderId, String abnormalIntro, String abnormalImg) { |
| | | OrderTaxi orderTaxi = this.selectById(orderId); |
| | | if(orderTaxi.getState()!=7 || orderTaxi.getAbnormalIntro()!=null){ |
| | | if (orderTaxi.getState() != 7 || orderTaxi.getAbnormalIntro() != null) { |
| | | throw new RuntimeException("此订单无法申诉"); |
| | | } |
| | | orderTaxi.setAbnormalIntro(abnormalIntro); |
| | |
| | | orderTaxi.setAbnormal(2); |
| | | this.baseMapper.updateById(orderTaxi); |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void promotion(Integer orderId) { |
| | | OrderTaxi orderTaxi = this.baseMapper.selectById(orderId); |
| | | UserInfo userInfo = userInfoService.selectById(orderTaxi.getUserId()); |
| | | if(orderTaxi.getPromotionDriverId()!=null){ |
| | | 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")); |
| | | if(tDriverPromotionActivity!=null){ |
| | | 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 = new BigDecimal(tDriverPromotionActivity.getCommissionRatio()).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(payMoney)).setScale(2, RoundingMode.HALF_UP); |
| | | 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); |
| | | } |
| | | } |
| | | // 是否异常订单 |
| | | if (orderTaxi.getResponsibilityType() !=null && orderTaxi.getResponsibilityType() >2) { |
| | | if (orderTaxi.getResponsibilityType() != null && orderTaxi.getResponsibilityType() > 2) { |
| | | TAbnormalPayOrder tAbnormalPayOrder = abnormalPayOrderMapper.selectList(new EntityWrapper<TAbnormalPayOrder>().eq("type", 2).eq("orderNum", orderTaxi.getOrderNum())).stream().findFirst().orElse(null); |
| | | if (tAbnormalPayOrder != null) { |
| | | tAbnormalPayOrder.setPayStatus(2); |