| | |
| | | import com.yeshi.fanli.dto.jd.JDFilter;
|
| | | import com.yeshi.fanli.dto.jd.JDOrderResult;
|
| | | import com.yeshi.fanli.dto.jd.JDPingouInfo;
|
| | | import com.yeshi.fanli.dto.jd.JDSearchResult;
|
| | | import com.yeshi.fanli.dto.jd.JDShopInfo;
|
| | | import com.yeshi.fanli.entity.jd.JDGoods;
|
| | | import com.yeshi.fanli.entity.jd.JDOrder;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.MoneyBigDecimalUtil;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.TimeUtil;
|
| | |
| | | *
|
| | | * @return
|
| | | */
|
| | | public static String convertLink(String materialId, String couponUrl, String pid) {
|
| | | public static String convertLink(String materialId, String couponUrl, String positionId, String ext1) {
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("materialId", materialId);
|
| | | json.put("siteId", APP_ID);
|
| | | if (couponUrl != null)
|
| | | json.put("positionId", positionId);
|
| | | |
| | | if (!StringUtil.isNullOrEmpty(couponUrl))
|
| | | json.put("couponUrl", couponUrl);
|
| | | // json.put("ext1", "437032_12");
|
| | | json.put("pid", pid);
|
| | | |
| | | if (!StringUtil.isNullOrEmpty(ext1))
|
| | | json.put("ext1", ext1);
|
| | |
|
| | | JSONObject root = new JSONObject();
|
| | | root.put("promotionCodeReq", json);
|
| | |
|
| | | String result = baseRequest("jd.union.open.promotion.common.get", null, json);
|
| | | String result = baseRequest("jd.union.open.promotion.common.get", null, root);
|
| | | JSONObject resultJson = JSONObject.fromObject(result);
|
| | | result = resultJson.optJSONObject("jd_union_open_promotion_common_get_response").optString("result");
|
| | | resultJson = JSONObject.fromObject(result);
|
| | |
| | | filter.setPageIndex(1);
|
| | | filter.setPageSize(20);
|
| | | filter.setListId(skuIdList);
|
| | | List<JDGoods> list = queryByKey(filter);
|
| | | if (list != null && list.size() > 0)
|
| | | return list.get(0);
|
| | | JDSearchResult searchResult = queryByKey(filter);
|
| | | if (searchResult != null) {
|
| | | List<JDGoods> list = searchResult.getGoodsList();
|
| | | if (list != null && list.size() > 0)
|
| | | return list.get(0);
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | |
| | | * @param skuIdList
|
| | | * @return
|
| | | */
|
| | | public static List<JDGoods> queryByKey(JDFilter filter) {
|
| | | public static JDSearchResult queryByKey(JDFilter filter) {
|
| | | JDSearchResult searchResult = new JDSearchResult();
|
| | | |
| | | List<JDGoods> list = new ArrayList<>();
|
| | | JSONObject json = new JSONObject();
|
| | | json.put("pageIndex", filter.getPageIndex());
|
| | |
| | | if (filter.getIsPG() != null)
|
| | | json.put("isPG", filter.getIsPG());
|
| | |
|
| | | if (filter.getIsCoupon() != null)
|
| | | json.put("isCoupon", filter.getIsCoupon());
|
| | |
|
| | | if (filter.getPingouPriceStart() != null)
|
| | | json.put("pingouPriceStart", filter.getPingouPriceStart());
|
| | |
|
| | |
| | |
|
| | | if (filter.getShopId() != null)
|
| | | json.put("shopId", filter.getShopId());
|
| | | |
| | | if (filter.getOwner() != null)
|
| | | json.put("owner", filter.getOwner());
|
| | | |
| | | System.out.println(json.toString());
|
| | |
|
| | | JSONObject jsonDTO = new JSONObject();
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | long totalCount = resultJson.optLong("totalCount");
|
| | | PageEntity pageEntity = new PageEntity();
|
| | | pageEntity.setTotalCount(totalCount);
|
| | | |
| | | searchResult.setPageEntity(pageEntity);
|
| | | }
|
| | | return list;
|
| | | searchResult.setGoodsList(list);
|
| | | return searchResult;
|
| | | }
|
| | |
|
| | |
|