Commit b849194d82d1c69dacb69894f5fb0259281cf69c
Committed by
Gitee
!1094 【功能完善】商城: APP 积分商城活动完善 app-api 接口
Merge pull request !1094 from puhui999/develop
Showing
12 changed files
with
318 additions
and
17 deletions
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/collection/CollectionUtils.java
| @@ -290,6 +290,15 @@ public class CollectionUtils { | @@ -290,6 +290,15 @@ public class CollectionUtils { | ||
| 290 | return valueFunc.apply(t); | 290 | return valueFunc.apply(t); |
| 291 | } | 291 | } |
| 292 | 292 | ||
| 293 | + public static <T, V extends Comparable<? super V>> T getMinPropertyObj(List<T> from, Function<T, V> valueFunc) { | ||
| 294 | + if (CollUtil.isEmpty(from)) { | ||
| 295 | + return null; | ||
| 296 | + } | ||
| 297 | + assert from.size() > 0; // 断言,避免告警 | ||
| 298 | + return from.stream().min(Comparator.comparing(valueFunc)).get(); | ||
| 299 | + } | ||
| 300 | + | ||
| 301 | + | ||
| 293 | public static <T, V extends Comparable<? super V>> V getSumValue(Collection<T> from, Function<T, V> valueFunc, | 302 | public static <T, V extends Comparable<? super V>> V getSumValue(Collection<T> from, Function<T, V> valueFunc, |
| 294 | BinaryOperator<V> accumulator) { | 303 | BinaryOperator<V> accumulator) { |
| 295 | return getSumValue(from, valueFunc, accumulator, null); | 304 | return getSumValue(from, valueFunc, accumulator, null); |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/point/PointActivityController.java
| 1 | package cn.iocoder.yudao.module.promotion.controller.admin.point; | 1 | package cn.iocoder.yudao.module.promotion.controller.admin.point; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollUtil; | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 6 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | -import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | ||
| 7 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | 7 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 8 | import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi; | 8 | import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi; |
| 9 | import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; | 9 | import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; |
| @@ -28,8 +28,8 @@ import java.util.List; | @@ -28,8 +28,8 @@ import java.util.List; | ||
| 28 | import java.util.Map; | 28 | import java.util.Map; |
| 29 | 29 | ||
| 30 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 30 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 31 | -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMultiMap; | ||
| 32 | -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | 31 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; |
| 32 | +import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.findAndThen; | ||
| 33 | 33 | ||
| 34 | @Tag(name = "管理后台 - 积分商城活动") | 34 | @Tag(name = "管理后台 - 积分商城活动") |
| 35 | @RestController | 35 | @RestController |
| @@ -101,19 +101,41 @@ public class PointActivityController { | @@ -101,19 +101,41 @@ public class PointActivityController { | ||
| 101 | } | 101 | } |
| 102 | 102 | ||
| 103 | // 拼接数据 | 103 | // 拼接数据 |
| 104 | + List<PointActivityRespVO> resultList = buildPointActivityRespVOList(pageResult.getList()); | ||
| 105 | + return success(new PageResult<>(resultList, pageResult.getTotal())); | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + @GetMapping("/list-by-ids") | ||
| 109 | + @Operation(summary = "获得积分商城活动列表,基于活动编号数组") | ||
| 110 | + @Parameter(name = "ids", description = "活动编号数组", required = true, example = "[1024, 1025]") | ||
| 111 | + public CommonResult<List<PointActivityRespVO>> getPointActivityListByIds(@RequestParam("ids") List<Long> ids) { | ||
| 112 | + // 1. 获得开启的活动列表 | ||
| 113 | + List<PointActivityDO> activityList = pointActivityService.getPointActivityListByIds(ids); | ||
| 114 | + activityList.removeIf(activity -> CommonStatusEnum.isDisable(activity.getStatus())); | ||
| 115 | + if (CollUtil.isEmpty(activityList)) { | ||
| 116 | + return success(Collections.emptyList()); | ||
| 117 | + } | ||
| 118 | + // 2. 拼接返回 | ||
| 119 | + List<PointActivityRespVO> result = buildPointActivityRespVOList(activityList); | ||
| 120 | + return success(result); | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + private List<PointActivityRespVO> buildPointActivityRespVOList(List<PointActivityDO> activityList) { | ||
| 104 | List<PointProductDO> products = pointActivityService.getPointProductListByActivityIds( | 124 | List<PointProductDO> products = pointActivityService.getPointProductListByActivityIds( |
| 105 | - convertSet(pageResult.getList(), PointActivityDO::getId)); | 125 | + convertSet(activityList, PointActivityDO::getId)); |
| 106 | Map<Long, List<PointProductDO>> productsMap = convertMultiMap(products, PointProductDO::getActivityId); | 126 | Map<Long, List<PointProductDO>> productsMap = convertMultiMap(products, PointProductDO::getActivityId); |
| 107 | Map<Long, ProductSpuRespDTO> spuMap = productSpuApi.getSpusMap( | 127 | Map<Long, ProductSpuRespDTO> spuMap = productSpuApi.getSpusMap( |
| 108 | - convertSet(pageResult.getList(), PointActivityDO::getSpuId)); | ||
| 109 | - PageResult<PointActivityRespVO> result = BeanUtils.toBean(pageResult, PointActivityRespVO.class); | ||
| 110 | - result.getList().forEach(activity -> { | ||
| 111 | - activity.setProducts(BeanUtils.toBean(productsMap.get(activity.getId()), PointProductRespVO.class)); | ||
| 112 | - MapUtils.findAndThen(spuMap, activity.getSpuId(), | 128 | + convertSet(activityList, PointActivityDO::getSpuId)); |
| 129 | + List<PointActivityRespVO> result = BeanUtils.toBean(activityList, PointActivityRespVO.class); | ||
| 130 | + result.forEach(activity -> { | ||
| 131 | + // 设置 product 信息 | ||
| 132 | + PointProductDO minProduct = getMinPropertyObj(productsMap.get(activity.getId()), PointProductDO::getPoint); | ||
| 133 | + assert minProduct != null; | ||
| 134 | + activity.setPoint(minProduct.getPoint()).setPrice(minProduct.getPrice()); | ||
| 135 | + findAndThen(spuMap, activity.getSpuId(), | ||
| 113 | spu -> activity.setSpuName(spu.getName()).setPicUrl(spu.getPicUrl()).setMarketPrice(spu.getMarketPrice())); | 136 | spu -> activity.setSpuName(spu.getName()).setPicUrl(spu.getPicUrl()).setMarketPrice(spu.getMarketPrice())); |
| 114 | - | ||
| 115 | }); | 137 | }); |
| 116 | - return success(result); | 138 | + return result; |
| 117 | } | 139 | } |
| 118 | 140 | ||
| 119 | } | 141 | } |
| 120 | \ No newline at end of file | 142 | \ No newline at end of file |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/point/vo/activity/PointActivityRespVO.java
| @@ -26,6 +26,14 @@ public class PointActivityRespVO { | @@ -26,6 +26,14 @@ public class PointActivityRespVO { | ||
| 26 | @ExcelProperty("活动状态") | 26 | @ExcelProperty("活动状态") |
| 27 | private Integer status; | 27 | private Integer status; |
| 28 | 28 | ||
| 29 | + @Schema(description = "积分商城活动库存(剩余库存积分兑换时扣减)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | ||
| 30 | + @ExcelProperty("积分商城活动库存(剩余库存积分兑换时扣减)") | ||
| 31 | + private Integer stock; | ||
| 32 | + | ||
| 33 | + @Schema(description = "积分商城活动总库存", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | ||
| 34 | + @ExcelProperty("积分商城活动总库存") | ||
| 35 | + private Integer totalStock; | ||
| 36 | + | ||
| 29 | @Schema(description = "备注", example = "你说的对") | 37 | @Schema(description = "备注", example = "你说的对") |
| 30 | @ExcelProperty("备注") | 38 | @ExcelProperty("备注") |
| 31 | private String remark; | 39 | private String remark; |
| @@ -55,9 +63,6 @@ public class PointActivityRespVO { | @@ -55,9 +63,6 @@ public class PointActivityRespVO { | ||
| 55 | 63 | ||
| 56 | //======================= 显示所需兑换积分最少的 sku 信息 ======================= | 64 | //======================= 显示所需兑换积分最少的 sku 信息 ======================= |
| 57 | 65 | ||
| 58 | - @Schema(description = "可兑换数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "3926") | ||
| 59 | - private Integer maxCount; | ||
| 60 | - | ||
| 61 | @Schema(description = "兑换积分", requiredMode = Schema.RequiredMode.REQUIRED) | 66 | @Schema(description = "兑换积分", requiredMode = Schema.RequiredMode.REQUIRED) |
| 62 | private Integer point; | 67 | private Integer point; |
| 63 | 68 |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/seckill/SeckillActivityController.java
| @@ -102,7 +102,7 @@ public class SeckillActivityController { | @@ -102,7 +102,7 @@ public class SeckillActivityController { | ||
| 102 | @GetMapping("/list-by-ids") | 102 | @GetMapping("/list-by-ids") |
| 103 | @Operation(summary = "获得秒杀活动列表,基于活动编号数组") | 103 | @Operation(summary = "获得秒杀活动列表,基于活动编号数组") |
| 104 | @Parameter(name = "ids", description = "活动编号数组", required = true, example = "[1024, 1025]") | 104 | @Parameter(name = "ids", description = "活动编号数组", required = true, example = "[1024, 1025]") |
| 105 | - public CommonResult<List<SeckillActivityRespVO>> getCombinationActivityListByIds(@RequestParam("ids") List<Long> ids) { | 105 | + public CommonResult<List<SeckillActivityRespVO>> getSeckillActivityListByIds(@RequestParam("ids") List<Long> ids) { |
| 106 | // 1. 获得开启的活动列表 | 106 | // 1. 获得开启的活动列表 |
| 107 | List<SeckillActivityDO> activityList = seckillActivityService.getSeckillActivityListByIds(ids); | 107 | List<SeckillActivityDO> activityList = seckillActivityService.getSeckillActivityListByIds(ids); |
| 108 | activityList.removeIf(activity -> CommonStatusEnum.isDisable(activity.getStatus())); | 108 | activityList.removeIf(activity -> CommonStatusEnum.isDisable(activity.getStatus())); |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/point/AppPointActivityController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.promotion.controller.app.point; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import cn.hutool.core.util.ObjUtil; | ||
| 5 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | ||
| 6 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 7 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 8 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 9 | +import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi; | ||
| 10 | +import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; | ||
| 11 | +import cn.iocoder.yudao.module.promotion.controller.admin.point.vo.activity.PointActivityPageReqVO; | ||
| 12 | +import cn.iocoder.yudao.module.promotion.controller.app.point.vo.AppPointActivityDetailRespVO; | ||
| 13 | +import cn.iocoder.yudao.module.promotion.controller.app.point.vo.AppPointActivityPageReqVO; | ||
| 14 | +import cn.iocoder.yudao.module.promotion.controller.app.point.vo.AppPointActivityRespVO; | ||
| 15 | +import cn.iocoder.yudao.module.promotion.dal.dataobject.point.PointActivityDO; | ||
| 16 | +import cn.iocoder.yudao.module.promotion.dal.dataobject.point.PointProductDO; | ||
| 17 | +import cn.iocoder.yudao.module.promotion.service.point.PointActivityService; | ||
| 18 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 19 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 20 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 21 | +import jakarta.annotation.Resource; | ||
| 22 | +import org.springframework.validation.annotation.Validated; | ||
| 23 | +import org.springframework.web.bind.annotation.GetMapping; | ||
| 24 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 25 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 26 | +import org.springframework.web.bind.annotation.RestController; | ||
| 27 | + | ||
| 28 | +import java.util.Collections; | ||
| 29 | +import java.util.List; | ||
| 30 | +import java.util.Map; | ||
| 31 | + | ||
| 32 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 33 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; | ||
| 34 | +import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.findAndThen; | ||
| 35 | + | ||
| 36 | +@Tag(name = "用户 App - 积分商城活动") | ||
| 37 | +@RestController | ||
| 38 | +@RequestMapping("/promotion/point-activity") | ||
| 39 | +@Validated | ||
| 40 | +public class AppPointActivityController { | ||
| 41 | + | ||
| 42 | + @Resource | ||
| 43 | + private PointActivityService pointActivityService; | ||
| 44 | + | ||
| 45 | + @Resource | ||
| 46 | + private ProductSpuApi productSpuApi; | ||
| 47 | + | ||
| 48 | + @GetMapping("/page") | ||
| 49 | + @Operation(summary = "获得积分商城活动分页") | ||
| 50 | + public CommonResult<PageResult<AppPointActivityRespVO>> getPointActivityPage(AppPointActivityPageReqVO pageReqVO) { | ||
| 51 | + // 1. 查询满足当前阶段的活动 | ||
| 52 | + PageResult<PointActivityDO> pageResult = pointActivityService.getPointActivityPage( | ||
| 53 | + BeanUtils.toBean(pageReqVO, PointActivityPageReqVO.class)); | ||
| 54 | + if (CollUtil.isEmpty(pageResult.getList())) { | ||
| 55 | + return success(PageResult.empty(pageResult.getTotal())); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + // 2. 拼接数据 | ||
| 59 | + List<AppPointActivityRespVO> resultList = buildAppPointActivityRespVOList(pageResult.getList()); | ||
| 60 | + return success(new PageResult<>(resultList, pageResult.getTotal())); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + @GetMapping("/get-detail") | ||
| 64 | + @Operation(summary = "获得积分商城活动明细") | ||
| 65 | + @Parameter(name = "id", description = "活动编号", required = true, example = "1024") | ||
| 66 | + public CommonResult<AppPointActivityDetailRespVO> getPointActivity(@RequestParam("id") Long id) { | ||
| 67 | + // 1. 获取活动 | ||
| 68 | + PointActivityDO activity = pointActivityService.getPointActivity(id); | ||
| 69 | + if (activity == null | ||
| 70 | + || ObjUtil.equal(activity.getStatus(), CommonStatusEnum.DISABLE.getStatus())) { | ||
| 71 | + return success(null); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + // 2. 拼接数据 | ||
| 75 | + List<PointProductDO> products = pointActivityService.getPointProductListByActivityIds(Collections.singletonList(id)); | ||
| 76 | + AppPointActivityDetailRespVO respVO = BeanUtils.toBean(activity, AppPointActivityDetailRespVO.class); | ||
| 77 | + respVO.setProducts(BeanUtils.toBean(products, AppPointActivityDetailRespVO.Product.class)); | ||
| 78 | + return success(respVO); | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + @GetMapping("/list-by-ids") | ||
| 82 | + @Operation(summary = "获得积分商城活动列表,基于活动编号数组") | ||
| 83 | + @Parameter(name = "ids", description = "活动编号数组", required = true, example = "[1024, 1025]") | ||
| 84 | + public CommonResult<List<AppPointActivityRespVO>> getCombinationActivityListByIds(@RequestParam("ids") List<Long> ids) { | ||
| 85 | + // 1. 获得开启的活动列表 | ||
| 86 | + List<PointActivityDO> activityList = pointActivityService.getPointActivityListByIds(ids); | ||
| 87 | + activityList.removeIf(activity -> CommonStatusEnum.isDisable(activity.getStatus())); | ||
| 88 | + if (CollUtil.isEmpty(activityList)) { | ||
| 89 | + return success(Collections.emptyList()); | ||
| 90 | + } | ||
| 91 | + // 2. 拼接返回 | ||
| 92 | + List<AppPointActivityRespVO> result = buildAppPointActivityRespVOList(activityList); | ||
| 93 | + return success(result); | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + private List<AppPointActivityRespVO> buildAppPointActivityRespVOList(List<PointActivityDO> activityList) { | ||
| 97 | + List<PointProductDO> products = pointActivityService.getPointProductListByActivityIds( | ||
| 98 | + convertSet(activityList, PointActivityDO::getId)); | ||
| 99 | + Map<Long, List<PointProductDO>> productsMap = convertMultiMap(products, PointProductDO::getActivityId); | ||
| 100 | + Map<Long, ProductSpuRespDTO> spuMap = productSpuApi.getSpusMap( | ||
| 101 | + convertSet(activityList, PointActivityDO::getSpuId)); | ||
| 102 | + List<AppPointActivityRespVO> result = BeanUtils.toBean(activityList, AppPointActivityRespVO.class); | ||
| 103 | + result.forEach(activity -> { | ||
| 104 | + // 设置 product 信息 | ||
| 105 | + PointProductDO minProduct = getMinPropertyObj(productsMap.get(activity.getId()), PointProductDO::getPoint); | ||
| 106 | + assert minProduct != null; | ||
| 107 | + activity.setPoint(minProduct.getPoint()).setPrice(minProduct.getPrice()); | ||
| 108 | + findAndThen(spuMap, activity.getSpuId(), | ||
| 109 | + spu -> activity.setSpuName(spu.getName()).setPicUrl(spu.getPicUrl()).setMarketPrice(spu.getMarketPrice())); | ||
| 110 | + }); | ||
| 111 | + return result; | ||
| 112 | + } | ||
| 113 | + | ||
| 114 | +} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/point/vo/AppPointActivityDetailRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.promotion.controller.app.point.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.util.List; | ||
| 7 | + | ||
| 8 | +@Schema(description = "用户 App - 积分商城活动的详细 Response VO") | ||
| 9 | +@Data | ||
| 10 | +public class AppPointActivityDetailRespVO { | ||
| 11 | + | ||
| 12 | + @Schema(description = "积分商城活动编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11373") | ||
| 13 | + private Long id; | ||
| 14 | + | ||
| 15 | + @Schema(description = "积分商城活动商品", requiredMode = Schema.RequiredMode.REQUIRED, example = "19509") | ||
| 16 | + private Long spuId; | ||
| 17 | + | ||
| 18 | + @Schema(description = "活动状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | ||
| 19 | + private Integer status; | ||
| 20 | + | ||
| 21 | + @Schema(description = "积分商城活动库存(剩余库存积分兑换时扣减)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | ||
| 22 | + private Integer stock; | ||
| 23 | + | ||
| 24 | + @Schema(description = "积分商城活动总库存", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | ||
| 25 | + private Integer totalStock; | ||
| 26 | + | ||
| 27 | + @Schema(description = "备注", example = "你说的对") | ||
| 28 | + private String remark; | ||
| 29 | + | ||
| 30 | + @Schema(description = "商品信息数组", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 31 | + private List<Product> products; | ||
| 32 | + | ||
| 33 | + @Schema(description = "商品信息") | ||
| 34 | + @Data | ||
| 35 | + public static class Product { | ||
| 36 | + | ||
| 37 | + @Schema(description = "积分商城商品编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "31718") | ||
| 38 | + private Long id; | ||
| 39 | + | ||
| 40 | + @Schema(description = "商品 SKU 编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "2736") | ||
| 41 | + private Long skuId; | ||
| 42 | + | ||
| 43 | + @Schema(description = "可兑换数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "3926") | ||
| 44 | + private Integer count; | ||
| 45 | + | ||
| 46 | + @Schema(description = "兑换积分", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 47 | + private Integer point; | ||
| 48 | + | ||
| 49 | + @Schema(description = "兑换金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "15860") | ||
| 50 | + private Integer price; | ||
| 51 | + | ||
| 52 | + @Schema(description = "积分商城商品库存", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") | ||
| 53 | + private Integer stock; | ||
| 54 | + | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | +} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/point/vo/AppPointActivityPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.promotion.controller.app.point.vo; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | +import lombok.Data; | ||
| 6 | +import lombok.EqualsAndHashCode; | ||
| 7 | +import lombok.ToString; | ||
| 8 | + | ||
| 9 | +@Schema(description = "用户 App - 积分商城活动分页 Request VO") | ||
| 10 | +@Data | ||
| 11 | +@EqualsAndHashCode(callSuper = true) | ||
| 12 | +@ToString(callSuper = true) | ||
| 13 | +public class AppPointActivityPageReqVO extends PageParam { | ||
| 14 | + | ||
| 15 | + | ||
| 16 | +} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/point/vo/AppPointActivityRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.promotion.controller.app.point.vo; | ||
| 2 | + | ||
| 3 | +import com.alibaba.excel.annotation.ExcelProperty; | ||
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +import java.time.LocalDateTime; | ||
| 8 | + | ||
| 9 | +@Schema(description = "用户 App - 积分商城活动 Response VO") | ||
| 10 | +@Data | ||
| 11 | +public class AppPointActivityRespVO { | ||
| 12 | + | ||
| 13 | + @Schema(description = "积分商城活动编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "11373") | ||
| 14 | + @ExcelProperty("积分商城活动编号") | ||
| 15 | + private Long id; | ||
| 16 | + | ||
| 17 | + @Schema(description = "积分商城活动商品", requiredMode = Schema.RequiredMode.REQUIRED, example = "19509") | ||
| 18 | + @ExcelProperty("积分商城活动商品") | ||
| 19 | + private Long spuId; | ||
| 20 | + | ||
| 21 | + @Schema(description = "活动状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | ||
| 22 | + @ExcelProperty("活动状态") | ||
| 23 | + private Integer status; | ||
| 24 | + | ||
| 25 | + @Schema(description = "积分商城活动库存(剩余库存积分兑换时扣减)", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | ||
| 26 | + @ExcelProperty("积分商城活动库存(剩余库存积分兑换时扣减)") | ||
| 27 | + private Integer stock; | ||
| 28 | + | ||
| 29 | + @Schema(description = "积分商城活动总库存", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | ||
| 30 | + @ExcelProperty("积分商城活动总库存") | ||
| 31 | + private Integer totalStock; | ||
| 32 | + | ||
| 33 | + @Schema(description = "备注", example = "你说的对") | ||
| 34 | + @ExcelProperty("备注") | ||
| 35 | + private String remark; | ||
| 36 | + | ||
| 37 | + @Schema(description = "排序", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 38 | + @ExcelProperty("排序") | ||
| 39 | + private Integer sort; | ||
| 40 | + | ||
| 41 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 42 | + @ExcelProperty("创建时间") | ||
| 43 | + private LocalDateTime createTime; | ||
| 44 | + | ||
| 45 | + // ========== 商品字段 ========== | ||
| 46 | + | ||
| 47 | + @Schema(description = "商品名称", requiredMode = Schema.RequiredMode.REQUIRED, // 从 SPU 的 name 读取 | ||
| 48 | + example = "618大促") | ||
| 49 | + private String spuName; | ||
| 50 | + @Schema(description = "商品主图", requiredMode = Schema.RequiredMode.REQUIRED, // 从 SPU 的 picUrl 读取 | ||
| 51 | + example = "https://www.iocoder.cn/xx.png") | ||
| 52 | + private String picUrl; | ||
| 53 | + @Schema(description = "商品市场价,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, // 从 SPU 的 marketPrice 读取 | ||
| 54 | + example = "50") | ||
| 55 | + private Integer marketPrice; | ||
| 56 | + | ||
| 57 | + //======================= 显示所需兑换积分最少的 sku 信息 ======================= | ||
| 58 | + | ||
| 59 | + @Schema(description = "兑换积分", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 60 | + private Integer point; | ||
| 61 | + | ||
| 62 | + @Schema(description = "兑换金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "15860") | ||
| 63 | + private Integer price; | ||
| 64 | + | ||
| 65 | +} |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillActivityController.java
| @@ -151,7 +151,7 @@ public class AppSeckillActivityController { | @@ -151,7 +151,7 @@ public class AppSeckillActivityController { | ||
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | @GetMapping("/list-by-ids") | 153 | @GetMapping("/list-by-ids") |
| 154 | - @Operation(summary = "获得拼团活动列表,基于活动编号数组") | 154 | + @Operation(summary = "获得秒杀活动列表,基于活动编号数组") |
| 155 | @Parameter(name = "ids", description = "活动编号数组", required = true, example = "[1024, 1025]") | 155 | @Parameter(name = "ids", description = "活动编号数组", required = true, example = "[1024, 1025]") |
| 156 | public CommonResult<List<AppSeckillActivityRespVO>> getCombinationActivityListByIds(@RequestParam("ids") List<Long> ids) { | 156 | public CommonResult<List<AppSeckillActivityRespVO>> getCombinationActivityListByIds(@RequestParam("ids") List<Long> ids) { |
| 157 | // 1. 获得开启的活动列表 | 157 | // 1. 获得开启的活动列表 |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/point/PointActivityService.java
| @@ -63,6 +63,14 @@ public interface PointActivityService { | @@ -63,6 +63,14 @@ public interface PointActivityService { | ||
| 63 | PageResult<PointActivityDO> getPointActivityPage(PointActivityPageReqVO pageReqVO); | 63 | PageResult<PointActivityDO> getPointActivityPage(PointActivityPageReqVO pageReqVO); |
| 64 | 64 | ||
| 65 | /** | 65 | /** |
| 66 | + * 获得积分商城活动列表 | ||
| 67 | + * | ||
| 68 | + * @param ids 活动编号 | ||
| 69 | + * @return 积分商城活动列表 | ||
| 70 | + */ | ||
| 71 | + List<PointActivityDO> getPointActivityListByIds(Collection<Long> ids); | ||
| 72 | + | ||
| 73 | + /** | ||
| 66 | * 获得活动商品 | 74 | * 获得活动商品 |
| 67 | * | 75 | * |
| 68 | * @param activityIds 活动编号 | 76 | * @param activityIds 活动编号 |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/point/PointActivityServiceImpl.java
| @@ -235,6 +235,11 @@ public class PointActivityServiceImpl implements PointActivityService { | @@ -235,6 +235,11 @@ public class PointActivityServiceImpl implements PointActivityService { | ||
| 235 | } | 235 | } |
| 236 | 236 | ||
| 237 | @Override | 237 | @Override |
| 238 | + public List<PointActivityDO> getPointActivityListByIds(Collection<Long> ids) { | ||
| 239 | + return pointActivityMapper.selectList(PointActivityDO::getId, ids); | ||
| 240 | + } | ||
| 241 | + | ||
| 242 | + @Override | ||
| 238 | public List<PointProductDO> getPointProductListByActivityIds(Collection<Long> activityIds) { | 243 | public List<PointProductDO> getPointProductListByActivityIds(Collection<Long> activityIds) { |
| 239 | return pointProductMapper.selectListByActivityId(activityIds); | 244 | return pointProductMapper.selectListByActivityId(activityIds); |
| 240 | } | 245 | } |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/seckill/SeckillActivityServiceImpl.java
| @@ -330,7 +330,7 @@ public class SeckillActivityServiceImpl implements SeckillActivityService { | @@ -330,7 +330,7 @@ public class SeckillActivityServiceImpl implements SeckillActivityService { | ||
| 330 | 330 | ||
| 331 | @Override | 331 | @Override |
| 332 | public List<SeckillActivityDO> getSeckillActivityListByIds(Collection<Long> ids) { | 332 | public List<SeckillActivityDO> getSeckillActivityListByIds(Collection<Long> ids) { |
| 333 | - return seckillActivityMapper.selectBatchIds(ids); | 333 | + return seckillActivityMapper.selectList(SeckillActivityDO::getId, ids); |
| 334 | } | 334 | } |
| 335 | 335 | ||
| 336 | } | 336 | } |