优惠券 券使用记录

This commit is contained in:
2025-02-22 11:47:54 +08:00
parent c29f508b4c
commit 97ae7983f1
12 changed files with 229 additions and 159 deletions

View File

@@ -1,11 +1,19 @@
package com.czg.controller.admin;
import com.czg.account.dto.ShopCouponDTO;
import com.czg.account.service.ShopCouponService;
import com.czg.annotation.SaAdminCheckPermission;
import com.czg.resp.CzgResult;
import com.czg.sa.StpKit;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 店铺优惠券
*
* @author ww
* @description
*/
@@ -16,5 +24,37 @@ public class ShopCouponController {
@Resource
private ShopCouponService couponService;
/**
* 店铺优惠券列表
* 权限标识: coupon:list
* 状态 0 未使用 1已使用 2已过期
*/
@SaAdminCheckPermission("coupon:list")
@GetMapping
public CzgResult<List<ShopCouponDTO>> detail(@RequestParam(required = false) Integer type,
@RequestParam(required = false) Integer status) {
return CzgResult.success(couponService.getList(StpKit.USER.getShopId(), type, status));
}
/**
* 店铺优惠券新增
* 权限标识: coupon:add
*/
@SaAdminCheckPermission("coupon:add")
@PostMapping
public CzgResult<Boolean> add(@RequestBody @Validated ShopCouponDTO couponDTO) {
couponDTO.setShopId(StpKit.USER.getShopId());
return CzgResult.success(couponService.add(couponDTO));
}
/**
* 店铺优惠券修改
* 权限标识: coupon:edit
*/
@SaAdminCheckPermission("coupon:edit")
@PutMapping
public CzgResult<Boolean> edit(@RequestBody @Validated ShopCouponDTO couponDTO) {
couponDTO.setShopId(StpKit.USER.getShopId());
return CzgResult.success(couponService.edit(couponDTO));
}
}

View File

@@ -0,0 +1,34 @@
package com.czg.controller.user;
import com.czg.account.entity.ShopActivateCouponRecord;
import com.czg.account.service.ShopCouponService;
import com.czg.resp.CzgResult;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 店铺优惠券
*
* @author ww
* @description
*/
@RestController
@RequestMapping("/user/coupon")
public class UserShopCouponController {
@Resource
private ShopCouponService couponService;
/**
* 通过用户Id 查找优惠券
*
* @param status 0 未使用 1已使用 2已过期
*/
@GetMapping("/findByUserId")
public CzgResult<List<ShopActivateCouponRecord>> findByUserId(
@RequestParam Long shopUserId, @RequestParam(required = false) Integer status) {
return CzgResult.success(couponService.find(shopUserId, status));
}
}