|
|
|
@ -6,6 +6,7 @@ import com.xydl.cac.repository.IcdConfigTypeInstRepository;
|
|
|
|
|
import com.xydl.cac.repository.IcdConfigTypeRepository;
|
|
|
|
|
import com.xydl.cac.repository.RptparamindexRepository;
|
|
|
|
|
import com.xydl.cac.service.DataService;
|
|
|
|
|
import com.xydl.cac.socket.WebSocketServer;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
|
|
|
@ -22,12 +23,14 @@ public class IEDCollectService {
|
|
|
|
|
IecClient iecClient;
|
|
|
|
|
IcdIed ied;
|
|
|
|
|
String xml;
|
|
|
|
|
WebSocketServer _webSocketServer;
|
|
|
|
|
|
|
|
|
|
public static HashMap<Integer, HashMap<String, String>> lastDataMap = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
public IEDCollectService(IcdConfigTypeRepository configRepository, IcdConfigTypeAttRepository attRepository,
|
|
|
|
|
IcdConfigTypeInstRepository instRepository, RptparamindexRepository rptparamindexRepository,
|
|
|
|
|
DataService dataService, String xml, IcdIed ied) {
|
|
|
|
|
DataService dataService, String xml, IcdIed ied,
|
|
|
|
|
WebSocketServer webSocketServer) {
|
|
|
|
|
_configRepository = configRepository;
|
|
|
|
|
_attRepository = attRepository;
|
|
|
|
|
_instRepository = instRepository;
|
|
|
|
@ -35,6 +38,7 @@ public class IEDCollectService {
|
|
|
|
|
_dataService = dataService;
|
|
|
|
|
this.xml = xml;
|
|
|
|
|
this.ied = ied;
|
|
|
|
|
_webSocketServer = webSocketServer;
|
|
|
|
|
iecClient = new IecClient();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -58,7 +62,9 @@ public class IEDCollectService {
|
|
|
|
|
this.doCollectAndSave(configTypeList, rptList);
|
|
|
|
|
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
log.error("61850采集数据异常, ied=" + ied.getName() + ", ip=" + ied.getIp(), ex);
|
|
|
|
|
String err = "61850采集数据异常, ied=" + ied.getName() + ", ip=" + ied.getIp();
|
|
|
|
|
log.error(err, ex);
|
|
|
|
|
_webSocketServer.sendMessage(err, null);
|
|
|
|
|
} finally {
|
|
|
|
|
iecClient.disconnect();
|
|
|
|
|
}
|
|
|
|
|