Explorar el Código

报批数据依赖增加不同的表数据来源

chenendian hace 3 meses
padre
commit
6793f0f350

+ 1 - 1
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/enums/TdgyAttachmentNameEnum.java

@@ -9,7 +9,7 @@ import com.siwei.apply.common.UnifyAttachmentEnum;
 public enum TdgyAttachmentNameEnum implements UnifyAttachmentEnum {
     NAME_1("1", "土地权属来源文件", "用地批复", "土地供应阶段"),
     NAME_2("2", "规划条件出具", "用地红线:t_tjyydhx|规划条件出具:t_tjyydhx", "土地供应阶段"),
-    NAME_3("3", "出让图形", "用地红线", "土地供应阶段"),
+    NAME_3("3", "出让图形", "用地红线:t_tjyydhx", "土地供应阶段"),
     NAME_4("4", "出让方案批复文件", "", "土地供应阶段"),
     NAME_5("5", "主体资格文件", "", "土地供应阶段"),
     NAME_7("6", "出让合同及成交确认书", "", "土地供应阶段");

+ 53 - 0
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/enums/TdgyHbAttachmentNameEnum.java

@@ -0,0 +1,53 @@
+package com.siwei.apply.enums;
+
+
+import com.siwei.apply.common.UnifyAttachmentEnum;
+
+/**
+ * 土地供应阶段(划拨用)
+ */
+public enum TdgyHbAttachmentNameEnum implements UnifyAttachmentEnum {
+    NAME_1("1", "项目批准文件", "项目建设依据:t_ydysyxz|办理成果:t_ydysyxz", "土地供应阶段"),
+    NAME_2("2", "土地权属来源文件", "用地批复:t_ydbp", "土地供应阶段"),
+    NAME_2_B("2.1", "土地权属来源文件", "用地批复:t_ydbp_data", "土地供应阶段"),
+    NAME_3("3", "主体资格文件", "用地红线:t_tjyydhx", "土地供应阶段"),
+    NAME_4("4", "测量报告", "用地批复:t_ydbp", "土地供应阶段"),
+    NAME_4_B("4.1", "测量报告", "用地批复:t_ydbp_data", "土地供应阶段"),
+    NAME_5("5", "其它文件", "", "土地供应阶段"),
+    NAME_7("6", "划拨决定书及交地确认书", "", "土地供应阶段");
+
+    private final String code;
+    private final String name;
+    private final String relationName;
+    private final String parentName;
+
+    TdgyHbAttachmentNameEnum(String code, String name, String relationName, String parentName) {
+        this.code = code;
+        this.name = name;
+        this.relationName = relationName;
+        this.parentName = parentName;
+    }
+
+    public String getName() {
+        return this.name;
+    }
+
+    public String getCode() {
+        return this.code;
+    }
+    public String getRelationName() {
+        return this.relationName;
+    }
+
+    public String getParentName() {
+        return this.parentName;
+    }
+
+    public static TdgyHbAttachmentNameEnum fromCode(String code) {
+        if (code == null) return null;
+        for (TdgyHbAttachmentNameEnum e : values()) {
+            if (code.equals(e.code)) return e;
+        }
+        return null;
+    }
+}

+ 67 - 29
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/impl/NodeAttachmentImpl.java

@@ -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;
     }