3 Commits

Author SHA1 Message Date
RuoYi
8c122a9609 升级fastjson到最新版2.0.61 2026-03-09 17:41:30 +08:00
RuoYi
de1dbe61a5 update userid default value 2026-03-09 17:38:37 +08:00
RuoYi
156471d638 优化Excel自定义格式样式重复创建问题 2026-03-09 15:12:11 +08:00
3 changed files with 14 additions and 2 deletions

View File

@@ -28,7 +28,7 @@
<dynamic-ds.version>4.3.1</dynamic-ds.version>
<commons.io.version>2.21.0</commons.io.version>
<velocity.version>2.3</velocity.version>
<fastjson.version>2.0.60</fastjson.version>
<fastjson.version>2.0.61</fastjson.version>
<jjwt.version>0.9.1</jjwt.version>
<minio.version>8.2.2</minio.version>
<poi.version>4.1.2</poi.version>

View File

@@ -53,7 +53,7 @@ public class SecurityContextHolder
public static Long getUserId()
{
return Convert.toLong(get(SecurityConstants.DETAILS_USER_ID), 0L);
return Convert.toLong(get(SecurityConstants.DETAILS_USER_ID), null);
}
public static void setUserId(String account)

View File

@@ -79,6 +79,11 @@ public class ExcelUtil<T>
public static final String[] FORMULA_STR = { "=", "-", "+", "@" };
/**
* 单元格样式缓存
*/
private Map<String, CellStyle> cellStyleCache = new HashMap<String, CellStyle>();
/**
* Excel sheet最大行数默认65536
*/
@@ -1042,9 +1047,16 @@ public class ExcelUtil<T>
*/
private CellStyle createCellStyle(CellStyle cellStyle, String format)
{
String key = cellStyle.getIndex() + "|" + format;
CellStyle cached = cellStyleCache.get(key);
if (cached != null)
{
return cached;
}
CellStyle style = wb.createCellStyle();
style.cloneStyleFrom(cellStyle);
style.setDataFormat(wb.getCreationHelper().createDataFormat().getFormat(format));
cellStyleCache.put(key, style);
return style;
}