lideyin 4 жил өмнө
parent
commit
ac6f2d16d2

+ 18 - 2
examcloud-core-oe-student-service/src/main/java/cn/com/qmth/examcloud/core/oe/student/service/impl/ExamControlServiceImpl.java

@@ -1433,7 +1433,7 @@ public class ExamControlServiceImpl implements ExamControlService {
             return null;
         }
         // 检查考试会话是否存在,或者是否失效,如果没有失效,则返回考试中的考试记录实体,否则直接返回null
-        ExamRecordData examingRecord = checkExamSession(examSessionInfo, studentId);
+        ExamRecordData examingRecord = checkExamSession(examSessionInfo);
         if (examingRecord == null) {
             return null;
         } else {
@@ -1526,7 +1526,7 @@ public class ExamControlServiceImpl implements ExamControlService {
         examContinuedRecordRepo.save(entity);
     }
 
-    private ExamRecordData checkExamSession(ExamingSession examSessionInfo, Long studentId) {
+    private ExamRecordData checkExamSession(ExamingSession examSessionInfo) {
         ExamRecordData examingRecord = examRecordDataService
                 .getExamRecordDataCache(examSessionInfo.getExamRecordDataId());
         if (examingRecord == null) {
@@ -1556,6 +1556,22 @@ public class ExamControlServiceImpl implements ExamControlService {
             delayHandInExamIfLocked(examingRecord.getId());
             return null;
         }
+        Long examId = examSessionInfo.getExamId();
+        Long studentId = examSessionInfo.getStudentId();
+        Long examStageId = examSessionInfo.getExamStageId();
+
+        //如果设置了定点交卷,且超过了定点交卷时间,自动交卷
+        if (isTimingEnd(examId, studentId, examStageId)) {
+            ExamStageCacheBean examStage = CacheHelper.getExamStage(examId, examStageId);
+            //定点交卷时间 = 开始进入考试的起始值 + 定点交卷时长
+            Date fixedSubmitTime = DateUtils.addMinutes(examStage.getStartTime(), examStage.getSubmitDuration());
+
+            if (now >= fixedSubmitTime.getTime()) {
+                delayHandInExamIfLocked(examingRecord.getId());
+                return null;
+            }
+        }
+
         return examingRecord;
     }