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