package com.njcn.csharmonic.controller;

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.csharmonic.pojo.vo.TemperatureVO;
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
import com.njcn.csharmonic.service.TemperatureService;
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
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.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * Description:
 * Date: 2023/8/29  20:03【需求编号】
 *
 * @author clam
 * @version V1.0.0
 */
@Slf4j
@RestController
@RequestMapping("/temperature")
@Api(tags = "温度数据展示")
@AllArgsConstructor
public class TemperatureController extends BaseController {
    private final TemperatureService temperatureService;
    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/queryTemperature")
    @ApiOperation("查询谐波畸变率实时数据")
    @ApiImplicitParams(
            @ApiImplicitParam(name = "devId", value = "设备id", required = true))
    public HttpResult<List<StatisticalDataDTO>> queryTemperature(@RequestParam("devId") String devId) {
        String methodDescribe = getMethodDescribe("queryTemperature");
        List<StatisticalDataDTO> list = temperatureService.queryTemperature(devId);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }

}
