| | |
| | | if (stockList.size() > 0){ |
| | | stockListVOS.addAll(Objects.requireNonNull(StockApi.getStockReailTimes(stockList))); |
| | | } |
| | | |
| | | // Create a list to hold Futures |
| | | List<CompletableFuture<Void>> futures = new ArrayList<>(); |
| | | |
| | | // Use CompletableFuture to perform asynchronous processing for each stockListVO |
| | | // for (StockListVO stockListVO : stockListVOS) { |
| | | // CompletableFuture<Void> future = CompletableFuture.runAsync(() -> { |
| | | // stockListVO.setNowPrice(iPriceServices.getNowPrice(stockListVO.getCode(), stockType).toString()); |
| | | // Map<String, Object> newStock = iPriceServices.getNewStock(stockListVO.getCode()); |
| | | // stockListVO.setHcrateP(newStock.get("pcp").toString()); |
| | | // }); |
| | | // futures.add(future); |
| | | // } |
| | | // |
| | | // // Wait for all futures to complete |
| | | // CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])).join(); |
| | | |
| | | RPageInfo pageInfo = new RPageInfo(); |
| | | pageInfo.setList(stockListVOS); |
| | | pageInfo.setStockType(stockType); |