package com.njcn.csharmonic.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.csharmonic.param.CommonStatisticalQueryParam;
import com.njcn.csharmonic.param.FrequencyStatisticalQueryParam;
import com.njcn.csharmonic.param.ThdDataQueryParm;
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
import com.njcn.csharmonic.service.StableDataService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
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.*;

import java.util.List;

/**
 * Description:
 * Date: 2023/5/18  8:51【需求编号】
 *
 * @author clam
 * @version V1.0.0
 */
@Slf4j
@RestController
@RequestMapping("/stable")
@Api(tags = "稳态数据展示")
@AllArgsConstructor
public class StableDataController extends BaseController {

    private final StableDataService stableDataService;

//
//    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
//    @PostMapping("/queryFisrtThdData")
//    @ApiOperation("查询谐波畸变率实时数据")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "devId", value = "设备id", required = true),
//            @ApiImplicitParam(name = "statisticalName", value = "统计指标name", required = true)
//    })
//    public HttpResult<List<ThdDataVO>> queryFisrtThdData(@RequestParam("devId") String devId, @RequestParam("statisticalName") String statisticalName) {
//        String methodDescribe = getMethodDescribe("queryThdData");
//        List<ThdDataVO> list = stableDataService.queryThdData(devId, statisticalName);
//        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
//    }
//
//    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
//    @PostMapping("/queryThdDataByTime")
//    @ApiOperation("查询时间段内谐波畸变率")
//    @ApiImplicitParam(name = "thdDataQueryParm", value = "查询参数", required = true)
//    public HttpResult<List<ThdDataVO>> queryThdDataByTime(@RequestBody @Validated ThdDataQueryParm thdDataQueryParm) {
//        String methodDescribe = getMethodDescribe("queryThdDataByTime");
//        List<ThdDataVO> list = stableDataService.queryThdDataByTime(thdDataQueryParm);
//        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
//
//    }
//
//    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
//    @PostMapping("/queryFisrtThdContent")
//    @ApiOperation("查询谐波含量实时数据")
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "devId", value = "设备id", required = true),
//            @ApiImplicitParam(name = "statisticalName", value = "统计指标name", required = true)
//    })
//    public HttpResult<List<ThdDataVO>> queryFisrtThdContent(@RequestParam("devId") String devId, @RequestParam("statisticalName") String statisticalName) {
//        String methodDescribe = getMethodDescribe("queryFisrtThdContent");
//        List<ThdDataVO> list = stableDataService.queryFisrtThdContent(devId, statisticalName);
//        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
//    }
//
//    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
//    @PostMapping("/queryThdContentByTime")
//    @ApiOperation("查询时间段内谐波畸变率")
//    @ApiImplicitParam(name = "thdDataQueryParm", value = "查询参数", required = true)
//    public HttpResult<List<ThdDataVO>> queryThdContentByTime(@RequestBody @Validated ThdDataQueryParm thdDataQueryParm) {
//        String methodDescribe = getMethodDescribe("queryThdContentByTime");
//        List<ThdDataVO> list = stableDataService.queryThdContentByTime(thdDataQueryParm);
//        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
//
//    }
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/queryFisrtCommonStatistical")
    @ApiOperation("查询实时数据")
    public HttpResult<List<ThdDataVO>> queryFisrtCommonStatistical(@RequestBody CommonStatisticalQueryParam commonStatisticalQueryParam) {
        String methodDescribe = getMethodDescribe("queryFisrtCommonStatistical");
        List<ThdDataVO> result = stableDataService.queryFisrtCommonStatistical(commonStatisticalQueryParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/queryCommonStatisticalByTime")
    @ApiOperation("查询时间段实时数据")
    public HttpResult<List<ThdDataVO>> queryCommonStatisticalByTime(@RequestBody CommonStatisticalQueryParam commonStatisticalQueryParam) {
        String methodDescribe = getMethodDescribe("queryFisrtCommonStatistical");
        List<ThdDataVO> result = stableDataService.queryCommonStatisticalByTime(commonStatisticalQueryParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }

//    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
//    @PostMapping("/queryLineCommonStatistical")
//    @ApiOperation("多监测点数据比较")
//    public HttpResult<List<ThdDataVO>> queryLineCommonStatistical(@RequestBody CommonStatisticalQueryParam commonStatisticalQueryParam) {
//        String methodDescribe = getMethodDescribe("queryFisrtCommonStatistical");
//        List<ThdDataVO> result = stableDataService.queryLineCommonStatistical(commonStatisticalQueryParam);
//        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
//    }

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/QuerySqlData")
    @ApiOperation("查询(2-50)的指标")
    @ApiImplicitParam(name = "frequencyStatisticalQueryParam", value = "查询参数", required = true)
    public HttpResult<List<ThdDataVO>> QuerySqlData(@RequestBody FrequencyStatisticalQueryParam frequencyStatisticalQueryParam) {
        String methodDescribe = getMethodDescribe("queryFisrtCommonStatistical");
        List<ThdDataVO> thdDataVOList = stableDataService.QuerySqlData(frequencyStatisticalQueryParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, thdDataVOList, methodDescribe);
    }


}