From 330380c2d0dd58af81af921e6b781d95395721c4 Mon Sep 17 00:00:00 2001 From: owen Date: Fri, 17 Nov 2023 09:56:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=90=A5=E9=94=80=EF=BC=9A=E9=80=82=E9=85=8D?= =?UTF-8?q?=E5=95=86=E5=9F=8E=E8=A3=85=E4=BF=AE=E7=BB=84=E4=BB=B6=E3=80=90?= =?UTF-8?q?=E5=95=86=E5=93=81=E5=8D=A1=E7=89=87=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/spu/vo/ProductSpuDetailRespVO.java | 14 +------------ .../admin/spu/vo/ProductSpuRespVO.java | 2 +- .../app/spu/AppProductSpuController.java | 20 +++++++++++++++++++ .../app/spu/vo/AppProductSpuPageRespVO.java | 3 +++ 4 files changed, 25 insertions(+), 14 deletions(-) diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuDetailRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuDetailRespVO.java index 1be96632d..336d44467 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuDetailRespVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuDetailRespVO.java @@ -12,19 +12,7 @@ import java.util.List; @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class ProductSpuDetailRespVO extends ProductSpuBaseVO { - - @Schema(description = "商品 SPU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1212") - private Long id; - - @Schema(description = "商品销量", requiredMode = Schema.RequiredMode.REQUIRED, example = "10000") - private Integer salesCount; - - @Schema(description = "浏览量", requiredMode = Schema.RequiredMode.REQUIRED, example = "20000") - private Integer browseCount; - - @Schema(description = "商品状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") - private Integer status; +public class ProductSpuDetailRespVO extends ProductSpuRespVO { // ========== SKU 相关字段 ========= diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuRespVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuRespVO.java index 0148cb2a1..faf8a5572 100755 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuRespVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuRespVO.java @@ -13,7 +13,7 @@ import java.time.LocalDateTime; @ToString(callSuper = true) public class ProductSpuRespVO extends ProductSpuBaseVO { - @Schema(description = "spuId", requiredMode = Schema.RequiredMode.REQUIRED, example = "111") + @Schema(description = "商品 SPU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "111") private Long id; @Schema(description = "商品价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "1999") diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/AppProductSpuController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/AppProductSpuController.java index 8f49e7f74..9d0a1fe9f 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/AppProductSpuController.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/spu/AppProductSpuController.java @@ -30,6 +30,7 @@ import javax.annotation.Resource; import javax.validation.Valid; import java.util.Collections; import java.util.List; +import java.util.Set; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @@ -75,6 +76,25 @@ public class AppProductSpuController { return success(voList); } + @GetMapping("/list-by-ids") + @Operation(summary = "获得商品 SPU 列表") + @Parameters({ + @Parameter(name = "ids", description = "编号列表", required = true) + }) + public CommonResult> getSpuList(@RequestParam("ids") Set ids) { + List list = productSpuService.getSpuList(ids); + if (CollUtil.isEmpty(list)) { + return success(Collections.emptyList()); + } + + // 拼接返回 + List voList = ProductSpuConvert.INSTANCE.convertListForGetSpuList(list); + // 处理 vip 价格 + MemberLevelRespDTO memberLevel = getMemberLevel(); + voList.forEach(vo -> vo.setVipPrice(calculateVipPrice(vo.getPrice(), memberLevel))); + return success(voList); + } + @GetMapping("/page") @Operation(summary = "获得商品 SPU 分页") public CommonResult> getSpuPage(@Valid AppProductSpuPageReqVO pageVO) { 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 c4a66afd2..07b0d8e95 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 @@ -15,6 +15,9 @@ public class AppProductSpuPageRespVO { @Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋道") private String name; + @Schema(description = "商品简介", requiredMode = Schema.RequiredMode.REQUIRED, example = "清凉小短袖简介") + private String introduction; + @Schema(description = "分类编号", requiredMode = Schema.RequiredMode.REQUIRED) private Long categoryId;