券兑换码相关接口
This commit is contained in:
@@ -0,0 +1,118 @@
|
||||
package com.czg.controller.admin;
|
||||
|
||||
import com.czg.annotation.SaAdminCheckPermission;
|
||||
import com.czg.annotation.SaCheckMainShop;
|
||||
import com.czg.constant.TableValueConstant;
|
||||
import com.czg.market.dto.MkCouponRedemptionConfigDTO;
|
||||
import com.czg.market.dto.MkEnableConfigDTO;
|
||||
import com.czg.market.entity.MkCouponRedemptionConfig;
|
||||
import com.czg.market.service.MkCouponRedemptionConfigService;
|
||||
import com.czg.market.service.MkEnableConfigService;
|
||||
import com.czg.market.vo.MkCouponRedemptionCodeVO;
|
||||
import com.czg.market.vo.MkCouponRedemptionConfigVO;
|
||||
import com.czg.market.vo.MkEnableConfigVO;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import com.czg.validator.group.UpdateGroup;
|
||||
import com.mybatisflex.core.paginate.Page;
|
||||
import com.mybatisflex.core.query.QueryWrapper;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import jakarta.validation.groups.Default;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
*
|
||||
* 券兑换码相关
|
||||
* @author Administrator
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/admin/couponRedemption")
|
||||
public class CouponRedemptionController {
|
||||
@Resource
|
||||
private MkCouponRedemptionConfigService configService;
|
||||
@Resource
|
||||
private MkEnableConfigService enableConfigService;
|
||||
|
||||
/**
|
||||
* 开关。可用门店修改
|
||||
*/
|
||||
@SaAdminCheckPermission(value = "couponRedemption:enable", name = "券兑换码状态修改")
|
||||
@PutMapping("/enable")
|
||||
public CzgResult<Boolean> upEnable(@Validated @RequestBody MkEnableConfigDTO dto) {
|
||||
return CzgResult.success(enableConfigService.upEnable(StpKit.USER.getMainShopId(),StpKit.USER.getLoginIdAsLong(), dto, TableValueConstant.EnableConfig.Type.COUPON_REDEMPTION));
|
||||
}
|
||||
|
||||
/**
|
||||
* 开关状态,可用门店详情
|
||||
*/
|
||||
@GetMapping("/enable/status")
|
||||
public CzgResult<MkEnableConfigVO> upEnable() {
|
||||
return CzgResult.success(enableConfigService.detail(StpKit.USER.getMainShopId(), StpKit.USER.getLoginIdAsLong(), TableValueConstant.EnableConfig.Type.RECHARGE_REDEMPTION));
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置信息详情
|
||||
*/
|
||||
@SaAdminCheckPermission(value = "couponRedemption:detail", name = "券兑换码列表")
|
||||
@GetMapping
|
||||
public CzgResult<MkCouponRedemptionConfigVO> detail(@RequestParam Integer id) {
|
||||
return CzgResult.success(configService.getOneAs(new QueryWrapper().eq(MkCouponRedemptionConfig::getId, id)
|
||||
.eq(MkCouponRedemptionConfig::getMainShopId, StpKit.USER.getMainShopId()), MkCouponRedemptionConfigVO.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置信息获取 列表
|
||||
*/
|
||||
@SaAdminCheckPermission(value = "couponRedemption:list", name = "券兑换码列表")
|
||||
@GetMapping("/list")
|
||||
public CzgResult<Page<MkCouponRedemptionConfigVO>> list(@RequestParam(required = false, defaultValue = "-1") Integer status) {
|
||||
return CzgResult.success(configService.pageInfo(StpKit.USER.getMainShopId(), status));
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置信息添加
|
||||
*/
|
||||
@SaAdminCheckPermission(value = "couponRedemption:add", name = "券兑换码配置添加")
|
||||
@PostMapping
|
||||
@SaCheckMainShop
|
||||
public CzgResult<Boolean> add(@Validated @RequestBody MkCouponRedemptionConfigDTO dto) {
|
||||
return CzgResult.success(configService.add(StpKit.USER.getMainShopId(), dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置信息修改
|
||||
*
|
||||
* @return 是否成功
|
||||
*/
|
||||
@SaAdminCheckPermission(value = "couponRedemption:edit", name = "券兑换码修改")
|
||||
@SaCheckMainShop
|
||||
@PutMapping
|
||||
public CzgResult<Boolean> edit(@Validated({UpdateGroup.class, Default.class}) @RequestBody MkCouponRedemptionConfigDTO dto) {
|
||||
return CzgResult.success(configService.edit(StpKit.USER.getShopId(), dto));
|
||||
}
|
||||
|
||||
/**
|
||||
* 券兑换码码列表
|
||||
*
|
||||
* @return 是否成功
|
||||
*/
|
||||
@SaAdminCheckPermission(value = "couponRedemption:codeList", name = "券兑换码码列表")
|
||||
@GetMapping("/code/list")
|
||||
public CzgResult<Page<MkCouponRedemptionCodeVO>> codeList(@RequestParam Long redemptionId, @RequestParam(required = false) String code, @RequestParam(required = false) Integer status) {
|
||||
return CzgResult.success(configService.codeList(StpKit.USER.getMainShopId(), redemptionId, code, status));
|
||||
}
|
||||
|
||||
/**
|
||||
* 券兑换码码导出
|
||||
*/
|
||||
@SaAdminCheckPermission(value = "couponRedemption:codeExport", name = "券兑换码码列表导出")
|
||||
@GetMapping("/code/export")
|
||||
public void exportCodeList(@RequestParam Long redemptionId, @RequestParam(required = false) String code, @RequestParam(required = false) Integer status,
|
||||
HttpServletResponse response, HttpServletRequest request) {
|
||||
configService.exportCodeList(StpKit.USER.getMainShopId(), redemptionId, code, status, response, request);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user