From d33e687ff5b3fdb50e3dccf50e3a276baf2e6c5c Mon Sep 17 00:00:00 2001
From: zzw <wander.zheng@qq.com>
Date: 星期五, 17 十一月 2023 17:03:50 +0800
Subject: [PATCH] 编号

---
 core/src/main/java/com/zt/life/export/service/WordFileService.java |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/core/src/main/java/com/zt/life/export/service/WordFileService.java b/core/src/main/java/com/zt/life/export/service/WordFileService.java
index d1b3f77..2329e9e 100644
--- a/core/src/main/java/com/zt/life/export/service/WordFileService.java
+++ b/core/src/main/java/com/zt/life/export/service/WordFileService.java
@@ -8,6 +8,7 @@
 import com.deepoove.poi.policy.HackLoopTableRenderPolicy;
 
 import com.zt.life.export.dto.WordFile;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 
 
@@ -19,16 +20,19 @@
 
 @Service
 public class WordFileService {
+    @Value("${zt.oss.local-path}")
+    private String localPath;
+
     public void exportWordFile(HttpServletRequest request, Object dataObj, WordFile wordFile, HttpServletResponse response) throws UnsupportedEncodingException, FileNotFoundException {
         // 鏁版嵁map闆嗗悎
         Map<String, Object> wordData = new HashMap<>();
         //HackLoopTableRenderPolicy hackLoopTableRenderPolicy = new HackLoopTableRenderPolicy();
         Configure config = null;
         ConfigureBuilder builder = Configure.newBuilder();
-        this.formatWordData(wordFile, wordData, builder);
+        this.formatWordData(dataObj, wordData, builder);
 
         config = builder.build();
-        File fl = new File(wordFile.getModulePath());
+        File fl = new File(localPath+"/template/"+wordFile.getModulePath());
         FileInputStream fs = new FileInputStream(fl);
         XWPFTemplate template;
         if (config != null) {
@@ -51,7 +55,7 @@
                 formatWordData(staticFieldValue, wordData, builder);
             } else {
                 if (field.getType().getName().equals("java.util.List")) {
-                    builder.bind(fieldName, new HackLoopTableRenderPolicy());
+                   builder.bind(fieldName, new HackLoopTableRenderPolicy());
                 } else if (staticFieldValue != null) {
                     String valStr = staticFieldValue.toString();
                     if (valStr.contains("绛惧悕鍥剧墖:")) {

--
Gitblit v1.9.1