package com.njcn.prepare.harmonic.controller.line;

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.prepare.harmonic.pojo.param.LineParam;
import com.njcn.prepare.harmonic.service.mysql.line.NormalLimitService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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;

/**
 *  用于每天统计前一天异常监测点数据(需要在r_stat_limit_target_d数据后面执行)
 *  @author denghuajun
 * @version 1.0.0
 * @date 2022年10月17日 19:56
 */
@Slf4j
@RestController
@RequestMapping("/normalLimit")
@Api(tags = "告警数据预处理_mysql")
@AllArgsConstructor
public class NormalLimitController extends BaseController {

    private final NormalLimitService normLimitService;

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getNormLimitData")
    @ApiOperation("监测点告警数据预处理")
    public HttpResult<String> getNormLimitData(@RequestBody LineParam lineParam) {
        String methodDescribe = getMethodDescribe("getNormLimitData");
        normLimitService.abnormalLineData(lineParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
    }
}
