From 49accc946d47dc3e1d25432e5d9e3fc7e8a29cce Mon Sep 17 00:00:00 2001 From: owen Date: Wed, 22 Nov 2023 16:58:01 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E8=90=A5=E9=94=80=EF=BC=9A=E9=80=82?= =?UTF-8?q?=E9=85=8D=E5=95=86=E5=9F=8E=E8=A3=85=E4=BF=AE=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E3=80=90=E4=BC=98=E6=83=A0=E5=88=B8=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../admin/coupon/CouponTemplateController.java | 13 +++++++++++++ .../app/coupon/AppCouponTemplateController.java | 16 ++++++++++++++++ .../convert/coupon/CouponTemplateConvert.java | 2 ++ 3 files changed, 31 insertions(+) diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/coupon/CouponTemplateController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/coupon/CouponTemplateController.java index 69e39d13c..271d71131 100755 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/coupon/CouponTemplateController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/coupon/CouponTemplateController.java @@ -16,6 +16,9 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import javax.validation.Valid; +import java.util.Collection; +import java.util.List; + import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; @Tag(name = "管理后台 - 优惠劵模板") @@ -75,4 +78,14 @@ public class CouponTemplateController { PageResult pageResult = couponTemplateService.getCouponTemplatePage(pageVO); return success(CouponTemplateConvert.INSTANCE.convertPage(pageResult)); } + + @GetMapping("/list") + @Operation(summary = "获得优惠劵模板列表") + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") + @PreAuthorize("@ss.hasPermission('promotion:coupon-template:query')") + public CommonResult> getCouponTemplateList(@RequestParam("ids") Collection ids) { + List list = couponTemplateService.getCouponTemplateList(ids); + return success(CouponTemplateConvert.INSTANCE.convertList(list)); + } + } diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/coupon/AppCouponTemplateController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/coupon/AppCouponTemplateController.java index 16ddb7a5b..6d72605b9 100755 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/coupon/AppCouponTemplateController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/coupon/AppCouponTemplateController.java @@ -69,6 +69,22 @@ public class AppCouponTemplateController { return success(CouponTemplateConvert.INSTANCE.convertAppList(list, canCanTakeMap)); } + @GetMapping("/list-by-ids") + @Operation(summary = "获得优惠劵模版列表") + @Parameters({ + @Parameter(name = "ids", description = "优惠券模板编号列表") + }) + public CommonResult> getCouponTemplateList( + @RequestParam(value = "ids", required = false) Set ids) { + // 1. 查询 + List list = couponTemplateService.getCouponTemplateList(ids); + + // 2.1 领取数量 + Map canCanTakeMap = couponService.getUserCanCanTakeMap(getLoginUserId(), list); + // 2.2 拼接返回 + return success(CouponTemplateConvert.INSTANCE.convertAppList(list, canCanTakeMap)); + } + @GetMapping("/page") @Operation(summary = "获得优惠劵模版分页") public CommonResult> getCouponTemplatePage(AppCouponTemplatePageReqVO pageReqVO) { diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/coupon/CouponTemplateConvert.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/coupon/CouponTemplateConvert.java index e09d0f013..c6b86da38 100755 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/coupon/CouponTemplateConvert.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/coupon/CouponTemplateConvert.java @@ -58,4 +58,6 @@ public interface CouponTemplateConvert { } } + List convertList(List list); + } From 4a3aa1fa086ed976c57ab7381ae0a71abb309dc8 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Fri, 24 Nov 2023 19:55:07 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=90=A5=E9=94=80=EF=BC=9A=E9=80=82?= =?UTF-8?q?=E9=85=8D=E5=95=86=E5=9F=8E=E8=A3=85=E4=BF=AE=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E3=80=90=E4=BC=98=E6=83=A0=E5=88=B8=E3=80=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/app/coupon/AppCouponTemplateController.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/coupon/AppCouponTemplateController.java b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/coupon/AppCouponTemplateController.java index 6d72605b9..b4bab466a 100755 --- a/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/coupon/AppCouponTemplateController.java +++ b/yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/controller/app/coupon/AppCouponTemplateController.java @@ -71,9 +71,7 @@ public class AppCouponTemplateController { @GetMapping("/list-by-ids") @Operation(summary = "获得优惠劵模版列表") - @Parameters({ - @Parameter(name = "ids", description = "优惠券模板编号列表") - }) + @Parameter(name = "ids", description = "优惠券模板编号列表") public CommonResult> getCouponTemplateList( @RequestParam(value = "ids", required = false) Set ids) { // 1. 查询