package com.fs.qw.strategy.impl;

import com.fs.common.utils.DateUtils;
import com.fs.qw.bo.SendMsgLogBo;
import com.fs.qw.domain.QwCourseLinkSendMsgLog;
import com.fs.qw.mapper.QwCourseLinkSendMsgLogMapper;
import com.fs.qw.strategy.SmsLogStrategy;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.fs.common.core.domain.R;

@Component
public class CourseLinkLogStrategyImpl implements SmsLogStrategy {

    @Autowired
    private QwCourseLinkSendMsgLogMapper courseLinkSendMsgLogMapper;

    @Override
    public void recordLog(R result, String content, String phone, Long tempId, String type, Integer number, Object contextObject) {

        SendMsgLogBo sendMsgLogBo = (SendMsgLogBo) contextObject;

        QwCourseLinkSendMsgLog log = new QwCourseLinkSendMsgLog();
        log.setCompanySmsLogsId(sendMsgLogBo.getCompanySmsLogsId());
        log.setExternalContactId(sendMsgLogBo.getExternalId());
        log.setCourseId(sendMsgLogBo.getCourseId());
        log.setVideoId(sendMsgLogBo.getVideoId());
        log.setNumber(number);
        log.setType(type);
        log.setPhone(phone);
        log.setTempId(tempId);
        log.setContent(content);
        log.setCreateTime(DateUtils.getNowDate());
        log.setResult(result.get("msg").toString());
        
        courseLinkSendMsgLogMapper.insertQwCourseLinkSendMsgLog(log);
    }
}