| | |
| | | } |
| | | |
| | | @Override |
| | | public UserGoodsStorage getByUidAndAuctionId(Long uid, Long auctionId, Integer goodsType) { |
| | | public UserGoodsStorage getByUidAndAuctionId(Long uid, String auctionId, Integer goodsType) { |
| | | return userGoodsStorageMapper.getByUidAndAuctionId(uid, auctionId, goodsType); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void save(Long uid, Set<Long> auctionIds, Integer goodsType) throws UserGoodsStorageException { |
| | | public void save(Long uid, Set<String> auctionIds, Integer goodsType) throws UserGoodsStorageException { |
| | | |
| | | if (uid == null) { |
| | | throw new UserGoodsStorageException(1, "用户尚未登录"); |
| | |
| | | throw new UserGoodsStorageException(1, "商品ID为空"); |
| | | } |
| | | |
| | | for (Long auctionId : auctionIds) { |
| | | for (String auctionId : auctionIds) { |
| | | CommonGoods commonGoods = null; |
| | | if (goodsType == null) { |
| | | goodsType = Constant.SOURCE_TYPE_TAOBAO; |
| | |
| | | |
| | | if (goodsType == Constant.SOURCE_TYPE_JD) { |
| | | // 京东 |
| | | JDGoods jdGoods = JDApiUtil.queryGoodsDetail(auctionId); |
| | | JDGoods jdGoods = JDApiUtil.queryGoodsDetail(Long.parseLong(auctionId)); |
| | | if (jdGoods == null) { |
| | | jdGoods = JDApiUtil.getGoodsDetail(auctionId); |
| | | jdGoods = JDApiUtil.getGoodsDetail(Long.parseLong( auctionId)); |
| | | } |
| | | if (jdGoods == null) { |
| | | throw new UserGoodsStorageException(1, auctionId + "商品已下架"); |
| | |
| | | |
| | | } else if (goodsType == Constant.SOURCE_TYPE_PDD) { |
| | | // 拼多多 |
| | | PDDGoodsDetail pddGoods = PinDuoDuoApiUtil.getGoodsDetail(auctionId); |
| | | PDDGoodsDetail pddGoods = PinDuoDuoApiUtil.getGoodsDetail(Long.parseLong(auctionId)); |
| | | if (pddGoods == null) { |
| | | throw new UserGoodsStorageException(1, auctionId + "商品已下架"); |
| | | } |
| | |
| | | |
| | | List<TaoBaoGoodsBrief> listTaoKeGoods = null; |
| | | if (source == Constant.SOURCE_TYPE_TAOBAO) { |
| | | List<Long> listGid = new ArrayList<Long>(); |
| | | List<String> listGid = new ArrayList<>(); |
| | | for (UserGoodsStorage userGoodsStorage : listStorage) { |
| | | CommonGoods commonGoods = userGoodsStorage.getCommonGoods(); |
| | | if (commonGoods == null) { |
| | |
| | | if (listTaoKeGoods != null && listTaoKeGoods.size() > 0 && goodsType != null |
| | | && goodsType == Constant.SOURCE_TYPE_TAOBAO) { |
| | | state = 1; // 默认停售 |
| | | Long goodsId = commonGoods.getGoodsId(); |
| | | String goodsId = commonGoods.getGoodsId(); |
| | | for (TaoBaoGoodsBrief taoKeGoods : listTaoKeGoods) { |
| | | Long auctionId = taoKeGoods.getAuctionId(); |
| | | String auctionId = taoKeGoods.getAuctionId(); |
| | | if (goodsId == auctionId || goodsId.equals(auctionId)) { |
| | | state = 0; // 在售 |
| | | break; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public boolean isExistStorage(Long uid, Long auctionId, Integer goodType) { |
| | | public boolean isExistStorage(Long uid, String auctionId, Integer goodType) { |
| | | boolean state = false; |
| | | if (uid != null && auctionId != null) { |
| | | UserGoodsStorage userGoodsStorage = userGoodsStorageMapper.getByUidAndAuctionId(uid, auctionId, goodType); |