源码如下 

//获取otherList数据
        List<SampleTestProgressDTO> otherList = purchaseSampleItemMapper.selectSampleTestProgress((pageNo - 1) * pageSize, pageSize);

        //获取orderList数据
        List<SampleTestProgressDTO> orderList = sampleTestProgressExtendApiService.getList((pageNo - 1) * pageSize, pageSize);


        //将orderList中的数据赋值到otherList中
        List<SampleTestProgressDTO> list = otherList.stream().map(map -> orderList.stream()
                        //判断两个list中ElsAccount是否相等
                        .filter(m -> Objects.equals(m.getElsAccount(), map.getElsAccount()))
                        .findFirst().map(m -> {
                            //将orderList字段赋值到otherList中
                            map.setSupplierCode(m.getSupplierCode());
                            map.setSupplierName(m.getSupplierName());
                            map.setOrderNumber(m.getOrderNumber());
                            map.setQuantity(m.getQuantity());
                            map.setOrderDate(m.getOrderDate());
                            return map;
                        }).orElse(null))
                .filter(Objects::nonNull).collect(Collectors.toList());

Logo

更多推荐