| | |
| | | package com.ruoyi.promotion.controller.management; |
| | | |
| | | |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.utils.page.PageDTO; |
| | | import com.ruoyi.promotion.controller.management.dto.MgtCouponDTO; |
| | | import com.ruoyi.promotion.controller.management.dto.MgtCouponQuery; |
| | | import com.ruoyi.promotion.controller.management.dto.MgtCouponReceiveQuery; |
| | | import com.ruoyi.promotion.controller.management.dto.MgtCouponUpdDTO; |
| | | import com.ruoyi.promotion.controller.management.vo.CouponReceiveDetailVO; |
| | | import com.ruoyi.promotion.controller.management.vo.MgtCouponVO; |
| | | import com.ruoyi.promotion.service.ICouponService; |
| | | import com.ruoyi.system.api.validate.InsertGroup; |
| | | import com.ruoyi.system.api.validate.ModifyGroup; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.PutMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/mgt/coupon") |
| | | @RequiredArgsConstructor |
| | | @Api(value = "管理后台-优惠券管理相关接口", tags = "管理后台-优惠券管理相关接口") |
| | | public class MgtCouponController { |
| | | |
| | | private final ICouponService couponService; |
| | | |
| | | /** |
| | | * 获取优惠券列表的分页数据 |
| | | * |
| | | * @param query 管理后台-优惠券查询对象 |
| | | * @return PageDTO<MgtCouponVO> |
| | | */ |
| | | @ApiOperation(value = "获取优惠券列表的分页数据", notes = "优惠券列表的分页数据") |
| | | @PostMapping("/page") |
| | | public R<PageDTO<MgtCouponVO>> getCouponPage(@Validated @RequestBody MgtCouponQuery query) { |
| | | return R.ok(couponService.getCouponPage(query)); |
| | | } |
| | | |
| | | /** |
| | | * 添加优惠券 |
| | | * |
| | | * @param dto 管理后台-优惠券数据传输对象 |
| | | */ |
| | | @ApiOperation("添加优惠券") |
| | | @PostMapping("/add") |
| | | public R<?> saveCoupon(@Validated(InsertGroup.class) @RequestBody MgtCouponDTO dto) { |
| | | couponService.saveCoupon(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 编辑优惠券 |
| | | * |
| | | * @param dto 管理后台-优惠券数据传输对象 |
| | | */ |
| | | @ApiOperation("编辑优惠券") |
| | | @PutMapping("/update") |
| | | public R<?> updateCoupon(@Validated(ModifyGroup.class) @RequestBody MgtCouponDTO dto) { |
| | | couponService.updateCoupon(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 上架/下架 |
| | | * |
| | | * @param dto |
| | | * @return |
| | | */ |
| | | @ApiOperation("上架/下架") |
| | | @PutMapping("/upd-status") |
| | | public R<?> updStatus(@Validated @RequestBody MgtCouponUpdDTO dto) { |
| | | couponService.updStatus(dto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 领取详情 |
| | | * |
| | | * @param query 管理后台-优惠券领取详情查询对象 |
| | | * @return PageDTO<CouponReceiveDetailVO> |
| | | */ |
| | | @ApiOperation("领取详情") |
| | | @PostMapping("/receive-detail") |
| | | public R<PageDTO<CouponReceiveDetailVO>> getReceiveDetail( |
| | | @Validated @RequestBody MgtCouponReceiveQuery query) { |
| | | return R.ok(couponService.getReceiveDetail(query)); |
| | | } |
| | | } |