版本更新

This commit is contained in:
Zhang.WH
2025-10-16 17:17:24 +08:00
parent d23a594a4b
commit f515bb8fbb
600 changed files with 7881 additions and 35954 deletions

View File

@@ -1,23 +1,13 @@
package com.openhis.crosssystem.utils;
import java.io.IOException;
import java.security.KeyManagementException;
import java.security.NoSuchAlgorithmException;
import java.security.SecureRandom;
import java.security.cert.X509Certificate;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.Collectors;
import javax.net.ssl.SSLContext;
import javax.net.ssl.TrustManager;
import javax.net.ssl.X509TrustManager;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.CloseableHttpClient;
@@ -32,6 +22,7 @@ import com.core.common.exception.ServiceException;
import com.core.common.utils.DateUtils;
import com.core.common.utils.StringUtils;
import com.core.web.util.TenantOptionUtil;
import com.openhis.common.utils.CommonUtil;
import com.openhis.crosssystem.dto.*;
import com.openhis.crosssystem.enums.LisAgeUnit;
import com.openhis.crosssystem.enums.PacsAgeUnit;
@@ -119,7 +110,7 @@ public class CrossSystemSendApplyUtil {
.setSocketTimeout(30000).build();
// 创建无视SSL验证的HttpClient
CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(requestConfig)
.setSSLSocketFactory(createIgnoreSslSocketFactory()).build();
.setSSLSocketFactory(CommonUtil.createIgnoreSslSocketFactory()).build();
CloseableHttpResponse response = null;
// 发起HTTP请求
try {
@@ -221,7 +212,7 @@ public class CrossSystemSendApplyUtil {
.setSocketTimeout(30000).build();
// 创建无视SSL验证的HttpClient
CloseableHttpClient httpClient = HttpClients.custom().setDefaultRequestConfig(requestConfig)
.setSSLSocketFactory(createIgnoreSslSocketFactory()).build();
.setSSLSocketFactory(CommonUtil.createIgnoreSslSocketFactory()).build();
CloseableHttpResponse response = null;
// 发起HTTP请求
try {
@@ -255,35 +246,4 @@ public class CrossSystemSendApplyUtil {
}
}
/**
* 创建无视SSL验证的SSLSocketFactory
*/
private static SSLConnectionSocketFactory createIgnoreSslSocketFactory() {
try {
// 创建信任所有证书的TrustManager
X509TrustManager trustAllCert = new X509TrustManager() {
@Override
public void checkClientTrusted(X509Certificate[] chain, String authType) {}
@Override
public void checkServerTrusted(X509Certificate[] chain, String authType) {}
@Override
public X509Certificate[] getAcceptedIssuers() {
return new X509Certificate[0];
}
};
// 初始化SSLContext
SSLContext sslContext = SSLContext.getInstance("SSL");
sslContext.init(null, new TrustManager[] {trustAllCert}, new SecureRandom());
// 创建不验证主机名的SocketFactory
return new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE // 关键:禁用主机名验证
);
} catch (NoSuchAlgorithmException | KeyManagementException e) {
throw new RuntimeException("SSL配置失败", e);
}
}
}