|
|
@@ -350,11 +350,8 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
XWPFWordExtractor extractor = new XWPFWordExtractor(doc);
|
|
|
List<XWPFParagraph> paragraphList = doc.getParagraphs();
|
|
|
int type = -1; //题目类型
|
|
|
- String q_content = ""; //题目正文
|
|
|
List<QuestionChildAddBo> optionsList =new ArrayList<>(); //题目选项
|
|
|
String content = "";
|
|
|
- String splitContent = ""; //拼接文本
|
|
|
- String splitIndex = "";
|
|
|
int i = 0;
|
|
|
//遍历正文
|
|
|
while (i<paragraphList.size())
|
|
|
@@ -377,12 +374,116 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
|
|
|
else if(content.equals("简答题格式")){
|
|
|
type = 5;
|
|
|
}
|
|
|
+ //第一个选项
|
|
|
else if(content.startsWith("A.")){
|
|
|
- splitIndex = "A";
|
|
|
QuestionChildAddBo bo1 = new QuestionChildAddBo();
|
|
|
bo1.setOptionsId(1L);
|
|
|
- // bo1.setContent(question.getV1());
|
|
|
+ int j = i;
|
|
|
+ String q_content = ""; //题目正文
|
|
|
+ while (j<paragraphList.size())
|
|
|
+ {
|
|
|
+ String tempTxt = paragraphList.get(j).getText();
|
|
|
+ if(Validator.isEmpty(tempTxt)||tempTxt.startsWith("B.")){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ q_content+=tempTxt;
|
|
|
+ j++;
|
|
|
+ }
|
|
|
+ bo1.setContent(q_content);
|
|
|
+ optionsList.add(bo1);
|
|
|
+ }
|
|
|
+ //第二个选项
|
|
|
+ else if(content.startsWith("B.")){
|
|
|
+ QuestionChildAddBo bo1 = new QuestionChildAddBo();
|
|
|
+ bo1.setOptionsId(1L);
|
|
|
+ int j = i;
|
|
|
+ String q_content = ""; //题目正文
|
|
|
+ while (j<paragraphList.size())
|
|
|
+ {
|
|
|
+ String tempTxt = paragraphList.get(j).getText();
|
|
|
+ if(Validator.isEmpty(tempTxt)||tempTxt.startsWith("C.")){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ q_content+=tempTxt;
|
|
|
+ j++;
|
|
|
+ }
|
|
|
+ bo1.setContent(q_content);
|
|
|
+ optionsList.add(bo1);
|
|
|
+ }
|
|
|
+ //第三个选项
|
|
|
+ else if(content.startsWith("C.")){
|
|
|
+ QuestionChildAddBo bo1 = new QuestionChildAddBo();
|
|
|
+ bo1.setOptionsId(1L);
|
|
|
+ int j = i;
|
|
|
+ String q_content = ""; //题目正文
|
|
|
+ while (j<paragraphList.size())
|
|
|
+ {
|
|
|
+ String tempTxt = paragraphList.get(j).getText();
|
|
|
+ if(Validator.isEmpty(tempTxt)||tempTxt.startsWith("D.")){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ q_content+=tempTxt;
|
|
|
+ j++;
|
|
|
+ }
|
|
|
+ bo1.setContent(q_content);
|
|
|
+ optionsList.add(bo1);
|
|
|
+ }
|
|
|
+ //第四个选项
|
|
|
+ else if(content.startsWith("D.")){
|
|
|
+ QuestionChildAddBo bo1 = new QuestionChildAddBo();
|
|
|
+ bo1.setOptionsId(1L);
|
|
|
+ int j = i;
|
|
|
+ String q_content = ""; //题目正文
|
|
|
+ while (j<paragraphList.size())
|
|
|
+ {
|
|
|
+ String tempTxt = paragraphList.get(j).getText();
|
|
|
+ if(Validator.isEmpty(tempTxt)||tempTxt.startsWith("E.")){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ q_content+=tempTxt;
|
|
|
+ j++;
|
|
|
+ }
|
|
|
+ bo1.setContent(q_content);
|
|
|
optionsList.add(bo1);
|
|
|
+ }
|
|
|
+ //第五个选项
|
|
|
+ else if(content.startsWith("E.")){
|
|
|
+ QuestionChildAddBo bo1 = new QuestionChildAddBo();
|
|
|
+ bo1.setOptionsId(1L);
|
|
|
+ int j = i;
|
|
|
+ String q_content = ""; //题目正文
|
|
|
+ while (j<paragraphList.size())
|
|
|
+ {
|
|
|
+ String tempTxt = paragraphList.get(j).getText();
|
|
|
+ if(Validator.isEmpty(tempTxt)||tempTxt.startsWith("F.")){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ q_content+=tempTxt;
|
|
|
+ j++;
|
|
|
+ }
|
|
|
+ bo1.setContent(q_content);
|
|
|
+ optionsList.add(bo1);
|
|
|
+ }
|
|
|
+ //第六个选项
|
|
|
+ else if(content.startsWith("F.")){
|
|
|
+ QuestionChildAddBo bo1 = new QuestionChildAddBo();
|
|
|
+ bo1.setOptionsId(1L);
|
|
|
+ int j = i;
|
|
|
+ String q_content = ""; //题目正文
|
|
|
+ while (j<paragraphList.size())
|
|
|
+ {
|
|
|
+ String tempTxt = paragraphList.get(j).getText();
|
|
|
+ if(Validator.isEmpty(tempTxt)||tempTxt.startsWith("G.")){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ q_content+=tempTxt;
|
|
|
+ j++;
|
|
|
+ }
|
|
|
+ bo1.setContent(q_content);
|
|
|
+ optionsList.add(bo1);
|
|
|
+ }
|
|
|
+ else if(content.startsWith("建匠答案")){
|
|
|
+
|
|
|
}
|
|
|
paragraph.getText();
|
|
|
}
|