diff --git a/ruoyi-admin/src/main/java/com/ruoyi/pt/quartz/PushQuartz.java b/ruoyi-admin/src/main/java/com/ruoyi/pt/quartz/PushQuartz.java index 50ba6b2..8e77280 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/pt/quartz/PushQuartz.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/pt/quartz/PushQuartz.java @@ -1,9 +1,11 @@ package com.ruoyi.pt.quartz; import com.ruoyi.pt.service.RemoteCallsService; -import org.springframework.scheduling.annotation.EnableAsync; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.time.LocalDate; @@ -15,15 +17,17 @@ import java.time.format.DateTimeFormatter; * @author wu * @since 2023/12/26 16:19 */ -@Component -@EnableAsync +@Configuration +@EnableScheduling public class PushQuartz { + public static final Logger log = LoggerFactory.getLogger(PushQuartz.class); @Resource private RemoteCallsService remoteCallsService; - @Scheduled(cron = "0 0 1 * * * ?") + @Scheduled(cron = "0 0 1 * * ? ") public void pushData() { + log.info("==============开始定时任务============"); // 获取社会治理中心增量事件保存到events_import表 remoteCallsService.getEventDate(); // 获取昨天的数据 diff --git a/ruoyi-admin/src/main/java/com/ruoyi/pt/service/impl/RemoteCallsServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/pt/service/impl/RemoteCallsServiceImpl.java index 01fbbd8..af67c67 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/pt/service/impl/RemoteCallsServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/pt/service/impl/RemoteCallsServiceImpl.java @@ -122,13 +122,14 @@ public class RemoteCallsServiceImpl implements RemoteCallsService { x.setEventTime(eventTime); }); String jsonStr = JSONUtil.toJsonStr(dtos); - String body = HttpRequest.post(url + "/gateway/event/event/eventData/imports").header("Authorization", "Bearer " + accessToken).body(jsonStr).execute().body(); + HttpRequest.post(url + "/gateway/event/event/eventData/imports").header("Authorization", "Bearer " + accessToken).body(jsonStr).execute().body(); // 判断是否还有下一页 if (dataPage.getPages() > dataPage.getCurrent()) { // 设置下一页的页码 page.setCurrent(page.getCurrent() + 1); } else { - break; // 已经获取完所有数据,结束循环 + log.info("==========推送完成========="); + return; // 已经获取完所有数据,结束循环 } } @@ -140,6 +141,7 @@ public class RemoteCallsServiceImpl implements RemoteCallsService { @Override public void getEventDate() { Long id = casesImportService.findIdDesc(); + log.info("最新id是=============:"+id); if (id == null) { id = 0L; }