| | |
| | | private double latitude; |
| | | private String streamType; |
| | | private boolean status; |
| | | /** |
| | | * GMT unix系统时间戳,单位秒 |
| | | */ |
| | | public Long createStamp; |
| | | |
| | | public String getApp() { |
| | | return app; |
| | |
| | | public void setMediaServerId(String mediaServerId) { |
| | | this.mediaServerId = mediaServerId; |
| | | } |
| | | |
| | | |
| | | public Long getCreateStamp() { |
| | | return createStamp; |
| | | } |
| | | |
| | | public void setCreateStamp(Long createStamp) { |
| | | this.createStamp = createStamp; |
| | | } |
| | | } |
| | |
| | | if (gbStreamMapper.selectOne(transform.getApp(), transform.getStream()) != null) { |
| | | gbStreamMapper.update(transform); |
| | | }else { |
| | | transform.setCreateStamp(System.currentTimeMillis()); |
| | | gbStreamMapper.add(transform); |
| | | } |
| | | } |
| | |
| | | private String originUrl; |
| | | |
| | | /** |
| | | * GMT unix系统时间戳,单位秒 |
| | | */ |
| | | private Long createStamp; |
| | | |
| | | /** |
| | | * 存活时间,单位秒 |
| | | */ |
| | | private Long aliveSecond; |
| | |
| | | |
| | | @Override |
| | | public int compareTo(@NotNull StreamPushItem streamPushItem) { |
| | | return Long.valueOf(this.createStamp - streamPushItem.getCreateStamp().intValue()).intValue(); |
| | | return Long.valueOf(super.createStamp - streamPushItem.getCreateStamp().intValue()).intValue(); |
| | | } |
| | | |
| | | public static class MediaSchema { |
| | |
| | | |
| | | public void setOriginUrl(String originUrl) { |
| | | this.originUrl = originUrl; |
| | | } |
| | | |
| | | public Long getCreateStamp() { |
| | | return createStamp; |
| | | } |
| | | |
| | | public void setCreateStamp(Long createStamp) { |
| | | this.createStamp = createStamp; |
| | | } |
| | | |
| | | public Long getAliveSecond() { |
| | |
| | | try { |
| | | List<DeviceChannel> deviceChannelList = new ArrayList<>(); |
| | | for (GbStream gbStream : gbStreams) { |
| | | platformGbStreamMapper.delByAppAndStream(gbStream.getApp(), gbStream.getStream()); |
| | | platformGbStreamMapper.delByAppAndStreamAndPlatform(gbStream.getApp(), gbStream.getStream(), platformId); |
| | | DeviceChannel deviceChannel = new DeviceChannel(); |
| | | deviceChannel.setChannelId(gbStream.getGbId()); |
| | | deviceChannelList.add(deviceChannel); |
| | |
| | | public boolean saveToGB(GbStream stream) { |
| | | stream.setStreamType("push"); |
| | | stream.setStatus(true); |
| | | stream.setCreateStamp(System.currentTimeMillis()); |
| | | int add = gbStreamMapper.add(stream); |
| | | |
| | | // 查找开启了全部直播流共享的上级平台 |
| | |
| | | streamPushItem.setStreamType("push"); |
| | | streamPushItem.setStatus(true); |
| | | streamPushItem.setGbId("34020000004111" + gbId); |
| | | streamPushItem.setCreateStamp(System.currentTimeMillis()); |
| | | gbId ++; |
| | | } |
| | | int limitCount = 30; |
| | |
| | | streamPushItem.setGbId(streamPushExcelDto.getGbId()); |
| | | streamPushItem.setStatus(false); |
| | | streamPushItem.setStreamType("push"); |
| | | streamPushItem.setCreateStamp(System.currentTimeMillis()/1000); |
| | | streamPushItem.setCreateStamp(System.currentTimeMillis()); |
| | | streamPushItem.setMediaServerId(defaultMediaServerId); |
| | | streamPushItem.setName(streamPushExcelDto.getName()); |
| | | streamPushItem.setOriginType(2); |
| | |
| | | public interface GbStreamMapper { |
| | | |
| | | @Insert("REPLACE INTO gb_stream (app, stream, gbId, name, " + |
| | | "longitude, latitude, streamType, mediaServerId, status) VALUES" + |
| | | "longitude, latitude, streamType, mediaServerId, status, createStamp) VALUES" + |
| | | "('${app}', '${stream}', '${gbId}', '${name}', " + |
| | | "'${longitude}', '${latitude}', '${streamType}', " + |
| | | "'${mediaServerId}', ${status})") |
| | | "'${mediaServerId}', ${status}, ${createStamp})") |
| | | int add(GbStream gbStream); |
| | | |
| | | @Update("UPDATE gb_stream " + |
| | |
| | | int del(String app, String stream); |
| | | |
| | | @Select("SELECT gs.*, pgs.platformId AS platformId, pgs.catalogId AS catalogId FROM gb_stream gs " + |
| | | "LEFT JOIN platform_gb_stream pgs ON gs.app = pgs.app AND gs.stream = pgs.stream " + |
| | | "WHERE pgs.platformId is null OR pgs.platformId = #{platformId}") |
| | | "LEFT JOIN platform_gb_stream pgs ON gs.app = pgs.app AND gs.stream = pgs.stream AND (pgs.platformId = #{platformId} OR pgs.platformId is null)" + |
| | | "order by gs.id asc ") |
| | | List<GbStream> selectAll(String platformId); |
| | | |
| | | @Select("SELECT * FROM gb_stream WHERE app=#{app} AND stream=#{stream}") |
| | |
| | | @Insert("<script> " + |
| | | "REPLACE into gb_stream " + |
| | | "(app, stream, gbId, name, " + |
| | | "longitude, latitude, streamType, mediaServerId, status)" + |
| | | "longitude, latitude, streamType, mediaServerId, status, createStamp)" + |
| | | "values " + |
| | | "<foreach collection='subList' index='index' item='item' separator=','> " + |
| | | "('${item.app}', '${item.stream}', '${item.gbId}', '${item.name}', " + |
| | | "'${item.longitude}', '${item.latitude}', '${item.streamType}', " + |
| | | "'${item.mediaServerId}', ${item.status}) "+ |
| | | "'${item.mediaServerId}', ${item.status}, ${item.createStamp}) "+ |
| | | "</foreach> " + |
| | | "</script>") |
| | | void batchAdd(List<StreamPushItem> subList); |
| | |
| | | "</script> ") |
| | | List<ParentPlatform> queryPlatFormListForGBWithGBId(String app, String stream, List<String> platforms); |
| | | |
| | | @Select("SELECT * FROM platform_gb_stream WHERE app=#{app} AND stream=#{stream} AND platformId=#{platformId}") |
| | | int delByAppAndStreamAndPlatform(String app, String streamId, String platformId); |
| | | @Delete("DELETE FROM platform_gb_stream WHERE app=#{app} AND stream=#{stream} AND platformId=#{platformId}") |
| | | int delByAppAndStreamAndPlatform(String app, String stream, String platformId); |
| | | } |
| | |
| | | streamProxyItem.setStatus(true); |
| | | String now = this.format.format(System.currentTimeMillis()); |
| | | streamProxyItem.setCreateTime(now); |
| | | streamProxyItem.setCreateStamp(System.currentTimeMillis()); |
| | | try { |
| | | if (gbStreamMapper.add(streamProxyItem)<0 || streamProxyMapper.add(streamProxyItem) < 0) { |
| | | //事务回滚 |
| | |
| | | @ResponseBody |
| | | public DeferredResult<ResponseEntity<WVPResult<Object>>> uploadChannelFile(@RequestParam(value = "file") MultipartFile file){ |
| | | |
| | | |
| | | // 最多处理文件一个小时 |
| | | DeferredResult<ResponseEntity<WVPResult<Object>>> result = new DeferredResult<>(60*60*1000L); |
| | | // 录像查询以channelId作为deviceId查询 |
| | |
| | | result.setResult(ResponseEntity.status(HttpStatus.BAD_REQUEST).body(wvpResult)); |
| | | return result; |
| | | } |
| | | if (file.getContentType() == null) { |
| | | WVPResult<Object> wvpResult = new WVPResult<>(); |
| | | wvpResult.setCode(-1); |
| | | wvpResult.setMsg("无法识别文件类型"); |
| | | result.setResult(ResponseEntity.status(HttpStatus.BAD_REQUEST).body(wvpResult)); |
| | | return result; |
| | | } |
| | | if (!file.getContentType().endsWith(".xls") |
| | | && !file.getContentType().endsWith(".csv") |
| | | && !file.getContentType().endsWith(".xlsx") ) { |
| | | logger.warn("通道导入文件类型错误"); |
| | | WVPResult<Object> wvpResult = new WVPResult<>(); |
| | | wvpResult.setCode(-1); |
| | | wvpResult.setMsg("文件类型错误,请使用"); |
| | | result.setResult(ResponseEntity.status(HttpStatus.BAD_REQUEST).body(wvpResult)); |
| | | return result; |
| | | } |
| | | // 同时只处理一个文件 |
| | | if (resultHolder.exist(key, null)) { |
| | | logger.warn("已有导入任务正在执行"); |
| | |
| | | disabled: node.level === 1, |
| | | divided: true, |
| | | onClick: () => { |
| | | this.removeCatalog(data.id, node) |
| | | this.$confirm('确定删除?', '提示', { |
| | | confirmButtonText: '确定', |
| | | cancelButtonText: '取消', |
| | | type: 'warning' |
| | | }).then(() => { |
| | | this.removeCatalog(data.id, node) |
| | | }).catch(() => { |
| | | |
| | | }); |
| | | } |
| | | }, |
| | | { |