| | |
| | | JSONObject item = array.optJSONObject(i); |
| | | TaoBaoGoodsBrief goods = new TaoBaoGoodsBrief(); |
| | | goods.setPictUrl(item.optString("pict_url")); |
| | | goods.setAuctionId(item.optLong("num_iid")); |
| | | goods.setAuctionId(item.optString("num_iid")); |
| | | goods.setAuctionUrl(item.optString("item_url")); |
| | | goods.setBiz30day(item.optInt("volume")); |
| | | goods.setCouponInfo(item.optString("coupon_info")); |
| | |
| | | |
| | | private static TaoBaoGoodsBrief parseSimpleGoodsInfo(JSONObject item) { |
| | | TaoBaoGoodsBrief goods = new TaoBaoGoodsBrief(); |
| | | goods.setAuctionId(item.optLong("num_iid")); |
| | | goods.setAuctionId(item.optString("num_iid")); |
| | | goods.setAuctionUrl(item.optString("item_url")); |
| | | goods.setBiz30day(item.optInt("volume")); |
| | | if (item.optJSONObject("small_images") != null) { |
| | |
| | | if (result != null && result.getTaoBaoGoodsBriefs() != null) |
| | | for (TaoBaoGoodsBrief g : result.getTaoBaoGoodsBriefs()) { |
| | | System.out.println(goods.getAuctionId() + ":" + g.getAuctionId()); |
| | | if (goods.getAuctionId().longValue() == g.getAuctionId()) { |
| | | g.setId(goods.getAuctionId()); |
| | | if (TaoBaoUtil.isEqual( goods.getAuctionId(), g.getAuctionId())) { |
| | | g.setAuctionId(goods.getAuctionId()); |
| | | g.setCreatetime(new Date()); |
| | | g.setMaterialLibType(goods.getMaterialLibType()); |
| | | g.setProvcity(goods.getProvcity()); |
| | |
| | | goods.getUserType(), app); |
| | | if (result != null && result.getTaoBaoGoodsBriefs() != null) |
| | | for (TaoBaoGoodsBrief g : result.getTaoBaoGoodsBriefs()) { |
| | | if (goods.getAuctionId().longValue() == g.getAuctionId()) { |
| | | g.setId(goods.getAuctionId()); |
| | | if (TaoBaoUtil.isEqual(goods.getAuctionId(), g.getAuctionId())) { |
| | | g.setAuctionId(goods.getAuctionId()); |
| | | // 判断是否有优惠券 |
| | | if (!StringUtil.isNullOrEmpty(g.getCouponActivityId())) { |
| | | // 获取优惠券详情 |
| | |
| | | goods.getUserType(), app); |
| | | if (result != null && result.getTaoBaoGoodsBriefs() != null) |
| | | for (TaoBaoGoodsBrief g : result.getTaoBaoGoodsBriefs()) { |
| | | if (goods.getAuctionId().longValue() == g.getAuctionId()) { |
| | | g.setId(goods.getAuctionId()); |
| | | if (TaoBaoUtil.isEqual( goods.getAuctionId(), g.getAuctionId())) { |
| | | g.setAuctionId(goods.getAuctionId()); |
| | | g.setCreatetime(new Date()); |
| | | return g; |
| | | } |
| | |
| | | goods.getUserType()); |
| | | if (result != null && result.getTaoBaoGoodsBriefs() != null) |
| | | for (TaoBaoGoodsBrief g : result.getTaoBaoGoodsBriefs()) { |
| | | if (goods.getAuctionId().longValue() == g.getAuctionId()) { |
| | | g.setId(goods.getAuctionId()); |
| | | if ( TaoBaoUtil.isEqual(goods.getAuctionId(), g.getAuctionId())) { |
| | | g.setAuctionId(goods.getAuctionId()); |
| | | g.setAuctionUrl(goods.getAuctionUrl()); |
| | | g.setShopTitle(goods.getShopTitle()); |
| | | |
| | |
| | | if (searchResult != null && searchResult.getTaoBaoGoodsBriefs() != null |
| | | && searchResult.getTaoBaoGoodsBriefs().size() > 0) { |
| | | for (TaoBaoGoodsBrief g : searchResult.getTaoBaoGoodsBriefs()) { |
| | | if (g.getAuctionId().longValue() == goods.getAuctionId()) { |
| | | if (TaoBaoUtil.isEqual(g.getAuctionId() , goods.getAuctionId())) { |
| | | g.setImgList(goods.getImgList()); |
| | | g.setId(goods.getAuctionId()); |
| | | g.setAuctionId(goods.getAuctionId()); |
| | | g.setAuctionUrl(goods.getAuctionUrl()); |
| | | g.setShopTitle(goods.getShopTitle()); |
| | | |
| | |
| | | /** |
| | | * 商品物料搜索 |
| | | * |
| | | * @param filter |
| | | * @return |
| | | */ |
| | | public static TaoBaoSearchResult searchWuLiaoForDetail(String title, BigDecimal zkPrice, String provcity, |
| | |
| | | /** |
| | | * 商品物料搜索 |
| | | * |
| | | * @param filter |
| | | * @return |
| | | */ |
| | | public static TaoBaoSearchResult searchWuLiaoForDetail(String title, BigDecimal zkPrice, String provcity, |
| | |
| | | goods.setPictUrlWhite(item.optString("white_image")); |
| | | } |
| | | |
| | | goods.setAuctionId(item.optLong("num_iid")); |
| | | goods.setAuctionId(item.optString("num_iid")); |
| | | goods.setAuctionUrl("https:" + item.optString("url")); |
| | | goods.setBiz30day(item.optInt("volume")); |
| | | goods.setCouponInfo(item.optString("coupon_info")); |
| | |
| | | * @param activityId |
| | | * @return |
| | | */ |
| | | public static TaoKeApiUtil.QuanInfo getQuanInfo(Long auctionId, String activityId) { |
| | | public static TaoKeApiUtil.QuanInfo getQuanInfo(String auctionId, String activityId) { |
| | | TaoKeApiUtil.QuanInfo info = new TaoKeApiUtil.QuanInfo(); |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("method", "taobao.tbk.coupon.get"); |
| | |
| | | /** |
| | | * 店铺搜索 |
| | | * |
| | | * @param key -店铺名称 |
| | | * @param page -页码 |
| | | * @return |
| | | */ |
| | | public static List<TaoBaoShopInfo> searchShop(SearchShopFilter filter) { |
| | |
| | | System.out.println(resultStr); |
| | | } |
| | | |
| | | public static void getTAEGoodsDetail(Long auctionId) { |
| | | public static void getTAEGoodsDetail(String auctionId) { |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("method", "taobao.tae.items.list"); |
| | | map.put("fields", "title,nick,pic_url,location,cid,price,post_fee,promoted_service,ju,shop_name"); |
| | |
| | | return null; |
| | | } |
| | | |
| | | public static void specialConvertItem(Long auctionId, TaoKeAppInfo app) { |
| | | public static void specialConvertItem(String auctionId, TaoKeAppInfo app) { |
| | | String pid = app.getPid(); |
| | | String[] sts = pid.split("_"); |
| | | Map<String, String> map = new HashMap<>(); |
| | |
| | | } |
| | | } |
| | | |
| | | public static TaoBaoGoodsBrief specialConvertCoupon(Long auctionId, TaoKeAppInfo app) { |
| | | public static TaoBaoGoodsBrief specialConvertCoupon(String auctionId, TaoKeAppInfo app) { |
| | | String pid = app.getPid(); |
| | | String[] sts = pid.split("_"); |
| | | Map<String, String> map = new HashMap<>(); |
| | |
| | | TaoBaoGoodsBrief goods = new TaoBaoGoodsBrief(); |
| | | // 设置成320*320的图片尺寸 |
| | | goods.setPictUrl(TbImgUtil.getTBSize320Img("https:" + item.optString("pict_url"))); |
| | | goods.setAuctionId(item.optLong("item_id")); |
| | | goods.setAuctionId(item.optString("item_id")); |
| | | goods.setAuctionUrl("https://item.taobao.com/item.htm?id=" + goods.getAuctionId()); |
| | | goods.setBiz30day(item.optInt("volume")); |
| | | if (!StringUtil.isNullOrEmpty(item.optString("coupon_amount"))) { |
| | |
| | | } |
| | | |
| | | // 淘礼金创建 |
| | | public static TaoLiJinDTO createTaoLiJin(Long auctionId, String name, BigDecimal perface, int totalNum, |
| | | public static TaoLiJinDTO createTaoLiJin(String auctionId, String name, BigDecimal perface, int totalNum, |
| | | Date sendStartTime, Date sendEndTime, Date useStartTime, Date useEndTime, TaoKeAppInfo app) |
| | | throws TaoLiJinCreateException, TaoKeApiException { |
| | | Map<String, String> map = new HashMap<>(); |
| | |
| | | } |
| | | |
| | | // 淘礼金报告 |
| | | public static UserTaoLiJinReport getTaoLiJinEffective(String rightsId) { |
| | | public static UserTaoLiJinReport getTaoLiJinEffective(String rightsId, String pid) { |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("method", "taobao.tbk.dg.vegas.tlj.instance.report"); |
| | | map.put("method", "taobao.tbk.dg.vegas.tlj.report("); |
| | | map.put("rights_id", rightsId); |
| | | map.put("adzone_id", pid.split("_")[3]); |
| | | |
| | | TaoKeAppInfo app = new TaoKeAppInfo(); |
| | | app.setAppKey(TaoBaoConstant.TAOBAO_AUTH_APPKEY); |
| | |
| | | JSONObject json = JSONObject.fromObject(result); |
| | | System.out.println(json); |
| | | |
| | | JSONObject root = json.optJSONObject("tbk_dg_vegas_tlj_instance_report_response"); |
| | | JSONObject root = json.optJSONObject("tbk_dg_vegas_tlj_report_response"); |
| | | |
| | | if (root != null && root.optJSONObject("result") != null) { |
| | | if (root.optJSONObject("result").optBoolean("success")) { |
| | | JSONObject modelJson = root.optJSONObject("result").optJSONObject("model"); |
| | | |
| | | if (modelJson != null && modelJson.size() > 0) { |
| | | UserTaoLiJinReport report = new UserTaoLiJinReport(); |
| | | report.setId(rightsId); |
| | | report.setUnfreezeAmount(new BigDecimal(modelJson.optString("unfreeze_amount"))); |
| | | report.setUnfreezeNum(modelJson.optInt("unfreeze_num")); |
| | | report.setRefundAmount(new BigDecimal(modelJson.optString("refund_amount"))); |
| | | report.setRefundNum(modelJson.optInt("refund_num")); |
| | | report.setAlipayAmount(new BigDecimal(modelJson.optString("alipay_amount"))); |
| | | report.setUseAmount(new BigDecimal(modelJson.optString("use_amount"))); |
| | | report.setUseNum(modelJson.optInt("use_num")); |
| | | report.setWinAmount(new BigDecimal(modelJson.optString("win_amount"))); |
| | | report.setWinNum(modelJson.optInt("win_num")); |
| | | report.setPreCommissionAmount(new BigDecimal(modelJson.optString("pre_commission_amount"))); |
| | | return report; |
| | | } |
| | | if (root != null && root.optBoolean("result_success")) { |
| | | JSONObject modelJson = root.optJSONObject("model").optJSONObject("extra"); |
| | | if (modelJson != null && modelJson.size() > 0) { |
| | | UserTaoLiJinReport report = new UserTaoLiJinReport(); |
| | | report.setId(rightsId); |
| | | report.setWinAmount(new BigDecimal(modelJson.optString("win_sum_amt"))); |
| | | report.setWinNum(modelJson.optInt("win_pv")); |
| | | report.setRefundAmount(new BigDecimal(modelJson.optString("refund_sum_amt"))); |
| | | report.setRefundNum(modelJson.optInt("refund_num")); |
| | | report.setAlipayAmount(new BigDecimal(modelJson.optString("alipay_amt"))); |
| | | report.setUseAmount(new BigDecimal(modelJson.optString("use_sum_amt"))); |
| | | report.setUseNum(modelJson.optInt("use_num")); |
| | | report.setUnfreezeAmount(new BigDecimal(modelJson.optString("remaining_amt"))); |
| | | report.setUnfreezeNum(modelJson.optInt("remaining_num")); |
| | | report.setPreCommissionAmount(new BigDecimal(modelJson.optString("pre_pub_share_fee_for_disp"))); |
| | | return report; |
| | | } |
| | | } |
| | | } catch (Exception e) { |
| | |
| | | return null; |
| | | } |
| | | |
| | | public static void getCouponByAuctionId(Long auctionId) { |
| | | public static void getCouponByAuctionId(String auctionId) { |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("method", "taobao.tbk.itemid.coupon.get"); |
| | | map.put("platform", 2 + ""); |
| | |
| | | return null; |
| | | } |
| | | |
| | | public static List<TaoBaoGoodsBrief> guessLikeByAuctionId(Long auctionId, int count) { |
| | | public static List<TaoBaoGoodsBrief> guessLikeByAuctionId(String auctionId, int count) { |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("method", "taobao.tbk.dg.optimus.material"); |
| | | map.put("item_id", auctionId + ""); |
| | |
| | | return goodsList; |
| | | } |
| | | |
| | | public static List<TaoBaoGoodsBrief> getCouponListByItemId(Long auctionId) { |
| | | public static List<TaoBaoGoodsBrief> getCouponListByItemId(String auctionId) { |
| | | Map<String, String> map = new HashMap<>(); |
| | | map.put("method", "taobao.tbk.itemid.coupon.get"); |
| | | map.put("platform", auctionId + ""); |