فهرست منبع

配置文件分级

qxp192083 5 سال پیش
والد
کامیت
e730fc90c1

dgtly-admin/src/main/resources/application-druid.yml → dgtly-admin/src/main/resources/application-dev-druid.yml


+ 130 - 0
dgtly-admin/src/main/resources/application-dev.yml

@@ -0,0 +1,130 @@
+# 项目相关配置
+ruoyi:
+  # 名称
+  name: SteelfurnitureManager
+  # 版本
+  version: 4.0.0
+  # 版权年份
+  copyrightYear: 2019
+  # 实例演示开关
+  demoEnabled: true
+  # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
+  profile: D:/testfile/dgtly/uploadPath
+  # 获取ip地址开关
+  addressEnabled: true
+
+# 开发环境配置
+server:
+  # 服务器的HTTP端口,默认为80
+  port: 80
+  servlet:
+    # 应用的访问路径
+    context-path: /
+  tomcat:
+    # tomcat的URI编码
+    uri-encoding: UTF-8
+    # tomcat最大线程数,默认为200
+    max-threads: 800
+    # Tomcat启动初始化的线程数,默认值25
+    min-spare-threads: 30
+ 
+# 日志配置
+logging:
+  level:
+    com.dgtly: debug
+    org.springframework: warn
+
+# 用户配置
+user:
+  password:
+    # 密码错误{maxRetryCount}次锁定10分钟
+    maxRetryCount: 5
+
+# Spring配置
+spring:
+  # 模板引擎
+  thymeleaf:
+    mode: HTML
+    encoding: utf-8
+    # 禁用缓存
+    cache: false
+  # 资源信息
+  messages:
+    # 国际化资源文件路径
+    basename: static/i18n/messages
+  jackson:
+    time-zone: GMT+8
+    date-format: yyyy-MM-dd HH:mm:ss
+  profiles:
+    include: dev-druid
+  # 文件上传
+  servlet:
+     multipart:
+       # 单个文件大小
+       max-file-size:  10MB
+       # 设置总上传的文件大小
+       max-request-size:  20MB
+  # 服务模块
+  devtools:
+    restart:
+      # 热部署开关
+      enabled: true
+
+# MyBatis
+mybatis:
+    # 搜索指定包别名
+    typeAliasesPackage: com.dgtly.**.domain
+    # 配置mapper的扫描,找到所有的mapper.xml映射文件
+    mapperLocations: classpath*:mapper/**/*Mapper.xml
+    # 加载全局的配置文件
+    configLocation: classpath:mybatis/mybatis-config.xml
+
+# PageHelper分页插件
+pagehelper: 
+  helperDialect: mysql
+  reasonable: true
+  supportMethodsArguments: true
+  params: count=countSql 
+
+# Shiro
+shiro:
+  user:
+    # 登录地址
+    loginUrl: /login
+    # 权限认证失败地址
+    unauthorizedUrl: /unauth
+    # 首页地址
+    indexUrl: /index
+    # 验证码开关
+    captchaEnabled: true
+    # 验证码类型 math 数组计算 char 字符
+    captchaType: math
+  cookie:
+    # 设置Cookie的域名 默认空,即当前访问的域名
+    domain: 
+    # 设置cookie的有效访问路径
+    path: /
+    # 设置HttpOnly属性
+    httpOnly: true
+    # 设置Cookie的过期时间,天为单位
+    maxAge: 30
+  session:
+    # Session超时时间,-1代表永不过期(默认30分钟)
+    expireTime: 30
+    # 同步session到数据库的周期(默认1分钟)
+    dbSyncPeriod: 1
+    # 相隔多久检查一次session的有效性,默认就是10分钟
+    validationInterval: 10
+    # 同一个用户最大会话数,比如2的意思是同一个账号允许最多同时两个人登录(默认-1不限制)
+    maxSession: -1
+    # 踢出之前登录的/之后登录的用户,默认踢出之前登录的用户
+    kickoutAfter: false
+
+# 防止XSS攻击
+xss: 
+  # 过滤开关
+  enabled: true
+  # 排除链接(多个用逗号分隔)
+  excludes: /system/notice/*
+  # 匹配链接
+  urlPatterns: /system/*,/monitor/*,/tool/*

+ 1 - 128
dgtly-admin/src/main/resources/application.yml

@@ -1,130 +1,3 @@
-# 项目相关配置
-ruoyi:
-  # 名称
-  name: SteelfurnitureManager
-  # 版本
-  version: 4.0.0
-  # 版权年份
-  copyrightYear: 2019
-  # 实例演示开关
-  demoEnabled: true
-  # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
-  profile: D:/testfile/dgtly/uploadPath
-  # 获取ip地址开关
-  addressEnabled: true
-
-# 开发环境配置
-server:
-  # 服务器的HTTP端口,默认为80
-  port: 80
-  servlet:
-    # 应用的访问路径
-    context-path: /
-  tomcat:
-    # tomcat的URI编码
-    uri-encoding: UTF-8
-    # tomcat最大线程数,默认为200
-    max-threads: 800
-    # Tomcat启动初始化的线程数,默认值25
-    min-spare-threads: 30
- 
-# 日志配置
-logging:
-  level:
-    com.dgtly: debug
-    org.springframework: warn
-
-# 用户配置
-user:
-  password:
-    # 密码错误{maxRetryCount}次锁定10分钟
-    maxRetryCount: 5
-
-# Spring配置
 spring:
 spring:
-  # 模板引擎
-  thymeleaf:
-    mode: HTML
-    encoding: utf-8
-    # 禁用缓存
-    cache: false
-  # 资源信息
-  messages:
-    # 国际化资源文件路径
-    basename: static/i18n/messages
-  jackson:
-    time-zone: GMT+8
-    date-format: yyyy-MM-dd HH:mm:ss
   profiles: 
   profiles: 
-    active: druid
-  # 文件上传
-  servlet:
-     multipart:
-       # 单个文件大小
-       max-file-size:  10MB
-       # 设置总上传的文件大小
-       max-request-size:  20MB
-  # 服务模块
-  devtools:
-    restart:
-      # 热部署开关
-      enabled: true
-
-# MyBatis
-mybatis:
-    # 搜索指定包别名
-    typeAliasesPackage: com.dgtly.**.domain
-    # 配置mapper的扫描,找到所有的mapper.xml映射文件
-    mapperLocations: classpath*:mapper/**/*Mapper.xml
-    # 加载全局的配置文件
-    configLocation: classpath:mybatis/mybatis-config.xml
-
-# PageHelper分页插件
-pagehelper: 
-  helperDialect: mysql
-  reasonable: true
-  supportMethodsArguments: true
-  params: count=countSql 
-
-# Shiro
-shiro:
-  user:
-    # 登录地址
-    loginUrl: /login
-    # 权限认证失败地址
-    unauthorizedUrl: /unauth
-    # 首页地址
-    indexUrl: /index
-    # 验证码开关
-    captchaEnabled: true
-    # 验证码类型 math 数组计算 char 字符
-    captchaType: math
-  cookie:
-    # 设置Cookie的域名 默认空,即当前访问的域名
-    domain: 
-    # 设置cookie的有效访问路径
-    path: /
-    # 设置HttpOnly属性
-    httpOnly: true
-    # 设置Cookie的过期时间,天为单位
-    maxAge: 30
-  session:
-    # Session超时时间,-1代表永不过期(默认30分钟)
-    expireTime: 30
-    # 同步session到数据库的周期(默认1分钟)
-    dbSyncPeriod: 1
-    # 相隔多久检查一次session的有效性,默认就是10分钟
-    validationInterval: 10
-    # 同一个用户最大会话数,比如2的意思是同一个账号允许最多同时两个人登录(默认-1不限制)
-    maxSession: -1
-    # 踢出之前登录的/之后登录的用户,默认踢出之前登录的用户
-    kickoutAfter: false
-
-# 防止XSS攻击
-xss: 
-  # 过滤开关
-  enabled: true
-  # 排除链接(多个用逗号分隔)
-  excludes: /system/notice/*
-  # 匹配链接
-  urlPatterns: /system/*,/monitor/*,/tool/*
+    active: dev

+ 3 - 3
dgtly-api/src/main/resources/application-druid.yml

@@ -6,9 +6,9 @@ spring:
         druid:
         druid:
             # 主库数据源
             # 主库数据源
             master:
             master:
-                url: jdbc:mysql://192.168.100.254:3306/dgtlyoneportal?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
-                username: dgtly_oneportal
-                password: 123456
+                url: jdbc:mysql://182.92.160.141:3306/SteelfurnitureManager?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+                username: qxp
+                password: qxp
             # 从库数据源
             # 从库数据源
             slave:
             slave:
                 # 从数据源开关/默认关闭
                 # 从数据源开关/默认关闭

+ 71 - 0
dgtly-api/src/main/resources/application-dev.yml

@@ -0,0 +1,71 @@
+# 项目相关配置1
+ruoyi:
+  # 名称
+  name: dgtly_oneportal
+  # 版本
+  version: 4.0.0
+  # 版权年份
+  copyrightYear: 2019
+  # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
+  profile: D:/dgtly/uploadPath
+  # 获取ip地址开关
+  addressEnabled: true
+  #是否开启swagger
+  openSwagger: true
+#接口安全验证
+security:
+  #接口过期时间
+  apiTimeOut: 10
+  #接口的plat和对应的AppKey 支持多个用,号分割
+  platMap: "{wx:'cd72c223-923f-44a3-aede-b9f07dcd56b8'}"
+  #开发模式下 可以使用swagger测试 放过验签环节
+  isDev: true
+
+
+# 开发环境配置
+server:
+  # 服务器的HTTP端口,默认为80
+  port: 8888
+  servlet:
+    # 应用的访问路径
+    context-path: /
+  tomcat:
+    # tomcat的URI编码
+    uri-encoding: UTF-8
+    # tomcat最大线程数,默认为200
+    max-threads: 800
+    # Tomcat启动初始化的线程数,默认值25
+    min-spare-threads: 30
+ 
+# 日志配置
+logging:
+  level:
+    com.dgtly: debug
+    org.springframework: warn
+# Spring配置
+spring:
+  jackson:
+    time-zone: GMT+8
+    date-format: yyyy-MM-dd HH:mm:ss
+  profiles:
+    include: dev-druid
+  # 文件上传
+  servlet:
+     multipart:
+       # 单个文件大小
+       max-file-size:  10MB
+       # 设置总上传的文件大小
+       max-request-size:  20MB
+  # 服务模块
+  devtools:
+    restart:
+      # 热部署开关
+      enabled: true
+# MyBatis
+mybatis:
+    # 搜索指定包别名
+    typeAliasesPackage: com.dgtly.**.domain
+    # 配置mapper的扫描,找到所有的mapper.xml映射文件
+    mapperLocations: classpath*:mapper/**/*Mapper.xml
+    # 加载全局的配置文件
+    configLocation: classpath:mybatis/mybatis-config.xml

+ 57 - 0
dgtly-api/src/main/resources/application-test-druid.yml

@@ -0,0 +1,57 @@
+# 数据源配置
+spring:
+    datasource:
+        type: com.alibaba.druid.pool.DruidDataSource
+        driverClassName: com.mysql.cj.jdbc.Driver
+        druid:
+            # 主库数据源
+            master:
+                url: jdbc:mysql://182.92.160.141:3306/SteelfurnitureManager?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
+                username: qxp
+                password: qxp
+            # 从库数据源
+            slave:
+                # 从数据源开关/默认关闭
+                enabled: false
+                url: 
+                username: 
+                password: 
+            # 初始连接数
+            initialSize: 5
+            # 最小连接池数量
+            minIdle: 10
+            # 最大连接池数量
+            maxActive: 20
+            # 配置获取连接等待超时的时间
+            maxWait: 60000
+            # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
+            timeBetweenEvictionRunsMillis: 60000
+            # 配置一个连接在池中最小生存的时间,单位是毫秒
+            minEvictableIdleTimeMillis: 300000
+            # 配置一个连接在池中最大生存的时间,单位是毫秒
+            maxEvictableIdleTimeMillis: 900000
+            # 配置检测连接是否有效
+            validationQuery: SELECT 1 FROM DUAL
+            testWhileIdle: true
+            testOnBorrow: false
+            testOnReturn: false
+            webStatFilter: 
+                enabled: true
+            statViewServlet:
+                enabled: true
+                # 设置白名单,不填则允许所有访问
+                allow:
+                url-pattern: /druid/*
+                # 控制台管理用户名和密码
+                login-username: 
+                login-password: 
+            filter:
+                stat:
+                    enabled: true
+                    # 慢SQL记录
+                    log-slow-sql: true
+                    slow-sql-millis: 1000
+                    merge-sql: true
+                wall:
+                    config:
+                        multi-statement-allow: true

+ 71 - 0
dgtly-api/src/main/resources/application-test.yml

@@ -0,0 +1,71 @@
+# 项目相关配置1
+ruoyi:
+  # 名称
+  name: dgtly_oneportal
+  # 版本
+  version: 4.0.0
+  # 版权年份
+  copyrightYear: 2019
+  # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
+  profile: D:/dgtly/uploadPath
+  # 获取ip地址开关
+  addressEnabled: true
+  #是否开启swagger
+  openSwagger: true
+#接口安全验证
+security:
+  #接口过期时间
+  apiTimeOut: 10
+  #接口的plat和对应的AppKey 支持多个用,号分割
+  platMap: "{wx:'cd72c223-923f-44a3-aede-b9f07dcd56b8'}"
+  #开发模式下 可以使用swagger测试 放过验签环节
+  isDev: true
+
+
+# 开发环境配置
+server:
+  # 服务器的HTTP端口,默认为80
+  port: 8888
+  servlet:
+    # 应用的访问路径
+    context-path: /
+  tomcat:
+    # tomcat的URI编码
+    uri-encoding: UTF-8
+    # tomcat最大线程数,默认为200
+    max-threads: 800
+    # Tomcat启动初始化的线程数,默认值25
+    min-spare-threads: 30
+ 
+# 日志配置
+logging:
+  level:
+    com.dgtly: debug
+    org.springframework: warn
+# Spring配置
+spring:
+  jackson:
+    time-zone: GMT+8
+    date-format: yyyy-MM-dd HH:mm:ss
+  profiles:
+    include: test-druid
+  # 文件上传
+  servlet:
+     multipart:
+       # 单个文件大小
+       max-file-size:  10MB
+       # 设置总上传的文件大小
+       max-request-size:  20MB
+  # 服务模块
+  devtools:
+    restart:
+      # 热部署开关
+      enabled: true
+# MyBatis
+mybatis:
+    # 搜索指定包别名
+    typeAliasesPackage: com.dgtly.**.domain
+    # 配置mapper的扫描,找到所有的mapper.xml映射文件
+    mapperLocations: classpath*:mapper/**/*Mapper.xml
+    # 加载全局的配置文件
+    configLocation: classpath:mybatis/mybatis-config.xml

+ 3 - 68
dgtly-api/src/main/resources/application.yml

@@ -1,69 +1,4 @@
-# 项目相关配置1
-ruoyi:
-  # 名称
-  name: dgtly_oneportal
-  # 版本
-  version: 4.0.0
-  # 版权年份
-  copyrightYear: 2019
-  # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
-  profile: D:/dgtly/uploadPath
-  # 获取ip地址开关
-  addressEnabled: true
-  #是否开启swagger
-  openSwagger: true
-#接口安全验证
-security:
-  #接口过期时间
-  apiTimeOut: 10
-  #接口的plat和对应的AppKey 支持多个用,号分割
-  platMap: "{wx:'cd72c223-923f-44a3-aede-b9f07dcd56b8'}"
-
-
-# 开发环境配置
-server:
-  # 服务器的HTTP端口,默认为80
-  port: 8888
-  servlet:
-    # 应用的访问路径
-    context-path: /
-  tomcat:
-    # tomcat的URI编码
-    uri-encoding: UTF-8
-    # tomcat最大线程数,默认为200
-    max-threads: 800
-    # Tomcat启动初始化的线程数,默认值25
-    min-spare-threads: 30
- 
-# 日志配置
-logging:
-  level:
-    com.dgtly: debug
-    org.springframework: warn
-# Spring配置
 spring:
 spring:
-  jackson:
-    time-zone: GMT+8
-    date-format: yyyy-MM-dd HH:mm:ss
-  profiles: 
-    active: druid
-  # 文件上传
-  servlet:
-     multipart:
-       # 单个文件大小
-       max-file-size:  10MB
-       # 设置总上传的文件大小
-       max-request-size:  20MB
-  # 服务模块
-  devtools:
-    restart:
-      # 热部署开关
-      enabled: true
-# MyBatis
-mybatis:
-    # 搜索指定包别名
-    typeAliasesPackage: com.dgtly.**.domain
-    # 配置mapper的扫描,找到所有的mapper.xml映射文件
-    mapperLocations: classpath*:mapper/**/*Mapper.xml
-    # 加载全局的配置文件
-    configLocation: classpath:mybatis/mybatis-config.xml
+  profiles:
+    active: dev
+#开发环境dev 测试环境test 正式环境prod

+ 10 - 5
dgtly-apiframework/src/main/java/com/dgtly/apiframework/interceptor/VerifyInterceptor.java

@@ -28,6 +28,9 @@ public class VerifyInterceptor  extends HandlerInterceptorAdapter {
     @Value("#{${security.platMap}}")
     @Value("#{${security.platMap}}")
     private Map<String,String> platMap;
     private Map<String,String> platMap;
 
 
+    @Value("#{${security.isDev}}")
+    private Boolean isDev;
+
     @Value("${security.apiTimeOut}")
     @Value("${security.apiTimeOut}")
     private int apiTimeOut;
     private int apiTimeOut;
 
 
@@ -50,11 +53,13 @@ public class VerifyInterceptor  extends HandlerInterceptorAdapter {
                  * 判断类或方法上是否有放行注解  只要一个有就不验证
                  * 判断类或方法上是否有放行注解  只要一个有就不验证
                  */
                  */
                 if(a1==null&&a2==null){
                 if(a1==null&&a2==null){
-                    String swaggerSign = request.getHeader("SwaggerSign");
-                    if(swaggerSign!=null&&!swaggerSign.trim().equals("")){
-                        if("dgtly-oneportal".equalsIgnoreCase(swaggerSign)){
-                            logger.info("swagger访问 测试 验签放行");
-                            return true;
+                    if(isDev){
+                        String swaggerSign = request.getHeader("SwaggerSign");
+                        if(swaggerSign!=null&&!swaggerSign.trim().equals("")){
+                            if("dgtly-oneportal".equalsIgnoreCase(swaggerSign)){
+                                logger.info("swagger访问 测试 验签放行");
+                                return true;
+                            }
                         }
                         }
                     }
                     }
                     /**
                     /**

+ 2 - 2
dgtly-common/src/main/java/com/dgtly/common/core/domain/ResultType.java

@@ -6,6 +6,8 @@ public enum ResultType {
     /** 成功 */
     /** 成功 */
     SUCCESS(0,"成功")
     SUCCESS(0,"成功")
     /** 查询结果为空错误 */
     /** 查询结果为空错误 */
+    ,LESSPARAM(402,"缺少请求参数")
+    /** 查询结果为空错误 */
     ,NUll(404,"查询结果为空")
     ,NUll(404,"查询结果为空")
     /** 错误 */
     /** 错误 */
     ,ERROR(500,"系统内部错误")
     ,ERROR(500,"系统内部错误")
@@ -20,8 +22,6 @@ public enum ResultType {
     /** 暂不支持此种请求方式 */
     /** 暂不支持此种请求方式 */
     ,FORBIDMETHOD(505,"暂不支持此种请求方式")
     ,FORBIDMETHOD(505,"暂不支持此种请求方式")
     /** 缺少参数 */
     /** 缺少参数 */
-    ,LESSPARAM(506,"缺少参数")
-
     ;
     ;