package com.ssj.service.task;

import com.ssj.framework.core.util.SystemResourceLocator;
import com.ssj.service.sys.situation.service.LearningConditionService;
import com.ssj.taskthread.Task;

import java.util.concurrent.TimeUnit;

/**
 * 异步统计生成知识点错题统计数据
 *
 * @author yrf
 * @date 2020/5/27 15:20
 */
public class SyncGenerateKnowledgeWrongQuestionCount extends Task {

    private String homeworkId;

    public SyncGenerateKnowledgeWrongQuestionCount(String homeworkId) {
        super();
        this.homeworkId = homeworkId;
    }

    @Override
    public void run() {
        // 统计生成知识点错题统计数据
        try {
            TimeUnit.SECONDS.sleep(6);

            logger.info("异步统计生成知识点错题统计数据开始，=[{}]", homeworkId);
            LearningConditionService learningConditionService = SystemResourceLocator.getBean(LearningConditionService.class);
            learningConditionService.generateWrongQuestionKnowledge(this.homeworkId);
			logger.info("异步统计生成知识点错题统计数据完成");
		} catch (Exception e) {
			logger.error("异步统计生成知识点错题统计数据异常", e);
        }
    }

}
