package com.gs.xiaomi.task; import com.gs.xiaomi.service.XM104Service; import lombok.RequiredArgsConstructor; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import java.io.IOException; @Component @RequiredArgsConstructor public class ScheduledTasks { private final XM104Service xm104Service; /** * 每五分钟执行一次 * 获取设备最近的一条记录 * * @return void * @author tjx * @description TODO * @date 2024/9/27 21:48 */ @Scheduled(cron = "0 0 9,12,18 * * ?") public void getDeviceRealTimeData() throws IOException { xm104Service.getDb(); } }