用户优惠券列表
This commit is contained in:
@@ -0,0 +1,48 @@
|
|||||||
|
package com.czg.controller.user;
|
||||||
|
|
||||||
|
import com.czg.account.vo.UserCouponVo;
|
||||||
|
import com.czg.market.entity.MkShopCouponRecord;
|
||||||
|
import com.czg.market.service.ShopCouponService;
|
||||||
|
import com.czg.resp.CzgResult;
|
||||||
|
import com.czg.sa.StpKit;
|
||||||
|
import com.czg.utils.AssertUtil;
|
||||||
|
import com.mybatisflex.core.paginate.Page;
|
||||||
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author ww
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/user/coupon")
|
||||||
|
public class UShopCouponController {
|
||||||
|
@Resource
|
||||||
|
private ShopCouponService couponService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过用户Id 查找优惠券
|
||||||
|
*
|
||||||
|
* @param status 0 未使用 1已使用 2已过期
|
||||||
|
*/
|
||||||
|
@GetMapping("/findByUserId")
|
||||||
|
public CzgResult<Page<MkShopCouponRecord>> findByUserId(
|
||||||
|
@RequestParam(required = false) Integer status,
|
||||||
|
@RequestParam(required = false) Long shopId) {
|
||||||
|
return CzgResult.success(couponService.find(StpKit.USER.getLoginIdAsLong(), shopId, status));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成订单后使用
|
||||||
|
* 通过用户Id 查找优惠券
|
||||||
|
*
|
||||||
|
* @param shopUserId 店铺用户Id
|
||||||
|
*/
|
||||||
|
@GetMapping("/findCoupon")
|
||||||
|
public CzgResult<List<UserCouponVo>> findCoupon(@RequestHeader String shopId, @RequestParam Long shopUserId, @RequestParam(required = false) Integer type) {
|
||||||
|
AssertUtil.isBlank(shopId, "店铺Id不能为空");
|
||||||
|
return CzgResult.success(couponService.findCoupon(Long.parseLong(shopId), shopUserId, type));
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user