release: 校验用户是否已参与

release-2024-08-08
huangyw 4 months ago
parent 043f94071d
commit 24467b787f

@ -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 = "您已参加,不能再次参与";
}

@ -309,6 +309,10 @@ public class LotteryService {
// 校验用户是否可参与
UserInfo userInfo = userInfoDao.findById(userLoginDto.getUserId()).get();
List<LotteryUser> 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())) {

Loading…
Cancel
Save