|
@@ -35,6 +35,7 @@ import com.google.common.collect.Lists;
|
|
|
|
|
|
import cn.com.qmth.examcloud.commons.base.exception.StatusException;
|
|
|
import cn.com.qmth.examcloud.commons.base.util.ErrorMsg;
|
|
|
+import cn.com.qmth.examcloud.commons.web.security.bean.User;
|
|
|
import cn.com.qmth.examcloud.commons.web.support.ControllerSupport;
|
|
|
import cn.com.qmth.examcloud.core.examwork.api.controller.bean.CourseGroupBean;
|
|
|
import cn.com.qmth.examcloud.core.examwork.dao.CourseGroupRelationRepo;
|
|
@@ -160,46 +161,43 @@ public class ExamController extends ControllerSupport {
|
|
|
public Exam addExam(HttpServletRequest request, @RequestBody Exam exam) {
|
|
|
|
|
|
if (null != exam.getBeforeExamRemark() && exam.getBeforeExamRemark().length() > 250000) {
|
|
|
- throw new StatusException("EXAMWORK-001002", "考前说明内容过大");
|
|
|
+ throw new StatusException("E-001002", "考前说明内容过大");
|
|
|
}
|
|
|
if (null != exam.getAfterExamRemark() && exam.getAfterExamRemark().length() > 250000) {
|
|
|
- throw new StatusException("EXAMWORK-001002", "考后说明内容过大");
|
|
|
+ throw new StatusException("E-001002", "考后说明内容过大");
|
|
|
}
|
|
|
if (null != exam.getCheatingRemark() && exam.getCheatingRemark().length() > 250000) {
|
|
|
- throw new StatusException("EXAMWORK-001002", "作弊说明内容过大");
|
|
|
+ throw new StatusException("E-001002", "作弊说明内容过大");
|
|
|
}
|
|
|
|
|
|
- cn.com.qmth.examcloud.commons.web.security.bean.User accessUser = getAccessUser();
|
|
|
- if (accessUser != null) {
|
|
|
- exam.setOrgId(accessUser.getOrgId());
|
|
|
- exam.setRootOrgId(accessUser.getRootOrgId());
|
|
|
- exam.setCreateTime(new Date());
|
|
|
- exam.setCanStuDel(true);
|
|
|
- if (!examService.checkExamName(exam)) {
|
|
|
- throw new StatusException("EXAMWORK-001001", "考试名称已存在,请重新填写");
|
|
|
- }
|
|
|
- Exam ret = examService.insertExam(exam, accessUser);
|
|
|
- return ret;
|
|
|
- } else {
|
|
|
- throw new StatusException("EXAMWORK-001002", "accessUser为空");
|
|
|
+ User accessUser = getAccessUser();
|
|
|
+
|
|
|
+ exam.setOrgId(accessUser.getOrgId());
|
|
|
+ exam.setRootOrgId(accessUser.getRootOrgId());
|
|
|
+ exam.setCreateTime(new Date());
|
|
|
+ exam.setCanStuDel(true);
|
|
|
+ if (!examService.checkExamName(exam)) {
|
|
|
+ throw new StatusException("E-001001", "考试名称已存在,请重新填写");
|
|
|
}
|
|
|
+ Exam ret = examService.insertExam(exam, accessUser);
|
|
|
+ return ret;
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "更新考试批次", notes = "更新")
|
|
|
@PutMapping("/exam")
|
|
|
public Exam updateExam(@RequestBody Exam exam) {
|
|
|
if (!examService.checkExamName(exam)) {
|
|
|
- throw new StatusException("EXAMWORK-001001", "考试名称已存在,请重新填写");
|
|
|
+ throw new StatusException("E-001001", "考试名称已存在,请重新填写");
|
|
|
}
|
|
|
|
|
|
if (null != exam.getBeforeExamRemark() && exam.getBeforeExamRemark().length() > 250000) {
|
|
|
- throw new StatusException("EXAMWORK-001002", "考前说明内容过大");
|
|
|
+ throw new StatusException("E-001002", "考前说明内容过大");
|
|
|
}
|
|
|
if (null != exam.getAfterExamRemark() && exam.getAfterExamRemark().length() > 250000) {
|
|
|
- throw new StatusException("EXAMWORK-001002", "考后说明内容过大");
|
|
|
+ throw new StatusException("E-001002", "考后说明内容过大");
|
|
|
}
|
|
|
if (null != exam.getCheatingRemark() && exam.getCheatingRemark().length() > 250000) {
|
|
|
- throw new StatusException("EXAMWORK-001002", "作弊说明内容过大");
|
|
|
+ throw new StatusException("E-001002", "作弊说明内容过大");
|
|
|
}
|
|
|
|
|
|
Exam ret = examService.saveExam(exam);
|