This commit is contained in:
parent
d188e68262
commit
810671c898
|
|
@ -831,31 +831,31 @@ public class UserService extends AbstractUserBot implements IUserService {
|
|||
@Override
|
||||
public GetAllInstallBotsResponse getAllInstallBots(Integer userId) {
|
||||
|
||||
List<InstallBot> installBots = installMapper.selectList(Wrappers.<InstallBot>lambdaQuery()
|
||||
.eq(InstallBot::getInstallerId,userId));
|
||||
List<InstallBotInfo> installBotInfos = new ArrayList<>();
|
||||
installBots.forEach(installBot -> {
|
||||
Integer botId = installBot.getBotId();
|
||||
Bot bot = botMapper.selectOne(Wrappers.<Bot>lambdaQuery()
|
||||
.eq(Bot::getId,botId));
|
||||
InstallBotInfo installBotInfo = new InstallBotInfo();
|
||||
List<BotLimitEvent> botLimitEvents = botLimitMapper.selectList(Wrappers.<BotLimitEvent>
|
||||
lambdaQuery().eq(BotLimitEvent::getBotId,botId));
|
||||
LimitVO limitVO = getLimitFromLimitEvents(botLimitEvents);
|
||||
installBotInfo.setLimitVO(limitVO);
|
||||
BeanUtils.copyProperties(bot,installBotInfo);
|
||||
BeanUtils.copyProperties(installBot,installBotInfo);
|
||||
installBotInfos.add(installBotInfo);
|
||||
});
|
||||
List<InstallBot> installBots = installMapper.selectList(Wrappers.<InstallBot>lambdaQuery()
|
||||
.eq(InstallBot::getInstallerId,userId));
|
||||
List<InstallBotInfo> installBotInfos = new ArrayList<>();
|
||||
installBots.forEach(installBot -> {
|
||||
Integer botId = installBot.getBotId();
|
||||
Bot bot = botMapper.selectOne(Wrappers.<Bot>lambdaQuery()
|
||||
.eq(Bot::getId,botId));
|
||||
InstallBotInfo installBotInfo = new InstallBotInfo();
|
||||
List<BotLimitEvent> botLimitEvents = botLimitMapper.selectList(Wrappers.<BotLimitEvent>
|
||||
lambdaQuery().eq(BotLimitEvent::getBotId,botId));
|
||||
LimitVO limitVO = getLimitFromLimitEvents(botLimitEvents);
|
||||
installBotInfo.setLimitVO(limitVO);
|
||||
BeanUtils.copyProperties(bot,installBotInfo);
|
||||
BeanUtils.copyProperties(installBot,installBotInfo);
|
||||
installBotInfos.add(installBotInfo);
|
||||
});
|
||||
|
||||
installBotInfos.stream().collect(Collectors.collectingAndThen(
|
||||
Collectors.toCollection(()->new TreeSet<>(Comparator.comparing(
|
||||
InstallBotInfo::getBotId
|
||||
))),ArrayList::new
|
||||
));
|
||||
GetAllInstallBotsResponse getAllInstallBotsResponse = new GetAllInstallBotsResponse();
|
||||
getAllInstallBotsResponse.setUserId(userId);
|
||||
getAllInstallBotsResponse.setInstallBots(installBotInfos);
|
||||
List<InstallBotInfo> installBotInfoList = installBotInfos.stream().collect(Collectors.collectingAndThen(
|
||||
Collectors.toCollection(()->new TreeSet<>(Comparator.comparing(
|
||||
InstallBotInfo::getBotId
|
||||
))),ArrayList::new
|
||||
));
|
||||
GetAllInstallBotsResponse getAllInstallBotsResponse = new GetAllInstallBotsResponse();
|
||||
getAllInstallBotsResponse.setUserId(userId);
|
||||
getAllInstallBotsResponse.setInstallBots(installBotInfoList);
|
||||
return getAllInstallBotsResponse;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue