package com.njcn.harmonic.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.harmonic.pojo.param.RStatHarmonicMParam;
import com.njcn.harmonic.pojo.vo.*;
import com.njcn.harmonic.service.majornetwork.RStatHarmonicMService;
import com.njcn.harmonic.service.majornetwork.RStatHarmonicQService;
import com.njcn.harmonic.service.majornetwork.RStatHarmonicYService;
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.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author rui.wu
 * @since 2022-10-09
 */
@RestController
@RequiredArgsConstructor
@Api(tags = "主网指标分类概览-监测点分类总览")
@RequestMapping("/harmonic/rStatHarmonic")
public class RStatHarmonicController extends BaseController {

    private final RStatHarmonicMService rStatHarmonicMService;
    private final RStatHarmonicQService rStatHarmonicQService;
    private final RStatHarmonicYService rStatHarmonicYService;

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

    /**
     * 电铁-频率偏差-电压统计图
     */
    @GetMapping("/getRStatHarmonicIconVoltage")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("稳态电铁-频率偏差-电压统计图")
    public HttpResult<List<RIconVO>> getRStatHarmonicIconVoltage(RStatHarmonicMParam param) {
        String methodDescribe = getMethodDescribe("getRStatHarmonicIconVoltage");
        List<RIconVO> rStatHarmonicIcon = rStatHarmonicMService.getRStatHarmonicIconVoltage(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rStatHarmonicIcon, methodDescribe);
    }

    /**
     * 电铁-频率偏差-电压统计图
     */
    @GetMapping("/getRStatHarmonicIconDate")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("主网稳态指标每日统计图")
    public HttpResult<List<RHarmonicPolylineVO>> getRStatHarmonicIconDate(RStatHarmonicMParam param) {
        String methodDescribe = getMethodDescribe("getRStatHarmonicIconDate");
        List<RHarmonicPolylineVO> rStatHarmonicIcon = rStatHarmonicMService.getRStatHarmonicIconDate(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rStatHarmonicIcon, methodDescribe);
    }


}

