|
@@ -8,7 +8,6 @@ import com.qmth.themis.business.constant.SystemConstant;
|
|
|
import com.qmth.themis.business.dto.MqDto;
|
|
|
import com.qmth.themis.business.dto.WebsocketDto;
|
|
|
import com.qmth.themis.business.entity.TBSession;
|
|
|
-import com.qmth.themis.business.enums.ExamRecordStatusEnum;
|
|
|
import com.qmth.themis.business.enums.MonitorStatusSourceEnum;
|
|
|
import com.qmth.themis.business.enums.MonitorVideoSourceEnum;
|
|
|
import com.qmth.themis.business.enums.WebsocketTypeEnum;
|
|
@@ -20,7 +19,6 @@ import com.qmth.themis.common.enums.ExceptionResultEnum;
|
|
|
import com.qmth.themis.common.exception.BusinessException;
|
|
|
import com.qmth.themis.common.signature.SignatureInfo;
|
|
|
import com.qmth.themis.common.signature.SignatureType;
|
|
|
-import com.qmth.themis.exam.config.ExamConstant;
|
|
|
import com.qmth.themis.exam.listener.service.MqOeLogicService;
|
|
|
import com.qmth.themis.exam.websocketTemplete.WebSocketMobileMessageTemplete;
|
|
|
import com.qmth.themis.mq.templete.Concurrently;
|
|
@@ -102,36 +100,27 @@ public class WebSocketMobileServer implements Concurrently {
|
|
|
} else {
|
|
|
if (info.validate(tbSession.getAccessToken()) && info.getTimestamp() < tbSession.getExpireTime().getTime()
|
|
|
&& platform.equalsIgnoreCase(tbSession.getPlatform()) && Objects.equals(deviceId, tbSession.getDeviceId())) {
|
|
|
-// ExamRecordStatusEnum status = ExamRecordCacheUtil.getStatus(this.recordId);
|
|
|
-// if (Objects.nonNull(status) && Objects.equals(ExamRecordStatusEnum.BREAK_OFF, status)) {//如果是已中断状态,则给客户端和移动端发送考试停止的消息
|
|
|
-// ExamConstant.sendExamStopMsg(recordId);
|
|
|
-// throw new BusinessException("考试已中断,请重新登录");
|
|
|
-// } else {
|
|
|
- this.session = session;
|
|
|
- session.setMaxIdleTimeout(SystemConstant.WEBSOCKET_MAX_TIME_OUT);
|
|
|
- this.sessionId = tbSession.getId();
|
|
|
- if (webSocketMap.containsKey(this.recordId + "-" + this.source.name())) {
|
|
|
- webSocketMap.remove(this.recordId + "-" + this.source.name());
|
|
|
- webSocketMap.put(this.recordId + "-" + this.source.name(), this);
|
|
|
- //加入set中
|
|
|
- } else {
|
|
|
- webSocketMap.put(this.recordId + "-" + this.source.name(), this);
|
|
|
- //加入set中
|
|
|
- addOnlineCount();
|
|
|
- //在线数加1
|
|
|
- }
|
|
|
- log.info("用户连接:" + this.sessionId + ",当前在线人数为:" + getOnlineCount());
|
|
|
- InetSocketAddress addr = (InetSocketAddress) WebsocketUtil.getFieldInstance(this.session.getAsyncRemote(), "base#socketWrapper#socket#sc#remoteAddress");
|
|
|
- this.ip = addr.toString().replace("/", "").split(":")[0];
|
|
|
+ this.session = session;
|
|
|
+ session.setMaxIdleTimeout(SystemConstant.WEBSOCKET_MAX_TIME_OUT);
|
|
|
+ this.sessionId = tbSession.getId();
|
|
|
+ if (webSocketMap.containsKey(this.recordId + "-" + this.source.name())) {
|
|
|
+ webSocketMap.remove(this.recordId + "-" + this.source.name());
|
|
|
+ webSocketMap.put(this.recordId + "-" + this.source.name(), this);
|
|
|
+ } else {
|
|
|
+ webSocketMap.put(this.recordId + "-" + this.source.name(), this);
|
|
|
+ addOnlineCount();
|
|
|
+ }
|
|
|
+ log.info("用户连接:" + this.sessionId + ",当前在线人数为:" + getOnlineCount());
|
|
|
+ InetSocketAddress addr = (InetSocketAddress) WebsocketUtil.getFieldInstance(this.session.getAsyncRemote(), "base#socketWrapper#socket#sc#remoteAddress");
|
|
|
+ this.ip = addr.toString().replace("/", "").split(":")[0];
|
|
|
// this.sendMessage("ip[" + this.ip + "]连接成功");
|
|
|
- log.info("ip[:{}]连接成功", this.ip);
|
|
|
- tranMap = new HashMap<>();
|
|
|
- tranMap.put("recordId", this.recordId);
|
|
|
- tranMap.put("deviceId", this.deviceId);
|
|
|
- tranMap.put("ip", this.ip);
|
|
|
- this.updateTime = System.currentTimeMillis();
|
|
|
- tranMap.put("updateTime", this.updateTime);
|
|
|
-// }
|
|
|
+ log.info("ip[:{}]连接成功", this.ip);
|
|
|
+ tranMap = new HashMap<>();
|
|
|
+ tranMap.put("recordId", this.recordId);
|
|
|
+ tranMap.put("deviceId", this.deviceId);
|
|
|
+ tranMap.put("ip", this.ip);
|
|
|
+ this.updateTime = System.currentTimeMillis();
|
|
|
+ tranMap.put("updateTime", this.updateTime);
|
|
|
} else {
|
|
|
throw new BusinessException(ExceptionResultEnum.AUTHORIZATION_ERROR);
|
|
|
}
|