|
@@ -35,6 +35,7 @@ import java.time.Duration;
|
|
|
import java.time.LocalDate;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.LocalTime;
|
|
|
+import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
@@ -149,4 +150,21 @@ public class AppSeckillActivityController {
|
|
|
return success(SeckillActivityConvert.INSTANCE.convert3(activity, productList, startTime, endTime));
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/list-by-ids")
|
|
|
+ @Operation(summary = "获得拼团活动列表,基于活动编号数组")
|
|
|
+ @Parameter(name = "ids", description = "活动编号数组", required = true, example = "[1024, 1025]")
|
|
|
+ public CommonResult<List<AppSeckillActivityRespVO>> getCombinationActivityListByIds(@RequestParam("ids") List<Long> ids) {
|
|
|
+ // 1. 获得开启的活动列表
|
|
|
+ List<SeckillActivityDO> activityList = activityService.getSeckillActivityListByIds(ids);
|
|
|
+ activityList.removeIf(activity -> CommonStatusEnum.isDisable(activity.getStatus()));
|
|
|
+ if (CollUtil.isEmpty(activityList)) {
|
|
|
+ return success(Collections.emptyList());
|
|
|
+ }
|
|
|
+ // 2. 拼接返回
|
|
|
+ List<SeckillProductDO> productList = activityService.getSeckillProductListByActivityIds(
|
|
|
+ convertList(activityList, SeckillActivityDO::getId));
|
|
|
+ List<ProductSpuRespDTO> spuList = spuApi.getSpuList(convertList(activityList, SeckillActivityDO::getSpuId));
|
|
|
+ return success(SeckillActivityConvert.INSTANCE.convertAppList(activityList, productList, spuList));
|
|
|
+ }
|
|
|
+
|
|
|
}
|