From 03d3cd458fc0dee8859564073ae3e754df228e2f Mon Sep 17 00:00:00 2001
From: LSH
Date: 星期一, 27 十一月 2023 14:17:22 +0800
Subject: [PATCH] #
---
src/main/java/com/zy/crm/common/utils/FileSaveExampleUtil.java | 43 ++++++++++++++++++++++++++++++-------------
1 files changed, 30 insertions(+), 13 deletions(-)
diff --git a/src/main/java/com/zy/crm/common/utils/FileSaveExampleUtil.java b/src/main/java/com/zy/crm/common/utils/FileSaveExampleUtil.java
index 46987e2..dd83772 100644
--- a/src/main/java/com/zy/crm/common/utils/FileSaveExampleUtil.java
+++ b/src/main/java/com/zy/crm/common/utils/FileSaveExampleUtil.java
@@ -1,6 +1,8 @@
package com.zy.crm.common.utils;
import java.io.*;
+
+import com.zy.crm.manager.entity.PlanUrl;
import org.springframework.core.io.Resource;
import java.net.URLEncoder;
@@ -61,19 +63,19 @@
// }
// }
- public static void saveFile(MultipartFile file, String savePath) throws IOException {
- // 鍒涘缓淇濆瓨鏂囦欢鐨勭洰褰曪紙濡傛灉涓嶅瓨鍦級
- File directory = new File(savePath);
- if (!directory.exists()) {
- directory.mkdirs();
- }
-
- // 淇濆瓨鏂囦欢
- String fileName = file.getOriginalFilename();
- String filePath = savePath + fileName;
- File dest = new File(filePath);
- file.transferTo(dest);
- }
+// public static void saveFile(MultipartFile file, String savePath) throws IOException {
+// // 鍒涘缓淇濆瓨鏂囦欢鐨勭洰褰曪紙濡傛灉涓嶅瓨鍦級
+// File directory = new File(savePath);
+// if (!directory.exists()) {
+// directory.mkdirs();
+// }
+//
+// // 淇濆瓨鏂囦欢
+// String fileName = file.getOriginalFilename();
+// String filePath = savePath + fileName;
+// File dest = new File(filePath);
+// file.transferTo(dest);
+// }
public static void deleteFilesInDirectory(String directoryPath) {
File directory = new File(directoryPath);
@@ -237,6 +239,7 @@
private String name;
private long size;
private String path;
+ private String userName;
private boolean success;
private String errorMessage;
@@ -246,12 +249,26 @@
this.path = path;
}
+ public FileDTO(String name, long size, String path,String userName) {
+ this.name = name;
+ this.size = size;
+ this.path = path;
+ this.userName = userName;
+ }
+
public FileDTO(String name, long size) {
this.name = name;
this.size = size;
// this.path = path;
}
+ public FileDTO(PlanUrl planUrl) {
+ this.name = planUrl.getName();
+ this.size = planUrl.getFileSize();
+ this.path = planUrl.getUrl();
+ this.userName = planUrl.getUserName();
+ }
+
public FileDTO(boolean success, String name, String errorMessage) {
this.success = success;
this.name = name;
--
Gitblit v1.9.1