浏览代码

管乐迷曲目来源内容平台

zouxuan 1 年之前
父节点
当前提交
85cb4e077c
共有 1 个文件被更改,包括 10 次插入7 次删除
  1. 10 7
      mec-im/src/main/java/com/ym/service/Impl/RoomServiceImpl.java

+ 10 - 7
mec-im/src/main/java/com/ym/service/Impl/RoomServiceImpl.java

@@ -599,7 +599,7 @@ public class RoomServiceImpl implements RoomService {
             }
         }
         //已下载的伴奏列表
-        this.initCourseScheduleStudentMusicScore(scheduleStudentMusicScores);
+        scheduleStudentMusicScores = this.initCourseScheduleStudentMusicScore(scheduleStudentMusicScores);
         if (CollectionUtils.isNotEmpty(scheduleStudentMusicScores)) {
             List<CourseScheduleStudentMusicScore> musicScores = scheduleStudentMusicScores.stream()
                     .filter(e -> e.getUserId().equals(sysUser.getId())).collect(Collectors.toList());
@@ -642,7 +642,7 @@ public class RoomServiceImpl implements RoomService {
             Set<String> userIds = roomMemberList.stream().map(RoomMember::getUid).collect(Collectors.toSet());
             Map<Integer, String> midiMap = MapUtil.convertMybatisMap(courseScheduleStudentPaymentDao.queryMidiByUserIdsAndCourseId(userIds, courseId.toString()));
             Map<Integer, String> examSongMap = MapUtil.convertMybatisMap(courseScheduleStudentPaymentDao.queryExamSongByUserIdsAndCourseId(userIds, courseId.toString()));
-            this.initCourseScheduleStudentMusicScore(scheduleStudentMusicScores);
+            scheduleStudentMusicScores = this.initCourseScheduleStudentMusicScore(scheduleStudentMusicScores);
             roomResult.setMembers(roomMemberList, midiMap, examSongMap, scheduleStudentMusicScores);
         }
         roomResult.setWhiteboards(whiteboardDao.findByRid(roomId));
@@ -665,11 +665,13 @@ public class RoomServiceImpl implements RoomService {
         businessLogger.info("join room: roomId = {}, userId = {}, userName={}, role = {}", roomId, userId, userName, roleEnum);
     }
 
-    private void initCourseScheduleStudentMusicScore(List<CourseScheduleStudentMusicScore> scheduleStudentMusicScores) {
+    private List<CourseScheduleStudentMusicScore> initCourseScheduleStudentMusicScore(List<CourseScheduleStudentMusicScore> scheduleStudentMusicScores) {
+        List<CourseScheduleStudentMusicScore> result = new ArrayList<>();
         if(CollectionUtils.isEmpty(scheduleStudentMusicScores)){
-            return;
+            return result;
         }
-        List<Long> musicSheetSoundIds = scheduleStudentMusicScores.stream().map(e->Long.parseLong(e.getMusicScoreAccompanimentId())).distinct().collect(Collectors.toList());
+        List<Long> musicSheetSoundIds = scheduleStudentMusicScores.stream().map(e->Long.parseLong(e.getMusicScoreAccompanimentId()))
+                .distinct().collect(Collectors.toList());
         List<CbsMusicSheetWrapper.MusicSheetAccApplication> sheetApplications = this.getSheetApplications(musicSheetSoundIds);
         Map<Long, CbsMusicSheetWrapper.MusicSheetAccApplication> sheetApplicationMap = sheetApplications.stream()
                 .collect(Collectors.toMap(CbsMusicSheetWrapper.MusicSheetAccApplication::getMusicSheetSoundId, Function.identity()));
@@ -683,8 +685,9 @@ public class RoomServiceImpl implements RoomService {
             //管乐迷的历史问题,原音和伴奏反过来
             studentMusicScore.setMp3Url(sheetApplication.getUrl());
             studentMusicScore.setUrl(sheetApplication.getMp3Url());
-            courseScheduleStudentMusicScoreDao.update(studentMusicScore);
+            result.add(studentMusicScore);
         }
+        return result;
     }
 
     private void joinImGroup(String roomId, Integer actualTeacherId, CourseSchedule courseSchedule) throws Exception {
@@ -2238,7 +2241,7 @@ public class RoomServiceImpl implements RoomService {
             Set<String> userIds = roomMemberList.stream().map(RoomMember::getUid).collect(Collectors.toSet());
             Map<Integer, String> midiMap = MapUtil.convertMybatisMap(courseScheduleStudentPaymentDao.queryMidiByUserIdsAndCourseId(userIds, roomId.substring(1)));
             Map<Integer, String> examSongMap = MapUtil.convertMybatisMap(courseScheduleStudentPaymentDao.queryExamSongByUserIdsAndCourseId(userIds, roomId.substring(1)));
-            this.initCourseScheduleStudentMusicScore(scheduleStudentMusicScores);
+            scheduleStudentMusicScores = this.initCourseScheduleStudentMusicScore(scheduleStudentMusicScores);
             roomResult.setMembers(roomMemberList, midiMap, examSongMap, scheduleStudentMusicScores);
 
             // 全员静音开启状态