package com.njcn.harmonic.controller.distribution;


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.RArrayVO;
import com.njcn.harmonic.pojo.vo.RHarmonicPolylineVO;
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.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 配网指标分类概览-监测点分类总览
 * </p>
 *
 * @author wr
 * @since 2022-10-09
 */
@RestController
@RequiredArgsConstructor
@Api(tags = "配网指标分类概览-监测点分类总览")
@RequestMapping("/harmonic/pwRStatHarmonic")
public class PwRStatHarmonicController extends BaseController {

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

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


    /**
     * 监测点-频率偏差-电压统计图
     */
    @PostMapping("/getPwRStatHarmonicIconDate")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("稳态监测点-频率偏差-越线日期统计图")
    @ApiImplicitParam(name = "param", value = "越线日期统计参数", required = true)
    public HttpResult<List<RHarmonicPolylineVO>> getPwRStatHarmonicIconDate(@RequestBody RStatHarmonicMParam param) {
        String methodDescribe = getMethodDescribe("getPwRStatHarmonicIconDate");
        List<RHarmonicPolylineVO> rStatHarmonicIcon = rStatHarmonicMService.getPwRStatHarmonicIconDate(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rStatHarmonicIcon, methodDescribe);
    }

}

