From c2387a2793513dba24d82d211524d0a9054a6086 Mon Sep 17 00:00:00 2001 From: ggxl <194689125@qq.com> Date: Tue, 20 May 2025 15:33:22 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3HTTP400=E3=80=81=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E9=85=8D=E7=BD=AE=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= =?UTF-8?q?-=E9=BE=9A=E5=AE=87=E6=9D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../print/TripReimbursePrintPlugin.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/main/java/zf47/jdgz1/fi/em/plugin/print/TripReimbursePrintPlugin.java b/src/main/java/zf47/jdgz1/fi/em/plugin/print/TripReimbursePrintPlugin.java index 16e7bab..74b48b6 100644 --- a/src/main/java/zf47/jdgz1/fi/em/plugin/print/TripReimbursePrintPlugin.java +++ b/src/main/java/zf47/jdgz1/fi/em/plugin/print/TripReimbursePrintPlugin.java @@ -33,8 +33,10 @@ import java.awt.image.BufferedImage; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; +import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.URL; +import java.net.URLEncoder; import java.util.*; /** @@ -146,7 +148,11 @@ public class TripReimbursePrintPlugin extends AbstractPrintPlugin implements Plu try { FileService fs = FileServiceFactory.getAttachmentFileService(); FilePathService fps = new FilePathService(); + String realPath = fps.getRealPath(url); + String fileName = realPath.substring(realPath.lastIndexOf("/") + 1); + realPath = realPath.substring(0, realPath.lastIndexOf("/")) + "/" + URLEncoder.encode(fileName, "utf-8"); + String fileserver = System.getProperty("fileserver"); String abUrl = fileserver + realPath; String abEncreptUrl = AttachmentServiceHelper.getEncreptURL(abUrl); @@ -219,7 +225,11 @@ public class TripReimbursePrintPlugin extends AbstractPrintPlugin implements Plu ArrayList resUrls = new ArrayList<>(); FileService fs = FileServiceFactory.getAttachmentFileService(); FilePathService fps = new FilePathService(); + String realPath = fps.getRealPath(url); + String fileName = realPath.substring(realPath.lastIndexOf("/") + 1); + realPath = realPath.substring(0, realPath.lastIndexOf("/")) + "/" + URLEncoder.encode(fileName, "utf-8"); + String fileserver = System.getProperty("fileserver"); String abUrl = fileserver + realPath; String abEncreptUrl = AttachmentServiceHelper.getEncreptURL(abUrl); @@ -273,8 +283,16 @@ public class TripReimbursePrintPlugin extends AbstractPrintPlugin implements Plu private ArrayList handlePicAttUrl(String url) { ArrayList urls = new ArrayList<>(); FilePathService fps = new FilePathService(); + String realPath = fps.getRealPath(url); - String fileserver = System.getProperty("imageServer.external.url"); + try { + String fileName = realPath.substring(realPath.lastIndexOf("/") + 1); + realPath = realPath.substring(0, realPath.lastIndexOf("/")) + "/" + URLEncoder.encode(fileName, "utf-8"); + } catch (Exception e) { + log.error("TripReimbursePrintPlugin:" + e.getMessage()); + } + + String fileserver = System.getProperty("fileserver"); String abUrl = fileserver + realPath; String abEncreptUrl = AttachmentServiceHelper.getEncreptURL(abUrl); abEncreptUrl = abEncreptUrl.replaceAll("\\s", "%20").replaceAll("'", "%27");