Commit 85f55ce2 authored by gaozhentao's avatar gaozhentao

修改拓扑图参数信息

parent a1710a9d
package com.yingxin.prms.dto;
import java.util.List;
/**
* Created by gaoxiang on 2019/7/29.
*/
public class TcpFlowLineDto {
private String from; //出发点
private String to; //目的点
private String description;
private String descriptionCss;
private String fromSpot; //出发点代表位置 (上或下或左或右)
private String toSpot; //目的点代表位置 (上或下或左或右)
private String color;
private String text;
private List points;
private String client_alias;
private String server_alias;
private int errorTcpTransactionTotalCount;
private int tcpTransactionTotalCount;
public String getFrom() {
return from;
}
public void setFrom(String from) {
this.from = from;
}
public String getTo() {
return to;
}
public void setTo(String to) {
this.to = to;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getFromSpot() {
return fromSpot;
}
public void setFromSpot(String fromSpot) {
this.fromSpot = fromSpot;
}
public String getToSpot() {
return toSpot;
}
public void setToSpot(String toSpot) {
this.toSpot = toSpot;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public List getPoints() {
return points;
}
public void setPoints(List points) {
this.points = points;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getClient_alias() {
return client_alias;
}
public void setClient_alias(String client_alias) {
this.client_alias = client_alias;
}
public String getServer_alias() {
return server_alias;
}
public void setServer_alias(String server_alias) {
this.server_alias = server_alias;
}
public int getErrorTcpTransactionTotalCount() {
return errorTcpTransactionTotalCount;
}
public void setErrorTcpTransactionTotalCount(int errorTcpTransactionTotalCount) {
this.errorTcpTransactionTotalCount = errorTcpTransactionTotalCount;
}
public int getTcpTransactionTotalCount() {
return tcpTransactionTotalCount;
}
public void setTcpTransactionTotalCount(int tcpTransactionTotalCount) {
this.tcpTransactionTotalCount = tcpTransactionTotalCount;
}
public String getDescriptionCss() {
return descriptionCss;
}
public void setDescriptionCss(String descriptionCss) {
this.descriptionCss = descriptionCss;
}
@Override
public String toString() {
return "TcpFlowLineDto{" +
"from='" + from + '\'' +
", to='" + to + '\'' +
", description='" + description + '\'' +
", descriptionCss='" + descriptionCss + '\'' +
", fromSpot='" + fromSpot + '\'' +
", toSpot='" + toSpot + '\'' +
", color='" + color + '\'' +
", text='" + text + '\'' +
", points=" + points +
", client_alias='" + client_alias + '\'' +
", server_alias='" + server_alias + '\'' +
", errorTcpTransactionTotalCount=" + errorTcpTransactionTotalCount +
", tcpTransactionTotalCount=" + tcpTransactionTotalCount +
'}';
}
}
package com.yingxin.prms.dto;
/**
* Created by gaoxiang on 2019/8/13.
*/
public class TcpFlowNodeDto {
private String key; //标识
/**/
private String category; //图标标识
private String description;
private String descriptionCss;
private String pos;
private String text;
private String serverName; //集群名
private String imgsrc;
private String caption;
private int tcpTransactionTotalCount;
private int errorTcpTransactionTotalCount;
private int faultCount; //错误数
private String url; //服务路径
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public int getFaultCount() {
return faultCount;
}
public void setFaultCount(int faultCount) {
this.faultCount = faultCount;
}
public String getKey() {
return key;
}
public void setKey(String key) {
this.key = key;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public String getPos() {
return pos;
}
public void setPos(String pos) {
this.pos = pos;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getServerName() {
return serverName;
}
public void setServerName(String serverName) {
this.serverName = serverName;
}
public String getImgsrc() {
return imgsrc;
}
public void setImgsrc(String imgsrc) {
this.imgsrc = imgsrc;
}
public String getCaption() {
return caption;
}
public void setCaption(String caption) {
this.caption = caption;
}
public int getTcpTransactionTotalCount() {
return tcpTransactionTotalCount;
}
public void setTcpTransactionTotalCount(int tcpTransactionTotalCount) {
this.tcpTransactionTotalCount = tcpTransactionTotalCount;
}
public int getErrorTcpTransactionTotalCount() {
return errorTcpTransactionTotalCount;
}
public void setErrorTcpTransactionTotalCount(int errorTcpTransactionTotalCount) {
this.errorTcpTransactionTotalCount = errorTcpTransactionTotalCount;
}
public String getDescriptionCss() {
return descriptionCss;
}
public void setDescriptionCss(String descriptionCss) {
this.descriptionCss = descriptionCss;
}
@Override
public String toString() {
return "TcpFlowNodeDto{" +
"key='" + key + '\'' +
", category='" + category + '\'' +
", description='" + description + '\'' +
", descriptionCss='" + descriptionCss + '\'' +
", pos='" + pos + '\'' +
", text='" + text + '\'' +
", serverName='" + serverName + '\'' +
", imgsrc='" + imgsrc + '\'' +
", caption='" + caption + '\'' +
", tcpTransactionTotalCount=" + tcpTransactionTotalCount +
", errorTcpTransactionTotalCount=" + errorTcpTransactionTotalCount +
'}';
}
}
...@@ -395,49 +395,40 @@ public class Manager { ...@@ -395,49 +395,40 @@ public class Manager {
} }
public Map selectTopology(){ public Map selectTopology(){
List<Server_Host_Info> serverHostInfoAll = authModeAndHostList.getClusterBeMonitoredList();
Map result = new HashMap(); Map result = new HashMap();
List<FlowNode> flowNodes = flowDao.findNodeAll(); List<FlowNode> flowNodes = flowDao.findNodeAll();
List<FlowLine> flowLines = flowDao.findLineAll(); List<FlowLine> flowLines = flowDao.findLineAll();
List<FlowNode> list = new ArrayList<>(); List<TcpFlowLineDto> lineDtos = new ArrayList<>();
if(flowNodes.size()>0){ List<TcpFlowNodeDto> nodeDtos = new ArrayList<>();
result.put("linkData",flowLines); TcpFlowNodeDto nodeDto = new TcpFlowNodeDto();
for(FlowNode node : flowNodes){ for(FlowNode node : flowNodes){
long faultCount=0; long faultCount=0;
try { try {
faultCount = getFaultCount(node.getServerPath()); faultCount = getFaultCount(node.getServerPath());
} catch (Exception e) { } catch (Exception e) {
faultCount = 0; faultCount = 0;
}
node.setFaultCount(String.valueOf(faultCount));
}
result.put("nodeData",flowNodes);
}else{
Map<String,String> map = new HashMap();
for(Server_Host_Info hostInfo : serverHostInfoAll){
if(!map.containsKey(hostInfo.getCluster_name())){
map.put(hostInfo.getCluster_name(),hostInfo.getService_path());
FlowNode flowNode = new FlowNode();
flowNode.setCluster_name(hostInfo.getCluster_name());
flowNode.setServerPath(hostInfo.getService_path());
flowNode.setCoordinate("初始坐标");
long faultCount=0;
try {
faultCount = getFaultCount(hostInfo.getService_path());
} catch (Exception e) {
faultCount = 0;
}
flowNode.setFaultCount(String.valueOf(faultCount));
if(faultCount>0){
flowNode.setMark("red");
}else{
flowNode.setMark("green");
}
list.add(flowNode);
flowDao.insertNode(flowNode);
}
} }
nodeDto.setFaultCount((int) faultCount);
nodeDto.setKey(node.getCluster_name());
nodeDto.setUrl(node.getServerPath());
nodeDto.setServerName(node.getCluster_name());
nodeDto.setCategory(node.getMark());
nodeDto.setPos(node.getCoordinate());
nodeDtos.add(nodeDto);
} }
for(FlowLine line : flowLines){
TcpFlowLineDto lineDto = new TcpFlowLineDto();
lineDto.setFrom(line.getCluster_name_left());
lineDto.setTo(line.getClusterNameRight());
lineDto.setFromSpot(line.getCoordinateLeft());
lineDto.setToSpot(line.getCoordinateRight());
lineDtos.add(lineDto);
}
result.put("class", "GraphLinksModel");
result.put("nodeDataArray", nodeDtos);
result.put("linkDataArray", lineDtos);
return result; return result;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment