Ver código fonte

节点基础数据保存时同时保存所有表格

chenr 3 meses atrás
pai
commit
f66cc50929

+ 43 - 32
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -3520,7 +3520,7 @@ public class ExcelTabController extends BladeController {
     @ApiImplicitParam(name = "fileId", value = "fileId")
     public void downGongChengExcelFile(HttpServletResponse response) throws Exception {
         String fileName = URLEncoder.encode("工程划分导入模版", Charsets.UTF_8.name());
-        String filePath="https://blade-oss-chongqing.oss-cn-shenzhen.aliyuncs.com//upload/20250327/a012e20cdf78a078d2db0e04d05bacd1.xlsx";
+        String filePath="https://xinan1.zos.ctyun.cn/blade-oss-chongqing/upload/20250508/bf69e3bd5a3fd3a216099238591948d9.xlsx";
         InputStream redio = CommonUtil.getOSSInputStream(filePath);
         byte[] buffer = IoUtil.readToByteArray(redio);
         OutputStream toClient = new BufferedOutputStream(response.getOutputStream());
@@ -4459,51 +4459,62 @@ public class ExcelTabController extends BladeController {
      * 如果excel都不存在,就输出出来
      * @throws Exception
      */
-    //@Scheduled(cron = "10 26 10 * * ?")
+    //@Scheduled(cron = "00 13 10 * * ?")
     public void checkHtmlIsExist() throws Exception {
         StringBuilder result=new StringBuilder("");
+        StringBuilder result1=new StringBuilder("");
         String sql = "Select * from m_excel_tab where parent_id=0 and is_deleted=0";
         List<ExcelTab> query = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ExcelTab.class));
         String excelPath="E:\\excel\\";
-        for (ExcelTab excelTab : query) {
-            String sql1 = "Select * from m_excel_tab where parent_id=" + excelTab.getId() + " and is_deleted=0";
-            List<ExcelTab> query1 = jdbcTemplate.query(sql1, new BeanPropertyRowMapper<>(ExcelTab.class));
-            for (ExcelTab tab : query1) {
-                String sql2 = "Select * from m_excel_tab where parent_id=" + tab.getId() + " and is_deleted=0";
-                List<ExcelTab> query2 = jdbcTemplate.query(sql2, new BeanPropertyRowMapper<>(ExcelTab.class));
-                for (ExcelTab excelTab1 : query2) {
-                    if(!signFtpUtil.isExist(excelTab1.getHtmlUrl())){
-                        if(excelTab1.getFileUrl() != null&&excelTab1.getFileUrl().endsWith(".xlsx") || excelTab1.getFileUrl().endsWith(".xls")){
-                            long resourceLength = CommonUtil.getResourceLength(excelTab1.getFileUrl());
-                            if(resourceLength>=500){
-                                //先下载这个文件,再上传
-                                String fileUrl = excelTab1.getFileUrl();
-                                String localPath=excelPath+excelTab1.getId()+".xlsx";
-                                InputStream inputStreamByUrl = FileUtils.getInputStreamByUrl(fileUrl);
-                                FileUtils.saveFile(inputStreamByUrl,localPath);
-                                File file = new File(localPath);
-                                if(file.exists()){
-                                    Map<String, Object> paramMap = new HashMap<>();
-                                    paramMap.put("nodeId", excelTab1.getId());
-                                    paramMap.put("type",2);
-                                    HashMap<String,String> headers=new HashMap<>();
-                                    headers.put("Content-Type", "multipart/form-data; boundary=----WebKitFormBoundary4tcP4daRPIFDBRvm");
-                                    headers.put("Authorization","Basic c2FiZXI6c2FiZXJfc2VjcmV0");
-                                    headers.put("Blade-auth","bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnRfaWQiOiIwMDAwMDAiLCJ1c2VyX25hbWUiOiJjciIsInJlYWxfbmFtZSI6IumZiOeEtiIsImF2YXRhciI6IiIsImF1dGhvcml0aWVzIjpbImFkbWluaXN0cmF0b3IiXSwiY2xpZW50X2lkIjoic2FiZXIiLCJyb2xlX25hbWUiOiJhZG1pbmlzdHJhdG9yIiwibGljZW5zZSI6InBvd2VyZWQgYnkgYmxhZGV4IiwicG9zdF9pZCI6IiIsInVzZXJfaWQiOiIxOTEyNzAxMzgzOTgyNDI0MDY1Iiwicm9sZV9pZCI6IjExMjM1OTg4MTY3Mzg2NzUyMDEiLCJwaG9uZSI6IjE1MjE1MDUyNzg2Iiwic2NvcGUiOlsiYWxsIl0sIm5pY2tfbmFtZSI6IumZiOeEtiIsIm9hdXRoX2lkIjoiIiwiZGV0YWlsIjp7InR5cGUiOiJ3ZWIifSwiZXhwIjoxNzQ2NDk5MTYyLCJkZXB0X2lkIjoiMTUzNjk4MzA1NjM2MjM4MTMxMyIsImp0aSI6IjIzNGRmY2ZmLWUwOWMtNDVkMy05ODI1LTdhNGI2MjdhYWFlZSIsImFjY291bnQiOiJjciJ9.yfweibj1y8VlWzpGlbhyUr2FMGzG_N1y5fK3xH9kbcE");
-                                    headers.put("Tenant-Id","000000");
-                                    String url="http://testmanger.hcxxy.com/api/blade-manager/exceltab/put-file-attach";
-                                    String body = HttpUtil.createPost(url).addHeaders(headers).form(paramMap).form("file", file).execute().body();
+        try {
+            for (ExcelTab excelTab : query) {
+                String sql1 = "Select * from m_excel_tab where parent_id=" + excelTab.getId() + " and is_deleted=0";
+                List<ExcelTab> query1 = jdbcTemplate.query(sql1, new BeanPropertyRowMapper<>(ExcelTab.class));
+                for (ExcelTab tab : query1) {
+                    String sql2 = "Select * from m_excel_tab where parent_id=" + tab.getId() + " and is_deleted=0 and file_url is not null ";
+                    List<ExcelTab> query2 = jdbcTemplate.query(sql2, new BeanPropertyRowMapper<>(ExcelTab.class));
+                    for (ExcelTab excelTab1 : query2) {
+                        if(!signFtpUtil.isExist(excelTab1.getHtmlUrl())){
+                            if(excelTab1.getFileUrl() != null&&excelTab1.getFileUrl().endsWith(".xlsx") || excelTab1.getFileUrl().endsWith(".xls")){
+                                long resourceLength = CommonUtil.getResourceLength(excelTab1.getFileUrl());
+                                if(resourceLength>=500){
+                                    //先下载这个文件,再上传
+                                    String fileUrl = excelTab1.getFileUrl();
+                                    String localPath=excelPath+excelTab1.getId()+".xlsx";
+                                    InputStream inputStreamByUrl = FileUtils.getInputStreamByUrl(fileUrl);
+                                    FileUtils.saveFile(inputStreamByUrl,localPath);
+                                    File file = new File(localPath);
+                                    if(file.exists()){
+                                        Map<String, Object> paramMap = new HashMap<>();
+                                        paramMap.put("nodeId", excelTab1.getId());
+                                        paramMap.put("type",2);
+                                        HashMap<String,String> headers=new HashMap<>();
+                                        headers.put("Content-Type", "multipart/form-data; boundary=----WebKitFormBoundary4tcP4daRPIFDBRvm");
+                                        headers.put("Authorization","Basic c2FiZXI6c2FiZXJfc2VjcmV0");
+                                        headers.put("Blade-auth","bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ0ZW5hbnRfaWQiOiIwMDAwMDAiLCJ1c2VyX25hbWUiOiJjciIsInJlYWxfbmFtZSI6IumZiOeEtiIsImF2YXRhciI6IiIsImF1dGhvcml0aWVzIjpbImFkbWluaXN0cmF0b3IiXSwiY2xpZW50X2lkIjoiY2xpZW50Iiwicm9sZV9uYW1lIjoiYWRtaW5pc3RyYXRvciIsImxpY2Vuc2UiOiJwb3dlcmVkIGJ5IGJsYWRleCIsInBvc3RfaWQiOiIiLCJ1c2VyX2lkIjoiMTkxMjcwMTM4Mzk4MjQyNDA2NSIsInJvbGVfaWQiOiIxMTIzNTk4ODE2NzM4Njc1MjAxIiwicGhvbmUiOiIxNTIxNTA1Mjc4NiIsInNjb3BlIjpbImFsbCJdLCJuaWNrX25hbWUiOiLpmYjnhLYiLCJvYXV0aF9pZCI6IiIsImRldGFpbCI6eyJ0eXBlIjoid2ViIn0sImV4cCI6MTc0NjY4ODQxOCwiZGVwdF9pZCI6IjE1MzY5ODMwNTYzNjIzODEzMTMiLCJqdGkiOiI3ZjEwY2U0NC1lOWE2LTRlYjMtYjBjYi1iYTJlY2U2MDk3ZjAiLCJhY2NvdW50IjoiY3IifQ.2v68wLgQvCUXanrNdXE6WPnXSrnjjW6mmepPgeWbAMo");
+                                        headers.put("Tenant-Id","000000");
+                                        String url="http://testmanger.hcxxy.com/api/blade-manager/exceltab/put-file-attach";
+                                        String body = HttpUtil.createPost(url).addHeaders(headers).form(paramMap).form("file", file).execute().body();
+                                        Map map = JSON.parseObject(body, Map.class);
+                                        if((int)map.get("code")!=200){
+                                            result1.append(excelTab.getName() + "--" + tab.getName() + "--" + excelTab1.getName()+"\n");
+                                        }
+                                    }
+                                }else {
+                                    result.append(excelTab.getName() + "--" + tab.getName() + "--" + excelTab1.getName()+"\n");
                                 }
-                            }else {
-                                result.append(excelTab.getName() + "--" + tab.getName() + "--" + excelTab1.getName()+"\n");
                             }
                         }
                     }
                 }
             }
+        } catch (Exception e) {
+            throw new RuntimeException(e);
         }
+
         System.out.println("完成");
         System.out.println(result);
+        System.out.println(result1);
     }
     @GetMapping("/checkParamElement")
     @ApiOperationSupport(order = 30)

+ 101 - 2
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/NodeBaseInfoController.java

@@ -16,7 +16,12 @@
  */
 package org.springblade.manager.controller;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.alibaba.nacos.shaded.io.opencensus.metrics.LongGauge;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.google.gson.Gson;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -24,10 +29,18 @@ import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
 import lombok.AllArgsConstructor;
 import javax.validation.Valid;
 
+import org.apache.commons.lang.StringUtils;
 import org.springblade.core.mp.support.Condition;
 import org.springblade.core.mp.support.Query;
 import org.springblade.core.tool.api.R;
 import org.springblade.core.tool.utils.Func;
+import org.springblade.manager.entity.WbsTreeContract;
+import org.springblade.manager.service.IExcelTabService;
+import org.springblade.manager.service.IWbsTreeContractService;
+import org.springblade.manager.vo.AppWbsTreeContractVO;
+import org.springframework.jdbc.core.BeanPropertyRowMapper;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.core.SingleColumnRowMapper;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.RequestParam;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -38,6 +51,8 @@ import org.springblade.core.boot.ctrl.BladeController;
 
 import java.math.BigDecimal;
 import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  *  控制器
@@ -52,6 +67,11 @@ import java.util.HashMap;
 public class NodeBaseInfoController extends BladeController {
 
 	private final INodeBaseInfoService nodeBaseInfoService;
+    private final JdbcTemplate jdbcTemplate;
+    private final IWbsTreeContractService wbsTreeContractService;
+    private final IExcelTabService excelTabService;
+    private final ExcelTabController controller;
+
 
 	/**
 	 * 详情
@@ -112,10 +132,89 @@ public class NodeBaseInfoController extends BladeController {
 	@PostMapping("/submit")
 	@ApiOperationSupport(order = 6)
 	@ApiOperation(value = "新增或修改", notes = "传入nodeBaseInfo")
-	public R submit(@Valid @RequestBody NodeBaseInfo nodeBaseInfo) {
-		return R.status(nodeBaseInfoService.saveOrUpdate(nodeBaseInfo));
+	public R submit(@Valid @RequestBody NodeBaseInfo nodeBaseInfo) throws Exception {
+        boolean update = nodeBaseInfoService.saveOrUpdate(nodeBaseInfo);
+        String s="Select project_id,contract_id from m_wbs_tree_contract where p_key_id="+nodeBaseInfo.getNodeId();
+        List<WbsTreeContract> wbsTreeContract = jdbcTemplate.query(s, new BeanPropertyRowMapper<>(WbsTreeContract.class));
+        if(update){
+            //施工部分
+            String sql1="select p_key_id from m_wbs_tree_contract where p_id="+nodeBaseInfo.getNodeId()+" and is_deleted=0 and table_owner in('1','2','3')";
+            List<Long> longs1 = jdbcTemplate.query(sql1, new SingleColumnRowMapper<>(Long.class));
+            Map<Long,Map<String, Object>>dataMap1=new HashMap<>();
+            if (longs1.size()>0){
+                for (Long pkeyId: longs1) {
+                    Map<String, Object> map1 = nodeBaseInfoService.getAllNodeBaseInfoByPkeyId(pkeyId, nodeBaseInfo.getNodeId());
+                    dataMap1.put(pkeyId,map1);
+                }
+                this.synPDFInfo(wbsTreeContract.get(0).getContractId(), nodeBaseInfo.getNodeId()+"", "1", wbsTreeContract.get(0).getProjectId(),dataMap1);
+            }
+            //监理部分
+            String sql2="select p_key_id from m_wbs_tree_contract where p_id="+nodeBaseInfo.getNodeId()+" and is_deleted=0 and table_owner in('4','5','6')";
+            List<Long> longs2 = jdbcTemplate.query(sql2, new SingleColumnRowMapper<>(Long.class));
+            Map<Long,Map<String, Object>>dataMap2=new HashMap<>();
+            if (longs2.size()>0){
+                for (Long pkeyId: longs2) {
+                    Map<String, Object> map2 = nodeBaseInfoService.getAllNodeBaseInfoByPkeyId(pkeyId, nodeBaseInfo.getNodeId());
+                    dataMap2.put(pkeyId,map2);
+                }
+                this.synPDFInfo(wbsTreeContract.get(0).getContractId(), nodeBaseInfo.getNodeId()+"", "2", wbsTreeContract.get(0).getProjectId(),dataMap2);
+            }
+        }
+        return R.status(update);
 	}
 
+    public R synPDFInfo(String contractId, String nodeId, String classify, String projectId,Map<Long,Map<String,Object>>dataMap) {
+
+        if (contractId == null && StringUtils.isEmpty(contractId)) {
+            return R.data("contractId不能为空");
+        }
+
+        if (nodeId == null && StringUtils.isEmpty(nodeId)) {
+            return R.data("nodeId不能为空");
+        }
+
+        if (classify == null && StringUtils.isEmpty(classify)) {
+            return R.data("classify不能为空");
+        }
+
+        if (projectId == null && StringUtils.isEmpty(projectId)) {
+            return R.data("projectId不能为空");
+        }
+        try {
+                JSONObject js = new JSONObject();
+                JSONObject js2 = new JSONObject();
+                List<AppWbsTreeContractVO> tableAll = wbsTreeContractService.searchNodeAllTable(nodeId, classify, contractId, projectId, null);
+                JSONArray array = new JSONArray();
+                if (tableAll != null && tableAll.size() >= 1) {
+                    /*只需加载第一张即可,生效会自动补全*/
+                    for (AppWbsTreeContractVO tab : tableAll) {
+                        Map<String, Object> jo = excelTabService.getBussDataInfo(tab.getPKeyId(), 0,true);
+                        if(dataMap.containsKey(tab.getPKeyId())){
+                            Map<String, Object> map = dataMap.get(tab.getPKeyId());
+                            map.forEach((key, value) -> jo.merge(key, value, (oldVal, newVal) -> newVal));
+                        }
+                        String s = new Gson().toJson(jo);
+                        //字符串转jsonobject
+                        JSONObject obj = JSON.parseObject(s);
+                        obj.put("classify", classify);
+                        obj.put("nodeId", nodeId);
+                        obj.put("contractId", contractId);
+                        obj.put("pkeyId", tab.getPKeyId());
+                        obj.put("projectId", projectId);
+                        obj.put("isCollapseLoad", true);
+                        obj.put("isRenderForm", true);
+                        array.add(obj);
+                    }
+                }
+                js2.put("orderList", array);
+                js.put("dataInfo", js2);
+                controller.saveBussData2(js);
+        } catch (Exception e) {
+            return null;
+        }
+        return R.data("成功");
+    }
+
 
 	/**
 	 * 删除

+ 37 - 6
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/ExcelTabServiceImpl.java

@@ -1243,11 +1243,27 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
 
                     WbsTreeContract wbsTreeContractByP = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
                             .eq(WbsTreeContract::getId, wbsTreeContract.getParentId()).eq(WbsTreeContract::getContractId, tableInfo.getContractId()));
-
                     if (wbsTreeContractByP != null) {
                         //处理文件提名
                         String fileName = this.wbsParamService.createFileTitle(wbsTreeContractByP);
-
+                        String sql="select template_type from m_contract_info where id="+wbsTreeContractByP.getContractId();
+                        Integer type = jdbcTemplate.query(sql, rs -> {
+                            if (rs.next()) {
+                                return rs.getObject(1, Integer.class);
+                            } else {
+                                return 0; // 默认值
+                            }
+                        });
+                        if(type==2){
+                            if(wbsTreeContractByP.getMajorDataType()!=null&&wbsTreeContractByP.getMajorDataType()==4){
+                                if(tableInfo.getClassify()!=null&&tableInfo.getClassify().equals("1")){
+                                    //查询是否是底层节点
+                                    fileName=fileName+"检验申请批复单及附件";
+                                }else {
+                                    fileName=fileName+"抽检记录";
+                                }
+                            }
+                        }
                         //huangjn 保存成功后调用生成资料查询列表数据
                         this.informationQueryClient.saveOrUpdateInformationQueryData(wbsTreeContractByP.getPKeyId() + "", "首件使用字段", "业务ID(主要将来给首件使用)", fileName, Integer.parseInt(tableInfo.getClassify()), 2, "是否是首件(临时,暂时没用到)", "源文件(首件字段)", "pdf文件(首件字段)", "首件上传总结报告名称", new ArrayList<>());
                     }
@@ -1280,15 +1296,30 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
 
                 //获取节点
                 WbsTreeContract wbsTreeContract = this.wbsTreeContractService.getOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getPKeyId, tableInfoList.get(0).getPkeyId()));
-
                 WbsTreeContract wbsTreeContractByP = wbsTreeContractService.getBaseMapper().selectOne(Wrappers.<WbsTreeContract>query().lambda()
                         .eq(WbsTreeContract::getId, wbsTreeContract.getParentId()).eq(WbsTreeContract::getContractId, wbsTreeContract.getContractId()));
                 //处理文件提名
                 fileName1= this.wbsParamService.createFileTitle(wbsTreeContractByP);
-
+                String sql="select template_type from m_contract_info where id="+wbsTreeContractByP.getContractId();
+                Integer type = jdbcTemplate.query(sql, rs -> {
+                    if (rs.next()) {
+                        return rs.getObject(1, Integer.class);
+                    } else {
+                        return 0; // 默认值
+                    }
+                });
+                if(type==2){
+                    if(wbsTreeContractByP.getMajorDataType()!=null&&wbsTreeContractByP.getMajorDataType()==4){
+                        if(tableInfoList.get(0).getClassify()!=null&&tableInfoList.get(0).getClassify().equals("1")){
+                            //查询是否是底层节点
+                            fileName1=fileName1+"检验申请批复单及附件";
+                        }else {
+                            fileName1=fileName1+"抽检记录";
+                        }
+                    }
+                }
                 //huangjn 保存成功后调用生成资料查询列表数据
                 this.informationQueryClient.saveOrUpdateInformationQueryData(wbsTreeContractByP.getPKeyId() + "", "首件使用字段", "业务ID(主要将来给首件使用)", fileName1, Integer.parseInt(tableInfoList.get(0).getClassify()), 2, "false", "源文件(首件字段)", "pdf文件(首件字段)", "首件上传总结报告名称", new ArrayList<>());
-
                 JSONObject json = new JSONObject();
                 json.put("operationObjIds", Func.toStrList(pkids));
                 json.put("operationObjName", wbsTreeContractByP.getNodeName() + "节点数据操作");
@@ -1692,7 +1723,7 @@ public class ExcelTabServiceImpl extends BaseServiceImpl<ExcelTabMapper, ExcelTa
         Map<String, Object> nodeBaseInfo = nodeBaseInfoService.getAllNodeBaseInfoByPkeyId(pkeyId, nodeId);
         if(nodeBaseInfo!=null){
             for (Map.Entry<String, Object> entry : nodeBaseInfo.entrySet()) {
-                reData.putIfAbsent(entry.getKey(), entry.getValue());
+                reData.put(entry.getKey(), entry.getValue());
             }
         }
 //        if(reData.size()>0){

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

@@ -74,15 +74,13 @@ public class NodeBaseInfoServiceImpl extends BaseServiceImpl<NodeBaseInfoMapper,
         //查出当前节点的所有父节点
         WbsTreeContract wbsTreeContract = iWbsTreeContractService.getBaseMapper().selectOne(new LambdaQueryWrapper<>(WbsTreeContract.class).eq(WbsTreeContract::getPKeyId,pKeyId));
         if(wbsTreeContract!=null&&wbsTreeContract.getAncestors()!=null){
-            String ancestors = wbsTreeContract.getAncestors();
+            String ancestors = wbsTreeContract.getAncestorsPId();
             String[] nodeIds = ancestors.split(",");
             QueryWrapper<WbsTreeContract> queryWrapper = new QueryWrapper<>();
             queryWrapper.eq("project_id", wbsTreeContract.getProjectId())
                 .eq("contract_id", wbsTreeContract.getContractId())
                 .ne("parent_id", 0)
-                .and(wrapper -> wrapper.in("p_key_id", Arrays.asList(nodeIds))
-                    .or()
-                    .in("id", Arrays.asList(nodeIds)))
+                .and(wrapper -> wrapper.in("p_key_id", Arrays.asList(nodeIds)))
                 .groupBy("p_key_id");
             List<WbsTreeContract> wbsTreeContracts = iWbsTreeContractService.getBaseMapper().selectList(queryWrapper);
             if(wbsTreeContracts.size()>0){

+ 81 - 70
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java

@@ -2390,79 +2390,88 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
         String sqlList="Select parent_id,node_name from m_wbs_tree_contract where contract_id="+wbsTreeContractRoot.getContractId()+" and wbs_id="+wbsTreeContractRoot.getWbsId()+" and is_deleted=0";
         List<WbsTreeContract> WbsTreeContractListupdate = jdbcTemplate.query(sqlList, new BeanPropertyRowMapper<>(WbsTreeContract.class));
         //导入节点与现有节点进行比较。进行修改编号
+        List<String>updateUnitNames=new ArrayList<>();
         for (ImportTreeDto dto : list) {
             for (WbsTreeContractVO vo : wbsTreeContractVOS) {
                 //wbs节点和单位工程的名称类型能对应上,并且编号不一样,就修改编号
                 if(vo.getNodeName().equals(dto.getUnitName())&&vo.getNodeType()==1){
-                    Boolean exist = this.isExist(dto, WbsTreeContractListupdate, 1, Long.valueOf(wbsTreeContractRoot.getContractId()));
+                    Boolean exist = this.isExist(dto, WbsTreeContractListupdate, 1, wbsTreeContractRoot);
                     if(exist){
                         if(vo.getPartitionCode()==null||!vo.getPartitionCode().equals(dto.getUnitCode())){
-                            baseMapper.update(null,Wrappers.<WbsTreeContract>lambdaUpdate().set(WbsTreeContract::getPartitionCode,dto.getUnitCode()).eq(WbsTreeContract::getPKeyId,vo.getPrimaryKeyId()));
+                            if(updateUnitNames.size()>=1&&updateUnitNames.contains(vo.getNodeName())){
+                                continue;
+                            }
+                            baseMapper.update(null,Wrappers.<WbsTreeContract>lambdaUpdate().set(WbsTreeContract::getPartitionCode,dto.getUnitCode()).eq(WbsTreeContract::getPKeyId,vo.getPKeyId()));
                             updateList.add(vo.getNodeName());
+                            updateUnitNames.add(vo.getNodeName());
+                            dto.setIsUnit(true);
                         }
-                        dto.setIsUnit(true);
                         continue;
                     }
                 }
                 //wbs节点和子单位工程的名称类型能对应上,并且编号不一样,并且祖级节点也都能对应上,就修改编号
                 if(vo.getNodeName().equals(dto.getSubUnitName())&&vo.getNodeType()==18){
-                    Boolean exist = this.isExist(dto, WbsTreeContractListupdate, 2, Long.valueOf(wbsTreeContractRoot.getContractId()));
+                    Boolean exist = this.isExist(dto, WbsTreeContractListupdate, 2, wbsTreeContractRoot);
                     if(exist){
                         if(isTrueNode(Arrays.asList(dto.getUnitName(),dto.getSubUnitName()),vo)){
                             if(vo.getPartitionCode()==null||!vo.getPartitionCode().equals(dto.getSubUnitCode())){
-                                baseMapper.update(null,Wrappers.<WbsTreeContract>lambdaUpdate().set(WbsTreeContract::getPartitionCode,dto.getSubUnitCode()).eq(WbsTreeContract::getPKeyId,vo.getPrimaryKeyId()));
+                                baseMapper.update(null,Wrappers.<WbsTreeContract>lambdaUpdate().set(WbsTreeContract::getPartitionCode,dto.getSubUnitCode()).eq(WbsTreeContract::getPKeyId,vo.getPKeyId()));
                                 updateList.add(vo.getNodeName());
+                                dto.setIsSubUnit(true);
                             }
-                            dto.setIsSubUnit(true);
+
                         }
                         continue;
                     }
                 }
                 //wbs节点和分部工程的名称类型能对应上,并且编号不一样,并且祖级节点也都能对应上,就修改编号
                 if(vo.getNodeName().equals(dto.getDivisionName())&&vo.getNodeType()==2&&!vo.getPartitionCode().equals(dto.getDivisionCode())){
-                    Boolean exist = this.isExist(dto, WbsTreeContractListupdate, 3, Long.valueOf(wbsTreeContractRoot.getContractId()));
+                    Boolean exist = this.isExist(dto, WbsTreeContractListupdate, 3, wbsTreeContractRoot);
                     if(exist){
                         if(isTrueNode(Arrays.asList(dto.getUnitName(),dto.getSubUnitName(),dto.getDivisionName()),vo)){
-                            baseMapper.update(null,Wrappers.<WbsTreeContract>lambdaUpdate().set(WbsTreeContract::getPartitionCode,dto.getDivisionCode()).eq(WbsTreeContract::getPKeyId,vo.getPrimaryKeyId()));
+                            baseMapper.update(null,Wrappers.<WbsTreeContract>lambdaUpdate().set(WbsTreeContract::getPartitionCode,dto.getDivisionCode()).eq(WbsTreeContract::getPKeyId,vo.getPKeyId()));
                             updateList.add(vo.getNodeName());
+                            dto.setIsDivision(true);
                         }
-                        dto.setIsDivision(true);
+
                         continue;
                     }
                 }
                 //wbs节点和子分部工程的名称类型能对应上,并且编号不一样,并且祖级节点也都能对应上,就修改编号
                 if(vo.getNodeName().equals(dto.getSubDivisionName())&&vo.getNodeType()==3&&(vo.getPartitionCode()==null||!vo.getPartitionCode().equals(dto.getSubDivisionCode()))){
-                    Boolean exist = this.isExist(dto, WbsTreeContractListupdate, 4, Long.valueOf(wbsTreeContractRoot.getContractId()));
+                    Boolean exist = this.isExist(dto, WbsTreeContractListupdate, 4, wbsTreeContractRoot);
                     if(exist){
                         if(isTrueNode(Arrays.asList(dto.getUnitName(),dto.getSubUnitName(),dto.getDivisionName(),dto.getSubDivisionName()),vo)){
-                            baseMapper.update(null,Wrappers.<WbsTreeContract>lambdaUpdate().set(WbsTreeContract::getPartitionCode,dto.getSubDivisionCode()).eq(WbsTreeContract::getPKeyId,vo.getPrimaryKeyId()));
+                            baseMapper.update(null,Wrappers.<WbsTreeContract>lambdaUpdate().set(WbsTreeContract::getPartitionCode,dto.getSubDivisionCode()).eq(WbsTreeContract::getPKeyId,vo.getPKeyId()));
                             updateList.add(vo.getNodeName());
+                            dto.setIsSubDivision(true);
                         }
-                        dto.setIsSubDivision(true);
+
                         continue;
                     }
                 }
                 //wbs节点和分项工程的名称类型能对应上,并且编号不一样,并且祖级节点也都能对应上,就修改编号
                 if(vo.getNodeName().equals(dto.getItemName())&&vo.getNodeType()==4&&(vo.getPartitionCode()==null||!vo.getPartitionCode().equals(dto.getItemCode()))){
-                    Boolean exist = this.isExist(dto, WbsTreeContractListupdate, 5, Long.valueOf(wbsTreeContractRoot.getContractId()));
+                    Boolean exist = this.isExist(dto, WbsTreeContractListupdate, 5, wbsTreeContractRoot);
                     if(exist){
                         if(isTrueNode(Arrays.asList(dto.getUnitName(),dto.getSubUnitName(),dto.getDivisionName(),dto.getSubDivisionName(),dto.getItemName()),vo)){
-                            baseMapper.update(null,Wrappers.<WbsTreeContract>lambdaUpdate().set(WbsTreeContract::getPartitionCode,dto.getItemCode()).eq(WbsTreeContract::getPKeyId,vo.getPrimaryKeyId()));
+                            baseMapper.update(null,Wrappers.<WbsTreeContract>lambdaUpdate().set(WbsTreeContract::getPartitionCode,dto.getItemCode()).eq(WbsTreeContract::getPKeyId,vo.getPKeyId()));
                             updateList.add(vo.getNodeName());
+                            dto.setIsItem(true);
                         }
-                        dto.setIsItem(true);
+
                         continue;
                     }
                 }
                 //wbs节点和子分项工程的名称类型能对应上,并且编号不一样,并且祖级节点也都能对应上,就修改编号
                 if(vo.getNodeName().equals(dto.getSubItemName())&&vo.getNodeType()==5&&(vo.getPartitionCode()==null||!vo.getPartitionCode().equals(dto.getSubItemCode()))){
-                    Boolean exist = this.isExist(dto, WbsTreeContractListupdate, 6, Long.valueOf(wbsTreeContractRoot.getContractId()));
+                    Boolean exist = this.isExist(dto, WbsTreeContractListupdate, 6, wbsTreeContractRoot);
                     if(exist){
                         if(isTrueNode(Arrays.asList(dto.getUnitName(),dto.getSubUnitName(),dto.getDivisionName(),dto.getSubDivisionName(),dto.getItemName(),dto.getSubItemName()),vo)){
-                            baseMapper.update(null,Wrappers.<WbsTreeContract>lambdaUpdate().set(WbsTreeContract::getPartitionCode,dto.getSubItemCode()).eq(WbsTreeContract::getPKeyId,vo.getPrimaryKeyId()));
+                            baseMapper.update(null,Wrappers.<WbsTreeContract>lambdaUpdate().set(WbsTreeContract::getPartitionCode,dto.getSubItemCode()).eq(WbsTreeContract::getPKeyId,vo.getPKeyId()));
                             updateList.add(vo.getNodeName());
+                            dto.setIsSubItem(true);
                         }
-                        dto.setIsSubItem(true);
                         break;
                     }
 
@@ -2478,7 +2487,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
             //单位工程:如果没有被处理过,说明需要新增
             if (!dto.getIsUnit()){
                 //检测是否已经存在,如果存在,就不需要新增了
-                Boolean exist = this.isExist(dto, WbsTreeContractList, 1, Long.valueOf(wbsTreeContractRoot.getContractId()));
+                Boolean exist = this.isExist(dto, WbsTreeContractList, 1, wbsTreeContractRoot);
                 if(!exist){
                     WbsTreeContract unit = new WbsTreeContract();
                     BeanUtil.copy(wbsTreeContractRoot,unit);
@@ -2493,14 +2502,16 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                     unit.setFullName(dto.getUnitName());
                     unit.setIsTypePrivatePid(null);
                     unit.setSort(i);
+                    unit.setTreePId(null);
+                    unit.setPId(wbsTreeContractRoot.getPKeyId());
+                    unit.setAncestorsPId(wbsTreeContractRoot.getAncestorsPId() + "," + wbsTreeContractRoot.getPKeyId());
                     baseMapper.insert(unit);
                     insertList.add(unit);
                 }
-
             }
             //子单位工程:如果没有被处理过,说明需要新增,最重要是需要找到父节点。单位工程不会有相同的,所以直接根据名称查找
             if(!dto.getIsSubUnit()){
-                Boolean exist = this.isExist(dto, WbsTreeContractList, 2, Long.valueOf(wbsTreeContractRoot.getContractId()));
+                Boolean exist = this.isExist(dto, WbsTreeContractList, 2, wbsTreeContractRoot);
                 if(!exist){
                     WbsTreeContract fatherNode = baseMapper.selectOne(Wrappers.<WbsTreeContract>lambdaQuery().eq(WbsTreeContract::getNodeName, dto.getUnitName()).eq(WbsTreeContract::getProjectId, wbsTreeContractRoot.getProjectId())
                         .eq(WbsTreeContract::getContractId, wbsTreeContractRoot.getContractId()).eq(WbsTreeContract::getIsDeleted, 0).last("LIMIT 1"));
@@ -2517,6 +2528,9 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                     subUnit.setFullName(dto.getSubUnitName());
                     subUnit.setIsTypePrivatePid(null);
                     subUnit.setSort(i);
+                    subUnit.setTreePId(null);
+                    subUnit.setPId(fatherNode.getPKeyId());
+                    subUnit.setAncestorsPId(fatherNode.getAncestorsPId() + "," + fatherNode.getPKeyId());
                     baseMapper.insert(subUnit);
                     insertList.add(subUnit);
                 }
@@ -2524,7 +2538,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
             }
             //分部工程:如果没有被处理过,说明需要新增,最重要是需要找到父节点。现在的办法是(通过祖级节点名称拼接的方式来判断)。
             if(!dto.getIsDivision()){
-                Boolean exist = this.isExist(dto, WbsTreeContractList, 3, Long.valueOf(wbsTreeContractRoot.getContractId()));
+                Boolean exist = this.isExist(dto, WbsTreeContractList, 3, wbsTreeContractRoot);
                 if(!exist){
                     String fatherNodeName="";
                     if(dto.getSubUnitName()!=null&&!dto.getSubUnitName().equals("")){
@@ -2536,7 +2550,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                         .eq(WbsTreeContract::getContractId, wbsTreeContractRoot.getContractId()).eq(WbsTreeContract::getIsDeleted, 0));
                     if(list1.size()>0){
                         for (WbsTreeContract contract : list1) {
-                            String[] ids = contract.getAncestors().split(",");
+                            String[] ids = contract.getAncestorsPId().split(",");
                             ids=Arrays.stream(ids)
                                 .filter(id -> !id.equals("0")) // 过滤掉值为 "0" 的元素
                                 .toArray(String[]::new);
@@ -2559,6 +2573,9 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                                 division.setFullName(dto.getDivisionName());
                                 division.setIsTypePrivatePid(null);
                                 division.setSort(i);
+                                division.setTreePId(null);
+                                division.setPId(contract.getPKeyId());
+                                division.setAncestorsPId(contract.getAncestorsPId() + "," + contract.getPKeyId());
                                 baseMapper.insert(division);
                                 insertList.add(division);
                                 break;
@@ -2570,7 +2587,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
             }
             //子分部工程:如果没有被处理过,说明需要新增,最重要是需要找到父节点。现在的办法是(通过祖级节点名称拼接的方式来判断)。
             if(!dto.getIsSubDivision()){
-                Boolean exist = this.isExist(dto, WbsTreeContractList, 4, Long.valueOf(wbsTreeContractRoot.getContractId()));
+                Boolean exist = this.isExist(dto, WbsTreeContractList, 4, wbsTreeContractRoot);
                 if(!exist){
                     String fatherNodeName="";
                     if(dto.getDivisionName()!=null&&!dto.getDivisionName().equals("")){
@@ -2584,7 +2601,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                         .eq(WbsTreeContract::getContractId, wbsTreeContractRoot.getContractId()).eq(WbsTreeContract::getIsDeleted, 0));
                     if(list1.size()>0){
                         for (WbsTreeContract contract : list1) {
-                            String[] ids = contract.getAncestors().split(",");
+                            String[] ids = contract.getAncestorsPId().split(",");
                             ids=Arrays.stream(ids)
                                 .filter(id -> !id.equals("0")) // 过滤掉值为 "0" 的元素
                                 .toArray(String[]::new);
@@ -2608,6 +2625,9 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                                 subDivision.setFullName(dto.getSubDivisionName());
                                 subDivision.setIsTypePrivatePid(null);
                                 subDivision.setSort(i);
+                                subDivision.setTreePId(null);
+                                subDivision.setPId(contract.getPKeyId());
+                                subDivision.setAncestorsPId(contract.getAncestorsPId() + "," + contract.getPKeyId());
                                 baseMapper.insert(subDivision);
                                 insertList.add(subDivision);
                                 break;
@@ -2619,7 +2639,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
             }
             //分项节点:如果没有被处理过,说明需要新增,最重要是需要找到父节点。现在的办法是(通过祖级节点名称拼接的方式来判断)。
             if(!dto.getIsItem()){
-                Boolean exist = this.isExist(dto, WbsTreeContractList, 5, Long.valueOf(wbsTreeContractRoot.getContractId()));
+                Boolean exist = this.isExist(dto, WbsTreeContractList, 5, wbsTreeContractRoot);
                 if(!exist){
                     String fatherNodeName="";
                     if(dto.getSubDivisionName()!=null&&!dto.getSubDivisionName().equals("")){
@@ -2636,7 +2656,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                         .eq(WbsTreeContract::getContractId, wbsTreeContractRoot.getContractId()).eq(WbsTreeContract::getIsDeleted, 0));
                     if(list1.size()>0){
                         for (WbsTreeContract contract : list1) {
-                            String[] ids = contract.getAncestors().split(",");
+                            String[] ids = contract.getAncestorsPId().split(",");
                             ids=Arrays.stream(ids)
                                 .filter(id -> !id.equals("0")) // 过滤掉值为 "0" 的元素
                                 .toArray(String[]::new);
@@ -2661,6 +2681,9 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                                 item.setFullName(dto.getItemName());
                                 item.setIsTypePrivatePid(null);
                                 item.setSort(i);
+                                item.setTreePId(null);
+                                item.setPId(contract.getPKeyId());
+                                item.setAncestorsPId(contract.getAncestorsPId() + "," + contract.getPKeyId());
                                 baseMapper.insert(item);
                                 insertList.add(item);
                                 break;
@@ -2672,7 +2695,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
             }
             //子分项节点:如果没有被处理过,说明需要新增,最重要是需要找到父节点。现在的办法是(通过祖级节点名称拼接的方式来判断)。
             if(!dto.getIsSubItem()){
-                Boolean exist = this.isExist(dto, WbsTreeContractList, 6, Long.valueOf(wbsTreeContractRoot.getContractId()));
+                Boolean exist = this.isExist(dto, WbsTreeContractList, 6, wbsTreeContractRoot);
                 if(!exist){
                     String fatherNodeName="";
                     if(dto.getItemName()!=null&&!dto.getItemName().equals("")){
@@ -2691,7 +2714,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                         .eq(WbsTreeContract::getContractId, wbsTreeContractRoot.getContractId()).eq(WbsTreeContract::getIsDeleted, 0));
                     if(list1.size()>0){
                         for (WbsTreeContract contract : list1) {
-                            String[] ids = contract.getAncestors().split(",");
+                            String[] ids = contract.getAncestorsPId().split(",");
                             ids=Arrays.stream(ids)
                                 .filter(id -> !id.equals("0")) // 过滤掉值为 "0" 的元素
                                 .toArray(String[]::new);
@@ -2717,6 +2740,9 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                                 subItem.setFullName(dto.getSubItemName());
                                 subItem.setIsTypePrivatePid(null);
                                 subItem.setSort(i);
+                                subItem.setTreePId(null);
+                                subItem.setPId(contract.getPKeyId());
+                                subItem.setAncestorsPId(contract.getAncestorsPId() + "," + contract.getPKeyId());
                                 baseMapper.insert(subItem);
                                 insertList.add(subItem);
                                 break;
@@ -3022,7 +3048,8 @@ public static boolean hasConflictingCodes(List<ImportTreeDto> list) {
             Objects.equals(fatherNodeType1, fatherNodeType2) &&
             !Objects.equals(dto1.getSubItemCode(), dto2.getSubItemCode());
     }
-    private Boolean isExist(ImportTreeDto dto, List<WbsTreeContract> wbsTreeContractList, int type,Long contractId) {
+    private Boolean isExist(ImportTreeDto dto, List<WbsTreeContract> wbsTreeContractList, int type,WbsTreeContract tree) {
+        Long contractId=Long.valueOf(tree.getContractId());
         String nodeName="";
         if(type==1){
             nodeName=dto.getUnitName();
@@ -3045,7 +3072,7 @@ public static boolean hasConflictingCodes(List<ImportTreeDto> list) {
         String finalNodeName = nodeName;
         List<Long> list = wbsTreeContractList.stream()
             .filter(item -> finalNodeName.equals(item.getNodeName()))
-            .map(item -> item.getParentId())
+            .map(item -> item.getPId())
             .collect(Collectors.toList());
         if(list.size()==0){
             return false;
@@ -3054,56 +3081,40 @@ public static boolean hasConflictingCodes(List<ImportTreeDto> list) {
                 return true;
             }
             //如果数据库中存在名称相同的节点,查询该节点的祖级节点
-            String sql="select node_name from m_wbs_tree_contract where is_deleted=0 and contract_id="+contractId+" and id in ("+String.join(",", list.stream().map(String::valueOf).collect(Collectors.toList()))+")";
-            List<String> nodeNames = jdbcTemplate.query(sql, new SingleColumnRowMapper<>(String.class));
+            String sql="select p_key_id,node_name from m_wbs_tree_contract where is_deleted=0 and contract_id="+contractId+" and p_key_id in ("+String.join(",", list.stream().map(String::valueOf).collect(Collectors.toList()))+")";
+            List<WbsTreeContract> wbsContracts = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(WbsTreeContract.class));
             String  fatherNodeName="";
             if(type==2){
-                fatherNodeName=dto.getUnitName();
+                fatherNodeName=tree.getNodeName()+dto.getUnitName();
             }
            else if(type==3){
-                if(dto.getSubUnitName()!=null&&!dto.getSubUnitName().equals("")){
-                    fatherNodeName=dto.getSubUnitName();
-                }else if(dto.getUnitName()!=null&&!dto.getUnitName().equals("")){
-                    fatherNodeName=dto.getUnitName();
-                }
+                fatherNodeName=tree.getNodeName()+dto.getUnitName()+dto.getSubUnitName();
             }
             else if(type==4){
-                if(dto.getDivisionName()!=null&&!dto.getDivisionName().equals("")){
-                    fatherNodeName=dto.getDivisionName();
-                } else if(dto.getSubUnitName()!=null&&!dto.getSubUnitName().equals("")){
-                    fatherNodeName=dto.getSubUnitName();
-                }else if(dto.getUnitName()!=null&&!dto.getUnitName().equals("")){
-                    fatherNodeName=dto.getUnitName();
-                }
+                fatherNodeName=tree.getNodeName()+dto.getUnitName()+dto.getSubUnitName()+dto.getDivisionName();
             }
             else if(type==5){
-                if(dto.getSubDivisionName()!=null&&!dto.getSubDivisionName().equals("")){
-                    fatherNodeName=dto.getSubDivisionName();
-                }
-                else if(dto.getDivisionName()!=null&&!dto.getDivisionName().equals("")){
-                    fatherNodeName=dto.getDivisionName();
-                } else if(dto.getSubUnitName()!=null&&!dto.getSubUnitName().equals("")){
-                    fatherNodeName=dto.getSubUnitName();
-                }else if(dto.getUnitName()!=null&&!dto.getUnitName().equals("")){
-                    fatherNodeName=dto.getUnitName();
-                }
+                fatherNodeName=tree.getNodeName()+dto.getUnitName()+dto.getSubUnitName()+dto.getDivisionName()+dto.getSubDivisionName();
             }
             else  if(type==6){
-                if(dto.getItemName()!=null&&!dto.getItemName().equals("")){
-                } else  if(dto.getSubDivisionName()!=null&&!dto.getSubDivisionName().equals("")){
-                    fatherNodeName=dto.getSubDivisionName();
-                }
-                else if(dto.getDivisionName()!=null&&!dto.getDivisionName().equals("")){
-                    fatherNodeName=dto.getDivisionName();
-                } else if(dto.getSubUnitName()!=null&&!dto.getSubUnitName().equals("")){
-                    fatherNodeName=dto.getSubUnitName();
-                }else if(dto.getUnitName()!=null&&!dto.getUnitName().equals("")){
-                    fatherNodeName=dto.getUnitName();
+                fatherNodeName=tree.getNodeName()+dto.getUnitName()+dto.getSubUnitName()+dto.getDivisionName()+dto.getSubDivisionName()+dto.getItemName();
+            }
+            if(wbsContracts.size()>0){
+                for (WbsTreeContract wbsContract : wbsContracts) {
+                        String Sql="select ancestors_p_id from m_wbs_tree_contract where p_key_id="+wbsContract.getPKeyId();
+                        String ancestors = jdbcTemplate.queryForObject(Sql, new SingleColumnRowMapper<>(String.class));
+                        String[] ids = ancestors.split(",");
+                        ids=Arrays.stream(ids)
+                            .filter(id -> !id.equals("0")) // 过滤掉值为 "0" 的元素
+                            .toArray(String[]::new);
+                        String sql1="Select node_name from m_wbs_tree_contract where p_key_id in("+String.join(",", ids)+")";
+                        List<String> nodeNames = jdbcTemplate.query(sql1, new SingleColumnRowMapper<>(String.class));
+                        String join = String.join("", nodeNames);
+                        if(join.equals(fatherNodeName)){
+                            return true;
+                        }
                 }
-            }
-
-            if(nodeNames.size()>0&&nodeNames.contains(fatherNodeName)){
-                return true;
+                return false;
             }
             return false;
         }