| | |
| | |
|
| | | String key = searchFilter.getKey();
|
| | | if (StringUtil.isNullOrEmpty(key)) {
|
| | | data.put("key", "");
|
| | | data.put("keywordType", "kt0");
|
| | | data.put("searchType", "st3");
|
| | | } else {
|
| | |
| | | JSONArray array = json.optJSONObject("data").optJSONArray("unionGoods");
|
| | | if (array != null) {
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | goodsList.add(parseGoods(array.optJSONArray(i).optJSONObject(0).toString()));
|
| | | JDGoods parseGoods = parseGoods(array.optJSONArray(i).optJSONObject(0).toString());
|
| | | if (parseGoods != null) {
|
| | | goodsList.add(parseGoods);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | JSONArray array = json.optJSONObject("data").optJSONArray("unionRecommendGoods");
|
| | | if (array != null) {
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | goodsList.add(parseGoods(array.optJSONArray(i).optJSONObject(0).toString()));
|
| | | JDGoods parseGoods = parseGoods(array.optJSONArray(i).optJSONObject(0).toString());
|
| | | if (parseGoods != null) {
|
| | | goodsList.add(parseGoods);
|
| | | }
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | return null;
|
| | | }
|
| | |
|
| | | |
| | | private static JDGoods parseGoods(String data) {
|
| | | JDGoods goods = new JDGoods();
|
| | | JSONObject json = JSONObject.fromObject(data);
|
| | | |
| | | BigDecimal wlCommissionRatio = new BigDecimal(json.optString("wlCommissionRatio"));
|
| | | if (wlCommissionRatio.compareTo(new BigDecimal(0)) > 0) {
|
| | | JDCommissionInfo commission = new JDCommissionInfo();
|
| | | commission.setCommission(new BigDecimal(json.optString("wlCommission")));
|
| | | commission.setCommissionShare(wlCommissionRatio);
|
| | | goods.setCommissionInfo(commission);
|
| | | } else {
|
| | | return null; // 过滤无返利商品
|
| | | }
|
| | | |
| | | goods.setSkuId(json.optLong("skuId"));
|
| | | goods.setSkuName(json.optString("skuName"));
|
| | | |
| | |
|
| | | JDShopInfo shopInfo = new JDShopInfo();
|
| | | shopInfo.setShopId(json.optInt("shopId"));
|
| | | shopInfo.setShopName(json.optString("shopName"));
|
| | | goods.setShopInfo(shopInfo);
|
| | |
|
| | | if (!StringUtil.isNullOrEmpty(json.optString("wlPrice")))
|
| | | goods.setPrice(new BigDecimal(json.optString("wlPrice")));
|
| | | else
|
| | | goods.setPrice(new BigDecimal(json.optString("finalPrice")));
|
| | | |
| | | goods.setPrice(new BigDecimal(json.optString("wlPrice")));
|
| | | |
| | | goods.setInOrderCount30Days(json.optLong("inOrderCount30Days"));
|
| | |
|
| | | if (json.optInt("isZY") == 1)
|
| | |
| | |
|
| | | goods.setMaterialUrl("https://item.jd.com/"+ json.optLong("skuId") +".html");
|
| | | goods.setPicUrl("http://img14.360buyimg.com/n1/" + json.optString("materialUrl"));
|
| | | JDCommissionInfo commission = new JDCommissionInfo();
|
| | | commission.setCommission(new BigDecimal(json.optString("wlCommission")));
|
| | | commission.setCommissionShare(new BigDecimal(json.optString("wlCommissionRatio")));
|
| | | goods.setCommissionInfo(commission);
|
| | | |
| | | goods.setGoodCommentsShare(new BigDecimal(json.optString("goodCommentsShare")));
|
| | |
|
| | | // 券信息
|
| | | if (json.optString("hasCoupon") != null && json.optInt("hasCoupon") == 1
|
| | | && json.optInt("couponRemainCnt") > 0) {
|
| | | JDCouponInfo coupon = new JDCouponInfo();
|
| | | coupon.setDiscount(new BigDecimal(json.optString("couponDiscount")));
|
| | | coupon.setQuota(new BigDecimal(json.optString("couponQuota")));
|
| | | coupon.setLink("https:" + json.optString("couponLink"));
|
| | | goods.setCouponInfo(coupon);
|
| | | } |
| | | |
| | | // 团购信息
|
| | | if (json.optString("isPinGou") != null && json.optInt("isPinGou") == 1) {
|
| | | JDPingouInfo jdPinGouInfo = new JDPingouInfo();
|
| | |
| | | goods.setPinGouInfo(jdPinGouInfo);
|
| | | }
|
| | |
|
| | | |
| | | String finalPrice = json.optString("finalPrice");
|
| | | if (!StringUtil.isNullOrEmpty(finalPrice)) {
|
| | | // 券信息
|
| | | BigDecimal finalPriceDecimal = new BigDecimal(json.optString("finalPrice"));
|
| | | if (finalPriceDecimal != null && json.optString("hasCoupon") != null && json.optInt("hasCoupon") == 1
|
| | | && json.optInt("couponRemainCnt") > 0) {
|
| | | JDCouponInfo coupon = new JDCouponInfo();
|
| | | coupon.setDiscount(new BigDecimal(json.optString("couponDiscount")));
|
| | | coupon.setQuota(new BigDecimal(json.optString("couponQuota")));
|
| | | coupon.setLink("https:" + json.optString("couponLink"));
|
| | | goods.setCouponInfo(coupon);
|
| | | } |
| | | }
|
| | | |
| | | |
| | | return goods;
|
| | | }
|
| | |
|