diff --git a/src/main/java/com/genersoft/iot/vmp/conf/CivilCodeFileConf.java b/src/main/java/com/genersoft/iot/vmp/conf/CivilCodeFileConf.java index 15dd874a3..10c509562 100644 --- a/src/main/java/com/genersoft/iot/vmp/conf/CivilCodeFileConf.java +++ b/src/main/java/com/genersoft/iot/vmp/conf/CivilCodeFileConf.java @@ -23,7 +23,6 @@ import java.nio.file.Files; */ @Slf4j @Configuration -@Order(value=15) public class CivilCodeFileConf implements CommandLineRunner { @Autowired diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java b/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java index 0aa7e2ed6..1a4094ec6 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/SipLayer.java @@ -8,10 +8,9 @@ import com.genersoft.iot.vmp.gb28181.transmit.ISIPProcessorObserver; import com.genersoft.iot.vmp.utils.EnvUtil; import gov.nist.javax.sip.SipProviderImpl; import gov.nist.javax.sip.SipStackImpl; +import jakarta.annotation.PostConstruct; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.CommandLineRunner; -import org.springframework.core.annotation.Order; import org.springframework.stereotype.Component; import org.springframework.util.ObjectUtils; @@ -24,8 +23,7 @@ import java.util.concurrent.ConcurrentHashMap; @Slf4j @Component -@Order(value=10) -public class SipLayer implements CommandLineRunner { +public class SipLayer{ @Autowired private SipConfig sipConfig; @@ -40,8 +38,8 @@ public class SipLayer implements CommandLineRunner { private final Map udpSipProviderMap = new ConcurrentHashMap<>(); private final List monitorIps = new ArrayList<>(); - @Override - public void run(String... args) { + @PostConstruct + public void onApplicationReady(){ if (ObjectUtils.isEmpty(sipConfig.getIp())) { try { // 获得本机的所有网络接口 diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceServiceImpl.java index f7a3d74fd..8feb2389e 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/DeviceServiceImpl.java @@ -43,9 +43,8 @@ import gov.nist.javax.sip.message.SIPResponse; import jakarta.validation.constraints.NotNull; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.context.event.EventListener; -import org.springframework.core.annotation.Order; import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; @@ -65,8 +64,7 @@ import java.util.concurrent.TimeUnit; */ @Slf4j @Service -@Order(value=16) -public class DeviceServiceImpl implements IDeviceService, CommandLineRunner { +public class DeviceServiceImpl implements IDeviceService { @Autowired private ISIPCommander sipCommander; @@ -129,8 +127,8 @@ public class DeviceServiceImpl implements IDeviceService, CommandLineRunner { return deviceMapper.getDeviceByDeviceId(deviceId); } - @Override - public void run(String... args) throws Exception { + @EventListener(ApplicationReadyEvent.class) + public void onApplicationReady(){ // 清理数据库不存在但是 redis 中存在的数据 List devicesInDb = getAll(); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelServiceImpl.java index 628e5e3f6..c3a09d782 100644 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/GbChannelServiceImpl.java @@ -34,7 +34,8 @@ import org.locationtech.jts.geom.Point; import org.springframework.beans.BeanWrapper; import org.springframework.beans.BeanWrapperImpl; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.context.event.ApplicationReadyEvent; +import org.springframework.context.event.EventListener; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -49,7 +50,7 @@ import java.util.concurrent.atomic.AtomicReference; @Slf4j @Service -public class GbChannelServiceImpl implements IGbChannelService, CommandLineRunner { +public class GbChannelServiceImpl implements IGbChannelService { @Autowired private EventPublisher eventPublisher; @@ -81,8 +82,8 @@ public class GbChannelServiceImpl implements IGbChannelService, CommandLineRunne private final GeometryFactory geometryFactory = new GeometryFactory(); - @Override - public void run(String... args) throws Exception { + @EventListener(ApplicationReadyEvent.class) + public void onApplicationReady() { // 启动时重新发布抽稀图层 List channelList = commonGBChannelMapper.queryAllWithPosition(); Map> zoomCameraMap = new ConcurrentHashMap<>(); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformServiceImpl.java index 8acda4698..f6cc67863 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/service/impl/PlatformServiceImpl.java @@ -39,9 +39,8 @@ import com.github.pagehelper.PageInfo; import gov.nist.javax.sip.message.SIPResponse; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.context.event.EventListener; -import org.springframework.core.annotation.Order; import org.springframework.scheduling.annotation.Async; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; @@ -62,8 +61,7 @@ import java.util.concurrent.TimeUnit; */ @Slf4j @Service -@Order(value=15) -public class PlatformServiceImpl implements IPlatformService, CommandLineRunner { +public class PlatformServiceImpl implements IPlatformService { @Autowired private PlatformMapper platformMapper; @@ -116,8 +114,8 @@ public class PlatformServiceImpl implements IPlatformService, CommandLineRunner @Autowired private PlatformStatusTaskRunner statusTaskRunner; - @Override - public void run(String... args) throws Exception { + @EventListener(ApplicationReadyEvent.class) + public void onApplicationReady(){ // 查找国标推流 List sendRtpItems = redisCatchStorage.queryAllSendRTPServer(); diff --git a/src/main/java/com/genersoft/iot/vmp/gb28181/session/CatalogDataManager.java b/src/main/java/com/genersoft/iot/vmp/gb28181/session/CatalogDataManager.java index 88ac9d59c..a3b78d65a 100755 --- a/src/main/java/com/genersoft/iot/vmp/gb28181/session/CatalogDataManager.java +++ b/src/main/java/com/genersoft/iot/vmp/gb28181/session/CatalogDataManager.java @@ -6,7 +6,8 @@ import com.genersoft.iot.vmp.gb28181.service.IGroupService; import com.genersoft.iot.vmp.gb28181.service.IRegionService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.context.event.ApplicationReadyEvent; +import org.springframework.context.event.EventListener; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @@ -21,7 +22,7 @@ import java.util.concurrent.TimeUnit; @Slf4j @Component -public class CatalogDataManager implements CommandLineRunner { +public class CatalogDataManager{ @Autowired private IDeviceChannelService deviceChannelService; @@ -209,8 +210,8 @@ public class CatalogDataManager implements CommandLineRunner { return false; } - @Override - public void run(String... args) throws Exception { + @EventListener(ApplicationReadyEvent.class) + public void onApplicationReady(){ // 启动时清理旧的数据 redisTemplate.delete(key); } diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/codec/netty/TcpServer.java b/src/main/java/com/genersoft/iot/vmp/jt1078/codec/netty/TcpServer.java index 3996c3fa1..4c6212257 100644 --- a/src/main/java/com/genersoft/iot/vmp/jt1078/codec/netty/TcpServer.java +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/codec/netty/TcpServer.java @@ -18,13 +18,7 @@ import io.netty.channel.socket.nio.NioSocketChannel; import io.netty.handler.codec.DelimiterBasedFrameDecoder; import io.netty.handler.timeout.IdleStateHandler; import io.netty.util.concurrent.Future; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.CommandLineRunner; -import org.springframework.context.ApplicationContextInitializer; import org.springframework.context.ApplicationEventPublisher; -import org.springframework.stereotype.Component; import lombok.extern.slf4j.Slf4j; import java.util.concurrent.TimeUnit; diff --git a/src/main/java/com/genersoft/iot/vmp/jt1078/service/impl/jt1078ServiceImpl.java b/src/main/java/com/genersoft/iot/vmp/jt1078/service/impl/jt1078ServiceImpl.java index 342f4f52b..298cc9ad7 100644 --- a/src/main/java/com/genersoft/iot/vmp/jt1078/service/impl/jt1078ServiceImpl.java +++ b/src/main/java/com/genersoft/iot/vmp/jt1078/service/impl/jt1078ServiceImpl.java @@ -30,12 +30,12 @@ import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; import com.genersoft.iot.vmp.vmanager.bean.WVPResult; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; -import jakarta.annotation.PostConstruct; import jakarta.servlet.ServletOutputStream; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.ObjectUtils; import org.apache.ftpserver.usermanager.impl.BaseUser; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.context.event.EventListener; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.scheduling.annotation.Async; @@ -89,9 +89,9 @@ public class jt1078ServiceImpl implements Ijt1078Service { @Autowired private FtpDownloadManager downloadManager; - // 服务启动后五分钟内没有尽量连接的设备设置为离线 - @PostConstruct - public void init(){ + // 服务启动后五分钟内没有连接的设备设置为离线 + @EventListener(ApplicationReadyEvent.class) + public void onApplicationReady(){ // 检查session与在线终端是是否对应 不对应则设置终端离线 List deviceList = jtDeviceMapper.getDeviceList(null, true); if (deviceList.isEmpty()) { diff --git a/src/main/java/com/genersoft/iot/vmp/media/MediaServerConfig.java b/src/main/java/com/genersoft/iot/vmp/media/MediaServerConfig.java index ccd63089d..79ec635c4 100755 --- a/src/main/java/com/genersoft/iot/vmp/media/MediaServerConfig.java +++ b/src/main/java/com/genersoft/iot/vmp/media/MediaServerConfig.java @@ -7,9 +7,9 @@ import com.genersoft.iot.vmp.media.event.mediaServer.MediaServerChangeEvent; import com.genersoft.iot.vmp.media.service.IMediaServerService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.CommandLineRunner; +import org.springframework.boot.context.event.ApplicationReadyEvent; import org.springframework.context.ApplicationEventPublisher; -import org.springframework.core.annotation.Order; +import org.springframework.context.event.EventListener; import org.springframework.stereotype.Component; import java.util.List; @@ -19,8 +19,7 @@ import java.util.List; */ @Slf4j @Component -@Order(value=12) -public class MediaServerConfig implements CommandLineRunner { +public class MediaServerConfig{ @Autowired private ApplicationEventPublisher applicationEventPublisher; @@ -35,8 +34,8 @@ public class MediaServerConfig implements CommandLineRunner { private UserSetting userSetting; - @Override - public void run(String... strings) throws Exception { + @EventListener(ApplicationReadyEvent.class) + public void onApplicationReady(){ // 清理所有在线节点的缓存信息 mediaServerService.clearMediaServerForOnline(); MediaServer mediaSerItemInConfig = mediaConfig.buildMediaSer(); diff --git a/web/src/views/streamProxy/index.vue b/web/src/views/streamProxy/index.vue index ccde54d38..1d2901461 100755 --- a/web/src/views/streamProxy/index.vue +++ b/web/src/views/streamProxy/index.vue @@ -255,11 +255,8 @@ export default { }, stopPlay: function(row) { this.$store.dispatch('streamProxy/stopPlay', row.id) - .then((data) => { - this.$refs.devicePlayer.openDialog('streamPlay', null, null, { - streamInfo: data, - hasAudio: true - }) + .then(() => { + this.getStreamProxyList() }) .catch((error) => { this.$message({