重构报警SSE推送
This commit is contained in:
@@ -13,18 +13,15 @@ import java.util.Set;
|
||||
@Data
|
||||
public class DeviceAlarm {
|
||||
|
||||
/**
|
||||
* 数据库id
|
||||
*/
|
||||
@Schema(description = "数据库id")
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 设备Id
|
||||
*/
|
||||
@Schema(description = "设备的国标编号")
|
||||
private String deviceId;
|
||||
|
||||
@Schema(description = "设备名称")
|
||||
private String deviceName;
|
||||
|
||||
/**
|
||||
* 通道Id
|
||||
*/
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
package com.genersoft.iot.vmp.gb28181.bean;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class SSEMessage<T> {
|
||||
private String event;
|
||||
private T data;
|
||||
|
||||
public static SSEMessage<DeviceAlarm> getInstance(String event, DeviceAlarm data) {
|
||||
SSEMessage<DeviceAlarm> message = new SSEMessage<>();
|
||||
message.setEvent(event);
|
||||
message.setData(data);
|
||||
return message;
|
||||
}
|
||||
|
||||
public String ecode(){
|
||||
return String.format("event:%s\ndata:%s\n", event, JSONObject.toJSONString(data));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user