package com.njcn.harmonic.controller.dim;

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.harmonic.pojo.param.DimGlobalDataParam;
import com.njcn.harmonic.pojo.vo.DimGlobalDataStandVO;
import com.njcn.harmonic.pojo.vo.DimGlobalDataVO;
import com.njcn.harmonic.service.dim.DimGlobalDealService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
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;

/**
 * pqs
 *
 * @author cdf
 * @date 2023/11/27
 */
@RestController
@RequestMapping("/dimGlobal")
@Slf4j
@Api(tags = "pms电能质量指标综合")
@RequiredArgsConstructor
public class DimGlobalDealController extends BaseController {

    private final DimGlobalDealService dimGlobalDealService;

    /**
     *
     * @author cdf
     * @date 2023/11/27
     */
    @PostMapping("/dealGlobalData")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("pms电能质量指标综合")
    @ApiImplicitParam(name = "dimGlobalDataParam", value = "条件参数", required = true)
    public HttpResult<List<DimGlobalDataVO>> dealGlobalData(@RequestBody @Validated DimGlobalDataParam dimGlobalDataParam){
        String methodDescribe = getMethodDescribe("dealGlobalData");
        List<DimGlobalDataVO> result = dimGlobalDealService.dealGlobalData(dimGlobalDataParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }


    /**
     * **电压等级**指标标准差
     * @author cdf
     * @date 2023/12/1
     */
    @PostMapping("/standardDeviation")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("**电压等级**指标标准差")
    @ApiImplicitParam(name = "dimGlobalDataParam", value = "条件参数", required = true)
    public HttpResult<List<DimGlobalDataStandVO>> standardDeviation(@RequestBody @Validated DimGlobalDataParam dimGlobalDataParam){
        String methodDescribe = getMethodDescribe("dealGlobalData");
        List<DimGlobalDataStandVO> result = dimGlobalDealService.standardDeviation(dimGlobalDataParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }
}
