dev:人员导入去除岗位必填的校验

main
SondonYong 2025-11-20 11:37:48 +08:00
parent 4bfbcdb7ab
commit 2848a33125
1 changed files with 19 additions and 11 deletions

View File

@ -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<String, DepartmentE> 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<PostE> 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<PostE> postListByDepartId = postList.stream().filter(post -> post.getDepartmentId().equals(departmentId)).collect(Collectors.toList());
Map<String, PostE> 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<PostE> postListByDepartId = postList.stream().filter(post -> post.getDepartmentId().equals(departmentId)).collect(Collectors.toList());
Map<String, PostE> 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());