From 8cb7ec4a35a38ae91d0eed17cde711e81d2b2bbf Mon Sep 17 00:00:00 2001
From: yujian <yujian>
Date: 星期二, 14 五月 2019 11:37:49 +0800
Subject: [PATCH] 合并

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/GoodsClassController.java |  165 +++++++++++++++++++++++-------------------------------
 1 files changed, 70 insertions(+), 95 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/GoodsClassController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/GoodsClassController.java
index b62e3c8..35fa3dd 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/GoodsClassController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/GoodsClassController.java
@@ -4,7 +4,6 @@
 import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -20,36 +19,34 @@
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
 import com.yeshi.fanli.entity.accept.AcceptData;
-import com.yeshi.fanli.entity.bus.clazz.ClassRecommendGoods;
 import com.yeshi.fanli.entity.bus.clazz.GoodsClass;
 import com.yeshi.fanli.entity.bus.clazz.GoodsSecondClass;
 import com.yeshi.fanli.entity.bus.clazz.GoodsSubClass;
+import com.yeshi.fanli.entity.bus.homemodule.SwiperPicture;
 import com.yeshi.fanli.entity.bus.lable.QualityFactory;
-import com.yeshi.fanli.entity.bus.su.clazz.SuperGoodsClass;
-import com.yeshi.fanli.entity.system.System;
+import com.yeshi.fanli.entity.system.BusinessSystem;
 import com.yeshi.fanli.entity.taobao.SearchFilter;
 import com.yeshi.fanli.entity.taobao.TaoBaoCoupon;
 import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
 import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBriefExtra;
 import com.yeshi.fanli.entity.taobao.TaoBaoSearchNav;
 import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
-import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
 import com.yeshi.fanli.log.LogHelper;
-import com.yeshi.fanli.service.inter.config.SystemService;
-import com.yeshi.fanli.service.inter.goods.ClassRecommendGoodsService;
+import com.yeshi.fanli.service.inter.config.BusinessSystemService;
 import com.yeshi.fanli.service.inter.goods.GoodsClassService;
 import com.yeshi.fanli.service.inter.goods.GoodsSecondClassService;
 import com.yeshi.fanli.service.inter.goods.GoodsSubClassService;
 import com.yeshi.fanli.service.inter.goods.SuperGoodsClassService;
 import com.yeshi.fanli.service.inter.goods.TaoBaoClassService;
 import com.yeshi.fanli.service.inter.goods.TaoBaoCouponService;
+import com.yeshi.fanli.service.inter.homemodule.HomeNavbarService;
+import com.yeshi.fanli.service.inter.homemodule.SwiperPictureService;
 import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
 import com.yeshi.fanli.service.inter.lable.LabelClassService;
 import com.yeshi.fanli.service.inter.lable.QualityFactoryService;
 import com.yeshi.fanli.service.inter.lable.QualityGoodsService;
 import com.yeshi.fanli.service.inter.lable.TaoKeGoodsService;
 import com.yeshi.fanli.service.inter.monitor.MonitorService;
-import com.yeshi.fanli.util.CMQManager;
 import com.yeshi.fanli.util.Constant;
 import com.yeshi.fanli.util.RedisManager;
 import com.yeshi.fanli.util.StringUtil;
@@ -73,9 +70,6 @@
 	private GoodsSecondClassService goodsSecondClassService;
 
 	@Resource
-	private ClassRecommendGoodsService classRecommendGoodsService;
-
-	@Resource
 	private GoodsClassService goodsClassService;
 
 	@Resource
@@ -91,7 +85,7 @@
 	private HongBaoManageService manageService;
 
 	@Resource
-	private SystemService systemService;
+	private BusinessSystemService businessSystemService;
 
 	@Resource
 	private RedisManager redisManager;
@@ -112,6 +106,12 @@
 
 	@Resource
 	private MonitorService monitorService;
+	
+	@Resource
+	private HomeNavbarService homeNavbarService;
+	@Resource
+	private SwiperPictureService swiperPictureService;
+
 
 	@Resource(name = "taskExecutor")
 	private TaskExecutor executor;
@@ -126,13 +126,7 @@
 	public void getGoodsClass(AcceptData acceptData, PrintWriter out) {
 
 		try {
-			System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
-			if (system == null) {
-				out.print(JsonUtil.loadFalseResult("绯荤粺涓嶅瓨鍦�"));
-				return;
-			}
-
-			List<GoodsClass> goodsClassList = goodsClassService.getListClassCache(system.getId());
+			List<GoodsClass> goodsClassList = goodsClassService.getEffectiveClassCache();
 			if (goodsClassList == null || goodsClassList.size() == 0) {
 				out.print(JsonUtil.loadFalseResult("鏆傛棤鏁版嵁"));
 				return;
@@ -140,7 +134,7 @@
 
 			JSONObject data = new JSONObject();
 			data.put("count", goodsClassList.size());
-			data.put("goodsClassList", goodsClassList);
+			data.put("goodsClassList", JsonUtil.getApiCommonGson().toJson(goodsClassList));
 
 			out.print(JsonUtil.loadTrueResult(data));
 		} catch (Exception e) {
@@ -162,22 +156,50 @@
 	 * @param out
 	 */
 	@RequestMapping(value = "getgoodssecondclass", method = RequestMethod.POST)
-	public void getGoodsSecondClass(AcceptData acceptData, long gcid, PrintWriter out) {
-
+	public void getGoodsSecondClass(AcceptData acceptData, long gcid, Long swpid, PrintWriter out) {
 		try {
-
 			GoodsClass goodsClass = goodsClassService.getGoodsClassCache(gcid);
 			if (goodsClass == null) {
 				out.print(JsonUtil.loadFalseResult("鏆傛棤鏁版嵁"));
 				return;
 			}
 
+			// 杞挱鍥�
+			List<SwiperPicture> picList = null;
+			if (swpid != null) {
+				picList = swiperPictureService.getByBannerId(swpid);
+			}
+			if (picList == null) {
+				picList = new ArrayList<SwiperPicture>();
+			}
+			
 			List<GoodsSubClass> goodsSubClassList = goodsSubClassService.getSubClassCache(gcid, 1);
 			if (goodsSubClassList == null) {
 				goodsSubClassList = new ArrayList<GoodsSubClass>();
 			}
-
+			
+			boolean changePicture = false;
+			String version = acceptData.getVersion();
+			int tversion = Integer.parseInt(version);
+			String platform = acceptData.getPlatform();
+			if ("android".equalsIgnoreCase(platform) && tversion > 38) {
+				changePicture = true;
+			} else if (tversion > 47){
+				changePicture = true;
+			}
+			
+			// 1.5.3鏂扮増鍥剧墖鏇挎崲
+			if (changePicture) {
+				for (GoodsSubClass goodsSubClass: goodsSubClassList) {
+					String pictureSecond = goodsSubClass.getPictureSecond();
+					if (pictureSecond != null && pictureSecond.trim().length() > 0) {
+						goodsSubClass.setPicture(pictureSecond);
+					}
+				}
+			}
+			
 			JSONObject data = new JSONObject();
+			data.put("picList", JsonUtil.getApiCommonGson().toJson(picList));
 			data.put("count", goodsSubClassList.size());
 			data.put("goodsSecondClassList", JsonUtil.getApiCommonGson().toJson(goodsSubClassList));
 			out.print(JsonUtil.loadTrueResult(data));
@@ -201,7 +223,12 @@
 							goodsClass.setIosClick(1L);
 						}
 					}
-					goodsClassService.updateByPrimaryKeySelective(goodsClass);
+					
+					GoodsClass gc = new GoodsClass();
+					gc.setId(goodsClass.getId());
+					gc.setIosClick(goodsClass.getIosClick());
+					gc.setAndroidClick(goodsClass.getAndroidClick());
+					goodsClassService.updateByPrimaryKeySelective(gc);
 				}
 			});
 
@@ -216,20 +243,6 @@
 
 	}
 
-	@RequestMapping(value = "getclassrecommendgoods", method = RequestMethod.POST)
-	public void getClassRecommendGoods(AcceptData acceptData, long goodsClassId, PrintWriter out) {
-		List<ClassRecommendGoods> classRecommendGoodsList = classRecommendGoodsService
-				.getClassRecommendGoodsByGoodsClassId(goodsClassId);
-		if (classRecommendGoodsList == null) {
-			out.print(JsonUtil.loadFalseResult("鏆傛棤鏁版嵁"));
-			return;
-		}
-		JSONObject data = new JSONObject();
-		data.put("count", classRecommendGoodsList.size());
-		data.put("classRecommendGoodsList", JsonUtil.getApiCommonGson().toJson(classRecommendGoodsList));
-		String result = JsonUtil.loadTrueResult(data);
-		out.print(result);
-	}
 
 	@RequestMapping(value = "getCouponGoods", method = RequestMethod.POST)
 	public void getCouponGoods(AcceptData acceptData, int page, long gcid, PrintWriter out) {
@@ -280,7 +293,7 @@
 	@RequestMapping(value = "getgoods", method = RequestMethod.POST)
 	public void getGoods(AcceptData acceptData, int page, long scid, String filter, String order, String startprice,
 			String endprice, String fastFilter, PrintWriter out) {
-		System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
+		BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), acceptData.getPackages());
 		if (system == null) {
 			out.print(JsonUtil.loadFalseResult("绯荤粺涓嶅瓨鍦�"));
 			return;
@@ -388,7 +401,7 @@
 	@RequestMapping(value = "getsecondclassgoods", method = RequestMethod.POST)
 	public void getSecondClassGoods(AcceptData acceptData, int page, long scid, String filter, String order,
 			String startprice, String endprice, String fastFilter, Integer totalSales, PrintWriter out) {
-		System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
+		BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), acceptData.getPackages());
 		if (system == null) {
 			out.print(JsonUtil.loadFalseResult("绯荤粺涓嶅瓨鍦�"));
 			return;
@@ -562,7 +575,7 @@
 	@RequestMapping("choiceGoods")
 	public void choiceGoods(AcceptData acceptData, long gcid, int page, PrintWriter out) {
 
-		System system = systemService.getSystemCache(acceptData.getPlatform(), acceptData.getPackages());
+		BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), acceptData.getPackages());
 		if (system == null) {
 			out.print(JsonUtil.loadFalseResult("绯荤粺涓嶅瓨鍦�"));
 			return;
@@ -603,17 +616,12 @@
 				filter = new SearchFilter();
 			}
 
-			// String searchKey = goodsClass.getName();
-			// String key = goodsClass.getKey();
-			// if (key != null && !"".equals(key.trim())) {
-			// searchKey = key;
-			// }
-			// filter.setKey(searchKey);
-
 			filter.setMaterialId("6707");
 			filter.setPage(page);
 			filter.setPageSize(pageSize);
 			filter.setCateIds(taoBaoCatIds);
+			//娴嬭瘯鏃舵坊鍔�
+			filter.setSort(TaoBaoUtil.SORT_SALE_HIGH_TO_LOW);//閿�閲忎粠楂樺埌浣�
 
 			JSONObject result = taoKeGoodsService.searchWuLiao(filter);
 			out.print(JsonUtil.loadTrueResult(result));
@@ -660,44 +668,6 @@
 		data.put("result", array);
 		out.print(JsonUtil.loadTrueResult(data));
 
-		/*
-		 * // 娴嬭瘯鍙栨秷缂撳瓨 GoodsClass goodsClass =
-		 * goodsClassService.getGoodsClassCache(gcid); if (goodsClass == null) {
-		 * out.append(JsonUtil.loadFalseResult("涓嶅瓨鍦ㄨ鍒嗙被")); return; }
-		 * 
-		 * SearchFilter sf = new SearchFilter(); sf.setKey(goodsClass.getKey());
-		 * sf.setPage(page); sf.setPageSize(Constant.PAGE_SIZE); sf.setQuan(1);
-		 * 
-		 * TaoBaoSearchResult result = TaoKeApiUtil.searchWuLiao(sf);
-		 * 
-		 * List<TaoBaoSearchNav> navList = TaoBaoUtil.getBaseNav(); if
-		 * (result.getNavList() != null) navList.addAll(result.getNavList());
-		 * Gson gson = new GsonBuilder().create(); JSONObject data = new
-		 * JSONObject(); data.put("nav", gson.toJson(navList));
-		 * List<TaoBaoGoodsBriefExtra> re = new
-		 * ArrayList<TaoBaoGoodsBriefExtra>(); List<TaoBaoGoodsBrief>
-		 * taoBaoGoodsBriefs = result.getTaoBaoGoodsBriefs(); Map<String,
-		 * String> map = manageService.convertMap(); String proportion =
-		 * map.get("hongbao_goods_proportion"); String fcRate =
-		 * map.get("hongbao_fc_ratio");
-		 * 
-		 * TaoBaoGoodsBriefExtra taoBaoGoodsBriefExtra; if (taoBaoGoodsBriefs !=
-		 * null) for (TaoBaoGoodsBrief taoBaoGoodsBrief : taoBaoGoodsBriefs) {
-		 * int count = taoBaoGoodsBrief.getBiz30day(); if (count >= 10000) {
-		 * double sales = count; String salesCountMidea = String.format("%.1f",
-		 * sales / 10000); taoBaoGoodsBrief.setSalesCount(salesCountMidea +
-		 * "涓�"); taoBaoGoodsBriefExtra =
-		 * TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion,
-		 * fcRate, ""); re.add(taoBaoGoodsBriefExtra); } else {
-		 * taoBaoGoodsBrief.setSalesCount(count + ""); taoBaoGoodsBriefExtra =
-		 * TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion,
-		 * fcRate, ""); re.add(taoBaoGoodsBriefExtra); } }
-		 * 
-		 * Gson gson2 = JsonUtil.getApiCommonGson(); data.put("result",
-		 * gson2.toJson(re)); data.put("count",
-		 * result.getTaoBaoHead().getDocsfound());
-		 * out.print(JsonUtil.loadTrueResult(data));
-		 */
 
 	}
 
@@ -778,7 +748,7 @@
 		if (meterialId > 0)
 			result = TaoKeApiUtil.getMaterialByMaterialId(meterialId, page, 20);
 		else
-			result = TaoKeApiUtil.searchCouple(goodsClassService.getKwById(id), null, page, 20);
+			result = TaoKeApiUtil.searchCouple(goodsClassService.getKeysById(id), null, page, 20);
 
 		List<TaoBaoSearchNav> navList = TaoBaoUtil.getBaseNav();
 		if (result.getNavList() != null)
@@ -832,14 +802,19 @@
 	@RequestMapping(value = { "getcategory" }, method = { org.springframework.web.bind.annotation.RequestMethod.POST })
 	public void getcategory(AcceptData acceptData, PrintWriter out) {
 		try {
-			com.yeshi.fanli.entity.system.System system = this.systemService.getSystemCache(acceptData.getPlatform(),
-					acceptData.getPackages());
-			if (system == null) {
-				out.print(JsonUtil.loadFalseResult("绯荤粺涓嶅瓨鍦�"));
-				return;
+			
+			boolean changePicture = false;
+			String version = acceptData.getVersion();
+			int tversion = Integer.parseInt(version);
+			String platform = acceptData.getPlatform();
+			if ("android".equalsIgnoreCase(platform) && tversion > 38) {
+				changePicture = true;
+			} else if (tversion > 47){
+				changePicture = true;
 			}
-
-			List<Map<String, Object>> listCache = goodsClassService.getClassListAllCache(system.getId());
+			
+			
+			List<Map<String, Object>> listCache = goodsClassService.getClassListAllCache(changePicture);
 			if (listCache == null) {
 				listCache = new ArrayList<Map<String, Object>>();
 			}

--
Gitblit v1.8.0