From 5aeec2b48b5c3f1ed9d9ecf8b95a8ddc2031d43d Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 06 三月 2019 14:15:56 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/master'

---
 fanli/src/main/java/com/yeshi/fanli/util/taobao/TaoKeApiUtil.java |   60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 54 insertions(+), 6 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 0a2f2fb..16d7b30 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
@@ -25,6 +25,7 @@
 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;
@@ -1595,6 +1596,7 @@
 					.optString("relation_id");
 		} catch (TaoKeApiException e) {
 			e.printStackTrace();
+			LogHelper.error("娓犻亾ID鐢宠鍑洪敊:" + resultJSON);
 		}
 
 		return null;
@@ -1617,6 +1619,7 @@
 					.optString("special_id");
 		} catch (TaoKeApiException e) {
 			e.printStackTrace();
+			LogHelper.error("浼氬憳杩愯惀ID鐢宠鍑洪敊:" + resultJSON);
 		}
 
 		return null;
@@ -1797,6 +1800,26 @@
 
 		return null;
 	}
+	
+	
+	public static void punish()
+	{
+		Map<String, String> map = new HashMap<>();
+		map.put("method", "taobao.tbk.dg.punish.order.get");
+		map.put("span", "3600");
+		map.put("page_no", "1");
+		map.put("page_size", "20");
+		map.put("start_time", "2019-01-01 00:00:00");
+//		map.put("start_time", "2019-01-01 00:00:00");
+		TaoKeAppInfo app = new TaoKeAppInfo();
+		app.setAppKey(Constant.TAOBAO_AUTH_APPKEY);
+		app.setAppSecret(Constant.TAOBAO_AUTH_APPSECRET);
+		try {
+			JSONObject json = TaoKeBaseUtil.baseRequest(map, app);
+		} catch (TaoKeApiException e) {
+			e.printStackTrace();
+		}
+	}
 
 	private static List<TaoBaoOrder> parseTaoBaoOrder(String response) {
 
@@ -1814,9 +1837,8 @@
 				.optJSONArray("n_tbk_order");
 		for (int i = 0; i < array.size(); i++) {
 
-		
-				JSONObject item = array.optJSONObject(i);
-				try {
+			JSONObject item = array.optJSONObject(i);
+			try {
 				TaoBaoOrder taoBaoOrder = new TaoBaoOrder();
 				taoBaoOrder.setAdPositionId(item.optString("adzone_id"));
 				taoBaoOrder.setAdPositionName(item.optString("adzone_name"));
@@ -1875,14 +1897,19 @@
 					taoBaoOrder.setTkMoney(new BigDecimal(item.optString("total_commission_fee")));
 				else
 					taoBaoOrder.setTkMoney(new BigDecimal(0));
-				taoBaoOrder.setTkRate(new BigDecimal(item.optString("commission_rate")));
+				if (!StringUtil.isNullOrEmpty(item.optString("commission_rate")))
+					taoBaoOrder
+							.setTkRate(new BigDecimal(item.optString("commission_rate")).multiply(new BigDecimal(100)));
+				else if (!StringUtil.isNullOrEmpty(item.optString("total_commission_rate")))
+					taoBaoOrder.setTkRate(
+							new BigDecimal(item.optString("total_commission_rate")).multiply(new BigDecimal(100)));
 				taoBaoOrder.setTransactionPlatform(item.optString("terminal_type"));
 				taoBaoOrder.setRelationId(item.optString("relation_id"));
 				taoBaoOrder.setSpecialId(item.optString("special_id"));
 				orderList.add(taoBaoOrder);
 			} catch (Exception e) {
 				try {
-					LogHelper.errorDetailInfo(e, "璁㈠崟鍙蜂俊鎭�:"+item.toString(), "璁㈠崟瑙f瀽鍑洪敊");
+					LogHelper.errorDetailInfo(e, "璁㈠崟鍙蜂俊鎭�:" + item.toString(), "璁㈠崟瑙f瀽鍑洪敊");
 				} catch (Exception e1) {
 				}
 			}
@@ -1923,7 +1950,8 @@
 			String itemLink = resultJSON.optString("item_url");
 			TaoBaoGoodsBrief goods = new TaoBaoGoodsBrief();
 			goods.setAuctionUrl(itemLink);
-			goods.setCouponLink(couponLink);
+			if (!StringUtil.isNullOrEmpty(resultJSON.optString("coupon_info")))
+				goods.setCouponLink(couponLink);
 			return goods;
 		} catch (TaoKeApiException e) {
 			e.printStackTrace();
@@ -1932,6 +1960,26 @@
 		return null;
 	}
 
+	public static void juHuaSuan() {
+		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("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();
+		}
+
+	}
+
 	// AA5ISJ
 
 	private static TaoBaoGoodsBrief parseWuLiaoItemFromMaterialId(JSONObject item) {

--
Gitblit v1.8.0