|
@@ -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){
|