Browse Source

引入lombok框架

优化redis存储结构
pull/1/head
648540858 4 years ago
parent
commit
1947edb69a
  1. 5
      pom.xml
  2. 30
      src/main/java/com/genersoft/iot/vmp/common/PageResult.java
  3. 73
      src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java
  4. 523
      src/main/java/com/genersoft/iot/vmp/conf/MediaServerConfig.java
  5. 49
      src/main/java/com/genersoft/iot/vmp/conf/SipConfig.java
  6. 11
      src/main/java/com/genersoft/iot/vmp/conf/VManagerConfig.java
  7. 85
      src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java
  8. 66
      src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceAlarm.java
  9. 230
      src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java
  10. 21
      src/main/java/com/genersoft/iot/vmp/gb28181/bean/Host.java
  11. 34
      src/main/java/com/genersoft/iot/vmp/gb28181/bean/RecordInfo.java
  12. 75
      src/main/java/com/genersoft/iot/vmp/gb28181/bean/RecordItem.java
  13. 2
      src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java
  14. 46
      src/main/java/com/genersoft/iot/vmp/storager/redis/VideoManagerRedisStoragerImpl.java
  15. 66
      src/main/java/com/genersoft/iot/vmp/utils/redis/RedisUtil.java
  16. 178
      src/main/java/com/genersoft/iot/vmp/vmanager/device/entity/Device.java
  17. 193
      src/main/java/com/genersoft/iot/vmp/vmanager/device/entity/DeviceChannel.java

5
pom.xml

@ -156,6 +156,11 @@
<artifactId>okhttp</artifactId>
<version>4.9.0</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.12</version>
</dependency>
</dependencies>

30
src/main/java/com/genersoft/iot/vmp/common/PageResult.java

@ -1,7 +1,10 @@
package com.genersoft.iot.vmp.common;
import lombok.Data;
import java.util.List;
@Data
public class PageResult<T> {
private int page;
@ -14,31 +17,4 @@ public class PageResult<T> {
return data;
}
public void setData(List<T> data) {
this.data = data;
}
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
}

73
src/main/java/com/genersoft/iot/vmp/common/StreamInfo.java

@ -1,7 +1,9 @@
package com.genersoft.iot.vmp.common;
import com.alibaba.fastjson.JSONArray;
import lombok.Data;
@Data
public class StreamInfo {
private String ssrc;
@ -14,75 +16,4 @@ public class StreamInfo {
private String rtsp;
private JSONArray tracks;
public String getSsrc() {
return ssrc;
}
public void setSsrc(String ssrc) {
this.ssrc = ssrc;
}
public String getFlv() {
return flv;
}
public void setFlv(String flv) {
this.flv = flv;
}
public String getWs_flv() {
return ws_flv;
}
public void setWs_flv(String ws_flv) {
this.ws_flv = ws_flv;
}
public String getRtmp() {
return rtmp;
}
public void setRtmp(String rtmp) {
this.rtmp = rtmp;
}
public String getHls() {
return hls;
}
public void setHls(String hls) {
this.hls = hls;
}
public String getRtsp() {
return rtsp;
}
public void setRtsp(String rtsp) {
this.rtsp = rtsp;
}
public String getDeviceID() {
return deviceID;
}
public void setDeviceID(String deviceID) {
this.deviceID = deviceID;
}
public String getCahnnelId() {
return cahnnelId;
}
public void setCahnnelId(String cahnnelId) {
this.cahnnelId = cahnnelId;
}
public JSONArray getTracks() {
return tracks;
}
public void setTracks(JSONArray tracks) {
this.tracks = tracks;
}
}

523
src/main/java/com/genersoft/iot/vmp/conf/MediaServerConfig.java

@ -1,7 +1,9 @@
package com.genersoft.iot.vmp.conf;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
@Data
public class MediaServerConfig {
@JSONField(name = "api.apiDebug")
@ -198,525 +200,4 @@ public class MediaServerConfig {
@JSONField(name = "shell.shell")
private String shellPhell;
public String getApiDebug() {
return apiDebug;
}
public void setApiDebug(String apiDebug) {
this.apiDebug = apiDebug;
}
public String getApiSecret() {
return apiSecret;
}
public void setApiSecret(String apiSecret) {
this.apiSecret = apiSecret;
}
public String getFfmpegBin() {
return ffmpegBin;
}
public void setFfmpegBin(String ffmpegBin) {
this.ffmpegBin = ffmpegBin;
}
public String getFfmpegCmd() {
return ffmpegCmd;
}
public void setFfmpegCmd(String ffmpegCmd) {
this.ffmpegCmd = ffmpegCmd;
}
public String getFfmpegLog() {
return ffmpegLog;
}
public void setFfmpegLog(String ffmpegLog) {
this.ffmpegLog = ffmpegLog;
}
public String getGeneralEnableVhost() {
return generalEnableVhost;
}
public void setGeneralEnableVhost(String generalEnableVhost) {
this.generalEnableVhost = generalEnableVhost;
}
public String getGeneralFlowThreshold() {
return generalFlowThreshold;
}
public void setGeneralFlowThreshold(String generalFlowThreshold) {
this.generalFlowThreshold = generalFlowThreshold;
}
public String getGeneralMaxStreamWaitMS() {
return generalMaxStreamWaitMS;
}
public void setGeneralMaxStreamWaitMS(String generalMaxStreamWaitMS) {
this.generalMaxStreamWaitMS = generalMaxStreamWaitMS;
}
public String getGeneralStreamNoneReaderDelayMS() {
return generalStreamNoneReaderDelayMS;
}
public void setGeneralStreamNoneReaderDelayMS(String generalStreamNoneReaderDelayMS) {
this.generalStreamNoneReaderDelayMS = generalStreamNoneReaderDelayMS;
}
public String getHlsFileBufSize() {
return hlsFileBufSize;
}
public void setHlsFileBufSize(String hlsFileBufSize) {
this.hlsFileBufSize = hlsFileBufSize;
}
public String getHlsFilePath() {
return hlsFilePath;
}
public void setHlsFilePath(String hlsFilePath) {
this.hlsFilePath = hlsFilePath;
}
public String getHlsSegDur() {
return hlsSegDur;
}
public void setHlsSegDur(String hlsSegDur) {
this.hlsSegDur = hlsSegDur;
}
public String getHlsSegNum() {
return hlsSegNum;
}
public void setHlsSegNum(String hlsSegNum) {
this.hlsSegNum = hlsSegNum;
}
public String getHookAccessFileExceptHLS() {
return hookAccessFileExceptHLS;
}
public void setHookAccessFileExceptHLS(String hookAccessFileExceptHLS) {
this.hookAccessFileExceptHLS = hookAccessFileExceptHLS;
}
public String getHookAdminParams() {
return hookAdminParams;
}
public void setHookAdminParams(String hookAdminParams) {
this.hookAdminParams = hookAdminParams;
}
public String getHookEnable() {
return hookEnable;
}
public void setHookEnable(String hookEnable) {
this.hookEnable = hookEnable;
}
public String getHookOnFlowReport() {
return hookOnFlowReport;
}
public void setHookOnFlowReport(String hookOnFlowReport) {
this.hookOnFlowReport = hookOnFlowReport;
}
public String getHookOnHttpAccess() {
return hookOnHttpAccess;
}
public void setHookOnHttpAccess(String hookOnHttpAccess) {
this.hookOnHttpAccess = hookOnHttpAccess;
}
public String getHookOnPlay() {
return hookOnPlay;
}
public void setHookOnPlay(String hookOnPlay) {
this.hookOnPlay = hookOnPlay;
}
public String getHookOnPublish() {
return hookOnPublish;
}
public void setHookOnPublish(String hookOnPublish) {
this.hookOnPublish = hookOnPublish;
}
public String getHookOnRecordMp4() {
return hookOnRecordMp4;
}
public void setHookOnRecordMp4(String hookOnRecordMp4) {
this.hookOnRecordMp4 = hookOnRecordMp4;
}
public String getHookOnRtspAuth() {
return hookOnRtspAuth;
}
public void setHookOnRtspAuth(String hookOnRtspAuth) {
this.hookOnRtspAuth = hookOnRtspAuth;
}
public String getHookOnRtspRealm() {
return hookOnRtspRealm;
}
public void setHookOnRtspRealm(String hookOnRtspRealm) {
this.hookOnRtspRealm = hookOnRtspRealm;
}
public String getHookOnShellLogin() {
return hookOnShellLogin;
}
public void setHookOnShellLogin(String hookOnShellLogin) {
this.hookOnShellLogin = hookOnShellLogin;
}
public String getHookOnStreamChanged() {
return hookOnStreamChanged;
}
public void setHookOnStreamChanged(String hookOnStreamChanged) {
this.hookOnStreamChanged = hookOnStreamChanged;
}
public String getHookOnStreamNoneReader() {
return hookOnStreamNoneReader;
}
public void setHookOnStreamNoneReader(String hookOnStreamNoneReader) {
this.hookOnStreamNoneReader = hookOnStreamNoneReader;
}
public String getHookOnStreamNotFound() {
return hookOnStreamNotFound;
}
public void setHookOnStreamNotFound(String hookOnStreamNotFound) {
this.hookOnStreamNotFound = hookOnStreamNotFound;
}
public String getHookTimeoutSec() {
return hookTimeoutSec;
}
public void setHookTimeoutSec(String hookTimeoutSec) {
this.hookTimeoutSec = hookTimeoutSec;
}
public String getHttpCharSet() {
return httpCharSet;
}
public void setHttpCharSet(String httpCharSet) {
this.httpCharSet = httpCharSet;
}
public String getHttpKeepAliveSecond() {
return httpKeepAliveSecond;
}
public void setHttpKeepAliveSecond(String httpKeepAliveSecond) {
this.httpKeepAliveSecond = httpKeepAliveSecond;
}
public String getHttpMaxReqCount() {
return httpMaxReqCount;
}
public void setHttpMaxReqCount(String httpMaxReqCount) {
this.httpMaxReqCount = httpMaxReqCount;
}
public String getHttpMaxReqSize() {
return httpMaxReqSize;
}
public void setHttpMaxReqSize(String httpMaxReqSize) {
this.httpMaxReqSize = httpMaxReqSize;
}
public String getHttpNotFound() {
return httpNotFound;
}
public void setHttpNotFound(String httpNotFound) {
this.httpNotFound = httpNotFound;
}
public String getHttpPort() {
return httpPort;
}
public void setHttpPort(String httpPort) {
this.httpPort = httpPort;
}
public String getHttpRootPath() {
return httpRootPath;
}
public void setHttpRootPath(String httpRootPath) {
this.httpRootPath = httpRootPath;
}
public String getHttpSendBufSize() {
return httpSendBufSize;
}
public void setHttpSendBufSize(String httpSendBufSize) {
this.httpSendBufSize = httpSendBufSize;
}
public String getHttpSSLport() {
return httpSSLport;
}
public void setHttpSSLport(String httpSSLport) {
this.httpSSLport = httpSSLport;
}
public String getMulticastAddrMax() {
return multicastAddrMax;
}
public void setMulticastAddrMax(String multicastAddrMax) {
this.multicastAddrMax = multicastAddrMax;
}
public String getMulticastAddrMin() {
return multicastAddrMin;
}
public void setMulticastAddrMin(String multicastAddrMin) {
this.multicastAddrMin = multicastAddrMin;
}
public String getMulticastUdpTTL() {
return multicastUdpTTL;
}
public void setMulticastUdpTTL(String multicastUdpTTL) {
this.multicastUdpTTL = multicastUdpTTL;
}
public String getRecordAppName() {
return recordAppName;
}
public void setRecordAppName(String recordAppName) {
this.recordAppName = recordAppName;
}
public String getRecordFilePath() {
return recordFilePath;
}
public void setRecordFilePath(String recordFilePath) {
this.recordFilePath = recordFilePath;
}
public String getRecordFileSecond() {
return recordFileSecond;
}
public void setRecordFileSecond(String recordFileSecond) {
this.recordFileSecond = recordFileSecond;
}
public String getRecordFileSampleMS() {
return recordFileSampleMS;
}
public void setRecordFileSampleMS(String recordFileSampleMS) {
this.recordFileSampleMS = recordFileSampleMS;
}
public String getRtmpHandshakeSecond() {
return rtmpHandshakeSecond;
}
public void setRtmpHandshakeSecond(String rtmpHandshakeSecond) {
this.rtmpHandshakeSecond = rtmpHandshakeSecond;
}
public String getRtmpKeepAliveSecond() {
return rtmpKeepAliveSecond;
}
public void setRtmpKeepAliveSecond(String rtmpKeepAliveSecond) {
this.rtmpKeepAliveSecond = rtmpKeepAliveSecond;
}
public String getRtmpModifyStamp() {
return rtmpModifyStamp;
}
public void setRtmpModifyStamp(String rtmpModifyStamp) {
this.rtmpModifyStamp = rtmpModifyStamp;
}
public String getRtmpPort() {
return rtmpPort;
}
public void setRtmpPort(String rtmpPort) {
this.rtmpPort = rtmpPort;
}
public String getRtpAudioMtuSize() {
return rtpAudioMtuSize;
}
public void setRtpAudioMtuSize(String rtpAudioMtuSize) {
this.rtpAudioMtuSize = rtpAudioMtuSize;
}
public String getRtpClearCount() {
return rtpClearCount;
}
public void setRtpClearCount(String rtpClearCount) {
this.rtpClearCount = rtpClearCount;
}
public String getRtpCycleMS() {
return rtpCycleMS;
}
public void setRtpCycleMS(String rtpCycleMS) {
this.rtpCycleMS = rtpCycleMS;
}
public String getRtpMaxRtpCount() {
return rtpMaxRtpCount;
}
public void setRtpMaxRtpCount(String rtpMaxRtpCount) {
this.rtpMaxRtpCount = rtpMaxRtpCount;
}
public String getRtpVideoMtuSize() {
return rtpVideoMtuSize;
}
public void setRtpVideoMtuSize(String rtpVideoMtuSize) {
this.rtpVideoMtuSize = rtpVideoMtuSize;
}
public String getRtspAuthBasic() {
return rtspAuthBasic;
}
public void setRtspAuthBasic(String rtspAuthBasic) {
this.rtspAuthBasic = rtspAuthBasic;
}
public String getRtspHandshakeSecond() {
return rtspHandshakeSecond;
}
public void setRtspHandshakeSecond(String rtspHandshakeSecond) {
this.rtspHandshakeSecond = rtspHandshakeSecond;
}
public String getRtspKeepAliveSecond() {
return rtspKeepAliveSecond;
}
public void setRtspKeepAliveSecond(String rtspKeepAliveSecond) {
this.rtspKeepAliveSecond = rtspKeepAliveSecond;
}
public String getRtspPort() {
return rtspPort;
}
public void setRtspPort(String rtspPort) {
this.rtspPort = rtspPort;
}
public String getRtspSSlport() {
return rtspSSlport;
}
public void setRtspSSlport(String rtspSSlport) {
this.rtspSSlport = rtspSSlport;
}
public String getShellMaxReqSize() {
return shellMaxReqSize;
}
public void setShellMaxReqSize(String shellMaxReqSize) {
this.shellMaxReqSize = shellMaxReqSize;
}
public String getShellPhell() {
return shellPhell;
}
public void setShellPhell(String shellPhell) {
this.shellPhell = shellPhell;
}
public String getLocalIP() {
return localIP;
}
public void setLocalIP(String localIP) {
this.localIP = localIP;
}
public String getRtpProxyCheckSource() {
return rtpProxyCheckSource;
}
public void setRtpProxyCheckSource(String rtpProxyCheckSource) {
this.rtpProxyCheckSource = rtpProxyCheckSource;
}
public String getRtpProxyDumpDir() {
return rtpProxyDumpDir;
}
public void setRtpProxyDumpDir(String rtpProxyDumpDir) {
this.rtpProxyDumpDir = rtpProxyDumpDir;
}
public String getRtpProxyPort() {
return rtpProxyPort;
}
public void setRtpProxyPort(String rtpProxyPort) {
this.rtpProxyPort = rtpProxyPort;
}
public String getRtpProxyTimeoutSec() {
return rtpProxyTimeoutSec;
}
public void setRtpProxyTimeoutSec(String rtpProxyTimeoutSec) {
this.rtpProxyTimeoutSec = rtpProxyTimeoutSec;
}
}

49
src/main/java/com/genersoft/iot/vmp/conf/SipConfig.java

@ -1,8 +1,10 @@
package com.genersoft.iot.vmp.conf;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
@Data
@Configuration("sipConfig")
public class SipConfig {
@ -20,51 +22,4 @@ public class SipConfig {
@Value("${sip.ptz.speed:50}")
Integer speed;
public String getSipIp() {
return sipIp;
}
public void setSipIp(String sipIp) {
this.sipIp = sipIp;
}
public Integer getSipPort() {
return sipPort;
}
public void setSipPort(Integer sipPort) {
this.sipPort = sipPort;
}
public String getSipDomain() {
return sipDomain;
}
public void setSipDomain(String sipDomain) {
this.sipDomain = sipDomain;
}
public String getSipPassword() {
return sipPassword;
}
public void setSipPassword(String sipPassword) {
this.sipPassword = sipPassword;
}
public Integer getSpeed() {
return speed;
}
public void setSpeed(Integer speed) {
this.speed = speed;
}
public String getSipId() {
return sipId;
}
public void setSipId(String sipId) {
this.sipId = sipId;
}
}

11
src/main/java/com/genersoft/iot/vmp/conf/VManagerConfig.java

@ -1,5 +1,6 @@
package com.genersoft.iot.vmp.conf;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
@ -8,20 +9,12 @@ import org.springframework.context.annotation.Configuration;
* @author: swwheihei
* @date: 2020年5月6日 下午2:46:00
*/
@Data
@Configuration("vmConfig")
public class VManagerConfig {
@Value("${spring.application.database:redis}")
private String database;
public String getDatabase() {
return database;
}
public void setDatabase(String database) {
this.database = database;
}
}

85
src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java

@ -1,8 +1,11 @@
package com.genersoft.iot.vmp.gb28181.bean;
import java.util.Map;
import lombok.Data;
import java.util.List;
import java.util.Map;
@Data
public class Device {
/**
@ -53,84 +56,6 @@ public class Device {
private int channelCount;
private List<String> channelList;
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getTransport() {
return transport;
}
public void setTransport(String transport) {
this.transport = transport;
}
public Host getHost() {
return host;
}
public void setHost(Host host) {
this.host = host;
}
// public Map<String, DeviceChannel> getChannelMap() {
// return channelMap;
// }
//
// public void setChannelMap(Map<String, DeviceChannel> channelMap) {
// this.channelMap = channelMap;
// }
public String getManufacturer() {
return manufacturer;
}
public void setManufacturer(String manufacturer) {
this.manufacturer = manufacturer;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public String getFirmware() {
return firmware;
}
public void setFirmware(String firmware) {
this.firmware = firmware;
}
public int getOnline() {
return online;
}
public void setOnline(int online) {
this.online = online;
}
public int getChannelCount() {
return channelCount;
}
public void setChannelCount(int channelCount) {
this.channelCount = channelCount;
}
}

66
src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceAlarm.java

@ -1,5 +1,8 @@
package com.genersoft.iot.vmp.gb28181.bean;
import lombok.Data;
@Data
public class DeviceAlarm {
/**
@ -43,68 +46,5 @@ public class DeviceAlarm {
*/
private String alarmType;
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getAlarmPriorit() {
return alarmPriorit;
}
public void setAlarmPriorit(String alarmPriorit) {
this.alarmPriorit = alarmPriorit;
}
public String getAlarmMethod() {
return alarmMethod;
}
public void setAlarmMethod(String alarmMethod) {
this.alarmMethod = alarmMethod;
}
public String getAlarmTime() {
return alarmTime;
}
public void setAlarmTime(String alarmTime) {
this.alarmTime = alarmTime;
}
public String getAlarmDescription() {
return alarmDescription;
}
public void setAlarmDescription(String alarmDescription) {
this.alarmDescription = alarmDescription;
}
public double getLongitude() {
return longitude;
}
public void setLongitude(double longitude) {
this.longitude = longitude;
}
public double getLatitude() {
return latitude;
}
public void setLatitude(double latitude) {
this.latitude = latitude;
}
public String getAlarmType() {
return alarmType;
}
public void setAlarmType(String alarmType) {
this.alarmType = alarmType;
}
}

230
src/main/java/com/genersoft/iot/vmp/gb28181/bean/DeviceChannel.java

@ -1,5 +1,8 @@
package com.genersoft.iot.vmp.gb28181.bean;
import lombok.Data;
@Data
public class DeviceChannel {
/**
@ -153,193 +156,6 @@ public class DeviceChannel {
*/
private boolean play;
public String getChannelId() {
return channelId;
}
public void setChannelId(String channelId) {
this.channelId = channelId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public String getManufacture() {
return manufacture;
}
public void setManufacture(String manufacture) {
this.manufacture = manufacture;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public String getOwner() {
return owner;
}
public void setOwner(String owner) {
this.owner = owner;
}
public String getCivilCode() {
return civilCode;
}
public void setCivilCode(String civilCode) {
this.civilCode = civilCode;
}
public String getBlock() {
return block;
}
public void setBlock(String block) {
this.block = block;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public int getParental() {
return parental;
}
public void setParental(int parental) {
this.parental = parental;
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public int getSafetyWay() {
return safetyWay;
}
public void setSafetyWay(int safetyWay) {
this.safetyWay = safetyWay;
}
public int getRegisterWay() {
return registerWay;
}
public void setRegisterWay(int registerWay) {
this.registerWay = registerWay;
}
public String getCertNum() {
return certNum;
}
public void setCertNum(String certNum) {
this.certNum = certNum;
}
public int getCertifiable() {
return certifiable;
}
public void setCertifiable(int certifiable) {
this.certifiable = certifiable;
}
public int getErrCode() {
return errCode;
}
public void setErrCode(int errCode) {
this.errCode = errCode;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public String getSecrecy() {
return secrecy;
}
public void setSecrecy(String secrecy) {
this.secrecy = secrecy;
}
public String getIpAddress() {
return ipAddress;
}
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public double getLongitude() {
return longitude;
}
public void setLongitude(double longitude) {
this.longitude = longitude;
}
public double getLatitude() {
return latitude;
}
public void setLatitude(double latitude) {
this.latitude = latitude;
}
public int getPTZType() {
return PTZType;
}
public void setPTZType(int PTZType) {
this.PTZType = PTZType;
@ -361,44 +177,4 @@ public class DeviceChannel {
break;
}
}
public String getPTZTypeText() {
return PTZTypeText;
}
public String getSsrc() {
return ssrc;
}
public void setSsrc(String ssrc) {
this.ssrc = ssrc;
}
public int getSubCount() {
return subCount;
}
public void setSubCount(int subCount) {
this.subCount = subCount;
}
public void setPTZTypeText(String PTZTypeText) {
this.PTZTypeText = PTZTypeText;
}
public boolean isHasAudio() {
return hasAudio;
}
public void setHasAudio(boolean hasAudio) {
this.hasAudio = hasAudio;
}
public boolean isPlay() {
return play;
}
public void setPlay(boolean play) {
this.play = play;
}
}

21
src/main/java/com/genersoft/iot/vmp/gb28181/bean/Host.java

@ -1,29 +1,14 @@
package com.genersoft.iot.vmp.gb28181.bean;
import lombok.Data;
@Data
public class Host {
private String ip;
private int port;
private String address;
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public int getPort() {
return port;
}
public void setPort(int port) {
this.port = port;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}

34
src/main/java/com/genersoft/iot/vmp/gb28181/bean/RecordInfo.java

@ -1,5 +1,7 @@
package com.genersoft.iot.vmp.gb28181.bean;
import lombok.Data;
import java.util.List;
/**
@ -7,6 +9,7 @@ import java.util.List;
* @author: swwheihei
* @date: 2020年5月8日 下午2:05:56
*/
@Data
public class RecordInfo {
private String deviceId;
@ -17,35 +20,4 @@ public class RecordInfo {
private List<RecordItem> recordList;
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getSumNum() {
return sumNum;
}
public void setSumNum(int sumNum) {
this.sumNum = sumNum;
}
public List<RecordItem> getRecordList() {
return recordList;
}
public void setRecordList(List<RecordItem> recordList) {
this.recordList = recordList;
}
}

75
src/main/java/com/genersoft/iot/vmp/gb28181/bean/RecordItem.java

@ -1,10 +1,14 @@
package com.genersoft.iot.vmp.gb28181.bean;
import lombok.Data;
/**
* @Description:设备录像bean
* @author: swwheihei
* @date: 2020年5月8日 下午2:06:54
*/
@Data
public class RecordItem {
private String deviceId;
@ -25,75 +29,4 @@ public class RecordItem {
private String recorderId;
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getFilePath() {
return filePath;
}
public void setFilePath(String filePath) {
this.filePath = filePath;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public int getSecrecy() {
return secrecy;
}
public void setSecrecy(int secrecy) {
this.secrecy = secrecy;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public String getRecorderId() {
return recorderId;
}
public void setRecordId(String recorderId) {
this.recorderId = recorderId;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
}

2
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/request/impl/MessageRequestProcessor.java

@ -308,7 +308,7 @@ public class MessageRequestProcessor extends SIPRequestAbstractProcessor {
record.setEndTime(DateUtil.ISO8601Toyyyy_MM_dd_HH_mm_ss(XmlUtil.getText(itemRecord,"EndTime")));
record.setSecrecy(itemRecord.element("Secrecy") == null? 0:Integer.parseInt(XmlUtil.getText(itemRecord,"Secrecy")));
record.setType(XmlUtil.getText(itemRecord,"Type"));
record.setRecordId(XmlUtil.getText(itemRecord,"RecorderID"));
record.setRecorderId(XmlUtil.getText(itemRecord,"RecorderID"));
recordList.add(record);
}
recordInfo.setRecordList(recordList);

46
src/main/java/com/genersoft/iot/vmp/storager/redis/VideoManagerRedisStoragerImpl.java

@ -66,7 +66,6 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager {
if (deviceMap.get(device.getDeviceId()) == null) {
deviceMap.put(device.getDeviceId(), new HashMap<String, HashSet<String>>());
}
// List<Object> deviceChannelList = redis.keys(VideoManagerConstants.CACHEKEY_PREFIX + device.getDeviceId() + "_" + "*");
// 更新device中的通道数量
device.setChannelCount(deviceMap.get(device.getDeviceId()).size());
// 存储device
@ -90,7 +89,6 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager {
// 存储通道
redis.set(VideoManagerConstants.CACHEKEY_PREFIX + deviceId +
"_" + channel.getChannelId() +
":" + channel.getName() +
"_" + (channel.getStatus() == 1 ? "on":"off") +
"_" + (channelMap.get(channelId).size() > 0)+
"_" + (StringUtils.isEmpty(channel.getParentId())?null:channel.getParentId()),
@ -117,7 +115,6 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager {
// deviceChannel);
redis.set(VideoManagerConstants.CACHEKEY_PREFIX + deviceId +
"_" + deviceChannel.getChannelId() +
":" + deviceChannel.getName() +
"_" + (deviceChannel.getStatus() == 1 ? "on":"off") +
"_" + (channelMap.get(deviceChannel.getChannelId()).size() > 0)+
"_" + (StringUtils.isEmpty(deviceChannel.getParentId())?null:deviceChannel.getParentId()),
@ -156,7 +153,8 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager {
"_" + queryOnline + // 搜索是否在线
"_" + queryHasSubChannel + // 搜索是否含有子节点
"_" + "*";
List<Object> deviceChannelList = redis.keys(queryStr);
// List<Object> deviceChannelList = redis.keys(queryStr);
List<Object> deviceChannelList = redis.scan(queryStr);
pageResult.setPage(page);
pageResult.setCount(count);
pageResult.setTotal(deviceChannelList.size());
@ -180,7 +178,9 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager {
@Override
public List<DeviceChannel> queryChannelsByDeviceId(String deviceId) {
List<DeviceChannel> result = new ArrayList<>();
List<Object> deviceChannelList = redis.keys(VideoManagerConstants.CACHEKEY_PREFIX + deviceId + "_" + "*");
// List<Object> deviceChannelList = redis.keys(VideoManagerConstants.CACHEKEY_PREFIX + deviceId + "_" + "*");
List<Object> deviceChannelList = redis.scan(VideoManagerConstants.CACHEKEY_PREFIX + deviceId + "_" + "*");
if (deviceChannelList != null && deviceChannelList.size() > 0 ) {
for (int i = 0; i < deviceChannelList.size(); i++) {
result.add((DeviceChannel)redis.get((String) deviceChannelList.get(i)));
@ -204,7 +204,8 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager {
"_" + queryHasSubChannel + // 搜索是否含有子节点
"_" + parentChannelId;
List<Object> deviceChannelList = redis.keys(queryStr);
// List<Object> deviceChannelList = redis.keys(queryStr);
List<Object> deviceChannelList = redis.scan(queryStr);
if (deviceChannelList != null && deviceChannelList.size() > 0 ) {
for (int i = 0; i < deviceChannelList.size(); i++) {
@ -230,7 +231,8 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager {
public List<DeviceChannel> querySubChannels(String deviceId, String parentChannelId) {
List<DeviceChannel> allDeviceChannels = new ArrayList<>();
List<Object> deviceChannelList = redis.keys(VideoManagerConstants.CACHEKEY_PREFIX + deviceId + "_" + "*");
// List<Object> deviceChannelList = redis.keys(VideoManagerConstants.CACHEKEY_PREFIX + deviceId + "_" + "*");
List<Object> deviceChannelList = redis.scan(VideoManagerConstants.CACHEKEY_PREFIX + deviceId + "_" + "*");
if (deviceChannelList != null && deviceChannelList.size() > 0 ) {
for (int i = 0; i < deviceChannelList.size(); i++) {
@ -247,7 +249,8 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager {
@Override
public DeviceChannel queryChannel(String deviceId, String channelId) {
DeviceChannel deviceChannel = null;
List<Object> deviceChannelList = redis.keys(VideoManagerConstants.CACHEKEY_PREFIX + deviceId +
// List<Object> deviceChannelList = redis.keys(VideoManagerConstants.CACHEKEY_PREFIX + deviceId +
List<Object> deviceChannelList = redis.scan(VideoManagerConstants.CACHEKEY_PREFIX + deviceId +
"_" + channelId + "*");
if (deviceChannelList != null && deviceChannelList.size() > 0 ) {
deviceChannel = (DeviceChannel)redis.get((String)deviceChannelList.get(0));
@ -271,7 +274,8 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager {
if (deviceIds == null || deviceIds.length == 0) {
List<Object> deviceIdList = redis.keys(VideoManagerConstants.DEVICE_PREFIX+"*");
// List<Object> deviceIdList = redis.keys(VideoManagerConstants.DEVICE_PREFIX+"*");
List<Object> deviceIdList = redis.scan(VideoManagerConstants.DEVICE_PREFIX+"*");
pageResult.setTotal(deviceIdList.size());
int maxCount = (page + 1)* count;
for (int i = page * count; i < (pageResult.getTotal() > maxCount ? maxCount : pageResult.getTotal() ); i++) {
@ -297,7 +301,8 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager {
List<Device> devices = new ArrayList<>();
if (deviceIds == null || deviceIds.length == 0) {
List<Object> deviceIdList = redis.keys(VideoManagerConstants.DEVICE_PREFIX+"*");
// List<Object> deviceIdList = redis.keys(VideoManagerConstants.DEVICE_PREFIX+"*");
List<Object> deviceIdList = redis.scan(VideoManagerConstants.DEVICE_PREFIX+"*");
for (int i = 0; i < deviceIdList.size(); i++) {
devices.add((Device)redis.get((String)deviceIdList.get(i)));
}
@ -392,14 +397,16 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager {
}
@Override
public StreamInfo queryPlayBySSRC(String ssrc) {
List<Object> playLeys = redis.keys(String.format("%S_%s_*", VideoManagerConstants.PLAYER_PREFIX, ssrc));
// List<Object> playLeys = redis.keys(String.format("%S_%s_*", VideoManagerConstants.PLAYER_PREFIX, ssrc));
List<Object> playLeys = redis.scan(String.format("%S_%s_*", VideoManagerConstants.PLAYER_PREFIX, ssrc));
if (playLeys == null || playLeys.size() == 0) return null;
return (StreamInfo)redis.get(playLeys.get(0).toString());
}
@Override
public StreamInfo queryPlayByDevice(String deviceId, String code) {
List<Object> playLeys = redis.keys(String.format("%S_*_%s_%s", VideoManagerConstants.PLAYER_PREFIX,
// List<Object> playLeys = redis.keys(String.format("%S_*_%s_%s", VideoManagerConstants.PLAYER_PREFIX,
List<Object> playLeys = redis.scan(String.format("%S_*_%s_%s", VideoManagerConstants.PLAYER_PREFIX,
deviceId,
code));
if (playLeys == null || playLeys.size() == 0) return null;
@ -434,20 +441,21 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager {
for (Device device : devices) {
// 更新设备下的通道
HashMap<String, HashSet<String>> channelMap = new HashMap<String, HashSet<String>>();
List<Object> deviceChannelList = redis.keys(VideoManagerConstants.CACHEKEY_PREFIX +
// List<Object> deviceChannelList = redis.keys(VideoManagerConstants.CACHEKEY_PREFIX +
List<Object> deviceChannelList = redis.scan(VideoManagerConstants.CACHEKEY_PREFIX +
device.getDeviceId() + "_" + "*");
if (deviceChannelList != null && deviceChannelList.size() > 0 ) {
for (int i = 0; i < deviceChannelList.size(); i++) {
String key = (String)deviceChannelList.get(i);
String[] s = key.split("_");
String channelId = s[3].split(":")[0];
String channelId = s[3];
HashSet<String> subChannel = channelMap.get(channelId);
if (subChannel == null) {
subChannel = new HashSet<>();
}
System.out.println(key);
if (s.length == 7 && !"null".equals(s[6])) {
subChannel.add(s[6]);
if (s.length == 6 && !"null".equals(s[5])) {
subChannel.add(s[5]);
}
channelMap.put(channelId, subChannel);
}
@ -459,7 +467,8 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager {
@Override
public void cleanChannelsForDevice(String deviceId) {
List<DeviceChannel> result = new ArrayList<>();
List<Object> deviceChannelList = redis.keys(VideoManagerConstants.CACHEKEY_PREFIX + deviceId + "_" + "*");
// List<Object> deviceChannelList = redis.keys(VideoManagerConstants.CACHEKEY_PREFIX + deviceId + "_" + "*");
List<Object> deviceChannelList = redis.scan(VideoManagerConstants.CACHEKEY_PREFIX + deviceId + "_" + "*");
if (deviceChannelList != null && deviceChannelList.size() > 0 ) {
for (int i = 0; i < deviceChannelList.size(); i++) {
redis.del((String)deviceChannelList.get(i));
@ -470,7 +479,8 @@ public class VideoManagerRedisStoragerImpl implements IVideoManagerStorager {
@Override
public Map<String, StreamInfo> queryPlayByDeviceId(String deviceId) {
Map<String, StreamInfo> streamInfos = new HashMap<>();
List<Object> playLeys = redis.keys(String.format("%S_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, deviceId));
// List<Object> playLeys = redis.keys(String.format("%S_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, deviceId));
List<Object> playLeys = redis.scan(String.format("%S_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, deviceId));
if (playLeys.size() == 0) return streamInfos;
for (int i = 0; i < playLeys.size(); i++) {
String key = (String) playLeys.get(i);

66
src/main/java/com/genersoft/iot/vmp/utils/redis/RedisUtil.java

@ -1,14 +1,12 @@
package com.genersoft.iot.vmp.utils.redis;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.concurrent.TimeUnit;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.ZSetOperations;
import org.springframework.dao.DataAccessException;
import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.core.*;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
@ -676,4 +674,60 @@ public class RedisUtil {
return null;
}
}
/**
* 模糊查询
* @param query 查询参数
* @return
*/
// public List<Object> scan(String query) {
// List<Object> result = new ArrayList<>();
// try {
// Cursor<Map.Entry<Object,Object>> cursor = redisTemplate.opsForHash().scan("field",
// ScanOptions.scanOptions().match(query).count(1000).build());
// while (cursor.hasNext()) {
// Map.Entry<Object,Object> entry = cursor.next();
// result.add(entry.getKey());
// Object key = entry.getKey();
// Object valueSet = entry.getValue();
// }
// //关闭cursor
// cursor.close();
// } catch (Exception e) {
// e.printStackTrace();
// }
// return result;
// }
/**
* 模糊查询
* @param query 查询参数
* @return
*/
public List<Object> scan(String query) {
Set<String> keys = (Set<String>) redisTemplate.execute((RedisCallback<Set<String>>) connection -> {
Set<String> keysTmp = new HashSet<>();
Cursor<byte[]> cursor = connection.scan(new ScanOptions.ScanOptionsBuilder().match(query).count(1000).build());
while (cursor.hasNext()) {
keysTmp.add(new String(cursor.next()));
}
return keysTmp;
});
// Set<String> keys = (Set<String>) redisTemplate.execute(new RedisCallback<Set<String>>(){
//
// @Override
// public Set<String> doInRedis(RedisConnection connection) throws DataAccessException {
// Set<String> keysTmp = new HashSet<>();
// Cursor<byte[]> cursor = connection.scan(new ScanOptions.ScanOptionsBuilder().match(query).count(1000).build());
// while (cursor.hasNext()) {
// keysTmp.add(new String(cursor.next()));
// }
// return keysTmp;
// }
// });
return new ArrayList<>(keys);
}
}

178
src/main/java/com/genersoft/iot/vmp/vmanager/device/entity/Device.java

@ -12,12 +12,14 @@ import javax.validation.constraints.Size;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Description:视频设备信息
* @author: songww
* @date: 2020年5月8日 下午2:05:56
*/
@Data
@ApiModel(value = "视频设备信息", description = "视频设备信息")
@Table(name="VMP_VIDEODEVICES")
public class Device {
@ -222,180 +224,4 @@ public class Device {
@Transient
private List<DeviceChannel> channelList;
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getDeviceName() {
return deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getTransport() {
return transport;
}
public void setTransport(String transport) {
this.transport = transport;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public Integer getPort() {
return port;
}
public void setPort(Integer port) {
this.port = port;
}
public String getManufacturer() {
return manufacturer;
}
public void setManufacturer(String manufacturer) {
this.manufacturer = manufacturer;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public String getFirmware() {
return firmware;
}
public void setFirmware(String firmware) {
this.firmware = firmware;
}
public String getOnline() {
return online;
}
public void setOnline(String online) {
this.online = online;
}
public String getStreamMode() {
return streamMode;
}
public void setStreamMode(String streamMode) {
this.streamMode = streamMode;
}
public List<DeviceChannel> getChannelList() {
return channelList;
}
public void setChannelList(List<DeviceChannel> channelList) {
this.channelList = channelList;
}
public Integer getChannelSum() {
return channelSum;
}
public void setChannelSum(Integer channelSum) {
this.channelSum = channelSum;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getRegisterTime() {
return registerTime;
}
public void setRegisterTime(String registerTime) {
this.registerTime = registerTime;
}
public String getHeartbeatTime() {
return heartbeatTime;
}
public void setHeartbeatTime(String heartbeatTime) {
this.heartbeatTime = heartbeatTime;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
public String getUpdatePerson() {
return updatePerson;
}
public void setUpdatePerson(String updatePerson) {
this.updatePerson = updatePerson;
}
public String getSyncTime() {
return syncTime;
}
public void setSyncTime(String syncTime) {
this.syncTime = syncTime;
}
public String getSyncPerson() {
return syncPerson;
}
public void setSyncPerson(String syncPerson) {
this.syncPerson = syncPerson;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public String getProtocol() {
return protocol;
}
public void setProtocol(String protocol) {
this.protocol = protocol;
}
}

193
src/main/java/com/genersoft/iot/vmp/vmanager/device/entity/DeviceChannel.java

@ -6,12 +6,14 @@ import javax.persistence.Table;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @Description:设备通道信息
* @author: songww
* @date: 2020年5月20日 下午9:00:46
*/
@Data
@ApiModel(value = "设备通道信息", description = "设备通道信息")
@Table(name="VMP_VIDEOCHANNELS")
public class DeviceChannel {
@ -191,195 +193,4 @@ public class DeviceChannel {
@Column(name="LATITUDE")
private double latitude;
public String getChannelId() {
return channelId;
}
public void setChannelId(String channelId) {
this.channelId = channelId;
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getChannelName() {
return channelName;
}
public void setChannelName(String channelName) {
this.channelName = channelName;
}
public String getOnline() {
return online;
}
public void setOnline(String online) {
this.online = online;
}
public String getManufacture() {
return manufacture;
}
public void setManufacture(String manufacture) {
this.manufacture = manufacture;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public String getOwner() {
return owner;
}
public void setOwner(String owner) {
this.owner = owner;
}
public String getCivilCode() {
return civilCode;
}
public void setCivilCode(String civilCode) {
this.civilCode = civilCode;
}
public String getBlock() {
return block;
}
public void setBlock(String block) {
this.block = block;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getParental() {
return parental;
}
public void setParental(String parental) {
this.parental = parental;
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public String getSafetyWay() {
return safetyWay;
}
public void setSafetyWay(String safetyWay) {
this.safetyWay = safetyWay;
}
public String getRegisterWay() {
return registerWay;
}
public void setRegisterWay(String registerWay) {
this.registerWay = registerWay;
}
public String getCertNum() {
return certNum;
}
public void setCertNum(String certNum) {
this.certNum = certNum;
}
public String getCertValid() {
return certValid;
}
public void setCertValid(String certValid) {
this.certValid = certValid;
}
public String getCertErrCode() {
return certErrCode;
}
public void setCertErrCode(String certErrCode) {
this.certErrCode = certErrCode;
}
public String getCertEndTime() {
return certEndTime;
}
public void setCertEndTime(String certEndTime) {
this.certEndTime = certEndTime;
}
public String getSecrecy() {
return secrecy;
}
public void setSecrecy(String secrecy) {
this.secrecy = secrecy;
}
public String getIp() {
return ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public Integer getPort() {
return port;
}
public void setPort(Integer port) {
this.port = port;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public double getLongitude() {
return longitude;
}
public void setLongitude(double longitude) {
this.longitude = longitude;
}
public double getLatitude() {
return latitude;
}
public void setLatitude(double latitude) {
this.latitude = latitude;
}
}

Loading…
Cancel
Save