!113 修复商品审核和编辑商品缺失对es操作问题

Merge pull request !113 from OceansDeep/feature/pg
This commit is contained in:
OceansDeep 2022-01-11 04:11:31 +00:00 committed by Gitee
commit bbed7afdcb
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
3 changed files with 6 additions and 5 deletions

View File

@ -188,6 +188,7 @@ public class GoodsMessageListener implements RocketMQListener<MessageExt> {
case GOODS_AUDIT:
Goods goods = JSONUtil.toBean(new String(messageExt.getBody()), Goods.class);
updateGoodsNum(goods);
updateGoodsIndex(goods);
break;
//删除商品
case GOODS_DELETE:

View File

@ -54,10 +54,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.*;
/**
* 商品业务层实现
@ -197,6 +194,9 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
if (goodsOperationDTO.getGoodsGalleryList() != null && !goodsOperationDTO.getGoodsGalleryList().isEmpty()) {
this.goodsGalleryService.add(goodsOperationDTO.getGoodsGalleryList(), goods.getId());
}
if (GoodsAuthEnum.TOBEAUDITED.name().equals(goods.getAuthFlag())) {
this.deleteEsGoods(Collections.singletonList(goodsId));
}
cache.remove(CachePrefix.GOODS.getPrefix() + goodsId);
}

View File

@ -172,7 +172,7 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
this.updateBatchById(newSkuList);
}
this.updateStock(newSkuList);
if (!newSkuList.isEmpty()) {
if (GoodsAuthEnum.PASS.name().equals(goods.getAuthFlag()) && !newSkuList.isEmpty()) {
generateEs(goods);
}
}