package com.brilliance.controller;

import com.alibaba.fastjson.JSONObject;
import com.brilliance.bo.*;
import com.brilliance.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/cigem")
@RestController
public class ComController {

    @Autowired
    private QryMonitorPointAllService qryMonitorPointAllService;
    @Autowired
    private QryAvgOnlineRateService qryAvgOnlineRateService;
    @Autowired
    private QryOnlineRateRankService qryOnlineRateRankService;
    @Autowired
    private QryMonitorDeviceListService qryMonitorDeviceListService;
    @Autowired
    private QryDBDataPointsService qryDBDataPointsService;
    @Autowired
    private QryEarthReportService qryEarthReportService;
    @Autowired
    private QryImportReportService qryImportReportService;
    @Autowired
    private QryWeatherReportService qryWeatherReportService;
    @Autowired
    private QryEarthReportTrendDataService qryEarthReportTrendDataService;
    @Autowired
    private QryDeviceAndSensorCountService qryDeviceAndSensorCountService;
    @Autowired
    private QryWarnMsgDisposeRateService qryWarnMsgDisposeRateService;
    @Autowired
    private QryOnlineRateOfMonthService qryOnlineRateOfMonthService;
    @Autowired
    private QryWarnMsgDisposeRateOfMonthService qryWarnMsgDisposeRateOfMonthService;

    /**
     * 测试
     * @param comBo
     * @return
     */
    @RequestMapping(value = "/test", method = RequestMethod.POST)
    @ResponseBody
    public String queryStationChang(@RequestBody ComBo comBo){
        return comBo.str;
    }

    /**
     * 2.3.4.监测点列表
     * @param
     * @return
     */
    @RequestMapping(value = "/getMonitorPointAll", method = RequestMethod.POST)
    @ResponseBody
    public RspComBo<RspMonitorPointAllBo> getMonitorPointAll(@RequestBody ReqQryMonitorPointAllBo req) throws Exception {
        return qryMonitorPointAllService.qryMonitorPointAll(req);
    }

    /**
     * 2.3.11.不同时间段不同地区设备在线率
     * @param
     * @return
     */
    @RequestMapping(value = "/getAvgOnlineRate", method = RequestMethod.POST)
    @ResponseBody
    public JSONObject getAvgOnlineRate(@RequestBody ReqAvgOnlineRateBo req) throws Exception {
        return qryAvgOnlineRateService.getAvgOnlineRate(req);
    }

    /**
     * 2.3.12.各省/厂商设备在线率及排名
     * @param
     * @return
     */
    @RequestMapping(value = "/getOnlineRateRank", method = RequestMethod.POST)
    @ResponseBody
    public RspComBo<RspOnlineRateRankBo> getOnlineRateRank(@RequestBody ReqOnlineRateRankBo req) throws Exception {
        return qryOnlineRateRankService.getOnlineRateRank(req);
    }

    /**
     * 2.3.6.监测点下设备及传感器列表
     * @param
     * @return
     */
    @RequestMapping(value = "/getMonitorDeviceList", method = RequestMethod.POST)
    @ResponseBody
    public RspComBo<RspMonitorDeviceListBo> getMonitorDeviceList(@RequestBody ReqMonitorDeviceListBo req) throws Exception {
        return qryMonitorDeviceListService.getMonitorDeviceList(req);
    }
    /**
     * 2.3.7.监测数据获取
     * @param
     * @return
     */
    @RequestMapping(value = "/getDBDataPoints", method = RequestMethod.POST)
    @ResponseBody
    public RspComBo<RspDBDataPointsBo> getDBDataPoints(@RequestBody ReqDBDataPointsBo req) throws Exception {
        return qryDBDataPointsService.getDBDataPoints(req);
    }

    /**
     * 2.3.9.地震速报数据获取
     * @param
     * @return
     */
    @RequestMapping(value = "/getEarthReport", method = RequestMethod.POST)
    @ResponseBody
    public RspFileComBo getEarthReport(@RequestBody ReqEarthReportBo req) throws Exception {
        return qryEarthReportService.getEarthReport(req);
    }

    /**
     * 2.3.10.重大事件速报数据获取
     * @param
     * @return
     */
    @RequestMapping(value = "/getImportReport", method = RequestMethod.POST)
    @ResponseBody
    public RspFileComBo getImportReport(@RequestBody ReqImportReportBo req) throws Exception {
        return qryImportReportService.getImportReport(req);
    }

    /**
     * 2.3.13.气象速报数据获取
     * @param
     * @return
     */
    @RequestMapping(value = "/getWeatherReport", method = RequestMethod.POST)
    @ResponseBody
    public RspFileComBo getWeatherReport(@RequestBody ReqWeatherReportBo req) throws Exception {
        return qryWeatherReportService.getWeatherReport(req);
    }

    /**
     * 2.3.14.地震二期速报未来24小时趋势数据获取
     * @param
     * @return
     */
    @RequestMapping(value = "/getEarthReportTrendData", method = RequestMethod.POST)
    @ResponseBody
    public RspComBo<RspEarthReportTrendDataBo> getEarthReportTrendData(@RequestBody ReqEarthReportTrendDataBo req) throws Exception {
        return qryEarthReportTrendDataService.getEarthReportTrendData(req);
    }

    /**
     * 2.3.15.不同时间段不同地区设备和传感器类型和个数
     * @param
     * @return
     */
    @RequestMapping(value = "/getDeviceAndSensorCount", method = RequestMethod.POST)
    @ResponseBody
    public JSONObject getDeviceAndSensorCount(@RequestBody ReqDeviceAndSensorCountBo req) throws Exception {
        return qryDeviceAndSensorCountService.getDeviceAndSensorCount(req);
    }

    /**
     * 2.3.16.不同时间段不同地区预警处置和虚警情况
     * @param
     * @return
     */
    @RequestMapping(value = "/getWarnMsgDisposeRate", method = RequestMethod.POST)
    @ResponseBody
    public RspComObjBo<RspWarnMsgDisposeRateBo> getWarnMsgDisposeRate(@RequestBody ReqWarnMsgDisposeRateBo req) throws Exception {
        return qryWarnMsgDisposeRateService.getWarnMsgDisposeRate(req);
    }

    /**
     * 2.3.17.按年统计每月在线率
     * @param
     * @return
     */
    @RequestMapping(value = "/getOnlineRateOfMonth", method = RequestMethod.POST)
    @ResponseBody
    public JSONObject getOnlineRateOfMonth(@RequestBody ReqOnlineRateOfMonthBo req) throws Exception {
        return qryOnlineRateOfMonthService.getOnlineRateOfMonth(req);
    }

    /**
     * 2.3.18.按年统计每月处置率、虚警率
     * @param
     * @return
     */
    @RequestMapping(value = "/getWarnMsgDisposeRateOfMonth", method = RequestMethod.POST)
    @ResponseBody
    public RspComBo<RspWarnMsgDisposeRateOfMonthBo> getWarnMsgDisposeRateOfMonth(@RequestBody ReqWarnMsgDisposeRateOfMonthBo req) throws Exception {
        return qryWarnMsgDisposeRateOfMonthService.getWarnMsgDisposeRateOfMonth(req);
    }
}