| | |
| | | import java.math.RoundingMode; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | import java.util.concurrent.LinkedBlockingQueue; |
| | | import java.util.concurrent.ThreadPoolExecutor; |
| | | import java.util.concurrent.TimeUnit; |
| | | import java.util.concurrent.locks.Lock; |
| | | import java.util.concurrent.locks.ReentrantLock; |
| | |
| | | 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")); |
| | | TDriverPromotionActivity tDriverPromotionActivity = driverPromotionActivityService.selectOne(new EntityWrapper<TDriverPromotionActivity>().eq("districtCode", registAreaCode).eq("state",1).ge("startTime", new Date()).lt("endTime", new Date()).last("AND FIND_IN_SET(" + 1 + ", bizType) limit 1")); |
| | | if(tDriverPromotionActivity!=null){ |
| | | return userInfo.getBindDriverId(); |
| | | } |
| | |
| | | } |
| | | resultUtil = ResultUtil.success(payInfo.getData().getRedirectUrl()); |
| | | } |
| | | |
| | | paymentRecordService.saveData(1, orderPrivateCar.getUserId(), 1, orderId, 1, 1, orderMoney, "", 1);//添加预支付数据 |
| | | |
| | | //创建定时任务查询订单支付状态 |
| | | ThreadPoolExecutor threadPoolExecutor = new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>()); |
| | | threadPoolExecutor.execute(()->{ |
| | | try { |
| | | int num = 1; |
| | | int wait = 0; |
| | | while (num <= 13) { |
| | | int min = 5000; |
| | | wait += (min * num); |
| | | OrderPrivateCar orderPrivateCar1 = this.selectById(orderPrivateCar.getId()); |
| | | if (orderPrivateCar1.getState() != 7) { |
| | | break; |
| | | } |
| | | GetTravelItineraryListRequest request = new GetTravelItineraryListRequest(); |
| | | request.setCustomerId(userInfo.getOnconUUID()); |
| | | request.setOrderNo("PR" + orderPrivateCar1.getId()); |
| | | request.setDriverId(driver.getEmpId().toString()); |
| | | ListPage<List<TravelItinerary>> travelItineraryList = OrderUtil.getTravelItineraryList(request); |
| | | TravelItinerary travelItinerary = travelItineraryList.getList().get(0); |
| | | if(travelItinerary.getStatus() != 7 || travelItinerary.getOrderStatus() == 11){ |
| | | GetPaymentInfoDataRequest getPaymentInfoDataRequest = new GetPaymentInfoDataRequest(); |
| | | getPaymentInfoDataRequest.setPartnerPayId(orderPrivateCar1.getTravelId()); |
| | | GetPaymentInfo getPaymentInfo = OrderUtil.paymentInfo(getPaymentInfoDataRequest); |
| | | payOrderPrivateCarCallback(orderPrivateCar1.getId(), getPaymentInfo.getPayId(), 1); |
| | | break; |
| | | } |
| | | Thread.sleep(wait); |
| | | num++; |
| | | } |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | }finally { |
| | | threadPoolExecutor.shutdown(); |
| | | } |
| | | |
| | | }); |
| | | |
| | | } |
| | | if (payType == 2) {//支付宝支付 |
| | | if (orderMoney == 0) { |
| | |
| | | } |
| | | orderPrivateCar.setAbnormalIntro(abnormalIntro); |
| | | orderPrivateCar.setAbnormalImg(abnormalImg); |
| | | orderPrivateCar.setAbnormal(1); |
| | | orderPrivateCar.setAbnormal(2); |
| | | this.baseMapper.updateById(orderPrivateCar); |
| | | |
| | | } |
| | |
| | | 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); |
| | | orderPrivateCar.setPromotionActivityId(tDriverPromotionActivity.getId()); |
| | | this.baseMapper.updateById(orderPrivateCar); |
| | | } |
| | | } |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> queryMyTripList(Integer uid, Integer pageNum, Integer size) throws Exception { |
| | | pageNum = (pageNum - 1) * size; |
| | | List<Map<String, Object>> maps = orderPrivateCarMapper.queryMyTripList(uid, pageNum, size); |
| | | for (Map<String, Object> map : maps) { |
| | | if (Integer.valueOf(String.valueOf(map.get("state"))) == 11) { |
| | | map.put("state", map.get("oldState")); |
| | | } |
| | | } |
| | | return maps; |
| | | } |
| | | |
| | | @Override |
| | | public List<Map<String, Object>> queryMyTripListAll(Integer uid) throws Exception { |
| | | |
| | | List<Map<String, Object>> maps = orderPrivateCarMapper.queryMyTripListAll(uid); |
| | | for (Map<String, Object> map : maps) { |
| | | if (Integer.valueOf(String.valueOf(map.get("state"))) == 11) { |
| | | map.put("state", map.get("oldState")); |
| | | } |
| | | } |
| | | return maps; |
| | | } |
| | | } |