From 51a4ff5d777028d52a19c314a99f796334cb7b51 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期六, 23 十一月 2019 18:30:01 +0800
Subject: [PATCH] 配置文件修改

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/goods/recommend/RecommendGoodsDeleteHistoryServiceImpl.java |   50 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/recommend/RecommendGoodsDeleteHistoryServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/recommend/RecommendGoodsDeleteHistoryServiceImpl.java
index 46eb4f9..73d6b51 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/recommend/RecommendGoodsDeleteHistoryServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/goods/recommend/RecommendGoodsDeleteHistoryServiceImpl.java
@@ -1,14 +1,22 @@
 package com.yeshi.fanli.service.impl.goods.recommend;
 
+import java.util.ArrayList;
 import java.util.Date;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 
 import javax.annotation.Resource;
 
+import org.springframework.cache.Cache;
+import org.springframework.cache.ehcache.EhCacheCacheManager;
 import org.springframework.stereotype.Service;
 
 import com.yeshi.fanli.dao.mybatis.goods.recommend.RecommendGoodsDeleteHistoryMapper;
 import com.yeshi.fanli.entity.goods.recommend.RecommendGoodsDeleteHistory;
+import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
 import com.yeshi.fanli.service.inter.goods.recommend.RecommendGoodsDeleteHistoryService;
+import com.yeshi.fanli.util.Constant;
 import com.yeshi.fanli.util.StringUtil;
 
 @Service
@@ -16,6 +24,8 @@
 
 	@Resource
 	private RecommendGoodsDeleteHistoryMapper recommendGoodsDeleteHistoryMapper;
+	@Resource
+	private EhCacheCacheManager ehCacheCacheManager;
 
 	@Override
 	public void addRecommendGoodsDeleteHistory(RecommendGoodsDeleteHistory history) {
@@ -25,6 +35,46 @@
 		if (history.getCreateTime() == null)
 			history.setCreateTime(new Date());
 		recommendGoodsDeleteHistoryMapper.insertSelective(history);
+		try {
+			// 娓呴櫎涓汉鎺ㄨ崘鐨勭紦瀛�
+			Cache cache = ehCacheCacheManager.getCache("recommendUserCache");
+			cache.clear();
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
 	}
 
+	@Override
+	public List<TaoBaoGoodsBrief> filterGoods(String device, List<TaoBaoGoodsBrief> goodsList) {
+		List<TaoBaoGoodsBrief> resultList = new ArrayList<>();
+		if (goodsList == null || goodsList.size() == 0)
+			return goodsList;
+
+		Map<Long, TaoBaoGoodsBrief> resultMap = new ConcurrentHashMap<>();
+		List<RecommendGoodsDeleteHistory> hlist = new ArrayList<>();
+		for (TaoBaoGoodsBrief goods : goodsList) {
+			hlist.add(new RecommendGoodsDeleteHistory(goods.getAuctionId(), Constant.SOURCE_TYPE_TAOBAO));
+			resultMap.put(goods.getAuctionId(), goods);
+		}
+		List<RecommendGoodsDeleteHistory> existList = recommendGoodsDeleteHistoryMapper.listByGoodsInfo(device, hlist);
+		if (existList != null)
+			for (RecommendGoodsDeleteHistory dh : existList)
+				resultMap.remove(dh.getGoodsId());
+
+		for (TaoBaoGoodsBrief goods : goodsList) {
+			if (resultMap.get(goods.getAuctionId()) != null)
+				resultList.add(resultMap.get(goods.getAuctionId()));
+		}
+		return resultList;
+	}
+
+	@Override
+	public List<RecommendGoodsDeleteHistory> listBackStage(long start, int count, String key) {
+		return recommendGoodsDeleteHistoryMapper.listBackStage(start, count, key);
+	}
+	
+	@Override
+	public long countBackStage(String key) {
+		return recommendGoodsDeleteHistoryMapper.countBackStage(key);
+	}
 }

--
Gitblit v1.8.0