From bf052072dbce8c74f1eeff6adb4af1c73e94ffce Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期一, 18 五月 2020 14:52:57 +0800
Subject: [PATCH] iso版本改为81

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/DynamicControllerV2.java |   68 +++++++++++++++++++++++++++++++--
 1 files changed, 63 insertions(+), 5 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/DynamicControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/DynamicControllerV2.java
index 5be2ddb..4c4c8ce 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/DynamicControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/DynamicControllerV2.java
@@ -12,6 +12,7 @@
 
 import javax.annotation.Resource;
 
+import org.apache.commons.beanutils.PropertyUtils;
 import org.springframework.core.task.TaskExecutor;
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -621,11 +622,61 @@
 			} else if (cid == TYPE_SUCAI) {
 				type = 2;
 			}
+			List<GoodsEvaluate> listNew = new ArrayList<GoodsEvaluate>();
 
 			List<GoodsEvaluate> list = goodsEvaluateService.queryMaterialsCache((page - 1) * Constant.PAGE_SIZE,
 					Constant.PAGE_SIZE, type);
-			if (list == null) {
-				list = new ArrayList<>();
+
+			if (!VersionUtil.greaterThan_2_1_1(acceptData.getPlatform(), acceptData.getVersion())) {
+				listNew.addAll(list);
+			} else if (list.size() > 0) { // 娲诲姩鍥剧墖涓嶅厑璁歌烦杞�
+				for (GoodsEvaluate goodsEvaluate : list) {
+					if (goodsEvaluate.getType() != EvaluateEnum.activity) {
+						listNew.add(goodsEvaluate);
+						continue;
+					}
+
+					GoodsEvaluate evaluateNew = new GoodsEvaluate();
+					try {
+						PropertyUtils.copyProperties(evaluateNew, goodsEvaluate);
+					} catch (Exception e) {
+						e.printStackTrace();
+						continue;
+					}
+					// 璺宠浆杩囨浮椤�
+					String jumpLink = configService.get(ConfigKeyEnum.activityDetailLink.getKey()) + "?type=%s&id=%s";
+					jumpLink = String.format(jumpLink, "circle", evaluateNew.getId());
+					evaluateNew.setJumpLink(jumpLink);
+
+					// 鍥剧墖鏁伴噺
+					if (evaluateNew.getImgList() != null && evaluateNew.getImgList().size() > 0) {
+						int size = evaluateNew.getImgList().size();
+						List<ImgInfo> listInfoNew = new ArrayList<ImgInfo>();
+
+						for (ImgInfo imgInfo : goodsEvaluate.getImgList()) {
+							if (imgInfo.getType() != ImgEnum.activity) {
+								listInfoNew.add(imgInfo);
+								continue;
+							}
+							ImgInfo infoNew = new ImgInfo();
+							try {
+								PropertyUtils.copyProperties(infoNew, imgInfo);
+							} catch (Exception e) {
+								e.printStackTrace();
+								continue;
+							}
+							infoNew.setType(ImgEnum.img);
+							// 鍥剧墖澶т簬涓�寮犳椂 鏄剧ず涔濆鏍煎浘
+							if (size > 1) {
+								infoNew.setW(1);
+								infoNew.setH(1);
+							}
+							listInfoNew.add(infoNew);
+						}
+						evaluateNew.setImgList(listInfoNew);
+					}
+					listNew.add(evaluateNew);
+				}
 			}
 
 			GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
@@ -706,7 +757,7 @@
 
 			JSONArray jsonArray = new JSONArray();
 
-			String listStr = gson.toJson(list);
+			String listStr = gson.toJson(listNew);
 			JSONArray array = JSONArray.fromObject(listStr);
 			for (int i = 0; i < array.size(); i++) {
 				Object object = array.get(i);
@@ -1162,11 +1213,12 @@
 			List<ImgInfo> imgList = evaluate.getImgList();
 			if (imgList != null && imgList.size() > 0) {
 				for (ImgInfo imgInfo : imgList) {
-					if (imgInfo.getType() == ImgEnum.img && !StringUtil.isNullOrEmpty(imgInfo.getUrl())) {
+					if (!StringUtil.isNullOrEmpty(imgInfo.getUrl()) 
+							&& (imgInfo.getType() == ImgEnum.img || imgInfo.getType() == ImgEnum.activity)) {
 						imgs.add(imgInfo.getUrl());
 					}
 					
-					if (imgInfo.getType() == ImgEnum.img || imgInfo.getType() == ImgEnum.video) {
+					if (imgInfo.getType() == ImgEnum.img || imgInfo.getType() == ImgEnum.activity) {
 						if (StringUtil.isNullOrEmpty(jumpLink) && !StringUtil.isNullOrEmpty(imgInfo.getActivityUrl())) {
 							jumpLink  = imgInfo.getActivityUrl();
 						}
@@ -1210,6 +1262,12 @@
 				comment = shareInfo.getComment();
 			}
 		}
+		
+		if (!StringUtil.isNullOrEmpty(comment)) { // 鏇挎崲娣樺疂瀹樻柟娲诲姩
+			List<String> activityIdList = convertLinkManager.getTaoBaoOfficialActivityId(comment);
+			for (String st : activityIdList)
+				comment = comment.replace(st, "");
+		}
 
 		JSONObject data = new JSONObject();
 		data.put("title", title);

--
Gitblit v1.8.0