feat(sj_1.0.0): 1、修复用户查询失败问题 2、修复通知人为空问题

This commit is contained in:
opensnail 2024-05-05 10:10:57 +08:00
parent 97237ac538
commit 05c9c06bd0
3 changed files with 14 additions and 4 deletions

View File

@ -16,7 +16,6 @@ import com.aizuda.snailjob.server.common.enums.SyetemTaskTypeEnum;
import com.aizuda.snailjob.server.common.triple.ImmutableTriple;
import com.aizuda.snailjob.server.common.triple.Triple;
import com.aizuda.snailjob.template.datasource.access.AccessTemplate;
import com.aizuda.snailjob.server.common.triple.Triple;
import com.aizuda.snailjob.template.datasource.persistence.mapper.NotifyRecipientMapper;
import com.aizuda.snailjob.template.datasource.persistence.po.NotifyConfig;
import com.aizuda.snailjob.template.datasource.persistence.po.NotifyRecipient;
@ -31,7 +30,6 @@ import org.springframework.context.ApplicationEvent;
import org.springframework.context.ApplicationListener;
import org.springframework.util.CollectionUtils;
import java.text.MessageFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
import java.util.stream.Collectors;
@ -123,6 +121,10 @@ public abstract class AbstractAlarm<E extends ApplicationEvent, A extends AlarmI
Map<Long, NotifyRecipient> recipientMap = notifyRecipients.stream()
.collect(Collectors.toMap(NotifyRecipient::getId, i->i));
if (CollectionUtils.isEmpty(recipientIds)) {
return Maps.newHashMap();
}
List<NotifyConfigInfo> notifyConfigInfos = AlarmInfoConverter.INSTANCE.retryToNotifyConfigInfos(notifyConfigs);
return notifyConfigInfos.stream()

View File

@ -27,6 +27,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import lombok.RequiredArgsConstructor;
import org.jetbrains.annotations.NotNull;
@ -145,6 +146,10 @@ public class NotifyConfigServiceImpl implements NotifyConfigService {
set.addAll(b);
return set;
}).orElse(new HashSet<>());
if (CollectionUtils.isEmpty(recipientIds)) {
return Maps.newHashMap();
}
List<NotifyRecipient> notifyRecipients = notifyRecipientMapper.selectBatchIds(recipientIds);
return notifyRecipients.stream()
.collect(Collectors.toMap(NotifyRecipient::getId, NotifyRecipient::getRecipientName));

View File

@ -215,10 +215,13 @@ public class SystemUserServiceImpl implements SystemUserService {
.map(SystemUserPermission::getNamespaceId)
.collect(Collectors.toSet());
// TODO: uniqueIds可能为空
List<Namespace> namespaces = namespaceMapper.selectList(Wrappers.<Namespace>lambdaQuery()
List<Namespace> namespaces = Lists.newArrayList();
if (!CollectionUtils.isEmpty(uniqueIds)) {
namespaces = namespaceMapper.selectList(Wrappers.<Namespace>lambdaQuery()
.select(Namespace::getId, Namespace::getUniqueId, Namespace::getName)
.in(Namespace::getUniqueId, uniqueIds));
}
Map<String, String> namespaceMap = namespaces.stream().collect(Collectors.toMap(Namespace::getUniqueId, Namespace::getName));
Map<Long, List<SystemUserPermission>> userPermissionsMap = userPermissions.stream()