接收火情事件
This commit is contained in:
parent
b5de1fc8f0
commit
af65dc23f5
@ -4,13 +4,17 @@ import com.dahuatech.icc.event.model.v202011.EventSubscribeRequest;
|
||||
import com.dahuatech.icc.event.model.v202011.EventSubscribeResponse;
|
||||
import com.dahuatech.icc.oauth.http.DefaultClient;
|
||||
import com.dahuatech.icc.oauth.http.IClient;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.xkrs.common.encapsulation.PromptMessageEnum;
|
||||
import org.apache.http.util.TextUtils;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Locale;
|
||||
|
||||
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
||||
@ -57,13 +61,30 @@ public class FireEventController {
|
||||
* 接收火情事件
|
||||
*/
|
||||
@PostMapping("/receiveFireEvent")
|
||||
public void receiveFireEvent(@RequestBody Object fireEvent) {
|
||||
try {
|
||||
String message = outputEncapsulationObject(PromptMessageEnum.SUCCESS, fireEvent, locale);
|
||||
System.out.println("----接收火情事件----123" + message);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
public void receiveFireEvent(@RequestBody String message) throws IOException {
|
||||
JsonNode jsonNode = new ObjectMapper().readTree(message);
|
||||
|
||||
String category = jsonNode.get("category").asText();
|
||||
String method = jsonNode.get("method").asText();
|
||||
String subsystem = jsonNode.get("subsystem").asText();
|
||||
String info = jsonNode.get("info").asText();
|
||||
boolean fireEventForCategory = (!TextUtils.isEmpty(category)) && "alarm".equals(category);
|
||||
boolean fireEventForMethod = (!TextUtils.isEmpty(method)) && "alarm.msg".equals(method);
|
||||
boolean fireEventForSubsystem = (!TextUtils.isEmpty(subsystem)) && "admin".equals(subsystem);
|
||||
boolean hasInfo = true;
|
||||
//火情事件
|
||||
if (fireEventForCategory && fireEventForMethod && fireEventForSubsystem && hasInfo) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean firePictureForCategory = (!TextUtils.isEmpty(category)) && "business".equals(category);
|
||||
boolean firePictureForMethod = (!TextUtils.isEmpty(method)) && "vms.notifyAlarmPicture".equals(method);
|
||||
boolean firePictureForSubsystem = (!TextUtils.isEmpty(subsystem)) && "admin".equals(subsystem);
|
||||
//火情图片
|
||||
if (firePictureForCategory && firePictureForMethod && firePictureForSubsystem && hasInfo) {
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@ -71,7 +92,6 @@ public class FireEventController {
|
||||
*/
|
||||
@GetMapping("/selectFireEvent")
|
||||
public String selectFireEvent() {
|
||||
// return fireEventService.selectFireEventList();
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "selectFireEvent", locale);
|
||||
}
|
||||
|
||||
|
127
src/main/java/com/xkrs/controller/Temp.java
Normal file
127
src/main/java/com/xkrs/controller/Temp.java
Normal file
@ -0,0 +1,127 @@
|
||||
package com.xkrs.controller;
|
||||
|
||||
public class Temp {
|
||||
|
||||
|
||||
/**
|
||||
* {
|
||||
* "id":null,
|
||||
* "category":"alarm",
|
||||
* "method":"alarm.msg",
|
||||
* "info":{
|
||||
* "orgName":"热成像云台",
|
||||
* "nodeCode":"1000042$1$0$1",
|
||||
* "deviceCode":"1000042",
|
||||
* "alarmCode":"{6E750E9B-9DB4-9C42-983F-B5117E2B8F67}",
|
||||
* "alarmPicture":"",
|
||||
* "nodeType":2,
|
||||
* "deviceName":"固定桥村北",
|
||||
* "alarmDate":"1646471854",
|
||||
* "alarmGrade":2,
|
||||
* "isSave":true,
|
||||
* "unitType":1,
|
||||
* "unitSeq":0,
|
||||
* "extend":{
|
||||
* "params":[
|
||||
* {
|
||||
* "fTemperature":0,
|
||||
* "nDistance":1000,
|
||||
* "nThermoHFOV":520,
|
||||
* "nPresetId":1,
|
||||
* "stuBoundingBox":{
|
||||
* "nTop":4096,
|
||||
* "nBottom":4369,
|
||||
* "nLeft":3686,
|
||||
* "nRight":3891
|
||||
* },
|
||||
* "stuFiringGPS":{
|
||||
* "dbAltitude":0,
|
||||
* "dwLatidude":0,
|
||||
* "dwLongitude":0
|
||||
* },
|
||||
* "nThermoVFOV":390,
|
||||
* "stuPTZPosition":{
|
||||
* "nPositionX":2123,
|
||||
* "nPositionY":2,
|
||||
* "nZoom":1
|
||||
* },
|
||||
* "nTemperatureUnit":1,
|
||||
* "fsid":2267,
|
||||
* "fAltitude":150,
|
||||
* "GPS_POINT":{
|
||||
* "dwLatidude":39.873801,
|
||||
* "dwLongitude":113.49956299999999
|
||||
* }
|
||||
* },
|
||||
* {
|
||||
* "fTemperature":0,
|
||||
* "nDistance":1000,
|
||||
* "nThermoHFOV":520,
|
||||
* "nPresetId":1,
|
||||
* "stuBoundingBox":{
|
||||
* "nTop":5188,
|
||||
* "nBottom":5461,
|
||||
* "nLeft":1433,
|
||||
* "nRight":2457
|
||||
* },
|
||||
* "stuFiringGPS":{
|
||||
* "dbAltitude":0,
|
||||
* "dwLatidude":0,
|
||||
* "dwLongitude":0
|
||||
* },
|
||||
* "nThermoVFOV":390,
|
||||
* "stuPTZPosition":{
|
||||
* "nPositionX":2123,
|
||||
* "nPositionY":2,
|
||||
* "nZoom":1
|
||||
* },
|
||||
* "nTemperatureUnit":1,
|
||||
* "fsid":2267,
|
||||
* "fAltitude":150,
|
||||
* "GPS_POINT":{
|
||||
* "dwLatidude":39.873801,
|
||||
* "dwLongitude":113.49956299999999
|
||||
* }
|
||||
* }
|
||||
* ]
|
||||
* },
|
||||
* "alarmType":5122,
|
||||
* "linkIds":"598970c2f97a422fbfeae77d02ffc8a5",
|
||||
* "channelSeq":1,
|
||||
* "orgCode":"001001",
|
||||
* "channelName":"固定桥村北热成像",
|
||||
* "alarmStat":1,
|
||||
* "isEvent":false
|
||||
* },
|
||||
* "subsystem":"admin",
|
||||
* "userIds":null,
|
||||
* "sid":null,
|
||||
* "domainId":null,
|
||||
* "infoArray":null,
|
||||
* "protocol":null
|
||||
* }
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* {
|
||||
* "id":null,
|
||||
* "category":"business",
|
||||
* "method":"vms.notifyAlarmPicture",
|
||||
* "info":{
|
||||
* "chnName":"施家会村可见光",
|
||||
* "pictureSize":"",
|
||||
* "alarmCode":"{B73E8BD6-60A5-D549-80B8-B03FDB68C76F}",
|
||||
* "alarmDate":"1646471804",
|
||||
* "picture":"d7e12fe8-938d-11ec-9713-00ddb6910ecd/20220305/1/dsf_4d9cb367-9c5f-11ec-8e91-00ddb6910ecd_28749380_29339566.jpg"
|
||||
* },
|
||||
* "subsystem":"admin",
|
||||
* "userIds":null,
|
||||
* "sid":null,
|
||||
* "domainId":null,
|
||||
* "infoArray":null,
|
||||
* "protocol":null
|
||||
* }
|
||||
*/
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user