From 20201b7c7b28d5342be4a0e0b1e8641b2490c78b Mon Sep 17 00:00:00 2001
From: KKSU <15274802129@163.com>
Date: Mon, 13 Jan 2025 22:34:13 +0800
Subject: [PATCH] fix(mall): 修复获取积分日榜和月榜时的潜在空指针异常
---
src/main/java/cc/mrbird/febs/mall/service/impl/RunVipServiceImpl.java | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/src/main/java/cc/mrbird/febs/mall/service/impl/RunVipServiceImpl.java b/src/main/java/cc/mrbird/febs/mall/service/impl/RunVipServiceImpl.java
index d55972e..d46432f 100644
--- a/src/main/java/cc/mrbird/febs/mall/service/impl/RunVipServiceImpl.java
+++ b/src/main/java/cc/mrbird/febs/mall/service/impl/RunVipServiceImpl.java
@@ -104,10 +104,12 @@
.orderByDesc(RunVipGrow::getId)
).stream().findFirst().orElse(null);
if(runVipGrow != null){
- BigDecimal amountNow = runVipGrow.getAmountNow();
- reduceAmount = reduceAmount.add(amountNow);
+ reduceAmount = runVipGrow.getAmountNow();
}
presentAmount = presentAmount.subtract(reduceAmount);
+ if(BigDecimal.ZERO.compareTo(presentAmount) >= 0){
+ throw new FebsException("支付异常,请刷新页面重试");
+ }
Long addressId = apiGoChargeDto.getAddressId();
MallMemberPayment mallMemberPayment = mallMemberPaymentMapper.selectById(addressId);
@@ -201,10 +203,12 @@
.orderByDesc(RunVipGrow::getId)
).stream().findFirst().orElse(null);
if(runVipGrow != null){
- BigDecimal amountNow = runVipGrow.getAmountNow();
- reduceAmount = reduceAmount.add(amountNow);
+ reduceAmount = runVipGrow.getAmountNow();
}
presentAmount = presentAmount.subtract(reduceAmount);
+ if(BigDecimal.ZERO.compareTo(presentAmount) >= 0){
+ throw new FebsException("支付异常,请刷新页面重试");
+ }
MallMemberWallet mallMemberWallet = mallMemberWalletMapper.selectWalletByMemberId(memberId);
if(mallMemberWallet.getCommission().compareTo(BigDecimal.ZERO) <= 0){
@@ -545,7 +549,7 @@
BigDecimal presentPriceNext = runVipNext.getPresentPrice();
if(presentPriceNext.compareTo(add) <= 0){
- mallCharge.setVipCode(runVipGrow.getLevelNext());
+ mallCharge.setVipCode(runVipNext.getVipCode());
}
}
mallChargeMapper.insert(mallCharge);
--
Gitblit v1.9.1