|
@@ -240,37 +240,35 @@ public class RoomServiceImpl implements RoomService {
|
|
|
if(roomMember == null){
|
|
|
return ;
|
|
|
}
|
|
|
+
|
|
|
log.info("joinRoomSuccess : roomId={}, userId={}", roomId, userId);
|
|
|
RoleEnum roleEnum = RoleEnum.getEnumByValue(roomMember.getRole());
|
|
|
- CourseSchedule schedule = courseScheduleDao.get(Long.parseLong(roomId.substring(1)));
|
|
|
+ CourseSchedule schedule = courseScheduleDao.getLock(Long.parseLong(roomId.substring(1)));
|
|
|
|
|
|
String display = "";
|
|
|
if(roleEnum == RoleTeacher){
|
|
|
//如果是老师加入房间,调整节拍器状态
|
|
|
courseScheduleStudentPaymentDao.adjustPlayMidi(schedule.getId(),null,null);
|
|
|
display = "display://type=1?userId=" + userId + "?uri=";
|
|
|
- updateDisplay(roomId, userId, display, 0);
|
|
|
}else if (roleEnum == RoleEnum.RoleAssistant){
|
|
|
display = "display://type=0?userId=" + userId + "?uri=";
|
|
|
- updateDisplay(roomId, userId, display, 0);
|
|
|
}
|
|
|
-
|
|
|
Date curTime = DateTimeUtils.currentUTC();
|
|
|
Room room = roomDao.findByRid(roomId);
|
|
|
if (room == null) {
|
|
|
//如果房间不存在,删除除了自己之外的其他用户
|
|
|
// roomMemberDao.deleteRoomMember(roomId,userId);
|
|
|
- try {
|
|
|
- saveRoom(roomId, roomId, curTime, display);
|
|
|
- }catch (Exception e){
|
|
|
- log.error("joinRoomSuccess saveRoom error: {}", e.getMessage());
|
|
|
- }
|
|
|
+ saveRoom(roomId, roomId, curTime, display);
|
|
|
IMApiResultInfo resultInfo = imHelper.createGroup(new String[]{userId}, roomId, roomId);
|
|
|
if (!resultInfo.isSuccess()) {
|
|
|
log.error("joinRoomSuccess createGroup error: roomId={}, {}", roomId, resultInfo.getErrorMessage());
|
|
|
throw new ApiException(ErrorEnum.ERR_CREATE_ROOM_ERROR, resultInfo.getErrorMessage());
|
|
|
}
|
|
|
}
|
|
|
+ if(roleEnum == RoleTeacher || roleEnum == RoleEnum.RoleAssistant){
|
|
|
+ updateDisplay(roomId, userId, display, 0);
|
|
|
+ }
|
|
|
+
|
|
|
UserInfo userInfo = userDao.findByUid(userId);
|
|
|
if (userInfo == null) {
|
|
|
userInfo = new UserInfo();
|