|
@@ -50,6 +50,7 @@ import com.ym.whiteboard.WhiteBoardHelper;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
import org.apache.commons.collections.CollectionUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.joda.time.DateTime;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -177,7 +178,7 @@ public class RoomServiceImpl implements RoomService {
|
|
if (courseSchedule.getTeachMode() == TeachModeEnum.OFFLINE) {
|
|
if (courseSchedule.getTeachMode() == TeachModeEnum.OFFLINE) {
|
|
return new BaseResponse(ErrorEnum.JOIN_ROOM_ERROR, ErrorEnum.JOIN_ROOM_ERROR.getErrMsg(), null);
|
|
return new BaseResponse(ErrorEnum.JOIN_ROOM_ERROR, ErrorEnum.JOIN_ROOM_ERROR.getErrMsg(), null);
|
|
}
|
|
}
|
|
- Date curTime = DateTimeUtils.currentUTC();
|
|
|
|
|
|
+ Date curTime = DateTime.now().toDate();
|
|
//是否提前进入教室
|
|
//是否提前进入教室
|
|
String courseBeforeBufferTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.COURSE_BEFORE_BUFFER_TIME, courseSchedule.getTenantId());
|
|
String courseBeforeBufferTime = sysTenantConfigService.getTenantConfigValue(SysConfigService.COURSE_BEFORE_BUFFER_TIME, courseSchedule.getTenantId());
|
|
if (StringUtils.isEmpty(courseBeforeBufferTime)) {
|
|
if (StringUtils.isEmpty(courseBeforeBufferTime)) {
|
|
@@ -837,6 +838,37 @@ public class RoomServiceImpl implements RoomService {
|
|
userDao.deleteByUid(userId);
|
|
userDao.deleteByUid(userId);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 事件回调通知
|
|
|
|
+ *
|
|
|
|
+ * @param roomId 房间编号
|
|
|
|
+ * @param userId 用户编号
|
|
|
|
+ * @param deviceNum 设备编号
|
|
|
|
+ * @param callbackTs 事件回调时间
|
|
|
|
+ * @throws Exception Exception
|
|
|
|
+ */
|
|
|
|
+ @Transactional
|
|
|
|
+ @Override
|
|
|
|
+ public void leaveRoomSuccess(String roomId, String userId, String deviceNum, Long callbackTs) throws Exception {
|
|
|
|
+
|
|
|
|
+ // 用户退出房间多次触发调用判定
|
|
|
|
+ RoomMember roomMember = roomMemberDao.findByRidAndUid(roomId, userId);
|
|
|
|
+ if (Objects.isNull(roomMember)) {
|
|
|
|
+ log.warn("leaveRoomSuccess: REPEATED_EXECUTION roomId={}, userId={}, deviceNum={}", roomId, userId, deviceNum);
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 回调整事件延迟通知
|
|
|
|
+ if (callbackTs < roomMember.getJoinDt().getTime()) {
|
|
|
|
+ log.warn("leaveRoomSuccess: EVENT_DELAY_NOTICE roomId={}, userId={}, deviceNum={}, callbackTs={}, joinTs={}",
|
|
|
|
+ roomId, userId, deviceNum, callbackTs, roomMember.getJoinDt().getTime());
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // 用户离开事件
|
|
|
|
+ leaveRoomSuccess(roomId, userId, deviceNum);
|
|
|
|
+ }
|
|
|
|
+
|
|
public void deleteWhiteboardByUser(String roomId, String userId) throws Exception {
|
|
public void deleteWhiteboardByUser(String roomId, String userId) throws Exception {
|
|
List<Whiteboard> whiteboardList = whiteboardDao.findByRidAndCreator(roomId, userId);
|
|
List<Whiteboard> whiteboardList = whiteboardDao.findByRidAndCreator(roomId, userId);
|
|
if (!whiteboardList.isEmpty()) {
|
|
if (!whiteboardList.isEmpty()) {
|