Commit 9c56cb40 authored by gaozhentao's avatar gaozhentao

修改拓扑图参数

parent e7da0b4c
......@@ -23,6 +23,7 @@ public class FlowLine {
@Column("coordinate_right")
String coordinateRight; //右坐标
String points; //坐标
String color; //坐标
public String getPoints() {
return points;
......@@ -32,6 +33,14 @@ public class FlowLine {
this.points = points;
}
public String getColor() {
return color;
}
public void setColor(String color) {
this.color = color;
}
public String getCluster_name_left() {
return cluster_name_left;
}
......
......@@ -405,6 +405,12 @@ public class Manager {
long faultCount=0;
try {
faultCount = getFaultCount(node.getServerPath());
if(faultCount>0){
/* machine浅色图标 clusterFault错误图标 clusterNormal正常图标 */
nodeDto.setCategory("clusterFault");
}else{
nodeDto.setCategory("clusterNormal");
}
} catch (Exception e) {
faultCount = 0;
}
......@@ -413,7 +419,6 @@ public class Manager {
nodeDto.setUrl(node.getServerPath());
nodeDto.setServerName(node.getCluster_name());
nodeDto.setText(node.getCluster_name());
nodeDto.setCategory(node.getMark());
nodeDto.setPos(node.getCoordinate());
nodeDtos.add(nodeDto);
}
......@@ -424,7 +429,15 @@ public class Manager {
lineDto.setTo(line.getClusterNameRight());
lineDto.setFromSpot(line.getCoordinateLeft());
lineDto.setToSpot(line.getCoordinateRight());
lineDto.setColor("#008000");
lineDto.setColor(line.getColor());
String point = line.getPoints();
if(point!=null && point.length()>0){
point = point.substring(1,point.length()-2);
List points = Arrays.asList(point.split(","));
lineDto.setPoints(points);
}else{
lineDto.setPoints(null);
}
lineDtos.add(lineDto);
}
result.put("class", "GraphLinksModel");
......@@ -448,18 +461,16 @@ public class Manager {
public Map saveTopology(String json) {
JSONObject jsonObject = JSONObject.fromObject(json);
List<Map<String,String>> list = jsonObject.getJSONArray("list");
for(Map<String,String> map : list){
List<Map<String,String>> nodeList = jsonObject.getJSONArray("nodeDataArray");
List<Map<String,String>> linkList = jsonObject.getJSONArray("linkDataArray");
for(Map<String,String> map : nodeList){
if(map!=null && !map.isEmpty()){
flowDao.updateNode(map.get("serverName"),map.get("pos"), map.get("category"));
}
}
for(Map<String,String> map : linkList){
if(map!=null && !map.isEmpty()){
flowDao.updateNode(map.get("clusterName"),map.get("coordinate"), map.get("mark"));
flowDao.updateLine(map.get("clusterNameLeft"),map.get("clusterNameRight"), map.get("points"));
// String id = UUID.randomUUID().toString();
// FlowLine flowLine = new FlowLine();
// flowLine.setClusterNameLeft(map.get("clusterNameLeft"));
// flowLine.setClusterNameRight(map.get("clusterNameRight"));
// flowLine.setCoordinateLeft(map.get("coordinateLeft"));
// flowLine.setCoordinateRight(map.get("coordinateRight"));
// flowDao.insertLine(flowLine);
flowDao.updateLine(map.get("from"),map.get("to"), map.get("points"),map.get("color"));
}
}
Map result = new HashMap();
......
......@@ -51,8 +51,8 @@ public class FlowDaoImpl {
template.getCqlOperations().execute(cql);
}
public void updateLine(String clusterNameLeft, String clusterNameRight, String points) {
String cql ="UPDATE ctid_prof.flowline SET points='"+points+"' " +
public void updateLine(String clusterNameLeft, String clusterNameRight, String points, String color) {
String cql ="UPDATE ctid_prof.flowline SET points='"+points+"',color ='"+color+"' " +
"where cluster_name_left='"+clusterNameLeft+"' and cluster_name_right='"+clusterNameRight+"'";
template.getCqlOperations().execute(cql);
}
......
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