From d8e7ad6acb9f6105ac6ff6fe2ce892e622cde256 Mon Sep 17 00:00:00 2001 From: mitao <2763622819@qq.com> Date: 星期二, 18 三月 2025 22:11:24 +0800 Subject: [PATCH] Merge remote-tracking branch '喜望/dev-2.0' into dev-2.0 --- springcloud_k8s_panzhihuazhihuishequ/service_sangeshenbian/src/main/java/com/panzhihua/sangeshenbian/service/impl/ComplaintServiceImpl.java | 16 ++++++++++------ 1 files changed, 10 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 1239fac..2e4d59c 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 @@ -33,11 +33,13 @@ import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.context.annotation.Lazy; +import org.springframework.core.io.ClassPathResource; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import javax.servlet.http.HttpServletResponse; import java.io.IOException; +import java.io.InputStream; import java.net.URLEncoder; import java.text.SimpleDateFormat; import java.util.*; @@ -810,6 +812,8 @@ if (Objects.isNull(complaintAuditRecord)) { throw new ServiceException("上报申请记录不存在"); } + complaintAuditRecord.setAuditorName(systemUser.getName()); + complaintAuditRecord.setAuditorPhone(systemUser.getPhone()); if (complaintReporAuditDTO.getAuditResult().equals(1)) { complaintAuditRecord.setAuditStatus(1); complaintAuditRecord.setAuditorId(loginUserInfoVO.getUserId()); @@ -1184,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(); } @@ -1203,7 +1207,7 @@ if (Objects.nonNull(record)) { reportType = record.getReportType(); } - fileName = "协调通知单"; + fileName = "notice.docx"; break; } Map<String, Object> map = new HashMap<>(); @@ -1238,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" + "\""); - String fileTemplateName = FileUtil.getPath() + "template/" + fileName + ".docx"; - XWPFTemplate.compile(fileTemplateName).render(map).writeAndClose(response.getOutputStream()); + InputStream resourceAsStream = this.getClass().getResourceAsStream("/template/" + fileName); + XWPFTemplate.compile(resourceAsStream).render(map).writeAndClose(response.getOutputStream()); } @@ -1260,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