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; }); }