Commit fb9ff66fa436bd4e25116e057d71c38ad4e6bb00

Authored by 房远帅
1 parent fa30fab7

楚江ERP:根据角色code和办事处ID获取办理人

... ... @@ -80,21 +80,13 @@ public class TransactorHandler {
80 80 }
81 81 List<String> result = new ArrayList<>();
82 82 // 获取所有部门(包含子部门)
83   - List<String> childDeptIds = recursionMappingService.getNodeChildIds(deptId, SysDeptNodeType.class);
84   - childDeptIds.add(deptId);
85   - log.info("================== listTransactorsByRoleCodeAndDeptId invoke childDeptIds, childDeptIds:{}", childDeptIds);
  83 + Map<String, List<String>> deptIdMap = userDeptService.mapAllDeptByUserId(userIdList, true);
86 84 for (String id : userIdList) {
87 85 log.info("================== listTransactorsByRoleCodeAndDeptId userId:{}", id);
88   - List<SysUserDept> sysUserDeptList = userDeptService.getByUserId(id);
89   - log.info("================== listTransactorsByRoleCodeAndDeptId sysUserDeptList size:{}", CollectionUtils.isEmpty(sysUserDeptList) ? 0 : sysUserDeptList.size());
90   - if (CollectionUtils.isNotEmpty(sysUserDeptList)) {
91   - List<String> deptIds = sysUserDeptList.stream()
92   - .map(SysUserDept::getDeptId)
93   - .collect(Collectors.toList());
94   - if (childDeptIds.stream()
95   - .anyMatch(deptIds::contains)) {
96   - result.add(id);
97   - }
  86 + List<String> deptIdList = deptIdMap.get(id);
  87 + log.info("================== listTransactorsByRoleCodeAndDeptId deptIdList size:{}", CollectionUtils.isEmpty(deptIdList) ? 0 : deptIdList.size());
  88 + if (CollectionUtils.isNotEmpty(deptIdList) && deptIdList.contains(deptId)) {
  89 + result.add(id);
98 90 }
99 91 }
100 92 log.info("================== listTransactorsByRoleCodeAndDeptId invoke end, transactors:{}", JsonUtil.toJsonString(result));
... ...