处理问题

This commit is contained in:
wanggeng 2022-08-23 12:02:47 +08:00
parent dd7fe484db
commit ab63d88141
2 changed files with 84 additions and 51 deletions

View File

@ -6,6 +6,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import ink.wgink.common.manager.env.EnvManager;
import ink.wgink.login.base.manager.ConfigManager;
import org.apache.commons.lang3.StringUtils;
import javax.net.ssl.*;
import java.io.*;
@ -34,7 +35,9 @@ import java.util.Map.Entry;
*/
public class SMCHttpUtil {
/** 请求超时时间 */
/**
* 请求超时时间
*/
private static Integer TIMEOUT = 3000;
private static final String CHECK_MEETING_URL = "huaweiSmcCheckMeetingUrl";
private static final String CHECK_MEETING_NAME_URL = "huaweiSmcCheckMeetingNameUrl";
@ -50,6 +53,9 @@ public class SMCHttpUtil {
HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier() {
@Override
public boolean verify(String urlHostName, SSLSession session) {
if (StringUtils.isBlank(urlHostName)) {
return false;
}
return true;
}
});
@ -60,7 +66,7 @@ public class SMCHttpUtil {
private static void trustAllHttpsCertificates() throws NoSuchAlgorithmException, KeyManagementException {
TrustManager[] trustAllCerts = new TrustManager[1];
trustAllCerts[0] = new TrustAllManager();
SSLContext sc = SSLContext.getInstance("SSL");
SSLContext sc = SSLContext.getInstance("TLSv1.2");
sc.init(null, trustAllCerts, null);
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
}
@ -71,14 +77,21 @@ public class SMCHttpUtil {
}
public void checkServerTrusted(X509Certificate[] certs, String authType) throws CertificateException {
if (certs == null && StringUtils.isBlank(authType)) {
throw new CertificateException("异常");
}
}
public void checkClientTrusted(X509Certificate[] certs, String authType) throws CertificateException {
if (certs == null && StringUtils.isBlank(authType)) {
throw new CertificateException("异常");
}
}
}
/**
* 删除会议室
*
* @param meetingId 会议室ID
* @return
* @throws Exception
@ -97,6 +110,7 @@ public class SMCHttpUtil {
/**
* 创建会议室
*
* @param name 名称 ( : 集宁区-张三丰)
* @param username 账号
* @return
@ -146,6 +160,7 @@ public class SMCHttpUtil {
/**
* 获取随机的会议终端号码
*
* @return
*/
private String getMeetingNumber() throws Exception {
@ -162,6 +177,7 @@ public class SMCHttpUtil {
/**
* 验证会议室是否已经存在
*
* @return
*/
public Boolean checkMeetingExists(String username) throws Exception {
@ -175,6 +191,7 @@ public class SMCHttpUtil {
/**
* 验证会议室是否已经存在
*
* @return
*/
public Boolean checkMeetingNameExists(String name) throws Exception {
@ -213,12 +230,13 @@ public class SMCHttpUtil {
/**
* jsonPost请求
* @Description: TODO
*
* @param @param postUrl
* @param @param json
* @param @return
* @return String
* @throws
* @Description: TODO
* @author 崔宝铖
* @date 2019年6月19日
*/
@ -260,8 +278,12 @@ public class SMCHttpUtil {
e.printStackTrace();
} finally {
try {
if (out != null) { out.close();}
if (br != null) {br.close();}
if (out != null) {
out.close();
}
if (br != null) {
br.close();
}
} catch (Exception ex) {
ex.printStackTrace();
}
@ -275,13 +297,14 @@ public class SMCHttpUtil {
/**
* Post请求
* @Description: TODO
*
* @param @param postUrl
* @param @param param
* @param @return
* @return String
* @throws IOException
* @throws
* @Description: TODO
* @author 崔宝铖
* @date 2019年6月19日
*/
@ -343,8 +366,12 @@ public class SMCHttpUtil {
e.printStackTrace();
} finally {
try {
if (out != null) { out.close();}
if (in != null) {in.close();}
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
} catch (Exception ex) {
ex.printStackTrace();
}
@ -358,13 +385,14 @@ public class SMCHttpUtil {
/**
* Get请求
* @Description: TODO
*
* @param @param getUrl 请求地址
* @param @param param 请求参数
* @param @return
* @param @throws Exception
* @return RetBody<PageData>
* @throws
* @Description: TODO
* @author 崔宝铖
* @date 2019年6月19日
*/
@ -374,6 +402,7 @@ public class SMCHttpUtil {
/**
* 初始化Token
*
* @param getUrl
* @param param
* @param property
@ -431,8 +460,12 @@ public class SMCHttpUtil {
e.printStackTrace();
} finally {
try {
if (out != null) { out.close();}
if (in != null) {in.close();}
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
} catch (Exception ex) {
ex.printStackTrace();
}

View File

@ -156,7 +156,7 @@ logging:
file:
name: /project/logs/usercenter-logs.log
level:
root: error
root: debug
org.springframework.data.mongodb: debug
org.springframework.boot.autoconfigure.security.servlet: debug
ink.wgink: debug