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