zouxuan 3 lat temu
rodzic
commit
c66a1919a3

+ 1 - 1
mec-im/src/main/java/com/ym/common/ErrorEnum.java

@@ -35,7 +35,7 @@ public enum ErrorEnum {
     ERR_USER_EXIST_IN_ROOM(28, "User exist in room"),
     ERR_CHANGE_SELF_ROLE(29, "Can not change self role"),
     ERR_APPLY_TICKET_INVALID(30, "Apply ticket invalid"),
-    ERR_OVER_MAX_COUNT(31, "Over max count"),
+    ERR_OVER_MAX_COUNT(31, "云教室人数已超上线"),
     ERR_TEACHER_EXIST_IN_ROOM(32, "Teacher exist in room"),
     ERR_DOWNGRADE_ROLE(33, "Can't downgrade role"),
     ERR_CHANGE_ROLE(34, "Only change student to teacher");

+ 2 - 2
mec-im/src/main/java/com/ym/controller/RoomController.java

@@ -22,8 +22,8 @@ public class RoomController{
     MessageService messageService;
 
     @RequestMapping(value = "/join", method = RequestMethod.POST)
-    public Object joinRoom(@RequestBody ReqUserData data) throws Exception {
-        return new BaseResponse<>(roomService.joinRoom(data.getRoomId()));
+    public BaseResponse joinRoom(@RequestBody ReqUserData data) throws Exception {
+        return new BaseResponse(roomService.joinRoom(data.getRoomId()));
     }
 
     @RequestMapping(value = "/signIn", method = RequestMethod.POST)

+ 7 - 7
mec-im/src/main/java/com/ym/service/Impl/RoomServiceImpl.java

@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.alibaba.fastjson.serializer.SerializerFeature;
 import com.ym.common.ApiException;
+import com.ym.common.BaseResponse;
 import com.ym.common.DisplayEnum;
 import com.ym.common.ErrorEnum;
 import com.ym.config.IMProperties;
@@ -126,9 +127,8 @@ public class RoomServiceImpl implements RoomService {
 
     @Transactional(propagation = Propagation.REQUIRED, rollbackFor = Exception.class)
     @Override
-    public RoomResult joinRoom(String roomId) throws Exception {
+    public BaseResponse joinRoom(String roomId) throws Exception {
         CheckUtils.checkArgument(roomId != null, "roomId must't be null");
-
         SysUser sysUser = sysUserFeignService.queryUserInfo();
         String userId = sysUser.getId().toString();
         log.info("joinRoom: roomId={}, userId={}", roomId, userId);
@@ -136,7 +136,7 @@ public class RoomServiceImpl implements RoomService {
         Teacher teacher = teacherDao.get(Integer.parseInt(userId));
         CourseSchedule courseSchedule = courseScheduleDao.get(Long.parseLong(roomId));
         if(courseSchedule.getTeachMode() == TeachModeEnum.OFFLINE){
-            throw new ApiException(ErrorEnum.JOIN_ROOM_ERROR);
+            return new BaseResponse(ErrorEnum.JOIN_ROOM_ERROR,ErrorEnum.JOIN_ROOM_ERROR.getErrMsg(),null);
         }
         Date curTime = DateTimeUtils.currentUTC();
         //是否提前进入教室
@@ -146,7 +146,7 @@ public class RoomServiceImpl implements RoomService {
         }
         Date addMinutes = DateUtil.addMinutes(curTime, Integer.parseInt(courseBeforeBufferTime));
         if(courseSchedule.getStartClassTime().compareTo(addMinutes) > 0 ){
-            throw new ApiException(ErrorEnum.ROOM_NOT_START);
+            return new BaseResponse(ErrorEnum.ROOM_NOT_START,ErrorEnum.ROOM_NOT_START.getErrMsg(),null);
 //            throw new BizException("网络教室暂未开启,请在{}分钟后进入教室",DateUtil.minutesBetween(addMinutes,courseSchedule.getStartClassTime()));
         }
         final TenantAssetsInfo one = tenantAssetsInfoService.getOne(new WrapperUtil<TenantAssetsInfo>()
@@ -154,7 +154,7 @@ public class RoomServiceImpl implements RoomService {
                 .queryWrapper()
                 .gt("balance_", 0));
         if(one == null){
-            throw new ApiException(ErrorEnum.CLOUD_BALANCE_NOT_FEE);
+            return new BaseResponse(ErrorEnum.CLOUD_BALANCE_NOT_FEE,ErrorEnum.CLOUD_BALANCE_NOT_FEE.getErrMsg(),null);
         }
 
         //是否是连堂课
@@ -201,7 +201,7 @@ public class RoomServiceImpl implements RoomService {
             int count = roomMemberDao.countByRidAndExcludeRole(roomId, RoleEnum.RoleAudience.getValue());
             if (count == roomProperties.getMaxCount()) {
                 log.info("join error Over max count: roomId = {}, userId = {}", roomId,userId);
-                throw new ApiException(ErrorEnum.ERR_OVER_MAX_COUNT);
+                return new BaseResponse(ErrorEnum.ERR_OVER_MAX_COUNT,ErrorEnum.ERR_OVER_MAX_COUNT.getErrMsg(),null);
             }
             if(teacher != null && teacher.getId().equals(courseSchedule.getActualTeacherId())){
                 roleEnum = RoleTeacher;
@@ -285,7 +285,7 @@ public class RoomServiceImpl implements RoomService {
             roomResult.setSoundVolume(room.getSoundVolume());
         }
         log.info("join room: roomId = {}, userId = {}, userName={}, role = {}", roomId, userId, userName, roleEnum);
-        return roomResult;
+        return new BaseResponse(roomResult);
     }
 
     public RoomMember saveRoomMember(String roomId,String userId){

+ 2 - 1
mec-im/src/main/java/com/ym/service/RoomService.java

@@ -1,5 +1,6 @@
 package com.ym.service;
 
+import com.ym.common.BaseResponse;
 import com.ym.mec.biz.dal.dto.RongyunBasicUserDto;
 import com.ym.pojo.*;
 import org.apache.ibatis.annotations.Param;
@@ -11,7 +12,7 @@ import java.util.List;
  */
 public interface RoomService {
     //everyone
-    RoomResult joinRoom(String roomId) throws Exception;
+    BaseResponse joinRoom(String roomId) throws Exception;
 
     Integer getCurrentCourseId(String roomId);