From 5c9a99c83e004a5557bf69aba2fd3f49f3747e58 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 25 Jun 2023 17:40:04 +0800 Subject: [PATCH] =?UTF-8?q?mall=20+=20promotion=EF=BC=9A=201=E3=80=81mock?= =?UTF-8?q?=20=E4=BC=98=E6=83=A0=E5=8A=B5=E6=A8=A1=E7=89=88=E5=88=86?= =?UTF-8?q?=E9=A1=B5=202=E3=80=81mock=20=E6=89=B9=E9=87=8F=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=94=B6=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/favorite/AppFavoriteController.java | 14 ++++++-- .../favorite/vo/AppFavoriteBatchReqVO.java | 19 +++++++++++ .../app/favorite/vo/AppFavoriteReqVO.java | 2 +- .../coupon/AppCouponTemplateController.java | 33 +++++++++++++++++-- 4 files changed, 63 insertions(+), 5 deletions(-) create mode 100644 yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/favorite/vo/AppFavoriteBatchReqVO.java diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/favorite/AppFavoriteController.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/favorite/AppFavoriteController.java index 68f6e8010..cb9f73c87 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/favorite/AppFavoriteController.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/favorite/AppFavoriteController.java @@ -4,6 +4,7 @@ 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.framework.security.core.annotations.PreAuthenticated; +import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoriteBatchReqVO; import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoritePageReqVO; import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoriteReqVO; import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoriteRespVO; @@ -43,15 +44,24 @@ public class AppFavoriteController { } @DeleteMapping(value = "/delete") - @Operation(summary = "取消商品收藏") + @Operation(summary = "取消单个商品收藏") @PreAuthenticated public CommonResult deleteFavorite(@RequestBody @Valid AppFavoriteReqVO reqVO) { productFavoriteService.deleteFavorite(getLoginUserId(), reqVO.getSpuId()); return success(Boolean.TRUE); } + @DeleteMapping(value = "/delete-list") + @Operation(summary = "取消多个商品收藏") + @PreAuthenticated + public CommonResult deleteFavoriteList(@RequestBody @Valid AppFavoriteBatchReqVO reqVO) { + // todo @jason:待实现 +// productFavoriteService.deleteFavorite(getLoginUserId(), reqVO.getSpuId()); + return success(Boolean.TRUE); + } + @GetMapping(value = "/page") - @Operation(summary = "分页获取商品收藏列表") + @Operation(summary = "获得商品收藏分页") @PreAuthenticated public CommonResult> getFavoritePage(AppFavoritePageReqVO reqVO) { PageResult favoritePage = productFavoriteService.getFavoritePage(getLoginUserId(), reqVO); diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/favorite/vo/AppFavoriteBatchReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/favorite/vo/AppFavoriteBatchReqVO.java new file mode 100644 index 000000000..fbb1afb9e --- /dev/null +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/favorite/vo/AppFavoriteBatchReqVO.java @@ -0,0 +1,19 @@ +package cn.iocoder.yudao.module.product.controller.app.favorite.vo; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import javax.validation.constraints.NotEmpty; +import java.util.List; + +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; + +@Schema(description = "用户 APP - 商品收藏的批量 Request VO") // 用于收藏、取消收藏、获取收藏 +@Data +public class AppFavoriteBatchReqVO { + + @Schema(description = "商品 SPU 编号数组", requiredMode = REQUIRED, example = "29502") + @NotEmpty(message = "商品 SPU 编号数组不能为空") + private List spuIds; + +} diff --git a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/favorite/vo/AppFavoriteReqVO.java b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/favorite/vo/AppFavoriteReqVO.java index 639de011e..4f95a6bf0 100644 --- a/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/favorite/vo/AppFavoriteReqVO.java +++ b/yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/favorite/vo/AppFavoriteReqVO.java @@ -7,7 +7,7 @@ import javax.validation.constraints.NotNull; import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; -@Schema(description = "用户 APP - 商品收藏 Request VO") // 用于收藏、取消收藏、获取收藏 +@Schema(description = "用户 APP - 商品收藏的单个 Request VO") // 用于收藏、取消收藏、获取收藏 @Data public class AppFavoriteReqVO { diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/coupon/AppCouponTemplateController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/coupon/AppCouponTemplateController.java index 8c6521803..7446b04b0 100755 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/coupon/AppCouponTemplateController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/coupon/AppCouponTemplateController.java @@ -74,11 +74,40 @@ public class AppCouponTemplateController { return success(list); } - // TODO 芋艿:待实现 + // TODO 芋艿:待实现;和 getCouponTemplateList 类似 @GetMapping("/page") @Operation(summary = "获得优惠劵模版分页") public CommonResult> getCouponTemplatePage(AppCouponTemplatePageReqVO pageReqVO) { - return null; + List list = new ArrayList<>(); + Random random = new Random(); + for (int i = 0; i < 10; i++) { + AppCouponTemplateRespVO vo = new AppCouponTemplateRespVO(); + vo.setId(i + 1L); + vo.setName("优惠劵" + (i + 1)); + vo.setTakeLimitCount(random.nextInt(10) + 1); + vo.setUsePrice(random.nextInt(100) * 100); + vo.setValidityType(random.nextInt(2) + 1); + if (vo.getValidityType() == 1) { + vo.setValidStartTime(LocalDateTime.now().plusDays(random.nextInt(10))); + vo.setValidEndTime(LocalDateTime.now().plusDays(random.nextInt(20) + 10)); + } else { + vo.setFixedStartTerm(random.nextInt(10)); + vo.setFixedEndTerm(random.nextInt(10) + vo.getFixedStartTerm() + 1); + } + vo.setDiscountType(random.nextInt(2) + 1); + if (vo.getDiscountType() == 1) { + vo.setDiscountPercent(null); + vo.setDiscountPrice(random.nextInt(50) * 100); + vo.setDiscountLimitPrice(null); + } else { + vo.setDiscountPercent(random.nextInt(90) + 10); + vo.setDiscountPrice(null); + vo.setDiscountLimitPrice(random.nextInt(200) * 100); + } + vo.setTakeStatus(random.nextBoolean()); + list.add(vo); + } + return success(new PageResult<>(list, 20L)); } }