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

import cn.hutool.core.collection.CollectionUtil;
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.dto.MonitorLimitDTO;
import com.njcn.device.pms.pojo.dto.PmsGeneralDeviceDTO;
import com.njcn.device.pms.pojo.dto.PushMonitorDTO;
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam;
import com.njcn.device.pms.pojo.param.PmsMonitorQueryParam;
import com.njcn.device.pms.service.gwPush.GwMonitorPushService;
import com.njcn.web.controller.BaseController;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
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;

import java.util.List;

/**
 * pqs
 * 台账国网推送
 *
 * @author cdf
 * @date 2023/12/11
 */
@Slf4j
@Api(tags = "台账国网推送")
@RestController
@RequestMapping("/gwTerminalPush")
@RequiredArgsConstructor
public class GwMonitorPushController extends BaseController {

    private final GwMonitorPushService gwMonitorPushService;


    /**
     * 推送主网监测点
     *
     * @author cdf
     * @date 2023/12/11
     */
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/pushMonitor")
    @ApiOperation("推送主网监测点")
    @ApiImplicitParam(name = "ids", value = "主网监测点id集合", required = true)
    public HttpResult<Object> pushMonitor(@RequestBody List<String> ids) {
        String methodDescribe = getMethodDescribe("pushMonitor");
        String msg = gwMonitorPushService.pushMonitor(ids);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, msg, methodDescribe);
    }




    /**
     * 推送监测点限值台账数据接口
     * @author cdf
     * @date 2023/12/13
     */
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/pushMonitorOverLimit")
    @ApiOperation("推送主网监测点限值")
    @ApiImplicitParam(name = "ids", value = "主网监测点id集合", required = true)
    public HttpResult<Object> pushMonitorOverLimit(@RequestBody List<String> ids) {
        String methodDescribe = getMethodDescribe("pushMonitorOverLimit");
        String msg = gwMonitorPushService.pushMonitorOverLimit(ids);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, msg, methodDescribe);
    }

    /**
     * 推送监测点限值台账数据接口
     * @author cdf
     * @date 2023/12/13
     */
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/queryMonitorOverLimit")
    @ApiOperation("查询主网监测点限值")
    @ApiImplicitParam(name = "baseParam", value = "请求体", required = true)
    public HttpResult<Page<MonitorLimitDTO>> queryMonitorOverLimit(@RequestBody PmsMonitorQueryParam baseParam) {
        String methodDescribe = getMethodDescribe("queryMonitorOverLimit");
        Page<MonitorLimitDTO> page = gwMonitorPushService.queryMonitorOverLimit(baseParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
    }

}
