‘liusuyi’
2023-11-24 bf75d92d753bcd3cf871d6d1201f8dd359b11bc6
优化application删除不必要的配置
优化pom中多余的依赖
已修改10个文件
393 ■■■■■ 文件已修改
ard-work/pom.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/src/main/java/com/ruoyi/cmd/startup.java 32 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
pom.xml 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/pom.xml 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/application-dev.yml 173 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/application-prod.yml 57 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/application.yml 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-common/src/main/java/com/ruoyi/common/filter/MyI18nInterceptor.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ard-work/pom.xml
@@ -69,7 +69,6 @@
        <dependency>
            <groupId>com.github.xiaoymin</groupId>
            <artifactId>knife4j-spring-boot-starter</artifactId>
            <version>3.0.3</version>
        </dependency>
        <!--张建提供引导依赖-->
        <dependency>
ard-work/src/main/java/com/ruoyi/cmd/startup.java
@@ -45,12 +45,6 @@
    String mediamtxName = "mediamtx.exe";
    @Value("${mediamtx.enabled}")
    Boolean mediamtxEnabled;
    //webrtc-streamer
    String webrtcName = "webrtc-streamer.exe";
    @Value("${webrtc.host}")
    String webrtcHost;
    @Value("${webrtc.enabled}")
    Boolean webrtcEnabled;
    //redis
    String redisName = "redis-server.exe";
@@ -124,25 +118,6 @@
//            CmdUtils.commandStart(command);
            }
        }
        if (webrtcEnabled) {
            log.info("初始化启动webrtc-streamer");
            if (Platform.isWindows()) {
                String exePath = System.getProperty("user.dir") + File.separator + "server" + File.separator + "webrtc" + File.separator + webrtcName;
                List<String> cmd = new ArrayList<>();
                cmd.add(exePath);
                cmd.add("-H" + webrtcHost);
                cmd.add("-o");
                if (CmdUtils.isProcessRunning(webrtcName)) {
                    // 进程已经在运行,结束该进程
                    CmdUtils.stopProcess(webrtcName);
                }
                // 启动后台进程
                CmdUtils.commandStart(webrtcName, cmd, null);
                // 启动cmd窗口
//                String[] command = {"cmd", "/c", "start", exePath, "-H127.0.0.1:8000", "-o"};
//                CmdUtils.commandStart(command);
            }
        }
    }
    @PreDestroy
@@ -159,13 +134,6 @@
            if (CmdUtils.isProcessRunning(mediamtxName)) {
                // 进程已经在运行,结束该进程
                CmdUtils.stopProcess(mediamtxName);
            }
        }
        if (webrtcEnabled) {
            log.info("销毁webrtc-streamer");
            if (CmdUtils.isProcessRunning(webrtcName)) {
                // 进程已经在运行,结束该进程
                CmdUtils.stopProcess(webrtcName);
            }
        }
        if (true) {
pom.xml
@@ -21,6 +21,7 @@
        <druid.version>1.2.15</druid.version>
        <bitwalker.version>1.21</bitwalker.version>
        <swagger.version>3.0.0</swagger.version>
        <knife4j.version>3.0.3</knife4j.version>
        <kaptcha.version>2.3.3</kaptcha.version>
        <pagehelper.boot.version>1.4.6</pagehelper.boot.version>
        <fastjson.version>2.0.20</fastjson.version>
@@ -77,20 +78,7 @@
            <dependency>
                <groupId>com.github.xiaoymin</groupId>
                <artifactId>knife4j-spring-boot-starter</artifactId>
                <version>2.0.9</version>
            </dependency>
            <!-- Swagger3依赖 -->
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-boot-starter</artifactId>
                <version>${swagger.version}</version>
                <exclusions>
                    <exclusion>
                        <groupId>io.swagger</groupId>
                        <artifactId>swagger-models</artifactId>
                    </exclusion>
                </exclusions>
                <version>${knife4j.version}</version>
            </dependency>
            <!-- io常用工具类 -->
ruoyi-admin/pom.xml
@@ -30,7 +30,6 @@
        <dependency>
            <groupId>com.github.xiaoymin</groupId>
            <artifactId>knife4j-spring-boot-starter</artifactId>
            <version>3.0.3</version>
        </dependency>
         <!-- Postgresql驱动包 -->
        <dependency>
ruoyi-admin/src/main/java/com/ruoyi/web/core/config/SwaggerConfig.java
@@ -37,13 +37,13 @@
    @Autowired
    private ARDConfig ardConfig;
    /** 是否开启swagger */
    @Value("${swagger.enabled}")
    private boolean enabled;
    /** 设置请求的统一前缀 */
    @Value("${swagger.pathMapping}")
    private String pathMapping;
    ///** 是否开启swagger */
    //@Value("${swagger.enabled}")
    //private boolean enabled;
    //
    ///** 设置请求的统一前缀 */
    //@Value("${swagger.pathMapping}")
    //private String pathMapping;
    /**
     * 创建API
@@ -53,7 +53,7 @@
    {
        return new Docket(DocumentationType.SWAGGER_2)
                // 是否启用Swagger
                .enable(enabled)
                .enable(true)
                // 用来创建该API的基本信息,展示在文档的页面中(自定义展示的信息)
                .apiInfo(apiInfo())
                // 设置哪些接口暴露给Swagger展示
@@ -68,7 +68,7 @@
                /* 设置安全模式,swagger可以设置访问token */
                .securitySchemes(securitySchemes())
                .securityContexts(securityContexts())
                .pathMapping(pathMapping);
                .pathMapping("/");
    }
    /**
ruoyi-admin/src/main/resources/application-dev.yml
@@ -1,104 +1,71 @@
# 开发环境配置
server:
  # 服务器的HTTP端口,默认为8080
  port: 8080
  servlet:
    # 应用的访问路径
    context-path: /
  tomcat:
    # tomcat的URI编码
    uri-encoding: UTF-8
    # 连接数满后的排队数,默认为100
    accept-count: 1000
    threads:
      # tomcat最大线程数,默认为200
      max: 800
      # Tomcat启动初始化的线程数,默认值10
      min-spare: 100
# Spring配置
spring:
  # redis 配置
  redis:
    # 地址
    host: 127.0.0.1
    # 端口,默认为6379
    port: 6379
    # 数据库索引
    database: 0
    # 密码
    password:
    # 连接超时时间
    timeout: 10s
    lettuce:
      pool:
        # 连接池中的最小空闲连接
        min-idle: 0
        # 连接池中的最大空闲连接
        max-idle: 8
        # 连接池的最大数据库连接数
        max-active: 8
        # #连接池最大阻塞等待时间(使用负值表示没有限制)
        max-wait: -1ms
# 日志配置
logging:
  level:
    authorize: info
    minio: info
    hikSdk: debug
    dhSdk: debug
    sdk: debug
    vtdu: debug
    stealAlarm: info
    websocket: info
    patrolInspectionTask: info
    mqtt: debug
    guideQueue: debug
    rongCloud: info
    cmd: info
    uav: info
    sy: info
# webrtc-streamer配置
webrtc:
  enabled: false
  host: 127.0.0.1:8000
# minio配置
minio:
  enabled: false
  endpoint: http://192.168.2.15:9001
  accessKey: admin
  secretKey: xzx12345
  path: G:/DATA
# forest配置
forest:
  backend: okhttp3             # 后端HTTP框架(默认为 okhttp3)
  max-connections: 1000        # 连接池最大连接数(默认为 500)
  max-route-connections: 500   # 每个路由的最大连接数(默认为 500)
  max-request-queue-size: 100  # [自v1.5.22版本起可用] 最大请求等待队列大小
  max-async-thread-size: 300   # [自v1.5.21版本起可用] 最大异步线程数
  max-async-queue-size: 16     # [自v1.5.22版本起可用] 最大异步线程池队列大小
  timeout: 3000                # [已不推荐使用] 请求超时时间,单位为毫秒(默认为 3000)
  connect-timeout: 3000        # 连接超时时间,单位为毫秒(默认为 timeout)
  read-timeout: 3000           # 数据读取超时时间,单位为毫秒(默认为 timeout)
  max-retry-count: 0           # 请求失败后重试次数(默认为 0 次不重试)
  ssl-protocol: TLS            # 单向验证的HTTPS的默认TLS协议(默认为 TLS)
  log-enabled: true            # 打开或关闭日志(默认为 true)
  log-request: true            # 打开/关闭Forest请求日志(默认为 true)
  log-response-status: true    # 打开/关闭Forest响应状态日志(默认为 true)
  log-response-content: true   # 打开/关闭Forest响应内容日志(默认为 false)
  async-mode: platform         # [自v1.5.27版本起可用] 异步模式(默认为 platform)
#流媒体转码服务器
mediamtx:
  enabled: true
  host: 192.168.1.227
#mqtt
mqtt:
  host: tcp://192.168.2.15:1883
  clientId: Server-2271
  username: admin
  password: admin
  topic: minioEvent,radar
  timeout: 100
  keepalive: 60
# 开发环境配置
server:
  # 服务器的HTTP端口,默认为8080
  port: 8080
  servlet:
    # 应用的访问路径
    context-path: /
  tomcat:
    # tomcat的URI编码
    uri-encoding: UTF-8
    # 连接数满后的排队数,默认为100
    accept-count: 1000
    threads:
      # tomcat最大线程数,默认为200
      max: 800
      # Tomcat启动初始化的线程数,默认值10
      min-spare: 100
# Spring配置
spring:
# 日志配置
logging:
  level:
    com.ruoyi.common.filter.MyI18nInterceptor: debug
    authorize: info
    minio: info
    hikSdk: debug
    dhSdk: debug
    sdk: debug
    vtdu: debug
    stealAlarm: info
    websocket: info
    patrolInspectionTask: info
    mqtt: debug
    guideQueue: debug
    rongCloud: info
    cmd: info
    uav: info
    sy: info
## knife4j配置
knife4j:
  # knife4j增强功能,开启后下面参数才生效
  enable: true
  #是否为生产模式 项目部属时为true 防止接口暴露
  production: false
  # 配置用户密码
  basic:
    enable: false
    username: admin
    password: ardkj12345
# minio配置
minio:
  enabled: false
  endpoint: http://192.168.2.15:9001
  accessKey: admin
  secretKey: xzx12345
  path: G:/DATA
#流媒体转码服务器
mediamtx:
  enabled: true
  host: 192.168.1.227
#mqtt
mqtt:
  host: tcp://192.168.2.15:1883
  clientId: Server-2271
  username: admin
  password: admin
  topic: minioEvent,radar
  timeout: 100
  keepalive: 60
  enabled: true
ruoyi-admin/src/main/resources/application-prod.yml
@@ -15,48 +15,17 @@
      max: 800
      # Tomcat启动初始化的线程数,默认值10
      min-spare: 100
# Spring配置
spring:
  # redis 配置
  redis:
    # 地址
    host: 192.168.5.229
    # 端口,默认为6379
    port: 6379
    # 数据库索引
    database: 0
    # 密码
    password:
    # 连接超时时间
    timeout: 10s
    lettuce:
      pool:
        # 连接池中的最小空闲连接
        min-idle: 0
        # 连接池中的最大空闲连接
        max-idle: 8
        # 连接池的最大数据库连接数
        max-active: 8
        # #连接池最大阻塞等待时间(使用负值表示没有限制)
        max-wait: -1ms
# forest配置
forest:
  backend: okhttp3             # 后端HTTP框架(默认为 okhttp3)
  max-connections: 1000        # 连接池最大连接数(默认为 500)
  max-route-connections: 500   # 每个路由的最大连接数(默认为 500)
  max-request-queue-size: 100  # [自v1.5.22版本起可用] 最大请求等待队列大小
  max-async-thread-size: 300   # [自v1.5.21版本起可用] 最大异步线程数
  max-async-queue-size: 16     # [自v1.5.22版本起可用] 最大异步线程池队列大小
  timeout: 3000                # [已不推荐使用] 请求超时时间,单位为毫秒(默认为 3000)
  connect-timeout: 3000        # 连接超时时间,单位为毫秒(默认为 timeout)
  read-timeout: 3000           # 数据读取超时时间,单位为毫秒(默认为 timeout)
  max-retry-count: 0           # 请求失败后重试次数(默认为 0 次不重试)
  ssl-protocol: TLS            # 单向验证的HTTPS的默认TLS协议(默认为 TLS)
  log-enabled: true            # 打开或关闭日志(默认为 true)
  log-request: true            # 打开/关闭Forest请求日志(默认为 true)
  log-response-status: true    # 打开/关闭Forest响应状态日志(默认为 true)
  log-response-content: true   # 打开/关闭Forest响应内容日志(默认为 false)
  async-mode: platform         # [自v1.5.27版本起可用] 异步模式(默认为 platform)
## knife4j配置
knife4j:
  # knife4j增强功能,开启后下面参数才生效
  enable: true
  #是否为生产模式 项目部属时为true 防止接口暴露
  production: true
  # 配置用户密码
  basic:
    enable: true
    username: admin
    password: ardkj12345
# 日志配置
logging:
  level:
@@ -72,10 +41,6 @@
    cmd: info
    uav: info
    sy: info
# webrtc-streamer配置
webrtc:
  enabled: false
  host: 192.168.5.229:8000
# minio配置
minio:
  enabled: false
ruoyi-admin/src/main/resources/application.yml
@@ -30,13 +30,6 @@
  # 令牌有效期(默认30分钟)
  expireTime: 30
# MyBatis配置
#mybatis:
#    # 搜索指定包别名
#    typeAliasesPackage: com.ruoyi.**.domain
#    # 配置mapper的扫描,找到所有的mapper.xml映射文件
#    mapperLocations: classpath*:mapper/**/*Mapper.xml
#    # 加载全局的配置文件
#    configLocation: classpath:mybatis/mybatis-config.xml
mybatis-plus:
  type-Aliases-Package: com.ruoyi.**.domain
  mapper-Locations: classpath*:mapper/**/*Mapper.xml
@@ -45,34 +38,29 @@
    banner: off # 关闭mybatisplus启动图标
    db-config: #主键不用MyBatis plus的雪花算法,用数据库的主键自增
      id-type: uuid
#  configuration:
#    # 是否开启自动驼峰命名规则映射:从数据库列名到Java属性驼峰命名的类似映射
#    map-underscore-to-camel-case: true
#    # 如果查询结果中包含空值的列,则 MyBatis 在映射的时候,不会映射这个字段
#    call-setters-on-nulls: true
#    # 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
#    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# PageHelper分页插件
pagehelper:
  helperDialect: postgresql
  supportMethodsArguments: true
  params: count=countSql
# Swagger配置
swagger:
  # 是否开启swagger
  enabled: true
  # 请求前缀
  pathMapping: /
knife4j:
  # knife4j增强功能
  enable: true
  #是否为生产模式 项目部属时为true 防止接口暴露
  production: false
  # 配置用户密码
  basic:
    enable: true
    username: admin
    password: ardkj12345
# forest配置
forest:
  backend: okhttp3             # 后端HTTP框架(默认为 okhttp3)
  max-connections: 1000        # 连接池最大连接数(默认为 500)
  max-route-connections: 500   # 每个路由的最大连接数(默认为 500)
  max-request-queue-size: 100  # [自v1.5.22版本起可用] 最大请求等待队列大小
  max-async-thread-size: 300   # [自v1.5.21版本起可用] 最大异步线程数
  max-async-queue-size: 16     # [自v1.5.22版本起可用] 最大异步线程池队列大小
  timeout: 3000                # [已不推荐使用] 请求超时时间,单位为毫秒(默认为 3000)
  connect-timeout: 3000        # 连接超时时间,单位为毫秒(默认为 timeout)
  read-timeout: 3000           # 数据读取超时时间,单位为毫秒(默认为 timeout)
  max-retry-count: 0           # 请求失败后重试次数(默认为 0 次不重试)
  ssl-protocol: TLS            # 单向验证的HTTPS的默认TLS协议(默认为 TLS)
  log-enabled: true            # 打开或关闭日志(默认为 true)
  log-request: true            # 打开/关闭Forest请求日志(默认为 true)
  log-response-status: true    # 打开/关闭Forest响应状态日志(默认为 true)
  log-response-content: true   # 打开/关闭Forest响应内容日志(默认为 false)
  async-mode: platform         # [自v1.5.27版本起可用] 异步模式(默认为 platform)
# 防止XSS攻击
xss:
  # 过滤开关
@@ -107,6 +95,29 @@
      enabled: false
  thymeleaf:
    cache: false
  # redis 配置
  redis:
    # 地址
    host: 127.0.0.1
    # 端口,默认为6379
    port: 6379
    # 数据库索引
    database: 0
    # 密码
    password:
    # 连接超时时间
    timeout: 10s
    lettuce:
      pool:
        # 连接池中的最小空闲连接
        min-idle: 0
        # 连接池中的最大空闲连接
        max-idle: 8
        # 连接池的最大数据库连接数
        max-active: 8
        # #连接池最大阻塞等待时间(使用负值表示没有限制)
        max-wait: -1ms
  # 激活配置文件
  profiles:
    active: dev-druid,dev
ruoyi-admin/src/main/resources/mybatis/mybatis-config.xml
@@ -1,21 +1,21 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
    <!-- 全局参数 -->
    <settings>
        <!-- 使全局的映射器启用或禁用缓存 -->
        <setting name="cacheEnabled"             value="true"   />
        <setting name="cacheEnabled" value="true"/>
        <!-- 允许JDBC 支持自动生成主键 -->
        <setting name="useGeneratedKeys"         value="true"   />
        <setting name="useGeneratedKeys" value="true"/>
        <!-- 配置默认的执行器.SIMPLE就是普通执行器;REUSE执行器会重用预处理语句(prepared statements);BATCH执行器将重用语句并执行批量更新 -->
        <setting name="defaultExecutorType"      value="SIMPLE" />
        <!-- 指定 MyBatis 所用日志的具体实现 -->
        <setting name="logImpl"                  value="SLF4J"  />
        <setting name="defaultExecutorType" value="SIMPLE"/>
        <!-- 指定 MyBatis 所用日志的具体实现 -->
        <setting name="logImpl" value="SLF4J"/>
        <!-- 使用驼峰命名法转换字段 -->
        <!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
    </settings>
        <!-- <setting name="mapUnderscoreToCamelCase" value="true"/> -->
    </settings>
    <typeAliases>
        <package name="com.ruoyi.*.*.domain"/> <!--替换成你的项目的实体类的路径(这个配置对于项目来说没有作用,仅仅是写给IDEA上安装的 MyBatis 插件看的,防止标红)-->
        <package name="com.ruoyi.*.domain"/>
ruoyi-common/src/main/java/com/ruoyi/common/filter/MyI18nInterceptor.java
@@ -7,6 +7,7 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Enumeration;
import java.util.Locale;
@Slf4j
@@ -18,13 +19,14 @@
            final String key = "language";
            //String language = "en-US";
            //String language = "zh-CN";
            Enumeration<String> headers = request.getHeaderNames();
            String language = request.getHeader(key);
            if (language == null) {
                //String language = "en-US";
                language = "en-US";
            }
            // 前端传递的language必须是zh-CN格式的,中间的_必须要完整,不能只传递zh或en
            log.info("当前语言={}", language);
            // 前端传递的language必须是zh-CN格式的,中间的-必须要完整,不能只传递zh或en
            log.debug("当前语言={}", language);
            Locale locale = new Locale(language.split("-")[0], language.split("-")[1]);
            // 这样赋值以后,MessageUtils.message方法就不用修改了
            LocaleContextHolder.setLocale(locale);