From 6d93d5ca16c22f333d89da9124aba6b2a1ad871f Mon Sep 17 00:00:00 2001 From: perry <292303709@qq.com> Date: Sat, 3 Jun 2023 11:32:34 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8E=A8=E5=B9=BF=E5=91=98=E9=87=8D=E5=A4=8D?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/module/member/enums/ErrorCodeConstants.java | 2 ++ .../member/service/promoter/PromoterServiceImpl.java | 8 ++++++-- .../module/member/service/user/MemberUserServiceImpl.java | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java index 504bf8cf7..afa5aacde 100644 --- a/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java +++ b/yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/enums/ErrorCodeConstants.java @@ -15,6 +15,8 @@ public interface ErrorCodeConstants { ErrorCode PROMOTER_NOT_EXISTS = new ErrorCode(1004001002, "推广员不存在"); ErrorCode PROMOTER_EXISTS = new ErrorCode(1004001003, "推广员存在"); + + ErrorCode PROMOTER_EXISTS_OTHER = new ErrorCode(1004001003, "推广员信息存在于其他商户"); ErrorCode PROMOTER_IMPORT_LIST_IS_EMPTY = new ErrorCode(1002003004, "导入推广员数据不能为空!"); // ========== AUTH 模块 1004003000 ========== ErrorCode AUTH_LOGIN_BAD_CREDENTIALS = new ErrorCode(1004003000, "登录失败,账号密码不正确"); diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/promoter/PromoterServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/promoter/PromoterServiceImpl.java index eae3a3245..72d9c85f7 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/promoter/PromoterServiceImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/promoter/PromoterServiceImpl.java @@ -5,6 +5,7 @@ import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.framework.common.exception.ServiceException; import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; +import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore; import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO; import cn.iocoder.yudao.module.member.enums.ErrorCodeConstants; @@ -76,11 +77,13 @@ public class PromoterServiceImpl implements PromoterService { memberUserDO.setPassword(createReqVO.getMobile().substring(createReqVO.getMobile().length() - 6)); memberUserDO = memberUserService.createUserIfAbsent(createReqVO.getMobile(), createReqVO.getNickname(), getClientIP()); } + if(!TenantContextHolder.getTenantId().equals(memberUserDO.getTenantId())){ + throw new ServiceException(PROMOTER_EXISTS_OTHER); + } // 插入 PromoterDO promoter = PromoterConvert.INSTANCE.convert(createReqVO); promoter.setTenantId(TenantContextHolder.getTenantId()); - Long count = promoterMapper.selectCount(Wrappers.lambdaQuery(PromoterDO.class).eq(PromoterDO::getUserId, memberUserDO.getId())); - if (count > 0) { + if (checkIsPromoterByUserId(memberUserDO.getId())) { throw new ServiceException(PROMOTER_EXISTS); } promoter.setUserId(memberUserDO.getId()); @@ -135,6 +138,7 @@ public class PromoterServiceImpl implements PromoterService { * @param userId@return 推广员 */ @Override + @TenantIgnore public Boolean checkIsPromoterByUserId(Long userId) { Long count = this.promoterMapper.selectCount(Wrappers.lambdaQuery(PromoterDO.class).eq(PromoterDO::getUserId, userId)); return count > 0; diff --git a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java index 9b110490d..4b337991f 100644 --- a/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java +++ b/yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java @@ -56,6 +56,7 @@ public class MemberUserServiceImpl implements MemberUserService { private PasswordEncoder passwordEncoder; @Override + @TenantIgnore public MemberUserDO getUserByMobile(String mobile) { return memberUserMapper.selectByMobile(mobile); }