Browse Source

细节完善

zhaoyk 3 years ago
parent
commit
74e61905e4

+ 8 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/controller/DemoDiagramController.java

@@ -102,4 +102,12 @@ public class DemoDiagramController {
         return ResultHelper.single(diagramManager.saveDiagram(req.getDiagram()));
     }
 
+    /**
+     * 重置系统图
+     */
+    @PostMapping("resetDiagram")
+    public CommonResult<Diagram> resetDiagram(@RequestBody EditRequest req) {
+        return ResultHelper.single(diagramManager.resetDiagram(req.getDiagramId()));
+    }
+
 }

+ 3 - 1
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/core/DiagramBuilder.java

@@ -422,9 +422,11 @@ public class DiagramBuilder {
 		if(obj.get("localName") != null) {
 			name = obj.get("localName").asText();
 		}
-		if(StrUtil.isBlank(name)) {
+		if(StrUtil.isBlank(name) && obj.get("name") != null) {
 			name = obj.get("name").asText();
 		}
+		if(name == null)
+			System.out.println();
 		return name;
 	}
 

+ 16 - 1
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/manage/DemoDiagramManager.java

@@ -131,7 +131,22 @@ public class DemoDiagramManager {
 	 */
 	public Diagram saveDiagram(Map<String, Object> diagramMap) {
 		Diagram diagram = manager.fromMapData(diagramMap);
-		return dataStrategy.saveDiagram(diagram);
+		dataStrategy.saveDiagram(diagram);
+		manager.buildDiagram(diagram);
+		return diagram;
+	}
+
+	/**
+	 * 重置系统图
+	 */
+	public Diagram resetDiagram(String diagramId) {
+		Diagram diagram = dataStrategy.getDiagram(diagramId);
+		manager.resetDiagram(diagram);
+
+		dataStrategy.saveDiagram(diagram);
+		manager.buildDiagram(diagram);
+
+		return diagram;
 	}
 
 }