|
|
|
@ -12,6 +12,7 @@ import org.springframework.http.ResponseEntity;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
@Service
|
|
|
|
@ -33,7 +34,7 @@ public class TerminalClient {
|
|
|
|
|
* @param radius
|
|
|
|
|
* @return
|
|
|
|
|
*/
|
|
|
|
|
public ResponseResult aroundsearch(String center,Integer radius){
|
|
|
|
|
public ResponseResult<List<TerminalAroundSearch>> aroundsearch(String center,Integer radius){
|
|
|
|
|
//拼接请求的URL
|
|
|
|
|
StringBuilder url = new StringBuilder();
|
|
|
|
|
url.append(AmapConfigConstant.TERMINAL_AROUND_SEARCH_URL);
|
|
|
|
@ -52,15 +53,19 @@ public class TerminalClient {
|
|
|
|
|
String bodyStr = forEntity.getBody();
|
|
|
|
|
JSONObject result = JSONObject.fromObject(bodyStr);
|
|
|
|
|
System.out.println("周边搜索终端的结果:"+bodyStr);
|
|
|
|
|
List<TerminalAroundSearch> list = new ArrayList<>();
|
|
|
|
|
if(result.has("data")){
|
|
|
|
|
JSONObject data = result.getJSONObject("data");
|
|
|
|
|
// int count = data.getInt("count");
|
|
|
|
|
JSONArray jsonArray = data.getJSONArray("results");
|
|
|
|
|
for (int index = 0 ;index < jsonArray.size();index++){
|
|
|
|
|
JSONObject jsonObject = jsonArray.getJSONObject(index);
|
|
|
|
|
TerminalAroundSearch terminalAroundSearch = new TerminalAroundSearch();
|
|
|
|
|
List<TerminalAroundSearch> jsonArray = data.getJSONArray("results");
|
|
|
|
|
ResponseResult.success(ResponseResult.success());
|
|
|
|
|
terminalAroundSearch.setTid(jsonObject.getString("tid"));
|
|
|
|
|
terminalAroundSearch.setCarId(jsonObject.getLong("desc"));
|
|
|
|
|
list.add(terminalAroundSearch);
|
|
|
|
|
}
|
|
|
|
|
return ResponseResult.success(list);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return ResponseResult.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|