package com.njcn.event.controller.majornetwork;


import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.BizParamConstant;
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.event.pojo.param.REventMParam;
import com.njcn.event.pojo.param.StatSubstationBizBaseParam;
import com.njcn.event.pojo.vo.*;
import com.njcn.event.service.majornetwork.RStatEventMService;
import com.njcn.event.service.majornetwork.RStatEventQService;
import com.njcn.event.service.majornetwork.RStatEventYService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
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-09
 */
@RestController
@RequiredArgsConstructor
@Api(tags = "主网指标分类概览-监测点分类总览")
@RequestMapping("/event/rStatHarmonic")
public class RStatEventController extends BaseController {

    private final RStatEventYService rStatEventYService;
    private final RStatEventQService rStatEventQService;
    private final RStatEventMService rStatEventMService;


    /**
     * 查询查询监测点稳态指标 日/月点数
     */
    @GetMapping("/getAllRStatEvent")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("查询暂态累计超标监测点数")
    public HttpResult<List<RArrayVO>> getAllRStatEvent(StatisticsBizBaseParam param) {
        String methodDescribe = getMethodDescribe("getAllRStatHarmonic");
        List<RArrayVO> rStatHarmonicMAll = null;
        String string = param.getType().toString();
        switch (string) {
            //查询超标监测点数-年数据
            case BizParamConstant.STAT_BIZ_YEAR:
                rStatHarmonicMAll = rStatEventYService.getRStatEventYAll(param);
                break;
            //查询超标监测点数-季数据
            case BizParamConstant.STAT_BIZ_QUARTER:
                rStatHarmonicMAll = rStatEventQService.getRStatEventQAll(param);
                break;
            //查询超标监测点数-月数据
            case BizParamConstant.STAT_BIZ_MONTH:
                rStatHarmonicMAll = rStatEventMService.getRStatEventMAll(param);
                break;
            default:
                break;
        }
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rStatHarmonicMAll, methodDescribe);
    }

    /**
     * 暂态按电压等级统计图
     */
    @GetMapping("/getRStatHarmonicIconVoltage")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("暂态电铁-频率偏差-电压统计图")
    public HttpResult<List<RStatEventMVO>> getRStatHarmonicIconVoltage(REventMParam param) {
        String methodDescribe = getMethodDescribe("getRStatHarmonicIconVoltage");
        List<RStatEventMVO> rStatHarmonicIcon = rStatEventMService.getRStatHarmonicIcon(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rStatHarmonicIcon, methodDescribe);
    }


    /**
     * 暂态电铁-频率偏差-电压统计图
     */
    @GetMapping("/getRStatHarmonicIconDate")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("暂态电铁-频率偏差-越线日期统计图")
    public HttpResult<List<REventPolylineVO>> getRStatHarmonicIconDate(REventMParam param) {
        String methodDescribe = getMethodDescribe("getRStatHarmonicIconDate");
        List<REventPolylineVO> rStatHarmonicIcon = rStatEventMService.getRStatHarmonicIcon2(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rStatHarmonicIcon, methodDescribe);
    }

    /**
     * 区域暂态电能质量水平评估
     */
    @PostMapping("/getEventBenchmarkLevelList")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("区域暂态电能质量水平评估")
    public HttpResult<List<RStatEventMVO.Vo>> getEventBenchmarkLevelList(@RequestBody StatSubstationBizBaseParam param) {
        String methodDescribe = getMethodDescribe("getEventBenchmarkLevelList");
        List<RStatEventMVO.Vo> eventBenchmarkLevelList = rStatEventYService.getEventBenchmarkLevelList(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, eventBenchmarkLevelList, methodDescribe);
    }

}

