From 3eb97e3efbc84ae920a7d1048357615a04308618 Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期四, 18 七月 2019 17:32:02 +0800
Subject: [PATCH] 搜索结果店铺处理

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoShopServiceImpl.java |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 48 insertions(+), 0 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoShopServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoShopServiceImpl.java
index 1cc4323..1ee728d 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoShopServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoShopServiceImpl.java
@@ -23,9 +23,11 @@
 import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService;
 import com.yeshi.fanli.util.StringUtil;
 import com.yeshi.fanli.util.db.MongoDBManager;
+import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
 import com.yeshi.fanli.util.taobao.TaoBaoShopUtil;
 import com.yeshi.fanli.util.taobao.TaoBaoUtil;
 import com.yeshi.fanli.vo.brand.TaoBaoShopVO;
+import com.yeshi.fanli.vo.goods.GoodsDetailVO;
 
 @Service
 public class TaoBaoShopServiceImpl implements TaoBaoShopService {
@@ -197,4 +199,50 @@
 		}
 		return list;
 	}
+	
+	
+	@Override
+	@Cacheable(value = "brandCache", key = "'getShopByKeyV2-'+#key")
+	public List<TaoBaoShopVO> getShopByKeyV2(String key) {
+		List<TaoBaoShopVO> list = taoBaoShopMapper.getShopByKey(key);
+		if (list == null || list.size() == 0) {
+			return null;
+		}
+
+		BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
+		BigDecimal shareRate = hongBaoManageService.getShareRate();
+		for (TaoBaoShopVO taoBaoShopVO : list) {
+			
+			Integer userType = taoBaoShopVO.getUserType();
+			if (userType == null || userType == 0) {
+				taoBaoShopVO.setUserType(10);
+			} else {
+				taoBaoShopVO.setUserType(11);
+			}
+
+			String shopLink = taoBaoShopVO.getShopLink();
+			if (StringUtil.isNullOrEmpty(shopLink)) {
+				taoBaoShopVO.setShopLink(TaoBaoUtil.getShopLink(taoBaoShopVO.getId()));
+			}
+
+			String shopNameCustom = taoBaoShopVO.getShopNameCustom();
+			if (!StringUtil.isNullOrEmpty(shopNameCustom)) {
+				taoBaoShopVO.setShopName(shopNameCustom);
+			}
+
+			String shopIconCustom = taoBaoShopVO.getShopIconCustom();
+			if (!StringUtil.isNullOrEmpty(shopIconCustom)) {
+				taoBaoShopVO.setShopIcon(shopIconCustom);
+			}
+
+			List<GoodsDetailVO> listGoods = new ArrayList<GoodsDetailVO>();
+			List<TaoBaoGoodsBrief> listGoodsBrief = taoBaoShopVO.getListGoodsBrief();
+			for (TaoBaoGoodsBrief taoBaoGoodsBrief : listGoodsBrief) {
+				GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate, shareRate);
+				listGoods.add(goodsDetailVO);
+			}
+			taoBaoShopVO.setListGoodsVO(listGoods);
+		}
+		return list;
+	}
 }

--
Gitblit v1.8.0