Browse Source

优化zlm接入

pull/276/head
648540858 3 years ago
parent
commit
a797cd1c4b
  1. 4
      src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java
  2. 17
      src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
  3. 23
      web_src/src/components/dialog/platformEdit.vue

4
src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java

@ -52,7 +52,9 @@ public class ZLMRunner implements CommandLineRunner {
(MediaServerItem mediaServerItem, JSONObject response)->{ (MediaServerItem mediaServerItem, JSONObject response)->{
ZLMServerConfig zlmServerConfig = JSONObject.toJavaObject(response, ZLMServerConfig.class); ZLMServerConfig zlmServerConfig = JSONObject.toJavaObject(response, ZLMServerConfig.class);
if (zlmServerConfig !=null ) { if (zlmServerConfig !=null ) {
startGetMedia.remove(zlmServerConfig.getGeneralMediaServerId()); if (startGetMedia != null) {
startGetMedia.remove(zlmServerConfig.getGeneralMediaServerId());
}
mediaServerService.handLeZLMServerConfig(zlmServerConfig); mediaServerService.handLeZLMServerConfig(zlmServerConfig);
} }
}); });

17
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java

@ -29,6 +29,7 @@ import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.*; import java.util.*;
@ -203,6 +204,15 @@ public class MediaServerServiceImpl implements IMediaServerService, CommandLineR
} }
result.add(mediaServerItem); result.add(mediaServerItem);
} }
result.sort((serverItem1, serverItem2)->{
int sortResult = 0;
try {
sortResult = format.parse(serverItem1.getCreateTime()).compareTo(format.parse(serverItem2.getCreateTime()));
} catch (ParseException e) {
e.printStackTrace();
}
return sortResult;
});
return result; return result;
} }
@ -271,7 +281,9 @@ public class MediaServerServiceImpl implements IMediaServerService, CommandLineR
result.setMsg("保存失败,媒体服务ID [ " + zlmServerConfig.getGeneralMediaServerId() + " ] 已存在,请修改媒体服务器配置"); result.setMsg("保存失败,媒体服务ID [ " + zlmServerConfig.getGeneralMediaServerId() + " ] 已存在,请修改媒体服务器配置");
return result; return result;
} }
mediaServerItem.setId(zlmServerConfig.getGeneralMediaServerId());
zlmServerConfig.setIp(mediaServerItem.getIp()); zlmServerConfig.setIp(mediaServerItem.getIp());
mediaServerMapper.add(mediaServerItem);
handLeZLMServerConfig(zlmServerConfig); handLeZLMServerConfig(zlmServerConfig);
result.setCode(0); result.setCode(0);
result.setMsg("success"); result.setMsg("success");
@ -311,8 +323,13 @@ public class MediaServerServiceImpl implements IMediaServerService, CommandLineR
} }
if (StringUtils.isEmpty(serverItem.getId())) { if (StringUtils.isEmpty(serverItem.getId())) {
serverItem.setId(zlmServerConfig.getGeneralMediaServerId()); serverItem.setId(zlmServerConfig.getGeneralMediaServerId());
}
if (redisUtil.get(VideoManagerConstants.MEDIA_SERVER_PREFIX + serverItem.getId()) == null) {
SsrcConfig ssrcConfig = new SsrcConfig(serverItem.getId(), null, sipConfig.getDomain());
serverItem.setSsrcConfig(ssrcConfig);
redisUtil.set(VideoManagerConstants.MEDIA_SERVER_PREFIX + serverItem.getId(), serverItem); redisUtil.set(VideoManagerConstants.MEDIA_SERVER_PREFIX + serverItem.getId(), serverItem);
} }
serverItem.setStatus(true); serverItem.setStatus(true);
mediaServerMapper.update(serverItem); mediaServerMapper.update(serverItem);
resetOnlineServerItem(serverItem); resetOnlineServerItem(serverItem);

23
web_src/src/components/dialog/platformEdit.vue

@ -97,7 +97,28 @@ export default {
name: "platformEdit", name: "platformEdit",
props: {}, props: {},
computed: {}, computed: {},
created() {}, created() {
this.platform = {
id: null,
enable: true,
ptz: true,
rtcp: false,
name: null,
serverGBId: null,
serverGBDomain: null,
serverIP: null,
serverPort: null,
deviceGBId: null,
deviceIp: null,
devicePort: null,
username: null,
password: null,
expires: 300,
keepTimeout: 60,
transport: "UDP",
characterSet: "GB2312",
}
},
data() { data() {
var deviceGBIdRules = async (rule, value, callback) => { var deviceGBIdRules = async (rule, value, callback) => {
console.log(value); console.log(value);

Loading…
Cancel
Save