Commit b95fe5fb79dd79622454f366ff0f63b30c36607e

Authored by liujun001
1 parent e1f3d030

添加配置 用于调度系统

src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java
@@ -49,10 +49,7 @@ import javax.servlet.http.HttpServletRequest; @@ -49,10 +49,7 @@ import javax.servlet.http.HttpServletRequest;
49 import javax.sip.InvalidArgumentException; 49 import javax.sip.InvalidArgumentException;
50 import javax.sip.SipException; 50 import javax.sip.SipException;
51 import java.text.ParseException; 51 import java.text.ParseException;
52 -import java.util.HashMap;  
53 -import java.util.List;  
54 -import java.util.Map;  
55 -import java.util.UUID; 52 +import java.util.*;
56 53
57 /** 54 /**
58 * @description:针对 ZLMediaServer的hook事件监听 55 * @description:针对 ZLMediaServer的hook事件监听
@@ -567,6 +564,8 @@ public class ZLMHttpHookListener { @@ -567,6 +564,8 @@ public class ZLMHttpHookListener {
567 String stream = param.getStream(); 564 String stream = param.getStream();
568 Object port = redisTemplate.opsForValue().get("tag:history:port:" + stream); 565 Object port = redisTemplate.opsForValue().get("tag:history:port:" + stream);
569 Object httpPort = redisTemplate.opsForValue().get("tag:history:httpPort:" + stream); 566 Object httpPort = redisTemplate.opsForValue().get("tag:history:httpPort:" + stream);
  567 + Object time = redisTemplate.opsForValue().get("tag:history:httpPort:time:" + stream);
  568 +
570 if (ObjectUtils.isEmpty(port)) { 569 if (ObjectUtils.isEmpty(port)) {
571 port = -1; 570 port = -1;
572 } 571 }
@@ -575,11 +574,14 @@ public class ZLMHttpHookListener { @@ -575,11 +574,14 @@ public class ZLMHttpHookListener {
575 httpPort = -1; 574 httpPort = -1;
576 } 575 }
577 576
578 - Map<String, Object> resl = jt1078OfCarController.sendIORequestStop(StringUtils.substringBefore(stream, "-"), StringUtils.substringAfter(stream, "-"), stream, (Integer) port, (Integer) httpPort);  
579 - if (!StringUtils.equals(String.valueOf(resl.get("code")), "1")) {  
580 - logger.info("停流失败,稍后再试:{},{},{}", stream, port, httpPort);  
581 - return ret; 577 + if (Objects.isNull(time) || Objects.equals(0L, time)) {
  578 + Map<String, Object> resl = jt1078OfCarController.sendIORequestStop(StringUtils.substringBefore(stream, "-"), StringUtils.substringAfter(stream, "-"), stream, (Integer) port, (Integer) httpPort);
  579 + if (!StringUtils.equals(String.valueOf(resl.get("code")), "1")) {
  580 + logger.info("停流失败,稍后再试:{},{},{}", stream, port, httpPort);
  581 + return ret;
  582 + }
582 } 583 }
  584 +
583 // 国标流, 点播/录像回放/录像下载 585 // 国标流, 点播/录像回放/录像下载
584 InviteInfo inviteInfo = inviteStreamService.getInviteInfoByStream(null, param.getStream()); 586 InviteInfo inviteInfo = inviteStreamService.getInviteInfoByStream(null, param.getStream());
585 // 点播 587 // 点播
src/main/java/com/genersoft/iot/vmp/vmanager/jt1078/platform/Jt1078OfCarController.java
@@ -5,6 +5,7 @@ import com.alibaba.fastjson2.JSONException; @@ -5,6 +5,7 @@ import com.alibaba.fastjson2.JSONException;
5 import com.genersoft.iot.vmp.conf.MediaConfig; 5 import com.genersoft.iot.vmp.conf.MediaConfig;
6 import com.genersoft.iot.vmp.conf.UserSetting; 6 import com.genersoft.iot.vmp.conf.UserSetting;
7 import com.genersoft.iot.vmp.conf.security.SecurityUtils; 7 import com.genersoft.iot.vmp.conf.security.SecurityUtils;
  8 +import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyItem;
8 import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem; 9 import com.genersoft.iot.vmp.media.zlm.dto.StreamPushItem;
9 import com.genersoft.iot.vmp.service.IStreamPushService; 10 import com.genersoft.iot.vmp.service.IStreamPushService;
10 import com.genersoft.iot.vmp.vmanager.bean.StreamContent; 11 import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
@@ -15,6 +16,7 @@ import com.genersoft.iot.vmp.vmanager.jt1078.platform.config.RtspConfigBean; @@ -15,6 +16,7 @@ import com.genersoft.iot.vmp.vmanager.jt1078.platform.config.RtspConfigBean;
15 import com.genersoft.iot.vmp.vmanager.jt1078.platform.config.TuohuaConfigBean; 16 import com.genersoft.iot.vmp.vmanager.jt1078.platform.config.TuohuaConfigBean;
16 import com.genersoft.iot.vmp.vmanager.jt1078.platform.handler.HttpClientUtil; 17 import com.genersoft.iot.vmp.vmanager.jt1078.platform.handler.HttpClientUtil;
17 18
  19 +import com.genersoft.iot.vmp.vmanager.streamProxy.StreamProxyController;
18 import com.genersoft.iot.vmp.vmanager.streamPush.StreamPushController; 20 import com.genersoft.iot.vmp.vmanager.streamPush.StreamPushController;
19 import com.sun.jna.platform.win32.Rasapi32Util; 21 import com.sun.jna.platform.win32.Rasapi32Util;
20 import com.xiaoleilu.hutool.crypto.SecureUtil; 22 import com.xiaoleilu.hutool.crypto.SecureUtil;
@@ -71,6 +73,8 @@ public class Jt1078OfCarController { @@ -71,6 +73,8 @@ public class Jt1078OfCarController {
71 private MediaConfig mediaConfig; 73 private MediaConfig mediaConfig;
72 @Autowired 74 @Autowired
73 private StreamPushController streamPushController; 75 private StreamPushController streamPushController;
  76 + @Autowired
  77 + private StreamProxyController streamProxyController;
74 78
75 @Autowired 79 @Autowired
76 private IStreamPushService streamPushService; 80 private IStreamPushService streamPushService;
@@ -189,17 +193,19 @@ public class Jt1078OfCarController { @@ -189,17 +193,19 @@ public class Jt1078OfCarController {
189 resultMap.put("httpPort", entity.getHttpPort()); 193 resultMap.put("httpPort", entity.getHttpPort());
190 resultMap.put("stream", stream); 194 resultMap.put("stream", stream);
191 195
192 - redisTemplate.opsForValue().set("tag:history:port:"+stream, entity.getPort(), 2, TimeUnit.DAYS);  
193 - redisTemplate.opsForValue().set("tag:history:httpPort:"+stream, entity.getHttpPort(), 2, TimeUnit.DAYS); 196 + redisTemplate.opsForValue().set("tag:history:port:" + stream, entity.getPort(), 2, TimeUnit.DAYS);
  197 + redisTemplate.opsForValue().set("tag:history:httpPort:" + stream, entity.getHttpPort(), 2, TimeUnit.DAYS);
  198 + redisTemplate.opsForValue().set("tag:history:httpPort:time:" + stream, new Date().getTime(), 1800, TimeUnit.SECONDS);
194 199
195 - msg = jt1078ConfigBean.formatMessageId(sim, channel, rtspConfigBean, entity.getPort() + 30000); 200 + msg = jt1078ConfigBean.formatMessageId(sim, channel, rtspConfigBean, entity.getPort());
196 201
197 entity = httpClientUtil.doPost(url, msg, null); 202 entity = httpClientUtil.doPost(url, msg, null);
198 - Map<String, Object> resultMap1 = chooseEntity(entity);  
199 - if (Objects.nonNull(resultMap1)) {  
200 - return resultMap1;  
201 - } 203 +// Map<String, Object> resultMap1 = chooseEntity(entity);
  204 +// if (Objects.nonNull(resultMap1)) {
  205 +// return resultMap1;
  206 +// }
202 log.info(entity.getResultStr()); 207 log.info(entity.getResultStr());
  208 + createStreamProxy(sim + "-" + channel);
203 209
204 streamContent = getStreamContent(stream); 210 streamContent = getStreamContent(stream);
205 } 211 }
@@ -241,6 +247,8 @@ public class Jt1078OfCarController { @@ -241,6 +247,8 @@ public class Jt1078OfCarController {
241 247
242 String url = jt1078ConfigBean.formatStopPushURL(stream, port, httpPort); 248 String url = jt1078ConfigBean.formatStopPushURL(stream, port, httpPort);
243 try { 249 try {
  250 + streamProxyController.del(stream,stream);
  251 +
244 httpClientUtil.doGet(url, null); 252 httpClientUtil.doGet(url, null);
245 253
246 url = StringUtils.replace(jt1078ConfigBean.getJt1078Url(), "{0}", jt1078ConfigBean.getStopSendPort()); 254 url = StringUtils.replace(jt1078ConfigBean.getJt1078Url(), "{0}", jt1078ConfigBean.getStopSendPort());
@@ -267,7 +275,6 @@ public class Jt1078OfCarController { @@ -267,7 +275,6 @@ public class Jt1078OfCarController {
267 resultMap.put("code", "1"); 275 resultMap.put("code", "1");
268 resultMap.put("message", "OK"); 276 resultMap.put("message", "OK");
269 277
270 -  
271 return resultMap; 278 return resultMap;
272 } catch (URISyntaxException | IOException e) { 279 } catch (URISyntaxException | IOException e) {
273 log.error("发送停止推流指令异常;[{}],[{}]", url, msg, e); 280 log.error("发送停止推流指令异常;[{}],[{}]", url, msg, e);
@@ -325,7 +332,7 @@ public class Jt1078OfCarController { @@ -325,7 +332,7 @@ public class Jt1078OfCarController {
325 return resultMap; 332 return resultMap;
326 } 333 }
327 334
328 - Map<String, Object> resultMap1 = chooseEntity(entity); 335 + Map<String, Object> resultMap1 = chooseEntity(entity,url);
329 if (Objects.nonNull(resultMap1)) { 336 if (Objects.nonNull(resultMap1)) {
330 return resultMap1; 337 return resultMap1;
331 } 338 }
@@ -402,7 +409,7 @@ public class Jt1078OfCarController { @@ -402,7 +409,7 @@ public class Jt1078OfCarController {
402 return resultMap; 409 return resultMap;
403 } 410 }
404 411
405 - Map<String, Object> resultMap1 = chooseEntity(entity); 412 + Map<String, Object> resultMap1 = chooseEntity(entity,url);
406 if (Objects.nonNull(resultMap1)) { 413 if (Objects.nonNull(resultMap1)) {
407 return resultMap1; 414 return resultMap1;
408 } 415 }
@@ -411,10 +418,11 @@ public class Jt1078OfCarController { @@ -411,10 +418,11 @@ public class Jt1078OfCarController {
411 resultMap.put("port", entity.getPort()); 418 resultMap.put("port", entity.getPort());
412 resultMap.put("httpPort", entity.getHttpPort()); 419 resultMap.put("httpPort", entity.getHttpPort());
413 420
414 - redisTemplate.opsForValue().set("tag:history:port:"+channelMapping, entity.getPort(), 2, TimeUnit.DAYS);  
415 - redisTemplate.opsForValue().set("tag:history:httpPort:"+channelMapping, entity.getHttpPort(), 2, TimeUnit.DAYS); 421 + redisTemplate.opsForValue().set("tag:history:port:" + channelMapping, entity.getPort(), 2, TimeUnit.DAYS);
  422 + redisTemplate.opsForValue().set("tag:history:httpPort:" + channelMapping, entity.getHttpPort(), 2, TimeUnit.DAYS);
  423 + redisTemplate.opsForValue().set("tag:history:httpPort:time:" + channelMapping, new Date().getTime(), 1800, TimeUnit.SECONDS);
416 424
417 - msg = jt1078ConfigBean.formatMessageHistoryPlayRTSP(sim, channel, startTime, endTime, rtspConfigBean, entity.getPort() + 30000); 425 + msg = jt1078ConfigBean.formatMessageHistoryPlayRTSP(sim, channel, startTime, endTime, rtspConfigBean, entity.getPort());
418 boolean flag = false; 426 boolean flag = false;
419 427
420 key = key + "-lock"; 428 key = key + "-lock";
@@ -439,7 +447,7 @@ public class Jt1078OfCarController { @@ -439,7 +447,7 @@ public class Jt1078OfCarController {
439 return resultMap; 447 return resultMap;
440 } 448 }
441 log.info(entity.getResultStr()); 449 log.info(entity.getResultStr());
442 - 450 + createStreamProxy(channelMapping);
443 451
444 resultMap.put("code", "1"); 452 resultMap.put("code", "1");
445 resultMap.put("message", "OK"); 453 resultMap.put("message", "OK");
@@ -635,23 +643,56 @@ public class Jt1078OfCarController { @@ -635,23 +643,56 @@ public class Jt1078OfCarController {
635 return httpClientPostEntity; 643 return httpClientPostEntity;
636 } 644 }
637 645
638 - private Map<String, Object> chooseEntity(HttpClientPostEntity entity) { 646 + private Map<String, Object> chooseEntity(HttpClientPostEntity entity,String url) {
639 Map<String, Object> result = new HashMap<>(); 647 Map<String, Object> result = new HashMap<>();
640 if (Objects.isNull(entity)) { 648 if (Objects.isNull(entity)) {
641 result.put("code", "301"); 649 result.put("code", "301");
642 result.put("msg", "下发指令异常"); 650 result.put("msg", "下发指令异常");
643 return result; 651 return result;
644 } 652 }
645 - Map<String,String> rsultMap = JSON.parseObject(entity.getResultStr(),HashMap.class);  
646 - if(Objects.equals(rsultMap.get("code"),"4000") || Objects.equals(rsultMap.get("code"),4000)){  
647 - result.put("code", "304");  
648 - result.put("msg", "离线的客户端(请检查设备是否注册或者鉴权");  
649 - return result; 653 + try {
  654 + Map<String, Object> rsultMap = JSON.parseObject(entity.getResultStr(), HashMap.class);
  655 + if (Objects.equals(rsultMap.get("code"), "4000") || Objects.equals(rsultMap.get("code"), 4000)) {
  656 + result.put("code", "304");
  657 + result.put("msg", "离线的客户端(请检查设备是否注册或者鉴权");
  658 + return result;
  659 + }
  660 +
  661 + if (Objects.nonNull(rsultMap.get("success")) && StringUtils.equalsAnyIgnoreCase(String.valueOf(rsultMap.get("success")), "true")) {
  662 + return null;
  663 + } else if (StringUtils.isNoneBlank(rsultMap.get("msg") + "")) {
  664 + result.put("code", "304");
  665 + result.put("msg", rsultMap.get("msg"));
  666 + return result;
  667 + }
  668 + }catch (Exception e){
  669 + log.error("entity.getResultStr():{{}}",entity.getResultStr(),e);
650 } 670 }
651 671
652 return null; 672 return null;
653 673
654 } 674 }
655 675
  676 + private void createStreamProxy(String stream) {
  677 + String url = StringUtils.replace(jt1078ConfigBean.getGetURL(), "{stream}", stream);
  678 + StreamProxyItem item = new StreamProxyItem();
  679 + item.setApp("schedule");
  680 + item.setEnable(true);
  681 + item.setEnableAudio(true);
  682 + item.setRtpType("default");
  683 + item.setStream(stream);
  684 + item.setMediaServerId(mediaConfig.getId());
  685 + item.setUrl(url);
  686 + item.setFfmpegCmdKey("ffmpeg.cmd");
  687 + item.setEnable(true);
  688 + item.setEnableAudio(true);
  689 + item.setEnableMp4(false);
  690 + item.setEnableRemoveNoneReader(false);
  691 + item.setEnableDisableNoneReader(false);
  692 +
  693 + streamProxyController.save(item);
  694 +
  695 + }
  696 +
656 697
657 } 698 }
src/main/java/com/genersoft/iot/vmp/vmanager/jt1078/platform/config/Jt1078ConfigBean.java
@@ -33,6 +33,8 @@ public class Jt1078ConfigBean { @@ -33,6 +33,8 @@ public class Jt1078ConfigBean {
33 33
34 private Integer start1078Port; 34 private Integer start1078Port;
35 private Integer end1078Port; 35 private Integer end1078Port;
  36 + @Value("${tuohua.bsth.jt1078.get.url}")
  37 + private String getURL;
36 38
37 39
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\"}"; 40 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\"}";
@@ -124,4 +126,8 @@ public class Jt1078ConfigBean { @@ -124,4 +126,8 @@ public class Jt1078ConfigBean {
124 public String getStopPUshURL() { 126 public String getStopPUshURL() {
125 return stopPUshURL; 127 return stopPUshURL;
126 } 128 }
  129 +
  130 + public String getGetURL() {
  131 + return getURL;
  132 + }
127 } 133 }
src/main/java/com/genersoft/iot/vmp/vmanager/jt1078/platform/config/TuohuaConfigBean.java
@@ -84,7 +84,7 @@ public class TuohuaConfigBean { @@ -84,7 +84,7 @@ public class TuohuaConfigBean {
84 84
85 85
86 private final String LINE_URL = "/line/company/{companyId}?timestamp={timestamp}&nonce={nonce}&password={password}&sign={sign}"; 86 private final String LINE_URL = "/line/company/{companyId}?timestamp={timestamp}&nonce={nonce}&password={password}&sign={sign}";
87 -//private final String LINE_URL = "/line/all?timestamp={timestamp}&nonce={nonce}&password={password}&sign={sign}"; 87 + //private final String LINE_URL = "/line/all?timestamp={timestamp}&nonce={nonce}&password={password}&sign={sign}";
88 private final String CAR_URL = "/car/company/{companyId}?timestamp={timestamp}&nonce={nonce}&password={password}&sign={sign}"; 88 private final String CAR_URL = "/car/company/{companyId}?timestamp={timestamp}&nonce={nonce}&password={password}&sign={sign}";
89 89
90 public String requestLine(HttpClientUtil httpClientUtil, String companyId) throws Exception { 90 public String requestLine(HttpClientUtil httpClientUtil, String companyId) throws Exception {
@@ -142,7 +142,7 @@ public class TuohuaConfigBean { @@ -142,7 +142,7 @@ public class TuohuaConfigBean {
142 String code = convertStr(hashMap.get("lineCode")); 142 String code = convertStr(hashMap.get("lineCode"));
143 HashMap<String, Object> map = combationTree(code, convertStr(hashMap.get("line")), code, false, convertStr(hashMap.get("name")), code, false, 143 HashMap<String, Object> map = combationTree(code, convertStr(hashMap.get("line")), code, false, convertStr(hashMap.get("name")), code, false,
144 "<span><img src='/metronic_v4.5.4/layui/icon/line.png' class ='imageIcon' /></span><span>" + convertStr(hashMap.get("name")) + "</span>", 144 "<span><img src='/metronic_v4.5.4/layui/icon/line.png' class ='imageIcon' /></span><span>" + convertStr(hashMap.get("name")) + "</span>",
145 - "<span><img src='/metronic_v4.5.4/layui/icon/line.png' class ='imageIcon' /></span><span>" + convertStr(hashMap.get("name")) + "</span>",201); 145 + "<span><img src='/metronic_v4.5.4/layui/icon/line.png' class ='imageIcon' /></span><span>" + convertStr(hashMap.get("name")) + "</span>", 201);
146 if (carsSize > 0) { 146 if (carsSize > 0) {
147 List<HashMap> carList = carJsonListFinal.stream().filter(c -> Objects.nonNull(c.get("lineCode")) && StringUtils.equals(convertStr(c.get("lineCode")), code)).map(ch -> { 147 List<HashMap> carList = carJsonListFinal.stream().filter(c -> Objects.nonNull(c.get("lineCode")) && StringUtils.equals(convertStr(c.get("lineCode")), code)).map(ch -> {
148 ch.put("used", "1"); 148 ch.put("used", "1");
@@ -196,7 +196,7 @@ public class TuohuaConfigBean { @@ -196,7 +196,7 @@ public class TuohuaConfigBean {
196 } 196 }
197 197
198 public HashMap<String, Object> combationTree(String code, String icon, String id, boolean initChild, String name, String sourceId, 198 public HashMap<String, Object> combationTree(String code, String icon, String id, boolean initChild, String name, String sourceId,
199 - boolean spread, String text, String title,Integer type) { 199 + boolean spread, String text, String title, Integer type) {
200 HashMap<String, Object> result = new HashMap<>(); 200 HashMap<String, Object> result = new HashMap<>();
201 result.put("code", code); 201 result.put("code", code);
202 result.put("icon", icon); 202 result.put("icon", icon);
@@ -207,16 +207,16 @@ public class TuohuaConfigBean { @@ -207,16 +207,16 @@ public class TuohuaConfigBean {
207 result.put("spread", spread); 207 result.put("spread", spread);
208 result.put("text", text); 208 result.put("text", text);
209 result.put("title", title); 209 result.put("title", title);
210 - result.put("type",type); 210 + result.put("type", type);
211 return result; 211 return result;
212 } 212 }
213 213
214 private HashMap<String, Object> combatioinCarTree(HashMap ch) { 214 private HashMap<String, Object> combatioinCarTree(HashMap ch) {
215 String code = convertStr(ch.get("nbbm")); 215 String code = convertStr(ch.get("nbbm"));
216 HashMap<String, Object> hashMap = combationTree(code, "bus1", code, false, code, code, false, "<span><img src='/metronic_v4.5.4/layui/icon/bus1.png' class ='imageIcon' /></span><span>" + code + "</span>", 216 HashMap<String, Object> hashMap = combationTree(code, "bus1", code, false, code, code, false, "<span><img src='/metronic_v4.5.4/layui/icon/bus1.png' class ='imageIcon' /></span><span>" + code + "</span>",
217 - "<span><img src='/metronic_v4.5.4/layui/icon/bus1.png' class ='imageIcon' /></span><span>" + code + "</span>",301);  
218 - hashMap.put("sim",convertStr(ch.get("sim")));  
219 -// hashMap.put("sim","122223333444"); 217 + "<span><img src='/metronic_v4.5.4/layui/icon/bus1.png' class ='imageIcon' /></span><span>" + code + "</span>", 301);
  218 + hashMap.put("sim", formatSim(convertStr(ch.get("sim"))));
  219 +// hashMap.put("sim","013800138999");
220 return hashMap; 220 return hashMap;
221 } 221 }
222 222
@@ -243,5 +243,33 @@ public class TuohuaConfigBean { @@ -243,5 +243,33 @@ public class TuohuaConfigBean {
243 return Objects.isNull(object) ? "" : object.toString(); 243 return Objects.isNull(object) ? "" : object.toString();
244 } 244 }
245 245
  246 + private String formatSim(String sim) {
  247 + if (StringUtils.isBlank(sim)) {
  248 + return sim;
  249 + }
  250 +
  251 + char[] chars = sim.toCharArray();
  252 + int length = chars.length;
  253 + StringBuilder builder = new StringBuilder();
  254 + boolean flag = true;
  255 + for (int i = 0; i < length; i++) {
  256 + char val = chars[i];
  257 + if (flag && val == '0') {
  258 + continue;
  259 + }
  260 + flag = false;
  261 + builder.append(chars[i]);
  262 + }
  263 + return builder.toString();
  264 + }
  265 +
  266 + public static void main(String[] args) {
  267 +
  268 + TuohuaConfigBean bean = new TuohuaConfigBean();
  269 + String str = "0000156012345000";
  270 +
  271 + System.out.println(bean.formatSim(str));
  272 + }
  273 +
246 274
247 } 275 }
src/main/java/com/genersoft/iot/vmp/vmanager/jt1078/platform/handler/HttpClientUtil.java
1 package com.genersoft.iot.vmp.vmanager.jt1078.platform.handler; 1 package com.genersoft.iot.vmp.vmanager.jt1078.platform.handler;
2 2
  3 +import com.alibaba.fastjson2.JSON;
3 import com.genersoft.iot.vmp.vmanager.jt1078.platform.ben.HttpClientPostEntity; 4 import com.genersoft.iot.vmp.vmanager.jt1078.platform.ben.HttpClientPostEntity;
4 import org.apache.commons.collections4.CollectionUtils; 5 import org.apache.commons.collections4.CollectionUtils;
5 import org.apache.http.HttpEntity; 6 import org.apache.http.HttpEntity;
@@ -61,7 +62,7 @@ public class HttpClientUtil { @@ -61,7 +62,7 @@ public class HttpClientUtil {
61 response = httpclient.execute(httpPost); 62 response = httpclient.execute(httpPost);
62 // 判断返回状态是否为200 63 // 判断返回状态是否为200
63 if (response.getStatusLine().getStatusCode() == 200) { 64 if (response.getStatusLine().getStatusCode() == 200) {
64 - return combationReturnObj(response, httpclient); 65 + return combationReturnObj(response, httpclient,url, null);
65 } 66 }
66 } finally { 67 } finally {
67 if (response != null) { 68 if (response != null) {
@@ -96,7 +97,7 @@ public class HttpClientUtil { @@ -96,7 +97,7 @@ public class HttpClientUtil {
96 response = httpclient.execute(httpPost); 97 response = httpclient.execute(httpPost);
97 // 判断返回状态是否为200 98 // 判断返回状态是否为200
98 if (response.getStatusLine().getStatusCode() == 200) { 99 if (response.getStatusLine().getStatusCode() == 200) {
99 - return combationReturnObj(response, httpclient); 100 + return combationReturnObj(response, httpclient,url,requestBody);
100 } 101 }
101 } catch (Exception e) { 102 } catch (Exception e) {
102 log.error("请求数据异常", e); 103 log.error("请求数据异常", e);
@@ -148,7 +149,7 @@ public class HttpClientUtil { @@ -148,7 +149,7 @@ public class HttpClientUtil {
148 response = httpclient.execute(httpGet); 149 response = httpclient.execute(httpGet);
149 // 判断返回状态是否为200 150 // 判断返回状态是否为200
150 if (response.getStatusLine().getStatusCode() == 200) { 151 if (response.getStatusLine().getStatusCode() == 200) {
151 - return combationReturnObj(response, httpclient); 152 + return combationReturnObj(response, httpclient,url,null);
152 } 153 }
153 } finally { 154 } finally {
154 if (response != null) { 155 if (response != null) {
@@ -161,7 +162,7 @@ public class HttpClientUtil { @@ -161,7 +162,7 @@ public class HttpClientUtil {
161 162
162 163
163 @NotNull 164 @NotNull
164 - private static HttpClientPostEntity combationReturnObj(CloseableHttpResponse response, DefaultHttpClient httpclient) throws IOException { 165 + private static HttpClientPostEntity combationReturnObj(CloseableHttpResponse response, DefaultHttpClient httpclient,String url,String requestBody) throws IOException {
165 HttpEntity httpEntity = response.getEntity(); 166 HttpEntity httpEntity = response.getEntity();
166 167
167 CookieStore cookieStore = httpclient.getCookieStore(); 168 CookieStore cookieStore = httpclient.getCookieStore();
@@ -170,7 +171,7 @@ public class HttpClientUtil { @@ -170,7 +171,7 @@ public class HttpClientUtil {
170 HttpClientPostEntity postEntity = new HttpClientPostEntity(); 171 HttpClientPostEntity postEntity = new HttpClientPostEntity();
171 postEntity.setCookieStore(cookieStore); 172 postEntity.setCookieStore(cookieStore);
172 postEntity.setResultStr(result); 173 postEntity.setResultStr(result);
173 - log.info("response data:{}",result); 174 + log.info("url:{};requestBody:{};response data:{}",url,requestBody,result);
174 return postEntity; 175 return postEntity;
175 } 176 }
176 } 177 }
src/main/resources/application-local.yml
@@ -92,7 +92,7 @@ media: @@ -92,7 +92,7 @@ media:
92 # [可选] zlm服务器的http.sslport, 置空使用zlm配置文件配置 92 # [可选] zlm服务器的http.sslport, 置空使用zlm配置文件配置
93 http-ssl-port: 443 93 http-ssl-port: 443
94 # [可选] zlm服务器的hook.admin_params=secret 94 # [可选] zlm服务器的hook.admin_params=secret
95 - secret: RPorcBlIw26uHGnEHYGesIYyFDXpgjkP 95 + secret: RPorcBlIw26uHGnEHYGesIYyFDXpgjkP1
96 # 启用多端口模式, 多端口模式使用端口区分每路流,兼容性更好。 单端口使用流的ssrc区分, 点播超时建议使用多端口测试 96 # 启用多端口模式, 多端口模式使用端口区分每路流,兼容性更好。 单端口使用流的ssrc区分, 点播超时建议使用多端口测试
97 rtp: 97 rtp:
98 # [可选] 是否启用多端口模式, 开启后会在portRange范围内选择端口用于媒体流传输 98 # [可选] 是否启用多端口模式, 开启后会在portRange范围内选择端口用于媒体流传输
@@ -159,6 +159,8 @@ tuohua: @@ -159,6 +159,8 @@ tuohua:
159 playHistoryPort: 9201 159 playHistoryPort: 9201
160 sendPort: 9101 160 sendPort: 9101
161 stopSendPort: 9102 161 stopSendPort: 9102
  162 + get:
  163 + url: http://192.169.1.92:3333/video/{stream}.flv
162 playURL: /play/wasm/ws%3A%2F%2F{ip}%3A{port}%2Fschedule%2F{sim}-{channel}.live.flv%3FcallId%{publickey} 164 playURL: /play/wasm/ws%3A%2F%2F{ip}%3A{port}%2Fschedule%2F{sim}-{channel}.live.flv%3FcallId%{publickey}
163 165
164 166
src/main/resources/application-localDev.yml
@@ -157,6 +157,8 @@ tuohua: @@ -157,6 +157,8 @@ tuohua:
157 playHistoryPort: 9201 157 playHistoryPort: 9201
158 sendPort: 9101 158 sendPort: 9101
159 stopSendPort: 9102 159 stopSendPort: 9102
  160 + get:
  161 + url: http://192.169.1.92:3333/video/{stream}.flv
160 playURL: /play/wasm/ws%3A%2F%2F{ip}%3A{port}%2Fschedule%2F{sim}-{channel}.live.flv%3FcallId%{publickey} 162 playURL: /play/wasm/ws%3A%2F%2F{ip}%3A{port}%2Fschedule%2F{sim}-{channel}.live.flv%3FcallId%{publickey}
161 163
162 164
src/main/resources/application.yml
@@ -2,6 +2,6 @@ spring: @@ -2,6 +2,6 @@ spring:
2 application: 2 application:
3 name: wvp 3 name: wvp
4 profiles: 4 profiles:
5 - active: localDev 5 + active: local
6 server: 6 server:
7 port: 18080 7 port: 18080
8 \ No newline at end of file 8 \ No newline at end of file