| | |
| | | import com.yeshi.fanli.util.RedisManager;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | | import com.yeshi.fanli.util.VersionUtil;
|
| | | import com.yeshi.fanli.util.dataoke.DaTaoKeApiUtil;
|
| | | import com.yeshi.fanli.util.taobao.DaTaoKeUtil;
|
| | | import com.yeshi.fanli.util.taobao.TaoBaoUtil;
|
| | |
| | | for (TaoBaoGoodsBrief goods : goodsList)
|
| | | goodsIdList.add(goods.getAuctionId());
|
| | |
|
| | | List<DaTaoKeDetailV2> dtList = listByGoodsIds(goodsIdList);
|
| | | List<DaTaoKeDetailV2> dtList = null;
|
| | |
|
| | | try {
|
| | | dtList = listByGoodsIds(goodsIdList);
|
| | | } catch (Exception e) {
|
| | |
|
| | | }
|
| | | Map<Long, DaTaoKeDetailV2> map = new HashMap<>();
|
| | | for (DaTaoKeDetailV2 goods : dtList)
|
| | | map.put(goods.getGoodsId(), goods);
|
| | | if (dtList != null)
|
| | | for (DaTaoKeDetailV2 goods : dtList)
|
| | | map.put(goods.getGoodsId(), goods);
|
| | | for (TaoBaoGoodsBrief goods : goodsList) {
|
| | | DaTaoKeDetailV2 detail = map.get(goods.getAuctionId());
|
| | | goods = DaTaoKeUtil.filterTaoBaoGoods(goods, detail);
|
| | |
| | |
|
| | | @Override
|
| | | public TaoBaoGoodsBrief filterTaoBaoGoods(TaoBaoGoodsBrief goods) {
|
| | | List<Long> goodsIdList = new ArrayList<>();
|
| | | goodsIdList.add(goods.getAuctionId());
|
| | |
|
| | | List<DaTaoKeDetailV2> daTaoKeList = listByGoodsIds(goodsIdList);
|
| | | if (daTaoKeList == null || daTaoKeList.size() == 0)
|
| | | return goods;
|
| | |
|
| | | // 重新设置标题与券价格
|
| | | goods = DaTaoKeUtil.filterTaoBaoGoods(goods, daTaoKeList.get(0));
|
| | |
|
| | | return goods;
|
| | | return filterTaoBaoGoods(goods, null, null);
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | |
|
| | | @Override
|
| | | public List<DaTaoKeDetailV2> getGoodsNotInList(Long cid, List<Long> listId, int count) {
|
| | | if (cid != null && cid == 0L)
|
| | | cid = null;
|
| | | return daTaoKeGoodsDetailV2Dao.getGoodsNotInList(cid, listId, count);
|
| | | }
|
| | |
|
| | |
| | |
|
| | | @Async
|
| | | private void updateGoods(Long id) {
|
| | | DaTaoKeDetailV2 v2 = DaTaoKeApiUtil.getGoodsDetail(id);
|
| | | // TODO暂时关闭服务
|
| | | DaTaoKeDetailV2 v2 = null;// DaTaoKeApiUtil.getGoodsDetail(id);
|
| | | if (v2 != null)
|
| | | daTaoKeGoodsDetailV2Dao.save(v2);
|
| | | }
|
| | |
| | | idList.add(td.getId());
|
| | | List<DaTaoKeDetailV2> finalList = listByIds(idList);
|
| | | if (finalList.size() != idList.size()) {
|
| | | for (Long id : idList)
|
| | | updateGoods(id);
|
| | | for (Long id : idList) {
|
| | | // updateGoods(id);
|
| | | // TODO 不能异步调用
|
| | | }
|
| | | finalList = listByIds(idList);
|
| | | }
|
| | |
|
| | |
| | | return dateList;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<DaTaoKeDetailV2> listByMaxPrice(Integer cid, BigDecimal maxPrice, String sortName, int page,
|
| | | int count) {
|
| | |
|
| | | return daTaoKeGoodsDetailV2Dao.listByMaxPrice(cid, maxPrice, sortName, (page - 1) * count, count);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public int countByMaxPrice(Integer cid, BigDecimal maxPrice) {
|
| | | return (int) daTaoKeGoodsDetailV2Dao.countByMaxPrice(cid, maxPrice);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<DaTaoKeDetailV2> listBySellerId(long start, int count, Long sellerId) {
|
| | | return daTaoKeGoodsDetailV2Dao.listBySellerId((int) start, count, sellerId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public DaTaoKeDetailV2 selectByAuctionId(Long auctionId) {
|
| | | return daTaoKeGoodsDetailV2Dao.selectByAuctionId(auctionId);
|
| | | }
|
| | |
|
| | | @Cacheable(value = "daTaoKeGoodsCache", key = "'selectByAuctionId-'+#auctionId")
|
| | | @Override
|
| | | public DaTaoKeDetailV2 selectByAuctionIdCache(Long auctionId) {
|
| | | return selectByAuctionId(auctionId);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public TaoBaoGoodsBrief filterTaoBaoGoods(TaoBaoGoodsBrief goods, String platform, String version) {
|
| | | List<Long> goodsIdList = new ArrayList<>();
|
| | | goodsIdList.add(goods.getAuctionId());
|
| | |
|
| | | List<DaTaoKeDetailV2> daTaoKeList = listByGoodsIds(goodsIdList);
|
| | | if (daTaoKeList == null || daTaoKeList.size() == 0)
|
| | | return goods;
|
| | |
|
| | | if (platform != null && version != null && VersionUtil.greaterThan_2_1(platform, version)) {
|
| | | // 重新设置标题与券价格
|
| | | goods = DaTaoKeUtil.filterTaoBaoGoods(goods, daTaoKeList.get(0), true);
|
| | | } else
|
| | | goods = DaTaoKeUtil.filterTaoBaoGoods(goods, daTaoKeList.get(0), false);
|
| | |
|
| | | return goods;
|
| | | }
|
| | |
|
| | | }
|