liuyc 1 年間 前
コミット
7a2b597133

+ 41 - 12
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/InformationQueryServiceImpl.java

@@ -25,6 +25,7 @@ import org.springblade.core.secure.BladeUser;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.utils.*;
 import org.springblade.manager.entity.ContractInfo;
+import org.springblade.manager.entity.ContractRelationJlyz;
 import org.springblade.manager.entity.TabBusstimeInfo;
 import org.springblade.manager.entity.WbsTreeContract;
 import org.springblade.manager.feign.ContractClient;
@@ -908,20 +909,48 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
 
     @Override
     public void delAsyncWbsTree(String contractId) {
-        //模糊匹配所有以contractId开头的所有合同段节点key值
-        Set<String> keysByNodes = RedisTemplate.keys("blade-manager::contract:wbstree:" + contractId + "*");
-        if (keysByNodes != null) {
-            RedisTemplate.delete(keysByNodes);
-        }
+        ContractInfo contractInfo = jdbcTemplate.query("select id,contract_type from m_contract_info where id = " + contractId, new BeanPropertyRowMapper<>(ContractInfo.class)).stream().findAny().orElse(null);
+
+        /*================ 监理合同段 ================*/
+        if (contractInfo != null && (new Integer("2").equals(contractInfo.getContractType()) || new Integer("3").equals(contractInfo.getContractType()))) {
+            String sql = "select * from m_contract_relation_jlyz where contract_id_jlyz = " + contractInfo.getId();
+            List<Long> record_SG = jdbcTemplate.query(sql, new BeanPropertyRowMapper<>(ContractRelationJlyz.class)).stream().map(ContractRelationJlyz::getContractIdSg).collect(Collectors.toList());
+            if (record_SG.size() > 0) {
+                for (Long sgId : record_SG) {
+                    //模糊匹配所有以contractId开头的所有合同段节点key值
+                    Set<String> keysByNodes = RedisTemplate.keys("blade-manager::contract:wbstree:" + sgId + "*");
+                    if (keysByNodes != null) {
+                        RedisTemplate.delete(keysByNodes);
+                    }
 
-        //模糊匹配所有以contractId开头的所有资料填报key值
-        Set<String> keysByInformationQuery = RedisTemplate.keys("blade-manager::contract:wbstree:byInformationQuery:" + contractId + "*");
-        if (keysByInformationQuery != null) {
-            RedisTemplate.delete(keysByInformationQuery);
-        }
+                    //模糊匹配所有以contractId开头的所有资料填报key值
+                    Set<String> keysByInformationQuery = RedisTemplate.keys("blade-manager::contract:wbstree:byInformationQuery:" + sgId + "*");
+                    if (keysByInformationQuery != null) {
+                        RedisTemplate.delete(keysByInformationQuery);
+                    }
+
+                    //删除合同段本地缓存
+                    wbsTreeContractClient.deleteContractLocalCache(String.valueOf(sgId));
+                }
+            }
+
+            /*================ 施工合同段 ================*/
+        } else if (contractInfo != null && new Integer("1").equals(contractInfo.getContractType())) {
+            //模糊匹配所有以contractId开头的所有合同段节点key值
+            Set<String> keysByNodes = RedisTemplate.keys("blade-manager::contract:wbstree:" + contractId + "*");
+            if (keysByNodes != null) {
+                RedisTemplate.delete(keysByNodes);
+            }
 
-        //删除合同段本地缓存
-        wbsTreeContractClient.deleteContractLocalCache(contractId);
+            //模糊匹配所有以contractId开头的所有资料填报key值
+            Set<String> keysByInformationQuery = RedisTemplate.keys("blade-manager::contract:wbstree:byInformationQuery:" + contractId + "*");
+            if (keysByInformationQuery != null) {
+                RedisTemplate.delete(keysByInformationQuery);
+            }
+
+            //删除合同段本地缓存
+            wbsTreeContractClient.deleteContractLocalCache(contractId);
+        }
     }
 
     @Override

+ 52 - 53
blade-service/blade-manager/src/main/java/org/springblade/manager/controller/ExcelTabController.java

@@ -313,7 +313,7 @@ public class ExcelTabController extends BladeController {
         BladeFile bladeFile = newIOSSClient.uploadFile(file.getOriginalFilename(), exceUrl);
         // 解析原始excel
 
-      //  BladeFile bladeFileR = newIOSSClient.uploadFileByInputStream(file);
+        //  BladeFile bladeFileR = newIOSSClient.uploadFileByInputStream(file);
         detail.setExtension(file.getOriginalFilename());
         detail.setFileUrl(bladeFile.getLink());
         detail.setFileType(3); // 表示为清表信息  1 表示祖节点  2 表示为节点信息 3 表示清表
@@ -1801,7 +1801,7 @@ public class ExcelTabController extends BladeController {
         // 解析 style
         Document doc = Jsoup.parse(htmlString);
         Element table = doc.select("table").first();
-        table.select("table").attr("min-width","-webkit-fill-available");
+        table.select("table").attr("min-width", "-webkit-fill-available");
         doc.select("Col").remove();
         fileInputStream.close();
         return R.data(table + "");
@@ -1960,7 +1960,7 @@ public class ExcelTabController extends BladeController {
         String sql = "select pdf_url,e_visa_pdf_url,pdf_trial_url,pdf_trial_url_position,status from u_information_query where classify='" + classify + "' and wbs_id='" + nodeId + "' and contract_id='" + contractId + "'";
         List<Map<String, Object>> maps = jdbcTemplate.queryForList(sql);
         if (maps == null || maps.size() == 0) {
-            WbsTreeContract contract = wbsTreeContractService.getOne(new LambdaQueryWrapper<WbsTreeContract>().eq(WbsTreeContract::getPKeyId,nodeId));
+            WbsTreeContract contract = wbsTreeContractService.getOne(new LambdaQueryWrapper<WbsTreeContract>().eq(WbsTreeContract::getPKeyId, nodeId));
             String fileName = this.wbsParamService.createFileTitle(contract);
             InformationQuery query = new InformationQuery();
             query.setId(SnowFlakeUtil.getId());
@@ -1972,7 +1972,7 @@ public class ExcelTabController extends BladeController {
             query.setType((contract.getIsExpernode() == null || contract.getIsExpernode() <= 0) ? 1 : 2);
             query.setName(fileName);
             query.setCreateTime(new Date());
-            query.setFileUserIdAndName(AuthUtil.getUserId()+"-"+AuthUtil.getUserName());
+            query.setFileUserIdAndName(AuthUtil.getUserId() + "-" + AuthUtil.getUserName());
             informationQueryClient.saveInfo(query);
         }
         excelTabService.getBussPdfs(nodeId, classify, contractId, projectId);
@@ -2031,11 +2031,11 @@ public class ExcelTabController extends BladeController {
                 return R.fail("暂无PDF数据");
             } else {
                 // 由于独立附件 需要追加最后
-                List<TableFileVO> data = tableFileService.selectTableFileListByTen(Long.valueOf(nodeId+""));
+                List<TableFileVO> data = tableFileService.selectTableFileListByTen(Long.valueOf(nodeId + ""));
                 List<String> datainfo = new ArrayList<>();
                 datainfo.add(pdfUrl);
-                if(data!=null && data.size()>=1){
-                    for(TableFileVO tabsx :data){
+                if (data != null && data.size() >= 1) {
+                    for (TableFileVO tabsx : data) {
                         datainfo.add(tabsx.getUrl());
                     }
                     String listPdf = file_path + "/pdf/" + nodeId + ".pdf";
@@ -2046,7 +2046,7 @@ public class ExcelTabController extends BladeController {
                     FileUtils.mergePdfPublicMethods(datainfo, listPdf);
                     String netUrl = FileUtils.getNetUrl(listPdf);
                     return R.data(netUrl);
-                }else{
+                } else {
                     return R.data(pdfUrl);
                 }
             }
@@ -2106,9 +2106,6 @@ public class ExcelTabController extends BladeController {
     }
 
 
-
-
-
     @PostMapping("/save_buss_data")
     @ApiOperationSupport(order = 13)
     @ApiOperation(value = "填报页面数据保存", notes = "填报页面数据保存")
@@ -2189,7 +2186,7 @@ public class ExcelTabController extends BladeController {
         if (errorPKeyIds.size() > 0) {
             List<AppWbsTreeContractVO> errorTabs = new LinkedList<>();
             for (AppWbsTreeContractVO appWbsTreeContractVO : tableAll) {
-                if (errorPKeyIds.contains(appWbsTreeContractVO.getPKeyId().toString())){
+                if (errorPKeyIds.contains(appWbsTreeContractVO.getPKeyId().toString())) {
                     errorTabs.add(appWbsTreeContractVO);
                 }
             }
@@ -2411,8 +2408,8 @@ public class ExcelTabController extends BladeController {
                                                 sheet.getCellRange(y1, x1).getStyle().setShrinkToFit(true);
 
                                             } else if (data.html().indexOf("hc-form-checkbox-group") >= 0) {
-                                                 CellRange cellRange = sheet.getCellRange(y1, x1);
-                                                 String exceVal = cellRange.getValue().replaceAll(" ", "");
+                                                CellRange cellRange = sheet.getCellRange(y1, x1);
+                                                String exceVal = cellRange.getValue().replaceAll(" ", "");
                                                 //如果有□ 代表 自动生成  如果没有 代表后期添加 需要显示html 中的值
                                                 if (exceVal.indexOf("□") >= 0) {
                                                     if (myData.equals("1")) {
@@ -2420,7 +2417,7 @@ public class ExcelTabController extends BladeController {
                                                     }
                                                 } else {
                                                     List<Node> nodes = data.childNodes();
-                                                    Node node = nodes.get(nodes.size() -1);
+                                                    Node node = nodes.get(nodes.size() - 1);
                                                     String dataJson = node.attr(":objs");
                                                     if (StringUtils.isNotEmpty(dataJson)) {
                                                         JSONArray jsonArray = JSONArray.parseArray(dataJson);
@@ -3800,47 +3797,48 @@ public class ExcelTabController extends BladeController {
     @PostMapping("/save_sigpdfInfo12313213")
     @ApiOperationSupport(order = 72)
     @ApiOperation(value = "pdf", notes = "pdf")
-    public void synPDFInfo(@RequestParam String contractid,@RequestParam String typeinfo){
-        String sqlInfo = "SELECT DISTINCT wbs_id,classify,contract_id,project_id,type from u_information_query where contract_id='"+contractid+"' and is_deleted=0 and type=1 and  classify='"+typeinfo+"' and wbs_id in(SELECT p_key_id from m_wbs_tree_contract where is_deleted=0 and contract_id='"+contractid+"')";
+    public void synPDFInfo(@RequestParam String contractid, @RequestParam String typeinfo) {
+        String sqlInfo = "SELECT DISTINCT wbs_id,classify,contract_id,project_id,type from u_information_query where contract_id='" + contractid + "' and is_deleted=0 and type=1 and  classify='" + typeinfo + "' and wbs_id in(SELECT p_key_id from m_wbs_tree_contract where is_deleted=0 and contract_id='" + contractid + "')";
         List<Map<String, Object>> maps = jdbcTemplate.queryForList(sqlInfo);
         System.out.println(maps.size());
 
-            int i=0;
-            if(maps!=null && maps.size()>=1){
-                for(Map<String, Object> dataMap:maps){
-                    String nodeId = dataMap.get("wbs_id")+"";
-                    String classify = dataMap.get("classify")+"";
-                    String contractId = dataMap.get("contract_id")+"";
-                    String projectId = dataMap.get("project_id")+"";
-                    List<AppWbsTreeContractVO> tableAll = wbsTreeContractService.searchNodeAllTable(nodeId, classify, contractId, projectId);
-                    if(tableAll!=null && tableAll.size()>=1){
-                        for(AppWbsTreeContractVO tab:tableAll){
-                            try {
-                                 excelTabService.getBussPdfInfo(Long.parseLong(tab.getPKeyId()+""));
-                            }catch (Exception e){
-                                e.printStackTrace();
-                            }finally {
-                                continue;
-                            }
+        int i = 0;
+        if (maps != null && maps.size() >= 1) {
+            for (Map<String, Object> dataMap : maps) {
+                String nodeId = dataMap.get("wbs_id") + "";
+                String classify = dataMap.get("classify") + "";
+                String contractId = dataMap.get("contract_id") + "";
+                String projectId = dataMap.get("project_id") + "";
+                List<AppWbsTreeContractVO> tableAll = wbsTreeContractService.searchNodeAllTable(nodeId, classify, contractId, projectId);
+                if (tableAll != null && tableAll.size() >= 1) {
+                    for (AppWbsTreeContractVO tab : tableAll) {
+                        try {
+                            excelTabService.getBussPdfInfo(Long.parseLong(tab.getPKeyId() + ""));
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        } finally {
+                            continue;
                         }
                     }
-                    i=i+1;
-                    System.out.println("完成1---="+i);
-                    try {
-                        excelTabService.getBussPdfs(nodeId, classify, contractId, projectId);
-                    } catch (Exception e) {
-                        continue;
-                    }finally {
-                        continue;
-                    }
+                }
+                i = i + 1;
+                System.out.println("完成1---=" + i);
+                try {
+                    excelTabService.getBussPdfs(nodeId, classify, contractId, projectId);
+                } catch (Exception e) {
+                    continue;
+                } finally {
+                    continue;
                 }
             }
+        }
 
     }
 
 
     /**
      * 用户保存新接口
+     *
      * @param dataInfo
      * @return
      * @throws Exception
@@ -3856,13 +3854,14 @@ public class ExcelTabController extends BladeController {
         } else { //单个保存
             dataArray.add(dataInfo);
         }
-        this.excelTabService.formulaFillData2(dataArray,ExecuteType.INSPECTION);
+        this.excelTabService.formulaFillData2(dataArray, ExecuteType.INSPECTION);
         return excelTabService.saveBussData(dataArray);
     }
 
 
     /**
      * 质检附件追加
+     *
      * @return ObjectStat
      */
     @SneakyThrows
@@ -3876,8 +3875,8 @@ public class ExcelTabController extends BladeController {
     })
     public R addBussFile(@RequestParam("file") MultipartFile[] file, String nodeId) {
         List<TableFile> fileList = new ArrayList<>();
-        if(file!=null && file.length>=1){
-            for (MultipartFile multipartFile:file){
+        if (file != null && file.length >= 1) {
+            for (MultipartFile multipartFile : file) {
                 R<BladeFile> bladeFile = iossClient.addFileInfo(multipartFile);
                 BladeFile bladeFile1 = bladeFile.getData();
 
@@ -3894,7 +3893,7 @@ public class ExcelTabController extends BladeController {
             }
             tableFileService.saveOrUpdateBatch(fileList);
             return R.data("操作成功");
-        }else{
+        } else {
             return R.data("请上传pdf");
         }
 
@@ -3910,21 +3909,21 @@ public class ExcelTabController extends BladeController {
             @ApiImplicitParam(name = "classify", value = "classify", required = true),
             @ApiImplicitParam(name = "projectId", value = "projectId", required = true)
     })
-    public R synPDFInfo(String contractId,String nodeIds, String classify, String projectId) {
+    public R synPDFInfo(String contractId, String nodeIds, String classify, String projectId) {
 
-        if( contractId==null && StringUtils.isEmpty(contractId)){
+        if (contractId == null && StringUtils.isEmpty(contractId)) {
             return R.data("contractId不能为空");
         }
 
-        if(nodeIds==null && StringUtils.isEmpty(nodeIds)){
+        if (nodeIds == null && StringUtils.isEmpty(nodeIds)) {
             return R.data("nodeId不能为空");
         }
 
-        if(classify==null && StringUtils.isEmpty(classify)){
+        if (classify == null && StringUtils.isEmpty(classify)) {
             return R.data("classify不能为空");
         }
 
-        if(projectId==null && StringUtils.isEmpty(projectId)){
+        if (projectId == null && StringUtils.isEmpty(projectId)) {
             return R.data("projectId不能为空");
         }
 
@@ -3962,7 +3961,7 @@ public class ExcelTabController extends BladeController {
                 js.put("dataInfo", js2);
                 this.saveBussData2(js);
             }
-        }catch (Exception e){
+        } catch (Exception e) {
             return null;
         }
         return R.data("成功");

+ 47 - 42
blade-service/blade-manager/src/main/java/org/springblade/manager/service/impl/WbsTreeContractServiceImpl.java

@@ -14,6 +14,8 @@ import org.jsoup.Jsoup;
 import org.jsoup.nodes.Document;
 import org.jsoup.nodes.Element;
 import org.jsoup.select.Elements;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.springblade.business.entity.ConstructionLedger;
 import org.springblade.business.feign.ConstructionLedgerFeignClient;
 import org.springblade.business.feign.InformationQueryClient;
@@ -65,6 +67,7 @@ import java.util.stream.Stream;
 @AllArgsConstructor
 public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractMapper, WbsTreeContract> implements IWbsTreeContractService {
 
+    private static final Logger logger = LoggerFactory.getLogger(WbsTreeContractServiceImpl.class);
     private final ConstructionLedgerFeignClient constructionLedgerFeign;
     private final WbsTreePrivateMapper wbsTreePrivateMapper;
     private final ContractInfoMapper contractInfoMapper;
@@ -701,20 +704,11 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
 
                             long startTime1 = System.currentTimeMillis();
 
-                            /*开启mybatis-plus二级缓存*/
-                            /*List<WbsTreeContract> wbsTreeContracts = baseMapper.selectList(Wrappers.<WbsTreeContract>lambdaQuery()
-                                    .select(WbsTreeContract::getId, WbsTreeContract::getPKeyId, WbsTreeContract::getParentId)
-                                    .eq(WbsTreeContract::getType, 1)
-                                    .eq(WbsTreeContract::getStatus, 1)
-                                    .eq(WbsTreeContract::getContractId, contractId)
-                            );
-                            nodesAll = BeanUtil.copyProperties(wbsTreeContracts, WbsTreeContractLazyVO.class);*/
-
                             nodesAll = jdbcTemplate.query("select a.p_key_id,a.id,a.parent_id from m_wbs_tree_contract a where a.type = 1 and a.status = 1 and a.is_deleted = 0 and a.contract_id = " + contractId, new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
 
                             long endTime1 = System.currentTimeMillis();
                             long executionTime1 = endTime1 - startTime1;
-                            System.out.println("baseMapper.selectList(contractId)执行时间:" + executionTime1 + " ms");
+                            logger.info("查询合同段" + contractId + "所有树执行时间:" + executionTime1 + " ms");
 
                             if (nodesAll.size() > 0) {
                                 //判断是否有子级,赋值
@@ -797,7 +791,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
 
                         long endTime2 = System.currentTimeMillis();
                         long executionTime2 = endTime2 - startTime2;
-                        System.out.println("recursiveGetParentNodes执行时间:" + executionTime2 + " ms");
+                        logger.info("recursiveGetParentNodes 处理数量 执行时间:" + executionTime2 + " ms");
 
                         //最底层节点颜色构造后Map
                         Map<Long, WbsTreeContractLazyVO> lowestNodesMap = lowestNodesTB.stream()
@@ -814,6 +808,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                                 }).collect(Collectors.toMap(WbsTreeContractLazyVO::getPKeyId, Function.identity()));
 
                         long startTime3 = System.currentTimeMillis();
+
                         //TODO 处理颜色
                         //先将WbsTreeContractLazyVO转为NodeVO
                         List<NodeVO> nodeVOList = distinctNodesAll.stream().map(this::convertToNodeVO).collect(Collectors.toList());
@@ -830,7 +825,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
 
                         long endTime3 = System.currentTimeMillis();
                         long executionTime3 = endTime3 - startTime3;
-                        System.out.println("处理颜色执行时间:" + executionTime3 + " ms");
+                        logger.info("处理颜色执行时间:" + executionTime3 + " ms");
 
                         //TODO 处理最终结果集
                         if (lazyNodes.size() > 0) {
@@ -891,41 +886,51 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                     for (String sgContractId : contractIds) {
                         ContractInfo sgContractInfo = jdbcTemplate.query("select contract_name from m_contract_info where id = " + sgContractId, new BeanPropertyRowMapper<>(ContractInfo.class)).stream().findAny().orElse(null);
                         if (sgContractInfo != null) {
-                            //获取当前合同段所有缓存节点信息
-                            List<WbsTreeContractLazyVO> nodesAll;
-                            /*Object data = redisTemplate.opsForValue().get("blade-manager::contract:wbstree:" + sgContractId);
-                            if (data != null) {
-                                nodesAll = JSON.parseArray(data.toString(), WbsTreeContractLazyVO.class);
-                            } else {*/
+                            /*获取本地缓存*/
+                            List<WbsTreeContractLazyVO> nodesAll = localCacheNodes.get(sgContractId);
 
-                            List<WbsTreeContract> wbsTreeContracts = baseMapper.selectList(Wrappers.<WbsTreeContract>lambdaQuery()
-                                    .select(WbsTreeContract::getId, WbsTreeContract::getPKeyId, WbsTreeContract::getParentId)
-                                    .eq(WbsTreeContract::getType, 1)
-                                    .eq(WbsTreeContract::getStatus, 1)
-                                    .eq(WbsTreeContract::getContractId, sgContractId)
-                            );
-                            nodesAll = BeanUtil.copyProperties(wbsTreeContracts, WbsTreeContractLazyVO.class);
+                            if (nodesAll == null || nodesAll.size() == 0) {
 
-                            //nodesAll = jdbcTemplate.query("select a.p_key_id,a.id,a.parent_id from m_wbs_tree_contract a where a.type = 1 and a.status = 1 and a.is_deleted = 0 and a.contract_id = " + sgContractId, new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
-                            if (nodesAll.size() > 0) {
-                                //判断是否有子级,赋值
-                                Map<Long, List<WbsTreeContractLazyVO>> groupedByParentId = nodesAll.stream().collect(Collectors.groupingBy(WbsTreeContractLazyVO::getParentId));
-                                for (WbsTreeContractLazyVO vo : nodesAll) {
-                                    if (vo.getParentId() == 0) {
-                                        vo.setHasChildren(1);
-                                    }
-                                    List<WbsTreeContractLazyVO> childNodes = groupedByParentId.getOrDefault(vo.getId(), null);
-                                    if (childNodes != null && childNodes.size() > 0) {
-                                        vo.setHasChildren(1);
-                                    } else {
-                                        vo.setHasChildren(0);
+                                //获取当前合同段所有缓存节点信息
+                                Object data = redisTemplate.opsForValue().get("blade-manager::contract:wbstree:" + sgContractId);
+                                if (data != null) {
+                                    //从Redis获取数据
+                                    nodesAll = JSON.parseArray(data.toString(), WbsTreeContractLazyVO.class);
+                                    /*更新本地缓存*/
+                                    localCacheNodes.put(sgContractId, nodesAll);
+
+                                } else {
+
+                                    long startTime1 = System.currentTimeMillis();
+
+                                    nodesAll = jdbcTemplate.query("select a.p_key_id,a.id,a.parent_id from m_wbs_tree_contract a where a.type = 1 and a.status = 1 and a.is_deleted = 0 and a.contract_id = " + sgContractId, new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));
+
+                                    long endTime1 = System.currentTimeMillis();
+                                    long executionTime1 = endTime1 - startTime1;
+                                    System.out.println("baseMapper.selectList(contractId)执行时间:" + executionTime1 + " ms");
+
+                                    if (nodesAll.size() > 0) {
+                                        //判断是否有子级,赋值
+                                        Map<Long, List<WbsTreeContractLazyVO>> groupedByParentId = nodesAll.stream().collect(Collectors.groupingBy(WbsTreeContractLazyVO::getParentId));
+                                        for (WbsTreeContractLazyVO vo : nodesAll) {
+                                            if (vo.getParentId() == 0) {
+                                                vo.setHasChildren(1);
+                                            }
+                                            List<WbsTreeContractLazyVO> childNodes = groupedByParentId.getOrDefault(vo.getId(), null);
+                                            if (childNodes != null && childNodes.size() > 0) {
+                                                vo.setHasChildren(1);
+                                            } else {
+                                                vo.setHasChildren(0);
+                                            }
+                                        }
+                                        /*更新本地缓存*/
+                                        localCacheNodes.put(sgContractId, nodesAll);
+
+                                        JSONArray array = JSONArray.parseArray(JSON.toJSONString(nodesAll));
+                                        redisTemplate.opsForValue().set("blade-manager::contract:wbstree:" + sgContractId, JSON.toJSON(array).toString());
                                     }
                                 }
-
-                                /*JSONArray array = JSONArray.parseArray(JSON.toJSONString(nodesAll));
-                                redisTemplate.opsForValue().set("blade-manager::contract:wbstree:" + sgContractId, JSON.toJSON(array).toString());*/
                             }
-                            //}
 
                             //获取当前层懒加载节点
                             List<WbsTreeContractLazyVO> lazyNodes = jdbcTemplate.query("select p_key_id,contract_id,(SELECT id FROM u_contract_tree_drawings where process_id = p_key_id) AS drawingsId,id,parent_id,node_type,type,wbs_type,major_data_type,partition_code,old_id,contract_id_relation,is_concealed_works_node,CASE (SELECT count(1) FROM u_tree_contract_first AS tcf WHERE tcf.is_deleted = 0 AND tcf.wbs_node_id = a.p_key_id) WHEN 0 THEN 'false' ELSE 'true' END AS isFirst,IFNULL(if(length(trim(full_name))>0,full_name,node_name),node_name) AS title,(SELECT CASE WHEN count(1) > 0 THEN 1 ELSE 0 END FROM m_wbs_tree_contract b WHERE b.parent_id = a.id AND  b.type = 1 and b.status = 1 AND b.contract_id = " + sgContractId + " AND b.is_deleted = 0 ) AS hasChildren from m_wbs_tree_contract a where a.node_type != 111 and a.type = 1 and a.status = 1 and a.is_deleted = 0 and parent_id = " + (StringUtils.isNotEmpty(id) ? id : 0) + " and contract_id = " + sgContractId + " ORDER BY a.sort,title,a.create_time", new BeanPropertyRowMapper<>(WbsTreeContractLazyVO.class));