Commit 2e60339e0a9db9548d4523399c87ec02cd1fb625

Authored by 648540858
1 parent a179a45a

修复候选通道查询bug

src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStream.java
... ... @@ -14,6 +14,10 @@ public class GbStream extends PlatformGbStream{
14 14 private double latitude;
15 15 private String streamType;
16 16 private boolean status;
  17 + /**
  18 + * GMT unix系统时间戳,单位秒
  19 + */
  20 + public Long createStamp;
17 21  
18 22 public String getApp() {
19 23 return app;
... ... @@ -86,4 +90,13 @@ public class GbStream extends PlatformGbStream{
86 90 public void setMediaServerId(String mediaServerId) {
87 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 138 if (gbStreamMapper.selectOne(transform.getApp(), transform.getStream()) != null) {
139 139 gbStreamMapper.update(transform);
140 140 }else {
  141 + transform.setCreateStamp(System.currentTimeMillis());
141 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 57 private String originUrl;
58 58  
59 59 /**
60   - * GMT unix系统时间戳,单位秒
61   - */
62   - private Long createStamp;
63   -
64   - /**
65 60 * 存活时间,单位秒
66 61 */
67 62 private Long aliveSecond;
... ... @@ -92,7 +87,7 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte
92 87  
93 88 @Override
94 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 93 public static class MediaSchema {
... ... @@ -182,14 +177,6 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte
182 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 180 public Long getAliveSecond() {
194 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 117 try {
118 118 List<DeviceChannel> deviceChannelList = new ArrayList<>();
119 119 for (GbStream gbStream : gbStreams) {
120   - platformGbStreamMapper.delByAppAndStream(gbStream.getApp(), gbStream.getStream());
  120 + platformGbStreamMapper.delByAppAndStreamAndPlatform(gbStream.getApp(), gbStream.getStream(), platformId);
121 121 DeviceChannel deviceChannel = new DeviceChannel();
122 122 deviceChannel.setChannelId(gbStream.getGbId());
123 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 125 public boolean saveToGB(GbStream stream) {
126 126 stream.setStreamType("push");
127 127 stream.setStatus(true);
  128 + stream.setCreateStamp(System.currentTimeMillis());
128 129 int add = gbStreamMapper.add(stream);
129 130  
130 131 // 查找开启了全部直播流共享的上级平台
... ... @@ -305,6 +306,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
305 306 streamPushItem.setStreamType("push");
306 307 streamPushItem.setStatus(true);
307 308 streamPushItem.setGbId("34020000004111" + gbId);
  309 + streamPushItem.setCreateStamp(System.currentTimeMillis());
308 310 gbId ++;
309 311 }
310 312 int limitCount = 30;
... ...
src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java
... ... @@ -56,7 +56,7 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener&lt;StreamPus
56 56 streamPushItem.setGbId(streamPushExcelDto.getGbId());
57 57 streamPushItem.setStatus(false);
58 58 streamPushItem.setStreamType("push");
59   - streamPushItem.setCreateStamp(System.currentTimeMillis()/1000);
  59 + streamPushItem.setCreateStamp(System.currentTimeMillis());
60 60 streamPushItem.setMediaServerId(defaultMediaServerId);
61 61 streamPushItem.setName(streamPushExcelDto.getName());
62 62 streamPushItem.setOriginType(2);
... ...
src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java
... ... @@ -15,10 +15,10 @@ import java.util.List;
15 15 public interface GbStreamMapper {
16 16  
17 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 19 "('${app}', '${stream}', '${gbId}', '${name}', " +
20 20 "'${longitude}', '${latitude}', '${streamType}', " +
21   - "'${mediaServerId}', ${status})")
  21 + "'${mediaServerId}', ${status}, ${createStamp})")
22 22 int add(GbStream gbStream);
23 23  
24 24 @Update("UPDATE gb_stream " +
... ... @@ -38,8 +38,8 @@ public interface GbStreamMapper {
38 38 int del(String app, String stream);
39 39  
40 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 43 List<GbStream> selectAll(String platformId);
44 44  
45 45 @Select("SELECT * FROM gb_stream WHERE app=#{app} AND stream=#{stream}")
... ... @@ -87,12 +87,12 @@ public interface GbStreamMapper {
87 87 @Insert("<script> " +
88 88 "REPLACE into gb_stream " +
89 89 "(app, stream, gbId, name, " +
90   - "longitude, latitude, streamType, mediaServerId, status)" +
  90 + "longitude, latitude, streamType, mediaServerId, status, createStamp)" +
91 91 "values " +
92 92 "<foreach collection='subList' index='index' item='item' separator=','> " +
93 93 "('${item.app}', '${item.stream}', '${item.gbId}', '${item.name}', " +
94 94 "'${item.longitude}', '${item.latitude}', '${item.streamType}', " +
95   - "'${item.mediaServerId}', ${item.status}) "+
  95 + "'${item.mediaServerId}', ${item.status}, ${item.createStamp}) "+
96 96 "</foreach> " +
97 97 "</script>")
98 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 73 "</script> ")
74 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 679 streamProxyItem.setStatus(true);
680 680 String now = this.format.format(System.currentTimeMillis());
681 681 streamProxyItem.setCreateTime(now);
  682 + streamProxyItem.setCreateStamp(System.currentTimeMillis());
682 683 try {
683 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 118 @ResponseBody
119 119 public DeferredResult<ResponseEntity<WVPResult<Object>>> uploadChannelFile(@RequestParam(value = "file") MultipartFile file){
120 120  
121   -
122 121 // 最多处理文件一个小时
123 122 DeferredResult<ResponseEntity<WVPResult<Object>>> result = new DeferredResult<>(60*60*1000L);
124 123 // 录像查询以channelId作为deviceId查询
... ... @@ -133,6 +132,23 @@ public class StreamPushController {
133 132 result.setResult(ResponseEntity.status(HttpStatus.BAD_REQUEST).body(wvpResult));
134 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 153 if (resultHolder.exist(key, null)) {
138 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 239 disabled: node.level === 1,
240 240 divided: true,
241 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 {
... ...