From ff34faee79dfdbb2a72839b97b1e748551549b08 Mon Sep 17 00:00:00 2001
From: yj <Administrator@192>
Date: 星期五, 06 三月 2020 10:21:02 +0800
Subject: [PATCH] 发圈

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java |   51 +++++++++++++++++++++++++++++++--------------------
 1 files changed, 31 insertions(+), 20 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java
index 9e33f5b..3bcc297 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/GoodsEvaluateServiceImpl.java
@@ -16,6 +16,7 @@
 import javax.annotation.Resource;
 import javax.imageio.ImageIO;
 
+import org.apache.commons.beanutils.PropertyUtils;
 import org.springframework.cache.annotation.Cacheable;
 import org.springframework.core.task.TaskExecutor;
 import org.springframework.stereotype.Service;
@@ -1444,38 +1445,37 @@
 	}
 
 	@Override
-	@Cacheable(value = "dynamicCache", key = "'queryMaterialsCache-'+#start+'-'+#type")
+//	@Cacheable(value = "dynamicCache", key = "'queryMaterialsCache-'+#start+'-'+#type")
 	public List<GoodsEvaluate> queryMaterialsCache(int start, int count, int type) throws Exception {
 		List<GoodsEvaluate> list = goodsEvaluateDao.queryValid(start, count, type);
-
-		List<GoodsEvaluate> listOBJ = list;
-		// 鏇存柊鍟嗗搧淇℃伅
-		executor.execute(new Runnable() {
-			@Override
-			public void run() {
-				updateGoodInfo(listOBJ);
-			}
-		});
-
 		if (list == null) {
 			list = new ArrayList<>();
 		}
 		Date now = new Date();
 		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
+		
+		List<GoodsEvaluate> listNew = new ArrayList<>();
 		for (GoodsEvaluate goodsEvaluate : list) {
-
+			
+			GoodsEvaluate evaluateNew = new GoodsEvaluate();
+			try {
+				PropertyUtils.copyProperties(evaluateNew, goodsEvaluate);
+			} catch (Exception e) {
+				e.printStackTrace();
+				continue;
+			}
+			
 			int comment = 0;
-			List<CommentInfo> comments = goodsEvaluate.getComments();
+			List<CommentInfo> comments = evaluateNew.getComments();
 			if (comments != null && comments.size() > 0) {
-				EvaluateEnum typeEnum = goodsEvaluate.getType();
+				EvaluateEnum typeEnum = evaluateNew.getType();
 				List<CommentInfo> commentNew = new ArrayList<>();
 
 				for (CommentInfo commentInfo : comments) {
 					comment++;
-
 					CommentInfoEnum typeComment = commentInfo.getTypeEnum();
 					if (typeComment != null && typeComment == CommentInfoEnum.goodsCoupon) {
-						GoodsDetailVO goods = goodsEvaluate.getGoods();
+						GoodsDetailVO goods = evaluateNew.getGoods();
 						if (goods.isHasCoupon()) {
 							commentNew.add(commentInfo);
 							continue;
@@ -1505,17 +1505,17 @@
 
 					commentNew.add(commentInfo);
 				}
-				goodsEvaluate.setComments(commentNew);
+				evaluateNew.setComments(commentNew);
 
 				if (typeEnum != null && typeEnum == EvaluateEnum.single) {
 					if (comment > 0 && commentNew.size() == 0) { // 鎵�鏈夊埜璇勮涓嬫灦
-						GoodsDetailVO goods = goodsEvaluate.getGoods();
+						GoodsDetailVO goods = evaluateNew.getGoods();
 						if (goods != null) {
 							goods.setState(1); // 璇勮涓嶅瓨鍦� 涓嬫灦
 							LogHelper.test("鑾峰彇鍒楄〃鍟嗗搧涓嬫灦1");
 						}
 
-						List<ImgInfo> imgList = goodsEvaluate.getImgList();
+						List<ImgInfo> imgList = evaluateNew.getImgList();
 						if (imgList != null) {
 							for (ImgInfo imgInfo : imgList) {
 								SimpleGoods simpleGoods = imgInfo.getGoods();
@@ -1529,9 +1529,20 @@
 					}
 				}
 			}
+			
+			listNew.add(evaluateNew);
 		}
 
-		return list;
+		List<GoodsEvaluate> listOBJ = list;
+		// 鏇存柊鍟嗗搧淇℃伅
+		executor.execute(new Runnable() {
+			@Override
+			public void run() {
+				updateGoodInfo(listOBJ);
+			}
+		});
+		
+		return listNew;
 	}
 
 	@Override

--
Gitblit v1.8.0