package com.xzzn.web.controller.ems;

import com.xzzn.common.core.controller.BaseController;
import com.xzzn.common.core.domain.AjaxResult;
import com.xzzn.ems.domain.vo.DateSearchRequest;
import com.xzzn.ems.service.IHomePageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 *  站点地图
 *
 */
@RestController
@RequestMapping("/ems/siteMap")
public class EmsSiteMapController extends BaseController{

    @Autowired
    private IHomePageService homePageService;

    /**
     * 获取某个站点基本信息
     */
    @GetMapping("/getSingleSiteBaseInfo")
    public AjaxResult getSingleSiteBaseInfo(@RequestParam String siteId)
    {
        return success(homePageService.getSingleSiteBaseInfo(siteId));
    }

    /**
     * 获取某个站点7天充放电数据
     */
    @GetMapping("/getSevenChargeData")
    public AjaxResult getSevenChargeData(DateSearchRequest request)
    {
        String siteId = request.getSiteId();
        if(siteId == null || siteId.isEmpty()) {
            return error("站点必传");
        }
        return success(homePageService.getSevenChargeData(request));
    }

}
