Commit d795dbc7ac4dcb3a74add152f6b2bf33e5100d84
1 parent
a93acd2a
mall + promotion:优化限购、库存的返回结果
Showing
4 changed files
with
33 additions
and
25 deletions
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/AppCombinationActivityController.java
| ... | ... | @@ -94,34 +94,31 @@ public class AppCombinationActivityController { |
| 94 | 94 | obj.setName("晚九点限时秒杀"); |
| 95 | 95 | obj.setStatus(1); |
| 96 | 96 | obj.setStartTime(LocalDateTime.of(2023, 6, 15, 0, 0, 0)); |
| 97 | - obj.setEndTime(LocalDateTime.of(2023, 6, 15, 23, 59, 0)); | |
| 97 | + obj.setEndTime(LocalDateTime.of(2023, 6, 20, 23, 59, 0)); | |
| 98 | 98 | obj.setUserSize(2); |
| 99 | 99 | obj.setSuccessCount(100); |
| 100 | 100 | obj.setSpuId(633L); |
| 101 | + obj.setSingleLimitCount(2); | |
| 102 | + obj.setTotalLimitCount(3); | |
| 103 | + | |
| 101 | 104 | // 创建一个Product对象的列表 |
| 102 | 105 | List<AppCombinationActivityDetailRespVO.Product> productList = new ArrayList<>(); |
| 103 | 106 | // 创建三个新的Product对象并设置其属性的值 |
| 104 | 107 | AppCombinationActivityDetailRespVO.Product product1 = new AppCombinationActivityDetailRespVO.Product(); |
| 105 | 108 | product1.setSkuId(1L); |
| 106 | 109 | product1.setCombinationPrice(100); |
| 107 | - product1.setQuota(50); | |
| 108 | - product1.setLimitCount(3); | |
| 109 | 110 | // 将第一个Product对象添加到列表中 |
| 110 | 111 | productList.add(product1); |
| 111 | 112 | // 创建第二个Product对象并设置其属性的值 |
| 112 | 113 | AppCombinationActivityDetailRespVO.Product product2 = new AppCombinationActivityDetailRespVO.Product(); |
| 113 | 114 | product2.setSkuId(2L); |
| 114 | 115 | product2.setCombinationPrice(200); |
| 115 | - product2.setQuota(100); | |
| 116 | - product2.setLimitCount(4); | |
| 117 | 116 | // 将第二个Product对象添加到列表中 |
| 118 | 117 | productList.add(product2); |
| 119 | 118 | // 创建第三个Product对象并设置其属性的值 |
| 120 | 119 | AppCombinationActivityDetailRespVO.Product product3 = new AppCombinationActivityDetailRespVO.Product(); |
| 121 | 120 | product3.setSkuId(3L); |
| 122 | 121 | product3.setCombinationPrice(300); |
| 123 | - product3.setQuota(150); | |
| 124 | - product3.setLimitCount(5); | |
| 125 | 122 | // 将第三个Product对象添加到列表中 |
| 126 | 123 | productList.add(product3); |
| 127 | 124 | // 将Product列表设置为对象的属性值 | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/vo/activity/AppCombinationActivityDetailRespVO.java
| ... | ... | @@ -34,6 +34,12 @@ public class AppCombinationActivityDetailRespVO { |
| 34 | 34 | @Schema(description = "商品 SPU 编号", required = true, example = "2048") |
| 35 | 35 | private Long spuId; |
| 36 | 36 | |
| 37 | + @Schema(description = "总共限购数量", example = "10") | |
| 38 | + private Integer totalLimitCount; | |
| 39 | + | |
| 40 | + @Schema(description = "单次限购数量", example = "5") | |
| 41 | + private Integer singleLimitCount; | |
| 42 | + | |
| 37 | 43 | @Schema(description = "商品信息数组", required = true) |
| 38 | 44 | private List<Product> products; |
| 39 | 45 | |
| ... | ... | @@ -47,12 +53,6 @@ public class AppCombinationActivityDetailRespVO { |
| 47 | 53 | @Schema(description = "拼团金额,单位:分", required = true, example = "100") |
| 48 | 54 | private Integer combinationPrice; |
| 49 | 55 | |
| 50 | - @Schema(description = "拼团限量库存", required = true, example = "50") | |
| 51 | - private Integer quota; | |
| 52 | - | |
| 53 | - @Schema(description = "每人限购数量", required = true, example = "10") | |
| 54 | - private Integer limitCount; | |
| 55 | - | |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | } | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillActivityController.java
| ... | ... | @@ -90,33 +90,35 @@ public class AppSeckillActivityController { |
| 90 | 90 | obj.setId(id); |
| 91 | 91 | obj.setName("晚九点限时秒杀"); |
| 92 | 92 | obj.setStatus(1); |
| 93 | - obj.setStartTime(LocalDateTime.of(2023, 6, 11, 0, 0, 0)); | |
| 94 | - obj.setEndTime(LocalDateTime.of(2023, 6, 11, 23, 59, 0)); | |
| 93 | + obj.setStartTime(LocalDateTime.of(2023, 6, 16, 0, 0, 0)); | |
| 94 | + obj.setEndTime(LocalDateTime.of(2023, 6, 20, 23, 59, 0)); | |
| 95 | 95 | obj.setSpuId(633L); |
| 96 | + obj.setSingleLimitCount(2); | |
| 97 | + obj.setTotalLimitCount(3); | |
| 98 | + obj.setStock(100); | |
| 99 | + obj.setTotalStock(200); | |
| 100 | + | |
| 96 | 101 | // 创建一个Product对象的列表 |
| 97 | 102 | List<AppSeckillActivityDetailRespVO.Product> productList = new ArrayList<>(); |
| 98 | 103 | // 创建三个新的Product对象并设置其属性的值 |
| 99 | 104 | AppSeckillActivityDetailRespVO.Product product1 = new AppSeckillActivityDetailRespVO.Product(); |
| 100 | 105 | product1.setSkuId(1L); |
| 101 | 106 | product1.setSeckillPrice(100); |
| 102 | - product1.setQuota(50); | |
| 103 | - product1.setLimitCount(3); | |
| 107 | + product1.setStock(50); | |
| 104 | 108 | // 将第一个Product对象添加到列表中 |
| 105 | 109 | productList.add(product1); |
| 106 | 110 | // 创建第二个Product对象并设置其属性的值 |
| 107 | 111 | AppSeckillActivityDetailRespVO.Product product2 = new AppSeckillActivityDetailRespVO.Product(); |
| 108 | 112 | product2.setSkuId(2L); |
| 109 | 113 | product2.setSeckillPrice(200); |
| 110 | - product2.setQuota(100); | |
| 111 | - product2.setLimitCount(4); | |
| 114 | + product2.setStock(100); | |
| 112 | 115 | // 将第二个Product对象添加到列表中 |
| 113 | 116 | productList.add(product2); |
| 114 | 117 | // 创建第三个Product对象并设置其属性的值 |
| 115 | 118 | AppSeckillActivityDetailRespVO.Product product3 = new AppSeckillActivityDetailRespVO.Product(); |
| 116 | 119 | product3.setSkuId(3L); |
| 117 | 120 | product3.setSeckillPrice(300); |
| 118 | - product3.setQuota(150); | |
| 119 | - product3.setLimitCount(5); | |
| 121 | + product3.setStock(150); | |
| 120 | 122 | // 将第三个Product对象添加到列表中 |
| 121 | 123 | productList.add(product3); |
| 122 | 124 | // 将Product列表设置为对象的属性值 | ... | ... |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/vo/activity/AppSeckillActivityDetailRespVO.java
| ... | ... | @@ -30,6 +30,18 @@ public class AppSeckillActivityDetailRespVO { |
| 30 | 30 | @Schema(description = "商品 SPU 编号", required = true, example = "2048") |
| 31 | 31 | private Long spuId; |
| 32 | 32 | |
| 33 | + @Schema(description = "总共限购数量", example = "10") | |
| 34 | + private Integer totalLimitCount; | |
| 35 | + | |
| 36 | + @Schema(description = "单次限购数量", example = "5") | |
| 37 | + private Integer singleLimitCount; | |
| 38 | + | |
| 39 | + @Schema(description = "秒杀库存(剩余)", required = true, example = "50") | |
| 40 | + private Integer stock; | |
| 41 | + | |
| 42 | + @Schema(description = "秒杀库存(总计)", required = true, example = "100") | |
| 43 | + private Integer totalStock; | |
| 44 | + | |
| 33 | 45 | @Schema(description = "商品信息数组", required = true) |
| 34 | 46 | private List<Product> products; |
| 35 | 47 | |
| ... | ... | @@ -44,10 +56,7 @@ public class AppSeckillActivityDetailRespVO { |
| 44 | 56 | private Integer seckillPrice; |
| 45 | 57 | |
| 46 | 58 | @Schema(description = "秒杀限量库存", required = true, example = "50") |
| 47 | - private Integer quota; | |
| 48 | - | |
| 49 | - @Schema(description = "每人限购数量", required = true, example = "10") | |
| 50 | - private Integer limitCount; | |
| 59 | + private Integer stock; | |
| 51 | 60 | |
| 52 | 61 | } |
| 53 | 62 | ... | ... |