升级 easytrans 2.2.7

This commit is contained in:
阿沐 2023-09-18 14:37:13 +08:00
parent e6a4c49103
commit f7a59f1b5f
2 changed files with 7 additions and 7 deletions

View File

@ -105,7 +105,7 @@ public class ExcelUtils {
* @param data 数据
*/
public static <T> void excelExport(Class<T> head, File file, List<T> data) {
excelExport(head, file, "sheet1", data);
excelExport(head, file, "sheet1" , data);
}
/**
@ -137,11 +137,11 @@ public class ExcelUtils {
public static <T> void excelExport(Class<T> head, String excelName, String sheetName, List<T> data) {
try {
HttpServletResponse response = HttpContextUtils.getHttpServletResponse();
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
response.setCharacterEncoding("utf-8");
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" );
response.setCharacterEncoding("utf-8" );
// 这里URLEncoder.encode可以防止中文乱码 当然和easy excel没有关系
String fileName = URLUtil.encode(excelName).replaceAll("\\+", "%20");
response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
String fileName = URLUtil.encode(excelName).replaceAll("\\+" , "%20" );
response.setHeader("Content-disposition" , "attachment;filename*=utf-8''" + fileName + ".xlsx" );
EasyExcel.write(response.getOutputStream(), head).sheet(StringUtils.isBlank(sheetName) ? "sheet1" : sheetName).doWrite(data);
} catch (IOException e) {
throw new RuntimeException(e);
@ -174,7 +174,7 @@ public class ExcelUtils {
Field ref = ReflectUtils.getDeclaredField(clazz, trans.ref());
ref.setAccessible(true);
// 获取字典反向值
String value = dictionaryTransService.getUnTransMap().get(trans.key() + "_" + ref.get(data));
String value = dictionaryTransService.getDictionaryTransMap().get(trans.key() + "_" + ref.get(data));
if (StringUtils.isBlank(value)) {
continue;
}

View File

@ -48,7 +48,7 @@
<huaweicloud.obs.version>3.22.3</huaweicloud.obs.version>
<easyexcel.version>3.2.1</easyexcel.version>
<okio.version>3.3.0</okio.version>
<easytrans.version>2.1.11</easytrans.version>
<easytrans.version>2.2.7</easytrans.version>
<transmittable.thread.local.version>2.14.2</transmittable.thread.local.version>
</properties>