Compare commits

...

3 Commits

2 changed files with 17 additions and 2 deletions

View File

@ -15,7 +15,7 @@ import com.ruoyi.common.core.utils.StringUtils;
*/ */
public class SecurityContextHolder public class SecurityContextHolder
{ {
private static final TransmittableThreadLocal<Map<String, Object>> THREAD_LOCAL = new TransmittableThreadLocal<>(); private static final TransmittableThreadLocal<Map<String, Object>> THREAD_LOCAL = TransmittableThreadLocal.withInitial(ConcurrentHashMap::new);
public static void set(String key, Object value) public static void set(String key, Object value)
{ {

View File

@ -1003,7 +1003,7 @@ public class ExcelUtil<T>
String separator = attr.separator(); String separator = attr.separator();
if (StringUtils.isNotEmpty(dateFormat) && StringUtils.isNotNull(value)) if (StringUtils.isNotEmpty(dateFormat) && StringUtils.isNotNull(value))
{ {
cell.getCellStyle().setDataFormat(this.wb.getCreationHelper().createDataFormat().getFormat(dateFormat)); cell.setCellStyle(createCellStyle(cell.getCellStyle(), dateFormat));
cell.setCellValue(parseDateToStr(dateFormat, value)); cell.setCellValue(parseDateToStr(dateFormat, value));
} }
else if (StringUtils.isNotEmpty(readConverterExp) && StringUtils.isNotNull(value)) else if (StringUtils.isNotEmpty(readConverterExp) && StringUtils.isNotNull(value))
@ -1033,6 +1033,21 @@ public class ExcelUtil<T>
return cell; return cell;
} }
/**
* 使
*
* @param cellStyle
* @param format
* @return CellStyle
*/
private CellStyle createCellStyle(CellStyle cellStyle, String format)
{
CellStyle style = wb.createCellStyle();
style.cloneStyleFrom(cellStyle);
style.setDataFormat(wb.getCreationHelper().createDataFormat().getFormat(format));
return style;
}
/** /**
* POI XSSFSheet * POI XSSFSheet
* *