...
|
...
|
@@ -23,6 +23,7 @@ import java.util.Arrays; |
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Objects;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
...
|
...
|
@@ -82,23 +83,35 @@ public class SellerDownShelfPrepareProcessor { |
|
|
|
|
|
/**
|
|
|
* 获取skup对应的商品信息
|
|
|
* @param skup
|
|
|
* @param skups
|
|
|
* @return
|
|
|
*/
|
|
|
public SkupDownShelfPrepareDto getDownShelfPreDto(int skup){
|
|
|
public SkupDownShelfPrepareDto getDownShelfFastDeliveryPreDto(List<Integer> skups){
|
|
|
|
|
|
SellerOrderGoods sog = sellerOrderGoodsMapper.selectByPrimaryKey(skup);
|
|
|
if (sog == null || (sog.getStatus() != null && !CAN_OFF_STATUS.contains(sog.getStatus()))){
|
|
|
logger.warn("getSellerOrderGoodInfo has buyed, skup {}", skup);
|
|
|
List<SellerOrderGoods> sogs = sellerOrderGoodsMapper.selectBySkups(skups);
|
|
|
if (CollectionUtils.isEmpty(sogs)){
|
|
|
logger.warn("getDownShelfFastDeliveryPreDto order goods not exist");
|
|
|
throw new UfoServiceException(501, "商品已被下单购买");
|
|
|
}
|
|
|
|
|
|
// 过滤出状态=出售中的商品
|
|
|
List<SellerOrderGoods> canSellSellerOrderGoods = sogs.stream().filter(x->x.getStatus()==SkupStatus.CAN_SELL.getCode()).collect(Collectors.toList());
|
|
|
if (CollectionUtils.isEmpty(canSellSellerOrderGoods)){
|
|
|
logger.warn("getDownShelfFastDeliveryPreDto can sell order goods not exist");
|
|
|
throw new UfoServiceException(501, "商品已被下单购买");
|
|
|
}
|
|
|
|
|
|
// 根据skup转成普通的map
|
|
|
Map<Integer, SellerOrderGoods> sellerOrderGoodsMap = canSellSellerOrderGoods.stream().collect(Collectors.toMap(SellerOrderGoods::getId, Function.identity(), (key1, key2) -> key2));
|
|
|
|
|
|
Map<Integer, SkupDto> skupMap = Maps.newHashMap();
|
|
|
skupMap.put(sog.getId(), SkupDto.builder().skup(sog.getId()).sellerOrderGoods(sog).batchNo(sog.getBatchNo()).build());
|
|
|
for (Integer skup : sellerOrderGoodsMap.keySet()){
|
|
|
skupMap.put(skup, SkupDto.builder().skup(skup).sellerOrderGoods(sellerOrderGoodsMap.get(skup)).batchNo(sellerOrderGoodsMap.get(skup).getBatchNo()).build());
|
|
|
}
|
|
|
|
|
|
SkupDownShelfPrepareDto sdspDto = SkupDownShelfPrepareDto.builder()
|
|
|
.idSkupMap(skupMap)
|
|
|
.skupType(SkupType.getSkupType(sog.getAttributes()))
|
|
|
.skupType(SkupType.FAST_DELIVERY)
|
|
|
.build();
|
|
|
return sdspDto;
|
|
|
}
|
...
|
...
|
|