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();