diff --git a/luoo_common/src/main/java/constants/ErrorConstants.java b/luoo_common/src/main/java/constants/ErrorConstants.java index 7b850c9..e3d0efe 100644 --- a/luoo_common/src/main/java/constants/ErrorConstants.java +++ b/luoo_common/src/main/java/constants/ErrorConstants.java @@ -55,5 +55,6 @@ public class ErrorConstants { public static final String TICKET_CITY_IS_REQUIRED = "门票抽奖城市必填"; public static final String REAL_NUMBER_IS_REQUIRED = "实物抽奖数量必填"; public static final String DRAW_TIME_IS_REQUIRED = "必须填写开奖时间"; + public static final String ALREADY_PARTICIPATED_CANNOT_PARTICIPATE_AGAIN = "您已参加,不能再次参与"; } 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 841e292..ff478fc 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 @@ -309,6 +309,10 @@ public class LotteryService { // 校验用户是否可参与 UserInfo userInfo = userInfoDao.findById(userLoginDto.getUserId()).get(); + List list = lotteryUserDao.findByLotteryIdAndUserId(id, userLoginDto.getUserId()); + if (list != null && !list.isEmpty()) { + throw new BizException(ErrorConstants.ALREADY_PARTICIPATED_CANNOT_PARTICIPATE_AGAIN); + } Integer participant = lottery.getParticipant(); if (Objects.equals(participant, PointEnums.LOTTERY_ALL_MEMBER.getCode())) {