Răsfoiți Sursa

试卷下载和bugfix

wangliang 4 ani în urmă
părinte
comite
2ae036e071

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

@@ -9,6 +9,7 @@ import com.qmth.themis.business.dto.WebsocketDto;
 import com.qmth.themis.business.entity.TBSession;
 import com.qmth.themis.business.enums.WebsocketTypeEnum;
 import com.qmth.themis.business.util.*;
+import com.qmth.themis.common.contanst.Constants;
 import com.qmth.themis.common.enums.ExceptionResultEnum;
 import com.qmth.themis.common.enums.Platform;
 import com.qmth.themis.common.exception.BusinessException;
@@ -60,20 +61,20 @@ public class WebSocketAdminServer
         }
         log.info("mapParameter:{}", JacksonUtil.parseJson(mapParameter));
         log.info("uri:{}", session.getRequestURI());
-        if (Objects.isNull(mapParameter.get("platform")) || mapParameter.get("platform").size() == 0) {
+        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("platform").get(0));
-        if (Objects.isNull(mapParameter.get("deviceId")) || mapParameter.get("deviceId").size() == 0) {
+        this.platform = String.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("deviceId").get(0));
-        this.authorization = String.valueOf(mapParameter.get("authorization").get(0));
-        this.time = Long.parseLong(String.valueOf(mapParameter.get("time").get(0)));
-        this.userId = Long.parseLong(String.valueOf(mapParameter.get("userId").get(0)));
+        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)));
 
         redisUtil = SpringContextHolder.getBean(RedisUtil.class);
-        TBSession tbSession = AuthUtil.websocketAuthInterceptor(Platform.valueOf(platform), deviceId, authorization, String.valueOf(mapParameter.get("time").get(0)), SystemConstant.GET, url);
+        TBSession tbSession = AuthUtil.websocketAuthInterceptor(Platform.valueOf(platform), deviceId, authorization, String.valueOf(mapParameter.get(Constants.HEADER_TIME).get(0)), SystemConstant.GET, url);
         this.session = session;
         session.setMaxIdleTimeout(SystemConstant.WEBSOCKET_MAX_TIME_OUT);
         this.sessionId = tbSession.getId();

+ 65 - 0
themis-business/src/main/java/com/qmth/themis/business/bean/exam/ExamPaperDownloadBean.java

@@ -0,0 +1,65 @@
+package com.qmth.themis.business.bean.exam;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+import java.io.Serializable;
+
+@ApiModel("试卷下载返回信息")
+public class ExamPaperDownloadBean implements Serializable {
+
+    @ApiModelProperty("试卷数据包下载地址")
+    private String paperUrl;
+
+    @ApiModelProperty("试卷数据包MD5内容")
+    private String paperMd5;
+
+    @ApiModelProperty("试卷结构下载地址")
+    private String structUrl;
+
+    @ApiModelProperty("试卷结构文件MD5内容")
+    private String structMd5;
+
+    public ExamPaperDownloadBean() {
+
+    }
+
+    public ExamPaperDownloadBean(String paperUrl, String paperMd5, String structUrl, String structMd5) {
+        this.paperUrl = paperUrl;
+        this.paperMd5 = paperMd5;
+        this.structUrl = structUrl;
+        this.structMd5 = structMd5;
+    }
+
+    public String getPaperUrl() {
+        return paperUrl;
+    }
+
+    public void setPaperUrl(String paperUrl) {
+        this.paperUrl = paperUrl;
+    }
+
+    public String getPaperMd5() {
+        return paperMd5;
+    }
+
+    public void setPaperMd5(String paperMd5) {
+        this.paperMd5 = paperMd5;
+    }
+
+    public String getStructUrl() {
+        return structUrl;
+    }
+
+    public void setStructUrl(String structUrl) {
+        this.structUrl = structUrl;
+    }
+
+    public String getStructMd5() {
+        return structMd5;
+    }
+
+    public void setStructMd5(String structMd5) {
+        this.structMd5 = structMd5;
+    }
+}

+ 8 - 1
themis-business/src/main/java/com/qmth/themis/business/service/TEExamService.java

@@ -7,7 +7,6 @@ import com.qmth.themis.business.bean.admin.OpenExamBean;
 import com.qmth.themis.business.bean.exam.*;
 import com.qmth.themis.business.cache.bean.ExamCacheBean;
 import com.qmth.themis.business.dto.MqDto;
-import com.qmth.themis.business.dto.response.TEExamDto;
 import com.qmth.themis.business.dto.response.TEExamQueryDto;
 import com.qmth.themis.business.dto.response.TEExamWaitDto;
 import com.qmth.themis.business.entity.TEExam;
@@ -167,6 +166,14 @@ public interface TEExamService extends IService<TEExam> {
      */
     public ExamResultBean result(Long recordId);
 
+    /**
+     * 试卷下载
+     *
+     * @param recordId
+     * @return
+     */
+    public ExamPaperDownloadBean paperDownload(Long recordId);
+
     /**
      * 监考端获取考试批次列表
      *

+ 19 - 0
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamServiceImpl.java

@@ -1215,6 +1215,25 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
         return ret;
     }
 
+    /**
+     * 试卷下载
+     *
+     * @param recordId
+     * @return
+     */
+    @Override
+    public ExamPaperDownloadBean paperDownload(Long recordId) {
+        Long paperId = ExamRecordCacheUtil.getPaperId(recordId);
+        ExamPaperCacheBean ep = teExamPaperService.getExamPaperCacheBean(paperId);
+        if (Objects.isNull(ep)) {
+            throw new BusinessException(ExceptionResultEnum.NOT_FOUND_EXAM_PAPER);
+        }
+        ExamPaperDownloadBean ret = new ExamPaperDownloadBean();
+        ret.setPaperUrl(ossUtil.getPrivateUrl(ep.getPaperPath()));
+        ret.setStructUrl(ossUtil.getPrivateUrl(ep.getStructPath()));
+        return ret;
+    }
+
     /**
      * 监考端获取考试批次列表
      *

+ 3 - 1
themis-business/src/main/java/com/qmth/themis/business/util/WebsocketUtil.java

@@ -6,6 +6,7 @@ import com.qmth.themis.business.enums.ExamRecordFieldEnum;
 import com.qmth.themis.business.enums.ExamRecordStatusEnum;
 import com.qmth.themis.business.enums.WebsocketStatusEnum;
 import com.qmth.themis.business.service.TOeExamRecordService;
+import com.qmth.themis.common.contanst.Constants;
 import com.qmth.themis.common.enums.ExceptionResultEnum;
 import com.qmth.themis.common.exception.BusinessException;
 import org.slf4j.Logger;
@@ -13,6 +14,7 @@ import org.slf4j.LoggerFactory;
 
 import java.lang.reflect.Field;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 import java.util.Objects;
 
@@ -66,7 +68,7 @@ public class WebsocketUtil {
         }
         if (!Objects.equals(ExamRecordStatusEnum.FIRST_PREPARE, examRecordStatusEnum) && !Objects.equals(ExamRecordStatusEnum.RESUME_PREPARE, examRecordStatusEnum)
                 && !Objects.equals(ExamRecordStatusEnum.ANSWERING, examRecordStatusEnum)) {
-            throw new BusinessException("考试状态错误");
+            throw new BusinessException(ExceptionResultEnum.EXAM_STATUS_ERROR);
         }
     }
 

+ 2 - 24
themis-business/src/main/resources/mapper/TOeExamRecordMapper.xml

@@ -379,33 +379,11 @@
 		update t_ie_invigilate_warn_info tiiwi set tiiwi.approve_status = 1
 		where exists(
 		select t.warningId from(select
-		tiiwi.id as warningId,
-		tee.id as examId,
-		tee.name as examName,
-		teea.id as examActivityId,
-		tees.id as examStudentId,
-		teea.code as examActivityCode,
-		tees.room_code as roomCode,
-		tees.room_name as roomName,
-		toer.id as examRecordId,
-		tees.`identity`,
-		tees.name,
-		tees.course_code as courseCode,
-		tees.course_name as courseName,
-		toer.status as statusCode,
-		IFNULL(toer.warning_count,0) as warningCount,
-		IFNULL(toer.breach_status,1) as breachStatus,
-		toer.client_last_sync_time as updateTime,
-		tiiwi.approve_status as approveStatus
-		,(select count(1) from t_ie_invigilate_warn_info tiiwi where
-		tiiwi.exam_record_id = toer.id and tiiwi.`type` =
-		'FACE_COUNT_ERROR' and tiiwi.`level` = 'D8') as multipleFaceCount
-		,(select count(1) from t_ie_invigilate_exception_info tiiei where
-		tiiei.exam_record_id = toer.id) as exceptionCount
+		tiiwi.id as warningId
 		from t_ie_invigilate_warn_info tiiwi
 		left join t_e_exam tee on tee.id = tiiwi.exam_id
 		left join t_e_exam_activity teea on teea.id = tiiwi.exam_activity_id
-		left join t_oe_exam_record toer on toer.id = t.id
+		left join t_oe_exam_record toer on toer.id = tiiwi.exam_record_id
 		left join t_e_exam_student tees on tees.id = tiiwi.exam_student_id
 		<where> 1 = 1
 			<if test="examId != null and examId != ''">

+ 5 - 1
themis-common/src/main/java/com/qmth/themis/common/contanst/Constants.java

@@ -26,7 +26,11 @@ public interface Constants {
 
     public static final String HEADER_DEVICE_ID = "deviceId";
 
-    public static final String HEADER_DOMAIN = "domain";
+    public static final String HEADER_RECORD_ID = "recordId";
+
+    public static final String HEADER_SOURCE = "source";
+
+    public static final String HEADER_USER_ID = "userId";
 
     /**
      * aes相关

+ 3 - 1
themis-common/src/main/java/com/qmth/themis/common/enums/ExceptionResultEnum.java

@@ -243,7 +243,9 @@ public enum ExceptionResultEnum {
 
     EXAM_STUDENT_ENABLE(500, 500019, "考生已停用"),
 
-    EXAM_STATUS_UPDATE_ERROR(500, 5000020, "考试状态更新失败");
+    EXAM_STATUS_UPDATE_ERROR(500, 5000020, "考试状态更新失败"),
+
+    EXAM_STATUS_ERROR(500, 5000021, "考试状态错误");
 
     private int statusCode;
     private int code;

+ 37 - 18
themis-exam/src/main/java/com/qmth/themis/exam/api/TEExamController.java

@@ -105,7 +105,7 @@ public class TEExamController {
         }
         try {
             if (param.getExamStudentId() == null) {
-                throw new BusinessException("考生id不能为空");
+                throw new BusinessException(ExceptionResultEnum.EXAM_STUDENT_ID_IS_NULL);
             }
             return ResultUtil.ok(teExamService.prepare(teStudent.getId(), param.getExamStudentId()));
         } finally {
@@ -131,7 +131,7 @@ public class TEExamController {
             ExamConstant.sendExamStopMsg(Long.valueOf(recordId), false);
         } else {
             if (Objects.nonNull(status)) {
-                throw new BusinessException("考试状态出错");
+                throw new BusinessException(ExceptionResultEnum.EXAM_STATUS_ERROR);
             }
         }
         ConcurrentHashMap<String, WebSocketOeServer> webSocketMap = WebSocketOeServer.getWebSocketMap();
@@ -154,8 +154,8 @@ public class TEExamController {
             throw new BusinessException(ExceptionResultEnum.REQUEST_AWAIT);
         }
         try {
-            if (param.getRecordId() == null) {
-                throw new BusinessException("考试记录id不能为空");
+            if (Objects.isNull(param.getRecordId()) || Objects.equals(param.getRecordId(), "")) {
+                throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
             }
             ExamStartBean examStartBean = teExamService.start(teStudent.getId(), param.getRecordId());
             if (Objects.nonNull(param.getReason())) {
@@ -193,8 +193,8 @@ public class TEExamController {
     @ApiResponses({@ApiResponse(code = 200, message = "试卷信息")})
     public Result studentPaperStruct(@RequestBody StudentPaperStructParamBean param) {
         TEStudentCacheDto teStudent = (TEStudentCacheDto) ServletUtil.getRequestStudentAccount();
-        if (param.getRecordId() == null) {
-            throw new BusinessException("考试记录id不能为空");
+        if (Objects.isNull(param.getRecordId()) || Objects.equals(param.getRecordId(), "")) {
+            throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
         }
         if (param.getContent() == null) {
             throw new BusinessException("试卷结构json字符串不能为空");
@@ -208,8 +208,8 @@ public class TEExamController {
     @ApiResponses({@ApiResponse(code = 200, message = "试卷信息")})
     public Result answerSubmit(@RequestBody AnswerSubmitParamBean param) {
         TEStudentCacheDto teStudent = (TEStudentCacheDto) ServletUtil.getRequestStudentAccount();
-        if (param.getRecordId() == null) {
-            throw new BusinessException("考试记录id不能为空");
+        if (Objects.isNull(param.getRecordId()) || Objects.equals(param.getRecordId(), "")) {
+            throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
         }
         if (param.getMainNumber() == null) {
             throw new BusinessException("大题号不能为空");
@@ -234,8 +234,8 @@ public class TEExamController {
     @ApiResponses({@ApiResponse(code = 200, message = "试卷信息")})
     public Result audioLeftPlayCountSubmit(@RequestBody AudioLeftPlayCountSubmitParamBean param) {
         TEStudentCacheDto teStudent = (TEStudentCacheDto) ServletUtil.getRequestStudentAccount();
-        if (param.getRecordId() == null) {
-            throw new BusinessException("考试记录id不能为空");
+        if (Objects.isNull(param.getRecordId()) || Objects.equals(param.getRecordId(), "")) {
+            throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
         }
         if (param.getKey() == null) {
             throw new BusinessException("音频标识不能为空");
@@ -268,8 +268,8 @@ public class TEExamController {
             throw new BusinessException(ExceptionResultEnum.REQUEST_AWAIT);
         }
         try {
-            if (param.getRecordId() == null) {
-                throw new BusinessException("考试记录id不能为空");
+            if (Objects.isNull(param.getRecordId()) || Objects.equals(param.getRecordId(), "")) {
+                throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
             }
             return ResultUtil.ok(teExamService.resume(teStudent.getId(), param.getRecordId()));
         } finally {
@@ -288,11 +288,11 @@ public class TEExamController {
             throw new BusinessException(ExceptionResultEnum.REQUEST_AWAIT);
         }
         try {
-            if (param.getRecordId() == null) {
-                throw new BusinessException("考试记录id不能为空");
+            if (Objects.isNull(param.getRecordId()) || Objects.equals(param.getRecordId(), "")) {
+                throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
             }
             if (param.getType() == null) {
-                throw new BusinessException("结束类型不能为空");
+                throw new BusinessException(ExceptionResultEnum.FINISH_TYPE_IS_NULL);
             }
             if (param.getDurationSeconds() == null) {
                 throw new BusinessException("总用时秒数不能为空");
@@ -305,14 +305,33 @@ public class TEExamController {
         }
     }
 
-
     @ApiOperation(value = "查询交卷结果")
     @RequestMapping(value = "/result", method = RequestMethod.POST)
     @ApiResponses({@ApiResponse(code = 200, message = "试卷信息")})
     public Result result(@RequestBody ResultParamBean param) {
-        if (param.getRecordId() == null) {
-            throw new BusinessException("考试记录id不能为空");
+        if (Objects.isNull(param.getRecordId()) || Objects.equals(param.getRecordId(), "")) {
+            throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
         }
         return ResultUtil.ok(teExamService.result(param.getRecordId()));
     }
+
+    @ApiOperation(value = "获取试卷下载信息")
+    @RequestMapping(value = "/paper/download", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "试卷信息")})
+    public Result paperDownload(@RequestBody ResultParamBean param) {
+        if (Objects.isNull(param.getRecordId()) || Objects.equals(param.getRecordId(), "")) {
+            throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
+        }
+        return ResultUtil.ok(teExamService.paperDownload(param.getRecordId()));
+    }
+
+    @ApiOperation(value = "试卷下载成功通知")
+    @RequestMapping(value = "/paper/downloaded", method = RequestMethod.POST)
+    @ApiResponses({@ApiResponse(code = 200, message = "试卷信息")})
+    public Result paperDownloaded(@RequestBody ResultParamBean param) {
+        if (Objects.isNull(param.getRecordId()) || Objects.equals(param.getRecordId(), "")) {
+            throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
+        }
+        return ResultUtil.ok(Collections.singletonMap("updateTime", System.currentTimeMillis()));
+    }
 }

+ 2 - 1
themis-exam/src/main/java/com/qmth/themis/exam/api/TEFaceController.java

@@ -7,6 +7,7 @@ import com.qmth.themis.business.enums.MqTagEnum;
 import com.qmth.themis.business.service.MqDtoService;
 import com.qmth.themis.business.service.TOeFaceVerifyHistoryService;
 import com.qmth.themis.business.util.MqUtil;
+import com.qmth.themis.common.enums.ExceptionResultEnum;
 import com.qmth.themis.common.exception.BusinessException;
 import com.qmth.themis.common.util.Result;
 import com.qmth.themis.common.util.ResultUtil;
@@ -51,7 +52,7 @@ public class TEFaceController {
     @Transactional
     public Result verify(@RequestBody FaceVerifyParamBean param) {
         if (param.getRecordId() == null) {
-            throw new BusinessException("考试记录id不能为空");
+            throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
         }
         if (param.getType() == null) {
             throw new BusinessException("type不能为空");

+ 2 - 1
themis-exam/src/main/java/com/qmth/themis/exam/api/TELivenessController.java

@@ -7,6 +7,7 @@ import com.qmth.themis.business.enums.MqTagEnum;
 import com.qmth.themis.business.service.MqDtoService;
 import com.qmth.themis.business.service.TOeLivenessVerifyHistoryService;
 import com.qmth.themis.business.util.MqUtil;
+import com.qmth.themis.common.enums.ExceptionResultEnum;
 import com.qmth.themis.common.exception.BusinessException;
 import com.qmth.themis.common.util.Result;
 import com.qmth.themis.common.util.ResultUtil;
@@ -51,7 +52,7 @@ public class TELivenessController {
     @Transactional
     public Result verify(@RequestBody LivenessVerifyParamBean param) {
         if (param.getRecordId() == null) {
-            throw new BusinessException("考试记录id不能为空");
+            throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
         }
         if (param.getType() == null) {
             throw new BusinessException("type不能为空");

+ 2 - 2
themis-exam/src/main/java/com/qmth/themis/exam/api/TEMobileController.java

@@ -64,7 +64,7 @@ public class TEMobileController {
     @RequestMapping(value = "/answer/ready", method = RequestMethod.POST)
     public Result answerReady(@RequestBody AnswerReadyParamBean param) {
         if (param.getRecordId() == null) {
-            throw new BusinessException("考试记录id不能为空");
+            throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
         }
         if (param.getMainNumber() == null) {
             throw new BusinessException("大题号不能为空");
@@ -124,7 +124,7 @@ public class TEMobileController {
     public Result answerSubmit(@RequestBody MobileAnswerSubmitParamBean param) {
         TEStudentCacheDto teStudent = (TEStudentCacheDto) ServletUtil.getRequestStudentAccount();
         if (param.getRecordId() == null) {
-            throw new BusinessException("考试记录id不能为空");
+            throw new BusinessException(ExceptionResultEnum.RECORD_ID_IS_NULL);
         }
         if (param.getMainNumber() == null) {
             throw new BusinessException("大题号不能为空");

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

@@ -70,21 +70,21 @@ public class WebSocketMobileServer implements Concurrently {
         }
         log.info("mapParameter:{}", JacksonUtil.parseJson(mapParameter));
         log.info("uri:{}", session.getRequestURI());
-        if (Objects.isNull(mapParameter.get("platform")) || mapParameter.get("platform").size() == 0) {
+        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("platform").get(0));
-        if (Objects.isNull(mapParameter.get("deviceId")) || mapParameter.get("deviceId").size() == 0) {
+        this.platform = String.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("deviceId").get(0));
-        this.authorization = String.valueOf(mapParameter.get("authorization").get(0));
-        this.time = Long.parseLong(String.valueOf(mapParameter.get("time").get(0)));
-        this.recordId = Long.parseLong(String.valueOf(mapParameter.get("recordId").get(0)));
-        this.source = MonitorVideoSourceEnum.valueOf(mapParameter.get("source").get(0));
+        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.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, String.valueOf(mapParameter.get("time").get(0)), SystemConstant.GET, url);
+        TBSession tbSession = AuthUtil.websocketAuthInterceptor(Platform.valueOf(platform), deviceId, authorization, String.valueOf(mapParameter.get(Constants.HEADER_TIME).get(0)), SystemConstant.GET, url);
         WebsocketUtil.checkExamStatus(this.recordId);
         this.session = session;
         session.setMaxIdleTimeout(SystemConstant.WEBSOCKET_MAX_TIME_OUT);

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

@@ -72,20 +72,20 @@ public class WebSocketOeServer implements Concurrently {
         }
         log.info("mapParameter:{}", JacksonUtil.parseJson(mapParameter));
         log.info("uri:{}", session.getRequestURI());
-        if (Objects.isNull(mapParameter.get("platform")) || mapParameter.get("platform").size() == 0) {
+        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("platform").get(0));
-        if (Objects.isNull(mapParameter.get("deviceId")) || mapParameter.get("deviceId").size() == 0) {
+        this.platform = String.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("deviceId").get(0));
-        this.authorization = String.valueOf(mapParameter.get("authorization").get(0));
-        this.time = Long.parseLong(String.valueOf(mapParameter.get("time").get(0)));
-        this.recordId = Long.parseLong(String.valueOf(mapParameter.get("recordId").get(0)));
+        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)));
         redisUtil = SpringContextHolder.getBean(RedisUtil.class);
 
-        TBSession tbSession = AuthUtil.websocketAuthInterceptor(Platform.valueOf(platform), deviceId, authorization, String.valueOf(mapParameter.get("time").get(0)), SystemConstant.GET, url);
+        TBSession tbSession = AuthUtil.websocketAuthInterceptor(Platform.valueOf(platform), deviceId, authorization, String.valueOf(mapParameter.get(Constants.HEADER_TIME).get(0)), SystemConstant.GET, url);
         WebsocketUtil.checkExamStatus(this.recordId);
         this.session = session;
         session.setMaxIdleTimeout(SystemConstant.WEBSOCKET_MAX_TIME_OUT);