package cn.iocoder.yudao.scheduled;

import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler;
import cn.iocoder.yudao.framework.tenant.core.job.TenantJob;
import cn.iocoder.yudao.module.company.service.CompanyService;
import cn.iocoder.yudao.module.company.vo.CompanyRespVO;
import cn.iocoder.yudao.module.property.service.PropertyService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * 企业资产临期定时通知
 * @author 小李
 * @date 8:42 2024/8/16
**/
@Component
@TenantJob
@Slf4j
public class NoticeCompanyPropertyExpiredJob implements JobHandler {

    @Resource
    private PropertyService propertyService;

    @Resource
    private CompanyService companyService;

    @Override
    public String execute(String param) throws Exception {
        // 获得所有企业的企业管理员
        List<CompanyRespVO> companyAndManager = companyService.getCompanyAndManager();

        // 执行定时任务
        propertyService.noticePropertyExpired(companyAndManager);
        return null;
    }
}
