Commit 1319f362c70c5047777bf7c3fa96fb47f11a14c4
1 parent
77e16880
添加配置 用于调度系统
Showing
12 changed files
with
196 additions
and
52 deletions
src/main/java/com/genersoft/iot/vmp/vmanager/jt1078/platform/Jt1078OfCarController.java
| @@ -191,22 +191,36 @@ public class Jt1078OfCarController { | @@ -191,22 +191,36 @@ public class Jt1078OfCarController { | ||
| 191 | 191 | ||
| 192 | return resultMap; | 192 | return resultMap; |
| 193 | } | 193 | } |
| 194 | - String msg = jt1078ConfigBean.formatMessageId(sim, channel, rtspConfigBean); | 194 | + String msg = null; |
| 195 | 195 | ||
| 196 | + String stream = StringUtils.join(sim, "-", channel); | ||
| 196 | String url = StringUtils.replace(jt1078ConfigBean.getJt1078Url(), "{0}", jt1078ConfigBean.getJt1078SendPort()); | 197 | String url = StringUtils.replace(jt1078ConfigBean.getJt1078Url(), "{0}", jt1078ConfigBean.getJt1078SendPort()); |
| 197 | try { | 198 | try { |
| 198 | - //List<StreamPushItem> streamPushItems = streamPushService.getPushList(StringUtils.join(sim, "-", channel)); | ||
| 199 | - // int count = CollectionUtils.size(streamPushItems); | ||
| 200 | - // if (count == 0) { | ||
| 201 | - HttpClientPostEntity entity = httpClientUtil.doPost(url, msg, null); | ||
| 202 | - log.info(entity.getResultStr()); | ||
| 203 | - //} | 199 | + StreamContent streamContent = getStreamContentPlayURL(StringUtils.join(stream)); |
| 200 | + if (Objects.isNull(streamContent) || StringUtils.isBlank(streamContent.getWs_flv())) { | ||
| 201 | + //List<StreamPushItem> streamPushItems = streamPushService.getPushList(StringUtils.join(sim, "-", channel)); | ||
| 202 | + // int count = CollectionUtils.size(streamPushItems); | ||
| 203 | + // if (count == 0) { | ||
| 204 | + HttpClientPostEntity entity = createServerLister(stream); | ||
| 205 | + if (Objects.isNull(entity)) { | ||
| 206 | + resultMap.put("code", "-20"); | ||
| 207 | + resultMap.put("message", "新建链接错误,请稍后再试"); | ||
| 208 | + return resultMap; | ||
| 209 | + } | ||
| 204 | 210 | ||
| 205 | - resultMap.put("code", "1"); | ||
| 206 | - resultMap.put("message", "OK"); | 211 | + resultMap.put("port", entity.getPort()); |
| 212 | + resultMap.put("httpPort", entity.getHttpPort()); | ||
| 213 | + resultMap.put("stream", stream); | ||
| 207 | 214 | ||
| 215 | + msg = jt1078ConfigBean.formatMessageId(sim, channel, rtspConfigBean, entity.getPort() + 30000); | ||
| 208 | 216 | ||
| 209 | - StreamContent streamContent = getStreamContent(StringUtils.join(sim, "-", channel)); | 217 | + entity = httpClientUtil.doPost(url, msg, null); |
| 218 | + log.info(entity.getResultStr()); | ||
| 219 | + | ||
| 220 | + streamContent = getStreamContent(stream); | ||
| 221 | + } | ||
| 222 | + resultMap.put("code", "1"); | ||
| 223 | + resultMap.put("message", "OK"); | ||
| 210 | resultMap.put("data", streamContent); | 224 | resultMap.put("data", streamContent); |
| 211 | 225 | ||
| 212 | return resultMap; | 226 | return resultMap; |
| @@ -221,10 +235,8 @@ public class Jt1078OfCarController { | @@ -221,10 +235,8 @@ public class Jt1078OfCarController { | ||
| 221 | } | 235 | } |
| 222 | 236 | ||
| 223 | 237 | ||
| 224 | - | ||
| 225 | - | ||
| 226 | - @GetMapping("/send/stop/io/{sim}/{channel}") | ||
| 227 | - public Map<String, Object> sendIORequestStop(@PathVariable String sim, @PathVariable String channel) { | 238 | + @GetMapping("/send/stop/io/{sim}/{channel}/{stream}/{port}/{httpPort}") |
| 239 | + public Map<String, Object> sendIORequestStop(@PathVariable String sim, @PathVariable String channel, @PathVariable String stream, @PathVariable Integer port, @PathVariable Integer httpPort) { | ||
| 228 | Map<String, Object> resultMap = new HashMap<>(); | 240 | Map<String, Object> resultMap = new HashMap<>(); |
| 229 | if (StringUtils.isBlank(sim)) { | 241 | if (StringUtils.isBlank(sim)) { |
| 230 | resultMap.put("code", "-100"); | 242 | resultMap.put("code", "-100"); |
| @@ -243,9 +255,12 @@ public class Jt1078OfCarController { | @@ -243,9 +255,12 @@ public class Jt1078OfCarController { | ||
| 243 | String msg = jt1078ConfigBean.formatMessageStop(sim, channel); | 255 | String msg = jt1078ConfigBean.formatMessageStop(sim, channel); |
| 244 | 256 | ||
| 245 | 257 | ||
| 246 | - String url = StringUtils.replace(jt1078ConfigBean.getJt1078Url(), "{0}", jt1078ConfigBean.getStopSendPort()); | 258 | + String url = jt1078ConfigBean.formatStopPushURL(stream, port, httpPort); |
| 247 | try { | 259 | try { |
| 248 | - List<StreamPushItem> streamPushItems = streamPushService.getPushList(StringUtils.join(sim, "-", channel)); | 260 | + httpClientUtil.doGet(url, null); |
| 261 | + | ||
| 262 | + url = StringUtils.replace(jt1078ConfigBean.getJt1078Url(), "{0}", jt1078ConfigBean.getStopSendPort()); | ||
| 263 | + List<StreamPushItem> streamPushItems = streamPushService.getPushList(stream); | ||
| 249 | int count = CollectionUtils.size(streamPushItems); | 264 | int count = CollectionUtils.size(streamPushItems); |
| 250 | for (int i = 0; i < count; i++) { | 265 | for (int i = 0; i < count; i++) { |
| 251 | StreamPushItem item = streamPushItems.get(i); | 266 | StreamPushItem item = streamPushItems.get(i); |
| @@ -268,6 +283,7 @@ public class Jt1078OfCarController { | @@ -268,6 +283,7 @@ public class Jt1078OfCarController { | ||
| 268 | resultMap.put("code", "1"); | 283 | resultMap.put("code", "1"); |
| 269 | resultMap.put("message", "OK"); | 284 | resultMap.put("message", "OK"); |
| 270 | 285 | ||
| 286 | + | ||
| 271 | return resultMap; | 287 | return resultMap; |
| 272 | } catch (URISyntaxException | IOException e) { | 288 | } catch (URISyntaxException | IOException e) { |
| 273 | log.error("发送停止推流指令异常;[{}],[{}]", url, msg, e); | 289 | log.error("发送停止推流指令异常;[{}],[{}]", url, msg, e); |
| @@ -383,13 +399,25 @@ public class Jt1078OfCarController { | @@ -383,13 +399,25 @@ public class Jt1078OfCarController { | ||
| 383 | String key = StringUtils.join(sim, "-", channel); | 399 | String key = StringUtils.join(sim, "-", channel); |
| 384 | redisTemplate.opsForValue().set(key, channelMapping, 1, TimeUnit.HOURS); | 400 | redisTemplate.opsForValue().set(key, channelMapping, 1, TimeUnit.HOURS); |
| 385 | 401 | ||
| 386 | - String msg = jt1078ConfigBean.formatMessageHistoryPlayRTSP(sim, channel, startTime, endTime, rtspConfigBean); | 402 | + String msg = null; |
| 387 | 403 | ||
| 388 | log.info("msg:{}", msg); | 404 | log.info("msg:{}", msg); |
| 389 | String url = StringUtils.replace(jt1078ConfigBean.getJt1078Url(), "{0}", jt1078ConfigBean.getPlayHistoryPort()); | 405 | String url = StringUtils.replace(jt1078ConfigBean.getJt1078Url(), "{0}", jt1078ConfigBean.getPlayHistoryPort()); |
| 406 | + | ||
| 390 | try { | 407 | try { |
| 408 | + HttpClientPostEntity entity = createServerLister(channelMapping); | ||
| 409 | + if (Objects.isNull(entity)) { | ||
| 410 | + resultMap.put("code", "-20"); | ||
| 411 | + resultMap.put("message", "新建链接错误,请稍后再试"); | ||
| 412 | + return resultMap; | ||
| 413 | + } | ||
| 414 | + resultMap.put("stream", channelMapping); | ||
| 415 | + resultMap.put("port", entity.getPort()); | ||
| 416 | + resultMap.put("httpPort", entity.getHttpPort()); | ||
| 417 | + | ||
| 418 | + msg = jt1078ConfigBean.formatMessageHistoryPlayRTSP(sim, channel, startTime, endTime, rtspConfigBean, entity.getPort() + 30000); | ||
| 391 | boolean flag = false; | 419 | boolean flag = false; |
| 392 | - HttpClientPostEntity entity = null; | 420 | + |
| 393 | key = key + "-lock"; | 421 | key = key + "-lock"; |
| 394 | int index = 0; | 422 | int index = 0; |
| 395 | do { | 423 | do { |
| @@ -419,11 +447,12 @@ public class Jt1078OfCarController { | @@ -419,11 +447,12 @@ public class Jt1078OfCarController { | ||
| 419 | 447 | ||
| 420 | Thread.sleep(10000); | 448 | Thread.sleep(10000); |
| 421 | 449 | ||
| 422 | - StreamContent streamContent = getStreamContent("\"" + channelMapping + "\""); | 450 | + StreamContent streamContent = getStreamContent(channelMapping); |
| 423 | 451 | ||
| 424 | log.info("StreamContent:[{}]", streamContent); | 452 | log.info("StreamContent:[{}]", streamContent); |
| 425 | resultMap.put("data", streamContent); | 453 | resultMap.put("data", streamContent); |
| 426 | 454 | ||
| 455 | + | ||
| 427 | return resultMap; | 456 | return resultMap; |
| 428 | } catch (URISyntaxException | IOException e) { | 457 | } catch (URISyntaxException | IOException e) { |
| 429 | log.error("发送推流指令异常;[{}],[{}]", url, msg, e); | 458 | log.error("发送推流指令异常;[{}],[{}]", url, msg, e); |
| @@ -456,11 +485,8 @@ public class Jt1078OfCarController { | @@ -456,11 +485,8 @@ public class Jt1078OfCarController { | ||
| 456 | int index = 0; | 485 | int index = 0; |
| 457 | do { | 486 | do { |
| 458 | index++; | 487 | index++; |
| 459 | - try { | ||
| 460 | - streamContent = streamPushController.getPlayUrl("schedule", stream, mediaConfig.getId()); | ||
| 461 | - } catch (com.genersoft.iot.vmp.conf.exception.ControllerException e) { | ||
| 462 | - log.info("获取播放地址失败:[{}],[{}]",stream,mediaConfig.getId()); | ||
| 463 | - } | 488 | + streamContent = getStreamContentPlayURL(stream); |
| 489 | + | ||
| 464 | if (Objects.nonNull(streamContent) && StringUtils.isNotEmpty(streamContent.getWs_flv())) { | 490 | if (Objects.nonNull(streamContent) && StringUtils.isNotEmpty(streamContent.getWs_flv())) { |
| 465 | break; | 491 | break; |
| 466 | } | 492 | } |
| @@ -471,6 +497,15 @@ public class Jt1078OfCarController { | @@ -471,6 +497,15 @@ public class Jt1078OfCarController { | ||
| 471 | return streamContent; | 497 | return streamContent; |
| 472 | } | 498 | } |
| 473 | 499 | ||
| 500 | + private StreamContent getStreamContentPlayURL(String stream) { | ||
| 501 | + try { | ||
| 502 | + return streamPushController.getPlayUrl("schedule", stream, mediaConfig.getId()); | ||
| 503 | + } catch (com.genersoft.iot.vmp.conf.exception.ControllerException e) { | ||
| 504 | + log.info("获取播放地址失败:[{}],[{}]", stream, mediaConfig.getId()); | ||
| 505 | + } | ||
| 506 | + return null; | ||
| 507 | + } | ||
| 508 | + | ||
| 474 | private void requestToken() throws URISyntaxException, IOException { | 509 | private void requestToken() throws URISyntaxException, IOException { |
| 475 | HttpClientPostEntity entity = this.httpClientUtil.doGet(this.tuohuaConfigBean.getPageURL(), (String) null); | 510 | HttpClientPostEntity entity = this.httpClientUtil.doGet(this.tuohuaConfigBean.getPageURL(), (String) null); |
| 476 | if (!Objects.isNull(entity)) { | 511 | if (!Objects.isNull(entity)) { |
| @@ -559,4 +594,45 @@ public class Jt1078OfCarController { | @@ -559,4 +594,45 @@ public class Jt1078OfCarController { | ||
| 559 | time = StringUtils.replace(time, " ", ""); | 594 | time = StringUtils.replace(time, " ", ""); |
| 560 | return StringUtils.replace(time, ":", ""); | 595 | return StringUtils.replace(time, ":", ""); |
| 561 | } | 596 | } |
| 597 | + | ||
| 598 | + private HttpClientPostEntity createServerLister(String channelMapping) throws URISyntaxException, IOException { | ||
| 599 | + Integer port = RandomUtils.nextInt(jt1078ConfigBean.getStart1078Port(), jt1078ConfigBean.getEnd1078Port()); | ||
| 600 | + Integer httPort = RandomUtils.nextInt(jt1078ConfigBean.getStart1078Port(), jt1078ConfigBean.getEnd1078Port()); | ||
| 601 | + if (!Objects.equals(port, httPort) && Objects.nonNull(port)) { | ||
| 602 | +// Integer port = 1078; | ||
| 603 | +// Integer httPort = 3333; | ||
| 604 | + | ||
| 605 | + String key = "jt1078:server:port:" + port; | ||
| 606 | + String httpKey = "jt1078:server:httpport:" + httPort; | ||
| 607 | + int index = 0; | ||
| 608 | + while (redisTemplate.hasKey(key) || redisTemplate.hasKey(httpKey)) { | ||
| 609 | + port = RandomUtils.nextInt(jt1078ConfigBean.getStart1078Port(), jt1078ConfigBean.getEnd1078Port()); | ||
| 610 | + httPort = RandomUtils.nextInt(jt1078ConfigBean.getStart1078Port(), jt1078ConfigBean.getEnd1078Port()); | ||
| 611 | + key = "jt1078:server:port:" + port; | ||
| 612 | + httpKey = "jt1078:server:httpport:" + httPort; | ||
| 613 | + | ||
| 614 | + if (index > 1000) { | ||
| 615 | + break; | ||
| 616 | + } | ||
| 617 | + } | ||
| 618 | + | ||
| 619 | + redisTemplate.opsForValue().set(key, 1, 2, TimeUnit.DAYS); | ||
| 620 | + redisTemplate.opsForValue().set(httpKey, 1, 2, TimeUnit.DAYS); | ||
| 621 | + } else { | ||
| 622 | + port = 1078; | ||
| 623 | + httPort = 3333; | ||
| 624 | + } | ||
| 625 | + | ||
| 626 | + String url = jt1078ConfigBean.formatPushURL(channelMapping, port, httPort); | ||
| 627 | + | ||
| 628 | + HttpClientPostEntity httpClientPostEntity = httpClientUtil.doGet(url, null); | ||
| 629 | + if (Objects.isNull(httpClientPostEntity)) { | ||
| 630 | + return null; | ||
| 631 | + } | ||
| 632 | +// HttpClientPostEntity httpClientPostEntity = new HttpClientPostEntity(); | ||
| 633 | + httpClientPostEntity.setHttpPort(httPort); | ||
| 634 | + httpClientPostEntity.setPort(port); | ||
| 635 | + | ||
| 636 | + return httpClientPostEntity; | ||
| 637 | + } | ||
| 562 | } | 638 | } |
src/main/java/com/genersoft/iot/vmp/vmanager/jt1078/platform/ben/HttpClientPostEntity.java
| @@ -15,6 +15,9 @@ public class HttpClientPostEntity { | @@ -15,6 +15,9 @@ public class HttpClientPostEntity { | ||
| 15 | private Map<String, String> headers; | 15 | private Map<String, String> headers; |
| 16 | private CookieStore cookieStore; | 16 | private CookieStore cookieStore; |
| 17 | 17 | ||
| 18 | + private Integer port; | ||
| 19 | + private Integer httpPort; | ||
| 20 | + | ||
| 18 | public String getResultStr() { | 21 | public String getResultStr() { |
| 19 | return resultStr; | 22 | return resultStr; |
| 20 | } | 23 | } |
| @@ -38,4 +41,20 @@ public class HttpClientPostEntity { | @@ -38,4 +41,20 @@ public class HttpClientPostEntity { | ||
| 38 | public void setCookieStore(CookieStore cookieStore) { | 41 | public void setCookieStore(CookieStore cookieStore) { |
| 39 | this.cookieStore = cookieStore; | 42 | this.cookieStore = cookieStore; |
| 40 | } | 43 | } |
| 44 | + | ||
| 45 | + public Integer getPort() { | ||
| 46 | + return port; | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + public void setPort(Integer port) { | ||
| 50 | + this.port = port; | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + public Integer getHttpPort() { | ||
| 54 | + return httpPort; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + public void setHttpPort(Integer httpPort) { | ||
| 58 | + this.httpPort = httpPort; | ||
| 59 | + } | ||
| 41 | } | 60 | } |
src/main/java/com/genersoft/iot/vmp/vmanager/jt1078/platform/config/Jt1078ConfigBean.java
| @@ -4,6 +4,8 @@ import org.apache.commons.lang3.StringUtils; | @@ -4,6 +4,8 @@ import org.apache.commons.lang3.StringUtils; | ||
| 4 | import org.springframework.beans.factory.annotation.Value; | 4 | import org.springframework.beans.factory.annotation.Value; |
| 5 | import org.springframework.stereotype.Component; | 5 | import org.springframework.stereotype.Component; |
| 6 | 6 | ||
| 7 | +import java.util.Objects; | ||
| 8 | + | ||
| 7 | /** | 9 | /** |
| 8 | * @author liujun | 10 | * @author liujun |
| 9 | * @date 2024年10月23日 13:38 | 11 | * @date 2024年10月23日 13:38 |
| @@ -21,16 +23,27 @@ public class Jt1078ConfigBean { | @@ -21,16 +23,27 @@ public class Jt1078ConfigBean { | ||
| 21 | @Value("${tuohua.bsth.jt1078.playHistoryPort}") | 23 | @Value("${tuohua.bsth.jt1078.playHistoryPort}") |
| 22 | private String playHistoryPort; | 24 | private String playHistoryPort; |
| 23 | 25 | ||
| 26 | + @Value("${tuohua.bsth.jt1078.ports}") | ||
| 27 | + private String portsOf1078; | ||
| 28 | + | ||
| 29 | + @Value("${tuohua.bsth.jt1078.pushURL}") | ||
| 30 | + private String pushURL; | ||
| 31 | + @Value("${tuohua.bsth.jt1078.stopPushURL}") | ||
| 32 | + private String stopPUshURL; | ||
| 33 | + | ||
| 34 | + private Integer start1078Port; | ||
| 35 | + private Integer end1078Port; | ||
| 36 | + | ||
| 24 | 37 | ||
| 25 | private static final String SEND_IO_MESSAGE_RTSP = "{ \"messageId\": 37121, \"properties\": 0, \"clientId\": \"{clientId}\", \"serialNo\": \"1\", \"ip\": \"{ip}\", \"tcpPort\": \"{tcpPort}\", \"udpPort\": \"{udpPort}\", \"channelNo\": \"{channelNo}\", \"mediaType\": \"1\", \"streamType\": \"1\"}"; | 38 | private static final String SEND_IO_MESSAGE_RTSP = "{ \"messageId\": 37121, \"properties\": 0, \"clientId\": \"{clientId}\", \"serialNo\": \"1\", \"ip\": \"{ip}\", \"tcpPort\": \"{tcpPort}\", \"udpPort\": \"{udpPort}\", \"channelNo\": \"{channelNo}\", \"mediaType\": \"1\", \"streamType\": \"1\"}"; |
| 26 | private static final String SEND_IO_MESSAGE_RTSP_STOP = "{\"messageId\": 37122,\"properties\": 0,\"clientId\": \"{clientId}\",\"serialNo\": \"1\",\"channelNo\": \"{channelNo}\",\"command\": \"0\",\"closeType\": \"0\",\"streamType\": \"1\"}"; | 39 | private static final String SEND_IO_MESSAGE_RTSP_STOP = "{\"messageId\": 37122,\"properties\": 0,\"clientId\": \"{clientId}\",\"serialNo\": \"1\",\"channelNo\": \"{channelNo}\",\"command\": \"0\",\"closeType\": \"0\",\"streamType\": \"1\"}"; |
| 27 | private static final String SEND_IO_HISTORY_RTSP = "{\"msgid\":37381,\"clientId\":\"{clientId}\",\"startTime\":\"{startTime}\",\"endTime\":\"{endTime}\",\"mediaType\":0,\"streamType\":0,\"storageType\":0,\"channelId\":{channelNo}}"; | 40 | private static final String SEND_IO_HISTORY_RTSP = "{\"msgid\":37381,\"clientId\":\"{clientId}\",\"startTime\":\"{startTime}\",\"endTime\":\"{endTime}\",\"mediaType\":0,\"streamType\":0,\"storageType\":0,\"channelId\":{channelNo}}"; |
| 28 | private static final String SEND_IO_PLAY_RTSP = "{\"ip\":\"{ip}\",\"tcpPort\":{tcpPort},\"udpPort\":{udpPort},\"channelNo\":\"{channelNo}\",\"mediaType\":0,\"streamType\":0,\"storageType\":0,\"playbackType\":0,\"playbackSpeed\":1,\"startTime\":\"{startTime}\",\"endTime\":\"{endTime}\",\"clientId\":\"{sim}\",\"messageId\":37377}"; | 41 | private static final String SEND_IO_PLAY_RTSP = "{\"ip\":\"{ip}\",\"tcpPort\":{tcpPort},\"udpPort\":{udpPort},\"channelNo\":\"{channelNo}\",\"mediaType\":0,\"streamType\":0,\"storageType\":0,\"playbackType\":0,\"playbackSpeed\":1,\"startTime\":\"{startTime}\",\"endTime\":\"{endTime}\",\"clientId\":\"{sim}\",\"messageId\":37377}"; |
| 29 | 42 | ||
| 30 | - public String formatMessageId(String sim, String channel, RtspConfigBean configBean) { | 43 | + public String formatMessageId(String sim, String channel, RtspConfigBean configBean,Integer port) { |
| 31 | String msg = StringUtils.replace(SEND_IO_MESSAGE_RTSP, "{clientId}", sim); | 44 | String msg = StringUtils.replace(SEND_IO_MESSAGE_RTSP, "{clientId}", sim); |
| 32 | - msg = StringUtils.replace(msg, "{tcpPort}", configBean.getRtspTcpPort()); | ||
| 33 | - msg = StringUtils.replace(msg, "{udpPort}", configBean.getRtspUdpPort()); | 45 | + msg = StringUtils.replace(msg, "{tcpPort}", port+""); |
| 46 | + msg = StringUtils.replace(msg, "{udpPort}", port+""); | ||
| 34 | msg = StringUtils.replace(msg, "{channelNo}", channel); | 47 | msg = StringUtils.replace(msg, "{channelNo}", channel); |
| 35 | return StringUtils.replace(msg, "{ip}", configBean.getRtspIp()); | 48 | return StringUtils.replace(msg, "{ip}", configBean.getRtspIp()); |
| 36 | } | 49 | } |
| @@ -47,17 +60,29 @@ public class Jt1078ConfigBean { | @@ -47,17 +60,29 @@ public class Jt1078ConfigBean { | ||
| 47 | return StringUtils.replace(msg, "{channelNo}", channel); | 60 | return StringUtils.replace(msg, "{channelNo}", channel); |
| 48 | } | 61 | } |
| 49 | 62 | ||
| 50 | - public String formatMessageHistoryPlayRTSP(String sim, String channel, String startTime, String endTime, RtspConfigBean configBean) { | 63 | + public String formatMessageHistoryPlayRTSP(String sim, String channel, String startTime, String endTime, RtspConfigBean configBean,Integer port) { |
| 51 | String msg = StringUtils.replace(SEND_IO_PLAY_RTSP, "{clientId}", sim); | 64 | String msg = StringUtils.replace(SEND_IO_PLAY_RTSP, "{clientId}", sim); |
| 52 | msg = StringUtils.replace(msg, "{startTime}", startTime); | 65 | msg = StringUtils.replace(msg, "{startTime}", startTime); |
| 53 | msg = StringUtils.replace(msg, "{endTime}", endTime); | 66 | msg = StringUtils.replace(msg, "{endTime}", endTime); |
| 54 | msg = StringUtils.replace(msg, "{channelNo}", channel); | 67 | msg = StringUtils.replace(msg, "{channelNo}", channel); |
| 55 | - msg = StringUtils.replace(msg, "{tcpPort}", configBean.getHistoryTcpPort()); | ||
| 56 | - msg = StringUtils.replace(msg, "{udpPort}", configBean.getHistoryUdpPort()); | 68 | + msg = StringUtils.replace(msg, "{tcpPort}", port+""); |
| 69 | + msg = StringUtils.replace(msg, "{udpPort}", port+""); | ||
| 57 | msg = StringUtils.replace(msg, "{sim}", sim); | 70 | msg = StringUtils.replace(msg, "{sim}", sim); |
| 58 | return StringUtils.replace(msg, "{ip}", configBean.getRtspIp()); | 71 | return StringUtils.replace(msg, "{ip}", configBean.getRtspIp()); |
| 59 | } | 72 | } |
| 60 | 73 | ||
| 74 | + public String formatPushURL(String pushKey, int port, int httpPort) { | ||
| 75 | + String msg = StringUtils.replace(pushURL, "{pushKey}", pushKey); | ||
| 76 | + msg = StringUtils.replace(msg, "{port}", String.valueOf(port)); | ||
| 77 | + return StringUtils.replace(msg, "{httpPort}", String.valueOf(httpPort)); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + public String formatStopPushURL(String pushKey, int port, int httpPort) { | ||
| 81 | + String msg = StringUtils.replace(stopPUshURL, "{pushKey}", pushKey); | ||
| 82 | + msg = StringUtils.replace(msg, "{port}", String.valueOf(port)); | ||
| 83 | + return StringUtils.replace(msg, "{httpPort}", String.valueOf(httpPort)); | ||
| 84 | + } | ||
| 85 | + | ||
| 61 | public String getJt1078Url() { | 86 | public String getJt1078Url() { |
| 62 | return jt1078Url; | 87 | return jt1078Url; |
| 63 | } | 88 | } |
| @@ -77,4 +102,26 @@ public class Jt1078ConfigBean { | @@ -77,4 +102,26 @@ public class Jt1078ConfigBean { | ||
| 77 | public String getPlayHistoryPort() { | 102 | public String getPlayHistoryPort() { |
| 78 | return playHistoryPort; | 103 | return playHistoryPort; |
| 79 | } | 104 | } |
| 105 | + | ||
| 106 | + public String getPushURL() { | ||
| 107 | + return pushURL; | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | + public Integer getStart1078Port() { | ||
| 111 | + if (Objects.isNull(start1078Port)) { | ||
| 112 | + start1078Port = Integer.parseInt(StringUtils.substringBefore(portsOf1078, ",")); | ||
| 113 | + } | ||
| 114 | + return start1078Port; | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + public Integer getEnd1078Port() { | ||
| 118 | + if (Objects.isNull(end1078Port)) { | ||
| 119 | + end1078Port = Integer.parseInt(StringUtils.substringAfter(portsOf1078, ",")); | ||
| 120 | + } | ||
| 121 | + return end1078Port; | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + public String getStopPUshURL() { | ||
| 125 | + return stopPUshURL; | ||
| 126 | + } | ||
| 80 | } | 127 | } |
src/main/java/com/genersoft/iot/vmp/vmanager/jt1078/platform/config/TuohuaConfigBean.java
| 1 | package com.genersoft.iot.vmp.vmanager.jt1078.platform.config; | 1 | package com.genersoft.iot.vmp.vmanager.jt1078.platform.config; |
| 2 | 2 | ||
| 3 | +import org.apache.commons.lang3.StringUtils; | ||
| 3 | import org.springframework.beans.factory.annotation.Value; | 4 | import org.springframework.beans.factory.annotation.Value; |
| 4 | import org.springframework.stereotype.Component; | 5 | import org.springframework.stereotype.Component; |
| 5 | 6 | ||
| 7 | +import java.util.Objects; | ||
| 8 | + | ||
| 6 | /** | 9 | /** |
| 7 | * @author liujun | 10 | * @author liujun |
| 8 | * @date 2024年10月23日 13:34 | 11 | * @date 2024年10月23日 13:34 |
| @@ -57,4 +60,6 @@ public class TuohuaConfigBean { | @@ -57,4 +60,6 @@ public class TuohuaConfigBean { | ||
| 57 | public String getSimURL() { | 60 | public String getSimURL() { |
| 58 | return simURL; | 61 | return simURL; |
| 59 | } | 62 | } |
| 63 | + | ||
| 64 | + | ||
| 60 | } | 65 | } |
src/main/resources/application-local.yml
| @@ -13,7 +13,7 @@ spring: | @@ -13,7 +13,7 @@ spring: | ||
| 13 | # REDIS数据库配置 | 13 | # REDIS数据库配置 |
| 14 | redis: | 14 | redis: |
| 15 | # [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1 | 15 | # [必须修改] Redis服务器IP, REDIS安装在本机的,使用127.0.0.1 |
| 16 | - host: 127.0.0.1 | 16 | + host: 192.168.169.100 |
| 17 | # [必须修改] 端口号 | 17 | # [必须修改] 端口号 |
| 18 | port: 6379 | 18 | port: 6379 |
| 19 | # [可选] 数据库 DB | 19 | # [可选] 数据库 DB |
| @@ -60,7 +60,7 @@ sip: | @@ -60,7 +60,7 @@ sip: | ||
| 60 | # 如果要监听多张网卡,可以使用逗号分隔多个IP, 例如: 192.168.1.4,10.0.0.4 | 60 | # 如果要监听多张网卡,可以使用逗号分隔多个IP, 例如: 192.168.1.4,10.0.0.4 |
| 61 | # 如果不明白,就使用0.0.0.0,大部分情况都是可以的 | 61 | # 如果不明白,就使用0.0.0.0,大部分情况都是可以的 |
| 62 | # 请不要使用127.0.0.1,任何包括localhost在内的域名都是不可以的。 | 62 | # 请不要使用127.0.0.1,任何包括localhost在内的域名都是不可以的。 |
| 63 | - ip: 192.169.1.89 | 63 | + ip: 0.0.0.0 |
| 64 | # [可选] 28181服务监听的端口 | 64 | # [可选] 28181服务监听的端口 |
| 65 | port: 5060 | 65 | port: 5060 |
| 66 | 66 | ||
| @@ -148,9 +148,12 @@ tuohua: | @@ -148,9 +148,12 @@ tuohua: | ||
| 148 | historyUdpPort: 9999 | 148 | historyUdpPort: 9999 |
| 149 | ip : 61.169.120.202 | 149 | ip : 61.169.120.202 |
| 150 | jt1078: | 150 | jt1078: |
| 151 | + ports: 9000,9500 | ||
| 152 | + pushURL: http://192.169.1.92:3333/new/server/{pushKey}/{port}/{httpPort} | ||
| 153 | + stopPushURL: http://192.169.1.92:3333/stop/channel/{pushKey}/{port}/{httpPort} | ||
| 151 | url: http://192.168.168.241:8100/device/{0} | 154 | url: http://192.168.168.241:8100/device/{0} |
| 152 | historyListPort: 9205 | 155 | historyListPort: 9205 |
| 153 | - historyPlayPort: 9201 | 156 | + playHistoryPort: 9201 |
| 154 | sendPort: 9101 | 157 | sendPort: 9101 |
| 155 | stopSendPort: 9102 | 158 | stopSendPort: 9102 |
| 156 | playURL: /play/wasm/ws%3A%2F%2F{ip}%3A{port}%2Fschedule%2F{sim}-{channel}.live.flv%3FcallId%{publickey} | 159 | playURL: /play/wasm/ws%3A%2F%2F{ip}%3A{port}%2Fschedule%2F{sim}-{channel}.live.flv%3FcallId%{publickey} |
src/main/resources/application-localDev.yml
| @@ -81,15 +81,15 @@ sip: | @@ -81,15 +81,15 @@ sip: | ||
| 81 | media: | 81 | media: |
| 82 | id: guzijian1 | 82 | id: guzijian1 |
| 83 | # [必须修改] zlm服务器的内网IP | 83 | # [必须修改] zlm服务器的内网IP |
| 84 | - ip: 61.169.120.202 | 84 | + ip: 192.168.169.100 |
| 85 | # [必须修改] zlm服务器的http.port | 85 | # [必须修改] zlm服务器的http.port |
| 86 | http-port: 1091 | 86 | http-port: 1091 |
| 87 | # [可选] 返回流地址时的ip,置空使用 media.ip | 87 | # [可选] 返回流地址时的ip,置空使用 media.ip |
| 88 | - stream-ip: 61.169.120.202 | 88 | + stream-ip: 192.168.169.100 |
| 89 | # [可选] wvp在国标信令中使用的ip,此ip为摄像机可以访问到的ip, 置空使用 media.ip | 89 | # [可选] wvp在国标信令中使用的ip,此ip为摄像机可以访问到的ip, 置空使用 media.ip |
| 90 | - sdp-ip: 61.169.120.202 | 90 | + sdp-ip: 192.168.169.100 |
| 91 | # [可选] zlm服务器的hook所使用的IP, 默认使用sip.ip | 91 | # [可选] zlm服务器的hook所使用的IP, 默认使用sip.ip |
| 92 | - hook-ip: 61.169.120.202 | 92 | + hook-ip: 192.168.169.100 |
| 93 | # [可选] zlm服务器的http.sslport, 置空使用zlm配置文件配置 | 93 | # [可选] zlm服务器的http.sslport, 置空使用zlm配置文件配置 |
| 94 | http-ssl-port: 443 | 94 | http-ssl-port: 443 |
| 95 | # [可选] zlm服务器的hook.admin_params=secret | 95 | # [可选] zlm服务器的hook.admin_params=secret |
| @@ -147,6 +147,9 @@ tuohua: | @@ -147,6 +147,9 @@ tuohua: | ||
| 147 | historyUdpPort: 9999 | 147 | historyUdpPort: 9999 |
| 148 | ip : 61.169.120.202 | 148 | ip : 61.169.120.202 |
| 149 | jt1078: | 149 | jt1078: |
| 150 | + ports: 9000,9500 | ||
| 151 | + pushURL: http://192.169.1.92:3333/new/server/{pushKey}/{port}/{httpPort} | ||
| 152 | + stopPushURL: http://192.169.1.92:3333/stop/channel/{pushKey}/{port}/{httpPort} | ||
| 150 | url: http://192.168.168.241:8100/device/{0} | 153 | url: http://192.168.168.241:8100/device/{0} |
| 151 | historyListPort: 9205 | 154 | historyListPort: 9205 |
| 152 | playHistoryPort: 9201 | 155 | playHistoryPort: 9201 |
| @@ -154,8 +157,4 @@ tuohua: | @@ -154,8 +157,4 @@ tuohua: | ||
| 154 | stopSendPort: 9102 | 157 | stopSendPort: 9102 |
| 155 | playURL: /play/wasm/ws%3A%2F%2F{ip}%3A{port}%2Fschedule%2F{sim}-{channel}.live.flv%3FcallId%{publickey} | 158 | playURL: /play/wasm/ws%3A%2F%2F{ip}%3A{port}%2Fschedule%2F{sim}-{channel}.live.flv%3FcallId%{publickey} |
| 156 | 159 | ||
| 157 | -jt1078: | ||
| 158 | - enable: true | ||
| 159 | - port: 9998 | ||
| 160 | - | ||
| 161 | 160 |
src/main/resources/application.yml
web_src/config/index.js
| @@ -11,14 +11,14 @@ module.exports = { | @@ -11,14 +11,14 @@ module.exports = { | ||
| 11 | assetsPublicPath: "/", | 11 | assetsPublicPath: "/", |
| 12 | proxyTable: { | 12 | proxyTable: { |
| 13 | "/debug": { | 13 | "/debug": { |
| 14 | - target: "http://192.169.1.89:18080", | 14 | + target: "http://192.169.1.92:28080", |
| 15 | changeOrigin: true, | 15 | changeOrigin: true, |
| 16 | pathRewrite: { | 16 | pathRewrite: { |
| 17 | "^/debug": "/", | 17 | "^/debug": "/", |
| 18 | }, | 18 | }, |
| 19 | }, | 19 | }, |
| 20 | "/static/snap": { | 20 | "/static/snap": { |
| 21 | - target: "http://192.169.1.89:18080", | 21 | + target: "http://192.168.169.100:28080", |
| 22 | changeOrigin: true, | 22 | changeOrigin: true, |
| 23 | // pathRewrite: { | 23 | // pathRewrite: { |
| 24 | // '^/static/snap': '/static/snap' | 24 | // '^/static/snap': '/static/snap' |
web_src/src/components/common/DeviceTreeForZtree.vue
| @@ -30,6 +30,7 @@ export default { | @@ -30,6 +30,7 @@ export default { | ||
| 30 | return { | 30 | return { |
| 31 | deviceService: new DeviceService(), | 31 | deviceService: new DeviceService(), |
| 32 | device: null, | 32 | device: null, |
| 33 | + ztreeObj:null, | ||
| 33 | nodes:[], | 34 | nodes:[], |
| 34 | setting: { | 35 | setting: { |
| 35 | callback: { | 36 | callback: { |
| @@ -93,6 +94,7 @@ export default { | @@ -93,6 +94,7 @@ export default { | ||
| 93 | // console.log(treeNodes) | 94 | // console.log(treeNodes) |
| 94 | }, | 95 | }, |
| 95 | handleCreated(ztreeObj) { | 96 | handleCreated(ztreeObj) { |
| 97 | + this.ztreeObj = ztreeObj; | ||
| 96 | console.log(ztreeObj) | 98 | console.log(ztreeObj) |
| 97 | } | 99 | } |
| 98 | } | 100 | } |
web_src/src/layout/UiHeader.vue
| @@ -9,7 +9,6 @@ | @@ -9,7 +9,6 @@ | ||
| 9 | <el-menu-item index="/deviceList">国标设备</el-menu-item> | 9 | <el-menu-item index="/deviceList">国标设备</el-menu-item> |
| 10 | <el-menu-item index="/deviceList1078">1078设备</el-menu-item> | 10 | <el-menu-item index="/deviceList1078">1078设备</el-menu-item> |
| 11 | <el-menu-item index="/map">电子地图</el-menu-item> | 11 | <el-menu-item index="/map">电子地图</el-menu-item> |
| 12 | - <el-menu-item index="/deviceList1078">1078设备</el-menu-item> | ||
| 13 | <el-menu-item index="/pushVideoList">推流列表</el-menu-item> | 12 | <el-menu-item index="/pushVideoList">推流列表</el-menu-item> |
| 14 | <el-menu-item index="/streamProxyList">拉流代理</el-menu-item> | 13 | <el-menu-item index="/streamProxyList">拉流代理</el-menu-item> |
| 15 | <el-menu-item index="/cloudRecord">云端录像</el-menu-item> | 14 | <el-menu-item index="/cloudRecord">云端录像</el-menu-item> |
web_src/src/router/index.js
| @@ -20,7 +20,6 @@ import minhangChannel from '../components/common/minhangChannel.vue' | @@ -20,7 +20,6 @@ import minhangChannel from '../components/common/minhangChannel.vue' | ||
| 20 | import console from '../components/console.vue' | 20 | import console from '../components/console.vue' |
| 21 | import live from '../components/live.vue' | 21 | import live from '../components/live.vue' |
| 22 | import map from '../components/map.vue' | 22 | import map from '../components/map.vue' |
| 23 | -import map1078 from '../components/map1078.vue' | ||
| 24 | import media from '../components/setting/Media.vue' | 23 | import media from '../components/setting/Media.vue' |
| 25 | import sip from '../components/setting/Sip.vue' | 24 | import sip from '../components/setting/Sip.vue' |
| 26 | import web from '../components/setting/Web.vue' | 25 | import web from '../components/setting/Web.vue' |
| @@ -100,11 +99,6 @@ export default new VueRouter({ | @@ -100,11 +99,6 @@ export default new VueRouter({ | ||
| 100 | component: map, | 99 | component: map, |
| 101 | }, | 100 | }, |
| 102 | { | 101 | { |
| 103 | - path: '/map1078', | ||
| 104 | - name: 'map1078', | ||
| 105 | - component: map1078, | ||
| 106 | - }, | ||
| 107 | - { | ||
| 108 | path: '/cloudRecord', | 102 | path: '/cloudRecord', |
| 109 | name: 'cloudRecord', | 103 | name: 'cloudRecord', |
| 110 | component: cloudRecord, | 104 | component: cloudRecord, |