From d2357693d74ec048ed19e483ea29f87d823cde5f Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期一, 22 七月 2019 16:26:23 +0800
Subject: [PATCH] 资金明细添加京东,拼多多兼容

---
 fanli/src/main/java/com/yeshi/fanli/util/jd/JDApiUtil.java |   31 +++++++++++++++++++++++--------
 1 files changed, 23 insertions(+), 8 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/util/jd/JDApiUtil.java b/fanli/src/main/java/com/yeshi/fanli/util/jd/JDApiUtil.java
index 768f339..faae43b 100644
--- a/fanli/src/main/java/com/yeshi/fanli/util/jd/JDApiUtil.java
+++ b/fanli/src/main/java/com/yeshi/fanli/util/jd/JDApiUtil.java
@@ -22,9 +22,11 @@
 import com.yeshi.fanli.dto.jd.JDFilter;
 import com.yeshi.fanli.dto.jd.JDOrderResult;
 import com.yeshi.fanli.dto.jd.JDPingouInfo;
+import com.yeshi.fanli.dto.jd.JDSearchResult;
 import com.yeshi.fanli.dto.jd.JDShopInfo;
 import com.yeshi.fanli.entity.jd.JDGoods;
 import com.yeshi.fanli.entity.jd.JDOrder;
+import com.yeshi.fanli.tag.PageEntity;
 import com.yeshi.fanli.util.MoneyBigDecimalUtil;
 import com.yeshi.fanli.util.StringUtil;
 import com.yeshi.fanli.util.TimeUtil;
@@ -176,9 +178,12 @@
 		filter.setPageIndex(1);
 		filter.setPageSize(20);
 		filter.setListId(skuIdList);
-		List<JDGoods> list = queryByKey(filter);
-		if (list != null && list.size() > 0)
-			return list.get(0);
+		JDSearchResult searchResult = queryByKey(filter);
+		if (searchResult != null) {
+			List<JDGoods> list = searchResult.getGoodsList();
+			if (list != null && list.size() > 0)
+				return list.get(0);
+		}
 		return null;
 	}
 	
@@ -187,7 +192,9 @@
 	 * @param skuIdList
 	 * @return
 	 */
-	public static List<JDGoods> queryByKey(JDFilter filter) {
+	public static JDSearchResult queryByKey(JDFilter filter) {
+		JDSearchResult searchResult = new JDSearchResult();
+		
 		List<JDGoods> list = new ArrayList<>();
 		JSONObject json = new JSONObject();
 		json.put("pageIndex", filter.getPageIndex());
@@ -232,9 +239,6 @@
 		if (filter.getIsPG() != null)
 			json.put("isPG", filter.getIsPG());
 
-		if (filter.getIsCoupon() != null)
-			json.put("isCoupon", filter.getIsCoupon());
-
 		if (filter.getPingouPriceStart() != null)
 			json.put("pingouPriceStart", filter.getPingouPriceStart());
 
@@ -249,6 +253,10 @@
 
 		if (filter.getShopId() != null)
 			json.put("shopId", filter.getShopId());
+		
+		if (filter.getOwner() != null)
+			json.put("owner", filter.getOwner());
+		
 		System.out.println(json.toString());
 		
 		JSONObject jsonDTO = new JSONObject();
@@ -273,8 +281,15 @@
 					}
 				}
 			}
+			
+			long totalCount = resultJson.optLong("totalCount");
+			PageEntity pageEntity = new PageEntity();
+			pageEntity.setTotalCount(totalCount);
+			
+			searchResult.setPageEntity(pageEntity);
 		}
-		return list;
+		searchResult.setGoodsList(list);
+		return searchResult;
 	}
 	
 	

--
Gitblit v1.8.0