解决HTTP400、参数配置错误问题-龚宇杰

This commit is contained in:
ggxl 2025-05-20 15:33:22 +08:00
parent dec83ac3db
commit c2387a2793
1 changed files with 19 additions and 1 deletions

View File

@ -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<String> 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<String> handlePicAttUrl(String url) {
ArrayList<String> 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");