mall + promotion:增加砍价记录的 mock

This commit is contained in:
YunaiV 2023-06-21 23:45:59 +08:00
parent 772a982b5f
commit c33bd38b5d
6 changed files with 111 additions and 6 deletions

View File

@ -0,0 +1,45 @@
package cn.iocoder.yudao.module.promotion.controller.app.bargain;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.help.AppBargainHelpCreateReqVO;
import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.help.AppBargainHelpRespVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
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/bargain-help")
@Validated
public class AppBargainHelpController {
@PostMapping("/create")
@Operation(summary = "创建砍价助力", description = "给拼团记录砍一刀") // 返回结果为砍价金额单位
public CommonResult<Long> createBargainHelp(@RequestBody AppBargainHelpCreateReqVO reqVO) {
return success(20L);
}
@GetMapping("/list")
@Operation(summary = "获得砍价助力列表")
// TODO 芋艿swagger
public CommonResult<List<AppBargainHelpRespVO>> getBargainHelpList(@RequestParam("recordId") Long recordId) {
List<AppBargainHelpRespVO> list = new ArrayList<>();
for (int i = 0; i < 10; i++) {
AppBargainHelpRespVO vo = new AppBargainHelpRespVO();
vo.setNickname("用户" + i);
vo.setAvatar("https://www.iocoder.cn/avatar/" + i + ".jpg");
vo.setReducePrice((i + 1) * 100);
vo.setCreateTime(LocalDateTime.now());
list.add(vo);
}
return success(list);
}
}

View File

@ -2,15 +2,13 @@ package cn.iocoder.yudao.module.promotion.controller.app.bargain;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils; import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils;
import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record.AppBargainRecordCreateReqVO;
import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record.AppBargainRecordDetailRespVO; import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record.AppBargainRecordDetailRespVO;
import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record.AppBargainRecordSummaryRespVO; import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record.AppBargainRecordSummaryRespVO;
import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag; import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.time.Duration; import java.time.Duration;
import java.util.ArrayList; import java.util.ArrayList;
@ -60,9 +58,16 @@ public class AppBargainRecordController {
detail.setPrice(200); detail.setPrice(200);
detail.setPayPrice(180); detail.setPayPrice(180);
detail.setStatus(1); detail.setStatus(1);
detail.setAction(AppBargainRecordDetailRespVO.ACTION_SUCCESS); detail.setAction(AppBargainRecordDetailRespVO.ACTION_ORDER_CREATE);
detail.setHelpAction(AppBargainRecordDetailRespVO.HELP_ACTION_NONE);
detail.setExpireTime(LocalDateTimeUtils.addTime(Duration.ofDays(2))); detail.setExpireTime(LocalDateTimeUtils.addTime(Duration.ofDays(2)));
return success(detail); return success(detail);
} }
@PostMapping("/create")
@Operation(summary = "创建砍价记录", description = "参与拼团活动")
public CommonResult<Long> createBargainRecord(@RequestBody AppBargainRecordCreateReqVO reqVO) {
return success(1L);
}
} }

View File

@ -0,0 +1,16 @@
package cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.help;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Schema(description = "用户 App - 砍价助力的创建 Request VO")
@Data
public class AppBargainHelpCreateReqVO {
@Schema(description = "砍价记录编号", required = true, example = "1024")
@NotNull(message = "砍价记录编号不能为空")
private Long recordId;
}

View File

@ -0,0 +1,24 @@
package cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.help;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.time.LocalDateTime;
@Schema(description = "用户 App - 砍价助力 Response VO")
@Data
public class AppBargainHelpRespVO {
@Schema(description = "助力用户的昵称", required = true, example = "1024")
private String nickname;
@Schema(description = "助力用户的头像", required = true, example = "1024")
private String avatar;
@Schema(description = "助力用户的砍价金额", required = true, example = "1024")
private Integer reducePrice;
@Schema(description = "创建时间", required = true, example = "1024")
private LocalDateTime createTime;
}

View File

@ -0,0 +1,16 @@
package cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import javax.validation.constraints.NotNull;
@Schema(description = "用户 App - 砍价记录的创建 Request VO")
@Data
public class AppBargainRecordCreateReqVO {
@Schema(description = "砍价活动编号", required = true, example = "1024")
@NotNull(message = "砍价活动编号不能为空")
private Long activityId;
}

View File

@ -51,5 +51,4 @@ public class AppBargainRecordDetailRespVO {
// 6-已帮砍其他人的有帮砍过 // 6-已帮砍其他人的有帮砍过
// 7-帮砍次数已满其他人的帮砍次数已满 // 7-帮砍次数已满其他人的帮砍次数已满
} }