Commit 5ffc1ac9f34d32c13ddb26711dd21797e286e9ad
1 parent
4f5ac0ed
mall + promotion:增加秒杀活动的 mock 接口
Showing
7 changed files
with
127 additions
and
7 deletions
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/coupon/AppCouponController.java
| @@ -20,7 +20,7 @@ public class AppCouponController { | @@ -20,7 +20,7 @@ public class AppCouponController { | ||
| 20 | 20 | ||
| 21 | // TODO 芋艿:待实现 | 21 | // TODO 芋艿:待实现 |
| 22 | @PostMapping("/take") | 22 | @PostMapping("/take") |
| 23 | - @Operation(description = "领取优惠劵") | 23 | + @Operation(summary = "领取优惠劵") |
| 24 | public CommonResult<Long> takeCoupon(@RequestBody AppCouponTemplatePageReqVO pageReqVO) { | 24 | public CommonResult<Long> takeCoupon(@RequestBody AppCouponTemplatePageReqVO pageReqVO) { |
| 25 | return success(1L); | 25 | return success(1L); |
| 26 | } | 26 | } |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/coupon/AppCouponTemplateController.java
| @@ -34,7 +34,7 @@ public class AppCouponTemplateController { | @@ -34,7 +34,7 @@ public class AppCouponTemplateController { | ||
| 34 | 34 | ||
| 35 | // TODO 芋艿:待实现 | 35 | // TODO 芋艿:待实现 |
| 36 | @GetMapping("/list") | 36 | @GetMapping("/list") |
| 37 | - @Operation(description = "获得优惠劵模版列表") // 目前主要给商品详情使用 | 37 | + @Operation(summary = "获得优惠劵模版列表") // 目前主要给商品详情使用 |
| 38 | @Parameters({ | 38 | @Parameters({ |
| 39 | @Parameter(name = "spuId", description = "商品 SPU 编号", required = true), | 39 | @Parameter(name = "spuId", description = "商品 SPU 编号", required = true), |
| 40 | @Parameter(name = "useType", description = "使用类型"), | 40 | @Parameter(name = "useType", description = "使用类型"), |
| @@ -76,7 +76,7 @@ public class AppCouponTemplateController { | @@ -76,7 +76,7 @@ public class AppCouponTemplateController { | ||
| 76 | 76 | ||
| 77 | // TODO 芋艿:待实现 | 77 | // TODO 芋艿:待实现 |
| 78 | @GetMapping("/page") | 78 | @GetMapping("/page") |
| 79 | - @Operation(description = "获得优惠劵模版分页") | 79 | + @Operation(summary = "获得优惠劵模版分页") |
| 80 | public CommonResult<PageResult<AppCouponTemplateRespVO>> getCouponTemplatePage(AppCouponTemplatePageReqVO pageReqVO) { | 80 | public CommonResult<PageResult<AppCouponTemplateRespVO>> getCouponTemplatePage(AppCouponTemplatePageReqVO pageReqVO) { |
| 81 | return null; | 81 | return null; |
| 82 | } | 82 | } |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillActivityController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.promotion.controller.app.seckill; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 4 | +import cn.iocoder.yudao.module.promotion.controller.app.seckill.vo.AppSeckillActivitiDetailRespVO; | ||
| 5 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 6 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 7 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 8 | +import org.springframework.validation.annotation.Validated; | ||
| 9 | +import org.springframework.web.bind.annotation.GetMapping; | ||
| 10 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 11 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 12 | +import org.springframework.web.bind.annotation.RestController; | ||
| 13 | + | ||
| 14 | +import java.time.LocalDateTime; | ||
| 15 | +import java.util.ArrayList; | ||
| 16 | +import java.util.List; | ||
| 17 | + | ||
| 18 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 19 | + | ||
| 20 | +@Tag(name = "用户 App - 秒杀活动") | ||
| 21 | +@RestController | ||
| 22 | +@RequestMapping("/promotion/seckill-activity") | ||
| 23 | +@Validated | ||
| 24 | +public class AppSeckillActivityController { | ||
| 25 | + | ||
| 26 | + @GetMapping("/get-detail") | ||
| 27 | + @Operation(summary = "获得秒杀活动明细") | ||
| 28 | + @Parameter(name = "id", description = "活动编号", required = true, example = "1024") | ||
| 29 | + public CommonResult<AppSeckillActivitiDetailRespVO> getSeckillActivity(@RequestParam("id") Long id) { | ||
| 30 | + // TODO 芋艿:如果禁用的时候,需要抛出异常; | ||
| 31 | + AppSeckillActivitiDetailRespVO obj = new AppSeckillActivitiDetailRespVO(); | ||
| 32 | + // 设置其属性的值 | ||
| 33 | + obj.setId(id); | ||
| 34 | + obj.setName("晚九点限时秒杀"); | ||
| 35 | + obj.setStatus(1); | ||
| 36 | + obj.setStartTime(LocalDateTime.of(2023, 6, 10, 0, 0, 0)); | ||
| 37 | + obj.setEndTime(LocalDateTime.of(2023, 6, 10, 23, 59, 0)); | ||
| 38 | + obj.setSpuId(633L); | ||
| 39 | + // 创建一个Product对象的列表 | ||
| 40 | + List<AppSeckillActivitiDetailRespVO.Product> productList = new ArrayList<>(); | ||
| 41 | + // 创建三个新的Product对象并设置其属性的值 | ||
| 42 | + AppSeckillActivitiDetailRespVO.Product product1 = new AppSeckillActivitiDetailRespVO.Product(); | ||
| 43 | + product1.setSkuId(4096L); | ||
| 44 | + product1.setSeckillPrice(100); | ||
| 45 | + product1.setQuota(50); | ||
| 46 | + // 将第一个Product对象添加到列表中 | ||
| 47 | + productList.add(product1); | ||
| 48 | + // 创建第二个Product对象并设置其属性的值 | ||
| 49 | + AppSeckillActivitiDetailRespVO.Product product2 = new AppSeckillActivitiDetailRespVO.Product(); | ||
| 50 | + product2.setSkuId(4097L); | ||
| 51 | + product2.setSeckillPrice(200); | ||
| 52 | + product2.setQuota(100); | ||
| 53 | + // 将第二个Product对象添加到列表中 | ||
| 54 | + productList.add(product2); | ||
| 55 | + // 创建第三个Product对象并设置其属性的值 | ||
| 56 | + AppSeckillActivitiDetailRespVO.Product product3 = new AppSeckillActivitiDetailRespVO.Product(); | ||
| 57 | + product3.setSkuId(4098L); | ||
| 58 | + product3.setSeckillPrice(300); | ||
| 59 | + product3.setQuota(150); | ||
| 60 | + // 将第三个Product对象添加到列表中 | ||
| 61 | + productList.add(product3); | ||
| 62 | + // 将Product列表设置为对象的属性值 | ||
| 63 | + obj.setProducts(productList); | ||
| 64 | + return success(obj); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | +} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/vo/AppSeckillActivitiDetailRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.promotion.controller.app.seckill.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.time.LocalDateTime; | ||
| 7 | +import java.util.List; | ||
| 8 | + | ||
| 9 | +@Schema(description = "用户 App - 秒杀活动 Response VO") | ||
| 10 | +@Data | ||
| 11 | +public class AppSeckillActivitiDetailRespVO { | ||
| 12 | + | ||
| 13 | + @Schema(description = "秒杀活动编号", required = true, example = "1024") | ||
| 14 | + private Long id; | ||
| 15 | + | ||
| 16 | + @Schema(description = "秒杀活动名称", required = true, example = "晚九点限时秒杀") | ||
| 17 | + private String name; | ||
| 18 | + | ||
| 19 | + @Schema(description = "活动状态", required = true, example = "1") | ||
| 20 | + private Integer status; | ||
| 21 | + | ||
| 22 | + // TODO @芋艿:开始时间、结束时间,要和场次结合起来;就是要算到当前场次,是几点哈; | ||
| 23 | + | ||
| 24 | + @Schema(description = "活动开始时间", required = true) | ||
| 25 | + private LocalDateTime startTime; | ||
| 26 | + | ||
| 27 | + @Schema(description = "活动结束时间", required = true) | ||
| 28 | + private LocalDateTime endTime; | ||
| 29 | + | ||
| 30 | + @Schema(description = "商品 SPU 编号", required = true, example = "2048") | ||
| 31 | + private Long spuId; | ||
| 32 | + | ||
| 33 | + @Schema(description = "商品 SPU 名字", required = true) | ||
| 34 | + private List<Product> products; | ||
| 35 | + | ||
| 36 | + @Schema(description = "商品信息") | ||
| 37 | + @Data | ||
| 38 | + public static class Product { | ||
| 39 | + | ||
| 40 | + @Schema(description = "商品 SKU 编号", required = true, example = "4096") | ||
| 41 | + private Long skuId; | ||
| 42 | + | ||
| 43 | + @Schema(description = "秒杀金额,单位:分", required = true, example = "100") | ||
| 44 | + private Integer seckillPrice; | ||
| 45 | + | ||
| 46 | + @Schema(description = "秒杀限量库存", required = true, example = "50") | ||
| 47 | + private Integer quota; | ||
| 48 | + | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | +} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/seckill/seckillactivity/SeckillActivityDO.java
| @@ -37,7 +37,7 @@ public class SeckillActivityDO extends BaseDO { | @@ -37,7 +37,7 @@ public class SeckillActivityDO extends BaseDO { | ||
| 37 | private String name; | 37 | private String name; |
| 38 | /** | 38 | /** |
| 39 | * 活动状态 | 39 | * 活动状态 |
| 40 | - * <p> | 40 | + * |
| 41 | * 枚举 {@link PromotionActivityStatusEnum 对应的类} | 41 | * 枚举 {@link PromotionActivityStatusEnum 对应的类} |
| 42 | */ | 42 | */ |
| 43 | private Integer status; | 43 | private Integer status; |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/seckill/seckillactivity/SeckillProductDO.java
| @@ -53,6 +53,7 @@ public class SeckillProductDO extends BaseDO { | @@ -53,6 +53,7 @@ public class SeckillProductDO extends BaseDO { | ||
| 53 | */ | 53 | */ |
| 54 | private Integer seckillPrice; | 54 | private Integer seckillPrice; |
| 55 | 55 | ||
| 56 | + // TODO @芋艿:改成 quota 限量库存;每次购买时,需要减小; | ||
| 56 | /** | 57 | /** |
| 57 | * 秒杀库存 | 58 | * 秒杀库存 |
| 58 | */ | 59 | */ |
| @@ -61,5 +62,6 @@ public class SeckillProductDO extends BaseDO { | @@ -61,5 +62,6 @@ public class SeckillProductDO extends BaseDO { | ||
| 61 | /** | 62 | /** |
| 62 | * 每人限购 | 63 | * 每人限购 |
| 63 | */ | 64 | */ |
| 64 | - private Integer limitBuyCount; | ||
| 65 | -} | ||
| 66 | \ No newline at end of file | 65 | \ No newline at end of file |
| 66 | + private Integer limitCount; | ||
| 67 | + | ||
| 68 | +} |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.java
| @@ -64,7 +64,7 @@ public class AppTradeOrderController { | @@ -64,7 +64,7 @@ public class AppTradeOrderController { | ||
| 64 | } | 64 | } |
| 65 | 65 | ||
| 66 | @PostMapping("/update-paid") | 66 | @PostMapping("/update-paid") |
| 67 | - @Operation(description = "更新订单为已支付") // 由 pay-module 支付服务,进行回调,可见 PayNotifyJob | 67 | + @Operation(summary = "更新订单为已支付") // 由 pay-module 支付服务,进行回调,可见 PayNotifyJob |
| 68 | public CommonResult<Boolean> updateOrderPaid(@RequestBody PayOrderNotifyReqDTO notifyReqDTO) { | 68 | public CommonResult<Boolean> updateOrderPaid(@RequestBody PayOrderNotifyReqDTO notifyReqDTO) { |
| 69 | tradeOrderService.updateOrderPaid(Long.valueOf(notifyReqDTO.getMerchantOrderId()), | 69 | tradeOrderService.updateOrderPaid(Long.valueOf(notifyReqDTO.getMerchantOrderId()), |
| 70 | notifyReqDTO.getPayOrderId()); | 70 | notifyReqDTO.getPayOrderId()); |