!190 优化索引生成,商品索引查询

Merge pull request !190 from OceansDeep/feature/pg
This commit is contained in:
OceansDeep 2022-06-13 10:51:16 +00:00 committed by Gitee
commit a6ff38159f
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
11 changed files with 151 additions and 64 deletions

View File

@ -85,6 +85,7 @@ public abstract class BaseElasticsearchService {
*/
protected void createIndexRequest(String index) {
try {
deleteIndexRequest(index);
CreateIndexRequest request = new CreateIndexRequest(index);
//Settings for this index
request.settings(Settings.builder()

View File

@ -0,0 +1,25 @@
package cn.lili.modules.goods.entity.dto;
import cn.lili.modules.goods.entity.dos.GoodsSku;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
/**
* @author paulG
* @since 2022/6/13
**/
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class GoodsSkuDTO extends GoodsSku {
private static final long serialVersionUID = 6600436187015048097L;
@ApiModelProperty(value = "商品参数json")
private String params;
}

View File

@ -5,6 +5,7 @@ import cn.lili.modules.goods.entity.dos.GoodsSku;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import java.util.List;
@ -16,6 +17,7 @@ import java.util.List;
* @since 2020-02-26 23:24:13
*/
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class GoodsSkuVO extends GoodsSku {

View File

@ -1,7 +1,11 @@
package cn.lili.modules.goods.mapper;
import cn.lili.modules.goods.entity.dos.GoodsSku;
import cn.lili.modules.goods.entity.dto.GoodsSkuDTO;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
@ -99,4 +103,15 @@ public interface GoodsSkuMapper extends BaseMapper<GoodsSku> {
")")
int replaceGoodsSku(@Param("goodsSku") GoodsSku goodsSku);
/**
* 分页查询商品skuDTO
*
* @param page 分页
* @param queryWrapper 查询条件
* @return 售后VO分页
*/
@Select("SELECT *,g.params as params FROM li_goods_sku gs inner join li_goods g on gs.goods_id = g.id ${ew.customSqlSegment}")
IPage<GoodsSkuDTO> queryByParams(IPage<GoodsSkuDTO> page, @Param(Constants.WRAPPER) Wrapper<GoodsSkuDTO> queryWrapper);
}

View File

@ -5,9 +5,12 @@ import cn.lili.modules.goods.entity.dos.Goods;
import cn.lili.modules.goods.entity.dos.GoodsSku;
import cn.lili.modules.goods.entity.dto.GoodsOperationDTO;
import cn.lili.modules.goods.entity.dto.GoodsSearchParams;
import cn.lili.modules.goods.entity.dto.GoodsSkuDTO;
import cn.lili.modules.goods.entity.dto.GoodsSkuStockDTO;
import cn.lili.modules.goods.entity.vos.GoodsSkuVO;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
@ -136,6 +139,15 @@ public interface GoodsSkuService extends IService<GoodsSku> {
*/
IPage<GoodsSku> getGoodsSkuByPage(GoodsSearchParams searchParams);
/**
* 分页查询商品sku信息
*
* @param searchParams 查询参数
* @return 商品sku信息
*/
IPage<GoodsSkuDTO> getGoodsSkuDTOByPage(Page<GoodsSkuDTO> page, Wrapper<GoodsSkuDTO> queryWrapper);
/**
* 列表查询商品sku信息
*

View File

@ -18,6 +18,7 @@ import cn.lili.modules.goods.entity.dos.GoodsGallery;
import cn.lili.modules.goods.entity.dos.GoodsSku;
import cn.lili.modules.goods.entity.dto.GoodsOperationDTO;
import cn.lili.modules.goods.entity.dto.GoodsSearchParams;
import cn.lili.modules.goods.entity.dto.GoodsSkuDTO;
import cn.lili.modules.goods.entity.dto.GoodsSkuStockDTO;
import cn.lili.modules.goods.entity.enums.GoodsAuthEnum;
import cn.lili.modules.goods.entity.enums.GoodsStatusEnum;
@ -44,9 +45,11 @@ import cn.lili.modules.search.utils.EsIndexUtil;
import cn.lili.mybatis.util.PageUtil;
import cn.lili.rocketmq.RocketmqSendCallbackBuilder;
import cn.lili.rocketmq.tags.GoodsTagsEnum;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.rocketmq.spring.core.RocketMQTemplate;
import org.springframework.beans.factory.annotation.Autowired;
@ -448,6 +451,11 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
return this.page(PageUtil.initPage(searchParams), searchParams.queryWrapper());
}
@Override
public IPage<GoodsSkuDTO> getGoodsSkuDTOByPage(Page<GoodsSkuDTO> page, Wrapper<GoodsSkuDTO> queryWrapper) {
return this.baseMapper.queryByParams(page, queryWrapper);
}
/**
* 列表查询商品sku信息
*

View File

@ -29,7 +29,7 @@ public interface EsGoodsIndexService {
*
* @return
*/
Map<String, Integer> getProgress();
Map<String, Long> getProgress();
/**
@ -106,8 +106,9 @@ public interface EsGoodsIndexService {
* 初始化商品索引
*
* @param goodsIndexList 商品索引列表
* @param regeneratorIndex 是否重新生成索引
*/
void initIndex(List<EsGoodsIndex> goodsIndexList);
void initIndex(List<EsGoodsIndex> goodsIndexList, boolean regeneratorIndex);
/**
* 更新商品索引的促销信息

View File

@ -21,6 +21,7 @@ import cn.lili.elasticsearch.EsSuffix;
import cn.lili.elasticsearch.config.ElasticsearchProperties;
import cn.lili.modules.goods.entity.dos.*;
import cn.lili.modules.goods.entity.dto.GoodsParamsDTO;
import cn.lili.modules.goods.entity.dto.GoodsSkuDTO;
import cn.lili.modules.goods.entity.enums.GoodsAuthEnum;
import cn.lili.modules.goods.entity.enums.GoodsStatusEnum;
import cn.lili.modules.goods.entity.enums.GoodsWordsTypeEnum;
@ -38,6 +39,7 @@ import cn.lili.modules.search.service.EsGoodsSearchService;
import cn.lili.rocketmq.RocketmqSendCallbackBuilder;
import cn.lili.rocketmq.tags.GoodsTagsEnum;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.extern.slf4j.Slf4j;
@ -83,6 +85,11 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements
private final Map<String, Field> fieldMap = ReflectUtil.getFieldMap(EsGoodsIndex.class);
private final String KEY_SUCCESS = "success";
private final String KEY_FAIL = "fail";
private final String KEY_PROCESSED = "processed";
@Autowired
private ElasticsearchProperties elasticsearchProperties;
@Autowired
@ -128,7 +135,7 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements
Boolean flag = (Boolean) cache.get(CachePrefix.INIT_INDEX_FLAG.getPrefix());
//为空则默认写入没有任务
if (flag == null) {
cache.put(CachePrefix.INIT_INDEX_FLAG.getPrefix(), false, 10L, TimeUnit.MINUTES);
cache.put(CachePrefix.INIT_INDEX_FLAG.getPrefix(), false);
}
//有正在初始化的任务则提示异常
if (Boolean.TRUE.equals(flag)) {
@ -137,48 +144,58 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements
//初始化标识
cache.put(CachePrefix.INIT_INDEX_PROCESS.getPrefix(), null);
cache.put(CachePrefix.INIT_INDEX_FLAG.getPrefix(), true);
cache.put(CachePrefix.INIT_INDEX_FLAG.getPrefix(), true, 10L, TimeUnit.MINUTES);
ThreadUtil.execAsync(() -> {
try {
LambdaQueryWrapper<Goods> goodsQueryWrapper = new LambdaQueryWrapper<>();
goodsQueryWrapper.eq(Goods::getAuthFlag, GoodsAuthEnum.PASS.name());
goodsQueryWrapper.eq(Goods::getMarketEnable, GoodsStatusEnum.UPPER.name());
goodsQueryWrapper.eq(Goods::getDeleteFlag, false);
QueryWrapper<GoodsSkuDTO> skuQueryWrapper = new QueryWrapper<>();
skuQueryWrapper.eq("gs.auth_flag", GoodsAuthEnum.PASS.name());
skuQueryWrapper.eq("gs.market_enable", GoodsStatusEnum.UPPER.name());
skuQueryWrapper.eq("gs.delete_flag", false);
Map<String, Long> resultMap = (Map<String, Long>) cache.get(CachePrefix.INIT_INDEX_PROCESS.getPrefix());
if (CollUtil.isEmpty(resultMap)) {
QueryWrapper<GoodsSku> skuCountQueryWrapper = new QueryWrapper<>();
skuCountQueryWrapper.eq("auth_flag", GoodsAuthEnum.PASS.name());
skuCountQueryWrapper.eq("market_enable", GoodsStatusEnum.UPPER.name());
skuCountQueryWrapper.eq("delete_flag", false);
resultMap = new HashMap<>();
resultMap.put(KEY_SUCCESS, 0L);
resultMap.put(KEY_FAIL, 0L);
resultMap.put(KEY_PROCESSED, 0L);
resultMap.put("total", this.goodsSkuService.count(skuCountQueryWrapper));
cache.put(CachePrefix.INIT_INDEX_PROCESS.getPrefix(), resultMap);
}
for (int i = 1; ; i++) {
List<EsGoodsIndex> esGoodsIndices = new ArrayList<>();
IPage<Goods> page = new Page<>(i, 1000);
IPage<Goods> goodsIPage = goodsService.page(page, goodsQueryWrapper);
if (goodsIPage == null || CollUtil.isEmpty(goodsIPage.getRecords())) {
Page<GoodsSkuDTO> skuPage = new Page<>(i, 100);
IPage<GoodsSkuDTO> skuIPage = goodsSkuService.getGoodsSkuDTOByPage(skuPage, skuQueryWrapper);
if (skuIPage == null || CollUtil.isEmpty(skuIPage.getRecords())) {
break;
}
for (Goods goods : goodsIPage.getRecords()) {
LambdaQueryWrapper<GoodsSku> skuQueryWrapper = new LambdaQueryWrapper<>();
skuQueryWrapper.eq(GoodsSku::getGoodsId, goods.getId());
skuQueryWrapper.eq(GoodsSku::getAuthFlag, GoodsAuthEnum.PASS.name());
skuQueryWrapper.eq(GoodsSku::getMarketEnable, GoodsStatusEnum.UPPER.name());
skuQueryWrapper.eq(GoodsSku::getDeleteFlag, false);
for (int j = 1; ; j++) {
IPage<GoodsSku> skuPage = new Page<>(j, 100);
IPage<GoodsSku> skuIPage = goodsSkuService.page(skuPage, skuQueryWrapper);
if (skuIPage == null || CollUtil.isEmpty(skuIPage.getRecords())) {
break;
}
int skuSource = 100;
for (GoodsSku goodsSku : skuIPage.getRecords()) {
EsGoodsIndex esGoodsIndex = wrapperEsGoodsIndex(goodsSku, goods);
esGoodsIndex.setSkuSource(skuSource--);
esGoodsIndices.add(esGoodsIndex);
//库存锁是在redis做的所以生成索引同时更新一下redis中的库存数量
cache.put(GoodsSkuService.getStockCacheKey(goodsSku.getId()), goodsSku.getQuantity());
}
for (GoodsSkuDTO goodsSku : skuIPage.getRecords()) {
int skuSource = 100;
EsGoodsIndex esGoodsIndex = wrapperEsGoodsIndex(goodsSku);
long count = esGoodsIndices.stream().filter(j -> j.getGoodsId().equals(esGoodsIndex.getGoodsId())).count();
if (count >= 1) {
skuSource -= count;
}
esGoodsIndex.setSkuSource(skuSource);
esGoodsIndices.add(esGoodsIndex);
//库存锁是在redis做的所以生成索引同时更新一下redis中的库存数量
cache.put(GoodsSkuService.getStockCacheKey(goodsSku.getId()), goodsSku.getQuantity());
}
this.initIndex(esGoodsIndices);
//批量插入索引如果为第一次则删除原索引并创建新索引
this.initIndex(esGoodsIndices, i == 1);
}
cache.put(CachePrefix.INIT_INDEX_FLAG.getPrefix(), false);
//初始化商品索引
} catch (Exception e) {
@ -188,16 +205,17 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements
cache.put(CachePrefix.INIT_INDEX_FLAG.getPrefix(), false);
}
});
}
@Override
public Map<String, Integer> getProgress() {
Map<String, Integer> map = (Map<String, Integer>) cache.get(CachePrefix.INIT_INDEX_PROCESS.getPrefix());
public Map<String, Long> getProgress() {
Map<String, Long> map = (Map<String, Long>) cache.get(CachePrefix.INIT_INDEX_PROCESS.getPrefix());
if (map == null) {
return Collections.emptyMap();
}
Boolean flag = (Boolean) cache.get(CachePrefix.INIT_INDEX_FLAG.getPrefix());
map.put("flag", Boolean.TRUE.equals(flag) ? 1 : 0);
map.put("flag", Boolean.TRUE.equals(flag) ? 1L : 0L);
return map;
}
@ -391,7 +409,7 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements
}
@Override
public void initIndex(List<EsGoodsIndex> goodsIndexList) {
public void initIndex(List<EsGoodsIndex> goodsIndexList, boolean regeneratorIndex) {
if (goodsIndexList == null || goodsIndexList.isEmpty()) {
//初始化标识
cache.put(CachePrefix.INIT_INDEX_PROCESS.getPrefix(), null);
@ -405,27 +423,18 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements
//但是如果索引已经自动生成过这里就不会创建索引设置mapping所以这里决定在初始化索引的同时将已有索引删除重新创建
//如果索引存在则删除重新生成 这里应该有更优解
if (this.indexExist(indexName)) {
deleteIndexRequest(indexName);
boolean indexExist = this.indexExist(indexName);
if (regeneratorIndex || !indexExist) {
//如果索引不存在则创建索引
createIndexRequest(indexName);
}
//如果索引不存在则创建索引
createIndexRequest(indexName);
Map<String, Integer> resultMap = new HashMap<>(16);
final String KEY_SUCCESS = "success";
final String KEY_FAIL = "fail";
final String KEY_PROCESSED = "processed";
resultMap.put("total", goodsIndexList.size());
resultMap.put(KEY_SUCCESS, 0);
resultMap.put(KEY_FAIL, 0);
resultMap.put(KEY_PROCESSED, 0);
cache.put(CachePrefix.INIT_INDEX_PROCESS.getPrefix(), resultMap);
Map<String, Long> resultMap = (Map<String, Long>) cache.get(CachePrefix.INIT_INDEX_PROCESS.getPrefix());
if (!goodsIndexList.isEmpty()) {
goodsIndexRepository.deleteAll();
for (EsGoodsIndex goodsIndex : goodsIndexList) {
try {
log.info("生成商品索引:{}", goodsIndex);
addIndex(goodsIndex);
this.addIndex(goodsIndex);
resultMap.put(KEY_SUCCESS, resultMap.get(KEY_SUCCESS) + 1);
} catch (Exception e) {
log.error("商品{}生成索引错误!", goodsIndex);
@ -436,7 +445,6 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements
}
}
cache.put(CachePrefix.INIT_INDEX_PROCESS.getPrefix(), resultMap);
cache.put(CachePrefix.INIT_INDEX_FLAG.getPrefix(), false);
}
@Override
@ -813,30 +821,30 @@ public class EsGoodsIndexServiceImpl extends BaseElasticsearchService implements
return elasticsearchProperties.getIndexPrefix() + "_" + EsSuffix.GOODS_INDEX_NAME;
}
private EsGoodsIndex wrapperEsGoodsIndex(GoodsSku goodsSku, Goods goods) {
private EsGoodsIndex wrapperEsGoodsIndex(GoodsSkuDTO goodsSku) {
EsGoodsIndex index = new EsGoodsIndex(goodsSku);
//商品参数索引
if (goods.getParams() != null && !goods.getParams().isEmpty()) {
List<GoodsParamsDTO> goodsParamDTOS = JSONUtil.toList(goods.getParams(), GoodsParamsDTO.class);
if (CharSequenceUtil.isNotEmpty(goodsSku.getParams())) {
List<GoodsParamsDTO> goodsParamDTOS = JSONUtil.toList(goodsSku.getParams(), GoodsParamsDTO.class);
index = new EsGoodsIndex(goodsSku, goodsParamDTOS);
}
//商品分类索引
if (goods.getCategoryPath() != null) {
List<Category> categories = categoryService.listByIdsOrderByLevel(Arrays.asList(goods.getCategoryPath().split(",")));
if (goodsSku.getCategoryPath() != null) {
List<Category> categories = categoryService.listByIdsOrderByLevel(Arrays.asList(goodsSku.getCategoryPath().split(",")));
if (!categories.isEmpty()) {
index.setCategoryNamePath(ArrayUtil.join(categories.stream().map(Category::getName).toArray(), ","));
}
}
//商品品牌索引
Brand brand = brandService.getById(goods.getBrandId());
Brand brand = brandService.getById(goodsSku.getBrandId());
if (brand != null) {
index.setBrandName(brand.getName());
index.setBrandUrl(brand.getLogo());
}
//店铺分类索引
if (goods.getStoreCategoryPath() != null && CharSequenceUtil.isNotEmpty(goods.getStoreCategoryPath())) {
List<StoreGoodsLabel> storeGoodsLabels = storeGoodsLabelService.listByStoreIds(Arrays.asList(goods.getStoreCategoryPath().split(",")));
if (goodsSku.getStoreCategoryPath() != null && CharSequenceUtil.isNotEmpty(goodsSku.getStoreCategoryPath())) {
List<StoreGoodsLabel> storeGoodsLabels = storeGoodsLabelService.listByStoreIds(Arrays.asList(goodsSku.getStoreCategoryPath().split(",")));
if (!storeGoodsLabels.isEmpty()) {
index.setStoreCategoryNamePath(ArrayUtil.join(storeGoodsLabels.stream().map(StoreGoodsLabel::getLabelName).toArray(), ","));
}

View File

@ -365,9 +365,12 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
//关键字检索
if (CharSequenceUtil.isEmpty(searchDTO.getKeyword())) {
List<FunctionScoreQueryBuilder.FilterFunctionBuilder> filterFunctionBuilders = new ArrayList<>();
GaussDecayFunctionBuilder skuNoScore = ScoreFunctionBuilders.gaussDecayFunction("skuSource", 100, 10).setWeight(10);
GaussDecayFunctionBuilder skuNoScore = ScoreFunctionBuilders.gaussDecayFunction("skuSource", 50, 10, 50).setWeight(2);
FunctionScoreQueryBuilder.FilterFunctionBuilder skuNoBuilder = new FunctionScoreQueryBuilder.FilterFunctionBuilder(QueryBuilders.matchAllQuery(), skuNoScore);
filterFunctionBuilders.add(skuNoBuilder);
FieldValueFactorFunctionBuilder buyCountScore = ScoreFunctionBuilders.fieldValueFactorFunction("buyCount").modifier(FieldValueFactorFunction.Modifier.LOG1P).setWeight(3);
FunctionScoreQueryBuilder.FilterFunctionBuilder buyCountBuilder = new FunctionScoreQueryBuilder.FilterFunctionBuilder(QueryBuilders.matchAllQuery(), buyCountScore);
filterFunctionBuilders.add(buyCountBuilder);
FunctionScoreQueryBuilder.FilterFunctionBuilder[] builders = new FunctionScoreQueryBuilder.FilterFunctionBuilder[filterFunctionBuilders.size()];
filterFunctionBuilders.toArray(builders);
FunctionScoreQueryBuilder functionScoreQueryBuilder = QueryBuilders.functionScoreQuery(builders)
@ -561,7 +564,7 @@ public class EsGoodsSearchServiceImpl implements EsGoodsSearchService {
filterFunctionBuilders.add(new FunctionScoreQueryBuilder.FilterFunctionBuilder(QueryBuilders.nestedQuery(ATTR_PATH, QueryBuilders.wildcardQuery(ATTR_VALUE, "*" + keyword + "*"), ScoreMode.None),
ScoreFunctionBuilders.weightFactorFunction(8)));
GaussDecayFunctionBuilder skuNoScore = ScoreFunctionBuilders.gaussDecayFunction("skuSource", 100, 10).setWeight(7);
GaussDecayFunctionBuilder skuNoScore = ScoreFunctionBuilders.gaussDecayFunction("skuSource", 50, 10, 50).setWeight(7);
FunctionScoreQueryBuilder.FilterFunctionBuilder skuNoBuilder = new FunctionScoreQueryBuilder.FilterFunctionBuilder(goodsNameQuery, skuNoScore);
filterFunctionBuilders.add(skuNoBuilder);

View File

@ -33,7 +33,7 @@ public class ElasticsearchController {
}
@GetMapping("/progress")
public ResultMessage<Map<String, Integer>> getProgress() {
public ResultMessage<Map<String, Long>> getProgress() {
return ResultUtil.data(esGoodsIndexService.getProgress());
}
}

View File

@ -3,9 +3,11 @@ package cn.lili.test.elasticsearch;
import cn.hutool.json.JSONUtil;
import cn.lili.cache.Cache;
import cn.lili.common.vo.PageVO;
import cn.lili.modules.goods.entity.dos.Goods;
import cn.lili.modules.goods.entity.dos.GoodsSku;
import cn.lili.modules.goods.entity.enums.GoodsAuthEnum;
import cn.lili.modules.goods.entity.enums.GoodsStatusEnum;
import cn.lili.modules.goods.service.GoodsService;
import cn.lili.modules.goods.service.GoodsSkuService;
import cn.lili.modules.promotion.service.PromotionService;
import cn.lili.modules.search.entity.dos.EsGoodsAttribute;
@ -47,6 +49,9 @@ class EsTest {
@Autowired
private GoodsSkuService goodsSkuService;
@Autowired
private GoodsService goodsService;
@Autowired
private Cache cache;
@ -63,6 +68,13 @@ class EsTest {
// System.out.println(HtmlUtil.filter("+ADw-script+AD4-alert(document.cookie)+ADw-/script+AD4-"));
// Date dt1 = new Date(2021, 12, 10);
// Date dt2 = new Date(2021, 12, 14);
for (int i = 0; i < 1000; i++) {
Goods goods = new Goods();
goods.setGoodsName("测试商品" + i);
// goods.setAuthFlag();
}
//
}
@ -132,7 +144,7 @@ class EsTest {
esGoodsIndices.add(index);
cache.put(GoodsSkuService.getStockCacheKey(goodsSku.getId()), goodsSku.getQuantity());
}
esGoodsIndexService.initIndex(esGoodsIndices);
esGoodsIndexService.initIndex(esGoodsIndices, true);
Assertions.assertTrue(true);
}