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 String streamType;
private boolean status;
/**
* GMT unix系统时间戳单位秒
*/
public Long createStamp;
public String getApp() {
return app;
@ -86,4 +90,13 @@ public class GbStream extends PlatformGbStream{
public void setMediaServerId(String 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) {
gbStreamMapper.update(transform);
}else {
transform.setCreateStamp(System.currentTimeMillis());
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;
/**
* GMT unix系统时间戳单位秒
*/
private Long createStamp;
/**
* 存活时间单位秒
*/
@ -92,7 +87,7 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte
@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 {
@ -182,14 +177,6 @@ public class StreamPushItem extends GbStream implements Comparable<StreamPushIte
this.originUrl = originUrl;
}
public Long getCreateStamp() {
return createStamp;
}
public void setCreateStamp(Long createStamp) {
this.createStamp = createStamp;
}
public Long getAliveSecond() {
return aliveSecond;
}

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

@ -117,7 +117,7 @@ public class GbStreamServiceImpl implements IGbStreamService {
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);

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) {
stream.setStreamType("push");
stream.setStatus(true);
stream.setCreateStamp(System.currentTimeMillis());
int add = gbStreamMapper.add(stream);
// 查找开启了全部直播流共享的上级平台
@ -305,6 +306,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
streamPushItem.setStreamType("push");
streamPushItem.setStatus(true);
streamPushItem.setGbId("34020000004111" + gbId);
streamPushItem.setCreateStamp(System.currentTimeMillis());
gbId ++;
}
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.setStatus(false);
streamPushItem.setStreamType("push");
streamPushItem.setCreateStamp(System.currentTimeMillis()/1000);
streamPushItem.setCreateStamp(System.currentTimeMillis());
streamPushItem.setMediaServerId(defaultMediaServerId);
streamPushItem.setName(streamPushExcelDto.getName());
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 {
@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 " +
@ -38,8 +38,8 @@ public interface GbStreamMapper {
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}")
@ -87,12 +87,12 @@ public interface GbStreamMapper {
@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);

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

@ -73,6 +73,6 @@ public interface PlatformGbStreamMapper {
"</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);
}

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

@ -679,6 +679,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
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) {
//事务回滚

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

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

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,
divided: true,
onClick: () => {
this.$confirm('确定删除?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.removeCatalog(data.id, node)
}).catch(() => {
});
}
},
{

Loading…
Cancel
Save