替换wss
This commit is contained in:
parent
32913ad718
commit
8c228f1495
@ -14,6 +14,7 @@ import com.zhgd.jeecg.common.execption.OpenAlertException;
|
|||||||
import com.zhgd.jeecg.common.util.JSONUtil;
|
import com.zhgd.jeecg.common.util.JSONUtil;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
@ -25,6 +26,18 @@ import java.util.*;
|
|||||||
**/
|
**/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
public class HikVideoUtil {
|
public class HikVideoUtil {
|
||||||
|
private static String replaceWssFrom;
|
||||||
|
private static String replaceWssTo;
|
||||||
|
|
||||||
|
@Value("${replaceWssFrom:wss://hrdl.zhgdyun.com}")
|
||||||
|
public void setReplaceWssFrom(String replaceWssFrom) {
|
||||||
|
HikVideoUtil.replaceWssFrom = replaceWssFrom;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Value("${replaceWssTo:wss://sp.szjxj.com}")
|
||||||
|
public void setReplaceWssTo(String replaceWssTo) {
|
||||||
|
HikVideoUtil.replaceWssTo = replaceWssTo;
|
||||||
|
}
|
||||||
|
|
||||||
private static final String ARTEMIS_PATH = "/artemis";
|
private static final String ARTEMIS_PATH = "/artemis";
|
||||||
|
|
||||||
@ -81,6 +94,10 @@ public class HikVideoUtil {
|
|||||||
if ("0".equals((String) json.get("code"))) {
|
if ("0".equals((String) json.get("code"))) {
|
||||||
JSONObject object2 = (JSONObject) json.get("data");
|
JSONObject object2 = (JSONObject) json.get("data");
|
||||||
url = (String) object2.get("url");
|
url = (String) object2.get("url");
|
||||||
|
//替换wss域名
|
||||||
|
if (url.startsWith(HikVideoUtil.replaceWssFrom)) {
|
||||||
|
url = StrUtil.replace(url, HikVideoUtil.replaceWssFrom, HikVideoUtil.replaceWssTo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new OpenAlertException(MessageUtil.get("failErr"));
|
throw new OpenAlertException(MessageUtil.get("failErr"));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user