From 684f9e65a5229204eae4d2d64ebc509ed599bdfc Mon Sep 17 00:00:00 2001 From: chenrui <1187576398@qq.com> Date: 星期三, 05 三月 2025 17:40:49 +0800 Subject: [PATCH] 代码迁移bug解决 --- inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java index 7d61ac8..5ffffde 100644 --- a/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java +++ b/inspect-server/src/main/java/com/ruoyi/inspect/service/impl/InsReportServiceImpl.java @@ -39,6 +39,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.poi.xwpf.usermodel.*; import org.springframework.beans.factory.annotation.Value; +import org.springframework.core.io.ClassPathResource; import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -83,8 +84,7 @@ private String wordUrl; @Value("${file.path}") private String imgUrl; - @Value("${file.licenseUrl}") - private String licenseUrl; + @Resource private InsOrderMapper insOrderMapper; @Resource @@ -537,6 +537,11 @@ } // 鍘嬬缉涓存椂鏂囦欢澶� zipFilePath = wordUrl + "/zip/output.zip"; + // 鍒ゆ柇zip璺緞鏄惁瀛樺湪 + File zipDir = new File(wordUrl + "/zip"); + if(!zipDir.isDirectory()){ + zipDir.mkdirs(); + } zipDirectory(tempFolderPath, zipFilePath); // 娓呯悊涓存椂鏂囦欢澶� @@ -676,7 +681,7 @@ FileOutputStream os = null; try { //鍑瘉 涓嶇劧鍒囨崲鍚庢湁姘村嵃 - InputStream is = Files.newInputStream(new File(licenseUrl).toPath()); + InputStream is = new ClassPathResource("/lib/license.xml").getInputStream(); License license = new License(); license.setLicense(is); if (!license.getIsLicensed()) { @@ -1115,7 +1120,7 @@ FileOutputStream os = null; try { //鍑瘉 涓嶇劧鍒囨崲鍚庢湁姘村嵃 - InputStream is = Files.newInputStream(new File(licenseUrl).toPath()); + InputStream is = new ClassPathResource("/lib/license.xml").getInputStream(); License license = new License(); license.setLicense(is); if (!license.getIsLicensed()) { -- Gitblit v1.9.3