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.SteadyQualifyCensusVO;
import com.njcn.harmonic.pojo.vo.SteadyQualifyDetailVO;
import com.njcn.harmonic.pojo.vo.SteadyQualifyVO;
import com.njcn.harmonic.service.SteadyQualifyService;
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/03/30 19:18
 */
@Validated
@Slf4j
@RestController
@RequestMapping("/steadyQualify")
@Api(tags = "稳态合格率统计")
@AllArgsConstructor
public class SteadyQualifyController extends BaseController {

    private final SteadyQualifyService steadyQualifyService;

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getSteadyQualifyData")
    @ApiOperation("稳态合格率列表")
    @ApiImplicitParam(name = "steadyParam", value = "稳态列表参数", required = true)
    public HttpResult<List<SteadyQualifyVO>> getSteadyQualifyData(@RequestBody @Validated DeviceInfoParam.BusinessParam steadyParam){
        String methodDescribe = getMethodDescribe("getSteadyQualifyData");
        List<SteadyQualifyVO> list = steadyQualifyService.getSteadyQualifyData(steadyParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getSteadyQualifyCensus")
    @ApiOperation("稳态合格率图表")
    @ApiImplicitParam(name = "steadyCensusParam", value = "稳态列表参数", required = true)
    public HttpResult<SteadyQualifyCensusVO> getSteadyQualifyCensus(@RequestBody @Validated DeviceInfoParam.BusinessParam steadyCensusParam){
        String methodDescribe = getMethodDescribe("getSteadyQualifyCensus");
        SteadyQualifyCensusVO censusVO = steadyQualifyService.getSteadyQualifyCensus(steadyCensusParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, censusVO, methodDescribe);
    }


    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getEnterpriseSteadyQualify")
    @ApiOperation("企业级稳态合格率图表")
    @ApiImplicitParam(name = "steadyParam", value = "稳态列表参数", required = true)
    public HttpResult<List<SteadyQualifyVO>> getEnterpriseSteadyQualify(@RequestBody @Validated DeviceInfoParam.BusinessParam steadyParam){
        String methodDescribe = getMethodDescribe("getEnterpriseSteadyQualify");
        List<SteadyQualifyVO> list = steadyQualifyService.getEnterpriseSteadyQualify(steadyParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getSteadyQualifyTableData")
    @ApiOperation("稳态合格率列表(曲靖)")
    @ApiImplicitParam(name = "steadyParam", value = "稳态列表参数", required = true)
    public HttpResult<List<SteadyQualifyDetailVO>> getSteadyQualifyTableData(@RequestBody @Validated DeviceInfoParam.BusinessParam steadyParam){
        String methodDescribe = getMethodDescribe("getSteadyQualifyTableData");
        List<SteadyQualifyDetailVO> list = steadyQualifyService.getSteadyQualifyTableData(steadyParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }

}
