mall + trade:mock 拼团活动详情的接口

This commit is contained in:
YunaiV 2023-06-14 23:08:22 +08:00
parent dcb1660880
commit b74991e242
3 changed files with 142 additions and 2 deletions

View File

@ -0,0 +1,70 @@
package cn.iocoder.yudao.module.promotion.controller.app.combination;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.promotion.controller.app.combination.vo.activity.AppCombinationActivityDetailRespVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "用户 APP - 拼团活动")
@RestController
@RequestMapping("/promotion/combination-activity")
@Validated
public class AppCombinationController {
@GetMapping("/get-detail")
@Operation(summary = "获得拼团活动明细")
@Parameter(name = "id", description = "活动编号", required = true, example = "1024")
public CommonResult<AppCombinationActivityDetailRespVO> getCombinationActivity(@RequestParam("id") Long id) {
// TODO 芋艿如果禁用的时候需要抛出异常
AppCombinationActivityDetailRespVO obj = new AppCombinationActivityDetailRespVO();
// 设置其属性的值
obj.setId(id);
obj.setName("晚九点限时秒杀");
obj.setStatus(1);
obj.setStartTime(LocalDateTime.of(2023, 6, 11, 0, 0, 0));
obj.setEndTime(LocalDateTime.of(2023, 6, 11, 23, 59, 0));
obj.setSpuId(633L);
// 创建一个Product对象的列表
List<AppCombinationActivityDetailRespVO.Product> productList = new ArrayList<>();
// 创建三个新的Product对象并设置其属性的值
AppCombinationActivityDetailRespVO.Product product1 = new AppCombinationActivityDetailRespVO.Product();
product1.setSkuId(1L);
product1.setCombinationPrice(100);
product1.setQuota(50);
product1.setLimitCount(3);
// 将第一个Product对象添加到列表中
productList.add(product1);
// 创建第二个Product对象并设置其属性的值
AppCombinationActivityDetailRespVO.Product product2 = new AppCombinationActivityDetailRespVO.Product();
product2.setSkuId(2L);
product2.setCombinationPrice(200);
product2.setQuota(100);
product2.setLimitCount(4);
// 将第二个Product对象添加到列表中
productList.add(product2);
// 创建第三个Product对象并设置其属性的值
AppCombinationActivityDetailRespVO.Product product3 = new AppCombinationActivityDetailRespVO.Product();
product3.setSkuId(3L);
product3.setCombinationPrice(300);
product3.setQuota(150);
product3.setLimitCount(5);
// 将第三个Product对象添加到列表中
productList.add(product3);
// 将Product列表设置为对象的属性值
obj.setProducts(productList);
return success(obj);
}
}

View File

@ -0,0 +1,67 @@
package cn.iocoder.yudao.module.promotion.controller.app.combination.vo.activity;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
import java.util.List;
@Schema(description = "用户 App - 拼团活动明细 Response VO")
@Data
public class AppCombinationActivityDetailRespVO {
@Schema(description = "拼团活动编号", required = true, example = "1024")
private Long id;
@Schema(description = "拼团活动名称", required = true, example = "618 大拼团")
private String name;
@Schema(description = "活动状态", required = true, example = "1")
private Integer status;
@Schema(description = "活动开始时间", required = true)
private LocalDateTime startTime;
@Schema(description = "活动结束时间", required = true)
private LocalDateTime endTime;
@Schema(description = "商品 SPU 编号", required = true, example = "2048")
private Long spuId;
@Schema(description = "商品信息数组", required = true)
private List<Product> products;
@Schema(description = "成功的拼团记录", required = true)
private List<Record> successRecords;
@Schema(description = "进行中的拼团记录", required = true)
private List<Record> runningRecords;
@Schema(description = "商品信息")
@Data
public static class Product {
@Schema(description = "商品 SKU 编号", required = true, example = "4096")
private Long skuId;
@Schema(description = "拼团金额,单位:分", required = true, example = "100")
private Integer combinationPrice;
@Schema(description = "拼团限量库存", required = true, example = "50")
private Integer quota;
@Schema(description = "每人限购数量", required = true, example = "10")
private Integer limitCount;
}
@Schema(description = "拼团记录")
@Data
public static class Record {
@Schema(description = "拼团记录编号", required = true, example = "1024")
private Long id;
}
}

View File

@ -27,10 +27,13 @@ public class AppSeckillActivitiDetailRespVO {
@Schema(description = "活动结束时间", required = true)
private LocalDateTime endTime;
private Long successGruopCount;
@Schema(description = "商品 SPU 编号", required = true, example = "2048")
private Long spuId;
@Schema(description = "商品 SPU 名字", required = true)
@Schema(description = "商品信息数组", required = true)
private List<Product> products;
@Schema(description = "商品信息")
@ -46,7 +49,7 @@ public class AppSeckillActivitiDetailRespVO {
@Schema(description = "秒杀限量库存", required = true, example = "50")
private Integer quota;
@Schema(description = "limitCount", required = true, example = "10")
@Schema(description = "每人限购数量", required = true, example = "10")
private Integer limitCount;
}