From a9241cfbf41e613fe5b033ad76c44a97cb09946a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=97=B4=E8=B4=A7?= <252048765@qq.com> Date: Sat, 14 Sep 2024 19:12:35 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=8A=9F=E8=83=BD=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E3=80=91=E4=BC=98=E5=8C=96=E5=95=86=E5=93=81=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E9=A1=B5=E6=88=96=E8=80=85=E8=AF=A6=E6=83=85=E9=A1=B5=E4=BC=9A?= =?UTF-8?q?=E5=91=98=E4=BB=B7=E5=92=8C=E9=99=90=E6=97=B6=E4=BC=98=E6=83=A0?= =?UTF-8?q?=E4=BB=B7=EF=BC=8C=E9=82=A3=E4=B8=AA=E4=BE=BF=E5=AE=9C=E5=B1=95?= =?UTF-8?q?=E7=A4=BA=E9=82=A3=E4=B8=AA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/order/AppTradeOrderController.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.java index e4ae2f57d..b325c99ec 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.java @@ -100,15 +100,22 @@ public class AppTradeOrderController { skuList.forEach(sku -> { //查询限时优惠价格 AppTradeProductSettlementRespVO.Sku skuDiscount = calculateDiscountPrice(sku.getId(), sku.getPrice()); - if(skuDiscount != null){ - skus.add(skuDiscount); - } //查询会员价 AppTradeProductSettlementRespVO.Sku skuVip = calculateVipPrice(sku.getId(), sku.getPrice(), memberLevel); - if(skuVip != null){ + + if(skuDiscount != null && skuVip != null){ + if(skuDiscount.getPrice() > skuVip.getPrice()){ + skus.add(skuDiscount); + }else{ + skus.add(skuVip); + } + }else if(skuDiscount != null){ + skus.add(skuDiscount); + }else if(skuVip != null){ skus.add(skuVip); } + }); AppTradeProductSettlementRespVO.Reward reward = calculateReward(spuId); AppTradeProductSettlementRespVO respVO = AppTradeProductSettlementRespVO.builder().id(spuId).skus(skus).build();