package com.huatek.busi.controller.cable;

import com.alibaba.dubbo.config.annotation.Reference;
import com.huatek.busi.constant.ApiConstant;
import com.huatek.busi.dto.cable.BusiOtherThresholdDto;
import com.huatek.busi.service.IBusiCableThresholdService;
import com.huatek.busi.service.cable.BusiOtherThresholdService;
import com.huatek.busi.vo.cable.BusiOtherThresholdVo;
import com.huatek.torch.frame.tools.ConstantUtil;
import com.huatek.torch.frame.tools.ResultUtil;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 其他阈值控制层
 *
 * @author Bobi_huo
 * @date 2020-09-16 10:57
 */
@Api(tags = {ApiConstant.Tags.BUSI_OTHER_THRESHOLD})
@Slf4j
@RestController
@RequestMapping("/api/busiOtherThreshold")
public class BusiOtherThresholdController {

    @Reference(check = false)
    private BusiOtherThresholdService busiOtherThresholdService;

    /**
     * 根据状态查询阈值
     *
     * @param dto
     * @return
     */
    @PostMapping(value = "/find", produces = {"application/json;charset=utf-8"})
    public Map<String, Object> findOtherThreshold(@RequestBody BusiOtherThresholdDto dto) {
        return busiOtherThresholdService.findOtherVo(dto);
    }

    /**
     * 根据状态查询阈值
     *
     * @param dto
     * @return
     */
    @PostMapping(value = "/getGrowthRate", produces = {"application/json;charset=utf-8"})
    public Map<String, Object> getGrowthRate(@RequestBody BusiOtherThresholdDto dto) {
        return busiOtherThresholdService.getGrowthRate(dto);
    }



    /**
     * 添加、编辑阈值
     *
     * @param token
     * @param dto
     * @return
     */
    @PostMapping(value = "/saveOtherThreshold", produces = {"application/json;charset=utf-8"})
    public Map<String, Object> saveOtherThreshold(@RequestHeader("token") String token, @RequestBody BusiOtherThresholdDto dto) {
        return busiOtherThresholdService.saveOtherThreshold(token, dto);
    }


    /**
     * 删除阈值
     *

     * @param dto
     * @return
     */
    @PostMapping(value = "/deleteOtherThreshold", produces = {"application/json;charset=utf-8"})
    public Map<String, Object> deleteOtherThreshold(@RequestBody BusiOtherThresholdDto dto) {
        return busiOtherThresholdService.deleteOtherThreshold(dto);
    }
}
