瀏覽代碼

fix 考试会话处于“非正式状态”场景

deason 2 年之前
父節點
當前提交
93281c1d09

+ 2 - 1
examcloud-core-oe-task-service/src/main/java/cn/com/qmth/examcloud/core/oe/task/service/job/BeforeHandInExamJobHandler.java

@@ -12,6 +12,7 @@ import cn.com.qmth.examcloud.support.enums.HandInExamType;
 import cn.com.qmth.examcloud.support.examing.ExamRecordData;
 import cn.com.qmth.examcloud.support.examing.ExamingActivityTime;
 import cn.com.qmth.examcloud.support.examing.ExamingSession;
+import cn.com.qmth.examcloud.support.examing.ExamingStatus;
 import cn.com.qmth.examcloud.support.redis.RedisKeyHelper;
 import cn.com.qmth.examcloud.web.exception.SequenceLockException;
 import cn.com.qmth.examcloud.web.helpers.SequenceLockHelper;
@@ -121,7 +122,7 @@ public class BeforeHandInExamJobHandler {
         }
 
         ExamingSession examingSession = examingSessionService.getExamingSession(examRecordDataCache.getStudentId());
-        if (examingSession == null) {
+        if (examingSession == null || ExamingStatus.INFORMAL.equals(examingSession.getExamingStatus())) {
             // 考试会话不存在,则自动交卷
             log.warn("redisKey {}{} value not exist, do autoHandInExam, examRecordDataId:{}",
                     CacheConstants.CACHE_OE_SESSION, examRecordDataCache.getStudentId(), examRecordDataId);

+ 2 - 2
examcloud-core-oe-task-service/src/main/java/cn/com/qmth/examcloud/core/oe/task/service/job/SyncExamRecordDataJobHandler.java

@@ -267,9 +267,9 @@ public class SyncExamRecordDataJobHandler {
         // 清除心跳缓存
         redisClient.delete(RedisKeyHelper.getBuilder().examingHeartbeatKey(examRecordDataId));
 
-        // 清除当前学生的考试会话缓存
+        // 清除当前学生的考试会话缓存(交卷后,正好又重新开考“预处理阶段”时examingSession的examRecordDataId会为空!)
         ExamingSession examingSession = examingSessionService.getExamingSession(studentId);
-        if (examingSession != null && examingSession.getExamRecordDataId().equals(examRecordDataId)) {
+        if (examingSession != null && examRecordDataId.equals(examingSession.getExamRecordDataId())) {
             examingSessionService.deleteExamingSession(studentId);
         }