Authored by wangnan

fix use esfield

Showing 14 changed files with 113 additions and 112 deletions
package com.yoho.search.consumer.index.increment;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import com.alibaba.fastjson.JSONArray;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.consumer.service.bo.ProductGoodsBO;
import com.yoho.search.consumer.service.bo.ProductSizesBO;
import com.yoho.search.consumer.service.logicService.ProductGoodsLogicService;
import com.yoho.search.consumer.service.logicService.ProductSizesLogicService;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.*;
/**
* Created by ginozhang on 2017/2/8. 将库存相关的增量更新代码抽象到父类,被Storage和Goods的MqListener共用。
... ... @@ -28,23 +24,23 @@ public abstract class AbstractStorageRelatedMqListener extends AbstractIndexMqLi
protected void fillStorageNumAndSizeInfo(Integer productId, Map<String, Object> indexData) {
List<ProductSizesBO> productSizesBOList = productSizesLogicService.getProductSizeBOList(Arrays.asList(productId));
if (productSizesBOList == null || productSizesBOList.isEmpty()) {
indexData.put("storageNum", 0);
indexData.put("isSoonSoldOut", "Y");
indexData.put("sizeIds", "");
indexData.put("sizeNames", "");
indexData.put("breakSizePercent", 100);
indexData.put("heatValue", 0);
indexData.put("skuIds", "");
indexData.put(ProductIndexEsField.storageNum, 0);
indexData.put(ProductIndexEsField.isSoonSoldOut, "Y");
indexData.put(ProductIndexEsField.sizeIds, "");
indexData.put(ProductIndexEsField.sizeNames, "");
indexData.put(ProductIndexEsField.breakSizePercent, 100);
indexData.put(ProductIndexEsField.heatValue, 0);
indexData.put(ProductIndexEsField.skuIds, "");
return;
}
ProductSizesBO productSizesBO = productSizesBOList.get(0);
indexData.put("storageNum", productSizesBO.getStorageNum());
indexData.put("isSoonSoldOut", productSizesBO.getIsSoonSoldOut());
indexData.put("sizeIds", productSizesBO.getSizeIds());
indexData.put("sizeNames", productSizesBO.getSizeNames());
indexData.put("breakSizePercent", productSizesBO.getBreakSizePercent());
indexData.put("heatValue", productSizesBO.getHeatValue());
indexData.put("skuIds", productSizesBO.getSkuIds());
indexData.put(ProductIndexEsField.storageNum, productSizesBO.getStorageNum());
indexData.put(ProductIndexEsField.isSoonSoldOut, productSizesBO.getIsSoonSoldOut());
indexData.put(ProductIndexEsField.sizeIds, productSizesBO.getSizeIds());
indexData.put(ProductIndexEsField.sizeNames, productSizesBO.getSizeNames());
indexData.put(ProductIndexEsField.breakSizePercent, productSizesBO.getBreakSizePercent());
indexData.put(ProductIndexEsField.heatValue, productSizesBO.getHeatValue());
indexData.put(ProductIndexEsField.skuIds, productSizesBO.getSkuIds());
}
protected void fillColor(Map<String, Object> indexData, Integer productId) {
... ... @@ -58,13 +54,13 @@ public abstract class AbstractStorageRelatedMqListener extends AbstractIndexMqLi
JSONArray goodsListJsonArray = productGoodsBO.getGoodsList();
// 获取有库存且状态正常的color
productGoodsLogicService.getColorSet(goodsListJsonArray, colorIdSet, colorNameSet);
indexData.put("goodsList", goodsListJsonArray);
indexData.put("colorIds", StringUtils.join(colorIdSet, ","));
indexData.put("colorNames", StringUtils.join(colorNameSet, ","));
indexData.put(ProductIndexEsField.goodsList, goodsListJsonArray);
indexData.put(ProductIndexEsField.colorIds, StringUtils.join(colorIdSet, ","));
indexData.put(ProductIndexEsField.colorNames, StringUtils.join(colorNameSet, ","));
} else {
indexData.put("goodsList", new JSONArray());
indexData.put("colorIds", "");
indexData.put("colorNames", "");
indexData.put(ProductIndexEsField.goodsList, new JSONArray());
indexData.put(ProductIndexEsField.colorIds, "");
indexData.put(ProductIndexEsField.colorNames, "");
}
}
}
\ No newline at end of file
... ...
package com.yoho.search.consumer.index.increment.flow;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.elasticsearch.action.bulk.BulkResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSONObject;
import com.yoho.search.base.utils.ISearchConstants;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.consumer.index.common.IYohoIndexService;
import com.yoho.search.consumer.index.rebuild.RebuildFlagService;
import com.yoho.search.consumer.service.daoService.ProductService;
... ... @@ -25,6 +13,18 @@ import com.yoho.search.consumer.suggests.common.RetryBusinessFlow;
import com.yoho.search.core.es.IElasticsearchClient;
import com.yoho.search.core.es.model.ESBluk;
import com.yoho.search.dal.model.Product;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils;
import org.elasticsearch.action.bulk.BulkResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* Created by ginozhang on 2017/3/17.
... ... @@ -103,13 +103,13 @@ public class ProductIndexFeatureVectorUpdateFlow implements RetryBusinessFlow {
String vector = productVectorFeatureMapBaseSkn.get(product.getErpProductId());
JSONObject updateData = new JSONObject();
if (StringUtils.isBlank(vector)) {
updateData.put("id", productId);
updateData.put("productFeatureFactor", "");
updateData.put("productFeatureFactorExist", "N");
updateData.put(ProductIndexEsField.id, productId);
updateData.put(ProductIndexEsField.productFeatureFactor, "");
updateData.put(ProductIndexEsField.productFeatureFactorExist, "N");
} else {
updateData.put("id", productId);
updateData.put("productFeatureFactor", vector);
updateData.put("productFeatureFactorExist", "Y");
updateData.put(ProductIndexEsField.id, productId);
updateData.put(ProductIndexEsField.productFeatureFactor, vector);
updateData.put(ProductIndexEsField.productFeatureFactorExist, "Y");
}
dataList.add(updateData);
}
... ...
... ... @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yoho.search.base.utils.ConvertUtils;
import com.yoho.search.base.utils.EventReportEnum;
import com.yoho.search.base.utils.ISearchConstants;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.consumer.common.CostStatistics;
import com.yoho.search.consumer.index.increment.AbstractStorageRelatedMqListener;
import com.yoho.search.consumer.service.daoService.GoodsService;
... ... @@ -121,12 +122,12 @@ public class GoodsMqListener extends AbstractStorageRelatedMqListener {
}
}
if (sknInvalid) {
indexData.put("status", 0);
indexData.put(ProductIndexEsField.status, 0);
} else {
// 需要检查product表的status字段,如果为1才更新状态,为0则以product表的状态为准
Product product = productService.getById(productId);
if (product != null && product.getStatus() == 1) {
indexData.put("status", 1);
indexData.put(ProductIndexEsField.status, 1);
}
}
}
... ...
... ... @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yoho.search.base.utils.ConvertUtils;
import com.yoho.search.base.utils.EventReportEnum;
import com.yoho.search.base.utils.ISearchConstants;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.consumer.common.CostStatistics;
import com.yoho.search.consumer.index.increment.AbstractIndexMqListener;
import com.yoho.search.consumer.service.daoService.ProductActivitiesLinkService;
... ... @@ -65,8 +66,8 @@ public class ProductActivitiesLinkMqListener extends AbstractIndexMqListener {
logger.info("[func=deleteData][step(3/4)selectProductIdBySkn][productSkn={}][cost={}ms]", productSkn, costStatistics.getCost());
// 第四步:更新该商品索引
Map<String, Object> indexData = new HashMap<String, Object>();
indexData.put("productId", productId);
indexData.put("yohoodId", this.getYohoodIdByProductSkn(productSkn, Integer.valueOf(id)));
indexData.put(ProductIndexEsField.productId, productId);
indexData.put(ProductIndexEsField.yohoodId, this.getYohoodIdByProductSkn(productSkn, Integer.valueOf(id)));
this.updateProductIndexWithDataMap(indexData, productId);
logger.info("[func=deleteData][step(4/4)updateProductIndexWithDataMap][productSkn={}][cost={}ms]", productSkn, costStatistics.getCost());
... ... @@ -95,8 +96,8 @@ public class ProductActivitiesLinkMqListener extends AbstractIndexMqListener {
}
// 第四步:增量更新商品列表索引
Map<String, Object> indexData = new HashMap<String, Object>();
indexData.put("productId", productId);
indexData.put("yohoodId", this.getYohoodIdByProductSkn(productSkn, null));
indexData.put(ProductIndexEsField.productId, productId);
indexData.put(ProductIndexEsField.yohoodId, this.getYohoodIdByProductSkn(productSkn, null));
this.updateProductIndexWithDataMap(indexData, productId);
logger.info("[func=updateData][step(3/3)updateProductIndexWithDataMap][productSkn={}][cost={}ms]", productSkn, costStatistics.getCost());
}
... ...
package com.yoho.search.consumer.index.increment.productIndex;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSONObject;
import com.yoho.search.base.utils.ConvertUtils;
import com.yoho.search.base.utils.EventReportEnum;
import com.yoho.search.base.utils.ISearchConstants;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.consumer.index.common.IYohoIndexService;
import com.yoho.search.consumer.index.increment.AbstractIndexMqListener;
import com.yoho.search.consumer.service.daoService.ProductAttributeService;
import com.yoho.search.consumer.service.daoService.ProductService;
import com.yoho.search.dal.model.Product;
import com.yoho.search.dal.model.ProductAttributePropertyValues;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
@Component
public class ProductAttributePropertyValuesMqListener extends AbstractIndexMqListener {
... ... @@ -54,7 +54,7 @@ public class ProductAttributePropertyValuesMqListener extends AbstractIndexMqLis
// 更新ES数据
Map<String, Object> data = new HashMap<String, Object>();
String attributeNames = getAttributeNames(productAttributePropertyValues.getProductSkn());
data.put("attributeNames", attributeNames);
data.put(ProductIndexEsField.attributeNames, attributeNames);
indexService.updateIndexData(this.getIndexName(), product.getId().toString(), data);
}
... ... @@ -74,7 +74,7 @@ public class ProductAttributePropertyValuesMqListener extends AbstractIndexMqLis
// 更新es数据
Map<String, Object> esData = new HashMap<String, Object>();
String attributeNames = getAttributeNames(productAttributePropertyValues.getProductSkn());
esData.put("attributeNames", attributeNames);
esData.put(ProductIndexEsField.attributeNames, attributeNames);
indexService.updateIndexData(this.getIndexName(), product.getId().toString(), esData);
}
... ...
... ... @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yoho.search.base.utils.ConvertUtils;
import com.yoho.search.base.utils.EventReportEnum;
import com.yoho.search.base.utils.ISearchConstants;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.consumer.index.common.IYohoIndexService;
import com.yoho.search.consumer.index.increment.AbstractIndexMqListener;
import com.yoho.search.consumer.service.daoService.ProductExtService;
... ... @@ -52,9 +53,9 @@ public class ProductExtMqListener extends AbstractIndexMqListener {
}
// 更新ES数据
Map<String, Object> data = new HashMap<String, Object>();
data.put("sknDefaultImg", "");
data.put("deposit", "");
data.put("depositMultiples", "");
data.put(ProductIndexEsField.sknDefaultImg, "");
data.put(ProductIndexEsField.deposit, "");
data.put(ProductIndexEsField.depositMultiples, "");
indexService.updateIndexData(this.getIndexName(), product.getId().toString(), data);
}
... ... @@ -74,9 +75,9 @@ public class ProductExtMqListener extends AbstractIndexMqListener {
}
// 更新es数据
Map<String, Object> esData = new HashMap<String, Object>();
esData.put("sknDefaultImg", productExt.getSknDefaultImg() == null ? "" : productExt.getSknDefaultImg());
esData.put("deposit", productExt.getDeposit() == null ? "" : productExt.getDeposit());
esData.put("depositMultiples", productExt.getDepositMultiples() == null ? "" : productExt.getDepositMultiples());
esData.put(ProductIndexEsField.sknDefaultImg, productExt.getSknDefaultImg() == null ? "" : productExt.getSknDefaultImg());
esData.put(ProductIndexEsField.deposit, productExt.getDeposit() == null ? "" : productExt.getDeposit());
esData.put(ProductIndexEsField.depositMultiples, productExt.getDepositMultiples() == null ? "" : productExt.getDepositMultiples());
indexService.updateIndexData(this.getIndexName(), productId.toString(), esData);
}
... ...
... ... @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yoho.search.base.utils.ConvertUtils;
import com.yoho.search.base.utils.EventReportEnum;
import com.yoho.search.base.utils.ISearchConstants;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.consumer.index.increment.AbstractIndexMqListener;
import com.yoho.search.consumer.service.daoService.ProductKeywordsService;
import com.yoho.search.dal.model.ProductKeywords;
... ... @@ -58,8 +59,8 @@ public class ProductKeywordsMqListener extends AbstractIndexMqListener {
private void updateProductIndex(Integer productId, String productKeyword) {
Map<String, Object> indexData = new HashMap<String, Object>();
indexData.put("productId", productId);
indexData.put("productKeyword", productKeyword);
indexData.put(ProductIndexEsField.productId, productId);
indexData.put(ProductIndexEsField.productKeyword, productKeyword);
this.updateProductIndexWithDataMap(indexData, productId);
}
... ...
... ... @@ -5,13 +5,14 @@ import com.alibaba.fastjson.JSONObject;
import com.yoho.search.base.utils.ConvertUtils;
import com.yoho.search.base.utils.EventReportEnum;
import com.yoho.search.base.utils.ISearchConstants;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.consumer.common.CostStatistics;
import com.yoho.search.consumer.index.common.IYohoIndexService;
import com.yoho.search.consumer.index.fullbuild.ProductIndexIndexBuilder;
import com.yoho.search.consumer.index.increment.AbstractIndexMqListener;
import com.yoho.search.consumer.service.daoService.ProductService;
import com.yoho.search.consumer.service.bo.ProductIBO;
import com.yoho.search.consumer.service.bo.ProductPriceBO;
import com.yoho.search.consumer.service.daoService.ProductService;
import com.yoho.search.consumer.service.logicService.ProductPriceBOLogicService;
import com.yoho.search.consumer.service.logicService.productIndex.ProductCustomizeTagBuilder;
import com.yoho.search.dal.model.Product;
... ... @@ -99,12 +100,12 @@ public class ProductMqListener extends AbstractIndexMqListener {
// 3、构建更新对象
JSONObject jsonObject = (JSONObject) JSON.toJSON(productIBO);
if (!isUpdate) {
jsonObject.put("salesNum", 0);
jsonObject.put(ProductIndexEsField.salesNum, 0);
}
if (productPriceBO != null) {
jsonObject.putAll((JSONObject) JSON.toJSON(productPriceBO));
}
jsonObject.put("customizeTags", productCustomizeTagBuilder.getCustomizeTags(productIBO.getIspromotion()));
jsonObject.put(ProductIndexEsField.customizeTags, productCustomizeTagBuilder.getCustomizeTags(productIBO.getIspromotion()));
// 4、更新到ES
try {
this.updateProductIndexWithDataMap(jsonObject, productId);
... ...
... ... @@ -5,6 +5,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yoho.search.base.utils.ConvertUtils;
import com.yoho.search.base.utils.EventReportEnum;
import com.yoho.search.base.utils.ISearchConstants;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.consumer.common.CostStatistics;
import com.yoho.search.consumer.index.increment.AbstractIndexMqListener;
import com.yoho.search.consumer.service.daoService.ProductPoolDetailService;
... ... @@ -107,9 +108,9 @@ public class ProductPoolDetailMqListener extends AbstractIndexMqListener {
Integer productId = productService.selectProductIdBySkn(productPoolDetail.getProductSkn());
if (productId != null) {
Map<String, Object> indexData = new HashMap<String, Object>();
indexData.put("productId", productId);
indexData.put("poolId", poolId.toString());
indexData.put("pools", pools);
indexData.put(ProductIndexEsField.productId, productId);
indexData.put(ProductIndexEsField.poolId, poolId.toString());
indexData.put(ProductIndexEsField.pools, pools);
this.updateProductIndexWithDataMap(indexData, productId);
}
}
... ...
package com.yoho.search.consumer.index.increment.productIndex;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSONObject;
import com.yoho.search.base.utils.ConvertUtils;
import com.yoho.search.base.utils.EventReportEnum;
import com.yoho.search.base.utils.ISearchConstants;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.consumer.index.increment.AbstractIndexMqListener;
import com.yoho.search.consumer.service.daoService.ProductStandardRelationService;
import com.yoho.search.dal.model.ProductStandardRelation;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.*;
@Component
public class ProductStandardRelationMqListener extends AbstractIndexMqListener {
... ... @@ -105,10 +101,10 @@ public class ProductStandardRelationMqListener extends AbstractIndexMqListener {
}
}
Map<String, Object> indexData = new HashMap<String, Object>();
indexData.put("productId", productId);
indexData.put("standardIds", StringUtils.join(standardIdSet, ","));
indexData.put("standardNames", StringUtils.join(standardNameSet, ","));
indexData.put("standardOnlyNames", StringUtils.join(standardOnlyNameSet, ","));
indexData.put(ProductIndexEsField.productId, productId);
indexData.put(ProductIndexEsField.standardIds, StringUtils.join(standardIdSet, ","));
indexData.put(ProductIndexEsField.standardNames, StringUtils.join(standardNameSet, ","));
indexData.put(ProductIndexEsField.standardOnlyNames, StringUtils.join(standardOnlyNameSet, ","));
this.updateProductIndexWithDataMap(indexData, productId);
}
... ...
... ... @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yoho.search.base.utils.ConvertUtils;
import com.yoho.search.base.utils.EventReportEnum;
import com.yoho.search.base.utils.ISearchConstants;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.consumer.index.increment.AbstractIndexMqListener;
import com.yoho.search.consumer.service.daoService.ProductStyleRelationService;
import com.yoho.search.dal.model.ProductStyleRelation;
... ... @@ -74,8 +75,8 @@ public class ProductStyleRelationMqListener extends AbstractIndexMqListener{
styleIdSet.add(styleRelation.getStyleId() + "");
}
Map<String, Object> indexData = new HashMap<String, Object>();
indexData.put("productId", productId);
indexData.put("styleIds", StringUtils.join(styleIdSet, ","));
indexData.put(ProductIndexEsField.productId, productId);
indexData.put(ProductIndexEsField.styleIds, StringUtils.join(styleIdSet, ","));
this.updateProductIndexWithDataMap(indexData, productId);
}
... ...
package com.yoho.search.consumer.index.increment.productIndex;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSONObject;
import com.yoho.search.base.utils.ConvertUtils;
import com.yoho.search.base.utils.EventReportEnum;
import com.yoho.search.base.utils.ISearchConstants;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.consumer.index.increment.AbstractIndexMqListener;
import com.yoho.search.consumer.service.daoService.ProductService;
import com.yoho.search.consumer.service.daoService.ProductTimingService;
... ... @@ -22,6 +12,16 @@ import com.yoho.search.consumer.service.logicService.StorageUpdateTimeLogicServi
import com.yoho.search.dal.model.Product;
import com.yoho.search.dal.model.ProductTiming;
import com.yoho.search.dal.model.StorageUpdateTime;
import org.apache.commons.collections.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Created by wangnan on 2016/11/24.
... ... @@ -105,10 +105,10 @@ public class ProductTimingMqListener extends AbstractIndexMqListener {
List<StorageUpdateTime> storageUpdateTimes = storageUpdateTimeLogicService.getStorageUpdateTimeList(productIds, skns);
if (CollectionUtils.isNotEmpty(storageUpdateTimes)) {
StorageUpdateTime storageUpdateTime = storageUpdateTimes.get(0);
indexData.put("storageUpdateTime", storageUpdateTime.getStorageUpdateTime());
indexData.put(ProductIndexEsField.storageUpdateTime, storageUpdateTime.getStorageUpdateTime());
}
if (!indexData.isEmpty()) {
indexData.put("productId", productId);
indexData.put(ProductIndexEsField.productId, productId);
this.updateProductIndexWithDataMap(indexData, productId);
}
... ...
... ... @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yoho.search.base.utils.ConvertUtils;
import com.yoho.search.base.utils.EventReportEnum;
import com.yoho.search.base.utils.ISearchConstants;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.consumer.index.common.IYohoIndexService;
import com.yoho.search.consumer.index.increment.AbstractIndexMqListener;
import com.yoho.search.consumer.service.daoService.ProductService;
... ... @@ -60,7 +61,7 @@ public class ScoreSknRuleMqListener extends AbstractIndexMqListener {
}
// 更新ES数据
Map<String, Object> esData = new HashMap<String, Object>();
esData.put("toAddScore", "N");
esData.put(ProductIndexEsField.toAddScore, "N");
indexService.updateIndexData(this.getIndexName(), product.getId().toString(), esData);
}
... ... @@ -81,7 +82,7 @@ public class ScoreSknRuleMqListener extends AbstractIndexMqListener {
}
// 更新es数据
Map<String, Object> esData = new HashMap<String, Object>();
esData.put("toAddScore", "Y");
esData.put(ProductIndexEsField.toAddScore, "Y");
indexService.updateIndexData(this.getIndexName(), product.getId().toString(), esData);
}
}
... ...
... ... @@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.yoho.search.base.utils.ConvertUtils;
import com.yoho.search.base.utils.EventReportEnum;
import com.yoho.search.base.utils.ISearchConstants;
import com.yoho.search.base.utils.ProductIndexEsField;
import com.yoho.search.consumer.common.CostStatistics;
import com.yoho.search.consumer.index.increment.AbstractStorageRelatedMqListener;
import com.yoho.search.consumer.service.daoService.ProductService;
... ... @@ -89,7 +90,7 @@ public class StorageMqListener extends AbstractStorageRelatedMqListener {
private void updateProductIndex(Integer productId) {
Map<String, Object> indexData = new HashMap<String, Object>();
indexData.put("productId", productId);
indexData.put(ProductIndexEsField.productId, productId);
// 更新库存和尺码信息
this.fillStorageNumAndSizeInfo(productId, indexData);
// 更新color相关信息
... ... @@ -109,7 +110,7 @@ public class StorageMqListener extends AbstractStorageRelatedMqListener {
List<StorageUpdateTime> storageUpdateTimes = storageUpdateTimeLogicService.getStorageUpdateTimeList(productIds, sknList);
if (CollectionUtils.isNotEmpty(storageUpdateTimes)) {
StorageUpdateTime storageUpdateTime = storageUpdateTimes.get(0);
indexData.put("storageUpdateTime", storageUpdateTime.getStorageUpdateTime());
indexData.put(ProductIndexEsField.storageUpdateTime, storageUpdateTime.getStorageUpdateTime());
}
}
... ...