mall + trade:mock 拼团记录详情的接口

This commit is contained in:
YunaiV 2023-06-16 00:12:49 +08:00
parent 1662d17fc9
commit af9334c9b2
6 changed files with 140 additions and 21 deletions

View File

@ -21,7 +21,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@RestController @RestController
@RequestMapping("/promotion/combination-activity") @RequestMapping("/promotion/combination-activity")
@Validated @Validated
public class AppCombinationController { public class AppCombinationActivityController {
@GetMapping("/get-detail") @GetMapping("/get-detail")
@Operation(summary = "获得拼团活动明细") @Operation(summary = "获得拼团活动明细")
@ -33,8 +33,10 @@ public class AppCombinationController {
obj.setId(id); obj.setId(id);
obj.setName("晚九点限时秒杀"); obj.setName("晚九点限时秒杀");
obj.setStatus(1); obj.setStatus(1);
obj.setStartTime(LocalDateTime.of(2023, 6, 11, 0, 0, 0)); obj.setStartTime(LocalDateTime.of(2023, 6, 15, 0, 0, 0));
obj.setEndTime(LocalDateTime.of(2023, 6, 11, 23, 59, 0)); obj.setEndTime(LocalDateTime.of(2023, 6, 15, 23, 59, 0));
obj.setUserSize(2);
obj.setSuccessCount(100);
obj.setSpuId(633L); obj.setSpuId(633L);
// 创建一个Product对象的列表 // 创建一个Product对象的列表
List<AppCombinationActivityDetailRespVO.Product> productList = new ArrayList<>(); List<AppCombinationActivityDetailRespVO.Product> productList = new ArrayList<>();

View File

@ -0,0 +1,78 @@
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.record.AppCombinationRecordDetailRespVO;
import cn.iocoder.yudao.module.promotion.controller.app.combination.vo.record.AppCombinationRecordSimpleRespVO;
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 javax.validation.constraints.Max;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Tag(name = "用户 APP - 拼团活动")
@RestController
@RequestMapping("/promotion/combination-record")
@Validated
public class AppCombinationRecordController {
@GetMapping("/get-head-list")
@Operation(summary = "获得最近 n 条拼团记录(团长发起的)")
public CommonResult<List<AppCombinationRecordSimpleRespVO>> getHeadCombinationRecordList(
@RequestParam("status") Integer status,
@RequestParam(value = "count", defaultValue = "20") @Max(20) Integer count) {
List<AppCombinationRecordSimpleRespVO> list = new ArrayList<>();
for (int i = 1; i <= count; i++) {
AppCombinationRecordSimpleRespVO record = new AppCombinationRecordSimpleRespVO();
record.setId((long) i);
record.setNickname("用户" + i);
record.setAvatar("头像" + i);
record.setExpireTime(new Date());
record.setUserSize(10);
record.setUserCount(i);
list.add(record);
}
return success(list);
}
@GetMapping("/get-detail")
@Operation(summary = "获得拼团记录明细")
@Parameter(name = "id", description = "拼团记录编号", required = true, example = "1024")
public CommonResult<AppCombinationRecordDetailRespVO> getCombinationRecordDetail(@RequestParam("id") Long id) {
AppCombinationRecordDetailRespVO detail = new AppCombinationRecordDetailRespVO();
// 团长
AppCombinationRecordSimpleRespVO headRecord = new AppCombinationRecordSimpleRespVO();
headRecord.setId(1L);
headRecord.setNickname("用户" + 1);
headRecord.setAvatar("头像" + 1);
headRecord.setExpireTime(new Date());
headRecord.setUserSize(10);
headRecord.setUserCount(3);
// 团员
List<AppCombinationRecordSimpleRespVO> list = new ArrayList<>();
for (int i = 1; i <= 2; i++) {
AppCombinationRecordSimpleRespVO record = new AppCombinationRecordSimpleRespVO();
record.setId((long) i);
record.setNickname("用户" + i);
record.setAvatar("头像" + i);
record.setExpireTime(new Date());
record.setUserSize(10);
record.setUserCount(i);
list.add(record);
}
detail.setMemberRecords(list);
// 订单编号
detail.setOrderId(100L);
return success(detail);
}
}

View File

@ -25,18 +25,18 @@ public class AppCombinationActivityDetailRespVO {
@Schema(description = "活动结束时间", required = true) @Schema(description = "活动结束时间", required = true)
private LocalDateTime endTime; private LocalDateTime endTime;
@Schema(description = "拼团人数", required = true, example = "3")
private Integer userSize;
@Schema(description = "成功的拼团数量", required = true, example = "100")
private Integer successCount;
@Schema(description = "商品 SPU 编号", required = true, example = "2048") @Schema(description = "商品 SPU 编号", required = true, example = "2048")
private Long spuId; private Long spuId;
@Schema(description = "商品信息数组", required = true) @Schema(description = "商品信息数组", required = true)
private List<Product> products; private List<Product> products;
@Schema(description = "成功的拼团记录", required = true)
private List<Record> successRecords;
@Schema(description = "进行中的拼团记录", required = true)
private List<Record> runningRecords;
@Schema(description = "商品信息") @Schema(description = "商品信息")
@Data @Data
public static class Product { public static class Product {
@ -55,13 +55,4 @@ public class AppCombinationActivityDetailRespVO {
} }
@Schema(description = "拼团记录")
@Data
public static class Record {
@Schema(description = "拼团记录编号", required = true, example = "1024")
private Long id;
}
} }

View File

@ -0,0 +1,21 @@
package cn.iocoder.yudao.module.promotion.controller.app.combination.vo.record;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Schema(description = "用户 App - 拼团记录详细 Response VO")
@Data
public class AppCombinationRecordDetailRespVO {
@Schema(description = "团长的拼团记录", required = true)
private AppCombinationRecordSimpleRespVO headRecord;
@Schema(description = "成员的拼团记录", required = true)
private List<AppCombinationRecordSimpleRespVO> memberRecords;
@Schema(description = "当前用户参团记录对应的订单编号", required = true, example = "1024") // 如果没参团返回 null
private Long orderId;
}

View File

@ -0,0 +1,30 @@
package cn.iocoder.yudao.module.promotion.controller.app.combination.vo.record;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.Date;
@Schema(description = "用户 App - 拼团记录精简 Response VO")
@Data
public class AppCombinationRecordSimpleRespVO {
@Schema(description = "拼团记录编号", required = true, example = "1024")
private Long id;
@Schema(description = "用户昵称", required = true, example = "1024")
private String nickname;
@Schema(description = "用户头像", required = true, example = "1024")
private String avatar;
@Schema(description = "过期时间", required = true)
private Date expireTime;
@Schema(description = "可参团人数", required = true, example = "10")
private Integer userSize;
@Schema(description = "已参团人数", required = true, example = "5")
private Integer userCount;
}

View File

@ -27,9 +27,6 @@ public class AppSeckillActivitiDetailRespVO {
@Schema(description = "活动结束时间", required = true) @Schema(description = "活动结束时间", required = true)
private LocalDateTime endTime; private LocalDateTime endTime;
private Long successGruopCount;
@Schema(description = "商品 SPU 编号", required = true, example = "2048") @Schema(description = "商品 SPU 编号", required = true, example = "2048")
private Long spuId; private Long spuId;