Authored by caoyan

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

@@ -200,6 +200,7 @@ @@ -200,6 +200,7 @@
200 <delete id="clearUserHistoryData"> 200 <delete id="clearUserHistoryData">
201 update seller_wallet_detail set del = 1 201 update seller_wallet_detail set del = 1
202 where uid = #{uid,jdbcType=INTEGER} 202 where uid = #{uid,jdbcType=INTEGER}
  203 + and del=0
203 </delete> 204 </delete>
204 205
205 </mapper> 206 </mapper>
@@ -20,6 +20,8 @@ public enum UfoProductCacheKeyEnum { @@ -20,6 +20,8 @@ public enum UfoProductCacheKeyEnum {
20 20
21 PRODUCT_STORAGE_INFO_KEY("ufo:product:storageInfo:", "商品SKU信息", 15, TimeUnit.MINUTES), 21 PRODUCT_STORAGE_INFO_KEY("ufo:product:storageInfo:", "商品SKU信息", 15, TimeUnit.MINUTES),
22 22
  23 + PRODUCT_STORAGE_BASE_INFO_KEY("ufo:product:baseStorageInfo:", "商品SKU基本信息", 15, TimeUnit.MINUTES),
  24 +
23 SIZE_LIST_CACHE_KEY("ufo:product:sizeList:", "尺码列表", 15, TimeUnit.MINUTES), 25 SIZE_LIST_CACHE_KEY("ufo:product:sizeList:", "尺码列表", 15, TimeUnit.MINUTES),
24 26
25 STORAGE_PRICE_IN_STOCK_INFO_KEY("ufo:product:storagePrice:inStock", "商品现货价格信息", 5, TimeUnit.MINUTES), 27 STORAGE_PRICE_IN_STOCK_INFO_KEY("ufo:product:storagePrice:inStock", "商品现货价格信息", 5, TimeUnit.MINUTES),
@@ -3,6 +3,7 @@ package com.yohoufo.product.service.cache; @@ -3,6 +3,7 @@ package com.yohoufo.product.service.cache;
3 import com.google.common.collect.Maps; 3 import com.google.common.collect.Maps;
4 import com.yoho.core.cache.LocalCache; 4 import com.yoho.core.cache.LocalCache;
5 import com.yoho.core.cache.LocalCacheCallback; 5 import com.yoho.core.cache.LocalCacheCallback;
  6 +import com.yohoufo.common.helper.ImageUrlAssist;
6 import com.yohoufo.dal.product.BrandMapper; 7 import com.yohoufo.dal.product.BrandMapper;
7 import com.yohoufo.dal.product.model.Brand; 8 import com.yohoufo.dal.product.model.Brand;
8 import com.yohoufo.product.cache.UfoProductCacheKeyEnum; 9 import com.yohoufo.product.cache.UfoProductCacheKeyEnum;
@@ -68,6 +69,7 @@ public class BrandCacheService implements LocalCacheService { @@ -68,6 +69,7 @@ public class BrandCacheService implements LocalCacheService {
68 LOG.warn("No data in database table (brand)."); 69 LOG.warn("No data in database table (brand).");
69 collect = Maps.newHashMap(); 70 collect = Maps.newHashMap();
70 } else { 71 } else {
  72 + brandList.forEach(item -> item.setBrandLogo(ImageUrlAssist.getAllProductPicUrl(item.getBrandLogo(), "brandLogo", "center", "d2hpdGU=")));
71 collect = brandList.stream().collect(Collectors.toMap(Brand::getId, Function.identity())); 73 collect = brandList.stream().collect(Collectors.toMap(Brand::getId, Function.identity()));
72 } 74 }
73 LOG.info("end load allBrand, costTime:{}", System.currentTimeMillis()-beginTime); 75 LOG.info("end load allBrand, costTime:{}", System.currentTimeMillis()-beginTime);
@@ -18,6 +18,19 @@ import java.util.function.BinaryOperator; @@ -18,6 +18,19 @@ import java.util.function.BinaryOperator;
18 import java.util.function.Function; 18 import java.util.function.Function;
19 import java.util.stream.Collectors; 19 import java.util.stream.Collectors;
20 20
  21 +import com.alibaba.fastjson.JSON;
  22 +import com.alibaba.fastjson.serializer.SerializerFeature;
  23 +import com.yohobuy.ufo.model.request.product.ProductRequestBo;
  24 +import com.yohobuy.ufo.model.response.StorageCheckResp;
  25 +import com.yohobuy.ufo.model.response.store.StoreInfoBo;
  26 +import com.yohoufo.common.ApiResponse;
  27 +import com.yohoufo.common.constant.BusinessClientEnum;
  28 +import com.yohoufo.common.exception.UfoServiceException;
  29 +import com.yohoufo.common.utils.OrikaUtils;
  30 +import com.yohoufo.dal.product.*;
  31 +import com.yohoufo.dal.product.model.*;
  32 +import com.yohoufo.product.service.cache.BrandCacheService;
  33 +import com.yohoufo.product.service.cache.SizeCacheService;
21 import org.apache.commons.collections.MapUtils; 34 import org.apache.commons.collections.MapUtils;
22 import org.apache.commons.lang.ArrayUtils; 35 import org.apache.commons.lang.ArrayUtils;
23 import org.apache.commons.lang3.StringUtils; 36 import org.apache.commons.lang3.StringUtils;
@@ -138,6 +151,9 @@ public class ProductServiceImpl implements ProductService { @@ -138,6 +151,9 @@ public class ProductServiceImpl implements ProductService {
138 private BrandMapper brandMapper; 151 private BrandMapper brandMapper;
139 152
140 @Autowired 153 @Autowired
  154 + private BrandCacheService brandCacheService;
  155 +
  156 + @Autowired
141 private BrandSeriesMapper brandSeriesMapper; 157 private BrandSeriesMapper brandSeriesMapper;
142 158
143 @Autowired 159 @Autowired
@@ -216,6 +232,9 @@ public class ProductServiceImpl implements ProductService { @@ -216,6 +232,9 @@ public class ProductServiceImpl implements ProductService {
216 private BidProductService bidProductService; 232 private BidProductService bidProductService;
217 233
218 @Autowired 234 @Autowired
  235 + private SizeCacheService sizeCacheService;
  236 +
  237 + @Autowired
219 private SizePoolMapper sizePoolMapper; 238 private SizePoolMapper sizePoolMapper;
220 239
221 @Autowired 240 @Autowired
@@ -1665,10 +1684,15 @@ public class ProductServiceImpl implements ProductService { @@ -1665,10 +1684,15 @@ public class ProductServiceImpl implements ProductService {
1665 1684
1666 @Override 1685 @Override
1667 public JSONObject querySecondHandProductListFilter(Integer storageId) { 1686 public JSONObject querySecondHandProductListFilter(Integer storageId) {
1668 - Storage storage = storageMapper.selectByPrimaryKey(storageId);  
1669 - Size size = sizeMapper.selectByPrimaryKey(storage.getSizeId());  
1670 - Product product = productMapper.selectByPrimaryKey(storage.getProductId());  
1671 - Brand brand = brandMapper.selectByPrimaryKey(product.getBrandId()); 1687 + Storage storage = storageService.selectStorageByCache(storageId);
  1688 + //Storage storage = storageMapper.selectByPrimaryKey(storageId);
  1689 + // Size size = sizeMapper.selectByPrimaryKey(storage.getSizeId());
  1690 + String sizeName = sizeCacheService.queryNameBySizeId(storage.getSizeId());
  1691 + Product product = productHelpService.selectByIdCache(storage.getProductId());
  1692 + //Product product = productMapper.selectByPrimaryKey(storage.getProductId());
  1693 + //Brand brand = brandMapper.selectByPrimaryKey(product.getBrandId());
  1694 + Brand brand = brandCacheService.queryByBrandId(product.getBrandId());
  1695 +
1672 List<Integer> type = storagePriceMapper.selectSecondHandType(storageId); 1696 List<Integer> type = storagePriceMapper.selectSecondHandType(storageId);
1673 1697
1674 JSONObject jo = new JSONObject(); 1698 JSONObject jo = new JSONObject();
@@ -1699,7 +1723,7 @@ public class ProductServiceImpl implements ProductService { @@ -1699,7 +1723,7 @@ public class ProductServiceImpl implements ProductService {
1699 JSONArray filterSizeItemArray = new JSONArray(); 1723 JSONArray filterSizeItemArray = new JSONArray();
1700 JSONObject filterSizeItem = new JSONObject(); 1724 JSONObject filterSizeItem = new JSONObject();
1701 filterSizeItem.put("itemId", storageId); 1725 filterSizeItem.put("itemId", storageId);
1702 - filterSizeItem.put("itemName", size.getSizeName()); 1726 + filterSizeItem.put("itemName", sizeName);
1703 filterSizeItemArray.add(filterSizeItem); 1727 filterSizeItemArray.add(filterSizeItem);
1704 filterSize.put("itemList", filterSizeItemArray); 1728 filterSize.put("itemList", filterSizeItemArray);
1705 filterArray.add(filterSize); 1729 filterArray.add(filterSize);
@@ -1712,7 +1736,7 @@ public class ProductServiceImpl implements ProductService { @@ -1712,7 +1736,7 @@ public class ProductServiceImpl implements ProductService {
1712 JSONObject filterBrandItem = new JSONObject(); 1736 JSONObject filterBrandItem = new JSONObject();
1713 filterBrandItem.put("itemId", brand.getId()); 1737 filterBrandItem.put("itemId", brand.getId());
1714 filterBrandItem.put("itemName", brand.getBrandName()); 1738 filterBrandItem.put("itemName", brand.getBrandName());
1715 - filterBrandItem.put("itemUrl", ImageUrlAssist.getAllProductPicUrl(brand.getBrandLogo(), "brandLogo", "center", "d2hpdGU=")); 1739 + filterBrandItem.put("itemUrl", brand.getBrandLogo());
1716 filterBrandItemArray.add(filterBrandItem); 1740 filterBrandItemArray.add(filterBrandItem);
1717 filterBrand.put("itemList", filterBrandItemArray); 1741 filterBrand.put("itemList", filterBrandItemArray);
1718 filterArray.add(filterBrand); 1742 filterArray.add(filterBrand);
@@ -79,4 +79,14 @@ public class StorageService { @@ -79,4 +79,14 @@ public class StorageService {
79 productCacheService.setCacheByString(UfoProductCacheKeyEnum.PRODUCT_STORAGE_INFO_KEY, result, goodsBO.getId()); 79 productCacheService.setCacheByString(UfoProductCacheKeyEnum.PRODUCT_STORAGE_INFO_KEY, result, goodsBO.getId());
80 return result; 80 return result;
81 } 81 }
  82 +
  83 + public Storage selectStorageByCache(Integer storageId) {
  84 + Storage cacheById = productCacheService.getCacheByString(UfoProductCacheKeyEnum.PRODUCT_STORAGE_BASE_INFO_KEY, Storage.class, storageId);
  85 + if (null != cacheById) {
  86 + return cacheById;
  87 + }
  88 + Storage storage = storageMapper.selectByPrimaryKey(storageId);
  89 + productCacheService.setCacheByString(UfoProductCacheKeyEnum.PRODUCT_STORAGE_BASE_INFO_KEY, storage, storageId);
  90 + return storage;
  91 + }
82 } 92 }