退款回调添加修改商品状态逻辑

This commit is contained in:
longbinbin
2024-12-06 17:15:36 +08:00
parent 571838866f
commit ad20769a31

View File

@ -223,6 +223,24 @@ public class OrderServiceImpl implements OrderService {
sourceMapper.update(sourceEntity);
}
});
} else if (state == OrderStateEnum.REFUNDED.getState()) {//订单退款成功就把商品状态更改成未购买
OrderRespVO orderRespVO = orderMapper.getById(orderSn);
List<OrderItemVO> orderItemList = orderRespVO.getOrderItemList();
orderItemList.forEach(orderItemVO -> {
Integer goodsType = orderItemVO.getGoodsType();
Long goodsId = orderItemVO.getGoodsId();
if (Objects.equals(goodsType, GoodsTypeEnum.VIDEO.code)) {
VideoEntity videoEntity = new VideoEntity();
videoEntity.setId(goodsId);
videoEntity.setIsBuy(0);
videoMapper.update(videoEntity);
} else if (Objects.equals(goodsType, GoodsTypeEnum.SOURCE.code)) {
SourceEntity sourceEntity = new SourceEntity();
sourceEntity.setId(goodsId);
sourceEntity.setIsBuy(0);
sourceMapper.update(sourceEntity);
}
});
}
}
orderMapper.update(orderAddOrUpdateReq);