zouxuan %!s(int64=3) %!d(string=hai) anos
pai
achega
3afaae00ac

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

@@ -85,7 +85,10 @@ public interface CourseScheduleStudentPaymentDao extends BaseMapper<CourseSchedu
      * @author zx
      * @date 2022/5/7 16:44
      */
-    void adjustPlayMidiAndMusicSheet(Long scheduleId, Long userId, String content, String musicSheetJson);
+    void adjustPlayMidiAndMusicSheet(@Param("scheduleId") Long scheduleId,
+                                     @Param("userId") Long userId,
+                                     @Param("content") String content,
+                                     @Param("musicSheetJson") String musicSheetJson);
 
     //查询报课学员
     List<CourseScheduleStudentVo> selectUser();

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

@@ -25,6 +25,8 @@ import org.springframework.util.CollectionUtils;
 
 import javax.annotation.Resource;
 import java.util.*;
+import java.util.function.BiConsumer;
+import java.util.function.Consumer;
 import java.util.stream.Collectors;
 
 /**
@@ -260,6 +262,7 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
     public void pushDownloadMusicSheetMsg(ImNetworkMusicSheetDto musicSheetDto) throws Exception {
         Long courseScheduleId = Optional.ofNullable(musicSheetDto).map(ImNetworkBaseDto::getRoomId).orElseThrow(() -> new BizException("房间编号不能为空"));
         Long accompanimentId = Optional.ofNullable(musicSheetDto).map(ImNetworkMusicSheetDto::getAccompanimentId).orElseThrow(() -> new BizException("伴奏编号不能为空"));
+        log.info("pushDownloadMusicSheetMsg: courseScheduleId:{} ,accompanimentId:{} ,deviceType:{}", courseScheduleId,accompanimentId);
         Long userId = sysUserService.getUserId();
         List<CourseScheduleStudentMusicSheetResult> scheduleStudentMusicSheetResults = courseScheduleStudentMusicSheetService.getDao().
                 queryBySheetIdAndCourseId(accompanimentId, courseScheduleId, null, null, 0);
@@ -335,6 +338,7 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
                     deviceType == ImNetworkDeviceTypeEnum.MUSIC_SHEET ||
                     deviceType == ImNetworkDeviceTypeEnum.ACCOMPANIMENT) {
                 List<CourseScheduleStudentPayment> studentPayments = courseScheduleStudentPaymentService.getDao().queryByCourseId(Long.parseLong(deviceControl.getRoomId()));
+
                 for (CourseScheduleStudentPayment studentPayment : studentPayments) {
                     deviceControl.setUserId(studentPayment.getUserId());
                     controlDevice(deviceControl);
@@ -355,20 +359,21 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void controlDevice(ImNetworkDeviceControlDto deviceControl) throws Exception {
-        log.info("controlDevice in deviceControl = {}", deviceControl);
         SysUser sysUser = sysUserService.getUser();
         String roomId = deviceControl.getRoomId();
         Long userId = deviceControl.getUserId();
-        if(deviceControl.getEnable()){
+        Boolean enable = deviceControl.getEnable();
+        log.info("controlDevice: roomId:{} ,deviceType:{} ,enable:{} ,userId:{}", roomId,deviceControl.getDeviceType(),enable);
+        if(enable){
             long scheduleId = Long.parseLong(roomId);
-            ImNetworkDeviceStateChangedMessage deviceResourceMessage = new ImNetworkDeviceStateChangedMessage(deviceControl.getDeviceType().ordinal(),deviceControl.getEnable());
+            ImNetworkDeviceStateChangedMessage deviceResourceMessage = new ImNetworkDeviceStateChangedMessage(deviceControl.getDeviceType().ordinal(),enable);
             deviceResourceMessage.setUserId(userId.toString());
             switch (deviceControl.getDeviceType()) {
                 case EXAM_SONG:
                     ImNetworkRoomMusicSheetDownloadData msg = courseScheduleStudentPaymentService.getMemberExamSong(scheduleId, userId);
-                    msg.setEnable(deviceControl.getEnable());
+                    msg.setEnable(enable);
                     courseScheduleStudentPaymentService.getDao().adjustExamSong(scheduleId,userId, JSON.toJSONString(msg));
-                    imHelper.publishMessage(userId.toString(), deviceControl.getRoomId(), deviceResourceMessage, 1);
+                    imHelper.publishMessage(userId.toString(), roomId, deviceResourceMessage, 1);
                     break;
                 case MUSIC_SHEET:
                     Integer musicSheetId = Optional.ofNullable(deviceControl.getMusicSheetAccompanimentId()).
@@ -449,7 +454,7 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void approveControlDevice(ImNetworkDeviceControlDto deviceControl) throws Exception {
-        log.info("approveControlDevice: deviceControl={}", deviceControl);
+        log.info("approveControlDevice: roomId:{} ,deviceType:{} ,enable:{}", deviceControl.getRoomId(),deviceControl.getDeviceType(),deviceControl.getEnable());
         SysUser sysUser = sysUserService.getUser();
         ImNetworkRoomMember roomMember = Optional.ofNullable(imNetworkRoomMemberService.getDao().findByRidAndUid(deviceControl.getRoomId(), sysUser.getId())).
                 orElseThrow(()-> new BizException("用户不在房间内"));
@@ -488,7 +493,7 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void deviceStatusSync(ImNetworkDeviceControlDto deviceStatusSync) throws Exception {
-        log.info("deviceStatusSync: deviceStatusSync={}", deviceStatusSync);
+        log.info("deviceStatusSync: enable:{} ,roomId:{} ,deviceType:{}", deviceStatusSync.getEnable(),deviceStatusSync.getRoomId(),deviceStatusSync.getDeviceType());
         Long userId = sysUserService.getUserId();
         ImNetworkDeviceTypeEnum deviceType = deviceStatusSync.getDeviceType();
         ImNetworkRoomMember roomMember = Optional.ofNullable(imNetworkRoomMemberService.getDao().
@@ -541,7 +546,7 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void rejectControlDevice(ImNetworkDeviceControlDto deviceControl) throws Exception {
-        log.info("rejectControlDevice: deviceControl={}", deviceControl);
+        log.info("rejectControlDevice: roomId:{} ,deviceType:{}", deviceControl.getRoomId(),deviceControl.getDeviceType());
         SysUser sysUser = sysUserService.getUser();
         ImNetworkControlDeviceNotifyMessage msg = new ImNetworkControlDeviceNotifyMessage(ImNetworkActionEnum.REJECT.ordinal());
         msg.setType(deviceControl.getDeviceType().ordinal());
@@ -560,7 +565,7 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
         Long roomId = Optional.ofNullable(musicSheetDto).map(ImNetworkBaseDto::getRoomId).orElseThrow(() -> new BizException("房间编号不能为空"));
         Long accompanimentId = Optional.ofNullable(musicSheetDto).map(ImNetworkMusicSheetDto::getAccompanimentId).orElseThrow(() -> new BizException("伴奏编号不能为空"));
         Integer status = Optional.ofNullable(musicSheetDto).map(ImNetworkMusicSheetDto::getStatus).orElseThrow(() -> new BizException("伴奏下载状态不能为空"));
-        log.info("musicSheetDownNotify: musicSheetDto={}", musicSheetDto);
+        log.info("musicSheetDownNotify: roomId:{} ,accompanimentId:{} ,status:{}", roomId,accompanimentId,status);
         Long userId = sysUserService.getUserId();
         List<CourseScheduleStudentMusicSheetResult> studentMusicSheetResults = courseScheduleStudentMusicSheetService.getDao().queryBySheetIdAndCourseId(accompanimentId, roomId,userId, null, null);
         if(CollectionUtils.isEmpty(studentMusicSheetResults)){

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

@@ -64,10 +64,10 @@
         UPDATE course_schedule_student_payment cssp
         <set>
             <if test="content == null or content == ''">
-                cssp.open_play_midi_ = NULL,cssp.updated_time_ = NOW()
+                cssp.open_play_midi_ = NULL,cssp.updated_time_ = NOW(),
             </if>
             <if test="content != null and content != ''">
-                cssp.open_play_midi_ = #{content},cssp.updated_time_ = NOW()
+                cssp.open_play_midi_ = #{content},cssp.updated_time_ = NOW(),
             </if>
             <if test="examSongJson != null">
                 cssp.exam_song_download_json_ = #{examSongJson}