From c33bd38b5dc1373f011b72245d25424442bd8336 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 21 Jun 2023 23:45:59 +0800 Subject: [PATCH] =?UTF-8?q?mall=20+=20promotion=EF=BC=9A=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=A0=8D=E4=BB=B7=E8=AE=B0=E5=BD=95=E7=9A=84=20mock?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/bargain/AppBargainHelpController.java | 45 +++++++++++++++++++ .../bargain/AppBargainRecordController.java | 15 ++++--- .../vo/help/AppBargainHelpCreateReqVO.java | 16 +++++++ .../bargain/vo/help/AppBargainHelpRespVO.java | 24 ++++++++++ .../record/AppBargainRecordCreateReqVO.java | 16 +++++++ .../record/AppBargainRecordDetailRespVO.java | 1 - 6 files changed, 111 insertions(+), 6 deletions(-) create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainHelpController.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/help/AppBargainHelpCreateReqVO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/help/AppBargainHelpRespVO.java create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/record/AppBargainRecordCreateReqVO.java diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainHelpController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainHelpController.java new file mode 100644 index 000000000..6c05122a8 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainHelpController.java @@ -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 createBargainHelp(@RequestBody AppBargainHelpCreateReqVO reqVO) { + return success(20L); + } + + @GetMapping("/list") + @Operation(summary = "获得砍价助力列表") + // TODO 芋艿:swagger + public CommonResult> getBargainHelpList(@RequestParam("recordId") Long recordId) { + List 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); + } + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainRecordController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainRecordController.java index 27d089049..d8d7303b4 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainRecordController.java +++ b/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; import cn.iocoder.yudao.framework.common.pojo.CommonResult; 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.AppBargainRecordSummaryRespVO; 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.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import java.time.Duration; import java.util.ArrayList; @@ -60,9 +58,16 @@ public class AppBargainRecordController { detail.setPrice(200); detail.setPayPrice(180); 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))); return success(detail); } + @PostMapping("/create") + @Operation(summary = "创建砍价记录", description = "参与拼团活动") + public CommonResult createBargainRecord(@RequestBody AppBargainRecordCreateReqVO reqVO) { + return success(1L); + } + } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/help/AppBargainHelpCreateReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/help/AppBargainHelpCreateReqVO.java new file mode 100644 index 000000000..5ce588c5c --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/help/AppBargainHelpCreateReqVO.java @@ -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; + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/help/AppBargainHelpRespVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/help/AppBargainHelpRespVO.java new file mode 100644 index 000000000..d13dbaaf9 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/help/AppBargainHelpRespVO.java @@ -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; + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/record/AppBargainRecordCreateReqVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/record/AppBargainRecordCreateReqVO.java new file mode 100644 index 000000000..e20482bb3 --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/record/AppBargainRecordCreateReqVO.java @@ -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; + +} diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/record/AppBargainRecordDetailRespVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/record/AppBargainRecordDetailRespVO.java index 02a9a5dfc..2b64924a4 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/record/AppBargainRecordDetailRespVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/record/AppBargainRecordDetailRespVO.java @@ -51,5 +51,4 @@ public class AppBargainRecordDetailRespVO { // 6-已帮砍:其他人的,有帮砍过; // 7-帮砍次数已满:其他人的,帮砍次数已满 - }