|
|
@@ -829,33 +829,43 @@ public class PartyPositionProvider extends GenericProvider implements IPartyPosi
|
|
|
String userId = ContextUtil.getCurrentUserId();
|
|
|
PartyEmployeePo partyEmployee = partyEmployeeRepository.get(userId);
|
|
|
if (BeanUtils.isNotEmpty(partyEmployee) && StringUtil.isNotBlank(partyEmployee.getPositions())) {
|
|
|
- String position = partyEmployee.getPositions().split(",")[0];
|
|
|
- PartyEntityPo entityPo = partyEntityRepository.get(position);
|
|
|
- List<PartyRolePo> rolePos = partyRoleRepository.findUserRolesByUserId(userId);
|
|
|
- boolean xtgljs = rolePos.stream().anyMatch(role -> "xtgljs".equals(role.getRoleAlias()));
|
|
|
- String path = "";
|
|
|
- if (xtgljs){
|
|
|
- // 系统管理员--当前用户分院下所有部门
|
|
|
- path = entityPo.getPath().split(StringPool.BACK_SLASH+StringPool.DOT)[0];
|
|
|
- }else {
|
|
|
- // 普通用户--当前用户科室下所有部门
|
|
|
- path = entityPo.getPath().split(StringPool.BACK_SLASH+StringPool.DOT)[2];
|
|
|
- }
|
|
|
- groupTreeList = partyEntityRepository.findAllPosition(PartyType.POSITION.getValue(),"","%"+path+"%");
|
|
|
- if (BeanUtils.isNotEmpty(groupTreeList)){
|
|
|
- List<PartyEntityTreePo> entityTreeList = new ArrayList<>();
|
|
|
- for (int i = 0; i < groupTreeList.size(); i++) {
|
|
|
- PartyEntityTreePo bean = groupTreeList.get(i);
|
|
|
- if (bean.getDepth() ==3){
|
|
|
- this.getPosition(bean.getParentId(),entityTreeList);
|
|
|
+// String position = partyEmployee.getPositions().split(",")[0];
|
|
|
+ for (String position : partyEmployee.getPositions().split(",")) {
|
|
|
+
|
|
|
+
|
|
|
+ PartyEntityPo entityPo = partyEntityRepository.get(position);
|
|
|
+ List<PartyRolePo> rolePos = partyRoleRepository.findUserRolesByUserId(userId);
|
|
|
+ boolean xtgljs = rolePos.stream().anyMatch(role -> "xtgljs".equals(role.getRoleAlias()));
|
|
|
+ String path = "";
|
|
|
+ String[] split = entityPo.getPath().split(StringPool.BACK_SLASH + StringPool.DOT);
|
|
|
+ if (xtgljs) {
|
|
|
+ // 系统管理员--当前用户分院下所有部门
|
|
|
+ path = split[0];
|
|
|
+ } else if (split.length < 3) {
|
|
|
+ path = split[split.length - 1];
|
|
|
+ } else {
|
|
|
+ // 普通用户--当前用户科室下所有部门
|
|
|
+ path = split[2];
|
|
|
+ }
|
|
|
+ List<PartyEntityTreePo> groupTreeList2 = partyEntityRepository.findAllPosition(PartyType.POSITION.getValue(), "", "%" + path + "%");
|
|
|
+ if (BeanUtils.isNotEmpty(groupTreeList2)) {
|
|
|
+ List<PartyEntityTreePo> entityTreeList = new ArrayList<>();
|
|
|
+ for (int i = 0; i < groupTreeList2.size(); i++) {
|
|
|
+ PartyEntityTreePo bean = groupTreeList2.get(i);
|
|
|
+ if (bean.getDepth() == 3) {
|
|
|
+ this.getPosition(bean.getParentId(), entityTreeList);
|
|
|
+ }
|
|
|
}
|
|
|
+ groupTreeList2.addAll(entityTreeList);
|
|
|
+ groupTreeList.addAll(groupTreeList2);
|
|
|
}
|
|
|
- groupTreeList.addAll(entityTreeList);
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
List<PartyEntityTreePo> filteredList = groupTreeList.stream()
|
|
|
.filter(Objects::nonNull) // 使用Objects.nonNull方法过滤掉null
|
|
|
+ .sorted(Comparator.comparing(PartyEntityTreePo::getId))
|
|
|
.collect(Collectors.toList()); // 收集过滤后的元素到新的List中
|
|
|
result.setData(PartyUtil.unique(filteredList));
|
|
|
}catch (Exception e){
|