|
@@ -334,7 +334,6 @@ public class ImportPaperService {
|
|
|
paperDetailUnits.add(paperDetailUnit);
|
|
|
// 设置当前索引,防止多余循环
|
|
|
i = importPaperCheck.index - 1;
|
|
|
- paperDetail = null;
|
|
|
}else if(paperDetail == null){
|
|
|
throw new PaperException("导入文件格式有误,必须有大题头信息,且以[试题分类]开头!");
|
|
|
}else{
|
|
@@ -392,7 +391,11 @@ public class ImportPaperService {
|
|
|
&& !pText.startsWith(ImportPaperMsg.subQuestionType_word)
|
|
|
&& !pText.startsWith(ImportPaperMsg.nestedQuestion_start)
|
|
|
&& !pText.startsWith(ImportPaperMsg.nestedQuestion_number);*/
|
|
|
- return pText.startsWith(ImportPaperMsg.questionClassify_word);
|
|
|
+ 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);
|
|
|
}
|
|
|
|
|
|
public boolean isHeader(String pText){
|
|
@@ -521,6 +524,11 @@ public class ImportPaperService {
|
|
|
*/
|
|
|
public void processMainQuesHeader(List<Object> pList, int index, ImportPaperCheck importPaperCheck,String courseNo) throws PaperException {
|
|
|
int i = 0;
|
|
|
+ P pFirst = (P) pList.get(index);
|
|
|
+ String tmpTextFirst = DocxProcessUtil.getPText(pFirst);
|
|
|
+ if(!tmpTextFirst.startsWith(ImportPaperMsg.questionClassify_word)){
|
|
|
+ throw new PaperException("导入文件格式有误,必须有大题头信息,且以[试题分类]开头!");
|
|
|
+ }
|
|
|
for (i = index; i < pList.size(); i++) {
|
|
|
P pHeader = (P) pList.get(i);
|
|
|
P pNextHeader = (P) pList.get(i+1);
|
|
@@ -853,6 +861,14 @@ public class ImportPaperService {
|
|
|
} else if (tmpText.startsWith(ImportPaperMsg.subQuesScore_word)) {
|
|
|
// 检测到分数开始段落
|
|
|
quesScore = getContent(tmpText, ImportPaperMsg.subQuesScore_word);
|
|
|
+ if(!CommonUtils.isInteger(quesScore)){
|
|
|
+ if(importPaperCheck.nestedHeadNumber == 0){
|
|
|
+ importPaperCheck.setErrorInfo("[大题名称]:"+importPaperCheck.quesName+"第"+subQuesNum+"题中[小题分数]格式不对或没有值");
|
|
|
+ }else {
|
|
|
+ importPaperCheck.setErrorInfo("[大题名称]:"+importPaperCheck.quesName+"第"+importPaperCheck.nestedHeadNumber+"个套题中,第"+subQuesNum+"题中[小题分数]格式不对或没有值");
|
|
|
+ }
|
|
|
+ throw new PaperException(importPaperCheck.errorInfo);
|
|
|
+ }
|
|
|
answerStart = false;
|
|
|
}
|
|
|
//-------------------------------------------------------------------------------------------------------
|
|
@@ -914,13 +930,20 @@ public class ImportPaperService {
|
|
|
question.setQuesAnswerWord(answerWordML.toString());
|
|
|
}
|
|
|
|
|
|
- // 设置预设分数
|
|
|
+ /* // 设置预设分数
|
|
|
if (quesScore != null && quesScore.matches("^\\d+(\\.\\d+)?$")) {
|
|
|
question.setScore(Double.parseDouble(quesScore));
|
|
|
}
|
|
|
// 一般大题明细需要设置分数
|
|
|
if (!isNested && quesScore != null && quesScore.matches("^\\d+(\\.\\d+)?$")) {
|
|
|
paperDetailUnit.setScore(Double.parseDouble(quesScore));
|
|
|
+ }*/
|
|
|
+ if (quesScore != null) {
|
|
|
+ question.setScore(Double.parseDouble(quesScore));
|
|
|
+ }
|
|
|
+ // 一般大题明细需要设置分数
|
|
|
+ if (!isNested && quesScore != null) {
|
|
|
+ paperDetailUnit.setScore(Double.parseDouble(quesScore));
|
|
|
}
|
|
|
//校验小题尾信息是否含有"一节属性","二级属性","难度","公开"
|
|
|
checkAttributeIsFull(firstProperty,secondProperty,difficulty,publicity,importPaperCheck,subQuesNum);
|
|
@@ -1169,7 +1192,11 @@ public class ImportPaperService {
|
|
|
} else if (tmpText.matches("^\\d{1,}\\.[\\s\\S]*")) {
|
|
|
++subQuesNum;
|
|
|
if(!hasQuesType){
|
|
|
- importPaperCheck.setErrorInfo("[大题名称]:"+importPaperCheck.quesName+"第"+subQuesNum+"个套题"+"中,缺失[小题型],请检查套题");
|
|
|
+ if(importPaperCheck.nestedHeadNumber == 0){
|
|
|
+ importPaperCheck.setErrorInfo("[大题名称]:"+importPaperCheck.quesName+"第"+subQuesNum+"题中,缺失[小题型],请检查套题");
|
|
|
+ }else {
|
|
|
+ importPaperCheck.setErrorInfo("[大题名称]:"+importPaperCheck.quesName+"第"+importPaperCheck.nestedHeadNumber+"个套题中,第"+subQuesNum+"题缺失[小题型],请检查套题");
|
|
|
+ }
|
|
|
throw new PaperException(importPaperCheck.errorInfo);
|
|
|
}
|
|
|
if (StringUtils.isEmpty(nestedQuesType)) {
|
|
@@ -1215,11 +1242,6 @@ public class ImportPaperService {
|
|
|
return;
|
|
|
}
|
|
|
}
|
|
|
- //判断小题型
|
|
|
- if(!hasQuesType){
|
|
|
- importPaperCheck.setErrorInfo(importPaperCheck.quesName+"第"+importPaperCheck.nestedHeadNumber+"个套题"+"中,缺失小题型,请检查套题");
|
|
|
- throw new PaperException(importPaperCheck.errorInfo);
|
|
|
- }
|
|
|
//判断子题数量是否一样
|
|
|
if(importPaperCheck.nestedQuesNumber!=subQuesList.size()){
|
|
|
importPaperCheck.setErrorInfo(importPaperCheck.quesName+"第"+importPaperCheck.nestedHeadNumber+"个套题"+"中,套题数量与子题数量不一样,请检查套题");
|