Commit a797cd1c4bf7ccc18098033ab5572377e84094fd

Authored by 648540858
1 parent 2a1f9796

优化zlm接入

src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMRunner.java
... ... @@ -52,7 +52,9 @@ public class ZLMRunner implements CommandLineRunner {
52 52 (MediaServerItem mediaServerItem, JSONObject response)->{
53 53 ZLMServerConfig zlmServerConfig = JSONObject.toJavaObject(response, ZLMServerConfig.class);
54 54 if (zlmServerConfig !=null ) {
55   - startGetMedia.remove(zlmServerConfig.getGeneralMediaServerId());
  55 + if (startGetMedia != null) {
  56 + startGetMedia.remove(zlmServerConfig.getGeneralMediaServerId());
  57 + }
56 58 mediaServerService.handLeZLMServerConfig(zlmServerConfig);
57 59 }
58 60 });
... ...
src/main/java/com/genersoft/iot/vmp/service/impl/MediaServerServiceImpl.java
... ... @@ -29,6 +29,7 @@ import org.springframework.core.annotation.Order;
29 29 import org.springframework.stereotype.Service;
30 30 import org.springframework.util.StringUtils;
31 31  
  32 +import java.text.ParseException;
32 33 import java.text.SimpleDateFormat;
33 34 import java.util.*;
34 35  
... ... @@ -203,6 +204,15 @@ public class MediaServerServiceImpl implements IMediaServerService, CommandLineR
203 204 }
204 205 result.add(mediaServerItem);
205 206 }
  207 + result.sort((serverItem1, serverItem2)->{
  208 + int sortResult = 0;
  209 + try {
  210 + sortResult = format.parse(serverItem1.getCreateTime()).compareTo(format.parse(serverItem2.getCreateTime()));
  211 + } catch (ParseException e) {
  212 + e.printStackTrace();
  213 + }
  214 + return sortResult;
  215 + });
206 216 return result;
207 217 }
208 218  
... ... @@ -271,7 +281,9 @@ public class MediaServerServiceImpl implements IMediaServerService, CommandLineR
271 281 result.setMsg("保存失败,媒体服务ID [ " + zlmServerConfig.getGeneralMediaServerId() + " ] 已存在,请修改媒体服务器配置");
272 282 return result;
273 283 }
  284 + mediaServerItem.setId(zlmServerConfig.getGeneralMediaServerId());
274 285 zlmServerConfig.setIp(mediaServerItem.getIp());
  286 + mediaServerMapper.add(mediaServerItem);
275 287 handLeZLMServerConfig(zlmServerConfig);
276 288 result.setCode(0);
277 289 result.setMsg("success");
... ... @@ -311,8 +323,13 @@ public class MediaServerServiceImpl implements IMediaServerService, CommandLineR
311 323 }
312 324 if (StringUtils.isEmpty(serverItem.getId())) {
313 325 serverItem.setId(zlmServerConfig.getGeneralMediaServerId());
  326 + }
  327 + if (redisUtil.get(VideoManagerConstants.MEDIA_SERVER_PREFIX + serverItem.getId()) == null) {
  328 + SsrcConfig ssrcConfig = new SsrcConfig(serverItem.getId(), null, sipConfig.getDomain());
  329 + serverItem.setSsrcConfig(ssrcConfig);
314 330 redisUtil.set(VideoManagerConstants.MEDIA_SERVER_PREFIX + serverItem.getId(), serverItem);
315 331 }
  332 +
316 333 serverItem.setStatus(true);
317 334 mediaServerMapper.update(serverItem);
318 335 resetOnlineServerItem(serverItem);
... ...
web_src/src/components/dialog/platformEdit.vue
... ... @@ -97,7 +97,28 @@ export default {
97 97 name: "platformEdit",
98 98 props: {},
99 99 computed: {},
100   - created() {},
  100 + created() {
  101 + this.platform = {
  102 + id: null,
  103 + enable: true,
  104 + ptz: true,
  105 + rtcp: false,
  106 + name: null,
  107 + serverGBId: null,
  108 + serverGBDomain: null,
  109 + serverIP: null,
  110 + serverPort: null,
  111 + deviceGBId: null,
  112 + deviceIp: null,
  113 + devicePort: null,
  114 + username: null,
  115 + password: null,
  116 + expires: 300,
  117 + keepTimeout: 60,
  118 + transport: "UDP",
  119 + characterSet: "GB2312",
  120 + }
  121 + },
101 122 data() {
102 123 var deviceGBIdRules = async (rule, value, callback) => {
103 124 console.log(value);
... ...