package com.njcn.product.device.ledger.controller;

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.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.common.utils.LogUtil;

import com.njcn.product.device.ledger.pojo.vo.LineDetailDataVO;
import com.njcn.product.device.ledger.service.LineService;
import com.njcn.product.device.overlimit.pojo.Overlimit;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

import java.util.List;
import java.util.Map;
import java.util.Objects;

/**
 * @author denghuajun
 * @date 2022/2/23
 * 监测点相关
 */
@Slf4j
@Api(tags = "监测点管理")
@RestController
@RequestMapping("/line")
@RequiredArgsConstructor
public class LineController extends BaseController {

    private final LineService lineService;



    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getLineDetailData")
    @ApiOperation("根据监测点id获取监测点详情")
    @ApiImplicitParam(name = "id", value = "监测点id", required = true)
    public HttpResult<LineDetailDataVO> getLineDetailData(@RequestParam("id") String id) {
        String methodDescribe = getMethodDescribe("getLineDetailData");
        LineDetailDataVO result = lineService.getLineDetailData(id);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }



    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getOverLimitData")
    @ApiOperation("根据监测点id获取越限数值")
    @ApiImplicitParam(name = "id", value = "监测点id", required = true)
    public HttpResult<Overlimit> getOverLimitData(@RequestParam("id") String id) {
        String methodDescribe = getMethodDescribe("getOverLimitData");
        Overlimit result = lineService.getOverLimitData(id);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
    }





}
