From 9eeda0d3049b71877c373c04d65533939b5582ef Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期一, 02 九月 2019 09:55:55 +0800
Subject: [PATCH] getBoss方法只查询有效上级信息

---
 fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TLJBuyGoodsServiceImpl.java |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TLJBuyGoodsServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TLJBuyGoodsServiceImpl.java
index 8d011b6..eadb46c 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TLJBuyGoodsServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/TLJBuyGoodsServiceImpl.java
@@ -3,6 +3,7 @@
 import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.List;
@@ -67,6 +68,8 @@
 			goods.setUpdateTime(new Date());
 		if (taoKeAppInfo != null)
 			goods.setAppKey(taoKeAppInfo.getAppKey());
+		if (goods.getWeight() == null)
+			goods.setWeight(1);
 		tljBuyGoodsDao.save(goods);
 	}
 
@@ -97,7 +100,7 @@
 					// 杩囨护娣樼ぜ閲戝ぇ浜�10鍧楅挶鐨�
 					BigDecimal hongBao = TaoBaoUtil.getGoodsHongBaoMoney(list.get(i).getGoods(),
 							TaoBaoConstant.OWN_BUY_WITHOUT_FANLI_RATE);
-					if (hongBao.compareTo(new BigDecimal(10)) > 0) {
+					if (hongBao.compareTo(new BigDecimal(20)) > 0) {
 						list.remove(i--);
 					}
 				}
@@ -106,6 +109,14 @@
 				goodsList.addAll(list);
 		}
 		Collections.shuffle(goodsList);
+		Comparator<TLJBuyGoods> cm = new Comparator<TLJBuyGoods>() {
+
+			@Override
+			public int compare(TLJBuyGoods o1, TLJBuyGoods o2) {
+				return o1.getWeight() != null && o2.getWeight() != null ? o2.getWeight() - o1.getWeight() : 0;
+			}
+		};
+		Collections.sort(goodsList, cm);
 		return goodsList;
 	}
 

--
Gitblit v1.8.0