浏览代码

候考和查询考试口令加入禁用状态过滤

wangliang 4 年之前
父节点
当前提交
e81c3f14af

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

@@ -206,7 +206,9 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
             throw new BusinessException(ExceptionResultEnum.EXAM_STUDENT_ENABLE);
         }
         ExamCacheBean examCache = getExamCacheBeanNative(es.getExamId());
-
+        if (examCache.getEnable().intValue() == 0) {
+            throw new BusinessException(ExceptionResultEnum.EXAM_ENABLE);
+        }
         checkIp(examCache);
 
         Long unFinishedRecordId = ExamingDataCacheUtil.getUnFinishedRecordId(studentId);

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

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

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

@@ -71,7 +71,7 @@ public class TEExamController {
         }
         String shortCode = String.valueOf(mapParameter.get("shortCode"));
         QueryWrapper<TEExam> teExamQueryWrapper = new QueryWrapper<>();
-        teExamQueryWrapper.lambda().eq(TEExam::getShortCode, shortCode);
+        teExamQueryWrapper.lambda().eq(TEExam::getShortCode, shortCode).eq(TEExam::getEnable, 1);
         TEExam teExam = teExamService.getOne(teExamQueryWrapper);
         if (Objects.isNull(teExam)) {
             throw new BusinessException(ExceptionResultEnum.EXAM_NO);