上下级关系3

This commit is contained in:
2026-01-31 15:05:28 +08:00
parent 76567aef53
commit ab955c6b8a

View File

@@ -321,13 +321,13 @@ public class MkDistributionUserServiceImpl extends ServiceImpl<MkDistributionUse
@Override @Override
@GlobalTransactional @GlobalTransactional
public void bindInviteUser(Long fromUserId, Long toUserId, Long shopId) throws CzgException, ValidateException { public void bindInviteUser(Long fromUserId, Long toUserId, Long shopId) throws CzgException, ValidateException {
ShopUser shopUser = shopUserService.getById(fromUserId); ShopUser shopUser = shopUserService.getById(toUserId);
AssertUtil.isNull(shopUser, "店铺用户不存在"); AssertUtil.isNull(shopUser, "店铺用户不存在");
MkDistributionInvite shopUserInvite = distributionInviteService.getByShopIdAndShopUserId(shopId, shopUser.getId()); MkDistributionInvite shopUserInvite = distributionInviteService.getByShopIdAndShopUserId(shopId, shopUser.getId());
if (shopUserInvite != null && shopUserInvite.getParentUserId() != null) { if (shopUserInvite != null && shopUserInvite.getParentUserId() != null) {
throw new CzgException("店铺用户已存在上级"); throw new CzgException("店铺用户已存在上级");
} }
MkDistributionUser parent = getOne(QueryWrapper.create().eq(MkDistributionUser::getId, toUserId)); MkDistributionUser parent = getOne(QueryWrapper.create().eq(MkDistributionUser::getId, fromUserId));
AssertUtil.isNull(parent, "邀请人不存在"); AssertUtil.isNull(parent, "邀请人不存在");
if (!parent.getShopId().equals(shopId)) { if (!parent.getShopId().equals(shopId)) {
throw new CzgException("邀请人不是本店铺的分销员"); throw new CzgException("邀请人不是本店铺的分销员");