Parcourir la source

资料查询节点与page数据排序问题

liuyc il y a 2 ans
Parent
commit
e66c6b90d7

+ 5 - 88
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -8,6 +8,9 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.google.common.cache.Cache;
+import com.google.common.cache.CacheBuilder;
 import com.google.common.collect.Lists;
 import io.swagger.annotations.*;
 import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
@@ -61,6 +64,7 @@ import java.io.IOException;
 import java.util.*;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
 import java.util.function.Function;
 import java.util.stream.Collectors;
 
@@ -2038,35 +2042,6 @@ public class InformationWriteQueryController extends BladeController {
         }
     }
 
-    /**
-     * 获取所有子级节点-资料查询
-     */
-    private List<WbsTreeContract> getChildNodesZL(WbsTreeContract obj) {
-        if (obj != null) {
-            List<WbsTreeContract> wbsTreeContracts = Collections.singletonList(obj);
-            List<WbsTreeContract> result = new ArrayList<>();
-            this.recursionGetChildNodesZL(wbsTreeContracts, result, obj.getContractId());
-            if (result.size() > 0) {
-                return result;
-            }
-        }
-        return null;
-    }
-
-    /**
-     * 递归获取所有子级节点-资料查询
-     */
-    private void recursionGetChildNodesZL(List<WbsTreeContract> list, List<WbsTreeContract> result, String contractId) {
-        List<Long> ids = list.stream().map(WbsTreeContract::getId).collect(Collectors.toList());
-        if (ids.size() > 0) {
-            List<WbsTreeContract> query = jdbcTemplate.query("select full_name,id,p_key_id,parent_id,sort from m_wbs_tree_contract where type = 1 and parent_id in(" + StringUtils.join(ids, ",") + ") and status = 1 and is_deleted = 0 and contract_id = " + contractId, new BeanPropertyRowMapper<>(WbsTreeContract.class));
-            if (query.size() > 0) {
-                result.addAll(query);
-                recursionGetChildNodesZL(query, result, contractId);
-            }
-        }
-    }
-
     /**
      * 获取所有子级下的表
      */
@@ -3124,65 +3099,7 @@ public class InformationWriteQueryController extends BladeController {
             vo.setContractId(Long.valueOf(vo.getContractIdRelation()));
         }
 
-        IPage<InformationQueryVO> resultPageData = this.informationQueryService.selectInformationQueryPage(Condition.getPage(query), vo);
-
-        //TODO 处理资料查询,page数据与节点顺序同步问题
-        //获取选择的节点下的所有子节点信息
-        /*WbsTreeContract oldSelectedNode = BeanUtil.copyProperties(node, WbsTreeContract.class);
-        List<WbsTreeContract> treeAll = this.getChildNodesZL(oldSelectedNode);
-        if (treeAll == null) {
-            treeAll = new ArrayList<>();
-        }
-        treeAll.add(oldSelectedNode);
-
-        if (treeAll.size() == 1) { //最底层节点,直接返回
-            return R.data(resultPageData);
-        } else {
-            List<InformationQueryVO> resultData = new ArrayList<>();
-            if (oldSelectedNode != null) {
-                List<WbsTreeContract> resultNodes = this.reOrderNode(treeAll, oldSelectedNode);
-                Map<Long, InformationQueryVO> dataMaps = resultPageData.getRecords().stream().collect(Collectors.toMap(InformationQueryVO::getWbsId, Function.identity()));
-                for (WbsTreeContract resultNode : resultNodes) {
-                    InformationQueryVO queryVO = dataMaps.get(resultNode.getPKeyId());
-                    if (queryVO != null) {
-                        resultData.add(queryVO);
-                    }
-                }
-            }
-            if (resultData.size() > 0) {
-                return R.data(resultPageData.setRecords(resultData));
-            } else {*/
-        return R.data(resultPageData);
-        //}
-        //}
-    }
-
-    /**
-     * 节点重新排序
-     */
-    private List<WbsTreeContract> reOrderNode(List<WbsTreeContract> inList, WbsTreeContract oldSelectedNode) {
-        Map<Long, List<WbsTreeContract>> parentGroup = inList.stream().collect(Collectors.groupingBy(WbsTreeContract::getParentId));
-        Long parentId = oldSelectedNode.getId();
-        return getSubNodes(parentId, parentGroup);
-    }
-
-    private List<WbsTreeContract> getSubNodes(Long parentId, Map<Long, List<WbsTreeContract>> parentGroup) {
-        List<WbsTreeContract> subNodes = new ArrayList<>();
-        if (parentGroup.containsKey(parentId)) {
-            List<WbsTreeContract> children = parentGroup.get(parentId);
-            for (WbsTreeContract child : children) {
-                List<WbsTreeContract> grandChildren = this.getSubNodes(child.getId(), parentGroup);
-                subNodes.addAll(grandChildren);
-            }
-            subNodes.addAll(children);
-        }
-        subNodes.sort(
-                Comparator.comparingInt((WbsTreeContract node) -> node.getSort() == null ? Integer.MAX_VALUE : node.getSort())
-                        .thenComparing(Comparator.nullsLast(Comparator.comparing(WbsTreeContract::getFullName)))
-                        .thenComparingLong(node -> node.getPKeyId() == null ? Long.MAX_VALUE : node.getPKeyId())
-                        .thenComparing(Comparator.nullsLast(Comparator.comparing(WbsTreeContract::getUpdateTime)))
-        );
-        return subNodes;
+        return R.data(this.informationQueryService.selectInformationQueryPage(Condition.getPage(query), vo,node));
     }
 
     /**

+ 80 - 72
blade-service/blade-business/src/main/java/org/springblade/business/mapper/InformationQueryMapper.java

@@ -20,6 +20,7 @@ import org.springblade.business.entity.InformationQuery;
 import org.springblade.business.vo.InformationQueryVO;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
+
 import java.util.List;
 import java.util.Map;
 
@@ -29,90 +30,97 @@ import org.springblade.manager.entity.WbsTreeContract;
 import org.springblade.manager.vo.WbsTreeContractTreeVOS;
 
 /**
- *  Mapper 接口
+ * Mapper 接口
  *
  * @author BladeX
  * @since 2022-06-08
  */
 public interface InformationQueryMapper extends BaseMapper<InformationQuery> {
 
-	List<WbsTreeContractTreeVOS> queryContractTreeSupervision(@Param("contractIds") List<String> contractIds, @Param("parentId") String parentId, @Param("classify") Integer classify);
-
-	List<WbsTreeContractTreeVOS> queryContractTree(@Param("contractId") String contractId, @Param("parentId") String parentId, @Param("classify") Integer classify);
-
-	List<QueryProcessDataVO> queryProcessDataByPrimaryKeyIdAndClassify(@Param("primaryKeyId") String primaryKeyId, @Param("classify") Integer classify);
-
-	/**
-	 * 查询工序节点的填报记录
-	 */
-	List<QueryProcessDataVO> queryProcessDataByParentIdAndContractId(@Param("parentId") String parentId, @Param("classify") Integer classify, @Param("contractId") String contractId);
-	/**
-	 * 查询工序节点的填报记录
-	 */
-	List<QueryProcessDataVO> queryProcessDataByParentIdAndContractIdTwo(@Param("parentId") String parentId, @Param("classify") Integer classify, @Param("contractId") String contractId);
-	/**
-	 * 查询工序节点的填报记录,资料进度使用
-	 */
-	List<QueryProcessDataVO> queryProcessDataByParentIdAndContractIdThree(@Param("parentId") String parentId, @Param("classify") Integer classify, @Param("contractId") String contractId);
-
-	/**
-	 * 根据节点ID及其填报的类型获取填报记录
-	 * @param wbsId 节点ID
-	 * @param classify 1施工2质检
-	 * @return 结果对象
-	 */
-	InformationQuery getInformationQueryByWbsId(@Param("wbsId") Long wbsId, @Param("classify") Integer classify);
-
-	/**
-	 * 获取当前合同段下所有的上报批次
-	 * @param classify 合同段类型
-	 * @param contractId 合同段ID
-	 * @return 填报人集合
-	 */
-	List<Integer> getReportNumberByContractId(@Param("classify") Integer classify, @Param("contractId") String contractId);
-
-	/**
-	 * 查询填报人集合
-	 * @param classify 合同段类型
-	 * @param contractId 合同段ID
-	 * @return 填报人集合
-	 */
-	List<InformationQuery> queryFileUserByContractId(@Param("classify") Integer classify, @Param("contractId") String contractId);
-
-	/**
-	 * 统计
-	 */
-	Integer countInformationQuery(@Param("query") InformationQueryVO informationQuery);
-	/**
-	 * 统计
-	 */
-	Integer countInformationQueryTwo(@Param("query") InformationQueryVO informationQuery);
-
-	/**
-	 * 自定义分页
-	 */
-	List<InformationQuery> selectInformationQueryPage(@Param("current") Long current, @Param("size") Long size, @Param("query") InformationQueryVO informationQuery);
-	/**
-	 * 自定义分页,因为information的批次字段数据不全
-	 */
-	List<InformationQuery> selectInformationQueryPageTwo(@Param("current") Long current, @Param("size") Long size, @Param("query") InformationQueryVO informationQuery);
-
-	List<WbsTreeContract> getContractNodeByPrimaryKeyIds(String ids);
+    List<WbsTreeContractTreeVOS> queryContractTreeSupervision(@Param("contractIds") List<String> contractIds, @Param("parentId") String parentId, @Param("classify") Integer classify);
+
+    List<WbsTreeContractTreeVOS> queryContractTree(@Param("contractId") String contractId, @Param("parentId") String parentId, @Param("classify") Integer classify);
+
+    List<QueryProcessDataVO> queryProcessDataByPrimaryKeyIdAndClassify(@Param("primaryKeyId") String primaryKeyId, @Param("classify") Integer classify);
+
+    /**
+     * 查询工序节点的填报记录
+     */
+    List<QueryProcessDataVO> queryProcessDataByParentIdAndContractId(@Param("parentId") String parentId, @Param("classify") Integer classify, @Param("contractId") String contractId);
+
+    /**
+     * 查询工序节点的填报记录
+     */
+    List<QueryProcessDataVO> queryProcessDataByParentIdAndContractIdTwo(@Param("parentId") String parentId, @Param("classify") Integer classify, @Param("contractId") String contractId);
+
+    /**
+     * 查询工序节点的填报记录,资料进度使用
+     */
+    List<QueryProcessDataVO> queryProcessDataByParentIdAndContractIdThree(@Param("parentId") String parentId, @Param("classify") Integer classify, @Param("contractId") String contractId);
+
+    /**
+     * 根据节点ID及其填报的类型获取填报记录
+     *
+     * @param wbsId    节点ID
+     * @param classify 1施工2质检
+     * @return 结果对象
+     */
+    InformationQuery getInformationQueryByWbsId(@Param("wbsId") Long wbsId, @Param("classify") Integer classify);
+
+    /**
+     * 获取当前合同段下所有的上报批次
+     *
+     * @param classify   合同段类型
+     * @param contractId 合同段ID
+     * @return 填报人集合
+     */
+    List<Integer> getReportNumberByContractId(@Param("classify") Integer classify, @Param("contractId") String contractId);
+
+    /**
+     * 查询填报人集合
+     *
+     * @param classify   合同段类型
+     * @param contractId 合同段ID
+     * @return 填报人集合
+     */
+    List<InformationQuery> queryFileUserByContractId(@Param("classify") Integer classify, @Param("contractId") String contractId);
+
+    /**
+     * 统计
+     */
+    Integer countInformationQuery(@Param("query") InformationQueryVO informationQuery);
+
+    /**
+     * 统计
+     */
+    Integer countInformationQueryTwo(@Param("query") InformationQueryVO informationQuery);
+
+    /**
+     * 自定义分页
+     */
+    List<InformationQuery> selectInformationQueryPage(@Param("current") Long current, @Param("size") Long size, @Param("query") InformationQueryVO informationQuery);
+
+    /**
+     * 自定义分页,因为information的批次字段数据不全
+     */
+    List<InformationQuery> selectInformationQueryPageTwo(@Param("query") InformationQueryVO informationQuery);
+
+    List<WbsTreeContract> getContractNodeByPrimaryKeyIds(String ids);
 
     List<WbsTreeContract> getContractWbsTreeAll(@Param("obj") WbsTreeContract wbsTreeContract);
 
-    void updateBatchByPKeyId(@Param("list")List<WbsTreeContract> result);
+    void updateBatchByPKeyId(@Param("list") List<WbsTreeContract> result);
 
-	// 节点复制数据
-	boolean copeNodeData(String nodeId, String vocationalId);
+    // 节点复制数据
+    boolean copeNodeData(String nodeId, String vocationalId);
 
-	// 获取当前节点的子节点及自己
-	List<WbsTreeContract> getNodeChildAllByNodeId(String nodeId,String contractId,String pKeyId);
+    // 获取当前节点的子节点及自己
+    List<WbsTreeContract> getNodeChildAllByNodeId(String nodeId, String contractId, String pKeyId);
 
-	// 获取当前节点下,所有表单的字段数据
-	List<QueryProcessDataVO> getNodeChildTabColsAllByNodeId(String nodeId, String contractId);
+    // 获取当前节点下,所有表单的字段数据
+    List<QueryProcessDataVO> getNodeChildTabColsAllByNodeId(String nodeId, String contractId);
 
-	// 获取当前节点下,所有表单的字段数据,根据表名
-	List<QueryProcessDataVO> getNodeChildTabColsAllByTabName(String tabName);
+    // 获取当前节点下,所有表单的字段数据,根据表名
+    List<QueryProcessDataVO> getNodeChildTabColsAllByTabName(String tabName);
 
 }

+ 2 - 3
blade-service/blade-business/src/main/java/org/springblade/business/mapper/InformationQueryMapper.xml

@@ -731,7 +731,6 @@
             and query.createTimes between #{query.startTime} and #{query.endTime}
         </if>
         order by create_time desc
-        limit #{current}, #{size}
     </select>
 
     <select id="getContractNodeByPrimaryKeyIds" resultType="org.springblade.manager.entity.WbsTreeContract">
@@ -768,12 +767,12 @@
                    ELSE 'true' end                                                                      AS isExperiment
         FROM m_wbs_tree_contract AS wtc
                  LEFT JOIN u_information_query AS uiq
-                           ON wtc.p_key_id = uiq.wbs_id AND uiq.classify = #{classify} and uiq.is_deleted = 0
+                           ON wtc.p_key_id = uiq.wbs_id AND uiq.classify = #{classify} and uiq.is_deleted = 0 and wtc.is_deleted = 0 and wtc.status = 1
         WHERE wtc.type = 1
           AND wtc.major_data_type in (0, 1, 2, 3, 4)
           AND wtc.ancestors like concat('%', #{parentId}, '%')
           AND wtc.contract_id = #{contractId}
-          AND wtc.is_deleted = 0
+          AND wtc.is_deleted = 0 AND wtc.status = 1
     </select>
 
     <select id="queryProcessDataByParentIdAndContractIdThree" resultMap="queryProcessDataMap">

+ 1 - 1
blade-service/blade-business/src/main/java/org/springblade/business/service/IInformationQueryService.java

@@ -107,7 +107,7 @@ public interface IInformationQueryService extends BaseService<InformationQuery>
     /**
      * 自定义分页
      */
-    IPage<InformationQueryVO> selectInformationQueryPage(IPage<InformationQueryVO> page, InformationQueryVO vo);
+    IPage<InformationQueryVO> selectInformationQueryPage(IPage<InformationQueryVO> page, InformationQueryVO vo,WbsTreeContract node);
 
 
     List<WbsTreeContract> getContractWbsTreeAll(WbsTreeContract wbsTreeContract);

+ 122 - 13
blade-service/blade-business/src/main/java/org/springblade/business/service/impl/InformationQueryServiceImpl.java

@@ -22,13 +22,12 @@ import org.springblade.common.constant.LauncherConstant;
 import org.springblade.common.utils.SnowFlakeUtil;
 import org.springblade.core.cache.utils.CacheUtil;
 import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springblade.core.mp.support.Condition;
 import org.springblade.core.oss.model.BladeFile;
 import org.springblade.core.secure.BladeUser;
 import org.springblade.core.secure.utils.AuthUtil;
 import org.springblade.core.tool.api.R;
-import org.springblade.core.tool.utils.DateUtil;
-import org.springblade.core.tool.utils.Func;
-import org.springblade.core.tool.utils.ResourceUtil;
+import org.springblade.core.tool.utils.*;
 import org.springblade.manager.entity.ContractInfo;
 import org.springblade.manager.entity.WbsTreeContract;
 import org.springblade.manager.feign.ContractClient;
@@ -49,6 +48,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.util.*;
+import java.util.function.Function;
 import java.util.stream.Collectors;
 
 /**
@@ -477,9 +477,7 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
     }
 
     @Override
-    public IPage<InformationQueryVO> selectInformationQueryPage(IPage<InformationQueryVO> page, InformationQueryVO vo) {
-        long current = (page.getCurrent() - 1L) * page.getSize();
-
+    public IPage<InformationQueryVO> selectInformationQueryPage(IPage<InformationQueryVO> page, InformationQueryVO vo, WbsTreeContract node) {
         if (StringUtils.isNotEmpty(vo.getBetweenTime())) {
             String[] betweenTime;
             if (vo.getBetweenTime().contains("~")) {
@@ -501,10 +499,10 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
         }
 
         //获取总量
-        Integer count = this.baseMapper.countInformationQueryTwo(vo);
+        //Integer count = this.baseMapper.countInformationQueryTwo(vo);
 
-        //获取数据
-        List<InformationQuery> result = this.baseMapper.selectInformationQueryPageTwo(current, page.getSize(), vo);
+        //获取全部数据(后面单独分页)
+        List<InformationQuery> result = this.baseMapper.selectInformationQueryPageTwo(vo);
 
         //转换VO
         if (result != null && result.size() != 0) {
@@ -564,15 +562,126 @@ public class InformationQueryServiceImpl extends BaseServiceImpl<InformationQuer
                 }
 
             });
-            page.setRecords(voResult);
-            page.setTotal(count);
 
-            return page;
-        }
+            if (ObjectUtil.isEmpty(voResult)) {
+                return page.setRecords(null);
+
+            } else if (voResult.size() == 1) {
+                //最底层节点,直接返回
+                page.setRecords(voResult);
+                page.setTotal(voResult.size());
+                return page;
+
+            } else if (voResult.size() > 1) {
+                /**
+                 * @Author liuYC
+                 * @Date 2023年5月5日11:53:57
+                 * @Description
+                 *   处理资料查询,page资料填报数据与节点顺序同步展示问题,查询出当前选择节点下所有资料填报信息,
+                 *   然后匹配节点位置信息,不分页查询page数据,分页查询会导致数据匹配异常,处理完匹配后,再分页返回。
+                 */
+                //获取选择的节点下的所有子节点信息
+                WbsTreeContract oldSelectedNode = BeanUtil.copyProperties(node, WbsTreeContract.class);
+                List<WbsTreeContract> treeAll = this.getChildNodesZL(oldSelectedNode);
+                if (treeAll == null) {
+                    treeAll = new ArrayList<>();
+                }
+                treeAll.add(0, oldSelectedNode); //添加当前选择的节点为根节点
+
+                if (treeAll.size() > 1) {
+                    LinkedList<InformationQueryVO> resultData = new LinkedList<>();
+                    //将当前页数据中符合条件的记录都添加到结果列表中
+                    LinkedHashMap<Long, InformationQueryVO> dataMaps = voResult.stream()
+                            .collect(Collectors.toMap(InformationQueryVO::getWbsId, Function.identity(),
+                                    (oldValue, newValue) -> oldValue, LinkedHashMap::new));
+                    for (WbsTreeContract resultNode : treeAll) {
+                        InformationQueryVO queryVO = dataMaps.get(resultNode.getPKeyId());
+                        if (queryVO != null) {
+                            //按节点顺序插入
+                            resultData.add(queryVO);
+                        }
+                    }
+                    if (resultData.size() > 0) {
+                        long current = (page.getCurrent() - 1) * page.getSize();
+                        if (current < 0) {
+                            throw new IllegalArgumentException("当前页码不能小于0");
+                        }
+                        //分页
+                        int currentNow = (int) (current / page.getSize() + 1); //当前页码
+                        int pageSize = (int) page.getSize(); //每页大小
+                        //计算起始位置和结束位置
+                        int fromIndex = (currentNow - 1) * pageSize;
+                        int toIndex = Math.min(currentNow * pageSize, resultData.size());
+                        List<InformationQueryVO> subList = resultData.subList(fromIndex, toIndex);
+                        page.setRecords(subList);
+                        page.setTotal(resultData.size());
+                        return page;
 
+                    } else {
+                        return page.setRecords(null);
+                    }
+                }
+            }
+        }
         return page.setRecords(null);
     }
 
+    /**
+     * 获取所有子级节点-资料查询
+     */
+    private List<WbsTreeContract> getChildNodesZL(WbsTreeContract obj) {
+        if (obj != null) {
+            List<WbsTreeContract> wbsTreeContracts = Collections.singletonList(obj);
+            List<WbsTreeContract> result = new ArrayList<>();
+            this.recursionGetChildNodesZL(wbsTreeContracts, result, obj.getContractId());
+            if (result.size() > 0) {
+                return result;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * 递归获取所有子级节点-资料查询
+     */
+    private void recursionGetChildNodesZL(List<WbsTreeContract> list, List<WbsTreeContract> result, String contractId) {
+        List<Long> ids = list.stream().map(WbsTreeContract::getId).collect(Collectors.toList());
+        if (ids.size() > 0) {
+            //构建以parent_id为key的Map
+            Map<Long, List<WbsTreeContract>> queryMap = jdbcTemplate.query("select id,p_key_id,parent_id,sort," +
+                            "IFNULL(if(length(trim(full_name)) > 0, full_name, node_name), node_name) AS fullName," +
+                            "create_time from m_wbs_tree_contract where type = 1 and parent_id " +
+                            "in(" + StringUtils.join(ids, ",") + ") and status = 1 and is_deleted = 0 " +
+                            "and contract_id = " + contractId + " order by sort,fullName,create_time",
+                    rs -> {
+                        Map<Long, List<WbsTreeContract>> map = new LinkedHashMap<>();
+                        while (rs.next()) {
+                            WbsTreeContract item = new WbsTreeContract();
+                            item.setId(rs.getLong("id"));
+                            item.setPKeyId(rs.getLong("p_key_id"));
+                            item.setParentId(rs.getLong("parent_id"));
+                            item.setSort(rs.getInt("sort"));
+                            item.setFullName(rs.getString("fullName"));
+                            item.setCreateTime(rs.getTime("create_time"));
+                            Long parentId = item.getParentId();
+                            if (!map.containsKey(parentId)) {
+                                map.put(parentId, new ArrayList<>());
+                            }
+                            map.get(parentId).add(item);
+                        }
+                        return map;
+                    });
+            //遍历ids,将查询结果按照ids的顺序加入result
+            for (Long id : ids) {
+                if (queryMap != null && queryMap.containsKey(id)) {
+                    List<WbsTreeContract> nodes = queryMap.get(id);
+                    result.addAll(nodes);
+                    recursionGetChildNodesZL(nodes, result, contractId);
+                }
+            }
+        }
+    }
+
     private void getMergePdf(InformationQueryVO vor) throws FileNotFoundException {
         String pdfUrl = vor.getPdfUrl();
         if (StringUtils.isNotEmpty(vor.getEVisaPdfUrl())) {

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

@@ -147,6 +147,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                         wbsTreeContract.setWbsId(pawDTO.getWbsId());
                         wbsTreeContract.setProjectId(pawDTO.getProjectId());
                         wbsTreeContract.setContractId(pawDTO.getContractId());
+                        wbsTreeContract.setIsTypePrivatePid(wbsTreePrivate.getPKeyId());
                         if (wbsTreePrivate.getType() == 2) {
                             wbsTreeContract.setIsTypePrivatePid(wbsTreePrivate.getPKeyId());
                         }
@@ -247,6 +248,7 @@ public class WbsTreeContractServiceImpl extends BaseServiceImpl<WbsTreeContractM
                         wbsTreeContract.setProjectId(pawDTO.getProjectId());
                         wbsTreeContract.setContractId(pawDTO.getContractId());
                         wbsTreeContract.setIsConcealedWorksNode(0);
+                        wbsTreeContract.setIsTypePrivatePid(wbsTreePrivate.getPKeyId());
                         if (wbsTreePrivate.getType() == 2) {
                             wbsTreeContract.setIsTypePrivatePid(wbsTreePrivate.getPKeyId());
                         }