| | |
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | | import com.yeshi.fanli.exception.jd.JDGoodsException;
|
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.hongbao.HongBaoManageService;
|
| | | import com.yeshi.fanli.service.inter.jd.JDGoodsService;
|
| | | import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.Constant;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
| | | if (result == null) {
|
| | | return null;
|
| | | } else {
|
| | | return result.getGoodsList();
|
| | | return filterJDGoods(result.getGoodsList());
|
| | | }
|
| | | }
|
| | |
|
| | |
| | | list.addAll(listGoods);
|
| | | }
|
| | | }
|
| | | return list;
|
| | | return filterJDGoods(list);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 过滤商品
|
| | | * |
| | | * @param goodsList
|
| | | * @return
|
| | | */
|
| | | private List<JDGoods> filterJDGoods(List<JDGoods> goodsList) {
|
| | | List<Long> skuIds = new ArrayList<>();
|
| | | for (JDGoods goods : goodsList) {
|
| | | skuIds.add(goods.getSkuId());
|
| | | }
|
| | | List<JDGoods> newGoodsList = JDApiUtil.listGoodsDetail(skuIds);
|
| | | if (newGoodsList != null && newGoodsList.size() > 0)
|
| | | return newGoodsList;
|
| | | return goodsList;
|
| | | }
|
| | |
|
| | | private List<JDGoods> search(int page, int pageSize, String jdcid) {
|
| | |
| | | public JDSearchResult getIndexJDGoods(int page) {
|
| | | JDSearchResult result = null;
|
| | | String way = configService.get("jd_api_search_key");
|
| | | // TODO 需要调整规则
|
| | | way = "0";
|
| | | if ("1".equals(way)) {
|
| | | JDFilter filterAPI = new JDFilter();
|
| | | filterAPI.setPageIndex(page);
|
| | |
| | | JDSearchFilter jdfilter = new JDSearchFilter();
|
| | | jdfilter.setPageNo(page);
|
| | | jdfilter.setPageSize(Constant.PAGE_SIZE);
|
| | | result = JDUtil.searchByKey(jdfilter);
|
| | | result =JDApiUtil.getJingFenGoods(page,15); //JDUtil.searchByKey(jdfilter);
|
| | | }
|
| | | if (result != null && result.getGoodsList() != null)
|
| | | Collections.shuffle(result.getGoodsList());
|