zouxuan před 3 roky
rodič
revize
0e9f8d2b0a
14 změnil soubory, kde provedl 95 přidání a 286 odebrání
  1. 2 2
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/CourseScheduleStudentMusicSheetDao.java
  2. 1 1
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/CourseScheduleStudentPaymentDao.java
  3. 0 9
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/ImNetworkControlDeviceNotifyMessage.java
  4. 8 8
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/ImNetworkCustomMessage.java
  5. 10 10
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/ImNetworkDeviceControlDto.java
  6. 5 5
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/ImNetworkDeviceStateChangedMessage.java
  7. 5 5
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/CourseScheduleStudentMusicSheet.java
  8. 52 41
      cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/ImNetworkRoomServiceImpl.java
  9. 4 4
      cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleStudentMusicSheetDao.xml
  10. 5 5
      cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleStudentPaymentMapper.xml
  11. 1 1
      cooleshow-user/user-biz/src/main/resources/config/mybatis/ImNetworkRoomMemberMapper.xml
  12. 2 0
      cooleshow-user/user-classroom/src/main/java/com/yonge/cooleshow/classroom/controller/ImNetworkRoomController.java
  13. 0 166
      cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/ImNetworkRoomController.java
  14. 0 29
      cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/ImNetworkRoomMemberController.java

+ 2 - 2
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/CourseScheduleStudentMusicSheetDao.java

@@ -22,10 +22,10 @@ public interface CourseScheduleStudentMusicSheetDao extends BaseMapper<CourseSch
                                                                           @Param("userType") Integer userType);
     //开启原音播放
     void openPlayStatus(@Param("scheduleId") Long scheduleId,
-                       @Param("musicScoreAccompanimentId") Integer musicScoreAccompanimentId,
+                       @Param("musicSheetAccompanimentId") Integer musicSheetAccompanimentId,
                        @Param("userId") Long userId);
     void openAccompanimentPlayStatus(@Param("scheduleId") Long scheduleId,
-                                    @Param("musicScoreAccompanimentId") Integer musicScoreAccompanimentId,
+                                    @Param("musicSheetAccompanimentId") Integer musicSheetAccompanimentId,
                                     @Param("userId") Long userId);
     //关闭伴奏
     void closePlayStatus(@Param("courseId") Long courseId,@Param("userId") Long userId);

+ 1 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dao/CourseScheduleStudentPaymentDao.java

@@ -65,7 +65,7 @@ public interface CourseScheduleStudentPaymentDao extends BaseMapper<CourseSchedu
     String getMusicSheetByCourseIdAndUserId(@Param("courseScheduleId") Long courseScheduleId, @Param("userId") Long userId);
 
     //调整节拍器
-    void adjustPlayMidi(@Param("courseScheduleId") long courseScheduleId, @Param("userId") Long userId, @Param("content") String content);
+    void adjustPlayMidi(@Param("courseScheduleId") long courseScheduleId, @Param("userId") String userId, @Param("content") String content);
 
     //调整伴奏
     void adjustExamSong(@Param("courseScheduleId") long courseScheduleId, @Param("userId") Long userId, @Param("examSongJson") String examSongJson);

+ 0 - 9
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/ImNetworkControlDeviceNotifyMessage.java

@@ -6,7 +6,6 @@ import com.yonge.cooleshow.biz.dal.entity.BaseMessage;
 public class ImNetworkControlDeviceNotifyMessage extends BaseMessage {
 
     private int action;
-//    private String ticket;
     private int type;
     private String opUserId;
     private String opUserName;
@@ -23,14 +22,6 @@ public class ImNetworkControlDeviceNotifyMessage extends BaseMessage {
         this.action = action;
     }
 
-//    public String getTicket() {
-//        return ticket;
-//    }
-//
-//    public void setTicket(String ticket) {
-//        this.ticket = ticket;
-//    }
-
     public int getType() {
         return type;
     }

+ 8 - 8
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/ImNetworkCustomMessage.java

@@ -8,7 +8,7 @@ public class ImNetworkCustomMessage extends BaseMessage {
     @ApiModelProperty(value = "节拍器开关",required = true)
     private boolean enable;
 
-    @ApiModelProperty(value = "消息类型",required = true)
+    @ApiModelProperty(value = "消息类型(移动端定义,具体的类型不太清楚)",required = true)
     private int customType;
 
     @ApiModelProperty(value = "速度",required = true)
@@ -17,18 +17,18 @@ public class ImNetworkCustomMessage extends BaseMessage {
     @ApiModelProperty(value = "音量",required = true)
     private int playVolume;
 
-    @ApiModelProperty(value = "用户",required = false)
+    @ApiModelProperty(value = "学员编号列表,都还分割",required = true)
     private String userId;
 
-    @ApiModelProperty(value = "课程编号",required = true)
-    private Long courseScheduleId;
+    @ApiModelProperty(value = "房间号(课程编号",required = true)
+    private Long roomId;
 
-    public Long getCourseScheduleId() {
-        return courseScheduleId;
+    public Long getRoomId() {
+        return roomId;
     }
 
-    public void setCourseScheduleId(Long courseScheduleId) {
-        this.courseScheduleId = courseScheduleId;
+    public void setRoomId(Long roomId) {
+        this.roomId = roomId;
     }
 
     public int getPlayVolume() {

+ 10 - 10
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/ImNetworkDeviceControlDto.java

@@ -23,10 +23,10 @@ public class ImNetworkDeviceControlDto {
 	private Integer status;
 
 	@ApiModelProperty(value = "原音",required = true)
-	private Integer examSongId;
+	private Integer musicSheetId;
 
 	@ApiModelProperty(value = "伴奏",required = true)
-	private Integer musicScoreAccompanimentId;
+	private Integer musicSheetAccompanimentId;
 
 	@ApiModelProperty(value = "伴奏音量",required = true)
 	private Integer soundVolume = 100;
@@ -79,20 +79,20 @@ public class ImNetworkDeviceControlDto {
 		this.status = status;
 	}
 
-	public Integer getExamSongId() {
-		return examSongId;
+	public Integer getMusicSheetId() {
+		return musicSheetId;
 	}
 
-	public void setExamSongId(Integer examSongId) {
-		this.examSongId = examSongId;
+	public void setMusicSheetId(Integer musicSheetId) {
+		this.musicSheetId = musicSheetId;
 	}
 
-	public Integer getMusicScoreAccompanimentId() {
-		return musicScoreAccompanimentId;
+	public Integer getMusicSheetAccompanimentId() {
+		return musicSheetAccompanimentId;
 	}
 
-	public void setMusicScoreAccompanimentId(Integer musicScoreAccompanimentId) {
-		this.musicScoreAccompanimentId = musicScoreAccompanimentId;
+	public void setMusicSheetAccompanimentId(Integer musicSheetAccompanimentId) {
+		this.musicSheetAccompanimentId = musicSheetAccompanimentId;
 	}
 
 	public Integer getSoundVolume() {

+ 5 - 5
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/dto/ImNetworkDeviceStateChangedMessage.java

@@ -6,7 +6,7 @@ import com.yonge.cooleshow.biz.dal.entity.BaseMessage;
 public class ImNetworkDeviceStateChangedMessage extends BaseMessage {
     private boolean enable;
     private int type;
-    private Integer musicScoreAccompanimentId;
+    private Integer musicSheetAccompanimentId;
     private String userId;
     private String userName;
     private Integer soundVolume = 100;
@@ -32,12 +32,12 @@ public class ImNetworkDeviceStateChangedMessage extends BaseMessage {
         this.type = type;
     }
 
-    public Integer getMusicScoreAccompanimentId() {
-        return musicScoreAccompanimentId;
+    public Integer getMusicSheetAccompanimentId() {
+        return musicSheetAccompanimentId;
     }
 
-    public void setMusicScoreAccompanimentId(Integer musicScoreAccompanimentId) {
-        this.musicScoreAccompanimentId = musicScoreAccompanimentId;
+    public void setMusicSheetAccompanimentId(Integer musicSheetAccompanimentId) {
+        this.musicSheetAccompanimentId = musicSheetAccompanimentId;
     }
 
     public String getUserId() {

+ 5 - 5
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/entity/CourseScheduleStudentMusicSheet.java

@@ -33,7 +33,7 @@ public class CourseScheduleStudentMusicSheet implements Serializable {
 
     @TableField("down_status_")
     @ApiModelProperty(value = "伴奏下载状态(1下载成功0下载中2下载失败)")
-    private Integer downStatus;
+    private Integer downStatus = 0;
 
     @TableField("music_sheet_accompaniment_id_")
     @ApiModelProperty(value = "伴奏编号")
@@ -41,19 +41,19 @@ public class CourseScheduleStudentMusicSheet implements Serializable {
 
     @TableField("play_status_")
     @ApiModelProperty(value = "原音播放状态(1是0否)")
-    private Integer playStatus;
+    private Integer playStatus = 0;
 
     @TableField("accompaniment_play_status_")
     @ApiModelProperty(value = "伴奏播放状态")
-    private Integer accompanimentPlayStatus;
+    private Integer accompanimentPlayStatus = 0;
 
     @TableField("user_type_")
     @ApiModelProperty(value = "0学生1老师")
-    private Integer userType;
+    private Integer userType = 0;
 
     @TableField("speed_")
     @ApiModelProperty(value = "播放速度")
-    private Integer speed;
+    private Integer speed = 100;
 
     @TableField("create_time_")
     @ApiModelProperty(value = "${column.comment}")

+ 52 - 41
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/ImNetworkRoomServiceImpl.java

@@ -1,7 +1,6 @@
 package com.yonge.cooleshow.biz.dal.service.impl;
 
 import com.alibaba.fastjson.JSON;
-import com.baomidou.mybatisplus.extension.exceptions.ApiException;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.yonge.cooleshow.auth.api.client.SysUserFeignService;
 import com.yonge.cooleshow.auth.api.entity.SysUser;
@@ -29,8 +28,6 @@ import javax.annotation.Resource;
 import java.util.*;
 import java.util.stream.Collectors;
 
-import static org.bouncycastle.asn1.cms.CMSObjectIdentifiers.data;
-
 /**
  * 网络教室房间(ImNetworkRoom)表服务实现类
  *
@@ -72,11 +69,12 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
     @Transactional(rollbackFor = Exception.class)
     public HttpResponseResult<ImNetworkRoomResult> joinRoom(Long courseScheduleId, UserRoleEnum userRole) throws Exception {
         log.info("joinRoom params:courseScheduleId:{},userRole:{}",courseScheduleId,userRole);
-        SysUser user = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
+        Long userId = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
+                map(SysUser::getId).
                 orElseThrow(()-> new BizException("请登录"));
         CourseSchedule courseSchedule = Optional.ofNullable(courseScheduleService.getById(courseScheduleId)).
                 orElseThrow(()->new BizException("房间信息不存在"));
-        BasicUserInfo sysUser = Optional.ofNullable(teacherDao.getBasicUserInfo(user.getId())).
+        BasicUserInfo sysUser = Optional.ofNullable(teacherDao.getBasicUserInfo(userId)).
                 orElseThrow(()-> new BizException("用户信息不存在"));
         Date now = new Date();
         courseSchedule.setUpdatedTime(now);
@@ -125,12 +123,13 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
     @Transactional(rollbackFor = Exception.class)
     public void joinRoomSuccess(String roomId,Long userId) throws Exception {
         log.info("joinRoomSuccess: roomId={}, userId={}", roomId, userId);
-        CourseSchedule courseSchedule = Optional.ofNullable(courseScheduleService.getById(roomId)).
+        Long teacherId = Optional.ofNullable(courseScheduleService.getById(roomId)).
+                map(CourseSchedule::getTeacherId).
                 orElseThrow(()->new BizException("房间信息不存在"));
         BasicUserInfo sysUser = Optional.ofNullable(teacherDao.getBasicUserInfo(userId)).
                 orElseThrow(()-> new BizException("用户信息不存在"));
         UserRoleEnum userRole = UserRoleEnum.STUDENT;
-        if(Objects.equals(courseSchedule.getTeacherId(),userId)){
+        if(Objects.equals(teacherId,userId)){
             userRole = UserRoleEnum.TEACHER;
         }
         Date now = new Date();
@@ -153,9 +152,9 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void joinRoomFailure(String roomId) {
-        SysUser sysUser = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
+        Long userId = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
+                map(SysUser::getId).
                 orElseThrow(()-> new BizException("请登录"));
-        Long userId = sysUser.getId();
         log.info("joinRoomFailure: roomId={}, userId={}", roomId, userId);
         imNetworkRoomMemberService.getDao().delByRidAndUid(roomId, userId);
     }
@@ -163,9 +162,9 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void leaveRoom(String roomId,UserRoleEnum userRole) throws Exception {
-        SysUser sysUser = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
+        Long userId = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
+                map(SysUser::getId).
                 orElseThrow(()-> new BizException("请登录"));
-        Long userId = sysUser.getId();
         log.info("leaveRoom: roomId={}, userId={}", roomId, userId);
         long courseScheduleId = Long.parseLong(roomId);
         if (userRole == UserRoleEnum.TEACHER){
@@ -227,21 +226,22 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void sendImPlayMidiMessage(ImNetworkCustomMessage customMessage) throws Exception {
-        SysUser sysUser = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
+        Long userId = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
+                map(SysUser::getId).
                 orElseThrow(()-> new BizException("请登录"));
-        Long userId = sysUser.getId();
-        Long courseScheduleId = customMessage.getCourseScheduleId();
-        log.info("sendImPlayMidiMessage: roomId={}, userId={}", courseScheduleId, userId);
+        Long roomId = customMessage.getRoomId();
+        log.info("sendImPlayMidiMessage: roomId={}, userId={}", roomId, userId);
         ImNetworkMetronomeMessage displayMessage = new ImNetworkMetronomeMessage(customMessage);
-        imHelper.publishMessage(userId.toString(), courseScheduleId.toString(), displayMessage, 0);
+        imHelper.publishMessage(userId.toString(), roomId.toString(), displayMessage, 0);
         //记录节拍器信息
-        courseScheduleStudentPaymentService.getDao().adjustPlayMidi(courseScheduleId,userId,customMessage.toString());
+        courseScheduleStudentPaymentService.getDao().adjustPlayMidi(roomId,customMessage.getUserId(),customMessage.toString());
     }
 
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void pushDownloadMusicSheetMsg(String roomId,Long accompanimentId) throws Exception {
-        SysUser sysUser = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
+        Long userId = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
+                map(SysUser::getId).
                 orElseThrow(()-> new BizException("请登录"));
         Long courseScheduleId = Long.parseLong(roomId);
         List<CourseScheduleStudentMusicSheetResult> scheduleStudentMusicSheetResults = courseScheduleStudentMusicSheetService.getDao().
@@ -264,21 +264,22 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
             musicSheet.setMusicSheetAccompanimentId(accompanimentId);
             musicSheet.setSpeed(accompaniment.getSpeed());
             musicSheet.setCourseScheduleId(courseScheduleId);
-            musicSheet.setUserId(sysUser.getId());
+            musicSheet.setUserId(userId);
             musicSheet.setUserType(1);
             scheduleStudentMusicSheetResults.add(musicSheet);
             courseScheduleStudentMusicSheetService.getDao().batchInsert(scheduleStudentMusicSheetResults);
         }
         ImNetworkMusicSheetDownloadMessage msg = new ImNetworkMusicSheetDownloadMessage(
                 JSON.parseObject(JSON.toJSONString(accompaniment), ImNetworkMusicSheetDownloadMessageContent.class));
-        imHelper.publishMessage(sysUser.getId().toString(), roomId, msg, 0);
+        imHelper.publishMessage(userId.toString(), roomId, msg, 0);
     }
 
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void display(ImNetworkDisplayDataDto displayData) throws Exception {
         log.info("display in data = {}", displayData);
-        SysUser sysUser = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
+        Long userId = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
+                map(SysUser::getId).
                 orElseThrow(()-> new BizException("请登录"));
 
         StringBuffer display = new StringBuffer("display://type=").append(displayData.getType().ordinal()).append("?userId=");
@@ -288,22 +289,24 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
                 display = new StringBuffer();
                 break;
             case TEACHER:
-                CourseSchedule courseSchedule = courseScheduleService.getById(displayData.getRoomId());
-                display.append(courseSchedule.getTeacherId()).append("?uri=");
+                Long teacherId = Optional.ofNullable(courseScheduleService.getById(displayData.getRoomId())).
+                        map(CourseSchedule::getTeacherId).
+                        orElseThrow(()->new BizException("房间信息不存在"));
+                display.append(teacherId).append("?uri=");
                 break;
             case SCREEN:
-                display.append(sysUser.getId()).append("?uri=");
+                display.append(userId).append("?uri=");
                 break;
             case STUDENT:
                 display.append(displayData.getUserId()).append("?uri=").append(displayData.getUri());
                 break;
             default:
-                display.append(sysUser.getId()).append("?uri=").append(displayData.getUri());
+                display.append(userId).append("?uri=").append(displayData.getUri());
                 break;
         }
         ImNetworkRoom room = baseMapper.findByRoomId(displayData.getRoomId());
         room.setDisplay(display.toString());
-        this.updateDisplay(sysUser.getId(),room);
+        this.updateDisplay(userId,room);
     }
 
     @Override
@@ -354,21 +357,25 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
                     imHelper.publishMessage(userId.toString(), deviceControl.getRoomId(), deviceResourceMessage, 1);
                     break;
                 case MUSIC_SHEET:
+                    Integer musicSheetId = Optional.ofNullable(deviceControl.getMusicSheetAccompanimentId()).
+                            orElseThrow(()-> new BizException("请选择曲目"));
                     //关闭所有曲目播放
                     courseScheduleStudentMusicSheetService.getDao().closePlayStatus(scheduleId,userId);
                     //打开原音
-                    courseScheduleStudentMusicSheetService.getDao().openPlayStatus(scheduleId,deviceControl.getMusicScoreAccompanimentId(),userId);
-                    deviceResourceMessage.setMusicScoreAccompanimentId(deviceControl.getMusicScoreAccompanimentId());
+                    courseScheduleStudentMusicSheetService.getDao().openPlayStatus(scheduleId,musicSheetId,userId);
+                    deviceResourceMessage.setMusicSheetAccompanimentId(musicSheetId);
                     deviceResourceMessage.setUserId(userId.toString());
                     deviceResourceMessage.setSoundVolume(deviceControl.getSoundVolume());
                     imHelper.publishMessage(sysUser.getId().toString(), roomId, deviceResourceMessage, 1);
                     break;
                 case ACCOMPANIMENT:
+                  Integer musicSheetAccompanimentId = Optional.ofNullable(deviceControl.getMusicSheetAccompanimentId()).
+                            orElseThrow(()-> new BizException("请选择曲目"));
                     //关闭所有曲目播放
                     courseScheduleStudentMusicSheetService.getDao().closePlayStatus(scheduleId,userId);
                     //打开伴奏
-                    courseScheduleStudentMusicSheetService.getDao().openAccompanimentPlayStatus(scheduleId, deviceControl.getMusicScoreAccompanimentId(),userId);
-                    deviceResourceMessage.setMusicScoreAccompanimentId(deviceControl.getMusicScoreAccompanimentId());
+                    courseScheduleStudentMusicSheetService.getDao().openAccompanimentPlayStatus(scheduleId,musicSheetAccompanimentId,userId);
+                    deviceResourceMessage.setMusicSheetAccompanimentId(musicSheetAccompanimentId);
                     deviceResourceMessage.setUserId(userId.toString());
                     deviceResourceMessage.setSoundVolume(deviceControl.getSoundVolume());
                     imHelper.publishMessage(sysUser.getId().toString(), roomId, deviceResourceMessage, 1);
@@ -376,7 +383,6 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
                 default:
                     //邀请打开指定设备权限
                     ImNetworkControlDeviceNotifyMessage message = new ImNetworkControlDeviceNotifyMessage(ImNetworkActionEnum.INVITE.ordinal());
-//                    msg.setTicket(ticket);
                     message.setType(deviceControl.getDeviceType().ordinal());
                     message.setOpUserId(sysUser.getId().toString());
                     message.setOpUserName(sysUser.getUsername());
@@ -384,7 +390,8 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
                     break;
             }
         }else {
-            ImNetworkRoomMember roomMember = imNetworkRoomMemberService.getById(roomId);
+            ImNetworkRoomMember roomMember = Optional.ofNullable(imNetworkRoomMemberService.getDao().findByRidAndUid(roomId, userId))
+                    .orElseThrow(()-> new BizException("用户不在房间内"));
             long scheduleId = Long.parseLong(roomId);
             switch (deviceControl.getDeviceType()) {
                 case CAMERA:
@@ -431,7 +438,8 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
         log.info("approveControlDevice: deviceControl={}", deviceControl);
         SysUser sysUser = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
                 orElseThrow(()-> new BizException("请登录"));
-        ImNetworkRoomMember roomMember = imNetworkRoomMemberService.getById(deviceControl.getRoomId());
+        ImNetworkRoomMember roomMember = Optional.ofNullable(imNetworkRoomMemberService.getDao().findByRidAndUid(deviceControl.getRoomId(), sysUser.getId())).
+                orElseThrow(()-> new BizException("用户不在房间内"));
         switch (deviceControl.getDeviceType()) {
             case CAMERA:
                 roomMember.setCameraFlag(deviceControl.getEnable());
@@ -465,10 +473,13 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
     @Transactional(rollbackFor = Exception.class)
     public void deviceStatusSync(ImNetworkDeviceControlDto deviceStatusSync) throws Exception {
         log.info("deviceStatusSync: deviceStatusSync={}", deviceStatusSync);
-        SysUser sysUser = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
+        Long userId = Optional.ofNullable(sysUserFeignService.queryUserInfo()).
+                map(SysUser::getId).
                 orElseThrow(()-> new BizException("请登录"));
         ImNetworkDeviceTypeEnum deviceType = deviceStatusSync.getDeviceType();
-        ImNetworkRoomMember roomMember = imNetworkRoomMemberService.getById(deviceStatusSync.getRoomId());
+        ImNetworkRoomMember roomMember = Optional.ofNullable(imNetworkRoomMemberService.getDao().
+                        findByRidAndUid(deviceStatusSync.getRoomId(), userId))
+                .orElseThrow(()-> new BizException("用户不在房间内"));
         switch (deviceType) {
             case CAMERA:
                 roomMember.setCameraFlag(deviceStatusSync.getEnable());
@@ -484,9 +495,9 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
                 break;
             case EXAM_SONG:
                 long scheduleId = Long.parseLong(deviceStatusSync.getRoomId());
-                ImNetworkRoomMusicSheetDownloadData msg = courseScheduleStudentPaymentService.getMemberExamSong(scheduleId, sysUser.getId());
+                ImNetworkRoomMusicSheetDownloadData msg = courseScheduleStudentPaymentService.getMemberExamSong(scheduleId, userId);
                 msg.setEnable(deviceStatusSync.getEnable());
-                courseScheduleStudentPaymentService.getDao().adjustExamSong(scheduleId, sysUser.getId(), JSON.toJSONString(msg));
+                courseScheduleStudentPaymentService.getDao().adjustExamSong(scheduleId, userId, JSON.toJSONString(msg));
                 break;
         }
         if(deviceType == ImNetworkDeviceTypeEnum.CAMERA ||
@@ -496,10 +507,10 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
             imNetworkRoomMemberService.getDao().updateById(roomMember);
         }
         ImNetworkDeviceStateChangedMessage deviceResourceMessage = new ImNetworkDeviceStateChangedMessage(deviceType.ordinal(),deviceStatusSync.getEnable());
-        deviceResourceMessage.setUserId(sysUser.getId().toString());
-        ImNetworkRoom room = this.getById(deviceStatusSync.getRoomId());
+        deviceResourceMessage.setUserId(userId.toString());
+        ImNetworkRoom room = baseMapper.findByRoomId(deviceStatusSync.getRoomId());
         deviceResourceMessage.setSoundVolume(room.getSoundVolume());
-        imHelper.publishMessage(sysUser.getId().toString(), deviceStatusSync.getRoomId(), deviceResourceMessage, 1);
+        imHelper.publishMessage(userId.toString(), deviceStatusSync.getRoomId(), deviceResourceMessage, 1);
     }
 
     @Override
@@ -547,7 +558,7 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
         if (StringUtils.isEmpty(courseBeforeBufferTime)) {
             courseBeforeBufferTime = "5";
         }
-        Date addMinutes = DateUtil.addMinutes(courseSchedule.getUpdatedTime(), Integer.parseInt(courseBeforeBufferTime));
+        Date addMinutes = DateUtil.addMinutes(courseSchedule.getStartTime(), Integer.parseInt(courseBeforeBufferTime));
         return courseSchedule.getStartTime().compareTo(addMinutes) > 0;
     }
 

+ 4 - 4
cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleStudentMusicSheetDao.xml

@@ -21,12 +21,12 @@
     accompaniment_play_status_, user_type_, speed_, create_time_, update_time_
     </sql>
     <insert id="batchInsert">
-        INSERT INTO course_schedule_student_music_score (course_schedule_id_,user_id_,user_type_,down_status_,
+        INSERT INTO course_schedule_student_music_sheet (course_schedule_id_,user_id_,user_type_,down_status_,
         music_sheet_accompaniment_id_,play_status_,accompaniment_play_status_,
                                                          speed_,create_time_,update_time_)
         VALUE
         <foreach collection="musicSheet" item="item" separator=",">
-            (#{item.courseScheduleId},#{item.userId},#{item.userType},#{item.downStatus},#{item.musicScoreAccompanimentId},
+            (#{item.courseScheduleId},#{item.userId},#{item.userType},#{item.downStatus},#{item.musicSheetAccompanimentId},
             #{item.playStatus},#{item.accompanimentPlayStatus},#{item.speed},now(),now())
         </foreach>
     </insert>
@@ -40,14 +40,14 @@
     <update id="openPlayStatus">
         UPDATE course_schedule_student_music_sheet SET play_status_ = 1,update_time_ = NOW()
         WHERE course_schedule_id_ = #{scheduleId}
-        AND music_score_accompaniment_id_ = #{musicScoreAccompanimentId}
+        AND music_sheet_accompaniment_id_ = #{musicSheetAccompanimentId}
         <if test="userId != null">
             AND user_id_ = #{userId}
         </if>
     </update>
     <update id="openAccompanimentPlayStatus">
         UPDATE course_schedule_student_music_sheet SET accompaniment_play_status_ = 1,update_time_ = NOW()
-        WHERE course_schedule_id_ = #{scheduleId} AND music_score_accompaniment_id_ = #{musicScoreAccompanimentId}
+        WHERE course_schedule_id_ = #{scheduleId} AND music_sheet_accompaniment_id_ = #{musicSheetAccompanimentId}
         <if test="userId != null">
             AND user_id_ = #{userId}
         </if>

+ 5 - 5
cooleshow-user/user-biz/src/main/resources/config/mybatis/CourseScheduleStudentPaymentMapper.xml

@@ -40,10 +40,10 @@
         UPDATE course_schedule_student_payment cssp
         <set>
             <if test="content == null or content == ''">
-                cssp.play_midi_ = NULL,cssp.update_time_ = NOW()
+                cssp.play_midi_ = NULL,cssp.updated_time_ = NOW()
             </if>
             <if test="content != null and content != ''">
-                cssp.play_midi_ = #{content},cssp.update_time_ = NOW()
+                cssp.play_midi_ = #{content},cssp.updated_time_ = NOW()
             </if>
         </set>
         <where>
@@ -55,7 +55,7 @@
     </update>
     <update id="adjustExamSong">
         UPDATE course_schedule_student_payment SET music_sheet_download_json_ = #{examSongJson}
-        WHERE course_id_ = #{roomId}
+        WHERE course_id_ = #{courseScheduleId}
         <if test="userId != null">
             AND user_id_ = #{userId}
         </if>
@@ -64,10 +64,10 @@
         UPDATE course_schedule_student_payment cssp
         <set>
             <if test="content == null or content == ''">
-                cssp.open_play_midi_ = NULL,cssp.update_time_ = NOW()
+                cssp.open_play_midi_ = NULL,cssp.updated_time_ = NOW()
             </if>
             <if test="content != null and content != ''">
-                cssp.open_play_midi_ = #{content},cssp.update_time_ = NOW()
+                cssp.open_play_midi_ = #{content},cssp.updated_time_ = NOW()
             </if>
             <if test="examSongJson != null">
                 cssp.exam_song_download_json_ = #{examSongJson}

+ 1 - 1
cooleshow-user/user-biz/src/main/resources/config/mybatis/ImNetworkRoomMemberMapper.xml

@@ -40,7 +40,7 @@
                 #{entity.cameraFlag}, #{entity.micFlag}, #{entity.musicModeFlag}, #{entity.handFlag}, #{entity.username}, #{entity.avatar})
         ON DUPLICATE KEY UPDATE
         room_id_ = VALUES(room_id_),
-        user_id_ = VALUES(user_id_))
+        user_id_ = VALUES(user_id_)
     </insert>
     <delete id="delByRidAndUid">
         DELETE FROM im_network_room_member WHERE room_id_ = #{roomId} AND user_id_ = #{userId}

+ 2 - 0
cooleshow-user/user-classroom/src/main/java/com/yonge/cooleshow/classroom/controller/ImNetworkRoomController.java

@@ -120,6 +120,7 @@ public class ImNetworkRoomController extends BaseController {
     @ApiOperation(value = "学员同意打开,麦克风、摄像头")
     @PostMapping(value = "/device/approve", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
     public HttpResponseResult approveControlDevice(@RequestBody ImNetworkDeviceControlDto deviceControl) throws Exception {
+        deviceControl.setEnable(true);
         imNetworkRoomService.approveControlDevice(deviceControl);
         return succeed();
     }
@@ -128,6 +129,7 @@ public class ImNetworkRoomController extends BaseController {
     @PostMapping(value = "/device/reject", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
     public HttpResponseResult rejectControlDevice(@RequestBody ImNetworkDeviceControlDto deviceControl)
             throws Exception {
+        deviceControl.setEnable(false);
         imNetworkRoomService.rejectControlDevice(deviceControl);
         return succeed();
     }

+ 0 - 166
cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/ImNetworkRoomController.java

@@ -1,166 +0,0 @@
-package com.yonge.cooleshow.teacher.controller;
-
-
-import com.alibaba.fastjson.JSONObject;
-import com.yonge.cooleshow.biz.dal.dto.*;
-import com.yonge.cooleshow.biz.dal.enums.UserRoleEnum;
-import com.yonge.cooleshow.biz.dal.service.ImNetworkRoomService;
-import com.yonge.cooleshow.common.controller.BaseController;
-import com.yonge.cooleshow.common.entity.HttpResponseResult;
-import com.yonge.toolset.base.exception.BizException;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiImplicitParam;
-import io.swagger.annotations.ApiImplicitParams;
-import io.swagger.annotations.ApiOperation;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.http.MediaType;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-import java.util.Optional;
-
-/**
- * 网络教室房间(ImNetworkRoom)表控制层
- *
- * @author zx
- * @since 2022-03-30 16:36:36
- */
-@Api(tags = "网络教室房间")
-@RestController
-@RequestMapping("/imNetworkRoom")
-public class ImNetworkRoomController extends BaseController {
-
-    private final static Logger log = LoggerFactory.getLogger(ImNetworkRoomController.class);
-    /**
-     * 服务对象
-     */
-    @Resource
-    private ImNetworkRoomService imNetworkRoomService;
-
-    @ApiOperation("加入网络教室")
-    @PostMapping(value = "/join", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
-    @ApiImplicitParam(name = "roomId", dataType = "Long", value = "课程编号")
-    public HttpResponseResult<ImNetworkRoomResult> joinRoom(Long roomId) throws Exception {
-        roomId = Optional.ofNullable(roomId)
-                .orElseThrow(()->new BizException("房间号不可为空"));
-        return imNetworkRoomService.joinRoom(roomId, UserRoleEnum.TEACHER);
-    }
-
-//    @ApiOperation("加入网络教室状态回调")
-//    @PostMapping(value = "joinRoomSuccess", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
-//    public HttpResponseResult joinRoomSuccess(Long courseScheduleId) throws Exception {
-//        imNetworkRoomService.joinRoomSuccess(courseScheduleId.toString(),UserRoleEnum.TEACHER);
-//        return succeed();
-//    }
-
-    @ApiOperation("加入网络教室状态回调")
-    @PostMapping(value = "joinRoomFailure", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
-    public HttpResponseResult joinRoomFailure(Long roomId){
-        imNetworkRoomService.joinRoomFailure(roomId.toString());
-        return succeed();
-    }
-
-    @RequestMapping(value = "/statusSync")
-    public void statusSync(@RequestBody String body) throws Exception {
-        ImChannelStateNotify notify = JSONObject.parseObject(body, ImChannelStateNotify.class);
-        log.info("statusSyncParam: {}",JSONObject.toJSON(notify));
-        switch (notify.getEvent()) {
-            case 11:
-                //成员加入
-                imNetworkRoomService.joinRoomSuccess(notify.getChannelId(),Long.parseLong(notify.getUserId()));
-                break;
-            case 12:
-                //成员退出
-                imNetworkRoomService.leaveRoomSuccess(notify.getChannelId(),Long.parseLong(notify.getUserId()));
-                break;
-        }
-    }
-
-    @ApiOperation("退出网络教室")
-    @ApiImplicitParam(name = "roomId", dataType = "Long", value = "课程编号")
-    @PostMapping(value = "/leave", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
-    public HttpResponseResult leaveRoom(Long roomId) throws Exception {
-        imNetworkRoomService.leaveRoom(roomId.toString(),UserRoleEnum.TEACHER);
-        return succeed();
-    }
-
-    @ApiOperation("控制学员节拍器")
-    @PostMapping(value = "/sendImPlayMidiMessage", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
-    public HttpResponseResult sendImPlayMidiMessage(@RequestBody ImNetworkCustomMessage customMessage) throws Exception {
-        imNetworkRoomService.sendImPlayMidiMessage(customMessage);
-        return succeed();
-    }
-
-    @ApiOperation("移动端用来渲染页面")
-    @PostMapping(value = "/display", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
-    public HttpResponseResult display(@RequestBody ImNetworkDisplayDataDto displayData) throws Exception {
-        imNetworkRoomService.display(displayData);
-        return succeed();
-    }
-
-    @ApiOperation(value = "批量控制学员设备开关")
-    @PostMapping(value = "/device/batchControl", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
-    public Object batchControlDevice(@RequestBody ImNetworkDeviceControlDto deviceControl)throws Exception {
-        imNetworkRoomService.batchControlDevice(deviceControl);
-        return succeed();
-    }
-
-    @ApiOperation(value = "控制学员设备开关")
-    @PostMapping(value = "/device/control", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
-    public HttpResponseResult controlDevice(@RequestBody ImNetworkDeviceControlDto deviceControl)
-            throws Exception {
-        imNetworkRoomService.controlDevice(deviceControl);
-        return succeed();
-    }
-
-    @ApiOperation(value = "学员同意打开,麦克风、摄像头")
-    @PostMapping(value = "/device/approve", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
-    public HttpResponseResult approveControlDevice(@RequestBody ImNetworkDeviceControlDto deviceControl) throws Exception {
-        imNetworkRoomService.approveControlDevice(deviceControl);
-        return succeed();
-    }
-
-    @ApiOperation(value = "学员拒绝打开,麦克风、摄像头")
-    @PostMapping(value = "/device/reject", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
-    public HttpResponseResult rejectControlDevice(@RequestBody ImNetworkDeviceControlDto deviceControl)
-            throws Exception {
-        imNetworkRoomService.rejectControlDevice(deviceControl);
-        return succeed();
-    }
-
-    @ApiOperation(value = "学员设备状态同步")
-    @PostMapping(value = "/device/sync", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
-    public Object deviceStatusSync(@RequestBody ImNetworkDeviceControlDto deviceControl)
-            throws Exception {
-        imNetworkRoomService.deviceStatusSync(deviceControl);
-        return succeed();
-    }
-
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "roomId", dataType = "String", value = "房间号",required = true),
-            @ApiImplicitParam(name = "accompanimentId", dataType = "Long", value = "伴奏编号",required = true)
-    })
-    @ApiOperation(value = "老师在网络教室选择完伴奏后、通知学员下载伴奏")
-    @PostMapping(value = "pushDownloadMusicSheetMsg", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
-    public HttpResponseResult pushDownloadMusicSheetMsg(String roomId,Long accompanimentId) throws Exception {
-        imNetworkRoomService.pushDownloadMusicSheetMsg(roomId,accompanimentId);
-        return succeed();
-    }
-
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "roomId", dataType = "String", value = "房间号",required = true),
-            @ApiImplicitParam(name = "accompanimentId", dataType = "Long", value = "伴奏编号",required = false),
-            @ApiImplicitParam(name = "status", dataType = "Integer", value = "伴奏下载状态(1下载成功0下载中2下载失败)",required = true)
-    })
-    @ApiOperation(value = "学员伴奏下载状态回调")
-    @PostMapping(value = "musicSheetDownNotify", consumes = MediaType.MULTIPART_FORM_DATA_VALUE, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
-    public HttpResponseResult adjustMusicScore(String roomId,Long accompanimentId,Integer status) throws Exception {
-        imNetworkRoomService.musicSheetDownNotify(roomId,accompanimentId,status);
-        return succeed();
-    }
-}
-

+ 0 - 29
cooleshow-user/user-teacher/src/main/java/com/yonge/cooleshow/teacher/controller/ImNetworkRoomMemberController.java

@@ -1,29 +0,0 @@
-package com.yonge.cooleshow.teacher.controller;
-
-
-import com.yonge.cooleshow.biz.dal.service.ImNetworkRoomMemberService;
-import com.yonge.cooleshow.common.controller.BaseController;
-import io.swagger.annotations.Api;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-
-/**
- * 网络教室成员(ImNetworkRoomMember)表控制层
- *
- * @author zx
- * @since 2022-03-30 16:36:37
- */
-@Api(tags = "网络教室成员")
-@RestController
-@RequestMapping("/imNetworkRoomMember")
-public class ImNetworkRoomMemberController extends BaseController {
-    /**
-     * 服务对象
-     */
-    @Resource
-    private ImNetworkRoomMemberService imNetworkRoomMemberService;
-
-}
-