Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
acdaf4c3a4
34
pom.xml
34
pom.xml
@ -31,6 +31,8 @@
|
||||
<dysmsapi20170525.version>2.0.4</dysmsapi20170525.version>
|
||||
<hutool-all.version>4.4.3</hutool-all.version>
|
||||
<tus-client.version>0.4.0</tus-client.version>
|
||||
<!-- ICCSDK版本 -->
|
||||
<icc.sdk.version>1.0.9</icc.sdk.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
@ -190,7 +192,7 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-websocket</artifactId>
|
||||
<scope>provided</scope>
|
||||
<!-- <scope>provided</scope>-->
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/redis.clients/jedis -->
|
||||
@ -204,6 +206,36 @@
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>${hutool-all.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!-- ICC鉴权 -->
|
||||
<dependency>
|
||||
<groupId>com.dahuatech.icc</groupId>
|
||||
<artifactId>java-sdk-oauth</artifactId>
|
||||
<version>${icc.sdk.version}</version>
|
||||
</dependency>
|
||||
<!-- ICC基础资源SDK -->
|
||||
<dependency>
|
||||
<groupId>com.dahuatech.icc</groupId>
|
||||
<artifactId>java-sdk-brm</artifactId>
|
||||
<version>${icc.sdk.version}</version>
|
||||
</dependency>
|
||||
<!-- ICC 事件中心sdk -->
|
||||
<dependency>
|
||||
<groupId>com.dahuatech.icc</groupId>
|
||||
<artifactId>java-sdk-event</artifactId>
|
||||
<version>${icc.sdk.version}</version>
|
||||
</dependency>
|
||||
<!-- h8900sdk -->
|
||||
<dependency>
|
||||
<groupId>com.dahuatech.icc</groupId>
|
||||
<artifactId>java-sdk-h8900</artifactId>
|
||||
<version>${icc.sdk.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
78
src/main/java/com/xkrs/controller/FireEventController.java
Normal file
78
src/main/java/com/xkrs/controller/FireEventController.java
Normal file
@ -0,0 +1,78 @@
|
||||
package com.xkrs.controller;
|
||||
|
||||
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.xkrs.common.encapsulation.PromptMessageEnum;
|
||||
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.util.Locale;
|
||||
|
||||
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
||||
|
||||
|
||||
/**
|
||||
* ./start.sh
|
||||
* sudo tail -f nohup.out
|
||||
* /home/sxy/server/SmartUrbanRural
|
||||
*/
|
||||
@RestController
|
||||
public class FireEventController {
|
||||
|
||||
Locale locale = LocaleContextHolder.getLocale();
|
||||
|
||||
/**
|
||||
* 订阅火情事件
|
||||
*/
|
||||
@GetMapping("/subscribeFireEvent")
|
||||
public String subscribeFireEvent() {
|
||||
try {
|
||||
String host = "111.53.13.180:4433";
|
||||
String username = "system";
|
||||
String password = "Admin@123";
|
||||
String clientId = "xkrszhcx";
|
||||
String clientSecret = "eac429df-950a-4cba-aa50-76e47b0a74d8";
|
||||
System.out.println("----开始执行----{}------事件订阅");
|
||||
IClient iClient = new DefaultClient(host, username, password, clientId, clientSecret);
|
||||
EventSubscribeRequest subscribeRequest = new EventSubscribeRequest();
|
||||
// 接收事件地址
|
||||
String receiveUrl = "http://118.24.27.47:6820/receiveFireEvent";
|
||||
String mqinfo = "{\"param\":{\"monitors\":[{\"monitor\":\"" + receiveUrl + "\",\"monitorType\":\"url\",\"events\":[{\"category\":\"business\",\"subscribeAll\":1,\"domainSubscribe\":2,\"authorities\":[{}]},{\"category\":\"alarm\",\"subscribeAll\":1,\"domainSubscribe\":2,\"authorities\":[{}]},{\"category\":\"state\",\"subscribeAll\":1,\"domainSubscribe\":2,\"authorities\":[{}]}]}],\"subsystem\":{\"subsystemType\":0,\"name\":\"118.24.27.47_6820\",\"magic\":\"118.24.27.47_6820\"}}}";
|
||||
subscribeRequest.body(mqinfo);
|
||||
EventSubscribeResponse subscribeResponse = iClient.doAction(subscribeRequest, subscribeRequest.getResponseClass());
|
||||
System.out.println("----结束执行----{}------事件订阅" + subscribeResponse.toString());
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, subscribeResponse, locale);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "订阅火情事件失败", locale);
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收火情事件
|
||||
*/
|
||||
@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();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询火情事件
|
||||
*/
|
||||
@GetMapping("/selectFireEvent")
|
||||
public String selectFireEvent() {
|
||||
// return fireEventService.selectFireEventList();
|
||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "selectFireEvent", locale);
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user