Commit 8a7f7fd6415e08d8c173d480e93d55a44d829c77

Authored by YunaiV
1 parent fc570b60

mall + promotion:增加拼团的 mock 返回

yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainActivityController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.promotion.controller.app.bargain;
  2 +
  3 +import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  4 +import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.activity.AppBargainActivityRespVO;
  5 +import io.swagger.v3.oas.annotations.Operation;
  6 +import io.swagger.v3.oas.annotations.tags.Tag;
  7 +import org.springframework.validation.annotation.Validated;
  8 +import org.springframework.web.bind.annotation.GetMapping;
  9 +import org.springframework.web.bind.annotation.RequestMapping;
  10 +import org.springframework.web.bind.annotation.RequestParam;
  11 +import org.springframework.web.bind.annotation.RestController;
  12 +
  13 +import java.util.ArrayList;
  14 +import java.util.List;
  15 +
  16 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  17 +
  18 +@Tag(name = "用户 App - 砍价活动")
  19 +@RestController
  20 +@RequestMapping("/promotion/bargain-activity")
  21 +@Validated
  22 +public class AppBargainActivityController {
  23 +
  24 + @GetMapping("/list")
  25 + @Operation(summary = "获得砍价活动列表", description = "用于小程序首页")
  26 + // TODO 芋艿:增加 Spring Cache
  27 + // TODO 芋艿:缺少 swagger 注解
  28 + public CommonResult<List<AppBargainActivityRespVO>> getBargainActivityList(
  29 + @RequestParam(name = "count", defaultValue = "6") Integer count) {
  30 + List<AppBargainActivityRespVO> activityList = new ArrayList<>();
  31 + AppBargainActivityRespVO activity1 = new AppBargainActivityRespVO();
  32 + activity1.setId(1L);
  33 + activity1.setName("618 大砍价");
  34 + activity1.setSpuId(2048L);
  35 + activity1.setPicUrl("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg");
  36 + activity1.setMarketPrice(50);
  37 + activity1.setBargainPrice(100);
  38 + activityList.add(activity1);
  39 +
  40 + AppBargainActivityRespVO activity2 = new AppBargainActivityRespVO();
  41 + activity2.setId(2L);
  42 + activity2.setName("双十一砍价");
  43 + activity2.setSpuId(4096L);
  44 + activity2.setPicUrl("https://thirdwx.qlogo.cn/mmopen/vi_32/Q0j4TwGTfTKXMYJOomfp7cebz3cIeb8sHk3GGSIJtWEgREe3j7J1WoAbTvIOicpcNdFkWAziatBSMod8b5RyS4CQ/132");
  45 + activity2.setMarketPrice(100);
  46 + activity2.setBargainPrice(200);
  47 + activityList.add(activity2);
  48 +
  49 + return success(activityList);
  50 + }
  51 +
  52 +}
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainRecordController.java 0 → 100644
  1 +package cn.iocoder.yudao.module.promotion.controller.app.bargain;
  2 +
  3 +import cn.iocoder.yudao.framework.common.pojo.CommonResult;
  4 +import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record.AppBargainRecordSummaryRespVO;
  5 +import io.swagger.v3.oas.annotations.Operation;
  6 +import io.swagger.v3.oas.annotations.tags.Tag;
  7 +import org.springframework.validation.annotation.Validated;
  8 +import org.springframework.web.bind.annotation.GetMapping;
  9 +import org.springframework.web.bind.annotation.RequestMapping;
  10 +import org.springframework.web.bind.annotation.RestController;
  11 +
  12 +import java.util.ArrayList;
  13 +
  14 +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
  15 +
  16 +@Tag(name = "用户 App - 砍价记录")
  17 +@RestController
  18 +@RequestMapping("/promotion/bargain-record")
  19 +@Validated
  20 +public class AppBargainRecordController {
  21 +
  22 + @GetMapping("/get-summary")
  23 + @Operation(summary = "获得砍价记录的概要信息", description = "用于小程序首页")
  24 + // TODO 芋艿:增加 @Cache 缓存,1 分钟过期
  25 + public CommonResult<AppBargainRecordSummaryRespVO> getBargainRecordSummary() {
  26 + AppBargainRecordSummaryRespVO summary = new AppBargainRecordSummaryRespVO();
  27 + summary.setUserCount(1024);
  28 + summary.setSuccessRecords(new ArrayList<>());
  29 + AppBargainRecordSummaryRespVO.Record record1 = new AppBargainRecordSummaryRespVO.Record();
  30 + record1.setNickname("王**");
  31 + record1.setAvatar("https://www.iocoder.cn/xxx.jpg");
  32 + record1.setActivityName("天蚕土豆");
  33 + AppBargainRecordSummaryRespVO.Record record2 = new AppBargainRecordSummaryRespVO.Record();
  34 + record2.setNickname("张**");
  35 + record2.setAvatar("https://www.iocoder.cn/yyy.jpg");
  36 + record2.setActivityName("斗罗大陆");
  37 + summary.getSuccessRecords().add(record1);
  38 + summary.getSuccessRecords().add(record2);
  39 + return success(summary);
  40 + }
  41 +
  42 +}
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/activity/AppBargainActivityRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.activity;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.Data;
  5 +
  6 +@Schema(description = "用户 App - 砍价活动 Response VO")
  7 +@Data
  8 +public class AppBargainActivityRespVO {
  9 +
  10 + @Schema(description = "砍价活动编号", required = true, example = "1024")
  11 + private Long id;
  12 +
  13 + @Schema(description = "砍价活动名称", required = true, example = "618 大砍价")
  14 + private String name;
  15 +
  16 + @Schema(description = "商品 SPU 编号", required = true, example = "2048")
  17 + private Long spuId;
  18 +
  19 + @Schema(description = "商品图片", required = true, example = "4096") // 从 SPU 的 picUrl 读取
  20 + private String picUrl;
  21 +
  22 + @Schema(description = "商品市场价,单位:分", required = true, example = "50") // 从 SPU 的 marketPrice 读取
  23 + private Integer marketPrice;
  24 +
  25 + @Schema(description = "砍价最低金额,单位:分", required = true, example = "100") // 从砍价商品里取最低价
  26 + private Integer bargainPrice;
  27 +
  28 +}
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/record/AppBargainRecordSummaryRespVO.java 0 → 100644
  1 +package cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record;
  2 +
  3 +import io.swagger.v3.oas.annotations.media.Schema;
  4 +import lombok.Data;
  5 +
  6 +import java.util.List;
  7 +
  8 +@Schema(description = "用户 App - 砍价记录的简要概括 Response VO")
  9 +@Data
  10 +public class AppBargainRecordSummaryRespVO {
  11 +
  12 + @Schema(description = "砍价用户数量", required = true, example = "1024")
  13 + private Integer userCount;
  14 +
  15 + @Schema(description = "成功砍价的记录", required = true) // 只返回最近的 7 个
  16 + private List<Record> successRecords;
  17 +
  18 + @Schema(description = "成功砍价记录")
  19 + @Data
  20 + public static class Record {
  21 +
  22 + @Schema(description = "用户昵称", required = true, example = "王**")
  23 + private String nickname;
  24 +
  25 + @Schema(description = "用户头像", required = true, example = "https://www.iocoder.cn/xxx.jpg")
  26 + private String avatar;
  27 +
  28 + @Schema(description = "活动名称", required = true, example = "天蚕土豆")
  29 + private String activityName;
  30 +
  31 + }
  32 +
  33 +}
... ...
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/AppCombinationRecordController.java
... ... @@ -29,9 +29,9 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
29 29 public class AppCombinationRecordController {
30 30  
31 31 @GetMapping("/get-summary")
32   - @Operation(summary = "获得拼团活动的概要信息", description = "用于小程序首页")
  32 + @Operation(summary = "获得拼团记录的概要信息", description = "用于小程序首页")
33 33 // TODO 芋艿:增加 @Cache 缓存,1 分钟过期
34   - public CommonResult<AppCombinationRecordSummaryRespVO> getCombinationSummary() {
  34 + public CommonResult<AppCombinationRecordSummaryRespVO> getCombinationRecordSummary() {
35 35 AppCombinationRecordSummaryRespVO summary = new AppCombinationRecordSummaryRespVO();
36 36 summary.setUserCount(1024);
37 37 summary.setAvatars(new ArrayList<>());
... ...