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


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.common.utils.LogUtil;
import com.njcn.device.pms.pojo.param.TerminalQueryParam;
import com.njcn.device.pms.pojo.param.pwUser.PwUserMonitorParam;
import com.njcn.device.pms.pojo.po.PmsTerminal;
import com.njcn.device.pms.pojo.vo.pwUser.PwUserMonitorDataVO;
import com.njcn.device.pms.service.ledgerManger.PwUserMonitorDataService;
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.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("pwUser")
@Api(tags = "配网用户侧数据")
@RequiredArgsConstructor
public class PwUserMonitorDataController extends BaseController {

    private final PwUserMonitorDataService pwUserMonitorDataService;


    /**
     * 获取配网用户侧监测点数据完整性
     */
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("getMonitorIntegrity")
    @ApiOperation("获取配网用户侧监测点数据完整性")
    @ApiImplicitParam(name = "pwUserMonitorParam",value = "请求头",required = true)
    public HttpResult<Page<PwUserMonitorDataVO>> getMonitorIntegrity(@RequestBody @Validated PwUserMonitorParam pwUserMonitorParam){
        String methodDescribe = getMethodDescribe("getMonitorIntegrity");
        Page<PwUserMonitorDataVO> page = pwUserMonitorDataService.pageIntegrityData(pwUserMonitorParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,page,methodDescribe);
    }


    /**
     * 获取配网用户装置在线率
     */
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("getPwDeviceOnline")
    @ApiOperation("获取配网用户侧监测点数据完整性")
    @ApiImplicitParam(name = "pwUserMonitorParam",value = "请求头",required = true)
    public HttpResult<Page<PwUserMonitorDataVO>> getPwDeviceOnline(@RequestBody @Validated PwUserMonitorParam pwUserMonitorParam){
        String methodDescribe = getMethodDescribe("getPwDeviceOnline");
        Page<PwUserMonitorDataVO> page = pwUserMonitorDataService.getPwDeviceOnline(pwUserMonitorParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,page,methodDescribe);
    }
}
