微调
This commit is contained in:
@@ -310,8 +310,8 @@ public class PqReportServiceImpl extends ServiceImpl<PqReportMapper, PqReport> 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<PqReportMapper, PqReport> 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<PqReportMapper, PqReport> 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<PqReportMapper, PqReport> 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<PqReportMapper, PqReport> 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);
|
||||
|
||||
Reference in New Issue
Block a user