|
@@ -35,8 +35,12 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.http.HttpEntity;
|
|
|
+import org.springframework.http.HttpHeaders;
|
|
|
+import org.springframework.http.MediaType;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
+import org.springframework.web.client.RestTemplate;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
@@ -185,6 +189,10 @@ public class AlarmEventServiceImpl implements AlarmEventService {
|
|
|
centereventTEventcatalogue.setIsUrged(SYS_ISURGE_2);//sys_isurge_2
|
|
|
centereventTEventcatalogue.setEventStatus("上报");
|
|
|
centereventTEventcatalogue.setEventStatusValue(FOREST_EVENT_STATUS_1);//forest_event_status_1
|
|
|
+ // 自动研判误报
|
|
|
+ if ("1".equals(centereventTEventcatalogue.getEventType())) {
|
|
|
+ test(centereventTEventcatalogue);
|
|
|
+ }
|
|
|
centereventTEventcatalogue.setCreateBy(centerdataTCamera.getId());
|
|
|
centereventTEventcatalogue.setCreateName(centerdataTCamera.getCameraName());
|
|
|
centereventTEventcatalogue.setCreateTime(null == createTime ? DateUtils.getNowDate() : createTime);
|
|
@@ -192,6 +200,34 @@ public class AlarmEventServiceImpl implements AlarmEventService {
|
|
|
return centereventTEventcatalogue;
|
|
|
}
|
|
|
|
|
|
+ private void test(CentereventTEventcatalogue centereventTEventcatalogue) {
|
|
|
+ HttpHeaders headers = new HttpHeaders();
|
|
|
+ headers.setContentType(MediaType.APPLICATION_JSON);
|
|
|
+ JSONObject requestBody = JSONObject.parseObject("{" +
|
|
|
+ "\"getFeatureMode\": \"SPATIAL\"," +
|
|
|
+ "\"datasetNames\": [\"chengchuanzhen:城川镇_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();
|
|
|
+ JSONObject result = restTemplate.postForEntity("http://192.168.1.14:8090/iserver/services/data-chengchunzhen/rest/data/featureResults.json?returnContent=true", entity, JSONObject.class).getBody();
|
|
|
+ // {"features":[],"featureUriList":[],"datasetInfos":[],"totalCount":0,"featureCount":0}
|
|
|
+ if (result.getLong("totalCount") == 0 && result.getLong("featureCount") == 0) {
|
|
|
+ centereventTEventcatalogue.setEventStatus("误报");
|
|
|
+ centereventTEventcatalogue.setEventStatusValue("forest_event_status_3");
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
// 事件部门
|
|
|
private void insertEventDept(CentereventTEventcatalogue centereventTEventcatalogue, List<CenterdataTAidevicedept> listDept) {
|
|
|
listDept.forEach(item -> {
|