Commit e2e22b46ba8911faa509982d6a6bbc4697e900a5
1 parent
93d6404b
fix():添加历史回放视频上传和下载
Showing
79 changed files
with
449 additions
and
557 deletions
Too many changes to show.
To preserve performance only 79 of 80 files are displayed.
pom.xml
| ... | ... | @@ -155,10 +155,29 @@ |
| 155 | 155 | </exclusions> |
| 156 | 156 | </dependency> |
| 157 | 157 | <dependency> |
| 158 | + <groupId>org.mybatis</groupId> | |
| 159 | + <artifactId>mybatis</artifactId> | |
| 160 | + <version>3.5.16</version> | |
| 161 | + </dependency> | |
| 162 | + <dependency> | |
| 158 | 163 | <groupId>org.springframework.boot</groupId> |
| 159 | 164 | <artifactId>spring-boot-starter-security</artifactId> |
| 160 | 165 | </dependency> |
| 161 | 166 | |
| 167 | + <!-- mybatis-plus --> | |
| 168 | + <dependency> | |
| 169 | + <groupId>com.baomidou</groupId> | |
| 170 | + <artifactId>mybatis-plus-boot-starter</artifactId> | |
| 171 | + <version>3.5.5</version> | |
| 172 | + </dependency> | |
| 173 | + | |
| 174 | + <!-- mybatis-plus-join --> | |
| 175 | + <dependency> | |
| 176 | + <groupId>com.github.yulichang</groupId> | |
| 177 | + <artifactId>mybatis-plus-join-boot-starter</artifactId> | |
| 178 | + <version>1.5.2</version> | |
| 179 | + </dependency> | |
| 180 | + | |
| 162 | 181 | <dependency> |
| 163 | 182 | <groupId>org.springframework.boot</groupId> |
| 164 | 183 | <artifactId>spring-boot-starter-jdbc</artifactId> | ... | ... |
src/main/java/com/genersoft/iot/vmp/VManageBootstrap.java
src/main/java/com/genersoft/iot/vmp/conf/ApiAccessFilter.java
| 1 | 1 | package com.genersoft.iot.vmp.conf; |
| 2 | 2 | |
| 3 | 3 | import com.genersoft.iot.vmp.common.ApiSaveConstant; |
| 4 | -import com.genersoft.iot.vmp.conf.security.IpWhitelistFilter; | |
| 5 | 4 | import com.genersoft.iot.vmp.conf.security.SecurityUtils; |
| 6 | -import com.genersoft.iot.vmp.conf.security.WebSecurityConfig; | |
| 7 | 5 | import com.genersoft.iot.vmp.service.ILogService; |
| 8 | -import com.genersoft.iot.vmp.storager.dao.dto.LogDto; | |
| 6 | +import com.genersoft.iot.vmp.storager.mapper.dto.LogDto; | |
| 9 | 7 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 10 | 8 | import org.apache.commons.lang3.StringUtils; |
| 11 | 9 | import org.slf4j.Logger; | ... | ... |
src/main/java/com/genersoft/iot/vmp/conf/CloudRecordTimer.java
| ... | ... | @@ -2,13 +2,11 @@ package com.genersoft.iot.vmp.conf; |
| 2 | 2 | |
| 3 | 3 | |
| 4 | 4 | import com.alibaba.fastjson2.JSONObject; |
| 5 | -import com.genersoft.iot.vmp.media.zlm.AssistRESTfulUtils; | |
| 6 | 5 | import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; |
| 7 | 6 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 8 | 7 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 9 | 8 | import com.genersoft.iot.vmp.service.bean.CloudRecordItem; |
| 10 | -import com.genersoft.iot.vmp.storager.dao.CloudRecordServiceMapper; | |
| 11 | -import com.genersoft.iot.vmp.vmanager.cloudRecord.CloudRecordController; | |
| 9 | +import com.genersoft.iot.vmp.storager.mapper.CloudRecordServiceMapper; | |
| 12 | 10 | import org.slf4j.Logger; |
| 13 | 11 | import org.slf4j.LoggerFactory; |
| 14 | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -16,7 +14,6 @@ import org.springframework.scheduling.annotation.Scheduled; |
| 16 | 14 | import org.springframework.stereotype.Component; |
| 17 | 15 | |
| 18 | 16 | import java.io.File; |
| 19 | -import java.util.ArrayList; | |
| 20 | 17 | import java.util.Calendar; |
| 21 | 18 | import java.util.Date; |
| 22 | 19 | import java.util.List; | ... | ... |
src/main/java/com/genersoft/iot/vmp/conf/GlobalResponseAdvice.java
| ... | ... | @@ -32,7 +32,7 @@ public class GlobalResponseAdvice implements ResponseBodyAdvice<Object> { |
| 32 | 32 | @Override |
| 33 | 33 | public Object beforeBodyWrite(Object body, @NotNull MethodParameter returnType, @NotNull MediaType selectedContentType, @NotNull Class<? extends HttpMessageConverter<?>> selectedConverterType, @NotNull ServerHttpRequest request, @NotNull ServerHttpResponse response) { |
| 34 | 34 | // 排除api文档的接口,这个接口不需要统一 |
| 35 | - String[] excludePath = {"/v3/api-docs","/api/v1","/index/hook","/api/video-"}; | |
| 35 | + String[] excludePath = {"/v3/api-docs","/api/v1","/index/hook","/api/video-","/api/jt1078/query/history/download/"}; | |
| 36 | 36 | for (String path : excludePath) { |
| 37 | 37 | if (request.getURI().getPath().startsWith(path)) { |
| 38 | 38 | return body; | ... | ... |
src/main/java/com/genersoft/iot/vmp/conf/MybatisConfig.java deleted
100644 → 0
| 1 | -package com.genersoft.iot.vmp.conf; | |
| 2 | - | |
| 3 | -import org.apache.ibatis.logging.stdout.StdOutImpl; | |
| 4 | -import org.apache.ibatis.session.SqlSessionFactory; | |
| 5 | -import org.mybatis.spring.SqlSessionFactoryBean; | |
| 6 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 7 | -import org.springframework.context.annotation.Bean; | |
| 8 | -import org.springframework.context.annotation.Configuration; | |
| 9 | -import org.springframework.core.annotation.Order; | |
| 10 | - | |
| 11 | -import javax.sql.DataSource; | |
| 12 | - | |
| 13 | -/** | |
| 14 | - * 配置mybatis | |
| 15 | - */ | |
| 16 | -@Configuration | |
| 17 | -@Order(value=1) | |
| 18 | -public class MybatisConfig { | |
| 19 | - | |
| 20 | - @Autowired | |
| 21 | - private UserSetting userSetting; | |
| 22 | - | |
| 23 | - @Bean | |
| 24 | - public SqlSessionFactory sqlSessionFactory(DataSource dataSource) throws Exception { | |
| 25 | - final SqlSessionFactoryBean sqlSessionFactory = new SqlSessionFactoryBean(); | |
| 26 | - sqlSessionFactory.setDataSource(dataSource); | |
| 27 | - org.apache.ibatis.session.Configuration config = new org.apache.ibatis.session.Configuration(); | |
| 28 | - if (userSetting.getSqlLog()){ | |
| 29 | - config.setLogImpl(StdOutImpl.class); | |
| 30 | - } | |
| 31 | - config.setMapUnderscoreToCamelCase(true); | |
| 32 | - sqlSessionFactory.setConfiguration(config); | |
| 33 | - return sqlSessionFactory.getObject(); | |
| 34 | - } | |
| 35 | - | |
| 36 | -} |
src/main/java/com/genersoft/iot/vmp/conf/MybatisPlusConfig.java
0 → 100644
| 1 | +package com.genersoft.iot.vmp.conf; | |
| 2 | + | |
| 3 | +import com.baomidou.mybatisplus.annotation.DbType; | |
| 4 | +import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; | |
| 5 | +import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor; | |
| 6 | +import org.mybatis.spring.annotation.MapperScan; | |
| 7 | +import org.springframework.context.annotation.Bean; | |
| 8 | +import org.springframework.context.annotation.Configuration; | |
| 9 | + | |
| 10 | +/** | |
| 11 | + * mybatis-plus分页配置 | |
| 12 | + * | |
| 13 | + * @Author WangXin | |
| 14 | + * @Data 2024/12/4 | |
| 15 | + * @Version 1.0.0 | |
| 16 | + */ | |
| 17 | +@Configuration | |
| 18 | +@MapperScan("com.genersoft.iot.vmp.**.mapper") | |
| 19 | +public class MybatisPlusConfig { | |
| 20 | + | |
| 21 | + @Bean | |
| 22 | + public MybatisPlusInterceptor mybatisPlusInterceptor() { | |
| 23 | + MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor(); | |
| 24 | + mybatisPlusInterceptor.addInnerInterceptor(new PaginationInnerInterceptor(DbType.MYSQL)); | |
| 25 | + return mybatisPlusInterceptor; | |
| 26 | + } | |
| 27 | +} | ... | ... |
src/main/java/com/genersoft/iot/vmp/conf/security/DefaultUserDetailsServiceImpl.java
| ... | ... | @@ -3,7 +3,7 @@ package com.genersoft.iot.vmp.conf.security; |
| 3 | 3 | import com.alibaba.excel.util.StringUtils; |
| 4 | 4 | import com.genersoft.iot.vmp.conf.security.dto.LoginUser; |
| 5 | 5 | import com.genersoft.iot.vmp.service.IUserService; |
| 6 | -import com.genersoft.iot.vmp.storager.dao.dto.User; | |
| 6 | +import com.genersoft.iot.vmp.storager.mapper.dto.User; | |
| 7 | 7 | import org.slf4j.Logger; |
| 8 | 8 | import org.slf4j.LoggerFactory; |
| 9 | 9 | import org.springframework.beans.factory.annotation.Autowired; | ... | ... |
src/main/java/com/genersoft/iot/vmp/conf/security/JwtAuthenticationFilter.java
| ... | ... | @@ -2,8 +2,8 @@ package com.genersoft.iot.vmp.conf.security; |
| 2 | 2 | |
| 3 | 3 | import com.genersoft.iot.vmp.conf.UserSetting; |
| 4 | 4 | import com.genersoft.iot.vmp.conf.security.dto.JwtUser; |
| 5 | -import com.genersoft.iot.vmp.storager.dao.dto.Role; | |
| 6 | -import com.genersoft.iot.vmp.storager.dao.dto.User; | |
| 5 | +import com.genersoft.iot.vmp.storager.mapper.dto.Role; | |
| 6 | +import com.genersoft.iot.vmp.storager.mapper.dto.User; | |
| 7 | 7 | import org.apache.commons.lang3.StringUtils; |
| 8 | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | 9 | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; | ... | ... |
src/main/java/com/genersoft/iot/vmp/conf/security/JwtUtils.java
| ... | ... | @@ -2,7 +2,7 @@ package com.genersoft.iot.vmp.conf.security; |
| 2 | 2 | |
| 3 | 3 | import com.genersoft.iot.vmp.conf.security.dto.JwtUser; |
| 4 | 4 | import com.genersoft.iot.vmp.service.IUserService; |
| 5 | -import com.genersoft.iot.vmp.storager.dao.dto.User; | |
| 5 | +import com.genersoft.iot.vmp.storager.mapper.dto.User; | |
| 6 | 6 | import org.jose4j.jwk.RsaJsonWebKey; |
| 7 | 7 | import org.jose4j.jwk.RsaJwkGenerator; |
| 8 | 8 | import org.jose4j.jws.AlgorithmIdentifiers; | ... | ... |
src/main/java/com/genersoft/iot/vmp/conf/security/SecurityUtils.java
| 1 | 1 | package com.genersoft.iot.vmp.conf.security; |
| 2 | 2 | |
| 3 | 3 | import com.genersoft.iot.vmp.conf.security.dto.LoginUser; |
| 4 | -import com.genersoft.iot.vmp.storager.dao.dto.User; | |
| 4 | +import com.genersoft.iot.vmp.storager.mapper.dto.User; | |
| 5 | 5 | import org.springframework.security.authentication.AuthenticationManager; |
| 6 | 6 | import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
| 7 | 7 | import org.springframework.security.core.Authentication; | ... | ... |
src/main/java/com/genersoft/iot/vmp/conf/security/dto/LoginUser.java
| 1 | 1 | package com.genersoft.iot.vmp.conf.security.dto; |
| 2 | 2 | |
| 3 | -import com.genersoft.iot.vmp.storager.dao.dto.Role; | |
| 4 | -import com.genersoft.iot.vmp.storager.dao.dto.User; | |
| 3 | +import com.genersoft.iot.vmp.storager.mapper.dto.Role; | |
| 4 | +import com.genersoft.iot.vmp.storager.mapper.dto.User; | |
| 5 | 5 | import org.springframework.security.core.CredentialsContainer; |
| 6 | 6 | import org.springframework.security.core.GrantedAuthority; |
| 7 | 7 | import org.springframework.security.core.SpringSecurityCoreVersion; | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/cmd/impl/SIPCommanderFroPlatform.java
| ... | ... | @@ -23,7 +23,7 @@ import com.genersoft.iot.vmp.service.IMediaServerService; |
| 23 | 23 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| 24 | 24 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; |
| 25 | 25 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 26 | -import com.genersoft.iot.vmp.storager.dao.dto.PlatformRegisterInfo; | |
| 26 | +import com.genersoft.iot.vmp.storager.mapper.dto.PlatformRegisterInfo; | |
| 27 | 27 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 28 | 28 | import com.genersoft.iot.vmp.utils.GitUtil; |
| 29 | 29 | import gov.nist.javax.sip.message.MessageFactoryImpl; | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/message/query/cmd/RecordInfoQueryMessageHandler.java
| ... | ... | @@ -11,7 +11,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.IMessag |
| 11 | 11 | import com.genersoft.iot.vmp.gb28181.transmit.event.request.impl.message.query.QueryMessageHandler; |
| 12 | 12 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 13 | 13 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 14 | -import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo; | |
| 14 | +import com.genersoft.iot.vmp.storager.mapper.dto.ChannelSourceInfo; | |
| 15 | 15 | import gov.nist.javax.sip.message.SIPRequest; |
| 16 | 16 | import org.dom4j.Element; |
| 17 | 17 | import org.slf4j.Logger; | ... | ... |
src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/response/impl/RegisterResponseProcessor.java
| ... | ... | @@ -10,7 +10,7 @@ import com.genersoft.iot.vmp.gb28181.transmit.event.response.SIPResponseProcesso |
| 10 | 10 | import com.genersoft.iot.vmp.service.IPlatformService; |
| 11 | 11 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 12 | 12 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 13 | -import com.genersoft.iot.vmp.storager.dao.dto.PlatformRegisterInfo; | |
| 13 | +import com.genersoft.iot.vmp.storager.mapper.dto.PlatformRegisterInfo; | |
| 14 | 14 | import gov.nist.javax.sip.message.SIPResponse; |
| 15 | 15 | import org.slf4j.Logger; |
| 16 | 16 | import org.slf4j.LoggerFactory; |
| ... | ... | @@ -24,10 +24,10 @@ import javax.sip.header.WWWAuthenticateHeader; |
| 24 | 24 | import javax.sip.message.Response; |
| 25 | 25 | import java.text.ParseException; |
| 26 | 26 | |
| 27 | -/** | |
| 27 | +/** | |
| 28 | 28 | * @description:Register响应处理器 |
| 29 | 29 | * @author: swwheihei |
| 30 | - * @date: 2020年5月3日 下午5:32:23 | |
| 30 | + * @date: 2020年5月3日 下午5:32:23 | |
| 31 | 31 | */ |
| 32 | 32 | @Component |
| 33 | 33 | public class RegisterResponseProcessor extends SIPResponseProcessorAbstract { | ... | ... |
src/main/java/com/genersoft/iot/vmp/jtt1078/app/VideoServerApp.java
| ... | ... | @@ -46,10 +46,10 @@ public class VideoServerApp |
| 46 | 46 | case "wx-local": |
| 47 | 47 | configProperties = "/app.properties"; |
| 48 | 48 | break; |
| 49 | - case "dev100": | |
| 49 | + case "jt1078-dev100": | |
| 50 | 50 | configProperties = "/app-dev100.properties"; |
| 51 | 51 | break; |
| 52 | - case "dev103": | |
| 52 | + case "jt1078-dev103": | |
| 53 | 53 | configProperties = "/app-dev103.properties"; |
| 54 | 54 | break; |
| 55 | 55 | default: | ... | ... |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java
| ... | ... | @@ -9,9 +9,9 @@ import com.genersoft.iot.vmp.service.IStreamProxyService; |
| 9 | 9 | import com.genersoft.iot.vmp.service.IStreamPushService; |
| 10 | 10 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 11 | 11 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 12 | -import com.genersoft.iot.vmp.storager.dao.GbStreamMapper; | |
| 13 | -import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper; | |
| 14 | -import com.genersoft.iot.vmp.storager.dao.StreamPushMapper; | |
| 12 | +import com.genersoft.iot.vmp.storager.mapper.GbStreamMapper; | |
| 13 | +import com.genersoft.iot.vmp.storager.mapper.PlatformGbStreamMapper; | |
| 14 | +import com.genersoft.iot.vmp.storager.mapper.StreamPushMapper; | |
| 15 | 15 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 16 | 16 | import org.slf4j.Logger; |
| 17 | 17 | import org.slf4j.LoggerFactory; | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/ILogService.java
src/main/java/com/genersoft/iot/vmp/service/IRoleService.java
src/main/java/com/genersoft/iot/vmp/service/IUserService.java
src/main/java/com/genersoft/iot/vmp/service/impl/CloudRecordServiceImpl.java
| ... | ... | @@ -14,7 +14,7 @@ import com.genersoft.iot.vmp.service.IMediaServerService; |
| 14 | 14 | import com.genersoft.iot.vmp.service.bean.CloudRecordItem; |
| 15 | 15 | import com.genersoft.iot.vmp.service.bean.DownloadFileInfo; |
| 16 | 16 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 17 | -import com.genersoft.iot.vmp.storager.dao.CloudRecordServiceMapper; | |
| 17 | +import com.genersoft.iot.vmp.storager.mapper.CloudRecordServiceMapper; | |
| 18 | 18 | import com.genersoft.iot.vmp.utils.CloudRecordUtils; |
| 19 | 19 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 20 | 20 | import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceAlarmServiceImpl.java
| ... | ... | @@ -2,9 +2,8 @@ package com.genersoft.iot.vmp.service.impl; |
| 2 | 2 | |
| 3 | 3 | import com.baomidou.dynamic.datasource.annotation.DS; |
| 4 | 4 | import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm; |
| 5 | -import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; | |
| 6 | 5 | import com.genersoft.iot.vmp.service.IDeviceAlarmService; |
| 7 | -import com.genersoft.iot.vmp.storager.dao.DeviceAlarmMapper; | |
| 6 | +import com.genersoft.iot.vmp.storager.mapper.DeviceAlarmMapper; | |
| 8 | 7 | import com.github.pagehelper.PageHelper; |
| 9 | 8 | import com.github.pagehelper.PageInfo; |
| 10 | 9 | import org.springframework.beans.factory.annotation.Autowired; | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceChannelServiceImpl.java
| ... | ... | @@ -13,9 +13,9 @@ import com.genersoft.iot.vmp.gb28181.utils.Coordtransform; |
| 13 | 13 | import com.genersoft.iot.vmp.service.IDeviceChannelService; |
| 14 | 14 | import com.genersoft.iot.vmp.service.IInviteStreamService; |
| 15 | 15 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 16 | -import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper; | |
| 17 | -import com.genersoft.iot.vmp.storager.dao.DeviceMapper; | |
| 18 | -import com.genersoft.iot.vmp.storager.dao.DeviceMobilePositionMapper; | |
| 16 | +import com.genersoft.iot.vmp.storager.mapper.DeviceChannelMapper; | |
| 17 | +import com.genersoft.iot.vmp.storager.mapper.DeviceMapper; | |
| 18 | +import com.genersoft.iot.vmp.storager.mapper.DeviceMobilePositionMapper; | |
| 19 | 19 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 20 | 20 | import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo; |
| 21 | 21 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/DeviceServiceImpl.java
| ... | ... | @@ -22,9 +22,9 @@ import com.genersoft.iot.vmp.service.IDeviceService; |
| 22 | 22 | import com.genersoft.iot.vmp.service.IInviteStreamService; |
| 23 | 23 | import com.genersoft.iot.vmp.service.IMediaServerService; |
| 24 | 24 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 25 | -import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper; | |
| 26 | -import com.genersoft.iot.vmp.storager.dao.DeviceMapper; | |
| 27 | -import com.genersoft.iot.vmp.storager.dao.PlatformChannelMapper; | |
| 25 | +import com.genersoft.iot.vmp.storager.mapper.DeviceChannelMapper; | |
| 26 | +import com.genersoft.iot.vmp.storager.mapper.DeviceMapper; | |
| 27 | +import com.genersoft.iot.vmp.storager.mapper.PlatformChannelMapper; | |
| 28 | 28 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 29 | 29 | import com.genersoft.iot.vmp.vmanager.bean.BaseTree; |
| 30 | 30 | import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo; | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java
| ... | ... | @@ -6,10 +6,10 @@ import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 6 | 6 | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; |
| 7 | 7 | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| 8 | 8 | import com.genersoft.iot.vmp.service.IGbStreamService; |
| 9 | -import com.genersoft.iot.vmp.storager.dao.GbStreamMapper; | |
| 10 | -import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper; | |
| 11 | -import com.genersoft.iot.vmp.storager.dao.PlatformCatalogMapper; | |
| 12 | -import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper; | |
| 9 | +import com.genersoft.iot.vmp.storager.mapper.GbStreamMapper; | |
| 10 | +import com.genersoft.iot.vmp.storager.mapper.ParentPlatformMapper; | |
| 11 | +import com.genersoft.iot.vmp.storager.mapper.PlatformCatalogMapper; | |
| 12 | +import com.genersoft.iot.vmp.storager.mapper.PlatformGbStreamMapper; | |
| 13 | 13 | import com.github.pagehelper.PageHelper; |
| 14 | 14 | import com.github.pagehelper.PageInfo; |
| 15 | 15 | import org.slf4j.Logger; | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/LogServiceImpl.java
| 1 | 1 | package com.genersoft.iot.vmp.service.impl; |
| 2 | 2 | |
| 3 | 3 | import com.baomidou.dynamic.datasource.annotation.DS; |
| 4 | -import com.genersoft.iot.vmp.gb28181.bean.DeviceAlarm; | |
| 5 | 4 | import com.genersoft.iot.vmp.service.ILogService; |
| 6 | -import com.genersoft.iot.vmp.storager.dao.LogMapper; | |
| 7 | -import com.genersoft.iot.vmp.storager.dao.dto.LogDto; | |
| 5 | +import com.genersoft.iot.vmp.storager.mapper.LogMapper; | |
| 6 | +import com.genersoft.iot.vmp.storager.mapper.dto.LogDto; | |
| 8 | 7 | import com.github.pagehelper.PageHelper; |
| 9 | 8 | import com.github.pagehelper.PageInfo; |
| 10 | 9 | import org.springframework.beans.factory.annotation.Autowired; | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
| ... | ... | @@ -20,12 +20,11 @@ import com.genersoft.iot.vmp.service.IMediaServerService; |
| 20 | 20 | import com.genersoft.iot.vmp.service.bean.MediaServerLoad; |
| 21 | 21 | import com.genersoft.iot.vmp.service.bean.SSRCInfo; |
| 22 | 22 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 23 | -import com.genersoft.iot.vmp.storager.dao.MediaServerMapper; | |
| 23 | +import com.genersoft.iot.vmp.storager.mapper.MediaServerMapper; | |
| 24 | 24 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 25 | 25 | import com.genersoft.iot.vmp.utils.JsonUtil; |
| 26 | 26 | import com.genersoft.iot.vmp.utils.redis.RedisUtil; |
| 27 | 27 | import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; |
| 28 | -import com.genersoft.iot.vmp.vmanager.bean.RecordFile; | |
| 29 | 28 | import okhttp3.OkHttpClient; |
| 30 | 29 | import okhttp3.Request; |
| 31 | 30 | import okhttp3.Response; |
| ... | ... | @@ -36,19 +35,16 @@ import org.springframework.beans.factory.annotation.Qualifier; |
| 36 | 35 | import org.springframework.beans.factory.annotation.Value; |
| 37 | 36 | import org.springframework.data.redis.core.RedisTemplate; |
| 38 | 37 | import org.springframework.jdbc.datasource.DataSourceTransactionManager; |
| 39 | -import org.springframework.scheduling.annotation.Async; | |
| 40 | 38 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| 41 | 39 | import org.springframework.stereotype.Service; |
| 42 | 40 | import org.springframework.transaction.TransactionDefinition; |
| 43 | 41 | import org.springframework.transaction.TransactionStatus; |
| 44 | -import org.springframework.util.Assert; | |
| 45 | 42 | import org.springframework.util.ObjectUtils; |
| 46 | 43 | |
| 44 | +import javax.annotation.Resource; | |
| 47 | 45 | import java.io.File; |
| 48 | 46 | import java.time.LocalDateTime; |
| 49 | 47 | import java.util.*; |
| 50 | -import java.util.concurrent.CompletableFuture; | |
| 51 | -import java.util.concurrent.ExecutionException; | |
| 52 | 48 | |
| 53 | 49 | /** |
| 54 | 50 | * 媒体服务器节点管理 |
| ... | ... | @@ -85,7 +81,7 @@ public class MediaServerServiceImpl implements IMediaServerService { |
| 85 | 81 | @Autowired |
| 86 | 82 | private ZLMRESTfulUtils zlmresTfulUtils; |
| 87 | 83 | |
| 88 | - @Autowired | |
| 84 | + @Resource | |
| 89 | 85 | private MediaServerMapper mediaServerMapper; |
| 90 | 86 | |
| 91 | 87 | @Autowired | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/PlatformChannelServiceImpl.java
| ... | ... | @@ -5,10 +5,10 @@ import com.genersoft.iot.vmp.gb28181.bean.*; |
| 5 | 5 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 6 | 6 | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; |
| 7 | 7 | import com.genersoft.iot.vmp.service.IPlatformChannelService; |
| 8 | -import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper; | |
| 9 | -import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper; | |
| 10 | -import com.genersoft.iot.vmp.storager.dao.PlatformCatalogMapper; | |
| 11 | -import com.genersoft.iot.vmp.storager.dao.PlatformChannelMapper; | |
| 8 | +import com.genersoft.iot.vmp.storager.mapper.DeviceChannelMapper; | |
| 9 | +import com.genersoft.iot.vmp.storager.mapper.ParentPlatformMapper; | |
| 10 | +import com.genersoft.iot.vmp.storager.mapper.PlatformCatalogMapper; | |
| 11 | +import com.genersoft.iot.vmp.storager.mapper.PlatformChannelMapper; | |
| 12 | 12 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; |
| 13 | 13 | import org.slf4j.Logger; |
| 14 | 14 | import org.slf4j.LoggerFactory; | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/PlatformServiceImpl.java
| ... | ... | @@ -15,8 +15,6 @@ import com.genersoft.iot.vmp.gb28181.session.VideoStreamSessionManager; |
| 15 | 15 | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommanderFroPlatform; |
| 16 | 16 | import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; |
| 17 | 17 | import com.genersoft.iot.vmp.media.zlm.ZlmHttpHookSubscribe; |
| 18 | -import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeFactory; | |
| 19 | -import com.genersoft.iot.vmp.media.zlm.dto.HookSubscribeForStreamChange; | |
| 20 | 18 | import com.genersoft.iot.vmp.gb28181.utils.SipUtils; |
| 21 | 19 | import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory; |
| 22 | 20 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| ... | ... | @@ -27,11 +25,10 @@ import com.genersoft.iot.vmp.service.IPlatformService; |
| 27 | 25 | import com.genersoft.iot.vmp.service.IPlayService; |
| 28 | 26 | import com.genersoft.iot.vmp.service.bean.*; |
| 29 | 27 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 30 | -import com.genersoft.iot.vmp.storager.dao.*; | |
| 28 | +import com.genersoft.iot.vmp.storager.mapper.*; | |
| 31 | 29 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 32 | 30 | import com.github.pagehelper.PageHelper; |
| 33 | 31 | import com.github.pagehelper.PageInfo; |
| 34 | -import gov.nist.javax.sip.message.SIPRequest; | |
| 35 | 32 | import gov.nist.javax.sip.message.SIPResponse; |
| 36 | 33 | import org.slf4j.Logger; |
| 37 | 34 | import org.slf4j.LoggerFactory; |
| ... | ... | @@ -41,17 +38,12 @@ import org.springframework.stereotype.Service; |
| 41 | 38 | import javax.sdp.*; |
| 42 | 39 | import javax.sip.InvalidArgumentException; |
| 43 | 40 | import javax.sip.ResponseEvent; |
| 44 | -import javax.sip.PeerUnavailableException; | |
| 45 | 41 | import javax.sip.SipException; |
| 46 | 42 | import java.text.ParseException; |
| 47 | 43 | import java.util.HashMap; |
| 48 | 44 | import java.util.List; |
| 49 | 45 | import java.util.Map; |
| 50 | 46 | import java.util.UUID; |
| 51 | -import java.util.HashMap; | |
| 52 | -import java.util.List; | |
| 53 | -import java.util.Map; | |
| 54 | -import java.util.UUID; | |
| 55 | 47 | import java.util.*; |
| 56 | 48 | |
| 57 | 49 | /** | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/PlayServiceImpl.java
| ... | ... | @@ -34,7 +34,7 @@ import com.genersoft.iot.vmp.service.bean.*; |
| 34 | 34 | import com.genersoft.iot.vmp.service.redisMsg.RedisGbPlayMsgListener; |
| 35 | 35 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 36 | 36 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 37 | -import com.genersoft.iot.vmp.storager.dao.CloudRecordServiceMapper; | |
| 37 | +import com.genersoft.iot.vmp.storager.mapper.CloudRecordServiceMapper; | |
| 38 | 38 | import com.genersoft.iot.vmp.utils.CloudRecordUtils; |
| 39 | 39 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 40 | 40 | import com.genersoft.iot.vmp.vmanager.bean.AudioBroadcastResult; | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/RoleServerImpl.java
| ... | ... | @@ -2,8 +2,8 @@ package com.genersoft.iot.vmp.service.impl; |
| 2 | 2 | |
| 3 | 3 | import com.baomidou.dynamic.datasource.annotation.DS; |
| 4 | 4 | import com.genersoft.iot.vmp.service.IRoleService; |
| 5 | -import com.genersoft.iot.vmp.storager.dao.RoleMapper; | |
| 6 | -import com.genersoft.iot.vmp.storager.dao.dto.Role; | |
| 5 | +import com.genersoft.iot.vmp.storager.mapper.RoleMapper; | |
| 6 | +import com.genersoft.iot.vmp.storager.mapper.dto.Role; | |
| 7 | 7 | import org.springframework.beans.factory.annotation.Autowired; |
| 8 | 8 | import org.springframework.stereotype.Service; |
| 9 | 9 | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java
| ... | ... | @@ -3,14 +3,12 @@ package com.genersoft.iot.vmp.service.impl; |
| 3 | 3 | import com.alibaba.fastjson2.JSONArray; |
| 4 | 4 | import com.alibaba.fastjson2.JSONObject; |
| 5 | 5 | import com.baomidou.dynamic.datasource.annotation.DS; |
| 6 | -import com.genersoft.iot.vmp.VManageBootstrap; | |
| 7 | 6 | import com.genersoft.iot.vmp.common.GeneralCallback; |
| 8 | 7 | import com.genersoft.iot.vmp.common.StreamInfo; |
| 9 | 8 | import com.genersoft.iot.vmp.conf.DynamicTask; |
| 10 | 9 | import com.genersoft.iot.vmp.conf.StreamProxyTask; |
| 11 | 10 | import com.genersoft.iot.vmp.conf.UserSetting; |
| 12 | 11 | import com.genersoft.iot.vmp.conf.exception.ControllerException; |
| 13 | -import com.genersoft.iot.vmp.gb28181.event.EventPublisher; | |
| 14 | 12 | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; |
| 15 | 13 | import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; |
| 16 | 14 | import com.genersoft.iot.vmp.media.zlm.ZLMServerFactory; |
| ... | ... | @@ -23,10 +21,9 @@ import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam; |
| 23 | 21 | import com.genersoft.iot.vmp.service.*; |
| 24 | 22 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 25 | 23 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 26 | -import com.genersoft.iot.vmp.storager.dao.GbStreamMapper; | |
| 27 | -import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper; | |
| 28 | -import com.genersoft.iot.vmp.storager.dao.PlatformGbStreamMapper; | |
| 29 | -import com.genersoft.iot.vmp.storager.dao.StreamProxyMapper; | |
| 24 | +import com.genersoft.iot.vmp.storager.mapper.GbStreamMapper; | |
| 25 | +import com.genersoft.iot.vmp.storager.mapper.PlatformGbStreamMapper; | |
| 26 | +import com.genersoft.iot.vmp.storager.mapper.StreamProxyMapper; | |
| 30 | 27 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 31 | 28 | import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; |
| 32 | 29 | import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo; | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java
| ... | ... | @@ -19,7 +19,7 @@ import com.genersoft.iot.vmp.service.IMediaServerService; |
| 19 | 19 | import com.genersoft.iot.vmp.service.IStreamPushService; |
| 20 | 20 | import com.genersoft.iot.vmp.service.bean.StreamPushItemFromRedis; |
| 21 | 21 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 22 | -import com.genersoft.iot.vmp.storager.dao.*; | |
| 22 | +import com.genersoft.iot.vmp.storager.mapper.*; | |
| 23 | 23 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 24 | 24 | import com.genersoft.iot.vmp.vmanager.bean.ResourceBaseInfo; |
| 25 | 25 | import com.github.pagehelper.PageHelper; | ... | ... |
src/main/java/com/genersoft/iot/vmp/service/impl/UserServiceImpl.java
| ... | ... | @@ -2,8 +2,8 @@ package com.genersoft.iot.vmp.service.impl; |
| 2 | 2 | |
| 3 | 3 | import com.baomidou.dynamic.datasource.annotation.DS; |
| 4 | 4 | import com.genersoft.iot.vmp.service.IUserService; |
| 5 | -import com.genersoft.iot.vmp.storager.dao.UserMapper; | |
| 6 | -import com.genersoft.iot.vmp.storager.dao.dto.User; | |
| 5 | +import com.genersoft.iot.vmp.storager.mapper.UserMapper; | |
| 6 | +import com.genersoft.iot.vmp.storager.mapper.dto.User; | |
| 7 | 7 | import com.github.pagehelper.PageHelper; |
| 8 | 8 | import com.github.pagehelper.PageInfo; |
| 9 | 9 | import org.springframework.beans.factory.annotation.Autowired; | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java
| ... | ... | @@ -11,7 +11,7 @@ import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo; |
| 11 | 11 | import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam; |
| 12 | 12 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| 13 | 13 | import com.genersoft.iot.vmp.service.bean.MessageForPushChannel; |
| 14 | -import com.genersoft.iot.vmp.storager.dao.dto.PlatformRegisterInfo; | |
| 14 | +import com.genersoft.iot.vmp.storager.mapper.dto.PlatformRegisterInfo; | |
| 15 | 15 | |
| 16 | 16 | import java.util.List; |
| 17 | 17 | import java.util.Map; | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/IVideoManagerStorage.java
| ... | ... | @@ -3,24 +3,24 @@ package com.genersoft.iot.vmp.storager; |
| 3 | 3 | import com.genersoft.iot.vmp.gb28181.bean.*; |
| 4 | 4 | import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; |
| 5 | 5 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| 6 | -import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo; | |
| 6 | +import com.genersoft.iot.vmp.storager.mapper.dto.ChannelSourceInfo; | |
| 7 | 7 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; |
| 8 | 8 | import com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend; |
| 9 | 9 | import com.github.pagehelper.PageInfo; |
| 10 | 10 | |
| 11 | 11 | import java.util.List; |
| 12 | 12 | |
| 13 | -/** | |
| 13 | +/** | |
| 14 | 14 | * @description:视频设备数据存储接口 |
| 15 | 15 | * @author: swwheihei |
| 16 | - * @date: 2020年5月6日 下午2:14:31 | |
| 16 | + * @date: 2020年5月6日 下午2:14:31 | |
| 17 | 17 | */ |
| 18 | 18 | @SuppressWarnings("rawtypes") |
| 19 | 19 | public interface IVideoManagerStorage { |
| 20 | 20 | |
| 21 | - /** | |
| 21 | + /** | |
| 22 | 22 | * 根据设备ID判断设备是否存在 |
| 23 | - * | |
| 23 | + * | |
| 24 | 24 | * @param deviceId 设备ID |
| 25 | 25 | * @return true:存在 false:不存在 |
| 26 | 26 | */ |
| ... | ... | @@ -40,10 +40,10 @@ public interface IVideoManagerStorage { |
| 40 | 40 | * @param channelId 通道ID |
| 41 | 41 | */ |
| 42 | 42 | public void stopPlay(String deviceId, String channelId); |
| 43 | - | |
| 44 | - /** | |
| 43 | + | |
| 44 | + /** | |
| 45 | 45 | * 获取设备 |
| 46 | - * | |
| 46 | + * | |
| 47 | 47 | * @param deviceId 设备ID |
| 48 | 48 | * @return DShadow 设备对象 |
| 49 | 49 | */ |
| ... | ... | @@ -58,7 +58,7 @@ public interface IVideoManagerStorage { |
| 58 | 58 | * @return |
| 59 | 59 | */ |
| 60 | 60 | public PageInfo<DeviceChannel> queryChannelsByDeviceId(String deviceId, String query, Boolean hasSubChannel, Boolean online, Boolean catalogUnderDevice, int page, int count); |
| 61 | - | |
| 61 | + | |
| 62 | 62 | public List<DeviceChannelExtend> queryChannelsByDeviceIdWithStartAndLimit(String deviceId, List<String> channelIds, String query, Boolean hasSubChannel, Boolean online, int start, int limit); |
| 63 | 63 | |
| 64 | 64 | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
| ... | ... | @@ -15,9 +15,9 @@ import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam; |
| 15 | 15 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| 16 | 16 | import com.genersoft.iot.vmp.service.bean.MessageForPushChannel; |
| 17 | 17 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 18 | -import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper; | |
| 19 | -import com.genersoft.iot.vmp.storager.dao.DeviceMapper; | |
| 20 | -import com.genersoft.iot.vmp.storager.dao.dto.PlatformRegisterInfo; | |
| 18 | +import com.genersoft.iot.vmp.storager.mapper.DeviceChannelMapper; | |
| 19 | +import com.genersoft.iot.vmp.storager.mapper.DeviceMapper; | |
| 20 | +import com.genersoft.iot.vmp.storager.mapper.dto.PlatformRegisterInfo; | |
| 21 | 21 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 22 | 22 | import com.genersoft.iot.vmp.utils.JsonUtil; |
| 23 | 23 | import com.genersoft.iot.vmp.utils.SystemInfoUtils; | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStorageImpl.java
| ... | ... | @@ -7,12 +7,11 @@ import com.genersoft.iot.vmp.gb28181.bean.*; |
| 7 | 7 | import com.genersoft.iot.vmp.gb28181.event.EventPublisher; |
| 8 | 8 | import com.genersoft.iot.vmp.gb28181.event.subscribe.catalog.CatalogEvent; |
| 9 | 9 | import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; |
| 10 | -import com.genersoft.iot.vmp.service.IGbStreamService; | |
| 11 | 10 | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| 12 | 11 | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| 13 | 12 | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; |
| 14 | -import com.genersoft.iot.vmp.storager.dao.*; | |
| 15 | -import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo; | |
| 13 | +import com.genersoft.iot.vmp.storager.mapper.*; | |
| 14 | +import com.genersoft.iot.vmp.storager.mapper.dto.ChannelSourceInfo; | |
| 16 | 15 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 17 | 16 | import com.genersoft.iot.vmp.vmanager.gb28181.platform.bean.ChannelReduce; |
| 18 | 17 | import com.genersoft.iot.vmp.web.gb28181.dto.DeviceChannelExtend; | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/dao/CloudRecordServiceMapper.java renamed to src/main/java/com/genersoft/iot/vmp/storager/mapper/CloudRecordServiceMapper.java
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceAlarmMapper.java renamed to src/main/java/com/genersoft/iot/vmp/storager/mapper/DeviceAlarmMapper.java
100755 → 100644
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceChannelMapper.java renamed to src/main/java/com/genersoft/iot/vmp/storager/mapper/DeviceChannelMapper.java
100755 → 100644
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMapper.java renamed to src/main/java/com/genersoft/iot/vmp/storager/mapper/DeviceMapper.java
100755 → 100644
src/main/java/com/genersoft/iot/vmp/storager/dao/DeviceMobilePositionMapper.java renamed to src/main/java/com/genersoft/iot/vmp/storager/mapper/DeviceMobilePositionMapper.java
100755 → 100644
src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java renamed to src/main/java/com/genersoft/iot/vmp/storager/mapper/GbStreamMapper.java
100755 → 100644
src/main/java/com/genersoft/iot/vmp/storager/dao/LogMapper.java renamed to src/main/java/com/genersoft/iot/vmp/storager/mapper/LogMapper.java
100755 → 100644
| 1 | -package com.genersoft.iot.vmp.storager.dao; | |
| 1 | +package com.genersoft.iot.vmp.storager.mapper; | |
| 2 | 2 | |
| 3 | -import com.genersoft.iot.vmp.storager.dao.dto.LogDto; | |
| 3 | +import com.genersoft.iot.vmp.storager.mapper.dto.LogDto; | |
| 4 | 4 | import org.apache.ibatis.annotations.Delete; |
| 5 | 5 | import org.apache.ibatis.annotations.Insert; |
| 6 | 6 | import org.apache.ibatis.annotations.Mapper; | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/dao/MediaServerMapper.java renamed to src/main/java/com/genersoft/iot/vmp/storager/mapper/MediaServerMapper.java
100755 → 100644
| 1 | -package com.genersoft.iot.vmp.storager.dao; | |
| 1 | +package com.genersoft.iot.vmp.storager.mapper; | |
| 2 | 2 | |
| 3 | 3 | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| 4 | 4 | import org.apache.ibatis.annotations.*; |
| 5 | 5 | import org.apache.ibatis.annotations.Param; |
| 6 | -import org.springframework.stereotype.Repository; | |
| 7 | 6 | |
| 8 | 7 | import java.util.List; |
| 9 | 8 | |
| 10 | 9 | |
| 11 | 10 | @Mapper |
| 12 | -@Repository | |
| 13 | 11 | public interface MediaServerMapper { |
| 14 | 12 | |
| 15 | 13 | @Insert("INSERT INTO wvp_media_server (" + | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/dao/ParentPlatformMapper.java renamed to src/main/java/com/genersoft/iot/vmp/storager/mapper/ParentPlatformMapper.java
100755 → 100644
| 1 | -package com.genersoft.iot.vmp.storager.dao; | |
| 1 | +package com.genersoft.iot.vmp.storager.mapper; | |
| 2 | 2 | |
| 3 | 3 | import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform; |
| 4 | -import com.genersoft.iot.vmp.storager.dao.dto.ChannelSourceInfo; | |
| 4 | +import com.genersoft.iot.vmp.storager.mapper.dto.ChannelSourceInfo; | |
| 5 | 5 | import org.apache.ibatis.annotations.*; |
| 6 | 6 | import org.apache.ibatis.annotations.Param; |
| 7 | 7 | import org.springframework.stereotype.Repository; | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformCatalogMapper.java renamed to src/main/java/com/genersoft/iot/vmp/storager/mapper/PlatformCatalogMapper.java
100755 → 100644
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformChannelMapper.java renamed to src/main/java/com/genersoft/iot/vmp/storager/mapper/PlatformChannelMapper.java
100755 → 100644
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java renamed to src/main/java/com/genersoft/iot/vmp/storager/mapper/PlatformGbStreamMapper.java
100755 → 100644
src/main/java/com/genersoft/iot/vmp/storager/dao/RoleMapper.java renamed to src/main/java/com/genersoft/iot/vmp/storager/mapper/RoleMapper.java
100755 → 100644
| 1 | -package com.genersoft.iot.vmp.storager.dao; | |
| 1 | +package com.genersoft.iot.vmp.storager.mapper; | |
| 2 | 2 | |
| 3 | -import com.genersoft.iot.vmp.storager.dao.dto.Role; | |
| 3 | +import com.genersoft.iot.vmp.storager.mapper.dto.Role; | |
| 4 | 4 | import org.apache.ibatis.annotations.*; |
| 5 | 5 | import org.springframework.stereotype.Repository; |
| 6 | 6 | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/dao/StreamProxyMapper.java renamed to src/main/java/com/genersoft/iot/vmp/storager/mapper/StreamProxyMapper.java
100755 → 100644
src/main/java/com/genersoft/iot/vmp/storager/dao/StreamPushMapper.java renamed to src/main/java/com/genersoft/iot/vmp/storager/mapper/StreamPushMapper.java
100755 → 100644
src/main/java/com/genersoft/iot/vmp/storager/dao/UserMapper.java renamed to src/main/java/com/genersoft/iot/vmp/storager/mapper/UserMapper.java
100755 → 100644
| 1 | -package com.genersoft.iot.vmp.storager.dao; | |
| 1 | +package com.genersoft.iot.vmp.storager.mapper; | |
| 2 | 2 | |
| 3 | -import com.genersoft.iot.vmp.storager.dao.dto.User; | |
| 3 | +import com.genersoft.iot.vmp.storager.mapper.dto.User; | |
| 4 | 4 | import org.apache.ibatis.annotations.*; |
| 5 | 5 | import org.apache.ibatis.annotations.Param; |
| 6 | 6 | import org.springframework.stereotype.Repository; | ... | ... |
src/main/java/com/genersoft/iot/vmp/storager/dao/dto/ChannelSourceInfo.java renamed to src/main/java/com/genersoft/iot/vmp/storager/mapper/dto/ChannelSourceInfo.java
100755 → 100644
src/main/java/com/genersoft/iot/vmp/storager/dao/dto/LogDto.java renamed to src/main/java/com/genersoft/iot/vmp/storager/mapper/dto/LogDto.java
100755 → 100644
src/main/java/com/genersoft/iot/vmp/storager/dao/dto/PlatformRegisterInfo.java renamed to src/main/java/com/genersoft/iot/vmp/storager/mapper/dto/PlatformRegisterInfo.java
100755 → 100644
src/main/java/com/genersoft/iot/vmp/storager/dao/dto/RecordInfo.java renamed to src/main/java/com/genersoft/iot/vmp/storager/mapper/dto/RecordInfo.java
100755 → 100644
src/main/java/com/genersoft/iot/vmp/storager/dao/dto/Role.java renamed to src/main/java/com/genersoft/iot/vmp/storager/mapper/dto/Role.java
100755 → 100644
src/main/java/com/genersoft/iot/vmp/storager/dao/dto/User.java renamed to src/main/java/com/genersoft/iot/vmp/storager/mapper/dto/User.java
100755 → 100644
src/main/java/com/genersoft/iot/vmp/vmanager/jt1078/platform/Jt1078OfCarController.java
| ... | ... | @@ -5,7 +5,6 @@ |
| 5 | 5 | |
| 6 | 6 | package com.genersoft.iot.vmp.vmanager.jt1078.platform; |
| 7 | 7 | |
| 8 | -import cn.hutool.core.io.resource.InputStreamResource; | |
| 9 | 8 | import com.alibaba.fastjson2.JSON; |
| 10 | 9 | import com.alibaba.fastjson2.JSONArray; |
| 11 | 10 | import com.alibaba.fastjson2.JSONException; |
| ... | ... | @@ -19,7 +18,6 @@ import com.genersoft.iot.vmp.conf.security.dto.JwtUser; |
| 19 | 18 | import com.genersoft.iot.vmp.jtt1078.app.VideoServerApp; |
| 20 | 19 | import com.genersoft.iot.vmp.jtt1078.publisher.PublishManager; |
| 21 | 20 | import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; |
| 22 | -import com.genersoft.iot.vmp.service.IStreamProxyService; | |
| 23 | 21 | import com.genersoft.iot.vmp.service.IStreamPushService; |
| 24 | 22 | import com.genersoft.iot.vmp.service.StremProxyService1078; |
| 25 | 23 | import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; |
| ... | ... | @@ -51,6 +49,7 @@ import org.slf4j.Logger; |
| 51 | 49 | import org.slf4j.LoggerFactory; |
| 52 | 50 | import org.springframework.beans.factory.annotation.Autowired; |
| 53 | 51 | import org.springframework.beans.factory.annotation.Value; |
| 52 | +import org.springframework.core.io.InputStreamResource; | |
| 54 | 53 | import org.springframework.data.redis.core.RedisTemplate; |
| 55 | 54 | import org.springframework.http.HttpHeaders; |
| 56 | 55 | import org.springframework.http.MediaType; |
| ... | ... | @@ -74,6 +73,7 @@ import java.security.Key; |
| 74 | 73 | import java.security.KeyFactory; |
| 75 | 74 | import java.security.spec.X509EncodedKeySpec; |
| 76 | 75 | import java.text.MessageFormat; |
| 76 | +import java.text.ParseException; | |
| 77 | 77 | import java.text.SimpleDateFormat; |
| 78 | 78 | import java.time.LocalDateTime; |
| 79 | 79 | import java.util.*; |
| ... | ... | @@ -113,10 +113,6 @@ public class Jt1078OfCarController { |
| 113 | 113 | private StremProxyService1078 stremProxyService1078; |
| 114 | 114 | private static final long TIME_COUNT = 300000L; |
| 115 | 115 | private Date tokenDate; |
| 116 | - @Autowired | |
| 117 | - private IStreamProxyService streamProxyService; | |
| 118 | - @Resource | |
| 119 | - private Jt1078OfService jt1078OfService; | |
| 120 | 116 | @Resource |
| 121 | 117 | private HisToryRecordService hisToryRecordService; |
| 122 | 118 | @Resource |
| ... | ... | @@ -168,8 +164,29 @@ public class Jt1078OfCarController { |
| 168 | 164 | return resultMap; |
| 169 | 165 | } |
| 170 | 166 | |
| 167 | + public static String timeCover(String time) { | |
| 168 | + // 定义用于解析输入字符串的格式 | |
| 169 | + SimpleDateFormat inputFormat = new SimpleDateFormat("yyyyMMddHHmmss"); | |
| 170 | + | |
| 171 | + // 定义输出的目标格式 | |
| 172 | + SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 173 | + | |
| 174 | + try { | |
| 175 | + // 将字符串解析为Date对象 | |
| 176 | + Date date = inputFormat.parse(time); | |
| 177 | + | |
| 178 | + // 使用目标格式格式化Date对象 | |
| 179 | + return outputFormat.format(date); | |
| 180 | + | |
| 181 | + } catch (ParseException e) { | |
| 182 | + log.error("时间转换错误"); | |
| 183 | + throw new RuntimeException("时间转换错误"); | |
| 184 | + } | |
| 185 | + } | |
| 186 | + | |
| 171 | 187 | /** |
| 172 | 188 | * 上传历史视频到FTP |
| 189 | + * | |
| 173 | 190 | * @param stream 流名称 |
| 174 | 191 | */ |
| 175 | 192 | @GetMapping("/history/uploading/{stream}") |
| ... | ... | @@ -185,20 +202,21 @@ public class Jt1078OfCarController { |
| 185 | 202 | String startTime = split[2]; |
| 186 | 203 | String endTime = split[3]; |
| 187 | 204 | hisToryRecordService.addOrUpdRecode( |
| 188 | - HistoryRecord.builder().ip(UUID.randomUUID().toString()) | |
| 205 | + HistoryRecord.builder().id(UUID.randomUUID().toString()) | |
| 189 | 206 | .name(stream) |
| 190 | 207 | .createTime(new Date()) |
| 191 | 208 | .sim(sim) |
| 192 | 209 | .channel(channel) |
| 193 | - .startTime(startTime) | |
| 194 | - .endTime(endTime) | |
| 210 | + .startTime(timeCover(startTime)) | |
| 211 | + .endTime(timeCover(endTime)) | |
| 195 | 212 | .status(HistoryEnum.UPLOADING.getCode()) |
| 196 | 213 | .ip(ftpConfigBean.getHost()) |
| 197 | 214 | .port(ftpConfigBean.getPort()) |
| 198 | 215 | .username(ftpConfigBean.getUsername()) |
| 199 | 216 | .password(MD5Util.encrypt(ftpConfigBean.getPassword())) |
| 200 | - .path(StringUtils.join(ftpConfigBean.getBasePath(),"/",sim,"/channel_",channel)) | |
| 201 | - .build()); | |
| 217 | + .path(StringUtils.join(ftpConfigBean.getBasePath(), "/", sim, "/channel_", channel, "/", stream)) | |
| 218 | + .build()); | |
| 219 | + updateHistoryRecord(); | |
| 202 | 220 | } catch (Exception e) { |
| 203 | 221 | throw new RuntimeException(e); |
| 204 | 222 | } |
| ... | ... | @@ -208,7 +226,7 @@ public class Jt1078OfCarController { |
| 208 | 226 | * 定时更新 |
| 209 | 227 | */ |
| 210 | 228 | @Scheduled(cron = "0 */2 * * * *") |
| 211 | - private void HistoryRecordScheduled(){ | |
| 229 | + private void HistoryRecordScheduled() { | |
| 212 | 230 | updateHistoryRecord(); |
| 213 | 231 | } |
| 214 | 232 | |
| ... | ... | @@ -224,37 +242,56 @@ public class Jt1078OfCarController { |
| 224 | 242 | * 更新历史视频上传记录 |
| 225 | 243 | */ |
| 226 | 244 | @GetMapping("/history/updateHistoryRecord") |
| 227 | - public void updateHistoryRecord(){ | |
| 245 | + public void updateHistoryRecord() { | |
| 228 | 246 | List<HistoryRecord> list = hisToryRecordService.getHistoryRecordList(); |
| 229 | 247 | if (CollectionUtils.isNotEmpty(list)) { |
| 230 | - List<HistoryRecord> expiredList = list.stream().filter(HistoryRecord::checkCreateTimeExpiration).collect(Collectors.toList()); | |
| 248 | + //删除过期的文件 | |
| 249 | + List<HistoryRecord> expiredList = list.stream().filter(ftpUtils::checkCreateTimeExpiration).collect(Collectors.toList()); | |
| 231 | 250 | if (CollectionUtils.isNotEmpty(expiredList)) { |
| 232 | 251 | try { |
| 233 | - expiredList = ftpUtils.batchDelete(expiredList); | |
| 252 | + expiredList = ftpUtils.batchDelete(expiredList).get("true"); | |
| 234 | 253 | hisToryRecordService.beachUpdRecode(expiredList); |
| 235 | 254 | } catch (IOException e) { |
| 236 | 255 | log.error("删除FTP文件失败"); |
| 237 | 256 | throw new RuntimeException(e); |
| 238 | 257 | } |
| 239 | 258 | } |
| 240 | - List<HistoryRecord> uploadedList = list.stream().filter(HistoryRecord::checkCreateTimeNotExpiration) | |
| 241 | - .filter(ftpUtils::checkHistoryVideo).collect(Collectors.toList()); | |
| 242 | - if (CollectionUtils.isNotEmpty(expiredList)) { | |
| 259 | + //修改上传成功 | |
| 260 | + List<HistoryRecord> uploadedList = list.stream() | |
| 261 | + .filter(ftpUtils::checkCreateTimeNotExpiration).filter(ftpUtils::checkHistoryVideo) | |
| 262 | + .collect(Collectors.toList()); | |
| 263 | + if (CollectionUtils.isNotEmpty(uploadedList)) { | |
| 243 | 264 | hisToryRecordService.beachUpdRecode(uploadedList); |
| 244 | 265 | } |
| 245 | - HISTORY_RECORD_MAP = hisToryRecordService.getHistoryRecordList().stream().collect(Collectors.toMap( | |
| 246 | - HistoryRecord::getName, // 使用名字作为键 | |
| 247 | - Function.identity(), // 用户对象作为值 | |
| 248 | - (existing, replacement) -> { | |
| 249 | - throw new IllegalArgumentException(String.format("Duplicate name found: %s", existing.getName())); | |
| 250 | - }, | |
| 251 | - ConcurrentHashMap::new // 保持插入顺序 | |
| 252 | - )); | |
| 266 | + | |
| 267 | + //修改超时未上传成功的文件 | |
| 268 | + List<HistoryRecord> updateTimeExpirationList = list.stream().filter(ftpUtils::checkUpdateTimeExpiration).collect(Collectors.toList()); | |
| 269 | + if (CollectionUtils.isNotEmpty(updateTimeExpirationList)) { | |
| 270 | + try { | |
| 271 | + Map<String, List<HistoryRecord>> stringListMap = ftpUtils.batchDelete(updateTimeExpirationList); | |
| 272 | + expiredList = stringListMap.get("false"); | |
| 273 | + expiredList.addAll(stringListMap.get("true")); | |
| 274 | + hisToryRecordService.beachUpdRecode(expiredList); | |
| 275 | + } catch (IOException e) { | |
| 276 | + log.error("删除未上传成功FTP文件失败"); | |
| 277 | + throw new RuntimeException(e); | |
| 278 | + } | |
| 279 | + } | |
| 253 | 280 | } |
| 281 | + //刷新内存 | |
| 282 | + HISTORY_RECORD_MAP = hisToryRecordService.getHistoryRecordList().stream().collect(Collectors.toMap( | |
| 283 | + HistoryRecord::getName, // 使用名字作为键 | |
| 284 | + Function.identity(), // 用户对象作为值 | |
| 285 | + (existing, replacement) -> { | |
| 286 | + throw new IllegalArgumentException(String.format("Duplicate name found: %s", existing.getName())); | |
| 287 | + }, | |
| 288 | + ConcurrentHashMap::new // 保持插入顺序 | |
| 289 | + )); | |
| 254 | 290 | } |
| 255 | 291 | |
| 256 | 292 | /** |
| 257 | 293 | * 下载历史视频 |
| 294 | + * | |
| 258 | 295 | * @param stream 流名称 |
| 259 | 296 | */ |
| 260 | 297 | @GetMapping("/history/download/{stream}") |
| ... | ... | @@ -666,7 +703,13 @@ public class Jt1078OfCarController { |
| 666 | 703 | endTime = this.formatTime(endTime).substring(2); |
| 667 | 704 | String msg = this.jt1078ConfigBean.formatMessageHistoryListRTSP(sim, channel, startTime, endTime); |
| 668 | 705 | try { |
| 669 | - HttpClientPostEntity entity = this.httpClientUtil.doPost(url, msg, (String) null); | |
| 706 | + String KEY = StringUtils.join("history-list:", sim, "_", channel, "_", startTime, "_", endTime); | |
| 707 | + String s = (String) redisTemplate.opsForValue().get(KEY); | |
| 708 | + HttpClientPostEntity entity = JSONObject.parseObject(s, HttpClientPostEntity.class); | |
| 709 | + if (entity == null) { | |
| 710 | + entity = this.httpClientUtil.doPost(url, msg, (String) null); | |
| 711 | + redisTemplate.opsForValue().set(KEY, JSONObject.toJSONString(entity), 5, TimeUnit.MINUTES); | |
| 712 | + } | |
| 670 | 713 | if (Objects.isNull(entity)) { |
| 671 | 714 | resultMap.put("code", "-1"); |
| 672 | 715 | resultMap.put("msg", "请求历史视频列表错误,请联系管理员"); |
| ... | ... | @@ -679,25 +722,16 @@ public class Jt1078OfCarController { |
| 679 | 722 | HashSet<String> set = new HashSet<>(); |
| 680 | 723 | if (Objects.nonNull(dataJO.get("items"))) { |
| 681 | 724 | JSONArray jsonArray = (JSONArray) dataJO.get("items"); |
| 682 | - jsonArray = | |
| 683 | - new JSONArray( | |
| 684 | - jsonArray.stream() | |
| 685 | - .map(json -> dateCon((JSONObject) json, sim, channel)) | |
| 686 | - .filter(jsonObject -> { | |
| 687 | - // 获取channelMapping并转换为List以便于比较 | |
| 688 | - String channelMapping = jsonObject.getString("channelMapping"); | |
| 689 | - return set.add(channelMapping); | |
| 690 | - }) | |
| 691 | - .collect(Collectors.toList()) | |
| 692 | - ); | |
| 693 | - if (jsonArray.size() > 1) { | |
| 694 | - jsonArray = filterContainedRanges(jsonArray); | |
| 725 | + if (!jsonArray.isEmpty()) { | |
| 726 | + List<HistoryRecord> list = filterContainedRanges(sim, channel, startTime, endTime, jsonArray); | |
| 727 | + dataJO.put("items", list); | |
| 695 | 728 | } |
| 696 | - dataJO.put("items", jsonArray); | |
| 697 | 729 | } |
| 698 | 730 | } |
| 699 | 731 | resultMap.put("code", "1"); |
| 700 | 732 | resultMap.put("obj", hashMap); |
| 733 | + entity = this.httpClientUtil.doPost(url, msg, (String) null); | |
| 734 | + redisTemplate.opsForValue().set(KEY, JSONObject.toJSONString(entity), 5, TimeUnit.MINUTES); | |
| 701 | 735 | return resultMap; |
| 702 | 736 | } |
| 703 | 737 | } catch (Exception e) { |
| ... | ... | @@ -707,19 +741,23 @@ public class Jt1078OfCarController { |
| 707 | 741 | } |
| 708 | 742 | } |
| 709 | 743 | |
| 710 | - public static JSONArray filterContainedRanges(JSONArray jsonArray) { | |
| 711 | - List<JSONObject> list = new ArrayList<>(); | |
| 712 | - for (int i = 0; i < jsonArray.size(); i++) { | |
| 713 | - list.add(jsonArray.getJSONObject(i)); | |
| 744 | + public static List<HistoryRecord> filterContainedRanges(String sim, String channel, String startTime, String endTime, JSONArray jsonArray) { | |
| 745 | + List<HistoryRecord> list = new ArrayList<>(); | |
| 746 | + for (Object object : jsonArray) { | |
| 747 | + HistoryRecord historyRecord = JSONObject.parseObject(object.toString(), HistoryRecord.class); | |
| 748 | + historyRecord.setSim(sim); | |
| 749 | + historyRecord.setName(StringUtils.join(sim, "_", channel, "_", | |
| 750 | + historyRecord.getStartTime().replace("-", "").replace(":", "").replace(" ", ""), "_", | |
| 751 | + historyRecord.getEndTime().replace("-", "").replace(":", "").replace(" ", ""))); | |
| 752 | + historyRecord.setData(object); | |
| 753 | + historyRecord.setChannel(channel); | |
| 754 | + HistoryRecord historyRecord1 = HISTORY_RECORD_MAP.get(historyRecord.getName()); | |
| 755 | + historyRecord.setStatus(historyRecord1 != null ? historyRecord1.getStatus() : HistoryEnum.NOT_UPLOADED.getCode()); | |
| 756 | + list.add(historyRecord); | |
| 714 | 757 | } |
| 715 | 758 | |
| 716 | - // 过滤逻辑 | |
| 717 | - List<JSONObject> filteredList = list.stream() | |
| 718 | - .filter(timeRange -> !isAnyOtherRangeContainingThis(list, timeRange)) | |
| 719 | - .collect(Collectors.toList()); | |
| 720 | - | |
| 721 | 759 | // 将过滤后的列表转换回 JSONArray |
| 722 | - return new JSONArray(filteredList); | |
| 760 | + return list; | |
| 723 | 761 | } |
| 724 | 762 | |
| 725 | 763 | private static boolean isAnyOtherRangeContainingThis(List<JSONObject> jsonArray, JSONObject timeRange) { |
| ... | ... | @@ -818,9 +856,9 @@ public class Jt1078OfCarController { |
| 818 | 856 | Map<String, Object> resultMap = new HashMap(); |
| 819 | 857 | startTime = this.formatTime(startTime); |
| 820 | 858 | endTime = this.formatTime(endTime); |
| 821 | - channelMapping = StringUtils.join(new String[]{sim, "-", channel,"-",startTime,"-",endTime}); | |
| 859 | + channelMapping = StringUtils.join(new String[]{sim, "-", channel, "-", startTime, "-", endTime}); | |
| 822 | 860 | Integer historyPort = createHistoryPort(channelMapping); |
| 823 | - channelMapping = StringUtils.join(new String[]{channelMapping,"_", String.valueOf(historyPort)}); | |
| 861 | + channelMapping = StringUtils.join(new String[]{channelMapping, "_", String.valueOf(historyPort)}); | |
| 824 | 862 | this.redisTemplate.opsForValue().set(key, channelMapping, 1L, TimeUnit.HOURS); |
| 825 | 863 | StreamContent streamContent = this.getStreamContentPlayURL(StringUtils.join(new String[]{channelMapping})); |
| 826 | 864 | if (Objects.nonNull(streamContent) && StringUtils.isNotEmpty(streamContent.getWs_flv())) { |
| ... | ... | @@ -935,12 +973,12 @@ public class Jt1078OfCarController { |
| 935 | 973 | } |
| 936 | 974 | String[] split = value.split("-"); |
| 937 | 975 | Map<String, Object> stringObjectMap = stopHistory(split[1], split[0]); |
| 938 | - while (true){ | |
| 939 | - if (stringObjectMap.get("code").equals("1")){ | |
| 940 | - log.info("{} 历史视频断流成功",value); | |
| 976 | + while (true) { | |
| 977 | + if (stringObjectMap.get("code").equals("1")) { | |
| 978 | + log.info("{} 历史视频断流成功", value); | |
| 941 | 979 | break; |
| 942 | - }else { | |
| 943 | - throw new ServiceException(String.format(" %s 历史视频断流失败",value)); | |
| 980 | + } else { | |
| 981 | + throw new ServiceException(String.format(" %s 历史视频断流失败", value)); | |
| 944 | 982 | } |
| 945 | 983 | } |
| 946 | 984 | strings.remove(value); |
| ... | ... | @@ -1021,6 +1059,7 @@ public class Jt1078OfCarController { |
| 1021 | 1059 | |
| 1022 | 1060 | /** |
| 1023 | 1061 | * 获取视频播放地址 |
| 1062 | + * | |
| 1024 | 1063 | * @param stream 流名称 |
| 1025 | 1064 | * @return 流信息 |
| 1026 | 1065 | */ |
| ... | ... | @@ -1156,15 +1195,17 @@ public class Jt1078OfCarController { |
| 1156 | 1195 | if (Objects.equals(rsultMap.get("code"), "4000") || Objects.equals(rsultMap.get("code"), 4000)) { |
| 1157 | 1196 | throw new ControllerException(ErrorCode.ERROR304); |
| 1158 | 1197 | } |
| 1198 | + if (Objects.equals(rsultMap.get("code"), "410") || Objects.equals(rsultMap.get("code"), 410)) { | |
| 1199 | + throw new ControllerException(ErrorCode.ERROR400); | |
| 1200 | + } | |
| 1159 | 1201 | |
| 1160 | 1202 | if (flag) { |
| 1161 | 1203 | if (StringUtils.isNoneBlank(new CharSequence[]{rsultMap.get("msg") + ""})) { |
| 1162 | 1204 | throw new ControllerException(304, String.valueOf(rsultMap.get("msg"))); |
| 1163 | 1205 | } |
| 1164 | 1206 | } |
| 1165 | - } catch (Exception var6) { | |
| 1166 | - Exception e = var6; | |
| 1167 | - log.error("entity.getResultStr():{{}}", entity.getResultStr(), e.getMessage()); | |
| 1207 | + } catch (Exception e) { | |
| 1208 | + log.error("entity.getResultStr():{{}}", e.getMessage()); | |
| 1168 | 1209 | throw new ControllerException(500, e.getMessage()); |
| 1169 | 1210 | } |
| 1170 | 1211 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/jt1078/platform/ben/HttpClientPostEntity.java
| 1 | 1 | package com.genersoft.iot.vmp.vmanager.jt1078.platform.ben; |
| 2 | 2 | |
| 3 | 3 | |
| 4 | +import lombok.AllArgsConstructor; | |
| 5 | +import lombok.Data; | |
| 6 | +import lombok.NoArgsConstructor; | |
| 7 | +import lombok.experimental.SuperBuilder; | |
| 4 | 8 | import org.apache.http.client.CookieStore; |
| 5 | 9 | |
| 6 | 10 | import java.util.Map; |
| ... | ... | @@ -9,52 +13,14 @@ import java.util.Map; |
| 9 | 13 | * @author liujun |
| 10 | 14 | * @date 2024年10月21日 15:20 |
| 11 | 15 | */ |
| 12 | - | |
| 16 | +@Data | |
| 17 | +@SuperBuilder | |
| 18 | +@AllArgsConstructor | |
| 19 | +@NoArgsConstructor | |
| 13 | 20 | public class HttpClientPostEntity { |
| 14 | 21 | private String resultStr; |
| 15 | 22 | private Map<String, String> headers; |
| 16 | 23 | private CookieStore cookieStore; |
| 17 | - | |
| 18 | 24 | private Integer port; |
| 19 | 25 | private Integer httpPort; |
| 20 | - | |
| 21 | - public String getResultStr() { | |
| 22 | - return resultStr; | |
| 23 | - } | |
| 24 | - | |
| 25 | - public void setResultStr(String resultStr) { | |
| 26 | - this.resultStr = resultStr; | |
| 27 | - } | |
| 28 | - | |
| 29 | - public Map<String, String> getHeaders() { | |
| 30 | - return headers; | |
| 31 | - } | |
| 32 | - | |
| 33 | - public void setHeaders(Map<String, String> headers) { | |
| 34 | - this.headers = headers; | |
| 35 | - } | |
| 36 | - | |
| 37 | - public CookieStore getCookieStore() { | |
| 38 | - return cookieStore; | |
| 39 | - } | |
| 40 | - | |
| 41 | - public void setCookieStore(CookieStore cookieStore) { | |
| 42 | - this.cookieStore = cookieStore; | |
| 43 | - } | |
| 44 | - | |
| 45 | - public Integer getPort() { | |
| 46 | - return port; | |
| 47 | - } | |
| 48 | - | |
| 49 | - public void setPort(Integer port) { | |
| 50 | - this.port = port; | |
| 51 | - } | |
| 52 | - | |
| 53 | - public Integer getHttpPort() { | |
| 54 | - return httpPort; | |
| 55 | - } | |
| 56 | - | |
| 57 | - public void setHttpPort(Integer httpPort) { | |
| 58 | - this.httpPort = httpPort; | |
| 59 | - } | |
| 60 | 26 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/jt1078/platform/config/FtpConfigBean.java
src/main/java/com/genersoft/iot/vmp/vmanager/jt1078/platform/config/Jt1078ConfigBean.java
| 1 | -package com.genersoft.iot.vmp.vmanager.jt1078.platform.config; import com.genersoft.iot.vmp.vmanager.jt1078.platform.Jt1078OfCarController; import lombok.Data; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; import javax.annotation.Resource; import java.util.*; @Data @Component public class Jt1078ConfigBean { @Value("${tuohua.bsth.jt1078.url}") private String jt1078Url; @Value("${tuohua.bsth.jt1078.sendPort}") private String jt1078SendPort; @Value("${tuohua.bsth.jt1078.stopSendPort}") private String stopSendPort; @Value("${tuohua.bsth.jt1078.historyListPort}") private String historyListPort; @Value("${tuohua.bsth.jt1078.history_upload}") private String historyUpload = "9206"; @Value("${tuohua.bsth.jt1078.playHistoryPort}") private String playHistoryPort; @Value("${tuohua.bsth.jt1078.ports}") private String portsOf1078; @Value("${tuohua.bsth.jt1078.pushURL}") private String pushURL; @Value("${tuohua.bsth.jt1078.stopPushURL}") private String stopPUshURL; private Integer start1078Port; private Integer end1078Port; @Value("${tuohua.bsth.jt1078.get.url}") private String getURL; @Value("${tuohua.bsth.jt1078.addPortVal}") private Integer addPort; @Value("${tuohua.bsth.jt1078.ws}") private String ws; @Value("${tuohua.bsth.jt1078.wss}") private String wss; @Value("${tuohua.bsth.jt1078.downloadFLV}") private String downloadFlv; @Value("${tuohua.bsth.jt1078.port}") private Integer port; @Value("${tuohua.bsth.jt1078.httpPort}") private Integer httpPort; @Value("${spring.profiles.active}") private String profilesActive; @Value("${media.pushKey}") private String pushKey; @Resource private RedisTemplate<String, Integer> redisTemplate; @Resource private FtpConfigBean ftpConfigBean; public Integer getPort() { if (port == null) { return 30000; } return port; } public Integer getHttpPort() { if (httpPort == null) { return 30000; } return httpPort; } private Integer getIntPort() { return profilesActive.equals("wx-local") ? 10000 : 0; } @PostConstruct public void initMap() { Set<String> historyPortKeys = redisTemplate.keys("history:port:*"); Set<String> keys = redisTemplate.keys("tag:*"); Set<String> patrolKeys = redisTemplate.keys("patrol:stream:*"); if (!historyPortKeys.isEmpty()) { keys.addAll(historyPortKeys); } if (!patrolKeys.isEmpty()) { keys.addAll(patrolKeys); } if (keys != null) { redisTemplate.delete(keys); } Map<Integer, Set<String>> hashMap = new HashMap<>(); for (int number = getStart1078Port(); number <= getEnd1078Port(); number++) { hashMap.put(number, new HashSet<>()); } Jt1078OfCarController.map.putAll(hashMap); } private static final String SEND_IO_MESSAGE_RTSP = "{ \"messageId\": 37121, \"properties\": 0, \"clientId\": \"{clientId}\", \"serialNo\": \"1\", \"ip\": \"{ip}\", \"tcpPort\": \"{tcpPort}\", \"udpPort\": \"{udpPort}\", \"channelNo\": \"{channelNo}\", \"mediaType\": \"1\", \"streamType\": \"1\"}"; private static final String SEND_IO_MESSAGE_RTSP_STOP = "{\"messageId\": 37122,\"properties\": 0,\"clientId\": \"{clientId}\",\"serialNo\": \"1\",\"channelNo\": \"{channelNo}\",\"command\": \"0\",\"closeType\": \"0\",\"streamType\": \"1\"}"; private static final String SEND_IO_HISTORY_RTSP = "{\"msgid\":37381,\"clientId\":\"{clientId}\",\"startTime\":\"{startTime}\",\"endTime\":\"{endTime}\",\"mediaType\":0,\"streamType\":0,\"storageType\":0,\"channelId\":{channelNo}}"; private static final String SEND_IO_PLAY_RTSP = "{\"ip\":\"{ip}\",\"tcpPort\":{tcpPort},\"udpPort\":{udpPort},\"channelNo\":\"{channelNo}\",\"mediaType\":0,\"streamType\":0,\"storageType\":0,\"playbackType\":0,\"playbackSpeed\":1,\"startTime\":\"{startTime}\",\"endTime\":\"{endTime}\",\"clientId\":\"{sim}\",\"messageId\":37377}"; public String formatMessageId(String sim, String channel, RtspConfigBean configBean, Integer port) { String msg = StringUtils.replace("{ \"messageId\": 37121, \"properties\": 0, \"clientId\": \"{clientId}\", \"serialNo\": \"1\", \"ip\": \"{ip}\", \"tcpPort\": \"{tcpPort}\", \"udpPort\": \"{udpPort}\", \"channelNo\": \"{channelNo}\", \"mediaType\": \"1\", \"streamType\": \"1\"}", "{clientId}", sim); msg = StringUtils.replace(msg, "{tcpPort}", (port.intValue() + getIntPort() + getAddPort()) + ""); msg = StringUtils.replace(msg, "{udpPort}", (port.intValue() + getIntPort() + getAddPort()) + ""); msg = StringUtils.replace(msg, "{channelNo}", channel); return StringUtils.replace(msg, "{ip}", configBean.getRtspIp()); } public String formatMessageStop(String sim, String channel) { String msg = StringUtils.replace("{\"messageId\": 37122,\"properties\": 0,\"clientId\": \"{clientId}\",\"serialNo\": \"1\",\"channelNo\": \"{channelNo}\",\"command\": \"0\",\"closeType\": \"0\",\"streamType\": \"1\"}", "{clientId}", sim); return StringUtils.replace(msg, "{channelNo}", channel); } public String formatMessageHistoryListRTSP(String sim, String channel, String startTime, String endTime) { String msg = StringUtils.replace("{\"msgid\":37381,\"clientId\":\"{clientId}\",\"startTime\":\"{startTime}\",\"endTime\":\"{endTime}\",\"mediaType\":0,\"streamType\":1,\"storageType\":0,\"channelNo\":{channelNo}}", "{clientId}", sim); msg = StringUtils.replace(msg, "{startTime}", startTime); msg = StringUtils.replace(msg, "{endTime}", endTime); return StringUtils.replace(msg, "{channelNo}", channel); } public String formatMessageHistoryPlayRTSP(String sim, String channel, String startTime, String endTime, RtspConfigBean configBean, Integer port) { String msg = StringUtils.replace("{\"ip\":\"{ip}\",\"tcpPort\":{tcpPort},\"udpPort\":{udpPort},\"channelNo\":\"{channelNo}\",\"mediaType\":0,\"streamType\":0,\"storageType\":0,\"playbackType\":0,\"playbackSpeed\":1,\"startTime\":\"{startTime}\",\"endTime\":\"{endTime}\",\"clientId\":\"{sim}\",\"messageId\":37377}", "{clientId}", sim); msg = StringUtils.replace(msg, "{startTime}", startTime); msg = StringUtils.replace(msg, "{endTime}", endTime); msg = StringUtils.replace(msg, "{channelNo}", channel); msg = StringUtils.replace(msg, "{tcpPort}", (port.intValue() + getIntPort() +getAddPort()) + ""); msg = StringUtils.replace(msg, "{udpPort}", (port.intValue() + getIntPort() + getAddPort()) + ""); msg = StringUtils.replace(msg, "{sim}", sim); return StringUtils.replace(msg, "{ip}", configBean.getRtspIp()); } public String formatMessageHistoryUpload(String stream) { if (StringUtils.isBlank(stream)) { throw new RuntimeException("上传参数不能为空"); } String[] split = stream.split("_"); if (split.length < 4){ throw new RuntimeException("上传参数异常, 请联系管理员"); } String sim = split[0]; String channel = split[1]; String startTime = split[2]; String endTime = split[3]; String msg = StringUtils.replace("{\n" + " \"clientId\": \"{clientId}\",\n" + " \"ip\": \"{ip}\",\n" + " \"port\": {port},\n" + " \"username\": \"{username}\",\n" + " \"password\": \"{password}\",\n" + " \"path\": \"{path}\",\n" + " \"channelNo\": {channel},\n" + " \"startTime\": \"{startTime}\",\n" + " \"endTime\": \"{endTime}\",\n" + " \"mediaType\": 0,\n" + " \"streamType\": 1,\n" + " \"storageType\": 1,\n" + " \"condition\": 6\n" + "}","{clientId}",sim); msg = StringUtils.replace(msg, "{ip}", ftpConfigBean.getHost()); msg = StringUtils.replace(msg, "{port}", ftpConfigBean.getPort().toString()); msg = StringUtils.replace(msg, "{username}", channel); msg = StringUtils.replace(msg, "{password}", ftpConfigBean.getPassword()); msg = StringUtils.replace(msg, "{path}", StringUtils.join(ftpConfigBean.getBasePath(),"/",sim,"/channel_",channel)); msg = StringUtils.replace(msg, "{channelNo}", channel); msg = StringUtils.replace(msg, "{startTime}", startTime); return StringUtils.replace(msg, "{endTime}", endTime); } public String formatMessageHistoryStopRTSP(String sim, String channel, RtspConfigBean configBean) { String msg = StringUtils.replace("{\"playbackMode\":2,\"channelNo\":{channelNo},\"playbackSpeed\":0,\"clientId\":\"{sim}\"}", "{sim}", sim); return StringUtils.replace(msg, "{channelNo}", channel); } public String formatPushURL(String pushKey, int port, int httpPort) { String msg = StringUtils.replace(this.pushURL, "{pushKey}", pushKey); msg = StringUtils.replace(msg, "{port}", String.valueOf(port)); return StringUtils.replace(msg, "{httpPort}", String.valueOf(httpPort)); } public String formatStopPushURL(String pushKey, int port, int httpPort) { String msg = StringUtils.replace(this.stopPUshURL, "{pushKey}", pushKey); msg = StringUtils.replace(msg, "{port}", String.valueOf(port)); return StringUtils.replace(msg, "{httpPort}", String.valueOf(httpPort)); } public String formatVideoURL(String stream) { String url = StringUtils.replace(getGetURL(), "{stream}", stream); if (!StringUtils.endsWith(url, ".flv")) { url = url + ".flv"; } return url; } public String getJt1078Url() { return this.jt1078Url; } public String getJt1078SendPort() { return this.jt1078SendPort; } public String getStopSendPort() { return this.stopSendPort; } public String getHistoryListPort() { return this.historyListPort; } public String getPlayHistoryPort() { return this.playHistoryPort; } public String getPushURL() { return this.pushURL; } public Integer getStart1078Port() { if (Objects.isNull(this.start1078Port)) this.start1078Port = Integer.valueOf(Integer.parseInt(StringUtils.substringBefore(this.portsOf1078, ","))); return this.start1078Port; } public Integer getEnd1078Port() { if (Objects.isNull(this.end1078Port)) this.end1078Port = Integer.valueOf(Integer.parseInt(StringUtils.substringAfter(this.portsOf1078, ","))); return this.end1078Port; } public String getPushKey(){ if (Objects.isNull(this.pushKey)){ this.pushKey = "?callId=41db35390ddad33f83944f44b8b75ded"; } return "?callId="+this.pushKey; } public String getStopPUshURL() { return this.stopPUshURL; } public String getGetURL() { return this.getURL; } public Integer getAddPort() { return this.addPort; } public String getWs() { return this.ws; } public String getWss() { return this.wss; } public String getDownloadFlv() { return downloadFlv; } public String getPortsOf1078() { return portsOf1078; } } | |
| 2 | 1 | \ No newline at end of file |
| 2 | +package com.genersoft.iot.vmp.vmanager.jt1078.platform.config; import com.genersoft.iot.vmp.vmanager.jt1078.platform.Jt1078OfCarController; import lombok.Data; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; import javax.annotation.Resource; import java.util.*; @Data @Component public class Jt1078ConfigBean { @Value("${tuohua.bsth.jt1078.url}") private String jt1078Url; @Value("${tuohua.bsth.jt1078.sendPort}") private String jt1078SendPort; @Value("${tuohua.bsth.jt1078.stopSendPort}") private String stopSendPort; @Value("${tuohua.bsth.jt1078.historyListPort}") private String historyListPort; @Value("${tuohua.bsth.jt1078.history_upload}") private String historyUpload = "9206"; @Value("${tuohua.bsth.jt1078.playHistoryPort}") private String playHistoryPort; @Value("${tuohua.bsth.jt1078.ports}") private String portsOf1078; @Value("${tuohua.bsth.jt1078.pushURL}") private String pushURL; @Value("${tuohua.bsth.jt1078.stopPushURL}") private String stopPUshURL; private Integer start1078Port; private Integer end1078Port; @Value("${tuohua.bsth.jt1078.get.url}") private String getURL; @Value("${tuohua.bsth.jt1078.addPortVal}") private Integer addPort; @Value("${tuohua.bsth.jt1078.ws}") private String ws; @Value("${tuohua.bsth.jt1078.wss}") private String wss; @Value("${tuohua.bsth.jt1078.downloadFLV}") private String downloadFlv; @Value("${tuohua.bsth.jt1078.port}") private Integer port; @Value("${tuohua.bsth.jt1078.httpPort}") private Integer httpPort; @Value("${spring.profiles.active}") private String profilesActive; @Value("${media.pushKey}") private String pushKey; @Resource private RedisTemplate<String, Integer> redisTemplate; @Resource private FtpConfigBean ftpConfigBean; public Integer getPort() { if (port == null) { return 30000; } return port; } public Integer getHttpPort() { if (httpPort == null) { return 30000; } return httpPort; } private Integer getIntPort() { return profilesActive.equals("wx-local") ? 10000 : 0; } @PostConstruct public void initMap() { Set<String> historyPortKeys = redisTemplate.keys("history:port:*"); Set<String> keys = redisTemplate.keys("tag:*"); Set<String> patrolKeys = redisTemplate.keys("patrol:stream:*"); Set<String> historyListKeys = redisTemplate.keys("history-list:*"); if (!historyPortKeys.isEmpty()) { keys.addAll(historyPortKeys); } if (!patrolKeys.isEmpty()) { keys.addAll(patrolKeys); } if (!historyListKeys.isEmpty()) { keys.addAll(historyListKeys); } if (keys != null) { redisTemplate.delete(keys); } Map<Integer, Set<String>> hashMap = new HashMap<>(); for (int number = getStart1078Port(); number <= getEnd1078Port(); number++) { hashMap.put(number, new HashSet<>()); } Jt1078OfCarController.map.putAll(hashMap); } private static final String SEND_IO_MESSAGE_RTSP = "{ \"messageId\": 37121, \"properties\": 0, \"clientId\": \"{clientId}\", \"serialNo\": \"1\", \"ip\": \"{ip}\", \"tcpPort\": \"{tcpPort}\", \"udpPort\": \"{udpPort}\", \"channelNo\": \"{channelNo}\", \"mediaType\": \"1\", \"streamType\": \"1\"}"; private static final String SEND_IO_MESSAGE_RTSP_STOP = "{\"messageId\": 37122,\"properties\": 0,\"clientId\": \"{clientId}\",\"serialNo\": \"1\",\"channelNo\": \"{channelNo}\",\"command\": \"0\",\"closeType\": \"0\",\"streamType\": \"1\"}"; private static final String SEND_IO_HISTORY_RTSP = "{\"msgid\":37381,\"clientId\":\"{clientId}\",\"startTime\":\"{startTime}\",\"endTime\":\"{endTime}\",\"mediaType\":0,\"streamType\":0,\"storageType\":0,\"channelId\":{channelNo}}"; private static final String SEND_IO_PLAY_RTSP = "{\"ip\":\"{ip}\",\"tcpPort\":{tcpPort},\"udpPort\":{udpPort},\"channelNo\":\"{channelNo}\",\"mediaType\":0,\"streamType\":0,\"storageType\":0,\"playbackType\":0,\"playbackSpeed\":1,\"startTime\":\"{startTime}\",\"endTime\":\"{endTime}\",\"clientId\":\"{sim}\",\"messageId\":37377}"; public String formatMessageId(String sim, String channel, RtspConfigBean configBean, Integer port) { String msg = StringUtils.replace("{ \"messageId\": 37121, \"properties\": 0, \"clientId\": \"{clientId}\", \"serialNo\": \"1\", \"ip\": \"{ip}\", \"tcpPort\": \"{tcpPort}\", \"udpPort\": \"{udpPort}\", \"channelNo\": \"{channelNo}\", \"mediaType\": \"1\", \"streamType\": \"1\"}", "{clientId}", sim); msg = StringUtils.replace(msg, "{tcpPort}", (port.intValue() + getIntPort() + getAddPort()) + ""); msg = StringUtils.replace(msg, "{udpPort}", (port.intValue() + getIntPort() + getAddPort()) + ""); msg = StringUtils.replace(msg, "{channelNo}", channel); return StringUtils.replace(msg, "{ip}", configBean.getRtspIp()); } public String formatMessageStop(String sim, String channel) { String msg = StringUtils.replace("{\"messageId\": 37122,\"properties\": 0,\"clientId\": \"{clientId}\",\"serialNo\": \"1\",\"channelNo\": \"{channelNo}\",\"command\": \"0\",\"closeType\": \"0\",\"streamType\": \"1\"}", "{clientId}", sim); return StringUtils.replace(msg, "{channelNo}", channel); } public String formatMessageHistoryListRTSP(String sim, String channel, String startTime, String endTime) { String msg = StringUtils.replace("{\"msgid\":37381,\"clientId\":\"{clientId}\",\"startTime\":\"{startTime}\",\"endTime\":\"{endTime}\",\"mediaType\":0,\"streamType\":1,\"storageType\":0,\"channelNo\":{channelNo}}", "{clientId}", sim); msg = StringUtils.replace(msg, "{startTime}", startTime); msg = StringUtils.replace(msg, "{endTime}", endTime); return StringUtils.replace(msg, "{channelNo}", channel); } public String formatMessageHistoryPlayRTSP(String sim, String channel, String startTime, String endTime, RtspConfigBean configBean, Integer port) { String msg = StringUtils.replace("{\"ip\":\"{ip}\",\"tcpPort\":{tcpPort},\"udpPort\":{udpPort},\"channelNo\":\"{channelNo}\",\"mediaType\":0,\"streamType\":0,\"storageType\":0,\"playbackType\":0,\"playbackSpeed\":1,\"startTime\":\"{startTime}\",\"endTime\":\"{endTime}\",\"clientId\":\"{sim}\",\"messageId\":37377}", "{clientId}", sim); msg = StringUtils.replace(msg, "{startTime}", startTime); msg = StringUtils.replace(msg, "{endTime}", endTime); msg = StringUtils.replace(msg, "{channelNo}", channel); msg = StringUtils.replace(msg, "{tcpPort}", (port.intValue() + getIntPort() +getAddPort()) + ""); msg = StringUtils.replace(msg, "{udpPort}", (port.intValue() + getIntPort() + getAddPort()) + ""); msg = StringUtils.replace(msg, "{sim}", sim); return StringUtils.replace(msg, "{ip}", configBean.getRtspIp()); } public String formatMessageHistoryUpload(String stream) { if (StringUtils.isBlank(stream)) { throw new RuntimeException("上传参数不能为空"); } String[] split = stream.split("_"); if (split.length < 4){ throw new RuntimeException("上传参数异常, 请联系管理员"); } String sim = split[0]; String channel = split[1]; String startTime = split[2]; String endTime = split[3]; String msg = StringUtils.replace("{\n" + " \"clientId\": \"{clientId}\",\n" + " \"ip\": \"{ip}\",\n" + " \"port\": {port},\n" + " \"username\": \"{username}\",\n" + " \"password\": \"{password}\",\n" + " \"path\": \"{path}\",\n" + " \"channelNo\": {channel},\n" + " \"startTime\": \"{startTime}\",\n" + " \"endTime\": \"{endTime}\",\n" + " \"mediaType\": 0,\n" + " \"streamType\": 1,\n" + " \"storageType\": 1,\n" + " \"condition\": 6\n" + "}","{clientId}",sim); msg = StringUtils.replace(msg, "{ip}", ftpConfigBean.getHost()); msg = StringUtils.replace(msg, "{port}", ftpConfigBean.getPort().toString()); msg = StringUtils.replace(msg, "{username}", ftpConfigBean.getUsername()); msg = StringUtils.replace(msg, "{password}", ftpConfigBean.getPassword()); msg = StringUtils.replace(msg, "{path}", StringUtils.join(ftpConfigBean.getBasePath(),"/",sim,"/channel_",channel,"/",stream)); msg = StringUtils.replace(msg, "{channel}", channel); msg = StringUtils.replace(msg, "{startTime}", Jt1078OfCarController.timeCover(startTime)); return StringUtils.replace(msg, "{endTime}", Jt1078OfCarController.timeCover(endTime)); } public String formatMessageHistoryStopRTSP(String sim, String channel, RtspConfigBean configBean) { String msg = StringUtils.replace("{\"playbackMode\":2,\"channelNo\":{channelNo},\"playbackSpeed\":0,\"clientId\":\"{sim}\"}", "{sim}", sim); return StringUtils.replace(msg, "{channelNo}", channel); } public String formatPushURL(String pushKey, int port, int httpPort) { String msg = StringUtils.replace(this.pushURL, "{pushKey}", pushKey); msg = StringUtils.replace(msg, "{port}", String.valueOf(port)); return StringUtils.replace(msg, "{httpPort}", String.valueOf(httpPort)); } public String formatStopPushURL(String pushKey, int port, int httpPort) { String msg = StringUtils.replace(this.stopPUshURL, "{pushKey}", pushKey); msg = StringUtils.replace(msg, "{port}", String.valueOf(port)); return StringUtils.replace(msg, "{httpPort}", String.valueOf(httpPort)); } public String formatVideoURL(String stream) { String url = StringUtils.replace(getGetURL(), "{stream}", stream); if (!StringUtils.endsWith(url, ".flv")) { url = url + ".flv"; } return url; } public String getJt1078Url() { return this.jt1078Url; } public String getJt1078SendPort() { return this.jt1078SendPort; } public String getStopSendPort() { return this.stopSendPort; } public String getHistoryListPort() { return this.historyListPort; } public String getPlayHistoryPort() { return this.playHistoryPort; } public String getPushURL() { return this.pushURL; } public Integer getStart1078Port() { if (Objects.isNull(this.start1078Port)) this.start1078Port = Integer.valueOf(Integer.parseInt(StringUtils.substringBefore(this.portsOf1078, ","))); return this.start1078Port; } public Integer getEnd1078Port() { if (Objects.isNull(this.end1078Port)) this.end1078Port = Integer.valueOf(Integer.parseInt(StringUtils.substringAfter(this.portsOf1078, ","))); return this.end1078Port; } public String getPushKey(){ if (Objects.isNull(this.pushKey)){ this.pushKey = "?callId=41db35390ddad33f83944f44b8b75ded"; } return "?callId="+this.pushKey; } public String getStopPUshURL() { return this.stopPUshURL; } public String getGetURL() { return this.getURL; } public Integer getAddPort() { return this.addPort; } public String getWs() { return this.ws; } public String getWss() { return this.wss; } public String getDownloadFlv() { return downloadFlv; } public String getPortsOf1078() { return portsOf1078; } } | |
| 3 | 3 | \ No newline at end of file | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/jt1078/platform/config/TuohuaConfigBean.java
| ... | ... | @@ -169,8 +169,8 @@ public class TuohuaConfigBean { |
| 169 | 169 | if (CollectionUtils.isNotEmpty(carData)) { |
| 170 | 170 | if (StringUtils.equals(profileActive, "wx-local")) { |
| 171 | 171 | CarData value = carData.get(0); |
| 172 | - value.setSim("13800009998"); | |
| 173 | -// value.setSim("123456789011"); | |
| 172 | +// value.setSim("1030715050"); | |
| 173 | + value.setSim("123456789011"); | |
| 174 | 174 | map.put(value.getSim(), value); |
| 175 | 175 | }else { |
| 176 | 176 | for (CarData carDatum : carData) { |
| ... | ... | @@ -319,8 +319,8 @@ public class TuohuaConfigBean { |
| 319 | 319 | hashMap.put("abnormalStatus",abnormalStatus); |
| 320 | 320 | |
| 321 | 321 | if (StringUtils.equals(profileActive, "wx-local")) { |
| 322 | - hashMap.put("sim","13800009998"); | |
| 323 | -// hashMap.put("sim", "123456789011"); | |
| 322 | +// hashMap.put("sim","1030715050"); | |
| 323 | + hashMap.put("sim", "123456789011"); | |
| 324 | 324 | } |
| 325 | 325 | return hashMap; |
| 326 | 326 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/jt1078/platform/domain/HistoryRecord.java
| 1 | 1 | package com.genersoft.iot.vmp.vmanager.jt1078.platform.domain; |
| 2 | 2 | |
| 3 | +import com.baomidou.mybatisplus.annotation.TableField; | |
| 3 | 4 | import com.fasterxml.jackson.annotation.JsonFormat; |
| 4 | 5 | import com.genersoft.iot.vmp.vmanager.jt1078.platform.config.FtpConfigBean; |
| 5 | 6 | import com.genersoft.iot.vmp.vmanager.util.FtpUtils; |
| ... | ... | @@ -77,6 +78,11 @@ public class HistoryRecord { |
| 77 | 78 | */ |
| 78 | 79 | private String endTime; |
| 79 | 80 | /** |
| 81 | + * 原始数据 | |
| 82 | + */ | |
| 83 | + @TableField(exist = false) | |
| 84 | + private Object data; | |
| 85 | + /** | |
| 80 | 86 | * 修改时间 |
| 81 | 87 | */ |
| 82 | 88 | @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
| ... | ... | @@ -101,21 +107,5 @@ public class HistoryRecord { |
| 101 | 107 | */ |
| 102 | 108 | private String remark; |
| 103 | 109 | |
| 104 | - public static boolean checkCreateTimeExpiration(HistoryRecord historyRecord) { | |
| 105 | - long l = calculateDaysBetween(historyRecord.createTime); | |
| 106 | - return l > getBean(FtpConfigBean.class).getExpirationTime(); | |
| 107 | - } | |
| 108 | - | |
| 109 | - public static boolean checkCreateTimeNotExpiration(HistoryRecord historyRecord) { | |
| 110 | - long l = calculateDaysBetween(historyRecord.createTime); | |
| 111 | - return l < getBean(FtpConfigBean.class).getExpirationTime(); | |
| 112 | - } | |
| 113 | - | |
| 114 | 110 | |
| 115 | - private static long calculateDaysBetween(Date startDate) { | |
| 116 | - // 将Date转换为LocalDate | |
| 117 | - LocalDate startLocalDate = startDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); | |
| 118 | - // 计算两个LocalDate对象之间的天数差异 | |
| 119 | - return ChronoUnit.DAYS.between(startLocalDate, LocalDate.now()); | |
| 120 | - } | |
| 121 | 111 | } | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/jt1078/platform/mapper/HisToryRecordMapper.java
| ... | ... | @@ -3,6 +3,7 @@ package com.genersoft.iot.vmp.vmanager.jt1078.platform.mapper; |
| 3 | 3 | import com.genersoft.iot.vmp.vmanager.jt1078.platform.domain.HistoryRecord; |
| 4 | 4 | import org.apache.ibatis.annotations.Mapper; |
| 5 | 5 | import org.apache.ibatis.annotations.Param; |
| 6 | +import org.apache.ibatis.annotations.Select; | |
| 6 | 7 | |
| 7 | 8 | import java.util.List; |
| 8 | 9 | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/jt1078/platform/service/HisToryRecordService.java
src/main/java/com/genersoft/iot/vmp/vmanager/jt1078/platform/service/impl/HisToryRecordServiceImpl.java
| ... | ... | @@ -4,12 +4,8 @@ import com.genersoft.iot.vmp.vmanager.jt1078.platform.domain.HistoryRecord; |
| 4 | 4 | import com.genersoft.iot.vmp.vmanager.jt1078.platform.mapper.HisToryRecordMapper; |
| 5 | 5 | import com.genersoft.iot.vmp.vmanager.jt1078.platform.service.HisToryRecordService; |
| 6 | 6 | import lombok.AllArgsConstructor; |
| 7 | -import org.springframework.data.redis.cache.RedisCache; | |
| 8 | 7 | import org.springframework.stereotype.Service; |
| 9 | 8 | |
| 10 | -import javax.annotation.Resource; | |
| 11 | -import java.util.Collections; | |
| 12 | -import java.util.Date; | |
| 13 | 9 | import java.util.List; |
| 14 | 10 | |
| 15 | 11 | /** |
| ... | ... | @@ -22,8 +18,6 @@ import java.util.List; |
| 22 | 18 | public class HisToryRecordServiceImpl implements HisToryRecordService { |
| 23 | 19 | |
| 24 | 20 | private final HisToryRecordMapper hisToryRecordMapper; |
| 25 | - @Resource | |
| 26 | - private RedisCache redisCache; | |
| 27 | 21 | /** |
| 28 | 22 | * 添加历史下载记录 |
| 29 | 23 | * @param record 历史视频下载记录对象 |
| ... | ... | @@ -36,8 +30,8 @@ public class HisToryRecordServiceImpl implements HisToryRecordService { |
| 36 | 30 | * 修改历史视频记录 |
| 37 | 31 | */ |
| 38 | 32 | @Override |
| 39 | - public String beachUpdRecode(List<HistoryRecord> record) { | |
| 40 | - return hisToryRecordMapper.beachUpdRecode(record) > 0 ? "success" : "fail"; | |
| 33 | + public void beachUpdRecode(List<HistoryRecord> record) { | |
| 34 | + hisToryRecordMapper.beachUpdRecode(record); | |
| 41 | 35 | } |
| 42 | 36 | /** |
| 43 | 37 | * 历史视频上传记录列表 | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/log/LogController.java
| ... | ... | @@ -4,7 +4,7 @@ import com.genersoft.iot.vmp.conf.UserSetting; |
| 4 | 4 | import com.genersoft.iot.vmp.conf.exception.ControllerException; |
| 5 | 5 | import com.genersoft.iot.vmp.conf.security.JwtUtils; |
| 6 | 6 | import com.genersoft.iot.vmp.service.ILogService; |
| 7 | -import com.genersoft.iot.vmp.storager.dao.dto.LogDto; | |
| 7 | +import com.genersoft.iot.vmp.storager.mapper.dto.LogDto; | |
| 8 | 8 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 9 | 9 | import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; |
| 10 | 10 | import com.github.pagehelper.PageInfo; | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/user/RoleController.java
| ... | ... | @@ -4,7 +4,7 @@ import com.genersoft.iot.vmp.conf.exception.ControllerException; |
| 4 | 4 | import com.genersoft.iot.vmp.conf.security.JwtUtils; |
| 5 | 5 | import com.genersoft.iot.vmp.conf.security.SecurityUtils; |
| 6 | 6 | import com.genersoft.iot.vmp.service.IRoleService; |
| 7 | -import com.genersoft.iot.vmp.storager.dao.dto.Role; | |
| 7 | +import com.genersoft.iot.vmp.storager.mapper.dto.Role; | |
| 8 | 8 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 9 | 9 | import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; |
| 10 | 10 | import io.swagger.v3.oas.annotations.Operation; | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/user/UserController.java
| ... | ... | @@ -6,8 +6,8 @@ import com.genersoft.iot.vmp.conf.security.SecurityUtils; |
| 6 | 6 | import com.genersoft.iot.vmp.conf.security.dto.LoginUser; |
| 7 | 7 | import com.genersoft.iot.vmp.service.IRoleService; |
| 8 | 8 | import com.genersoft.iot.vmp.service.IUserService; |
| 9 | -import com.genersoft.iot.vmp.storager.dao.dto.Role; | |
| 10 | -import com.genersoft.iot.vmp.storager.dao.dto.User; | |
| 9 | +import com.genersoft.iot.vmp.storager.mapper.dto.Role; | |
| 10 | +import com.genersoft.iot.vmp.storager.mapper.dto.User; | |
| 11 | 11 | import com.genersoft.iot.vmp.utils.DateUtil; |
| 12 | 12 | import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; |
| 13 | 13 | import com.genersoft.iot.vmp.vmanager.bean.WVPResult; | ... | ... |
src/main/java/com/genersoft/iot/vmp/vmanager/util/FtpUtils.java
| ... | ... | @@ -12,11 +12,14 @@ import org.apache.commons.net.ftp.FTPFile; |
| 12 | 12 | import org.apache.commons.net.ftp.FTPReply; |
| 13 | 13 | import org.springframework.stereotype.Component; |
| 14 | 14 | |
| 15 | -import java.io.ByteArrayOutputStream; | |
| 16 | 15 | import java.io.IOException; |
| 17 | 16 | import java.io.InputStream; |
| 18 | 17 | import java.net.SocketException; |
| 19 | 18 | import java.text.SimpleDateFormat; |
| 19 | +import java.time.LocalDate; | |
| 20 | +import java.time.LocalDateTime; | |
| 21 | +import java.time.ZoneId; | |
| 22 | +import java.time.temporal.ChronoUnit; | |
| 20 | 23 | import java.util.*; |
| 21 | 24 | |
| 22 | 25 | /** |
| ... | ... | @@ -29,6 +32,41 @@ public class FtpUtils { |
| 29 | 32 | |
| 30 | 33 | private final FtpConfigBean ftpConfigBean; |
| 31 | 34 | |
| 35 | + public boolean checkUpdateTimeExpiration(HistoryRecord historyRecord){ | |
| 36 | + Date updateTime = historyRecord.getUpdateTime(); | |
| 37 | + if (updateTime != null) { | |
| 38 | + long uploadTime = calculateSecondsBetween(updateTime); | |
| 39 | + return (uploadTime > ftpConfigBean.getTimeOut() && historyRecord.getStatus().equals(HistoryEnum.UPLOADING.getCode())); | |
| 40 | + } | |
| 41 | + return false; | |
| 42 | + } | |
| 43 | + | |
| 44 | + public boolean checkCreateTimeExpiration(HistoryRecord historyRecord) { | |
| 45 | + long l = calculateDaysBetween(historyRecord.getCreateTime()); | |
| 46 | + return l > ftpConfigBean.getExpirationTime(); | |
| 47 | + } | |
| 48 | + | |
| 49 | + public boolean checkCreateTimeNotExpiration(HistoryRecord historyRecord) { | |
| 50 | + long l = calculateDaysBetween(historyRecord.getCreateTime()); | |
| 51 | + return l <= ftpConfigBean.getExpirationTime(); | |
| 52 | + } | |
| 53 | + | |
| 54 | + | |
| 55 | + private long calculateDaysBetween(Date startDate) { | |
| 56 | + // 将Date转换为LocalDate | |
| 57 | + LocalDate startLocalDate = startDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDate(); | |
| 58 | + // 计算两个LocalDate对象之间的天数差异 | |
| 59 | + return ChronoUnit.DAYS.between(startLocalDate, LocalDate.now()); | |
| 60 | + } | |
| 61 | + | |
| 62 | + | |
| 63 | + private long calculateSecondsBetween(Date startDate) { | |
| 64 | + // 将Date转换为LocalDate | |
| 65 | + LocalDateTime startLocalDate = startDate.toInstant().atZone(ZoneId.systemDefault()).toLocalDateTime(); | |
| 66 | + // 计算两个LocalDate对象之间的天数差异 | |
| 67 | + return ChronoUnit.SECONDS.between(startLocalDate, LocalDateTime.now()); | |
| 68 | + } | |
| 69 | + | |
| 32 | 70 | /** |
| 33 | 71 | * 获取 FTPClient对象 |
| 34 | 72 | * @return FTPClient对象 |
| ... | ... | @@ -60,7 +98,7 @@ public class FtpUtils { |
| 60 | 98 | ftpClient.disconnect(); |
| 61 | 99 | return null; |
| 62 | 100 | } else { |
| 63 | - log.info("连接到FTP服务成功"); | |
| 101 | + log.debug("连接到FTP服务成功"); | |
| 64 | 102 | // 设置二进制方式传输文件 |
| 65 | 103 | ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE); |
| 66 | 104 | // 设置被动工作模式,文件传输端口设置,否则文件上传不成功,也不报错 |
| ... | ... | @@ -88,7 +126,7 @@ public class FtpUtils { |
| 88 | 126 | ftpClient.logout(); |
| 89 | 127 | // 断开ftp的连接 |
| 90 | 128 | ftpClient.disconnect(); |
| 91 | - log.info("关闭ftp客户端成功"); | |
| 129 | + log.debug("关闭ftp客户端成功"); | |
| 92 | 130 | } |
| 93 | 131 | } catch (Exception e) { |
| 94 | 132 | log.error("关闭ftp客户端异常"); |
| ... | ... | @@ -211,8 +249,6 @@ public class FtpUtils { |
| 211 | 249 | } catch (IOException e) { |
| 212 | 250 | log.error("获取文件输入流异常"); |
| 213 | 251 | throw new FtpException("获取文件输入流异常"); |
| 214 | - } finally { | |
| 215 | - closeConnect(ftpClient); | |
| 216 | 252 | } |
| 217 | 253 | return is; |
| 218 | 254 | } |
| ... | ... | @@ -247,10 +283,17 @@ public class FtpUtils { |
| 247 | 283 | * @return 如果目录中存在至少一个文件,则返回文件名;否则返回null |
| 248 | 284 | */ |
| 249 | 285 | public String checkDirectoryContainsFiles(String directoryPath){ |
| 286 | + if (directoryPath == null ){ | |
| 287 | + return null; | |
| 288 | + } | |
| 250 | 289 | FTPClient ftpClient = getFTPClient(); |
| 251 | 290 | try { |
| 291 | + String substring = directoryPath; | |
| 252 | 292 | // 改变工作目录 |
| 253 | - if (ftpClient.changeWorkingDirectory(directoryPath)) { | |
| 293 | + if (directoryPath.endsWith(".mp4")){ | |
| 294 | + substring = directoryPath.substring(0, directoryPath.lastIndexOf("/") + 1); | |
| 295 | + } | |
| 296 | + if (ftpClient.changeWorkingDirectory(substring)) { | |
| 254 | 297 | // 列出目录中的所有文件和子目录 |
| 255 | 298 | FTPFile[] files = ftpClient.listFiles(); |
| 256 | 299 | for (FTPFile file : files) { |
| ... | ... | @@ -273,25 +316,27 @@ public class FtpUtils { |
| 273 | 316 | |
| 274 | 317 | public boolean checkHistoryVideo(HistoryRecord record) { |
| 275 | 318 | String fileName = checkDirectoryContainsFiles(record.getPath()); |
| 276 | - boolean flag = fileName != null; | |
| 319 | + boolean flag = fileName != null && record.getStatus().equals(HistoryEnum.UPLOADING.getCode()); | |
| 277 | 320 | if (flag){ |
| 278 | - record.setPath( String.join(record.getPath(),"/",fileName)); | |
| 321 | + record.setPath( StringUtils.join(record.getPath(),"/",fileName)); | |
| 279 | 322 | record.setStatus(HistoryEnum.UPLOADED.getCode()); |
| 323 | + record.setUpdateTime(new Date()); | |
| 280 | 324 | } |
| 281 | 325 | return flag; |
| 282 | 326 | } |
| 283 | 327 | /** |
| 284 | 328 | * 批量删除指定路径下的文件和文件夹。 |
| 285 | 329 | */ |
| 286 | - public List<HistoryRecord> batchDelete(List<HistoryRecord> historyRecordList) throws IOException { | |
| 330 | + public Map<String,List<HistoryRecord>> batchDelete(List<HistoryRecord> historyRecordList) throws IOException { | |
| 287 | 331 | HashMap<String, List<HistoryRecord>> recordMap = new HashMap<>(); |
| 288 | 332 | recordMap.put("true",new ArrayList<>(historyRecordList)); |
| 289 | 333 | recordMap.put("false",new ArrayList<>(historyRecordList)); |
| 290 | 334 | for (HistoryRecord historyRecord : historyRecordList) { |
| 291 | 335 | boolean b = deleteRecursive(historyRecord.getPath()); |
| 336 | + historyRecord.setPath(null); | |
| 337 | + historyRecord.setStatus(HistoryEnum.NOT_UPLOADED.getCode()); | |
| 338 | + historyRecord.setUpdateTime(new Date()); | |
| 292 | 339 | if (!b) { |
| 293 | - historyRecord.setPath(null); | |
| 294 | - historyRecord.setStatus(HistoryEnum.NOT_UPLOADED.getCode()); | |
| 295 | 340 | historyRecord.setCreateTime(new Date()); |
| 296 | 341 | recordMap.get("true").add(historyRecord); |
| 297 | 342 | }else { |
| ... | ... | @@ -303,9 +348,10 @@ public class FtpUtils { |
| 303 | 348 | log.debug("==> {} 成功删除文件 {} 个 ", format,recordMap.get("true").size()); |
| 304 | 349 | log.debug("==> {} 未删除文件 {} 个", format,recordMap.get("false").size()); |
| 305 | 350 | log.debug("==========================================================="); |
| 306 | - return recordMap.get("false"); | |
| 351 | + return recordMap; | |
| 307 | 352 | } |
| 308 | 353 | |
| 354 | + | |
| 309 | 355 | /** |
| 310 | 356 | * 递归删除指定路径下的文件和文件夹。 |
| 311 | 357 | * | ... | ... |
src/main/java/com/genersoft/iot/vmp/web/gb28181/AuthController.java
| 1 | 1 | package com.genersoft.iot.vmp.web.gb28181; |
| 2 | 2 | |
| 3 | 3 | import com.genersoft.iot.vmp.service.IUserService; |
| 4 | -import com.genersoft.iot.vmp.storager.dao.dto.User; | |
| 4 | +import com.genersoft.iot.vmp.storager.mapper.dto.User; | |
| 5 | 5 | import org.springframework.beans.factory.annotation.Autowired; |
| 6 | 6 | import org.springframework.web.bind.annotation.*; |
| 7 | 7 | ... | ... |
src/main/resources/application-dev100.yml deleted
100644 → 0
| 1 | -spring: | |
| 2 | - # 设置接口超时时间 | |
| 3 | - mvc: | |
| 4 | - async: | |
| 5 | - request-timeout: 20000 | |
| 6 | - thymeleaf: | |
| 7 | - cache: false | |
| 8 | - # [可选]上传文件大小限制 | |
| 9 | - servlet: | |
| 10 | - multipart: | |
| 11 | - max-file-size: 10MB | |
| 12 | - max-request-size: 100MB | |
| 13 | - | |
| 14 | - # REDIS数据库配置 | |
| 15 | - redis: | |
| 16 | - # [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1 | |
| 17 | - host: 192.168.169.100 | |
| 18 | - # [必须修改] 端口号 | |
| 19 | - port: 6879 | |
| 20 | - # [可选] 数据库 DB | |
| 21 | - database: 7 | |
| 22 | - # [可选] 访问密码,若你的redis服务器没有设置密码,就不需要用密码去连接 | |
| 23 | - password: wvp4@444 | |
| 24 | - # [可选] 超时时间 | |
| 25 | - timeout: 10000 | |
| 26 | - # mysql数据源 | |
| 27 | - datasource: | |
| 28 | - dynamic: | |
| 29 | - primary: master | |
| 30 | - datasource: | |
| 31 | - master: | |
| 32 | - type: com.zaxxer.hikari.HikariDataSource | |
| 33 | - driver-class-name: com.mysql.cj.jdbc.Driver | |
| 34 | - url: jdbc:mysql://192.168.169.100:3306/wvp4?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&allowPublicKeyRetrieval=TRUE&serverTimezone=PRC&useSSL=false&allowMultiQueries=true&sessionVariables=sql_mode='NO_ENGINE_SUBSTITUTION'&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull | |
| 35 | - username: root | |
| 36 | - password: guzijian | |
| 37 | - hikari: | |
| 38 | - connection-timeout: 20000 # 是客户端等待连接池连接的最大毫秒数 | |
| 39 | - initialSize: 50 # 连接池初始化连接数 | |
| 40 | - maximum-pool-size: 200 # 连接池最大连接数 | |
| 41 | - minimum-idle: 10 # 连接池最小空闲连接数 | |
| 42 | - idle-timeout: 300000 # 允许连接在连接池中空闲的最长时间(以毫秒为单位) | |
| 43 | - max-lifetime: 1200000 # 是池中连接关闭后的最长生命周期(以毫秒为单位) | |
| 44 | -#[可选] WVP监听的HTTP端口, 网页和接口调用都是这个端口 | |
| 45 | -server: | |
| 46 | - port: 18989 | |
| 47 | - # [可选] HTTPS配置, 默认不开启 | |
| 48 | - ssl: | |
| 49 | - # [可选] 是否开启HTTPS访问 | |
| 50 | - enabled: false | |
| 51 | - # [可选] 证书文件路径,放置在resource/目录下即可,修改xxx为文件名 | |
| 52 | - key-store: classpath:Aserver.keystore | |
| 53 | - # [可选] 证书密码 | |
| 54 | - key-store-password: guzijian | |
| 55 | - # [可选] 证书类型, 默认为jks,根据实际修改 | |
| 56 | - key-store-type: JKS | |
| 57 | - | |
| 58 | -# 作为28181服务器的配置 | |
| 59 | -sip: | |
| 60 | - # [必须修改] 本机的IP,对应你的网卡,监听什么ip就是使用什么网卡, | |
| 61 | - # 如果要监听多张网卡,可以使用逗号分隔多个IP, 例如: 192.168.1.4,10.0.0.4 | |
| 62 | - # 如果不明白,就使用0.0.0.0,大部分情况都是可以的 | |
| 63 | - # 请不要使用127.0.0.1,任何包括localhost在内的域名都是不可以的。 | |
| 64 | - ip: 192.168.169.100 | |
| 65 | - # [可选] 28181服务监听的端口 | |
| 66 | - port: 28083 | |
| 67 | - # 根据国标6.1.2中规定,domain宜采用ID统一编码的前十位编码。国标附录D中定义前8位为中心编码(由省级、市级、区级、基层编号组成,参照GB/T 2260-2007) | |
| 68 | - # 后两位为行业编码,定义参照附录D.3 | |
| 69 | - # 3701020049标识山东济南历下区 信息行业接入 | |
| 70 | - # [可选] | |
| 71 | - domain: 4403000000 | |
| 72 | - # [可选] | |
| 73 | - id: 44030000003110008001 | |
| 74 | - # [可选] 默认设备认证密码,后续扩展使用设备单独密码, 移除密码将不进行校验 | |
| 75 | - password: 2024bsth@gb18181 | |
| 76 | - # 是否存储alarm信息 | |
| 77 | - alarm: true | |
| 78 | - | |
| 79 | -#zlm 默认服务器配置 | |
| 80 | -media: | |
| 81 | - id: guzijian1 | |
| 82 | - # [必须修改] zlm服务器的内网IP | |
| 83 | - ip: 192.168.169.100 | |
| 84 | - # [必须修改] zlm服务器的http.port | |
| 85 | - http-port: 1909 | |
| 86 | - # [可选] 返回流地址时的ip,置空使用 media.ip 1 | |
| 87 | - stream-ip: 61.169.120.202 | |
| 88 | - # [可选] wvp在国标信令中使用的ip,此ip为摄像机可以访问到的ip, 置空使用 media.ip 1 | |
| 89 | - sdp-ip: 61.169.120.202 | |
| 90 | - # [可选] zlm服务器的hook所使用的IP, 默认使用sip.ip | |
| 91 | - hook-ip: 192.168.169.100 | |
| 92 | - # [可选] zlm服务器的http.sslport, 置空使用zlm配置文件配置 | |
| 93 | - http-ssl-port: 2939 | |
| 94 | - # [可选] zlm服务器的hook.admin_params=secret | |
| 95 | - secret: 8KMYsD5ItKkHN1CIcPI9VeLa6u4S8deU | |
| 96 | - pushKey: 41db35390ddad33f83944f44b8b75ded | |
| 97 | - # 启用多端口模式, 多端口模式使用端口区分每路流,兼容性更好。 单端口使用流的ssrc区分, 点播超时建议使用多端口测试 | |
| 98 | - rtp: | |
| 99 | - # [可选] 是否启用多端口模式, 开启后会在portRange范围内选择端口用于媒体流传输 | |
| 100 | - enable: true | |
| 101 | - # [可选] 在此范围内选择端口用于媒体流传输, 必须提前在zlm上配置该属性,不然自动配置此属性可能不成功 | |
| 102 | - port-range: 52000,52500 # 端口范围 | |
| 103 | - # [可选] 国标级联在此范围内选择端口发送媒体流, | |
| 104 | - send-port-range: 52000,52500 # 端口范围 | |
| 105 | - # 录像辅助服务, 部署此服务可以实现zlm录像的管理与下载, 0 表示不使用 | |
| 106 | - record-assist-port: 18081 | |
| 107 | -# [根据业务需求配置] | |
| 108 | -user-settings: | |
| 109 | - # 点播/录像回放 等待超时时间,单位:毫秒 | |
| 110 | - play-timeout: 180000 | |
| 111 | - # [可选] 自动点播, 使用固定流地址进行播放时,如果未点播则自动进行点播, 需要rtp.enable=true | |
| 112 | - auto-apply-play: true | |
| 113 | - # 设备/通道状态变化时发送消息 | |
| 114 | - device-status-notify: true | |
| 115 | -# [可选] 日志配置, 一般不需要改 | |
| 116 | -jt1078: | |
| 117 | - enable: true | |
| 118 | - port: 1079 | |
| 119 | -logging: | |
| 120 | - config: classpath:logback-spring.xml | |
| 121 | -tuohua: | |
| 122 | - bsth: | |
| 123 | - login: | |
| 124 | - pageURL: http://192.168.168.152:9088/user/login/jCryptionKey | |
| 125 | - url: http://192.168.168.152:9088/user/login | |
| 126 | - userName: yuanxiaohu | |
| 127 | - password: Yxiaohu1.0 | |
| 128 | - rest: | |
| 129 | - baseURL: http://192.168.168.152:9089/webservice/rest | |
| 130 | - password: bafb2b44a07a02e5e9912f42cd197423884116a8 | |
| 131 | - tree: | |
| 132 | - url: | |
| 133 | - company: http://192.168.168.152:9088/video/tree | |
| 134 | - car: http://192.168.168.152:9088/video/tree/carNo/{0} | |
| 135 | - sim: http://192.168.168.152:9088/video//tree/caNO/sim/{0} | |
| 136 | - wvp28181: | |
| 137 | - rtsp: | |
| 138 | - tcpPort: 1078 | |
| 139 | - udpPort: 1078 | |
| 140 | - historyTcpPort: 9999 | |
| 141 | - historyUdpPort: 9999 | |
| 142 | - ip : 61.169.120.202 | |
| 143 | - jt1078: | |
| 144 | - ports: 49101,49101 | |
| 145 | - port: 9100 | |
| 146 | - httpPort: 3333 | |
| 147 | - addPortVal: 0 | |
| 148 | - pushURL: http://127.0.0.1:3333/new/server/{pushKey}/{port}/{httpPort} | |
| 149 | - stopPushURL: http://127.0.0.1:3333/stop/channel/{pushKey}/{port}/{httpPort} | |
| 150 | - url: http://192.168.168.152:8100/device/{0} | |
| 151 | - new_url: http://192.168.168.152:8100/device | |
| 152 | - historyListPort: 9205 | |
| 153 | - playHistoryPort: 9201 | |
| 154 | - sendPort: 9101 | |
| 155 | - stopSendPort: 9102 | |
| 156 | - ws: ws://61.169.120.202:1909/schedule/{stream}.live.flv | |
| 157 | - wss: wss://61.169.120.202:2930/schedule/{stream}.live.flv | |
| 158 | - downloadFLV: http://61.169.120.202:1909/schedule/{stream}.live.flv | |
| 159 | - get: | |
| 160 | - url: http://192.168.169.100:3333/video/{stream}.flv | |
| 161 | - playURL: /play/wasm/ws%3A%2F%2F{ip}%3A{port}%2Fschedule%2F{sim}-{channel}.live.flv%3FcallId%{publickey} | |
| 162 | - | |
| 163 | -ftp: | |
| 164 | - basePath: /wvp-local | |
| 165 | - host: 192.168.169.100 | |
| 166 | - httpPath: ftp://192.168.169.100 | |
| 167 | - filePathPrefix: http://192.168.169.100:10021/wvp-local | |
| 168 | - password: ftp@123 | |
| 169 | - port: 21 | |
| 170 | - username: ftpadmin | |
| 171 | - retryTimes: 5 | |
| 172 | - retryWaitTimes: 3000 | |
| 173 | - | |
| 174 | -forest: | |
| 175 | - backend: okhttp3 # 后端HTTP框架(默认为 okhttp3) | |
| 176 | - max-connections: 1000 # 连接池最大连接数(默认为 500) | |
| 177 | - max-route-connections: 500 # 每个路由的最大连接数(默认为 500) | |
| 178 | - max-request-queue-size: 100 # [自v1.5.22版本起可用] 最大请求等待队列大小 | |
| 179 | - max-async-thread-size: 300 # [自v1.5.21版本起可用] 最大异步线程数 | |
| 180 | - max-async-queue-size: 16 # [自v1.5.22版本起可用] 最大异步线程池队列大小 | |
| 181 | - timeout: 3000 # [已不推荐使用] 请求超时时间,单位为毫秒(默认为 3000) | |
| 182 | - connect-timeout: 3000 # 连接超时时间,单位为毫秒(默认为 timeout) | |
| 183 | - read-timeout: 3000 # 数据读取超时时间,单位为毫秒(默认为 timeout) | |
| 184 | - max-retry-count: 0 # 请求失败后重试次数(默认为 0 次不重试) | |
| 185 | - # ssl-protocol: TLS # 单向验证的HTTPS的默认TLS协议(默认为 TLS) | |
| 186 | - log-enabled: true # 打开或关闭日志(默认为 true) | |
| 187 | - log-request: true # 打开/关闭Forest请求日志(默认为 true) | |
| 188 | - log-response-status: true # 打开/关闭Forest响应状态日志(默认为 true) | |
| 189 | - log-response-content: true # 打开/关闭Forest响应内容日志(默认为 false) | |
| 190 | -# async-mode: platform # [自v1.5.27版本起可用] 异步模式(默认为 platform) |
src/main/resources/mapper/HisToryRecordMapper.xml renamed to src/main/resources/mapper/jt1078/HisToryRecordMapper.xml
| ... | ... | @@ -50,9 +50,10 @@ |
| 50 | 50 | INSERT INTO `wvp_history_record` |
| 51 | 51 | <trim prefix="(" suffix=")" suffixOverrides=","> |
| 52 | 52 | <if test=" id != null and id != '' ">`id` ,</if> |
| 53 | + <if test=" name != null and name != '' ">`name` ,</if> | |
| 53 | 54 | <if test=" sim != null and sim != '' ">`sim` ,</if> |
| 54 | 55 | <if test=" channel != null and channel != '' ">`channel` ,</if> |
| 55 | - <if test=" startTime != null and startTime != '' ">`strat_time` ,</if> | |
| 56 | + <if test=" startTime != null and startTime != '' ">`start_time` ,</if> | |
| 56 | 57 | <if test=" endTime != null and endTime != '' ">`end_time` ,</if> |
| 57 | 58 | <if test=" status != null and status != '' ">`status` ,</if> |
| 58 | 59 | <if test=" ip != null and ip != '' ">`ip` ,</if> |
| ... | ... | @@ -92,7 +93,7 @@ |
| 92 | 93 | <if test=" name != null and name != '' "> `name` = #{name}, </if> |
| 93 | 94 | <if test=" sim != null and sim != '' "> `sim` = #{sim}, </if> |
| 94 | 95 | <if test=" channel != null and channel != '' "> `channel` = #{channel}, </if> |
| 95 | - <if test=" startTime != null and startTime != '' "> `strat_time` = #{startTime}, </if> | |
| 96 | + <if test=" startTime != null and startTime != '' "> `start_time` = #{startTime}, </if> | |
| 96 | 97 | <if test=" endTime != null and endTime != '' "> `end_time` = #{endTime}, </if> |
| 97 | 98 | <if test=" status != null and status != '' "> `status` = #{status}, </if> |
| 98 | 99 | <if test=" ip != null and ip != '' "> `ip` = #{ip}, </if> |
| ... | ... | @@ -114,7 +115,7 @@ |
| 114 | 115 | <set> |
| 115 | 116 | <if test="item.sim != null and item.sim != '' ">`sim` = #{item.sim}, </if> |
| 116 | 117 | <if test="item.channel != null and item.channel != '' ">`channel` = #{item.channel}, </if> |
| 117 | - <if test="item.startTime != null and item.startTime != '' ">`strat_time` = #{item.startTime}, </if> | |
| 118 | + <if test="item.startTime != null and item.startTime != '' ">`start_time` = #{item.startTime}, </if> | |
| 118 | 119 | <if test="item.endTime != null and item.endTime != '' ">`end_time` = #{item.endTime}, </if> |
| 119 | 120 | <if test="item.status != null and item.status != '' ">`status` = #{item.status}, </if> |
| 120 | 121 | <if test="item.ip != null and item.ip != '' ">`ip` = #{item.ip}, </if> |
| ... | ... | @@ -133,10 +134,12 @@ |
| 133 | 134 | `name` = #{item.name} |
| 134 | 135 | </foreach> |
| 135 | 136 | </update> |
| 137 | + | |
| 136 | 138 | <select id="getHistoryRecordList" |
| 137 | 139 | resultMap="HISTORY_RECORD_LIST_MAP"> |
| 138 | 140 | <include refid="HISTORY_RECORD_LIST_SQL" /> |
| 139 | 141 | </select> |
| 142 | + | |
| 140 | 143 | <select id="getHistoryRecord" |
| 141 | 144 | resultMap="HISTORY_RECORD_LIST_MAP"> |
| 142 | 145 | <include refid="HISTORY_RECORD_LIST_SQL" /> | ... | ... |
web_src/src/components/HistoricalRecord.vue
| ... | ... | @@ -29,7 +29,7 @@ |
| 29 | 29 | </el-time-picker> |
| 30 | 30 | </el-form-item> |
| 31 | 31 | <el-form-item> |
| 32 | - <el-button type="primary" @click="searchHistoryList" style="width: 70%;">搜索</el-button> | |
| 32 | + <el-button type="primary" @click="searchHistoryTimer" style="width: 70%;">搜索</el-button> | |
| 33 | 33 | </el-form-item> |
| 34 | 34 | </el-form> |
| 35 | 35 | </el-footer> |
| ... | ... | @@ -48,7 +48,6 @@ |
| 48 | 48 | <el-footer style="width: 100%;height: 30%;background-color: white"> |
| 49 | 49 | <history-search-table :table-data="historyData" |
| 50 | 50 | @playHistoryVideo="clickHistoricalPlay" |
| 51 | - @downloadHistoryVideo="downloadFunction" | |
| 52 | 51 | @uploadHistoryVideo="uploadHistoryVideo"/> |
| 53 | 52 | </el-footer> |
| 54 | 53 | </el-container> |
| ... | ... | @@ -74,6 +73,8 @@ export default { |
| 74 | 73 | data() { |
| 75 | 74 | //这里存放数据" |
| 76 | 75 | return { |
| 76 | + //列表定时器 | |
| 77 | + timer: null, | |
| 77 | 78 | //历史视频列表定时器 |
| 78 | 79 | historyTimer: null, |
| 79 | 80 | historyData: [], |
| ... | ... | @@ -148,6 +149,12 @@ export default { |
| 148 | 149 | this.loading = true; |
| 149 | 150 | this.getCarInfo() |
| 150 | 151 | }, |
| 152 | + getCarInfoTimer() { | |
| 153 | + this.searchHistoryList() | |
| 154 | + this.timer = setInterval(() => { | |
| 155 | + this.getCarInfo(); | |
| 156 | + }, 10000); // | |
| 157 | + }, | |
| 151 | 158 | getCarInfo() { |
| 152 | 159 | this.$axios({ |
| 153 | 160 | method: 'get', |
| ... | ... | @@ -162,11 +169,6 @@ export default { |
| 162 | 169 | this.statisticsOnline(res.data.data.result) |
| 163 | 170 | this.sourceValue = res.data.data.result; |
| 164 | 171 | this.loading = false |
| 165 | - //定时更新数据 | |
| 166 | - let this_ = this | |
| 167 | - this.carInfoTimeout = setTimeout(function () { | |
| 168 | - this_.getCarInfo() | |
| 169 | - }, 45000); | |
| 170 | 172 | } else if (res.data.data.message) { |
| 171 | 173 | this.$message.error(res.data.data.message); |
| 172 | 174 | } |
| ... | ... | @@ -175,6 +177,8 @@ export default { |
| 175 | 177 | } |
| 176 | 178 | this.loading = false |
| 177 | 179 | }).catch(error => { |
| 180 | + this.loading = false | |
| 181 | + clearInterval(this.timer) | |
| 178 | 182 | this.$message.error(error.message); |
| 179 | 183 | }) |
| 180 | 184 | }, |
| ... | ... | @@ -267,10 +271,13 @@ export default { |
| 267 | 271 | * 上传历史视频 |
| 268 | 272 | */ |
| 269 | 273 | uploadHistoryVideo(data){ |
| 274 | + console.log("开始上传视频 ===》 ",data) | |
| 275 | + this.loading = true | |
| 270 | 276 | this.$axios({ |
| 271 | 277 | method: 'get', |
| 272 | - url: '/api/jt1078/query/history/list/' + data.sim + '/' + data.channel + "/" + this.startTime + "/" + this.endTime | |
| 278 | + url: '/api/jt1078/query/history/uploading/' + data.name | |
| 273 | 279 | }).then(res => { |
| 280 | + console.log("上传视频 ==》 ",res) | |
| 274 | 281 | if (res.data.data.code === -1){ |
| 275 | 282 | this.$message.success("视频开始上传,请等待") |
| 276 | 283 | this.searchHistoryList() |
| ... | ... | @@ -278,36 +285,15 @@ export default { |
| 278 | 285 | }).cache(err => { |
| 279 | 286 | console.log(err) |
| 280 | 287 | this.$message.error("视频上传失败,请联系管理员") |
| 288 | + this.loading = false | |
| 281 | 289 | }) |
| 282 | 290 | }, |
| 283 | - /** | |
| 284 | - * 下载历史视频 | |
| 285 | - */ | |
| 286 | - downloadFunction(data) { | |
| 287 | - this.$axios({ | |
| 288 | - url: `/api/jt1078/query/history/download/${data.name}`, // 请求URL | |
| 289 | - method: 'GET', // 将FTP文件路径作为参数传递 | |
| 290 | - responseType: 'blob', // 告知axios以二进制数据流的形式处理响应 | |
| 291 | - }).then((response) => { | |
| 292 | - const blob = new Blob([response.data], { type: 'application/octet-stream' }); | |
| 293 | - const link = document.createElement('a'); | |
| 294 | - link.href = window.URL.createObjectURL(blob); | |
| 295 | - link.download = ftpFilePath.substring(ftpFilePath.lastIndexOf('/') + 1); // 设置下载文件名 | |
| 296 | - document.body.appendChild(link); | |
| 297 | - link.click(); | |
| 298 | - document.body.removeChild(link); | |
| 299 | - }).catch(error => { | |
| 300 | - console.error("下载失败", error); | |
| 301 | - }); | |
| 291 | + searchHistoryTimer() { | |
| 292 | + this.searchHistoryList() | |
| 293 | + this.historyTimer = setInterval(() => { | |
| 294 | + this.searchHistoryList(); | |
| 295 | + }, 10000); // | |
| 302 | 296 | }, |
| 303 | - // downloadFunction(data) { | |
| 304 | - // this.getDateTime(); | |
| 305 | - // console.log(this.downloadURL); | |
| 306 | - // if (this.isEmpty(this.downloadURL)) { | |
| 307 | - // return; | |
| 308 | - // } | |
| 309 | - // window.open(this.downloadURL, "_download"); | |
| 310 | - // }, | |
| 311 | 297 | /** |
| 312 | 298 | * 搜索历史视频 |
| 313 | 299 | */ |
| ... | ... | @@ -336,34 +322,29 @@ export default { |
| 336 | 322 | this.$message.error('请选择开始和结束时间'); |
| 337 | 323 | return; |
| 338 | 324 | } |
| 339 | - this.loading = true | |
| 340 | 325 | this.$axios({ |
| 341 | 326 | method: 'get', |
| 342 | 327 | url: '/api/jt1078/query/history/list/' + sim + '/' + channel + "/" + this.startTime + "/" + this.endTime |
| 343 | - }).then( | |
| 344 | - res => { | |
| 328 | + }).then(res => { | |
| 345 | 329 | let items = res.data.data.obj.data.items; |
| 346 | 330 | if (res && res.data && res.data.data && res.data.data.obj && res.data.data.code == 1 && res.data.data.obj.data && items) { |
| 347 | 331 | for (let i in items) { |
| 348 | - items[i].sim = sim; | |
| 349 | - items[i].channel = channel | |
| 350 | - items[i].name = items[i].startTime + '-' + items[i].endTime; | |
| 332 | + items[i].disabled = false; | |
| 333 | + items[i].countdown = 10; | |
| 351 | 334 | } |
| 352 | 335 | this.historyData = items; |
| 353 | - clearInterval(this.historyTimer); | |
| 354 | - this.historyTimer = setInterval(() => { | |
| 355 | - this.searchHistoryList(); | |
| 356 | - }, 10000); // | |
| 357 | 336 | } else if (res && res.data && res.data.data && res.data.data.msg) { |
| 358 | 337 | this.$message.error(res.data.data.msg); |
| 359 | 338 | } else if (items === undefined) { |
| 360 | 339 | this.historyData = []; |
| 361 | 340 | this.$message.warning("搜索历史列表为空") |
| 362 | 341 | } |
| 363 | - this.loading = false | |
| 364 | - }).cache(res => { | |
| 365 | - this.$message.error(res.msg); | |
| 366 | 342 | this.loading = false |
| 343 | + }).catch(error => { | |
| 344 | + console.log(error) | |
| 345 | + this.loading = false | |
| 346 | + clearInterval(this.historyTimer) | |
| 347 | + this.$message.error("发送历史视频列表指令异常"); | |
| 367 | 348 | }) |
| 368 | 349 | }, |
| 369 | 350 | /** |
| ... | ... | @@ -527,6 +508,8 @@ export default { |
| 527 | 508 | beforeDestroy() { |
| 528 | 509 | }, //生命周期 - 销毁之前", |
| 529 | 510 | destroyed() { |
| 511 | + clearInterval(this.timer) | |
| 512 | + clearInterval(this.historyTimer) | |
| 530 | 513 | }, //生命周期 - 销毁完成", |
| 531 | 514 | activated() { |
| 532 | 515 | } //如果页面有keep-alive缓存功能,这个函数会触发", | ... | ... |
web_src/src/components/JT1078Components/HistorySearchTable.vue
| 1 | 1 | <template> |
| 2 | + <div style="width: 100%;height: 100%;"> | |
| 2 | 3 | <el-table |
| 4 | + v-if="tableData.length > 0" | |
| 3 | 5 | ref="singleTable" |
| 4 | 6 | :data="tableData" |
| 7 | + :header-cell-style="{ textAlign: 'center' ,height:'20px',lineHeight:'20px' }" | |
| 8 | + border | |
| 5 | 9 | highlight-current-row |
| 6 | 10 | @current-change="handleCurrentChange" |
| 7 | 11 | height="250" |
| 8 | - style="width: 100%"> | |
| 12 | + style="width: 100%;text-align: center"> | |
| 9 | 13 | <el-table-column |
| 10 | 14 | type="index" |
| 11 | 15 | fixed |
| 12 | - width="100"> | |
| 16 | + align="center" | |
| 17 | + width="100" | |
| 18 | + label="序号"> | |
| 13 | 19 | </el-table-column> |
| 14 | 20 | <el-table-column |
| 15 | 21 | property="name" |
| 22 | + align="center" | |
| 16 | 23 | label="名称"> |
| 17 | 24 | </el-table-column> |
| 18 | 25 | <el-table-column |
| 19 | - property="date" | |
| 26 | + align="center" | |
| 20 | 27 | label="日期"> |
| 28 | + <template slot-scope="scope"> | |
| 29 | + {{`${scope.row.startTime}-${scope.row.endTime}`}} | |
| 30 | + </template> | |
| 21 | 31 | </el-table-column> |
| 22 | 32 | <el-table-column |
| 23 | 33 | property="status" |
| 34 | + align="center" | |
| 24 | 35 | label="状态"> |
| 36 | + <template slot-scope="scope"> | |
| 37 | + <span v-if="scope.row.status===null ||scope.row.status === '0'"><el-tag>未上传</el-tag></span> | |
| 38 | + <span v-if="scope.row.status==='2'"><el-tag type="info">上传中</el-tag></span> | |
| 39 | + <span v-if="scope.row.status==='3'"><el-tag type="success">已上传</el-tag></span> | |
| 40 | + </template> | |
| 25 | 41 | </el-table-column> |
| 26 | 42 | <el-table-column |
| 27 | 43 | fixed="right" |
| 44 | + align="center" | |
| 28 | 45 | label="操作"> |
| 29 | 46 | <template slot-scope="scope"> |
| 30 | 47 | <el-button icon="el-icon-video-play" size="small" style="border: none" @click="playHistoryVideo(scope.row)"></el-button> |
| 31 | - <el-button v-if="scope.row.status === '1'" icon="el-icon-upload" size="small" style="border: none" @click="uploadHistoryVideo(scope.row)"></el-button> | |
| 32 | - <el-button v-if="scope.row.status === '2'" icon="el-icon-download" size="small" style="border: none" @click="downloadHistoryVideo(scope.row)"></el-button> | |
| 48 | + <el-button v-if="scope.row.status === '0'" icon="el-icon-upload" size="small" style="border: none" @click="uploadHistoryVideo(scope.row)"></el-button> | |
| 49 | + <el-button v-if="scope.row.status === '3'" | |
| 50 | + icon="el-icon-download" | |
| 51 | + :disabled="scope.row.disabled" | |
| 52 | + size="small" style="border: none" | |
| 53 | + @click="downloadHistoryVideo(scope.row)"> | |
| 54 | + {{ scope.row.disabled ? `${scope.row.countdown}s` : '' }} | |
| 55 | + </el-button> | |
| 33 | 56 | </template> |
| 34 | 57 | </el-table-column> |
| 35 | 58 | </el-table> |
| 59 | + <el-empty v-else style="width: 100%;height: 100%"></el-empty> | |
| 60 | + </div> | |
| 36 | 61 | </template> |
| 37 | 62 | |
| 38 | 63 | <script> |
| ... | ... | @@ -50,7 +75,8 @@ |
| 50 | 75 | data() { |
| 51 | 76 | //这里存放数据" |
| 52 | 77 | return { |
| 53 | - currentRow: null | |
| 78 | + currentRow: null, | |
| 79 | + historyTimer: null | |
| 54 | 80 | }; |
| 55 | 81 | }, |
| 56 | 82 | //计算属性 类似于data概念", |
| ... | ... | @@ -87,8 +113,48 @@ |
| 87 | 113 | * 下载历史视频 |
| 88 | 114 | * @param row |
| 89 | 115 | */ |
| 90 | - downloadHistoryVideo(row){ | |
| 91 | - this.$emit('downloadHistoryVideo', row); | |
| 116 | + downloadHistoryVideo(data){ | |
| 117 | + if (data.disabled) return; | |
| 118 | + if (data.historyTimer){ | |
| 119 | + this.$message.warning("点击太频繁,请稍后重试") | |
| 120 | + } | |
| 121 | + let initialCountdown = data.countdown; | |
| 122 | + const timer = setInterval(() => { | |
| 123 | + if (data.countdown > 0) { | |
| 124 | + data.countdown--; | |
| 125 | + } else { | |
| 126 | + clearInterval(timer); | |
| 127 | + data.countdown = initialCountdown; // 重置倒计时 | |
| 128 | + data.isCountingDown = false; // 结束倒计时 | |
| 129 | + } | |
| 130 | + }, 1000); | |
| 131 | + /** | |
| 132 | + * 下载历史视频 | |
| 133 | + */ | |
| 134 | + this.$axios({ | |
| 135 | + url: `/api/jt1078/query/history/download/${data.name}`, // 请求URL | |
| 136 | + method: 'GET', // 将FTP文件路径作为参数传递 | |
| 137 | + responseType: 'blob', // 告知axios以二进制数据流的形式处理响应 | |
| 138 | + }).then((response) => { | |
| 139 | + const blob = new Blob([response.data], { type: 'application/octet-stream' }); | |
| 140 | + const link = document.createElement('a'); | |
| 141 | + data.disabled = true; | |
| 142 | + link.href = window.URL.createObjectURL(blob); | |
| 143 | + link.download = data.name + ".mp4"; // 设置下载文件名 | |
| 144 | + document.body.appendChild(link); | |
| 145 | + link.click(); | |
| 146 | + document.body.removeChild(link); | |
| 147 | + clearInterval(timer); | |
| 148 | + data.countdown = initialCountdown; // 重置倒计时 | |
| 149 | + data.isCountingDown = false; | |
| 150 | + this.$message.success(`${link.download} 下载成功`) | |
| 151 | + }).catch(error => { | |
| 152 | + clearInterval(timer); | |
| 153 | + data.countdown = initialCountdown; // 重置倒计时 | |
| 154 | + data.isCountingDown = false; | |
| 155 | + this.$message.error(`${data.name} 下载失败`) | |
| 156 | + console.error("下载失败", error); | |
| 157 | + }); | |
| 92 | 158 | } |
| 93 | 159 | }, |
| 94 | 160 | //生命周期 - 创建完成(可以访问当前this实例)", | ... | ... |
web_src/src/components/JT1078Components/deviceList/Device1078Tree.vue
| ... | ... | @@ -33,9 +33,12 @@ |
| 33 | 33 | <span v-if="data.abnormalStatus !== undefined && data.abnormalStatus === 10"> |
| 34 | 34 | <i class="el-icon-location" style="color: #909399"></i>{{ `${data.name}(未接入)` }} |
| 35 | 35 | </span> |
| 36 | - <span v-if="data.abnormalStatus === undefined && data.children "> | |
| 36 | + <span v-if="data.abnormalStatus === undefined && data.children && data.children.length > 0 "> | |
| 37 | 37 | {{ `${data.name}(${data.onlineData.length}/${data.children.length})` }} |
| 38 | 38 | </span> |
| 39 | + <span v-if="data.abnormalStatus === undefined && data.children && data.children.length === 0 "> | |
| 40 | + {{ `${data.name}(0/0)` }} | |
| 41 | + </span> | |
| 39 | 42 | <span v-if="data.abnormalStatus === undefined && data.children === undefined "> |
| 40 | 43 | <i class="el-icon-video-camera-solid"> </i>{{ `${data.name}` }} |
| 41 | 44 | </span> | ... | ... |