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

master
wjt 1 year ago
parent 4beeaec72f
commit 647f5415f8

@ -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<ChannelCustom> 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);
}

@ -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("暂不支持删除代理商");
}
//分机号

Loading…
Cancel
Save