服务器注册接口、snmp采集工具优化、其他bug修复

This commit is contained in:
gaoyutao
2025-10-17 18:56:32 +08:00
parent b3f16d2c8f
commit b0e63880fc
47 changed files with 1856 additions and 209 deletions
@@ -1,5 +1,6 @@
package com.ruoyi.system.controller;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
@@ -7,6 +8,7 @@ import com.ruoyi.common.core.web.page.PageDomain;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.InnerAuth;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.system.domain.RmSwitchManagement;
import com.ruoyi.system.service.IRmSwitchManagementService;
@@ -110,4 +112,14 @@ public class RmSwitchManagementController extends BaseController
List<RmSwitchManagement> list = rmSwitchManagementService.selectRmSwitchManagementList(rmSwitchManagement);
return success(list);
}
/**
* 查询交换机管理列表
*/
@InnerAuth
@PostMapping("/getSwitchNameByClientId")
public R<List<RmSwitchManagement>> getSwitchNameByClientId(@RequestBody RmSwitchManagement rmSwitchManagement)
{
List<RmSwitchManagement> list = rmSwitchManagementService.selectRmSwitchManagementList(rmSwitchManagement);
return R.ok(list);
}
}
@@ -33,4 +33,6 @@ public class RmSwitchInterfaceInfo extends BaseEntity
/** 接口备注 */
@Excel(name = "接口备注")
private String interfaceRemark;
/** 客户端id */
private String clientId;
}
@@ -83,5 +83,7 @@ public class RmSwitchManagement extends BaseEntity
private String switchUser;
/** 端口备注列表 */
private List<RmSwitchInterfaceInfo> switchInterfaceInfoList;
/** 自动生成客户端id(uuid) */
private String clientId;
}
@@ -1,6 +1,7 @@
package com.ruoyi.system.service.impl;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.uuid.IdUtils;
import com.ruoyi.system.domain.RmSwitchInterfaceInfo;
import com.ruoyi.system.domain.RmSwitchManagement;
import com.ruoyi.system.mapper.RmSwitchInterfaceInfoMapper;
@@ -35,11 +36,13 @@ public class RmSwitchManagementServiceImpl implements IRmSwitchManagementService
public RmSwitchManagement selectRmSwitchManagementById(Long id)
{
RmSwitchManagement rmSwitchManagement = rmSwitchManagementMapper.selectRmSwitchManagementById(id);
// 查询端口备注信息
RmSwitchInterfaceInfo queryParam = new RmSwitchInterfaceInfo();
queryParam.setHardwareSn(rmSwitchManagement.getHardwareSn());
List<RmSwitchInterfaceInfo> interfaceInfos = rmSwitchInterfaceInfoMapper.selectRmSwitchInterfaceInfoList(queryParam);
rmSwitchManagement.setSwitchInterfaceInfoList(interfaceInfos);
if(rmSwitchManagement != null){
// 查询端口备注信息
RmSwitchInterfaceInfo queryParam = new RmSwitchInterfaceInfo();
queryParam.setClientId(rmSwitchManagement.getClientId());
List<RmSwitchInterfaceInfo> interfaceInfos = rmSwitchInterfaceInfoMapper.selectRmSwitchInterfaceInfoList(queryParam);
rmSwitchManagement.setSwitchInterfaceInfoList(interfaceInfos);
}
return rmSwitchManagement;
}
@@ -65,6 +68,7 @@ public class RmSwitchManagementServiceImpl implements IRmSwitchManagementService
public int insertRmSwitchManagement(RmSwitchManagement rmSwitchManagement)
{
rmSwitchManagement.setCreateTime(DateUtils.getNowDate());
rmSwitchManagement.setClientId(IdUtils.simpleUUID());
return rmSwitchManagementMapper.insertRmSwitchManagement(rmSwitchManagement);
}
@@ -60,7 +60,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<trim prefix="SET" suffixOverrides=",">
<if test="scriptName != null">script_name = #{scriptName},</if>
<if test="scriptPath != null">script_path = #{scriptPath},</if>
<if test="defaultParams != null">default_params = #{defaultParams},</if>
default_params = #{defaultParams},
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
@@ -14,10 +14,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="clientId" column="client_id" />
</resultMap>
<sql id="selectRmSwitchInterfaceInfoVo">
select id, hardware_sn, switch_name, interface_name, interface_remark, create_time, update_time, create_by, update_by from rm_switch_interface_info
select id, hardware_sn, switch_name, interface_name, interface_remark, create_time, update_time, create_by, update_by, client_id from rm_switch_interface_info
</sql>
<select id="selectRmSwitchInterfaceInfoList" parameterType="RmSwitchInterfaceInfo" resultMap="RmSwitchInterfaceInfoResult">
@@ -27,6 +28,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="switchName != null and switchName != ''"> and switch_name like concat('%', #{switchName}, '%')</if>
<if test="interfaceName != null and interfaceName != ''"> and interface_name like concat('%', #{interfaceName}, '%')</if>
<if test="interfaceRemark != null and interfaceRemark != ''"> and interface_remark = #{interfaceRemark}</if>
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
</where>
</select>
@@ -46,6 +48,7 @@ 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>
<if test="clientId != null">client_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="hardwareSn != null and hardwareSn != ''">#{hardwareSn},</if>
@@ -56,6 +59,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>
<if test="clientId != null">#{clientId},</if>
</trim>
</insert>
@@ -27,10 +27,11 @@
<result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="clientId" column="client_id" />
</resultMap>
<sql id="selectRmSwitchManagementVo">
select id, switch_type, 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_user, switch_password, create_time, update_time, create_by, update_by from rm_switch_management
select id, switch_type, 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_user, switch_password, create_time, update_time, create_by, update_by, client_id from rm_switch_management
</sql>
<select id="selectRmSwitchManagementList" parameterType="RmSwitchManagement" resultMap="RmSwitchManagementResult">
@@ -53,6 +54,7 @@
<if test="communityName != null and communityName != ''"> and community_name like concat('%', #{communityName}, '%')</if>
<if test="switchUser != null and switchUser != ''"> and switch_user = #{switchUser}</if>
<if test="switchPassword != null and switchPassword != ''"> and switch_password = #{switchPassword}</if>
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
</where>
</select>
@@ -85,6 +87,7 @@
<if test="updateTime != null">update_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
<if test="clientId != null">client_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="switchType != null">#{switchType},</if>
@@ -108,6 +111,7 @@
<if test="updateTime != null">#{updateTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="clientId != null">#{clientId},</if>
</trim>
</insert>