fix
This commit is contained in:
@@ -49,7 +49,6 @@ public class PlayCustomUserInfoServiceImpl extends ServiceImpl<PlayCustomUserInf
|
||||
private IPlayBalanceDetailsInfoService playBalanceDetailsInfoService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public PlayCustomUserInfoEntity selectByOpenid(String openId) {
|
||||
LambdaQueryWrapper<PlayCustomUserInfoEntity> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
@@ -84,11 +83,37 @@ public class PlayCustomUserInfoServiceImpl extends ServiceImpl<PlayCustomUserInf
|
||||
public void customAccountBalanceRecharge(BigDecimal rechargeAmount, String customId, String orderId) {
|
||||
PlayCustomUserInfoEntity userInfo = this.selectById(customId);
|
||||
//查询充值赠送金额(暂是设置为0)
|
||||
BigDecimal giftAmount = BigDecimal.ZERO;
|
||||
// 此处我想实现:超过50送5,超过100送10,200送20,300送30,400送40,500送50
|
||||
BigDecimal giftAmount = calculateGiftMoney(rechargeAmount);
|
||||
//修改用户账户余额
|
||||
this.updateAccountBalanceById(customId, userInfo.getAccountBalance(), userInfo.getAccountBalance().add(rechargeAmount).add(giftAmount), "0", "重置", rechargeAmount.add(giftAmount), giftAmount, orderId);
|
||||
this.updateAccountBalanceById(customId, userInfo.getAccountBalance(), userInfo.getAccountBalance().add(rechargeAmount).add(giftAmount), "0", "充值", rechargeAmount.add(giftAmount), giftAmount, orderId);
|
||||
}
|
||||
|
||||
private static BigDecimal calculateGiftMoney(BigDecimal rechargeAmount) {
|
||||
//此处我想实现:超过50送5,超过100送10,200送20,300送30,400送40,500送50
|
||||
BigDecimal giftAmount = BigDecimal.ZERO;
|
||||
if (rechargeAmount.compareTo(new BigDecimal(50)) >= 0) {
|
||||
giftAmount = new BigDecimal(5);
|
||||
}
|
||||
if (rechargeAmount.compareTo(new BigDecimal(100)) >= 0) {
|
||||
giftAmount = new BigDecimal(10);
|
||||
}
|
||||
if (rechargeAmount.compareTo(new BigDecimal(200)) >= 0) {
|
||||
giftAmount = new BigDecimal(20);
|
||||
}
|
||||
if (rechargeAmount.compareTo(new BigDecimal(300)) >= 0) {
|
||||
giftAmount = new BigDecimal(30);
|
||||
}
|
||||
if (rechargeAmount.compareTo(new BigDecimal(400)) >= 0) {
|
||||
giftAmount = new BigDecimal(40);
|
||||
}
|
||||
if (rechargeAmount.compareTo(new BigDecimal(500)) >= 0) {
|
||||
giftAmount = new BigDecimal(50);
|
||||
}
|
||||
return giftAmount;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询顾客
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user