package com.njcn.harmonic.controller.majornetwork;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
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.device.pms.pojo.param.pwUser.PwUserMonitorParam;
import com.njcn.harmonic.pojo.param.RStatLimitQueryParam;
import com.njcn.harmonic.pojo.po.day.RStatLimitTargetDPO;
import com.njcn.harmonic.pojo.vo.MonitorLimitRateVO;
import com.njcn.harmonic.pojo.vo.PwLimitDataVO;
import com.njcn.harmonic.pojo.vo.RStatLimitTargetVO;
import com.njcn.harmonic.service.majornetwork.RStatLimitService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * pqs
 *
 * @author cdf
 * @date 2024/2/28
 */
@RestController
@RequiredArgsConstructor
@Api(tags = "主网指标检测点超标明细")
@RequestMapping("/limitRateD")
public class RStatLimitController extends BaseController {

    private final RStatLimitService rStatLimitService;


    @PostMapping("/monitorIdsGetLimitTargetInfo")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("获取指定日期超标监测点详细信息")
    public HttpResult<List<RStatLimitTargetDPO>> monitorIdsGetLimitTargetInfo(@RequestBody RStatLimitQueryParam rStatLimitQueryParam) {
        String methodDescribe = getMethodDescribe("monitorIdsGetLimitTargetInfo");
        List<RStatLimitTargetDPO> result = rStatLimitService.monitorIdsGetLimitTargetInfo(rStatLimitQueryParam.getDate(),rStatLimitQueryParam.getIds());
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }

    @PostMapping("/monitorOverLimitDays")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("按日期查询监测点各指标越限天数")
    public HttpResult<List<RStatLimitTargetVO>> monitorOverLimitDays(@RequestBody RStatLimitQueryParam rStatLimitQueryParam) {
        String methodDescribe = getMethodDescribe("monitorOverLimitDays");
        List<RStatLimitTargetVO> result = rStatLimitService.monitorOverLimitDays(rStatLimitQueryParam.getDate(),rStatLimitQueryParam.getEndDate(),rStatLimitQueryParam.getIds());
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }



    @PostMapping("/pwMonitorLimitData")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("获取配网指标超标详情")
    public HttpResult<Page<MonitorLimitRateVO>> pwMonitorLimitData(@RequestBody @Validated PwUserMonitorParam pwUserMonitorParam){
        String methodDescribe = getMethodDescribe("pwMonitorLimitData");
        Page<MonitorLimitRateVO> page = rStatLimitService.pwMonitorLimitData(pwUserMonitorParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
    }


    @PostMapping("/pwMonitorLimitDataRange")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("获取配网指标超标详情")
    public HttpResult<List<PwLimitDataVO>> pwMonitorLimitDataRange(@RequestBody @Validated PwUserMonitorParam pwUserMonitorParam){
        String methodDescribe = getMethodDescribe("pwMonitorLimitDataRange");
        List<PwLimitDataVO> page = rStatLimitService.pwMonitorLimitDataRange(pwUserMonitorParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
    }

}
