fix: 课程导出问题修正

修正文件名错误的问题
This commit is contained in:
liu.zixi
2025-11-24 13:45:35 +08:00
parent eafac59c8f
commit c5bcf8fa57

View File

@@ -30,6 +30,7 @@ import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.util.*;
@@ -283,6 +284,9 @@ public class CoursePageServiceImpl implements ICoursePageService {
// output
try (OutputStream out = response.getOutputStream()) {
response.setContentType("application/octet-stream");
String fileName = "课程列表.xlsx";
response.setHeader("Content-disposition", "attachment;filename=" + new String(fileName.getBytes(StandardCharsets.UTF_8), StandardCharsets.ISO_8859_1));
ExportsExcelSenderUtil.exportDynamic(exportMap, dataList, out, null);
} catch (Exception e) {
throw new AppException("导出课程列表发生异常", e);