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.device.pq.pojo.param.DeviceInfoParam;
import com.njcn.harmonic.pojo.vo.ComAssessVO;
import com.njcn.harmonic.service.ComAssessService;
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.extern.slf4j.Slf4j;
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 java.util.List;

/**
 * @version 1.0.0
 * @author chenchao
 * @date 2022/04/21 09:05
 * 对应菜单 谐波系统-区域-电能质量评估
 */
@Validated
@Slf4j
@RestController
@RequestMapping("/comAccess")
@Api(tags = "稳态综合评估")
@AllArgsConstructor
public class ComAssessController extends BaseController {

    private final ComAssessService comAssessService;

    @OperateInfo(info = LogEnum.BUSINESS_COMMON)
    @PostMapping("/getComAccessData")
    @ApiOperation("稳态综合评估统计")
    @ApiImplicitParam(name = "comAccessParam", value = "综合评估参数", required = true)
    public HttpResult<List<ComAssessVO>> getComAccessData(@RequestBody @Validated DeviceInfoParam.BusinessParam comAccessParam){
        String methodDescribe = getMethodDescribe("getComAccessData");
        List<ComAssessVO> comAssessVOList = comAssessService.getComAccessData(comAccessParam);
        return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, comAssessVOList, methodDescribe);
    }

}
