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

pull/1669/head
648540858 2024-10-30 15:19:17 +08:00
parent b759bdcccd
commit 396961ea20
9 changed files with 143 additions and 309 deletions

View File

@ -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 Boolean recordPushLive = Boolean.TRUE;
private Boolean recordSip = Boolean.TRUE;
private Boolean logInDatabase = Boolean.FALSE;
private Boolean usePushingAsStatus = Boolean.FALSE;
private Boolean useSourceIpAsStreamIp = Boolean.FALSE;
private Boolean sipUseSourceIpAsRemoteAddress = Boolean.FALSE;
private Boolean streamOnDemand = Boolean.TRUE;
private Boolean pushAuthority = Boolean.TRUE;
private Boolean syncChannelOnDeviceOnline = Boolean.FALSE;
private Boolean sipLog = Boolean.FALSE;
private Boolean sqlLog = Boolean.FALSE;
private Boolean sendToPlatformsWhenIdLost = Boolean.FALSE;
private Boolean refuseChannelStatusChannelFormNotify = Boolean.FALSE;
private Boolean deviceStatusNotify = Boolean.TRUE;
private Boolean useCustomSsrcForParentInvite = Boolean.TRUE;
private Boolean docEnable = Boolean.TRUE;
private String serverId = "000000";
private String thirdPartyGBIdReg = "[\\s\\S]*";
private String broadcastForPlatform = "UDP";
private String civilCodeFile = "classpath:civilCode.csv";
/**
* , ,/**
*/
private List<String> interfaceAuthenticationExcludes = new ArrayList<>();
/**
*
*/
private Boolean recordPushLive = Boolean.TRUE;
/**
*
*/
private Boolean recordSip = Boolean.TRUE;
/**
* 使
*/
private Boolean usePushingAsStatus = Boolean.FALSE;
/**
* 使ipstreamIp,zlmwvp
*/
private Boolean useSourceIpAsStreamIp = Boolean.FALSE;
/**
* 使IpIP 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;
/**
* ID000000
*/
private String serverId = "000000";
/**
* * UDP:udp TCP-ACTIVEtcp TCP-PASSIVEtcp
*/
private String broadcastForPlatform = "UDP";
/**
* ,
*/
private String civilCodeFile = "classpath:civilCode.csv";
/**
*
*/
private List<String> allowedOrigins = new ArrayList<>();
/**
* notify486 BUSY_HERE, 100000
*/
private int maxNotifyCountQueue = 100000;
/**
* 线
*/
private int registerAgainAfterTime = 60;
/**
* truefalse使
*/
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;
}
}

View File

@ -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);

View File

@ -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("/#/**");

View File

@ -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()) {

View File

@ -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)) {

View File

@ -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);

View File

@ -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)) {

View File

@ -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;
}
// 查询是否存在推流设备,没有则不发送

View File

@ -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 {