|
|
@ -23,6 +23,7 @@ import org.springframework.web.client.RestTemplate; |
|
|
|
import org.springframework.web.util.UriComponentsBuilder; |
|
|
|
|
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.RoundingMode; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Objects; |
|
|
|
import java.util.UUID; |
|
|
@ -132,7 +133,7 @@ public class BeanRechargeServiceImpl implements BeanRechargeService { |
|
|
|
// 初始化累加器 |
|
|
|
int permanentGoldSum = 0; |
|
|
|
int freeGoldSum = 0; |
|
|
|
Double moneySum = 0.0; |
|
|
|
BigDecimal moneySum = new BigDecimal("0.0"); |
|
|
|
|
|
|
|
// 遍历充值记录并累加金币 |
|
|
|
for (BeanSystemRechargeInfo info : beanSystemRechargeInfos) { |
|
|
@ -144,16 +145,12 @@ public class BeanRechargeServiceImpl implements BeanRechargeService { |
|
|
|
if (info.getFreeBean() != null) { |
|
|
|
freeGoldSum += info.getFreeBean(); |
|
|
|
} |
|
|
|
// 累加金额 |
|
|
|
if (info.getMoney() != null) { |
|
|
|
moneySum += info.getMoney(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
moneySum = new BigDecimal(permanentGoldSum).divide(new BigDecimal("50"), 2, RoundingMode.HALF_UP); |
|
|
|
// 将累加结果设置到Gold对象 |
|
|
|
gold.setPermanentBean(permanentGoldSum); |
|
|
|
gold.setFreeBean(freeGoldSum); |
|
|
|
gold.setMoney(moneySum); |
|
|
|
gold.setMoney(moneySum.doubleValue()); |
|
|
|
gold.setBeanNum(permanentGoldSum+freeGoldSum); |
|
|
|
return gold; |
|
|
|
} |
|
|
|