Default Changelist

This commit is contained in:
XinYi Song 2022-03-04 18:11:38 +08:00
parent b9204a9221
commit 2114d28b0b
10 changed files with 668 additions and 35 deletions

View File

@ -1,7 +1,9 @@
package com.xkrs.controller;
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.service.CameraService;
import com.xkrs.service.FireService;
import org.springframework.web.bind.annotation.GetMapping;
@ -23,13 +25,16 @@ public class CameraController {
@Resource
private CameraDao cameraDao;
@GetMapping("/Select")
@Resource
private DeviceManagementDao deviceManagementDao;
@GetMapping("/getCameraInformation")
public List<CameraInformation> getCameraInformation(){
return cameraService.SelectCameraAll();
}
@GetMapping("/Insert")
@GetMapping("/insertCameraInformation")
public boolean insertCameraInformation(CameraInformation cameraInformation){
try {
cameraService.InsertCamera(cameraInformation);
@ -39,7 +44,12 @@ public class CameraController {
return false;
}
}
@GetMapping("/SelectDeviceManagement")
public List<DeviceManagement> SelectDeviceManagement()
{
return cameraService.SelectDevice();
}
}

View File

@ -1,5 +1,7 @@
package com.xkrs.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
@ -8,15 +10,17 @@ import com.xkrs.common.encapsulation.PromptMessageEnum;
import com.xkrs.common.tools.GetTokenTool;
import com.xkrs.common.tools.JackSonTool;
import com.xkrs.dao.EquipmentDao;
import com.xkrs.model.entity.DeviceManagement;
import com.xkrs.model.entity.Equipment;
import com.xkrs.util.Md5Util;
import com.xkrs.util.RequestUtil;
import com.xkrs.util.WeatherUtils;
import com.xkrs.model.entity.Fire;
import com.xkrs.util.*;
import com.xkrs.websocket.server.WebSocketServer;
import org.springframework.context.i18n.LocaleContextHolder;
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;
@ -100,12 +104,20 @@ public class TestController {
return jsonNode1;
}
/*@GetMapping("/getmanagement")
/**
* 获取设备信息
* @return
*/
@GetMapping("/getmanagement")
public JsonNode getManagement(){
}*/
JsonNode forecastWeather = ManagementUtil.getManagement();
JsonNode results = forecastWeather.path("results");
JsonNode jsonNode = results.get(0);
JsonNode daily = jsonNode.path("daily");
JsonNode jsonNode1 = daily.get(0);
return jsonNode1;
}
@PostMapping("/updateVideoPath")
@Transactional(rollbackOn = Exception.class)
public String updateVideoPath(){
@ -117,4 +129,53 @@ public class TestController {
}
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"成功!",locale);
}
/**
* 获取设备分页
* @return
*/
@GetMapping("/getPaging")
public boolean 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 = objectMapper.readTree(message);
String method = jsonNode.get("method").asText();
if("vms.alarm.msg".equals(method)){
JsonNode info = jsonNode.get("info");
Fire fire = new Fire();
fire.setDeviceCode(info.get("deviceCode").asText());
fire.setChannelSeq(info.get("channelSeq").asText());
fire.setUnitType(info.get("unitType").asText());
fire.setNodeType(info.get("nodeType").asText());
fire.setNodeCode(info.get("nodeCode").asText());
String alarmCode = info.get("alarmCode").asText();
fire.setAlarmCode(alarmCode);
fire.setAlarmStat(info.get("alarmStat").asText());
fire.setAlarmType(info.get("alarmType").asText());
fire.setAlarmGrade(info.get("alarmGrade").asText());
fire.setAlarmPicture(info.get("alarmPicture").asText());
String modifyTime = DateTimeUtil.timeMillisToString(Long.parseLong(info.get("alarmDate").asText()));
fire.setAlarmDate(modifyTime);
fire.setAlarmSourceName(info.get("alarmSourceName").asText());
fire.setAlarmLongitude(info.get("gpsX").asText());
fire.setAlarmLatitude(info.get("gpsY").asText());
fire.setAltitude(info.get("altitude").asText());
fire.setFireDistance(info.get("fireDistance").asText());
fire.setFireId(info.get("fsid").asText());
fire.setFireState("0");
}
*//* for (int i=0;i<listObjectFir.size();i++)
{
DeviceManagement deviceManagement=new DeviceManagement();
deviceManagement.setDeviceName(listObjectFir.size();
}*//*
*//* for (Map<String,<String> mapList : listObjectFir) {
for (Map.Entry entry : mapList.entrySet()) {
System.out.println(entry.getKey() + " " + entry.getValue());
}
}*/
return true;
}
}

View File

@ -0,0 +1,24 @@
package com.xkrs.dao;
import com.xkrs.model.entity.CameraInformation;
import com.xkrs.model.entity.DeviceManagement;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import java.util.List;
import java.util.Map;
/**
* @Author: XinYi Song
* @Date: 2022/3/4 11:54
*/
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);
}

View File

@ -6,6 +6,8 @@ import javax.persistence.*;
* @Author: XinYi Song
* @Date: 2022/3/4 8:23
*/
@Entity
@Table(name = "DeviceManagement")
public class DeviceManagement {
/**
* 主键id
@ -22,7 +24,7 @@ public class DeviceManagement {
/**
* 设备编码
*/
@Column(length = 32, columnDefinition = "varchar(65)")
@Column(length = 32, columnDefinition = "varchar(32)")
private String deviceCode;
/**
* 设备唯一标识码
@ -32,99 +34,295 @@ public class DeviceManagement {
/**
* 设备大类
*/
@Column(length = 32, columnDefinition = "varchar(65)")
@Column(length = 32, columnDefinition = "varchar(32)")
private int deviceCategory;
/**
* 设备小类
*/
@Column(length = 32, columnDefinition = "varchar(65)")
@Column(length = 32, columnDefinition = "varchar(32)")
private int deviceType;
/**
* 厂商类型
*/
@Column(length = 32, columnDefinition = "varchar(65)")
@Column(length = 32, columnDefinition = "varchar(32)")
private String deviceManufacturer;
/**
* 设备型号
*/
@Column(length = 32, columnDefinition = "varchar(65)")
@Column(length = 32, columnDefinition = "varchar(32)")
private String deviceModel;
/**
* 设备ip
*/
@Column(length = 32, columnDefinition = "varchar(65)")
@Column(length = 32, columnDefinition = "varchar(32)")
private String deviceIp;
/**
* 设备端口
*/
@Column(length = 32, columnDefinition = "varchar(65)")
@Column(length = 32, columnDefinition = "varchar(32)")
private int devicePort;
/**
* 设备所属组织
*/
@Column(length = 32, columnDefinition = "varchar(65)")
@Column(length = 32, columnDefinition = "varchar(32)")
private String ownerCode;
/**
* 添加方式
*/
@Column(length = 32, columnDefinition = "varchar(65)")
@Column(length = 32, columnDefinition = "varchar(32)")
private String loginType;
/**
* 登录名称
*/
@Column(length = 32, columnDefinition = "varchar(65)")
@Column(length = 32, columnDefinition = "varchar(32)")
private String loginName;
/**
* 登录密码
*/
@Column(length = 32, columnDefinition = "varchar(65)")
@Column(length = 32, columnDefinition = "varchar(32)")
private String loginPassword;
/**
* 主动注册代理端口
*/
@Column(length = 32, columnDefinition = "varchar(65)")
@Column(length = 32, columnDefinition = "varchar(32)")
private int registProxyPort;
/**
* 主动注册服务器编码
*/
@Column(length = 32, columnDefinition = "varchar(65)")
@Column(length = 32, columnDefinition = "varchar(32)")
private String registDeviceCode;
/**
* 通道描述
*/
@Column(length = 32, columnDefinition = "varchar(65)")
@Column(length = 32, columnDefinition = "varchar(32)")
private String memo;
/**
* 在线状态
*/
@Column(length = 32, columnDefinition = "varchar(65)")
@Column(length = 32, columnDefinition = "varchar(32)")
private int isOnline;
/**
* 光栅图
*/
@Column(length = 32, columnDefinition = "varchar(65)")
@Column(length = 32, columnDefinition = "varchar(32)")
private long mapId;
/**
* 经度
*/
@Column(length = 32, columnDefinition = "varchar(65)")
@Column(length = 32, columnDefinition = "varchar(32)")
private String gpsX;
/**
* 纬度
*/
@Column(length = 32, columnDefinition = "varchar(65)")
@Column(length = 32, columnDefinition = "varchar(32)")
private String gpsY;
/**
* 设备所属子系统
*/
@Column(length = 32, columnDefinition = "varchar(65)")
@Column(length = 32, columnDefinition = "varchar(32)")
private String subSystem;
/**
* 设备扩展属性
*/
@Column(length = 32, columnDefinition = "varchar(65)")
@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;
/**
* 实时视频
*/
private String liveVideo;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
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 int getDeviceCategory() {
return deviceCategory;
}
public void setDeviceCategory(int deviceCategory) {
this.deviceCategory = deviceCategory;
}
public int getDeviceType() {
return deviceType;
}
public void setDeviceType(int deviceType) {
this.deviceType = deviceType;
}
public String getDeviceManufacturer() {
return deviceManufacturer;
}
public void setDeviceManufacturer(String deviceManufacturer) {
this.deviceManufacturer = deviceManufacturer;
}
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 int getDevicePort() {
return devicePort;
}
public void setDevicePort(int 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 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;
}
}

View File

@ -0,0 +1,74 @@
package com.xkrs.model.entity;
import javax.persistence.*;
/**
* @Author: XinYi Song
* @Date: 2022/3/4 10:07
*/
public class DevicePaging {
/**
* 主键id
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "equipment_seq_gen")
@SequenceGenerator(name = "equipment_seq_gen", sequenceName = "equipment_id_seq",allocationSize = 1)
private Integer id;
/**
* 当前页
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private int pageNum;
/**
* 每页记录数
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private int pageSize;
/**
* 设备所属组织编码集合
*/
@Column(length = 65, columnDefinition = "varchar(65)")
private String ownerCodes;
/**
* 是否获取设备所属组织子节点下设备记
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private int showChildNodeData;
/**
* 单元类型,多个
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private boolean unitTypes;
/**
* 设备大类
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private boolean categorys;
/**
* 设备小类
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String types;
/**
* 设备编码列表
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String deviceCodes;
/**
* 设备标识码列表
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String deviceSns;
/**
* 设备地址
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String deviceIps;
/**
* 在线状态
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String isOnline;
}

View File

@ -0,0 +1,87 @@
package com.xkrs.model.entity;
import javax.persistence.*;
/**
* @Author: XinYi Song
* @Date: 2022/3/4 11:22
*/
@Entity
@Table(name = "Videotape")
public class Videotape {
/**
* 主键id
*/
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "weather_seq_gen")
@SequenceGenerator(name = "weather_seq_gen", sequenceName = "weather_id_seq",allocationSize = 1)
private Integer id;
/**
* 通道编码
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String channelId;
/**
* 录像来源
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String recordSource;
/**
* 录像类型
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String recordType;
/**
* 开始时间
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String startTime;
/**
* 结束时间
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String endTime;
/**
* 录像名字
*/
@Column(length = 65, columnDefinition = "varchar(65)")
private String recordName;
/**
* 文件长度
*/
@Column(length = 65, columnDefinition = "varchar(65)")
private String fileLength;
/**
* 录像计划ID
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String planId;
/**
* 存储服务ID
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String ssId;
/**
* 磁盘ID
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String diskId;
/**
* 码流处理(StreamId)
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String streamId;
/**
* 是否淡忘
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String forgotten;
/**
* 码流类型
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String streamType;
}

View File

@ -0,0 +1,130 @@
package com.xkrs.model.vo;
import javax.persistence.Column;
import java.util.List;
/**
* @Author: XinYi Song
* @Date: 2022/3/4 18:00
*/
public class JsonHelp1 {
private Boolean success;
private String code;
private String errMsg;
private List<Data> data;
private class Data{
/**
* 设备名称
*/
@Column(length = 65, columnDefinition = "varchar(65)")
private String deviceName;
/**
* 设备编码
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String deviceCode;
/**
* 设备唯一标识码
*/
@Column(length = 65, columnDefinition = "varchar(65)")
private String deviceSn;
/**
* 设备大类
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private int deviceCategory;
/**
* 设备小类
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private int deviceType;
/**
* 厂商类型
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String deviceManufacturer;
/**
* 设备型号
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String deviceModel;
/**
* 设备ip
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String deviceIp;
/**
* 设备端口
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private int devicePort;
/**
* 设备所属组织
*/
@Column(length = 32, columnDefinition = "varchar(32)")
private String ownerCode;
/**
* 添加方式
*/
@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;
}
}

View File

@ -1,6 +1,7 @@
package com.xkrs.service;
import com.xkrs.model.entity.CameraInformation;
import com.xkrs.model.entity.DeviceManagement;
import java.util.List;
@ -18,4 +19,15 @@ public interface CameraService {
* 添加
* */
boolean InsertCamera(CameraInformation cameraInformation);
/**
* 查询全部设备信息
* @return
*/
List<DeviceManagement> SelectDevice();
/**
* 添加设备分页信息
*/
boolean InsertPaging(DeviceManagement para);
}

View File

@ -1,8 +1,10 @@
package com.xkrs.service.impl;
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.service.CameraService;
import com.xkrs.util.Query;
@ -17,6 +19,9 @@ public class CameraServiceImpl implements CameraService {
@Resource
private CameraDao cameraDao;
@Resource
private DeviceManagementDao deviceManagementDao;
@Override
public List<CameraInformation> SelectCameraAll() {
List<CameraInformation> cameraInformations =cameraDao.findAll();
@ -40,4 +45,26 @@ public class CameraServiceImpl implements CameraService {
}
@Override
public List<DeviceManagement> SelectDevice() {
List<DeviceManagement> deviceManagements =deviceManagementDao.findAll();
if (deviceManagements==null) {
System.out.println("实现错误");
}
return deviceManagements;
}
@Override
public boolean InsertPaging(DeviceManagement para)
{
try {
deviceManagementDao.selectDeviceManagement(para);
return true;
}
catch (Exception e){
return false;
}
}
}

View File

@ -1,19 +1,29 @@
package com.xkrs.util;
import com.fasterxml.jackson.databind.JsonNode;
import com.xkrs.model.entity.DeviceManagement;
import springfox.documentation.spring.web.json.Json;
import java.util.HashMap;
import java.util.Map;
/**
* @Author: XinYi Song
* @Date: 2022/3/4 9:38
*/
public class ManagementUtil {
public static JsonNode getForecastWeather() {
String url = "http://portalweather.comsys.net.cn/weather03/api/weatherService/getDailyWeather?cityName=大同";
public static JsonNode getManagement() {
String url = "https://111.53.13.180:4433/evo-apigw/evo-brm/1.0.0/device?deviceCode=100001";
Map<String, String> map = new HashMap<>(3);
JsonNode jsonNode = RequestUtil.doGetJsonNode(url, map);
return jsonNode;
}
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);
return jsonNode;
}
}