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

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.vo.gw.MonitorEnergy;
import com.njcn.device.pms.service.gwPush.MonitorStatisticsService;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@RestController
@RequestMapping("/monitorStatistics")
@Api(tags = "台账类国网上送监测点统计")
@RequiredArgsConstructor
public class MonitorStatisticsController extends BaseController {

    private final MonitorStatisticsService monitorStatisticsService;

    @PostMapping("/objType")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("查询主网用户分类")
    public HttpResult< List<List<String>>> objType(String deptId,Integer up){
        String methodDescribe = getMethodDescribe("objType");
        List<List<String>> gwMonitorStatistics = monitorStatisticsService.getGwMonitorStatistics(deptId,up);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, gwMonitorStatistics, methodDescribe);
    }

    @PostMapping("/objTypeStatis")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("查询主网用户分类")
    public HttpResult< List<List<String>>> objTypeStatis(String deptId){
        String methodDescribe = getMethodDescribe("objTypeStatis");
        List<List<String>> gwMonitorStatistics = monitorStatisticsService.objTypeStatistic(deptId);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, gwMonitorStatistics, methodDescribe);
    }

    @PostMapping("/energy")
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @ApiOperation("新能源场站监测率")
    public HttpResult<List<MonitorEnergy>> energy(String deptId){
        String methodDescribe = getMethodDescribe("energy");
        List<MonitorEnergy> gwMonitorEnergy = monitorStatisticsService.getGwMonitorEnergy(deptId);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, gwMonitorEnergy, methodDescribe);
    }
}
