package com.lightinit.hsdatashow.controller.admin;

import com.lightinit.hsdatashow.model.admin.*;
import com.lightinit.hsdatashow.service.admin.IWaterThingService;
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.List;

@Controller
@RequestMapping(value = "/admin/waterThing")
public class WaterThingController {

    @Autowired
    private IWaterThingService waterThingService ;

    @RequestMapping(value = "/index.htm")
    public ModelAndView index(){
        ModelAndView modelAndView = new ModelAndView("admin/waterThing/index") ;
        //降水总量
        PrecipitationAggregateResultModel jiangshui = waterThingService.getPrecipitationAggregate() ;
        modelAndView.addObject("jiangshui",jiangshui) ;
        //水资源总量
        WaterResourceAggregateResultModel shuiziyuan = waterThingService.getWaterResourceAggregate() ;
        modelAndView.addObject("shuiziyuan",shuiziyuan) ;
        //蓄水总量
        WaterStorageAggregateResultModel xushui = waterThingService.getWaterStorageAggregate() ;
        modelAndView.addObject("xushui",xushui) ;
        return modelAndView ;
    }

    /**
     * 蓄水总量变化图
     * @return
     */
    @RequestMapping(value = "getChangeWaterStorageAggregate.action")
    @ResponseBody
    public GroupNameAndValueModel getChangeWaterStorageAggregate(){
        return waterThingService.getChangeWaterStorageAggregate() ;
    }

    /**
     * 水资源总量
     * @return
     */
    @RequestMapping(value = "getWaterResourceAggregateList.action")
    @ResponseBody
    public GroupNameAndValueModel getWaterResourceAggregateList(){
        return waterThingService.getWaterResourceAggregateList() ;
    }

    /**
     * 水源地水质分析
     * @return
     */
    @RequestMapping(value = "getWaterSourceQualityAnalysis.action")
    @ResponseBody
    public GroupNameAndValueModel getWaterSourceQualityAnalysis(){
        return waterThingService.getWaterSourceQualityAnalysis() ;
    }

    /**
     * 人均用水量
     * @return
     */
    @RequestMapping(value = "getWaterConsumptionPerCapita.action")
    @ResponseBody
    public GroupNameAndValueModel getWaterConsumptionPerCapita(){
        return waterThingService.getWaterConsumptionPerCapita() ;
    }

    /**
     * 污水排放量
     * @return
     */
    @RequestMapping(value = "getSewageDischarge.action")
    @ResponseBody
    public GroupNameAndValueModel getSewageDischarge(){
        return waterThingService.getSewageDischarge() ;
    }

    /**
     * 降水总量（一个数）
     * @return
     */
    @RequestMapping(value = "getPrecipitationAggregate.action")
    @ResponseBody
    public GroupNameAndValueModel getPrecipitationAggregate(){
        return waterThingService.getPrecipitationAggregateList() ;
    }

    /**
     * 主要企业用水
     * @return
     */
    @RequestMapping(value = "getWaterSupplyMain.action")
    @ResponseBody
    public WaterSupplyMainReturnModel getWaterSupplyMain(){
        return waterThingService.getWaterSupplyMain() ;
    }

    /**
     * 供水量
     * @return
     */
    @RequestMapping(value = "getWaterSupplyAggregate.action")
    @ResponseBody
    public List<WaterSupplyAggregateResultModel> getWaterSupplyAggregate(){
        return waterThingService.getWaterSupplyAggregate() ;
    }

    /**
     * 降水量分布
     * @return
     */
    @RequestMapping(value = "getPrecipitation.action")
    @ResponseBody
    public List<PrecipitationResultModel> getPrecipitation(){
        return waterThingService.getPrecipitation() ;
    }


    /**
     * 全市供水量
     * @return
     */
    @RequestMapping(value = "getWaterAllCity.action")
    @ResponseBody
    public GroupNameAndValueModel getWaterAllCity(){
        return waterThingService.getWaterAllCity() ;
    }

    /**
     * 县供水量
     */
    @RequestMapping(value = "getWaterAllCounty.action")
    @ResponseBody
    public GroupNameAndValueModel getWaterAllCounty(){
        return waterThingService.getWaterAllCounty() ;
    }
}
