Browse Source

报批默认附件

chenendian 2 months ago
parent
commit
c47a88fd25

+ 16 - 6
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/NodeAttachmentController.java

@@ -364,12 +364,22 @@ public class NodeAttachmentController extends BaseController {
     }
 
 
-
-
-
-
-
-
+    @GetMapping("/defaultAttachment")
+    public R<NodeAttachment> getDefaultAttachment() {
+        try {
+            //这里使用默认值
+            String tableName = AloneWorkFlowEnum.NODE_1.getTableName();
+            NodeAttachment nodeAttachment = new NodeAttachment();
+            nodeAttachment.setId(null);
+            nodeAttachment.setNodeId(null);
+            Map<String, Object> attachment = nodeAttachmentService.getDefaultAttachment(tableName);
+            nodeAttachment.setAttachment(attachment);
+            return R.ok(nodeAttachment);
+        } catch (Exception e) {
+            logger.error("获取批次报批集成数据失败", e);
+            return R.fail(502,"获取批次报批集成数据失败:" + e.getMessage());
+        }
+    }
 
 
 }

+ 2 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/NodeAttachmentService.java

@@ -64,4 +64,6 @@ public interface NodeAttachmentService {
 
     Boolean  modifyAttachmentInfo(String projectId,String nodeId,String nodeAttachmentId);
 
+    Map<String, Object>  getDefaultAttachment(String tableName) ;
+
     }

+ 23 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/impl/NodeAttachmentImpl.java

@@ -679,6 +679,29 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
     }
 
 
+    @Override
+    public  Map<String, Object>  getDefaultAttachment(String tableName) {
+        Map<String,List<String>> resultMap =  getCurrentAttachmentName(tableName,null);
+        String directoryName = resultMap.keySet().stream().findFirst().get();
+        Map<String, Object> structure = new HashMap<>();
+        structure.put("name", directoryName);
+        structure.put("type", "directory" );
+        structure.put("path", "");
+        List<String> subDirectoryList  = resultMap.values().stream().findFirst().get();
+        List<Map<String, Object>> list = new ArrayList<>();
+        for (String subDirectoryName : subDirectoryList) {
+            Map<String, Object> children = new LinkedHashMap<>();
+            children.put("name", subDirectoryName);
+            children.put("type", "directory" );
+            children.put("path", "");
+            children.put("children", new ArrayList<>());
+            list.add(children);
+        }
+        structure.put("children", list);
+        return structure;
+    }
+
+
 
 
 }

+ 1 - 1
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/impl/ProjectImpl.java

@@ -223,7 +223,7 @@ public class ProjectImpl implements ProjectService {
         List<ProjectCycleRes> workflows = workflowMapper.selectByProjectTypeOrderByIndex(projectType);
         // 获取项目对应的工作流
         List<ProjectWorkflowRes> projectWorkflowsAll = projectWorkflowMapper.selectCycleByProjectId(projectId);
-        // 过滤掉没有上链的
+        // 过滤掉没有上链的x
         List<ProjectWorkflowRes> projectWorkflows = new ArrayList<>();
         for (ProjectWorkflowRes projectWorkflowRes : projectWorkflowsAll) {
             Boolean hasOnchain = projectWorkflowMapper.isOnchain(projectWorkflowRes.getNodeId(), projectId, projectWorkflowRes.getNodeTableName());