From 646e2340ff8bba93d722c756ee570eff53ca039d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=85=95=E4=B8=8B?= <484014559@qq.com> Date: Mon, 30 Sep 2024 11:42:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E7=A8=8B=E5=BA=8F=E7=A7=AF=E5=88=86?= =?UTF-8?q?=E5=95=86=E5=93=81=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../app/pointmall/AppPointMallController.java | 57 +++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/pointmall/AppPointMallController.java diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/pointmall/AppPointMallController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/pointmall/AppPointMallController.java new file mode 100644 index 0000000..a4dccbe --- /dev/null +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/pointmall/AppPointMallController.java @@ -0,0 +1,57 @@ +package cn.iocoder.yudao.module.promotion.controller.app.pointmall; + +import cn.iocoder.yudao.framework.common.pojo.CommonResult; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; +import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated; +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.admin.pointmall.vo.PointMallPageReqVO; +import cn.iocoder.yudao.module.promotion.controller.admin.pointmall.vo.PointMallRespVO; +import cn.iocoder.yudao.module.promotion.dal.dataobject.pointmall.PointMallDO; +import cn.iocoder.yudao.module.promotion.service.pointmall.PointMallService; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import javax.validation.Valid; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; + +@Tag(name = "用户 APP - 积分商城") +@RestController +@RequestMapping("/promotion/point-mall") +@Validated +public class AppPointMallController { + @Resource + private PointMallService pointMallService; + @Resource + private ProductSpuApi productSpuApi; + + @GetMapping("/page") + @Operation(summary = "积分商品分页") + @PreAuthenticated + public CommonResult> getPointMallPage(@Valid PointMallPageReqVO pageReqVO) { + PageResult pageResult = pointMallService.getPointMallPage(pageReqVO); + ArrayList list = new ArrayList<>(); + HashMap map = new HashMap<>(); + for (PointMallDO mallDO : pageResult.getList()) { + list.add(mallDO.getSpuId()); + map.put(mallDO.getSpuId(),mallDO.getExchangePointNum()); + } + List spuList = productSpuApi.getSpuList(list); + for (ProductSpuRespDTO productSpuRespDTO : spuList) { + productSpuRespDTO.setPointCount(map.get(productSpuRespDTO.getId())); + } + return success(spuList); + } +} -- 2.45.2