|
@@ -38,6 +38,7 @@ import cn.com.qmth.examcloud.commons.helpers.DynamicEnum;
|
|
|
import cn.com.qmth.examcloud.commons.helpers.DynamicEnumManager;
|
|
|
import cn.com.qmth.examcloud.core.examwork.base.enums.ExamProperty;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.ExamCourseRelationRepo;
|
|
|
+import cn.com.qmth.examcloud.core.examwork.dao.ExamIpLimitRepo;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.ExamPaperTypeRelationRepo;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.ExamPropertyRepo;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.ExamRepo;
|
|
@@ -46,11 +47,13 @@ import cn.com.qmth.examcloud.core.examwork.dao.ExamStageRepo;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.ExamStudentRepo;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamCourseRelationEntity;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamEntity;
|
|
|
+import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamIpLimitEntity;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamPaperTypeRelationEntity;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamPropertyEntity;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamSpecialSettingsEntity;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamStageEntity;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamStudentEntity;
|
|
|
+import cn.com.qmth.examcloud.core.examwork.dao.enums.IpLimitType;
|
|
|
import cn.com.qmth.examcloud.core.examwork.service.ExamCourseService;
|
|
|
import cn.com.qmth.examcloud.core.examwork.service.ExamService;
|
|
|
import cn.com.qmth.examcloud.core.examwork.service.OnGoingExamService;
|
|
@@ -153,6 +156,9 @@ public class ExamCloudServiceProvider extends ControllerSupport implements ExamC
|
|
|
|
|
|
@Autowired
|
|
|
OnGoingExamService onGoingExamService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ExamIpLimitRepo examIpLimitRepo;
|
|
|
|
|
|
@ApiOperation(value = "保存考试批次", notes = "保存")
|
|
|
@PostMapping("saveExam")
|
|
@@ -185,6 +191,14 @@ public class ExamCloudServiceProvider extends ControllerSupport implements ExamC
|
|
|
if(properties.get(ExamProperties.IS_OBJ_SCORE_VIEW.name())==null) {
|
|
|
properties.put(ExamProperties.IS_OBJ_SCORE_VIEW.name(),"true");
|
|
|
}
|
|
|
+ if("true".equals(properties.get(ExamProperties.IS_FACE_ENABLE.name()))) {
|
|
|
+ if(properties.get(ExamProperties.IS_FACE_CHECK.name())==null) {
|
|
|
+ properties.put(ExamProperties.IS_FACE_CHECK.name(),"true");
|
|
|
+ }
|
|
|
+ if(properties.get(ExamProperties.DISABLE_SNAPSHOT.name())==null) {
|
|
|
+ properties.put(ExamProperties.DISABLE_SNAPSHOT.name(),"false");
|
|
|
+ }
|
|
|
+ }
|
|
|
if(properties.get(ExamProperties.MARKING_TYPE.name())==null) {
|
|
|
properties.put(ExamProperties.MARKING_TYPE.name(),"ALL");
|
|
|
}
|
|
@@ -200,6 +214,7 @@ public class ExamCloudServiceProvider extends ControllerSupport implements ExamC
|
|
|
}
|
|
|
ExamEntity saved = examService.saveExam(examInfo, CURD.CREATION_OR_UPDATE);
|
|
|
disposeStage(req, saved);
|
|
|
+ disposeIpLimit(req, saved);
|
|
|
SaveExamResp resp = new SaveExamResp();
|
|
|
resp.setExamId(saved.getId());
|
|
|
|
|
@@ -222,7 +237,25 @@ public class ExamCloudServiceProvider extends ControllerSupport implements ExamC
|
|
|
return resp;
|
|
|
}
|
|
|
|
|
|
- private void disposeStage(SaveExamReq req,ExamEntity exam) {
|
|
|
+ private void disposeIpLimit(SaveExamReq req, ExamEntity saved) {
|
|
|
+ String iplimit=req.getProperties().get(ExamProperties.IP_LIMIT.name());
|
|
|
+ if("true".equals(iplimit)) {
|
|
|
+ examIpLimitRepo.deleteAllByExamId(saved.getId());
|
|
|
+ if(CollectionUtils.isNotEmpty(req.getIpWhitelist())) {
|
|
|
+ List<ExamIpLimitEntity> ips=new ArrayList<>();
|
|
|
+ for(String ip:req.getIpWhitelist()) {
|
|
|
+ ExamIpLimitEntity tem=new ExamIpLimitEntity();
|
|
|
+ tem.setExamId(saved.getId());
|
|
|
+ tem.setIp(ip);
|
|
|
+ tem.setLimitType(IpLimitType.HAS_ACCESS);
|
|
|
+ ips.add(tem);
|
|
|
+ }
|
|
|
+ examIpLimitRepo.saveAll(ips);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void disposeStage(SaveExamReq req,ExamEntity exam) {
|
|
|
if(req.getEnableExamStage()!=null&&!req.getEnableExamStage()) {
|
|
|
return;
|
|
|
}
|
|
@@ -244,15 +277,18 @@ public class ExamCloudServiceProvider extends ControllerSupport implements ExamC
|
|
|
esEntity.setEndTime(temEnd);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+ if(req.getEnableTimingEnd()!=null&&req.getEnableTimingEnd()) {
|
|
|
+ esEntity.setSubmitType(SubmitType.TIMING_END);
|
|
|
+ }else {
|
|
|
+ esEntity.setSubmitType(SubmitType.NORMAL);
|
|
|
+ }
|
|
|
esEntity.setRootOrgId(exam.getRootOrgId());
|
|
|
esEntity.setExamId(exam.getId());
|
|
|
esEntity.setStageOrder(1);
|
|
|
esEntity.setEnable(true);
|
|
|
esEntity.setSpecialSetting(false);
|
|
|
- esEntity.setSubmitType(SubmitType.NORMAL);
|
|
|
- esEntity.setSubmitDuration(null);
|
|
|
+ esEntity.setSubmitDuration(req.getDuration());
|
|
|
esEntity.setStartExamStatus(ExamStageStartExamStatus.NOT_START);
|
|
|
examStageRepo.save(esEntity);
|
|
|
}
|
|
@@ -304,6 +340,7 @@ public class ExamCloudServiceProvider extends ControllerSupport implements ExamC
|
|
|
bean.setRemark(exam.getRemark());
|
|
|
bean.setRootOrgId(exam.getRootOrgId());
|
|
|
bean.setExamLimit(exam.getExamLimit());
|
|
|
+ bean.setCallType(exam.getCallType());
|
|
|
|
|
|
return examResp;
|
|
|
}
|