package com.jiayue.ipfcst.dataexchange.controller;

import com.jiayue.ipfcst.common.core.web.vo.ResponseVO;
import com.jiayue.ipfcst.dataexchange.container.ProtocolDataContainer;
import com.jiayue.ipfcst.dataexchange.service.ProtocolGatherDataPointService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/protocolDataContainer")
public class ProtocolDataContainerController {

  ProtocolDataContainer protocolDataContainer = ProtocolDataContainer.getInstance();
  @Autowired ProtocolGatherDataPointService protocolGatherDataPointService;

  @GetMapping
  public ResponseVO realTimeData(){
    try {
      Map map = protocolDataContainer.realTimeData();
      return ResponseVO.success(map);
    } catch (Exception e) {
      e.printStackTrace();
      log.error("采集点表实时数据列查询异常");
      return ResponseVO.fail();
    }
  }
}
