瀏覽代碼

完善新活体代码

lideyin 5 年之前
父節點
當前提交
8c63a0775f

+ 10 - 0
examcloud-core-oe-admin-api-provider/src/main/java/cn/com/qmth/examcloud/core/oe/admin/api/provider/ExamScoreDataCloudServiceProvider.java

@@ -16,6 +16,7 @@ import cn.com.qmth.examcloud.core.oe.admin.service.ExamScoreService;
 import cn.com.qmth.examcloud.core.oe.common.base.utils.Check;
 import cn.com.qmth.examcloud.core.oe.common.entity.*;
 import cn.com.qmth.examcloud.core.oe.common.enums.DisciplineType;
+import cn.com.qmth.examcloud.core.oe.common.enums.ExamType;
 import cn.com.qmth.examcloud.core.oe.common.repository.*;
 import cn.com.qmth.examcloud.core.oe.common.service.GainBaseDataService;
 import cn.com.qmth.examcloud.examwork.api.ExamCloudService;
@@ -328,6 +329,12 @@ public class ExamScoreDataCloudServiceProvider extends ControllerSupport impleme
         if (req.getExamId() == null) {
             throw new StatusException("100003", "考试id不允许为空");
         }
+        //只支持离线和在线考试
+        ExamSettingsCacheBean examSettings = CacheHelper.getExamSettings(req.getExamId());
+        if (!(ExamType.ONLINE.toString().equals(examSettings.getExamType()) ||
+                ExamType.OFFLINE.toString().equals(examSettings.getExamType()))) {
+            throw new StatusException("100009", "不支持的考试类型");
+        }
 
         if (StringUtils.isEmpty(req.getIdentityNumber()) && StringUtils.isEmpty(req.getStudentCode())) {
             throw new StatusException("100004", "学号和身份证号不能同时为空");
@@ -353,6 +360,9 @@ public class ExamScoreDataCloudServiceProvider extends ControllerSupport impleme
         //如果该学生缺考,直接返回
         ExamStudentEntity examStudent = examStudentRepo.findByIdentityNumberAndExamIdAndCourseId(
                 identityNumber, req.getExamId(), courseId);
+        if (examStudent == null) {
+            throw new StatusException("100008", "考生不存在");
+        }
         Boolean isAbsent = examStudent.getFinished() == null || !examStudent.getFinished();
         if (isAbsent) {
             resp.setAbsent(true);