package com.usky.meeting.controller.web;


import com.usky.common.core.bean.ApiResult;
import com.usky.meeting.domain.MeetingDeviceHeartbeat;
import com.usky.meeting.service.MeetingDeviceHeartbeatService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 会议设备心跳表 前端控制器
 * </p>
 *
 * @author fu
 * @since 2025-11-13
 */
@RestController
@RequestMapping("/meetingDeviceHeartbeat")
public class MeetingDeviceHeartbeatController {
    private static final Logger log = LoggerFactory.getLogger(MeetingDeviceHeartbeatController.class);
    @Autowired
    private MeetingDeviceHeartbeatService heartbeatService;

    @PostMapping("/escalation")
    public ApiResult<Void> heartbeatEscalation(@RequestBody MeetingDeviceHeartbeat heartbeat) {
        try {
            heartbeatService.heartbeatEscalation(heartbeat);
        } catch (Exception e) {
            log.error("设备心跳异常", e);
            return ApiResult.error("设备心跳入库异常！");
        }
        return ApiResult.success();
    }
}

