...
|
...
|
@@ -37,8 +37,6 @@ public class GoodsMqListener extends AbstractStorageRelatedMqListener implements |
|
|
private StorageSkuIndexBulkService storageSkuIndexService;
|
|
|
@Autowired
|
|
|
private StorageSkuLogicService storageSkuLogicService;
|
|
|
@Autowired
|
|
|
private ProductGoodsLogicService productGoodsLogicService;
|
|
|
|
|
|
public void onMessage(Message message, Channel channel) throws Exception {
|
|
|
try {
|
...
|
...
|
@@ -128,35 +126,17 @@ public class GoodsMqListener extends AbstractStorageRelatedMqListener implements |
|
|
|
|
|
private void updateIndexNew(Integer productId, long begin, final String key) {
|
|
|
CostStatistics costStatistics = new CostStatistics();
|
|
|
Set<String> colorIdSet = new HashSet<String>();
|
|
|
Set<String> colorNameSet = new HashSet<String>();
|
|
|
Map<String, Object> indexData = new HashMap<String, Object>();
|
|
|
|
|
|
// 第一步:获取goodsList
|
|
|
List<ProductGoodsBO> productGoodsBOList = goodsService.getProductGoodsByProductId(productId);
|
|
|
logger.info("[model=GoodsMqListener_UpdateIndexNew][step=getGoodsListByProductId][productId={}][cost={}]", productId, costStatistics.getCost());
|
|
|
|
|
|
// 第二步、组装goods数据
|
|
|
if (productGoodsBOList != null && productGoodsBOList.size() == 1) {
|
|
|
ProductGoodsBO productGoodsBO = productGoodsBOList.get(0);
|
|
|
String goodsListJsonArrayStr = productGoodsBO.getGoodsList();
|
|
|
JSONArray goodsListJsonArray = JSONArray.parseArray(goodsListJsonArrayStr);
|
|
|
productGoodsLogicService.getColorSet(goodsListJsonArray, colorIdSet, colorNameSet);//获取有库存且状态正常的color
|
|
|
indexData.put("goodsList", goodsListJsonArray);
|
|
|
indexData.put("colorIds", StringUtils.join(colorIdSet, ","));
|
|
|
indexData.put("colorNames", StringUtils.join(colorNameSet, ","));
|
|
|
} else {
|
|
|
indexData.put("goodsList", "");
|
|
|
indexData.put("colorIds", "");
|
|
|
indexData.put("colorNames", "");
|
|
|
}
|
|
|
//第一步:获取goodsList,组装goods数据
|
|
|
fillColor(indexData,productId);
|
|
|
logger.info("[model=GoodsMqListener_UpdateIndexNew][step=genGoodsList][productId={}][cost={}]", productId, costStatistics.getCost());
|
|
|
|
|
|
// 第三步、组装库存数据
|
|
|
// 第二步、组装库存数据
|
|
|
this.fillStorageNumAndSizeInfo(productId, indexData);
|
|
|
logger.info("[model=GoodsMqListener_UpdateIndexNew][step=fillProductStorage][productId={}][cost={}]", productId, costStatistics.getCost());
|
|
|
|
|
|
// 第四步:更新索引
|
|
|
// 第三步:更新索引
|
|
|
this.updateProductIndexWithDataMap(indexData, productId, key, begin);
|
|
|
logger.info("[model=GoodsMqListener_UpdateIndexNew][step=updateProductIndexWithDataMap][productId={}][cost={}]", productId, costStatistics.getCost());
|
|
|
}
|
...
|
...
|
|