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.device.biz.pojo.dto.PollutionLineDTO;
import com.njcn.harmonic.pojo.param.PVOverviewParam;
import com.njcn.harmonic.service.majornetwork.PVOverviewService;
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;

/**
 * @author wr
 * @date 2023/5/10 9:25
 */
@RestController
@RequiredArgsConstructor
@Api(tags = "冀北分布式光伏-主网监测点")
@RequestMapping("/JbOverview")
public class PVOverviewController extends BaseController {

    private final PVOverviewService pvOverviewService;

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getPVSynthesisCount")
    @ApiOperation("冀北分布式光伏获取综合统计")
    public HttpResult<List<Integer>> getPVSynthesisCount(@RequestBody StatisticsBizBaseParam param) {
        String methodDescribe = getMethodDescribe("getPVSynthesisCount");
        List<Integer> pvSynthesisCount = pvOverviewService.getPVSynthesisCount(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pvSynthesisCount, methodDescribe);
    }

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getPVPollution")
    @ApiOperation("冀北分布式光伏获取污染指数统计")
    public HttpResult<List<PollutionLineDTO.PVPollution>> getPVPollution(@RequestBody PVOverviewParam param) {
        String methodDescribe = getMethodDescribe("getPVPollution");
        List<PollutionLineDTO.PVPollution> pvPollution = pvOverviewService.getPVPollution(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pvPollution, methodDescribe);
    }



}
