fix: 一轮采集用相同时间

main
huangfeng 7 months ago
parent 2320c11b8b
commit 57e1a8acbb

@ -34,6 +34,7 @@ public class IEDCollectService {
BizConfig _bizConfig;
String folder = "/record";
String sameTime;
public IEDCollectService(IcdConfigTypeRepository configRepository, IcdConfigTypeAttRepository attRepository,
IcdConfigTypeInstRepository instRepository, RptparamindexRepository rptparamindexRepository,
@ -70,6 +71,7 @@ public class IEDCollectService {
try {
log.info("61850开始采集数据, ied=" + ied.getName() + ", ip=" + ied.getIp() + ", port=" + ied.getPort());
this.connect();
sameTime = null;
if (!CollectionUtils.isEmpty(rptList)) {
this.doCollectAndSave(configTypeList, rptList);
}
@ -118,6 +120,7 @@ public class IEDCollectService {
String time = iecClient.getValue(paramindexT, fc);
log.info("采集到" + fc + " " + paramindexNew + "=" + value + ", t=" + time);
time = DateUtil.fromZoneUTCToLocal(time);
time = this.makeSameTime(time);
_dataService.insertData(rpt.getTablename(), rpt.getEqmid(), time, rpt.getColname(), value);
// 更新最新数据缓存
@ -132,6 +135,17 @@ public class IEDCollectService {
StaticVariable.paramRelationMap.put(key, value);
}
private String makeSameTime(String time) {
if (sameTime == null) {
sameTime = time;
} else {
if (!sameTime.equals(time)) {
}
}
return sameTime;
}
private Rptparamindex findRpt(List<Rptparamindex> rptList, String paramindex) {
for (Rptparamindex rpt : rptList) {
if (rpt.getParamindex().equals(paramindex)) {

Loading…
Cancel
Save