Commit c33bd38b5dc1373f011b72245d25424442bd8336
1 parent
772a982b
mall + promotion:增加砍价记录的 mock
Showing
6 changed files
with
111 additions
and
6 deletions
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainHelpController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.promotion.controller.app.bargain; | |
| 2 | + | |
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | |
| 4 | +import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.help.AppBargainHelpCreateReqVO; | |
| 5 | +import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.help.AppBargainHelpRespVO; | |
| 6 | +import io.swagger.v3.oas.annotations.Operation; | |
| 7 | +import io.swagger.v3.oas.annotations.tags.Tag; | |
| 8 | +import org.springframework.validation.annotation.Validated; | |
| 9 | +import org.springframework.web.bind.annotation.*; | |
| 10 | + | |
| 11 | +import java.time.LocalDateTime; | |
| 12 | +import java.util.ArrayList; | |
| 13 | +import java.util.List; | |
| 14 | + | |
| 15 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 16 | + | |
| 17 | +@Tag(name = "用户 App - 砍价助力") | |
| 18 | +@RestController | |
| 19 | +@RequestMapping("/promotion/bargain-help") | |
| 20 | +@Validated | |
| 21 | +public class AppBargainHelpController { | |
| 22 | + | |
| 23 | + @PostMapping("/create") | |
| 24 | + @Operation(summary = "创建砍价助力", description = "给拼团记录砍一刀") // 返回结果为砍价金额,单位:分 | |
| 25 | + public CommonResult<Long> createBargainHelp(@RequestBody AppBargainHelpCreateReqVO reqVO) { | |
| 26 | + return success(20L); | |
| 27 | + } | |
| 28 | + | |
| 29 | + @GetMapping("/list") | |
| 30 | + @Operation(summary = "获得砍价助力列表") | |
| 31 | + // TODO 芋艿:swagger | |
| 32 | + public CommonResult<List<AppBargainHelpRespVO>> getBargainHelpList(@RequestParam("recordId") Long recordId) { | |
| 33 | + List<AppBargainHelpRespVO> list = new ArrayList<>(); | |
| 34 | + for (int i = 0; i < 10; i++) { | |
| 35 | + AppBargainHelpRespVO vo = new AppBargainHelpRespVO(); | |
| 36 | + vo.setNickname("用户" + i); | |
| 37 | + vo.setAvatar("https://www.iocoder.cn/avatar/" + i + ".jpg"); | |
| 38 | + vo.setReducePrice((i + 1) * 100); | |
| 39 | + vo.setCreateTime(LocalDateTime.now()); | |
| 40 | + list.add(vo); | |
| 41 | + } | |
| 42 | + return success(list); | |
| 43 | + } | |
| 44 | + | |
| 45 | +} | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainRecordController.java
| ... | ... | @@ -2,15 +2,13 @@ package cn.iocoder.yudao.module.promotion.controller.app.bargain; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils; |
| 5 | +import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record.AppBargainRecordCreateReqVO; | |
| 5 | 6 | import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record.AppBargainRecordDetailRespVO; |
| 6 | 7 | import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record.AppBargainRecordSummaryRespVO; |
| 7 | 8 | import io.swagger.v3.oas.annotations.Operation; |
| 8 | 9 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 9 | 10 | import org.springframework.validation.annotation.Validated; |
| 10 | -import org.springframework.web.bind.annotation.GetMapping; | |
| 11 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 12 | -import org.springframework.web.bind.annotation.RequestParam; | |
| 13 | -import org.springframework.web.bind.annotation.RestController; | |
| 11 | +import org.springframework.web.bind.annotation.*; | |
| 14 | 12 | |
| 15 | 13 | import java.time.Duration; |
| 16 | 14 | import java.util.ArrayList; |
| ... | ... | @@ -60,9 +58,16 @@ public class AppBargainRecordController { |
| 60 | 58 | detail.setPrice(200); |
| 61 | 59 | detail.setPayPrice(180); |
| 62 | 60 | detail.setStatus(1); |
| 63 | - detail.setAction(AppBargainRecordDetailRespVO.ACTION_SUCCESS); | |
| 61 | + detail.setAction(AppBargainRecordDetailRespVO.ACTION_ORDER_CREATE); | |
| 62 | + detail.setHelpAction(AppBargainRecordDetailRespVO.HELP_ACTION_NONE); | |
| 64 | 63 | detail.setExpireTime(LocalDateTimeUtils.addTime(Duration.ofDays(2))); |
| 65 | 64 | return success(detail); |
| 66 | 65 | } |
| 67 | 66 | |
| 67 | + @PostMapping("/create") | |
| 68 | + @Operation(summary = "创建砍价记录", description = "参与拼团活动") | |
| 69 | + public CommonResult<Long> createBargainRecord(@RequestBody AppBargainRecordCreateReqVO reqVO) { | |
| 70 | + return success(1L); | |
| 71 | + } | |
| 72 | + | |
| 68 | 73 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/help/AppBargainHelpCreateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.help; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +import javax.validation.constraints.NotNull; | |
| 7 | + | |
| 8 | +@Schema(description = "用户 App - 砍价助力的创建 Request VO") | |
| 9 | +@Data | |
| 10 | +public class AppBargainHelpCreateReqVO { | |
| 11 | + | |
| 12 | + @Schema(description = "砍价记录编号", required = true, example = "1024") | |
| 13 | + @NotNull(message = "砍价记录编号不能为空") | |
| 14 | + private Long recordId; | |
| 15 | + | |
| 16 | +} | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/help/AppBargainHelpRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.help; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +import java.time.LocalDateTime; | |
| 7 | + | |
| 8 | +@Schema(description = "用户 App - 砍价助力 Response VO") | |
| 9 | +@Data | |
| 10 | +public class AppBargainHelpRespVO { | |
| 11 | + | |
| 12 | + @Schema(description = "助力用户的昵称", required = true, example = "1024") | |
| 13 | + private String nickname; | |
| 14 | + | |
| 15 | + @Schema(description = "助力用户的头像", required = true, example = "1024") | |
| 16 | + private String avatar; | |
| 17 | + | |
| 18 | + @Schema(description = "助力用户的砍价金额", required = true, example = "1024") | |
| 19 | + private Integer reducePrice; | |
| 20 | + | |
| 21 | + @Schema(description = "创建时间", required = true, example = "1024") | |
| 22 | + private LocalDateTime createTime; | |
| 23 | + | |
| 24 | +} | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/record/AppBargainRecordCreateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record; | |
| 2 | + | |
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | +import lombok.Data; | |
| 5 | + | |
| 6 | +import javax.validation.constraints.NotNull; | |
| 7 | + | |
| 8 | +@Schema(description = "用户 App - 砍价记录的创建 Request VO") | |
| 9 | +@Data | |
| 10 | +public class AppBargainRecordCreateReqVO { | |
| 11 | + | |
| 12 | + @Schema(description = "砍价活动编号", required = true, example = "1024") | |
| 13 | + @NotNull(message = "砍价活动编号不能为空") | |
| 14 | + private Long activityId; | |
| 15 | + | |
| 16 | +} | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/record/AppBargainRecordDetailRespVO.java