This commit is contained in:
wangjinlei
2024-05-22 14:10:28 +08:00
parent 2280276a58
commit 689d241310
6 changed files with 31 additions and 8 deletions

View File

@@ -247,7 +247,8 @@ public class BuyOrderController {
totalPrice = totalPrice.add(getShoppingAmount(buyOrder));
//减去积分抵扣
totalPrice = totalPrice.subtract(buyOrder.getJfDeduction());
totalPrice = totalPrice.subtract(buyOrder.getJfDeduction()==null?BigDecimal.ZERO:buyOrder.getJfDeduction());
String orderSn = IdWorker.getTimeId().substring(0, 32);
buyOrder.setOrderSn(orderSn);
@@ -293,7 +294,7 @@ public class BuyOrderController {
recordTransaction(buyOrder, user, totalPrice);
}
//记录用户积分消费情况
if(buyOrder.getJfDeduction().compareTo(BigDecimal.ZERO) > 0){
if(buyOrder.getJfDeduction()!=null&&buyOrder.getJfDeduction().compareTo(BigDecimal.ZERO) > 0){
recordJfTransaction(buyOrder, user, buyOrder.getJfDeduction());
}
//消费用户积分并记录用户积分消费记录
@@ -874,6 +875,9 @@ public class BuyOrderController {
private boolean useJfCoin(MyUserEntity user,BigDecimal jf){
if(jf==null){
return true;
}
if(user.getJf().compareTo(jf)>=0){
user.setJf(user.getJf().subtract(jf));
this.myUserService.updateById(user);