Commit 210a93e8c80a4238ae4073c4437f7256c96e17d6
1 parent
8ffb627c
feat(mall):优惠劵详情接口
Showing
3 changed files
with
25 additions
and
1 deletions
yudao-module-mall/yudao-module-promotion/src/main/java/cn/iocoder/yudao/module/promotion/controller/admin/coupon/CouponController.java
| @@ -4,10 +4,12 @@ import cn.hutool.core.collection.CollUtil; | @@ -4,10 +4,12 @@ import cn.hutool.core.collection.CollUtil; | ||
| 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; | 4 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | 6 | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| 7 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 7 | import cn.iocoder.yudao.module.member.api.user.MemberUserApi; | 8 | import cn.iocoder.yudao.module.member.api.user.MemberUserApi; |
| 8 | import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; | 9 | import cn.iocoder.yudao.module.member.api.user.dto.MemberUserRespDTO; |
| 9 | import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.coupon.CouponPageItemRespVO; | 10 | import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.coupon.CouponPageItemRespVO; |
| 10 | import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.coupon.CouponPageReqVO; | 11 | import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.coupon.CouponPageReqVO; |
| 12 | +import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.coupon.CouponRespVO; | ||
| 11 | import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.coupon.CouponSendReqVO; | 13 | import cn.iocoder.yudao.module.promotion.controller.admin.coupon.vo.coupon.CouponSendReqVO; |
| 12 | import cn.iocoder.yudao.module.promotion.convert.coupon.CouponConvert; | 14 | import cn.iocoder.yudao.module.promotion.convert.coupon.CouponConvert; |
| 13 | import cn.iocoder.yudao.module.promotion.dal.dataobject.coupon.CouponDO; | 15 | import cn.iocoder.yudao.module.promotion.dal.dataobject.coupon.CouponDO; |
| @@ -63,6 +65,15 @@ public class CouponController { | @@ -63,6 +65,15 @@ public class CouponController { | ||
| 63 | return success(pageResulVO); | 65 | return success(pageResulVO); |
| 64 | } | 66 | } |
| 65 | 67 | ||
| 68 | + @GetMapping("/get") | ||
| 69 | + @Operation(summary = "获得优惠劵") | ||
| 70 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 71 | + @PreAuthorize("@ss.hasPermission('promotion:coupon:query')") | ||
| 72 | + public CommonResult<CouponRespVO> getCoupon(@RequestParam("id") Long id) { | ||
| 73 | + CouponDO coupon = couponService.getCoupon(id); | ||
| 74 | + return success(BeanUtils.toBean(coupon, CouponRespVO.class)); | ||
| 75 | + } | ||
| 76 | + | ||
| 66 | @PostMapping("/send") | 77 | @PostMapping("/send") |
| 67 | @Operation(summary = "发送优惠劵") | 78 | @Operation(summary = "发送优惠劵") |
| 68 | @PreAuthorize("@ss.hasPermission('promotion:coupon:send')") | 79 | @PreAuthorize("@ss.hasPermission('promotion:coupon:send')") |
yudao-module-mall/yudao-module-promotion/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponService.java
| @@ -160,7 +160,7 @@ public interface CouponService { | @@ -160,7 +160,7 @@ public interface CouponService { | ||
| 160 | Map<Long, Boolean> getUserCanCanTakeMap(Long userId, List<CouponTemplateDO> templates); | 160 | Map<Long, Boolean> getUserCanCanTakeMap(Long userId, List<CouponTemplateDO> templates); |
| 161 | 161 | ||
| 162 | /** | 162 | /** |
| 163 | - * 获得优惠劵 | 163 | + * 【会员】获得优惠劵 |
| 164 | * | 164 | * |
| 165 | * @param userId 用户编号 | 165 | * @param userId 用户编号 |
| 166 | * @param id 编号 | 166 | * @param id 编号 |
| @@ -168,4 +168,12 @@ public interface CouponService { | @@ -168,4 +168,12 @@ public interface CouponService { | ||
| 168 | */ | 168 | */ |
| 169 | CouponDO getCoupon(Long userId, Long id); | 169 | CouponDO getCoupon(Long userId, Long id); |
| 170 | 170 | ||
| 171 | + /** | ||
| 172 | + * 【管理员】获得优惠劵 | ||
| 173 | + * | ||
| 174 | + * @param id 编号 | ||
| 175 | + * @return 优惠劵 | ||
| 176 | + */ | ||
| 177 | + CouponDO getCoupon(Long id); | ||
| 178 | + | ||
| 171 | } | 179 | } |
yudao-module-mall/yudao-module-promotion/src/main/java/cn/iocoder/yudao/module/promotion/service/coupon/CouponServiceImpl.java
| @@ -378,6 +378,11 @@ public class CouponServiceImpl implements CouponService { | @@ -378,6 +378,11 @@ public class CouponServiceImpl implements CouponService { | ||
| 378 | return couponMapper.selectByIdAndUserId(id, userId); | 378 | return couponMapper.selectByIdAndUserId(id, userId); |
| 379 | } | 379 | } |
| 380 | 380 | ||
| 381 | + @Override | ||
| 382 | + public CouponDO getCoupon(Long id) { | ||
| 383 | + return couponMapper.selectById(id); | ||
| 384 | + } | ||
| 385 | + | ||
| 381 | private CouponDO validateCouponExists(Long id) { | 386 | private CouponDO validateCouponExists(Long id) { |
| 382 | CouponDO coupon = couponMapper.selectById(id); | 387 | CouponDO coupon = couponMapper.selectById(id); |
| 383 | if (coupon == null) { | 388 | if (coupon == null) { |