| | |
| | | import com.yeshi.fanli.service.inter.goods.recommend.HomeRecommendGoodsService;
|
| | | import com.yeshi.fanli.service.inter.goods.recommend.RecommendGoodsDeleteHistoryService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TLJBuyGoodsService;
|
| | | import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
|
| | | import com.yeshi.fanli.service.inter.taobao.dataoke.DaTaoKeGoodsDetailService;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
| | | import com.yeshi.fanli.util.dataoke.DaTaoKeApiUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoKeApiUtil;
|
| | |
|
| | |
|
| | | @Service
|
| | | public class HomeRecommendGoodsServiceImpl implements HomeRecommendGoodsService {
|
| | |
| | |
|
| | | @Resource
|
| | | private TLJBuyGoodsService tljBuyGoodsService;
|
| | |
|
| | | @Resource
|
| | | private TaoBaoGoodsUpdateService taoBaoGoodsUpdateService;
|
| | |
|
| | | @Override
|
| | | public List<TaoBaoGoodsBrief> listGoodsByPage(Long uid, String device, String imei, String idfa, int page) {
|
| | |
| | | if (fList != null && fList.size() > 0)
|
| | | return fList;
|
| | |
|
| | | DaTaoKeGoodsResult result = DaTaoKeApiUtil.getRankingList(type, null);
|
| | | DaTaoKeGoodsResult result = null;
|
| | | int count = 0;
|
| | | while (result == null && count < 4) {
|
| | | count++;
|
| | | try {
|
| | | result = DaTaoKeApiUtil.getRankingList(type, null);
|
| | | } catch (Exception e) {
|
| | | }
|
| | | }
|
| | |
|
| | | List<DaTaoKeDetailV2> list = result.getGoodsList();
|
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>();
|
| | | if (list != null)
|
| | |
| | | if (goodsList != null && goodsList.size() > 0)
|
| | | saveObjList(goodsList, name, key);
|
| | |
|
| | | // 商品信息过滤
|
| | | goodsList = taoBaoGoodsUpdateService.filterImportantTaoBaoGoods(goodsList);
|
| | | return goodsList;
|
| | | }
|
| | |
|
| | |
| | | if (list != null && list.size() > 0)
|
| | | return list;
|
| | |
|
| | | TaoBaoSearchResult result = TaoKeApiUtil.getMaterialByMaterialId(3756, page, Constant.PAGE_SIZE);
|
| | | // 爆款商品库
|
| | | TaoBaoSearchResult result = TaoKeApiUtil.getMaterialByMaterialId(14624, page, Constant.PAGE_SIZE);
|
| | | if (result != null) {
|
| | | list = daTaoKeGoodsDetailService.filterTaoBaoGoods(result.getTaoBaoGoodsBriefs());
|
| | | saveObjList(list, name, key);
|
| | |
| | |
|
| | | List<TLJBuyGoods> list = tljBuyGoodsService
|
| | | .listByDay(TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy-MM-dd"));
|
| | |
|
| | | if (list.size() > 20)
|
| | | list = list.subList(0, 20);
|
| | | List<TaoBaoGoodsBrief> finalList = new ArrayList<>();
|
| | | Map<Long, TLJBuyGoods> map = new ConcurrentHashMap<>();
|
| | | if (list != null)
|
| | | for (TLJBuyGoods goods : list) {
|
| | | map.put(goods.getGoods().getAuctionId(), goods);
|
| | | finalList.add(goods.getGoods());
|
| | | try {
|
| | | if (goods.getGoods().getAuctionId() == null) {
|
| | | goods.getGoods().setAuctionId(goods.getGoods().getId());
|
| | | }
|
| | | map.put(goods.getGoods().getAuctionId(), goods);
|
| | | finalList.add(goods.getGoods());
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | |
|
| | | finalList = recommendGoodsDeleteHistoryService.filterGoods(device, finalList);
|
| | |
|
| | | if (finalList != null && finalList.size() > 0) {
|
| | | Collections.shuffle(finalList);
|
| | | if (finalList.size() >= 3)
|
| | | finalList = finalList.subList(0, 3);
|
| | | if (finalList.size() >= 10)
|
| | | finalList = finalList.subList(0, 10);
|
| | | list = new ArrayList<>();
|
| | | for (TaoBaoGoodsBrief goods : finalList) {
|
| | | list.add(map.get(goods.getAuctionId()));
|