ソースを参照

新活检添加考试已结束校验

lideyin 5 年 前
コミット
8b72077b70

+ 18 - 4
examcloud-core-oe-student-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/student/controller/FaceBiopsyController.java

@@ -8,6 +8,7 @@ import cn.com.qmth.examcloud.core.oe.common.entity.ExamRecordDataEntity;
 import cn.com.qmth.examcloud.core.oe.common.entity.FaceBiopsyItemEntity;
 import cn.com.qmth.examcloud.core.oe.common.entity.FaceBiopsyItemStepEntity;
 import cn.com.qmth.examcloud.core.oe.common.enums.ExamProperties;
+import cn.com.qmth.examcloud.core.oe.common.enums.ExamRecordStatus;
 import cn.com.qmth.examcloud.core.oe.common.enums.FaceBiopsyType;
 import cn.com.qmth.examcloud.core.oe.common.repository.ExamRecordDataRepo;
 import cn.com.qmth.examcloud.core.oe.common.repository.FaceBiopsyItemRepo;
@@ -70,10 +71,14 @@ public class FaceBiopsyController extends ControllerSupport {
             throw new StatusException("200101", "无效的考试记录");
         }
 
+        if (ExamRecordStatus.EXAM_ING != examRecordData.getExamRecordStatus()) {
+            throw new StatusException("200103", "考试已结束");
+        }
+
         // 获取考试会话,判断考生是否已结束考试
         ExamSessionInfo examSessionInfo = examSessionInfoService.getExamSessionInfo(studentId);
         if (examSessionInfo == null) {
-            throw new StatusException("200102", "考试会话已过期");
+            throw new StatusException("200104", "考试会话已过期");
         }
 
         //考试未开启人脸活体检测,不允许获取活检信息
@@ -81,7 +86,7 @@ public class FaceBiopsyController extends ControllerSupport {
                 examRecordData.getOrgId(), examRecordData.getStudentId(),
                 ExamProperties.IS_FACE_VERIFY.name()).getValue();
         if (!Constants.isTrue.equals(isFaceVerifyStr)) {
-            throw new StatusException("200103", "本场考试未开启人脸活体检测");
+            throw new StatusException("200105", "本场考试未开启人脸活体检测");
         }
 
         FaceBiopsyBaseInfo faceBiopsyBaseInfo = new FaceBiopsyBaseInfo();
@@ -120,10 +125,14 @@ public class FaceBiopsyController extends ControllerSupport {
             throw new StatusException("200101", "无效的考试记录");
         }
 
+        if (ExamRecordStatus.EXAM_ING != examRecordData.getExamRecordStatus()) {
+            throw new StatusException("200102", "考试已结束");
+        }
+
         // 获取考试会话,判断考生是否已结束考试
         ExamSessionInfo examSessionInfo = examSessionInfoService.getExamSessionInfo(studentId);
         if (examSessionInfo == null) {
-            throw new StatusException("200102", "考试会话已过期");
+            throw new StatusException("200103", "考试会话已过期");
         }
 
         //考试未开启人脸活体检测,不允许获取活检信息
@@ -131,7 +140,7 @@ public class FaceBiopsyController extends ControllerSupport {
                 examRecordData.getOrgId(), examRecordData.getStudentId(),
                 ExamProperties.IS_FACE_VERIFY.name()).getValue();
         if (!Constants.isTrue.equals(isFaceVerifyStr)) {
-            throw new StatusException("200103", "本场考试未开启人脸活体检测");
+            throw new StatusException("200104", "本场考试未开启人脸活体检测");
         }
 
         return faceBiopsyService.getFaceBiopsyInfo(user.getRootOrgId(), examRecordDataId, FaceBiopsyType.FACE_MOTION);
@@ -156,6 +165,11 @@ public class FaceBiopsyController extends ControllerSupport {
         if (examRecordData == null) {
             throw new StatusException("200105", "无效的考试记录");
         }
+
+        if (ExamRecordStatus.EXAM_ING != examRecordData.getExamRecordStatus()) {
+            throw new StatusException("200105", "考试已结束");
+        }
+
         if (req.getFaceBiopsyItemId() == null) {
             throw new StatusException("200106", "人脸活体检测明细id不允许为空");
         }