package com.njcn.device.pq.controller;

/**
 * @Author: cdf
 * @CreateTime: 2025-04-29
 * @Description: 异常告警数据指标范围
 */

import com.njcn.algorithm.pojo.dto.PqReasonableRangeDto;
import com.njcn.algorithm.pojo.param.DataCleanParam;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
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.pq.service.ReasonableRangeService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Controller;
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 javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xy
 * @since 2025-02-13
 */
@Validated
@Slf4j
@Controller
@RestController
@RequestMapping("/pqReasonableRange")
@Api(tags = "数据清洗标准库")
public class ReasonableRangeController extends BaseController {

    @Resource
    private ReasonableRangeService pqReasonableRangeService;

    @OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.QUERY)
    @PostMapping("/getData")
    @ApiOperation("按条件获取数据合理范围")
    public HttpResult<List<PqReasonableRangeDto>> getData(@RequestBody DataCleanParam param) {
        String methodDescribe = getMethodDescribe("getData");
        List<PqReasonableRangeDto> list = pqReasonableRangeService.getReasonableRangeList(param);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }

}