Commit b9f7367a by 罗长华

对/conversation/getList返回值进行排序置顶优先

parent 69b8ddd6
...@@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j; ...@@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
...@@ -995,6 +996,17 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap ...@@ -995,6 +996,17 @@ public class ImConversationServiceImpl extends BaseServiceImpl<ImConversationMap
ImClient currentClient = contextService.getImClientIfNotNullOrThrow(); ImClient currentClient = contextService.getImClientIfNotNullOrThrow();
// 查询用户加入的所有会话 与每个会话的未读条数 成员 // 查询用户加入的所有会话 与每个会话的未读条数 成员
List<ConversationVo> myImConversationListAndMsgCount = imConversationMapper.getMyImConversationListAndMsgCount(currentClient.getId(), currentClient.getClientId(), null); List<ConversationVo> myImConversationListAndMsgCount = imConversationMapper.getMyImConversationListAndMsgCount(currentClient.getId(), currentClient.getClientId(), null);
if (myImConversationListAndMsgCount.isEmpty()) {
return Collections.emptyList();
}
// 根据top进行排序
List<ConversationVo> topList = myImConversationListAndMsgCount.stream().filter(ConversationVo::getTop).collect(Collectors.toList());
List<ConversationVo> normalList =
myImConversationListAndMsgCount.stream().filter(vo -> !vo.getTop()).collect(Collectors.toList());
myImConversationListAndMsgCount = new ArrayList<>(topList);
myImConversationListAndMsgCount.addAll(normalList);
// 返回的 // 返回的
List<ConversationVo> myImConversationListAndMsgCountNew = new ArrayList<>(); List<ConversationVo> myImConversationListAndMsgCountNew = new ArrayList<>();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment