商品删除则删除相关促销商品
This commit is contained in:
parent
b61cfe8b6b
commit
90a2ec9719
@ -205,6 +205,8 @@ public class GoodsMessageListener implements RocketMQListener<MessageExt> {
|
||||
for (String goodsId : JSONUtil.toList(goodsIdsJsonStr, String.class)) {
|
||||
goodsIndexService.deleteIndex(MapUtil.builder(new HashMap<String, Object>()).put("goodsId", goodsId).build());
|
||||
}
|
||||
|
||||
promotionService.removeByGoodsIds(goodsIdsJsonStr);
|
||||
} catch (Exception e) {
|
||||
log.error("删除商品索引事件执行异常,商品信息: " + new String(messageExt.getBody()), e);
|
||||
}
|
||||
|
@ -149,6 +149,13 @@ public interface PromotionGoodsService extends IService<PromotionGoods> {
|
||||
*/
|
||||
void deletePromotionGoods(List<String> promotionIds);
|
||||
|
||||
/**
|
||||
* 删除商品的促销
|
||||
*
|
||||
* @param goodsIds 商品id
|
||||
*/
|
||||
void deletePromotionGoodsByGoods(List<String> goodsIds);
|
||||
|
||||
/**
|
||||
* 根据参数删除促销商品
|
||||
*
|
||||
|
@ -23,10 +23,16 @@ public interface PromotionService {
|
||||
/**
|
||||
* 根据商品索引获取当前商品索引的所有促销活动信息
|
||||
*
|
||||
* @param storeId 店铺id
|
||||
* @param storeId 店铺id
|
||||
* @param goodsSkuId 商品skuId
|
||||
* @return 当前促销活动集合
|
||||
*/
|
||||
Map<String, Object> getGoodsSkuPromotionMap(String storeId, String goodsSkuId);
|
||||
|
||||
/**
|
||||
* 删除商品,则删除相关促销信息
|
||||
*
|
||||
* @param goodsIdsJsonStr
|
||||
*/
|
||||
void removeByGoodsIds(String goodsIdsJsonStr);
|
||||
}
|
@ -281,6 +281,13 @@ public class PromotionGoodsServiceImpl extends ServiceImpl<PromotionGoodsMapper,
|
||||
this.remove(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deletePromotionGoodsByGoods(List<String> goodsIds) {
|
||||
LambdaQueryWrapper<PromotionGoods> queryWrapper = new LambdaQueryWrapper<PromotionGoods>().in(PromotionGoods::getGoodsId, goodsIds);
|
||||
this.remove(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据参数删除促销商品
|
||||
*
|
||||
|
@ -116,6 +116,10 @@ public class PromotionServiceImpl implements PromotionService {
|
||||
return promotionMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeByGoodsIds(String goodsIdsJsonStr) {
|
||||
promotionGoodsService.deletePromotionGoods(Arrays.asList(goodsIdsJsonStr.split(",")));
|
||||
}
|
||||
|
||||
private void getGoodsCurrentSeckill(String esPromotionKey, PromotionGoods promotionGoods, Map<String, Object> promotionMap) {
|
||||
Seckill seckill = seckillService.getById(promotionGoods.getPromotionId());
|
||||
|
Loading…
x
Reference in New Issue
Block a user