 package com.huatek.busi.controller;

import java.util.List;
import java.util.Map;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
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.dto.TransformerTgThresholdDto;
import com.huatek.busi.service.BusiSubPageService;
import com.huatek.busi.service.threshold.TransformerTgThresholdService;
import com.huatek.busi.vo.TransformerTgThresholdVo;
import com.huatek.busi.vo.warning.BusiIcgeVo;
import com.huatek.torch.frame.log.KerLog;
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;

/**
  * APP 套管告警阈值
  * @author buck_guo
  * @date 2019/08/20
  */
 @Api(tags = {Tags.BUSI_TG_SENSOR_THRESHOLD})
 @RestController
 @RequestMapping("/app/TransformerTgThreshold") 
 public class CasingWarnningAndThresholdController {
     @Reference(check = false)
     private TransformerTgThresholdService transformerTgThresholdService;

     @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> getCasingWarningInfo(@RequestParam("warningId") String warningId,
          @RequestParam("sensorCode") String sensorCode) {
//          BusiIcgeVo vo = busiSubPageService.getIcgeWarningInfo(warningId, sensorCode);
//          return ResultUtil.put(ConstantUtil.REQUEST_SUCCESS, "", vo);
          
          return null;
      }  
     /**
      * 根据变sensorCode、runState获取压器套管阈值
      * @param sensorCode
      * @param runState
      * @return
      */
     @ApiOperation(value = Tags.BUSI_TG_SENSOR_THRESHOLD_INFO)
     @KerLog(projectName = "PROJECTNAME", modelName = "TRANSFORMERTGTHRESHOLD.MODELNAME", methodName = "TRANSFORMERTGTHRESHOLD.METHODNAME.FINDTRANSFORMERTGTHRESHOLD")
     @PostMapping(value = "/findTgThreshold", produces = {"application/json;charset=utf-8"})
     public Map<String, Object>  findTgThreshold(@RequestParam("sensorCode") String sensorCode,@RequestParam("runState") String runState) {
         TransformerTgThresholdDto transformerTgThresholdDto = new TransformerTgThresholdDto();
         transformerTgThresholdDto.setSensorCode(sensorCode);
         transformerTgThresholdDto.setRunState(runState);
         TransformerTgThresholdVo transformerTgThreshold =transformerTgThresholdService.findTransformerTgThreshold(transformerTgThresholdDto);
         return ResultUtil.put(ConstantUtil.REQUEST_SUCCESS, "", transformerTgThreshold);
     }
     
     /**
      * 根据变sensorCode获取压器套管阈值
      * @param sensorCode
      * @param runState
      * @return
      */
     @ApiOperation(value = Tags.BUSI_TG_SENSOR_THRESHOLD_INFO_SENSORCODE)
     @KerLog(projectName = "PROJECTNAME", modelName = "TRANSFORMERTGTHRESHOLD.MODELNAME", methodName = "TRANSFORMERTGTHRESHOLD.METHODNAME.FINDTRANSFORMERTGTHRESHOLD")
     @PostMapping(value = "/findTgThresholdBysensorCode", produces = {"application/json;charset=utf-8"})
     public Map<String, Object>  findTgThresholdBysensorCode(@RequestParam("sensorCode") String sensorCode) {
         TransformerTgThresholdDto transformerTgThresholdDto = new TransformerTgThresholdDto();
         transformerTgThresholdDto.setSensorCode(sensorCode);
         List<TransformerTgThresholdVo> vo =transformerTgThresholdService.findTransformerTgThresholdList(transformerTgThresholdDto);
         return ResultUtil.put(ConstantUtil.REQUEST_SUCCESS, "", vo);
     }
}
