Ver Fonte

资料查询响应超时问题

liuyc há 1 ano atrás
pai
commit
27b00624ac

+ 12 - 15
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -3578,17 +3578,14 @@ public class InformationWriteQueryController extends BladeController {
                  * @author liuyc
                  * @date 2023年9月8日11:26:46
                  */
+
                 //不是工序,则查询当前节点下的所有填报节点
-                if (node.getParentId() == 0) {
-                    //当前合同段最底层节点pKeyIds
+                if (node.getParentId() == 0) { // TODO(暂不响应第一层根节点数据,数据量过多会导致响应超时)
+                    return R.fail("当前节点下子节点过多,请减少节点层级进行检索!");
+
+                    /*//当前合同段最底层节点pKeyIds
                     List<WbsTreeContract> lowestNodesAll = jdbcTemplate.query("select a.p_key_id,a.id,(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.contract_id = " + node.getContractId() + " AND b.status = 1 AND b.type = 1 AND b.is_deleted = 0) AS hasChildren from m_wbs_tree_contract a where a.type = 1 and a.status = 1 and a.is_deleted = 0 and a.contract_id = " + node.getContractId() + " HAVING hasChildren = 0", new BeanPropertyRowMapper<>(WbsTreeContract.class));
                     List<String> pKeyIds = lowestNodesAll.stream().map(WbsTreeContract::getPKeyId).map(String::valueOf).collect(Collectors.toList());
-
-                    /*TODO 暂时解决page数量过多导致响应超时问题*/
-                    if (pKeyIds.size() > 1000) {
-                        return R.fail("当前节点下子节点过多,请减少节点层级进行检索!");
-                    }
-
                     List<List<String>> partition = Lists.partition(pKeyIds, 1000);
                     for (List<String> items : partition) {
                         //获取填报节点信息
@@ -3596,20 +3593,20 @@ public class InformationWriteQueryController extends BladeController {
                         if (result.size() > 0) {
                             queryDataResult.addAll(result);
                         }
-                    }
+                    }*/
 
                     //queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractIdTwo("", contract.getContractType(), StringUtils.isNotEmpty(vo.getContractIdRelation()) ? vo.getContractIdRelation() : vo.getContractId().toString());
                 } else {
+                    //TODO 判断选择节点是否为第二层(暂不响应第二层数据,数据量过多会导致响应超时)
+                    WbsTreeContract wbsTreeContract = jdbcTemplate.query("select parent_id from m_wbs_tree_contract where is_deleted = 0 and status = 1 and type = 1 and id = " + node.getParentId() + " and contract_id = " + node.getContractId(), new BeanPropertyRowMapper<>(WbsTreeContract.class)).stream().findAny().orElse(null);
+                    if (wbsTreeContract != null && wbsTreeContract.getParentId().equals(0L)) {
+                        return R.fail("当前节点下子节点过多,请减少节点层级进行检索!");
+                    }
+
                     //获取当前选择的节点下的所有最底层节点
                     WbsTreeContractVO8 vo8 = BeanUtil.copyProperties(node, WbsTreeContractVO8.class);
                     this.lowestNodesRecursively(lowestNodes, Collections.singleton(vo8), node.getContractId());
                     List<String> pKeyIds = lowestNodes.stream().map(WbsTreeContractVO8::getPKeyId).map(String::valueOf).collect(Collectors.toList());
-
-                    /*TODO 暂时解决page数量过多导致响应超时问题*/
-                    if (pKeyIds.size() > 1000) {
-                        return R.fail("当前节点下子节点过多,请减少节点层级进行检索!");
-                    }
-
                     List<List<String>> partition = Lists.partition(pKeyIds, 1000);
                     for (List<String> items : partition) {
                         //获取填报节点信息