群聊优惠券
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
package com.czg.controller.admin;
|
||||
|
||||
import com.czg.annotation.SaAdminCheckPermission;
|
||||
import com.czg.market.dto.ChatCouponDTO;
|
||||
import com.czg.market.dto.ChatCouponGrantDTO;
|
||||
import com.czg.market.entity.MkShopCouponRecord;
|
||||
import com.czg.market.service.ChatCouponService;
|
||||
import com.czg.market.vo.ChatCouponVO;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import jakarta.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 群聊优惠券活动
|
||||
*
|
||||
* @author ww
|
||||
* @description
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/admin/chat/coupon")
|
||||
public class AChatCouponController {
|
||||
@Resource
|
||||
private ChatCouponService chatCouponService;
|
||||
|
||||
/**
|
||||
* 群聊优惠券活动-创建
|
||||
*/
|
||||
@PostMapping("/create")
|
||||
@SaAdminCheckPermission(value = "chat:coupon:create", name = "群聊优惠券活动-创建")
|
||||
public CzgResult<Void> createChatCoupon(@RequestBody @Validated ChatCouponDTO chatCoupon) {
|
||||
Long shopId = StpKit.USER.getShopId();
|
||||
chatCouponService.createChatCoupon(shopId, chatCoupon);
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 群聊优惠券活动-分页查询
|
||||
*/
|
||||
@GetMapping("/page")
|
||||
@SaAdminCheckPermission(value = "chat:coupon:page", name = "群聊优惠券活动-分页查询")
|
||||
public Page<ChatCouponVO> pageChatCoupon(@RequestParam(required = false, defaultValue = "1") Integer page,
|
||||
@RequestParam(required = false, defaultValue = "10") Integer size,
|
||||
@RequestParam(required = false) Integer status) {
|
||||
Long shopId = StpKit.USER.getShopId();
|
||||
return chatCouponService.pageChatCoupon(shopId, page, size, status);
|
||||
}
|
||||
|
||||
/**
|
||||
* 群聊优惠券活动-失效
|
||||
*/
|
||||
@DeleteMapping("/expired/{id}")
|
||||
@SaAdminCheckPermission(value = "chat:coupon:expired", name = "群聊优惠券活动-失效")
|
||||
public CzgResult<Void> expiredChatCoupon(@PathVariable Long id) {
|
||||
Long shopId = StpKit.USER.getShopId();
|
||||
chatCouponService.expiredChatCoupon(shopId, id);
|
||||
return CzgResult.success();
|
||||
}
|
||||
/**
|
||||
* 群聊优惠券活动-发放优惠券
|
||||
*/
|
||||
@PostMapping("/grant")
|
||||
@SaAdminCheckPermission(value = "chat:coupon:grant", name = "群聊优惠券活动-发放优惠券")
|
||||
public CzgResult<Void> grantChatCoupon(@RequestBody ChatCouponGrantDTO chatCouponGrant) {
|
||||
chatCouponService.grantChatCoupon(chatCouponGrant.getId(), chatCouponGrant.getShopUserId(), chatCouponGrant.getUserId());
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 群聊优惠券活动-发放记录
|
||||
*/
|
||||
@GetMapping("/record")
|
||||
@SaAdminCheckPermission(value = "chat:coupon:record", name = "群聊优惠券活动-发放记录")
|
||||
public Page<MkShopCouponRecord> grantChatCouponRecord(@RequestParam Long id,
|
||||
@RequestParam(required = false) Integer status,
|
||||
@RequestParam(required = false, defaultValue = "1") Integer page,
|
||||
@RequestParam(required = false, defaultValue = "10") Integer size) {
|
||||
return chatCouponService.grantChatCouponRecord(id, status, page, size);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -215,4 +215,17 @@ public class ACouponController {
|
||||
public CzgResult<List<UserCouponVo>> findCoupon(@RequestParam Long shopUserId, @RequestParam(required = false) Integer type, @RequestParam(required = false) Integer isFood) {
|
||||
return CzgResult.success(shopCouponService.findCoupon(StpKit.USER.getShopId(), shopUserId, type, isFood));
|
||||
}
|
||||
|
||||
/**
|
||||
* 群聊可发放优惠券列表
|
||||
*
|
||||
* @param search 优惠券名称模糊搜索
|
||||
*/
|
||||
@GetMapping("/chatCoupon")
|
||||
public CzgResult<Page<ShopCouponDTO>> chatCoupon(@RequestParam(required = false, defaultValue = "1") Integer page,
|
||||
@RequestParam(required = false, defaultValue = "10") Integer size,
|
||||
@RequestParam(required = false) String search) {
|
||||
Long shopId = StpKit.USER.getShopId();
|
||||
return CzgResult.success(shopCouponService.chatCoupon(shopId, search));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user