diff --git a/CHANGELOG.md b/CHANGELOG.md index 11b94bc5e..c53ed0299 100755 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ * 【extra 】 修复Ftp中路径问题(issue#I5R2DE@Gitee) * 【core 】 修复ConcurrentHashMap.computeIfAbsent缺陷导致的问题 * 【core 】 修复DateUtil.parseUTC时对-的处理问题(issue#2612@Github) +* 【core 】 修复Convert.chineseMoneyToNumber角分丢失问题(issue#2611@Github) ------------------------------------------------------------------------------------------------------------- diff --git a/hutool-core/src/main/java/cn/hutool/core/convert/NumberChineseFormatter.java b/hutool-core/src/main/java/cn/hutool/core/convert/NumberChineseFormatter.java index ebf0be822..71fd6fa1d 100644 --- a/hutool-core/src/main/java/cn/hutool/core/convert/NumberChineseFormatter.java +++ b/hutool-core/src/main/java/cn/hutool/core/convert/NumberChineseFormatter.java @@ -237,7 +237,6 @@ public class NumberChineseFormatter { /** * 中文大写数字金额转换为数字,返回结果以元为单位的BigDecimal类型数字 - * * 如: * “陆万柒仟伍佰伍拾陆元叁角贰分”返回“67556.32” * “叁角贰分”返回“0.32” @@ -310,8 +309,8 @@ public class NumberChineseFormatter { } BigDecimal amount = new BigDecimal(y); - amount = amount.add(BigDecimal.valueOf(j).divide(BigDecimal.TEN, RoundingMode.HALF_UP)); - amount = amount.add(BigDecimal.valueOf(f).divide(BigDecimal.valueOf(100), RoundingMode.HALF_UP)); + amount = amount.add(BigDecimal.valueOf(j).divide(BigDecimal.TEN, 2, RoundingMode.HALF_UP)); + amount = amount.add(BigDecimal.valueOf(f).divide(BigDecimal.valueOf(100), 2, RoundingMode.HALF_UP)); return amount; } @@ -440,7 +439,6 @@ public class NumberChineseFormatter { /** * 把中文转换为数字 如 二百二十 220
- * 见:https://www.d5.nz/read/sfdlq/text-part0000_split_030.html *