Browse Source

加入场次禁用后的判断

wangliang 1 year ago
parent
commit
050d2f7547

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

@@ -303,6 +303,9 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
         if (ac == null) {
             throw new BusinessException(ExceptionResultEnum.NOT_FOUND_EXAM_ACTIVITY);
         }
+        if (ac.getEnable().intValue() == 0) {
+            throw new BusinessException(ExceptionResultEnum.EXAM_ACTIVITY_ENABLE);
+        }
         Date now = new Date();
         if (ExamModeEnum.ANYTIME.equals(examCache.getMode())) {
             Long start = ac.getStartTime() - (ac.getPrepareSeconds() * 1000);

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

@@ -269,7 +269,9 @@ public enum ExceptionResultEnum {
 
     EXAM_FINISH(500, 5000024, "考试已结束"),
 
-    REPEAT_CONNECT_ERROR(500, 5000025, "不允许重复连接");
+    REPEAT_CONNECT_ERROR(500, 5000025, "不允许重复连接"),
+
+    EXAM_ACTIVITY_ENABLE(500, 500026, "考试场次已停用");
 
     private int statusCode;