From 7912a94e5de72b628bde39b16e6c7b21172910eb Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期一, 08 六月 2020 17:15:39 +0800
Subject: [PATCH] 2.1.2bug

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsControllerV2.java |  118 ++++++++++++++++++++++++++++++++---------------------------
 1 files changed, 64 insertions(+), 54 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 bbc8660..bf824c5 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
@@ -25,6 +25,7 @@
 import com.yeshi.fanli.dto.pdd.PDDPromotionUrl;
 import com.yeshi.fanli.dto.pdd.PDDSearchFilter;
 import com.yeshi.fanli.dto.suning.SuningGoodsInfo;
+import com.yeshi.fanli.dto.suning.SuningGoodsInfoRecommend;
 import com.yeshi.fanli.dto.taobao.DaTaoKeFilterResult;
 import com.yeshi.fanli.dto.vip.VIPConvertResultDTO;
 import com.yeshi.fanli.dto.vip.goods.VIPGoodsInfo;
@@ -660,7 +661,7 @@
 		
 		
 		if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) {
-			getCloudInfo(goodsDetail, extraVO);  // 浜戝彂鍗曟枃妗堜俊鎭�
+			getCloudInfo(acceptData, goodsDetail, extraVO);  // 浜戝彂鍗曟枃妗堜俊鎭�
 		}
 		
 		JSONObject object = new JSONObject();
@@ -882,7 +883,7 @@
 		extraVO.setShare(shareInfoVO);
 		
 		if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) {
-			getCloudInfo(goodsDetail, extraVO);  // 浜戝彂鍗曟枃妗堜俊鎭�
+			getCloudInfo(acceptData, goodsDetail, extraVO);  // 浜戝彂鍗曟枃妗堜俊鎭�
 		}
 
 		JSONObject object = new JSONObject();
@@ -1071,7 +1072,7 @@
 		}
 		
 		if (VersionUtil.greaterThan_2_1_2(acceptData.getPlatform(), acceptData.getVersion())) {
-			getCloudInfo(goodsDetail, extraVO); // 浜戝彂鍗曟枃妗堜俊鎭�
+			getCloudInfo(acceptData, goodsDetail, extraVO); // 浜戝彂鍗曟枃妗堜俊鎭�
 		}
 
 		JSONObject object = new JSONObject();
@@ -1210,7 +1211,7 @@
 		extraVO.setShare(shareInfoVO);
 		
 		// 浜戝彂鍗曟枃妗堜俊鎭�
-		getCloudInfo(goodsDetail, extraVO); 
+		getCloudInfo(acceptData, goodsDetail, extraVO); 
 
 		JSONObject object = new JSONObject();
 		object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO));
@@ -1344,7 +1345,7 @@
 		extraVO.setShare(shareInfoVO);
 
 		// 浜戝彂鍗曟枃妗堜俊鎭�
-		getCloudInfo(goodsDetail, extraVO); 
+		getCloudInfo(acceptData, goodsDetail, extraVO); 
 				
 		JSONObject object = new JSONObject();
 		object.put("extra", JsonUtil.getApiCommonGson().toJson(extraVO));
@@ -1373,10 +1374,19 @@
 	 * 	// 浜戝彂鍗曟枃妗堜俊鎭�
 	 * @param goodsDetail
 	 */
-	private void getCloudInfo(GoodsDetailVO goodsDetail, GoodsDetailExtraVO extraVO) {
+	private void getCloudInfo(AcceptData acceptData, GoodsDetailVO goodsDetail, GoodsDetailExtraVO extraVO) {
+		// 浜戝彂鍗曟槸鍚﹀紑鍚�
+		String cloudState = configService.getByVersion(ConfigKeyEnum.robotCloudOpen.getKey(), acceptData.getPlatform(),
+				Integer.parseInt(acceptData.getVersion()));
+		if (!StringUtil.isNullOrEmpty(cloudState) && "1".equals(cloudState)) {
+			extraVO.setCloudOpen(true);
+		}
+		
+		
 		if (!goodsDetail.isHasCoupon()) {
 			return;
 		}
+		
 		GoodsEvaluate evaluate = goodsEvaluateService.queryExistSingle(goodsDetail.getGoodsId() +"", goodsDetail.getGoodsType());
 		if (evaluate != null) {
 			String cloudText = null;
@@ -1417,7 +1427,6 @@
 		}
 
 		try {
-
 			// 浜笢
 			if (goodsType == Constant.SOURCE_TYPE_JD) {
 				JSONObject data = new JSONObject();
@@ -1490,11 +1499,50 @@
 				return;
 			}
 
-			if (goodsType == Constant.SOURCE_TYPE_SUNING) {
-				// 鐚滀綘鍠滄
-
+			// 鍞搧浼�
+			if (goodsType == Constant.SOURCE_TYPE_VIP) {
+				JSONObject data = new JSONObject();
+				data.put("listGuess", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>()));
+				data.put("listQuality", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>()));
+				out.print(JsonUtil.loadTrueResult(data));
+				return;
 			}
+			
+			// 鑻忓畞
+			if (goodsType == Constant.SOURCE_TYPE_SUNING) {
+				List<SuningGoodsInfo> resultList = null;
+				String[] ids = SuningUtil.getGoodsIdDetail(id);
+				List<SuningGoodsInfoRecommend> list = SuningApiUtil.getRecommendGoods(ids[1], ids[0]);
+				if (list != null && list.size() > 0) {
+					List<String> listId = new ArrayList<>();
+					for (SuningGoodsInfoRecommend goodsInfo:  list) {
+						 if (goodsInfo != null) {
+							 listId.add(goodsInfo.getCommodityCode() + "-" + goodsInfo.getSupplierCode());
+						 }
+					}
+					resultList = SuningApiUtil.getGoodsDetailList(listId);
+				}
+				
+				List<GoodsDetailVO> listDetailVO = new ArrayList<GoodsDetailVO>();
+				if (resultList != null) {
+					if (resultList != null && resultList.size() > 0) {
+						ConfigParamsDTO paramsDTO = orderHongBaoMoneyComputeService.getShowComputeRate(acceptData.getPlatform(),
+								acceptData.getVersion());
 
+						for (SuningGoodsInfo goods : resultList) {
+							GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertSuningGoods(goods, paramsDTO);
+							listDetailVO.add(goodsDetailVO);
+						}
+					}
+				}
+				
+				JSONObject data = new JSONObject();
+				data.put("listQuality", JsonUtil.getApiCommonGson().toJson(listDetailVO));
+				data.put("listGuess", JsonUtil.getApiCommonGson().toJson(new ArrayList<GoodsDetailVO>()));
+				out.print(JsonUtil.loadTrueResult(data));
+				return;
+			}
+			
 			List<TaoBaoGoodsBrief> goodsList = TaoKeApiUtil.guessLikeByAuctionId(Long.parseLong(id), 10);
 			// 鍒濆鍖�
 			if (goodsList == null) {
@@ -1502,50 +1550,12 @@
 			}
 
 			List<GoodsDetailVO> listExtra = new ArrayList<GoodsDetailVO>();
-			TaoKeAppInfo app = new TaoKeAppInfo();
-			app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY);
-			app.setAppSecret(TaoBaoConstant.TAOBAO_AUTH_APPSECRET);
-			app.setAdzoneId(TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT.split("_")[3]);
-			app.setPid(TaoBaoConstant.TAOBAO_SPECIAL_PID_DEFAULT);
-
-			List<Long> ids = new ArrayList<>();
-			for (TaoBaoGoodsBrief goods : goodsList)
-				ids.add(goods.getAuctionId());
-
-			try {
-				goodsList = TaoKeApiUtil.getBatchGoodsInfo(ids);
-			} catch (TaoKeApiException e1) {
-			} catch (TaobaoGoodsDownException e1) {
-			}
-
-			if (goodsList != null && goodsList.size() > 0) {
-
-				ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), null);
-
-				goodsList.parallelStream().forEach(goods -> {
-					if (goods != null) {
-						// 鑾峰彇璇︽儏
-						TaoBaoGoodsBrief taoBaoGoodsBrief = null;
-						try {
-							taoBaoGoodsBrief = taoBaoGoodsCacheUtil.getCommonTaoBaoGoodsInfo(goods.getAuctionId());
-						} catch (Exception e) {
-							e.printStackTrace();
-						}
-
-						if (taoBaoGoodsBrief == null) {
-							TaoBaoGoodsBrief newGoods = TaoKeApiUtil.specialConvertCoupon(goods.getAuctionId(), app);
-							goods.setCouponInfo(newGoods.getCouponInfo());
-							goods.setCouponLink(newGoods.getCouponLink());
-							goods.setTkRate(newGoods.getTkRate());
-							taoBaoGoodsBrief = goods;
-						}
-
-						if (taoBaoGoodsBrief != null) {
-							listExtra.add(GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO));
-						}
-					}
-				});
-			}
+			ConfigParamsDTO paramsDTO = getParamsDTO(acceptData.getPlatform(), acceptData.getVersion(), null);
+			goodsList.parallelStream().forEach(goods -> {
+				if (goods != null) {				
+					listExtra.add(GoodsDetailVOFactory.convertTaoBao(goods, paramsDTO));
+				}
+			});
 
 			List<GoodsDetailVO> listQuality = new ArrayList<GoodsDetailVO>();
 			// 鍙栧伓鏁颁釜鏁版嵁

--
Gitblit v1.8.0