|
@@ -602,7 +602,6 @@ public class ImportPaperFromJsonService {
|
|
private void processQuesBody(List<List<SectionElement>> pList, int index, int subQuesNum, Question question,
|
|
private void processQuesBody(List<List<SectionElement>> pList, int index, int subQuesNum, Question question,
|
|
ImportPaperCheck importPaperCheck, int errorQuesNum) throws Exception {
|
|
ImportPaperCheck importPaperCheck, int errorQuesNum) throws Exception {
|
|
// 定义题干json和html
|
|
// 定义题干json和html
|
|
- StringBuilder quesBodyJson = new StringBuilder();
|
|
|
|
StringBuilder quesBodyHtml = new StringBuilder();
|
|
StringBuilder quesBodyHtml = new StringBuilder();
|
|
int i = 0;
|
|
int i = 0;
|
|
for (i = index; i < pList.size(); i++) {
|
|
for (i = index; i < pList.size(); i++) {
|
|
@@ -613,8 +612,6 @@ public class ImportPaperFromJsonService {
|
|
continue;
|
|
continue;
|
|
} else if (tmpText.matches("^\\d{1,}\\.[\\s\\S]*")) {
|
|
} else if (tmpText.matches("^\\d{1,}\\.[\\s\\S]*")) {
|
|
// 题干第一段
|
|
// 题干第一段
|
|
- String tmpJson = JsonImportUtil.getJsonString(pBody);
|
|
|
|
- quesBodyJson.append(tmpJson);
|
|
|
|
// 过滤题干标题
|
|
// 过滤题干标题
|
|
pBody = JsonImportUtil.formatP(pBody, QuesUnit.QUES_BODY);
|
|
pBody = JsonImportUtil.formatP(pBody, QuesUnit.QUES_BODY);
|
|
quesBodyHtml.append(JsonImportUtil.questionJson2Html(pBody));
|
|
quesBodyHtml.append(JsonImportUtil.questionJson2Html(pBody));
|
|
@@ -623,12 +620,10 @@ public class ImportPaperFromJsonService {
|
|
break;
|
|
break;
|
|
} else {
|
|
} else {
|
|
// 题干普通段落
|
|
// 题干普通段落
|
|
- String tmpJson = JsonImportUtil.getJsonString(pBody);
|
|
|
|
- quesBodyJson.append(tmpJson);
|
|
|
|
quesBodyHtml.append(JsonImportUtil.questionJson2Html(pBody));
|
|
quesBodyHtml.append(JsonImportUtil.questionJson2Html(pBody));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (StringUtils.isEmpty(quesBodyHtml) || StringUtils.isEmpty(quesBodyJson)) {
|
|
|
|
|
|
+ if (StringUtils.isEmpty(quesBodyHtml)) {
|
|
if (subQuesNum == 0) {
|
|
if (subQuesNum == 0) {
|
|
if (importPaperCheck.getNestedHeadNumber() != 0) {
|
|
if (importPaperCheck.getNestedHeadNumber() != 0) {
|
|
importPaperCheck.setErrorInfo(importPaperCheck.getQuesName() + "第"
|
|
importPaperCheck.setErrorInfo(importPaperCheck.getQuesName() + "第"
|
|
@@ -650,7 +645,6 @@ public class ImportPaperFromJsonService {
|
|
}
|
|
}
|
|
importPaperCheck.setIndex(i);
|
|
importPaperCheck.setIndex(i);
|
|
question.setQuesBody(quesBodyHtml.toString());
|
|
question.setQuesBody(quesBodyHtml.toString());
|
|
- question.setQuesBodyJson(quesBodyJson.toString());
|
|
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -702,11 +696,8 @@ public class ImportPaperFromJsonService {
|
|
}
|
|
}
|
|
current.setNumber(String.valueOf(optionNumber));
|
|
current.setNumber(String.valueOf(optionNumber));
|
|
current.setOptionBody("");
|
|
current.setOptionBody("");
|
|
- current.setOptionBodyJson("");
|
|
|
|
quesOptions.add(current);
|
|
quesOptions.add(current);
|
|
optionCount++;
|
|
optionCount++;
|
|
- String tmpJson = JsonImportUtil.getJsonString(pOption);
|
|
|
|
- current.setOptionBodyJson(current.getOptionBodyJson() + tmpJson);
|
|
|
|
// 过滤选项标题
|
|
// 过滤选项标题
|
|
pOption = JsonImportUtil.formatP(pOption, QuesUnit.QUES_OPTION);
|
|
pOption = JsonImportUtil.formatP(pOption, QuesUnit.QUES_OPTION);
|
|
current.setOptionBody(current.getOptionBody() + JsonImportUtil.questionJson2Html(pOption));
|
|
current.setOptionBody(current.getOptionBody() + JsonImportUtil.questionJson2Html(pOption));
|
|
@@ -715,9 +706,7 @@ public class ImportPaperFromJsonService {
|
|
break;
|
|
break;
|
|
} else if (current != null) {
|
|
} else if (current != null) {
|
|
// 选项的其他段落
|
|
// 选项的其他段落
|
|
- String tmpJson = JsonImportUtil.getJsonString(pOption);
|
|
|
|
current.setOptionBody(current.getOptionBody() + JsonImportUtil.questionJson2Html(pOption));
|
|
current.setOptionBody(current.getOptionBody() + JsonImportUtil.questionJson2Html(pOption));
|
|
- current.setOptionBodyJson(current.getOptionBodyJson() + tmpJson);
|
|
|
|
} else {
|
|
} else {
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -752,7 +741,6 @@ public class ImportPaperFromJsonService {
|
|
PaperDetailUnit paperDetailUnit, ImportPaperCheck importPaperCheck, boolean isNested, Paper paper,
|
|
PaperDetailUnit paperDetailUnit, ImportPaperCheck importPaperCheck, boolean isNested, Paper paper,
|
|
int errorQuesNum) throws Exception {
|
|
int errorQuesNum) throws Exception {
|
|
|
|
|
|
- StringBuilder answerJson = new StringBuilder("");
|
|
|
|
StringBuilder answerHTML = new StringBuilder("");
|
|
StringBuilder answerHTML = new StringBuilder("");
|
|
String quesScore = null;
|
|
String quesScore = null;
|
|
// 定义一级属性
|
|
// 定义一级属性
|
|
@@ -774,7 +762,6 @@ public class ImportPaperFromJsonService {
|
|
for (i = index; i < pList.size(); i++) {
|
|
for (i = index; i < pList.size(); i++) {
|
|
List<SectionElement> pAnswer = pList.get(i);
|
|
List<SectionElement> pAnswer = pList.get(i);
|
|
String tmpText = JsonImportUtil.getPText(pAnswer);
|
|
String tmpText = JsonImportUtil.getPText(pAnswer);
|
|
- String tmpJson = JsonImportUtil.getJsonString(pAnswer);
|
|
|
|
if (StringUtils.isEmpty(tmpText) && JsonImportUtil.isText(pAnswer)) {
|
|
if (StringUtils.isEmpty(tmpText) && JsonImportUtil.isText(pAnswer)) {
|
|
// 跳过空白段落
|
|
// 跳过空白段落
|
|
continue;
|
|
continue;
|
|
@@ -786,16 +773,13 @@ public class ImportPaperFromJsonService {
|
|
// 校验单选多选答案
|
|
// 校验单选多选答案
|
|
String answerText = getContent(tmpText, ImportPaperMsg.answer_word);
|
|
String answerText = getContent(tmpText, ImportPaperMsg.answer_word);
|
|
checkSelectAnswer(question, answerText, importPaperCheck, errorQuesNum);
|
|
checkSelectAnswer(question, answerText, importPaperCheck, errorQuesNum);
|
|
- answerJson.append(tmpJson);
|
|
|
|
answerHTML.append(getContent(tmpText, ImportPaperMsg.answer_word));
|
|
answerHTML.append(getContent(tmpText, ImportPaperMsg.answer_word));
|
|
} else if (question.getQuestionType() == QuesStructType.BOOL_ANSWER_QUESTION) {
|
|
} else if (question.getQuestionType() == QuesStructType.BOOL_ANSWER_QUESTION) {
|
|
// 校验判断题答案
|
|
// 校验判断题答案
|
|
String answerText = getContent(tmpText, ImportPaperMsg.answer_word);
|
|
String answerText = getContent(tmpText, ImportPaperMsg.answer_word);
|
|
checkBoolAnswer(answerText, importPaperCheck, errorQuesNum);
|
|
checkBoolAnswer(answerText, importPaperCheck, errorQuesNum);
|
|
- answerJson.append(tmpJson);
|
|
|
|
answerHTML.append(answerText);
|
|
answerHTML.append(answerText);
|
|
} else {
|
|
} else {
|
|
- answerJson.append(tmpJson);
|
|
|
|
answerHTML.append(JsonImportUtil.questionJson2Html(pAnswer));
|
|
answerHTML.append(JsonImportUtil.questionJson2Html(pAnswer));
|
|
}
|
|
}
|
|
hasAnswer = true;
|
|
hasAnswer = true;
|
|
@@ -847,7 +831,6 @@ public class ImportPaperFromJsonService {
|
|
// 检测到其他特殊段落或下一题直接退出
|
|
// 检测到其他特殊段落或下一题直接退出
|
|
break;
|
|
break;
|
|
} else if (answerStart) {
|
|
} else if (answerStart) {
|
|
- answerJson.append(tmpJson);
|
|
|
|
answerHTML.append(JsonImportUtil.questionJson2Html(pAnswer));
|
|
answerHTML.append(JsonImportUtil.questionJson2Html(pAnswer));
|
|
} else {
|
|
} else {
|
|
break;
|
|
break;
|
|
@@ -868,10 +851,8 @@ public class ImportPaperFromJsonService {
|
|
// 设置答案
|
|
// 设置答案
|
|
if (StringUtils.isNotEmpty(answerHTML)) {
|
|
if (StringUtils.isNotEmpty(answerHTML)) {
|
|
question.setQuesAnswer(answerHTML.toString());
|
|
question.setQuesAnswer(answerHTML.toString());
|
|
- question.setQuesAnswerJson(answerJson.toString());
|
|
|
|
} else {
|
|
} else {
|
|
question.setQuesAnswer("<p></p>");
|
|
question.setQuesAnswer("<p></p>");
|
|
- question.setQuesAnswerJson(answerJson.toString());
|
|
|
|
}
|
|
}
|
|
|
|
|
|
if (quesScore != null) {
|
|
if (quesScore != null) {
|