Authored by caoyan

Merge branch 'test6.9.17' of http://git.yoho.cn/ufo/yohoufo-fore into test6.9.17

... ... @@ -200,6 +200,7 @@
<delete id="clearUserHistoryData">
update seller_wallet_detail set del = 1
where uid = #{uid,jdbcType=INTEGER}
and del=0
</delete>
</mapper>
\ No newline at end of file
... ...
... ... @@ -20,6 +20,8 @@ public enum UfoProductCacheKeyEnum {
PRODUCT_STORAGE_INFO_KEY("ufo:product:storageInfo:", "商品SKU信息", 15, TimeUnit.MINUTES),
PRODUCT_STORAGE_BASE_INFO_KEY("ufo:product:baseStorageInfo:", "商品SKU基本信息", 15, TimeUnit.MINUTES),
SIZE_LIST_CACHE_KEY("ufo:product:sizeList:", "尺码列表", 15, TimeUnit.MINUTES),
STORAGE_PRICE_IN_STOCK_INFO_KEY("ufo:product:storagePrice:inStock", "商品现货价格信息", 5, TimeUnit.MINUTES),
... ...
... ... @@ -3,6 +3,7 @@ package com.yohoufo.product.service.cache;
import com.google.common.collect.Maps;
import com.yoho.core.cache.LocalCache;
import com.yoho.core.cache.LocalCacheCallback;
import com.yohoufo.common.helper.ImageUrlAssist;
import com.yohoufo.dal.product.BrandMapper;
import com.yohoufo.dal.product.model.Brand;
import com.yohoufo.product.cache.UfoProductCacheKeyEnum;
... ... @@ -68,6 +69,7 @@ public class BrandCacheService implements LocalCacheService {
LOG.warn("No data in database table (brand).");
collect = Maps.newHashMap();
} else {
brandList.forEach(item -> item.setBrandLogo(ImageUrlAssist.getAllProductPicUrl(item.getBrandLogo(), "brandLogo", "center", "d2hpdGU=")));
collect = brandList.stream().collect(Collectors.toMap(Brand::getId, Function.identity()));
}
LOG.info("end load allBrand, costTime:{}", System.currentTimeMillis()-beginTime);
... ...
... ... @@ -18,6 +18,19 @@ import java.util.function.BinaryOperator;
import java.util.function.Function;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.yohobuy.ufo.model.request.product.ProductRequestBo;
import com.yohobuy.ufo.model.response.StorageCheckResp;
import com.yohobuy.ufo.model.response.store.StoreInfoBo;
import com.yohoufo.common.ApiResponse;
import com.yohoufo.common.constant.BusinessClientEnum;
import com.yohoufo.common.exception.UfoServiceException;
import com.yohoufo.common.utils.OrikaUtils;
import com.yohoufo.dal.product.*;
import com.yohoufo.dal.product.model.*;
import com.yohoufo.product.service.cache.BrandCacheService;
import com.yohoufo.product.service.cache.SizeCacheService;
import org.apache.commons.collections.MapUtils;
import org.apache.commons.lang.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
... ... @@ -138,6 +151,9 @@ public class ProductServiceImpl implements ProductService {
private BrandMapper brandMapper;
@Autowired
private BrandCacheService brandCacheService;
@Autowired
private BrandSeriesMapper brandSeriesMapper;
@Autowired
... ... @@ -216,6 +232,9 @@ public class ProductServiceImpl implements ProductService {
private BidProductService bidProductService;
@Autowired
private SizeCacheService sizeCacheService;
@Autowired
private SizePoolMapper sizePoolMapper;
@Autowired
... ... @@ -1665,10 +1684,15 @@ public class ProductServiceImpl implements ProductService {
@Override
public JSONObject querySecondHandProductListFilter(Integer storageId) {
Storage storage = storageMapper.selectByPrimaryKey(storageId);
Size size = sizeMapper.selectByPrimaryKey(storage.getSizeId());
Product product = productMapper.selectByPrimaryKey(storage.getProductId());
Brand brand = brandMapper.selectByPrimaryKey(product.getBrandId());
Storage storage = storageService.selectStorageByCache(storageId);
//Storage storage = storageMapper.selectByPrimaryKey(storageId);
// Size size = sizeMapper.selectByPrimaryKey(storage.getSizeId());
String sizeName = sizeCacheService.queryNameBySizeId(storage.getSizeId());
Product product = productHelpService.selectByIdCache(storage.getProductId());
//Product product = productMapper.selectByPrimaryKey(storage.getProductId());
//Brand brand = brandMapper.selectByPrimaryKey(product.getBrandId());
Brand brand = brandCacheService.queryByBrandId(product.getBrandId());
List<Integer> type = storagePriceMapper.selectSecondHandType(storageId);
JSONObject jo = new JSONObject();
... ... @@ -1699,7 +1723,7 @@ public class ProductServiceImpl implements ProductService {
JSONArray filterSizeItemArray = new JSONArray();
JSONObject filterSizeItem = new JSONObject();
filterSizeItem.put("itemId", storageId);
filterSizeItem.put("itemName", size.getSizeName());
filterSizeItem.put("itemName", sizeName);
filterSizeItemArray.add(filterSizeItem);
filterSize.put("itemList", filterSizeItemArray);
filterArray.add(filterSize);
... ... @@ -1712,7 +1736,7 @@ public class ProductServiceImpl implements ProductService {
JSONObject filterBrandItem = new JSONObject();
filterBrandItem.put("itemId", brand.getId());
filterBrandItem.put("itemName", brand.getBrandName());
filterBrandItem.put("itemUrl", ImageUrlAssist.getAllProductPicUrl(brand.getBrandLogo(), "brandLogo", "center", "d2hpdGU="));
filterBrandItem.put("itemUrl", brand.getBrandLogo());
filterBrandItemArray.add(filterBrandItem);
filterBrand.put("itemList", filterBrandItemArray);
filterArray.add(filterBrand);
... ...
... ... @@ -79,4 +79,14 @@ public class StorageService {
productCacheService.setCacheByString(UfoProductCacheKeyEnum.PRODUCT_STORAGE_INFO_KEY, result, goodsBO.getId());
return result;
}
public Storage selectStorageByCache(Integer storageId) {
Storage cacheById = productCacheService.getCacheByString(UfoProductCacheKeyEnum.PRODUCT_STORAGE_BASE_INFO_KEY, Storage.class, storageId);
if (null != cacheById) {
return cacheById;
}
Storage storage = storageMapper.selectByPrimaryKey(storageId);
productCacheService.setCacheByString(UfoProductCacheKeyEnum.PRODUCT_STORAGE_BASE_INFO_KEY, storage, storageId);
return storage;
}
}
... ...