package com.njcn.event.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.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.event.pojo.param.EventMonitorReportParam;
import com.njcn.event.pojo.vo.*;
import com.njcn.event.common.service.EventMonitorReportService;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 暂态指标监测点统计报表
 * @Title EventMonitorDailyReportController
 * @Package com.njcn.event.controller
 * @Author jianghaifei
 * @Date 2022-10-25 09:36
 * @Version V1.0
 */
@RestController
@RequestMapping("/eventMonitorReport")
@Api(tags = "主网-暂态指标统计报表")
@RequiredArgsConstructor
public class EventMonitorReportController extends BaseController {

    private final EventMonitorReportService eventMonitorReportService;

    /***
     * @author jianghaifei
     * @date 2022-10-29 16:37
     * @param eventMonitorReportParam
     * @return com.njcn.common.pojo.response.HttpResult<java.util.List<com.njcn.event.pojo.vo.EventMonitorReportVO>>
     */
    @PostMapping("getMonitorEventCount")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("监测点暂态事件发生次数")
    public HttpResult<List<EventMonitorReportVO>> getMonitorEventCount(@RequestBody EventMonitorReportParam eventMonitorReportParam) {
        String methodDescribe = getMethodDescribe("getMonitorEventCount");
        List<EventMonitorReportVO> list = eventMonitorReportService.getMonitorEventCount(eventMonitorReportParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }

    /***
     *
     * @author jianghaifei
     * @date 2022-10-29 14:08
     * @param eventMonitorReportParam
     * @return com.njcn.common.pojo.response.HttpResult<com.njcn.event.pojo.vo.EventDipShortDistributionVO>
     */
    @PostMapping("getEventDipShortDistribution")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("暂态指标监测点电压暂降和短时中断分布情况")
    public HttpResult<List<EventDipShortDistributionTableVO>> getEventDipShortDistribution(@RequestBody EventMonitorReportParam eventMonitorReportParam) {
        String methodDescribe = getMethodDescribe("getEventDipShortDistribution");
        List<EventDipShortDistributionTableVO> list = eventMonitorReportService.getEventDipShortDistributionByCond(eventMonitorReportParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }

    /***
     *
     * @author jianghaifei
     * @date 2022-10-29 14:08
     * @param eventMonitorReportParam
     * @return com.njcn.common.pojo.response.HttpResult<com.njcn.event.pojo.vo.EventRiseDistributionVO>
     */
    @PostMapping("getEventRiseDistribution")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("暂态指标监测点电压暂升分布情况")
    public HttpResult<List<EventRiseDistributionTableVO>> getEventRiseDistribution(@RequestBody EventMonitorReportParam eventMonitorReportParam) {
        String methodDescribe = getMethodDescribe("getEventRiseDistribution");
        List<EventRiseDistributionTableVO> list = eventMonitorReportService.getEventRiseDistributionByCond(eventMonitorReportParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }



}
