Bladeren bron

fix 导入题库

he2802 3 jaren geleden
bovenliggende
commit
2544e5fa38

+ 6 - 3
zhongzheng-system/src/main/java/com/zhongzheng/modules/bank/service/impl/QuestionServiceImpl.java

@@ -498,6 +498,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
                 String strContent = "";
                 for (XWPFParagraph paragraph : paragraphList) {
                     content = paragraph.getText();
+                    content = dealTxt(content);
                     List<XWPFRun> runs = paragraph.getRuns();
                     for (XWPFRun run : runs) {
                         Node node = run.getCTR().getDomNode();
@@ -536,11 +537,13 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> i
                                 e.printStackTrace();
                             }
                             String imgUrl = ossHost + "/" + ossPath + "?x-oss-process=image/resize,w_" + wPx + ",h_" + HPx;
-                            content = "<p><img src=\"" + imgUrl + "\"></p>";
+                            if(Validator.isNotEmpty(content)&&content!=""){
+                                content =  content +"<br />" +"<p><img src=\"" + imgUrl + "\"></p>";
+                            }else{
+                                content = "<p><img src=\"" + imgUrl + "\"></p>";
+                            }
                         }
                     }
-                    content = dealTxt(content);
-                    System.out.println(content);
                     if (content.startsWith("#")||isQuestionStart(content)) {
                         if(nowPart>0){
                             //插入上一条