package com.fs.qw.strategy.impl;

import com.fs.common.utils.DateUtils;
import com.fs.qw.bo.SendMsgLogBo;
import com.fs.qw.domain.QwAcquisitionSendMsgLog;
import com.fs.qw.mapper.QwAcquisitionSendMsgLogMapper;
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 AcquisitionLinkLogStrategyImpl implements SmsLogStrategy {

    @Autowired
    private QwAcquisitionSendMsgLogMapper acquisitionSendMsgLogMapper;

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

        QwAcquisitionSendMsgLog log = new QwAcquisitionSendMsgLog();
        log.setCompanySmsLogsId(sendMsgLogBo.getCompanySmsLogsId());
        log.setQwAcquisitionId(sendMsgLogBo.getQwAcquisitionId());
        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());
        
        acquisitionSendMsgLogMapper.insertQwAcquisitionSendMsgLog(log);
    }
}