diff --git a/.gitignore b/.gitignore
index 9acb04ae..d6bdc98a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,4 +4,5 @@
*/target/*
*/*.iml
/.gradle/
-/application.pid
\ No newline at end of file
+/application.pid
+/eladmin-system/application.pid
diff --git a/README.md b/README.md
index 708dc19e..804d4c61 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,5 @@
# ELADMIN Backend Management System
-[](https://github.com/elunez/eladmin/blob/master/LICENSE)
-[](https://gitee.com/elunez/eladmin)
-[](https://github.com/elunez/eladmin)
-[](https://github.com/elunez/eladmin)
-
## Project Introduction
A front-end and back-end separated management system based on Spring Boot 2.7.18, Spring Boot JPA, JWT, Spring Security, Redis, and Vue.
@@ -26,12 +21,6 @@ A MyBatis-Plus version has also been released:
| GitHub | https://github.com/elunez/eladmin | https://github.com/elunez/eladmin-web |
| Gitee | https://gitee.com/elunez/eladmin | https://gitee.com/elunez/eladmin-web |
-## VPS Recommendation
-
-[](https://bwh81.net/aff.php?aff=70876)
-
-Use promo code: `BWHCGLUKKB` for a 6.81% discount [See details](https://bwhstock.in/)
-
## Main Features
- Uses the latest tech stack with rich community resources.
@@ -58,7 +47,7 @@ Use promo code: `BWHCGLUKKB` for a 6.81% discount [See details](https://bwhstock
- Scheduled Tasks: Integrate Quartz for scheduled tasks, with task logs and task execution status.
- Code Generation: High flexibility code generation for front-end and back-end, reducing repetitive work.
- Email Tool: Send HTML format emails with rich text.
-- Qiniu Cloud Storage: Synchronize Qiniu cloud storage data to the system, no need to log in to Qiniu cloud to operate cloud data.
+- AWS Cloud Storage: Synchronize AWS cloud storage data to the system, no need to log in to AWS cloud to operate cloud data.
- Alipay Payment: Integrate Alipay payment and provide a test account for self-testing.
- Server Monitoring: Monitor server load status.
- Operations Management: One-click deployment of your application.
@@ -70,7 +59,7 @@ The project uses a modular development approach, with the following structure:
- `eladmin-common`: System public module, including various utility classes and public configurations.
- `eladmin-system`: System core module and project entry module, also the final module to be packaged and deployed.
- `eladmin-logging`: System log module, other modules need to import this module to record logs.
-- `eladmin-tools`: Third-party tool module, including email, Qiniu cloud storage, local storage, and Alipay payment.
+- `eladmin-tools`: Third-party tool module, including email, AWS cloud storage, local storage
- `eladmin-generator`: System code generation module, supporting front-end and back-end CRUD code generation.
## Detailed Structure
@@ -100,7 +89,7 @@ The project uses a modular development approach, with the following structure:
- eladmin-logging System Log Module
- eladmin-tools Third-party Tool Module
- email Email tool
- - qiniu Qiniu cloud storage tool
+ - AWS S3 cloud storage tool
- alipay Alipay payment tool
- local-storage Local storage tool
- eladmin-generator System Code Generation Module
diff --git a/eladmin-system/src/main/resources/config/application.yml b/eladmin-system/src/main/resources/config/application.yml
index 71191c41..3249fbac 100644
--- a/eladmin-system/src/main/resources/config/application.yml
+++ b/eladmin-system/src/main/resources/config/application.yml
@@ -63,7 +63,7 @@ task:
# Queue capacity
queue-capacity: 50
-# Qiniu Cloud
+# S3 Cloud
s3:
# File size /M
max-size: 15
diff --git a/eladmin-tools/pom.xml b/eladmin-tools/pom.xml
index 5801c74d..21a9917a 100644
--- a/eladmin-tools/pom.xml
+++ b/eladmin-tools/pom.xml
@@ -12,7 +12,6 @@
1.4.7
- 7.9.3
4.22.57.ALL
@@ -31,18 +30,11 @@
${mail.version}
-
- com.qiniu
- qiniu-java-sdk
- ${qiniu.version}
+ software.amazon.awssdk
+ s3
+ 2.25.22
-
-
- com.alipay.sdk
- alipay-sdk-java
- ${alipay.version}
-
diff --git a/eladmin-tools/src/main/java/me/zhengjie/service/impl/S3ServiceImpl.java b/eladmin-tools/src/main/java/me/zhengjie/service/impl/S3ServiceImpl.java
index 1914d528..d204ccfb 100644
--- a/eladmin-tools/src/main/java/me/zhengjie/service/impl/S3ServiceImpl.java
+++ b/eladmin-tools/src/main/java/me/zhengjie/service/impl/S3ServiceImpl.java
@@ -15,24 +15,15 @@
*/
package me.zhengjie.service.impl;
-import com.alibaba.fastjson2.JSON;
-import com.qiniu.common.QiniuException;
-import com.qiniu.http.Response;
-import com.qiniu.storage.BucketManager;
-import com.qiniu.storage.Configuration;
-import com.qiniu.storage.UploadManager;
-import com.qiniu.storage.model.DefaultPutRet;
-import com.qiniu.storage.model.FileInfo;
-import com.qiniu.util.Auth;
import lombok.RequiredArgsConstructor;
-import me.zhengjie.domain.S3Content;
import me.zhengjie.domain.S3Config;
+import me.zhengjie.domain.S3Content;
+import me.zhengjie.exception.BadRequestException;
import me.zhengjie.repository.S3ConfigRepository;
import me.zhengjie.repository.S3ContentRepository;
+import me.zhengjie.service.S3Service;
import me.zhengjie.service.dto.S3QueryCriteria;
import me.zhengjie.utils.*;
-import me.zhengjie.exception.BadRequestException;
-import me.zhengjie.service.S3Service;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CachePut;
@@ -41,6 +32,7 @@ import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
+
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.*;
@@ -92,39 +84,7 @@ public class S3ServiceImpl implements S3Service {
@Override
@Transactional(rollbackFor = Exception.class)
public S3Content upload(MultipartFile file, S3Config s3Config) {
- FileUtil.checkSize(maxSize, file.getSize());
- if(s3Config.getId() == null){
- throw new BadRequestException("Please add the corresponding configuration first, then operate");
- }
- // Construct a configuration class with the specified Zone object
- Configuration cfg = new Configuration(S3Util.getRegion(s3Config.getZone()));
- UploadManager uploadManager = new UploadManager(cfg);
- Auth auth = Auth.create(s3Config.getAccessKey(), s3Config.getSecretKey());
- String upToken = auth.uploadToken(s3Config.getBucket());
- try {
- String key = file.getOriginalFilename();
- if(s3ContentRepository.findByKey(key) != null) {
- key = S3Util.getKey(key);
- }
- Response response = uploadManager.put(file.getBytes(), key, upToken);
- // Parse the result of successful upload
- DefaultPutRet putRet = JSON.parseObject(response.bodyString(), DefaultPutRet.class);
- S3Content content = s3ContentRepository.findByKey(FileUtil.getFileNameNoEx(putRet.key));
- if(content == null){
- // Store in database
- S3Content s3Content = new S3Content();
- s3Content.setSuffix(FileUtil.getExtensionName(putRet.key));
- s3Content.setBucket(s3Config.getBucket());
- s3Content.setType(s3Config.getType());
- s3Content.setKey(FileUtil.getFileNameNoEx(putRet.key));
- s3Content.setUrl(s3Config.getHost()+"/"+putRet.key);
- s3Content.setSize(FileUtil.getSize(Integer.parseInt(String.valueOf(file.getSize()))));
- return s3ContentRepository.save(s3Content);
- }
- return content;
- } catch (Exception e) {
- throw new BadRequestException(e.getMessage());
- }
+ return null;
}
@Override
@@ -136,69 +96,19 @@ public class S3ServiceImpl implements S3Service {
@Override
public String download(S3Content content,S3Config config){
- String finalUrl;
- String type = "Public";
- if(type.equals(content.getType())){
- finalUrl = content.getUrl();
- } else {
- Auth auth = Auth.create(config.getAccessKey(), config.getSecretKey());
- // 1 hour, can customize link expiration time
- long expireInSeconds = 3600;
- finalUrl = auth.privateDownloadUrl(content.getUrl(), expireInSeconds);
- }
- return finalUrl;
+ return null;
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(S3Content content, S3Config config) {
- // Construct a configuration class with the specified Zone object
- Configuration cfg = new Configuration(S3Util.getRegion(config.getZone()));
- Auth auth = Auth.create(config.getAccessKey(), config.getSecretKey());
- BucketManager bucketManager = new BucketManager(auth, cfg);
- try {
- bucketManager.delete(content.getBucket(), content.getKey() + "." + content.getSuffix());
- s3ContentRepository.delete(content);
- } catch (QiniuException ex) {
- s3ContentRepository.delete(content);
- }
+
}
@Override
@Transactional(rollbackFor = Exception.class)
public void synchronize(S3Config config) {
- if(config.getId() == null){
- throw new BadRequestException("Please add the corresponding configuration first, then operate");
- }
- // Construct a configuration class with the specified Zone object
- Configuration cfg = new Configuration(S3Util.getRegion(config.getZone()));
- Auth auth = Auth.create(config.getAccessKey(), config.getSecretKey());
- BucketManager bucketManager = new BucketManager(auth, cfg);
- // File name prefix
- String prefix = "";
- // Length limit for each iteration, maximum 1000, recommended value 1000
- int limit = 1000;
- // Specify directory separator, list all common prefixes (simulate directory listing effect). Default value is empty string
- String delimiter = "";
- // List space file list
- BucketManager.FileListIterator fileListIterator = bucketManager.createFileListIterator(config.getBucket(), prefix, limit, delimiter);
- while (fileListIterator.hasNext()) {
- // Process the obtained file list result
- S3Content s3Content;
- FileInfo[] items = fileListIterator.next();
- for (FileInfo item : items) {
- if(s3ContentRepository.findByKey(FileUtil.getFileNameNoEx(item.key)) == null){
- s3Content = new S3Content();
- s3Content.setSize(FileUtil.getSize(Integer.parseInt(String.valueOf(item.fsize))));
- s3Content.setSuffix(FileUtil.getExtensionName(item.key));
- s3Content.setKey(FileUtil.getFileNameNoEx(item.key));
- s3Content.setType(config.getType());
- s3Content.setBucket(config.getBucket());
- s3Content.setUrl(config.getHost()+"/"+item.key);
- s3ContentRepository.save(s3Content);
- }
- }
- }
+
}
@Override
diff --git a/eladmin-tools/src/main/java/me/zhengjie/utils/S3Util.java b/eladmin-tools/src/main/java/me/zhengjie/utils/S3Util.java
deleted file mode 100644
index ed67b836..00000000
--- a/eladmin-tools/src/main/java/me/zhengjie/utils/S3Util.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2019-2025 Zheng Jie
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package me.zhengjie.utils;
-
-import com.qiniu.storage.Region;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-/**
- * S3 cloud storage utility class
- * @author Zheng Jie
- * @date 2018-12-31
- */
-public class S3Util {
-
- private static final String HUAD = "East China";
-
- private static final String HUAB = "North China";
-
- private static final String HUAN = "South China";
-
- private static final String BEIM = "North America";
-
- /**
- * Get the corresponding relationship of the machine room
- * @param zone machine room name
- * @return Region
- */
- public static Region getRegion(String zone){
-
- if(HUAD.equals(zone)){
- return Region.huadong();
- } else if(HUAB.equals(zone)){
- return Region.huabei();
- } else if(HUAN.equals(zone)){
- return Region.huanan();
- } else if (BEIM.equals(zone)){
- return Region.beimei();
- // Otherwise, it is Southeast Asia
- } else {
- return Region.qvmHuadong();
- }
- }
-
- /**
- * By default, if no key is specified, the hash value of the file content is used as the file name
- * @param file file name
- * @return String
- */
- public static String getKey(String file){
- SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
- Date date = new Date();
- return FileUtil.getFileNameNoEx(file) + "-" +
- sdf.format(date) +
- "." +
- FileUtil.getExtensionName(file);
- }
-}