mall + trade:mock 拼团记录列表的接口

This commit is contained in:
YunaiV 2023-06-16 20:32:03 +08:00
parent af9334c9b2
commit 8ec3733882
5 changed files with 54 additions and 13 deletions

View File

@ -55,7 +55,6 @@ public class DateUtils {
return LocalDateTime.ofInstant(instant, ZoneId.systemDefault()); return LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
} }
@Deprecated
public static Date addTime(Duration duration) { public static Date addTime(Duration duration) {
return new Date(System.currentTimeMillis() + duration.toMillis()); return new Date(System.currentTimeMillis() + duration.toMillis());
} }

View File

@ -1,8 +1,9 @@
package cn.iocoder.yudao.module.promotion.controller.app.combination; package cn.iocoder.yudao.module.promotion.controller.app.combination;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
import cn.iocoder.yudao.module.promotion.controller.app.combination.vo.record.AppCombinationRecordDetailRespVO; 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 cn.iocoder.yudao.module.promotion.controller.app.combination.vo.record.AppCombinationRecordRespVO;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
@ -13,6 +14,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.Max; import javax.validation.constraints.Max;
import java.time.Duration;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -27,18 +29,23 @@ public class AppCombinationRecordController {
@GetMapping("/get-head-list") @GetMapping("/get-head-list")
@Operation(summary = "获得最近 n 条拼团记录(团长发起的)") @Operation(summary = "获得最近 n 条拼团记录(团长发起的)")
public CommonResult<List<AppCombinationRecordSimpleRespVO>> getHeadCombinationRecordList( // TODO @芋艿注解要补全
public CommonResult<List<AppCombinationRecordRespVO>> getHeadCombinationRecordList(
@RequestParam(value = "activityId", required = false) Long activityId,
@RequestParam("status") Integer status, @RequestParam("status") Integer status,
@RequestParam(value = "count", defaultValue = "20") @Max(20) Integer count) { @RequestParam(value = "count", defaultValue = "20") @Max(20) Integer count) {
List<AppCombinationRecordSimpleRespVO> list = new ArrayList<>(); List<AppCombinationRecordRespVO> list = new ArrayList<>();
for (int i = 1; i <= count; i++) { for (int i = 1; i <= count; i++) {
AppCombinationRecordSimpleRespVO record = new AppCombinationRecordSimpleRespVO(); AppCombinationRecordRespVO record = new AppCombinationRecordRespVO();
record.setId((long) i); record.setId((long) i);
record.setNickname("用户" + i); record.setNickname("用户" + i);
record.setAvatar("头像" + i); record.setAvatar("头像" + i);
record.setExpireTime(new Date()); record.setExpireTime(new Date());
record.setUserSize(10); record.setUserSize(10);
record.setUserCount(i); record.setUserCount(i);
record.setPicUrl("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg");
record.setActivityId(1L);
record.setActivityName("活动:" + i);
list.add(record); list.add(record);
} }
return success(list); return success(list);
@ -50,23 +57,29 @@ public class AppCombinationRecordController {
public CommonResult<AppCombinationRecordDetailRespVO> getCombinationRecordDetail(@RequestParam("id") Long id) { public CommonResult<AppCombinationRecordDetailRespVO> getCombinationRecordDetail(@RequestParam("id") Long id) {
AppCombinationRecordDetailRespVO detail = new AppCombinationRecordDetailRespVO(); AppCombinationRecordDetailRespVO detail = new AppCombinationRecordDetailRespVO();
// 团长 // 团长
AppCombinationRecordSimpleRespVO headRecord = new AppCombinationRecordSimpleRespVO(); AppCombinationRecordRespVO headRecord = new AppCombinationRecordRespVO();
headRecord.setId(1L); headRecord.setId(1L);
headRecord.setNickname("用户" + 1); headRecord.setNickname("用户" + 1);
headRecord.setAvatar("头像" + 1); headRecord.setAvatar("头像" + 1);
headRecord.setExpireTime(new Date()); headRecord.setExpireTime(DateUtils.addTime(Duration.ofDays(1)));
headRecord.setUserSize(10); headRecord.setUserSize(10);
headRecord.setUserCount(3); headRecord.setUserCount(3);
headRecord.setStatus(1);
headRecord.setActivityId(10L);
headRecord.setPicUrl("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg");
headRecord.setCombinationPrice(100);
detail.setHeadRecord(headRecord);
// 团员 // 团员
List<AppCombinationRecordSimpleRespVO> list = new ArrayList<>(); List<AppCombinationRecordRespVO> list = new ArrayList<>();
for (int i = 1; i <= 2; i++) { for (int i = 1; i <= 2; i++) {
AppCombinationRecordSimpleRespVO record = new AppCombinationRecordSimpleRespVO(); AppCombinationRecordRespVO record = new AppCombinationRecordRespVO();
record.setId((long) i); record.setId((long) i);
record.setNickname("用户" + i); record.setNickname("用户" + i);
record.setAvatar("头像" + i); record.setAvatar("头像" + i);
record.setExpireTime(new Date()); record.setExpireTime(new Date());
record.setUserSize(10); record.setUserSize(10);
record.setUserCount(i); record.setUserCount(i);
record.setStatus(1);
list.add(record); list.add(record);
} }
detail.setMemberRecords(list); detail.setMemberRecords(list);

View File

@ -10,10 +10,10 @@ import java.util.List;
public class AppCombinationRecordDetailRespVO { public class AppCombinationRecordDetailRespVO {
@Schema(description = "团长的拼团记录", required = true) @Schema(description = "团长的拼团记录", required = true)
private AppCombinationRecordSimpleRespVO headRecord; private AppCombinationRecordRespVO headRecord;
@Schema(description = "成员的拼团记录", required = true) @Schema(description = "成员的拼团记录", required = true)
private List<AppCombinationRecordSimpleRespVO> memberRecords; private List<AppCombinationRecordRespVO> memberRecords;
@Schema(description = "当前用户参团记录对应的订单编号", required = true, example = "1024") // 如果没参团返回 null @Schema(description = "当前用户参团记录对应的订单编号", required = true, example = "1024") // 如果没参团返回 null
private Long orderId; private Long orderId;

View File

@ -5,13 +5,16 @@ import lombok.Data;
import java.util.Date; import java.util.Date;
@Schema(description = "用户 App - 拼团记录精简 Response VO") @Schema(description = "用户 App - 拼团记录 Response VO")
@Data @Data
public class AppCombinationRecordSimpleRespVO { public class AppCombinationRecordRespVO {
@Schema(description = "拼团记录编号", required = true, example = "1024") @Schema(description = "拼团记录编号", required = true, example = "1024")
private Long id; private Long id;
@Schema(description = "拼团活动编号", required = true, example = "1024")
private Long activityId;
@Schema(description = "用户昵称", required = true, example = "1024") @Schema(description = "用户昵称", required = true, example = "1024")
private String nickname; private String nickname;
@ -27,4 +30,18 @@ public class AppCombinationRecordSimpleRespVO {
@Schema(description = "已参团人数", required = true, example = "5") @Schema(description = "已参团人数", required = true, example = "5")
private Integer userCount; private Integer userCount;
@Schema(description = "拼团状态", required = true, example = "1")
private Integer status;
@Schema(description = "商品图片", required = true, example = "https://www.iocoder.cn/1.png")
private String picUrl;
@Schema(description = "拼团金额,单位:分", required = true, example = "100")
private Integer combinationPrice;
// ========== 获得最近 n 条拼团记录团长发起的返回的字段 ==========
@Schema(description = "拼团活动名字", required = true, example = "1024")
private String activityName;
} }

View File

@ -18,6 +18,7 @@ public class AppTradeOrderSettlementReqVO {
@NotNull(message = "交易类型不能为空") @NotNull(message = "交易类型不能为空")
@InEnum(value = TradeOrderTypeEnum.class, message = "交易类型必须是 {value}") @InEnum(value = TradeOrderTypeEnum.class, message = "交易类型必须是 {value}")
@Deprecated // TODO 芋艿后续干掉这个字段对于前端不需要关注这个
private Integer type; private Integer type;
@Schema(description = "商品项数组", required = true) @Schema(description = "商品项数组", required = true)
@ -30,6 +31,17 @@ public class AppTradeOrderSettlementReqVO {
@Schema(description = "优惠劵编号", example = "1024") @Schema(description = "优惠劵编号", example = "1024")
private Long couponId; private Long couponId;
// ========== 秒杀活动相关字段 ==========
@Schema(description = "秒杀活动编号", example = "1024")
private Long seckillActivityId;
// ========== 拼团活动相关字段 ==========
@Schema(description = "拼团活动编号", example = "1024")
private Long combinationActivityId;
@Schema(description = "拼团团长编号", example = "2048")
private Long combinationHeadId;
@Data @Data
@Schema(description = "用户 App - 商品项") @Schema(description = "用户 App - 商品项")
@Valid @Valid