ソースを参照

质检-删除WBS节点校验

qianxb 10 ヶ月 前
コミット
d5343616e6

+ 10 - 11
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -2778,18 +2778,17 @@ public class InformationWriteQueryController extends BladeController {
 
         //获取pKeyId
         List<Long> removeList = removeNodeList.stream().map(WbsTreeContract::getPKeyId).distinct().collect(Collectors.toList());
-
-        /** 判断是否子节点有上报或审批过的资料,因为父id和祖级节点错误,直接使用上面的值去查询上报情况*/
-        List<InformationQuery> list = informationQueryService.selectChildrenNodeInfo(removeList);
-        if (list != null && list.size() >= 1) {
-            return R.data(300, false, "存在已经上报或审批的节点,不允许删除");
+        if (removeList.size() > 0) {
+            /** 判断是否子节点有上报或审批过的资料,因为父id和祖级节点错误,直接使用上面的值去查询上报情况*/
+            List<InformationQuery> list = informationQueryService.selectChildrenNodeInfo(removeList);
+            if (list != null && list.size() >= 1) {
+                return R.data(300, false, "存在已经上报或审批的节点,不允许删除");
+            }
+            //拼接
+            ids = ids + "," + String.join(",", JSONArray.parseArray(JSONObject.toJSONString(removeList), String.class));
+            //删除掉表格 TODO(不清楚为什么要剔除表格,按理说删除节点后,节点下的表也应该一起删除的,猜测或许是为了方便恢复节点的时候表数据还存在)2023年9月19日
+            removeNodeList.removeIf(tree -> tree.getType() != null && new Integer("2").equals(tree.getType()));
         }
-
-        //拼接
-        ids = ids + "," + String.join(",", JSONArray.parseArray(JSONObject.toJSONString(removeList), String.class));
-        //删除掉表格 TODO(不清楚为什么要剔除表格,按理说删除节点后,节点下的表也应该一起删除的,猜测或许是为了方便恢复节点的时候表数据还存在)2023年9月19日
-        removeNodeList.removeIf(tree -> tree.getType() != null && new Integer("2").equals(tree.getType()));
-
         //获取被删除节点名称
         //String nodeName = StringUtils.isNotEmpty(removeNode.getFullName()) ? removeNode.getFullName() : removeNode.getNodeName() + "," + removeNodeList.stream().map(wbs -> StringUtils.isNotEmpty(wbs.getFullName()) ? wbs.getFullName() : wbs.getNodeName()).collect(Collectors.joining());