From 319887944579804e29ce3e4aa80183eb2aa7ca50 Mon Sep 17 00:00:00 2001 From: zhengzheng <18918765049@163.com> Date: Thu, 5 May 2022 10:10:42 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/busi/ActiveInfoController.java | 2 +- .../controller/common/CommonController.java | 28 ++++++++++ .../resources/templates/active/info/add.html | 40 +++++++++++++- .../resources/templates/active/info/edit.html | 54 ++++++++++++++++++- .../templates/active/info/first.html | 11 ++-- .../com/wuzhen/common/config/RuoYiConfig.java | 9 ++++ .../com/wuzhen/system/domain/ActiveInfo.java | 22 +++++++- .../mapper/system/ActiveInfoMapper.xml | 6 ++- 8 files changed, 162 insertions(+), 10 deletions(-) diff --git a/zt-admin/src/main/java/com/wuzhen/web/controller/busi/ActiveInfoController.java b/zt-admin/src/main/java/com/wuzhen/web/controller/busi/ActiveInfoController.java index 71c187161..26895d4e2 100644 --- a/zt-admin/src/main/java/com/wuzhen/web/controller/busi/ActiveInfoController.java +++ b/zt-admin/src/main/java/com/wuzhen/web/controller/busi/ActiveInfoController.java @@ -134,9 +134,9 @@ public class ActiveInfoController extends BaseController list.add(map); } } - String json = JSONObject.toJSONString(list); activeInfo.setListLpNames(json); + activeInfo.setListLsNames("http://localhost:18000/profile/upload/ls/"+activeInfo.getLsFilesName()); mmap.put("active", activeInfo); return prefix + "/edit"; } diff --git a/zt-admin/src/main/java/com/wuzhen/web/controller/common/CommonController.java b/zt-admin/src/main/java/com/wuzhen/web/controller/common/CommonController.java index 4b0c99c0c..fe8f9c059 100644 --- a/zt-admin/src/main/java/com/wuzhen/web/controller/common/CommonController.java +++ b/zt-admin/src/main/java/com/wuzhen/web/controller/common/CommonController.java @@ -163,6 +163,34 @@ public class CommonController } } + + /** + * 通用上传列表图 + */ + @PostMapping("/uploadsLs") + @ResponseBody + public AjaxResult uploadFilesLs(MultipartFile file) throws Exception + { + try + { + // 上传文件路径 + String filePath = RuoYiConfig.getLSUploadPath(); + // 上传并返回新文件名称 + String fileName = FileUploadUtils.upload(filePath, file); + String url = serverConfig.getUrl() + fileName; + AjaxResult ajax = AjaxResult.success(); + ajax.put("url", url); + ajax.put("fileName", fileName); + ajax.put("newFileName", FileUtils.getName(fileName)); + ajax.put("originalFilename", file.getOriginalFilename()); + return ajax; + } + catch (Exception e) + { + return AjaxResult.error(e.getMessage()); + } + } + /** * 本地资源通用下载 */ diff --git a/zt-admin/src/main/resources/templates/active/info/add.html b/zt-admin/src/main/resources/templates/active/info/add.html index 3476a309c..e196270fc 100644 --- a/zt-admin/src/main/resources/templates/active/info/add.html +++ b/zt-admin/src/main/resources/templates/active/info/add.html @@ -11,6 +11,7 @@