@Test public void testRebuild() { int counts = searchProductManager.rebuild(); System.out.println("重建数量：" + counts); System.out.println(esProductRepository.count()); }
public Integer rebuild() { Integer lastId = null; int rebuildCounts = 0; while (true) { CommonResult<List<Integer>> listProductSpuIdsResult = productSpuRpc.listProductSpuIds(lastId, REBUILD_FETCH_PER_SIZE); listProductSpuIdsResult.checkError(); List<Integer> spuIds = listProductSpuIdsResult.getData(); spuIds.forEach(this::saveProduct); rebuildCounts += listProductSpuIdsResult.getData().size(); if (spuIds.size() < REBUILD_FETCH_PER_SIZE) { break; } else { lastId = spuIds.get(spuIds.size() - 1); } } return rebuildCounts; }
SearchProductManager { public Integer rebuild() { Integer lastId = null; int rebuildCounts = 0; while (true) { CommonResult<List<Integer>> listProductSpuIdsResult = productSpuRpc.listProductSpuIds(lastId, REBUILD_FETCH_PER_SIZE); listProductSpuIdsResult.checkError(); List<Integer> spuIds = listProductSpuIdsResult.getData(); spuIds.forEach(this::saveProduct); rebuildCounts += listProductSpuIdsResult.getData().size(); if (spuIds.size() < REBUILD_FETCH_PER_SIZE) { break; } else { lastId = spuIds.get(spuIds.size() - 1); } } return rebuildCounts; } }
SearchProductManager { public Integer rebuild() { Integer lastId = null; int rebuildCounts = 0; while (true) { CommonResult<List<Integer>> listProductSpuIdsResult = productSpuRpc.listProductSpuIds(lastId, REBUILD_FETCH_PER_SIZE); listProductSpuIdsResult.checkError(); List<Integer> spuIds = listProductSpuIdsResult.getData(); spuIds.forEach(this::saveProduct); rebuildCounts += listProductSpuIdsResult.getData().size(); if (spuIds.size() < REBUILD_FETCH_PER_SIZE) { break; } else { lastId = spuIds.get(spuIds.size() - 1); } } return rebuildCounts; }  }
SearchProductManager { public Integer rebuild() { Integer lastId = null; int rebuildCounts = 0; while (true) { CommonResult<List<Integer>> listProductSpuIdsResult = productSpuRpc.listProductSpuIds(lastId, REBUILD_FETCH_PER_SIZE); listProductSpuIdsResult.checkError(); List<Integer> spuIds = listProductSpuIdsResult.getData(); spuIds.forEach(this::saveProduct); rebuildCounts += listProductSpuIdsResult.getData().size(); if (spuIds.size() < REBUILD_FETCH_PER_SIZE) { break; } else { lastId = spuIds.get(spuIds.size() - 1); } } return rebuildCounts; }  PageResult<SearchProductRespDTO> pageSearchProduct(SearchProductPageReqDTO pageReqDTO); SearchProductConditionRespDTO getSearchProductCondition(SearchProductConditionReqDTO conditionReqDTO); Integer rebuild(); Boolean saveProduct(Integer id); }
SearchProductManager { public Integer rebuild() { Integer lastId = null; int rebuildCounts = 0; while (true) { CommonResult<List<Integer>> listProductSpuIdsResult = productSpuRpc.listProductSpuIds(lastId, REBUILD_FETCH_PER_SIZE); listProductSpuIdsResult.checkError(); List<Integer> spuIds = listProductSpuIdsResult.getData(); spuIds.forEach(this::saveProduct); rebuildCounts += listProductSpuIdsResult.getData().size(); if (spuIds.size() < REBUILD_FETCH_PER_SIZE) { break; } else { lastId = spuIds.get(spuIds.size() - 1); } } return rebuildCounts; }  PageResult<SearchProductRespDTO> pageSearchProduct(SearchProductPageReqDTO pageReqDTO); SearchProductConditionRespDTO getSearchProductCondition(SearchProductConditionReqDTO conditionReqDTO); Integer rebuild(); Boolean saveProduct(Integer id);  }