| | |
| | | import com.zhitan.basicdata.services.IMeterImplementService; |
| | | import com.zhitan.model.domain.EnergyIndex; |
| | | import com.zhitan.model.domain.ModelInfo; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfor; |
| | | import com.zhitan.model.domain.vo.ModelNodeIndexInfo; |
| | | import com.zhitan.model.domain.vo.PointDataVO; |
| | | import com.zhitan.model.mapper.ModelInfoMapper; |
| | | import com.zhitan.model.service.IEnergyIndexService; |
| | |
| | | public List<PointDataVO> listEnergyIndexByModelId(String modelId) { |
| | | List<PointDataVO> voList = new ArrayList<>(); |
| | | // 根据id查询下级id与indexId |
| | | List<ModelNodeIndexInfor> inforList = modelNodeService.listModelNodeIndexIdRelationInforByParentId(modelId); |
| | | List<ModelNodeIndexInfo> inforList = modelNodeService.listModelNodeIndexIdRelationInforByParentId(modelId); |
| | | if (CollectionUtils.isEmpty(inforList)) { |
| | | List<ModelNodeIndexInfor> indexInforList = modelNodeService.getModelNodeIndexIdRelationInforByNodeId(modelId); |
| | | List<ModelNodeIndexInfo> indexInforList = modelNodeService.getModelNodeIndexIdRelationInforByNodeId(modelId); |
| | | if (CollectionUtils.isEmpty(indexInforList)) { |
| | | return voList; |
| | | } |
| | | inforList.addAll(indexInforList); |
| | | } |
| | | // 去除所有点位id信息 |
| | | List<String> indexIds = inforList.stream().map(ModelNodeIndexInfor::getIndexId).collect(Collectors.toList()); |
| | | List<String> indexIds = inforList.stream().map(ModelNodeIndexInfo::getIndexId).collect(Collectors.toList()); |
| | | List<EnergyIndex> energyIndexList = energyIndexService.getEnergyIndexByIds(indexIds); |
| | | // 根据indexid查询对应计量器具信息 |
| | | List<String> meterIds = energyIndexList.stream().map(EnergyIndex::getMeterId).collect(Collectors.toList()); |
| | | if (CollectionUtils.isEmpty(meterIds)) return voList; |
| | | Map<String, List<MeterImplement>> meterImplementMap = meterImplementService.listMeterImplementByIds(meterIds).stream() |
| | | .filter(li -> StringUtils.isNotEmpty(li.getInstallactionLocation())) |
| | | .collect(Collectors.groupingBy(MeterImplement::getId)); |
| | |
| | | if (CollectionUtils.isNotEmpty(meterImplements)) { |
| | | MeterImplement infor = meterImplements.get(0); |
| | | indexName = infor.getInstallactionLocation() + "_" + infor.getMeterName() + "_" + indexName; |
| | | pointData.setIndexName(indexName); |
| | | pointData.setIndexId(indexInfo.getIndexId()); |
| | | voList.add(pointData); |
| | | } |
| | | pointData.setIndexName(indexName); |
| | | pointData.setIndexId(indexInfo.getIndexId()); |
| | | voList.add(pointData); |
| | | |
| | | } |
| | | return voList; |
| | | } |