|
|
|
@ -580,14 +580,6 @@ public class LotteryService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public PageResult<LotteryUserAPPVO> findPageByLotteryId(Integer page, Integer size, String lotteryId) {
|
|
|
|
|
// Sort sort = new Sort(Direction.DESC, "createTime");
|
|
|
|
|
// PageRequest pageRequest = PageRequest.of(page - 1, size, sort);
|
|
|
|
|
//
|
|
|
|
|
// Specification<LotteryUser> specification = getLotteryUserSpecification(lotteryId);
|
|
|
|
|
// Page<LotteryUser> lotteryUserPage = lotteryUserDao.findAll(specification, pageRequest);
|
|
|
|
|
//
|
|
|
|
|
// long totalElements = lotteryUserPage.getTotalElements();
|
|
|
|
|
// return new PageResult<>(totalElements, lotteryUserPage.getContent());
|
|
|
|
|
|
|
|
|
|
QLotteryUser qLotteryUser = QLotteryUser.lotteryUser;
|
|
|
|
|
QUserInfo qUserInfo = QUserInfo.userInfo;
|
|
|
|
@ -644,11 +636,44 @@ public class LotteryService {
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Integer getLotteryUserResult(String lotteryId, String token) {
|
|
|
|
|
public LotteryUserAPPVO getLotteryUserResult(String lotteryId, String token) {
|
|
|
|
|
QLotteryUser qLotteryUser = QLotteryUser.lotteryUser;
|
|
|
|
|
QUserInfo qUserInfo = QUserInfo.userInfo;
|
|
|
|
|
QRegion qRegion = QRegion.region;
|
|
|
|
|
|
|
|
|
|
UserLoginDto userLoginDto = jwtUtil.getUserLoginDto(token);
|
|
|
|
|
LotteryUser lotteryUser = lotteryUserDao.findByLotteryIdAndUserId(lotteryId, userLoginDto.getUserId());
|
|
|
|
|
|
|
|
|
|
return lotteryUser.getResult();
|
|
|
|
|
BooleanBuilder booleanBuilder = new BooleanBuilder();
|
|
|
|
|
booleanBuilder.and(qLotteryUser.lotteryId.eq(lotteryId));
|
|
|
|
|
booleanBuilder.and(qLotteryUser.userId.eq(userLoginDto.getUserId()));
|
|
|
|
|
|
|
|
|
|
// 头像字段拼接字符串
|
|
|
|
|
StringExpression avatarWithPrefix = Expressions.stringTemplate("{0} || {1}", Constants.RESOURCE_PREFIX, qUserInfo.avatar);
|
|
|
|
|
|
|
|
|
|
return jpaQueryFactory
|
|
|
|
|
.select(Projections.bean(LotteryUserAPPVO.class,
|
|
|
|
|
qLotteryUser.id.as("id"),
|
|
|
|
|
qLotteryUser.lotteryId.as("lotteryId"),
|
|
|
|
|
qLotteryUser.userId.as("userId"),
|
|
|
|
|
qLotteryUser.regionId.as("regionId"),
|
|
|
|
|
qLotteryUser.result.as("result"),
|
|
|
|
|
qLotteryUser.createTime.as("createTime"),
|
|
|
|
|
qLotteryUser.updateTime.as("updateTime"),
|
|
|
|
|
qLotteryUser.createUser.as("createUser"),
|
|
|
|
|
qLotteryUser.updateUser.as("updateUser"),
|
|
|
|
|
qUserInfo.nickName.as("nickName"),
|
|
|
|
|
avatarWithPrefix.as("avatar"),
|
|
|
|
|
qLotteryUser.popup.as("popup"),
|
|
|
|
|
qRegion.name.as("regionName"),
|
|
|
|
|
qRegion.code.as("regionCode")
|
|
|
|
|
))
|
|
|
|
|
.from(qLotteryUser)
|
|
|
|
|
.leftJoin(qUserInfo)
|
|
|
|
|
.on(qLotteryUser.userId.eq(qUserInfo.id))
|
|
|
|
|
.leftJoin(qRegion)
|
|
|
|
|
.on(qLotteryUser.regionId.eq(qRegion.id))
|
|
|
|
|
.where(booleanBuilder)
|
|
|
|
|
.fetchOne();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -782,6 +807,13 @@ public class LotteryService {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
|
|
public void popup(String lotteryUserId) {
|
|
|
|
|
LotteryUser one = lotteryUserDao.getOne(lotteryUserId);
|
|
|
|
|
one.setPopup(PointEnums.ALREADY_POPUP.getCode());
|
|
|
|
|
lotteryUserDao.save(one);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void checkLotteryUserCondition(BooleanBuilder booleanBuilder, QLotteryUser qLotteryUser, String lotteryId, Integer userType) {
|
|
|
|
|
booleanBuilder.and(qLotteryUser.lotteryId.eq(lotteryId));
|
|
|
|
|
if (Objects.nonNull(userType)) {
|
|
|
|
|