From 9235b50cad6cdbdde1e0be3766ca165af03bb0c0 Mon Sep 17 00:00:00 2001
From: mitao <2763622819@qq.com>
Date: 星期二, 18 三月 2025 22:11:05 +0800
Subject: [PATCH] bug修改

---
 springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java
index d6058cd..36bd3a5 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java
@@ -39,6 +39,7 @@
 
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
+import java.io.InputStream;
 import java.net.URLEncoder;
 import java.text.SimpleDateFormat;
 import java.util.*;
@@ -1187,10 +1188,10 @@
         String fileName = "";
         switch (type) {
             case 1:
-                fileName = "社区问题单";
+                fileName = "community_question.docx";
                 break;
             case 2:
-                fileName = "问题处理单";
+                fileName = "question_handle.docx";
                 if (Objects.nonNull(partyMember)) {
                     community = community + "-" + partyMember.getServiceTarget();
                 }
@@ -1206,7 +1207,7 @@
                 if (Objects.nonNull(record)) {
                     reportType = record.getReportType();
                 }
-                fileName = "协调通知单";
+                fileName = "notice.docx";
                 break;
         }
         Map<String, Object> map = new HashMap<>();
@@ -1241,8 +1242,8 @@
         response.setContentType("application/octet-stream");
         String fileNameEncode = URLEncoder.encode(fileName, "UTF-8").replaceAll("\\+", "%20");
         response.setHeader("Content-disposition", "attachment;filename=\"" + fileNameEncode + ".docx" + "\"");
-        ClassPathResource resource = new ClassPathResource("template/" + fileName + ".docx");
-        XWPFTemplate.compile(resource.getFile()).render(map).writeAndClose(response.getOutputStream());
+        InputStream resourceAsStream = this.getClass().getResourceAsStream("/template/" + fileName);
+        XWPFTemplate.compile(resourceAsStream).render(map).writeAndClose(response.getOutputStream());
     }
 
 
@@ -1263,7 +1264,7 @@
             String content = "第一行内容\n第二行内容\n第三行内容";
             map.put("complaintProgress", content);
             map.put("status", "处理中");
-            XWPFTemplate.compile("F:\\DeskTop\\zhihuishequ\\springcloud_k8s_panzhihuazhihuishequ\\service_sangeshenbian\\src\\main\\resources\\template\\社区问题单.docx").render(map).writeToFile("F:\\DeskTop\\社区.docx");
+            XWPFTemplate.compile("F:\\DeskTop\\zhihuishequ\\springcloud_k8s_panzhihuazhihuishequ\\service_sangeshenbian\\src\\main\\resources\\template\\community_question.docx").render(map).writeToFile("F:\\DeskTop\\社区.docx");
         } catch (IOException e) {
             e.printStackTrace();
         }

--
Gitblit v1.7.1