...
|
...
|
@@ -22,10 +22,7 @@ import org.springframework.stereotype.Service; |
|
|
import java.math.BigDecimal;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.time.ZoneOffset;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.Set;
|
|
|
import java.util.*;
|
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
...
|
...
|
@@ -221,13 +218,21 @@ public class FavoriteSkuService { |
|
|
|
|
|
Map<Integer, BigDecimal> skuFavoriteMap = cacheService.getSkuFavoriteMap(vo.getUid());
|
|
|
List<GoodsSize> goodsSizes = ufoServiceCaller.call("ufo.product.skus", List.class, vo.getProductId());
|
|
|
|
|
|
if (CollectionUtils.isEmpty(goodsSizes)) {
|
|
|
logger.error("The result from ufo.product.skus is empty, vo is {}", vo.getProductId());
|
|
|
return Lists.newArrayList();
|
|
|
}
|
|
|
|
|
|
Map<Integer, FavoriteSkuResp> integerFavoriteSkuRespMap = searchSkuList(goodsSizes.stream().map(GoodsSize::getId).map(String::valueOf).collect(Collectors.toList()));
|
|
|
|
|
|
List<FavoriteSkuResp> respList = Lists.newArrayList();
|
|
|
goodsSizes.stream().forEach(item -> {
|
|
|
respList.add(FavoriteSkuResp.builder().storageId(item.getId()).favoriteFalg(skuFavoriteMap.containsKey(item.getId()) ? 1 : 0).build());
|
|
|
FavoriteSkuResp favoriteSkuResp = integerFavoriteSkuRespMap.get(item.getId());
|
|
|
if (!Objects.isNull(favoriteSkuResp)) {
|
|
|
favoriteSkuResp.setFavoriteFalg(skuFavoriteMap.containsKey(item.getId()) ? 1 : 0);
|
|
|
respList.add(favoriteSkuResp);
|
|
|
}
|
|
|
});
|
|
|
return respList;
|
|
|
}
|
...
|
...
|
|