package com.gyee.runeconomy.controller.monitor;

import com.gyee.runeconomy.dto.AjaxResult;
import com.gyee.runeconomy.service.monitor.PhotovoltaicmatrixService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

/**
 * 光伏矩阵展示
 */

@Controller
@RequestMapping("/Photovoltaic")
@Api(value = "光伏矩阵", tags = "光伏矩阵")
public class PhotovoltaicmatrixController {
    @Autowired
    private PhotovoltaicmatrixService photovoltaicmatrixService;

    /**
     * @param wpId
     * @return
     * @throws Exception
     */
    @GetMapping("/monitor")
    @ResponseBody
    @ApiOperation(value = "首页", notes = "首页")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "wpId", value = "场站编号", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "type", value = "类型", required = true, dataType = "string", paramType = "query")
            //            @ApiImplicitParam(name = "pageNum", value = "场站编号", required = true, dataType = "string", paramType = "query"),
            //            @ApiImplicitParam(name = "pageSize", value = "场站编号", required = true, dataType = "string", paramType = "query"),
    })

    public AjaxResult getinformation(String wpId, String type) throws Exception {

        Map<String, String> map = new HashMap<>();
        if (!wpId.isEmpty()) {
            map = photovoltaicmatrixService.getcockpit(wpId, type);
        }
        if (null != map) {
            return AjaxResult.successData(200, map);
        } else {
            return AjaxResult.error(500, "操作失败");
        }

    }

}
