mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
修复Money
类的setAmount方法没有获取当前币种的小数位数而是使用的默认小数位和在遇到非2小数位的币种(如日元使用 0 位)会导致金额设置错误问题(pr#3970@Github)
This commit is contained in:
@@ -310,7 +310,7 @@ public class Money implements Serializable, Comparable<Money> {
|
||||
*/
|
||||
public void setAmount(final BigDecimal amount) {
|
||||
if (amount != null) {
|
||||
cent = rounding(amount.movePointRight(2), DEFAULT_ROUNDING_MODE);
|
||||
cent = rounding(amount.movePointRight(currency.getDefaultFractionDigits()), DEFAULT_ROUNDING_MODE);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user