|
|
@@ -288,11 +288,9 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
|
|
|
* @return
|
|
|
*/
|
|
|
@Override
|
|
|
- public NodeAttachment addDefaultAttachment(String projectId,String nodeId) {
|
|
|
+ public String addDefaultAttachment(String projectId,String nodeId) {
|
|
|
String nodeAttachmentId = null;
|
|
|
String tableName = "";
|
|
|
- Map<String, Object> directoryStructure = null;
|
|
|
-
|
|
|
//获取当前节点表名
|
|
|
List<ProjectWorkflow> projectWorkflowList = projectWorkflowMapper.selectByNodeId(nodeId,projectId);
|
|
|
if(CollectionUtils.isNotEmpty(projectWorkflowList) && Objects.nonNull(projectWorkflowList.get(0))) {
|
|
|
@@ -308,14 +306,10 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
|
|
|
String path = ServiceFileUtil.createMultipartDirectory(directoryName,subDirectoryNameArr);
|
|
|
//重新构建json文件
|
|
|
Path file = Paths.get(path);
|
|
|
- directoryStructure = FileExtractUtil.getDirectoryStructure(file);
|
|
|
+ Map<String, Object> directoryStructure = FileExtractUtil.getDirectoryStructure(file);
|
|
|
nodeAttachmentId = this.saveAttachment(directoryStructure,nodeId);
|
|
|
}
|
|
|
- NodeAttachment nodeAttachment = new NodeAttachment();
|
|
|
- nodeAttachment.setId(nodeAttachmentId);
|
|
|
- nodeAttachment.setNodeId(nodeId); // 不设置nodeId
|
|
|
- nodeAttachment.setAttachment(directoryStructure);
|
|
|
- return nodeAttachment;
|
|
|
+ return nodeAttachmentId;
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -484,14 +478,15 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
|
|
|
List<Map <String,String>> currentAttachmentList = ServiceUtil.getDirChildrenList(name,nodeAttachment);
|
|
|
//当前目录不存在此节点,需要通过依赖关系填充
|
|
|
if(CollectionUtils.isEmpty(currentAttachmentList)) {
|
|
|
- currentAttachmentList = new ArrayList<>();
|
|
|
- List<String> relationNameList = new ArrayList();
|
|
|
+ if(Objects.isNull(currentAttachmentList)) {
|
|
|
+ currentAttachmentList = new ArrayList<>();
|
|
|
+ }
|
|
|
String relationNameStr = attachmentEnum.getRelationName();
|
|
|
if (StringUtils.isNotBlank(relationNameStr)) {
|
|
|
- relationNameList = Arrays.asList(relationNameStr.split("\\|"));
|
|
|
+ List<String> relationNameList = Arrays.asList(relationNameStr.split("\\|"));
|
|
|
if (CollectionUtils.isNotEmpty(relationNameList)) {
|
|
|
for (String innerRelationNameStr : relationNameList) {
|
|
|
- List<String> innerRelationNameList = Arrays.asList(innerRelationNameStr.split("\\:"));
|
|
|
+ List<String> innerRelationNameList = Arrays.asList(innerRelationNameStr.split(":"));
|
|
|
String relationName = innerRelationNameList.get(0);
|
|
|
String tableName = innerRelationNameList.get(1);
|
|
|
NodeAttachment relationNodeAttachment = this.getAttachmentByProjectIdAndTable(projectId, tableName);
|
|
|
@@ -501,15 +496,17 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
|
|
|
}//end for
|
|
|
}
|
|
|
//这里构建当前节点的附件信息
|
|
|
- Map<String, Object> currentNodeAttachmentMap = new LinkedHashMap<>();
|
|
|
- currentNodeAttachmentMap.put("name", name);
|
|
|
- currentNodeAttachmentMap.put("path", "");
|
|
|
- currentNodeAttachmentMap.put("physicalFlag", "0");
|
|
|
- currentNodeAttachmentMap.put("type", "directory");
|
|
|
+// Map<String, Object> currentNodeAttachmentMap = new LinkedHashMap<>();
|
|
|
+// currentNodeAttachmentMap.put("name", name);
|
|
|
+// currentNodeAttachmentMap.put("path", "");
|
|
|
+// currentNodeAttachmentMap.put("physicalFlag", "0");
|
|
|
+// currentNodeAttachmentMap.put("type", "directory");
|
|
|
+// currentNodeAttachmentMap.put("children", currentAttachmentList);
|
|
|
+ //获取当前的节点
|
|
|
+ Map<String, Object> currentNodeAttachmentMap = ServiceUtil.getDirChildrenMap(name,nodeAttachment);
|
|
|
currentNodeAttachmentMap.put("children", currentAttachmentList);
|
|
|
attachmentChildrenList.add(currentNodeAttachmentMap);
|
|
|
}
|
|
|
-
|
|
|
//这里构建最终的附件信息list
|
|
|
attachmentMap.put("children",attachmentChildrenList);
|
|
|
nodeAttachment.setAttachment(attachmentMap);
|
|
|
@@ -517,6 +514,7 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
|
|
|
}
|
|
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
|
* 根据表名获取内容
|
|
|
* @param tableName
|