|
|
|
@ -84,26 +84,27 @@ public class GoodsServiceImpl implements GoodsService { |
|
|
|
Map<String, Object> hmap = new HashMap(); |
|
|
|
hmap.put("entrust_token", sign); |
|
|
|
// get 方式获取
|
|
|
|
JSONObject jsonObject = RequestUtils.GetData(apiurl, hmap); |
|
|
|
// json的data节点
|
|
|
|
JSONArray jsonArray = jsonObject.getJSONArray("data"); |
|
|
|
JSONObject jsonObject = RequestUtils.GetData(apiurl, hmap,true); |
|
|
|
// 产品详情地址
|
|
|
|
String gdurl = host + "/consign/exchange/v1/selectEntrustDetails"; |
|
|
|
// 循环查询商品的详情
|
|
|
|
for(int i=0;i<jsonArray.size();i++){ |
|
|
|
if(jsonObject!=null && jsonObject.containsKey("data") ) { |
|
|
|
// json的data节点
|
|
|
|
JSONArray jsonArray = jsonObject.getJSONArray("data"); |
|
|
|
for (int i = 0; i < jsonArray.size(); i++) { |
|
|
|
// 获取到sourceData字段信息
|
|
|
|
JSONObject sdjson = (JSONObject) jsonArray.get(i); |
|
|
|
String nsdstr = sdjson.getString("sourceData"); |
|
|
|
if(nsdstr==null){ |
|
|
|
if (nsdstr == null) { |
|
|
|
continue; |
|
|
|
}else { |
|
|
|
} else { |
|
|
|
JSONObject nsdjson = JSONObject.parseObject(nsdstr); |
|
|
|
// 从sourcedata节点中提取商品唯一编号
|
|
|
|
String goodsId = nsdjson.getString("identifier"); |
|
|
|
// 以identifier为主键查询详情
|
|
|
|
String gdetailUrl = gdurl + "/" + goodsId; |
|
|
|
// 请求商品的详情
|
|
|
|
JSONObject gdJson = RequestUtils.GetData(gdetailUrl, hmap); |
|
|
|
JSONObject gdJson = RequestUtils.GetData(gdetailUrl, hmap,true); |
|
|
|
log.info(goodsId + "详情:" + gdJson); |
|
|
|
//处理返回的结果
|
|
|
|
JSONArray gdArr = gdJson.getJSONArray("data"); |
|
|
|
@ -172,7 +173,7 @@ public class GoodsServiceImpl implements GoodsService { |
|
|
|
// 计算器增加1
|
|
|
|
count++; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
return count; |
|
|
|
} |
|
|
|
|
|
|
|
|