Authored by wangnan

增量使用缓存获取brand sort shop 等信息 fix

... ... @@ -164,14 +164,15 @@ public class TblProductNewIndexBuilder extends IIndexBuilder {
* 增量构建
*/
public List<ProductIndexBO> getProductIndex(List<Integer> skns) {
logger.info("[tblProduct increase begin]########################################################################################################]");
long begin = System.currentTimeMillis();
logger.info("[###########################][TblProductNewIndexBuilder.getProductIndex][increase begin]");
List<TblProduct> tblProducts = tblProductService.getByskns(skns);
if (CollectionUtils.isEmpty(tblProducts)) {
return new ArrayList<>();
}
List<ProductIndexBO> productIndexBOS = buildProductIndex(tblProducts);
logger.info("[###########################]TblProductNewIndexBuilder.getProductIndex [increase end],[size:{}],[cost: {}]", System.currentTimeMillis() - begin);
logger.info("[fun=TblProductNewIndexBuilder.getProductIndex],[size:{}],[cost: {}]", System.currentTimeMillis() - begin);
logger.info("[tblProduct increase begin]########################################################################################################]");
return productIndexBOS;
}
... ... @@ -181,7 +182,6 @@ public class TblProductNewIndexBuilder extends IIndexBuilder {
public List<ProductIndexBO> buildProductIndex(List<TblProduct> tblProducts) {
List<ProductIndexBO> productIndexBOs = new ArrayList<>();
try {
logger.info("[TblProductNewIndexBuilder.buildProductIndex] get data from cache begin");
long begin = System.currentTimeMillis();
JSONObject jsonObject = cache.get(CACHE_KEY);
if (jsonObject != null) {
... ... @@ -194,7 +194,7 @@ public class TblProductNewIndexBuilder extends IIndexBuilder {
sortIdOrderByMap = (Map<Integer, ProductSort>) jsonObject.get(SORTIDORDERBY_CACHE_KEY);
sortMapList = (List<HashMap<Integer, Integer>>) jsonObject.get(SORTMAPLIST_CACHE_KEY);
}
logger.info("[TblProductNewIndexBuilder.buildProductIndex]get data from cache end [cost: {}]",System.currentTimeMillis() - begin);
logger.info("[TblProductNewIndexBuilder.buildProductIndex]get map from cache end [cost: {}]",System.currentTimeMillis() - begin);
Map<Integer, List<TblProductSkc>> tblProductSkcMap = tblProductSkcMapBuilder.build(tblProducts);
Map<Integer, List<TblProductSku>> tblProductSkuMap = tblProductSkuMapBuilder.build(tblProducts);
// 生成ProductIndexBO
... ...
... ... @@ -123,7 +123,7 @@ public class ProductMqListener extends AbstractMqListener implements ChannelAwar
return;
}
Integer productId = product.getId();
logger.info("[increase begin]########################################################################################################]");
logger.info("[product increase begin]########################################################################################################]");
logger.info("[step 1 =conver success][key={}][productId={}][cost={}ms]", key, productId, costStatistics.getCost());
// 2、保存进数据库
... ... @@ -135,7 +135,7 @@ public class ProductMqListener extends AbstractMqListener implements ChannelAwar
// 4、打印耗时
logger.info("[step6=getCostStatisticsString][key={}][productId={}][costStatistics={}]", key, productId, costStatistics.getCostStatisticsString());
logger.info("[increase end]########################################################################################################]");
logger.info("[product increase end]########################################################################################################]");
}
private void updateDateToEs(final Integer productId, Integer productSkn, final String key, boolean isUpdate) {
... ...
... ... @@ -78,6 +78,7 @@ public class TblProductMqListener extends AbstractMqListener implements ChannelA
@SuppressWarnings({ "rawtypes", "unchecked" })
public void updateData(final Map data, final String idField, final String key) throws Exception {
long begin = System.currentTimeMillis();
TblProduct tblProduct = (TblProduct) ConvertUtils.transMap2Bean(TblProduct.class, data);
if (tblProduct == null || tblProduct.getProductSkn() == null) {
... ... @@ -86,7 +87,7 @@ public class TblProductMqListener extends AbstractMqListener implements ChannelA
tblProductService.saveOrUpdate(tblProduct);
String idValue = data.get(idField).toString();
globalndexBulkService.updateGlobalIndex(tblProduct.getProductSkn(), System.currentTimeMillis(), key);
logger.info("[func=updateData][step=success][tableName=tblProduct][id={}][cost={}ms]", idValue, (System.currentTimeMillis() - begin));
logger.info("[func=TblProductMqListener.updateData][id={}][cost={}ms]", idValue, (System.currentTimeMillis() - begin));
}
public void deleteData(final String id, final String key) throws Exception {
... ...