|
@@ -86,7 +86,7 @@ public class RoomServiceImpl implements RoomService {
|
|
|
@Override
|
|
|
public void configRecord(String roomId,String userId) throws Exception {
|
|
|
ExamRoom examRoom = eduUserFeignService.getExamRoom(Integer.parseInt(roomId));
|
|
|
- RoomMember roomMembers = roomMemberDao.findByRidAndUid(roomId, userId);
|
|
|
+ RoomMember roomMember = roomMemberDao.findByRidAndUid(roomId, userId);
|
|
|
// imHelper.configRecord(roomId,userId);
|
|
|
}
|
|
|
|
|
@@ -1491,82 +1491,32 @@ public class RoomServiceImpl implements RoomService {
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class, isolation = Isolation.READ_COMMITTED)
|
|
|
- public boolean statusSync(String roomId,String userId) throws Exception {
|
|
|
- log.info("statusSync: roomId={}, userId={}", roomId, userId);
|
|
|
- RoomMember roomMember = roomMemberDao.findByRidAndUid(roomId, userId);
|
|
|
- if(roomMember != null){
|
|
|
-// SysUser sysUser = sysUserFeignService.queryUserById(Integer.parseInt(userId));
|
|
|
-
|
|
|
- List<Room> roomList = roomDao.findByRid(roomId);
|
|
|
- if (roomList.size() == 0) {
|
|
|
- log.error("room : {} not exist ", roomId);
|
|
|
- throw new ApiException(ErrorEnum.ERR_ROOM_NOT_EXIST);
|
|
|
- }
|
|
|
-
|
|
|
-// List<RoomMember> roomMemberList = roomMemberDao.findByRidAndUid(roomId, userId);
|
|
|
- /*if (roomMemberList.size() == 0) {
|
|
|
- log.error("{} not exist in room: {}", userId, roomId);
|
|
|
- throw new ApiException(ErrorEnum.ERR_USER_NOT_EXIST_IN_ROOM);
|
|
|
+ public boolean statusSync(ChannelStateNotify notify) throws Exception {
|
|
|
+// String roomId = notify.getChannelId();
|
|
|
+// String userId = notify.getUserId();
|
|
|
+// ExamRoom examRoom = eduUserFeignService.getExamRoom(Integer.parseInt(roomId));
|
|
|
+// RoomMember roomMember = roomMemberDao.findByRidAndUid(roomId, userId);
|
|
|
+ if(notify.getEvent() == 1){
|
|
|
+ //同步房间信息
|
|
|
+ }else if(notify.getEvent() == 2){
|
|
|
+ //房间创建
|
|
|
+ }else if(notify.getEvent() == 3){
|
|
|
+ //房间销毁
|
|
|
+ }else if(notify.getEvent() == 11){
|
|
|
+ //成员加入
|
|
|
+ /*if(roomMember.getRole() != 3){
|
|
|
+ this.configRecord(roomId,userId);
|
|
|
}*/
|
|
|
-
|
|
|
- int userRole = roomMember.getRole();
|
|
|
- log.info("statusSync: roomId={}, role={}", roomId, RoleEnum.getEnumByValue(userRole));
|
|
|
-
|
|
|
- if (userRole == RoleEnum.MainTeacher.getValue() || userRole == RoleEnum.AssistantTeacher.getValue()) {
|
|
|
- if (isUserDisplay(roomList.get(0), userId)) {
|
|
|
- try {
|
|
|
- updateDisplay(roomId, userId, "", 0);
|
|
|
- }catch (Exception e){
|
|
|
- log.error(e.getMessage());
|
|
|
- }
|
|
|
- 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) {
|
|
|
- IMApiResultInfo apiResultInfo = null;
|
|
|
- try {
|
|
|
- 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 {
|
|
|
- MemberChangedMessage msg = new MemberChangedMessage(MemberChangedMessage.Action_Leave, userId, userRole);
|
|
|
- imHelper.publishMessage(userId, roomId, msg);
|
|
|
-
|
|
|
- /*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);
|
|
|
- imHelper.publishMessage(userId, roomId, msg);
|
|
|
- imHelper.quit(new String[]{userId}, roomId);
|
|
|
- log.info("quit group: roomId={},userId: {}", roomId,userId);
|
|
|
- } else {
|
|
|
- throw new ApiException(ErrorEnum.ERR_EXIT_ROOM_ERROR, apiResultInfo.getErrorMessage());
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("leave room error: roomId={}, {}", roomId, e.getMessage());
|
|
|
- throw new ApiException(ErrorEnum.ERR_EXIT_ROOM_ERROR);
|
|
|
- }*/
|
|
|
- }
|
|
|
- userDao.deleteByUid(userId);
|
|
|
- return true;
|
|
|
+ }else if(notify.getEvent() == 12){
|
|
|
+ //成员退出
|
|
|
+ /*if(roomMember.getRole() != 3){
|
|
|
+ this.configRecord(roomId,userId);
|
|
|
+ }else {
|
|
|
+ this.stopRecord(roomId,userId);
|
|
|
+ }*/
|
|
|
+ this.leaveRoom(null,notify.getChannelId(),notify.getUserId());
|
|
|
+ }else if(notify.getEvent() == 20){
|
|
|
+ //资源发生变动
|
|
|
}
|
|
|
return true;
|
|
|
}
|