From 5105e778232abc6f48e1321e60a60b17cee56c92 Mon Sep 17 00:00:00 2001 From: caozehui <2427765068@qq.com> Date: Wed, 10 Dec 2025 09:17:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/PqReportServiceImpl.java | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 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 972f11e1..75d69e02 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 @@ -310,8 +310,8 @@ public class PqReportServiceImpl extends ServiceImpl i private void uploadFile(ReportParam reportParam, PqReport pqReport, boolean isAdd) { MultipartFile baseFile = reportParam.getBaseFile(); MultipartFile detailFile = reportParam.getDetailFile(); - String relativePath = File.separator + reportParam.getName() + File.separator + reportParam.getVersion() + File.separator; - String newDir = templatePath + relativePath; + String relativePath = reportParam.getName() + File.separator + reportParam.getVersion() + File.separator; + String newDir = templatePath + File.separator + relativePath; long FILE_SIZE_LIMIT = 5 * 1024 * 1024; if (isAdd) { @@ -388,13 +388,13 @@ public class PqReportServiceImpl extends ServiceImpl i // 文件夹重命名 String oldBasePathStr = oldPqReport.getBasePath(); String baseName = oldBasePathStr.substring(oldBasePathStr.lastIndexOf(File.separator) + 1); - Path oldBasePath = Paths.get(templatePath + oldBasePathStr); + Path oldBasePath = Paths.get(templatePath + File.separator + oldBasePathStr); Path newBasePath = Paths.get(newDir + baseName); pqReport.setBasePath(relativePath + baseName); String oldDetailPathStr = oldPqReport.getDetailPath(); String detailName = oldDetailPathStr.substring(oldDetailPathStr.lastIndexOf(File.separator) + 1); - Path oldDetailPath = Paths.get(templatePath + oldDetailPathStr); + Path oldDetailPath = Paths.get(templatePath + File.separator + oldDetailPathStr); Path newDetailPath = Paths.get(newDir + detailName); pqReport.setDetailPath(relativePath + detailName); @@ -420,13 +420,13 @@ public class PqReportServiceImpl extends ServiceImpl i if (!baseFileOriginalFilename.isEmpty()) { pqReport.setBasePath(relativePath + baseFileOriginalFilename); - Paths.get(templatePath + oldPqReport.getBasePath()).toFile().delete(); + Paths.get(templatePath + File.separator + oldPqReport.getBasePath()).toFile().delete(); Paths.get(newDir + oldPqReport.getBasePath().substring(oldPqReport.getBasePath().lastIndexOf(File.separator) + 1)).toFile().delete(); this.uploadFile(baseFile, newDir + baseFileOriginalFilename); } if (!detailFileOriginalFilename.isEmpty()) { pqReport.setDetailPath(relativePath + detailFileOriginalFilename); - Paths.get(templatePath + oldPqReport.getDetailPath()).toFile().delete(); + Paths.get(templatePath + File.separator + oldPqReport.getDetailPath()).toFile().delete(); Paths.get(newDir + oldPqReport.getDetailPath().substring(oldPqReport.getDetailPath().lastIndexOf(File.separator) + 1)).toFile().delete(); this.uploadFile(detailFile, newDir + detailFileOriginalFilename); } @@ -801,8 +801,8 @@ public class PqReportServiceImpl extends ServiceImpl i if (Objects.isNull(report)) { throw new BusinessException(ReportResponseEnum.REPORT_TEMPLATE_NOT_EXIST); } - Path basePath = Paths.get(templatePath + report.getBasePath()); - Path detailPath = Paths.get(templatePath + report.getDetailPath()); + Path basePath = Paths.get(templatePath + File.separator + report.getBasePath()); + Path detailPath = Paths.get(templatePath + File.separator + report.getDetailPath()); try (InputStream baseInputStream = Files.newInputStream(basePath); InputStream detailInputStream = Files.newInputStream(detailPath)) { WordprocessingMLPackage detailModelDocument = WordprocessingMLPackage.load(detailInputStream); @@ -878,8 +878,8 @@ public class PqReportServiceImpl extends ServiceImpl i if (Objects.isNull(report)) { throw new BusinessException(ReportResponseEnum.REPORT_TEMPLATE_NOT_EXIST); } - Path basePath = Paths.get(templatePath + report.getBasePath()); - Path detailPath = Paths.get(templatePath + report.getDetailPath()); + Path basePath = Paths.get(templatePath + File.separator + report.getBasePath()); + Path detailPath = Paths.get(templatePath + File.separator + report.getDetailPath()); try (InputStream baseInputStream = Files.newInputStream(basePath); InputStream detailInputStream = Files.newInputStream(detailPath)) { WordprocessingMLPackage detailModelDocument = WordprocessingMLPackage.load(detailInputStream);