package cn.com.ctop.toutiao.modules.material.service.impl;

import cn.com.ctop.common.module.utils.Check;
import cn.com.ctop.toutiao.modules.material.service.IBytedanceCleanMaterialService;
import cn.com.ctop.toutiao.modules.report.entity.ByteDanceCleanMaterialReport;
import cn.com.ctop.toutiao.modules.report.mapper.BytedanceCreativeDailyReportMapper;
import cn.com.ctop.toutiao.modules.report.service.IByteDanceCleanMaterialReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BytedanceCleanMaterialServiceImpl implements IBytedanceCleanMaterialService {
    @Autowired
    private BytedanceCreativeDailyReportMapper bytedanceCreativeDailyReportMapper;
    @Autowired
    private IByteDanceCleanMaterialReportService byteDanceCleanMaterialReportService;

    /**
     * MD5 集合
     *
     * @return
     */
    @Override
    public List<String> getSignature() {
        return bytedanceCreativeDailyReportMapper.getSignatureList();
    }

    /**
     * 头条素材报表
     *
     * @param signature
     */
    @Override
    public void calculationMaterialReport(String signature) {
        if (Check.isNull(signature)) {
            return;
        }
        ByteDanceCleanMaterialReport calculationMaterialReport = bytedanceCreativeDailyReportMapper.calculationMaterialReport(signature);
        if (!Check.isNull(calculationMaterialReport)) {
            byteDanceCleanMaterialReportService.saveOrUpdate(calculationMaterialReport);
        }
    }
}
