diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuBaseVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuBaseVO.java index 8ab8376c8..7f2c22c95 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuBaseVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuBaseVO.java @@ -97,7 +97,7 @@ public class ProductSpuBaseVO { private Integer giveIntegral; @Schema(description = "赠送的优惠劵数组包含优惠券编号和名称") - private List giveCouponTemplate; + private List giveCouponTemplates; @Schema(description = "分销类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") @NotNull(message = "商品分销类型不能为空") diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/ProductSpuConvert.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/ProductSpuConvert.java index b4083b854..0b83abe42 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/ProductSpuConvert.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/ProductSpuConvert.java @@ -107,7 +107,7 @@ public interface ProductSpuConvert { List couponTemplateList) { ProductSpuDetailRespVO respVO = convert03(spu); respVO.setSkus(ProductSkuConvert.INSTANCE.convertList(skus)); - respVO.setGiveCouponTemplate(convertList04(couponTemplateList)); + respVO.setGiveCouponTemplates(convertList04(couponTemplateList)); return respVO; } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/ProductSpuDO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/ProductSpuDO.java index 9e073fee7..9ce55a096 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/ProductSpuDO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/spu/ProductSpuDO.java @@ -194,7 +194,7 @@ public class ProductSpuDO extends BaseDO { * 对应 PromotionTypeEnum 枚举 */ @TableField(typeHandler = JacksonTypeHandler.class) - private List activityOrders; + private List activityOrders; // TODO @芋艿: 活动顺序字段长度需要增加 // ========== 统计相关字段 ========= diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java index 9d371eff2..5f2fcbb04 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java @@ -56,6 +56,7 @@ public class ProductSpuServiceImpl implements ProductSpuService { private ProductCategoryService categoryService; @Resource + @Lazy private CouponTemplateApi couponTemplateApi; @Override @@ -65,7 +66,7 @@ public class ProductSpuServiceImpl implements ProductSpuService { validateCategory(createReqVO.getCategoryId()); brandService.validateProductBrand(createReqVO.getBrandId()); // 校验优惠券 - Set giveCouponTemplateIds = convertSet(createReqVO.getGiveCouponTemplate(), ProductSpuCreateReqVO.GiveCouponTemplate::getId); + Set giveCouponTemplateIds = convertSet(createReqVO.getGiveCouponTemplates(), ProductSpuCreateReqVO.GiveCouponTemplate::getId); validateCouponTemplate(giveCouponTemplateIds); // 校验 SKU List skuSaveReqList = createReqVO.getSkus(); @@ -93,7 +94,7 @@ public class ProductSpuServiceImpl implements ProductSpuService { validateCategory(updateReqVO.getCategoryId()); brandService.validateProductBrand(updateReqVO.getBrandId()); // 校验优惠券 - Set giveCouponTemplateIds = convertSet(updateReqVO.getGiveCouponTemplate(), ProductSpuUpdateReqVO.GiveCouponTemplate::getId); + Set giveCouponTemplateIds = convertSet(updateReqVO.getGiveCouponTemplates(), ProductSpuUpdateReqVO.GiveCouponTemplate::getId); validateCouponTemplate(giveCouponTemplateIds); // 校验SKU List skuSaveReqList = updateReqVO.getSkus(); diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/coupon/CouponTemplateApiImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/coupon/CouponTemplateApiImpl.java index 77d2c2cde..8c4f443f5 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/coupon/CouponTemplateApiImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/api/coupon/CouponTemplateApiImpl.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.promotion.api.coupon; +import cn.hutool.core.collection.CollUtil; import cn.iocoder.yudao.module.promotion.api.coupon.dto.CouponTemplateRespDTO; import cn.iocoder.yudao.module.promotion.convert.coupon.CouponTemplateConvert; import cn.iocoder.yudao.module.promotion.service.coupon.CouponTemplateService; @@ -7,6 +8,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.Collection; +import java.util.Collections; import java.util.List; /** @@ -22,6 +24,9 @@ public class CouponTemplateApiImpl implements CouponTemplateApi { @Override public List getCouponTemplateListByIds(Collection ids) { + if (CollUtil.isEmpty(ids)) { // 防御一下 + return Collections.emptyList(); + } return CouponTemplateConvert.INSTANCE.convertList(couponTemplateService.getCouponTemplateListByIds(ids)); }