|
|
|
@ -85,15 +85,15 @@ public class CustomManageServiceImpl implements CustomManageService {
|
|
|
|
|
ChannelCustom parent = getChannelCustomByUserId();
|
|
|
|
|
//设置分配
|
|
|
|
|
if (channelCustom.getTotalNum() != null && channelCustom.getTotalNum() > 0) {
|
|
|
|
|
if (channelCustom.getType() == DefaultNumberConstants.ONE_NUMBER) {
|
|
|
|
|
if (channelCustom.getTotalNum() < DefaultNumberConstants.TEN_THOUSAND) {
|
|
|
|
|
return CommonResponse.createByErrorMessage("渠道商账号最低分配1万");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (channelCustom.getTotalNum() < DefaultNumberConstants.ONE_THOUSAND) {
|
|
|
|
|
return CommonResponse.createByErrorMessage("直客账号最低分配1000");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// if (channelCustom.getType() == DefaultNumberConstants.ONE_NUMBER) {
|
|
|
|
|
// if (channelCustom.getTotalNum() < DefaultNumberConstants.TEN_THOUSAND) {
|
|
|
|
|
// return CommonResponse.createByErrorMessage("渠道商账号最低分配1万");
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// if (channelCustom.getTotalNum() < DefaultNumberConstants.ONE_THOUSAND) {
|
|
|
|
|
// return CommonResponse.createByErrorMessage("直客账号最低分配1000");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
if (parent.getSurplusNum() == null || parent.getSurplusNum() < channelCustom.getTotalNum()) {
|
|
|
|
|
return CommonResponse.createByErrorMessage("可分配的余量不足");
|
|
|
|
|
}
|
|
|
|
@ -102,9 +102,6 @@ public class CustomManageServiceImpl implements CustomManageService {
|
|
|
|
|
parent.setSurplusNum(parent.getSurplusNum() - channelCustom.getTotalNum());
|
|
|
|
|
parent.setCreateTime(DateUtil.date());
|
|
|
|
|
channelCustomRepository.save(parent);
|
|
|
|
|
//分配记录
|
|
|
|
|
ChannelResourceAssign channelResourceAssign = new ChannelResourceAssign().addChannelResourceAssign(parent.getId(), channelCustom.getTotalNum(), channelCustom.getId(), channelCustom.getChannelName());
|
|
|
|
|
channelResourceAssignRepository.save(channelResourceAssign);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//激活码
|
|
|
|
@ -135,6 +132,11 @@ public class CustomManageServiceImpl implements CustomManageService {
|
|
|
|
|
}
|
|
|
|
|
channelCustom.setCreateTime(DateUtil.date());
|
|
|
|
|
channelCustomRepository.save(channelCustom);
|
|
|
|
|
if (channelCustom.getSurplusNum() != null && channelCustom.getSurplusNum() > 0) {
|
|
|
|
|
//分配记录
|
|
|
|
|
ChannelResourceAssign channelResourceAssign = new ChannelResourceAssign().addChannelResourceAssign(parent.getId(), channelCustom.getTotalNum(), channelCustom.getId(), channelCustom.getChannelName());
|
|
|
|
|
channelResourceAssignRepository.save(channelResourceAssign);
|
|
|
|
|
}
|
|
|
|
|
return CommonResponse.createBySuccess();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -144,15 +146,15 @@ public class CustomManageServiceImpl implements CustomManageService {
|
|
|
|
|
ChannelCustom channelCustom = channelCustomRepository.findById(customId).orElse(new ChannelCustom());
|
|
|
|
|
ChannelCustom parent = channelCustomRepository.findById(channelCustom.getParentId()).orElse(new ChannelCustom());
|
|
|
|
|
int parentSurplusNum = parent.getSurplusNum();
|
|
|
|
|
if (channelCustom.getType() == DefaultNumberConstants.ONE_NUMBER) {
|
|
|
|
|
if (assignNum < DefaultNumberConstants.TEN_THOUSAND) {
|
|
|
|
|
return CommonResponse.createByErrorMessage("渠道商账号最低分配1万");
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (assignNum < DefaultNumberConstants.ONE_THOUSAND) {
|
|
|
|
|
return CommonResponse.createByErrorMessage("直客账号最低分配1000");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// if (channelCustom.getType() == DefaultNumberConstants.ONE_NUMBER) {
|
|
|
|
|
// if (assignNum < DefaultNumberConstants.TEN_THOUSAND) {
|
|
|
|
|
// return CommonResponse.createByErrorMessage("渠道商账号最低分配1万");
|
|
|
|
|
// }
|
|
|
|
|
// } else {
|
|
|
|
|
// if (assignNum < DefaultNumberConstants.ONE_THOUSAND) {
|
|
|
|
|
// return CommonResponse.createByErrorMessage("直客账号最低分配1000");
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
if (parentSurplusNum < assignNum) {
|
|
|
|
|
return CommonResponse.createByErrorMessage("可分配的余量不足");
|
|
|
|
|
}
|
|
|
|
|