Commit 772a982b5f6fb0a373ba4b547f6928b8b9acbc49
1 parent
bf7f68a0
mall + promotion:增加拼团记录的 mock
Showing
4 changed files
with
157 additions
and
0 deletions
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainActivityController.java
| @@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; | @@ -4,6 +4,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.PageParam; | 4 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils; | 6 | import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils; |
| 7 | +import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.activity.AppBargainActivityDetailRespVO; | ||
| 7 | import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.activity.AppBargainActivityRespVO; | 8 | import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.activity.AppBargainActivityRespVO; |
| 8 | import io.swagger.v3.oas.annotations.Operation; | 9 | import io.swagger.v3.oas.annotations.Operation; |
| 9 | import io.swagger.v3.oas.annotations.tags.Tag; | 10 | import io.swagger.v3.oas.annotations.tags.Tag; |
| @@ -85,4 +86,25 @@ public class AppBargainActivityController { | @@ -85,4 +86,25 @@ public class AppBargainActivityController { | ||
| 85 | return success(activityList); | 86 | return success(activityList); |
| 86 | } | 87 | } |
| 87 | 88 | ||
| 89 | + @GetMapping("/get-detail") | ||
| 90 | + @Operation(summary = "获得砍价活动详情") | ||
| 91 | + // TODO 芋艿:缺少 swagger 注解 | ||
| 92 | + public CommonResult<AppBargainActivityDetailRespVO> getBargainActivityDetail(@RequestParam("id") Long id) { | ||
| 93 | + AppBargainActivityDetailRespVO activity = new AppBargainActivityDetailRespVO(); | ||
| 94 | + activity.setId(2L); | ||
| 95 | + activity.setName("618 大砍价"); | ||
| 96 | + activity.setSpuId(2048L); | ||
| 97 | + activity.setPicUrl("https://demo26.crmeb.net/uploads/attach/2021/11/15/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); | ||
| 98 | + activity.setMarketPrice(50); | ||
| 99 | + activity.setBargainPrice(100); | ||
| 100 | + activity.setStock(10); | ||
| 101 | + activity.setUnitName("件"); | ||
| 102 | + activity.setPrice(40); | ||
| 103 | + activity.setStartTime(LocalDateTimeUtils.addTime(Duration.ofDays(-2))); | ||
| 104 | + activity.setEndTime(LocalDateTimeUtils.addTime(Duration.ofDays(-10))); | ||
| 105 | + activity.setDescription("我吃西红柿"); | ||
| 106 | + activity.setSuccessCount(10); | ||
| 107 | + return success(activity); | ||
| 108 | + } | ||
| 109 | + | ||
| 88 | } | 110 | } |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/AppBargainRecordController.java
| 1 | package cn.iocoder.yudao.module.promotion.controller.app.bargain; | 1 | package cn.iocoder.yudao.module.promotion.controller.app.bargain; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 3 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 4 | +import cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils; | ||
| 5 | +import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record.AppBargainRecordDetailRespVO; | ||
| 4 | import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record.AppBargainRecordSummaryRespVO; | 6 | import cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.record.AppBargainRecordSummaryRespVO; |
| 5 | import io.swagger.v3.oas.annotations.Operation; | 7 | import io.swagger.v3.oas.annotations.Operation; |
| 6 | import io.swagger.v3.oas.annotations.tags.Tag; | 8 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 7 | import org.springframework.validation.annotation.Validated; | 9 | import org.springframework.validation.annotation.Validated; |
| 8 | import org.springframework.web.bind.annotation.GetMapping; | 10 | import org.springframework.web.bind.annotation.GetMapping; |
| 9 | import org.springframework.web.bind.annotation.RequestMapping; | 11 | import org.springframework.web.bind.annotation.RequestMapping; |
| 12 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 10 | import org.springframework.web.bind.annotation.RestController; | 13 | import org.springframework.web.bind.annotation.RestController; |
| 11 | 14 | ||
| 15 | +import java.time.Duration; | ||
| 12 | import java.util.ArrayList; | 16 | import java.util.ArrayList; |
| 13 | 17 | ||
| 14 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 18 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| @@ -39,4 +43,26 @@ public class AppBargainRecordController { | @@ -39,4 +43,26 @@ public class AppBargainRecordController { | ||
| 39 | return success(summary); | 43 | return success(summary); |
| 40 | } | 44 | } |
| 41 | 45 | ||
| 46 | + @GetMapping("/get-detail") | ||
| 47 | + @Operation(summary = "获得砍价记录的明细") | ||
| 48 | + // TODO 芋艿:swagger;id 和 activityId 二选一 | ||
| 49 | + public CommonResult<AppBargainRecordDetailRespVO> getBargainRecordDetail( | ||
| 50 | + @RequestParam(value = "id", required = false) Long id, | ||
| 51 | + @RequestParam(value = "activityId", required = false) Long activityId) { | ||
| 52 | + AppBargainRecordDetailRespVO detail = new AppBargainRecordDetailRespVO(); | ||
| 53 | + detail.setId(1L); | ||
| 54 | + detail.setUserId(1L); | ||
| 55 | + detail.setSpuId(1L); | ||
| 56 | + detail.setSkuId(1L); | ||
| 57 | + detail.setPrice(500); | ||
| 58 | + detail.setActivityId(1L); | ||
| 59 | + detail.setBargainPrice(150); | ||
| 60 | + detail.setPrice(200); | ||
| 61 | + detail.setPayPrice(180); | ||
| 62 | + detail.setStatus(1); | ||
| 63 | + detail.setAction(AppBargainRecordDetailRespVO.ACTION_SUCCESS); | ||
| 64 | + detail.setExpireTime(LocalDateTimeUtils.addTime(Duration.ofDays(2))); | ||
| 65 | + return success(detail); | ||
| 66 | + } | ||
| 67 | + | ||
| 42 | } | 68 | } |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/activity/AppBargainActivityDetailRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.promotion.controller.app.bargain.vo.activity; | ||
| 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 AppBargainActivityDetailRespVO { | ||
| 11 | + | ||
| 12 | + @Schema(description = "砍价活动编号", required = true, example = "1024") | ||
| 13 | + private Long id; | ||
| 14 | + | ||
| 15 | + @Schema(description = "砍价活动名称", required = true, example = "618 大砍价") | ||
| 16 | + private String name; | ||
| 17 | + | ||
| 18 | + @Schema(description = "活动开始时间", required = true) | ||
| 19 | + private LocalDateTime startTime; | ||
| 20 | + | ||
| 21 | + @Schema(description = "活动结束时间", required = true) | ||
| 22 | + private LocalDateTime endTime; | ||
| 23 | + | ||
| 24 | + @Schema(description = "商品 SPU 编号", required = true, example = "2048") | ||
| 25 | + private Long spuId; | ||
| 26 | + | ||
| 27 | + @Schema(description = "商品 SKU 编号", required = true, example = "1024") | ||
| 28 | + private Long skuId; | ||
| 29 | + | ||
| 30 | + @Schema(description = "商品价格,单位:分", required = true, example = "100") | ||
| 31 | + private Integer price; | ||
| 32 | + | ||
| 33 | + @Schema(description = "商品描述", required = true, example = "我要吃西红柿") | ||
| 34 | + private String description; | ||
| 35 | + | ||
| 36 | + @Schema(description = "砍价库存", required = true, example = "512") | ||
| 37 | + private Integer stock; | ||
| 38 | + | ||
| 39 | + @Schema(description = "商品图片", required = true, example = "4096") // 从 SPU 的 picUrl 读取 | ||
| 40 | + private String picUrl; | ||
| 41 | + | ||
| 42 | + @Schema(description = "商品市场价,单位:分", required = true, example = "50") // 从 SPU 的 marketPrice 读取 | ||
| 43 | + private Integer marketPrice; | ||
| 44 | + | ||
| 45 | + @Schema(description = "商品单位", required = true, example = "个") // 从 SPU 的 unit 读取,然后转换 | ||
| 46 | + private String unitName; | ||
| 47 | + | ||
| 48 | + @Schema(description = "砍价最低金额,单位:分", required = true, example = "100") // 从砍价商品里取最低价 | ||
| 49 | + private Integer bargainPrice; | ||
| 50 | + | ||
| 51 | + @Schema(description = "砍价成功数量", required = true, example = "100") | ||
| 52 | + private Integer successCount; | ||
| 53 | + | ||
| 54 | +} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/bargain/vo/record/AppBargainRecordDetailRespVO.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 java.time.LocalDateTime; | ||
| 7 | + | ||
| 8 | +@Schema(description = "用户 App - 砍价记录的明细 Response VO") | ||
| 9 | +@Data | ||
| 10 | +public class AppBargainRecordDetailRespVO { | ||
| 11 | + | ||
| 12 | + public static final int ACTION_NONE = 1; // 参与动作 - 未参与,可参与 | ||
| 13 | + public static final int ACTION_WAITING = 2; // 参与动作 - 参与中,等待砍价 | ||
| 14 | + public static final int ACTION_SUCCESS = 3; // 参与动作 - 砍价成功,待下单 | ||
| 15 | + public static final int ACTION_ORDER_CREATE = 4; // 参与动作 - 已下单,未付款 | ||
| 16 | + public static final int ACTION_ORDER_PAY = 5; // 参与动作 - 已下单,已付款 | ||
| 17 | + | ||
| 18 | + public static final int HELP_ACTION_NONE = 1; // 帮砍动作 - 未帮砍,可以帮砍 | ||
| 19 | + public static final int HELP_ACTION_FULL = 2; // 帮砍动作 - 未帮砍,无法帮砍(可帮砍次数已满) | ||
| 20 | + public static final int HELP_ACTION_SUCCESS = 3; // 帮砍动作 - 已帮砍 | ||
| 21 | + | ||
| 22 | + private Long id; | ||
| 23 | + private Long userId; | ||
| 24 | + private Long spuId; | ||
| 25 | + private Long skuId; | ||
| 26 | + private Long activityId; | ||
| 27 | + private Integer bargainPrice; | ||
| 28 | + private Integer price; | ||
| 29 | + private Integer payPrice; | ||
| 30 | + private Integer status; | ||
| 31 | + | ||
| 32 | + private LocalDateTime expireTime; | ||
| 33 | + | ||
| 34 | + private Long orderId; // 有且仅在自己的订单才返回 | ||
| 35 | + | ||
| 36 | + private Integer action; | ||
| 37 | + private Integer helpAction; | ||
| 38 | + | ||
| 39 | + // 【未参与】1-可以参与砍价:storeBargainUser 为空; | ||
| 40 | + // 【未参与】2-参与次数已满:storeBargainUser 为空,但是砍价次数已满;storeBargainUser 非空已支付,但是砍价次数已满 TODO 芋艿:这个就不做了 | ||
| 41 | + // 【参与中】3-砍价中:storeBargainUser 非空,人数未满 | ||
| 42 | + // 【参与中】4-已完成:storeBargainUser 非空,未创建订单 | ||
| 43 | + | ||
| 44 | + // 支付的情况; | ||
| 45 | + // 8-已生成订单未支付:storeBargainUser 不为空(status = 3),但是订单未支付; | ||
| 46 | + // 9-已支付:storeBargainUser 不为空(status = 3),且订单已支付; | ||
| 47 | + // 10-取消支付:storeBargainUser 不为空(status = 3),取消支付;【可忽略】 | ||
| 48 | + | ||
| 49 | + // help 的情况; | ||
| 50 | + // 5-可以帮砍:和 3 对应; | ||
| 51 | + // 6-已帮砍:其他人的,有帮砍过; | ||
| 52 | + // 7-帮砍次数已满:其他人的,帮砍次数已满 | ||
| 53 | + | ||
| 54 | + | ||
| 55 | +} |