From f4a0f2acc63d7785eab108419a4e16f5f688cb95 Mon Sep 17 00:00:00 2001
From: yujian <yujian@163.com>
Date: 星期六, 18 一月 2020 12:06:27 +0800
Subject: [PATCH] 用户注册信息

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v2/BrandControllerV2.java |  112 ++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 77 insertions(+), 35 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 ed5e9d0..0e51bb7 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
@@ -1,7 +1,6 @@
 package com.yeshi.fanli.controller.client.v2;
 
 import java.io.PrintWriter;
-import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -14,6 +13,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;
@@ -25,7 +25,7 @@
 import com.yeshi.fanli.entity.jd.JDGoods;
 import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
 import com.yeshi.fanli.entity.taobao.TaoBaoShop;
-import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetail;
+import com.yeshi.fanli.entity.taobao.dataoke.DaTaoKeDetailV2;
 import com.yeshi.fanli.exception.taobao.TaoKeApiException;
 import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
 import com.yeshi.fanli.service.inter.brand.BrandClassService;
@@ -40,10 +40,11 @@
 import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
 import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
 import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService;
-import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsService;
+import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailV2Service;
 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;
@@ -77,7 +78,7 @@
 	private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
 
 	@Resource
-	private DaTaoKeGoodsService daTaoKeGoodsService;
+	private DaTaoKeGoodsDetailV2Service daTaoKeGoodsDetailV2Service;
 
 	@Resource
 	private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
@@ -109,7 +110,7 @@
 		if (page == null || page < 1) {
 			page = 1;
 		}
-		JSONObject data = brandClassShopService.listEffectiveCacheV2(page, cid);
+		JSONObject data = brandClassShopService.listEffectiveCacheV2(page, cid,acceptData.getPlatform(),acceptData.getVersion());
 		out.print(JsonUtil.loadTrueResult(data));
 	}
 
@@ -250,9 +251,9 @@
 		List<TaoBaoGoodsBrief> listGoodsBrief = new ArrayList<TaoBaoGoodsBrief>();
 
 		// 鍏堟煡璇㈠ぇ娣樺鏁版嵁
-		List<DaTaoKeDetail> listDaTaoKe = daTaoKeGoodsService.listBySellerId(0, pageSize, sid);
+		List<DaTaoKeDetailV2> listDaTaoKe = daTaoKeGoodsDetailV2Service.listBySellerId(0, pageSize, sid);
 		if (listDaTaoKe != null && listDaTaoKe.size() > 0) {
-			for (DaTaoKeDetail daTaoKe : listDaTaoKe) {
+			for (DaTaoKeDetailV2 daTaoKe : listDaTaoKe) {
 				listGoodsBrief.add(TaoBaoUtil.convert(daTaoKe));
 			}
 		}
@@ -306,9 +307,8 @@
 			Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
 					.excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
 
-			BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
-			BigDecimal shareRate = hongBaoManageService.getShareRate();
-
+			ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
+					acceptData.getVersion());
 			// 鍟嗗搧淇℃伅杩囨护
 			listGoodsBrief = taoBaoGoodsUpdateService.filterImportantTaoBaoGoods(listGoodsBrief);
 
@@ -327,8 +327,7 @@
 						continue;
 					}
 				}
-				GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate,
-						shareRate);
+				GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO);
 				array.add(gson.toJson(goodsDetailVO));
 			}
 		}
@@ -351,6 +350,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_0_5(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;
@@ -371,7 +382,7 @@
 		
 		long count = brandInfoService.countBrandInfo(cid);
 		
-		List<BrandInfoVO> list = brandInfoService.listBrandInfoCache((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, cid);
+		List<BrandInfoVO> list = brandInfoService.listBrandInfoCache((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, cid,acceptData.getPlatform(),acceptData.getVersion());
 		if (list == null)
 			list = new ArrayList<BrandInfoVO>();
 		
@@ -394,6 +405,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_0_5(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 +428,7 @@
 		JSONObject data = new JSONObject();
 		if (page == 1) {
 			// 2銆侀《閮ㄨ疆鎾浘
-			List<SwiperPicture> oldtopPicList = swiperPictureService.getByBannerCard("brand_picture");
+			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);
@@ -452,9 +475,9 @@
 		List<TaoBaoGoodsBrief> listGoodsBrief = new ArrayList<TaoBaoGoodsBrief>();
 
 		// 鍏堟煡璇㈠ぇ娣樺鏁版嵁
-		List<DaTaoKeDetail> listDaTaoKe = daTaoKeGoodsService.listBySellerId(0, pageSize, id);
+		List<DaTaoKeDetailV2> listDaTaoKe = daTaoKeGoodsDetailV2Service.listBySellerId(0, pageSize, id);
 		if (listDaTaoKe != null && listDaTaoKe.size() > 0) {
-			for (DaTaoKeDetail daTaoKe : listDaTaoKe) {
+			for (DaTaoKeDetailV2 daTaoKe : listDaTaoKe) {
 				listGoodsBrief.add(TaoBaoUtil.convert(daTaoKe));
 			}
 		}
@@ -508,9 +531,8 @@
 			Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
 					.excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
 
-			BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
-			BigDecimal shareRate = hongBaoManageService.getShareRate();
-
+			ConfigParamsDTO paramsDTO = hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
+					acceptData.getVersion());
 			// 鍟嗗搧淇℃伅杩囨护
 			listGoodsBrief = taoBaoGoodsUpdateService.filterImportantTaoBaoGoods(listGoodsBrief);
 
@@ -529,8 +551,7 @@
 						continue;
 					}
 				}
-				GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, null, fanLiRate,
-						shareRate);
+				GoodsDetailVO goodsDetailVO = GoodsDetailVOFactory.convertTaoBao(taoBaoGoodsBrief, paramsDTO);
 				array.add(gson.toJson(goodsDetailVO));
 			}
 		}
@@ -553,6 +574,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_0_5(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,18 +656,25 @@
 	 * @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("椤电爜涓嶆纭�"));
 			return;
 		}
-		
 		if (cid != null && cid == 0) {
 			cid = null;
 		}
 		
+		
 		JSONObject data = new JSONObject();
+		if (page == 1  && cid == null) { // 绮鹃�夐〉banner
+			List<SwiperPicture> banners = swiperPictureService.getByBannerCardAndVersion("brand_banners",acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()));
+			if (banners == null)
+				banners = new ArrayList<>();
+			data.put("banners", JsonUtil.getApiCommonGson().toJson(banners));
+		}
+		
 		if (page == 1 && cid != null) {
 			List<BrandInfo> brandlist = brandInfoService.listValidByCidToApp(cid);
 			if(brandlist == null)
@@ -642,10 +682,9 @@
 			data.put("brandlist", JsonUtil.getApiCommonGson().toJson(brandlist));
 		}
 		
-		
 		long count = brandInfoService.countValidByCidToApp(cid);
 		
-		List<BrandInfoVO> list = brandInfoService.listValidToApp((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, cid);
+		List<BrandInfoVO> list = brandInfoService.listValidToApp((page - 1) * Constant.PAGE_SIZE, Constant.PAGE_SIZE, cid,acceptData.getPlatform(),acceptData.getVersion());
 		if (list == null)
 			list = new ArrayList<BrandInfoVO>();
 		
@@ -666,7 +705,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"));
@@ -678,29 +717,31 @@
 			brandInfoRecordService.addRecord(id, uid, acceptData.getDevice());
 		}
 		
-		BigDecimal fanLiRate = hongBaoManageService.getFanLiRate();
-		BigDecimal shareRate = hongBaoManageService.getShareRate();
+
 		Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
 				.excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
 		
+		ConfigParamsDTO paramsDTO =  hongBaoManageService.getShowComputeRate(acceptData.getPlatform(),
+				acceptData.getVersion());
 		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 +750,7 @@
 		if (page == 1 && array.size() > 0) {
 			// 2銆侀《閮ㄨ疆鎾浘
 			List<SwiperPicture> topPicList = new ArrayList<>();
-			List<SwiperPicture> oldtopPicList = swiperPictureService.getByBannerCard("brand_picture");
+			List<SwiperPicture> oldtopPicList = swiperPictureService.getByBannerCardAndVersion("brand_picture",acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()));
 			if (oldtopPicList != null && oldtopPicList.size() > 0)
 				topPicList.addAll(oldtopPicList);
 			
@@ -724,7 +765,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 +780,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 +803,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