Commit bb0bb2a4fa16380dad968e3ead36cc456f9b1738
1 parent
4a3703e3
mall + promotion:商品列表
Showing
3 changed files
with
17 additions
and
26 deletions
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuExcelVO.java
| @@ -44,9 +44,6 @@ public class ProductSpuExcelVO { | @@ -44,9 +44,6 @@ public class ProductSpuExcelVO { | ||
| 44 | @ExcelProperty("商品封面图") | 44 | @ExcelProperty("商品封面图") |
| 45 | private String picUrl; | 45 | private String picUrl; |
| 46 | 46 | ||
| 47 | - @ExcelProperty("商品轮播图地址") | ||
| 48 | - private String sliderPicUrls; | ||
| 49 | - | ||
| 50 | @ExcelProperty("商品视频") | 47 | @ExcelProperty("商品视频") |
| 51 | private String videoUrl; | 48 | private String videoUrl; |
| 52 | 49 | ||
| @@ -97,15 +94,9 @@ public class ProductSpuExcelVO { | @@ -97,15 +94,9 @@ public class ProductSpuExcelVO { | ||
| 97 | @ExcelProperty("赠送积分") | 94 | @ExcelProperty("赠送积分") |
| 98 | private Integer giveIntegral; | 95 | private Integer giveIntegral; |
| 99 | 96 | ||
| 100 | - @ExcelProperty("赠送的优惠劵编号的数组") | ||
| 101 | - private String giveCouponTemplateIds; | ||
| 102 | - | ||
| 103 | @ExcelProperty("分销类型") | 97 | @ExcelProperty("分销类型") |
| 104 | private Boolean subCommissionType; | 98 | private Boolean subCommissionType; |
| 105 | 99 | ||
| 106 | - @ExcelProperty("活动显示排序") | ||
| 107 | - private String activityOrders; | ||
| 108 | - | ||
| 109 | @ExcelProperty("商品销量") | 100 | @ExcelProperty("商品销量") |
| 110 | private Integer salesCount; | 101 | private Integer salesCount; |
| 111 | 102 |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/vo/AppProductSpuPageRespVO.java
| @@ -24,6 +24,9 @@ public class AppProductSpuPageRespVO { | @@ -24,6 +24,9 @@ public class AppProductSpuPageRespVO { | ||
| 24 | @Schema(description = "商品轮播图", requiredMode = Schema.RequiredMode.REQUIRED) | 24 | @Schema(description = "商品轮播图", requiredMode = Schema.RequiredMode.REQUIRED) |
| 25 | private List<String> sliderPicUrls; | 25 | private List<String> sliderPicUrls; |
| 26 | 26 | ||
| 27 | + @Schema(description = "单位名", requiredMode = Schema.RequiredMode.REQUIRED, example = "个") | ||
| 28 | + private String unitName; | ||
| 29 | + | ||
| 27 | // ========== SKU 相关字段 ========= | 30 | // ========== SKU 相关字段 ========= |
| 28 | 31 | ||
| 29 | @Schema(description = "规格类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") | 32 | @Schema(description = "规格类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "true") |
| @@ -35,6 +38,9 @@ public class AppProductSpuPageRespVO { | @@ -35,6 +38,9 @@ public class AppProductSpuPageRespVO { | ||
| 35 | @Schema(description = "市场价,单位使用:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | 38 | @Schema(description = "市场价,单位使用:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") |
| 36 | private Integer marketPrice; | 39 | private Integer marketPrice; |
| 37 | 40 | ||
| 41 | + @Schema(description = "VIP 价格,单位使用:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "968") // 通过会员等级,计算出折扣后价格 | ||
| 42 | + private Integer vipPrice; | ||
| 43 | + | ||
| 38 | @Schema(description = "库存", requiredMode = Schema.RequiredMode.REQUIRED, example = "666") | 44 | @Schema(description = "库存", requiredMode = Schema.RequiredMode.REQUIRED, example = "666") |
| 39 | private Integer stock; | 45 | private Integer stock; |
| 40 | 46 |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/convert/spu/ProductSpuConvert.java
| 1 | package cn.iocoder.yudao.module.product.convert.spu; | 1 | package cn.iocoder.yudao.module.product.convert.spu; |
| 2 | 2 | ||
| 3 | -import cn.hutool.core.util.StrUtil; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 5 | import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils; | 4 | import cn.iocoder.yudao.framework.dict.core.util.DictFrameworkUtils; |
| 6 | import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; | 5 | import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; |
| 7 | import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; | 6 | import cn.iocoder.yudao.module.product.controller.admin.spu.vo.*; |
| 8 | import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuDetailRespVO; | 7 | import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuDetailRespVO; |
| 9 | -import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageRespVO; | ||
| 10 | import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageReqVO; | 8 | import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageReqVO; |
| 9 | +import cn.iocoder.yudao.module.product.controller.app.spu.vo.AppProductSpuPageRespVO; | ||
| 11 | import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert; | 10 | import cn.iocoder.yudao.module.product.convert.sku.ProductSkuConvert; |
| 12 | import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; | 11 | import cn.iocoder.yudao.module.product.dal.dataobject.sku.ProductSkuDO; |
| 13 | import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; | 12 | import cn.iocoder.yudao.module.product.dal.dataobject.spu.ProductSpuDO; |
| @@ -46,20 +45,6 @@ public interface ProductSpuConvert { | @@ -46,20 +45,6 @@ public interface ProductSpuConvert { | ||
| 46 | 45 | ||
| 47 | List<ProductSpuSimpleRespVO> convertList02(List<ProductSpuDO> list); | 46 | List<ProductSpuSimpleRespVO> convertList02(List<ProductSpuDO> list); |
| 48 | 47 | ||
| 49 | - /** | ||
| 50 | - * 列表转字符串 | ||
| 51 | - * | ||
| 52 | - * @param list 列表 | ||
| 53 | - * @return 字符串 | ||
| 54 | - */ | ||
| 55 | - @Named("convertListToString") | ||
| 56 | - default String convertListToString(List<?> list) { | ||
| 57 | - return StrUtil.toString(list); | ||
| 58 | - } | ||
| 59 | - | ||
| 60 | - @Mapping(source = "sliderPicUrls", target = "sliderPicUrls", qualifiedByName = "convertListToString") | ||
| 61 | - @Mapping(source = "giveCouponTemplateIds", target = "giveCouponTemplateIds", qualifiedByName = "convertListToString") | ||
| 62 | - @Mapping(source = "activityOrders", target = "activityOrders", qualifiedByName = "convertListToString") | ||
| 63 | @Mapping(target = "price", expression = "java(spu.getPrice() / 100)") | 48 | @Mapping(target = "price", expression = "java(spu.getPrice() / 100)") |
| 64 | @Mapping(target = "marketPrice", expression = "java(spu.getMarketPrice() / 100)") | 49 | @Mapping(target = "marketPrice", expression = "java(spu.getMarketPrice() / 100)") |
| 65 | @Mapping(target = "costPrice", expression = "java(spu.getCostPrice() / 100)") | 50 | @Mapping(target = "costPrice", expression = "java(spu.getCostPrice() / 100)") |
| @@ -83,7 +68,16 @@ public interface ProductSpuConvert { | @@ -83,7 +68,16 @@ public interface ProductSpuConvert { | ||
| 83 | default List<AppProductSpuPageRespVO> convertListForGetSpuList(List<ProductSpuDO> list) { | 68 | default List<AppProductSpuPageRespVO> convertListForGetSpuList(List<ProductSpuDO> list) { |
| 84 | // 处理虚拟销量 | 69 | // 处理虚拟销量 |
| 85 | list.forEach(spu -> spu.setSalesCount(spu.getSalesCount() + spu.getVirtualSalesCount())); | 70 | list.forEach(spu -> spu.setSalesCount(spu.getSalesCount() + spu.getVirtualSalesCount())); |
| 86 | - return convertListForGetSpuList0(list); | 71 | + // 处理 VO 字段 |
| 72 | + List<AppProductSpuPageRespVO> voList = convertListForGetSpuList0(list); | ||
| 73 | + for (int i = 0; i < list.size(); i++) { | ||
| 74 | + ProductSpuDO spu = list.get(i); | ||
| 75 | + AppProductSpuPageRespVO spuVO = voList.get(i); | ||
| 76 | + spuVO.setUnitName(DictFrameworkUtils.getDictDataLabel(DictTypeConstants.PRODUCT_UNIT, spu.getUnit())); | ||
| 77 | + // 计算 vip 价格 TODO 芋艿:临时的逻辑,等 vip 支持后 | ||
| 78 | + spuVO.setVipPrice((int) (spuVO.getPrice() * 0.9)); | ||
| 79 | + } | ||
| 80 | + return voList; | ||
| 87 | } | 81 | } |
| 88 | @Named("convertListForGetSpuList0") | 82 | @Named("convertListForGetSpuList0") |
| 89 | List<AppProductSpuPageRespVO> convertListForGetSpuList0(List<ProductSpuDO> list); | 83 | List<AppProductSpuPageRespVO> convertListForGetSpuList0(List<ProductSpuDO> list); |