package com.lightinit.hsdatashow.controller.admin;

import com.lightinit.hsdatashow.dictionary.DicViewMenuTitle;
import com.lightinit.hsdatashow.model.ResultState;
import com.lightinit.hsdatashow.model.admin.*;
import com.lightinit.hsdatashow.service.admin.IAtmosphereService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.Map;

@Controller
@RequestMapping(value = "/admin/atmosphere")
public class AtmosphereController {

    @Autowired
    private IAtmosphereService atmosphereService ;

    @RequestMapping("/index.htm")
    public ModelAndView index(){
        ModelAndView modelAndView = new ModelAndView("admin/atmosphere/index") ;
        modelAndView.addObject("title", DicViewMenuTitle.ATMOSPHERE) ;
        return modelAndView ;
    }

    //空气质量指数
    @RequestMapping("/getAtmosphereIndex.action")
    @ResponseBody
    public AtmosphereNameAndValueModel getAtmosphereIndex(){
        AtmosphereNameAndValueModel atmosphereNameAndValueModel = atmosphereService.getAtmosphereIndex() ;
        return atmosphereNameAndValueModel ;
    }


    //全年空气质量状况
    @RequestMapping("/getAtmosphereYear.action")
    @ResponseBody
    public AtmosphereYearResultModel getAtmosphereYear(){
        AtmosphereYearResultModel atmosphereYearResultModel = atmosphereService.getAtmosphereYear() ;
        return atmosphereYearResultModel ;
    }

    //机动车尾气排放情况
    @RequestMapping("/getAtmosphereEmission.action")
    @ResponseBody
    public AtmosphereEmissionResultModel getAtmosphereEmission(){
        AtmosphereEmissionResultModel atmosphereEmissionResultModel = atmosphereService.getAtmosphereEmission() ;
        return atmosphereEmissionResultModel ;
    }

    //城市气化率
    @RequestMapping("/getAtmosphereGasification.action")
    @ResponseBody
    public AtmosphereGasificationResultModel getAtmosphereGasification(){
        AtmosphereGasificationResultModel atmosphereGasificationResultModel = atmosphereService.getAtmosphereGasification() ;
        return atmosphereGasificationResultModel ;
    }

    //重点污染源工业废气排放
    @RequestMapping("/getAtmosphereIndustry.action")
    @ResponseBody
    public AtmosphereIndustryResultModel getAtmosphereIndustry(){
        AtmosphereIndustryResultModel atmosphereGasificationResultModel = atmosphereService.getAtmosphereIndustry() ;
        return atmosphereGasificationResultModel ;
    }

    ////////////////////////衡水市空气质量日变化折线图 和 河北省空气质量日变化折线图////////////////////////////////////////////////////////
    @RequestMapping("/newairquality.htm")       //这是华丽的新页面
    public ModelAndView newairquality(){
        ModelAndView modelAndView = new ModelAndView("admin/atmosphere/new_air_quality") ;
        modelAndView.addObject("title", DicViewMenuTitle.ATMOSPHERE) ;
        return modelAndView ;
    }

    @RequestMapping("/airquality.htm")
    public ModelAndView airquality(){
        ModelAndView modelAndView = new ModelAndView("admin/atmosphere/air_quality") ;
        return modelAndView ;
    }
    @RequestMapping("/getHBCityAirQualityIndex.action")
    @ResponseBody
    public Map<String,Object> getHBCityAirQualityIndex(){
        return atmosphereService.getHBCityAirQualityIndex();
    }

    @RequestMapping("/getHSAreaAirPollutionIndex.action")
    @ResponseBody
    public Map<String,Object> getHSAreaAirPollutionIndex(){
        return atmosphereService.getHSAreaAirPollutionIndex();
    }

    @RequestMapping("/getHbAreaAirFineCount.action")
    @ResponseBody
    public ResultState getHbAreaAirFineCount(){
        return atmosphereService.getHbAreaAirFineCount();
    }
}
