소스 검색

项目初始化

xucaiqin 1 년 전
부모
커밋
2a519ce115

+ 265 - 0
pom.xml

@@ -0,0 +1,265 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>com.sckw</groupId>
+    <artifactId>freight-settlement</artifactId>
+    <version>1.0.0</version>
+
+    <description>数货运结</description>
+    <properties>
+        <maven.compiler.source>17</maven.compiler.source>
+        <maven.compiler.target>17</maven.compiler.target>
+        <maven.compiler.compilerVersion>17</maven.compiler.compilerVersion>
+        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+        <!--依赖相关配置-->
+        <spring-boot.version>3.0.5</spring-boot.version>
+        <!--maven相关插件配置-->
+        <start-class>com.sckw.freight.FreightApplication</start-class>
+        <maven-clean-plugin.version>3.2.0</maven-clean-plugin.version>
+        <maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
+        <maven-jar-plugin.version>3.3.0</maven-jar-plugin.version>
+        <maven-resources-plugin.version>3.3.0</maven-resources-plugin.version>
+        <maven-install-plugin.version>3.0.1</maven-install-plugin.version>
+        <maven-deploy-plugin.version>3.0.0</maven-deploy-plugin.version>
+
+    </properties>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-dependencies</artifactId>
+                <version>${spring-boot.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+        <!--lombok-->
+        <dependency>
+            <groupId>org.projectlombok</groupId>
+            <artifactId>lombok</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <!--spring-boot-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter</artifactId>
+            <exclusions>
+                <exclusion>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-starter-logging</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <!--log4j2日志框架-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-log4j2</artifactId>
+        </dependency>
+        <!--autoconfigure-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-configuration-processor</artifactId>
+            <optional>true</optional>
+        </dependency>
+        <!--validation-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-validation</artifactId>
+        </dependency>
+        <!--web-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-web</artifactId>
+            <!--排除tomcat-->
+            <exclusions>
+                <exclusion>
+                    <artifactId>spring-boot-starter-tomcat</artifactId>
+                    <groupId>org.springframework.boot</groupId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <!--undertow-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-undertow</artifactId>
+        </dependency>
+        <!--fastjson-->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>fastjson</artifactId>
+            <version>2.0.24</version>
+        </dependency>
+        <!--redis-->
+        <dependency>
+            <groupId>org.springframework.boot</groupId>
+            <artifactId>spring-boot-starter-data-redis</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-pool2</artifactId>
+        </dependency>
+        <!--mybatis-plus-->
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus-boot-starter</artifactId>
+            <version>3.5.3</version>
+        </dependency>
+        <dependency>
+            <groupId>com.baomidou</groupId>
+            <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
+            <version>3.6.1</version>
+        </dependency>
+        <!--druid-->
+        <dependency>
+            <groupId>com.alibaba</groupId>
+            <artifactId>druid-spring-boot-starter</artifactId>
+            <version>1.2.18</version>
+        </dependency>
+        <!--mysql-->
+        <dependency>
+            <groupId>com.mysql</groupId>
+            <artifactId>mysql-connector-j</artifactId>
+        </dependency>
+        <!--commons-lang3-->
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-lang3</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>com.squareup.okhttp3</groupId>
+            <artifactId>okhttp</artifactId>
+            <version>4.9.1</version>
+        </dependency>
+    </dependencies>
+
+
+    <build>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-clean-plugin</artifactId>
+                    <version>${maven-clean-plugin.version}</version>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-compiler-plugin</artifactId>
+                    <version>${maven-compiler-plugin.version}</version>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-deploy-plugin</artifactId>
+                    <version>${maven-deploy-plugin.version}</version>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-install-plugin</artifactId>
+                    <version>${maven-install-plugin.version}</version>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-jar-plugin</artifactId>
+                    <version>${maven-jar-plugin.version}</version>
+                </plugin>
+                <plugin>
+                    <groupId>org.apache.maven.plugins</groupId>
+                    <artifactId>maven-resources-plugin</artifactId>
+                    <version>${maven-resources-plugin.version}</version>
+                    <configuration>
+                        <propertiesEncoding>${project.build.sourceEncoding}</propertiesEncoding>
+                        <delimiters>
+                            <delimiter>@</delimiter>
+                        </delimiters>
+                        <useDefaultDelimiters>false</useDefaultDelimiters>
+                    </configuration>
+                </plugin>
+                <plugin>
+                    <groupId>org.springframework.boot</groupId>
+                    <artifactId>spring-boot-maven-plugin</artifactId>
+                    <version>${spring-boot.version}</version>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+        <plugins>
+            <plugin>
+                <groupId>org.springframework.boot</groupId>
+                <artifactId>spring-boot-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>repackage</id>
+                        <goals>
+                            <goal>repackage</goal>
+                        </goals>
+                    </execution>
+                </executions>
+                <configuration>
+                    <excludes>
+                        <exclude>
+                            <groupId>org.projectlombok</groupId>
+                            <artifactId>lombok</artifactId>
+                        </exclude>
+                    </excludes>
+                    <mainClass>${start-class}</mainClass>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>17</source>
+                    <target>17</target>
+                    <encoding>UTF-8</encoding>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <configuration>
+                    <archive>
+                        <manifest>
+                            <mainClass>${start-class}</mainClass>
+                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+                        </manifest>
+                    </archive>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-resources-plugin</artifactId>
+                <configuration>
+                    <propertiesEncoding>${project.build.sourceEncoding}</propertiesEncoding>
+                    <delimiters>
+                        <delimiter>@</delimiter>
+                    </delimiters>
+                    <useDefaultDelimiters>false</useDefaultDelimiters>
+                </configuration>
+            </plugin>
+        </plugins>
+
+        <resources>
+            <resource>
+                <!-- xml放在java目录下-->
+                <directory>src/main/java</directory>
+                <includes>
+                    <include>**/*.xml</include>
+                </includes>
+            </resource>
+            <resource>
+                <directory>src/main/resources</directory>
+                <includes>
+                    <include>**/*.properties</include>
+                    <!-- 配置一下yml文件 -->
+                    <include>**/*.yml</include>
+                    <include>**/*.xml</include>
+                </includes>
+                <filtering>false</filtering>
+            </resource>
+        </resources>
+    </build>
+</project>

+ 15 - 0
src/main/java/com/sckw/freight/FreightApplication.java

@@ -0,0 +1,15 @@
+package com.sckw.freight;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+/**
+ * @Author xucaiqin
+ * @date 2023-06-13 09:14:25
+ */
+@SpringBootApplication
+public class FreightApplication {
+    public static void main(String[] args) {
+        SpringApplication.run(FreightApplication.class, args);
+    }
+}

+ 71 - 0
src/main/java/com/sckw/freight/config/GlobalExceptionHandler.java

@@ -0,0 +1,71 @@
+package com.sckw.freight.config;
+
+
+import com.sckw.freight.exception.BusinessException;
+import com.sckw.freight.util.R;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.http.HttpStatus;
+import org.springframework.validation.BindException;
+import org.springframework.validation.BindingResult;
+import org.springframework.validation.FieldError;
+import org.springframework.web.bind.annotation.ExceptionHandler;
+import org.springframework.web.bind.annotation.ResponseStatus;
+import org.springframework.web.bind.annotation.RestControllerAdvice;
+
+/**
+ * API网关层,统一异常处理
+ *
+ * @author xcq
+ * @date 2023-02-17 16:07:15
+ * @description
+ **/
+@Slf4j
+@RestControllerAdvice
+public class GlobalExceptionHandler {
+    /**
+     * 全局异常处理 500
+     *
+     * @param ex
+     * @return
+     */
+    @ResponseStatus(code = HttpStatus.INTERNAL_SERVER_ERROR)
+    @ExceptionHandler(value = Exception.class)
+    public R<String> exceptionHandler(Exception ex) {
+        ex.printStackTrace();
+        log.error("全局异常处理:{}", ex.getMessage());
+        return R.failed( ex.getMessage());
+    }
+
+    /**
+     * 业务异常处理 200
+     *
+     * @param ex
+     * @return
+     */
+    @ResponseStatus(code = HttpStatus.OK)
+    @ExceptionHandler(value = BusinessException.class)
+    public R<String> businessHandler(Exception ex) {
+        log.error("业务异常处理:{}", ex.getMessage());
+        return R.failed(ex.getMessage());
+    }
+
+    /**
+     * 参数异常 400
+     *
+     * @param ex
+     * @return
+     */
+    @ResponseStatus(code = HttpStatus.BAD_REQUEST)
+    @ExceptionHandler(value = BindException.class)
+    public R<Object> bindHandler(BindException ex) {
+        log.error("BindException :{}", ex.getMessage());
+        BindingResult bindingResult = ex.getBindingResult();
+        StringBuilder msg = new StringBuilder();
+        for (FieldError fieldError : bindingResult.getFieldErrors()) {
+            msg.append(fieldError.getDefaultMessage());
+        }
+        return R.failed(msg.toString());
+    }
+
+
+}

+ 40 - 0
src/main/java/com/sckw/freight/config/MybatisPlusConfig.java

@@ -0,0 +1,40 @@
+package com.sckw.freight.config;
+
+import com.baomidou.mybatisplus.annotation.DbType;
+import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
+import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import java.util.Collections;
+
+/**
+ * @Author xucaiqin
+ * @date 2023-06-14 09:01:59
+ */
+@Configuration
+public class MybatisPlusConfig {
+    /**
+     * 分页插件 3.5.X
+     *
+     * @author Administrator
+     * @date 2023-02-21 08:37:21
+     **/
+    @Bean
+    public PaginationInnerInterceptor paginationInnerInterceptor() {
+        PaginationInnerInterceptor paginationInterceptor = new PaginationInnerInterceptor();
+        // 设置最大单页限制数量,默认 500 条,-1 不受限制
+        paginationInterceptor.setMaxLimit(200L);
+        paginationInterceptor.setDbType(DbType.MYSQL);
+        // 开启 count 的 join 优化,只针对部分 left join
+        paginationInterceptor.setOptimizeJoin(true);
+        return paginationInterceptor;
+    }
+
+    @Bean
+    public MybatisPlusInterceptor mybatisPlusInterceptor() {
+        MybatisPlusInterceptor mybatisPlusInterceptor = new MybatisPlusInterceptor();
+        mybatisPlusInterceptor.setInterceptors(Collections.singletonList(paginationInnerInterceptor()));
+        return mybatisPlusInterceptor;
+    }
+}

+ 58 - 0
src/main/java/com/sckw/freight/config/RedisConfig.java

@@ -0,0 +1,58 @@
+package com.sckw.freight.config;
+
+
+import com.fasterxml.jackson.annotation.JsonAutoDetect;
+import com.fasterxml.jackson.annotation.PropertyAccessor;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator;
+import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.data.redis.connection.RedisConnectionFactory;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
+import org.springframework.data.redis.serializer.StringRedisSerializer;
+
+/**
+ * 注入RedisTemplate<String,Object>
+ */
+@Configuration
+public class RedisConfig {
+
+    /**
+     * jackson序列化方式的redisTemplate
+     *
+     * @param redisConnectionFactory
+     * @return
+     */
+    @Bean
+    public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
+        RedisTemplate<String, Object> redisTemplate = new RedisTemplate<>();
+        redisTemplate.setConnectionFactory(redisConnectionFactory);
+        // 设置值(value)的序列化采用jackson
+        redisTemplate.setValueSerializer(serializer());
+        redisTemplate.setHashValueSerializer(serializer());
+
+        // 设置键(key)的序列化采用StringRedisSerializer。
+        redisTemplate.setKeySerializer(new StringRedisSerializer());
+        redisTemplate.setHashKeySerializer(new StringRedisSerializer());
+        redisTemplate.afterPropertiesSet();
+        return redisTemplate;
+    }
+
+
+    private Jackson2JsonRedisSerializer<Object> serializer() {
+        // 使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值
+        ObjectMapper objectMapper = new ObjectMapper();
+        // 解决jackson2无法序列化LocalDateTime问题
+        objectMapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
+        objectMapper.registerModule(new JavaTimeModule());
+        // 指定要序列化的域,field,get和set,以及修饰符范围,ANY是都有包括private和public
+        objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
+
+        // 指定序列化输入的类型,类必须是非final修饰的,final修饰的类,比如String,Integer等会跑出异常
+        objectMapper.activateDefaultTyping(LaissezFaireSubTypeValidator.instance, ObjectMapper.DefaultTyping.NON_FINAL);
+        return new Jackson2JsonRedisSerializer<>(objectMapper, Object.class);
+    }
+}

+ 25 - 0
src/main/java/com/sckw/freight/controller/IndexController.java

@@ -0,0 +1,25 @@
+package com.sckw.freight.controller;
+
+import com.sckw.freight.util.DateTimeUtil;
+import com.sckw.freight.util.R;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * @Author xucaiqin
+ * @date 2023-06-13 09:12:32
+ */
+@RestController
+@RequestMapping("/index")
+@Slf4j
+public class IndexController {
+
+    @GetMapping("")
+    public R<String> index() {
+        return R.ok(DateTimeUtil.formatYMD());
+    }
+
+
+}

+ 39 - 0
src/main/java/com/sckw/freight/exception/BusinessException.java

@@ -0,0 +1,39 @@
+package com.sckw.freight.exception;
+
+/**
+ * 业务异常
+ *
+ * @author xcq
+ * @date 2023-02-22 13:54:05
+ **/
+public class BusinessException extends RuntimeException {
+    private int code;
+    private String message;
+
+    public int getCode() {
+        return code;
+    }
+
+    public void setCode(int code) {
+        this.code = code;
+    }
+
+    @Override
+    public String getMessage() {
+        return message;
+    }
+
+    public void setMessage(String message) {
+        this.message = message;
+    }
+
+    public BusinessException() {
+        this.code = 500;
+    }
+
+    public BusinessException(String message) {
+        super(message);
+        this.message = message;
+        this.code = 500;
+    }
+}

+ 28 - 0
src/main/java/com/sckw/freight/util/DateTimeUtil.java

@@ -0,0 +1,28 @@
+package com.sckw.freight.util;
+
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+
+/**
+ * @author xcq
+ * @date 2022年07月29日 18:06
+ */
+public class DateTimeUtil {
+    public static String format(LocalDateTime localDateTime, String pattern) {
+        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(pattern);
+        return dateTimeFormatter.format(localDateTime);
+    }
+
+    public static String formatYMD(LocalDateTime localDateTime) {
+        return format(localDateTime, "yyyy-MM-dd HH:mm:ss");
+    }
+
+    public static String formatYMD() {
+        return format(LocalDateTime.now(), "yyyy-MM-dd");
+    }
+
+    public static LocalDateTime parse(String localDateTime) {
+        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+        return LocalDateTime.parse(localDateTime, dateTimeFormatter);
+    }
+}

+ 21 - 0
src/main/java/com/sckw/freight/util/DecimalUtil.java

@@ -0,0 +1,21 @@
+package com.sckw.freight.util;
+
+import java.math.BigDecimal;
+import java.math.RoundingMode;
+import java.util.Objects;
+
+/**
+ * @Author xucaiqin
+ * @date 2023-06-20 14:54:24
+ */
+public class DecimalUtil {
+    public static BigDecimal divide(BigDecimal a, BigDecimal b) {
+        if (Objects.isNull(a)) {
+            return new BigDecimal("0.00");
+        }
+        if (Objects.isNull(b) || BigDecimal.ZERO.compareTo(b) == 0) {
+            b = new BigDecimal("1.00");
+        }
+        return a.divide(b, RoundingMode.CEILING);
+    }
+}

+ 41 - 0
src/main/java/com/sckw/freight/util/IdUtil.java

@@ -0,0 +1,41 @@
+package com.sckw.freight.util;
+
+import java.util.Random;
+import java.util.UUID;
+
+public class IdUtil {
+    public static String randomUUID() {
+        return UUID.randomUUID().toString();
+    }
+
+    /**
+     * 返回没有-的uuid
+     *
+     * @return
+     */
+    public static String UUID() {
+        return randomUUID().replaceAll("-", "");
+    }
+
+    public static String UUID(int len) {
+        return UUID().substring(0, len);
+    }
+
+    public static int code(int len) {
+        Random random = new Random();
+        int min = (int) Math.pow(10, len - 1);
+        int max = (int) Math.pow(10, len) - 1;
+        return random.nextInt(max - min + 1) + min;
+    }
+
+    /**
+     * 返回随机生成的四位数
+     *
+     * @return 返回随机生成的四位数
+     */
+    public static int code() {
+        return code(4);
+    }
+
+
+}

+ 156 - 0
src/main/java/com/sckw/freight/util/MD5Util.java

@@ -0,0 +1,156 @@
+package com.sckw.freight.util;
+
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang3.StringUtils;
+
+import java.nio.charset.StandardCharsets;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+/**
+ * MD5 消息摘要算法(利用哈希算法来加密的)
+ *
+ * @author xcq
+ * @date 2022年07月27日 20:04
+ */
+@Slf4j
+public class MD5Util {
+    //十六进制下数字到字符的映射数组
+    private final static String[] HEX_DIGITS = {"0", "1", "2", "3", "4",
+            "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f"};
+
+    /**
+     * 计算字符串的MD5值
+     *
+     * @param string 明文
+     * @return md5摘要
+     */
+    public static String encodeByMD5(String string) {
+        if (string != null) {
+            try {
+                //创建具有指定算法名称的信息摘要
+                MessageDigest md = MessageDigest.getInstance("MD5");
+                //使用指定的字节数组对摘要进行最后更新,然后完成摘要计算
+                byte[] results = md.digest(string.getBytes());
+                //将得到的字节数组变成字符串返回
+                StringBuilder sb = new StringBuilder();
+                for (int j : results) {
+                    int n = j;
+                    if (n < 0) {
+                        n = 256 + n;
+                    }
+                    int d1 = n / 16;
+                    int d2 = n % 16;
+                    sb.append(HEX_DIGITS[d1]).append(HEX_DIGITS[d2]);
+                }
+                return sb.toString();
+            } catch (Exception ex) {
+                ex.printStackTrace();
+            }
+        }
+        return null;
+    }
+
+    /**
+     * 计算字符串的MD5值
+     *
+     * @param string 明文
+     * @return md5摘要
+     */
+    public static String md5(String string) {
+        if (string.isEmpty()) {
+            return "";
+        }
+        MessageDigest md5;
+        try {
+            md5 = MessageDigest.getInstance("MD5");
+            byte[] bytes = md5.digest(string.getBytes(StandardCharsets.UTF_8));
+            StringBuilder result = new StringBuilder();
+            for (byte b : bytes) {
+                /* & 0xff 可以将负数转为正数*/
+                String temp = Integer.toHexString(b & 0xff);
+                // 16进制数 temp小于16
+                if (temp.length() == 1) {
+                    temp = "0" + temp;
+                }
+                result.append(temp);
+            }
+            return result.toString();
+        } catch (NoSuchAlgorithmException e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    /*其它方法*/
+
+    /**
+     * md5摘要
+     *
+     * @param s 需要转换的字符串
+     * @return 返回字节形式的md5摘要数据
+     */
+    public static byte[] byteMD5(String s) {
+        MessageDigest md;
+        try {
+            md = MessageDigest.getInstance("MD5");
+            md.reset();
+            md.update(s.getBytes(StandardCharsets.UTF_8));
+            return md.digest();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    /**
+     * 将字节数据转换为16进制的字符串数据
+     *
+     * @param hash 转换后的字节数组
+     * @return 返回16进制的字符串
+     */
+    public static String byteToHex(byte[] hash) {
+        if (hash == null) {
+            return null;
+        }
+        StringBuffer buf = new StringBuffer(hash.length * 2);
+        int i;
+
+        for (i = 0; i < hash.length; i++) {
+            /* & 0xff 可以将负数转为正数*/
+            /* <0x10 表示小于16,需要进行补零*/
+            if ((hash[i] & 0xff) < 0x10) {
+                buf.append("0");
+            }
+            buf.append(Long.toString(hash[i] & 0xff, 16));
+        }
+        return buf.toString();
+    }
+
+    /**
+     * 将字节数组转换为十六进制字符串
+     *
+     * @param data 待转换的字节数组
+     * @return 转换后的十六进制字符串
+     */
+    private static String toHexString(byte[] data) {
+        StringBuilder sb = new StringBuilder();
+        for (byte b : data) {
+            sb.append(String.format("%02X", b));
+        }
+        return sb.toString();
+    }
+
+    /**
+     * 验证MD5校验值是否正确
+     *
+     * @param data       待验证的数据
+     * @param md5ToCheck 待验证的MD5校验值
+     * @return true表示校验通过,false表示校验失败
+     */
+    public static boolean verifyMD5(String data, String md5ToCheck) {
+        String check = md5(data);
+        return StringUtils.equals(check, md5ToCheck);
+    }
+
+}

+ 384 - 0
src/main/java/com/sckw/freight/util/OkHttpUtils.java

@@ -0,0 +1,384 @@
+package com.sckw.freight.util;
+
+import com.alibaba.fastjson.JSONObject;
+import lombok.extern.slf4j.Slf4j;
+import okhttp3.*;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.util.CollectionUtils;
+import org.springframework.web.multipart.MultipartFile;
+
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSocketFactory;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+import java.io.IOException;
+import java.net.URLEncoder;
+import java.nio.charset.StandardCharsets;
+import java.security.SecureRandom;
+import java.security.cert.X509Certificate;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * @author xcq
+ * @date 2023-02-21 10:42:20
+ **/
+@Slf4j
+public class OkHttpUtils {
+
+    private static volatile OkHttpClient okHttpClient = null;
+    private static volatile Semaphore semaphore = null;
+    private Map<String, String> headerMap;
+    private Map<String, String> paraMap;
+    private Map<String, String> bodyParaMap;
+    //json字符串
+    private String bodyParaString;
+    private String url;
+    private Request.Builder request;
+
+    /**
+     * 初始化okHttpClient,并且允许https访问
+     */
+    private OkHttpUtils() {
+        if (okHttpClient == null) {
+            synchronized (OkHttpUtils.class) {
+                if (okHttpClient == null) {
+                    TrustManager[] trustManagers = buildTrustManagers();
+                    okHttpClient = new OkHttpClient.Builder()
+                            .connectTimeout(15, TimeUnit.SECONDS)
+                            .writeTimeout(20, TimeUnit.SECONDS)
+                            .readTimeout(20, TimeUnit.SECONDS)
+                            .sslSocketFactory(createSSLSocketFactory(trustManagers), (X509TrustManager) trustManagers[0])
+                            .hostnameVerifier((hostName, session) -> true)
+                            .retryOnConnectionFailure(true)
+                            .build();
+                    addHeader("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36");
+                }
+            }
+        }
+    }
+
+    /**
+     * 用于异步请求时,控制访问线程数,返回结果
+     *
+     * @return
+     */
+    private static Semaphore getSemaphoreInstance() {
+        //只能1个线程同时访问
+        synchronized (OkHttpUtils.class) {
+            if (semaphore == null) {
+                semaphore = new Semaphore(0);
+            }
+        }
+        return semaphore;
+    }
+
+    /**
+     * 创建OkHttpUtils
+     *
+     * @return
+     */
+    public static OkHttpUtils builder() {
+        return new OkHttpUtils();
+    }
+
+    /**
+     * 添加url
+     *
+     * @param url
+     * @return
+     */
+    public OkHttpUtils url(String url) {
+        this.url = url;
+        return this;
+    }
+
+    /**
+     * 添加参数
+     *
+     * @param key   参数名
+     * @param value 参数值
+     * @return
+     */
+    public OkHttpUtils addPara(String key, String value) {
+        if (paraMap == null) {
+            paraMap = new LinkedHashMap<>(16);
+        }
+        paraMap.put(key, value);
+        return this;
+    }
+
+    /**
+     * 添加参数
+     *
+     * @param key   参数名
+     * @param value 参数值
+     * @return
+     */
+    public OkHttpUtils addBodyPara(String key, String value) {
+        if (bodyParaMap == null) {
+            bodyParaMap = new LinkedHashMap<>(16);
+        }
+        bodyParaMap.put(key, value);
+        return this;
+    }
+
+    public OkHttpUtils addBodyJsonStr(String string) {
+        bodyParaString = string;
+        return this;
+    }
+
+    /**
+     * 添加请求头
+     *
+     * @param key   参数名
+     * @param value 参数值
+     * @return
+     */
+    public OkHttpUtils addHeader(String key, String value) {
+        if (headerMap == null) {
+            headerMap = new LinkedHashMap<>(16);
+        }
+        headerMap.put(key, value);
+        return this;
+    }
+
+    /**
+     * 初始化get方法
+     *
+     * @return
+     */
+    public OkHttpUtils get() {
+        request = new Request.Builder().get();
+        request.url(buildUrl());
+        return this;
+    }
+
+    /**
+     * 初始化post方法
+     */
+    public OkHttpUtils postForm(JSONObject object, MultipartFile file) {
+
+        MultipartBody.Builder formBody = new MultipartBody.Builder();
+        formBody.setType(MultipartBody.FORM);
+
+        for (String s : object.keySet()) {
+            formBody.addFormDataPart(s, StringUtils.isBlank(object.getString(s)) ? "" : object.getString(s));
+        }
+        if (Objects.nonNull(file)) {
+            try {
+                formBody.addFormDataPart("file", file.getOriginalFilename(), RequestBody.create(file.getBytes()));
+            } catch (IOException e) {
+                log.error("文件异常:{}", e.getMessage());
+            }
+        }
+        RequestBody requestBody = formBody.build();
+        // params参数
+        request = new Request.Builder().post(requestBody).url(buildUrl());
+        return this;
+    }
+
+    /**
+     * 初始化post方法
+     *
+     * @param isJsonPost true等于json的方式提交数据,类似postman里post方法的raw
+     *                   false等于普通的表单提交
+     * @return
+     */
+    public OkHttpUtils post(boolean isJsonPost) {
+        RequestBody requestBody;
+        if (isJsonPost) {
+            String json;
+            if (StringUtils.isNotBlank(bodyParaString)) {
+                json = bodyParaString;
+            } else if (!CollectionUtils.isEmpty(bodyParaMap)) {
+                json = JSONObject.toJSONString(bodyParaMap);
+            } else {
+                json = "{}";
+            }
+            requestBody = RequestBody.create(json, MediaType.parse("application/json; charset=utf-8"));
+        } else {
+            FormBody.Builder formBody = new FormBody.Builder();
+            if (bodyParaMap != null) {
+                bodyParaMap.forEach(formBody::add);
+            }
+            requestBody = formBody.build();
+        }
+        // params参数
+        request = new Request.Builder().post(requestBody).url(buildUrl());
+        return this;
+    }
+
+    private String buildUrl() {
+        StringBuilder urlBuilder = new StringBuilder(url);
+        if (paraMap != null) {
+            urlBuilder.append("?");
+            try {
+                for (Map.Entry<String, String> entry : paraMap.entrySet()) {
+                    urlBuilder.append(URLEncoder.encode(entry.getKey(), StandardCharsets.UTF_8)).
+                            append("=").
+                            append(URLEncoder.encode(entry.getValue(), StandardCharsets.UTF_8)).
+                            append("&");
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            urlBuilder.deleteCharAt(urlBuilder.length() - 1);
+        }
+        return urlBuilder.toString();
+    }
+
+    /**
+     * 文件下载同步请求
+     *
+     * @return
+     */
+    public byte[] fileSync() {
+        setHeader(request);
+        try {
+            Response response = okHttpClient.newCall(request.build()).execute();
+            if (response.isSuccessful()) {
+                assert response.body() != null;
+                return response.body().bytes();
+            }
+            return new byte[0];
+        } catch (IOException e) {
+            e.printStackTrace();
+            return new byte[0];
+        }
+    }
+
+    /**
+     * 同步请求
+     *
+     * @return
+     */
+    public String sync() {
+        setHeader(request);
+        try {
+            Response response = okHttpClient.newCall(request.build()).execute();
+            assert response.body() != null;
+            return response.body().string();
+        } catch (IOException e) {
+            e.printStackTrace();
+            return "请求失败:" + e.getMessage();
+        }
+    }
+
+    /**
+     * 异步请求,有返回值
+     */
+    public String async() {
+        StringBuilder buffer = new StringBuilder("");
+        setHeader(request);
+        okHttpClient.newCall(request.build()).enqueue(new Callback() {
+            @Override
+            public void onFailure(Call call, IOException e) {
+                buffer.append("请求出错:").append(e.getMessage());
+            }
+
+            @Override
+            public void onResponse(Call call, Response response) throws IOException {
+                assert response.body() != null;
+                buffer.append(response.body().string());
+                getSemaphoreInstance().release();
+            }
+        });
+        try {
+            getSemaphoreInstance().acquire();
+        } catch (InterruptedException e) {
+            e.printStackTrace();
+        }
+        return buffer.toString();
+    }
+
+    /**
+     * 异步请求,带有接口回调
+     *
+     * @param callBack
+     */
+    public void async(ICallBack callBack) {
+        setHeader(request);
+        okHttpClient.newCall(request.build()).enqueue(new Callback() {
+            @Override
+            public void onFailure(Call call, IOException e) {
+                callBack.onFailure(call, e.getMessage());
+            }
+
+            @Override
+            public void onResponse(Call call, Response response) throws IOException {
+                assert response.body() != null;
+                callBack.onSuccessful(call, response.body().string());
+            }
+        });
+    }
+
+    /**
+     * 为request添加请求头
+     *
+     * @param request
+     */
+    private void setHeader(Request.Builder request) {
+        if (headerMap != null) {
+            try {
+                for (Map.Entry<String, String> entry : headerMap.entrySet()) {
+                    request.addHeader(entry.getKey(), entry.getValue());
+                }
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+
+    /**
+     * 生成安全套接字工厂,用于https请求的证书跳过
+     *
+     * @return
+     */
+    private static SSLSocketFactory createSSLSocketFactory(TrustManager[] trustAllCerts) {
+        SSLSocketFactory ssfFactory = null;
+        try {
+            SSLContext sc = SSLContext.getInstance("SSL");
+            sc.init(null, trustAllCerts, new SecureRandom());
+            ssfFactory = sc.getSocketFactory();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return ssfFactory;
+    }
+
+    private static TrustManager[] buildTrustManagers() {
+        return new TrustManager[]{
+                new X509TrustManager() {
+                    @Override
+                    public void checkClientTrusted(X509Certificate[] chain, String authType) {
+                    }
+
+                    @Override
+                    public void checkServerTrusted(X509Certificate[] chain, String authType) {
+                    }
+
+                    @Override
+                    public X509Certificate[] getAcceptedIssuers() {
+                        return new X509Certificate[]{};
+                    }
+                }
+        };
+    }
+
+    /**
+     * 自定义一个接口回调
+     */
+    public interface ICallBack {
+
+        void onSuccessful(Call call, String data);
+
+        void onFailure(Call call, String errorMsg);
+
+    }
+
+}

+ 71 - 0
src/main/java/com/sckw/freight/util/R.java

@@ -0,0 +1,71 @@
+package com.sckw.freight.util;
+
+import lombok.*;
+import lombok.experimental.Accessors;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+/**
+ * @author xcq
+ * @date 2022年06月14日 13:41
+ */
+@ToString
+@NoArgsConstructor
+@AllArgsConstructor
+@Accessors(chain = true)
+public class R<T> implements Serializable {
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    @Getter
+    @Setter
+    private String msg;
+    @Getter
+    @Setter
+    private Boolean status;
+
+    @Getter
+    @Setter
+    private T data;
+
+    public static <T> R<T> ok() {
+        return restResult(null, true, null);
+    }
+
+    public static <T> R<T> ok(T data) {
+        return restResult(data, true, null);
+    }
+
+    public static <T> R<T> ok(T data, String msg) {
+        return restResult(data, true, msg);
+    }
+
+    public static <T> R<T> failed() {
+        return restResult(null, false, null);
+    }
+
+    public static <T> R<T> failed(String msg) {
+        return restResult(null, false, msg);
+    }
+
+    public static <T> R<T> failed(T data) {
+        return restResult(data, false, null);
+    }
+
+    public static <T> R<T> failed(T data, String msg) {
+        return restResult(data, false, msg);
+    }
+
+    public static <T> R<T> failed(T data, String msg, int code) {
+        return restResult(data, false, msg);
+    }
+
+    private static <T> R<T> restResult(T data, Boolean status, String msg) {
+        R<T> apiResult = new R<>();
+        apiResult.setStatus(status);
+        apiResult.setData(data);
+        apiResult.setMsg(msg);
+        return apiResult;
+    }
+}

+ 37 - 0
src/main/resources/application-test.yml

@@ -0,0 +1,37 @@
+spring:
+  datasource:
+    dynamic:
+      druid:
+        initial-size: 2
+        max-active: 20
+        min-idle: 2
+      primary: master
+      datasource:
+        master:
+          driver-class-name: com.mysql.cj.jdbc.Driver
+          url: jdbc:mysql://10.10.10.221:3306/freight?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&zeroDateTimeBehavior=convertToNull
+          username: freight
+          password: freight
+  data:
+    redis:
+      host: 10.10.10.221
+      password: test
+      port: 6379
+      database: 13
+      lettuce:
+        pool:
+          enabled: true
+          max-active: 8
+          max-idle: 16
+          min-idle: 1
+
+# 日志级别
+logging:
+  level:
+    root: debug
+
+
+# mybatis-plus 打印sql
+mybatis-plus:
+  configuration:
+    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

+ 19 - 0
src/main/resources/application.yml

@@ -0,0 +1,19 @@
+server:
+  port: 12345
+
+spring:
+  application:
+    name: Freight-Settlement
+  profiles:
+    active: test
+  jackson:
+    date-format: yyyy-MM-dd HH:mm:ss
+    locale: zh
+    time-zone: GMT+8
+    serialization:
+      write-dates-as-timestamps: true
+    default-leniency: true
+  servlet:
+    multipart:
+      max-file-size: 20MB
+      max-request-size: 100MB

+ 159 - 0
src/main/resources/log4j2.xml

@@ -0,0 +1,159 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration status="info" monitorInterval="30">
+    <properties>
+        <!-- 格式化输出:%date表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度 %msg:日志消息,%n是换行符 -->
+        <!-- %logger{36} 表示 Logger 名字最长36个字符 -->
+        <property name="LOG_PATTERN"
+                  value="%clr{%d{yyyy-MM-dd HH:mm:ss.SSS}}{faint} %clr{%5p} %clr{${sys:PID}}{magenta} %clr{---}{faint} %clr{[%t]}{faint} %clr{%c{1.}}{cyan} %clr{:}{faint} %m%n%xwEx"/>
+        <property name="LOG_WITHOUT_COLOR_PATTERN"
+                  value="%d{yyyy-MM-dd HH:mm:ss.SSS} %5p ${sys:PID}--- [%t] %c{1.} : %m%n%xwEx"/>
+        <property name="LOG_PATH" value="logs"/>
+    </properties>
+    <!--DEBUG<INFO<WARNING<ERROR<CRITICAL-->
+    <!-- 先定义所有的appender(附加器)-->
+    <appenders>
+        <!-- 输出控制台的配置 -->
+        <Console name="Console" target="SYSTEM_OUT">
+            <!-- 输出日志的格式 -->
+            <PatternLayout pattern="${LOG_PATTERN}"/>
+        </Console>
+
+        <!--all级别日志-->
+        <RollingFile name="allFileAppender"
+                     fileName="${LOG_PATH}/all.log"
+                     filePattern="${LOG_PATH}/$${date:yyyy-MM}/all-%d{yyyy-MM-dd}-%i.log.gz">
+            <PatternLayout pattern="${LOG_WITHOUT_COLOR_PATTERN}"/>
+
+            <Policies>
+                <!-- 设置日志文件切分参数 -->
+                <!--<OnStartupTriggeringPolicy/>-->
+                <!--设置日志基础文件大小,超过该大小就触发日志文件滚动更新-->
+                <SizeBasedTriggeringPolicy size="100 MB"/>
+                <!--设置日志文件滚动更新的时间,依赖于文件命名filePattern的设置-->
+                <TimeBasedTriggeringPolicy/>
+            </Policies>
+            <!--设置日志的文件个数上限,不设置默认为7个,超过大小后会被覆盖;依赖于filePattern中的%i-->
+            <DefaultRolloverStrategy max="100"/>
+        </RollingFile>
+
+        <!--debug级别日志-->
+        <RollingFile name="debugFileAppender"
+                     fileName="${LOG_PATH}/debug.log"
+                     filePattern="${LOG_PATH}/$${date:yyyy-MM}/debug-%d{yyyy-MM-dd}-%i.log.gz">
+            <Filters>
+                <!--过滤掉info及更高级别日志-->
+                <ThresholdFilter level="info" onMatch="DENY" onMismatch="NEUTRAL"/>
+            </Filters>
+            <!--设置日志格式-->
+            <PatternLayout pattern="${LOG_WITHOUT_COLOR_PATTERN}"/>
+
+            <Policies>
+                <!-- 设置日志文件切分参数 -->
+                <!--<OnStartupTriggeringPolicy/>-->
+                <!--设置日志基础文件大小,超过该大小就触发日志文件滚动更新-->
+                <SizeBasedTriggeringPolicy size="100 MB"/>
+                <!--设置日志文件滚动更新的时间,依赖于文件命名filePattern的设置-->
+                <TimeBasedTriggeringPolicy/>
+            </Policies>
+            <!--设置日志的文件个数上限,不设置默认为7个,超过大小后会被覆盖;依赖于filePattern中的%i-->
+            <DefaultRolloverStrategy max="100"/>
+        </RollingFile>
+
+        <!--info级别日志-->
+        <RollingFile name="infoFileAppender"
+                     fileName="${LOG_PATH}/info.log"
+                     filePattern="${LOG_PATH}/$${date:yyyy-MM}/info-%d{yyyy-MM-dd}-%i.log.gz">
+            <Filters>
+                <!--过滤掉warn及更高级别日志-->
+                <ThresholdFilter level="warn" onMatch="DENY" onMismatch="NEUTRAL"/>
+            </Filters>
+            <!--设置日志格式-->
+            <PatternLayout pattern="${LOG_WITHOUT_COLOR_PATTERN}"/>
+
+            <Policies>
+                <!-- 设置日志文件切分参数 -->
+                <!--<OnStartupTriggeringPolicy/>-->
+                <!--设置日志基础文件大小,超过该大小就触发日志文件滚动更新-->
+                <SizeBasedTriggeringPolicy size="100 MB"/>
+                <!--设置日志文件滚动更新的时间,依赖于文件命名filePattern的设置-->
+                <TimeBasedTriggeringPolicy interval="1" modulate="true"/>
+            </Policies>
+            <!--设置日志的文件个数上限,不设置默认为7个,超过大小后会被覆盖;依赖于filePattern中的%i-->
+            <!--<DefaultRolloverStrategy max="100"/>-->
+        </RollingFile>
+
+        <!--warn级别日志-->
+        <RollingFile name="warnFileAppender"
+                     fileName="${LOG_PATH}/warn.log"
+                     filePattern="${LOG_PATH}/$${date:yyyy-MM}/warn-%d{yyyy-MM-dd}-%i.log.gz">
+            <Filters>
+                <!--过滤掉error及更高级别日志-->
+                <ThresholdFilter level="error" onMatch="DENY" onMismatch="NEUTRAL"/>
+            </Filters>
+            <!--设置日志格式-->
+            <PatternLayout pattern="${LOG_WITHOUT_COLOR_PATTERN}"/>
+
+            <Policies>
+                <!-- 设置日志文件切分参数 -->
+                <!--<OnStartupTriggeringPolicy/>-->
+                <!--设置日志基础文件大小,超过该大小就触发日志文件滚动更新-->
+                <SizeBasedTriggeringPolicy size="100 MB"/>
+                <!--设置日志文件滚动更新的时间,依赖于文件命名filePattern的设置-->
+                <TimeBasedTriggeringPolicy/>
+            </Policies>
+            <!--设置日志的文件个数上限,不设置默认为7个,超过大小后会被覆盖;依赖于filePattern中的%i-->
+            <DefaultRolloverStrategy max="100"/>
+        </RollingFile>
+
+        <!--error及更高级别日志-->
+        <RollingFile name="errorFileAppender"
+                     fileName="${LOG_PATH}/error.log"
+                     filePattern="${LOG_PATH}/$${date:yyyy-MM}/error-%d{yyyy-MM-dd}-%i.log.gz">
+            <!--设置日志格式-->
+            <PatternLayout pattern="${LOG_WITHOUT_COLOR_PATTERN}"/>
+            <Policies>
+                <!-- 设置日志文件切分参数 -->
+                <!--<OnStartupTriggeringPolicy/>-->
+                <!--设置日志基础文件大小,超过该大小就触发日志文件滚动更新-->
+                <SizeBasedTriggeringPolicy size="100 MB"/>
+                <!--设置日志文件滚动更新的时间,依赖于文件命名filePattern的设置-->
+                <TimeBasedTriggeringPolicy/>
+            </Policies>
+            <!--设置日志的文件个数上限,不设置默认为7个,超过大小后会被覆盖;依赖于filePattern中的%i-->
+            <DefaultRolloverStrategy max="100"/>
+        </RollingFile>
+
+        <!--json格式error级别日志-->
+        <RollingFile name="errorJsonAppender"
+                     fileName="${LOG_PATH}/error-json.log"
+                     filePattern="${LOG_PATH}/$${date:yyyy-MM}/error-json-%d{yyyy-MM-dd}-%i.log.gz">
+            <JSONLayout compact="true" eventEol="true" locationInfo="true"/>
+            <Policies>
+                <SizeBasedTriggeringPolicy size="100 MB"/>
+                <TimeBasedTriggeringPolicy interval="1" modulate="true"/>
+            </Policies>
+        </RollingFile>
+
+    </appenders>
+
+    <loggers>
+
+        <!-- 建立一个默认的root的logger -->
+        <!--这个的日志级别与application.yml中的logging.info.level不同,
+        application.yml配置的日志级别高于 log4j2.xml配置文件中的级别。
+        若AppenderRef中没有配置日志级别,则会继承application.yml中的日志级别-->
+        <root level="debug">
+            <AppenderRef ref="allFileAppender" level="all"/>
+            <AppenderRef ref="debugFileAppender" level="debug"/>
+            <AppenderRef ref="infoFileAppender" level="info"/>
+            <AppenderRef ref="warnFileAppender" level="warn"/>
+            <AppenderRef ref="errorFileAppender" level="error"/>
+            <AppenderRef ref="errorJsonAppender" level="error"/>
+            <appender-ref ref="Console" level="info"/>
+        </root>
+        <Logger name="org.springframework" level="info"/>
+        <Logger name="com.alibaba" level="info"/>
+        <Logger name="com.baomidou" level="info"/>
+    </loggers>
+
+</configuration>