package com.huatek.busi.controller;

import java.util.Map;

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.service.gis.GisSF6ThresholdService;
import com.huatek.busi.vo.GisSf6ThresholdVo;
import com.huatek.busi.vo.warning.BusiGisSf6Vo;
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;
/**
 * SF6告警及阈值
 * @author buck_guo
 * @date 2019/08/21
 */
@Api(tags = {Tags.SF_WARNNING_THRESHOLD})
@RestController
@RequestMapping("/app/sf6WarnningAndThreshold")
public class SF6WarnningAndThresholdController {

    @Reference(check = false)
    private BusiSubPageService busiSubPageService;

    @Reference(check = false)
    private GisSF6ThresholdService gisSF6ThresholdService;

    @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);
    }

    /**
     * 查询GIS SD6阈值查询
     *
     * @param sensorCode
     * @return
     */
    @ApiOperation(value = "查询GIS SD6阈值查询", response = GisSf6ThresholdVo.class)
    @GetMapping(value = "/findGisSF6Threshold", produces = {"application/json;charset=utf-8"})
    public Map<String, Object> findGisSF6Threshold(@RequestParam(value = "sensorCode") String sensorCode) {
        GisSf6ThresholdVo gisSF6ThresholdVo = gisSF6ThresholdService.queryGisSF6Threshold(sensorCode);
        return ResultUtil.put(ConstantUtil.REQUEST_SUCCESS, "", gisSF6ThresholdVo);
    }
}
