From 91f6f7f37efd867528619e2f0bf4afaf7bd52009 Mon Sep 17 00:00:00 2001
From: KKSU <15274802129@163.com>
Date: Fri, 03 Jan 2025 23:19:07 +0800
Subject: [PATCH] refactor(mall): 修改 API 商城用户统计图表数据数量限制逻辑

---
 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 9d1de84..ea2a489 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){
@@ -693,7 +697,7 @@
         ).stream().findFirst().orElse(null);
         if(runVipGrow != null){
             BigDecimal amountNow = runVipGrow.getAmountNow();
-            reduceAmount = reduceAmount.add(amountNow);
+            reduceAmount = amountNow;
         }
         apiReduceAmountVo.setReduceAmount(reduceAmount);
         return new FebsResponse().success().data(apiReduceAmountVo);

--
Gitblit v1.9.1