|
@@ -913,6 +913,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem
|
|
|
// 获取订单商品主材和包材
|
|
|
List<OrderSku> orderSkuList = orderSkuService.list(q -> q.eq(OrderSku::getOrderId, id));
|
|
|
List<OrderSkuBom> orderSkuBomList = orderSkuBomService.list(q -> q.eq(OrderSkuBom::getOrderId, id));
|
|
|
+ List<OrderPackageBom> orderPackageBomList = orderPackageBomService.list(q -> q.eq(OrderPackageBom::getOrderId, id));
|
|
|
|
|
|
// 成品退料
|
|
|
if (Objects.equals(orderInfo.getStockType(), StatusConstant.YES)) {
|
|
@@ -927,14 +928,19 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem
|
|
|
}
|
|
|
|
|
|
Map<Long, OrderSku> orderSkuMap = orderSkuList.stream().collect(Collectors.toMap(BaseIdPo::getId, Function.identity()));
|
|
|
+ // 筛选掉赠品sku
|
|
|
+ List<Long> skuSpecIds = orderSkuList.stream().map(OrderSku::getSkuSpecId).collect(Collectors.toList());
|
|
|
+ Set<Long> giftSkuSpecIds = skuSpecService.getGiftIdListByIdList(skuSpecIds);
|
|
|
|
|
|
// 合并主材和包材
|
|
|
- List<InOutStorageBom> inOutStorageBomList = orderSkuList.stream().map(item -> {
|
|
|
- InOutStorageBom inOutStorageBom = new InOutStorageBom();
|
|
|
- inOutStorageBom.setBomSpecId(item.getBomSpecId());
|
|
|
- inOutStorageBom.setQuantity(item.getQuantity());
|
|
|
- return inOutStorageBom;
|
|
|
- }).collect(Collectors.toList());
|
|
|
+ List<InOutStorageBom> inOutStorageBomList = orderSkuList.stream()
|
|
|
+ .filter(item -> giftSkuSpecIds.isEmpty() || !giftSkuSpecIds.contains(item.getSkuSpecId()))
|
|
|
+ .map(item -> {
|
|
|
+ InOutStorageBom inOutStorageBom = new InOutStorageBom();
|
|
|
+ inOutStorageBom.setBomSpecId(item.getBomSpecId());
|
|
|
+ inOutStorageBom.setQuantity(item.getQuantity());
|
|
|
+ return inOutStorageBom;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
|
|
|
for (OrderSkuBom orderSkuBom : orderSkuBomList) {
|
|
|
OrderSku orderSku = orderSkuMap.get(orderSkuBom.getOrderSkuId());
|
|
@@ -944,6 +950,13 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem
|
|
|
inOutStorageBomList.add(inOutStorageBom);
|
|
|
}
|
|
|
|
|
|
+ for (OrderPackageBom orderPackageBom : orderPackageBomList) {
|
|
|
+ InOutStorageBom inOutStorageBom = new InOutStorageBom();
|
|
|
+ inOutStorageBom.setBomSpecId(orderPackageBom.getBomSpecId());
|
|
|
+ inOutStorageBom.setQuantity(orderPackageBom.getQuantity());
|
|
|
+ inOutStorageBomList.add(inOutStorageBom);
|
|
|
+ }
|
|
|
+
|
|
|
// 合并数量
|
|
|
Map<Long, InOutStorageBom> map = inOutStorageBomList.stream().collect(Collectors.toMap(
|
|
|
InOutStorageBom::getBomSpecId,
|
|
@@ -1154,14 +1167,19 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem
|
|
|
}
|
|
|
List<OrderSku> orderSkuList = orderSkuService.list(q -> q.eq(OrderSku::getOrderId, id));
|
|
|
List<OrderSkuBom> orderSkuBomList = orderSkuBomService.list(q -> q.eq(OrderSkuBom::getOrderId, id));
|
|
|
+ List<OrderPackageBom> orderPackageBomList = orderPackageBomService.list(q -> q.eq(OrderPackageBom::getOrderId, id));
|
|
|
Map<Long, OrderSku> orderSkuMap = orderSkuList.stream().collect(Collectors.toMap(BaseIdPo::getId, Function.identity()));
|
|
|
if (Objects.equals(orderInfo.getClassify(), OrderClassifyEnum.OUTSOURCE_ORDER.getKey())) {
|
|
|
orderSkuList = Collections.emptyList();
|
|
|
}
|
|
|
+ // 筛选掉赠品sku
|
|
|
+ List<Long> skuSpecIds = orderSkuList.stream().map(OrderSku::getSkuSpecId).collect(Collectors.toList());
|
|
|
+ Set<Long> giftSkuSpecIds = skuSpecService.getGiftIdListByIdList(skuSpecIds);
|
|
|
|
|
|
- Map<Long, OutBomVo> map = Stream.concat(
|
|
|
+ Map<Long, OutBomVo> map = Stream.of(
|
|
|
// 主材
|
|
|
orderSkuList.stream()
|
|
|
+ .filter(item -> giftSkuSpecIds.isEmpty() || !giftSkuSpecIds.contains(item.getSkuSpecId()))
|
|
|
.map(item -> {
|
|
|
OutBomVo outBomVo = new OutBomVo();
|
|
|
outBomVo.setBomSpecId(item.getBomSpecId());
|
|
@@ -1176,8 +1194,17 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem
|
|
|
outBomVo.setBomSpecId(item.getBomSpecId());
|
|
|
outBomVo.setOutQuantity(item.getQuantity().multiply(orderSku.getQuantity()));
|
|
|
return outBomVo;
|
|
|
+ }),
|
|
|
+
|
|
|
+ // 快递包材
|
|
|
+ orderPackageBomList.stream().map(item -> {
|
|
|
+ OutBomVo outBomVo = new OutBomVo();
|
|
|
+ outBomVo.setBomSpecId(item.getBomSpecId());
|
|
|
+ outBomVo.setOutQuantity(item.getQuantity());
|
|
|
+ return outBomVo;
|
|
|
})
|
|
|
)
|
|
|
+ .flatMap(stream -> stream)
|
|
|
.collect(Collectors.toMap(
|
|
|
OutBomVo::getBomSpecId,
|
|
|
Function.identity(),
|
|
@@ -1491,7 +1518,7 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, OrderInfo> implem
|
|
|
Map<Long, BomSpecBo> bomSpecBoMap = skuSpecService.getBomSpecBoByIdList(bomSpecIdList);
|
|
|
// 筛选掉赠品sku
|
|
|
List<Long> skuSpecIds = orderSkuList.stream().map(OrderSku::getSkuSpecId).collect(Collectors.toList());
|
|
|
- List<Long> giftSkuSpecIds = skuSpecService.getGiftIdListByIdList(skuSpecIds);
|
|
|
+ Set<Long> giftSkuSpecIds = skuSpecService.getGiftIdListByIdList(skuSpecIds);
|
|
|
|
|
|
orderSkuList = orderSkuList.stream()
|
|
|
.filter(item -> giftSkuSpecIds.isEmpty() || !giftSkuSpecIds.contains(item.getSkuSpecId()))
|