From c33bd38b5dc1373f011b72245d25424442bd8336 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Wed, 21 Jun 2023 23:45:59 +0800 Subject: [PATCH 1/3] =?UTF-8?q?mall=20+=20promotion=EF=BC=9A=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=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-帮砍次数已满:其他人的,帮砍次数已满 - } From f5b2bb4d7d4c70f9fca48588cedd3f2431b06dbf Mon Sep 17 00:00:00 2001 From: YunaiV Date: Thu, 22 Jun 2023 23:06:16 +0800 Subject: [PATCH 2/3] =?UTF-8?q?mall=20+=20promotion=EF=BC=9A=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=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 --- .../bargain/AppBargainRecordController.java | 74 +++++++++++++++++++ .../vo/record/AppBargainRecordRespVO.java | 32 ++++++++ 2 files changed, 106 insertions(+) create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/record/AppBargainRecordRespVO.java 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 d8d7303b4..78d17c816 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 @@ -1,9 +1,12 @@ package cn.iocoder.yudao.module.promotion.controller.app.bargain; import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageParam; +import cn.iocoder.yudao.framework.common.pojo.PageResult; 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.AppBargainRecordRespVO; 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; @@ -64,6 +67,77 @@ public class AppBargainRecordController { return success(detail); } + @GetMapping("/page") + @Operation(summary = "获得砍价记录的分页") + public CommonResult> getBargainRecordPage(PageParam pageParam) { + PageResult page = new PageResult<>(); + page.setList(new ArrayList<>()); + AppBargainRecordRespVO record1 = new AppBargainRecordRespVO(); + record1.setId(1L); + record1.setUserId(1L); + record1.setSpuId(1L); + record1.setSkuId(1L); + record1.setPrice(500); + record1.setActivityId(1L); + record1.setBargainPrice(150); + record1.setPrice(200); + record1.setPayPrice(180); + record1.setStatus(1); + record1.setPicUrl("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); + record1.setExpireTime(LocalDateTimeUtils.addTime(Duration.ofDays(2))); + page.getList().add(record1); + + AppBargainRecordRespVO record2 = new AppBargainRecordRespVO(); + record2.setId(1L); + record2.setUserId(1L); + record2.setSpuId(1L); + record2.setSkuId(1L); + record2.setPrice(500); + record2.setActivityId(1L); + record2.setBargainPrice(150); + record2.setPrice(200); + record2.setPayPrice(280); + record2.setStatus(2); + record2.setPicUrl("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); + record2.setExpireTime(LocalDateTimeUtils.addTime(Duration.ofDays(2))); + page.getList().add(record2); + + AppBargainRecordRespVO record3 = new AppBargainRecordRespVO(); + record3.setId(1L); + record3.setUserId(1L); + record3.setSpuId(1L); + record3.setSkuId(1L); + record3.setPrice(500); + record3.setActivityId(1L); + record3.setBargainPrice(150); + record3.setPrice(200); + record3.setPayPrice(380); + record3.setStatus(2); + record3.setPicUrl("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); + record3.setExpireTime(LocalDateTimeUtils.addTime(Duration.ofDays(2))); + record3.setOrderId(100L); + page.getList().add(record3); + + AppBargainRecordRespVO record4 = new AppBargainRecordRespVO(); + record4.setId(1L); + record4.setUserId(1L); + record4.setSpuId(1L); + record4.setSkuId(1L); + record4.setPrice(500); + record4.setActivityId(1L); + record4.setBargainPrice(150); + record4.setPrice(200); + record4.setPayPrice(380); + record4.setStatus(3); + record4.setPicUrl("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); + record4.setExpireTime(LocalDateTimeUtils.addTime(Duration.ofDays(2))); + record4.setOrderId(100L); + page.getList().add(record4); + + page.setTotal(1L); + return success(page); + } + @PostMapping("/create") @Operation(summary = "创建砍价记录", description = "参与拼团活动") public CommonResult createBargainRecord(@RequestBody AppBargainRecordCreateReqVO reqVO) { diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/record/AppBargainRecordRespVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/record/AppBargainRecordRespVO.java new file mode 100644 index 000000000..73f2a713e --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/record/AppBargainRecordRespVO.java @@ -0,0 +1,32 @@ +package cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.Data; + +import java.time.LocalDateTime; + +@Schema(description = "用户 App - 砍价记录的 Response VO") +@Data +public class AppBargainRecordRespVO { + + // TODO @芋艿:status;如果砍价对应的订单支付超时,算失败么?砍价的支付时间,以 expireTime 为准么? + + private Long id; + private Long userId; + private Long spuId; + private Long skuId; + private Long activityId; + private Integer bargainPrice; + private Integer price; + private Integer payPrice; + private Integer status; + private LocalDateTime expireTime; + + private Long orderId; + private Boolean payStatus; + private Long payOrderId; + + private String activityName; + private String picUrl; + +} From b0fcd96dfe9a99a0bd8304f71cf52e22c271d859 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 23 Jun 2023 00:26:04 +0800 Subject: [PATCH 3/3] =?UTF-8?q?mall=20+=20promotion=EF=BC=9A=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=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 --- .../bargain/AppBargainRecordController.java | 2 -- .../record/AppBargainRecordDetailRespVO.java | 25 ++----------------- 2 files changed, 2 insertions(+), 25 deletions(-) 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 78d17c816..0df8db49a 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 @@ -61,8 +61,6 @@ public class AppBargainRecordController { detail.setPrice(200); detail.setPayPrice(180); detail.setStatus(1); - detail.setAction(AppBargainRecordDetailRespVO.ACTION_ORDER_CREATE); - detail.setHelpAction(AppBargainRecordDetailRespVO.HELP_ACTION_NONE); detail.setExpireTime(LocalDateTimeUtils.addTime(Duration.ofDays(2))); return success(detail); } 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 2b64924a4..17997015d 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 @@ -9,12 +9,6 @@ import java.time.LocalDateTime; @Data public class AppBargainRecordDetailRespVO { - public static final int ACTION_NONE = 1; // 参与动作 - 未参与,可参与 - public static final int ACTION_WAITING = 2; // 参与动作 - 参与中,等待砍价 - public static final int ACTION_SUCCESS = 3; // 参与动作 - 砍价成功,待下单 - public static final int ACTION_ORDER_CREATE = 4; // 参与动作 - 已下单,未付款 - public static final int ACTION_ORDER_PAY = 5; // 参与动作 - 已下单,已付款 - public static final int HELP_ACTION_NONE = 1; // 帮砍动作 - 未帮砍,可以帮砍 public static final int HELP_ACTION_FULL = 2; // 帮砍动作 - 未帮砍,无法帮砍(可帮砍次数已满) public static final int HELP_ACTION_SUCCESS = 3; // 帮砍动作 - 已帮砍 @@ -31,24 +25,9 @@ public class AppBargainRecordDetailRespVO { private LocalDateTime expireTime; - private Long orderId; // 有且仅在自己的订单才返回 + private Long orderId; + private Boolean payStatus; - private Integer action; private Integer helpAction; - // 【未参与】1-可以参与砍价:storeBargainUser 为空; - // 【未参与】2-参与次数已满:storeBargainUser 为空,但是砍价次数已满;storeBargainUser 非空已支付,但是砍价次数已满 TODO 芋艿:这个就不做了 - // 【参与中】3-砍价中:storeBargainUser 非空,人数未满 - // 【参与中】4-已完成:storeBargainUser 非空,未创建订单 - - // 支付的情况; - // 8-已生成订单未支付:storeBargainUser 不为空(status = 3),但是订单未支付; - // 9-已支付:storeBargainUser 不为空(status = 3),且订单已支付; - // 10-取消支付:storeBargainUser 不为空(status = 3),取消支付;【可忽略】 - - // help 的情况; - // 5-可以帮砍:和 3 对应; - // 6-已帮砍:其他人的,有帮砍过; - // 7-帮砍次数已满:其他人的,帮砍次数已满 - }