Ver Fonte

排班的定时任务

xiaochan há 5 meses atrás
pai
commit
8115cda1f3

+ 1 - 1
pom.xml

@@ -23,7 +23,7 @@
         <thyy-haikang>0.0.5</thyy-haikang>
         <thyy-emr-query>1.5.1</thyy-emr-query>
         <thyy-thirdpart-api>0.0.4</thyy-thirdpart-api>
-        <thyy-scheduled>0.1.1</thyy-scheduled>
+        <thyy-scheduled>0.1.2</thyy-scheduled>
         <thyy-plugins>0.0.1</thyy-plugins>
         <thyy-medinsur>0.0.1</thyy-medinsur>
         <!--   plugins     -->

+ 21 - 5
thyy-scheduled/src/main/java/org/thyy/scheduled/task/ClockinDataTask.java

@@ -1,23 +1,39 @@
 package org.thyy.scheduled.task;
 
+import cn.hutool.core.util.StrUtil;
+import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
+import org.springframework.web.client.RestTemplate;
+import org.thyy.scheduled.config.constant.Thyy;
 import org.thyy.scheduled.service.FetchClockinData;
 
 @Slf4j
 @Component
+@RequiredArgsConstructor
 public class ClockinDataTask {
     private final FetchClockinData fetchClockinData;
+    private final Thyy thyy;
+    private final RestTemplate template;
 
-    @Autowired
-    public ClockinDataTask(FetchClockinData fetchClockinData) {
-        this.fetchClockinData = fetchClockinData;
-    }
 
     @Scheduled(cron = "0 0 8 ? * *")
     public void fetchClockinData() {
         fetchClockinData.start();
     }
+
+    @Scheduled(cron = "0 0 1 20 * ?")
+    public void taskCreateClass() {
+        if (StrUtil.isBlank(thyy.getMainAddress())) return;
+        String url = thyy.getMainAddress() + "/schedulingClass/taskSendMsg";
+        template.getForObject(url, String.class);
+    }
+
+    @Scheduled(cron = "0 20 17 * * ?")
+    public void taskSendMsg() {
+        if (StrUtil.isBlank(thyy.getMainAddress())) return;
+        String url = thyy.getMainAddress() + "/schedulingClass/taskSendMsg";
+        template.getForObject(url, String.class);
+    }
 }