|
@@ -926,8 +926,14 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
Integer nowPart = -1;//0正文 1选项A 2选项B 3选项C 4选项D 5选项E 6选项F
|
|
|
String strContent = "";
|
|
|
String imgUrl = null;
|
|
|
+ boolean hasQuestion = false;
|
|
|
for (XWPFParagraph paragraph : paragraphList) {
|
|
|
content = paragraph.getText();
|
|
|
+ System.out.println(content);
|
|
|
+ System.out.println("EEE");
|
|
|
+ if(content.startsWith("2")){
|
|
|
+ System.out.println("EEE");
|
|
|
+ }
|
|
|
content = dealTxt(content);
|
|
|
List<XWPFRun> runs = paragraph.getRuns();
|
|
|
imgUrl = null;
|
|
@@ -980,7 +986,8 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
}
|
|
|
}
|
|
|
if (content.startsWith("#")||isQuestionStart(content)) {
|
|
|
- if(nowPart>0){
|
|
|
+ if(hasQuestion){
|
|
|
+ hasQuestion = false;
|
|
|
//插入上一条
|
|
|
QuestionAddBo addBo = new QuestionAddBo();
|
|
|
qContent = removeNo(qContent);
|
|
@@ -1037,8 +1044,8 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
if(Validator.isEmpty(content)||content.equals("")){
|
|
|
continue;
|
|
|
}
|
|
|
-
|
|
|
if (isQuestionStart(content)||(nowPart==0&&!isLineStart(content))) {
|
|
|
+ hasQuestion = true;
|
|
|
if(nowPart!=0){
|
|
|
qContent = "";
|
|
|
}
|
|
@@ -1048,6 +1055,10 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
}
|
|
|
//第一个选项
|
|
|
if(content.startsWith("A.")||(nowPart==1&&!isLineStart(content))) {
|
|
|
+ if (Validator.isEmpty(qContent)) {
|
|
|
+ errorLog += "第" + index + "条题目内容空白\n";
|
|
|
+ continue;
|
|
|
+ }
|
|
|
if(nowPart!=1){
|
|
|
strContent = "";
|
|
|
}
|
|
@@ -1169,6 +1180,10 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
}
|
|
|
//答案和题型
|
|
|
if (content.startsWith("正确答案:")||(nowPart==7&&!isLineStart(content))) {
|
|
|
+ if (Validator.isEmpty(qContent)) {
|
|
|
+ errorLog += "第" + index + "条题目内容空白\n";
|
|
|
+ continue;
|
|
|
+ }
|
|
|
if(nowPart!=7){
|
|
|
strContent = "";
|
|
|
}
|
|
@@ -1292,6 +1307,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
Integer nowPart = -1;//0正文 1选项A 2选项B 3选项C 4选项D 5选项E 6选项F
|
|
|
String strContent = "";
|
|
|
String imgUrl = "";
|
|
|
+ boolean hasQuestion = false;
|
|
|
for (XWPFParagraph paragraph : paragraphList) {
|
|
|
content = paragraph.getText();
|
|
|
List<XWPFRun> runs = paragraph.getRuns();
|
|
@@ -1341,7 +1357,8 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
}
|
|
|
content = dealTxt(content);
|
|
|
if (content.startsWith("#")||isQuestionStart(content)) {
|
|
|
- if(nowPart>0){
|
|
|
+ if(hasQuestion){
|
|
|
+ hasQuestion = false;
|
|
|
//插入上一条
|
|
|
QuestionAddBo addBo = new QuestionAddBo();
|
|
|
qContent = removeNo(qContent);
|
|
@@ -1400,6 +1417,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
}
|
|
|
|
|
|
if (isQuestionStart(content)||(nowPart==0&&!isLineStart(content))) {
|
|
|
+ hasQuestion = true;
|
|
|
if(nowPart!=0){
|
|
|
qContent = "";
|
|
|
}
|
|
@@ -1409,6 +1427,10 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
}
|
|
|
//第一个选项
|
|
|
if(content.startsWith("A.")||(nowPart==1&&!isLineStart(content))) {
|
|
|
+ if (Validator.isEmpty(qContent)) {
|
|
|
+ errorLog += "第" + index + "条题目内容空白\n";
|
|
|
+ continue;
|
|
|
+ }
|
|
|
if(nowPart!=1){
|
|
|
strContent = "";
|
|
|
}
|
|
@@ -1530,6 +1552,10 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
}
|
|
|
//答案和题型
|
|
|
if (content.startsWith("正确答案:")||(nowPart==7&&!isLineStart(content))) {
|
|
|
+ if (Validator.isEmpty(qContent)) {
|
|
|
+ errorLog += "第" + index + "条题目内容空白\n";
|
|
|
+ continue;
|
|
|
+ }
|
|
|
if(nowPart!=7){
|
|
|
strContent = "";
|
|
|
}
|