|
@@ -210,8 +210,8 @@ public class SearchIndexServiceImpl implements SearchIndexService {
|
|
if (promotionIds != null && promotionIds.size() > 0) {
|
|
if (promotionIds != null && promotionIds.size() > 0) {
|
|
product.setP_promotions_id(promotionIds.get(0));
|
|
product.setP_promotions_id(promotionIds.get(0));
|
|
}
|
|
}
|
|
- // 定义星范商品数据
|
|
|
|
- List<DocumentDTO<MallProductDO>> mallProductList = new ArrayList<>();
|
|
|
|
|
|
+// // 定义星范商品数据
|
|
|
|
+// List<DocumentDTO<MallProductDO>> mallProductList = new ArrayList<>();
|
|
// // 星范商品设值,【必须先于商品文档设值】
|
|
// // 星范商品设值,【必须先于商品文档设值】
|
|
// Integer mallId = setMallProductDocument(mallProductList, productId);
|
|
// Integer mallId = setMallProductDocument(mallProductList, productId);
|
|
// 定义商品文档数据
|
|
// 定义商品文档数据
|
|
@@ -238,7 +238,7 @@ public class SearchIndexServiceImpl implements SearchIndexService {
|
|
return updateProductIndexById(productId);
|
|
return updateProductIndexById(productId);
|
|
} else {
|
|
} else {
|
|
// 推送到阿里云
|
|
// 推送到阿里云
|
|
- pushProductDocument(mainList, productList, mallProductList);
|
|
|
|
|
|
+ pushProductDocument(mainList, productList/*, mallProductList*/);
|
|
// 返回结果
|
|
// 返回结果
|
|
return ResponseJson.success(mainList.size());
|
|
return ResponseJson.success(mainList.size());
|
|
}
|
|
}
|
|
@@ -605,8 +605,8 @@ public class SearchIndexServiceImpl implements SearchIndexService {
|
|
// 获取数据库商品列表的分页数据
|
|
// 获取数据库商品列表的分页数据
|
|
List<ProductDO> dbList = searchMapper.searchProductList();
|
|
List<ProductDO> dbList = searchMapper.searchProductList();
|
|
|
|
|
|
- // 定义星范商品数据
|
|
|
|
- List<DocumentDTO<MallProductDO>> mallProductList = new ArrayList<>();
|
|
|
|
|
|
+// // 定义星范商品数据
|
|
|
|
+// List<DocumentDTO<MallProductDO>> mallProductList = new ArrayList<>();
|
|
// 定义商品文档数据
|
|
// 定义商品文档数据
|
|
List<DocumentDTO<ProductDO>> productList = new ArrayList<>();
|
|
List<DocumentDTO<ProductDO>> productList = new ArrayList<>();
|
|
// 定义主文档入口数据
|
|
// 定义主文档入口数据
|
|
@@ -640,7 +640,7 @@ public class SearchIndexServiceImpl implements SearchIndexService {
|
|
}
|
|
}
|
|
try {
|
|
try {
|
|
// 推送到阿里云
|
|
// 推送到阿里云
|
|
- pushProductDocument(mainList, productList, mallProductList);
|
|
|
|
|
|
+ pushProductDocument(mainList, productList/*, mallProductList*/);
|
|
// 添加到返回结果
|
|
// 添加到返回结果
|
|
productRecord += mainList.size();
|
|
productRecord += mainList.size();
|
|
} catch (OpenSearchClientException | OpenSearchException | JSONException e) {
|
|
} catch (OpenSearchClientException | OpenSearchException | JSONException e) {
|
|
@@ -656,11 +656,11 @@ public class SearchIndexServiceImpl implements SearchIndexService {
|
|
*
|
|
*
|
|
* @param mainList list
|
|
* @param mainList list
|
|
* @param productList list
|
|
* @param productList list
|
|
- * @param mallProductList list
|
|
|
|
|
|
+ * // @param mallProductList list
|
|
* @throws OpenSearchClientException exp
|
|
* @throws OpenSearchClientException exp
|
|
* @throws OpenSearchException exp
|
|
* @throws OpenSearchException exp
|
|
*/
|
|
*/
|
|
- private void pushProductDocument(List<DocumentDTO<MainDO>> mainList, List<DocumentDTO<ProductDO>> productList, List<DocumentDTO<MallProductDO>> mallProductList) throws OpenSearchClientException, OpenSearchException {
|
|
|
|
|
|
+ private void pushProductDocument(List<DocumentDTO<MainDO>> mainList, List<DocumentDTO<ProductDO>> productList/*, List<DocumentDTO<MallProductDO>> mallProductList*/) throws OpenSearchClientException, OpenSearchException {
|
|
if (mainList.size() > 0) {
|
|
if (mainList.size() > 0) {
|
|
// 将主文档列表转换成Json串,并推送到阿里云
|
|
// 将主文档列表转换成Json串,并推送到阿里云
|
|
String mainDocStr = new JSONArray(mainList).toString();
|
|
String mainDocStr = new JSONArray(mainList).toString();
|
|
@@ -677,12 +677,12 @@ public class SearchIndexServiceImpl implements SearchIndexService {
|
|
// 更新
|
|
// 更新
|
|
log.info(">>>>>>>>>>>>>>>update document: 【search_product(" + productList.size() + "个):" + productResult + "】");
|
|
log.info(">>>>>>>>>>>>>>>update document: 【search_product(" + productList.size() + "个):" + productResult + "】");
|
|
}
|
|
}
|
|
- // 将星范商品推送到阿里云
|
|
|
|
- if (mallProductList.size() > 0) {
|
|
|
|
- String mallProductStr = new JSONArray(mallProductList).toString();
|
|
|
|
- String mallProductResult = searchOpenService.pushDocument(mallProductStr, "search_product_mall");
|
|
|
|
- log.info(">>>>>>>>>>>>>>>add document: 【search_product_mall(" + mallProductList.size() + "):" + mallProductResult + "】");
|
|
|
|
- }
|
|
|
|
|
|
+// // 将星范商品推送到阿里云
|
|
|
|
+// if (mallProductList.size() > 0) {
|
|
|
|
+// String mallProductStr = new JSONArray(mallProductList).toString();
|
|
|
|
+// String mallProductResult = searchOpenService.pushDocument(mallProductStr, "search_product_mall");
|
|
|
|
+// log.info(">>>>>>>>>>>>>>>add document: 【search_product_mall(" + mallProductList.size() + "):" + mallProductResult + "】");
|
|
|
|
+// }
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1087,34 +1087,34 @@ public class SearchIndexServiceImpl implements SearchIndexService {
|
|
return docsJsonArr.toString();
|
|
return docsJsonArr.toString();
|
|
}
|
|
}
|
|
|
|
|
|
- /**
|
|
|
|
- * 商品星范商品设值
|
|
|
|
- *
|
|
|
|
- * @param mallProductList list
|
|
|
|
- * @param productId int
|
|
|
|
- */
|
|
|
|
- private Integer setMallProductDocument(List<DocumentDTO<MallProductDO>> mallProductList, Integer productId) {
|
|
|
|
- // 是否是星范商品
|
|
|
|
- int mallCount = searchMapper.countMallProduct(productId);
|
|
|
|
- if (mallCount >= 1) {
|
|
|
|
- MallProductDO mallProduct = searchMapper.searchMallProductByProductId(productId);
|
|
|
|
- // 是否有阶梯价
|
|
|
|
- Integer mallLadderFlag = searchMapper.getMallLadderPriceFlag(productId);
|
|
|
|
- if (mallLadderFlag == 1) {
|
|
|
|
- // 阶梯价
|
|
|
|
- Double mallLadderPrice = searchMapper.getMallLowerLadderPrice(productId);
|
|
|
|
- mallProduct.setM_price(mallLadderPrice);
|
|
|
|
- }
|
|
|
|
- mallProduct.setM_all(1);
|
|
|
|
- // 搜索星范商品数据
|
|
|
|
- DocumentDTO<MallProductDO> mallProductDoc = new DocumentDTO<>();
|
|
|
|
- mallProductDoc.setCmd("add");
|
|
|
|
- mallProductDoc.setFields(mallProduct);
|
|
|
|
- mallProductList.add(mallProductDoc);
|
|
|
|
- return mallProduct.getM_id();
|
|
|
|
- }
|
|
|
|
- return 0;
|
|
|
|
- }
|
|
|
|
|
|
+// /**
|
|
|
|
+// * 商品星范商品设值
|
|
|
|
+// *
|
|
|
|
+// * @param mallProductList list
|
|
|
|
+// * @param productId int
|
|
|
|
+// */
|
|
|
|
+// private Integer setMallProductDocument(List<DocumentDTO<MallProductDO>> mallProductList, Integer productId) {
|
|
|
|
+// // 是否是星范商品
|
|
|
|
+// int mallCount = searchMapper.countMallProduct(productId);
|
|
|
|
+// if (mallCount >= 1) {
|
|
|
|
+// MallProductDO mallProduct = searchMapper.searchMallProductByProductId(productId);
|
|
|
|
+// // 是否有阶梯价
|
|
|
|
+// Integer mallLadderFlag = searchMapper.getMallLadderPriceFlag(productId);
|
|
|
|
+// if (mallLadderFlag == 1) {
|
|
|
|
+// // 阶梯价
|
|
|
|
+// Double mallLadderPrice = searchMapper.getMallLowerLadderPrice(productId);
|
|
|
|
+// mallProduct.setM_price(mallLadderPrice);
|
|
|
|
+// }
|
|
|
|
+// mallProduct.setM_all(1);
|
|
|
|
+// // 搜索星范商品数据
|
|
|
|
+// DocumentDTO<MallProductDO> mallProductDoc = new DocumentDTO<>();
|
|
|
|
+// mallProductDoc.setCmd("add");
|
|
|
|
+// mallProductDoc.setFields(mallProduct);
|
|
|
|
+// mallProductList.add(mallProductDoc);
|
|
|
|
+// return mallProduct.getM_id();
|
|
|
|
+// }
|
|
|
|
+// return 0;
|
|
|
|
+// }
|
|
|
|
|
|
/**
|
|
/**
|
|
* 商品文档设值
|
|
* 商品文档设值
|