|
@@ -38,7 +38,9 @@ import java.lang.reflect.Method;
|
|
|
import java.net.InetSocketAddress;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.ZoneOffset;
|
|
|
-import java.util.*;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Map;
|
|
|
+import java.util.Objects;
|
|
|
import java.util.concurrent.ConcurrentHashMap;
|
|
|
|
|
|
/**
|
|
@@ -162,27 +164,25 @@ public class WebSocketOeServer implements Concurrently {
|
|
|
log.warn("Authorization faile: deviceId invalid, session deviceId is " + tbSession.getDeviceId());
|
|
|
throw new BusinessException(ExceptionResultEnum.AUTHORIZATION_ERROR);
|
|
|
}
|
|
|
- Boolean check = WebsocketUtil.checkExamStatus(this.recordId);
|
|
|
- if (check) {
|
|
|
- this.session = session;
|
|
|
- session.setMaxIdleTimeout(SystemConstant.WEBSOCKET_MAX_TIME_OUT);
|
|
|
- this.sessionId = tbSession.getId();
|
|
|
- if (webSocketMap.containsKey(this.recordId)) {
|
|
|
- webSocketMap.remove(this.recordId);
|
|
|
- webSocketMap.put(this.recordId, this);
|
|
|
- } else {
|
|
|
- webSocketMap.put(this.recordId, 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];
|
|
|
- log.info("ip[:{}]连接成功", this.ip);
|
|
|
- WebsocketUtil.updateExamRecordWebsocketStatus(recordId, ip, this.session.getId(), WebsocketStatusEnum.ON_LINE);
|
|
|
- this.updateTime = System.currentTimeMillis();
|
|
|
- tranMap = WebsocketUtil.initWebsocket(recordId, null, deviceId, ip, updateTime);
|
|
|
+ WebsocketUtil.checkExamStatus(this.recordId);
|
|
|
+ this.session = session;
|
|
|
+ session.setMaxIdleTimeout(SystemConstant.WEBSOCKET_MAX_TIME_OUT);
|
|
|
+ this.sessionId = tbSession.getId();
|
|
|
+ if (webSocketMap.containsKey(this.recordId)) {
|
|
|
+ webSocketMap.remove(this.recordId);
|
|
|
+ webSocketMap.put(this.recordId, this);
|
|
|
+ } else {
|
|
|
+ webSocketMap.put(this.recordId, 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];
|
|
|
+ log.info("ip[:{}]连接成功", this.ip);
|
|
|
+ WebsocketUtil.updateExamRecordWebsocketStatus(recordId, ip, this.session.getId(), WebsocketStatusEnum.ON_LINE);
|
|
|
+ this.updateTime = System.currentTimeMillis();
|
|
|
+ tranMap = WebsocketUtil.initWebsocket(recordId, null, deviceId, ip, updateTime);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -346,7 +346,7 @@ public class WebSocketOeServer implements Concurrently {
|
|
|
|
|
|
@Override
|
|
|
public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs,
|
|
|
- ConsumeConcurrentlyContext consumeConcurrentlyContext) {
|
|
|
+ ConsumeConcurrentlyContext consumeConcurrentlyContext) {
|
|
|
RedisUtil redisUtil = SpringContextHolder.getBean(RedisUtil.class);
|
|
|
MqOeLogicService mqOeLogicService = SpringContextHolder.getBean(MqOeLogicService.class);
|
|
|
MqDto mqDto = null;
|