Browse Source

Revert "模板编辑复制粘贴操作"

This reverts commit b74cb8ba43ff3d6cfe520a951eb4283afc0e1b9b.
yucheng 2 years ago
parent
commit
c8fb8d56f6

+ 0 - 10
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/controller/TemplateController.java

@@ -106,14 +106,4 @@ public class TemplateController {
         return ResultHelper.single(templateManager.modifyDynGroup(params.getDynGroup(), params.getCurrentCompId(), params.getTemplateId()));
     }
 
-    @PostMapping("copyContent")
-    public CommonResult<String> copyContent(@RequestBody EditRequest params){
-        return ResultHelper.single(templateManager.getCopyContent(params.getCurrentCompId(), params.getTemplateId()));
-    }
-
-    @PostMapping("pasteContent")
-    public CommonResult<DiagramTemplate> pasteContent(@RequestBody EditRequest params){
-        return ResultHelper.single(templateManager.setPasteContent(params.getContent(), params.getCurrentCompId(), params.getTemplateId()));
-    }
-
 }

+ 0 - 2
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/frame/EditRequest.java

@@ -40,8 +40,6 @@ public class EditRequest {
 
 	private DynGroup dynGroup;
 
-	private String content;
-
 	@Data
 	public static class TemplatePropsData {
 

+ 0 - 61
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/manage/TemplateManager.java

@@ -2,7 +2,6 @@ package com.persagy.adm.diagram.manage;
 
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.IdUtil;
-import cn.hutool.core.util.StrUtil;
 import com.fasterxml.jackson.databind.node.ObjectNode;
 import com.persagy.adm.diagram.core.ContentParser;
 import com.persagy.adm.diagram.core.DataStrategy;
@@ -402,64 +401,4 @@ public class TemplateManager {
         return saveTemplate(template);
     }
 
-    public String getCopyContent(String compId, String templateId){
-        DiagramTemplate template = dataStrategy.getTemplate(templateId);
-        template.init();
-
-        Object obj;
-        if(StrUtil.isNotBlank(compId)) {
-            obj = template.getContainerById(compId);
-            if(obj == null){
-                obj = template.getMainPipeById(compId);
-            }
-        } else {
-            obj = template;
-        }
-        return obj != null ? contentParser.toJson(obj) : "";
-    }
-
-    public DiagramTemplate setPasteContent(String content, String compId, String templateId){
-        DiagramTemplate template = dataStrategy.getTemplate(templateId);
-        template.init();
-
-        if(StrUtil.isNotBlank(content)) {
-            Map<String, Object> map = contentParser.parseContent(content, Map.class);
-            Object o = null;
-            if(Container.TYPE.equals(map.get("compType"))){
-                o = contentParser.parseContent(content, Container.class);
-            } else if(MainPipe.TYPE.equals(map.get("compType"))) {
-                o = contentParser.parseContent(content, MainPipe.class);
-            } else if(map.containsKey("frame")) {
-                o = contentParser.parseContent(content, DiagramTemplate.class);
-            }
-
-            if(o != null) {
-                if(o instanceof DiagramTemplate){
-                    DiagramTemplate other = (DiagramTemplate)o;
-                    if(StrUtil.isBlank(compId)) {
-                        template.setFrame(other.getFrame());
-                        template.setMainPipes(other.getMainPipes());
-                        template.setScatteredContainers(other.getScatteredContainers());
-                    }
-                } else if(o instanceof Container) {
-                    Container target = null;
-                    if(StrUtil.isNotBlank(compId)) {
-                        Container con = template.getContainerById(compId);
-                        if(con != null){
-                            target = con;
-                        }
-                    } else {
-                      target = template.getFrame();
-                    }
-                    if(target != null){
-                        target.addComp((Container)o);
-                    }
-                } else {
-                    //暂不支持干管粘贴
-                }
-            }
-        }
-        return saveTemplate(template);
-    }
-
 }