فهرست منبع

客户端首件,首件查询

qianxb 2 سال پیش
والد
کامیت
77ae1ea0d6

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

@@ -2302,40 +2302,31 @@ public class InformationWriteQueryController extends BladeController {
         if (!new Integer("6").equals(node.getNodeType()) && !Arrays.asList("1,2,3,4".split(",")).contains(node.getMajorDataType().toString())) {
             //不是工序,则查询当前节点下的所有填报节点
             if (node.getParentId() == 0) {
-                String contractId = node.getContractId();
-                List<WbsTreeContract> treeS = wbsTreeContractClient.getContractWbsTreeByParentId(node.getId().toString(), contractId);
-                for (WbsTreeContract tree : treeS) {
-                    List<QueryProcessDataVO> Result = this.informationQueryService.queryProcessDataByParentIdAndContractIdTwo(tree.getId().toString(), contract.getContractType(), StringUtils.isNotEmpty(vo.getContractIdRelation()) ? vo.getContractIdRelation() : vo.getContractId().toString());
-                    if (Result != null && Result.size() > 0) {
-                        queryDataResult.addAll(Result);
-                        Result.clear();
-                    }
-                }
+                queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractIdTwo("", contract.getContractType(), StringUtils.isNotEmpty(vo.getContractIdRelation()) ? vo.getContractIdRelation() : vo.getContractId().toString());
             } else {
-                List<QueryProcessDataVO> Result = this.informationQueryService.queryProcessDataByParentIdAndContractIdTwo(node.getId().toString(), contract.getContractType(), StringUtils.isNotEmpty(vo.getContractIdRelation()) ? vo.getContractIdRelation() : vo.getContractId().toString());
-                if (Result != null && Result.size() > 0) {
-                    queryDataResult.addAll(Result);
-                    Result.clear();
-                }
+                queryDataResult = this.informationQueryService.queryProcessDataByParentIdAndContractIdTwo(node.getId().toString(), contract.getContractType(), StringUtils.isNotEmpty(vo.getContractIdRelation()) ? vo.getContractIdRelation() : vo.getContractId().toString());
+
             }
             //如果是首件列表请求,则删掉没有标记为首件的数据
             if (queryDataResult != null && queryDataResult.size() > 0) {
                 if (StringUtils.isNotEmpty(vo.getIsFirst())) {
-                    List<String> treeIds = queryDataResult.stream().map(QueryProcessDataVO::getPrimaryKeyId).distinct().collect(Collectors.toList());
-                    //通过合同段主键在首件关联表中查询出所有数据
-                    List<TreeContractFirst> firstList = treeContractFirstService.list(new LambdaQueryWrapper<TreeContractFirst>().in(TreeContractFirst::getWbsNodeId, treeIds));
-                    List<String> list = firstList.stream().map(fl -> (fl.getWbsNodeId() + "")).collect(Collectors.toList());
-                    queryDataResult = queryDataResult.stream().filter(qdr -> list.contains(qdr.getPrimaryKeyId())).collect(Collectors.toList());
-//                    for (QueryProcessDataVO queryProcessDataVO : queryDataResult) {
-//                        TreeContractFirst first = treeContractFirstService.getOne(new LambdaQueryWrapper<TreeContractFirst>()
-//                                .eq(TreeContractFirst::getWbsNodeId, queryProcessDataVO.getPrimaryKeyId()));
-//                        if (first != null){
-//                            queryProcessDataVO.setFirstId(first.getId()+"");
-//                        }
-//                    }
-//                    queryDataResult.removeIf(data -> StringUtils.isEmpty(data.getFirstId()));
+                    if (StringUtils.isNotEmpty(vo.getFirstTitle())){
+                        if (node.getParentId()==0) {
+                            List<TreeContractFirst> firstList = treeContractFirstService.list(new LambdaQueryWrapper<TreeContractFirst>().in(TreeContractFirst::getContractId, node.getContractId()));
+                            List<String> list = firstList.stream().map(fl -> (fl.getWbsNodeId() + "")).collect(Collectors.toList());
+                            submitNodeKeyIds.addAll(list);
+                        }
+                    }else {
+                        //节点主键集合
+                        List<String> treeIds = queryDataResult.stream().map(QueryProcessDataVO::getPrimaryKeyId).distinct().collect(Collectors.toList());
+                        //通过合同段主键在首件关联表中查询出所有数据
+                        List<TreeContractFirst> firstList = treeContractFirstService.list(new LambdaQueryWrapper<TreeContractFirst>().in(TreeContractFirst::getWbsNodeId, treeIds));
+                        List<String> list = firstList.stream().map(fl -> (fl.getWbsNodeId() + "")).collect(Collectors.toList());
+                        queryDataResult = queryDataResult.stream().filter(qdr -> list.contains(qdr.getPrimaryKeyId())).collect(Collectors.toList());
+                        submitNodeKeyIds.addAll(queryDataResult.stream().map(QueryProcessDataVO::getPrimaryKeyId).distinct().collect(Collectors.toList()));
+                    }
                 }
-                submitNodeKeyIds.addAll(queryDataResult.stream().map(QueryProcessDataVO::getPrimaryKeyId).distinct().collect(Collectors.toList()));
+
             }
         }
         //设置进集合中