|
@@ -1,6 +1,8 @@
|
|
|
package com.shkpr.service.bespokegateway.zhscada.manager;
|
|
package com.shkpr.service.bespokegateway.zhscada.manager;
|
|
|
|
|
|
|
|
|
|
+import com.shkpr.service.bespokegateway.core.properties.SchedulingProperties;
|
|
|
import com.shkpr.service.bespokegateway.zhscada.components.InfoSynchronizer;
|
|
import com.shkpr.service.bespokegateway.zhscada.components.InfoSynchronizer;
|
|
|
|
|
+import com.shkpr.service.bespokegateway.zhscada.constants.ScadaPlatformMetadata;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
@@ -16,11 +18,14 @@ import javax.annotation.PostConstruct;
|
|
|
@Component
|
|
@Component
|
|
|
public class InfoSyncManager {
|
|
public class InfoSyncManager {
|
|
|
final
|
|
final
|
|
|
|
|
+ SchedulingProperties schedulingProperties;
|
|
|
|
|
+ final
|
|
|
ThreadPoolTaskExecutor taskScheduler;
|
|
ThreadPoolTaskExecutor taskScheduler;
|
|
|
final
|
|
final
|
|
|
InfoSynchronizer infoSynchronizer;
|
|
InfoSynchronizer infoSynchronizer;
|
|
|
|
|
|
|
|
- public InfoSyncManager(ThreadPoolTaskExecutor taskScheduler, InfoSynchronizer infoSynchronizer) {
|
|
|
|
|
|
|
+ public InfoSyncManager(SchedulingProperties schedulingProperties, ThreadPoolTaskExecutor taskScheduler, InfoSynchronizer infoSynchronizer) {
|
|
|
|
|
+ this.schedulingProperties = schedulingProperties;
|
|
|
this.taskScheduler = taskScheduler;
|
|
this.taskScheduler = taskScheduler;
|
|
|
this.infoSynchronizer = infoSynchronizer;
|
|
this.infoSynchronizer = infoSynchronizer;
|
|
|
}
|
|
}
|
|
@@ -31,7 +36,8 @@ public class InfoSyncManager {
|
|
|
@PostConstruct
|
|
@PostConstruct
|
|
|
public void init() {
|
|
public void init() {
|
|
|
//同步备标签信息
|
|
//同步备标签信息
|
|
|
- taskScheduler.execute(infoSynchronizer::syncDeviceTags);
|
|
|
|
|
|
|
+ if (schedulingProperties.isTaskActive(ScadaPlatformMetadata.SchedulingKeys.SYNC_DEVICE_TAGS))
|
|
|
|
|
+ taskScheduler.execute(infoSynchronizer::syncDeviceTags);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -40,6 +46,7 @@ public class InfoSyncManager {
|
|
|
@Scheduled(cron = "0 */10 * * * *")
|
|
@Scheduled(cron = "0 */10 * * * *")
|
|
|
public void minuteTask() {
|
|
public void minuteTask() {
|
|
|
//同步设备标签信息
|
|
//同步设备标签信息
|
|
|
- taskScheduler.execute(infoSynchronizer::syncDeviceTags);
|
|
|
|
|
|
|
+ if (schedulingProperties.isTaskActive(ScadaPlatformMetadata.SchedulingKeys.SYNC_DEVICE_TAGS))
|
|
|
|
|
+ taskScheduler.execute(infoSynchronizer::syncDeviceTags);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|