Commit 5c9a99c83e004a5557bf69aba2fd3f49f3747e58
1 parent
bb0bb2a4
mall + promotion:
1、mock 优惠劵模版分页 2、mock 批量删除收藏
Showing
4 changed files
with
63 additions
and
5 deletions
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; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | 6 | import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated; |
| 7 | +import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoriteBatchReqVO; | |
| 7 | 8 | import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoritePageReqVO; |
| 8 | 9 | import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoriteReqVO; |
| 9 | 10 | import cn.iocoder.yudao.module.product.controller.app.favorite.vo.AppFavoriteRespVO; |
| ... | ... | @@ -43,15 +44,24 @@ public class AppFavoriteController { |
| 43 | 44 | } |
| 44 | 45 | |
| 45 | 46 | @DeleteMapping(value = "/delete") |
| 46 | - @Operation(summary = "取消商品收藏") | |
| 47 | + @Operation(summary = "取消单个商品收藏") | |
| 47 | 48 | @PreAuthenticated |
| 48 | 49 | public CommonResult<Boolean> deleteFavorite(@RequestBody @Valid AppFavoriteReqVO reqVO) { |
| 49 | 50 | productFavoriteService.deleteFavorite(getLoginUserId(), reqVO.getSpuId()); |
| 50 | 51 | return success(Boolean.TRUE); |
| 51 | 52 | } |
| 52 | 53 | |
| 54 | + @DeleteMapping(value = "/delete-list") | |
| 55 | + @Operation(summary = "取消多个商品收藏") | |
| 56 | + @PreAuthenticated | |
| 57 | + public CommonResult<Boolean> deleteFavoriteList(@RequestBody @Valid AppFavoriteBatchReqVO reqVO) { | |
| 58 | + // todo @jason:待实现 | |
| 59 | +// productFavoriteService.deleteFavorite(getLoginUserId(), reqVO.getSpuId()); | |
| 60 | + return success(Boolean.TRUE); | |
| 61 | + } | |
| 62 | + | |
| 53 | 63 | @GetMapping(value = "/page") |
| 54 | - @Operation(summary = "分页获取商品收藏列表") | |
| 64 | + @Operation(summary = "获得商品收藏分页") | |
| 55 | 65 | @PreAuthenticated |
| 56 | 66 | public CommonResult<PageResult<AppFavoriteRespVO>> getFavoritePage(AppFavoritePageReqVO reqVO) { |
| 57 | 67 | PageResult<ProductFavoriteDO> favoritePage = productFavoriteService.getFavoritePage(getLoginUserId(), reqVO); | ... | ... |
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/app/favorite/vo/AppFavoriteBatchReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.product.controller.app.favorite.vo; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +import javax.validation.constraints.NotEmpty; | |
| 7 | +import java.util.List; | |
| 8 | + | |
| 9 | +import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; | |
| 10 | + | |
| 11 | +@Schema(description = "用户 APP - 商品收藏的批量 Request VO") // 用于收藏、取消收藏、获取收藏 | |
| 12 | +@Data | |
| 13 | +public class AppFavoriteBatchReqVO { | |
| 14 | + | |
| 15 | + @Schema(description = "商品 SPU 编号数组", requiredMode = REQUIRED, example = "29502") | |
| 16 | + @NotEmpty(message = "商品 SPU 编号数组不能为空") | |
| 17 | + private List<Long> spuIds; | |
| 18 | + | |
| 19 | +} | ... | ... |
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; |
| 7 | 7 | |
| 8 | 8 | import static io.swagger.v3.oas.annotations.media.Schema.RequiredMode.REQUIRED; |
| 9 | 9 | |
| 10 | -@Schema(description = "用户 APP - 商品收藏 Request VO") // 用于收藏、取消收藏、获取收藏 | |
| 10 | +@Schema(description = "用户 APP - 商品收藏的单个 Request VO") // 用于收藏、取消收藏、获取收藏 | |
| 11 | 11 | @Data |
| 12 | 12 | public class AppFavoriteReqVO { |
| 13 | 13 | ... | ... |
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 { |
| 74 | 74 | return success(list); |
| 75 | 75 | } |
| 76 | 76 | |
| 77 | - // TODO 芋艿:待实现 | |
| 77 | + // TODO 芋艿:待实现;和 getCouponTemplateList 类似 | |
| 78 | 78 | @GetMapping("/page") |
| 79 | 79 | @Operation(summary = "获得优惠劵模版分页") |
| 80 | 80 | public CommonResult<PageResult<AppCouponTemplateRespVO>> getCouponTemplatePage(AppCouponTemplatePageReqVO pageReqVO) { |
| 81 | - return null; | |
| 81 | + List<AppCouponTemplateRespVO> list = new ArrayList<>(); | |
| 82 | + Random random = new Random(); | |
| 83 | + for (int i = 0; i < 10; i++) { | |
| 84 | + AppCouponTemplateRespVO vo = new AppCouponTemplateRespVO(); | |
| 85 | + vo.setId(i + 1L); | |
| 86 | + vo.setName("优惠劵" + (i + 1)); | |
| 87 | + vo.setTakeLimitCount(random.nextInt(10) + 1); | |
| 88 | + vo.setUsePrice(random.nextInt(100) * 100); | |
| 89 | + vo.setValidityType(random.nextInt(2) + 1); | |
| 90 | + if (vo.getValidityType() == 1) { | |
| 91 | + vo.setValidStartTime(LocalDateTime.now().plusDays(random.nextInt(10))); | |
| 92 | + vo.setValidEndTime(LocalDateTime.now().plusDays(random.nextInt(20) + 10)); | |
| 93 | + } else { | |
| 94 | + vo.setFixedStartTerm(random.nextInt(10)); | |
| 95 | + vo.setFixedEndTerm(random.nextInt(10) + vo.getFixedStartTerm() + 1); | |
| 96 | + } | |
| 97 | + vo.setDiscountType(random.nextInt(2) + 1); | |
| 98 | + if (vo.getDiscountType() == 1) { | |
| 99 | + vo.setDiscountPercent(null); | |
| 100 | + vo.setDiscountPrice(random.nextInt(50) * 100); | |
| 101 | + vo.setDiscountLimitPrice(null); | |
| 102 | + } else { | |
| 103 | + vo.setDiscountPercent(random.nextInt(90) + 10); | |
| 104 | + vo.setDiscountPrice(null); | |
| 105 | + vo.setDiscountLimitPrice(random.nextInt(200) * 100); | |
| 106 | + } | |
| 107 | + vo.setTakeStatus(random.nextBoolean()); | |
| 108 | + list.add(vo); | |
| 109 | + } | |
| 110 | + return success(new PageResult<>(list, 20L)); | |
| 82 | 111 | } |
| 83 | 112 | |
| 84 | 113 | } | ... | ... |