商品列表 结构
耗材库存 列表接口 耗材 库存预警值推送更新 cons.info.change.queue
This commit is contained in:
@@ -1698,11 +1698,7 @@ public class OrderInfoCustomServiceImpl implements OrderInfoCustomService {
|
||||
List<OrderDetail> details = orderDetailService.list(QueryWrapper.create().eq(OrderDetail::getOrderId, orderId).eq(OrderDetail::getPlaceNum, placeNum));
|
||||
List<Map<String, Object>> dataList = new ArrayList<>();
|
||||
for (OrderDetail detail : details) {
|
||||
Map<String, Object> data = new HashMap<>();
|
||||
data.put("shopId", shopId);
|
||||
data.put("productId", detail.getProductId());
|
||||
data.put("num", NumberUtil.sub(detail.getNum(), detail.getReturnNum()));
|
||||
dataList.add(data);
|
||||
dataList.add(Map.of("productId", detail.getProductId(), "number", NumberUtil.sub(detail.getNum(), detail.getReturnNum())));
|
||||
}
|
||||
orderDetailService.remove(new QueryWrapper().eq(OrderDetail::getOrderId, orderId).eq(OrderDetail::getPlaceNum, placeNum));
|
||||
if (CollUtil.isNotEmpty(dataList)) {
|
||||
|
||||
@@ -97,14 +97,10 @@ public class OrderInfoRpcServiceImpl implements OrderInfoRpcService {
|
||||
// 封装扣减库存数据
|
||||
List<Map<String, Object>> dataList = new ArrayList<>();
|
||||
for (OrderDetail orderDetail : detailList) {
|
||||
Map<String, Object> data = new HashMap<>(16);
|
||||
Long productId = orderDetail.getProductId();
|
||||
BigDecimal num = orderDetail.getNum();
|
||||
BigDecimal refundNum = orderDetail.getRefundNum();
|
||||
data.put("shopId", shopId);
|
||||
data.put("productId", productId);
|
||||
data.put("num", NumberUtil.sub(num, refundNum));
|
||||
dataList.add(data);
|
||||
dataList.add(Map.of("productId", productId, "number", NumberUtil.sub(num, refundNum)));
|
||||
}
|
||||
try {
|
||||
// 调用商品服务扣减库存
|
||||
@@ -130,22 +126,17 @@ public class OrderInfoRpcServiceImpl implements OrderInfoRpcService {
|
||||
if (CollUtil.isEmpty(detailList)) {
|
||||
throw new CzgException("该订单下不存在商品");
|
||||
}
|
||||
Long shopId = orderInfo.getShopId();
|
||||
// 封装扣减库存数据
|
||||
List<Map<String, Object>> dataList = new ArrayList<>();
|
||||
for (OrderDetail orderDetail : detailList) {
|
||||
Map<String, Object> data = new HashMap<>(16);
|
||||
Long productId = orderDetail.getProductId();
|
||||
BigDecimal num = orderDetail.getNum();
|
||||
BigDecimal refundNum = orderDetail.getRefundNum();
|
||||
data.put("shopId", shopId);
|
||||
data.put("productId", productId);
|
||||
data.put("num", NumberUtil.sub(num, refundNum));
|
||||
dataList.add(data);
|
||||
dataList.add(Map.of("productId", productId, "number", NumberUtil.sub(num, refundNum)));
|
||||
}
|
||||
try {
|
||||
// 调用商品服务扣减库存
|
||||
productRpcService.orderCancelRecoverStock(shopId, orderId, dataList);
|
||||
productRpcService.orderCancelRecoverStock(orderInfo.getShopId(), orderId, dataList);
|
||||
} catch (Exception e) {
|
||||
log.error("调用商品服务恢复库存", e);
|
||||
throw e;
|
||||
@@ -171,13 +162,7 @@ public class OrderInfoRpcServiceImpl implements OrderInfoRpcService {
|
||||
// 封装扣减库存数据
|
||||
List<Map<String, Object>> dataList = new ArrayList<>();
|
||||
for (String key : keys) {
|
||||
Long productId = Convert.toLong(key);
|
||||
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);
|
||||
dataList.add(Map.of("productId", key, "number", obj.getBigDecimal(key)));
|
||||
}
|
||||
try {
|
||||
// 调用商品服务回退库存
|
||||
|
||||
@@ -520,6 +520,7 @@ public class OrderPayServiceImpl implements OrderPayService {
|
||||
}
|
||||
//退款返还库存
|
||||
if (!returnProMap.isEmpty()) {
|
||||
//TODO 退款 商品退不退的 校验
|
||||
rabbitPublisher.sendOrderRefundMsg(JSONObject.toJSONString(Map.of("orderId", orderInfo.getId(), "returnProMap", returnProMap)));
|
||||
}
|
||||
refundOrderAfter(orderInfo.getId(), orderInfo.getShopId(), orderInfo.getUserId(), orderInfo.getOrderNo(),
|
||||
|
||||
Reference in New Issue
Block a user