145 lines
4.0 KiB
Plaintext
145 lines
4.0 KiB
Plaintext
package com.securityControl.system.utils;
|
|
|
|
import com.securityControl.common.core.utils.aes.StringHelper;
|
|
import com.securityControl.common.redis.service.RedisService;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import javax.annotation.Resource;
|
|
import java.util.HashMap;
|
|
import java.util.Map;
|
|
|
|
@Component
|
|
public class SysVideoConfigUtil {
|
|
/**
|
|
* 登录平台地址
|
|
*/
|
|
public static String IPADDRESS;
|
|
/**
|
|
* 平台端口
|
|
*/
|
|
public static String PORT;
|
|
/**
|
|
* 账号
|
|
*/
|
|
public static String USER;
|
|
/**
|
|
* 账号
|
|
*/
|
|
public static String PASSWORD;
|
|
/**
|
|
* 请求地址
|
|
*/
|
|
public static String Q2HTTPURL;
|
|
|
|
public static String EPID ;// 登录平台企业ID
|
|
|
|
public static int BFIX ;// 登录平台是否通过网闸模式
|
|
|
|
@Resource
|
|
private RedisService redisService;
|
|
|
|
@Value("${video.ip}")
|
|
public void setIPADDRESS(String IPADDRESS) {
|
|
SysVideoConfigUtil.IPADDRESS = IPADDRESS;
|
|
|
|
}
|
|
@Value("${video.port}")
|
|
public void setPORT(String PORT) {
|
|
SysVideoConfigUtil.PORT = PORT;
|
|
}
|
|
|
|
@Value("${video.name}")
|
|
public void setUSER(String USER) {
|
|
SysVideoConfigUtil.USER = USER;
|
|
|
|
|
|
}
|
|
|
|
@Value("${video.key}")
|
|
public void setPASSWORD(String PASSWORD) {
|
|
SysVideoConfigUtil.PASSWORD = PASSWORD;
|
|
|
|
}
|
|
|
|
@Value("${video.url}")
|
|
public void setQ2HTTPURL(String q2HTTPURL) {
|
|
SysVideoConfigUtil.Q2HTTPURL = q2HTTPURL;
|
|
}
|
|
|
|
@Value("${video.epid}")
|
|
public void setEPID(String EPID) {
|
|
SysVideoConfigUtil.EPID = EPID;
|
|
}
|
|
@Value("${video.bfix}")
|
|
public void setBFIX(int BFIX) {
|
|
SysVideoConfigUtil.BFIX = BFIX;
|
|
}
|
|
|
|
|
|
public Map<String, Object> getMaps(){
|
|
Map<String, Object> params = new HashMap<>(16);
|
|
Map<String, Object> map = new HashMap<>(16);
|
|
String ip= redisService.get("video","ip");
|
|
String port= redisService.get("video","port");
|
|
String user=redisService.get("video","user");
|
|
String key=redisService.get("video","pwd");
|
|
String bfix=redisService.get("video","bfix");
|
|
String epid=redisService.get("video","epid");
|
|
if(StringHelper.isEmpty(ip)){
|
|
map.put("address", SysVideoConfigUtil.IPADDRESS);
|
|
}else{
|
|
map.put("address",ip);
|
|
}
|
|
|
|
if(StringHelper.isEmpty(port)){
|
|
map.put("port", SysVideoConfigUtil.PORT);
|
|
}else{
|
|
map.put("port",port);
|
|
}
|
|
|
|
if(StringHelper.isEmpty(user)){
|
|
map.put("user", SysVideoConfigUtil.USER);
|
|
}else{
|
|
map.put("user",user);
|
|
}
|
|
|
|
if(StringHelper.isEmpty(key)){
|
|
map.put("password", SysVideoConfigUtil.PASSWORD);
|
|
}else{
|
|
map.put("password",key);
|
|
}
|
|
|
|
if(StringHelper.isEmpty(epid)){
|
|
map.put("epid", SysVideoConfigUtil.EPID);
|
|
}else{
|
|
map.put("epid",epid);
|
|
}
|
|
if(StringHelper.isEmpty(bfix)){
|
|
map.put("fixaddr", SysVideoConfigUtil.BFIX);
|
|
}else{
|
|
map.put("fixaddr",Integer.parseInt(bfix));
|
|
}
|
|
String rucan="address="+map.get("address").toString()+"&port="+map.get("port").toString()+
|
|
"&user="+map.get("user").toString()+"&epid="+map.get("epid").toString()+
|
|
"&password="+map.get("password").toString()+"&fixaddr="+map.get("fixaddr").toString();
|
|
String data= SystemAesEncryptUtils.encrypt(rucan, SystemAesEncryptUtils.VIDEO_KEY);
|
|
params.put("params",data);
|
|
return params;
|
|
}
|
|
|
|
/**
|
|
* 获取url
|
|
* @return
|
|
*/
|
|
public String getUrl(){
|
|
String url=redisService.get("video","url");
|
|
if(StringHelper.isEmpty(url)){
|
|
return SysVideoConfigUtil.Q2HTTPURL;
|
|
}
|
|
return url;
|
|
}
|
|
|
|
|
|
}
|