he2802 3 жил өмнө
parent
commit
98d8969a26

+ 10 - 16
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionServiceImpl.java

@@ -602,20 +602,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
                         }
                         }
                         //题目正文
                         //题目正文
                         else{
                         else{
-                            int j = i;
-                            String q_content = ""; //题目正文
-                            while (j<paragraphList.size())
-                            {
-                                String tempTxt = dealTxt(paragraphList.get(j).getText());
-                                if(checkKey(tempTxt)){
-                                    break;
-                                }
-                                q_content+=tempTxt;
-                                System.out.println("正文"+q_content);
-                                j++;
-                            }
-                            qContent = q_content;
-                            i = j;
+                            qContent += content;
                         }
                         }
                     }else{
                     }else{
                        System.out.println("换行");
                        System.out.println("换行");
@@ -628,7 +615,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
                            errorLog+="第"+index+"条题目内容空白\n";
                            errorLog+="第"+index+"条题目内容空白\n";
                        }
                        }
                        bo.setStatus(1);
                        bo.setStatus(1);
-                       bo.setContent(qContent);
+                       bo.setContent(removeNo(qContent));
                        bo.setAnswerQuestion(answerQuestion);
                        bo.setAnswerQuestion(answerQuestion);
                        bo.setAnalysisContent(analysisContent);
                        bo.setAnalysisContent(analysisContent);
                        bo.setOptionsList(optionsList);
                        bo.setOptionsList(optionsList);
@@ -660,9 +647,16 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
         }
         }
     }
     }
 
 
+    private String removeNo(String txt){
+        int intIndex = txt.indexOf(".");
+        if(intIndex != -1){
+            txt = txt.substring(intIndex+1);
+        }
+        return txt;
+    }
 
 
     private boolean checkKey(String key){
     private boolean checkKey(String key){
-        if(Validator.isEmpty(key)||"解题思路:".equals(key)||"考查考点:".equals(key)||"老师解答:".equals(key)||"正确答案:".equals(key)||"A.".equals(key)||"【问题】".equals(key)||"A.".equals(key)){
+        if(Validator.isEmpty(key)||key.startsWith("解题思路:")||key.startsWith("考查考点:")||key.startsWith("老师解答:")||key.startsWith("正确答案:")||key.startsWith("A.")||key.startsWith("【问题】")){
             return true;
             return true;
         }
         }
         return false;
         return false;