package com.lightinit.hsdatashow.controller.topic.water;

import com.lightinit.hsdatashow.entity.StWaterLake;
import com.lightinit.hsdatashow.model.topic.water.*;
import com.lightinit.hsdatashow.service.topic.water.IRiverChiefServer;
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.math.BigDecimal;

@Controller
@RequestMapping("/topic/water/riverChief")
public class RiverChiefController {

    @Autowired
    private IRiverChiefServer riverChiefServer ;

    @RequestMapping(value = "/index.htm")
    public ModelAndView index(){
        ModelAndView modelAndView = new ModelAndView("/topic/water/riverChief/index") ;
        //河流概况(个数)
        int riverCount = riverChiefServer.getRiverCount() ;
        modelAndView.addObject("riverCount",riverCount) ;
        //河流概况(河流总长)
        BigDecimal riverLength = riverChiefServer.getRiverLength() ;
        modelAndView.addObject("riverLength",riverLength) ;
        //衡水湖信息
        StWaterLake stWaterLake = riverChiefServer.getHengshuiHu() ;
        modelAndView.addObject("hshxs",stWaterLake.getLakeImpoundage()) ;
        modelAndView.addObject("hshmj",stWaterLake.getLakeArea()) ;
        //河流总蓄水量
        BigDecimal hlxs = riverChiefServer.getHlXs() ;
        modelAndView.addObject("hlxs",hlxs) ;
        return modelAndView ;
    }

    /**
     * 衡水市主要河流概况
     * @return
     */
    @RequestMapping(value = "/getHeliuGaikuang.action")
    @ResponseBody
    public HeliuGaikuangReturnModel getHeliuGaikuang(){
        return riverChiefServer.getHeliuGaikuang() ;
    }

    /**
     * 河流蓄水量
     * @return
     */
    @RequestMapping(value = "/getHeliuXushui.action")
    @ResponseBody
    public ModelNameAndNameOrValue getHeliuXushui(){
        return riverChiefServer.getHeliuXushui() ;
    }

    /**
     * 河流水位
     * @return
     */
    @RequestMapping(value = "/getHeliuShuiwei.action")
    @ResponseBody
    public HeLiuShuiWeiReturnModel getHeliuShuiwei(){
        return riverChiefServer.getHeliuShuiwei() ;
    }

    /**
     * 衡水湖蓄水
     * @return
     */
    @RequestMapping(value = "/getHshxushui.action")
    @ResponseBody
    public NameAndListModel getHshxushui(){
        return riverChiefServer.getHshxushui() ;
    }

    /**
     * 衡水湖水位
     * @return
     */
    @RequestMapping(value = "/getHshshuiwei.action")
    @ResponseBody
    public HshxushuiReturnModel getHshshuiwei(){
        return riverChiefServer.getHshshuiwei() ;
    }
}
