From 0fbe4163e855c1537d6f0040b12fa1501a499de0 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 11 六月 2019 09:13:05 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoShopServiceImpl.java |   44 ++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 44 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 308223d..b6d9cae 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
@@ -1,20 +1,25 @@
 package com.yeshi.fanli.service.impl.taobao;
 
 import java.io.InputStream;
+import java.math.BigDecimal;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.UUID;
 
 import javax.annotation.Resource;
 
+import org.springframework.cache.annotation.Cacheable;
 import org.springframework.stereotype.Service;
 import org.springframework.web.multipart.MultipartFile;
 import org.yeshi.utils.tencentcloud.COSManager;
 
 import com.yeshi.fanli.dao.mybatis.taobao.TaoBaoShopMapper;
 import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
+import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra;
 import com.yeshi.fanli.entity.taobao.TaoBaoShop;
 import com.yeshi.fanli.entity.taobao.TaoBaoShopInfo;
 import com.yeshi.fanli.log.LogHelper;
+import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
 import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService;
 import com.yeshi.fanli.util.StringUtil;
 import com.yeshi.fanli.util.db.MongoDBManager;
@@ -30,6 +35,9 @@
 
 	@Resource
 	private TaoBaoShopMapper taoBaoShopMapper;
+	
+	@Resource
+	private HongBaoManageService hongBaoManageService;
 
 	@Override
 	public TaoBaoShopInfo getTaoBaoShopInfo(TaoBaoGoodsBrief goodsInfo) {
@@ -153,4 +161,40 @@
 		return shop;
 	}
 
+	
+	@Override
+	@Cacheable(value = "brandCache", key = "'getShopByKey-'+#key")
+	public List<TaoBaoShopVO> getShopByKey(String key) {
+		List<TaoBaoShopVO> list = taoBaoShopMapper.getShopByKey(key);
+		if (list == null || list.size() == 0) {
+			return null;
+		}
+
+		BigDecimal proportion = hongBaoManageService.getFanLiRate();
+		for (TaoBaoShopVO taoBaoShopVO : list) {
+
+			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<TaoBaoGoodsBriefExtra> listGoods = new ArrayList<TaoBaoGoodsBriefExtra>();
+			List<TaoBaoGoodsBrief> listGoodsBrief = taoBaoShopVO.getListGoodsBrief();
+			for (TaoBaoGoodsBrief taoBaoGoodsBrief : listGoodsBrief) {
+				listGoods.add(TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null));
+			}
+			taoBaoShopVO.setListGoods(listGoods);
+		}
+		return list;
+	}
 }

--
Gitblit v1.8.0