增加可选服务器所属交换机功能。

This commit is contained in:
gaoyutao
2026-04-03 09:39:43 +08:00
parent feaa0b4b97
commit 4d39627d96
5 changed files with 49 additions and 3 deletions
@@ -296,5 +296,13 @@ public class RmResourceRegistrationController extends BaseController
{ {
return toAjax(rmResourceRegistrationService.removeServer(rmResourceRegistration.getIds())); return toAjax(rmResourceRegistrationService.removeServer(rmResourceRegistration.getIds()));
} }
/**
* 根据交换机分组
*/
@Log(title = "根据交换机分组", businessType = BusinessType.UPDATE)
@PostMapping("/bindSwitch")
public AjaxResult bindSwitch(@RequestBody RmResourceRegistration rmResourceRegistration)
{
return toAjax(rmResourceRegistrationService.bindSwitch(rmResourceRegistration));
}
} }
@@ -91,7 +91,11 @@ public class RmResourceRegistration extends BaseEntity
/** 出省流量占比 */ /** 出省流量占比 */
@Excel(name = "出省流量占比") @Excel(name = "出省流量占比")
private BigDecimal outboundRate; private BigDecimal outboundRate;
/** 所属交换机唯一标识*/
private String switchClientId;
/** 所属交换机名称*/
@Excel(name = "所属交换机名称")
private String switchName;
/** 需要绑定的网卡信息 */ /** 需要绑定的网卡信息 */
private List<Map> bindNetworkMsg; private List<Map> bindNetworkMsg;
@@ -157,4 +157,6 @@ public interface IRmResourceRegistrationService
RmResourceRegistration getMaxAgentVersion(); RmResourceRegistration getMaxAgentVersion();
RmResourceRegistration selectRmResourceRegistrationByClientId(RmResourceRegistration rmResourceRegistration); RmResourceRegistration selectRmResourceRegistrationByClientId(RmResourceRegistration rmResourceRegistration);
int bindSwitch(RmResourceRegistration rmResourceRegistration);
} }
@@ -1476,4 +1476,18 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
} }
return new RmResourceRegistration(); return new RmResourceRegistration();
} }
@Override
public int bindSwitch(RmResourceRegistration rmResourceRegistration) {
String clientIds = rmResourceRegistration.getDeployDevice();
String[] clientIdArr = clientIds.split("\n");
for (String clientId : clientIdArr) {
RmResourceRegistration updateData = new RmResourceRegistration();
updateData.setClientId(clientId);
updateData.setSwitchName(rmResourceRegistration.getSwitchName());
updateData.setSwitchClientId(rmResourceRegistration.getSwitchClientId());
rmResourceRegistrationMapper.updateStatusByResource(updateData);
}
return 1;
}
} }
@@ -29,16 +29,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="frpcConnectionStatus" column="frpc_connection_status" /> <result property="frpcConnectionStatus" column="frpc_connection_status" />
<result property="frpcRemotePort" column="frpc_remote_port" /> <result property="frpcRemotePort" column="frpc_remote_port" />
<result property="frpcServerAddr" column="frpc_server_addr" /> <result property="frpcServerAddr" column="frpc_server_addr" />
<result property="switchClientId" column="switch_client_id" />
<result property="switchName" column="switch_name" />
</resultMap> </resultMap>
<sql id="selectRmResourceRegistrationVo"> <sql id="selectRmResourceRegistrationVo">
select id, client_id, hardware_sn, business_name, logical_node_id, multi_public_ip_status, registration_status, online_status, resource_type, agent_version, create_time, update_time, heartbeat_count, heartbeat_interval, onboard_time, remark, create_by, update_by, reported_bandwidth, del_alarm_time, outbound_rate from rm_resource_registration select id, client_id, hardware_sn, business_name, logical_node_id, multi_public_ip_status, registration_status, online_status, resource_type, agent_version, create_time, update_time, heartbeat_count, heartbeat_interval, onboard_time, remark, create_by, update_by, reported_bandwidth, del_alarm_time, outbound_rate,switch_client_id, switch_name from rm_resource_registration
</sql> </sql>
<select id="selectRmResourceRegistrationList" parameterType="RmResourceRegistration" resultMap="RmResourceRegistrationResult"> <select id="selectRmResourceRegistrationList" parameterType="RmResourceRegistration" resultMap="RmResourceRegistrationResult">
<include refid="selectRmResourceRegistrationVo"/> <include refid="selectRmResourceRegistrationVo"/>
<where> <where>
and del_flag=0 and del_flag=0
<if test="switchClientId != null and switchClientId != ''"> and switch_client_id = #{switchClientId}</if>
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if> <if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
<if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if> <if test="hardwareSn != null and hardwareSn != ''"> and hardware_sn = #{hardwareSn}</if>
<if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if> <if test="businessName != null and businessName != ''"> and business_name like concat('%', #{businessName}, '%')</if>
@@ -75,6 +78,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.reported_bandwidth as reportedBandwidth, a.reported_bandwidth as reportedBandwidth,
a.del_alarm_time as delAlarmTime, a.del_alarm_time as delAlarmTime,
a.outbound_rate as outboundRate, a.outbound_rate as outboundRate,
a.switch_client_id as switchClientId,
a.switch_name as switchName,
b.machine_code as machineCode, b.machine_code as machineCode,
(select bandwidth_result from eps_node_bandwidth (select bandwidth_result from eps_node_bandwidth
where client_id=a.client_id and calculation_mode='1000' and bandwidth_type=1 where client_id=a.client_id and calculation_mode='1000' and bandwidth_type=1
@@ -104,6 +109,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.reported_bandwidth as reportedBandwidth, a.reported_bandwidth as reportedBandwidth,
a.del_alarm_time as delAlarmTime, a.del_alarm_time as delAlarmTime,
a.outbound_rate as outboundRate, a.outbound_rate as outboundRate,
a.switch_client_id as switchClientId,
a.switch_name as switchName,
b.machine_code as machineCode, b.machine_code as machineCode,
(select bandwidth_result from eps_node_bandwidth (select bandwidth_result from eps_node_bandwidth
where client_id=a.client_id and calculation_mode='1000' and bandwidth_type=1 where client_id=a.client_id and calculation_mode='1000' and bandwidth_type=1
@@ -137,6 +144,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="reportedBandwidth != null">reported_bandwidth,</if> <if test="reportedBandwidth != null">reported_bandwidth,</if>
<if test="delAlarmTime != null">del_alarm_time,</if> <if test="delAlarmTime != null">del_alarm_time,</if>
<if test="outboundRate != null">outbound_rate,</if> <if test="outboundRate != null">outbound_rate,</if>
<if test="switchClientId != null">switch_client_id,</if>
<if test="switchName != null">switch_name,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="clientId != null">#{clientId},</if> <if test="clientId != null">#{clientId},</if>
@@ -159,6 +168,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="reportedBandwidth != null">#{reportedBandwidth},</if> <if test="reportedBandwidth != null">#{reportedBandwidth},</if>
<if test="delAlarmTime != null">#{delAlarmTime},</if> <if test="delAlarmTime != null">#{delAlarmTime},</if>
<if test="outboundRate != null">#{outboundRate},</if> <if test="outboundRate != null">#{outboundRate},</if>
<if test="switchClientId != null">#{switchClientId},</if>
<if test="switchName != null">#{switchName},</if>
</trim> </trim>
</insert> </insert>
@@ -185,6 +196,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="reportedBandwidth != null">reported_bandwidth = #{reportedBandwidth},</if> <if test="reportedBandwidth != null">reported_bandwidth = #{reportedBandwidth},</if>
<if test="delAlarmTime != null">del_alarm_time = #{delAlarmTime},</if> <if test="delAlarmTime != null">del_alarm_time = #{delAlarmTime},</if>
<if test="outboundRate != null">outbound_rate = #{outboundRate},</if> <if test="outboundRate != null">outbound_rate = #{outboundRate},</if>
<if test="switchClientId != null">switch_client_id = #{switchClientId},</if>
<if test="switchName != null">switch_name = #{switchName},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
@@ -225,6 +238,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>
<if test="reportedBandwidth != null">reported_bandwidth = #{reportedBandwidth},</if> <if test="reportedBandwidth != null">reported_bandwidth = #{reportedBandwidth},</if>
<if test="outboundRate != null">outbound_rate = #{outboundRate},</if> <if test="outboundRate != null">outbound_rate = #{outboundRate},</if>
<if test="switchClientId != null">switch_client_id = #{switchClientId},</if>
<if test="switchName != null">switch_name = #{switchName},</if>
</trim> </trim>
<where> <where>
<choose> <choose>
@@ -279,6 +294,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
a.reported_bandwidth as reportedBandwidth, a.reported_bandwidth as reportedBandwidth,
a.del_alarm_time as delAlarmTime, a.del_alarm_time as delAlarmTime,
a.outbound_rate as outboundRate, a.outbound_rate as outboundRate,
a.switch_client_id as switchClientId,
a.switch_name as switchName,
b.machine_code as machineCode, b.machine_code as machineCode,
c.frpc_connection_status frpcConnectionStatus, c.frpc_connection_status frpcConnectionStatus,
c.frpc_remote_port frpcRemotePort, c.frpc_remote_port frpcRemotePort,
@@ -291,6 +308,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join rm_frpc_config_manage c on a.client_id=c.client_id left join rm_frpc_config_manage c on a.client_id=c.client_id
<where> <where>
<if test="delFlag != null"> and a.del_flag = #{delFlag}</if> <if test="delFlag != null"> and a.del_flag = #{delFlag}</if>
<if test="switchClientId != null and switchClientId != ''"> and switch_client_id = #{switchClientId}</if>
<if test="hardwareSn != null and hardwareSn != ''"> and a.hardware_sn = #{hardwareSn}</if> <if test="hardwareSn != null and hardwareSn != ''"> and a.hardware_sn = #{hardwareSn}</if>
<if test="resourceType != null and resourceType != ''"> and a.resource_type = #{resourceType}</if> <if test="resourceType != null and resourceType != ''"> and a.resource_type = #{resourceType}</if>
<if test="agentVersion != null and agentVersion != ''"> and a.agent_version = #{agentVersion}</if> <if test="agentVersion != null and agentVersion != ''"> and a.agent_version = #{agentVersion}</if>