Commit fff3d64f850b3ee61b9847cd80e7958c46cc6347
1 parent
f84eebdb
fix 优化pom依赖,去除几个重复客户端。并改了几个 equals判断不精准的bug
Showing
6 changed files
with
68 additions
and
61 deletions
pom.xml
| ... | ... | @@ -61,6 +61,13 @@ |
| 61 | 61 | <dependency> |
| 62 | 62 | <groupId>org.springframework.boot</groupId> |
| 63 | 63 | <artifactId>spring-boot-starter-data-redis</artifactId> |
| 64 | + <exclusions> | |
| 65 | + <!-- 去掉 Lettuce 的依赖, Spring Boot 优先使用 Lettuce 作为 Redis 客户端 --> | |
| 66 | + <exclusion> | |
| 67 | + <groupId>io.lettuce</groupId> | |
| 68 | + <artifactId>lettuce-core</artifactId> | |
| 69 | + </exclusion> | |
| 70 | + </exclusions> | |
| 64 | 71 | </dependency> |
| 65 | 72 | <dependency> |
| 66 | 73 | <groupId>org.springframework.boot</groupId> |
| ... | ... | @@ -75,6 +82,12 @@ |
| 75 | 82 | <groupId>org.mybatis.spring.boot</groupId> |
| 76 | 83 | <artifactId>mybatis-spring-boot-starter</artifactId> |
| 77 | 84 | <version>2.1.4</version> |
| 85 | + <exclusions> | |
| 86 | + <exclusion> | |
| 87 | + <groupId>com.zaxxer</groupId> | |
| 88 | + <artifactId>HikariCP</artifactId> | |
| 89 | + </exclusion> | |
| 90 | + </exclusions> | |
| 78 | 91 | </dependency> |
| 79 | 92 | <dependency> |
| 80 | 93 | <groupId>org.springframework.boot</groupId> |
| ... | ... | @@ -84,7 +97,6 @@ |
| 84 | 97 | <dependency> |
| 85 | 98 | <groupId>redis.clients</groupId> |
| 86 | 99 | <artifactId>jedis</artifactId> |
| 87 | - <version>${jedis-version}</version> | |
| 88 | 100 | </dependency> |
| 89 | 101 | |
| 90 | 102 | <!-- druid数据库连接池 --> | ... | ... |
src/main/java/com/genersoft/iot/vmp/conf/UserSetting.java
src/main/java/com/genersoft/iot/vmp/conf/security/DefaultUserDetailsServiceImpl.java
| 1 | 1 | package com.genersoft.iot.vmp.conf.security; |
| 2 | 2 | |
| 3 | -import com.genersoft.iot.vmp.conf.security.dto.LoginUser; | |
| 4 | -import com.genersoft.iot.vmp.service.IUserService; | |
| 5 | -import com.genersoft.iot.vmp.storager.dao.dto.User; | |
| 6 | -import com.github.xiaoymin.knife4j.core.util.StrUtil; | |
| 3 | +import java.time.LocalDateTime; | |
| 4 | + | |
| 7 | 5 | import org.slf4j.Logger; |
| 8 | 6 | import org.slf4j.LoggerFactory; |
| 9 | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -12,7 +10,10 @@ import org.springframework.security.core.userdetails.UserDetailsService; |
| 12 | 10 | import org.springframework.security.core.userdetails.UsernameNotFoundException; |
| 13 | 11 | import org.springframework.stereotype.Component; |
| 14 | 12 | |
| 15 | -import java.time.LocalDateTime; | |
| 13 | +import com.alibaba.excel.util.StringUtils; | |
| 14 | +import com.genersoft.iot.vmp.conf.security.dto.LoginUser; | |
| 15 | +import com.genersoft.iot.vmp.service.IUserService; | |
| 16 | +import com.genersoft.iot.vmp.storager.dao.dto.User; | |
| 16 | 17 | |
| 17 | 18 | /** |
| 18 | 19 | * 用户登录认证逻辑 |
| ... | ... | @@ -27,7 +28,7 @@ public class DefaultUserDetailsServiceImpl implements UserDetailsService { |
| 27 | 28 | |
| 28 | 29 | @Override |
| 29 | 30 | public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { |
| 30 | - if (StrUtil.isBlank(username)) { | |
| 31 | + if (StringUtils.isBlank(username)) { | |
| 31 | 32 | logger.info("登录用户:{} 不存在", username); |
| 32 | 33 | throw new UsernameNotFoundException("登录用户:" + username + " 不存在"); |
| 33 | 34 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/ByeRequestProcessor.java
| ... | ... | @@ -126,7 +126,7 @@ public class ByeRequestProcessor extends SIPRequestProcessorParent implements In |
| 126 | 126 | SsrcTransaction ssrcTransactionForPlay = streamSession.getSsrcTransaction(device.getDeviceId(), channelId, "play", null); |
| 127 | 127 | if (ssrcTransactionForPlay != null){ |
| 128 | 128 | SIPDialog dialogForPlay = (SIPDialog) SerializeUtils.deSerialize(ssrcTransactionForPlay.getDialog()); |
| 129 | - if (dialogForPlay.getCallId().equals(callIdHeader.getCallId())){ | |
| 129 | + if (dialogForPlay.getCallId().getCallId().equals(callIdHeader.getCallId())){ | |
| 130 | 130 | // 释放ssrc |
| 131 | 131 | MediaServerItem mediaServerItem = mediaServerService.getOne(ssrcTransactionForPlay.getMediaServerId()); |
| 132 | 132 | if (mediaServerItem != null) { | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
| 1 | 1 | package com.genersoft.iot.vmp.service.impl; |
| 2 | 2 | |
| 3 | +import java.time.LocalDateTime; | |
| 4 | +import java.util.ArrayList; | |
| 5 | +import java.util.Collections; | |
| 6 | +import java.util.HashMap; | |
| 7 | +import java.util.List; | |
| 8 | +import java.util.Map; | |
| 9 | +import java.util.Set; | |
| 10 | + | |
| 11 | +import org.slf4j.Logger; | |
| 12 | +import org.slf4j.LoggerFactory; | |
| 13 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 14 | +import org.springframework.beans.factory.annotation.Value; | |
| 15 | +import org.springframework.jdbc.datasource.DataSourceTransactionManager; | |
| 16 | +import org.springframework.stereotype.Service; | |
| 17 | +import org.springframework.transaction.TransactionDefinition; | |
| 18 | +import org.springframework.transaction.TransactionStatus; | |
| 19 | +import org.springframework.util.StringUtils; | |
| 20 | + | |
| 3 | 21 | import com.alibaba.fastjson.JSON; |
| 4 | 22 | import com.alibaba.fastjson.JSONArray; |
| 5 | 23 | import com.alibaba.fastjson.JSONObject; |
| 6 | 24 | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| 7 | 25 | import com.genersoft.iot.vmp.conf.SipConfig; |
| 8 | 26 | import com.genersoft.iot.vmp.conf.UserSetting; |
| 9 | -import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction; | |
| 10 | 27 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 11 | 28 | import com.genersoft.iot.vmp.gb28181.session.SsrcConfig; |
| 12 | 29 | import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; |
| ... | ... | @@ -15,30 +32,16 @@ import com.genersoft.iot.vmp.media.zlm.ZLMRTPServerFactory; |
| 15 | 32 | import com.genersoft.iot.vmp.media.zlm.ZLMServerConfig; |
| 16 | 33 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 17 | 34 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 18 | -import com.genersoft.iot.vmp.service.IStreamProxyService; | |
| 19 | 35 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; |
| 20 | -import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | |
| 21 | 36 | import com.genersoft.iot.vmp.storager.dao.MediaServerMapper; |
| 22 | 37 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 23 | 38 | import com.genersoft.iot.vmp.utils.redis.JedisUtil; |
| 24 | 39 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; |
| 25 | 40 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 26 | -import okhttp3.*; | |
| 27 | -import org.slf4j.Logger; | |
| 28 | -import org.slf4j.LoggerFactory; | |
| 29 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 30 | -import org.springframework.beans.factory.annotation.Value; | |
| 31 | -import org.springframework.jdbc.datasource.DataSourceTransactionManager; | |
| 32 | -import org.springframework.stereotype.Service; | |
| 33 | -import org.springframework.transaction.TransactionDefinition; | |
| 34 | -import org.springframework.transaction.TransactionStatus; | |
| 35 | -import org.springframework.util.StringUtils; | |
| 36 | 41 | |
| 37 | -import java.text.ParseException; | |
| 38 | -import java.text.SimpleDateFormat; | |
| 39 | -import java.time.LocalDateTime; | |
| 40 | -import java.util.*; | |
| 41 | -import java.util.stream.Collectors; | |
| 42 | +import okhttp3.OkHttpClient; | |
| 43 | +import okhttp3.Request; | |
| 44 | +import okhttp3.Response; | |
| 42 | 45 | |
| 43 | 46 | /** |
| 44 | 47 | * 媒体服务器节点管理 |
| ... | ... | @@ -82,12 +85,6 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 82 | 85 | private RedisUtil redisUtil; |
| 83 | 86 | |
| 84 | 87 | @Autowired |
| 85 | - private IVideoManagerStorage storager; | |
| 86 | - | |
| 87 | - @Autowired | |
| 88 | - private IStreamProxyService streamProxyService; | |
| 89 | - | |
| 90 | - @Autowired | |
| 91 | 88 | private EventPublisher publisher; |
| 92 | 89 | |
| 93 | 90 | @Autowired |
| ... | ... | @@ -600,9 +597,6 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 600 | 597 | boolean result = false; |
| 601 | 598 | OkHttpClient client = new OkHttpClient(); |
| 602 | 599 | String url = String.format("http://%s:%s/index/api/record", ip, port); |
| 603 | - | |
| 604 | - FormBody.Builder builder = new FormBody.Builder(); | |
| 605 | - | |
| 606 | 600 | Request request = new Request.Builder() |
| 607 | 601 | .get() |
| 608 | 602 | .url(url) |
| ... | ... | @@ -652,7 +646,7 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 652 | 646 | mediaServerItemMap.put(mediaServerItem.getId(), mediaServerItem); |
| 653 | 647 | } |
| 654 | 648 | for (MediaServerItem mediaServerItem : allInCatch) { |
| 655 | - if (mediaServerItemMap.get(mediaServerItem) == null) { | |
| 649 | + if (!mediaServerItemMap.containsKey(mediaServerItem.getId())) { | |
| 656 | 650 | delete(mediaServerItem.getId()); |
| 657 | 651 | } |
| 658 | 652 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
| 1 | 1 | package com.genersoft.iot.vmp.service.impl; |
| 2 | 2 | |
| 3 | +import java.math.BigDecimal; | |
| 4 | +import java.math.RoundingMode; | |
| 5 | +import java.util.List; | |
| 6 | +import java.util.Objects; | |
| 7 | +import java.util.UUID; | |
| 8 | + | |
| 9 | +import javax.sip.ResponseEvent; | |
| 10 | + | |
| 11 | +import org.slf4j.Logger; | |
| 12 | +import org.slf4j.LoggerFactory; | |
| 13 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 14 | +import org.springframework.http.HttpStatus; | |
| 15 | +import org.springframework.http.ResponseEntity; | |
| 16 | +import org.springframework.stereotype.Service; | |
| 17 | +import org.springframework.web.context.request.async.DeferredResult; | |
| 18 | + | |
| 3 | 19 | import com.alibaba.fastjson.JSON; |
| 4 | 20 | import com.alibaba.fastjson.JSONArray; |
| 5 | 21 | import com.alibaba.fastjson.JSONObject; |
| 6 | 22 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 7 | 23 | import com.genersoft.iot.vmp.conf.DynamicTask; |
| 8 | 24 | import com.genersoft.iot.vmp.conf.UserSetting; |
| 9 | -import com.genersoft.iot.vmp.gb28181.bean.*; | |
| 25 | +import com.genersoft.iot.vmp.gb28181.bean.Device; | |
| 26 | +import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | |
| 27 | +import com.genersoft.iot.vmp.gb28181.bean.InviteStreamCallback; | |
| 28 | +import com.genersoft.iot.vmp.gb28181.bean.InviteStreamInfo; | |
| 29 | +import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; | |
| 30 | +import com.genersoft.iot.vmp.gb28181.bean.SendRtpItem; | |
| 31 | +import com.genersoft.iot.vmp.gb28181.bean.SsrcTransaction; | |
| 10 | 32 | import com.genersoft.iot.vmp.gb28181.event.SipSubscribe; |
| 11 | 33 | import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; |
| 12 | 34 | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; |
| 13 | 35 | import com.genersoft.iot.vmp.gb28181.transmit.callback.RequestMessage; |
| 14 | 36 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; |
| 15 | 37 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; |
| 16 | -import com.genersoft.iot.vmp.utils.DateUtil; | |
| 17 | 38 | import com.genersoft.iot.vmp.media.zlm.AssistRESTfulUtils; |
| 18 | 39 | import com.genersoft.iot.vmp.media.zlm.ZLMHttpHookSubscribe; |
| 19 | 40 | import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; |
| ... | ... | @@ -27,23 +48,11 @@ import com.genersoft.iot.vmp.service.bean.PlayBackResult; |
| 27 | 48 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; |
| 28 | 49 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 29 | 50 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 51 | +import com.genersoft.iot.vmp.utils.DateUtil; | |
| 30 | 52 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; |
| 31 | 53 | import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.PlayResult; |
| 32 | -import gov.nist.javax.sip.stack.SIPDialog; | |
| 33 | -import org.slf4j.Logger; | |
| 34 | -import org.slf4j.LoggerFactory; | |
| 35 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 36 | -import org.springframework.http.HttpStatus; | |
| 37 | -import org.springframework.http.ResponseEntity; | |
| 38 | -import org.springframework.stereotype.Service; | |
| 39 | -import org.springframework.util.ResourceUtils; | |
| 40 | -import org.springframework.web.context.request.async.DeferredResult; | |
| 41 | 54 | |
| 42 | -import javax.sip.ResponseEvent; | |
| 43 | -import java.io.FileNotFoundException; | |
| 44 | -import java.math.BigDecimal; | |
| 45 | -import java.math.RoundingMode; | |
| 46 | -import java.util.*; | |
| 55 | +import gov.nist.javax.sip.stack.SIPDialog; | |
| 47 | 56 | |
| 48 | 57 | @SuppressWarnings(value = {"rawtypes", "unchecked"}) |
| 49 | 58 | @Service |
| ... | ... | @@ -531,14 +540,6 @@ public class PlayServiceImpl implements IPlayService { |
| 531 | 540 | StreamInfo streamInfo = onPublishHandler(inviteStreamInfo.getMediaServerItem(), inviteStreamInfo.getResponse(), deviceId, channelId); |
| 532 | 541 | streamInfo.setStartTime(startTime); |
| 533 | 542 | streamInfo.setEndTime(endTime); |
| 534 | - if (streamInfo == null) { | |
| 535 | - logger.warn("录像下载API调用失败!"); | |
| 536 | - wvpResult.setCode(-1); | |
| 537 | - wvpResult.setMsg("录像下载API调用失败"); | |
| 538 | - downloadResult.setCode(-1); | |
| 539 | - hookCallBack.call(downloadResult); | |
| 540 | - return ; | |
| 541 | - } | |
| 542 | 543 | redisCatchStorage.startDownload(streamInfo, inviteStreamInfo.getCallId()); |
| 543 | 544 | wvpResult.setCode(0); |
| 544 | 545 | wvpResult.setMsg("success"); | ... | ... |