package com.gyee.frame.controller.warn;

import com.gyee.frame.common.conf.AjaxStatus;
import com.gyee.frame.common.domain.AjaxResult;
import com.gyee.frame.model.custom.TemperatureVo;
import com.gyee.frame.service.warn.TemperatureService;
import com.gyee.frame.util.StringUtils;
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.ArrayList;
import java.util.List;

@Controller
@RequestMapping("/temperature")
@Api(value = "预警事件", tags = "预警事件")
public class TemperatureController {

    @Resource
    private TemperatureService temperatureService;

    @PostMapping("/getTemperatureList")
    @ResponseBody
    @ApiOperation(value = "预警事件查询 type yyz 液压站,clx 齿轮箱,fdj 发电机,bj 变桨,qt 其他,zz 主轴,zd 震动", notes = "预警事件查询")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "wpId", value = "风场编号", required = true, dataType = "string", paramType = "query"),
            @ApiImplicitParam(name = "type", value = "类型", required = true, dataType = "string", paramType = "query")})

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

        List<List<TemperatureVo>>result=new ArrayList<>();

        if (StringUtils.notEmp(wpId) && StringUtils.notEmp(type) ) {

            result=temperatureService.temperatureQuery(wpId,type);
        }
        if (null != result) {
            return AjaxResult.successData(AjaxStatus.success.code, result);
        } else {
            return AjaxResult.successData(AjaxStatus.success.code, result);
        }

    }


}
