|
@@ -204,38 +204,37 @@ public class AlarmEventServiceImpl implements AlarmEventService {
|
|
|
}
|
|
|
|
|
|
private void test(CentereventTEventcatalogue centereventTEventcatalogue) {
|
|
|
- HttpHeaders headers = new HttpHeaders();
|
|
|
- headers.setContentType(MediaType.APPLICATION_JSON);
|
|
|
- for (String url : datasetUrl.split(";")) {
|
|
|
- JSONObject requestBody = JSONObject.parseObject("{" +
|
|
|
- "\"getFeatureMode\": \"SPATIAL\"," +
|
|
|
- "\"datasetNames\": [" + url.split("&")[1] + "]," +
|
|
|
- "\"geometry\": {" +
|
|
|
- "\"id\": 0," +
|
|
|
- "\"style\": null," +
|
|
|
- "\"parts\": [1]," +
|
|
|
- "\"points\": [{" +
|
|
|
- "\"y\": " + Double.parseDouble(centereventTEventcatalogue.getLatitude()) + "," +
|
|
|
- "\"x\": " + Double.parseDouble(centereventTEventcatalogue.getLongitude()) +
|
|
|
- "}]," +
|
|
|
- "\"type\": \"POINT\"}," +
|
|
|
- "\"spatialQueryMode\": \"INTERSECT\"" +
|
|
|
- "}");
|
|
|
- HttpEntity<JSONObject> entity = new HttpEntity<>(requestBody, headers);
|
|
|
- JSONObject result = null;
|
|
|
- try {
|
|
|
+ try {
|
|
|
+ HttpHeaders headers = new HttpHeaders();
|
|
|
+ headers.setContentType(MediaType.APPLICATION_JSON);
|
|
|
+ for (String url : datasetUrl.split(";")) {
|
|
|
+ JSONObject requestBody = JSONObject.parseObject("{" +
|
|
|
+ "\"getFeatureMode\": \"SPATIAL\"," +
|
|
|
+ "\"datasetNames\": " + url.split("&datasetNames=")[1] + "," +
|
|
|
+ "\"geometry\": {" +
|
|
|
+ "\"id\": 0," +
|
|
|
+ "\"style\": null," +
|
|
|
+ "\"parts\": [1]," +
|
|
|
+ "\"points\": [{" +
|
|
|
+ "\"y\": " + Double.parseDouble(centereventTEventcatalogue.getLatitude()) + "," +
|
|
|
+ "\"x\": " + Double.parseDouble(centereventTEventcatalogue.getLongitude()) +
|
|
|
+ "}]," +
|
|
|
+ "\"type\": \"POINT\"}," +
|
|
|
+ "\"spatialQueryMode\": \"INTERSECT\"" +
|
|
|
+ "}");
|
|
|
+ HttpEntity<JSONObject> entity = new HttpEntity<>(requestBody, headers);
|
|
|
RestTemplate restTemplate = new RestTemplate();
|
|
|
- result = restTemplate.postForEntity(url.split("&")[0], entity, JSONObject.class).getBody();
|
|
|
+ JSONObject result = restTemplate.postForEntity(url.split("&datasetNames=")[0], entity, JSONObject.class).getBody();
|
|
|
logger.info(result.toJSONString());
|
|
|
- } catch (Exception e) {
|
|
|
- logger.error(e.getMessage());
|
|
|
- }
|
|
|
- // {"features":[],"featureUriList":[],"datasetInfos":[],"totalCount":0,"featureCount":0}
|
|
|
- if (result.getLong("totalCount") != 0 && result.getLong("featureCount") != 0) {
|
|
|
- centereventTEventcatalogue.setEventStatus("误报");
|
|
|
- centereventTEventcatalogue.setEventStatusValue("forest_event_status_3");
|
|
|
- break;
|
|
|
+ // {"features":[],"featureUriList":[],"datasetInfos":[],"totalCount":0,"featureCount":0}
|
|
|
+ if (result.getLong("totalCount") != 0 && result.getLong("featureCount") != 0) {
|
|
|
+ centereventTEventcatalogue.setEventStatus("误报");
|
|
|
+ centereventTEventcatalogue.setEventStatusValue("forest_event_status_3");
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error(e.getMessage());
|
|
|
}
|
|
|
}
|
|
|
|