mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-09 08:57:17 +08:00
refactor: 优化部分代码
移除所有 toString(),修复 Sonar、Codacy 扫描问题
This commit is contained in:
@@ -19,7 +19,7 @@ package top.charles7c.continew.starter.file.excel.util;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.URLUtil;
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.alibaba.excel.EasyExcelFactory;
|
||||
import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import org.slf4j.Logger;
|
||||
@@ -74,7 +74,7 @@ public class ExcelUtils {
|
||||
.format(new Date(), DatePattern.PURE_DATETIME_PATTERN)));
|
||||
response.setHeader("Content-disposition", "attachment;filename=" + exportFileName);
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
|
||||
EasyExcel.write(response.getOutputStream(), clazz)
|
||||
EasyExcelFactory.write(response.getOutputStream(), clazz)
|
||||
.autoCloseStream(false)
|
||||
// 自动适配宽度
|
||||
.registerWriteHandler(new LongestMatchColumnWidthStyleStrategy())
|
||||
|
Reference in New Issue
Block a user