Browse Source

Merge branch 'dev_openapi_bugfix'

wangliang 4 years ago
parent
commit
a9b8b7c781

+ 8 - 7
themis-admin/src/main/java/com/qmth/themis/admin/websocket/WebSocketAdminServer.java

@@ -45,7 +45,8 @@ public class WebSocketAdminServer
      * 与某个客户端的连接会话,需要通过它来给客户端发送数据
      */
     private Session session = null;
-    private String sessionId = null, ip = null, platform = null, deviceId = null, authorization = null, url = "/ws/admin", websocketSessionId = null;
+    private Platform platform = null;
+    private String sessionId = null, ip = null, deviceId = null, authorization = null, url = "/ws/admin", websocketSessionId = null;
     private Long time = null, userId = null, updateTime = null;
     private RedisUtil redisUtil;
     private Map<String, Object> tranMap = null;
@@ -64,17 +65,17 @@ public class WebSocketAdminServer
         if (Objects.isNull(mapParameter.get(Constants.HEADER_PLATFORM)) || mapParameter.get(Constants.HEADER_PLATFORM).size() == 0) {
             throw new BusinessException(ExceptionResultEnum.PLATFORM_INVALID);
         }
-        this.platform = String.valueOf(mapParameter.get(Constants.HEADER_PLATFORM).get(0));
+        this.platform = Platform.valueOf(mapParameter.get(Constants.HEADER_PLATFORM).get(0));
         if (Objects.isNull(mapParameter.get(Constants.HEADER_DEVICE_ID)) || mapParameter.get(Constants.HEADER_DEVICE_ID).size() == 0) {
             throw new BusinessException(ExceptionResultEnum.DEVICE_ID_INVALID);
         }
-        this.deviceId = String.valueOf(mapParameter.get(Constants.HEADER_DEVICE_ID).get(0));
-        this.authorization = String.valueOf(mapParameter.get(Constants.HEADER_AUTHORIZATION).get(0));
-        this.time = Long.parseLong(String.valueOf(mapParameter.get(Constants.HEADER_TIME).get(0)));
-        this.userId = Long.parseLong(String.valueOf(mapParameter.get(Constants.HEADER_USER_ID).get(0)));
+        this.deviceId = mapParameter.get(Constants.HEADER_DEVICE_ID).get(0);
+        this.authorization = mapParameter.get(Constants.HEADER_AUTHORIZATION).get(0);
+        this.time = Long.parseLong(mapParameter.get(Constants.HEADER_TIME).get(0));
+        this.userId = Long.parseLong(mapParameter.get(Constants.HEADER_USER_ID).get(0));
 
         redisUtil = SpringContextHolder.getBean(RedisUtil.class);
-        TBSession tbSession = AuthUtil.websocketAuthInterceptor(Platform.valueOf(platform), deviceId, authorization, Long.parseLong(mapParameter.get(Constants.HEADER_TIME).get(0)), SystemConstant.GET, url);
+        TBSession tbSession = AuthUtil.websocketAuthInterceptor(this.platform, this.deviceId, this.authorization, this.time, SystemConstant.GET, this.url);
         this.session = session;
         session.setMaxIdleTimeout(SystemConstant.WEBSOCKET_MAX_TIME_OUT);
         this.sessionId = tbSession.getId();

+ 8 - 7
themis-exam/src/main/java/com/qmth/themis/exam/websocket/WebSocketMobileServer.java

@@ -55,7 +55,8 @@ public class WebSocketMobileServer implements Concurrently {
      * 与某个客户端的连接会话,需要通过它来给客户端发送数据
      */
     private Session session = null;
-    private String sessionId = null, ip = null, platform = null, deviceId = null, authorization = null, url = "/ws/mobile", websocketSessionId = null;
+    private Platform platform = null;
+    private String sessionId = null, ip = null, deviceId = null, authorization = null, url = "/ws/mobile", websocketSessionId = null;
     private Long time = null, recordId = null, updateTime = null;
     private RedisUtil redisUtil;
     private Map<String, Object> tranMap = null;
@@ -75,18 +76,18 @@ public class WebSocketMobileServer implements Concurrently {
         if (Objects.isNull(mapParameter.get(Constants.HEADER_PLATFORM)) || mapParameter.get(Constants.HEADER_PLATFORM).size() == 0) {
             throw new BusinessException(ExceptionResultEnum.PLATFORM_INVALID);
         }
-        this.platform = String.valueOf(mapParameter.get(Constants.HEADER_PLATFORM).get(0));
+        this.platform = Platform.valueOf(mapParameter.get(Constants.HEADER_PLATFORM).get(0));
         if (Objects.isNull(mapParameter.get(Constants.HEADER_DEVICE_ID)) || mapParameter.get(Constants.HEADER_DEVICE_ID).size() == 0) {
             throw new BusinessException(ExceptionResultEnum.DEVICE_ID_INVALID);
         }
-        this.deviceId = String.valueOf(mapParameter.get(Constants.HEADER_DEVICE_ID).get(0));
-        this.authorization = String.valueOf(mapParameter.get(Constants.HEADER_AUTHORIZATION).get(0));
-        this.time = Long.parseLong(String.valueOf(mapParameter.get(Constants.HEADER_TIME).get(0)));
-        this.recordId = Long.parseLong(String.valueOf(mapParameter.get(Constants.HEADER_RECORD_ID).get(0)));
+        this.deviceId = mapParameter.get(Constants.HEADER_DEVICE_ID).get(0);
+        this.authorization = mapParameter.get(Constants.HEADER_AUTHORIZATION).get(0);
+        this.time = Long.parseLong(mapParameter.get(Constants.HEADER_TIME).get(0));
+        this.recordId = Long.parseLong(mapParameter.get(Constants.HEADER_RECORD_ID).get(0));
         this.source = MonitorVideoSourceEnum.valueOf(mapParameter.get(Constants.HEADER_SOURCE).get(0));
 
         this.redisUtil = SpringContextHolder.getBean(RedisUtil.class);
-        TBSession tbSession = AuthUtil.websocketAuthInterceptor(Platform.valueOf(platform), deviceId, authorization, Long.parseLong(mapParameter.get(Constants.HEADER_TIME).get(0)), SystemConstant.GET, url);
+        TBSession tbSession = AuthUtil.websocketAuthInterceptor(this.platform, this.deviceId, this.authorization, this.time, SystemConstant.GET, this.url);
         WebsocketUtil.checkExamStatus(this.recordId);
         this.session = session;
         session.setMaxIdleTimeout(SystemConstant.WEBSOCKET_MAX_TIME_OUT);

+ 8 - 7
themis-exam/src/main/java/com/qmth/themis/exam/websocket/WebSocketOeServer.java

@@ -54,7 +54,8 @@ public class WebSocketOeServer implements Concurrently {
      * 与某个客户端的连接会话,需要通过它来给客户端发送数据
      */
     private Session session = null;
-    private String sessionId = null, ip = null, platform = null, deviceId = null, authorization = null, url = "/ws/oe", websocketSessionId = null;
+    private Platform platform = null;
+    private String sessionId = null, ip = null, deviceId = null, authorization = null, url = "/ws/oe", websocketSessionId = null;
     private Long recordId = null, time = null, updateTime = null;
     private RedisUtil redisUtil;
     private Map<String, Object> tranMap = null;
@@ -73,17 +74,17 @@ public class WebSocketOeServer implements Concurrently {
         if (Objects.isNull(mapParameter.get(Constants.HEADER_PLATFORM)) || mapParameter.get(Constants.HEADER_PLATFORM).size() == 0) {
             throw new BusinessException(ExceptionResultEnum.PLATFORM_INVALID);
         }
-        this.platform = String.valueOf(mapParameter.get(Constants.HEADER_PLATFORM).get(0));
+        this.platform = Platform.valueOf(mapParameter.get(Constants.HEADER_PLATFORM).get(0));
         if (Objects.isNull(mapParameter.get(Constants.HEADER_DEVICE_ID)) || mapParameter.get(Constants.HEADER_DEVICE_ID).size() == 0) {
             throw new BusinessException(ExceptionResultEnum.DEVICE_ID_INVALID);
         }
-        this.deviceId = String.valueOf(mapParameter.get(Constants.HEADER_DEVICE_ID).get(0));
-        this.authorization = String.valueOf(mapParameter.get(Constants.HEADER_AUTHORIZATION).get(0));
-        this.time = Long.parseLong(String.valueOf(mapParameter.get(Constants.HEADER_TIME).get(0)));
-        this.recordId = Long.parseLong(String.valueOf(mapParameter.get(Constants.HEADER_RECORD_ID).get(0)));
+        this.deviceId = mapParameter.get(Constants.HEADER_DEVICE_ID).get(0);
+        this.authorization = mapParameter.get(Constants.HEADER_AUTHORIZATION).get(0);
+        this.time = Long.parseLong(mapParameter.get(Constants.HEADER_TIME).get(0));
+        this.recordId = Long.parseLong(mapParameter.get(Constants.HEADER_RECORD_ID).get(0));
         redisUtil = SpringContextHolder.getBean(RedisUtil.class);
 
-        TBSession tbSession = AuthUtil.websocketAuthInterceptor(Platform.valueOf(platform), deviceId, authorization, Long.parseLong(mapParameter.get(Constants.HEADER_TIME).get(0)), SystemConstant.GET, url);
+        TBSession tbSession = AuthUtil.websocketAuthInterceptor(this.platform, this.deviceId, this.authorization, this.time, SystemConstant.GET, this.url);
         WebsocketUtil.checkExamStatus(this.recordId);
         this.session = session;
         session.setMaxIdleTimeout(SystemConstant.WEBSOCKET_MAX_TIME_OUT);