zhangfeng
2022-12-23 5bd5f3bcd6d2cb375feb0756505691b551339716
equipment/equipment-service/src/main/java/com/gkhy/safePlatform/equipment/schedule/KeepAliveRobot.java
对比新文件
@@ -0,0 +1,28 @@
package com.gkhy.safePlatform.equipment.schedule;
import com.gkhy.safePlatform.equipment.service.EquipmentInfoService;
import com.gkhy.safePlatform.equipment.service.baseService.EquipmentInfoBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Component("equipmentKeepAlive")
@EnableScheduling
@ConditionalOnProperty(prefix = "threadPool.scheduling", name = "enabled", havingValue = "true")
public class KeepAliveRobot {
    @Autowired
    private EquipmentInfoBaseService equipmentInfoBaseService;
    // 30m
    @Scheduled(cron = "0 0/30 * * * ?")
    public void keepAlive(){
        //
        equipmentInfoBaseService.getById(1L);
    }
}