瀏覽代碼

218工程车、222区域入侵自动研判

lyq 2 月之前
父節點
當前提交
6d998e99c7

+ 30 - 31
src/main/java/com/sooka/sponest/event/centereventteventcatalogue/service/impl/AlarmEventServiceImpl.java

@@ -75,9 +75,6 @@ public class AlarmEventServiceImpl implements AlarmEventService {
     @Value("${sooka.supermap.datasetUrl}")
     @Value("${sooka.supermap.datasetUrl}")
     private String datasetUrl;
     private String datasetUrl;
 
 
-    @Value("${sooka.supermap.datasetNames}")
-    private String datasetNames;
-
     static final String ERROR_MSG_CHANNEL = "无法匹配相关设备!通道编号为:{}";
     static final String ERROR_MSG_CHANNEL = "无法匹配相关设备!通道编号为:{}";
 
 
     static final String ERROR_MSG_DEPT = "无法匹配相关部门!摄像头编号为:{}";
     static final String ERROR_MSG_DEPT = "无法匹配相关部门!摄像头编号为:{}";
@@ -209,34 +206,36 @@ public class AlarmEventServiceImpl implements AlarmEventService {
     private void test(CentereventTEventcatalogue centereventTEventcatalogue) {
     private void test(CentereventTEventcatalogue centereventTEventcatalogue) {
         HttpHeaders headers = new HttpHeaders();
         HttpHeaders headers = new HttpHeaders();
         headers.setContentType(MediaType.APPLICATION_JSON);
         headers.setContentType(MediaType.APPLICATION_JSON);
-        JSONObject requestBody = JSONObject.parseObject("{" +
-                "\"getFeatureMode\": \"SPATIAL\"," +
-                "\"datasetNames\": [" + datasetNames + "]," +
-                "\"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 {
-            RestTemplate restTemplate = new RestTemplate();
-            result = restTemplate.postForEntity(datasetUrl, 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");
+        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 {
+                RestTemplate restTemplate = new RestTemplate();
+                result = restTemplate.postForEntity(url.split("&")[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;
+            }
         }
         }
     }
     }