|
@@ -519,6 +519,9 @@ public class ImGroupCoreServiceImpl implements ImGroupCoreService {
|
|
|
// 自动激活用户
|
|
|
asyncRegisterUser(groupMembers);
|
|
|
}
|
|
|
+
|
|
|
+ // 刷新群成员禁言状态
|
|
|
+ flushGroupMute(imGroup.getId());
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -569,6 +572,44 @@ public class ImGroupCoreServiceImpl implements ImGroupCoreService {
|
|
|
// 自动激活用户
|
|
|
asyncRegisterUser(groupMembers);
|
|
|
|
|
|
+ // 刷新群成员禁言状态
|
|
|
+ flushGroupMute(imGroup.getId());
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void flushGroupMute(String groupId) {
|
|
|
+ try {
|
|
|
+ List<GroupMemberWrapper.Member> members = imPluginContext.getPluginService().groupUserGagList(groupId);
|
|
|
+
|
|
|
+ List<ImGroupMember> list = imGroupMemberService.lambdaQuery()
|
|
|
+ .eq(ImGroupMember::getGroupId, groupId)
|
|
|
+ .list();
|
|
|
+ if (CollectionUtils.isEmpty(members)) {
|
|
|
+ // 设置为全体非禁言状态
|
|
|
+ for (ImGroupMember item : list) {
|
|
|
+ item.setGroupMute(false);
|
|
|
+ }
|
|
|
+
|
|
|
+ return;
|
|
|
+ } else {
|
|
|
+ List<Long> userIds = members.stream().map(o -> analysisImUserId(o.getId())).map(Long::valueOf).collect(Collectors.toList());
|
|
|
+ list = list.stream().map(o -> {
|
|
|
+ if (userIds.contains(o.getUserId())) {
|
|
|
+ o.setGroupMute(true);
|
|
|
+ } else {
|
|
|
+ o.setGroupMute(false);
|
|
|
+ }
|
|
|
+ return o;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (CollectionUtils.isNotEmpty(list)) {
|
|
|
+ imGroupMemberService.updateBatchById(list);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("flushGroupMute error",e);
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
/**
|