Эх сурвалжийг харах

修改节点时只有底层节点才能判断父节点类型

chenr 3 сар өмнө
parent
commit
aefc52d2b9

+ 28 - 21
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -3039,29 +3039,36 @@ public R<Boolean> updateContractNodeParameter(@RequestParam Long pKeyId, @Reques
     WbsTreeContract nodee = wbsTreeContractClient.getContractNodeByPrimaryKeyId(pKeyId+"");
     String sql="Select * from m_wbs_tree_contract where id="+nodee.getParentId()+" and contract_id="+nodee.getContractId()+" and wbs_id="+nodee.getWbsId()+" and is_deleted=0";
     WbsTreeContract parentNode=jdbcTemplate.queryForObject(sql,new BeanPropertyRowMapper<>(WbsTreeContract.class));
-    if (parentNode != null) {
-        Integer targetType;//当前节点
-        Integer sourceType;//当前节点的父节点
-        if (parentNode.getNodeType() != 1) {
-            sourceType = parentNode.getNodeType() + 1;
-        } else {
-            sourceType = parentNode.getNodeType();
-        }
-        if (parentNode.getNodeType() == 18) {
-            sourceType = 2;
-        }
-        if (nodeType != 1) {
-            targetType = nodeType + 1;
-        } else {
-            targetType = nodeType;
-        }
-        if (nodeType == 18) {
-            targetType = 2;
-        }
-        if (sourceType >= targetType) {
-            throw new ServiceException("当前节点类型不能大于或等于父级节点类型");
+    Integer templateType = jdbcTemplate.queryForObject(
+        "select COALESCE(template_type, 0) from m_contract_info where id="+nodee.getContractId()+" and is_deleted=0",
+        Integer.class
+    );
+    if(templateType!=null&&templateType==2){
+        if (parentNode != null) {
+            Integer targetType;//当前节点
+            Integer sourceType;//当前节点的父节点
+            if (parentNode.getNodeType() != 1) {
+                sourceType = parentNode.getNodeType() + 1;
+            } else {
+                sourceType = parentNode.getNodeType();
+            }
+            if (parentNode.getNodeType() == 18) {
+                sourceType = 2;
+            }
+            if (nodeType != 1) {
+                targetType = nodeType + 1;
+            } else {
+                targetType = nodeType;
+            }
+            if (nodeType == 18) {
+                targetType = 2;
+            }
+            if (sourceType >= targetType) {
+                throw new ServiceException("当前节点类型不能大于或等于父级节点类型");
+            }
         }
     }
+
     WbsTreeContract queries = this.wbsTreeContractClient.getContractWbsTreeByPrimaryKeyId(pKeyId);
     if (ObjectUtil.isNotEmpty(className) || ObjectUtil.isNotEmpty(unitName)) {
         //查询当前节点的是否是子节点,以及当前节点父节点是否包含单元评定