fixed:导入用户

dev_xiangguanfang
SondonYong 2025-12-23 13:30:57 +08:00
parent f5fbc6a8bd
commit 4fcdbc6d5d
1 changed files with 11 additions and 6 deletions

View File

@ -78,7 +78,7 @@ public class UserImportExe {
// 角色数据
MultiResponse<RoleCO> roleCOMultiResponse = roleFacade.listRoles();
if (roleCOMultiResponse == null || CollUtil.isEmpty(roleCOMultiResponse.getData())) {
throw new BizException("未创建默认通用角色,请联系管理员");
throw new BizException("未创建角色,请联系管理员");
}
// 部门数据
List<DepartmentDO> departmentDOList = departmentRepository.listByCorpInfoId(corpinfoId);
@ -349,12 +349,17 @@ public class UserImportExe {
if(StringUtils.isBlank(importEntity.getRoleName())){
throw new BizException("角色名称不能为空");
}
Map<String, RoleCO> roleCOMap = roleList.stream().collect(Collectors.toMap(RoleCO::getRoleName, role -> role));
String roleName = importEntity.getRoleName();
if(roleCOMap.get(roleName) == null){
throw new BizException("角色不存在: " + roleName);
try {
Map<String, RoleCO> roleCOMap = roleList.stream().collect(Collectors.toMap(RoleCO::getRoleName, role -> role));
String roleName = importEntity.getRoleName();
if(roleCOMap.get(roleName) == null){
throw new BizException("角色不存在: " + roleName);
}
return roleCOMap.get(roleName).getId();
}catch (IllegalStateException e){
throw new BizException("系统角色名称重复,请联系管理员");
}
return roleCOMap.get(roleName).getId();
}
/**