|
@ -2,6 +2,7 @@ package com.lottery.api.service.Impl; |
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils; |
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
|
|
import com.lottery.admin.controller.AdminPrizeController; |
|
|
import com.lottery.admin.controller.AdminPrizeController; |
|
|
import com.lottery.admin.mapper.AdminPrizeMapper; |
|
|
import com.lottery.admin.mapper.AdminPrizeMapper; |
|
@ -186,12 +187,12 @@ public class UserDetailServiceImpl extends ServiceImpl<IUserDetailMapper, UserDe |
|
|
List<User> allAvailableUsers = getAllAvailableUsers(startLotteryDto.getGradeId()); |
|
|
List<User> allAvailableUsers = getAllAvailableUsers(startLotteryDto.getGradeId()); |
|
|
|
|
|
|
|
|
// 再次确保不包含任何内定用户 |
|
|
// 再次确保不包含任何内定用户 |
|
|
allAvailableUsers = allAvailableUsers.stream() |
|
|
|
|
|
.filter(user -> { |
|
|
|
|
|
UserDetail detail = userDetailMapper.selectById(user.getId()); |
|
|
|
|
|
return detail == null || detail.getIsFixed() != 1; |
|
|
|
|
|
}) |
|
|
|
|
|
.collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
// allAvailableUsers = allAvailableUsers.stream() |
|
|
|
|
|
// .filter(user -> { |
|
|
|
|
|
// UserDetail detail = userDetailMapper.selectById(user.getId()); |
|
|
|
|
|
// return detail == null || detail.getIsFixed() != 1; |
|
|
|
|
|
// }) |
|
|
|
|
|
// .collect(Collectors.toList()); |
|
|
|
|
|
|
|
|
List<User> supplementWinners = randomSelectUsers( |
|
|
List<User> supplementWinners = randomSelectUsers( |
|
|
allAvailableUsers, |
|
|
allAvailableUsers, |
|
@ -237,6 +238,23 @@ public class UserDetailServiceImpl extends ServiceImpl<IUserDetailMapper, UserDe |
|
|
return availableUsers; |
|
|
return availableUsers; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// private List<User> getAvailableFixedUsers(List<UserDetail> fixedUsers) { |
|
|
|
|
|
// if (CollectionUtils.isEmpty(fixedUsers)) { |
|
|
|
|
|
// return Collections.emptyList(); |
|
|
|
|
|
// } |
|
|
|
|
|
// |
|
|
|
|
|
// List<Long> userIds = fixedUsers.stream() |
|
|
|
|
|
// .map(UserDetail::getUserId) |
|
|
|
|
|
// .collect(Collectors.toList()); |
|
|
|
|
|
// |
|
|
|
|
|
// LambdaQueryWrapper<User> wrapper = new LambdaQueryWrapper<>() |
|
|
|
|
|
// .in(User::getId, userIds) |
|
|
|
|
|
// .eq(User::getIsDel, 0) |
|
|
|
|
|
// .eq(User::getIsWin, 0); |
|
|
|
|
|
// |
|
|
|
|
|
// return userMapper.selectList(wrapper); |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
// 获取所有其他等奖的内定用户(排除当前等级) |
|
|
// 获取所有其他等奖的内定用户(排除当前等级) |
|
|
private List<User> getOtherGradeFixedUsers(Long excludeGradeId) { |
|
|
private List<User> getOtherGradeFixedUsers(Long excludeGradeId) { |
|
|
LambdaQueryWrapper<UserDetail> wrapper = new LambdaQueryWrapper<>(); |
|
|
LambdaQueryWrapper<UserDetail> wrapper = new LambdaQueryWrapper<>(); |
|
|