Browse Source

#路由修改

zhongwei
yang_shj 1 year ago
parent
commit
48ed6cb427
  1. 34
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainWorkBenchServiceImpl.java

34
hzims-service/operational/src/main/java/com/hnac/hzims/operational/main/service/impl/MainWorkBenchServiceImpl.java

@ -150,16 +150,17 @@ public class MainWorkBenchServiceImpl extends BaseServiceImpl<MainWorkBenchMappe
public InDustryVo getHomePageWorkBench(RoutingParamVo vo) {
InDustryVo inDustryVo = new InDustryVo();
// 查询站点
List<StationEntity> stations = stationService.list();
if(CollectionUtil.isEmpty(stations)){
return null;
}
//根据用户权限获取机构
R<List<Dept>> deptByCurrentUser = sysClient.getDeptByCurrentUser();
if (!deptByCurrentUser.isSuccess() || CollectionUtil.isEmpty(deptByCurrentUser.getData())) {
return null;
}
// 站点类型
List<Integer> typeList = this.getStationTypeList(deptByCurrentUser.getData());
if (CollectionUtil.isEmpty(typeList)) {
return null;
}
// 首页分类类型 : 集团、省子公司、区域、站点
Optional<Dept> 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<MainWorkBenchMappe
// 当前用户
BladeUser user = AuthUtil.getUser();
// 查询路由列表
List<MainWorkBenchEntity> list = this.baseMapper.selectMainWorkBenchByType(deptCategory.toString(), null, vo.getRefTerminal(), typeList,deptList,dept.getId(),user.getUserId());
List<MainWorkBenchEntity> 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<MainWorkBenchMappe
inDustryVo.setMainWorkBenchExtendVo(mainWorkBenchExtendVo);
return inDustryVo;
}
/**
* 获取站点类型
* @param list
* @return List<Integer>
*/
private List<Integer> getStationTypeList(List<Dept> list) {
// 站点类型
List<Integer> 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<StationEntity> stationEntityList = stationService.getStationList(list,null,storage,null,true);
if(CollectionUtil.isEmpty(stationEntityList)){
return null;
}
Map<Integer,List<StationEntity>> map = stationEntityList.stream().collect(Collectors.groupingBy(StationEntity::getType));
if(MapUtils.isEmpty(map)){
return null;
}
return new ArrayList<>(map.keySet());
}
}

Loading…
Cancel
Save