package com.njcn.harmonic.controller.distribution;


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.param.StatisticsBizBaseParam;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.harmonic.pojo.param.RStatOrgParam;
import com.njcn.harmonic.pojo.param.StatSubstationBizBaseParam;
import com.njcn.harmonic.pojo.vo.*;
import com.njcn.harmonic.service.distribution.PwRStatOrgService;
import com.njcn.harmonic.service.majornetwork.*;
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.*;

import java.util.List;


/**
 * <p>
 * 区域分类统计月表 前端控制器
 * </p>
 *
 * @author rui.wu
 * @since 2022-10-17
 */
@RestController
@RequiredArgsConstructor
@Api(tags = "配网指标-稳态指标")
@RequestMapping("/harmonic/pwRStatOrg")
public class PwRStatOrgController extends BaseController {

    private final PwRStatOrgService pwRStatOrgService;
    private final RMpPartHarmonicDetailDService rMpPartHarmonicDetailDService;


    /**
     * 查询配网区域超标统计
     */
    @PostMapping("/getPwAllRStatHarmonicOrg")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("区域超标统计")
    @ApiImplicitParam(name = "param", value = "超标参数", required = true)
    public HttpResult<List<RStatOrgVO.PwRStatOrgVO>> getPwAllRStatHarmonicOrg(@RequestBody StatSubstationBizBaseParam param) {
        String methodDescribe = getMethodDescribe("getPwAllRStatHarmonicOrg");
        List<RStatOrgVO.PwRStatOrgVO> rStatHarmonicAll = pwRStatOrgService.getRStatHarmonicAll(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rStatHarmonicAll, methodDescribe);
    }


    /**
     * 配网区域稳态指标超标分类统计表
     */
    @PostMapping("/getPwRStatSubstation")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("区域稳态指标超标分类统计表")
    @ApiImplicitParam(name = "param", value = "超标分类参数", required = true)
    public HttpResult<List<RStatSubstationOrg2VO.PwRStatSubstationOrgVO>> getPwRStatSubstation(@RequestBody StatSubstationBizBaseParam param) {
        String methodDescribe = getMethodDescribe("getPwRStatSubstation");
        List<RStatSubstationOrg2VO.PwRStatSubstationOrgVO> statSubstationIcon = pwRStatOrgService.getRStatSubstationOrg(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, statSubstationIcon, methodDescribe);
    }

    /**
     * 配网稳态指标超标明细表
     */
    @PostMapping("/getPwRMpPartHarmonicDetail")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("稳态指标超标明细表")
    @ApiImplicitParam(name = "param", value = "超标明细参数", required = true)
    public HttpResult<Page<RMpPartHarmonicDetailVO.PwRMpPartHarmonicDetailDVO>> getPwRMpPartHarmonicDetail(@RequestBody RStatOrgParam.PwRStatOrgParam param) {
        String methodDescribe = getMethodDescribe("getPwRMpPartHarmonicDetail");
        Page<RMpPartHarmonicDetailVO.PwRMpPartHarmonicDetailDVO> rMpPartHarmonicDetail = pwRStatOrgService.getRMpPartHarmonicDetail(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rMpPartHarmonicDetail, methodDescribe);
    }

    /**
     * 配网稳态指标超标明细表-指标趋势图
     */
    @PostMapping("/getRMpPartHarmonicDetailIcon")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("稳态指标超标明细表-指标趋势图")
    @ApiImplicitParam(name = "param", value = "超标指标趋势参数", required = true)
    public HttpResult<List<RMpPartHarmonicDetailIconVO>> getRMpPartHarmonicDetailIcon(@RequestBody StatisticsBizBaseParam param) {
        String methodDescribe = getMethodDescribe("getRMpPartHarmonicDetailIcon");
        List<RMpPartHarmonicDetailIconVO> rMpPartHarmonicDetail = rMpPartHarmonicDetailDService.getRMpPartHarmonicDetailIcon(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rMpPartHarmonicDetail, methodDescribe);
    }

    /**
     * 配网区域稳态指标合格率统计表-配网（稳态指标合格率统计）
     */
    @PostMapping("/getPwRStatOrgIndex")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("区域稳态指标合格率统计表")
    @ApiImplicitParam(name = "param", value = "超标合格率统计参数", required = true)
    public HttpResult<List<PwRStatOrgVO>> getPwRStatOrgIndex(@RequestBody StatSubstationBizBaseParam param) {
        String methodDescribe = getMethodDescribe("getPwRStatOrgIndex");
        List<PwRStatOrgVO> rStatOrg = pwRStatOrgService.getRStatOrgIndex(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rStatOrg, methodDescribe);
    }

    /**
     * 区域稳态指标合格率统计表-配网（稳态指标合格率统计）
     */
    @PostMapping("/getPwRMpPassRateInfo")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("配网稳态指标合格率明细表")
    @ApiImplicitParam(name = "param", value = "超标合格率明细参数", required = true)
    public HttpResult<Page<PwRStatOrgVO.PwRStatOrgDetailVO>> getPwRMpPassRateInfo(@RequestBody RStatOrgParam.PwRStatOrgParam param) {
        String methodDescribe = getMethodDescribe("getPwRMpPassRateInfo");
        Page<PwRStatOrgVO.PwRStatOrgDetailVO> rStatOrg = pwRStatOrgService.getRMpPassRateInfo(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rStatOrg, methodDescribe);
    }

    /**
     * 变电站稳态指标超标分类统计表
     */
    @PostMapping("/getPwRStatSubstationOrg")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("变电站稳态指标超标分类统计表")
    public HttpResult<List<RSubstationIcon2VO.RSubstationInfoVO>> getRStatSubstationOrg(@RequestBody StatSubstationBizBaseParam param
    ) {
        String methodDescribe = getMethodDescribe("getRStatSubstationOrg");
        List<RSubstationIcon2VO.RSubstationInfoVO> rStatOrg = pwRStatOrgService.getRStatSubstation(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rStatOrg, methodDescribe);
    }

}

