package com.ssj.service.conch.teacher.task;

import com.alibaba.fastjson.JSON;
import com.ssj.bean.kmt.kmt.domain.QuestionRecommendRecord;
import com.ssj.service.kmt.service.QuestionRecommendRecordService;
import com.ssj.taskthread.Task;

/**
 * @author yrf
 * @description
 * @time 2020/3/17 13:18
 */
public class QuestionRecommendRecordSaveTask extends Task {

    private QuestionRecommendRecord questionRecommendRecord;
    private QuestionRecommendRecordService questionRecommendRecordService;

    public QuestionRecommendRecordSaveTask(QuestionRecommendRecord questionRecommendRecord,
                                           QuestionRecommendRecordService questionRecommendRecordService) {

        super();
        this.questionRecommendRecord = questionRecommendRecord;
        this.questionRecommendRecordService = questionRecommendRecordService;
    }

    @Override
    public void run() {
        try {
            questionRecommendRecordService.save(questionRecommendRecord);
        } catch (Exception e) {
            logger.error("questionRecommendRecord={}", JSON.toJSONString(questionRecommendRecord));
            logger.error("异步保存推荐题目记录异常", e);
        }
    }

}
