Commit a8ea50a059289915b53319910e3c27c7e56c72e5
1 parent
85e21092
update hutool 5.8.5
Showing
4 changed files
with
246 additions
and
4 deletions
yudao-dependencies/pom.xml
| @@ -46,7 +46,7 @@ | @@ -46,7 +46,7 @@ | ||
| 46 | <jasypt-spring-boot-starter.version>3.0.4</jasypt-spring-boot-starter.version> | 46 | <jasypt-spring-boot-starter.version>3.0.4</jasypt-spring-boot-starter.version> |
| 47 | <lombok.version>1.18.20</lombok.version> | 47 | <lombok.version>1.18.20</lombok.version> |
| 48 | <mapstruct.version>1.4.1.Final</mapstruct.version> | 48 | <mapstruct.version>1.4.1.Final</mapstruct.version> |
| 49 | - <hutool.version>5.7.22</hutool.version> | 49 | + <hutool.version>5.8.5</hutool.version> |
| 50 | <easyexcel.verion>3.1.1</easyexcel.verion> | 50 | <easyexcel.verion>3.1.1</easyexcel.verion> |
| 51 | <velocity.version>2.2</velocity.version> | 51 | <velocity.version>2.2</velocity.version> |
| 52 | <screw.version>1.0.5</screw.version> | 52 | <screw.version>1.0.5</screw.version> |
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/collection/ArrayUtils.java
| 1 | package cn.iocoder.yudao.framework.common.util.collection; | 1 | package cn.iocoder.yudao.framework.common.util.collection; |
| 2 | 2 | ||
| 3 | import cn.hutool.core.collection.CollectionUtil; | 3 | import cn.hutool.core.collection.CollectionUtil; |
| 4 | +import cn.hutool.core.collection.IterUtil; | ||
| 4 | import cn.hutool.core.util.ArrayUtil; | 5 | import cn.hutool.core.util.ArrayUtil; |
| 5 | 6 | ||
| 6 | import java.util.Collection; | 7 | import java.util.Collection; |
| @@ -44,7 +45,7 @@ public class ArrayUtils { | @@ -44,7 +45,7 @@ public class ArrayUtils { | ||
| 44 | if (CollectionUtil.isEmpty(from)) { | 45 | if (CollectionUtil.isEmpty(from)) { |
| 45 | return (T[]) (new Object[0]); | 46 | return (T[]) (new Object[0]); |
| 46 | } | 47 | } |
| 47 | - return ArrayUtil.toArray(from, (Class<T>) CollectionUtil.getElementType(from.iterator())); | 48 | + return ArrayUtil.toArray(from, (Class<T>) IterUtil.getElementType(from.iterator())); |
| 48 | } | 49 | } |
| 49 | 50 | ||
| 50 | public static <T> T get(T[] array, int index) { | 51 | public static <T> T get(T[] array, int index) { |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/AbstractPayClient.java
| 1 | package cn.iocoder.yudao.framework.pay.core.client.impl; | 1 | package cn.iocoder.yudao.framework.pay.core.client.impl; |
| 2 | 2 | ||
| 3 | -import cn.hutool.extra.validation.ValidationUtil; | ||
| 4 | import cn.iocoder.yudao.framework.pay.core.client.AbstractPayCodeMapping; | 3 | import cn.iocoder.yudao.framework.pay.core.client.AbstractPayCodeMapping; |
| 5 | import cn.iocoder.yudao.framework.pay.core.client.PayClient; | 4 | import cn.iocoder.yudao.framework.pay.core.client.PayClient; |
| 6 | import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; | 5 | import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; |
| @@ -10,6 +9,8 @@ import cn.iocoder.yudao.framework.pay.core.client.dto.PayRefundUnifiedReqDTO; | @@ -10,6 +9,8 @@ import cn.iocoder.yudao.framework.pay.core.client.dto.PayRefundUnifiedReqDTO; | ||
| 10 | import cn.iocoder.yudao.framework.pay.core.client.dto.PayRefundUnifiedRespDTO; | 9 | import cn.iocoder.yudao.framework.pay.core.client.dto.PayRefundUnifiedRespDTO; |
| 11 | import lombok.extern.slf4j.Slf4j; | 10 | import lombok.extern.slf4j.Slf4j; |
| 12 | 11 | ||
| 12 | +import javax.validation.Validation; | ||
| 13 | + | ||
| 13 | import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; | 14 | import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; |
| 14 | 15 | ||
| 15 | /** | 16 | /** |
| @@ -79,7 +80,7 @@ public abstract class AbstractPayClient<Config extends PayClientConfig> implemen | @@ -79,7 +80,7 @@ public abstract class AbstractPayClient<Config extends PayClientConfig> implemen | ||
| 79 | 80 | ||
| 80 | @Override | 81 | @Override |
| 81 | public final PayCommonResult<?> unifiedOrder(PayOrderUnifiedReqDTO reqDTO) { | 82 | public final PayCommonResult<?> unifiedOrder(PayOrderUnifiedReqDTO reqDTO) { |
| 82 | - ValidationUtil.validate(reqDTO); | 83 | + Validation.buildDefaultValidatorFactory().getValidator().validate(reqDTO); |
| 83 | // 执行短信发送 | 84 | // 执行短信发送 |
| 84 | PayCommonResult<?> result; | 85 | PayCommonResult<?> result; |
| 85 | try { | 86 | try { |
yudao-server/src/main/resources/application-local.yaml
0 → 100644
| 1 | +server: | ||
| 2 | + port: 48080 | ||
| 3 | + | ||
| 4 | +--- #################### 数据库相关配置 #################### | ||
| 5 | + | ||
| 6 | +spring: | ||
| 7 | + # 数据源配置项 | ||
| 8 | + autoconfigure: | ||
| 9 | + exclude: | ||
| 10 | + - com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure # 排除 Druid 的自动配置,使用 dynamic-datasource-spring-boot-starter 配置多数据源 | ||
| 11 | + - org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration # 排除积木报表带来的 MongoDB 的自动配置 | ||
| 12 | + datasource: | ||
| 13 | + druid: # Druid 【监控】相关的全局配置 | ||
| 14 | + web-stat-filter: | ||
| 15 | + enabled: true | ||
| 16 | + stat-view-servlet: | ||
| 17 | + enabled: true | ||
| 18 | + allow: # 设置白名单,不填则允许所有访问 | ||
| 19 | + url-pattern: /druid/* | ||
| 20 | + login-username: # 控制台管理用户名和密码 | ||
| 21 | + login-password: | ||
| 22 | + filter: | ||
| 23 | + stat: | ||
| 24 | + enabled: true | ||
| 25 | + log-slow-sql: true # 慢 SQL 记录 | ||
| 26 | + slow-sql-millis: 100 | ||
| 27 | + merge-sql: true | ||
| 28 | + wall: | ||
| 29 | + config: | ||
| 30 | + multi-statement-allow: true | ||
| 31 | + dynamic: # 多数据源配置 | ||
| 32 | + druid: # Druid 【连接池】相关的全局配置 | ||
| 33 | + initial-size: 5 # 初始连接数 | ||
| 34 | + min-idle: 10 # 最小连接池数量 | ||
| 35 | + max-active: 20 # 最大连接池数量 | ||
| 36 | + max-wait: 600000 # 配置获取连接等待超时的时间,单位:毫秒 | ||
| 37 | + time-between-eviction-runs-millis: 60000 # 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位:毫秒 | ||
| 38 | + min-evictable-idle-time-millis: 300000 # 配置一个连接在池中最小生存的时间,单位:毫秒 | ||
| 39 | + max-evictable-idle-time-millis: 900000 # 配置一个连接在池中最大生存的时间,单位:毫秒 | ||
| 40 | + validation-query: SELECT 1 FROM DUAL # 配置检测连接是否有效 | ||
| 41 | + test-while-idle: true | ||
| 42 | + test-on-borrow: false | ||
| 43 | + test-on-return: false | ||
| 44 | + primary: master | ||
| 45 | + datasource: | ||
| 46 | + master: | ||
| 47 | + name: ruoyi-vue-pro | ||
| 48 | + url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 | ||
| 49 | + # url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.master.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例 | ||
| 50 | + # url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name} # PostgreSQL 连接的示例 | ||
| 51 | + # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 | ||
| 52 | + # url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.master.name} # SQLServer 连接的示例 | ||
| 53 | + username: root | ||
| 54 | + password: 123456 | ||
| 55 | + # username: sa | ||
| 56 | + # password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W | ||
| 57 | + slave: # 模拟从库,可根据自己需要修改 | ||
| 58 | + name: ruoyi-vue-pro | ||
| 59 | + url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true # MySQL Connector/J 8.X 连接的示例 | ||
| 60 | + # url: jdbc:mysql://127.0.0.1:3306/${spring.datasource.dynamic.datasource.slave.name}?useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT # MySQL Connector/J 5.X 连接的示例 | ||
| 61 | + # url: jdbc:postgresql://127.0.0.1:5432/${spring.datasource.dynamic.datasource.slave.name} # PostgreSQL 连接的示例 | ||
| 62 | + # url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例 | ||
| 63 | + # url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=${spring.datasource.dynamic.datasource.slave.name} # SQLServer 连接的示例 | ||
| 64 | + username: root | ||
| 65 | + password: 123456 | ||
| 66 | + # username: sa | ||
| 67 | + # password: JSm:g(*%lU4ZAkz06cd52KqT3)i1?H7W | ||
| 68 | + | ||
| 69 | + # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 | ||
| 70 | + redis: | ||
| 71 | + host: 127.0.0.1 # 地址 | ||
| 72 | + port: 6379 # 端口 | ||
| 73 | + database: 0 # 数据库索引 | ||
| 74 | +# password: 123456 # 密码,建议生产环境开启 | ||
| 75 | + | ||
| 76 | +jasypt: | ||
| 77 | + encryptor: | ||
| 78 | + password: yuanma # 加解密的秘钥 | ||
| 79 | + | ||
| 80 | +--- #################### 定时任务相关配置 #################### | ||
| 81 | + | ||
| 82 | +# Quartz 配置项,对应 QuartzProperties 配置类 | ||
| 83 | +spring: | ||
| 84 | + quartz: | ||
| 85 | + auto-startup: false # 本地开发环境,尽量不要开启 Job | ||
| 86 | + scheduler-name: schedulerName # Scheduler 名字。默认为 schedulerName | ||
| 87 | + job-store-type: jdbc # Job 存储器类型。默认为 memory 表示内存,可选 jdbc 使用数据库。 | ||
| 88 | + wait-for-jobs-to-complete-on-shutdown: true # 应用关闭时,是否等待定时任务执行完成。默认为 false ,建议设置为 true | ||
| 89 | + properties: # 添加 Quartz Scheduler 附加属性,更多可以看 http://www.quartz-scheduler.org/documentation/2.4.0-SNAPSHOT/configuration.html 文档 | ||
| 90 | + org: | ||
| 91 | + quartz: | ||
| 92 | + # Scheduler 相关配置 | ||
| 93 | + scheduler: | ||
| 94 | + instanceName: schedulerName | ||
| 95 | + instanceId: AUTO # 自动生成 instance ID | ||
| 96 | + # JobStore 相关配置 | ||
| 97 | + jobStore: | ||
| 98 | + # JobStore 实现类。可见博客:https://blog.csdn.net/weixin_42458219/article/details/122247162 | ||
| 99 | + class: org.springframework.scheduling.quartz.LocalDataSourceJobStore | ||
| 100 | + isClustered: true # 是集群模式 | ||
| 101 | + clusterCheckinInterval: 15000 # 集群检查频率,单位:毫秒。默认为 15000,即 15 秒 | ||
| 102 | + misfireThreshold: 60000 # misfire 阀值,单位:毫秒。 | ||
| 103 | + # 线程池相关配置 | ||
| 104 | + threadPool: | ||
| 105 | + threadCount: 25 # 线程池大小。默认为 10 。 | ||
| 106 | + threadPriority: 5 # 线程优先级 | ||
| 107 | + class: org.quartz.simpl.SimpleThreadPool # 线程池类型 | ||
| 108 | + jdbc: # 使用 JDBC 的 JobStore 的时候,JDBC 的配置 | ||
| 109 | + initialize-schema: NEVER # 是否自动使用 SQL 初始化 Quartz 表结构。这里设置成 never ,我们手动创建表结构。 | ||
| 110 | + | ||
| 111 | +--- #################### 配置中心相关配置 #################### | ||
| 112 | + | ||
| 113 | +# Apollo 配置中心 | ||
| 114 | +apollo: | ||
| 115 | + bootstrap: | ||
| 116 | + enabled: true # 设置 Apollo 在启动阶段生效 | ||
| 117 | + eagerLoad: | ||
| 118 | + enabled: true # 设置 Apollo 在日志初始化前生效,可以实现日志的动态级别配置 | ||
| 119 | + jdbc: # 自定义的 JDBC 配置项,用于数据库的地址 | ||
| 120 | + dao: cn.iocoder.yudao.module.infra.dal.mysql.config.ConfigDAOImpl | ||
| 121 | + url: ${spring.datasource.dynamic.datasource.master.url} | ||
| 122 | + username: ${spring.datasource.dynamic.datasource.master.username} | ||
| 123 | + password: ${spring.datasource.dynamic.datasource.master.password} | ||
| 124 | + | ||
| 125 | +--- #################### 服务保障相关配置 #################### | ||
| 126 | + | ||
| 127 | +# Lock4j 配置项 | ||
| 128 | +lock4j: | ||
| 129 | + acquire-timeout: 3000 # 获取分布式锁超时时间,默认为 3000 毫秒 | ||
| 130 | + expire: 30000 # 分布式锁的超时时间,默认为 30 毫秒 | ||
| 131 | + | ||
| 132 | +# Resilience4j 配置项 | ||
| 133 | +resilience4j: | ||
| 134 | + ratelimiter: | ||
| 135 | + instances: | ||
| 136 | + backendA: | ||
| 137 | + limit-for-period: 1 # 每个周期内,允许的请求数。默认为 50 | ||
| 138 | + limit-refresh-period: 60s # 每个周期的时长,单位:微秒。默认为 500 | ||
| 139 | + timeout-duration: 1s # 被限流时,阻塞等待的时长,单位:微秒。默认为 5s | ||
| 140 | + register-health-indicator: true # 是否注册到健康监测 | ||
| 141 | + | ||
| 142 | +--- #################### 监控相关配置 #################### | ||
| 143 | + | ||
| 144 | +# Actuator 监控端点的配置项 | ||
| 145 | +management: | ||
| 146 | + endpoints: | ||
| 147 | + web: | ||
| 148 | + base-path: /actuator # Actuator 提供的 API 接口的根目录。默认为 /actuator | ||
| 149 | + exposure: | ||
| 150 | + include: '*' # 需要开放的端点。默认值只打开 health 和 info 两个端点。通过设置 * ,可以开放所有端点。 | ||
| 151 | + | ||
| 152 | +# Spring Boot Admin 配置项 | ||
| 153 | +spring: | ||
| 154 | + boot: | ||
| 155 | + admin: | ||
| 156 | + # Spring Boot Admin Client 客户端的相关配置 | ||
| 157 | + client: | ||
| 158 | + url: http://127.0.0.1:${server.port}/${spring.boot.admin.context-path} # 设置 Spring Boot Admin Server 地址 | ||
| 159 | + instance: | ||
| 160 | + service-host-type: IP # 注册实例时,优先使用 IP [IP, HOST_NAME, CANONICAL_HOST_NAME] | ||
| 161 | + # Spring Boot Admin Server 服务端的相关配置 | ||
| 162 | + context-path: /admin # 配置 Spring | ||
| 163 | + | ||
| 164 | +# 日志文件配置 | ||
| 165 | +logging: | ||
| 166 | + file: | ||
| 167 | + name: ${user.home}/logs/${spring.application.name}.log # 日志文件名,全路径 | ||
| 168 | + level: | ||
| 169 | + # 配置自己写的 MyBatis Mapper 打印日志 | ||
| 170 | + cn.iocoder.yudao.module.bpm.dal.mysql: debug | ||
| 171 | + cn.iocoder.yudao.module.infra.dal.mysql: debug | ||
| 172 | + cn.iocoder.yudao.module.pay.dal.mysql: debug | ||
| 173 | + cn.iocoder.yudao.module.system.dal.mysql: debug | ||
| 174 | + cn.iocoder.yudao.module.tool.dal.mysql: debug | ||
| 175 | + cn.iocoder.yudao.module.member.dal.mysql: debug | ||
| 176 | + | ||
| 177 | +--- #################### 微信公众号、小程序相关配置 #################### | ||
| 178 | +wx: | ||
| 179 | + mp: # 公众号配置(必填),参见 https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-mp-spring-boot-starter/README.md 文档 | ||
| 180 | + app-id: wx041349c6f39b268b | ||
| 181 | + secret: 5abee519483bc9f8cb37ce280e814bd0 | ||
| 182 | + # 存储配置,解决 AccessToken 的跨节点的共享 | ||
| 183 | + config-storage: | ||
| 184 | + type: RedisTemplate # 采用 RedisTemplate 操作 Redis,会自动从 Spring 中获取 | ||
| 185 | + key-prefix: wx # Redis Key 的前缀 TODO 芋艿:解决下 Redis key 管理的配置 | ||
| 186 | + http-client-type: HttpClient # 采用 HttpClient 请求微信公众号平台 | ||
| 187 | + miniapp: # 小程序配置(必填),参见 https://github.com/Wechat-Group/WxJava/blob/develop/spring-boot-starters/wx-java-miniapp-spring-boot-starter/README.md 文档 | ||
| 188 | + appid: wx63c280fe3248a3e7 | ||
| 189 | + secret: 6f270509224a7ae1296bbf1c8cb97aed | ||
| 190 | + config-storage: | ||
| 191 | + type: RedisTemplate # 采用 RedisTemplate 操作 Redis,会自动从 Spring 中获取 | ||
| 192 | + key-prefix: wa # Redis Key 的前缀 TODO 芋艿:解决下 Redis key 管理的配置 | ||
| 193 | + http-client-type: HttpClient # 采用 HttpClient 请求微信公众号平台 | ||
| 194 | + | ||
| 195 | +--- #################### 芋道相关配置 #################### | ||
| 196 | + | ||
| 197 | +# 芋道配置项,设置当前项目所有自定义的配置 | ||
| 198 | +yudao: | ||
| 199 | + captcha: | ||
| 200 | + enable: false # 本地环境,暂时关闭图片验证码,方便登录等接口的测试 | ||
| 201 | + security: | ||
| 202 | + mock-enable: true | ||
| 203 | + xss: | ||
| 204 | + enable: false | ||
| 205 | + exclude-urls: # 如下两个 url,仅仅是为了演示,去掉配置也没关系 | ||
| 206 | + - ${spring.boot.admin.context-path}/** # 不处理 Spring Boot Admin 的请求 | ||
| 207 | + - ${management.endpoints.web.base-path}/** # 不处理 Actuator 的请求 | ||
| 208 | + pay: | ||
| 209 | + pay-notify-url: http://niubi.natapp1.cc/api/pay/order/notify | ||
| 210 | + pay-return-url: http://niubi.natapp1.cc/api/pay/order/return | ||
| 211 | + refund-notify-url: http://niubi.natapp1.cc/api/pay/refund/notify | ||
| 212 | + access-log: # 访问日志的配置项 | ||
| 213 | + enable: false | ||
| 214 | + error-code: # 错误码相关配置项 | ||
| 215 | + enable: false | ||
| 216 | + demo: false # 关闭演示模式 | ||
| 217 | + | ||
| 218 | +justauth: | ||
| 219 | + enabled: true | ||
| 220 | + type: | ||
| 221 | + DINGTALK: # 钉钉 | ||
| 222 | + client-id: dingvrnreaje3yqvzhxg | ||
| 223 | + client-secret: i8E6iZyDvZj51JIb0tYsYfVQYOks9Cq1lgryEjFRqC79P3iJcrxEwT6Qk2QvLrLI | ||
| 224 | + ignore-check-redirect-uri: true | ||
| 225 | + WECHAT_ENTERPRISE: # 企业微信 | ||
| 226 | + client-id: wwd411c69a39ad2e54 | ||
| 227 | + client-secret: 1wTb7hYxnpT2TUbIeHGXGo7T0odav1ic10mLdyyATOw | ||
| 228 | + agent-id: 1000004 | ||
| 229 | + ignore-check-redirect-uri: true | ||
| 230 | + WECHAT_MINI_APP: # 微信小程序 | ||
| 231 | + client-id: ${wx.miniapp.appid} | ||
| 232 | + client-secret: ${wx.miniapp.secret} | ||
| 233 | + ignore-check-redirect-uri: true | ||
| 234 | + ignore-check-state: true # 微信小程序,不会使用到 state,所以不进行校验 | ||
| 235 | + | ||
| 236 | + cache: | ||
| 237 | + type: REDIS | ||
| 238 | + prefix: 'social_auth_state:' # 缓存前缀,目前只对 Redis 缓存生效,默认 JUSTAUTH::STATE:: | ||
| 239 | + timeout: 24h # 超时时长,目前只对 Redis 缓存生效,默认 3 分钟 | ||
| 240 | + |