From e4db7d4a3e03ec4767a57743aef01e54461bbe9a Mon Sep 17 00:00:00 2001
From: jinlin <jinlin>
Date: 星期一, 18 十二月 2023 14:29:11 +0800
Subject: [PATCH] 修改

---
 core/src/main/java/com/zt/life/export/service/WordFileService.java |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 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 3ef75f1..8b9208e 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
@@ -20,6 +20,7 @@
 import java.awt.image.BufferedImage;
 import java.io.*;
 import java.lang.reflect.Field;
+import java.text.SimpleDateFormat;
 import java.util.*;
 
 @Service
@@ -65,11 +66,15 @@
                 if (field.getType().getName().equals("java.util.List")) {
                     builder.bind(fieldName, new HackLoopTableRenderPolicy());
                 } else if (staticFieldValue != null) {
+                    if (typeName.contains("java.util.Date") && fieldName.contains("Date")) {
+                        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+                        staticFieldValue = sdf.format(staticFieldValue);
+                    }
                     String valStr = staticFieldValue.toString();
                     if (valStr.contains("鏂囦欢鍥剧墖:")) {
                         valStr = localPath + valStr.replace("鏂囦欢鍥剧墖:", "");
                         File file = new File(valStr);
-                        if (file.exists()) {
+                        if (file.exists() && !localPath.equals(valStr)) {
                             try (InputStream in = ossEncryptService.decrypt(file)) {
                                 InputStream in2 = ossEncryptService.decrypt(file);
                                 BufferedImage bufferedImage = ImageIO.read(in2);
@@ -81,13 +86,15 @@
                                 e.printStackTrace();
                             }
                         } else {
-                            staticFieldValue = new PictureRenderData(100, 30, "template/noSign.png");
+                            staticFieldValue = new PictureRenderData(100, 30, localPath+"template/noSign.png");
                         }
                     }
                 }
                 if (wordData.get(fieldName) == null)
                     wordData.put(fieldName, staticFieldValue);
             }
+            if (wordData.get(fieldName) == null)
+                wordData.put(fieldName, staticFieldValue);
         }
     }
 }

--
Gitblit v1.9.1