package com.njcn.harmonic.controller;

import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.harmonic.pojo.vo.SteadyExceedRateCensusVO;
import com.njcn.harmonic.pojo.vo.SteadyExceedRateVO;
import com.njcn.harmonic.service.SteadyExceedRateService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @version 1.0.0
 * @author chenchao
 * @date 2022/04/12 11:44
 */
@Validated
@Slf4j
@RestController
@RequestMapping("/steadyExceedRate")
@Api(tags = "稳态指标超标占比")
@AllArgsConstructor
public class SteadyExceedRateController extends BaseController {

    private final SteadyExceedRateService steadyExceedRateService;

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getSteadyExceedRateData")
    @ApiOperation("稳态超标占比列表")
    @ApiImplicitParam(name = "steadyExceedParam", value = "稳态超标占比参数", required = true)
    public HttpResult<List<SteadyExceedRateVO>> getSteadyExceedRateData(@RequestBody @Validated DeviceInfoParam.BusinessParam steadyExceedParam){
        String methodDescribe = getMethodDescribe("getSteadyExceedRateData");
        List<SteadyExceedRateVO> list = steadyExceedRateService.getSteadyExceedRateData(steadyExceedParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getSteadyExceedRateCensus")
    @ApiOperation("稳态超标占比图表")
    @ApiImplicitParam(name = "steadyExceedCensusParam", value = "稳态超标占比参数", required = true)
    public HttpResult<SteadyExceedRateCensusVO> getSteadyExceedRateCensus(@RequestBody @Validated DeviceInfoParam.BusinessParam steadyExceedCensusParam){
        String methodDescribe = getMethodDescribe("getSteadyExceedRateCensus");
        SteadyExceedRateCensusVO censusVO = steadyExceedRateService.getSteadyExceedRateCensus(steadyExceedCensusParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, censusVO, methodDescribe);
    }

}











