package cn.cecep.talroad.task;

import cn.cecep.talroad.common.core.web.domain.AjaxResults;
import cn.cecep.talroad.data.analyse.task.service.SiteMonitoringService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
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;

@Api(tags = "站点监测高值")
@RestController
@RequestMapping("/site/monitoring")
@Slf4j
public class SiteMonitoringController {

    @Autowired
    private SiteMonitoringService siteMonitoringService;

    @GetMapping("/warningReport")
    public AjaxResults<Void> warningReport() {
        try {
            log.info("站点监测高值开始执行");
            siteMonitoringService.mainProcess();
        } catch (Exception e) {
            e.printStackTrace();
            log.info("站点监测高值执行失败. 原因：" + e.getMessage());
        }
        return AjaxResults.success();
    }

}
