兑换码优化
This commit is contained in:
@@ -3,19 +3,17 @@ 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.MkRedemptionConfigDTO;
|
||||
import com.czg.market.dto.MkEnableConfigDTO;
|
||||
import com.czg.market.entity.MkCouponRedemptionConfig;
|
||||
import com.czg.market.service.MkCouponRedemptionConfigService;
|
||||
import com.czg.market.service.MkRedemptionConfigService;
|
||||
import com.czg.market.service.MkEnableConfigService;
|
||||
import com.czg.market.vo.MkCouponRedemptionCodeVO;
|
||||
import com.czg.market.vo.MkCouponRedemptionConfigVO;
|
||||
import com.czg.market.vo.MkRedemptionCodeVO;
|
||||
import com.czg.market.vo.MkRedemptionConfigVO;
|
||||
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;
|
||||
@@ -32,7 +30,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
@RequestMapping("/admin/couponRedemption")
|
||||
public class CouponRedemptionController {
|
||||
@Resource
|
||||
private MkCouponRedemptionConfigService configService;
|
||||
private MkRedemptionConfigService configService;
|
||||
@Resource
|
||||
private MkEnableConfigService enableConfigService;
|
||||
|
||||
@@ -58,7 +56,7 @@ public class CouponRedemptionController {
|
||||
*/
|
||||
@SaAdminCheckPermission(value = "couponRedemption:detail", name = "券兑换码列表")
|
||||
@GetMapping
|
||||
public CzgResult<MkCouponRedemptionConfigVO> detail(@RequestParam Long id) {
|
||||
public CzgResult<MkRedemptionConfigVO> detail(@RequestParam Long id) {
|
||||
return CzgResult.success(configService.detail(StpKit.USER.getMainShopId(), id));
|
||||
}
|
||||
|
||||
@@ -67,8 +65,8 @@ public class CouponRedemptionController {
|
||||
*/
|
||||
@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));
|
||||
public CzgResult<Page<MkRedemptionConfigVO>> list(@RequestParam(required = false, defaultValue = "-1") Integer status) {
|
||||
return CzgResult.success(configService.pageInfo(StpKit.USER.getMainShopId(), status, false));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -77,8 +75,8 @@ public class CouponRedemptionController {
|
||||
@SaAdminCheckPermission(value = "couponRedemption:add", name = "券兑换码配置添加")
|
||||
@PostMapping
|
||||
@SaCheckMainShop
|
||||
public CzgResult<Boolean> add(@Validated @RequestBody MkCouponRedemptionConfigDTO dto) {
|
||||
return CzgResult.success(configService.add(StpKit.USER.getMainShopId(), dto));
|
||||
public CzgResult<Boolean> add(@Validated @RequestBody MkRedemptionConfigDTO dto) {
|
||||
return CzgResult.success(configService.add(StpKit.USER.getMainShopId(), dto, false));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -89,8 +87,8 @@ public class CouponRedemptionController {
|
||||
@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));
|
||||
public CzgResult<Boolean> edit(@Validated({UpdateGroup.class, Default.class}) @RequestBody MkRedemptionConfigDTO dto) {
|
||||
return CzgResult.success(configService.edit(StpKit.USER.getShopId(), dto, false));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,8 +98,8 @@ public class CouponRedemptionController {
|
||||
*/
|
||||
@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));
|
||||
public CzgResult<Page<MkRedemptionCodeVO>> 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, false));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,7 +109,7 @@ public class CouponRedemptionController {
|
||||
@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);
|
||||
configService.exportCodeList(StpKit.USER.getMainShopId(), redemptionId, code, status, response, request, false);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,19 +3,17 @@ 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.MkRedemptionConfigDTO;
|
||||
import com.czg.market.dto.MkEnableConfigDTO;
|
||||
import com.czg.market.dto.MkRechargeRedemptionConfigDTO;
|
||||
import com.czg.market.entity.MkRechargeRedemptionConfig;
|
||||
import com.czg.market.service.MkRedemptionConfigService;
|
||||
import com.czg.market.service.MkEnableConfigService;
|
||||
import com.czg.market.service.MkRechargeRedemptionConfigService;
|
||||
import com.czg.market.vo.MkRedemptionCodeVO;
|
||||
import com.czg.market.vo.MkRedemptionConfigVO;
|
||||
import com.czg.market.vo.MkEnableConfigVO;
|
||||
import com.czg.market.vo.MkRechargeRedemptionCodeVO;
|
||||
import com.czg.market.vo.MkRechargeRedemptionConfigVO;
|
||||
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;
|
||||
@@ -32,7 +30,7 @@ import org.springframework.web.bind.annotation.*;
|
||||
@RequestMapping("/admin/rechargeRedemption")
|
||||
public class RechargeRedemptionController {
|
||||
@Resource
|
||||
private MkRechargeRedemptionConfigService configService;
|
||||
private MkRedemptionConfigService configService;
|
||||
@Resource
|
||||
private MkEnableConfigService enableConfigService;
|
||||
|
||||
@@ -58,9 +56,8 @@ public class RechargeRedemptionController {
|
||||
*/
|
||||
@SaAdminCheckPermission(value = "rechargeRedemption:detail", name = "充值兑换列表")
|
||||
@GetMapping
|
||||
public CzgResult<MkRechargeRedemptionConfigVO> detail(@RequestParam Integer id) {
|
||||
return CzgResult.success(configService.getOneAs(new QueryWrapper().eq(MkRechargeRedemptionConfig::getId, id)
|
||||
.eq(MkRechargeRedemptionConfig::getMainShopId, StpKit.USER.getMainShopId()), MkRechargeRedemptionConfigVO.class));
|
||||
public CzgResult<MkRedemptionConfigVO> detail(@RequestParam Long id) {
|
||||
return CzgResult.success(configService.detail(StpKit.USER.getMainShopId(), id));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,8 +65,8 @@ public class RechargeRedemptionController {
|
||||
*/
|
||||
@SaAdminCheckPermission(value = "rechargeRedemption:list", name = "充值兑换列表")
|
||||
@GetMapping("/list")
|
||||
public CzgResult<Page<MkRechargeRedemptionConfig>> list(@RequestParam(required = false, defaultValue = "-1") Integer status) {
|
||||
return CzgResult.success(configService.pageInfo(StpKit.USER.getMainShopId(), status));
|
||||
public CzgResult<Page<MkRedemptionConfigVO>> list(@RequestParam(required = false, defaultValue = "-1") Integer status) {
|
||||
return CzgResult.success(configService.pageInfo(StpKit.USER.getMainShopId(), status, true));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -78,8 +75,8 @@ public class RechargeRedemptionController {
|
||||
@SaAdminCheckPermission(value = "rechargeRedemption:add", name = "充值兑换配置添加")
|
||||
@PostMapping
|
||||
@SaCheckMainShop
|
||||
public CzgResult<Boolean> add(@Validated @RequestBody MkRechargeRedemptionConfigDTO dto) {
|
||||
return CzgResult.success(configService.add(StpKit.USER.getMainShopId(), dto));
|
||||
public CzgResult<Boolean> add(@Validated @RequestBody MkRedemptionConfigDTO dto) {
|
||||
return CzgResult.success(configService.add(StpKit.USER.getMainShopId(), dto, true));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,8 +87,8 @@ public class RechargeRedemptionController {
|
||||
@SaAdminCheckPermission(value = "rechargeRedemption:edit", name = "充值兑换修改")
|
||||
@SaCheckMainShop
|
||||
@PutMapping
|
||||
public CzgResult<Boolean> edit(@Validated({UpdateGroup.class, Default.class}) @RequestBody MkRechargeRedemptionConfigDTO dto) {
|
||||
return CzgResult.success(configService.edit(StpKit.USER.getShopId(), dto));
|
||||
public CzgResult<Boolean> edit(@Validated({UpdateGroup.class, Default.class}) @RequestBody MkRedemptionConfigDTO dto) {
|
||||
return CzgResult.success(configService.edit(StpKit.USER.getShopId(), dto, true));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,8 +98,8 @@ public class RechargeRedemptionController {
|
||||
*/
|
||||
@SaAdminCheckPermission(value = "rechargeRedemption:codeList", name = "充值兑换码列表")
|
||||
@GetMapping("/code/list")
|
||||
public CzgResult<Page<MkRechargeRedemptionCodeVO>> 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));
|
||||
public CzgResult<Page<MkRedemptionCodeVO>> 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, true));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,7 +109,7 @@ public class RechargeRedemptionController {
|
||||
@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);
|
||||
configService.exportCodeList(StpKit.USER.getMainShopId(), redemptionId, code, status, response, request, true);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package com.czg.controller.user;
|
||||
|
||||
import com.czg.market.dto.MkRedemptionDTO;
|
||||
import com.czg.market.service.MkCouponRedemptionConfigService;
|
||||
import com.czg.market.service.MkEnableConfigService;
|
||||
import com.czg.market.service.MkRechargeRedemptionConfigService;
|
||||
import com.czg.market.service.MkRedemptionConfigService;
|
||||
import com.czg.resp.CzgResult;
|
||||
import com.czg.sa.StpKit;
|
||||
import jakarta.annotation.Resource;
|
||||
@@ -19,20 +17,15 @@ import org.springframework.web.bind.annotation.*;
|
||||
@RequestMapping("/user/redemption")
|
||||
public class URedemptionController {
|
||||
@Resource
|
||||
private MkRechargeRedemptionConfigService rechargeRedemptionConfigService;
|
||||
@Resource
|
||||
private MkCouponRedemptionConfigService couponRedemptionConfigService;
|
||||
private MkRedemptionConfigService couponRedemptionConfigService;
|
||||
|
||||
/**
|
||||
* 使用券码
|
||||
*/
|
||||
@PostMapping("/exchange")
|
||||
public CzgResult<Boolean> exchange(@Validated @RequestBody MkRedemptionDTO dto) {
|
||||
if ("recharge".equals(dto.getType())) {
|
||||
rechargeRedemptionConfigService.exchange(StpKit.USER.getLoginIdAsLong(), dto);
|
||||
}else {
|
||||
couponRedemptionConfigService.exchange(StpKit.USER.getLoginIdAsLong(), dto);
|
||||
}
|
||||
couponRedemptionConfigService.exchange(StpKit.USER.getLoginIdAsLong(), dto);
|
||||
|
||||
return CzgResult.success();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user