This commit is contained in:
RB 2024-11-04 09:55:20 +08:00
parent 5e31f49175
commit 79f4828db5

View file

@ -381,8 +381,8 @@ public class EasyExcelGenerator extends SetUser {
// Keep Type // Keep Type
} else if (dt == DisplayType.DECIMAL) { } else if (dt == DisplayType.DECIMAL) {
String format = easyField.getExtraAttr(EasyFieldConfigProps.DECIMAL_FORMAT); String format = easyField.getExtraAttr(EasyFieldConfigProps.DECIMAL_FORMAT);
int scale = format.split("\\.").length == 1 ? 0 int scale = StringUtils.isBlank(format) ? 2 :
: StringUtils.isBlank(format) ? 2 : format.split("\\.")[1].length(); format.split("\\.").length == 1 ? 0 : format.split("\\.")[1].length();
// Keep Type // Keep Type
fieldValue = ((BigDecimal) fieldValue).setScale(scale, RoundingMode.HALF_UP); fieldValue = ((BigDecimal) fieldValue).setScale(scale, RoundingMode.HALF_UP);
} else { } else {