|
|
|
@ -5,6 +5,7 @@ import com.beanit.iec61850bean.FileInformation;
|
|
|
|
|
import com.xydl.cac.config.BizConfig;
|
|
|
|
|
import com.xydl.cac.entity.*;
|
|
|
|
|
import com.xydl.cac.entity.constants.Constants;
|
|
|
|
|
import com.xydl.cac.model.StaticVariable;
|
|
|
|
|
import com.xydl.cac.repository.*;
|
|
|
|
|
import com.xydl.cac.service.DataService;
|
|
|
|
|
import com.xydl.cac.service.IedDlRecordService;
|
|
|
|
@ -33,9 +34,6 @@ public class IEDCollectService {
|
|
|
|
|
|
|
|
|
|
String folder = "/record";
|
|
|
|
|
|
|
|
|
|
public static HashMap<Integer, HashMap<String, String>> lastDataMap = new HashMap<>();
|
|
|
|
|
public static HashMap<String, String> relationMap = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
public IEDCollectService(IcdConfigTypeRepository configRepository, IcdConfigTypeAttRepository attRepository,
|
|
|
|
|
IcdConfigTypeInstRepository instRepository, RptparamindexRepository rptparamindexRepository,
|
|
|
|
|
IedDlRecordService dlRecordService, DataService dataService,
|
|
|
|
@ -69,7 +67,7 @@ public class IEDCollectService {
|
|
|
|
|
}
|
|
|
|
|
// 开始连iec61850采集数据
|
|
|
|
|
try {
|
|
|
|
|
log.info("61850开始采集数据, ied=" + ied.getName() + ", ip=" + ied.getIp());
|
|
|
|
|
log.info("61850开始采集数据, ied=" + ied.getName() + ", ip=" + ied.getIp() + ", port=" + ied.getPort());
|
|
|
|
|
this.connect();
|
|
|
|
|
if (!CollectionUtils.isEmpty(rptList)) {
|
|
|
|
|
this.doCollectAndSave(configTypeList, rptList);
|
|
|
|
@ -79,7 +77,7 @@ public class IEDCollectService {
|
|
|
|
|
this.doDownload(dlList);
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception ex) {
|
|
|
|
|
String err = "61850采集数据异常, ied=" + ied.getName() + ", ip=" + ied.getIp();
|
|
|
|
|
String err = "61850采集数据异常, ied=" + ied.getName() + ", ip=" + ied.getIp() + ", port=" + ied.getPort();
|
|
|
|
|
log.error(err, ex);
|
|
|
|
|
_webSocketServer.sendMessage(err, null);
|
|
|
|
|
} finally {
|
|
|
|
@ -122,10 +120,10 @@ public class IEDCollectService {
|
|
|
|
|
// 更新关联关系缓存
|
|
|
|
|
String key = paramindexNew + "_" + fc;
|
|
|
|
|
value = rpt.getEqmid() + "," + rpt.getColname();
|
|
|
|
|
relationMap.put(key, value);
|
|
|
|
|
StaticVariable.paramRelationMap.put(key, value);
|
|
|
|
|
key = paramindexT + "_" + fc;
|
|
|
|
|
value = rpt.getEqmid() + ",acquisitionTime";
|
|
|
|
|
relationMap.put(key, value);
|
|
|
|
|
StaticVariable.paramRelationMap.put(key, value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private Rptparamindex findRpt(List<Rptparamindex> rptList, String paramindex) {
|
|
|
|
@ -183,10 +181,10 @@ public class IEDCollectService {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void updateLastData(Integer eqmid, String colname, String value, String time) {
|
|
|
|
|
HashMap<String, String> map = lastDataMap.get(eqmid);
|
|
|
|
|
HashMap<String, String> map = StaticVariable.sensorLastDataMap.get(eqmid);
|
|
|
|
|
if (map == null) {
|
|
|
|
|
map = new HashMap<>();
|
|
|
|
|
lastDataMap.put(eqmid, map);
|
|
|
|
|
StaticVariable.sensorLastDataMap.put(eqmid, map);
|
|
|
|
|
}
|
|
|
|
|
map.put(colname, value);
|
|
|
|
|
if (time != null) {
|
|
|
|
@ -198,8 +196,8 @@ public class IEDCollectService {
|
|
|
|
|
try {
|
|
|
|
|
String ref = bda.getReference().toString();
|
|
|
|
|
String key = ref + "_" + bda.getFc().toString();
|
|
|
|
|
if (IEDCollectService.relationMap.containsKey(key)) {
|
|
|
|
|
String value = IEDCollectService.relationMap.get(key);
|
|
|
|
|
if (StaticVariable.paramRelationMap.containsKey(key)) {
|
|
|
|
|
String value = StaticVariable.paramRelationMap.get(key);
|
|
|
|
|
String[] str = value.split(",");
|
|
|
|
|
Integer eqmid = Integer.parseInt(str[0]);
|
|
|
|
|
String colname = str[1];
|
|
|
|
|