package com.njcn.harmonic.controller.majornetwork;


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.vo.RSubstationIcon2VO;
import com.njcn.harmonic.pojo.vo.RSubstationIconVO;
import com.njcn.harmonic.pojo.vo.RVoltageIconVO;
import com.njcn.harmonic.service.majornetwork.RStatSubstationMService;
import com.njcn.harmonic.service.majornetwork.RStatSubstationVoltageMService;
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-18
 */
@RestController
@RequiredArgsConstructor
@Api(tags = "主网指标分类概览-变电站分类总览")
@RequestMapping("/harmonic/rStatSubstation")
public class RStatSubstationController extends BaseController {

    private final RStatSubstationMService rStatSubstationMService;
    private final RStatSubstationVoltageMService rStatSubstationVoltageMService;

    /**
     * 变电站稳态指标超标分布（按超标天数）
     */
    @GetMapping("/getAllRStatSubstationIconDays")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("变电站稳态指标超标分布（按超标天数）")
    public HttpResult<RSubstationIconVO> getAllRStatSubstationIconDays(StatisticsBizBaseParam param) {
        String methodDescribe = getMethodDescribe("getAllRStatSubstationIconDays");
        RSubstationIconVO statSubstationIcon = rStatSubstationMService.getStatSubstationIcon(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, statSubstationIcon, methodDescribe);
    }

    /**
     * 变电站稳态指标超标分布（按电压等级）
     */
    @GetMapping("/getAllRStatSubstationIconVoltage")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("变电站稳态指标超标分布（按电压等级）")
    public HttpResult<List<RVoltageIconVO>> getAllRStatSubstationIconVoltage(StatisticsBizBaseParam param) {
        String methodDescribe = getMethodDescribe("getAllRStatSubstationIconVoltage");
        List<RVoltageIconVO> statSubstationIcon = rStatSubstationVoltageMService.getStatSubstationIcon(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, statSubstationIcon, methodDescribe);
    }


    /**
     * 变电站稳态指标平均超标天数
     */
    @GetMapping("/getAllRStatSubstationIconAvgDays")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("变电站稳态指标平均超标天数")
    public HttpResult<List<RSubstationIcon2VO>> getAllRStatSubstationIconAvgDays(StatisticsBizBaseParam param) {
        String methodDescribe = getMethodDescribe("getAllRStatSubstationIconAvgDays");
        List<RSubstationIcon2VO> statSubstationIcon = rStatSubstationMService.getStatSubstationIcon2(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, statSubstationIcon, methodDescribe);
    }
}

