From 8aac33c14bdf18c5dc41f45813195a4ceb75d6f4 Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Wed, 25 Mar 2026 14:30:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8A=A5=E5=91=8A=E6=94=B9=E6=88=90=E8=AF=BB?= =?UTF-8?q?=E5=8F=96=E6=8C=87=E5=AE=9A=E7=9B=AE=E5=BD=95=E4=B8=8B=E7=9A=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../report/service/impl/PqReportServiceImpl.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java b/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java index 5caa5f50..4041b074 100644 --- a/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java +++ b/detection/src/main/java/com/njcn/gather/report/service/impl/PqReportServiceImpl.java @@ -86,6 +86,7 @@ import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.FileSystemResource; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -600,7 +601,8 @@ public class PqReportServiceImpl extends ServiceImpl i throw new BusinessException(ReportResponseEnum.REPORT_TEMPLATE_NOT_EXIST); } // 读取模板文件 - ClassPathResource resource = new ClassPathResource("/model/" + reportName.getCode() + ReportConstant.DOCX); +// ClassPathResource resource = new ClassPathResource("/model/" + reportName.getCode() + ReportConstant.DOCX); + FileSystemResource resource = new FileSystemResource(templatePath + File.separator + reportName.getCode() + ReportConstant.DOCX); try (InputStream inputStream = resource.getInputStream()) { // 加载Word文档 XWPFDocument baseModelDocument = new XWPFDocument(inputStream); @@ -1525,12 +1527,13 @@ public class PqReportServiceImpl extends ServiceImpl i //String scriptId = adPlan.getScriptId(); Integer devChns = pqDevVO.getDevChns(); for (int i = 1; i <= devChns; i++) { - String path = "/model/report_table.docx"; + String path = "/report_table.docx"; DevType devType = devTypeService.getById(pqDevVO.getDevType()); if (devType.getName().equals("PQ-COM")) { - path = "/model/report_table - PQ-COM.docx"; + path = "/report_table - PQ-COM.docx"; } - ClassPathResource resource = new ClassPathResource(path); +// ClassPathResource resource = new ClassPathResource(path); + FileSystemResource resource = new FileSystemResource(templatePath + path); XWPFDocument dataModelDocumentTemp = new XWPFDocument(resource.getInputStream()); SingleNonHarmParam singleNonHarmParam = new SingleNonHarmParam();