1
zj
2024-10-08 6fb4fda8659d6202b34d2347fb0d481446e28ee3
src/main/java/com/nq/service/impl/StockServiceImpl.java
@@ -177,23 +177,6 @@
        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);
@@ -223,9 +206,9 @@
        stockVO.setSpell(stock.getStockSpell());
        stockVO.setGid(stock.getStockGid().toUpperCase());
        Map<String, Object> newStock = iPriceServices.getNewStock(stock.getStockCode());
        stockVO.setHcrate(newStock.get("pcp").toString().replaceAll("%", ""));
        stockVO.setToday_max(newStock.get("high").toString());
        stockVO.setToday_min(newStock.get("low").toString());
        stockVO.setHcrate(newStock.get("ChgPct").toString().replaceAll("%", ""));
        stockVO.setToday_max(newStock.get("High").toString());
        stockVO.setToday_min(newStock.get("Low").toString());
        if(null != cacheBaseStock){
            stockVO.setOpen_px(cacheBaseStock.getOpen());
            stockVO.setPreclose_px(cacheBaseStock.getPrevClose());