|
@@ -24,10 +24,8 @@ import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.BeanUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
-import org.springframework.http.ResponseEntity;
|
|
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
-import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
|
|
import java.time.LocalDate;
|
|
import java.time.LocalDate;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
@@ -88,9 +86,6 @@ public class ApiGoodsController extends ApiBaseAction {
|
|
@Value("${api.host.url}")
|
|
@Value("${api.host.url}")
|
|
private String apiHost;
|
|
private String apiHost;
|
|
|
|
|
|
- @Autowired
|
|
|
|
- private RestTemplate restTemplate;
|
|
|
|
-
|
|
|
|
/**
|
|
/**
|
|
*/
|
|
*/
|
|
@ApiOperation(value = "商品首页")
|
|
@ApiOperation(value = "商品首页")
|
|
@@ -168,9 +163,9 @@ public class ApiGoodsController extends ApiBaseAction {
|
|
}
|
|
}
|
|
String openApiurl = apiHost + "/4dage/shop/findHotIdByGoods" + "?goodsId=" + goodsId + "&origin=" + "4Dplaza" + "&pageSid=" + pageSid;
|
|
String openApiurl = apiHost + "/4dage/shop/findHotIdByGoods" + "?goodsId=" + goodsId + "&origin=" + "4Dplaza" + "&pageSid=" + pageSid;
|
|
log.info("获取商品绑定的热点id列表,请求openApi的url={}", openApiurl);
|
|
log.info("获取商品绑定的热点id列表,请求openApi的url={}", openApiurl);
|
|
- ResponseEntity<String> apiResultStr = restTemplate.getForEntity(openApiurl,String.class);
|
|
|
|
|
|
+ String apiResultStr = HttpClientUtil.doGet(openApiurl);
|
|
log.info("api平台返回结果:{}" , apiResultStr);
|
|
log.info("api平台返回结果:{}" , apiResultStr);
|
|
- JSONObject rspObject = JSON.parseObject(apiResultStr.getBody());
|
|
|
|
|
|
+ JSONObject rspObject = JSON.parseObject(apiResultStr);
|
|
JSONArray data = new JSONArray();
|
|
JSONArray data = new JSONArray();
|
|
if(null != rspObject){
|
|
if(null != rspObject){
|
|
data = rspObject.getJSONArray("data");
|
|
data = rspObject.getJSONArray("data");
|
|
@@ -567,9 +562,9 @@ public class ApiGoodsController extends ApiBaseAction {
|
|
requestParam.put("pageSid" , pageSid);
|
|
requestParam.put("pageSid" , pageSid);
|
|
String openApiurl = apiHost + "/4dage/shop/findHotIdByGoods";
|
|
String openApiurl = apiHost + "/4dage/shop/findHotIdByGoods";
|
|
log.info("获取商品绑定的热点id列表,请求openApi的url={},入参为:{}", openApiurl , JSON.toJSONString(requestParam));
|
|
log.info("获取商品绑定的热点id列表,请求openApi的url={},入参为:{}", openApiurl , JSON.toJSONString(requestParam));
|
|
- ResponseEntity<String> apiResultStr = restTemplate.postForEntity(openApiurl , JSON.toJSONString(requestParam),String.class);
|
|
|
|
|
|
+ String apiResultStr = HttpClientUtil.doPostJson(openApiurl , JSON.toJSONString(requestParam));
|
|
log.info("api平台返回结果:{}" , apiResultStr);
|
|
log.info("api平台返回结果:{}" , apiResultStr);
|
|
- JSONObject rspObject = JSON.parseObject(apiResultStr.getBody());
|
|
|
|
|
|
+ JSONObject rspObject = JSON.parseObject(apiResultStr);
|
|
if(null != rspObject){
|
|
if(null != rspObject){
|
|
JSONObject dataObj = rspObject.getJSONObject("data");
|
|
JSONObject dataObj = rspObject.getJSONObject("data");
|
|
if(null != dataObj){
|
|
if(null != dataObj){
|