Compare commits

..

7 Commits

Author SHA1 Message Date
7812cd3a73 Default Changelist 2022-03-05 18:03:09 +08:00
af65dc23f5 接收火情事件 2022-03-05 17:59:05 +08:00
b5de1fc8f0 Default Changelist 2022-03-05 17:56:39 +08:00
acdaf4c3a4 Merge remote-tracking branch 'origin/master' 2022-03-05 17:56:26 +08:00
50cefb8ef0 添加火情事件模块 2022-03-05 17:07:34 +08:00
e727446553 Default Changelist 2022-03-05 14:15:10 +08:00
8f889ef4e8 Default Changelist 2022-03-05 14:11:13 +08:00
21 changed files with 1267 additions and 357 deletions

View File

@ -192,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 -->
@ -201,6 +201,11 @@
<artifactId>jedis</artifactId>
<version>3.7.0</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>${hutool-all.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>

View File

@ -1,12 +1,21 @@
package com.xkrs;
import com.alibaba.fastjson.JSON;
import com.xkrs.model.vo.ADD;
import com.xkrs.model.vo.DA;
import com.xkrs.service.CameraService;
import com.xkrs.service.impl.CameraServiceImpl;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.jms.annotation.EnableJms;
import javax.annotation.Resource;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
/**
* 启动类
*
* @author XinYi Song
**/
@SpringBootApplication
@ -15,6 +24,7 @@ import org.springframework.jms.annotation.EnableJms;
public class SmartUrbanRuralApplication {
public static void main(String[] args) {
SpringApplication.run(SmartUrbanRuralApplication.class, args);
}

View File

@ -1,9 +1,12 @@
package com.xkrs.controller;
import com.alibaba.fastjson.JSON;
import com.xkrs.dao.CameraDao;
import com.xkrs.dao.DeviceManagementDao;
import com.xkrs.model.entity.CameraInformation;
import com.xkrs.model.entity.DeviceManagement;
import com.xkrs.model.vo.ADD;
import com.xkrs.model.vo.DA;
import com.xkrs.service.CameraService;
import com.xkrs.service.FireService;
import org.springframework.web.bind.annotation.GetMapping;
@ -11,6 +14,8 @@ import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.io.*;
import java.util.ArrayList;
import java.util.List;
/**
@ -28,6 +33,7 @@ public class CameraController {
@Resource
private DeviceManagementDao deviceManagementDao;
@GetMapping("/getCameraInformation")
public List<CameraInformation> getCameraInformation(){
@ -44,12 +50,85 @@ public class CameraController {
return false;
}
}
@GetMapping("/SelectDeviceManagement")
public List<DeviceManagement> SelectDeviceManagement()
/**
* 返回全部信息
* @param
* @return
*/
@GetMapping("/findEquipment1")
public String Selectequipment(){
try
{
return cameraService.SelectDevice();
return cameraService.Selectequipment();
}
catch (Exception E)
{
return E.getMessage();
}
}
/**
* 查询实时视频连接
* @return
*/
@GetMapping("/findVideoPath1")
public String selectVideotape(){
try {
return cameraService.Videotape();
}
catch (Exception e){
return e.getMessage();
}
}
/**
* 添加设备信息
* @return
*/
@GetMapping("/SelectDeviceManagement")
public String SelectDeviceManagement()
{
File file = new File("C:\\Users\\HP\\Desktop\\摄像头设备信息.txt");
try {
BufferedReader br=new BufferedReader(new FileReader(file));
String contnetTotal="";
String s;
while (( s=br.readLine())!=null){
contnetTotal+=s;
}
br.close();
DA tempBran = JSON.parseObject(contnetTotal, DA.class);
List<DA.DataDTO.PageDataDTO> pageData = tempBran.getData().getPageData();
for (DA.DataDTO.PageDataDTO item: pageData) {
DeviceManagement add=new DeviceManagement();
add.setDeviceName(item.getDeviceName());
add.setDeviceCode(item.getDeviceCode());
add.setDeviceSn(item.getDeviceSn());
add.setDeviceCategory(item.getDeviceCategory());
add.setDeviceManufacturer(item.getDeviceManufacturer());
add.setDeviceType(item.getDeviceType());
add.setDeviceModel(item.getDeviceModel());
add.setDeviceIp(item.getDeviceIp());
add.setDevicePort(item.getDevicePort());
add.setOwnerCode(item.getOwnerCode());
add.setLiveVideo("http://111.53.13.180:7086/live/cameraid/"+item.getDeviceCode()+ "%240/substream/1.m3u8");
add.setIsOnline(item.getIsOnline());
add.setUpdateTime(item.getOnlineUpdateTime());
deviceManagementDao.save(add);
}
System.out.println("111");
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return "1";
}
}

View File

@ -3,11 +3,15 @@ package com.xkrs.controller;
import com.xkrs.common.encapsulation.PromptMessageEnum;
import com.xkrs.dao.EquipmentDao;
import com.xkrs.dao.FireDao;
import com.xkrs.model.entity.Fire;
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.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.transaction.Transactional;
import java.math.BigInteger;
import java.util.HashMap;
import java.util.List;
@ -36,7 +40,6 @@ public class FireController {
/**
* 根据设备编号获取火情信息
*
* @param code
* @return
*/
@ -47,7 +50,6 @@ public class FireController {
/**
* 根据设备编码和时间段查询火情信息
*
* @param code
* @param startTime
* @param endTime
@ -60,7 +62,6 @@ public class FireController {
/**
* 查询最新的300条火情信息
*
* @return
*/
@GetMapping("/findThreeHundredData")
@ -70,7 +71,6 @@ public class FireController {
/**
* 查询一个月中每一天各个街道的火情数量
*
* @param beginTime
* @param endTime
* @return
@ -86,7 +86,6 @@ public class FireController {
/**
* 查询一年中每个月的各个街道的火情数量
*
* @param beginTime
* @param endTime
* @return
@ -102,7 +101,6 @@ public class FireController {
/**
* 修改火点状态
*
* @param map
* @return
*/
@ -115,7 +113,6 @@ public class FireController {
/**
* 查询已处理和未处理的火点的数量
*
* @param street
* @param month
* @return
@ -131,5 +128,4 @@ public class FireController {
map.put("notProcessed",notprocessed);
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,map,locale);
}
}

View File

@ -4,31 +4,38 @@ 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 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 javax.annotation.Resource;
import java.io.IOException;
import java.util.Locale;
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
/**
* @Author: XinYi Song
* @Date: 2022/2/11 9:03
* ./start.sh
* sudo tail -f nohup.out
* /home/sxy/server/SmartUrbanRural
*/
@RestController
public class FireEventController {
@Resource
private FireEventService fireEventService;
Locale locale = LocaleContextHolder.getLocale();
/**
* 订阅火情事件
*/
@GetMapping("/subscribeFireEvent")
public void subscribeFireEvent() {
public String subscribeFireEvent() {
try {
//118.24.27.47:6820
String host = "111.53.13.180:4433";
String username = "system";
String password = "Admin@123";
@ -43,21 +50,41 @@ public class FireEventController {
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 {
System.out.println("----接收火情事件----{}------" + fireEvent.toString());
} 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;
}
}
/**
@ -65,7 +92,7 @@ public class FireEventController {
*/
@GetMapping("/selectFireEvent")
public String selectFireEvent() {
return fireEventService.selectFireEventList();
return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "selectFireEvent", locale);
}
}

View 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
* }
*/
}

View File

@ -20,10 +20,7 @@ import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.transaction.Transactional;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.*;
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
@ -134,35 +131,39 @@ public class TestController {
* @return
*/
@GetMapping("/getPaging")
public boolean getPaging( String para) {
public String getPaging( String para) {
String forecastWeather = ManagementUtil.getPaging(para);
List<Map<String, String>> listObjectFir = (List<Map<String, String>>) JSONArray.parse(forecastWeather);
ObjectMapper objectMapper = new ObjectMapper();
JsonNode jsonNode = null;
try {
jsonNode = objectMapper.readTree(forecastWeather);
} catch (JsonProcessingException e) {
e.printStackTrace();
}
String method = jsonNode.get("method").asText();
if("vms.alarm.msg".equals(method)){
JsonNode info = jsonNode.get("info");
DeviceManagement fire = new DeviceManagement();
fire.setDeviceName(info.get("deviceName").asText());
fire.setDeviceCode(info.get("deviceCode").asText());
fire.setDeviceSn(info.get("deviceSn").asText());
fire.setDeviceCategory(Integer.valueOf(info.get("deviceCategory").asText()));
fire.setDeviceType(Integer.valueOf(info.get("deviceType").asText()));
fire.setDeviceManufacturer(info.get("deviceManufacturer").asText());
fire.setDeviceModel(info.get("deviceModel").asText());
fire.setDeviceIp(info.get("deviceIp").asText());
fire.setDevicePort(Integer.valueOf(info.get("devicePort").asText()));
fire.setOwnerCode(info.get("ownerCode").asText());
//fire.setOwnerOrgName(Integer.valueOf(info.get("ownerOrgName").asText()));
fire.setIsOnline(Integer.valueOf(info.get("isOnline").asText()));
fire.setSubSystem(info.get("subSystem").asText());
fire.setDevExt(info.get("devExt").asText());
}
return true;
// List<Map<String, String>> listObjectFir = (List<Map<String, String>>) JSONArray.parse(forecastWeather);
// ObjectMapper objectMapper = new ObjectMapper();
// JsonNode jsonNode = null;
// try {
// jsonNode = objectMapper.readTree(forecastWeather);
// } catch (JsonProcessingException e) {
// e.printStackTrace();
// }
// List<DeviceManagement> item= new ArrayList<>();
// String method = jsonNode.get("method").asText();
// if("vms.alarm.msg".equals(method)){
// JsonNode info = jsonNode.get("info");
// DeviceManagement fire = new DeviceManagement();
// fire.setDeviceName(info.get("deviceName").asText());
// fire.setDeviceCode(info.get("deviceCode").asText());
// fire.setDeviceSn(info.get("deviceSn").asText());
// fire.setDeviceCategory(Integer.valueOf(info.get("deviceCategory").asText()));
// fire.setDeviceType(Integer.valueOf(info.get("deviceType").asText()));
// fire.setDeviceManufacturer(info.get("deviceManufacturer").asText());
// fire.setDeviceModel(info.get("deviceModel").asText());
// fire.setDeviceIp(info.get("deviceIp").asText());
// fire.setDevicePort(Integer.valueOf(info.get("devicePort").asText()));
// fire.setOwnerCode(info.get("ownerCode").asText());
// //fire.setOwnerOrgName(Integer.valueOf(info.get("ownerOrgName").asText()));
//// fire.setIsOnline(Integer.valueOf(info.get("isOnline").asText()));
//// fire.setSubSystem(info.get("subSystem").asText());
//// fire.setDevExt(info.get("devExt").asText());
// item.add(fire);
// }
return forecastWeather;
}
}

View File

@ -2,10 +2,13 @@ package com.xkrs.dao;
import com.xkrs.model.entity.CameraInformation;
import com.xkrs.model.entity.DeviceManagement;
import com.xkrs.model.vo.ADD;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
import java.util.Locale;
import java.util.Map;
/**
@ -14,11 +17,16 @@ import java.util.Map;
*/
public interface DeviceManagementDao extends JpaRepository<DeviceManagement,Long> {
/**
* 添加设备分页信息
*/
@Query(value = "Insert device_management('','','','','','','','','','','','','','','','','') " +
"VALUES('?1','?2','?3','?4','?5','?6','?7','?8','?9','?10','?11','?12','?13','?14','?15');",nativeQuery = true)
List<Map<String,Object>> selectDeviceManagement(DeviceManagement deviceManagement);
/**
* 查询视频连接
*/
@Query(value = "SELECT device_code,live_video FROM device_management",nativeQuery = true)
List<Map<String,String>> Videotape();
/**
* 查询全部设备信息
*/
@Query(value = "SELECT * FROM device_management",nativeQuery = true)
List<Map<String,String>> equipment();
}

View File

@ -1,15 +0,0 @@
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> {
}

View File

@ -7,7 +7,7 @@ import javax.persistence.*;
* @Date: 2022/3/4 8:23
*/
@Entity
@Table(name = "DeviceManagement")
@Table(name = "device_management")
public class DeviceManagement {
/**
* 主键id
@ -66,76 +66,88 @@ public class DeviceManagement {
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String ownerCode;
/**
* 添加方式
* 设备端口
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String loginType;
private String updateTime;
/**
* 登录名称
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String loginName;
/**
* 登录密码
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String loginPassword;
/**
* 主动注册代理端口
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private int registProxyPort;
/**
* 主动注册服务器编码
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String registDeviceCode;
/**
* 通道描述
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String memo;
/**
* 在线状态
* 设备所属组织
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private int isOnline;
/**
* 光栅图
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private long mapId;
/**
* 经度
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String gpsX;
/**
* 纬度
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String gpsY;
/**
* 设备所属子系统
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String subSystem;
/**
* 设备扩展属性
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String devExt;
/**
* 通道序号
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String channelSeq;
/**
*通道名称
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String channelName;
// /**
// * 添加方式
// */
// @Column(length = 32, columnDefinition = "varchar(32)")
// private String loginType;
// /**
// * 登录名称
// */
// @Column(length = 32, columnDefinition = "varchar(32)")
// private String loginName;
// /**
// * 登录密码
// */
// @Column(length = 32, columnDefinition = "varchar(32)")
// private String loginPassword;
// /**
// * 主动注册代理端口
// */
// @Column(length = 32, columnDefinition = "varchar(32)")
// private int registProxyPort;
// /**
// * 主动注册服务器编码
// */
// @Column(length = 32, columnDefinition = "varchar(32)")
// private String registDeviceCode;
// /**
// * 通道描述
// */
// @Column(length = 32, columnDefinition = "varchar(32)")
// private String memo;
// /**
// * 在线状态
// */
// @Column(length = 32, columnDefinition = "varchar(32)")
// private int isOnline;
// /**
// * 光栅图
// */
// @Column(length = 32, columnDefinition = "varchar(32)")
// private long mapId;
// /**
// * 经度
// */
// @Column(length = 32, columnDefinition = "varchar(32)")
// private String gpsX;
// /**
// * 纬度
// */
// @Column(length = 32, columnDefinition = "varchar(32)")
// private String gpsY;
// /**
// * 设备所属子系统
// */
// @Column(length = 32, columnDefinition = "varchar(32)")
// private String subSystem;
// /**
// * 设备扩展属性
// */
// @Column(length = 32, columnDefinition = "varchar(32)")
// private String devExt;
// /**
// * 通道序号
// */
// @Column(length = 32, columnDefinition = "varchar(32)")
// private String channelSeq;
// /**
// *通道名称
// */
// @Column(length = 32, columnDefinition = "varchar(32)")
// private String channelName;
/**
* 实时视频
*/
@ -230,52 +242,116 @@ public class DeviceManagement {
this.ownerCode = ownerCode;
}
public String getLoginType() {
return loginType;
// public String getLoginType() {
// return loginType;
// }
//
// public void setLoginType(String loginType) {
// this.loginType = loginType;
// }
//
// public String getLoginName() {
// return loginName;
// }
//
// public void setLoginName(String loginName) {
// this.loginName = loginName;
// }
//
// public String getLoginPassword() {
// return loginPassword;
// }
//
// public void setLoginPassword(String loginPassword) {
// this.loginPassword = loginPassword;
// }
//
// public int getRegistProxyPort() {
// return registProxyPort;
// }
//
// public void setRegistProxyPort(int registProxyPort) {
// this.registProxyPort = registProxyPort;
// }
//
// public String getRegistDeviceCode() {
// return registDeviceCode;
// }
//
// public void setRegistDeviceCode(String registDeviceCode) {
// this.registDeviceCode = registDeviceCode;
// }
//
// public String getMemo() {
// return memo;
// }
//
// public void setMemo(String memo) {
// this.memo = memo;
// }
//
// public int getIsOnline() {
// return isOnline;
// }
//
// public void setIsOnline(int isOnline) {
// this.isOnline = isOnline;
// }
//
// public long getMapId() {
// return mapId;
// }
//
// public void setMapId(long mapId) {
// this.mapId = mapId;
// }
//
// public String getGpsX() {
// return gpsX;
// }
//
// public void setGpsX(String gpsX) {
// this.gpsX = gpsX;
// }
//
// public String getGpsY() {
// return gpsY;
// }
//
// public void setGpsY(String gpsY) {
// this.gpsY = gpsY;
// }
//
// public String getSubSystem() {
// return subSystem;
// }
//
// public void setSubSystem(String subSystem) {
// this.subSystem = subSystem;
// }
//
// public String getDevExt() {
// return devExt;
// }
//
// public void setDevExt(String devExt) {
// this.devExt = devExt;
// }
public String getLiveVideo() {
return liveVideo;
}
public void setLoginType(String loginType) {
this.loginType = loginType;
public void setLiveVideo(String liveVideo) {
this.liveVideo = liveVideo;
}
public String getLoginName() {
return loginName;
public String getUpdateTime() {
return updateTime;
}
public void setLoginName(String loginName) {
this.loginName = loginName;
}
public String getLoginPassword() {
return loginPassword;
}
public void setLoginPassword(String loginPassword) {
this.loginPassword = loginPassword;
}
public int getRegistProxyPort() {
return registProxyPort;
}
public void setRegistProxyPort(int registProxyPort) {
this.registProxyPort = registProxyPort;
}
public String getRegistDeviceCode() {
return registDeviceCode;
}
public void setRegistDeviceCode(String registDeviceCode) {
this.registDeviceCode = registDeviceCode;
}
public String getMemo() {
return memo;
}
public void setMemo(String memo) {
this.memo = memo;
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
public int getIsOnline() {
@ -285,44 +361,4 @@ public class DeviceManagement {
public void setIsOnline(int isOnline) {
this.isOnline = isOnline;
}
public long getMapId() {
return mapId;
}
public void setMapId(long mapId) {
this.mapId = mapId;
}
public String getGpsX() {
return gpsX;
}
public void setGpsX(String gpsX) {
this.gpsX = gpsX;
}
public String getGpsY() {
return gpsY;
}
public void setGpsY(String gpsY) {
this.gpsY = gpsY;
}
public String getSubSystem() {
return subSystem;
}
public void setSubSystem(String subSystem) {
this.subSystem = subSystem;
}
public String getDevExt() {
return devExt;
}
public void setDevExt(String devExt) {
this.devExt = devExt;
}
}

View File

@ -1,23 +0,0 @@
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;
}

View File

@ -0,0 +1,18 @@
package com.xkrs.model.vo;
/**
* @Author: XinYi Song
* @Date: 2022/3/4 21:30
*/
public class ADD {
public String deviceName;
public String deviCevode;
public String deviceSn;
public int deviceCategory;
public int deviceType;
public String deviceManufacture;
public String deviceModel;
public String deviceLp;
public int devicePort;
public String ownerCode;
}

View File

@ -0,0 +1,613 @@
package com.xkrs.model.vo;
import java.util.List;
/**
* @Author: XinYi Song
* @Date: 2022/3/4 21:31
*/
public class DA {
private Boolean success;
private DataDTO data;
private String code;
private String errMsg;
public Boolean getSuccess() {
return success;
}
public void setSuccess(Boolean success) {
this.success = success;
}
public DataDTO getData() {
return data;
}
public void setData(DataDTO data) {
this.data = data;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getErrMsg() {
return errMsg;
}
public void setErrMsg(String errMsg) {
this.errMsg = errMsg;
}
public static class DataDTO {
private List<PageDataDTO> pageData;
private Integer currentPage;
private Integer totalPage;
private Integer pageSize;
private Integer totalRows;
public List<PageDataDTO> getPageData() {
return pageData;
}
public void setPageData(List<PageDataDTO> pageData) {
this.pageData = pageData;
}
public Integer getCurrentPage() {
return currentPage;
}
public void setCurrentPage(Integer currentPage) {
this.currentPage = currentPage;
}
public Integer getTotalPage() {
return totalPage;
}
public void setTotalPage(Integer totalPage) {
this.totalPage = totalPage;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public Integer getTotalRows() {
return totalRows;
}
public void setTotalRows(Integer totalRows) {
this.totalRows = totalRows;
}
public static class PageDataDTO {
private String deviceName;
private String deviceCode;
private String deviceSn;
private Integer deviceCategory;
private Integer deviceType;
private String deviceManufacturer;
private String protocol;
private String deviceModel;
private String deviceIp;
private Integer devicePort;
private String ownerCode;
private String loginType;
private String loginName;
private String loginPassword;
private Boolean isPwdChange;
private String registServerCode;
private Integer isOnline;
private String onlineUpdateTime;
private Integer onlineUpdateVersion;
private String offlineReason;
private Integer isVirtual;
private String subSystem;
private DataDTO.PageDataDTO.DevExtDTO devExt;
private List<UnitsDTO> units;
private String updateTime;
private String deviceMac;
private Integer registProxyPort;
private String registDeviceCode;
public String getDeviceName() {
return deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getDeviceCode() {
return deviceCode;
}
public void setDeviceCode(String deviceCode) {
this.deviceCode = deviceCode;
}
public String getDeviceSn() {
return deviceSn;
}
public void setDeviceSn(String deviceSn) {
this.deviceSn = deviceSn;
}
public Integer getDeviceCategory() {
return deviceCategory;
}
public void setDeviceCategory(Integer deviceCategory) {
this.deviceCategory = deviceCategory;
}
public Integer getDeviceType() {
return deviceType;
}
public void setDeviceType(Integer deviceType) {
this.deviceType = deviceType;
}
public String getDeviceManufacturer() {
return deviceManufacturer;
}
public void setDeviceManufacturer(String deviceManufacturer) {
this.deviceManufacturer = deviceManufacturer;
}
public String getProtocol() {
return protocol;
}
public void setProtocol(String protocol) {
this.protocol = protocol;
}
public String getDeviceModel() {
return deviceModel;
}
public void setDeviceModel(String deviceModel) {
this.deviceModel = deviceModel;
}
public String getDeviceIp() {
return deviceIp;
}
public void setDeviceIp(String deviceIp) {
this.deviceIp = deviceIp;
}
public Integer getDevicePort() {
return devicePort;
}
public void setDevicePort(Integer devicePort) {
this.devicePort = devicePort;
}
public String getOwnerCode() {
return ownerCode;
}
public void setOwnerCode(String ownerCode) {
this.ownerCode = ownerCode;
}
public String getLoginType() {
return loginType;
}
public void setLoginType(String loginType) {
this.loginType = loginType;
}
public String getLoginName() {
return loginName;
}
public void setLoginName(String loginName) {
this.loginName = loginName;
}
public String getLoginPassword() {
return loginPassword;
}
public void setLoginPassword(String loginPassword) {
this.loginPassword = loginPassword;
}
public Boolean getPwdChange() {
return isPwdChange;
}
public void setPwdChange(Boolean pwdChange) {
isPwdChange = pwdChange;
}
public String getRegistServerCode() {
return registServerCode;
}
public void setRegistServerCode(String registServerCode) {
this.registServerCode = registServerCode;
}
public Integer getIsOnline() {
return isOnline;
}
public void setIsOnline(Integer isOnline) {
this.isOnline = isOnline;
}
public String getOnlineUpdateTime() {
return onlineUpdateTime;
}
public void setOnlineUpdateTime(String onlineUpdateTime) {
this.onlineUpdateTime = onlineUpdateTime;
}
public Integer getOnlineUpdateVersion() {
return onlineUpdateVersion;
}
public void setOnlineUpdateVersion(Integer onlineUpdateVersion) {
this.onlineUpdateVersion = onlineUpdateVersion;
}
public String getOfflineReason() {
return offlineReason;
}
public void setOfflineReason(String offlineReason) {
this.offlineReason = offlineReason;
}
public Integer getIsVirtual() {
return isVirtual;
}
public void setIsVirtual(Integer isVirtual) {
this.isVirtual = isVirtual;
}
public String getSubSystem() {
return subSystem;
}
public void setSubSystem(String subSystem) {
this.subSystem = subSystem;
}
public DevExtDTO getDevExt() {
return devExt;
}
public void setDevExt(DevExtDTO devExt) {
this.devExt = devExt;
}
public List<UnitsDTO> getUnits() {
return units;
}
public void setUnits(List<UnitsDTO> units) {
this.units = units;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
public String getDeviceMac() {
return deviceMac;
}
public void setDeviceMac(String deviceMac) {
this.deviceMac = deviceMac;
}
public Integer getRegistProxyPort() {
return registProxyPort;
}
public void setRegistProxyPort(Integer registProxyPort) {
this.registProxyPort = registProxyPort;
}
public String getRegistDeviceCode() {
return registDeviceCode;
}
public void setRegistDeviceCode(String registDeviceCode) {
this.registDeviceCode = registDeviceCode;
}
public static class DevExtDTO {
private String pictureServerCode;
private String videoServerCode;
public String getPictureServerCode() {
return pictureServerCode;
}
public void setPictureServerCode(String pictureServerCode) {
this.pictureServerCode = pictureServerCode;
}
public String getVideoServerCode() {
return videoServerCode;
}
public void setVideoServerCode(String videoServerCode) {
this.videoServerCode = videoServerCode;
}
}
public static class UnitsDTO {
private Integer unitType;
private Integer unitSeq;
private DataDTO.PageDataDTO.UnitsDTO.UnitExtDTO unitExt;
private List<ChannelsDTO> channels;
public Integer getUnitType() {
return unitType;
}
public void setUnitType(Integer unitType) {
this.unitType = unitType;
}
public Integer getUnitSeq() {
return unitSeq;
}
public void setUnitSeq(Integer unitSeq) {
this.unitSeq = unitSeq;
}
public UnitExtDTO getUnitExt() {
return unitExt;
}
public void setUnitExt(UnitExtDTO unitExt) {
this.unitExt = unitExt;
}
public List<ChannelsDTO> getChannels() {
return channels;
}
public void setChannels(List<ChannelsDTO> channels) {
this.channels = channels;
}
public static class UnitExtDTO {
private String streamType;
private Integer zeroChnEncode;
private Integer assistStream;
public String getStreamType() {
return streamType;
}
public void setStreamType(String streamType) {
this.streamType = streamType;
}
public Integer getZeroChnEncode() {
return zeroChnEncode;
}
public void setZeroChnEncode(Integer zeroChnEncode) {
this.zeroChnEncode = zeroChnEncode;
}
public Integer getAssistStream() {
return assistStream;
}
public void setAssistStream(Integer assistStream) {
this.assistStream = assistStream;
}
}
public static class ChannelsDTO {
private String channelName;
private Integer channelSeq;
private String channelType;
private String cameraType;
private String capability;
private String ownerCode;
private String channelCode;
private Integer stat;
private Integer isOnline;
private String onlineUpdateTime;
private Integer onlineUpdateVersion;
private DataDTO.PageDataDTO.UnitsDTO.ChannelsDTO.ChExtDTO chExt;
private Integer isVirtual;
public String getChannelName() {
return channelName;
}
public void setChannelName(String channelName) {
this.channelName = channelName;
}
public Integer getChannelSeq() {
return channelSeq;
}
public void setChannelSeq(Integer channelSeq) {
this.channelSeq = channelSeq;
}
public String getChannelType() {
return channelType;
}
public void setChannelType(String channelType) {
this.channelType = channelType;
}
public String getCameraType() {
return cameraType;
}
public void setCameraType(String cameraType) {
this.cameraType = cameraType;
}
public String getCapability() {
return capability;
}
public void setCapability(String capability) {
this.capability = capability;
}
public String getOwnerCode() {
return ownerCode;
}
public void setOwnerCode(String ownerCode) {
this.ownerCode = ownerCode;
}
public String getChannelCode() {
return channelCode;
}
public void setChannelCode(String channelCode) {
this.channelCode = channelCode;
}
public Integer getStat() {
return stat;
}
public void setStat(Integer stat) {
this.stat = stat;
}
public Integer getIsOnline() {
return isOnline;
}
public void setIsOnline(Integer isOnline) {
this.isOnline = isOnline;
}
public String getOnlineUpdateTime() {
return onlineUpdateTime;
}
public void setOnlineUpdateTime(String onlineUpdateTime) {
this.onlineUpdateTime = onlineUpdateTime;
}
public Integer getOnlineUpdateVersion() {
return onlineUpdateVersion;
}
public void setOnlineUpdateVersion(Integer onlineUpdateVersion) {
this.onlineUpdateVersion = onlineUpdateVersion;
}
public ChExtDTO getChExt() {
return chExt;
}
public void setChExt(ChExtDTO chExt) {
this.chExt = chExt;
}
public Integer getIsVirtual() {
return isVirtual;
}
public void setIsVirtual(Integer isVirtual) {
this.isVirtual = isVirtual;
}
public static class ChExtDTO {
}
}
}
}
}
}

View File

@ -2,6 +2,7 @@ package com.xkrs.service;
import com.xkrs.model.entity.CameraInformation;
import com.xkrs.model.entity.DeviceManagement;
import com.xkrs.model.vo.ADD;
import java.util.List;
@ -25,9 +26,18 @@ public interface CameraService {
* @return
*/
List<DeviceManagement> SelectDevice();
/**
* 查询摄像头信息
* @return
*/
String Videotape();
/**
*
*/
String Selectequipment();
/**
* 添加设备分页信息
*/
boolean InsertPaging(DeviceManagement para);
String InsertPaging(List<DeviceManagement> para);
}

View File

@ -1,11 +0,0 @@
package com.xkrs.service;
/**
* @Author: XinYi Song
* @Date: 2022/2/11 8:51
*/
public interface FireEventService {
String selectFireEventList();
}

View File

@ -1,5 +1,7 @@
package com.xkrs.service;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @Author: XinYi Song
* @Date: 2022/2/11 8:51
@ -8,7 +10,6 @@ public interface FireService {
/**
* 根据设备编码获取火情信息
*
* @param code
* @return
*/
@ -16,7 +17,6 @@ public interface FireService {
/**
* 根据设备编码和时间段查询火情信息
*
* @param code
* @param startTime
* @param endTime
@ -26,14 +26,12 @@ public interface FireService {
/**
* 查询最新三百条火情信息
*
* @return
*/
String findThreeHundredData();
/**
* 修改火点状态
*
* @param alarmCode
* @return
*/

View File

@ -1,16 +1,25 @@
package com.xkrs.service.impl;
import com.xkrs.common.encapsulation.PromptMessageEnum;
import com.xkrs.dao.CameraDao;
import com.xkrs.dao.DeviceManagementDao;
import com.xkrs.dao.FireDao;
import com.xkrs.model.entity.CameraInformation;
import com.xkrs.model.entity.DeviceManagement;
import com.xkrs.model.vo.ADD;
import com.xkrs.service.CameraService;
import com.xkrs.util.Query;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.math.BigInteger;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import static com.xkrs.common.encapsulation.OutputEncapsulation.outputEncapsulationObject;
/**
* @Author: XinYi Song
@ -24,6 +33,8 @@ public class CameraServiceImpl implements CameraService {
@Resource
private DeviceManagementDao deviceManagementDao;
Locale locale = LocaleContextHolder.getLocale();
@Override
public List<CameraInformation> SelectCameraAll() {
List<CameraInformation> cameraInformations = cameraDao.findAll();
@ -39,13 +50,10 @@ public class CameraServiceImpl implements CameraService {
try {
cameraDao.save(cameraInformation);
return true;
}
catch (Exception e){
} catch (Exception e) {
return false;
}
}
@Override
@ -58,15 +66,28 @@ public class CameraServiceImpl implements CameraService {
}
@Override
public boolean InsertPaging(DeviceManagement para)
{
try {
deviceManagementDao.selectDeviceManagement(para);
return true;
}
catch (Exception e){
public String Videotape() {
List<Map<String,String>> stringObjectMap = deviceManagementDao.Videotape();
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,stringObjectMap,locale);
return false;
}
@Override
public String Selectequipment() {
List<Map<String,String>> stringObjectMap = deviceManagementDao.equipment();
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,stringObjectMap,locale);
}
@Override
public String InsertPaging(List<DeviceManagement> para) {
try {
DeviceManagement deviceManagement = new DeviceManagement();
return "成功添加!";
} catch (Exception e) {
return e.getMessage();
}
}
}

View File

@ -1,30 +0,0 @@
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);
}
}

View File

@ -34,9 +34,9 @@ public class FireServerImpl implements FireService {
Locale locale = LocaleContextHolder.getLocale();
/**
* 根据设备编码获取火情的信息
*
* @param code
* @return
*/
@ -52,7 +52,6 @@ public class FireServerImpl implements FireService {
/**
* 根据设备编码和时间段查询火情信息
*
* @param code
* @param startTime
* @param endTime
@ -70,7 +69,6 @@ public class FireServerImpl implements FireService {
/**
* 查询最新300条火情信息
*
* @return
*/
@Cacheable(keyGenerator = "keyGenerator",unless="#result == null")
@ -86,7 +84,6 @@ public class FireServerImpl implements FireService {
/**
* 修改火点状态
*
* @param alarmCode
* @return
*/

View File

@ -14,15 +14,16 @@ import java.util.Map;
*/
public class ManagementUtil {
public static JsonNode getManagement() {
String url = "https://111.53.13.180:4433/evo-apigw/evo-brm/1.0.0/device?deviceCode=100001";
String url = "https://111.53.13.180:4433/evo-apigw/evo-brm/1.0.0/device?deviceCode=1001339";
Map<String, String> map = new HashMap<>(3);
JsonNode jsonNode = RequestUtil.doGetJsonNode(url, map);
return jsonNode;
}
//https://{{host}}/evo-apigw/evo-brm/{{version}}/device/1001339
public static String getPaging(String para) {
String url = "https://111.53.13.180:4433/evo-apigw/evo-brm/1.2.0/device/subsystem/page";
String jsonNode = RequestUtil.doPostJson(url, para);
String url = "https://111.53.13.180:4433/evo-apigw/evo-brm/1.2.0/devic?deviceCode="+para;
String jsonNode = RequestUtil.getPost(url);
return jsonNode;
}

View File

@ -124,6 +124,48 @@ public class RequestUtil {
return result;
}
/**
* get设备详细信息查询
* @param url
* @return String
*/
public static String getPost(String url) {
// 创建Httpclient对象
CloseableHttpClient httpclient = HttpClients.createDefault();
String resultString = "";
CloseableHttpResponse response = null;
try {
URI uri = new URI(url);
// 创建http GET请求
HttpGet httpGet = new HttpGet(uri);
// 执行请求
response = httpclient.execute(httpGet);
// 判断返回状态是否为200
if (response.getStatusLine().getStatusCode() == 200) {
resultString = EntityUtils.toString(response.getEntity(), "UTF-8");
ObjectMapper objectMapper = new ObjectMapper();
//使用ObjectMapper对象对 User对象进行转换
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (response != null) {
response.close();
}
httpclient.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return resultString;
}
/**
* 带参数的get请求
* @param url