From b6c37e4bc38db88a360d0f2c6099183f9bb75bdc Mon Sep 17 00:00:00 2001
From: yujian <yujian>
Date: 星期一, 22 四月 2019 14:31:59 +0800
Subject: [PATCH] 券推送插入

---
 fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java |   43 ++++++++++++++++++++++++++++++++++++-------
 1 files changed, 36 insertions(+), 7 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java b/fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java
index c1a4b0f..cdc1302 100644
--- a/fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java
+++ b/fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java
@@ -14,7 +14,6 @@
 import com.yeshi.fanli.entity.taobao.SearchFilter;
 import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
 import com.yeshi.fanli.entity.taobao.TaoBaoHead;
-import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
 import com.yeshi.fanli.entity.taobao.TaoBaoProvince;
 import com.yeshi.fanli.entity.taobao.TaoBaoSearchNav;
 import com.yeshi.fanli.entity.taobao.TaoBaoSearchResult;
@@ -25,7 +24,6 @@
 import com.yeshi.fanli.log.LogHelper;
 import com.yeshi.fanli.log.TaoKeLogHelper;
 import com.yeshi.fanli.tag.PageEntity;
-import com.yeshi.fanli.util.Constant;
 import com.yeshi.fanli.util.MoneyBigDecimalUtil;
 import com.yeshi.fanli.util.StringUtil;
 import com.yeshi.fanli.util.TimeUtil;
@@ -226,6 +224,8 @@
 
 			if (!StringUtil.isNullOrEmpty(item.optString("material_lib_type")))
 				goods.setMaterialLibType(item.optInt("material_lib_type"));
+			else
+				goods.setMaterialLibType(0);
 
 			return goods;
 		}
@@ -339,7 +339,9 @@
 					goods.setFreeShipment(1);
 
 				if ("1".equalsIgnoreCase(item.optString("material_lib_type")))
-					;
+					goods.setMaterialLibType(1);
+				else
+					goods.setMaterialLibType(0);
 
 				goodsList.add(goods);
 			}
@@ -367,6 +369,7 @@
 				goods.getUserType());
 		if (result != null && result.getTaoBaoGoodsBriefs() != null)
 			for (TaoBaoGoodsBrief g : result.getTaoBaoGoodsBriefs()) {
+				System.out.println(goods.getAuctionId() + ":" + g.getAuctionId());
 				if (goods.getAuctionId().longValue() == g.getAuctionId()) {
 					g.setId(goods.getAuctionId());
 					// 鍒ゆ柇鏄惁鏈変紭鎯犲埜
@@ -386,6 +389,7 @@
 						g.setCouponStartFee(new BigDecimal(0));
 					}
 					g.setCreatetime(new Date());
+					g.setMaterialLibType(goods.getMaterialLibType());
 					return g;
 				}
 			}
@@ -453,6 +457,7 @@
 						g.setCouponStartFee(new BigDecimal(0));
 					}
 					g.setCreatetime(new Date());
+					g.setMaterialLibType(goods.getMaterialLibType());
 					return g;
 				}
 			}
@@ -1097,6 +1102,8 @@
 					goods.setZkPrice(new BigDecimal(item.optString("zk_final_price")));
 					goods.setAuctionUrl(item.optString("item_url"));
 					goods.setPictUrl(item.optString("pict_url"));
+					goods.setSalesCount(item.optString("volume"));
+					goods.setUserType(item.optInt("user_type"));
 					list.add(goods);
 				}
 		}
@@ -1657,8 +1664,14 @@
 			String itemLink = resultJSON.optString("item_url");
 			TaoBaoGoodsBrief goods = new TaoBaoGoodsBrief();
 			goods.setAuctionUrl(itemLink);
-			if (!StringUtil.isNullOrEmpty(resultJSON.optString("coupon_info")))
+			if (!StringUtil.isNullOrEmpty(resultJSON.optString("coupon_info"))) {
 				goods.setCouponLink(couponLink);
+				goods.setCouponInfo(resultJSON.optString("coupon_info"));
+			}
+			String tkRate = resultJSON.optString("max_commission_rate");
+			if (!StringUtil.isNullOrEmpty(tkRate)) {
+				goods.setTkRate(new BigDecimal(tkRate));
+			}
 			return goods;
 		} catch (TaoKeApiException e) {
 			e.printStackTrace();
@@ -1671,15 +1684,30 @@
 		Map<String, String> map = new HashMap<>();
 		map.put("method", "taobao.ju.items.search");
 		map.put("current_page", 1 + "");
-		map.put("page_size", 100+"");
+		map.put("page_size", 100 + "");
 		map.put("pid", "mm_124933865_43788020_381938426");
-		
+
 		TaoKeAppInfo app = new TaoKeAppInfo();
 		app.setAppKey("24838852");
 		app.setAppSecret("bc8265e2bf8d8115329d652f9d3d4cd8");
-		
+
 		try {
 			JSONObject json = TaoKeBaseUtil.baseRequest(map, app);
+			System.out.println(json);
+		} catch (TaoKeApiException e) {
+			e.printStackTrace();
+		}
+
+	}
+	
+	public static void taoKeContent() {
+		Map<String, String> map = new HashMap<>();
+		map.put("method", "taobao.tbk.content.get");
+		TaoKeAppInfo app = new TaoKeAppInfo();
+		app.setAppKey("24838852");
+		app.setAppSecret("bc8265e2bf8d8115329d652f9d3d4cd8");
+		try {
+			JSONObject json = TaoKeBaseUtil.baseRequest(map,app);
 			System.out.println(json);
 		} catch (TaoKeApiException e) {
 			e.printStackTrace();
@@ -1777,6 +1805,7 @@
 		}
 		goods.setReservePrice(new BigDecimal(0));
 		goods.setTotalFee(new BigDecimal("0"));
+		goods.setPictUrlWhite(item.optString("white_image"));
 		return goods;
 	}
 

--
Gitblit v1.8.0