package com.huatek.busi.controller;

import java.util.Map;

import com.huatek.busi.vo.cable.BusiCableCirculationWarningVo;
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;

import com.alibaba.dubbo.config.annotation.Reference;
import com.huatek.busi.constant.ApiConstant.Tags;
import com.huatek.busi.service.BusiSubPageService;
import com.huatek.busi.vo.BusiInfraredVo;
import com.huatek.busi.vo.warning.BusiArresterVo;
import com.huatek.busi.vo.warning.BusiCapaVo;
import com.huatek.busi.vo.warning.BusiGisSf6Vo;
import com.huatek.busi.vo.warning.BusiIcgeVo;
import com.huatek.busi.vo.warning.BusiOilVo;
import com.huatek.busi.vo.warning.BusiPdVo;
import com.huatek.busi.vo.warning.BusiPhotoVo;
import com.huatek.busi.vo.warning.BusiRunStateVo;
import com.huatek.busi.vo.warning.BusiWcgVo;
import com.huatek.torch.frame.tools.ConstantUtil;
import com.huatek.torch.frame.tools.ResultUtil;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

/**
 * @ClassName: BusiSubPageController
 * @FullClassPath: com.huatek.busi.controller.BusiSubPageController
 * @Description: 二级页面控制器.
 * @author: Arno
 * @date: Aug 2, 2019 2:20:01 PM
 * @version: 1.0
 */
@Api(tags = {Tags.BUSI_SUB_PAGE})
@RestController
@RequestMapping("/api/busiSubPage")
public class BusiSubPageController {

    @Reference(check = false)
    private BusiSubPageService busiSubPageService;

    /**
     * @Title: getIcgeWarningInfo
     * @Description: 铁芯接地信息
     * @createDate: Aug 2, 2019 2:22:03 PM
     * @param    warningId    告警ID
     * @param    sensorCode	 传感器编码
     * @return   Map<String,Object>
     */
    @ApiOperation(value = "铁芯接地信息", response = BusiIcgeVo.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "warningId", value="告警ID"),
            @ApiImplicitParam(name = "sensorCode", value="传感器编码")
    })
    @GetMapping(value = "/getIcgeWarningInfo")
    public Map<String, Object> getIcgeWarningInfo(@RequestParam("warningId") String warningId,
                                                  @RequestParam("sensorCode") String sensorCode) {
        BusiIcgeVo vo = busiSubPageService.getIcgeWarningInfo(warningId, sensorCode);
        return ResultUtil.put(ConstantUtil.REQUEST_SUCCESS, "", vo);
    }

    /**
     * @Title: getOilWarnigInfo
     * @Description: 油色谱告警信息
     * @createDate: Aug 2, 2019 2:22:03 PM
     * @param    warningId    告警ID
     * @param    sensorCode	 传感器编码
     * @return   Map<String,Object>
     */
    @ApiOperation(value = "油色谱告警信息 ", response = BusiOilVo.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "warningId", value="告警ID"),
            @ApiImplicitParam(name = "sensorCode", value="传感器编码")
    })
    @GetMapping(value = "/getOilWarnigInfo")
    public Map<String, Object> getOilWarnigInfo(@RequestParam("warningId") String warningId,
                                                @RequestParam("sensorCode") String sensorCode) {
        BusiOilVo vo = busiSubPageService.getOilWarnigInfo(warningId, sensorCode);
        return ResultUtil.put(ConstantUtil.REQUEST_SUCCESS, "", vo);
    }

    /**
     * 避雷器告警信息
     *
     * @param warningId
     *            告警ID
     * @param sensorCode
     *            传感器编码
     * @return BusiArresterVo
     */
    @ApiOperation(value = "避雷器告警信息", response = BusiArresterVo.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "warningId", value="告警ID"),
            @ApiImplicitParam(name = "sensorCode", value="传感器编码")
    })
    @GetMapping(value = "/getArresterInfo")
    public Map<String, Object> getArresterInfo(@RequestParam("warningId") String warningId,
                                               @RequestParam("sensorCode") String sensorCode) {
        BusiArresterVo arresterInfo = busiSubPageService.getArresterInfo(warningId, sensorCode);
        return ResultUtil.put(ConstantUtil.REQUEST_SUCCESS, "", arresterInfo);
    }

    /**
     * 容性设备告警信息
     *
     * @param warningId
     *            告警ID
     * @param sensorCode
     *            传感器编码
     * @return BusiCapaVo
     */
    @ApiOperation(value = "容性设备告警信息", response = BusiCapaVo.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "warningId", value="告警ID"),
            @ApiImplicitParam(name = "sensorCode", value="传感器编码")
    })
    @GetMapping(value = "/getCapacitanceInfo")
    public Map<String, Object> getCapacitanceInfo(@RequestParam("warningId") String warningId,
                                                  @RequestParam("sensorCode") String sensorCode) {
        BusiCapaVo busiCapaVo = busiSubPageService.getCapacitanceInfo(warningId, sensorCode);
        return ResultUtil.put(ConstantUtil.REQUEST_SUCCESS, "", busiCapaVo);
    }

    /**
     * @Title: getPdWarningInfo
     * @Description: 局放告警信息
     * @createDate: Aug 2, 2019 2:22:03 PM
     * @param    warningId    告警ID
     * @param    sensorCode	 传感器编码
     * @return   Map<String,Object>
     */
    @ApiOperation(value = "局放告警信息", response = BusiPdVo.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "warningId", value="告警ID"),
            @ApiImplicitParam(name = "sensorCode", value="传感器编码"),
            @ApiImplicitParam(name = "eqType", value="告警大类")
    })
    @GetMapping(value = "/getPdWarningInfo")
    public Map<String, Object> getPdWarningInfo(@RequestParam("warningId") String warningId,
                                                @RequestParam("sensorCode") String sensorCode, @RequestParam("eqType") String eqType) {
        BusiPdVo vo = busiSubPageService.getPdWarningInfo(warningId, sensorCode, eqType);
        return ResultUtil.put(ConstantUtil.REQUEST_SUCCESS, "", vo);
    }

    /**
     * @Title: getPhotoWarningInfo
     * @Description: 局放告警信息
     * @createDate: Aug 2, 2019 2:22:03 PM
     * @param    warningId    告警ID
     * @param    sensorCode	 传感器编码
     * @return   Map<String,Object>
     */
    @ApiOperation(value = "图片告警信息", response = BusiPhotoVo.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "warningId", value="告警ID"),
            @ApiImplicitParam(name = "sensorCode", value="传感器编码"),
            @ApiImplicitParam(name = "eqType", value="告警大类")
    })
    @GetMapping(value = "/getPhotoWarningInfo")
    public Map<String, Object> getPhotoWarningInfo(@RequestParam("warningId") String warningId,
                                                   @RequestParam("sensorCode") String sensorCode, @RequestParam("eqType") String eqType) {
        BusiPhotoVo vo = busiSubPageService.getPhotoWarningInfo(warningId, sensorCode, eqType);
        return ResultUtil.put(ConstantUtil.REQUEST_SUCCESS, "", vo);
    }

    /**
     * Gis-SF6告警信息
     *
     * @param warningId
     *            告警ID
     * @param sensorCode
     *            传感器编码
     * @return BusiCapaVo
     */
    @ApiOperation(value = "Gis-SF6告警信息", response = BusiGisSf6Vo.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "warningId", value="告警ID"),
            @ApiImplicitParam(name = "sensorCode", value="传感器编码")
    })
    @GetMapping(value = "/getGisSf6Info")
    public Map<String, Object> getGisSf6Info(@RequestParam("warningId") String warningId,
                                             @RequestParam("sensorCode") String sensorCode) {
        BusiGisSf6Vo busiGisSf6Vo = busiSubPageService.getGisSf6Info(warningId, sensorCode);
        return ResultUtil.put(ConstantUtil.REQUEST_SUCCESS, "", busiGisSf6Vo);
    }

    /**
     * 运行工况告警信息
     *
     * @param warningId
     *            告警ID
     * @param sensorCode
     *            传感器编码
     * @return BusiCapaVo
     */
    @ApiOperation(value = "运行工况告警信息", response = BusiRunStateVo.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "warningId", value="告警ID"),
            @ApiImplicitParam(name = "mainTreeId", value="站点设备树ID")
    })
    @GetMapping(value = "/getRunStateWarningInfo")
    public Map<String, Object> getRunStateWarningInfo(@RequestParam("warningId") String warningId,
                                                      @RequestParam("mainTreeId") String mainTreeId) {
        BusiRunStateVo busiRunStateVo = busiSubPageService.getRunStateWarningInfo(warningId, mainTreeId);
        return ResultUtil.put(ConstantUtil.REQUEST_SUCCESS, "", busiRunStateVo);
    }


    /**
     * @Title: getPdWarningInfo
     * @Description: 红外检测告警信息
     * @createDate: Aug 2, 2019 2:22:03 PM
     * @param    warningId    告警ID
     * @param    sensorCode   传感器编码
     * @return   Map<String,Object>
     */
    @ApiOperation(value = "红外检测告警信息", response = BusiInfraredVo.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "warningId", value="告警ID"),
            @ApiImplicitParam(name = "sensorCode", value="传感器编码"),
            @ApiImplicitParam(name = "eqType", value="告警大类")
    })
    @GetMapping(value = "/getBusiInfrared")
    public Map<String, Object> getBusiInfrared(@RequestParam("warningId") String warningId,
                                               @RequestParam("sensorCode") String sensorCode, @RequestParam("eqType") String eqType) {
        BusiInfraredVo vo = busiSubPageService.getBusiInfrared(warningId, sensorCode,eqType);
        return ResultUtil.put(ConstantUtil.REQUEST_SUCCESS, "", vo);
    }

    /**
     * @Title: getcableCirculationWarningInfo
     * @Description: 电缆环流告警信息
     * @createDate: Aug 2, 2019 2:22:03 PM
     * @param    warningId    告警ID
     * @param    sensorCode   传感器编码
     * @return   Map<String,Object>
     */
    @ApiOperation(value = "电缆环流告警信息", response = BusiCableCirculationWarningVo.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "warningId", value="告警ID"),
            @ApiImplicitParam(name = "sensorCode", value="传感器编码"),
            @ApiImplicitParam(name = "eqType", value="告警大类")
    })
    @GetMapping(value = "/getCableCirculationWarningInfo")
    public Map<String, Object> getcableCirculationWarningInfo(@RequestParam("warningId") String warningId,
                                               @RequestParam("sensorCode") String sensorCode, @RequestParam("eqType") String eqType) {
        BusiCableCirculationWarningVo vo = busiSubPageService.getcableCirculationWarningInfo(warningId, sensorCode,eqType);
        return ResultUtil.put(ConstantUtil.REQUEST_SUCCESS, "", vo);
    }

    /**
     * @Title: getCwgInfo
     * @Description:测温柜告警信息
     * @createDate: Aug 15, 2019 2:17:53 PM
     * @param warningId
     *            告警ID
     * @param sensorCode
     *            传感器编码
     * @return Map<String,Object>
     */
    @ApiOperation(value = "测温柜告警信息", response = BusiWcgVo.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "warningId", value = "告警ID"),
            @ApiImplicitParam(name = "sensorCode", value = "传感器编码")
    })
    @GetMapping(value = "/getCwgInfo")
    public Map<String, Object> getCwgInfo(@RequestParam("warningId") String warningId,
                                          @RequestParam("sensorCode") String sensorCode) {
        BusiWcgVo vo = busiSubPageService.getCwgInfo(warningId, sensorCode);
        return ResultUtil.put(ConstantUtil.REQUEST_SUCCESS, "", vo);
    }
}
