|
@@ -211,10 +211,6 @@ public class RoomServiceImpl implements RoomService {
|
|
|
StudentExamResultApiDto examResult = null;
|
|
|
if(registrationId != null){
|
|
|
examResult = eduUserFeignService.getExamResult(registrationId);
|
|
|
- /*Integer recordFlag = examResult.getRecordFlag();
|
|
|
- if(recordFlag != null && recordFlag == 1){
|
|
|
- joinRecorded(registrationId);
|
|
|
- }*/
|
|
|
roomId = examResult.getRoomId();
|
|
|
}
|
|
|
|
|
@@ -233,22 +229,11 @@ public class RoomServiceImpl implements RoomService {
|
|
|
isAssistant = true;
|
|
|
}
|
|
|
}
|
|
|
-// String display = "";
|
|
|
Date curTime = DateTimeUtils.currentUTC();
|
|
|
List<Room> roomList = roomDao.findByRid(roomId);
|
|
|
if (roomList.isEmpty()) {
|
|
|
saveRoom(roomId, roomId, curTime, null);
|
|
|
- /*IMApiResultInfo resultInfo = imHelper.createGroup(new String[]{userId}, roomId, roomId);
|
|
|
- if (!resultInfo.isSuccess()) {
|
|
|
- log.error("joinRoom IM error: roomId={}, {}", roomId, resultInfo.getErrorMessage());
|
|
|
- throw new ApiException(ErrorEnum.ERR_CREATE_ROOM_ERROR, resultInfo.getErrorMessage());
|
|
|
- }
|
|
|
- else {
|
|
|
- scheduleManager.addExpiredTask(this, roomId);
|
|
|
- }*/
|
|
|
- }/* else {
|
|
|
- display = roomList.get(0).getDisplay();
|
|
|
- }*/
|
|
|
+ }
|
|
|
RoleEnum roleEnum;
|
|
|
RoomResult roomResult = new RoomResult();
|
|
|
BaseResponse baseResponse = new BaseResponse(roomResult);
|
|
@@ -275,10 +260,7 @@ public class RoomServiceImpl implements RoomService {
|
|
|
roleEnum = Student;
|
|
|
}
|
|
|
saveRoomMember(userId,sysUser.getAvatar(), realName, roomId, roleEnum.getValue(), !isDisableCamera,!isMusicMode, curTime,registrationId);
|
|
|
- /*IMApiResultInfo resultInfo = imHelper.joinGroup(new String[]{userId}, roomId, roomId);
|
|
|
- if (!resultInfo.isSuccess()) {
|
|
|
- throw new ApiException(ErrorEnum.ERR_CREATE_ROOM_ERROR, resultInfo.getErrorMessage());
|
|
|
- }*/
|
|
|
+
|
|
|
userResult.setMicrophone(true);
|
|
|
userResult.setCamera(!isDisableCamera);
|
|
|
userResult.setHandUp(false);
|
|
@@ -299,7 +281,6 @@ public class RoomServiceImpl implements RoomService {
|
|
|
return getBaseResponse(baseResponse);
|
|
|
}
|
|
|
}
|
|
|
-// roomMemberDao.updateCameraByRidAndUid(roomId, userId, !isDisableCamera);
|
|
|
userResult.setCamera(roomMember.isCamera());
|
|
|
userResult.setHandUp(roomMember.isHand());
|
|
|
userResult.setJoinTime(roomMember.getJoinDt());
|
|
@@ -311,15 +292,6 @@ public class RoomServiceImpl implements RoomService {
|
|
|
msg.setUserName(realName);
|
|
|
msg.setCamera(!isDisableCamera);
|
|
|
imHelper.publishMessage(userId, roomId, msg);
|
|
|
- /*if (roleEnum == RoleEnum.MainTeacher) {
|
|
|
- display = "display://type=0?userId=" + userId + "?uri=";
|
|
|
- updateDisplay(roomId, userId, display, 0);
|
|
|
- log.info("joinRoom, display changed: roomId={}, {}, userId={}", roomId, display, userId);
|
|
|
- } else if (roleEnum == RoleEnum.AssistantTeacher && display.isEmpty()) {
|
|
|
- display = "display://type=1?userId=" + userId + "?uri=";
|
|
|
- updateDisplay(roomId, userId, display, 0);
|
|
|
- log.info("joinRoom, display changed: roomId={}, {}, userId={}", roomId, display, userId);
|
|
|
- }*/
|
|
|
|
|
|
List<UserInfo> userInfoList = userDao.findByUid(userId);
|
|
|
if (userInfoList.isEmpty()) {
|
|
@@ -339,7 +311,6 @@ public class RoomServiceImpl implements RoomService {
|
|
|
userResult.setUserId(userId);
|
|
|
userResult.setRole(roleEnum.getValue());
|
|
|
roomResult.setUserInfo(userResult);
|
|
|
-// roomResult.setDisplay(display);
|
|
|
roomResult.setRoomId(roomId);
|
|
|
if (registrationId != null){
|
|
|
roomResult.setRegistrationId(registrationId);
|
|
@@ -347,8 +318,6 @@ public class RoomServiceImpl implements RoomService {
|
|
|
roomResult.setExamFlag(examRoom.getExamFlag());
|
|
|
List<RoomMember> roomMembers = roomMemberDao.findByRid(roomId);
|
|
|
roomResult.setMembers(roomMembers,examRoom.getShieldUserId());
|
|
|
-// List<Whiteboard> whiteboardList = whiteboardDao.findByRid(roomId);
|
|
|
-// roomResult.setWhiteboards(whiteboardList);
|
|
|
log.info("join success: roomId = {}, userId = {}, userName={}, role = {}", roomId, userId, roleEnum);
|
|
|
if(registrationId != null){
|
|
|
if(examResult.getIsFinishedExam() == 1){
|
|
@@ -357,10 +326,9 @@ public class RoomServiceImpl implements RoomService {
|
|
|
this.publishMessage(eduUserFeignService.getPublishMessage(registrationId));
|
|
|
eduUserFeignService.upsetStudentAttendance(registrationId,0);
|
|
|
imHelper.startRecord(userId,roomId, registrationId,roomMembers);
|
|
|
-// eduUserFeignService.updateSessionId(registrationId,imApiResultInfo.getSessionId());
|
|
|
+ //踢出其他学员
|
|
|
}else {
|
|
|
eduUserFeignService.upsetTeacherAttendance(examRoom.getId(),sysUser.getId(),0);
|
|
|
-// imHelper.configRecord(roomId, registrationId,roomMembers);
|
|
|
}
|
|
|
return baseResponse;
|
|
|
}
|
|
@@ -371,7 +339,6 @@ public class RoomServiceImpl implements RoomService {
|
|
|
room.setName(roomName);
|
|
|
room.setCreateDt(createTime);
|
|
|
room.setDisplay(display);
|
|
|
-// room.setWhiteboardNameIndex(0);
|
|
|
try {
|
|
|
roomDao.save(room);
|
|
|
}catch (Exception e){
|
|
@@ -398,10 +365,6 @@ public class RoomServiceImpl implements RoomService {
|
|
|
public Boolean leaveRoom(Long registrationId,String roomId,String userId) throws Exception {
|
|
|
if(registrationId != null){
|
|
|
StudentExamResultApiDto examResult = eduUserFeignService.getExamResult(registrationId);
|
|
|
- /*Integer recordFlag = examResult.getRecordFlag();
|
|
|
- if(recordFlag != null && recordFlag == 1){
|
|
|
- levelRecorded(registrationId);
|
|
|
- }*/
|
|
|
roomId = examResult.getRoomId();
|
|
|
}
|
|
|
SysUser user;
|
|
@@ -411,12 +374,6 @@ public class RoomServiceImpl implements RoomService {
|
|
|
}else {
|
|
|
user = sysUserFeignService.queryUserById(Integer.parseInt(userId));
|
|
|
}
|
|
|
- /*if(StringUtils.isEmpty(userId)){
|
|
|
- user = sysUserFeignService.queryUserInfo();
|
|
|
- userId = user.getId().toString();
|
|
|
- }else {
|
|
|
- user = sysUserFeignService.queryUserById(Integer.parseInt(userId));
|
|
|
- }*/
|
|
|
log.info("leaveRoom: roomId={}, userId={}", roomId,userId);
|
|
|
|
|
|
CheckUtils.checkArgument(userId != null, "userId must't be null");
|
|
@@ -425,50 +382,19 @@ public class RoomServiceImpl implements RoomService {
|
|
|
if (roomList.size() == 0) {
|
|
|
log.error("room : {} not exist ", roomId);
|
|
|
return false;
|
|
|
-// throw new ApiException(ErrorEnum.ERR_ROOM_NOT_EXIST);
|
|
|
}
|
|
|
RoomMember roomMember = roomMemberDao.findByRidAndUid(roomId, userId);
|
|
|
if (roomMember == null) {
|
|
|
log.error("{} not exist in room: {}", userId, roomId);
|
|
|
return false;
|
|
|
-// throw new ApiException(ErrorEnum.ERR_USER_NOT_EXIST_IN_ROOM);
|
|
|
}
|
|
|
|
|
|
int userRole = roomMember.getRole();
|
|
|
log.info("leaveRoom: roomId={}, role={}", roomId, RoleEnum.getEnumByValue(userRole));
|
|
|
|
|
|
- /*if (userRole == RoleEnum.MainTeacher.getValue() || userRole == RoleEnum.AssistantTeacher.getValue()) {
|
|
|
- if (isUserDisplay(roomList.get(0), userId)) {
|
|
|
- updateDisplay(roomId, userId, "", 0);
|
|
|
- log.info("clear display cause speaker leave: roomId={}", roomId);
|
|
|
- } else {
|
|
|
- log.info("don't update current display: room={}, role={}", roomList.get(0), RoleEnum.getEnumByValue(userRole));
|
|
|
- }
|
|
|
- } else {
|
|
|
- log.info("don't update current display: room={}, userRole={}", roomList.get(0), RoleEnum.getEnumByValue(userRole));
|
|
|
- }*/
|
|
|
-
|
|
|
if (roomMemberDao.countByRid(roomId) == 1) {
|
|
|
roomMemberDao.deleteUserByRidAndUid(roomId, userId);
|
|
|
roomDao.deleteByRid(roomId);
|
|
|
- /*IMApiResultInfo apiResultInfo = null;
|
|
|
- try {
|
|
|
- roomMemberDao.deleteUserByRidAndUid(roomId, userId);
|
|
|
- roomDao.deleteByRid(roomId);
|
|
|
- apiResultInfo = imHelper.dismiss(userId, roomId);
|
|
|
- if (apiResultInfo.getCode() == 200) {
|
|
|
- roomMemberDao.deleteUserByRidAndUid(roomId, userId);
|
|
|
- roomDao.deleteByRid(roomId);
|
|
|
-// deleteWhiteboardByUser(roomId, userId);
|
|
|
- log.info("dismiss the room: {},userId: {}", roomId,userId);
|
|
|
- } else {
|
|
|
- log.error("{} exit {} room error: {}", userId, roomId, apiResultInfo.getErrorMessage());
|
|
|
- throw new ApiException(ErrorEnum.ERR_EXIT_ROOM_ERROR, apiResultInfo.getErrorMessage());
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("{} exit {} room error: {}", userId, roomId, e.getMessage());
|
|
|
- throw new ApiException(ErrorEnum.ERR_EXIT_ROOM_ERROR, e.getMessage());
|
|
|
- }*/
|
|
|
} else {
|
|
|
roomMemberDao.deleteUserByRidAndUid(roomId, userId);
|
|
|
MemberChangedMessage msg = new MemberChangedMessage(MemberChangedMessage.Action_Leave, userId, userRole);
|
|
@@ -477,8 +403,6 @@ public class RoomServiceImpl implements RoomService {
|
|
|
log.info("quit group: roomId={},userId: {}", roomId,userId);
|
|
|
}
|
|
|
userDao.deleteByUid(userId);
|
|
|
-// this.signOut(Long.parseLong(roomId));
|
|
|
-// this.publishMessage(eduUserFeignService.getPublishMessage(registrationId));
|
|
|
if(registrationId != null){
|
|
|
eduUserFeignService.upsetStudentAttendance(registrationId,1);
|
|
|
imHelper.stopRecord(userId,roomId);
|
|
@@ -516,42 +440,8 @@ public class RoomServiceImpl implements RoomService {
|
|
|
if (roomMemberDao.countByRid(roomId) == 1) {
|
|
|
roomMemberDao.deleteUserByRidAndUid(roomId, userId);
|
|
|
roomDao.deleteByRid(roomId);
|
|
|
-
|
|
|
- /*IMApiResultInfo apiResultInfo = null;
|
|
|
- try {
|
|
|
- apiResultInfo = imHelper.dismiss(userId, roomId);
|
|
|
- if (apiResultInfo.getCode() == 200) {
|
|
|
- roomMemberDao.deleteUserByRidAndUid(roomId, userId);
|
|
|
- roomDao.deleteByRid(roomId);
|
|
|
- log.info("levelRecorded dismiss the room: {},userId: {}", roomId,userId);
|
|
|
- } else {
|
|
|
- log.error("levelRecorded {} exit {} room error: {}", userId, roomId, apiResultInfo.getErrorMessage());
|
|
|
- throw new ApiException(ErrorEnum.ERR_EXIT_ROOM_ERROR, apiResultInfo.getErrorMessage());
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("levelRecorded {} exit {} room error: {}", userId, roomId, e.getMessage());
|
|
|
- throw new ApiException(ErrorEnum.ERR_EXIT_ROOM_ERROR, e.getMessage());
|
|
|
- }*/
|
|
|
} else {
|
|
|
roomMemberDao.deleteUserByRidAndUid(roomId, userId);
|
|
|
-
|
|
|
- /*IMApiResultInfo apiResultInfo = null;
|
|
|
- try {
|
|
|
- apiResultInfo = imHelper.quit(new String[]{userId}, roomId);
|
|
|
- if (apiResultInfo.isSuccess()) {
|
|
|
- roomMemberDao.deleteUserByRidAndUid(roomId, userId);
|
|
|
- MemberChangedMessage msg = new MemberChangedMessage(MemberChangedMessage.Action_Leave, userId, userRole);
|
|
|
- msg.setUserName(user.getUsername());
|
|
|
- imHelper.publishMessage(userId, roomId, msg);
|
|
|
- imHelper.quit(new String[]{userId}, roomId);
|
|
|
- log.info("levelRecorded quit group: roomId={},userId: {}", roomId,userId);
|
|
|
- } else {
|
|
|
- throw new ApiException(ErrorEnum.ERR_EXIT_ROOM_ERROR, apiResultInfo.getErrorMessage());
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("levelRecorded leave room error: roomId={}, {}", roomId, e.getMessage());
|
|
|
- throw new ApiException(ErrorEnum.ERR_EXIT_ROOM_ERROR);
|
|
|
- }*/
|
|
|
}
|
|
|
userDao.deleteByUid(userId);
|
|
|
if(registrationId != null){
|