From 3727469752a977dde6327e2c48d761b20b565d3d Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 15 七月 2022 09:19:21 +0800 Subject: [PATCH] 商品ID字符串化 --- fanli/src/main/java/com/yeshi/fanli/util/jd/JDApiUtil.java | 60 ++++++++++++++++++++++++++++-------------------------------- 1 files changed, 28 insertions(+), 32 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/util/jd/JDApiUtil.java b/fanli/src/main/java/com/yeshi/fanli/util/jd/JDApiUtil.java index 1a18ceb..c3ced2e 100644 --- a/fanli/src/main/java/com/yeshi/fanli/util/jd/JDApiUtil.java +++ b/fanli/src/main/java/com/yeshi/fanli/util/jd/JDApiUtil.java @@ -26,6 +26,8 @@ import com.yeshi.fanli.entity.jd.JDOrderItem; import com.yeshi.fanli.log.LogHelper; import com.yeshi.common.entity.PageEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.yeshi.utils.MoneyBigDecimalUtil; import com.yeshi.fanli.util.StringUtil; import org.yeshi.utils.TimeUtil; @@ -140,46 +142,40 @@ } public static String convertLinkWithSubUnionId(String materialId, String couponUrl, String giftCouponKey, String positionId, - String subUnionId) { + String subUnionId) throws Exception { String log = "浜笢杞摼鍑洪敊:"; - try { - JSONObject json = new JSONObject(); + JSONObject json = new JSONObject(); - json.put("siteId", APP_ID); - json.put("positionId", positionId); - json.put("materialId", materialId); + json.put("siteId", APP_ID); + json.put("positionId", positionId); + json.put("materialId", materialId); - if (!StringUtil.isNullOrEmpty(giftCouponKey)) { - json.put("giftCouponKey", giftCouponKey); - } - if (!StringUtil.isNullOrEmpty(couponUrl)) - json.put("couponUrl", couponUrl); + if (!StringUtil.isNullOrEmpty(giftCouponKey)) { + json.put("giftCouponKey", giftCouponKey); + } + if (!StringUtil.isNullOrEmpty(couponUrl)) + json.put("couponUrl", couponUrl); - if (!StringUtil.isNullOrEmpty(subUnionId)) - json.put("subUnionId", subUnionId); + if (!StringUtil.isNullOrEmpty(subUnionId)) + json.put("subUnionId", subUnionId); - // 1锛氶暱閾撅紝 2 锛氱煭閾� 锛�3锛� 闀块摼+鐭摼 - json.put("chainType", 3); - JSONObject root = new JSONObject(); - root.put("promotionCodeReq", json); + // 1锛氶暱閾撅紝 2 锛氱煭閾� 锛�3锛� 闀块摼+鐭摼 + json.put("chainType", 3); + JSONObject root = new JSONObject(); + root.put("promotionCodeReq", json); - String result = baseRequest2("jd.union.open.promotion.bysubunionid.get", null, root); + String result = baseRequest2("jd.union.open.promotion.bysubunionid.get", null, root); - log += json.toString() + "####" + result; - JSONObject resultJson = JSONObject.fromObject(result); - result = resultJson.optJSONObject("jd_union_open_promotion_bysubunionid_get_response").optString("result"); - System.out.println(result); - if (result == null) { - return null; - } - - resultJson = JSONObject.fromObject(result); - return resultJson.optJSONObject("data").optString("shortURL"); - } catch (Exception e) { - LogHelper.error(log); + log += json.toString() + "####" + result; + JSONObject resultJson = JSONObject.fromObject(result); + result = resultJson.optJSONObject("jd_union_open_promotion_bysubunionid_get_response").optString("result"); + System.out.println(result); + if (result == null) { + return null; } - return null; + resultJson = JSONObject.fromObject(result); + return resultJson.optJSONObject("data").optString("shortURL"); } public static JDGoods queryGoodsDetail(Long skuId) { @@ -743,7 +739,7 @@ JDBackUpOrder order = new JDBackUpOrder(); order.setId(orderId); order.setContent(item.toString()); - order.setOrderTime(new Date(orderTime )); + order.setOrderTime(new Date(orderTime)); orderList.add(order); } return new JDOrderForBackUpResult(hasMore, orderList); -- Gitblit v1.8.0