|
|
@@ -93,10 +93,29 @@ public class ProtocolManagementServiceImpl extends ServiceImpl<ProtocolManagemen
|
|
|
throw new IllegalArgumentException("协议文件路径不存在");
|
|
|
}
|
|
|
|
|
|
+ // 添加域名判断和转换逻辑
|
|
|
+ String newDomain = "https://ossfile.ailien.shop/";
|
|
|
+ String oldDomain = "https://alien-volume.oss-cn-beijing.aliyuncs.com/";
|
|
|
+
|
|
|
+ if (protocolUrl.startsWith(oldDomain) && !protocolUrl.contains(newDomain)) {
|
|
|
+ protocolUrl = newDomain + protocolUrl.substring(oldDomain.length());
|
|
|
+ }
|
|
|
+
|
|
|
InputStream inputStream = null;
|
|
|
OutputStream outputStream = null;
|
|
|
try {
|
|
|
URL url = new URL(protocolUrl);
|
|
|
+
|
|
|
+ // 绕过SSL证书验证
|
|
|
+ if (protocolUrl.startsWith("https://ossfile.ailien.shop/")) {
|
|
|
+ // 对于自定义域名,暂时回退到原始OSS域名
|
|
|
+ String fallbackUrl = protocolUrl.replace(
|
|
|
+ "https://ossfile.ailien.shop/",
|
|
|
+ "https://alien-volume.oss-cn-beijing.aliyuncs.com/"
|
|
|
+ );
|
|
|
+ url = new URL(fallbackUrl);
|
|
|
+ }
|
|
|
+
|
|
|
URLConnection connection = url.openConnection();
|
|
|
connection.setConnectTimeout(5000);
|
|
|
connection.setReadTimeout(10000);
|
|
|
@@ -168,7 +187,15 @@ public class ProtocolManagementServiceImpl extends ServiceImpl<ProtocolManagemen
|
|
|
Map<String, String> fileNameAndType = FileUtil.getFileNameAndType(multipartFile);
|
|
|
|
|
|
String s = aliOSSUtil.uploadFile(multipartFile, prefix + fileNameAndType.get("name") + RandomCreateUtil.getRandomNum(6) + "." + fileNameAndType.get("type"));
|
|
|
- // 上传文件
|
|
|
+ // 修改oss路径为域名路径
|
|
|
+ String newDomain = "https://ossfile.ailien.shop/";
|
|
|
+ String oldDomain = "https://alien-volume.oss-cn-beijing.aliyuncs.com/";
|
|
|
+
|
|
|
+ if (s.startsWith(oldDomain)) {
|
|
|
+ s = newDomain + s.substring(oldDomain.length());
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
protocolManagement.setProtocolFilePath(s);
|
|
|
|
|
|
// 根据 type(displayPosition) 和名称(protocolFileName) 查询是否存在
|