Commit bf7f68a04bd39c23cc4c02d222e366c332bdce5d
1 parent
8a7f7fd6
mall + promotion:增加拼团的 mock 返回
Showing
2 changed files
with
50 additions
and
0 deletions
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainActivityController.java
| 1 | 1 | package cn.iocoder.yudao.module.promotion.controller.app.bargain; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | |
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 6 | +import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils; | |
| 4 | 7 | import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.activity.AppBargainActivityRespVO; |
| 5 | 8 | import io.swagger.v3.oas.annotations.Operation; |
| 6 | 9 | import io.swagger.v3.oas.annotations.tags.Tag; |
| ... | ... | @@ -10,6 +13,7 @@ import org.springframework.web.bind.annotation.RequestMapping; |
| 10 | 13 | import org.springframework.web.bind.annotation.RequestParam; |
| 11 | 14 | import org.springframework.web.bind.annotation.RestController; |
| 12 | 15 | |
| 16 | +import java.time.Duration; | |
| 13 | 17 | import java.util.ArrayList; |
| 14 | 18 | import java.util.List; |
| 15 | 19 | |
| ... | ... | @@ -21,6 +25,38 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 21 | 25 | @Validated |
| 22 | 26 | public class AppBargainActivityController { |
| 23 | 27 | |
| 28 | + @GetMapping("/page") | |
| 29 | + @Operation(summary = "获得砍价活动活动") // TODO 芋艿:只查询进行中,且在时间范围内的 | |
| 30 | + // TODO 芋艿:缺少 swagger 注解 | |
| 31 | + public CommonResult<PageResult<AppBargainActivityRespVO>> getBargainActivityPage(PageParam pageReqVO) { | |
| 32 | + List<AppBargainActivityRespVO> activityList = new ArrayList<>(); | |
| 33 | + AppBargainActivityRespVO activity1 = new AppBargainActivityRespVO(); | |
| 34 | + activity1.setId(1L); | |
| 35 | + activity1.setName("618 大砍价"); | |
| 36 | + activity1.setSpuId(2048L); | |
| 37 | + activity1.setPicUrl("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); | |
| 38 | + activity1.setMarketPrice(50); | |
| 39 | + activity1.setBargainPrice(100); | |
| 40 | + activity1.setStartTime(LocalDateTimeUtils.addTime(Duration.ofDays(-2))); | |
| 41 | + activity1.setEndTime(LocalDateTimeUtils.addTime(Duration.ofDays(1))); | |
| 42 | + activity1.setStock(10); | |
| 43 | + activityList.add(activity1); | |
| 44 | + | |
| 45 | + AppBargainActivityRespVO activity2 = new AppBargainActivityRespVO(); | |
| 46 | + activity2.setId(2L); | |
| 47 | + activity2.setName("双十一砍价"); | |
| 48 | + activity2.setSpuId(4096L); | |
| 49 | + activity2.setPicUrl("https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTKXMYJOomfp7cebz3cIeb8sHk3GGSIJtWEgREe3j7J1WoAbTvIOicpcNdFkWAziatBSMod8b5RyS4CQ/132"); | |
| 50 | + activity2.setMarketPrice(100); | |
| 51 | + activity2.setBargainPrice(200); | |
| 52 | + activity2.setStartTime(LocalDateTimeUtils.addTime(Duration.ofDays(-2))); | |
| 53 | + activity2.setEndTime(LocalDateTimeUtils.addTime(Duration.ofDays(1))); | |
| 54 | + activity2.setStock(0); | |
| 55 | + activityList.add(activity2); | |
| 56 | + | |
| 57 | + return success(new PageResult<>(activityList, 10L)); | |
| 58 | + } | |
| 59 | + | |
| 24 | 60 | @GetMapping("/list") |
| 25 | 61 | @Operation(summary = "获得砍价活动列表", description = "用于小程序首页") |
| 26 | 62 | // TODO 芋艿:增加 Spring Cache | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/activity/AppBargainActivityRespVO.java
| ... | ... | @@ -3,6 +3,8 @@ package cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.activity; |
| 3 | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | 4 | import lombok.Data; |
| 5 | 5 | |
| 6 | +import java.time.LocalDateTime; | |
| 7 | + | |
| 6 | 8 | @Schema(description = "用户 App - 砍价活动 Response VO") |
| 7 | 9 | @Data |
| 8 | 10 | public class AppBargainActivityRespVO { |
| ... | ... | @@ -13,9 +15,21 @@ public class AppBargainActivityRespVO { |
| 13 | 15 | @Schema(description = "砍价活动名称", required = true, example = "618 大砍价") |
| 14 | 16 | private String name; |
| 15 | 17 | |
| 18 | + @Schema(description = "活动开始时间", required = true) | |
| 19 | + private LocalDateTime startTime; | |
| 20 | + | |
| 21 | + @Schema(description = "活动结束时间", required = true) | |
| 22 | + private LocalDateTime endTime; | |
| 23 | + | |
| 16 | 24 | @Schema(description = "商品 SPU 编号", required = true, example = "2048") |
| 17 | 25 | private Long spuId; |
| 18 | 26 | |
| 27 | + @Schema(description = "商品 SKU 编号", required = true, example = "1024") | |
| 28 | + private Long skuId; | |
| 29 | + | |
| 30 | + @Schema(description = "砍价库存", required = true, example = "512") | |
| 31 | + private Integer stock; | |
| 32 | + | |
| 19 | 33 | @Schema(description = "商品图片", required = true, example = "4096") // 从 SPU 的 picUrl 读取 |
| 20 | 34 | private String picUrl; |
| 21 | 35 | ... | ... |