package com.rongwei.savecheck.controller;

import com.rongwei.rwcommon.base.R;
import com.rongwei.sfcommon.sys.service.DataXApiService;
import lombok.extern.slf4j.Slf4j;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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.HashMap;
import java.util.Map;

/**
 * 数据眼接口
 */
@RestController
@RequestMapping("dataXApi")
@Slf4j
public class DataXApiController {

    private static final Logger logger = LoggerFactory.getLogger(MobileApiController.class);
    @Autowired
    private DataXApiService dataXApiService;

    /**
     * 大屏预警灯显示接口
     *
     * @return
     */
    @GetMapping("/getWarnLevel")
    public R getWarnLevel() {
        try {
            Integer warnLevel = dataXApiService.getWarnLevel();
            Map<String, Object> map = new HashMap<>();
            map.put("warnLevel", warnLevel);
            return R.ok(map);
        } catch (Exception e) {
            e.printStackTrace();
            logger.error(e.getMessage());
            return R.error();
        }
    }

}
