浏览代码

feat(protocol): 更新协议文件路径处理逻辑

- 添加域名判断和转换逻辑,将旧域名替换为新域名
- 实现SSL证书验证绕过功能,对特定域名回退到原始OSS地址
- 修改上传文件路径为自定义域名路径
- 优化协议文件路径获取和存储逻辑
fcw 4 天之前
父节点
当前提交
3d66bbb93d

+ 28 - 1
alien-store/src/main/java/shop/alien/store/service/impl/ProtocolManagementServiceImpl.java

@@ -93,10 +93,29 @@ public class ProtocolManagementServiceImpl extends ServiceImpl<ProtocolManagemen
             throw new IllegalArgumentException("协议文件路径不存在");
             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;
         InputStream inputStream = null;
         OutputStream outputStream = null;
         OutputStream outputStream = null;
         try {
         try {
             URL url = new URL(protocolUrl);
             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();
             URLConnection connection = url.openConnection();
             connection.setConnectTimeout(5000);
             connection.setConnectTimeout(5000);
             connection.setReadTimeout(10000);
             connection.setReadTimeout(10000);
@@ -168,7 +187,15 @@ public class ProtocolManagementServiceImpl extends ServiceImpl<ProtocolManagemen
         Map<String, String> fileNameAndType = FileUtil.getFileNameAndType(multipartFile);
         Map<String, String> fileNameAndType = FileUtil.getFileNameAndType(multipartFile);
 
 
         String s = aliOSSUtil.uploadFile(multipartFile, prefix + fileNameAndType.get("name") + RandomCreateUtil.getRandomNum(6) + "." + fileNameAndType.get("type"));
         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);
         protocolManagement.setProtocolFilePath(s);
 
 
         // 根据 type(displayPosition) 和名称(protocolFileName) 查询是否存在
         // 根据 type(displayPosition) 和名称(protocolFileName) 查询是否存在

二进制
alien-store/src/main/resources/templates/举报导入模版.xlsx


二进制
alien-store/src/main/resources/templates/意见反馈导入模版.xlsx


二进制
alien-store/src/main/resources/templates/筛选条件导入模版.xlsx


二进制
alien-store/src/main/resources/templates/门店标签导入模版.xlsx