package org.nl.acs.monitor.rest;

import com.alibaba.fastjson.JSONArray;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.nl.acs.monitor.service.DeviceStageMonitorService;
import org.nl.common.logging.annotation.Log;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
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;

/**
 * @Author: lyd
 * @Description: 设备信息
 * @Date: 2022-08-17
 */
@Slf4j
@RestController
@RequiredArgsConstructor
@Api(tags = "设备信息")
@RequestMapping("/api/deviceInfo")
public class DeviceStageMonitorController {

    private final DeviceStageMonitorService deviceStageMonitorService;

    @Log("获取舞台设备信息")
    @ApiOperation("获取舞台设备信息")
    @PostMapping("/getDeviceByCodes")
    public ResponseEntity<Object> getDeviceByCodes(@RequestBody String json) throws Exception {
        JSONArray jsonArray = JSONArray.parseArray(json);
        return new ResponseEntity<>(deviceStageMonitorService.getData(jsonArray), HttpStatus.OK);
    }
}
