From e63f08bb358dd2d53a1bece9fb7654ff196c113b Mon Sep 17 00:00:00 2001
From: KKSU <15274802129@163.com>
Date: Thu, 09 Jan 2025 18:03:58 +0800
Subject: [PATCH] refactor(mall): 优化 BigDecimal 的舍入方式
---
src/main/java/cc/mrbird/febs/mall/service/impl/AsyncServiceImpl.java | 18 +++++++-----------
1 files changed, 7 insertions(+), 11 deletions(-)
diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/AsyncServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/AsyncServiceImpl.java
index c3585fd..9063f79 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/AsyncServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/AsyncServiceImpl.java
@@ -43,26 +43,22 @@
}
@Override
- public void releaseNodeCoin(BigDecimal amount, BigDecimal percent, BigDecimal balanceToCoin, Long memberId) {
+ public void releaseNodeCoin(BigDecimal amount, BigDecimal percent, Long memberId) {
//实际节点助力的碳币
- BigDecimal multiply = amount.multiply(percent);
+ BigDecimal multiply = amount.multiply(percent).setScale(2,RoundingMode.DOWN);
if(BigDecimal.ZERO.compareTo(multiply) >=0){
return;
}
- BigDecimal divide = multiply.divide(balanceToCoin, 2, RoundingMode.DOWN);
- if(BigDecimal.ZERO.compareTo(divide) >=0){
- return;
- }
- walletService.addBalance(divide,memberId);
+ walletService.addCommission(multiply,memberId);
String orderNo = MallUtils.getOrderNum("JD");
mallMoneyFlowService.runVipMoneyFlowAdd(
memberId,
memberId,
orderNo,
- FlowTypeEnum.BALANCE.getValue(),
- RunVipMoneyFlowTypeEnum.NODE_BALANCE.getValue(),
- divide,
- StrUtil.format(RunVipMoneyFlowTypeEnum.NODE_BALANCE.getDescription(),divide),
+ FlowTypeEnum.COMMISSION.getValue(),
+ RunVipMoneyFlowTypeEnum.NODE_COMMISSION.getValue(),
+ multiply,
+ StrUtil.format(RunVipMoneyFlowTypeEnum.NODE_COMMISSION.getDescription(),multiply),
YesOrNoEnum.YES.getValue()
);
--
Gitblit v1.9.1