zouxuan %!s(int64=2) %!d(string=hai) anos
pai
achega
c4a8b361aa

+ 1 - 1
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/RoomService.java

@@ -20,7 +20,7 @@ public interface RoomService extends IService<ImNetworkRoom> {
     ImNetworkRoomDao getDao();
 
     //初始化网络教室基本信息
-    ImNetworkRoom initRoom(String roomId, RoleEnum userRole, Long userId) throws Exception;
+    ImNetworkRoom initRoom(String roomId, RoleEnum userRole, String imUserId) throws Exception;
 
     //获取腾讯相关房间配置信息
     RTCRoomConfig getRtcRoomConfig(String serviceProvider, ImNetworkRoomMember roomMember);

+ 5 - 6
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/ImNetworkRoomServiceImpl.java

@@ -91,8 +91,7 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
                 orElseThrow(()->new BizException("房间信息不存在"));
 
         RoleEnum userRole = RoleEnum.RoleStudent;
-        if(clientType == ClientEnum.TEACHER
-                || courseSchedule.getTeacherId().equals(userId)){
+        if(clientType == ClientEnum.TEACHER){
             userRole = RoleEnum.RoleTeacher;
         }
         log.info("joinRoom params:roomId:{},userRole:{},userId:{}",roomId,userRole,userId);
@@ -106,7 +105,8 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
         }
         ImNetworkRoomResult joinRoomResult = new ImNetworkRoomResult();
         //初始化房间信息
-        ImNetworkRoom room = roomService.initRoom(roomId,userRole,sysUser.getUserId());
+        String imUserId = imGroupService.getImUserId(sysUser.getUserId(), userRole);
+        ImNetworkRoom room = roomService.initRoom(roomId,userRole,imUserId);
         BeanUtils.copyProperties(room,joinRoomResult);
         //定时销毁房间
         //初始化房间用户信息
@@ -158,8 +158,7 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
                 orElseThrow(()->new BizException("房间信息不存在"));
 
         RoleEnum userRole = RoleEnum.RoleStudent;
-        if((imNetworkBaseDto.getClientType() != null && imNetworkBaseDto.getClientType() == ClientEnum.TEACHER)
-                || courseSchedule.getTeacherId().equals(userId)){
+        if(imNetworkBaseDto.getClientType() == ClientEnum.TEACHER){
             userRole = RoleEnum.RoleTeacher;
         }
         log.info("joinRoom params:roomId:{},userRole:{},userId:{}",roomId,userRole,userId);
@@ -239,7 +238,7 @@ public class ImNetworkRoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNe
             studentAttendanceService.signIn(userId,courseSchedule);
         }
         //获取房间信息
-        ImNetworkRoom room = roomService.initRoom(roomId, userRole, userId);
+        ImNetworkRoom room = roomService.initRoom(roomId, userRole, imUserId);
         //获取房间用户信息
         ImNetworkRoomMember roomMember = imNetworkRoomMemberService.initRoomMember(roomId,sysUser,userRole,!courseSchedule.getMuteAll());
         //发送人员变动消息

+ 3 - 3
cooleshow-user/user-biz/src/main/java/com/yonge/cooleshow/biz/dal/service/impl/RoomServiceImpl.java

@@ -59,11 +59,11 @@ public class RoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNetworkRoom
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public ImNetworkRoom initRoom(String roomId, RoleEnum userRole, Long userId) throws Exception {
+    public ImNetworkRoom initRoom(String roomId, RoleEnum userRole, String imUserId) throws Exception {
         ImNetworkRoom room = baseMapper.findByRoomId(roomId);
         String display = "";
         if (userRole == RoleEnum.RoleTeacher) {
-            display = "display://type=1?userId=" + userId + "?uri=";
+            display = "display://type=1?userId=" + imUserId + "?uri=";
         }
         if(Objects.isNull(room)){
             room = new ImNetworkRoom();
@@ -71,7 +71,7 @@ public class RoomServiceImpl extends ServiceImpl<ImNetworkRoomDao, ImNetworkRoom
             room.setRoomId(roomId);
             room.setDisplay(display);
             baseMapper.insert(room);
-            IMApiResultInfo resultInfo = imHelper.createGroup(new String[]{userId.toString()}, roomId, roomId);
+            IMApiResultInfo resultInfo = imHelper.createGroup(new String[]{imUserId}, roomId, roomId);
             if(resultInfo.getCode() != 200){
                 log.error("创建群聊失败 resultInfo:{}",resultInfo);
             }