|
|
|
@ -15,7 +15,6 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
|
|
|
|
|
|
|
|
import java.net.SocketException;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
@ -33,6 +32,7 @@ public class IEDCollectService {
|
|
|
|
|
String xml;
|
|
|
|
|
WebSocketServer _webSocketServer;
|
|
|
|
|
BizConfig _bizConfig;
|
|
|
|
|
WarningRepository _warningRepository;
|
|
|
|
|
|
|
|
|
|
String folder = "/record";
|
|
|
|
|
HashMap<Integer, String> eqmidTimeMap = new HashMap<>();
|
|
|
|
@ -41,7 +41,8 @@ public class IEDCollectService {
|
|
|
|
|
IcdConfigTypeInstRepository instRepository, RptparamindexRepository rptparamindexRepository,
|
|
|
|
|
IedDlRecordService dlRecordService, DataService dataService,
|
|
|
|
|
String xml, IcdIed ied,
|
|
|
|
|
WebSocketServer webSocketServer, BizConfig bizConfig) {
|
|
|
|
|
WebSocketServer webSocketServer, BizConfig bizConfig,
|
|
|
|
|
WarningRepository warningRepository) {
|
|
|
|
|
_configRepository = configRepository;
|
|
|
|
|
_attRepository = attRepository;
|
|
|
|
|
_instRepository = instRepository;
|
|
|
|
@ -52,6 +53,7 @@ public class IEDCollectService {
|
|
|
|
|
this.ied = ied;
|
|
|
|
|
_webSocketServer = webSocketServer;
|
|
|
|
|
_bizConfig = bizConfig;
|
|
|
|
|
_warningRepository = warningRepository;
|
|
|
|
|
iecClient = new IecClient();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -82,22 +84,33 @@ public class IEDCollectService {
|
|
|
|
|
this.doDownload(dlList);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
String err = "61850采集数据异常, ied=" + ied.getName() + ", ip=" + ied.getIp() + ", port=" + ied.getPort();
|
|
|
|
|
String err = "61850采集数据异常, ied=" + ied.getName() + ", ip=" + ied.getIp() + ", port=" + ied.getPort()
|
|
|
|
|
+ ", " + ex.getMessage();
|
|
|
|
|
log.error(err, ex);
|
|
|
|
|
this.saveWarning(err);
|
|
|
|
|
String key = ied.getName() + ied.getIp() + ied.getPort();
|
|
|
|
|
if (!StaticVariable.doneWarnMap.containsKey(key)) {
|
|
|
|
|
StaticVariable.doneWarnMap.put(key, "1");
|
|
|
|
|
_webSocketServer.sendMessage(err, null);
|
|
|
|
|
}
|
|
|
|
|
if (ex instanceof SocketException) {
|
|
|
|
|
NetErrorThread thread = new NetErrorThread(ied.getId());
|
|
|
|
|
thread.start();
|
|
|
|
|
}
|
|
|
|
|
} finally {
|
|
|
|
|
iecClient.disconnect();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void saveWarning(String err) {
|
|
|
|
|
Warning warning = Warning.builder()
|
|
|
|
|
.zsbName("61850采集数据")
|
|
|
|
|
.dTime(new Date())
|
|
|
|
|
.warnLevel(2)
|
|
|
|
|
.state("1")
|
|
|
|
|
.warnDesc(err)
|
|
|
|
|
.warnTime(new Date())
|
|
|
|
|
.processTime(new Date())
|
|
|
|
|
.build();
|
|
|
|
|
_warningRepository.save(warning);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void doCollectAndSave(List<IcdConfigType> configTypeList, List<Rptparamindex> rptList) throws Exception {
|
|
|
|
|
for (IcdConfigType configType : configTypeList) {
|
|
|
|
|
List<IcdConfigTypeInst> instList = _instRepository.findByIcdConfigTypeId(configType.getId());
|
|
|
|
|