From 626d711cb15896055c13fe344eb7fcc824589715 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期四, 19 十二月 2019 15:38:42 +0800
Subject: [PATCH] 帮助中心

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/BrandControllerV2.java |   71 +++++++++++++++++++++++++++--------
 1 files changed, 55 insertions(+), 16 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/BrandControllerV2.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/BrandControllerV2.java
index 5dab50c..e347e07 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/BrandControllerV2.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v2/BrandControllerV2.java
@@ -14,6 +14,7 @@
 
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
+import com.yeshi.fanli.dto.ConfigParamsDTO;
 import com.yeshi.fanli.dto.pdd.PDDGoodsDetail;
 import com.yeshi.fanli.entity.accept.AcceptData;
 import com.yeshi.fanli.entity.brand.BrandGoodsCahe;
@@ -44,6 +45,7 @@
 import com.yeshi.fanli.util.Constant;
 import com.yeshi.fanli.util.StringUtil;
 import com.yeshi.fanli.util.ThreadUtil;
+import com.yeshi.fanli.util.VersionUtil;
 import com.yeshi.fanli.util.factory.goods.GoodsDetailVOFactory;
 import com.yeshi.fanli.util.taobao.TaoBaoUtil;
 import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
@@ -308,7 +310,7 @@
 
 			BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
 			BigDecimal shareRate = hongBaoManageService.getShareRate();
-
+			ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE,	hongBaoManageService.getVIPFanLiRate());
 			// 鍟嗗搧淇℃伅杩囨护
 			listGoodsBrief = taoBaoGoodsUpdateService.filterImportantTaoBaoGoods(listGoodsBrief);
 
@@ -327,8 +329,7 @@
 						continue;
 					}
 				}
-				GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate,
-						shareRate);
+				GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO);
 				array.add(gson.toJson(goodsDetailVO));
 			}
 		}
@@ -351,6 +352,18 @@
 	 */
 	@RequestMapping(value = "getList", method = RequestMethod.POST)
 	public void getList(AcceptData acceptData, Integer page, Long cid, Long uid, PrintWriter out) {
+		if ("ios".equalsIgnoreCase(acceptData.getPlatform())) {
+			if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
+				getListV3(acceptData, page, cid, uid, out);
+				return;
+			}
+		} else {
+			if (VersionUtil.greaterThan_2_0_2(acceptData.getPlatform(), acceptData.getVersion())) {
+				getListV3(acceptData, page, cid, uid, out);
+				return;
+			}
+		}
+		
 		if (page == null || page < 1) {
 			out.print(JsonUtil.loadFalseResult("椤电爜涓嶆纭�"));
 			return;
@@ -394,6 +407,18 @@
 	@RequestMapping(value = "getShopInfoV2", method = RequestMethod.POST)
 	public void getShopInfoV2(AcceptData acceptData, Integer page, Long id, Long uid, PrintWriter out) {
 		
+		if ("ios".equalsIgnoreCase(acceptData.getPlatform())) {
+			if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
+				getShopInfoV3(acceptData, page, id, uid, out);
+				return;
+			}
+		} else {
+			if (VersionUtil.greaterThan_2_0_2(acceptData.getPlatform(), acceptData.getVersion())) {
+				getShopInfoV3(acceptData, page, id, uid, out);
+				return;
+			}
+		}
+		
 		if (id == null) {
 			out.print(JsonUtil.loadFalseResult("缂哄け搴楅摵id"));
 			return;
@@ -405,7 +430,7 @@
 		JSONObject data = new JSONObject();
 		if (page == 1) {
 			// 2銆侀《閮ㄨ疆鎾浘
-			List<SwiperPicture> oldtopPicList = swiperPictureService.getByBannerCard("index_top");
+			List<SwiperPicture> oldtopPicList = swiperPictureService.getByBannerCardAndVersion("brand_picture",acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()));
 			if (oldtopPicList != null && oldtopPicList.size() > 0)
 				topPicList.addAll(oldtopPicList);
 			TaoBaoShop taoBaoShop = taoBaoShopService.selectByPrimaryKey(id);
@@ -510,7 +535,7 @@
 
 			BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
 			BigDecimal shareRate = hongBaoManageService.getShareRate();
-
+			ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE,	hongBaoManageService.getVIPFanLiRate());
 			// 鍟嗗搧淇℃伅杩囨护
 			listGoodsBrief = taoBaoGoodsUpdateService.filterImportantTaoBaoGoods(listGoodsBrief);
 
@@ -529,8 +554,7 @@
 						continue;
 					}
 				}
-				GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate,
-						shareRate);
+				GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO);
 				array.add(gson.toJson(goodsDetailVO));
 			}
 		}
@@ -553,6 +577,18 @@
 	 */
 	@RequestMapping(value = "getHistoryV2", method = RequestMethod.POST)
 	public void getHistoryV2(AcceptData acceptData, Integer page, Long uid, Integer type, PrintWriter out) {
+		if ("ios".equalsIgnoreCase(acceptData.getPlatform())) {
+			if (VersionUtil.greaterThan_2_1(acceptData.getPlatform(), acceptData.getVersion())) {
+				getHistoryV3(acceptData, page, uid, type, out);
+				return;
+			}
+		} else {
+			if (VersionUtil.greaterThan_2_0_2(acceptData.getPlatform(), acceptData.getVersion())) {
+				getHistoryV3(acceptData, page, uid, type, out);
+				return;
+			}
+		}
+		
 		if (type == null) {
 			out.print(JsonUtil.loadFalseResult("绫诲瀷涓嶆纭�"));
 			return;
@@ -623,7 +659,7 @@
 	 * @param acceptData
 	 * @param out
 	 */
-	@RequestMapping(value = "getListV3", method = RequestMethod.POST)
+//	@RequestMapping(value = "getList", method = RequestMethod.POST)
 	public void getListV3(AcceptData acceptData, Integer page, Long cid, Long uid, PrintWriter out) {
 		if (page == null || page < 1) {
 			out.print(JsonUtil.loadFalseResult("椤电爜涓嶆纭�"));
@@ -666,7 +702,7 @@
 	 * @param acceptData
 	 * @param out
 	 */
-	@RequestMapping(value = "getShopInfoV3", method = RequestMethod.POST)
+//	@RequestMapping(value = "getShopInfoV2", method = RequestMethod.POST)
 	public void getShopInfoV3(AcceptData acceptData, Integer page, Long id, Long uid, PrintWriter out) {
 		if (id == null) {
 			out.print(JsonUtil.loadFalseResult("缂哄け搴楅摵id"));
@@ -683,24 +719,26 @@
 		Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
 				.excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
 		
+		ConfigParamsDTO paramsDTO = new ConfigParamsDTO(fanLiRate, shareRate, Constant.MAX_REWARD_RATE,	hongBaoManageService.getVIPFanLiRate());
 		JSONArray array = new JSONArray();
+		
 		List<BrandGoodsCahe> listGoods = brandGoodsCaheService.getByBrandId((page - 1) * 50, 50,id);
 		for (BrandGoodsCahe brandGoods: listGoods) {
 			JDGoods goodsJD = brandGoods.getGoodsJD();
 			if (goodsJD != null) {
-				array.add(gson.toJson(GoodsDetailVOFactory.convertJDGoods(goodsJD, fanLiRate, shareRate)));
+				array.add(gson.toJson(GoodsDetailVOFactory.convertJDGoods(goodsJD, paramsDTO)));
 				continue;
 			}
 			
 			TaoBaoGoodsBrief goodsTB = brandGoods.getGoodsTB();
 			if (goodsTB != null) {
-				array.add(gson.toJson(GoodsDetailVOFactory.convertTaoBao(goodsTB, null, fanLiRate, shareRate)));
+				array.add(gson.toJson(GoodsDetailVOFactory.convertTaoBao(goodsTB, paramsDTO)));
 				continue;
 			}
 			
 			PDDGoodsDetail goodsPDD = brandGoods.getGoodsPDD();
 			if (goodsPDD != null) {
-				array.add(gson.toJson(GoodsDetailVOFactory.convertPDDGoods(goodsPDD, fanLiRate, shareRate)));
+				array.add(gson.toJson(GoodsDetailVOFactory.convertPDDGoods(goodsPDD, paramsDTO)));
 				continue;
 			}
 		}
@@ -709,7 +747,7 @@
 		if (page == 1 && array.size() > 0) {
 			// 2銆侀《閮ㄨ疆鎾浘
 			List<SwiperPicture> topPicList = new ArrayList<>();
-			List<SwiperPicture> oldtopPicList = swiperPictureService.getByBannerCard("index_top");
+			List<SwiperPicture> oldtopPicList = swiperPictureService.getByBannerCardAndVersion("brand_picture",acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()));
 			if (oldtopPicList != null && oldtopPicList.size() > 0)
 				topPicList.addAll(oldtopPicList);
 			
@@ -724,7 +762,7 @@
 			data.put("shopList", JsonUtil.getApiCommonGson().toJson(shopList));
 		}
 		
-		data.put("count", 50);
+		data.put("count", array.size());
 		data.put("list", array);
 		out.print(JsonUtil.loadTrueResult(data));
 	}
@@ -739,7 +777,7 @@
 	 *            绮鹃��1锛� 瓒宠抗鍒楄〃2
 	 * @param out
 	 */
-	@RequestMapping(value = "getHistoryV3", method = RequestMethod.POST)
+//	@RequestMapping(value = "getHistoryV2", method = RequestMethod.POST)
 	public void getHistoryV3(AcceptData acceptData, Integer page, Long uid, Integer type, PrintWriter out) {
 		if (type == null) {
 			out.print(JsonUtil.loadFalseResult("绫诲瀷涓嶆纭�"));
@@ -762,7 +800,8 @@
 		List<BrandInfo> list = new ArrayList<BrandInfo>();
 		if (listRecord != null && listRecord.size() > 0) {
 			for (BrandInfoRecord history : listRecord) {
-			    list.add(history.getBrandInfo());
+				if (history.getBrandInfo() != null) 
+					list.add(history.getBrandInfo());
 			}
 		}
 		

--
Gitblit v1.8.0