Ver código fonte

考试记录状态校验

wangliang 4 anos atrás
pai
commit
988d4d6614

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

@@ -512,6 +512,8 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
                         ExamActivityRecordCacheUtil.setExamRecordStatus(activityId, recordId,
                                 new ExamActivityRecordCacheBean(ExamRecordCacheUtil.getExamStudentId(recordId),
                                         ExamRecordCacheUtil.getStatus(recordId)));
+                    } else {
+                        throw new BusinessException(ExceptionResultEnum.EXAM_STATUS_ALREADY_UPDATE);
                     }
                     break;
                 } finally {
@@ -883,6 +885,8 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
                         ExamActivityRecordCacheUtil.setExamRecordStatus(es.getExamActivityId(), recordId,
                                 new ExamActivityRecordCacheBean(ExamRecordCacheUtil.getExamStudentId(recordId),
                                         ExamRecordCacheUtil.getStatus(recordId)));
+                    } else {
+                        throw new BusinessException(ExceptionResultEnum.EXAM_STATUS_ALREADY_UPDATE);
                     }
                     break;
                 } finally {
@@ -1066,6 +1070,8 @@ public class TEExamServiceImpl extends ServiceImpl<TEExamMapper, TEExam> impleme
                         ExamActivityRecordCacheUtil.setExamRecordStatus(es.getExamActivityId(), recordId,
                                 new ExamActivityRecordCacheBean(ExamRecordCacheUtil.getExamStudentId(recordId),
                                         ExamRecordCacheUtil.getStatus(recordId)));
+                    } else {
+                        throw new BusinessException(ExceptionResultEnum.EXAM_STATUS_ALREADY_UPDATE);
                     }
                     break;
                 } finally {

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

@@ -22,6 +22,7 @@ import com.qmth.themis.business.util.MqUtil;
 import com.qmth.themis.business.util.OssUtil;
 import com.qmth.themis.business.util.RedisUtil;
 import com.qmth.themis.business.util.UidUtil;
+import com.qmth.themis.common.enums.ExceptionResultEnum;
 import com.qmth.themis.common.exception.BusinessException;
 import com.qmth.themis.common.util.FileUtil;
 import com.qmth.themis.common.util.SimpleBeanUtil;
@@ -1049,6 +1050,8 @@ public class TOeExamRecordServiceImpl extends ServiceImpl<TOeExamRecordMapper, T
                         ExamActivityRecordCacheUtil.setExamRecordStatus(examActivityId, recordId,
                                 new ExamActivityRecordCacheBean(ExamRecordCacheUtil.getExamStudentId(recordId),
                                         ExamRecordCacheUtil.getStatus(recordId)));
+                    } else {
+                        throw new BusinessException(ExceptionResultEnum.EXAM_STATUS_ALREADY_UPDATE);
                     }
                     break;
                 } catch (Exception e) {

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

@@ -249,7 +249,9 @@ public enum ExceptionResultEnum {
 
     EXAM_STATUS_ERROR(500, 5000021, "考试状态错误"),
 
-    EXAM_ENABLE(500, 500022, "考试已停用");
+    EXAM_ENABLE(500, 500022, "考试已停用"),
+
+    EXAM_STATUS_ALREADY_UPDATE(500, 5000023, "考试状态已被修改");
 
     private int statusCode;
     private int code;