mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 15:21:53 +08:00
SPU: 完善选择优惠卷
This commit is contained in:
parent
6e11154010
commit
283ca908b7
@ -97,7 +97,7 @@ public class ProductSpuBaseVO {
|
|||||||
private Integer giveIntegral;
|
private Integer giveIntegral;
|
||||||
|
|
||||||
@Schema(description = "赠送的优惠劵数组包含优惠券编号和名称")
|
@Schema(description = "赠送的优惠劵数组包含优惠券编号和名称")
|
||||||
private List<GiveCouponTemplate> giveCouponTemplate;
|
private List<GiveCouponTemplate> giveCouponTemplates;
|
||||||
|
|
||||||
@Schema(description = "分销类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
@Schema(description = "分销类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "true")
|
||||||
@NotNull(message = "商品分销类型不能为空")
|
@NotNull(message = "商品分销类型不能为空")
|
||||||
|
@ -107,7 +107,7 @@ public interface ProductSpuConvert {
|
|||||||
List<CouponTemplateRespDTO> couponTemplateList) {
|
List<CouponTemplateRespDTO> couponTemplateList) {
|
||||||
ProductSpuDetailRespVO respVO = convert03(spu);
|
ProductSpuDetailRespVO respVO = convert03(spu);
|
||||||
respVO.setSkus(ProductSkuConvert.INSTANCE.convertList(skus));
|
respVO.setSkus(ProductSkuConvert.INSTANCE.convertList(skus));
|
||||||
respVO.setGiveCouponTemplate(convertList04(couponTemplateList));
|
respVO.setGiveCouponTemplates(convertList04(couponTemplateList));
|
||||||
return respVO;
|
return respVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ public class ProductSpuDO extends BaseDO {
|
|||||||
* 对应 PromotionTypeEnum 枚举
|
* 对应 PromotionTypeEnum 枚举
|
||||||
*/
|
*/
|
||||||
@TableField(typeHandler = JacksonTypeHandler.class)
|
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||||
private List<Integer> activityOrders;
|
private List<Integer> activityOrders; // TODO @芋艿: 活动顺序字段长度需要增加
|
||||||
|
|
||||||
// ========== 统计相关字段 =========
|
// ========== 统计相关字段 =========
|
||||||
|
|
||||||
|
@ -56,6 +56,7 @@ public class ProductSpuServiceImpl implements ProductSpuService {
|
|||||||
private ProductCategoryService categoryService;
|
private ProductCategoryService categoryService;
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
|
@Lazy
|
||||||
private CouponTemplateApi couponTemplateApi;
|
private CouponTemplateApi couponTemplateApi;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -65,7 +66,7 @@ public class ProductSpuServiceImpl implements ProductSpuService {
|
|||||||
validateCategory(createReqVO.getCategoryId());
|
validateCategory(createReqVO.getCategoryId());
|
||||||
brandService.validateProductBrand(createReqVO.getBrandId());
|
brandService.validateProductBrand(createReqVO.getBrandId());
|
||||||
// 校验优惠券
|
// 校验优惠券
|
||||||
Set<Long> giveCouponTemplateIds = convertSet(createReqVO.getGiveCouponTemplate(), ProductSpuCreateReqVO.GiveCouponTemplate::getId);
|
Set<Long> giveCouponTemplateIds = convertSet(createReqVO.getGiveCouponTemplates(), ProductSpuCreateReqVO.GiveCouponTemplate::getId);
|
||||||
validateCouponTemplate(giveCouponTemplateIds);
|
validateCouponTemplate(giveCouponTemplateIds);
|
||||||
// 校验 SKU
|
// 校验 SKU
|
||||||
List<ProductSkuCreateOrUpdateReqVO> skuSaveReqList = createReqVO.getSkus();
|
List<ProductSkuCreateOrUpdateReqVO> skuSaveReqList = createReqVO.getSkus();
|
||||||
@ -93,7 +94,7 @@ public class ProductSpuServiceImpl implements ProductSpuService {
|
|||||||
validateCategory(updateReqVO.getCategoryId());
|
validateCategory(updateReqVO.getCategoryId());
|
||||||
brandService.validateProductBrand(updateReqVO.getBrandId());
|
brandService.validateProductBrand(updateReqVO.getBrandId());
|
||||||
// 校验优惠券
|
// 校验优惠券
|
||||||
Set<Long> giveCouponTemplateIds = convertSet(updateReqVO.getGiveCouponTemplate(), ProductSpuUpdateReqVO.GiveCouponTemplate::getId);
|
Set<Long> giveCouponTemplateIds = convertSet(updateReqVO.getGiveCouponTemplates(), ProductSpuUpdateReqVO.GiveCouponTemplate::getId);
|
||||||
validateCouponTemplate(giveCouponTemplateIds);
|
validateCouponTemplate(giveCouponTemplateIds);
|
||||||
// 校验SKU
|
// 校验SKU
|
||||||
List<ProductSkuCreateOrUpdateReqVO> skuSaveReqList = updateReqVO.getSkus();
|
List<ProductSkuCreateOrUpdateReqVO> skuSaveReqList = updateReqVO.getSkus();
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package cn.iocoder.yudao.module.promotion.api.coupon;
|
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.api.coupon.dto.CouponTemplateRespDTO;
|
||||||
import cn.iocoder.yudao.module.promotion.convert.coupon.CouponTemplateConvert;
|
import cn.iocoder.yudao.module.promotion.convert.coupon.CouponTemplateConvert;
|
||||||
import cn.iocoder.yudao.module.promotion.service.coupon.CouponTemplateService;
|
import cn.iocoder.yudao.module.promotion.service.coupon.CouponTemplateService;
|
||||||
@ -7,6 +8,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -22,6 +24,9 @@ public class CouponTemplateApiImpl implements CouponTemplateApi {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CouponTemplateRespDTO> getCouponTemplateListByIds(Collection<Long> ids) {
|
public List<CouponTemplateRespDTO> getCouponTemplateListByIds(Collection<Long> ids) {
|
||||||
|
if (CollUtil.isEmpty(ids)) { // 防御一下
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
return CouponTemplateConvert.INSTANCE.convertList(couponTemplateService.getCouponTemplateListByIds(ids));
|
return CouponTemplateConvert.INSTANCE.convertList(couponTemplateService.getCouponTemplateListByIds(ids));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user