package cn.com.ctop.kuaishou.modules.report.controller;

import cn.com.ctop.kuaishou.modules.report.mapper.NewMonitorMapper;
import cn.com.ctop.kuaishou.modules.report.service.NewMonitorService;
import org.apache.ibatis.annotations.Param;
import org.jeecg.common.api.vo.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Description: 新上监控
 * @Author: zzy
 * @Date: 2021-08-13
 * @Version: V1.0
 */
@RestController
@RequestMapping("/newMonitor")
public class NewMonitorController {

    @Autowired
    NewMonitorService newMonitorService;
    @Autowired
    NewMonitorMapper NewMonitorMapperl;

    /**
     * @param type
     * @return
     */
    @GetMapping("/synchronousMonitor")
    public Result synchronousMonitor(@Param("type") String type) {
        List<Long> kuaiShouallAccountId = NewMonitorMapperl.getAllAccountId("2");
        List<Long> touTiaoAccountId = NewMonitorMapperl.getAllAccountId("1");
        for (Long aLong : kuaiShouallAccountId) {
            newMonitorService.synchronousKuaiShouMonitor(type, aLong);
        }
        for (Long aLong : touTiaoAccountId) {
            newMonitorService.synchronousTouTiaoMonitor(type, aLong);
        }

        return new Result();
    }
}
