|
@@ -346,16 +346,21 @@ public class DataUploadService {
|
|
|
}
|
|
|
//复制卷子给试评用
|
|
|
ExamQuestion questionNew = null;
|
|
|
- ExamQuestion isExist = examQuestionRepo.findByWorkIdAndSubjectAndAreaCode(workId, subject, dto.getAreaCode());
|
|
|
+ ExamQuestion isExist = examQuestionRepo.findByWorkIdAndSubjectAndAreaCodeAndTest(workId, subject, dto.getAreaCode(), TrialEnum.DEFAULT.getId());
|
|
|
if (Objects.isNull(isExist)) {
|
|
|
throw new Exception("请先上传试卷");
|
|
|
} else {
|
|
|
+ ExamQuestion questionTemp = examQuestionRepo.findByWorkIdAndSubjectAndAreaCodeAndTest(workId, subject, dto.getAreaCode(), TrialEnum.INIT.getId());
|
|
|
questionNew = new ExamQuestion();
|
|
|
- BeanUtils.copyProperties(isExist, questionNew);
|
|
|
- questionNew.setTest(TrialEnum.INIT.getId());
|
|
|
- questionNew.setName(new StringBuffer("试评").append(subject.getName()).append(dto.getAreaCode()).toString());
|
|
|
- questionNew.setId(null);
|
|
|
- examQuestionRepo.save(questionNew);
|
|
|
+ if (Objects.isNull(questionTemp)) {
|
|
|
+ BeanUtils.copyProperties(isExist, questionNew);
|
|
|
+ questionNew.setTest(TrialEnum.INIT.getId());
|
|
|
+ questionNew.setName(new StringBuffer("试评").append(subject.getName()).append(dto.getAreaCode()).toString());
|
|
|
+ questionNew.setId(null);
|
|
|
+ examQuestionRepo.save(questionNew);
|
|
|
+ } else {
|
|
|
+ BeanUtils.copyProperties(questionTemp, questionNew);
|
|
|
+ }
|
|
|
}
|
|
|
//复制学生给试评用
|
|
|
Student studentNew = null;
|