|
|
|
@ -107,18 +107,19 @@ public class GoodsServiceImpl implements GoodsService { |
|
|
|
JSONObject gdJson = RequestUtils.GetData(gdetailUrl, hmap,true); |
|
|
|
log.info(goodsId + "详情:" + gdJson); |
|
|
|
//处理返回的结果
|
|
|
|
JSONArray gdArr = gdJson.getJSONArray("data"); |
|
|
|
//JSONArray gdArr = gdJson.getJSONArray("data");
|
|
|
|
// 如果goods表中存在记录,不进行操作
|
|
|
|
Goods tgoods = goodsMapper.getGoodsByIsli(goodsId); |
|
|
|
if (tgoods != null) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
// add goodsSource,循环插入 商品资源
|
|
|
|
for (int x = 0; x < gdArr.size(); x++) { |
|
|
|
JSONObject gditem = (JSONObject) gdArr.get(x); |
|
|
|
//for (int x = 0; x < gdArr.size(); x++) {
|
|
|
|
// 从里面取出数据
|
|
|
|
JSONObject gditem = gdJson.getJSONObject("data"); |
|
|
|
GoodsSource goodsSource = ApiGoodsUtils.jsonToGoodsSource(gditem, goodsId); |
|
|
|
goodsSourceMapper.add(goodsSource); |
|
|
|
} |
|
|
|
//}
|
|
|
|
// insertGoodsDetail
|
|
|
|
GoodsDetail goodsDetail = ApiGoodsUtils.jsonToGoodsDetail(nsdjson, sdjson); |
|
|
|
// 返回商品详情
|
|
|
|
|