fanli/src/main/java/com/yeshi/fanli/entity/taobao/TLJBuyGoods.java
@@ -33,6 +33,16 @@ private Integer totalHongBaoCount;// 总红包个数 @Field private Integer leftHongBaoCount;// 剩余红包个数 @Field private Integer weight; public Integer getWeight() { return weight; } public void setWeight(Integer weight) { this.weight = weight; } public String getAppKey() { return appKey; 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); } @@ -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; } fanli/src/main/java/com/yeshi/fanli/service/impl/taobao/dataoke/DaTaoKeGoodsDetailV2ServiceImpl.java
@@ -355,6 +355,17 @@ finalList = listByIds(idList); } // 如果商品数小于4,需要再加商品 if (finalList == null || finalList.size() <= 3) { // 按更新时间加 List<DaTaoKeDetailV2> latestList = daTaoKeGoodsDetailV2Dao.listPreShareHotGoods(0, 50, "updateTime", new BigDecimal("0.5")); if (latestList != null && latestList.size() > 0) { Collections.shuffle(latestList); finalList.addAll(latestList.subList(0, latestList.size() > 8 ? 8 : latestList.size())); } } for (DaTaoKeDetailV2 detail : finalList) { detail.setCouponReceiveNum(detail.getCouponTotalNum() - (int) (200 + Math.random() * 1000)); if (detail.getCouponTotalNum() - detail.getCouponReceiveNum() <= 0)