题库导入修改
This commit is contained in:
parent
583806972a
commit
cb312b1ed2
@ -394,33 +394,35 @@ public class ExamQuestionBankController {
|
||||
List<ExamQuestionOption> examQuestionOptionList = new ArrayList<>();
|
||||
int index = 0;
|
||||
for (ExamQuestionBankImport examQuestionBankImport : examQuestionBankImports) {
|
||||
if (StringUtils.isNotBlank(examQuestionBankImport.getIndex())) {
|
||||
index++;
|
||||
List<ExamSubject> subjects = subList.stream().filter(s -> s.getName().equals(examQuestionBankImport.getSubjectName())).collect(Collectors.toList());
|
||||
if (subjects == null || subjects.size() == 0) {
|
||||
throw new CustomException("没有对应的科目名称,请检查", HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
if (StringUtils.isNotBlank(examQuestionBankImport.getQuestionName())) {
|
||||
if (StringUtils.isNotBlank(examQuestionBankImport.getIndex())) {
|
||||
index++;
|
||||
List<ExamSubject> subjects = subList.stream().filter(s -> s.getName().equals(examQuestionBankImport.getSubjectName())).collect(Collectors.toList());
|
||||
if (subjects == null || subjects.size() == 0) {
|
||||
throw new CustomException("没有对应的科目名称,请检查", HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
}
|
||||
ExamQuestionBank examQuestionBank = new ExamQuestionBank();
|
||||
examQuestionBank.setId((long) index);
|
||||
examQuestionBank.setSubjectId(subjects.get(0).getId());
|
||||
examQuestionBank.setQuestionName(examQuestionBankImport.getQuestionName());
|
||||
examQuestionBank.setType(getType(examQuestionBankImport.getTypeName()));
|
||||
examQuestionBank.setDifficulty(getDifficulty(examQuestionBankImport.getDifficulty()));
|
||||
examQuestionBank.setOptions(examQuestionBankImport.getOptions());
|
||||
examQuestionBank.setIsEnable(examQuestionBankImport.getIsEnable().equals("是") ? 1 : 0);
|
||||
examQuestionBank.setScore(examQuestionBankImport.getScore());
|
||||
examQuestionBank.setProjectSn(systemUser.getSn());
|
||||
examQuestionBank.setCreateBy(systemUser.getUserId().toString());
|
||||
examQuestionBank.setCreateTime(new Date());
|
||||
examQuestionBank.setUpdateBy(systemUser.getUserId().toString());
|
||||
examQuestionBank.setUpdateTime(examQuestionBank.getCreateTime());
|
||||
examQuestionBankList.add(examQuestionBank);
|
||||
} else {
|
||||
ExamQuestionOption examQuestionOption = new ExamQuestionOption();
|
||||
examQuestionOption.setQuestionId((long) index);
|
||||
examQuestionOption.setOptionCode(examQuestionBankImport.getSubjectName());
|
||||
examQuestionOption.setOptionDesc(examQuestionBankImport.getQuestionName());
|
||||
examQuestionOptionList.add(examQuestionOption);
|
||||
}
|
||||
ExamQuestionBank examQuestionBank = new ExamQuestionBank();
|
||||
examQuestionBank.setId((long) index);
|
||||
examQuestionBank.setSubjectId(subjects.get(0).getId());
|
||||
examQuestionBank.setQuestionName(examQuestionBankImport.getQuestionName());
|
||||
examQuestionBank.setType(getType(examQuestionBankImport.getTypeName()));
|
||||
examQuestionBank.setDifficulty(getDifficulty(examQuestionBankImport.getDifficulty()));
|
||||
examQuestionBank.setOptions(examQuestionBankImport.getOptions());
|
||||
examQuestionBank.setIsEnable(examQuestionBankImport.getIsEnable().equals("是") ? 1 : 0);
|
||||
examQuestionBank.setScore(examQuestionBankImport.getScore());
|
||||
examQuestionBank.setProjectSn(systemUser.getSn());
|
||||
examQuestionBank.setCreateBy(systemUser.getUserId().toString());
|
||||
examQuestionBank.setCreateTime(new Date());
|
||||
examQuestionBank.setUpdateBy(systemUser.getUserId().toString());
|
||||
examQuestionBank.setUpdateTime(examQuestionBank.getCreateTime());
|
||||
examQuestionBankList.add(examQuestionBank);
|
||||
} else {
|
||||
ExamQuestionOption examQuestionOption = new ExamQuestionOption();
|
||||
examQuestionOption.setQuestionId((long) index);
|
||||
examQuestionOption.setOptionCode(examQuestionBankImport.getSubjectName());
|
||||
examQuestionOption.setOptionDesc(examQuestionBankImport.getQuestionName());
|
||||
examQuestionOptionList.add(examQuestionOption);
|
||||
}
|
||||
}
|
||||
for (ExamQuestionBank examQuestionBank : examQuestionBankList) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user