From 68993f38cca7e67478f8462c36233d12299b4fbb Mon Sep 17 00:00:00 2001
From: 赵文轩 <1652863494@qq.com>
Date: 星期二, 04 六月 2024 19:19:05 +0800
Subject: [PATCH] 定时任务类

---
 src/main/java/com/example/scheudleds/DictSync.java |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/example/scheudleds/DictSync.java b/src/main/java/com/example/scheudleds/DictSync.java
new file mode 100644
index 0000000..96f1800
--- /dev/null
+++ b/src/main/java/com/example/scheudleds/DictSync.java
@@ -0,0 +1,33 @@
+package com.example.scheudleds;
+
+import com.example.utils.DictionaryUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.EnableScheduling;
+import org.springframework.scheduling.annotation.Scheduled;
+import org.springframework.stereotype.Component;
+
+import java.io.IOException;
+
+@Slf4j
+@Component
+@EnableScheduling
+public class DictSync {
+    @Autowired
+    private DictionaryUtil dictionaryUtil;
+
+    /**
+     * 瀛楀吀鍚屾
+     */
+    @Scheduled(cron = "0 0 22 * * ? ")
+    public void execDict(){
+        try {
+            dictionaryUtil.exec1();
+        } catch (IOException e) {
+            log.error("瀹氭椂浠诲姟寮傚父");
+            e.printStackTrace();
+        }
+    }
+}

--
Gitblit v1.8.0