diff --git a/luoo_user/src/main/java/com/luoo/user/service/LotteryService.java b/luoo_user/src/main/java/com/luoo/user/service/LotteryService.java index 180bd5d..dbe2f65 100644 --- a/luoo_user/src/main/java/com/luoo/user/service/LotteryService.java +++ b/luoo_user/src/main/java/com/luoo/user/service/LotteryService.java @@ -355,7 +355,7 @@ public class LotteryService { // 已参与抽奖,不能再次参与 LotteryUser byLotteryIdAndUserId = lotteryUserDao.findByLotteryIdAndUserId(id, userLoginDto.getUserId()); - if(byLotteryIdAndUserId != null) { + if (byLotteryIdAndUserId != null) { throw new BizException(ErrorConstants.ALREADY_PARTICIPATED); } @@ -469,6 +469,7 @@ public class LotteryService { BooleanBuilder booleanBuilder = new BooleanBuilder(); QLottery qLottery = QLottery.lottery; checkCondition(booleanBuilder, qLottery, lotterySearchDto); + booleanBuilder.and(qLottery.status.in(new Integer[]{PointEnums.LOTTERY_STATUS_LOTTERY.getCode(), PointEnums.LOTTERY_STATUS_SIGN.getCode()})); // 创建分页对象 Pageable pageable = PageRequest.of(page - 1, size); List list = jpaQueryFactory.select(Projections.constructor(LotteryAPPVO.class, @@ -494,7 +495,7 @@ public class LotteryService { qLottery.publishTime )).from(qLottery) .where(booleanBuilder) - .orderBy(qLottery.publishTime.desc()) + .orderBy(qLottery.status.asc(), qLottery.publishTime.desc()) .offset(pageable.getOffset()) .limit(pageable.getPageSize()) .fetch();