|
@@ -207,13 +207,14 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public String importQuestion(List<QuestionImport> questionList, Boolean isUpdateSupport, String operName) {
|
|
|
+ public List<QuestionImport> importQuestion(List<QuestionImport> questionList, Boolean isUpdateSupport, String operName) {
|
|
|
if (Validator.isNull(questionList) || questionList.size() == 0) {
|
|
|
throw new CustomException("导入数据不能为空!");
|
|
|
}
|
|
|
String errorLog = "";
|
|
|
String importNo = ServletUtils.getEncoded("IMPORT");
|
|
|
int i=10;
|
|
|
+ List<QuestionImport> errorList = new ArrayList<>();
|
|
|
for (QuestionImport question : questionList) {
|
|
|
QuestionAddBo bo = new QuestionAddBo();
|
|
|
if(Validator.isNotEmpty(question.getKnowledge())){
|
|
@@ -222,7 +223,9 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
for (String knowledge : knowledgeList) {
|
|
|
Long knowledgeId = findKnowledgeId(knowledge);
|
|
|
if(!Validator.isNotEmpty(knowledgeId)){
|
|
|
- errorLog+=knowledge+"-该知识点不存在\n";
|
|
|
+ // errorLog+=knowledge+"-该知识点不存在\n";
|
|
|
+ question.setCause("该知识点不存在");
|
|
|
+ errorList.add(question);
|
|
|
continue;
|
|
|
}
|
|
|
kIdList.add(knowledgeId);
|
|
@@ -236,7 +239,9 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
}
|
|
|
Integer type = findType(question.getType());
|
|
|
if(type==null){
|
|
|
- errorLog+=question.getType()+"-该题目类型错误\n";
|
|
|
+ // errorLog+=question.getType()+"-该题目类型错误\n";
|
|
|
+ question.setCause("题目类型错误");
|
|
|
+ errorList.add(question);
|
|
|
continue;
|
|
|
}
|
|
|
/* if(!Validator.isNotEmpty(question.getPrefixName())){
|
|
@@ -254,22 +259,30 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
QuestionBusinessAddBo questionBusinessAddBo = new QuestionBusinessAddBo();
|
|
|
Long eduId = findEduId(question.getEducationType());
|
|
|
if(!Validator.isNotEmpty(eduId)){
|
|
|
- errorLog+=question.getEducationType()+"-该教育类型不存在\n";
|
|
|
+ // errorLog+=question.getEducationType()+"-该教育类型不存在\n";
|
|
|
+ question.setCause("教育类型不存在");
|
|
|
+ errorList.add(question);
|
|
|
continue;
|
|
|
}
|
|
|
Long projectId = findProjectId(question.getProject());
|
|
|
if(!Validator.isNotEmpty(projectId)){
|
|
|
- errorLog+=question.getProject()+"-该项目类型不存在\n";
|
|
|
+ // errorLog+=question.getProject()+"-该项目类型不存在\n";
|
|
|
+ question.setCause("项目类型不存在");
|
|
|
+ errorList.add(question);
|
|
|
continue;
|
|
|
}
|
|
|
Long businessId = findBusinessId(question.getBusiness());
|
|
|
if(!Validator.isNotEmpty(businessId)){
|
|
|
- errorLog+=question.getBusiness()+"-该业务层次不存在\n";
|
|
|
+ // errorLog+=question.getBusiness()+"-该业务层次不存在\n";
|
|
|
+ question.setCause("业务层次不存在");
|
|
|
+ errorList.add(question);
|
|
|
continue;
|
|
|
}
|
|
|
Long subjectId = findSubjectId(question.getSubject());
|
|
|
if(!Validator.isNotEmpty(subjectId)){
|
|
|
- errorLog+=question.getSubject()+"-该科目不存在\n";
|
|
|
+ // errorLog+=question.getSubject()+"-该科目不存在\n";
|
|
|
+ question.setCause("科目不存在");
|
|
|
+ errorList.add(question);
|
|
|
continue;
|
|
|
}
|
|
|
questionBusinessAddBo.setEducationTypeId(eduId);
|
|
@@ -283,7 +296,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
bo.setCreateBy(operName);
|
|
|
bo.setImportNo(importNo);
|
|
|
bo.setPublishStatus(1);
|
|
|
- errorLog = insertByAddBoImport(bo,errorLog,i);
|
|
|
+ errorLog = insertByAddBoImport(bo,i);
|
|
|
i++;
|
|
|
}
|
|
|
return errorLog;
|
|
@@ -295,7 +308,8 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
}
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public String insertByAddBoImport(QuestionAddBo bo,String errorLog,Integer no) {
|
|
|
+ public String insertByAddBoImport(QuestionAddBo bo,Integer no) {
|
|
|
+ String errorLog = null;
|
|
|
Question add = BeanUtil.toBean(bo, Question.class);
|
|
|
add.setCode(ServletUtils.getImportEncoded("TM")+no);
|
|
|
if(bo.getOptionsList()!=null){
|