Commit 49accc946d47dc3e1d25432e5d9e3fc7e8a29cce
1 parent
c7a21b2a
营销:适配商城装修组件【优惠券】
Showing
3 changed files
with
31 additions
and
0 deletions
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.*; | @@ -16,6 +16,9 @@ import org.springframework.web.bind.annotation.*; | ||
| 16 | import javax.annotation.Resource; | 16 | import javax.annotation.Resource; |
| 17 | import javax.validation.Valid; | 17 | import javax.validation.Valid; |
| 18 | 18 | ||
| 19 | +import java.util.Collection; | ||
| 20 | +import java.util.List; | ||
| 21 | + | ||
| 19 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | 22 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; |
| 20 | 23 | ||
| 21 | @Tag(name = "管理后台 - 优惠劵模板") | 24 | @Tag(name = "管理后台 - 优惠劵模板") |
| @@ -75,4 +78,14 @@ public class CouponTemplateController { | @@ -75,4 +78,14 @@ public class CouponTemplateController { | ||
| 75 | PageResult<CouponTemplateDO> pageResult = couponTemplateService.getCouponTemplatePage(pageVO); | 78 | PageResult<CouponTemplateDO> pageResult = couponTemplateService.getCouponTemplatePage(pageVO); |
| 76 | return success(CouponTemplateConvert.INSTANCE.convertPage(pageResult)); | 79 | return success(CouponTemplateConvert.INSTANCE.convertPage(pageResult)); |
| 77 | } | 80 | } |
| 81 | + | ||
| 82 | + @GetMapping("/list") | ||
| 83 | + @Operation(summary = "获得优惠劵模板列表") | ||
| 84 | + @Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") | ||
| 85 | + @PreAuthorize("@ss.hasPermission('promotion:coupon-template:query')") | ||
| 86 | + public CommonResult<List<CouponTemplateRespVO>> getCouponTemplateList(@RequestParam("ids") Collection<Long> ids) { | ||
| 87 | + List<CouponTemplateDO> list = couponTemplateService.getCouponTemplateList(ids); | ||
| 88 | + return success(CouponTemplateConvert.INSTANCE.convertList(list)); | ||
| 89 | + } | ||
| 90 | + | ||
| 78 | } | 91 | } |
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 { | @@ -69,6 +69,22 @@ public class AppCouponTemplateController { | ||
| 69 | return success(CouponTemplateConvert.INSTANCE.convertAppList(list, canCanTakeMap)); | 69 | return success(CouponTemplateConvert.INSTANCE.convertAppList(list, canCanTakeMap)); |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | + @GetMapping("/list-by-ids") | ||
| 73 | + @Operation(summary = "获得优惠劵模版列表") | ||
| 74 | + @Parameters({ | ||
| 75 | + @Parameter(name = "ids", description = "优惠券模板编号列表") | ||
| 76 | + }) | ||
| 77 | + public CommonResult<List<AppCouponTemplateRespVO>> getCouponTemplateList( | ||
| 78 | + @RequestParam(value = "ids", required = false) Set<Long> ids) { | ||
| 79 | + // 1. 查询 | ||
| 80 | + List<CouponTemplateDO> list = couponTemplateService.getCouponTemplateList(ids); | ||
| 81 | + | ||
| 82 | + // 2.1 领取数量 | ||
| 83 | + Map<Long, Boolean> canCanTakeMap = couponService.getUserCanCanTakeMap(getLoginUserId(), list); | ||
| 84 | + // 2.2 拼接返回 | ||
| 85 | + return success(CouponTemplateConvert.INSTANCE.convertAppList(list, canCanTakeMap)); | ||
| 86 | + } | ||
| 87 | + | ||
| 72 | @GetMapping("/page") | 88 | @GetMapping("/page") |
| 73 | @Operation(summary = "获得优惠劵模版分页") | 89 | @Operation(summary = "获得优惠劵模版分页") |
| 74 | public CommonResult<PageResult<AppCouponTemplateRespVO>> getCouponTemplatePage(AppCouponTemplatePageReqVO pageReqVO) { | 90 | public CommonResult<PageResult<AppCouponTemplateRespVO>> getCouponTemplatePage(AppCouponTemplatePageReqVO pageReqVO) { |
yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/convert/coupon/CouponTemplateConvert.java