|
@@ -2955,6 +2955,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
|
HttpRespMsg httpRespMsg=new HttpRespMsg();
|
|
|
//域部门节点
|
|
|
String searchBase = "DC="+dcFirst+",DC="+dcSecond;
|
|
|
+ //String searchBase = "OU=my(组织架构名称),DC=test,DC=com";
|
|
|
//搜索条件
|
|
|
String searchFilter = "objectclass=organizationalUnit";
|
|
|
//String searchFilter = "(&(objectclass=organizationalUnit)(|(name=名称1)(name=名称2)))"; //查询部门,并且部门名称等于名称1或者名称2
|
|
@@ -3063,7 +3064,7 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
|
.setRoleId(smanager.getId())
|
|
|
.setRoleName(smanager.getRolename())
|
|
|
.setName("sysadmin")
|
|
|
- .setPhone("sysadmin@"+dcFirst+dcSecond)
|
|
|
+ .setPhone("sysadmin@"+dcFirst+"."+dcSecond)
|
|
|
.setPassword(MD5Util.getPassword("000000"))
|
|
|
.setColor(ColorUtil.randomColor())
|
|
|
.setCompanyId(company.getId());
|
|
@@ -3222,18 +3223,24 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
|
|
Department department=new Department();
|
|
|
department.setDepartmentName(dept.getString("name"))
|
|
|
.setCompanyId(company.getId());
|
|
|
- String canonicalName = dept.getString("canonicalName");
|
|
|
- String[] split = canonicalName.split("/");
|
|
|
- if(split.length>2){
|
|
|
- String s = split[split.length - 2];
|
|
|
- Department one = departmentMapper.selectOne(new QueryWrapper<Department>().eq("department_name", s).eq("company_id", company.getId()));
|
|
|
- if(one!=null&&Optional.of(one).isPresent()){
|
|
|
- department.setSuperiorId(one.getDepartmentId());
|
|
|
- }
|
|
|
- }
|
|
|
departmentMapper.insert(department);
|
|
|
}
|
|
|
List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", company.getId()));
|
|
|
+ for (JSONObject deptArray : deptArrays) {
|
|
|
+ String canonicalName = deptArray.getString("canonicalName");
|
|
|
+ Optional<Department> first = departmentList.stream().filter(dl -> dl.getDepartmentName().equals(deptArray.getString("name"))).findFirst();
|
|
|
+ if(first.isPresent()){
|
|
|
+ String[] split = canonicalName.split("/");
|
|
|
+ if(split.length>2){
|
|
|
+ String s = split[split.length - 2];
|
|
|
+ Department one = departmentMapper.selectOne(new QueryWrapper<Department>().eq("department_name", s).eq("company_id", company.getId()));
|
|
|
+ if(one!=null&&Optional.of(one).isPresent()){
|
|
|
+ first.get().setSuperiorId(one.getDepartmentId());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ departmentMapper.updateById(first.get());
|
|
|
+ }
|
|
|
+ }
|
|
|
List<JSONObject> userArrays = getUser();
|
|
|
for (JSONObject user : userArrays) {
|
|
|
User u=new User();
|