Commit b74991e24261edde587713ffbe9b612c56d5be50
1 parent
dcb16608
mall + trade:mock 拼团活动详情的接口
Showing
3 changed files
with
142 additions
and
2 deletions
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/AppCombinationController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.promotion.controller.app.combination; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 4 | +import cn.iocoder.yudao.module.promotion.controller.app.combination.vo.activity.AppCombinationActivityDetailRespVO; | ||
| 5 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 6 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 7 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 8 | +import org.springframework.validation.annotation.Validated; | ||
| 9 | +import org.springframework.web.bind.annotation.GetMapping; | ||
| 10 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 11 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 12 | +import org.springframework.web.bind.annotation.RestController; | ||
| 13 | + | ||
| 14 | +import java.time.LocalDateTime; | ||
| 15 | +import java.util.ArrayList; | ||
| 16 | +import java.util.List; | ||
| 17 | + | ||
| 18 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 19 | + | ||
| 20 | +@Tag(name = "用户 APP - 拼团活动") | ||
| 21 | +@RestController | ||
| 22 | +@RequestMapping("/promotion/combination-activity") | ||
| 23 | +@Validated | ||
| 24 | +public class AppCombinationController { | ||
| 25 | + | ||
| 26 | + @GetMapping("/get-detail") | ||
| 27 | + @Operation(summary = "获得拼团活动明细") | ||
| 28 | + @Parameter(name = "id", description = "活动编号", required = true, example = "1024") | ||
| 29 | + public CommonResult<AppCombinationActivityDetailRespVO> getCombinationActivity(@RequestParam("id") Long id) { | ||
| 30 | + // TODO 芋艿:如果禁用的时候,需要抛出异常; | ||
| 31 | + AppCombinationActivityDetailRespVO obj = new AppCombinationActivityDetailRespVO(); | ||
| 32 | + // 设置其属性的值 | ||
| 33 | + obj.setId(id); | ||
| 34 | + obj.setName("晚九点限时秒杀"); | ||
| 35 | + obj.setStatus(1); | ||
| 36 | + obj.setStartTime(LocalDateTime.of(2023, 6, 11, 0, 0, 0)); | ||
| 37 | + obj.setEndTime(LocalDateTime.of(2023, 6, 11, 23, 59, 0)); | ||
| 38 | + obj.setSpuId(633L); | ||
| 39 | + // 创建一个Product对象的列表 | ||
| 40 | + List<AppCombinationActivityDetailRespVO.Product> productList = new ArrayList<>(); | ||
| 41 | + // 创建三个新的Product对象并设置其属性的值 | ||
| 42 | + AppCombinationActivityDetailRespVO.Product product1 = new AppCombinationActivityDetailRespVO.Product(); | ||
| 43 | + product1.setSkuId(1L); | ||
| 44 | + product1.setCombinationPrice(100); | ||
| 45 | + product1.setQuota(50); | ||
| 46 | + product1.setLimitCount(3); | ||
| 47 | + // 将第一个Product对象添加到列表中 | ||
| 48 | + productList.add(product1); | ||
| 49 | + // 创建第二个Product对象并设置其属性的值 | ||
| 50 | + AppCombinationActivityDetailRespVO.Product product2 = new AppCombinationActivityDetailRespVO.Product(); | ||
| 51 | + product2.setSkuId(2L); | ||
| 52 | + product2.setCombinationPrice(200); | ||
| 53 | + product2.setQuota(100); | ||
| 54 | + product2.setLimitCount(4); | ||
| 55 | + // 将第二个Product对象添加到列表中 | ||
| 56 | + productList.add(product2); | ||
| 57 | + // 创建第三个Product对象并设置其属性的值 | ||
| 58 | + AppCombinationActivityDetailRespVO.Product product3 = new AppCombinationActivityDetailRespVO.Product(); | ||
| 59 | + product3.setSkuId(3L); | ||
| 60 | + product3.setCombinationPrice(300); | ||
| 61 | + product3.setQuota(150); | ||
| 62 | + product3.setLimitCount(5); | ||
| 63 | + // 将第三个Product对象添加到列表中 | ||
| 64 | + productList.add(product3); | ||
| 65 | + // 将Product列表设置为对象的属性值 | ||
| 66 | + obj.setProducts(productList); | ||
| 67 | + return success(obj); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | +} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/vo/activity/AppCombinationActivityDetailRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.promotion.controller.app.combination.vo.activity; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.time.LocalDateTime; | ||
| 7 | +import java.util.List; | ||
| 8 | + | ||
| 9 | +@Schema(description = "用户 App - 拼团活动明细 Response VO") | ||
| 10 | +@Data | ||
| 11 | +public class AppCombinationActivityDetailRespVO { | ||
| 12 | + | ||
| 13 | + @Schema(description = "拼团活动编号", required = true, example = "1024") | ||
| 14 | + private Long id; | ||
| 15 | + | ||
| 16 | + @Schema(description = "拼团活动名称", required = true, example = "618 大拼团") | ||
| 17 | + private String name; | ||
| 18 | + | ||
| 19 | + @Schema(description = "活动状态", required = true, example = "1") | ||
| 20 | + private Integer status; | ||
| 21 | + | ||
| 22 | + @Schema(description = "活动开始时间", required = true) | ||
| 23 | + private LocalDateTime startTime; | ||
| 24 | + | ||
| 25 | + @Schema(description = "活动结束时间", required = true) | ||
| 26 | + private LocalDateTime endTime; | ||
| 27 | + | ||
| 28 | + @Schema(description = "商品 SPU 编号", required = true, example = "2048") | ||
| 29 | + private Long spuId; | ||
| 30 | + | ||
| 31 | + @Schema(description = "商品信息数组", required = true) | ||
| 32 | + private List<Product> products; | ||
| 33 | + | ||
| 34 | + @Schema(description = "成功的拼团记录", required = true) | ||
| 35 | + private List<Record> successRecords; | ||
| 36 | + | ||
| 37 | + @Schema(description = "进行中的拼团记录", required = true) | ||
| 38 | + private List<Record> runningRecords; | ||
| 39 | + | ||
| 40 | + @Schema(description = "商品信息") | ||
| 41 | + @Data | ||
| 42 | + public static class Product { | ||
| 43 | + | ||
| 44 | + @Schema(description = "商品 SKU 编号", required = true, example = "4096") | ||
| 45 | + private Long skuId; | ||
| 46 | + | ||
| 47 | + @Schema(description = "拼团金额,单位:分", required = true, example = "100") | ||
| 48 | + private Integer combinationPrice; | ||
| 49 | + | ||
| 50 | + @Schema(description = "拼团限量库存", required = true, example = "50") | ||
| 51 | + private Integer quota; | ||
| 52 | + | ||
| 53 | + @Schema(description = "每人限购数量", required = true, example = "10") | ||
| 54 | + private Integer limitCount; | ||
| 55 | + | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + @Schema(description = "拼团记录") | ||
| 59 | + @Data | ||
| 60 | + public static class Record { | ||
| 61 | + | ||
| 62 | + @Schema(description = "拼团记录编号", required = true, example = "1024") | ||
| 63 | + private Long id; | ||
| 64 | + | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | +} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/vo/AppSeckillActivitiDetailRespVO.java
| @@ -27,10 +27,13 @@ public class AppSeckillActivitiDetailRespVO { | @@ -27,10 +27,13 @@ public class AppSeckillActivitiDetailRespVO { | ||
| 27 | @Schema(description = "活动结束时间", required = true) | 27 | @Schema(description = "活动结束时间", required = true) |
| 28 | private LocalDateTime endTime; | 28 | private LocalDateTime endTime; |
| 29 | 29 | ||
| 30 | + | ||
| 31 | + private Long successGruopCount; | ||
| 32 | + | ||
| 30 | @Schema(description = "商品 SPU 编号", required = true, example = "2048") | 33 | @Schema(description = "商品 SPU 编号", required = true, example = "2048") |
| 31 | private Long spuId; | 34 | private Long spuId; |
| 32 | 35 | ||
| 33 | - @Schema(description = "商品 SPU 名字", required = true) | 36 | + @Schema(description = "商品信息数组", required = true) |
| 34 | private List<Product> products; | 37 | private List<Product> products; |
| 35 | 38 | ||
| 36 | @Schema(description = "商品信息") | 39 | @Schema(description = "商品信息") |
| @@ -46,7 +49,7 @@ public class AppSeckillActivitiDetailRespVO { | @@ -46,7 +49,7 @@ public class AppSeckillActivitiDetailRespVO { | ||
| 46 | @Schema(description = "秒杀限量库存", required = true, example = "50") | 49 | @Schema(description = "秒杀限量库存", required = true, example = "50") |
| 47 | private Integer quota; | 50 | private Integer quota; |
| 48 | 51 | ||
| 49 | - @Schema(description = "limitCount", required = true, example = "10") | 52 | + @Schema(description = "每人限购数量", required = true, example = "10") |
| 50 | private Integer limitCount; | 53 | private Integer limitCount; |
| 51 | 54 | ||
| 52 | } | 55 | } |