fix: 修复下载excel文件路径失效

This commit is contained in:
tjlygdx
2026-05-28 00:42:14 +08:00
parent 4ba2e7f5eb
commit b11f5a1bee

View File

@@ -424,16 +424,16 @@ public class ExcelUtils {
private static Map<String, String> downLoadRemoteExcel(ExcelConfiguration remoteExcelRequest) throws DEException, FileNotFoundException {
Map<String, String> fileNames = new HashMap<>();
File p = new File(path);
if (!p.exists()) {
p.mkdirs();
}
if (remoteExcelRequest.getUrl().trim().startsWith("http")) {
HttpClientConfig httpClientConfig = new HttpClientConfig();
if (StringUtils.isNotEmpty(remoteExcelRequest.getUserName()) && StringUtils.isNotEmpty(remoteExcelRequest.getPasswd())) {
String authValue = "Basic " + Base64.getUrlEncoder().encodeToString((remoteExcelRequest.getUserName() + ":" + remoteExcelRequest.getPasswd()).getBytes());
httpClientConfig.addHeader("Authorization", authValue);
}
File p = new File(path);
if (!p.exists()) {
p.mkdirs();
}
fileNames = HttpClientUtil.downloadFile(remoteExcelRequest.getUrl(), httpClientConfig, path);
} else if (remoteExcelRequest.getUrl().trim().startsWith("ftp")) {
fileNames = downLoadFromFtp(remoteExcelRequest);