package cn.iocoder.yudao.module.system.job;

import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
import cn.iocoder.yudao.module.system.service.deviceinfo.DeviceInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * @author zt
 * @description <description class purpose>
 * @since 2024/7/17
 */
@Slf4j
@Component
public class DevuceAliveJob implements JobHandler {


    @Resource
    private DeviceInfoService deviceInfoService;


    @Override
    @TenantIgnore
    @Transactional(rollbackFor = Exception.class)
    public String execute(String param) {
        int size = deviceInfoService.updateAlive();
        log.info("[execute][设备在线检测任务下线数量 ({}) 个]", size);
        return String.format("设备在线检测任务下线数量 %s 个", size);
    }
}
