Преглед на файлове

json导入不用保存原json内容

xiatian преди 5 години
родител
ревизия
9b46ad9365

+ 0 - 9
examcloud-core-questions-dao/src/main/java/cn/com/qmth/examcloud/core/questions/dao/entity/QuesOption.java

@@ -18,7 +18,6 @@ public class QuesOption implements Serializable {
 
     private String optionBodyWord;// 选项word
 
-    private String optionBodyJson;// 选项json
 
     /**
      * 是否是正确答案 1:是 0:否
@@ -60,12 +59,4 @@ public class QuesOption implements Serializable {
         this.isCorrect = isCorrect;
     }
 
-    public String getOptionBodyJson() {
-        return optionBodyJson;
-    }
-
-    public void setOptionBodyJson(String optionBodyJson) {
-        this.optionBodyJson = optionBodyJson;
-    }
-
 }

+ 0 - 20
examcloud-core-questions-dao/src/main/java/cn/com/qmth/examcloud/core/questions/dao/entity/Question.java

@@ -19,8 +19,6 @@ public class Question extends IdBase {
 
     private String quesBodyWord;// 题干word
 
-    private String quesBodyJson;// 题干Json
-
     /**
      * 试题wordpkg对象序列化数据
      */
@@ -35,8 +33,6 @@ public class Question extends IdBase {
 
     private String quesAnswerWord;// 答案word
 
-    private String quesAnswerJson;// 答案Json
-
     private String quesAnswerAnalysis;// 答案解析,默认为html
 
     private String quesAnswerAnalysisWord;// 答案word解析
@@ -421,20 +417,4 @@ public class Question extends IdBase {
         this.answerType = answerType;
     }
 
-    public String getQuesBodyJson() {
-        return quesBodyJson;
-    }
-
-    public void setQuesBodyJson(String quesBodyJson) {
-        this.quesBodyJson = quesBodyJson;
-    }
-
-    public String getQuesAnswerJson() {
-        return quesAnswerJson;
-    }
-
-    public void setQuesAnswerJson(String quesAnswerJson) {
-        this.quesAnswerJson = quesAnswerJson;
-    }
-
 }

+ 1 - 20
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/ImportPaperFromJsonService.java

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