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.RStatOrgPvDetailVO;
import com.njcn.harmonic.pojo.vo.RStatOrgPvPowerStreamVO;
import com.njcn.harmonic.service.specialanalysis.RStatOrgPvPowerQualityService;
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 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 wr
 * @createTime 2022-11-25
 */
@RestController
@RequestMapping("/distributedPvVolOver")
@Api(tags = "专项分析-分布式光伏")
@RequiredArgsConstructor
public class RStatOrgPvPowerQualityController extends BaseController {

    private final RStatOrgPvPowerQualityService rStatOrgPvPowerQualityService;


    /**
     * 低功率因数统计
     *
     */
    @PostMapping("/getPowerQualityStream")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("低功率因数统计")
    @ApiImplicitParam(name = "param", value = "分页查询参数", required = true)
    public HttpResult<Page<RStatOrgPvPowerStreamVO>> getPowerQualityStream(@RequestBody PowerQualityParam param) {
        String methodDescribe = getMethodDescribe("getPowerQualityStream");
        Page<RStatOrgPvPowerStreamVO> powerQualityStream = rStatOrgPvPowerQualityService.getPowerQualityStream(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, powerQualityStream, methodDescribe);
    }

    /**
     * 详细数据表分页查询
     *
     */
    @PostMapping("/getPowerQualityInfo")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("详细数据表分页查询")
    @ApiImplicitParam(name = "param", value = "分页查询参数", required = true)
    public HttpResult<Page<RStatOrgPvDetailVO>> getPowerQualityInfo(@RequestBody PowerQualityParam.PowerQualityDetailInfoParam param) {
        String methodDescribe = getMethodDescribe("getPowerQualityInfo");
        Page<RStatOrgPvDetailVO> powerQualityInfo = rStatOrgPvPowerQualityService.getPowerQualityInfo(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, powerQualityInfo, methodDescribe);
    }

}
