REQ-3345: 添加限流
This commit is contained in:
parent
20197be1ef
commit
2860e1c1f7
@ -4,6 +4,7 @@ import cn.axzo.im.dao.mapper.ChatGroupMapper;
|
||||
import cn.axzo.im.dao.repository.GroupDao;
|
||||
import cn.axzo.im.entity.ChatGroup;
|
||||
import cn.axzo.im.entity.Group;
|
||||
import com.google.common.collect.Sets;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
@ -27,7 +28,13 @@ public class LegacyGroupSupport {
|
||||
private final GroupDao groupDao;
|
||||
private final ChatGroupMapper chatGroupMapper;
|
||||
|
||||
public List<String> getGroupAccounts(Set<String> groupIds) {
|
||||
public Set<String> getMergedAccounts(Set<String> groupIds) {
|
||||
Set<String> accounts = Sets.newHashSet(getGroupAccounts(groupIds));
|
||||
accounts.addAll(getGroupCatAccounts(groupIds));
|
||||
return accounts;
|
||||
}
|
||||
|
||||
private List<String> getGroupAccounts(Set<String> groupIds) {
|
||||
if (CollectionUtils.isEmpty(groupIds))
|
||||
return Collections.emptyList();
|
||||
if (parseLongs(groupIds).isEmpty())
|
||||
@ -40,7 +47,7 @@ public class LegacyGroupSupport {
|
||||
.collect(toList());
|
||||
}
|
||||
|
||||
public List<String> getGroupCatAccounts(Set<String> groupIds) {
|
||||
private List<String> getGroupCatAccounts(Set<String> groupIds) {
|
||||
if (CollectionUtils.isEmpty(groupIds))
|
||||
return Collections.emptyList();
|
||||
return chatGroupMapper.selectList(
|
||||
|
||||
@ -48,7 +48,6 @@ import org.springframework.util.CollectionUtils;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@ -413,10 +412,7 @@ public class MessageTaskServiceImpl extends ServiceImpl<MessageTaskMapper, Messa
|
||||
.map(MessageTask.ReceivePerson::getImAccount)
|
||||
.filter(StringUtils::isNotBlank)
|
||||
.collect(toSet());
|
||||
HashSet<String> result = new HashSet<>();
|
||||
result.addAll(legacyGroupSupport.getGroupAccounts(imAccounts));
|
||||
result.addAll(legacyGroupSupport.getGroupCatAccounts(imAccounts));
|
||||
return result;
|
||||
return legacyGroupSupport.getMergedAccounts(imAccounts);
|
||||
}
|
||||
|
||||
private String resolveBody(MessageTask.ReceivePerson receivePerson,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user