|
|
@@ -335,6 +335,12 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
|
|
|
public NodeAttachment getNodeAttachmentData(String nodeId) {
|
|
|
try {
|
|
|
NodeAttachment nodeAttachment = this.getByNodeId(nodeId);
|
|
|
+ if(Objects.isNull(nodeAttachment)){
|
|
|
+ nodeAttachment = new NodeAttachment();
|
|
|
+ nodeAttachment.setId("");
|
|
|
+ nodeAttachment.setNodeId(nodeId);
|
|
|
+ }
|
|
|
+
|
|
|
ProjectWorkflow projectWorkflow = null;
|
|
|
//根据节点获取表名
|
|
|
List<ProjectWorkflow> projectWorkflowList = projectWorkflowMapper.selectByNodeId(nodeId,null);
|
|
|
@@ -349,9 +355,6 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
|
|
|
Project project =projectMapper.get(projectId);
|
|
|
Integer projectType = project.getProjectType();
|
|
|
|
|
|
- //最终结果集合
|
|
|
- Map <String, Object> currentNodeAttachmentMap = null;
|
|
|
-
|
|
|
//单独选址
|
|
|
if(ProjectType.ALONE.getCode().equals(String.valueOf(projectType))){
|
|
|
nodeTableName = "t_ydbp";
|
|
|
@@ -361,14 +364,11 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
|
|
|
//取当前节点数据内容;
|
|
|
TdgyRes tdgy = tdgyService.getById(nodeId);
|
|
|
String gdType = tdgy.getGdType();
|
|
|
-
|
|
|
-
|
|
|
if("出让".equals(gdType)) {
|
|
|
//处理-规划条件出具依赖
|
|
|
- currentNodeAttachmentMap = this.assemblyAttachment(projectId,TdgyAttachmentNameEnum.NAME_2,nodeAttachment);
|
|
|
+ nodeAttachment = this.assemblyAttachment(projectId,TdgyAttachmentNameEnum.NAME_2,nodeAttachment);
|
|
|
//处理-出让图形依赖
|
|
|
- currentNodeAttachmentMap = this.assemblyAttachment(projectId,TdgyAttachmentNameEnum.NAME_3,nodeAttachment);
|
|
|
-
|
|
|
+ nodeAttachment = this.assemblyAttachment(projectId,TdgyAttachmentNameEnum.NAME_3,nodeAttachment);
|
|
|
}else if("划拨".equals(gdType)) {
|
|
|
|
|
|
}
|
|
|
@@ -406,7 +406,7 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
|
|
|
}*/
|
|
|
|
|
|
}
|
|
|
- return null;
|
|
|
+ return nodeAttachment;
|
|
|
} catch (Exception e) {
|
|
|
logger.error("查询节点附件信息异常,nodeId: {}", nodeId, e);
|
|
|
return null;
|
|
|
@@ -422,20 +422,31 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
|
|
|
*
|
|
|
*
|
|
|
*/
|
|
|
- public Map <String, Object> assemblyAttachment(String projectId,UnifyAttachmentEnum attachmentEnum,NodeAttachment nodeAttachment){
|
|
|
- //最终结果集合
|
|
|
- Map <String, Object> currentNodeAttachmentMap = new LinkedHashMap<>();
|
|
|
- Map <String, Object> relationNodeAttachmentMap = new LinkedHashMap<>();
|
|
|
+ public NodeAttachment assemblyAttachment(String projectId,UnifyAttachmentEnum attachmentEnum,NodeAttachment nodeAttachment){
|
|
|
+ String name = attachmentEnum.getName();
|
|
|
+ Map <String, Object> attachmentMap = null;
|
|
|
if(Objects.nonNull(nodeAttachment) && Objects.nonNull(nodeAttachment.getAttachment())) {
|
|
|
- currentNodeAttachmentMap = nodeAttachment.getAttachment();
|
|
|
+ attachmentMap = nodeAttachment.getAttachment();
|
|
|
+ }else {
|
|
|
+ attachmentMap = new LinkedHashMap<>();
|
|
|
+ attachmentMap.put("name",name);
|
|
|
+ attachmentMap.put("path","");
|
|
|
+ attachmentMap.put("type","directory");
|
|
|
}
|
|
|
- String name = attachmentEnum.getName();
|
|
|
- List<String> currentAttachmentList = new ArrayList<>();
|
|
|
-
|
|
|
-
|
|
|
|
|
|
+ //当前材料的首层目录结构list
|
|
|
+ List<Map <String,Object>> attachmentChildrenList = null;
|
|
|
+ if(Objects.nonNull(attachmentMap.get("children"))) {
|
|
|
+ attachmentChildrenList = (List<Map<String, Object>>) attachmentMap.get("children");
|
|
|
+ }else {
|
|
|
+ attachmentChildrenList = new ArrayList<>();
|
|
|
+ }
|
|
|
|
|
|
- if(!currentNodeAttachmentMap.containsKey(name) || Objects.isNull(currentNodeAttachmentMap.get(name))) {
|
|
|
+ //当前节点的当前名称子children list
|
|
|
+ List<Map <String,String>> currentAttachmentList = this.getDirChildrenList(name,nodeAttachment);
|
|
|
+ //当前目录不存在此节点,需要通过依赖关系填充
|
|
|
+ if(CollectionUtils.isEmpty(currentAttachmentList)) {
|
|
|
+ currentAttachmentList = new ArrayList<>();
|
|
|
List<String> relationNameList = new ArrayList();
|
|
|
String relationNameStr = attachmentEnum.getRelationName();
|
|
|
if (StringUtils.isNotBlank(relationNameStr)) {
|
|
|
@@ -446,20 +457,47 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
|
|
|
String relationName = innerRelationNameList.get(0);
|
|
|
String tableName = innerRelationNameList.get(1);
|
|
|
NodeAttachment relationNodeAttachment = this.getAttachmentByProjectIdAndTable(projectId, tableName);
|
|
|
- if (Objects.nonNull(relationNodeAttachment) && Objects.nonNull(relationNodeAttachment.getAttachment())) {
|
|
|
- relationNodeAttachmentMap.putAll(relationNodeAttachment.getAttachment());
|
|
|
- }
|
|
|
- //获取两个合并的map
|
|
|
- if (relationNodeAttachmentMap.containsKey(relationName) && Objects.nonNull(relationNodeAttachmentMap.get(relationName))) {
|
|
|
- currentAttachmentList.addAll((Collection<? extends String>) relationNodeAttachmentMap.get(relationName));
|
|
|
- }
|
|
|
+ List<Map<String, String>> relationNodeFileList = this.getDirChildrenList(relationName, relationNodeAttachment);
|
|
|
+ currentAttachmentList.addAll(relationNodeFileList);
|
|
|
}
|
|
|
}//end for
|
|
|
}
|
|
|
- //第一个依赖关系解决
|
|
|
- currentNodeAttachmentMap.put(name,currentAttachmentList);
|
|
|
+ //这里构建当前节点的附件信息
|
|
|
+ Map<String, Object> currentNodeAttachmentMap = new LinkedHashMap<>();
|
|
|
+ currentNodeAttachmentMap.put("name", name);
|
|
|
+ currentNodeAttachmentMap.put("path", "");
|
|
|
+ currentNodeAttachmentMap.put("type", "directory");
|
|
|
+ currentNodeAttachmentMap.put("children", currentAttachmentList);
|
|
|
+ attachmentChildrenList.add(currentNodeAttachmentMap);
|
|
|
+ }
|
|
|
+
|
|
|
+ //这里构建最终的附件信息list
|
|
|
+ attachmentMap.put("children",attachmentChildrenList);
|
|
|
+ nodeAttachment.setAttachment(attachmentMap);
|
|
|
+ return nodeAttachment;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public List<Map <String,String>> getDirChildrenList(String dirName,NodeAttachment nodeAttachment) {
|
|
|
+ List<Map <String,String>> list = new ArrayList<>();
|
|
|
+ if (Objects.nonNull(nodeAttachment) && Objects.nonNull(nodeAttachment.getAttachment())) {
|
|
|
+ Map<String, Object> attachment = nodeAttachment.getAttachment();
|
|
|
+ //第一曾经children 所有目录list
|
|
|
+ List<Map> childrenList = (List<Map>) attachment.get("children");
|
|
|
+ if (CollectionUtils.isNotEmpty(childrenList)) {
|
|
|
+ for (Map childMap : childrenList) {
|
|
|
+ String childName = (String) childMap.get("name");
|
|
|
+ if (childName.equalsIgnoreCase(dirName)) {
|
|
|
+ list = (List<Map<String, String>>) childMap.get("children");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- return currentNodeAttachmentMap;
|
|
|
+ return list;
|
|
|
}
|
|
|
|
|
|
|