smart-switch-java/smart-switch-service/src/main/java/com/ruoyi/task/device/DeviceStatusTask.java

49 lines
1.4 KiB
Java
Raw Normal View History

2024-05-20 16:04:35 +08:00
package com.ruoyi.task.device;
2024-05-22 15:50:24 +08:00
import com.ruoyi.common.utils.collection.CollectionUtils;
import com.ruoyi.ss.device.domain.DeviceQuery;
2024-05-20 16:04:35 +08:00
import com.ruoyi.ss.device.domain.enums.DeviceStatus;
import com.ruoyi.ss.device.domain.vo.DeviceVO;
2024-07-15 15:26:48 +08:00
import com.ruoyi.ss.device.service.DeviceService;
2024-05-20 16:04:35 +08:00
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
2024-07-15 15:26:48 +08:00
private DeviceService deviceService;
2024-05-20 16:04:35 +08:00
/**
* 项目启动时查询所有正在使用的设备并更新设备状态
* @param args
* @throws Exception
*/
@Override
public void run(ApplicationArguments args) throws Exception {
2024-09-21 17:38:46 +08:00
// log.info("项目启动,查询正在使用中的设备");
// DeviceQuery query = new DeviceQuery();
// query.setStatus(DeviceStatus.USING.getStatus());
// List<DeviceVO> list = deviceService.selectSmDeviceList(query);
// if (CollectionUtils.isEmptyElement(list)) {
// log.info("没有正在使用中的设备");
// return;
// }
//
// for (DeviceVO device : list) {
// deviceService.freshStatus(device);
// }
2024-05-20 16:04:35 +08:00
}
}