告警信息查询 确认接口新增
This commit is contained in:
parent
3226f6e156
commit
04d19d8dfa
@ -1,11 +1,15 @@
|
|||||||
package com.das.modules.data.domain;
|
package com.das.modules.data.domain;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class DeviceEventInfo {
|
public class DeviceEventInfo {
|
||||||
private Long updateTime;
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
|
private Long eventTime;
|
||||||
|
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long eventId;
|
private Long eventId;
|
||||||
|
|
||||||
private Integer eventType;
|
private Integer eventType;
|
||||||
@ -18,6 +22,7 @@ public class DeviceEventInfo {
|
|||||||
|
|
||||||
private String confirmAccount;
|
private String confirmAccount;
|
||||||
|
|
||||||
|
@JsonSerialize(using = ToStringSerializer.class)
|
||||||
private Long confirmTime;
|
private Long confirmTime;
|
||||||
|
|
||||||
private String deviceId;
|
private String deviceId;
|
||||||
|
@ -393,7 +393,7 @@ public class TDEngineService {
|
|||||||
sb.append("','");
|
sb.append("','");
|
||||||
sb.append(dv.getDeviceName());
|
sb.append(dv.getDeviceName());
|
||||||
sb.append("') values (");
|
sb.append("') values (");
|
||||||
sb.append(dv.getUpdateTime());
|
sb.append(dv.getEventTime());
|
||||||
sb.append(",");
|
sb.append(",");
|
||||||
sb.append(dv.getEventId());
|
sb.append(dv.getEventId());
|
||||||
sb.append(",");
|
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());
|
log.debug(sb.toString());
|
||||||
try (Connection conn = hikariDataSource.getConnection();
|
try (Connection conn = hikariDataSource.getConnection();
|
||||||
Statement smt = conn.createStatement();
|
Statement smt = conn.createStatement();
|
||||||
ResultSet rs = smt.executeQuery(sb.toString())) {
|
ResultSet rs = smt.executeQuery(sb.toString())) {
|
||||||
while (rs.next()) {
|
while (rs.next()) {
|
||||||
DeviceEventInfo deviceEventInfo = new DeviceEventInfo();
|
DeviceEventInfo deviceEventInfo = new DeviceEventInfo();
|
||||||
deviceEventInfo.setUpdateTime(rs.getLong("event_time"));
|
deviceEventInfo.setEventTime(rs.getLong("event_time"));
|
||||||
deviceEventInfo.setDeviceId(rs.getString("event_id"));
|
deviceEventInfo.setEventId(rs.getLong("event_id"));
|
||||||
deviceEventInfo.setEventLevel(rs.getInt("event_level"));
|
deviceEventInfo.setEventLevel(rs.getInt("event_level"));
|
||||||
deviceEventInfo.setEventType(rs.getInt("event_type"));
|
deviceEventInfo.setEventType(rs.getInt("event_type"));
|
||||||
deviceEventInfo.setEventText(rs.getString("event_text"));
|
deviceEventInfo.setEventText(rs.getString("event_text"));
|
||||||
@ -658,7 +658,7 @@ public class TDEngineService {
|
|||||||
sb.append("insert into e_");
|
sb.append("insert into e_");
|
||||||
sb.append(deviceEventInfo.getDeviceId());
|
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(" 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(",");
|
||||||
sb.append(deviceEventInfo.getEventId());
|
sb.append(deviceEventInfo.getEventId());
|
||||||
sb.append(",");
|
sb.append(",");
|
||||||
|
@ -46,7 +46,8 @@ public class EventController {
|
|||||||
* @param deviceEventInfo 确认信息
|
* @param deviceEventInfo 确认信息
|
||||||
*/
|
*/
|
||||||
@PostMapping("/confirm")
|
@PostMapping("/confirm")
|
||||||
public void confirmEvent(@RequestBody DeviceEventInfo deviceEventInfo){
|
public R<Void> confirmEvent(@RequestBody DeviceEventInfo deviceEventInfo){
|
||||||
eventService.confirmEvent(deviceEventInfo);
|
eventService.confirmEvent(deviceEventInfo);
|
||||||
|
return R.success();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,7 @@ public class NodeMessageServiceImpl implements NodeMessageService {
|
|||||||
for (DeviceEventVo item : list){
|
for (DeviceEventVo item : list){
|
||||||
DeviceInfoCache deviceInfoCache = cacheService.getEquipmentCache().getDeviceInfoCacheById(Long.valueOf(item.getDeviceId()));
|
DeviceInfoCache deviceInfoCache = cacheService.getEquipmentCache().getDeviceInfoCacheById(Long.valueOf(item.getDeviceId()));
|
||||||
DeviceEventInfo deviceEventInfo = new DeviceEventInfo();
|
DeviceEventInfo deviceEventInfo = new DeviceEventInfo();
|
||||||
deviceEventInfo.setUpdateTime(item.getEventTime());
|
deviceEventInfo.setEventTime(item.getEventTime());
|
||||||
deviceEventInfo.setEventId(IdWorker.getId());
|
deviceEventInfo.setEventId(IdWorker.getId());
|
||||||
deviceEventInfo.setDeviceId(item.getDeviceId());
|
deviceEventInfo.setDeviceId(item.getDeviceId());
|
||||||
deviceEventInfo.setDeviceName(deviceInfoCache.getDeviceName());
|
deviceEventInfo.setDeviceName(deviceInfoCache.getDeviceName());
|
||||||
|
Loading…
Reference in New Issue
Block a user