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

import cn.com.ctop.common.module.utils.Check;
import cn.com.ctop.kuaishou.modules.report.entity.KuaiShouCleanMaterialReport;
import cn.com.ctop.kuaishou.modules.report.mapper.KuaiShouCleanMaterialReportMapper;
import cn.com.ctop.kuaishou.modules.report.mapper.KuaishouReportDailyCreativeMapper;
import cn.com.ctop.kuaishou.modules.report.service.IKuaiShouCleanMaterialReportService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 快手素材清洗数据
 *
 * @author jeecg-boot
 * @version V1.0
 * @date 2020-02-24
 */
@Service
public class KuaiShouCleanMaterialReportServiceImpl extends ServiceImpl<KuaiShouCleanMaterialReportMapper, KuaiShouCleanMaterialReport> implements IKuaiShouCleanMaterialReportService {
    @Autowired
    private KuaishouReportDailyCreativeMapper kuaishouReportDailyCreativeMapper;

    @Override
    public List<String> getSignature() {
        return kuaishouReportDailyCreativeMapper.getSignatureList();
    }

    @Override
    public void calculationReport(String signature) {
        if (Check.isNull(signature)) {
            return;
        }
        KuaiShouCleanMaterialReport calculationMaterialReport = kuaishouReportDailyCreativeMapper.calculationMaterialReport(signature);
        if (!Check.isNull(calculationMaterialReport)) {
            this.saveOrUpdate(calculationMaterialReport);
        }
    }
}
