Browse Source

修复候选通道查询bug

pull/317/head
648540858 3 years ago
parent
commit
2e60339e0a
  1. 13
      src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStream.java
  2. 1
      src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java
  3. 15
      src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java
  4. 2
      src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java
  5. 2
      src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java
  6. 2
      src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java
  7. 12
      src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java
  8. 4
      src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java
  9. 1
      src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java
  10. 18
      src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java
  11. BIN
      src/main/resources/wvp.sqlite
  12. 8
      web_src/src/components/dialog/chooseChannelForCatalog.vue

13
src/main/java/com/genersoft/iot/vmp/gb28181/bean/GbStream.java

@ -14,6 +14,10 @@ public class GbStream extends PlatformGbStream{
private double latitude; private double latitude;
private String streamType; private String streamType;
private boolean status; private boolean status;
/**
* GMT unix系统时间戳单位秒
*/
public Long createStamp;
public String getApp() { public String getApp() {
return app; return app;
@ -86,4 +90,13 @@ public class GbStream extends PlatformGbStream{
public void setMediaServerId(String mediaServerId) { public void setMediaServerId(String mediaServerId) {
this.mediaServerId = mediaServerId; this.mediaServerId = mediaServerId;
} }
public Long getCreateStamp() {
return createStamp;
}
public void setCreateStamp(Long createStamp) {
this.createStamp = createStamp;
}
} }

1
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMMediaListManager.java

@ -138,6 +138,7 @@ public class ZLMMediaListManager {
if (gbStreamMapper.selectOne(transform.getApp(), transform.getStream()) != null) { if (gbStreamMapper.selectOne(transform.getApp(), transform.getStream()) != null) {
gbStreamMapper.update(transform); gbStreamMapper.update(transform);
}else { }else {
transform.setCreateStamp(System.currentTimeMillis());
gbStreamMapper.add(transform); gbStreamMapper.add(transform);
} }
} }

15
src/main/java/com/genersoft/iot/vmp/media/zlm/dto/StreamPushItem.java

@ -56,11 +56,6 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte
*/ */
private String originUrl; private String originUrl;
/**
* GMT unix系统时间戳单位秒
*/
private Long createStamp;
/** /**
* 存活时间单位秒 * 存活时间单位秒
*/ */
@ -92,7 +87,7 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte
@Override @Override
public int compareTo(@NotNull StreamPushItem streamPushItem) { 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 static class MediaSchema {
@ -182,14 +177,6 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte
this.originUrl = originUrl; this.originUrl = originUrl;
} }
public Long getCreateStamp() {
return createStamp;
}
public void setCreateStamp(Long createStamp) {
this.createStamp = createStamp;
}
public Long getAliveSecond() { public Long getAliveSecond() {
return aliveSecond; return aliveSecond;
} }

2
src/main/java/com/genersoft/iot/vmp/service/impl/GbStreamServiceImpl.java

@ -117,7 +117,7 @@ public class GbStreamServiceImpl implements IGbStreamService {
try { try {
List<DeviceChannel> deviceChannelList = new ArrayList<>(); List<DeviceChannel> deviceChannelList = new ArrayList<>();
for (GbStream gbStream : gbStreams) { for (GbStream gbStream : gbStreams) {
platformGbStreamMapper.delByAppAndStream(gbStream.getApp(), gbStream.getStream()); platformGbStreamMapper.delByAppAndStreamAndPlatform(gbStream.getApp(), gbStream.getStream(), platformId);
DeviceChannel deviceChannel = new DeviceChannel(); DeviceChannel deviceChannel = new DeviceChannel();
deviceChannel.setChannelId(gbStream.getGbId()); deviceChannel.setChannelId(gbStream.getGbId());
deviceChannelList.add(deviceChannel); deviceChannelList.add(deviceChannel);

2
src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushServiceImpl.java

@ -125,6 +125,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
public boolean saveToGB(GbStream stream) { public boolean saveToGB(GbStream stream) {
stream.setStreamType("push"); stream.setStreamType("push");
stream.setStatus(true); stream.setStatus(true);
stream.setCreateStamp(System.currentTimeMillis());
int add = gbStreamMapper.add(stream); int add = gbStreamMapper.add(stream);
// 查找开启了全部直播流共享的上级平台 // 查找开启了全部直播流共享的上级平台
@ -305,6 +306,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
streamPushItem.setStreamType("push"); streamPushItem.setStreamType("push");
streamPushItem.setStatus(true); streamPushItem.setStatus(true);
streamPushItem.setGbId("34020000004111" + gbId); streamPushItem.setGbId("34020000004111" + gbId);
streamPushItem.setCreateStamp(System.currentTimeMillis());
gbId ++; gbId ++;
} }
int limitCount = 30; int limitCount = 30;

2
src/main/java/com/genersoft/iot/vmp/service/impl/StreamPushUploadFileHandler.java

@ -56,7 +56,7 @@ public class StreamPushUploadFileHandler extends AnalysisEventListener<StreamPus
streamPushItem.setGbId(streamPushExcelDto.getGbId()); streamPushItem.setGbId(streamPushExcelDto.getGbId());
streamPushItem.setStatus(false); streamPushItem.setStatus(false);
streamPushItem.setStreamType("push"); streamPushItem.setStreamType("push");
streamPushItem.setCreateStamp(System.currentTimeMillis()/1000); streamPushItem.setCreateStamp(System.currentTimeMillis());
streamPushItem.setMediaServerId(defaultMediaServerId); streamPushItem.setMediaServerId(defaultMediaServerId);
streamPushItem.setName(streamPushExcelDto.getName()); streamPushItem.setName(streamPushExcelDto.getName());
streamPushItem.setOriginType(2); streamPushItem.setOriginType(2);

12
src/main/java/com/genersoft/iot/vmp/storager/dao/GbStreamMapper.java

@ -15,10 +15,10 @@ import java.util.List;
public interface GbStreamMapper { public interface GbStreamMapper {
@Insert("REPLACE INTO gb_stream (app, stream, gbId, name, " + @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}', " + "('${app}', '${stream}', '${gbId}', '${name}', " +
"'${longitude}', '${latitude}', '${streamType}', " + "'${longitude}', '${latitude}', '${streamType}', " +
"'${mediaServerId}', ${status})") "'${mediaServerId}', ${status}, ${createStamp})")
int add(GbStream gbStream); int add(GbStream gbStream);
@Update("UPDATE gb_stream " + @Update("UPDATE gb_stream " +
@ -38,8 +38,8 @@ public interface GbStreamMapper {
int del(String app, String stream); int del(String app, String stream);
@Select("SELECT gs.*, pgs.platformId AS platformId, pgs.catalogId AS catalogId FROM gb_stream gs " + @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 " + "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)" +
"WHERE pgs.platformId is null OR pgs.platformId = #{platformId}") "order by gs.id asc ")
List<GbStream> selectAll(String platformId); List<GbStream> selectAll(String platformId);
@Select("SELECT * FROM gb_stream WHERE app=#{app} AND stream=#{stream}") @Select("SELECT * FROM gb_stream WHERE app=#{app} AND stream=#{stream}")
@ -87,12 +87,12 @@ public interface GbStreamMapper {
@Insert("<script> " + @Insert("<script> " +
"REPLACE into gb_stream " + "REPLACE into gb_stream " +
"(app, stream, gbId, name, " + "(app, stream, gbId, name, " +
"longitude, latitude, streamType, mediaServerId, status)" + "longitude, latitude, streamType, mediaServerId, status, createStamp)" +
"values " + "values " +
"<foreach collection='subList' index='index' item='item' separator=','> " + "<foreach collection='subList' index='index' item='item' separator=','> " +
"('${item.app}', '${item.stream}', '${item.gbId}', '${item.name}', " + "('${item.app}', '${item.stream}', '${item.gbId}', '${item.name}', " +
"'${item.longitude}', '${item.latitude}', '${item.streamType}', " + "'${item.longitude}', '${item.latitude}', '${item.streamType}', " +
"'${item.mediaServerId}', ${item.status}) "+ "'${item.mediaServerId}', ${item.status}, ${item.createStamp}) "+
"</foreach> " + "</foreach> " +
"</script>") "</script>")
void batchAdd(List<StreamPushItem> subList); void batchAdd(List<StreamPushItem> subList);

4
src/main/java/com/genersoft/iot/vmp/storager/dao/PlatformGbStreamMapper.java

@ -73,6 +73,6 @@ public interface PlatformGbStreamMapper {
"</script> ") "</script> ")
List<ParentPlatform> queryPlatFormListForGBWithGBId(String app, String stream, List<String> platforms); 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}") @Delete("DELETE FROM platform_gb_stream WHERE app=#{app} AND stream=#{stream} AND platformId=#{platformId}")
int delByAppAndStreamAndPlatform(String app, String streamId, String platformId); int delByAppAndStreamAndPlatform(String app, String stream, String platformId);
} }

1
src/main/java/com/genersoft/iot/vmp/storager/impl/VideoManagerStoragerImpl.java

@ -679,6 +679,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
streamProxyItem.setStatus(true); streamProxyItem.setStatus(true);
String now = this.format.format(System.currentTimeMillis()); String now = this.format.format(System.currentTimeMillis());
streamProxyItem.setCreateTime(now); streamProxyItem.setCreateTime(now);
streamProxyItem.setCreateStamp(System.currentTimeMillis());
try { try {
if (gbStreamMapper.add(streamProxyItem)<0 || streamProxyMapper.add(streamProxyItem) < 0) { if (gbStreamMapper.add(streamProxyItem)<0 || streamProxyMapper.add(streamProxyItem) < 0) {
//事务回滚 //事务回滚

18
src/main/java/com/genersoft/iot/vmp/vmanager/streamPush/StreamPushController.java

@ -118,7 +118,6 @@ public class StreamPushController {
@ResponseBody @ResponseBody
public DeferredResult<ResponseEntity<WVPResult<Object>>> uploadChannelFile(@RequestParam(value = "file") MultipartFile file){ public DeferredResult<ResponseEntity<WVPResult<Object>>> uploadChannelFile(@RequestParam(value = "file") MultipartFile file){
// 最多处理文件一个小时 // 最多处理文件一个小时
DeferredResult<ResponseEntity<WVPResult<Object>>> result = new DeferredResult<>(60*60*1000L); DeferredResult<ResponseEntity<WVPResult<Object>>> result = new DeferredResult<>(60*60*1000L);
// 录像查询以channelId作为deviceId查询 // 录像查询以channelId作为deviceId查询
@ -133,6 +132,23 @@ public class StreamPushController {
result.setResult(ResponseEntity.status(HttpStatus.BAD_REQUEST).body(wvpResult)); result.setResult(ResponseEntity.status(HttpStatus.BAD_REQUEST).body(wvpResult));
return result; 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)) { if (resultHolder.exist(key, null)) {
logger.warn("已有导入任务正在执行"); logger.warn("已有导入任务正在执行");

BIN
src/main/resources/wvp.sqlite

Binary file not shown.

8
web_src/src/components/dialog/chooseChannelForCatalog.vue

@ -239,7 +239,15 @@ export default {
disabled: node.level === 1, disabled: node.level === 1,
divided: true, divided: true,
onClick: () => { onClick: () => {
this.$confirm('确定删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.removeCatalog(data.id, node) this.removeCatalog(data.id, node)
}).catch(() => {
});
} }
}, },
{ {

Loading…
Cancel
Save