package com.xzzn.web.controller.ems;

import com.xzzn.common.core.controller.BaseController;
import com.xzzn.common.core.domain.AjaxResult;
import com.xzzn.ems.service.IEmsSiteService;
import com.xzzn.ems.service.IHomePageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 *
 *  站点信息
 *
 */
@RestController
@RequestMapping("/ems/homePage")
public class EmsHomePageController extends BaseController{

    @Autowired
    private IHomePageService homePageService;
    @Autowired
    private IEmsSiteService emsSiteService;

    /**
     * 获取站点总信息
     */
    @GetMapping("/getSiteTotalInfo")
    public AjaxResult getSiteTotalInfo()
    {
        return success(homePageService.getSiteTotalInfo());
    }

    /**
     * 首页看板数据
     */
    @GetMapping("/dataList")
    public AjaxResult list() throws  Exception
    {
        try {
            return success(homePageService.getHomePageDataList());
        } catch (Exception e) {
            return error(e.getMessage());
        }
    }

    /**
     * 获取所有站点
     */
    @GetMapping("/getAllSites")
    public AjaxResult getAllSites()
    {
        return success(emsSiteService.getAllSites());
    }



}
