|
@@ -4,6 +4,8 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.skyversation.xjcy.util.HttpUtil;
|
|
import com.skyversation.xjcy.util.HttpUtil;
|
|
|
import lombok.Getter;
|
|
import lombok.Getter;
|
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.HttpStatus;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.http.ResponseEntity;
|
|
@@ -18,6 +20,7 @@ import java.util.Map;
|
|
|
|
|
|
|
|
@Service
|
|
@Service
|
|
|
public class OWSService {
|
|
public class OWSService {
|
|
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(OWSService.class);
|
|
|
@Value("${app.ows.path}")
|
|
@Value("${app.ows.path}")
|
|
|
private String owsPath;
|
|
private String owsPath;
|
|
|
|
|
|
|
@@ -38,29 +41,23 @@ public class OWSService {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private JSONArray sendToOWS(Map<String, String> params, int depth) {
|
|
|
|
|
|
|
+ private JSONArray sendToOWS(Map<String, String> params) {
|
|
|
MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>();
|
|
MultiValueMap<String, String> map = new LinkedMultiValueMap<String, String>();
|
|
|
for (Map.Entry<String, String> entry : params.entrySet()) {
|
|
for (Map.Entry<String, String> entry : params.entrySet()) {
|
|
|
map.add(entry.getKey(), entry.getValue());
|
|
map.add(entry.getKey(), entry.getValue());
|
|
|
}
|
|
}
|
|
|
try {
|
|
try {
|
|
|
- String result = HttpUtil.requestGet(owsPath, map, Collections.emptyMap());
|
|
|
|
|
|
|
+ String result = HttpUtil.requestGet(owsPath+"/xjxm/ows", map, Collections.emptyMap());
|
|
|
JSONObject json = JSONObject.parseObject(result);
|
|
JSONObject json = JSONObject.parseObject(result);
|
|
|
return json.getJSONArray("features");
|
|
return json.getJSONArray("features");
|
|
|
} catch (RestClientException e) {
|
|
} catch (RestClientException e) {
|
|
|
- if (depth >= 3) {
|
|
|
|
|
- System.out.println("无法访问OWS服务,相关参数如下");
|
|
|
|
|
- System.out.println("path:"+owsPath);
|
|
|
|
|
- params.forEach((k,v)-> System.out.println(k+":"+v));
|
|
|
|
|
- return null;
|
|
|
|
|
- }
|
|
|
|
|
- return sendToOWS(params, depth + 1);
|
|
|
|
|
|
|
+ log.error("无法访问OWS服务,相关参数如下");
|
|
|
|
|
+ log.error("path:{}/xjxm/ows", owsPath);
|
|
|
|
|
+ params.forEach((k,v)-> log.error("{}:{}", k, v));
|
|
|
|
|
+ return null;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private JSONArray sendToOWS(Map<String, String> params) {
|
|
|
|
|
- return sendToOWS(params, 0);
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
private Map<String, String> commonParams() {
|
|
private Map<String, String> commonParams() {
|
|
|
Map<String, String> params = new HashMap<String, String>();
|
|
Map<String, String> params = new HashMap<String, String>();
|