xiatian il y a 4 ans
Parent
commit
8559b0a4b0

+ 20 - 10
themis-business/src/main/java/com/qmth/themis/business/service/impl/TEExamServiceImpl.java

@@ -446,6 +446,10 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
         if (ac == null) {
             throw new BusinessException("未找到场次");
         }
+        ExamRecordStatusEnum sta = ExamRecordCacheUtil.getStatus(recordId);
+        if (ExamRecordStatusEnum.FINISHED.equals(sta) || ExamRecordStatusEnum.PERSISTED.equals(sta)) {
+            throw new BusinessException("该考试已结束");
+        }
         Date now = new Date();
         if (ExamModeEnum.ANYTIME.equals(exam.getMode())) {
             Long start = ac.getStartTime();
@@ -453,8 +457,10 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
             if (now.getTime() < start) {
                 throw new BusinessException("没有到允许开考的时间");
             }
-            if (now.getTime() > end) {
-                throw new BusinessException("允许开考的时间已结束");
+            if(!ExamRecordStatusEnum.RESUME_PREPARE.equals(sta)) {//非断点进入的
+            	if (now.getTime() > end) {
+                    throw new BusinessException("允许开考的时间已结束");
+                }
             }
         } else {
             Long start = ac.getStartTime();
@@ -462,18 +468,22 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
             if (now.getTime() < start) {
                 throw new BusinessException("没有到允许开考的时间");
             }
-            //集中不启用统一收卷,考试快结束时,断点,再登录时, 时间已经超过考试截止时间,断点时,此时应该能登录继续作答
-            Integer forceFinish = ExamRecordCacheUtil.getForceFinish(recordId);
-            if (forceFinish != null && forceFinish.intValue() == 1) {
-                if (now.getTime() > end) {
+            if(ExamRecordStatusEnum.RESUME_PREPARE.equals(sta)) {//断点进入的
+            	//集中不启用统一收卷,考试快结束时,断点,再登录时, 时间已经超过考试截止时间,断点时,此时应该能登录继续作答
+	            Integer forceFinish = ExamRecordCacheUtil.getForceFinish(recordId);
+	            if (forceFinish != null && forceFinish.intValue() == 1) {
+	                if (now.getTime() > end) {
+	                    throw new BusinessException("允许开考的时间已结束");
+	                }
+	            }
+            }else {
+            	if (now.getTime() > end) {
                     throw new BusinessException("允许开考的时间已结束");
                 }
             }
         }
-        ExamRecordStatusEnum sta = ExamRecordCacheUtil.getStatus(recordId);
-        if (ExamRecordStatusEnum.FINISHED.equals(sta) || ExamRecordStatusEnum.PERSISTED.equals(sta)) {
-            throw new BusinessException("该考试已结束");
-        }
+        
+
         Long paperId = ExamRecordCacheUtil.getPaperId(recordId);
         ExamPaperCacheBean ep = teExamPaperService.getExamPaperCacheBean(paperId);
         if (ep == null) {