NIMSDK-AOS  9.19.0
TeamMsgAckInfo.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.msg.model;
2 
3 import com.netease.nimlib.util.CollectionUtil;
4 
5 import java.util.ArrayList;
6 import java.util.List;
7 import java.util.Set;
8 
9 /**
10  * 群已读回执信息
11  * 此类有两种状态,一种是存储已读未读用户账号列表的状态,一种是存储已读未读人数的状态
12  * 第一种状态下,ackCount和unAckCount为0
13  * 第二种状态下ackAccountList和unAckAccountList都为null
14  */
15 public class TeamMsgAckInfo {
16  private String teamId;
17  private String msgId;
18  /** 新已读用户的账号 */
19  private String newReaderAccount;
20  private int ackCount;
21  private int unAckCount;
22  private List<String> ackAccountList;
23  private List<String> unAckAccountList;
24 
25  public TeamMsgAckInfo(String teamId, String msgId, int ackCount, int unAckCount) {
26  this(teamId, msgId, ackCount, unAckCount, null);
27  }
28 
29  public TeamMsgAckInfo(String teamId, String msgId, int ackCount, int unAckCount, String newReaderAccount) {
30  this.teamId = teamId;
31  this.msgId = msgId;
32  this.ackCount = ackCount;
33  this.unAckCount = unAckCount;
34  this.newReaderAccount = newReaderAccount;
35  }
36 
37  public TeamMsgAckInfo(String teamId, String msgId, List<String> ackAccountList, List<String> unAckAccountList) {
38  this.teamId = teamId;
39  this.msgId = msgId;
40  this.ackAccountList = ackAccountList;
41  this.unAckAccountList = unAckAccountList;
42  }
43 
44  public String getTeamId() {
45  return teamId;
46  }
47 
48  public String getMsgId() {
49  return msgId;
50  }
51 
52  public int getAckCount() {
53  if (ackAccountList != null) {
54  return ackAccountList.size();
55  }
56 
57  return ackCount;
58  }
59 
60  public int getUnAckCount() {
61  if (unAckAccountList != null) {
62  return unAckAccountList.size();
63  }
64 
65  return unAckCount;
66  }
67 
68  public String getNewReaderAccount() {
69  return newReaderAccount;
70  }
71 
72  public List<String> getAckAccountList() {
73  return ackAccountList;
74  }
75 
76  public List<String> getUnAckAccountList() {
77  return unAckAccountList;
78  }
79 
80  /**
81  * 生成一个新的实例,里面只包含指定用户的已读未读情况
82  * 如果当前实例中不含用户列表,直接返回null
83  *
84  * @param accountSet 指定用户的账号列表
85  * @return 新实例,如果当前实例中不含用户列表,直接返回null
86  */
87  public TeamMsgAckInfo newInstanceFromPartOfAccount(Set<String> accountSet) {
88  // 不含有用户ID列表,直接返回null
89  if (CollectionUtil.isEmpty(ackAccountList) && CollectionUtil.isEmpty(unAckAccountList)) {
90  return null;
91  }
92 
93  // 指定用户集为空,返回带空列表的示例
94  if (CollectionUtil.isEmpty(accountSet)) {
95  return new TeamMsgAckInfo(teamId, msgId, new ArrayList<>(0), new ArrayList<>(0));
96  }
97 
98  List<String> chosenAckList = CollectionUtil.findAll(this.ackAccountList, accountSet::contains);
99  List<String> chosenUnAckList = CollectionUtil.findAll(this.unAckAccountList, accountSet::contains);
100  return new TeamMsgAckInfo(teamId, msgId, chosenAckList, chosenUnAckList);
101  }
102 }
TeamMsgAckInfo newInstanceFromPartOfAccount(Set< String > accountSet)
生成一个新的实例,里面只包含指定用户的已读未读情况 如果当前实例中不含用户列表,直接返回null ...
TeamMsgAckInfo(String teamId, String msgId, int ackCount, int unAckCount, String newReaderAccount)
群已读回执信息 此类有两种状态,一种是存储已读未读用户账号列表的状态,一种是存储已读未读人数的状态 第...
TeamMsgAckInfo(String teamId, String msgId, int ackCount, int unAckCount)
TeamMsgAckInfo(String teamId, String msgId, List< String > ackAccountList, List< String > unAckAccountList)