|
@@ -8,19 +8,15 @@ import com.ym.common.DisplayEnum;
|
|
|
import com.ym.common.ErrorEnum;
|
|
|
import com.ym.config.IMProperties;
|
|
|
import com.ym.config.RoomProperties;
|
|
|
-import com.ym.dao.RoomDao;
|
|
|
-import com.ym.dao.RoomMemberDao;
|
|
|
-import com.ym.dao.UserDao;
|
|
|
-import com.ym.dao.WhiteboardDao;
|
|
|
+import com.ym.dao.*;
|
|
|
import com.ym.job.ScheduleManager;
|
|
|
import com.ym.mec.auth.api.client.SysUserFeignService;
|
|
|
import com.ym.mec.auth.api.entity.SysUser;
|
|
|
import com.ym.mec.biz.dal.dao.*;
|
|
|
+import com.ym.mec.biz.dal.dao.CourseScheduleStudentMusicScoreDao;
|
|
|
import com.ym.mec.biz.dal.dto.BasicUserDto;
|
|
|
import com.ym.mec.biz.dal.dto.RongyunBasicUserDto;
|
|
|
-import com.ym.mec.biz.dal.entity.CourseSchedule;
|
|
|
-import com.ym.mec.biz.dal.entity.SysExamSong;
|
|
|
-import com.ym.mec.biz.dal.entity.Teacher;
|
|
|
+import com.ym.mec.biz.dal.entity.*;
|
|
|
import com.ym.mec.biz.dal.enums.GroupType;
|
|
|
import com.ym.mec.biz.dal.enums.TeachModeEnum;
|
|
|
import com.ym.mec.biz.service.StudentAttendanceService;
|
|
@@ -95,6 +91,10 @@ public class RoomServiceImpl implements RoomService {
|
|
|
@Autowired
|
|
|
private SysConfigDao sysConfigDao;
|
|
|
@Autowired
|
|
|
+ private CourseScheduleStudentMusicScoreDao courseScheduleStudentMusicScoreDao;
|
|
|
+ @Autowired
|
|
|
+ private SysMusicScoreAccompanimentDao sysMusicScoreAccompanimentDao;
|
|
|
+ @Autowired
|
|
|
private RedisTemplate<String,String> redisTemplate;
|
|
|
|
|
|
@Override
|
|
@@ -827,6 +827,9 @@ public class RoomServiceImpl implements RoomService {
|
|
|
DeviceStateChangedMessage deviceResourceMessage = new DeviceStateChangedMessage(typeEnum.ordinal(), enable);
|
|
|
deviceResourceMessage.setUserId(userId);
|
|
|
imHelper.publishMessage(authUser.getId().toString(), roomId, deviceResourceMessage, 1);
|
|
|
+ }else if(typeEnum.equals(DeviceTypeEnum.MusicScore)){
|
|
|
+ long scheduleId = Long.parseLong(roomId.substring(1));
|
|
|
+
|
|
|
}else {
|
|
|
String ticket = IdentifierUtils.uuid();
|
|
|
ControlDeviceTaskInfo taskInfo = new ControlDeviceTaskInfo();
|
|
@@ -924,7 +927,9 @@ public class RoomServiceImpl implements RoomService {
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public Boolean approveControlDevice(String roomId, String ticket) throws Exception {
|
|
|
+ public Boolean approveControlDevice(ReqDeviceControlData data) throws Exception {
|
|
|
+ String ticket = data.getTicket();
|
|
|
+ String roomId = data.getRoomId();
|
|
|
CheckUtils.checkArgument(ticket != null, "ticket must't be null");
|
|
|
SysUser authUser = sysUserFeignService.queryUserInfo();
|
|
|
String userId = authUser.getId().toString();
|
|
@@ -932,7 +937,7 @@ public class RoomServiceImpl implements RoomService {
|
|
|
ControlDeviceTaskInfo taskInfo = (ControlDeviceTaskInfo) scheduleManager.executeTask(ticket);
|
|
|
if (taskInfo.getTypeEnum().equals(DeviceTypeEnum.Camera)) {
|
|
|
roomMemberDao.updateCameraByRidAndUid(roomId, userId, taskInfo.isOnOff());
|
|
|
- }if (taskInfo.getTypeEnum().equals(DeviceTypeEnum.ExamSong)) {
|
|
|
+ }else if (taskInfo.getTypeEnum().equals(DeviceTypeEnum.ExamSong)) {
|
|
|
long scheduleId = Long.parseLong(roomId.substring(1));
|
|
|
ExamSongDownloadData msg;
|
|
|
String examJson = courseScheduleStudentPaymentDao.getExamJsonByCourseIdAndUserId(scheduleId, authUser.getId());
|
|
@@ -943,6 +948,16 @@ public class RoomServiceImpl implements RoomService {
|
|
|
msg.setEnable(true);
|
|
|
}
|
|
|
courseScheduleStudentPaymentDao.adjustExamSong(scheduleId,authUser.getId(),JSON.toJSONString(msg));
|
|
|
+ }else if (taskInfo.getTypeEnum().equals(DeviceTypeEnum.MusicScore)) {
|
|
|
+ long scheduleId = Long.parseLong(roomId.substring(1));
|
|
|
+ //学员伴奏播放状态修改为播放
|
|
|
+ List<CourseScheduleStudentMusicScore> studentMusicScores = courseScheduleStudentMusicScoreDao.queryByScoreIdAndCourseId(data.getMusicScoreAccompanimentId(), scheduleId, authUser.getId(), null, null);
|
|
|
+ if(studentMusicScores == null || studentMusicScores.size() == 0){
|
|
|
+ throw new BizException("学员伴奏信息异常");
|
|
|
+ }
|
|
|
+ CourseScheduleStudentMusicScore studentMusicScore = studentMusicScores.get(0);
|
|
|
+ studentMusicScore.setPlayStatus(1);
|
|
|
+ courseScheduleStudentMusicScoreDao.update(studentMusicScore);
|
|
|
} else {
|
|
|
roomMemberDao.updateMicByRidAndUid(roomId, userId, taskInfo.isOnOff());
|
|
|
}
|
|
@@ -1441,6 +1456,42 @@ public class RoomServiceImpl implements RoomService {
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
+ public void pushDownloadMusicScoreMsg(MusicScoreData musicScoreData) throws Exception {
|
|
|
+ SysUser authUser = sysUserFeignService.queryUserInfo();
|
|
|
+ Long courseScheduleId = musicScoreData.getRoomId();
|
|
|
+ List<CourseScheduleStudentMusicScore> scheduleStudentMusicScores =
|
|
|
+ courseScheduleStudentMusicScoreDao.queryByScoreIdAndCourseId(musicScoreData.getMusicScoreAccompanimentId(),
|
|
|
+ courseScheduleId,null,null,0);
|
|
|
+ SysMusicScoreAccompaniment accompaniment = sysMusicScoreAccompanimentDao.get(musicScoreData.getMusicScoreAccompanimentId());
|
|
|
+ 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.setCourseScheduleId(courseScheduleId);
|
|
|
+ musicScore.setUserId(e);
|
|
|
+ scheduleStudentMusicScores.add(musicScore);
|
|
|
+ });
|
|
|
+ //老师伴奏
|
|
|
+ CourseScheduleStudentMusicScore musicScore = new CourseScheduleStudentMusicScore();
|
|
|
+ musicScore.setMusicScoreAccompanimentId(accompaniment.getId());
|
|
|
+ musicScore.setSpeed(accompaniment.getSpeed());
|
|
|
+ musicScore.setCourseScheduleId(courseScheduleId);
|
|
|
+ musicScore.setUserId(authUser.getId());
|
|
|
+ musicScore.setUserType(1);
|
|
|
+ scheduleStudentMusicScores.add(musicScore);
|
|
|
+ courseScheduleStudentMusicScoreDao.batchInsert(scheduleStudentMusicScores);
|
|
|
+ }
|
|
|
+ MusicScoreMessage musicScoreMessage = JSON.parseObject(JSON.toJSONString(accompaniment), MusicScoreMessage.class);
|
|
|
+ MusicScoreDownloadMessageMessage msg = new MusicScoreDownloadMessageMessage(musicScoreMessage);
|
|
|
+ imHelper.publishMessage(authUser.getId().toString(), courseScheduleId.toString(), msg, 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public void pushDownloadExamSongMsg(String roomId, Integer examSongId) throws Exception {
|
|
|
SysUser authUser = sysUserFeignService.queryUserInfo();
|
|
|
|
|
@@ -1471,6 +1522,33 @@ public class RoomServiceImpl implements RoomService {
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
+ public void adjustMusicScore(MusicScoreData musicScoreData) throws Exception {
|
|
|
+ SysUser authUser = sysUserFeignService.queryUserInfo();
|
|
|
+ Integer studentId = authUser.getId();
|
|
|
+ Long scheduleId = musicScoreData.getRoomId();
|
|
|
+ Integer status = musicScoreData.getStatus();
|
|
|
+ Integer accompanimentId = musicScoreData.getMusicScoreAccompanimentId();
|
|
|
+
|
|
|
+ SysMusicScoreAccompaniment accompaniment = sysMusicScoreAccompanimentDao.get(accompanimentId);
|
|
|
+ if(accompaniment == null){
|
|
|
+ throw new BizException("曲目信息不存在");
|
|
|
+ }
|
|
|
+ //修改下载状态
|
|
|
+ List<CourseScheduleStudentMusicScore> studentMusicScores = courseScheduleStudentMusicScoreDao.queryByScoreIdAndCourseId(accompanimentId,scheduleId,studentId,null,null);
|
|
|
+ if(studentMusicScores == null || studentMusicScores.size() == 0){
|
|
|
+ throw new BizException("学员不存在此下载曲目");
|
|
|
+ }
|
|
|
+ CourseScheduleStudentMusicScore studentMusicScore = studentMusicScores.get(0);
|
|
|
+ studentMusicScore.setDownStatus(musicScoreData.getStatus());
|
|
|
+ courseScheduleStudentMusicScoreDao.update(studentMusicScore);
|
|
|
+ //给老师发送学员曲目下载状态
|
|
|
+ CourseSchedule courseSchedule = courseScheduleDao.get(scheduleId);
|
|
|
+ MusicScoreDownloadStatusMessage statusMessage = new MusicScoreDownloadStatusMessage(status,studentId,accompanimentId);
|
|
|
+ imHelper.publishMessage(studentId.toString(),courseSchedule.getActualTeacherId().toString(), scheduleId.toString(),statusMessage);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public void adjustExamSong(String roomId, Integer status,Integer examSongId) throws Exception {
|
|
|
if(roomId == null || status == null || examSongId == null){
|
|
|
throw new BizException("参数校验失败");
|