增加注释

This commit is contained in:
Chopper
2021-05-17 10:42:06 +08:00
parent bffca15b3c
commit 4cea9038eb
4 changed files with 62 additions and 8 deletions

View File

@@ -46,11 +46,14 @@ public class ElasticsearchController {
@GetMapping
public void init() {
//查询商品信息
LambdaQueryWrapper<GoodsSku> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(GoodsSku::getIsAuth, GoodsAuthEnum.PASS.name());
queryWrapper.eq(GoodsSku::getMarketEnable, GoodsStatusEnum.UPPER.name());
List<GoodsSku> list = goodsSkuService.list(queryWrapper);
List<EsGoodsIndex> esGoodsIndices = new ArrayList<>();
//库存锁是在redis做的所以生成索引同时更新一下redis中的库存数量
for (GoodsSku goodsSku : list) {
EsGoodsIndex index = new EsGoodsIndex(goodsSku);
Map<String, Object> goodsCurrentPromotionMap = promotionService.getGoodsCurrentPromotionMap(index);
@@ -58,6 +61,7 @@ public class ElasticsearchController {
esGoodsIndices.add(index);
stringRedisTemplate.opsForValue().set(GoodsSkuService.getStockCacheKey(goodsSku.getId()), goodsSku.getQuantity().toString());
}
//初始化商品索引
esGoodsIndexService.initIndex(esGoodsIndices);
Assertions.assertTrue(true);
}