Ver Fonte

Merge branch 'test-merge' of http://219.151.181.73:3000/zhuwei/bladex into test-merge

lvy há 4 dias atrás
pai
commit
e0d37dcf30

+ 120 - 114
blade-service/blade-archive/src/main/java/org/springblade/archive/service/impl/ArchiveAiNameServiceImpl.java

@@ -1,70 +1,71 @@
-///*
-// *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
-// *
-// *  Redistribution and use in source and binary forms, with or without
-// *  modification, are permitted provided that the following conditions are met:
-// *
-// *  Redistributions of source code must retain the above copyright notice,
-// *  this list of conditions and the following disclaimer.
-// *  Redistributions in binary form must reproduce the above copyright
-// *  notice, this list of conditions and the following disclaimer in the
-// *  documentation and/or other materials provided with the distribution.
-// *  Neither the name of the dreamlu.net developer nor the names of its
-// *  contributors may be used to endorse or promote products derived from
-// *  this software without specific prior written permission.
-// *  Author: Chill 庄骞 (smallchill@163.com)
-// */
-//package org.springblade.archive.service.impl;
-//
-//
-//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-//import org.apache.commons.lang.StringUtils;
-//import org.springblade.archive.entity.ArchiveAiName;
-//import org.springblade.archive.mapper.ArchiveAiNameMapper;
-//import org.springblade.archive.service.IArchiveAiNameService;
-//import org.springblade.archive.vo.ArchiveAiNameVO;
-//import org.springblade.archive.vo.ArchiveAiNameVO1;
-//import org.springblade.common.utils.DeepSeekClient;
-//import org.springblade.core.mp.base.BaseServiceImpl;
-//import org.springframework.beans.factory.annotation.Autowired;
-//import org.springframework.jdbc.core.BeanPropertyRowMapper;
-//import org.springframework.jdbc.core.JdbcTemplate;
-//import org.springframework.scheduling.annotation.Async;
-//import org.springframework.stereotype.Service;
-//import org.springframework.transaction.annotation.Transactional;
-//
-//import javax.annotation.Resource;
-//import java.text.SimpleDateFormat;
-//import java.util.*;
-//import java.util.concurrent.Semaphore;
-//import java.util.concurrent.ThreadPoolExecutor;
-//import java.util.stream.Collectors;
-//
-//import static java.util.stream.Collectors.groupingBy;
-//
-///**
-// *  服务实现类
-// *
-// * @author BladeX
-// * @since 2025-07-03
-// */
-//@Service
-//public class ArchiveAiNameServiceImpl extends BaseServiceImpl<ArchiveAiNameMapper, ArchiveAiName> implements IArchiveAiNameService {
-//
-//	 private static String DEEPSEEK_ARCHIVE_NAME = ".这是一段案卷题名,精简案卷题名重复啰嗦的内容,不要加以上内容没有的词语 返回值不要有任何多余得废话,只要结果";
-//	 private static final int MAX_CONCURRENT_REQUESTS = 5;
-//
-//	@Autowired
-//	private JdbcTemplate jdbcTemplate;
-//
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.archive.service.impl;
+
+
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import org.apache.commons.lang.StringUtils;
+import org.springblade.archive.entity.ArchiveAiName;
+import org.springblade.archive.mapper.ArchiveAiNameMapper;
+import org.springblade.archive.service.IArchiveAiNameService;
+import org.springblade.archive.vo.ArchiveAiNameVO;
+import org.springblade.archive.vo.ArchiveAiNameVO1;
+
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import javax.annotation.Resource;
+import java.io.IOException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.stream.Collectors;
+
+import static java.util.stream.Collectors.groupingBy;
+
+/**
+ *  服务实现类
+ *
+ * @author BladeX
+ * @since 2025-07-03
+ */
+@Service
+public class ArchiveAiNameServiceImpl extends BaseServiceImpl<ArchiveAiNameMapper, ArchiveAiName> implements IArchiveAiNameService {
+
+	 private static String DEEPSEEK_ARCHIVE_NAME = ".这是一段案卷题名,精简案卷题名重复啰嗦的内容,不要加以上内容没有的词语 返回值不要有任何多余得废话,只要结果";
+	 private static final int MAX_CONCURRENT_REQUESTS = 5;
+
+	@Autowired
+	private JdbcTemplate jdbcTemplate;
+
 //	@Autowired
 //	private DeepSeekClient deepSeekClient;
-//
-//	@Resource(name = "taskExecutor1")
-//	private ThreadPoolExecutor executor;
-//
-//	private final Semaphore apiSemaphore = new Semaphore(MAX_CONCURRENT_REQUESTS);
-//
+
+	@Resource(name = "taskExecutor1")
+	private ThreadPoolExecutor executor;
+
+	private final Semaphore apiSemaphore = new Semaphore(MAX_CONCURRENT_REQUESTS);
+
 //	@Override
 //	@Async("taskExecutor1")
 //	@Transactional
@@ -104,52 +105,57 @@
 //			this.updateBatchById(batch);
 //		}
 //	}
-//
-//	@Override
-//	public List<ArchiveAiNameVO> getArchiveAiTask(Long projectId, Long contractId) {
-//		List<ArchiveAiNameVO>list=new ArrayList<>();
-//		List<ArchiveAiName> archiveAiNameList = this.baseMapper.selectList(new LambdaQueryWrapper<>(ArchiveAiName.class).eq(ArchiveAiName::getProjectId, projectId).eq(ArchiveAiName::getContractId, contractId));
-//		if(!archiveAiNameList.isEmpty()){
-//			Map<Long, List<ArchiveAiName>> map = archiveAiNameList.stream().collect(groupingBy(ArchiveAiName::getTaskId));
-//			for (Map.Entry<Long, List<ArchiveAiName>> entry : map.entrySet()) {
-//				ArchiveAiNameVO archiveAiNameVO = new ArchiveAiNameVO();
-//				List<ArchiveAiName> archiveAiNames = entry.getValue();
-//				archiveAiNameVO.setTaskId(entry.getKey());
-//				Date createTime = archiveAiNames.get(0).getCreateTime();
-//				SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-//				String formattedDate = sdf.format(createTime);
-//				archiveAiNameVO.setTaskTime(formattedDate);
-//				archiveAiNameVO.setNum(archiveAiNames.size());
-//				archiveAiNameVO.setStatus(archiveAiNames.stream().allMatch(ai -> ai.getStatus() >1) ? 2:1);
-//				list.add(archiveAiNameVO);
-//			}
-//		}
-//		return list;
-//	}
-//
-//
-//	@Transactional
-//	public boolean confirmAiName(List<ArchiveAiNameVO1>vos) {
-//		for (ArchiveAiNameVO1 archiveAiName : vos) {
-//			if(archiveAiName.getStatus()==2&& StringUtils.isNotEmpty(archiveAiName.getArchiveNameAi())){
-//				archiveAiName.setStatus(3);
-//				String sql=" update u_archives_auto set name='"+archiveAiName.getArchiveNameAi()+"', colour_status=2  where id="+archiveAiName.getArchiveAutoId();
-//				jdbcTemplate.update(sql);
-//				String sql2="update u_archive_ai_name set status=3 where id="+archiveAiName.getId();
-//				jdbcTemplate.update(sql2);
-//			}
-//		}
-//		Long taskId = vos.get(0).getTaskId();
-//		String sql3="select * from u_archive_ai_name where task_id="+taskId+" and is_deleted=0";
-//		List<ArchiveAiName> list = jdbcTemplate.query(sql3, new BeanPropertyRowMapper<>(ArchiveAiName.class));
-//		if(list.stream().allMatch(item -> item.getStatus() >= 3)){
-//			deletedArchiveAiTask(taskId);
-//		};
-//		return true;
-//	}
-//
-//	@Override
-//	public Boolean deletedArchiveAiTask(Long taskId) {
-//		return baseMapper.deletedArchiveAiTask(taskId);
-//	}
-//}
+
+    @Override
+    public void syncCreatAiName(List<ArchiveAiName> aiNames) throws IOException {
+
+    }
+
+    @Override
+	public List<ArchiveAiNameVO> getArchiveAiTask(Long projectId, Long contractId) {
+		List<ArchiveAiNameVO>list=new ArrayList<>();
+		List<ArchiveAiName> archiveAiNameList = this.baseMapper.selectList(new LambdaQueryWrapper<>(ArchiveAiName.class).eq(ArchiveAiName::getProjectId, projectId).eq(ArchiveAiName::getContractId, contractId));
+		if(!archiveAiNameList.isEmpty()){
+			Map<Long, List<ArchiveAiName>> map = archiveAiNameList.stream().collect(groupingBy(ArchiveAiName::getTaskId));
+			for (Map.Entry<Long, List<ArchiveAiName>> entry : map.entrySet()) {
+				ArchiveAiNameVO archiveAiNameVO = new ArchiveAiNameVO();
+				List<ArchiveAiName> archiveAiNames = entry.getValue();
+				archiveAiNameVO.setTaskId(entry.getKey());
+				Date createTime = archiveAiNames.get(0).getCreateTime();
+				SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+				String formattedDate = sdf.format(createTime);
+				archiveAiNameVO.setTaskTime(formattedDate);
+				archiveAiNameVO.setNum(archiveAiNames.size());
+				archiveAiNameVO.setStatus(archiveAiNames.stream().allMatch(ai -> ai.getStatus() >1) ? 2:1);
+				list.add(archiveAiNameVO);
+			}
+		}
+		return list;
+	}
+
+
+	@Transactional
+	public boolean confirmAiName(List<ArchiveAiNameVO1>vos) {
+		for (ArchiveAiNameVO1 archiveAiName : vos) {
+			if(archiveAiName.getStatus()==2&& StringUtils.isNotEmpty(archiveAiName.getArchiveNameAi())){
+				archiveAiName.setStatus(3);
+				String sql=" update u_archives_auto set name='"+archiveAiName.getArchiveNameAi()+"', colour_status=2  where id="+archiveAiName.getArchiveAutoId();
+				jdbcTemplate.update(sql);
+				String sql2="update u_archive_ai_name set status=3 where id="+archiveAiName.getId();
+				jdbcTemplate.update(sql2);
+			}
+		}
+		Long taskId = vos.get(0).getTaskId();
+		String sql3="select * from u_archive_ai_name where task_id="+taskId+" and is_deleted=0";
+		List<ArchiveAiName> list = jdbcTemplate.query(sql3, new BeanPropertyRowMapper<>(ArchiveAiName.class));
+		if(list.stream().allMatch(item -> item.getStatus() >= 3)){
+			deletedArchiveAiTask(taskId);
+		};
+		return true;
+	}
+
+	@Override
+	public Boolean deletedArchiveAiTask(Long taskId) {
+		return baseMapper.deletedArchiveAiTask(taskId);
+	}
+}

+ 8 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreePrivateController.java

@@ -475,8 +475,8 @@ public class WbsTreePrivateController extends BladeController {
             @ApiImplicitParam(name = "parentId", value = "父级id"),
             @ApiImplicitParam(name = "projectId", value = "项目id")
     })
-    public R<List<WbsTreePrivateVO>> lazyTree(String wbsId, String wbsType, Long parentId, String projectId) {
-        List<WbsTreePrivateVO> tree = wbsTreePrivateService.lazyTree(wbsId, wbsType, parentId, projectId);
+    public R<List<WbsTreePrivateVO>> lazyTree(String wbsId, String wbsType, Long parentId, String projectId,Integer type) {
+        List<WbsTreePrivateVO> tree = wbsTreePrivateService.lazyTree(wbsId, wbsType, parentId, projectId,type);
         if (tree != null && tree.size() > 0) {
             return R.data(tree);
         }
@@ -1097,4 +1097,10 @@ public class WbsTreePrivateController extends BladeController {
         IPage<TreeNodeVOByTabType> page = wbsTreePrivateService.tabTypeLazyTreeByProject(Condition.getPage(query), parentId, projectId, titleName);
         return R.data(page);
     }
+    @PostMapping("/copyNode")
+    @ApiOperationSupport(order = 50)
+    @ApiOperation(value = "复制节点")
+    public R copyNode(List<String>leftIds,List<String>rightIds){
+        return R.status(wbsTreePrivateService.copyNode(leftIds,rightIds));
+    }
 }

+ 27 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/WbsTreeSynchronousRecordController.java

@@ -4,6 +4,7 @@ package org.springblade.manager.controller;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.apache.commons.beanutils.BeanUtils;
@@ -165,6 +166,7 @@ public class WbsTreeSynchronousRecordController {
     public R<List<WbsTreeSynchronousRecordDTO>> querySyncRecord(@RequestParam Long projectId) {
         List<WbsTreeSynchronousRecord> list = this.mWbsTreeSynchronousRecordService.list(new QueryWrapper<WbsTreeSynchronousRecord>().lambda()
                 .eq(WbsTreeSynchronousRecord::getProjectId, projectId)
+                .eq(WbsTreeSynchronousRecord::getIsDeleted, 0)
                 .ne(WbsTreeSynchronousRecord::getStatus, 2)
         );
         List<WbsTreeSynchronousRecordDTO> wbsTreeSynchronousRecordDTOS = BeanUtil.copyProperties(list, WbsTreeSynchronousRecordDTO.class);
@@ -183,5 +185,30 @@ public class WbsTreeSynchronousRecordController {
         });
         return R.data(wbsTreeSynchronousRecordDTOS);
     }
+
+    /**
+     * 删除接口
+     */
+    @ApiOperation(value = "删除接口")
+    @GetMapping("delete")
+    public R<Boolean> delete(@RequestParam Long id) {
+        return R.data(this.mWbsTreeSynchronousRecordService.update(Wrappers.<WbsTreeSynchronousRecord>update().lambda()
+                .set(WbsTreeSynchronousRecord::getIsDeleted, 1)
+                .eq(WbsTreeSynchronousRecord::getId, id)
+        ));
+    }
+
+
+    /**
+     * 重刷接口
+     */
+    @ApiOperation(value = "重刷接口")
+    @GetMapping("reFlush")
+    public R<Boolean> reFlush(@RequestParam Long id) {
+        return R.data(this.mWbsTreeSynchronousRecordService.update(Wrappers.<WbsTreeSynchronousRecord>update().lambda()
+                .set(WbsTreeSynchronousRecord::getStatus, 0)
+                .eq(WbsTreeSynchronousRecord::getId, id)
+        ));
+    }
 }
 

+ 3 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreePrivateMapper.java

@@ -39,7 +39,7 @@ public interface WbsTreePrivateMapper extends EasyBaseMapper<WbsTreePrivate> {
 
     void updateDeletedByCondition(String id, String wbsId, String projectId);
 
-    List<WbsTreePrivateVO> lazyTree(String wbsId, Integer wbsType, Long parentId, String projectId);
+    List<WbsTreePrivateVO> lazyTree(String wbsId, Integer wbsType, Long parentId, String projectId,Integer type);
 
     List<TreeNodeVOByTabType> tabTypeLazyTree(IPage page, Long parentId, String projectId, String titleName);
 
@@ -155,4 +155,6 @@ public interface WbsTreePrivateMapper extends EasyBaseMapper<WbsTreePrivate> {
     List<ArchiveSyncLogVO> getContractAllLogMonthPack(@Param("contractId") Long contractId);
 
     List<Long> getContractAllLogWbsNodeIds(@Param("contractId") Long contractId);
+
+    List<WbsTreePrivate> selectAllChildNode(@Param("leftIds") List<String> leftIds);
 }

+ 15 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/mapper/WbsTreePrivateMapper.xml

@@ -387,7 +387,9 @@
             m_wbs_tree_private d
         WHERE
             d.is_deleted = 0
-        AND (d.is_buss_show != 1 OR d.is_buss_show IS NULL)
+        <if test="type != null and wbsType != '' and type =1">
+          AND  (d.is_add_conceal != 1 OR d.is_add_conceal IS NULL)
+        </if>
         AND d.parent_id = #{parentId}
         AND d.project_id = #{projectId}
             <if test="wbsType != null and wbsType != '' and wbsType != -1">
@@ -1064,4 +1066,16 @@
         select DISTINCT wbs_node_id from u_contract_log  WHERE
             contract_id = #{contractId}
     </select>
+    <select id="selectAllChildNode" resultType="org.springblade.manager.entity.WbsTreePrivate">
+        SELECT DISTINCT *
+        FROM m_wbs_tree_private
+        WHERE is_deleted = 0
+        <if test="leftList != null and leftList.size() > 0">
+            AND (
+            <foreach collection="leftList" item="item" separator=" OR ">
+                FIND_IN_SET(#{item}, ancestors_p_id)
+            </foreach>
+            )
+        </if>
+    </select>
 </mapper>

+ 3 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/IWbsTreePrivateService.java

@@ -26,7 +26,7 @@ public interface IWbsTreePrivateService extends BaseService<WbsTreePrivate> {
 
     boolean removeTableByCondition(String id, String wbsId, String projectId);
 
-    List<WbsTreePrivateVO> lazyTree(String wbsId, String wbsType, Long parentId, String projectId);
+    List<WbsTreePrivateVO> lazyTree(String wbsId, String wbsType, Long parentId, String projectId,Integer type);
 
     // 项目级 表单类型划分
     IPage<TreeNodeVOByTabType> tabTypeLazyTree(IPage<TreeNodeVOByTabType> page, Long parentId, String projectId, String titleName);
@@ -115,4 +115,6 @@ public interface IWbsTreePrivateService extends BaseService<WbsTreePrivate> {
     List<ArchiveSyncLogVO> getContractAllLogMonthPack(Long contractId);
 
     List<Long> getContractAllLogWbsNodeIds(Long contractId);
+
+    boolean copyNode(List<String> leftIds, List<String> rightIds);
 }

+ 1 - 1
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/FormulaServiceImpl.java

@@ -5455,7 +5455,7 @@ public class FormulaServiceImpl extends BaseServiceImpl<FormulaMapper, Formula>
                             SoilTestChart generator = new SoilTestChart(points);
                             // 生成图表并保存为图片(不显示GUI窗口)
                             generator.generateChart(listPdf, 330, 360);
-                        }else if (fd.getCode().contains("m_20230410104301_1645256037877415936")){
+                        }else if (fd.getCode().contains("m_20250929094210_1972476967416496128")){
                             //土工击试验
                             // 创建图表生成器
                             SmoothCurveChartToImage generator = new SmoothCurveChartToImage(points, "含水率(%)", "干密度(g/cm³)", "最大干密度曲线");

+ 108 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreePrivateServiceImpl.java

@@ -260,10 +260,10 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
     }
 
     @Override
-    public List<WbsTreePrivateVO> lazyTree(String wbsId, String wbsType, Long parentId, String projectId) {
+    public List<WbsTreePrivateVO> lazyTree(String wbsId, String wbsType, Long parentId, String projectId, Integer type) {
         //获取请求头中的authorization
         String headerAuthorization = getHeaderAuthorization();
-        List<WbsTreePrivateVO> wbsTreePrivateVOS = baseMapper.lazyTree(wbsId, Integer.valueOf(wbsType), parentId, projectId);
+        List<WbsTreePrivateVO> wbsTreePrivateVOS = baseMapper.lazyTree(wbsId, Integer.valueOf(wbsType), parentId, projectId,type);
         //判断如果是客户端就进入分支 把包含委托单的节点删除
         if (headerAuthorization != null && !"".equals(headerAuthorization) && headerAuthorization.contains("client_secret") && wbsTreePrivateVOS.size() > 0) {
             JSONArray objects = JSONUtil.parseArray(wbsTreePrivateVOS);
@@ -3205,6 +3205,112 @@ public class WbsTreePrivateServiceImpl extends BaseServiceImpl<WbsTreePrivateMap
         return baseMapper.getContractAllLogWbsNodeIds(contractId);
     }
 
+    @Override
+    public boolean copyNode(List<String> leftIds, List<String> rightIds) {
+        List<WbsTreePrivate> leftLists = baseMapper.selectAllChildNode(leftIds);
+        for (String rightId : rightIds) {
+            // 每次循环都创建一个新的集合作为副本
+            List<WbsTreePrivate> workingList = leftLists.stream()
+                    .map(node -> {
+                        // 创建每个节点的副本
+                        WbsTreePrivate copy = new WbsTreePrivate();
+                        BeanUtils.copyProperties(copy, node);
+                        return copy;
+                    })
+                    .collect(Collectors.toList());
+            WbsTreePrivate rightWbsTreePrivate = baseMapper.getByPKeyId(Long.parseLong(rightId));
+
+            // 找到leftLists中所有的根节点(没有在leftLists中作为子节点出现的节点)
+            Set<Long> allPIds = workingList.stream()
+                    .map(WbsTreePrivate::getPId)
+                    .filter(Objects::nonNull)
+                    .collect(Collectors.toSet());
+
+            List<WbsTreePrivate> rootNodes = workingList.stream()
+                    .filter(node -> !allPIds.contains(node.getPKeyId()))
+                    .collect(Collectors.toList());
+
+            // 为每个根节点重新设置属性,并将其放到rightWbsTreePrivate节点下
+            for (WbsTreePrivate rootNode : rootNodes) {
+                // 重新分配节点值
+                reassignNodeValues(workingList, rootNode, rightWbsTreePrivate);
+            }
+            this.insertBatch(workingList,500);
+        }
+        return true;
+    }
+    // 添加一个辅助方法来重新分配节点值
+    private void reassignNodeValues(List<WbsTreePrivate> leftLists, WbsTreePrivate rootNode, WbsTreePrivate rightWbsTreePrivate) {
+        // 创建节点映射以便快速查找
+        Map<Long, WbsTreePrivate> nodeMap = leftLists.stream()
+                .collect(Collectors.toMap(WbsTreePrivate::getPKeyId, node -> node));
+
+        // 为根节点生成新的随机ID
+        Long newRootId = SnowFlakeUtil.getId();
+        Long newRootPKeyId = SnowFlakeUtil.getId();
+
+        // 设置根节点属性,使其成为rightWbsTreePrivate的子节点
+        rootNode.setId(newRootId);
+        rootNode.setPKeyId(newRootPKeyId);
+        rootNode.setParentId(rightWbsTreePrivate.getId());
+        rootNode.setPId(rightWbsTreePrivate.getPKeyId());
+
+        // ancestors设置为rightWbsTreePrivate的ancestors加上rightWbsTreePrivate的id
+        if (rightWbsTreePrivate.getAncestors() != null && !rightWbsTreePrivate.getAncestors().isEmpty()) {
+            rootNode.setAncestors(rightWbsTreePrivate.getAncestors() + "," + rightWbsTreePrivate.getId());
+        } else {
+            rootNode.setAncestors(String.valueOf(rightWbsTreePrivate.getId()));
+        }
+
+        // ancestors_p_id设置为rightWbsTreePrivate的ancestors_p_id加上rightWbsTreePrivate的pKeyId
+        if (rightWbsTreePrivate.getAncestorsPId() != null && !rightWbsTreePrivate.getAncestorsPId().isEmpty()) {
+            rootNode.setAncestorsPId(rightWbsTreePrivate.getAncestorsPId() + "," + rightWbsTreePrivate.getPKeyId());
+        } else {
+            rootNode.setAncestorsPId(String.valueOf(rightWbsTreePrivate.getPKeyId()));
+        }
+
+        // 更新所有子节点
+        updateChildNodes(nodeMap, rootNode, rootNode.getAncestors(), rootNode.getAncestorsPId(), newRootPKeyId);
+    }
+
+    // 递归更新子节点属性
+    private void updateChildNodes(Map<Long, WbsTreePrivate> nodeMap, WbsTreePrivate parentNode, String parentAncestors, String parentAncestorsPId, Long parentPKeyId) {
+        // 查找当前节点的所有直接子节点(通过pId匹配父节点的pKeyId)
+        List<WbsTreePrivate> childNodes = nodeMap.values().stream()
+                .filter(node -> node.getPId() != null && node.getPId().equals(parentNode.getPKeyId()))
+                .collect(Collectors.toList());
+
+        // 更新每个子节点的属性
+        for (WbsTreePrivate childNode : childNodes) {
+            // 为子节点生成新的随机ID
+            Long newChildId = SnowFlakeUtil.getId();
+            Long newChildPKeyId = SnowFlakeUtil.getId();
+
+            // id设置为新的随机ID
+            childNode.setId(newChildId);
+
+            // pKeyId设置为新的随机ID
+            childNode.setPKeyId(newChildPKeyId);
+
+            // parentId设置为父节点的id
+            childNode.setParentId(parentNode.getId());
+
+            // pId设置为父节点的pKeyId
+            childNode.setPId(parentPKeyId);
+
+            // ancestors设置为父节点的ancestors加上父节点的id
+            childNode.setAncestors(parentAncestors + "," + parentNode.getId());
+
+            // ancestors_p_id设置为父节点的ancestors_p_id加上父节点的pKeyId
+            childNode.setAncestorsPId(parentAncestorsPId + "," + parentPKeyId);
+
+            // 递归更新孙子节点
+            updateChildNodes(nodeMap, childNode, childNode.getAncestors(), childNode.getAncestorsPId(), newChildPKeyId);
+        }
+    }
+
+
+
     public void diGuiWbs(int i) {
         QueryWrapper<WbsTreePrivate> wbsTreePrivateQueryWrapper = new QueryWrapper<>();
         wbsTreePrivateQueryWrapper.select("p_key_id", "id", "p_id", "wbs_id", "project_id", "parent_id", "ancestors");

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

@@ -503,7 +503,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
             if (("1").equals(type)) {//节点
                 if (ObjectUtil.isEmpty(projectId)) {//公有
                     Set<WbsTree> resultNodes = new HashSet<>();
-                    List<WbsTree> wbsTrees = baseMapper.selectList(Wrappers.<WbsTree>lambdaQuery().eq(WbsTree::getType, 1).eq(WbsTree::getWbsId, wbsId).and(wrapper -> wrapper.like(WbsTree::getNodeName, queryValue).or().like(WbsTree::getFullName, queryValue)));
+                    List<WbsTree> wbsTrees = baseMapper.selectList(Wrappers.<WbsTree>lambdaQuery().eq(WbsTree::getType, 1).eq(WbsTree::getWbsId, wbsId).and(wrapper -> wrapper.like(WbsTree::getNodeName, queryValue).or().like(WbsTree::getImportMatchingInfo, queryValue)));
                     this.getParentNodesPublicWbs(wbsTrees, resultNodes);
                     resultNodes.addAll(wbsTrees);
                     List<WbsTreeQueryValueVO> wbsTreeQueryValueVOS = BeanUtil.copyProperties(resultNodes, WbsTreeQueryValueVO.class);
@@ -516,7 +516,7 @@ public class WbsTreeServiceImpl extends BaseServiceImpl<WbsTreeMapper, WbsTree>
                     }
                 } else {//私有
                     Set<WbsTreePrivate> resultNodes = new HashSet<>();
-                    List<WbsTreePrivate> wbsTreePrivates = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getType, 1).eq(WbsTreePrivate::getWbsId, wbsId).eq(WbsTreePrivate::getProjectId, projectId).and(wrapper -> wrapper.like(WbsTreePrivate::getNodeName, queryValue).or().like(WbsTreePrivate::getFullName, queryValue)));
+                    List<WbsTreePrivate> wbsTreePrivates = wbsTreePrivateMapper.selectList(Wrappers.<WbsTreePrivate>lambdaQuery().eq(WbsTreePrivate::getType, 1).eq(WbsTreePrivate::getWbsId, wbsId).eq(WbsTreePrivate::getProjectId, projectId).and(wrapper -> wrapper.like(WbsTreePrivate::getNodeName, queryValue).or().like(WbsTreePrivate::getImportMatchingInfo, queryValue)).and(wrapper -> wrapper.ne(WbsTreePrivate::getIsAddConceal, 1).or().isNull(WbsTreePrivate::getIsAddConceal)));
                     this.getParentNodesPrivateWbs(wbsTreePrivates, resultNodes, projectId, wbsId);
                     resultNodes.addAll(wbsTreePrivates);
                     List<WbsTreePrivateQueryValueVO> wbsTreePrivateQueryValueVOS = BeanUtil.copyProperties(resultNodes, WbsTreePrivateQueryValueVO.class);