package com.lightinit.hsdatashow.controller.admin;

import com.lightinit.hsdatashow.dictionary.DicViewMenuTitle;
import com.lightinit.hsdatashow.model.ResultState;
import com.lightinit.hsdatashow.model.admin.EconomicDevelopmentListModel;
import com.lightinit.hsdatashow.model.admin.GdpOccupationRatioModel;
import com.lightinit.hsdatashow.model.admin.PerCapitaGdpListModel;
import com.lightinit.hsdatashow.service.admin.IEconomicDevelopmentService;
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;

@Controller
@RequestMapping(value = "/admin/newEconomicDevelopment")
public class NewEconomicDevelopmentController {
    @Autowired
    private IEconomicDevelopmentService economicDevelopmentService;
    @RequestMapping(value = "/index.htm")
    public ModelAndView index(){
        ModelAndView modelAndView = new ModelAndView("admin/economicDevelopment/new") ;
        GdpOccupationRatioModel model = economicDevelopmentService.getGDPTotal();
        modelAndView.addObject("value",model.getValue().get(0)) ;
        modelAndView.addObject("value1",model.getValue1().get(0)) ;
        modelAndView.addObject("value2",model.getValue2().get(0)) ;
        modelAndView.addObject("value3",model.getValue3().get(0)) ;
        modelAndView.addObject("title",DicViewMenuTitle.STATISTICS);
        return modelAndView ;
    }
    @RequestMapping(value = "/getGDP.action")
    @ResponseBody
    public PerCapitaGdpListModel getGDP(){
        PerCapitaGdpListModel model = economicDevelopmentService.getGDP();
        return model;
    }

//    @RequestMapping(value = "/getGDPTotal.action")
//    @ResponseBody
//    public GdpOccupationRatioModel getGDPTotal(){
//        GdpOccupationRatioModel model = economicDevelopmentService.getGDPTotal();
//        return model;
//    }

    @RequestMapping(value = "/getPerCapitaGdp.action")
    @ResponseBody
    public PerCapitaGdpListModel getPerCapitaGdp(){
        PerCapitaGdpListModel model = economicDevelopmentService.getPerCapitaGdp();
        return model;
    }
    @RequestMapping(value = "/getGdpOccupationRatio.action")
    @ResponseBody
    public ResultState getGdpOccupationRatio(){
        ResultState model = economicDevelopmentService.getGdpOccupationRatio();
        return model;
    }

    @RequestMapping(value = "/getGdpOccupationRatio2.action")
    @ResponseBody
    public GdpOccupationRatioModel getGdpOccupationRatio2(){
        GdpOccupationRatioModel model = economicDevelopmentService.getGdpOccupationRatio2();
        return model;
    }

//    @RequestMapping(value = "/getLaborProduction.action")
//    @ResponseBody
//    public PerCapitaGdpListModel getLaborProduction(){
//        PerCapitaGdpListModel model = economicDevelopmentService.getLaborProduction();
//        return model;
//    }
    @RequestMapping(value = "/getUrbanization.action")
    @ResponseBody
    public PerCapitaGdpListModel getUrbanization(){
        PerCapitaGdpListModel model = economicDevelopmentService.getUrbanization();
        return model;
    }

    @RequestMapping(value = "/getDistrictCounty.action")
    @ResponseBody
    public ResultState getDistrictCounty(){
        ResultState model = economicDevelopmentService.getDistrictCounty();
        return model;
    }

}
