Răsfoiți Sursa

admin mq session优化

wangliang 4 ani în urmă
părinte
comite
47e4db31c5

+ 12 - 2
themis-exam/src/main/java/com/qmth/themis/exam/listener/service/impl/MqOeLogicServiceImpl.java

@@ -279,7 +279,12 @@ public class MqOeLogicServiceImpl implements MqOeLogicService {
             String clientWebsocketId = ExamRecordCacheUtil.getClientWebsocketId(recordId);
             if (Objects.nonNull(clientWebsocketId) && Objects.nonNull(webSocketMap.get(clientWebsocketId + "-" + MonitorVideoSourceEnum.MOBILE_FIRST.name()))) {
                 WebSocketMobileServer webSocketMobileServer = webSocketMap.get(clientWebsocketId + "-" + MonitorVideoSourceEnum.MOBILE_FIRST.name());
-                if (Objects.nonNull(webSocketMobileServer.getRecordId()) && webSocketMobileServer.getRecordId().longValue() == recordId.longValue()) {
+                ExamRecordStatusEnum examRecordStatusEnum = ExamRecordCacheUtil.getStatus(recordId);
+                if ((Objects.nonNull(examRecordStatusEnum)
+                        && !Objects.equals(ExamRecordStatusEnum.PERSISTED, examRecordStatusEnum)
+                        && !Objects.equals(ExamRecordStatusEnum.FINISHED, examRecordStatusEnum))
+                        && Objects.nonNull(webSocketMobileServer.getRecordId())
+                        && webSocketMobileServer.getRecordId().longValue() == recordId.longValue()) {
                     match.set(true);
                     WebsocketDto websocketDto = null;
                     switch (tag.toUpperCase()) {
@@ -297,7 +302,12 @@ public class MqOeLogicServiceImpl implements MqOeLogicService {
             }
             if (Objects.nonNull(clientWebsocketId) && Objects.nonNull(webSocketMap.get(clientWebsocketId + "-" + MonitorVideoSourceEnum.MOBILE_SECOND.name()))) {
                 WebSocketMobileServer webSocketMobileServer = webSocketMap.get(clientWebsocketId + "-" + MonitorVideoSourceEnum.MOBILE_SECOND.name());
-                if (Objects.nonNull(webSocketMobileServer.getRecordId()) && webSocketMobileServer.getRecordId().longValue() == recordId.longValue()) {
+                ExamRecordStatusEnum examRecordStatusEnum = ExamRecordCacheUtil.getStatus(recordId);
+                if ((Objects.nonNull(examRecordStatusEnum)
+                        && !Objects.equals(ExamRecordStatusEnum.PERSISTED, examRecordStatusEnum)
+                        && !Objects.equals(ExamRecordStatusEnum.FINISHED, examRecordStatusEnum))
+                        && Objects.nonNull(webSocketMobileServer.getRecordId())
+                        && webSocketMobileServer.getRecordId().longValue() == recordId.longValue()) {
                     match.set(true);
                     WebsocketDto websocketDto = null;
                     switch (tag.toUpperCase()) {