From 30d8e227e8d823b6c38c3b9c90ac2df03b63befe Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期二, 25 二月 2025 16:41:22 +0800
Subject: [PATCH] 淘宝转链接口更新

---
 fanli/src/main/java/com/yeshi/fanli/controller/client/v1/BrandController.java |  749 ++++++++++++++++++++++++++++----------------------------
 1 files changed, 373 insertions(+), 376 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/BrandController.java b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/BrandController.java
index dd35b0d..2fda77c 100644
--- a/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/BrandController.java
+++ b/fanli/src/main/java/com/yeshi/fanli/controller/client/v1/BrandController.java
@@ -1,376 +1,373 @@
-package com.yeshi.fanli.controller.client.v1;
-
-import java.io.PrintWriter;
-import java.math.BigDecimal;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.annotation.Resource;
-
-import org.springframework.stereotype.Controller;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
-import org.yeshi.utils.JsonUtil;
-
-import com.google.gson.Gson;
-import com.google.gson.GsonBuilder;
-import com.yeshi.fanli.entity.accept.AcceptData;
-import com.yeshi.fanli.entity.brand.BrandClass;
-import com.yeshi.fanli.entity.brand.TaoBaoShopHistory;
-import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
-import com.yeshi.fanli.entity.system.ConfigKeyEnum;
-import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
-import com.yeshi.fanli.entity.taobao.TaoBaoShop;
-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;
-import com.yeshi.fanli.service.inter.brand.BrandClassShopService;
-import com.yeshi.fanli.service.inter.brand.BrandInfoRecordService;
-import com.yeshi.fanli.service.inter.brand.TaoBaoShopHistoryService;
-import com.yeshi.fanli.service.inter.config.ConfigService;
-import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
-import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
-import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService;
-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.taobao.TaoBaoUtil;
-import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
-
-import net.sf.json.JSONArray;
-import net.sf.json.JSONObject;
-
-@Controller
-@RequestMapping("api/v1/brand")
-public class BrandController {
-
-	@Resource
-	private BrandClassService brandClassService;
-
-	@Resource
-	private BrandClassShopService brandClassShopService;
-
-	@Resource
-	private TaoBaoShopService taoBaoShopService;
-
-	@Resource
-	private TaoBaoShopHistoryService taoBaoShopHistoryService;
-
-	@Resource
-	private HongBaoManageService manageService;
-
-	@Resource
-	private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
-
-	@Resource
-	private DaTaoKeGoodsDetailV2Service daTaoKeGoodsDetailV2Service;
-
-	@Resource
-	private BrandInfoRecordService brandInfoRecordService;
-
-	@Resource
-	private ConfigService configService;
-
-	/**
-	 * 鑾峰彇鍝佺墝鍒嗙被
-	 * 
-	 * @param acceptData
-	 * @param out
-	 */
-	@RequestMapping(value = "getClass", method = RequestMethod.POST)
-	public void getClass(AcceptData acceptData, PrintWriter out) {
-		try {
-			List<BrandClass> list = brandClassService.listBrandClassEffectiveCache(acceptData.getSystem());
-			if (list == null) {
-				list = new ArrayList<BrandClass>();
-			}
-
-			JSONObject data = new JSONObject();
-			data.put("bgPicture", configService.getValue(ConfigKeyEnum.brandBackgroundPicture.getKey(),acceptData.getSystem()));
-			data.put("count", list.size());
-			data.put("list", JsonUtil.getApiCommonGson().toJson(list));
-
-			out.print(JsonUtil.loadTrueResult(data));
-		} catch (Exception e) {
-			out.print(JsonUtil.loadFalseResult("鏌ヨ澶辫触"));
-			e.printStackTrace();
-		}
-	}
-
-	/**
-	 * 娣诲姞瓒宠抗
-	 * 
-	 * @param acceptData
-	 * @param out
-	 */
-	@RequestMapping(value = "deleteHistory", method = RequestMethod.POST)
-	public void deleteHistory(AcceptData acceptData, String ids, Long uid, PrintWriter out) {
-		try {
-			if (StringUtil.isNullOrEmpty(ids)) {
-				out.print(JsonUtil.loadFalseResult("鏈�夋嫨鏁版嵁"));
-				return;
-			}
-
-			// 鏂扮増鍒犻櫎
-			if ("ios".equalsIgnoreCase(acceptData.getPlatform())) {
-				if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) {
-					brandInfoRecordService.deleteRecord(Arrays.asList(ids.split(",")), uid, acceptData.getDevice());
-					out.print(JsonUtil.loadTrueResult("鍒犻櫎鎴愬姛"));
-					return;
-				}
-			} else {
-				if (VersionUtil.greaterThan_2_0_2(acceptData.getPlatform(), acceptData.getVersion())) {
-					brandInfoRecordService.deleteRecord(Arrays.asList(ids.split(",")), uid, acceptData.getDevice());
-					out.print(JsonUtil.loadTrueResult("鍒犻櫎鎴愬姛"));
-					return;
-				}
-			}
-
-			taoBaoShopHistoryService.deleteHistory(Arrays.asList(ids.split(",")), uid, acceptData.getDevice());
-			out.print(JsonUtil.loadTrueResult("鍒犻櫎鎴愬姛"));
-		} catch (Exception e) {
-			out.print(JsonUtil.loadFalseResult("鍒犻櫎澶辫触"));
-			e.printStackTrace();
-		}
-	}
-
-	/**
-	 * 搴楅摵瓒宠抗
-	 * 
-	 * @param acceptData
-	 * @param type
-	 *            绮鹃��1锛� 瓒宠抗鍒楄〃2
-	 * @param out
-	 */
-	@RequestMapping(value = "getHistory", method = RequestMethod.POST)
-	public void getHistory(AcceptData acceptData, Integer page, Long uid, Integer type, PrintWriter out) {
-		try {
-			if (type == null) {
-				out.print(JsonUtil.loadFalseResult("绫诲瀷涓嶆纭�"));
-				return;
-			}
-
-			if (page == null || page < 1) {
-				page = 1;
-			}
-
-			int pageSize;
-			if (type == 1) {
-				pageSize = 4;
-			} else {
-				pageSize = Constant.PAGE_SIZE;
-			}
-
-			long count = 0;
-			List<TaoBaoShopHistory> listHistory = null;
-			if (uid == null || uid == 0) {
-				String device = acceptData.getDevice();
-				count = taoBaoShopHistoryService.countByDevice(device);
-				if (count > 0) {
-					listHistory = taoBaoShopHistoryService.listByDevice((page - 1) * pageSize, pageSize, device);
-				}
-			} else {
-				count = taoBaoShopHistoryService.countByUid(uid);
-				if (count > 0) {
-					listHistory = taoBaoShopHistoryService.listByUid((page - 1) * pageSize, pageSize, uid);
-				}
-			}
-
-			List<TaoBaoShop> list = new ArrayList<TaoBaoShop>();
-			if (listHistory != null && listHistory.size() > 0) {
-				for (TaoBaoShopHistory history : listHistory) {
-					TaoBaoShop taoBaoShop = history.getTaoBaoShop();
-					if (taoBaoShop != null) {
-
-						String shopLink = taoBaoShop.getShopLink();
-						if (StringUtil.isNullOrEmpty(shopLink)) {
-							taoBaoShop.setShopLink(TaoBaoUtil.getShopLink(taoBaoShop.getId()));
-						}
-
-						String shopNameCustom = taoBaoShop.getShopNameCustom();
-						if (!StringUtil.isNullOrEmpty(shopNameCustom)) {
-							taoBaoShop.setShopName(shopNameCustom);
-						}
-
-						String shopIconCustom = taoBaoShop.getShopIconCustom();
-						if (!StringUtil.isNullOrEmpty(shopIconCustom)) {
-							taoBaoShop.setShopIcon(shopIconCustom);
-						}
-
-						list.add(taoBaoShop);
-					}
-				}
-			}
-
-			JSONObject data = new JSONObject();
-			data.put("count", count);
-			data.put("list", JsonUtil.getApiCommonGson().toJson(list));
-
-			out.print(JsonUtil.loadTrueResult(data));
-		} catch (Exception e) {
-			e.printStackTrace();
-			out.print(JsonUtil.loadFalseResult("鏌ヨ澶辫触"));
-		}
-	}
-
-	/**
-	 * 搴楅摵鍒楄〃
-	 * 
-	 * @param acceptData
-	 * @param out
-	 */
-	@RequestMapping(value = "getShopList", method = RequestMethod.POST)
-	public void getShopList(AcceptData acceptData, Integer page, Long cid, PrintWriter out) {
-		try {
-			if (page == null || page < 1) {
-				page = 1;
-			}
-			JSONObject data = brandClassShopService.listEffectiveCache(page, cid,acceptData.getSystem());
-			out.print(JsonUtil.loadTrueResult(data));
-		} catch (Exception e) {
-			e.printStackTrace();
-			out.print(JsonUtil.loadFalseResult("鏌ヨ澶辫触"));
-		}
-	}
-
-	/**
-	 * 搴楅摵璇︽儏椤�
-	 * 
-	 * @param acceptData
-	 * @param out
-	 */
-	@RequestMapping(value = "getShopInfo", method = RequestMethod.POST)
-	public void getShopInfo(AcceptData acceptData, Integer page, Long sid, Long uid, PrintWriter out) {
-		try {
-			if (sid == null) {
-				out.print(JsonUtil.loadFalseResult("缂哄け搴楅摵id"));
-				return;
-			}
-
-			JSONObject data = new JSONObject();
-			if (page == 1) {
-				TaoBaoShop taoBaoShop = taoBaoShopService.selectByPrimaryKey(sid);
-				if (taoBaoShop == null) {
-					out.print(JsonUtil.loadFalseResult("搴楅摵淇℃伅鑾峰彇澶辫触"));
-					return;
-				}
-				String shopLink = taoBaoShop.getShopLink();
-				if (StringUtil.isNullOrEmpty(shopLink)) {
-					taoBaoShop.setShopLink(TaoBaoUtil.getShopLink(taoBaoShop.getId()));
-				}
-
-				String shopNameCustom = taoBaoShop.getShopNameCustom();
-				if (!StringUtil.isNullOrEmpty(shopNameCustom)) {
-					taoBaoShop.setShopName(shopNameCustom);
-				}
-
-				String shopIconCustom = taoBaoShop.getShopIconCustom();
-				if (!StringUtil.isNullOrEmpty(shopIconCustom)) {
-					taoBaoShop.setShopIcon(shopIconCustom);
-				}
-				data.put("shop", JsonUtil.getApiCommonGson().toJson(taoBaoShop));
-
-				ThreadUtil.run(new Runnable() {
-					public void run() {
-						// 娣诲姞瓒宠抗
-						taoBaoShopHistoryService.addHistory(sid, uid, acceptData.getDevice());
-					}
-				});
-			}
-
-			// 鍟嗗搧鍒楄〃淇℃伅
-			int pageSize = 50;
-			List<TaoBaoGoodsBrief> listGoodsBrief = new ArrayList<TaoBaoGoodsBrief>();
-
-			// 鍏堟煡璇㈠ぇ娣樺鏁版嵁
-			List<DaTaoKeDetailV2> listDaTaoKe = daTaoKeGoodsDetailV2Service.listBySellerId(0, pageSize, sid);
-			if (listDaTaoKe != null && listDaTaoKe.size() > 0) {
-				for (DaTaoKeDetailV2 daTaoKe : listDaTaoKe) {
-					listGoodsBrief.add(TaoBaoUtil.convert(daTaoKe));
-				}
-			}
-
-			// 涓嶈冻50鏉℃暟鎹�佹煡璇㈢簿閫夊簱
-			if (listGoodsBrief.size() < pageSize) {
-				int needCount = pageSize - listGoodsBrief.size();
-				List<TaoBaoGoodsBrief> listGoods = taoBaoGoodsBriefService.listByShopId(0, needCount, sid);
-				if (listGoods != null && listGoods.size() > 0) {
-
-					if (listGoodsBrief.size() > 0) {
-						for (int i = 0; i < listGoods.size(); i++) {
-							long id = listGoods.get(i).getAuctionId();
-							boolean isRepeat = false;
-							for (TaoBaoGoodsBrief goodsBrief : listGoodsBrief) {
-								long auctionId = goodsBrief.getAuctionId();
-								if (auctionId == id) {
-									isRepeat = true;
-									break;
-								}
-							}
-							if (isRepeat) {
-								listGoods.remove(i);
-								i--;
-							}
-						}
-					}
-
-					listGoodsBrief.addAll(listGoods);
-				}
-			}
-
-			JSONArray array = new JSONArray();
-			if (listGoodsBrief.size() > 0) {
-				List<Long> listGid = new ArrayList<Long>();
-				for (TaoBaoGoodsBrief taoBaoGoodsBrief : listGoodsBrief) {
-					listGid.add(taoBaoGoodsBrief.getAuctionId());
-				}
-				// API缃戠粶鎺ュ彛楠岃瘉鏄惁鍦ㄥ敭
-				List<TaoBaoGoodsBrief> listTaoKeGoods = null;
-				try {
-					listTaoKeGoods = TaoKeApiUtil.getBatchGoodsInfo(listGid);
-				} catch (TaoKeApiException e) {
-					e.printStackTrace();
-				} catch (TaobaoGoodsDownException e) {
-					e.printStackTrace();
-				} catch (Exception e) {
-					e.printStackTrace();
-				}
-
-				Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
-						.excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
-				BigDecimal proportion = manageService.getFanLiRate(UserLevelEnum.daRen,acceptData.getSystem());
-
-				for (TaoBaoGoodsBrief taoBaoGoodsBrief : listGoodsBrief) {
-					if (listTaoKeGoods != null && listTaoKeGoods.size() > 0) {
-						boolean stateSale = false; // 榛樿鍋滃敭
-						Long goodsId = taoBaoGoodsBrief.getAuctionId();
-						for (TaoBaoGoodsBrief taoKeGoods : listTaoKeGoods) {
-							Long auctionId = taoKeGoods.getAuctionId();
-							if (goodsId == auctionId || goodsId.equals(auctionId)) {
-								stateSale = true; // 鍦ㄥ敭
-								break;
-							}
-						}
-						if (!stateSale) {
-							continue;
-						}
-					}
-					array.add(gson.toJson(
-							TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)));
-				}
-			}
-
-			data.put("count", array.size());
-			data.put("list", array);
-			out.print(JsonUtil.loadTrueResult(data));
-		} catch (Exception e) {
-			e.printStackTrace();
-			out.print(JsonUtil.loadFalseResult("鏌ヨ澶辫触"));
-		}
-	}
-
-}
+package com.yeshi.fanli.controller.client.v1;
+
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import com.yeshi.fanli.entity.accept.AcceptData;
+import com.yeshi.fanli.entity.brand.BrandClass;
+import com.yeshi.fanli.entity.brand.TaoBaoShopHistory;
+import com.yeshi.fanli.entity.bus.user.vip.UserLevelEnum;
+import com.yeshi.fanli.entity.system.ConfigKeyEnum;
+import com.yeshi.goods.facade.entity.taobao.TaoBaoGoodsBrief;
+import com.yeshi.common.entity.taobao.TaoBaoShop;
+import com.yeshi.fanli.exception.taobao.TaoKeApiException;
+import com.yeshi.fanli.exception.taobao.TaobaoGoodsDownException;
+import com.yeshi.fanli.service.inter.brand.BrandClassService;
+import com.yeshi.fanli.service.inter.brand.BrandClassShopService;
+import com.yeshi.fanli.service.inter.brand.BrandInfoRecordService;
+import com.yeshi.fanli.service.inter.brand.TaoBaoShopHistoryService;
+import com.yeshi.fanli.service.inter.config.ConfigService;
+import com.yeshi.fanli.service.inter.goods.TaoBaoGoodsBriefService;
+import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
+import com.yeshi.fanli.service.inter.taobao.TaoBaoShopService;
+import com.yeshi.goods.facade.service.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.taobao.TaoBaoUtil;
+import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
+import com.yeshi.goods.facade.entity.taobao.dataoke.DaTaoKeDetailV2;
+import net.sf.json.JSONArray;
+import net.sf.json.JSONObject;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.yeshi.utils.JsonUtil;
+
+import javax.annotation.Resource;
+import java.io.PrintWriter;
+import java.math.BigDecimal;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+@Controller
+@RequestMapping("api/v1/brand")
+public class BrandController {
+
+	@Resource
+	private BrandClassService brandClassService;
+
+	@Resource
+	private BrandClassShopService brandClassShopService;
+
+	@Resource
+	private TaoBaoShopService taoBaoShopService;
+
+	@Resource
+	private TaoBaoShopHistoryService taoBaoShopHistoryService;
+
+	@Resource
+	private HongBaoManageService manageService;
+
+	@Resource
+	private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
+
+	@Resource
+	private DaTaoKeGoodsDetailV2Service daTaoKeGoodsDetailV2Service;
+
+	@Resource
+	private BrandInfoRecordService brandInfoRecordService;
+
+	@Resource
+	private ConfigService configService;
+
+	/**
+	 * 鑾峰彇鍝佺墝鍒嗙被
+	 * 
+	 * @param acceptData
+	 * @param out
+	 */
+	@RequestMapping(value = "getClass", method = RequestMethod.POST)
+	public void getClass(AcceptData acceptData, PrintWriter out) {
+		try {
+			List<BrandClass> list = brandClassService.listBrandClassEffectiveCache(acceptData.getSystem());
+			if (list == null) {
+				list = new ArrayList<BrandClass>();
+			}
+
+			JSONObject data = new JSONObject();
+			data.put("bgPicture", configService.getValue(ConfigKeyEnum.brandBackgroundPicture.getKey(),acceptData.getSystem()));
+			data.put("count", list.size());
+			data.put("list", JsonUtil.getApiCommonGson().toJson(list));
+
+			out.print(JsonUtil.loadTrueResult(data));
+		} catch (Exception e) {
+			out.print(JsonUtil.loadFalseResult("鏌ヨ澶辫触"));
+			e.printStackTrace();
+		}
+	}
+
+	/**
+	 * 娣诲姞瓒宠抗
+	 * 
+	 * @param acceptData
+	 * @param out
+	 */
+	@RequestMapping(value = "deleteHistory", method = RequestMethod.POST)
+	public void deleteHistory(AcceptData acceptData, String ids, Long uid, PrintWriter out) {
+		try {
+			if (StringUtil.isNullOrEmpty(ids)) {
+				out.print(JsonUtil.loadFalseResult("鏈�夋嫨鏁版嵁"));
+				return;
+			}
+
+			// 鏂扮増鍒犻櫎
+			if ("ios".equalsIgnoreCase(acceptData.getPlatform())) {
+				if (VersionUtil.greaterThan_2_0_5(acceptData.getPlatform(), acceptData.getVersion())) {
+					brandInfoRecordService.deleteRecord(Arrays.asList(ids.split(",")), uid, acceptData.getDevice());
+					out.print(JsonUtil.loadTrueResult("鍒犻櫎鎴愬姛"));
+					return;
+				}
+			} else {
+				if (VersionUtil.greaterThan_2_0_2(acceptData.getPlatform(), acceptData.getVersion())) {
+					brandInfoRecordService.deleteRecord(Arrays.asList(ids.split(",")), uid, acceptData.getDevice());
+					out.print(JsonUtil.loadTrueResult("鍒犻櫎鎴愬姛"));
+					return;
+				}
+			}
+
+			taoBaoShopHistoryService.deleteHistory(Arrays.asList(ids.split(",")), uid, acceptData.getDevice());
+			out.print(JsonUtil.loadTrueResult("鍒犻櫎鎴愬姛"));
+		} catch (Exception e) {
+			out.print(JsonUtil.loadFalseResult("鍒犻櫎澶辫触"));
+			e.printStackTrace();
+		}
+	}
+
+	/**
+	 * 搴楅摵瓒宠抗
+	 * 
+	 * @param acceptData
+	 * @param type
+	 *            绮鹃��1锛� 瓒宠抗鍒楄〃2
+	 * @param out
+	 */
+	@RequestMapping(value = "getHistory", method = RequestMethod.POST)
+	public void getHistory(AcceptData acceptData, Integer page, Long uid, Integer type, PrintWriter out) {
+		try {
+			if (type == null) {
+				out.print(JsonUtil.loadFalseResult("绫诲瀷涓嶆纭�"));
+				return;
+			}
+
+			if (page == null || page < 1) {
+				page = 1;
+			}
+
+			int pageSize;
+			if (type == 1) {
+				pageSize = 4;
+			} else {
+				pageSize = Constant.PAGE_SIZE;
+			}
+
+			long count = 0;
+			List<TaoBaoShopHistory> listHistory = null;
+			if (uid == null || uid == 0) {
+				String device = acceptData.getDevice();
+				count = taoBaoShopHistoryService.countByDevice(device);
+				if (count > 0) {
+					listHistory = taoBaoShopHistoryService.listByDevice((page - 1) * pageSize, pageSize, device);
+				}
+			} else {
+				count = taoBaoShopHistoryService.countByUid(uid);
+				if (count > 0) {
+					listHistory = taoBaoShopHistoryService.listByUid((page - 1) * pageSize, pageSize, uid);
+				}
+			}
+
+			List<TaoBaoShop> list = new ArrayList<TaoBaoShop>();
+			if (listHistory != null && listHistory.size() > 0) {
+				for (TaoBaoShopHistory history : listHistory) {
+					TaoBaoShop taoBaoShop = history.getTaoBaoShop();
+					if (taoBaoShop != null) {
+
+						String shopLink = taoBaoShop.getShopLink();
+						if (StringUtil.isNullOrEmpty(shopLink)) {
+							taoBaoShop.setShopLink(TaoBaoUtil.getShopLink(taoBaoShop.getId()));
+						}
+
+						String shopNameCustom = taoBaoShop.getShopNameCustom();
+						if (!StringUtil.isNullOrEmpty(shopNameCustom)) {
+							taoBaoShop.setShopName(shopNameCustom);
+						}
+
+						String shopIconCustom = taoBaoShop.getShopIconCustom();
+						if (!StringUtil.isNullOrEmpty(shopIconCustom)) {
+							taoBaoShop.setShopIcon(shopIconCustom);
+						}
+
+						list.add(taoBaoShop);
+					}
+				}
+			}
+
+			JSONObject data = new JSONObject();
+			data.put("count", count);
+			data.put("list", JsonUtil.getApiCommonGson().toJson(list));
+
+			out.print(JsonUtil.loadTrueResult(data));
+		} catch (Exception e) {
+			e.printStackTrace();
+			out.print(JsonUtil.loadFalseResult("鏌ヨ澶辫触"));
+		}
+	}
+
+	/**
+	 * 搴楅摵鍒楄〃
+	 * 
+	 * @param acceptData
+	 * @param out
+	 */
+	@RequestMapping(value = "getShopList", method = RequestMethod.POST)
+	public void getShopList(AcceptData acceptData, Integer page, Long cid, PrintWriter out) {
+		try {
+			if (page == null || page < 1) {
+				page = 1;
+			}
+			JSONObject data = brandClassShopService.listEffectiveCache(page, cid,acceptData.getSystem());
+			out.print(JsonUtil.loadTrueResult(data));
+		} catch (Exception e) {
+			e.printStackTrace();
+			out.print(JsonUtil.loadFalseResult("鏌ヨ澶辫触"));
+		}
+	}
+
+	/**
+	 * 搴楅摵璇︽儏椤�
+	 * 
+	 * @param acceptData
+	 * @param out
+	 */
+	@RequestMapping(value = "getShopInfo", method = RequestMethod.POST)
+	public void getShopInfo(AcceptData acceptData, Integer page, Long sid, Long uid, PrintWriter out) {
+		try {
+			if (sid == null) {
+				out.print(JsonUtil.loadFalseResult("缂哄け搴楅摵id"));
+				return;
+			}
+
+			JSONObject data = new JSONObject();
+			if (page == 1) {
+				TaoBaoShop taoBaoShop = taoBaoShopService.selectByPrimaryKey(sid);
+				if (taoBaoShop == null) {
+					out.print(JsonUtil.loadFalseResult("搴楅摵淇℃伅鑾峰彇澶辫触"));
+					return;
+				}
+				String shopLink = taoBaoShop.getShopLink();
+				if (StringUtil.isNullOrEmpty(shopLink)) {
+					taoBaoShop.setShopLink(TaoBaoUtil.getShopLink(taoBaoShop.getId()));
+				}
+
+				String shopNameCustom = taoBaoShop.getShopNameCustom();
+				if (!StringUtil.isNullOrEmpty(shopNameCustom)) {
+					taoBaoShop.setShopName(shopNameCustom);
+				}
+
+				String shopIconCustom = taoBaoShop.getShopIconCustom();
+				if (!StringUtil.isNullOrEmpty(shopIconCustom)) {
+					taoBaoShop.setShopIcon(shopIconCustom);
+				}
+				data.put("shop", JsonUtil.getApiCommonGson().toJson(taoBaoShop));
+
+				ThreadUtil.run(new Runnable() {
+					public void run() {
+						// 娣诲姞瓒宠抗
+						taoBaoShopHistoryService.addHistory(sid, uid, acceptData.getDevice());
+					}
+				});
+			}
+
+			// 鍟嗗搧鍒楄〃淇℃伅
+			int pageSize = 50;
+			List<TaoBaoGoodsBrief> listGoodsBrief = new ArrayList<TaoBaoGoodsBrief>();
+
+			// 鍏堟煡璇㈠ぇ娣樺鏁版嵁
+			List<DaTaoKeDetailV2> listDaTaoKe = daTaoKeGoodsDetailV2Service.listBySellerId(0, pageSize, sid);
+			if (listDaTaoKe != null && listDaTaoKe.size() > 0) {
+				for (DaTaoKeDetailV2 daTaoKe : listDaTaoKe) {
+					listGoodsBrief.add(TaoBaoUtil.convert(daTaoKe));
+				}
+			}
+
+			// 涓嶈冻50鏉℃暟鎹�佹煡璇㈢簿閫夊簱
+			if (listGoodsBrief.size() < pageSize) {
+				int needCount = pageSize - listGoodsBrief.size();
+				List<TaoBaoGoodsBrief> listGoods = taoBaoGoodsBriefService.listByShopId(0, needCount, sid);
+				if (listGoods != null && listGoods.size() > 0) {
+
+					if (listGoodsBrief.size() > 0) {
+						for (int i = 0; i < listGoods.size(); i++) {
+							String id = listGoods.get(i).getAuctionId();
+							boolean isRepeat = false;
+							for (TaoBaoGoodsBrief goodsBrief : listGoodsBrief) {
+								String auctionId = goodsBrief.getAuctionId();
+								if (auctionId.equalsIgnoreCase( id)) {
+									isRepeat = true;
+									break;
+								}
+							}
+							if (isRepeat) {
+								listGoods.remove(i);
+								i--;
+							}
+						}
+					}
+
+					listGoodsBrief.addAll(listGoods);
+				}
+			}
+
+			JSONArray array = new JSONArray();
+			if (listGoodsBrief.size() > 0) {
+				List<String> listGid = new ArrayList<>();
+				for (TaoBaoGoodsBrief taoBaoGoodsBrief : listGoodsBrief) {
+					listGid.add(taoBaoGoodsBrief.getAuctionId());
+				}
+				// API缃戠粶鎺ュ彛楠岃瘉鏄惁鍦ㄥ敭
+				List<TaoBaoGoodsBrief> listTaoKeGoods = null;
+				try {
+					listTaoKeGoods = TaoKeApiUtil.getBatchGoodsInfo(listGid);
+				} catch (TaoKeApiException e) {
+					e.printStackTrace();
+				} catch (TaobaoGoodsDownException e) {
+					e.printStackTrace();
+				} catch (Exception e) {
+					e.printStackTrace();
+				}
+
+				Gson gson = JsonUtil.getConvertBigDecimalToStringSubZeroBuilder(new GsonBuilder())
+						.excludeFieldsWithoutExposeAnnotation().setDateFormat("yyyy-MM-dd").create();
+				BigDecimal proportion = manageService.getFanLiRate(UserLevelEnum.daRen,acceptData.getSystem());
+
+				for (TaoBaoGoodsBrief taoBaoGoodsBrief : listGoodsBrief) {
+					if (listTaoKeGoods != null && listTaoKeGoods.size() > 0) {
+						boolean stateSale = false; // 榛樿鍋滃敭
+						String goodsId = taoBaoGoodsBrief.getAuctionId();
+						for (TaoBaoGoodsBrief taoKeGoods : listTaoKeGoods) {
+							String auctionId = taoKeGoods.getAuctionId();
+							if (goodsId == auctionId || goodsId.equals(auctionId)) {
+								stateSale = true; // 鍦ㄥ敭
+								break;
+							}
+						}
+						if (!stateSale) {
+							continue;
+						}
+					}
+					array.add(gson.toJson(
+							TaoBaoUtil.getTaoBaoGoodsBriefExtra(taoBaoGoodsBrief, proportion.toString(), null)));
+				}
+			}
+
+			data.put("count", array.size());
+			data.put("list", array);
+			out.print(JsonUtil.loadTrueResult(data));
+		} catch (Exception e) {
+			e.printStackTrace();
+			out.print(JsonUtil.loadFalseResult("鏌ヨ澶辫触"));
+		}
+	}
+
+}

--
Gitblit v1.8.0