|
|
@ -1,6 +1,7 @@
|
|
|
|
package com.luoo.user.service;
|
|
|
|
package com.luoo.user.service;
|
|
|
|
|
|
|
|
|
|
|
|
import api.PageResult;
|
|
|
|
import api.PageResult;
|
|
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
import com.luoo.user.Scheduler.DrawLotteryScheduler;
|
|
|
|
import com.luoo.user.Scheduler.DrawLotteryScheduler;
|
|
|
|
import com.luoo.user.config.EnvConfig;
|
|
|
|
import com.luoo.user.config.EnvConfig;
|
|
|
@ -13,6 +14,7 @@ import com.luoo.user.dto.point.LotteryParticipatedSearchDto;
|
|
|
|
import com.luoo.user.dto.point.LotterySearchDto;
|
|
|
|
import com.luoo.user.dto.point.LotterySearchDto;
|
|
|
|
import com.luoo.user.pojo.*;
|
|
|
|
import com.luoo.user.pojo.*;
|
|
|
|
import com.luoo.user.vo.point.*;
|
|
|
|
import com.luoo.user.vo.point.*;
|
|
|
|
|
|
|
|
import com.luoo.user.vo.userinfo.UserinfoShippingAddressAppVO;
|
|
|
|
import com.querydsl.core.BooleanBuilder;
|
|
|
|
import com.querydsl.core.BooleanBuilder;
|
|
|
|
import com.querydsl.core.types.Projections;
|
|
|
|
import com.querydsl.core.types.Projections;
|
|
|
|
import com.querydsl.core.types.dsl.Expressions;
|
|
|
|
import com.querydsl.core.types.dsl.Expressions;
|
|
|
@ -89,7 +91,9 @@ public class LotteryService {
|
|
|
|
|
|
|
|
|
|
|
|
private final EnvConfig envConfig;
|
|
|
|
private final EnvConfig envConfig;
|
|
|
|
|
|
|
|
|
|
|
|
public LotteryService(LotteryDao lotteryDao, JwtUtil jwtUtil, IdWorker idWorker, RedisLockUtil redisLockUtil, RegionService regionService, LotteryRegionDao lotteryRegionDao, UserInfoDao userInfoDao, RabbitTemplate rabbitTemplate, LotteryUserDao lotteryUserDao, DrawLotteryScheduler drawLotteryScheduler, JPAQueryFactory jpaQueryFactory, EnvConfig envConfig) {
|
|
|
|
private final UserinfoShippingAddressService userinfoShippingAddressService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public LotteryService(LotteryDao lotteryDao, JwtUtil jwtUtil, IdWorker idWorker, RedisLockUtil redisLockUtil, RegionService regionService, LotteryRegionDao lotteryRegionDao, UserInfoDao userInfoDao, RabbitTemplate rabbitTemplate, LotteryUserDao lotteryUserDao, DrawLotteryScheduler drawLotteryScheduler, JPAQueryFactory jpaQueryFactory, EnvConfig envConfig, UserinfoShippingAddressService userinfoShippingAddressService) {
|
|
|
|
this.lotteryDao = lotteryDao;
|
|
|
|
this.lotteryDao = lotteryDao;
|
|
|
|
this.jwtUtil = jwtUtil;
|
|
|
|
this.jwtUtil = jwtUtil;
|
|
|
|
this.idWorker = idWorker;
|
|
|
|
this.idWorker = idWorker;
|
|
|
@ -102,6 +106,7 @@ public class LotteryService {
|
|
|
|
this.drawLotteryScheduler = drawLotteryScheduler;
|
|
|
|
this.drawLotteryScheduler = drawLotteryScheduler;
|
|
|
|
this.jpaQueryFactory = jpaQueryFactory;
|
|
|
|
this.jpaQueryFactory = jpaQueryFactory;
|
|
|
|
this.envConfig = envConfig;
|
|
|
|
this.envConfig = envConfig;
|
|
|
|
|
|
|
|
this.userinfoShippingAddressService = userinfoShippingAddressService;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -374,6 +379,13 @@ public class LotteryService {
|
|
|
|
lottery.getApplyEndTime().isBefore(LocalDateTime.now())) {
|
|
|
|
lottery.getApplyEndTime().isBefore(LocalDateTime.now())) {
|
|
|
|
throw new BizException(ErrorConstants.NOT_IN_THE_SIGN_UP_TIME);
|
|
|
|
throw new BizException(ErrorConstants.NOT_IN_THE_SIGN_UP_TIME);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ObjectUtil.equals(PointEnums.LOTTERY_REAL.getCode(), lottery.getType())) {
|
|
|
|
|
|
|
|
// 实物抽奖报名必须要已填写抽奖地址
|
|
|
|
|
|
|
|
List<UserinfoShippingAddressAppVO> userinfoShippingAddressList = userinfoShippingAddressService.getUserinfoShippingAddressList();
|
|
|
|
|
|
|
|
if (userinfoShippingAddressList.isEmpty()) {
|
|
|
|
|
|
|
|
throw new BizException(ErrorConstants.SHIPPING_ADDRESS_IS_REQUIRED);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
// 校验用户是否可参与
|
|
|
|
// 校验用户是否可参与
|
|
|
|
UserInfo userInfo = userInfoDao.findById(userLoginDto.getUserId()).get();
|
|
|
|
UserInfo userInfo = userInfoDao.findById(userLoginDto.getUserId()).get();
|
|
|
|
|
|
|
|
|
|
|
|