| 
					
				 | 
			
			
				@@ -321,6 +321,7 @@ public class RoomServiceImpl implements RoomService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         msg.setUserName(roomMember.getName()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         msg.setCamera(true); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Boolean playMidi = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Boolean examSong = false; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(roleEnum == RoleStudent){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             String midiByCourseIdAndUserId = courseScheduleStudentPaymentDao.getMidiByCourseIdAndUserId(schedule.getId().toString(), userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             //获取节拍器信息 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -330,9 +331,15 @@ public class RoomServiceImpl implements RoomService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     playMidi = Boolean.parseBoolean(jsonObject.get("enable").toString()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            String examJson = courseScheduleStudentPaymentDao.getExamJsonByCourseIdAndUserId(schedule.getId(), Integer.parseInt(userId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if(StringUtils.isNotEmpty(examJson)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ExamSongDownloadData examSongDownloadData = JSON.parseObject(examJson, ExamSongDownloadData.class); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                playMidi = examSongDownloadData.getEnable(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         msg.setHandUpOn(roomMember.isHand()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         msg.setMetronomeSwitch(playMidi); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        msg.setExamSongSwitch(examSong); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         imHelper.publishMessage(userId, roomId, msg); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         log.info("join room success: roomId = {}, userId = {}, role = {}", roomId, userId, roleEnum); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         signInSuccess(roomMember); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -341,11 +348,19 @@ public class RoomServiceImpl implements RoomService { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public void signInSuccess(RoomMember roomMember) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String roomId = roomMember.getRid(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         String userId = roomMember.getUid(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Long currentRoomId = Long.parseLong(redisTemplate.opsForValue().get(roomId + userId)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String currentRoomIdKey = roomId + userId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Long firstCourseId = Long.parseLong(roomId.substring(1)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        Long currentRoomId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if(redisTemplate.hasKey(currentRoomIdKey)){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            currentRoomId = Long.parseLong(redisTemplate.opsForValue().get(currentRoomIdKey)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        }else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            log.error("signInFailure: roomId={}, userId={}", roomId, userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            currentRoomId = firstCourseId; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         log.info("signInSuccess: currentRoomId={}", currentRoomId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         log.info("signInSuccess: roomId={}, userId={}", roomId, userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         Integer userIdInt = Integer.parseInt(userId); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        Long firstCourseId = Long.parseLong(roomId.substring(1)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         RoleEnum roleEnum = RoleEnum.getEnumByValue(roomMember.getRole()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         if(roleEnum == RoleTeacher){ 
			 |