瀏覽代碼

发送短信或邮件

lyhzzz 5 月之前
父節點
當前提交
6949695dc3

+ 2 - 0
src/main/java/com/fdkankan/agent/config/AgentConfig.java

@@ -16,4 +16,6 @@ public class AgentConfig {
     @Value("${agent.sms.template-code}")
     private String smsTemplateCode;
 
+    @Value("${agent.task.auth-exp-msg}")
+    private String authExpMsg;
 }

+ 8 - 1
src/main/java/com/fdkankan/agent/task/TaskService.java

@@ -1,20 +1,27 @@
 package com.fdkankan.agent.task;
 
+import cn.hutool.log.Log;
+import com.fdkankan.agent.config.AgentConfig;
 import com.fdkankan.agent.service.IAgentAuthorizeModelingService;
 import com.fdkankan.agent.service.IMailTemplateService;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Service;
 
 @Service
+@Slf4j
 public class TaskService {
 
+    @Autowired
+    AgentConfig agentConfig;
 
     @Autowired
     IAgentAuthorizeModelingService agentAuthorizeModelingService;
 
-    @Scheduled(cron = "0 0 11 * * ?")
+    @Scheduled(cron = "#{agentConfig.getAuthExpMsg()}")
     public void task(){
+        log.info("定时任务启动");
         agentAuthorizeModelingService.checkExpTime();
     }
 }