Commit c1326335 by 吕明尚

Merge branch 'refs/heads/dev' into test

parents 8d921035 1bb9f6eb
...@@ -13,6 +13,7 @@ import share.system.mapper.ConsumerWalletMapper; ...@@ -13,6 +13,7 @@ import share.system.mapper.ConsumerWalletMapper;
import share.system.service.*; import share.system.service.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -157,7 +158,9 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper, ...@@ -157,7 +158,9 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
consumerWallet.setBalance(balance); consumerWallet.setBalance(balance);
BigDecimal duration = consumerWallet.getRemainingDuration().add(rechargeConf.getGiveDuration()); BigDecimal duration = consumerWallet.getRemainingDuration().add(rechargeConf.getGiveDuration());
consumerWallet.setRemainingDuration(duration); consumerWallet.setRemainingDuration(duration);
BigDecimal Integral = consumerWallet.getRemainingIntegral().add(rechargeConf.getGiveRatio().multiply(recharge.getRechargeAmount())); BigDecimal divide = recharge.getRechargeAmount().multiply(rechargeConf.getGiveRatio()).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP);
BigDecimal Integral = consumerWallet.getRemainingIntegral().add(divide);
consumerWallet.setRemainingIntegral(Integral); consumerWallet.setRemainingIntegral(Integral);
int i = updateConsumerWallet(consumerWallet); int i = updateConsumerWallet(consumerWallet);
BalanceLog balanceLog = new BalanceLog(); BalanceLog balanceLog = new BalanceLog();
...@@ -179,7 +182,7 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper, ...@@ -179,7 +182,7 @@ public class ConsumerWalletServiceImpl extends ServiceImpl<ConsumerWalletMapper,
IntegralLog integralLog = new IntegralLog(); IntegralLog integralLog = new IntegralLog();
integralLog.setConsumerId(consumerWallet.getConsumerId()); integralLog.setConsumerId(consumerWallet.getConsumerId());
integralLog.setCurrentIntegral(consumerWallet.getRemainingIntegral()); integralLog.setCurrentIntegral(consumerWallet.getRemainingIntegral());
integralLog.setVariableIntegral(rechargeConf.getGiveRatio().multiply(recharge.getRechargeAmount())); integralLog.setVariableIntegral(divide);
integralLog.setOperationTime(new Date()); integralLog.setOperationTime(new Date());
integralLog.setOperationType(YesNoEnum.yes.getIndex()); integralLog.setOperationType(YesNoEnum.yes.getIndex());
integralLog.setCreateTime(new Date()); integralLog.setCreateTime(new Date());
......
...@@ -22,6 +22,7 @@ import share.system.response.RechargePayResultResponse; ...@@ -22,6 +22,7 @@ import share.system.response.RechargePayResultResponse;
import share.system.service.*; import share.system.service.*;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -182,7 +183,7 @@ public class RechargeServiceImpl extends ServiceImpl<RechargeMapper, Recharge> i ...@@ -182,7 +183,7 @@ public class RechargeServiceImpl extends ServiceImpl<RechargeMapper, Recharge> i
BigDecimal balance = recharge.getRechargeAmount().add(rechargeConf.getGiveAmount()); BigDecimal balance = recharge.getRechargeAmount().add(rechargeConf.getGiveAmount());
consumerWallet.setBalance(balance); consumerWallet.setBalance(balance);
consumerWallet.setRemainingDuration(rechargeConf.getGiveDuration()); consumerWallet.setRemainingDuration(rechargeConf.getGiveDuration());
BigDecimal Integral = recharge.getRechargeAmount().multiply(rechargeConf.getGiveRatio()); BigDecimal Integral = recharge.getRechargeAmount().multiply(rechargeConf.getGiveRatio()).divide(new BigDecimal(100), 2, RoundingMode.HALF_UP);
consumerWallet.setRemainingIntegral(Integral); consumerWallet.setRemainingIntegral(Integral);
consumerWallet.setCreateTime(new Date()); consumerWallet.setCreateTime(new Date());
consumerWalletService.addConsumerWallet(consumerWallet); consumerWalletService.addConsumerWallet(consumerWallet);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment