增加agent联调,获取最新策略应答功能
This commit is contained in:
		@@ -106,5 +106,13 @@ public interface RemoteRevenueConfigService
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    @PostMapping("/registration/innerAddRegist")
 | 
					    @PostMapping("/registration/innerAddRegist")
 | 
				
			||||||
    public R<Integer> innerAddRegist(@RequestBody RmRegisterMsgRemote rmRegisterMsgRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
 | 
					    public R<Integer> innerAddRegist(@RequestBody RmRegisterMsgRemote rmRegisterMsgRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 添加节点标识
 | 
				
			||||||
 | 
					     * @param rmResourceRegistrationRemote
 | 
				
			||||||
 | 
					     * @param source
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @PostMapping("/registration/innerupdateRegist")
 | 
				
			||||||
 | 
					    public R<Integer> innerupdateRegist(@RequestBody RmResourceRegistrationRemote rmResourceRegistrationRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -54,6 +54,14 @@ public interface RemoteRocketMqService {
 | 
				
			|||||||
    @PostMapping("/networkInterface/getNetworkInterfaceList")
 | 
					    @PostMapping("/networkInterface/getNetworkInterfaceList")
 | 
				
			||||||
    public R<List<RmNetworkInterfaceRemote>> getNetworkInterfaceList(@RequestBody RmNetworkInterfaceRemote rmNetworkInterfaceRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
 | 
					    public R<List<RmNetworkInterfaceRemote>> getNetworkInterfaceList(@RequestBody RmNetworkInterfaceRemote rmNetworkInterfaceRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 获取网卡接口列表
 | 
				
			||||||
 | 
					     * @param rmNetworkInterfaceRemote
 | 
				
			||||||
 | 
					     * @param source
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @PostMapping("/networkInterface/bindPublicIp")
 | 
				
			||||||
 | 
					    public R<Integer> bindPublicIp(@RequestBody RmNetworkInterfaceRemote rmNetworkInterfaceRemote, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 下发策略
 | 
					     * 下发策略
 | 
				
			||||||
     * @param id
 | 
					     * @param id
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,11 +1,13 @@
 | 
				
			|||||||
package com.ruoyi.system.api.domain;
 | 
					package com.ruoyi.system.api.domain;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 | 
				
			||||||
import com.fasterxml.jackson.annotation.JsonProperty;
 | 
					import com.fasterxml.jackson.annotation.JsonProperty;
 | 
				
			||||||
import lombok.Data;
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Data
 | 
					@Data
 | 
				
			||||||
 | 
					@JsonIgnoreProperties(ignoreUnknown = true)
 | 
				
			||||||
public class RmRegisterMsgRemote {
 | 
					public class RmRegisterMsgRemote {
 | 
				
			||||||
    @JsonProperty("clientId")
 | 
					    @JsonProperty("clientId")
 | 
				
			||||||
    private String clientId;
 | 
					    private String clientId;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -59,22 +59,27 @@ public class RemoteRevenueConfigFallbackFactory implements FallbackFactory<Remot
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            @Override
 | 
					            @Override
 | 
				
			||||||
            public R<TableDataInfo> getRegistrationList(RmResourceRegistrationRemote rmResourceRegistrationRemote, String source) {
 | 
					            public R<TableDataInfo> getRegistrationList(RmResourceRegistrationRemote rmResourceRegistrationRemote, String source) {
 | 
				
			||||||
                return R.fail("获取资源注册列表信息失败" + throwable.getMessage());
 | 
					                return R.fail("获取资源注册列表信息失败:" + throwable.getMessage());
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            @Override
 | 
					            @Override
 | 
				
			||||||
            public R<RmResourceRegistrationRemote> getListByHardwareSn(RmResourceRegistrationRemote rmResourceRegistrationRemote, String source) {
 | 
					            public R<RmResourceRegistrationRemote> getListByHardwareSn(RmResourceRegistrationRemote rmResourceRegistrationRemote, String source) {
 | 
				
			||||||
                return R.fail("根据SN获取资源注册列表信息失败" + throwable.getMessage());
 | 
					                return R.fail("根据SN获取资源注册列表信息失败:" + throwable.getMessage());
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            @Override
 | 
					            @Override
 | 
				
			||||||
            public R<List<RmSwitchManagementRemote>> getSwitchNameByClientId(RmSwitchManagementRemote rmSwitchManagementRemote, String source) {
 | 
					            public R<List<RmSwitchManagementRemote>> getSwitchNameByClientId(RmSwitchManagementRemote rmSwitchManagementRemote, String source) {
 | 
				
			||||||
                return R.fail("根据clientId获取交换机信息失败" + throwable.getMessage());
 | 
					                return R.fail("根据clientId获取交换机信息失败:" + throwable.getMessage());
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            @Override
 | 
					            @Override
 | 
				
			||||||
            public R<Integer> innerAddRegist(RmRegisterMsgRemote rmRegisterMsgRemote, String source) {
 | 
					            public R<Integer> innerAddRegist(RmRegisterMsgRemote rmRegisterMsgRemote, String source) {
 | 
				
			||||||
                return R.fail("自动注册失败" + throwable.getMessage());
 | 
					                return R.fail("自动注册失败:" + throwable.getMessage());
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            @Override
 | 
				
			||||||
 | 
					            public R<Integer> innerupdateRegist(RmResourceRegistrationRemote rmResourceRegistrationRemote, String source) {
 | 
				
			||||||
 | 
					                return R.fail("修改服务器注册信息失败:" + throwable.getMessage());
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -53,6 +53,11 @@ public class RemoteRocketMqFallbackFactory implements FallbackFactory<RemoteRock
 | 
				
			|||||||
                return R.fail(throwable.getMessage());
 | 
					                return R.fail(throwable.getMessage());
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            @Override
 | 
				
			||||||
 | 
					            public R<Integer> bindPublicIp(RmNetworkInterfaceRemote rmNetworkInterfaceRemote, String source) {
 | 
				
			||||||
 | 
					                return R.fail(throwable.getMessage());
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            @Override
 | 
					            @Override
 | 
				
			||||||
            public R<String> innerIssueSwitchPolicy(Long id, String source) {
 | 
					            public R<String> innerIssueSwitchPolicy(Long id, String source) {
 | 
				
			||||||
                return R.fail(throwable.getMessage());
 | 
					                return R.fail(throwable.getMessage());
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,6 +11,7 @@ import com.ruoyi.common.log.enums.BusinessType;
 | 
				
			|||||||
import com.ruoyi.common.security.annotation.InnerAuth;
 | 
					import com.ruoyi.common.security.annotation.InnerAuth;
 | 
				
			||||||
import com.ruoyi.common.security.annotation.RequiresPermissions;
 | 
					import com.ruoyi.common.security.annotation.RequiresPermissions;
 | 
				
			||||||
import com.ruoyi.system.api.domain.RmRegisterMsgRemote;
 | 
					import com.ruoyi.system.api.domain.RmRegisterMsgRemote;
 | 
				
			||||||
 | 
					import com.ruoyi.system.api.domain.RmResourceRegistrationRemote;
 | 
				
			||||||
import com.ruoyi.system.domain.RmResourceRegistration;
 | 
					import com.ruoyi.system.domain.RmResourceRegistration;
 | 
				
			||||||
import com.ruoyi.system.service.IRmResourceRegistrationService;
 | 
					import com.ruoyi.system.service.IRmResourceRegistrationService;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
@@ -189,5 +190,27 @@ public class RmResourceRegistrationController extends BaseController
 | 
				
			|||||||
        int rows = rmResourceRegistrationService.innerAddRegist(rmResourceRegistration);
 | 
					        int rows = rmResourceRegistrationService.innerAddRegist(rmResourceRegistration);
 | 
				
			||||||
        return R.ok(rows);
 | 
					        return R.ok(rows);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 添加节点标识
 | 
				
			||||||
 | 
					     * @param rmResourceRegistration mq接收的消息
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @PostMapping("/innerUpdateRegist")
 | 
				
			||||||
 | 
					    @InnerAuth
 | 
				
			||||||
 | 
					    public R<Integer> innerUpdateRegist(@RequestBody RmResourceRegistrationRemote rmResourceRegistration)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        int rows = rmResourceRegistrationService.innerUpdateRegist(rmResourceRegistration);
 | 
				
			||||||
 | 
					        return R.ok(rows);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 选择公网业务IP
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @RequiresPermissions("system:registration:update")
 | 
				
			||||||
 | 
					    @PostMapping("/bindBusinessPubulicIp")
 | 
				
			||||||
 | 
					    public AjaxResult bindBusinessPubulicIp(@RequestBody RmResourceRegistration rmResourceRegistration)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        int rows = rmResourceRegistrationService.bindBusinessPubulicIp(rmResourceRegistration);
 | 
				
			||||||
 | 
					        return toAjax(rows);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,6 +4,9 @@ import com.ruoyi.common.core.annotation.Excel;
 | 
				
			|||||||
import com.ruoyi.common.core.web.domain.BaseEntity;
 | 
					import com.ruoyi.common.core.web.domain.BaseEntity;
 | 
				
			||||||
import lombok.Data;
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.util.Map;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 资源注册对象 rm_resource_registration
 | 
					 * 资源注册对象 rm_resource_registration
 | 
				
			||||||
 * 
 | 
					 * 
 | 
				
			||||||
@@ -173,4 +176,6 @@ public class RmResourceRegistration extends BaseEntity
 | 
				
			|||||||
     * 心跳周期(单位:秒)
 | 
					     * 心跳周期(单位:秒)
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    private Integer heartbeatInterval;
 | 
					    private Integer heartbeatInterval;
 | 
				
			||||||
 | 
					    /** 需要绑定的网卡信息 */
 | 
				
			||||||
 | 
					    private List<Map> bindNetworkMsg;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -85,5 +85,7 @@ public class RmSwitchManagement extends BaseEntity
 | 
				
			|||||||
    private List<RmSwitchInterfaceInfo> switchInterfaceInfoList;
 | 
					    private List<RmSwitchInterfaceInfo> switchInterfaceInfoList;
 | 
				
			||||||
    /** 自动生成客户端id(uuid) */
 | 
					    /** 自动生成客户端id(uuid) */
 | 
				
			||||||
    private String clientId;
 | 
					    private String clientId;
 | 
				
			||||||
 | 
					    /** 查询条件 */
 | 
				
			||||||
 | 
					    private String queryName;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -3,6 +3,7 @@ package com.ruoyi.system.service;
 | 
				
			|||||||
import com.ruoyi.common.core.domain.R;
 | 
					import com.ruoyi.common.core.domain.R;
 | 
				
			||||||
import com.ruoyi.common.core.web.domain.AjaxResult;
 | 
					import com.ruoyi.common.core.web.domain.AjaxResult;
 | 
				
			||||||
import com.ruoyi.system.api.domain.RmRegisterMsgRemote;
 | 
					import com.ruoyi.system.api.domain.RmRegisterMsgRemote;
 | 
				
			||||||
 | 
					import com.ruoyi.system.api.domain.RmResourceRegistrationRemote;
 | 
				
			||||||
import com.ruoyi.system.domain.RmResourceRegistration;
 | 
					import com.ruoyi.system.domain.RmResourceRegistration;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
@@ -98,4 +99,18 @@ public interface IRmResourceRegistrationService
 | 
				
			|||||||
     * @return
 | 
					     * @return
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    int innerAddRegist(RmRegisterMsgRemote rmResourceRegistration);
 | 
					    int innerAddRegist(RmRegisterMsgRemote rmResourceRegistration);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 添加节点标识
 | 
				
			||||||
 | 
					     * @param rmResourceRegistration
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    int innerUpdateRegist(RmResourceRegistrationRemote rmResourceRegistration);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 选择公网业务IP
 | 
				
			||||||
 | 
					     * @param rmResourceRegistration
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    int bindBusinessPubulicIp(RmResourceRegistration rmResourceRegistration);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -5,11 +5,14 @@ import com.ruoyi.common.core.constant.SecurityConstants;
 | 
				
			|||||||
import com.ruoyi.common.core.domain.R;
 | 
					import com.ruoyi.common.core.domain.R;
 | 
				
			||||||
import com.ruoyi.common.core.enums.MsgEnum;
 | 
					import com.ruoyi.common.core.enums.MsgEnum;
 | 
				
			||||||
import com.ruoyi.common.core.utils.DateUtils;
 | 
					import com.ruoyi.common.core.utils.DateUtils;
 | 
				
			||||||
 | 
					import com.ruoyi.common.core.utils.StringUtils;
 | 
				
			||||||
import com.ruoyi.common.core.web.domain.AjaxResult;
 | 
					import com.ruoyi.common.core.web.domain.AjaxResult;
 | 
				
			||||||
import com.ruoyi.common.security.utils.SecurityUtils;
 | 
					import com.ruoyi.common.security.utils.SecurityUtils;
 | 
				
			||||||
import com.ruoyi.system.api.RemoteRocketMqService;
 | 
					import com.ruoyi.system.api.RemoteRocketMqService;
 | 
				
			||||||
import com.ruoyi.system.api.domain.NetworkInfo;
 | 
					import com.ruoyi.system.api.domain.NetworkInfo;
 | 
				
			||||||
 | 
					import com.ruoyi.system.api.domain.RmNetworkInterfaceRemote;
 | 
				
			||||||
import com.ruoyi.system.api.domain.RmRegisterMsgRemote;
 | 
					import com.ruoyi.system.api.domain.RmRegisterMsgRemote;
 | 
				
			||||||
 | 
					import com.ruoyi.system.api.domain.RmResourceRegistrationRemote;
 | 
				
			||||||
import com.ruoyi.system.domain.EpsNodeBandwidth;
 | 
					import com.ruoyi.system.domain.EpsNodeBandwidth;
 | 
				
			||||||
import com.ruoyi.system.domain.EpsServerRevenueConfig;
 | 
					import com.ruoyi.system.domain.EpsServerRevenueConfig;
 | 
				
			||||||
import com.ruoyi.system.domain.RmEpsTopologyManagement;
 | 
					import com.ruoyi.system.domain.RmEpsTopologyManagement;
 | 
				
			||||||
@@ -427,5 +430,53 @@ public class RmResourceRegistrationServiceImpl implements IRmResourceRegistratio
 | 
				
			|||||||
        return 1;
 | 
					        return 1;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 添加节点标识
 | 
				
			||||||
 | 
					     * @param rmResourceRegistration
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public int innerUpdateRegist(RmResourceRegistrationRemote rmResourceRegistration) {
 | 
				
			||||||
 | 
					        // 查询此数据是否存在
 | 
				
			||||||
 | 
					        RmResourceRegistration queryParam = new RmResourceRegistration();
 | 
				
			||||||
 | 
					        queryParam.setClientId(rmResourceRegistration.getClientId());
 | 
				
			||||||
 | 
					        RmResourceRegistration exits = rmResourceRegistrationMapper.selectRegistMsgByClientId(queryParam);
 | 
				
			||||||
 | 
					        if(exits != null){
 | 
				
			||||||
 | 
					            // 如果逻辑节点为空或者有变化 设置新节点
 | 
				
			||||||
 | 
					            if(exits.getLogicalNodeId() == null ||
 | 
				
			||||||
 | 
					                    !StringUtils.equals(rmResourceRegistration.getLogicalNodeId(),exits.getLogicalNodeId())){
 | 
				
			||||||
 | 
					                // 如果服务器已注册 增加节点标识
 | 
				
			||||||
 | 
					                RmResourceRegistration updateData = new RmResourceRegistration();
 | 
				
			||||||
 | 
					                updateData.setId(exits.getId());
 | 
				
			||||||
 | 
					                updateData.setLogicalNodeId(rmResourceRegistration.getLogicalNodeId());
 | 
				
			||||||
 | 
					                rmResourceRegistrationMapper.updateRmResourceRegistration(updateData);
 | 
				
			||||||
 | 
					                log.info("设备:{},逻辑节点增加成功",rmResourceRegistration.getClientId());
 | 
				
			||||||
 | 
					                return 1;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        return 0;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public int bindBusinessPubulicIp(RmResourceRegistration rmResourceRegistration) {
 | 
				
			||||||
 | 
					        List<Map> bindMsgMap = rmResourceRegistration.getBindNetworkMsg();
 | 
				
			||||||
 | 
					        for (Map map : bindMsgMap) {
 | 
				
			||||||
 | 
					            // id
 | 
				
			||||||
 | 
					            Long id = (Long) map.get("id");
 | 
				
			||||||
 | 
					            String status = map.get("status").toString();
 | 
				
			||||||
 | 
					            // 绑定ip
 | 
				
			||||||
 | 
					            RmNetworkInterfaceRemote rmNetworkInterfaceRemote = new RmNetworkInterfaceRemote();
 | 
				
			||||||
 | 
					            rmNetworkInterfaceRemote.setId(id);
 | 
				
			||||||
 | 
					            rmNetworkInterfaceRemote.setBindIp(status);
 | 
				
			||||||
 | 
					            remoteRocketMqService.bindPublicIp(rmNetworkInterfaceRemote, SecurityConstants.INNER);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        // 修改多公网IP状态为已绑定
 | 
				
			||||||
 | 
					        RmResourceRegistration updateData = new RmResourceRegistration();
 | 
				
			||||||
 | 
					        updateData.setId(rmResourceRegistration.getId());
 | 
				
			||||||
 | 
					        updateData.setMultiPublicIpStatus("1");
 | 
				
			||||||
 | 
					        rmResourceRegistrationMapper.updateRmResourceRegistration(updateData);
 | 
				
			||||||
 | 
					        return 1;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -55,6 +55,9 @@
 | 
				
			|||||||
            <if test="switchUser != null  and switchUser != ''"> and switch_user = #{switchUser}</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="switchPassword != null  and switchPassword != ''"> and switch_password = #{switchPassword}</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="queryName != null  and queryName != ''">
 | 
				
			||||||
 | 
					                and (snmp_address = #{snmpAddress} or switch_name like concat('%', #{switchName}, '%'))
 | 
				
			||||||
 | 
					             </if>
 | 
				
			||||||
        </where>
 | 
					        </where>
 | 
				
			||||||
    </select>
 | 
					    </select>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -73,4 +73,27 @@ public class RmAgentManagementController extends BaseController
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        return toAjax(rmAgentManagementService.updateRmAgentManagement(rmAgentManagement));
 | 
					        return toAjax(rmAgentManagementService.updateRmAgentManagement(rmAgentManagement));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 手动立即更新
 | 
				
			||||||
 | 
					     * @param id
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @RequiresPermissions("rocketmq:management:edit")
 | 
				
			||||||
 | 
					    @GetMapping("/updateAgentNow")
 | 
				
			||||||
 | 
					    public AjaxResult updateAgentNow(Long id){
 | 
				
			||||||
 | 
					        rmAgentManagementService.updateAgentNow(id);
 | 
				
			||||||
 | 
					        return success();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 配置更新策略
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @RequiresPermissions("rocketmq:management:add")
 | 
				
			||||||
 | 
					    @Log(title = "Agent管理", businessType = BusinessType.INSERT)
 | 
				
			||||||
 | 
					    @PostMapping("/addUpdatePolicy")
 | 
				
			||||||
 | 
					    public AjaxResult addUpdatePolicy(@RequestBody RmAgentManagement rmAgentManagement)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return toAjax(rmAgentManagementService.addUpdatePolicy(rmAgentManagement));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,105 @@
 | 
				
			|||||||
 | 
					package com.ruoyi.rocketmq.controller;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.io.IOException;
 | 
				
			||||||
 | 
					import javax.servlet.http.HttpServletResponse;
 | 
				
			||||||
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.GetMapping;
 | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.PostMapping;
 | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.PutMapping;
 | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.DeleteMapping;
 | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.PathVariable;
 | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.RequestBody;
 | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.RequestMapping;
 | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.RestController;
 | 
				
			||||||
 | 
					import com.ruoyi.common.log.annotation.Log;
 | 
				
			||||||
 | 
					import com.ruoyi.common.log.enums.BusinessType;
 | 
				
			||||||
 | 
					import com.ruoyi.common.security.annotation.RequiresPermissions;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.domain.RmFileInfo;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.service.IRmFileInfoService;
 | 
				
			||||||
 | 
					import com.ruoyi.common.core.web.controller.BaseController;
 | 
				
			||||||
 | 
					import com.ruoyi.common.core.web.domain.AjaxResult;
 | 
				
			||||||
 | 
					import com.ruoyi.common.core.utils.poi.ExcelUtil;
 | 
				
			||||||
 | 
					import com.ruoyi.common.core.web.page.TableDataInfo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 文件信息Controller
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @author gyt
 | 
				
			||||||
 | 
					 * @date 2025-09-15
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					@RestController
 | 
				
			||||||
 | 
					@RequestMapping("/info")
 | 
				
			||||||
 | 
					public class RmFileInfoController extends BaseController
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    @Autowired
 | 
				
			||||||
 | 
					    private IRmFileInfoService rmFileInfoService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询文件信息列表
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @RequiresPermissions("rocketmq:info:list")
 | 
				
			||||||
 | 
					    @GetMapping("/list")
 | 
				
			||||||
 | 
					    public TableDataInfo list(RmFileInfo rmFileInfo)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        startPage();
 | 
				
			||||||
 | 
					        List<RmFileInfo> list = rmFileInfoService.selectRmFileInfoList(rmFileInfo);
 | 
				
			||||||
 | 
					        return getDataTable(list);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 导出文件信息列表
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @RequiresPermissions("rocketmq:info:export")
 | 
				
			||||||
 | 
					    @Log(title = "文件信息", businessType = BusinessType.EXPORT)
 | 
				
			||||||
 | 
					    @PostMapping("/export")
 | 
				
			||||||
 | 
					    public void export(HttpServletResponse response, RmFileInfo rmFileInfo)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        List<RmFileInfo> list = rmFileInfoService.selectRmFileInfoList(rmFileInfo);
 | 
				
			||||||
 | 
					        ExcelUtil<RmFileInfo> util = new ExcelUtil<RmFileInfo>(RmFileInfo.class);
 | 
				
			||||||
 | 
					        util.exportExcel(response, list, "文件信息数据");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 获取文件信息详细信息
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @RequiresPermissions("rocketmq:info:query")
 | 
				
			||||||
 | 
					    @GetMapping(value = "/{id}")
 | 
				
			||||||
 | 
					    public AjaxResult getInfo(@PathVariable("id") Long id)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return success(rmFileInfoService.selectRmFileInfoById(id));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 新增文件信息
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @RequiresPermissions("rocketmq:info:add")
 | 
				
			||||||
 | 
					    @Log(title = "文件信息", businessType = BusinessType.INSERT)
 | 
				
			||||||
 | 
					    @PostMapping
 | 
				
			||||||
 | 
					    public AjaxResult add(@RequestBody RmFileInfo rmFileInfo)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return toAjax(rmFileInfoService.insertRmFileInfo(rmFileInfo));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 修改文件信息
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @RequiresPermissions("rocketmq:info:edit")
 | 
				
			||||||
 | 
					    @Log(title = "文件信息", businessType = BusinessType.UPDATE)
 | 
				
			||||||
 | 
					    @PutMapping
 | 
				
			||||||
 | 
					    public AjaxResult edit(@RequestBody RmFileInfo rmFileInfo)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return toAjax(rmFileInfoService.updateRmFileInfo(rmFileInfo));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 删除文件信息
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @RequiresPermissions("rocketmq:info:remove")
 | 
				
			||||||
 | 
					    @Log(title = "文件信息", businessType = BusinessType.DELETE)
 | 
				
			||||||
 | 
						@DeleteMapping("/{ids}")
 | 
				
			||||||
 | 
					    public AjaxResult remove(@PathVariable Long[] ids)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return toAjax(rmFileInfoService.deleteRmFileInfoByIds(ids));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -4,7 +4,6 @@ import com.ruoyi.common.core.domain.R;
 | 
				
			|||||||
import com.ruoyi.common.core.utils.poi.ExcelUtil;
 | 
					import com.ruoyi.common.core.utils.poi.ExcelUtil;
 | 
				
			||||||
import com.ruoyi.common.core.web.controller.BaseController;
 | 
					import com.ruoyi.common.core.web.controller.BaseController;
 | 
				
			||||||
import com.ruoyi.common.core.web.domain.AjaxResult;
 | 
					import com.ruoyi.common.core.web.domain.AjaxResult;
 | 
				
			||||||
import com.ruoyi.common.core.web.page.TableDataInfo;
 | 
					 | 
				
			||||||
import com.ruoyi.common.log.annotation.Log;
 | 
					import com.ruoyi.common.log.annotation.Log;
 | 
				
			||||||
import com.ruoyi.common.log.enums.BusinessType;
 | 
					import com.ruoyi.common.log.enums.BusinessType;
 | 
				
			||||||
import com.ruoyi.common.security.annotation.InnerAuth;
 | 
					import com.ruoyi.common.security.annotation.InnerAuth;
 | 
				
			||||||
@@ -34,12 +33,11 @@ public class RmNetworkInterfaceController extends BaseController
 | 
				
			|||||||
     * 查询客户端网络接口信息列表
 | 
					     * 查询客户端网络接口信息列表
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @RequiresPermissions("rocketmq:networkInterface:list")
 | 
					    @RequiresPermissions("rocketmq:networkInterface:list")
 | 
				
			||||||
    @GetMapping("/list")
 | 
					    @PostMapping("/list")
 | 
				
			||||||
    public TableDataInfo list(RmNetworkInterface rmNetworkInterface)
 | 
					    public AjaxResult list(RmNetworkInterface rmNetworkInterface)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        startPage();
 | 
					 | 
				
			||||||
        List<RmNetworkInterface> list = rmNetworkInterfaceService.selectRmNetworkInterfaceList(rmNetworkInterface);
 | 
					        List<RmNetworkInterface> list = rmNetworkInterfaceService.selectRmNetworkInterfaceList(rmNetworkInterface);
 | 
				
			||||||
        return getDataTable(list);
 | 
					        return success(list);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@@ -107,4 +105,15 @@ public class RmNetworkInterfaceController extends BaseController
 | 
				
			|||||||
        List<RmNetworkInterface> list = rmNetworkInterfaceService.selectRmNetworkInterfaceList(rmNetworkInterface);
 | 
					        List<RmNetworkInterface> list = rmNetworkInterfaceService.selectRmNetworkInterfaceList(rmNetworkInterface);
 | 
				
			||||||
        return R.ok(list);
 | 
					        return R.ok(list);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 远程调用修改客户端网络接口信息
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @InnerAuth
 | 
				
			||||||
 | 
					    @PostMapping("/bindPublicIp")
 | 
				
			||||||
 | 
					    public R<Integer> bindPublicIp(@RequestBody RmNetworkInterface rmNetworkInterface)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        int rows = rmNetworkInterfaceService.bindPublicIp(rmNetworkInterface);
 | 
				
			||||||
 | 
					        return R.ok(rows);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,105 @@
 | 
				
			|||||||
 | 
					package com.ruoyi.rocketmq.controller;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import java.io.IOException;
 | 
				
			||||||
 | 
					import javax.servlet.http.HttpServletResponse;
 | 
				
			||||||
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.GetMapping;
 | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.PostMapping;
 | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.PutMapping;
 | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.DeleteMapping;
 | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.PathVariable;
 | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.RequestBody;
 | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.RequestMapping;
 | 
				
			||||||
 | 
					import org.springframework.web.bind.annotation.RestController;
 | 
				
			||||||
 | 
					import com.ruoyi.common.log.annotation.Log;
 | 
				
			||||||
 | 
					import com.ruoyi.common.log.enums.BusinessType;
 | 
				
			||||||
 | 
					import com.ruoyi.common.security.annotation.RequiresPermissions;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.domain.RmPolicyDeviceDetails;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.service.IRmPolicyDeviceDetailsService;
 | 
				
			||||||
 | 
					import com.ruoyi.common.core.web.controller.BaseController;
 | 
				
			||||||
 | 
					import com.ruoyi.common.core.web.domain.AjaxResult;
 | 
				
			||||||
 | 
					import com.ruoyi.common.core.utils.poi.ExcelUtil;
 | 
				
			||||||
 | 
					import com.ruoyi.common.core.web.page.TableDataInfo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 客户端策略关联Controller
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @author gyt
 | 
				
			||||||
 | 
					 * @date 2025-10-22
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					@RestController
 | 
				
			||||||
 | 
					@RequestMapping("/policyDeviceDetails")
 | 
				
			||||||
 | 
					public class RmPolicyDeviceDetailsController extends BaseController
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    @Autowired
 | 
				
			||||||
 | 
					    private IRmPolicyDeviceDetailsService rmPolicyDeviceDetailsService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询客户端策略关联列表
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @RequiresPermissions("rocketmq:policyDeviceDetails:list")
 | 
				
			||||||
 | 
					    @GetMapping("/list")
 | 
				
			||||||
 | 
					    public TableDataInfo list(RmPolicyDeviceDetails rmPolicyDeviceDetails)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        startPage();
 | 
				
			||||||
 | 
					        List<RmPolicyDeviceDetails> list = rmPolicyDeviceDetailsService.selectRmPolicyDeviceDetailsList(rmPolicyDeviceDetails);
 | 
				
			||||||
 | 
					        return getDataTable(list);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 导出客户端策略关联列表
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @RequiresPermissions("rocketmq:policyDeviceDetails:export")
 | 
				
			||||||
 | 
					    @Log(title = "客户端策略关联", businessType = BusinessType.EXPORT)
 | 
				
			||||||
 | 
					    @PostMapping("/export")
 | 
				
			||||||
 | 
					    public void export(HttpServletResponse response, RmPolicyDeviceDetails rmPolicyDeviceDetails)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        List<RmPolicyDeviceDetails> list = rmPolicyDeviceDetailsService.selectRmPolicyDeviceDetailsList(rmPolicyDeviceDetails);
 | 
				
			||||||
 | 
					        ExcelUtil<RmPolicyDeviceDetails> util = new ExcelUtil<RmPolicyDeviceDetails>(RmPolicyDeviceDetails.class);
 | 
				
			||||||
 | 
					        util.exportExcel(response, list, "客户端策略关联数据");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 获取客户端策略关联详细信息
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @RequiresPermissions("rocketmq:policyDeviceDetails:query")
 | 
				
			||||||
 | 
					    @GetMapping(value = "/{id}")
 | 
				
			||||||
 | 
					    public AjaxResult getInfo(@PathVariable("id") Long id)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return success(rmPolicyDeviceDetailsService.selectRmPolicyDeviceDetailsById(id));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 新增客户端策略关联
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @RequiresPermissions("rocketmq:policyDeviceDetails:add")
 | 
				
			||||||
 | 
					    @Log(title = "客户端策略关联", businessType = BusinessType.INSERT)
 | 
				
			||||||
 | 
					    @PostMapping
 | 
				
			||||||
 | 
					    public AjaxResult add(@RequestBody RmPolicyDeviceDetails rmPolicyDeviceDetails)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return toAjax(rmPolicyDeviceDetailsService.insertRmPolicyDeviceDetails(rmPolicyDeviceDetails));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 修改客户端策略关联
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @RequiresPermissions("rocketmq:policyDeviceDetails:edit")
 | 
				
			||||||
 | 
					    @Log(title = "客户端策略关联", businessType = BusinessType.UPDATE)
 | 
				
			||||||
 | 
					    @PutMapping
 | 
				
			||||||
 | 
					    public AjaxResult edit(@RequestBody RmPolicyDeviceDetails rmPolicyDeviceDetails)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return toAjax(rmPolicyDeviceDetailsService.updateRmPolicyDeviceDetails(rmPolicyDeviceDetails));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 删除客户端策略关联
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @RequiresPermissions("rocketmq:policyDeviceDetails:remove")
 | 
				
			||||||
 | 
					    @Log(title = "客户端策略关联", businessType = BusinessType.DELETE)
 | 
				
			||||||
 | 
						@DeleteMapping("/{ids}")
 | 
				
			||||||
 | 
					    public AjaxResult remove(@PathVariable Long[] ids)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return toAjax(rmPolicyDeviceDetailsService.deleteRmPolicyDeviceDetailsByIds(ids));
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -1,5 +1,6 @@
 | 
				
			|||||||
package com.ruoyi.rocketmq.domain;
 | 
					package com.ruoyi.rocketmq.domain;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
 | 
				
			||||||
import com.ruoyi.common.core.annotation.Excel;
 | 
					import com.ruoyi.common.core.annotation.Excel;
 | 
				
			||||||
import com.ruoyi.common.core.web.domain.BaseEntity;
 | 
					import com.ruoyi.common.core.web.domain.BaseEntity;
 | 
				
			||||||
import lombok.Data;
 | 
					import lombok.Data;
 | 
				
			||||||
@@ -11,12 +12,17 @@ import lombok.Data;
 | 
				
			|||||||
 * @date 2025-09-08
 | 
					 * @date 2025-09-08
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
@Data
 | 
					@Data
 | 
				
			||||||
 | 
					@JsonIgnoreProperties(ignoreUnknown = true)
 | 
				
			||||||
public class InitialHeartbeatListen extends BaseEntity
 | 
					public class InitialHeartbeatListen extends BaseEntity
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    private static final long serialVersionUID = 1L;
 | 
					    private static final long serialVersionUID = 1L;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /** 客户端ID */
 | 
					    /** 客户端ID */
 | 
				
			||||||
    private String clientId;
 | 
					    private String clientId;
 | 
				
			||||||
 | 
					    /** 节点 */
 | 
				
			||||||
 | 
					    private String logicalNode;
 | 
				
			||||||
 | 
					    /** sn */
 | 
				
			||||||
 | 
					    private String sn;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /** 强度值 */
 | 
					    /** 强度值 */
 | 
				
			||||||
    @Excel(name = "强度值")
 | 
					    @Excel(name = "强度值")
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -74,5 +74,11 @@ public class RmAgentManagement extends BaseEntity
 | 
				
			|||||||
    private String includeNames;
 | 
					    private String includeNames;
 | 
				
			||||||
    /** 查询条件名称 */
 | 
					    /** 查询条件名称 */
 | 
				
			||||||
    private String queryName;
 | 
					    private String queryName;
 | 
				
			||||||
 | 
					    /** 文件MD5 */
 | 
				
			||||||
 | 
					    private String fileMd5;
 | 
				
			||||||
 | 
					    /** 客户端id */
 | 
				
			||||||
 | 
					    private String clientId;
 | 
				
			||||||
 | 
					    /** 部署设备 */
 | 
				
			||||||
 | 
					    private String deployDevice;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -81,4 +81,12 @@ public class RmDeploymentPolicy extends BaseEntity
 | 
				
			|||||||
    private String resourceGroupName;
 | 
					    private String resourceGroupName;
 | 
				
			||||||
    /** 资源组置空 */
 | 
					    /** 资源组置空 */
 | 
				
			||||||
    private Boolean resourceGroupIdNull;
 | 
					    private Boolean resourceGroupIdNull;
 | 
				
			||||||
 | 
					    /** 部署设备 */
 | 
				
			||||||
 | 
					    private String deployDevice;
 | 
				
			||||||
 | 
					    /** 业务脚本名称 */
 | 
				
			||||||
 | 
					    private String scriptName;
 | 
				
			||||||
 | 
					    /** 业务脚本文件地址 */
 | 
				
			||||||
 | 
					    private String scriptPath;
 | 
				
			||||||
 | 
					    /** 业务脚本参数 */
 | 
				
			||||||
 | 
					    private String defaultParams;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,131 @@
 | 
				
			|||||||
 | 
					package com.ruoyi.rocketmq.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;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 文件信息对象 rm_file_info
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @author gyt
 | 
				
			||||||
 | 
					 * @date 2025-09-15
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					public class RmFileInfo extends BaseEntity
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    private static final long serialVersionUID = 1L;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** 文件ID */
 | 
				
			||||||
 | 
					    private Long id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** 文件名称 */
 | 
				
			||||||
 | 
					    @Excel(name = "文件名称")
 | 
				
			||||||
 | 
					    private String name;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** 文件类型(如:jpg、pdf、exe等) */
 | 
				
			||||||
 | 
					    @Excel(name = "文件类型", readConverterExp = "如=:jpg、pdf、exe等")
 | 
				
			||||||
 | 
					    private String type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** 文件描述 */
 | 
				
			||||||
 | 
					    @Excel(name = "文件描述")
 | 
				
			||||||
 | 
					    private String description;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** 文件大小(KB) */
 | 
				
			||||||
 | 
					    @Excel(name = "文件大小", readConverterExp = "K=B")
 | 
				
			||||||
 | 
					    private Long fileSize;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** 文件MD5值 */
 | 
				
			||||||
 | 
					    @Excel(name = "文件MD5值")
 | 
				
			||||||
 | 
					    private String md5;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** 文件存储路径 */
 | 
				
			||||||
 | 
					    @Excel(name = "文件存储路径")
 | 
				
			||||||
 | 
					    private String path;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setId(Long id) 
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.id = id;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Long getId() 
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return id;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setName(String name) 
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.name = name;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getName() 
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return name;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setType(String type) 
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.type = type;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getType() 
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return type;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setDescription(String description) 
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.description = description;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getDescription() 
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return description;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setFileSize(Long fileSize) 
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.fileSize = fileSize;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public Long getFileSize() 
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return fileSize;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setMd5(String md5) 
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.md5 = md5;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getMd5() 
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return md5;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setPath(String path) 
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.path = path;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getPath() 
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return path;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public String toString() {
 | 
				
			||||||
 | 
					        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
 | 
				
			||||||
 | 
					            .append("id", getId())
 | 
				
			||||||
 | 
					            .append("name", getName())
 | 
				
			||||||
 | 
					            .append("type", getType())
 | 
				
			||||||
 | 
					            .append("description", getDescription())
 | 
				
			||||||
 | 
					            .append("fileSize", getFileSize())
 | 
				
			||||||
 | 
					            .append("md5", getMd5())
 | 
				
			||||||
 | 
					            .append("path", getPath())
 | 
				
			||||||
 | 
					            .append("createTime", getCreateTime())
 | 
				
			||||||
 | 
					            .append("updateTime", getUpdateTime())
 | 
				
			||||||
 | 
					            .append("createBy", getCreateBy())
 | 
				
			||||||
 | 
					            .append("updateBy", getUpdateBy())
 | 
				
			||||||
 | 
					            .toString();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,116 @@
 | 
				
			|||||||
 | 
					package com.ruoyi.rocketmq.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;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 客户端策略关联对象 rm_policy_device_details
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @author gyt
 | 
				
			||||||
 | 
					 * @date 2025-10-22
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					public class RmPolicyDeviceDetails extends BaseEntity
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    private static final long serialVersionUID = 1L;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** 主键ID */
 | 
				
			||||||
 | 
					    private Long id;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** 客户端ID */
 | 
				
			||||||
 | 
					    @Excel(name = "客户端ID")
 | 
				
			||||||
 | 
					    private String clientId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** 策略ID */
 | 
				
			||||||
 | 
					    @Excel(name = "策略ID")
 | 
				
			||||||
 | 
					    private String policyId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** 脚本ID */
 | 
				
			||||||
 | 
					    @Excel(name = "脚本ID")
 | 
				
			||||||
 | 
					    private String scriptId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** 版本ID */
 | 
				
			||||||
 | 
					    @Excel(name = "版本ID")
 | 
				
			||||||
 | 
					    private String versionId;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** 状态(0-未下发,1-已下发) */
 | 
				
			||||||
 | 
					    @Excel(name = "状态(0-未下发,1-已下发)")
 | 
				
			||||||
 | 
					    private String policyStatus;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    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 setPolicyId(String policyId) 
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.policyId = policyId;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getPolicyId() 
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return policyId;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setScriptId(String scriptId) 
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.scriptId = scriptId;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getScriptId() 
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return scriptId;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setVersionId(String versionId) 
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.versionId = versionId;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getVersionId() 
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return versionId;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void setPolicyStatus(String policyStatus) 
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        this.policyStatus = policyStatus;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public String getPolicyStatus() 
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return policyStatus;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public String toString() {
 | 
				
			||||||
 | 
					        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
 | 
				
			||||||
 | 
					            .append("id", getId())
 | 
				
			||||||
 | 
					            .append("clientId", getClientId())
 | 
				
			||||||
 | 
					            .append("policyId", getPolicyId())
 | 
				
			||||||
 | 
					            .append("scriptId", getScriptId())
 | 
				
			||||||
 | 
					            .append("versionId", getVersionId())
 | 
				
			||||||
 | 
					            .append("policyStatus", getPolicyStatus())
 | 
				
			||||||
 | 
					            .append("createTime", getCreateTime())
 | 
				
			||||||
 | 
					            .append("updateTime", getUpdateTime())
 | 
				
			||||||
 | 
					            .append("createBy", getCreateBy())
 | 
				
			||||||
 | 
					            .append("updateBy", getUpdateBy())
 | 
				
			||||||
 | 
					            .toString();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,15 @@
 | 
				
			|||||||
 | 
					package com.ruoyi.rocketmq.domain.vo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Data
 | 
				
			||||||
 | 
					public class AgentUpdateMsgVo {
 | 
				
			||||||
 | 
					    /**文件地址,外网HTTP(S)地址 */
 | 
				
			||||||
 | 
					    private String fileUrl;
 | 
				
			||||||
 | 
					    /** 文件MD5 */
 | 
				
			||||||
 | 
					    private String fileMd5;
 | 
				
			||||||
 | 
					    /** 执行方式:0、立即执行;1、定时执行; */
 | 
				
			||||||
 | 
					    private Integer method;
 | 
				
			||||||
 | 
					    /** 定时时间,执行方式为1、定时执行时该字段必传 */
 | 
				
			||||||
 | 
					    private long policyTime;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,18 @@
 | 
				
			|||||||
 | 
					package com.ruoyi.rocketmq.domain.vo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.time.Instant;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Data
 | 
				
			||||||
 | 
					public class PolicyTypeVo {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /** 服务器监控策略信息 */
 | 
				
			||||||
 | 
					    private String monitors;
 | 
				
			||||||
 | 
					    /** 服务器脚本策略信息 */
 | 
				
			||||||
 | 
					    private String scripts;
 | 
				
			||||||
 | 
					    /** agent更新信息 */
 | 
				
			||||||
 | 
					    private String versions;
 | 
				
			||||||
 | 
					    /** 时间戳 */
 | 
				
			||||||
 | 
					    private Long timestamp = Instant.now().getEpochSecond();
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,14 @@
 | 
				
			|||||||
 | 
					package com.ruoyi.rocketmq.domain.vo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.time.Instant;
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Data
 | 
				
			||||||
 | 
					public class PolicyVo<T> {
 | 
				
			||||||
 | 
					    /** 更新时间戳 */
 | 
				
			||||||
 | 
					    private Long upTime = Instant.now().getEpochSecond();
 | 
				
			||||||
 | 
					    /** 更新内容 */
 | 
				
			||||||
 | 
					    private List<T> contents;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,17 @@
 | 
				
			|||||||
 | 
					package com.ruoyi.rocketmq.domain.vo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import lombok.Data;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					@Data
 | 
				
			||||||
 | 
					public class ServerScriptPolicyVo {
 | 
				
			||||||
 | 
					    /** 策略名称 */
 | 
				
			||||||
 | 
					    private String policyName;
 | 
				
			||||||
 | 
					    /** 外网Http(s)地址 */
 | 
				
			||||||
 | 
					    private String fileUrl;
 | 
				
			||||||
 | 
					    /** 脚本参数 */
 | 
				
			||||||
 | 
					    private String commandParams;
 | 
				
			||||||
 | 
					    /** 执行方式 */
 | 
				
			||||||
 | 
					    private int method;
 | 
				
			||||||
 | 
					    /** 定时时间 精确到秒的时间戳 */
 | 
				
			||||||
 | 
					    private Long policyTime;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -1,7 +1,5 @@
 | 
				
			|||||||
package com.ruoyi.rocketmq.handler;
 | 
					package com.ruoyi.rocketmq.handler;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.fasterxml.jackson.databind.JsonNode;
 | 
					 | 
				
			||||||
import com.fasterxml.jackson.databind.ObjectMapper;
 | 
					 | 
				
			||||||
import com.ruoyi.common.core.constant.SecurityConstants;
 | 
					import com.ruoyi.common.core.constant.SecurityConstants;
 | 
				
			||||||
import com.ruoyi.common.core.domain.R;
 | 
					import com.ruoyi.common.core.domain.R;
 | 
				
			||||||
import com.ruoyi.common.core.enums.MsgEnum;
 | 
					import com.ruoyi.common.core.enums.MsgEnum;
 | 
				
			||||||
@@ -14,9 +12,11 @@ import com.ruoyi.rocketmq.domain.vo.RspVo;
 | 
				
			|||||||
import com.ruoyi.rocketmq.service.*;
 | 
					import com.ruoyi.rocketmq.service.*;
 | 
				
			||||||
import com.ruoyi.rocketmq.utils.DataProcessUtil;
 | 
					import com.ruoyi.rocketmq.utils.DataProcessUtil;
 | 
				
			||||||
import com.ruoyi.rocketmq.utils.JsonDataParser;
 | 
					import com.ruoyi.rocketmq.utils.JsonDataParser;
 | 
				
			||||||
import com.ruoyi.rocketmq.utils.SwitchJsonDataParser;
 | 
					 | 
				
			||||||
import com.ruoyi.system.api.RemoteRevenueConfigService;
 | 
					import com.ruoyi.system.api.RemoteRevenueConfigService;
 | 
				
			||||||
import com.ruoyi.system.api.domain.*;
 | 
					import com.ruoyi.system.api.domain.EpsInitialTrafficDataRemote;
 | 
				
			||||||
 | 
					import com.ruoyi.system.api.domain.NetworkInfo;
 | 
				
			||||||
 | 
					import com.ruoyi.system.api.domain.RmRegisterMsgRemote;
 | 
				
			||||||
 | 
					import com.ruoyi.system.api.domain.RmResourceRegistrationRemote;
 | 
				
			||||||
import lombok.extern.slf4j.Slf4j;
 | 
					import lombok.extern.slf4j.Slf4j;
 | 
				
			||||||
import org.springframework.beans.BeanUtils;
 | 
					import org.springframework.beans.BeanUtils;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
@@ -29,12 +29,8 @@ import org.springframework.scheduling.annotation.Scheduled;
 | 
				
			|||||||
import org.springframework.stereotype.Component;
 | 
					import org.springframework.stereotype.Component;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import javax.annotation.PostConstruct;
 | 
					import javax.annotation.PostConstruct;
 | 
				
			||||||
import java.math.BigDecimal;
 | 
					 | 
				
			||||||
import java.math.RoundingMode;
 | 
					 | 
				
			||||||
import java.util.*;
 | 
					import java.util.*;
 | 
				
			||||||
import java.util.function.Consumer;
 | 
					import java.util.function.Consumer;
 | 
				
			||||||
import java.util.function.Function;
 | 
					 | 
				
			||||||
import java.util.stream.Collectors;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 设备消息处理器
 | 
					 * 设备消息处理器
 | 
				
			||||||
@@ -72,24 +68,8 @@ public class MessageHandler {
 | 
				
			|||||||
    @Autowired
 | 
					    @Autowired
 | 
				
			||||||
    private IInitialMountPointInfoService initialMountPointInfoService;
 | 
					    private IInitialMountPointInfoService initialMountPointInfoService;
 | 
				
			||||||
    @Autowired
 | 
					    @Autowired
 | 
				
			||||||
    private IInitialSwitchInfoService initialSwitchInfoService;
 | 
					 | 
				
			||||||
    @Autowired
 | 
					 | 
				
			||||||
    private IInitialSystemInfoService initialSystemInfoService;
 | 
					 | 
				
			||||||
    @Autowired
 | 
					 | 
				
			||||||
    private IInitialSwitchInfoTempService initialSwitchInfoTempService;
 | 
					 | 
				
			||||||
    @Autowired
 | 
					 | 
				
			||||||
    private IInitialHeartbeatListenLogService initialHeartbeatListenLog;
 | 
					    private IInitialHeartbeatListenLogService initialHeartbeatListenLog;
 | 
				
			||||||
    @Autowired
 | 
					    @Autowired
 | 
				
			||||||
    private IInitialSwitchPowerSupplyService initialSwitchPowerSupplyService;
 | 
					 | 
				
			||||||
    @Autowired
 | 
					 | 
				
			||||||
    private IInitialSwitchFanInfoService initialSwitchFanInfoService;
 | 
					 | 
				
			||||||
    @Autowired
 | 
					 | 
				
			||||||
    private IInitialSwitchMpuInfoService initialSwitchMpuInfoService;
 | 
					 | 
				
			||||||
    @Autowired
 | 
					 | 
				
			||||||
    private IInitialSwitchOpticalModuleService initialSwitchOpticalModuleService;
 | 
					 | 
				
			||||||
    @Autowired
 | 
					 | 
				
			||||||
    private IInitialSwitchOtherCollectDataService insertInitialSwitchOtherInfo;
 | 
					 | 
				
			||||||
    @Autowired
 | 
					 | 
				
			||||||
    private IInitialSystemOtherCollectDataService iInitialSystemOtherCollectDataService;
 | 
					    private IInitialSystemOtherCollectDataService iInitialSystemOtherCollectDataService;
 | 
				
			||||||
    @Autowired
 | 
					    @Autowired
 | 
				
			||||||
    private IRmResourceRemoteService rmResourceRemoteService;
 | 
					    private IRmResourceRemoteService rmResourceRemoteService;
 | 
				
			||||||
@@ -99,8 +79,10 @@ public class MessageHandler {
 | 
				
			|||||||
    private DataProcessUtil dataProcessUtil;
 | 
					    private DataProcessUtil dataProcessUtil;
 | 
				
			||||||
    @Autowired
 | 
					    @Autowired
 | 
				
			||||||
    private IRmNetworkInterfaceService rmNetworkInterfaceService;
 | 
					    private IRmNetworkInterfaceService rmNetworkInterfaceService;
 | 
				
			||||||
    // 在类中添加
 | 
					    @Autowired
 | 
				
			||||||
    private static final ObjectMapper objectMapper = new ObjectMapper();
 | 
					    private IRmMonitorPolicyService rmMonitorPolicyService;
 | 
				
			||||||
 | 
					    @Autowired
 | 
				
			||||||
 | 
					    private IRmDeploymentPolicyService rmDeploymentPolicyService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@@ -108,14 +90,6 @@ public class MessageHandler {
 | 
				
			|||||||
     */
 | 
					     */
 | 
				
			||||||
    @PostConstruct
 | 
					    @PostConstruct
 | 
				
			||||||
    public void init() {
 | 
					    public void init() {
 | 
				
			||||||
        // 所有应答类消息使用同一个处理器
 | 
					 | 
				
			||||||
//        registerHandler(MsgEnum.注册应答.getValue(), this::handleResponseMessage);
 | 
					 | 
				
			||||||
//        registerHandler(MsgEnum.断开应答.getValue(), this::handleResponseMessage);
 | 
					 | 
				
			||||||
//        registerHandler(MsgEnum.开启系统采集应答.getValue(), this::handleResponseMessage);
 | 
					 | 
				
			||||||
//        registerHandler(MsgEnum.关闭系统采集应答.getValue(), this::handleResponseMessage);
 | 
					 | 
				
			||||||
//        registerHandler(MsgEnum.开启交换机采集应答.getValue(), this::handleResponseMessage);
 | 
					 | 
				
			||||||
//        registerHandler(MsgEnum.关闭交换机采集应答.getValue(), this::handleResponseMessage);
 | 
					 | 
				
			||||||
//        registerHandler(MsgEnum.告警设置应答.getValue(), this::handleResponseMessage);
 | 
					 | 
				
			||||||
//        registerHandler(MsgEnum.执行脚本策略应答.getValue(), this::handleScriptRspMessage);
 | 
					//        registerHandler(MsgEnum.执行脚本策略应答.getValue(), this::handleScriptRspMessage);
 | 
				
			||||||
//        registerHandler(MsgEnum.Agent版本更新应答.getValue(), this::handleAgentUpdateRspMessage);
 | 
					//        registerHandler(MsgEnum.Agent版本更新应答.getValue(), this::handleAgentUpdateRspMessage);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -129,9 +103,7 @@ public class MessageHandler {
 | 
				
			|||||||
//        registerHandler(MsgEnum.网络上报.getValue(), this::handleNetMessage);
 | 
					//        registerHandler(MsgEnum.网络上报.getValue(), this::handleNetMessage);
 | 
				
			||||||
//        registerHandler(MsgEnum.挂载上报.getValue(), this::handleMountPointMessage);
 | 
					//        registerHandler(MsgEnum.挂载上报.getValue(), this::handleMountPointMessage);
 | 
				
			||||||
//        registerHandler(MsgEnum.系统其他上报.getValue(), this::handleOtherSystemMessage);
 | 
					//        registerHandler(MsgEnum.系统其他上报.getValue(), this::handleOtherSystemMessage);
 | 
				
			||||||
//        registerHandler(MsgEnum.交换机上报.getValue(), this::handleSwitchDataMessage);
 | 
					        registerHandler(MsgEnum.心跳上报.getValue(), this::handleHeartbeatMessage);
 | 
				
			||||||
//        registerHandler(MsgEnum.心跳上报.getValue(), this::handleHeartbeatMessage);
 | 
					 | 
				
			||||||
//        registerHandler(MsgEnum.多公网IP探测.getValue(), this::handlePublicIpDetectMessage);
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
@@ -141,8 +113,12 @@ public class MessageHandler {
 | 
				
			|||||||
    private void handleNewPolicyMessage(DeviceMessage deviceMessage) {
 | 
					    private void handleNewPolicyMessage(DeviceMessage deviceMessage) {
 | 
				
			||||||
        List<RegisterMsgVo> interfaces = JsonDataParser.parseJsonData(deviceMessage.getData(), RegisterMsgVo.class);
 | 
					        List<RegisterMsgVo> interfaces = JsonDataParser.parseJsonData(deviceMessage.getData(), RegisterMsgVo.class);
 | 
				
			||||||
        if(!interfaces.isEmpty()) {
 | 
					        if(!interfaces.isEmpty()) {
 | 
				
			||||||
            // 获取该服务器的策略信息
 | 
					            RegisterMsgVo registerMsgVo = interfaces.get(0);
 | 
				
			||||||
 | 
					            String clientId = registerMsgVo.getClientId();
 | 
				
			||||||
 | 
					            // 如果未下发监控策略,下发
 | 
				
			||||||
 | 
					            rmMonitorPolicyService.issuePolicyMsgByClientId(clientId);
 | 
				
			||||||
 | 
					            // 如果未下发服务器脚本策略,下发
 | 
				
			||||||
 | 
					            rmDeploymentPolicyService.issueDeployPolicyMsgByClientId(clientId);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -253,17 +229,6 @@ public class MessageHandler {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * 多公网IP探测
 | 
					 | 
				
			||||||
     * @param message
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    private void handlePublicIpDetectMessage(DeviceMessage message) {
 | 
					 | 
				
			||||||
        List<RspVo> rspVoList = JsonDataParser.parseJsonData(message.getData(), RspVo.class);
 | 
					 | 
				
			||||||
        //TODO 公网信息入库
 | 
					 | 
				
			||||||
        // 查询公网信息
 | 
					 | 
				
			||||||
        // 如果公网信息有变化修改公网IP状态为需绑定
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * agent更新响应
 | 
					     * agent更新响应
 | 
				
			||||||
     * @param message
 | 
					     * @param message
 | 
				
			||||||
@@ -448,248 +413,9 @@ public class MessageHandler {
 | 
				
			|||||||
            throw new RuntimeException("挂载点data数据为空");
 | 
					            throw new RuntimeException("挂载点data数据为空");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * 交换机所有数据入库
 | 
					 | 
				
			||||||
     * @param message
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    private void handleSwitchDataMessage(DeviceMessage message) {
 | 
					 | 
				
			||||||
        List<CollectDataVo> switchData = JsonDataParser.parseJsonData(message.getData(), CollectDataVo.class);
 | 
					 | 
				
			||||||
        if(!switchData.isEmpty()){
 | 
					 | 
				
			||||||
            CollectDataVo switchDataVo = switchData.get(0);
 | 
					 | 
				
			||||||
            switch(switchDataVo.getType()){
 | 
					 | 
				
			||||||
                case "switchNetCollect":
 | 
					 | 
				
			||||||
                    handleSwitchNetMessage(switchDataVo, message.getClientId());
 | 
					 | 
				
			||||||
                    break;
 | 
					 | 
				
			||||||
                case "switchPwrCollect":
 | 
					 | 
				
			||||||
                    handleSwitchPwrMessage(switchDataVo, message.getClientId());
 | 
					 | 
				
			||||||
                    break;
 | 
					 | 
				
			||||||
                case "switchModuleCollect":
 | 
					 | 
				
			||||||
                    handleSwitchModuleMessage(switchDataVo, message.getClientId());
 | 
					 | 
				
			||||||
                    break;
 | 
					 | 
				
			||||||
                case "switchMpuCollect":
 | 
					 | 
				
			||||||
                    handleSwitchMpuMessage(switchDataVo, message.getClientId());
 | 
					 | 
				
			||||||
                    break;
 | 
					 | 
				
			||||||
                case "switchFanCollect":
 | 
					 | 
				
			||||||
                    handleSwitchFanMessage(switchDataVo, message.getClientId());
 | 
					 | 
				
			||||||
                    break;
 | 
					 | 
				
			||||||
                default:
 | 
					 | 
				
			||||||
                    handleSwitchOtherMessage(switchDataVo, message.getClientId());
 | 
					 | 
				
			||||||
                    break;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }else{
 | 
					 | 
				
			||||||
            throw new RuntimeException("交换机data数据为空");
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * 电源发现数据
 | 
					 | 
				
			||||||
     * @param switchDataVo
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    private void handleSwitchPwrMessage(CollectDataVo switchDataVo, String clientId){
 | 
					 | 
				
			||||||
        List<InitialSwitchPowerSupply> powerSupplyList = SwitchJsonDataParser.parseJsonData(switchDataVo.getValue(), InitialSwitchPowerSupply.class);
 | 
					 | 
				
			||||||
        if (!powerSupplyList.isEmpty()){
 | 
					 | 
				
			||||||
            for (InitialSwitchPowerSupply insertData : powerSupplyList) {
 | 
					 | 
				
			||||||
                // 时间戳转换
 | 
					 | 
				
			||||||
                long timestamp = switchDataVo.getTimestamp();
 | 
					 | 
				
			||||||
                long millis = timestamp * 1000;
 | 
					 | 
				
			||||||
                Date createTime = new Date(millis / 1000 * 1000); // 去除毫秒
 | 
					 | 
				
			||||||
                insertData.setClientId(clientId);
 | 
					 | 
				
			||||||
                insertData.setCreateTime(createTime);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            initialSwitchPowerSupplyService.insertBatchInitialSwitchPowerSupply(powerSupplyList);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * 光模块发现数据
 | 
					 | 
				
			||||||
     * @param switchDataVo
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    private void handleSwitchModuleMessage(CollectDataVo switchDataVo, String clientId){
 | 
					 | 
				
			||||||
        List<InitialSwitchOpticalModule> moduleList = SwitchJsonDataParser.parseJsonData(switchDataVo.getValue(), InitialSwitchOpticalModule.class);
 | 
					 | 
				
			||||||
        if (!moduleList.isEmpty()){
 | 
					 | 
				
			||||||
            for (InitialSwitchOpticalModule insertData : moduleList) {
 | 
					 | 
				
			||||||
                // 时间戳转换
 | 
					 | 
				
			||||||
                long timestamp = switchDataVo.getTimestamp();
 | 
					 | 
				
			||||||
                long millis = timestamp * 1000;
 | 
					 | 
				
			||||||
                Date createTime = new Date(millis / 1000 * 1000); // 去除毫秒
 | 
					 | 
				
			||||||
                insertData.setClientId(clientId);
 | 
					 | 
				
			||||||
                insertData.setCreateTime(createTime);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            initialSwitchOpticalModuleService.batchInitialSwitchOpticalModule(moduleList);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * MPU发现数据
 | 
					 | 
				
			||||||
     * @param switchDataVo
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    private void handleSwitchMpuMessage(CollectDataVo switchDataVo, String clientId){
 | 
					 | 
				
			||||||
        List<InitialSwitchMpuInfo> mpuList = SwitchJsonDataParser.parseJsonData(switchDataVo.getValue(), InitialSwitchMpuInfo.class);
 | 
					 | 
				
			||||||
        if (!mpuList.isEmpty()){
 | 
					 | 
				
			||||||
            for (InitialSwitchMpuInfo insertData : mpuList) {
 | 
					 | 
				
			||||||
                // 时间戳转换
 | 
					 | 
				
			||||||
                long timestamp = switchDataVo.getTimestamp();
 | 
					 | 
				
			||||||
                long millis = timestamp * 1000;
 | 
					 | 
				
			||||||
                Date createTime = new Date(millis / 1000 * 1000); // 去除毫秒
 | 
					 | 
				
			||||||
                insertData.setClientId(clientId);
 | 
					 | 
				
			||||||
                insertData.setCreateTime(createTime);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            initialSwitchMpuInfoService.insertBatchInitialSwitchMpuInfo(mpuList);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * 风扇发现数据
 | 
					 | 
				
			||||||
     * @param switchDataVo
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    private void handleSwitchFanMessage(CollectDataVo switchDataVo, String clientId){
 | 
					 | 
				
			||||||
        List<InitialSwitchFanInfo> fanList = SwitchJsonDataParser.parseJsonData(switchDataVo.getValue(), InitialSwitchFanInfo.class);
 | 
					 | 
				
			||||||
        if (!fanList.isEmpty()){
 | 
					 | 
				
			||||||
            for (InitialSwitchFanInfo insertData : fanList) {
 | 
					 | 
				
			||||||
                // 时间戳转换
 | 
					 | 
				
			||||||
                long timestamp = switchDataVo.getTimestamp();
 | 
					 | 
				
			||||||
                long millis = timestamp * 1000;
 | 
					 | 
				
			||||||
                Date createTime = new Date(millis / 1000 * 1000); // 去除毫秒
 | 
					 | 
				
			||||||
                insertData.setClientId(clientId);
 | 
					 | 
				
			||||||
                insertData.setCreateTime(createTime);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            initialSwitchFanInfoService.insertBatchInitialSwitchFanInfo(fanList);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * 其他发现数据(默认处理)
 | 
					 | 
				
			||||||
     * @param switchDataVo
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    private void handleSwitchOtherMessage(CollectDataVo switchDataVo, String clientId) {
 | 
					 | 
				
			||||||
        if (switchDataVo != null) {
 | 
					 | 
				
			||||||
            try {
 | 
					 | 
				
			||||||
                InitialSwitchOtherCollectData insertData = new InitialSwitchOtherCollectData();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                // 设置基本信息
 | 
					 | 
				
			||||||
                long timestamp = switchDataVo.getTimestamp();
 | 
					 | 
				
			||||||
                Date createTime = new Date(timestamp * 1000 / 1000 * 1000);
 | 
					 | 
				
			||||||
                insertData.setClientId(clientId);
 | 
					 | 
				
			||||||
                insertData.setCreateTime(createTime);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                String value = switchDataVo.getValue();
 | 
					 | 
				
			||||||
                JsonNode jsonNode = objectMapper.readTree(value);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                // 处理数组中的字符串JSON
 | 
					 | 
				
			||||||
                if (jsonNode.isArray() && jsonNode.size() > 0) {
 | 
					 | 
				
			||||||
                    JsonNode firstElement = jsonNode.get(0);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                    if (firstElement.isTextual()) {
 | 
					 | 
				
			||||||
                        // 二次解析JSON字符串
 | 
					 | 
				
			||||||
                        JsonNode innerJsonNode = objectMapper.readTree(firstElement.asText());
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                        if (innerJsonNode.isObject()) {
 | 
					 | 
				
			||||||
                            Iterator<Map.Entry<String, JsonNode>> fields = innerJsonNode.fields();
 | 
					 | 
				
			||||||
                            if (fields.hasNext()) {
 | 
					 | 
				
			||||||
                                Map.Entry<String, JsonNode> entry = fields.next();
 | 
					 | 
				
			||||||
                                String fieldName = entry.getKey();
 | 
					 | 
				
			||||||
                                String fieldValue = entry.getValue().asText();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                                insertData.setCollectType(fieldName);
 | 
					 | 
				
			||||||
                                if (!"null".equals(fieldValue)) {
 | 
					 | 
				
			||||||
                                    insertData.setCollectValue(fieldValue);
 | 
					 | 
				
			||||||
                                    insertInitialSwitchOtherInfo.insertInitialSwitchOtherCollectData(insertData);
 | 
					 | 
				
			||||||
                                }
 | 
					 | 
				
			||||||
                            }
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            } catch (Exception e) {
 | 
					 | 
				
			||||||
                log.error("解析JSON数据失败: {}, value: {}", e.getMessage(), switchDataVo.getValue(), e);
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    /**
 | 
					 | 
				
			||||||
     * 交换机网卡信息数据入库
 | 
					 | 
				
			||||||
     * @param switchDataVo
 | 
					 | 
				
			||||||
     */
 | 
					 | 
				
			||||||
    private void handleSwitchNetMessage(CollectDataVo switchDataVo, String clientId) {
 | 
					 | 
				
			||||||
        List<InitialSwitchInfo> switchInfos = SwitchJsonDataParser.parseJsonData(switchDataVo.getValue(), InitialSwitchInfo.class);
 | 
					 | 
				
			||||||
        if(!switchInfos.isEmpty()){
 | 
					 | 
				
			||||||
            // 根据clientId查询交换机ip
 | 
					 | 
				
			||||||
            RmResourceRegistrationRemote queryParam = new RmResourceRegistrationRemote();
 | 
					 | 
				
			||||||
            queryParam.setHardwareSn(clientId);
 | 
					 | 
				
			||||||
            R<RmResourceRegistrationRemote> registMsgR = remoteRevenueConfigService.getListByHardwareSn(queryParam, SecurityConstants.INNER);
 | 
					 | 
				
			||||||
            if(registMsgR != null){
 | 
					 | 
				
			||||||
                RmResourceRegistrationRemote registMsg = registMsgR.getData();
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            // 时间戳转换
 | 
					 | 
				
			||||||
            long timestamp = switchDataVo.getTimestamp();
 | 
					 | 
				
			||||||
            long millis = timestamp * 1000;
 | 
					 | 
				
			||||||
            Date createTime = new Date(millis / 1000 * 1000); // 去除毫秒
 | 
					 | 
				
			||||||
            String timeStr = DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss",createTime);
 | 
					 | 
				
			||||||
            // 查询临时表信息,计算实际流量值
 | 
					 | 
				
			||||||
            InitialSwitchInfoTemp temp = new InitialSwitchInfoTemp();
 | 
					 | 
				
			||||||
            temp.setClientId(clientId);
 | 
					 | 
				
			||||||
            List<InitialSwitchInfoTemp> tempList = initialSwitchInfoTempService.selectInitialSwitchInfoTempList(temp);
 | 
					 | 
				
			||||||
            if(!tempList.isEmpty()){
 | 
					 | 
				
			||||||
                // 1. 构建快速查找的Map
 | 
					 | 
				
			||||||
                Map<String, InitialSwitchInfoTemp> tempMap = tempList.stream()
 | 
					 | 
				
			||||||
                        .collect(Collectors.toMap(
 | 
					 | 
				
			||||||
                                InitialSwitchInfoTemp::getName,
 | 
					 | 
				
			||||||
                                Function.identity(),
 | 
					 | 
				
			||||||
                                (existing, replacement) -> existing
 | 
					 | 
				
			||||||
                        ));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                // 2. 预计算除数(避免重复创建对象)
 | 
					 | 
				
			||||||
                BigDecimal divisor = new BigDecimal(300);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                // 3. 计算速度
 | 
					 | 
				
			||||||
                switchInfos.forEach(switchInfo -> {
 | 
					 | 
				
			||||||
                    switchInfo.setClientId(clientId);
 | 
					 | 
				
			||||||
                    switchInfo.setCreateTime(createTime);
 | 
					 | 
				
			||||||
                    if(registMsgR != null && registMsgR.getData()!=null && registMsgR.getData().getSnmpCollectAddr()!=null){
 | 
					 | 
				
			||||||
                        switchInfo.setSwitchIp(registMsgR.getData().getSnmpCollectAddr());
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                    InitialSwitchInfoTemp tempInfo = tempMap.get(switchInfo.getName());
 | 
					 | 
				
			||||||
                    if (tempInfo != null) {
 | 
					 | 
				
			||||||
                        // 计算inSpeed
 | 
					 | 
				
			||||||
                        if (switchInfo.getInBytes() != null && tempInfo.getInBytes() != null) {
 | 
					 | 
				
			||||||
                            BigDecimal inDiff = switchInfo.getInBytes().subtract(tempInfo.getInBytes());
 | 
					 | 
				
			||||||
                            // 字节转为bit
 | 
					 | 
				
			||||||
                            BigDecimal inDiffBit = inDiff.multiply(new BigDecimal(8)).setScale(0, RoundingMode.HALF_UP);
 | 
					 | 
				
			||||||
                            switchInfo.setInSpeed(inDiffBit.divide(divisor, 2, RoundingMode.HALF_UP));
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                        // 计算outSpeed
 | 
					 | 
				
			||||||
                        if (switchInfo.getOutBytes() != null && tempInfo.getOutBytes() != null) {
 | 
					 | 
				
			||||||
                            BigDecimal outDiff = switchInfo.getOutBytes().subtract(tempInfo.getOutBytes());
 | 
					 | 
				
			||||||
                            // 字节转为bit
 | 
					 | 
				
			||||||
                            BigDecimal outDiffBit = outDiff.multiply(new BigDecimal(8)).setScale(0, RoundingMode.HALF_UP);
 | 
					 | 
				
			||||||
                            switchInfo.setOutSpeed(outDiffBit.divide(divisor, 2, RoundingMode.HALF_UP));
 | 
					 | 
				
			||||||
                        }
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
            }else{
 | 
					 | 
				
			||||||
                switchInfos.forEach(switchInfo -> {
 | 
					 | 
				
			||||||
                    switchInfo.setClientId(clientId);
 | 
					 | 
				
			||||||
                    switchInfo.setCreateTime(createTime);
 | 
					 | 
				
			||||||
                    if(registMsgR != null && registMsgR.getData()!=null && registMsgR.getData().getSnmpCollectAddr()!=null){
 | 
					 | 
				
			||||||
                        switchInfo.setSwitchIp(registMsgR.getData().getSnmpCollectAddr());
 | 
					 | 
				
			||||||
                    }
 | 
					 | 
				
			||||||
                });
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            // 清空临时表对应switch信息
 | 
					 | 
				
			||||||
            initialSwitchInfoTempService.truncateSwitchInfoTemp(clientId);
 | 
					 | 
				
			||||||
            // 临时表 用来计算inSpeed outSeppd
 | 
					 | 
				
			||||||
            initialSwitchInfoTempService.batchInsertInitialSwitchInfoTemp(switchInfos);
 | 
					 | 
				
			||||||
            // 初始交换机数据入库
 | 
					 | 
				
			||||||
            initialSwitchInfoService.batchInsertInitialSwitchInfo(switchInfos);
 | 
					 | 
				
			||||||
            // 业务表入库
 | 
					 | 
				
			||||||
            InitialSwitchInfoDetailsRemote detailsRemote = new InitialSwitchInfoDetailsRemote();
 | 
					 | 
				
			||||||
            detailsRemote.setClientId(clientId);
 | 
					 | 
				
			||||||
            detailsRemote.setStartTime(timeStr);
 | 
					 | 
				
			||||||
            detailsRemote.setEndTime(timeStr);
 | 
					 | 
				
			||||||
            remoteRevenueConfigService.autoSaveSwitchTraffic(detailsRemote, SecurityConstants.INNER);
 | 
					 | 
				
			||||||
        }else{
 | 
					 | 
				
			||||||
            throw new RuntimeException("交换机data数据为空");
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 系统其他信息
 | 
					     * 系统其他信息
 | 
				
			||||||
@@ -733,7 +459,11 @@ public class MessageHandler {
 | 
				
			|||||||
            InitialHeartbeatListen heartbeat = heartbeats.get(0);
 | 
					            InitialHeartbeatListen heartbeat = heartbeats.get(0);
 | 
				
			||||||
            String clientId = message.getClientId();
 | 
					            String clientId = message.getClientId();
 | 
				
			||||||
            log.debug("处理心跳消息,客户端ID: {}, 时间: {}", clientId, heartbeat.getTimestamp());
 | 
					            log.debug("处理心跳消息,客户端ID: {}, 时间: {}", clientId, heartbeat.getTimestamp());
 | 
				
			||||||
 | 
					            // 添加逻辑节点标识
 | 
				
			||||||
 | 
					            RmResourceRegistrationRemote updateData = new RmResourceRegistrationRemote();
 | 
				
			||||||
 | 
					            updateData.setClientId(message.getClientId());
 | 
				
			||||||
 | 
					            updateData.setLogicalNodeId(heartbeat.getLogicalNode());
 | 
				
			||||||
 | 
					            remoteRevenueConfigService.innerupdateRegist(updateData, SecurityConstants.INNER);
 | 
				
			||||||
            // 使用Redis存储状态
 | 
					            // 使用Redis存储状态
 | 
				
			||||||
            String statusKey = HEARTBEAT_STATUS_PREFIX + clientId;
 | 
					            String statusKey = HEARTBEAT_STATUS_PREFIX + clientId;
 | 
				
			||||||
            String timeKey = HEARTBEAT_TIME_PREFIX + clientId;
 | 
					            String timeKey = HEARTBEAT_TIME_PREFIX + clientId;
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,8 +1,9 @@
 | 
				
			|||||||
package com.ruoyi.rocketmq.mapper;
 | 
					package com.ruoyi.rocketmq.mapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
import com.ruoyi.rocketmq.domain.RmDeploymentPolicy;
 | 
					import com.ruoyi.rocketmq.domain.RmDeploymentPolicy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 服务器脚本策略Mapper接口
 | 
					 * 服务器脚本策略Mapper接口
 | 
				
			||||||
 * 
 | 
					 * 
 | 
				
			||||||
@@ -58,4 +59,11 @@ public interface RmDeploymentPolicyMapper
 | 
				
			|||||||
     * @return 结果
 | 
					     * @return 结果
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public int deleteRmDeploymentPolicyByIds(Long[] ids);
 | 
					    public int deleteRmDeploymentPolicyByIds(Long[] ids);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 根据clientId查询未下发的服务器脚本策略
 | 
				
			||||||
 | 
					     * @param queryParam
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    List<RmDeploymentPolicy> selectRmDeploymentPolicyByClientId(RmDeploymentPolicy queryParam);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,61 @@
 | 
				
			|||||||
 | 
					package com.ruoyi.rocketmq.mapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.domain.RmFileInfo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 文件信息Mapper接口
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @author gyt
 | 
				
			||||||
 | 
					 * @date 2025-09-15
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					public interface RmFileInfoMapper 
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询文件信息
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param id 文件信息主键
 | 
				
			||||||
 | 
					     * @return 文件信息
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public RmFileInfo selectRmFileInfoById(Long id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询文件信息列表
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param rmFileInfo 文件信息
 | 
				
			||||||
 | 
					     * @return 文件信息集合
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public List<RmFileInfo> selectRmFileInfoList(RmFileInfo rmFileInfo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 新增文件信息
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param rmFileInfo 文件信息
 | 
				
			||||||
 | 
					     * @return 结果
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public int insertRmFileInfo(RmFileInfo rmFileInfo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 修改文件信息
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param rmFileInfo 文件信息
 | 
				
			||||||
 | 
					     * @return 结果
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public int updateRmFileInfo(RmFileInfo rmFileInfo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 删除文件信息
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param id 文件信息主键
 | 
				
			||||||
 | 
					     * @return 结果
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public int deleteRmFileInfoById(Long id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 批量删除文件信息
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param ids 需要删除的数据主键集合
 | 
				
			||||||
 | 
					     * @return 结果
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public int deleteRmFileInfoByIds(Long[] ids);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -0,0 +1,61 @@
 | 
				
			|||||||
 | 
					package com.ruoyi.rocketmq.mapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.domain.RmPolicyDeviceDetails;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 客户端策略关联Mapper接口
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @author gyt
 | 
				
			||||||
 | 
					 * @date 2025-10-22
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					public interface RmPolicyDeviceDetailsMapper 
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询客户端策略关联
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param id 客户端策略关联主键
 | 
				
			||||||
 | 
					     * @return 客户端策略关联
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public RmPolicyDeviceDetails selectRmPolicyDeviceDetailsById(Long id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询客户端策略关联列表
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param rmPolicyDeviceDetails 客户端策略关联
 | 
				
			||||||
 | 
					     * @return 客户端策略关联集合
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public List<RmPolicyDeviceDetails> selectRmPolicyDeviceDetailsList(RmPolicyDeviceDetails rmPolicyDeviceDetails);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 新增客户端策略关联
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param rmPolicyDeviceDetails 客户端策略关联
 | 
				
			||||||
 | 
					     * @return 结果
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public int insertRmPolicyDeviceDetails(RmPolicyDeviceDetails rmPolicyDeviceDetails);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 修改客户端策略关联
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param rmPolicyDeviceDetails 客户端策略关联
 | 
				
			||||||
 | 
					     * @return 结果
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public int updateRmPolicyDeviceDetails(RmPolicyDeviceDetails rmPolicyDeviceDetails);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 删除客户端策略关联
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param id 客户端策略关联主键
 | 
				
			||||||
 | 
					     * @return 结果
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public int deleteRmPolicyDeviceDetailsById(Long id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 批量删除客户端策略关联
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param ids 需要删除的数据主键集合
 | 
				
			||||||
 | 
					     * @return 结果
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public int deleteRmPolicyDeviceDetailsByIds(Long[] ids);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -74,4 +74,18 @@ public interface IRmAgentManagementService
 | 
				
			|||||||
     * @return
 | 
					     * @return
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    int addRmAgentManagement(RmAgentManagement rmAgentManagement);
 | 
					    int addRmAgentManagement(RmAgentManagement rmAgentManagement);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 手动立即更新agent
 | 
				
			||||||
 | 
					     * @param id
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    int updateAgentNow(Long id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 配置更新策略
 | 
				
			||||||
 | 
					     * @param rmAgentManagement
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    int addUpdatePolicy(RmAgentManagement rmAgentManagement);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,8 +1,9 @@
 | 
				
			|||||||
package com.ruoyi.rocketmq.service;
 | 
					package com.ruoyi.rocketmq.service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					 | 
				
			||||||
import com.ruoyi.rocketmq.domain.RmDeploymentPolicy;
 | 
					import com.ruoyi.rocketmq.domain.RmDeploymentPolicy;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 服务器脚本策略Service接口
 | 
					 * 服务器脚本策略Service接口
 | 
				
			||||||
 * 
 | 
					 * 
 | 
				
			||||||
@@ -60,4 +61,11 @@ public interface IRmDeploymentPolicyService
 | 
				
			|||||||
    public int deleteRmDeploymentPolicyById(Long id);
 | 
					    public int deleteRmDeploymentPolicyById(Long id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    int issueDeploymentPolicy(Long id);
 | 
					    int issueDeploymentPolicy(Long id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 根据clientId下发包含此设备未下发的服务器脚本策略
 | 
				
			||||||
 | 
					     * @param clientId
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    int issueDeployPolicyMsgByClientId(String clientId);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,61 @@
 | 
				
			|||||||
 | 
					package com.ruoyi.rocketmq.service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.domain.RmFileInfo;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 文件信息Service接口
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @author gyt
 | 
				
			||||||
 | 
					 * @date 2025-09-15
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					public interface IRmFileInfoService 
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询文件信息
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param id 文件信息主键
 | 
				
			||||||
 | 
					     * @return 文件信息
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public RmFileInfo selectRmFileInfoById(Long id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询文件信息列表
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param rmFileInfo 文件信息
 | 
				
			||||||
 | 
					     * @return 文件信息集合
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public List<RmFileInfo> selectRmFileInfoList(RmFileInfo rmFileInfo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 新增文件信息
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param rmFileInfo 文件信息
 | 
				
			||||||
 | 
					     * @return 结果
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public int insertRmFileInfo(RmFileInfo rmFileInfo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 修改文件信息
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param rmFileInfo 文件信息
 | 
				
			||||||
 | 
					     * @return 结果
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public int updateRmFileInfo(RmFileInfo rmFileInfo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 批量删除文件信息
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param ids 需要删除的文件信息主键集合
 | 
				
			||||||
 | 
					     * @return 结果
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public int deleteRmFileInfoByIds(Long[] ids);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 删除文件信息信息
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param id 文件信息主键
 | 
				
			||||||
 | 
					     * @return 结果
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public int deleteRmFileInfoById(Long id);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -1,7 +1,6 @@
 | 
				
			|||||||
package com.ruoyi.rocketmq.service;
 | 
					package com.ruoyi.rocketmq.service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.ruoyi.rocketmq.domain.RmMonitorPolicy;
 | 
					import com.ruoyi.rocketmq.domain.RmMonitorPolicy;
 | 
				
			||||||
import com.ruoyi.rocketmq.domain.vo.CollectVo;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import java.util.List;
 | 
					import java.util.List;
 | 
				
			||||||
import java.util.Map;
 | 
					import java.util.Map;
 | 
				
			||||||
@@ -86,9 +85,9 @@ public interface IRmMonitorPolicyService
 | 
				
			|||||||
    int updatePolicyMsgInner(RmMonitorPolicy rmMonitorPolicy);
 | 
					    int updatePolicyMsgInner(RmMonitorPolicy rmMonitorPolicy);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     *
 | 
					     * 检测策略是否下发,如果未下发,进行下发操作
 | 
				
			||||||
     * @param clientId
 | 
					     * @param clientId
 | 
				
			||||||
     * @return
 | 
					     * @return
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public List<CollectVo> getPolicyMsgByClientId(String clientId);
 | 
					    public int issuePolicyMsgByClientId(String clientId);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -66,4 +66,11 @@ public interface IRmNetworkInterfaceService
 | 
				
			|||||||
     * @return 结果
 | 
					     * @return 结果
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    public int deleteRmNetworkInterfaceById(Long id);
 | 
					    public int deleteRmNetworkInterfaceById(Long id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 绑定公网ip
 | 
				
			||||||
 | 
					     * @param rmNetworkInterface
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    int bindPublicIp(RmNetworkInterface rmNetworkInterface);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,61 @@
 | 
				
			|||||||
 | 
					package com.ruoyi.rocketmq.service;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.domain.RmPolicyDeviceDetails;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 客户端策略关联Service接口
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @author gyt
 | 
				
			||||||
 | 
					 * @date 2025-10-22
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					public interface IRmPolicyDeviceDetailsService 
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询客户端策略关联
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param id 客户端策略关联主键
 | 
				
			||||||
 | 
					     * @return 客户端策略关联
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public RmPolicyDeviceDetails selectRmPolicyDeviceDetailsById(Long id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询客户端策略关联列表
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param rmPolicyDeviceDetails 客户端策略关联
 | 
				
			||||||
 | 
					     * @return 客户端策略关联集合
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public List<RmPolicyDeviceDetails> selectRmPolicyDeviceDetailsList(RmPolicyDeviceDetails rmPolicyDeviceDetails);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 新增客户端策略关联
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param rmPolicyDeviceDetails 客户端策略关联
 | 
				
			||||||
 | 
					     * @return 结果
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public int insertRmPolicyDeviceDetails(RmPolicyDeviceDetails rmPolicyDeviceDetails);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 修改客户端策略关联
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param rmPolicyDeviceDetails 客户端策略关联
 | 
				
			||||||
 | 
					     * @return 结果
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public int updateRmPolicyDeviceDetails(RmPolicyDeviceDetails rmPolicyDeviceDetails);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 批量删除客户端策略关联
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param ids 需要删除的客户端策略关联主键集合
 | 
				
			||||||
 | 
					     * @return 结果
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public int deleteRmPolicyDeviceDetailsByIds(Long[] ids);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 删除客户端策略关联信息
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param id 客户端策略关联主键
 | 
				
			||||||
 | 
					     * @return 结果
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public int deleteRmPolicyDeviceDetailsById(Long id);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -5,12 +5,13 @@ import com.ruoyi.common.core.enums.MsgEnum;
 | 
				
			|||||||
import com.ruoyi.common.core.utils.DateUtils;
 | 
					import com.ruoyi.common.core.utils.DateUtils;
 | 
				
			||||||
import com.ruoyi.rocketmq.domain.DeviceMessage;
 | 
					import com.ruoyi.rocketmq.domain.DeviceMessage;
 | 
				
			||||||
import com.ruoyi.rocketmq.domain.RmAgentManagement;
 | 
					import com.ruoyi.rocketmq.domain.RmAgentManagement;
 | 
				
			||||||
import com.ruoyi.rocketmq.domain.vo.AgentUpdateVo;
 | 
					import com.ruoyi.rocketmq.domain.vo.*;
 | 
				
			||||||
import com.ruoyi.rocketmq.mapper.RmAgentManagementMapper;
 | 
					import com.ruoyi.rocketmq.mapper.RmAgentManagementMapper;
 | 
				
			||||||
import com.ruoyi.rocketmq.model.ProducerMode;
 | 
					import com.ruoyi.rocketmq.model.ProducerMode;
 | 
				
			||||||
import com.ruoyi.rocketmq.producer.MessageProducer;
 | 
					import com.ruoyi.rocketmq.producer.MessageProducer;
 | 
				
			||||||
import com.ruoyi.rocketmq.service.IRmAgentManagementService;
 | 
					import com.ruoyi.rocketmq.service.IRmAgentManagementService;
 | 
				
			||||||
import lombok.extern.slf4j.Slf4j;
 | 
					import lombok.extern.slf4j.Slf4j;
 | 
				
			||||||
 | 
					import org.springframework.beans.BeanUtils;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Value;
 | 
					import org.springframework.beans.factory.annotation.Value;
 | 
				
			||||||
import org.springframework.stereotype.Service;
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
@@ -132,6 +133,29 @@ public class RmAgentManagementServiceImpl implements IRmAgentManagementService
 | 
				
			|||||||
        processAgentUpdateData(rmAgentManagement);
 | 
					        processAgentUpdateData(rmAgentManagement);
 | 
				
			||||||
        return 1;
 | 
					        return 1;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 配置更新策略v1.1
 | 
				
			||||||
 | 
					     * @param rmAgentManagement
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public int addUpdatePolicy(RmAgentManagement rmAgentManagement) {
 | 
				
			||||||
 | 
					        processAgentData(rmAgentManagement);
 | 
				
			||||||
 | 
					        return 1;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 手动立即更新
 | 
				
			||||||
 | 
					     * @param id
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public int updateAgentNow(Long id) {
 | 
				
			||||||
 | 
					        // 根据id查询agent更新信息
 | 
				
			||||||
 | 
					        RmAgentManagement rmAgentManagement = rmAgentManagementMapper.selectRmAgentManagementById(id);
 | 
				
			||||||
 | 
					        processAgentData(rmAgentManagement);
 | 
				
			||||||
 | 
					        return 1;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 处理agen更新数据
 | 
					     * 处理agen更新数据
 | 
				
			||||||
@@ -187,4 +211,74 @@ public class RmAgentManagementServiceImpl implements IRmAgentManagementService
 | 
				
			|||||||
            log.error("发送设备配置失败,deviceId: {}", rmAgentManagement.getHardwareSn(), e);
 | 
					            log.error("发送设备配置失败,deviceId: {}", rmAgentManagement.getHardwareSn(), e);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 处理agen更新数据
 | 
				
			||||||
 | 
					     * @param rmAgentManagement
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    public void processAgentData(RmAgentManagement rmAgentManagement){
 | 
				
			||||||
 | 
					        String clientIds = rmAgentManagement.getDeployDevice();
 | 
				
			||||||
 | 
					        String[] clientIdArr = clientIds.split("\n");
 | 
				
			||||||
 | 
					        for (String clientId : clientIdArr) {
 | 
				
			||||||
 | 
					            // 创建新的对象,避免污染原始数据
 | 
				
			||||||
 | 
					            RmAgentManagement currentAgent = new RmAgentManagement();
 | 
				
			||||||
 | 
					            // 复制原始对象的属性
 | 
				
			||||||
 | 
					            BeanUtils.copyProperties(rmAgentManagement, currentAgent);
 | 
				
			||||||
 | 
					            // 设置当前循环的 clientId
 | 
				
			||||||
 | 
					            currentAgent.setClientId(clientId);
 | 
				
			||||||
 | 
					            currentAgent.setDeployDevice(clientId);
 | 
				
			||||||
 | 
					            // 查询该资源是否已经配置
 | 
				
			||||||
 | 
					            RmAgentManagement agentQueryParam = new RmAgentManagement();
 | 
				
			||||||
 | 
					            agentQueryParam.setClientId(clientId);
 | 
				
			||||||
 | 
					            List<RmAgentManagement> agentManagements = rmAgentManagementMapper.selectRmAgentManagementList(agentQueryParam);
 | 
				
			||||||
 | 
					            if(!agentManagements.isEmpty()){
 | 
				
			||||||
 | 
					                // 如果存在,修改
 | 
				
			||||||
 | 
					                currentAgent.setLastUpdateTime(DateUtils.getNowDate());
 | 
				
			||||||
 | 
					                if("0".equals(rmAgentManagement.getMethod())){
 | 
				
			||||||
 | 
					                    currentAgent.setScheduledUpdateTime(null);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                rmAgentManagementMapper.updateRmAgentManagementBySn(currentAgent);
 | 
				
			||||||
 | 
					            }else{
 | 
				
			||||||
 | 
					                // 如果不存在,添加
 | 
				
			||||||
 | 
					                currentAgent.setLastUpdateTime(DateUtils.getNowDate());
 | 
				
			||||||
 | 
					                if("0".equals(rmAgentManagement.getMethod())){
 | 
				
			||||||
 | 
					                    currentAgent.setScheduledUpdateTime(null);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					                rmAgentManagementMapper.insertRmAgentManagement(currentAgent);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            // 构建更新策略
 | 
				
			||||||
 | 
					            AgentUpdateMsgVo agentUpdateMsgVo = new AgentUpdateMsgVo();
 | 
				
			||||||
 | 
					            agentUpdateMsgVo.setFileUrl(rmAgentManagement.getFileUrl());
 | 
				
			||||||
 | 
					            agentUpdateMsgVo.setFileMd5(rmAgentManagement.getFileMd5());
 | 
				
			||||||
 | 
					            agentUpdateMsgVo.setMethod(rmAgentManagement.getMethod());
 | 
				
			||||||
 | 
					            if(rmAgentManagement.getMethod() == 1){
 | 
				
			||||||
 | 
					                Date scheduledUpdateTime = rmAgentManagement.getScheduledUpdateTime();
 | 
				
			||||||
 | 
					                long scheduledTime = scheduledUpdateTime.toInstant().getEpochSecond();
 | 
				
			||||||
 | 
					                agentUpdateMsgVo.setPolicyTime(scheduledTime);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            try {
 | 
				
			||||||
 | 
					                PolicyVo<AgentUpdateMsgVo> policyVo = new PolicyVo();
 | 
				
			||||||
 | 
					                List<AgentUpdateMsgVo> list = new ArrayList<>();
 | 
				
			||||||
 | 
					                list.add(agentUpdateMsgVo);
 | 
				
			||||||
 | 
					                policyVo.setContents(list);
 | 
				
			||||||
 | 
					                String policyVoStr = JSONObject.toJSONString(policyVo);
 | 
				
			||||||
 | 
					                PolicyTypeVo policyTypeVo = new PolicyTypeVo();
 | 
				
			||||||
 | 
					                policyTypeVo.setVersions(policyVoStr);
 | 
				
			||||||
 | 
					                String configJson = JSONObject.toJSONString(policyTypeVo);
 | 
				
			||||||
 | 
					                DeviceMessage deviceMessage = new DeviceMessage();
 | 
				
			||||||
 | 
					                deviceMessage.setClientId(clientId);
 | 
				
			||||||
 | 
					                deviceMessage.setDataType(MsgEnum.获取最新策略应答.getValue());
 | 
				
			||||||
 | 
					                deviceMessage.setData(configJson);
 | 
				
			||||||
 | 
					                MessageProducer messageProducer = new MessageProducer();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                messageProducer.sendAsyncProducerMessage(
 | 
				
			||||||
 | 
					                        producerMode.getAgentTopic(),
 | 
				
			||||||
 | 
					                        "",
 | 
				
			||||||
 | 
					                        "",
 | 
				
			||||||
 | 
					                        JSONObject.toJSONString(deviceMessage)
 | 
				
			||||||
 | 
					                );
 | 
				
			||||||
 | 
					            } catch (Exception e) {
 | 
				
			||||||
 | 
					                log.error("发送设备配置失败,deviceId: {}", rmAgentManagement.getHardwareSn(), e);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -8,7 +8,10 @@ import com.ruoyi.common.core.utils.DateUtils;
 | 
				
			|||||||
import com.ruoyi.common.core.utils.StringUtils;
 | 
					import com.ruoyi.common.core.utils.StringUtils;
 | 
				
			||||||
import com.ruoyi.rocketmq.domain.DeviceMessage;
 | 
					import com.ruoyi.rocketmq.domain.DeviceMessage;
 | 
				
			||||||
import com.ruoyi.rocketmq.domain.RmDeploymentPolicy;
 | 
					import com.ruoyi.rocketmq.domain.RmDeploymentPolicy;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.domain.vo.PolicyTypeVo;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.domain.vo.PolicyVo;
 | 
				
			||||||
import com.ruoyi.rocketmq.domain.vo.ScriptPolicyVo;
 | 
					import com.ruoyi.rocketmq.domain.vo.ScriptPolicyVo;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.domain.vo.ServerScriptPolicyVo;
 | 
				
			||||||
import com.ruoyi.rocketmq.mapper.RmDeploymentPolicyMapper;
 | 
					import com.ruoyi.rocketmq.mapper.RmDeploymentPolicyMapper;
 | 
				
			||||||
import com.ruoyi.rocketmq.model.ProducerMode;
 | 
					import com.ruoyi.rocketmq.model.ProducerMode;
 | 
				
			||||||
import com.ruoyi.rocketmq.producer.MessageProducer;
 | 
					import com.ruoyi.rocketmq.producer.MessageProducer;
 | 
				
			||||||
@@ -254,4 +257,86 @@ public class RmDeploymentPolicyServiceImpl implements IRmDeploymentPolicyService
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 根据clientId下发包含此设备未下发的服务器脚本策略
 | 
				
			||||||
 | 
					     * @param clientId
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public int issueDeployPolicyMsgByClientId(String clientId) {
 | 
				
			||||||
 | 
					        try {
 | 
				
			||||||
 | 
					            // 根据clientId查询未下发的策略信息
 | 
				
			||||||
 | 
					            RmDeploymentPolicy queryParam = new RmDeploymentPolicy();
 | 
				
			||||||
 | 
					            queryParam.setDeployDevice(clientId);
 | 
				
			||||||
 | 
					            queryParam.setPolicyStatus("0");
 | 
				
			||||||
 | 
					            // 获取策略详情
 | 
				
			||||||
 | 
					            List<RmDeploymentPolicy> policyList = rmDeploymentPolicyMapper.selectRmDeploymentPolicyByClientId(queryParam);
 | 
				
			||||||
 | 
					            if (policyList.isEmpty()) {
 | 
				
			||||||
 | 
					                log.error("无待下发策略,clientId: {}", clientId);
 | 
				
			||||||
 | 
					                return 0;
 | 
				
			||||||
 | 
					            }else{
 | 
				
			||||||
 | 
					                for (RmDeploymentPolicy policy : policyList) {
 | 
				
			||||||
 | 
					                    // 构建并发送脚本配置
 | 
				
			||||||
 | 
					                    ServerScriptPolicyVo scriptPolicyVo = new ServerScriptPolicyVo();
 | 
				
			||||||
 | 
					                    scriptPolicyVo.setPolicyName(policy.getPolicyName());
 | 
				
			||||||
 | 
					                    scriptPolicyVo.setFileUrl(policy.getScriptPath());
 | 
				
			||||||
 | 
					                    scriptPolicyVo.setCommandParams(policy.getDefaultParams());
 | 
				
			||||||
 | 
					                    scriptPolicyVo.setMethod(policy.getExecutionMethod());
 | 
				
			||||||
 | 
					                    // 定时执行
 | 
				
			||||||
 | 
					                    if(policy.getExecutionMethod() == 1){
 | 
				
			||||||
 | 
					                        Date scheduledTime = policy.getScheduledTime();
 | 
				
			||||||
 | 
					                        // 转化为时间戳(秒)
 | 
				
			||||||
 | 
					                        long timestampInSecondes = scheduledTime.getTime() / 1000;
 | 
				
			||||||
 | 
					                        scriptPolicyVo.setPolicyTime(timestampInSecondes);
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                    String[] clientIdArr = policy.getDeployDevice().split("\n");
 | 
				
			||||||
 | 
					                    sendDeploymentPolicy(clientIdArr, scriptPolicyVo);
 | 
				
			||||||
 | 
					                    // 更新策略状态为已下发
 | 
				
			||||||
 | 
					                    RmDeploymentPolicy deploymentPolicy = new RmDeploymentPolicy();
 | 
				
			||||||
 | 
					                    deploymentPolicy.setId(policy.getId());
 | 
				
			||||||
 | 
					                    deploymentPolicy.setPolicyStatus("1");
 | 
				
			||||||
 | 
					                    deploymentPolicy.setDeployTime(DateUtils.getNowDate());
 | 
				
			||||||
 | 
					                    rmDeploymentPolicyMapper.updateRmDeploymentPolicy(deploymentPolicy);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                return 1;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        } catch (Exception e) {
 | 
				
			||||||
 | 
					            log.error("下发策略失败,clientId: {}", clientId, e);
 | 
				
			||||||
 | 
					            return 0;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 发送配置到设备
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private void sendDeploymentPolicy(String[] clientIdArr, ServerScriptPolicyVo scriptPolicyVo) {
 | 
				
			||||||
 | 
					        MessageProducer messageProducer = new MessageProducer();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        PolicyVo<ServerScriptPolicyVo> policyVo = new PolicyVo();
 | 
				
			||||||
 | 
					        List<ServerScriptPolicyVo> list = new ArrayList<>();
 | 
				
			||||||
 | 
					        list.add(scriptPolicyVo);
 | 
				
			||||||
 | 
					        policyVo.setContents(list);
 | 
				
			||||||
 | 
					        String policyVoStr = JSONObject.toJSONString(policyVo);
 | 
				
			||||||
 | 
					        PolicyTypeVo policyTypeVo = new PolicyTypeVo();
 | 
				
			||||||
 | 
					        policyTypeVo.setScripts(policyVoStr);
 | 
				
			||||||
 | 
					        String configJson = JSONObject.toJSONString(policyTypeVo);
 | 
				
			||||||
 | 
					        for (String clientId : clientIdArr) {
 | 
				
			||||||
 | 
					            try {
 | 
				
			||||||
 | 
					                DeviceMessage message = new DeviceMessage();
 | 
				
			||||||
 | 
					                message.setClientId(clientId);
 | 
				
			||||||
 | 
					                message.setData(configJson);
 | 
				
			||||||
 | 
					                message.setDataType(MsgEnum.获取最新策略应答.getValue());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                messageProducer.sendAsyncProducerMessage(
 | 
				
			||||||
 | 
					                        producerMode.getAgentTopic(),
 | 
				
			||||||
 | 
					                        "",
 | 
				
			||||||
 | 
					                        "",
 | 
				
			||||||
 | 
					                        JSONObject.toJSONString(message)
 | 
				
			||||||
 | 
					                );
 | 
				
			||||||
 | 
					            } catch (Exception e) {
 | 
				
			||||||
 | 
					                log.error("发送设备配置失败,deviceId: {}", clientId, e);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,96 @@
 | 
				
			|||||||
 | 
					package com.ruoyi.rocketmq.service.impl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import com.ruoyi.common.core.utils.DateUtils;
 | 
				
			||||||
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.mapper.RmFileInfoMapper;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.domain.RmFileInfo;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.service.IRmFileInfoService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 文件信息Service业务层处理
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @author gyt
 | 
				
			||||||
 | 
					 * @date 2025-09-15
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					@Service
 | 
				
			||||||
 | 
					public class RmFileInfoServiceImpl implements IRmFileInfoService 
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    @Autowired
 | 
				
			||||||
 | 
					    private RmFileInfoMapper rmFileInfoMapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询文件信息
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param id 文件信息主键
 | 
				
			||||||
 | 
					     * @return 文件信息
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public RmFileInfo selectRmFileInfoById(Long id)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return rmFileInfoMapper.selectRmFileInfoById(id);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询文件信息列表
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param rmFileInfo 文件信息
 | 
				
			||||||
 | 
					     * @return 文件信息
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public List<RmFileInfo> selectRmFileInfoList(RmFileInfo rmFileInfo)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return rmFileInfoMapper.selectRmFileInfoList(rmFileInfo);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 新增文件信息
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param rmFileInfo 文件信息
 | 
				
			||||||
 | 
					     * @return 结果
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public int insertRmFileInfo(RmFileInfo rmFileInfo)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        rmFileInfo.setCreateTime(DateUtils.getNowDate());
 | 
				
			||||||
 | 
					        return rmFileInfoMapper.insertRmFileInfo(rmFileInfo);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 修改文件信息
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param rmFileInfo 文件信息
 | 
				
			||||||
 | 
					     * @return 结果
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public int updateRmFileInfo(RmFileInfo rmFileInfo)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        rmFileInfo.setUpdateTime(DateUtils.getNowDate());
 | 
				
			||||||
 | 
					        return rmFileInfoMapper.updateRmFileInfo(rmFileInfo);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 批量删除文件信息
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param ids 需要删除的文件信息主键
 | 
				
			||||||
 | 
					     * @return 结果
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public int deleteRmFileInfoByIds(Long[] ids)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return rmFileInfoMapper.deleteRmFileInfoByIds(ids);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 删除文件信息信息
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param id 文件信息主键
 | 
				
			||||||
 | 
					     * @return 结果
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public int deleteRmFileInfoById(Long id)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return rmFileInfoMapper.deleteRmFileInfoById(id);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -6,10 +6,7 @@ import com.ruoyi.common.core.utils.DateUtils;
 | 
				
			|||||||
import com.ruoyi.common.core.utils.StringUtils;
 | 
					import com.ruoyi.common.core.utils.StringUtils;
 | 
				
			||||||
import com.ruoyi.common.security.utils.SecurityUtils;
 | 
					import com.ruoyi.common.security.utils.SecurityUtils;
 | 
				
			||||||
import com.ruoyi.rocketmq.domain.*;
 | 
					import com.ruoyi.rocketmq.domain.*;
 | 
				
			||||||
import com.ruoyi.rocketmq.domain.vo.CollectVo;
 | 
					import com.ruoyi.rocketmq.domain.vo.*;
 | 
				
			||||||
import com.ruoyi.rocketmq.domain.vo.RegisterSwitchVo;
 | 
					 | 
				
			||||||
import com.ruoyi.rocketmq.domain.vo.RmMonitorPolicyVo;
 | 
					 | 
				
			||||||
import com.ruoyi.rocketmq.domain.vo.SwitchOidVo;
 | 
					 | 
				
			||||||
import com.ruoyi.rocketmq.mapper.*;
 | 
					import com.ruoyi.rocketmq.mapper.*;
 | 
				
			||||||
import com.ruoyi.rocketmq.model.ProducerMode;
 | 
					import com.ruoyi.rocketmq.model.ProducerMode;
 | 
				
			||||||
import com.ruoyi.rocketmq.producer.MessageProducer;
 | 
					import com.ruoyi.rocketmq.producer.MessageProducer;
 | 
				
			||||||
@@ -500,12 +497,12 @@ public class RmMonitorPolicyServiceImpl implements IRmMonitorPolicyService
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 根据clientId得到监控策略信息
 | 
					     * 根据clientId下发监控策略信息
 | 
				
			||||||
     * @param clientId
 | 
					     * @param clientId
 | 
				
			||||||
     * @return
 | 
					     * @return
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public List<CollectVo> getPolicyMsgByClientId(String clientId) {
 | 
					    public int issuePolicyMsgByClientId(String clientId) {
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
            // 根据clientId查询未下发的策略信息
 | 
					            // 根据clientId查询未下发的策略信息
 | 
				
			||||||
            RmMonitorPolicy queryParam = new RmMonitorPolicy();
 | 
					            RmMonitorPolicy queryParam = new RmMonitorPolicy();
 | 
				
			||||||
@@ -515,8 +512,8 @@ public class RmMonitorPolicyServiceImpl implements IRmMonitorPolicyService
 | 
				
			|||||||
            queryParam.setResourceType("linux");
 | 
					            queryParam.setResourceType("linux");
 | 
				
			||||||
            RmMonitorPolicy policy = rmMonitorPolicyMapper.selectRmMonitorPolicyByClientId(queryParam);
 | 
					            RmMonitorPolicy policy = rmMonitorPolicyMapper.selectRmMonitorPolicyByClientId(queryParam);
 | 
				
			||||||
            if (policy == null) {
 | 
					            if (policy == null) {
 | 
				
			||||||
                log.error("无待下发策略,clientId: {}", clientId);
 | 
					                log.warn("无待下发策略,clientId: {}", clientId);
 | 
				
			||||||
                return null;
 | 
					                return 0;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // 构建并发送采集配置
 | 
					            // 构建并发送采集配置
 | 
				
			||||||
@@ -524,10 +521,47 @@ public class RmMonitorPolicyServiceImpl implements IRmMonitorPolicyService
 | 
				
			|||||||
            List<CollectVo> collectVos = buildCollectConfigurations(policyDetails);
 | 
					            List<CollectVo> collectVos = buildCollectConfigurations(policyDetails);
 | 
				
			||||||
            // 去重
 | 
					            // 去重
 | 
				
			||||||
            List<CollectVo> uniqueList = collectVos.stream().distinct().collect(Collectors.toList());
 | 
					            List<CollectVo> uniqueList = collectVos.stream().distinct().collect(Collectors.toList());
 | 
				
			||||||
            return collectVos;
 | 
					            String[] clientIdArr = policy.getDeployDevice().split("\n");
 | 
				
			||||||
 | 
					            sendMonitorPolicy(clientIdArr, uniqueList);
 | 
				
			||||||
 | 
					            // 更新策略状态为已下发
 | 
				
			||||||
 | 
					            RmMonitorPolicy policyUpdate = new RmMonitorPolicy();
 | 
				
			||||||
 | 
					            policyUpdate.setId(policy.getId());
 | 
				
			||||||
 | 
					            policyUpdate.setStatus("1");
 | 
				
			||||||
 | 
					            rmMonitorPolicyMapper.updateRmMonitorPolicy(policyUpdate);
 | 
				
			||||||
 | 
					            return 1;
 | 
				
			||||||
        } catch (Exception e) {
 | 
					        } catch (Exception e) {
 | 
				
			||||||
            log.error("下发策略失败,clientId: {}", clientId, e);
 | 
					            log.error("下发策略失败,clientId: {}", clientId, e);
 | 
				
			||||||
            return null;
 | 
					            return 0;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 发送监控策略到设备
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    private void sendMonitorPolicy(String[] clientIdArr, List<CollectVo> collectVos) {
 | 
				
			||||||
 | 
					        MessageProducer messageProducer = new MessageProducer();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        PolicyVo<CollectVo> policyVo = new PolicyVo();
 | 
				
			||||||
 | 
					        policyVo.setContents(collectVos);
 | 
				
			||||||
 | 
					        String policyVoStr = JSONObject.toJSONString(policyVo);
 | 
				
			||||||
 | 
					        PolicyTypeVo policyTypeVo = new PolicyTypeVo();
 | 
				
			||||||
 | 
					        policyTypeVo.setMonitors(policyVoStr);
 | 
				
			||||||
 | 
					        String configJson = JSONObject.toJSONString(policyTypeVo);
 | 
				
			||||||
 | 
					        for (String clientId : clientIdArr) {
 | 
				
			||||||
 | 
					            try {
 | 
				
			||||||
 | 
					                DeviceMessage message = new DeviceMessage();
 | 
				
			||||||
 | 
					                message.setClientId(clientId);
 | 
				
			||||||
 | 
					                message.setData(configJson);
 | 
				
			||||||
 | 
					                message.setDataType(MsgEnum.获取最新策略应答.getValue());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                messageProducer.sendAsyncProducerMessage(
 | 
				
			||||||
 | 
					                        producerMode.getAgentTopic(),
 | 
				
			||||||
 | 
					                        "",
 | 
				
			||||||
 | 
					                        "",
 | 
				
			||||||
 | 
					                        JSONObject.toJSONString(message)
 | 
				
			||||||
 | 
					                );
 | 
				
			||||||
 | 
					            } catch (Exception e) {
 | 
				
			||||||
 | 
					                log.error("发送设备配置失败,clientId: {}", clientId, e);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    private SwitchOidVo buildOids(Map<String, Object> policyDetails) {
 | 
					    private SwitchOidVo buildOids(Map<String, Object> policyDetails) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -100,4 +100,14 @@ public class RmNetworkInterfaceServiceImpl implements IRmNetworkInterfaceService
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        return rmNetworkInterfaceMapper.deleteRmNetworkInterfaceById(id);
 | 
					        return rmNetworkInterfaceMapper.deleteRmNetworkInterfaceById(id);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 绑定公网ip
 | 
				
			||||||
 | 
					     * @param rmNetworkInterface
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public int bindPublicIp(RmNetworkInterface rmNetworkInterface) {
 | 
				
			||||||
 | 
					        return rmNetworkInterfaceMapper.updateRmNetworkInterface(rmNetworkInterface);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,96 @@
 | 
				
			|||||||
 | 
					package com.ruoyi.rocketmq.service.impl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.util.List;
 | 
				
			||||||
 | 
					import com.ruoyi.common.core.utils.DateUtils;
 | 
				
			||||||
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
 | 
					import org.springframework.stereotype.Service;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.mapper.RmPolicyDeviceDetailsMapper;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.domain.RmPolicyDeviceDetails;
 | 
				
			||||||
 | 
					import com.ruoyi.rocketmq.service.IRmPolicyDeviceDetailsService;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**
 | 
				
			||||||
 | 
					 * 客户端策略关联Service业务层处理
 | 
				
			||||||
 | 
					 * 
 | 
				
			||||||
 | 
					 * @author gyt
 | 
				
			||||||
 | 
					 * @date 2025-10-22
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					@Service
 | 
				
			||||||
 | 
					public class RmPolicyDeviceDetailsServiceImpl implements IRmPolicyDeviceDetailsService 
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    @Autowired
 | 
				
			||||||
 | 
					    private RmPolicyDeviceDetailsMapper rmPolicyDeviceDetailsMapper;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询客户端策略关联
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param id 客户端策略关联主键
 | 
				
			||||||
 | 
					     * @return 客户端策略关联
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public RmPolicyDeviceDetails selectRmPolicyDeviceDetailsById(Long id)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return rmPolicyDeviceDetailsMapper.selectRmPolicyDeviceDetailsById(id);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 查询客户端策略关联列表
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param rmPolicyDeviceDetails 客户端策略关联
 | 
				
			||||||
 | 
					     * @return 客户端策略关联
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public List<RmPolicyDeviceDetails> selectRmPolicyDeviceDetailsList(RmPolicyDeviceDetails rmPolicyDeviceDetails)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return rmPolicyDeviceDetailsMapper.selectRmPolicyDeviceDetailsList(rmPolicyDeviceDetails);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 新增客户端策略关联
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param rmPolicyDeviceDetails 客户端策略关联
 | 
				
			||||||
 | 
					     * @return 结果
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public int insertRmPolicyDeviceDetails(RmPolicyDeviceDetails rmPolicyDeviceDetails)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        rmPolicyDeviceDetails.setCreateTime(DateUtils.getNowDate());
 | 
				
			||||||
 | 
					        return rmPolicyDeviceDetailsMapper.insertRmPolicyDeviceDetails(rmPolicyDeviceDetails);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 修改客户端策略关联
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param rmPolicyDeviceDetails 客户端策略关联
 | 
				
			||||||
 | 
					     * @return 结果
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public int updateRmPolicyDeviceDetails(RmPolicyDeviceDetails rmPolicyDeviceDetails)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        rmPolicyDeviceDetails.setUpdateTime(DateUtils.getNowDate());
 | 
				
			||||||
 | 
					        return rmPolicyDeviceDetailsMapper.updateRmPolicyDeviceDetails(rmPolicyDeviceDetails);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 批量删除客户端策略关联
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param ids 需要删除的客户端策略关联主键
 | 
				
			||||||
 | 
					     * @return 结果
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public int deleteRmPolicyDeviceDetailsByIds(Long[] ids)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return rmPolicyDeviceDetailsMapper.deleteRmPolicyDeviceDetailsByIds(ids);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 删除客户端策略关联信息
 | 
				
			||||||
 | 
					     * 
 | 
				
			||||||
 | 
					     * @param id 客户端策略关联主键
 | 
				
			||||||
 | 
					     * @return 结果
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public int deleteRmPolicyDeviceDetailsById(Long id)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        return rmPolicyDeviceDetailsMapper.deleteRmPolicyDeviceDetailsById(id);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -43,7 +43,7 @@ public class DataProcessUtil {
 | 
				
			|||||||
            R<List<RmSwitchManagementRemote>> switchMsg = remoteRevenueConfigService
 | 
					            R<List<RmSwitchManagementRemote>> switchMsg = remoteRevenueConfigService
 | 
				
			||||||
                    .getSwitchNameByClientId(queryParam, SecurityConstants.INNER);
 | 
					                    .getSwitchNameByClientId(queryParam, SecurityConstants.INNER);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (switchMsg != null && switchMsg.getData() != null) {
 | 
					            if (switchMsg != null && switchMsg.getData() != null && !switchMsg.getData().isEmpty()) {
 | 
				
			||||||
                return switchMsg.getData().get(0).getClientId();
 | 
					                return switchMsg.getData().get(0).getClientId();
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        } catch (Exception e) {
 | 
					        } catch (Exception e) {
 | 
				
			||||||
@@ -253,7 +253,7 @@ public class DataProcessUtil {
 | 
				
			|||||||
            R<List<RmSwitchManagementRemote>> switchMsg = remoteRevenueConfigService
 | 
					            R<List<RmSwitchManagementRemote>> switchMsg = remoteRevenueConfigService
 | 
				
			||||||
                    .getSwitchNameByClientId(queryParam, SecurityConstants.INNER);
 | 
					                    .getSwitchNameByClientId(queryParam, SecurityConstants.INNER);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (switchMsg != null && switchMsg.getData() != null) {
 | 
					            if (switchMsg != null && switchMsg.getData() != null && !switchMsg.getData().isEmpty()) {
 | 
				
			||||||
                return switchMsg.getData().get(0);
 | 
					                return switchMsg.getData().get(0);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        } catch (Exception e) {
 | 
					        } catch (Exception e) {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,10 +22,13 @@
 | 
				
			|||||||
        <result property="updateTime"    column="update_time"    />
 | 
					        <result property="updateTime"    column="update_time"    />
 | 
				
			||||||
        <result property="createBy"    column="create_by"    />
 | 
					        <result property="createBy"    column="create_by"    />
 | 
				
			||||||
        <result property="updateBy"    column="update_by"    />
 | 
					        <result property="updateBy"    column="update_by"    />
 | 
				
			||||||
 | 
					        <result property="fileMd5"    column="file_md5"    />
 | 
				
			||||||
 | 
					        <result property="clientId"    column="client_id"    />
 | 
				
			||||||
 | 
					        <result property="deployDevice"    column="deploy_device"    />
 | 
				
			||||||
    </resultMap>
 | 
					    </resultMap>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <sql id="selectRmAgentManagementVo">
 | 
					    <sql id="selectRmAgentManagementVo">
 | 
				
			||||||
        select id, hardware_sn, resource_name, internal_ip, status, agent_version, method, scheduled_update_time, file_url_type, file_url, file_directory, last_update_result, last_update_time, create_time, update_time, create_by, update_by from rm_agent_management
 | 
					        select id, hardware_sn, resource_name, internal_ip, status, agent_version, method, scheduled_update_time, file_url_type, file_url, file_directory, last_update_result, last_update_time, create_time, update_time, create_by, update_by, file_md5, client_id, deploy_device from rm_agent_management
 | 
				
			||||||
    </sql>
 | 
					    </sql>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <select id="selectRmAgentManagementList" parameterType="RmAgentManagement" resultMap="RmAgentManagementResult">
 | 
					    <select id="selectRmAgentManagementList" parameterType="RmAgentManagement" resultMap="RmAgentManagementResult">
 | 
				
			||||||
@@ -43,6 +46,9 @@
 | 
				
			|||||||
            <if test="fileDirectory != null  and fileDirectory != ''"> and file_directory = #{fileDirectory}</if>
 | 
					            <if test="fileDirectory != null  and fileDirectory != ''"> and file_directory = #{fileDirectory}</if>
 | 
				
			||||||
            <if test="lastUpdateResult != null  and lastUpdateResult != ''"> and last_update_result = #{lastUpdateResult}</if>
 | 
					            <if test="lastUpdateResult != null  and lastUpdateResult != ''"> and last_update_result = #{lastUpdateResult}</if>
 | 
				
			||||||
            <if test="lastUpdateTime != null "> and last_update_time = #{lastUpdateTime}</if>
 | 
					            <if test="lastUpdateTime != null "> and last_update_time = #{lastUpdateTime}</if>
 | 
				
			||||||
 | 
					            <if test="fileMd5 != null  and fileMd5 != ''"> and file_md5 = #{fileMd5}</if>
 | 
				
			||||||
 | 
					            <if test="clientId != null  and clientId != ''"> and client_id = #{clientId}</if>
 | 
				
			||||||
 | 
					            <if test="deployDevice != null  and deployDevice != ''"> and deploy_device = #{deployDevice}</if>
 | 
				
			||||||
            <if test="queryName != null and queryName != '' "> and (resource_name like concat('%', #{resourceName}, '%') or internal_ip = #{internalIp})</if>
 | 
					            <if test="queryName != null and queryName != '' "> and (resource_name like concat('%', #{resourceName}, '%') or internal_ip = #{internalIp})</if>
 | 
				
			||||||
        </where>
 | 
					        </where>
 | 
				
			||||||
    </select>
 | 
					    </select>
 | 
				
			||||||
@@ -71,6 +77,9 @@
 | 
				
			|||||||
            <if test="updateTime != null">update_time,</if>
 | 
					            <if test="updateTime != null">update_time,</if>
 | 
				
			||||||
            <if test="createBy != null">create_by,</if>
 | 
					            <if test="createBy != null">create_by,</if>
 | 
				
			||||||
            <if test="updateBy != null">update_by,</if>
 | 
					            <if test="updateBy != null">update_by,</if>
 | 
				
			||||||
 | 
					            <if test="fileMd5 != null">file_md5,</if>
 | 
				
			||||||
 | 
					            <if test="clientId != null">client_id,</if>
 | 
				
			||||||
 | 
					            <if test="deployDevice != null">deploy_device,</if>
 | 
				
			||||||
        </trim>
 | 
					        </trim>
 | 
				
			||||||
        <trim prefix="values (" suffix=")" suffixOverrides=",">
 | 
					        <trim prefix="values (" suffix=")" suffixOverrides=",">
 | 
				
			||||||
            <if test="hardwareSn != null and hardwareSn != ''">#{hardwareSn},</if>
 | 
					            <if test="hardwareSn != null and hardwareSn != ''">#{hardwareSn},</if>
 | 
				
			||||||
@@ -89,6 +98,9 @@
 | 
				
			|||||||
            <if test="updateTime != null">#{updateTime},</if>
 | 
					            <if test="updateTime != null">#{updateTime},</if>
 | 
				
			||||||
            <if test="createBy != null">#{createBy},</if>
 | 
					            <if test="createBy != null">#{createBy},</if>
 | 
				
			||||||
            <if test="updateBy != null">#{updateBy},</if>
 | 
					            <if test="updateBy != null">#{updateBy},</if>
 | 
				
			||||||
 | 
					            <if test="fileMd5 != null">#{fileMd5},</if>
 | 
				
			||||||
 | 
					            <if test="clientId != null">#{clientId},</if>
 | 
				
			||||||
 | 
					            <if test="deployDevice != null">#{deployDevice},</if>
 | 
				
			||||||
        </trim>
 | 
					        </trim>
 | 
				
			||||||
    </insert>
 | 
					    </insert>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -111,31 +123,12 @@
 | 
				
			|||||||
            <if test="updateTime != null">update_time = #{updateTime},</if>
 | 
					            <if test="updateTime != null">update_time = #{updateTime},</if>
 | 
				
			||||||
            <if test="createBy != null">create_by = #{createBy},</if>
 | 
					            <if test="createBy != null">create_by = #{createBy},</if>
 | 
				
			||||||
            <if test="updateBy != null">update_by = #{updateBy},</if>
 | 
					            <if test="updateBy != null">update_by = #{updateBy},</if>
 | 
				
			||||||
 | 
					            <if test="fileMd5 != null">file_md5 = #{fileMd5},</if>
 | 
				
			||||||
 | 
					            <if test="clientId != null">client_id = #{clientId},</if>
 | 
				
			||||||
 | 
					            <if test="deployDevice != null">deploy_device = #{deployDevice},</if>
 | 
				
			||||||
        </trim>
 | 
					        </trim>
 | 
				
			||||||
        where id = #{id}
 | 
					        where id = #{id}
 | 
				
			||||||
    </update>
 | 
					    </update>
 | 
				
			||||||
    <update id="updateRmAgentManagementBySn" parameterType="RmAgentManagement">
 | 
					 | 
				
			||||||
        update rm_agent_management
 | 
					 | 
				
			||||||
        <trim prefix="SET" suffixOverrides=",">
 | 
					 | 
				
			||||||
            <if test="resourceName != null and resourceName != ''">resource_name = #{resourceName},</if>
 | 
					 | 
				
			||||||
            <if test="internalIp != null">internal_ip = #{internalIp},</if>
 | 
					 | 
				
			||||||
            <if test="status != null and status != ''">status = #{status},</if>
 | 
					 | 
				
			||||||
            <if test="agentVersion != null">agent_version = #{agentVersion},</if>
 | 
					 | 
				
			||||||
            <if test="method != null">method = #{method},</if>
 | 
					 | 
				
			||||||
            <if test="scheduledUpdateTime != null">scheduled_update_time = #{scheduledUpdateTime},</if>
 | 
					 | 
				
			||||||
            <if test="fileUrlType != null">file_url_type = #{fileUrlType},</if>
 | 
					 | 
				
			||||||
            <if test="fileUrl != null">file_url = #{fileUrl},</if>
 | 
					 | 
				
			||||||
            <if test="fileDirectory != null">file_directory = #{fileDirectory},</if>
 | 
					 | 
				
			||||||
            <if test="lastUpdateResult != null">last_update_result = #{lastUpdateResult},</if>
 | 
					 | 
				
			||||||
            <if test="lastUpdateTime != null">last_update_time = #{lastUpdateTime},</if>
 | 
					 | 
				
			||||||
            <if test="createTime != null">create_time = #{createTime},</if>
 | 
					 | 
				
			||||||
            <if test="updateTime != null">update_time = #{updateTime},</if>
 | 
					 | 
				
			||||||
            <if test="createBy != null">create_by = #{createBy},</if>
 | 
					 | 
				
			||||||
            <if test="updateBy != null">update_by = #{updateBy},</if>
 | 
					 | 
				
			||||||
        </trim>
 | 
					 | 
				
			||||||
        where hardware_sn = #{hardwareSn}
 | 
					 | 
				
			||||||
    </update>
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <delete id="deleteRmAgentManagementById" parameterType="Long">
 | 
					    <delete id="deleteRmAgentManagementById" parameterType="Long">
 | 
				
			||||||
        delete from rm_agent_management where id = #{id}
 | 
					        delete from rm_agent_management where id = #{id}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -23,10 +23,17 @@
 | 
				
			|||||||
        <result property="updateTime"    column="update_time"    />
 | 
					        <result property="updateTime"    column="update_time"    />
 | 
				
			||||||
        <result property="createBy"    column="create_by"    />
 | 
					        <result property="createBy"    column="create_by"    />
 | 
				
			||||||
        <result property="updateBy"    column="update_by"    />
 | 
					        <result property="updateBy"    column="update_by"    />
 | 
				
			||||||
 | 
					        <result property="scriptName"    column="script_name"    />
 | 
				
			||||||
 | 
					        <result property="scriptPath"    column="script_path"    />
 | 
				
			||||||
 | 
					        <result property="defaultParams"    column="default_params"    />
 | 
				
			||||||
 | 
					        <result property="deployDevice"    column="deploy_device"    />
 | 
				
			||||||
    </resultMap>
 | 
					    </resultMap>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <sql id="selectRmDeploymentPolicyVo">
 | 
					    <sql id="selectRmDeploymentPolicyVo">
 | 
				
			||||||
        select id, policy_name, description, resource_group_id, included_devices_id, source_file_path_type, source_file_path, target_directory, command_content, execution_method, scheduled_time, policy_status, deploy_time, script_type, create_time, update_time, create_by, update_by from rm_deployment_policy
 | 
					        select id, policy_name, description, resource_group_id, included_devices_id, source_file_path_type,
 | 
				
			||||||
 | 
					               source_file_path, target_directory, command_content, execution_method, scheduled_time, policy_status,
 | 
				
			||||||
 | 
					               deploy_time, script_type, create_time, update_time, create_by, update_by, script_name, script_path,
 | 
				
			||||||
 | 
					               default_params, deploy_device from rm_deployment_policy
 | 
				
			||||||
    </sql>
 | 
					    </sql>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <select id="selectRmDeploymentPolicyList" parameterType="RmDeploymentPolicy" resultMap="RmDeploymentPolicyResult">
 | 
					    <select id="selectRmDeploymentPolicyList" parameterType="RmDeploymentPolicy" resultMap="RmDeploymentPolicyResult">
 | 
				
			||||||
@@ -45,6 +52,9 @@
 | 
				
			|||||||
            <if test="policyStatus != null  and policyStatus != ''"> and policy_status = #{policyStatus}</if>
 | 
					            <if test="policyStatus != null  and policyStatus != ''"> and policy_status = #{policyStatus}</if>
 | 
				
			||||||
            <if test="deployTime != null "> and deploy_time = #{deployTime}</if>
 | 
					            <if test="deployTime != null "> and deploy_time = #{deployTime}</if>
 | 
				
			||||||
            <if test="scriptType != null  and scriptType != ''"> and script_type = #{scriptType}</if>
 | 
					            <if test="scriptType != null  and scriptType != ''"> and script_type = #{scriptType}</if>
 | 
				
			||||||
 | 
					            <if test="scriptName != null  and scriptName != ''"> and script_name = #{scriptName}</if>
 | 
				
			||||||
 | 
					            <if test="scriptPath != null  and scriptPath != ''"> and script_path = #{scriptPath}</if>
 | 
				
			||||||
 | 
					            <if test="defaultParams != null  and defaultParams != ''"> and default_params = #{defaultParams}</if>
 | 
				
			||||||
        </where>
 | 
					        </where>
 | 
				
			||||||
    </select>
 | 
					    </select>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -73,6 +83,10 @@
 | 
				
			|||||||
            <if test="updateTime != null">update_time,</if>
 | 
					            <if test="updateTime != null">update_time,</if>
 | 
				
			||||||
            <if test="createBy != null">create_by,</if>
 | 
					            <if test="createBy != null">create_by,</if>
 | 
				
			||||||
            <if test="updateBy != null">update_by,</if>
 | 
					            <if test="updateBy != null">update_by,</if>
 | 
				
			||||||
 | 
					            <if test="scriptName != null">script_name,</if>
 | 
				
			||||||
 | 
					            <if test="scriptPath != null">script_path,</if>
 | 
				
			||||||
 | 
					            <if test="defaultParams != null">default_params,</if>
 | 
				
			||||||
 | 
					            <if test="deployDevice != null">deploy_device,</if>
 | 
				
			||||||
        </trim>
 | 
					        </trim>
 | 
				
			||||||
        <trim prefix="values (" suffix=")" suffixOverrides=",">
 | 
					        <trim prefix="values (" suffix=")" suffixOverrides=",">
 | 
				
			||||||
            <if test="policyName != null and policyName != ''">#{policyName},</if>
 | 
					            <if test="policyName != null and policyName != ''">#{policyName},</if>
 | 
				
			||||||
@@ -92,6 +106,10 @@
 | 
				
			|||||||
            <if test="updateTime != null">#{updateTime},</if>
 | 
					            <if test="updateTime != null">#{updateTime},</if>
 | 
				
			||||||
            <if test="createBy != null">#{createBy},</if>
 | 
					            <if test="createBy != null">#{createBy},</if>
 | 
				
			||||||
            <if test="updateBy != null">#{updateBy},</if>
 | 
					            <if test="updateBy != null">#{updateBy},</if>
 | 
				
			||||||
 | 
					            <if test="scriptName != null">#{scriptName},</if>
 | 
				
			||||||
 | 
					            <if test="scriptPath != null">#{scriptPath},</if>
 | 
				
			||||||
 | 
					            <if test="defaultParams != null">#{defaultParams},</if>
 | 
				
			||||||
 | 
					            <if test="deployDevice != null">#{deployDevice},</if>
 | 
				
			||||||
        </trim>
 | 
					        </trim>
 | 
				
			||||||
    </insert>
 | 
					    </insert>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -116,6 +134,10 @@
 | 
				
			|||||||
            <if test="updateTime != null">update_time = #{updateTime},</if>
 | 
					            <if test="updateTime != null">update_time = #{updateTime},</if>
 | 
				
			||||||
            <if test="createBy != null">create_by = #{createBy},</if>
 | 
					            <if test="createBy != null">create_by = #{createBy},</if>
 | 
				
			||||||
            <if test="updateBy != null">update_by = #{updateBy},</if>
 | 
					            <if test="updateBy != null">update_by = #{updateBy},</if>
 | 
				
			||||||
 | 
					            <if test="scriptName != null">script_name = #{scriptName},</if>
 | 
				
			||||||
 | 
					            <if test="scriptPath != null">script_path = #{scriptPath},</if>
 | 
				
			||||||
 | 
					            <if test="defaultParams != null">default_params = #{defaultParams},</if>
 | 
				
			||||||
 | 
					            <if test="deployDevice != null">deploy_device = #{deployDevice},</if>
 | 
				
			||||||
        </trim>
 | 
					        </trim>
 | 
				
			||||||
        where id = #{id}
 | 
					        where id = #{id}
 | 
				
			||||||
    </update>
 | 
					    </update>
 | 
				
			||||||
@@ -130,4 +152,13 @@
 | 
				
			|||||||
            #{id}
 | 
					            #{id}
 | 
				
			||||||
        </foreach>
 | 
					        </foreach>
 | 
				
			||||||
    </delete>
 | 
					    </delete>
 | 
				
			||||||
 | 
					    <select id="selectRmDeploymentPolicyByClientId" parameterType="RmDeploymentPolicy" resultMap="RmDeploymentPolicyResult">
 | 
				
			||||||
 | 
					        <include refid="selectRmDeploymentPolicyVo"/>
 | 
				
			||||||
 | 
					        <where>
 | 
				
			||||||
 | 
					            <if test="policyStatus != null  and policyStatus != ''"> and policy_status = #{policyStatus}</if>
 | 
				
			||||||
 | 
					            <if test="deployDevice != null ">
 | 
				
			||||||
 | 
					                FIND_IN_SET(#{deployDevice}, REPLACE(deploy_device, '\n', ',')) > 0
 | 
				
			||||||
 | 
					            </if>
 | 
				
			||||||
 | 
					        </where>
 | 
				
			||||||
 | 
					    </select>
 | 
				
			||||||
</mapper>
 | 
					</mapper>
 | 
				
			||||||
@@ -0,0 +1,97 @@
 | 
				
			|||||||
 | 
					<?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">
 | 
				
			||||||
 | 
					<mapper namespace="com.ruoyi.rocketmq.mapper.RmFileInfoMapper">
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    <resultMap type="RmFileInfo" id="RmFileInfoResult">
 | 
				
			||||||
 | 
					        <result property="id"    column="id"    />
 | 
				
			||||||
 | 
					        <result property="name"    column="name"    />
 | 
				
			||||||
 | 
					        <result property="type"    column="type"    />
 | 
				
			||||||
 | 
					        <result property="description"    column="description"    />
 | 
				
			||||||
 | 
					        <result property="fileSize"    column="file_size"    />
 | 
				
			||||||
 | 
					        <result property="md5"    column="md5"    />
 | 
				
			||||||
 | 
					        <result property="path"    column="path"    />
 | 
				
			||||||
 | 
					        <result property="createTime"    column="create_time"    />
 | 
				
			||||||
 | 
					        <result property="updateTime"    column="update_time"    />
 | 
				
			||||||
 | 
					        <result property="createBy"    column="create_by"    />
 | 
				
			||||||
 | 
					        <result property="updateBy"    column="update_by"    />
 | 
				
			||||||
 | 
					    </resultMap>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <sql id="selectRmFileInfoVo">
 | 
				
			||||||
 | 
					        select id, name, type, description, file_size, md5, path, create_time, update_time, create_by, update_by from rm_file_info
 | 
				
			||||||
 | 
					    </sql>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <select id="selectRmFileInfoList" parameterType="RmFileInfo" resultMap="RmFileInfoResult">
 | 
				
			||||||
 | 
					        <include refid="selectRmFileInfoVo"/>
 | 
				
			||||||
 | 
					        <where>  
 | 
				
			||||||
 | 
					            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
 | 
				
			||||||
 | 
					            <if test="type != null  and type != ''"> and type = #{type}</if>
 | 
				
			||||||
 | 
					            <if test="description != null  and description != ''"> and description = #{description}</if>
 | 
				
			||||||
 | 
					            <if test="fileSize != null "> and file_size = #{fileSize}</if>
 | 
				
			||||||
 | 
					            <if test="md5 != null  and md5 != ''"> and md5 = #{md5}</if>
 | 
				
			||||||
 | 
					            <if test="path != null  and path != ''"> and path = #{path}</if>
 | 
				
			||||||
 | 
					        </where>
 | 
				
			||||||
 | 
					    </select>
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    <select id="selectRmFileInfoById" parameterType="Long" resultMap="RmFileInfoResult">
 | 
				
			||||||
 | 
					        <include refid="selectRmFileInfoVo"/>
 | 
				
			||||||
 | 
					        where id = #{id}
 | 
				
			||||||
 | 
					    </select>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <insert id="insertRmFileInfo" parameterType="RmFileInfo" useGeneratedKeys="true" keyProperty="id">
 | 
				
			||||||
 | 
					        insert into rm_file_info
 | 
				
			||||||
 | 
					        <trim prefix="(" suffix=")" suffixOverrides=",">
 | 
				
			||||||
 | 
					            <if test="name != null and name != ''">name,</if>
 | 
				
			||||||
 | 
					            <if test="type != null and type != ''">type,</if>
 | 
				
			||||||
 | 
					            <if test="description != null">description,</if>
 | 
				
			||||||
 | 
					            <if test="fileSize != null">file_size,</if>
 | 
				
			||||||
 | 
					            <if test="md5 != null and md5 != ''">md5,</if>
 | 
				
			||||||
 | 
					            <if test="path != null and path != ''">path,</if>
 | 
				
			||||||
 | 
					            <if test="createTime != null">create_time,</if>
 | 
				
			||||||
 | 
					            <if test="updateTime != null">update_time,</if>
 | 
				
			||||||
 | 
					            <if test="createBy != null">create_by,</if>
 | 
				
			||||||
 | 
					            <if test="updateBy != null">update_by,</if>
 | 
				
			||||||
 | 
					         </trim>
 | 
				
			||||||
 | 
					        <trim prefix="values (" suffix=")" suffixOverrides=",">
 | 
				
			||||||
 | 
					            <if test="name != null and name != ''">#{name},</if>
 | 
				
			||||||
 | 
					            <if test="type != null and type != ''">#{type},</if>
 | 
				
			||||||
 | 
					            <if test="description != null">#{description},</if>
 | 
				
			||||||
 | 
					            <if test="fileSize != null">#{fileSize},</if>
 | 
				
			||||||
 | 
					            <if test="md5 != null and md5 != ''">#{md5},</if>
 | 
				
			||||||
 | 
					            <if test="path != null and path != ''">#{path},</if>
 | 
				
			||||||
 | 
					            <if test="createTime != null">#{createTime},</if>
 | 
				
			||||||
 | 
					            <if test="updateTime != null">#{updateTime},</if>
 | 
				
			||||||
 | 
					            <if test="createBy != null">#{createBy},</if>
 | 
				
			||||||
 | 
					            <if test="updateBy != null">#{updateBy},</if>
 | 
				
			||||||
 | 
					         </trim>
 | 
				
			||||||
 | 
					    </insert>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <update id="updateRmFileInfo" parameterType="RmFileInfo">
 | 
				
			||||||
 | 
					        update rm_file_info
 | 
				
			||||||
 | 
					        <trim prefix="SET" suffixOverrides=",">
 | 
				
			||||||
 | 
					            <if test="name != null and name != ''">name = #{name},</if>
 | 
				
			||||||
 | 
					            <if test="type != null and type != ''">type = #{type},</if>
 | 
				
			||||||
 | 
					            <if test="description != null">description = #{description},</if>
 | 
				
			||||||
 | 
					            <if test="fileSize != null">file_size = #{fileSize},</if>
 | 
				
			||||||
 | 
					            <if test="md5 != null and md5 != ''">md5 = #{md5},</if>
 | 
				
			||||||
 | 
					            <if test="path != null and path != ''">path = #{path},</if>
 | 
				
			||||||
 | 
					            <if test="createTime != null">create_time = #{createTime},</if>
 | 
				
			||||||
 | 
					            <if test="updateTime != null">update_time = #{updateTime},</if>
 | 
				
			||||||
 | 
					            <if test="createBy != null">create_by = #{createBy},</if>
 | 
				
			||||||
 | 
					            <if test="updateBy != null">update_by = #{updateBy},</if>
 | 
				
			||||||
 | 
					        </trim>
 | 
				
			||||||
 | 
					        where id = #{id}
 | 
				
			||||||
 | 
					    </update>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <delete id="deleteRmFileInfoById" parameterType="Long">
 | 
				
			||||||
 | 
					        delete from rm_file_info where id = #{id}
 | 
				
			||||||
 | 
					    </delete>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <delete id="deleteRmFileInfoByIds" parameterType="String">
 | 
				
			||||||
 | 
					        delete from rm_file_info where id in 
 | 
				
			||||||
 | 
					        <foreach item="id" collection="array" open="(" separator="," close=")">
 | 
				
			||||||
 | 
					            #{id}
 | 
				
			||||||
 | 
					        </foreach>
 | 
				
			||||||
 | 
					    </delete>
 | 
				
			||||||
 | 
					</mapper>
 | 
				
			||||||
@@ -0,0 +1,99 @@
 | 
				
			|||||||
 | 
					<?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">
 | 
				
			||||||
 | 
					<mapper namespace="com.ruoyi.rocketmq.mapper.RmPolicyDeviceDetailsMapper">
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    <resultMap type="RmPolicyDeviceDetails" id="RmPolicyDeviceDetailsResult">
 | 
				
			||||||
 | 
					        <result property="id"    column="id"    />
 | 
				
			||||||
 | 
					        <result property="clientId"    column="client_id"    />
 | 
				
			||||||
 | 
					        <result property="policyId"    column="policy_id"    />
 | 
				
			||||||
 | 
					        <result property="scriptId"    column="script_id"    />
 | 
				
			||||||
 | 
					        <result property="versionId"    column="version_id"    />
 | 
				
			||||||
 | 
					        <result property="policyStatus"    column="policy_status"    />
 | 
				
			||||||
 | 
					        <result property="createTime"    column="create_time"    />
 | 
				
			||||||
 | 
					        <result property="updateTime"    column="update_time"    />
 | 
				
			||||||
 | 
					        <result property="createBy"    column="create_by"    />
 | 
				
			||||||
 | 
					        <result property="updateBy"    column="update_by"    />
 | 
				
			||||||
 | 
					    </resultMap>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <sql id="selectRmPolicyDeviceDetailsVo">
 | 
				
			||||||
 | 
					        select id, client_id, policy_id, script_id, version_id, policy_status, create_time, update_time, create_by, update_by from rm_policy_device_details
 | 
				
			||||||
 | 
					    </sql>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <select id="selectRmPolicyDeviceDetailsList" parameterType="RmPolicyDeviceDetails" resultMap="RmPolicyDeviceDetailsResult">
 | 
				
			||||||
 | 
					        <include refid="selectRmPolicyDeviceDetailsVo"/>
 | 
				
			||||||
 | 
					        <where>  
 | 
				
			||||||
 | 
					            <if test="clientId != null  and clientId != ''"> and client_id = #{clientId}</if>
 | 
				
			||||||
 | 
					            <if test="policyId != null  and policyId != ''"> and policy_id = #{policyId}</if>
 | 
				
			||||||
 | 
					            <if test="scriptId != null  and scriptId != ''"> and script_id = #{scriptId}</if>
 | 
				
			||||||
 | 
					            <if test="versionId != null  and versionId != ''"> and version_id = #{versionId}</if>
 | 
				
			||||||
 | 
					            <if test="policyStatus != null  and policyStatus != ''"> and policy_status = #{policyStatus}</if>
 | 
				
			||||||
 | 
					        </where>
 | 
				
			||||||
 | 
					    </select>
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    <select id="selectRmPolicyDeviceDetailsById" parameterType="Long" resultMap="RmPolicyDeviceDetailsResult">
 | 
				
			||||||
 | 
					        <include refid="selectRmPolicyDeviceDetailsVo"/>
 | 
				
			||||||
 | 
					        where id = #{id}
 | 
				
			||||||
 | 
					    </select>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <insert id="insertRmPolicyDeviceDetails" parameterType="RmPolicyDeviceDetails" useGeneratedKeys="true" keyProperty="id">
 | 
				
			||||||
 | 
					        insert into rm_policy_device_details
 | 
				
			||||||
 | 
					        <trim prefix="(" suffix=")" suffixOverrides=",">
 | 
				
			||||||
 | 
					            <if test="clientId != null and clientId != ''">client_id,</if>
 | 
				
			||||||
 | 
					            <if test="policyId != null and policyId != ''">policy_id,</if>
 | 
				
			||||||
 | 
					            <if test="scriptId != null">script_id,</if>
 | 
				
			||||||
 | 
					            <if test="versionId != null">version_id,</if>
 | 
				
			||||||
 | 
					            <if test="policyStatus != null and policyStatus != ''">policy_status,</if>
 | 
				
			||||||
 | 
					            <if test="createTime != null">create_time,</if>
 | 
				
			||||||
 | 
					            <if test="updateTime != null">update_time,</if>
 | 
				
			||||||
 | 
					            <if test="createBy != null">create_by,</if>
 | 
				
			||||||
 | 
					            <if test="updateBy != null">update_by,</if>
 | 
				
			||||||
 | 
					         </trim>
 | 
				
			||||||
 | 
					        <trim prefix="values (" suffix=")" suffixOverrides=",">
 | 
				
			||||||
 | 
					            <if test="clientId != null and clientId != ''">#{clientId},</if>
 | 
				
			||||||
 | 
					            <if test="policyId != null and policyId != ''">#{policyId},</if>
 | 
				
			||||||
 | 
					            <if test="scriptId != null">#{scriptId},</if>
 | 
				
			||||||
 | 
					            <if test="versionId != null">#{versionId},</if>
 | 
				
			||||||
 | 
					            <if test="policyStatus != null and policyStatus != ''">#{policyStatus},</if>
 | 
				
			||||||
 | 
					            <if test="createTime != null">#{createTime},</if>
 | 
				
			||||||
 | 
					            <if test="updateTime != null">#{updateTime},</if>
 | 
				
			||||||
 | 
					            <if test="createBy != null">#{createBy},</if>
 | 
				
			||||||
 | 
					            <if test="updateBy != null">#{updateBy},</if>
 | 
				
			||||||
 | 
					         </trim>
 | 
				
			||||||
 | 
					    </insert>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <update id="updateRmPolicyDeviceDetails" parameterType="RmPolicyDeviceDetails">
 | 
				
			||||||
 | 
					        update rm_policy_device_details
 | 
				
			||||||
 | 
					        <trim prefix="SET" suffixOverrides=",">
 | 
				
			||||||
 | 
					            <if test="policyStatus != null and policyStatus != ''">policy_status = #{policyStatus},</if>
 | 
				
			||||||
 | 
					            <if test="createTime != null">create_time = #{createTime},</if>
 | 
				
			||||||
 | 
					            <if test="updateTime != null">update_time = #{updateTime},</if>
 | 
				
			||||||
 | 
					            <if test="createBy != null">create_by = #{createBy},</if>
 | 
				
			||||||
 | 
					            <if test="updateBy != null">update_by = #{updateBy},</if>
 | 
				
			||||||
 | 
					        </trim>
 | 
				
			||||||
 | 
					        where
 | 
				
			||||||
 | 
					        <choose>
 | 
				
			||||||
 | 
					            <when test="id != null">
 | 
				
			||||||
 | 
					                id = #{id}
 | 
				
			||||||
 | 
					            </when>
 | 
				
			||||||
 | 
					            <when test="policyId != null and policyId != '' and clientId != null and clientId != ''">
 | 
				
			||||||
 | 
					                policy_id = #{policyId} and client_id = #{clientId}
 | 
				
			||||||
 | 
					            </when>
 | 
				
			||||||
 | 
					            <otherwise>
 | 
				
			||||||
 | 
					                1=0 <!-- 如果没有提供任何条件,则不更新任何记录 -->
 | 
				
			||||||
 | 
					            </otherwise>
 | 
				
			||||||
 | 
					        </choose>
 | 
				
			||||||
 | 
					    </update>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <delete id="deleteRmPolicyDeviceDetailsById" parameterType="Long">
 | 
				
			||||||
 | 
					        delete from rm_policy_device_details where id = #{id}
 | 
				
			||||||
 | 
					    </delete>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    <delete id="deleteRmPolicyDeviceDetailsByIds" parameterType="String">
 | 
				
			||||||
 | 
					        delete from rm_policy_device_details where id in 
 | 
				
			||||||
 | 
					        <foreach item="id" collection="array" open="(" separator="," close=")">
 | 
				
			||||||
 | 
					            #{id}
 | 
				
			||||||
 | 
					        </foreach>
 | 
				
			||||||
 | 
					    </delete>
 | 
				
			||||||
 | 
					</mapper>
 | 
				
			||||||
		Reference in New Issue
	
	Block a user