|
@@ -374,13 +374,12 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void pushDownloadMusicSheetMsg(ImNetworkMusicSheetDto musicSheetDto) throws Exception {
|
|
|
String roomId = Optional.ofNullable(musicSheetDto).map(ImNetworkBaseDto::getRoomId).orElseThrow(() -> new BizException("房间编号不能为空"));
|
|
|
- Long musicScoreId = Optional.of(musicSheetDto).map(ImNetworkMusicSheetDto::getMusicScoreAccompanimentId).orElseThrow(() -> new BizException("伴奏编号不能为空"));
|
|
|
- log.info("pushDownloadMusicSheetMsg: roomId:{} ,musicScoreId:{}", roomId,musicScoreId);
|
|
|
+ Long accompanimentId = Optional.of(musicSheetDto).map(ImNetworkMusicSheetDto::getMusicScoreAccompanimentId).orElseThrow(() -> new BizException("伴奏编号不能为空"));
|
|
|
+ log.info("pushDownloadMusicSheetMsg: roomId:{} ,accompanimentId:{}", roomId,accompanimentId);
|
|
|
Long userId = sysUserService.getUserId();
|
|
|
- MusicSheetAccompaniment accompaniment = musicSheetAccompanimentService.lambdaQuery().eq(MusicSheetAccompaniment::getMusicSheetId,musicScoreId)
|
|
|
- .last("LIMIT 1").one();
|
|
|
+ MusicSheetAccompaniment accompaniment = musicSheetAccompanimentService.getById(accompanimentId);
|
|
|
List<CourseScheduleStudentMusicSheetResult> scheduleStudentMusicSheetResults = courseScheduleStudentMusicSheetService.getDao().
|
|
|
- queryBySheetIdAndCourseId(musicScoreId, Long.parseLong(roomId), null, null, 0);
|
|
|
+ queryBySheetIdAndCourseId(accompanimentId, Long.parseLong(roomId), null, null, 0);
|
|
|
|
|
|
if (scheduleStudentMusicSheetResults.isEmpty()) {
|
|
|
//第一次下载,生成数据
|
|
@@ -389,14 +388,14 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
|
|
|
Set<Long> studentIds = studentPayments.stream().map(CourseScheduleStudentPayment::getUserId).collect(Collectors.toSet());
|
|
|
studentIds.forEach(e -> {
|
|
|
CourseScheduleStudentMusicSheetResult musicSheet = new CourseScheduleStudentMusicSheetResult();
|
|
|
- musicSheet.setMusicScoreAccompanimentId(musicScoreId);
|
|
|
+ musicSheet.setMusicScoreAccompanimentId(accompanimentId);
|
|
|
musicSheet.setSpeed(accompaniment.getSpeed());
|
|
|
musicSheet.setCourseScheduleId(Long.parseLong(roomId));
|
|
|
musicSheet.setUserId(e);
|
|
|
scheduleStudentMusicSheetResults.add(musicSheet);
|
|
|
});
|
|
|
CourseScheduleStudentMusicSheetResult musicSheet = new CourseScheduleStudentMusicSheetResult();
|
|
|
- musicSheet.setMusicScoreAccompanimentId(musicScoreId);
|
|
|
+ musicSheet.setMusicScoreAccompanimentId(accompanimentId);
|
|
|
musicSheet.setSpeed(accompaniment.getSpeed());
|
|
|
musicSheet.setCourseScheduleId(Long.parseLong(roomId));
|
|
|
musicSheet.setUserId(userId);
|
|
@@ -408,8 +407,7 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
|
|
|
// IM用户ID
|
|
|
String imUserId = imGroupService.getImUserId(userId,musicSheetDto.getClientType());
|
|
|
ImNetworkMusicSheetDownloadMessageContent content = JSON.parseObject(JSON.toJSONString(accompaniment), ImNetworkMusicSheetDownloadMessageContent.class);
|
|
|
- content.setExamSongId(accompaniment.getId().intValue());
|
|
|
- content.setId(accompaniment.getMusicSheetId().intValue());
|
|
|
+ content.setExamSongId(accompaniment.getMusicSheetId().intValue());
|
|
|
if(StringUtils.isNotEmpty(accompaniment.getMusicSubjectId())){
|
|
|
content.setSubjectId(Integer.parseInt(accompaniment.getMusicSubjectId()));
|
|
|
}
|