package com.njcn.device.pq.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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.device.biz.pojo.po.Overlimit;
import com.njcn.device.pq.pojo.param.AlarmStrategyParam;
import com.njcn.device.pq.pojo.vo.AlarmStrategyVO;
import com.njcn.device.pq.service.AlarmStrategyService;
import com.njcn.device.pq.service.IOverLimitService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
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.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * 监测点限值
 * @author cdf
 * @date 2023/6/7
 */
@Slf4j
@RestController
@RequestMapping("/overLimit")
@Api(tags = "监测点限值")
@RequiredArgsConstructor
public class OverLimitController extends BaseController {

    private final IOverLimitService iOverLimitService;



    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getOverLimitByLineIds")
    @ApiOperation("监测点集合获取限值")
    @ApiImplicitParam(name = "lineIds", value = "监测点ids", required = true)
    @ApiIgnore
    public HttpResult<List<Overlimit>> getOverLimitByLineIds(@RequestBody List<String> lineIds){
        String methodDescribe = getMethodDescribe("getOverLimitByLineIds");
        List<Overlimit> overLimitList= iOverLimitService.list(new LambdaQueryWrapper<Overlimit>().in(Overlimit::getId,lineIds));
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, overLimitList, methodDescribe);
    }


    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getLimitMapsByLineIds")
    @ApiOperation("监测点集合获取限值")
    @ApiImplicitParam(name = "lineIds", value = "监测点ids", required = true)
    @ApiIgnore
    public HttpResult<List<Map<String, Object>>> getLimitMapsByLineIds(@RequestBody List<String> lineIds){
        String methodDescribe = getMethodDescribe("getLimitMapsByLineIds");
        List<Map<String, Object>> overLimitList= iOverLimitService.listMaps(new LambdaQueryWrapper<Overlimit>().in(Overlimit::getId,lineIds));
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, overLimitList, methodDescribe);
    }

}
