注册打印
This commit is contained in:
+49
-1
@@ -90,7 +90,55 @@ public class AgentConsumerDownListener implements RocketMQListener<String> {
|
||||
JSONObject object = new JSONObject();
|
||||
object.put("timestamp", timestamp);
|
||||
if(StringUtils.isNotBlank(switchBoard)){
|
||||
object.put("switchBoard",switchBoard);
|
||||
String community = "";
|
||||
String switchIp = "";
|
||||
int switchPort = 0;
|
||||
String netOID = "";
|
||||
String moduleOID = "";
|
||||
String mpuOID = "";
|
||||
String pwrOID = "";
|
||||
String fanOID = "";
|
||||
String otherOID = "";
|
||||
JSONObject json = JSONObject.parseObject(switchBoard);
|
||||
if(json.containsKey("community")){
|
||||
community = json.getString("community");
|
||||
}
|
||||
if(json.containsKey("ip")){
|
||||
switchIp = json.getString("ip");
|
||||
}
|
||||
if(json.containsKey("port")){
|
||||
switchPort = json.getInteger("port");
|
||||
}
|
||||
if(json.containsKey("netOID")){
|
||||
netOID = json.getString("netOID");
|
||||
}
|
||||
if(json.containsKey("moduleOID")){
|
||||
moduleOID = json.getString("moduleOID");
|
||||
}
|
||||
if(json.containsKey("mpuOID")){
|
||||
mpuOID = json.getString("mpuOID");
|
||||
}
|
||||
if(json.containsKey("pwrOID")){
|
||||
pwrOID = json.getString("pwrOID");
|
||||
}
|
||||
if(json.containsKey("fanOID")){
|
||||
fanOID = json.getString("fanOID");
|
||||
}
|
||||
if(json.containsKey("otherOID")){
|
||||
otherOID = json.getString("otherOID");
|
||||
}
|
||||
JSONObject switchBoardJson = new JSONObject();
|
||||
switchBoardJson.put("community",community);
|
||||
switchBoardJson.put("ip",switchIp);
|
||||
switchBoardJson.put("port",switchPort);
|
||||
switchBoardJson.put("netOID",netOID);
|
||||
switchBoardJson.put("moduleOID",moduleOID);
|
||||
switchBoardJson.put("mpuOID",mpuOID);
|
||||
switchBoardJson.put("pwrOID",pwrOID);
|
||||
switchBoardJson.put("fanOID",fanOID);
|
||||
switchBoardJson.put("otherOID",otherOID);
|
||||
object.put("switchBoard",switchBoardJson.toString());
|
||||
AssertLog.info("交换机配置信息={}",switchBoardJson.toString());
|
||||
}
|
||||
Message msg = Message.builder().clientId(dto.getClientId()).dataType(MsgEnum.注册.getValue()).data(object.toString()).build();
|
||||
// 将对象转为 JSON 字符串
|
||||
|
||||
Reference in New Issue
Block a user