|
|
|
@ -593,59 +593,13 @@ public class StationServiceImpl extends BaseServiceImpl<StationMapper, StationEn |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<StationEntity> getStationList(List<Dept> authList, Long deptId, List<Integer> types, Integer servrType, boolean make) { |
|
|
|
public List<StationEntity> getStationList(List<Dept> authList, Long deptId, List<Integer> types, Integer servrType, boolean make) { |
|
|
|
Dept dept; |
|
|
|
// 取权限机构中已绑定站点的机构(stationId 不为空)
|
|
|
|
if (null == deptId) { |
|
|
|
List<Long> refDepList = authList.stream().filter(o -> StringUtils.isNotBlank(o.getStationId())).map(Dept::getId).collect(Collectors.toList()); |
|
|
|
// 最小类型机构
|
|
|
|
|
|
|
|
Optional<Dept> min = authList.stream().min(Comparator.comparing(Dept::getDeptCategory)); |
|
|
|
|
|
|
|
dept = min.orElse(null); |
|
|
|
|
|
|
|
if (ObjectUtil.isEmpty(dept)) { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 检查是否存在传入机构
|
|
|
|
|
|
|
|
List<Dept> list = authList.stream().filter(o -> deptId.equals(o.getId())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
if (CollectionUtil.isEmpty(list)) { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 传入机构为站点
|
|
|
|
|
|
|
|
dept = list.get(0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
List<Long> refDepList; |
|
|
|
|
|
|
|
if (dept.getDeptCategory().equals(4)) { |
|
|
|
|
|
|
|
refDepList = Collections.singletonList(dept.getId()); |
|
|
|
|
|
|
|
// 传入机构为区域、省子公司、集团
|
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
// 递归权限机构获取站点级机构
|
|
|
|
|
|
|
|
refDepList = this.getStationDeptList(authList, dept.getId(), new ArrayList<>()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 获取水利站点(过滤其他站点类型)
|
|
|
|
// 获取水利站点(过滤其他站点类型)
|
|
|
|
return this.getWaterList(refDepList, types, servrType, make); |
|
|
|
return this.getWaterList(refDepList, types, servrType, make); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 递归权限机构获取站点级机构 |
|
|
|
|
|
|
|
* |
|
|
|
|
|
|
|
* @param departList |
|
|
|
|
|
|
|
* @param deptId |
|
|
|
|
|
|
|
* @param list |
|
|
|
|
|
|
|
* @return |
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
private List<Long> getStationDeptList(List<Dept> departList, Long deptId, List<Long> list) { |
|
|
|
|
|
|
|
if (null == deptId || CollectionUtil.isEmpty(departList)) { |
|
|
|
|
|
|
|
return null; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
departList.forEach(dept -> { |
|
|
|
|
|
|
|
if (dept.getParentId().equals(deptId)) { |
|
|
|
|
|
|
|
if (dept.getDeptCategory().equals(4)) { |
|
|
|
|
|
|
|
list.add(dept.getId()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
getStationDeptList(departList, dept.getId(), list); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
return list; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
|
|
* 获取参数类型站点(过滤其他站点类型) |
|
|
|
* 获取参数类型站点(过滤其他站点类型) |
|
|
|
* |
|
|
|
* |
|
|
|
* @param refDepList |
|
|
|
* @param refDepList |
|
|
|
|