重构报警SSE推送

This commit is contained in:
648540858
2024-10-29 15:57:52 +08:00
parent caf9e99939
commit 5304620861
10 changed files with 94 additions and 92 deletions

View File

@@ -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
*/

View File

@@ -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));
}
}