From 770ede03b2e532ff3729a8f447bdb4351637ca63 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期二, 02 六月 2020 12:02:58 +0800
Subject: [PATCH] 云发单兼容动态+商品详情

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

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java
index d023e8b..a754074 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java
@@ -13,7 +13,6 @@
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
-import org.yeshi.utils.HttpUtil;
 import org.yeshi.utils.JsonUtil;
 import org.yeshi.utils.taobao.TbImgUtil;
 
@@ -33,6 +32,10 @@
 import com.yeshi.fanli.entity.bus.user.ShamUser;
 import com.yeshi.fanli.entity.bus.user.UserInfo;
 import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
+import com.yeshi.fanli.entity.dynamic.CommentInfo;
+import com.yeshi.fanli.entity.dynamic.GoodsEvaluate;
+import com.yeshi.fanli.entity.dynamic.ImgInfo;
+import com.yeshi.fanli.entity.dynamic.ImgInfo.ImgEnum;
 import com.yeshi.fanli.entity.goods.CollectionGoodsV2;
 import com.yeshi.fanli.entity.goods.CommonGoods;
 import com.yeshi.fanli.entity.jd.JDGoods;
@@ -654,6 +657,12 @@
 			couponInfoList.add(goodsDetail.getCouponInfo());
 			goodsDetail.setCouponInfoList(couponInfoList);
 		}
+		
+		
+		if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) {
+			getCloudInfo(goodsDetail); // 浜戝彂鍗曟枃妗堜俊鎭�
+		}
+		
 		JSONObject object = new JSONObject();
 		object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO));
 		object.put("goods", JsonUtil.getApiCommonGson().toJson(goodsDetail));
@@ -871,6 +880,10 @@
 		ShareVO shareInfoVO = new ShareVO();
 		shareInfoVO.setHelpLink(helpLink);
 		extraVO.setShare(shareInfoVO);
+		
+		if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) {
+			getCloudInfo(goodsDetail); // 浜戝彂鍗曟枃妗堜俊鎭�
+		}
 
 		JSONObject object = new JSONObject();
 		object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO));
@@ -1056,6 +1069,10 @@
 			extraVO.setCouponJumpLink(convertUrl.getUrl());
 			extraVO.setNativeCouponJumpLink(PinDuoDuoUtil.getAndroidNativeURI(convertUrl.getUrl()));
 		}
+		
+		if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) {
+			getCloudInfo(goodsDetail); // 浜戝彂鍗曟枃妗堜俊鎭�
+		}
 
 		JSONObject object = new JSONObject();
 		object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO));
@@ -1191,6 +1208,9 @@
 		ShareVO shareInfoVO = new ShareVO();
 		shareInfoVO.setHelpLink(helpLink);
 		extraVO.setShare(shareInfoVO);
+		
+		// 浜戝彂鍗曟枃妗堜俊鎭�
+		getCloudInfo(goodsDetail); 
 
 		JSONObject object = new JSONObject();
 		object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO));
@@ -1323,6 +1343,9 @@
 		shareInfoVO.setHelpLink(helpLink);
 		extraVO.setShare(shareInfoVO);
 
+		// 浜戝彂鍗曟枃妗堜俊鎭�
+		getCloudInfo(goodsDetail); 
+				
 		JSONObject object = new JSONObject();
 		object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO));
 		object.put("goods", JsonUtil.getApiCommonGson().toJson(goodsDetail));
@@ -1345,6 +1368,44 @@
 			}
 		});
 	}
+	
+	/**
+	 * 	// 浜戝彂鍗曟枃妗堜俊鎭�
+	 * @param goodsDetail
+	 */
+	private void getCloudInfo(GoodsDetailVO goodsDetail) {
+		if (!goodsDetail.isHasCoupon()) {
+			return;
+		}
+		GoodsEvaluate evaluate = goodsEvaluateService.queryExistSingle(goodsDetail.getGoodsId() +"", goodsDetail.getGoodsType());
+		if (evaluate != null) {
+			String cloudText = null;
+			List<CommentInfo> comments = evaluate.getComments();
+			if (comments != null && comments.size() > 0) {
+				cloudText = comments.get(0).getContent();
+			}
+			
+			String cloudPic = null;
+			List<ImgInfo> imgList = evaluate.getImgList();
+			if (imgList != null && imgList.size() > 0) {
+				for (ImgInfo imgInfo: imgList) {
+					ImgEnum type = imgInfo.getType();
+					if (type == ImgEnum.goods) {
+						cloudPic = imgInfo.getUrl();
+					}
+				}
+			}
+			
+			if (!StringUtil.isNullOrEmpty(cloudText) && !StringUtil.isNullOrEmpty(cloudPic)) {
+				OtherInfo otherInfo = goodsDetail.getOtherInfo();
+				if (otherInfo == null)
+					otherInfo = new OtherInfo();
+				otherInfo.setCloudPic(cloudPic);
+				otherInfo.setCloudText(cloudText);
+				goodsDetail.setOtherInfo(otherInfo);
+			}
+		}
+	}
 
 	/**
 	 * 鍟嗗搧璇︽儏鎺ㄨ崘锛堢寽浣犲枩娆� + 鎺ㄨ崘锛�

--
Gitblit v1.8.0