package com.chinaweal.aiccs.schedule;

import com.chinaweal.aiccs.aiccs.force.mapper.XrForceDeregisterSpeMapper;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * 拟强制注销定时任务
 *
 * @author iFlow
 * @since 2026/2/4
 */
@Slf4j
@Component
public class ForceDeregisterSchedule {

    @Autowired
    private XrForceDeregisterSpeMapper xrForceDeregisterSpeMapper;

    /**
     * 更新公告期满的拟强制注销企业状态
     * 将公告期至小于等于当前日期且拟强制注销结果为1（正在进行拟强制注销公告）的企业，
     * 更新拟强制注销结果为2（拟强制注销公告期满）
     *
     * @author iFlow
     */
    @Scheduled(cron = "${scheduling.cron.forceDeregisterNoticeExpired}")
    public void updateForceDeregisterNoticeExpired() {
        log.info("===========开始更新公告期满的拟强制注销企业状态===========");
        int count = xrForceDeregisterSpeMapper.updateForceDeregisterNoticeExpired();
        log.info("===========结束更新公告期满的拟强制注销企业状态，累计更新{}条===========", count);
    }

}