package com.njcn.device.pms.controller.distribution;

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.device.pms.pojo.dto.PwPmsMonitorDTO;
import com.njcn.device.pms.pojo.param.PwPmsMonitorParam;
import com.njcn.device.pms.service.distribution.IPwMonitorService;
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 lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author yzh
 * @date 2022/10/28
 */

@RestController
@RequestMapping("/pms/pwMonitor")
@Slf4j
@Api(tags = "配网监测点信息")
@RequiredArgsConstructor
public class PwMonitorController extends BaseController {

    private final IPwMonitorService iPwMonitorService;



    /**
     * 获取配网所有监测点信息
     *
     * @param pwPmsMonitorParam 参数条件
     * @return 配网所有监测点信息
     */
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getPwMonitorList")
    @ApiOperation("获取配网所有监测点信息")
    @ApiImplicitParam(name = "pwPmsMonitorParam",value = "获取配网所有监测点信息条件",required = true)
    public HttpResult<List<PwPmsMonitorDTO>> getPwMonitorList(@RequestBody @Validated PwPmsMonitorParam pwPmsMonitorParam) {
        String methodDescribe = getMethodDescribe("getPwMonitorList");
        List<PwPmsMonitorDTO> monitorList = iPwMonitorService.getPwMonitorList(pwPmsMonitorParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, monitorList, methodDescribe);
    }

    /**
     * 获取配网所有监测点信息(新)
     *
     * @param pwPmsMonitorParam 参数条件
     * @return 配网所有监测点信息
     */
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getPwNewMonitorList")
    @ApiOperation("获取配网所有监测点信息(新)")
    @ApiImplicitParam(name = "pwPmsMonitorParam",value = "获取配网所有监测点信息条件",required = true)
    public HttpResult<List<PwPmsMonitorDTO>> getPwNewMonitorList(@RequestBody @Validated PwPmsMonitorParam pwPmsMonitorParam) {
        String methodDescribe = getMethodDescribe("getPwNewMonitorList");
        List<PwPmsMonitorDTO> monitorList = iPwMonitorService.getPwNewMonitorList(pwPmsMonitorParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, monitorList, methodDescribe);
    }

    /**
     * 获取配网所有监测点信息
     *
     * @param pwPmsMonitorParam 参数条件
     * @return 配网所有监测点信息
     */
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getPwSubsetMonitorList")
    @ApiOperation("获取子集配网所有监测点信息")
    @ApiImplicitParam(name = "pwPmsMonitorParam",value = "获取子集配网所有监测点信息条件",required = true)
    public HttpResult<List<PwPmsMonitorDTO>> getPwSubsetMonitorList(@RequestBody @Validated PwPmsMonitorParam pwPmsMonitorParam) {
        String methodDescribe = getMethodDescribe("getPwSubsetMonitorList");
        List<PwPmsMonitorDTO> monitorList = iPwMonitorService.getPwSubsetMonitorList(pwPmsMonitorParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, monitorList, methodDescribe);

    }


    /**
     * 获取分布式光伏配网所有监测点信息
     *
     * @param pwPmsMonitorParam 参数条件
     * @return 配网所有监测点信息
     */
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getPwPhotovoltaicMonitorList")
    @ApiOperation("获取分布式光伏配网所有监测点信息")
    @ApiImplicitParam(name = "pwPmsMonitorParam",value = "获取分布式光伏配网所有监测点信息",required = true)
    public HttpResult<List<PwPmsMonitorDTO>> getPwPhotovoltaicMonitorList(@RequestBody @Validated PwPmsMonitorParam pwPmsMonitorParam) {
        String methodDescribe = getMethodDescribe("getPwPhotovoltaicMonitorList");
        List<PwPmsMonitorDTO> monitorList = iPwMonitorService.getPwPhotovoltaicMonitorList(pwPmsMonitorParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, monitorList, methodDescribe);
    }
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getPVCompositeIndicators")
    @ApiOperation("冀北分布式光伏获取综合指标")
    public HttpResult<List<List<Integer>>> getPVCompositeIndicators(@RequestBody StatisticsBizBaseParam param) {
        String methodDescribe = getMethodDescribe("getPVCompositeIndicators");
        List<List<Integer>> compositeIndicators = iPwMonitorService.getCompositeIndicators(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, compositeIndicators, methodDescribe);
    }



}
