fix: 法规评估库导出
This commit is contained in:
+36
-1
@@ -182,7 +182,7 @@ public class LawsConformityAssessmentLibraryServiceImpl extends ServiceImpl<Laws
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.settleDocuments(url, "佐证材料", recordsExport);
|
this.settleDocuments(url, "佐证材料", recordsExport);
|
||||||
this.settleDocuments(url, "辅助说明材料", recordsExport);
|
this.settleDocumentsTwo(url, "辅助说明材料", recordsExport);
|
||||||
|
|
||||||
// 去除文本的<p>
|
// 去除文本的<p>
|
||||||
String regex = "<[^>]*>";
|
String regex = "<[^>]*>";
|
||||||
@@ -344,6 +344,41 @@ public class LawsConformityAssessmentLibraryServiceImpl extends ServiceImpl<Laws
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void settleDocumentsTwo(String url, String folderName, List<LawsConformityAssessmentLibraryExportVO> excelVos) throws IOException {
|
||||||
|
// 构建完整的文件夹路径
|
||||||
|
String directoryPath = url + File.separator + folderName;
|
||||||
|
|
||||||
|
// 检查文件夹是否存在,如果不存在则创建
|
||||||
|
File directory = new File(directoryPath);
|
||||||
|
if (!directory.exists()) {
|
||||||
|
directory.mkdirs(); // 使用mkdirs()而不是mkdir(),因为mkdirs()会创建所有必需的父目录
|
||||||
|
}
|
||||||
|
|
||||||
|
for (LawsConformityAssessmentLibraryExportVO vo : excelVos) {
|
||||||
|
// 查询文件
|
||||||
|
if (StringUtils.isNotBlank(vo.getUnsatisfiedRequireAttach())) {
|
||||||
|
List<String> fileIdList = Arrays.asList(vo.getUnsatisfiedRequireAttach().split(","));
|
||||||
|
List<OSSFile> ossFileList = ossFileService.listByIds(fileIdList);
|
||||||
|
if (!ossFileList.isEmpty()) {
|
||||||
|
// 赋值
|
||||||
|
List<UnsatisfiedRequireAttachFile> materialFileList = com.jero.common.util.BeanCopyUtils.copyBeanList(ossFileList, UnsatisfiedRequireAttachFile.class);
|
||||||
|
vo.setUnsatisfiedRequireAttachList(materialFileList);
|
||||||
|
// 写出文件
|
||||||
|
for (OSSFile ossFile : ossFileList) {
|
||||||
|
InputStream inputStream = ObsBootUtil.getOssFile(ossFile.getUrl());
|
||||||
|
// pdf加水印
|
||||||
|
if (StringUtils.endsWithIgnoreCase(ossFile.getFileName(), ".pdf")) {
|
||||||
|
inputStream = sysWaterMarkUtil.addWatermarkToPdf(inputStream);
|
||||||
|
}
|
||||||
|
// 构建文件保存路径,将文件保存在指定文件夹下
|
||||||
|
String filePath = url + File.separator + folderName + File.separator + ossFile.getFileName();
|
||||||
|
writeToLocal(filePath, inputStream);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 将InputStream写入本地文件
|
* 将InputStream写入本地文件
|
||||||
|
|||||||
Reference in New Issue
Block a user