|
|
|
@ -81,6 +81,17 @@ public class RealTimeDataService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void stopCollect(Integer iedId) {
|
|
|
|
|
this.onlyStop(iedId);
|
|
|
|
|
Optional<IcdIed> optional = iedRepository.findById(iedId);
|
|
|
|
|
if (optional.isPresent()) {
|
|
|
|
|
IcdIed ied = optional.get();
|
|
|
|
|
ied.setStart(Constants.FALSE);
|
|
|
|
|
iedRepository.save(ied);
|
|
|
|
|
log.info("61850停止订阅, ied=" + ied.getName() + ", ip=" + ied.getIp() + ", port=" + ied.getPort());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void onlyStop(Integer iedId) {
|
|
|
|
|
IecClient iecClient = clientMap.get(iedId);
|
|
|
|
|
if (iecClient != null) {
|
|
|
|
|
iecClient.keep = false;
|
|
|
|
@ -90,13 +101,6 @@ public class RealTimeDataService {
|
|
|
|
|
iecClient.disconnect();
|
|
|
|
|
clientMap.remove(iedId);
|
|
|
|
|
}
|
|
|
|
|
Optional<IcdIed> optional = iedRepository.findById(iedId);
|
|
|
|
|
if (optional.isPresent()) {
|
|
|
|
|
IcdIed ied = optional.get();
|
|
|
|
|
ied.setStart(Constants.FALSE);
|
|
|
|
|
iedRepository.save(ied);
|
|
|
|
|
log.info("61850停止订阅, ied=" + ied.getName() + ", ip=" + ied.getIp() + ", port=" + ied.getPort());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PreDestroy
|
|
|
|
@ -104,11 +108,8 @@ public class RealTimeDataService {
|
|
|
|
|
log.info("关闭61850订阅服务.");
|
|
|
|
|
Iterator<Integer> it = clientMap.keySet().iterator();
|
|
|
|
|
while (it.hasNext()) {
|
|
|
|
|
Integer key = it.next();
|
|
|
|
|
IecClient iecClient = clientMap.get(key);
|
|
|
|
|
iecClient.disableReporting();
|
|
|
|
|
iecClient.disconnect();
|
|
|
|
|
clientMap.remove(key);
|
|
|
|
|
Integer iedId = it.next();
|
|
|
|
|
this.onlyStop(iedId);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|