|
|
|
@ -48,6 +48,7 @@ import java.util.stream.Stream; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 集中监控数据获取实现类 |
|
|
|
* 集中监控数据获取实现类 |
|
|
|
|
|
|
|
* |
|
|
|
* @author ysj |
|
|
|
* @author ysj |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Service |
|
|
|
@Service |
|
|
|
@ -103,12 +104,13 @@ public class MonitorServiceImpl implements MonitorService { |
|
|
|
public void loadRealId(String param) { |
|
|
|
public void loadRealId(String param) { |
|
|
|
// 所有站点
|
|
|
|
// 所有站点
|
|
|
|
List<StationEntity> stationList = stationService.list(); |
|
|
|
List<StationEntity> stationList = stationService.list(); |
|
|
|
if(CollectionUtil.isEmpty(stationList)){ |
|
|
|
if (CollectionUtil.isEmpty(stationList)) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
// 设备监测点list
|
|
|
|
// 设备监测点list
|
|
|
|
Object json = redisTemplate.opsForValue().get(device_cache_final); |
|
|
|
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
|
|
|
|
List<AnalyzeCodeBySignagesVO> wsMonitorList = this.getRealIdByWsCodeAndSign(); |
|
|
|
List<AnalyzeCodeBySignagesVO> wsMonitorList = this.getRealIdByWsCodeAndSign(); |
|
|
|
// 实时监控监测点list
|
|
|
|
// 实时监控监测点list
|
|
|
|
@ -119,56 +121,58 @@ public class MonitorServiceImpl implements MonitorService { |
|
|
|
}}); |
|
|
|
}}); |
|
|
|
// 监测点存储list
|
|
|
|
// 监测点存储list
|
|
|
|
List<StationRealVo> list = new ArrayList<>(); |
|
|
|
List<StationRealVo> list = new ArrayList<>(); |
|
|
|
stationList.forEach(station->{ |
|
|
|
stationList.forEach(station -> { |
|
|
|
StationRealVo stationRealVo = new StationRealVo(); |
|
|
|
StationRealVo stationRealVo = new StationRealVo(); |
|
|
|
stationRealVo.setStation(station.getCode()); |
|
|
|
stationRealVo.setStation(station.getCode()); |
|
|
|
List<String> realDeviceList = this.getRealDeviceList(station.getRefDept(),eminfoAndEmParams); |
|
|
|
List<String> realDeviceList = this.getRealDeviceList(station.getRefDept(), eminfoAndEmParams); |
|
|
|
// 厂站匹配站点监测点集合
|
|
|
|
// 厂站匹配站点监测点集合
|
|
|
|
List<String> realWsList = wsMonitorList.stream().filter( |
|
|
|
List<String> realWsList = wsMonitorList.stream().filter( |
|
|
|
o -> Func.isNotEmpty(o.getStation()) && o.getStation().equals(station.getCode()) |
|
|
|
o -> Func.isNotEmpty(o.getStation()) && o.getStation().equals(station.getCode()) |
|
|
|
).map(AnalyzeCodeBySignagesVO::getRealId).collect(Collectors.toList()); |
|
|
|
).map(AnalyzeCodeBySignagesVO::getRealId).collect(Collectors.toList()); |
|
|
|
// 实时监控匹配站点监测点集合
|
|
|
|
// 实时监控匹配站点监测点集合
|
|
|
|
List<String> realTimeList = timeList.stream().filter(o -> null != o.getStationId() && o.getStationId().equals(station.getCode())).map(StationAttributeEntity::getMonitorId).collect(Collectors.toList()); |
|
|
|
List<String> realTimeList = timeList.stream().filter(o -> null != o.getStationId() && o.getStationId().equals(station.getCode())).map(StationAttributeEntity::getMonitorId).collect(Collectors.toList()); |
|
|
|
if(CollectionUtil.isNotEmpty(realTimeList)){ |
|
|
|
if (CollectionUtil.isNotEmpty(realTimeList)) { |
|
|
|
realDeviceList.addAll(realTimeList); |
|
|
|
realDeviceList.addAll(realTimeList); |
|
|
|
} |
|
|
|
} |
|
|
|
if(CollectionUtil.isNotEmpty(realWsList)) { |
|
|
|
if (CollectionUtil.isNotEmpty(realWsList)) { |
|
|
|
realDeviceList.addAll(realWsList); |
|
|
|
realDeviceList.addAll(realWsList); |
|
|
|
} |
|
|
|
} |
|
|
|
if(CollectionUtil.isEmpty(realDeviceList)){ |
|
|
|
if (CollectionUtil.isEmpty(realDeviceList)) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
List<String> realList = realDeviceList.stream().distinct().collect(Collectors.toList()); |
|
|
|
List<String> realList = realDeviceList.stream().distinct().collect(Collectors.toList()); |
|
|
|
String[] realArr = StringUtil.join(realList,",").split(","); |
|
|
|
String[] realArr = StringUtil.join(realList, ",").split(","); |
|
|
|
stationRealVo.setRealId(realArr); |
|
|
|
stationRealVo.setRealId(realArr); |
|
|
|
list.add(stationRealVo); |
|
|
|
list.add(stationRealVo); |
|
|
|
}); |
|
|
|
}); |
|
|
|
redisTemplate.opsForValue().set(moniter_realId_cache_final,list); |
|
|
|
redisTemplate.opsForValue().set(moniter_realId_cache_final, list); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void loadRealData(String param) { |
|
|
|
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->{ |
|
|
|
List<String> switchOnOff = devices.stream().map(o -> { |
|
|
|
Map<String,String> points = o.getPoint(); |
|
|
|
Map<String, String> points = o.getPoint(); |
|
|
|
if(CollectionUtil.isEmpty(points)){ |
|
|
|
if (CollectionUtil.isEmpty(points)) { |
|
|
|
return ""; |
|
|
|
return ""; |
|
|
|
} |
|
|
|
} |
|
|
|
String jointRelay = points.get(HomePageConstant.JOINT_RELAY); |
|
|
|
String jointRelay = points.get(HomePageConstant.JOINT_RELAY); |
|
|
|
if(!StringUtil.isEmpty(jointRelay)){ |
|
|
|
if (!StringUtil.isEmpty(jointRelay)) { |
|
|
|
return jointRelay; |
|
|
|
return jointRelay; |
|
|
|
} |
|
|
|
} |
|
|
|
String onOff = points.get(HomePageConstant.SWITCH_ON_OFF); |
|
|
|
String onOff = points.get(HomePageConstant.SWITCH_ON_OFF); |
|
|
|
if(!StringUtil.isEmpty(onOff)){ |
|
|
|
if (!StringUtil.isEmpty(onOff)) { |
|
|
|
return onOff; |
|
|
|
return onOff; |
|
|
|
} |
|
|
|
} |
|
|
|
return ""; |
|
|
|
return ""; |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
}).collect(Collectors.toList()); |
|
|
|
// 获取站点缓存数据
|
|
|
|
// 获取站点缓存数据
|
|
|
|
List<StationRealVo> stationRealVos = (List<StationRealVo>) redisTemplate.opsForValue().get(moniter_realId_cache_final); |
|
|
|
List<StationRealVo> stationRealVos = (List<StationRealVo>) redisTemplate.opsForValue().get(moniter_realId_cache_final); |
|
|
|
if(CollectionUtil.isEmpty(stationRealVos)){ |
|
|
|
if (CollectionUtil.isEmpty(stationRealVos)) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
// 数据切割
|
|
|
|
// 数据切割
|
|
|
|
@ -176,33 +180,52 @@ public class MonitorServiceImpl implements MonitorService { |
|
|
|
List<List<StationRealVo>> list = Stream.iterate(0, n -> n + 1).limit(limit).parallel().map(a -> stationRealVos.stream().skip((long) a * 5).limit(5).parallel().collect(Collectors.toList())).collect(Collectors.toList()); |
|
|
|
List<List<StationRealVo>> list = Stream.iterate(0, n -> n + 1).limit(limit).parallel().map(a -> stationRealVos.stream().skip((long) a * 5).limit(5).parallel().collect(Collectors.toList())).collect(Collectors.toList()); |
|
|
|
ExecutorService pool = Executors.newFixedThreadPool(limit); |
|
|
|
ExecutorService pool = Executors.newFixedThreadPool(limit); |
|
|
|
// <real,value>
|
|
|
|
// <real,value>
|
|
|
|
Map<String,String> valueMap = new ConcurrentHashMap<>(); |
|
|
|
Map<String, String> valueMap = new ConcurrentHashMap<>(); |
|
|
|
// <real,<attribute,value>>
|
|
|
|
// <real,<attribute,value>>
|
|
|
|
Map<String,Map<String,String>> keyMap = new ConcurrentHashMap<>(); |
|
|
|
Map<String, Map<String, String>> keyMap = new ConcurrentHashMap<>(); |
|
|
|
CountDownLatch countDownLatch = new CountDownLatch(limit); |
|
|
|
CountDownLatch countDownLatch = new CountDownLatch(limit); |
|
|
|
pool.execute(()-> list.forEach(stations -> { |
|
|
|
pool.execute(() -> list.forEach(stations -> { |
|
|
|
stations.forEach(stationReal -> { |
|
|
|
stations.forEach(stationReal -> { |
|
|
|
String[] realIdArr = stationReal.getRealId(); |
|
|
|
String[] realIdArr = stationReal.getRealId(); |
|
|
|
List<String> realIds = Stream.of(realIdArr).collect(Collectors.toList()); |
|
|
|
List<String> realIds = Stream.of(realIdArr).collect(Collectors.toList()); |
|
|
|
if(CollectionUtil.isEmpty(realIds)){ |
|
|
|
if (CollectionUtil.isEmpty(realIds)) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
log.error("real_time_data: {},{}",stationReal.getStation(),realIds); |
|
|
|
List<String> objects = redisClient.getBatchRealDataByRealId(stationReal.getStation(), realIds); |
|
|
|
List<String> objects = redisClient.getBatchRealDataByRealId(stationReal.getStation(),realIds); |
|
|
|
List<String> emptyIds = new ArrayList<>(); |
|
|
|
for(int i = 0; i < realIds.size() ;i++){ |
|
|
|
for (int i = 0; i < realIds.size(); i++) { |
|
|
|
if(ObjectUtil.isEmpty(objects.get(i))){ |
|
|
|
if (ObjectUtil.isEmpty(objects.get(i))) { |
|
|
|
log.error(realIds.get(i) + "is null"); |
|
|
|
emptyIds.add(realIds.get(i)); |
|
|
|
}else{ |
|
|
|
} 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")); |
|
|
|
attribute.put("time",attribute.get("t")); |
|
|
|
attribute.put("time", attribute.get("t")); |
|
|
|
attribute.remove("v"); |
|
|
|
attribute.remove("v"); |
|
|
|
attribute.remove("k"); |
|
|
|
attribute.remove("k"); |
|
|
|
attribute.remove("t"); |
|
|
|
attribute.remove("t"); |
|
|
|
this.getCheckMap(attribute,switchOnOff); |
|
|
|
this.getCheckMap(attribute, switchOnOff); |
|
|
|
valueMap.put(realIdArr[i],attribute.get("value")); |
|
|
|
valueMap.put(realIdArr[i], attribute.get("value")); |
|
|
|
keyMap.put(realIdArr[i],attribute); |
|
|
|
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); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
@ -217,8 +240,8 @@ public class MonitorServiceImpl implements MonitorService { |
|
|
|
} |
|
|
|
} |
|
|
|
pool.shutdown(); |
|
|
|
pool.shutdown(); |
|
|
|
// redis 存储
|
|
|
|
// redis 存储
|
|
|
|
redisTemplate.opsForValue().set(real_cache_final,JSONObject.toJSONString(valueMap)); |
|
|
|
redisTemplate.opsForValue().set(real_cache_final, JSONObject.toJSONString(valueMap)); |
|
|
|
redisTemplate.opsForValue().set(real_gather_cache_final,JSONObject.toJSONString(keyMap)); |
|
|
|
redisTemplate.opsForValue().set(real_gather_cache_final, JSONObject.toJSONString(keyMap)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
@ -230,27 +253,29 @@ public class MonitorServiceImpl implements MonitorService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 监测点过期数据检查 |
|
|
|
* 监测点过期数据检查 |
|
|
|
|
|
|
|
* |
|
|
|
* @param value |
|
|
|
* @param value |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void getCheckMap(Map<String, String> value,List<String> switchOnOff){ |
|
|
|
private void getCheckMap(Map<String, String> value, List<String> switchOnOff) { |
|
|
|
// 不处理开机状态监测点
|
|
|
|
// 不处理开机状态监测点
|
|
|
|
if(switchOnOff.contains(value.get("realId"))){ |
|
|
|
if (switchOnOff.contains(value.get("realId"))) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
String time = value.get("time"); |
|
|
|
String time = value.get("time"); |
|
|
|
if(StringUtil.isEmpty(time)){ |
|
|
|
if (StringUtil.isEmpty(time)) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
Date date = DateUtil.parse(time,DateUtil.PATTERN_DATETIME); |
|
|
|
Date date = DateUtil.parse(time, DateUtil.PATTERN_DATETIME); |
|
|
|
// 实时数据超出10分钟未刷新,值置为 0 显示
|
|
|
|
// 实时数据超出10分钟未刷新,值置为 0 显示
|
|
|
|
if(System.currentTimeMillis() - date.getTime() > 10 * 60 * 1000L){ |
|
|
|
if (System.currentTimeMillis() - date.getTime() > 10 * 60 * 1000L) { |
|
|
|
value.put("value","0"); |
|
|
|
value.put("value", "0"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 集中监控数据处理 |
|
|
|
* 集中监控数据处理 |
|
|
|
|
|
|
|
* |
|
|
|
* @param param |
|
|
|
* @param param |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
@ -284,12 +309,13 @@ public class MonitorServiceImpl implements MonitorService { |
|
|
|
// 所有设备分类
|
|
|
|
// 所有设备分类
|
|
|
|
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); |
|
|
|
// 所有设备
|
|
|
|
// 所有设备
|
|
|
|
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)); |
|
|
|
Map<String, List<StationAttributeEntity>> stationAttbtMap = list.stream().collect(Collectors.groupingBy(StationAttributeEntity::getStationId)); |
|
|
|
// 获取站点列表
|
|
|
|
// 获取站点列表
|
|
|
|
List<StationEntity> stationEntityList = stationService.list(Wrappers.<StationEntity>lambdaQuery() |
|
|
|
List<StationEntity> stationEntityList = stationService.list(Wrappers.<StationEntity>lambdaQuery() |
|
|
|
.in(StationEntity::getCode,new ArrayList<>(stationAttbtMap.keySet()))); |
|
|
|
.in(StationEntity::getCode, new ArrayList<>(stationAttbtMap.keySet()))); |
|
|
|
// 隐藏设备列表
|
|
|
|
// 隐藏设备列表
|
|
|
|
List<String> hideList = attrConfigService.getHideList(); |
|
|
|
List<String> hideList = attrConfigService.getHideList(); |
|
|
|
// 分割,每个map限制10个长度
|
|
|
|
// 分割,每个map限制10个长度
|
|
|
|
@ -302,17 +328,17 @@ public class MonitorServiceImpl implements MonitorService { |
|
|
|
R<List<Dept>> deptAll = sysClient.getDeptList(); |
|
|
|
R<List<Dept>> deptAll = sysClient.getDeptList(); |
|
|
|
// 存储数据节点
|
|
|
|
// 存储数据节点
|
|
|
|
List<RealStationVo> stationList = new CopyOnWriteArrayList<>(); |
|
|
|
List<RealStationVo> stationList = new CopyOnWriteArrayList<>(); |
|
|
|
pool.execute(()->{ |
|
|
|
pool.execute(() -> { |
|
|
|
// 线程处理数据
|
|
|
|
// 线程处理数据
|
|
|
|
for(Map<String, List<StationAttributeEntity>> item : handleList){ |
|
|
|
for (Map<String, List<StationAttributeEntity>> item : handleList) { |
|
|
|
item.forEach((key,value)->{ |
|
|
|
item.forEach((key, value) -> { |
|
|
|
RealStationVo station = new RealStationVo(); |
|
|
|
RealStationVo station = new RealStationVo(); |
|
|
|
// 站点编码
|
|
|
|
// 站点编码
|
|
|
|
station.setStationCode(key); |
|
|
|
station.setStationCode(key); |
|
|
|
// 设置站点状态
|
|
|
|
// 设置站点状态
|
|
|
|
this.setStationStatus(alarmList,station,key); |
|
|
|
this.setStationStatus(alarmList, station, key); |
|
|
|
// 名称、限制水位、服务类型、机构、排序
|
|
|
|
// 名称、限制水位、服务类型、机构、排序
|
|
|
|
this.stationParam(stationEntityList,station,deptAll.getData()); |
|
|
|
this.stationParam(stationEntityList, station, deptAll.getData()); |
|
|
|
// 根据设备名称分组
|
|
|
|
// 根据设备名称分组
|
|
|
|
Map<String, List<StationAttributeEntity>> deviceAttbtMap = value.stream().filter(o -> !hideList.contains(o.getEmName())).collect(Collectors.groupingBy(StationAttributeEntity::getEmName)); |
|
|
|
Map<String, List<StationAttributeEntity>> deviceAttbtMap = value.stream().filter(o -> !hideList.contains(o.getEmName())).collect(Collectors.groupingBy(StationAttributeEntity::getEmName)); |
|
|
|
List<RealDeviceVo> deviceList = new ArrayList<>(); |
|
|
|
List<RealDeviceVo> deviceList = new ArrayList<>(); |
|
|
|
@ -363,7 +389,7 @@ public class MonitorServiceImpl implements MonitorService { |
|
|
|
RealAttributeVo realAttributeVo = new RealAttributeVo(); |
|
|
|
RealAttributeVo realAttributeVo = new RealAttributeVo(); |
|
|
|
// 设备重点属性处理 : 单条-item
|
|
|
|
// 设备重点属性处理 : 单条-item
|
|
|
|
Map<String, String> real = map.get(item.getMonitorId()); |
|
|
|
Map<String, String> real = map.get(item.getMonitorId()); |
|
|
|
if(MapUtils.isEmpty(real)){ |
|
|
|
if (MapUtils.isEmpty(real)) { |
|
|
|
realAttributeVo.setName(item.getAttributes()); |
|
|
|
realAttributeVo.setName(item.getAttributes()); |
|
|
|
realAttributeVo.setType(item.getAttributeType()); |
|
|
|
realAttributeVo.setType(item.getAttributeType()); |
|
|
|
realAttributeVo.setRealId(item.getMonitorId()); |
|
|
|
realAttributeVo.setRealId(item.getMonitorId()); |
|
|
|
@ -385,19 +411,20 @@ public class MonitorServiceImpl implements MonitorService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取站点属性 |
|
|
|
* 获取站点属性 |
|
|
|
|
|
|
|
* |
|
|
|
* @param stationEntityList |
|
|
|
* @param stationEntityList |
|
|
|
* @param item |
|
|
|
* @param item |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void stationParam(List<StationEntity> stationEntityList, RealStationVo item,List<Dept> deptAll) { |
|
|
|
private void stationParam(List<StationEntity> stationEntityList, RealStationVo item, List<Dept> deptAll) { |
|
|
|
if(CollectionUtil.isEmpty(stationEntityList)){ |
|
|
|
if (CollectionUtil.isEmpty(stationEntityList)) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
List<StationEntity> filterList = stationEntityList.stream().filter(o->item.getStationCode().equals(o.getCode())).collect(Collectors.toList()); |
|
|
|
List<StationEntity> filterList = stationEntityList.stream().filter(o -> item.getStationCode().equals(o.getCode())).collect(Collectors.toList()); |
|
|
|
if(CollectionUtil.isEmpty(filterList)){ |
|
|
|
if (CollectionUtil.isEmpty(filterList)) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
StationEntity station = filterList.get(0); |
|
|
|
StationEntity station = filterList.get(0); |
|
|
|
if(ObjectUtil.isEmpty(station)){ |
|
|
|
if (ObjectUtil.isEmpty(station)) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
item.setStationName(station.getName()); |
|
|
|
item.setStationName(station.getName()); |
|
|
|
@ -405,8 +432,8 @@ public class MonitorServiceImpl implements MonitorService { |
|
|
|
item.setServerType(station.getServeType()); |
|
|
|
item.setServerType(station.getServeType()); |
|
|
|
item.setStationDeptId(station.getRefDept()); |
|
|
|
item.setStationDeptId(station.getRefDept()); |
|
|
|
// 排序
|
|
|
|
// 排序
|
|
|
|
List<Dept> list = deptAll.stream().filter(o-> station.getRefDept().equals(o.getId())).collect(Collectors.toList()); |
|
|
|
List<Dept> list = deptAll.stream().filter(o -> station.getRefDept().equals(o.getId())).collect(Collectors.toList()); |
|
|
|
if(CollectionUtil.isEmpty(list)){ |
|
|
|
if (CollectionUtil.isEmpty(list)) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
item.setSort(list.get(0).getSort()); |
|
|
|
item.setSort(list.get(0).getSort()); |
|
|
|
@ -626,7 +653,7 @@ public class MonitorServiceImpl implements MonitorService { |
|
|
|
past = System.currentTimeMillis() - handleList.get(0).getProcessTime().getTime(); |
|
|
|
past = System.currentTimeMillis() - handleList.get(0).getProcessTime().getTime(); |
|
|
|
} |
|
|
|
} |
|
|
|
boolean exist = ((CollectionUtil.isEmpty(handleList) && CollectionUtil.isEmpty(recordList)) || (past / 1000 / 60 > 30 && CollectionUtil.isEmpty(recordList))); |
|
|
|
boolean exist = ((CollectionUtil.isEmpty(handleList) && CollectionUtil.isEmpty(recordList)) || (past / 1000 / 60 > 30 && CollectionUtil.isEmpty(recordList))); |
|
|
|
if (exist){ |
|
|
|
if (exist) { |
|
|
|
Long alertId = alertService.insertAlert(item.getStationId(), item.getMonitorId()); |
|
|
|
Long alertId = alertService.insertAlert(item.getStationId(), item.getMonitorId()); |
|
|
|
attest.setId(alertId); |
|
|
|
attest.setId(alertId); |
|
|
|
attest.setStatus(ConfigStatus.ConfigStatusEnum.YELLOW.getStatus()); |
|
|
|
attest.setStatus(ConfigStatus.ConfigStatusEnum.YELLOW.getStatus()); |
|
|
|
@ -646,13 +673,14 @@ public class MonitorServiceImpl implements MonitorService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 设置站点状态 |
|
|
|
* 设置站点状态 |
|
|
|
|
|
|
|
* |
|
|
|
* @param alarmList |
|
|
|
* @param alarmList |
|
|
|
* @param station |
|
|
|
* @param station |
|
|
|
* @param key |
|
|
|
* @param key |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void setStationStatus(List<String> alarmList, RealStationVo station, String key) { |
|
|
|
private void setStationStatus(List<String> alarmList, RealStationVo station, String key) { |
|
|
|
station.setStatus(0); |
|
|
|
station.setStatus(0); |
|
|
|
if(alarmList.contains(key)){ |
|
|
|
if (alarmList.contains(key)) { |
|
|
|
station.setStatus(1); |
|
|
|
station.setStatus(1); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -705,17 +733,18 @@ public class MonitorServiceImpl implements MonitorService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取厂房监测点 |
|
|
|
* 获取厂房监测点 |
|
|
|
|
|
|
|
* |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private List<AnalyzeCodeBySignagesVO> getRealIdByWsCodeAndSign() { |
|
|
|
private List<AnalyzeCodeBySignagesVO> getRealIdByWsCodeAndSign() { |
|
|
|
List<WorkshopInfoEntity> wsInfoList = workshopInfoService.list(); |
|
|
|
List<WorkshopInfoEntity> wsInfoList = workshopInfoService.list(); |
|
|
|
if(CollectionUtil.isEmpty(wsInfoList)) { |
|
|
|
if (CollectionUtil.isEmpty(wsInfoList)) { |
|
|
|
return Lists.newArrayList(); |
|
|
|
return Lists.newArrayList(); |
|
|
|
} |
|
|
|
} |
|
|
|
Function<String, MultiAnalyzeCodePO> getAnalyzeCodePO = wsCode -> { |
|
|
|
Function<String, MultiAnalyzeCodePO> getAnalyzeCodePO = wsCode -> { |
|
|
|
MultiAnalyzeCodePO multiAnalyzeCodePO = new MultiAnalyzeCodePO(); |
|
|
|
MultiAnalyzeCodePO multiAnalyzeCodePO = new MultiAnalyzeCodePO(); |
|
|
|
multiAnalyzeCodePO.setDeviceCode(wsCode); |
|
|
|
multiAnalyzeCodePO.setDeviceCode(wsCode); |
|
|
|
multiAnalyzeCodePO.setSignages(Lists.newArrayList(HomePageConstant.PV_JOINT_RELAY,HomePageConstant.PV_REACTIVE_POWER,HomePageConstant.PV_GENERATION_CAPACITY)); |
|
|
|
multiAnalyzeCodePO.setSignages(Lists.newArrayList(HomePageConstant.PV_JOINT_RELAY, HomePageConstant.PV_REACTIVE_POWER, HomePageConstant.PV_GENERATION_CAPACITY)); |
|
|
|
return multiAnalyzeCodePO; |
|
|
|
return multiAnalyzeCodePO; |
|
|
|
}; |
|
|
|
}; |
|
|
|
List<MultiAnalyzeCodePO> analyzeCodePOList = wsInfoList.stream().map(WorkshopInfoEntity::getNumber).map(getAnalyzeCodePO).collect(Collectors.toList()); |
|
|
|
List<MultiAnalyzeCodePO> analyzeCodePOList = wsInfoList.stream().map(WorkshopInfoEntity::getNumber).map(getAnalyzeCodePO).collect(Collectors.toList()); |
|
|
|
@ -725,24 +754,25 @@ public class MonitorServiceImpl implements MonitorService { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 获取站点realId |
|
|
|
* 获取站点realId |
|
|
|
|
|
|
|
* |
|
|
|
* @param refDept |
|
|
|
* @param refDept |
|
|
|
* @param eminfoAndEmParams |
|
|
|
* @param eminfoAndEmParams |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private List<String> getRealDeviceList(Long refDept, List<EminfoAndEmParamVo> eminfoAndEmParams) { |
|
|
|
private List<String> getRealDeviceList(Long refDept, List<EminfoAndEmParamVo> eminfoAndEmParams) { |
|
|
|
// 参数检查
|
|
|
|
// 参数检查
|
|
|
|
if(CollectionUtil.isEmpty(eminfoAndEmParams) || ObjectUtil.isEmpty(refDept)){ |
|
|
|
if (CollectionUtil.isEmpty(eminfoAndEmParams) || ObjectUtil.isEmpty(refDept)) { |
|
|
|
return new ArrayList<>(); |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
} |
|
|
|
// 有效设备
|
|
|
|
// 有效设备
|
|
|
|
List<EminfoAndEmParamVo> filters = eminfoAndEmParams.stream().filter(o-> o.getCreateDept().equals(refDept)).collect(Collectors.toList()); |
|
|
|
List<EminfoAndEmParamVo> filters = eminfoAndEmParams.stream().filter(o -> o.getCreateDept().equals(refDept)).collect(Collectors.toList()); |
|
|
|
if(CollectionUtil.isEmpty(filters)){ |
|
|
|
if (CollectionUtil.isEmpty(filters)) { |
|
|
|
return new ArrayList<>(); |
|
|
|
return new ArrayList<>(); |
|
|
|
} |
|
|
|
} |
|
|
|
// 遍历设备
|
|
|
|
// 遍历设备
|
|
|
|
List<String> result = new ArrayList<>(); |
|
|
|
List<String> result = new ArrayList<>(); |
|
|
|
for(EminfoAndEmParamVo device : filters){ |
|
|
|
for (EminfoAndEmParamVo device : filters) { |
|
|
|
if(CollectionUtil.isEmpty(device.getPoint())){ |
|
|
|
if (CollectionUtil.isEmpty(device.getPoint())) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
result.addAll(device.getPoint().values()); |
|
|
|
result.addAll(device.getPoint().values()); |
|
|
|
|