|
@@ -577,7 +577,7 @@ public class ImportPaperService {
|
|
|
* @throws Exception
|
|
|
*/
|
|
|
public void processNestedQuestionHead(List<Object> pList, int index, int subQuesNum,Question question,
|
|
|
- ImportPaperCheck importPaperCheck) throws Exception{
|
|
|
+ ImportPaperCheck importPaperCheck,PaperDetailUnit paperDetailUnit) throws Exception{
|
|
|
int i = 0;
|
|
|
for(i=index;i<pList.size();i++){
|
|
|
P pHeader = (P)pList.get(i);
|
|
@@ -588,25 +588,33 @@ public class ImportPaperService {
|
|
|
// 跳过空白段落
|
|
|
continue;
|
|
|
} else if (tmpText.startsWith(ImportPaperMsg.nestedQuestion_start)) {
|
|
|
- if(!nextTmpText.startsWith(ImportPaperMsg.nestedQuestion_number)){
|
|
|
- importPaperCheck.setErrorInfo("[套题]的下一题头应该是[套题数量],当前读到的信息为:“"+nextTmpText+"”,请检查word中格式问题");
|
|
|
- throw new PaperException(importPaperCheck.errorInfo);
|
|
|
- }
|
|
|
+ //判断【套题】后面的值
|
|
|
if(StringUtils.isBlank(getContent(nextTmpText,ImportPaperMsg.nestedQuestion_start))){
|
|
|
importPaperCheck.setErrorInfo("[套题]的后面没有值,当前读到的信息为:“"+nextTmpText+"”,请检查word中格式问题");
|
|
|
- throw new PaperException(importPaperCheck.errorInfo);
|
|
|
- }
|
|
|
- if(StringUtils.isBlank(getContent(nextTmpText,ImportPaperMsg.nestedQuestion_number))){
|
|
|
- importPaperCheck.setErrorInfo("[套题数量]的后面没有值,当前读到的信息为:“"+nextTmpText+"”,请检查word中格式问题");
|
|
|
throw new PaperException(importPaperCheck.errorInfo);
|
|
|
}
|
|
|
Pattern pattern = Pattern.compile("[0-9]*");
|
|
|
boolean isHeadNumber = pattern.matcher(getContent(tmpText,ImportPaperMsg.nestedQuestion_start)).matches();
|
|
|
- boolean isNumber = pattern.matcher(getContent(nextTmpText,ImportPaperMsg.nestedQuestion_number)).matches();
|
|
|
if(!isHeadNumber){
|
|
|
importPaperCheck.setErrorInfo("[套题]后面应该为整数,当前读到的信息为:“"+tmpText+"”,请检查word中格式问题");
|
|
|
throw new PaperException(importPaperCheck.errorInfo);
|
|
|
}
|
|
|
+ //判断是否含有【套题数量】标签
|
|
|
+ if(!nextTmpText.startsWith(ImportPaperMsg.nestedQuestion_number)){
|
|
|
+ //如果读取的错误信息太长,截取前50个字符。
|
|
|
+ if(nextTmpText.length()>50){
|
|
|
+ nextTmpText = nextTmpText.substring(0, 50) + "...";
|
|
|
+ }
|
|
|
+ importPaperCheck.setErrorInfo("[大题名称]:"+paperDetailUnit.getPaperDetail().getName() +","+ tmpText +"的下一题头应该是[套题数量],当前读到的信息为:“"+nextTmpText+"”,请检查word中格式问题");
|
|
|
+ throw new PaperException(importPaperCheck.errorInfo);
|
|
|
+ }
|
|
|
+ //判断【套题数量】后面的值
|
|
|
+ if(StringUtils.isBlank(getContent(nextTmpText,ImportPaperMsg.nestedQuestion_number))){
|
|
|
+ importPaperCheck.setErrorInfo("[套题数量]的后面没有值,当前读到的信息为:“"+nextTmpText+"”,请检查word中格式问题");
|
|
|
+ throw new PaperException(importPaperCheck.errorInfo);
|
|
|
+ }
|
|
|
+ boolean isNumber = pattern.matcher(getContent(nextTmpText,ImportPaperMsg.nestedQuestion_number)).matches();
|
|
|
+
|
|
|
if(!isNumber){
|
|
|
importPaperCheck.setErrorInfo("[套题数量]应该为整数,当前读到的信息为:“"+nextTmpText+"”,请检查word中格式问题");
|
|
|
throw new PaperException(importPaperCheck.errorInfo);
|
|
@@ -1112,7 +1120,7 @@ public class ImportPaperService {
|
|
|
// 题型
|
|
|
String nestedQuesType = "";
|
|
|
//处理套题的头信息
|
|
|
- processNestedQuestionHead(pList,index,0,question,importPaperCheck);
|
|
|
+ processNestedQuestionHead(pList,index,0,question,importPaperCheck,paperDetailUnit);
|
|
|
// 设置套题题干
|
|
|
processQuesBody(pList, importPaperCheck.index, 0,question, importPaperCheck, wordMLPackage);
|
|
|
// 创建小题集合
|