From 31e963fab5edf7f0afece695c8224831abd25750 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 06 八月 2019 18:43:06 +0800
Subject: [PATCH] 常用商品缓存,华为推送修改

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsClassControllerV2.java |   47 +++++++++++++++++++++++++++++++----------------
 1 files changed, 31 insertions(+), 16 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsClassControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsClassControllerV2.java
index 14cb402..5e931ce 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsClassControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/GoodsClassControllerV2.java
@@ -32,6 +32,7 @@
 import com.yeshi.fanli.service.inter.lable.LabelClassService;
 import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
 import com.yeshi.fanli.service.inter.lable.TaoKeGoodsService;
+import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
 import com.yeshi.fanli.util.Constant;
 import com.yeshi.fanli.util.StringUtil;
 import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
@@ -72,6 +73,9 @@
 
 	@Resource
 	private LabelClassService labelClassService;
+
+	@Resource
+	private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
 
 	/**
 	 * 涓�绾у垎绫�
@@ -135,6 +139,8 @@
 		// 鎬绘潯鏁�
 		long counttotal = 5000;
 
+		List<TaoBaoGoodsBrief> updateGoodsList = new ArrayList<>();
+
 		// 绮鹃�夊簱鏁版嵁涓虹┖鏃讹紝缃戠粶杩涜鏌ヨ
 		if (listQuery == null || listQuery.size() == 0) {
 			long count = qualityGoodsService.countQueryClassId(gcid);
@@ -179,6 +185,7 @@
 			if (taoBaoGoodsBrief == null) {
 				continue;
 			}
+			updateGoodsList.add(taoBaoGoodsBrief);
 			GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate,
 					shareRate);
 			array.add(gson.toJson(goodsDetailVO));
@@ -189,6 +196,10 @@
 		data.put("count", counttotal);
 		data.put("result", array);
 		out.print(JsonUtil.loadTrueResult(data));
+		try {
+			taoBaoGoodsUpdateService.addUpdateQueueAsync(updateGoodsList);
+		} catch (Exception e) {
+		}
 	}
 
 	/**
@@ -198,15 +209,19 @@
 	 * @param page
 	 * @param scid
 	 * @param filter
-	 * @param order      鏉ユ簮锛氥�愭帹鑽愶細0 | 缁煎悎锛�4 銆佺患鍚堝彧鐪嬫湁鍒� 1 銆佺患鍚堝彧鐪嬪ぉ鐚� 1 | 浠锋牸锛氫綆鍒伴珮3 楂樺埌浣�2 | 閿�閲忥細1銆�
-	 *                   鎺掑簭鍊硷細銆愰攢閲忕敱楂樺埌浣�: 1 锛� 閿�閲忕敱浣庡埌楂� 5锛� 浠锋牸浠庨珮鍒颁綆: 2 锛� 浠锋牸浠庝綆鍒伴珮:3 锛� 鎺ㄥ箍閲忛珮鍒颁綆:4
-	 *                   锛� 鍏朵粬榛樿锛� 閿�閲忕敱楂樺埌浣庛��
+	 * @param order
+	 *            鏉ユ簮锛氥�愭帹鑽愶細0 | 缁煎悎锛�4 銆佺患鍚堝彧鐪嬫湁鍒� 1 銆佺患鍚堝彧鐪嬪ぉ鐚� 1 | 浠锋牸锛氫綆鍒伴珮3 楂樺埌浣�2 | 閿�閲忥細1銆�
+	 *            鎺掑簭鍊硷細銆愰攢閲忕敱楂樺埌浣�: 1 锛� 閿�閲忕敱浣庡埌楂� 5锛� 浠锋牸浠庨珮鍒颁綆: 2 锛� 浠锋牸浠庝綆鍒伴珮:3 锛� 鎺ㄥ箍閲忛珮鍒颁綆:4 锛�
+	 *            鍏朵粬榛樿锛� 閿�閲忕敱楂樺埌浣庛��
 	 * 
-	 * @param startprice 璧峰浠锋牸
-	 * @param endprice   缁撴潫浠锋牸
-	 * @param fastFilter fastFilter 鏈夊埜 [{"type":"quantype"}] 澶╃尗鍟嗗搧
-	 *                   [{"type":"shoptype"}]
-	 * @param totalSales 閿�閲忎互涓�
+	 * @param startprice
+	 *            璧峰浠锋牸
+	 * @param endprice
+	 *            缁撴潫浠锋牸
+	 * @param fastFilter
+	 *            fastFilter 鏈夊埜 [{"type":"quantype"}] 澶╃尗鍟嗗搧 [{"type":"shoptype"}]
+	 * @param totalSales
+	 *            閿�閲忎互涓�
 	 * @param out
 	 */
 	@RequestMapping(value = "getSubGoods", method = RequestMethod.POST)
@@ -236,9 +251,9 @@
 			if (catesId.endsWith(","))
 				catesId = catesId.substring(0, catesId.length() - 1);
 			sf.setCateIds(catesId);
-			
+
 			// 鎸夊垎绫诲悕绉版悳绱�
-			if (!StringUtil.isNullOrEmpty(catesId))	{
+			if (!StringUtil.isNullOrEmpty(catesId)) {
 				String searchParam = goodsSubClass.getSearchJson();
 				Gson gs = new Gson();
 				SearchFilter searchfilter = gs.fromJson(searchParam, SearchFilter.class);
@@ -251,7 +266,6 @@
 						totalSales);
 				TaoBaoSearchResult searchResult = TaoKeApiUtil.searchWuLiao(searchfilter);
 				long count = searchResult.getPageEntity().getTotalCount();
-
 
 				List<TaoBaoGoodsBrief> resultGoodsList = searchResult.getTaoBaoGoodsBriefs();
 				// 鏌ヨ鏄惁瓒呰繃浜嗘渶澶х殑鍟嗗搧鏁�
@@ -272,19 +286,20 @@
 							resultGoodsList.addAll(resultListTemp);
 					}
 				}
-				
+
 				Gson gson2 = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
 						.excludeFieldsWithoutExposeAnnotation().create();
-				
+
 				JSONArray array = new JSONArray();
 				BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
 				BigDecimal shareRate = hongBaoManageService.getShareRate();
 				if (resultGoodsList != null)
 					for (TaoBaoGoodsBrief goods : resultGoodsList) {
-						GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(goods, null, fanLiRate, shareRate);
+						GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(goods, null, fanLiRate,
+								shareRate);
 						array.add(gson2.toJson(goodsDetailVO));
 					}
-				
+
 				JSONObject result = new JSONObject();
 				result.put("result", array);
 				result.put("count", result.optLong("count") + count);
@@ -302,7 +317,7 @@
 				searchfilter.setKey(goodsSubClass.getKey());
 				taoKeGoodsService.setSearchFilter(searchfilter, filter, order, startprice, endprice, fastFilter,
 						totalSales);
-				
+
 				JSONObject result = taoKeGoodsService.searchWuLiaoV2(searchfilter);
 				out.print(JsonUtil.loadTrueResult(result));
 				return;

--
Gitblit v1.8.0