1
13693261870
2024-12-08 a4610dbd98e8525e189e2b8a99034ec076d0b742
1
已添加13个文件
已修改2个文件
750 ■■■■■ 文件已修改
se-modules/pom.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
se-modules/se-docker/pom.xml 89 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
se-modules/se-docker/src/main/java/com/se/file/SeFileApplication.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
se-modules/se-docker/src/main/java/com/se/file/config/MinioConfig.java 82 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
se-modules/se-docker/src/main/java/com/se/file/config/ResourcesConfig.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
se-modules/se-docker/src/main/java/com/se/file/controller/SysFileController.java 48 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
se-modules/se-docker/src/main/java/com/se/file/service/FastDfsSysFileServiceImpl.java 46 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
se-modules/se-docker/src/main/java/com/se/file/service/ISysFileService.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
se-modules/se-docker/src/main/java/com/se/file/service/LocalSysFileServiceImpl.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
se-modules/se-docker/src/main/java/com/se/file/service/MinioSysFileServiceImpl.java 50 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
se-modules/se-docker/src/main/java/com/se/file/utils/FileUploadUtils.java 185 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
se-modules/se-docker/src/main/resources/banner.txt 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
se-modules/se-docker/src/main/resources/bootstrap.yml 27 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
se-modules/se-docker/src/main/resources/logback.xml 74 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
说明.txt 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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>-->
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>
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("    æ–‡ä»¶æ¨¡å—启动成功    ");
    }
}
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();
    }
}
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");
    }
}
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());
        }
    }
}
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();
    }
}
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;
}
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;
    }
}
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;
    }
}
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;
    }
}
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,已经启动
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}
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>
˵Ã÷.txt
@@ -6,6 +6,9 @@
java è‡ªå®šä¹‰è½¯ä»¶è®¸å¯
https://blog.csdn.net/a1374469523/article/details/138667196
# æ˜ å°„宿主机docker套接字
-v /var/run/docker.sock:/var/run/docker.sock
--------------------------------------------------------
  user_name         varchar(30)     not null                   comment '用户账号',
  nick_name         varchar(30)     not null                   comment '用户姓名',