Commit 2e60339e0a9db9548d4523399c87ec02cd1fb625
1 parent
a179a45a
修复候选通道查询bug
Showing
12 changed files
with
54 additions
and
26 deletions
src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStream.java
| @@ -14,6 +14,10 @@ public class GbStream extends PlatformGbStream{ | @@ -14,6 +14,10 @@ public class GbStream extends PlatformGbStream{ | ||
| 14 | private double latitude; | 14 | private double latitude; |
| 15 | private String streamType; | 15 | private String streamType; |
| 16 | private boolean status; | 16 | private boolean status; |
| 17 | + /** | ||
| 18 | + * GMT unix系统时间戳,单位秒 | ||
| 19 | + */ | ||
| 20 | + public Long createStamp; | ||
| 17 | 21 | ||
| 18 | public String getApp() { | 22 | public String getApp() { |
| 19 | return app; | 23 | return app; |
| @@ -86,4 +90,13 @@ public class GbStream extends PlatformGbStream{ | @@ -86,4 +90,13 @@ public class GbStream extends PlatformGbStream{ | ||
| 86 | public void setMediaServerId(String mediaServerId) { | 90 | public void setMediaServerId(String mediaServerId) { |
| 87 | this.mediaServerId = mediaServerId; | 91 | this.mediaServerId = mediaServerId; |
| 88 | } | 92 | } |
| 93 | + | ||
| 94 | + | ||
| 95 | + public Long getCreateStamp() { | ||
| 96 | + return createStamp; | ||
| 97 | + } | ||
| 98 | + | ||
| 99 | + public void setCreateStamp(Long createStamp) { | ||
| 100 | + this.createStamp = createStamp; | ||
| 101 | + } | ||
| 89 | } | 102 | } |
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java
| @@ -138,6 +138,7 @@ public class ZLMMediaListManager { | @@ -138,6 +138,7 @@ public class ZLMMediaListManager { | ||
| 138 | if (gbStreamMapper.selectOne(transform.getApp(), transform.getStream()) != null) { | 138 | if (gbStreamMapper.selectOne(transform.getApp(), transform.getStream()) != null) { |
| 139 | gbStreamMapper.update(transform); | 139 | gbStreamMapper.update(transform); |
| 140 | }else { | 140 | }else { |
| 141 | + transform.setCreateStamp(System.currentTimeMillis()); | ||
| 141 | gbStreamMapper.add(transform); | 142 | gbStreamMapper.add(transform); |
| 142 | } | 143 | } |
| 143 | } | 144 | } |
src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java
| @@ -57,11 +57,6 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte | @@ -57,11 +57,6 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte | ||
| 57 | private String originUrl; | 57 | private String originUrl; |
| 58 | 58 | ||
| 59 | /** | 59 | /** |
| 60 | - * GMT unix系统时间戳,单位秒 | ||
| 61 | - */ | ||
| 62 | - private Long createStamp; | ||
| 63 | - | ||
| 64 | - /** | ||
| 65 | * 存活时间,单位秒 | 60 | * 存活时间,单位秒 |
| 66 | */ | 61 | */ |
| 67 | private Long aliveSecond; | 62 | private Long aliveSecond; |
| @@ -92,7 +87,7 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte | @@ -92,7 +87,7 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte | ||
| 92 | 87 | ||
| 93 | @Override | 88 | @Override |
| 94 | public int compareTo(@NotNull StreamPushItem streamPushItem) { | 89 | public int compareTo(@NotNull StreamPushItem streamPushItem) { |
| 95 | - return Long.valueOf(this.createStamp - streamPushItem.getCreateStamp().intValue()).intValue(); | 90 | + return Long.valueOf(super.createStamp - streamPushItem.getCreateStamp().intValue()).intValue(); |
| 96 | } | 91 | } |
| 97 | 92 | ||
| 98 | public static class MediaSchema { | 93 | public static class MediaSchema { |
| @@ -182,14 +177,6 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte | @@ -182,14 +177,6 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte | ||
| 182 | this.originUrl = originUrl; | 177 | this.originUrl = originUrl; |
| 183 | } | 178 | } |
| 184 | 179 | ||
| 185 | - public Long getCreateStamp() { | ||
| 186 | - return createStamp; | ||
| 187 | - } | ||
| 188 | - | ||
| 189 | - public void setCreateStamp(Long createStamp) { | ||
| 190 | - this.createStamp = createStamp; | ||
| 191 | - } | ||
| 192 | - | ||
| 193 | public Long getAliveSecond() { | 180 | public Long getAliveSecond() { |
| 194 | return aliveSecond; | 181 | return aliveSecond; |
| 195 | } | 182 | } |
src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java
| @@ -117,7 +117,7 @@ public class GbStreamServiceImpl implements IGbStreamService { | @@ -117,7 +117,7 @@ public class GbStreamServiceImpl implements IGbStreamService { | ||
| 117 | try { | 117 | try { |
| 118 | List<DeviceChannel> deviceChannelList = new ArrayList<>(); | 118 | List<DeviceChannel> deviceChannelList = new ArrayList<>(); |
| 119 | for (GbStream gbStream : gbStreams) { | 119 | for (GbStream gbStream : gbStreams) { |
| 120 | - platformGbStreamMapper.delByAppAndStream(gbStream.getApp(), gbStream.getStream()); | 120 | + platformGbStreamMapper.delByAppAndStreamAndPlatform(gbStream.getApp(), gbStream.getStream(), platformId); |
| 121 | DeviceChannel deviceChannel = new DeviceChannel(); | 121 | DeviceChannel deviceChannel = new DeviceChannel(); |
| 122 | deviceChannel.setChannelId(gbStream.getGbId()); | 122 | deviceChannel.setChannelId(gbStream.getGbId()); |
| 123 | deviceChannelList.add(deviceChannel); | 123 | deviceChannelList.add(deviceChannel); |
src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java
| @@ -125,6 +125,7 @@ public class StreamPushServiceImpl implements IStreamPushService { | @@ -125,6 +125,7 @@ public class StreamPushServiceImpl implements IStreamPushService { | ||
| 125 | public boolean saveToGB(GbStream stream) { | 125 | public boolean saveToGB(GbStream stream) { |
| 126 | stream.setStreamType("push"); | 126 | stream.setStreamType("push"); |
| 127 | stream.setStatus(true); | 127 | stream.setStatus(true); |
| 128 | + stream.setCreateStamp(System.currentTimeMillis()); | ||
| 128 | int add = gbStreamMapper.add(stream); | 129 | int add = gbStreamMapper.add(stream); |
| 129 | 130 | ||
| 130 | // 查找开启了全部直播流共享的上级平台 | 131 | // 查找开启了全部直播流共享的上级平台 |
| @@ -305,6 +306,7 @@ public class StreamPushServiceImpl implements IStreamPushService { | @@ -305,6 +306,7 @@ public class StreamPushServiceImpl implements IStreamPushService { | ||
| 305 | streamPushItem.setStreamType("push"); | 306 | streamPushItem.setStreamType("push"); |
| 306 | streamPushItem.setStatus(true); | 307 | streamPushItem.setStatus(true); |
| 307 | streamPushItem.setGbId("34020000004111" + gbId); | 308 | streamPushItem.setGbId("34020000004111" + gbId); |
| 309 | + streamPushItem.setCreateStamp(System.currentTimeMillis()); | ||
| 308 | gbId ++; | 310 | gbId ++; |
| 309 | } | 311 | } |
| 310 | int limitCount = 30; | 312 | int limitCount = 30; |
src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java
| @@ -56,7 +56,7 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener<StreamPus | @@ -56,7 +56,7 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener<StreamPus | ||
| 56 | streamPushItem.setGbId(streamPushExcelDto.getGbId()); | 56 | streamPushItem.setGbId(streamPushExcelDto.getGbId()); |
| 57 | streamPushItem.setStatus(false); | 57 | streamPushItem.setStatus(false); |
| 58 | streamPushItem.setStreamType("push"); | 58 | streamPushItem.setStreamType("push"); |
| 59 | - streamPushItem.setCreateStamp(System.currentTimeMillis()/1000); | 59 | + streamPushItem.setCreateStamp(System.currentTimeMillis()); |
| 60 | streamPushItem.setMediaServerId(defaultMediaServerId); | 60 | streamPushItem.setMediaServerId(defaultMediaServerId); |
| 61 | streamPushItem.setName(streamPushExcelDto.getName()); | 61 | streamPushItem.setName(streamPushExcelDto.getName()); |
| 62 | streamPushItem.setOriginType(2); | 62 | streamPushItem.setOriginType(2); |
src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java
| @@ -15,10 +15,10 @@ import java.util.List; | @@ -15,10 +15,10 @@ import java.util.List; | ||
| 15 | public interface GbStreamMapper { | 15 | public interface GbStreamMapper { |
| 16 | 16 | ||
| 17 | @Insert("REPLACE INTO gb_stream (app, stream, gbId, name, " + | 17 | @Insert("REPLACE INTO gb_stream (app, stream, gbId, name, " + |
| 18 | - "longitude, latitude, streamType, mediaServerId, status) VALUES" + | 18 | + "longitude, latitude, streamType, mediaServerId, status, createStamp) VALUES" + |
| 19 | "('${app}', '${stream}', '${gbId}', '${name}', " + | 19 | "('${app}', '${stream}', '${gbId}', '${name}', " + |
| 20 | "'${longitude}', '${latitude}', '${streamType}', " + | 20 | "'${longitude}', '${latitude}', '${streamType}', " + |
| 21 | - "'${mediaServerId}', ${status})") | 21 | + "'${mediaServerId}', ${status}, ${createStamp})") |
| 22 | int add(GbStream gbStream); | 22 | int add(GbStream gbStream); |
| 23 | 23 | ||
| 24 | @Update("UPDATE gb_stream " + | 24 | @Update("UPDATE gb_stream " + |
| @@ -38,8 +38,8 @@ public interface GbStreamMapper { | @@ -38,8 +38,8 @@ public interface GbStreamMapper { | ||
| 38 | int del(String app, String stream); | 38 | int del(String app, String stream); |
| 39 | 39 | ||
| 40 | @Select("SELECT gs.*, pgs.platformId AS platformId, pgs.catalogId AS catalogId FROM gb_stream gs " + | 40 | @Select("SELECT gs.*, pgs.platformId AS platformId, pgs.catalogId AS catalogId FROM gb_stream gs " + |
| 41 | - "LEFT JOIN platform_gb_stream pgs ON gs.app = pgs.app AND gs.stream = pgs.stream " + | ||
| 42 | - "WHERE pgs.platformId is null OR pgs.platformId = #{platformId}") | 41 | + "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)" + |
| 42 | + "order by gs.id asc ") | ||
| 43 | List<GbStream> selectAll(String platformId); | 43 | List<GbStream> selectAll(String platformId); |
| 44 | 44 | ||
| 45 | @Select("SELECT * FROM gb_stream WHERE app=#{app} AND stream=#{stream}") | 45 | @Select("SELECT * FROM gb_stream WHERE app=#{app} AND stream=#{stream}") |
| @@ -87,12 +87,12 @@ public interface GbStreamMapper { | @@ -87,12 +87,12 @@ public interface GbStreamMapper { | ||
| 87 | @Insert("<script> " + | 87 | @Insert("<script> " + |
| 88 | "REPLACE into gb_stream " + | 88 | "REPLACE into gb_stream " + |
| 89 | "(app, stream, gbId, name, " + | 89 | "(app, stream, gbId, name, " + |
| 90 | - "longitude, latitude, streamType, mediaServerId, status)" + | 90 | + "longitude, latitude, streamType, mediaServerId, status, createStamp)" + |
| 91 | "values " + | 91 | "values " + |
| 92 | "<foreach collection='subList' index='index' item='item' separator=','> " + | 92 | "<foreach collection='subList' index='index' item='item' separator=','> " + |
| 93 | "('${item.app}', '${item.stream}', '${item.gbId}', '${item.name}', " + | 93 | "('${item.app}', '${item.stream}', '${item.gbId}', '${item.name}', " + |
| 94 | "'${item.longitude}', '${item.latitude}', '${item.streamType}', " + | 94 | "'${item.longitude}', '${item.latitude}', '${item.streamType}', " + |
| 95 | - "'${item.mediaServerId}', ${item.status}) "+ | 95 | + "'${item.mediaServerId}', ${item.status}, ${item.createStamp}) "+ |
| 96 | "</foreach> " + | 96 | "</foreach> " + |
| 97 | "</script>") | 97 | "</script>") |
| 98 | void batchAdd(List<StreamPushItem> subList); | 98 | void batchAdd(List<StreamPushItem> subList); |
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java
| @@ -73,6 +73,6 @@ public interface PlatformGbStreamMapper { | @@ -73,6 +73,6 @@ public interface PlatformGbStreamMapper { | ||
| 73 | "</script> ") | 73 | "</script> ") |
| 74 | List<ParentPlatform> queryPlatFormListForGBWithGBId(String app, String stream, List<String> platforms); | 74 | List<ParentPlatform> queryPlatFormListForGBWithGBId(String app, String stream, List<String> platforms); |
| 75 | 75 | ||
| 76 | - @Select("SELECT * FROM platform_gb_stream WHERE app=#{app} AND stream=#{stream} AND platformId=#{platformId}") | ||
| 77 | - int delByAppAndStreamAndPlatform(String app, String streamId, String platformId); | 76 | + @Delete("DELETE FROM platform_gb_stream WHERE app=#{app} AND stream=#{stream} AND platformId=#{platformId}") |
| 77 | + int delByAppAndStreamAndPlatform(String app, String stream, String platformId); | ||
| 78 | } | 78 | } |
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
| @@ -679,6 +679,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | @@ -679,6 +679,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager { | ||
| 679 | streamProxyItem.setStatus(true); | 679 | streamProxyItem.setStatus(true); |
| 680 | String now = this.format.format(System.currentTimeMillis()); | 680 | String now = this.format.format(System.currentTimeMillis()); |
| 681 | streamProxyItem.setCreateTime(now); | 681 | streamProxyItem.setCreateTime(now); |
| 682 | + streamProxyItem.setCreateStamp(System.currentTimeMillis()); | ||
| 682 | try { | 683 | try { |
| 683 | if (gbStreamMapper.add(streamProxyItem)<0 || streamProxyMapper.add(streamProxyItem) < 0) { | 684 | if (gbStreamMapper.add(streamProxyItem)<0 || streamProxyMapper.add(streamProxyItem) < 0) { |
| 684 | //事务回滚 | 685 | //事务回滚 |
src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java
| @@ -118,7 +118,6 @@ public class StreamPushController { | @@ -118,7 +118,6 @@ public class StreamPushController { | ||
| 118 | @ResponseBody | 118 | @ResponseBody |
| 119 | public DeferredResult<ResponseEntity<WVPResult<Object>>> uploadChannelFile(@RequestParam(value = "file") MultipartFile file){ | 119 | public DeferredResult<ResponseEntity<WVPResult<Object>>> uploadChannelFile(@RequestParam(value = "file") MultipartFile file){ |
| 120 | 120 | ||
| 121 | - | ||
| 122 | // 最多处理文件一个小时 | 121 | // 最多处理文件一个小时 |
| 123 | DeferredResult<ResponseEntity<WVPResult<Object>>> result = new DeferredResult<>(60*60*1000L); | 122 | DeferredResult<ResponseEntity<WVPResult<Object>>> result = new DeferredResult<>(60*60*1000L); |
| 124 | // 录像查询以channelId作为deviceId查询 | 123 | // 录像查询以channelId作为deviceId查询 |
| @@ -133,6 +132,23 @@ public class StreamPushController { | @@ -133,6 +132,23 @@ public class StreamPushController { | ||
| 133 | result.setResult(ResponseEntity.status(HttpStatus.BAD_REQUEST).body(wvpResult)); | 132 | result.setResult(ResponseEntity.status(HttpStatus.BAD_REQUEST).body(wvpResult)); |
| 134 | return result; | 133 | return result; |
| 135 | } | 134 | } |
| 135 | + if (file.getContentType() == null) { | ||
| 136 | + WVPResult<Object> wvpResult = new WVPResult<>(); | ||
| 137 | + wvpResult.setCode(-1); | ||
| 138 | + wvpResult.setMsg("无法识别文件类型"); | ||
| 139 | + result.setResult(ResponseEntity.status(HttpStatus.BAD_REQUEST).body(wvpResult)); | ||
| 140 | + return result; | ||
| 141 | + } | ||
| 142 | + if (!file.getContentType().endsWith(".xls") | ||
| 143 | + && !file.getContentType().endsWith(".csv") | ||
| 144 | + && !file.getContentType().endsWith(".xlsx") ) { | ||
| 145 | + logger.warn("通道导入文件类型错误"); | ||
| 146 | + WVPResult<Object> wvpResult = new WVPResult<>(); | ||
| 147 | + wvpResult.setCode(-1); | ||
| 148 | + wvpResult.setMsg("文件类型错误,请使用"); | ||
| 149 | + result.setResult(ResponseEntity.status(HttpStatus.BAD_REQUEST).body(wvpResult)); | ||
| 150 | + return result; | ||
| 151 | + } | ||
| 136 | // 同时只处理一个文件 | 152 | // 同时只处理一个文件 |
| 137 | if (resultHolder.exist(key, null)) { | 153 | if (resultHolder.exist(key, null)) { |
| 138 | logger.warn("已有导入任务正在执行"); | 154 | logger.warn("已有导入任务正在执行"); |
src/main/resources/wvp.sqlite
No preview for this file type
web_src/src/components/dialog/chooseChannelForCatalog.vue
| @@ -239,7 +239,15 @@ export default { | @@ -239,7 +239,15 @@ export default { | ||
| 239 | disabled: node.level === 1, | 239 | disabled: node.level === 1, |
| 240 | divided: true, | 240 | divided: true, |
| 241 | onClick: () => { | 241 | onClick: () => { |
| 242 | - this.removeCatalog(data.id, node) | 242 | + this.$confirm('确定删除?', '提示', { |
| 243 | + confirmButtonText: '确定', | ||
| 244 | + cancelButtonText: '取消', | ||
| 245 | + type: 'warning' | ||
| 246 | + }).then(() => { | ||
| 247 | + this.removeCatalog(data.id, node) | ||
| 248 | + }).catch(() => { | ||
| 249 | + | ||
| 250 | + }); | ||
| 243 | } | 251 | } |
| 244 | }, | 252 | }, |
| 245 | { | 253 | { |