From c7ef5f837fe90766574cee9d0eae9e89e34af263 Mon Sep 17 00:00:00 2001
From: liusheng <337615773@qq.com>
Date: 星期四, 09 十月 2025 09:46:56 +0800
Subject: [PATCH] 代码提交

---
 ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java |   35 ++++++++++++++++++++++++++++++++---
 1 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java
index 7d34762..bc0e282 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/common/CommonController.java
@@ -10,6 +10,8 @@
 import com.ruoyi.common.utils.file.FileUploadUtils;
 import com.ruoyi.common.utils.file.FileUtils;
 import com.ruoyi.framework.config.ServerConfig;
+import com.ruoyi.system.domain.SysConfig;
+import com.ruoyi.system.mapper.SysConfigMapper;
 import com.smartor.domain.HtmlContentVO;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -53,6 +55,9 @@
 
     @Autowired
     private ServerConfig serverConfig;
+
+    @Autowired
+    private SysConfigMapper sysConfigMapper;
 
     private static final String FILE_DELIMETER = ",";
 
@@ -143,7 +148,10 @@
             convertDocToHtml(filePath + "\\" + file.getOriginalFilename(), filePath + "\\" + file.getOriginalFilename().split("\\.", 2)[0] + ".html");
 
             String url = null;
-            String xhPath = "http://218.108.11.22:8093/profile-api";
+            SysConfig config = new SysConfig();
+            config.setConfigKey("sys.qdip");
+            SysConfig sysConfig = sysConfigMapper.selectConfig(config);
+            String xhPath = sysConfig.getConfigValue() + "/profile-api";
             if (uploadSwitch == 1) {
                 String fn = fileName.replaceAll("\\.[^.]*$", ".html").replaceAll("/profile", "");
                 url = xhPath + fn;
@@ -263,8 +271,7 @@
         // 灏嗘枃浠朵繚瀛樺埌鎸囧畾鐩綍
         File outputFile = new File(RuoYiConfig.getUploadPath() + "/show/" + fileName.split("\\.", 2)[0] + "/" + fileName);
         try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outputFile), "UTF-8"))) {
-            if (StringUtils.isNotEmpty(htmlContentVO.getContent()))
-                writer.write(htmlContentVO.getContent());
+            if (StringUtils.isNotEmpty(htmlContentVO.getContent())) writer.write(htmlContentVO.getContent());
         } catch (IOException e) {
             e.printStackTrace();
         }
@@ -315,4 +322,26 @@
     }
 
 
+    /**
+     * 鑾峰彇鏂囦欢鎵╁睍鍚�
+     */
+    private static String getFileExtension(String fileName) {
+        int lastDotIndex = fileName.lastIndexOf('.');
+        if (lastDotIndex > 0) {
+            return fileName.substring(lastDotIndex);
+        }
+        return "";
+    }
+
+    /**
+     * 妫�鏌ユ枃浠舵槸鍚︿负鏀寔鐨刉ord鏍煎紡
+     */
+    public static boolean isSupportedWordFormat(String filePath) {
+        if (filePath == null) return false;
+        String fileName = filePath.toLowerCase();
+        return fileName.endsWith(".doc") || fileName.endsWith(".docx");
+    }
 }
+
+
+

--
Gitblit v1.9.3