xiatian 5 年 前
コミット
a0603e40ba

+ 5 - 0
examcloud-core-questions-base/src/main/java/cn/com/qmth/examcloud/core/questions/base/FileDisposeUtil.java

@@ -357,4 +357,9 @@ public class FileDisposeUtil {
                 zipFile.close();
         }
     }
+    
+    public static String getDocxBasePath() {
+        return FileDisposeUtil.class.getProtectionDomain().getCodeSource().getLocation().getPath()
+                + "export_template/docx";
+    }
 }

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

@@ -46,6 +46,8 @@ public class ExportPaperUtil {
 
     private static final Logger log = LoggerFactory.getLogger(ExportPaperUtil.class);
     
+    private static final String docxBasePath=FileDisposeUtil.getDocxBasePath();
+    
     private static final int docImageSzie=12700;
 
     private static final String DOCX_SUFFIX = ".docx";
@@ -104,7 +106,7 @@ public class ExportPaperUtil {
     //考试说明word文件
     public static File createExamRemarkDocFile(File directory,String fileName,String html) throws IOException {
      // doc固定源文件目录
-        File docxDir = new File(getDocxBasePath());
+        File docxDir = new File(docxBasePath);
         // 将要生成的doc源文件目录
         File docxTargetDir = new File(directory.getAbsolutePath() + "/docx/");
         docxTargetDir.mkdir();
@@ -288,7 +290,7 @@ public class ExportPaperUtil {
     // 原始试卷
     public static File createOriginPaperDocFile(PaperExp paperExp, File directory) throws Exception {
         // doc固定源文件目录
-        File docxDir = new File(getDocxBasePath());
+        File docxDir = new File(docxBasePath);
         // 将要生成的doc源文件目录
         File docxTargetDir = new File(directory.getAbsolutePath() + "/docx/");
         docxTargetDir.mkdir();
@@ -310,10 +312,6 @@ public class ExportPaperUtil {
 
     }
 
-    private static String getDocxBasePath() {
-        return JsonImportUtil.class.getProtectionDomain().getCodeSource().getLocation().getPath()
-                + "export_template/docx";
-    }
 
     private static List<JSection> getSections(String html) {
         return getSections(html, false);