fix: 【bug-101】管理端,更改主账号关联的代理商公司,去掉一个重复的小写的代理商公司,并关联了一个新增的代理商公司,保存时报错
如果移除了公司,则检查被移除的公司是否绑定了子账号,如果绑定了,则不允许移除
This commit is contained in:
parent
d4dfb87460
commit
64ed311191
|
|
@ -204,7 +204,18 @@ public class AppUserController extends ControllerBase {
|
||||||
appUserService.updateById(user);
|
appUserService.updateById(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updatePrimaryAppUser(AppUser user,AppUserUpdateRequest request) throws MessagingException {
|
public void updatePrimaryAppUser(AppUser user,AppUserUpdateRequest request) {
|
||||||
|
Collection<Integer> currentCompanyIds=StrUtil.split(user.getCompanyId(),",").stream().map(Integer::parseInt).collect(Collectors.toSet());
|
||||||
|
currentCompanyIds.removeAll(request.getCompanyIds());
|
||||||
|
if (CollectionUtil.isNotEmpty(currentCompanyIds)){
|
||||||
|
//删除了一些公司,需要判断被删除的公司是否被其他代理商子账号关联,如果被删除的公司下有子账号,则不允许删除
|
||||||
|
VUtils.trueThrowBusinessError(appUserService.lambdaQuery()
|
||||||
|
.eq(AppUser::getIsDel,false)
|
||||||
|
.eq(AppUser::getIsPrimary,false)
|
||||||
|
.in(AppUser::getCompanyId, currentCompanyIds)
|
||||||
|
.exists())
|
||||||
|
.throwMessage("被移除的公司存在子账号,移除失败");
|
||||||
|
}
|
||||||
List<Integer> companyIds = appUserService.lambdaQuery()
|
List<Integer> companyIds = appUserService.lambdaQuery()
|
||||||
.select(AppUser::getCompanyId)
|
.select(AppUser::getCompanyId)
|
||||||
.eq(AppUser::getIsPrimary, true)
|
.eq(AppUser::getIsPrimary, true)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue