Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
6e1cf8aafb | |||
36e9d31941 | |||
39ea504f16 |
32
pom.xml
32
pom.xml
@ -31,6 +31,8 @@
|
|||||||
<dysmsapi20170525.version>2.0.4</dysmsapi20170525.version>
|
<dysmsapi20170525.version>2.0.4</dysmsapi20170525.version>
|
||||||
<hutool-all.version>4.4.3</hutool-all.version>
|
<hutool-all.version>4.4.3</hutool-all.version>
|
||||||
<tus-client.version>0.4.0</tus-client.version>
|
<tus-client.version>0.4.0</tus-client.version>
|
||||||
|
<!-- ICCSDK版本 -->
|
||||||
|
<icc.sdk.version>1.0.9</icc.sdk.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
@ -199,6 +201,36 @@
|
|||||||
<artifactId>jedis</artifactId>
|
<artifactId>jedis</artifactId>
|
||||||
<version>3.7.0</version>
|
<version>3.7.0</version>
|
||||||
</dependency>
|
</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>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
@ -6,6 +6,7 @@ import org.springframework.jms.annotation.EnableJms;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 启动类
|
* 启动类
|
||||||
|
*
|
||||||
* @author XinYi Song
|
* @author XinYi Song
|
||||||
**/
|
**/
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
|
@ -3,15 +3,11 @@ package com.xkrs.controller;
|
|||||||
import com.xkrs.common.encapsulation.PromptMessageEnum;
|
import com.xkrs.common.encapsulation.PromptMessageEnum;
|
||||||
import com.xkrs.dao.EquipmentDao;
|
import com.xkrs.dao.EquipmentDao;
|
||||||
import com.xkrs.dao.FireDao;
|
import com.xkrs.dao.FireDao;
|
||||||
import com.xkrs.model.entity.Fire;
|
|
||||||
import com.xkrs.service.FireService;
|
import com.xkrs.service.FireService;
|
||||||
import com.xkrs.util.Query;
|
|
||||||
import org.springframework.cache.annotation.Cacheable;
|
|
||||||
import org.springframework.context.i18n.LocaleContextHolder;
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.transaction.Transactional;
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -40,6 +36,7 @@ public class FireController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据设备编号获取火情信息
|
* 根据设备编号获取火情信息
|
||||||
|
*
|
||||||
* @param code
|
* @param code
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -50,6 +47,7 @@ public class FireController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据设备编码和时间段查询火情信息
|
* 根据设备编码和时间段查询火情信息
|
||||||
|
*
|
||||||
* @param code
|
* @param code
|
||||||
* @param startTime
|
* @param startTime
|
||||||
* @param endTime
|
* @param endTime
|
||||||
@ -62,6 +60,7 @@ public class FireController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询最新的300条火情信息
|
* 查询最新的300条火情信息
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@GetMapping("/findThreeHundredData")
|
@GetMapping("/findThreeHundredData")
|
||||||
@ -71,6 +70,7 @@ public class FireController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询一个月中每一天各个街道的火情数量
|
* 查询一个月中每一天各个街道的火情数量
|
||||||
|
*
|
||||||
* @param beginTime
|
* @param beginTime
|
||||||
* @param endTime
|
* @param endTime
|
||||||
* @return
|
* @return
|
||||||
@ -86,6 +86,7 @@ public class FireController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询一年中每个月的各个街道的火情数量
|
* 查询一年中每个月的各个街道的火情数量
|
||||||
|
*
|
||||||
* @param beginTime
|
* @param beginTime
|
||||||
* @param endTime
|
* @param endTime
|
||||||
* @return
|
* @return
|
||||||
@ -101,6 +102,7 @@ public class FireController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改火点状态
|
* 修改火点状态
|
||||||
|
*
|
||||||
* @param map
|
* @param map
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -113,6 +115,7 @@ public class FireController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询已处理和未处理的火点的数量
|
* 查询已处理和未处理的火点的数量
|
||||||
|
*
|
||||||
* @param street
|
* @param street
|
||||||
* @param month
|
* @param month
|
||||||
* @return
|
* @return
|
||||||
@ -128,4 +131,5 @@ public class FireController {
|
|||||||
map.put("notProcessed", notprocessed);
|
map.put("notProcessed", notprocessed);
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, map, locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, map, locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
71
src/main/java/com/xkrs/controller/FireEventController.java
Normal file
71
src/main/java/com/xkrs/controller/FireEventController.java
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
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.service.FireEventService;
|
||||||
|
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 javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: XinYi Song
|
||||||
|
* @Date: 2022/2/11 9:03
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
public class FireEventController {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private FireEventService fireEventService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订阅火情事件
|
||||||
|
*/
|
||||||
|
@GetMapping("/subscribeFireEvent")
|
||||||
|
public void subscribeFireEvent() {
|
||||||
|
try {
|
||||||
|
//118.24.27.47:6820
|
||||||
|
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());
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接收火情事件
|
||||||
|
*/
|
||||||
|
@PostMapping("/receiveFireEvent")
|
||||||
|
public void receiveFireEvent(@RequestBody Object fireEvent) {
|
||||||
|
try {
|
||||||
|
System.out.println("----接收火情事件----{}------" + fireEvent.toString());
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询火情事件
|
||||||
|
*/
|
||||||
|
@GetMapping("/selectFireEvent")
|
||||||
|
public String selectFireEvent() {
|
||||||
|
return fireEventService.selectFireEventList();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
15
src/main/java/com/xkrs/dao/FireEventDao.java
Normal file
15
src/main/java/com/xkrs/dao/FireEventDao.java
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
package com.xkrs.dao;
|
||||||
|
|
||||||
|
import com.xkrs.model.entity.FireEvent;
|
||||||
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: XinYi Song
|
||||||
|
* @Date: 2022/2/8 17:12
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public interface FireEventDao extends JpaRepository<FireEvent, Long>, JpaSpecificationExecutor<FireEvent> {
|
||||||
|
|
||||||
|
}
|
23
src/main/java/com/xkrs/model/entity/FireEvent.java
Normal file
23
src/main/java/com/xkrs/model/entity/FireEvent.java
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
package com.xkrs.model.entity;
|
||||||
|
|
||||||
|
import javax.persistence.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 大华推送的火情事件
|
||||||
|
*/
|
||||||
|
@Entity
|
||||||
|
@Table(name = "fire_event")
|
||||||
|
public class FireEvent {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
@Id
|
||||||
|
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "fire_event_seq_gen")
|
||||||
|
@SequenceGenerator(name = "fire_event_seq_gen", sequenceName = "fire_event_id_seq", allocationSize = 1)
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@Column(length = 85, columnDefinition = "varchar(85)")
|
||||||
|
private String temp;
|
||||||
|
|
||||||
|
}
|
11
src/main/java/com/xkrs/service/FireEventService.java
Normal file
11
src/main/java/com/xkrs/service/FireEventService.java
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
package com.xkrs.service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Author: XinYi Song
|
||||||
|
* @Date: 2022/2/11 8:51
|
||||||
|
*/
|
||||||
|
public interface FireEventService {
|
||||||
|
|
||||||
|
String selectFireEventList();
|
||||||
|
|
||||||
|
}
|
@ -1,7 +1,5 @@
|
|||||||
package com.xkrs.service;
|
package com.xkrs.service;
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Author: XinYi Song
|
* @Author: XinYi Song
|
||||||
* @Date: 2022/2/11 8:51
|
* @Date: 2022/2/11 8:51
|
||||||
@ -10,6 +8,7 @@ public interface FireService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据设备编码获取火情信息
|
* 根据设备编码获取火情信息
|
||||||
|
*
|
||||||
* @param code
|
* @param code
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -17,6 +16,7 @@ public interface FireService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据设备编码和时间段查询火情信息
|
* 根据设备编码和时间段查询火情信息
|
||||||
|
*
|
||||||
* @param code
|
* @param code
|
||||||
* @param startTime
|
* @param startTime
|
||||||
* @param endTime
|
* @param endTime
|
||||||
@ -26,12 +26,14 @@ public interface FireService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询最新三百条火情信息
|
* 查询最新三百条火情信息
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
String findThreeHundredData();
|
String findThreeHundredData();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改火点状态
|
* 修改火点状态
|
||||||
|
*
|
||||||
* @param alarmCode
|
* @param alarmCode
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
@ -0,0 +1,30 @@
|
|||||||
|
package com.xkrs.service.impl;
|
||||||
|
|
||||||
|
import com.xkrs.common.encapsulation.PromptMessageEnum;
|
||||||
|
import com.xkrs.dao.FireEventDao;
|
||||||
|
import com.xkrs.model.entity.FireEvent;
|
||||||
|
import com.xkrs.service.FireEventService;
|
||||||
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class FireEventServiceImpl implements FireEventService {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private FireEventDao fireEventDao;
|
||||||
|
|
||||||
|
private Locale locale = LocaleContextHolder.getLocale();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String selectFireEventList() {
|
||||||
|
List<FireEvent> fireEventList = fireEventDao.findAll();
|
||||||
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, fireEventList, locale);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -34,9 +34,9 @@ public class FireServerImpl implements FireService {
|
|||||||
|
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据设备编码获取火情的信息
|
* 根据设备编码获取火情的信息
|
||||||
|
*
|
||||||
* @param code
|
* @param code
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@ -52,6 +52,7 @@ public class FireServerImpl implements FireService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据设备编码和时间段查询火情信息
|
* 根据设备编码和时间段查询火情信息
|
||||||
|
*
|
||||||
* @param code
|
* @param code
|
||||||
* @param startTime
|
* @param startTime
|
||||||
* @param endTime
|
* @param endTime
|
||||||
@ -69,6 +70,7 @@ public class FireServerImpl implements FireService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询最新300条火情信息
|
* 查询最新300条火情信息
|
||||||
|
*
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@Cacheable(keyGenerator = "keyGenerator", unless = "#result == null")
|
@Cacheable(keyGenerator = "keyGenerator", unless = "#result == null")
|
||||||
@ -84,6 +86,7 @@ public class FireServerImpl implements FireService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 修改火点状态
|
* 修改火点状态
|
||||||
|
*
|
||||||
* @param alarmCode
|
* @param alarmCode
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user