diff --git a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/ErrorCodeConstants.java b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/ErrorCodeConstants.java index c39fbb316..798e59851 100644 --- a/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/ErrorCodeConstants.java +++ b/yudao-module-mall/yudao-module-promotion-api/src/main/java/cn/iocoder/yudao/module/promotion/enums/ErrorCodeConstants.java @@ -56,7 +56,7 @@ public interface ErrorCodeConstants { ErrorCode SECKILL_ACTIVITY_DELETE_FAIL_STATUS_NOT_CLOSED_OR_END = new ErrorCode(1013008004, "秒杀活动未关闭或未结束,不能删除"); ErrorCode SECKILL_ACTIVITY_CLOSE_FAIL_STATUS_CLOSED = new ErrorCode(1013008005, "秒杀活动已关闭,不能重复关闭"); ErrorCode SECKILL_ACTIVITY_UPDATE_STOCK_FAIL = new ErrorCode(1013008006, "秒杀失败,原因秒杀库存不足"); - ErrorCode SECKILL_ACTIVITY_FAIL_STATUS_CLOSED = new ErrorCode(1013008007, "秒杀活动已关闭"); + ErrorCode SECKILL_ACTIVITY_APP_STATUS_CLOSED = new ErrorCode(1013008007, "秒杀活动已关闭"); // ========== 秒杀时段 1013009000 ========== ErrorCode SECKILL_CONFIG_NOT_EXISTS = new ErrorCode(1013009000, "秒杀时段不存在"); @@ -69,6 +69,7 @@ public interface ErrorCodeConstants { ErrorCode COMBINATION_ACTIVITY_STATUS_DISABLE_NOT_UPDATE = new ErrorCode(1013010002, "拼团活动已关闭不能修改"); ErrorCode COMBINATION_ACTIVITY_DELETE_FAIL_STATUS_NOT_CLOSED_OR_END = new ErrorCode(1013010003, "拼团活动未关闭或未结束,不能删除"); ErrorCode COMBINATION_ACTIVITY_STATUS_DISABLE = new ErrorCode(1013010004, "拼团失败,原因:拼团活动已关闭"); + ErrorCode COMBINATION_ACTIVITY_APP_STATUS_DISABLE = new ErrorCode(1013010005, "拼团活动已关闭"); // ========== 拼团记录 1013011000 ========== ErrorCode COMBINATION_RECORD_NOT_EXISTS = new ErrorCode(1013011000, "拼团不存在"); diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/AppCombinationActivityController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/AppCombinationActivityController.java index 75693f90b..e2c8c67bd 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/AppCombinationActivityController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/AppCombinationActivityController.java @@ -1,10 +1,19 @@ package cn.iocoder.yudao.module.promotion.controller.app.combination; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; 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.module.product.api.spu.ProductSpuApi; +import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; import cn.iocoder.yudao.module.promotion.controller.app.combination.vo.activity.AppCombinationActivityDetailRespVO; import cn.iocoder.yudao.module.promotion.controller.app.combination.vo.activity.AppCombinationActivityRespVO; +import cn.iocoder.yudao.module.promotion.convert.combination.CombinationActivityConvert; +import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationActivityDO; +import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationProductDO; +import cn.iocoder.yudao.module.promotion.service.combination.CombinationActivityService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; import io.swagger.v3.oas.annotations.tags.Tag; @@ -14,11 +23,14 @@ import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import java.time.LocalDateTime; -import java.util.ArrayList; +import javax.annotation.Resource; +import java.util.Arrays; import java.util.List; +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; +import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.COMBINATION_ACTIVITY_APP_STATUS_DISABLE; @Tag(name = "用户 APP - 拼团活动") @RestController @@ -26,104 +38,55 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @Validated public class AppCombinationActivityController { + @Resource + private CombinationActivityService activityService; + @Resource + private ProductSpuApi spuApi; + + @GetMapping("/list") @Operation(summary = "获得拼团活动列表", description = "用于小程序首页") - // TODO 芋艿:增加 Spring Cache - // TODO 芋艿:缺少 swagger 注解 + @Parameter(name = "count", description = "需要展示的数量", example = "6") public CommonResult> getCombinationActivityList( @RequestParam(name = "count", defaultValue = "6") Integer count) { - List activityList = new ArrayList<>(); - AppCombinationActivityRespVO activity1 = new AppCombinationActivityRespVO(); - activity1.setId(1L); - activity1.setName("618 大拼团"); - activity1.setUserSize(3); - activity1.setSpuId(2048L); - activity1.setPicUrl("https://static.iocoder.cn/mall/a79f5d2ea6bf0c3c11b2127332dfe2df.jpg"); - activity1.setMarketPrice(50); - activity1.setCombinationPrice(100); - activityList.add(activity1); + List list = activityService.getCombinationActivityAppList(count); + if (CollUtil.isEmpty(list)) { + return success(CombinationActivityConvert.INSTANCE.convertAppList(list)); + } - AppCombinationActivityRespVO activity2 = new AppCombinationActivityRespVO(); - activity2.setId(2L); - activity2.setName("双十一拼团"); - activity2.setUserSize(5); - activity2.setSpuId(4096L); - activity2.setPicUrl("https://static.iocoder.cn/mall/132.jpeg"); - activity2.setMarketPrice(100); - activity2.setCombinationPrice(200); - activityList.add(activity2); - - return success(activityList); + List spuList = spuApi.getSpuList(convertList(list, CombinationActivityDO::getSpuId)); + // TODO 芋艿:增加 Spring Cache + return success(CombinationActivityConvert.INSTANCE.convertAppList(list, spuList)); } @GetMapping("/page") @Operation(summary = "获得拼团活动分页") public CommonResult> getCombinationActivityPage(PageParam pageParam) { - List activityList = new ArrayList<>(); - AppCombinationActivityRespVO activity1 = new AppCombinationActivityRespVO(); - activity1.setId(1L); - activity1.setName("618 大拼团"); - activity1.setUserSize(3); - activity1.setSpuId(2048L); - activity1.setPicUrl("商品图片地址"); - activity1.setMarketPrice(50); - activity1.setCombinationPrice(100); - activityList.add(activity1); + PageResult result = activityService.getCombinationActivityAppPage(pageParam); + if (CollUtil.isEmpty(result.getList())) { + return success(PageResult.empty(result.getTotal())); + } - AppCombinationActivityRespVO activity2 = new AppCombinationActivityRespVO(); - activity2.setId(2L); - activity2.setName("双十一拼团"); - activity2.setUserSize(5); - activity2.setSpuId(4096L); - activity2.setPicUrl("商品图片地址"); - activity2.setMarketPrice(100); - activity2.setCombinationPrice(200); - activityList.add(activity2); - - return success(new PageResult<>(activityList, 2L)); + List spuList = spuApi.getSpuList(convertList(result.getList(), CombinationActivityDO::getSpuId)); + return success(CombinationActivityConvert.INSTANCE.convertAppPage(result, spuList)); } @GetMapping("/get-detail") @Operation(summary = "获得拼团活动明细") @Parameter(name = "id", description = "活动编号", required = true, example = "1024") public CommonResult getCombinationActivityDetail(@RequestParam("id") Long id) { - // TODO 芋艿:如果禁用的时候,需要抛出异常; - AppCombinationActivityDetailRespVO obj = new AppCombinationActivityDetailRespVO(); - // 设置其属性的值 - obj.setId(id); - obj.setName("晚九点限时秒杀"); - obj.setStatus(1); - obj.setStartTime(LocalDateTime.of(2023, 6, 15, 0, 0, 0)); - obj.setEndTime(LocalDateTime.of(2023, 6, 20, 23, 59, 0)); - obj.setUserSize(2); - obj.setSuccessCount(100); - obj.setSpuId(633L); - obj.setSingleLimitCount(2); - obj.setTotalLimitCount(3); + // 1、获取活动 + CombinationActivityDO combinationActivity = activityService.getCombinationActivity(id); + if (combinationActivity == null) { + return success(null); + } + if (ObjectUtil.equal(combinationActivity.getStatus(), CommonStatusEnum.DISABLE.getStatus())) { + throw exception(COMBINATION_ACTIVITY_APP_STATUS_DISABLE); + } - // 创建一个Product对象的列表 - List productList = new ArrayList<>(); - // 创建三个新的Product对象并设置其属性的值 - AppCombinationActivityDetailRespVO.Product product1 = new AppCombinationActivityDetailRespVO.Product(); - product1.setSkuId(1L); - product1.setCombinationPrice(100); - // 将第一个Product对象添加到列表中 - productList.add(product1); - // 创建第二个Product对象并设置其属性的值 - AppCombinationActivityDetailRespVO.Product product2 = new AppCombinationActivityDetailRespVO.Product(); - product2.setSkuId(2L); - product2.setCombinationPrice(200); - // 将第二个Product对象添加到列表中 - productList.add(product2); - // 创建第三个Product对象并设置其属性的值 - AppCombinationActivityDetailRespVO.Product product3 = new AppCombinationActivityDetailRespVO.Product(); - product3.setSkuId(3L); - product3.setCombinationPrice(300); - // 将第三个Product对象添加到列表中 - productList.add(product3); - // 将Product列表设置为对象的属性值 - obj.setProducts(productList); - return success(obj); + // 2、获取活动商品 + List products = activityService.getCombinationProductsByActivityIds(Arrays.asList(combinationActivity.getId())); + return success(CombinationActivityConvert.INSTANCE.convert3(combinationActivity, products)); } } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/vo/activity/AppCombinationActivityRespVO.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/vo/activity/AppCombinationActivityRespVO.java index b536e8abe..64462a377 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/vo/activity/AppCombinationActivityRespVO.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/combination/vo/activity/AppCombinationActivityRespVO.java @@ -28,7 +28,6 @@ public class AppCombinationActivityRespVO { private Integer marketPrice; @Schema(description = "拼团金额,单位:分", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") - // 从拼团商品里取最低价 private Integer combinationPrice; } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillActivityController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillActivityController.java index 8037c36cb..0e047f1a5 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillActivityController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/seckill/AppSeckillActivityController.java @@ -4,7 +4,6 @@ import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.module.product.api.spu.ProductSpuApi; import cn.iocoder.yudao.module.product.api.spu.dto.ProductSpuRespDTO; import cn.iocoder.yudao.module.promotion.controller.app.seckill.vo.activity.AppSeckillActivityDetailRespVO; @@ -33,10 +32,9 @@ import java.util.List; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.filterList; -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.findFirst; +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; import static cn.iocoder.yudao.framework.common.util.date.LocalDateTimeUtils.isBetween; -import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.SECKILL_ACTIVITY_FAIL_STATUS_CLOSED; +import static cn.iocoder.yudao.module.promotion.enums.ErrorCodeConstants.SECKILL_ACTIVITY_APP_STATUS_CLOSED; @Tag(name = "用户 App - 秒杀活动") @RestController @@ -53,8 +51,7 @@ public class AppSeckillActivityController { private ProductSpuApi spuApi; @GetMapping("/get-now") - @Operation(summary = "获得当前秒杀活动") // 提供给首页使用 - // TODO 芋艿:需要增加 spring cache + @Operation(summary = "获得当前秒杀活动", description = "获取当前正在进行的活动,提供给首页使用") public CommonResult getNowSeckillActivity() { // 1、获取当前时间处在哪个秒杀阶段 List configList = configService.getSeckillConfigList(); @@ -69,7 +66,8 @@ public class AppSeckillActivityController { List activityList = activityService.getSeckillActivityListByConfigIds(Arrays.asList(filteredConfig.getId())); List filteredList = filterList(activityList, item -> ObjectUtil.equal(item.getStatus(), CommonStatusEnum.ENABLE.getStatus())); // 2、1 获取 spu 信息 - List spuList = spuApi.getSpuList(CollectionUtils.convertList(filteredList, SeckillActivityDO::getSpuId)); + List spuList = spuApi.getSpuList(convertList(filteredList, SeckillActivityDO::getSpuId)); + // TODO 芋艿:需要增加 spring cache return success(SeckillActivityConvert.INSTANCE.convert(filteredConfig, filteredList, spuList)); } @@ -79,7 +77,7 @@ public class AppSeckillActivityController { // 1、查询满足当前阶段的活动 PageResult pageResult = activityService.getSeckillActivityAppPageByConfigId(pageReqVO); // 1、1 获取 spu 信息 - List spuList = spuApi.getSpuList(CollectionUtils.convertList(pageResult.getList(), SeckillActivityDO::getSpuId)); + List spuList = spuApi.getSpuList(convertList(pageResult.getList(), SeckillActivityDO::getSpuId)); return success(SeckillActivityConvert.INSTANCE.convertPage(pageResult, spuList)); } @@ -101,9 +99,8 @@ public class AppSeckillActivityController { if (seckillActivity == null) { return success(null); } - // TODO 芋艿:如果禁用的时候,需要抛出异常; if (ObjectUtil.equal(seckillActivity.getStatus(), CommonStatusEnum.DISABLE.getStatus())) { - throw exception(SECKILL_ACTIVITY_FAIL_STATUS_CLOSED); + throw exception(SECKILL_ACTIVITY_APP_STATUS_CLOSED); } // 3、获取活动商品 diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/combination/CombinationActivityConvert.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/combination/CombinationActivityConvert.java index a6e086cc2..67b300c44 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/combination/CombinationActivityConvert.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/combination/CombinationActivityConvert.java @@ -13,6 +13,8 @@ import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activit import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityUpdateReqVO; import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.product.CombinationProductBaseVO; import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.product.CombinationProductRespVO; +import cn.iocoder.yudao.module.promotion.controller.app.combination.vo.activity.AppCombinationActivityDetailRespVO; +import cn.iocoder.yudao.module.promotion.controller.app.combination.vo.activity.AppCombinationActivityRespVO; import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationActivityDO; import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationProductDO; import cn.iocoder.yudao.module.promotion.dal.dataobject.combination.CombinationRecordDO; @@ -25,6 +27,7 @@ import java.util.List; import java.util.Map; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; +import static cn.iocoder.yudao.framework.common.util.collection.MapUtils.findAndThen; /** * 拼团活动 Convert @@ -109,4 +112,44 @@ public interface CombinationActivityConvert { List convert(List bean); + List convertAppList(List list); + + default List convertAppList(List list, List spuList) { + List activityList = convertAppList(list); + Map spuMap = convertMap(spuList, ProductSpuRespDTO::getId); + return CollectionUtils.convertList(activityList, item -> { + findAndThen(spuMap, item.getSpuId(), spu -> { + item.setPicUrl(spu.getPicUrl()); + item.setMarketPrice(spu.getMarketPrice()); + }); + return item; + }); + } + + PageResult convertAppPage(PageResult result); + + default PageResult convertAppPage(PageResult result, List spuList) { + PageResult appPage = convertAppPage(result); + Map spuMap = convertMap(spuList, ProductSpuRespDTO::getId); + List list = CollectionUtils.convertList(appPage.getList(), item -> { + findAndThen(spuMap, item.getSpuId(), spu -> { + item.setPicUrl(spu.getPicUrl()); + item.setMarketPrice(spu.getMarketPrice()); + }); + return item; + }); + appPage.setList(list); + return appPage; + } + + AppCombinationActivityDetailRespVO convert2(CombinationActivityDO combinationActivity); + + List convertList1(List products); + + default AppCombinationActivityDetailRespVO convert3(CombinationActivityDO combinationActivity, List products) { + AppCombinationActivityDetailRespVO detailRespVO = convert2(combinationActivity); + detailRespVO.setProducts(convertList1(products)); + return detailRespVO; + } + } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/CombinationActivityMapper.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/CombinationActivityMapper.java index c2868d191..76e914f3a 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/CombinationActivityMapper.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/mysql/combination/CombinationActivityMapper.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.promotion.dal.mysql.combination; +import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; @@ -28,4 +29,9 @@ public interface CombinationActivityMapper extends BaseMapperX selectAppPage(PageParam pageParam, Integer status) { + return selectPage(pageParam, new LambdaQueryWrapperX() + .eq(CombinationActivityDO::getStatus, status)); + } + } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/bargain/BargainActivityService.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/bargain/BargainActivityService.java index e59e1ce3e..d560f6549 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/bargain/BargainActivityService.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/bargain/BargainActivityService.java @@ -75,7 +75,8 @@ public interface BargainActivityService { * 获取 APP 端活动展示数据 * * @param count 需要的数量 - * @return + * @return 活动列表 */ List getBargainActivityAppList(Integer count); + } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationActivityService.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationActivityService.java index c3e0f5313..235bf142c 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationActivityService.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationActivityService.java @@ -1,5 +1,6 @@ package cn.iocoder.yudao.module.promotion.service.combination; +import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityCreateReqVO; import cn.iocoder.yudao.module.promotion.controller.admin.combination.vo.activity.CombinationActivityPageReqVO; @@ -82,4 +83,20 @@ public interface CombinationActivityService { */ void validateCombination(Long activityId, Long userId, Long skuId, Integer count); + /** + * 获取 APP 端活动展示数据 + * + * @param count 需要的数量 + * @return 活动列表 + */ + List getCombinationActivityAppList(Integer count); + + /** + * 获取 APP 端活动分页数据 + * + * @param pageParam 分页参数 + * @return 活动分页数据 + */ + PageResult getCombinationActivityAppPage(PageParam pageParam); + } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationActivityServiceImpl.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationActivityServiceImpl.java index a9f95fa62..e29bc69a8 100644 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationActivityServiceImpl.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/service/combination/CombinationActivityServiceImpl.java @@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.promotion.service.combination; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ObjectUtil; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; +import cn.iocoder.yudao.framework.common.pojo.PageParam; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.module.product.api.sku.ProductSkuApi; @@ -245,4 +246,20 @@ public class CombinationActivityServiceImpl implements CombinationActivityServic } + @Override + public List getCombinationActivityAppList(Integer count) { + if (count == null) { + count = 6; + } + + PageResult result = combinationActivityMapper.selectAppPage(new PageParam().setPageSize(count), + CommonStatusEnum.ENABLE.getStatus()); + return result.getList(); + } + + @Override + public PageResult getCombinationActivityAppPage(PageParam pageParam) { + return combinationActivityMapper.selectAppPage(pageParam, CommonStatusEnum.ENABLE.getStatus()); + } + }