diff --git a/src/main/java/com/gitlink/softbot/service/user/impl/UserService.java b/src/main/java/com/gitlink/softbot/service/user/impl/UserService.java index 3986346..2d1020a 100644 --- a/src/main/java/com/gitlink/softbot/service/user/impl/UserService.java +++ b/src/main/java/com/gitlink/softbot/service/user/impl/UserService.java @@ -831,31 +831,31 @@ public class UserService extends AbstractUserBot implements IUserService { @Override public GetAllInstallBotsResponse getAllInstallBots(Integer userId) { - List installBots = installMapper.selectList(Wrappers.lambdaQuery() - .eq(InstallBot::getInstallerId,userId)); - List installBotInfos = new ArrayList<>(); - installBots.forEach(installBot -> { - Integer botId = installBot.getBotId(); - Bot bot = botMapper.selectOne(Wrappers.lambdaQuery() - .eq(Bot::getId,botId)); - InstallBotInfo installBotInfo = new InstallBotInfo(); - List botLimitEvents = botLimitMapper.selectList(Wrappers. - lambdaQuery().eq(BotLimitEvent::getBotId,botId)); - LimitVO limitVO = getLimitFromLimitEvents(botLimitEvents); - installBotInfo.setLimitVO(limitVO); - BeanUtils.copyProperties(bot,installBotInfo); - BeanUtils.copyProperties(installBot,installBotInfo); - installBotInfos.add(installBotInfo); - }); + List installBots = installMapper.selectList(Wrappers.lambdaQuery() + .eq(InstallBot::getInstallerId,userId)); + List installBotInfos = new ArrayList<>(); + installBots.forEach(installBot -> { + Integer botId = installBot.getBotId(); + Bot bot = botMapper.selectOne(Wrappers.lambdaQuery() + .eq(Bot::getId,botId)); + InstallBotInfo installBotInfo = new InstallBotInfo(); + List botLimitEvents = botLimitMapper.selectList(Wrappers. + 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 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; }