package cn.com.ctop.kuaishou.modules.live.service.impl;

import cn.com.ctop.kuaishou.modules.live.entity.LiveDataImportRecord;
import cn.com.ctop.kuaishou.modules.live.mapper.LiveDataImportRecordMapper;
import cn.com.ctop.kuaishou.modules.live.service.ILiveDataImportRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.common.util.DateUtils;
import org.springframework.stereotype.Service;

import java.util.UUID;

/**
 * 直播数据——操作记录表
 *
 * @author jeecg-boot
 * 2022-04-01
 * @version V1.0
 */
@Service
public class LiveDataImportRecordServiceImpl extends ServiceImpl<LiveDataImportRecordMapper, LiveDataImportRecord> implements ILiveDataImportRecordService {

    @Override
    public void addImportRecord(Long accountId, Integer type, String userId) {
        LiveDataImportRecord record = new LiveDataImportRecord();
        record.setAccountId(accountId);
        record.setId(accountId + "_" + DateUtils.formatDate("yyyyMMdd") + "_" + UUID.randomUUID().toString().replace("-", "").substring(0, 9));
        record.setType(type);
        record.setUserId(userId);
        record.setStatDate(DateUtils.date2Str());
        this.save(record);
    }

}
