package com.gyee.frame.controller.monitor;

import com.gyee.frame.common.conf.AjaxStatus;
import com.gyee.frame.common.domain.AjaxResult;
import com.gyee.frame.service.websocket.SandtableService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping("/sandtable")
@Api(value = "沙盘监视" ,tags =  "沙盘监视")
public class SandtableController {

    @Resource
    private SandtableService sandtableService;



    @PostMapping("/findWtInfo")
    @ResponseBody
    @ApiOperation(value = "风机信息", notes = "风场信息")
    @ApiImplicitParams({@ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query")
    })

    public AjaxResult findSandtableInfo(String wpId) throws Exception {


        Map<String, Object> map=  new HashMap<>();


        map=sandtableService.findSandtableInfo(wpId);

        if (null!=map) {
            return AjaxResult.successData(AjaxStatus.success.code, map);
        } else {
            return AjaxResult.successData(AjaxStatus.error.code, map);
        }

    }

    @PostMapping("/judgeWpHealth")
    @ResponseBody
    @ApiOperation(value = "风场健康情况", notes = "风场健康情况")

    public AjaxResult judgeWpHealth() throws Exception {


        Map<String, Object> map=  new HashMap<>();


        map=sandtableService.judgeWpHealth();

        if (null!=map) {
            return AjaxResult.successData(AjaxStatus.success.code, map);
        } else {
            return AjaxResult.successData(AjaxStatus.error.code, map);
        }

    }


}
