From fe879975a3e8a0a1aa280fb839e02d159bfbcff8 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 27 八月 2019 18:04:38 +0800
Subject: [PATCH] 金币任务多次获取bug修改

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TaoBaoShopServiceImpl.java |   61 ++++++++++++++++++++++++++++--
 1 files changed, 56 insertions(+), 5 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 1a5c03a..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 {
@@ -35,7 +37,7 @@
 
 	@Resource
 	private TaoBaoShopMapper taoBaoShopMapper;
-	
+
 	@Resource
 	private HongBaoManageService hongBaoManageService;
 
@@ -81,7 +83,7 @@
 	}
 
 	@Override
-	public void changeInfo(MultipartFile file, Long id, String shopName) {
+	public void changeInfo(MultipartFile file, Long id, String shopName, String key) {
 		TaoBaoShop taoBaoShop = taoBaoShopMapper.selectByPrimaryKey(id);
 		if (taoBaoShop == null) {
 			return;
@@ -113,6 +115,7 @@
 
 		updateShop.setId(id);
 		updateShop.setShopNameCustom(shopName);
+		updateShop.setKey(key);
 		taoBaoShopMapper.updateByPrimaryKeySelective(updateShop);
 	}
 
@@ -153,12 +156,14 @@
 		if (shop != null)
 			return shop;
 		shop = TaoBaoUtil.getTaoBaoShopDetailByAuctionId(auctionId);
-		if (shop != null)
-			taoBaoShopMapper.insert(shop);
+		try {
+			if (shop != null)
+				taoBaoShopMapper.insert(shop);
+		} catch (Exception e) {
+		}
 		return shop;
 	}
 
-	
 	@Override
 	@Cacheable(value = "brandCache", key = "'getShopByKey-'+#key")
 	public List<TaoBaoShopVO> getShopByKey(String key) {
@@ -194,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