mirror of
https://github.com/yangzongzhuan/RuoYi.git
synced 2025-10-15 18:18:28 +00:00
优化Excel统计行数值的单元格样式显示
This commit is contained in:
@@ -158,11 +158,11 @@ public class SysProfileController extends BaseController
|
|||||||
@ResponseBody
|
@ResponseBody
|
||||||
public AjaxResult updateAvatar(@RequestParam("avatarfile") MultipartFile file)
|
public AjaxResult updateAvatar(@RequestParam("avatarfile") MultipartFile file)
|
||||||
{
|
{
|
||||||
SysUser currentUser = getSysUser();
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!file.isEmpty())
|
if (!file.isEmpty())
|
||||||
{
|
{
|
||||||
|
SysUser currentUser = getSysUser();
|
||||||
String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION, true);
|
String avatar = FileUploadUtils.upload(RuoYiConfig.getAvatarPath(), file, MimeTypeUtils.IMAGE_EXTENSION, true);
|
||||||
if (userService.updateUserAvatar(currentUser.getUserId(), avatar))
|
if (userService.updateUserAvatar(currentUser.getUserId(), avatar))
|
||||||
{
|
{
|
||||||
|
@@ -221,7 +221,6 @@ public class FileUploadUtils
|
|||||||
throw new InvalidExtensionException(allowedExtension, extension, fileName);
|
throw new InvalidExtensionException(allowedExtension, extension, fileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -186,11 +186,6 @@ public class ExcelUtil<T>
|
|||||||
*/
|
*/
|
||||||
private Map<Integer, Double> statistics = new HashMap<Integer, Double>();
|
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 = wb.createCellStyle();
|
||||||
style.setAlignment(HorizontalAlignment.CENTER);
|
style.setAlignment(HorizontalAlignment.CENTER);
|
||||||
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
style.setVerticalAlignment(VerticalAlignment.CENTER);
|
||||||
|
style.setDataFormat(dataFormat.getFormat("######0.00"));
|
||||||
Font totalFont = wb.createFont();
|
Font totalFont = wb.createFont();
|
||||||
totalFont.setFontName("Arial");
|
totalFont.setFontName("Arial");
|
||||||
totalFont.setFontHeightInPoints((short) 10);
|
totalFont.setFontHeightInPoints((short) 10);
|
||||||
@@ -1443,7 +1439,7 @@ public class ExcelUtil<T>
|
|||||||
{
|
{
|
||||||
cell = row.createCell(key);
|
cell = row.createCell(key);
|
||||||
cell.setCellStyle(styles.get("total"));
|
cell.setCellStyle(styles.get("total"));
|
||||||
cell.setCellValue(DOUBLE_FORMAT.format(statistics.get(key)));
|
cell.setCellValue(statistics.get(key));
|
||||||
}
|
}
|
||||||
statistics.clear();
|
statistics.clear();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user