|
|
|
|
@ -48,6 +48,7 @@ import java.util.stream.Stream;
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 集中监控数据获取实现类 |
|
|
|
|
* |
|
|
|
|
* @author ysj |
|
|
|
|
*/ |
|
|
|
|
@Service |
|
|
|
|
@ -108,7 +109,8 @@ public class MonitorServiceImpl implements MonitorService {
|
|
|
|
|
} |
|
|
|
|
// 设备监测点list
|
|
|
|
|
Object json = redisTemplate.opsForValue().get(device_cache_final); |
|
|
|
|
List<EminfoAndEmParamVo> eminfoAndEmParams = JSONObject.parseObject(json.toString(), new TypeReference<List<EminfoAndEmParamVo>>() {}); |
|
|
|
|
List<EminfoAndEmParamVo> eminfoAndEmParams = JSONObject.parseObject(json.toString(), new TypeReference<List<EminfoAndEmParamVo>>() { |
|
|
|
|
}); |
|
|
|
|
// 厂房监测点list
|
|
|
|
|
List<AnalyzeCodeBySignagesVO> wsMonitorList = this.getRealIdByWsCodeAndSign(); |
|
|
|
|
// 实时监控监测点list
|
|
|
|
|
@ -149,7 +151,9 @@ public class MonitorServiceImpl implements MonitorService {
|
|
|
|
|
@Override |
|
|
|
|
public void loadRealData(String param) { |
|
|
|
|
// 获取设备
|
|
|
|
|
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_final).toString(),new TypeReference<List<EminfoAndEmParamVo>>() {});; |
|
|
|
|
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_final).toString(), new TypeReference<List<EminfoAndEmParamVo>>() { |
|
|
|
|
}); |
|
|
|
|
; |
|
|
|
|
// 设备开关机集合监测点
|
|
|
|
|
List<String> switchOnOff = devices.stream().map(o -> { |
|
|
|
|
Map<String, String> points = o.getPoint(); |
|
|
|
|
@ -187,11 +191,11 @@ public class MonitorServiceImpl implements MonitorService {
|
|
|
|
|
if (CollectionUtil.isEmpty(realIds)) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
log.error("real_time_data: {},{}",stationReal.getStation(),realIds); |
|
|
|
|
List<String> objects = redisClient.getBatchRealDataByRealId(stationReal.getStation(), realIds); |
|
|
|
|
List<String> emptyIds = new ArrayList<>(); |
|
|
|
|
for (int i = 0; i < realIds.size(); i++) { |
|
|
|
|
if (ObjectUtil.isEmpty(objects.get(i))) { |
|
|
|
|
log.error(realIds.get(i) + "is null"); |
|
|
|
|
emptyIds.add(realIds.get(i)); |
|
|
|
|
} else { |
|
|
|
|
Map<String, String> attribute = (Map<String, String>) JSONObject.parse(objects.get(i)); |
|
|
|
|
attribute.put("realId", attribute.get("k")); |
|
|
|
|
@ -205,6 +209,25 @@ public class MonitorServiceImpl implements MonitorService {
|
|
|
|
|
keyMap.put(realIdArr[i], attribute); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (CollectionUtil.isNotEmpty(emptyIds)) { |
|
|
|
|
List<String> restList = redisClient.getBatchRealDataByRealId("901200000034", emptyIds); |
|
|
|
|
for (int i = 0; i < emptyIds.size(); i++) { |
|
|
|
|
if (ObjectUtil.isEmpty(restList.get(i))) { |
|
|
|
|
log.error("获取数据失败:{}", emptyIds.get(i)); |
|
|
|
|
} else { |
|
|
|
|
Map<String, String> attribute = (Map<String, String>) JSONObject.parse(restList.get(i)); |
|
|
|
|
attribute.put("realId", attribute.get("k")); |
|
|
|
|
attribute.put("value", attribute.get("v")); |
|
|
|
|
attribute.put("time", attribute.get("t")); |
|
|
|
|
attribute.remove("v"); |
|
|
|
|
attribute.remove("k"); |
|
|
|
|
attribute.remove("t"); |
|
|
|
|
this.getCheckMap(attribute, switchOnOff); |
|
|
|
|
valueMap.put(emptyIds.get(i), attribute.get("value")); |
|
|
|
|
keyMap.put(emptyIds.get(i), attribute); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
countDownLatch.countDown(); |
|
|
|
|
})); |
|
|
|
|
@ -230,6 +253,7 @@ public class MonitorServiceImpl implements MonitorService {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 监测点过期数据检查 |
|
|
|
|
* |
|
|
|
|
* @param value |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@ -251,6 +275,7 @@ public class MonitorServiceImpl implements MonitorService {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 集中监控数据处理 |
|
|
|
|
* |
|
|
|
|
* @param param |
|
|
|
|
*/ |
|
|
|
|
@Override |
|
|
|
|
@ -284,7 +309,8 @@ public class MonitorServiceImpl implements MonitorService {
|
|
|
|
|
// 所有设备分类
|
|
|
|
|
Map<String, List<String>> deviceClassifyMap = (Map<String, List<String>>) redisTemplate.opsForValue().get(device_classify_cache_final); |
|
|
|
|
// 所有设备
|
|
|
|
|
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_final).toString(),new TypeReference<List<EminfoAndEmParamVo>>() {}); |
|
|
|
|
List<EminfoAndEmParamVo> devices = JSONObject.parseObject(redisTemplate.opsForValue().get(device_cache_final).toString(), new TypeReference<List<EminfoAndEmParamVo>>() { |
|
|
|
|
}); |
|
|
|
|
// 根据站点分组
|
|
|
|
|
Map<String, List<StationAttributeEntity>> stationAttbtMap = list.stream().collect(Collectors.groupingBy(StationAttributeEntity::getStationId)); |
|
|
|
|
// 获取站点列表
|
|
|
|
|
@ -385,6 +411,7 @@ public class MonitorServiceImpl implements MonitorService {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取站点属性 |
|
|
|
|
* |
|
|
|
|
* @param stationEntityList |
|
|
|
|
* @param item |
|
|
|
|
*/ |
|
|
|
|
@ -646,6 +673,7 @@ public class MonitorServiceImpl implements MonitorService {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 设置站点状态 |
|
|
|
|
* |
|
|
|
|
* @param alarmList |
|
|
|
|
* @param station |
|
|
|
|
* @param key |
|
|
|
|
@ -705,6 +733,7 @@ public class MonitorServiceImpl implements MonitorService {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取厂房监测点 |
|
|
|
|
* |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
private List<AnalyzeCodeBySignagesVO> getRealIdByWsCodeAndSign() { |
|
|
|
|
@ -725,6 +754,7 @@ public class MonitorServiceImpl implements MonitorService {
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取站点realId |
|
|
|
|
* |
|
|
|
|
* @param refDept |
|
|
|
|
* @param eminfoAndEmParams |
|
|
|
|
* @return |
|
|
|
|
|