| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -8,8 +8,6 @@ import com.google.common.collect.Lists; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.google.common.util.concurrent.ThreadFactoryBuilder; | 
					 | 
					 | 
					 | 
					import com.google.common.util.concurrent.ThreadFactoryBuilder; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.hnac.hzims.equipment.entity.WorkshopInfoEntity; | 
					 | 
					 | 
					 | 
					import com.hnac.hzims.equipment.entity.WorkshopInfoEntity; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; | 
					 | 
					 | 
					 | 
					import com.hnac.hzims.equipment.vo.EminfoAndEmParamVo; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.hnac.hzims.fdp.vo.FdpFaultStatusVo; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.hnac.hzims.operational.config.entity.StAlarmRecordEntity; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.hnac.hzims.operational.config.enume.ConfigStatus; | 
					 | 
					 | 
					 | 
					import com.hnac.hzims.operational.config.enume.ConfigStatus; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.hnac.hzims.operational.config.vo.StationRealVo; | 
					 | 
					 | 
					 | 
					import com.hnac.hzims.operational.config.vo.StationRealVo; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import com.hnac.hzims.operational.main.constant.HomePageConstant; | 
					 | 
					 | 
					 | 
					import com.hnac.hzims.operational.main.constant.HomePageConstant; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -41,6 +39,8 @@ import org.springframework.beans.factory.annotation.Value; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import org.springframework.data.redis.core.RedisTemplate; | 
					 | 
					 | 
					 | 
					import org.springframework.data.redis.core.RedisTemplate; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import org.springframework.stereotype.Service; | 
					 | 
					 | 
					 | 
					import org.springframework.stereotype.Service; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					import java.math.BigDecimal; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					import java.math.RoundingMode; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.util.*; | 
					 | 
					 | 
					 | 
					import java.util.*; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.util.concurrent.*; | 
					 | 
					 | 
					 | 
					import java.util.concurrent.*; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					import java.util.function.Function; | 
					 | 
					 | 
					 | 
					import java.util.function.Function; | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -207,9 +207,7 @@ public class MonitorServiceImpl implements MonitorService { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                log.error("real_time_data: {},{}",stationReal.getStation(),realIds); | 
					 | 
					 | 
					 | 
					                log.error("real_time_data: {},{}",stationReal.getStation(),realIds); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                List<String> objects = redisClient.getBatchRealDataByRealId(stationReal.getStation(),realIds); | 
					 | 
					 | 
					 | 
					                List<String> objects = redisClient.getBatchRealDataByRealId(stationReal.getStation(),realIds); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                for(int i = 0; i < realIds.size() ;i++){ | 
					 | 
					 | 
					 | 
					                for(int i = 0; i < realIds.size() ;i++){ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    if(ObjectUtil.isEmpty(objects.get(i))){ | 
					 | 
					 | 
					 | 
					                    if(ObjectUtil.isNotEmpty(objects.get(i))){ | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					//                        log.error(realIds.get(i) + "is null");
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    }else{ | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        Map<String,String> attribute = (Map<String, String>) JSONObject.parse(objects.get(i)); | 
					 | 
					 | 
					 | 
					                        Map<String,String> attribute = (Map<String, String>) JSONObject.parse(objects.get(i)); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        attribute.put("realId",attribute.get("k")); | 
					 | 
					 | 
					 | 
					                        attribute.put("realId",attribute.get("k")); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        attribute.put("value",attribute.get("v")); | 
					 | 
					 | 
					 | 
					                        attribute.put("value",attribute.get("v")); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -272,84 +270,51 @@ public class MonitorServiceImpl implements MonitorService { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */ | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    @Override | 
					 | 
					 | 
					 | 
					    @Override | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    public void loadMonitoring(String param) { | 
					 | 
					 | 
					 | 
					    public void loadMonitoring(String param) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        Thread thread = Thread.currentThread(); | 
					 | 
					 | 
					 | 
					        // 集中监控属性配置
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        Object json = redisTemplate.opsForValue().get(real_data_cache_final); | 
					 | 
					 | 
					 | 
					        Map<String,List<StationAttributeEntity>> attributes = this.attributes(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (ObjectUtil.isEmpty(json)) { | 
					 | 
					 | 
					 | 
					        // realId对应实时数据
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return; | 
					 | 
					 | 
					 | 
					        Map<String,Map<String,String>> realTimeData = this.realTimeData(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        if(MapUtils.isEmpty(attributes) || MapUtils.isEmpty(realTimeData)){ | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        Map<String, Map<String, String>> map = JSONObject.parseObject(json.toString(), new TypeReference<Map<String, Map<String, String>>>() { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (MapUtils.isEmpty(map)) { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return; | 
					 | 
					 | 
					 | 
					            return; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // 获取所有设备重点属性
 | 
					 | 
					 | 
					 | 
					        // 集中监控站点
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<StationAttributeEntity> list = attbtService.list(new LambdaQueryWrapper<StationAttributeEntity>() {{ | 
					 | 
					 | 
					 | 
					        List<StationEntity> stations = this.monitorStations(new ArrayList<>(attributes.keySet())); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            isNotNull(StationAttributeEntity::getStationId); | 
					 | 
					 | 
					 | 
					        if(CollectionUtil.isEmpty(stations)){ | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            eq(StationAttributeEntity::getIsDeleted, "0"); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            orderByAsc(StationAttributeEntity::getSort); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }}); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (CollectionUtil.isEmpty(list)) { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return; | 
					 | 
					 | 
					 | 
					            return; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // 获取所有告警记录
 | 
					 | 
					 | 
					 | 
					        // 机构(取排序字段)
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<StAlarmRecordEntity> alertList = alertService.list(new LambdaQueryWrapper<StAlarmRecordEntity>() {{ | 
					 | 
					 | 
					 | 
					        Map<Long,Integer> sorts = this.monitorDeptSorts(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            orderByDesc(StAlarmRecordEntity::getCreateTime); | 
					 | 
					 | 
					 | 
					        List<String> operations = stations.stream().filter(o->HomePageConstant.HYDROPOWER_SERVETYPE_STRING.equals(o.getServeType())).map(StationEntity::getCode).collect(Collectors.toList()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }}); | 
					 | 
					 | 
					 | 
					        // 告警铃铛(代运维)
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // 所有设备分类
 | 
					 | 
					 | 
					 | 
					        List<String> bells = alarmQueryService.bells(operations); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        // 数据中断(代运维)
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        List<String> aborts = interruptionAlarmService.aborts(operations); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        // 设备状态分类
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        Map<String, List<String>> deviceClassifyMap = (Map<String, List<String>>) redisTemplate.opsForValue().get(device_classify_cache_final); | 
					 | 
					 | 
					 | 
					        Map<String, List<String>> deviceClassifyMap = (Map<String, List<String>>) redisTemplate.opsForValue().get(device_classify_cache_final); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // 所有设备
 | 
					 | 
					 | 
					 | 
					        // 按10个站点一组分割属性配置
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_final).toString(),new TypeReference<List<EminfoAndEmParamVo>>() {}); | 
					 | 
					 | 
					 | 
					        List<Map<String, List<StationAttributeEntity>>> limit = this.limitMapChunk(attributes); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // 根据站点分组
 | 
					 | 
					 | 
					 | 
					        // 线程执行次数
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        Map<String, List<StationAttributeEntity>> stationAttbtMap = list.stream().collect(Collectors.groupingBy(StationAttributeEntity::getStationId)); | 
					 | 
					 | 
					 | 
					        CountDownLatch countDownLatch = new CountDownLatch(limit.size()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // 获取站点列表
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<StationEntity> stationEntityList = stationService.list(Wrappers.<StationEntity>lambdaQuery() | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                .in(StationEntity::getCode,new ArrayList<>(stationAttbtMap.keySet()))); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // 铃铛
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<String> bells = alarmQueryService.bells(stationEntityList.stream().map(StationEntity::getCode).collect(Collectors.toList())); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // 数据中断
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<String> aborts = interruptionAlarmService.aborts(stationEntityList.stream().filter(o->HomePageConstant.HYDROPOWER_SERVETYPE_STR.equals(o.getServeType())).map(StationEntity::getCode).collect(Collectors.toList())); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // 隐藏设备列表
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<String> hideList = attrConfigService.getHideList(); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // 分割,每个map限制10个长度
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<Map<String, List<StationAttributeEntity>>> handleList = this.mapChunk(stationAttbtMap); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // 创建线程池
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					       CountDownLatch countDownLatch = new CountDownLatch(handleList.size()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // 所有机构
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        R<List<Dept>> deptAll = sysClient.getDeptList(); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // 存储数据节点
 | 
					 | 
					 | 
					 | 
					        // 存储数据节点
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<RealStationVo> stationList = new CopyOnWriteArrayList<>(); | 
					 | 
					 | 
					 | 
					        List<RealStationVo> realStations = new CopyOnWriteArrayList<>(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // 线程处理数据
 | 
					 | 
					 | 
					 | 
					        // 切割数据遍历
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        for(Map<String, List<StationAttributeEntity>> item : handleList){ | 
					 | 
					 | 
					 | 
					        for(Map<String, List<StationAttributeEntity>> item : limit){ | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            // 提交线程任务
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            pool.submit(()->{ | 
					 | 
					 | 
					 | 
					            pool.submit(()->{ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                item.forEach((key,value)->{ | 
					 | 
					 | 
					 | 
					                item.forEach((key,value)->{ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    RealStationVo station = new RealStationVo(); | 
					 | 
					 | 
					 | 
					                    RealStationVo realStation = new RealStationVo(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    // 站点编码
 | 
					 | 
					 | 
					 | 
					                    // 设备信息
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    station.setStationCode(key); | 
					 | 
					 | 
					 | 
					                    List<RealDeviceVo> devices = this.monitorRealDevice(value,realTimeData); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    // 名称、限制水位、服务类型、机构、排序
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    this.stationParam(stationEntityList,station,deptAll.getData()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    // 根据设备名称分组
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    Map<String, List<StationAttributeEntity>> deviceAttbtMap = value.stream().filter(o -> !StringUtil.isEmpty(o.getEmName()) && !hideList.contains(o.getEmName())).collect(Collectors.groupingBy(StationAttributeEntity::getEmName)); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    List<RealDeviceVo> deviceList = new ArrayList<>(); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    // device - 设备,arrbt - 设备重点属性
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    deviceAttbtMap.forEach((device, attbt) -> { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        RealDeviceVo deviceVo = new RealDeviceVo(); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        // 设备名称
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        deviceVo.setDeviceName(device); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        deviceVo.setDeviceCode(attbt.get(0).getEmCode()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        // 设备处理
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        this.handleDevice(attbt, map, deviceVo, alertList); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        deviceList.add(deviceVo); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    }); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    // 设备状态
 | 
					 | 
					 | 
					 | 
					                    // 设备状态
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    this.getDeviceParam(devices, deviceClassifyMap, deviceList); | 
					 | 
					 | 
					 | 
					                    this.deviceStatus(devices,deviceClassifyMap); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    // 设置站点状态:数据中断
 | 
					 | 
					 | 
					 | 
					                    realStation.setDeviceList(devices.stream().sorted(Comparator.comparing(RealDeviceVo::getDeviceName)).collect(Collectors.toList())); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    this.setStationStatus(aborts,station,key,deviceList); | 
					 | 
					 | 
					 | 
					                    // 站点基础信息: 编码、名称、限制水位、服务类型、机构、排序
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    // 运行设备状态设置
 | 
					 | 
					 | 
					 | 
					                    this.stationBaseInfo(stations.stream().filter(station->key.equals(station.getCode())).findFirst(),sorts,realStation); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    this.deviceState(deviceList); | 
					 | 
					 | 
					 | 
					                    // 站点总功率计算
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    // 铃铛
 | 
					 | 
					 | 
					 | 
					                    this.stationActivePower(devices,realStation); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    this.stationBell(station,bells); | 
					 | 
					 | 
					 | 
					                    // 站点铃铛、数据中断状态
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    station.setDeviceList(deviceList.stream().sorted(Comparator.comparing((RealDeviceVo::getDeviceName))).collect(Collectors.toList())); | 
					 | 
					 | 
					 | 
					                    this.stationStatus(aborts,bells,realStation); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    stationList.add(station); | 
					 | 
					 | 
					 | 
					                    realStations.add(realStation); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                }); | 
					 | 
					 | 
					 | 
					                }); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                countDownLatch.countDown(); | 
					 | 
					 | 
					 | 
					                countDownLatch.countDown(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            }); | 
					 | 
					 | 
					 | 
					            }); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -361,169 +326,223 @@ public class MonitorServiceImpl implements MonitorService { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            e.printStackTrace(); | 
					 | 
					 | 
					 | 
					            e.printStackTrace(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            Thread.currentThread().interrupt(); | 
					 | 
					 | 
					 | 
					            Thread.currentThread().interrupt(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        redisTemplate.opsForValue().set(moniter_station_cache_final, stationList); | 
					 | 
					 | 
					 | 
					        redisTemplate.opsForValue().set(moniter_station_cache_final, realStations); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    /** | 
					 | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * 站点铃铛设置 | 
					 | 
					 | 
					 | 
					     * 设置设备状态 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param station | 
					 | 
					 | 
					 | 
					     * @param devices | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param bells | 
					 | 
					 | 
					 | 
					     * @param deviceClassifyMap | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */ | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private void stationBell(RealStationVo station, List<String> bells) { | 
					 | 
					 | 
					 | 
					    private void deviceStatus(List<RealDeviceVo> devices, Map<String, List<String>> deviceClassifyMap) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        station.setBell(0); | 
					 | 
					 | 
					 | 
					        if (CollectionUtil.isEmpty(devices) || MapUtils.isEmpty(deviceClassifyMap)) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if(CollectionUtil.isEmpty(bells)){ | 
					 | 
					 | 
					 | 
					            return; | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        List<String> faults = deviceClassifyMap.get(HomePageConstant.FAULT); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        List<String> overhaults = deviceClassifyMap.get(HomePageConstant.OVERHAUL); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        devices.forEach(device -> { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            int state = -1; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            if(StringUtil.isNotBlank(device.getDeviceCode())){ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                // 故障
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                if (CollectionUtil.isNotEmpty(faults) && faults.contains(device.getDeviceCode())) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    state = 4; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                // 检修
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                } else if (CollectionUtil.isNotEmpty(overhaults) && overhaults.contains(device.getDeviceCode())) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    state = 0; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            if(state >= 0){ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                device.setState(state); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            }else{ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                List<RealAttributeVo> attbts = device.getAttbtList(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                // 功率属性记录
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                List<RealAttributeVo> powers = attbts.stream().filter(att-> HomePageConstant.powerList.contains(att.getName())).collect(Collectors.toList()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                if(CollectionUtil.isEmpty(powers)){ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    device.setState(-1); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    return; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                if("0.000000".equals(powers.get(0).getValue()) || "-".equals(powers.get(0).getValue()) || HomePageConstant.ON.equals(powers.get(0).getValue())){ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                    device.setState(-1); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    return; | 
					 | 
					 | 
					 | 
					                    return; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                } | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if(bells.contains(station.getStationCode())){ | 
					 | 
					 | 
					 | 
					                device.setState(1); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            station.setBell(1); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        }); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    /** | 
					 | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * 设备处理 | 
					 | 
					 | 
					 | 
					     * 站点总功率计算 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * | 
					 | 
					 | 
					 | 
					     * @param devices | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param list、 | 
					 | 
					 | 
					 | 
					     * @param realStation | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param map | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param device | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */ | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private void handleDevice(List<StationAttributeEntity> list, Map<String, Map<String, String>> map, | 
					 | 
					 | 
					 | 
					    private void stationActivePower(List<RealDeviceVo> devices, RealStationVo realStation) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                              RealDeviceVo device, List<StAlarmRecordEntity> alertList) { | 
					 | 
					 | 
					 | 
					        realStation.setPowerSum(0.0); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (CollectionUtil.isEmpty(list) || MapUtils.isEmpty(map)) { | 
					 | 
					 | 
					 | 
					        if (CollectionUtil.isEmpty(devices)) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return; | 
					 | 
					 | 
					 | 
					            return; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<RealAttributeVo> attbtList = new ArrayList<>(); | 
					 | 
					 | 
					 | 
					        double powerSum = 0.0; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        list.forEach(item -> { | 
					 | 
					 | 
					 | 
					        // 遍历设备
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            RealAttributeVo realAttributeVo = new RealAttributeVo(); | 
					 | 
					 | 
					 | 
					        for (RealDeviceVo item : devices) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            // 设备重点属性处理 : 单条-item
 | 
					 | 
					 | 
					 | 
					            List<RealAttributeVo> attributes = item.getAttbtList(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            Map<String, String> real = map.get(item.getMonitorId()); | 
					 | 
					 | 
					 | 
					            if (CollectionUtil.isEmpty(attributes)) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if(MapUtils.isEmpty(real)){ | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                realAttributeVo.setName(item.getAttributes()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                realAttributeVo.setType(item.getAttributeType()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                realAttributeVo.setRealId(item.getMonitorId()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                realAttributeVo.setQuality(-1); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                realAttributeVo.setStatus(0); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                realAttributeVo.setValue("0"); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                realAttributeVo.setUnit(item.getUnit()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                attbtList.add(realAttributeVo); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                return; | 
					 | 
					 | 
					 | 
					                return; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            realAttributeVo = handleAttbt(item, real, alertList); | 
					 | 
					 | 
					 | 
					            List<RealAttributeVo> powerList = attributes.stream().filter(o -> StringUtil.isNoneBlank(o.getValue()) && !"-".equals(o.getValue()) && HomePageConstant.powerList.contains(o.getName())).collect(Collectors.toList()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (ObjectUtil.isEmpty(realAttributeVo)) { | 
					 | 
					 | 
					 | 
					            if (CollectionUtil.isEmpty(powerList)) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                return; | 
					 | 
					 | 
					 | 
					                return; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            attbtList.add(realAttributeVo); | 
					 | 
					 | 
					 | 
					            // 获取设备中属性为P/p的value值总和
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }); | 
					 | 
					 | 
					 | 
					            powerSum += BigDecimal.valueOf(powerList.stream().mapToDouble(m -> Double.parseDouble(m.getValue())).sum()).setScale(2, RoundingMode.HALF_UP).doubleValue(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        device.setAttbtList(attbtList); | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    /** | 
					 | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * 设备状态 | 
					 | 
					 | 
					 | 
					     * 站点铃铛、数据中断状态 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param deviceList | 
					 | 
					 | 
					 | 
					     * @param aborts | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @param bells | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @param realStation | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */ | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private void deviceState(List<RealDeviceVo> deviceList) { | 
					 | 
					 | 
					 | 
					    private void stationStatus(List<String> aborts, List<String> bells, RealStationVo realStation) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        deviceList.forEach(device->{ | 
					 | 
					 | 
					 | 
					        realStation.setBell(0); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            // 设备属性列表
 | 
					 | 
					 | 
					 | 
					        realStation.setStatus(0); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            List<RealAttributeVo> attbts = device.getAttbtList(); | 
					 | 
					 | 
					 | 
					        // 铃铛
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if(CollectionUtil.isEmpty(attbts)){ | 
					 | 
					 | 
					 | 
					        if(bells.contains(realStation.getStationCode())){ | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                device.setState(-1); | 
					 | 
					 | 
					 | 
					            realStation.setBell(1); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                return; | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        // 数据中断
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        if(realStation.getPowerSum() <= 0 && aborts.contains(realStation.getStationCode())){ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            realStation.setStatus(1); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            // 功率属性记录
 | 
					 | 
					 | 
					 | 
					    /** | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            List<RealAttributeVo> powers = attbts.stream().filter(att-> HomePageConstant.powerList.contains(att.getName())).collect(Collectors.toList()); | 
					 | 
					 | 
					 | 
					     * 监控设备实时信息 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if(CollectionUtil.isEmpty(powers)){ | 
					 | 
					 | 
					 | 
					     * @param attributes | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                device.setState(-1); | 
					 | 
					 | 
					 | 
					     * @param realTimeData | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                return; | 
					 | 
					 | 
					 | 
					     * @return | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    private List<RealDeviceVo> monitorRealDevice(List<StationAttributeEntity> attributes,Map<String,Map<String,String>> realTimeData) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        if(CollectionUtil.isEmpty(attributes)){ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            return new ArrayList<>(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if("0.000000".equals(powers.get(0).getValue()) || "-".equals(powers.get(0).getValue()) || HomePageConstant.ON.equals(powers.get(0).getValue())){ | 
					 | 
					 | 
					 | 
					        // 根据设备名称分组
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                device.setState(-1); | 
					 | 
					 | 
					 | 
					        return attributes.stream().filter(o -> !StringUtil.isEmpty(o.getEmName())).collect(Collectors.groupingBy(StationAttributeEntity::getEmName)).entrySet().stream().map(entry->{ | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                return; | 
					 | 
					 | 
					 | 
					            RealDeviceVo device = new RealDeviceVo(); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            device.setDeviceName(entry.getKey()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            device.setDeviceCode(entry.getValue().get(0).getEmCode()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            // 设备处理
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            this.handleDevice(entry.getValue(), realTimeData, device); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            return device; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        }).collect(Collectors.toList()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            device.setState(1); | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					     * 获取缓存中实时数据 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @return | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    private Map<String, Map<String, String>> realTimeData() { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        Object json = redisTemplate.opsForValue().get(real_data_cache_final); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        if (ObjectUtil.isEmpty(json)) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            return new HashMap<>(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        return JSONObject.parseObject(json.toString(), new TypeReference<Map<String, Map<String, String>>>() { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }); | 
					 | 
					 | 
					 | 
					        }); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    /** | 
					 | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * 获取站点属性 | 
					 | 
					 | 
					 | 
					     * 查询集中监控属性配置 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param stationEntityList | 
					 | 
					 | 
					 | 
					     * @return | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param item | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */ | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private void stationParam(List<StationEntity> stationEntityList, RealStationVo item,List<Dept> deptAll) { | 
					 | 
					 | 
					 | 
					    private Map<String,List<StationAttributeEntity>> attributes() { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        item.setSort(9999); | 
					 | 
					 | 
					 | 
					        List<StationAttributeEntity> attributes = attbtService.list(new LambdaQueryWrapper<StationAttributeEntity>() {{ | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if(CollectionUtil.isEmpty(stationEntityList)){ | 
					 | 
					 | 
					 | 
					            isNotNull(StationAttributeEntity::getStationId); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return; | 
					 | 
					 | 
					 | 
					            orderByAsc(StationAttributeEntity::getSort); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        }}); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        if(CollectionUtil.isEmpty(attributes)){ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            return new HashMap<>(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<StationEntity> filterList = stationEntityList.stream().filter(o->item.getStationCode().equals(o.getCode())).collect(Collectors.toList()); | 
					 | 
					 | 
					 | 
					        return attributes.stream().collect(Collectors.groupingBy(StationAttributeEntity::getStationId)); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if(CollectionUtil.isEmpty(filterList)){ | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        StationEntity station = filterList.get(0); | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if(ObjectUtil.isEmpty(station)){ | 
					 | 
					 | 
					 | 
					    /** | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return; | 
					 | 
					 | 
					 | 
					     * 集中监控站点 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @param codes | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @return | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    private List<StationEntity> monitorStations(ArrayList<String> codes) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        return stationService.list(Wrappers.<StationEntity>lambdaQuery() | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                .in(StationEntity::getCode,codes) | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        ); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        item.setStationName(station.getName()); | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        item.setWaterLevelMax(Optional.ofNullable(station.getLimitWaterLevel()).orElse(0.0)); | 
					 | 
					 | 
					 | 
					    /** | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        item.setServerType(station.getServeType()); | 
					 | 
					 | 
					 | 
					     * 机构排序 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        item.setStationDeptId(station.getRefDept()); | 
					 | 
					 | 
					 | 
					     * @return | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // 排序
 | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<Dept> list = deptAll.stream().filter(o-> station.getRefDept().equals(o.getId())).collect(Collectors.toList()); | 
					 | 
					 | 
					 | 
					    private Map<Long, Integer> monitorDeptSorts() { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if(CollectionUtil.isEmpty(list)){ | 
					 | 
					 | 
					 | 
					        R<List<Dept>> depts = sysClient.getDeptList(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return; | 
					 | 
					 | 
					 | 
					        if (!depts.isSuccess() || CollectionUtil.isEmpty(depts.getData())) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            new HashMap<>(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        item.setSort(list.get(0).getSort()); | 
					 | 
					 | 
					 | 
					        return depts.getData().stream().collect(Collectors.toMap(Dept::getId,Dept::getSort)); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    /** | 
					 | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * 设备参数设置 | 
					 | 
					 | 
					 | 
					     * 站点基础信息 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * | 
					 | 
					 | 
					 | 
					     * @param realStation | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param devices | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param deviceClassifyMap | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param deviceList | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */ | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private void getDeviceParam(List<EminfoAndEmParamVo> devices, Map<String, List<String>> deviceClassifyMap, List<RealDeviceVo> deviceList) { | 
					 | 
					 | 
					 | 
					    private void stationBaseInfo(Optional<StationEntity> optional, Map<Long, Integer> sorts, RealStationVo realStation) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (CollectionUtil.isEmpty(devices) || CollectionUtil.isEmpty(deviceList) || MapUtils.isEmpty(deviceClassifyMap)) { | 
					 | 
					 | 
					 | 
					        realStation.setSort(999); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        if(!optional.isPresent()){ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return; | 
					 | 
					 | 
					 | 
					            return; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<String> faultList = deviceClassifyMap.get(HomePageConstant.FAULT); | 
					 | 
					 | 
					 | 
					        realStation.setStationCode(optional.get().getCode()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<String> maintaintList = deviceClassifyMap.get(HomePageConstant.MAINTAIN); | 
					 | 
					 | 
					 | 
					        realStation.setStationName(optional.get().getName()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<String> overhaultList = deviceClassifyMap.get(HomePageConstant.OVERHAUL); | 
					 | 
					 | 
					 | 
					        realStation.setWaterLevelMax(Optional.ofNullable(optional.get().getLimitWaterLevel()).orElse(0.0)); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<String> runtList = deviceClassifyMap.get(HomePageConstant.RUN); | 
					 | 
					 | 
					 | 
					        realStation.setServerType(optional.get().getServeType()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<String> sparetList = deviceClassifyMap.get(HomePageConstant.SPARE); | 
					 | 
					 | 
					 | 
					        realStation.setStationDeptId(optional.get().getRefDept()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        deviceList.forEach(device -> { | 
					 | 
					 | 
					 | 
					        if(sorts.containsKey(optional.get().getRefDept())){ | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (StringUtil.isBlank(device.getDeviceCode())) { | 
					 | 
					 | 
					 | 
					            realStation.setSort(sorts.get(optional.get().getRefDept())); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                device.setState(-1); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                return; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            List<EminfoAndEmParamVo> list = devices.stream().filter(o -> null != o.getId() && o.getId().toString().equals(device.getDeviceCode())).collect(Collectors.toList()); | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (CollectionUtil.isEmpty(list)) { | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                device.setState(-1); | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					     * 设备处理 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					     * | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @param list、 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @param map | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					     * @param device | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    private void handleDevice(List<StationAttributeEntity> list, Map<String, Map<String, String>> map,RealDeviceVo device) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        if (CollectionUtil.isEmpty(list) || MapUtils.isEmpty(map)) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return; | 
					 | 
					 | 
					 | 
					            return; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            String deviceCode = list.get(0).getEmCode(); | 
					 | 
					 | 
					 | 
					        List<RealAttributeVo> attbtList = new ArrayList<>(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (StringUtil.isBlank(deviceCode)) { | 
					 | 
					 | 
					 | 
					        list.forEach(item -> { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                device.setState(-1); | 
					 | 
					 | 
					 | 
					            RealAttributeVo realAttributeVo = new RealAttributeVo(); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            // 设备重点属性处理 : 单条-item
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            Map<String, String> real = map.get(item.getMonitorId()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            if(MapUtils.isEmpty(real)){ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                realAttributeVo.setName(item.getAttributes()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                realAttributeVo.setType(item.getAttributeType()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                realAttributeVo.setRealId(item.getMonitorId()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                realAttributeVo.setQuality(-1); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                realAttributeVo.setStatus(0); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                realAttributeVo.setValue("0"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                realAttributeVo.setUnit(item.getUnit()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                attbtList.add(realAttributeVo); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                return; | 
					 | 
					 | 
					 | 
					                return; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            // 故障
 | 
					 | 
					 | 
					 | 
					            realAttributeVo = handleAttbt(item, real); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (CollectionUtil.isNotEmpty(faultList) && faultList.contains(deviceCode)) { | 
					 | 
					 | 
					 | 
					            if (ObjectUtil.isEmpty(realAttributeVo)) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                device.setState(4); | 
					 | 
					 | 
					 | 
					                return; | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                // 保养
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } else if (CollectionUtil.isNotEmpty(maintaintList) && maintaintList.contains(deviceCode)) { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                device.setState(3); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                // 备用
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } else if (CollectionUtil.isNotEmpty(sparetList) && sparetList.contains(deviceCode)) { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                device.setState(2); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                // 运行
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } else if (CollectionUtil.isNotEmpty(runtList) && runtList.contains(deviceCode)) { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                device.setState(1); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                // 检修
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } else if (CollectionUtil.isNotEmpty(overhaultList) && overhaultList.contains(deviceCode)) { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                device.setState(0); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                // 未知
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } else { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                device.setState(-1); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					            } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            attbtList.add(realAttributeVo); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }); | 
					 | 
					 | 
					 | 
					        }); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        device.setAttbtList(attbtList); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    /** | 
					 | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -533,8 +552,7 @@ public class MonitorServiceImpl implements MonitorService { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param real | 
					 | 
					 | 
					 | 
					     * @param real | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @return | 
					 | 
					 | 
					 | 
					     * @return | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */ | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private RealAttributeVo handleAttbt(StationAttributeEntity item, Map<String, String> real, | 
					 | 
					 | 
					 | 
					    private RealAttributeVo handleAttbt(StationAttributeEntity item, Map<String, String> real) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                        List<StAlarmRecordEntity> alertList) { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        RealAttributeVo attest = new RealAttributeVo(); | 
					 | 
					 | 
					 | 
					        RealAttributeVo attest = new RealAttributeVo(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        this.setAttbtParam(attest, real); | 
					 | 
					 | 
					 | 
					        this.setAttbtParam(attest, real); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        attest.setRealId(item.getMonitorId()); | 
					 | 
					 | 
					 | 
					        attest.setRealId(item.getMonitorId()); | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -544,7 +562,7 @@ public class MonitorServiceImpl implements MonitorService { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        String value = Optional.ofNullable(attest.getValue()).orElse("-"); | 
					 | 
					 | 
					 | 
					        String value = Optional.ofNullable(attest.getValue()).orElse("-"); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // 正常状态
 | 
					 | 
					 | 
					 | 
					        // 正常状态
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        attest.setStatus(ConfigStatus.ConfigStatusEnum.NORMAL.getStatus()); | 
					 | 
					 | 
					 | 
					        attest.setStatus(ConfigStatus.ConfigStatusEnum.NORMAL.getStatus()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        int quality = Optional.ofNullable(attest.getQuality()).orElse(-1); | 
					 | 
					 | 
					 | 
					        int quality = Optional.of(attest.getQuality()).orElse(-1); | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        String time = Optional.ofNullable(attest.getTime()).orElse(""); | 
					 | 
					 | 
					 | 
					        String time = Optional.ofNullable(attest.getTime()).orElse(""); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // 延时状态 :质量为空 && 时间为空
 | 
					 | 
					 | 
					 | 
					        // 延时状态 :质量为空 && 时间为空
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (-1 == quality && StringUtil.isEmpty(time)) { | 
					 | 
					 | 
					 | 
					        if (-1 == quality && StringUtil.isEmpty(time)) { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -552,14 +570,16 @@ public class MonitorServiceImpl implements MonitorService { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        int type = item.getAttributeType(); | 
					 | 
					 | 
					 | 
					        int type = item.getAttributeType(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        switch (type) { | 
					 | 
					 | 
					 | 
					        switch (type) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            case 1://遥测
 | 
					 | 
					 | 
					 | 
					            //遥测
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					            case 1: | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                // 预警状态 :value值为"1" &&  quality值为0
 | 
					 | 
					 | 
					 | 
					                // 预警状态 :value值为"1" &&  quality值为0
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                if ("1".equals(value) && 0 == quality) { | 
					 | 
					 | 
					 | 
					                if ("1".equals(value) && 0 == quality) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    attest.setStatus(ConfigStatus.ConfigStatusEnum.RED.getStatus()); | 
					 | 
					 | 
					 | 
					                    attest.setStatus(ConfigStatus.ConfigStatusEnum.RED.getStatus()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                } | 
					 | 
					 | 
					 | 
					                } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                break; | 
					 | 
					 | 
					 | 
					                break; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            case 2://遥信
 | 
					 | 
					 | 
					 | 
					            //遥信
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                signalyRemote(item, attest, quality, value, alertList); | 
					 | 
					 | 
					 | 
					            case 2: | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					                signalyRemote(item, attest, quality, value); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                //处理
 | 
					 | 
					 | 
					 | 
					                //处理
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                break; | 
					 | 
					 | 
					 | 
					                break; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            default: | 
					 | 
					 | 
					 | 
					            default: | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -606,9 +626,9 @@ public class MonitorServiceImpl implements MonitorService { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * | 
					 | 
					 | 
					 | 
					     * | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param attest | 
					 | 
					 | 
					 | 
					     * @param attest | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */ | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private void signalyRemote(StationAttributeEntity item, RealAttributeVo attest, int quality, String strValue, List<StAlarmRecordEntity> alertList) { | 
					 | 
					 | 
					 | 
					    private void signalyRemote(StationAttributeEntity attribute, RealAttributeVo attest, int quality, String strValue) { | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        //需要所有值的数据不为null,并且满足条件才会进去添加数据返回id
 | 
					 | 
					 | 
					 | 
					        // 需要所有限制不为null,并且满足条件才会设置设备状态标识
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (null == item.getUpUpLimit() || null == item.getDownDownLimit() || null == item.getUpLimit() || null == item.getDownLimit()) { | 
					 | 
					 | 
					 | 
					        if (null == attribute.getUpUpLimit() || null == attribute.getDownDownLimit() || null == attribute.getUpLimit() || null == attribute.getDownLimit()) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return; | 
					 | 
					 | 
					 | 
					            return; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (-1 == quality) { | 
					 | 
					 | 
					 | 
					        if (-1 == quality) { | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -620,99 +640,17 @@ public class MonitorServiceImpl implements MonitorService { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if ("-".equals(strValue)) { | 
					 | 
					 | 
					 | 
					        if ("-".equals(strValue)) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return; | 
					 | 
					 | 
					 | 
					            return; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        double upup = item.getUpUpLimit(); | 
					 | 
					 | 
					 | 
					        double upup = attribute.getUpUpLimit(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        double lwlw = item.getDownDownLimit(); | 
					 | 
					 | 
					 | 
					        double lwlw = attribute.getDownDownLimit(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        double up = item.getUpLimit(); | 
					 | 
					 | 
					 | 
					        double up = attribute.getUpLimit(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        double lw = item.getDownLimit(); | 
					 | 
					 | 
					 | 
					        double lw = attribute.getDownLimit(); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        //查询出来已处理告警记录
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<StAlarmRecordEntity> handleList = alertList.stream().filter(o -> o.getStationId().equals(item.getStationId()) && o.getRealId().equals(attest.getRealId()) && o.getStatus() == 1).collect(Collectors.toList()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        //查询出来未处理告警记录
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        List<StAlarmRecordEntity> recordList = alertList.stream().filter(o -> o.getStationId().equals(item.getStationId()) && o.getRealId().equals(attest.getRealId()) && o.getStatus() == 0).collect(Collectors.toList()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        long past = 0L; | 
					 | 
					 | 
					 | 
					        long past = 0L; | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        double value = Double.parseDouble(strValue); | 
					 | 
					 | 
					 | 
					        double value = Double.parseDouble(strValue); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (value > upup || value < lwlw) { | 
					 | 
					 | 
					 | 
					        if (value > upup || value < lwlw) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (CollectionUtil.isNotEmpty(handleList)) { | 
					 | 
					 | 
					 | 
					            attest.setStatus(ConfigStatus.ConfigStatusEnum.RED.getStatus()); | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                // 现在时间 - 处理时间
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                past = System.currentTimeMillis() - handleList.get(0).getProcessTime().getTime(); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            boolean isOverrun = ((CollectionUtil.isEmpty(handleList) && CollectionUtil.isEmpty(recordList)) || (past / 1000 / 60 > 30 && CollectionUtil.isEmpty(recordList))); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (isOverrun) { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                Long alertId = alertService.insertAlert(item.getStationId(), item.getMonitorId()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                attest.setId(alertId); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                attest.setStatus(ConfigStatus.ConfigStatusEnum.YELLOW.getStatus()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } else if (CollectionUtil.isNotEmpty(recordList)) { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                StAlarmRecordEntity record = recordList.get(0); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                attest.setId(record.getId()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                // 告警处理完成
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                if (record.getProcessTime() != null && record.getStatus() == (byte) 1) { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    attest.setStatus(ConfigStatus.ConfigStatusEnum.NORMAL.getStatus()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    // 告警未处理
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                } else if (record.getProcessTime() == null && record.getStatus() == (byte) 0) { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    attest.setStatus(ConfigStatus.ConfigStatusEnum.HAND_DELAY_STATUS.getStatus()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                } | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } else if (value > up && value < upup || value < lw && value > lwlw) { | 
					 | 
					 | 
					 | 
					        } else if (value > up && value < upup || value < lw && value > lwlw) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (CollectionUtil.isNotEmpty(handleList)) { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                // 现在时间 - 处理时间
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                past = System.currentTimeMillis() - handleList.get(0).getProcessTime().getTime(); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            boolean exist = ((CollectionUtil.isEmpty(handleList) && CollectionUtil.isEmpty(recordList)) || (past / 1000 / 60 > 30 && CollectionUtil.isEmpty(recordList))); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if (exist){ | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                Long alertId = alertService.insertAlert(item.getStationId(), item.getMonitorId()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                attest.setId(alertId); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            attest.setStatus(ConfigStatus.ConfigStatusEnum.YELLOW.getStatus()); | 
					 | 
					 | 
					 | 
					            attest.setStatus(ConfigStatus.ConfigStatusEnum.YELLOW.getStatus()); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                // 存在告警记录
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } else if (CollectionUtil.isNotEmpty(recordList)) { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                StAlarmRecordEntity record = recordList.get(0); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                if (recordList.get(0).getStatus() == (byte) 0 && recordList.get(0).getCreateTime() != null) { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    attest.setId(record.getId()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    attest.setStatus(ConfigStatus.ConfigStatusEnum.RED.getStatus()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                } else { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    attest.setId(recordList.get(0).getId()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    attest.setStatus(ConfigStatus.ConfigStatusEnum.NORMAL.getStatus()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                } | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    /** | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * 设置站点状态 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param station | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param key | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */ | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private void setStationStatus(List<String> aborts,RealStationVo station, String key,List<RealDeviceVo> deviceList) { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        // 站点功率大于0为正常上送数据
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        for(RealDeviceVo item : deviceList){ | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            if(!CollectionUtil.isEmpty(item.getAttbtList())){ | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                List<RealAttributeVo> powers = item.getAttbtList().stream().filter(att-> HomePageConstant.powerList.contains(att.getName())).collect(Collectors.toList()); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                if(!CollectionUtil.isEmpty(powers)){ | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    for(RealAttributeVo attr :  powers){ | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        if(!"-".equals(attr.getValue())){ | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            if(attr.getQuality() == 0 && Double.parseDouble(attr.getValue()) > 0){ | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                station.setStatus(0); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                                return; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                            } | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                        } | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                    } | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					                } | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            } | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if(aborts.contains(key)){ | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            station.setStatus(1); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    /** | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * 获取所有告警记录 | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @return | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */ | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private List<FdpFaultStatusVo> getFdpFaultAll() { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        Object json = redisTemplate.opsForValue().get(fdp_fault_cache_final); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (ObjectUtil.isEmpty(json)) { | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return new ArrayList<>(); | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        return (List<FdpFaultStatusVo>) json; | 
					 | 
					 | 
					 | 
					 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    } | 
					 | 
					 | 
					 | 
					    } | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    /** | 
					 | 
					 | 
					 | 
					    /** | 
				
			
			
		
	
	
		
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
					 | 
					@ -723,7 +661,7 @@ public class MonitorServiceImpl implements MonitorService { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @param chunkMap | 
					 | 
					 | 
					 | 
					     * @param chunkMap | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     * @return | 
					 | 
					 | 
					 | 
					     * @return | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					     */ | 
					 | 
					 | 
					 | 
					     */ | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    private <k, v> List<Map<k, v>> mapChunk(Map<k, v> chunkMap) { | 
					 | 
					 | 
					 | 
					    private <k, v> List<Map<k, v>> limitMapChunk(Map<k, v> chunkMap) { | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (chunkMap == null) { | 
					 | 
					 | 
					 | 
					        if (chunkMap == null) { | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					            return Lists.newArrayList(); | 
					 | 
					 | 
					 | 
					            return Lists.newArrayList(); | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        } | 
					 | 
					 | 
					 | 
					        } | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
  |