Merge branch 'feature/REQ-2012' into 'pre'

Feature/req 2012

See merge request universal/infrastructure/backend/im-center!37
This commit is contained in:
宋远伦 2024-01-15 04:17:48 +00:00
commit 23b5e3528e
2 changed files with 10 additions and 6 deletions

View File

@ -72,7 +72,7 @@ public class PrivateMessageController {
if (CollUtil.isEmpty(accounts)) {
log.info("appKey= [{}], senderId= [{}] 用户没有注册im账号, 请检查",
appKey, param.getSenderId());
return CommonResponse.success(result);
AssertUtil.notEmpty(accounts, "发送者未注册im账号, 请检查");
}
AccountRegister account = accounts.get(0);
if (param.getSenderType() == AccountTypeEnum.USER) {

View File

@ -8,14 +8,15 @@ import cn.axzo.im.channel.netease.INotifyService;
import cn.axzo.im.channel.netease.dto.RegisterUpdateRequest;
import cn.hutool.json.JSONUtil;
import com.google.common.collect.Maps;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
/**
* 通知到IM系统
*
@ -44,8 +45,11 @@ public class NotifyChannelServiceImpl implements INotifyService {
userProfileMap.put("accountType", AccountTypeEnum.ROBOT.getCode());
List<RobotTagResp> robotTags = robotInfoResp.getRobotTagList();
if (CollectionUtils.isNotEmpty(robotTags)) {
robotTags = robotTags.stream().sorted(
Comparator.comparing(RobotTagResp::getWeight, Comparator.reverseOrder())
.thenComparing(RobotTagResp::getId, Comparator.reverseOrder()))
.collect(Collectors.toList());
robotTags.forEach(robotTagResp -> {
robotTagResp.setId(null);
robotTagResp.setUseCount(null);
robotTagResp.setWeight(null);
});