From e41a4d558298fc72855465ab9a0e6a7ca2fe7eec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=9C=E5=AD=A6=E6=88=90?= <1274337408@qq.com> Date: Fri, 16 Oct 2026 16:42:32 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E6=A1=88=E5=AF=BC=E5=87=BA=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=EF=BC=9A=E5=AF=BC=E5=87=BA=E4=B8=8A=E4=BC=9A=E6=8F=90?= =?UTF-8?q?=E6=A1=88=E8=A1=A8=E6=B1=87=E6=80=BB=E8=A1=A8=E6=97=B6=E6=9B=BF?= =?UTF-8?q?=E6=8D=A2=E7=89=B9=E6=AE=8A=E5=AD=97=E7=AC=A6=EF=BC=88=E9=81=BF?= =?UTF-8?q?=E5=85=8D=E5=9B=A0=E4=B8=BA/=E6=8B=BC=E6=8E=A5path=E5=BC=82?= =?UTF-8?q?=E5=B8=B8=EF=BC=89=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../export/proposalExportNotCaseController.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/io/v/nutz/proposal/controller/export/proposalExportNotCaseController.java b/src/main/java/io/v/nutz/proposal/controller/export/proposalExportNotCaseController.java index ef931c9..880af6c 100644 --- a/src/main/java/io/v/nutz/proposal/controller/export/proposalExportNotCaseController.java +++ b/src/main/java/io/v/nutz/proposal/controller/export/proposalExportNotCaseController.java @@ -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()); }