优化Excel统计行数值的单元格样式显示

springboot3
RuoYi 2025-06-19 14:45:38 +08:00
parent 45cc53652b
commit 768c13569a
3 changed files with 3 additions and 8 deletions

View File

@ -158,11 +158,11 @@ public class SysProfileController extends BaseController
@ResponseBody
public AjaxResult updateAvatar(@RequestParam("avatarfile") MultipartFile file)
{
SysUser currentUser = getSysUser();
try
{
if (!file.isEmpty())
{
SysUser currentUser = getSysUser();
String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION, true);
if (userService.updateUserAvatar(currentUser.getUserId(), avatar))
{

View File

@ -221,7 +221,6 @@ public class FileUploadUtils
throw new InvalidExtensionException(allowedExtension, extension, fileName);
}
}
}
/**

View File

@ -186,11 +186,6 @@ public class ExcelUtil<T>
*/
private Map<Integer, Double> statistics = new HashMap<Integer, Double>();
/**
*
*/
private static final DecimalFormat DOUBLE_FORMAT = new DecimalFormat("######0.00");
/**
*
*/
@ -861,6 +856,7 @@ public class ExcelUtil<T>
style = wb.createCellStyle();
style.setAlignment(HorizontalAlignment.CENTER);
style.setVerticalAlignment(VerticalAlignment.CENTER);
style.setDataFormat(dataFormat.getFormat("######0.00"));
Font totalFont = wb.createFont();
totalFont.setFontName("Arial");
totalFont.setFontHeightInPoints((short) 10);
@ -1443,7 +1439,7 @@ public class ExcelUtil<T>
{
cell = row.createCell(key);
cell.setCellStyle(styles.get("total"));
cell.setCellValue(DOUBLE_FORMAT.format(statistics.get(key)));
cell.setCellValue(statistics.get(key));
}
statistics.clear();
}