You've already forked FrameTour-BE
支付回调添加修改商品状态逻辑
This commit is contained in:
@ -204,6 +204,26 @@ public class OrderServiceImpl implements OrderService {
|
|||||||
if (state == OrderStateEnum.CANCELED.getState()) {
|
if (state == OrderStateEnum.CANCELED.getState()) {
|
||||||
orderAddOrUpdateReq.setCancelAt(new Date());
|
orderAddOrUpdateReq.setCancelAt(new Date());
|
||||||
}
|
}
|
||||||
|
//如果订单未支付就把商品状态更改成未购买
|
||||||
|
if (state != OrderStateEnum.PAID.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);
|
orderMapper.update(orderAddOrUpdateReq);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user