1
0
Просмотр исходного кода

出让,划拨切换解决目录依赖

chenendian 3 месяцев назад
Родитель
Сommit
fd0f777a57

+ 57 - 8
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/controller/NodeAttachmentController.java

@@ -2,8 +2,10 @@ package com.siwei.apply.controller;
 
 import com.siwei.apply.domain.NodeAttachment;
 import com.siwei.apply.domain.ProjectWorkflow;
+import com.siwei.apply.domain.res.TdgyRes;
 import com.siwei.apply.service.NodeAttachmentService;
 import com.siwei.apply.service.ProjectService;
+import com.siwei.apply.service.TdgyService;
 import com.siwei.apply.utils.ServiceFileUtil;
 import com.siwei.common.core.domain.R;
 import com.siwei.common.core.utils.StringUtils;
@@ -29,6 +31,10 @@ public class NodeAttachmentController extends BaseController {
     private ProjectService projectService;
 
 
+    @Autowired
+    private TdgyService tdgyService;
+
+
     /**
      * 处理文件并保存附件信息
      *
@@ -142,7 +148,7 @@ public class NodeAttachmentController extends BaseController {
                 return R.fail("nodeId不能为空");
             }
             //获取附件信息及依赖关系
-            NodeAttachment nodeAttachment = nodeAttachmentService.getNodeAttachmentData(nodeId);
+            NodeAttachment nodeAttachment = nodeAttachmentService.getNodeAttachmentData(nodeId,null);
             return R.ok(nodeAttachment);
         } catch (Exception e) {
             logger.error("查询节点附件信息异常", e);
@@ -258,28 +264,71 @@ public class NodeAttachmentController extends BaseController {
             NodeAttachment nodeAttachment = nodeAttachmentService.getByNodeId(nodeId);
             //增加一条空目录结构
             if (Objects.isNull(nodeAttachment)) {
-                nodeAttachmentService.addDefaultAttachment(projectId,nodeId);
+                nodeAttachmentService.addDefaultAttachment(projectId, nodeId);
             }
             //这里重新获取依赖关系
-            nodeAttachment = nodeAttachmentService.getNodeAttachmentData(nodeId);
+            nodeAttachment = nodeAttachmentService.getNodeAttachmentData(nodeId,null);
             return R.ok(nodeAttachment);
         } catch (Exception e) {
             logger.error("初始化附件信息异常", e);
-            return R.fail(502,"初始化附件信息异常:" + e.getMessage());
+            return R.fail(502, "初始化附件信息异常:" + e.getMessage());
         }
+    }
 
 
+    /**
+     * 切换供地类型,出让,划拨
+     * 获取不同附件依赖关系
+     * 1.出让
+     * 2.划拨
+     */
+    @PostMapping("/changeTypeNodeAttachment")
+    public R<NodeAttachment> getNodeAttachmentAfterChangeType(@RequestBody Map<String, String> requestBody) {
+        try {
+            String nodeId = requestBody.get("nodeId");
+            String projectId = requestBody.get("projectId");
+            String gdType = requestBody.get("gdType");
+            if (StringUtils.isBlank(gdType)) {
+                return R.fail(502,"gdType不能为空");
+            }
+            if (StringUtils.isBlank(nodeId)) {
+                return R.fail(502,"nodeId不能为空");
+            }
+            NodeAttachment nodeAttachment = null;
+            TdgyRes tdgyRes =  tdgyService.getById(nodeId);
+            if (Objects.nonNull(tdgyRes)) {
+                String dbGdType = tdgyRes.getGdType();
+                //如果当前类型与库中一致,则直接取
+                if(("出让".equals(dbGdType) && "1".equals(gdType)) ||  ("划拨".equals(dbGdType) && "2".equals(gdType))){
+                    // 1.如果出让
+                    nodeAttachment = nodeAttachmentService.getByNodeId(nodeId);
+                    //增加一条空目录结构
+                    if (Objects.isNull(nodeAttachment)) {
+                        nodeAttachmentService.addDefaultAttachment(projectId, nodeId);
+                    }
+                    //这里重新获取依赖关系
+                    nodeAttachment = nodeAttachmentService.getNodeAttachmentData(nodeId,gdType);
+                }else {
+                    //1.先删除当前节点
+                    nodeAttachmentService.deleteByNodeId(nodeId);
+                    nodeAttachmentService.addDefaultAttachment(projectId, nodeId);
+                    //这里重新获取依赖关系
+                    nodeAttachment = nodeAttachmentService.getNodeAttachmentData(nodeId,gdType);
+                }
+            }
 
+            return R.ok(nodeAttachment);
+        } catch (Exception e) {
+            logger.error("初始化附件信息异常", e);
+            return R.fail(502,"初始化附件信息异常:" + e.getMessage());
+        }
 
 
 
 
 
 
-
-
-
-    }
+        }
 
 
 

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

@@ -54,7 +54,7 @@ public interface NodeAttachmentService {
 
     List<NodeAttachment> getByNodeIdList(List<String> nodeIdList);
 
-    NodeAttachment getNodeAttachmentData(String nodeId);
+    NodeAttachment getNodeAttachmentData(String nodeId,String gdType);
 
     NodeAttachment getAttachmentByProjectIdAndTable(String projectId,String nodeTableName) ;
 

+ 16 - 24
siwei-modules/siwei-apply/src/main/java/com/siwei/apply/service/impl/NodeAttachmentImpl.java

@@ -100,7 +100,6 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
     }
 
 
-
     /**
      * 根据节点ID查询附件信息
      * @param nodeIdList 节点ID
@@ -358,39 +357,30 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
 
 
     /**
-     *      *             1.先判断,当前节点是否存在引用关系。
-     *      *             2.如果不存在直接返回。
-     *      *             3.查询出当前节点信息,解析object对象
-     *      *             4.如果存在引用关系,查询出所有被引用节点的附件信息
-     *      *             5.重新组装object信息并且生成json对象展示。
-     *      *              找到当前枚举类,
-     *      *              查看其依赖关系
-     *      *              根据依赖关系把其它数据进行整理。
-     *
+     *            1.先判断,当前节点是否存在引用关系。
+     *            2.如果不存在直接返回。
+     *            3.查询出当前节点信息,解析object对象
+     *            4.如果存在引用关系,查询出所有被引用节点的附件信息
+     *            5.重新组装object信息并且生成json对象展示。
+     *             找到当前枚举类,
+     *             查看其依赖关系
+     *             根据依赖关系把其它数据进行整理。
      * 根据节点ID获取当前节点的附件信息
      * 这里需要合并依赖关系的附件资料引用复用等
      * @param nodeId 节点ID
      * @return NodeAttachment
      */
     @Override
-    public NodeAttachment getNodeAttachmentData(String nodeId) {
+    public NodeAttachment getNodeAttachmentData(String nodeId,String gdType) {
         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);
             if(CollectionUtils.isNotEmpty(projectWorkflowList) && Objects.nonNull(projectWorkflowList.get(0))) {
                 projectWorkflow = projectWorkflowList.get(0);
             }
 
-
             if(Objects.isNull(projectWorkflow)) {
                 throw new ServiceException("未查询到节点对应的流程信息,nodeId: " + nodeId);
             }
@@ -402,15 +392,17 @@ public class NodeAttachmentImpl implements NodeAttachmentService {
             if(ProjectType.ALONE.getCode().equals(String.valueOf(projectType))||ProjectType.BATCH.getCode().equals(String.valueOf(projectType))){
                 if(AloneWorkFlowEnum.NODE_2.getTableName().equalsIgnoreCase(nodeTableName)){
                     //规划条件,用地红线出具:查找所有的批次报批节点进行合并
-                    //取当前节点数据内容;
-                    TdgyRes tdgy = tdgyService.getById(nodeId);
-                    String gdType = tdgy.getGdType();
-                    if("出让".equals(gdType)) {
+                    //非前端传参数,则从库中获取
+                    if(StringUtils.isBlank(gdType)){
+                        TdgyRes tdgy = tdgyService.getById(nodeId);
+                        gdType = tdgy.getGdType();
+                    }
+                    if("1".equals(gdType)) {
                         //处理-规划条件出具依赖
                         nodeAttachment = this.assemblyAttachment(projectId,TdgyAttachmentNameEnum.NAME_2,nodeAttachment);
                         //处理-出让图形依赖
                         nodeAttachment = this.assemblyAttachment(projectId,TdgyAttachmentNameEnum.NAME_3,nodeAttachment);
-                    }else if("划拨".equals(gdType)) {
+                    }else if("2".equals(gdType)) {
                         //处理-项目批准文件
                         nodeAttachment = this.assemblyAttachment(projectId,TdgyHbAttachmentNameEnum.NAME_1,nodeAttachment);
                         //处理-土地权属来源文件