| | |
| | | private Lock lock = new ReentrantLock(); |
| | | @Autowired |
| | | private AppOrderController appOrderController; |
| | | |
| | | @Autowired |
| | | private TDriverPromotionActivityService driverPromotionActivityService; |
| | | |
| | | /** |
| | | * 专车下单操作 |
| | |
| | | orderPrivateCar.setTotalPeopleNum(peopleNum); |
| | | orderPrivateCar.setIsReassign(1); |
| | | orderPrivateCar.setIsDelete(1); |
| | | |
| | | // 是否推广订单 |
| | | Integer promotion = isPromotion(uid); |
| | | orderPrivateCar.setPromotion(promotion); |
| | | |
| | | |
| | | this.insert(orderPrivateCar); |
| | | |
| | | //判断独享,一口价,拼车 |
| | |
| | | } |
| | | return ResultUtil.success(baseWarpper); |
| | | } |
| | | |
| | | |
| | | |
| | | private Integer isPromotion(Integer userId){ |
| | | UserInfo userInfo = userInfoService.selectById(userId); |
| | | if(userInfo.getBindDriverId()!=null && userInfo.getBindExpireDate().getTime()<=System.currentTimeMillis()){ |
| | | 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(" + 1 + ", bizType) limit 1")); |
| | | if(tDriverPromotionActivity!=null){ |
| | | return 2; |
| | | } |
| | | } |
| | | return null; |
| | | |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 下单后继续等待 |
| | | * |
| | |
| | | this.baseMapper.updateById(orderPrivateCar); |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public void promotion(Integer orderId) { |
| | | OrderPrivateCar orderPrivateCar = this.baseMapper.selectById(orderId); |
| | | UserInfo userInfo = userInfoService.selectById(orderPrivateCar.getUserId()); |
| | | if(userInfo.getBindDriverId()!=null && userInfo.getBindExpireDate().getTime()<=System.currentTimeMillis()){ |
| | | 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(" + 1 + ", bizType) limit 1")); |
| | | if(tDriverPromotionActivity!=null){ |
| | | Double payMoney = orderPrivateCar.getPayMoney(); |
| | | BigDecimal bigDecimal = tDriverPromotionActivity.getCommissionRatio().divide(new BigDecimal(100), 2, RoundingMode.HALF_UP).multiply(new BigDecimal(payMoney)).setScale(2, RoundingMode.HALF_UP); |
| | | orderPrivateCar.setPromotionDriverId(userInfo.getBindDriverId()); |
| | | orderPrivateCar.setPromotionMoney(bigDecimal); |
| | | this.baseMapper.updateById(orderPrivateCar); |
| | | } |
| | | } |
| | | } |
| | | } |