|
@@ -117,9 +117,10 @@ public class RoomServiceImpl implements RoomService {
|
|
|
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 {
|
|
|
+// scheduleManager.addExpiredTask(this, roomId);
|
|
|
+// }
|
|
|
} else {
|
|
|
display = roomList.get(0).getDisplay();
|
|
|
}
|
|
@@ -206,6 +207,7 @@ public class RoomServiceImpl implements RoomService {
|
|
|
roomResult.setUserInfo(userResult);
|
|
|
roomResult.setDisplay(display);
|
|
|
roomResult.setRoomId(roomId);
|
|
|
+
|
|
|
List<RoomMember> roomMemberList = roomMemberDao.findByRid(roomId);
|
|
|
roomResult.setMembers(roomMemberList);
|
|
|
|
|
@@ -287,7 +289,7 @@ public class RoomServiceImpl implements RoomService {
|
|
|
roomMemberDao.deleteUserByRidAndUid(roomId, userId);
|
|
|
roomDao.deleteByRid(roomId);
|
|
|
deleteWhiteboardByUser(roomId, userId);
|
|
|
- log.info("dismiss the room: {}", roomId);
|
|
|
+ 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());
|
|
@@ -306,7 +308,7 @@ public class RoomServiceImpl implements RoomService {
|
|
|
msg.setUserName(user.getUsername());
|
|
|
imHelper.publishMessage(userId, roomId, msg);
|
|
|
imHelper.quit(new String[]{userId}, roomId);
|
|
|
- log.info("quit group: roomId={}", roomId);
|
|
|
+ log.info("quit group: roomId={},userId: {}", roomId,userId);
|
|
|
} else {
|
|
|
throw new ApiException(ErrorEnum.ERR_EXIT_ROOM_ERROR, apiResultInfo.getErrorMessage());
|
|
|
}
|
|
@@ -335,18 +337,20 @@ public class RoomServiceImpl implements RoomService {
|
|
|
public void destroyRoom(String roomId) {
|
|
|
roomDao.deleteByRid(roomId);
|
|
|
whiteboardDao.deleteByRid(roomId);
|
|
|
-
|
|
|
- List<RoomMember> list = roomMemberDao.findByRid(roomId);
|
|
|
- if (!list.isEmpty()) {
|
|
|
- try {
|
|
|
- imHelper.dismiss(list.get(0).getUid(), roomId);
|
|
|
- } catch (Exception e) {
|
|
|
- log.error("destroyRoom: {}", e.getMessage());
|
|
|
- e.printStackTrace();
|
|
|
+ List<Room> roomList = roomDao.findByRid(roomId);
|
|
|
+ if (roomList.isEmpty()) {
|
|
|
+ List<RoomMember> list = roomMemberDao.findByRid(roomId);
|
|
|
+ if (!list.isEmpty()) {
|
|
|
+ try {
|
|
|
+ imHelper.dismiss(list.get(0).getUid(), roomId);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("destroyRoom: {}", e.getMessage());
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
+ roomMemberDao.deleteByRid(roomId);
|
|
|
+ log.info("destroyRoom: {}", roomId);
|
|
|
}
|
|
|
- roomMemberDao.deleteByRid(roomId);
|
|
|
- log.info("destroyRoom: {}", roomId);
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
@@ -404,7 +408,6 @@ public class RoomServiceImpl implements RoomService {
|
|
|
|
|
|
@Override
|
|
|
public Boolean kickMember(String roomId) throws ApiException, Exception {
|
|
|
- String token = SecurityUtils.getAuthenticationValue();
|
|
|
SysUser authUser = sysUserFeignService.queryUserInfo();
|
|
|
String userId = authUser.getId().toString();
|
|
|
CheckUtils.checkArgument(userId != null, "userId must't be null");
|
|
@@ -1108,7 +1111,7 @@ public class RoomServiceImpl implements RoomService {
|
|
|
roomMemberDao.deleteUserByRidAndUid(member.getRid(), member.getUid());
|
|
|
roomDao.deleteByRid(member.getRid());
|
|
|
deleteWhiteboardByUser(member.getRid(), member.getUid());
|
|
|
- log.info("dismiss the room: {}", member.getRid());
|
|
|
+ log.info("dismiss the room: {},userId: {}", member.getRid(),userId);
|
|
|
} else {
|
|
|
log.error("{} exit {} room error: {}", member.getUid(), member.getRid(), apiResultInfo.getErrorMessage());
|
|
|
}
|
|
@@ -1121,7 +1124,7 @@ public class RoomServiceImpl implements RoomService {
|
|
|
msg.setUserName(member.getName());
|
|
|
imHelper.publishMessage(member.getUid(), member.getRid(), msg);
|
|
|
imHelper.quit(new String[]{member.getUid()}, member.getRid());
|
|
|
- log.info("quit group: roomId={}, {}", member.getRid(), member.getUid());
|
|
|
+ log.info("quit group: roomId={},userId: {}", member.getRid(), member.getUid());
|
|
|
} else {
|
|
|
log.error("{} exit {} room error: {}", member.getUid(), member.getRid(), apiResultInfo.getErrorMessage());
|
|
|
}
|
|
@@ -1183,7 +1186,7 @@ public class RoomServiceImpl implements RoomService {
|
|
|
roomMemberDao.deleteUserByRidAndUid(roomId, userId);
|
|
|
roomDao.deleteByRid(roomId);
|
|
|
deleteWhiteboardByUser(roomId, userId);
|
|
|
- log.info("dismiss the room: {}", roomId);
|
|
|
+ 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());
|
|
@@ -1202,7 +1205,7 @@ public class RoomServiceImpl implements RoomService {
|
|
|
msg.setUserName(sysUser.getUsername());
|
|
|
imHelper.publishMessage(userId, roomId, msg);
|
|
|
imHelper.quit(new String[]{userId}, roomId);
|
|
|
- log.info("quit group: roomId={}", roomId);
|
|
|
+ log.info("quit group: roomId={},userId: {}", roomId,userId);
|
|
|
} else {
|
|
|
throw new ApiException(ErrorEnum.ERR_EXIT_ROOM_ERROR, apiResultInfo.getErrorMessage());
|
|
|
}
|