| | |
| | | |
| | | import com.yeshi.fanli.entity.SystemEnum; |
| | | import com.yeshi.fanli.entity.SystemFunction; |
| | | import com.yeshi.fanli.entity.goods.CommonGoods; |
| | | import com.yeshi.fanli.util.SystemInfoUtil; |
| | | import com.yeshi.fanli.util.factory.CommonGoodsFactory; |
| | | import com.yeshi.goods.facade.dto.taobao.haodanku.HaoDanKuJDGoodsInfo; |
| | | import com.yeshi.goods.facade.dto.taobao.haodanku.HaoDanKuListResult; |
| | | import com.yeshi.goods.facade.dto.taobao.haodanku.HaoDanKuPDDGoodsInfo; |
| | | import com.yeshi.goods.facade.entity.taobao.haodanku.HDKGoodsDetail; |
| | | import com.yeshi.goods.facade.utils.taobao.HaoDanKuApiUtil; |
| | | import com.yeshi.goods.facade.utils.taobao.HaoDankuUtil; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<CommonContentNav> getNavList(CommonContentTypeEnum type,SystemEnum system) { |
| | | public List<CommonContentNav> getNavList(CommonContentTypeEnum type, SystemEnum system) { |
| | | List<CommonContentNav> navList = new ArrayList<>(); |
| | | if (type == CommonContentTypeEnum._9k9) { |
| | | navList.add(new CommonContentNav("-1", "综合")); |
| | |
| | | navList = getCommonNav(system); |
| | | } else if (type == CommonContentTypeEnum.mianDan) { |
| | | navList = new ArrayList<>(); |
| | | } else if (type == CommonContentTypeEnum.pddHotGoodsRank) { |
| | | //好单库数据 |
| | | navList.add(new CommonContentNav("0", "全部")); |
| | | for (HaoDankuUtil.Category category : HaoDankuUtil.CATEGORYS) { |
| | | navList.add(new CommonContentNav(category.getId() + "", category.getName())); |
| | | } |
| | | } else if (type == CommonContentTypeEnum.jdHotGoodsRank) { |
| | | //好单库数据 |
| | | navList.add(new CommonContentNav("0", "全部")); |
| | | for (HaoDankuUtil.Category category : HaoDankuUtil.CATEGORYS) { |
| | | navList.add(new CommonContentNav(category.getId() + "", category.getName())); |
| | | } |
| | | } else if (type == CommonContentTypeEnum.tbHotGoodsRank) { |
| | | //好单库数据 |
| | | navList.add(new CommonContentNav("0", "全部")); |
| | | for (HaoDankuUtil.Category category : HaoDankuUtil.CATEGORYS) { |
| | | navList.add(new CommonContentNav(category.getId() + "", category.getName())); |
| | | } |
| | | } |
| | | |
| | | return navList; |
| | |
| | | result = getHaoQuanContent(cid, page, pageSize); |
| | | } else if (type == CommonContentTypeEnum.mianDan) { |
| | | result = getMianDanContent(page, pageSize); |
| | | } else if (type == CommonContentTypeEnum.pddHotGoodsRank) { |
| | | result = getPDDHotGoodsRankContent(cid, page); |
| | | } else if (type == CommonContentTypeEnum.jdHotGoodsRank) { |
| | | result = getJDHotGoodsRankContent(cid, page); |
| | | } else if (type == CommonContentTypeEnum.tbHotGoodsRank) { |
| | | result = getTBHotGoodsRankContent(cid, page); |
| | | } |
| | | |
| | | if (result != null) {// 商品信息过滤 |
| | | List<TaoBaoGoodsBrief> goodsList = taoBaoGoodsUpdateService |
| | | .filterImportantTaoBaoGoods(result.getGoodsList()); |
| | | List<CommonGoods> goodsList = taoBaoGoodsUpdateService |
| | | .filterImportantTaoBaoGoodsWithCommonGoods(result.getGoodsList()); |
| | | result.setGoodsList(goodsList); |
| | | } |
| | | |
| | |
| | | for (DaTaoKeDetailV2 detail : result.getGoodsList()) |
| | | goodsList.add(TaoBaoUtil.convert(detail)); |
| | | } |
| | | return new CommonContentResult(goodsList, count); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(goodsList), count); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | goodsList.add(taoBaoGoodsBrief); |
| | | } |
| | | return new CommonContentResult(goodsList, count); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(goodsList), count); |
| | | } |
| | | |
| | | /** |
| | |
| | | } |
| | | goodsList.add(taoBaoGoodsBrief); |
| | | } |
| | | return new CommonContentResult(goodsList, count); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(goodsList), count); |
| | | } |
| | | |
| | | /** |
| | |
| | | for (DaTaoKeDetailV2 detail : result.getGoodsList()) |
| | | goodsList.add(TaoBaoUtil.convert(detail)); |
| | | } |
| | | return new CommonContentResult(goodsList, count); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(goodsList), count); |
| | | } |
| | | |
| | | /** |
| | |
| | | for (DaTaoKeDetailV2 detail : result.getGoodsList()) |
| | | goodsList.add(TaoBaoUtil.convert(detail)); |
| | | } |
| | | return new CommonContentResult(goodsList, count); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(goodsList), count); |
| | | } |
| | | |
| | | /** |
| | |
| | | for (DaTaoKeDetailV2 detail : result.getGoodsList()) |
| | | goodsList.add(TaoBaoUtil.convert(detail)); |
| | | } |
| | | return new CommonContentResult(goodsList, count); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(goodsList), count); |
| | | } |
| | | |
| | | /** |
| | |
| | | for (DaTaoKeDetailV2 detail : result.getGoodsList()) |
| | | goodsList.add(TaoBaoUtil.convert(detail)); |
| | | } |
| | | return new CommonContentResult(goodsList, count); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(goodsList), count); |
| | | |
| | | } else {// |
| | | List<TaobaoMeterial> taobaoMeterials = taobaoMeterialService.selectByClassNameAndSuperNameCache("母婴_" + cid, |
| | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | return new CommonContentResult(listBrands, 1000); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(listBrands), 1000); |
| | | } |
| | | return new CommonContentResult(new ArrayList<>(), 0); |
| | | } |
| | |
| | | for (DaTaoKeDetailV2 detail : result.getGoodsList()) |
| | | goodsList.add(TaoBaoUtil.convert(detail)); |
| | | } |
| | | return new CommonContentResult(goodsList, count); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(goodsList), count); |
| | | } |
| | | |
| | | /** |
| | |
| | | for (DaTaoKeDetailV2 detail : result.getGoodsList()) |
| | | goodsList.add(TaoBaoUtil.convert(detail)); |
| | | } |
| | | return new CommonContentResult(goodsList, count); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(goodsList), count); |
| | | } |
| | | |
| | | /** |
| | |
| | | goodsList.add(TaoBaoUtil.convert(detail)); |
| | | } |
| | | Collections.shuffle(goodsList); |
| | | return new CommonContentResult(goodsList, count); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(goodsList), count); |
| | | } |
| | | |
| | | /** |
| | |
| | | goodsList.add(TaoBaoUtil.convert(detail)); |
| | | } |
| | | Collections.shuffle(goodsList); |
| | | return new CommonContentResult(goodsList, count); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(goodsList), count); |
| | | } |
| | | |
| | | /** |
| | |
| | | goodsList.add(TaoBaoUtil.convert(detail)); |
| | | } |
| | | Collections.shuffle(goodsList); |
| | | return new CommonContentResult(goodsList, count); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(goodsList), count); |
| | | } |
| | | |
| | | /** |
| | |
| | | goodsList.add(TaoBaoUtil.convert(detail)); |
| | | } |
| | | Collections.shuffle(goodsList); |
| | | return new CommonContentResult(goodsList, count); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(goodsList), count); |
| | | } |
| | | |
| | | /** |
| | |
| | | goodsList.add(TaoBaoUtil.convert(detail)); |
| | | } |
| | | Collections.shuffle(goodsList); |
| | | return new CommonContentResult(goodsList, count); |
| | | return new CommonContentResult(CommonGoodsFactory.createTaoBaoList(goodsList), count); |
| | | } |
| | | |
| | | /** |
| | |
| | | List<QualityFactory> listQuery = qualityGoodsService.listFreeGoods((page - 1) * pageSize, pageSize); |
| | | long count = qualityGoodsService.countFreeGoods(); |
| | | result.setCount(count); |
| | | List<Long> listGid = new ArrayList<Long>(); |
| | | List<String> listGid = new ArrayList<>(); |
| | | List<TaoBaoGoodsBrief> goodsList = new ArrayList<>(); |
| | | for (QualityFactory qualityFactory : listQuery) { |
| | | TaoBaoGoodsBrief taoBaoGoodsBrief = qualityFactory.getTaoBaoGoodsBrief(); |
| | |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | Map<Long, TaoBaoGoodsBrief> goodsMap = new HashMap<>(); |
| | | Map<String, TaoBaoGoodsBrief> goodsMap = new HashMap<>(); |
| | | if (listTaoKeGoods != null) |
| | | for (TaoBaoGoodsBrief goods : listTaoKeGoods) |
| | | goodsMap.put(goods.getAuctionId(), goods); |
| | |
| | | goodsList.remove(i--); |
| | | } |
| | | } |
| | | result.setGoodsList(CommonGoodsFactory.createTaoBaoList(goodsList)); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 拼多多热销 |
| | | * |
| | | * @return |
| | | */ |
| | | private CommonContentResult getPDDHotGoodsRankContent(String cid, int page) { |
| | | cid = cid == null ? 0 + "" : cid; |
| | | CommonContentResult result = new CommonContentResult(); |
| | | HaoDanKuListResult pddResult = HaoDanKuApiUtil.getInstance().getPDDHotGoods(Integer.parseInt(cid), page == 1 ? null : page); //qualityGoodsService.listFreeGoods((page - 1) * pageSize, pageSize); |
| | | result.setCount(1000); |
| | | List<CommonGoods> goodsList = new ArrayList<>(); |
| | | if (pddResult != null) { |
| | | List<HaoDanKuPDDGoodsInfo> list = pddResult.getResultList(); |
| | | for (HaoDanKuPDDGoodsInfo goodsInfo : list) { |
| | | goodsList.add(CommonGoodsFactory.create(goodsInfo)); |
| | | } |
| | | } |
| | | result.setGoodsList(goodsList); |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 京东热销 |
| | | * |
| | | * @return |
| | | */ |
| | | private CommonContentResult getJDHotGoodsRankContent(String cid, int page) { |
| | | CommonContentResult result = new CommonContentResult(); |
| | | HaoDanKuListResult pddResult = HaoDanKuApiUtil.getInstance().getJDHotGoods(Integer.parseInt(cid), page == 1 ? null : page); //qualityGoodsService.listFreeGoods((page - 1) * pageSize, pageSize); |
| | | result.setCount(1000); |
| | | List<CommonGoods> goodsList = new ArrayList<>(); |
| | | if (pddResult != null) { |
| | | List<HaoDanKuJDGoodsInfo> list = pddResult.getResultList(); |
| | | for (HaoDanKuJDGoodsInfo goodsInfo : list) { |
| | | goodsList.add(CommonGoodsFactory.create(goodsInfo)); |
| | | } |
| | | } |
| | | result.setGoodsList(goodsList); |
| | | return result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 淘宝热销 |
| | | * |
| | | * @return |
| | | */ |
| | | private CommonContentResult getTBHotGoodsRankContent(String cid, int page) { |
| | | CommonContentResult result = new CommonContentResult(); |
| | | HaoDanKuListResult pddResult = HaoDanKuApiUtil.getInstance().getTBHotGoods(Integer.parseInt(cid), page == 1 ? null : page); //qualityGoodsService.listFreeGoods((page - 1) * pageSize, pageSize); |
| | | result.setCount(1000); |
| | | List<CommonGoods> goodsList = new ArrayList<>(); |
| | | if (pddResult != null) { |
| | | List<HDKGoodsDetail> list = pddResult.getResultList(); |
| | | for (HDKGoodsDetail goodsInfo : list) { |
| | | goodsList.add(CommonGoodsFactory.create(goodsInfo)); |
| | | } |
| | | } |
| | | result.setGoodsList(goodsList); |
| | | return result; |
| | | } |