去除冗余代码,修正编译报警项

This commit is contained in:
lawrencehj
2021-02-05 15:15:39 +08:00
parent 6868577e32
commit a8603075d4
42 changed files with 114 additions and 217 deletions

View File

@@ -1,34 +1,28 @@
package com.genersoft.iot.vmp.media.zlm;
import com.alibaba.fastjson.JSONObject;
import com.genersoft.iot.vmp.conf.MediaServerConfig;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
// import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
// import org.slf4j.Logger;
// import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpRequest;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.client.HttpClientErrorException;
import org.springframework.web.client.RestTemplate;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Enumeration;
@RestController
@RequestMapping("/zlm")
public class ZLMHTTPProxyController {
private final static Logger logger = LoggerFactory.getLogger(ZLMHTTPProxyController.class);
// private final static Logger logger = LoggerFactory.getLogger(ZLMHTTPProxyController.class);
@Autowired
private IVideoManagerStorager storager;
// @Autowired
// private IVideoManagerStorager storager;
@Autowired
private IRedisCatchStorage redisCatchStorage;

View File

@@ -1,19 +1,13 @@
package com.genersoft.iot.vmp.media.zlm;
import java.math.BigInteger;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.conf.MediaServerConfig;
import com.genersoft.iot.vmp.gb28181.bean.Device;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
import com.genersoft.iot.vmp.utils.IpUtil;
import com.genersoft.iot.vmp.vmanager.service.IPlayService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -57,8 +51,8 @@ public class ZLMHttpHookListener {
@Autowired
private IRedisCatchStorage redisCatchStorage;
@Autowired
private ZLMRESTfulUtils zlmresTfulUtils;
// @Autowired
// private ZLMRESTfulUtils zlmresTfulUtils;
@Autowired
private ZLMHttpHookSubscribe subscribe;
@@ -86,9 +80,6 @@ public class ZLMHttpHookListener {
if (logger.isDebugEnabled()) {
logger.debug("ZLM HOOK on_flow_report API调用参数" + json.toString());
}
// TODO Auto-generated method stub
JSONObject ret = new JSONObject();
ret.put("code", 0);
ret.put("msg", "success");
@@ -106,8 +97,6 @@ public class ZLMHttpHookListener {
if (logger.isDebugEnabled()) {
logger.debug("ZLM HOOK on_http_access API 调用,参数:" + json.toString());
}
// TODO Auto-generated method stub
JSONObject ret = new JSONObject();
ret.put("code", 0);
ret.put("err", "");
@@ -127,8 +116,6 @@ public class ZLMHttpHookListener {
if (logger.isDebugEnabled()) {
logger.debug("ZLM HOOK on_play API调用参数" + json.toString());
}
// TODO Auto-generated method stub
JSONObject ret = new JSONObject();
ret.put("code", 0);
ret.put("msg", "success");
@@ -146,15 +133,12 @@ public class ZLMHttpHookListener {
if (logger.isDebugEnabled()) {
logger.debug("ZLM HOOK on_publish API调用参数" + json.toString());
}
String app = json.getString("app");
String streamId = json.getString("id");
// String app = json.getString("app");
// String streamId = json.getString("id");
ZLMHttpHookSubscribe.Event subscribe = this.subscribe.getSubscribe(ZLMHttpHookSubscribe.HookType.on_publish, json);
if (subscribe != null) subscribe.response(json);
// TODO Auto-generated method stub
JSONObject ret = new JSONObject();
ret.put("code", 0);
ret.put("msg", "success");
@@ -175,8 +159,6 @@ public class ZLMHttpHookListener {
if (logger.isDebugEnabled()) {
logger.debug("ZLM HOOK on_record_mp4 API调用参数" + json.toString());
}
// TODO Auto-generated method stub
JSONObject ret = new JSONObject();
ret.put("code", 0);
ret.put("msg", "success");
@@ -194,8 +176,6 @@ public class ZLMHttpHookListener {
if (logger.isDebugEnabled()) {
logger.debug("ZLM HOOK on_rtsp_realm API调用参数" + json.toString());
}
// TODO Auto-generated method stub
JSONObject ret = new JSONObject();
ret.put("code", 0);
ret.put("realm", "");
@@ -214,8 +194,6 @@ public class ZLMHttpHookListener {
if (logger.isDebugEnabled()) {
logger.debug("ZLM HOOK on_rtsp_auth API调用参数" + json.toString());
}
// TODO Auto-generated method stub
JSONObject ret = new JSONObject();
ret.put("code", 0);
ret.put("encrypted", false);
@@ -234,8 +212,6 @@ public class ZLMHttpHookListener {
if (logger.isDebugEnabled()) {
logger.debug("ZLM HOOK on_shell_login API调用参数" + json.toString());
}
// TODO Auto-generated method stub
JSONObject ret = new JSONObject();
ret.put("code", 0);
ret.put("msg", "success");
@@ -267,8 +243,6 @@ public class ZLMHttpHookListener {
redisCatchStorage.stopPlayback(streamInfo);
}
}
JSONObject ret = new JSONObject();
ret.put("code", 0);
ret.put("msg", "success");
@@ -316,8 +290,6 @@ public class ZLMHttpHookListener {
if (logger.isDebugEnabled()) {
logger.debug("ZLM HOOK on_stream_not_found API调用参数" + json.toString());
}
// TODO Auto-generated method stub
if (autoApplyPlay) {
String app = json.getString("app");
String streamId = json.getString("stream");
@@ -367,8 +339,6 @@ public class ZLMHttpHookListener {
mediaServerConfig.setWanIp(StringUtils.isEmpty(mediaWanIp)? mediaIp: mediaWanIp);
mediaServerConfig.setLocalIP(mediaIp);
redisCatchStorage.updateMediaInfo(mediaServerConfig);
// TODO Auto-generated method stub
JSONObject ret = new JSONObject();
ret.put("code", 0);
ret.put("msg", "success");

View File

@@ -1,24 +1,8 @@
package com.genersoft.iot.vmp.media.zlm;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.genersoft.iot.vmp.common.StreamInfo;
import com.genersoft.iot.vmp.conf.MediaServerConfig;
import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander;
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.util.ConcurrentReferenceHashMap;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.math.BigInteger;
import java.text.DecimalFormat;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -31,8 +15,6 @@ import java.util.concurrent.ConcurrentHashMap;
@Component
public class ZLMHttpHookSubscribe {
private final static Logger logger = LoggerFactory.getLogger(ZLMHttpHookSubscribe.class);
public enum HookType{
on_flow_report,
on_http_access,
@@ -72,8 +54,6 @@ public class ZLMHttpHookSubscribe {
for (JSONObject key : eventMap.keySet()) {
Boolean result = null;
for (String s : key.keySet()) {
String string = hookResponse.getString(s);
String string1 = key.getString(s);
if (result == null) {
result = key.getString(s).equals(hookResponse.getString(s));
}else {

View File

@@ -11,7 +11,6 @@ import org.springframework.stereotype.Component;
import java.io.IOException;
import java.net.ConnectException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
@Component

View File

@@ -5,8 +5,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.genersoft.iot.vmp.conf.MediaServerConfig;
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
import okhttp3.*;
//import com.genersoft.iot.vmp.storager.IVideoManagerStorager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -16,9 +15,6 @@ import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
import org.springframework.util.StringUtils;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
@@ -28,8 +24,8 @@ public class ZLMRunner implements CommandLineRunner {
private final static Logger logger = LoggerFactory.getLogger(ZLMRunner.class);
@Autowired
private IVideoManagerStorager storager;
// @Autowired
// private IVideoManagerStorager storager;
@Autowired
private IRedisCatchStorage redisCatchStorage;