master:同步到ES中父类数据错误;
parent
ef99bec678
commit
28f784c6f2
|
|
@ -55,6 +55,7 @@ import java.util.function.BinaryOperator;
|
|||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.ruoyi.common.constant.Constants.TOPMOST_PRODUCT_CATEGORY_ID;
|
||||
import static com.ruoyi.common.constant.Constants.WEIGHT_DEFAULT_ZERO;
|
||||
|
||||
/**
|
||||
|
|
@ -518,8 +519,6 @@ public class GtAndFhbBiz22222222Controller extends BaseController {
|
|||
.setSaleWeight(WEIGHT_DEFAULT_ZERO.toString()).setRecommendWeight(WEIGHT_DEFAULT_ZERO.toString())
|
||||
.setPopularityWeight(WEIGHT_DEFAULT_ZERO.toString())
|
||||
.setMainPicUrl("").setMainPicName("").setMainPicSize(BigDecimal.ZERO)
|
||||
.setParCateId(ObjectUtils.isNotEmpty(parCate) ? parCate.getId().toString() : "")
|
||||
.setParCateName(ObjectUtils.isNotEmpty(parCate) ? parCate.getName() : "")
|
||||
.setProdPrice(ObjectUtils.isNotEmpty(prodMinPrice) ? prodMinPrice.toString() : "")
|
||||
.setSeason(ObjectUtils.isNotEmpty(cateAttr) ? cateAttr.getSuitableSeason() : "")
|
||||
.setProdStatus(product.getProdStatus().toString())
|
||||
|
|
@ -528,6 +527,11 @@ public class GtAndFhbBiz22222222Controller extends BaseController {
|
|||
.setStoreName(ObjectUtils.isNotEmpty(store) ? store.getStoreName() : "")
|
||||
.setStyle(ObjectUtils.isNotEmpty(cateAttr) ? cateAttr.getStyle() : "")
|
||||
.setProdTitle(product.getProdTitle());
|
||||
if (ObjectUtils.isNotEmpty(parCate)) {
|
||||
// 如果父级分类为顶层分类,则prodCateId 和 parCateId 一样即可
|
||||
esProductDTO.setParCateId(Objects.equals(parCate.getId(), TOPMOST_PRODUCT_CATEGORY_ID) ? product.getProdCateId().toString() : parCate.getId().toString())
|
||||
.setParCateName(Objects.equals(parCate.getId(), TOPMOST_PRODUCT_CATEGORY_ID) ? cate.getName() : parCate.getName());
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(cateAttr) && StringUtils.isNotBlank(cateAttr.getStyle())) {
|
||||
esProductDTO.setTags(Collections.singletonList(cateAttr.getStyle()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ import java.util.function.BinaryOperator;
|
|||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.ruoyi.common.constant.Constants.TOPMOST_PRODUCT_CATEGORY_ID;
|
||||
import static com.ruoyi.common.constant.Constants.WEIGHT_DEFAULT_ZERO;
|
||||
|
||||
/**
|
||||
|
|
@ -584,8 +585,6 @@ public class GtAndFhbBizController extends BaseController {
|
|||
.setSaleWeight(WEIGHT_DEFAULT_ZERO.toString()).setRecommendWeight(WEIGHT_DEFAULT_ZERO.toString())
|
||||
.setPopularityWeight(WEIGHT_DEFAULT_ZERO.toString())
|
||||
.setMainPicUrl("").setMainPicName("").setMainPicSize(BigDecimal.ZERO)
|
||||
.setParCateId(ObjectUtils.isNotEmpty(parCate) ? parCate.getId().toString() : "")
|
||||
.setParCateName(ObjectUtils.isNotEmpty(parCate) ? parCate.getName() : "")
|
||||
.setProdPrice(ObjectUtils.isNotEmpty(prodMinPrice) ? prodMinPrice.toString() : "")
|
||||
.setSeason(ObjectUtils.isNotEmpty(cateAttr) ? cateAttr.getSuitableSeason() : "")
|
||||
.setProdStatus(product.getProdStatus().toString())
|
||||
|
|
@ -594,6 +593,11 @@ public class GtAndFhbBizController extends BaseController {
|
|||
.setStoreName(ObjectUtils.isNotEmpty(store) ? store.getStoreName() : "")
|
||||
.setStyle(ObjectUtils.isNotEmpty(cateAttr) ? cateAttr.getStyle() : "")
|
||||
.setProdTitle(product.getProdTitle());
|
||||
if (ObjectUtils.isNotEmpty(parCate)) {
|
||||
// 如果父级分类为顶层分类,则prodCateId 和 parCateId 一样即可
|
||||
esProductDTO.setParCateId(Objects.equals(parCate.getId(), TOPMOST_PRODUCT_CATEGORY_ID) ? product.getProdCateId().toString() : parCate.getId().toString())
|
||||
.setParCateName(Objects.equals(parCate.getId(), TOPMOST_PRODUCT_CATEGORY_ID) ? cate.getName() : parCate.getName());
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(cateAttr) && StringUtils.isNotBlank(cateAttr.getStyle())) {
|
||||
esProductDTO.setTags(Collections.singletonList(cateAttr.getStyle()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ import java.util.*;
|
|||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.ruoyi.common.constant.Constants.TOPMOST_PRODUCT_CATEGORY_ID;
|
||||
import static com.ruoyi.common.constant.Constants.WEIGHT_DEFAULT_ZERO;
|
||||
|
||||
/**
|
||||
|
|
@ -526,8 +527,6 @@ public class GtAndTyBiz222222Controller extends BaseController {
|
|||
.setSaleWeight(WEIGHT_DEFAULT_ZERO.toString()).setRecommendWeight(WEIGHT_DEFAULT_ZERO.toString())
|
||||
.setPopularityWeight(WEIGHT_DEFAULT_ZERO.toString())
|
||||
.setMainPicUrl("").setMainPicName("").setMainPicSize(BigDecimal.ZERO)
|
||||
.setParCateId(ObjectUtils.isNotEmpty(parCate) ? parCate.getId().toString() : "")
|
||||
.setParCateName(ObjectUtils.isNotEmpty(parCate) ? parCate.getName() : "")
|
||||
.setProdPrice(ObjectUtils.isNotEmpty(prodMinPrice) ? prodMinPrice.toString() : "")
|
||||
.setSeason(ObjectUtils.isNotEmpty(cateAttr) ? cateAttr.getSuitableSeason() : "")
|
||||
.setProdStatus(product.getProdStatus().toString())
|
||||
|
|
@ -536,6 +535,11 @@ public class GtAndTyBiz222222Controller extends BaseController {
|
|||
.setStoreName(ObjectUtils.isNotEmpty(store) ? store.getStoreName() : "")
|
||||
.setStyle(ObjectUtils.isNotEmpty(cateAttr) ? cateAttr.getStyle() : "")
|
||||
.setProdTitle(product.getProdTitle());
|
||||
if (ObjectUtils.isNotEmpty(parCate)) {
|
||||
// 如果父级分类为顶层分类,则prodCateId 和 parCateId 一样即可
|
||||
esProductDTO.setParCateId(Objects.equals(parCate.getId(), TOPMOST_PRODUCT_CATEGORY_ID) ? product.getProdCateId().toString() : parCate.getId().toString())
|
||||
.setParCateName(Objects.equals(parCate.getId(), TOPMOST_PRODUCT_CATEGORY_ID) ? cate.getName() : parCate.getName());
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(cateAttr) && StringUtils.isNotBlank(cateAttr.getStyle())) {
|
||||
esProductDTO.setTags(Collections.singletonList(cateAttr.getStyle()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,7 @@ import java.util.*;
|
|||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.ruoyi.common.constant.Constants.TOPMOST_PRODUCT_CATEGORY_ID;
|
||||
import static com.ruoyi.common.constant.Constants.WEIGHT_DEFAULT_ZERO;
|
||||
|
||||
/**
|
||||
|
|
@ -568,8 +569,6 @@ public class GtAndTyBizController extends BaseController {
|
|||
.setSaleWeight(WEIGHT_DEFAULT_ZERO.toString()).setRecommendWeight(WEIGHT_DEFAULT_ZERO.toString())
|
||||
.setPopularityWeight(WEIGHT_DEFAULT_ZERO.toString())
|
||||
.setMainPicUrl("").setMainPicName("").setMainPicSize(BigDecimal.ZERO)
|
||||
.setParCateId(ObjectUtils.isNotEmpty(parCate) ? parCate.getId().toString() : "")
|
||||
.setParCateName(ObjectUtils.isNotEmpty(parCate) ? parCate.getName() : "")
|
||||
.setProdPrice(ObjectUtils.isNotEmpty(prodMinPrice) ? prodMinPrice.toString() : "")
|
||||
.setSeason(ObjectUtils.isNotEmpty(cateAttr) ? cateAttr.getSuitableSeason() : "")
|
||||
.setProdStatus(product.getProdStatus().toString())
|
||||
|
|
@ -578,6 +577,11 @@ public class GtAndTyBizController extends BaseController {
|
|||
.setStoreName(ObjectUtils.isNotEmpty(store) ? store.getStoreName() : "")
|
||||
.setStyle(ObjectUtils.isNotEmpty(cateAttr) ? cateAttr.getStyle() : "")
|
||||
.setProdTitle(product.getProdTitle());
|
||||
if (ObjectUtils.isNotEmpty(parCate)) {
|
||||
// 如果父级分类为顶层分类,则prodCateId 和 parCateId 一样即可
|
||||
esProductDTO.setParCateId(Objects.equals(parCate.getId(), TOPMOST_PRODUCT_CATEGORY_ID) ? product.getProdCateId().toString() : parCate.getId().toString())
|
||||
.setParCateName(Objects.equals(parCate.getId(), TOPMOST_PRODUCT_CATEGORY_ID) ? cate.getName() : parCate.getName());
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(cateAttr) && StringUtils.isNotBlank(cateAttr.getStyle())) {
|
||||
esProductDTO.setTags(Collections.singletonList(cateAttr.getStyle()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,6 +42,7 @@ import java.util.*;
|
|||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.ruoyi.common.constant.Constants.TOPMOST_PRODUCT_CATEGORY_ID;
|
||||
import static com.ruoyi.common.constant.Constants.WEIGHT_DEFAULT_ZERO;
|
||||
|
||||
/**
|
||||
|
|
@ -278,8 +279,6 @@ public class GtOnlyBizController extends BaseController {
|
|||
.setSaleWeight(WEIGHT_DEFAULT_ZERO.toString()).setRecommendWeight(WEIGHT_DEFAULT_ZERO.toString())
|
||||
.setPopularityWeight(WEIGHT_DEFAULT_ZERO.toString())
|
||||
.setMainPicUrl("").setMainPicName("").setMainPicSize(BigDecimal.ZERO)
|
||||
.setParCateId(ObjectUtils.isNotEmpty(parCate) ? parCate.getId().toString() : "")
|
||||
.setParCateName(ObjectUtils.isNotEmpty(parCate) ? parCate.getName() : "")
|
||||
.setProdPrice(ObjectUtils.isNotEmpty(prodMinPrice) ? prodMinPrice.toString() : "")
|
||||
.setSeason(ObjectUtils.isNotEmpty(cateAttr) ? cateAttr.getSuitableSeason() : "")
|
||||
.setProdStatus(product.getProdStatus().toString())
|
||||
|
|
@ -288,6 +287,11 @@ public class GtOnlyBizController extends BaseController {
|
|||
.setStoreName(ObjectUtils.isNotEmpty(store) ? store.getStoreName() : "")
|
||||
.setStyle(ObjectUtils.isNotEmpty(cateAttr) ? cateAttr.getStyle() : "")
|
||||
.setProdTitle(product.getProdTitle());
|
||||
if (ObjectUtils.isNotEmpty(parCate)) {
|
||||
// 如果父级分类为顶层分类,则prodCateId 和 parCateId 一样即可
|
||||
esProductDTO.setParCateId(Objects.equals(parCate.getId(), TOPMOST_PRODUCT_CATEGORY_ID) ? product.getProdCateId().toString() : parCate.getId().toString())
|
||||
.setParCateName(Objects.equals(parCate.getId(), TOPMOST_PRODUCT_CATEGORY_ID) ? cate.getName() : parCate.getName());
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(cateAttr) && StringUtils.isNotBlank(cateAttr.getStyle())) {
|
||||
esProductDTO.setTags(Collections.singletonList(cateAttr.getStyle()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@ import java.util.*;
|
|||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.ruoyi.common.constant.Constants.TOPMOST_PRODUCT_CATEGORY_ID;
|
||||
import static com.ruoyi.common.constant.Constants.WEIGHT_DEFAULT_ZERO;
|
||||
|
||||
/**
|
||||
|
|
@ -309,8 +310,6 @@ public class GtOtherBizAfterController extends BaseController {
|
|||
.setSaleWeight(WEIGHT_DEFAULT_ZERO.toString()).setRecommendWeight(WEIGHT_DEFAULT_ZERO.toString())
|
||||
.setPopularityWeight(WEIGHT_DEFAULT_ZERO.toString())
|
||||
.setMainPicUrl("").setMainPicName("").setMainPicSize(BigDecimal.ZERO)
|
||||
.setParCateId(ObjectUtils.isNotEmpty(parCate) ? parCate.getId().toString() : "")
|
||||
.setParCateName(ObjectUtils.isNotEmpty(parCate) ? parCate.getName() : "")
|
||||
.setProdPrice(ObjectUtils.isNotEmpty(prodMinPrice) ? prodMinPrice.toString() : "")
|
||||
.setSeason(ObjectUtils.isNotEmpty(cateAttr) ? cateAttr.getSuitableSeason() : "")
|
||||
.setProdStatus(product.getProdStatus().toString())
|
||||
|
|
@ -319,6 +318,11 @@ public class GtOtherBizAfterController extends BaseController {
|
|||
.setStoreName(ObjectUtils.isNotEmpty(store) ? store.getStoreName() : "")
|
||||
.setStyle(ObjectUtils.isNotEmpty(cateAttr) ? cateAttr.getStyle() : "")
|
||||
.setProdTitle(product.getProdTitle());
|
||||
if (ObjectUtils.isNotEmpty(parCate)) {
|
||||
// 如果父级分类为顶层分类,则prodCateId 和 parCateId 一样即可
|
||||
esProductDTO.setParCateId(Objects.equals(parCate.getId(), TOPMOST_PRODUCT_CATEGORY_ID) ? product.getProdCateId().toString() : parCate.getId().toString())
|
||||
.setParCateName(Objects.equals(parCate.getId(), TOPMOST_PRODUCT_CATEGORY_ID) ? cate.getName() : parCate.getName());
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(cateAttr) && StringUtils.isNotBlank(cateAttr.getStyle())) {
|
||||
esProductDTO.setTags(Collections.singletonList(cateAttr.getStyle()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,6 +73,8 @@ import java.util.concurrent.TimeUnit;
|
|||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.ruoyi.common.constant.Constants.TOPMOST_PRODUCT_CATEGORY_ID;
|
||||
|
||||
/**
|
||||
* 鞋库通定时任务
|
||||
*
|
||||
|
|
@ -1040,8 +1042,6 @@ public class XktTask {
|
|||
.setMainPicUrl(ObjectUtils.isNotEmpty(mainPic) ? mainPic.getFileUrl() : "")
|
||||
.setMainPicName(ObjectUtils.isNotEmpty(mainPic) ? mainPic.getFileName() : "")
|
||||
.setMainPicSize(ObjectUtils.isNotEmpty(mainPic) ? mainPic.getFileSize() : BigDecimal.ZERO)
|
||||
.setParCateId(ObjectUtils.isNotEmpty(parCate) ? parCate.getId().toString() : "")
|
||||
.setParCateName(ObjectUtils.isNotEmpty(parCate) ? parCate.getName() : "")
|
||||
.setProdPrice(ObjectUtils.isNotEmpty(prodMinPrice) ? prodMinPrice.toString() : "")
|
||||
.setSeason(ObjectUtils.isNotEmpty(cateAttr) ? cateAttr.getSuitableSeason() : "")
|
||||
.setProdStatus(product.getProdStatus().toString())
|
||||
|
|
@ -1050,6 +1050,11 @@ public class XktTask {
|
|||
.setStyle(ObjectUtils.isNotEmpty(cateAttr) ? cateAttr.getStyle() : "")
|
||||
.setTags(ObjectUtils.isNotEmpty(cateAttr) ? Collections.singletonList(cateAttr.getStyle()) : new ArrayList<>())
|
||||
.setProdTitle(product.getProdTitle());
|
||||
if (ObjectUtils.isNotEmpty(parCate)) {
|
||||
// 如果父级分类为顶层分类,则prodCateId 和 parCateId 一样即可
|
||||
esProductDTO.setParCateId(Objects.equals(parCate.getId(), TOPMOST_PRODUCT_CATEGORY_ID) ? product.getProdCateId().toString() : parCate.getId().toString())
|
||||
.setParCateName(Objects.equals(parCate.getId(), TOPMOST_PRODUCT_CATEGORY_ID) ? cate.getName() : parCate.getName());
|
||||
}
|
||||
// 创建更新操作
|
||||
BulkOperation bulkOperation = new BulkOperation.Builder()
|
||||
.index(i -> i
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ import java.time.format.DateTimeFormatter;
|
|||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.ruoyi.common.constant.Constants.TOPMOST_PRODUCT_CATEGORY_ID;
|
||||
import static com.ruoyi.common.constant.Constants.WEIGHT_DEFAULT_ZERO;
|
||||
|
||||
/**
|
||||
|
|
@ -539,8 +540,6 @@ public class ElasticSearchServiceImpl implements IElasticSearchService {
|
|||
.setSaleWeight(WEIGHT_DEFAULT_ZERO.toString()).setRecommendWeight(WEIGHT_DEFAULT_ZERO.toString())
|
||||
.setPopularityWeight(WEIGHT_DEFAULT_ZERO.toString())
|
||||
.setMainPicUrl(mainPicMap.get(product.getId())).setMainPicName("").setMainPicSize(BigDecimal.ZERO)
|
||||
.setParCateId(ObjectUtils.isNotEmpty(parCate) ? parCate.getId().toString() : "")
|
||||
.setParCateName(ObjectUtils.isNotEmpty(parCate) ? parCate.getName() : "")
|
||||
.setProdPrice(ObjectUtils.isNotEmpty(prodMinPrice) ? prodMinPrice.toString() : "")
|
||||
.setSeason(ObjectUtils.isNotEmpty(cateAttr) ? cateAttr.getSuitableSeason() : "")
|
||||
.setProdStatus(product.getProdStatus().toString()).setStoreId(product.getStoreId().toString())
|
||||
|
|
@ -548,6 +547,11 @@ public class ElasticSearchServiceImpl implements IElasticSearchService {
|
|||
.setStoreName(ObjectUtils.isNotEmpty(store) ? store.getStoreName() : "")
|
||||
.setStyle(ObjectUtils.isNotEmpty(cateAttr) ? cateAttr.getStyle() : "")
|
||||
.setProdTitle(product.getProdTitle());
|
||||
if (ObjectUtils.isNotEmpty(parCate)) {
|
||||
// 如果父级分类为顶层分类,则prodCateId 和 parCateId 一样即可
|
||||
esProductDTO.setParCateId(Objects.equals(parCate.getId(), TOPMOST_PRODUCT_CATEGORY_ID) ? product.getProdCateId().toString() : parCate.getId().toString())
|
||||
.setParCateName(Objects.equals(parCate.getId(), TOPMOST_PRODUCT_CATEGORY_ID) ? cate.getName() : parCate.getName());
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(cateAttr) && StringUtils.isNotBlank(cateAttr.getStyle())) {
|
||||
esProductDTO.setTags(Collections.singletonList(cateAttr.getStyle()));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1185,7 +1185,10 @@ public class StoreProductServiceImpl implements IStoreProductService {
|
|||
.setProdCateName(updateDTO.getProdCateName()).setStoreName(storeName).setMainPicUrl(firstMainPic)
|
||||
.setCreateTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, storeProd.getCreateTime()))
|
||||
.setSaleWeight(WEIGHT_DEFAULT_ZERO.toString()).setRecommendWeight(WEIGHT_DEFAULT_ZERO.toString()).setPopularityWeight(WEIGHT_DEFAULT_ZERO.toString())
|
||||
.setParCateId(parCate.getProdCateId().toString()).setParCateName(parCate.getName()).setProdPrice(minPrice.toString());
|
||||
// 如果父级分类为顶层分类,则prodCateId 和 parCateId 一样即可
|
||||
.setParCateId(Objects.equals(parCate.getProdCateId(), TOPMOST_PRODUCT_CATEGORY_ID) ? updateDTO.getProdCateId().toString() : parCate.getProdCateId().toString())
|
||||
.setParCateName(Objects.equals(parCate.getProdCateId(), TOPMOST_PRODUCT_CATEGORY_ID) ? updateDTO.getProdCateName() : parCate.getName())
|
||||
.setProdPrice(minPrice.toString());
|
||||
if (StringUtils.isNotBlank(season)) {
|
||||
esProdDTO.setSeason(season);
|
||||
}
|
||||
|
|
@ -1217,34 +1220,6 @@ public class StoreProductServiceImpl implements IStoreProductService {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 重新创建ES索引下的文档
|
||||
*
|
||||
* @param reSaleList 重新上架商品列表
|
||||
* @throws IOException
|
||||
*/
|
||||
private void reSaleCreateESDoc(List<StoreProduct> reSaleList) throws IOException {
|
||||
if (CollectionUtils.isEmpty(reSaleList)) {
|
||||
return;
|
||||
}
|
||||
List<ProductESDTO> esDTOList = this.storeProdMapper.selectESDTOList(reSaleList.stream()
|
||||
.map(StoreProduct::getId).distinct().collect(Collectors.toList()));
|
||||
Map<Long, ProductESDTO> esDTOMap = esDTOList.stream().collect(Collectors.toMap(ProductESDTO::getId, Function.identity()));
|
||||
// 构建一个批量数据集合
|
||||
List<BulkOperation> list = reSaleList.stream().map(x -> {
|
||||
final String createTime = DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, x.getCreateTime());
|
||||
final ProductESDTO esDTO = Optional.ofNullable(esDTOMap.get(x.getId())).orElseThrow(() -> new ServiceException("档口商品不存在!", HttpStatus.ERROR));
|
||||
ESProductDTO esProductDTO = BeanUtil.toBean(x, ESProductDTO.class).setProdCateName(esDTO.getProdCateName()).setMainPicUrl(esDTO.getMainPic())
|
||||
.setParCateId(esDTO.getParCateId()).setParCateName(esDTO.getParCateName()).setProdPrice(esDTO.getProdPrice()).setStoreName(esDTO.getStoreName())
|
||||
.setSeason(esDTO.getSeason()).setStyle(esDTO.getStyle()).setCreateTime(createTime);
|
||||
return new BulkOperation.Builder().create(d -> d.document(esProductDTO).id(String.valueOf(x.getId()))
|
||||
.index(ES_INDEX_NAME)).build();
|
||||
}).collect(Collectors.toList());
|
||||
// 调用bulk方法执行批量插入操作
|
||||
BulkResponse bulkResponse = esClientWrapper.getEsClient().bulk(e -> e.index(ES_INDEX_NAME).operations(list));
|
||||
System.out.println("bulkResponse.items() = " + bulkResponse.items());
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜图服务同步商品
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue