From a4610dbd98e8525e189e2b8a99034ec076d0b742 Mon Sep 17 00:00:00 2001
From: 13693261870 <252740454@qq.com>
Date: 星期日, 08 十二月 2024 10:34:27 +0800
Subject: [PATCH] 1

---
 se-modules/se-docker/src/main/java/com/se/file/service/LocalSysFileServiceImpl.java   |   50 +++
 se-modules/se-docker/src/main/java/com/se/file/utils/FileUploadUtils.java             |  185 ++++++++++++++
 se-modules/se-docker/src/main/java/com/se/file/controller/SysFileController.java      |   48 +++
 se-modules/se-docker/src/main/java/com/se/file/service/ISysFileService.java           |   20 +
 说明.txt                                                                                |    3 
 se-modules/se-docker/src/main/resources/banner.txt                                    |    3 
 se-modules/se-docker/src/main/java/com/se/file/service/FastDfsSysFileServiceImpl.java |   46 +++
 se-modules/se-docker/src/main/java/com/se/file/SeFileApplication.java                 |   22 +
 se-modules/se-docker/pom.xml                                                          |   89 ++++++
 se-modules/se-docker/src/main/java/com/se/file/config/MinioConfig.java                |   82 ++++++
 se-modules/se-docker/src/main/java/com/se/file/service/MinioSysFileServiceImpl.java   |   50 +++
 se-modules/se-docker/src/main/java/com/se/file/config/ResourcesConfig.java            |   50 +++
 se-modules/se-docker/src/main/resources/bootstrap.yml                                 |   27 ++
 se-modules/se-docker/src/main/resources/logback.xml                                   |   74 +++++
 se-modules/pom.xml                                                                    |    1 
 15 files changed, 750 insertions(+), 0 deletions(-)

diff --git a/se-modules/pom.xml b/se-modules/pom.xml
index c39c8ee..c97ee98 100644
--- a/se-modules/pom.xml
+++ b/se-modules/pom.xml
@@ -10,6 +10,7 @@
 
     <modules>
         <module>se-system</module>
+        <module>se-docker</module>
         <!--<module>se-gen</module>
         <module>se-job</module>
         <module>se-file</module>-->
diff --git a/se-modules/se-docker/pom.xml b/se-modules/se-docker/pom.xml
new file mode 100644
index 0000000..9e3c363
--- /dev/null
+++ b/se-modules/se-docker/pom.xml
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xmlns="http://maven.apache.org/POM/4.0.0"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <groupId>com.se</groupId>
+        <artifactId>se-modules</artifactId>
+        <version>3.6.4</version>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>se-modules-file</artifactId>
+
+    <description>
+        se-modules-file鏂囦欢鏈嶅姟
+    </description>
+
+    <dependencies>
+    	
+    	<!-- SpringCloud Alibaba Nacos -->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
+        </dependency>
+        
+        <!-- SpringCloud Alibaba Nacos Config -->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
+        </dependency>
+        
+        <!-- SpringCloud Alibaba Sentinel -->
+        <dependency>
+            <groupId>com.alibaba.cloud</groupId>
+            <artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
+        </dependency>
+        
+        <!-- SpringBoot Actuator -->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-actuator</artifactId>
+        </dependency>
+		
+        <!-- FastDFS -->
+        <dependency>
+            <groupId>com.github.tobato</groupId>
+            <artifactId>fastdfs-client</artifactId>
+        </dependency>
+        
+        <!-- Minio -->
+        <dependency>
+            <groupId>io.minio</groupId>
+            <artifactId>minio</artifactId>
+            <version>8.2.2</version>
+<!--            <version>${minio.version}</version>-->
+        </dependency>
+        
+        <!-- SE Api System -->
+        <dependency>
+            <groupId>com.se</groupId>
+            <artifactId>se-api-system</artifactId>
+        </dependency>
+        
+        <!-- SE Common Swagger -->
+        <dependency>
+            <groupId>com.se</groupId>
+            <artifactId>se-common-swagger</artifactId>
+        </dependency>
+        
+    </dependencies>
+
+    <build>
+        <finalName>${project.artifactId}</finalName>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+   
+</project>
\ No newline at end of file
diff --git a/se-modules/se-docker/src/main/java/com/se/file/SeFileApplication.java b/se-modules/se-docker/src/main/java/com/se/file/SeFileApplication.java
new file mode 100644
index 0000000..d853e56
--- /dev/null
+++ b/se-modules/se-docker/src/main/java/com/se/file/SeFileApplication.java
@@ -0,0 +1,22 @@
+package com.se.file;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
+import com.se.common.swagger.annotation.EnableCustomSwagger2;
+
+/**
+ * 鏂囦欢鏈嶅姟
+ * 
+ * @author admin
+ */
+@EnableCustomSwagger2
+@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class })
+public class SeFileApplication
+{
+    public static void main(String[] args)
+    {
+        SpringApplication.run(SeFileApplication.class, args);
+        System.out.println("    鏂囦欢妯″潡鍚姩鎴愬姛    ");
+    }
+}
diff --git a/se-modules/se-docker/src/main/java/com/se/file/config/MinioConfig.java b/se-modules/se-docker/src/main/java/com/se/file/config/MinioConfig.java
new file mode 100644
index 0000000..bb02876
--- /dev/null
+++ b/se-modules/se-docker/src/main/java/com/se/file/config/MinioConfig.java
@@ -0,0 +1,82 @@
+package com.se.file.config;
+
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import io.minio.MinioClient;
+
+/**
+ * Minio 閰嶇疆淇℃伅
+ *
+ * @author admin
+ */
+@Configuration
+@ConfigurationProperties(prefix = "minio")
+public class MinioConfig
+{
+    /**
+     * 鏈嶅姟鍦板潃
+     */
+    private String url;
+
+    /**
+     * 鐢ㄦ埛鍚�
+     */
+    private String accessKey;
+
+    /**
+     * 瀵嗙爜
+     */
+    private String secretKey;
+
+    /**
+     * 瀛樺偍妗跺悕绉�
+     */
+    private String bucketName;
+
+    public String getUrl()
+    {
+        return url;
+    }
+
+    public void setUrl(String url)
+    {
+        this.url = url;
+    }
+
+    public String getAccessKey()
+    {
+        return accessKey;
+    }
+
+    public void setAccessKey(String accessKey)
+    {
+        this.accessKey = accessKey;
+    }
+
+    public String getSecretKey()
+    {
+        return secretKey;
+    }
+
+    public void setSecretKey(String secretKey)
+    {
+        this.secretKey = secretKey;
+    }
+
+    public String getBucketName()
+    {
+        return bucketName;
+    }
+
+    public void setBucketName(String bucketName)
+    {
+        this.bucketName = bucketName;
+    }
+
+    @Bean
+    public MinioClient getMinioClient()
+    {
+        return MinioClient.builder().endpoint(url).credentials(accessKey, secretKey).build();
+    }
+}
diff --git a/se-modules/se-docker/src/main/java/com/se/file/config/ResourcesConfig.java b/se-modules/se-docker/src/main/java/com/se/file/config/ResourcesConfig.java
new file mode 100644
index 0000000..bb0eebe
--- /dev/null
+++ b/se-modules/se-docker/src/main/java/com/se/file/config/ResourcesConfig.java
@@ -0,0 +1,50 @@
+package com.se.file.config;
+
+import java.io.File;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
+
+/**
+ * 閫氱敤鏄犲皠閰嶇疆
+ * 
+ * @author admin
+ */
+@Configuration
+public class ResourcesConfig implements WebMvcConfigurer
+{
+    /**
+     * 涓婁紶鏂囦欢瀛樺偍鍦ㄦ湰鍦扮殑鏍硅矾寰�
+     */
+    @Value("${file.path}")
+    private String localFilePath;
+
+    /**
+     * 璧勬簮鏄犲皠璺緞 鍓嶇紑
+     */
+    @Value("${file.prefix}")
+    public String localFilePrefix;
+
+    @Override
+    public void addResourceHandlers(ResourceHandlerRegistry registry)
+    {
+        /** 鏈湴鏂囦欢涓婁紶璺緞 */
+        registry.addResourceHandler(localFilePrefix + "/**")
+                .addResourceLocations("file:" + localFilePath + File.separator);
+    }
+    
+    /**
+     * 寮�鍚法鍩�
+     */
+    @Override
+    public void addCorsMappings(CorsRegistry registry) {
+        // 璁剧疆鍏佽璺ㄥ煙鐨勮矾鐢�
+        registry.addMapping(localFilePrefix  + "/**")
+                // 璁剧疆鍏佽璺ㄥ煙璇锋眰鐨勫煙鍚�
+                .allowedOrigins("*")
+                // 璁剧疆鍏佽鐨勬柟娉�
+                .allowedMethods("GET");
+    }
+}
\ No newline at end of file
diff --git a/se-modules/se-docker/src/main/java/com/se/file/controller/SysFileController.java b/se-modules/se-docker/src/main/java/com/se/file/controller/SysFileController.java
new file mode 100644
index 0000000..e87c238
--- /dev/null
+++ b/se-modules/se-docker/src/main/java/com/se/file/controller/SysFileController.java
@@ -0,0 +1,48 @@
+package com.se.file.controller;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.multipart.MultipartFile;
+import com.se.common.core.domain.R;
+import com.se.common.core.utils.file.FileUtils;
+import com.se.file.service.ISysFileService;
+import com.se.system.api.domain.SysFile;
+
+/**
+ * 鏂囦欢璇锋眰澶勭悊
+ * 
+ * @author admin
+ */
+@RestController
+public class SysFileController
+{
+    private static final Logger log = LoggerFactory.getLogger(SysFileController.class);
+
+    @Autowired
+    private ISysFileService sysFileService;
+
+    /**
+     * 鏂囦欢涓婁紶璇锋眰
+     */
+    @PostMapping("upload")
+    public R<SysFile> upload(MultipartFile file)
+    {
+        try
+        {
+            // 涓婁紶骞惰繑鍥炶闂湴鍧�
+            String url = sysFileService.uploadFile(file);
+            SysFile sysFile = new SysFile();
+            sysFile.setName(FileUtils.getName(url));
+            sysFile.setUrl(url);
+            return R.ok(sysFile);
+        }
+        catch (Exception e)
+        {
+            log.error("涓婁紶鏂囦欢澶辫触", e);
+            return R.fail(e.getMessage());
+        }
+    }
+}
\ No newline at end of file
diff --git a/se-modules/se-docker/src/main/java/com/se/file/service/FastDfsSysFileServiceImpl.java b/se-modules/se-docker/src/main/java/com/se/file/service/FastDfsSysFileServiceImpl.java
new file mode 100644
index 0000000..fa25b7b
--- /dev/null
+++ b/se-modules/se-docker/src/main/java/com/se/file/service/FastDfsSysFileServiceImpl.java
@@ -0,0 +1,46 @@
+package com.se.file.service;
+
+import java.io.InputStream;
+import com.alibaba.nacos.common.utils.IoUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+import com.github.tobato.fastdfs.domain.fdfs.StorePath;
+import com.github.tobato.fastdfs.service.FastFileStorageClient;
+import com.se.common.core.utils.file.FileTypeUtils;
+
+/**
+ * FastDFS 鏂囦欢瀛樺偍
+ *
+ * @author admin
+ */
+@Service
+public class FastDfsSysFileServiceImpl implements ISysFileService
+{
+    /**
+     * 鍩熷悕鎴栨湰鏈鸿闂湴鍧�
+     */
+    @Value("${fdfs.domain}")
+    public String domain;
+
+    @Autowired
+    private FastFileStorageClient storageClient;
+
+    /**
+     * FastDfs鏂囦欢涓婁紶鎺ュ彛
+     *
+     * @param file 涓婁紶鐨勬枃浠�
+     * @return 璁块棶鍦板潃
+     * @throws Exception
+     */
+    @Override
+    public String uploadFile(MultipartFile file) throws Exception
+    {
+        InputStream inputStream = file.getInputStream();
+        StorePath storePath = storageClient.uploadFile(inputStream, file.getSize(),
+                FileTypeUtils.getExtension(file), null);
+        IoUtils.closeQuietly(inputStream);
+        return domain + "/" + storePath.getFullPath();
+    }
+}
diff --git a/se-modules/se-docker/src/main/java/com/se/file/service/ISysFileService.java b/se-modules/se-docker/src/main/java/com/se/file/service/ISysFileService.java
new file mode 100644
index 0000000..9d4215e
--- /dev/null
+++ b/se-modules/se-docker/src/main/java/com/se/file/service/ISysFileService.java
@@ -0,0 +1,20 @@
+package com.se.file.service;
+
+import org.springframework.web.multipart.MultipartFile;
+
+/**
+ * 鏂囦欢涓婁紶鎺ュ彛
+ * 
+ * @author admin
+ */
+public interface ISysFileService
+{
+    /**
+     * 鏂囦欢涓婁紶鎺ュ彛
+     * 
+     * @param file 涓婁紶鐨勬枃浠�
+     * @return 璁块棶鍦板潃
+     * @throws Exception
+     */
+    public String uploadFile(MultipartFile file) throws Exception;
+}
diff --git a/se-modules/se-docker/src/main/java/com/se/file/service/LocalSysFileServiceImpl.java b/se-modules/se-docker/src/main/java/com/se/file/service/LocalSysFileServiceImpl.java
new file mode 100644
index 0000000..0ffaf52
--- /dev/null
+++ b/se-modules/se-docker/src/main/java/com/se/file/service/LocalSysFileServiceImpl.java
@@ -0,0 +1,50 @@
+package com.se.file.service;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Primary;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+import com.se.file.utils.FileUploadUtils;
+
+/**
+ * 鏈湴鏂囦欢瀛樺偍
+ * 
+ * @author admin
+ */
+@Primary
+@Service
+public class LocalSysFileServiceImpl implements ISysFileService
+{
+    /**
+     * 璧勬簮鏄犲皠璺緞 鍓嶇紑
+     */
+    @Value("${file.prefix}")
+    public String localFilePrefix;
+
+    /**
+     * 鍩熷悕鎴栨湰鏈鸿闂湴鍧�
+     */
+    @Value("${file.domain}")
+    public String domain;
+    
+    /**
+     * 涓婁紶鏂囦欢瀛樺偍鍦ㄦ湰鍦扮殑鏍硅矾寰�
+     */
+    @Value("${file.path}")
+    private String localFilePath;
+
+    /**
+     * 鏈湴鏂囦欢涓婁紶鎺ュ彛
+     * 
+     * @param file 涓婁紶鐨勬枃浠�
+     * @return 璁块棶鍦板潃
+     * @throws Exception
+     */
+    @Override
+    public String uploadFile(MultipartFile file) throws Exception
+    {
+        String name = FileUploadUtils.upload(localFilePath, file);
+        String url = domain + localFilePrefix + name;
+        return url;
+    }
+}
diff --git a/se-modules/se-docker/src/main/java/com/se/file/service/MinioSysFileServiceImpl.java b/se-modules/se-docker/src/main/java/com/se/file/service/MinioSysFileServiceImpl.java
new file mode 100644
index 0000000..cf7c1a1
--- /dev/null
+++ b/se-modules/se-docker/src/main/java/com/se/file/service/MinioSysFileServiceImpl.java
@@ -0,0 +1,50 @@
+package com.se.file.service;
+
+import java.io.InputStream;
+
+import com.se.file.config.MinioConfig;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+import com.alibaba.nacos.common.utils.IoUtils;
+import com.se.file.utils.FileUploadUtils;
+import io.minio.MinioClient;
+import io.minio.PutObjectArgs;
+
+/**
+ * Minio 鏂囦欢瀛樺偍
+ *
+ * @author admin
+ */
+@Service
+public class MinioSysFileServiceImpl implements ISysFileService
+{
+    @Autowired
+    private MinioConfig minioConfig;
+
+    @Autowired
+    private MinioClient client;
+
+    /**
+     * Minio鏂囦欢涓婁紶鎺ュ彛
+     *
+     * @param file 涓婁紶鐨勬枃浠�
+     * @return 璁块棶鍦板潃
+     * @throws Exception
+     */
+    @Override
+    public String uploadFile(MultipartFile file) throws Exception
+    {
+        String fileName = FileUploadUtils.extractFilename(file);
+        InputStream inputStream = file.getInputStream();
+        PutObjectArgs args = PutObjectArgs.builder()
+                .bucket(minioConfig.getBucketName())
+                .object(fileName)
+                .stream(inputStream, file.getSize(), -1)
+                .contentType(file.getContentType())
+                .build();
+        client.putObject(args);
+        IoUtils.closeQuietly(inputStream);
+        return minioConfig.getUrl() + "/" + minioConfig.getBucketName() + "/" + fileName;
+    }
+}
diff --git a/se-modules/se-docker/src/main/java/com/se/file/utils/FileUploadUtils.java b/se-modules/se-docker/src/main/java/com/se/file/utils/FileUploadUtils.java
new file mode 100644
index 0000000..c51548d
--- /dev/null
+++ b/se-modules/se-docker/src/main/java/com/se/file/utils/FileUploadUtils.java
@@ -0,0 +1,185 @@
+package com.se.file.utils;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Paths;
+import java.util.Objects;
+import org.apache.commons.io.FilenameUtils;
+import org.springframework.web.multipart.MultipartFile;
+import com.se.common.core.exception.file.FileException;
+import com.se.common.core.exception.file.FileNameLengthLimitExceededException;
+import com.se.common.core.exception.file.FileSizeLimitExceededException;
+import com.se.common.core.exception.file.InvalidExtensionException;
+import com.se.common.core.utils.DateUtils;
+import com.se.common.core.utils.StringUtils;
+import com.se.common.core.utils.file.FileTypeUtils;
+import com.se.common.core.utils.file.MimeTypeUtils;
+import com.se.common.core.utils.uuid.Seq;
+
+/**
+ * 鏂囦欢涓婁紶宸ュ叿绫�
+ * 
+ * @author admin
+ */
+public class FileUploadUtils
+{
+    /**
+     * 榛樿澶у皬 50M
+     */
+    public static final long DEFAULT_MAX_SIZE = 50 * 1024 * 1024L;
+
+    /**
+     * 榛樿鐨勬枃浠跺悕鏈�澶ч暱搴� 100
+     */
+    public static final int DEFAULT_FILE_NAME_LENGTH = 100;
+
+    /**
+     * 鏍规嵁鏂囦欢璺緞涓婁紶
+     *
+     * @param baseDir 鐩稿搴旂敤鐨勫熀鐩綍
+     * @param file 涓婁紶鐨勬枃浠�
+     * @return 鏂囦欢鍚嶇О
+     * @throws IOException
+     */
+    public static final String upload(String baseDir, MultipartFile file) throws IOException
+    {
+        try
+        {
+            return upload(baseDir, file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION);
+        }
+        catch (FileException fe)
+        {
+            throw new IOException(fe.getDefaultMessage(), fe);
+        }
+        catch (Exception e)
+        {
+            throw new IOException(e.getMessage(), e);
+        }
+    }
+
+    /**
+     * 鏂囦欢涓婁紶
+     *
+     * @param baseDir 鐩稿搴旂敤鐨勫熀鐩綍
+     * @param file 涓婁紶鐨勬枃浠�
+     * @param allowedExtension 涓婁紶鏂囦欢绫诲瀷
+     * @return 杩斿洖涓婁紶鎴愬姛鐨勬枃浠跺悕
+     * @throws FileSizeLimitExceededException 濡傛灉瓒呭嚭鏈�澶уぇ灏�
+     * @throws FileNameLengthLimitExceededException 鏂囦欢鍚嶅お闀�
+     * @throws IOException 姣斿璇诲啓鏂囦欢鍑洪敊鏃�
+     * @throws InvalidExtensionException 鏂囦欢鏍¢獙寮傚父
+     */
+    public static final String upload(String baseDir, MultipartFile file, String[] allowedExtension)
+            throws FileSizeLimitExceededException, IOException, FileNameLengthLimitExceededException,
+            InvalidExtensionException
+    {
+        int fileNamelength = Objects.requireNonNull(file.getOriginalFilename()).length();
+        if (fileNamelength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH)
+        {
+            throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH);
+        }
+
+        assertAllowed(file, allowedExtension);
+
+        String fileName = extractFilename(file);
+
+        String absPath = getAbsoluteFile(baseDir, fileName).getAbsolutePath();
+        file.transferTo(Paths.get(absPath));
+        return getPathFileName(fileName);
+    }
+
+    /**
+     * 缂栫爜鏂囦欢鍚�
+     */
+    public static final String extractFilename(MultipartFile file)
+    {
+        return StringUtils.format("{}/{}_{}.{}", DateUtils.datePath(),
+                FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), FileTypeUtils.getExtension(file));
+    }
+
+    private static final File getAbsoluteFile(String uploadDir, String fileName) throws IOException
+    {
+        File desc = new File(uploadDir + File.separator + fileName);
+
+        if (!desc.exists())
+        {
+            if (!desc.getParentFile().exists())
+            {
+                desc.getParentFile().mkdirs();
+            }
+        }
+        return desc.isAbsolute() ? desc : desc.getAbsoluteFile();
+    }
+
+    private static final String getPathFileName(String fileName) throws IOException
+    {
+        String pathFileName = "/" + fileName;
+        return pathFileName;
+    }
+
+    /**
+     * 鏂囦欢澶у皬鏍¢獙
+     *
+     * @param file 涓婁紶鐨勬枃浠�
+     * @throws FileSizeLimitExceededException 濡傛灉瓒呭嚭鏈�澶уぇ灏�
+     * @throws InvalidExtensionException 鏂囦欢鏍¢獙寮傚父
+     */
+    public static final void assertAllowed(MultipartFile file, String[] allowedExtension)
+            throws FileSizeLimitExceededException, InvalidExtensionException
+    {
+        long size = file.getSize();
+        if (size > DEFAULT_MAX_SIZE)
+        {
+            throw new FileSizeLimitExceededException(DEFAULT_MAX_SIZE / 1024 / 1024);
+        }
+
+        String fileName = file.getOriginalFilename();
+        String extension = FileTypeUtils.getExtension(file);
+        if (allowedExtension != null && !isAllowedExtension(extension, allowedExtension))
+        {
+            if (allowedExtension == MimeTypeUtils.IMAGE_EXTENSION)
+            {
+                throw new InvalidExtensionException.InvalidImageExtensionException(allowedExtension, extension,
+                        fileName);
+            }
+            else if (allowedExtension == MimeTypeUtils.FLASH_EXTENSION)
+            {
+                throw new InvalidExtensionException.InvalidFlashExtensionException(allowedExtension, extension,
+                        fileName);
+            }
+            else if (allowedExtension == MimeTypeUtils.MEDIA_EXTENSION)
+            {
+                throw new InvalidExtensionException.InvalidMediaExtensionException(allowedExtension, extension,
+                        fileName);
+            }
+            else if (allowedExtension == MimeTypeUtils.VIDEO_EXTENSION)
+            {
+                throw new InvalidExtensionException.InvalidVideoExtensionException(allowedExtension, extension,
+                        fileName);
+            }
+            else
+            {
+                throw new InvalidExtensionException(allowedExtension, extension, fileName);
+            }
+        }
+    }
+
+    /**
+     * 鍒ゆ柇MIME绫诲瀷鏄惁鏄厑璁哥殑MIME绫诲瀷
+     *
+     * @param extension 涓婁紶鏂囦欢绫诲瀷
+     * @param allowedExtension 鍏佽涓婁紶鏂囦欢绫诲瀷
+     * @return true/false
+     */
+    public static final boolean isAllowedExtension(String extension, String[] allowedExtension)
+    {
+        for (String str : allowedExtension)
+        {
+            if (str.equalsIgnoreCase(extension))
+            {
+                return true;
+            }
+        }
+        return false;
+    }
+}
\ No newline at end of file
diff --git a/se-modules/se-docker/src/main/resources/banner.txt b/se-modules/se-docker/src/main/resources/banner.txt
new file mode 100644
index 0000000..9504136
--- /dev/null
+++ b/se-modules/se-docker/src/main/resources/banner.txt
@@ -0,0 +1,3 @@
+Spring Boot Version: ${spring-boot.version}
+Spring Application Name: ${spring.application.name}
+SeFileApplication锛屽凡缁忓惎鍔�
\ No newline at end of file
diff --git a/se-modules/se-docker/src/main/resources/bootstrap.yml b/se-modules/se-docker/src/main/resources/bootstrap.yml
new file mode 100644
index 0000000..3204f87
--- /dev/null
+++ b/se-modules/se-docker/src/main/resources/bootstrap.yml
@@ -0,0 +1,27 @@
+# Tomcat
+server:
+  port: 9300
+
+# Spring
+spring: 
+  application:
+    # 搴旂敤鍚嶇О
+    name: se-file
+  profiles:
+    # 鐜閰嶇疆
+    active: dev
+  cloud:
+    nacos:
+      username: nacos
+      password: nAcos_!9#_admIn
+      discovery:
+        # 鏈嶅姟娉ㄥ唽鍦板潃
+        server-addr: 127.0.0.1:8848
+      config:
+        # 閰嶇疆涓績鍦板潃
+        server-addr: 127.0.0.1:8848
+        # 閰嶇疆鏂囦欢鏍煎紡
+        file-extension: yml
+        # 鍏变韩閰嶇疆
+        shared-configs:
+          - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
diff --git a/se-modules/se-docker/src/main/resources/logback.xml b/se-modules/se-docker/src/main/resources/logback.xml
new file mode 100644
index 0000000..46941d6
--- /dev/null
+++ b/se-modules/se-docker/src/main/resources/logback.xml
@@ -0,0 +1,74 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration scan="true" scanPeriod="60 seconds" debug="false">
+    <!-- 鏃ュ織瀛樻斁璺緞 -->
+	<property name="log.path" value="logs/se-file" />
+   <!-- 鏃ュ織杈撳嚭鏍煎紡 -->
+	<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n" />
+
+    <!-- 鎺у埗鍙拌緭鍑� -->
+	<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
+		<encoder>
+			<pattern>${log.pattern}</pattern>
+		</encoder>
+	</appender>
+
+    <!-- 绯荤粺鏃ュ織杈撳嚭 -->
+	<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
+	    <file>${log.path}/info.log</file>
+        <!-- 寰幆鏀跨瓥锛氬熀浜庢椂闂村垱寤烘棩蹇楁枃浠� -->
+		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!-- 鏃ュ織鏂囦欢鍚嶆牸寮� -->
+			<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
+			<!-- 鏃ュ織鏈�澶х殑鍘嗗彶 60澶� -->
+			<maxHistory>60</maxHistory>
+		</rollingPolicy>
+		<encoder>
+			<pattern>${log.pattern}</pattern>
+		</encoder>
+		<filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <!-- 杩囨护鐨勭骇鍒� -->
+            <level>INFO</level>
+            <!-- 鍖归厤鏃剁殑鎿嶄綔锛氭帴鏀讹紙璁板綍锛� -->
+            <onMatch>ACCEPT</onMatch>
+            <!-- 涓嶅尮閰嶆椂鐨勬搷浣滐細鎷掔粷锛堜笉璁板綍锛� -->
+            <onMismatch>DENY</onMismatch>
+        </filter>
+	</appender>
+
+    <appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
+	    <file>${log.path}/error.log</file>
+        <!-- 寰幆鏀跨瓥锛氬熀浜庢椂闂村垱寤烘棩蹇楁枃浠� -->
+        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+            <!-- 鏃ュ織鏂囦欢鍚嶆牸寮� -->
+            <fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
+			<!-- 鏃ュ織鏈�澶х殑鍘嗗彶 60澶� -->
+			<maxHistory>60</maxHistory>
+        </rollingPolicy>
+        <encoder>
+            <pattern>${log.pattern}</pattern>
+        </encoder>
+        <filter class="ch.qos.logback.classic.filter.LevelFilter">
+            <!-- 杩囨护鐨勭骇鍒� -->
+            <level>ERROR</level>
+			<!-- 鍖归厤鏃剁殑鎿嶄綔锛氭帴鏀讹紙璁板綍锛� -->
+            <onMatch>ACCEPT</onMatch>
+			<!-- 涓嶅尮閰嶆椂鐨勬搷浣滐細鎷掔粷锛堜笉璁板綍锛� -->
+            <onMismatch>DENY</onMismatch>
+        </filter>
+    </appender>
+
+    <!-- 绯荤粺妯″潡鏃ュ織绾у埆鎺у埗  -->
+	<logger name="com.se" level="info" />
+	<!-- Spring鏃ュ織绾у埆鎺у埗  -->
+	<logger name="org.springframework" level="warn" />
+
+	<root level="info">
+		<appender-ref ref="console" />
+	</root>
+	
+	<!--绯荤粺鎿嶄綔鏃ュ織-->
+    <root level="info">
+        <appender-ref ref="file_info" />
+        <appender-ref ref="file_error" />
+    </root>
+</configuration>
\ No newline at end of file
diff --git "a/\350\257\264\346\230\216.txt" "b/\350\257\264\346\230\216.txt"
index bc5723d..8c5faf3 100644
--- "a/\350\257\264\346\230\216.txt"
+++ "b/\350\257\264\346\230\216.txt"
@@ -6,6 +6,9 @@
 
 java 鑷畾涔夎蒋浠惰鍙�
 https://blog.csdn.net/a1374469523/article/details/138667196
+
+# 鏄犲皠瀹夸富鏈篸ocker濂楁帴瀛�
+-v /var/run/docker.sock:/var/run/docker.sock
 --------------------------------------------------------
   user_name         varchar(30)     not null                   comment '鐢ㄦ埛璐﹀彿',
   nick_name         varchar(30)     not null                   comment '鐢ㄦ埛濮撳悕',

--
Gitblit v1.9.3