package com.ruoyi.task.device; import com.ruoyi.common.utils.collection.CollectionUtils; import com.ruoyi.ss.device.domain.DeviceQuery; import com.ruoyi.ss.device.domain.enums.DeviceStatus; import com.ruoyi.ss.device.domain.vo.DeviceVO; import com.ruoyi.ss.device.service.DeviceService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.ApplicationArguments; import org.springframework.boot.ApplicationRunner; import org.springframework.stereotype.Component; import java.util.List; /** * @author wjh * 2024/5/20 */ @Component @Slf4j public class DeviceStatusTask implements ApplicationRunner { @Autowired private DeviceService deviceService; /** * 项目启动时,查询所有正在使用的设备,并更新设备状态 * @param args * @throws Exception */ @Override public void run(ApplicationArguments args) throws Exception { // log.info("项目启动,查询正在使用中的设备"); // DeviceQuery query = new DeviceQuery(); // query.setStatus(DeviceStatus.USING.getStatus()); // List list = deviceService.selectSmDeviceList(query); // if (CollectionUtils.isEmptyElement(list)) { // log.info("没有正在使用中的设备"); // return; // } // // for (DeviceVO device : list) { // deviceService.freshStatus(device); // } } }