1. 商品信息变动刷新库存
2. 商品信息变动发生Mq消息
This commit is contained in:
@@ -182,15 +182,28 @@ public class OrderInfoRpcServiceImpl implements OrderInfoRpcService {
|
||||
|
||||
@Override
|
||||
public void orderRefundCallback(JSONObject data) {
|
||||
Set<String> keys = data.keySet();
|
||||
Long orderId = data.getLong("orderId");
|
||||
// 订单取消后商品库存恢复,耗材恢复,流水记录
|
||||
OrderInfo orderInfo = orderInfoMapper.selectOneById(orderId);
|
||||
if (orderInfo == null) {
|
||||
throw new CzgException("订单不存在");
|
||||
}
|
||||
// 查询订单下商品
|
||||
List<OrderDetail> detailList = orderDetailMapper.selectListByQuery(QueryWrapper.create().eq(OrderDetail::getOrderId, orderId));
|
||||
if (CollUtil.isEmpty(detailList)) {
|
||||
throw new CzgException("该订单下不存在商品");
|
||||
}
|
||||
JSONObject obj = data.getJSONObject("returnProMap");
|
||||
Set<String> keys = obj.keySet();
|
||||
// 封装扣减库存数据
|
||||
List<Map<String, Object>> dataList = new ArrayList<>();
|
||||
for (String key : keys) {
|
||||
Long productId = Convert.toLong(key);
|
||||
BigDecimal num = data.getBigDecimal(key);
|
||||
Map<String, Object> row = new HashMap<>(2);
|
||||
data.put("productId", productId);
|
||||
data.put("num", num);
|
||||
BigDecimal num = obj.getBigDecimal(key);
|
||||
Map<String, Object> row = new HashMap<>(3);
|
||||
row.put("shopId", orderInfo.getShopId());
|
||||
row.put("productId", productId);
|
||||
row.put("num", num);
|
||||
dataList.add(row);
|
||||
}
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user