Authored by wangnan

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

@@ -164,14 +164,15 @@ public class TblProductNewIndexBuilder extends IIndexBuilder { @@ -164,14 +164,15 @@ public class TblProductNewIndexBuilder extends IIndexBuilder {
164 * 增量构建 164 * 增量构建
165 */ 165 */
166 public List<ProductIndexBO> getProductIndex(List<Integer> skns) { 166 public List<ProductIndexBO> getProductIndex(List<Integer> skns) {
  167 + logger.info("[tblProduct increase begin]########################################################################################################]");
167 long begin = System.currentTimeMillis(); 168 long begin = System.currentTimeMillis();
168 - logger.info("[###########################][TblProductNewIndexBuilder.getProductIndex][increase begin]");  
169 List<TblProduct> tblProducts = tblProductService.getByskns(skns); 169 List<TblProduct> tblProducts = tblProductService.getByskns(skns);
170 if (CollectionUtils.isEmpty(tblProducts)) { 170 if (CollectionUtils.isEmpty(tblProducts)) {
171 return new ArrayList<>(); 171 return new ArrayList<>();
172 } 172 }
173 List<ProductIndexBO> productIndexBOS = buildProductIndex(tblProducts); 173 List<ProductIndexBO> productIndexBOS = buildProductIndex(tblProducts);
174 - logger.info("[###########################]TblProductNewIndexBuilder.getProductIndex [increase end],[size:{}],[cost: {}]", System.currentTimeMillis() - begin); 174 + logger.info("[fun=TblProductNewIndexBuilder.getProductIndex],[size:{}],[cost: {}]", System.currentTimeMillis() - begin);
  175 + logger.info("[tblProduct increase begin]########################################################################################################]");
175 return productIndexBOS; 176 return productIndexBOS;
176 } 177 }
177 178
@@ -181,7 +182,6 @@ public class TblProductNewIndexBuilder extends IIndexBuilder { @@ -181,7 +182,6 @@ public class TblProductNewIndexBuilder extends IIndexBuilder {
181 public List<ProductIndexBO> buildProductIndex(List<TblProduct> tblProducts) { 182 public List<ProductIndexBO> buildProductIndex(List<TblProduct> tblProducts) {
182 List<ProductIndexBO> productIndexBOs = new ArrayList<>(); 183 List<ProductIndexBO> productIndexBOs = new ArrayList<>();
183 try { 184 try {
184 - logger.info("[TblProductNewIndexBuilder.buildProductIndex] get data from cache begin");  
185 long begin = System.currentTimeMillis(); 185 long begin = System.currentTimeMillis();
186 JSONObject jsonObject = cache.get(CACHE_KEY); 186 JSONObject jsonObject = cache.get(CACHE_KEY);
187 if (jsonObject != null) { 187 if (jsonObject != null) {
@@ -194,7 +194,7 @@ public class TblProductNewIndexBuilder extends IIndexBuilder { @@ -194,7 +194,7 @@ public class TblProductNewIndexBuilder extends IIndexBuilder {
194 sortIdOrderByMap = (Map<Integer, ProductSort>) jsonObject.get(SORTIDORDERBY_CACHE_KEY); 194 sortIdOrderByMap = (Map<Integer, ProductSort>) jsonObject.get(SORTIDORDERBY_CACHE_KEY);
195 sortMapList = (List<HashMap<Integer, Integer>>) jsonObject.get(SORTMAPLIST_CACHE_KEY); 195 sortMapList = (List<HashMap<Integer, Integer>>) jsonObject.get(SORTMAPLIST_CACHE_KEY);
196 } 196 }
197 - logger.info("[TblProductNewIndexBuilder.buildProductIndex]get data from cache end [cost: {}]",System.currentTimeMillis() - begin); 197 + logger.info("[TblProductNewIndexBuilder.buildProductIndex]get map from cache end [cost: {}]",System.currentTimeMillis() - begin);
198 Map<Integer, List<TblProductSkc>> tblProductSkcMap = tblProductSkcMapBuilder.build(tblProducts); 198 Map<Integer, List<TblProductSkc>> tblProductSkcMap = tblProductSkcMapBuilder.build(tblProducts);
199 Map<Integer, List<TblProductSku>> tblProductSkuMap = tblProductSkuMapBuilder.build(tblProducts); 199 Map<Integer, List<TblProductSku>> tblProductSkuMap = tblProductSkuMapBuilder.build(tblProducts);
200 // 生成ProductIndexBO 200 // 生成ProductIndexBO
@@ -123,7 +123,7 @@ public class ProductMqListener extends AbstractMqListener implements ChannelAwar @@ -123,7 +123,7 @@ public class ProductMqListener extends AbstractMqListener implements ChannelAwar
123 return; 123 return;
124 } 124 }
125 Integer productId = product.getId(); 125 Integer productId = product.getId();
126 - logger.info("[increase begin]########################################################################################################]"); 126 + logger.info("[product increase begin]########################################################################################################]");
127 logger.info("[step 1 =conver success][key={}][productId={}][cost={}ms]", key, productId, costStatistics.getCost()); 127 logger.info("[step 1 =conver success][key={}][productId={}][cost={}ms]", key, productId, costStatistics.getCost());
128 128
129 // 2、保存进数据库 129 // 2、保存进数据库
@@ -135,7 +135,7 @@ public class ProductMqListener extends AbstractMqListener implements ChannelAwar @@ -135,7 +135,7 @@ public class ProductMqListener extends AbstractMqListener implements ChannelAwar
135 135
136 // 4、打印耗时 136 // 4、打印耗时
137 logger.info("[step6=getCostStatisticsString][key={}][productId={}][costStatistics={}]", key, productId, costStatistics.getCostStatisticsString()); 137 logger.info("[step6=getCostStatisticsString][key={}][productId={}][costStatistics={}]", key, productId, costStatistics.getCostStatisticsString());
138 - logger.info("[increase end]########################################################################################################]"); 138 + logger.info("[product increase end]########################################################################################################]");
139 } 139 }
140 140
141 private void updateDateToEs(final Integer productId, Integer productSkn, final String key, boolean isUpdate) { 141 private void updateDateToEs(final Integer productId, Integer productSkn, final String key, boolean isUpdate) {
@@ -78,6 +78,7 @@ public class TblProductMqListener extends AbstractMqListener implements ChannelA @@ -78,6 +78,7 @@ public class TblProductMqListener extends AbstractMqListener implements ChannelA
78 78
79 @SuppressWarnings({ "rawtypes", "unchecked" }) 79 @SuppressWarnings({ "rawtypes", "unchecked" })
80 public void updateData(final Map data, final String idField, final String key) throws Exception { 80 public void updateData(final Map data, final String idField, final String key) throws Exception {
  81 +
81 long begin = System.currentTimeMillis(); 82 long begin = System.currentTimeMillis();
82 TblProduct tblProduct = (TblProduct) ConvertUtils.transMap2Bean(TblProduct.class, data); 83 TblProduct tblProduct = (TblProduct) ConvertUtils.transMap2Bean(TblProduct.class, data);
83 if (tblProduct == null || tblProduct.getProductSkn() == null) { 84 if (tblProduct == null || tblProduct.getProductSkn() == null) {
@@ -86,7 +87,7 @@ public class TblProductMqListener extends AbstractMqListener implements ChannelA @@ -86,7 +87,7 @@ public class TblProductMqListener extends AbstractMqListener implements ChannelA
86 tblProductService.saveOrUpdate(tblProduct); 87 tblProductService.saveOrUpdate(tblProduct);
87 String idValue = data.get(idField).toString(); 88 String idValue = data.get(idField).toString();
88 globalndexBulkService.updateGlobalIndex(tblProduct.getProductSkn(), System.currentTimeMillis(), key); 89 globalndexBulkService.updateGlobalIndex(tblProduct.getProductSkn(), System.currentTimeMillis(), key);
89 - logger.info("[func=updateData][step=success][tableName=tblProduct][id={}][cost={}ms]", idValue, (System.currentTimeMillis() - begin)); 90 + logger.info("[func=TblProductMqListener.updateData][id={}][cost={}ms]", idValue, (System.currentTimeMillis() - begin));
90 } 91 }
91 92
92 public void deleteData(final String id, final String key) throws Exception { 93 public void deleteData(final String id, final String key) throws Exception {