告警管理,告警日志接口。更改计算95值定时任务时间
This commit is contained in:
@@ -3,17 +3,43 @@ package com.ruoyi.system.api;
|
||||
import com.ruoyi.common.core.constant.SecurityConstants;
|
||||
import com.ruoyi.common.core.constant.ServiceNameConstants;
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.system.api.domain.RmAlarmRecordRemote;
|
||||
import com.ruoyi.system.api.factory.RemoteRocketMqFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@FeignClient(contextId = "remoteRocketMqService", value = ServiceNameConstants.ROCKETMQ_SERVICE, fallbackFactory = RemoteRocketMqFallbackFactory.class)
|
||||
public interface RemoteRocketMqService {
|
||||
|
||||
/**
|
||||
* 发送异步消息
|
||||
* @param topic
|
||||
* @param tag
|
||||
* @param key
|
||||
* @param value
|
||||
* @param source
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/api/rocketMessage/sendAsyncProducerMessage")
|
||||
public R<Map> sendAsyncProducerMessage(@RequestParam("topic") String topic, @RequestParam("tag") String tag, @RequestParam("key") String key, @RequestParam("value") String value, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 查询告警记录
|
||||
*
|
||||
* @param rmAlarmRecordRemote
|
||||
* @param source
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/alarmRecord/getAlarmList")
|
||||
public R<List<RmAlarmRecordRemote>> getAlarmList(@RequestBody RmAlarmRecordRemote rmAlarmRecordRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
|
||||
/**
|
||||
* 资源告警处理情况
|
||||
* @param source
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/alarmRecord/alarmHandlingStatus")
|
||||
public R<Map> alarmHandlingStatus(@RequestHeader(SecurityConstants.FROM_SOURCE) String source);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
package com.ruoyi.system.api.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 告警记录对象 rm_alarm_record
|
||||
*
|
||||
* @author gyt
|
||||
* @date 2025-09-12
|
||||
*/
|
||||
public class RmAlarmRecordRemote extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键ID */
|
||||
private Long id;
|
||||
|
||||
/** 客户端ID/设备ID */
|
||||
@Excel(name = "客户端ID/设备ID")
|
||||
private String clientId;
|
||||
|
||||
/** 资源名称 */
|
||||
@Excel(name = "资源名称")
|
||||
private String resourceName;
|
||||
|
||||
/** 源IP地址 */
|
||||
@Excel(name = "源IP地址")
|
||||
private String sourceIp;
|
||||
|
||||
/** 告警发生时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "告警发生时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date occurTime;
|
||||
|
||||
/** 告警详细内容 */
|
||||
@Excel(name = "告警详细内容")
|
||||
private String content;
|
||||
|
||||
/** 重复告警次数 */
|
||||
@Excel(name = "重复告警次数")
|
||||
private Long repeatCount;
|
||||
|
||||
/** 状态:0-未处理,1-已处理 */
|
||||
@Excel(name = "状态:0-未处理,1-已处理")
|
||||
private String status;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setClientId(String clientId)
|
||||
{
|
||||
this.clientId = clientId;
|
||||
}
|
||||
|
||||
public String getClientId()
|
||||
{
|
||||
return clientId;
|
||||
}
|
||||
|
||||
public void setResourceName(String resourceName)
|
||||
{
|
||||
this.resourceName = resourceName;
|
||||
}
|
||||
|
||||
public String getResourceName()
|
||||
{
|
||||
return resourceName;
|
||||
}
|
||||
|
||||
public void setSourceIp(String sourceIp)
|
||||
{
|
||||
this.sourceIp = sourceIp;
|
||||
}
|
||||
|
||||
public String getSourceIp()
|
||||
{
|
||||
return sourceIp;
|
||||
}
|
||||
|
||||
public void setOccurTime(Date occurTime)
|
||||
{
|
||||
this.occurTime = occurTime;
|
||||
}
|
||||
|
||||
public Date getOccurTime()
|
||||
{
|
||||
return occurTime;
|
||||
}
|
||||
|
||||
public void setContent(String content)
|
||||
{
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getContent()
|
||||
{
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setRepeatCount(Long repeatCount)
|
||||
{
|
||||
this.repeatCount = repeatCount;
|
||||
}
|
||||
|
||||
public Long getRepeatCount()
|
||||
{
|
||||
return repeatCount;
|
||||
}
|
||||
|
||||
public void setStatus(String status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("clientId", getClientId())
|
||||
.append("resourceName", getResourceName())
|
||||
.append("sourceIp", getSourceIp())
|
||||
.append("occurTime", getOccurTime())
|
||||
.append("content", getContent())
|
||||
.append("repeatCount", getRepeatCount())
|
||||
.append("status", getStatus())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,14 @@ package com.ruoyi.system.api.factory;
|
||||
|
||||
import com.ruoyi.common.core.domain.R;
|
||||
import com.ruoyi.system.api.RemoteRocketMqService;
|
||||
import com.ruoyi.system.api.domain.RmAlarmRecordRemote;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -33,6 +35,16 @@ public class RemoteRocketMqFallbackFactory implements FallbackFactory<RemoteRock
|
||||
errorMap.put("error", throwable.getMessage());
|
||||
return R.fail(errorMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<List<RmAlarmRecordRemote>> getAlarmList(RmAlarmRecordRemote rmAlarmRecordRemote, String source) {
|
||||
return R.fail(throwable.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<Map> alarmHandlingStatus(String source) {
|
||||
return R.fail(throwable.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user