|
@@ -7,7 +7,7 @@ import com.example.opc_common.util.Blank;
|
|
|
import com.example.opc_common.util.ConstantStr;
|
|
|
import com.example.opc_da.config.SpringContextUtils;
|
|
|
import com.example.opc_da.dao.DictDao;
|
|
|
-import com.example.opc_da.task.OpcAsyncTask;
|
|
|
+import com.example.opc_da.task.AsyncTask;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
@@ -30,7 +30,7 @@ public class DatasouceAlarmTask {
|
|
|
ScheduledExecutorService threadPool = Executors.newScheduledThreadPool(5);
|
|
|
ScheduledFuture<?> future = null;
|
|
|
QueryService queryService = SpringContextUtils.getBean(QueryService.class);
|
|
|
- OpcAsyncTask opcAsyncTask = SpringContextUtils.getBean(OpcAsyncTask.class);
|
|
|
+ AsyncTask asyncTask = SpringContextUtils.getBean(AsyncTask.class);
|
|
|
DictDao dictDao = SpringContextUtils.getBean(DictDao.class);
|
|
|
|
|
|
public Map<Integer, AlarmConfig> getDatasouceAlarmTaskMap() {
|
|
@@ -75,11 +75,11 @@ public class DatasouceAlarmTask {
|
|
|
// log.info("定时器的run方法被执行了,数据项有{}个", items.size());
|
|
|
//获取数据项最新的数据
|
|
|
List<com.cqcy.ei.influxdb.entity.Item> itemDataByLast = queryService.getItemDataByLast(items, dataSourceName);
|
|
|
- itemDataByLast.forEach(i->{
|
|
|
+ itemDataByLast.forEach(i -> {
|
|
|
// log.info("名称:{},时间{},值{}",i.getName(),i.getTime(),i.getValue());
|
|
|
});
|
|
|
if (Blank.isNotEmpty(alarmConfigList) && Blank.isNotEmpty(itemDataByLast)) {
|
|
|
- opcAsyncTask.generateAlarms(alarmConfigList, itemDataByLast);
|
|
|
+ asyncTask.generateAlarms(alarmConfigList, itemDataByLast);
|
|
|
}
|
|
|
}
|
|
|
}, 1, period, TimeUnit.SECONDS);
|
|
@@ -97,7 +97,7 @@ public class DatasouceAlarmTask {
|
|
|
this.threadPool.shutdown();
|
|
|
this.future.cancel(true);
|
|
|
this.queryService = null;
|
|
|
- this.opcAsyncTask = null;
|
|
|
+ this.asyncTask = null;
|
|
|
}
|
|
|
|
|
|
|