|
@@ -121,16 +121,25 @@ public class ExamServiceImpl implements ExamService {
|
|
|
throw new StatusException("E-002001", "id is wrong");
|
|
|
}
|
|
|
} else {
|
|
|
- exam = examRepo.findByNameAndRootOrgId(examInfo.getName(), examInfo.getRootOrgId());
|
|
|
- if (null == exam) {
|
|
|
- throw new StatusException("E-002002", "name is wrong");
|
|
|
- }
|
|
|
+ throw new StatusException("E-002002", "id is null");
|
|
|
}
|
|
|
if (!exam.getRootOrgId().equals(examInfo.getRootOrgId())) {
|
|
|
throw new StatusException("E-002003", "rootOrgId is wrong");
|
|
|
}
|
|
|
+ if (!exam.getExamType().equals(examInfo.getExamType())) {
|
|
|
+ throw new StatusException("E-002100", "examType is wrong");
|
|
|
+ }
|
|
|
+
|
|
|
+ ExamEntity tempExam = examRepo.findByNameAndRootOrgId(examInfo.getName(),
|
|
|
+ examInfo.getRootOrgId());
|
|
|
+ if (null != tempExam && tempExam.getId().equals(examInfo.getId())) {
|
|
|
+ throw new StatusException("E-002005", "考试名称已存在");
|
|
|
+ }
|
|
|
+
|
|
|
realStatus = DataExecutionStatus.UPDATE;
|
|
|
- } else if (es.equals(DataExecutionStatus.CREATION)) {
|
|
|
+ }
|
|
|
+ // 创建
|
|
|
+ else if (es.equals(DataExecutionStatus.CREATION)) {
|
|
|
if (null != examInfo.getId()) {
|
|
|
throw new StatusException("E-002004", "id is needless");
|
|
|
}
|
|
@@ -142,7 +151,9 @@ public class ExamServiceImpl implements ExamService {
|
|
|
exam = new ExamEntity();
|
|
|
exam.setEnable(true);
|
|
|
realStatus = DataExecutionStatus.CREATION;
|
|
|
- } else if (es.equals(DataExecutionStatus.CREATION_OR_UPDATE)) {
|
|
|
+ }
|
|
|
+ // (根据考试名称)新增或创建
|
|
|
+ else if (es.equals(DataExecutionStatus.CREATION_OR_UPDATE)) {
|
|
|
if (null != examInfo.getId()) {
|
|
|
throw new StatusException("E-002006", "id is needless");
|
|
|
}
|
|
@@ -152,6 +163,12 @@ public class ExamServiceImpl implements ExamService {
|
|
|
exam.setEnable(true);
|
|
|
realStatus = DataExecutionStatus.CREATION;
|
|
|
} else {
|
|
|
+ if (!exam.getRootOrgId().equals(examInfo.getRootOrgId())) {
|
|
|
+ throw new StatusException("E-002003", "rootOrgId is wrong");
|
|
|
+ }
|
|
|
+ if (!exam.getExamType().equals(examInfo.getExamType())) {
|
|
|
+ throw new StatusException("E-002100", "examType is wrong");
|
|
|
+ }
|
|
|
realStatus = DataExecutionStatus.UPDATE;
|
|
|
}
|
|
|
}
|