...
|
...
|
@@ -14,7 +14,9 @@ import java.util.function.BinaryOperator; |
|
|
import java.util.function.Function;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import com.yohoufo.product.model.*;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.apache.commons.lang3.tuple.Pair;
|
|
|
import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
...
|
...
|
@@ -45,12 +47,6 @@ import com.yohoufo.dal.product.model.SaleCategory; |
|
|
import com.yohoufo.dal.product.model.Size;
|
|
|
import com.yohoufo.dal.product.model.Storage;
|
|
|
import com.yohoufo.dal.product.model.StoragePrice;
|
|
|
import com.yohoufo.product.model.GoodsBO;
|
|
|
import com.yohoufo.product.model.GoodsImageBO;
|
|
|
import com.yohoufo.product.model.GoodsSize;
|
|
|
import com.yohoufo.product.model.ProductInfo;
|
|
|
import com.yohoufo.product.model.ProductSeriesTemplate;
|
|
|
import com.yohoufo.product.model.ProductSortTemplate;
|
|
|
import com.yohoufo.product.request.StoragePriceBo;
|
|
|
import com.yohoufo.product.response.ProductDetailResp;
|
|
|
import com.yohoufo.product.response.ProductSeriesTemplateResp;
|
...
|
...
|
@@ -777,4 +773,66 @@ public class ProductServiceImpl implements ProductService{ |
|
|
sc.setSub(new ArrayList<>());
|
|
|
return sc;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public SkupInfo querySkupDetailBySkup(int skup) {
|
|
|
|
|
|
StoragePrice skupDo = storagePriceMapper.selectBySkup(skup);
|
|
|
|
|
|
Product product = productMapper.selectByPrimaryKey(skupDo.getProductId());
|
|
|
|
|
|
Goods goods = goodsMapper.selectByPrimaryKey(skupDo.getGoodsId());
|
|
|
|
|
|
List<GoodsImages> goodsImages = goodsImagesMapper.selectByGoodsId(skupDo.getGoodsId());
|
|
|
|
|
|
List<String> imageList = CollectionUtils.isEmpty(goodsImages) ? Lists.newArrayList()
|
|
|
: goodsImages.stream().map(GoodsImages::getImageUrl).filter(StringUtils::isNotBlank).collect(Collectors.toList());
|
|
|
|
|
|
Brand brand = product.getBrandId() == null ? null : brandMapper.selectByPrimaryKey(product.getBrandId());
|
|
|
|
|
|
BrandSeries brandSeries = product.getSeriesId() == null ? null : brandSeriesMapper.selectByPrimaryKey(product.getSeriesId());
|
|
|
|
|
|
Pair<Integer, String> skupStatusPair = product.getShelveStatus() == 1 ? getSkupStatus(skupDo.getStatus()) : getSkupStatus(0);
|
|
|
|
|
|
return SkupInfo.builder()
|
|
|
.productId(product.getId())
|
|
|
.productName(product.getProductName())
|
|
|
.productCode(product.getProductCode())
|
|
|
.brandName(brand == null ? "" : brand.getBrandName())
|
|
|
.seriesName(brandSeries == null ? "" : brandSeries.getSeriesName())
|
|
|
.saleTime((product.getSaleTime() == null || product.getSaleTime().equals(0)) ? "0" : DateUtil.getDateString(product.getSaleTime(), DateUtil.YYYY_MM_DD_DOT))
|
|
|
.colorName(goods.getColorName())
|
|
|
.imageList(imageList)
|
|
|
.skup(skup)
|
|
|
.price(skupDo.getPrice())
|
|
|
.status(skupStatusPair.getLeft())
|
|
|
.statusStr(skupStatusPair.getRight())
|
|
|
.storeName("YOHO!STORE艾尚店")
|
|
|
.build();
|
|
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* skup状态:0:已下架;1:可售;2:已售出
|
|
|
* @param status
|
|
|
* @return
|
|
|
*/
|
|
|
private Pair<Integer, String> getSkupStatus(int status) {
|
|
|
int skupStatus = 0;
|
|
|
String skupStatusStr = "已下架";
|
|
|
|
|
|
switch(status) {
|
|
|
case 1:
|
|
|
skupStatus = 1;
|
|
|
skupStatusStr = "可售";
|
|
|
break;
|
|
|
case 100:
|
|
|
skupStatus = 2;
|
|
|
skupStatusStr = "已售出";
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
return Pair.of(skupStatus, skupStatusStr);
|
|
|
}
|
|
|
} |
...
|
...
|
|