package com.lightinit.hsdatashow.controller.admin;

import com.lightinit.hsdatashow.model.admin.*;
import com.lightinit.hsdatashow.service.admin.IPeopleGrowthService;
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/peopleGrowth")
public class PeopleGrowthController {

    @Autowired
    private IPeopleGrowthService peopleGrowthService ;


    @RequestMapping(value = "/index.htm")
    public ModelAndView index(){
        ModelAndView modelAndView = new ModelAndView("admin/peopleGrowth/index") ;
        return modelAndView ;
    }

    /**
     * 平均寿命
     * @return
     */
    @RequestMapping(value = "getLifetime.action")
    @ResponseBody
    public GroupNameAndValueModel getLifetime(){
        return peopleGrowthService.getLifetime() ;
    }

    /**
     * 平均预产期
     * @return
     */
    @RequestMapping(value = "getExpectedRate.action")
    @ResponseBody
    public AverageExpectedRateResultModel getExpectedRate(){
        return peopleGrowthService.getExpectedRate() ;
    }

    /**
     * 抚养比
     * @return
     */
    @RequestMapping(value = "getDependencyRatio.action")
    @ResponseBody
    public GroupNameAndValueModel getDependencyRatio(){
        return peopleGrowthService.getDependencyRatio() ;
    }

    /**
     * 人口状况
     * @return
     */
    @RequestMapping(value = "getPopulationSummary.action")
    @ResponseBody
    public PopulationSummaryListModel getPopulationSummary(){
        return peopleGrowthService.getPopulationSummary() ;
    }

    /**
     * 年龄结构
     * @return
     */
    @RequestMapping(value = "getAgeStructure.action")
    @ResponseBody
    public AgeStructureReturnModel getAgeStructure(){
        return peopleGrowthService.getAgeStructure() ;
    }

    /**
     * 区域人口
     * @return
     */
    @RequestMapping(value = "getPopulationRegion.action")
    @ResponseBody
    public List<PopulationRegionResultModel> getPopulationRegion(){
        return peopleGrowthService.getPopulationRegion() ;
    }

    /**
     * 区域人口巨型图
     * @return
     */
    @RequestMapping(value = "getPopulationRegionPicture.action")
    @ResponseBody
    public GroupNameAndValueModel getPopulationRegionPicture(){
        return peopleGrowthService.getPopulationRegionPicture() ;
    }

}
