package com.njcn.harmonic.controller.specialanalysis;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.PowerQualityParam;
import com.njcn.harmonic.pojo.vo.RMpPvPowerDetailVO;
import com.njcn.harmonic.service.specialanalysis.DistributedPvVolOverService;
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;


/**
 * 专项分析-分布式光伏-电压越限分析
 *
 * @author yzh
 * @date 2022/11/15
 */
@RestController
@RequestMapping("/distributedPvVolOver")
@Slf4j
@Api(tags = "专项分析-分布式光伏")
@RequiredArgsConstructor
public class DistributedPvVolOverController extends BaseController {

    private final DistributedPvVolOverService distributedPvVolOverService;

    /**
     * 获取电压越限分析
     *
     * @param param 条件参数
     * @return com.njcn.common.pojo.response.HttpResult<java.util.List < ?>>
     * @author yzh
     * @date 2022/11/22
     */
    @PostMapping("/getVoltageOutOfLimitAnalysis")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("获取分布式光伏电压越限分析")
    @ApiImplicitParam(name = "param", value = "条件参数", required = true)
    public HttpResult<Page<RMpPvPowerDetailVO>> getVoltageOutOfLimitAnalysis(@RequestBody PowerQualityParam param) {
        String methodDescribe = getMethodDescribe("getVoltageOutOfLimitAnalysis");
        Page<RMpPvPowerDetailVO> list = distributedPvVolOverService.getVoltageOutOfLimitAnalysis(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }
}
