Przeglądaj źródła

选项无内容导出bug

xiatian 3 lat temu
rodzic
commit
c4ef6319b5

+ 14 - 1
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/util/ExportPaperUtil.java

@@ -326,7 +326,7 @@ public class ExportPaperUtil {
 
     private static List<JSection> getSections(String html, boolean diposeFillBlank) {
         if (StringUtils.isBlank(html)) {
-            return null;
+            return getEmptySections();
         }
         html = html.trim();
         if (!html.startsWith("<p>")) {
@@ -349,6 +349,19 @@ public class ExportPaperUtil {
         return ss;
 
     }
+    
+    private static List<JSection> getEmptySections(){
+    	List<JSection> ss = new ArrayList<JSection>();
+    	JSection s = new JSection();
+        List<SectionElement> ses = new ArrayList<SectionElement>();
+        s.setElements(ses);
+        SectionElement se=new SectionElement();
+        se.setType(ELEMENT_TYPE_TEXT);
+        se.setValue("");
+        ses.add(se);
+        ss.add(s);
+        return ss;
+    }
 
     private static void getSectionElement(Node ce, List<SectionElement> ses, boolean diposeFillBlank) {
         if ("span".equals(ce.nodeName()) && ce.childNodeSize() > 0) {