活动商品在商品下架或者删除时数据未能同步处理的问题
This commit is contained in:
parent
3011645c44
commit
c87081f673
@ -211,6 +211,10 @@ public class GoodsMessageListener implements RocketMQListener<MessageExt> {
|
||||
log.error("删除商品索引事件执行异常,商品信息: " + new String(messageExt.getBody()), e);
|
||||
}
|
||||
break;
|
||||
case DOWN:
|
||||
String goodsIdsJsonStr = new String(messageExt.getBody());
|
||||
promotionService.removeByGoodsIds(goodsIdsJsonStr);
|
||||
break;
|
||||
//规格删除
|
||||
case SKU_DELETE:
|
||||
String message = new String(messageExt.getBody());
|
||||
|
@ -134,6 +134,10 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
||||
List<String> list = this.baseMapper.getGoodsIdByStoreId(storeId);
|
||||
//下架店铺下的商品
|
||||
updateGoodsMarketAble(list, GoodsStatusEnum.DOWN, "店铺关闭");
|
||||
|
||||
applicationEventPublisher.publishEvent(new TransactionCommitSendMQEvent("下架商品",
|
||||
rocketmqCustomProperties.getGoodsTopic(), GoodsTagsEnum.DOWN.name(), JSONUtil.toJsonStr(list)));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -337,13 +341,13 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateGoodsMarketAbleByStoreId(String storeId, GoodsStatusEnum goodsStatusEnum, String underReason) {
|
||||
boolean result;
|
||||
|
||||
|
||||
LambdaUpdateWrapper<Goods> updateWrapper = this.getUpdateWrapperByStoreAuthority();
|
||||
updateWrapper.set(Goods::getMarketEnable, goodsStatusEnum.name());
|
||||
updateWrapper.set(Goods::getUnderMessage, underReason);
|
||||
updateWrapper.eq(Goods::getStoreId, storeId);
|
||||
result = this.update(updateWrapper);
|
||||
boolean result = this.update(updateWrapper);
|
||||
|
||||
//修改规格商品
|
||||
this.goodsSkuService.updateGoodsSkuStatusByStoreId(storeId, goodsStatusEnum.name(), null);
|
||||
@ -505,6 +509,13 @@ public class GoodsServiceImpl extends ServiceImpl<GoodsMapper, Goods> implements
|
||||
} else {
|
||||
this.updateEsGoods(goodsIds);
|
||||
}
|
||||
|
||||
|
||||
//下架商品发送消息
|
||||
if (goodsStatusEnum.equals(GoodsStatusEnum.DOWN)) {
|
||||
applicationEventPublisher.publishEvent(new TransactionCommitSendMQEvent("下架商品",
|
||||
rocketmqCustomProperties.getGoodsTopic(), GoodsTagsEnum.DOWN.name(), JSONUtil.toJsonStr(goodsIds)));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -158,7 +158,6 @@ public abstract class AbstractPromotionsServiceImpl<M extends BaseMapper<T>, T e
|
||||
*/
|
||||
@Override
|
||||
public <S extends BasePromotionsSearchParams> IPage<T> pageFindAll(S searchParams, PageVO page) {
|
||||
page.setNotConvert(false);
|
||||
return this.page(PageUtil.initPage(page), searchParams.queryWrapper());
|
||||
}
|
||||
|
||||
|
@ -276,7 +276,7 @@ public class KanjiaActivityGoodsServiceImpl extends AbstractPromotionsServiceImp
|
||||
|
||||
@Override
|
||||
public void deleteByGoodsIds(List<String> goodsIds) {
|
||||
this.remove(new QueryWrapper<KanjiaActivityGoods>().in("goods_id", goodsIds));
|
||||
this.remove(new LambdaQueryWrapper<KanjiaActivityGoods>().in(KanjiaActivityGoods::getGoodsId, goodsIds));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,5 +1,6 @@
|
||||
package cn.lili.modules.promotion.serviceimpl;
|
||||
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import cn.lili.common.enums.PromotionTypeEnum;
|
||||
import cn.lili.modules.promotion.entity.dos.*;
|
||||
import cn.lili.modules.promotion.entity.dto.search.PromotionGoodsSearchParams;
|
||||
@ -121,8 +122,9 @@ public class PromotionServiceImpl implements PromotionService {
|
||||
|
||||
@Override
|
||||
public void removeByGoodsIds(String goodsIdsJsonStr) {
|
||||
promotionGoodsService.deletePromotionGoods(Arrays.asList(goodsIdsJsonStr.split(",")));
|
||||
kanjiaActivityGoodsService.deleteByGoodsIds(Arrays.asList(goodsIdsJsonStr.split(",")));
|
||||
List<String> goodsIds = JSONUtil.toList(goodsIdsJsonStr, String.class);
|
||||
promotionGoodsService.deletePromotionGoodsByGoods(goodsIds);
|
||||
kanjiaActivityGoodsService.deleteByGoodsIds(goodsIds);
|
||||
}
|
||||
|
||||
private void getGoodsCurrentSeckill(String esPromotionKey, PromotionGoods promotionGoods, Map<String, Object> promotionMap) {
|
||||
|
@ -39,6 +39,10 @@ public enum GoodsTagsEnum {
|
||||
* "删除店铺商品索引"
|
||||
*/
|
||||
STORE_GOODS_DELETE("删除店铺商品索引"),
|
||||
/**
|
||||
* 下架商品"
|
||||
*/
|
||||
DOWN("下架商品"),
|
||||
/**
|
||||
* "删除商品"
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user