package com.njcn.harmonic.controller.specialanalysis;

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.RMpInfluenceParam;
import com.njcn.harmonic.pojo.vo.RStatOrgWfIndexOverviewVO;
import com.njcn.harmonic.service.specialanalysis.WindFarmIndexOverview;
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.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;

/**
 * 专项分析-风电场-指标总览
 *
 * @author yzh
 * @date 2022/11/30
 */
@RestController
@RequestMapping("/windFarmIndexOverview")
@Slf4j
@Api(tags = "专项分析-指标总览")
@RequiredArgsConstructor
public class WindFarmIndexOverviewController extends BaseController {

    private final WindFarmIndexOverview windFarmIndexOverview;

    /**
     * 获取风电场指标总览-谐波电流
     *
     * @param param 条件参数
     * @return com.njcn.common.pojo.response.HttpResult<java.util.List < com.njcn.harmonic.pojo.vo.RMpPvPowerDetailVO>>
     * @author yzh
     * @date 2022/11/30
     */
    @PostMapping("/getHarmonicCurrent")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("获取指标总览-谐波电流")
    @ApiImplicitParam(name = "param", value = "条件参数", required = true)
    public HttpResult<List<RStatOrgWfIndexOverviewVO>> getHarmonicCurrent(@RequestBody RMpInfluenceParam param) {
        String methodDescribe = getMethodDescribe("getHarmonicCurrent");
        List<RStatOrgWfIndexOverviewVO> list = windFarmIndexOverview.getHarmonicCurrent(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }

    /**
     * 获取风电场指标总览-谐波电压
     *
     * @param param 条件参数
     * @return com.njcn.common.pojo.response.HttpResult<java.util.List < com.njcn.harmonic.pojo.vo.RMpPvPowerDetailVO>>
     * @author yzh
     * @date 2022/11/30
     */
    @PostMapping("/getHarmonicVoltage")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("获取指标总览-谐波电压")
    @ApiImplicitParam(name = "param", value = "条件参数", required = true)
    public HttpResult<List<RStatOrgWfIndexOverviewVO>> getHarmonicVoltage(@RequestBody RMpInfluenceParam param) {
        String methodDescribe = getMethodDescribe("getHarmonicVoltage");
        List<RStatOrgWfIndexOverviewVO> list = windFarmIndexOverview.getHarmonicVoltage(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }

    /**
     * 获取风电场指标总览-各单位电流
     *
     * @param param 条件参数
     * @return com.njcn.common.pojo.response.HttpResult<java.util.List < com.njcn.harmonic.pojo.vo.RStatOrgWfIndexOverviewVO>>
     * @author yzh
     * @date 2022/11/30
     */
    @PostMapping("/getUnitCurrent")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("获取指标总览-各单位电流")
    @ApiImplicitParam(name = "param", value = "条件参数", required = true)
    public HttpResult<List<RStatOrgWfIndexOverviewVO>> getUnitCurrent(@RequestBody RMpInfluenceParam param) {
        String methodDescribe = getMethodDescribe("getUnitCurrent");
        List<RStatOrgWfIndexOverviewVO> list = windFarmIndexOverview.getUnitCurrent(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }

    /**
     * 获取风电场指标总览-各单位电压
     *
     * @param param 条件参数
     * @return com.njcn.common.pojo.response.HttpResult<java.util.List < com.njcn.harmonic.pojo.vo.RStatOrgWfIndexOverviewVO>>
     * @author yzh
     * @date 2022/12/1
     */
    @PostMapping("/getUnitVoltage")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("获取指标总览-各单位电压")
    @ApiImplicitParam(name = "param", value = "条件参数", required = true)
    public HttpResult<List<RStatOrgWfIndexOverviewVO>> getUnitVoltage(@RequestBody RMpInfluenceParam param) {
        String methodDescribe = getMethodDescribe("getUnitVoltage");
        List<RStatOrgWfIndexOverviewVO> list = windFarmIndexOverview.getUnitVoltage(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }
}
