From 495c3565a6816decff38d85c61a9d46ca3dddad7 Mon Sep 17 00:00:00 2001 From: KKSU <15274802129@163.com> Date: Mon, 06 Jan 2025 14:26:03 +0800 Subject: [PATCH] refactor(mall): 修改 API接口文档和枚举类型描述 --- src/main/java/cc/mrbird/febs/mall/service/impl/RunVipServiceImpl.java | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 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..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); @@ -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