From 4fcdbc6d5d89247bbfb588ccd39462910ada8ae4 Mon Sep 17 00:00:00 2001 From: SondonYong Date: Tue, 23 Dec 2025 13:30:57 +0800 Subject: [PATCH] =?UTF-8?q?fixed:=E5=AF=BC=E5=85=A5=E7=94=A8=E6=88=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../basic/info/command/UserImportExe.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/web-app/src/main/java/com/zcloud/basic/info/command/UserImportExe.java b/web-app/src/main/java/com/zcloud/basic/info/command/UserImportExe.java index 4aae1b33..83677c23 100644 --- a/web-app/src/main/java/com/zcloud/basic/info/command/UserImportExe.java +++ b/web-app/src/main/java/com/zcloud/basic/info/command/UserImportExe.java @@ -78,7 +78,7 @@ public class UserImportExe { // 角色数据 MultiResponse roleCOMultiResponse = roleFacade.listRoles(); if (roleCOMultiResponse == null || CollUtil.isEmpty(roleCOMultiResponse.getData())) { - throw new BizException("未创建默认通用角色,请联系管理员"); + throw new BizException("未创建角色,请联系管理员"); } // 部门数据 List departmentDOList = departmentRepository.listByCorpInfoId(corpinfoId); @@ -349,12 +349,17 @@ public class UserImportExe { if(StringUtils.isBlank(importEntity.getRoleName())){ throw new BizException("角色名称不能为空"); } - Map 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 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(); + } /**