Commit 7e755f405dd1112a201b9dbde7e2d6cff8abc8f4
1 parent
ee490f5b
支持国标移动位置订阅,收到新位置发送redis消息;支持通道redis消息拉起第三方推流;云台控制添加ControlPriority字段;处理sql的bug
Showing
92 changed files
with
1460 additions
and
1068 deletions
sql/update.sql
0 → 100644
src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java
| @@ -70,8 +70,24 @@ public class VideoManagerConstants { | @@ -70,8 +70,24 @@ public class VideoManagerConstants { | ||
| 70 | public static final String SYSTEM_INFO_NET_PREFIX = "VMP_SYSTEM_INFO_NET_"; | 70 | public static final String SYSTEM_INFO_NET_PREFIX = "VMP_SYSTEM_INFO_NET_"; |
| 71 | 71 | ||
| 72 | //************************** redis 消息********************************* | 72 | //************************** redis 消息********************************* |
| 73 | + | ||
| 74 | + // 流变化的通知 | ||
| 73 | public static final String WVP_MSG_STREAM_CHANGE_PREFIX = "WVP_MSG_STREAM_CHANGE_"; | 75 | public static final String WVP_MSG_STREAM_CHANGE_PREFIX = "WVP_MSG_STREAM_CHANGE_"; |
| 74 | - public static final String WVP_MSG_GPS_PREFIX = "VM_MSG_GPS"; | 76 | + |
| 77 | + // 接收推流设备的GPS变化通知 | ||
| 78 | + public static final String VM_MSG_GPS = "VM_MSG_GPS"; | ||
| 79 | + | ||
| 80 | + // redis 消息通知设备推流到平台 | ||
| 81 | + public static final String VM_MSG_STREAM_PUSH_REQUESTED = "VM_MSG_STREAM_PUSH_REQUESTED"; | ||
| 82 | + | ||
| 83 | + // 移动位置订阅通知 | ||
| 84 | + public static final String VM_MSG_SUBSCRIBE_MOBILE_POSITION = "mobileposition"; | ||
| 85 | + | ||
| 86 | + // 报警订阅的通知 | ||
| 87 | + public static final String VM_MSG_SUBSCRIBE_ALARM = "alarm"; | ||
| 88 | + | ||
| 89 | + // 设备状态订阅的通知 | ||
| 90 | + public static final String VM_MSG_SUBSCRIBE_DEVICE_STATUS = "device"; | ||
| 75 | 91 | ||
| 76 | //************************** 第三方 **************************************** | 92 | //************************** 第三方 **************************************** |
| 77 | public static final String WVP_STREAM_GB_ID_PREFIX = "memberNo_"; | 93 | public static final String WVP_STREAM_GB_ID_PREFIX = "memberNo_"; |
src/main/java/com/genersoft/iot/vmp/conf/ApiAccessFilter.java
| @@ -29,7 +29,7 @@ public class ApiAccessFilter extends OncePerRequestFilter { | @@ -29,7 +29,7 @@ public class ApiAccessFilter extends OncePerRequestFilter { | ||
| 29 | private final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | 29 | private final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| 30 | 30 | ||
| 31 | @Autowired | 31 | @Autowired |
| 32 | - private UserSetup userSetup; | 32 | + private UserSetting userSetting; |
| 33 | 33 | ||
| 34 | @Autowired | 34 | @Autowired |
| 35 | private ILogService logService; | 35 | private ILogService logService; |
| @@ -48,7 +48,7 @@ public class ApiAccessFilter extends OncePerRequestFilter { | @@ -48,7 +48,7 @@ public class ApiAccessFilter extends OncePerRequestFilter { | ||
| 48 | 48 | ||
| 49 | filterChain.doFilter(servletRequest, servletResponse); | 49 | filterChain.doFilter(servletRequest, servletResponse); |
| 50 | 50 | ||
| 51 | - if (uriName != null && userSetup.getLogInDatebase()) { | 51 | + if (uriName != null && userSetting.getLogInDatebase()) { |
| 52 | 52 | ||
| 53 | LogDto logDto = new LogDto(); | 53 | LogDto logDto = new LogDto(); |
| 54 | logDto.setName(uriName); | 54 | logDto.setName(uriName); |
src/main/java/com/genersoft/iot/vmp/conf/DynamicTask.java
| @@ -7,6 +7,7 @@ import org.springframework.stereotype.Component; | @@ -7,6 +7,7 @@ import org.springframework.stereotype.Component; | ||
| 7 | 7 | ||
| 8 | import java.util.Date; | 8 | import java.util.Date; |
| 9 | import java.util.Map; | 9 | import java.util.Map; |
| 10 | +import java.util.Set; | ||
| 10 | import java.util.concurrent.ConcurrentHashMap; | 11 | import java.util.concurrent.ConcurrentHashMap; |
| 11 | import java.util.concurrent.ScheduledFuture; | 12 | import java.util.concurrent.ScheduledFuture; |
| 12 | 13 | ||
| @@ -45,12 +46,12 @@ public class DynamicTask { | @@ -45,12 +46,12 @@ public class DynamicTask { | ||
| 45 | * 延时任务 | 46 | * 延时任务 |
| 46 | * @param key 任务ID | 47 | * @param key 任务ID |
| 47 | * @param task 任务 | 48 | * @param task 任务 |
| 48 | - * @param delay 延时 /秒 | 49 | + * @param delay 延时 /毫秒 |
| 49 | * @return | 50 | * @return |
| 50 | */ | 51 | */ |
| 51 | public String startDelay(String key, Runnable task, int delay) { | 52 | public String startDelay(String key, Runnable task, int delay) { |
| 52 | stop(key); | 53 | stop(key); |
| 53 | - Date starTime = new Date(System.currentTimeMillis() + delay * 1000); | 54 | + Date starTime = new Date(System.currentTimeMillis() + delay); |
| 54 | // scheduleWithFixedDelay 必须等待上一个任务结束才开始计时period, cycleForCatalog表示执行的间隔 | 55 | // scheduleWithFixedDelay 必须等待上一个任务结束才开始计时period, cycleForCatalog表示执行的间隔 |
| 55 | ScheduledFuture future = threadPoolTaskScheduler.schedule(task, starTime); | 56 | ScheduledFuture future = threadPoolTaskScheduler.schedule(task, starTime); |
| 56 | futureMap.put(key, future); | 57 | futureMap.put(key, future); |
| @@ -67,4 +68,8 @@ public class DynamicTask { | @@ -67,4 +68,8 @@ public class DynamicTask { | ||
| 67 | return futureMap.get(key) != null; | 68 | return futureMap.get(key) != null; |
| 68 | } | 69 | } |
| 69 | 70 | ||
| 71 | + public Set<String> getAllKeys() { | ||
| 72 | + return futureMap.keySet(); | ||
| 73 | + } | ||
| 74 | + | ||
| 70 | } | 75 | } |
src/main/java/com/genersoft/iot/vmp/conf/RedisConfig.java
| @@ -92,7 +92,7 @@ public class RedisConfig extends CachingConfigurerSupport { | @@ -92,7 +92,7 @@ public class RedisConfig extends CachingConfigurerSupport { | ||
| 92 | 92 | ||
| 93 | RedisMessageListenerContainer container = new RedisMessageListenerContainer(); | 93 | RedisMessageListenerContainer container = new RedisMessageListenerContainer(); |
| 94 | container.setConnectionFactory(connectionFactory); | 94 | container.setConnectionFactory(connectionFactory); |
| 95 | - container.addMessageListener(redisGPSMsgListener, new PatternTopic(VideoManagerConstants.WVP_MSG_GPS_PREFIX)); | 95 | + container.addMessageListener(redisGPSMsgListener, new PatternTopic(VideoManagerConstants.VM_MSG_GPS)); |
| 96 | return container; | 96 | return container; |
| 97 | } | 97 | } |
| 98 | 98 |
src/main/java/com/genersoft/iot/vmp/conf/RedisKeyExpirationEventMessageListener.java
| @@ -3,25 +3,24 @@ package com.genersoft.iot.vmp.conf; | @@ -3,25 +3,24 @@ package com.genersoft.iot.vmp.conf; | ||
| 3 | import org.springframework.data.redis.connection.RedisConnection; | 3 | import org.springframework.data.redis.connection.RedisConnection; |
| 4 | import org.springframework.data.redis.listener.KeyExpirationEventMessageListener; | 4 | import org.springframework.data.redis.listener.KeyExpirationEventMessageListener; |
| 5 | import org.springframework.data.redis.listener.RedisMessageListenerContainer; | 5 | import org.springframework.data.redis.listener.RedisMessageListenerContainer; |
| 6 | -import org.springframework.util.StringUtils; | ||
| 7 | 6 | ||
| 8 | import java.util.Properties; | 7 | import java.util.Properties; |
| 9 | 8 | ||
| 10 | public class RedisKeyExpirationEventMessageListener extends KeyExpirationEventMessageListener { | 9 | public class RedisKeyExpirationEventMessageListener extends KeyExpirationEventMessageListener { |
| 11 | 10 | ||
| 12 | - private UserSetup userSetup; | 11 | + private UserSetting userSetting; |
| 13 | private RedisMessageListenerContainer listenerContainer; | 12 | private RedisMessageListenerContainer listenerContainer; |
| 14 | private String keyspaceNotificationsConfigParameter = "EA"; | 13 | private String keyspaceNotificationsConfigParameter = "EA"; |
| 15 | 14 | ||
| 16 | - public RedisKeyExpirationEventMessageListener(RedisMessageListenerContainer listenerContainer, UserSetup userSetup) { | 15 | + public RedisKeyExpirationEventMessageListener(RedisMessageListenerContainer listenerContainer, UserSetting userSetting) { |
| 17 | super(listenerContainer); | 16 | super(listenerContainer); |
| 18 | this.listenerContainer = listenerContainer; | 17 | this.listenerContainer = listenerContainer; |
| 19 | - this.userSetup = userSetup; | 18 | + this.userSetting = userSetting; |
| 20 | } | 19 | } |
| 21 | 20 | ||
| 22 | @Override | 21 | @Override |
| 23 | public void init() { | 22 | public void init() { |
| 24 | - if (!userSetup.getRedisConfig()) { | 23 | + if (!userSetting.getRedisConfig()) { |
| 25 | // 配置springboot默认Config为空,即不让应用去修改redis的默认配置,因为Redis服务出于安全会禁用CONFIG命令给远程用户使用 | 24 | // 配置springboot默认Config为空,即不让应用去修改redis的默认配置,因为Redis服务出于安全会禁用CONFIG命令给远程用户使用 |
| 26 | setKeyspaceNotificationsConfigParameter(""); | 25 | setKeyspaceNotificationsConfigParameter(""); |
| 27 | }else { | 26 | }else { |
src/main/java/com/genersoft/iot/vmp/conf/SipPlatformRunner.java
| @@ -4,9 +4,8 @@ import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | @@ -4,9 +4,8 @@ import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | ||
| 4 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch; | 4 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch; |
| 5 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | 5 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 6 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; | 6 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; |
| 7 | -import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; | ||
| 8 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 7 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 9 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 8 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | import org.springframework.boot.CommandLineRunner; | 10 | import org.springframework.boot.CommandLineRunner; |
| 12 | import org.springframework.core.annotation.Order; | 11 | import org.springframework.core.annotation.Order; |
| @@ -22,7 +21,7 @@ import java.util.List; | @@ -22,7 +21,7 @@ import java.util.List; | ||
| 22 | public class SipPlatformRunner implements CommandLineRunner { | 21 | public class SipPlatformRunner implements CommandLineRunner { |
| 23 | 22 | ||
| 24 | @Autowired | 23 | @Autowired |
| 25 | - private IVideoManagerStorager storager; | 24 | + private IVideoManagerStorage storager; |
| 26 | 25 | ||
| 27 | @Autowired | 26 | @Autowired |
| 28 | private IRedisCatchStorage redisCatchStorage; | 27 | private IRedisCatchStorage redisCatchStorage; |
src/main/java/com/genersoft/iot/vmp/conf/UserSetup.java renamed to src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java
| @@ -6,10 +6,12 @@ import org.springframework.stereotype.Component; | @@ -6,10 +6,12 @@ import org.springframework.stereotype.Component; | ||
| 6 | import java.util.ArrayList; | 6 | import java.util.ArrayList; |
| 7 | import java.util.List; | 7 | import java.util.List; |
| 8 | 8 | ||
| 9 | - | 9 | +/** |
| 10 | + * 配置文件 user-settings 映射的配置信息 | ||
| 11 | + */ | ||
| 10 | @Component | 12 | @Component |
| 11 | @ConfigurationProperties(prefix = "user-settings", ignoreInvalidFields = true) | 13 | @ConfigurationProperties(prefix = "user-settings", ignoreInvalidFields = true) |
| 12 | -public class UserSetup { | 14 | +public class UserSetting { |
| 13 | 15 | ||
| 14 | private Boolean savePositionHistory = Boolean.FALSE; | 16 | private Boolean savePositionHistory = Boolean.FALSE; |
| 15 | 17 | ||
| @@ -19,6 +21,8 @@ public class UserSetup { | @@ -19,6 +21,8 @@ public class UserSetup { | ||
| 19 | 21 | ||
| 20 | private Long playTimeout = 18000L; | 22 | private Long playTimeout = 18000L; |
| 21 | 23 | ||
| 24 | + private int platformPlayTimeout = 60000; | ||
| 25 | + | ||
| 22 | private Boolean interfaceAuthentication = Boolean.TRUE; | 26 | private Boolean interfaceAuthentication = Boolean.TRUE; |
| 23 | 27 | ||
| 24 | private Boolean recordPushLive = Boolean.TRUE; | 28 | private Boolean recordPushLive = Boolean.TRUE; |
| @@ -134,4 +138,12 @@ public class UserSetup { | @@ -134,4 +138,12 @@ public class UserSetup { | ||
| 134 | public void setRecordSip(Boolean recordSip) { | 138 | public void setRecordSip(Boolean recordSip) { |
| 135 | this.recordSip = recordSip; | 139 | this.recordSip = recordSip; |
| 136 | } | 140 | } |
| 141 | + | ||
| 142 | + public int getPlatformPlayTimeout() { | ||
| 143 | + return platformPlayTimeout; | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + public void setPlatformPlayTimeout(int platformPlayTimeout) { | ||
| 147 | + this.platformPlayTimeout = platformPlayTimeout; | ||
| 148 | + } | ||
| 137 | } | 149 | } |
src/main/java/com/genersoft/iot/vmp/conf/runner/SipDeviceRunner.java
| 1 | package com.genersoft.iot.vmp.conf.runner; | 1 | package com.genersoft.iot.vmp.conf.runner; |
| 2 | 2 | ||
| 3 | -import com.genersoft.iot.vmp.conf.UserSetup; | 3 | +import com.genersoft.iot.vmp.conf.UserSetting; |
| 4 | import com.genersoft.iot.vmp.gb28181.bean.Device; | 4 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 5 | import com.genersoft.iot.vmp.service.IDeviceService; | 5 | import com.genersoft.iot.vmp.service.IDeviceService; |
| 6 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 6 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 7 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 7 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | import org.springframework.boot.CommandLineRunner; | 9 | import org.springframework.boot.CommandLineRunner; |
| 10 | import org.springframework.core.annotation.Order; | 10 | import org.springframework.core.annotation.Order; |
| @@ -21,13 +21,13 @@ import java.util.List; | @@ -21,13 +21,13 @@ import java.util.List; | ||
| 21 | public class SipDeviceRunner implements CommandLineRunner { | 21 | public class SipDeviceRunner implements CommandLineRunner { |
| 22 | 22 | ||
| 23 | @Autowired | 23 | @Autowired |
| 24 | - private IVideoManagerStorager storager; | 24 | + private IVideoManagerStorage storager; |
| 25 | 25 | ||
| 26 | @Autowired | 26 | @Autowired |
| 27 | private IRedisCatchStorage redisCatchStorage; | 27 | private IRedisCatchStorage redisCatchStorage; |
| 28 | 28 | ||
| 29 | @Autowired | 29 | @Autowired |
| 30 | - private UserSetup userSetup; | 30 | + private UserSetting userSetting; |
| 31 | 31 | ||
| 32 | @Autowired | 32 | @Autowired |
| 33 | private IDeviceService deviceService; | 33 | private IDeviceService deviceService; |
| @@ -44,6 +44,7 @@ public class SipDeviceRunner implements CommandLineRunner { | @@ -44,6 +44,7 @@ public class SipDeviceRunner implements CommandLineRunner { | ||
| 44 | if (device != null && device.getSubscribeCycleForCatalog() > 0) { | 44 | if (device != null && device.getSubscribeCycleForCatalog() > 0) { |
| 45 | // 查询在线设备那些开启了订阅,为设备开启定时的目录订阅 | 45 | // 查询在线设备那些开启了订阅,为设备开启定时的目录订阅 |
| 46 | deviceService.addCatalogSubscribe(device); | 46 | deviceService.addCatalogSubscribe(device); |
| 47 | + deviceService.addMobilePositionSubscribe(device); | ||
| 47 | } | 48 | } |
| 48 | } | 49 | } |
| 49 | // 重置cseq计数 | 50 | // 重置cseq计数 |
src/main/java/com/genersoft/iot/vmp/conf/security/WebSecurityConfig.java
| 1 | package com.genersoft.iot.vmp.conf.security; | 1 | package com.genersoft.iot.vmp.conf.security; |
| 2 | 2 | ||
| 3 | -import com.genersoft.iot.vmp.conf.UserSetup; | 3 | +import com.genersoft.iot.vmp.conf.UserSetting; |
| 4 | import org.slf4j.Logger; | 4 | import org.slf4j.Logger; |
| 5 | import org.slf4j.LoggerFactory; | 5 | import org.slf4j.LoggerFactory; |
| 6 | import org.springframework.beans.factory.annotation.Autowired; | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -29,7 +29,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | @@ -29,7 +29,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | ||
| 29 | private final static Logger logger = LoggerFactory.getLogger(WebSecurityConfig.class); | 29 | private final static Logger logger = LoggerFactory.getLogger(WebSecurityConfig.class); |
| 30 | 30 | ||
| 31 | @Autowired | 31 | @Autowired |
| 32 | - private UserSetup userSetup; | 32 | + private UserSetting userSetting; |
| 33 | 33 | ||
| 34 | @Autowired | 34 | @Autowired |
| 35 | private DefaultUserDetailsServiceImpl userDetailsService; | 35 | private DefaultUserDetailsServiceImpl userDetailsService; |
| @@ -77,7 +77,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | @@ -77,7 +77,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | ||
| 77 | @Override | 77 | @Override |
| 78 | public void configure(WebSecurity web) { | 78 | public void configure(WebSecurity web) { |
| 79 | 79 | ||
| 80 | - if (!userSetup.isInterfaceAuthentication()) { | 80 | + if (!userSetting.isInterfaceAuthentication()) { |
| 81 | web.ignoring().antMatchers("**"); | 81 | web.ignoring().antMatchers("**"); |
| 82 | }else { | 82 | }else { |
| 83 | // 可以直接访问的静态数据 | 83 | // 可以直接访问的静态数据 |
| @@ -91,7 +91,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | @@ -91,7 +91,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | ||
| 91 | .antMatchers("/swagger-resources/**") | 91 | .antMatchers("/swagger-resources/**") |
| 92 | .antMatchers("/v3/api-docs/**") | 92 | .antMatchers("/v3/api-docs/**") |
| 93 | .antMatchers("/js/**"); | 93 | .antMatchers("/js/**"); |
| 94 | - List<String> interfaceAuthenticationExcludes = userSetup.getInterfaceAuthenticationExcludes(); | 94 | + List<String> interfaceAuthenticationExcludes = userSetting.getInterfaceAuthenticationExcludes(); |
| 95 | for (String interfaceAuthenticationExclude : interfaceAuthenticationExcludes) { | 95 | for (String interfaceAuthenticationExclude : interfaceAuthenticationExcludes) { |
| 96 | if (interfaceAuthenticationExclude.split("/").length < 4 ) { | 96 | if (interfaceAuthenticationExclude.split("/").length < 4 ) { |
| 97 | logger.warn("{}不满足两级目录,已忽略", interfaceAuthenticationExclude); | 97 | logger.warn("{}不满足两级目录,已忽略", interfaceAuthenticationExclude); |
src/main/java/com/genersoft/iot/vmp/gb28181/auth/RegisterLogicHandler.java
| 1 | package com.genersoft.iot.vmp.gb28181.auth; | 1 | package com.genersoft.iot.vmp.gb28181.auth; |
| 2 | 2 | ||
| 3 | -import com.genersoft.iot.vmp.storager.impl.VideoManagerStoragerImpl; | 3 | +import com.genersoft.iot.vmp.storager.impl.VideoManagerStorageImpl; |
| 4 | import org.slf4j.Logger; | 4 | import org.slf4j.Logger; |
| 5 | import org.slf4j.LoggerFactory; | 5 | import org.slf4j.LoggerFactory; |
| 6 | import org.springframework.beans.factory.annotation.Autowired; | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -23,7 +23,7 @@ public class RegisterLogicHandler { | @@ -23,7 +23,7 @@ public class RegisterLogicHandler { | ||
| 23 | private SIPCommander cmder; | 23 | private SIPCommander cmder; |
| 24 | 24 | ||
| 25 | @Autowired | 25 | @Autowired |
| 26 | - private VideoManagerStoragerImpl storager; | 26 | + private VideoManagerStorageImpl storager; |
| 27 | 27 | ||
| 28 | public void onRegister(Device device) { | 28 | public void onRegister(Device device) { |
| 29 | // 只有第一次注册时调用查询设备信息,如需更新调用更新API接口 | 29 | // 只有第一次注册时调用查询设备信息,如需更新调用更新API接口 |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/Device.java
| @@ -112,8 +112,22 @@ public class Device { | @@ -112,8 +112,22 @@ public class Device { | ||
| 112 | /** | 112 | /** |
| 113 | * 目录订阅周期,0为不订阅 | 113 | * 目录订阅周期,0为不订阅 |
| 114 | */ | 114 | */ |
| 115 | - private int subscribeCycleForCatalog ; | 115 | + private int subscribeCycleForCatalog; |
| 116 | 116 | ||
| 117 | + /** | ||
| 118 | + * 移动设备位置订阅周期,0为不订阅 | ||
| 119 | + */ | ||
| 120 | + private int subscribeCycleForMobilePosition; | ||
| 121 | + | ||
| 122 | + /** | ||
| 123 | + * 移动设备位置信息上报时间间隔,单位:秒,默认值5 | ||
| 124 | + */ | ||
| 125 | + private int mobilePositionSubmissionInterval = 5; | ||
| 126 | + | ||
| 127 | + /** | ||
| 128 | + * 报警订阅周期,0为不订阅 | ||
| 129 | + */ | ||
| 130 | + private int subscribeCycleForAlarm; | ||
| 117 | 131 | ||
| 118 | 132 | ||
| 119 | public String getDeviceId() { | 133 | public String getDeviceId() { |
| @@ -283,4 +297,28 @@ public class Device { | @@ -283,4 +297,28 @@ public class Device { | ||
| 283 | public void setSubscribeCycleForCatalog(int subscribeCycleForCatalog) { | 297 | public void setSubscribeCycleForCatalog(int subscribeCycleForCatalog) { |
| 284 | this.subscribeCycleForCatalog = subscribeCycleForCatalog; | 298 | this.subscribeCycleForCatalog = subscribeCycleForCatalog; |
| 285 | } | 299 | } |
| 300 | + | ||
| 301 | + public int getSubscribeCycleForMobilePosition() { | ||
| 302 | + return subscribeCycleForMobilePosition; | ||
| 303 | + } | ||
| 304 | + | ||
| 305 | + public void setSubscribeCycleForMobilePosition(int subscribeCycleForMobilePosition) { | ||
| 306 | + this.subscribeCycleForMobilePosition = subscribeCycleForMobilePosition; | ||
| 307 | + } | ||
| 308 | + | ||
| 309 | + public int getMobilePositionSubmissionInterval() { | ||
| 310 | + return mobilePositionSubmissionInterval; | ||
| 311 | + } | ||
| 312 | + | ||
| 313 | + public void setMobilePositionSubmissionInterval(int mobilePositionSubmissionInterval) { | ||
| 314 | + this.mobilePositionSubmissionInterval = mobilePositionSubmissionInterval; | ||
| 315 | + } | ||
| 316 | + | ||
| 317 | + public int getSubscribeCycleForAlarm() { | ||
| 318 | + return subscribeCycleForAlarm; | ||
| 319 | + } | ||
| 320 | + | ||
| 321 | + public void setSubscribeCycleForAlarm(int subscribeCycleForAlarm) { | ||
| 322 | + this.subscribeCycleForAlarm = subscribeCycleForAlarm; | ||
| 323 | + } | ||
| 286 | } | 324 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/InviteStreamType.java
0 → 100644
src/main/java/com/genersoft/iot/vmp/gb28181/bean/ParentPlatform.java
| @@ -125,9 +125,9 @@ public class ParentPlatform { | @@ -125,9 +125,9 @@ public class ParentPlatform { | ||
| 125 | private boolean alarmSubscribe; | 125 | private boolean alarmSubscribe; |
| 126 | 126 | ||
| 127 | /** | 127 | /** |
| 128 | - * 已被订阅GPS信息 | 128 | + * 已被订阅移动位置信息 |
| 129 | */ | 129 | */ |
| 130 | - private boolean gpsSubscribe; | 130 | + private boolean mobilePositionSubscribe; |
| 131 | 131 | ||
| 132 | public Integer getId() { | 132 | public Integer getId() { |
| 133 | return id; | 133 | return id; |
| @@ -322,11 +322,11 @@ public class ParentPlatform { | @@ -322,11 +322,11 @@ public class ParentPlatform { | ||
| 322 | this.alarmSubscribe = alarmSubscribe; | 322 | this.alarmSubscribe = alarmSubscribe; |
| 323 | } | 323 | } |
| 324 | 324 | ||
| 325 | - public boolean isGpsSubscribe() { | ||
| 326 | - return gpsSubscribe; | 325 | + public boolean isMobilePositionSubscribe() { |
| 326 | + return mobilePositionSubscribe; | ||
| 327 | } | 327 | } |
| 328 | 328 | ||
| 329 | - public void setGpsSubscribe(boolean gpsSubscribe) { | ||
| 330 | - this.gpsSubscribe = gpsSubscribe; | 329 | + public void setMobilePositionSubscribe(boolean mobilePositionSubscribe) { |
| 330 | + this.mobilePositionSubscribe = mobilePositionSubscribe; | ||
| 331 | } | 331 | } |
| 332 | } | 332 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/bean/SendRtpItem.java
| @@ -77,9 +77,9 @@ public class SendRtpItem { | @@ -77,9 +77,9 @@ public class SendRtpItem { | ||
| 77 | private String CallId; | 77 | private String CallId; |
| 78 | 78 | ||
| 79 | /** | 79 | /** |
| 80 | - * 是否是play, false是playback | 80 | + * 播放类型 |
| 81 | */ | 81 | */ |
| 82 | - private boolean isPlay; | 82 | + private InviteStreamType playType; |
| 83 | 83 | ||
| 84 | private byte[] transaction; | 84 | private byte[] transaction; |
| 85 | 85 | ||
| @@ -197,12 +197,12 @@ public class SendRtpItem { | @@ -197,12 +197,12 @@ public class SendRtpItem { | ||
| 197 | CallId = callId; | 197 | CallId = callId; |
| 198 | } | 198 | } |
| 199 | 199 | ||
| 200 | - public boolean isPlay() { | ||
| 201 | - return isPlay; | 200 | + public InviteStreamType getPlayType() { |
| 201 | + return playType; | ||
| 202 | } | 202 | } |
| 203 | 203 | ||
| 204 | - public void setPlay(boolean play) { | ||
| 205 | - isPlay = play; | 204 | + public void setPlayType(InviteStreamType playType) { |
| 205 | + this.playType = playType; | ||
| 206 | } | 206 | } |
| 207 | 207 | ||
| 208 | public byte[] getTransaction() { | 208 | public byte[] getTransaction() { |
src/main/java/com/genersoft/iot/vmp/gb28181/event/DeviceOffLineDetector.java
| 1 | package com.genersoft.iot.vmp.gb28181.event; | 1 | package com.genersoft.iot.vmp.gb28181.event; |
| 2 | 2 | ||
| 3 | -import com.genersoft.iot.vmp.conf.UserSetup; | 3 | +import com.genersoft.iot.vmp.conf.UserSetting; |
| 4 | import org.springframework.beans.factory.annotation.Autowired; | 4 | import org.springframework.beans.factory.annotation.Autowired; |
| 5 | import org.springframework.stereotype.Component; | 5 | import org.springframework.stereotype.Component; |
| 6 | 6 | ||
| @@ -19,10 +19,10 @@ public class DeviceOffLineDetector { | @@ -19,10 +19,10 @@ public class DeviceOffLineDetector { | ||
| 19 | private RedisUtil redis; | 19 | private RedisUtil redis; |
| 20 | 20 | ||
| 21 | @Autowired | 21 | @Autowired |
| 22 | - private UserSetup userSetup; | 22 | + private UserSetting userSetting; |
| 23 | 23 | ||
| 24 | public boolean isOnline(String deviceId) { | 24 | public boolean isOnline(String deviceId) { |
| 25 | - String key = VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetup.getServerId() + "_" + deviceId; | 25 | + String key = VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetting.getServerId() + "_" + deviceId; |
| 26 | return redis.hasKey(key); | 26 | return redis.hasKey(key); |
| 27 | } | 27 | } |
| 28 | } | 28 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/KeepaliveTimeoutListenerForPlatform.java
| 1 | package com.genersoft.iot.vmp.gb28181.event.offline; | 1 | package com.genersoft.iot.vmp.gb28181.event.offline; |
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.conf.RedisKeyExpirationEventMessageListener; | 3 | import com.genersoft.iot.vmp.conf.RedisKeyExpirationEventMessageListener; |
| 4 | -import com.genersoft.iot.vmp.conf.UserSetup; | 4 | +import com.genersoft.iot.vmp.conf.UserSetting; |
| 5 | import com.genersoft.iot.vmp.gb28181.bean.Device; | 5 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 6 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | 6 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| 7 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; | 7 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; |
| 8 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 8 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 9 | import org.slf4j.Logger; | 9 | import org.slf4j.Logger; |
| 10 | import org.slf4j.LoggerFactory; | 10 | import org.slf4j.LoggerFactory; |
| 11 | -import org.springframework.beans.factory.InitializingBean; | ||
| 12 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| 13 | -import org.springframework.context.annotation.DependsOn; | ||
| 14 | import org.springframework.data.redis.connection.Message; | 12 | import org.springframework.data.redis.connection.Message; |
| 15 | -import org.springframework.data.redis.connection.RedisConnection; | ||
| 16 | -import org.springframework.data.redis.listener.KeyExpirationEventMessageListener; | ||
| 17 | import org.springframework.data.redis.listener.RedisMessageListenerContainer; | 13 | import org.springframework.data.redis.listener.RedisMessageListenerContainer; |
| 18 | import org.springframework.stereotype.Component; | 14 | import org.springframework.stereotype.Component; |
| 19 | 15 | ||
| 20 | import com.genersoft.iot.vmp.common.VideoManagerConstants; | 16 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 21 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | 17 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 22 | -import org.springframework.util.StringUtils; | ||
| 23 | - | ||
| 24 | -import java.util.Properties; | ||
| 25 | 18 | ||
| 26 | /** | 19 | /** |
| 27 | * @description:设备心跳超时监听,借助redis过期特性,进行监听,监听到说明设备心跳超时,发送离线事件 | 20 | * @description:设备心跳超时监听,借助redis过期特性,进行监听,监听到说明设备心跳超时,发送离线事件 |
| @@ -37,16 +30,16 @@ public class KeepaliveTimeoutListenerForPlatform extends RedisKeyExpirationEvent | @@ -37,16 +30,16 @@ public class KeepaliveTimeoutListenerForPlatform extends RedisKeyExpirationEvent | ||
| 37 | private EventPublisher publisher; | 30 | private EventPublisher publisher; |
| 38 | 31 | ||
| 39 | @Autowired | 32 | @Autowired |
| 40 | - private UserSetup userSetup; | 33 | + private UserSetting userSetting; |
| 41 | 34 | ||
| 42 | @Autowired | 35 | @Autowired |
| 43 | private SipSubscribe sipSubscribe; | 36 | private SipSubscribe sipSubscribe; |
| 44 | 37 | ||
| 45 | @Autowired | 38 | @Autowired |
| 46 | - private IVideoManagerStorager storager; | 39 | + private IVideoManagerStorage storager; |
| 47 | 40 | ||
| 48 | - public KeepaliveTimeoutListenerForPlatform(RedisMessageListenerContainer listenerContainer, UserSetup userSetup) { | ||
| 49 | - super(listenerContainer, userSetup); | 41 | + public KeepaliveTimeoutListenerForPlatform(RedisMessageListenerContainer listenerContainer, UserSetting userSetting) { |
| 42 | + super(listenerContainer, userSetting); | ||
| 50 | } | 43 | } |
| 51 | 44 | ||
| 52 | 45 | ||
| @@ -61,10 +54,10 @@ public class KeepaliveTimeoutListenerForPlatform extends RedisKeyExpirationEvent | @@ -61,10 +54,10 @@ public class KeepaliveTimeoutListenerForPlatform extends RedisKeyExpirationEvent | ||
| 61 | String expiredKey = message.toString(); | 54 | String expiredKey = message.toString(); |
| 62 | logger.debug(expiredKey); | 55 | logger.debug(expiredKey); |
| 63 | // 平台心跳到期,需要重发, 判断是否已经多次未收到心跳回复, 多次未收到,则重新发起注册, 注册尝试多次未得到回复,则认为平台离线 | 56 | // 平台心跳到期,需要重发, 判断是否已经多次未收到心跳回复, 多次未收到,则重新发起注册, 注册尝试多次未得到回复,则认为平台离线 |
| 64 | - String PLATFORM_KEEPLIVEKEY_PREFIX = VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetup.getServerId() + "_"; | ||
| 65 | - String PLATFORM_REGISTER_PREFIX = VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetup.getServerId() + "_"; | ||
| 66 | - String KEEPLIVEKEY_PREFIX = VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetup.getServerId() + "_"; | ||
| 67 | - String REGISTER_INFO_PREFIX = VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetup.getServerId() + "_"; | 57 | + String PLATFORM_KEEPLIVEKEY_PREFIX = VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetting.getServerId() + "_"; |
| 58 | + String PLATFORM_REGISTER_PREFIX = VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetting.getServerId() + "_"; | ||
| 59 | + String KEEPLIVEKEY_PREFIX = VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetting.getServerId() + "_"; | ||
| 60 | + String REGISTER_INFO_PREFIX = VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_"; | ||
| 68 | if (expiredKey.startsWith(PLATFORM_KEEPLIVEKEY_PREFIX)) { | 61 | if (expiredKey.startsWith(PLATFORM_KEEPLIVEKEY_PREFIX)) { |
| 69 | String platformGBId = expiredKey.substring(PLATFORM_KEEPLIVEKEY_PREFIX.length(),expiredKey.length()); | 62 | String platformGBId = expiredKey.substring(PLATFORM_KEEPLIVEKEY_PREFIX.length(),expiredKey.length()); |
| 70 | ParentPlatform platform = storager.queryParentPlatByServerGBId(platformGBId); | 63 | ParentPlatform platform = storager.queryParentPlatByServerGBId(platformGBId); |
| @@ -84,12 +77,14 @@ public class KeepaliveTimeoutListenerForPlatform extends RedisKeyExpirationEvent | @@ -84,12 +77,14 @@ public class KeepaliveTimeoutListenerForPlatform extends RedisKeyExpirationEvent | ||
| 84 | publisher.outlineEventPublish(deviceId, KEEPLIVEKEY_PREFIX); | 77 | publisher.outlineEventPublish(deviceId, KEEPLIVEKEY_PREFIX); |
| 85 | } | 78 | } |
| 86 | }else if (expiredKey.startsWith(REGISTER_INFO_PREFIX)) { | 79 | }else if (expiredKey.startsWith(REGISTER_INFO_PREFIX)) { |
| 87 | - String callid = expiredKey.substring(REGISTER_INFO_PREFIX.length()); | ||
| 88 | - SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult(); | ||
| 89 | - eventResult.callId = callid; | ||
| 90 | - eventResult.msg = "注册超时"; | ||
| 91 | - eventResult.type = "register timeout"; | ||
| 92 | - sipSubscribe.getErrorSubscribe(callid).response(eventResult); | 80 | + String callId = expiredKey.substring(REGISTER_INFO_PREFIX.length()); |
| 81 | + if (sipSubscribe.getErrorSubscribe(callId) != null) { | ||
| 82 | + SipSubscribe.EventResult eventResult = new SipSubscribe.EventResult(); | ||
| 83 | + eventResult.callId = callId; | ||
| 84 | + eventResult.msg = "注册超时"; | ||
| 85 | + eventResult.type = "register timeout"; | ||
| 86 | + sipSubscribe.getErrorSubscribe(callId).response(eventResult); | ||
| 87 | + } | ||
| 93 | } | 88 | } |
| 94 | 89 | ||
| 95 | } | 90 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/KeepliveTimeoutListener.java
| 1 | package com.genersoft.iot.vmp.gb28181.event.offline; | 1 | package com.genersoft.iot.vmp.gb28181.event.offline; |
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.conf.RedisKeyExpirationEventMessageListener; | 3 | import com.genersoft.iot.vmp.conf.RedisKeyExpirationEventMessageListener; |
| 4 | -import com.genersoft.iot.vmp.conf.UserSetup; | 4 | +import com.genersoft.iot.vmp.conf.UserSetting; |
| 5 | import org.slf4j.Logger; | 5 | import org.slf4j.Logger; |
| 6 | import org.slf4j.LoggerFactory; | 6 | import org.slf4j.LoggerFactory; |
| 7 | import org.springframework.beans.factory.annotation.Autowired; | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| 8 | -import org.springframework.context.annotation.DependsOn; | ||
| 9 | -import org.springframework.context.annotation.Lazy; | ||
| 10 | import org.springframework.data.redis.connection.Message; | 8 | import org.springframework.data.redis.connection.Message; |
| 11 | -import org.springframework.data.redis.listener.KeyExpirationEventMessageListener; | ||
| 12 | import org.springframework.data.redis.listener.RedisMessageListenerContainer; | 9 | import org.springframework.data.redis.listener.RedisMessageListenerContainer; |
| 13 | import org.springframework.stereotype.Component; | 10 | import org.springframework.stereotype.Component; |
| 14 | 11 | ||
| @@ -29,15 +26,15 @@ public class KeepliveTimeoutListener extends RedisKeyExpirationEventMessageListe | @@ -29,15 +26,15 @@ public class KeepliveTimeoutListener extends RedisKeyExpirationEventMessageListe | ||
| 29 | private EventPublisher publisher; | 26 | private EventPublisher publisher; |
| 30 | 27 | ||
| 31 | @Autowired | 28 | @Autowired |
| 32 | - private UserSetup userSetup; | 29 | + private UserSetting userSetting; |
| 33 | 30 | ||
| 34 | - public KeepliveTimeoutListener(RedisMessageListenerContainer listenerContainer, UserSetup userSetup) { | ||
| 35 | - super(listenerContainer, userSetup); | 31 | + public KeepliveTimeoutListener(RedisMessageListenerContainer listenerContainer, UserSetting userSetting) { |
| 32 | + super(listenerContainer, userSetting); | ||
| 36 | } | 33 | } |
| 37 | 34 | ||
| 38 | @Override | 35 | @Override |
| 39 | public void init() { | 36 | public void init() { |
| 40 | - if (!userSetup.getRedisConfig()) { | 37 | + if (!userSetting.getRedisConfig()) { |
| 41 | // 配置springboot默认Config为空,即不让应用去修改redis的默认配置,因为Redis服务出于安全会禁用CONFIG命令给远程用户使用 | 38 | // 配置springboot默认Config为空,即不让应用去修改redis的默认配置,因为Redis服务出于安全会禁用CONFIG命令给远程用户使用 |
| 42 | setKeyspaceNotificationsConfigParameter(""); | 39 | setKeyspaceNotificationsConfigParameter(""); |
| 43 | } | 40 | } |
| @@ -54,7 +51,7 @@ public class KeepliveTimeoutListener extends RedisKeyExpirationEventMessageListe | @@ -54,7 +51,7 @@ public class KeepliveTimeoutListener extends RedisKeyExpirationEventMessageListe | ||
| 54 | public void onMessage(Message message, byte[] pattern) { | 51 | public void onMessage(Message message, byte[] pattern) { |
| 55 | // 获取失效的key | 52 | // 获取失效的key |
| 56 | String expiredKey = message.toString(); | 53 | String expiredKey = message.toString(); |
| 57 | - String KEEPLIVEKEY_PREFIX = VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetup.getServerId() + "_"; | 54 | + String KEEPLIVEKEY_PREFIX = VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetting.getServerId() + "_"; |
| 58 | if(!expiredKey.startsWith(KEEPLIVEKEY_PREFIX)){ | 55 | if(!expiredKey.startsWith(KEEPLIVEKEY_PREFIX)){ |
| 59 | logger.debug("收到redis过期监听,但开头不是"+KEEPLIVEKEY_PREFIX+",忽略"); | 56 | logger.debug("收到redis过期监听,但开头不是"+KEEPLIVEKEY_PREFIX+",忽略"); |
| 60 | return; | 57 | return; |
src/main/java/com/genersoft/iot/vmp/gb28181/event/offline/OfflineEventListener.java
| 1 | package com.genersoft.iot.vmp.gb28181.event.offline; | 1 | package com.genersoft.iot.vmp.gb28181.event.offline; |
| 2 | 2 | ||
| 3 | -import com.genersoft.iot.vmp.conf.UserSetup; | 3 | +import com.genersoft.iot.vmp.conf.UserSetting; |
| 4 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | 4 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| 5 | import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction; | 5 | import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction; |
| 6 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | 6 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 7 | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; | 7 | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; |
| 8 | import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; | 8 | import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; |
| 9 | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; | 9 | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; |
| 10 | -import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | ||
| 11 | import com.genersoft.iot.vmp.service.IMediaServerService; | 10 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 12 | import org.slf4j.Logger; | 11 | import org.slf4j.Logger; |
| 13 | import org.slf4j.LoggerFactory; | 12 | import org.slf4j.LoggerFactory; |
| 14 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 15 | import org.springframework.context.ApplicationListener; | 14 | import org.springframework.context.ApplicationListener; |
| 16 | -import org.springframework.context.annotation.DependsOn; | ||
| 17 | -import org.springframework.context.annotation.Lazy; | ||
| 18 | import org.springframework.stereotype.Component; | 15 | import org.springframework.stereotype.Component; |
| 19 | 16 | ||
| 20 | import com.genersoft.iot.vmp.common.VideoManagerConstants; | 17 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 21 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 18 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 22 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; | 19 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; |
| 23 | 20 | ||
| 24 | import java.util.List; | 21 | import java.util.List; |
| @@ -36,7 +33,7 @@ public class OfflineEventListener implements ApplicationListener<OfflineEvent> { | @@ -36,7 +33,7 @@ public class OfflineEventListener implements ApplicationListener<OfflineEvent> { | ||
| 36 | private final static Logger logger = LoggerFactory.getLogger(OfflineEventListener.class); | 33 | private final static Logger logger = LoggerFactory.getLogger(OfflineEventListener.class); |
| 37 | 34 | ||
| 38 | @Autowired | 35 | @Autowired |
| 39 | - private IVideoManagerStorager storager; | 36 | + private IVideoManagerStorage storager; |
| 40 | 37 | ||
| 41 | @Autowired | 38 | @Autowired |
| 42 | private VideoStreamSessionManager streamSession; | 39 | private VideoStreamSessionManager streamSession; |
| @@ -45,7 +42,7 @@ public class OfflineEventListener implements ApplicationListener<OfflineEvent> { | @@ -45,7 +42,7 @@ public class OfflineEventListener implements ApplicationListener<OfflineEvent> { | ||
| 45 | private RedisUtil redis; | 42 | private RedisUtil redis; |
| 46 | 43 | ||
| 47 | @Autowired | 44 | @Autowired |
| 48 | - private UserSetup userSetup; | 45 | + private UserSetting userSetting; |
| 49 | 46 | ||
| 50 | @Autowired | 47 | @Autowired |
| 51 | private EventPublisher eventPublisher; | 48 | private EventPublisher eventPublisher; |
| @@ -65,7 +62,7 @@ public class OfflineEventListener implements ApplicationListener<OfflineEvent> { | @@ -65,7 +62,7 @@ public class OfflineEventListener implements ApplicationListener<OfflineEvent> { | ||
| 65 | logger.debug("设备离线事件触发,deviceId:" + event.getDeviceId() + ",from:" + event.getFrom()); | 62 | logger.debug("设备离线事件触发,deviceId:" + event.getDeviceId() + ",from:" + event.getFrom()); |
| 66 | } | 63 | } |
| 67 | 64 | ||
| 68 | - String key = VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetup.getServerId() + "_" + event.getDeviceId(); | 65 | + String key = VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetting.getServerId() + "_" + event.getDeviceId(); |
| 69 | 66 | ||
| 70 | switch (event.getFrom()) { | 67 | switch (event.getFrom()) { |
| 71 | // 心跳超时触发的离线事件,说明redis中已删除,无需处理 | 68 | // 心跳超时触发的离线事件,说明redis中已删除,无需处理 |
src/main/java/com/genersoft/iot/vmp/gb28181/event/online/OnlineEventListener.java
| 1 | package com.genersoft.iot.vmp.gb28181.event.online; | 1 | package com.genersoft.iot.vmp.gb28181.event.online; |
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.conf.SipConfig; | 3 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 4 | -import com.genersoft.iot.vmp.conf.UserSetup; | 4 | +import com.genersoft.iot.vmp.conf.UserSetting; |
| 5 | import com.genersoft.iot.vmp.gb28181.bean.Device; | 5 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 6 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | 6 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| 7 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | 7 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 8 | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; | 8 | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; |
| 9 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | 9 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| 10 | import com.genersoft.iot.vmp.service.IDeviceService; | 10 | import com.genersoft.iot.vmp.service.IDeviceService; |
| 11 | -import com.genersoft.iot.vmp.storager.dao.dto.User; | ||
| 12 | import org.slf4j.Logger; | 11 | import org.slf4j.Logger; |
| 13 | import org.slf4j.LoggerFactory; | 12 | import org.slf4j.LoggerFactory; |
| 14 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -16,7 +15,7 @@ import org.springframework.context.ApplicationListener; | @@ -16,7 +15,7 @@ import org.springframework.context.ApplicationListener; | ||
| 16 | import org.springframework.stereotype.Component; | 15 | import org.springframework.stereotype.Component; |
| 17 | 16 | ||
| 18 | import com.genersoft.iot.vmp.common.VideoManagerConstants; | 17 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 19 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 18 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 20 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; | 19 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; |
| 21 | 20 | ||
| 22 | import java.text.SimpleDateFormat; | 21 | import java.text.SimpleDateFormat; |
| @@ -35,7 +34,7 @@ public class OnlineEventListener implements ApplicationListener<OnlineEvent> { | @@ -35,7 +34,7 @@ public class OnlineEventListener implements ApplicationListener<OnlineEvent> { | ||
| 35 | private final static Logger logger = LoggerFactory.getLogger(OnlineEventListener.class); | 34 | private final static Logger logger = LoggerFactory.getLogger(OnlineEventListener.class); |
| 36 | 35 | ||
| 37 | @Autowired | 36 | @Autowired |
| 38 | - private IVideoManagerStorager storager; | 37 | + private IVideoManagerStorage storager; |
| 39 | 38 | ||
| 40 | @Autowired | 39 | @Autowired |
| 41 | private IDeviceService deviceService; | 40 | private IDeviceService deviceService; |
| @@ -47,7 +46,7 @@ public class OnlineEventListener implements ApplicationListener<OnlineEvent> { | @@ -47,7 +46,7 @@ public class OnlineEventListener implements ApplicationListener<OnlineEvent> { | ||
| 47 | private SipConfig sipConfig; | 46 | private SipConfig sipConfig; |
| 48 | 47 | ||
| 49 | @Autowired | 48 | @Autowired |
| 50 | - private UserSetup userSetup; | 49 | + private UserSetting userSetting; |
| 51 | 50 | ||
| 52 | @Autowired | 51 | @Autowired |
| 53 | private EventPublisher eventPublisher; | 52 | private EventPublisher eventPublisher; |
| @@ -65,7 +64,7 @@ public class OnlineEventListener implements ApplicationListener<OnlineEvent> { | @@ -65,7 +64,7 @@ public class OnlineEventListener implements ApplicationListener<OnlineEvent> { | ||
| 65 | } | 64 | } |
| 66 | Device device = event.getDevice(); | 65 | Device device = event.getDevice(); |
| 67 | if (device == null) return; | 66 | if (device == null) return; |
| 68 | - String key = VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetup.getServerId() + "_" + event.getDevice().getDeviceId(); | 67 | + String key = VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetting.getServerId() + "_" + event.getDevice().getDeviceId(); |
| 69 | Device deviceInStore = storager.queryVideoDevice(device.getDeviceId()); | 68 | Device deviceInStore = storager.queryVideoDevice(device.getDeviceId()); |
| 70 | device.setOnline(1); | 69 | device.setOnline(1); |
| 71 | switch (event.getFrom()) { | 70 | switch (event.getFrom()) { |
| @@ -103,6 +102,7 @@ public class OnlineEventListener implements ApplicationListener<OnlineEvent> { | @@ -103,6 +102,7 @@ public class OnlineEventListener implements ApplicationListener<OnlineEvent> { | ||
| 103 | // 上线添加订阅 | 102 | // 上线添加订阅 |
| 104 | if (device.getSubscribeCycleForCatalog() > 0) { | 103 | if (device.getSubscribeCycleForCatalog() > 0) { |
| 105 | deviceService.addCatalogSubscribe(device); | 104 | deviceService.addCatalogSubscribe(device); |
| 105 | + deviceService.addMobilePositionSubscribe(device); | ||
| 106 | } | 106 | } |
| 107 | } | 107 | } |
| 108 | } | 108 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/event/platformKeepaliveExpire/PlatformKeepaliveExpireEventLister.java
| @@ -6,7 +6,7 @@ import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | @@ -6,7 +6,7 @@ import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | ||
| 6 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; | 6 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; |
| 7 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; | 7 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; |
| 8 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 8 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 9 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 9 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 10 | import org.jetbrains.annotations.NotNull; | 10 | import org.jetbrains.annotations.NotNull; |
| 11 | import org.slf4j.Logger; | 11 | import org.slf4j.Logger; |
| 12 | import org.slf4j.LoggerFactory; | 12 | import org.slf4j.LoggerFactory; |
| @@ -14,7 +14,6 @@ import org.springframework.beans.factory.annotation.Autowired; | @@ -14,7 +14,6 @@ import org.springframework.beans.factory.annotation.Autowired; | ||
| 14 | import org.springframework.context.ApplicationListener; | 14 | import org.springframework.context.ApplicationListener; |
| 15 | import org.springframework.stereotype.Component; | 15 | import org.springframework.stereotype.Component; |
| 16 | 16 | ||
| 17 | -import javax.sip.ResponseEvent; | ||
| 18 | import javax.sip.message.Response; | 17 | import javax.sip.message.Response; |
| 19 | 18 | ||
| 20 | /** | 19 | /** |
| @@ -29,7 +28,7 @@ public class PlatformKeepaliveExpireEventLister implements ApplicationListener<P | @@ -29,7 +28,7 @@ public class PlatformKeepaliveExpireEventLister implements ApplicationListener<P | ||
| 29 | private final static Logger logger = LoggerFactory.getLogger(PlatformKeepaliveExpireEventLister.class); | 28 | private final static Logger logger = LoggerFactory.getLogger(PlatformKeepaliveExpireEventLister.class); |
| 30 | 29 | ||
| 31 | @Autowired | 30 | @Autowired |
| 32 | - private IVideoManagerStorager storager; | 31 | + private IVideoManagerStorage storager; |
| 33 | 32 | ||
| 34 | @Autowired | 33 | @Autowired |
| 35 | private IRedisCatchStorage redisCatchStorage; | 34 | private IRedisCatchStorage redisCatchStorage; |
src/main/java/com/genersoft/iot/vmp/gb28181/event/platformNotRegister/PlatformCycleRegisterEventLister.java
| @@ -3,7 +3,7 @@ package com.genersoft.iot.vmp.gb28181.event.platformNotRegister; | @@ -3,7 +3,7 @@ package com.genersoft.iot.vmp.gb28181.event.platformNotRegister; | ||
| 3 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | 3 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| 4 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; | 4 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; |
| 5 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; | 5 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; |
| 6 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 6 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 7 | import org.slf4j.Logger; | 7 | import org.slf4j.Logger; |
| 8 | import org.slf4j.LoggerFactory; | 8 | import org.slf4j.LoggerFactory; |
| 9 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -19,7 +19,7 @@ public class PlatformCycleRegisterEventLister implements ApplicationListener<Pla | @@ -19,7 +19,7 @@ public class PlatformCycleRegisterEventLister implements ApplicationListener<Pla | ||
| 19 | private final static Logger logger = LoggerFactory.getLogger(PlatformCycleRegisterEventLister.class); | 19 | private final static Logger logger = LoggerFactory.getLogger(PlatformCycleRegisterEventLister.class); |
| 20 | 20 | ||
| 21 | @Autowired | 21 | @Autowired |
| 22 | - private IVideoManagerStorager storager; | 22 | + private IVideoManagerStorage storager; |
| 23 | @Autowired | 23 | @Autowired |
| 24 | private ISIPCommanderForPlatform sipCommanderFroPlatform; | 24 | private ISIPCommanderForPlatform sipCommanderFroPlatform; |
| 25 | 25 |
src/main/java/com/genersoft/iot/vmp/gb28181/event/platformNotRegister/PlatformNotRegisterEventLister.java
| @@ -9,7 +9,7 @@ import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; | @@ -9,7 +9,7 @@ import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; | ||
| 9 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | 9 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 10 | import com.genersoft.iot.vmp.service.IMediaServerService; | 10 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 11 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 11 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 12 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 12 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 13 | import org.slf4j.Logger; | 13 | import org.slf4j.Logger; |
| 14 | import org.slf4j.LoggerFactory; | 14 | import org.slf4j.LoggerFactory; |
| 15 | import org.springframework.beans.factory.annotation.Autowired; | 15 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -31,7 +31,7 @@ public class PlatformNotRegisterEventLister implements ApplicationListener<Platf | @@ -31,7 +31,7 @@ public class PlatformNotRegisterEventLister implements ApplicationListener<Platf | ||
| 31 | private final static Logger logger = LoggerFactory.getLogger(PlatformNotRegisterEventLister.class); | 31 | private final static Logger logger = LoggerFactory.getLogger(PlatformNotRegisterEventLister.class); |
| 32 | 32 | ||
| 33 | @Autowired | 33 | @Autowired |
| 34 | - private IVideoManagerStorager storager; | 34 | + private IVideoManagerStorage storager; |
| 35 | @Autowired | 35 | @Autowired |
| 36 | private IRedisCatchStorage redisCatchStorage; | 36 | private IRedisCatchStorage redisCatchStorage; |
| 37 | @Autowired | 37 | @Autowired |
src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/SubscribeListenerForPlatform.java
| @@ -3,7 +3,7 @@ package com.genersoft.iot.vmp.gb28181.event.subscribe; | @@ -3,7 +3,7 @@ package com.genersoft.iot.vmp.gb28181.event.subscribe; | ||
| 3 | import com.genersoft.iot.vmp.common.VideoManagerConstants; | 3 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 4 | import com.genersoft.iot.vmp.conf.DynamicTask; | 4 | import com.genersoft.iot.vmp.conf.DynamicTask; |
| 5 | import com.genersoft.iot.vmp.conf.RedisKeyExpirationEventMessageListener; | 5 | import com.genersoft.iot.vmp.conf.RedisKeyExpirationEventMessageListener; |
| 6 | -import com.genersoft.iot.vmp.conf.UserSetup; | 6 | +import com.genersoft.iot.vmp.conf.UserSetting; |
| 7 | import org.slf4j.Logger; | 7 | import org.slf4j.Logger; |
| 8 | import org.slf4j.LoggerFactory; | 8 | import org.slf4j.LoggerFactory; |
| 9 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -20,13 +20,13 @@ public class SubscribeListenerForPlatform extends RedisKeyExpirationEventMessage | @@ -20,13 +20,13 @@ public class SubscribeListenerForPlatform extends RedisKeyExpirationEventMessage | ||
| 20 | private Logger logger = LoggerFactory.getLogger(SubscribeListenerForPlatform.class); | 20 | private Logger logger = LoggerFactory.getLogger(SubscribeListenerForPlatform.class); |
| 21 | 21 | ||
| 22 | @Autowired | 22 | @Autowired |
| 23 | - private UserSetup userSetup; | 23 | + private UserSetting userSetting; |
| 24 | 24 | ||
| 25 | @Autowired | 25 | @Autowired |
| 26 | private DynamicTask dynamicTask; | 26 | private DynamicTask dynamicTask; |
| 27 | 27 | ||
| 28 | - public SubscribeListenerForPlatform(RedisMessageListenerContainer listenerContainer, UserSetup userSetup) { | ||
| 29 | - super(listenerContainer, userSetup); | 28 | + public SubscribeListenerForPlatform(RedisMessageListenerContainer listenerContainer, UserSetting userSetting) { |
| 29 | + super(listenerContainer, userSetting); | ||
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | 32 | ||
| @@ -41,7 +41,7 @@ public class SubscribeListenerForPlatform extends RedisKeyExpirationEventMessage | @@ -41,7 +41,7 @@ public class SubscribeListenerForPlatform extends RedisKeyExpirationEventMessage | ||
| 41 | String expiredKey = message.toString(); | 41 | String expiredKey = message.toString(); |
| 42 | logger.debug(expiredKey); | 42 | logger.debug(expiredKey); |
| 43 | // 订阅到期 | 43 | // 订阅到期 |
| 44 | - String PLATFORM_KEEPLIVEKEY_PREFIX = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_"; | 44 | + String PLATFORM_KEEPLIVEKEY_PREFIX = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetting.getServerId() + "_"; |
| 45 | if (expiredKey.startsWith(PLATFORM_KEEPLIVEKEY_PREFIX)) { | 45 | if (expiredKey.startsWith(PLATFORM_KEEPLIVEKEY_PREFIX)) { |
| 46 | // 取消定时任务 | 46 | // 取消定时任务 |
| 47 | dynamicTask.stop(expiredKey); | 47 | dynamicTask.stop(expiredKey); |
src/main/java/com/genersoft/iot/vmp/gb28181/event/subscribe/catalog/CatalogEventLister.java
| @@ -2,17 +2,14 @@ package com.genersoft.iot.vmp.gb28181.event.subscribe.catalog; | @@ -2,17 +2,14 @@ package com.genersoft.iot.vmp.gb28181.event.subscribe.catalog; | ||
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.common.VideoManagerConstants; | 3 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 4 | import com.genersoft.iot.vmp.conf.SipConfig; | 4 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 5 | -import com.genersoft.iot.vmp.conf.UserSetup; | 5 | +import com.genersoft.iot.vmp.conf.UserSetting; |
| 6 | import com.genersoft.iot.vmp.gb28181.bean.*; | 6 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 7 | -import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; | ||
| 8 | -import com.genersoft.iot.vmp.gb28181.event.platformNotRegister.PlatformNotRegisterEvent; | ||
| 9 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; | 7 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; |
| 10 | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; | 8 | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; |
| 11 | -import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | ||
| 12 | import com.genersoft.iot.vmp.service.IGbStreamService; | 9 | import com.genersoft.iot.vmp.service.IGbStreamService; |
| 13 | import com.genersoft.iot.vmp.service.IMediaServerService; | 10 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 14 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 11 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 15 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 12 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 16 | import org.slf4j.Logger; | 13 | import org.slf4j.Logger; |
| 17 | import org.slf4j.LoggerFactory; | 14 | import org.slf4j.LoggerFactory; |
| 18 | import org.springframework.beans.factory.annotation.Autowired; | 15 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -31,7 +28,7 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> { | @@ -31,7 +28,7 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> { | ||
| 31 | private final static Logger logger = LoggerFactory.getLogger(CatalogEventLister.class); | 28 | private final static Logger logger = LoggerFactory.getLogger(CatalogEventLister.class); |
| 32 | 29 | ||
| 33 | @Autowired | 30 | @Autowired |
| 34 | - private IVideoManagerStorager storager; | 31 | + private IVideoManagerStorage storager; |
| 35 | @Autowired | 32 | @Autowired |
| 36 | private IRedisCatchStorage redisCatchStorage; | 33 | private IRedisCatchStorage redisCatchStorage; |
| 37 | @Autowired | 34 | @Autowired |
| @@ -47,7 +44,7 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> { | @@ -47,7 +44,7 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> { | ||
| 47 | private SipConfig config; | 44 | private SipConfig config; |
| 48 | 45 | ||
| 49 | @Autowired | 46 | @Autowired |
| 50 | - private UserSetup userSetup; | 47 | + private UserSetting userSetting; |
| 51 | 48 | ||
| 52 | @Autowired | 49 | @Autowired |
| 53 | private IGbStreamService gbStreamService; | 50 | private IGbStreamService gbStreamService; |
| @@ -64,7 +61,7 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> { | @@ -64,7 +61,7 @@ public class CatalogEventLister implements ApplicationListener<CatalogEvent> { | ||
| 64 | if (event.getPlatformId() != null) { | 61 | if (event.getPlatformId() != null) { |
| 65 | parentPlatform = storager.queryParentPlatByServerGBId(event.getPlatformId()); | 62 | parentPlatform = storager.queryParentPlatByServerGBId(event.getPlatformId()); |
| 66 | if (parentPlatform != null && !parentPlatform.isStatus())return; | 63 | if (parentPlatform != null && !parentPlatform.isStatus())return; |
| 67 | - String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_Catalog_" + event.getPlatformId(); | 64 | + String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetting.getServerId() + "_Catalog_" + event.getPlatformId(); |
| 68 | // subscribe = redisCatchStorage.getSubscribe(key); | 65 | // subscribe = redisCatchStorage.getSubscribe(key); |
| 69 | subscribe = subscribeHolder.getCatalogSubscribe(event.getPlatformId()); | 66 | subscribe = subscribeHolder.getCatalogSubscribe(event.getPlatformId()); |
| 70 | 67 |
src/main/java/com/genersoft/iot/vmp/gb28181/session/CatalogDataCatch.java
| @@ -5,7 +5,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device; | @@ -5,7 +5,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device; | ||
| 5 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | 5 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| 6 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | 6 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 7 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; | 7 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| 8 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 8 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 9 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | 9 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | import org.springframework.scheduling.annotation.Scheduled; | 11 | import org.springframework.scheduling.annotation.Scheduled; |
| @@ -23,7 +23,7 @@ public class CatalogDataCatch { | @@ -23,7 +23,7 @@ public class CatalogDataCatch { | ||
| 23 | private DeferredResultHolder deferredResultHolder; | 23 | private DeferredResultHolder deferredResultHolder; |
| 24 | 24 | ||
| 25 | @Autowired | 25 | @Autowired |
| 26 | - private IVideoManagerStorager storager; | 26 | + private IVideoManagerStorage storager; |
| 27 | 27 | ||
| 28 | public void put(String key, int total, Device device, List<DeviceChannel> deviceChannelList) { | 28 | public void put(String key, int total, Device device, List<DeviceChannel> deviceChannelList) { |
| 29 | CatalogData catalogData = data.get(key); | 29 | CatalogData catalogData = data.get(key); |
src/main/java/com/genersoft/iot/vmp/gb28181/session/VideoStreamSessionManager.java
| @@ -7,7 +7,7 @@ import javax.sip.ClientTransaction; | @@ -7,7 +7,7 @@ import javax.sip.ClientTransaction; | ||
| 7 | import javax.sip.Dialog; | 7 | import javax.sip.Dialog; |
| 8 | 8 | ||
| 9 | import com.genersoft.iot.vmp.common.VideoManagerConstants; | 9 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 10 | -import com.genersoft.iot.vmp.conf.UserSetup; | 10 | +import com.genersoft.iot.vmp.conf.UserSetting; |
| 11 | import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction; | 11 | import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction; |
| 12 | import com.genersoft.iot.vmp.utils.SerializeUtils; | 12 | import com.genersoft.iot.vmp.utils.SerializeUtils; |
| 13 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; | 13 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; |
| @@ -28,7 +28,7 @@ public class VideoStreamSessionManager { | @@ -28,7 +28,7 @@ public class VideoStreamSessionManager { | ||
| 28 | private RedisUtil redisUtil; | 28 | private RedisUtil redisUtil; |
| 29 | 29 | ||
| 30 | @Autowired | 30 | @Autowired |
| 31 | - private UserSetup userSetup; | 31 | + private UserSetting userSetting; |
| 32 | 32 | ||
| 33 | public enum SessionType { | 33 | public enum SessionType { |
| 34 | play, | 34 | play, |
| @@ -58,9 +58,9 @@ public class VideoStreamSessionManager { | @@ -58,9 +58,9 @@ public class VideoStreamSessionManager { | ||
| 58 | ssrcTransaction.setMediaServerId(mediaServerId); | 58 | ssrcTransaction.setMediaServerId(mediaServerId); |
| 59 | ssrcTransaction.setType(type); | 59 | ssrcTransaction.setType(type); |
| 60 | 60 | ||
| 61 | - redisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetup.getServerId() | 61 | + redisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() |
| 62 | + "_" + deviceId + "_" + channelId + "_" + callId + "_" + stream, ssrcTransaction); | 62 | + "_" + deviceId + "_" + channelId + "_" + callId + "_" + stream, ssrcTransaction); |
| 63 | - redisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetup.getServerId() | 63 | + redisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() |
| 64 | + "_" + deviceId + "_" + channelId + "_" + callId + "_" + stream, ssrcTransaction); | 64 | + "_" + deviceId + "_" + channelId + "_" + callId + "_" + stream, ssrcTransaction); |
| 65 | } | 65 | } |
| 66 | 66 | ||
| @@ -70,7 +70,7 @@ public class VideoStreamSessionManager { | @@ -70,7 +70,7 @@ public class VideoStreamSessionManager { | ||
| 70 | byte[] dialogByteArray = SerializeUtils.serialize(dialog); | 70 | byte[] dialogByteArray = SerializeUtils.serialize(dialog); |
| 71 | ssrcTransaction.setDialog(dialogByteArray); | 71 | ssrcTransaction.setDialog(dialogByteArray); |
| 72 | } | 72 | } |
| 73 | - redisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetup.getServerId() | 73 | + redisUtil.set(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() |
| 74 | + "_" + deviceId + "_" + channelId + "_" + ssrcTransaction.getCallId() + "_" | 74 | + "_" + deviceId + "_" + channelId + "_" + ssrcTransaction.getCallId() + "_" |
| 75 | + ssrcTransaction.getStream(), ssrcTransaction); | 75 | + ssrcTransaction.getStream(), ssrcTransaction); |
| 76 | } | 76 | } |
| @@ -105,7 +105,7 @@ public class VideoStreamSessionManager { | @@ -105,7 +105,7 @@ public class VideoStreamSessionManager { | ||
| 105 | public SsrcTransaction getSsrcTransaction(String deviceId, String channelId, String callId, String stream){ | 105 | public SsrcTransaction getSsrcTransaction(String deviceId, String channelId, String callId, String stream){ |
| 106 | if (StringUtils.isEmpty(callId)) callId ="*"; | 106 | if (StringUtils.isEmpty(callId)) callId ="*"; |
| 107 | if (StringUtils.isEmpty(stream)) stream ="*"; | 107 | if (StringUtils.isEmpty(stream)) stream ="*"; |
| 108 | - String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetup.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId+ "_" + stream; | 108 | + String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId+ "_" + stream; |
| 109 | List<Object> scanResult = redisUtil.scan(key); | 109 | List<Object> scanResult = redisUtil.scan(key); |
| 110 | if (scanResult.size() == 0) return null; | 110 | if (scanResult.size() == 0) return null; |
| 111 | return (SsrcTransaction)redisUtil.get((String) scanResult.get(0)); | 111 | return (SsrcTransaction)redisUtil.get((String) scanResult.get(0)); |
| @@ -116,7 +116,7 @@ public class VideoStreamSessionManager { | @@ -116,7 +116,7 @@ public class VideoStreamSessionManager { | ||
| 116 | if (StringUtils.isEmpty(channelId)) channelId ="*"; | 116 | if (StringUtils.isEmpty(channelId)) channelId ="*"; |
| 117 | if (StringUtils.isEmpty(callId)) callId ="*"; | 117 | if (StringUtils.isEmpty(callId)) callId ="*"; |
| 118 | if (StringUtils.isEmpty(stream)) stream ="*"; | 118 | if (StringUtils.isEmpty(stream)) stream ="*"; |
| 119 | - String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetup.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId+ "_" + stream; | 119 | + String key = VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" + deviceId + "_" + channelId + "_" + callId+ "_" + stream; |
| 120 | List<Object> scanResult = redisUtil.scan(key); | 120 | List<Object> scanResult = redisUtil.scan(key); |
| 121 | if (scanResult.size() == 0) return null; | 121 | if (scanResult.size() == 0) return null; |
| 122 | List<SsrcTransaction> result = new ArrayList<>(); | 122 | List<SsrcTransaction> result = new ArrayList<>(); |
| @@ -141,13 +141,13 @@ public class VideoStreamSessionManager { | @@ -141,13 +141,13 @@ public class VideoStreamSessionManager { | ||
| 141 | public void remove(String deviceId, String channelId, String stream) { | 141 | public void remove(String deviceId, String channelId, String stream) { |
| 142 | SsrcTransaction ssrcTransaction = getSsrcTransaction(deviceId, channelId, null, stream); | 142 | SsrcTransaction ssrcTransaction = getSsrcTransaction(deviceId, channelId, null, stream); |
| 143 | if (ssrcTransaction == null) return; | 143 | if (ssrcTransaction == null) return; |
| 144 | - redisUtil.del(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetup.getServerId() + "_" | 144 | + redisUtil.del(VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX + userSetting.getServerId() + "_" |
| 145 | + deviceId + "_" + channelId + "_" + ssrcTransaction.getCallId() + "_" + ssrcTransaction.getStream()); | 145 | + deviceId + "_" + channelId + "_" + ssrcTransaction.getCallId() + "_" + ssrcTransaction.getStream()); |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | 148 | ||
| 149 | public List<SsrcTransaction> getAllSsrc() { | 149 | public List<SsrcTransaction> getAllSsrc() { |
| 150 | - List<Object> ssrcTransactionKeys = redisUtil.scan(String.format("%s_*_*_*_*", VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX+ userSetup.getServerId() + "_" )); | 150 | + List<Object> ssrcTransactionKeys = redisUtil.scan(String.format("%s_*_*_*_*", VideoManagerConstants.MEDIA_TRANSACTION_USED_PREFIX+ userSetting.getServerId() + "_" )); |
| 151 | List<SsrcTransaction> result= new ArrayList<>(); | 151 | List<SsrcTransaction> result= new ArrayList<>(); |
| 152 | for (int i = 0; i < ssrcTransactionKeys.size(); i++) { | 152 | for (int i = 0; i < ssrcTransactionKeys.size(); i++) { |
| 153 | String key = (String)ssrcTransactionKeys.get(i); | 153 | String key = (String)ssrcTransactionKeys.get(i); |
src/main/java/com/genersoft/iot/vmp/gb28181/task/GPSSubscribeTask.java
| 1 | package com.genersoft.iot.vmp.gb28181.task; | 1 | package com.genersoft.iot.vmp.gb28181.task; |
| 2 | 2 | ||
| 3 | +import com.alibaba.fastjson.JSON; | ||
| 3 | import com.genersoft.iot.vmp.gb28181.bean.GbStream; | 4 | import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| 4 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | 5 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| 5 | import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder; | 6 | import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder; |
| @@ -7,7 +8,7 @@ import com.genersoft.iot.vmp.gb28181.bean.SubscribeInfo; | @@ -7,7 +8,7 @@ import com.genersoft.iot.vmp.gb28181.bean.SubscribeInfo; | ||
| 7 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; | 8 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; |
| 8 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; | 9 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| 9 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 10 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 10 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 11 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 11 | 12 | ||
| 12 | import java.text.SimpleDateFormat; | 13 | import java.text.SimpleDateFormat; |
| 13 | import java.util.List; | 14 | import java.util.List; |
| @@ -15,7 +16,7 @@ import java.util.List; | @@ -15,7 +16,7 @@ import java.util.List; | ||
| 15 | public class GPSSubscribeTask implements Runnable{ | 16 | public class GPSSubscribeTask implements Runnable{ |
| 16 | 17 | ||
| 17 | private IRedisCatchStorage redisCatchStorage; | 18 | private IRedisCatchStorage redisCatchStorage; |
| 18 | - private IVideoManagerStorager storager; | 19 | + private IVideoManagerStorage storager; |
| 19 | private ISIPCommanderForPlatform sipCommanderForPlatform; | 20 | private ISIPCommanderForPlatform sipCommanderForPlatform; |
| 20 | private SubscribeHolder subscribeHolder; | 21 | private SubscribeHolder subscribeHolder; |
| 21 | private String platformId; | 22 | private String platformId; |
| @@ -24,7 +25,7 @@ public class GPSSubscribeTask implements Runnable{ | @@ -24,7 +25,7 @@ public class GPSSubscribeTask implements Runnable{ | ||
| 24 | 25 | ||
| 25 | private final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | 26 | private final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| 26 | 27 | ||
| 27 | - public GPSSubscribeTask(IRedisCatchStorage redisCatchStorage, ISIPCommanderForPlatform sipCommanderForPlatform, IVideoManagerStorager storager, String platformId, String sn, String key, SubscribeHolder subscribeInfo) { | 28 | + public GPSSubscribeTask(IRedisCatchStorage redisCatchStorage, ISIPCommanderForPlatform sipCommanderForPlatform, IVideoManagerStorage storager, String platformId, String sn, String key, SubscribeHolder subscribeInfo) { |
| 28 | this.redisCatchStorage = redisCatchStorage; | 29 | this.redisCatchStorage = redisCatchStorage; |
| 29 | this.storager = storager; | 30 | this.storager = storager; |
| 30 | this.platformId = platformId; | 31 | this.platformId = platformId; |
| @@ -48,21 +49,18 @@ public class GPSSubscribeTask implements Runnable{ | @@ -48,21 +49,18 @@ public class GPSSubscribeTask implements Runnable{ | ||
| 48 | for (GbStream gbStream : gbStreams) { | 49 | for (GbStream gbStream : gbStreams) { |
| 49 | String gbId = gbStream.getGbId(); | 50 | String gbId = gbStream.getGbId(); |
| 50 | GPSMsgInfo gpsMsgInfo = redisCatchStorage.getGpsMsgInfo(gbId); | 51 | GPSMsgInfo gpsMsgInfo = redisCatchStorage.getGpsMsgInfo(gbId); |
| 51 | - if (gbStream.isStatus()) { | ||
| 52 | - if (gpsMsgInfo != null) { | ||
| 53 | - // 发送GPS消息 | ||
| 54 | - sipCommanderForPlatform.sendNotifyMobilePosition(parentPlatform, gpsMsgInfo, subscribe); | ||
| 55 | - }else { | ||
| 56 | - // 没有在redis找到新的消息就使用数据库的消息 | ||
| 57 | - gpsMsgInfo = new GPSMsgInfo(); | ||
| 58 | - gpsMsgInfo.setId(gbId); | ||
| 59 | - gpsMsgInfo.setLat(gbStream.getLongitude()); | ||
| 60 | - gpsMsgInfo.setLng(gbStream.getLongitude()); | ||
| 61 | - // 发送GPS消息 | ||
| 62 | - sipCommanderForPlatform.sendNotifyMobilePosition(parentPlatform, gpsMsgInfo, subscribe); | ||
| 63 | - } | 52 | + if (gpsMsgInfo != null) { |
| 53 | + // 发送GPS消息 | ||
| 54 | + sipCommanderForPlatform.sendNotifyMobilePosition(parentPlatform, gpsMsgInfo, subscribe); | ||
| 55 | + }else { | ||
| 56 | + // 没有在redis找到新的消息就使用数据库的消息 | ||
| 57 | + gpsMsgInfo = new GPSMsgInfo(); | ||
| 58 | + gpsMsgInfo.setId(gbId); | ||
| 59 | + gpsMsgInfo.setLat(gbStream.getLongitude()); | ||
| 60 | + gpsMsgInfo.setLng(gbStream.getLongitude()); | ||
| 61 | + // 发送GPS消息 | ||
| 62 | + sipCommanderForPlatform.sendNotifyMobilePosition(parentPlatform, gpsMsgInfo, subscribe); | ||
| 64 | } | 63 | } |
| 65 | - | ||
| 66 | } | 64 | } |
| 67 | } | 65 | } |
| 68 | } | 66 | } |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/ISIPCommander.java
| @@ -305,11 +305,9 @@ public interface ISIPCommander { | @@ -305,11 +305,9 @@ public interface ISIPCommander { | ||
| 305 | * 订阅、取消订阅移动位置 | 305 | * 订阅、取消订阅移动位置 |
| 306 | * | 306 | * |
| 307 | * @param device 视频设备 | 307 | * @param device 视频设备 |
| 308 | - * @param expires 订阅超时时间(值=0时为取消订阅) | ||
| 309 | - * @param interval 上报时间间隔 | ||
| 310 | * @return true = 命令发送成功 | 308 | * @return true = 命令发送成功 |
| 311 | */ | 309 | */ |
| 312 | - boolean mobilePositionSubscribe(Device device, int expires, int interval); | 310 | + boolean mobilePositionSubscribe(Device device, SipSubscribe.Event okEvent ,SipSubscribe.Event errorEvent); |
| 313 | 311 | ||
| 314 | /** | 312 | /** |
| 315 | * 订阅、取消订阅报警信息 | 313 | * 订阅、取消订阅报警信息 |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommander.java
| @@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSONObject; | @@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSONObject; | ||
| 4 | import com.genersoft.iot.vmp.common.StreamInfo; | 4 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 5 | import com.genersoft.iot.vmp.conf.DynamicTask; | 5 | import com.genersoft.iot.vmp.conf.DynamicTask; |
| 6 | import com.genersoft.iot.vmp.conf.SipConfig; | 6 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 7 | -import com.genersoft.iot.vmp.conf.UserSetup; | 7 | +import com.genersoft.iot.vmp.conf.UserSetting; |
| 8 | import com.genersoft.iot.vmp.gb28181.bean.Device; | 8 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 9 | import com.genersoft.iot.vmp.gb28181.bean.InviteStreamCallback; | 9 | import com.genersoft.iot.vmp.gb28181.bean.InviteStreamCallback; |
| 10 | import com.genersoft.iot.vmp.gb28181.bean.InviteStreamInfo; | 10 | import com.genersoft.iot.vmp.gb28181.bean.InviteStreamInfo; |
| @@ -20,7 +20,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | @@ -20,7 +20,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | ||
| 20 | import com.genersoft.iot.vmp.service.IMediaServerService; | 20 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 21 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; | 21 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; |
| 22 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 22 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 23 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 23 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 24 | import gov.nist.javax.sip.SipProviderImpl; | 24 | import gov.nist.javax.sip.SipProviderImpl; |
| 25 | import gov.nist.javax.sip.SipStackImpl; | 25 | import gov.nist.javax.sip.SipStackImpl; |
| 26 | import gov.nist.javax.sip.message.SIPRequest; | 26 | import gov.nist.javax.sip.message.SIPRequest; |
| @@ -71,13 +71,13 @@ public class SIPCommander implements ISIPCommander { | @@ -71,13 +71,13 @@ public class SIPCommander implements ISIPCommander { | ||
| 71 | private VideoStreamSessionManager streamSession; | 71 | private VideoStreamSessionManager streamSession; |
| 72 | 72 | ||
| 73 | @Autowired | 73 | @Autowired |
| 74 | - private IVideoManagerStorager storager; | 74 | + private IVideoManagerStorage storager; |
| 75 | 75 | ||
| 76 | @Autowired | 76 | @Autowired |
| 77 | private IRedisCatchStorage redisCatchStorage; | 77 | private IRedisCatchStorage redisCatchStorage; |
| 78 | 78 | ||
| 79 | @Autowired | 79 | @Autowired |
| 80 | - private UserSetup userSetup; | 80 | + private UserSetting userSetting; |
| 81 | 81 | ||
| 82 | @Autowired | 82 | @Autowired |
| 83 | private ZLMHttpHookSubscribe subscribe; | 83 | private ZLMHttpHookSubscribe subscribe; |
| @@ -236,6 +236,7 @@ public class SIPCommander implements ISIPCommander { | @@ -236,6 +236,7 @@ public class SIPCommander implements ISIPCommander { | ||
| 236 | ptzXml.append("<DeviceID>" + channelId + "</DeviceID>\r\n"); | 236 | ptzXml.append("<DeviceID>" + channelId + "</DeviceID>\r\n"); |
| 237 | ptzXml.append("<PTZCmd>" + cmdStr + "</PTZCmd>\r\n"); | 237 | ptzXml.append("<PTZCmd>" + cmdStr + "</PTZCmd>\r\n"); |
| 238 | ptzXml.append("<Info>\r\n"); | 238 | ptzXml.append("<Info>\r\n"); |
| 239 | + ptzXml.append("<ControlPriority>5</ControlPriority>\r\n"); | ||
| 239 | ptzXml.append("</Info>\r\n"); | 240 | ptzXml.append("</Info>\r\n"); |
| 240 | ptzXml.append("</Control>\r\n"); | 241 | ptzXml.append("</Control>\r\n"); |
| 241 | 242 | ||
| @@ -277,6 +278,7 @@ public class SIPCommander implements ISIPCommander { | @@ -277,6 +278,7 @@ public class SIPCommander implements ISIPCommander { | ||
| 277 | ptzXml.append("<DeviceID>" + channelId + "</DeviceID>\r\n"); | 278 | ptzXml.append("<DeviceID>" + channelId + "</DeviceID>\r\n"); |
| 278 | ptzXml.append("<PTZCmd>" + cmdStr + "</PTZCmd>\r\n"); | 279 | ptzXml.append("<PTZCmd>" + cmdStr + "</PTZCmd>\r\n"); |
| 279 | ptzXml.append("<Info>\r\n"); | 280 | ptzXml.append("<Info>\r\n"); |
| 281 | + ptzXml.append("<ControlPriority>5</ControlPriority>\r\n"); | ||
| 280 | ptzXml.append("</Info>\r\n"); | 282 | ptzXml.append("</Info>\r\n"); |
| 281 | ptzXml.append("</Control>\r\n"); | 283 | ptzXml.append("</Control>\r\n"); |
| 282 | 284 | ||
| @@ -311,6 +313,7 @@ public class SIPCommander implements ISIPCommander { | @@ -311,6 +313,7 @@ public class SIPCommander implements ISIPCommander { | ||
| 311 | ptzXml.append("<DeviceID>" + channelId + "</DeviceID>\r\n"); | 313 | ptzXml.append("<DeviceID>" + channelId + "</DeviceID>\r\n"); |
| 312 | ptzXml.append("<PTZCmd>" + cmdString + "</PTZCmd>\r\n"); | 314 | ptzXml.append("<PTZCmd>" + cmdString + "</PTZCmd>\r\n"); |
| 313 | ptzXml.append("<Info>\r\n"); | 315 | ptzXml.append("<Info>\r\n"); |
| 316 | + ptzXml.append("<ControlPriority>5</ControlPriority>\r\n"); | ||
| 314 | ptzXml.append("</Info>\r\n"); | 317 | ptzXml.append("</Info>\r\n"); |
| 315 | ptzXml.append("</Control>\r\n"); | 318 | ptzXml.append("</Control>\r\n"); |
| 316 | 319 | ||
| @@ -365,7 +368,7 @@ public class SIPCommander implements ISIPCommander { | @@ -365,7 +368,7 @@ public class SIPCommander implements ISIPCommander { | ||
| 365 | content.append("c=IN IP4 "+ mediaServerItem.getSdpIp() +"\r\n"); | 368 | content.append("c=IN IP4 "+ mediaServerItem.getSdpIp() +"\r\n"); |
| 366 | content.append("t=0 0\r\n"); | 369 | content.append("t=0 0\r\n"); |
| 367 | 370 | ||
| 368 | - if (userSetup.isSeniorSdp()) { | 371 | + if (userSetting.isSeniorSdp()) { |
| 369 | if("TCP-PASSIVE".equals(streamMode)) { | 372 | if("TCP-PASSIVE".equals(streamMode)) { |
| 370 | content.append("m=video "+ ssrcInfo.getPort() +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n"); | 373 | content.append("m=video "+ ssrcInfo.getPort() +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n"); |
| 371 | }else if ("TCP-ACTIVE".equals(streamMode)) { | 374 | }else if ("TCP-ACTIVE".equals(streamMode)) { |
| @@ -465,7 +468,7 @@ public class SIPCommander implements ISIPCommander { | @@ -465,7 +468,7 @@ public class SIPCommander implements ISIPCommander { | ||
| 465 | 468 | ||
| 466 | String streamMode = device.getStreamMode().toUpperCase(); | 469 | String streamMode = device.getStreamMode().toUpperCase(); |
| 467 | 470 | ||
| 468 | - if (userSetup.isSeniorSdp()) { | 471 | + if (userSetting.isSeniorSdp()) { |
| 469 | if("TCP-PASSIVE".equals(streamMode)) { | 472 | if("TCP-PASSIVE".equals(streamMode)) { |
| 470 | content.append("m=video "+ ssrcInfo.getPort() +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n"); | 473 | content.append("m=video "+ ssrcInfo.getPort() +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n"); |
| 471 | }else if ("TCP-ACTIVE".equals(streamMode)) { | 474 | }else if ("TCP-ACTIVE".equals(streamMode)) { |
| @@ -575,7 +578,7 @@ public class SIPCommander implements ISIPCommander { | @@ -575,7 +578,7 @@ public class SIPCommander implements ISIPCommander { | ||
| 575 | 578 | ||
| 576 | String streamMode = device.getStreamMode().toUpperCase(); | 579 | String streamMode = device.getStreamMode().toUpperCase(); |
| 577 | 580 | ||
| 578 | - if (userSetup.isSeniorSdp()) { | 581 | + if (userSetting.isSeniorSdp()) { |
| 579 | if("TCP-PASSIVE".equals(streamMode)) { | 582 | if("TCP-PASSIVE".equals(streamMode)) { |
| 580 | content.append("m=video "+ ssrcInfo.getPort() +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n"); | 583 | content.append("m=video "+ ssrcInfo.getPort() +" TCP/RTP/AVP 96 126 125 99 34 98 97\r\n"); |
| 581 | }else if ("TCP-ACTIVE".equals(streamMode)) { | 584 | }else if ("TCP-ACTIVE".equals(streamMode)) { |
| @@ -1433,11 +1436,9 @@ public class SIPCommander implements ISIPCommander { | @@ -1433,11 +1436,9 @@ public class SIPCommander implements ISIPCommander { | ||
| 1433 | * 订阅、取消订阅移动位置 | 1436 | * 订阅、取消订阅移动位置 |
| 1434 | * | 1437 | * |
| 1435 | * @param device 视频设备 | 1438 | * @param device 视频设备 |
| 1436 | - * @param expires 订阅超时时间 | ||
| 1437 | - * @param interval 上报时间间隔 | ||
| 1438 | * @return true = 命令发送成功 | 1439 | * @return true = 命令发送成功 |
| 1439 | */ | 1440 | */ |
| 1440 | - public boolean mobilePositionSubscribe(Device device, int expires, int interval) { | 1441 | + public boolean mobilePositionSubscribe(Device device, SipSubscribe.Event okEvent ,SipSubscribe.Event errorEvent) { |
| 1441 | try { | 1442 | try { |
| 1442 | StringBuffer subscribePostitionXml = new StringBuffer(200); | 1443 | StringBuffer subscribePostitionXml = new StringBuffer(200); |
| 1443 | String charset = device.getCharset(); | 1444 | String charset = device.getCharset(); |
| @@ -1446,8 +1447,8 @@ public class SIPCommander implements ISIPCommander { | @@ -1446,8 +1447,8 @@ public class SIPCommander implements ISIPCommander { | ||
| 1446 | subscribePostitionXml.append("<CmdType>MobilePosition</CmdType>\r\n"); | 1447 | subscribePostitionXml.append("<CmdType>MobilePosition</CmdType>\r\n"); |
| 1447 | subscribePostitionXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); | 1448 | subscribePostitionXml.append("<SN>" + (int)((Math.random()*9+1)*100000) + "</SN>\r\n"); |
| 1448 | subscribePostitionXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n"); | 1449 | subscribePostitionXml.append("<DeviceID>" + device.getDeviceId() + "</DeviceID>\r\n"); |
| 1449 | - if (expires > 0) { | ||
| 1450 | - subscribePostitionXml.append("<Interval>" + String.valueOf(interval) + "</Interval>\r\n"); | 1450 | + if (device.getSubscribeCycleForMobilePosition() > 0) { |
| 1451 | + subscribePostitionXml.append("<Interval>" + String.valueOf(device.getMobilePositionSubmissionInterval()) + "</Interval>\r\n"); | ||
| 1451 | } | 1452 | } |
| 1452 | subscribePostitionXml.append("</Query>\r\n"); | 1453 | subscribePostitionXml.append("</Query>\r\n"); |
| 1453 | 1454 | ||
| @@ -1456,8 +1457,8 @@ public class SIPCommander implements ISIPCommander { | @@ -1456,8 +1457,8 @@ public class SIPCommander implements ISIPCommander { | ||
| 1456 | CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId() | 1457 | CallIdHeader callIdHeader = device.getTransport().equals("TCP") ? tcpSipProvider.getNewCallId() |
| 1457 | : udpSipProvider.getNewCallId(); | 1458 | : udpSipProvider.getNewCallId(); |
| 1458 | 1459 | ||
| 1459 | - Request request = headerProvider.createSubscribeRequest(device, subscribePostitionXml.toString(), "z9hG4bK-viaPos-" + tm, "fromTagPos" + tm, null, expires, "presence" ,callIdHeader); //Position;id=" + tm.substring(tm.length() - 4)); | ||
| 1460 | - transmitRequest(device, request); | 1460 | + Request request = headerProvider.createSubscribeRequest(device, subscribePostitionXml.toString(), "z9hG4bK-viaPos-" + tm, "fromTagPos" + tm, null, device.getSubscribeCycleForMobilePosition(), "presence" ,callIdHeader); //Position;id=" + tm.substring(tm.length() - 4)); |
| 1461 | + transmitRequest(device, request, errorEvent, okEvent); | ||
| 1461 | 1462 | ||
| 1462 | return true; | 1463 | return true; |
| 1463 | 1464 |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java
| @@ -372,7 +372,6 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | @@ -372,7 +372,6 @@ public class SIPCommanderFroPlatform implements ISIPCommanderForPlatform { | ||
| 372 | : udpSipProvider.getNewCallId(); | 372 | : udpSipProvider.getNewCallId(); |
| 373 | callIdHeader.setCallId(subscribeInfo.getCallId()); | 373 | callIdHeader.setCallId(subscribeInfo.getCallId()); |
| 374 | 374 | ||
| 375 | -// | ||
| 376 | sendNotify(parentPlatform, deviceStatusXml.toString(), subscribeInfo, eventResult -> { | 375 | sendNotify(parentPlatform, deviceStatusXml.toString(), subscribeInfo, eventResult -> { |
| 377 | logger.error("发送NOTIFY通知消息失败。错误:{} {}", eventResult.statusCode, eventResult.msg); | 376 | logger.error("发送NOTIFY通知消息失败。错误:{} {}", eventResult.statusCode, eventResult.msg); |
| 378 | }, null); | 377 | }, null); |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java
| @@ -2,7 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl; | @@ -2,7 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl; | ||
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.common.StreamInfo; | 3 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 4 | import com.genersoft.iot.vmp.gb28181.bean.Device; | 4 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 5 | -import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | 5 | +import com.genersoft.iot.vmp.gb28181.bean.InviteStreamType; |
| 6 | import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; | 6 | import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; |
| 7 | import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction; | 7 | import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction; |
| 8 | import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; | 8 | import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; |
| @@ -13,8 +13,9 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorP | @@ -13,8 +13,9 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorP | ||
| 13 | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; | 13 | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; |
| 14 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | 14 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 15 | import com.genersoft.iot.vmp.service.IMediaServerService; | 15 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 16 | +import com.genersoft.iot.vmp.service.bean.MessageForPushChannel; | ||
| 16 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 17 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 17 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 18 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 18 | import com.genersoft.iot.vmp.utils.SerializeUtils; | 19 | import com.genersoft.iot.vmp.utils.SerializeUtils; |
| 19 | import gov.nist.javax.sip.stack.SIPDialog; | 20 | import gov.nist.javax.sip.stack.SIPDialog; |
| 20 | import org.slf4j.Logger; | 21 | import org.slf4j.Logger; |
| @@ -50,7 +51,7 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In | @@ -50,7 +51,7 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In | ||
| 50 | private IRedisCatchStorage redisCatchStorage; | 51 | private IRedisCatchStorage redisCatchStorage; |
| 51 | 52 | ||
| 52 | @Autowired | 53 | @Autowired |
| 53 | - private IVideoManagerStorager storager; | 54 | + private IVideoManagerStorage storager; |
| 54 | 55 | ||
| 55 | @Autowired | 56 | @Autowired |
| 56 | private ZLMRTPServerFactory zlmrtpServerFactory; | 57 | private ZLMRTPServerFactory zlmrtpServerFactory; |
| @@ -99,10 +100,20 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In | @@ -99,10 +100,20 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In | ||
| 99 | redisCatchStorage.deleteSendRTPServer(platformGbId, channelId, callIdHeader.getCallId(), null); | 100 | redisCatchStorage.deleteSendRTPServer(platformGbId, channelId, callIdHeader.getCallId(), null); |
| 100 | int totalReaderCount = zlmrtpServerFactory.totalReaderCount(mediaInfo, sendRtpItem.getApp(), streamId); | 101 | int totalReaderCount = zlmrtpServerFactory.totalReaderCount(mediaInfo, sendRtpItem.getApp(), streamId); |
| 101 | if (totalReaderCount <= 0) { | 102 | if (totalReaderCount <= 0) { |
| 102 | - logger.info("收到bye: {}无其它观看者,通知设备停止推流", streamId); | ||
| 103 | - if (sendRtpItem.isPlay()) { | 103 | + logger.info("收到bye: {} 无其它观看者,通知设备停止推流", streamId); |
| 104 | + if (sendRtpItem.getPlayType().equals(InviteStreamType.PLAY)) { | ||
| 104 | cmder.streamByeCmd(sendRtpItem.getDeviceId(), channelId, streamId, null); | 105 | cmder.streamByeCmd(sendRtpItem.getDeviceId(), channelId, streamId, null); |
| 105 | } | 106 | } |
| 107 | + if (sendRtpItem.getPlayType().equals(InviteStreamType.PUSH)) { | ||
| 108 | + MessageForPushChannel messageForPushChannel = new MessageForPushChannel(); | ||
| 109 | + messageForPushChannel.setType(0); | ||
| 110 | + messageForPushChannel.setGbId(sendRtpItem.getChannelId()); | ||
| 111 | + messageForPushChannel.setApp(sendRtpItem.getApp()); | ||
| 112 | + messageForPushChannel.setStream(sendRtpItem.getStreamId()); | ||
| 113 | + messageForPushChannel.setMediaServerId(sendRtpItem.getMediaServerId()); | ||
| 114 | + messageForPushChannel.setPlatFormId(sendRtpItem.getPlatformId()); | ||
| 115 | + redisCatchStorage.sendStreamPushRequestedMsg(messageForPushChannel); | ||
| 116 | + } | ||
| 106 | } | 117 | } |
| 107 | } | 118 | } |
| 108 | // 可能是设备主动停止 | 119 | // 可能是设备主动停止 |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/InviteRequestProcessor.java
| 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl; | 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl; |
| 2 | 2 | ||
| 3 | -import com.alibaba.fastjson.JSON; | ||
| 4 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 5 | -import com.genersoft.iot.vmp.common.StreamInfo; | ||
| 6 | import com.genersoft.iot.vmp.conf.DynamicTask; | 4 | import com.genersoft.iot.vmp.conf.DynamicTask; |
| 5 | +import com.genersoft.iot.vmp.conf.UserSetting; | ||
| 7 | import com.genersoft.iot.vmp.gb28181.bean.*; | 6 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 8 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; | 7 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; |
| 9 | import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; | 8 | import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; |
| 10 | import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; | 9 | import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; |
| 11 | -import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; | ||
| 12 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; | 10 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; |
| 13 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | 11 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| 14 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; | 12 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; |
| @@ -16,20 +14,19 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor | @@ -16,20 +14,19 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor | ||
| 16 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; | 14 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 17 | import com.genersoft.iot.vmp.gb28181.utils.SipUtils; | 15 | import com.genersoft.iot.vmp.gb28181.utils.SipUtils; |
| 18 | import com.genersoft.iot.vmp.media.zlm.ZLMHttpHookSubscribe; | 16 | import com.genersoft.iot.vmp.media.zlm.ZLMHttpHookSubscribe; |
| 17 | +import com.genersoft.iot.vmp.media.zlm.ZLMMediaListManager; | ||
| 19 | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; | 18 | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; |
| 20 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | 19 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 21 | import com.genersoft.iot.vmp.service.IMediaServerService; | 20 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 22 | import com.genersoft.iot.vmp.service.IPlayService; | 21 | import com.genersoft.iot.vmp.service.IPlayService; |
| 22 | +import com.genersoft.iot.vmp.service.bean.MessageForPushChannel; | ||
| 23 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; | 23 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; |
| 24 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 24 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 25 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 25 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 26 | import com.genersoft.iot.vmp.utils.SerializeUtils; | 26 | import com.genersoft.iot.vmp.utils.SerializeUtils; |
| 27 | -import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.PlayResult; | ||
| 28 | import gov.nist.javax.sdp.TimeDescriptionImpl; | 27 | import gov.nist.javax.sdp.TimeDescriptionImpl; |
| 29 | import gov.nist.javax.sdp.fields.TimeField; | 28 | import gov.nist.javax.sdp.fields.TimeField; |
| 30 | -import gov.nist.javax.sip.address.AddressImpl; | ||
| 31 | -import gov.nist.javax.sip.address.SipUri; | ||
| 32 | -import gov.nist.javax.sip.header.Subject; | 29 | +import javafx.application.Platform; |
| 33 | import org.slf4j.Logger; | 30 | import org.slf4j.Logger; |
| 34 | import org.slf4j.LoggerFactory; | 31 | import org.slf4j.LoggerFactory; |
| 35 | import org.springframework.beans.factory.InitializingBean; | 32 | import org.springframework.beans.factory.InitializingBean; |
| @@ -37,20 +34,14 @@ import org.springframework.beans.factory.annotation.Autowired; | @@ -37,20 +34,14 @@ import org.springframework.beans.factory.annotation.Autowired; | ||
| 37 | import org.springframework.stereotype.Component; | 34 | import org.springframework.stereotype.Component; |
| 38 | 35 | ||
| 39 | import javax.sdp.*; | 36 | import javax.sdp.*; |
| 40 | -import javax.sip.InvalidArgumentException; | ||
| 41 | -import javax.sip.RequestEvent; | ||
| 42 | -import javax.sip.ServerTransaction; | ||
| 43 | -import javax.sip.SipException; | 37 | +import javax.sip.*; |
| 44 | import javax.sip.address.SipURI; | 38 | import javax.sip.address.SipURI; |
| 45 | import javax.sip.header.CallIdHeader; | 39 | import javax.sip.header.CallIdHeader; |
| 46 | -import javax.sip.header.FromHeader; | ||
| 47 | -import javax.sip.header.Header; | ||
| 48 | import javax.sip.message.Request; | 40 | import javax.sip.message.Request; |
| 49 | import javax.sip.message.Response; | 41 | import javax.sip.message.Response; |
| 50 | import java.text.ParseException; | 42 | import java.text.ParseException; |
| 51 | import java.text.SimpleDateFormat; | 43 | import java.text.SimpleDateFormat; |
| 52 | import java.util.Date; | 44 | import java.util.Date; |
| 53 | -import java.util.List; | ||
| 54 | import java.util.Vector; | 45 | import java.util.Vector; |
| 55 | 46 | ||
| 56 | /** | 47 | /** |
| @@ -68,7 +59,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | @@ -68,7 +59,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | ||
| 68 | private SIPCommanderFroPlatform cmderFroPlatform; | 59 | private SIPCommanderFroPlatform cmderFroPlatform; |
| 69 | 60 | ||
| 70 | @Autowired | 61 | @Autowired |
| 71 | - private IVideoManagerStorager storager; | 62 | + private IVideoManagerStorage storager; |
| 72 | 63 | ||
| 73 | @Autowired | 64 | @Autowired |
| 74 | private IRedisCatchStorage redisCatchStorage; | 65 | private IRedisCatchStorage redisCatchStorage; |
| @@ -97,6 +88,12 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | @@ -97,6 +88,12 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | ||
| 97 | @Autowired | 88 | @Autowired |
| 98 | private VideoStreamSessionManager sessionManager; | 89 | private VideoStreamSessionManager sessionManager; |
| 99 | 90 | ||
| 91 | + @Autowired | ||
| 92 | + private UserSetting userSetting; | ||
| 93 | + | ||
| 94 | + @Autowired | ||
| 95 | + private ZLMMediaListManager mediaListManager; | ||
| 96 | + | ||
| 100 | 97 | ||
| 101 | @Override | 98 | @Override |
| 102 | public void afterPropertiesSet() throws Exception { | 99 | public void afterPropertiesSet() throws Exception { |
| @@ -153,12 +150,6 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | @@ -153,12 +150,6 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | ||
| 153 | responseAck(evt, Response.GONE); | 150 | responseAck(evt, Response.GONE); |
| 154 | return; | 151 | return; |
| 155 | } | 152 | } |
| 156 | - Boolean streamReady = zlmrtpServerFactory.isStreamReady(mediaServerItem, gbStream.getApp(), gbStream.getStream()); | ||
| 157 | - if (!streamReady ) { | ||
| 158 | - logger.info("[ app={}, stream={} ]通道离线,返回400",gbStream.getApp(), gbStream.getStream()); | ||
| 159 | - responseAck(evt, Response.BAD_REQUEST, "channel [" + gbStream.getGbId() + "] offline"); | ||
| 160 | - return; | ||
| 161 | - } | ||
| 162 | responseAck(evt, Response.CALL_IS_BEING_FORWARDED); // 通道存在,发181,呼叫转接中 | 153 | responseAck(evt, Response.CALL_IS_BEING_FORWARDED); // 通道存在,发181,呼叫转接中 |
| 163 | }else if (catalog != null) { | 154 | }else if (catalog != null) { |
| 164 | responseAck(evt, Response.BAD_REQUEST, "catalog channel can not play"); // 目录不支持点播 | 155 | responseAck(evt, Response.BAD_REQUEST, "catalog channel can not play"); // 目录不支持点播 |
| @@ -273,13 +264,11 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | @@ -273,13 +264,11 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | ||
| 273 | return; | 264 | return; |
| 274 | } | 265 | } |
| 275 | sendRtpItem.setCallId(callIdHeader.getCallId()); | 266 | sendRtpItem.setCallId(callIdHeader.getCallId()); |
| 276 | - sendRtpItem.setPlay("Play".equals(sessionName)); | 267 | + sendRtpItem.setPlayType("Play".equals(sessionName)?InviteStreamType.PLAY:InviteStreamType.PLAYBACK); |
| 277 | byte[] dialogByteArray = SerializeUtils.serialize(evt.getDialog()); | 268 | byte[] dialogByteArray = SerializeUtils.serialize(evt.getDialog()); |
| 278 | sendRtpItem.setDialog(dialogByteArray); | 269 | sendRtpItem.setDialog(dialogByteArray); |
| 279 | byte[] transactionByteArray = SerializeUtils.serialize(evt.getServerTransaction()); | 270 | byte[] transactionByteArray = SerializeUtils.serialize(evt.getServerTransaction()); |
| 280 | sendRtpItem.setTransaction(transactionByteArray); | 271 | sendRtpItem.setTransaction(transactionByteArray); |
| 281 | - | ||
| 282 | - | ||
| 283 | Long finalStartTime = startTime; | 272 | Long finalStartTime = startTime; |
| 284 | Long finalStopTime = stopTime; | 273 | Long finalStopTime = stopTime; |
| 285 | ZLMHttpHookSubscribe.Event hookEvent = (mediaServerItemInUSe, responseJSON)->{ | 274 | ZLMHttpHookSubscribe.Event hookEvent = (mediaServerItemInUSe, responseJSON)->{ |
| @@ -315,7 +304,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | @@ -315,7 +304,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | ||
| 315 | mediaServerService.releaseSsrc(mediaServerItemInUSe.getId(), ssrc); | 304 | mediaServerService.releaseSsrc(mediaServerItemInUSe.getId(), ssrc); |
| 316 | // 回复bye | 305 | // 回复bye |
| 317 | cmderFroPlatform.streamByeCmd(platform, callIdHeader.getCallId()); | 306 | cmderFroPlatform.streamByeCmd(platform, callIdHeader.getCallId()); |
| 318 | - }, 60); | 307 | + }, 60*1000); |
| 319 | responseSdpAck(evt, content.toString(), platform); | 308 | responseSdpAck(evt, content.toString(), platform); |
| 320 | 309 | ||
| 321 | } catch (SipException e) { | 310 | } catch (SipException e) { |
| @@ -340,7 +329,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | @@ -340,7 +329,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | ||
| 340 | }); | 329 | }); |
| 341 | sendRtpItem.setApp("rtp"); | 330 | sendRtpItem.setApp("rtp"); |
| 342 | if ("Playback".equals(sessionName)) { | 331 | if ("Playback".equals(sessionName)) { |
| 343 | - sendRtpItem.setPlay(false); | 332 | + sendRtpItem.setPlayType(InviteStreamType.PLAYBACK); |
| 344 | SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, null, true); | 333 | SSRCInfo ssrcInfo = mediaServerService.openRTPServer(mediaServerItem, null, true); |
| 345 | sendRtpItem.setStreamId(ssrcInfo.getStream()); | 334 | sendRtpItem.setStreamId(ssrcInfo.getStream()); |
| 346 | // 写入redis, 超时时回复 | 335 | // 写入redis, 超时时回复 |
| @@ -370,7 +359,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | @@ -370,7 +359,7 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | ||
| 370 | } | 359 | } |
| 371 | }); | 360 | }); |
| 372 | }else { | 361 | }else { |
| 373 | - sendRtpItem.setPlay(true); | 362 | + sendRtpItem.setPlayType(InviteStreamType.PLAY); |
| 374 | SsrcTransaction playTransaction = sessionManager.getSsrcTransaction(device.getDeviceId(), channelId, "play", null); | 363 | SsrcTransaction playTransaction = sessionManager.getSsrcTransaction(device.getDeviceId(), channelId, "play", null); |
| 375 | if (playTransaction != null) { | 364 | if (playTransaction != null) { |
| 376 | Boolean streamReady = zlmrtpServerFactory.isStreamReady(mediaServerItem, "rtp", playTransaction.getStream()); | 365 | Boolean streamReady = zlmrtpServerFactory.isStreamReady(mediaServerItem, "rtp", playTransaction.getStream()); |
| @@ -401,56 +390,105 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | @@ -401,56 +390,105 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | ||
| 401 | } | 390 | } |
| 402 | } | 391 | } |
| 403 | }else if (gbStream != null) { | 392 | }else if (gbStream != null) { |
| 404 | - SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId, | ||
| 405 | - gbStream.getApp(), gbStream.getStream(), channelId, | ||
| 406 | - mediaTransmissionTCP); | ||
| 407 | 393 | ||
| 408 | - if (tcpActive != null) { | ||
| 409 | - sendRtpItem.setTcpActive(tcpActive); | ||
| 410 | - } | ||
| 411 | - if (sendRtpItem == null) { | ||
| 412 | - logger.warn("服务器端口资源不足"); | ||
| 413 | - responseAck(evt, Response.BUSY_HERE); | ||
| 414 | - return; | ||
| 415 | - } | 394 | + Boolean streamReady = zlmrtpServerFactory.isStreamReady(mediaServerItem, gbStream.getApp(), gbStream.getStream()); |
| 395 | + if (!streamReady ) { | ||
| 396 | + if ("proxy".equals(gbStream.getStreamType())) { | ||
| 397 | + // TODO 控制启用以使设备上线 | ||
| 398 | + logger.info("[ app={}, stream={} ]通道离线,启用流后开始推流",gbStream.getApp(), gbStream.getStream()); | ||
| 399 | + responseAck(evt, Response.BAD_REQUEST, "channel [" + gbStream.getGbId() + "] offline"); | ||
| 400 | + }else if ("push".equals(gbStream.getStreamType())) { | ||
| 401 | + // 发送redis消息以使设备上线 | ||
| 402 | + logger.info("[ app={}, stream={} ]通道离线,发送redis信息控制设备开始推流",gbStream.getApp(), gbStream.getStream()); | ||
| 403 | + MessageForPushChannel messageForPushChannel = new MessageForPushChannel(); | ||
| 404 | + messageForPushChannel.setType(1); | ||
| 405 | + messageForPushChannel.setGbId(gbStream.getGbId()); | ||
| 406 | + messageForPushChannel.setApp(gbStream.getApp()); | ||
| 407 | + messageForPushChannel.setStream(gbStream.getStream()); | ||
| 408 | + // TODO 获取低负载的节点 | ||
| 409 | + messageForPushChannel.setMediaServerId(gbStream.getMediaServerId()); | ||
| 410 | + messageForPushChannel.setPlatFormId(platform.getServerGBId()); | ||
| 411 | + messageForPushChannel.setPlatFormName(platform.getName()); | ||
| 412 | + redisCatchStorage.sendStreamPushRequestedMsg(messageForPushChannel); | ||
| 413 | + // 设置超时 | ||
| 414 | + dynamicTask.startDelay(callIdHeader.getCallId(), ()->{ | ||
| 415 | + logger.info("[ app={}, stream={} ] 等待设备开始推流超时", gbStream.getApp(), gbStream.getStream()); | ||
| 416 | + try { | ||
| 417 | + mediaListManager.removedChannelOnlineEventLister(gbStream.getGbId()); | ||
| 418 | + responseAck(evt, Response.REQUEST_TIMEOUT); // 超时 | ||
| 419 | + } catch (SipException e) { | ||
| 420 | + e.printStackTrace(); | ||
| 421 | + } catch (InvalidArgumentException e) { | ||
| 422 | + e.printStackTrace(); | ||
| 423 | + } catch (ParseException e) { | ||
| 424 | + e.printStackTrace(); | ||
| 425 | + } | ||
| 426 | + }, userSetting.getPlatformPlayTimeout()); | ||
| 427 | + // 添加监听 | ||
| 428 | + MediaServerItem finalMediaServerItem = mediaServerItem; | ||
| 429 | + int finalPort = port; | ||
| 430 | + boolean finalMediaTransmissionTCP = mediaTransmissionTCP; | ||
| 431 | + Boolean finalTcpActive = tcpActive; | ||
| 432 | + mediaListManager.addChannelOnlineEventLister(gbStream.getGbId(), (app, stream)->{ | ||
| 433 | + SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(finalMediaServerItem, addressStr, finalPort, ssrc, requesterId, | ||
| 434 | + app, stream, channelId, finalMediaTransmissionTCP); | ||
| 435 | + | ||
| 436 | + if (sendRtpItem == null) { | ||
| 437 | + logger.warn("服务器端口资源不足"); | ||
| 438 | + try { | ||
| 439 | + responseAck(evt, Response.BUSY_HERE); | ||
| 440 | + } catch (SipException e) { | ||
| 441 | + e.printStackTrace(); | ||
| 442 | + } catch (InvalidArgumentException e) { | ||
| 443 | + e.printStackTrace(); | ||
| 444 | + } catch (ParseException e) { | ||
| 445 | + e.printStackTrace(); | ||
| 446 | + } | ||
| 447 | + return; | ||
| 448 | + } | ||
| 449 | + if (finalTcpActive != null) { | ||
| 450 | + sendRtpItem.setTcpActive(finalTcpActive); | ||
| 451 | + } | ||
| 452 | + sendRtpItem.setPlayType(InviteStreamType.PUSH); | ||
| 453 | + // 写入redis, 超时时回复 | ||
| 454 | + sendRtpItem.setStatus(1); | ||
| 455 | + sendRtpItem.setCallId(callIdHeader.getCallId()); | ||
| 456 | + byte[] dialogByteArray = SerializeUtils.serialize(evt.getDialog()); | ||
| 457 | + sendRtpItem.setDialog(dialogByteArray); | ||
| 458 | + byte[] transactionByteArray = SerializeUtils.serialize(evt.getServerTransaction()); | ||
| 459 | + sendRtpItem.setTransaction(transactionByteArray); | ||
| 460 | + redisCatchStorage.updateSendRTPSever(sendRtpItem); | ||
| 461 | + sendStreamAck(finalMediaServerItem, sendRtpItem, platform, evt); | ||
| 416 | 462 | ||
| 417 | - // 写入redis, 超时时回复 | ||
| 418 | - sendRtpItem.setStatus(1); | ||
| 419 | - sendRtpItem.setCallId(callIdHeader.getCallId()); | ||
| 420 | - byte[] dialogByteArray = SerializeUtils.serialize(evt.getDialog()); | ||
| 421 | - sendRtpItem.setDialog(dialogByteArray); | ||
| 422 | - byte[] transactionByteArray = SerializeUtils.serialize(evt.getServerTransaction()); | ||
| 423 | - sendRtpItem.setTransaction(transactionByteArray); | ||
| 424 | - redisCatchStorage.updateSendRTPSever(sendRtpItem); | ||
| 425 | - StringBuffer content = new StringBuffer(200); | ||
| 426 | - content.append("v=0\r\n"); | ||
| 427 | - content.append("o="+ channelId +" 0 0 IN IP4 "+mediaServerItem.getSdpIp()+"\r\n"); | ||
| 428 | - content.append("s=Play\r\n"); | ||
| 429 | - content.append("c=IN IP4 "+mediaServerItem.getSdpIp()+"\r\n"); | ||
| 430 | - content.append("t=0 0\r\n"); | ||
| 431 | - content.append("m=video "+ sendRtpItem.getLocalPort()+" RTP/AVP 96\r\n"); | ||
| 432 | - content.append("a=sendonly\r\n"); | ||
| 433 | - content.append("a=rtpmap:96 PS/90000\r\n"); | ||
| 434 | - if (sendRtpItem.isTcp()) { | ||
| 435 | - content.append("a=connection:new\r\n"); | ||
| 436 | - if (!sendRtpItem.isTcpActive()) { | ||
| 437 | - content.append("a=setup:active\r\n"); | ||
| 438 | - }else { | ||
| 439 | - content.append("a=setup:passive\r\n"); | 463 | + }); |
| 440 | } | 464 | } |
| 465 | + }else { | ||
| 466 | + SendRtpItem sendRtpItem = zlmrtpServerFactory.createSendRtpItem(mediaServerItem, addressStr, port, ssrc, requesterId, | ||
| 467 | + gbStream.getApp(), gbStream.getStream(), channelId, | ||
| 468 | + mediaTransmissionTCP); | ||
| 469 | + | ||
| 470 | + | ||
| 471 | + if (sendRtpItem == null) { | ||
| 472 | + logger.warn("服务器端口资源不足"); | ||
| 473 | + responseAck(evt, Response.BUSY_HERE); | ||
| 474 | + return; | ||
| 475 | + } | ||
| 476 | + if (tcpActive != null) { | ||
| 477 | + sendRtpItem.setTcpActive(tcpActive); | ||
| 478 | + } | ||
| 479 | + sendRtpItem.setPlayType(InviteStreamType.PUSH); | ||
| 480 | + // 写入redis, 超时时回复 | ||
| 481 | + sendRtpItem.setStatus(1); | ||
| 482 | + sendRtpItem.setCallId(callIdHeader.getCallId()); | ||
| 483 | + byte[] dialogByteArray = SerializeUtils.serialize(evt.getDialog()); | ||
| 484 | + sendRtpItem.setDialog(dialogByteArray); | ||
| 485 | + byte[] transactionByteArray = SerializeUtils.serialize(evt.getServerTransaction()); | ||
| 486 | + sendRtpItem.setTransaction(transactionByteArray); | ||
| 487 | + redisCatchStorage.updateSendRTPSever(sendRtpItem); | ||
| 488 | + sendStreamAck(mediaServerItem, sendRtpItem, platform, evt); | ||
| 441 | } | 489 | } |
| 442 | - content.append("y="+ ssrc + "\r\n"); | ||
| 443 | - content.append("f=\r\n"); | ||
| 444 | - | ||
| 445 | - try { | ||
| 446 | - responseSdpAck(evt, content.toString(), platform); | ||
| 447 | - } catch (SipException e) { | ||
| 448 | - e.printStackTrace(); | ||
| 449 | - } catch (InvalidArgumentException e) { | ||
| 450 | - e.printStackTrace(); | ||
| 451 | - } catch (ParseException e) { | ||
| 452 | - e.printStackTrace(); | ||
| 453 | - } | 490 | + |
| 491 | + | ||
| 454 | } | 492 | } |
| 455 | 493 | ||
| 456 | } | 494 | } |
| @@ -466,6 +504,39 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | @@ -466,6 +504,39 @@ public class InviteRequestProcessor extends SIPRequestProcessorParent implements | ||
| 466 | } | 504 | } |
| 467 | } | 505 | } |
| 468 | 506 | ||
| 507 | + public void sendStreamAck(MediaServerItem mediaServerItem, SendRtpItem sendRtpItem, ParentPlatform platform, RequestEvent evt){ | ||
| 508 | + | ||
| 509 | + StringBuffer content = new StringBuffer(200); | ||
| 510 | + content.append("v=0\r\n"); | ||
| 511 | + content.append("o="+ sendRtpItem.getChannelId() +" 0 0 IN IP4 "+ mediaServerItem.getSdpIp()+"\r\n"); | ||
| 512 | + content.append("s=Play\r\n"); | ||
| 513 | + content.append("c=IN IP4 "+mediaServerItem.getSdpIp()+"\r\n"); | ||
| 514 | + content.append("t=0 0\r\n"); | ||
| 515 | + content.append("m=video "+ sendRtpItem.getLocalPort()+" RTP/AVP 96\r\n"); | ||
| 516 | + content.append("a=sendonly\r\n"); | ||
| 517 | + content.append("a=rtpmap:96 PS/90000\r\n"); | ||
| 518 | + if (sendRtpItem.isTcp()) { | ||
| 519 | + content.append("a=connection:new\r\n"); | ||
| 520 | + if (!sendRtpItem.isTcpActive()) { | ||
| 521 | + content.append("a=setup:active\r\n"); | ||
| 522 | + }else { | ||
| 523 | + content.append("a=setup:passive\r\n"); | ||
| 524 | + } | ||
| 525 | + } | ||
| 526 | + content.append("y="+ sendRtpItem.getSsrc() + "\r\n"); | ||
| 527 | + content.append("f=\r\n"); | ||
| 528 | + | ||
| 529 | + try { | ||
| 530 | + responseSdpAck(evt, content.toString(), platform); | ||
| 531 | + } catch (SipException e) { | ||
| 532 | + e.printStackTrace(); | ||
| 533 | + } catch (InvalidArgumentException e) { | ||
| 534 | + e.printStackTrace(); | ||
| 535 | + } catch (ParseException e) { | ||
| 536 | + e.printStackTrace(); | ||
| 537 | + } | ||
| 538 | + } | ||
| 539 | + | ||
| 469 | public void inviteFromDeviceHandle(RequestEvent evt, String requesterId) throws InvalidArgumentException, ParseException, SipException, SdpException { | 540 | public void inviteFromDeviceHandle(RequestEvent evt, String requesterId) throws InvalidArgumentException, ParseException, SipException, SdpException { |
| 470 | 541 | ||
| 471 | // 非上级平台请求,查询是否设备请求(通常为接收语音广播的设备) | 542 | // 非上级平台请求,查询是否设备请求(通常为接收语音广播的设备) |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestProcessor.java
| 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl; | 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl; |
| 2 | 2 | ||
| 3 | +import com.alibaba.fastjson.JSONObject; | ||
| 3 | import com.genersoft.iot.vmp.common.VideoManagerConstants; | 4 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 4 | import com.genersoft.iot.vmp.conf.SipConfig; | 5 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 5 | -import com.genersoft.iot.vmp.conf.UserSetup; | 6 | +import com.genersoft.iot.vmp.conf.UserSetting; |
| 6 | import com.genersoft.iot.vmp.gb28181.bean.*; | 7 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 7 | import com.genersoft.iot.vmp.gb28181.event.DeviceOffLineDetector; | 8 | import com.genersoft.iot.vmp.gb28181.event.DeviceOffLineDetector; |
| 8 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | 9 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| @@ -16,7 +17,7 @@ import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; | @@ -16,7 +17,7 @@ import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; | ||
| 16 | import com.genersoft.iot.vmp.gb28181.utils.SipUtils; | 17 | import com.genersoft.iot.vmp.gb28181.utils.SipUtils; |
| 17 | import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; | 18 | import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; |
| 18 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 19 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 19 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 20 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 20 | import com.genersoft.iot.vmp.utils.GpsUtil; | 21 | import com.genersoft.iot.vmp.utils.GpsUtil; |
| 21 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; | 22 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; |
| 22 | import org.dom4j.DocumentException; | 23 | import org.dom4j.DocumentException; |
| @@ -46,10 +47,10 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements | @@ -46,10 +47,10 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements | ||
| 46 | private final static Logger logger = LoggerFactory.getLogger(NotifyRequestProcessor.class); | 47 | private final static Logger logger = LoggerFactory.getLogger(NotifyRequestProcessor.class); |
| 47 | 48 | ||
| 48 | @Autowired | 49 | @Autowired |
| 49 | - private UserSetup userSetup; | 50 | + private UserSetting userSetting; |
| 50 | 51 | ||
| 51 | @Autowired | 52 | @Autowired |
| 52 | - private IVideoManagerStorager storager; | 53 | + private IVideoManagerStorage storager; |
| 53 | 54 | ||
| 54 | @Autowired | 55 | @Autowired |
| 55 | private EventPublisher eventPublisher; | 56 | private EventPublisher eventPublisher; |
| @@ -109,11 +110,15 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements | @@ -109,11 +110,15 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements | ||
| 109 | */ | 110 | */ |
| 110 | private void processNotifyMobilePosition(RequestEvent evt) { | 111 | private void processNotifyMobilePosition(RequestEvent evt) { |
| 111 | try { | 112 | try { |
| 113 | + FromHeader fromHeader = (FromHeader) evt.getRequest().getHeader(FromHeader.NAME); | ||
| 114 | + String deviceId = SipUtils.getUserIdFromFromHeader(fromHeader); | ||
| 115 | + | ||
| 112 | // 回复 200 OK | 116 | // 回复 200 OK |
| 113 | Element rootElement = getRootElement(evt); | 117 | Element rootElement = getRootElement(evt); |
| 118 | + | ||
| 114 | MobilePosition mobilePosition = new MobilePosition(); | 119 | MobilePosition mobilePosition = new MobilePosition(); |
| 115 | Element deviceIdElement = rootElement.element("DeviceID"); | 120 | Element deviceIdElement = rootElement.element("DeviceID"); |
| 116 | - String deviceId = deviceIdElement.getTextTrim().toString(); | 121 | + String channelId = deviceIdElement.getTextTrim().toString(); |
| 117 | Device device = redisCatchStorage.getDevice(deviceId); | 122 | Device device = redisCatchStorage.getDevice(deviceId); |
| 118 | if (device != null) { | 123 | if (device != null) { |
| 119 | if (!StringUtils.isEmpty(device.getName())) { | 124 | if (!StringUtils.isEmpty(device.getName())) { |
| @@ -121,7 +126,9 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements | @@ -121,7 +126,9 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements | ||
| 121 | } | 126 | } |
| 122 | } | 127 | } |
| 123 | mobilePosition.setDeviceId(XmlUtil.getText(rootElement, "DeviceID")); | 128 | mobilePosition.setDeviceId(XmlUtil.getText(rootElement, "DeviceID")); |
| 124 | - mobilePosition.setTime(XmlUtil.getText(rootElement, "Time")); | 129 | + mobilePosition.setChannelId(channelId); |
| 130 | + String time = XmlUtil.getText(rootElement, "Time"); | ||
| 131 | + mobilePosition.setTime(time); | ||
| 125 | mobilePosition.setLongitude(Double.parseDouble(XmlUtil.getText(rootElement, "Longitude"))); | 132 | mobilePosition.setLongitude(Double.parseDouble(XmlUtil.getText(rootElement, "Longitude"))); |
| 126 | mobilePosition.setLatitude(Double.parseDouble(XmlUtil.getText(rootElement, "Latitude"))); | 133 | mobilePosition.setLatitude(Double.parseDouble(XmlUtil.getText(rootElement, "Latitude"))); |
| 127 | if (NumericUtil.isDouble(XmlUtil.getText(rootElement, "Speed"))) { | 134 | if (NumericUtil.isDouble(XmlUtil.getText(rootElement, "Speed"))) { |
| @@ -140,16 +147,27 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements | @@ -140,16 +147,27 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements | ||
| 140 | mobilePosition.setAltitude(0.0); | 147 | mobilePosition.setAltitude(0.0); |
| 141 | } | 148 | } |
| 142 | mobilePosition.setReportSource("Mobile Position"); | 149 | mobilePosition.setReportSource("Mobile Position"); |
| 143 | - BaiduPoint bp = new BaiduPoint(); | ||
| 144 | - bp = GpsUtil.Wgs84ToBd09(String.valueOf(mobilePosition.getLongitude()), String.valueOf(mobilePosition.getLatitude())); | 150 | + BaiduPoint bp = GpsUtil.Wgs84ToBd09(String.valueOf(mobilePosition.getLongitude()), String.valueOf(mobilePosition.getLatitude())); |
| 145 | logger.info("百度坐标:" + bp.getBdLng() + ", " + bp.getBdLat()); | 151 | logger.info("百度坐标:" + bp.getBdLng() + ", " + bp.getBdLat()); |
| 146 | mobilePosition.setGeodeticSystem("BD-09"); | 152 | mobilePosition.setGeodeticSystem("BD-09"); |
| 147 | mobilePosition.setCnLng(bp.getBdLng()); | 153 | mobilePosition.setCnLng(bp.getBdLng()); |
| 148 | mobilePosition.setCnLat(bp.getBdLat()); | 154 | mobilePosition.setCnLat(bp.getBdLat()); |
| 149 | - if (!userSetup.getSavePositionHistory()) { | 155 | + if (!userSetting.getSavePositionHistory()) { |
| 150 | storager.clearMobilePositionsByDeviceId(deviceId); | 156 | storager.clearMobilePositionsByDeviceId(deviceId); |
| 151 | } | 157 | } |
| 152 | storager.insertMobilePosition(mobilePosition); | 158 | storager.insertMobilePosition(mobilePosition); |
| 159 | + storager.updateChannelPotion(deviceId, channelId, mobilePosition.getLongitude(), mobilePosition.getLatitude() ); | ||
| 160 | + // 发送redis消息。 通知位置信息的变化 | ||
| 161 | + JSONObject jsonObject = new JSONObject(); | ||
| 162 | + jsonObject.put("time", time); | ||
| 163 | + jsonObject.put("serial", deviceId); | ||
| 164 | + jsonObject.put("code", channelId); | ||
| 165 | + jsonObject.put("longitude", mobilePosition.getLongitude()); | ||
| 166 | + jsonObject.put("latitude", mobilePosition.getLatitude()); | ||
| 167 | + jsonObject.put("altitude", mobilePosition.getAltitude()); | ||
| 168 | + jsonObject.put("direction", mobilePosition.getDirection()); | ||
| 169 | + jsonObject.put("speed", mobilePosition.getSpeed()); | ||
| 170 | + redisCatchStorage.sendMobilePositionMsg(jsonObject); | ||
| 153 | responseAck(evt, Response.OK); | 171 | responseAck(evt, Response.OK); |
| 154 | } catch (DocumentException | SipException | InvalidArgumentException | ParseException e) { | 172 | } catch (DocumentException | SipException | InvalidArgumentException | ParseException e) { |
| 155 | e.printStackTrace(); | 173 | e.printStackTrace(); |
| @@ -209,7 +227,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements | @@ -209,7 +227,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements | ||
| 209 | mobilePosition.setGeodeticSystem("BD-09"); | 227 | mobilePosition.setGeodeticSystem("BD-09"); |
| 210 | mobilePosition.setCnLng(bp.getBdLng()); | 228 | mobilePosition.setCnLng(bp.getBdLng()); |
| 211 | mobilePosition.setCnLat(bp.getBdLat()); | 229 | mobilePosition.setCnLat(bp.getBdLat()); |
| 212 | - if (!userSetup.getSavePositionHistory()) { | 230 | + if (!userSetting.getSavePositionHistory()) { |
| 213 | storager.clearMobilePositionsByDeviceId(deviceId); | 231 | storager.clearMobilePositionsByDeviceId(deviceId); |
| 214 | } | 232 | } |
| 215 | storager.insertMobilePosition(mobilePosition); | 233 | storager.insertMobilePosition(mobilePosition); |
| @@ -321,7 +339,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements | @@ -321,7 +339,7 @@ public class NotifyRequestProcessor extends SIPRequestProcessorParent implements | ||
| 321 | public void setCmder(SIPCommander cmder) { | 339 | public void setCmder(SIPCommander cmder) { |
| 322 | } | 340 | } |
| 323 | 341 | ||
| 324 | - public void setStorager(IVideoManagerStorager storager) { | 342 | + public void setStorager(IVideoManagerStorage storager) { |
| 325 | this.storager = storager; | 343 | this.storager = storager; |
| 326 | } | 344 | } |
| 327 | 345 |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/RegisterRequestProcessor.java
| @@ -11,7 +11,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; | @@ -11,7 +11,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; | ||
| 11 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor; | 11 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor; |
| 12 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; | 12 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 13 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 13 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 14 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 14 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 15 | import gov.nist.javax.sip.RequestEventExt; | 15 | import gov.nist.javax.sip.RequestEventExt; |
| 16 | import gov.nist.javax.sip.address.AddressImpl; | 16 | import gov.nist.javax.sip.address.AddressImpl; |
| 17 | import gov.nist.javax.sip.address.SipUri; | 17 | import gov.nist.javax.sip.address.SipUri; |
| @@ -56,7 +56,7 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen | @@ -56,7 +56,7 @@ public class RegisterRequestProcessor extends SIPRequestProcessorParent implemen | ||
| 56 | private IRedisCatchStorage redisCatchStorage; | 56 | private IRedisCatchStorage redisCatchStorage; |
| 57 | 57 | ||
| 58 | @Autowired | 58 | @Autowired |
| 59 | - private IVideoManagerStorager storager; | 59 | + private IVideoManagerStorage storager; |
| 60 | 60 | ||
| 61 | @Autowired | 61 | @Autowired |
| 62 | private EventPublisher publisher; | 62 | private EventPublisher publisher; |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/SubscribeRequestProcessor.java
| @@ -2,7 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl; | @@ -2,7 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl; | ||
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.common.VideoManagerConstants; | 3 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 4 | import com.genersoft.iot.vmp.conf.DynamicTask; | 4 | import com.genersoft.iot.vmp.conf.DynamicTask; |
| 5 | -import com.genersoft.iot.vmp.conf.UserSetup; | 5 | +import com.genersoft.iot.vmp.conf.UserSetting; |
| 6 | import com.genersoft.iot.vmp.gb28181.bean.CmdType; | 6 | import com.genersoft.iot.vmp.gb28181.bean.CmdType; |
| 7 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | 7 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| 8 | import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder; | 8 | import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder; |
| @@ -15,8 +15,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorP | @@ -15,8 +15,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorP | ||
| 15 | import com.genersoft.iot.vmp.gb28181.utils.SipUtils; | 15 | import com.genersoft.iot.vmp.gb28181.utils.SipUtils; |
| 16 | import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; | 16 | import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; |
| 17 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 17 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 18 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | ||
| 19 | -import com.genersoft.iot.vmp.utils.SerializeUtils; | 18 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 20 | import gov.nist.javax.sip.SipProviderImpl; | 19 | import gov.nist.javax.sip.SipProviderImpl; |
| 21 | import org.dom4j.DocumentException; | 20 | import org.dom4j.DocumentException; |
| 22 | import org.dom4j.Element; | 21 | import org.dom4j.Element; |
| @@ -30,7 +29,6 @@ import org.springframework.stereotype.Component; | @@ -30,7 +29,6 @@ import org.springframework.stereotype.Component; | ||
| 30 | 29 | ||
| 31 | import javax.sip.*; | 30 | import javax.sip.*; |
| 32 | import javax.sip.header.ExpiresHeader; | 31 | import javax.sip.header.ExpiresHeader; |
| 33 | -import javax.sip.header.ToHeader; | ||
| 34 | import javax.sip.message.Request; | 32 | import javax.sip.message.Request; |
| 35 | import javax.sip.message.Response; | 33 | import javax.sip.message.Response; |
| 36 | import java.text.ParseException; | 34 | import java.text.ParseException; |
| @@ -54,7 +52,7 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme | @@ -54,7 +52,7 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme | ||
| 54 | private ISIPCommanderForPlatform sipCommanderForPlatform; | 52 | private ISIPCommanderForPlatform sipCommanderForPlatform; |
| 55 | 53 | ||
| 56 | @Autowired | 54 | @Autowired |
| 57 | - private IVideoManagerStorager storager; | 55 | + private IVideoManagerStorage storager; |
| 58 | 56 | ||
| 59 | @Lazy | 57 | @Lazy |
| 60 | @Autowired | 58 | @Autowired |
| @@ -70,7 +68,7 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme | @@ -70,7 +68,7 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme | ||
| 70 | private DynamicTask dynamicTask; | 68 | private DynamicTask dynamicTask; |
| 71 | 69 | ||
| 72 | @Autowired | 70 | @Autowired |
| 73 | - private UserSetup userSetup; | 71 | + private UserSetting userSetting; |
| 74 | 72 | ||
| 75 | 73 | ||
| 76 | @Autowired | 74 | @Autowired |
| @@ -135,12 +133,21 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme | @@ -135,12 +133,21 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme | ||
| 135 | /** | 133 | /** |
| 136 | * 处理移动位置订阅消息 | 134 | * 处理移动位置订阅消息 |
| 137 | */ | 135 | */ |
| 138 | - private void processNotifyMobilePosition(RequestEvent evt, Element rootElement) { | 136 | + private void processNotifyMobilePosition(RequestEvent evt, Element rootElement) throws SipException { |
| 139 | String platformId = SipUtils.getUserIdFromFromHeader(evt.getRequest()); | 137 | String platformId = SipUtils.getUserIdFromFromHeader(evt.getRequest()); |
| 140 | String deviceID = XmlUtil.getText(rootElement, "DeviceID"); | 138 | String deviceID = XmlUtil.getText(rootElement, "DeviceID"); |
| 139 | + ParentPlatform platform = storager.queryParentPlatByServerGBId(platformId); | ||
| 141 | SubscribeInfo subscribeInfo = new SubscribeInfo(evt, platformId); | 140 | SubscribeInfo subscribeInfo = new SubscribeInfo(evt, platformId); |
| 141 | + if (evt.getServerTransaction() == null) { | ||
| 142 | + ServerTransaction serverTransaction = platform.getTransport().equals("TCP") ? tcpSipProvider.getNewServerTransaction(evt.getRequest()) | ||
| 143 | + : udpSipProvider.getNewServerTransaction(evt.getRequest()); | ||
| 144 | + subscribeInfo.setTransaction(serverTransaction); | ||
| 145 | + Dialog dialog = serverTransaction.getDialog(); | ||
| 146 | + dialog.terminateOnBye(false); | ||
| 147 | + subscribeInfo.setDialog(dialog); | ||
| 148 | + } | ||
| 142 | String sn = XmlUtil.getText(rootElement, "SN"); | 149 | String sn = XmlUtil.getText(rootElement, "SN"); |
| 143 | - String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_MobilePosition_" + platformId; | 150 | + String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetting.getServerId() + "_MobilePosition_" + platformId; |
| 144 | logger.info("接收到{}的MobilePosition订阅", platformId); | 151 | logger.info("接收到{}的MobilePosition订阅", platformId); |
| 145 | StringBuilder resultXml = new StringBuilder(200); | 152 | StringBuilder resultXml = new StringBuilder(200); |
| 146 | resultXml.append("<?xml version=\"1.0\" ?>\r\n") | 153 | resultXml.append("<?xml version=\"1.0\" ?>\r\n") |
| @@ -193,7 +200,7 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme | @@ -193,7 +200,7 @@ public class SubscribeRequestProcessor extends SIPRequestProcessorParent impleme | ||
| 193 | subscribeInfo.setDialog(dialog); | 200 | subscribeInfo.setDialog(dialog); |
| 194 | } | 201 | } |
| 195 | String sn = XmlUtil.getText(rootElement, "SN"); | 202 | String sn = XmlUtil.getText(rootElement, "SN"); |
| 196 | - String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_Catalog_" + platformId; | 203 | + String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetting.getServerId() + "_Catalog_" + platformId; |
| 197 | logger.info("接收到{}的Catalog订阅", platformId); | 204 | logger.info("接收到{}的Catalog订阅", platformId); |
| 198 | StringBuilder resultXml = new StringBuilder(200); | 205 | StringBuilder resultXml = new StringBuilder(200); |
| 199 | resultXml.append("<?xml version=\"1.0\" ?>\r\n") | 206 | resultXml.append("<?xml version=\"1.0\" ?>\r\n") |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/MessageRequestProcessor.java
| @@ -11,7 +11,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor | @@ -11,7 +11,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.ISIPRequestProcessor | ||
| 11 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; | 11 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 12 | import com.genersoft.iot.vmp.gb28181.utils.SipUtils; | 12 | import com.genersoft.iot.vmp.gb28181.utils.SipUtils; |
| 13 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 13 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 14 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 14 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 15 | import org.dom4j.DocumentException; | 15 | import org.dom4j.DocumentException; |
| 16 | import org.dom4j.Element; | 16 | import org.dom4j.Element; |
| 17 | import org.slf4j.Logger; | 17 | import org.slf4j.Logger; |
| @@ -43,7 +43,7 @@ public class MessageRequestProcessor extends SIPRequestProcessorParent implement | @@ -43,7 +43,7 @@ public class MessageRequestProcessor extends SIPRequestProcessorParent implement | ||
| 43 | private SIPProcessorObserver sipProcessorObserver; | 43 | private SIPProcessorObserver sipProcessorObserver; |
| 44 | 44 | ||
| 45 | @Autowired | 45 | @Autowired |
| 46 | - private IVideoManagerStorager storage; | 46 | + private IVideoManagerStorage storage; |
| 47 | 47 | ||
| 48 | @Autowired | 48 | @Autowired |
| 49 | private SipSubscribe sipSubscribe; | 49 | private SipSubscribe sipSubscribe; |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/control/cmd/DeviceControlQueryMessageHandler.java
| @@ -8,8 +8,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; | @@ -8,8 +8,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; | ||
| 8 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; | 8 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; | 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| 10 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.control.ControlMessageHandler; | 10 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.control.ControlMessageHandler; |
| 11 | -import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.QueryMessageHandler; | ||
| 12 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 11 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 13 | import com.genersoft.iot.vmp.utils.SpringBeanFactory; | 12 | import com.genersoft.iot.vmp.utils.SpringBeanFactory; |
| 14 | import gov.nist.javax.sip.SipStackImpl; | 13 | import gov.nist.javax.sip.SipStackImpl; |
| 15 | import org.dom4j.Element; | 14 | import org.dom4j.Element; |
| @@ -41,7 +40,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent | @@ -41,7 +40,7 @@ public class DeviceControlQueryMessageHandler extends SIPRequestProcessorParent | ||
| 41 | private ControlMessageHandler controlMessageHandler; | 40 | private ControlMessageHandler controlMessageHandler; |
| 42 | 41 | ||
| 43 | @Autowired | 42 | @Autowired |
| 44 | - private IVideoManagerStorager storager; | 43 | + private IVideoManagerStorage storager; |
| 45 | 44 | ||
| 46 | @Autowired | 45 | @Autowired |
| 47 | private SIPCommander cmder; | 46 | private SIPCommander cmder; |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/AlarmNotifyMessageHandler.java
| 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd; | 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd; |
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.conf.SipConfig; | 3 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 4 | -import com.genersoft.iot.vmp.conf.UserSetup; | 4 | +import com.genersoft.iot.vmp.conf.UserSetting; |
| 5 | import com.genersoft.iot.vmp.gb28181.bean.*; | 5 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 6 | import com.genersoft.iot.vmp.gb28181.event.DeviceOffLineDetector; | 6 | import com.genersoft.iot.vmp.gb28181.event.DeviceOffLineDetector; |
| 7 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | 7 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| @@ -10,7 +10,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessag | @@ -10,7 +10,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessag | ||
| 10 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler; | 10 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler; |
| 11 | import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; | 11 | import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; |
| 12 | import com.genersoft.iot.vmp.service.IDeviceAlarmService; | 12 | import com.genersoft.iot.vmp.service.IDeviceAlarmService; |
| 13 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 13 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 14 | import com.genersoft.iot.vmp.utils.GpsUtil; | 14 | import com.genersoft.iot.vmp.utils.GpsUtil; |
| 15 | import org.dom4j.Element; | 15 | import org.dom4j.Element; |
| 16 | import org.slf4j.Logger; | 16 | import org.slf4j.Logger; |
| @@ -37,13 +37,13 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme | @@ -37,13 +37,13 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme | ||
| 37 | private EventPublisher publisher; | 37 | private EventPublisher publisher; |
| 38 | 38 | ||
| 39 | @Autowired | 39 | @Autowired |
| 40 | - private UserSetup userSetup; | 40 | + private UserSetting userSetting; |
| 41 | 41 | ||
| 42 | @Autowired | 42 | @Autowired |
| 43 | private SipConfig sipConfig; | 43 | private SipConfig sipConfig; |
| 44 | 44 | ||
| 45 | @Autowired | 45 | @Autowired |
| 46 | - private IVideoManagerStorager storager; | 46 | + private IVideoManagerStorage storager; |
| 47 | 47 | ||
| 48 | @Autowired | 48 | @Autowired |
| 49 | private IDeviceAlarmService deviceAlarmService; | 49 | private IDeviceAlarmService deviceAlarmService; |
| @@ -99,7 +99,7 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme | @@ -99,7 +99,7 @@ public class AlarmNotifyMessageHandler extends SIPRequestProcessorParent impleme | ||
| 99 | mobilePosition.setGeodeticSystem("BD-09"); | 99 | mobilePosition.setGeodeticSystem("BD-09"); |
| 100 | mobilePosition.setCnLng(bp.getBdLng()); | 100 | mobilePosition.setCnLng(bp.getBdLng()); |
| 101 | mobilePosition.setCnLat(bp.getBdLat()); | 101 | mobilePosition.setCnLat(bp.getBdLat()); |
| 102 | - if (!userSetup.getSavePositionHistory()) { | 102 | + if (!userSetting.getSavePositionHistory()) { |
| 103 | storager.clearMobilePositionsByDeviceId(device.getDeviceId()); | 103 | storager.clearMobilePositionsByDeviceId(device.getDeviceId()); |
| 104 | } | 104 | } |
| 105 | storager.insertMobilePosition(mobilePosition); | 105 | storager.insertMobilePosition(mobilePosition); |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/CatalogNotifyMessageHandler.java
| 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd; | 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd; |
| 2 | 2 | ||
| 3 | -import com.genersoft.iot.vmp.conf.SipConfig; | ||
| 4 | import com.genersoft.iot.vmp.gb28181.bean.*; | 3 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 5 | -import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | ||
| 6 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | 4 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 7 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; | 5 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; |
| 8 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; | 6 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; | 7 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| 10 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler; | 8 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler; |
| 11 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | ||
| 12 | -import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; | 9 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 13 | import org.dom4j.Element; | 10 | import org.dom4j.Element; |
| 14 | -import org.slf4j.Logger; | ||
| 15 | -import org.slf4j.LoggerFactory; | ||
| 16 | import org.springframework.beans.factory.InitializingBean; | 11 | import org.springframework.beans.factory.InitializingBean; |
| 17 | import org.springframework.beans.factory.annotation.Autowired; | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| 18 | import org.springframework.stereotype.Component; | 13 | import org.springframework.stereotype.Component; |
| @@ -28,21 +23,17 @@ import java.util.List; | @@ -28,21 +23,17 @@ import java.util.List; | ||
| 28 | @Component | 23 | @Component |
| 29 | public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent implements InitializingBean, IMessageHandler { | 24 | public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent implements InitializingBean, IMessageHandler { |
| 30 | 25 | ||
| 31 | - private Logger logger = LoggerFactory.getLogger(CatalogNotifyMessageHandler.class); | ||
| 32 | private final String cmdType = "Catalog"; | 26 | private final String cmdType = "Catalog"; |
| 33 | 27 | ||
| 34 | @Autowired | 28 | @Autowired |
| 35 | private NotifyMessageHandler notifyMessageHandler; | 29 | private NotifyMessageHandler notifyMessageHandler; |
| 36 | 30 | ||
| 37 | @Autowired | 31 | @Autowired |
| 38 | - private IVideoManagerStorager storager; | 32 | + private IVideoManagerStorage storage; |
| 39 | 33 | ||
| 40 | @Autowired | 34 | @Autowired |
| 41 | private SIPCommanderFroPlatform cmderFroPlatform; | 35 | private SIPCommanderFroPlatform cmderFroPlatform; |
| 42 | 36 | ||
| 43 | - @Autowired | ||
| 44 | - private SipConfig config; | ||
| 45 | - | ||
| 46 | @Override | 37 | @Override |
| 47 | public void afterPropertiesSet() throws Exception { | 38 | public void afterPropertiesSet() throws Exception { |
| 48 | notifyMessageHandler.addHandler(cmdType, this); | 39 | notifyMessageHandler.addHandler(cmdType, this); |
| @@ -64,12 +55,12 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple | @@ -64,12 +55,12 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple | ||
| 64 | Element snElement = rootElement.element("SN"); | 55 | Element snElement = rootElement.element("SN"); |
| 65 | String sn = snElement.getText(); | 56 | String sn = snElement.getText(); |
| 66 | // 准备回复通道信息 | 57 | // 准备回复通道信息 |
| 67 | - List<DeviceChannelInPlatform> deviceChannels = storager.queryChannelListInParentPlatform(parentPlatform.getServerGBId()); | 58 | + List<DeviceChannelInPlatform> deviceChannels = storage.queryChannelListInParentPlatform(parentPlatform.getServerGBId()); |
| 68 | // 查询关联的直播通道 | 59 | // 查询关联的直播通道 |
| 69 | - List<GbStream> gbStreams = storager.queryGbStreamListInPlatform(parentPlatform.getServerGBId()); | 60 | + List<GbStream> gbStreams = storage.queryGbStreamListInPlatform(parentPlatform.getServerGBId()); |
| 70 | int size = deviceChannels.size() + gbStreams.size(); | 61 | int size = deviceChannels.size() + gbStreams.size(); |
| 71 | // 回复目录信息 | 62 | // 回复目录信息 |
| 72 | - List<PlatformCatalog> catalogs = storager.queryCatalogInPlatform(parentPlatform.getServerGBId()); | 63 | + List<PlatformCatalog> catalogs = storage.queryCatalogInPlatform(parentPlatform.getServerGBId()); |
| 73 | if (catalogs.size() > 0) { | 64 | if (catalogs.size() > 0) { |
| 74 | for (PlatformCatalog catalog : catalogs) { | 65 | for (PlatformCatalog catalog : catalogs) { |
| 75 | if (catalog.getParentId().equals(catalog.getPlatformId())) { | 66 | if (catalog.getParentId().equals(catalog.getPlatformId())) { |
| @@ -101,7 +92,7 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple | @@ -101,7 +92,7 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple | ||
| 101 | if (channel.getCatalogId().equals(parentPlatform.getServerGBId())) { | 92 | if (channel.getCatalogId().equals(parentPlatform.getServerGBId())) { |
| 102 | channel.setCatalogId(parentPlatform.getDeviceGBId()); | 93 | channel.setCatalogId(parentPlatform.getDeviceGBId()); |
| 103 | } | 94 | } |
| 104 | - DeviceChannel deviceChannel = storager.queryChannel(channel.getDeviceId(), channel.getChannelId()); | 95 | + DeviceChannel deviceChannel = storage.queryChannel(channel.getDeviceId(), channel.getChannelId()); |
| 105 | deviceChannel.setParental(0); | 96 | deviceChannel.setParental(0); |
| 106 | deviceChannel.setParentId(channel.getCatalogId()); | 97 | deviceChannel.setParentId(channel.getCatalogId()); |
| 107 | deviceChannel.setCivilCode(parentPlatform.getDeviceGBId().substring(0, 6)); | 98 | deviceChannel.setCivilCode(parentPlatform.getDeviceGBId().substring(0, 6)); |
| @@ -140,13 +131,7 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple | @@ -140,13 +131,7 @@ public class CatalogNotifyMessageHandler extends SIPRequestProcessorParent imple | ||
| 140 | // 回复无通道 | 131 | // 回复无通道 |
| 141 | cmderFroPlatform.catalogQuery(null, parentPlatform, sn, fromHeader.getTag(), size); | 132 | cmderFroPlatform.catalogQuery(null, parentPlatform, sn, fromHeader.getTag(), size); |
| 142 | } | 133 | } |
| 143 | - } catch (SipException e) { | ||
| 144 | - e.printStackTrace(); | ||
| 145 | - } catch (InvalidArgumentException e) { | ||
| 146 | - e.printStackTrace(); | ||
| 147 | - } catch (ParseException e) { | ||
| 148 | - e.printStackTrace(); | ||
| 149 | - } catch (InterruptedException e) { | 134 | + } catch (SipException | InvalidArgumentException | ParseException | InterruptedException e) { |
| 150 | e.printStackTrace(); | 135 | e.printStackTrace(); |
| 151 | } | 136 | } |
| 152 | 137 |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/KeepaliveNotifyMessageHandler.java
| @@ -7,9 +7,8 @@ import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | @@ -7,9 +7,8 @@ import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | ||
| 7 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; | 7 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 8 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; | 8 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler; | 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler; |
| 10 | -import com.genersoft.iot.vmp.service.IDeviceService; | ||
| 11 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 10 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 12 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 11 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 13 | import org.dom4j.Element; | 12 | import org.dom4j.Element; |
| 14 | import org.slf4j.Logger; | 13 | import org.slf4j.Logger; |
| 15 | import org.slf4j.LoggerFactory; | 14 | import org.slf4j.LoggerFactory; |
| @@ -17,7 +16,6 @@ import org.springframework.beans.factory.InitializingBean; | @@ -17,7 +16,6 @@ import org.springframework.beans.factory.InitializingBean; | ||
| 17 | import org.springframework.beans.factory.annotation.Autowired; | 16 | import org.springframework.beans.factory.annotation.Autowired; |
| 18 | import org.springframework.stereotype.Component; | 17 | import org.springframework.stereotype.Component; |
| 19 | import org.springframework.util.StringUtils; | 18 | import org.springframework.util.StringUtils; |
| 20 | -import springfox.documentation.service.Header; | ||
| 21 | 19 | ||
| 22 | import javax.sip.InvalidArgumentException; | 20 | import javax.sip.InvalidArgumentException; |
| 23 | import javax.sip.RequestEvent; | 21 | import javax.sip.RequestEvent; |
| @@ -39,7 +37,7 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp | @@ -39,7 +37,7 @@ public class KeepaliveNotifyMessageHandler extends SIPRequestProcessorParent imp | ||
| 39 | private EventPublisher publisher; | 37 | private EventPublisher publisher; |
| 40 | 38 | ||
| 41 | @Autowired | 39 | @Autowired |
| 42 | - private IVideoManagerStorager videoManagerStorager; | 40 | + private IVideoManagerStorage videoManagerStorager; |
| 43 | 41 | ||
| 44 | @Autowired | 42 | @Autowired |
| 45 | private IRedisCatchStorage redisCatchStorage; | 43 | private IRedisCatchStorage redisCatchStorage; |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/notify/cmd/MobilePositionNotifyMessageHandler.java
| 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd; | 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.cmd; |
| 2 | 2 | ||
| 3 | -import com.genersoft.iot.vmp.conf.UserSetup; | 3 | +import com.genersoft.iot.vmp.conf.UserSetting; |
| 4 | import com.genersoft.iot.vmp.gb28181.bean.BaiduPoint; | 4 | import com.genersoft.iot.vmp.gb28181.bean.BaiduPoint; |
| 5 | import com.genersoft.iot.vmp.gb28181.bean.Device; | 5 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 6 | import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; | 6 | import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; |
| @@ -9,7 +9,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorP | @@ -9,7 +9,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorP | ||
| 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; | 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| 10 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler; | 10 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.notify.NotifyMessageHandler; |
| 11 | import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; | 11 | import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; |
| 12 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 12 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 13 | import com.genersoft.iot.vmp.utils.GpsUtil; | 13 | import com.genersoft.iot.vmp.utils.GpsUtil; |
| 14 | import org.dom4j.DocumentException; | 14 | import org.dom4j.DocumentException; |
| 15 | import org.dom4j.Element; | 15 | import org.dom4j.Element; |
| @@ -38,10 +38,10 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen | @@ -38,10 +38,10 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen | ||
| 38 | private NotifyMessageHandler notifyMessageHandler; | 38 | private NotifyMessageHandler notifyMessageHandler; |
| 39 | 39 | ||
| 40 | @Autowired | 40 | @Autowired |
| 41 | - private UserSetup userSetup; | 41 | + private UserSetting userSetting; |
| 42 | 42 | ||
| 43 | @Autowired | 43 | @Autowired |
| 44 | - private IVideoManagerStorager storager; | 44 | + private IVideoManagerStorage storager; |
| 45 | 45 | ||
| 46 | @Override | 46 | @Override |
| 47 | public void afterPropertiesSet() throws Exception { | 47 | public void afterPropertiesSet() throws Exception { |
| @@ -85,7 +85,7 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen | @@ -85,7 +85,7 @@ public class MobilePositionNotifyMessageHandler extends SIPRequestProcessorParen | ||
| 85 | mobilePosition.setGeodeticSystem("BD-09"); | 85 | mobilePosition.setGeodeticSystem("BD-09"); |
| 86 | mobilePosition.setCnLng(bp.getBdLng()); | 86 | mobilePosition.setCnLng(bp.getBdLng()); |
| 87 | mobilePosition.setCnLat(bp.getBdLat()); | 87 | mobilePosition.setCnLat(bp.getBdLat()); |
| 88 | - if (!userSetup.getSavePositionHistory()) { | 88 | + if (!userSetting.getSavePositionHistory()) { |
| 89 | storager.clearMobilePositionsByDeviceId(device.getDeviceId()); | 89 | storager.clearMobilePositionsByDeviceId(device.getDeviceId()); |
| 90 | } | 90 | } |
| 91 | storager.insertMobilePosition(mobilePosition); | 91 | storager.insertMobilePosition(mobilePosition); |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/AlarmQueryMessageHandler.java
| @@ -2,17 +2,13 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query. | @@ -2,17 +2,13 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query. | ||
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.conf.SipConfig; | 3 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 4 | import com.genersoft.iot.vmp.gb28181.bean.Device; | 4 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 5 | -import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | ||
| 6 | -import com.genersoft.iot.vmp.gb28181.bean.GbStream; | ||
| 7 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | 5 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| 8 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | 6 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 9 | -import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | ||
| 10 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; | 7 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; |
| 11 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; | 8 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 12 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; | 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| 13 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.QueryMessageHandler; | 10 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.QueryMessageHandler; |
| 14 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | ||
| 15 | -import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; | 11 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 16 | import org.dom4j.Element; | 12 | import org.dom4j.Element; |
| 17 | import org.slf4j.Logger; | 13 | import org.slf4j.Logger; |
| 18 | import org.slf4j.LoggerFactory; | 14 | import org.slf4j.LoggerFactory; |
| @@ -23,10 +19,8 @@ import org.springframework.stereotype.Component; | @@ -23,10 +19,8 @@ import org.springframework.stereotype.Component; | ||
| 23 | import javax.sip.InvalidArgumentException; | 19 | import javax.sip.InvalidArgumentException; |
| 24 | import javax.sip.RequestEvent; | 20 | import javax.sip.RequestEvent; |
| 25 | import javax.sip.SipException; | 21 | import javax.sip.SipException; |
| 26 | -import javax.sip.header.FromHeader; | ||
| 27 | import javax.sip.message.Response; | 22 | import javax.sip.message.Response; |
| 28 | import java.text.ParseException; | 23 | import java.text.ParseException; |
| 29 | -import java.util.List; | ||
| 30 | 24 | ||
| 31 | @Component | 25 | @Component |
| 32 | public class AlarmQueryMessageHandler extends SIPRequestProcessorParent implements InitializingBean, IMessageHandler { | 26 | public class AlarmQueryMessageHandler extends SIPRequestProcessorParent implements InitializingBean, IMessageHandler { |
| @@ -38,7 +32,7 @@ public class AlarmQueryMessageHandler extends SIPRequestProcessorParent implemen | @@ -38,7 +32,7 @@ public class AlarmQueryMessageHandler extends SIPRequestProcessorParent implemen | ||
| 38 | private QueryMessageHandler queryMessageHandler; | 32 | private QueryMessageHandler queryMessageHandler; |
| 39 | 33 | ||
| 40 | @Autowired | 34 | @Autowired |
| 41 | - private IVideoManagerStorager storager; | 35 | + private IVideoManagerStorage storager; |
| 42 | 36 | ||
| 43 | @Autowired | 37 | @Autowired |
| 44 | private SIPCommanderFroPlatform cmderFroPlatform; | 38 | private SIPCommanderFroPlatform cmderFroPlatform; |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/CatalogQueryMessageHandler.java
| @@ -8,8 +8,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; | @@ -8,8 +8,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; | ||
| 8 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; | 8 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; | 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| 10 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.QueryMessageHandler; | 10 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.QueryMessageHandler; |
| 11 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | ||
| 12 | -import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; | 11 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 13 | import org.dom4j.Element; | 12 | import org.dom4j.Element; |
| 14 | import org.slf4j.Logger; | 13 | import org.slf4j.Logger; |
| 15 | import org.slf4j.LoggerFactory; | 14 | import org.slf4j.LoggerFactory; |
| @@ -35,7 +34,7 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem | @@ -35,7 +34,7 @@ public class CatalogQueryMessageHandler extends SIPRequestProcessorParent implem | ||
| 35 | private QueryMessageHandler queryMessageHandler; | 34 | private QueryMessageHandler queryMessageHandler; |
| 36 | 35 | ||
| 37 | @Autowired | 36 | @Autowired |
| 38 | - private IVideoManagerStorager storager; | 37 | + private IVideoManagerStorage storager; |
| 39 | 38 | ||
| 40 | @Autowired | 39 | @Autowired |
| 41 | private SIPCommanderFroPlatform cmderFroPlatform; | 40 | private SIPCommanderFroPlatform cmderFroPlatform; |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/DeviceStatusQueryMessageHandler.java
| @@ -8,7 +8,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; | @@ -8,7 +8,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; | ||
| 8 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; | 8 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; | 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| 10 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.QueryMessageHandler; | 10 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.QueryMessageHandler; |
| 11 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 11 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 12 | import org.dom4j.Element; | 12 | import org.dom4j.Element; |
| 13 | import org.slf4j.Logger; | 13 | import org.slf4j.Logger; |
| 14 | import org.slf4j.LoggerFactory; | 14 | import org.slf4j.LoggerFactory; |
| @@ -33,7 +33,7 @@ public class DeviceStatusQueryMessageHandler extends SIPRequestProcessorParent i | @@ -33,7 +33,7 @@ public class DeviceStatusQueryMessageHandler extends SIPRequestProcessorParent i | ||
| 33 | private QueryMessageHandler queryMessageHandler; | 33 | private QueryMessageHandler queryMessageHandler; |
| 34 | 34 | ||
| 35 | @Autowired | 35 | @Autowired |
| 36 | - private IVideoManagerStorager storager; | 36 | + private IVideoManagerStorage storager; |
| 37 | 37 | ||
| 38 | @Autowired | 38 | @Autowired |
| 39 | private SIPCommanderFroPlatform cmderFroPlatform; | 39 | private SIPCommanderFroPlatform cmderFroPlatform; |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/RecordInfoQueryMessageHandler.java
| @@ -4,16 +4,14 @@ import com.genersoft.iot.vmp.conf.SipConfig; | @@ -4,16 +4,14 @@ import com.genersoft.iot.vmp.conf.SipConfig; | ||
| 4 | import com.genersoft.iot.vmp.gb28181.bean.*; | 4 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 5 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | 5 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 6 | import com.genersoft.iot.vmp.gb28181.event.record.RecordEndEventListener; | 6 | import com.genersoft.iot.vmp.gb28181.event.record.RecordEndEventListener; |
| 7 | -import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | ||
| 8 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | 7 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| 9 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; | 8 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; |
| 10 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; | 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 11 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; | 10 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| 12 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.QueryMessageHandler; | 11 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.QueryMessageHandler; |
| 13 | import com.genersoft.iot.vmp.gb28181.utils.DateUtil; | 12 | import com.genersoft.iot.vmp.gb28181.utils.DateUtil; |
| 14 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 13 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 15 | import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo; | 14 | import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo; |
| 16 | -import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; | ||
| 17 | import org.dom4j.Element; | 15 | import org.dom4j.Element; |
| 18 | import org.slf4j.Logger; | 16 | import org.slf4j.Logger; |
| 19 | import org.slf4j.LoggerFactory; | 17 | import org.slf4j.LoggerFactory; |
| @@ -39,7 +37,7 @@ public class RecordInfoQueryMessageHandler extends SIPRequestProcessorParent imp | @@ -39,7 +37,7 @@ public class RecordInfoQueryMessageHandler extends SIPRequestProcessorParent imp | ||
| 39 | private QueryMessageHandler queryMessageHandler; | 37 | private QueryMessageHandler queryMessageHandler; |
| 40 | 38 | ||
| 41 | @Autowired | 39 | @Autowired |
| 42 | - private IVideoManagerStorager storager; | 40 | + private IVideoManagerStorage storager; |
| 43 | 41 | ||
| 44 | @Autowired | 42 | @Autowired |
| 45 | private SIPCommanderFroPlatform cmderFroPlatform; | 43 | private SIPCommanderFroPlatform cmderFroPlatform; |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/CatalogResponseMessageHandler.java
| @@ -2,7 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.respon | @@ -2,7 +2,7 @@ package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.respon | ||
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.common.VideoManagerConstants; | 3 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 4 | import com.genersoft.iot.vmp.conf.SipConfig; | 4 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 5 | -import com.genersoft.iot.vmp.conf.UserSetup; | 5 | +import com.genersoft.iot.vmp.conf.UserSetting; |
| 6 | import com.genersoft.iot.vmp.gb28181.bean.*; | 6 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 7 | import com.genersoft.iot.vmp.gb28181.event.DeviceOffLineDetector; | 7 | import com.genersoft.iot.vmp.gb28181.event.DeviceOffLineDetector; |
| 8 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | 8 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| @@ -15,7 +15,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.respons | @@ -15,7 +15,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.respons | ||
| 15 | import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; | 15 | import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; |
| 16 | import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; | 16 | import com.genersoft.iot.vmp.gb28181.utils.XmlUtil; |
| 17 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 17 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 18 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 18 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 19 | import com.genersoft.iot.vmp.utils.GpsUtil; | 19 | import com.genersoft.iot.vmp.utils.GpsUtil; |
| 20 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | 20 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 21 | import org.dom4j.DocumentException; | 21 | import org.dom4j.DocumentException; |
| @@ -34,12 +34,9 @@ import javax.sip.message.Response; | @@ -34,12 +34,9 @@ import javax.sip.message.Response; | ||
| 34 | import java.text.ParseException; | 34 | import java.text.ParseException; |
| 35 | import java.text.SimpleDateFormat; | 35 | import java.text.SimpleDateFormat; |
| 36 | import java.util.ArrayList; | 36 | import java.util.ArrayList; |
| 37 | -import java.util.Date; | ||
| 38 | import java.util.Iterator; | 37 | import java.util.Iterator; |
| 39 | import java.util.List; | 38 | import java.util.List; |
| 40 | 39 | ||
| 41 | -import static com.genersoft.iot.vmp.gb28181.utils.XmlUtil.getText; | ||
| 42 | - | ||
| 43 | @Component | 40 | @Component |
| 44 | public class CatalogResponseMessageHandler extends SIPRequestProcessorParent implements InitializingBean, IMessageHandler { | 41 | public class CatalogResponseMessageHandler extends SIPRequestProcessorParent implements InitializingBean, IMessageHandler { |
| 45 | 42 | ||
| @@ -52,7 +49,7 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp | @@ -52,7 +49,7 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp | ||
| 52 | private ResponseMessageHandler responseMessageHandler; | 49 | private ResponseMessageHandler responseMessageHandler; |
| 53 | 50 | ||
| 54 | @Autowired | 51 | @Autowired |
| 55 | - private IVideoManagerStorager storager; | 52 | + private IVideoManagerStorage storager; |
| 56 | 53 | ||
| 57 | @Autowired | 54 | @Autowired |
| 58 | private DeferredResultHolder deferredResultHolder; | 55 | private DeferredResultHolder deferredResultHolder; |
| @@ -71,7 +68,7 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp | @@ -71,7 +68,7 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp | ||
| 71 | 68 | ||
| 72 | //by brewswang | 69 | //by brewswang |
| 73 | @Autowired | 70 | @Autowired |
| 74 | - private UserSetup userSetup; | 71 | + private UserSetting userSetting; |
| 75 | 72 | ||
| 76 | @Autowired | 73 | @Autowired |
| 77 | private IRedisCatchStorage redisCatchStorage; | 74 | private IRedisCatchStorage redisCatchStorage; |
| @@ -224,7 +221,7 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp | @@ -224,7 +221,7 @@ public class CatalogResponseMessageHandler extends SIPRequestProcessorParent imp | ||
| 224 | mobilePosition.setGeodeticSystem("BD-09"); | 221 | mobilePosition.setGeodeticSystem("BD-09"); |
| 225 | mobilePosition.setCnLng(bp.getBdLng()); | 222 | mobilePosition.setCnLng(bp.getBdLng()); |
| 226 | mobilePosition.setCnLat(bp.getBdLat()); | 223 | mobilePosition.setCnLat(bp.getBdLat()); |
| 227 | - if (!userSetup.getSavePositionHistory()) { | 224 | + if (!userSetting.getSavePositionHistory()) { |
| 228 | storager.clearMobilePositionsByDeviceId(deviceId); | 225 | storager.clearMobilePositionsByDeviceId(deviceId); |
| 229 | } | 226 | } |
| 230 | storager.insertMobilePosition(mobilePosition); | 227 | storager.insertMobilePosition(mobilePosition); |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/DeviceInfoResponseMessageHandler.java
| @@ -11,7 +11,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; | @@ -11,7 +11,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; | ||
| 11 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; | 11 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorParent; |
| 12 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; | 12 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| 13 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler; | 13 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler; |
| 14 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 14 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 15 | import org.dom4j.DocumentException; | 15 | import org.dom4j.DocumentException; |
| 16 | import org.dom4j.Element; | 16 | import org.dom4j.Element; |
| 17 | import org.slf4j.Logger; | 17 | import org.slf4j.Logger; |
| @@ -39,7 +39,7 @@ public class DeviceInfoResponseMessageHandler extends SIPRequestProcessorParent | @@ -39,7 +39,7 @@ public class DeviceInfoResponseMessageHandler extends SIPRequestProcessorParent | ||
| 39 | private ResponseMessageHandler responseMessageHandler; | 39 | private ResponseMessageHandler responseMessageHandler; |
| 40 | 40 | ||
| 41 | @Autowired | 41 | @Autowired |
| 42 | - private IVideoManagerStorager storager; | 42 | + private IVideoManagerStorage storager; |
| 43 | 43 | ||
| 44 | @Autowired | 44 | @Autowired |
| 45 | private DeferredResultHolder deferredResultHolder; | 45 | private DeferredResultHolder deferredResultHolder; |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/response/cmd/MobilePositionResponseMessageHandler.java
| 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd; | 1 | package com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.cmd; |
| 2 | 2 | ||
| 3 | -import com.genersoft.iot.vmp.conf.UserSetup; | 3 | +import com.genersoft.iot.vmp.conf.UserSetting; |
| 4 | import com.genersoft.iot.vmp.gb28181.bean.BaiduPoint; | 4 | import com.genersoft.iot.vmp.gb28181.bean.BaiduPoint; |
| 5 | import com.genersoft.iot.vmp.gb28181.bean.Device; | 5 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 6 | import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; | 6 | import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; |
| @@ -9,7 +9,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorP | @@ -9,7 +9,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.SIPRequestProcessorP | ||
| 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; | 9 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessageHandler; |
| 10 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler; | 10 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.response.ResponseMessageHandler; |
| 11 | import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; | 11 | import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; |
| 12 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 12 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 13 | import com.genersoft.iot.vmp.utils.GpsUtil; | 13 | import com.genersoft.iot.vmp.utils.GpsUtil; |
| 14 | import org.dom4j.DocumentException; | 14 | import org.dom4j.DocumentException; |
| 15 | import org.dom4j.Element; | 15 | import org.dom4j.Element; |
| @@ -38,10 +38,10 @@ public class MobilePositionResponseMessageHandler extends SIPRequestProcessorPar | @@ -38,10 +38,10 @@ public class MobilePositionResponseMessageHandler extends SIPRequestProcessorPar | ||
| 38 | private ResponseMessageHandler responseMessageHandler; | 38 | private ResponseMessageHandler responseMessageHandler; |
| 39 | 39 | ||
| 40 | @Autowired | 40 | @Autowired |
| 41 | - private UserSetup userSetup; | 41 | + private UserSetting userSetting; |
| 42 | 42 | ||
| 43 | @Autowired | 43 | @Autowired |
| 44 | - private IVideoManagerStorager storager; | 44 | + private IVideoManagerStorage storager; |
| 45 | 45 | ||
| 46 | @Override | 46 | @Override |
| 47 | public void afterPropertiesSet() throws Exception { | 47 | public void afterPropertiesSet() throws Exception { |
| @@ -85,7 +85,7 @@ public class MobilePositionResponseMessageHandler extends SIPRequestProcessorPar | @@ -85,7 +85,7 @@ public class MobilePositionResponseMessageHandler extends SIPRequestProcessorPar | ||
| 85 | mobilePosition.setGeodeticSystem("BD-09"); | 85 | mobilePosition.setGeodeticSystem("BD-09"); |
| 86 | mobilePosition.setCnLng(bp.getBdLng()); | 86 | mobilePosition.setCnLng(bp.getBdLng()); |
| 87 | mobilePosition.setCnLat(bp.getBdLat()); | 87 | mobilePosition.setCnLat(bp.getBdLat()); |
| 88 | - if (!userSetup.getSavePositionHistory()) { | 88 | + if (!userSetting.getSavePositionHistory()) { |
| 89 | storager.clearMobilePositionsByDeviceId(device.getDeviceId()); | 89 | storager.clearMobilePositionsByDeviceId(device.getDeviceId()); |
| 90 | } | 90 | } |
| 91 | storager.insertMobilePosition(mobilePosition); | 91 | storager.insertMobilePosition(mobilePosition); |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/RegisterResponseProcessor.java
| @@ -7,7 +7,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; | @@ -7,7 +7,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.SIPProcessorObserver; | ||
| 7 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; | 7 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; |
| 8 | import com.genersoft.iot.vmp.gb28181.transmit.event.response.SIPResponseProcessorAbstract; | 8 | import com.genersoft.iot.vmp.gb28181.transmit.event.response.SIPResponseProcessorAbstract; |
| 9 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 9 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 10 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 10 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 11 | import org.slf4j.Logger; | 11 | import org.slf4j.Logger; |
| 12 | import org.slf4j.LoggerFactory; | 12 | import org.slf4j.LoggerFactory; |
| 13 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -33,7 +33,7 @@ public class RegisterResponseProcessor extends SIPResponseProcessorAbstract { | @@ -33,7 +33,7 @@ public class RegisterResponseProcessor extends SIPResponseProcessorAbstract { | ||
| 33 | private ISIPCommanderForPlatform sipCommanderForPlatform; | 33 | private ISIPCommanderForPlatform sipCommanderForPlatform; |
| 34 | 34 | ||
| 35 | @Autowired | 35 | @Autowired |
| 36 | - private IVideoManagerStorager storager; | 36 | + private IVideoManagerStorage storager; |
| 37 | 37 | ||
| 38 | @Autowired | 38 | @Autowired |
| 39 | private IRedisCatchStorage redisCatchStorage; | 39 | private IRedisCatchStorage redisCatchStorage; |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
| @@ -2,12 +2,10 @@ package com.genersoft.iot.vmp.media.zlm; | @@ -2,12 +2,10 @@ package com.genersoft.iot.vmp.media.zlm; | ||
| 2 | 2 | ||
| 3 | import java.util.ArrayList; | 3 | import java.util.ArrayList; |
| 4 | import java.util.List; | 4 | import java.util.List; |
| 5 | -import java.util.UUID; | ||
| 6 | 5 | ||
| 7 | import com.alibaba.fastjson.JSON; | 6 | import com.alibaba.fastjson.JSON; |
| 8 | import com.genersoft.iot.vmp.common.StreamInfo; | 7 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 9 | -import com.genersoft.iot.vmp.conf.MediaConfig; | ||
| 10 | -import com.genersoft.iot.vmp.conf.UserSetup; | 8 | +import com.genersoft.iot.vmp.conf.UserSetting; |
| 11 | import com.genersoft.iot.vmp.gb28181.bean.Device; | 9 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 12 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | 10 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| 13 | import com.genersoft.iot.vmp.gb28181.bean.GbStream; | 11 | import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| @@ -17,9 +15,8 @@ import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; | @@ -17,9 +15,8 @@ import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; | ||
| 17 | import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; | 15 | import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; |
| 18 | import com.genersoft.iot.vmp.media.zlm.dto.*; | 16 | import com.genersoft.iot.vmp.media.zlm.dto.*; |
| 19 | import com.genersoft.iot.vmp.service.*; | 17 | import com.genersoft.iot.vmp.service.*; |
| 20 | -import com.genersoft.iot.vmp.service.bean.SSRCInfo; | ||
| 21 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 18 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 22 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 19 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 23 | import org.slf4j.Logger; | 20 | import org.slf4j.Logger; |
| 24 | import org.slf4j.LoggerFactory; | 21 | import org.slf4j.LoggerFactory; |
| 25 | import org.springframework.beans.factory.annotation.Autowired; | 22 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -54,7 +51,7 @@ public class ZLMHttpHookListener { | @@ -54,7 +51,7 @@ public class ZLMHttpHookListener { | ||
| 54 | private IPlayService playService; | 51 | private IPlayService playService; |
| 55 | 52 | ||
| 56 | @Autowired | 53 | @Autowired |
| 57 | - private IVideoManagerStorager storager; | 54 | + private IVideoManagerStorage storager; |
| 58 | 55 | ||
| 59 | @Autowired | 56 | @Autowired |
| 60 | private IRedisCatchStorage redisCatchStorage; | 57 | private IRedisCatchStorage redisCatchStorage; |
| @@ -81,7 +78,7 @@ public class ZLMHttpHookListener { | @@ -81,7 +78,7 @@ public class ZLMHttpHookListener { | ||
| 81 | private ZLMHttpHookSubscribe subscribe; | 78 | private ZLMHttpHookSubscribe subscribe; |
| 82 | 79 | ||
| 83 | @Autowired | 80 | @Autowired |
| 84 | - private UserSetup userSetup; | 81 | + private UserSetting userSetting; |
| 85 | 82 | ||
| 86 | @Autowired | 83 | @Autowired |
| 87 | private VideoStreamSessionManager sessionManager; | 84 | private VideoStreamSessionManager sessionManager; |
| @@ -189,6 +186,12 @@ public class ZLMHttpHookListener { | @@ -189,6 +186,12 @@ public class ZLMHttpHookListener { | ||
| 189 | ret.put("code", 0); | 186 | ret.put("code", 0); |
| 190 | ret.put("msg", "success"); | 187 | ret.put("msg", "success"); |
| 191 | ret.put("enable_hls", true); | 188 | ret.put("enable_hls", true); |
| 189 | + if (json.getInteger("originType") == 1 | ||
| 190 | + || json.getInteger("originType") == 2 | ||
| 191 | + || json.getInteger("originType") == 3) { | ||
| 192 | + ret.put("enable_audio", true); | ||
| 193 | + } | ||
| 194 | + | ||
| 192 | String mediaServerId = json.getString("mediaServerId"); | 195 | String mediaServerId = json.getString("mediaServerId"); |
| 193 | ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_publish, json); | 196 | ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_publish, json); |
| 194 | if (subscribe != null) { | 197 | if (subscribe != null) { |
| @@ -203,9 +206,9 @@ public class ZLMHttpHookListener { | @@ -203,9 +206,9 @@ public class ZLMHttpHookListener { | ||
| 203 | String app = json.getString("app"); | 206 | String app = json.getString("app"); |
| 204 | String stream = json.getString("stream"); | 207 | String stream = json.getString("stream"); |
| 205 | if ("rtp".equals(app)) { | 208 | if ("rtp".equals(app)) { |
| 206 | - ret.put("enable_mp4", userSetup.getRecordSip()); | 209 | + ret.put("enable_mp4", userSetting.getRecordSip()); |
| 207 | }else { | 210 | }else { |
| 208 | - ret.put("enable_mp4", userSetup.isRecordPushLive()); | 211 | + ret.put("enable_mp4", userSetting.isRecordPushLive()); |
| 209 | } | 212 | } |
| 210 | List<SsrcTransaction> ssrcTransactionForAll = sessionManager.getSsrcTransactionForAll(null, null, null, stream); | 213 | List<SsrcTransaction> ssrcTransactionForAll = sessionManager.getSsrcTransactionForAll(null, null, null, stream); |
| 211 | if (ssrcTransactionForAll != null && ssrcTransactionForAll.size() == 1) { | 214 | if (ssrcTransactionForAll != null && ssrcTransactionForAll.size() == 1) { |
| @@ -412,7 +415,7 @@ public class ZLMHttpHookListener { | @@ -412,7 +415,7 @@ public class ZLMHttpHookListener { | ||
| 412 | if (type != null) { | 415 | if (type != null) { |
| 413 | // 发送流变化redis消息 | 416 | // 发送流变化redis消息 |
| 414 | JSONObject jsonObject = new JSONObject(); | 417 | JSONObject jsonObject = new JSONObject(); |
| 415 | - jsonObject.put("serverId", userSetup.getServerId()); | 418 | + jsonObject.put("serverId", userSetting.getServerId()); |
| 416 | jsonObject.put("app", app); | 419 | jsonObject.put("app", app); |
| 417 | jsonObject.put("stream", streamId); | 420 | jsonObject.put("stream", streamId); |
| 418 | jsonObject.put("register", regist); | 421 | jsonObject.put("register", regist); |
| @@ -506,7 +509,7 @@ public class ZLMHttpHookListener { | @@ -506,7 +509,7 @@ public class ZLMHttpHookListener { | ||
| 506 | } | 509 | } |
| 507 | String mediaServerId = json.getString("mediaServerId"); | 510 | String mediaServerId = json.getString("mediaServerId"); |
| 508 | MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId); | 511 | MediaServerItem mediaInfo = mediaServerService.getOne(mediaServerId); |
| 509 | - if (userSetup.isAutoApplyPlay() && mediaInfo != null && mediaInfo.isRtpEnable()) { | 512 | + if (userSetting.isAutoApplyPlay() && mediaInfo != null && mediaInfo.isRtpEnable()) { |
| 510 | String app = json.getString("app"); | 513 | String app = json.getString("app"); |
| 511 | String streamId = json.getString("stream"); | 514 | String streamId = json.getString("stream"); |
| 512 | if ("rtp".equals(app)) { | 515 | if ("rtp".equals(app)) { |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java
| 1 | package com.genersoft.iot.vmp.media.zlm; | 1 | package com.genersoft.iot.vmp.media.zlm; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | -import com.genersoft.iot.vmp.conf.UserSetup; | 4 | +import com.genersoft.iot.vmp.conf.UserSetting; |
| 5 | import com.genersoft.iot.vmp.gb28181.bean.GbStream; | 5 | import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| 6 | -import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; | ||
| 7 | -import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | ||
| 8 | -import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; | ||
| 9 | -import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; | 6 | +import com.genersoft.iot.vmp.media.zlm.dto.*; |
| 10 | import com.genersoft.iot.vmp.service.IStreamProxyService; | 7 | import com.genersoft.iot.vmp.service.IStreamProxyService; |
| 11 | import com.genersoft.iot.vmp.service.IStreamPushService; | 8 | import com.genersoft.iot.vmp.service.IStreamPushService; |
| 12 | import com.genersoft.iot.vmp.service.bean.ThirdPartyGB; | 9 | import com.genersoft.iot.vmp.service.bean.ThirdPartyGB; |
| 13 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 10 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 14 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 11 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 15 | import com.genersoft.iot.vmp.storager.dao.GbStreamMapper; | 12 | import com.genersoft.iot.vmp.storager.dao.GbStreamMapper; |
| 16 | import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper; | 13 | import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper; |
| 17 | import com.genersoft.iot.vmp.storager.dao.StreamPushMapper; | 14 | import com.genersoft.iot.vmp.storager.dao.StreamPushMapper; |
| 15 | +import org.checkerframework.checker.units.qual.C; | ||
| 18 | import org.slf4j.Logger; | 16 | import org.slf4j.Logger; |
| 19 | import org.slf4j.LoggerFactory; | 17 | import org.slf4j.LoggerFactory; |
| 20 | import org.springframework.beans.factory.annotation.Autowired; | 18 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -22,6 +20,7 @@ import org.springframework.stereotype.Component; | @@ -22,6 +20,7 @@ import org.springframework.stereotype.Component; | ||
| 22 | import org.springframework.util.StringUtils; | 20 | import org.springframework.util.StringUtils; |
| 23 | 21 | ||
| 24 | import java.util.*; | 22 | import java.util.*; |
| 23 | +import java.util.concurrent.ConcurrentHashMap; | ||
| 25 | import java.util.regex.Matcher; | 24 | import java.util.regex.Matcher; |
| 26 | import java.util.regex.Pattern; | 25 | import java.util.regex.Pattern; |
| 27 | 26 | ||
| @@ -37,7 +36,7 @@ public class ZLMMediaListManager { | @@ -37,7 +36,7 @@ public class ZLMMediaListManager { | ||
| 37 | private IRedisCatchStorage redisCatchStorage; | 36 | private IRedisCatchStorage redisCatchStorage; |
| 38 | 37 | ||
| 39 | @Autowired | 38 | @Autowired |
| 40 | - private IVideoManagerStorager storager; | 39 | + private IVideoManagerStorage storager; |
| 41 | 40 | ||
| 42 | @Autowired | 41 | @Autowired |
| 43 | private GbStreamMapper gbStreamMapper; | 42 | private GbStreamMapper gbStreamMapper; |
| @@ -58,7 +57,9 @@ public class ZLMMediaListManager { | @@ -58,7 +57,9 @@ public class ZLMMediaListManager { | ||
| 58 | private ZLMHttpHookSubscribe subscribe; | 57 | private ZLMHttpHookSubscribe subscribe; |
| 59 | 58 | ||
| 60 | @Autowired | 59 | @Autowired |
| 61 | - private UserSetup userSetup; | 60 | + private UserSetting userSetting; |
| 61 | + | ||
| 62 | + private Map<String, ChannelOnlineEvent> channelOnlineEvents = new ConcurrentHashMap<>(); | ||
| 62 | 63 | ||
| 63 | 64 | ||
| 64 | public void updateMediaList(MediaServerItem mediaServerItem) { | 65 | public void updateMediaList(MediaServerItem mediaServerItem) { |
| @@ -109,7 +110,7 @@ public class ZLMMediaListManager { | @@ -109,7 +110,7 @@ public class ZLMMediaListManager { | ||
| 109 | // 查找此直播流是否存在redis预设gbId | 110 | // 查找此直播流是否存在redis预设gbId |
| 110 | StreamPushItem transform = streamPushService.transform(mediaItem); | 111 | StreamPushItem transform = streamPushService.transform(mediaItem); |
| 111 | // 从streamId取出查询关键值 | 112 | // 从streamId取出查询关键值 |
| 112 | - Pattern pattern = Pattern.compile(userSetup.getThirdPartyGBIdReg()); | 113 | + Pattern pattern = Pattern.compile(userSetting.getThirdPartyGBIdReg()); |
| 113 | Matcher matcher = pattern.matcher(mediaItem.getStream());// 指定要匹配的字符串 | 114 | Matcher matcher = pattern.matcher(mediaItem.getStream());// 指定要匹配的字符串 |
| 114 | String queryKey = null; | 115 | String queryKey = null; |
| 115 | if (matcher.find()) { //此处find()每次被调用后,会偏移到下一个匹配 | 116 | if (matcher.find()) { //此处find()每次被调用后,会偏移到下一个匹配 |
| @@ -157,7 +158,15 @@ public class ZLMMediaListManager { | @@ -157,7 +158,15 @@ public class ZLMMediaListManager { | ||
| 157 | transform.setCreateStamp(System.currentTimeMillis()); | 158 | transform.setCreateStamp(System.currentTimeMillis()); |
| 158 | gbStreamMapper.add(transform); | 159 | gbStreamMapper.add(transform); |
| 159 | } | 160 | } |
| 161 | + if (transform != null) { | ||
| 162 | + if (channelOnlineEvents.get(transform.getGbId()) != null) { | ||
| 163 | + channelOnlineEvents.get(transform.getGbId()).run(transform.getApp(), transform.getStream()); | ||
| 164 | + channelOnlineEvents.remove(transform.getGbId()); | ||
| 165 | + } | ||
| 166 | + } | ||
| 160 | } | 167 | } |
| 168 | + | ||
| 169 | + | ||
| 161 | storager.updateMedia(transform); | 170 | storager.updateMedia(transform); |
| 162 | return transform; | 171 | return transform; |
| 163 | } | 172 | } |
| @@ -200,6 +209,14 @@ public class ZLMMediaListManager { | @@ -200,6 +209,14 @@ public class ZLMMediaListManager { | ||
| 200 | return result; | 209 | return result; |
| 201 | } | 210 | } |
| 202 | 211 | ||
| 212 | + public void addChannelOnlineEventLister(String key, ChannelOnlineEvent callback) { | ||
| 213 | + this.channelOnlineEvents.put(key,callback); | ||
| 214 | + } | ||
| 215 | + | ||
| 216 | + public void removedChannelOnlineEventLister(String key) { | ||
| 217 | + this.channelOnlineEvents.remove(key); | ||
| 218 | + } | ||
| 219 | + | ||
| 203 | 220 | ||
| 204 | 221 | ||
| 205 | // public void clearAllSessions() { | 222 | // public void clearAllSessions() { |
src/main/java/com/genersoft/iot/vmp/media/zlm/dto/ChannelOnlineEvent.java
0 → 100644
src/main/java/com/genersoft/iot/vmp/media/zlm/event/ZLMKeepliveTimeoutListener.java
| @@ -3,7 +3,7 @@ package com.genersoft.iot.vmp.media.zlm.event; | @@ -3,7 +3,7 @@ package com.genersoft.iot.vmp.media.zlm.event; | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | import com.genersoft.iot.vmp.common.VideoManagerConstants; | 4 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 5 | import com.genersoft.iot.vmp.conf.RedisKeyExpirationEventMessageListener; | 5 | import com.genersoft.iot.vmp.conf.RedisKeyExpirationEventMessageListener; |
| 6 | -import com.genersoft.iot.vmp.conf.UserSetup; | 6 | +import com.genersoft.iot.vmp.conf.UserSetting; |
| 7 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | 7 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 8 | import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; | 8 | import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; |
| 9 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | 9 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| @@ -12,7 +12,6 @@ import org.slf4j.Logger; | @@ -12,7 +12,6 @@ import org.slf4j.Logger; | ||
| 12 | import org.slf4j.LoggerFactory; | 12 | import org.slf4j.LoggerFactory; |
| 13 | import org.springframework.beans.factory.annotation.Autowired; | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 14 | import org.springframework.data.redis.connection.Message; | 14 | import org.springframework.data.redis.connection.Message; |
| 15 | -import org.springframework.data.redis.listener.KeyExpirationEventMessageListener; | ||
| 16 | import org.springframework.data.redis.listener.RedisMessageListenerContainer; | 15 | import org.springframework.data.redis.listener.RedisMessageListenerContainer; |
| 17 | import org.springframework.stereotype.Component; | 16 | import org.springframework.stereotype.Component; |
| 18 | 17 | ||
| @@ -33,13 +32,13 @@ public class ZLMKeepliveTimeoutListener extends RedisKeyExpirationEventMessageLi | @@ -33,13 +32,13 @@ public class ZLMKeepliveTimeoutListener extends RedisKeyExpirationEventMessageLi | ||
| 33 | private ZLMRESTfulUtils zlmresTfulUtils; | 32 | private ZLMRESTfulUtils zlmresTfulUtils; |
| 34 | 33 | ||
| 35 | @Autowired | 34 | @Autowired |
| 36 | - private UserSetup userSetup; | 35 | + private UserSetting userSetting; |
| 37 | 36 | ||
| 38 | @Autowired | 37 | @Autowired |
| 39 | private IMediaServerService mediaServerService; | 38 | private IMediaServerService mediaServerService; |
| 40 | 39 | ||
| 41 | - public ZLMKeepliveTimeoutListener(RedisMessageListenerContainer listenerContainer, UserSetup userSetup) { | ||
| 42 | - super(listenerContainer, userSetup); | 40 | + public ZLMKeepliveTimeoutListener(RedisMessageListenerContainer listenerContainer, UserSetting userSetting) { |
| 41 | + super(listenerContainer, userSetting); | ||
| 43 | } | 42 | } |
| 44 | 43 | ||
| 45 | 44 | ||
| @@ -52,7 +51,7 @@ public class ZLMKeepliveTimeoutListener extends RedisKeyExpirationEventMessageLi | @@ -52,7 +51,7 @@ public class ZLMKeepliveTimeoutListener extends RedisKeyExpirationEventMessageLi | ||
| 52 | public void onMessage(Message message, byte[] pattern) { | 51 | public void onMessage(Message message, byte[] pattern) { |
| 53 | // 获取失效的key | 52 | // 获取失效的key |
| 54 | String expiredKey = message.toString(); | 53 | String expiredKey = message.toString(); |
| 55 | - String KEEPLIVEKEY_PREFIX = VideoManagerConstants.MEDIA_SERVER_KEEPALIVE_PREFIX + userSetup.getServerId() + "_"; | 54 | + String KEEPLIVEKEY_PREFIX = VideoManagerConstants.MEDIA_SERVER_KEEPALIVE_PREFIX + userSetting.getServerId() + "_"; |
| 56 | if(!expiredKey.startsWith(KEEPLIVEKEY_PREFIX)){ | 55 | if(!expiredKey.startsWith(KEEPLIVEKEY_PREFIX)){ |
| 57 | return; | 56 | return; |
| 58 | } | 57 | } |
src/main/java/com/genersoft/iot/vmp/service/IDeviceService.java
| @@ -21,4 +21,17 @@ public interface IDeviceService { | @@ -21,4 +21,17 @@ public interface IDeviceService { | ||
| 21 | */ | 21 | */ |
| 22 | boolean removeCatalogSubscribe(Device device); | 22 | boolean removeCatalogSubscribe(Device device); |
| 23 | 23 | ||
| 24 | + /** | ||
| 25 | + * 添加移动位置订阅 | ||
| 26 | + * @param device 设备信息 | ||
| 27 | + * @return | ||
| 28 | + */ | ||
| 29 | + boolean addMobilePositionSubscribe(Device device); | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 移除移动位置订阅 | ||
| 33 | + * @param device 设备信息 | ||
| 34 | + * @return | ||
| 35 | + */ | ||
| 36 | + boolean removeMobilePositionSubscribe(Device device); | ||
| 24 | } | 37 | } |
src/main/java/com/genersoft/iot/vmp/service/StreamGPSSubscribeTask.java
| @@ -2,7 +2,7 @@ package com.genersoft.iot.vmp.service; | @@ -2,7 +2,7 @@ package com.genersoft.iot.vmp.service; | ||
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; | 3 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| 4 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 4 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 5 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 5 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 6 | import org.springframework.beans.factory.annotation.Autowired; | 6 | import org.springframework.beans.factory.annotation.Autowired; |
| 7 | import org.springframework.scheduling.annotation.Scheduled; | 7 | import org.springframework.scheduling.annotation.Scheduled; |
| 8 | import org.springframework.stereotype.Component; | 8 | import org.springframework.stereotype.Component; |
| @@ -20,7 +20,7 @@ public class StreamGPSSubscribeTask { | @@ -20,7 +20,7 @@ public class StreamGPSSubscribeTask { | ||
| 20 | private IRedisCatchStorage redisCatchStorage; | 20 | private IRedisCatchStorage redisCatchStorage; |
| 21 | 21 | ||
| 22 | @Autowired | 22 | @Autowired |
| 23 | - private IVideoManagerStorager storager; | 23 | + private IVideoManagerStorage storager; |
| 24 | 24 | ||
| 25 | 25 | ||
| 26 | 26 |
src/main/java/com/genersoft/iot/vmp/service/bean/CatalogSubscribeTask.java
| @@ -10,6 +10,9 @@ import org.slf4j.LoggerFactory; | @@ -10,6 +10,9 @@ import org.slf4j.LoggerFactory; | ||
| 10 | 10 | ||
| 11 | import javax.sip.ResponseEvent; | 11 | import javax.sip.ResponseEvent; |
| 12 | 12 | ||
| 13 | +/** | ||
| 14 | + * 目录订阅任务 | ||
| 15 | + */ | ||
| 13 | public class CatalogSubscribeTask implements Runnable{ | 16 | public class CatalogSubscribeTask implements Runnable{ |
| 14 | private final Logger logger = LoggerFactory.getLogger(CatalogSubscribeTask.class); | 17 | private final Logger logger = LoggerFactory.getLogger(CatalogSubscribeTask.class); |
| 15 | private Device device; | 18 | private Device device; |
| @@ -24,7 +27,6 @@ public class CatalogSubscribeTask implements Runnable{ | @@ -24,7 +27,6 @@ public class CatalogSubscribeTask implements Runnable{ | ||
| 24 | public void run() { | 27 | public void run() { |
| 25 | sipCommander.catalogSubscribe(device, eventResult -> { | 28 | sipCommander.catalogSubscribe(device, eventResult -> { |
| 26 | ResponseEvent event = (ResponseEvent) eventResult.event; | 29 | ResponseEvent event = (ResponseEvent) eventResult.event; |
| 27 | - Element rootElement = null; | ||
| 28 | if (event.getResponse().getRawContent() != null) { | 30 | if (event.getResponse().getRawContent() != null) { |
| 29 | // 成功 | 31 | // 成功 |
| 30 | logger.info("[目录订阅]成功: {}", device.getDeviceId()); | 32 | logger.info("[目录订阅]成功: {}", device.getDeviceId()); |
src/main/java/com/genersoft/iot/vmp/service/bean/MessageForPushChannel.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.service.bean; | ||
| 2 | + | ||
| 3 | +/** | ||
| 4 | + * 当上级平台 | ||
| 5 | + */ | ||
| 6 | +public class MessageForPushChannel { | ||
| 7 | + /** | ||
| 8 | + * 消息类型 | ||
| 9 | + * 0 流注销 1 流注册 | ||
| 10 | + */ | ||
| 11 | + private int type; | ||
| 12 | + | ||
| 13 | + /** | ||
| 14 | + * 流应用名 | ||
| 15 | + */ | ||
| 16 | + private String app; | ||
| 17 | + | ||
| 18 | + /** | ||
| 19 | + * 流Id | ||
| 20 | + */ | ||
| 21 | + private String stream; | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 国标ID | ||
| 25 | + */ | ||
| 26 | + private String gbId; | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 请求的平台ID | ||
| 30 | + */ | ||
| 31 | + private String platFormId; | ||
| 32 | + | ||
| 33 | + /** | ||
| 34 | + * 请求平台名称 | ||
| 35 | + */ | ||
| 36 | + private String platFormName; | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * WVP服务ID | ||
| 40 | + */ | ||
| 41 | + private String serverId; | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * 目标流媒体节点ID | ||
| 45 | + */ | ||
| 46 | + private String mediaServerId; | ||
| 47 | + | ||
| 48 | + | ||
| 49 | + public int getType() { | ||
| 50 | + return type; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + public void setType(int type) { | ||
| 54 | + this.type = type; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + public String getApp() { | ||
| 58 | + return app; | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + public void setApp(String app) { | ||
| 62 | + this.app = app; | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + public String getStream() { | ||
| 66 | + return stream; | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + public void setStream(String stream) { | ||
| 70 | + this.stream = stream; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + public String getGbId() { | ||
| 74 | + return gbId; | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + public void setGbId(String gbId) { | ||
| 78 | + this.gbId = gbId; | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + public String getPlatFormId() { | ||
| 82 | + return platFormId; | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + public void setPlatFormId(String platFormId) { | ||
| 86 | + this.platFormId = platFormId; | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + public String getPlatFormName() { | ||
| 90 | + return platFormName; | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + public void setPlatFormName(String platFormName) { | ||
| 94 | + this.platFormName = platFormName; | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + public String getServerId() { | ||
| 98 | + return serverId; | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + public void setServerId(String serverId) { | ||
| 102 | + this.serverId = serverId; | ||
| 103 | + } | ||
| 104 | + | ||
| 105 | + public String getMediaServerId() { | ||
| 106 | + return mediaServerId; | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + public void setMediaServerId(String mediaServerId) { | ||
| 110 | + this.mediaServerId = mediaServerId; | ||
| 111 | + } | ||
| 112 | +} |
src/main/java/com/genersoft/iot/vmp/service/bean/MobilePositionSubscribeTask.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.service.bean; | ||
| 2 | + | ||
| 3 | +import com.genersoft.iot.vmp.gb28181.bean.Device; | ||
| 4 | +import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; | ||
| 5 | +import org.dom4j.Element; | ||
| 6 | +import org.slf4j.Logger; | ||
| 7 | +import org.slf4j.LoggerFactory; | ||
| 8 | + | ||
| 9 | +import javax.sip.ResponseEvent; | ||
| 10 | + | ||
| 11 | +public class MobilePositionSubscribeTask implements Runnable{ | ||
| 12 | + private final Logger logger = LoggerFactory.getLogger(MobilePositionSubscribeTask.class); | ||
| 13 | + private Device device; | ||
| 14 | + private ISIPCommander sipCommander; | ||
| 15 | + | ||
| 16 | + public MobilePositionSubscribeTask(Device device, ISIPCommander sipCommander) { | ||
| 17 | + this.device = device; | ||
| 18 | + this.sipCommander = sipCommander; | ||
| 19 | + } | ||
| 20 | + | ||
| 21 | + @Override | ||
| 22 | + public void run() { | ||
| 23 | + sipCommander.mobilePositionSubscribe(device, eventResult -> { | ||
| 24 | + ResponseEvent event = (ResponseEvent) eventResult.event; | ||
| 25 | + Element rootElement = null; | ||
| 26 | + if (event.getResponse().getRawContent() != null) { | ||
| 27 | + // 成功 | ||
| 28 | + logger.info("[移动位置订阅]成功: {}", device.getDeviceId()); | ||
| 29 | + }else { | ||
| 30 | + // 成功 | ||
| 31 | + logger.info("[移动位置订阅]成功: {}", device.getDeviceId()); | ||
| 32 | + } | ||
| 33 | + },eventResult -> { | ||
| 34 | + // 失败 | ||
| 35 | + logger.warn("[移动位置订阅]失败,信令发送失败: {}-{} ", device.getDeviceId(), eventResult.msg); | ||
| 36 | + }); | ||
| 37 | + } | ||
| 38 | +} |
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
| @@ -5,6 +5,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device; | @@ -5,6 +5,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device; | ||
| 5 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; | 5 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommander; |
| 6 | import com.genersoft.iot.vmp.service.IDeviceService; | 6 | import com.genersoft.iot.vmp.service.IDeviceService; |
| 7 | import com.genersoft.iot.vmp.service.bean.CatalogSubscribeTask; | 7 | import com.genersoft.iot.vmp.service.bean.CatalogSubscribeTask; |
| 8 | +import com.genersoft.iot.vmp.service.bean.MobilePositionSubscribeTask; | ||
| 8 | import org.slf4j.Logger; | 9 | import org.slf4j.Logger; |
| 9 | import org.slf4j.LoggerFactory; | 10 | import org.slf4j.LoggerFactory; |
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -20,7 +21,6 @@ public class DeviceServiceImpl implements IDeviceService { | @@ -20,7 +21,6 @@ public class DeviceServiceImpl implements IDeviceService { | ||
| 20 | 21 | ||
| 21 | @Autowired | 22 | @Autowired |
| 22 | private DynamicTask dynamicTask; | 23 | private DynamicTask dynamicTask; |
| 23 | -; | ||
| 24 | 24 | ||
| 25 | @Autowired | 25 | @Autowired |
| 26 | private ISIPCommander sipCommander; | 26 | private ISIPCommander sipCommander; |
| @@ -30,9 +30,9 @@ public class DeviceServiceImpl implements IDeviceService { | @@ -30,9 +30,9 @@ public class DeviceServiceImpl implements IDeviceService { | ||
| 30 | if (device == null || device.getSubscribeCycleForCatalog() < 0) { | 30 | if (device == null || device.getSubscribeCycleForCatalog() < 0) { |
| 31 | return false; | 31 | return false; |
| 32 | } | 32 | } |
| 33 | - if (dynamicTask.contains(device.getDeviceId())) { | 33 | + if (dynamicTask.contains(device.getDeviceId() + "catalog")) { |
| 34 | // 存在则停止现有的,开启新的 | 34 | // 存在则停止现有的,开启新的 |
| 35 | - dynamicTask.stop(device.getDeviceId()); | 35 | + dynamicTask.stop(device.getDeviceId() + "catalog"); |
| 36 | } | 36 | } |
| 37 | logger.info("[添加目录订阅] 设备{}", device.getDeviceId()); | 37 | logger.info("[添加目录订阅] 设备{}", device.getDeviceId()); |
| 38 | // 添加目录订阅 | 38 | // 添加目录订阅 |
| @@ -42,7 +42,7 @@ public class DeviceServiceImpl implements IDeviceService { | @@ -42,7 +42,7 @@ public class DeviceServiceImpl implements IDeviceService { | ||
| 42 | int subscribeCycleForCatalog = device.getSubscribeCycleForCatalog(); | 42 | int subscribeCycleForCatalog = device.getSubscribeCycleForCatalog(); |
| 43 | // 设置最小值为30 | 43 | // 设置最小值为30 |
| 44 | subscribeCycleForCatalog = Math.max(subscribeCycleForCatalog, 30); | 44 | subscribeCycleForCatalog = Math.max(subscribeCycleForCatalog, 30); |
| 45 | - dynamicTask.startCron(device.getDeviceId(), catalogSubscribeTask, subscribeCycleForCatalog - 5); | 45 | + dynamicTask.startCron(device.getDeviceId() + "catalog", catalogSubscribeTask, subscribeCycleForCatalog - 5); |
| 46 | return true; | 46 | return true; |
| 47 | } | 47 | } |
| 48 | 48 | ||
| @@ -52,9 +52,42 @@ public class DeviceServiceImpl implements IDeviceService { | @@ -52,9 +52,42 @@ public class DeviceServiceImpl implements IDeviceService { | ||
| 52 | return false; | 52 | return false; |
| 53 | } | 53 | } |
| 54 | logger.info("移除目录订阅: {}", device.getDeviceId()); | 54 | logger.info("移除目录订阅: {}", device.getDeviceId()); |
| 55 | - dynamicTask.stop(device.getDeviceId()); | 55 | + dynamicTask.stop(device.getDeviceId() + "catalog"); |
| 56 | device.setSubscribeCycleForCatalog(0); | 56 | device.setSubscribeCycleForCatalog(0); |
| 57 | sipCommander.catalogSubscribe(device, null, null); | 57 | sipCommander.catalogSubscribe(device, null, null); |
| 58 | return true; | 58 | return true; |
| 59 | } | 59 | } |
| 60 | + | ||
| 61 | + @Override | ||
| 62 | + public boolean addMobilePositionSubscribe(Device device) { | ||
| 63 | + if (device == null || device.getSubscribeCycleForMobilePosition() < 0) { | ||
| 64 | + return false; | ||
| 65 | + } | ||
| 66 | + if (dynamicTask.contains(device.getDeviceId() + "mobile_position")) { | ||
| 67 | + // 存在则停止现有的,开启新的 | ||
| 68 | + dynamicTask.stop(device.getDeviceId() + "mobile_position"); | ||
| 69 | + } | ||
| 70 | + logger.info("[添加移动位置订阅] 设备{}", device.getDeviceId()); | ||
| 71 | + // 添加目录订阅 | ||
| 72 | + MobilePositionSubscribeTask mobilePositionSubscribeTask = new MobilePositionSubscribeTask(device, sipCommander); | ||
| 73 | + mobilePositionSubscribeTask.run(); | ||
| 74 | + // 提前开始刷新订阅 | ||
| 75 | + int subscribeCycleForCatalog = device.getSubscribeCycleForCatalog(); | ||
| 76 | + // 设置最小值为30 | ||
| 77 | + subscribeCycleForCatalog = Math.max(subscribeCycleForCatalog, 30); | ||
| 78 | + dynamicTask.startCron(device.getDeviceId() + "mobile_position" , mobilePositionSubscribeTask, subscribeCycleForCatalog - 5); | ||
| 79 | + return true; | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + @Override | ||
| 83 | + public boolean removeMobilePositionSubscribe(Device device) { | ||
| 84 | + if (device == null || device.getSubscribeCycleForCatalog() < 0) { | ||
| 85 | + return false; | ||
| 86 | + } | ||
| 87 | + logger.info("移除移动位置订阅: {}", device.getDeviceId()); | ||
| 88 | + dynamicTask.stop(device.getDeviceId() + "mobile_position"); | ||
| 89 | + device.setSubscribeCycleForCatalog(0); | ||
| 90 | + sipCommander.mobilePositionSubscribe(device, null, null); | ||
| 91 | + return true; | ||
| 92 | + } | ||
| 60 | } | 93 | } |
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
| @@ -4,10 +4,8 @@ import com.alibaba.fastjson.JSON; | @@ -4,10 +4,8 @@ import com.alibaba.fastjson.JSON; | ||
| 4 | import com.alibaba.fastjson.JSONArray; | 4 | import com.alibaba.fastjson.JSONArray; |
| 5 | import com.alibaba.fastjson.JSONObject; | 5 | import com.alibaba.fastjson.JSONObject; |
| 6 | import com.genersoft.iot.vmp.common.VideoManagerConstants; | 6 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 7 | -import com.genersoft.iot.vmp.conf.MediaConfig; | ||
| 8 | import com.genersoft.iot.vmp.conf.SipConfig; | 7 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 9 | -import com.genersoft.iot.vmp.conf.UserSetup; | ||
| 10 | -import com.genersoft.iot.vmp.gb28181.bean.Device; | 8 | +import com.genersoft.iot.vmp.conf.UserSetting; |
| 11 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | 9 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 12 | import com.genersoft.iot.vmp.gb28181.session.SsrcConfig; | 10 | import com.genersoft.iot.vmp.gb28181.session.SsrcConfig; |
| 13 | import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; | 11 | import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; |
| @@ -15,11 +13,10 @@ import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; | @@ -15,11 +13,10 @@ import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; | ||
| 15 | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; | 13 | import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; |
| 16 | import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig; | 14 | import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig; |
| 17 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | 15 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 18 | -import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; | ||
| 19 | import com.genersoft.iot.vmp.service.IMediaServerService; | 16 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 20 | import com.genersoft.iot.vmp.service.IStreamProxyService; | 17 | import com.genersoft.iot.vmp.service.IStreamProxyService; |
| 21 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; | 18 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; |
| 22 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 19 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 23 | import com.genersoft.iot.vmp.storager.dao.MediaServerMapper; | 20 | import com.genersoft.iot.vmp.storager.dao.MediaServerMapper; |
| 24 | import com.genersoft.iot.vmp.utils.redis.JedisUtil; | 21 | import com.genersoft.iot.vmp.utils.redis.JedisUtil; |
| 25 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; | 22 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; |
| @@ -29,10 +26,7 @@ import org.slf4j.Logger; | @@ -29,10 +26,7 @@ import org.slf4j.Logger; | ||
| 29 | import org.slf4j.LoggerFactory; | 26 | import org.slf4j.LoggerFactory; |
| 30 | import org.springframework.beans.factory.annotation.Autowired; | 27 | import org.springframework.beans.factory.annotation.Autowired; |
| 31 | import org.springframework.beans.factory.annotation.Value; | 28 | import org.springframework.beans.factory.annotation.Value; |
| 32 | -import org.springframework.boot.CommandLineRunner; | ||
| 33 | -import org.springframework.core.annotation.Order; | ||
| 34 | import org.springframework.jdbc.datasource.DataSourceTransactionManager; | 29 | import org.springframework.jdbc.datasource.DataSourceTransactionManager; |
| 35 | -import org.springframework.security.core.parameters.P; | ||
| 36 | import org.springframework.stereotype.Service; | 30 | import org.springframework.stereotype.Service; |
| 37 | import org.springframework.transaction.TransactionDefinition; | 31 | import org.springframework.transaction.TransactionDefinition; |
| 38 | import org.springframework.transaction.TransactionStatus; | 32 | import org.springframework.transaction.TransactionStatus; |
| @@ -60,7 +54,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -60,7 +54,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 60 | private Integer serverPort; | 54 | private Integer serverPort; |
| 61 | 55 | ||
| 62 | @Autowired | 56 | @Autowired |
| 63 | - private UserSetup userSetup; | 57 | + private UserSetting userSetting; |
| 64 | 58 | ||
| 65 | @Autowired | 59 | @Autowired |
| 66 | private ZLMRESTfulUtils zlmresTfulUtils; | 60 | private ZLMRESTfulUtils zlmresTfulUtils; |
| @@ -84,7 +78,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -84,7 +78,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 84 | private RedisUtil redisUtil; | 78 | private RedisUtil redisUtil; |
| 85 | 79 | ||
| 86 | @Autowired | 80 | @Autowired |
| 87 | - private IVideoManagerStorager storager; | 81 | + private IVideoManagerStorage storager; |
| 88 | 82 | ||
| 89 | @Autowired | 83 | @Autowired |
| 90 | private IStreamProxyService streamProxyService; | 84 | private IStreamProxyService streamProxyService; |
| @@ -111,10 +105,10 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -111,10 +105,10 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 111 | if (mediaServerItem.getSsrcConfig() == null) { | 105 | if (mediaServerItem.getSsrcConfig() == null) { |
| 112 | SsrcConfig ssrcConfig = new SsrcConfig(mediaServerItem.getId(), null, sipConfig.getDomain()); | 106 | SsrcConfig ssrcConfig = new SsrcConfig(mediaServerItem.getId(), null, sipConfig.getDomain()); |
| 113 | mediaServerItem.setSsrcConfig(ssrcConfig); | 107 | mediaServerItem.setSsrcConfig(ssrcConfig); |
| 114 | - redisUtil.set(VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetup.getServerId() + "_" + mediaServerItem.getId(), mediaServerItem); | 108 | + redisUtil.set(VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItem.getId(), mediaServerItem); |
| 115 | } | 109 | } |
| 116 | // 查询redis是否存在此mediaServer | 110 | // 查询redis是否存在此mediaServer |
| 117 | - String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetup.getServerId() + "_" + mediaServerItem.getId(); | 111 | + String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItem.getId(); |
| 118 | if (!redisUtil.hasKey(key)) { | 112 | if (!redisUtil.hasKey(key)) { |
| 119 | redisUtil.set(key, mediaServerItem); | 113 | redisUtil.set(key, mediaServerItem); |
| 120 | } | 114 | } |
| @@ -133,7 +127,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -133,7 +127,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 133 | return null; | 127 | return null; |
| 134 | } | 128 | } |
| 135 | // 获取mediaServer可用的ssrc | 129 | // 获取mediaServer可用的ssrc |
| 136 | - String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetup.getServerId() + "_" + mediaServerItem.getId(); | 130 | + String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItem.getId(); |
| 137 | 131 | ||
| 138 | SsrcConfig ssrcConfig = mediaServerItem.getSsrcConfig(); | 132 | SsrcConfig ssrcConfig = mediaServerItem.getSsrcConfig(); |
| 139 | if (ssrcConfig == null) { | 133 | if (ssrcConfig == null) { |
| @@ -181,7 +175,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -181,7 +175,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 181 | SsrcConfig ssrcConfig = mediaServerItem.getSsrcConfig(); | 175 | SsrcConfig ssrcConfig = mediaServerItem.getSsrcConfig(); |
| 182 | ssrcConfig.releaseSsrc(ssrc); | 176 | ssrcConfig.releaseSsrc(ssrc); |
| 183 | mediaServerItem.setSsrcConfig(ssrcConfig); | 177 | mediaServerItem.setSsrcConfig(ssrcConfig); |
| 184 | - String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetup.getServerId() + "_" + mediaServerItem.getId(); | 178 | + String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItem.getId(); |
| 185 | redisUtil.set(key, mediaServerItem); | 179 | redisUtil.set(key, mediaServerItem); |
| 186 | } | 180 | } |
| 187 | 181 | ||
| @@ -191,7 +185,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -191,7 +185,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 191 | @Override | 185 | @Override |
| 192 | public void clearRTPServer(MediaServerItem mediaServerItem) { | 186 | public void clearRTPServer(MediaServerItem mediaServerItem) { |
| 193 | mediaServerItem.setSsrcConfig(new SsrcConfig(mediaServerItem.getId(), null, sipConfig.getDomain())); | 187 | mediaServerItem.setSsrcConfig(new SsrcConfig(mediaServerItem.getId(), null, sipConfig.getDomain())); |
| 194 | - redisUtil.zAdd(VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetup.getServerId(), mediaServerItem.getId(), 0); | 188 | + redisUtil.zAdd(VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(), mediaServerItem.getId(), 0); |
| 195 | } | 189 | } |
| 196 | 190 | ||
| 197 | 191 | ||
| @@ -211,15 +205,15 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -211,15 +205,15 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 211 | ) | 205 | ) |
| 212 | ); | 206 | ); |
| 213 | } | 207 | } |
| 214 | - String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetup.getServerId() + "_" + mediaServerItemInDataBase.getId(); | 208 | + String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItemInDataBase.getId(); |
| 215 | redisUtil.set(key, mediaServerItemInDataBase); | 209 | redisUtil.set(key, mediaServerItemInDataBase); |
| 216 | } | 210 | } |
| 217 | 211 | ||
| 218 | @Override | 212 | @Override |
| 219 | public List<MediaServerItem> getAll() { | 213 | public List<MediaServerItem> getAll() { |
| 220 | List<MediaServerItem> result = new ArrayList<>(); | 214 | List<MediaServerItem> result = new ArrayList<>(); |
| 221 | - List<Object> mediaServerKeys = redisUtil.scan(String.format("%S*", VideoManagerConstants.MEDIA_SERVER_PREFIX+ userSetup.getServerId() + "_" )); | ||
| 222 | - String onlineKey = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetup.getServerId(); | 215 | + List<Object> mediaServerKeys = redisUtil.scan(String.format("%S*", VideoManagerConstants.MEDIA_SERVER_PREFIX+ userSetting.getServerId() + "_" )); |
| 216 | + String onlineKey = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); | ||
| 223 | for (Object mediaServerKey : mediaServerKeys) { | 217 | for (Object mediaServerKey : mediaServerKeys) { |
| 224 | String key = (String) mediaServerKey; | 218 | String key = (String) mediaServerKey; |
| 225 | MediaServerItem mediaServerItem = (MediaServerItem) redisUtil.get(key); | 219 | MediaServerItem mediaServerItem = (MediaServerItem) redisUtil.get(key); |
| @@ -250,13 +244,13 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -250,13 +244,13 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 250 | 244 | ||
| 251 | @Override | 245 | @Override |
| 252 | public List<MediaServerItem> getAllOnline() { | 246 | public List<MediaServerItem> getAllOnline() { |
| 253 | - String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetup.getServerId(); | 247 | + String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); |
| 254 | Set<String> mediaServerIdSet = redisUtil.zRevRange(key, 0, -1); | 248 | Set<String> mediaServerIdSet = redisUtil.zRevRange(key, 0, -1); |
| 255 | 249 | ||
| 256 | List<MediaServerItem> result = new ArrayList<>(); | 250 | List<MediaServerItem> result = new ArrayList<>(); |
| 257 | if (mediaServerIdSet != null && mediaServerIdSet.size() > 0) { | 251 | if (mediaServerIdSet != null && mediaServerIdSet.size() > 0) { |
| 258 | for (String mediaServerId : mediaServerIdSet) { | 252 | for (String mediaServerId : mediaServerIdSet) { |
| 259 | - String serverKey = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetup.getServerId() + "_" + mediaServerId; | 253 | + String serverKey = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerId; |
| 260 | result.add((MediaServerItem) redisUtil.get(serverKey)); | 254 | result.add((MediaServerItem) redisUtil.get(serverKey)); |
| 261 | } | 255 | } |
| 262 | } | 256 | } |
| @@ -274,7 +268,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -274,7 +268,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 274 | if (mediaServerId == null) { | 268 | if (mediaServerId == null) { |
| 275 | return null; | 269 | return null; |
| 276 | } | 270 | } |
| 277 | - String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetup.getServerId() + "_" + mediaServerId; | 271 | + String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerId; |
| 278 | return (MediaServerItem)redisUtil.get(key); | 272 | return (MediaServerItem)redisUtil.get(key); |
| 279 | } | 273 | } |
| 280 | 274 | ||
| @@ -286,7 +280,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -286,7 +280,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 286 | 280 | ||
| 287 | @Override | 281 | @Override |
| 288 | public void clearMediaServerForOnline() { | 282 | public void clearMediaServerForOnline() { |
| 289 | - String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetup.getServerId(); | 283 | + String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); |
| 290 | redisUtil.del(key); | 284 | redisUtil.del(key); |
| 291 | } | 285 | } |
| 292 | 286 | ||
| @@ -393,7 +387,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -393,7 +387,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 393 | return; | 387 | return; |
| 394 | } | 388 | } |
| 395 | mediaServerMapper.update(serverItem); | 389 | mediaServerMapper.update(serverItem); |
| 396 | - String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetup.getServerId() + "_" + zlmServerConfig.getGeneralMediaServerId(); | 390 | + String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + zlmServerConfig.getGeneralMediaServerId(); |
| 397 | if (redisUtil.get(key) == null) { | 391 | if (redisUtil.get(key) == null) { |
| 398 | SsrcConfig ssrcConfig = new SsrcConfig(zlmServerConfig.getGeneralMediaServerId(), null, sipConfig.getDomain()); | 392 | SsrcConfig ssrcConfig = new SsrcConfig(zlmServerConfig.getGeneralMediaServerId(), null, sipConfig.getDomain()); |
| 399 | serverItem.setSsrcConfig(ssrcConfig); | 393 | serverItem.setSsrcConfig(ssrcConfig); |
| @@ -404,8 +398,9 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -404,8 +398,9 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 404 | redisUtil.set(key, serverItem); | 398 | redisUtil.set(key, serverItem); |
| 405 | resetOnlineServerItem(serverItem); | 399 | resetOnlineServerItem(serverItem); |
| 406 | updateMediaServerKeepalive(serverItem.getId(), null); | 400 | updateMediaServerKeepalive(serverItem.getId(), null); |
| 407 | - setZLMConfig(serverItem, "0".equals(zlmServerConfig.getHookEnable())); | ||
| 408 | - | 401 | + if (serverItem.isAutoConfig()) { |
| 402 | + setZLMConfig(serverItem, "0".equals(zlmServerConfig.getHookEnable())); | ||
| 403 | + } | ||
| 409 | publisher.zlmOnlineEventPublish(serverItem.getId()); | 404 | publisher.zlmOnlineEventPublish(serverItem.getId()); |
| 410 | logger.info("[ ZLM:{} ]-[ {}:{} ]连接成功", | 405 | logger.info("[ ZLM:{} ]-[ {}:{} ]连接成功", |
| 411 | zlmServerConfig.getGeneralMediaServerId(), zlmServerConfig.getIp(), zlmServerConfig.getHttpPort()); | 406 | zlmServerConfig.getGeneralMediaServerId(), zlmServerConfig.getIp(), zlmServerConfig.getHttpPort()); |
| @@ -420,7 +415,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -420,7 +415,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 420 | @Override | 415 | @Override |
| 421 | public void resetOnlineServerItem(MediaServerItem serverItem) { | 416 | public void resetOnlineServerItem(MediaServerItem serverItem) { |
| 422 | // 更新缓存 | 417 | // 更新缓存 |
| 423 | - String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetup.getServerId(); | 418 | + String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); |
| 424 | // 使用zset的分数作为当前并发量, 默认值设置为0 | 419 | // 使用zset的分数作为当前并发量, 默认值设置为0 |
| 425 | if (redisUtil.zScore(key, serverItem.getId()) == null) { // 不存在则设置默认值 已存在则重置 | 420 | if (redisUtil.zScore(key, serverItem.getId()) == null) { // 不存在则设置默认值 已存在则重置 |
| 426 | redisUtil.zAdd(key, serverItem.getId(), 0L); | 421 | redisUtil.zAdd(key, serverItem.getId(), 0L); |
| @@ -446,14 +441,14 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -446,14 +441,14 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 446 | if (mediaServerId == null) { | 441 | if (mediaServerId == null) { |
| 447 | return; | 442 | return; |
| 448 | } | 443 | } |
| 449 | - String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetup.getServerId(); | 444 | + String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); |
| 450 | redisUtil.zIncrScore(key, mediaServerId, 1); | 445 | redisUtil.zIncrScore(key, mediaServerId, 1); |
| 451 | 446 | ||
| 452 | } | 447 | } |
| 453 | 448 | ||
| 454 | @Override | 449 | @Override |
| 455 | public void removeCount(String mediaServerId) { | 450 | public void removeCount(String mediaServerId) { |
| 456 | - String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetup.getServerId(); | 451 | + String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); |
| 457 | redisUtil.zIncrScore(key, mediaServerId, - 1); | 452 | redisUtil.zIncrScore(key, mediaServerId, - 1); |
| 458 | } | 453 | } |
| 459 | 454 | ||
| @@ -463,7 +458,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -463,7 +458,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 463 | */ | 458 | */ |
| 464 | @Override | 459 | @Override |
| 465 | public MediaServerItem getMediaServerForMinimumLoad() { | 460 | public MediaServerItem getMediaServerForMinimumLoad() { |
| 466 | - String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetup.getServerId(); | 461 | + String key = VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(); |
| 467 | 462 | ||
| 468 | if (redisUtil.zSize(key) == null || redisUtil.zSize(key) == 0) { | 463 | if (redisUtil.zSize(key) == null || redisUtil.zSize(key) == 0) { |
| 469 | logger.info("获取负载最低的节点时无在线节点"); | 464 | logger.info("获取负载最低的节点时无在线节点"); |
| @@ -617,8 +612,8 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -617,8 +612,8 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 617 | 612 | ||
| 618 | @Override | 613 | @Override |
| 619 | public void delete(String id) { | 614 | public void delete(String id) { |
| 620 | - redisUtil.zRemove(VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetup.getServerId(), id); | ||
| 621 | - String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetup.getServerId() + "_" + id; | 615 | + redisUtil.zRemove(VideoManagerConstants.MEDIA_SERVERS_ONLINE_PREFIX + userSetting.getServerId(), id); |
| 616 | + String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + id; | ||
| 622 | redisUtil.del(key); | 617 | redisUtil.del(key); |
| 623 | } | 618 | } |
| 624 | @Override | 619 | @Override |
| @@ -636,7 +631,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | @@ -636,7 +631,7 @@ public class MediaServerServiceImpl implements IMediaServerService { | ||
| 636 | logger.warn("[更新ZLM 保活信息]失败,未找到流媒体信息"); | 631 | logger.warn("[更新ZLM 保活信息]失败,未找到流媒体信息"); |
| 637 | return; | 632 | return; |
| 638 | } | 633 | } |
| 639 | - String key = VideoManagerConstants.MEDIA_SERVER_KEEPALIVE_PREFIX + userSetup.getServerId() + "_" + mediaServerId; | 634 | + String key = VideoManagerConstants.MEDIA_SERVER_KEEPALIVE_PREFIX + userSetting.getServerId() + "_" + mediaServerId; |
| 640 | int hookAliveInterval = mediaServerItem.getHookAliveInterval() + 2; | 635 | int hookAliveInterval = mediaServerItem.getHookAliveInterval() + 2; |
| 641 | redisUtil.set(key, data, hookAliveInterval); | 636 | redisUtil.set(key, data, hookAliveInterval); |
| 642 | } | 637 | } |
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java
| @@ -6,11 +6,10 @@ import com.alibaba.fastjson.JSONObject; | @@ -6,11 +6,10 @@ import com.alibaba.fastjson.JSONObject; | ||
| 6 | import com.genersoft.iot.vmp.common.StreamInfo; | 6 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 7 | import com.genersoft.iot.vmp.conf.MediaConfig; | 7 | import com.genersoft.iot.vmp.conf.MediaConfig; |
| 8 | import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; | 8 | import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; |
| 9 | -import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; | ||
| 10 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | 9 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 11 | import com.genersoft.iot.vmp.service.IMediaServerService; | 10 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 12 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 11 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 13 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 12 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 14 | import com.genersoft.iot.vmp.service.IMediaService; | 13 | import com.genersoft.iot.vmp.service.IMediaService; |
| 15 | import org.springframework.beans.factory.annotation.Autowired; | 14 | import org.springframework.beans.factory.annotation.Autowired; |
| 16 | import org.springframework.stereotype.Service; | 15 | import org.springframework.stereotype.Service; |
| @@ -22,7 +21,7 @@ public class MediaServiceImpl implements IMediaService { | @@ -22,7 +21,7 @@ public class MediaServiceImpl implements IMediaService { | ||
| 22 | private IRedisCatchStorage redisCatchStorage; | 21 | private IRedisCatchStorage redisCatchStorage; |
| 23 | 22 | ||
| 24 | @Autowired | 23 | @Autowired |
| 25 | - private IVideoManagerStorager storager; | 24 | + private IVideoManagerStorage storager; |
| 26 | 25 | ||
| 27 | @Autowired | 26 | @Autowired |
| 28 | private IMediaServerService mediaServerService; | 27 | private IMediaServerService mediaServerService; |
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
| @@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSON; | @@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSON; | ||
| 4 | import com.alibaba.fastjson.JSONArray; | 4 | import com.alibaba.fastjson.JSONArray; |
| 5 | import com.alibaba.fastjson.JSONObject; | 5 | import com.alibaba.fastjson.JSONObject; |
| 6 | import com.genersoft.iot.vmp.common.StreamInfo; | 6 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 7 | -import com.genersoft.iot.vmp.conf.UserSetup; | 7 | +import com.genersoft.iot.vmp.conf.UserSetting; |
| 8 | import com.genersoft.iot.vmp.gb28181.bean.*; | 8 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 9 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; | 9 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; |
| 10 | import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; | 10 | import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; |
| @@ -23,7 +23,7 @@ import com.genersoft.iot.vmp.service.bean.PlayBackCallback; | @@ -23,7 +23,7 @@ import com.genersoft.iot.vmp.service.bean.PlayBackCallback; | ||
| 23 | import com.genersoft.iot.vmp.service.bean.PlayBackResult; | 23 | import com.genersoft.iot.vmp.service.bean.PlayBackResult; |
| 24 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; | 24 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; |
| 25 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 25 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 26 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 26 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 27 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; | 27 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; |
| 28 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | 28 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 29 | import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.PlayResult; | 29 | import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.PlayResult; |
| @@ -50,7 +50,7 @@ public class PlayServiceImpl implements IPlayService { | @@ -50,7 +50,7 @@ public class PlayServiceImpl implements IPlayService { | ||
| 50 | private final static Logger logger = LoggerFactory.getLogger(PlayServiceImpl.class); | 50 | private final static Logger logger = LoggerFactory.getLogger(PlayServiceImpl.class); |
| 51 | 51 | ||
| 52 | @Autowired | 52 | @Autowired |
| 53 | - private IVideoManagerStorager storager; | 53 | + private IVideoManagerStorage storager; |
| 54 | 54 | ||
| 55 | @Autowired | 55 | @Autowired |
| 56 | private SIPCommander cmder; | 56 | private SIPCommander cmder; |
| @@ -83,7 +83,7 @@ public class PlayServiceImpl implements IPlayService { | @@ -83,7 +83,7 @@ public class PlayServiceImpl implements IPlayService { | ||
| 83 | private VideoStreamSessionManager streamSession; | 83 | private VideoStreamSessionManager streamSession; |
| 84 | 84 | ||
| 85 | @Autowired | 85 | @Autowired |
| 86 | - private UserSetup userSetup; | 86 | + private UserSetting userSetting; |
| 87 | 87 | ||
| 88 | 88 | ||
| 89 | 89 | ||
| @@ -99,7 +99,7 @@ public class PlayServiceImpl implements IPlayService { | @@ -99,7 +99,7 @@ public class PlayServiceImpl implements IPlayService { | ||
| 99 | String uuid = UUID.randomUUID().toString(); | 99 | String uuid = UUID.randomUUID().toString(); |
| 100 | msg.setId(uuid); | 100 | msg.setId(uuid); |
| 101 | playResult.setUuid(uuid); | 101 | playResult.setUuid(uuid); |
| 102 | - DeferredResult<ResponseEntity<String>> result = new DeferredResult<>(userSetup.getPlayTimeout()); | 102 | + DeferredResult<ResponseEntity<String>> result = new DeferredResult<>(userSetting.getPlayTimeout()); |
| 103 | playResult.setResult(result); | 103 | playResult.setResult(result); |
| 104 | // 录像查询以channelId作为deviceId查询 | 104 | // 录像查询以channelId作为deviceId查询 |
| 105 | resultHolder.put(key, uuid, result); | 105 | resultHolder.put(key, uuid, result); |
| @@ -255,7 +255,7 @@ public class PlayServiceImpl implements IPlayService { | @@ -255,7 +255,7 @@ public class PlayServiceImpl implements IPlayService { | ||
| 255 | streamSession.remove(device.getDeviceId(), channelId, finalSsrcInfo.getStream()); | 255 | streamSession.remove(device.getDeviceId(), channelId, finalSsrcInfo.getStream()); |
| 256 | } | 256 | } |
| 257 | } | 257 | } |
| 258 | - }, userSetup.getPlayTimeout()); | 258 | + }, userSetting.getPlayTimeout()); |
| 259 | 259 | ||
| 260 | cmder.playStreamCmd(mediaServerItem, ssrcInfo, device, channelId, (MediaServerItem mediaServerItemInuse, JSONObject response) -> { | 260 | cmder.playStreamCmd(mediaServerItem, ssrcInfo, device, channelId, (MediaServerItem mediaServerItemInuse, JSONObject response) -> { |
| 261 | logger.info("收到订阅消息: " + response.toJSONString()); | 261 | logger.info("收到订阅消息: " + response.toJSONString()); |
| @@ -374,7 +374,7 @@ public class PlayServiceImpl implements IPlayService { | @@ -374,7 +374,7 @@ public class PlayServiceImpl implements IPlayService { | ||
| 374 | // 回复之前所有的点播请求 | 374 | // 回复之前所有的点播请求 |
| 375 | playBackCallback.call(playBackResult); | 375 | playBackCallback.call(playBackResult); |
| 376 | } | 376 | } |
| 377 | - }, userSetup.getPlayTimeout()); | 377 | + }, userSetting.getPlayTimeout()); |
| 378 | cmder.playbackStreamCmd(mediaServerItem, ssrcInfo, device, channelId, startTime, endTime, infoCallBack, | 378 | cmder.playbackStreamCmd(mediaServerItem, ssrcInfo, device, channelId, startTime, endTime, infoCallBack, |
| 379 | (InviteStreamInfo inviteStreamInfo) -> { | 379 | (InviteStreamInfo inviteStreamInfo) -> { |
| 380 | logger.info("收到订阅消息: " + inviteStreamInfo.getResponse().toJSONString()); | 380 | logger.info("收到订阅消息: " + inviteStreamInfo.getResponse().toJSONString()); |
| @@ -461,7 +461,7 @@ public class PlayServiceImpl implements IPlayService { | @@ -461,7 +461,7 @@ public class PlayServiceImpl implements IPlayService { | ||
| 461 | // 回复之前所有的点播请求 | 461 | // 回复之前所有的点播请求 |
| 462 | hookCallBack.call(downloadResult); | 462 | hookCallBack.call(downloadResult); |
| 463 | } | 463 | } |
| 464 | - }, userSetup.getPlayTimeout()); | 464 | + }, userSetting.getPlayTimeout()); |
| 465 | cmder.downloadStreamCmd(mediaServerItem, ssrcInfo, device, channelId, startTime, endTime, downloadSpeed, infoCallBack, | 465 | cmder.downloadStreamCmd(mediaServerItem, ssrcInfo, device, channelId, startTime, endTime, downloadSpeed, infoCallBack, |
| 466 | inviteStreamInfo -> { | 466 | inviteStreamInfo -> { |
| 467 | logger.info("收到订阅消息: " + inviteStreamInfo.getResponse().toJSONString()); | 467 | logger.info("收到订阅消息: " + inviteStreamInfo.getResponse().toJSONString()); |
src/main/java/com/genersoft/iot/vmp/service/impl/RedisGPSMsgListener.java
| @@ -20,7 +20,7 @@ public class RedisGPSMsgListener implements MessageListener { | @@ -20,7 +20,7 @@ public class RedisGPSMsgListener implements MessageListener { | ||
| 20 | 20 | ||
| 21 | @Override | 21 | @Override |
| 22 | public void onMessage(Message message, byte[] bytes) { | 22 | public void onMessage(Message message, byte[] bytes) { |
| 23 | - logger.debug("收到来自REDIS的GPS通知: {}", new String(message.getBody())); | 23 | + logger.info("收到来自REDIS的GPS通知: {}", new String(message.getBody())); |
| 24 | GPSMsgInfo gpsMsgInfo = JSON.parseObject(message.getBody(), GPSMsgInfo.class); | 24 | GPSMsgInfo gpsMsgInfo = JSON.parseObject(message.getBody(), GPSMsgInfo.class); |
| 25 | redisCatchStorage.updateGpsMsgInfo(gpsMsgInfo); | 25 | redisCatchStorage.updateGpsMsgInfo(gpsMsgInfo); |
| 26 | } | 26 | } |
src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java
| @@ -3,23 +3,20 @@ package com.genersoft.iot.vmp.service.impl; | @@ -3,23 +3,20 @@ package com.genersoft.iot.vmp.service.impl; | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | import com.genersoft.iot.vmp.common.StreamInfo; | 4 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 5 | import com.genersoft.iot.vmp.conf.SipConfig; | 5 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 6 | -import com.genersoft.iot.vmp.conf.UserSetup; | ||
| 7 | -import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | 6 | +import com.genersoft.iot.vmp.conf.UserSetting; |
| 8 | import com.genersoft.iot.vmp.gb28181.bean.GbStream; | 7 | import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| 9 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | 8 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| 10 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | 9 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 11 | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; | 10 | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; |
| 12 | import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; | 11 | import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; |
| 13 | -import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig; | ||
| 14 | import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; | 12 | import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; |
| 15 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | 13 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 16 | import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; | 14 | import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; |
| 17 | -import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; | ||
| 18 | import com.genersoft.iot.vmp.service.IGbStreamService; | 15 | import com.genersoft.iot.vmp.service.IGbStreamService; |
| 19 | import com.genersoft.iot.vmp.service.IMediaServerService; | 16 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 20 | import com.genersoft.iot.vmp.service.IMediaService; | 17 | import com.genersoft.iot.vmp.service.IMediaService; |
| 21 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 18 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 22 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 19 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 23 | import com.genersoft.iot.vmp.storager.dao.GbStreamMapper; | 20 | import com.genersoft.iot.vmp.storager.dao.GbStreamMapper; |
| 24 | import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper; | 21 | import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper; |
| 25 | import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper; | 22 | import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper; |
| @@ -44,7 +41,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService { | @@ -44,7 +41,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService { | ||
| 44 | private final static Logger logger = LoggerFactory.getLogger(StreamProxyServiceImpl.class); | 41 | private final static Logger logger = LoggerFactory.getLogger(StreamProxyServiceImpl.class); |
| 45 | 42 | ||
| 46 | @Autowired | 43 | @Autowired |
| 47 | - private IVideoManagerStorager videoManagerStorager; | 44 | + private IVideoManagerStorage videoManagerStorager; |
| 48 | 45 | ||
| 49 | @Autowired | 46 | @Autowired |
| 50 | private IMediaService mediaService; | 47 | private IMediaService mediaService; |
| @@ -59,10 +56,10 @@ public class StreamProxyServiceImpl implements IStreamProxyService { | @@ -59,10 +56,10 @@ public class StreamProxyServiceImpl implements IStreamProxyService { | ||
| 59 | private IRedisCatchStorage redisCatchStorage; | 56 | private IRedisCatchStorage redisCatchStorage; |
| 60 | 57 | ||
| 61 | @Autowired | 58 | @Autowired |
| 62 | - private IVideoManagerStorager storager; | 59 | + private IVideoManagerStorage storager; |
| 63 | 60 | ||
| 64 | @Autowired | 61 | @Autowired |
| 65 | - private UserSetup userSetup; | 62 | + private UserSetting userSetting; |
| 66 | 63 | ||
| 67 | @Autowired | 64 | @Autowired |
| 68 | private SipConfig sipConfig; | 65 | private SipConfig sipConfig; |
| @@ -321,7 +318,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService { | @@ -321,7 +318,7 @@ public class StreamProxyServiceImpl implements IStreamProxyService { | ||
| 321 | if (mediaItems.size() > 0) { | 318 | if (mediaItems.size() > 0) { |
| 322 | for (MediaItem mediaItem : mediaItems) { | 319 | for (MediaItem mediaItem : mediaItems) { |
| 323 | JSONObject jsonObject = new JSONObject(); | 320 | JSONObject jsonObject = new JSONObject(); |
| 324 | - jsonObject.put("serverId", userSetup.getServerId()); | 321 | + jsonObject.put("serverId", userSetting.getServerId()); |
| 325 | jsonObject.put("app", mediaItem.getApp()); | 322 | jsonObject.put("app", mediaItem.getApp()); |
| 326 | jsonObject.put("stream", mediaItem.getStream()); | 323 | jsonObject.put("stream", mediaItem.getStream()); |
| 327 | jsonObject.put("register", false); | 324 | jsonObject.put("register", false); |
src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java
| @@ -4,21 +4,17 @@ import com.alibaba.fastjson.JSON; | @@ -4,21 +4,17 @@ import com.alibaba.fastjson.JSON; | ||
| 4 | import com.alibaba.fastjson.JSONArray; | 4 | import com.alibaba.fastjson.JSONArray; |
| 5 | import com.alibaba.fastjson.JSONObject; | 5 | import com.alibaba.fastjson.JSONObject; |
| 6 | import com.alibaba.fastjson.TypeReference; | 6 | import com.alibaba.fastjson.TypeReference; |
| 7 | -import com.genersoft.iot.vmp.common.StreamInfo; | ||
| 8 | -import com.genersoft.iot.vmp.conf.UserSetup; | 7 | +import com.genersoft.iot.vmp.conf.UserSetting; |
| 9 | import com.genersoft.iot.vmp.gb28181.bean.*; | 8 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 10 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | 9 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 11 | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; | 10 | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; |
| 12 | -import com.genersoft.iot.vmp.media.zlm.ZLMHttpHookSubscribe; | ||
| 13 | import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; | 11 | import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; |
| 14 | -import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig; | ||
| 15 | import com.genersoft.iot.vmp.media.zlm.dto.*; | 12 | import com.genersoft.iot.vmp.media.zlm.dto.*; |
| 16 | import com.genersoft.iot.vmp.service.IGbStreamService; | 13 | import com.genersoft.iot.vmp.service.IGbStreamService; |
| 17 | import com.genersoft.iot.vmp.service.IMediaServerService; | 14 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 18 | import com.genersoft.iot.vmp.service.IStreamPushService; | 15 | import com.genersoft.iot.vmp.service.IStreamPushService; |
| 19 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 16 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 20 | import com.genersoft.iot.vmp.storager.dao.*; | 17 | import com.genersoft.iot.vmp.storager.dao.*; |
| 21 | -import com.genersoft.iot.vmp.vmanager.bean.StreamPushExcelDto; | ||
| 22 | import com.github.pagehelper.PageHelper; | 18 | import com.github.pagehelper.PageHelper; |
| 23 | import com.github.pagehelper.PageInfo; | 19 | import com.github.pagehelper.PageInfo; |
| 24 | import org.slf4j.Logger; | 20 | import org.slf4j.Logger; |
| @@ -63,7 +59,7 @@ public class StreamPushServiceImpl implements IStreamPushService { | @@ -63,7 +59,7 @@ public class StreamPushServiceImpl implements IStreamPushService { | ||
| 63 | private IRedisCatchStorage redisCatchStorage; | 59 | private IRedisCatchStorage redisCatchStorage; |
| 64 | 60 | ||
| 65 | @Autowired | 61 | @Autowired |
| 66 | - private UserSetup userSetup; | 62 | + private UserSetting userSetting; |
| 67 | 63 | ||
| 68 | @Autowired | 64 | @Autowired |
| 69 | private IMediaServerService mediaServerService; | 65 | private IMediaServerService mediaServerService; |
| @@ -263,7 +259,7 @@ public class StreamPushServiceImpl implements IStreamPushService { | @@ -263,7 +259,7 @@ public class StreamPushServiceImpl implements IStreamPushService { | ||
| 263 | String type = "PUSH"; | 259 | String type = "PUSH"; |
| 264 | for (MediaItem offlineMediaItem : offlineMediaItemList) { | 260 | for (MediaItem offlineMediaItem : offlineMediaItemList) { |
| 265 | JSONObject jsonObject = new JSONObject(); | 261 | JSONObject jsonObject = new JSONObject(); |
| 266 | - jsonObject.put("serverId", userSetup.getServerId()); | 262 | + jsonObject.put("serverId", userSetting.getServerId()); |
| 267 | jsonObject.put("app", offlineMediaItem.getApp()); | 263 | jsonObject.put("app", offlineMediaItem.getApp()); |
| 268 | jsonObject.put("stream", offlineMediaItem.getStream()); | 264 | jsonObject.put("stream", offlineMediaItem.getStream()); |
| 269 | jsonObject.put("register", false); | 265 | jsonObject.put("register", false); |
| @@ -293,7 +289,7 @@ public class StreamPushServiceImpl implements IStreamPushService { | @@ -293,7 +289,7 @@ public class StreamPushServiceImpl implements IStreamPushService { | ||
| 293 | // 移除redis内流的信息 | 289 | // 移除redis内流的信息 |
| 294 | redisCatchStorage.removeStream(mediaServerId, type, mediaItem.getApp(), mediaItem.getStream()); | 290 | redisCatchStorage.removeStream(mediaServerId, type, mediaItem.getApp(), mediaItem.getStream()); |
| 295 | JSONObject jsonObject = new JSONObject(); | 291 | JSONObject jsonObject = new JSONObject(); |
| 296 | - jsonObject.put("serverId", userSetup.getServerId()); | 292 | + jsonObject.put("serverId", userSetting.getServerId()); |
| 297 | jsonObject.put("app", mediaItem.getApp()); | 293 | jsonObject.put("app", mediaItem.getApp()); |
| 298 | jsonObject.put("stream", mediaItem.getStream()); | 294 | jsonObject.put("stream", mediaItem.getStream()); |
| 299 | jsonObject.put("register", false); | 295 | jsonObject.put("register", false); |
src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java
| @@ -7,6 +7,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; | @@ -7,6 +7,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; | ||
| 7 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | 7 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 8 | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; | 8 | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| 9 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; | 9 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| 10 | +import com.genersoft.iot.vmp.service.bean.MessageForPushChannel; | ||
| 10 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; | 11 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; |
| 11 | import com.genersoft.iot.vmp.service.bean.ThirdPartyGB; | 12 | import com.genersoft.iot.vmp.service.bean.ThirdPartyGB; |
| 12 | 13 | ||
| @@ -212,4 +213,7 @@ public interface IRedisCatchStorage { | @@ -212,4 +213,7 @@ public interface IRedisCatchStorage { | ||
| 212 | 213 | ||
| 213 | void addNetInfo(Map<String, String> networkInterfaces); | 214 | void addNetInfo(Map<String, String> networkInterfaces); |
| 214 | 215 | ||
| 216 | + void sendMobilePositionMsg(JSONObject jsonObject); | ||
| 217 | + | ||
| 218 | + void sendStreamPushRequestedMsg(MessageForPushChannel messageForPushChannel); | ||
| 215 | } | 219 | } |
src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorager.java renamed to src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorage.java
| 1 | -package com.genersoft.iot.vmp.storager; | ||
| 2 | - | ||
| 3 | -import com.genersoft.iot.vmp.gb28181.bean.*; | ||
| 4 | -import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | ||
| 5 | -import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; | ||
| 6 | -import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; | ||
| 7 | -import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; | ||
| 8 | -import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo; | ||
| 9 | -import com.genersoft.iot.vmp.vmanager.bean.DeviceChannelTree; | ||
| 10 | -import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; | ||
| 11 | -import com.github.pagehelper.PageInfo; | ||
| 12 | - | ||
| 13 | -import java.util.List; | ||
| 14 | - | ||
| 15 | -/** | ||
| 16 | - * @description:视频设备数据存储接口 | ||
| 17 | - * @author: swwheihei | ||
| 18 | - * @date: 2020年5月6日 下午2:14:31 | ||
| 19 | - */ | ||
| 20 | -@SuppressWarnings("rawtypes") | ||
| 21 | -public interface IVideoManagerStorager { | ||
| 22 | - | ||
| 23 | - /** | ||
| 24 | - * 根据设备ID判断设备是否存在 | ||
| 25 | - * | ||
| 26 | - * @param deviceId 设备ID | ||
| 27 | - * @return true:存在 false:不存在 | ||
| 28 | - */ | ||
| 29 | - public boolean exists(String deviceId); | ||
| 30 | - | ||
| 31 | - /** | ||
| 32 | - * 视频设备创建 | ||
| 33 | - * | ||
| 34 | - * @param device 设备对象 | ||
| 35 | - * @return true:创建成功 false:创建失败 | ||
| 36 | - */ | ||
| 37 | - public boolean create(Device device); | ||
| 38 | - | ||
| 39 | - /** | ||
| 40 | - * 视频设备更新 | ||
| 41 | - * | ||
| 42 | - * @param device 设备对象 | ||
| 43 | - * @return true:创建成功 false:创建失败 | ||
| 44 | - */ | ||
| 45 | - public boolean updateDevice(Device device); | ||
| 46 | - | ||
| 47 | - /** | ||
| 48 | - * 添加设备通道 | ||
| 49 | - * | ||
| 50 | - * @param deviceId 设备id | ||
| 51 | - * @param channel 通道 | ||
| 52 | - */ | ||
| 53 | - public void updateChannel(String deviceId, DeviceChannel channel); | ||
| 54 | - | ||
| 55 | - /** | ||
| 56 | - * 批量添加设备通道 | ||
| 57 | - * | ||
| 58 | - * @param deviceId 设备id | ||
| 59 | - * @param channels 多个通道 | ||
| 60 | - */ | ||
| 61 | - public int updateChannels(String deviceId, List<DeviceChannel> channels); | ||
| 62 | - | ||
| 63 | - /** | ||
| 64 | - * 开始播放 | ||
| 65 | - * @param deviceId 设备id | ||
| 66 | - * @param channelId 通道ID | ||
| 67 | - * @param streamId 流地址 | ||
| 68 | - */ | ||
| 69 | - public void startPlay(String deviceId, String channelId, String streamId); | ||
| 70 | - | ||
| 71 | - /** | ||
| 72 | - * 停止播放 | ||
| 73 | - * @param deviceId 设备id | ||
| 74 | - * @param channelId 通道ID | ||
| 75 | - */ | ||
| 76 | - public void stopPlay(String deviceId, String channelId); | ||
| 77 | - | ||
| 78 | - /** | ||
| 79 | - * 获取设备 | ||
| 80 | - * | ||
| 81 | - * @param deviceId 设备ID | ||
| 82 | - * @return DShadow 设备对象 | ||
| 83 | - */ | ||
| 84 | - public Device queryVideoDevice(String deviceId); | ||
| 85 | - | ||
| 86 | - /** | ||
| 87 | - * 获取某个设备的通道列表 | ||
| 88 | - * | ||
| 89 | - * @param deviceId 设备ID | ||
| 90 | - * @param page 分页 当前页 | ||
| 91 | - * @param count 每页数量 | ||
| 92 | - * @return | ||
| 93 | - */ | ||
| 94 | - public PageInfo queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, int page, int count); | ||
| 95 | - | ||
| 96 | - public List<DeviceChannel> queryChannelsByDeviceIdWithStartAndLimit(String deviceId, String query, Boolean hasSubChannel, Boolean online, int start, int limit); | ||
| 97 | - | ||
| 98 | - /** | ||
| 99 | - * 获取某个设备的通道树 | ||
| 100 | - * @param deviceId 设备ID | ||
| 101 | - * @return | ||
| 102 | - */ | ||
| 103 | - List<DeviceChannelTree> tree(String deviceId); | ||
| 104 | - | ||
| 105 | - /** | ||
| 106 | - * 获取某个设备的通道列表 | ||
| 107 | - * | ||
| 108 | - * @param deviceId 设备ID | ||
| 109 | - * @return | ||
| 110 | - */ | ||
| 111 | - public List<DeviceChannel> queryChannelsByDeviceId(String deviceId); | ||
| 112 | - public List<DeviceChannel> queryOnlineChannelsByDeviceId(String deviceId); | ||
| 113 | - | ||
| 114 | - /** | ||
| 115 | - * 获取某个设备的通道 | ||
| 116 | - * @param deviceId 设备ID | ||
| 117 | - * @param channelId 通道ID | ||
| 118 | - */ | ||
| 119 | - public DeviceChannel queryChannel(String deviceId, String channelId); | ||
| 120 | - | ||
| 121 | - /** | ||
| 122 | - * 删除通道 | ||
| 123 | - * @param deviceId 设备ID | ||
| 124 | - * @param channelId 通道ID | ||
| 125 | - */ | ||
| 126 | - public int delChannel(String deviceId, String channelId); | ||
| 127 | - | ||
| 128 | - /** | ||
| 129 | - * 获取多个设备 | ||
| 130 | - * @param page 当前页数 | ||
| 131 | - * @param count 每页数量 | ||
| 132 | - * @return List<Device> 设备对象数组 | ||
| 133 | - */ | ||
| 134 | - public PageInfo<Device> queryVideoDeviceList(int page, int count); | ||
| 135 | - | ||
| 136 | - /** | ||
| 137 | - * 获取多个设备 | ||
| 138 | - * | ||
| 139 | - * @return List<Device> 设备对象数组 | ||
| 140 | - */ | ||
| 141 | - public List<Device> queryVideoDeviceList(); | ||
| 142 | - | ||
| 143 | - /** | ||
| 144 | - * 删除设备 | ||
| 145 | - * | ||
| 146 | - * @param deviceId 设备ID | ||
| 147 | - * @return true:删除成功 false:删除失败 | ||
| 148 | - */ | ||
| 149 | - public boolean delete(String deviceId); | ||
| 150 | - | ||
| 151 | - /** | ||
| 152 | - * 更新设备在线 | ||
| 153 | - * | ||
| 154 | - * @param deviceId 设备ID | ||
| 155 | - * @return true:更新成功 false:更新失败 | ||
| 156 | - */ | ||
| 157 | - public boolean online(String deviceId); | ||
| 158 | - | ||
| 159 | - /** | ||
| 160 | - * 更新设备离线 | ||
| 161 | - * | ||
| 162 | - * @param deviceId 设备ID | ||
| 163 | - * @return true:更新成功 false:更新失败 | ||
| 164 | - */ | ||
| 165 | - public boolean outline(String deviceId); | ||
| 166 | - | ||
| 167 | - /** | ||
| 168 | - * 更新所有设备离线 | ||
| 169 | - * | ||
| 170 | - * @return true:更新成功 false:更新失败 | ||
| 171 | - */ | ||
| 172 | - public boolean outlineForAll(); | ||
| 173 | - | ||
| 174 | - | ||
| 175 | - /** | ||
| 176 | - * 查询子设备 | ||
| 177 | - * | ||
| 178 | - * @param deviceId | ||
| 179 | - * @param channelId | ||
| 180 | - * @param page | ||
| 181 | - * @param count | ||
| 182 | - * @return | ||
| 183 | - */ | ||
| 184 | - PageInfo querySubChannels(String deviceId, String channelId, String query, Boolean hasSubChannel, String online, int page, int count); | ||
| 185 | - | ||
| 186 | - | ||
| 187 | - /** | ||
| 188 | - * 清空通道 | ||
| 189 | - * @param deviceId | ||
| 190 | - */ | ||
| 191 | - void cleanChannelsForDevice(String deviceId); | ||
| 192 | - | ||
| 193 | - | ||
| 194 | - /** | ||
| 195 | - * 更新上级平台 | ||
| 196 | - * @param parentPlatform | ||
| 197 | - */ | ||
| 198 | - boolean updateParentPlatform(ParentPlatform parentPlatform); | ||
| 199 | - | ||
| 200 | - | ||
| 201 | - /** | ||
| 202 | - * 添加上级平台 | ||
| 203 | - * @param parentPlatform | ||
| 204 | - */ | ||
| 205 | - boolean addParentPlatform(ParentPlatform parentPlatform); | ||
| 206 | - | ||
| 207 | - /** | ||
| 208 | - * 删除上级平台 | ||
| 209 | - * @param parentPlatform | ||
| 210 | - */ | ||
| 211 | - boolean deleteParentPlatform(ParentPlatform parentPlatform); | ||
| 212 | - | ||
| 213 | - | ||
| 214 | - /** | ||
| 215 | - * 分页获取上级平台 | ||
| 216 | - * @param page | ||
| 217 | - * @param count | ||
| 218 | - * @return | ||
| 219 | - */ | ||
| 220 | - PageInfo<ParentPlatform> queryParentPlatformList(int page, int count); | ||
| 221 | - | ||
| 222 | - /** | ||
| 223 | - * 获取所有已启用的平台 | ||
| 224 | - * @return | ||
| 225 | - */ | ||
| 226 | - List<ParentPlatform> queryEnableParentPlatformList(boolean enable); | ||
| 227 | - | ||
| 228 | - /** | ||
| 229 | - * 获取上级平台 | ||
| 230 | - * @param platformGbId | ||
| 231 | - * @return | ||
| 232 | - */ | ||
| 233 | - ParentPlatform queryParentPlatByServerGBId(String platformGbId); | ||
| 234 | - | ||
| 235 | - /** | ||
| 236 | - * 所有平台离线 | ||
| 237 | - */ | ||
| 238 | - void outlineForAllParentPlatform(); | ||
| 239 | - | ||
| 240 | - /** | ||
| 241 | - * 查询通道信息,不区分设备(已关联平台或全部) | ||
| 242 | - */ | ||
| 243 | - PageInfo<ChannelReduce> queryAllChannelList(int page, int count, String query, Boolean online, Boolean channelType, String platformId, String catalogId); | ||
| 244 | - | ||
| 245 | - /** | ||
| 246 | - * 查询设备的通道信息 | ||
| 247 | - */ | ||
| 248 | - List<DeviceChannelInPlatform> queryChannelListInParentPlatform(String platformId); | ||
| 249 | - | ||
| 250 | - | ||
| 251 | - /** | ||
| 252 | - * 更新上级平台的通道信息 | ||
| 253 | - * @param platformId | ||
| 254 | - * @param channelReduces | ||
| 255 | - * @return | ||
| 256 | - */ | ||
| 257 | - int updateChannelForGB(String platformId, List<ChannelReduce> channelReduces, String catalogId); | ||
| 258 | - | ||
| 259 | - /** | ||
| 260 | - * 移除上级平台的通道信息 | ||
| 261 | - * @param platformId | ||
| 262 | - * @param channelReduces | ||
| 263 | - * @return | ||
| 264 | - */ | ||
| 265 | - int delChannelForGB(String platformId, List<ChannelReduce> channelReduces); | ||
| 266 | - | ||
| 267 | - | ||
| 268 | - DeviceChannel queryChannelInParentPlatform(String platformId, String channelId); | ||
| 269 | - | ||
| 270 | - List<PlatformCatalog> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId); | ||
| 271 | - List<PlatformCatalog> queryStreamInParentPlatformAndCatalog(String platformId, String catalogId); | ||
| 272 | - | ||
| 273 | - Device queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId); | ||
| 274 | - | ||
| 275 | - | ||
| 276 | - /** | ||
| 277 | - * 添加Mobile Position设备移动位置 | ||
| 278 | - * @param mobilePosition | ||
| 279 | - * @return | ||
| 280 | - */ | ||
| 281 | - public boolean insertMobilePosition(MobilePosition mobilePosition); | ||
| 282 | - | ||
| 283 | - /** | ||
| 284 | - * 查询移动位置轨迹 | ||
| 285 | - * @param deviceId | ||
| 286 | - * @param startTime | ||
| 287 | - * @param endTime | ||
| 288 | - */ | ||
| 289 | - public List<MobilePosition> queryMobilePositions(String deviceId, String startTime, String endTime); | ||
| 290 | - | ||
| 291 | - /** | ||
| 292 | - * 查询最新移动位置 | ||
| 293 | - * @param deviceId | ||
| 294 | - */ | ||
| 295 | - public MobilePosition queryLatestPosition(String deviceId); | ||
| 296 | - | ||
| 297 | - /** | ||
| 298 | - * 删除指定设备的所有移动位置 | ||
| 299 | - * @param deviceId | ||
| 300 | - */ | ||
| 301 | - public int clearMobilePositionsByDeviceId(String deviceId); | ||
| 302 | - | ||
| 303 | - /** | ||
| 304 | - * 新增代理流 | ||
| 305 | - * @param streamProxyDto | ||
| 306 | - * @return | ||
| 307 | - */ | ||
| 308 | - public boolean addStreamProxy(StreamProxyItem streamProxyDto); | ||
| 309 | - | ||
| 310 | - /** | ||
| 311 | - * 更新代理流 | ||
| 312 | - * @param streamProxyDto | ||
| 313 | - * @return | ||
| 314 | - */ | ||
| 315 | - public boolean updateStreamProxy(StreamProxyItem streamProxyDto); | ||
| 316 | - | ||
| 317 | - /** | ||
| 318 | - * 移除代理流 | ||
| 319 | - * @param app | ||
| 320 | - * @param stream | ||
| 321 | - * @return | ||
| 322 | - */ | ||
| 323 | - public int deleteStreamProxy(String app, String stream); | ||
| 324 | - | ||
| 325 | - /** | ||
| 326 | - * 按照是否启用获取代理流 | ||
| 327 | - * @param enable | ||
| 328 | - * @return | ||
| 329 | - */ | ||
| 330 | - public List<StreamProxyItem> getStreamProxyListForEnable(boolean enable); | ||
| 331 | - | ||
| 332 | - /** | ||
| 333 | - * 按照是app和stream获取代理流 | ||
| 334 | - * @param app | ||
| 335 | - * @param stream | ||
| 336 | - * @return | ||
| 337 | - */ | ||
| 338 | - public StreamProxyItem queryStreamProxy(String app, String stream); | ||
| 339 | - | ||
| 340 | - /** | ||
| 341 | - * 获取代理流 | ||
| 342 | - * @param page | ||
| 343 | - * @param count | ||
| 344 | - * @return | ||
| 345 | - */ | ||
| 346 | - PageInfo<StreamProxyItem> queryStreamProxyList(Integer page, Integer count); | ||
| 347 | - | ||
| 348 | - /** | ||
| 349 | - * 根据国标ID获取平台关联的直播流 | ||
| 350 | - * @param platformId | ||
| 351 | - * @param channelId | ||
| 352 | - * @return | ||
| 353 | - */ | ||
| 354 | - GbStream queryStreamInParentPlatform(String platformId, String channelId); | ||
| 355 | - | ||
| 356 | - /** | ||
| 357 | - * 获取平台关联的直播流 | ||
| 358 | - * @param platformId | ||
| 359 | - * @return | ||
| 360 | - */ | ||
| 361 | - List<GbStream> queryGbStreamListInPlatform(String platformId); | ||
| 362 | - | ||
| 363 | - /** | ||
| 364 | - * 批量更新推流列表 | ||
| 365 | - * @param streamPushItems | ||
| 366 | - */ | ||
| 367 | - void updateMediaList(List<StreamPushItem> streamPushItems); | ||
| 368 | - | ||
| 369 | - /** | ||
| 370 | - * 更新单个推流 | ||
| 371 | - * @param streamPushItem | ||
| 372 | - */ | ||
| 373 | - void updateMedia(StreamPushItem streamPushItem); | ||
| 374 | - | ||
| 375 | - /** | ||
| 376 | - * 移除单个推流 | ||
| 377 | - * @param app | ||
| 378 | - * @param stream | ||
| 379 | - */ | ||
| 380 | - int removeMedia(String app, String stream); | ||
| 381 | - | ||
| 382 | - | ||
| 383 | - /** | ||
| 384 | - * 清空推流列表 | ||
| 385 | - */ | ||
| 386 | - void clearMediaList(); | ||
| 387 | - | ||
| 388 | - /** | ||
| 389 | - * 设置流离线 | ||
| 390 | - * @param app | ||
| 391 | - * @param streamId | ||
| 392 | - */ | ||
| 393 | - int mediaOutline(String app, String streamId); | ||
| 394 | - | ||
| 395 | - /** | ||
| 396 | - * 设置平台在线/离线 | ||
| 397 | - * @param online | ||
| 398 | - */ | ||
| 399 | - void updateParentPlatformStatus(String platformGbID, boolean online); | ||
| 400 | - | ||
| 401 | - /** | ||
| 402 | - * 根据媒体ID获取启用/不启用的代理列表 | ||
| 403 | - * @param id 媒体ID | ||
| 404 | - * @param enable 启用/不启用 | ||
| 405 | - * @param status 状态 | ||
| 406 | - * @return | ||
| 407 | - */ | ||
| 408 | - List<StreamProxyItem> getStreamProxyListForEnableInMediaServer(String id, boolean enable, boolean status); | ||
| 409 | - | ||
| 410 | - /** | ||
| 411 | - * 根据通道ID获取其所在设备 | ||
| 412 | - * @param channelId 通道ID | ||
| 413 | - * @return | ||
| 414 | - */ | ||
| 415 | - Device queryVideoDeviceByChannelId(String channelId); | ||
| 416 | - | ||
| 417 | - /** | ||
| 418 | - * 通道上线 | ||
| 419 | - * @param channelId 通道ID | ||
| 420 | - */ | ||
| 421 | - void deviceChannelOnline(String deviceId, String channelId); | ||
| 422 | - | ||
| 423 | - /** | ||
| 424 | - * 通道离线 | ||
| 425 | - * @param channelId 通道ID | ||
| 426 | - */ | ||
| 427 | - void deviceChannelOffline(String deviceId, String channelId); | ||
| 428 | - | ||
| 429 | - /** | ||
| 430 | - * 通过app与stream获取StreamProxy | ||
| 431 | - * @param app | ||
| 432 | - * @param streamId | ||
| 433 | - * @return | ||
| 434 | - */ | ||
| 435 | - StreamProxyItem getStreamProxyByAppAndStream(String app, String streamId); | ||
| 436 | - | ||
| 437 | - /** | ||
| 438 | - * catlog查询结束后完全重写通道信息 | ||
| 439 | - * @param deviceId | ||
| 440 | - * @param deviceChannelList | ||
| 441 | - */ | ||
| 442 | - boolean resetChannels(String deviceId, List<DeviceChannel> deviceChannelList); | ||
| 443 | - | ||
| 444 | - /** | ||
| 445 | - * 获取目录信息 | ||
| 446 | - * @param platformId | ||
| 447 | - * @param parentId | ||
| 448 | - * @return | ||
| 449 | - */ | ||
| 450 | - List<PlatformCatalog> getChildrenCatalogByPlatform(String platformId, String parentId); | ||
| 451 | - | ||
| 452 | - int addCatalog(PlatformCatalog platformCatalog); | ||
| 453 | - | ||
| 454 | - PlatformCatalog getCatalog(String id); | ||
| 455 | - | ||
| 456 | - int delCatalog(String id); | ||
| 457 | - | ||
| 458 | - int updateCatalog(PlatformCatalog platformCatalog); | ||
| 459 | - | ||
| 460 | - int setDefaultCatalog(String platformId, String catalogId); | ||
| 461 | - | ||
| 462 | - List<PlatformCatalog> queryCatalogInPlatform(String serverGBId); | ||
| 463 | - | ||
| 464 | - int delRelation(PlatformCatalog platformCatalog); | ||
| 465 | - | ||
| 466 | - int updateStreamGPS(List<GPSMsgInfo> gpsMsgInfo); | ||
| 467 | - | ||
| 468 | - List<ParentPlatform> queryPlatFormListForGBWithGBId(String channelId, List<String> platforms); | ||
| 469 | - | ||
| 470 | - List<ParentPlatform> queryPlatFormListForStreamWithGBId(String app, String stream, List<String> platforms); | ||
| 471 | - | ||
| 472 | - GbStream getGbStream(String app, String streamId); | ||
| 473 | - | ||
| 474 | - void delCatalogByPlatformId(String serverGBId); | ||
| 475 | - | ||
| 476 | - void delRelationByPlatformId(String serverGBId); | ||
| 477 | - | ||
| 478 | - PlatformCatalog queryDefaultCatalogInPlatform(String platformId); | ||
| 479 | - | ||
| 480 | - List<ChannelSourceInfo> getChannelSource(String platformId, String gbId); | ||
| 481 | -} | 1 | +package com.genersoft.iot.vmp.storager; |
| 2 | + | ||
| 3 | +import com.genersoft.iot.vmp.gb28181.bean.*; | ||
| 4 | +import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; | ||
| 5 | +import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; | ||
| 6 | +import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; | ||
| 7 | +import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo; | ||
| 8 | +import com.genersoft.iot.vmp.vmanager.bean.DeviceChannelTree; | ||
| 9 | +import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; | ||
| 10 | +import com.github.pagehelper.PageInfo; | ||
| 11 | + | ||
| 12 | +import java.util.List; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * @description:视频设备数据存储接口 | ||
| 16 | + * @author: swwheihei | ||
| 17 | + * @date: 2020年5月6日 下午2:14:31 | ||
| 18 | + */ | ||
| 19 | +@SuppressWarnings("rawtypes") | ||
| 20 | +public interface IVideoManagerStorage { | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * 根据设备ID判断设备是否存在 | ||
| 24 | + * | ||
| 25 | + * @param deviceId 设备ID | ||
| 26 | + * @return true:存在 false:不存在 | ||
| 27 | + */ | ||
| 28 | + public boolean exists(String deviceId); | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * 视频设备创建 | ||
| 32 | + * | ||
| 33 | + * @param device 设备对象 | ||
| 34 | + * @return true:创建成功 false:创建失败 | ||
| 35 | + */ | ||
| 36 | + public boolean create(Device device); | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * 视频设备更新 | ||
| 40 | + * | ||
| 41 | + * @param device 设备对象 | ||
| 42 | + * @return true:创建成功 false:创建失败 | ||
| 43 | + */ | ||
| 44 | + public boolean updateDevice(Device device); | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * 添加设备通道 | ||
| 48 | + * | ||
| 49 | + * @param deviceId 设备id | ||
| 50 | + * @param channel 通道 | ||
| 51 | + */ | ||
| 52 | + public void updateChannel(String deviceId, DeviceChannel channel); | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * 批量添加设备通道 | ||
| 56 | + * | ||
| 57 | + * @param deviceId 设备id | ||
| 58 | + * @param channels 多个通道 | ||
| 59 | + */ | ||
| 60 | + public int updateChannels(String deviceId, List<DeviceChannel> channels); | ||
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * 开始播放 | ||
| 64 | + * @param deviceId 设备id | ||
| 65 | + * @param channelId 通道ID | ||
| 66 | + * @param streamId 流地址 | ||
| 67 | + */ | ||
| 68 | + public void startPlay(String deviceId, String channelId, String streamId); | ||
| 69 | + | ||
| 70 | + /** | ||
| 71 | + * 停止播放 | ||
| 72 | + * @param deviceId 设备id | ||
| 73 | + * @param channelId 通道ID | ||
| 74 | + */ | ||
| 75 | + public void stopPlay(String deviceId, String channelId); | ||
| 76 | + | ||
| 77 | + /** | ||
| 78 | + * 获取设备 | ||
| 79 | + * | ||
| 80 | + * @param deviceId 设备ID | ||
| 81 | + * @return DShadow 设备对象 | ||
| 82 | + */ | ||
| 83 | + public Device queryVideoDevice(String deviceId); | ||
| 84 | + | ||
| 85 | + /** | ||
| 86 | + * 获取某个设备的通道列表 | ||
| 87 | + * | ||
| 88 | + * @param deviceId 设备ID | ||
| 89 | + * @param page 分页 当前页 | ||
| 90 | + * @param count 每页数量 | ||
| 91 | + * @return | ||
| 92 | + */ | ||
| 93 | + public PageInfo queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, int page, int count); | ||
| 94 | + | ||
| 95 | + public List<DeviceChannel> queryChannelsByDeviceIdWithStartAndLimit(String deviceId, String query, Boolean hasSubChannel, Boolean online, int start, int limit); | ||
| 96 | + | ||
| 97 | + /** | ||
| 98 | + * 获取某个设备的通道树 | ||
| 99 | + * @param deviceId 设备ID | ||
| 100 | + * @return | ||
| 101 | + */ | ||
| 102 | + List<DeviceChannelTree> tree(String deviceId); | ||
| 103 | + | ||
| 104 | + /** | ||
| 105 | + * 获取某个设备的通道列表 | ||
| 106 | + * | ||
| 107 | + * @param deviceId 设备ID | ||
| 108 | + * @return | ||
| 109 | + */ | ||
| 110 | + public List<DeviceChannel> queryChannelsByDeviceId(String deviceId); | ||
| 111 | + public List<DeviceChannel> queryOnlineChannelsByDeviceId(String deviceId); | ||
| 112 | + | ||
| 113 | + /** | ||
| 114 | + * 获取某个设备的通道 | ||
| 115 | + * @param deviceId 设备ID | ||
| 116 | + * @param channelId 通道ID | ||
| 117 | + */ | ||
| 118 | + public DeviceChannel queryChannel(String deviceId, String channelId); | ||
| 119 | + | ||
| 120 | + /** | ||
| 121 | + * 删除通道 | ||
| 122 | + * @param deviceId 设备ID | ||
| 123 | + * @param channelId 通道ID | ||
| 124 | + */ | ||
| 125 | + public int delChannel(String deviceId, String channelId); | ||
| 126 | + | ||
| 127 | + /** | ||
| 128 | + * 获取多个设备 | ||
| 129 | + * @param page 当前页数 | ||
| 130 | + * @param count 每页数量 | ||
| 131 | + * @return List<Device> 设备对象数组 | ||
| 132 | + */ | ||
| 133 | + public PageInfo<Device> queryVideoDeviceList(int page, int count); | ||
| 134 | + | ||
| 135 | + /** | ||
| 136 | + * 获取多个设备 | ||
| 137 | + * | ||
| 138 | + * @return List<Device> 设备对象数组 | ||
| 139 | + */ | ||
| 140 | + public List<Device> queryVideoDeviceList(); | ||
| 141 | + | ||
| 142 | + /** | ||
| 143 | + * 删除设备 | ||
| 144 | + * | ||
| 145 | + * @param deviceId 设备ID | ||
| 146 | + * @return true:删除成功 false:删除失败 | ||
| 147 | + */ | ||
| 148 | + public boolean delete(String deviceId); | ||
| 149 | + | ||
| 150 | + /** | ||
| 151 | + * 更新设备在线 | ||
| 152 | + * | ||
| 153 | + * @param deviceId 设备ID | ||
| 154 | + * @return true:更新成功 false:更新失败 | ||
| 155 | + */ | ||
| 156 | + public boolean online(String deviceId); | ||
| 157 | + | ||
| 158 | + /** | ||
| 159 | + * 更新设备离线 | ||
| 160 | + * | ||
| 161 | + * @param deviceId 设备ID | ||
| 162 | + * @return true:更新成功 false:更新失败 | ||
| 163 | + */ | ||
| 164 | + public boolean outline(String deviceId); | ||
| 165 | + | ||
| 166 | + /** | ||
| 167 | + * 更新所有设备离线 | ||
| 168 | + * | ||
| 169 | + * @return true:更新成功 false:更新失败 | ||
| 170 | + */ | ||
| 171 | + public boolean outlineForAll(); | ||
| 172 | + | ||
| 173 | + | ||
| 174 | + /** | ||
| 175 | + * 查询子设备 | ||
| 176 | + * | ||
| 177 | + * @param deviceId | ||
| 178 | + * @param channelId | ||
| 179 | + * @param page | ||
| 180 | + * @param count | ||
| 181 | + * @return | ||
| 182 | + */ | ||
| 183 | + PageInfo querySubChannels(String deviceId, String channelId, String query, Boolean hasSubChannel, String online, int page, int count); | ||
| 184 | + | ||
| 185 | + | ||
| 186 | + /** | ||
| 187 | + * 清空通道 | ||
| 188 | + * @param deviceId | ||
| 189 | + */ | ||
| 190 | + void cleanChannelsForDevice(String deviceId); | ||
| 191 | + | ||
| 192 | + | ||
| 193 | + /** | ||
| 194 | + * 更新上级平台 | ||
| 195 | + * @param parentPlatform | ||
| 196 | + */ | ||
| 197 | + boolean updateParentPlatform(ParentPlatform parentPlatform); | ||
| 198 | + | ||
| 199 | + | ||
| 200 | + /** | ||
| 201 | + * 添加上级平台 | ||
| 202 | + * @param parentPlatform | ||
| 203 | + */ | ||
| 204 | + boolean addParentPlatform(ParentPlatform parentPlatform); | ||
| 205 | + | ||
| 206 | + /** | ||
| 207 | + * 删除上级平台 | ||
| 208 | + * @param parentPlatform | ||
| 209 | + */ | ||
| 210 | + boolean deleteParentPlatform(ParentPlatform parentPlatform); | ||
| 211 | + | ||
| 212 | + | ||
| 213 | + /** | ||
| 214 | + * 分页获取上级平台 | ||
| 215 | + * @param page | ||
| 216 | + * @param count | ||
| 217 | + * @return | ||
| 218 | + */ | ||
| 219 | + PageInfo<ParentPlatform> queryParentPlatformList(int page, int count); | ||
| 220 | + | ||
| 221 | + /** | ||
| 222 | + * 获取所有已启用的平台 | ||
| 223 | + * @return | ||
| 224 | + */ | ||
| 225 | + List<ParentPlatform> queryEnableParentPlatformList(boolean enable); | ||
| 226 | + | ||
| 227 | + /** | ||
| 228 | + * 获取上级平台 | ||
| 229 | + * @param platformGbId | ||
| 230 | + * @return | ||
| 231 | + */ | ||
| 232 | + ParentPlatform queryParentPlatByServerGBId(String platformGbId); | ||
| 233 | + | ||
| 234 | + /** | ||
| 235 | + * 所有平台离线 | ||
| 236 | + */ | ||
| 237 | + void outlineForAllParentPlatform(); | ||
| 238 | + | ||
| 239 | + /** | ||
| 240 | + * 查询通道信息,不区分设备(已关联平台或全部) | ||
| 241 | + */ | ||
| 242 | + PageInfo<ChannelReduce> queryAllChannelList(int page, int count, String query, Boolean online, Boolean channelType, String platformId, String catalogId); | ||
| 243 | + | ||
| 244 | + /** | ||
| 245 | + * 查询设备的通道信息 | ||
| 246 | + */ | ||
| 247 | + List<DeviceChannelInPlatform> queryChannelListInParentPlatform(String platformId); | ||
| 248 | + | ||
| 249 | + | ||
| 250 | + /** | ||
| 251 | + * 更新上级平台的通道信息 | ||
| 252 | + * @param platformId | ||
| 253 | + * @param channelReduces | ||
| 254 | + * @return | ||
| 255 | + */ | ||
| 256 | + int updateChannelForGB(String platformId, List<ChannelReduce> channelReduces, String catalogId); | ||
| 257 | + | ||
| 258 | + /** | ||
| 259 | + * 移除上级平台的通道信息 | ||
| 260 | + * @param platformId | ||
| 261 | + * @param channelReduces | ||
| 262 | + * @return | ||
| 263 | + */ | ||
| 264 | + int delChannelForGB(String platformId, List<ChannelReduce> channelReduces); | ||
| 265 | + | ||
| 266 | + | ||
| 267 | + DeviceChannel queryChannelInParentPlatform(String platformId, String channelId); | ||
| 268 | + | ||
| 269 | + List<PlatformCatalog> queryChannelInParentPlatformAndCatalog(String platformId, String catalogId); | ||
| 270 | + List<PlatformCatalog> queryStreamInParentPlatformAndCatalog(String platformId, String catalogId); | ||
| 271 | + | ||
| 272 | + Device queryVideoDeviceByPlatformIdAndChannelId(String platformId, String channelId); | ||
| 273 | + | ||
| 274 | + | ||
| 275 | + /** | ||
| 276 | + * 添加Mobile Position设备移动位置 | ||
| 277 | + * @param mobilePosition | ||
| 278 | + * @return | ||
| 279 | + */ | ||
| 280 | + public boolean insertMobilePosition(MobilePosition mobilePosition); | ||
| 281 | + | ||
| 282 | + /** | ||
| 283 | + * 查询移动位置轨迹 | ||
| 284 | + * @param deviceId | ||
| 285 | + * @param startTime | ||
| 286 | + * @param endTime | ||
| 287 | + */ | ||
| 288 | + public List<MobilePosition> queryMobilePositions(String deviceId, String startTime, String endTime); | ||
| 289 | + | ||
| 290 | + /** | ||
| 291 | + * 查询最新移动位置 | ||
| 292 | + * @param deviceId | ||
| 293 | + */ | ||
| 294 | + public MobilePosition queryLatestPosition(String deviceId); | ||
| 295 | + | ||
| 296 | + /** | ||
| 297 | + * 删除指定设备的所有移动位置 | ||
| 298 | + * @param deviceId | ||
| 299 | + */ | ||
| 300 | + public int clearMobilePositionsByDeviceId(String deviceId); | ||
| 301 | + | ||
| 302 | + /** | ||
| 303 | + * 新增代理流 | ||
| 304 | + * @param streamProxyDto | ||
| 305 | + * @return | ||
| 306 | + */ | ||
| 307 | + public boolean addStreamProxy(StreamProxyItem streamProxyDto); | ||
| 308 | + | ||
| 309 | + /** | ||
| 310 | + * 更新代理流 | ||
| 311 | + * @param streamProxyDto | ||
| 312 | + * @return | ||
| 313 | + */ | ||
| 314 | + public boolean updateStreamProxy(StreamProxyItem streamProxyDto); | ||
| 315 | + | ||
| 316 | + /** | ||
| 317 | + * 移除代理流 | ||
| 318 | + * @param app | ||
| 319 | + * @param stream | ||
| 320 | + * @return | ||
| 321 | + */ | ||
| 322 | + public int deleteStreamProxy(String app, String stream); | ||
| 323 | + | ||
| 324 | + /** | ||
| 325 | + * 按照是否启用获取代理流 | ||
| 326 | + * @param enable | ||
| 327 | + * @return | ||
| 328 | + */ | ||
| 329 | + public List<StreamProxyItem> getStreamProxyListForEnable(boolean enable); | ||
| 330 | + | ||
| 331 | + /** | ||
| 332 | + * 按照是app和stream获取代理流 | ||
| 333 | + * @param app | ||
| 334 | + * @param stream | ||
| 335 | + * @return | ||
| 336 | + */ | ||
| 337 | + public StreamProxyItem queryStreamProxy(String app, String stream); | ||
| 338 | + | ||
| 339 | + /** | ||
| 340 | + * 获取代理流 | ||
| 341 | + * @param page | ||
| 342 | + * @param count | ||
| 343 | + * @return | ||
| 344 | + */ | ||
| 345 | + PageInfo<StreamProxyItem> queryStreamProxyList(Integer page, Integer count); | ||
| 346 | + | ||
| 347 | + /** | ||
| 348 | + * 根据国标ID获取平台关联的直播流 | ||
| 349 | + * @param platformId | ||
| 350 | + * @param channelId | ||
| 351 | + * @return | ||
| 352 | + */ | ||
| 353 | + GbStream queryStreamInParentPlatform(String platformId, String channelId); | ||
| 354 | + | ||
| 355 | + /** | ||
| 356 | + * 获取平台关联的直播流 | ||
| 357 | + * @param platformId | ||
| 358 | + * @return | ||
| 359 | + */ | ||
| 360 | + List<GbStream> queryGbStreamListInPlatform(String platformId); | ||
| 361 | + | ||
| 362 | + /** | ||
| 363 | + * 批量更新推流列表 | ||
| 364 | + * @param streamPushItems | ||
| 365 | + */ | ||
| 366 | + void updateMediaList(List<StreamPushItem> streamPushItems); | ||
| 367 | + | ||
| 368 | + /** | ||
| 369 | + * 更新单个推流 | ||
| 370 | + * @param streamPushItem | ||
| 371 | + */ | ||
| 372 | + void updateMedia(StreamPushItem streamPushItem); | ||
| 373 | + | ||
| 374 | + /** | ||
| 375 | + * 移除单个推流 | ||
| 376 | + * @param app | ||
| 377 | + * @param stream | ||
| 378 | + */ | ||
| 379 | + int removeMedia(String app, String stream); | ||
| 380 | + | ||
| 381 | + | ||
| 382 | + /** | ||
| 383 | + * 清空推流列表 | ||
| 384 | + */ | ||
| 385 | + void clearMediaList(); | ||
| 386 | + | ||
| 387 | + /** | ||
| 388 | + * 设置流离线 | ||
| 389 | + * @param app | ||
| 390 | + * @param streamId | ||
| 391 | + */ | ||
| 392 | + int mediaOutline(String app, String streamId); | ||
| 393 | + | ||
| 394 | + /** | ||
| 395 | + * 设置平台在线/离线 | ||
| 396 | + * @param online | ||
| 397 | + */ | ||
| 398 | + void updateParentPlatformStatus(String platformGbID, boolean online); | ||
| 399 | + | ||
| 400 | + /** | ||
| 401 | + * 根据媒体ID获取启用/不启用的代理列表 | ||
| 402 | + * @param id 媒体ID | ||
| 403 | + * @param enable 启用/不启用 | ||
| 404 | + * @param status 状态 | ||
| 405 | + * @return | ||
| 406 | + */ | ||
| 407 | + List<StreamProxyItem> getStreamProxyListForEnableInMediaServer(String id, boolean enable, boolean status); | ||
| 408 | + | ||
| 409 | + /** | ||
| 410 | + * 根据通道ID获取其所在设备 | ||
| 411 | + * @param channelId 通道ID | ||
| 412 | + * @return | ||
| 413 | + */ | ||
| 414 | + Device queryVideoDeviceByChannelId(String channelId); | ||
| 415 | + | ||
| 416 | + /** | ||
| 417 | + * 通道上线 | ||
| 418 | + * @param channelId 通道ID | ||
| 419 | + */ | ||
| 420 | + void deviceChannelOnline(String deviceId, String channelId); | ||
| 421 | + | ||
| 422 | + /** | ||
| 423 | + * 通道离线 | ||
| 424 | + * @param channelId 通道ID | ||
| 425 | + */ | ||
| 426 | + void deviceChannelOffline(String deviceId, String channelId); | ||
| 427 | + | ||
| 428 | + /** | ||
| 429 | + * 通过app与stream获取StreamProxy | ||
| 430 | + * @param app | ||
| 431 | + * @param streamId | ||
| 432 | + * @return | ||
| 433 | + */ | ||
| 434 | + StreamProxyItem getStreamProxyByAppAndStream(String app, String streamId); | ||
| 435 | + | ||
| 436 | + /** | ||
| 437 | + * catlog查询结束后完全重写通道信息 | ||
| 438 | + * @param deviceId | ||
| 439 | + * @param deviceChannelList | ||
| 440 | + */ | ||
| 441 | + boolean resetChannels(String deviceId, List<DeviceChannel> deviceChannelList); | ||
| 442 | + | ||
| 443 | + /** | ||
| 444 | + * 获取目录信息 | ||
| 445 | + * @param platformId | ||
| 446 | + * @param parentId | ||
| 447 | + * @return | ||
| 448 | + */ | ||
| 449 | + List<PlatformCatalog> getChildrenCatalogByPlatform(String platformId, String parentId); | ||
| 450 | + | ||
| 451 | + int addCatalog(PlatformCatalog platformCatalog); | ||
| 452 | + | ||
| 453 | + PlatformCatalog getCatalog(String id); | ||
| 454 | + | ||
| 455 | + int delCatalog(String id); | ||
| 456 | + | ||
| 457 | + int updateCatalog(PlatformCatalog platformCatalog); | ||
| 458 | + | ||
| 459 | + int setDefaultCatalog(String platformId, String catalogId); | ||
| 460 | + | ||
| 461 | + List<PlatformCatalog> queryCatalogInPlatform(String serverGBId); | ||
| 462 | + | ||
| 463 | + int delRelation(PlatformCatalog platformCatalog); | ||
| 464 | + | ||
| 465 | + int updateStreamGPS(List<GPSMsgInfo> gpsMsgInfo); | ||
| 466 | + | ||
| 467 | + List<ParentPlatform> queryPlatFormListForGBWithGBId(String channelId, List<String> platforms); | ||
| 468 | + | ||
| 469 | + List<ParentPlatform> queryPlatFormListForStreamWithGBId(String app, String stream, List<String> platforms); | ||
| 470 | + | ||
| 471 | + GbStream getGbStream(String app, String streamId); | ||
| 472 | + | ||
| 473 | + void delCatalogByPlatformId(String serverGBId); | ||
| 474 | + | ||
| 475 | + void delRelationByPlatformId(String serverGBId); | ||
| 476 | + | ||
| 477 | + PlatformCatalog queryDefaultCatalogInPlatform(String platformId); | ||
| 478 | + | ||
| 479 | + List<ChannelSourceInfo> getChannelSource(String platformId, String gbId); | ||
| 480 | + | ||
| 481 | + void updateChannelPotion(String deviceId, String channelId, double longitude, double latitude); | ||
| 482 | +} |
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java
| @@ -106,7 +106,7 @@ public interface DeviceChannelMapper { | @@ -106,7 +106,7 @@ public interface DeviceChannelMapper { | ||
| 106 | " <if test='online == true' > AND dc.status=1</if> " + | 106 | " <if test='online == true' > AND dc.status=1</if> " + |
| 107 | " <if test='online == false' > AND dc.status=0</if> " + | 107 | " <if test='online == false' > AND dc.status=0</if> " + |
| 108 | " <if test='hasSubChannel!= null and hasSubChannel == true' > AND dc.subCount > 0</if> " + | 108 | " <if test='hasSubChannel!= null and hasSubChannel == true' > AND dc.subCount > 0</if> " + |
| 109 | - " <if test='hasSubChannel!= null and hasSubChannel == false' > AND dc.subCount == 0</if> " + | 109 | + " <if test='hasSubChannel!= null and hasSubChannel == false' > AND dc.subCount = 0</if> " + |
| 110 | " <if test='catalogId == null ' > AND dc.id not in (select deviceChannelId from platform_gb_channel where platformId=#{platformId} ) </if> " + | 110 | " <if test='catalogId == null ' > AND dc.id not in (select deviceChannelId from platform_gb_channel where platformId=#{platformId} ) </if> " + |
| 111 | " <if test='catalogId != null ' > AND pgc.platformId = #{platformId} and pgc.catalogId=#{catalogId} </if> " + | 111 | " <if test='catalogId != null ' > AND pgc.platformId = #{platformId} and pgc.catalogId=#{catalogId} </if> " + |
| 112 | " ORDER BY dc.deviceId, dc.channelId ASC" + | 112 | " ORDER BY dc.deviceId, dc.channelId ASC" + |
| @@ -270,4 +270,7 @@ public interface DeviceChannelMapper { | @@ -270,4 +270,7 @@ public interface DeviceChannelMapper { | ||
| 270 | " where deviceId = #{deviceId} " + | 270 | " where deviceId = #{deviceId} " + |
| 271 | " and channelId = #{channelId}") | 271 | " and channelId = #{channelId}") |
| 272 | int updateChannelSubCount(String deviceId, String channelId); | 272 | int updateChannelSubCount(String deviceId, String channelId); |
| 273 | + | ||
| 274 | + @Update(value = {"UPDATE device_channel SET latitude=${latitude}, longitude=${longitude} WHERE deviceId=#{deviceId} AND channelId=#{channelId}"}) | ||
| 275 | + void updatePotion(String deviceId, String channelId, double longitude, double latitude); | ||
| 273 | } | 276 | } |
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java
| @@ -34,6 +34,9 @@ public interface DeviceMapper { | @@ -34,6 +34,9 @@ public interface DeviceMapper { | ||
| 34 | "updateTime," + | 34 | "updateTime," + |
| 35 | "charset," + | 35 | "charset," + |
| 36 | "subscribeCycleForCatalog," + | 36 | "subscribeCycleForCatalog," + |
| 37 | + "subscribeCycleForMobilePosition," + | ||
| 38 | + "mobilePositionSubmissionInterval," + | ||
| 39 | + "subscribeCycleForAlarm," + | ||
| 37 | "online" + | 40 | "online" + |
| 38 | ") VALUES (" + | 41 | ") VALUES (" + |
| 39 | "#{deviceId}," + | 42 | "#{deviceId}," + |
| @@ -53,6 +56,9 @@ public interface DeviceMapper { | @@ -53,6 +56,9 @@ public interface DeviceMapper { | ||
| 53 | "#{updateTime}," + | 56 | "#{updateTime}," + |
| 54 | "#{charset}," + | 57 | "#{charset}," + |
| 55 | "#{subscribeCycleForCatalog}," + | 58 | "#{subscribeCycleForCatalog}," + |
| 59 | + "#{subscribeCycleForMobilePosition}," + | ||
| 60 | + "#{mobilePositionSubmissionInterval}," + | ||
| 61 | + "#{subscribeCycleForAlarm}," + | ||
| 56 | "#{online}" + | 62 | "#{online}" + |
| 57 | ")") | 63 | ")") |
| 58 | int add(Device device); | 64 | int add(Device device); |
| @@ -75,6 +81,9 @@ public interface DeviceMapper { | @@ -75,6 +81,9 @@ public interface DeviceMapper { | ||
| 75 | "<if test=\"expires != null\">, expires=${expires}</if>" + | 81 | "<if test=\"expires != null\">, expires=${expires}</if>" + |
| 76 | "<if test=\"charset != null\">, charset='${charset}'</if>" + | 82 | "<if test=\"charset != null\">, charset='${charset}'</if>" + |
| 77 | "<if test=\"subscribeCycleForCatalog != null\">, subscribeCycleForCatalog=${subscribeCycleForCatalog}</if>" + | 83 | "<if test=\"subscribeCycleForCatalog != null\">, subscribeCycleForCatalog=${subscribeCycleForCatalog}</if>" + |
| 84 | + "<if test=\"subscribeCycleForMobilePosition != null\">, subscribeCycleForMobilePosition=${subscribeCycleForMobilePosition}</if>" + | ||
| 85 | + "<if test=\"mobilePositionSubmissionInterval != null\">, mobilePositionSubmissionInterval=${mobilePositionSubmissionInterval}</if>" + | ||
| 86 | + "<if test=\"subscribeCycleForAlarm != null\">, subscribeCycleForAlarm=${subscribeCycleForAlarm}</if>" + | ||
| 78 | "WHERE deviceId='${deviceId}'"+ | 87 | "WHERE deviceId='${deviceId}'"+ |
| 79 | " </script>"}) | 88 | " </script>"}) |
| 80 | int update(Device device); | 89 | int update(Device device); |
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
| 1 | package com.genersoft.iot.vmp.storager.impl; | 1 | package com.genersoft.iot.vmp.storager.impl; |
| 2 | 2 | ||
| 3 | +import com.alibaba.fastjson.JSON; | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 4 | import com.alibaba.fastjson.JSONObject; |
| 4 | import com.genersoft.iot.vmp.common.StreamInfo; | 5 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 5 | import com.genersoft.iot.vmp.common.SystemInfoDto; | 6 | import com.genersoft.iot.vmp.common.SystemInfoDto; |
| 6 | import com.genersoft.iot.vmp.common.VideoManagerConstants; | 7 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 7 | -import com.genersoft.iot.vmp.conf.UserSetup; | 8 | +import com.genersoft.iot.vmp.conf.UserSetting; |
| 8 | import com.genersoft.iot.vmp.gb28181.bean.*; | 9 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 9 | import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; | 10 | import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; |
| 10 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | 11 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 11 | -import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; | ||
| 12 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; | 12 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| 13 | -import com.genersoft.iot.vmp.service.bean.SSRCInfo; | 13 | +import com.genersoft.iot.vmp.service.bean.MessageForPushChannel; |
| 14 | import com.genersoft.iot.vmp.service.bean.ThirdPartyGB; | 14 | import com.genersoft.iot.vmp.service.bean.ThirdPartyGB; |
| 15 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 15 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 16 | import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper; | 16 | import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper; |
| @@ -18,9 +18,7 @@ import com.genersoft.iot.vmp.utils.redis.RedisUtil; | @@ -18,9 +18,7 @@ import com.genersoft.iot.vmp.utils.redis.RedisUtil; | ||
| 18 | import org.slf4j.Logger; | 18 | import org.slf4j.Logger; |
| 19 | import org.slf4j.LoggerFactory; | 19 | import org.slf4j.LoggerFactory; |
| 20 | import org.springframework.beans.factory.annotation.Autowired; | 20 | import org.springframework.beans.factory.annotation.Autowired; |
| 21 | -import org.springframework.security.core.parameters.P; | ||
| 22 | import org.springframework.stereotype.Component; | 21 | import org.springframework.stereotype.Component; |
| 23 | -import org.springframework.util.StringUtils; | ||
| 24 | 22 | ||
| 25 | import java.text.SimpleDateFormat; | 23 | import java.text.SimpleDateFormat; |
| 26 | import java.util.*; | 24 | import java.util.*; |
| @@ -29,7 +27,7 @@ import java.util.*; | @@ -29,7 +27,7 @@ import java.util.*; | ||
| 29 | @Component | 27 | @Component |
| 30 | public class RedisCatchStorageImpl implements IRedisCatchStorage { | 28 | public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 31 | 29 | ||
| 32 | - private Logger logger = LoggerFactory.getLogger(RedisCatchStorageImpl.class); | 30 | + private final Logger logger = LoggerFactory.getLogger(RedisCatchStorageImpl.class); |
| 33 | 31 | ||
| 34 | @Autowired | 32 | @Autowired |
| 35 | private RedisUtil redis; | 33 | private RedisUtil redis; |
| @@ -38,13 +36,13 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -38,13 +36,13 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 38 | private DeviceChannelMapper deviceChannelMapper; | 36 | private DeviceChannelMapper deviceChannelMapper; |
| 39 | 37 | ||
| 40 | @Autowired | 38 | @Autowired |
| 41 | - private UserSetup userSetup; | 39 | + private UserSetting userSetting; |
| 42 | 40 | ||
| 43 | - private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | 41 | + private final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| 44 | 42 | ||
| 45 | @Override | 43 | @Override |
| 46 | public Long getCSEQ(String method) { | 44 | public Long getCSEQ(String method) { |
| 47 | - String key = VideoManagerConstants.SIP_CSEQ_PREFIX + userSetup.getServerId() + "_" + method; | 45 | + String key = VideoManagerConstants.SIP_CSEQ_PREFIX + userSetting.getServerId() + "_" + method; |
| 48 | 46 | ||
| 49 | long result = redis.incr(key, 1L); | 47 | long result = redis.incr(key, 1L); |
| 50 | if (result > Integer.MAX_VALUE) { | 48 | if (result > Integer.MAX_VALUE) { |
| @@ -56,7 +54,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -56,7 +54,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 56 | 54 | ||
| 57 | @Override | 55 | @Override |
| 58 | public Long getSN(String method) { | 56 | public Long getSN(String method) { |
| 59 | - String key = VideoManagerConstants.SIP_SN_PREFIX + userSetup.getServerId() + "_" + method; | 57 | + String key = VideoManagerConstants.SIP_SN_PREFIX + userSetting.getServerId() + "_" + method; |
| 60 | 58 | ||
| 61 | long result = redis.incr(key, 1L); | 59 | long result = redis.incr(key, 1L); |
| 62 | if (result > Integer.MAX_VALUE) { | 60 | if (result > Integer.MAX_VALUE) { |
| @@ -68,20 +66,20 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -68,20 +66,20 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 68 | 66 | ||
| 69 | @Override | 67 | @Override |
| 70 | public void resetAllCSEQ() { | 68 | public void resetAllCSEQ() { |
| 71 | - String scanKey = VideoManagerConstants.SIP_CSEQ_PREFIX + userSetup.getServerId() + "_*"; | 69 | + String scanKey = VideoManagerConstants.SIP_CSEQ_PREFIX + userSetting.getServerId() + "_*"; |
| 72 | List<Object> keys = redis.scan(scanKey); | 70 | List<Object> keys = redis.scan(scanKey); |
| 73 | - for (int i = 0; i < keys.size(); i++) { | ||
| 74 | - String key = (String) keys.get(i); | 71 | + for (Object o : keys) { |
| 72 | + String key = (String) o; | ||
| 75 | redis.set(key, 1); | 73 | redis.set(key, 1); |
| 76 | } | 74 | } |
| 77 | } | 75 | } |
| 78 | 76 | ||
| 79 | @Override | 77 | @Override |
| 80 | public void resetAllSN() { | 78 | public void resetAllSN() { |
| 81 | - String scanKey = VideoManagerConstants.SIP_SN_PREFIX + userSetup.getServerId() + "_*"; | 79 | + String scanKey = VideoManagerConstants.SIP_SN_PREFIX + userSetting.getServerId() + "_*"; |
| 82 | List<Object> keys = redis.scan(scanKey); | 80 | List<Object> keys = redis.scan(scanKey); |
| 83 | - for (int i = 0; i < keys.size(); i++) { | ||
| 84 | - String key = (String) keys.get(i); | 81 | + for (Object o : keys) { |
| 82 | + String key = (String) o; | ||
| 85 | redis.set(key, 1); | 83 | redis.set(key, 1); |
| 86 | } | 84 | } |
| 87 | } | 85 | } |
| @@ -93,7 +91,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -93,7 +91,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 93 | */ | 91 | */ |
| 94 | @Override | 92 | @Override |
| 95 | public boolean startPlay(StreamInfo stream) { | 93 | public boolean startPlay(StreamInfo stream) { |
| 96 | - return redis.set(String.format("%S_%S_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, userSetup.getServerId(), | 94 | + return redis.set(String.format("%S_%S_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), |
| 97 | stream.getStream(), stream.getDeviceID(), stream.getChannelId()), | 95 | stream.getStream(), stream.getDeviceID(), stream.getChannelId()), |
| 98 | stream); | 96 | stream); |
| 99 | } | 97 | } |
| @@ -107,7 +105,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -107,7 +105,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 107 | public boolean stopPlay(StreamInfo streamInfo) { | 105 | public boolean stopPlay(StreamInfo streamInfo) { |
| 108 | if (streamInfo == null) return false; | 106 | if (streamInfo == null) return false; |
| 109 | return redis.del(String.format("%S_%s_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, | 107 | return redis.del(String.format("%S_%s_%s_%s_%s", VideoManagerConstants.PLAYER_PREFIX, |
| 110 | - userSetup.getServerId(), | 108 | + userSetting.getServerId(), |
| 111 | streamInfo.getStream(), | 109 | streamInfo.getStream(), |
| 112 | streamInfo.getDeviceID(), | 110 | streamInfo.getDeviceID(), |
| 113 | streamInfo.getChannelId())); | 111 | streamInfo.getChannelId())); |
| @@ -121,14 +119,14 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -121,14 +119,14 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 121 | public StreamInfo queryPlay(StreamInfo streamInfo) { | 119 | public StreamInfo queryPlay(StreamInfo streamInfo) { |
| 122 | return (StreamInfo)redis.get(String.format("%S_%s_%s_%s_%s", | 120 | return (StreamInfo)redis.get(String.format("%S_%s_%s_%s_%s", |
| 123 | VideoManagerConstants.PLAYER_PREFIX, | 121 | VideoManagerConstants.PLAYER_PREFIX, |
| 124 | - userSetup.getServerId(), | 122 | + userSetting.getServerId(), |
| 125 | streamInfo.getStream(), | 123 | streamInfo.getStream(), |
| 126 | streamInfo.getDeviceID(), | 124 | streamInfo.getDeviceID(), |
| 127 | streamInfo.getChannelId())); | 125 | streamInfo.getChannelId())); |
| 128 | } | 126 | } |
| 129 | @Override | 127 | @Override |
| 130 | public StreamInfo queryPlayByStreamId(String streamId) { | 128 | public StreamInfo queryPlayByStreamId(String streamId) { |
| 131 | - List<Object> playLeys = redis.scan(String.format("%S_%s_%s_*", VideoManagerConstants.PLAYER_PREFIX, userSetup.getServerId(), streamId)); | 129 | + List<Object> playLeys = redis.scan(String.format("%S_%s_%s_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(), streamId)); |
| 132 | if (playLeys == null || playLeys.size() == 0) return null; | 130 | if (playLeys == null || playLeys.size() == 0) return null; |
| 133 | return (StreamInfo)redis.get(playLeys.get(0).toString()); | 131 | return (StreamInfo)redis.get(playLeys.get(0).toString()); |
| 134 | } | 132 | } |
| @@ -136,7 +134,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -136,7 +134,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 136 | @Override | 134 | @Override |
| 137 | public StreamInfo queryPlayByDevice(String deviceId, String channelId) { | 135 | public StreamInfo queryPlayByDevice(String deviceId, String channelId) { |
| 138 | List<Object> playLeys = redis.scan(String.format("%S_%s_*_%s_%s", VideoManagerConstants.PLAYER_PREFIX, | 136 | List<Object> playLeys = redis.scan(String.format("%S_%s_*_%s_%s", VideoManagerConstants.PLAYER_PREFIX, |
| 139 | - userSetup.getServerId(), | 137 | + userSetting.getServerId(), |
| 140 | deviceId, | 138 | deviceId, |
| 141 | channelId)); | 139 | channelId)); |
| 142 | if (playLeys == null || playLeys.size() == 0) return null; | 140 | if (playLeys == null || playLeys.size() == 0) return null; |
| @@ -147,11 +145,11 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -147,11 +145,11 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 147 | public Map<String, StreamInfo> queryPlayByDeviceId(String deviceId) { | 145 | public Map<String, StreamInfo> queryPlayByDeviceId(String deviceId) { |
| 148 | Map<String, StreamInfo> streamInfos = new HashMap<>(); | 146 | Map<String, StreamInfo> streamInfos = new HashMap<>(); |
| 149 | // List<Object> playLeys = redis.keys(String.format("%S_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, deviceId)); | 147 | // List<Object> playLeys = redis.keys(String.format("%S_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, deviceId)); |
| 150 | - List<Object> players = redis.scan(String.format("%S_%s_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, userSetup.getServerId(),deviceId)); | 148 | + List<Object> players = redis.scan(String.format("%S_%s_*_%S_*", VideoManagerConstants.PLAYER_PREFIX, userSetting.getServerId(),deviceId)); |
| 151 | if (players.size() == 0) return streamInfos; | 149 | if (players.size() == 0) return streamInfos; |
| 152 | - for (int i = 0; i < players.size(); i++) { | ||
| 153 | - String key = (String) players.get(i); | ||
| 154 | - StreamInfo streamInfo = (StreamInfo)redis.get(key); | 150 | + for (Object player : players) { |
| 151 | + String key = (String) player; | ||
| 152 | + StreamInfo streamInfo = (StreamInfo) redis.get(key); | ||
| 155 | streamInfos.put(streamInfo.getDeviceID() + "_" + streamInfo.getChannelId(), streamInfo); | 153 | streamInfos.put(streamInfo.getDeviceID() + "_" + streamInfo.getChannelId(), streamInfo); |
| 156 | } | 154 | } |
| 157 | return streamInfos; | 155 | return streamInfos; |
| @@ -161,7 +159,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -161,7 +159,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 161 | @Override | 159 | @Override |
| 162 | public boolean startPlayback(StreamInfo stream, String callId) { | 160 | public boolean startPlayback(StreamInfo stream, String callId) { |
| 163 | return redis.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, | 161 | return redis.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, |
| 164 | - userSetup.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream); | 162 | + userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream); |
| 165 | } | 163 | } |
| 166 | 164 | ||
| 167 | @Override | 165 | @Override |
| @@ -169,10 +167,10 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -169,10 +167,10 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 169 | boolean result; | 167 | boolean result; |
| 170 | if (stream.getProgress() == 1) { | 168 | if (stream.getProgress() == 1) { |
| 171 | result = redis.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, | 169 | result = redis.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, |
| 172 | - userSetup.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream); | 170 | + userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream); |
| 173 | }else { | 171 | }else { |
| 174 | result = redis.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, | 172 | result = redis.set(String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, |
| 175 | - userSetup.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream, 60*60); | 173 | + userSetting.getServerId(), stream.getDeviceID(), stream.getChannelId(), stream.getStream(), callId), stream, 60*60); |
| 176 | } | 174 | } |
| 177 | return result; | 175 | return result; |
| 178 | } | 176 | } |
| @@ -189,7 +187,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -189,7 +187,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 189 | if (stream == null) stream = "*"; | 187 | if (stream == null) stream = "*"; |
| 190 | if (callId == null) callId = "*"; | 188 | if (callId == null) callId = "*"; |
| 191 | String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, | 189 | String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, |
| 192 | - userSetup.getServerId(), | 190 | + userSetting.getServerId(), |
| 193 | deviceId, | 191 | deviceId, |
| 194 | channelId, | 192 | channelId, |
| 195 | stream, | 193 | stream, |
| @@ -217,7 +215,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -217,7 +215,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 217 | if (stream == null) stream = "*"; | 215 | if (stream == null) stream = "*"; |
| 218 | if (callId == null) callId = "*"; | 216 | if (callId == null) callId = "*"; |
| 219 | String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, | 217 | String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, |
| 220 | - userSetup.getServerId(), | 218 | + userSetting.getServerId(), |
| 221 | deviceId, | 219 | deviceId, |
| 222 | channelId, | 220 | channelId, |
| 223 | stream, | 221 | stream, |
| @@ -242,7 +240,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -242,7 +240,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 242 | if (stream == null) stream = "*"; | 240 | if (stream == null) stream = "*"; |
| 243 | if (callId == null) callId = "*"; | 241 | if (callId == null) callId = "*"; |
| 244 | String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, | 242 | String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, |
| 245 | - userSetup.getServerId(), | 243 | + userSetting.getServerId(), |
| 246 | deviceId, | 244 | deviceId, |
| 247 | channelId, | 245 | channelId, |
| 248 | stream, | 246 | stream, |
| @@ -258,63 +256,63 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -258,63 +256,63 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 258 | 256 | ||
| 259 | @Override | 257 | @Override |
| 260 | public void updatePlatformCatchInfo(ParentPlatformCatch parentPlatformCatch) { | 258 | public void updatePlatformCatchInfo(ParentPlatformCatch parentPlatformCatch) { |
| 261 | - String key = VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetup.getServerId() + "_" + parentPlatformCatch.getId(); | 259 | + String key = VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetting.getServerId() + "_" + parentPlatformCatch.getId(); |
| 262 | redis.set(key, parentPlatformCatch); | 260 | redis.set(key, parentPlatformCatch); |
| 263 | } | 261 | } |
| 264 | 262 | ||
| 265 | @Override | 263 | @Override |
| 266 | public void updatePlatformKeepalive(ParentPlatform parentPlatform) { | 264 | public void updatePlatformKeepalive(ParentPlatform parentPlatform) { |
| 267 | - String key = VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetup.getServerId() + "_" + parentPlatform.getServerGBId(); | 265 | + String key = VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetting.getServerId() + "_" + parentPlatform.getServerGBId(); |
| 268 | redis.set(key, "", Integer.parseInt(parentPlatform.getKeepTimeout())); | 266 | redis.set(key, "", Integer.parseInt(parentPlatform.getKeepTimeout())); |
| 269 | } | 267 | } |
| 270 | 268 | ||
| 271 | @Override | 269 | @Override |
| 272 | public void updatePlatformRegister(ParentPlatform parentPlatform) { | 270 | public void updatePlatformRegister(ParentPlatform parentPlatform) { |
| 273 | - String key = VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetup.getServerId() + "_" + parentPlatform.getServerGBId(); | 271 | + String key = VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetting.getServerId() + "_" + parentPlatform.getServerGBId(); |
| 274 | redis.set(key, "", Integer.parseInt(parentPlatform.getExpires())); | 272 | redis.set(key, "", Integer.parseInt(parentPlatform.getExpires())); |
| 275 | } | 273 | } |
| 276 | 274 | ||
| 277 | @Override | 275 | @Override |
| 278 | public ParentPlatformCatch queryPlatformCatchInfo(String platformGbId) { | 276 | public ParentPlatformCatch queryPlatformCatchInfo(String platformGbId) { |
| 279 | - return (ParentPlatformCatch)redis.get(VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetup.getServerId() + "_" + platformGbId); | 277 | + return (ParentPlatformCatch)redis.get(VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetting.getServerId() + "_" + platformGbId); |
| 280 | } | 278 | } |
| 281 | 279 | ||
| 282 | @Override | 280 | @Override |
| 283 | public void delPlatformCatchInfo(String platformGbId) { | 281 | public void delPlatformCatchInfo(String platformGbId) { |
| 284 | - redis.del(VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetup.getServerId() + "_" + platformGbId); | 282 | + redis.del(VideoManagerConstants.PLATFORM_CATCH_PREFIX + userSetting.getServerId() + "_" + platformGbId); |
| 285 | } | 283 | } |
| 286 | 284 | ||
| 287 | @Override | 285 | @Override |
| 288 | public void delPlatformKeepalive(String platformGbId) { | 286 | public void delPlatformKeepalive(String platformGbId) { |
| 289 | - redis.del(VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetup.getServerId() + "_" + platformGbId); | 287 | + redis.del(VideoManagerConstants.PLATFORM_KEEPALIVE_PREFIX + userSetting.getServerId() + "_" + platformGbId); |
| 290 | } | 288 | } |
| 291 | 289 | ||
| 292 | @Override | 290 | @Override |
| 293 | public void delPlatformRegister(String platformGbId) { | 291 | public void delPlatformRegister(String platformGbId) { |
| 294 | - redis.del(VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetup.getServerId() + "_" + platformGbId); | 292 | + redis.del(VideoManagerConstants.PLATFORM_REGISTER_PREFIX + userSetting.getServerId() + "_" + platformGbId); |
| 295 | } | 293 | } |
| 296 | 294 | ||
| 297 | 295 | ||
| 298 | @Override | 296 | @Override |
| 299 | public void updatePlatformRegisterInfo(String callId, String platformGbId) { | 297 | public void updatePlatformRegisterInfo(String callId, String platformGbId) { |
| 300 | - String key = VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetup.getServerId() + "_" + callId; | 298 | + String key = VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + callId; |
| 301 | redis.set(key, platformGbId, 30); | 299 | redis.set(key, platformGbId, 30); |
| 302 | } | 300 | } |
| 303 | 301 | ||
| 304 | 302 | ||
| 305 | @Override | 303 | @Override |
| 306 | public String queryPlatformRegisterInfo(String callId) { | 304 | public String queryPlatformRegisterInfo(String callId) { |
| 307 | - return (String)redis.get(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetup.getServerId() + "_" + callId); | 305 | + return (String)redis.get(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + callId); |
| 308 | } | 306 | } |
| 309 | 307 | ||
| 310 | @Override | 308 | @Override |
| 311 | public void delPlatformRegisterInfo(String callId) { | 309 | public void delPlatformRegisterInfo(String callId) { |
| 312 | - redis.del(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetup.getServerId() + "_" + callId); | 310 | + redis.del(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + callId); |
| 313 | } | 311 | } |
| 314 | 312 | ||
| 315 | @Override | 313 | @Override |
| 316 | public void cleanPlatformRegisterInfos() { | 314 | public void cleanPlatformRegisterInfos() { |
| 317 | - List regInfos = redis.scan(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetup.getServerId() + "_" + "*"); | 315 | + List regInfos = redis.scan(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + userSetting.getServerId() + "_" + "*"); |
| 318 | for (Object key : regInfos) { | 316 | for (Object key : regInfos) { |
| 319 | redis.del(key.toString()); | 317 | redis.del(key.toString()); |
| 320 | } | 318 | } |
| @@ -322,7 +320,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -322,7 +320,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 322 | 320 | ||
| 323 | @Override | 321 | @Override |
| 324 | public void updateSendRTPSever(SendRtpItem sendRtpItem) { | 322 | public void updateSendRTPSever(SendRtpItem sendRtpItem) { |
| 325 | - String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetup.getServerId() + "_" | 323 | + String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" |
| 326 | + sendRtpItem.getPlatformId() + "_" + sendRtpItem.getChannelId() + "_" | 324 | + sendRtpItem.getPlatformId() + "_" + sendRtpItem.getChannelId() + "_" |
| 327 | + sendRtpItem.getStreamId() + "_" + sendRtpItem.getCallId(); | 325 | + sendRtpItem.getStreamId() + "_" + sendRtpItem.getCallId(); |
| 328 | redis.set(key, sendRtpItem); | 326 | redis.set(key, sendRtpItem); |
| @@ -334,7 +332,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -334,7 +332,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 334 | if (channelId == null) channelId = "*"; | 332 | if (channelId == null) channelId = "*"; |
| 335 | if (streamId == null) streamId = "*"; | 333 | if (streamId == null) streamId = "*"; |
| 336 | if (callId == null) callId = "*"; | 334 | if (callId == null) callId = "*"; |
| 337 | - String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetup.getServerId() + "_" + platformGbId | 335 | + String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId |
| 338 | + "_" + channelId + "_" + streamId + "_" + callId; | 336 | + "_" + channelId + "_" + streamId + "_" + callId; |
| 339 | List<Object> scan = redis.scan(key); | 337 | List<Object> scan = redis.scan(key); |
| 340 | if (scan.size() > 0) { | 338 | if (scan.size() > 0) { |
| @@ -347,13 +345,13 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -347,13 +345,13 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 347 | @Override | 345 | @Override |
| 348 | public List<SendRtpItem> querySendRTPServer(String platformGbId) { | 346 | public List<SendRtpItem> querySendRTPServer(String platformGbId) { |
| 349 | if (platformGbId == null) platformGbId = "*"; | 347 | if (platformGbId == null) platformGbId = "*"; |
| 350 | - String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetup.getServerId() + "_" + platformGbId + "_*" + "_*" + "_*"; | 348 | + String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId + "_*" + "_*" + "_*"; |
| 351 | List<Object> queryResult = redis.scan(key); | 349 | List<Object> queryResult = redis.scan(key); |
| 352 | List<SendRtpItem> result= new ArrayList<>(); | 350 | List<SendRtpItem> result= new ArrayList<>(); |
| 353 | 351 | ||
| 354 | - for (int i = 0; i < queryResult.size(); i++) { | ||
| 355 | - String keyItem = (String) queryResult.get(i); | ||
| 356 | - result.add((SendRtpItem)redis.get(keyItem)); | 352 | + for (Object o : queryResult) { |
| 353 | + String keyItem = (String) o; | ||
| 354 | + result.add((SendRtpItem) redis.get(keyItem)); | ||
| 357 | } | 355 | } |
| 358 | 356 | ||
| 359 | return result; | 357 | return result; |
| @@ -368,7 +366,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -368,7 +366,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 368 | public void deleteSendRTPServer(String platformGbId, String channelId, String callId, String streamId) { | 366 | public void deleteSendRTPServer(String platformGbId, String channelId, String callId, String streamId) { |
| 369 | if (streamId == null) streamId = "*"; | 367 | if (streamId == null) streamId = "*"; |
| 370 | if (callId == null) callId = "*"; | 368 | if (callId == null) callId = "*"; |
| 371 | - String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetup.getServerId() + "_" + platformGbId | 369 | + String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + platformGbId |
| 372 | + "_" + channelId + "_" + streamId + "_" + callId; | 370 | + "_" + channelId + "_" + streamId + "_" + callId; |
| 373 | List<Object> scan = redis.scan(key); | 371 | List<Object> scan = redis.scan(key); |
| 374 | if (scan.size() > 0) { | 372 | if (scan.size() > 0) { |
| @@ -386,7 +384,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -386,7 +384,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 386 | */ | 384 | */ |
| 387 | @Override | 385 | @Override |
| 388 | public boolean isChannelSendingRTP(String channelId) { | 386 | public boolean isChannelSendingRTP(String channelId) { |
| 389 | - String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetup.getServerId() + "_" + "*_" + channelId + "*_" + "*_"; | 387 | + String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + userSetting.getServerId() + "_" + "*_" + channelId + "*_" + "*_"; |
| 390 | List<Object> RtpStreams = redis.scan(key); | 388 | List<Object> RtpStreams = redis.scan(key); |
| 391 | if (RtpStreams.size() > 0) { | 389 | if (RtpStreams.size() > 0) { |
| 392 | return true; | 390 | return true; |
| @@ -398,7 +396,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -398,7 +396,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 398 | @Override | 396 | @Override |
| 399 | public void clearCatchByDeviceId(String deviceId) { | 397 | public void clearCatchByDeviceId(String deviceId) { |
| 400 | List<Object> playLeys = redis.scan(String.format("%S_%s_*_%s_*", VideoManagerConstants.PLAYER_PREFIX, | 398 | List<Object> playLeys = redis.scan(String.format("%S_%s_*_%s_*", VideoManagerConstants.PLAYER_PREFIX, |
| 401 | - userSetup.getServerId(), | 399 | + userSetting.getServerId(), |
| 402 | deviceId)); | 400 | deviceId)); |
| 403 | if (playLeys.size() > 0) { | 401 | if (playLeys.size() > 0) { |
| 404 | for (Object key : playLeys) { | 402 | for (Object key : playLeys) { |
| @@ -407,7 +405,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -407,7 +405,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 407 | } | 405 | } |
| 408 | 406 | ||
| 409 | List<Object> playBackers = redis.scan(String.format("%S_%s_%s_*_*_*", VideoManagerConstants.PLAY_BLACK_PREFIX, | 407 | List<Object> playBackers = redis.scan(String.format("%S_%s_%s_*_*_*", VideoManagerConstants.PLAY_BLACK_PREFIX, |
| 410 | - userSetup.getServerId(), | 408 | + userSetting.getServerId(), |
| 411 | deviceId)); | 409 | deviceId)); |
| 412 | if (playBackers.size() > 0) { | 410 | if (playBackers.size() > 0) { |
| 413 | for (Object key : playBackers) { | 411 | for (Object key : playBackers) { |
| @@ -416,7 +414,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -416,7 +414,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 416 | } | 414 | } |
| 417 | 415 | ||
| 418 | List<Object> deviceCache = redis.scan(String.format("%S%s_%s", VideoManagerConstants.DEVICE_PREFIX, | 416 | List<Object> deviceCache = redis.scan(String.format("%S%s_%s", VideoManagerConstants.DEVICE_PREFIX, |
| 419 | - userSetup.getServerId(), | 417 | + userSetting.getServerId(), |
| 420 | deviceId)); | 418 | deviceId)); |
| 421 | if (deviceCache.size() > 0) { | 419 | if (deviceCache.size() > 0) { |
| 422 | for (Object key : deviceCache) { | 420 | for (Object key : deviceCache) { |
| @@ -427,7 +425,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -427,7 +425,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 427 | 425 | ||
| 428 | @Override | 426 | @Override |
| 429 | public void outlineForAll() { | 427 | public void outlineForAll() { |
| 430 | - List<Object> onlineDevices = redis.scan(VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetup.getServerId() + "_" + "*" ); | 428 | + List<Object> onlineDevices = redis.scan(VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetting.getServerId() + "_" + "*" ); |
| 431 | for (int i = 0; i < onlineDevices.size(); i++) { | 429 | for (int i = 0; i < onlineDevices.size(); i++) { |
| 432 | String key = (String) onlineDevices.get(i); | 430 | String key = (String) onlineDevices.get(i); |
| 433 | redis.del(key); | 431 | redis.del(key); |
| @@ -437,7 +435,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -437,7 +435,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 437 | @Override | 435 | @Override |
| 438 | public List<String> getOnlineForAll() { | 436 | public List<String> getOnlineForAll() { |
| 439 | List<String> result = new ArrayList<>(); | 437 | List<String> result = new ArrayList<>(); |
| 440 | - List<Object> onlineDevices = redis.scan(VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetup.getServerId() + "_" + "*" ); | 438 | + List<Object> onlineDevices = redis.scan(VideoManagerConstants.KEEPLIVEKEY_PREFIX + userSetting.getServerId() + "_" + "*" ); |
| 441 | for (int i = 0; i < onlineDevices.size(); i++) { | 439 | for (int i = 0; i < onlineDevices.size(); i++) { |
| 442 | String key = (String) onlineDevices.get(i); | 440 | String key = (String) onlineDevices.get(i); |
| 443 | result.add((String) redis.get(key)); | 441 | result.add((String) redis.get(key)); |
| @@ -447,7 +445,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -447,7 +445,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 447 | 445 | ||
| 448 | @Override | 446 | @Override |
| 449 | public void updateWVPInfo(JSONObject jsonObject, int time) { | 447 | public void updateWVPInfo(JSONObject jsonObject, int time) { |
| 450 | - String key = VideoManagerConstants.WVP_SERVER_PREFIX + userSetup.getServerId(); | 448 | + String key = VideoManagerConstants.WVP_SERVER_PREFIX + userSetting.getServerId(); |
| 451 | redis.set(key, jsonObject, time); | 449 | redis.set(key, jsonObject, time); |
| 452 | } | 450 | } |
| 453 | 451 | ||
| @@ -460,13 +458,13 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -460,13 +458,13 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 460 | 458 | ||
| 461 | @Override | 459 | @Override |
| 462 | public void addStream(MediaServerItem mediaServerItem, String type, String app, String streamId, MediaItem mediaItem) { | 460 | public void addStream(MediaServerItem mediaServerItem, String type, String app, String streamId, MediaItem mediaItem) { |
| 463 | - String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetup.getServerId() + "_" + type + "_" + app + "_" + streamId + "_" + mediaServerItem.getId(); | 461 | + String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_" + type + "_" + app + "_" + streamId + "_" + mediaServerItem.getId(); |
| 464 | redis.set(key, mediaItem); | 462 | redis.set(key, mediaItem); |
| 465 | } | 463 | } |
| 466 | 464 | ||
| 467 | @Override | 465 | @Override |
| 468 | public void removeStream(String mediaServerId, String type, String app, String streamId) { | 466 | public void removeStream(String mediaServerId, String type, String app, String streamId) { |
| 469 | - String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetup.getServerId() + "_" + type + "_" + app + "_" + streamId + "_" + mediaServerId; | 467 | + String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_" + type + "_" + app + "_" + streamId + "_" + mediaServerId; |
| 470 | redis.del(key); | 468 | redis.del(key); |
| 471 | } | 469 | } |
| 472 | 470 | ||
| @@ -480,7 +478,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -480,7 +478,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 480 | if (stream == null) stream = "*"; | 478 | if (stream == null) stream = "*"; |
| 481 | if (callId == null) callId = "*"; | 479 | if (callId == null) callId = "*"; |
| 482 | String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, | 480 | String key = String.format("%S_%s_%s_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, |
| 483 | - userSetup.getServerId(), | 481 | + userSetting.getServerId(), |
| 484 | deviceId, | 482 | deviceId, |
| 485 | channelId, | 483 | channelId, |
| 486 | stream, | 484 | stream, |
| @@ -503,7 +501,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -503,7 +501,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 503 | 501 | ||
| 504 | @Override | 502 | @Override |
| 505 | public void removeStream(String mediaServerId, String type) { | 503 | public void removeStream(String mediaServerId, String type) { |
| 506 | - String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetup.getServerId() + "_" + type + "_*_*_" + mediaServerId; | 504 | + String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_" + type + "_*_*_" + mediaServerId; |
| 507 | List<Object> streams = redis.scan(key); | 505 | List<Object> streams = redis.scan(key); |
| 508 | for (Object stream : streams) { | 506 | for (Object stream : streams) { |
| 509 | redis.del((String) stream); | 507 | redis.del((String) stream); |
| @@ -513,7 +511,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -513,7 +511,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 513 | @Override | 511 | @Override |
| 514 | public List<MediaItem> getStreams(String mediaServerId, String type) { | 512 | public List<MediaItem> getStreams(String mediaServerId, String type) { |
| 515 | List<MediaItem> result = new ArrayList<>(); | 513 | List<MediaItem> result = new ArrayList<>(); |
| 516 | - String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetup.getServerId() + "_" + type + "_*_*_" + mediaServerId; | 514 | + String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_" + type + "_*_*_" + mediaServerId; |
| 517 | List<Object> streams = redis.scan(key); | 515 | List<Object> streams = redis.scan(key); |
| 518 | for (Object stream : streams) { | 516 | for (Object stream : streams) { |
| 519 | MediaItem mediaItem = (MediaItem)redis.get((String) stream); | 517 | MediaItem mediaItem = (MediaItem)redis.get((String) stream); |
| @@ -524,37 +522,37 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -524,37 +522,37 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 524 | 522 | ||
| 525 | @Override | 523 | @Override |
| 526 | public void updateDevice(Device device) { | 524 | public void updateDevice(Device device) { |
| 527 | - String key = VideoManagerConstants.DEVICE_PREFIX + userSetup.getServerId() + "_" + device.getDeviceId(); | 525 | + String key = VideoManagerConstants.DEVICE_PREFIX + userSetting.getServerId() + "_" + device.getDeviceId(); |
| 528 | redis.set(key, device); | 526 | redis.set(key, device); |
| 529 | } | 527 | } |
| 530 | 528 | ||
| 531 | @Override | 529 | @Override |
| 532 | public void removeDevice(String deviceId) { | 530 | public void removeDevice(String deviceId) { |
| 533 | - String key = VideoManagerConstants.DEVICE_PREFIX + userSetup.getServerId() + "_" + deviceId; | 531 | + String key = VideoManagerConstants.DEVICE_PREFIX + userSetting.getServerId() + "_" + deviceId; |
| 534 | redis.del(key); | 532 | redis.del(key); |
| 535 | } | 533 | } |
| 536 | 534 | ||
| 537 | @Override | 535 | @Override |
| 538 | public Device getDevice(String deviceId) { | 536 | public Device getDevice(String deviceId) { |
| 539 | - String key = VideoManagerConstants.DEVICE_PREFIX + userSetup.getServerId() + "_" + deviceId; | 537 | + String key = VideoManagerConstants.DEVICE_PREFIX + userSetting.getServerId() + "_" + deviceId; |
| 540 | return (Device)redis.get(key); | 538 | return (Device)redis.get(key); |
| 541 | } | 539 | } |
| 542 | 540 | ||
| 543 | @Override | 541 | @Override |
| 544 | public void updateGpsMsgInfo(GPSMsgInfo gpsMsgInfo) { | 542 | public void updateGpsMsgInfo(GPSMsgInfo gpsMsgInfo) { |
| 545 | - String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetup.getServerId() + "_" + gpsMsgInfo.getId(); | 543 | + String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_" + gpsMsgInfo.getId(); |
| 546 | redis.set(key, gpsMsgInfo, 60); // 默认GPS消息保存1分钟 | 544 | redis.set(key, gpsMsgInfo, 60); // 默认GPS消息保存1分钟 |
| 547 | } | 545 | } |
| 548 | 546 | ||
| 549 | @Override | 547 | @Override |
| 550 | public GPSMsgInfo getGpsMsgInfo(String gbId) { | 548 | public GPSMsgInfo getGpsMsgInfo(String gbId) { |
| 551 | - String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetup.getServerId() + "_" + gbId; | 549 | + String key = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_" + gbId; |
| 552 | return (GPSMsgInfo)redis.get(key); | 550 | return (GPSMsgInfo)redis.get(key); |
| 553 | } | 551 | } |
| 554 | 552 | ||
| 555 | @Override | 553 | @Override |
| 556 | public List<GPSMsgInfo> getAllGpsMsgInfo() { | 554 | public List<GPSMsgInfo> getAllGpsMsgInfo() { |
| 557 | - String scanKey = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetup.getServerId() + "_*"; | 555 | + String scanKey = VideoManagerConstants.WVP_STREAM_GPS_MSG_PREFIX + userSetting.getServerId() + "_*"; |
| 558 | List<GPSMsgInfo> result = new ArrayList<>(); | 556 | List<GPSMsgInfo> result = new ArrayList<>(); |
| 559 | List<Object> keys = redis.scan(scanKey); | 557 | List<Object> keys = redis.scan(scanKey); |
| 560 | for (int i = 0; i < keys.size(); i++) { | 558 | for (int i = 0; i < keys.size(); i++) { |
| @@ -570,7 +568,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -570,7 +568,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 570 | 568 | ||
| 571 | @Override | 569 | @Override |
| 572 | public MediaItem getStreamInfo(String app, String streamId, String mediaServerId) { | 570 | public MediaItem getStreamInfo(String app, String streamId, String mediaServerId) { |
| 573 | - String scanKey = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetup.getServerId() + "_*_" + app + "_" + streamId + "_" + mediaServerId; | 571 | + String scanKey = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_*_" + app + "_" + streamId + "_" + mediaServerId; |
| 574 | 572 | ||
| 575 | MediaItem result = null; | 573 | MediaItem result = null; |
| 576 | List<Object> keys = redis.scan(scanKey); | 574 | List<Object> keys = redis.scan(scanKey); |
| @@ -584,7 +582,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -584,7 +582,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 584 | 582 | ||
| 585 | @Override | 583 | @Override |
| 586 | public void addCpuInfo(double cpuInfo) { | 584 | public void addCpuInfo(double cpuInfo) { |
| 587 | - String key = VideoManagerConstants.SYSTEM_INFO_CPU_PREFIX + userSetup.getServerId(); | 585 | + String key = VideoManagerConstants.SYSTEM_INFO_CPU_PREFIX + userSetting.getServerId(); |
| 588 | SystemInfoDto<Double> systemInfoDto = new SystemInfoDto<>(); | 586 | SystemInfoDto<Double> systemInfoDto = new SystemInfoDto<>(); |
| 589 | systemInfoDto.setTime(format.format(System.currentTimeMillis())); | 587 | systemInfoDto.setTime(format.format(System.currentTimeMillis())); |
| 590 | systemInfoDto.setData(cpuInfo); | 588 | systemInfoDto.setData(cpuInfo); |
| @@ -599,7 +597,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -599,7 +597,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 599 | 597 | ||
| 600 | @Override | 598 | @Override |
| 601 | public void addMemInfo(double memInfo) { | 599 | public void addMemInfo(double memInfo) { |
| 602 | - String key = VideoManagerConstants.SYSTEM_INFO_MEM_PREFIX + userSetup.getServerId(); | 600 | + String key = VideoManagerConstants.SYSTEM_INFO_MEM_PREFIX + userSetting.getServerId(); |
| 603 | SystemInfoDto<Double> systemInfoDto = new SystemInfoDto<>(); | 601 | SystemInfoDto<Double> systemInfoDto = new SystemInfoDto<>(); |
| 604 | systemInfoDto.setTime(format.format(System.currentTimeMillis())); | 602 | systemInfoDto.setTime(format.format(System.currentTimeMillis())); |
| 605 | systemInfoDto.setData(memInfo); | 603 | systemInfoDto.setData(memInfo); |
| @@ -614,7 +612,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -614,7 +612,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 614 | 612 | ||
| 615 | @Override | 613 | @Override |
| 616 | public void addNetInfo(Map<String, String> networkInterfaces) { | 614 | public void addNetInfo(Map<String, String> networkInterfaces) { |
| 617 | - String key = VideoManagerConstants.SYSTEM_INFO_NET_PREFIX + userSetup.getServerId(); | 615 | + String key = VideoManagerConstants.SYSTEM_INFO_NET_PREFIX + userSetting.getServerId(); |
| 618 | SystemInfoDto<Map<String, String>> systemInfoDto = new SystemInfoDto<>(); | 616 | SystemInfoDto<Map<String, String>> systemInfoDto = new SystemInfoDto<>(); |
| 619 | systemInfoDto.setTime(format.format(System.currentTimeMillis())); | 617 | systemInfoDto.setTime(format.format(System.currentTimeMillis())); |
| 620 | systemInfoDto.setData(networkInterfaces); | 618 | systemInfoDto.setData(networkInterfaces); |
| @@ -626,4 +624,18 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -626,4 +624,18 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 626 | } | 624 | } |
| 627 | } | 625 | } |
| 628 | } | 626 | } |
| 627 | + | ||
| 628 | + @Override | ||
| 629 | + public void sendMobilePositionMsg(JSONObject jsonObject) { | ||
| 630 | + String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_MOBILE_POSITION; | ||
| 631 | + logger.debug("[redis 移动位置订阅通知] {}: {}", key, jsonObject.toString()); | ||
| 632 | + redis.convertAndSend(key, jsonObject); | ||
| 633 | + } | ||
| 634 | + | ||
| 635 | + @Override | ||
| 636 | + public void sendStreamPushRequestedMsg(MessageForPushChannel msg) { | ||
| 637 | + String key = VideoManagerConstants.VM_MSG_STREAM_PUSH_REQUESTED; | ||
| 638 | + logger.debug("[redis 推流被请求通知] {}: {}-{}", key, msg.getApp(), msg.getStream()); | ||
| 639 | + redis.convertAndSend(key, (JSONObject)JSON.toJSON(msg)); | ||
| 640 | + } | ||
| 629 | } | 641 | } |
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java renamed to src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java
| @@ -5,14 +5,12 @@ import com.genersoft.iot.vmp.conf.SipConfig; | @@ -5,14 +5,12 @@ import com.genersoft.iot.vmp.conf.SipConfig; | ||
| 5 | import com.genersoft.iot.vmp.gb28181.bean.*; | 5 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 6 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | 6 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 7 | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; | 7 | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; |
| 8 | -import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; | ||
| 9 | -import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | ||
| 10 | import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; | 8 | import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; |
| 11 | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; | 9 | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| 12 | import com.genersoft.iot.vmp.service.IGbStreamService; | 10 | import com.genersoft.iot.vmp.service.IGbStreamService; |
| 13 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; | 11 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| 14 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 12 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 15 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 13 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 16 | import com.genersoft.iot.vmp.storager.dao.*; | 14 | import com.genersoft.iot.vmp.storager.dao.*; |
| 17 | import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo; | 15 | import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo; |
| 18 | import com.genersoft.iot.vmp.utils.node.ForestNodeMerger; | 16 | import com.genersoft.iot.vmp.utils.node.ForestNodeMerger; |
| @@ -40,9 +38,9 @@ import java.util.*; | @@ -40,9 +38,9 @@ import java.util.*; | ||
| 40 | */ | 38 | */ |
| 41 | @SuppressWarnings("rawtypes") | 39 | @SuppressWarnings("rawtypes") |
| 42 | @Component | 40 | @Component |
| 43 | -public class VideoManagerStoragerImpl implements IVideoManagerStorager { | 41 | +public class VideoManagerStorageImpl implements IVideoManagerStorage { |
| 44 | 42 | ||
| 45 | - private final Logger logger = LoggerFactory.getLogger(VideoManagerStoragerImpl.class); | 43 | + private final Logger logger = LoggerFactory.getLogger(VideoManagerStorageImpl.class); |
| 46 | 44 | ||
| 47 | @Autowired | 45 | @Autowired |
| 48 | EventPublisher eventPublisher; | 46 | EventPublisher eventPublisher; |
| @@ -85,7 +83,6 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | @@ -85,7 +83,6 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | ||
| 85 | 83 | ||
| 86 | @Autowired | 84 | @Autowired |
| 87 | private PlatformCatalogMapper catalogMapper; | 85 | private PlatformCatalogMapper catalogMapper; |
| 88 | -; | ||
| 89 | 86 | ||
| 90 | @Autowired | 87 | @Autowired |
| 91 | private PlatformGbStreamMapper platformGbStreamMapper; | 88 | private PlatformGbStreamMapper platformGbStreamMapper; |
| @@ -96,13 +93,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | @@ -96,13 +93,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | ||
| 96 | @Autowired | 93 | @Autowired |
| 97 | private ParentPlatformMapper parentPlatformMapper; | 94 | private ParentPlatformMapper parentPlatformMapper; |
| 98 | 95 | ||
| 99 | - @Autowired | ||
| 100 | - private VideoStreamSessionManager streamSession; | ||
| 101 | - | ||
| 102 | - @Autowired | ||
| 103 | - private MediaServerMapper mediaServerMapper; | ||
| 104 | - | ||
| 105 | - private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | 96 | + private final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| 106 | 97 | ||
| 107 | 98 | ||
| 108 | /** | 99 | /** |
| @@ -268,7 +259,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | @@ -268,7 +259,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | ||
| 268 | } | 259 | } |
| 269 | } | 260 | } |
| 270 | }else { | 261 | }else { |
| 271 | - stringBuilder.append(deviceChannel.getChannelId() + ","); | 262 | + stringBuilder.append(deviceChannel.getChannelId()).append(","); |
| 272 | } | 263 | } |
| 273 | } | 264 | } |
| 274 | if (channels.size() > 0) { | 265 | if (channels.size() > 0) { |
| @@ -286,7 +277,6 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | @@ -286,7 +277,6 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | ||
| 286 | logger.debug("[目录查询]收到的数据存在重复: {}" , stringBuilder); | 277 | logger.debug("[目录查询]收到的数据存在重复: {}" , stringBuilder); |
| 287 | } | 278 | } |
| 288 | try { | 279 | try { |
| 289 | -// int cleanChannelsResult = deviceChannelMapper.cleanChannelsByDeviceId(deviceId); | ||
| 290 | int cleanChannelsResult = deviceChannelMapper.cleanChannelsNotInList(deviceId, channels); | 280 | int cleanChannelsResult = deviceChannelMapper.cleanChannelsNotInList(deviceId, channels); |
| 291 | int limitCount = 300; | 281 | int limitCount = 300; |
| 292 | boolean result = cleanChannelsResult < 0; | 282 | boolean result = cleanChannelsResult < 0; |
| @@ -1133,4 +1123,9 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | @@ -1133,4 +1123,9 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | ||
| 1133 | public List<ChannelSourceInfo> getChannelSource(String platformId, String gbId) { | 1123 | public List<ChannelSourceInfo> getChannelSource(String platformId, String gbId) { |
| 1134 | return platformMapper.getChannelSource(platformId, gbId); | 1124 | return platformMapper.getChannelSource(platformId, gbId); |
| 1135 | } | 1125 | } |
| 1126 | + | ||
| 1127 | + @Override | ||
| 1128 | + public void updateChannelPotion(String deviceId, String channelId, double longitude, double latitude) { | ||
| 1129 | + deviceChannelMapper.updatePotion(deviceId, channelId, longitude, latitude); | ||
| 1130 | + } | ||
| 1136 | } | 1131 | } |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/MobilePosition/MobilePositionController.java
| @@ -3,14 +3,12 @@ package com.genersoft.iot.vmp.vmanager.gb28181.MobilePosition; | @@ -3,14 +3,12 @@ package com.genersoft.iot.vmp.vmanager.gb28181.MobilePosition; | ||
| 3 | import java.util.List; | 3 | import java.util.List; |
| 4 | import java.util.UUID; | 4 | import java.util.UUID; |
| 5 | 5 | ||
| 6 | -import javax.sip.message.Response; | ||
| 7 | - | ||
| 8 | import com.genersoft.iot.vmp.gb28181.bean.Device; | 6 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 9 | import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; | 7 | import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; |
| 10 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | 8 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 11 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; | 9 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| 12 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | 10 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| 13 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 11 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 14 | import com.github.pagehelper.util.StringUtil; | 12 | import com.github.pagehelper.util.StringUtil; |
| 15 | 13 | ||
| 16 | import io.swagger.annotations.Api; | 14 | import io.swagger.annotations.Api; |
| @@ -42,7 +40,7 @@ public class MobilePositionController { | @@ -42,7 +40,7 @@ public class MobilePositionController { | ||
| 42 | private final static Logger logger = LoggerFactory.getLogger(MobilePositionController.class); | 40 | private final static Logger logger = LoggerFactory.getLogger(MobilePositionController.class); |
| 43 | 41 | ||
| 44 | @Autowired | 42 | @Autowired |
| 45 | - private IVideoManagerStorager storager; | 43 | + private IVideoManagerStorage storager; |
| 46 | 44 | ||
| 47 | @Autowired | 45 | @Autowired |
| 48 | private SIPCommander cmder; | 46 | private SIPCommander cmder; |
| @@ -161,9 +159,11 @@ public class MobilePositionController { | @@ -161,9 +159,11 @@ public class MobilePositionController { | ||
| 161 | interval = "5"; | 159 | interval = "5"; |
| 162 | } | 160 | } |
| 163 | Device device = storager.queryVideoDevice(deviceId); | 161 | Device device = storager.queryVideoDevice(deviceId); |
| 164 | - | 162 | + device.setSubscribeCycleForMobilePosition(Integer.parseInt(expires)); |
| 163 | + device.setMobilePositionSubmissionInterval(Integer.parseInt(interval)); | ||
| 164 | + storager.updateDevice(device); | ||
| 165 | String result = msg; | 165 | String result = msg; |
| 166 | - if (cmder.mobilePositionSubscribe(device, Integer.parseInt(expires), Integer.parseInt(interval))) { | 166 | + if (cmder.mobilePositionSubscribe(device, null, null)) { |
| 167 | result += ",成功"; | 167 | result += ",成功"; |
| 168 | } else { | 168 | } else { |
| 169 | result += ",失败"; | 169 | result += ",失败"; |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceConfig.java
| @@ -7,14 +7,12 @@ | @@ -7,14 +7,12 @@ | ||
| 7 | 7 | ||
| 8 | package com.genersoft.iot.vmp.vmanager.gb28181.device; | 8 | package com.genersoft.iot.vmp.vmanager.gb28181.device; |
| 9 | 9 | ||
| 10 | -import javax.sip.message.Response; | ||
| 11 | - | ||
| 12 | import com.alibaba.fastjson.JSONObject; | 10 | import com.alibaba.fastjson.JSONObject; |
| 13 | import com.genersoft.iot.vmp.gb28181.bean.Device; | 11 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 14 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | 12 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 15 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; | 13 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| 16 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | 14 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| 17 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 15 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 18 | 16 | ||
| 19 | import io.swagger.annotations.Api; | 17 | import io.swagger.annotations.Api; |
| 20 | import io.swagger.annotations.ApiImplicitParam; | 18 | import io.swagger.annotations.ApiImplicitParam; |
| @@ -39,7 +37,7 @@ public class DeviceConfig { | @@ -39,7 +37,7 @@ public class DeviceConfig { | ||
| 39 | private final static Logger logger = LoggerFactory.getLogger(DeviceQuery.class); | 37 | private final static Logger logger = LoggerFactory.getLogger(DeviceQuery.class); |
| 40 | 38 | ||
| 41 | @Autowired | 39 | @Autowired |
| 42 | - private IVideoManagerStorager storager; | 40 | + private IVideoManagerStorage storager; |
| 43 | 41 | ||
| 44 | @Autowired | 42 | @Autowired |
| 45 | private SIPCommander cmder; | 43 | private SIPCommander cmder; |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceControl.java
| @@ -7,14 +7,12 @@ | @@ -7,14 +7,12 @@ | ||
| 7 | 7 | ||
| 8 | package com.genersoft.iot.vmp.vmanager.gb28181.device; | 8 | package com.genersoft.iot.vmp.vmanager.gb28181.device; |
| 9 | 9 | ||
| 10 | -import javax.sip.message.Response; | ||
| 11 | - | ||
| 12 | import com.alibaba.fastjson.JSONObject; | 10 | import com.alibaba.fastjson.JSONObject; |
| 13 | import com.genersoft.iot.vmp.gb28181.bean.Device; | 11 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 14 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | 12 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 15 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; | 13 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| 16 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | 14 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| 17 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 15 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 18 | 16 | ||
| 19 | import io.swagger.annotations.Api; | 17 | import io.swagger.annotations.Api; |
| 20 | import io.swagger.annotations.ApiImplicitParam; | 18 | import io.swagger.annotations.ApiImplicitParam; |
| @@ -40,7 +38,7 @@ public class DeviceControl { | @@ -40,7 +38,7 @@ public class DeviceControl { | ||
| 40 | private final static Logger logger = LoggerFactory.getLogger(DeviceQuery.class); | 38 | private final static Logger logger = LoggerFactory.getLogger(DeviceQuery.class); |
| 41 | 39 | ||
| 42 | @Autowired | 40 | @Autowired |
| 43 | - private IVideoManagerStorager storager; | 41 | + private IVideoManagerStorage storager; |
| 44 | 42 | ||
| 45 | @Autowired | 43 | @Autowired |
| 46 | private SIPCommander cmder; | 44 | private SIPCommander cmder; |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/device/DeviceQuery.java
| @@ -10,7 +10,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; | @@ -10,7 +10,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; | ||
| 10 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | 10 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| 11 | import com.genersoft.iot.vmp.service.IDeviceService; | 11 | import com.genersoft.iot.vmp.service.IDeviceService; |
| 12 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 12 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 13 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 13 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 14 | import com.genersoft.iot.vmp.vmanager.bean.DeviceChannelTree; | 14 | import com.genersoft.iot.vmp.vmanager.bean.DeviceChannelTree; |
| 15 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | 15 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 16 | import com.github.pagehelper.PageInfo; | 16 | import com.github.pagehelper.PageInfo; |
| @@ -28,6 +28,7 @@ import org.springframework.web.bind.annotation.*; | @@ -28,6 +28,7 @@ import org.springframework.web.bind.annotation.*; | ||
| 28 | import org.springframework.web.context.request.async.DeferredResult; | 28 | import org.springframework.web.context.request.async.DeferredResult; |
| 29 | 29 | ||
| 30 | import java.util.List; | 30 | import java.util.List; |
| 31 | +import java.util.Set; | ||
| 31 | import java.util.UUID; | 32 | import java.util.UUID; |
| 32 | 33 | ||
| 33 | @Api(tags = "国标设备查询", value = "国标设备查询") | 34 | @Api(tags = "国标设备查询", value = "国标设备查询") |
| @@ -40,7 +41,7 @@ public class DeviceQuery { | @@ -40,7 +41,7 @@ public class DeviceQuery { | ||
| 40 | private final static Logger logger = LoggerFactory.getLogger(DeviceQuery.class); | 41 | private final static Logger logger = LoggerFactory.getLogger(DeviceQuery.class); |
| 41 | 42 | ||
| 42 | @Autowired | 43 | @Autowired |
| 43 | - private IVideoManagerStorager storager; | 44 | + private IVideoManagerStorage storager; |
| 44 | 45 | ||
| 45 | @Autowired | 46 | @Autowired |
| 46 | private IRedisCatchStorage redisCatchStorage; | 47 | private IRedisCatchStorage redisCatchStorage; |
| @@ -213,7 +214,12 @@ public class DeviceQuery { | @@ -213,7 +214,12 @@ public class DeviceQuery { | ||
| 213 | if (isSuccess) { | 214 | if (isSuccess) { |
| 214 | redisCatchStorage.clearCatchByDeviceId(deviceId); | 215 | redisCatchStorage.clearCatchByDeviceId(deviceId); |
| 215 | // 停止此设备的订阅更新 | 216 | // 停止此设备的订阅更新 |
| 216 | - dynamicTask.stop(deviceId); | 217 | + Set<String> allKeys = dynamicTask.getAllKeys(); |
| 218 | + for (String key : allKeys) { | ||
| 219 | + if (key.startsWith(deviceId)) { | ||
| 220 | + dynamicTask.stop(key); | ||
| 221 | + } | ||
| 222 | + } | ||
| 217 | JSONObject json = new JSONObject(); | 223 | JSONObject json = new JSONObject(); |
| 218 | json.put("deviceId", deviceId); | 224 | json.put("deviceId", deviceId); |
| 219 | return new ResponseEntity<>(json.toString(),HttpStatus.OK); | 225 | return new ResponseEntity<>(json.toString(),HttpStatus.OK); |
| @@ -321,18 +327,38 @@ public class DeviceQuery { | @@ -321,18 +327,38 @@ public class DeviceQuery { | ||
| 321 | if (!StringUtils.isEmpty(device.getCharset())) deviceInStore.setCharset(device.getCharset()); | 327 | if (!StringUtils.isEmpty(device.getCharset())) deviceInStore.setCharset(device.getCharset()); |
| 322 | if (!StringUtils.isEmpty(device.getMediaServerId())) deviceInStore.setMediaServerId(device.getMediaServerId()); | 328 | if (!StringUtils.isEmpty(device.getMediaServerId())) deviceInStore.setMediaServerId(device.getMediaServerId()); |
| 323 | 329 | ||
| 330 | + // 目录订阅相关的信息 | ||
| 324 | if (device.getSubscribeCycleForCatalog() > 0) { | 331 | if (device.getSubscribeCycleForCatalog() > 0) { |
| 325 | if (deviceInStore.getSubscribeCycleForCatalog() == 0 || deviceInStore.getSubscribeCycleForCatalog() != device.getSubscribeCycleForCatalog()) { | 332 | if (deviceInStore.getSubscribeCycleForCatalog() == 0 || deviceInStore.getSubscribeCycleForCatalog() != device.getSubscribeCycleForCatalog()) { |
| 333 | + deviceInStore.setSubscribeCycleForCatalog(device.getSubscribeCycleForCatalog()); | ||
| 326 | // 开启订阅 | 334 | // 开启订阅 |
| 327 | deviceService.addCatalogSubscribe(deviceInStore); | 335 | deviceService.addCatalogSubscribe(deviceInStore); |
| 328 | } | 336 | } |
| 329 | }else if (device.getSubscribeCycleForCatalog() == 0) { | 337 | }else if (device.getSubscribeCycleForCatalog() == 0) { |
| 330 | if (deviceInStore.getSubscribeCycleForCatalog() != 0) { | 338 | if (deviceInStore.getSubscribeCycleForCatalog() != 0) { |
| 339 | + deviceInStore.setSubscribeCycleForCatalog(device.getSubscribeCycleForCatalog()); | ||
| 331 | // 取消订阅 | 340 | // 取消订阅 |
| 332 | deviceService.removeCatalogSubscribe(deviceInStore); | 341 | deviceService.removeCatalogSubscribe(deviceInStore); |
| 333 | } | 342 | } |
| 334 | } | 343 | } |
| 335 | 344 | ||
| 345 | + // 移动位置订阅相关的信息 | ||
| 346 | + if (device.getSubscribeCycleForMobilePosition() > 0) { | ||
| 347 | + if (deviceInStore.getSubscribeCycleForMobilePosition() == 0 || deviceInStore.getSubscribeCycleForMobilePosition() != device.getSubscribeCycleForMobilePosition()) { | ||
| 348 | + deviceInStore.setMobilePositionSubmissionInterval(device.getMobilePositionSubmissionInterval()); | ||
| 349 | + deviceInStore.setSubscribeCycleForMobilePosition(device.getSubscribeCycleForMobilePosition()); | ||
| 350 | + // 开启订阅 | ||
| 351 | + deviceService.addMobilePositionSubscribe(deviceInStore); | ||
| 352 | + } | ||
| 353 | + }else if (device.getSubscribeCycleForMobilePosition() == 0) { | ||
| 354 | + if (deviceInStore.getSubscribeCycleForMobilePosition() != 0) { | ||
| 355 | + // 取消订阅 | ||
| 356 | + deviceService.removeMobilePositionSubscribe(deviceInStore); | ||
| 357 | + } | ||
| 358 | + } | ||
| 359 | + | ||
| 360 | + // TODO 报警订阅相关的信息 | ||
| 361 | + | ||
| 336 | storager.updateDevice(device); | 362 | storager.updateDevice(device); |
| 337 | cmder.deviceInfoQuery(device); | 363 | cmder.deviceInfoQuery(device); |
| 338 | } | 364 | } |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/gbStream/GbStreamController.java
| 1 | package com.genersoft.iot.vmp.vmanager.gb28181.gbStream; | 1 | package com.genersoft.iot.vmp.vmanager.gb28181.gbStream; |
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.gb28181.bean.GbStream; | 3 | import com.genersoft.iot.vmp.gb28181.bean.GbStream; |
| 4 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 4 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 5 | import com.genersoft.iot.vmp.vmanager.gb28181.gbStream.bean.GbStreamParam; | 5 | import com.genersoft.iot.vmp.vmanager.gb28181.gbStream.bean.GbStreamParam; |
| 6 | import com.genersoft.iot.vmp.service.IGbStreamService; | 6 | import com.genersoft.iot.vmp.service.IGbStreamService; |
| 7 | import com.github.pagehelper.PageInfo; | 7 | import com.github.pagehelper.PageInfo; |
| @@ -27,7 +27,7 @@ public class GbStreamController { | @@ -27,7 +27,7 @@ public class GbStreamController { | ||
| 27 | private IGbStreamService gbStreamService; | 27 | private IGbStreamService gbStreamService; |
| 28 | 28 | ||
| 29 | @Autowired | 29 | @Autowired |
| 30 | - private IVideoManagerStorager storager; | 30 | + private IVideoManagerStorage storager; |
| 31 | 31 | ||
| 32 | 32 | ||
| 33 | /** | 33 | /** |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/media/MediaController.java
| @@ -4,13 +4,12 @@ import com.genersoft.iot.vmp.common.StreamInfo; | @@ -4,13 +4,12 @@ import com.genersoft.iot.vmp.common.StreamInfo; | ||
| 4 | import com.genersoft.iot.vmp.service.IMediaServerService; | 4 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 5 | import com.genersoft.iot.vmp.service.IStreamPushService; | 5 | import com.genersoft.iot.vmp.service.IStreamPushService; |
| 6 | import com.genersoft.iot.vmp.service.IMediaService; | 6 | import com.genersoft.iot.vmp.service.IMediaService; |
| 7 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 7 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 8 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | 8 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 9 | import io.swagger.annotations.Api; | 9 | import io.swagger.annotations.Api; |
| 10 | import io.swagger.annotations.ApiImplicitParam; | 10 | import io.swagger.annotations.ApiImplicitParam; |
| 11 | import io.swagger.annotations.ApiImplicitParams; | 11 | import io.swagger.annotations.ApiImplicitParams; |
| 12 | import io.swagger.annotations.ApiOperation; | 12 | import io.swagger.annotations.ApiOperation; |
| 13 | -import org.apache.commons.lang3.StringUtils; | ||
| 14 | import org.slf4j.Logger; | 13 | import org.slf4j.Logger; |
| 15 | import org.slf4j.LoggerFactory; | 14 | import org.slf4j.LoggerFactory; |
| 16 | import org.springframework.beans.factory.annotation.Autowired; | 15 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -27,7 +26,7 @@ public class MediaController { | @@ -27,7 +26,7 @@ public class MediaController { | ||
| 27 | private final static Logger logger = LoggerFactory.getLogger(MediaController.class); | 26 | private final static Logger logger = LoggerFactory.getLogger(MediaController.class); |
| 28 | 27 | ||
| 29 | @Autowired | 28 | @Autowired |
| 30 | - private IVideoManagerStorager storager; | 29 | + private IVideoManagerStorage storager; |
| 31 | 30 | ||
| 32 | @Autowired | 31 | @Autowired |
| 33 | private IStreamPushService streamPushService; | 32 | private IStreamPushService streamPushService; |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/platform/PlatformController.java
| @@ -4,13 +4,13 @@ import com.alibaba.fastjson.JSON; | @@ -4,13 +4,13 @@ import com.alibaba.fastjson.JSON; | ||
| 4 | import com.alibaba.fastjson.JSONObject; | 4 | import com.alibaba.fastjson.JSONObject; |
| 5 | import com.genersoft.iot.vmp.common.VideoManagerConstants; | 5 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 6 | import com.genersoft.iot.vmp.conf.DynamicTask; | 6 | import com.genersoft.iot.vmp.conf.DynamicTask; |
| 7 | -import com.genersoft.iot.vmp.conf.UserSetup; | 7 | +import com.genersoft.iot.vmp.conf.UserSetting; |
| 8 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | 8 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| 9 | import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog; | 9 | import com.genersoft.iot.vmp.gb28181.bean.PlatformCatalog; |
| 10 | import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder; | 10 | import com.genersoft.iot.vmp.gb28181.bean.SubscribeHolder; |
| 11 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; | 11 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; |
| 12 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 12 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 13 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 13 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 14 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | 14 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 15 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; | 15 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; |
| 16 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.UpdateChannelParam; | 16 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.UpdateChannelParam; |
| @@ -29,7 +29,6 @@ import org.springframework.web.bind.annotation.*; | @@ -29,7 +29,6 @@ import org.springframework.web.bind.annotation.*; | ||
| 29 | import com.genersoft.iot.vmp.conf.SipConfig; | 29 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 30 | 30 | ||
| 31 | import java.util.List; | 31 | import java.util.List; |
| 32 | -import java.util.Locale; | ||
| 33 | 32 | ||
| 34 | /** | 33 | /** |
| 35 | * 级联平台管理 | 34 | * 级联平台管理 |
| @@ -43,10 +42,10 @@ public class PlatformController { | @@ -43,10 +42,10 @@ public class PlatformController { | ||
| 43 | private final static Logger logger = LoggerFactory.getLogger(PlatformController.class); | 42 | private final static Logger logger = LoggerFactory.getLogger(PlatformController.class); |
| 44 | 43 | ||
| 45 | @Autowired | 44 | @Autowired |
| 46 | - private UserSetup userSetup; | 45 | + private UserSetting userSetting; |
| 47 | 46 | ||
| 48 | @Autowired | 47 | @Autowired |
| 49 | - private IVideoManagerStorager storager; | 48 | + private IVideoManagerStorage storager; |
| 50 | 49 | ||
| 51 | @Autowired | 50 | @Autowired |
| 52 | private IRedisCatchStorage redisCatchStorage; | 51 | private IRedisCatchStorage redisCatchStorage; |
| @@ -118,7 +117,7 @@ public class PlatformController { | @@ -118,7 +117,7 @@ public class PlatformController { | ||
| 118 | PageInfo<ParentPlatform> parentPlatformPageInfo = storager.queryParentPlatformList(page, count); | 117 | PageInfo<ParentPlatform> parentPlatformPageInfo = storager.queryParentPlatformList(page, count); |
| 119 | if (parentPlatformPageInfo.getList().size() > 0) { | 118 | if (parentPlatformPageInfo.getList().size() > 0) { |
| 120 | for (ParentPlatform platform : parentPlatformPageInfo.getList()) { | 119 | for (ParentPlatform platform : parentPlatformPageInfo.getList()) { |
| 121 | - platform.setGpsSubscribe(subscribeHolder.getMobilePositionSubscribe(platform.getServerGBId()) != null); | 120 | + platform.setMobilePositionSubscribe(subscribeHolder.getMobilePositionSubscribe(platform.getServerGBId()) != null); |
| 122 | platform.setCatalogSubscribe(subscribeHolder.getCatalogSubscribe(platform.getServerGBId()) != null); | 121 | platform.setCatalogSubscribe(subscribeHolder.getCatalogSubscribe(platform.getServerGBId()) != null); |
| 123 | } | 122 | } |
| 124 | } | 123 | } |
| @@ -305,7 +304,7 @@ public class PlatformController { | @@ -305,7 +304,7 @@ public class PlatformController { | ||
| 305 | storager.delCatalogByPlatformId(parentPlatform.getServerGBId()); | 304 | storager.delCatalogByPlatformId(parentPlatform.getServerGBId()); |
| 306 | storager.delRelationByPlatformId(parentPlatform.getServerGBId()); | 305 | storager.delRelationByPlatformId(parentPlatform.getServerGBId()); |
| 307 | // 停止发送位置订阅定时任务 | 306 | // 停止发送位置订阅定时任务 |
| 308 | - String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetup.getServerId() + "_MobilePosition_" + parentPlatform.getServerGBId(); | 307 | + String key = VideoManagerConstants.SIP_SUBSCRIBE_PREFIX + userSetting.getServerId() + "_MobilePosition_" + parentPlatform.getServerGBId(); |
| 309 | dynamicTask.stop(key); | 308 | dynamicTask.stop(key); |
| 310 | // 删除缓存的订阅信息 | 309 | // 删除缓存的订阅信息 |
| 311 | subscribeHolder.removeAllSubscribe(parentPlatform.getServerGBId()); | 310 | subscribeHolder.removeAllSubscribe(parentPlatform.getServerGBId()); |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/play/PlayController.java
| @@ -33,14 +33,12 @@ import org.springframework.web.bind.annotation.RestController; | @@ -33,14 +33,12 @@ import org.springframework.web.bind.annotation.RestController; | ||
| 33 | 33 | ||
| 34 | import com.alibaba.fastjson.JSONObject; | 34 | import com.alibaba.fastjson.JSONObject; |
| 35 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | 35 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| 36 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 36 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 37 | import org.springframework.web.context.request.async.DeferredResult; | 37 | import org.springframework.web.context.request.async.DeferredResult; |
| 38 | 38 | ||
| 39 | import java.util.List; | 39 | import java.util.List; |
| 40 | import java.util.UUID; | 40 | import java.util.UUID; |
| 41 | 41 | ||
| 42 | -import javax.sip.message.Response; | ||
| 43 | - | ||
| 44 | @Api(tags = "国标设备点播") | 42 | @Api(tags = "国标设备点播") |
| 45 | @CrossOrigin | 43 | @CrossOrigin |
| 46 | @RestController | 44 | @RestController |
| @@ -56,7 +54,7 @@ public class PlayController { | @@ -56,7 +54,7 @@ public class PlayController { | ||
| 56 | private VideoStreamSessionManager streamSession; | 54 | private VideoStreamSessionManager streamSession; |
| 57 | 55 | ||
| 58 | @Autowired | 56 | @Autowired |
| 59 | - private IVideoManagerStorager storager; | 57 | + private IVideoManagerStorage storager; |
| 60 | 58 | ||
| 61 | @Autowired | 59 | @Autowired |
| 62 | private IRedisCatchStorage redisCatchStorage; | 60 | private IRedisCatchStorage redisCatchStorage; |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/playback/PlaybackController.java
| @@ -2,11 +2,8 @@ package com.genersoft.iot.vmp.vmanager.gb28181.playback; | @@ -2,11 +2,8 @@ package com.genersoft.iot.vmp.vmanager.gb28181.playback; | ||
| 2 | 2 | ||
| 3 | import com.genersoft.iot.vmp.common.StreamInfo; | 3 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 4 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | 4 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 5 | -import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; | ||
| 6 | //import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; | 5 | //import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; |
| 7 | -import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | ||
| 8 | import com.genersoft.iot.vmp.service.IMediaServerService; | 6 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 9 | -import com.genersoft.iot.vmp.service.bean.SSRCInfo; | ||
| 10 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 7 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 11 | import com.genersoft.iot.vmp.service.IPlayService; | 8 | import com.genersoft.iot.vmp.service.IPlayService; |
| 12 | import io.swagger.annotations.Api; | 9 | import io.swagger.annotations.Api; |
| @@ -28,11 +25,9 @@ import org.springframework.web.bind.annotation.RestController; | @@ -28,11 +25,9 @@ import org.springframework.web.bind.annotation.RestController; | ||
| 28 | import com.alibaba.fastjson.JSONObject; | 25 | import com.alibaba.fastjson.JSONObject; |
| 29 | import com.genersoft.iot.vmp.gb28181.bean.Device; | 26 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 30 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | 27 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| 31 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 28 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 32 | import org.springframework.web.context.request.async.DeferredResult; | 29 | import org.springframework.web.context.request.async.DeferredResult; |
| 33 | 30 | ||
| 34 | -import java.util.UUID; | ||
| 35 | - | ||
| 36 | @Api(tags = "视频回放") | 31 | @Api(tags = "视频回放") |
| 37 | @CrossOrigin | 32 | @CrossOrigin |
| 38 | @RestController | 33 | @RestController |
| @@ -45,7 +40,7 @@ public class PlaybackController { | @@ -45,7 +40,7 @@ public class PlaybackController { | ||
| 45 | private SIPCommander cmder; | 40 | private SIPCommander cmder; |
| 46 | 41 | ||
| 47 | @Autowired | 42 | @Autowired |
| 48 | - private IVideoManagerStorager storager; | 43 | + private IVideoManagerStorage storager; |
| 49 | 44 | ||
| 50 | @Autowired | 45 | @Autowired |
| 51 | private IRedisCatchStorage redisCatchStorage; | 46 | private IRedisCatchStorage redisCatchStorage; |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/ptz/PtzController.java
| @@ -13,13 +13,11 @@ import org.springframework.util.StringUtils; | @@ -13,13 +13,11 @@ import org.springframework.util.StringUtils; | ||
| 13 | import org.springframework.web.bind.annotation.*; | 13 | import org.springframework.web.bind.annotation.*; |
| 14 | import org.springframework.web.context.request.async.DeferredResult; | 14 | import org.springframework.web.context.request.async.DeferredResult; |
| 15 | 15 | ||
| 16 | -import javax.sip.message.Response; | ||
| 17 | - | ||
| 18 | import com.genersoft.iot.vmp.gb28181.bean.Device; | 16 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 19 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | 17 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 20 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; | 18 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| 21 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | 19 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| 22 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 20 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 23 | 21 | ||
| 24 | import java.util.UUID; | 22 | import java.util.UUID; |
| 25 | 23 | ||
| @@ -35,7 +33,7 @@ public class PtzController { | @@ -35,7 +33,7 @@ public class PtzController { | ||
| 35 | private SIPCommander cmder; | 33 | private SIPCommander cmder; |
| 36 | 34 | ||
| 37 | @Autowired | 35 | @Autowired |
| 38 | - private IVideoManagerStorager storager; | 36 | + private IVideoManagerStorage storager; |
| 39 | 37 | ||
| 40 | @Autowired | 38 | @Autowired |
| 41 | private DeferredResultHolder resultHolder; | 39 | private DeferredResultHolder resultHolder; |
src/main/java/com/genersoft/iot/vmp/vmanager/gb28181/record/GBRecordController.java
| @@ -2,12 +2,9 @@ package com.genersoft.iot.vmp.vmanager.gb28181.record; | @@ -2,12 +2,9 @@ package com.genersoft.iot.vmp.vmanager.gb28181.record; | ||
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | import com.genersoft.iot.vmp.common.StreamInfo; | 4 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 5 | -import com.genersoft.iot.vmp.gb28181.bean.InviteStreamInfo; | ||
| 6 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; | 5 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| 7 | -import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | ||
| 8 | import com.genersoft.iot.vmp.service.IMediaServerService; | 6 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 9 | import com.genersoft.iot.vmp.service.IPlayService; | 7 | import com.genersoft.iot.vmp.service.IPlayService; |
| 10 | -import com.genersoft.iot.vmp.service.bean.SSRCInfo; | ||
| 11 | import io.swagger.annotations.Api; | 8 | import io.swagger.annotations.Api; |
| 12 | import io.swagger.annotations.ApiImplicitParam; | 9 | import io.swagger.annotations.ApiImplicitParam; |
| 13 | import io.swagger.annotations.ApiImplicitParams; | 10 | import io.swagger.annotations.ApiImplicitParams; |
| @@ -28,7 +25,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device; | @@ -28,7 +25,7 @@ import com.genersoft.iot.vmp.gb28181.bean.Device; | ||
| 28 | import com.genersoft.iot.vmp.gb28181.bean.RecordInfo; | 25 | import com.genersoft.iot.vmp.gb28181.bean.RecordInfo; |
| 29 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | 26 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 30 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | 27 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| 31 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 28 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 32 | 29 | ||
| 33 | import java.util.UUID; | 30 | import java.util.UUID; |
| 34 | 31 | ||
| @@ -44,7 +41,7 @@ public class GBRecordController { | @@ -44,7 +41,7 @@ public class GBRecordController { | ||
| 44 | private SIPCommander cmder; | 41 | private SIPCommander cmder; |
| 45 | 42 | ||
| 46 | @Autowired | 43 | @Autowired |
| 47 | - private IVideoManagerStorager storager; | 44 | + private IVideoManagerStorage storager; |
| 48 | 45 | ||
| 49 | @Autowired | 46 | @Autowired |
| 50 | private DeferredResultHolder resultHolder; | 47 | private DeferredResultHolder resultHolder; |
src/main/java/com/genersoft/iot/vmp/vmanager/log/LogController.java
| 1 | package com.genersoft.iot.vmp.vmanager.log; | 1 | package com.genersoft.iot.vmp.vmanager.log; |
| 2 | 2 | ||
| 3 | -import com.genersoft.iot.vmp.conf.UserSetup; | ||
| 4 | -import com.genersoft.iot.vmp.media.zlm.ZLMRunner; | 3 | +import com.genersoft.iot.vmp.conf.UserSetting; |
| 5 | import com.genersoft.iot.vmp.service.ILogService; | 4 | import com.genersoft.iot.vmp.service.ILogService; |
| 6 | import com.genersoft.iot.vmp.storager.dao.dto.LogDto; | 5 | import com.genersoft.iot.vmp.storager.dao.dto.LogDto; |
| 7 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | 6 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| @@ -33,7 +32,7 @@ public class LogController { | @@ -33,7 +32,7 @@ public class LogController { | ||
| 33 | private ILogService logService; | 32 | private ILogService logService; |
| 34 | 33 | ||
| 35 | @Autowired | 34 | @Autowired |
| 36 | - private UserSetup userSetup; | 35 | + private UserSetting userSetting; |
| 37 | 36 | ||
| 38 | private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | 37 | private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| 39 | 38 | ||
| @@ -69,7 +68,7 @@ public class LogController { | @@ -69,7 +68,7 @@ public class LogController { | ||
| 69 | if (StringUtils.isEmpty(query)) query = null; | 68 | if (StringUtils.isEmpty(query)) query = null; |
| 70 | if (StringUtils.isEmpty(startTime)) startTime = null; | 69 | if (StringUtils.isEmpty(startTime)) startTime = null; |
| 71 | if (StringUtils.isEmpty(endTime)) endTime = null; | 70 | if (StringUtils.isEmpty(endTime)) endTime = null; |
| 72 | - if (!userSetup.getLogInDatebase()) { | 71 | + if (!userSetting.getLogInDatebase()) { |
| 73 | logger.warn("自动记录日志功能已关闭,查询结果可能不完整。"); | 72 | logger.warn("自动记录日志功能已关闭,查询结果可能不完整。"); |
| 74 | } | 73 | } |
| 75 | 74 |
src/main/java/com/genersoft/iot/vmp/vmanager/server/ServerController.java
| @@ -5,7 +5,7 @@ import com.alibaba.fastjson.JSONObject; | @@ -5,7 +5,7 @@ import com.alibaba.fastjson.JSONObject; | ||
| 5 | import com.genersoft.iot.vmp.VManageBootstrap; | 5 | import com.genersoft.iot.vmp.VManageBootstrap; |
| 6 | import com.genersoft.iot.vmp.common.VersionPo; | 6 | import com.genersoft.iot.vmp.common.VersionPo; |
| 7 | import com.genersoft.iot.vmp.conf.SipConfig; | 7 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 8 | -import com.genersoft.iot.vmp.conf.UserSetup; | 8 | +import com.genersoft.iot.vmp.conf.UserSetting; |
| 9 | import com.genersoft.iot.vmp.conf.VersionInfo; | 9 | import com.genersoft.iot.vmp.conf.VersionInfo; |
| 10 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | 10 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 11 | import com.genersoft.iot.vmp.service.IMediaServerService; | 11 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| @@ -48,7 +48,7 @@ public class ServerController { | @@ -48,7 +48,7 @@ public class ServerController { | ||
| 48 | SipConfig sipConfig; | 48 | SipConfig sipConfig; |
| 49 | 49 | ||
| 50 | @Autowired | 50 | @Autowired |
| 51 | - UserSetup userSetup; | 51 | + UserSetting userSetting; |
| 52 | 52 | ||
| 53 | @Value("${server.port}") | 53 | @Value("${server.port}") |
| 54 | private int serverPort; | 54 | private int serverPort; |
| @@ -232,14 +232,14 @@ public class ServerController { | @@ -232,14 +232,14 @@ public class ServerController { | ||
| 232 | jsonObject.put("server.port", serverPort); | 232 | jsonObject.put("server.port", serverPort); |
| 233 | if (StringUtils.isEmpty(type)) { | 233 | if (StringUtils.isEmpty(type)) { |
| 234 | jsonObject.put("sip", JSON.toJSON(sipConfig)); | 234 | jsonObject.put("sip", JSON.toJSON(sipConfig)); |
| 235 | - jsonObject.put("base", JSON.toJSON(userSetup)); | 235 | + jsonObject.put("base", JSON.toJSON(userSetting)); |
| 236 | }else { | 236 | }else { |
| 237 | switch (type){ | 237 | switch (type){ |
| 238 | case "sip": | 238 | case "sip": |
| 239 | jsonObject.put("sip", sipConfig); | 239 | jsonObject.put("sip", sipConfig); |
| 240 | break; | 240 | break; |
| 241 | case "base": | 241 | case "base": |
| 242 | - jsonObject.put("base", userSetup); | 242 | + jsonObject.put("base", userSetting); |
| 243 | break; | 243 | break; |
| 244 | default: | 244 | default: |
| 245 | break; | 245 | break; |
src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiControlController.java
| @@ -3,7 +3,7 @@ package com.genersoft.iot.vmp.web.gb28181; | @@ -3,7 +3,7 @@ package com.genersoft.iot.vmp.web.gb28181; | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | import com.genersoft.iot.vmp.gb28181.bean.Device; | 4 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 5 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | 5 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| 6 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 6 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 7 | import org.slf4j.Logger; | 7 | import org.slf4j.Logger; |
| 8 | import org.slf4j.LoggerFactory; | 8 | import org.slf4j.LoggerFactory; |
| 9 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -23,7 +23,7 @@ public class ApiControlController { | @@ -23,7 +23,7 @@ public class ApiControlController { | ||
| 23 | private SIPCommander cmder; | 23 | private SIPCommander cmder; |
| 24 | 24 | ||
| 25 | @Autowired | 25 | @Autowired |
| 26 | - private IVideoManagerStorager storager; | 26 | + private IVideoManagerStorage storager; |
| 27 | 27 | ||
| 28 | /** | 28 | /** |
| 29 | * 设备控制 - 云台控制 | 29 | * 设备控制 - 云台控制 |
src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiDeviceController.java
| @@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSONArray; | @@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSONArray; | ||
| 4 | import com.alibaba.fastjson.JSONObject; | 4 | import com.alibaba.fastjson.JSONObject; |
| 5 | import com.genersoft.iot.vmp.gb28181.bean.Device; | 5 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 6 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | 6 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| 7 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 7 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 8 | import com.github.pagehelper.PageInfo; | 8 | import com.github.pagehelper.PageInfo; |
| 9 | import org.slf4j.Logger; | 9 | import org.slf4j.Logger; |
| 10 | import org.slf4j.LoggerFactory; | 10 | import org.slf4j.LoggerFactory; |
| @@ -25,7 +25,7 @@ public class ApiDeviceController { | @@ -25,7 +25,7 @@ public class ApiDeviceController { | ||
| 25 | private final static Logger logger = LoggerFactory.getLogger(ApiDeviceController.class); | 25 | private final static Logger logger = LoggerFactory.getLogger(ApiDeviceController.class); |
| 26 | 26 | ||
| 27 | @Autowired | 27 | @Autowired |
| 28 | - private IVideoManagerStorager storager; | 28 | + private IVideoManagerStorage storager; |
| 29 | 29 | ||
| 30 | // @Autowired | 30 | // @Autowired |
| 31 | // private SIPCommander cmder; | 31 | // private SIPCommander cmder; |
src/main/java/com/genersoft/iot/vmp/web/gb28181/ApiStreamController.java
| @@ -2,15 +2,14 @@ package com.genersoft.iot.vmp.web.gb28181; | @@ -2,15 +2,14 @@ package com.genersoft.iot.vmp.web.gb28181; | ||
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | import com.genersoft.iot.vmp.common.StreamInfo; | 4 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 5 | -import com.genersoft.iot.vmp.conf.UserSetup; | 5 | +import com.genersoft.iot.vmp.conf.UserSetting; |
| 6 | import com.genersoft.iot.vmp.gb28181.bean.Device; | 6 | import com.genersoft.iot.vmp.gb28181.bean.Device; |
| 7 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | 7 | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| 8 | -import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | ||
| 9 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | 8 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| 10 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | 9 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 11 | import com.genersoft.iot.vmp.service.IPlayService; | 10 | import com.genersoft.iot.vmp.service.IPlayService; |
| 12 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 11 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 13 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 12 | +import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 14 | import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.PlayResult; | 13 | import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.PlayResult; |
| 15 | import org.slf4j.Logger; | 14 | import org.slf4j.Logger; |
| 16 | import org.slf4j.LoggerFactory; | 15 | import org.slf4j.LoggerFactory; |
| @@ -33,10 +32,10 @@ public class ApiStreamController { | @@ -33,10 +32,10 @@ public class ApiStreamController { | ||
| 33 | private SIPCommander cmder; | 32 | private SIPCommander cmder; |
| 34 | 33 | ||
| 35 | @Autowired | 34 | @Autowired |
| 36 | - private IVideoManagerStorager storager; | 35 | + private IVideoManagerStorage storager; |
| 37 | 36 | ||
| 38 | @Autowired | 37 | @Autowired |
| 39 | - private UserSetup userSetup; | 38 | + private UserSetting userSetting; |
| 40 | 39 | ||
| 41 | @Autowired | 40 | @Autowired |
| 42 | private IRedisCatchStorage redisCatchStorage; | 41 | private IRedisCatchStorage redisCatchStorage; |
| @@ -69,7 +68,7 @@ public class ApiStreamController { | @@ -69,7 +68,7 @@ public class ApiStreamController { | ||
| 69 | @RequestParam(required = false)String timeout | 68 | @RequestParam(required = false)String timeout |
| 70 | 69 | ||
| 71 | ){ | 70 | ){ |
| 72 | - DeferredResult<JSONObject> resultDeferredResult = new DeferredResult<>(userSetup.getPlayTimeout() + 10); | 71 | + DeferredResult<JSONObject> resultDeferredResult = new DeferredResult<>(userSetting.getPlayTimeout() + 10); |
| 73 | Device device = storager.queryVideoDevice(serial); | 72 | Device device = storager.queryVideoDevice(serial); |
| 74 | if (device == null ) { | 73 | if (device == null ) { |
| 75 | JSONObject result = new JSONObject(); | 74 | JSONObject result = new JSONObject(); |
src/main/resources/all-application.yml
| @@ -170,6 +170,8 @@ user-settings: | @@ -170,6 +170,8 @@ user-settings: | ||
| 170 | save-position-history: false | 170 | save-position-history: false |
| 171 | # 点播等待超时时间,单位:毫秒 | 171 | # 点播等待超时时间,单位:毫秒 |
| 172 | play-timeout: 3000 | 172 | play-timeout: 3000 |
| 173 | + # 上级点播等待超时时间,单位:毫秒 | ||
| 174 | + platform-play-timeout: 60000 | ||
| 173 | # 是否开启接口鉴权 | 175 | # 是否开启接口鉴权 |
| 174 | interface-authentication: true | 176 | interface-authentication: true |
| 175 | # 自动配置redis 可以过期事件 | 177 | # 自动配置redis 可以过期事件 |
src/main/resources/logback-spring-local.xml
| @@ -80,12 +80,12 @@ | @@ -80,12 +80,12 @@ | ||
| 80 | <appender-ref ref="RollingFileError" /> | 80 | <appender-ref ref="RollingFileError" /> |
| 81 | </root> | 81 | </root> |
| 82 | 82 | ||
| 83 | - <logger name="com.genersoft.iot.vmp.storager.dao" level="INFO"> | ||
| 84 | - <appender-ref ref="STDOUT"/> | ||
| 85 | - </logger> | ||
| 86 | - <logger name="com.genersoft.iot.vmp.gb28181" level="INFO"> | ||
| 87 | - <appender-ref ref="STDOUT"/> | ||
| 88 | - </logger> | 83 | +<!-- <logger name="com.genersoft.iot.vmp.storager.dao" level="INFO">--> |
| 84 | +<!-- <appender-ref ref="STDOUT"/>--> | ||
| 85 | +<!-- </logger>--> | ||
| 86 | +<!-- <logger name="com.genersoft.iot.vmp.gb28181" level="INFO">--> | ||
| 87 | +<!-- <appender-ref ref="STDOUT"/>--> | ||
| 88 | +<!-- </logger>--> | ||
| 89 | 89 | ||
| 90 | <!--记录druid-sql的记录--> | 90 | <!--记录druid-sql的记录--> |
| 91 | <logger name="druid.sql.Statement" level="debug" additivity="true"> | 91 | <logger name="druid.sql.Statement" level="debug" additivity="true"> |
web_src/src/components/ParentPlatformList.vue
| @@ -47,8 +47,8 @@ | @@ -47,8 +47,8 @@ | ||
| 47 | <i v-if="!scope.row.alarmSubscribe" style="font-size: 20px" title="报警订阅" class="iconfont icon-gbaojings subscribe-off " ></i> | 47 | <i v-if="!scope.row.alarmSubscribe" style="font-size: 20px" title="报警订阅" class="iconfont icon-gbaojings subscribe-off " ></i> |
| 48 | <i v-if="scope.row.catalogSubscribe" title="目录订阅" class="iconfont icon-gjichus subscribe-on" ></i> | 48 | <i v-if="scope.row.catalogSubscribe" title="目录订阅" class="iconfont icon-gjichus subscribe-on" ></i> |
| 49 | <i v-if="!scope.row.catalogSubscribe" title="目录订阅" class="iconfont icon-gjichus subscribe-off" ></i> | 49 | <i v-if="!scope.row.catalogSubscribe" title="目录订阅" class="iconfont icon-gjichus subscribe-off" ></i> |
| 50 | - <i v-if="scope.row.gpsSubscribe" title="位置订阅" class="iconfont icon-gxunjians subscribe-on" ></i> | ||
| 51 | - <i v-if="!scope.row.gpsSubscribe" title="位置订阅" class="iconfont icon-gxunjians subscribe-off" ></i> | 50 | + <i v-if="scope.row.mobilePositionSubscribe" title="位置订阅" class="iconfont icon-gxunjians subscribe-on" ></i> |
| 51 | + <i v-if="!scope.row.mobilePositionSubscribe" title="位置订阅" class="iconfont icon-gxunjians subscribe-off" ></i> | ||
| 52 | </template> | 52 | </template> |
| 53 | </el-table-column> | 53 | </el-table-column> |
| 54 | 54 |
web_src/src/components/dialog/deviceEdit.vue
| @@ -39,6 +39,12 @@ | @@ -39,6 +39,12 @@ | ||
| 39 | <el-form-item label="目录订阅周期(0为停用订阅)" prop="subscribeCycleForCatalog" > | 39 | <el-form-item label="目录订阅周期(0为停用订阅)" prop="subscribeCycleForCatalog" > |
| 40 | <el-input v-model="form.subscribeCycleForCatalog" clearable ></el-input> | 40 | <el-input v-model="form.subscribeCycleForCatalog" clearable ></el-input> |
| 41 | </el-form-item> | 41 | </el-form-item> |
| 42 | + <el-form-item label="移动位置订阅周期(0为停用订阅)" prop="subscribeCycleForCatalog" > | ||
| 43 | + <el-input v-model="form.subscribeCycleForMobilePosition" clearable ></el-input> | ||
| 44 | + </el-form-item> | ||
| 45 | + <el-form-item label="移动位置报送间隔" prop="subscribeCycleForCatalog" > | ||
| 46 | + <el-input v-model="form.mobilePositionSubmissionInterval" clearable ></el-input> | ||
| 47 | + </el-form-item> | ||
| 42 | <el-form-item> | 48 | <el-form-item> |
| 43 | <div style="float: right;"> | 49 | <div style="float: right;"> |
| 44 | <el-button type="primary" @click="onSubmit" >确认</el-button> | 50 | <el-button type="primary" @click="onSubmit" >确认</el-button> |