|
@@ -30,6 +30,7 @@ import javax.annotation.Resource;
|
|
|
import javax.validation.Valid;
|
|
|
import java.util.Collections;
|
|
|
import java.util.List;
|
|
|
+import java.util.Set;
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
@@ -75,6 +76,25 @@ public class AppProductSpuController {
|
|
|
return success(voList);
|
|
|
}
|
|
|
|
|
|
+ @GetMapping("/list-by-ids")
|
|
|
+ @Operation(summary = "获得商品 SPU 列表")
|
|
|
+ @Parameters({
|
|
|
+ @Parameter(name = "ids", description = "编号列表", required = true)
|
|
|
+ })
|
|
|
+ public CommonResult<List<AppProductSpuPageRespVO>> getSpuList(@RequestParam("ids") Set<Long> ids) {
|
|
|
+ List<ProductSpuDO> list = productSpuService.getSpuList(ids);
|
|
|
+ if (CollUtil.isEmpty(list)) {
|
|
|
+ return success(Collections.emptyList());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 拼接返回
|
|
|
+ List<AppProductSpuPageRespVO> voList = ProductSpuConvert.INSTANCE.convertListForGetSpuList(list);
|
|
|
+ // 处理 vip 价格
|
|
|
+ MemberLevelRespDTO memberLevel = getMemberLevel();
|
|
|
+ voList.forEach(vo -> vo.setVipPrice(calculateVipPrice(vo.getPrice(), memberLevel)));
|
|
|
+ return success(voList);
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping("/page")
|
|
|
@Operation(summary = "获得商品 SPU 分页")
|
|
|
public CommonResult<PageResult<AppProductSpuPageRespVO>> getSpuPage(@Valid AppProductSpuPageReqVO pageVO) {
|