|
@@ -175,6 +175,9 @@ public class OmsOrderServiceImpl implements OmsOrderService {
|
|
|
if (CollectionUtils.isEmpty(omsOrderItems)) {
|
|
|
throw new BizException("订单详情不存在");
|
|
|
}
|
|
|
+ // skuID 商品名称 map
|
|
|
+ Map<Long,String > skuMap = omsOrderItems.stream().collect(Collectors.toMap(OmsOrderItem::getProductSkuId, OmsOrderItem::getProductName,(o1, o2)->o1));
|
|
|
+
|
|
|
// skuID集合
|
|
|
List<Long> skuIds = omsOrderItems.stream().map(OmsOrderItem::getProductSkuId).distinct().collect(Collectors.toList());
|
|
|
// 查询库存
|
|
@@ -182,7 +185,8 @@ public class OmsOrderServiceImpl implements OmsOrderService {
|
|
|
stockRecordExample.createCriteria().andProductSkuIdIn(skuIds);
|
|
|
List<PmsProductSkuStockRecord> productSkuStockRecords = pmsProductSkuStockRecordMapper.selectByExample(stockRecordExample);
|
|
|
if (CollectionUtils.isEmpty(productSkuStockRecords)) {
|
|
|
- throw new BizException("库存不足");
|
|
|
+ ArrayList<String> list = new ArrayList<>(skuMap.values());
|
|
|
+ throw new BizException(list.get(0) +"库存不足");
|
|
|
}
|
|
|
//id 集合
|
|
|
List<Long> stockRecordIds = productSkuStockRecords.stream().map(PmsProductSkuStockRecord::getId).collect(Collectors.toList());
|
|
@@ -205,7 +209,7 @@ public class OmsOrderServiceImpl implements OmsOrderService {
|
|
|
v.stream().forEach(o -> {
|
|
|
List<PmsProductSkuStockRecord> skuStockRecords = skuStockRecordMap.get(o.getProductSkuId());
|
|
|
if (CollectionUtils.isEmpty(skuStockRecords)) {
|
|
|
- throw new BizException("库存不足");
|
|
|
+ throw new BizException(skuMap.get(o.getProductSkuId()) +"库存不足");
|
|
|
}
|
|
|
int count1 = o.getProductQuantity();
|
|
|
// 扣减内部库存
|
|
@@ -270,7 +274,7 @@ public class OmsOrderServiceImpl implements OmsOrderService {
|
|
|
}
|
|
|
}
|
|
|
if (count1 > 0) {
|
|
|
- throw new BizException("库存不足");
|
|
|
+ throw new BizException(skuMap.get(o.getProductSkuId())+"库存不足");
|
|
|
}
|
|
|
});
|
|
|
skuSyncList.add(skuSync);
|
|
@@ -286,7 +290,7 @@ public class OmsOrderServiceImpl implements OmsOrderService {
|
|
|
try {
|
|
|
HttpResponseResult httpResponseResult = webFeignService.updateShippedStatus(skuSyncList);
|
|
|
if (httpResponseResult.getCode() != 200 && !httpResponseResult.getStatus()) {
|
|
|
- throw new BizException("发货通知失败");
|
|
|
+ throw new BizException("发货通知失败:"+httpResponseResult.getMsg());
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
throw new BizException("发货通知失败");
|