|
@@ -911,7 +911,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
String qContent = ""; //题目正文
|
|
String qContent = ""; //题目正文
|
|
String answerQuestion = null; //答案
|
|
String answerQuestion = null; //答案
|
|
String analysisContent = ""; //解析文本
|
|
String analysisContent = ""; //解析文本
|
|
- int index = 1; //题目序列号
|
|
|
|
|
|
+ int index = 0; //题目序列号
|
|
List<QuestionBusinessAddBo> businessList = new ArrayList<>();
|
|
List<QuestionBusinessAddBo> businessList = new ArrayList<>();
|
|
QuestionBusinessAddBo questionBusinessAddBo = new QuestionBusinessAddBo();
|
|
QuestionBusinessAddBo questionBusinessAddBo = new QuestionBusinessAddBo();
|
|
questionBusinessAddBo.setEducationTypeId(eduId);
|
|
questionBusinessAddBo.setEducationTypeId(eduId);
|
|
@@ -929,6 +929,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
String strContent = "";
|
|
String strContent = "";
|
|
String imgUrl = null;
|
|
String imgUrl = null;
|
|
boolean hasQuestion = false;
|
|
boolean hasQuestion = false;
|
|
|
|
+ boolean hasError = false;
|
|
for (XWPFParagraph paragraph : paragraphList) {
|
|
for (XWPFParagraph paragraph : paragraphList) {
|
|
content = paragraph.getText();
|
|
content = paragraph.getText();
|
|
content = dealTxt(content);
|
|
content = dealTxt(content);
|
|
@@ -984,54 +985,57 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
}
|
|
}
|
|
if (content.startsWith("#")||isQuestionStart(content)) {
|
|
if (content.startsWith("#")||isQuestionStart(content)) {
|
|
if(hasQuestion){
|
|
if(hasQuestion){
|
|
|
|
+ index++;
|
|
hasQuestion = false;
|
|
hasQuestion = false;
|
|
//插入上一条
|
|
//插入上一条
|
|
QuestionAddBo addBo = new QuestionAddBo();
|
|
QuestionAddBo addBo = new QuestionAddBo();
|
|
qContent = removeNo(qContent);
|
|
qContent = removeNo(qContent);
|
|
if (Validator.isEmpty(qContent)) {
|
|
if (Validator.isEmpty(qContent)) {
|
|
|
|
+ hasError = true;
|
|
errorLog += "第" + index + "条题目内容错误\n";
|
|
errorLog += "第" + index + "条题目内容错误\n";
|
|
- continue;
|
|
|
|
}
|
|
}
|
|
QuestionAddBo bo = new QuestionAddBo();
|
|
QuestionAddBo bo = new QuestionAddBo();
|
|
if (type == -1) {
|
|
if (type == -1) {
|
|
|
|
+ hasError = true;
|
|
errorLog += "第" + index + "条题目选项错误\n";
|
|
errorLog += "第" + index + "条题目选项错误\n";
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- bo.setType(type);
|
|
|
|
-
|
|
|
|
- bo.setStatus(1);
|
|
|
|
- bo.setContent(qContent);
|
|
|
|
- bo.setAnswerQuestion(answerQuestion);
|
|
|
|
- bo.setAnalysisContent(analysisContent);
|
|
|
|
- bo.setOptionsList(copyList(optionsList));
|
|
|
|
- bo.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
- bo.setImportNo(importNo);
|
|
|
|
- bo.setPublishStatus(1);
|
|
|
|
- bo.setBusinessList(businessList);
|
|
|
|
- bo.setCreateTime(nowTime);
|
|
|
|
- if(type==1){
|
|
|
|
- list1.add(bo);
|
|
|
|
- }
|
|
|
|
- if(type==2){
|
|
|
|
- list2.add(bo);
|
|
|
|
- }
|
|
|
|
- if(type==3){
|
|
|
|
- list4.add(bo);
|
|
|
|
}
|
|
}
|
|
- if(type==5){
|
|
|
|
- list3.add(bo);
|
|
|
|
|
|
+ if(!hasError){
|
|
|
|
+ bo.setType(type);
|
|
|
|
+ bo.setStatus(1);
|
|
|
|
+ bo.setContent(qContent);
|
|
|
|
+ bo.setAnswerQuestion(answerQuestion);
|
|
|
|
+ bo.setAnalysisContent(analysisContent);
|
|
|
|
+ bo.setOptionsList(copyList(optionsList));
|
|
|
|
+ bo.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
+ bo.setImportNo(importNo);
|
|
|
|
+ bo.setPublishStatus(1);
|
|
|
|
+ bo.setBusinessList(businessList);
|
|
|
|
+ bo.setCreateTime(nowTime);
|
|
|
|
+ if(type==1){
|
|
|
|
+ list1.add(bo);
|
|
|
|
+ }
|
|
|
|
+ if(type==2){
|
|
|
|
+ list2.add(bo);
|
|
|
|
+ }
|
|
|
|
+ if(type==3){
|
|
|
|
+ list4.add(bo);
|
|
|
|
+ }
|
|
|
|
+ if(type==5){
|
|
|
|
+ list3.add(bo);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
sort++;
|
|
sort++;
|
|
|
|
|
|
//清空数据
|
|
//清空数据
|
|
isOption = false;
|
|
isOption = false;
|
|
type = -1;
|
|
type = -1;
|
|
qContent = "";
|
|
qContent = "";
|
|
- index++;
|
|
|
|
answerQuestion = null;
|
|
answerQuestion = null;
|
|
analysisContent = "";
|
|
analysisContent = "";
|
|
optionsList.clear();
|
|
optionsList.clear();
|
|
nowPart = -1;
|
|
nowPart = -1;
|
|
|
|
+ hasError = false;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1052,10 +1056,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
}
|
|
}
|
|
//第一个选项(包含西里尔字母А)
|
|
//第一个选项(包含西里尔字母А)
|
|
if(content.startsWith("А.")||content.startsWith("A.")||(nowPart==1&&!isLineStart(content))) {
|
|
if(content.startsWith("А.")||content.startsWith("A.")||(nowPart==1&&!isLineStart(content))) {
|
|
- if (Validator.isEmpty(qContent)) {
|
|
|
|
- errorLog += "第" + index + "条题目内容错误\n";
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
|
|
+ hasQuestion = true;
|
|
if(nowPart!=1){
|
|
if(nowPart!=1){
|
|
strContent = "";
|
|
strContent = "";
|
|
}
|
|
}
|
|
@@ -1181,10 +1182,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
}
|
|
}
|
|
//答案和题型
|
|
//答案和题型
|
|
if (content.startsWith("正确答案:")||(nowPart==7&&!isLineStart(content))) {
|
|
if (content.startsWith("正确答案:")||(nowPart==7&&!isLineStart(content))) {
|
|
- if (Validator.isEmpty(qContent)) {
|
|
|
|
- errorLog += "第" + index + "条题目内容错误\n";
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
|
|
+ hasQuestion = true;
|
|
if(nowPart!=7){
|
|
if(nowPart!=7){
|
|
strContent = "";
|
|
strContent = "";
|
|
}
|
|
}
|
|
@@ -1291,7 +1289,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
String qContent = ""; //题目正文
|
|
String qContent = ""; //题目正文
|
|
String answerQuestion = null; //答案
|
|
String answerQuestion = null; //答案
|
|
String analysisContent = ""; //解析文本
|
|
String analysisContent = ""; //解析文本
|
|
- int index = 1; //题目序列号
|
|
|
|
|
|
+ int index = 0; //题目序列号
|
|
List<QuestionBusinessAddBo> businessList = new ArrayList<>();
|
|
List<QuestionBusinessAddBo> businessList = new ArrayList<>();
|
|
QuestionBusinessAddBo questionBusinessAddBo = new QuestionBusinessAddBo();
|
|
QuestionBusinessAddBo questionBusinessAddBo = new QuestionBusinessAddBo();
|
|
questionBusinessAddBo.setEducationTypeId(eduId);
|
|
questionBusinessAddBo.setEducationTypeId(eduId);
|
|
@@ -1309,6 +1307,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
String strContent = "";
|
|
String strContent = "";
|
|
String imgUrl = "";
|
|
String imgUrl = "";
|
|
boolean hasQuestion = false;
|
|
boolean hasQuestion = false;
|
|
|
|
+ boolean hasError = false;
|
|
for (XWPFParagraph paragraph : paragraphList) {
|
|
for (XWPFParagraph paragraph : paragraphList) {
|
|
content = paragraph.getText();
|
|
content = paragraph.getText();
|
|
List<XWPFRun> runs = paragraph.getRuns();
|
|
List<XWPFRun> runs = paragraph.getRuns();
|
|
@@ -1359,50 +1358,54 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
content = dealTxt(content);
|
|
content = dealTxt(content);
|
|
if (content.startsWith("#")||isQuestionStart(content)) {
|
|
if (content.startsWith("#")||isQuestionStart(content)) {
|
|
if(hasQuestion){
|
|
if(hasQuestion){
|
|
|
|
+ index++;
|
|
hasQuestion = false;
|
|
hasQuestion = false;
|
|
//插入上一条
|
|
//插入上一条
|
|
QuestionAddBo addBo = new QuestionAddBo();
|
|
QuestionAddBo addBo = new QuestionAddBo();
|
|
qContent = removeNo(qContent);
|
|
qContent = removeNo(qContent);
|
|
if (Validator.isEmpty(qContent)) {
|
|
if (Validator.isEmpty(qContent)) {
|
|
|
|
+ hasError = true;
|
|
errorLog += "第" + index + "条题目内容错误\n";
|
|
errorLog += "第" + index + "条题目内容错误\n";
|
|
- continue;
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
QuestionAddBo bo = new QuestionAddBo();
|
|
QuestionAddBo bo = new QuestionAddBo();
|
|
if (type == -1) {
|
|
if (type == -1) {
|
|
|
|
+ hasError = true;
|
|
errorLog += "第" + index + "条题目选项错误\n";
|
|
errorLog += "第" + index + "条题目选项错误\n";
|
|
- continue;
|
|
|
|
- }
|
|
|
|
- bo.setType(type);
|
|
|
|
-
|
|
|
|
- bo.setStatus(1);
|
|
|
|
- bo.setContent(qContent);
|
|
|
|
- bo.setAnswerQuestion(answerQuestion);
|
|
|
|
- bo.setAnalysisContent(analysisContent);
|
|
|
|
- bo.setOptionsList(copyList(optionsList));
|
|
|
|
- bo.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
- bo.setImportNo(importNo);
|
|
|
|
- bo.setPublishStatus(1);
|
|
|
|
- bo.setBusinessList(businessList);
|
|
|
|
- bo.setCreateTime(nowTime);
|
|
|
|
- if(type==1){
|
|
|
|
- list1.add(bo);
|
|
|
|
- }
|
|
|
|
- if(type==2){
|
|
|
|
- list2.add(bo);
|
|
|
|
- }
|
|
|
|
- if(type==3){
|
|
|
|
- list4.add(bo);
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
- if(type==5){
|
|
|
|
- list3.add(bo);
|
|
|
|
|
|
+ if(!hasError){
|
|
|
|
+ bo.setType(type);
|
|
|
|
+ bo.setStatus(1);
|
|
|
|
+ bo.setContent(qContent);
|
|
|
|
+ bo.setAnswerQuestion(answerQuestion);
|
|
|
|
+ bo.setAnalysisContent(analysisContent);
|
|
|
|
+ bo.setOptionsList(copyList(optionsList));
|
|
|
|
+ bo.setCreateBy(SecurityUtils.getUsername());
|
|
|
|
+ bo.setImportNo(importNo);
|
|
|
|
+ bo.setPublishStatus(1);
|
|
|
|
+ bo.setBusinessList(businessList);
|
|
|
|
+ bo.setCreateTime(nowTime);
|
|
|
|
+ if(type==1){
|
|
|
|
+ list1.add(bo);
|
|
|
|
+ }
|
|
|
|
+ if(type==2){
|
|
|
|
+ list2.add(bo);
|
|
|
|
+ }
|
|
|
|
+ if(type==3){
|
|
|
|
+ list4.add(bo);
|
|
|
|
+ }
|
|
|
|
+ if(type==5){
|
|
|
|
+ list3.add(bo);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- sort++;
|
|
|
|
|
|
|
|
|
|
+ sort++;
|
|
|
|
+ hasError = false;
|
|
//清空数据
|
|
//清空数据
|
|
isOption = false;
|
|
isOption = false;
|
|
type = -1;
|
|
type = -1;
|
|
qContent = "";
|
|
qContent = "";
|
|
- index++;
|
|
|
|
answerQuestion = null;
|
|
answerQuestion = null;
|
|
analysisContent = "";
|
|
analysisContent = "";
|
|
optionsList.clear();
|
|
optionsList.clear();
|
|
@@ -1428,10 +1431,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
}
|
|
}
|
|
//第一个选项
|
|
//第一个选项
|
|
if(content.startsWith("А.")||content.startsWith("A.")||(nowPart==1&&!isLineStart(content))) {
|
|
if(content.startsWith("А.")||content.startsWith("A.")||(nowPart==1&&!isLineStart(content))) {
|
|
- if (Validator.isEmpty(qContent)) {
|
|
|
|
- errorLog += "第" + index + "条题目内容错误\n";
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
|
|
+ hasQuestion = true;
|
|
if(nowPart!=1){
|
|
if(nowPart!=1){
|
|
strContent = "";
|
|
strContent = "";
|
|
}
|
|
}
|
|
@@ -1557,10 +1557,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
}
|
|
}
|
|
//答案和题型
|
|
//答案和题型
|
|
if (content.startsWith("正确答案:")||(nowPart==7&&!isLineStart(content))) {
|
|
if (content.startsWith("正确答案:")||(nowPart==7&&!isLineStart(content))) {
|
|
- if (Validator.isEmpty(qContent)) {
|
|
|
|
- errorLog += "第" + index + "条题目内容错误\n";
|
|
|
|
- continue;
|
|
|
|
- }
|
|
|
|
|
|
+ hasQuestion = true;
|
|
if(nowPart!=7){
|
|
if(nowPart!=7){
|
|
strContent = "";
|
|
strContent = "";
|
|
}
|
|
}
|
|
@@ -1644,6 +1641,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
return list;
|
|
return list;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
private String removeNo(String txt) {
|
|
private String removeNo(String txt) {
|
|
int intIndex = txt.indexOf("、");
|
|
int intIndex = txt.indexOf("、");
|
|
if (intIndex != -1) {
|
|
if (intIndex != -1) {
|