|
@@ -206,7 +206,7 @@ public class ImportPaperService {
|
|
if (StringUtils.isEmpty(pText)) {
|
|
if (StringUtils.isEmpty(pText)) {
|
|
// 跳过空白段落
|
|
// 跳过空白段落
|
|
continue;
|
|
continue;
|
|
- } else if (isQuesHeader(pText)) {
|
|
|
|
|
|
+ } else if (isMainQuesHeader(pText)) {
|
|
// 处理大题头信息
|
|
// 处理大题头信息
|
|
processMainQuesHeader(pList, importPaperCheck.index, importPaperCheck);
|
|
processMainQuesHeader(pList, importPaperCheck.index, importPaperCheck);
|
|
// 校验大题头信息
|
|
// 校验大题头信息
|
|
@@ -288,13 +288,24 @@ public class ImportPaperService {
|
|
return paper;
|
|
return paper;
|
|
}
|
|
}
|
|
|
|
|
|
- public boolean isQuesHeader(String pText){
|
|
|
|
|
|
+ public boolean isMainQuesHeader(String pText){
|
|
return pText.startsWith(ImportPaperMsg.left_bracket)
|
|
return pText.startsWith(ImportPaperMsg.left_bracket)
|
|
&& !pText.startsWith(ImportPaperMsg.answer_word)
|
|
&& !pText.startsWith(ImportPaperMsg.answer_word)
|
|
&& !pText.startsWith(ImportPaperMsg.score_word)
|
|
&& !pText.startsWith(ImportPaperMsg.score_word)
|
|
&& !pText.startsWith(ImportPaperMsg.subQuestionType_word);
|
|
&& !pText.startsWith(ImportPaperMsg.subQuestionType_word);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public boolean isHeader(String pText){
|
|
|
|
+ return pText.startsWith(ImportPaperMsg.questionClassify_word)
|
|
|
|
+ || pText.startsWith(ImportPaperMsg.questionType_word)
|
|
|
|
+ || pText.startsWith(ImportPaperMsg.questionName_word)
|
|
|
|
+ || pText.startsWith(ImportPaperMsg.questionNum_word)
|
|
|
|
+ || pText.startsWith(ImportPaperMsg.score_word)
|
|
|
|
+ || pText.startsWith(ImportPaperMsg.answer_word)
|
|
|
|
+ || pText.startsWith(ImportPaperMsg.subQuestionType_word)
|
|
|
|
+ || pText.startsWith(ImportPaperMsg.subQuesScore_word);
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 初始化试卷信息
|
|
* 初始化试卷信息
|
|
*
|
|
*
|
|
@@ -477,7 +488,7 @@ public class ImportPaperService {
|
|
tmpWordMl = DocxProcessUtil.formatPWordMl(tmpWordMl);
|
|
tmpWordMl = DocxProcessUtil.formatPWordMl(tmpWordMl);
|
|
quesBodyWordMl.append(tmpWordMl);
|
|
quesBodyWordMl.append(tmpWordMl);
|
|
quesBodyHtml.append(DocxProcessUtil.docx2Html(tmpWordMl, wordMLPackage));
|
|
quesBodyHtml.append(DocxProcessUtil.docx2Html(tmpWordMl, wordMLPackage));
|
|
- } else if (tmpText.matches("^[a-zA-Z]\\.[\\s\\S]*") || tmpText.startsWith(ImportPaperMsg.left_bracket)) {
|
|
|
|
|
|
+ } else if (tmpText.matches("^[a-zA-Z]\\.[\\s\\S]*") || isHeader(tmpText)) {
|
|
// 检测到选项或其他特殊段落直接退出
|
|
// 检测到选项或其他特殊段落直接退出
|
|
break;
|
|
break;
|
|
} else{
|
|
} else{
|
|
@@ -534,6 +545,11 @@ public class ImportPaperService {
|
|
if (StringUtils.isEmpty(tmpText) && DocxProcessUtil.isText(pOption)) {
|
|
if (StringUtils.isEmpty(tmpText) && DocxProcessUtil.isText(pOption)) {
|
|
// 跳过空白段落
|
|
// 跳过空白段落
|
|
continue;
|
|
continue;
|
|
|
|
+ } else if (DocxProcessUtil.isNumPr(pOption)) {
|
|
|
|
+ // 检测到序列
|
|
|
|
+ importPaperCheck.setErrorInfo(getQuesNumInfo(importPaperCheck.quesName, subQuesNum)+ImportPaperMsg.errMsg_11);
|
|
|
|
+ throw new PaperException(importPaperCheck.errorInfo);
|
|
|
|
+
|
|
} else if (tmpText.matches("^[a-zA-Z]\\.[\\s\\S]*")) {
|
|
} else if (tmpText.matches("^[a-zA-Z]\\.[\\s\\S]*")) {
|
|
// 检测到选项开始段落
|
|
// 检测到选项开始段落
|
|
// 创建试题选项
|
|
// 创建试题选项
|
|
@@ -549,7 +565,7 @@ public class ImportPaperService {
|
|
String tmpWordMl = DocxProcessUtil.getPWordMl(pOption);
|
|
String tmpWordMl = DocxProcessUtil.getPWordMl(pOption);
|
|
current.setOptionBody(current.getOptionBody() + DocxProcessUtil.docx2Html(tmpWordMl, wordMLPackage));
|
|
current.setOptionBody(current.getOptionBody() + DocxProcessUtil.docx2Html(tmpWordMl, wordMLPackage));
|
|
current.setOptionBodyWord(current.getOptionBodyWord() + DocxProcessUtil.formatPWordMl(tmpWordMl));
|
|
current.setOptionBodyWord(current.getOptionBodyWord() + DocxProcessUtil.formatPWordMl(tmpWordMl));
|
|
- } else if (tmpText.startsWith(ImportPaperMsg.left_bracket)) {
|
|
|
|
|
|
+ } else if (isHeader(tmpText)) {
|
|
// 非选项的其他内容直接退出
|
|
// 非选项的其他内容直接退出
|
|
break;
|
|
break;
|
|
} else if (current != null) {
|
|
} else if (current != null) {
|
|
@@ -621,7 +637,7 @@ public class ImportPaperService {
|
|
// 检测到分数开始段落
|
|
// 检测到分数开始段落
|
|
quesScore = getContent(tmpText, ImportPaperMsg.subQuesScore_word);
|
|
quesScore = getContent(tmpText, ImportPaperMsg.subQuesScore_word);
|
|
answerStart = false;
|
|
answerStart = false;
|
|
- } else if (tmpText.startsWith(ImportPaperMsg.left_bracket) || tmpText.matches("^\\d{1,}\\.[\\s\\S]*")) {
|
|
|
|
|
|
+ } else if (isHeader(tmpText) || tmpText.matches("^\\d{1,}\\.[\\s\\S]*")) {
|
|
// 检测到其他特殊段落或下一题直接退出
|
|
// 检测到其他特殊段落或下一题直接退出
|
|
break;
|
|
break;
|
|
} else if (answerStart) {
|
|
} else if (answerStart) {
|
|
@@ -738,7 +754,7 @@ public class ImportPaperService {
|
|
importPaperCheck.setErrorInfo(getQuesNumInfo(importPaperCheck.quesName, quesTypeNum) + ImportPaperMsg.errMsg_03);
|
|
importPaperCheck.setErrorInfo(getQuesNumInfo(importPaperCheck.quesName, quesTypeNum) + ImportPaperMsg.errMsg_03);
|
|
}
|
|
}
|
|
throw new PaperException(importPaperCheck.errorInfo);
|
|
throw new PaperException(importPaperCheck.errorInfo);
|
|
- }else if(tmpText.startsWith(ImportPaperMsg.left_bracket)){
|
|
|
|
|
|
+ }else if(isHeader(tmpText)){
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
if (!StringUtils.isEmpty(importPaperCheck.errorInfo)) {
|
|
if (!StringUtils.isEmpty(importPaperCheck.errorInfo)) {
|