package cn.com.ctop.job.kuaishou.handler;

import cn.com.ctop.kuaishou.modules.report.mapper.NewMonitorMapper;
import cn.com.ctop.kuaishou.modules.report.service.NewMonitorService;
import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

@Component
@Slf4j
public class NewMonitorOneDayJob {

    @Resource
    NewMonitorService newMonitorService;
    @Resource
    NewMonitorMapper newMonitorMapper;
    /**
     * 账户清理
     *
     * @param
     * @return
     * @throws
     * @author ZZY
     */
    @XxlJob("synchronousMonitorOneDay")
    public void execute() throws Exception {
        try {
            List<Long> kuaiShouallAccountId = newMonitorMapper.getAllAccountId("2");
            List<Long> touTiaoAccountId = newMonitorMapper.getAllAccountId("1");
            for (Long aLong : kuaiShouallAccountId) {
                newMonitorService.synchronousKuaiShouMonitor("1", aLong);
            }
            for (Long aLong : touTiaoAccountId) {
                newMonitorService.synchronousTouTiaoMonitor("1", aLong);
            }
        } catch (Exception e) {
            log.info("清理完成完成");
        }

    }
}
