|
|
@@ -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);
|
|
|
+ }
|
|
|
}
|