ソースを参照

客户端资料查询-点击根节点数据条数不对,有些根节点查不出数据

qianxb 2 年 前
コミット
1c776a6bf0

+ 2 - 0
blade-service-api/blade-manager-api/src/main/java/org/springblade/manager/feign/WbsTreeContractClient.java

@@ -139,4 +139,6 @@ public interface WbsTreeContractClient {
     @GetMapping(API_PREFIX + "/selectContractTreeAll")
     List<WbsTreeContract> selectContractTreeAll(@RequestParam String contractId);
 
+    @GetMapping(API_PREFIX + "/getContractWbsTreeByParentId")
+    List<WbsTreeContract> getContractWbsTreeByParentId(@RequestParam String parentId,@RequestParam String contractId);
 }

+ 19 - 7
blade-service/blade-business/src/main/java/org/springblade/business/controller/InformationWriteQueryController.java

@@ -1970,13 +1970,25 @@ public class InformationWriteQueryController extends BladeController {
 
         if (!new Integer("6").equals(node.getNodeType()) && !Arrays.asList("1,2,3,4".split(",")).contains(node.getMajorDataType().toString())) {
             //不是工序,则查询当前节点下的所有填报节点
-            List<QueryProcessDataVO> queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(node.getId().toString(), contract.getContractType(), StringUtils.isNotEmpty(vo.getContractIdRelation()) ? vo.getContractIdRelation() : vo.getContractId().toString());
-            if (StringUtils.isNotEmpty(vo.getIsFirst())) {
-                //如果是首件列表请求,则删掉没有标记为首件的数据
-                queryDataResult.removeIf(data -> StringUtils.isEmpty(data.getFirstId()));
-            }
-            if (queryDataResult != null && queryDataResult.size() > 0) {
-                submitNodeKeyIds.addAll(queryDataResult.stream().map(QueryProcessDataVO::getPrimaryKeyId).distinct().collect(Collectors.toList()));
+            if (node.getParentId() == 0){
+                String contractId = node.getContractId();
+                List<WbsTreeContract> treeS = wbsTreeContractClient.getContractWbsTreeByParentId(node.getId().toString(),contractId);
+                for (WbsTreeContract tree : treeS) {
+                    List<QueryProcessDataVO> queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(tree.getId().toString(), contract.getContractType(), StringUtils.isNotEmpty(vo.getContractIdRelation()) ? vo.getContractIdRelation() : vo.getContractId().toString());
+                    if (queryDataResult != null && queryDataResult.size() > 0) {
+                        submitNodeKeyIds.addAll(queryDataResult.stream().map(QueryProcessDataVO::getPrimaryKeyId).distinct().collect(Collectors.toList()));
+                        queryDataResult.clear();
+                    }
+                }
+            }else {
+                List<QueryProcessDataVO> queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractId(node.getId().toString(), contract.getContractType(), StringUtils.isNotEmpty(vo.getContractIdRelation()) ? vo.getContractIdRelation() : vo.getContractId().toString());
+                if (StringUtils.isNotEmpty(vo.getIsFirst())) {
+                    //如果是首件列表请求,则删掉没有标记为首件的数据
+                    queryDataResult.removeIf(data -> StringUtils.isEmpty(data.getFirstId()));
+                }
+                if (queryDataResult != null && queryDataResult.size() > 0) {
+                    submitNodeKeyIds.addAll(queryDataResult.stream().map(QueryProcessDataVO::getPrimaryKeyId).distinct().collect(Collectors.toList()));
+                }
             }
         }
         //设置进集合中

+ 8 - 0
blade-service/blade-manager/src/main/java/org/springblade/manager/feign/WbsTreeContractClientImpl.java

@@ -199,6 +199,14 @@ public class WbsTreeContractClientImpl implements WbsTreeContractClient {
         return this.wbsTreeContractService.selectContractTreeAll(Long.parseLong(contractId));
     }
 
+    @Override
+    public List<WbsTreeContract> getContractWbsTreeByParentId(String parentId,String contractId) {
+        LambdaQueryWrapper<WbsTreeContract> wrapper = new LambdaQueryWrapper<>();
+        wrapper.eq(WbsTreeContract::getParentId,parentId);
+        wrapper.eq(WbsTreeContract::getContractId,contractId);
+        return this.wbsTreeContractService.list(wrapper);
+    }
+
     @Override
     public List<WbsTreeContractTreeVOS> queryCurrentContractLogList(String contractId) {
         ContractInfo contract = this.contractInfoService.getById(contractId);