shangke 2 年之前
父节点
当前提交
df54329863

+ 23 - 20
mec-biz/src/main/java/com/ym/mec/biz/service/impl/ImLiveBroadcastRoomMemberServiceImpl.java

@@ -23,7 +23,6 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.MapUtils;
 import org.apache.commons.lang3.RandomStringUtils;
-import org.apache.commons.lang3.RandomUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -114,25 +113,29 @@ public class ImLiveBroadcastRoomMemberServiceImpl extends ServiceImpl<ImLiveBroa
             // 学生声部名称
             Map<Integer, String> subjectMap = Maps.newConcurrentMap();
 
-            for (List<Integer> item : Lists.partition(studentIds, 500)) {
-                // 并发查询学生信息
-                Lists.partition(item, 50).parallelStream().forEach(data -> {
-
-                    // 学生报名乐团
-                    Map<Integer, String> musicMap = baseMapper.selectStudentMusicGroup(data).stream()
-                            .collect(Collectors.toMap(ImLiveBroadcastRoomMemberVo::getStudentId, ImLiveBroadcastRoomMemberVo::getMusicGroupName, (o, n) -> n));
-
-                    if (MapUtils.isNotEmpty(musicMap)) {
-                        musicGroupMap.putAll(musicMap);
-                    }
-
-                    // 学生声部名称
-                    Map<Integer, String> collect = baseMapper.selectStudentSubject(studentIds).stream()
-                            .collect(Collectors.toMap(ImLiveBroadcastRoomMemberVo::getStudentId, ImLiveBroadcastRoomMemberVo::getSubName, (o, n) -> n));
-                    if (MapUtils.isNotEmpty(collect)) {
-                        subjectMap.putAll(collect);
-                    }
-                });
+            // 直播客户端查询在线用户信息时,忽略学生相关信息查询
+            if (MapUtils.getIntValue(param, "rows", 10) < 100) {
+
+                for (List<Integer> item : Lists.partition(studentIds, 500)) {
+                    // 并发查询学生信息
+                    Lists.partition(item, 50).parallelStream().forEach(data -> {
+
+                        // 学生报名乐团
+                        Map<Integer, String> musicMap = baseMapper.selectStudentMusicGroup(data).stream()
+                                .collect(Collectors.toMap(ImLiveBroadcastRoomMemberVo::getStudentId, ImLiveBroadcastRoomMemberVo::getMusicGroupName, (o, n) -> n));
+
+                        if (MapUtils.isNotEmpty(musicMap)) {
+                            musicGroupMap.putAll(musicMap);
+                        }
+
+                        // 学生声部名称
+                        Map<Integer, String> collect = baseMapper.selectStudentSubject(studentIds).stream()
+                                .collect(Collectors.toMap(ImLiveBroadcastRoomMemberVo::getStudentId, ImLiveBroadcastRoomMemberVo::getSubName, (o, n) -> n));
+                        if (MapUtils.isNotEmpty(collect)) {
+                            subjectMap.putAll(collect);
+                        }
+                    });
+                }
             }
 
             for (ImLiveBroadcastRoomMemberVo item : records) {