From f95981ed0867ae350423a8c2a7c8ab9383006def Mon Sep 17 00:00:00 2001 From: francis-fh Date: Tue, 9 Jun 2026 15:42:15 +0800 Subject: [PATCH] 111 --- .../com/ruoyi/cms/controller/app/AppScriptController.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/app/AppScriptController.java b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/app/AppScriptController.java index 641b4ca..fd6a9fa 100644 --- a/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/app/AppScriptController.java +++ b/ruoyi-bussiness/src/main/java/com/ruoyi/cms/controller/app/AppScriptController.java @@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; +import java.io.File; import java.io.IOException; /** @@ -55,13 +56,14 @@ public class AppScriptController extends BaseController // 上传文件路径 String filePath = RuoYiConfig.getUploadPath(); // 上传并返回新文件名称 - String fileName = null; + String fileName; try { fileName = FileUploadUtils.upload(filePath, file); } catch (IOException e) { - error("读取文件出错"); + logger.error("读取文件出错", e); + return error("文件上传失败:" + e.getMessage()); } - String path = filePath + fileName.replace("profile/upload/", ""); + String path = filePath + File.separator + fileName.replace("profile/upload/", ""); jobService.importRow(path); return success(); }