提案导出修复:导出上会提案表汇总表时替换特殊字符(避免因为/拼接path异常);

This commit is contained in:
2026-10-16 16:42:32 +08:00
parent 7b8de896e2
commit e41a4d5582
@@ -387,9 +387,13 @@ public class proposalExportNotCaseController {
InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream("docTemplate/proposal/proposalSH.docx");
String docxName = info.getString("proposalCode") + "-" + info.getString("proposalName") + ".docx";
Path docFile = Files.createFile(proposalSHPath.resolve(docxName));
String docxBaseName = (info.getString("proposalCode") + "-" + info.getString("proposalName"))
.replaceAll("[/\\\\:*?\"<>|]", "_");
Path docFile = proposalSHPath.resolve(docxBaseName + ".docx");
if (Files.exists(docFile)) {
docFile = proposalSHPath.resolve(docxBaseName + "-" + info.getString("id") + ".docx");
}
Files.createFile(docFile);
XWPFTemplate.compile(inputStream, config).render(info).writeToFile(docFile.toString());
}