package com.yinlihupo.enlish.service.task;

import com.yinlihupo.enlish.service.service.ExamWordsJudgeService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class AutoJudgeExamWordsTask {

    @Resource
    private ExamWordsJudgeService examWordsJudgeService;

    @Scheduled(fixedRate = 5000)
    public void autoJudgeExamWords() {
        if (examWordsJudgeService.getExamUnfinishedCount() != 0) {
            log.info("有试卷待检测，开始检测");
            examWordsJudgeService.judgeExamWords(5);
        }
    }
}
