Skip to content

fix(Money): currency scaling bug(币种小数位硬编码) #3970

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 20, 2025

Conversation

asukavuuyn
Copy link

说明

  • 确认提交的PR是到'v5-dev'分支。
  • 确认没有更改代码风格(如tab缩进)
  • 针对该bug添加对应Junit测试用例

修改描述

[bug修复] Money类的setAmount方法没有获取当前币种的小数位数而是使用的默认小数位: 2,在遇到非2小数位的币种(如日元使用 0 位)会导致金额设置错误

Money yen = new Money(1000, Currency.getInstance("JPY"));
yen.setAmount(BigDecimal.ONE); // 期望 1 JPY, 实际 100 JPY

@looly looly added the bug label Jun 18, 2025
@looly
Copy link
Collaborator

looly commented Jun 18, 2025

感谢,这个稍后合并。

@looly looly merged commit 28b21d7 into chinabugotech:v5-dev Jun 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants