|
@@ -3,8 +3,11 @@ package com.ym.service.Impl;
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
|
|
+import com.dayaedu.cbs.openfeign.wrapper.music.CbsMusicSheetWrapper;
|
|
|
import com.google.common.collect.Lists;
|
|
|
import com.google.common.collect.Maps;
|
|
|
+import com.microsvc.toolkit.common.response.paging.PageInfo;
|
|
|
+import com.microsvc.toolkit.common.response.template.R;
|
|
|
import com.microsvc.toolkit.middleware.rtc.RTCRoomPluginContext;
|
|
|
import com.microsvc.toolkit.middleware.rtc.RTCRoomPluginService;
|
|
|
import com.microsvc.toolkit.middleware.rtc.enums.EMemberAction;
|
|
@@ -113,9 +116,11 @@ public class RoomServiceImpl implements RoomService {
|
|
|
@Autowired
|
|
|
private SysExamSongDao sysExamSongDao;
|
|
|
@Autowired
|
|
|
+ private SysMusicScoreService sysMusicScoreService;
|
|
|
+ @Autowired
|
|
|
private CourseScheduleStudentMusicScoreDao courseScheduleStudentMusicScoreDao;
|
|
|
@Autowired
|
|
|
- private SysMusicScoreAccompanimentDao sysMusicScoreAccompanimentDao;
|
|
|
+ private SysMusicScoreAccompanimentService sysMusicScoreAccompanimentService;
|
|
|
@Autowired
|
|
|
private SysTenantConfigService sysTenantConfigService;
|
|
|
@Autowired
|
|
@@ -2719,28 +2724,42 @@ public class RoomServiceImpl implements RoomService {
|
|
|
List<CourseScheduleStudentMusicScore> scheduleStudentMusicScores =
|
|
|
courseScheduleStudentMusicScoreDao.queryByScoreIdAndCourseId(musicScoreData.getMusicScoreAccompanimentId(),
|
|
|
courseScheduleId, null, null, 0);
|
|
|
- SysMusicScoreAccompaniment accompaniment = sysMusicScoreAccompanimentDao.get(musicScoreData.getMusicScoreAccompanimentId());
|
|
|
+ CbsMusicSheetWrapper.MusicSheetApplicationQuery query = sysMusicScoreService.getMusicSheetApplicationQuery();
|
|
|
+ query.setRows(1);
|
|
|
+ query.setMusicSheetSoundId(musicScoreData.getMusicScoreAccompanimentId().longValue());
|
|
|
+ List<CbsMusicSheetWrapper.MusicSheetApplication> applications = sysMusicScoreService.queryCbsMusicSheetApplication(query);
|
|
|
+ if (CollectionUtils.isEmpty(applications)) {
|
|
|
+ throw new BizException("曲目信息不存在");
|
|
|
+ }
|
|
|
+ CbsMusicSheetWrapper.MusicSheetApplication sheetApplication = applications.get(0);
|
|
|
+ List<CbsMusicSheetWrapper.MusicSheetSound> soundList = sheetApplication.getMusicSheetSoundList();
|
|
|
+ if (CollectionUtils.isEmpty(soundList)) {
|
|
|
+ throw new BizException("曲目原音信息不存在");
|
|
|
+ }
|
|
|
+ CbsMusicSheetWrapper.MusicSheetSound sheetSound = soundList.stream().
|
|
|
+ filter(e -> e.getId().equals(musicScoreData.getMusicScoreAccompanimentId().longValue())).collect(Collectors.toList()).get(0);
|
|
|
if (scheduleStudentMusicScores.size() == 0) {
|
|
|
//第一次下载,生成数据
|
|
|
List<CourseScheduleStudentPayment> courseScheduleStudentPayments = courseScheduleStudentPaymentDao.findByCourseSchedule(courseScheduleId);
|
|
|
Set<Integer> studentIds = courseScheduleStudentPayments.stream().map(e -> e.getUserId()).collect(Collectors.toSet());
|
|
|
studentIds.forEach(e -> {
|
|
|
CourseScheduleStudentMusicScore musicScore = new CourseScheduleStudentMusicScore();
|
|
|
- musicScore.setMusicScoreAccompanimentId(accompaniment.getId());
|
|
|
- musicScore.setSpeed(accompaniment.getSpeed());
|
|
|
+ musicScore.setMusicScoreAccompanimentId(musicScoreData.getMusicScoreAccompanimentId());
|
|
|
+ musicScore.setSpeed(sheetApplication.getPlaySpeed());
|
|
|
musicScore.setCourseScheduleId(courseScheduleId);
|
|
|
musicScore.setUserId(e);
|
|
|
scheduleStudentMusicScores.add(musicScore);
|
|
|
});
|
|
|
CourseScheduleStudentMusicScore musicScore = new CourseScheduleStudentMusicScore();
|
|
|
- musicScore.setMusicScoreAccompanimentId(accompaniment.getId());
|
|
|
- musicScore.setSpeed(accompaniment.getSpeed());
|
|
|
+ musicScore.setMusicScoreAccompanimentId(musicScoreData.getMusicScoreAccompanimentId());
|
|
|
+ musicScore.setSpeed(sheetApplication.getPlaySpeed());
|
|
|
musicScore.setCourseScheduleId(courseScheduleId);
|
|
|
musicScore.setUserId(authUser.getId());
|
|
|
musicScore.setUserType(1);
|
|
|
scheduleStudentMusicScores.add(musicScore);
|
|
|
courseScheduleStudentMusicScoreDao.batchInsert(scheduleStudentMusicScores);
|
|
|
}
|
|
|
+ SysMusicScoreAccompaniment accompaniment = sysMusicScoreAccompanimentService.initSysMusicScoreAccompaniment(sheetApplication, sheetSound);
|
|
|
MusicScoreMessage musicScoreMessage = JSON.parseObject(JSON.toJSONString(accompaniment), MusicScoreMessage.class);
|
|
|
// 发送消息
|
|
|
String serviceProvider = getRoomServiceProvider(musicScoreData.getRoomId());
|
|
@@ -2822,7 +2841,21 @@ public class RoomServiceImpl implements RoomService {
|
|
|
Integer accompanimentId = musicScoreData.getMusicScoreAccompanimentId();
|
|
|
List<CourseScheduleStudentMusicScore> studentMusicScores = courseScheduleStudentMusicScoreDao.queryByScoreIdAndCourseId(accompanimentId, scheduleId, studentId, null, null);
|
|
|
if (accompanimentId != null) {
|
|
|
- SysMusicScoreAccompaniment accompaniment = sysMusicScoreAccompanimentDao.get(accompanimentId);
|
|
|
+ CbsMusicSheetWrapper.MusicSheetApplicationQuery query = sysMusicScoreService.getMusicSheetApplicationQuery();
|
|
|
+ query.setRows(1);
|
|
|
+ query.setMusicSheetSoundId(accompanimentId.longValue());
|
|
|
+ List<CbsMusicSheetWrapper.MusicSheetApplication> applications = sysMusicScoreService.queryCbsMusicSheetApplication(query);
|
|
|
+ if (CollectionUtils.isEmpty(applications)) {
|
|
|
+ throw new BizException("曲目信息不存在");
|
|
|
+ }
|
|
|
+ CbsMusicSheetWrapper.MusicSheetApplication sheetApplication = applications.get(0);
|
|
|
+ List<CbsMusicSheetWrapper.MusicSheetSound> soundList = sheetApplication.getMusicSheetSoundList();
|
|
|
+ if (CollectionUtils.isEmpty(soundList)) {
|
|
|
+ throw new BizException("曲目原音信息不存在");
|
|
|
+ }
|
|
|
+ CbsMusicSheetWrapper.MusicSheetSound sheetSound = soundList.stream().
|
|
|
+ filter(e -> e.getId().equals(musicScoreData.getMusicScoreAccompanimentId().longValue())).collect(Collectors.toList()).get(0);
|
|
|
+ SysMusicScoreAccompaniment accompaniment = sysMusicScoreAccompanimentService.initSysMusicScoreAccompaniment(sheetApplication,sheetSound);
|
|
|
if (accompaniment == null) {
|
|
|
throw new BizException("曲目信息不存在");
|
|
|
}
|