Explorar el Código

策略配置文件增加注释与使用Lombok

648540858 hace 1 año
padre
commit
396961ea20

+ 99 - 264
src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java

@@ -1,5 +1,6 @@
 package com.genersoft.iot.vmp.conf;
 
+import lombok.Data;
 import org.springframework.boot.context.properties.ConfigurationProperties;
 import org.springframework.core.annotation.Order;
 import org.springframework.stereotype.Component;
@@ -13,326 +14,160 @@ import java.util.List;
 @Component
 @ConfigurationProperties(prefix = "user-settings", ignoreInvalidFields = true)
 @Order(0)
+@Data
 public class UserSetting {
 
+    /**
+     * 是否保存位置的历史记录(轨迹)
+     */
     private Boolean savePositionHistory = Boolean.FALSE;
 
+    /**
+     * 是否开始自动点播: 请求流为未拉起的流时,自动开启点播, 需要rtp.enable=true
+     */
     private Boolean autoApplyPlay = Boolean.FALSE;
 
+    /**
+     * [可选] 部分设备需要扩展SDP,需要打开此设置,一般设备无需打开
+     */
     private Boolean seniorSdp = Boolean.FALSE;
 
+    /**
+     * 点播/录像回放 等待超时时间,单位:毫秒
+     */
     private Integer playTimeout = 10000;
 
+    /**
+     * 上级点播等待超时时间,单位:毫秒
+     */
     private int platformPlayTimeout = 20000;
 
+    /**
+     * 是否开启接口鉴权
+     */
     private Boolean interfaceAuthentication = Boolean.TRUE;
 
+    /**
+     * 接口鉴权例外的接口, 即不进行接口鉴权的接口,尽量详细书写,尽量不用/**,至少两级目录
+     */
+    private List<String> interfaceAuthenticationExcludes = new ArrayList<>();
+
+    /**
+     * 推流直播是否录制
+     */
     private Boolean recordPushLive = Boolean.TRUE;
 
+    /**
+     * 国标是否录制
+     */
     private Boolean recordSip = Boolean.TRUE;
 
-    private Boolean logInDatabase = Boolean.FALSE;
-
+    /**
+     * 使用推流状态作为推流通道状态
+     */
     private Boolean usePushingAsStatus = Boolean.FALSE;
 
+    /**
+     * 使用来源请求ip作为streamIp,当且仅当你只有zlm节点它与wvp在一起的情况下开启
+     */
     private Boolean useSourceIpAsStreamIp = Boolean.FALSE;
 
+    /**
+     * 是否使用设备来源Ip作为回复IP, 不设置则为 false
+     */
     private Boolean sipUseSourceIpAsRemoteAddress = Boolean.FALSE;
 
+    /**
+     * 国标点播 按需拉流, true:有人观看拉流,无人观看释放, false:拉起后不自动释放
+     */
     private Boolean streamOnDemand = Boolean.TRUE;
 
+    /**
+     * 推流鉴权, 默认开启
+     */
     private Boolean pushAuthority = Boolean.TRUE;
 
+    /**
+     * 设备上线时是否自动同步通道
+     */
     private Boolean syncChannelOnDeviceOnline = Boolean.FALSE;
 
+    /**
+     * 是否开启sip日志
+     */
     private Boolean sipLog = Boolean.FALSE;
+
+    /**
+     * 是否开启mybatis-sql日志
+     */
     private Boolean sqlLog = Boolean.FALSE;
+
+    /**
+     * 消息通道功能-缺少国标ID是否给所有上级发送消息
+     */
     private Boolean sendToPlatformsWhenIdLost = Boolean.FALSE;
 
+    /**
+     * 保持通道状态,不接受notify通道状态变化, 兼容海康平台发送错误消息
+     */
     private Boolean refuseChannelStatusChannelFormNotify = Boolean.FALSE;
 
+    /**
+     * 设备/通道状态变化时发送消息
+     */
     private Boolean deviceStatusNotify = Boolean.TRUE;
+
+    /**
+     * 上级平台点播时不使用上级平台指定的ssrc,使用自定义的ssrc,参考国标文档-点播外域设备媒体流SSRC处理方式
+     */
     private Boolean useCustomSsrcForParentInvite = Boolean.TRUE;
 
+    /**
+     * 开启接口文档页面。 默认开启,生产环境建议关闭,遇到swagger相关的漏洞时也可以关闭
+     */
     private Boolean docEnable = Boolean.TRUE;
 
+    /**
+     * 服务ID,不写则为000000
+     */
     private String serverId = "000000";
 
-    private String thirdPartyGBIdReg = "[\\s\\S]*";
 
+    /**
+     * 国标级联语音喊话发流模式 * UDP:udp传输 TCP-ACTIVE:tcp主动模式 TCP-PASSIVE:tcp被动模式
+     */
     private String broadcastForPlatform = "UDP";
 
+    /**
+     * 行政区划信息文件,系统启动时会加载到系统里
+     */
     private String civilCodeFile = "classpath:civilCode.csv";
 
-    private List<String> interfaceAuthenticationExcludes = new ArrayList<>();
-
+    /**
+     * 跨域配置,不配置此项则允许所有跨域请求,配置后则只允许配置的页面的地址请求, 可以配置多个
+     */
     private List<String> allowedOrigins = new ArrayList<>();
 
+    /**
+     * 设置notify缓存队列最大长度,超过此长度的数据将返回486 BUSY_HERE,消息丢弃, 默认100000
+     */
     private int maxNotifyCountQueue = 100000;
 
+    /**
+     * 国标级联离线后多久重试一次注册
+     */
     private int registerAgainAfterTime = 60;
 
+    /**
+     * 国标续订方式,true为续订,每次注册在同一个会话里,false为重新注册,每次使用新的会话
+     */
     private boolean registerKeepIntDialog = false;
 
+    /**
+     *     # 国标设备离线后的上线策略,
+     *     # 0: 国标标准实现,设备离线后不回复心跳,直到设备重新注册上线,
+     *     # 1(默认): 对于离线设备,收到心跳就把设备设置为上线,并更新注册时间为上次这次心跳的时间。防止过期时间判断异常
+     */
     private int gbDeviceOnline = 1;
 
-    public Boolean getSavePositionHistory() {
-        return savePositionHistory;
-    }
-
-    public Boolean isSavePositionHistory() {
-        return savePositionHistory;
-    }
-
-    public Boolean isAutoApplyPlay() {
-        return autoApplyPlay;
-    }
-
-    public Boolean isSeniorSdp() {
-        return seniorSdp;
-    }
-
-    public Integer getPlayTimeout() {
-        return playTimeout;
-    }
-
-    public Boolean isInterfaceAuthentication() {
-        return interfaceAuthentication;
-    }
-
-    public Boolean isRecordPushLive() {
-        return recordPushLive;
-    }
-
-    public List<String> getInterfaceAuthenticationExcludes() {
-        return interfaceAuthenticationExcludes;
-    }
-
-    public void setSavePositionHistory(Boolean savePositionHistory) {
-        this.savePositionHistory = savePositionHistory;
-    }
-
-    public void setAutoApplyPlay(Boolean autoApplyPlay) {
-        this.autoApplyPlay = autoApplyPlay;
-    }
-
-    public void setSeniorSdp(Boolean seniorSdp) {
-        this.seniorSdp = seniorSdp;
-    }
-
-    public void setPlayTimeout(Integer playTimeout) {
-        this.playTimeout = playTimeout;
-    }
-
-    public void setInterfaceAuthentication(boolean interfaceAuthentication) {
-        this.interfaceAuthentication = interfaceAuthentication;
-    }
-
-    public void setRecordPushLive(Boolean recordPushLive) {
-        this.recordPushLive = recordPushLive;
-    }
-
-    public void setInterfaceAuthenticationExcludes(List<String> interfaceAuthenticationExcludes) {
-        this.interfaceAuthenticationExcludes = interfaceAuthenticationExcludes;
-    }
-
-    public Boolean getLogInDatabase() {
-        return logInDatabase;
-    }
-
-    public void setLogInDatabase(Boolean logInDatabase) {
-        this.logInDatabase = logInDatabase;
-    }
-
-    public String getServerId() {
-        return serverId;
-    }
-
-    public void setServerId(String serverId) {
-        this.serverId = serverId;
-    }
-
-    public String getThirdPartyGBIdReg() {
-        return thirdPartyGBIdReg;
-    }
-
-    public void setThirdPartyGBIdReg(String thirdPartyGBIdReg) {
-        this.thirdPartyGBIdReg = thirdPartyGBIdReg;
-    }
-
-    public Boolean getRecordSip() {
-        return recordSip;
-    }
-
-    public void setRecordSip(Boolean recordSip) {
-        this.recordSip = recordSip;
-    }
-
-    public int getPlatformPlayTimeout() {
-        return platformPlayTimeout;
-    }
-
-    public void setPlatformPlayTimeout(int platformPlayTimeout) {
-        this.platformPlayTimeout = platformPlayTimeout;
-    }
-
-    public Boolean isUsePushingAsStatus() {
-        return usePushingAsStatus;
-    }
-
-    public void setUsePushingAsStatus(Boolean usePushingAsStatus) {
-        this.usePushingAsStatus = usePushingAsStatus;
-    }
-
-    public Boolean getStreamOnDemand() {
-        return streamOnDemand;
-    }
-
-    public void setStreamOnDemand(Boolean streamOnDemand) {
-        this.streamOnDemand = streamOnDemand;
-    }
-
-    public Boolean getUseSourceIpAsStreamIp() {
-        return useSourceIpAsStreamIp;
-    }
-
-    public void setUseSourceIpAsStreamIp(Boolean useSourceIpAsStreamIp) {
-        this.useSourceIpAsStreamIp = useSourceIpAsStreamIp;
-    }
-
-    public Boolean getPushAuthority() {
-        return pushAuthority;
-    }
-
-    public void setPushAuthority(Boolean pushAuthority) {
-        this.pushAuthority = pushAuthority;
-    }
-
-    public Boolean getSyncChannelOnDeviceOnline() {
-        return syncChannelOnDeviceOnline;
-    }
-
-    public void setSyncChannelOnDeviceOnline(Boolean syncChannelOnDeviceOnline) {
-        this.syncChannelOnDeviceOnline = syncChannelOnDeviceOnline;
-    }
-
-    public String getBroadcastForPlatform() {
-        return broadcastForPlatform;
-    }
-
-    public void setBroadcastForPlatform(String broadcastForPlatform) {
-        this.broadcastForPlatform = broadcastForPlatform;
-    }
-
-    public Boolean getSipUseSourceIpAsRemoteAddress() {
-        return sipUseSourceIpAsRemoteAddress;
-    }
-
-    public void setSipUseSourceIpAsRemoteAddress(Boolean sipUseSourceIpAsRemoteAddress) {
-        this.sipUseSourceIpAsRemoteAddress = sipUseSourceIpAsRemoteAddress;
-    }
-
-    public Boolean getSipLog() {
-        return sipLog;
-    }
-
-    public void setSipLog(Boolean sipLog) {
-        this.sipLog = sipLog;
-    }
-
-    public List<String> getAllowedOrigins() {
-        return allowedOrigins;
-    }
-
-    public void setAllowedOrigins(List<String> allowedOrigins) {
-        this.allowedOrigins = allowedOrigins;
-    }
-
-    public Boolean getSendToPlatformsWhenIdLost() {
-        return sendToPlatformsWhenIdLost;
-    }
-
-    public void setSendToPlatformsWhenIdLost(Boolean sendToPlatformsWhenIdLost) {
-        this.sendToPlatformsWhenIdLost = sendToPlatformsWhenIdLost;
-    }
-
-    public Boolean getRefuseChannelStatusChannelFormNotify() {
-        return refuseChannelStatusChannelFormNotify;
-    }
-
-    public void setRefuseChannelStatusChannelFormNotify(Boolean refuseChannelStatusChannelFormNotify) {
-        this.refuseChannelStatusChannelFormNotify = refuseChannelStatusChannelFormNotify;
-    }
-
-    public int getMaxNotifyCountQueue() {
-        return maxNotifyCountQueue;
-    }
-
-    public void setMaxNotifyCountQueue(int maxNotifyCountQueue) {
-        this.maxNotifyCountQueue = maxNotifyCountQueue;
-    }
-
-    public Boolean getDeviceStatusNotify() {
-        return deviceStatusNotify;
-    }
-
-    public void setDeviceStatusNotify(Boolean deviceStatusNotify) {
-        this.deviceStatusNotify = deviceStatusNotify;
-    }
-
-    public Boolean getUseCustomSsrcForParentInvite() {
-        return useCustomSsrcForParentInvite;
-    }
-
-    public void setUseCustomSsrcForParentInvite(Boolean useCustomSsrcForParentInvite) {
-        this.useCustomSsrcForParentInvite = useCustomSsrcForParentInvite;
-    }
-
-    public Boolean getSqlLog() {
-        return sqlLog;
-    }
-
-    public void setSqlLog(Boolean sqlLog) {
-        this.sqlLog = sqlLog;
-    }
-
-    public String getCivilCodeFile() {
-        return civilCodeFile;
-    }
-
-    public void setCivilCodeFile(String civilCodeFile) {
-        this.civilCodeFile = civilCodeFile;
-    }
-
-    public int getRegisterAgainAfterTime() {
-        return registerAgainAfterTime;
-    }
-
-    public void setRegisterAgainAfterTime(int registerAgainAfterTime) {
-        this.registerAgainAfterTime = registerAgainAfterTime;
-    }
-
-    public boolean isRegisterKeepIntDialog() {
-        return registerKeepIntDialog;
-    }
-
-    public void setRegisterKeepIntDialog(boolean registerKeepIntDialog) {
-        this.registerKeepIntDialog = registerKeepIntDialog;
-    }
-
-    public Boolean getDocEnable() {
-        return docEnable;
-    }
-
-    public void setDocEnable(Boolean docEnable) {
-        this.docEnable = docEnable;
-    }
-
-    public int getGbDeviceOnline() {
-        return gbDeviceOnline;
-    }
-
-    public void setGbDeviceOnline(int gbDeviceOnline) {
-        this.gbDeviceOnline = gbDeviceOnline;
-    }
 }

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/conf/security/JwtAuthenticationFilter.java

@@ -44,7 +44,7 @@ public class JwtAuthenticationFilter extends OncePerRequestFilter {
             return;
         }
 
-        if (!userSetting.isInterfaceAuthentication()) {
+        if (!userSetting.getInterfaceAuthentication()) {
             UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(null, null, new ArrayList<>() );
             SecurityContextHolder.getContext().setAuthentication(token);
             chain.doFilter(request, response);

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/conf/security/WebSecurityConfig.java

@@ -62,7 +62,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
      **/
     @Override
     public void configure(WebSecurity web) {
-        if (userSetting.isInterfaceAuthentication()) {
+        if (userSetting.getInterfaceAuthentication()) {
             ArrayList<String> matchers = new ArrayList<>();
             matchers.add("/");
             matchers.add("/#/**");

+ 0 - 1
src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceChannelServiceImpl.java

@@ -469,7 +469,6 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
         if (CollectionUtils.isEmpty(deviceChannelList)) {
             return false;
         }
-        System.out.println("size: " + deviceChannelList.size());
         List<DeviceChannel> allChannels = channelMapper.queryAllChannelsForRefresh(deviceDbId);
         Map<String,DeviceChannel> allChannelMap = new HashMap<>();
         if (!allChannels.isEmpty()) {

+ 3 - 3
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java

@@ -281,7 +281,7 @@ public class SIPCommander implements ISIPCommander {
         content.append("c=IN IP4 " + sdpIp + "\r\n");
         content.append("t=0 0\r\n");
 
-        if (userSetting.isSeniorSdp()) {
+        if (userSetting.getSeniorSdp()) {
             if ("TCP-PASSIVE".equalsIgnoreCase(device.getStreamMode())) {
                 content.append("m=video " + ssrcInfo.getPort() + " TCP/RTP/AVP 96 126 125 99 34 98 97\r\n");
             } else if ("TCP-ACTIVE".equalsIgnoreCase(device.getStreamMode())) {
@@ -383,7 +383,7 @@ public class SIPCommander implements ISIPCommander {
 
         String streamMode = device.getStreamMode();
 
-        if (userSetting.isSeniorSdp()) {
+        if (userSetting.getSeniorSdp()) {
             if ("TCP-PASSIVE".equalsIgnoreCase(streamMode)) {
                 content.append("m=video " + ssrcInfo.getPort() + " TCP/RTP/AVP 96 126 125 99 34 98 97\r\n");
             } else if ("TCP-ACTIVE".equalsIgnoreCase(streamMode)) {
@@ -472,7 +472,7 @@ public class SIPCommander implements ISIPCommander {
 
         String streamMode = device.getStreamMode().toUpperCase();
 
-        if (userSetting.isSeniorSdp()) {
+        if (userSetting.getSeniorSdp()) {
             if ("TCP-PASSIVE".equals(streamMode)) {
                 content.append("m=video " + ssrcInfo.getPort() + " TCP/RTP/AVP 96 126 125 99 34 98 97\r\n");
             } else if ("TCP-ACTIVE".equals(streamMode)) {

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java

@@ -209,7 +209,7 @@ public class ZLMHttpHookListener {
 
 
         MediaServer mediaServer = mediaServerService.getOne(param.getMediaServerId());
-        if (!userSetting.isAutoApplyPlay() || mediaServer == null) {
+        if (!userSetting.getAutoApplyPlay() || mediaServer == null) {
             return HookResult.SUCCESS();
         }
         MediaNotFoundEvent mediaNotFoundEvent = MediaNotFoundEvent.getInstance(this, param, mediaServer);

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java

@@ -123,7 +123,7 @@ public class MediaServiceImpl implements IMediaService {
         if ("rtp".equals(app)) {
             result.setEnable_mp4(userSetting.getRecordSip());
         } else {
-            result.setEnable_mp4(userSetting.isRecordPushLive());
+            result.setEnable_mp4(userSetting.getRecordPushLive());
         }
         // 国标流
         if ("rtp".equals(app)) {

+ 1 - 1
src/main/java/com/genersoft/iot/vmp/service/redisMsg/RedisPushStreamStatusMsgListener.java

@@ -100,7 +100,7 @@ public class RedisPushStreamStatusMsgListener implements MessageListener, Applic
 
     @Override
     public void run(ApplicationArguments args) throws Exception {
-        if (userSetting.isUsePushingAsStatus()) {
+        if (userSetting.getUsePushingAsStatus()) {
             return;
         }
         // 查询是否存在推流设备,没有则不发送

+ 4 - 4
src/main/java/com/genersoft/iot/vmp/streamPush/service/impl/StreamPushServiceImpl.java

@@ -284,7 +284,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
             mediaServerService.closeStreams(mediaServer, streamPush.getApp(), streamPush.getStream());
         }
         streamPush.setPushing(false);
-        if (userSetting.isUsePushingAsStatus()) {
+        if (userSetting.getUsePushingAsStatus()) {
             CommonGBChannel commonGBChannel = streamPush.buildCommonGBChannel();
             if (commonGBChannel != null) {
                 gbChannelService.offline(commonGBChannel);
@@ -474,7 +474,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
     @Override
     public ResourceBaseInfo getOverview() {
         int total = streamPushMapper.getAllCount();
-        int online = streamPushMapper.getAllPushing(userSetting.isUsePushingAsStatus());
+        int online = streamPushMapper.getAllPushing(userSetting.getUsePushingAsStatus());
 
         return new ResourceBaseInfo(total, online);
     }
@@ -500,7 +500,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
     @Transactional
     public void updatePushStatus(StreamPush streamPush, boolean pushIng) {
         streamPush.setPushing(pushIng);
-        if (userSetting.isUsePushingAsStatus()) {
+        if (userSetting.getUsePushingAsStatus()) {
             streamPush.setGbStatus(pushIng?"ON":"OFF");
         }
         streamPush.setPushTime(DateUtil.getNow());
@@ -508,7 +508,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
         if (ObjectUtils.isEmpty(streamPush.getGbDeviceId())) {
             return;
         }
-        if (userSetting.isUsePushingAsStatus()) {
+        if (userSetting.getUsePushingAsStatus()) {
             if ("ON".equalsIgnoreCase(streamPush.getGbStatus()) ) {
                 gbChannelService.online(streamPush.buildCommonGBChannel());
             }else {