瀏覽代碼

扩展动态节点

huangtf 2 年之前
父節點
當前提交
268fce5a7b

+ 3 - 2
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/entity/ArchiveTreeContract.java

@@ -47,9 +47,10 @@ public class ArchiveTreeContract extends BaseEntity {
 	@ApiModelProperty(value = "租户id")
 	@ApiModelProperty(value = "租户id")
 	private String tenantId;
 	private String tenantId;
 
 
+
 	/**
 	/**
-	* 项目ID
-	*/
+	 *  项目ID
+	 */
 	private Long projectId;
 	private Long projectId;
 	/**
 	/**
 	* 合同段ID
 	* 合同段ID

+ 13 - 1
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/vo/ArchiveTreeContractVO2.java

@@ -44,7 +44,14 @@ public class ArchiveTreeContractVO2 implements INode<ArchiveTreeContractVO2> {
 	@JsonSerialize(using = ToStringSerializer.class)
 	@JsonSerialize(using = ToStringSerializer.class)
 	@ApiModelProperty(value = "主键id")
 	@ApiModelProperty(value = "主键id")
 	private Long id;
 	private Long id;
-
+	/**
+	 * 项目ID
+	 */
+	private Long projectId;
+	/**
+	 * 合同段ID
+	 */
+	private Long contractId;
 	/**
 	/**
 	 * 父节点ID
 	 * 父节点ID
 	 */
 	 */
@@ -73,6 +80,11 @@ public class ArchiveTreeContractVO2 implements INode<ArchiveTreeContractVO2> {
 	@ApiModelProperty(value = "是否有子孙节点")
 	@ApiModelProperty(value = "是否有子孙节点")
 	private Boolean hasChildren;
 	private Boolean hasChildren;
 
 
+	/**
+	 * 关联类型
+	 */
+	private Integer associationType;
+
 	@Override
 	@Override
 	public List<ArchiveTreeContractVO2> getChildren() {
 	public List<ArchiveTreeContractVO2> getChildren() {
 		if (this.children == null) {
 		if (this.children == null) {

+ 2 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/ArchiveTreeContractMapper.xml

@@ -77,6 +77,7 @@
         <result column="title" property="title"/>
         <result column="title" property="title"/>
         <result column="value" property="value"/>
         <result column="value" property="value"/>
         <result column="key" property="key"/>
         <result column="key" property="key"/>
+        <result column="contract_id" property="contractId"/>
         <result column="has_children" property="hasChildren"/>
         <result column="has_children" property="hasChildren"/>
         <result column="displayHierarchy" property="displayHierarchy"/>
         <result column="displayHierarchy" property="displayHierarchy"/>
         <result column="majorDataType" property="majorDataType"/>
         <result column="majorDataType" property="majorDataType"/>
@@ -203,6 +204,7 @@
         SELECT
         SELECT
         id,
         id,
         parent_id,
         parent_id,
+        contract_id,
         node_name AS title,
         node_name AS title,
         id AS "value",
         id AS "value",
         id AS "key",
         id AS "key",

+ 97 - 9
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ArTreeContractInitServiceImpl.java

@@ -264,29 +264,117 @@ public class ArTreeContractInitServiceImpl {
         }
         }
     }
     }
 
 
+    /**
+     *
+     * @param tenantId
+     * @param projectId
+     * @param wbsId
+     * @param tree
+     * @return
+     */
+    public List<ArchiveTreeContract> getContractProcExtNodes(String tenantId, Long projectId,Long wbsId, ArchiveTreeContractVO2 tree) {
+
+        List<ArchiveTreeContract> addNodes = new ArrayList<>();
+        List<ArchiveTreeContractVO2> archiveTreeContractVO2s = new ArrayList<>();
+        ForestNodeMerger.getTreeList(tree,archiveTreeContractVO2s);
+
+        for (ArchiveTreeContractVO2 ar : archiveTreeContractVO2s) {
+            //关联质检资料
+            if (ar.getAssociationType()!= null
+                    &&  ar.getAssociationType() == 1
+                    && ar.getDisplayHierarchy() != null ) {
+                List<ArchiveTreeContract> tmpList  = getTreeContractFromWbs(tenantId,projectId,wbsId,ar);
+                addNodes.addAll(tmpList);
+            }
+        }
+        return addNodes;
+    }
 
 
 
 
 
 
 
 
-
-    public List<ArchiveTreeContract> getTreeContractFromWbs(String tenantId, Long projectId, Long wbsId, Long contractId,Long level,ArchiveTreeContractVO2 subTree){
+    public List<ArchiveTreeContract> getTreeContractFromWbs(String tenantId, Long projectId, Long wbsId, ArchiveTreeContractVO2 subTree){
         List<ArchiveTreeContract> archiveTreeContracts = new ArrayList<>();
         List<ArchiveTreeContract> archiveTreeContracts = new ArrayList<>();
 
 
+        Long contractId = subTree.getContractId();
+        Long level = Long.parseLong(subTree.getDisplayHierarchy());
+
         //1. 获取子树链表
         //1. 获取子树链表
         List<ArchiveTreeContractVO2> treeContractVO2s = new ArrayList<>();
         List<ArchiveTreeContractVO2> treeContractVO2s = new ArrayList<>();
         ForestNodeMerger.getTreeList(subTree,treeContractVO2s);
         ForestNodeMerger.getTreeList(subTree,treeContractVO2s);
 
 
         //2. 获取对应合同的树
         //2. 获取对应合同的树
-        List<WbsTreeContractVO6> wbsTreeContractVO6s =  contractInfoService.tree6List(wbsId.toString(),projectId.toString(),contractId.toString());
-        Iterator<WbsTreeContractVO6> iterator = wbsTreeContractVO6s.iterator();
-        while (iterator.hasNext()) {
-            WbsTreeContractVO6 treeContractVO6 = iterator.next();
-            if (treeContractVO6.getNodeType() > level) {
-                iterator.remove();
+        List<WbsTreeContractVO6> wbsTreeContractVO6s =  contractInfoService.tree6List(wbsId.toString(),subTree.toString(),contractId.toString());
+
+        List<WbsTreeContractVO6> addWbsNodes = new ArrayList<>();
+
+        //获取已经存在的
+        Map<Long,ArchiveTreeContractVO2> extMap = new LinkedHashMap<>();
+        Map<Long,Long> oldNewMap = new LinkedHashMap<>();
+        for (ArchiveTreeContractVO2 ar :treeContractVO2s) {
+            if (ar.getExtId() !=null ) {
+                extMap.put(ar.getExtId(),ar);
+                oldNewMap.put(ar.getExtId(),ar.getId());
             }
             }
         }
         }
 
 
-         return archiveTreeContracts;
+        for (WbsTreeContractVO6 wbsTreeVO2:wbsTreeContractVO6s) {
+            //不要中间交工,质量评定和开工报告作为目录节点
+            if (wbsTreeVO2.getMajorDataType() != null ) {
+                if (wbsTreeVO2.getMajorDataType() == 1
+                        || wbsTreeVO2.getMajorDataType() == 2
+                        || wbsTreeVO2.getMajorDataType() == 3){
+                    continue;
+                }
+            }
+            //只展示指定层级之上的
+            if (wbsTreeVO2.getNodeType() > level){
+                continue;
+            }
+
+            //排除已经有的
+            if (extMap.get(wbsTreeVO2.getId())!= null) {
+                continue;
+            }
+
+            addWbsNodes.add(wbsTreeVO2);
+        }
+
+        for (WbsTreeContractVO6 wbsTreeVO2:addWbsNodes) {
+            oldNewMap.put(wbsTreeVO2.getId(),SnowFlakeUtil.getId());
+        }
+
+        //遍历构建
+        for (WbsTreeContractVO6 wbsTreeVO2:addWbsNodes) {
+            //只展示指定层级之上的
+            ArchiveTreeContract archiveTree = new ArchiveTreeContract();
+            archiveTree.setTenantId(tenantId);
+            archiveTree.setProjectId(projectId);
+            archiveTree.setContractId(contractId);
+            archiveTree.setId(oldNewMap.get(wbsTreeVO2.getId()));
+            if (wbsTreeVO2.getParentId() == 0) {
+                wbsTreeVO2.setParentId(subTree.getId());
+            }else {
+                archiveTree.setParentId(oldNewMap.get(wbsTreeVO2.getParentId()));
+            }
+
+            archiveTree.setNodeName(wbsTreeVO2.getTitle());
+
+            //设置关联
+            archiveTree.setExtType(1);
+            archiveTree.setExtId(wbsTreeVO2.getId());
+            archiveTree.setExtAttachId(subTree.getId());
+            archiveTree.setDisplayHierarchy(level.toString());
+            archiveTree.setIsDeleted(0);
+            //上传节点
+            if (wbsTreeVO2.getNodeType().longValue() ==  level) {
+                archiveTree.setIsStorageNode(1);
+            }
+            archiveTreeContracts.add(archiveTree);
+
+        }
+
+        return archiveTreeContracts;
     }
     }
 
 
 }
 }

+ 13 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ArchiveTreeContractServiceImpl.java

@@ -17,9 +17,9 @@
 package org.springblade.manager.service.impl;
 package org.springblade.manager.service.impl;
 
 
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.core.toolkit.StringPool;
 import com.baomidou.mybatisplus.core.toolkit.StringPool;
-import com.mixsmart.utils.StringUtils;
 import lombok.AllArgsConstructor;
 import lombok.AllArgsConstructor;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.log.exception.ServiceException;
@@ -95,7 +95,18 @@ public class ArchiveTreeContractServiceImpl extends BaseServiceImpl<ArchiveTreeC
 
 
 		arTreeContractInitService.copyTree(tenantId,projectId,projectInfo.getProjectName(),tree.get(0),archiveTreeContracts,contractInfoVOS);
 		arTreeContractInitService.copyTree(tenantId,projectId,projectInfo.getProjectName(),tree.get(0),archiveTreeContracts,contractInfoVOS);
 
 
-	    //todo 同步质检资料动态节点,处理文件提名
+		//是否获取扩展的wbs节点
+
+		Long wbsId = null;
+		if (projectInfo!= null) {
+			Long lWbsId = projectInfo.getReferenceWbsTemplateId();
+			if (lWbsId != null) {
+				wbsId = projectInfo.getReferenceWbsTemplateId();
+			}
+		}
+
+
+		//todo 同步质检资料动态节点,处理文件提名
 
 
 		//todo 同步立卷规则
 		//todo 同步立卷规则