Merge branch 'refs/heads/2.7.1'
# Conflicts:
# pom.xml
# src/main/java/com/genersoft/iot/vmp/conf/security/WebSecurityConfig.java
# src/main/java/com/genersoft/iot/vmp/gb28181/transmit/event/request/impl/NotifyRequestForMobilePositionProcessor.java
# src/main/java/com/genersoft/iot/vmp/media/bean/MediaServer.java
# src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
# src/main/java/com/genersoft/iot/vmp/service/ICloudRecordService.java
# src/main/java/com/genersoft/iot/vmp/service/bean/CloudRecordItem.java
# src/main/java/com/genersoft/iot/vmp/service/impl/CloudRecordServiceImpl.java
# src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
# src/main/java/com/genersoft/iot/vmp/service/impl/MediaServiceImpl.java
# src/main/java/com/genersoft/iot/vmp/service/impl/StreamProxyServiceImpl.java
# src/main/java/com/genersoft/iot/vmp/storager/dao/CloudRecordServiceMapper.java
# src/main/java/com/genersoft/iot/vmp/storager/dao/MediaServerMapper.java
| | |
| | | import io.swagger.v3.oas.models.info.Info; |
| | | import io.swagger.v3.oas.models.info.License; |
| | | import io.swagger.v3.oas.models.security.SecurityScheme; |
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| | | import org.springframework.core.annotation.Order; |
| | | import org.springdoc.core.GroupedOpenApi; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | |
| | | */ |
| | | @Configuration |
| | | @Order(1) |
| | | @ConditionalOnProperty(value = "user-settings.doc-enable", havingValue = "true", matchIfMissing = true) |
| | | public class SpringDocConfig { |
| | | |
| | | @Value("${doc.enabled: true}") |
| | |
| | | private Boolean deviceStatusNotify = Boolean.TRUE; |
| | | private Boolean useCustomSsrcForParentInvite = Boolean.TRUE; |
| | | |
| | | private Boolean docEnable = Boolean.TRUE; |
| | | |
| | | private String serverId = "000000"; |
| | | |
| | | private String thirdPartyGBIdReg = "[\\s\\S]*"; |
| | |
| | | public void setRegisterKeepIntDialog(boolean registerKeepIntDialog) { |
| | | this.registerKeepIntDialog = registerKeepIntDialog; |
| | | } |
| | | |
| | | public Boolean getDocEnable() { |
| | | return docEnable; |
| | | } |
| | | |
| | | public void setDocEnable(Boolean docEnable) { |
| | | this.docEnable = docEnable; |
| | | } |
| | | } |
| | |
| | | package com.genersoft.iot.vmp.conf.redis; |
| | | |
| | | import com.alibaba.fastjson2.support.spring.data.redis.GenericFastJsonRedisSerializer; |
| | | import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; |
| | | import org.springframework.context.annotation.Bean; |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.data.redis.connection.RedisConnectionFactory; |
| | |
| | | redisTemplate.setConnectionFactory(redisConnectionFactory); |
| | | return redisTemplate; |
| | | } |
| | | |
| | | @Bean |
| | | public RedisTemplate<String, MobilePosition> getRedisTemplateForMobilePosition(RedisConnectionFactory redisConnectionFactory) { |
| | | RedisTemplate<String, MobilePosition> redisTemplate = new RedisTemplate<>(); |
| | | // 使ç¨fastJsonåºåå |
| | | GenericFastJsonRedisSerializer fastJsonRedisSerializer = new GenericFastJsonRedisSerializer(); |
| | | // valueå¼çåºååéç¨fastJsonRedisSerializer |
| | | redisTemplate.setValueSerializer(fastJsonRedisSerializer); |
| | | redisTemplate.setHashValueSerializer(fastJsonRedisSerializer); |
| | | |
| | | // keyçåºååéç¨StringRedisSerializer |
| | | redisTemplate.setKeySerializer(new StringRedisSerializer()); |
| | | redisTemplate.setHashKeySerializer(new StringRedisSerializer()); |
| | | redisTemplate.setConnectionFactory(redisConnectionFactory); |
| | | return redisTemplate; |
| | | } |
| | | } |
| | |
| | | |
| | | // 忽ç¥ç»å½è¯·æ±çtokenéªè¯ |
| | | String requestURI = request.getRequestURI(); |
| | | if ((requestURI.startsWith("/doc.html") || requestURI.startsWith("/swagger-ui") ) && !userSetting.getDocEnable()) { |
| | | response.setStatus(HttpServletResponse.SC_NOT_FOUND); |
| | | return; |
| | | } |
| | | if (requestURI.equalsIgnoreCase("/api/user/login")) { |
| | | chain.doFilter(request, response); |
| | | return; |
| | | } |
| | | |
| | | if (!userSetting.isInterfaceAuthentication()) { |
| | | UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(null, null, new ArrayList<>() ); |
| | | SecurityContextHolder.getContext().setAuthentication(token); |
| | |
| | | .authorizeRequests() |
| | | .requestMatchers(CorsUtils::isPreFlightRequest).permitAll() |
| | | .antMatchers(userSetting.getInterfaceAuthenticationExcludes().toArray(new String[0])).permitAll() |
| | | .antMatchers("/api/user/login", "/index/hook/**","/index/hook/abl/**", "/swagger-ui/**", "/doc.html").permitAll() |
| | | .antMatchers("/api/user/login", "/index/hook/**","/index/hook/abl/**", "/swagger-ui/**", "/doc.html#/**").permitAll() |
| | | .anyRequest().authenticated() |
| | | // å¼å¸¸å¤çå¨ |
| | | .and() |
| | |
| | | // via
|
| | | ArrayList<ViaHeader> viaHeaders = new ArrayList<ViaHeader>();
|
| | | ViaHeader viaHeader = SipFactory.getInstance().createHeaderFactory().createViaHeader(sipLayer.getLocalIp(device.getLocalIp()), sipConfig.getPort(), device.getTransport(), SipUtils.getNewViaTag());
|
| | | // viaHeader.setRPort();
|
| | | viaHeaders.add(viaHeader);
|
| | | //from
|
| | | SipURI fromSipURI = SipFactory.getInstance().createAddressFactory().createSipURI(sipConfig.getId(),sipConfig.getDomain());
|
| | |
| | | if (parentPlatform == null) { |
| | | return; |
| | | } |
| | | if (logger.isDebugEnabled()) { |
| | | logger.debug("[åé ç§»å¨ä½ç½®è®¢é
] {}/{}->{},{}", parentPlatform.getServerGBId(), gpsMsgInfo.getId(), gpsMsgInfo.getLng(), gpsMsgInfo.getLat()); |
| | | } |
| | | logger.info("[åé ç§»å¨ä½ç½®è®¢é
] {}/{}->{},{}", parentPlatform.getServerGBId(), gpsMsgInfo.getId(), gpsMsgInfo.getLng(), gpsMsgInfo.getLat()); |
| | | |
| | | String characterSet = parentPlatform.getCharacterSet(); |
| | | StringBuffer deviceStatusXml = new StringBuffer(600); |
| | |
| | | import com.genersoft.iot.vmp.gb28181.utils.NumericUtil; |
| | | import com.genersoft.iot.vmp.gb28181.utils.SipUtils; |
| | | import com.genersoft.iot.vmp.service.IDeviceChannelService; |
| | | import com.genersoft.iot.vmp.service.IMobilePositionService; |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import com.genersoft.iot.vmp.utils.DateUtil; |
| | | import org.dom4j.DocumentException; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import javax.sip.RequestEvent; |
| | | import javax.sip.header.FromHeader; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.concurrent.ConcurrentHashMap; |
| | | import java.util.concurrent.ConcurrentLinkedQueue; |
| | | |
| | | /** |
| | |
| | | @Autowired |
| | | private IDeviceChannelService deviceChannelService; |
| | | |
| | | @Autowired |
| | | private IMobilePositionService mobilePositionService; |
| | | |
| | | public void process(RequestEvent evt) { |
| | | |
| | | if (taskQueue.size() >= userSetting.getMaxNotifyCountQueue()) { |
| | |
| | | } |
| | | |
| | | @Scheduled(fixedRate = 200) //æ¯200æ¯«ç§æ§è¡ä¸æ¬¡ |
| | | @Transactional |
| | | public void executeTaskQueue() { |
| | | if (taskQueue.isEmpty()) { |
| | | return; |
| | | } |
| | | Map<String, DeviceChannel> updateChannelMap = new ConcurrentHashMap<>(); |
| | | List<MobilePosition> addMobilePositionList = new ArrayList<>(); |
| | | for (HandlerCatchData take : taskQueue) { |
| | | if (take == null) { |
| | | continue; |
| | |
| | | } |
| | | } |
| | | |
| | | // logger.info("[æ¶å°ç§»å¨ä½ç½®è®¢é
éç¥]ï¼{}/{}->{}.{}, æ¶é´ï¼ {}", mobilePosition.getDeviceId(), mobilePosition.getChannelId(), |
| | | // mobilePosition.getLongitude(), mobilePosition.getLatitude(), System.currentTimeMillis() - startTime); |
| | | logger.debug("[æ¶å°ç§»å¨ä½ç½®è®¢é
éç¥]ï¼{}/{}->{}.{}, æ¶é´ï¼ {}", mobilePosition.getDeviceId(), mobilePosition.getChannelId(), |
| | | mobilePosition.getLongitude(), mobilePosition.getLatitude(), System.currentTimeMillis() - startTime); |
| | | mobilePosition.setReportSource("Mobile Position"); |
| | | |
| | | // æ´æ°device channel çç»çº¬åº¦ |
| | | DeviceChannel deviceChannel = new DeviceChannel(); |
| | | deviceChannel.setDeviceId(device.getDeviceId()); |
| | | deviceChannel.setLongitude(mobilePosition.getLongitude()); |
| | | deviceChannel.setLatitude(mobilePosition.getLatitude()); |
| | | deviceChannel.setGpsTime(mobilePosition.getTime()); |
| | | updateChannelMap.put(deviceId + mobilePosition.getChannelId(), deviceChannel); |
| | | addMobilePositionList.add(mobilePosition); |
| | | |
| | | |
| | | mobilePositionService.add(mobilePosition); |
| | | // åå
³èäºè¯¥ééå¹¶ä¸å¼å¯ç§»å¨ä½ç½®è®¢é
çä¸çº§å¹³å°åéç§»å¨ä½ç½®è®¢é
æ¶æ¯ |
| | | try { |
| | | eventPublisher.mobilePositionEventPublish(mobilePosition); |
| | |
| | | } |
| | | } |
| | | taskQueue.clear(); |
| | | if(!updateChannelMap.isEmpty()) { |
| | | List<DeviceChannel> channels = new ArrayList<>(updateChannelMap.values()); |
| | | logger.info("[ç§»å¨ä½ç½®è®¢é
]æ´æ°ééä½ç½®ï¼ {}", channels.size()); |
| | | deviceChannelService.batchUpdateChannel(channels); |
| | | updateChannelMap.clear(); |
| | | } |
| | | if (userSetting.isSavePositionHistory() && !addMobilePositionList.isEmpty()) { |
| | | try { |
| | | logger.info("[ç§»å¨ä½ç½®è®¢é
] æ·»å éé轨迹ç¹ä½ï¼ {}", addMobilePositionList.size()); |
| | | deviceChannelService.batchAddMobilePosition(addMobilePositionList); |
| | | }catch (Exception e) { |
| | | logger.info("[ç§»å¨ä½ç½®è®¢é
] bæ·»å éé轨迹ç¹ä½ä¿åå¤±è´¥ï¼ {}", addMobilePositionList.size()); |
| | | } |
| | | addMobilePositionList.clear(); |
| | | } |
| | | } |
| | | @Scheduled(fixedRate = 10000) |
| | | public void execute(){ |
| | |
| | | @Schema(description = "ç±»åï¼ zlm/abl") |
| | | private String type; |
| | | |
| | | @Schema(description = "转ç çåç¼") |
| | | private String transcodeSuffix; |
| | | |
| | | public MediaServer() { |
| | | } |
| | | |
| | |
| | | rtpEnable = false; // é»è®¤ä½¿ç¨å端å£;ç´å°ç¨æ·èªå·±è®¾ç½®å¼å¯å¤ç«¯å£ |
| | | rtpPortRange = zlmServerConfig.getPortRange().replace("_",","); // é»è®¤ä½¿ç¨30000,30500ä½ä¸ºçº§èæ¶åéæµç端å£å· |
| | | recordAssistPort = 0; // é»è®¤å
³é |
| | | transcodeSuffix = zlmServerConfig.getTranscodeSuffix(); |
| | | |
| | | } |
| | | |
| | |
| | | public void setWsFlvSSLPort(int wsFlvSSLPort) { |
| | | this.wsFlvSSLPort = wsFlvSSLPort; |
| | | } |
| | | |
| | | public String getTranscodeSuffix() { |
| | | return transcodeSuffix; |
| | | } |
| | | |
| | | public void setTranscodeSuffix(String transcodeSuffix) { |
| | | this.transcodeSuffix = transcodeSuffix; |
| | | } |
| | | } |
| | |
| | | return port; |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | interface CheckPortCallback{ |
| | |
| | | import com.genersoft.iot.vmp.service.redisMsg.IRedisRpcService;
|
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
| | | import com.genersoft.iot.vmp.storager.IVideoManagerStorage;
|
| | | import com.genersoft.iot.vmp.utils.DateUtil;
|
| | | import com.genersoft.iot.vmp.utils.MediaServerUtils;
|
| | | import com.genersoft.iot.vmp.vmanager.bean.ErrorCode;
|
| | | import com.genersoft.iot.vmp.vmanager.bean.OtherPsSendInfo;
|
| | | import com.genersoft.iot.vmp.vmanager.bean.OtherRtpSendInfo;
|
| | | import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
|
| | | import org.slf4j.Logger;
|
| | | import org.slf4j.LoggerFactory;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | |
| | |
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | | import java.util.HashMap;
|
| | | import javax.sip.InvalidArgumentException;
|
| | | import javax.sip.SipException;
|
| | | import java.text.ParseException;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | |
|
| | | /**
|
| | |
| | | if (mediaServer == null) {
|
| | | return HookResult.SUCCESS();
|
| | | }
|
| | | if (!ObjectUtils.isEmpty(mediaServer.getTranscodeSuffix())
|
| | | && !"null".equalsIgnoreCase(mediaServer.getTranscodeSuffix())
|
| | | && param.getStream().endsWith(mediaServer.getTranscodeSuffix()) ) {
|
| | | return;
|
| | | }
|
| | | if (param.getSchema().equalsIgnoreCase("rtsp")) {
|
| | | if (param.isRegist()) {
|
| | | logger.info("[ZLM HOOK] æµæ³¨å, {}->{}->{}/{}", param.getMediaServerId(), param.getSchema(), param.getApp(), param.getStream());
|
| | |
| | |
|
| | | logger.info("[ZLM HOOK]æµæ 人è§çï¼{}->{}->{}/{}", param.getMediaServerId(), param.getSchema(),
|
| | | param.getApp(), param.getStream());
|
| | |
|
| | | MediaServerItem mediaInfo = mediaServerService.getOne(param.getMediaServerId());
|
| | | if (mediaInfo == null) {
|
| | | JSONObject ret = new JSONObject();
|
| | | ret.put("code", 0);
|
| | | return ret;
|
| | | }
|
| | | if (!ObjectUtils.isEmpty(mediaInfo.getTranscodeSuffix())
|
| | | && !"null".equalsIgnoreCase(mediaInfo.getTranscodeSuffix())
|
| | | && param.getStream().endsWith(mediaInfo.getTranscodeSuffix()) ) {
|
| | | param.setStream(param.getStream().substring(0, param.getStream().lastIndexOf(mediaInfo.getTranscodeSuffix()) -1 ));
|
| | | }
|
| | |
|
| | | JSONObject ret = new JSONObject();
|
| | | boolean close = mediaService.closeStreamOnNoneReader(param.getMediaServerId(), param.getApp(), param.getStream(), param.getSchema());
|
| | | ret.put("code", 0);
|
| | |
| | | }
|
| | |
|
| | | return HookResult.SUCCESS();
|
| | | }
|
| | |
|
| | | private Map<String, String> urlParamToMap(String params) {
|
| | | HashMap<String, String> map = new HashMap<>();
|
| | | if (ObjectUtils.isEmpty(params)) {
|
| | | return map;
|
| | | }
|
| | | String[] paramsArray = params.split("&");
|
| | | if (paramsArray.length == 0) {
|
| | | return map;
|
| | | }
|
| | | for (String param : paramsArray) {
|
| | | String[] paramArray = param.split("=");
|
| | | if (paramArray.length == 2) {
|
| | | map.put(paramArray[0], paramArray[1]);
|
| | | }
|
| | | }
|
| | | return map;
|
| | | }
|
| | | }
|
| | |
| | | @JSONField(name = "shell.shell") |
| | | private String shellPhell; |
| | | |
| | | @JSONField(name = "transcode.suffix") |
| | | private String transcodeSuffix; |
| | | |
| | | |
| | | public String getHookIp() { |
| | | return hookIp; |
| | |
| | | public void setHookOnRtpServerTimeout(String hookOnRtpServerTimeout) { |
| | | this.hookOnRtpServerTimeout = hookOnRtpServerTimeout; |
| | | } |
| | | |
| | | public String getTranscodeSuffix() { |
| | | return transcodeSuffix; |
| | | } |
| | | |
| | | public void setTranscodeSuffix(String transcodeSuffix) { |
| | | this.transcodeSuffix = transcodeSuffix; |
| | | } |
| | | } |
| | |
| | | private String vhost; |
| | | private long start_time; |
| | | private double time_len; |
| | | private String params; |
| | | |
| | | public String getApp() { |
| | | return app; |
| | |
| | | this.time_len = time_len; |
| | | } |
| | | |
| | | public String getParams() { |
| | | return params; |
| | | } |
| | | |
| | | public void setParams(String params) { |
| | | this.params = params; |
| | | } |
| | | |
| | | @Override |
| | | public String toString() { |
| | | return "OnRecordMp4HookParam{" + |
| | |
| | | ", vhost='" + vhost + '\'' + |
| | | ", start_time=" + start_time + |
| | | ", time_len=" + time_len + |
| | | ", params=" + params + |
| | | '}'; |
| | | } |
| | | } |
| | |
| | | /** |
| | | * å页åå»äºç«¯å½åå表 |
| | | */ |
| | | PageInfo<CloudRecordItem> getList(int page, int count, String query, String app, String stream, String startTime, String endTime, List<MediaServer> mediaServerItems); |
| | | PageInfo<CloudRecordItem> getList(int page, int count, String query, String app, String stream, String startTime, String endTime, List<MediaServer> mediaServerItems, String callId); |
| | | |
| | | /** |
| | | * æ ¹æ®hookæ¶æ¯å¢å 䏿¡è®°å½ |
| | | */ |
| | | void addRecord(OnRecordMp4HookParam param); |
| | | |
| | | /** |
| | | * è·åææçæ¥æ |
| | |
| | | * è·åææ¾å°å |
| | | */ |
| | | DownloadFileInfo getPlayUrlPath(Integer recordId); |
| | | |
| | | List<CloudRecordItem> getAllList(String query, String app, String stream, String startTime, String endTime, List<MediaServerItem> mediaServerItems, String callId, List<Integer> ids); |
| | | } |
New file |
| | |
| | | package com.genersoft.iot.vmp.service; |
| | | |
| | | |
| | | import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; |
| | | |
| | | import java.util.List; |
| | | |
| | | public interface IMobilePositionService { |
| | | |
| | | void add(List<MobilePosition> mobilePositionList); |
| | | |
| | | void add(MobilePosition mobilePosition); |
| | | } |
| | |
| | | |
| | | import com.genersoft.iot.vmp.media.event.media.MediaRecordMp4Event; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.hook.OnRecordMp4HookParam; |
| | | import com.genersoft.iot.vmp.utils.MediaServerUtils; |
| | | |
| | | import java.util.Map; |
| | | |
| | | /** |
| | | * äºç«¯å½åæ°æ® |
| | |
| | | cloudRecordItem.setMediaServerId(param.getMediaServer().getId()); |
| | | cloudRecordItem.setTimeLen((long) param.getRecordInfo().getTimeLen() * 1000); |
| | | cloudRecordItem.setEndTime((param.getRecordInfo().getStartTime() + (long)param.getRecordInfo().getTimeLen()) * 1000); |
| | | Map<String, String> paramsMap = MediaServerUtils.urlParamToMap(param.getParams()); |
| | | if (paramsMap.get("callId") != null) { |
| | | cloudRecordItem.setCallId(paramsMap.get("callId")); |
| | | } |
| | | return cloudRecordItem; |
| | | } |
| | | |
| | |
| | | import com.genersoft.iot.vmp.media.zlm.AssistRESTfulUtils; |
| | | import com.genersoft.iot.vmp.media.bean.MediaServer; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.hook.OnRecordMp4HookParam; |
| | | import com.genersoft.iot.vmp.service.ICloudRecordService; |
| | | import com.genersoft.iot.vmp.media.service.IMediaServerService; |
| | | import com.genersoft.iot.vmp.service.bean.CloudRecordItem; |
| | |
| | | import org.springframework.scheduling.annotation.Async; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.time.*; |
| | | import java.util.*; |
| | | import java.time.LocalDate; |
| | | import java.time.ZoneOffset; |
| | | import java.util.ArrayList; |
| | | import java.util.HashSet; |
| | | import java.util.List; |
| | | import java.util.Set; |
| | | |
| | | @Service |
| | | @DS("share") |
| | |
| | | private VideoStreamSessionManager streamSession; |
| | | |
| | | @Override |
| | | public PageInfo<CloudRecordItem> getList(int page, int count, String query, String app, String stream, String startTime, String endTime, List<MediaServer> mediaServerItems) { |
| | | public PageInfo<CloudRecordItem> getList(int page, int count, String query, String app, String stream, String startTime, String endTime, List<MediaServerItem> mediaServerItems, String callId) { |
| | | // å¼å§æ¶é´åç»ææ¶é´å¨æ°æ®åºä¸é½æ¯ä»¥ç§ä¸ºåä½ç |
| | | Long startTimeStamp = null; |
| | | Long endTimeStamp = null; |
| | |
| | | } |
| | | PageHelper.startPage(page, count); |
| | | List<CloudRecordItem> all = cloudRecordServiceMapper.getList(query, app, stream, startTimeStamp, endTimeStamp, |
| | | null, mediaServerItems); |
| | | callId, mediaServerItems, null); |
| | | return new PageInfo<>(all); |
| | | } |
| | | |
| | |
| | | long startTimeStamp = startDate.atStartOfDay().toInstant(ZoneOffset.ofHours(8)).getEpochSecond() * 1000; |
| | | long endTimeStamp = endDate.atStartOfDay().toInstant(ZoneOffset.ofHours(8)).getEpochSecond() * 1000; |
| | | List<CloudRecordItem> cloudRecordItemList = cloudRecordServiceMapper.getList(null, app, stream, startTimeStamp, |
| | | endTimeStamp, null, mediaServerItems); |
| | | endTimeStamp, null, mediaServerItems, null); |
| | | if (cloudRecordItemList.isEmpty()) { |
| | | return new ArrayList<>(); |
| | | } |
| | |
| | | @EventListener |
| | | public void onApplicationEvent(MediaRecordMp4Event event) { |
| | | CloudRecordItem cloudRecordItem = CloudRecordItem.getInstance(event); |
| | | StreamAuthorityInfo streamAuthorityInfo = redisCatchStorage.getStreamAuthorityInfo(event.getApp(), event.getStream()); |
| | | if (streamAuthorityInfo != null) { |
| | | cloudRecordItem.setCallId(streamAuthorityInfo.getCallId()); |
| | | } |
| | | logger.info("[æ·»å å½åè®°å½] {}/{} å
容ï¼{}", event.getApp(), event.getStream(), event.getRecordInfo()); |
| | | cloudRecordServiceMapper.add(cloudRecordItem); |
| | | } |
| | |
| | | } |
| | | |
| | | List<CloudRecordItem> all = cloudRecordServiceMapper.getList(null, app, stream, startTimeStamp, endTimeStamp, |
| | | callId, mediaServerItems); |
| | | callId, mediaServerItems, null); |
| | | if (all.isEmpty()) { |
| | | throw new ControllerException(ErrorCode.ERROR100.getCode(), "æªæ¾å°å¾
æ¶èçè§é¢"); |
| | | } |
| | |
| | | MediaServer mediaServerItem = mediaServerService.getOne(recordItem.getMediaServerId()); |
| | | return CloudRecordUtils.getDownloadFilePath(mediaServerItem, filePath); |
| | | } |
| | | |
| | | @Override |
| | | public List<CloudRecordItem> getAllList(String query, String app, String stream, String startTime, String endTime, List<MediaServerItem> mediaServerItems, String callId, List<Integer> ids) { |
| | | // å¼å§æ¶é´åç»ææ¶é´å¨æ°æ®åºä¸é½æ¯ä»¥ç§ä¸ºåä½ç |
| | | Long startTimeStamp = null; |
| | | Long endTimeStamp = null; |
| | | if (startTime != null ) { |
| | | if (!DateUtil.verification(startTime, DateUtil.formatter)) { |
| | | throw new ControllerException(ErrorCode.ERROR100.getCode(), "å¼å§æ¶é´æ ¼å¼éè¯¯ï¼æ£ç¡®æ ¼å¼ä¸ºï¼ " + DateUtil.formatter); |
| | | } |
| | | startTimeStamp = DateUtil.yyyy_MM_dd_HH_mm_ssToTimestampMs(startTime); |
| | | |
| | | } |
| | | if (endTime != null ) { |
| | | if (!DateUtil.verification(endTime, DateUtil.formatter)) { |
| | | throw new ControllerException(ErrorCode.ERROR100.getCode(), "ç»ææ¶é´æ ¼å¼éè¯¯ï¼æ£ç¡®æ ¼å¼ä¸ºï¼ " + DateUtil.formatter); |
| | | } |
| | | endTimeStamp = DateUtil.yyyy_MM_dd_HH_mm_ssToTimestampMs(endTime); |
| | | |
| | | } |
| | | return cloudRecordServiceMapper.getList(query, app, stream, startTimeStamp, endTimeStamp, |
| | | callId, mediaServerItems, ids); |
| | | } |
| | | } |
| | |
| | | import com.genersoft.iot.vmp.gb28181.transmit.cmd.ISIPCommanderForPlatform; |
| | | import com.genersoft.iot.vmp.media.bean.MediaServer; |
| | | import com.genersoft.iot.vmp.media.bean.ResultForOnPublish; |
| | | import com.alibaba.fastjson2.JSONArray; |
| | | import com.alibaba.fastjson2.JSONObject; |
| | | import com.genersoft.iot.vmp.common.StreamInfo; |
| | | import com.genersoft.iot.vmp.conf.MediaConfig; |
| | | import com.genersoft.iot.vmp.media.zlm.ZLMRESTfulUtils; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem; |
| | | import com.genersoft.iot.vmp.service.*; |
New file |
| | |
| | | package com.genersoft.iot.vmp.service.impl; |
| | | |
| | | import com.genersoft.iot.vmp.conf.UserSetting; |
| | | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; |
| | | import com.genersoft.iot.vmp.gb28181.bean.MobilePosition; |
| | | import com.genersoft.iot.vmp.service.IMobilePositionService; |
| | | import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper; |
| | | import com.genersoft.iot.vmp.storager.dao.DeviceMobilePositionMapper; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.scheduling.annotation.Scheduled; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | |
| | | |
| | | @Service |
| | | public class MobilePositionServiceImpl implements IMobilePositionService { |
| | | |
| | | @Autowired |
| | | private DeviceChannelMapper channelMapper; |
| | | |
| | | @Autowired |
| | | private DeviceMobilePositionMapper mobilePositionMapper; |
| | | |
| | | @Autowired |
| | | private UserSetting userSetting; |
| | | |
| | | @Autowired |
| | | private RedisTemplate<String, MobilePosition> redisTemplate; |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(MobilePositionServiceImpl.class); |
| | | |
| | | private final String REDIS_MOBILE_POSITION_LIST = "redis_mobile_position_list"; |
| | | |
| | | @Override |
| | | public void add(MobilePosition mobilePosition) { |
| | | List<MobilePosition> list = new ArrayList<>(); |
| | | list.add(mobilePosition); |
| | | add(list); |
| | | } |
| | | |
| | | @Override |
| | | public void add(List<MobilePosition> mobilePositionList) { |
| | | redisTemplate.opsForList().leftPushAll(REDIS_MOBILE_POSITION_LIST, mobilePositionList); |
| | | } |
| | | |
| | | private List<MobilePosition> get(int length) { |
| | | Long size = redisTemplate.opsForList().size(REDIS_MOBILE_POSITION_LIST); |
| | | if (size == null || size == 0) { |
| | | return new ArrayList<>(); |
| | | } |
| | | List<MobilePosition> mobilePositions; |
| | | if (size > length) { |
| | | mobilePositions = redisTemplate.opsForList().rightPop(REDIS_MOBILE_POSITION_LIST, length); |
| | | }else { |
| | | mobilePositions = redisTemplate.opsForList().rightPop(REDIS_MOBILE_POSITION_LIST, size); |
| | | } |
| | | return mobilePositions; |
| | | } |
| | | |
| | | |
| | | |
| | | @Scheduled(fixedRate = 1000) |
| | | @Transactional |
| | | public void executeTaskQueue() { |
| | | int countLimit = 3000; |
| | | List<MobilePosition> mobilePositions = get(countLimit); |
| | | if (mobilePositions == null || mobilePositions.isEmpty()) { |
| | | return; |
| | | } |
| | | if (userSetting.getSavePositionHistory()) { |
| | | mobilePositionMapper.batchadd(mobilePositions); |
| | | } |
| | | logger.info("[ç§»å¨ä½ç½®è®¢é
]æ´æ°ééä½ç½®ï¼ {}", mobilePositions.size()); |
| | | Map<String, DeviceChannel> updateChannelMap = new HashMap<>(); |
| | | for (MobilePosition mobilePosition : mobilePositions) { |
| | | DeviceChannel deviceChannel = new DeviceChannel(); |
| | | deviceChannel.setDeviceId(mobilePosition.getDeviceId()); |
| | | deviceChannel.setLongitude(mobilePosition.getLongitude()); |
| | | deviceChannel.setLatitude(mobilePosition.getLatitude()); |
| | | deviceChannel.setGpsTime(mobilePosition.getTime()); |
| | | updateChannelMap.put(mobilePosition.getDeviceId() + mobilePosition.getChannelId(), deviceChannel); |
| | | } |
| | | List<DeviceChannel> channels = new ArrayList<>(updateChannelMap.values()); |
| | | channelMapper.batchUpdatePosition(channels); |
| | | } |
| | | |
| | | } |
| | |
| | | } |
| | | String msgResult; |
| | | if ("ffmpeg".equalsIgnoreCase(param.getType())){ |
| | | if (param.getTimeoutMs() == 0) { |
| | | param.setTimeoutMs(15); |
| | | } |
| | | result = mediaServerService.addFFmpegSource(mediaServer, param.getSrcUrl().trim(), param.getDstUrl(), |
| | | param.getTimeoutMs(), param.isEnableAudio(), param.isEnableMp4(), |
| | | param.getFfmpegCmdKey()); |
| | |
| | | gbStreamMapper.del(app, stream); |
| | | videoManagerStorager.deleteStreamProxy(app, stream); |
| | | redisCatchStorage.removeStream(streamProxyItem.getMediaServerId(), "PULL", app, stream); |
| | | redisCatchStorage.removeStream(streamProxyItem.getMediaServerId(), "PUSH", app, stream); |
| | | Boolean result = removeStreamProxyFromZlm(streamProxyItem); |
| | | if (result != null && result) { |
| | | logger.info("[ç§»é¤ä»£ç]ï¼ ä»£çï¼ {}/{}, ä»zlmç§»é¤æå", app, stream); |
| | |
| | | " <if test= 'mediaServerItemList != null ' > and media_server_id in " + |
| | | " <foreach collection='mediaServerItemList' item='item' open='(' separator=',' close=')' > #{item.id}</foreach>" + |
| | | " </if>" + |
| | | " <if test= 'ids != null ' > and id in " + |
| | | " <foreach collection='ids' item='item' open='(' separator=',' close=')' > #{item}</foreach>" + |
| | | " </if>" + |
| | | " order by start_time DESC" + |
| | | |
| | | " </script>") |
| | | List<CloudRecordItem> getList(@Param("query") String query, @Param("app") String app, @Param("stream") String stream, |
| | | @Param("startTimeStamp")Long startTimeStamp, @Param("endTimeStamp")Long endTimeStamp, |
| | | @Param("callId")String callId, List<MediaServer> mediaServerItemList); |
| | | @Param("callId")String callId, List<MediaServer> mediaServerItemList, |
| | | List<Integer> ids); |
| | | |
| | | |
| | | @Select(" <script>" + |
| | |
| | | " </script>"}) |
| | | int updatePosition(DeviceChannel deviceChannel); |
| | | |
| | | @Update({"<script>" + |
| | | "<foreach collection='deviceChannelList' item='item' separator=';'>" + |
| | | " UPDATE" + |
| | | " wvp_device_channel" + |
| | | " SET gps_time=#{item.gpsTime}" + |
| | | "<if test='item.longitude != null'>, longitude=#{item.longitude}</if>" + |
| | | "<if test='item.latitude != null'>, latitude=#{item.latitude}</if>" + |
| | | "<if test='item.longitudeGcj02 != null'>, longitude_gcj02=#{item.longitudeGcj02}</if>" + |
| | | "<if test='item.latitudeGcj02 != null'>, latitude_gcj02=#{item.latitudeGcj02}</if>" + |
| | | "<if test='item.longitudeWgs84 != null'>, longitude_wgs84=#{item.longitudeWgs84}</if>" + |
| | | "<if test='item.latitudeWgs84 != null'>, latitude_wgs84=#{item.latitudeWgs84}</if>" + |
| | | "WHERE device_id=#{item.deviceId} " + |
| | | " <if test='item.channelId != null' > AND channel_id=#{item.channelId}</if>" + |
| | | "</foreach>" + |
| | | "</script>"}) |
| | | int batchUpdatePosition(List<DeviceChannel> deviceChannelList); |
| | | |
| | | @Select("SELECT * FROM wvp_device_channel WHERE length(trim(stream_id)) > 0") |
| | | List<DeviceChannel> getAllChannelInPlay(); |
| | | |
| | |
| | | " <if test='channelId != null'> and channel_id = #{channelId} </if>" + |
| | | "</script>") |
| | | void updateChannelStreamIdentification(DeviceChannel channel); |
| | | |
| | | |
| | | @Update({"<script>" + |
| | | "<foreach collection='channelList' item='item' separator=';'>" + |
| | | " UPDATE" + |
| | | " wvp_device_channel" + |
| | | " SET update_time=#{item.updateTime}" + |
| | | "<if test='item.longitude != null'>, longitude=#{item.longitude}</if>" + |
| | | "<if test='item.latitude != null'>, latitude=#{item.latitude}</if>" + |
| | | "<if test='item.longitudeGcj02 != null'>, longitude_gcj02=#{item.longitudeGcj02}</if>" + |
| | | "<if test='item.latitudeGcj02 != null'>, latitude_gcj02=#{item.latitudeGcj02}</if>" + |
| | | "<if test='item.longitudeWgs84 != null'>, longitude_wgs84=#{item.longitudeWgs84}</if>" + |
| | | "<if test='item.latitudeWgs84 != null'>, latitude_wgs84=#{item.latitudeWgs84}</if>" + |
| | | "<if test='item.gpsTime != null'>, gps_time=#{item.gpsTime}</if>" + |
| | | "<if test='item.id > 0'>WHERE id=#{item.id}</if>" + |
| | | "<if test='item.id == 0'>WHERE device_id=#{item.deviceId} AND channel_id=#{item.channelId}</if>" + |
| | | "</foreach>" + |
| | | "</script>"}) |
| | | void batchUpdatePosition(List<DeviceChannel> channelList); |
| | | |
| | | } |
| | |
| | | void batchadd2(List<MobilePosition> mobilePositions); |
| | | |
| | | @Insert("<script> " + |
| | | "<foreach collection='mobilePositions' index='index' item='item' separator=','> " + |
| | | "<foreach collection='mobilePositions' index='index' item='item' separator=';'> " + |
| | | "insert into wvp_device_mobile_position " + |
| | | "(device_id,channel_id, device_name,time,longitude,latitude,altitude,speed,direction,report_source," + |
| | | "longitude_gcj02,latitude_gcj02,longitude_wgs84,latitude_wgs84,create_time)"+ |
| | |
| | | "(#{item.deviceId}, #{item.channelId}, #{item.deviceName}, #{item.time}, #{item.longitude}, " + |
| | | "#{item.latitude}, #{item.altitude}, #{item.speed},#{item.direction}," + |
| | | "#{item.reportSource}, #{item.longitudeGcj02}, #{item.latitudeGcj02}, #{item.longitudeWgs84}, #{item.latitudeWgs84}, " + |
| | | "#{item.createTime}); " + |
| | | "#{item.createTime}) " + |
| | | "</foreach> " + |
| | | "</script>") |
| | | void batchadd(List<MobilePosition> mobilePositions); |
| | |
| | | "type,"+ |
| | | "create_time,"+ |
| | | "update_time,"+ |
| | | "transcode_suffix,"+ |
| | | "hook_alive_interval"+ |
| | | ") VALUES " + |
| | | "(" + |
| | |
| | | "#{type}, " + |
| | | "#{createTime}, " + |
| | | "#{updateTime}, " + |
| | | "#{transcodeSuffix}, " + |
| | | "#{hookAliveInterval})") |
| | | int add(MediaServer mediaServerItem); |
| | | |
| | |
| | | "<if test=\"hookAliveInterval != null\">, hook_alive_interval=#{hookAliveInterval}</if>" + |
| | | "<if test=\"recordDay != null\">, record_day=#{recordDay}</if>" + |
| | | "<if test=\"recordPath != null\">, record_path=#{recordPath}</if>" + |
| | | "<if test=\"transcodeSuffix != null\">, transcode_suffix=#{transcodeSuffix}</if>" + |
| | | "<if test=\"type != null\">, type=#{type}</if>" + |
| | | "WHERE id=#{id}"+ |
| | | " </script>"}) |
| | |
| | | "<if test=\"recordDay != null\">, record_day=#{recordDay}</if>" + |
| | | "<if test=\"recordPath != null\">, record_path=#{recordPath}</if>" + |
| | | "<if test=\"type != null\">, type=#{type}</if>" + |
| | | "<if test=\"transcodeSuffix != null\">, transcode_suffix=#{transcodeSuffix}</if>" + |
| | | "<if test=\"hookAliveInterval != null\">, hook_alive_interval=#{hookAliveInterval}</if>" + |
| | | "WHERE ip=#{ip} and http_port=#{httpPort}"+ |
| | | " </script>"}) |
| | |
| | | @Override |
| | | public void sendMobilePositionMsg(JSONObject jsonObject) { |
| | | String key = VideoManagerConstants.VM_MSG_SUBSCRIBE_MOBILE_POSITION; |
| | | // logger.info("[redisåééç¥] åé ç§»å¨ä½ç½® {}: {}", key, jsonObject.toString()); |
| | | logger.debug("[redisåééç¥] åé ç§»å¨ä½ç½® {}: {}", key, jsonObject.toString()); |
| | | redisTemplate.convertAndSend(key, jsonObject); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | /** |
| | | * æ¶é´æ³ 转 yyyy_MM_dd_HH_mm_ss |
| | | */ |
| | | public static String timestampMsToUrlToyyyy_MM_dd_HH_mm_ss(long timestamp) { |
| | | Instant instant = Instant.ofEpochMilli(timestamp); |
| | | return urlFormatter.format(LocalDateTime.ofInstant(instant, ZoneId.of(zoneStr))); |
| | | } |
| | | |
| | | /** |
| | | * yyyy_MM_dd_HH_mm_ss 转æ¶é´æ³ï¼æ¯«ç§ï¼ |
| | | * |
| | | * @param formatTime |
New file |
| | |
| | | package com.genersoft.iot.vmp.utils; |
| | | |
| | | import org.springframework.util.ObjectUtils; |
| | | |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | |
| | | public class MediaServerUtils { |
| | | public static Map<String, String> urlParamToMap(String params) { |
| | | HashMap<String, String> map = new HashMap<>(); |
| | | if (ObjectUtils.isEmpty(params)) { |
| | | return map; |
| | | } |
| | | String[] paramsArray = params.split("&"); |
| | | if (paramsArray.length == 0) { |
| | | return map; |
| | | } |
| | | for (String param : paramsArray) { |
| | | String[] paramArray = param.split("="); |
| | | if (paramArray.length == 2) { |
| | | map.put(paramArray[0], paramArray[1]); |
| | | } |
| | | } |
| | | return map; |
| | | } |
| | | } |
| | |
| | | import com.genersoft.iot.vmp.media.service.IMediaServerService; |
| | | import com.genersoft.iot.vmp.service.bean.CloudRecordItem; |
| | | import com.genersoft.iot.vmp.service.bean.DownloadFileInfo; |
| | | import com.genersoft.iot.vmp.utils.DateUtil; |
| | | import com.genersoft.iot.vmp.vmanager.bean.ErrorCode; |
| | | import com.genersoft.iot.vmp.vmanager.cloudRecord.bean.CloudRecordUrl; |
| | | import com.github.pagehelper.PageInfo; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.v3.oas.annotations.Parameter; |
| | |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.IOException; |
| | | import java.util.ArrayList; |
| | | import java.util.Calendar; |
| | | import java.util.List; |
| | | import java.util.zip.ZipEntry; |
| | | import java.util.zip.ZipOutputStream; |
| | | |
| | | @SuppressWarnings("rawtypes") |
| | | @Tag(name = "äºç«¯å½åæ¥å£") |
| | |
| | | @Parameter(name = "startTime", description = "å¼å§æ¶é´(yyyy-MM-dd HH:mm:ss)", required = false) |
| | | @Parameter(name = "endTime", description = "ç»ææ¶é´(yyyy-MM-dd HH:mm:ss)", required = false) |
| | | @Parameter(name = "mediaServerId", description = "æµåªä½IDï¼ç½®ç©ºåæ¥è¯¢å
¨é¨æµåªä½", required = false) |
| | | @Parameter(name = "callId", description = "æ¯æ¬¡å½åçå¯ä¸æ è¯ï¼ç½®ç©ºåæ¥è¯¢å
¨é¨æµåªä½", required = false) |
| | | public PageInfo<CloudRecordItem> openRtpServer( |
| | | @RequestParam(required = false) String query, |
| | | @RequestParam(required = false) String app, |
| | |
| | | @RequestParam int count, |
| | | @RequestParam(required = false) String startTime, |
| | | @RequestParam(required = false) String endTime, |
| | | @RequestParam(required = false) String mediaServerId |
| | | @RequestParam(required = false) String mediaServerId, |
| | | @RequestParam(required = false) String callId |
| | | |
| | | ) { |
| | | logger.info("[äºç«¯å½å] æ¥è¯¢ app->{}, stream->{}, mediaServerId->{}, page->{}, count->{}, startTime->{}, endTime->{}", |
| | | app, stream, mediaServerId, page, count, startTime, endTime); |
| | | logger.info("[äºç«¯å½å] æ¥è¯¢ app->{}, stream->{}, mediaServerId->{}, page->{}, count->{}, startTime->{}, endTime->{}, callId->{}", |
| | | app, stream, mediaServerId, page, count, startTime, endTime, callId); |
| | | |
| | | List<MediaServer> mediaServerItems; |
| | | if (!ObjectUtils.isEmpty(mediaServerId)) { |
| | |
| | | if (endTime != null && ObjectUtils.isEmpty(endTime.trim())) { |
| | | endTime = null; |
| | | } |
| | | return cloudRecordService.getList(page, count, query, app, stream, startTime, endTime, mediaServerItems); |
| | | if (callId != null && ObjectUtils.isEmpty(callId.trim())) { |
| | | callId = null; |
| | | } |
| | | return cloudRecordService.getList(page, count, query, app, stream, startTime, endTime, mediaServerItems, callId); |
| | | } |
| | | |
| | | @ResponseBody |
| | |
| | | ){ |
| | | return cloudRecordService.getPlayUrlPath(recordId); |
| | | } |
| | | |
| | | /************************* 以ä¸è¿äºæ¥å£åªéåwvpåzlmé¨ç½²å¨åä¸å°æå¡å¨çæ
åµï¼ä¸wvpåªæä¸ä¸ªzlmèç¹çæ
åµ ***************************************/ |
| | | |
| | | /** |
| | | * ä¸è½½æå®å½åæä»¶çå缩å
|
| | | * @param query æ£ç´¢å
容 |
| | | * @param app åºç¨å |
| | | * @param stream æµID |
| | | * @param startTime å¼å§æ¶é´(yyyy-MM-dd HH:mm:ss) |
| | | * @param endTime ç»ææ¶é´(yyyy-MM-dd HH:mm:ss) |
| | | * @param mediaServerId æµåªä½IDï¼ç½®ç©ºåæ¥è¯¢å
¨é¨æµåªä½ |
| | | * @param callId æ¯æ¬¡å½åçå¯ä¸æ è¯ï¼ç½®ç©ºåæ¥è¯¢å
¨é¨æµåªä½ |
| | | * @param ids æå®çId |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/zip") |
| | | public void downloadZipFile( |
| | | HttpServletResponse response, |
| | | @RequestParam(required = false) String query, |
| | | @RequestParam(required = false) String app, |
| | | @RequestParam(required = false) String stream, |
| | | @RequestParam(required = false) String startTime, |
| | | @RequestParam(required = false) String endTime, |
| | | @RequestParam(required = false) String mediaServerId, |
| | | @RequestParam(required = false) String callId, |
| | | @RequestParam(required = false) List<Integer> ids |
| | | |
| | | ) { |
| | | logger.info("[ä¸è½½æå®å½åæä»¶çå缩å
] æ¥è¯¢ app->{}, stream->{}, mediaServerId->{}, startTime->{}, endTime->{}, callId->{}", |
| | | app, stream, mediaServerId, startTime, endTime, callId); |
| | | |
| | | List<MediaServerItem> mediaServerItems; |
| | | if (!ObjectUtils.isEmpty(mediaServerId)) { |
| | | mediaServerItems = new ArrayList<>(); |
| | | MediaServerItem mediaServerItem = mediaServerService.getOne(mediaServerId); |
| | | if (mediaServerItem == null) { |
| | | throw new ControllerException(ErrorCode.ERROR100.getCode(), "æªæ¾å°æµåªä½: " + mediaServerId); |
| | | } |
| | | mediaServerItems.add(mediaServerItem); |
| | | } else { |
| | | mediaServerItems = mediaServerService.getAll(); |
| | | } |
| | | if (mediaServerItems.isEmpty()) { |
| | | throw new ControllerException(ErrorCode.ERROR100.getCode(), "å½åæ æµåªä½"); |
| | | } |
| | | if (query != null && ObjectUtils.isEmpty(query.trim())) { |
| | | query = null; |
| | | } |
| | | if (app != null && ObjectUtils.isEmpty(app.trim())) { |
| | | app = null; |
| | | } |
| | | if (stream != null && ObjectUtils.isEmpty(stream.trim())) { |
| | | stream = null; |
| | | } |
| | | if (startTime != null && ObjectUtils.isEmpty(startTime.trim())) { |
| | | startTime = null; |
| | | } |
| | | if (endTime != null && ObjectUtils.isEmpty(endTime.trim())) { |
| | | endTime = null; |
| | | } |
| | | if (callId != null && ObjectUtils.isEmpty(callId.trim())) { |
| | | callId = null; |
| | | } |
| | | if (stream != null && callId != null) { |
| | | response.addHeader( "Content-Disposition", "attachment;filename=" + stream + "_" + callId + ".zip" ); |
| | | } |
| | | List<CloudRecordItem> cloudRecordItemList = cloudRecordService.getAllList(query, app, stream, startTime, endTime, mediaServerItems, callId, ids); |
| | | if (ObjectUtils.isEmpty(cloudRecordItemList)) { |
| | | return; |
| | | } |
| | | try { |
| | | ZipOutputStream zos = new ZipOutputStream(response.getOutputStream()); |
| | | for (CloudRecordItem cloudRecordItem : cloudRecordItemList) { |
| | | zos.putNextEntry(new ZipEntry(DateUtil.timestampMsToUrlToyyyy_MM_dd_HH_mm_ss(cloudRecordItem.getStartTime()) + ".mp4")); |
| | | File file = new File(cloudRecordItem.getFilePath()); |
| | | if (!file.exists() || file.isDirectory()) { |
| | | continue; |
| | | } |
| | | FileInputStream fis = new FileInputStream(cloudRecordItem.getFilePath()); |
| | | byte[] buf = new byte[2*1024]; |
| | | int len; |
| | | while ((len = fis.read(buf)) != -1){ |
| | | zos.write(buf, 0, len); |
| | | } |
| | | zos.closeEntry(); |
| | | fis.close(); |
| | | } |
| | | zos.close(); |
| | | } catch (IOException e) { |
| | | logger.error("[ä¸è½½æå®å½åæä»¶çå缩å
] å¤±è´¥ï¼ æ¥è¯¢ app->{}, stream->{}, mediaServerId->{}, startTime->{}, endTime->{}, callId->{}", |
| | | app, stream, mediaServerId, startTime, endTime, callId, e); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * |
| | | * @param query æ£ç´¢å
容 |
| | | * @param app åºç¨å |
| | | * @param stream æµID |
| | | * @param startTime å¼å§æ¶é´(yyyy-MM-dd HH:mm:ss) |
| | | * @param endTime ç»ææ¶é´(yyyy-MM-dd HH:mm:ss) |
| | | * @param mediaServerId æµåªä½IDï¼ç½®ç©ºåæ¥è¯¢å
¨é¨æµåªä½ |
| | | * @param callId æ¯æ¬¡å½åçå¯ä¸æ è¯ï¼ç½®ç©ºåæ¥è¯¢å
¨é¨æµåªä½ |
| | | * @param remoteHost æ¼æ¥ææ¾å°åæ¶ä½¿ç¨çè¿ç¨å°å |
| | | */ |
| | | @ResponseBody |
| | | @GetMapping("/list-url") |
| | | @Operation(summary = "å页æ¥è¯¢äºç«¯å½å", security = @SecurityRequirement(name = JwtUtils.HEADER)) |
| | | @Parameter(name = "query", description = "æ£ç´¢å
容", required = false) |
| | | @Parameter(name = "app", description = "åºç¨å", required = false) |
| | | @Parameter(name = "stream", description = "æµID", required = false) |
| | | @Parameter(name = "page", description = "å½å页", required = true) |
| | | @Parameter(name = "count", description = "æ¯é¡µæ¥è¯¢æ°é", required = true) |
| | | @Parameter(name = "startTime", description = "å¼å§æ¶é´(yyyy-MM-dd HH:mm:ss)", required = false) |
| | | @Parameter(name = "endTime", description = "ç»ææ¶é´(yyyy-MM-dd HH:mm:ss)", required = false) |
| | | @Parameter(name = "mediaServerId", description = "æµåªä½IDï¼ç½®ç©ºåæ¥è¯¢å
¨é¨æµåªä½", required = false) |
| | | @Parameter(name = "callId", description = "æ¯æ¬¡å½åçå¯ä¸æ è¯ï¼ç½®ç©ºåæ¥è¯¢å
¨é¨æµåªä½", required = false) |
| | | public PageInfo<CloudRecordUrl> getListWithUrl( |
| | | HttpServletRequest request, |
| | | @RequestParam(required = false) String query, |
| | | @RequestParam(required = false) String app, |
| | | @RequestParam(required = false) String stream, |
| | | @RequestParam int page, |
| | | @RequestParam int count, |
| | | @RequestParam(required = false) String startTime, |
| | | @RequestParam(required = false) String endTime, |
| | | @RequestParam(required = false) String mediaServerId, |
| | | @RequestParam(required = false) String callId, |
| | | @RequestParam(required = false) String remoteHost |
| | | |
| | | ) { |
| | | logger.info("[äºç«¯å½å] æ¥è¯¢URL app->{}, stream->{}, mediaServerId->{}, page->{}, count->{}, startTime->{}, endTime->{}, callId->{}", |
| | | app, stream, mediaServerId, page, count, startTime, endTime, callId); |
| | | |
| | | List<MediaServerItem> mediaServerItems; |
| | | if (!ObjectUtils.isEmpty(mediaServerId)) { |
| | | mediaServerItems = new ArrayList<>(); |
| | | MediaServerItem mediaServerItem = mediaServerService.getOne(mediaServerId); |
| | | if (mediaServerItem == null) { |
| | | throw new ControllerException(ErrorCode.ERROR100.getCode(), "æªæ¾å°æµåªä½: " + mediaServerId); |
| | | } |
| | | mediaServerItems.add(mediaServerItem); |
| | | } else { |
| | | mediaServerItems = mediaServerService.getAll(); |
| | | } |
| | | if (mediaServerItems.isEmpty()) { |
| | | throw new ControllerException(ErrorCode.ERROR100.getCode(), "å½åæ æµåªä½"); |
| | | } |
| | | if (query != null && ObjectUtils.isEmpty(query.trim())) { |
| | | query = null; |
| | | } |
| | | if (app != null && ObjectUtils.isEmpty(app.trim())) { |
| | | app = null; |
| | | } |
| | | if (stream != null && ObjectUtils.isEmpty(stream.trim())) { |
| | | stream = null; |
| | | } |
| | | if (startTime != null && ObjectUtils.isEmpty(startTime.trim())) { |
| | | startTime = null; |
| | | } |
| | | if (endTime != null && ObjectUtils.isEmpty(endTime.trim())) { |
| | | endTime = null; |
| | | } |
| | | if (callId != null && ObjectUtils.isEmpty(callId.trim())) { |
| | | callId = null; |
| | | } |
| | | MediaServerItem mediaServerItem = mediaServerService.getDefaultMediaServer(); |
| | | if (mediaServerItem == null) { |
| | | throw new ControllerException(ErrorCode.ERROR100.getCode(), "æªæ¾å°æµåªä½èç¹"); |
| | | } |
| | | if (remoteHost == null) { |
| | | remoteHost = request.getScheme() + "://" + request.getLocalAddr() + ":" + |
| | | (request.getScheme().equals("https")? mediaServerItem.getHttpSSlPort() : mediaServerItem.getHttpPort()); |
| | | } |
| | | PageInfo<CloudRecordItem> cloudRecordItemPageInfo = cloudRecordService.getList(page, count, query, app, stream, startTime, endTime, mediaServerItems, callId); |
| | | PageInfo<CloudRecordUrl> cloudRecordUrlPageInfo = new PageInfo<>(); |
| | | if (!ObjectUtils.isEmpty(cloudRecordItemPageInfo)) { |
| | | cloudRecordUrlPageInfo.setPageNum(cloudRecordItemPageInfo.getPageNum()); |
| | | cloudRecordUrlPageInfo.setPageSize(cloudRecordItemPageInfo.getPageSize()); |
| | | cloudRecordUrlPageInfo.setSize(cloudRecordItemPageInfo.getSize()); |
| | | cloudRecordUrlPageInfo.setEndRow(cloudRecordItemPageInfo.getEndRow()); |
| | | cloudRecordUrlPageInfo.setStartRow(cloudRecordItemPageInfo.getStartRow()); |
| | | cloudRecordUrlPageInfo.setPages(cloudRecordItemPageInfo.getPages()); |
| | | cloudRecordUrlPageInfo.setPrePage(cloudRecordItemPageInfo.getPrePage()); |
| | | cloudRecordUrlPageInfo.setNextPage(cloudRecordItemPageInfo.getNextPage()); |
| | | cloudRecordUrlPageInfo.setIsFirstPage(cloudRecordItemPageInfo.isIsFirstPage()); |
| | | cloudRecordUrlPageInfo.setIsLastPage(cloudRecordItemPageInfo.isIsLastPage()); |
| | | cloudRecordUrlPageInfo.setHasPreviousPage(cloudRecordItemPageInfo.isHasPreviousPage()); |
| | | cloudRecordUrlPageInfo.setHasNextPage(cloudRecordItemPageInfo.isHasNextPage()); |
| | | cloudRecordUrlPageInfo.setNavigatePages(cloudRecordItemPageInfo.getNavigatePages()); |
| | | cloudRecordUrlPageInfo.setNavigateFirstPage(cloudRecordItemPageInfo.getNavigateFirstPage()); |
| | | cloudRecordUrlPageInfo.setNavigateLastPage(cloudRecordItemPageInfo.getNavigateLastPage()); |
| | | cloudRecordUrlPageInfo.setNavigatepageNums(cloudRecordItemPageInfo.getNavigatepageNums()); |
| | | cloudRecordUrlPageInfo.setTotal(cloudRecordItemPageInfo.getTotal()); |
| | | List<CloudRecordUrl> cloudRecordUrlList = new ArrayList<>(cloudRecordItemPageInfo.getList().size()); |
| | | List<CloudRecordItem> cloudRecordItemList = cloudRecordItemPageInfo.getList(); |
| | | for (CloudRecordItem cloudRecordItem : cloudRecordItemList) { |
| | | CloudRecordUrl cloudRecordUrl = new CloudRecordUrl(); |
| | | cloudRecordUrl.setId(cloudRecordItem.getId()); |
| | | cloudRecordUrl.setDownloadUrl(remoteHost + "/index/api/downloadFile?file_path=" + cloudRecordItem.getFilePath() |
| | | + "&save_name=" + cloudRecordItem.getStream() + "_" + cloudRecordItem.getCallId() + "_" + DateUtil.timestampMsToUrlToyyyy_MM_dd_HH_mm_ss(cloudRecordItem.getStartTime()) ); |
| | | cloudRecordUrl.setPlayUrl(remoteHost + "/index/api/downloadFile?file_path=" + cloudRecordItem.getFilePath()); |
| | | cloudRecordUrlList.add(cloudRecordUrl); |
| | | } |
| | | cloudRecordUrlPageInfo.setList(cloudRecordUrlList); |
| | | } |
| | | return cloudRecordUrlPageInfo; |
| | | } |
| | | } |
New file |
| | |
| | | package com.genersoft.iot.vmp.vmanager.cloudRecord.bean; |
| | | |
| | | public class CloudRecordUrl { |
| | | |
| | | private String playUrl; |
| | | private String downloadUrl; |
| | | private int id; |
| | | |
| | | public String getPlayUrl() { |
| | | return playUrl; |
| | | } |
| | | |
| | | public void setPlayUrl(String playUrl) { |
| | | this.playUrl = playUrl; |
| | | } |
| | | |
| | | public String getDownloadUrl() { |
| | | return downloadUrl; |
| | | } |
| | | |
| | | public void setDownloadUrl(String downloadUrl) { |
| | | this.downloadUrl = downloadUrl; |
| | | } |
| | | |
| | | public int getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(int id) { |
| | | this.id = id; |
| | | } |
| | | } |
| | |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.ObjectUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.context.request.async.DeferredResult; |
| | | |
| | |
| | | } |
| | | streamInfo.channgeStreamIp(host); |
| | | } |
| | | if (!ObjectUtils.isEmpty(newMediaServerItem.getTranscodeSuffix()) && !"null".equalsIgnoreCase(newMediaServerItem.getTranscodeSuffix())) { |
| | | streamInfo.setStream(streamInfo.getStream() + "_" + newMediaServerItem.getTranscodeSuffix()); |
| | | } |
| | | wvpResult.setData(new StreamContent(streamInfo)); |
| | | }else { |
| | | wvpResult.setCode(code); |
| | |
| | | register-again-after-time: 60 |
| | | # 彿 ç»è®¢æ¹å¼ï¼true为ç»è®¢ï¼æ¯æ¬¡æ³¨åå¨åä¸ä¸ªä¼è¯éï¼falseä¸ºéæ°æ³¨åï¼æ¯æ¬¡ä½¿ç¨æ°çä¼è¯ |
| | | register-keep-int-dialog: false |
| | | # å¼å¯æ¥å£ææ¡£é¡µé¢ã é»è®¤å¼å¯ï¼ç产ç¯å¢å»ºè®®å
³éï¼éå°swaggerç¸å
³çæ¼æ´æ¶ä¹å¯ä»¥å
³é |
| | | doc-enable: true |
| | | # è·¨åé
ç½®ï¼ä¸é
ç½®æ¤é¡¹åå
许ææè·¨å请æ±ï¼é
ç½®åååªå
许é
ç½®ç页é¢çå°å请æ±ï¼ å¯ä»¥é
ç½®å¤ä¸ª |
| | | allowed-origins: |
| | | - http://localhost:8008 |
| | |
| | | auto-apply-play: true |
| | | # 设å¤/ééç¶æååæ¶åéæ¶æ¯ |
| | | device-status-notify: true |
| | | # [å¯é] æ¥å¿é
ç½®, ä¸è¬ä¸éè¦æ¹ |
| | | logging: |
| | | config: classpath:logback-spring.xml |
| | | |
New file |
| | |
| | | /*建表*/ |
| | | create table wvp_device ( |
| | | id serial primary key , |
| | | device_id character varying(50) not null , |
| | | name character varying(255), |
| | | manufacturer character varying(255), |
| | | model character varying(255), |
| | | firmware character varying(255), |
| | | transport character varying(50), |
| | | stream_mode character varying(50), |
| | | on_line bool default false, |
| | | register_time character varying(50), |
| | | keepalive_time character varying(50), |
| | | ip character varying(50), |
| | | create_time character varying(50), |
| | | update_time character varying(50), |
| | | port integer, |
| | | expires integer, |
| | | subscribe_cycle_for_catalog integer DEFAULT 0, |
| | | subscribe_cycle_for_mobile_position integer DEFAULT 0, |
| | | mobile_position_submission_interval integer DEFAULT 5, |
| | | subscribe_cycle_for_alarm integer DEFAULT 0, |
| | | host_address character varying(50), |
| | | charset character varying(50), |
| | | ssrc_check bool default false, |
| | | geo_coord_sys character varying(50), |
| | | media_server_id character varying(50), |
| | | custom_name character varying(255), |
| | | sdp_ip character varying(50), |
| | | local_ip character varying(50), |
| | | password character varying(255), |
| | | as_message_channel bool default false, |
| | | keepalive_interval_time integer, |
| | | broadcast_push_after_ack bool default false, |
| | | constraint uk_device_device unique (device_id) |
| | | ); |
| | | |
| | | create table wvp_device_alarm ( |
| | | id serial primary key , |
| | | device_id character varying(50) not null, |
| | | channel_id character varying(50) not null, |
| | | alarm_priority character varying(50), |
| | | alarm_method character varying(50), |
| | | alarm_time character varying(50), |
| | | alarm_description character varying(255), |
| | | longitude double precision, |
| | | latitude double precision, |
| | | alarm_type character varying(50), |
| | | create_time character varying(50) not null |
| | | ); |
| | | |
| | | create table wvp_device_channel ( |
| | | id serial primary key , |
| | | channel_id character varying(50) not null, |
| | | name character varying(255), |
| | | custom_name character varying(255), |
| | | manufacture character varying(50), |
| | | model character varying(50), |
| | | owner character varying(50), |
| | | civil_code character varying(50), |
| | | block character varying(50), |
| | | address character varying(50), |
| | | parent_id character varying(50), |
| | | safety_way integer, |
| | | register_way integer, |
| | | cert_num character varying(50), |
| | | certifiable integer, |
| | | err_code integer, |
| | | end_time character varying(50), |
| | | secrecy character varying(50), |
| | | ip_address character varying(50), |
| | | port integer, |
| | | password character varying(255), |
| | | ptz_type integer, |
| | | custom_ptz_type integer, |
| | | status bool default false, |
| | | longitude double precision, |
| | | custom_longitude double precision, |
| | | latitude double precision, |
| | | custom_latitude double precision, |
| | | stream_id character varying(255), |
| | | device_id character varying(50) not null, |
| | | parental character varying(50), |
| | | has_audio bool default false, |
| | | create_time character varying(50) not null, |
| | | update_time character varying(50) not null, |
| | | sub_count integer, |
| | | longitude_gcj02 double precision, |
| | | latitude_gcj02 double precision, |
| | | longitude_wgs84 double precision, |
| | | latitude_wgs84 double precision, |
| | | business_group_id character varying(50), |
| | | gps_time character varying(50), |
| | | stream_identification character varying(50), |
| | | constraint uk_wvp_device_channel_unique_device_channel unique (device_id, channel_id) |
| | | ); |
| | | |
| | | create table wvp_device_mobile_position ( |
| | | id serial primary key, |
| | | device_id character varying(50) not null, |
| | | channel_id character varying(50) not null, |
| | | device_name character varying(255), |
| | | time character varying(50), |
| | | longitude double precision, |
| | | latitude double precision, |
| | | altitude double precision, |
| | | speed double precision, |
| | | direction double precision, |
| | | report_source character varying(50), |
| | | longitude_gcj02 double precision, |
| | | latitude_gcj02 double precision, |
| | | longitude_wgs84 double precision, |
| | | latitude_wgs84 double precision, |
| | | create_time character varying(50) |
| | | ); |
| | | |
| | | create table wvp_gb_stream ( |
| | | gb_stream_id serial primary key, |
| | | app character varying(255) not null, |
| | | stream character varying(255) not null, |
| | | gb_id character varying(50) not null, |
| | | name character varying(255), |
| | | longitude double precision, |
| | | latitude double precision, |
| | | stream_type character varying(50), |
| | | media_server_id character varying(50), |
| | | create_time character varying(50), |
| | | constraint uk_gb_stream_unique_gb_id unique (gb_id), |
| | | constraint uk_gb_stream_unique_app_stream unique (app, stream) |
| | | ); |
| | | |
| | | create table wvp_log ( |
| | | id serial primary key , |
| | | name character varying(50), |
| | | type character varying(50), |
| | | uri character varying(200), |
| | | address character varying(50), |
| | | result character varying(50), |
| | | timing bigint, |
| | | username character varying(50), |
| | | create_time character varying(50) |
| | | ); |
| | | |
| | | create table wvp_media_server ( |
| | | id character varying(255) primary key , |
| | | ip character varying(50), |
| | | hook_ip character varying(50), |
| | | sdp_ip character varying(50), |
| | | stream_ip character varying(50), |
| | | http_port integer, |
| | | http_ssl_port integer, |
| | | rtmp_port integer, |
| | | rtmp_ssl_port integer, |
| | | rtp_proxy_port integer, |
| | | rtsp_port integer, |
| | | rtsp_ssl_port integer, |
| | | auto_config bool default false, |
| | | secret character varying(50), |
| | | rtp_enable bool default false, |
| | | rtp_port_range character varying(50), |
| | | send_rtp_port_range character varying(50), |
| | | record_assist_port integer, |
| | | default_server bool default false, |
| | | create_time character varying(50), |
| | | update_time character varying(50), |
| | | hook_alive_interval integer, |
| | | record_path character varying(255), |
| | | record_day integer default 7, |
| | | transcode_suffix character varying(255), |
| | | constraint uk_media_server_unique_ip_http_port unique (ip, http_port) |
| | | ); |
| | | |
| | | create table wvp_platform ( |
| | | id serial primary key , |
| | | enable bool default false, |
| | | name character varying(255), |
| | | server_gb_id character varying(50), |
| | | server_gb_domain character varying(50), |
| | | server_ip character varying(50), |
| | | server_port integer, |
| | | device_gb_id character varying(50), |
| | | device_ip character varying(50), |
| | | device_port character varying(50), |
| | | username character varying(255), |
| | | password character varying(50), |
| | | expires character varying(50), |
| | | keep_timeout character varying(50), |
| | | transport character varying(50), |
| | | character_set character varying(50), |
| | | catalog_id character varying(50), |
| | | ptz bool default false, |
| | | rtcp bool default false, |
| | | status bool default false, |
| | | start_offline_push bool default false, |
| | | administrative_division character varying(50), |
| | | catalog_group integer, |
| | | create_time character varying(50), |
| | | update_time character varying(50), |
| | | as_message_channel bool default false, |
| | | auto_push_channel bool default false, |
| | | send_stream_ip character varying(50), |
| | | constraint uk_platform_unique_server_gb_id unique (server_gb_id) |
| | | ); |
| | | |
| | | create table wvp_platform_catalog ( |
| | | id character varying(50), |
| | | platform_id character varying(50), |
| | | name character varying(255), |
| | | parent_id character varying(50), |
| | | civil_code character varying(50), |
| | | business_group_id character varying(50), |
| | | constraint uk_platform_catalog_id_platform_id unique (id, platform_id) |
| | | ); |
| | | |
| | | create table wvp_platform_gb_channel ( |
| | | id serial primary key , |
| | | platform_id character varying(50), |
| | | catalog_id character varying(50), |
| | | device_channel_id integer, |
| | | constraint uk_platform_gb_channel_platform_id_catalog_id_device_channel_id unique (platform_id, catalog_id, device_channel_id) |
| | | ); |
| | | |
| | | create table wvp_platform_gb_stream ( |
| | | id serial primary key, |
| | | platform_id character varying(50), |
| | | catalog_id character varying(50), |
| | | gb_stream_id integer, |
| | | constraint uk_platform_gb_stream_platform_id_catalog_id_gb_stream_id unique (platform_id, catalog_id, gb_stream_id) |
| | | ); |
| | | |
| | | create table wvp_stream_proxy ( |
| | | id serial primary key, |
| | | type character varying(50), |
| | | app character varying(255), |
| | | stream character varying(255), |
| | | url character varying(255), |
| | | src_url character varying(255), |
| | | dst_url character varying(255), |
| | | timeout_ms integer, |
| | | ffmpeg_cmd_key character varying(255), |
| | | rtp_type character varying(50), |
| | | media_server_id character varying(50), |
| | | enable_audio bool default false, |
| | | enable_mp4 bool default false, |
| | | enable bool default false, |
| | | status boolean, |
| | | enable_remove_none_reader bool default false, |
| | | create_time character varying(50), |
| | | name character varying(255), |
| | | update_time character varying(50), |
| | | stream_key character varying(255), |
| | | enable_disable_none_reader bool default false, |
| | | constraint uk_stream_proxy_app_stream unique (app, stream) |
| | | ); |
| | | |
| | | create table wvp_stream_push ( |
| | | id serial primary key, |
| | | app character varying(255), |
| | | stream character varying(255), |
| | | total_reader_count character varying(50), |
| | | origin_type integer, |
| | | origin_type_str character varying(50), |
| | | create_time character varying(50), |
| | | alive_second integer, |
| | | media_server_id character varying(50), |
| | | server_id character varying(50), |
| | | push_time character varying(50), |
| | | status bool default false, |
| | | update_time character varying(50), |
| | | push_ing bool default false, |
| | | self bool default false, |
| | | constraint uk_stream_push_app_stream unique (app, stream) |
| | | ); |
| | | create table wvp_cloud_record ( |
| | | id serial primary key, |
| | | app character varying(255), |
| | | stream character varying(255), |
| | | call_id character varying(255), |
| | | start_time bigint, |
| | | end_time bigint, |
| | | media_server_id character varying(50), |
| | | file_name character varying(255), |
| | | folder character varying(255), |
| | | file_path character varying(255), |
| | | collect bool default false, |
| | | file_size bigint, |
| | | time_len bigint, |
| | | constraint uk_stream_push_app_stream_path unique (app, stream, file_path) |
| | | ); |
| | | |
| | | create table wvp_user ( |
| | | id serial primary key, |
| | | username character varying(255), |
| | | password character varying(255), |
| | | role_id integer, |
| | | create_time character varying(50), |
| | | update_time character varying(50), |
| | | push_key character varying(50), |
| | | constraint uk_user_username unique (username) |
| | | ); |
| | | |
| | | create table wvp_user_role ( |
| | | id serial primary key, |
| | | name character varying(50), |
| | | authority character varying(50), |
| | | create_time character varying(50), |
| | | update_time character varying(50) |
| | | ); |
| | | create table wvp_resources_tree ( |
| | | id serial primary key , |
| | | is_catalog bool default true, |
| | | device_channel_id integer , |
| | | gb_stream_id integer, |
| | | name character varying(255), |
| | | parentId integer, |
| | | path character varying(255) |
| | | ); |
| | | |
| | | |
| | | /*åå§æ°æ®*/ |
| | | INSERT INTO wvp_user VALUES (1, 'admin','21232f297a57a5a743894a0e4a801fc3',1,'2021-04-13 14:14:57','2021-04-13 14:14:57','3e80d1762a324d5b0ff636e0bd16f1e3'); |
| | | INSERT INTO wvp_user_role VALUES (1, 'admin','0','2021-04-13 14:14:57','2021-04-13 14:14:57'); |
| | | |
| | | |
| | | |
New file |
| | |
| | | /*建表*/ |
| | | create table wvp_device ( |
| | | id serial primary key , |
| | | device_id character varying(50) not null , |
| | | name character varying(255), |
| | | manufacturer character varying(255), |
| | | model character varying(255), |
| | | firmware character varying(255), |
| | | transport character varying(50), |
| | | stream_mode character varying(50), |
| | | on_line bool default false, |
| | | register_time character varying(50), |
| | | keepalive_time character varying(50), |
| | | ip character varying(50), |
| | | create_time character varying(50), |
| | | update_time character varying(50), |
| | | port integer, |
| | | expires integer, |
| | | subscribe_cycle_for_catalog integer DEFAULT 0, |
| | | subscribe_cycle_for_mobile_position integer DEFAULT 0, |
| | | mobile_position_submission_interval integer DEFAULT 5, |
| | | subscribe_cycle_for_alarm integer DEFAULT 0, |
| | | host_address character varying(50), |
| | | charset character varying(50), |
| | | ssrc_check bool default false, |
| | | geo_coord_sys character varying(50), |
| | | media_server_id character varying(50), |
| | | custom_name character varying(255), |
| | | sdp_ip character varying(50), |
| | | local_ip character varying(50), |
| | | password character varying(255), |
| | | as_message_channel bool default false, |
| | | keepalive_interval_time integer, |
| | | broadcast_push_after_ack bool default false, |
| | | constraint uk_device_device unique (device_id) |
| | | ); |
| | | |
| | | create table wvp_device_alarm ( |
| | | id serial primary key , |
| | | device_id character varying(50) not null, |
| | | channel_id character varying(50) not null, |
| | | alarm_priority character varying(50), |
| | | alarm_method character varying(50), |
| | | alarm_time character varying(50), |
| | | alarm_description character varying(255), |
| | | longitude double precision, |
| | | latitude double precision, |
| | | alarm_type character varying(50), |
| | | create_time character varying(50) not null |
| | | ); |
| | | |
| | | create table wvp_device_channel ( |
| | | id serial primary key , |
| | | channel_id character varying(50) not null, |
| | | name character varying(255), |
| | | custom_name character varying(255), |
| | | manufacture character varying(50), |
| | | model character varying(50), |
| | | owner character varying(50), |
| | | civil_code character varying(50), |
| | | block character varying(50), |
| | | address character varying(50), |
| | | parent_id character varying(50), |
| | | safety_way integer, |
| | | register_way integer, |
| | | cert_num character varying(50), |
| | | certifiable integer, |
| | | err_code integer, |
| | | end_time character varying(50), |
| | | secrecy character varying(50), |
| | | ip_address character varying(50), |
| | | port integer, |
| | | password character varying(255), |
| | | ptz_type integer, |
| | | custom_ptz_type integer, |
| | | status bool default false, |
| | | longitude double precision, |
| | | custom_longitude double precision, |
| | | latitude double precision, |
| | | custom_latitude double precision, |
| | | stream_id character varying(255), |
| | | device_id character varying(50) not null, |
| | | parental character varying(50), |
| | | has_audio bool default false, |
| | | create_time character varying(50) not null, |
| | | update_time character varying(50) not null, |
| | | sub_count integer, |
| | | longitude_gcj02 double precision, |
| | | latitude_gcj02 double precision, |
| | | longitude_wgs84 double precision, |
| | | latitude_wgs84 double precision, |
| | | business_group_id character varying(50), |
| | | gps_time character varying(50), |
| | | stream_identification character varying(50), |
| | | constraint uk_wvp_device_channel_unique_device_channel unique (device_id, channel_id) |
| | | ); |
| | | |
| | | create table wvp_device_mobile_position ( |
| | | id serial primary key, |
| | | device_id character varying(50) not null, |
| | | channel_id character varying(50) not null, |
| | | device_name character varying(255), |
| | | time character varying(50), |
| | | longitude double precision, |
| | | latitude double precision, |
| | | altitude double precision, |
| | | speed double precision, |
| | | direction double precision, |
| | | report_source character varying(50), |
| | | longitude_gcj02 double precision, |
| | | latitude_gcj02 double precision, |
| | | longitude_wgs84 double precision, |
| | | latitude_wgs84 double precision, |
| | | create_time character varying(50) |
| | | ); |
| | | |
| | | create table wvp_gb_stream ( |
| | | gb_stream_id serial primary key, |
| | | app character varying(255) not null, |
| | | stream character varying(255) not null, |
| | | gb_id character varying(50) not null, |
| | | name character varying(255), |
| | | longitude double precision, |
| | | latitude double precision, |
| | | stream_type character varying(50), |
| | | media_server_id character varying(50), |
| | | create_time character varying(50), |
| | | constraint uk_gb_stream_unique_gb_id unique (gb_id), |
| | | constraint uk_gb_stream_unique_app_stream unique (app, stream) |
| | | ); |
| | | |
| | | create table wvp_log ( |
| | | id serial primary key , |
| | | name character varying(50), |
| | | type character varying(50), |
| | | uri character varying(200), |
| | | address character varying(50), |
| | | result character varying(50), |
| | | timing bigint, |
| | | username character varying(50), |
| | | create_time character varying(50) |
| | | ); |
| | | |
| | | create table wvp_media_server ( |
| | | id character varying(255) primary key , |
| | | ip character varying(50), |
| | | hook_ip character varying(50), |
| | | sdp_ip character varying(50), |
| | | stream_ip character varying(50), |
| | | http_port integer, |
| | | http_ssl_port integer, |
| | | rtmp_port integer, |
| | | rtmp_ssl_port integer, |
| | | rtp_proxy_port integer, |
| | | rtsp_port integer, |
| | | rtsp_ssl_port integer, |
| | | auto_config bool default false, |
| | | secret character varying(50), |
| | | rtp_enable bool default false, |
| | | rtp_port_range character varying(50), |
| | | send_rtp_port_range character varying(50), |
| | | record_assist_port integer, |
| | | default_server bool default false, |
| | | create_time character varying(50), |
| | | update_time character varying(50), |
| | | hook_alive_interval integer, |
| | | record_path character varying(255), |
| | | record_day integer default 7, |
| | | transcode_suffix character varying(255), |
| | | constraint uk_media_server_unique_ip_http_port unique (ip, http_port) |
| | | ); |
| | | |
| | | create table wvp_platform ( |
| | | id serial primary key , |
| | | enable bool default false, |
| | | name character varying(255), |
| | | server_gb_id character varying(50), |
| | | server_gb_domain character varying(50), |
| | | server_ip character varying(50), |
| | | server_port integer, |
| | | device_gb_id character varying(50), |
| | | device_ip character varying(50), |
| | | device_port character varying(50), |
| | | username character varying(255), |
| | | password character varying(50), |
| | | expires character varying(50), |
| | | keep_timeout character varying(50), |
| | | transport character varying(50), |
| | | character_set character varying(50), |
| | | catalog_id character varying(50), |
| | | ptz bool default false, |
| | | rtcp bool default false, |
| | | status bool default false, |
| | | start_offline_push bool default false, |
| | | administrative_division character varying(50), |
| | | catalog_group integer, |
| | | create_time character varying(50), |
| | | update_time character varying(50), |
| | | as_message_channel bool default false, |
| | | auto_push_channel bool default false, |
| | | send_stream_ip character varying(50), |
| | | constraint uk_platform_unique_server_gb_id unique (server_gb_id) |
| | | ); |
| | | |
| | | create table wvp_platform_catalog ( |
| | | id character varying(50), |
| | | platform_id character varying(50), |
| | | name character varying(255), |
| | | parent_id character varying(50), |
| | | civil_code character varying(50), |
| | | business_group_id character varying(50), |
| | | constraint uk_platform_catalog_id_platform_id unique (id, platform_id) |
| | | ); |
| | | |
| | | create table wvp_platform_gb_channel ( |
| | | id serial primary key , |
| | | platform_id character varying(50), |
| | | catalog_id character varying(50), |
| | | device_channel_id integer, |
| | | constraint uk_platform_gb_channel_platform_id_catalog_id_device_channel_id unique (platform_id, catalog_id, device_channel_id) |
| | | ); |
| | | |
| | | create table wvp_platform_gb_stream ( |
| | | id serial primary key, |
| | | platform_id character varying(50), |
| | | catalog_id character varying(50), |
| | | gb_stream_id integer, |
| | | constraint uk_platform_gb_stream_platform_id_catalog_id_gb_stream_id unique (platform_id, catalog_id, gb_stream_id) |
| | | ); |
| | | |
| | | create table wvp_stream_proxy ( |
| | | id serial primary key, |
| | | type character varying(50), |
| | | app character varying(255), |
| | | stream character varying(255), |
| | | url character varying(255), |
| | | src_url character varying(255), |
| | | dst_url character varying(255), |
| | | timeout_ms integer, |
| | | ffmpeg_cmd_key character varying(255), |
| | | rtp_type character varying(50), |
| | | media_server_id character varying(50), |
| | | enable_audio bool default false, |
| | | enable_mp4 bool default false, |
| | | enable bool default false, |
| | | status boolean, |
| | | enable_remove_none_reader bool default false, |
| | | create_time character varying(50), |
| | | name character varying(255), |
| | | update_time character varying(50), |
| | | stream_key character varying(255), |
| | | enable_disable_none_reader bool default false, |
| | | constraint uk_stream_proxy_app_stream unique (app, stream) |
| | | ); |
| | | |
| | | create table wvp_stream_push ( |
| | | id serial primary key, |
| | | app character varying(255), |
| | | stream character varying(255), |
| | | total_reader_count character varying(50), |
| | | origin_type integer, |
| | | origin_type_str character varying(50), |
| | | create_time character varying(50), |
| | | alive_second integer, |
| | | media_server_id character varying(50), |
| | | server_id character varying(50), |
| | | push_time character varying(50), |
| | | status bool default false, |
| | | update_time character varying(50), |
| | | push_ing bool default false, |
| | | self bool default false, |
| | | constraint uk_stream_push_app_stream unique (app, stream) |
| | | ); |
| | | create table wvp_cloud_record ( |
| | | id serial primary key, |
| | | app character varying(255), |
| | | stream character varying(255), |
| | | call_id character varying(255), |
| | | start_time int8, |
| | | end_time int8, |
| | | media_server_id character varying(50), |
| | | file_name character varying(255), |
| | | folder character varying(255), |
| | | file_path character varying(255), |
| | | collect bool default false, |
| | | file_size int8, |
| | | time_len int8, |
| | | constraint uk_stream_push_app_stream_path unique (app, stream, file_path) |
| | | ); |
| | | |
| | | create table wvp_user ( |
| | | id serial primary key, |
| | | username character varying(255), |
| | | password character varying(255), |
| | | role_id integer, |
| | | create_time character varying(50), |
| | | update_time character varying(50), |
| | | push_key character varying(50), |
| | | constraint uk_user_username unique (username) |
| | | ); |
| | | |
| | | create table wvp_user_role ( |
| | | id serial primary key, |
| | | name character varying(50), |
| | | authority character varying(50), |
| | | create_time character varying(50), |
| | | update_time character varying(50) |
| | | ); |
| | | create table wvp_resources_tree ( |
| | | id serial primary key , |
| | | is_catalog bool default true, |
| | | device_channel_id integer , |
| | | gb_stream_id integer, |
| | | name character varying(255), |
| | | parentId integer, |
| | | path character varying(255) |
| | | ); |
| | | |
| | | |
| | | /*åå§æ°æ®*/ |
| | | INSERT INTO wvp_user VALUES (1, 'admin','21232f297a57a5a743894a0e4a801fc3',1,'2021-04-13 14:14:57','2021-04-13 14:14:57','3e80d1762a324d5b0ff636e0bd16f1e3'); |
| | | INSERT INTO wvp_user_role VALUES (1, 'admin','0','2021-04-13 14:14:57','2021-04-13 14:14:57'); |
| | | |
| | | |
| | | |
New file |
| | |
| | | alter table wvp_media_server |
| | | add transcode_suffix character varying(255); |
New file |
| | |
| | | alter table wvp_media_server |
| | | add transcode_suffix character varying(255); |