交换机管理,图形监控,策略

This commit is contained in:
gaoyutao
2025-10-11 17:54:17 +08:00
parent 6ffdf8d355
commit 054b0f1272
41 changed files with 1111 additions and 582 deletions
@@ -1,9 +1,11 @@
package com.ruoyi.system.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import lombok.Data;
import java.util.Date;
import java.util.List;
/**
* 交换机管理对象 rm_switch_management
@@ -11,6 +13,7 @@ import com.ruoyi.common.core.web.domain.BaseEntity;
* @author gyt
* @date 2025-10-10
*/
@Data
public class RmSwitchManagement extends BaseEntity
{
private static final long serialVersionUID = 1L;
@@ -36,8 +39,9 @@ public class RmSwitchManagement extends BaseEntity
/** 在线状态(0-离线,1-在线) */
@Excel(name = "在线状态(0-离线,1-在线)")
private Integer onlineStatus;
private String onlineStatus;
/** 上机时间 */
private Date upTime;
/** 心跳监测次数 */
@Excel(name = "心跳监测次数")
private Long heartbeatCount;
@@ -73,179 +77,7 @@ public class RmSwitchManagement extends BaseEntity
/** 密码 */
@Excel(name = "密码")
private String switchPassword;
/** 端口备注列表 */
private List<RmSwitchInterfaceInfo> switchInterfaceInfoList;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setSwitchName(String switchName)
{
this.switchName = switchName;
}
public String getSwitchName()
{
return switchName;
}
public void setHardwareSn(String hardwareSn)
{
this.hardwareSn = hardwareSn;
}
public String getHardwareSn()
{
return hardwareSn;
}
public void setSnmpAddress(String snmpAddress)
{
this.snmpAddress = snmpAddress;
}
public String getSnmpAddress()
{
return snmpAddress;
}
public void setSnmpPort(Long snmpPort)
{
this.snmpPort = snmpPort;
}
public Long getSnmpPort()
{
return snmpPort;
}
public void setOnlineStatus(Integer onlineStatus)
{
this.onlineStatus = onlineStatus;
}
public Integer getOnlineStatus()
{
return onlineStatus;
}
public void setHeartbeatCount(Long heartbeatCount)
{
this.heartbeatCount = heartbeatCount;
}
public Long getHeartbeatCount()
{
return heartbeatCount;
}
public void setHeartbeatInterval(Long heartbeatInterval)
{
this.heartbeatInterval = heartbeatInterval;
}
public Long getHeartbeatInterval()
{
return heartbeatInterval;
}
public void setHeartbeatOid(String heartbeatOid)
{
this.heartbeatOid = heartbeatOid;
}
public String getHeartbeatOid()
{
return heartbeatOid;
}
public void setSnmpVersion(String snmpVersion)
{
this.snmpVersion = snmpVersion;
}
public String getSnmpVersion()
{
return snmpVersion;
}
public void setReadWritePermission(String readWritePermission)
{
this.readWritePermission = readWritePermission;
}
public String getReadWritePermission()
{
return readWritePermission;
}
public void setSecurityLevel(String securityLevel)
{
this.securityLevel = securityLevel;
}
public String getSecurityLevel()
{
return securityLevel;
}
public void setEncryptionMethod(String encryptionMethod)
{
this.encryptionMethod = encryptionMethod;
}
public String getEncryptionMethod()
{
return encryptionMethod;
}
public void setCommunityName(String communityName)
{
this.communityName = communityName;
}
public String getCommunityName()
{
return communityName;
}
public void setSwitchPassword(String switchPassword)
{
this.switchPassword = switchPassword;
}
public String getSwitchPassword()
{
return switchPassword;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("switchName", getSwitchName())
.append("hardwareSn", getHardwareSn())
.append("snmpAddress", getSnmpAddress())
.append("snmpPort", getSnmpPort())
.append("onlineStatus", getOnlineStatus())
.append("heartbeatCount", getHeartbeatCount())
.append("heartbeatInterval", getHeartbeatInterval())
.append("heartbeatOid", getHeartbeatOid())
.append("snmpVersion", getSnmpVersion())
.append("readWritePermission", getReadWritePermission())
.append("securityLevel", getSecurityLevel())
.append("encryptionMethod", getEncryptionMethod())
.append("communityName", getCommunityName())
.append("switchPassword", getSwitchPassword())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.append("createBy", getCreateBy())
.append("updateBy", getUpdateBy())
.toString();
}
}
@@ -1,12 +1,15 @@
package com.ruoyi.system.service.impl;
import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.system.domain.RmSwitchInterfaceInfo;
import com.ruoyi.system.domain.RmSwitchManagement;
import com.ruoyi.system.mapper.RmSwitchInterfaceInfoMapper;
import com.ruoyi.system.mapper.RmSwitchManagementMapper;
import com.ruoyi.system.service.IRmSwitchManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.RmSwitchManagementMapper;
import com.ruoyi.system.domain.RmSwitchManagement;
import com.ruoyi.system.service.IRmSwitchManagementService;
import java.util.List;
/**
* 交换机管理Service业务层处理
@@ -19,6 +22,8 @@ public class RmSwitchManagementServiceImpl implements IRmSwitchManagementService
{
@Autowired
private RmSwitchManagementMapper rmSwitchManagementMapper;
@Autowired
private RmSwitchInterfaceInfoMapper rmSwitchInterfaceInfoMapper;
/**
* 查询交换机管理
@@ -29,7 +34,13 @@ public class RmSwitchManagementServiceImpl implements IRmSwitchManagementService
@Override
public RmSwitchManagement selectRmSwitchManagementById(Long id)
{
return rmSwitchManagementMapper.selectRmSwitchManagementById(id);
RmSwitchManagement rmSwitchManagement = rmSwitchManagementMapper.selectRmSwitchManagementById(id);
// 查询端口备注信息
RmSwitchInterfaceInfo queryParam = new RmSwitchInterfaceInfo();
queryParam.setHardwareSn(rmSwitchManagement.getHardwareSn());
List<RmSwitchInterfaceInfo> interfaceInfos = rmSwitchInterfaceInfoMapper.selectRmSwitchInterfaceInfoList(queryParam);
rmSwitchManagement.setSwitchInterfaceInfoList(interfaceInfos);
return rmSwitchManagement;
}
/**
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.system.mapper.RmSwitchManagementMapper">
<resultMap type="RmSwitchManagement" id="RmSwitchManagementResult">
<result property="id" column="id" />
<result property="switchName" column="switch_name" />
@@ -15,6 +15,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="heartbeatInterval" column="heartbeat_interval" />
<result property="heartbeatOid" column="heartbeat_oid" />
<result property="snmpVersion" column="snmp_version" />
<result property="upTime" column="up_time" />
<result property="readWritePermission" column="read_write_permission" />
<result property="securityLevel" column="security_level" />
<result property="encryptionMethod" column="encryption_method" />
@@ -27,21 +28,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap>
<sql id="selectRmSwitchManagementVo">
select id, switch_name, hardware_sn, snmp_address, snmp_port, online_status, heartbeat_count, heartbeat_interval, heartbeat_oid, snmp_version, read_write_permission, security_level, encryption_method, community_name, switch_password, create_time, update_time, create_by, update_by from rm_switch_management
select id, switch_name, hardware_sn, snmp_address, snmp_port, online_status, heartbeat_count, heartbeat_interval, heartbeat_oid, snmp_version, up_time, read_write_permission, security_level, encryption_method, community_name, switch_password, create_time, update_time, create_by, update_by from rm_switch_management
</sql>
<select id="selectRmSwitchManagementList" parameterType="RmSwitchManagement" resultMap="RmSwitchManagementResult">
<include refid="selectRmSwitchManagementVo"/>
<where>
<where>
<if test="switchName != null and switchName != ''"> and switch_name like concat('%', #{switchName}, '%')</if>
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
<if test="snmpAddress != null and snmpAddress != ''"> and snmp_address = #{snmpAddress}</if>
<if test="snmpPort != null "> and snmp_port = #{snmpPort}</if>
<if test="onlineStatus != null "> and online_status = #{onlineStatus}</if>
<if test="onlineStatus != null and onlineStatus != ''"> and online_status = #{onlineStatus}</if>
<if test="heartbeatCount != null "> and heartbeat_count = #{heartbeatCount}</if>
<if test="heartbeatInterval != null "> and heartbeat_interval = #{heartbeatInterval}</if>
<if test="heartbeatOid != null and heartbeatOid != ''"> and heartbeat_oid = #{heartbeatOid}</if>
<if test="snmpVersion != null and snmpVersion != ''"> and snmp_version = #{snmpVersion}</if>
<if test="upTime != null "> and up_time = #{upTime}</if>
<if test="readWritePermission != null and readWritePermission != ''"> and read_write_permission = #{readWritePermission}</if>
<if test="securityLevel != null and securityLevel != ''"> and security_level = #{securityLevel}</if>
<if test="encryptionMethod != null and encryptionMethod != ''"> and encryption_method = #{encryptionMethod}</if>
@@ -49,7 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="switchPassword != null and switchPassword != ''"> and switch_password = #{switchPassword}</if>
</where>
</select>
<select id="selectRmSwitchManagementById" parameterType="Long" resultMap="RmSwitchManagementResult">
<include refid="selectRmSwitchManagementVo"/>
where id = #{id}
@@ -62,11 +64,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="hardwareSn != null and hardwareSn != ''">hardware_sn,</if>
<if test="snmpAddress != null and snmpAddress != ''">snmp_address,</if>
<if test="snmpPort != null">snmp_port,</if>
<if test="onlineStatus != null">online_status,</if>
<if test="onlineStatus != null and onlineStatus != ''">online_status,</if>
<if test="heartbeatCount != null">heartbeat_count,</if>
<if test="heartbeatInterval != null">heartbeat_interval,</if>
<if test="heartbeatOid != null and heartbeatOid != ''">heartbeat_oid,</if>
<if test="snmpVersion != null and snmpVersion != ''">snmp_version,</if>
<if test="upTime != null">up_time,</if>
<if test="readWritePermission != null">read_write_permission,</if>
<if test="securityLevel != null">security_level,</if>
<if test="encryptionMethod != null">encryption_method,</if>
@@ -76,17 +79,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">update_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
</trim>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="switchName != null and switchName != ''">#{switchName},</if>
<if test="hardwareSn != null and hardwareSn != ''">#{hardwareSn},</if>
<if test="snmpAddress != null and snmpAddress != ''">#{snmpAddress},</if>
<if test="snmpPort != null">#{snmpPort},</if>
<if test="onlineStatus != null">#{onlineStatus},</if>
<if test="onlineStatus != null and onlineStatus != ''">#{onlineStatus},</if>
<if test="heartbeatCount != null">#{heartbeatCount},</if>
<if test="heartbeatInterval != null">#{heartbeatInterval},</if>
<if test="heartbeatOid != null and heartbeatOid != ''">#{heartbeatOid},</if>
<if test="snmpVersion != null and snmpVersion != ''">#{snmpVersion},</if>
<if test="upTime != null">#{upTime},</if>
<if test="readWritePermission != null">#{readWritePermission},</if>
<if test="securityLevel != null">#{securityLevel},</if>
<if test="encryptionMethod != null">#{encryptionMethod},</if>
@@ -96,7 +100,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateTime != null">#{updateTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
</trim>
</trim>
</insert>
<update id="updateRmSwitchManagement" parameterType="RmSwitchManagement">
@@ -106,11 +110,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="hardwareSn != null and hardwareSn != ''">hardware_sn = #{hardwareSn},</if>
<if test="snmpAddress != null and snmpAddress != ''">snmp_address = #{snmpAddress},</if>
<if test="snmpPort != null">snmp_port = #{snmpPort},</if>
<if test="onlineStatus != null">online_status = #{onlineStatus},</if>
<if test="onlineStatus != null and onlineStatus != ''">online_status = #{onlineStatus},</if>
<if test="heartbeatCount != null">heartbeat_count = #{heartbeatCount},</if>
<if test="heartbeatInterval != null">heartbeat_interval = #{heartbeatInterval},</if>
<if test="heartbeatOid != null and heartbeatOid != ''">heartbeat_oid = #{heartbeatOid},</if>
<if test="snmpVersion != null and snmpVersion != ''">snmp_version = #{snmpVersion},</if>
<if test="upTime != null">up_time = #{upTime},</if>
<if test="readWritePermission != null">read_write_permission = #{readWritePermission},</if>
<if test="securityLevel != null">security_level = #{securityLevel},</if>
<if test="encryptionMethod != null">encryption_method = #{encryptionMethod},</if>
@@ -129,7 +134,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete>
<delete id="deleteRmSwitchManagementByIds" parameterType="String">
delete from rm_switch_management where id in
delete from rm_switch_management where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>