|
@@ -66,6 +66,7 @@ import cn.com.qmth.examcloud.core.basic.api.request.GetStudentReq;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.response.GetOrgResp;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.response.GetOrgsResp;
|
|
|
import cn.com.qmth.examcloud.core.basic.api.response.GetStudentResp;
|
|
|
+import cn.com.qmth.examcloud.core.examwork.api.controller.bean.CopyExamDomain;
|
|
|
import cn.com.qmth.examcloud.core.examwork.api.controller.bean.ExamDomain;
|
|
|
import cn.com.qmth.examcloud.core.examwork.api.controller.bean.ExamOrgSettingsDomain;
|
|
|
import cn.com.qmth.examcloud.core.examwork.base.enums.ExamProperty;
|
|
@@ -83,9 +84,9 @@ import cn.com.qmth.examcloud.core.examwork.dao.entity.ExamPaperTypeRelationEntit
|
|
|
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.ExamStudentEntity;
|
|
|
+import cn.com.qmth.examcloud.core.examwork.service.ExamService;
|
|
|
import cn.com.qmth.examcloud.core.examwork.service.bean.ExamInfo;
|
|
|
import cn.com.qmth.examcloud.core.examwork.service.bean.ExamSpecialSettingsInfo;
|
|
|
-import cn.com.qmth.examcloud.core.examwork.service.impl.ExamServiceImpl;
|
|
|
import cn.com.qmth.examcloud.core.examwork.service.impl.ExamStudentServiceImpl;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.api.ExamRecordCloudService;
|
|
|
import cn.com.qmth.examcloud.core.oe.admin.api.request.CheckExamIsStartedReq;
|
|
@@ -123,7 +124,7 @@ public class ExamController extends ControllerSupport {
|
|
|
ExamRepo examRepo;
|
|
|
|
|
|
@Autowired
|
|
|
- ExamServiceImpl examService;
|
|
|
+ ExamService examService;
|
|
|
|
|
|
@Autowired
|
|
|
ExamStudentRepo examStudentRepo;
|
|
@@ -553,6 +554,80 @@ public class ExamController extends ControllerSupport {
|
|
|
return saved;
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "复制考试批次", notes = "")
|
|
|
+ @PostMapping("copyExam")
|
|
|
+ public void copyExam(@RequestBody CopyExamDomain domain) {
|
|
|
+
|
|
|
+ Long srcExamId = domain.getSrcExamId();
|
|
|
+
|
|
|
+ ExamEntity srcExam = GlobalHelper.getEntity(examRepo, srcExamId, ExamEntity.class);
|
|
|
+ if (null == srcExam) {
|
|
|
+ throw new StatusException("001259", "examId is wrong");
|
|
|
+ }
|
|
|
+
|
|
|
+ validateRootOrgIsolation(srcExam.getRootOrgId());
|
|
|
+
|
|
|
+ ExamDomain ed = new ExamDomain();
|
|
|
+ ed.setBeginTime(srcExam.getBeginTime());
|
|
|
+ ed.setDuration(srcExam.getDuration());
|
|
|
+ ed.setEnable(srcExam.getEnable());
|
|
|
+ ed.setEndTime(srcExam.getEndTime());
|
|
|
+ ed.setExamTimes(srcExam.getExamTimes());
|
|
|
+ ed.setExamType(srcExam.getExamType());
|
|
|
+ ed.setRemark(srcExam.getRemark());
|
|
|
+ ed.setRootOrgId(srcExam.getRootOrgId());
|
|
|
+ ed.setStarted(isStarted(srcExam.getId()));
|
|
|
+ ed.setExamLimit(srcExam.getExamLimit());
|
|
|
+
|
|
|
+ ed.setName(domain.getDestExamName());
|
|
|
+ ed.setCode(domain.getDestExamCode());
|
|
|
+
|
|
|
+ Map<String, String> map = Maps.newHashMap();
|
|
|
+ List<ExamPropertyEntity> list = examPropertyRepo.findByExamId(srcExam.getId());
|
|
|
+ DynamicEnumManager manager = ExamProperty.getDynamicEnumManager();
|
|
|
+ for (ExamPropertyEntity cur : list) {
|
|
|
+ DynamicEnum de = manager.getById(cur.getKeyId());
|
|
|
+ map.put(de.getName(), cur.getValue());
|
|
|
+ }
|
|
|
+
|
|
|
+ ed.setProperties(map);
|
|
|
+
|
|
|
+ ExamEntity savedExam = saveExam(ed, CURD.CREATION);
|
|
|
+
|
|
|
+ Boolean copyOrgSettings = domain.getCopyOrgSettings();
|
|
|
+
|
|
|
+ if (copyOrgSettings) {
|
|
|
+ List<ExamSpecialSettingsEntity> orgSettingsList = examSpecialSettingsRepo
|
|
|
+ .findAllByExamIdAndCourseIdIsNullAndOrgIdIsNotNull(srcExam.getId());
|
|
|
+
|
|
|
+ for (ExamSpecialSettingsEntity cur : orgSettingsList) {
|
|
|
+
|
|
|
+ ExamSpecialSettingsInfo info = new ExamSpecialSettingsInfo();
|
|
|
+ info.setBeginTime(cur.getBeginTime());
|
|
|
+ info.setEndTime(cur.getEndTime());
|
|
|
+ info.setOrgId(cur.getOrgId());
|
|
|
+ info.setExamLimit(cur.getExamLimit());
|
|
|
+ info.setRootOrgId(cur.getRootOrgId());
|
|
|
+
|
|
|
+ info.setExamId(savedExam.getId());
|
|
|
+
|
|
|
+ List<ExamOrgPropertyEntity> propList = examOrgPropertyRepo
|
|
|
+ .findByexamIdAndOrgId(cur.getExamId(), cur.getOrgId());
|
|
|
+
|
|
|
+ Map<String, String> orgProperties = Maps.newHashMap();
|
|
|
+ for (ExamOrgPropertyEntity curOrgProp : propList) {
|
|
|
+ DynamicEnum de = manager.getById(curOrgProp.getKeyId());
|
|
|
+ map.put(de.getName(), curOrgProp.getValue());
|
|
|
+ }
|
|
|
+ info.setOrgProperties(orgProperties);
|
|
|
+
|
|
|
+ examService.saveExamSpecialSettings(info);
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 方法注释
|
|
|
*
|