|
|
@ -34,7 +34,7 @@ public class IEDCollectService {
|
|
|
|
BizConfig _bizConfig;
|
|
|
|
BizConfig _bizConfig;
|
|
|
|
|
|
|
|
|
|
|
|
String folder = "/record";
|
|
|
|
String folder = "/record";
|
|
|
|
String firstOneTime;
|
|
|
|
HashMap<Integer, String> eqmidTimeMap = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
|
|
public IEDCollectService(IcdConfigTypeRepository configRepository, IcdConfigTypeAttRepository attRepository,
|
|
|
|
public IEDCollectService(IcdConfigTypeRepository configRepository, IcdConfigTypeAttRepository attRepository,
|
|
|
|
IcdConfigTypeInstRepository instRepository, RptparamindexRepository rptparamindexRepository,
|
|
|
|
IcdConfigTypeInstRepository instRepository, RptparamindexRepository rptparamindexRepository,
|
|
|
@ -71,7 +71,7 @@ public class IEDCollectService {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
log.info("61850开始采集数据, ied=" + ied.getName() + ", ip=" + ied.getIp() + ", port=" + ied.getPort());
|
|
|
|
log.info("61850开始采集数据, ied=" + ied.getName() + ", ip=" + ied.getIp() + ", port=" + ied.getPort());
|
|
|
|
this.connect();
|
|
|
|
this.connect();
|
|
|
|
firstOneTime = null;
|
|
|
|
eqmidTimeMap.clear();
|
|
|
|
if (!CollectionUtils.isEmpty(rptList)) {
|
|
|
|
if (!CollectionUtils.isEmpty(rptList)) {
|
|
|
|
this.doCollectAndSave(configTypeList, rptList);
|
|
|
|
this.doCollectAndSave(configTypeList, rptList);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -120,7 +120,7 @@ public class IEDCollectService {
|
|
|
|
String time = iecClient.getValue(paramindexT, fc);
|
|
|
|
String time = iecClient.getValue(paramindexT, fc);
|
|
|
|
log.info("采集到" + fc + " " + paramindexNew + "=" + value + ", t=" + time);
|
|
|
|
log.info("采集到" + fc + " " + paramindexNew + "=" + value + ", t=" + time);
|
|
|
|
time = DateUtil.fromZoneUTCToLocal(time);
|
|
|
|
time = DateUtil.fromZoneUTCToLocal(time);
|
|
|
|
time = this.makeSameTime(time);
|
|
|
|
time = this.makeSameTime(rpt.getEqmid(), time);
|
|
|
|
_dataService.insertData(rpt.getTablename(), rpt.getEqmid(), time, rpt.getColname(), value);
|
|
|
|
_dataService.insertData(rpt.getTablename(), rpt.getEqmid(), time, rpt.getColname(), value);
|
|
|
|
|
|
|
|
|
|
|
|
// 更新最新数据缓存
|
|
|
|
// 更新最新数据缓存
|
|
|
@ -135,20 +135,13 @@ public class IEDCollectService {
|
|
|
|
StaticVariable.paramRelationMap.put(key, value);
|
|
|
|
StaticVariable.paramRelationMap.put(key, value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private String makeSameTime(String time) {
|
|
|
|
private String makeSameTime(Integer eqmid, String time) {
|
|
|
|
if (firstOneTime == null) {
|
|
|
|
String sameTime = eqmidTimeMap.get(eqmid);
|
|
|
|
firstOneTime = time;
|
|
|
|
if (StringUtils.isBlank(sameTime)) {
|
|
|
|
} else {
|
|
|
|
sameTime = time;
|
|
|
|
if (!firstOneTime.equals(time)) {
|
|
|
|
eqmidTimeMap.put(eqmid, sameTime);
|
|
|
|
long sec = DateUtil.secondDiff(firstOneTime, time);
|
|
|
|
|
|
|
|
if (sec >= 0 && sec < 3) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
return time;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return firstOneTime;
|
|
|
|
return sameTime;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private Rptparamindex findRpt(List<Rptparamindex> rptList, String paramindex) {
|
|
|
|
private Rptparamindex findRpt(List<Rptparamindex> rptList, String paramindex) {
|
|
|
|