diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainWorkBenchServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainWorkBenchServiceImpl.java index 1bbc9bc..732f6ce 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainWorkBenchServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainWorkBenchServiceImpl.java @@ -150,16 +150,17 @@ public class MainWorkBenchServiceImpl extends BaseServiceImpl stations = stationService.list(); + if(CollectionUtil.isEmpty(stations)){ + return null; + } + //根据用户权限获取机构 R> deptByCurrentUser = sysClient.getDeptByCurrentUser(); if (!deptByCurrentUser.isSuccess() || CollectionUtil.isEmpty(deptByCurrentUser.getData())) { return null; } - // 站点类型 - List typeList = this.getStationTypeList(deptByCurrentUser.getData()); - if (CollectionUtil.isEmpty(typeList)) { - return null; - } // 首页分类类型 : 集团、省子公司、区域、站点 Optional optionalDept = deptByCurrentUser.getData().stream().min(Comparator.comparing(Dept::getDeptCategory)); Integer deptCategory = optionalDept.isPresent() ? optionalDept.map(Dept::getDeptCategory).orElse(null) : null; @@ -172,7 +173,7 @@ public class MainWorkBenchServiceImpl extends BaseServiceImpl list = this.baseMapper.selectMainWorkBenchByType(deptCategory.toString(), null, vo.getRefTerminal(), typeList,deptList,dept.getId(),user.getUserId()); + List list = this.baseMapper.selectMainWorkBenchByType(deptCategory.toString(), null, vo.getRefTerminal(), stations.stream().map(StationEntity::getType).collect(Collectors.toList()), deptList,dept.getId(),user.getUserId()); // 路由列表包含指定用户,过滤非指定用户数据 boolean isDesign = CollectionUtil.isNotEmpty(list.stream().filter(o->StringUtils.isNotEmpty(o.getAscriptionUser())).collect(Collectors.toList())); if(isDesign){ @@ -183,25 +184,4 @@ public class MainWorkBenchServiceImpl extends BaseServiceImpl - */ - private List getStationTypeList(List list) { - // 站点类型 - List storage = Arrays.asList(HomePageConstant.HYDROPOWER, HomePageConstant.WIND_POWER, HomePageConstant.WATER_CONSERVANCY,HomePageConstant.PUMPING,HomePageConstant.GATE, HomePageConstant.ENERGY_STORAGE, - HomePageConstant.DISTRIBUTION_NETWORK, HomePageConstant.PHOTOVOLTAIC, HomePageConstant.WATER_AFFAIRS, HomePageConstant.CHARGE); - // 查询站点 - List stationEntityList = stationService.getStationList(list,null,storage,null,true); - if(CollectionUtil.isEmpty(stationEntityList)){ - return null; - } - Map> map = stationEntityList.stream().collect(Collectors.groupingBy(StationEntity::getType)); - if(MapUtils.isEmpty(map)){ - return null; - } - return new ArrayList<>(map.keySet()); - } }