|
|
@ -108,10 +108,11 @@ public class DingUserSyncUtil { |
|
|
List<DepartmentDTO> departmentDTOList = TreeUtils.tree2List(departmentDTOtreeList, DepartmentDTO::getChildrenList); |
|
|
List<DepartmentDTO> departmentDTOList = TreeUtils.tree2List(departmentDTOtreeList, DepartmentDTO::getChildrenList); |
|
|
Map<String , List<Long>> depIdPathMap = new HashMap<>(); |
|
|
Map<String , List<Long>> depIdPathMap = new HashMap<>(); |
|
|
Map<String , List<String>> depNamePathMap = new HashMap<>(); |
|
|
Map<String , List<String>> depNamePathMap = new HashMap<>(); |
|
|
|
|
|
Map<String, String> allDepartmentNameMap = new HashMap<>(); |
|
|
|
|
|
|
|
|
departmentDTOList.forEach(dto -> depIdPathMap.put(dto.getId().toString() , dto.getDeptIdPath())); |
|
|
departmentDTOList.forEach(dto -> depIdPathMap.put(dto.getId().toString() , dto.getDeptIdPath())); |
|
|
departmentDTOList.forEach(dto -> depNamePathMap.put(dto.getId().toString() , dto.getDeptNamePath())); |
|
|
departmentDTOList.forEach(dto -> depNamePathMap.put(dto.getId().toString() , dto.getDeptNamePath())); |
|
|
|
|
|
allDepartment.forEach(dto -> allDepartmentNameMap.put(dto.getId().toString(), dto.getName())); |
|
|
|
|
|
|
|
|
List<List<DepartmentDTO>> departmentPartitions = ListUtil.partition(departmentDTOList, 300); |
|
|
List<List<DepartmentDTO>> departmentPartitions = ListUtil.partition(departmentDTOList, 300); |
|
|
for (List<DepartmentDTO> batch : departmentPartitions) { |
|
|
for (List<DepartmentDTO> batch : departmentPartitions) { |
|
|
@ -124,14 +125,17 @@ public class DingUserSyncUtil { |
|
|
allUserDTOList.forEach(user -> { |
|
|
allUserDTOList.forEach(user -> { |
|
|
Set<Long> depIdPathSet = new HashSet<>(); |
|
|
Set<Long> depIdPathSet = new HashSet<>(); |
|
|
Set<String> depNamePathSet = new HashSet<>(); |
|
|
Set<String> depNamePathSet = new HashSet<>(); |
|
|
|
|
|
Set<String> depNameSet = new HashSet<>(); |
|
|
if (StrUtil.isNotBlank(user.getDeptIdStr())) { |
|
|
if (StrUtil.isNotBlank(user.getDeptIdStr())) { |
|
|
for (String idStr : user.getDeptIdStr().split(",")) { |
|
|
for (String idStr : user.getDeptIdStr().split(",")) { |
|
|
depIdPathSet.addAll(depIdPathMap.get(idStr)); |
|
|
depIdPathSet.addAll(depIdPathMap.get(idStr)); |
|
|
depNamePathSet.addAll(depNamePathMap.get(idStr)); |
|
|
depNamePathSet.addAll(depNamePathMap.get(idStr)); |
|
|
|
|
|
depNameSet.add(allDepartmentNameMap.get(idStr)); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
user.setDeptIdList(depIdPathSet.stream().toList()); |
|
|
user.setDeptIdList(depIdPathSet.stream().toList()); |
|
|
user.setDeptPathNameStr(String.join("," , depNamePathSet)); |
|
|
user.setDeptPathNameStr(String.join("," , depNamePathSet)); |
|
|
|
|
|
user.setDeptNameStr(String.join("," , depNameSet)); |
|
|
}); |
|
|
}); |
|
|
List<List<UserDTO>> userPartitions = ListUtil.partition(allUserDTOList, 300); |
|
|
List<List<UserDTO>> userPartitions = ListUtil.partition(allUserDTOList, 300); |
|
|
for (List<UserDTO> batch : userPartitions) { |
|
|
for (List<UserDTO> batch : userPartitions) { |
|
|
|