From 00f89350e6dcce9f8df190a484064dddc7c108a9 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 21 Sep 2024 14:30:12 +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=E5=95=86=E5=9F=8E=EF=BC=9A=E8=B0=83=E6=95=B4=E6=BB=A1?= =?UTF-8?q?=E5=87=8F=E9=80=81=E7=9A=84=E6=95=B0=E6=8D=AE=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../vo/AppTradeProductSettlementRespVO.java | 49 ++++++++++++++----- .../service/price/TradePriceServiceImpl.java | 8 ++- 2 files changed, 40 insertions(+), 17 deletions(-) diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeProductSettlementRespVO.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeProductSettlementRespVO.java index c5bd455ea..f61b432fe 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeProductSettlementRespVO.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/vo/AppTradeProductSettlementRespVO.java @@ -6,6 +6,7 @@ import lombok.Data; import java.io.Serializable; import java.time.LocalDateTime; import java.util.List; +import java.util.Map; @Schema(description = "用户 App - 商品结算信息 Response VO") @Data @@ -20,18 +21,6 @@ public class AppTradeProductSettlementRespVO { @Schema(description = "满减送活动信息", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") private RewardActivity rewardActivity; - @Schema(description = "满减送活动信息") - @Data - public static class RewardActivity { - - @Schema(description = "满减活动编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") - private Long id; - - @Schema(description = "优惠规则描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "满 0.5 元减 0.3") - private List ruleDescriptions; - - } - @Schema(description = "SKU 价格信息") @Data public static class Sku implements Serializable { @@ -53,4 +42,40 @@ public class AppTradeProductSettlementRespVO { } + @Schema(description = "满减送活动信息") + @Data + public static class RewardActivity { + + @Schema(description = "满减活动编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Long id; + + @Schema(description = "条件类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + private Integer conditionType; + + @Schema(description = "优惠规则的数组", requiredMode = Schema.RequiredMode.REQUIRED) + private List rules; + + } + + @Schema(description = "优惠规则") + @Data + public static class RewardActivityRule { + + @Schema(description = "优惠门槛", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") // 1. 满 N 元,单位:分; 2. 满 N 件 + private Integer limit; + + @Schema(description = "优惠价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") + private Integer discountPrice; + + @Schema(description = "是否包邮", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") + private Boolean freeDelivery; + + @Schema(description = "赠送的积分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") + private Integer point; + + @Schema(description = "赠送的优惠劵编号的数组") + private Map giveCouponTemplateCounts; + + } + } diff --git a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/TradePriceServiceImpl.java b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/TradePriceServiceImpl.java index 35225db32..fcf095055 100644 --- a/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/TradePriceServiceImpl.java +++ b/yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/price/TradePriceServiceImpl.java @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.trade.service.price; import cn.hutool.core.collection.CollUtil; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; import cn.iocoder.yudao.module.member.api.level.dto.MemberLevelRespDTO; import cn.iocoder.yudao.module.product.api.sku.ProductSkuApi; import cn.iocoder.yudao.module.product.api.sku.dto.ProductSkuRespDTO; @@ -145,11 +146,8 @@ public class TradePriceServiceImpl implements TradePriceService { spuVO.setSkus(skuVOList); // 2.2 满减送活动 RewardActivityMatchRespDTO rewardActivity = CollUtil.findOne(rewardActivityMap, - activity -> CollUtil.contains(activity.getProductScopeValues(), spuId)); - if (rewardActivity != null) { - spuVO.setRewardActivity(new AppTradeProductSettlementRespVO.RewardActivity().setId(rewardActivity.getId()) - .setRuleDescriptions(convertList(rewardActivity.getRules(), RewardActivityMatchRespDTO.Rule::getDescription))); - } + activity -> CollUtil.contains(activity.getSpuIds(), spuId)); + spuVO.setRewardActivity(BeanUtils.toBean(rewardActivity, AppTradeProductSettlementRespVO.RewardActivity.class)); return spuVO; }); }