|
@@ -228,7 +228,9 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
return this.removeByIds(ids);
|
|
return this.removeByIds(ids);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
public List<QuestionImport> 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) {
|
|
if (Validator.isNull(questionList) || questionList.size() == 0) {
|
|
throw new CustomException("导入数据不能为空!");
|
|
throw new CustomException("导入数据不能为空!");
|
|
@@ -238,6 +240,9 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
int i = 1;
|
|
int i = 1;
|
|
Long nowTime = DateUtils.getNowTime();
|
|
Long nowTime = DateUtils.getNowTime();
|
|
List<QuestionImport> errorList = new ArrayList<>();
|
|
List<QuestionImport> errorList = new ArrayList<>();
|
|
|
|
+ Collections.reverse(questionList);
|
|
|
|
+ //案例附属题数组
|
|
|
|
+ List<QuestionAddBo> attList = new ArrayList<>();
|
|
for (QuestionImport question : questionList) {
|
|
for (QuestionImport question : questionList) {
|
|
QuestionAddBo bo = new QuestionAddBo();
|
|
QuestionAddBo bo = new QuestionAddBo();
|
|
|
|
|
|
@@ -252,6 +257,11 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
errorList.add(question);
|
|
errorList.add(question);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
|
|
+ if(Validator.isEmpty(question.getAttached())){
|
|
|
|
+ question.setCause("是否案例小题错误");
|
|
|
|
+ errorList.add(question);
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
/* if(!Validator.isNotEmpty(question.getPrefixName())){
|
|
/* if(!Validator.isNotEmpty(question.getPrefixName())){
|
|
errorLog+=question.getContent()+"-前缀名称空白\n";
|
|
errorLog+=question.getContent()+"-前缀名称空白\n";
|
|
continue;
|
|
continue;
|
|
@@ -266,28 +276,28 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
List<QuestionBusinessAddBo> businessList = new ArrayList<>();
|
|
List<QuestionBusinessAddBo> businessList = new ArrayList<>();
|
|
QuestionBusinessAddBo questionBusinessAddBo = new QuestionBusinessAddBo();
|
|
QuestionBusinessAddBo questionBusinessAddBo = new QuestionBusinessAddBo();
|
|
Long eduId = findEduId(question.getEducationType());
|
|
Long eduId = findEduId(question.getEducationType());
|
|
- if (!Validator.isNotEmpty(eduId)) {
|
|
|
|
|
|
+ if (question.getAttached().equals("否")&&!Validator.isNotEmpty(eduId)) {
|
|
// errorLog+=question.getEducationType()+"-该教育类型不存在\n";
|
|
// errorLog+=question.getEducationType()+"-该教育类型不存在\n";
|
|
question.setCause("教育类型不存在");
|
|
question.setCause("教育类型不存在");
|
|
errorList.add(question);
|
|
errorList.add(question);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
Long projectId = findProjectId(question.getProject(), eduId);
|
|
Long projectId = findProjectId(question.getProject(), eduId);
|
|
- if (!Validator.isNotEmpty(projectId)) {
|
|
|
|
|
|
+ if (question.getAttached().equals("否")&&!Validator.isNotEmpty(projectId)) {
|
|
// errorLog+=question.getProject()+"-该项目类型不存在\n";
|
|
// errorLog+=question.getProject()+"-该项目类型不存在\n";
|
|
question.setCause("项目类型不存在");
|
|
question.setCause("项目类型不存在");
|
|
errorList.add(question);
|
|
errorList.add(question);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
Long businessId = findBusinessId(question.getBusiness(), projectId);
|
|
Long businessId = findBusinessId(question.getBusiness(), projectId);
|
|
- if (!Validator.isNotEmpty(businessId)) {
|
|
|
|
|
|
+ if (question.getAttached().equals("否")&&!Validator.isNotEmpty(businessId)) {
|
|
// errorLog+=question.getBusiness()+"-该业务层次不存在\n";
|
|
// errorLog+=question.getBusiness()+"-该业务层次不存在\n";
|
|
question.setCause("业务层次不存在");
|
|
question.setCause("业务层次不存在");
|
|
errorList.add(question);
|
|
errorList.add(question);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
Long subjectId = findSubjectId(question.getSubject());
|
|
Long subjectId = findSubjectId(question.getSubject());
|
|
- if (!Validator.isNotEmpty(subjectId)) {
|
|
|
|
|
|
+ if (question.getAttached().equals("否")&&!Validator.isNotEmpty(subjectId)) {
|
|
// errorLog+=question.getSubject()+"-该科目不存在\n";
|
|
// errorLog+=question.getSubject()+"-该科目不存在\n";
|
|
question.setCause("科目不存在");
|
|
question.setCause("科目不存在");
|
|
errorList.add(question);
|
|
errorList.add(question);
|
|
@@ -338,9 +348,31 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
bo.setPublishStatus(1);
|
|
bo.setPublishStatus(1);
|
|
bo.setImportSort(nowTime + i); //导入时间从小到大排
|
|
bo.setImportSort(nowTime + i); //导入时间从小到大排
|
|
bo.setCreateTime(nowTime); //从大到小排
|
|
bo.setCreateTime(nowTime); //从大到小排
|
|
- errorLog = insertByAddBoImport(bo, i);
|
|
|
|
|
|
+ System.out.println(question);
|
|
|
|
+ if (question.getAttached().equals("是")){
|
|
|
|
+ System.out.println("123");
|
|
|
|
+ attList.add(bo);
|
|
|
|
+ }else{
|
|
|
|
+ System.out.println(bo);
|
|
|
|
+ System.out.println("CCVF"+bo.getType());
|
|
|
|
+ if(bo.getType()==4){//案例题
|
|
|
|
+ Collections.reverse(attList);
|
|
|
|
+ System.out.println("777");
|
|
|
|
+ bo.setJsonStr(JSON.toJSONString(attList));
|
|
|
|
+ System.out.println("666");
|
|
|
|
+ attList.clear();
|
|
|
|
+ }else {
|
|
|
|
+
|
|
|
|
+ System.out.println(errorList);
|
|
|
|
+ if(attList.size()>0){
|
|
|
|
+ throw new CustomException("案例题格式错误");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ errorLog = insertByAddBoImport(bo, i);
|
|
|
|
+ }
|
|
i++;
|
|
i++;
|
|
}
|
|
}
|
|
|
|
+
|
|
return errorList;
|
|
return errorList;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -490,6 +522,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
}
|
|
}
|
|
}
|
|
}
|
|
content = dealTxt(content);
|
|
content = dealTxt(content);
|
|
|
|
+ System.out.println(content);
|
|
if (content.startsWith("#")||isQuestionStart(content)) {
|
|
if (content.startsWith("#")||isQuestionStart(content)) {
|
|
if(nowPart>0){
|
|
if(nowPart>0){
|
|
//插入上一条
|
|
//插入上一条
|