|
@@ -659,29 +659,32 @@ public class TimingTask {
|
|
SysRole role = sysRoleMapper.selectOne(new QueryWrapper<SysRole>().eq("company_id",compId).eq("rolename","普通员工"));
|
|
SysRole role = sysRoleMapper.selectOne(new QueryWrapper<SysRole>().eq("company_id",compId).eq("rolename","普通员工"));
|
|
List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", compId));
|
|
List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id", compId));
|
|
List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", compId));
|
|
List<User> userList = userMapper.selectList(new QueryWrapper<User>().eq("company_id", compId));
|
|
-// List<JSONObject> deptArrays = userService.ldapGetOU();
|
|
|
|
-// for (JSONObject dept : deptArrays) {
|
|
|
|
-// Department department=new Department();
|
|
|
|
-// department.setDepartmentName(dept.getString("name"))
|
|
|
|
-// .setCompanyId(companyId);
|
|
|
|
-// departmentMapper.insert(department);
|
|
|
|
-// }
|
|
|
|
-// List<Department> departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id",companyId));
|
|
|
|
-// 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",companyId));
|
|
|
|
-// if(one!=null&&Optional.of(one).isPresent()){
|
|
|
|
-// first.get().setSuperiorId(one.getDepartmentId());
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
-// departmentMapper.updateById(first.get());
|
|
|
|
-// }
|
|
|
|
-// }
|
|
|
|
|
|
+ List<JSONObject> deptArrays = userService.ldapGetOU();
|
|
|
|
+ for (JSONObject dept : deptArrays) {
|
|
|
|
+ if(departmentList.stream().anyMatch(dl->dl.getDepartmentName().equals(dept.getString("name")))){
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ Department department=new Department();
|
|
|
|
+ department.setDepartmentName(dept.getString("name"))
|
|
|
|
+ .setCompanyId(compId);
|
|
|
|
+ departmentMapper.insert(department);
|
|
|
|
+ }
|
|
|
|
+ departmentList = departmentMapper.selectList(new QueryWrapper<Department>().eq("company_id",compId));
|
|
|
|
+ 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",compId));
|
|
|
|
+ if(one!=null&&Optional.of(one).isPresent()){
|
|
|
|
+ first.get().setSuperiorId(one.getDepartmentId());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ departmentMapper.updateById(first.get());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
List<JSONObject> userArrays = userService.getUser();
|
|
List<JSONObject> userArrays = userService.getUser();
|
|
Integer[] ints = {514, 546, 66050, 66080, 66082};
|
|
Integer[] ints = {514, 546, 66050, 66080, 66082};
|
|
List<Integer> disable = Arrays.asList(ints);
|
|
List<Integer> disable = Arrays.asList(ints);
|
|
@@ -690,7 +693,9 @@ public class TimingTask {
|
|
List<User> users = userList.stream().filter(ul -> ul.getPhone() != null).collect(Collectors.toList());
|
|
List<User> users = userList.stream().filter(ul -> ul.getPhone() != null).collect(Collectors.toList());
|
|
Optional<User> optional = users.stream().filter(ul -> ul.getPhone() != null && ul.getPhone().equals(user.getString("userPrincipalName"))).findFirst();
|
|
Optional<User> optional = users.stream().filter(ul -> ul.getPhone() != null && ul.getPhone().equals(user.getString("userPrincipalName"))).findFirst();
|
|
if(optional.isPresent()){
|
|
if(optional.isPresent()){
|
|
- userMapper.deleteById(optional.get().getId());
|
|
|
|
|
|
+ User u = optional.get();
|
|
|
|
+ u.setIsActive(0);
|
|
|
|
+ userMapper.updateById(optional.get());
|
|
}
|
|
}
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|