diff --git a/web-domain/src/main/java/com/zcloud/basic/info/domain/model/UserE.java b/web-domain/src/main/java/com/zcloud/basic/info/domain/model/UserE.java index d417418..4e0d205 100644 --- a/web-domain/src/main/java/com/zcloud/basic/info/domain/model/UserE.java +++ b/web-domain/src/main/java/com/zcloud/basic/info/domain/model/UserE.java @@ -203,9 +203,9 @@ public class UserE extends BaseE { if(CollUtil.isEmpty(departmentList)){ throw new BizException("该企业暂未存在部门信息,请添加部门后重新导入"); } - if(CollUtil.isEmpty(postList)){ - throw new BizException("该企业暂未存在岗位信息,请添加岗位后重新导入"); - } +// if(CollUtil.isEmpty(postList)){ +// throw new BizException("该企业暂未存在岗位信息,请添加岗位后重新导入"); +// } Map departmentEMap = departmentList.stream().collect(Collectors.toMap(DepartmentE::getName, DepartmentE -> DepartmentE)); @@ -237,9 +237,10 @@ public class UserE extends BaseE { } } // 岗位 - if(StringUtils.isEmpty(entity.getPostName())){ - errList.add("第" + (i+2) + "行所属岗位不能为空。"); - }else{ + if(StringUtils.isNotEmpty(entity.getPostName())){ + if(CollUtil.isEmpty(postList)){ + throw new BizException("该企业暂未存在岗位信息,请添加岗位后重新导入"); + } DepartmentE departmentE = departmentEMap.get(entity.getDepartmentName()); if(departmentE != null){ List postListByDepartId = postList.stream().filter(post -> post.getDepartmentId().equals(departmentE.getId())).collect(Collectors.toList()); @@ -252,8 +253,13 @@ public class UserE extends BaseE { } } } - } +// if(StringUtils.isEmpty(entity.getPostName())){ +// errList.add("第" + (i+2) + "行所属岗位不能为空。"); +// }else{ +// +// +// } // 用户名 if(StringUtils.isEmpty(entity.getUsername())){ errList.add("第" + (i+2) + "行用户名不能为空。"); @@ -297,10 +303,12 @@ public class UserE extends BaseE { userE.setDepartmentName(entity.getDepartmentName()); // 岗位 - List postListByDepartId = postList.stream().filter(post -> post.getDepartmentId().equals(departmentId)).collect(Collectors.toList()); - Map postEMap = postListByDepartId.stream().collect(Collectors.toMap(PostE::getPostName, PostE -> PostE)); - userE.setPostId(postEMap.get(entity.getPostName()).getId()); - userE.setPostName(entity.getPostName()); + if(StringUtils.isNotEmpty(entity.getPostName())){ + List postListByDepartId = postList.stream().filter(post -> post.getDepartmentId().equals(departmentId)).collect(Collectors.toList()); + Map postEMap = postListByDepartId.stream().collect(Collectors.toMap(PostE::getPostName, PostE -> PostE)); + userE.setPostId(postEMap.get(entity.getPostName()).getId()); + userE.setPostName(entity.getPostName()); + } // 用户名 userE.setUsername(entity.getUsername());