解决HTTP400、参数配置错误问题-龚宇杰
This commit is contained in:
parent
dec83ac3db
commit
c2387a2793
|
@ -33,8 +33,10 @@ import java.awt.image.BufferedImage;
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.net.URLEncoder;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -146,7 +148,11 @@ public class TripReimbursePrintPlugin extends AbstractPrintPlugin implements Plu
|
||||||
try {
|
try {
|
||||||
FileService fs = FileServiceFactory.getAttachmentFileService();
|
FileService fs = FileServiceFactory.getAttachmentFileService();
|
||||||
FilePathService fps = new FilePathService();
|
FilePathService fps = new FilePathService();
|
||||||
|
|
||||||
String realPath = fps.getRealPath(url);
|
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 fileserver = System.getProperty("fileserver");
|
||||||
String abUrl = fileserver + realPath;
|
String abUrl = fileserver + realPath;
|
||||||
String abEncreptUrl = AttachmentServiceHelper.getEncreptURL(abUrl);
|
String abEncreptUrl = AttachmentServiceHelper.getEncreptURL(abUrl);
|
||||||
|
@ -219,7 +225,11 @@ public class TripReimbursePrintPlugin extends AbstractPrintPlugin implements Plu
|
||||||
ArrayList<String> resUrls = new ArrayList<>();
|
ArrayList<String> resUrls = new ArrayList<>();
|
||||||
FileService fs = FileServiceFactory.getAttachmentFileService();
|
FileService fs = FileServiceFactory.getAttachmentFileService();
|
||||||
FilePathService fps = new FilePathService();
|
FilePathService fps = new FilePathService();
|
||||||
|
|
||||||
String realPath = fps.getRealPath(url);
|
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 fileserver = System.getProperty("fileserver");
|
||||||
String abUrl = fileserver + realPath;
|
String abUrl = fileserver + realPath;
|
||||||
String abEncreptUrl = AttachmentServiceHelper.getEncreptURL(abUrl);
|
String abEncreptUrl = AttachmentServiceHelper.getEncreptURL(abUrl);
|
||||||
|
@ -273,8 +283,16 @@ public class TripReimbursePrintPlugin extends AbstractPrintPlugin implements Plu
|
||||||
private ArrayList<String> handlePicAttUrl(String url) {
|
private ArrayList<String> handlePicAttUrl(String url) {
|
||||||
ArrayList<String> urls = new ArrayList<>();
|
ArrayList<String> urls = new ArrayList<>();
|
||||||
FilePathService fps = new FilePathService();
|
FilePathService fps = new FilePathService();
|
||||||
|
|
||||||
String realPath = fps.getRealPath(url);
|
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 abUrl = fileserver + realPath;
|
||||||
String abEncreptUrl = AttachmentServiceHelper.getEncreptURL(abUrl);
|
String abEncreptUrl = AttachmentServiceHelper.getEncreptURL(abUrl);
|
||||||
abEncreptUrl = abEncreptUrl.replaceAll("\\s", "%20").replaceAll("'", "%27");
|
abEncreptUrl = abEncreptUrl.replaceAll("\\s", "%20").replaceAll("'", "%27");
|
||||||
|
|
Loading…
Reference in New Issue