From f350465db70d6f9db9494483ee0cec7793a9007b Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期三, 19 八月 2026 17:47:57 +0800
Subject: [PATCH] feat(approve): 实现审批流程或签会签功能并优化数据库配置
---
src/main/java/com/ruoyi/project/common/CommonController.java | 70 +++++++++++++++++++++++++++++++---
1 files changed, 63 insertions(+), 7 deletions(-)
diff --git a/src/main/java/com/ruoyi/project/common/CommonController.java b/src/main/java/com/ruoyi/project/common/CommonController.java
index d5a6bcf..a5c1fb1 100644
--- a/src/main/java/com/ruoyi/project/common/CommonController.java
+++ b/src/main/java/com/ruoyi/project/common/CommonController.java
@@ -1,9 +1,17 @@
package com.ruoyi.project.common;
+import java.io.File;
import java.util.ArrayList;
+import java.util.LinkedHashMap;
import java.util.List;
+import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+
+import com.ruoyi.basic.service.StorageBlobService;
+import com.ruoyi.framework.web.domain.R;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -26,6 +34,7 @@
*
* @author ruoyi
*/
+@Api(tags = "閫氱敤鎺ュ彛")
@RestController
@RequestMapping("/common")
public class CommonController
@@ -52,21 +61,34 @@
{
throw new Exception(StringUtils.format("鏂囦欢鍚嶇О({})闈炴硶锛屼笉鍏佽涓嬭浇銆� ", fileName));
}
- String realFileName = System.currentTimeMillis() + fileName.substring(fileName.indexOf("_") + 1);
- String filePath = RuoYiConfig.getDownloadPath() + fileName;
+ String realFileName = fileName.substring(fileName.indexOf("_") + 1);
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
FileUtils.setAttachmentResponseHeader(response, realFileName);
- FileUtils.writeBytes(filePath, response.getOutputStream());
- if (delete)
- {
- FileUtils.deleteFile(filePath);
- }
+ FileUtils.writeBytes(fileName, response.getOutputStream());
+// if (delete)
+// {
+// FileUtils.deleteFile(fileName);
+// }
}
catch (Exception e)
{
log.error("涓嬭浇鏂囦欢澶辫触", e);
}
+ }
+
+ @Autowired
+ private StorageBlobService storageBlobService;
+
+
+ /**
+ * minio閫氱敤涓婁紶璇锋眰锛堝涓級
+ */
+ @PostMapping("/minioUploads")
+ @ApiOperation(value = "minio閫氱敤涓婁紶璇锋眰")
+ public AjaxResult minioUploadFiles(List<MultipartFile> files, String bucketName, Long type) throws Exception
+ {
+ return AjaxResult.success(storageBlobService.updateStorageBlobs(files, bucketName,type));
}
/**
@@ -133,6 +155,40 @@
}
/**
+ * 閫氱敤涓婁紶璇锋眰锛堝涓紝杩斿洖鏂囦欢鍒楄〃锛屼緵闄勪欢涓婁紶缁勪欢浣跨敤锛�
+ */
+ @PostMapping("/uploadsList")
+ @ApiOperation(value = "閫氱敤涓婁紶璇锋眰锛堝涓紝杩斿洖鏂囦欢鍒楄〃锛�")
+ public AjaxResult uploadsList(List<MultipartFile> files) throws Exception
+ {
+ try
+ {
+ if (files == null || files.isEmpty())
+ {
+ return AjaxResult.error("鏈�夋嫨鏂囦欢");
+ }
+ // 涓婁紶鏂囦欢璺緞
+ String filePath = RuoYiConfig.getUploadPath();
+ List<Map<String, String>> result = new ArrayList<>();
+ for (MultipartFile file : files)
+ {
+ // 涓婁紶骞惰繑鍥炴柊鏂囦欢鍚嶇О
+ String fileName = FileUploadUtils.upload(filePath, file);
+ String url = serverConfig.getUrl() + fileName;
+ Map<String, String> item = new LinkedHashMap<>();
+ item.put("name", file.getOriginalFilename());
+ item.put("url", url);
+ result.add(item);
+ }
+ return AjaxResult.success(result);
+ }
+ catch (Exception e)
+ {
+ return AjaxResult.error(e.getMessage());
+ }
+ }
+
+ /**
* 鏈湴璧勬簮閫氱敤涓嬭浇
*/
@GetMapping("/download/resource")
--
Gitblit v1.9.3