package com.xhkjedu.sstudy.task;

import com.xhkjedu.sstudy.service.paperstudent.PaperStudentService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

/**
 * @ClassName PaperStudentTask
 * Description 学生作业，如果是截至时间到时显示答案，定时任务处理
 * Author WN
 * Date 2020/10/13 15:32
 **/
@Slf4j
@Component
public class PaperStudentTask {

    @Autowired
    private PaperStudentService paperStudentService;

    @Async("threadPoolTaskScheduler")
    @Scheduled(cron = "${cron.updatePaperStuShowanswer}")
    public void updatePaperStuShowanswer() {
        paperStudentService.updateShowanswer();
    }

    /**
     * @Description 作业自动收卷
     * @Date 2024/4/1 14:39
     * @Author YWX
     * @Param []
     * @Return void
     **/
    @Async("threadPoolTaskScheduler")
    @Scheduled(cron = "${cron.updatePaperStuShowanswer}")
    public void updatePaperRollUp() {
        paperStudentService.updatePaperRollUp();
    }

    /**
     * 合并学生答案-题库作业
     *
     * @param []
     * @return void
     * @author ywx
     * @date 2022/5/9 16:32
     */
    @Async("threadPoolTaskScheduler")
    @Scheduled(cron = "${cron.imgMerge}")
    public void paperStuQuestionAnswerMerge() {
        paperStudentService.paperStuQuestionAnswerMerge();
    }

    /**
     * 合并学生答案-附件作业
     *
     * @param []
     * @return void
     * @author ywx
     * @date 2022/5/9 16:33
     */
    @Async("threadPoolTaskScheduler")
    @Scheduled(cron = "${cron.imgMerge}")
    public void paperStuScantronAnswerMerge() {
        paperStudentService.paperStuScantronAnswerMerge();
    }

}
