fix:【数据导出中心】解决文件名乱码问题

This commit is contained in:
taojinlong 2024-10-24 16:52:00 +08:00
parent 05aff99272
commit a965640597
2 changed files with 5 additions and 2 deletions

View File

@ -66,6 +66,8 @@ import org.springframework.transaction.annotation.Transactional;
import java.io.*; import java.io.*;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.text.DecimalFormat; import java.text.DecimalFormat;
import java.util.*; import java.util.*;
import java.util.concurrent.Future; import java.util.concurrent.Future;
@ -170,7 +172,8 @@ public class ExportCenterManage implements BaseExportApi {
CoreExportTask exportTask = exportTaskMapper.selectById(id); CoreExportTask exportTask = exportTaskMapper.selectById(id);
OutputStream outputStream = response.getOutputStream(); OutputStream outputStream = response.getOutputStream();
response.setContentType("application/vnd.ms-excel"); response.setContentType("application/vnd.ms-excel");
response.setHeader("Content-disposition", "attachment;filename=" + exportTask.getFileName());
response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode(exportTask.getFileName(), StandardCharsets.UTF_8));
InputStream fileInputStream = new FileInputStream(exportData_path + id + "/" + exportTask.getFileName()); InputStream fileInputStream = new FileInputStream(exportData_path + id + "/" + exportTask.getFileName());
byte[] buffer = new byte[4096]; byte[] buffer = new byte[4096];
int bytesRead; int bytesRead;

View File

@ -263,7 +263,7 @@ const timestampFormatDate = value => {
} }
import { PATH_URL } from '@/config/axios/service' import { PATH_URL } from '@/config/axios/service'
const downloadClick = item => { const downloadClick = item => {
window.open(PATH_URL + '/exportCenter/download/' + item.id, 'aaa.xls') window.open(PATH_URL + '/exportCenter/download/' + item.id)
} }
const retry = item => { const retry = item => {