| | |
| | | @Autowired |
| | | private ITaxiCardService taxiCardService; |
| | | |
| | | @Autowired |
| | | private ITaxiCardPaymentService taxiCardPaymentService; |
| | | |
| | | |
| | | @Autowired |
| | | private IUserUserService userUserService; |
| | | |
| | |
| | | //添加收入 |
| | | 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() { |
| | |
| | | resultUtil = appOrderController.placeAnOrder(new BigDecimal(orderMoney), 4, orderId, 9, integer); |
| | | |
| | | } |
| | | |
| | | this.updateAllColumnById(orderTaxi); |
| | | if(payType!=3){ |
| | | this.updateAllColumnById(orderTaxi); |
| | | } |
| | | |
| | | return resultUtil; |
| | | } |
| | | |
| | |
| | | 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("司机没有上传位置信息"); |
| | | |
| | |
| | | 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++) { |
| | | 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); |
| | | System.out.println("pushOrder:" + pushOrder); |
| | |
| | | } |
| | | } |
| | | Thread.sleep(pushOrder.getPushTime() * 1000);//设置等待时间 |
| | | OrderTaxi orderTaxi1 = OrderTaxiServiceImpl.this.selectById(orderTaxi.getId()); |
| | | OrderPrivateCar orderTaxi1 = orderPrivateCarService.selectById(orderTaxi.getId()); |
| | | Integer state = orderTaxi1.getState(); |
| | | if (state != 1) { |
| | | break; |
| | | } |
| | | if (i == querys.size() + 5 && state == 1) { |
| | | if (i == querys.size() + 15 && state == 1) { |
| | | pushUtil.pushEndPush(1, orderTaxi.getUserId(), orderTaxi.getId(), 2); |
| | | orderIds.remove(orderTaxi.getId()); |
| | | } |
| | |
| | | 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); |
| | | } |
| | | } |