package com.njcn.harmonic.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.harmonic.pojo.vo.TraceVO;
import com.njcn.harmonic.service.IHarmonicTraceService;
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.validation.annotation.Validated;
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;

/**
 * 类的介绍：谐波电流溯源(谐波源定位)
 *
 * @author xuyang
 * @version 1.0.0
 * @createTime 2024/1/5 14:37
 */
@Validated
@Slf4j
@RestController
@RequestMapping("/harmonicCurrent")
@Api(tags = "谐波源定位")
@AllArgsConstructor
public class HarmonicTraceController extends BaseController {
    private final IHarmonicTraceService harmonicTraceService;

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/trace")
    @ApiOperation("谐波电流溯源")
    @ApiImplicitParams({
        @ApiImplicitParam(name = "lineId", value = "监测点id", required = true),
        @ApiImplicitParam(name = "time", value = "时间", required = true)
    })
    public HttpResult<List<TraceVO>> getTraceData(@RequestParam("lineId") String lineId,@RequestParam("time") String time) {
        String methodDescribe = getMethodDescribe("getTraceData");
        List<TraceVO> list = harmonicTraceService.getTraceData(lineId,time);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
    }



}
