From fe5c5e42236c6524c0183687d2acc430aed8e7dc Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 12 Jan 2024 21:01:44 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20MALL=EF=BC=9A=E8=B0=83=E6=95=B4?= =?UTF-8?q?=E5=95=86=E5=93=81=20SPU=20=E5=AD=97=E6=AE=B5=EF=BC=8C=E7=AE=80?= =?UTF-8?q?=E5=8C=96=E9=83=A8=E5=88=86=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../product/enums/DictTypeConstants.java | 1 - .../property/ProductPropertyController.java | 28 +---------- .../ProductPropertyAndValueRespVO.java | 35 -------------- .../admin/spu/vo/ProductSpuBaseVO.java | 34 ++------------ .../admin/spu/vo/ProductSpuExcelVO.java | 22 --------- .../app/spu/vo/AppProductSpuDetailRespVO.java | 9 ---- .../app/spu/vo/AppProductSpuPageRespVO.java | 8 +--- .../property/ProductPropertyConvert.java | 24 ---------- .../convert/spu/ProductSpuConvert.java | 13 +----- .../dal/dataobject/spu/ProductSpuDO.java | 46 ++++--------------- .../dal/mysql/spu/ProductSpuMapper.java | 12 ----- .../ProductCategoryServiceImplTest.java | 4 +- .../spu/ProductSpuServiceImplTest.java | 28 ----------- .../AppBargainActivityDetailRespVO.java | 3 -- .../vo/activity/AppSeckillActivityRespVO.java | 3 +- .../bargain/BargainActivityConvert.java | 5 +- .../SeckillActivityConvert.java | 8 +--- 17 files changed, 23 insertions(+), 260 deletions(-) delete mode 100644 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyAndValueRespVO.java diff --git a/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/DictTypeConstants.java b/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/DictTypeConstants.java index 85725a18e..b96dde169 100644 --- a/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/DictTypeConstants.java +++ b/yudao-module-mall/yudao-module-product-api/src/main/java/cn/iocoder/yudao/module/product/enums/DictTypeConstants.java @@ -7,7 +7,6 @@ package cn.iocoder.yudao.module.product.enums; */ public interface DictTypeConstants { - String PRODUCT_UNIT = "product_unit"; // 商品单位 String PRODUCT_SPU_STATUS = "product_spu_status"; // 商品 SPU 状态 } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/ProductPropertyController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/ProductPropertyController.java index 1ebc2d890..c9824be24 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/ProductPropertyController.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/ProductPropertyController.java @@ -1,28 +1,22 @@ package cn.iocoder.yudao.module.product.controller.admin.property; -import cn.hutool.core.collection.CollUtil; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.*; import cn.iocoder.yudao.module.product.convert.property.ProductPropertyConvert; -import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO; -import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyValueDO; import cn.iocoder.yudao.module.product.service.property.ProductPropertyService; -import cn.iocoder.yudao.module.product.service.property.ProductPropertyValueService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.annotation.Resource; +import jakarta.validation.Valid; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; -import jakarta.annotation.Resource; -import jakarta.validation.Valid; -import java.util.Collections; import java.util.List; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; @Tag(name = "管理后台 - 商品属性项") @RestController @@ -32,8 +26,6 @@ public class ProductPropertyController { @Resource private ProductPropertyService productPropertyService; - @Resource - private ProductPropertyValueService productPropertyValueService; @PostMapping("/create") @Operation(summary = "创建属性项") @@ -81,20 +73,4 @@ public class ProductPropertyController { return success(ProductPropertyConvert.INSTANCE.convertPage(productPropertyService.getPropertyPage(pageVO))); } - @PostMapping("/get-value-list") - @Operation(summary = "获得属性项列表") - @PreAuthorize("@ss.hasPermission('product:property:query')") - public CommonResult> getPropertyAndValueList( - @Valid @RequestBody ProductPropertyListReqVO listReqVO) { - // 查询属性项 - List keys = productPropertyService.getPropertyList(listReqVO); - if (CollUtil.isEmpty(keys)) { - return success(Collections.emptyList()); - } - // 查询属性值 - List values = productPropertyValueService.getPropertyValueListByPropertyId( - convertSet(keys, ProductPropertyDO::getId)); - return success(ProductPropertyConvert.INSTANCE.convertList(keys, values)); - } - } diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyAndValueRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyAndValueRespVO.java deleted file mode 100644 index 6ef051451..000000000 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/property/ProductPropertyAndValueRespVO.java +++ /dev/null @@ -1,35 +0,0 @@ -package cn.iocoder.yudao.module.product.controller.admin.property.vo.property; - -import io.swagger.v3.oas.annotations.media.Schema; -import lombok.Data; - -import java.util.List; - -@Schema(description = "管理后台 - 商品属性项 + 属性值 Response VO") -@Data -public class ProductPropertyAndValueRespVO { - - @Schema(description = "属性项的编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") - private Long id; - - @Schema(description = "属性项的名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "颜色") - private String name; - - /** - * 属性值的集合 - */ - private List values; - - @Schema(description = "管理后台 - 属性值的简单 Response VO") - @Data - public static class Value { - - @Schema(description = "属性值的编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2048") - private Long id; - - @Schema(description = "属性值的名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "红色") - private String name; - - } - -} 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 749898e20..3917ca3ec 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 @@ -47,13 +47,6 @@ public class ProductSpuBaseVO { @Schema(description = "商品轮播图", requiredMode = Schema.RequiredMode.REQUIRED, example = "[https://www.iocoder.cn/xx.png, https://www.iocoder.cn/xxx.png]") private List sliderPicUrls; - @Schema(description = "商品视频", example = "https://www.iocoder.cn/xx.mp4") - private String videoUrl; - - @Schema(description = "单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") - @NotNull(message = "商品单位不能为空") - private Integer unit; - @Schema(description = "排序字段", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") @NotNull(message = "商品排序字段不能为空") private Integer sort; @@ -66,32 +59,16 @@ public class ProductSpuBaseVO { // ========== 物流相关字段 ========= + @Schema(description = "配送方式数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") + @NotEmpty(message = "配送方式不能为空") + private List deliveryTypes; + @Schema(description = "物流配置模板编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "111") @NotNull(message = "物流配置模板编号不能为空") private Long deliveryTemplateId; // ========== 营销相关字段 ========= - @Schema(description = "是否热卖推荐", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") - @NotNull(message = "商品推荐不能为空") - private Boolean recommendHot; - - @Schema(description = "是否优惠推荐", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") - @NotNull(message = "商品推荐不能为空") - private Boolean recommendBenefit; - - @Schema(description = "是否精品推荐", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") - @NotNull(message = "商品推荐不能为空") - private Boolean recommendBest; - - @Schema(description = "是否新品推荐", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") - @NotNull(message = "商品推荐不能为空") - private Boolean recommendNew; - - @Schema(description = "是否优品推荐", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") - @NotNull(message = "商品推荐不能为空") - private Boolean recommendGood; - @Schema(description = "赠送积分", requiredMode = Schema.RequiredMode.REQUIRED, example = "111") @NotNull(message = "商品赠送积分不能为空") private Integer giveIntegral; @@ -100,9 +77,6 @@ public class ProductSpuBaseVO { @NotNull(message = "商品分销类型不能为空") private Boolean subCommissionType; - @Schema(description = "活动展示顺序", example = "[1, 3, 2, 4, 5]") - private List activityOrders; - // ========== 统计相关字段 ========= @Schema(description = "虚拟销量", example = "66") diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuExcelVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuExcelVO.java index 38cbd8472..318f49698 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuExcelVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuExcelVO.java @@ -44,13 +44,6 @@ public class ProductSpuExcelVO { @ExcelProperty("商品封面图") private String picUrl; - @ExcelProperty("商品视频") - private String videoUrl; - - @ExcelProperty(value = "商品单位", converter = DictConvert.class) - @DictFormat(DictTypeConstants.PRODUCT_UNIT) - private Integer unit; - @ExcelProperty("排序字段") private Integer sort; @@ -76,21 +69,6 @@ public class ProductSpuExcelVO { @ExcelProperty("物流配置模板编号") private Long deliveryTemplateId; - @ExcelProperty("是否热卖推荐") - private Boolean recommendHot; - - @ExcelProperty("是否优惠推荐") - private Boolean recommendBenefit; - - @ExcelProperty("是否精品推荐") - private Boolean recommendBest; - - @ExcelProperty("是否新品推荐") - private Boolean recommendNew; - - @ExcelProperty("是否优品推荐") - private Boolean recommendGood; - @ExcelProperty("赠送积分") private Integer giveIntegral; diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/vo/AppProductSpuDetailRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/vo/AppProductSpuDetailRespVO.java index c890a7961..f1ee49b10 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/vo/AppProductSpuDetailRespVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/vo/AppProductSpuDetailRespVO.java @@ -33,17 +33,8 @@ public class AppProductSpuDetailRespVO { @Schema(description = "商品轮播图", requiredMode = Schema.RequiredMode.REQUIRED) private List sliderPicUrls; - @Schema(description = "商品视频", requiredMode = Schema.RequiredMode.REQUIRED) - private String videoUrl; - - @Schema(description = "单位名", requiredMode = Schema.RequiredMode.REQUIRED, example = "个") - private String unitName; - // ========== 营销相关字段 ========= - @Schema(description = "活动排序数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") - private List activityOrders; - // ========== SKU 相关字段 ========= @Schema(description = "规格类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/vo/AppProductSpuPageRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/vo/AppProductSpuPageRespVO.java index 07b0d8e95..9dc4d10da 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/vo/AppProductSpuPageRespVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/vo/AppProductSpuPageRespVO.java @@ -27,9 +27,6 @@ public class AppProductSpuPageRespVO { @Schema(description = "商品轮播图", requiredMode = Schema.RequiredMode.REQUIRED) private List sliderPicUrls; - @Schema(description = "单位名", requiredMode = Schema.RequiredMode.REQUIRED, example = "个") - private String unitName; - // ========== SKU 相关字段 ========= @Schema(description = "规格类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") @@ -43,15 +40,12 @@ public class AppProductSpuPageRespVO { @Schema(description = "VIP 价格,单位使用:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "968") // 通过会员等级,计算出折扣后价格 private Integer vipPrice; - + @Schema(description = "库存", requiredMode = Schema.RequiredMode.REQUIRED, example = "666") private Integer stock; // ========== 营销相关字段 ========= - @Schema(description = "活动排序数组", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") - private List activityOrders; - // ========== 统计相关字段 ========= @Schema(description = "商品销量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/property/ProductPropertyConvert.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/property/ProductPropertyConvert.java index 368da9416..4d388f515 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/property/ProductPropertyConvert.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/property/ProductPropertyConvert.java @@ -1,22 +1,14 @@ package cn.iocoder.yudao.module.product.convert.property; -import cn.hutool.core.collection.CollUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; -import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyAndValueRespVO; import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyCreateReqVO; import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyRespVO; import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyUpdateReqVO; import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyDO; -import cn.iocoder.yudao.module.product.dal.dataobject.property.ProductPropertyValueDO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; -import java.util.Collections; import java.util.List; -import java.util.Map; - -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; /** * 属性项 Convert @@ -38,20 +30,4 @@ public interface ProductPropertyConvert { PageResult convertPage(PageResult page); - default List convertList(List keys, List values) { - Map> valueMap = CollectionUtils.convertMultiMap(values, ProductPropertyValueDO::getPropertyId); - return CollectionUtils.convertList(keys, key -> { - ProductPropertyAndValueRespVO respVO = convert02(key); - // 如果属性值为空value不为null,返回空列表 - if (CollUtil.isEmpty(values)) { - respVO.setValues(Collections.emptyList()); - }else { - respVO.setValues(convertList02(valueMap.get(key.getId()))); - } - return respVO; - }); - } - ProductPropertyAndValueRespVO convert02(ProductPropertyDO bean); - List convertList02(List list); - } 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 30dd2d8b9..835dbd15f 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 @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.product.convert.spu; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; -import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils; import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuDetailRespVO; @@ -11,7 +10,6 @@ import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageRe import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert; import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; -import cn.iocoder.yudao.module.product.enums.DictTypeConstants; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.Named; @@ -74,13 +72,7 @@ public interface ProductSpuConvert { // 处理虚拟销量 list.forEach(spu -> spu.setSalesCount(spu.getSalesCount() + spu.getVirtualSalesCount())); // 处理 VO 字段 - List voList = convertListForGetSpuList0(list); - for (int i = 0; i < list.size(); i++) { - ProductSpuDO spu = list.get(i); - AppProductSpuPageRespVO spuVO = voList.get(i); - spuVO.setUnitName(DictFrameworkUtils.getDictDataLabel(DictTypeConstants.PRODUCT_UNIT, spu.getUnit())); - } - return voList; + return convertListForGetSpuList0(list); } @Named("convertListForGetSpuList0") @@ -89,8 +81,7 @@ public interface ProductSpuConvert { default AppProductSpuDetailRespVO convertForGetSpuDetail(ProductSpuDO spu, List skus) { // 处理 SPU AppProductSpuDetailRespVO spuVO = convertForGetSpuDetail(spu) - .setSalesCount(spu.getSalesCount() + defaultIfNull(spu.getVirtualSalesCount(), 0)) - .setUnitName(DictFrameworkUtils.getDictDataLabel(DictTypeConstants.PRODUCT_UNIT, spu.getUnit())); + .setSalesCount(spu.getSalesCount() + defaultIfNull(spu.getVirtualSalesCount(), 0)); // 处理 SKU spuVO.setSkus(convertListForGetSpuDetail(skus)); return spuVO; 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 9ce55a096..d95581e98 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 @@ -1,6 +1,7 @@ package cn.iocoder.yudao.module.product.dal.dataobject.spu; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import cn.iocoder.yudao.framework.mybatis.core.type.IntegerListTypeHandler; import cn.iocoder.yudao.module.product.dal.dataobject.brand.ProductBrandDO; import cn.iocoder.yudao.module.product.dal.dataobject.category.ProductCategoryDO; import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; @@ -80,17 +81,7 @@ public class ProductSpuDO extends BaseDO { */ @TableField(typeHandler = JacksonTypeHandler.class) private List sliderPicUrls; - /** - * 商品视频 - */ - private String videoUrl; - /** - * 单位 - * - * 对应 product_unit 数据字典 - */ - private Integer unit; /** * 排序字段 */ @@ -138,6 +129,13 @@ public class ProductSpuDO extends BaseDO { // ========== 物流相关字段 ========= + /** + * 配送方式数组 + * + * 对应 DeliveryTypeEnum 枚举 + */ + @TableField(typeHandler = IntegerListTypeHandler.class) + private List deliveryTypes; /** * 物流配置模板编号 * @@ -146,26 +144,6 @@ public class ProductSpuDO extends BaseDO { private Long deliveryTemplateId; // ========== 营销相关字段 ========= - /** - * 是否热卖推荐 - */ - private Boolean recommendHot; - /** - * 是否优惠推荐 - */ - private Boolean recommendBenefit; - /** - * 是否精品推荐 - */ - private Boolean recommendBest; - /** - * 是否新品推荐 - */ - private Boolean recommendNew; - /** - * 是否优品推荐 - */ - private Boolean recommendGood; /** * 赠送积分 @@ -188,14 +166,6 @@ public class ProductSpuDO extends BaseDO { */ private Boolean subCommissionType; - /** - * 活动展示顺序 - * - * 对应 PromotionTypeEnum 枚举 - */ - @TableField(typeHandler = JacksonTypeHandler.class) - private List activityOrders; // TODO @芋艿: 活动顺序字段长度需要增加 - // ========== 统计相关字段 ========= /** diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/ProductSpuMapper.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/ProductSpuMapper.java index f354f72d5..4d6db5019 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/ProductSpuMapper.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/spu/ProductSpuMapper.java @@ -64,18 +64,6 @@ public interface ProductSpuMapper extends BaseMapperX { .inIfPresent(ProductSpuDO::getCategoryId, categoryIds); // 上架状态 且有库存 query.eq(ProductSpuDO::getStatus, ProductSpuStatusEnum.ENABLE.getStatus()); - // 推荐类型的过滤条件 - if (ObjUtil.equal(pageReqVO.getRecommendType(), AppProductSpuPageReqVO.RECOMMEND_TYPE_HOT)) { - query.eq(ProductSpuDO::getRecommendHot, true); - } else if (ObjUtil.equal(pageReqVO.getRecommendType(), AppProductSpuPageReqVO.RECOMMEND_TYPE_BENEFIT)) { - query.eq(ProductSpuDO::getRecommendBenefit, true); - } else if (ObjUtil.equal(pageReqVO.getRecommendType(), AppProductSpuPageReqVO.RECOMMEND_TYPE_BEST)) { - query.eq(ProductSpuDO::getRecommendBest, true); - } else if (ObjUtil.equal(pageReqVO.getRecommendType(), AppProductSpuPageReqVO.RECOMMEND_TYPE_NEW)) { - query.eq(ProductSpuDO::getRecommendNew, true); - } else if (ObjUtil.equal(pageReqVO.getRecommendType(), AppProductSpuPageReqVO.RECOMMEND_TYPE_GOOD)) { - query.eq(ProductSpuDO::getRecommendGood, true); - } // 排序逻辑 if (Objects.equals(pageReqVO.getSortField(), AppProductSpuPageReqVO.SORT_FIELD_SALES_COUNT)) { diff --git a/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/category/ProductCategoryServiceImplTest.java b/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/category/ProductCategoryServiceImplTest.java index 5db5fa713..e919a4668 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/category/ProductCategoryServiceImplTest.java +++ b/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/category/ProductCategoryServiceImplTest.java @@ -152,8 +152,8 @@ public class ProductCategoryServiceImplTest extends BaseDbUnitTest { reqVO.setParentId(PARENT_ID_NULL); // 调用 - List list = productCategoryService.getEnableCategoryList(reqVO); - List all = productCategoryService.getEnableCategoryList(new ProductCategoryListReqVO()); + List list = productCategoryService.getCategoryList(reqVO); + List all = productCategoryService.getCategoryList(new ProductCategoryListReqVO()); // 断言 assertEquals(1, list.size()); assertEquals(4, all.size()); diff --git a/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImplTest.java b/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImplTest.java index 88c155a77..8117c5e84 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImplTest.java +++ b/yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImplTest.java @@ -103,11 +103,9 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { ProductSpuCreateReqVO createReqVO = randomPojo(ProductSpuCreateReqVO.class,o->{ o.setCategoryId(generateId()); o.setBrandId(generateId()); - o.setUnit(RandomUtil.randomInt(1,20)); // 限制商品单位范围 o.setSort(RandomUtil.randomInt(1,100)); // 限制排序范围 o.setGiveIntegral(generaInt()); // 限制范围为正整数 o.setVirtualSalesCount(generaInt()); // 限制范围为正整数 - o.setActivityOrders(newArrayList(1,3,2,4,5)); // 活动排序 o.setSkus(newArrayList(skuCreateOrUpdateReqVO,skuCreateOrUpdateReqVO,skuCreateOrUpdateReqVO)); }); when(categoryService.getCategoryLevel(eq(createReqVO.getCategoryId()))).thenReturn(2); @@ -123,11 +121,9 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { o.setCategoryId(generateId()); o.setBrandId(generateId()); o.setDeliveryTemplateId(generateId()); - o.setUnit(RandomUtil.randomInt(1,20)); // 限制商品单位范围 o.setSort(RandomUtil.randomInt(1,100)); // 限制排序范围 o.setGiveIntegral(generaInt()); // 限制范围为正整数 o.setVirtualSalesCount(generaInt()); // 限制范围为正整数 - o.setActivityOrders(newArrayList(1,3,2,4,5)); // 活动排序 o.setPrice(generaInt()); // 限制范围为正整数 o.setMarketPrice(generaInt()); // 限制范围为正整数 o.setCostPrice(generaInt()); // 限制范围为正整数 @@ -156,11 +152,9 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { o.setId(createReqVO.getId()); // 设置更新的 ID o.setCategoryId(generateId()); o.setBrandId(generateId()); - o.setUnit(RandomUtil.randomInt(1,20)); // 限制商品单位范围 o.setSort(RandomUtil.randomInt(1,100)); // 限制排序范围 o.setGiveIntegral(generaInt()); // 限制范围为正整数 o.setVirtualSalesCount(generaInt()); // 限制范围为正整数 - o.setActivityOrders(newArrayList(1,3,2,4,5)); // 活动排序 o.setGiveIntegral(generaInt()); // 限制范围为正整数 o.setSalesCount(generaInt()); // 限制范围为正整数 o.setBrowseCount(generaInt()); // 限制范围为正整数 @@ -189,11 +183,9 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { o.setCategoryId(generateId()); o.setBrandId(generateId()); o.setDeliveryTemplateId(generateId()); - o.setUnit(RandomUtil.randomInt(1,20)); // 限制商品单位范围 o.setSort(RandomUtil.randomInt(1,100)); // 限制排序范围 o.setGiveIntegral(generaInt()); // 限制范围为正整数 o.setVirtualSalesCount(generaInt()); // 限制范围为正整数 - o.setActivityOrders(newArrayList(1,3,2,4,5)); // 活动排序 o.setPrice(generaInt()); // 限制范围为正整数 o.setMarketPrice(generaInt()); // 限制范围为正整数 o.setCostPrice(generaInt()); // 限制范围为正整数 @@ -218,11 +210,9 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { o.setCategoryId(generateId()); o.setBrandId(generateId()); o.setDeliveryTemplateId(generateId()); - o.setUnit(RandomUtil.randomInt(1,20)); // 限制商品单位范围 o.setSort(RandomUtil.randomInt(1,100)); // 限制排序范围 o.setGiveIntegral(generaInt()); // 限制范围为正整数 o.setVirtualSalesCount(generaInt()); // 限制范围为正整数 - o.setActivityOrders(newArrayList(1,3,2,4,5)); // 活动排序 o.setPrice(generaInt()); // 限制范围为正整数 o.setMarketPrice(generaInt()); // 限制范围为正整数 o.setCostPrice(generaInt()); // 限制范围为正整数 @@ -244,11 +234,9 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { o.setCategoryId(generateId()); o.setBrandId(generateId()); o.setDeliveryTemplateId(generateId()); - o.setUnit(RandomUtil.randomInt(1,20)); // 限制商品单位范围 o.setSort(RandomUtil.randomInt(1,100)); // 限制排序范围 o.setGiveIntegral(generaInt()); // 限制范围为正整数 o.setVirtualSalesCount(generaInt()); // 限制范围为正整数 - o.setActivityOrders(newArrayList(1,3,2,4,5)); // 活动排序 o.setPrice(generaInt()); // 限制范围为正整数 o.setMarketPrice(generaInt()); // 限制范围为正整数 o.setCostPrice(generaInt()); // 限制范围为正整数 @@ -260,11 +248,9 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { o.setCategoryId(generateId()); o.setBrandId(generateId()); o.setDeliveryTemplateId(generateId()); - o.setUnit(RandomUtil.randomInt(1,20)); // 限制商品单位范围 o.setSort(RandomUtil.randomInt(1,100)); // 限制排序范围 o.setGiveIntegral(generaInt()); // 限制范围为正整数 o.setVirtualSalesCount(generaInt()); // 限制范围为正整数 - o.setActivityOrders(newArrayList(1,3,2,4,5)); // 活动排序 o.setPrice(generaInt()); // 限制范围为正整数 o.setMarketPrice(generaInt()); // 限制范围为正整数 o.setCostPrice(generaInt()); // 限制范围为正整数 @@ -287,11 +273,9 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { o.setCategoryId(generateId()); o.setBrandId(generateId()); o.setDeliveryTemplateId(generateId()); - o.setUnit(RandomUtil.randomInt(1,20)); // 限制商品单位范围 o.setSort(RandomUtil.randomInt(1,100)); // 限制排序范围 o.setGiveIntegral(generaInt()); // 限制范围为正整数 o.setVirtualSalesCount(generaInt()); // 限制范围为正整数 - o.setActivityOrders(newArrayList(1,3,2,4,5)); // 活动排序 o.setPrice(generaInt()); // 限制范围为正整数 o.setMarketPrice(generaInt()); // 限制范围为正整数 o.setCostPrice(generaInt()); // 限制范围为正整数 @@ -303,11 +287,9 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { o.setCategoryId(generateId()); o.setBrandId(generateId()); o.setDeliveryTemplateId(generateId()); - o.setUnit(RandomUtil.randomInt(1,20)); // 限制商品单位范围 o.setSort(RandomUtil.randomInt(1,100)); // 限制排序范围 o.setGiveIntegral(generaInt()); // 限制范围为正整数 o.setVirtualSalesCount(generaInt()); // 限制范围为正整数 - o.setActivityOrders(newArrayList(1,3,2,4,5)); // 活动排序 o.setPrice(generaInt()); // 限制范围为正整数 o.setMarketPrice(generaInt()); // 限制范围为正整数 o.setCostPrice(generaInt()); // 限制范围为正整数 @@ -335,11 +317,9 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { o.setCategoryId(generateId()); o.setBrandId(generateId()); o.setDeliveryTemplateId(generateId()); - o.setUnit(RandomUtil.randomInt(1,20)); // 限制商品单位范围 o.setSort(RandomUtil.randomInt(1,100)); // 限制排序范围 o.setGiveIntegral(generaInt()); // 限制范围为正整数 o.setVirtualSalesCount(generaInt()); // 限制范围为正整数 - o.setActivityOrders(newArrayList(1,3,2,4,5)); // 活动排序 o.setPrice(generaInt()); // 限制范围为正整数 o.setMarketPrice(generaInt()); // 限制范围为正整数 o.setCostPrice(generaInt()); // 限制范围为正整数 @@ -351,11 +331,9 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { o.setCategoryId(generateId()); o.setBrandId(generateId()); o.setDeliveryTemplateId(generateId()); - o.setUnit(RandomUtil.randomInt(1,20)); // 限制商品单位范围 o.setSort(RandomUtil.randomInt(1,100)); // 限制排序范围 o.setGiveIntegral(generaInt()); // 限制范围为正整数 o.setVirtualSalesCount(generaInt()); // 限制范围为正整数 - o.setActivityOrders(newArrayList(1,3,2,4,5)); // 活动排序 o.setPrice(generaInt()); // 限制范围为正整数 o.setMarketPrice(generaInt()); // 限制范围为正整数 o.setCostPrice(generaInt()); // 限制范围为正整数 @@ -379,11 +357,9 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { o.setCategoryId(generateId()); o.setBrandId(generateId()); o.setDeliveryTemplateId(generateId()); - o.setUnit(RandomUtil.randomInt(1,20)); // 限制商品单位范围 o.setSort(RandomUtil.randomInt(1,100)); // 限制排序范围 o.setGiveIntegral(generaInt()); // 限制范围为正整数 o.setVirtualSalesCount(generaInt()); // 限制范围为正整数 - o.setActivityOrders(newArrayList(1,3,2,4,5)); // 活动排序 o.setPrice(generaInt()); // 限制范围为正整数 o.setMarketPrice(generaInt()); // 限制范围为正整数 o.setCostPrice(generaInt()); // 限制范围为正整数 @@ -462,11 +438,9 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { o.setCategoryId(generateId()); o.setBrandId(generateId()); o.setDeliveryTemplateId(generateId()); - o.setUnit(RandomUtil.randomInt(1,20)); // 限制商品单位范围 o.setSort(RandomUtil.randomInt(1,100)); // 限制排序范围 o.setGiveIntegral(generaInt()); // 限制范围为正整数 o.setVirtualSalesCount(generaInt()); // 限制范围为正整数 - o.setActivityOrders(newArrayList(1,3,2,4,5)); // 活动排序 o.setPrice(generaInt()); // 限制范围为正整数 o.setMarketPrice(generaInt()); // 限制范围为正整数 o.setCostPrice(generaInt()); // 限制范围为正整数 @@ -480,11 +454,9 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { o.setCategoryId(generateId()); o.setBrandId(generateId()); o.setDeliveryTemplateId(generateId()); - o.setUnit(RandomUtil.randomInt(1,20)); // 限制商品单位范围 o.setSort(RandomUtil.randomInt(1,100)); // 限制排序范围 o.setGiveIntegral(generaInt()); // 限制范围为正整数 o.setVirtualSalesCount(generaInt()); // 限制范围为正整数 - o.setActivityOrders(newArrayList(1,3,2,4,5)); // 活动排序 o.setPrice(generaInt()); // 限制范围为正整数 o.setMarketPrice(generaInt()); // 限制范围为正整数 o.setCostPrice(generaInt()); // 限制范围为正整数 diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/activity/AppBargainActivityDetailRespVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/activity/AppBargainActivityDetailRespVO.java index 4a1f84504..78322f49e 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/activity/AppBargainActivityDetailRespVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/activity/AppBargainActivityDetailRespVO.java @@ -42,9 +42,6 @@ public class AppBargainActivityDetailRespVO { @Schema(description = "商品市场价,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "50") // 从 SPU 的 marketPrice 读取 private Integer marketPrice; - @Schema(description = "商品单位", requiredMode = Schema.RequiredMode.REQUIRED, example = "个") // 从 SPU 的 unit 读取,然后转换 - private String unitName; - @Schema(description = "砍价起始价格,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "200") private Integer bargainFirstPrice; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/vo/activity/AppSeckillActivityRespVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/vo/activity/AppSeckillActivityRespVO.java index 947a1122d..68e7ff829 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/vo/activity/AppSeckillActivityRespVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/vo/activity/AppSeckillActivityRespVO.java @@ -19,8 +19,7 @@ public class AppSeckillActivityRespVO { @Schema(description = "商品图片", requiredMode = Schema.RequiredMode.REQUIRED, // 从 SPU 的 picUrl 读取 example = "https://www.iocoder.cn/xx.png") private String picUrl; - @Schema(description = "单位名", requiredMode = Schema.RequiredMode.REQUIRED, example = "个") - private String unitName; + @Schema(description = "商品市场价,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, // 从 SPU 的 marketPrice 读取 example = "50") private Integer marketPrice; diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/bargain/BargainActivityConvert.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/bargain/BargainActivityConvert.java index 47448dfd3..69f1ce2ea 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/bargain/BargainActivityConvert.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/bargain/BargainActivityConvert.java @@ -2,9 +2,7 @@ package cn.iocoder.yudao.module.promotion.convert.bargain; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; -import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils; import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; -import cn.iocoder.yudao.module.product.enums.DictTypeConstants; import cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.activity.BargainActivityBaseVO; import cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.activity.BargainActivityPageItemRespVO; import cn.iocoder.yudao.module.promotion.controller.admin.bargain.vo.activity.BargainActivityRespVO; @@ -64,8 +62,7 @@ public interface BargainActivityConvert { default AppBargainActivityDetailRespVO convert(BargainActivityDO bean, Integer successUserCount, ProductSpuRespDTO spu) { AppBargainActivityDetailRespVO detail = convert1(bean).setSuccessUserCount(successUserCount); if (spu != null) { - detail.setPicUrl(spu.getPicUrl()).setMarketPrice(spu.getMarketPrice()) - .setUnitName(DictFrameworkUtils.getDictDataLabel(DictTypeConstants.PRODUCT_UNIT, spu.getUnit())); + detail.setPicUrl(spu.getPicUrl()).setMarketPrice(spu.getMarketPrice()); } return detail; } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/seckillactivity/SeckillActivityConvert.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/seckillactivity/SeckillActivityConvert.java index 271a0340f..4f53cf3dc 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/seckillactivity/SeckillActivityConvert.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/seckill/seckillactivity/SeckillActivityConvert.java @@ -3,9 +3,7 @@ package cn.iocoder.yudao.module.promotion.convert.seckill.seckillactivity; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.framework.common.util.collection.MapUtils; -import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils; import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; -import cn.iocoder.yudao.module.product.enums.DictTypeConstants; import cn.iocoder.yudao.module.promotion.api.seckill.dto.SeckillValidateJoinRespDTO; import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity.SeckillActivityCreateReqVO; import cn.iocoder.yudao.module.promotion.controller.admin.seckill.vo.activity.SeckillActivityDetailRespVO; @@ -104,8 +102,7 @@ public interface SeckillActivityConvert { item.setSeckillPrice(getMinValue(productMap.get(item.getId()), SeckillProductDO::getSeckillPrice)); // spu 信息 findAndThen(spuMap, item.getSpuId(), spu -> - item.setPicUrl(spu.getPicUrl()).setMarketPrice(spu.getMarketPrice()) - .setUnitName(DictFrameworkUtils.getDictDataLabel(DictTypeConstants.PRODUCT_UNIT, spu.getUnit()))); + item.setPicUrl(spu.getPicUrl()).setMarketPrice(spu.getMarketPrice())); return item; })); return respVO; @@ -121,8 +118,7 @@ public interface SeckillActivityConvert { // product 信息 item.setSeckillPrice(getMinValue(productMap.get(item.getId()), SeckillProductDO::getSeckillPrice)); // spu 信息 - findAndThen(spuMap, item.getSpuId(), spu -> item.setPicUrl(spu.getPicUrl()).setMarketPrice(spu.getMarketPrice()) - .setUnitName(DictFrameworkUtils.getDictDataLabel(DictTypeConstants.PRODUCT_UNIT, spu.getUnit()))); + findAndThen(spuMap, item.getSpuId(), spu -> item.setPicUrl(spu.getPicUrl()).setMarketPrice(spu.getMarketPrice())); return item; }); result.setList(list);