可以删除没有子渠道商和直客的渠道商

master
wjt 1 year ago
parent 4beeaec72f
commit 647f5415f8

@ -434,13 +434,17 @@ public class CustomManageServiceImpl implements CustomManageService {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void deleteByUserId(Long userId) { public void deleteByUserId(Long userId) {
ChannelCustom byUserId = channelCustomRepository.findByUserId(userId); ChannelCustom byUserId = channelCustomRepository.findByUserId(userId);
int num = 0; //渠道商,如果下面没有子渠道商和直客 可以删除
int bill = 0; if (byUserId.getType() == 1) {
if (byUserId.getType() == 2) { List<ChannelCustom> byParentId = channelCustomRepository.findByParentId(byUserId.getId());
num = byUserId.getSurplusNum(); if (CollUtil.isNotEmpty(byParentId)) {
bill = byUserId.getSurplusPhoneBill(); throw new BadRequestException("有子渠道商商或直客的不能删除");
channelCustomRepository.deleteByUserId(userId); }
} }
int num = byUserId.getSurplusNum();
int bill = byUserId.getSurplusPhoneBill();
channelCustomRepository.deleteByUserId(userId);
channelCustomRepository.updateSurplusNum(byUserId.getParentId(), num, bill); channelCustomRepository.updateSurplusNum(byUserId.getParentId(), num, bill);
} }

@ -722,7 +722,8 @@ public class UserServiceImpl implements UserService {
} }
this.sourceDel(userId, replaceUserId); this.sourceDel(userId, replaceUserId);
} else if (roleIds.contains(channelId)) { } else if (roleIds.contains(channelId)) {
throw new BadRequestException("暂不支持删除代理商"); customManageService.deleteByUserId(user.getId());
// throw new BadRequestException("暂不支持删除代理商");
} }
//分机号 //分机号

Loading…
Cancel
Save