|
|
@ -1,8 +1,10 @@
|
|
|
|
package com.xydl.cac.service.impl;
|
|
|
|
package com.xydl.cac.service.impl;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import com.beanit.iec61850bean.*;
|
|
|
|
import com.xydl.cac.entity.IcdFile;
|
|
|
|
import com.xydl.cac.entity.IcdFile;
|
|
|
|
import com.xydl.cac.entity.IcdIed;
|
|
|
|
import com.xydl.cac.entity.IcdIed;
|
|
|
|
import com.xydl.cac.iec.IecClient;
|
|
|
|
import com.xydl.cac.iec.IecClient;
|
|
|
|
|
|
|
|
import com.xydl.cac.iec.IecServer;
|
|
|
|
import com.xydl.cac.repository.*;
|
|
|
|
import com.xydl.cac.repository.*;
|
|
|
|
import com.xydl.cac.service.RealTimeService;
|
|
|
|
import com.xydl.cac.service.RealTimeService;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
@ -25,6 +27,8 @@ public class RealTimeServiceImpl implements RealTimeService {
|
|
|
|
@Resource
|
|
|
|
@Resource
|
|
|
|
IcdIedRepository iedRepository;
|
|
|
|
IcdIedRepository iedRepository;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static HashMap<String, String> dataMap = new HashMap<>();
|
|
|
|
|
|
|
|
public static IecServer iecServer = null;
|
|
|
|
HashMap<String, IecClient> clientMap = new HashMap<>();
|
|
|
|
HashMap<String, IecClient> clientMap = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
@ -57,8 +61,50 @@ public class RealTimeServiceImpl implements RealTimeService {
|
|
|
|
while (it.hasNext()) {
|
|
|
|
while (it.hasNext()) {
|
|
|
|
String key = it.next();
|
|
|
|
String key = it.next();
|
|
|
|
IecClient iecClient = clientMap.get(key);
|
|
|
|
IecClient iecClient = clientMap.get(key);
|
|
|
|
|
|
|
|
iecClient.disableReporting();
|
|
|
|
iecClient.disconnect();
|
|
|
|
iecClient.disconnect();
|
|
|
|
clientMap.remove(key);
|
|
|
|
clientMap.remove(key);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static void processReport(Report report) {
|
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(report.getValues())) {
|
|
|
|
|
|
|
|
for (FcModelNode node : report.getValues()) {
|
|
|
|
|
|
|
|
processNodeValue(node);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void processNodeValue(FcModelNode node) {
|
|
|
|
|
|
|
|
if (node instanceof FcDataObject) {
|
|
|
|
|
|
|
|
FcDataObject fcnode = (FcDataObject) node;
|
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(fcnode.getChildren())) {
|
|
|
|
|
|
|
|
for (ModelNode child : fcnode.getChildren()) {
|
|
|
|
|
|
|
|
if (child instanceof BasicDataAttribute) {
|
|
|
|
|
|
|
|
BasicDataAttribute bda = (BasicDataAttribute) child;
|
|
|
|
|
|
|
|
processBdaNodeValue(bda);
|
|
|
|
|
|
|
|
} else if (child instanceof ConstructedDataAttribute) {
|
|
|
|
|
|
|
|
ConstructedDataAttribute cda = (ConstructedDataAttribute) child;
|
|
|
|
|
|
|
|
if (!CollectionUtils.isEmpty(cda.getChildren())) {
|
|
|
|
|
|
|
|
for (ModelNode cchild : cda.getChildren()) {
|
|
|
|
|
|
|
|
if (cchild instanceof BasicDataAttribute) {
|
|
|
|
|
|
|
|
BasicDataAttribute bda = (BasicDataAttribute) cchild;
|
|
|
|
|
|
|
|
processBdaNodeValue(bda);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void processBdaNodeValue(BasicDataAttribute bda) {
|
|
|
|
|
|
|
|
String ref = bda.getReference().toString();
|
|
|
|
|
|
|
|
String value = bda.getValueString();
|
|
|
|
|
|
|
|
dataMap.put(ref, value);
|
|
|
|
|
|
|
|
if (iecServer != null) {
|
|
|
|
|
|
|
|
iecServer.updateBda(bda);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|