|
@@ -257,11 +257,11 @@ public class ExportPaperServiceImpl implements ExportPaperService {
|
|
//设置小题题号
|
|
//设置小题题号
|
|
computerTestQuestion.setNumber(i + 1);
|
|
computerTestQuestion.setNumber(i + 1);
|
|
//得到小题题干
|
|
//得到小题题干
|
|
- computerTestQuestion.setBody(getBodyOrAnswer(paperDetailUnit.getQuestion().getQuesBody()));
|
|
|
|
|
|
+ computerTestQuestion.setBody(getBodyOrAnswer(paperDetailUnit.getQuestion().getQuesBody(),computerTestPaper));
|
|
//得到小题所有选项
|
|
//得到小题所有选项
|
|
- computerTestQuestion.setOptions(getOption(paperDetailUnit.getQuestion()));
|
|
|
|
|
|
+ computerTestQuestion.setOptions(getOption(paperDetailUnit.getQuestion(),computerTestPaper));
|
|
//得到小题的答案
|
|
//得到小题的答案
|
|
- computerTestQuestion.setAnswer(getBodyOrAnswer(paperDetailUnit.getQuestion().getQuesAnswer()));
|
|
|
|
|
|
+ computerTestQuestion.setAnswer(getBodyOrAnswer(paperDetailUnit.getQuestion().getQuesAnswer(),computerTestPaper));
|
|
//查询小题中的 套题
|
|
//查询小题中的 套题
|
|
List<Question> subQuestionsList = paperDetailUnit.getQuestion().getSubQuestions();
|
|
List<Question> subQuestionsList = paperDetailUnit.getQuestion().getSubQuestions();
|
|
//判断这个小题中是否有套题
|
|
//判断这个小题中是否有套题
|
|
@@ -273,9 +273,9 @@ public class ExportPaperServiceImpl implements ExportPaperService {
|
|
ComputerTestQuestion subcomputerTestQuestion = new ComputerTestQuestion(subQuestion);
|
|
ComputerTestQuestion subcomputerTestQuestion = new ComputerTestQuestion(subQuestion);
|
|
//设置套题中小题题号
|
|
//设置套题中小题题号
|
|
subcomputerTestQuestion.setNumber(j + 1);
|
|
subcomputerTestQuestion.setNumber(j + 1);
|
|
- subcomputerTestQuestion.setBody(getBodyOrAnswer(subQuestion.getQuesBody()));
|
|
|
|
- subcomputerTestQuestion.setOptions(getOption(subQuestion));
|
|
|
|
- subcomputerTestQuestion.setAnswer(getBodyOrAnswer(subQuestion.getQuesAnswer()));
|
|
|
|
|
|
+ subcomputerTestQuestion.setBody(getBodyOrAnswer(subQuestion.getQuesBody(),computerTestPaper));
|
|
|
|
+ subcomputerTestQuestion.setOptions(getOption(subQuestion,computerTestPaper));
|
|
|
|
+ subcomputerTestQuestion.setAnswer(getBodyOrAnswer(subQuestion.getQuesAnswer(),computerTestPaper));
|
|
subQuestions.add(subcomputerTestQuestion);
|
|
subQuestions.add(subcomputerTestQuestion);
|
|
}
|
|
}
|
|
computerTestQuestion.setSubQuestions(subQuestions);
|
|
computerTestQuestion.setSubQuestions(subQuestions);
|
|
@@ -291,7 +291,7 @@ public class ExportPaperServiceImpl implements ExportPaperService {
|
|
return computerTestPaper;
|
|
return computerTestPaper;
|
|
}
|
|
}
|
|
|
|
|
|
- private Sections getBodyOrAnswer(String str) {
|
|
|
|
|
|
+ private Sections getBodyOrAnswer(String str,ComputerTestPaper computerTestPaper) {
|
|
Sections body = new Sections();
|
|
Sections body = new Sections();
|
|
List<Section> sections = new ArrayList<Section>();
|
|
List<Section> sections = new ArrayList<Section>();
|
|
//得到小题题干或者答案行数
|
|
//得到小题题干或者答案行数
|
|
@@ -300,7 +300,7 @@ public class ExportPaperServiceImpl implements ExportPaperService {
|
|
}
|
|
}
|
|
String[] questionRowStrings = str.split("</p>");
|
|
String[] questionRowStrings = str.split("</p>");
|
|
for (int i = 0; i < questionRowStrings.length; i++) {
|
|
for (int i = 0; i < questionRowStrings.length; i++) {
|
|
- List<Block> blocks = disposeQuestionBodyOrOption(questionRowStrings[i]);
|
|
|
|
|
|
+ List<Block> blocks = disposeQuestionBodyOrOption(questionRowStrings[i],computerTestPaper);
|
|
if (blocks != null && blocks.size() > 0) {
|
|
if (blocks != null && blocks.size() > 0) {
|
|
Section section = new Section();
|
|
Section section = new Section();
|
|
//将小题题干拆分为Block集合
|
|
//将小题题干拆分为Block集合
|
|
@@ -312,7 +312,7 @@ public class ExportPaperServiceImpl implements ExportPaperService {
|
|
return body;
|
|
return body;
|
|
}
|
|
}
|
|
|
|
|
|
- private List<ComputerTestOption> getOption(Question question) {
|
|
|
|
|
|
+ private List<ComputerTestOption> getOption(Question question,ComputerTestPaper computerTestPaper) {
|
|
//得到小题选项
|
|
//得到小题选项
|
|
List<QuesOption> quesOptions = question.getQuesOptions();
|
|
List<QuesOption> quesOptions = question.getQuesOptions();
|
|
List<ComputerTestOption> options = new ArrayList<ComputerTestOption>();
|
|
List<ComputerTestOption> options = new ArrayList<ComputerTestOption>();
|
|
@@ -329,7 +329,7 @@ public class ExportPaperServiceImpl implements ExportPaperService {
|
|
String optionString = quesOption.getOptionBody();
|
|
String optionString = quesOption.getOptionBody();
|
|
String[] optionStrings = optionString.split("</p>");
|
|
String[] optionStrings = optionString.split("</p>");
|
|
for (int i = 0; i < optionStrings.length; i++) {
|
|
for (int i = 0; i < optionStrings.length; i++) {
|
|
- List<Block> blocks = disposeQuestionBodyOrOption(optionStrings[i]);
|
|
|
|
|
|
+ List<Block> blocks = disposeQuestionBodyOrOption(optionStrings[i],computerTestPaper);
|
|
if (blocks != null && blocks.size() > 0) {
|
|
if (blocks != null && blocks.size() > 0) {
|
|
Section section = new Section();
|
|
Section section = new Section();
|
|
section.setBlocks(blocks);
|
|
section.setBlocks(blocks);
|
|
@@ -344,7 +344,7 @@ public class ExportPaperServiceImpl implements ExportPaperService {
|
|
return options;
|
|
return options;
|
|
}
|
|
}
|
|
|
|
|
|
- private List<Block> disposeQuestionBodyOrOption(String questionRow) {
|
|
|
|
|
|
+ private List<Block> disposeQuestionBodyOrOption(String questionRow,ComputerTestPaper computerTestPaper) {
|
|
List<Block> blocks = new ArrayList<Block>();
|
|
List<Block> blocks = new ArrayList<Block>();
|
|
//去掉每行里面的<p>,<span>,</span>标签
|
|
//去掉每行里面的<p>,<span>,</span>标签
|
|
questionRow = questionRow.replaceAll("<p>", "")
|
|
questionRow = questionRow.replaceAll("<p>", "")
|
|
@@ -353,6 +353,7 @@ public class ExportPaperServiceImpl implements ExportPaperService {
|
|
.replaceAll("</span>", "")
|
|
.replaceAll("</span>", "")
|
|
.replaceAll("</a>", "");
|
|
.replaceAll("</a>", "");
|
|
String[] questionRowStrings = questionRow.split("<|/>|>");
|
|
String[] questionRowStrings = questionRow.split("<|/>|>");
|
|
|
|
+ boolean hasAudio = false;
|
|
for (int i = 0; i < questionRowStrings.length; i++) {
|
|
for (int i = 0; i < questionRowStrings.length; i++) {
|
|
Block block = new Block();
|
|
Block block = new Block();
|
|
String rowStr = questionRowStrings[i];
|
|
String rowStr = questionRowStrings[i];
|
|
@@ -390,6 +391,7 @@ public class ExportPaperServiceImpl implements ExportPaperService {
|
|
block.setType("audio");
|
|
block.setType("audio");
|
|
block.setValue(CommonUtils.getAttrValue(rowStr, "id"));
|
|
block.setValue(CommonUtils.getAttrValue(rowStr, "id"));
|
|
blocks.add(block);
|
|
blocks.add(block);
|
|
|
|
+ hasAudio = true;
|
|
} else {
|
|
} else {
|
|
block.setType("text");
|
|
block.setType("text");
|
|
rowStr = rowStr.replace(" ", "");//消除空格
|
|
rowStr = rowStr.replace(" ", "");//消除空格
|
|
@@ -403,6 +405,9 @@ public class ExportPaperServiceImpl implements ExportPaperService {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if(hasAudio){
|
|
|
|
+ computerTestPaper.setHasVideo(1);
|
|
|
|
+ }
|
|
return blocks;
|
|
return blocks;
|
|
}
|
|
}
|
|
|
|
|