From 647f5415f80d9445d012220c5b05a64bf882c25e Mon Sep 17 00:00:00 2001 From: wjt Date: Wed, 5 Jul 2023 11:46:26 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E5=88=A0=E9=99=A4=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E5=AD=90=E6=B8=A0=E9=81=93=E5=95=86=E5=92=8C=E7=9B=B4?= =?UTF-8?q?=E5=AE=A2=E7=9A=84=E6=B8=A0=E9=81=93=E5=95=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/CustomManageServiceImpl.java | 16 ++++++++++------ .../system/service/impl/UserServiceImpl.java | 3 ++- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/agent/service/impl/CustomManageServiceImpl.java b/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/agent/service/impl/CustomManageServiceImpl.java index febd4b65..c1557029 100644 --- a/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/agent/service/impl/CustomManageServiceImpl.java +++ b/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/agent/service/impl/CustomManageServiceImpl.java @@ -434,13 +434,17 @@ public class CustomManageServiceImpl implements CustomManageService { @Transactional(rollbackFor = Exception.class) public void deleteByUserId(Long userId) { ChannelCustom byUserId = channelCustomRepository.findByUserId(userId); - int num = 0; - int bill = 0; - if (byUserId.getType() == 2) { - num = byUserId.getSurplusNum(); - bill = byUserId.getSurplusPhoneBill(); - channelCustomRepository.deleteByUserId(userId); + //渠道商,如果下面没有子渠道商和直客 可以删除 + if (byUserId.getType() == 1) { + List byParentId = channelCustomRepository.findByParentId(byUserId.getId()); + if (CollUtil.isNotEmpty(byParentId)) { + throw new BadRequestException("有子渠道商商或直客的不能删除"); + } } + int num = byUserId.getSurplusNum(); + int bill = byUserId.getSurplusPhoneBill(); + channelCustomRepository.deleteByUserId(userId); + channelCustomRepository.updateSurplusNum(byUserId.getParentId(), num, bill); } diff --git a/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/system/service/impl/UserServiceImpl.java b/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/system/service/impl/UserServiceImpl.java index e79b0e8c..3bfda2f9 100644 --- a/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/system/service/impl/UserServiceImpl.java +++ b/ad-platform-manage/ad-platform-management/src/main/java/com/baiye/modules/system/service/impl/UserServiceImpl.java @@ -722,7 +722,8 @@ public class UserServiceImpl implements UserService { } this.sourceDel(userId, replaceUserId); } else if (roleIds.contains(channelId)) { - throw new BadRequestException("暂不支持删除代理商"); + customManageService.deleteByUserId(user.getId()); +// throw new BadRequestException("暂不支持删除代理商"); } //分机号