From e2ff175fd12a5eb911fb0af6509a98b205c864ee Mon Sep 17 00:00:00 2001 From: huangyw <1207046171@qq.com> Date: Fri, 2 Aug 2024 08:50:42 +0800 Subject: [PATCH] =?UTF-8?q?release:=20=E5=88=A0=E9=99=A4=E4=BC=9A=E5=91=98?= =?UTF-8?q?=E7=A0=81=20=E5=8F=82=E6=95=B0=E6=8E=A5=E6=94=B6=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- luoo_common/src/main/java/constants/ErrorConstants.java | 2 +- .../java/com/luoo/user/controller/MembershipController.java | 3 +++ .../java/com/luoo/user/service/MembershipCodeService.java | 5 +++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/luoo_common/src/main/java/constants/ErrorConstants.java b/luoo_common/src/main/java/constants/ErrorConstants.java index f8d7b7d..ac9948c 100644 --- a/luoo_common/src/main/java/constants/ErrorConstants.java +++ b/luoo_common/src/main/java/constants/ErrorConstants.java @@ -41,7 +41,7 @@ public class ErrorConstants { // 会员部分 public static final String MEMBERSHIP_CODE_NOT_EXISTS = "会员码不存在"; - public static final String MEMBERSHIP_CODE_ALREADY_USED = "会员码已使用,禁止删除"; + public static final String MEMBERSHIP_CODE_ALREADY_USED = "会员码已使用!"; // 抽奖部分 public static final String CAN_NOT_EDIT = "不允许修改"; diff --git a/luoo_user/src/main/java/com/luoo/user/controller/MembershipController.java b/luoo_user/src/main/java/com/luoo/user/controller/MembershipController.java index 5a88df3..8334012 100644 --- a/luoo_user/src/main/java/com/luoo/user/controller/MembershipController.java +++ b/luoo_user/src/main/java/com/luoo/user/controller/MembershipController.java @@ -108,6 +108,9 @@ public class MembershipController extends BaseController { @ApiOperation(value = "5.删除会员码", notes = "仅限admin权限用户调用") @PostMapping("/code/del") @GlobalInterceptor(checkAdminLogin = true) + @ApiImplicitParams( + @ApiImplicitParam(name = "id", value = "会员码id", required = true, dataType = "String", paramType = "query") + ) public Result delMembershipCode( @RequestHeader(value = "Authorization", required = true) String authorization, @ApiParam(value = "会员码id", required = true) String id) { diff --git a/luoo_user/src/main/java/com/luoo/user/service/MembershipCodeService.java b/luoo_user/src/main/java/com/luoo/user/service/MembershipCodeService.java index c6aac16..dc4e9da 100644 --- a/luoo_user/src/main/java/com/luoo/user/service/MembershipCodeService.java +++ b/luoo_user/src/main/java/com/luoo/user/service/MembershipCodeService.java @@ -129,6 +129,11 @@ public class MembershipCodeService { if (membershipCode == null) { throw new BizException(ErrorConstants.MEMBERSHIP_CODE_NOT_EXISTS); } + + if (!Objects.equals(membershipCode.getStatus(), MembershipEnums.CREATED.getCode())) { + // 已使用,禁止删除 + throw new BizException(ErrorConstants.MEMBERSHIP_CODE_ALREADY_USED); + } // 处理会员码表 membershipCode.setStatus(MembershipEnums.BIND.getCode()); membershipCode.setUserId(userLoginDto.getUserId());