Parcourir la source

'定时任务定时将设备状态数据处理并同步到dmp_data_overview数据概览表'

james il y a 1 an
Parent
commit
f686f8aa97

+ 25 - 0
service-iot/service-iot-biz/src/main/java/com/usky/iot/controller/web/TaskController.java

@@ -0,0 +1,25 @@
+package com.usky.iot.controller.web;
+
+import com.usky.iot.service.job.DmpDataOverviewJob;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+/**
+ * @author zyj
+ * @since 2023-06-05
+ */
+@EnableScheduling
+@Component
+public class TaskController {
+    @Autowired
+    private DmpDataOverviewJob dmpDataOverviewJob;
+
+    @Scheduled(cron = "0 0 1 * * ? ") //每天凌晨1点执行
+    public void task() {
+        System.out.println(Thread.currentThread().getName() + "定时任务执行中");
+        dmpDataOverviewJob.execute();
+    }
+
+}