|
@@ -198,11 +198,23 @@ public class ExamServiceImpl implements ExamService {
|
|
|
*/
|
|
|
@Override
|
|
|
public ExamOrgEntity saveExamOrg(ExamOrgInfo examOrgInfo) {
|
|
|
- ExamOrgEntity examOrgEntity = new ExamOrgEntity();
|
|
|
- examOrgEntity.setId(examOrgInfo.getId());
|
|
|
+ ExamOrgEntity examOrgEntity = null;
|
|
|
+
|
|
|
+ if (null == examOrgInfo.getId()) {
|
|
|
+ examOrgEntity = examOrgRepo.findByExamIdAndOrgId(examOrgInfo.getExamId(),
|
|
|
+ examOrgInfo.getOrgId());
|
|
|
+ if (null == examOrgEntity) {
|
|
|
+ examOrgEntity = new ExamOrgEntity();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ examOrgEntity = examOrgRepo.findOne(examOrgInfo.getId());
|
|
|
+ if (null == examOrgEntity) {
|
|
|
+ throw new StatusException("E-001101", "id is wrong");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
examOrgEntity.setBeginTime(examOrgInfo.getBeginTime());
|
|
|
examOrgEntity.setEndTime(examOrgInfo.getEndTime());
|
|
|
- examOrgEntity.setId(examOrgInfo.getId());
|
|
|
examOrgEntity.setRootOrgId(examOrgInfo.getRootOrgId());
|
|
|
examOrgEntity.setExamId(examOrgInfo.getExamId());
|
|
|
examOrgEntity.setOrgId(examOrgInfo.getOrgId());
|