Authored by mali

二手封面

... ... @@ -76,4 +76,28 @@ public class GoodsService {
goodsImageBO.setImageUrl(ImageUrlAssist.getAllProductPicUrl(imageUrl, "goodsimg", "center", "d2hpdGU="));
return goodsImageBO;
}
public String getGoodsDeafultImage(Integer goodsId) {
List<GoodsImages> goodsImages = goodsImagesMapper.selectByGoodsId(goodsId);
String defaultYImage = null;
String fistImage = null;
for(GoodsImages image : goodsImages) {
if(StringUtils.isNotBlank(image.getImageUrl())) {
if(StringUtils.isBlank(fistImage)) {
fistImage = image.getImageUrl();
}
if(StringUtils.equals(image.getIsDefault(), "Y")) {
defaultYImage = image.getImageUrl();
break;
}
}
}
if(StringUtils.isNotBlank(defaultYImage)) {
return ImageUrlAssist.getAllProductPicUrl(defaultYImage, "goodsimg", "center", "d2hpdGU=");
} else if(StringUtils.isNotBlank(fistImage)) {
return ImageUrlAssist.getAllProductPicUrl(fistImage, "goodsimg", "center", "d2hpdGU=");
} else {
return "";
}
}
}
... ...
... ... @@ -1754,16 +1754,19 @@ public class ProductServiceImpl implements ProductService {
resp.setStatus(sp.getStatus());
Integer storageId = sp.getStorageId();
Integer productId = sp.getProductId();
Storage storage = storageMapper.selectByPrimaryKey(storageId);
Storage storage = storageService.selectStorageByCache(storageId);
Goods goods = goodsMapper.selectByPrimaryKey(storage.getGoodsId());
Product product = productMapper.selectByPrimaryKey(productId);
Size size = sizeMapper.selectByPrimaryKey(storage.getSizeId());
Brand brand = brandMapper.selectByPrimaryKey(product.getBrandId());
Product product = productHelpService.selectByIdCache(productId);
String sizeName = sizeCacheService.queryNameBySizeId(storage.getSizeId());
Brand brand = brandCacheService.queryByBrandId(product.getBrandId());
List<SecondhandImages> secondhandImagesList = secondhandImagesMapper.selectBySkup(skup);
SecondhandInfo secondhandInfo = secondhandInfoMapper.selectBySkup(skup);
resp.setProductId(productId);
resp.setImage(getGoodsDeafultImage(goods.getId()));
resp.setImage(goodsService.getGoodsDeafultImage(goods.getId()));
resp.setImageList(secondhandImagesList.stream().map(image -> com.yohoufo.common.helper.ImagesHelper.getImageAbsoluteUrl(image.getImageUrl(), "goodsimg")).collect(Collectors.toList()));
resp.setGender(productHelpService.getGenderName(product.getGender()));
... ... @@ -1775,7 +1778,7 @@ public class ProductServiceImpl implements ProductService {
resp.setSavePrice(inStockLeastPrice.subtract(sp.getPrice()).toString());
}
resp.setSizeName(size.getSizeName() + "码");
resp.setSizeName(sizeName + "码");
resp.setProductName(product.getProductName());
resp.setProductCode(product.getProductCode());
resp.setColorName(goods.getGoodsName());
... ... @@ -2007,31 +2010,6 @@ public class ProductServiceImpl implements ProductService {
}
return sizeIdList;
}
private String getGoodsDeafultImage(Integer goodsId) {
List<GoodsImages> goodsImages = goodsImagesMapper.selectByGoodsId(goodsId);
String defaultYImage = null;
String fistImage = null;
for(GoodsImages image : goodsImages) {
if(StringUtils.isNotBlank(image.getImageUrl())) {
if(StringUtils.isBlank(fistImage)) {
fistImage = image.getImageUrl();
}
if(StringUtils.equals(image.getIsDefault(), "Y")) {
defaultYImage = image.getImageUrl();
break;
}
}
}
if(StringUtils.isNotBlank(defaultYImage)) {
return ImageUrlAssist.getAllProductPicUrl(defaultYImage, "goodsimg", "center", "d2hpdGU=");
} else if(StringUtils.isNotBlank(fistImage)) {
return ImageUrlAssist.getAllProductPicUrl(fistImage, "goodsimg", "center", "d2hpdGU=");
} else {
return "";
}
}
private void setProductProfitRate(ProductInfo productInfo, Integer productId) {
if (null == productId) {
... ...