告警信息查询 确认接口新增

This commit is contained in:
huguanghan 2024-11-05 14:53:08 +08:00
parent 3226f6e156
commit 04d19d8dfa
4 changed files with 14 additions and 8 deletions

View File

@ -1,11 +1,15 @@
package com.das.modules.data.domain;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import lombok.Data;
@Data
public class DeviceEventInfo {
private Long updateTime;
@JsonSerialize(using = ToStringSerializer.class)
private Long eventTime;
@JsonSerialize(using = ToStringSerializer.class)
private Long eventId;
private Integer eventType;
@ -18,6 +22,7 @@ public class DeviceEventInfo {
private String confirmAccount;
@JsonSerialize(using = ToStringSerializer.class)
private Long confirmTime;
private String deviceId;

View File

@ -393,7 +393,7 @@ public class TDEngineService {
sb.append("','");
sb.append(dv.getDeviceName());
sb.append("') values (");
sb.append(dv.getUpdateTime());
sb.append(dv.getEventTime());
sb.append(",");
sb.append(dv.getEventId());
sb.append(",");
@ -627,15 +627,15 @@ public class TDEngineService {
}
}
}
sb.append(" order by t.updatetime");
sb.append(" order by t.event_time");
log.debug(sb.toString());
try (Connection conn = hikariDataSource.getConnection();
Statement smt = conn.createStatement();
ResultSet rs = smt.executeQuery(sb.toString())) {
while (rs.next()) {
DeviceEventInfo deviceEventInfo = new DeviceEventInfo();
deviceEventInfo.setUpdateTime(rs.getLong("event_time"));
deviceEventInfo.setDeviceId(rs.getString("event_id"));
deviceEventInfo.setEventTime(rs.getLong("event_time"));
deviceEventInfo.setEventId(rs.getLong("event_id"));
deviceEventInfo.setEventLevel(rs.getInt("event_level"));
deviceEventInfo.setEventType(rs.getInt("event_type"));
deviceEventInfo.setEventText(rs.getString("event_text"));
@ -658,7 +658,7 @@ public class TDEngineService {
sb.append("insert into e_");
sb.append(deviceEventInfo.getDeviceId());
sb.append(" USING event_info (device_id)TAGS (null) (event_time,event_id,confirmed,confirm_account,confirm_time) VALUES (");
sb.append(deviceEventInfo.getUpdateTime());
sb.append(deviceEventInfo.getEventTime());
sb.append(",");
sb.append(deviceEventInfo.getEventId());
sb.append(",");

View File

@ -46,7 +46,8 @@ public class EventController {
* @param deviceEventInfo 确认信息
*/
@PostMapping("/confirm")
public void confirmEvent(@RequestBody DeviceEventInfo deviceEventInfo){
public R<Void> confirmEvent(@RequestBody DeviceEventInfo deviceEventInfo){
eventService.confirmEvent(deviceEventInfo);
return R.success();
}
}

View File

@ -301,7 +301,7 @@ public class NodeMessageServiceImpl implements NodeMessageService {
for (DeviceEventVo item : list){
DeviceInfoCache deviceInfoCache = cacheService.getEquipmentCache().getDeviceInfoCacheById(Long.valueOf(item.getDeviceId()));
DeviceEventInfo deviceEventInfo = new DeviceEventInfo();
deviceEventInfo.setUpdateTime(item.getEventTime());
deviceEventInfo.setEventTime(item.getEventTime());
deviceEventInfo.setEventId(IdWorker.getId());
deviceEventInfo.setDeviceId(item.getDeviceId());
deviceEventInfo.setDeviceName(deviceInfoCache.getDeviceName());