|
@@ -1,5 +1,6 @@
|
|
|
package cn.com.qmth.examcloud.core.oe.student.service.impl;
|
|
|
|
|
|
+import cn.com.qmth.examcloud.api.commons.enums.ExamSpecialSettingsType;
|
|
|
import cn.com.qmth.examcloud.api.commons.security.bean.User;
|
|
|
import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
|
import cn.com.qmth.examcloud.commons.util.ByteUtil;
|
|
@@ -448,12 +449,38 @@ public class ExamControlServiceImpl implements ExamControlService {
|
|
|
* @return
|
|
|
*/
|
|
|
private ExamBean checkExam(ExamStudentEntity examStudentEntity) {
|
|
|
-
|
|
|
- // examStudentEntity.getOrgId());
|
|
|
+ Long examId = examStudentEntity.getExamId();
|
|
|
+ Long orgId = examStudentEntity.getOrgId();
|
|
|
+ Long studentId = examStudentEntity.getStudentId();
|
|
|
|
|
|
// 学习中心特殊考试配置(是否禁考,开考时间可以特殊设置)
|
|
|
- ExamBean examBean = ExamCacheTransferHelper.getCachedExam(examStudentEntity.getExamId(),
|
|
|
- examStudentEntity.getOrgId(), examStudentEntity.getStudentId());
|
|
|
+ ExamBean examBean = ExamCacheTransferHelper.getCachedExam(examId, orgId, studentId);
|
|
|
+
|
|
|
+ //如果启用了了特殊设置,并且无特殊设置时结束考试 配置 设置为true..且实际未设置特殊设置则不允许考试
|
|
|
+ ExamPropertyCacheBean limitedIfNoSpecialSettings = ExamCacheTransferHelper.getDefaultCachedExamProperty(examId,
|
|
|
+ ExamProperties.LIMITED_IF_NO_SPECIAL_SETTINGS.toString());
|
|
|
+ if (examBean.getSpecialSettingsEnabled() &&
|
|
|
+ (limitedIfNoSpecialSettings.getHasValue() && Boolean.valueOf(limitedIfNoSpecialSettings.getValue()))) {
|
|
|
+
|
|
|
+ //学生特殊设置开启未配置,不允许考试
|
|
|
+ if (examBean.getSpecialSettingsType() == ExamSpecialSettingsType.STUDENT_BASED) {
|
|
|
+ ExamStudentSettingsCacheBean specialSettings = CacheHelper.getExamStudentSettings(examId, studentId);
|
|
|
+ if (!specialSettings.getHasValue()) {
|
|
|
+ throw new StatusException("100014", "考试配置未完成,不允许考试");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //机构特殊设置开启未配置,不允许考试
|
|
|
+ if (examBean.getSpecialSettingsType() == ExamSpecialSettingsType.ORG_BASED) {
|
|
|
+ ExamOrgSettingsCacheBean specialSettings = CacheHelper.getExamOrgSettings(examId, orgId);
|
|
|
+ if (!specialSettings.getHasValue()) {
|
|
|
+ throw new StatusException("100015", "考试配置未完成,不允许考试");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
if (!examBean.getEnable() || (examBean.getExamLimit() != null && examBean.getExamLimit())) {
|
|
|
throw new StatusException("ExamControlServiceImpl-checkExam-exception-01", "暂无考试资格,请与学校老师联系");
|
|
|
}
|