Commit afc76973ce2423dffd528b67ad39cbb8cee83cf5
Merge branch 'master' of https://gitee.com/zhijiantianya/ruoyi-vue-pro into feature/1.8.0-uniapp
# Conflicts: # yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/DateUtils.java # yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/vo/CouponBaseVO.java # yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/vo/CouponExcelVO.java # yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/vo/CouponExportReqVO.java # yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/vo/CouponPageReqVO.java # yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/coupon/vo/CouponRespVO.java # yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempleteBaseVO.java # yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempleteExcelVO.java # yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempleteExportReqVO.java # yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempletePageReqVO.java # yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/controller/admin/templete/vo/CouponTempleteRespVO.java # yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/dal/dataobject/CouponTemplete/CouponTempleteDO.java # yudao-module-mall/yudao-module-coupon-biz/src/main/java/cn/iocoder/yudao/module/coupon/dal/dataobject/coupon/CouponDO.java # yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuPageReqVO.java # yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuRespVO.java # yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/discount/DiscountProductDO.java # yudao-module-mall/yudao-module-promotion-biz/src/main/java/cn/iocoder/yudao/module/promotion/dal/dataobject/reward/RewardActivityDO.java # yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/controller/app/order/AppTradeOrderController.java # yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/cart/TradeCartItemDO.java # yudao-module-member/yudao-module-member-api/src/main/java/cn/iocoder/yudao/module/member/api/user/dto/UserInfoDTO.java # yudao-module-member/yudao-module-member-biz/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java # yudao-server/pom.xml # yudao-server/src/main/resources/application-local.yaml # yudao-server/src/main/resources/application.yaml # yudao-ui-admin/src/views/mall/CouponTemplete/index.vue # yudao-ui-admin/src/views/mall/product/property/index.vue # yudao-ui-admin/src/views/mall/product/spu/index.vue # yudao-ui-admin/src/views/mall/product/spu/save.vue # yudao-ui-admin/src/views/system/role/index.vue
Showing
744 changed files
with
30729 additions
and
21310 deletions
Too many changes.
To preserve performance only 100 of 744 files are displayed.
README.md
| ... | ... | @@ -44,6 +44,18 @@ |
| 44 | 44 | | `yudao-cloud` | Spring Cloud 微服务 | **[Gitee](https://gitee.com/zhijiantianya/yudao-cloud)** [Github](https://github.com/YunaiV/yudao-cloud) | |
| 45 | 45 | | `Spring-Boot-Labs` | Spring Boot & Cloud 入门 | **[Gitee](https://gitee.com/zhijiantianya/SpringBoot-Labs)** [Github](https://github.com/YunaiV/SpringBoot-Labs) | |
| 46 | 46 | |
| 47 | +## 😎 开源协议 | |
| 48 | + | |
| 49 | +**为什么推荐使用本项目?** | |
| 50 | + | |
| 51 | +① 本项目采用比 Apache 2.0 更宽松的 [MIT License](https://gitee.com/zhijiantianya/ruoyi-vue-pro/blob/master/LICENSE) 开源协议,个人与企业可 100% 免费使用,不用保留类作者、Copyright 信息。 | |
| 52 | + | |
| 53 | +② 代码全部开源,不会像其他项目一样,只开源部分代码,让你无法了解整个项目的架构设计。[国产开源项目对比](https://www.yuque.com/xiatian-bsgny/lm0ec1/wqf8mn) | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | +③ 代码整洁、架构整洁,遵循《阿里巴巴 Java 开发手册》规范,代码注释详细,57000 行 Java 代码,22000 行代码注释。 | |
| 58 | + | |
| 47 | 59 | ## 🐼 内置功能 |
| 48 | 60 | |
| 49 | 61 | 系统内置多种多种业务功能,可以用于快速你的业务系统: |
| ... | ... | @@ -174,44 +186,44 @@ ps:核心功能已经实现,正在对接微信小程序中... |
| 174 | 186 | |
| 175 | 187 | ### 后端 |
| 176 | 188 | |
| 177 | -| 框架 | 说明 | 版本 | 学习指南 | | |
| 178 | -|---------------------------------------------------------------------------------------------|-----------------------|------------------|----------------------------------------------------------------| | |
| 179 | -| [Spring Boot](https://spring.io/projects/spring-boot) | 应用开发框架 | 2.6.12 | [文档](https://github.com/YunaiV/SpringBoot-Labs) | | |
| 180 | -| [MySQL](https://www.mysql.com/cn/) | 数据库服务器 | 5.7 / 8.0+ | | | |
| 181 | -| [Druid](https://github.com/alibaba/druid) | JDBC 连接池、监控组件 | 1.2.13-SNSAPSHOT | [文档](http://www.iocoder.cn/Spring-Boot/datasource-pool/?yudao) | | |
| 182 | -| [MyBatis Plus](https://mp.baomidou.com/) | MyBatis 增强工具包 | 3.5.2 | [文档](http://www.iocoder.cn/Spring-Boot/MyBatis/?yudao) | | |
| 183 | -| [Dynamic Datasource](https://dynamic-datasource.com/) | 动态数据源 | 3.5.2 | [文档](http://www.iocoder.cn/Spring-Boot/datasource-pool/?yudao) | | |
| 184 | -| [Redis](https://redis.io/) | key-value 数据库 | 5.0 | | | |
| 185 | -| [Redisson](https://github.com/redisson/redisson) | Redis 客户端 | 3.17.7 | [文档](http://www.iocoder.cn/Spring-Boot/Redis/?yudao) | | |
| 186 | -| [Spring MVC](https://github.com/spring-projects/spring-framework/tree/master/spring-webmvc) | MVC 框架 | 5.3.20 | [文档](http://www.iocoder.cn/SpringMVC/MVC/?yudao) | | |
| 187 | -| [Spring Security](https://github.com/spring-projects/spring-security) | Spring 安全框架 | 5.6.5 | [文档](http://www.iocoder.cn/Spring-Boot/Spring-Security/?yudao) | | |
| 188 | -| [Hibernate Validator](https://github.com/hibernate/hibernate-validator) | 参数校验组件 | 6.2.3 | [文档](http://www.iocoder.cn/Spring-Boot/Validation/?yudao) | | |
| 189 | -| [Flowable](https://github.com/flowable/flowable-engine) | 工作流引擎 | 6.7.2 | [文档](https://doc.iocoder.cn/bpm/) | | |
| 190 | -| [Quartz](https://github.com/quartz-scheduler) | 任务调度组件 | 2.3.2 | [文档](http://www.iocoder.cn/Spring-Boot/Job/?yudao) | | |
| 191 | -| [Knife4j](https://gitee.com/xiaoym/knife4j) | Swagger 增强 UI 实现 | 3.0.3 | [文档](http://www.iocoder.cn/Spring-Boot/Swagger/?yudao) | | |
| 192 | -| [Resilience4j](https://github.com/resilience4j/resilience4j) | 服务保障组件 | 1.7.1 | [文档](http://www.iocoder.cn/Spring-Boot/Resilience4j/?yudao) | | |
| 193 | -| [SkyWalking](https://skywalking.apache.org/) | 分布式应用追踪系统 | 8.5.0 | [文档](http://www.iocoder.cn/Spring-Boot/SkyWalking/?yudao) | | |
| 194 | -| [Spring Boot Admin](https://github.com/codecentric/spring-boot-admin) | Spring Boot 监控平台 | 2.6.9 | [文档](http://www.iocoder.cn/Spring-Boot/Admin/?yudao) | | |
| 195 | -| [Jackson](https://github.com/FasterXML/jackson) | JSON 工具库 | 2.13.3 | | | |
| 196 | -| [MapStruct](https://mapstruct.org/) | Java Bean 转换 | 1.5.2.Final | [文档](http://www.iocoder.cn/Spring-Boot/MapStruct/?yudao) | | |
| 197 | -| [Lombok](https://projectlombok.org/) | 消除冗长的 Java 代码 | 1.18.24 | [文档](http://www.iocoder.cn/Spring-Boot/Lombok/?yudao) | | |
| 198 | -| [JUnit](https://junit.org/junit5/) | Java 单元测试框架 | 5.8.2 | - | | |
| 199 | -| [Mockito](https://github.com/mockito/mockito) | Java Mock 框架 | 4.8.0 | - | | |
| 189 | +| 框架 | 说明 | 版本 | 学习指南 | | |
| 190 | +|---------------------------------------------------------------------------------------------|-----------------------|-------------|----------------------------------------------------------------| | |
| 191 | +| [Spring Boot](https://spring.io/projects/spring-boot) | 应用开发框架 | 2.6.13 | [文档](https://github.com/YunaiV/SpringBoot-Labs) | | |
| 192 | +| [MySQL](https://www.mysql.com/cn/) | 数据库服务器 | 5.7 / 8.0+ | | | |
| 193 | +| [Druid](https://github.com/alibaba/druid) | JDBC 连接池、监控组件 | 1.2.14 | [文档](http://www.iocoder.cn/Spring-Boot/datasource-pool/?yudao) | | |
| 194 | +| [MyBatis Plus](https://mp.baomidou.com/) | MyBatis 增强工具包 | 3.5.2 | [文档](http://www.iocoder.cn/Spring-Boot/MyBatis/?yudao) | | |
| 195 | +| [Dynamic Datasource](https://dynamic-datasource.com/) | 动态数据源 | 3.5.2 | [文档](http://www.iocoder.cn/Spring-Boot/datasource-pool/?yudao) | | |
| 196 | +| [Redis](https://redis.io/) | key-value 数据库 | 5.0 / 6.0 | | | |
| 197 | +| [Redisson](https://github.com/redisson/redisson) | Redis 客户端 | 3.17.7 | [文档](http://www.iocoder.cn/Spring-Boot/Redis/?yudao) | | |
| 198 | +| [Spring MVC](https://github.com/spring-projects/spring-framework/tree/master/spring-webmvc) | MVC 框架 | 5.3.23 | [文档](http://www.iocoder.cn/SpringMVC/MVC/?yudao) | | |
| 199 | +| [Spring Security](https://github.com/spring-projects/spring-security) | Spring 安全框架 | 5.6.8 | [文档](http://www.iocoder.cn/Spring-Boot/Spring-Security/?yudao) | | |
| 200 | +| [Hibernate Validator](https://github.com/hibernate/hibernate-validator) | 参数校验组件 | 6.2.3 | [文档](http://www.iocoder.cn/Spring-Boot/Validation/?yudao) | | |
| 201 | +| [Flowable](https://github.com/flowable/flowable-engine) | 工作流引擎 | 6.7.2 | [文档](https://doc.iocoder.cn/bpm/) | | |
| 202 | +| [Quartz](https://github.com/quartz-scheduler) | 任务调度组件 | 2.3.2 | [文档](http://www.iocoder.cn/Spring-Boot/Job/?yudao) | | |
| 203 | +| [Knife4j](https://gitee.com/xiaoym/knife4j) | Swagger 增强 UI 实现 | 3.0.3 | [文档](http://www.iocoder.cn/Spring-Boot/Swagger/?yudao) | | |
| 204 | +| [Resilience4j](https://github.com/resilience4j/resilience4j) | 服务保障组件 | 1.7.1 | [文档](http://www.iocoder.cn/Spring-Boot/Resilience4j/?yudao) | | |
| 205 | +| [SkyWalking](https://skywalking.apache.org/) | 分布式应用追踪系统 | 8.5.0 | [文档](http://www.iocoder.cn/Spring-Boot/SkyWalking/?yudao) | | |
| 206 | +| [Spring Boot Admin](https://github.com/codecentric/spring-boot-admin) | Spring Boot 监控平台 | 2.6.9 | [文档](http://www.iocoder.cn/Spring-Boot/Admin/?yudao) | | |
| 207 | +| [Jackson](https://github.com/FasterXML/jackson) | JSON 工具库 | 2.13.3 | | | |
| 208 | +| [MapStruct](https://mapstruct.org/) | Java Bean 转换 | 1.5.3.Final | [文档](http://www.iocoder.cn/Spring-Boot/MapStruct/?yudao) | | |
| 209 | +| [Lombok](https://projectlombok.org/) | 消除冗长的 Java 代码 | 1.18.24 | [文档](http://www.iocoder.cn/Spring-Boot/Lombok/?yudao) | | |
| 210 | +| [JUnit](https://junit.org/junit5/) | Java 单元测试框架 | 5.8.2 | - | | |
| 211 | +| [Mockito](https://github.com/mockito/mockito) | Java Mock 框架 | 4.8.0 | - | | |
| 200 | 212 | |
| 201 | 213 | ### [管理后台 Vue2 前端](./yudao-ui-admin) |
| 202 | 214 | |
| 203 | -| 框架 | 说明 | 版本 | | |
| 204 | -|------------------------------------------------------------------------------|---------------|--------| | |
| 205 | -| [Vue](https://cn.vuejs.org/index.html) | JavaScript 框架 | 2.6.12 | | |
| 206 | -| [Vue Element Admin](https://panjiachen.github.io/vue-element-admin-site/zh/) | 后台前端解决方案 | - | | |
| 215 | +| 框架 | 说明 | 版本 | | |
| 216 | +|------------------------------------------------------------------------------|---------------|-------| | |
| 217 | +| [Vue](https://cn.vuejs.org/index.html) | JavaScript 框架 | 2.7.0 | | |
| 218 | +| [Vue Element Admin](https://panjiachen.github.io/vue-element-admin-site/zh/) | 后台前端解决方案 | - | | |
| 207 | 219 | |
| 208 | 220 | ### [管理后台 Vue3 前端](./yudao-ui-admin-vue3) |
| 209 | 221 | |
| 210 | -| 框架 | 说明 | 版本 | | |
| 222 | +| 框架 | 说明 | 版本 | | |
| 211 | 223 | |----------------------------------------------------------------------|-----------------|--------| |
| 212 | -| [Vue](https://staging-cn.vuejs.org/) | Vue 框架 | 3.2.41 | | |
| 213 | -| [Vite](https://cn.vitejs.dev//) | 开发与构建工具 | 3.1.8 | | |
| 214 | -| [Element Plus](https://element-plus.org/zh-CN/) | Element Plus | 2.2.18 | | |
| 224 | +| [Vue](https://staging-cn.vuejs.org/) | Vue 框架 | 3.2.44 | | |
| 225 | +| [Vite](https://cn.vitejs.dev//) | 开发与构建工具 | 3.2.3 | | |
| 226 | +| [Element Plus](https://element-plus.org/zh-CN/) | Element Plus | 2.2.20 | | |
| 215 | 227 | | [TypeScript](https://www.typescriptlang.org/docs/) | TypeScript | 4.8.4 | |
| 216 | 228 | | [pinia](https://pinia.vuejs.org/) | vuex5 | 2.0.23 | |
| 217 | 229 | | [vue-i18n](https://kazupon.github.io/vue-i18n/zh/introduction.html/) | 国际化 | 9.2.2 | | ... | ... |
pom.xml
| ... | ... | @@ -38,7 +38,7 @@ |
| 38 | 38 | <maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version> |
| 39 | 39 | <!-- 看看咋放到 bom 里 --> |
| 40 | 40 | <lombok.version>1.18.24</lombok.version> |
| 41 | - <mapstruct.version>1.5.2.Final</mapstruct.version> | |
| 41 | + <mapstruct.version>1.5.3.Final</mapstruct.version> | |
| 42 | 42 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| 43 | 43 | </properties> |
| 44 | 44 | ... | ... |
sql/mysql/vue3-menu.sql renamed to sql/mysql/optional/vue3-menu.sql
| 1 | 1 | -- ---------------------------- |
| 2 | 2 | -- Table structure for system_menu |
| 3 | 3 | -- icon 不兼容 |
| 4 | +-- 注意!!!只有在使用 yudao-ui-admin-vue3 才进行导入!!! | |
| 5 | +-- 注意!!!只有在使用 yudao-ui-admin-vue3 才进行导入!!! | |
| 6 | +-- 注意!!!只有在使用 yudao-ui-admin-vue3 才进行导入!!! | |
| 4 | 7 | -- ---------------------------- |
| 5 | 8 | DROP TABLE IF EXISTS `system_menu`; |
| 6 | 9 | CREATE TABLE `system_menu` ( |
| ... | ... | @@ -257,7 +260,7 @@ INSERT INTO `system_menu` VALUES (1264, '客户端查询', 'system:oauth2-client |
| 257 | 260 | INSERT INTO `system_menu` VALUES (1265, '客户端创建', 'system:oauth2-client:create', 3, 2, 1263, '', '', '', 0, b'1', b'1', '', '2022-05-10 16:26:33', '1', '2022-05-11 00:31:23', b'0'); |
| 258 | 261 | INSERT INTO `system_menu` VALUES (1266, '客户端更新', 'system:oauth2-client:update', 3, 3, 1263, '', '', '', 0, b'1', b'1', '', '2022-05-10 16:26:33', '1', '2022-05-11 00:31:28', b'0'); |
| 259 | 262 | INSERT INTO `system_menu` VALUES (1267, '客户端删除', 'system:oauth2-client:delete', 3, 4, 1263, '', '', '', 0, b'1', b'1', '', '2022-05-10 16:26:33', '1', '2022-05-11 00:31:33', b'0'); |
| 260 | -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1281, '可视化报表', '', 1, 12, 0, '/visualization', 'ep:histogram', NULL, 0, b'1', b'1', '1', '2022-07-10 20:22:15', '1', '2022-07-10 20:33:30', b'0'); | |
| 261 | -INSERT INTO `system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (1282, '积木报表', '', 2, 1, 1281, 'jimu-report', 'ep:histogram', 'visualization/jmreport/index', 0, b'1', b'1', '1', '2022-07-10 20:26:36', '1', '2022-07-28 21:17:34', b'0'); | |
| 263 | +INSERT INTO `system_menu` VALUES (1281, '可视化报表', '', 1, 12, 0, '/visualization', 'ep:histogram', NULL, 0, b'1', b'1', '1', '2022-07-10 20:22:15', '1', '2022-07-10 20:33:30', b'0'); | |
| 264 | +INSERT INTO `system_menu` VALUES (1282, '积木报表', '', 2, 1, 1281, 'jimu-report', 'ep:histogram', 'visualization/jmreport/index', 0, b'1', b'1', '1', '2022-07-10 20:26:36', '1', '2022-07-28 21:17:34', b'0'); | |
| 262 | 265 | |
| 263 | 266 | SET FOREIGN_KEY_CHECKS = 1; | ... | ... |
sql/mysql/update.sql deleted
| 1 | --- ---------------------------- | |
| 2 | --- 升级SQL文件,全新安装只需要执行ruoyi-vue-pro.sql文件即可 | |
| 3 | --- 1.6.2 ==> 1.6.3 | |
| 4 | --- ---------------------------- | |
| 5 | --- 积木报表菜单 | |
| 6 | -INSERT INTO `system_menu` VALUES (1281, '可视化报表', '', 1, 12, 0, '/visualization', 'chart', NULL, 0, b'1', b'1', '1', '2022-07-10 20:22:15', '1', '2022-07-10 20:33:30', b'0'); | |
| 7 | -INSERT INTO `system_menu` VALUES (1282, '积木报表', '', 2, 1, 1281, 'jm-report', '#', 'visualization/jm/index', 0, b'1', b'1', '1', '2022-07-10 20:26:36', '1', '2022-07-10 20:33:26', b'0'); | |
| 8 | 0 | \ No newline at end of file |
sql/optional/mall/coupon.sql
| ... | ... | @@ -20,10 +20,10 @@ CREATE TABLE `coupon` |
| 20 | 20 | `whether_noticed` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否已提醒', |
| 21 | 21 | `state` tinyint(4) UNSIGNED NOT NULL DEFAULT 0 COMMENT '优惠券状态 1已领用(未使用) 2已使用 3已过期', |
| 22 | 22 | `get_type` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 COMMENT '获取方式1订单2.直接领取3.活动领取 4转赠 5分享获取', |
| 23 | - `fetch_time` datetime NOT NULL DEFAULT 0 COMMENT '领取时间', | |
| 24 | - `use_time` datetime NOT NULL DEFAULT 0 COMMENT '使用时间', | |
| 25 | - `start_time` datetime NOT NULL DEFAULT 0 COMMENT '可使用的开始时间', | |
| 26 | - `end_time` datetime NOT NULL DEFAULT 0 COMMENT '有效期结束时间', | |
| 23 | + `fetch_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '领取时间', | |
| 24 | + `use_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '使用时间', | |
| 25 | + `start_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '可使用的开始时间', | |
| 26 | + `end_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '有效期结束时间', | |
| 27 | 27 | `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', |
| 28 | 28 | `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
| 29 | 29 | `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | ... | ... |
sql/optional/mall/mall.sql
| ... | ... | @@ -23,18 +23,18 @@ SET FOREIGN_KEY_CHECKS = 0; |
| 23 | 23 | DROP TABLE IF EXISTS `market_activity`; |
| 24 | 24 | CREATE TABLE `market_activity` ( |
| 25 | 25 | `id` bigint NOT NULL AUTO_INCREMENT COMMENT '活动编号', |
| 26 | - `title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT '活动标题', | |
| 26 | + `title` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT '活动标题', | |
| 27 | 27 | `activity_type` tinyint NOT NULL COMMENT '活动类型', |
| 28 | 28 | `status` tinyint NOT NULL DEFAULT -1 COMMENT '活动状态', |
| 29 | 29 | `start_time` datetime NOT NULL COMMENT '开始时间', |
| 30 | 30 | `end_time` datetime NOT NULL COMMENT '结束时间', |
| 31 | 31 | `invalid_time` datetime NULL DEFAULT NULL COMMENT '失效时间', |
| 32 | 32 | `delete_time` datetime NULL DEFAULT NULL COMMENT '删除时间', |
| 33 | - `time_limited_discount` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '限制折扣字符串,使用 JSON 序列化成字符串存储', | |
| 34 | - `full_privilege` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '限制折扣字符串,使用 JSON 序列化成字符串存储', | |
| 35 | - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '创建者', | |
| 33 | + `time_limited_discount` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '限制折扣字符串,使用 JSON 序列化成字符串存储', | |
| 34 | + `full_privilege` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '限制折扣字符串,使用 JSON 序列化成字符串存储', | |
| 35 | + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', | |
| 36 | 36 | `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
| 37 | - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '更新者', | |
| 37 | + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | |
| 38 | 38 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| 39 | 39 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 40 | 40 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| ... | ... | @@ -53,18 +53,18 @@ COMMIT; |
| 53 | 53 | DROP TABLE IF EXISTS `market_banner`; |
| 54 | 54 | CREATE TABLE `market_banner` ( |
| 55 | 55 | `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'Banner编号', |
| 56 | - `title` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL DEFAULT '' COMMENT 'Banner标题', | |
| 57 | - `pic_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '图片URL', | |
| 56 | + `title` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '' COMMENT 'Banner标题', | |
| 57 | + `pic_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '图片URL', | |
| 58 | 58 | `status` tinyint NOT NULL DEFAULT -1 COMMENT '活动状态', |
| 59 | - `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '跳转地址', | |
| 60 | - `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '创建者', | |
| 59 | + `url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '跳转地址', | |
| 60 | + `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', | |
| 61 | 61 | `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
| 62 | - `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT '' COMMENT '更新者', | |
| 62 | + `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '更新者', | |
| 63 | 63 | `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', |
| 64 | 64 | `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除', |
| 65 | 65 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 66 | 66 | `sort` tinyint NULL DEFAULT NULL COMMENT '排序', |
| 67 | - `memo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NULL DEFAULT NULL COMMENT '描述', | |
| 67 | + `memo` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '描述', | |
| 68 | 68 | PRIMARY KEY (`id`) USING BTREE |
| 69 | 69 | ) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = 'Banner管理'; |
| 70 | 70 | |
| ... | ... | @@ -81,11 +81,11 @@ DROP TABLE IF EXISTS `member_address`; |
| 81 | 81 | CREATE TABLE `member_address` ( |
| 82 | 82 | `id` bigint NOT NULL AUTO_INCREMENT COMMENT '收件地址编号', |
| 83 | 83 | `user_id` bigint NOT NULL COMMENT '用户编号', |
| 84 | - `name` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '收件人名称', | |
| 85 | - `mobile` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '手机号', | |
| 84 | + `name` varchar(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '收件人名称', | |
| 85 | + `mobile` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '手机号', | |
| 86 | 86 | `area_id` bigint NOT NULL COMMENT '地区编码', |
| 87 | - `post_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '邮编', | |
| 88 | - `detail_address` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL COMMENT '收件详细地址', | |
| 87 | + `post_code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '邮编', | |
| 88 | + `detail_address` varchar(250) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '收件详细地址', | |
| 89 | 89 | `defaulted` bit(1) NOT NULL COMMENT '是否默认', |
| 90 | 90 | `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '' COMMENT '创建者', |
| 91 | 91 | `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', |
| ... | ... | @@ -95,7 +95,7 @@ CREATE TABLE `member_address` ( |
| 95 | 95 | `tenant_id` bigint NOT NULL DEFAULT 0 COMMENT '租户编号', |
| 96 | 96 | PRIMARY KEY (`id`) USING BTREE, |
| 97 | 97 | INDEX `idx_userId`(`user_id` ASC) USING BTREE |
| 98 | -) ENGINE = InnoDB AUTO_INCREMENT = 21 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_bin COMMENT = '用户收件地址'; | |
| 98 | +) ENGINE = InnoDB AUTO_INCREMENT = 21 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci COMMENT = '用户收件地址'; | |
| 99 | 99 | |
| 100 | 100 | -- ---------------------------- |
| 101 | 101 | -- Records of member_address |
| ... | ... | @@ -307,7 +307,7 @@ INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, ` |
| 307 | 307 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2022, '规格更新', 'product:property:update', 3, 3, 2019, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-08-01 14:55:35', b'0'); |
| 308 | 308 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2023, '规格删除', 'product:property:delete', 3, 4, 2019, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-08-01 14:55:35', b'0'); |
| 309 | 309 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2024, '规格导出', 'product:property:export', 3, 5, 2019, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:55:35', '', '2022-08-01 14:55:35', b'0'); |
| 310 | -INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2025, 'Banner管理', '', 2, 1, 2000, 'brand', '', 'mall/market/banner/index', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0'); | |
| 310 | +INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2025, 'Banner管理', '', 2, 1, 2000, 'banner', '', 'mall/market/banner/index', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0'); | |
| 311 | 311 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2026, 'Banner查询', 'market:banner:query', 3, 1, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0'); |
| 312 | 312 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2027, 'Banner创建', 'market:banner:create', 3, 2, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0'); |
| 313 | 313 | INSERT INTO `ruoyi-vue-pro`.`system_menu` (`id`, `name`, `permission`, `type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `visible`, `keep_alive`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES (2028, 'Banner更新', 'market:banner:update', 3, 3, 2025, '', '', '', 0, b'1', b'1', '', '2022-08-01 14:56:14', '', '2022-08-01 14:56:14', b'0'); | ... | ... |
yudao-dependencies/pom.xml
| ... | ... | @@ -16,19 +16,18 @@ |
| 16 | 16 | <properties> |
| 17 | 17 | <revision>1.6.4-snapshot</revision> |
| 18 | 18 | <!-- 统一依赖管理 --> |
| 19 | - <spring.boot.version>2.6.12</spring.boot.version> | |
| 19 | + <spring.boot.version>2.6.13</spring.boot.version> | |
| 20 | 20 | <!-- Web 相关 --> |
| 21 | 21 | <knife4j.version>3.0.3</knife4j.version> |
| 22 | 22 | <swagger-annotations.version>1.6.7</swagger-annotations.version> |
| 23 | 23 | <servlet.versoin>2.5</servlet.versoin> |
| 24 | 24 | <!-- DB 相关 --> |
| 25 | - <druid.version>1.2.13-SNSAPSHOT</druid.version> | |
| 25 | + <druid.version>1.2.14</druid.version> | |
| 26 | 26 | <mybatis-plus.version>3.5.2</mybatis-plus.version> |
| 27 | 27 | <mybatis-plus-generator.version>3.5.2</mybatis-plus-generator.version> |
| 28 | 28 | <dynamic-datasource.version>3.5.2</dynamic-datasource.version> |
| 29 | 29 | <redisson.version>3.17.7</redisson.version> |
| 30 | 30 | <!-- Config 配置中心相关 --> |
| 31 | - <apollo.version>2.0.1</apollo.version> | |
| 32 | 31 | <!-- 服务保障相关 --> |
| 33 | 32 | <lock4j.version>2.2.2</lock4j.version> |
| 34 | 33 | <resilience4j.version>1.7.1</resilience4j.version> |
| ... | ... | @@ -43,11 +42,10 @@ |
| 43 | 42 | <!-- Bpm 工作流相关 --> |
| 44 | 43 | <flowable.version>6.7.2</flowable.version> |
| 45 | 44 | <!-- 工具类相关 --> |
| 46 | - <jasypt-spring-boot-starter.version>3.0.4</jasypt-spring-boot-starter.version> | |
| 47 | 45 | <lombok.version>1.18.24</lombok.version> |
| 48 | - <mapstruct.version>1.5.2.Final</mapstruct.version> | |
| 49 | - <hutool.version>5.8.8</hutool.version> | |
| 50 | - <easyexcel.verion>3.1.1</easyexcel.verion> | |
| 46 | + <mapstruct.version>1.5.3.Final</mapstruct.version> | |
| 47 | + <hutool.version>5.8.9</hutool.version> | |
| 48 | + <easyexcel.verion>3.1.2</easyexcel.verion> | |
| 51 | 49 | <velocity.version>2.3</velocity.version> |
| 52 | 50 | <screw.version>1.0.5</screw.version> |
| 53 | 51 | <fastjson.version>1.2.83</fastjson.version> |
| ... | ... | @@ -225,17 +223,6 @@ |
| 225 | 223 | </dependency> |
| 226 | 224 | |
| 227 | 225 | <!-- Config 配置中心相关 --> |
| 228 | - <dependency> | |
| 229 | - <groupId>cn.iocoder.boot</groupId> | |
| 230 | - <artifactId>yudao-spring-boot-starter-config</artifactId> | |
| 231 | - <version>${revision}</version> | |
| 232 | - </dependency> | |
| 233 | - | |
| 234 | - <dependency> | |
| 235 | - <groupId>com.ctrip.framework.apollo</groupId> | |
| 236 | - <artifactId>apollo-client</artifactId> <!-- 引入 Apollo Client 库,实现内嵌的配置中心 --> | |
| 237 | - <version>${apollo.version}</version> | |
| 238 | - </dependency> | |
| 239 | 226 | |
| 240 | 227 | <!-- Job 定时任务相关 --> |
| 241 | 228 | <dependency> |
| ... | ... | @@ -408,12 +395,6 @@ |
| 408 | 395 | </dependency> |
| 409 | 396 | |
| 410 | 397 | <dependency> |
| 411 | - <groupId>com.github.ulisesbocchio</groupId> | |
| 412 | - <artifactId>jasypt-spring-boot-starter</artifactId> <!-- 加解密 --> | |
| 413 | - <version>${jasypt-spring-boot-starter.version}</version> | |
| 414 | - </dependency> | |
| 415 | - | |
| 416 | - <dependency> | |
| 417 | 398 | <groupId>cn.iocoder.boot</groupId> |
| 418 | 399 | <artifactId>yudao-spring-boot-starter-excel</artifactId> |
| 419 | 400 | <version>${revision}</version> | ... | ... |
yudao-example/yudao-sso-demo-by-code/pom.xml
| ... | ... | @@ -21,7 +21,7 @@ |
| 21 | 21 | <maven.compiler.target>8</maven.compiler.target> |
| 22 | 22 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| 23 | 23 | <!-- 统一依赖管理 --> |
| 24 | - <spring.boot.version>2.6.10</spring.boot.version> | |
| 24 | + <spring.boot.version>2.6.13</spring.boot.version> | |
| 25 | 25 | </properties> |
| 26 | 26 | |
| 27 | 27 | <dependencyManagement> |
| ... | ... | @@ -52,7 +52,7 @@ |
| 52 | 52 | <dependency> |
| 53 | 53 | <groupId>cn.hutool</groupId> |
| 54 | 54 | <artifactId>hutool-all</artifactId> |
| 55 | - <version>5.8.8</version> | |
| 55 | + <version>5.8.9</version> | |
| 56 | 56 | </dependency> |
| 57 | 57 | |
| 58 | 58 | <dependency> | ... | ... |
yudao-example/yudao-sso-demo-by-code/src/main/java/cn/iocoder/yudao/ssodemo/framework/config/SecurityConfiguration.java
| ... | ... | @@ -11,7 +11,7 @@ import org.springframework.security.web.authentication.UsernamePasswordAuthentic |
| 11 | 11 | |
| 12 | 12 | import javax.annotation.Resource; |
| 13 | 13 | |
| 14 | -@Configuration | |
| 14 | +@Configuration(proxyBeanMethods = false) | |
| 15 | 15 | public class SecurityConfiguration extends WebSecurityConfigurerAdapter { |
| 16 | 16 | |
| 17 | 17 | @Resource | ... | ... |
yudao-example/yudao-sso-demo-by-password/pom.xml
| ... | ... | @@ -21,7 +21,7 @@ |
| 21 | 21 | <maven.compiler.target>8</maven.compiler.target> |
| 22 | 22 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| 23 | 23 | <!-- 统一依赖管理 --> |
| 24 | - <spring.boot.version>2.6.10</spring.boot.version> | |
| 24 | + <spring.boot.version>2.6.13</spring.boot.version> | |
| 25 | 25 | </properties> |
| 26 | 26 | |
| 27 | 27 | <dependencyManagement> |
| ... | ... | @@ -52,7 +52,7 @@ |
| 52 | 52 | <dependency> |
| 53 | 53 | <groupId>cn.hutool</groupId> |
| 54 | 54 | <artifactId>hutool-all</artifactId> |
| 55 | - <version>5.8.8</version> | |
| 55 | + <version>5.8.9</version> | |
| 56 | 56 | </dependency> |
| 57 | 57 | |
| 58 | 58 | <dependency> | ... | ... |
yudao-example/yudao-sso-demo-by-password/src/main/java/cn/iocoder/yudao/ssodemo/framework/config/SecurityConfiguration.java
| ... | ... | @@ -11,7 +11,7 @@ import org.springframework.security.web.authentication.UsernamePasswordAuthentic |
| 11 | 11 | |
| 12 | 12 | import javax.annotation.Resource; |
| 13 | 13 | |
| 14 | -@Configuration | |
| 14 | +@Configuration(proxyBeanMethods = false) | |
| 15 | 15 | public class SecurityConfiguration extends WebSecurityConfigurerAdapter { |
| 16 | 16 | |
| 17 | 17 | @Resource | ... | ... |
yudao-framework/pom.xml
| ... | ... | @@ -20,7 +20,6 @@ |
| 20 | 20 | <module>yudao-spring-boot-starter-file</module> |
| 21 | 21 | <module>yudao-spring-boot-starter-monitor</module> |
| 22 | 22 | <module>yudao-spring-boot-starter-protection</module> |
| 23 | - <module>yudao-spring-boot-starter-config</module> | |
| 24 | 23 | <module>yudao-spring-boot-starter-job</module> |
| 25 | 24 | <module>yudao-spring-boot-starter-mq</module> |
| 26 | 25 | ... | ... |
yudao-framework/yudao-common/pom.xml
| ... | ... | @@ -105,6 +105,11 @@ |
| 105 | 105 | <artifactId>jackson-core</artifactId> |
| 106 | 106 | <scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 --> |
| 107 | 107 | </dependency> |
| 108 | + <dependency> | |
| 109 | + <groupId>com.fasterxml.jackson.datatype</groupId> | |
| 110 | + <artifactId>jackson-datatype-jsr310</artifactId> | |
| 111 | + <scope>provided</scope> <!-- 设置为 provided,只有工具类需要使用到 --> | |
| 112 | + </dependency> | |
| 108 | 113 | |
| 109 | 114 | <dependency> |
| 110 | 115 | <groupId>org.slf4j</groupId> | ... | ... |
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/exception/enums/GlobalErrorCodeConstants.java
| ... | ... | @@ -29,6 +29,7 @@ public interface GlobalErrorCodeConstants { |
| 29 | 29 | // ========== 服务端错误段 ========== |
| 30 | 30 | |
| 31 | 31 | ErrorCode INTERNAL_SERVER_ERROR = new ErrorCode(500, "系统异常"); |
| 32 | + ErrorCode NOT_IMPLEMENTED = new ErrorCode(501, "功能未实现/未开启"); | |
| 32 | 33 | |
| 33 | 34 | // ========== 自定义错误段 ========== |
| 34 | 35 | ErrorCode REPEATED_REQUESTS = new ErrorCode(900, "重复请求,请稍后重试"); // 重复请求 | ... | ... |
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/DateUtils.java
| 1 | 1 | package cn.iocoder.yudao.framework.common.util.date; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.date.DateUtil; |
| 4 | +import cn.hutool.core.date.LocalDateTimeUtil; | |
| 4 | 5 | |
| 5 | 6 | import java.time.Duration; |
| 7 | +import java.time.Instant; | |
| 8 | +import java.time.LocalDateTime; | |
| 9 | +import java.time.ZoneId; | |
| 10 | +import java.time.ZonedDateTime; | |
| 6 | 11 | import java.util.Calendar; |
| 7 | 12 | import java.util.Date; |
| 8 | 13 | |
| ... | ... | @@ -25,6 +30,34 @@ public class DateUtils { |
| 25 | 30 | |
| 26 | 31 | public static final String FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND = "yyyy-MM-dd HH:mm:ss"; |
| 27 | 32 | |
| 33 | + /** | |
| 34 | + * 将 LocalDateTime 转换成 Date | |
| 35 | + * | |
| 36 | + * @param date LocalDateTime | |
| 37 | + * @return LocalDateTime | |
| 38 | + */ | |
| 39 | + public static Date of(LocalDateTime date) { | |
| 40 | + // 将此日期时间与时区相结合以创建 ZonedDateTime | |
| 41 | + ZonedDateTime zonedDateTime = date.atZone(ZoneId.systemDefault()); | |
| 42 | + // 本地时间线 LocalDateTime 到即时时间线 Instant 时间戳 | |
| 43 | + Instant instant = zonedDateTime.toInstant(); | |
| 44 | + // UTC时间(世界协调时间,UTC + 00:00)转北京(北京,UTC + 8:00)时间 | |
| 45 | + return Date.from(instant); | |
| 46 | + } | |
| 47 | + | |
| 48 | + /** | |
| 49 | + * 将 Date 转换成 LocalDateTime | |
| 50 | + * | |
| 51 | + * @param date Date | |
| 52 | + * @return LocalDateTime | |
| 53 | + */ | |
| 54 | + public static LocalDateTime of(Date date) { | |
| 55 | + // 转为时间戳 | |
| 56 | + Instant instant = date.toInstant(); | |
| 57 | + // UTC时间(世界协调时间,UTC + 00:00)转北京(北京,UTC + 8:00)时间 | |
| 58 | + return LocalDateTime.ofInstant(instant, ZoneId.systemDefault()); | |
| 59 | + } | |
| 60 | + | |
| 28 | 61 | public static Date addTime(Duration duration) { |
| 29 | 62 | return new Date(System.currentTimeMillis() + duration.toMillis()); |
| 30 | 63 | } |
| ... | ... | @@ -33,6 +66,11 @@ public class DateUtils { |
| 33 | 66 | return System.currentTimeMillis() > time.getTime(); |
| 34 | 67 | } |
| 35 | 68 | |
| 69 | + public static boolean isExpired(LocalDateTime time) { | |
| 70 | + LocalDateTime now = LocalDateTime.now(); | |
| 71 | + return now.isAfter(time); | |
| 72 | + } | |
| 73 | + | |
| 36 | 74 | public static long diff(Date endTime, Date startTime) { |
| 37 | 75 | return endTime.getTime() - startTime.getTime(); |
| 38 | 76 | } |
| ... | ... | @@ -40,24 +78,28 @@ public class DateUtils { |
| 40 | 78 | /** |
| 41 | 79 | * 创建指定时间 |
| 42 | 80 | * |
| 43 | - * @param year 年 | |
| 44 | - * @param mouth 月 | |
| 45 | - * @param day 日 | |
| 81 | + * @param year 年 | |
| 82 | + * @param mouth 月 | |
| 83 | + * @param day 日 | |
| 46 | 84 | * @return 指定时间 |
| 47 | 85 | */ |
| 48 | 86 | public static Date buildTime(int year, int mouth, int day) { |
| 49 | 87 | return buildTime(year, mouth, day, 0, 0, 0); |
| 50 | 88 | } |
| 51 | 89 | |
| 90 | + public static LocalDateTime buildLocalDateTime(int year, int mouth, int day) { | |
| 91 | + return LocalDateTime.of(year, mouth, day, 0, 0, 0); | |
| 92 | + } | |
| 93 | + | |
| 52 | 94 | /** |
| 53 | 95 | * 创建指定时间 |
| 54 | 96 | * |
| 55 | - * @param year 年 | |
| 56 | - * @param mouth 月 | |
| 57 | - * @param day 日 | |
| 58 | - * @param hour 小时 | |
| 59 | - * @param minute 分钟 | |
| 60 | - * @param second 秒 | |
| 97 | + * @param year 年 | |
| 98 | + * @param mouth 月 | |
| 99 | + * @param day 日 | |
| 100 | + * @param hour 小时 | |
| 101 | + * @param minute 分钟 | |
| 102 | + * @param second 秒 | |
| 61 | 103 | * @return 指定时间 |
| 62 | 104 | */ |
| 63 | 105 | public static Date buildTime(int year, int mouth, int day, |
| ... | ... | @@ -83,6 +125,16 @@ public class DateUtils { |
| 83 | 125 | return a.compareTo(b) > 0 ? a : b; |
| 84 | 126 | } |
| 85 | 127 | |
| 128 | + public static LocalDateTime max(LocalDateTime a, LocalDateTime b) { | |
| 129 | + if (a == null) { | |
| 130 | + return b; | |
| 131 | + } | |
| 132 | + if (b == null) { | |
| 133 | + return a; | |
| 134 | + } | |
| 135 | + return a.isAfter(b) ? a : b; | |
| 136 | + } | |
| 137 | + | |
| 86 | 138 | public static boolean beforeNow(Date date) { |
| 87 | 139 | return date.getTime() < System.currentTimeMillis(); |
| 88 | 140 | } |
| ... | ... | @@ -91,6 +143,10 @@ public class DateUtils { |
| 91 | 143 | return date.getTime() >= System.currentTimeMillis(); |
| 92 | 144 | } |
| 93 | 145 | |
| 146 | + public static boolean afterNow(LocalDateTime localDateTime) { | |
| 147 | + return localDateTime.isAfter(LocalDateTime.now()); | |
| 148 | + } | |
| 149 | + | |
| 94 | 150 | /** |
| 95 | 151 | * 计算当期时间相差的日期 |
| 96 | 152 | * |
| ... | ... | @@ -136,6 +192,16 @@ public class DateUtils { |
| 136 | 192 | } |
| 137 | 193 | |
| 138 | 194 | /** |
| 195 | + * 是否今天 | |
| 196 | + * | |
| 197 | + * @param date 日期 | |
| 198 | + * @return 是否 | |
| 199 | + */ | |
| 200 | + public static boolean isToday(LocalDateTime date) { | |
| 201 | + return LocalDateTimeUtil.isSameDay(date, LocalDateTime.now()); | |
| 202 | + } | |
| 203 | + | |
| 204 | + /** | |
| 139 | 205 | * 判断当前时间是否在该时间范围内 |
| 140 | 206 | * |
| 141 | 207 | * @param startTime 开始时间 | ... | ... |
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/json/JsonUtils.java
| ... | ... | @@ -7,6 +7,7 @@ import com.fasterxml.jackson.core.type.TypeReference; |
| 7 | 7 | import com.fasterxml.jackson.databind.JsonNode; |
| 8 | 8 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 9 | 9 | import com.fasterxml.jackson.databind.SerializationFeature; |
| 10 | +import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule; | |
| 10 | 11 | import lombok.SneakyThrows; |
| 11 | 12 | import lombok.experimental.UtilityClass; |
| 12 | 13 | import lombok.extern.slf4j.Slf4j; |
| ... | ... | @@ -28,6 +29,7 @@ public class JsonUtils { |
| 28 | 29 | |
| 29 | 30 | static { |
| 30 | 31 | objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); |
| 32 | + objectMapper.registerModules(new JavaTimeModule()); // 解决 LocalDateTime 的序列化 | |
| 31 | 33 | } |
| 32 | 34 | |
| 33 | 35 | /** | ... | ... |
yudao-framework/yudao-spring-boot-starter-banner/src/main/java/cn/iocoder/yudao/framework/banner/config/YudaoBannerAutoConfiguration.java
yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/config/YudaoDataPermissionAutoConfiguration.java
| ... | ... | @@ -17,7 +17,7 @@ import java.util.List; |
| 17 | 17 | * |
| 18 | 18 | * @author 芋道源码 |
| 19 | 19 | */ |
| 20 | -@Configuration | |
| 20 | +@Configuration(proxyBeanMethods = false) | |
| 21 | 21 | public class YudaoDataPermissionAutoConfiguration { |
| 22 | 22 | |
| 23 | 23 | @Bean |
| ... | ... | @@ -27,9 +27,8 @@ public class YudaoDataPermissionAutoConfiguration { |
| 27 | 27 | |
| 28 | 28 | @Bean |
| 29 | 29 | public DataPermissionDatabaseInterceptor dataPermissionDatabaseInterceptor(MybatisPlusInterceptor interceptor, |
| 30 | - List<DataPermissionRule> rules) { | |
| 30 | + DataPermissionRuleFactory ruleFactory) { | |
| 31 | 31 | // 创建 DataPermissionDatabaseInterceptor 拦截器 |
| 32 | - DataPermissionRuleFactory ruleFactory = dataPermissionRuleFactory(rules); | |
| 33 | 32 | DataPermissionDatabaseInterceptor inner = new DataPermissionDatabaseInterceptor(ruleFactory); |
| 34 | 33 | // 添加到 interceptor 中 |
| 35 | 34 | // 需要加在首个,主要是为了在分页插件前面。这个是 MyBatis Plus 的规定 | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/main/java/cn/iocoder/yudao/framework/datapermission/config/YudaoDeptDataPermissionAutoConfiguration.java
| ... | ... | @@ -16,7 +16,7 @@ import java.util.List; |
| 16 | 16 | * |
| 17 | 17 | * @author 芋道源码 |
| 18 | 18 | */ |
| 19 | -@Configuration | |
| 19 | +@Configuration(proxyBeanMethods = false) | |
| 20 | 20 | @ConditionalOnClass(LoginUser.class) |
| 21 | 21 | @ConditionalOnBean(value = {PermissionApi.class, DeptDataPermissionRuleCustomizer.class}) |
| 22 | 22 | public class YudaoDeptDataPermissionAutoConfiguration { | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/test/java/cn/iocoder/yudao/framework/datapermission/core/db/DataPermissionDatabaseInterceptorTest.java
| ... | ... | @@ -87,7 +87,7 @@ public class DataPermissionDatabaseInterceptorTest extends BaseMockitoUnitTest { |
| 87 | 87 | interceptor.beforeQuery(null, mappedStatement, null, null, null, boundSql); |
| 88 | 88 | // 断言 |
| 89 | 89 | verify(mpBs, times(1)).sql( |
| 90 | - eq("SELECT * FROM t_user WHERE id = 1 AND dept_id = 100")); | |
| 90 | + eq("SELECT * FROM t_user WHERE id = 1 AND t_user.dept_id = 100")); | |
| 91 | 91 | // 断言缓存 |
| 92 | 92 | assertTrue(interceptor.getMappedStatementCache().getNoRewritableMappedStatements().isEmpty()); |
| 93 | 93 | } | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-dict/src/main/java/cn/iocoder/yudao/framework/dict/config/YudaoDictAutoConfiguration.java
| ... | ... | @@ -5,7 +5,7 @@ import cn.iocoder.yudao.module.system.api.dict.DictDataApi; |
| 5 | 5 | import org.springframework.context.annotation.Bean; |
| 6 | 6 | import org.springframework.context.annotation.Configuration; |
| 7 | 7 | |
| 8 | -@Configuration | |
| 8 | +@Configuration(proxyBeanMethods = false) | |
| 9 | 9 | public class YudaoDictAutoConfiguration { |
| 10 | 10 | |
| 11 | 11 | @Bean | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-error-code/src/main/java/cn/iocoder/yudao/framework/errorcode/config/YudaoErrorCodeConfiguration.java
| ... | ... | @@ -17,7 +17,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; |
| 17 | 17 | * |
| 18 | 18 | * @author 芋道源码 |
| 19 | 19 | */ |
| 20 | -@Configuration | |
| 20 | +@Configuration(proxyBeanMethods = false) | |
| 21 | 21 | @ConditionalOnProperty(prefix = "yudao.error-code", value = "enable", matchIfMissing = true) // 允许使用 yudao.error-code.enable=false 禁用访问日志 |
| 22 | 22 | @EnableConfigurationProperties(ErrorCodeProperties.class) |
| 23 | 23 | @EnableScheduling // 开启调度任务的功能,因为 ErrorCodeRemoteLoader 通过定时刷新错误码 | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-error-code/src/main/java/cn/iocoder/yudao/framework/errorcode/core/loader/ErrorCodeLoaderImpl.java
| ... | ... | @@ -10,7 +10,7 @@ import org.springframework.boot.context.event.ApplicationReadyEvent; |
| 10 | 10 | import org.springframework.context.event.EventListener; |
| 11 | 11 | import org.springframework.scheduling.annotation.Scheduled; |
| 12 | 12 | |
| 13 | -import java.util.Date; | |
| 13 | +import java.time.LocalDateTime; | |
| 14 | 14 | import java.util.List; |
| 15 | 15 | |
| 16 | 16 | /** |
| ... | ... | @@ -41,7 +41,7 @@ public class ErrorCodeLoaderImpl implements ErrorCodeLoader { |
| 41 | 41 | /** |
| 42 | 42 | * 缓存错误码的最大更新时间,用于后续的增量轮询,判断是否有更新 |
| 43 | 43 | */ |
| 44 | - private Date maxUpdateTime; | |
| 44 | + private LocalDateTime maxUpdateTime; | |
| 45 | 45 | |
| 46 | 46 | @EventListener(ApplicationReadyEvent.class) |
| 47 | 47 | public void loadErrorCodes() { | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/config/YudaoOperateLogAutoConfiguration.java
| ... | ... | @@ -7,7 +7,7 @@ import cn.iocoder.yudao.module.system.api.logger.OperateLogApi; |
| 7 | 7 | import org.springframework.context.annotation.Bean; |
| 8 | 8 | import org.springframework.context.annotation.Configuration; |
| 9 | 9 | |
| 10 | -@Configuration | |
| 10 | +@Configuration(proxyBeanMethods = false) | |
| 11 | 11 | public class YudaoOperateLogAutoConfiguration { |
| 12 | 12 | |
| 13 | 13 | @Bean | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/aop/OperateLogAspect.java
| 1 | 1 | package cn.iocoder.yudao.framework.operatelog.core.aop; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.date.LocalDateTimeUtil; | |
| 3 | 4 | import cn.hutool.core.exceptions.ExceptionUtil; |
| 4 | 5 | import cn.hutool.core.util.ArrayUtil; |
| 5 | 6 | import cn.hutool.core.util.StrUtil; |
| ... | ... | @@ -32,6 +33,7 @@ import javax.servlet.http.HttpServletRequest; |
| 32 | 33 | import javax.servlet.http.HttpServletResponse; |
| 33 | 34 | import java.lang.annotation.Annotation; |
| 34 | 35 | import java.lang.reflect.Array; |
| 36 | +import java.time.LocalDateTime; | |
| 35 | 37 | import java.util.*; |
| 36 | 38 | import java.util.function.Predicate; |
| 37 | 39 | import java.util.stream.IntStream; |
| ... | ... | @@ -94,7 +96,7 @@ public class OperateLogAspect { |
| 94 | 96 | } |
| 95 | 97 | |
| 96 | 98 | // 记录开始时间 |
| 97 | - Date startTime = new Date(); | |
| 99 | + LocalDateTime startTime = LocalDateTime.now(); | |
| 98 | 100 | try { |
| 99 | 101 | // 执行原有方法 |
| 100 | 102 | Object result = joinPoint.proceed(); |
| ... | ... | @@ -128,7 +130,7 @@ public class OperateLogAspect { |
| 128 | 130 | private void log(ProceedingJoinPoint joinPoint, |
| 129 | 131 | cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog operateLog, |
| 130 | 132 | ApiOperation apiOperation, |
| 131 | - Date startTime, Object result, Throwable exception) { | |
| 133 | + LocalDateTime startTime, Object result, Throwable exception) { | |
| 132 | 134 | try { |
| 133 | 135 | // 判断不记录的情况 |
| 134 | 136 | if (!isLogEnable(joinPoint, operateLog)) { |
| ... | ... | @@ -145,7 +147,7 @@ public class OperateLogAspect { |
| 145 | 147 | private void log0(ProceedingJoinPoint joinPoint, |
| 146 | 148 | cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog operateLog, |
| 147 | 149 | ApiOperation apiOperation, |
| 148 | - Date startTime, Object result, Throwable exception) { | |
| 150 | + LocalDateTime startTime, Object result, Throwable exception) { | |
| 149 | 151 | OperateLog operateLogObj = new OperateLog(); |
| 150 | 152 | // 补全通用字段 |
| 151 | 153 | operateLogObj.setTraceId(TracerUtils.getTraceId()); |
| ... | ... | @@ -226,7 +228,7 @@ public class OperateLogAspect { |
| 226 | 228 | private static void fillMethodFields(OperateLog operateLogObj, |
| 227 | 229 | ProceedingJoinPoint joinPoint, |
| 228 | 230 | cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog operateLog, |
| 229 | - Date startTime, Object result, Throwable exception) { | |
| 231 | + LocalDateTime startTime, Object result, Throwable exception) { | |
| 230 | 232 | MethodSignature methodSignature = (MethodSignature) joinPoint.getSignature(); |
| 231 | 233 | operateLogObj.setJavaMethod(methodSignature.toString()); |
| 232 | 234 | if (operateLog == null || operateLog.logArgs()) { |
| ... | ... | @@ -235,7 +237,7 @@ public class OperateLogAspect { |
| 235 | 237 | if (operateLog == null || operateLog.logResultData()) { |
| 236 | 238 | operateLogObj.setResultData(obtainResultData(result)); |
| 237 | 239 | } |
| 238 | - operateLogObj.setDuration((int) (System.currentTimeMillis() - startTime.getTime())); | |
| 240 | + operateLogObj.setDuration((int) (LocalDateTimeUtil.between(startTime, LocalDateTime.now()).toMillis())); | |
| 239 | 241 | // (正常)处理 resultCode 和 resultMsg 字段 |
| 240 | 242 | if (result instanceof CommonResult) { |
| 241 | 243 | CommonResult<?> commonResult = (CommonResult<?>) result; | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/service/OperateLog.java
| ... | ... | @@ -2,7 +2,7 @@ package cn.iocoder.yudao.framework.operatelog.core.service; |
| 2 | 2 | |
| 3 | 3 | import lombok.Data; |
| 4 | 4 | |
| 5 | -import java.util.Date; | |
| 5 | +import java.time.LocalDateTime; | |
| 6 | 6 | import java.util.Map; |
| 7 | 7 | |
| 8 | 8 | /** |
| ... | ... | @@ -85,7 +85,7 @@ public class OperateLog { |
| 85 | 85 | /** |
| 86 | 86 | * 开始时间 |
| 87 | 87 | */ |
| 88 | - private Date startTime; | |
| 88 | + private LocalDateTime startTime; | |
| 89 | 89 | |
| 90 | 90 | /** |
| 91 | 91 | * 执行时长,单位:毫秒 | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/config/YudaoPayAutoConfiguration.java
| ... | ... | @@ -11,7 +11,7 @@ import org.springframework.context.annotation.Configuration; |
| 11 | 11 | * |
| 12 | 12 | * @author 芋道源码 |
| 13 | 13 | */ |
| 14 | -@Configuration | |
| 14 | +@Configuration(proxyBeanMethods = false) | |
| 15 | 15 | @EnableConfigurationProperties(PayProperties.class) |
| 16 | 16 | public class YudaoPayAutoConfiguration { |
| 17 | 17 | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayOrderNotifyRespDTO.java
| ... | ... | @@ -5,7 +5,7 @@ import lombok.Builder; |
| 5 | 5 | import lombok.Data; |
| 6 | 6 | import lombok.NoArgsConstructor; |
| 7 | 7 | |
| 8 | -import java.util.Date; | |
| 8 | +import java.time.LocalDateTime; | |
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * 支付通知 Response DTO |
| ... | ... | @@ -33,7 +33,7 @@ public class PayOrderNotifyRespDTO { |
| 33 | 33 | /** |
| 34 | 34 | * 支付成功时间 |
| 35 | 35 | */ |
| 36 | - private Date successTime; | |
| 36 | + private LocalDateTime successTime; | |
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * 通知的原始数据 | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayOrderUnifiedReqDTO.java
| ... | ... | @@ -7,7 +7,7 @@ import org.hibernate.validator.constraints.URL; |
| 7 | 7 | import javax.validation.constraints.DecimalMin; |
| 8 | 8 | import javax.validation.constraints.NotEmpty; |
| 9 | 9 | import javax.validation.constraints.NotNull; |
| 10 | -import java.util.Date; | |
| 10 | +import java.time.LocalDateTime; | |
| 11 | 11 | import java.util.Map; |
| 12 | 12 | |
| 13 | 13 | /** |
| ... | ... | @@ -68,7 +68,7 @@ public class PayOrderUnifiedReqDTO { |
| 68 | 68 | * 支付过期时间 |
| 69 | 69 | */ |
| 70 | 70 | @NotNull(message = "支付过期时间不能为空") |
| 71 | - private Date expireTime; | |
| 71 | + private LocalDateTime expireTime; | |
| 72 | 72 | |
| 73 | 73 | // ========== 拓展参数 ========== |
| 74 | 74 | /** | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/PayRefundNotifyDTO.java
| ... | ... | @@ -5,7 +5,7 @@ import lombok.Builder; |
| 5 | 5 | import lombok.Data; |
| 6 | 6 | import lombok.ToString; |
| 7 | 7 | |
| 8 | -import java.util.Date; | |
| 8 | +import java.time.LocalDateTime; | |
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * 从渠道返回数据中解析得到的支付退款通知的Notify DTO |
| ... | ... | @@ -57,7 +57,7 @@ public class PayRefundNotifyDTO { |
| 57 | 57 | /** |
| 58 | 58 | * 退款成功时间 |
| 59 | 59 | */ |
| 60 | - private Date refundSuccessTime; | |
| 60 | + private LocalDateTime refundSuccessTime; | |
| 61 | 61 | |
| 62 | 62 | |
| 63 | 63 | } | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AbstractAlipayClient.java
| 1 | 1 | package cn.iocoder.yudao.framework.pay.core.client.impl.alipay; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.bean.BeanUtil; |
| 4 | -import cn.hutool.core.date.DateUtil; | |
| 5 | -import cn.hutool.http.HttpUtil; | |
| 4 | +import cn.hutool.core.date.LocalDateTimeUtil; | |
| 6 | 5 | import cn.iocoder.yudao.framework.pay.core.client.AbstractPayCodeMapping; |
| 7 | 6 | import cn.iocoder.yudao.framework.pay.core.client.PayCommonResult; |
| 8 | 7 | import cn.iocoder.yudao.framework.pay.core.client.dto.*; |
| ... | ... | @@ -61,7 +60,7 @@ public abstract class AbstractAlipayClient extends AbstractPayClient<AlipayPayCl |
| 61 | 60 | return PayOrderNotifyRespDTO.builder().orderExtensionNo(params.get("out_trade_no")) |
| 62 | 61 | .channelOrderNo(params.get("trade_no")).channelUserId(params.get("seller_id")) |
| 63 | 62 | .tradeStatus(params.get("trade_status")) |
| 64 | - .successTime(DateUtil.parse(params.get("notify_time"), "yyyy-MM-dd HH:mm:ss")) | |
| 63 | + .successTime(LocalDateTimeUtil.parse(params.get("notify_time"), "yyyy-MM-dd HH:mm:ss")) | |
| 65 | 64 | .data(data.getBody()).build(); |
| 66 | 65 | } |
| 67 | 66 | |
| ... | ... | @@ -72,7 +71,7 @@ public abstract class AbstractAlipayClient extends AbstractPayClient<AlipayPayCl |
| 72 | 71 | .tradeNo(params.get("out_trade_no")) |
| 73 | 72 | .reqNo(params.get("out_biz_no")) |
| 74 | 73 | .status(PayNotifyRefundStatusEnum.SUCCESS) |
| 75 | - .refundSuccessTime(DateUtil.parse(params.get("gmt_refund"), "yyyy-MM-dd HH:mm:ss")) | |
| 74 | + .refundSuccessTime(LocalDateTimeUtil.parse(params.get("gmt_refund"), "yyyy-MM-dd HH:mm:ss")) | |
| 76 | 75 | .build(); |
| 77 | 76 | return notifyDTO; |
| 78 | 77 | } | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXLitePayClient.java
| ... | ... | @@ -2,6 +2,7 @@ package cn.iocoder.yudao.framework.pay.core.client.impl.wx; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.bean.BeanUtil; |
| 4 | 4 | import cn.hutool.core.date.DateUtil; |
| 5 | +import cn.hutool.core.date.LocalDateTimeUtil; | |
| 5 | 6 | import cn.hutool.core.lang.Assert; |
| 6 | 7 | import cn.hutool.core.map.MapUtil; |
| 7 | 8 | import cn.hutool.core.util.StrUtil; |
| ... | ... | @@ -49,7 +50,7 @@ public class WXLitePayClient extends AbstractPayClient<WXPayClientConfig> { |
| 49 | 50 | @Override |
| 50 | 51 | protected void doInit() { |
| 51 | 52 | WxPayConfig payConfig = new WxPayConfig(); |
| 52 | - BeanUtil.copyProperties(config, payConfig, "keyContent"); | |
| 53 | + BeanUtil.copyProperties(config, payConfig, "privateKeyContent","privateCertContent"); | |
| 53 | 54 | payConfig.setTradeType(WxPayConstants.TradeType.JSAPI); // 设置使用 JS API 支付方式 |
| 54 | 55 | // if (StrUtil.isNotEmpty(config.getKeyContent())) { |
| 55 | 56 | // payConfig.setKeyContent(config.getKeyContent().getBytes(StandardCharsets.UTF_8)); |
| ... | ... | @@ -167,7 +168,7 @@ public class WXLitePayClient extends AbstractPayClient<WXPayClientConfig> { |
| 167 | 168 | .builder() |
| 168 | 169 | .orderExtensionNo(result.getOutTradeNo()) |
| 169 | 170 | .channelOrderNo(result.getTradeState()) |
| 170 | - .successTime(DateUtil.parse(result.getSuccessTime(), "yyyy-MM-dd'T'HH:mm:ssXXX")) | |
| 171 | + .successTime(LocalDateTimeUtil.parse(result.getSuccessTime(), "yyyy-MM-dd'T'HH:mm:ssXXX")) | |
| 171 | 172 | .data(data.getBody()) |
| 172 | 173 | .build(); |
| 173 | 174 | } |
| ... | ... | @@ -181,7 +182,7 @@ public class WXLitePayClient extends AbstractPayClient<WXPayClientConfig> { |
| 181 | 182 | .orderExtensionNo(notifyResult.getOutTradeNo()) |
| 182 | 183 | .channelOrderNo(notifyResult.getTransactionId()) |
| 183 | 184 | .channelUserId(notifyResult.getOpenid()) |
| 184 | - .successTime(DateUtil.parse(notifyResult.getTimeEnd(), "yyyyMMddHHmmss")) | |
| 185 | + .successTime(LocalDateTimeUtil.parse(notifyResult.getTimeEnd(), "yyyyMMddHHmmss")) | |
| 185 | 186 | .data(data.getBody()) |
| 186 | 187 | .build(); |
| 187 | 188 | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXNativePayClient.java
| ... | ... | @@ -2,6 +2,7 @@ package cn.iocoder.yudao.framework.pay.core.client.impl.wx; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.bean.BeanUtil; |
| 4 | 4 | import cn.hutool.core.date.DateUtil; |
| 5 | +import cn.hutool.core.date.LocalDateTimeUtil; | |
| 5 | 6 | import cn.hutool.core.lang.Assert; |
| 6 | 7 | import cn.hutool.core.util.StrUtil; |
| 7 | 8 | import cn.iocoder.yudao.framework.common.util.io.FileUtils; |
| ... | ... | @@ -150,7 +151,7 @@ public class WXNativePayClient extends AbstractPayClient<WXPayClientConfig> { |
| 150 | 151 | .builder() |
| 151 | 152 | .orderExtensionNo(result.getOutTradeNo()) |
| 152 | 153 | .channelOrderNo(result.getTradeState()) |
| 153 | - .successTime(DateUtil.parse(result.getSuccessTime(), "yyyy-MM-dd'T'HH:mm:ssXXX")) | |
| 154 | + .successTime(LocalDateTimeUtil.parse(result.getSuccessTime(), "yyyy-MM-dd'T'HH:mm:ssXXX")) | |
| 154 | 155 | .data(data.getBody()) |
| 155 | 156 | .build(); |
| 156 | 157 | } |
| ... | ... | @@ -164,7 +165,7 @@ public class WXNativePayClient extends AbstractPayClient<WXPayClientConfig> { |
| 164 | 165 | .orderExtensionNo(notifyResult.getOutTradeNo()) |
| 165 | 166 | .channelOrderNo(notifyResult.getTransactionId()) |
| 166 | 167 | .channelUserId(notifyResult.getOpenid()) |
| 167 | - .successTime(DateUtil.parse(notifyResult.getTimeEnd(), "yyyyMMddHHmmss")) | |
| 168 | + .successTime(LocalDateTimeUtil.parse(notifyResult.getTimeEnd(), "yyyyMMddHHmmss")) | |
| 168 | 169 | .data(data.getBody()) |
| 169 | 170 | .build(); |
| 170 | 171 | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/wx/WXPubPayClient.java
| ... | ... | @@ -2,6 +2,7 @@ package cn.iocoder.yudao.framework.pay.core.client.impl.wx; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.bean.BeanUtil; |
| 4 | 4 | import cn.hutool.core.date.DateUtil; |
| 5 | +import cn.hutool.core.date.LocalDateTimeUtil; | |
| 5 | 6 | import cn.hutool.core.lang.Assert; |
| 6 | 7 | import cn.hutool.core.map.MapUtil; |
| 7 | 8 | import cn.hutool.core.util.StrUtil; |
| ... | ... | @@ -161,7 +162,7 @@ public class WXPubPayClient extends AbstractPayClient<WXPayClientConfig> { |
| 161 | 162 | .builder() |
| 162 | 163 | .orderExtensionNo(result.getOutTradeNo()) |
| 163 | 164 | .channelOrderNo(result.getTradeState()) |
| 164 | - .successTime(DateUtil.parse(result.getSuccessTime(), "yyyy-MM-dd'T'HH:mm:ssXXX")) | |
| 165 | + .successTime(LocalDateTimeUtil.parse(result.getSuccessTime(), "yyyy-MM-dd'T'HH:mm:ssXXX")) | |
| 165 | 166 | .data(data.getBody()) |
| 166 | 167 | .build(); |
| 167 | 168 | } |
| ... | ... | @@ -175,7 +176,7 @@ public class WXPubPayClient extends AbstractPayClient<WXPayClientConfig> { |
| 175 | 176 | .orderExtensionNo(notifyResult.getOutTradeNo()) |
| 176 | 177 | .channelOrderNo(notifyResult.getTransactionId()) |
| 177 | 178 | .channelUserId(notifyResult.getOpenid()) |
| 178 | - .successTime(DateUtil.parse(notifyResult.getTimeEnd(), "yyyyMMddHHmmss")) | |
| 179 | + .successTime(LocalDateTimeUtil.parse(notifyResult.getTimeEnd(), "yyyyMMddHHmmss")) | |
| 179 | 180 | .data(data.getBody()) |
| 180 | 181 | .build(); |
| 181 | 182 | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/config/YudaoSmsAutoConfiguration.java
yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/dto/SmsReceiveRespDTO.java
| ... | ... | @@ -2,7 +2,7 @@ package cn.iocoder.yudao.framework.sms.core.client.dto; |
| 2 | 2 | |
| 3 | 3 | import lombok.Data; |
| 4 | 4 | |
| 5 | -import java.util.Date; | |
| 5 | +import java.time.LocalDateTime; | |
| 6 | 6 | |
| 7 | 7 | /** |
| 8 | 8 | * 消息接收 Response DTO |
| ... | ... | @@ -32,7 +32,7 @@ public class SmsReceiveRespDTO { |
| 32 | 32 | /** |
| 33 | 33 | * 用户接收时间 |
| 34 | 34 | */ |
| 35 | - private Date receiveTime; | |
| 35 | + private LocalDateTime receiveTime; | |
| 36 | 36 | |
| 37 | 37 | /** |
| 38 | 38 | * 短信 API 发送返回的序号 | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/aliyun/AliyunSmsClient.java
| ... | ... | @@ -28,7 +28,7 @@ import com.google.common.annotations.VisibleForTesting; |
| 28 | 28 | import lombok.Data; |
| 29 | 29 | import lombok.extern.slf4j.Slf4j; |
| 30 | 30 | |
| 31 | -import java.util.Date; | |
| 31 | +import java.time.LocalDateTime; | |
| 32 | 32 | import java.util.List; |
| 33 | 33 | import java.util.Objects; |
| 34 | 34 | import java.util.function.Function; |
| ... | ... | @@ -166,13 +166,13 @@ public class AliyunSmsClient extends AbstractSmsClient { |
| 166 | 166 | */ |
| 167 | 167 | @JsonProperty("send_time") |
| 168 | 168 | @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) |
| 169 | - private Date sendTime; | |
| 169 | + private LocalDateTime sendTime; | |
| 170 | 170 | /** |
| 171 | 171 | * 状态报告时间 |
| 172 | 172 | */ |
| 173 | 173 | @JsonProperty("report_time") |
| 174 | 174 | @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) |
| 175 | - private Date reportTime; | |
| 175 | + private LocalDateTime reportTime; | |
| 176 | 176 | /** |
| 177 | 177 | * 是否接收成功 |
| 178 | 178 | */ | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/tencent/TencentSmsClient.java
| ... | ... | @@ -22,7 +22,7 @@ import com.tencentcloudapi.sms.v20210111.SmsClient; |
| 22 | 22 | import com.tencentcloudapi.sms.v20210111.models.*; |
| 23 | 23 | import lombok.Data; |
| 24 | 24 | |
| 25 | -import java.util.Date; | |
| 25 | +import java.time.LocalDateTime; | |
| 26 | 26 | import java.util.List; |
| 27 | 27 | import java.util.function.Function; |
| 28 | 28 | import java.util.function.Supplier; |
| ... | ... | @@ -240,7 +240,7 @@ public class TencentSmsClient extends AbstractSmsClient { |
| 240 | 240 | */ |
| 241 | 241 | @JsonProperty("user_receive_time") |
| 242 | 242 | @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) |
| 243 | - private Date receiveTime; | |
| 243 | + private LocalDateTime receiveTime; | |
| 244 | 244 | |
| 245 | 245 | /** |
| 246 | 246 | * 国家(或地区)码 | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/client/impl/yunpian/YunpianSmsClient.java
| ... | ... | @@ -2,9 +2,11 @@ package cn.iocoder.yudao.framework.sms.core.client.impl.yunpian; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.hutool.core.lang.Assert; |
| 5 | +import cn.hutool.core.util.NumberUtil; | |
| 5 | 6 | import cn.hutool.core.util.StrUtil; |
| 6 | 7 | import cn.hutool.core.util.URLUtil; |
| 7 | 8 | import cn.iocoder.yudao.framework.common.core.KeyValue; |
| 9 | +import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | |
| 8 | 10 | import cn.iocoder.yudao.framework.sms.core.client.SmsCommonResult; |
| 9 | 11 | import cn.iocoder.yudao.framework.sms.core.client.dto.SmsReceiveRespDTO; |
| 10 | 12 | import cn.iocoder.yudao.framework.sms.core.client.dto.SmsSendRespDTO; |
| ... | ... | @@ -12,7 +14,6 @@ import cn.iocoder.yudao.framework.sms.core.client.dto.SmsTemplateRespDTO; |
| 12 | 14 | import cn.iocoder.yudao.framework.sms.core.client.impl.AbstractSmsClient; |
| 13 | 15 | import cn.iocoder.yudao.framework.sms.core.enums.SmsTemplateAuditStatusEnum; |
| 14 | 16 | import cn.iocoder.yudao.framework.sms.core.property.SmsChannelProperties; |
| 15 | -import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | |
| 16 | 17 | import com.fasterxml.jackson.annotation.JsonFormat; |
| 17 | 18 | import com.fasterxml.jackson.annotation.JsonProperty; |
| 18 | 19 | import com.google.common.annotations.VisibleForTesting; |
| ... | ... | @@ -23,6 +24,7 @@ import com.yunpian.sdk.model.Template; |
| 23 | 24 | import lombok.Data; |
| 24 | 25 | import lombok.extern.slf4j.Slf4j; |
| 25 | 26 | |
| 27 | +import java.time.LocalDateTime; | |
| 26 | 28 | import java.util.*; |
| 27 | 29 | import java.util.function.Function; |
| 28 | 30 | import java.util.function.Supplier; |
| ... | ... | @@ -104,6 +106,9 @@ public class YunpianSmsClient extends AbstractSmsClient { |
| 104 | 106 | @Override |
| 105 | 107 | protected SmsCommonResult<SmsTemplateRespDTO> doGetSmsTemplate(String apiTemplateId) throws Throwable { |
| 106 | 108 | return invoke(() -> { |
| 109 | + if (!NumberUtil.isNumber(apiTemplateId)) { | |
| 110 | + throw new IllegalArgumentException("云片的 API 模板编号必须为整数"); | |
| 111 | + } | |
| 107 | 112 | Map<String, String> request = new HashMap<>(); |
| 108 | 113 | request.put(YunpianConstant.APIKEY, properties.getApiKey()); |
| 109 | 114 | request.put(YunpianConstant.TPL_ID, apiTemplateId); |
| ... | ... | @@ -198,7 +203,7 @@ public class YunpianSmsClient extends AbstractSmsClient { |
| 198 | 203 | */ |
| 199 | 204 | @JsonProperty("user_receive_time") |
| 200 | 205 | @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND, timezone = TIME_ZONE_DEFAULT) |
| 201 | - private Date userReceiveTime; | |
| 206 | + private LocalDateTime userReceiveTime; | |
| 202 | 207 | |
| 203 | 208 | } |
| 204 | 209 | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-sms/src/test/java/cn/iocoder/yudao/framework/sms/core/client/impl/aliyun/AliyunSmsClientTest.java
| ... | ... | @@ -11,7 +11,6 @@ import cn.iocoder.yudao.framework.sms.core.client.dto.SmsTemplateRespDTO; |
| 11 | 11 | import cn.iocoder.yudao.framework.sms.core.enums.SmsTemplateAuditStatusEnum; |
| 12 | 12 | import cn.iocoder.yudao.framework.sms.core.property.SmsChannelProperties; |
| 13 | 13 | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| 14 | -import cn.iocoder.yudao.framework.common.util.date.DateUtils; | |
| 15 | 14 | import cn.iocoder.yudao.framework.sms.core.enums.SmsFrameworkErrorCodeConstants; |
| 16 | 15 | import com.aliyuncs.AcsRequest; |
| 17 | 16 | import com.aliyuncs.IAcsClient; |
| ... | ... | @@ -27,6 +26,7 @@ import org.mockito.ArgumentMatcher; |
| 27 | 26 | import org.mockito.InjectMocks; |
| 28 | 27 | import org.mockito.Mock; |
| 29 | 28 | |
| 29 | +import java.time.LocalDateTime; | |
| 30 | 30 | import java.util.List; |
| 31 | 31 | import java.util.function.Function; |
| 32 | 32 | |
| ... | ... | @@ -125,7 +125,7 @@ public class AliyunSmsClientTest extends BaseMockitoUnitTest { |
| 125 | 125 | assertEquals("DELIVERED", statuses.get(0).getErrorCode()); |
| 126 | 126 | assertEquals("用户接收成功", statuses.get(0).getErrorMsg()); |
| 127 | 127 | assertEquals("13900000001", statuses.get(0).getMobile()); |
| 128 | - assertEquals(DateUtils.buildTime(2017, 2, 2, 22, 23, 24), statuses.get(0).getReceiveTime()); | |
| 128 | + assertEquals(LocalDateTime.of(2017, 2, 2, 22, 23, 24), statuses.get(0).getReceiveTime()); | |
| 129 | 129 | assertEquals("12345", statuses.get(0).getSerialNo()); |
| 130 | 130 | assertEquals(67890L, statuses.get(0).getLogId()); |
| 131 | 131 | } |
| ... | ... | @@ -181,7 +181,7 @@ public class AliyunSmsClientTest extends BaseMockitoUnitTest { |
| 181 | 181 | when(client.getAcsResponse(any(AcsRequest.class))).thenThrow(ex); |
| 182 | 182 | |
| 183 | 183 | // 调用,并断言异常 |
| 184 | - SmsCommonResult<?> result = smsClient.invoke(request,null); | |
| 184 | + SmsCommonResult<?> result = smsClient.invoke(request, null); | |
| 185 | 185 | // 断言 |
| 186 | 186 | assertEquals(ex.getErrCode(), result.getApiCode()); |
| 187 | 187 | assertEquals(ex.getErrMsg(), result.getApiMsg()); | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-sms/src/test/java/cn/iocoder/yudao/framework/sms/core/client/impl/tencent/TencentSmsClientTest.java
| ... | ... | @@ -6,7 +6,6 @@ import cn.iocoder.yudao.framework.common.core.KeyValue; |
| 6 | 6 | import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants; |
| 7 | 7 | import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; |
| 8 | 8 | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| 9 | -import cn.iocoder.yudao.framework.common.util.date.DateUtils; | |
| 10 | 9 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| 11 | 10 | import cn.iocoder.yudao.framework.sms.core.client.SmsCommonResult; |
| 12 | 11 | import cn.iocoder.yudao.framework.sms.core.client.dto.SmsReceiveRespDTO; |
| ... | ... | @@ -25,6 +24,7 @@ import org.junit.jupiter.api.Test; |
| 25 | 24 | import org.mockito.InjectMocks; |
| 26 | 25 | import org.mockito.Mock; |
| 27 | 26 | |
| 27 | +import java.time.LocalDateTime; | |
| 28 | 28 | import java.util.ArrayList; |
| 29 | 29 | import java.util.List; |
| 30 | 30 | |
| ... | ... | @@ -146,7 +146,7 @@ public class TencentSmsClientTest extends BaseMockitoUnitTest { |
| 146 | 146 | assertEquals("DELIVRD", statuses.get(0).getErrorCode()); |
| 147 | 147 | assertEquals("用户短信送达成功", statuses.get(0).getErrorMsg()); |
| 148 | 148 | assertEquals("13900000001", statuses.get(0).getMobile()); |
| 149 | - assertEquals(DateUtils.buildTime(2015, 10, 17, 8, 3, 4), statuses.get(0).getReceiveTime()); | |
| 149 | + assertEquals(LocalDateTime.of(2015, 10, 17, 8, 3, 4), statuses.get(0).getReceiveTime()); | |
| 150 | 150 | assertEquals("12345", statuses.get(0).getSerialNo()); |
| 151 | 151 | assertEquals(67890L, statuses.get(0).getLogId()); |
| 152 | 152 | } | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-sms/src/test/java/cn/iocoder/yudao/framework/sms/core/client/impl/yunpian/YunpianSmsClientTest.java
| ... | ... | @@ -10,7 +10,6 @@ import cn.iocoder.yudao.framework.sms.core.client.dto.SmsSendRespDTO; |
| 10 | 10 | import cn.iocoder.yudao.framework.sms.core.client.dto.SmsTemplateRespDTO; |
| 11 | 11 | import cn.iocoder.yudao.framework.sms.core.enums.SmsTemplateAuditStatusEnum; |
| 12 | 12 | import cn.iocoder.yudao.framework.sms.core.property.SmsChannelProperties; |
| 13 | -import cn.iocoder.yudao.framework.common.util.date.DateUtils; | |
| 14 | 13 | import com.google.common.collect.Lists; |
| 15 | 14 | import com.yunpian.sdk.YunpianClient; |
| 16 | 15 | import com.yunpian.sdk.api.SmsApi; |
| ... | ... | @@ -23,6 +22,7 @@ import org.junit.jupiter.api.Test; |
| 23 | 22 | import org.mockito.InjectMocks; |
| 24 | 23 | import org.mockito.Mock; |
| 25 | 24 | |
| 25 | +import java.time.LocalDateTime; | |
| 26 | 26 | import java.util.HashMap; |
| 27 | 27 | import java.util.List; |
| 28 | 28 | import java.util.Map; |
| ... | ... | @@ -115,7 +115,7 @@ public class YunpianSmsClientTest extends BaseMockitoUnitTest { |
| 115 | 115 | assertEquals("", statuses.get(0).getErrorCode()); |
| 116 | 116 | assertNull(statuses.get(0).getErrorMsg()); |
| 117 | 117 | assertEquals("15205201314", statuses.get(0).getMobile()); |
| 118 | - assertEquals(DateUtils.buildTime(2014, 3, 17, 22, 55, 21), statuses.get(0).getReceiveTime()); | |
| 118 | + assertEquals(LocalDateTime.of(2014, 3, 17, 22, 55, 21), statuses.get(0).getReceiveTime()); | |
| 119 | 119 | assertEquals("9527", statuses.get(0).getSerialNo()); |
| 120 | 120 | assertEquals(1024L, statuses.get(0).getLogId()); |
| 121 | 121 | } | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-social/src/main/java/cn/iocoder/yudao/framework/social/config/YudaoSocialAutoConfiguration.java
| ... | ... | @@ -19,7 +19,7 @@ import org.springframework.context.annotation.Primary; |
| 19 | 19 | * @date 2021-10-30 |
| 20 | 20 | */ |
| 21 | 21 | @Slf4j |
| 22 | -@Configuration | |
| 22 | +@Configuration(proxyBeanMethods = false) | |
| 23 | 23 | @EnableConfigurationProperties(JustAuthProperties.class) |
| 24 | 24 | public class YudaoSocialAutoConfiguration { |
| 25 | 25 | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/config/YudaoTenantAutoConfiguration.java
| ... | ... | @@ -35,7 +35,7 @@ import org.springframework.data.redis.core.RedisTemplate; |
| 35 | 35 | |
| 36 | 36 | import java.util.Objects; |
| 37 | 37 | |
| 38 | -@Configuration | |
| 38 | +@Configuration(proxyBeanMethods = false) | |
| 39 | 39 | @ConditionalOnProperty(prefix = "yudao.tenant", value = "enable", matchIfMissing = true) // 允许使用 yudao.tenant.enable=false 禁用多租户 |
| 40 | 40 | @EnableConfigurationProperties(TenantProperties.class) |
| 41 | 41 | public class YudaoTenantAutoConfiguration { | ... | ... |
yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/config/YudaoCaptchaConfiguration.java
| ... | ... | @@ -8,7 +8,7 @@ import org.springframework.context.annotation.Bean; |
| 8 | 8 | import org.springframework.context.annotation.Configuration; |
| 9 | 9 | import org.springframework.data.redis.core.StringRedisTemplate; |
| 10 | 10 | |
| 11 | -@Configuration | |
| 11 | +@Configuration(proxyBeanMethods = false) | |
| 12 | 12 | public class YudaoCaptchaConfiguration { |
| 13 | 13 | |
| 14 | 14 | static { | ... | ... |
yudao-framework/yudao-spring-boot-starter-config/pom.xml deleted
| 1 | -<?xml version="1.0" encoding="UTF-8"?> | |
| 2 | -<project xmlns="http://maven.apache.org/POM/4.0.0" | |
| 3 | - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
| 4 | - xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
| 5 | - <parent> | |
| 6 | - <groupId>cn.iocoder.boot</groupId> | |
| 7 | - <artifactId>yudao-framework</artifactId> | |
| 8 | - <version>${revision}</version> | |
| 9 | - </parent> | |
| 10 | - <modelVersion>4.0.0</modelVersion> | |
| 11 | - <artifactId>yudao-spring-boot-starter-config</artifactId> | |
| 12 | - <packaging>jar</packaging> | |
| 13 | - | |
| 14 | - <name>${project.artifactId}</name> | |
| 15 | - <description>配置中心,基于 Apollo 魔改实现</description> | |
| 16 | - <url>https://github.com/YunaiV/ruoyi-vue-pro</url> | |
| 17 | - | |
| 18 | - <dependencies> | |
| 19 | - <dependency> | |
| 20 | - <groupId>cn.iocoder.boot</groupId> | |
| 21 | - <artifactId>yudao-common</artifactId> | |
| 22 | - </dependency> | |
| 23 | - | |
| 24 | - <!-- Spring 核心 --> | |
| 25 | - <dependency> | |
| 26 | - <groupId>org.springframework.boot</groupId> | |
| 27 | - <artifactId>spring-boot-starter</artifactId> | |
| 28 | - </dependency> | |
| 29 | - | |
| 30 | - <!-- Config 配置中心相关 --> | |
| 31 | - <dependency> | |
| 32 | - <groupId>com.ctrip.framework.apollo</groupId> | |
| 33 | - <artifactId>apollo-client</artifactId> <!-- 引入 Apollo Client 库,实现内嵌的配置中心 --> | |
| 34 | - </dependency> | |
| 35 | - </dependencies> | |
| 36 | - | |
| 37 | -</project> |
yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/core/ConfigConsts.java deleted
| 1 | -package cn.iocoder.yudao.framework.apollo.core; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.apollo.internals.ConfigFrameworkDAO; | |
| 4 | - | |
| 5 | -/** | |
| 6 | - * 针对 {@link com.ctrip.framework.apollo.core.ConfigConsts} 的补充,主要增加: | |
| 7 | - * | |
| 8 | - * 1. apollo.jdbc.* 配置项的枚举 | |
| 9 | - * | |
| 10 | - * @author 芋道源码 | |
| 11 | - */ | |
| 12 | -public class ConfigConsts { | |
| 13 | - | |
| 14 | - /** | |
| 15 | - * {@link ConfigFrameworkDAO} 的实现类 | |
| 16 | - */ | |
| 17 | - public static final String APOLLO_JDBC_DAO = "apollo.jdbc.dao"; | |
| 18 | - public static final String APOLLO_JDBC_URL = "apollo.jdbc.url"; | |
| 19 | - public static final String APOLLO_JDBC_USERNAME = "apollo.jdbc.username"; | |
| 20 | - public static final String APOLLO_JDBC_PASSWORD = "apollo.jdbc.password"; | |
| 21 | - | |
| 22 | -} |
yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/internals/ConfigFrameworkDAO.java deleted
| 1 | -package cn.iocoder.yudao.framework.apollo.internals; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.apollo.internals.dto.ConfigRespDTO; | |
| 4 | - | |
| 5 | -import java.util.Date; | |
| 6 | -import java.util.List; | |
| 7 | - | |
| 8 | -/** | |
| 9 | - * 配置 Framework DAO 接口 | |
| 10 | - * | |
| 11 | - * 注意,实现类必须提供 (String jdbcUrl, String username, String password) 构造方法 | |
| 12 | - * | |
| 13 | - * @author 芋道源码 | |
| 14 | - */ | |
| 15 | -public interface ConfigFrameworkDAO { | |
| 16 | - | |
| 17 | - /** | |
| 18 | - * 查询是否存在比 maxUpdateTime 的更新记录数量 | |
| 19 | - * | |
| 20 | - * @param maxUpdateTime 最大更新时间 | |
| 21 | - * @return 是否存在 | |
| 22 | - */ | |
| 23 | - int selectCountByUpdateTimeGt(Date maxUpdateTime); | |
| 24 | - | |
| 25 | - /** | |
| 26 | - * 查询配置列表 | |
| 27 | - * | |
| 28 | - * @return 配置列表 | |
| 29 | - */ | |
| 30 | - List<ConfigRespDTO> selectList(); | |
| 31 | - | |
| 32 | -} |
yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/internals/DBConfigRepository.java deleted
| 1 | -package cn.iocoder.yudao.framework.apollo.internals; | |
| 2 | - | |
| 3 | -import cn.hutool.core.collection.CollUtil; | |
| 4 | -import cn.hutool.core.util.ClassUtil; | |
| 5 | -import cn.hutool.core.util.ReflectUtil; | |
| 6 | -import cn.iocoder.yudao.framework.apollo.core.ConfigConsts; | |
| 7 | -import cn.iocoder.yudao.framework.apollo.internals.dto.ConfigRespDTO; | |
| 8 | -import com.ctrip.framework.apollo.Apollo; | |
| 9 | -import com.ctrip.framework.apollo.build.ApolloInjector; | |
| 10 | -import com.ctrip.framework.apollo.core.utils.ApolloThreadFactory; | |
| 11 | -import com.ctrip.framework.apollo.enums.ConfigSourceType; | |
| 12 | -import com.ctrip.framework.apollo.internals.AbstractConfigRepository; | |
| 13 | -import com.ctrip.framework.apollo.internals.ConfigRepository; | |
| 14 | -import com.ctrip.framework.apollo.tracer.Tracer; | |
| 15 | -import com.ctrip.framework.apollo.util.ConfigUtil; | |
| 16 | -import com.ctrip.framework.apollo.util.factory.PropertiesFactory; | |
| 17 | -import lombok.SneakyThrows; | |
| 18 | -import lombok.extern.slf4j.Slf4j; | |
| 19 | - | |
| 20 | -import java.lang.reflect.Constructor; | |
| 21 | -import java.util.Comparator; | |
| 22 | -import java.util.Date; | |
| 23 | -import java.util.List; | |
| 24 | -import java.util.Properties; | |
| 25 | -import java.util.concurrent.Executors; | |
| 26 | -import java.util.concurrent.ScheduledExecutorService; | |
| 27 | - | |
| 28 | -@Slf4j | |
| 29 | -public class DBConfigRepository extends AbstractConfigRepository { | |
| 30 | - | |
| 31 | - private final static ScheduledExecutorService m_executorService; | |
| 32 | - | |
| 33 | - private static DBConfigRepository INSTANCE; | |
| 34 | - | |
| 35 | - static { | |
| 36 | - m_executorService = Executors.newScheduledThreadPool(1, | |
| 37 | - ApolloThreadFactory.create(DBConfigRepository.class.getSimpleName(), true)); | |
| 38 | - } | |
| 39 | - | |
| 40 | - private final ConfigUtil m_configUtil; | |
| 41 | - private final PropertiesFactory propertiesFactory; | |
| 42 | - private final String m_namespace; | |
| 43 | - | |
| 44 | - /** | |
| 45 | - * 配置缓存,使用 Properties 存储 | |
| 46 | - */ | |
| 47 | - private volatile Properties m_configCache; | |
| 48 | - /** | |
| 49 | - * 缓存配置的最大更新时间,用于后续的增量轮询,判断是否有更新 | |
| 50 | - */ | |
| 51 | - private volatile Date maxUpdateTime; | |
| 52 | - | |
| 53 | - /** | |
| 54 | - * 配置读取 DAO | |
| 55 | - */ | |
| 56 | - private final ConfigFrameworkDAO configFrameworkDAO; | |
| 57 | - | |
| 58 | - public DBConfigRepository(String namespace) { | |
| 59 | - // 初始化变量 | |
| 60 | - this.m_namespace = namespace; | |
| 61 | - this.propertiesFactory = ApolloInjector.getInstance(PropertiesFactory.class); | |
| 62 | - this.m_configUtil = ApolloInjector.getInstance(ConfigUtil.class); | |
| 63 | - // 初始化 DB | |
| 64 | - this.configFrameworkDAO = createConfigFrameworkDAO(); | |
| 65 | - | |
| 66 | - // 初始化加载 | |
| 67 | - this.trySync(); | |
| 68 | - // 初始化定时任务 | |
| 69 | - this.schedulePeriodicRefresh(); | |
| 70 | - | |
| 71 | - // 设置单例 | |
| 72 | - INSTANCE = this; | |
| 73 | - } | |
| 74 | - | |
| 75 | - @SneakyThrows | |
| 76 | - private static ConfigFrameworkDAO createConfigFrameworkDAO() { | |
| 77 | - String dao = System.getProperty(ConfigConsts.APOLLO_JDBC_DAO); | |
| 78 | - String url = System.getProperty(ConfigConsts.APOLLO_JDBC_URL); | |
| 79 | - String username = System.getProperty(ConfigConsts.APOLLO_JDBC_USERNAME); | |
| 80 | - String password = System.getProperty(ConfigConsts.APOLLO_JDBC_PASSWORD); | |
| 81 | - // 创建 DBConfigRepository 对象 | |
| 82 | - Class<? extends ConfigFrameworkDAO> clazz = ClassUtil.loadClass(dao); | |
| 83 | - Constructor<? extends ConfigFrameworkDAO> constructor = ReflectUtil.getConstructor(clazz, String.class, String.class, String.class); | |
| 84 | - return constructor.newInstance(url, username, password); | |
| 85 | - } | |
| 86 | - | |
| 87 | - /** | |
| 88 | - * 通知同步, | |
| 89 | - */ | |
| 90 | - public static void noticeSync() { | |
| 91 | - // 提交到线程池中,避免和 schedulePeriodicRefresh 并发问题 | |
| 92 | - m_executorService.submit(() -> { | |
| 93 | - INSTANCE.trySync(); | |
| 94 | - }); | |
| 95 | - } | |
| 96 | - | |
| 97 | - @Override | |
| 98 | - protected void sync() { | |
| 99 | - // 第一步,尝试获取配置 | |
| 100 | - List<ConfigRespDTO> configs = this.loadConfigIfUpdate(this.maxUpdateTime); | |
| 101 | - if (CollUtil.isEmpty(configs)) { // 如果没有更新,则返回 | |
| 102 | - return; | |
| 103 | - } | |
| 104 | - | |
| 105 | - // 第二步,构建新的 Properties | |
| 106 | - Properties newProperties = this.buildProperties(configs); | |
| 107 | - this.m_configCache = newProperties; | |
| 108 | - // 第三步,获取最大的配置时间 | |
| 109 | - assert configs.size() > 0; // 断言,避免告警 | |
| 110 | - this.maxUpdateTime = configs.stream().max(Comparator.comparing(ConfigRespDTO::getUpdateTime)).get().getUpdateTime(); | |
| 111 | - // 第四部,触发配置刷新!重要!!!! | |
| 112 | - super.fireRepositoryChange(m_namespace, newProperties); | |
| 113 | - log.info("[sync][缓存配置,数量为:{}]", configs.size()); | |
| 114 | - } | |
| 115 | - | |
| 116 | - @Override | |
| 117 | - public Properties getConfig() { | |
| 118 | - // 兜底,避免可能存在配置为 null 的情况 | |
| 119 | - if (m_configCache == null) { | |
| 120 | - this.trySync(); | |
| 121 | - } | |
| 122 | - // 返回配置 | |
| 123 | - return m_configCache; | |
| 124 | - } | |
| 125 | - | |
| 126 | - @Override | |
| 127 | - public void setUpstreamRepository(ConfigRepository upstreamConfigRepository) { | |
| 128 | - // 啥事不做 | |
| 129 | - } | |
| 130 | - | |
| 131 | - @Override | |
| 132 | - public ConfigSourceType getSourceType() { | |
| 133 | - return ConfigSourceType.REMOTE; | |
| 134 | - } | |
| 135 | - | |
| 136 | - private Properties buildProperties(List<ConfigRespDTO> configs) { | |
| 137 | - Properties properties = propertiesFactory.getPropertiesInstance(); | |
| 138 | - configs.stream().filter(config -> !config.getDeleted()) // 过滤掉被删除的配置 | |
| 139 | - .forEach(config -> properties.put(config.getKey(), config.getValue())); | |
| 140 | - return properties; | |
| 141 | - } | |
| 142 | - | |
| 143 | - // ========== 定时器相关操作 ========== | |
| 144 | - | |
| 145 | - private void schedulePeriodicRefresh() { | |
| 146 | - log.debug("Schedule periodic refresh with interval: {} {}", | |
| 147 | - m_configUtil.getRefreshInterval(), m_configUtil.getRefreshIntervalTimeUnit()); | |
| 148 | - m_executorService.scheduleAtFixedRate(() -> { | |
| 149 | - Tracer.logEvent("Apollo.ConfigService", String.format("periodicRefresh: %s", m_namespace)); | |
| 150 | - log.debug("refresh config for namespace: {}", m_namespace); | |
| 151 | - | |
| 152 | - // 执行同步. 内部已经 try catch 掉异常,无需在处理 | |
| 153 | - trySync(); | |
| 154 | - | |
| 155 | - Tracer.logEvent("Apollo.Client.Version", Apollo.VERSION); | |
| 156 | - }, m_configUtil.getRefreshInterval(), m_configUtil.getRefreshInterval(), | |
| 157 | - m_configUtil.getRefreshIntervalTimeUnit()); | |
| 158 | - } | |
| 159 | - | |
| 160 | - // ========== 数据库相关操作 ========== | |
| 161 | - | |
| 162 | - /** | |
| 163 | - * 如果配置发生变化,从数据库中获取最新的全量配置。 | |
| 164 | - * 如果未发生变化,则返回空 | |
| 165 | - * | |
| 166 | - * @param maxUpdateTime 当前配置的最大更新时间 | |
| 167 | - * @return 配置列表 | |
| 168 | - */ | |
| 169 | - private List<ConfigRespDTO> loadConfigIfUpdate(Date maxUpdateTime) { | |
| 170 | - // 第一步,判断是否要更新。 | |
| 171 | - if (maxUpdateTime == null) { // 如果更新时间为空,说明 DB 一定有新数据 | |
| 172 | - log.info("[loadConfigIfUpdate][首次加载全量配置]"); | |
| 173 | - } else { // 判断数据库中是否有更新的配置 | |
| 174 | - if (configFrameworkDAO.selectCountByUpdateTimeGt(maxUpdateTime) == 0) { | |
| 175 | - return null; | |
| 176 | - } | |
| 177 | - log.info("[loadConfigIfUpdate][增量加载全量配置]"); | |
| 178 | - } | |
| 179 | - // 第二步,如果有更新,则从数据库加载所有配置 | |
| 180 | - return configFrameworkDAO.selectList(); | |
| 181 | - } | |
| 182 | - | |
| 183 | -} |
yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/internals/DefaultXInjector.java deleted
| 1 | -package cn.iocoder.yudao.framework.apollo.internals; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.apollo.spi.DBConfigFactory; | |
| 4 | -import com.ctrip.framework.apollo.exceptions.ApolloConfigException; | |
| 5 | -import com.ctrip.framework.apollo.internals.*; | |
| 6 | -import com.ctrip.framework.apollo.spi.*; | |
| 7 | -import com.ctrip.framework.apollo.tracer.Tracer; | |
| 8 | -import com.ctrip.framework.apollo.util.ConfigUtil; | |
| 9 | -import com.ctrip.framework.apollo.util.factory.DefaultPropertiesFactory; | |
| 10 | -import com.ctrip.framework.apollo.util.factory.PropertiesFactory; | |
| 11 | -import com.ctrip.framework.apollo.util.http.DefaultHttpClient; | |
| 12 | -import com.ctrip.framework.apollo.util.yaml.YamlParser; | |
| 13 | -import com.google.inject.AbstractModule; | |
| 14 | -import com.google.inject.Guice; | |
| 15 | -import com.google.inject.Singleton; | |
| 16 | - | |
| 17 | -/** | |
| 18 | - * Guice injector | |
| 19 | - * | |
| 20 | - * 基于 Guice 注入器实现类 | |
| 21 | - * | |
| 22 | - * @author Jason Song(song_s@ctrip.com) | |
| 23 | - */ | |
| 24 | -public class DefaultXInjector implements Injector { | |
| 25 | - | |
| 26 | - private final com.google.inject.Injector m_injector; | |
| 27 | - | |
| 28 | - public DefaultXInjector() { | |
| 29 | - try { | |
| 30 | - m_injector = Guice.createInjector(new ApolloModule()); | |
| 31 | - } catch (Throwable ex) { | |
| 32 | - ApolloConfigException exception = new ApolloConfigException("Unable to initialize Guice Injector!", ex); | |
| 33 | - Tracer.logError(exception); | |
| 34 | - throw exception; | |
| 35 | - } | |
| 36 | - } | |
| 37 | - | |
| 38 | - @Override | |
| 39 | - public <T> T getInstance(Class<T> clazz) { | |
| 40 | - try { | |
| 41 | - return m_injector.getInstance(clazz); | |
| 42 | - } catch (Throwable ex) { | |
| 43 | - Tracer.logError(ex); | |
| 44 | - throw new ApolloConfigException(String.format("Unable to load instance for %s!", clazz.getName()), ex); | |
| 45 | - } | |
| 46 | - } | |
| 47 | - | |
| 48 | - @Override | |
| 49 | - public <T> T getInstance(Class<T> clazz, String name) { | |
| 50 | - // Guice does not support get instance by type and name | |
| 51 | - return null; | |
| 52 | - } | |
| 53 | - | |
| 54 | - private static class ApolloModule extends AbstractModule { | |
| 55 | - | |
| 56 | - @Override | |
| 57 | - protected void configure() { | |
| 58 | - bind(ConfigManager.class).to(DefaultConfigManager.class).in(Singleton.class); | |
| 59 | - bind(ConfigFactoryManager.class).to(DefaultConfigFactoryManager.class).in(Singleton.class); | |
| 60 | - bind(ConfigRegistry.class).to(DefaultConfigRegistry.class).in(Singleton.class); | |
| 61 | - | |
| 62 | - // 自定义 ConfigFactory 实现,使用 DB 作为数据源 | |
| 63 | - bind(ConfigFactory.class).to(DBConfigFactory.class).in(Singleton.class); | |
| 64 | - | |
| 65 | - bind(ConfigUtil.class).in(Singleton.class); | |
| 66 | - bind(DefaultHttpClient.class).in(Singleton.class); | |
| 67 | - bind(ConfigServiceLocator.class).in(Singleton.class); | |
| 68 | - bind(RemoteConfigLongPollService.class).in(Singleton.class); | |
| 69 | - bind(YamlParser.class).in(Singleton.class); | |
| 70 | - bind(PropertiesFactory.class).to(DefaultPropertiesFactory.class).in(Singleton.class); | |
| 71 | - } | |
| 72 | - | |
| 73 | - } | |
| 74 | - | |
| 75 | -} |
yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/internals/dto/ConfigRespDTO.java deleted
| 1 | -package cn.iocoder.yudao.framework.apollo.internals.dto; | |
| 2 | - | |
| 3 | -import lombok.Data; | |
| 4 | - | |
| 5 | -import java.util.Date; | |
| 6 | - | |
| 7 | -/** | |
| 8 | - * 配置 Response DTO | |
| 9 | - * | |
| 10 | - * @author 芋道源码 | |
| 11 | - */ | |
| 12 | -@Data | |
| 13 | -public class ConfigRespDTO { | |
| 14 | - | |
| 15 | - /** | |
| 16 | - * 参数键名 | |
| 17 | - */ | |
| 18 | - private String key; | |
| 19 | - /** | |
| 20 | - * 参数键值 | |
| 21 | - */ | |
| 22 | - private String value; | |
| 23 | - | |
| 24 | - /** | |
| 25 | - * 是否删除 | |
| 26 | - */ | |
| 27 | - private Boolean deleted; | |
| 28 | - /** | |
| 29 | - * 更新时间 | |
| 30 | - */ | |
| 31 | - private Date updateTime; | |
| 32 | - | |
| 33 | -} |
yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/package-info.java deleted
| 1 | -/** | |
| 2 | - * 配置中心客户端,基于 Apollo Client 进行简化 | |
| 3 | - * | |
| 4 | - * 差别在于,我们使用 cn.iocoder.yudao.modules.infra.dal.dataobject.config.InfConfigDO 表作为配置源。 | |
| 5 | - * 当然,功能肯定也会相对少些,满足最小化诉求。 | |
| 6 | - * | |
| 7 | - * 1. 项目初始化时,可以使用 SysConfigDO 表的配置 | |
| 8 | - * 2. 使用 Spring @Value 可以注入属性 | |
| 9 | - * 3. SysConfigDO 表的配置修改时,注入到 @Value 的属性可以刷新 | |
| 10 | - * | |
| 11 | - * 另外,整个包结构会参考 Apollo 为主,方便维护与理解 | |
| 12 | - */ | |
| 13 | -package cn.iocoder.yudao.framework.apollo; |
yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/spi/DBConfigFactory.java deleted
| 1 | -package cn.iocoder.yudao.framework.apollo.spi; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.apollo.internals.DBConfigRepository; | |
| 4 | -import com.ctrip.framework.apollo.Config; | |
| 5 | -import com.ctrip.framework.apollo.ConfigFile; | |
| 6 | -import com.ctrip.framework.apollo.core.enums.ConfigFileFormat; | |
| 7 | -import com.ctrip.framework.apollo.internals.ConfigRepository; | |
| 8 | -import com.ctrip.framework.apollo.internals.DefaultConfig; | |
| 9 | -import com.ctrip.framework.apollo.spi.ConfigFactory; | |
| 10 | - | |
| 11 | -/** | |
| 12 | - * 基于 DB 的 ConfigFactory 实现类 | |
| 13 | - * | |
| 14 | - * @author 芋道源码 | |
| 15 | - */ | |
| 16 | -public class DBConfigFactory implements ConfigFactory { | |
| 17 | - | |
| 18 | - @Override | |
| 19 | - public Config create(String namespace) { | |
| 20 | - return new DefaultConfig(namespace, this.createDBConfigRepository(namespace)); | |
| 21 | - } | |
| 22 | - | |
| 23 | - @Override | |
| 24 | - public ConfigFile createConfigFile(String namespace, ConfigFileFormat configFileFormat) { | |
| 25 | - throw new UnsupportedOperationException("暂不支持 Apollo 配置文件"); | |
| 26 | - } | |
| 27 | - | |
| 28 | - private ConfigRepository createDBConfigRepository(String namespace) { | |
| 29 | - return new DBConfigRepository(namespace); | |
| 30 | - } | |
| 31 | - | |
| 32 | -} |
yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/spring/boot/ApolloApplicationContextInitializer.java deleted
| 1 | -package cn.iocoder.yudao.framework.apollo.spring.boot; | |
| 2 | - | |
| 3 | -import cn.iocoder.yudao.framework.apollo.core.ConfigConsts; | |
| 4 | -import com.google.common.base.Strings; | |
| 5 | -import org.springframework.boot.SpringApplication; | |
| 6 | -import org.springframework.boot.env.EnvironmentPostProcessor; | |
| 7 | -import org.springframework.core.Ordered; | |
| 8 | -import org.springframework.core.env.ConfigurableEnvironment; | |
| 9 | - | |
| 10 | -/** | |
| 11 | - * 对 {@link com.ctrip.framework.apollo.spring.boot.ApolloApplicationContextInitializer} 的补充,目前的目的有: | |
| 12 | - * | |
| 13 | - * 1. 将自定义的 apollo.jdbc 设置到 System 变量中 | |
| 14 | - * | |
| 15 | - * @author 芋道源码 | |
| 16 | - */ | |
| 17 | -public class ApolloApplicationContextInitializer implements EnvironmentPostProcessor, Ordered { | |
| 18 | - | |
| 19 | - /** | |
| 20 | - * 优先级更高,要早于 Apollo 的 ApolloApplicationContextInitializer 的初始化 | |
| 21 | - */ | |
| 22 | - public static final int DEFAULT_ORDER = -1; | |
| 23 | - | |
| 24 | - private int order = DEFAULT_ORDER; | |
| 25 | - | |
| 26 | - private static final String[] APOLLO_SYSTEM_PROPERTIES = {ConfigConsts.APOLLO_JDBC_DAO, | |
| 27 | - ConfigConsts.APOLLO_JDBC_URL, ConfigConsts.APOLLO_JDBC_USERNAME, ConfigConsts.APOLLO_JDBC_PASSWORD}; | |
| 28 | - | |
| 29 | - @Override | |
| 30 | - public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) { | |
| 31 | - initializeSystemProperty(environment); | |
| 32 | - } | |
| 33 | - | |
| 34 | - /** | |
| 35 | - * To fill system properties from environment config | |
| 36 | - */ | |
| 37 | - void initializeSystemProperty(ConfigurableEnvironment environment) { | |
| 38 | - for (String propertyName : APOLLO_SYSTEM_PROPERTIES) { | |
| 39 | - fillSystemPropertyFromEnvironment(environment, propertyName); | |
| 40 | - } | |
| 41 | - } | |
| 42 | - | |
| 43 | - private void fillSystemPropertyFromEnvironment(ConfigurableEnvironment environment, String propertyName) { | |
| 44 | - if (System.getProperty(propertyName) != null) { | |
| 45 | - return; | |
| 46 | - } | |
| 47 | - String propertyValue = environment.getProperty(propertyName); | |
| 48 | - if (Strings.isNullOrEmpty(propertyValue)) { | |
| 49 | - return; | |
| 50 | - } | |
| 51 | - System.setProperty(propertyName, propertyValue); | |
| 52 | - } | |
| 53 | - | |
| 54 | - @Override | |
| 55 | - public int getOrder() { | |
| 56 | - return order; | |
| 57 | - } | |
| 58 | - | |
| 59 | - public void setOrder(int order) { | |
| 60 | - this.order = order; | |
| 61 | - } | |
| 62 | - | |
| 63 | -} |
yudao-framework/yudao-spring-boot-starter-config/src/main/resources/META-INF/services/com.ctrip.framework.apollo.internals.Injector deleted
| 1 | -cn.iocoder.yudao.framework.apollo.internals.DefaultXInjector |
yudao-framework/yudao-spring-boot-starter-config/src/main/resources/META-INF/spring.factories deleted
yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/config/YudaoFileAutoConfiguration.java
yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClient.java
| ... | ... | @@ -75,7 +75,8 @@ public class S3FileClient extends AbstractFileClient<S3FileClientConfig> { |
| 75 | 75 | // 阿里云必须有 region,否则会报错 |
| 76 | 76 | if (config.getEndpoint().contains(ENDPOINT_ALIYUN)) { |
| 77 | 77 | return StrUtil.subBefore(config.getEndpoint(), '.', false) |
| 78 | - .replaceAll("-internal", ""); // 去除内网 Endpoint 的后缀 | |
| 78 | + .replaceAll("-internal", "")// 去除内网 Endpoint 的后缀 | |
| 79 | + .replaceAll("https://", ""); | |
| 79 | 80 | } |
| 80 | 81 | return null; |
| 81 | 82 | } | ... | ... |
yudao-framework/yudao-spring-boot-starter-flowable/src/main/java/cn/iocoder/yudao/framework/flowable/config/YudaoFlowableConfiguration.java
| ... | ... | @@ -8,7 +8,7 @@ import org.springframework.context.annotation.Configuration; |
| 8 | 8 | import org.springframework.core.task.AsyncListenableTaskExecutor; |
| 9 | 9 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
| 10 | 10 | |
| 11 | -@Configuration | |
| 11 | +@Configuration(proxyBeanMethods = false) | |
| 12 | 12 | public class YudaoFlowableConfiguration { |
| 13 | 13 | |
| 14 | 14 | /** | ... | ... |
yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/config/YudaoAsyncAutoConfiguration.java
yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/config/YudaoQuartzAutoConfiguration.java
| ... | ... | @@ -9,7 +9,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; |
| 9 | 9 | /** |
| 10 | 10 | * 定时任务 Configuration |
| 11 | 11 | */ |
| 12 | -@Configuration | |
| 12 | +@Configuration(proxyBeanMethods = false) | |
| 13 | 13 | @EnableScheduling // 开启 Spring 自带的定时任务 |
| 14 | 14 | public class YudaoQuartzAutoConfiguration { |
| 15 | 15 | ... | ... |
yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/handler/JobHandlerInvoker.java
| 1 | 1 | package cn.iocoder.yudao.framework.quartz.core.handler; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.date.LocalDateTimeUtil; | |
| 3 | 4 | import cn.hutool.core.lang.Assert; |
| 4 | 5 | import cn.hutool.core.thread.ThreadUtil; |
| 5 | 6 | import cn.iocoder.yudao.framework.quartz.core.enums.JobDataKeyEnum; |
| ... | ... | @@ -13,10 +14,10 @@ import org.springframework.context.ApplicationContext; |
| 13 | 14 | import org.springframework.scheduling.quartz.QuartzJobBean; |
| 14 | 15 | |
| 15 | 16 | import javax.annotation.Resource; |
| 16 | -import java.util.Date; | |
| 17 | +import java.time.LocalDateTime; | |
| 18 | +import java.time.temporal.ChronoUnit; | |
| 17 | 19 | |
| 18 | 20 | import static cn.hutool.core.exceptions.ExceptionUtil.getRootCauseMessage; |
| 19 | -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.diff; | |
| 20 | 21 | |
| 21 | 22 | /** |
| 22 | 23 | * 基础 Job 调用者,负责调用 {@link JobHandler#execute(String)} 执行任务 |
| ... | ... | @@ -46,7 +47,7 @@ public class JobHandlerInvoker extends QuartzJobBean { |
| 46 | 47 | |
| 47 | 48 | // 第二步,执行任务 |
| 48 | 49 | Long jobLogId = null; |
| 49 | - Date startTime = new Date(); | |
| 50 | + LocalDateTime startTime = LocalDateTime.now(); | |
| 50 | 51 | String data = null; |
| 51 | 52 | Throwable exception = null; |
| 52 | 53 | try { |
| ... | ... | @@ -73,9 +74,9 @@ public class JobHandlerInvoker extends QuartzJobBean { |
| 73 | 74 | return jobHandler.execute(jobHandlerParam); |
| 74 | 75 | } |
| 75 | 76 | |
| 76 | - private void updateJobLogResultAsync(Long jobLogId, Date startTime, String data, Throwable exception, | |
| 77 | + private void updateJobLogResultAsync(Long jobLogId, LocalDateTime startTime, String data, Throwable exception, | |
| 77 | 78 | JobExecutionContext executionContext) { |
| 78 | - Date endTime = new Date(); | |
| 79 | + LocalDateTime endTime = LocalDateTime.now(); | |
| 79 | 80 | // 处理是否成功 |
| 80 | 81 | boolean success = exception == null; |
| 81 | 82 | if (!success) { |
| ... | ... | @@ -83,7 +84,7 @@ public class JobHandlerInvoker extends QuartzJobBean { |
| 83 | 84 | } |
| 84 | 85 | // 更新日志 |
| 85 | 86 | try { |
| 86 | - jobLogFrameworkService.updateJobLogResultAsync(jobLogId, endTime, (int) diff(endTime, startTime), success, data); | |
| 87 | + jobLogFrameworkService.updateJobLogResultAsync(jobLogId, endTime, (int) LocalDateTimeUtil.between(startTime, endTime).toMillis(), success, data); | |
| 87 | 88 | } catch (Exception ex) { |
| 88 | 89 | log.error("[executeInternal][Job({}) logId({}) 记录执行日志失败({}/{})]", |
| 89 | 90 | executionContext.getJobDetail().getKey(), jobLogId, success, data); | ... | ... |
yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/service/JobLogFrameworkService.java
| ... | ... | @@ -2,7 +2,7 @@ package cn.iocoder.yudao.framework.quartz.core.service; |
| 2 | 2 | |
| 3 | 3 | import javax.validation.constraints.NotEmpty; |
| 4 | 4 | import javax.validation.constraints.NotNull; |
| 5 | -import java.util.Date; | |
| 5 | +import java.time.LocalDateTime; | |
| 6 | 6 | |
| 7 | 7 | /** |
| 8 | 8 | * Job 日志 Framework Service 接口 |
| ... | ... | @@ -22,7 +22,7 @@ public interface JobLogFrameworkService { |
| 22 | 22 | * @return Job 日志的编号 |
| 23 | 23 | */ |
| 24 | 24 | Long createJobLog(@NotNull(message = "任务编号不能为空") Long jobId, |
| 25 | - @NotNull(message = "开始时间") Date beginTime, | |
| 25 | + @NotNull(message = "开始时间") LocalDateTime beginTime, | |
| 26 | 26 | @NotEmpty(message = "Job 处理器的名字不能为空") String jobHandlerName, |
| 27 | 27 | String jobHandlerParam, |
| 28 | 28 | @NotNull(message = "第几次执行不能为空") Integer executeIndex); |
| ... | ... | @@ -37,7 +37,7 @@ public interface JobLogFrameworkService { |
| 37 | 37 | * @param result 成功数据 |
| 38 | 38 | */ |
| 39 | 39 | void updateJobLogResultAsync(@NotNull(message = "日志编号不能为空") Long logId, |
| 40 | - @NotNull(message = "结束时间不能为空") Date endTime, | |
| 40 | + @NotNull(message = "结束时间不能为空") LocalDateTime endTime, | |
| 41 | 41 | @NotNull(message = "运行时长不能为空") Integer duration, |
| 42 | 42 | boolean success, String result); |
| 43 | 43 | ... | ... |
yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/util/CronUtils.java
| 1 | 1 | package cn.iocoder.yudao.framework.quartz.core.util; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.date.LocalDateTimeUtil; | |
| 3 | 4 | import org.quartz.CronExpression; |
| 4 | 5 | |
| 5 | 6 | import java.text.ParseException; |
| 7 | +import java.time.LocalDateTime; | |
| 6 | 8 | import java.util.ArrayList; |
| 7 | 9 | import java.util.Date; |
| 8 | 10 | import java.util.List; |
| ... | ... | @@ -31,7 +33,7 @@ public class CronUtils { |
| 31 | 33 | * @param n 数量 |
| 32 | 34 | * @return 满足条件的执行时间 |
| 33 | 35 | */ |
| 34 | - public static List<Date> getNextTimes(String cronExpression, int n) { | |
| 36 | + public static List<LocalDateTime> getNextTimes(String cronExpression, int n) { | |
| 35 | 37 | // 获得 CronExpression 对象 |
| 36 | 38 | CronExpression cron; |
| 37 | 39 | try { |
| ... | ... | @@ -41,10 +43,10 @@ public class CronUtils { |
| 41 | 43 | } |
| 42 | 44 | // 从当前开始计算,n 个满足条件的 |
| 43 | 45 | Date now = new Date(); |
| 44 | - List<Date> nextTimes = new ArrayList<>(n); | |
| 46 | + List<LocalDateTime> nextTimes = new ArrayList<>(n); | |
| 45 | 47 | for (int i = 0; i < n; i++) { |
| 46 | 48 | Date nextTime = cron.getNextValidTimeAfter(now); |
| 47 | - nextTimes.add(nextTime); | |
| 49 | + nextTimes.add(LocalDateTimeUtil.of(nextTime)); | |
| 48 | 50 | // 切换现在,为下一个触发时间; |
| 49 | 51 | now = nextTime; |
| 50 | 52 | } | ... | ... |
yudao-framework/yudao-spring-boot-starter-monitor/src/main/java/cn/iocoder/yudao/framework/tracer/config/YudaoMetricsAutoConfiguration.java
| ... | ... | @@ -13,7 +13,7 @@ import org.springframework.context.annotation.Configuration; |
| 13 | 13 | * |
| 14 | 14 | * @author 芋道源码 |
| 15 | 15 | */ |
| 16 | -@Configuration | |
| 16 | +@Configuration(proxyBeanMethods = false) | |
| 17 | 17 | @ConditionalOnClass({MeterRegistryCustomizer.class}) |
| 18 | 18 | @ConditionalOnProperty(prefix = "yudao.metrics", value = "enable", matchIfMissing = true) // 允许使用 yudao.metrics.enable=false 禁用 Metrics |
| 19 | 19 | public class YudaoMetricsAutoConfiguration { | ... | ... |
yudao-framework/yudao-spring-boot-starter-monitor/src/main/java/cn/iocoder/yudao/framework/tracer/config/YudaoTracerAutoConfiguration.java
| ... | ... | @@ -15,7 +15,7 @@ import org.springframework.context.annotation.Configuration; |
| 15 | 15 | * |
| 16 | 16 | * @author mashu |
| 17 | 17 | */ |
| 18 | -@Configuration | |
| 18 | +@Configuration(proxyBeanMethods = false) | |
| 19 | 19 | @ConditionalOnClass({BizTraceAspect.class}) |
| 20 | 20 | @EnableConfigurationProperties(TracerProperties.class) |
| 21 | 21 | @ConditionalOnProperty(prefix = "yudao.tracer", value = "enable", matchIfMissing = true) | ... | ... |
yudao-framework/yudao-spring-boot-starter-mq/src/main/java/cn/iocoder/yudao/framework/mq/config/YudaoMQAutoConfiguration.java
| ... | ... | @@ -25,6 +25,7 @@ import org.springframework.data.redis.listener.ChannelTopic; |
| 25 | 25 | import org.springframework.data.redis.listener.RedisMessageListenerContainer; |
| 26 | 26 | import org.springframework.data.redis.stream.DefaultStreamMessageListenerContainerX; |
| 27 | 27 | import org.springframework.data.redis.stream.StreamMessageListenerContainer; |
| 28 | +import org.springframework.scheduling.annotation.Async; | |
| 28 | 29 | |
| 29 | 30 | import java.util.List; |
| 30 | 31 | import java.util.Properties; |
| ... | ... | @@ -34,7 +35,7 @@ import java.util.Properties; |
| 34 | 35 | * |
| 35 | 36 | * @author 芋道源码 |
| 36 | 37 | */ |
| 37 | -@Configuration | |
| 38 | +@Configuration(proxyBeanMethods = false) | |
| 38 | 39 | @AutoConfigureAfter(YudaoRedisAutoConfiguration.class) |
| 39 | 40 | @Slf4j |
| 40 | 41 | public class YudaoMQAutoConfiguration { |
| ... | ... | @@ -54,6 +55,7 @@ public class YudaoMQAutoConfiguration { |
| 54 | 55 | * 创建 Redis Pub/Sub 广播消费的容器 |
| 55 | 56 | */ |
| 56 | 57 | @Bean |
| 58 | + @Async // 异步化,可降低 2 秒左右的启动时间 | |
| 57 | 59 | public RedisMessageListenerContainer redisMessageListenerContainer( |
| 58 | 60 | RedisMQTemplate redisMQTemplate, List<AbstractChannelMessageListener<?>> listeners) { |
| 59 | 61 | // 创建 RedisMessageListenerContainer 对象 |
| ... | ... | @@ -76,6 +78,7 @@ public class YudaoMQAutoConfiguration { |
| 76 | 78 | * Redis Stream 的 xreadgroup 命令:https://www.geek-book.com/src/docs/redis/redis/redis.io/commands/xreadgroup.html |
| 77 | 79 | */ |
| 78 | 80 | @Bean(initMethod = "start", destroyMethod = "stop") |
| 81 | + @Async // 异步化,可降低 5 秒左右的启动时间 | |
| 79 | 82 | public StreamMessageListenerContainer<String, ObjectRecord<String, String>> redisStreamMessageListenerContainer( |
| 80 | 83 | RedisMQTemplate redisMQTemplate, List<AbstractStreamMessageListener<?>> listeners) { |
| 81 | 84 | RedisTemplate<String, ?> redisTemplate = redisMQTemplate.getRedisTemplate(); |
| ... | ... | @@ -95,6 +98,8 @@ public class YudaoMQAutoConfiguration { |
| 95 | 98 | // 第二步,注册监听器,消费对应的 Stream 主题 |
| 96 | 99 | String consumerName = buildConsumerName(); |
| 97 | 100 | listeners.parallelStream().forEach(listener -> { |
| 101 | + log.info("[redisStreamMessageListenerContainer][开始注册 StreamKey({}) 对应的监听器({})]", | |
| 102 | + listener.getStreamKey(), listener.getClass().getName()); | |
| 98 | 103 | // 创建 listener 对应的消费者分组 |
| 99 | 104 | try { |
| 100 | 105 | redisTemplate.opsForStream().createGroup(listener.getStreamKey(), listener.getGroup()); |
| ... | ... | @@ -111,6 +116,8 @@ public class YudaoMQAutoConfiguration { |
| 111 | 116 | .autoAcknowledge(false) // 不自动 ack |
| 112 | 117 | .cancelOnError(throwable -> false); // 默认配置,发生异常就取消消费,显然不符合预期;因此,我们设置为 false |
| 113 | 118 | container.register(builder.build(), listener); |
| 119 | + log.info("[redisStreamMessageListenerContainer][完成注册 StreamKey({}) 对应的监听器({})]", | |
| 120 | + listener.getStreamKey(), listener.getClass().getName()); | |
| 114 | 121 | }); |
| 115 | 122 | return container; |
| 116 | 123 | } | ... | ... |
yudao-framework/yudao-spring-boot-starter-mybatis/pom.xml
| ... | ... | @@ -59,13 +59,6 @@ |
| 59 | 59 | <artifactId>dynamic-datasource-spring-boot-starter</artifactId> <!-- 多数据源 --> |
| 60 | 60 | </dependency> |
| 61 | 61 | |
| 62 | - <!-- 工具类相关 --> | |
| 63 | - <dependency> | |
| 64 | - <groupId>com.github.ulisesbocchio</groupId> | |
| 65 | - <artifactId>jasypt-spring-boot-starter</artifactId> <!-- 加解密 --> | |
| 66 | - <optional>true</optional> | |
| 67 | - </dependency> | |
| 68 | - | |
| 69 | 62 | </dependencies> |
| 70 | 63 | |
| 71 | 64 | </project> | ... | ... |
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/datasource/config/YudaoDataSourceAutoConfiguration.java
| ... | ... | @@ -14,7 +14,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement; |
| 14 | 14 | * |
| 15 | 15 | * @author 芋道源码 |
| 16 | 16 | */ |
| 17 | -@Configuration | |
| 17 | +@Configuration(proxyBeanMethods = false) | |
| 18 | 18 | @EnableTransactionManagement(proxyTargetClass = true) // 启动事务管理 |
| 19 | 19 | @EnableConfigurationProperties(DruidStatProperties.class) |
| 20 | 20 | public class YudaoDataSourceAutoConfiguration { | ... | ... |
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/config/YudaoMybatisAutoConfiguration.java
| ... | ... | @@ -23,7 +23,7 @@ import org.springframework.core.env.ConfigurableEnvironment; |
| 23 | 23 | * |
| 24 | 24 | * @author 芋道源码 |
| 25 | 25 | */ |
| 26 | -@Configuration | |
| 26 | +@Configuration(proxyBeanMethods = false) | |
| 27 | 27 | @MapperScan(value = "${yudao.info.base-package}", annotationClass = Mapper.class, |
| 28 | 28 | lazyInitialization = "${mybatis.lazy-initialization:false}") // Mapper 懒加载,目前仅用于单元测试 |
| 29 | 29 | public class YudaoMybatisAutoConfiguration { | ... | ... |
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/dataobject/BaseDO.java
| ... | ... | @@ -7,7 +7,7 @@ import lombok.Data; |
| 7 | 7 | import org.apache.ibatis.type.JdbcType; |
| 8 | 8 | |
| 9 | 9 | import java.io.Serializable; |
| 10 | -import java.util.Date; | |
| 10 | +import java.time.LocalDateTime; | |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * 基础实体对象 |
| ... | ... | @@ -21,12 +21,12 @@ public abstract class BaseDO implements Serializable { |
| 21 | 21 | * 创建时间 |
| 22 | 22 | */ |
| 23 | 23 | @TableField(fill = FieldFill.INSERT) |
| 24 | - private Date createTime; | |
| 24 | + private LocalDateTime createTime; | |
| 25 | 25 | /** |
| 26 | 26 | * 最后更新时间 |
| 27 | 27 | */ |
| 28 | 28 | @TableField(fill = FieldFill.INSERT_UPDATE) |
| 29 | - private Date updateTime; | |
| 29 | + private LocalDateTime updateTime; | |
| 30 | 30 | /** |
| 31 | 31 | * 创建者,目前使用 SysUser 的 id 编号 |
| 32 | 32 | * | ... | ... |
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/handler/DefaultDBFieldHandler.java
| ... | ... | @@ -5,7 +5,7 @@ import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils; |
| 5 | 5 | import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; |
| 6 | 6 | import org.apache.ibatis.reflection.MetaObject; |
| 7 | 7 | |
| 8 | -import java.util.Date; | |
| 8 | +import java.time.LocalDateTime; | |
| 9 | 9 | import java.util.Objects; |
| 10 | 10 | |
| 11 | 11 | /** |
| ... | ... | @@ -22,7 +22,7 @@ public class DefaultDBFieldHandler implements MetaObjectHandler { |
| 22 | 22 | if (Objects.nonNull(metaObject) && metaObject.getOriginalObject() instanceof BaseDO) { |
| 23 | 23 | BaseDO baseDO = (BaseDO) metaObject.getOriginalObject(); |
| 24 | 24 | |
| 25 | - Date current = new Date(); | |
| 25 | + LocalDateTime current = LocalDateTime.now(); | |
| 26 | 26 | // 创建时间为空,则以当前时间为插入时间 |
| 27 | 27 | if (Objects.isNull(baseDO.getCreateTime())) { |
| 28 | 28 | baseDO.setCreateTime(current); |
| ... | ... | @@ -49,7 +49,7 @@ public class DefaultDBFieldHandler implements MetaObjectHandler { |
| 49 | 49 | // 更新时间为空,则以当前时间为更新时间 |
| 50 | 50 | Object modifyTime = getFieldValByName("updateTime", metaObject); |
| 51 | 51 | if (Objects.isNull(modifyTime)) { |
| 52 | - setFieldValByName("updateTime", new Date(), metaObject); | |
| 52 | + setFieldValByName("updateTime", LocalDateTime.now(), metaObject); | |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | // 当前登录用户不为空,更新人为空,则当前登录用户为更新人 | ... | ... |
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/core/type/EncryptTypeHandler.java
| 1 | 1 | package cn.iocoder.yudao.framework.mybatis.core.type; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.lang.Assert; |
| 4 | +import cn.hutool.crypto.SecureUtil; | |
| 5 | +import cn.hutool.crypto.symmetric.AES; | |
| 4 | 6 | import cn.hutool.extra.spring.SpringUtil; |
| 5 | 7 | import org.apache.ibatis.type.BaseTypeHandler; |
| 6 | 8 | import org.apache.ibatis.type.JdbcType; |
| 7 | -import org.jasypt.encryption.StringEncryptor; | |
| 8 | 9 | |
| 9 | 10 | import java.sql.CallableStatement; |
| 10 | 11 | import java.sql.PreparedStatement; |
| ... | ... | @@ -12,18 +13,20 @@ import java.sql.ResultSet; |
| 12 | 13 | import java.sql.SQLException; |
| 13 | 14 | |
| 14 | 15 | /** |
| 15 | - * 字段字段的 TypeHandler 实现类,基于 {@link StringEncryptor} 实现 | |
| 16 | + * 字段字段的 TypeHandler 实现类,基于 {@link cn.hutool.crypto.symmetric.AES} 实现 | |
| 16 | 17 | * 可通过 jasypt.encryptor.password 配置项,设置密钥 |
| 17 | 18 | * |
| 18 | 19 | * @author 芋道源码 |
| 19 | 20 | */ |
| 20 | 21 | public class EncryptTypeHandler extends BaseTypeHandler<String> { |
| 21 | 22 | |
| 22 | - private static StringEncryptor encryptor; | |
| 23 | + private static final String ENCRYPTOR_PROPERTY_NAME = "mybatis-plus.encryptor.password"; | |
| 24 | + | |
| 25 | + private static AES aes; | |
| 23 | 26 | |
| 24 | 27 | @Override |
| 25 | 28 | public void setNonNullParameter(PreparedStatement ps, int i, String parameter, JdbcType jdbcType) throws SQLException { |
| 26 | - ps.setString(i, getEncryptor().encrypt(parameter)); | |
| 29 | + ps.setString(i, encrypt(parameter)); | |
| 27 | 30 | } |
| 28 | 31 | |
| 29 | 32 | @Override |
| ... | ... | @@ -48,23 +51,25 @@ public class EncryptTypeHandler extends BaseTypeHandler<String> { |
| 48 | 51 | if (value == null) { |
| 49 | 52 | return null; |
| 50 | 53 | } |
| 51 | - return getEncryptor().decrypt(value); | |
| 54 | + return getEncryptor().decryptStr(value); | |
| 52 | 55 | } |
| 53 | 56 | |
| 54 | 57 | public static String encrypt(String rawValue) { |
| 55 | 58 | if (rawValue == null) { |
| 56 | 59 | return null; |
| 57 | 60 | } |
| 58 | - return getEncryptor().encrypt(rawValue); | |
| 61 | + return getEncryptor().encryptBase64(rawValue); | |
| 59 | 62 | } |
| 60 | 63 | |
| 61 | - private static StringEncryptor getEncryptor() { | |
| 62 | - if (encryptor != null) { | |
| 63 | - return encryptor; | |
| 64 | + private static AES getEncryptor() { | |
| 65 | + if (aes != null) { | |
| 66 | + return aes; | |
| 64 | 67 | } |
| 65 | - encryptor = SpringUtil.getBean(StringEncryptor.class); | |
| 66 | - Assert.notNull(encryptor, "StringEncryptor 不能为空"); | |
| 67 | - return encryptor; | |
| 68 | + // 构建 AES | |
| 69 | + String password = SpringUtil.getProperty(ENCRYPTOR_PROPERTY_NAME); | |
| 70 | + Assert.notEmpty(password, "配置项({}) 不能为空", ENCRYPTOR_PROPERTY_NAME); | |
| 71 | + aes = SecureUtil.aes(password.getBytes()); | |
| 72 | + return aes; | |
| 68 | 73 | } |
| 69 | 74 | |
| 70 | 75 | } | ... | ... |
yudao-framework/yudao-spring-boot-starter-protection/src/main/java/cn/iocoder/yudao/framework/lock4j/config/YudaoLock4jConfiguration.java
| ... | ... | @@ -8,7 +8,7 @@ import org.springframework.boot.autoconfigure.AutoConfigureBefore; |
| 8 | 8 | import org.springframework.context.annotation.Bean; |
| 9 | 9 | import org.springframework.context.annotation.Configuration; |
| 10 | 10 | |
| 11 | -@Configuration | |
| 11 | +@Configuration(proxyBeanMethods = false) | |
| 12 | 12 | @AutoConfigureBefore(LockAutoConfiguration.class) |
| 13 | 13 | public class YudaoLock4jConfiguration { |
| 14 | 14 | ... | ... |
yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoCacheAutoConfiguration.java
| ... | ... | @@ -13,7 +13,7 @@ import org.springframework.data.redis.serializer.RedisSerializer; |
| 13 | 13 | /** |
| 14 | 14 | * Cache 配置类,基于 Redis 实现 |
| 15 | 15 | */ |
| 16 | -@Configuration | |
| 16 | +@Configuration(proxyBeanMethods = false) | |
| 17 | 17 | @EnableConfigurationProperties({CacheProperties.class}) |
| 18 | 18 | @EnableCaching |
| 19 | 19 | public class YudaoCacheAutoConfiguration { | ... | ... |
yudao-framework/yudao-spring-boot-starter-redis/src/main/java/cn/iocoder/yudao/framework/redis/config/YudaoRedisAutoConfiguration.java
yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoWebSecurityConfigurerAdapter.java
| ... | ... | @@ -32,7 +32,7 @@ import java.util.Set; |
| 32 | 32 | * |
| 33 | 33 | * @author 芋道源码 |
| 34 | 34 | */ |
| 35 | -@Configuration | |
| 35 | +@Configuration(proxyBeanMethods = false) | |
| 36 | 36 | @EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) |
| 37 | 37 | public class YudaoWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter { |
| 38 | 38 | ... | ... |
yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/util/RandomUtils.java
| 1 | 1 | package cn.iocoder.yudao.framework.test.core.util; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.date.LocalDateTimeUtil; | |
| 3 | 4 | import cn.hutool.core.util.ArrayUtil; |
| 4 | 5 | import cn.hutool.core.util.RandomUtil; |
| 5 | 6 | import cn.hutool.core.util.StrUtil; |
| ... | ... | @@ -8,6 +9,7 @@ import uk.co.jemos.podam.api.PodamFactory; |
| 8 | 9 | import uk.co.jemos.podam.api.PodamFactoryImpl; |
| 9 | 10 | |
| 10 | 11 | import java.lang.reflect.Type; |
| 12 | +import java.time.LocalDateTime; | |
| 11 | 13 | import java.util.Arrays; |
| 12 | 14 | import java.util.Date; |
| 13 | 15 | import java.util.List; |
| ... | ... | @@ -76,6 +78,10 @@ public class RandomUtils { |
| 76 | 78 | return RandomUtil.randomDay(0, RANDOM_DATE_MAX); |
| 77 | 79 | } |
| 78 | 80 | |
| 81 | + public static LocalDateTime randomLocalDateTime() { | |
| 82 | + return LocalDateTimeUtil.of(randomDate()); | |
| 83 | + } | |
| 84 | + | |
| 79 | 85 | public static Short randomShort() { |
| 80 | 86 | return (short) RandomUtil.randomInt(0, Short.MAX_VALUE); |
| 81 | 87 | } | ... | ... |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/config/YudaoApiLogAutoConfiguration.java
| ... | ... | @@ -19,7 +19,7 @@ import org.springframework.context.annotation.Configuration; |
| 19 | 19 | |
| 20 | 20 | import javax.servlet.Filter; |
| 21 | 21 | |
| 22 | -@Configuration | |
| 22 | +@Configuration(proxyBeanMethods = false) | |
| 23 | 23 | @AutoConfigureAfter(YudaoWebAutoConfiguration.class) |
| 24 | 24 | public class YudaoApiLogAutoConfiguration { |
| 25 | 25 | ... | ... |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/filter/ApiAccessLogFilter.java
| 1 | 1 | package cn.iocoder.yudao.framework.apilog.core.filter; |
| 2 | 2 | |
| 3 | +import cn.hutool.core.date.LocalDateTimeUtil; | |
| 3 | 4 | import cn.hutool.core.exceptions.ExceptionUtil; |
| 4 | 5 | import cn.hutool.core.map.MapUtil; |
| 5 | 6 | import cn.hutool.extra.servlet.ServletUtil; |
| ... | ... | @@ -7,7 +8,6 @@ import cn.iocoder.yudao.framework.apilog.core.service.ApiAccessLog; |
| 7 | 8 | import cn.iocoder.yudao.framework.apilog.core.service.ApiAccessLogFrameworkService; |
| 8 | 9 | import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants; |
| 9 | 10 | import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 10 | -import cn.iocoder.yudao.framework.common.util.date.DateUtils; | |
| 11 | 11 | import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils; |
| 12 | 12 | import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; |
| 13 | 13 | import cn.iocoder.yudao.framework.web.config.WebProperties; |
| ... | ... | @@ -20,7 +20,8 @@ import javax.servlet.ServletException; |
| 20 | 20 | import javax.servlet.http.HttpServletRequest; |
| 21 | 21 | import javax.servlet.http.HttpServletResponse; |
| 22 | 22 | import java.io.IOException; |
| 23 | -import java.util.Date; | |
| 23 | +import java.time.LocalDateTime; | |
| 24 | +import java.time.temporal.ChronoUnit; | |
| 24 | 25 | import java.util.Map; |
| 25 | 26 | |
| 26 | 27 | import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; |
| ... | ... | @@ -47,7 +48,7 @@ public class ApiAccessLogFilter extends ApiRequestFilter { |
| 47 | 48 | protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain filterChain) |
| 48 | 49 | throws ServletException, IOException { |
| 49 | 50 | // 获得开始时间 |
| 50 | - Date beginTim = new Date(); | |
| 51 | + LocalDateTime beginTime = LocalDateTime.now(); | |
| 51 | 52 | // 提前获得参数,避免 XssFilter 过滤处理 |
| 52 | 53 | Map<String, String> queryString = ServletUtil.getParamMap(request); |
| 53 | 54 | String requestBody = ServletUtils.isJsonRequest(request) ? ServletUtil.getBody(request) : null; |
| ... | ... | @@ -56,15 +57,15 @@ public class ApiAccessLogFilter extends ApiRequestFilter { |
| 56 | 57 | // 继续过滤器 |
| 57 | 58 | filterChain.doFilter(request, response); |
| 58 | 59 | // 正常执行,记录日志 |
| 59 | - createApiAccessLog(request, beginTim, queryString, requestBody, null); | |
| 60 | + createApiAccessLog(request, beginTime, queryString, requestBody, null); | |
| 60 | 61 | } catch (Exception ex) { |
| 61 | 62 | // 异常执行,记录日志 |
| 62 | - createApiAccessLog(request, beginTim, queryString, requestBody, ex); | |
| 63 | + createApiAccessLog(request, beginTime, queryString, requestBody, ex); | |
| 63 | 64 | throw ex; |
| 64 | 65 | } |
| 65 | 66 | } |
| 66 | 67 | |
| 67 | - private void createApiAccessLog(HttpServletRequest request, Date beginTime, | |
| 68 | + private void createApiAccessLog(HttpServletRequest request, LocalDateTime beginTime, | |
| 68 | 69 | Map<String, String> queryString, String requestBody, Exception ex) { |
| 69 | 70 | ApiAccessLog accessLog = new ApiAccessLog(); |
| 70 | 71 | try { |
| ... | ... | @@ -75,7 +76,7 @@ public class ApiAccessLogFilter extends ApiRequestFilter { |
| 75 | 76 | } |
| 76 | 77 | } |
| 77 | 78 | |
| 78 | - private void buildApiAccessLogDTO(ApiAccessLog accessLog, HttpServletRequest request, Date beginTime, | |
| 79 | + private void buildApiAccessLogDTO(ApiAccessLog accessLog, HttpServletRequest request, LocalDateTime beginTime, | |
| 79 | 80 | Map<String, String> queryString, String requestBody, Exception ex) { |
| 80 | 81 | // 处理用户信息 |
| 81 | 82 | accessLog.setUserId(WebFrameworkUtils.getLoginUserId(request)); |
| ... | ... | @@ -103,8 +104,8 @@ public class ApiAccessLogFilter extends ApiRequestFilter { |
| 103 | 104 | accessLog.setUserIp(ServletUtil.getClientIP(request)); |
| 104 | 105 | // 持续时间 |
| 105 | 106 | accessLog.setBeginTime(beginTime); |
| 106 | - accessLog.setEndTime(new Date()); | |
| 107 | - accessLog.setDuration((int) DateUtils.diff(accessLog.getEndTime(), accessLog.getBeginTime())); | |
| 107 | + accessLog.setEndTime(LocalDateTime.now()); | |
| 108 | + accessLog.setDuration((int) LocalDateTimeUtil.between(accessLog.getBeginTime(), accessLog.getEndTime(), ChronoUnit.SECONDS)); | |
| 108 | 109 | } |
| 109 | 110 | |
| 110 | 111 | } | ... | ... |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiAccessLog.java
| ... | ... | @@ -3,7 +3,7 @@ package cn.iocoder.yudao.framework.apilog.core.service; |
| 3 | 3 | import lombok.Data; |
| 4 | 4 | |
| 5 | 5 | import javax.validation.constraints.NotNull; |
| 6 | -import java.util.Date; | |
| 6 | +import java.time.LocalDateTime; | |
| 7 | 7 | |
| 8 | 8 | /** |
| 9 | 9 | * API 访问日志 |
| ... | ... | @@ -61,12 +61,12 @@ public class ApiAccessLog { |
| 61 | 61 | * 开始请求时间 |
| 62 | 62 | */ |
| 63 | 63 | @NotNull(message = "开始请求时间不能为空") |
| 64 | - private Date beginTime; | |
| 64 | + private LocalDateTime beginTime; | |
| 65 | 65 | /** |
| 66 | 66 | * 结束请求时间 |
| 67 | 67 | */ |
| 68 | 68 | @NotNull(message = "结束请求时间不能为空") |
| 69 | - private Date endTime; | |
| 69 | + private LocalDateTime endTime; | |
| 70 | 70 | /** |
| 71 | 71 | * 执行时长,单位:毫秒 |
| 72 | 72 | */ | ... | ... |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiErrorLog.java
| ... | ... | @@ -3,7 +3,7 @@ package cn.iocoder.yudao.framework.apilog.core.service; |
| 3 | 3 | import lombok.Data; |
| 4 | 4 | |
| 5 | 5 | import javax.validation.constraints.NotNull; |
| 6 | -import java.util.Date; | |
| 6 | +import java.time.LocalDateTime; | |
| 7 | 7 | |
| 8 | 8 | /** |
| 9 | 9 | * API 错误日志 |
| ... | ... | @@ -61,7 +61,7 @@ public class ApiErrorLog { |
| 61 | 61 | * 异常时间 |
| 62 | 62 | */ |
| 63 | 63 | @NotNull(message = "异常时间不能为空") |
| 64 | - private Date exceptionTime; | |
| 64 | + private LocalDateTime exceptionTime; | |
| 65 | 65 | /** |
| 66 | 66 | * 异常名 |
| 67 | 67 | */ | ... | ... |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/jackson/config/YudaoJacksonAutoConfiguration.java
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/YudaoSwaggerAutoConfiguration.java
| ... | ... | @@ -29,7 +29,7 @@ import static springfox.documentation.builders.RequestHandlerSelectors.basePacka |
| 29 | 29 | * |
| 30 | 30 | * @author 芋道源码 |
| 31 | 31 | */ |
| 32 | -@Configuration | |
| 32 | +@Configuration(proxyBeanMethods = false) | |
| 33 | 33 | @EnableSwagger2 |
| 34 | 34 | @EnableKnife4j |
| 35 | 35 | @ConditionalOnClass({Docket.class, ApiInfoBuilder.class}) | ... | ... |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/config/YudaoWebAutoConfiguration.java
| ... | ... | @@ -26,7 +26,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
| 26 | 26 | import javax.annotation.Resource; |
| 27 | 27 | import javax.servlet.Filter; |
| 28 | 28 | |
| 29 | -@Configuration | |
| 29 | +@Configuration(proxyBeanMethods = false) | |
| 30 | 30 | @EnableConfigurationProperties({WebProperties.class, XssProperties.class}) |
| 31 | 31 | public class YudaoWebAutoConfiguration implements WebMvcConfigurer { |
| 32 | 32 | ... | ... |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java
| ... | ... | @@ -31,7 +31,7 @@ import javax.servlet.http.HttpServletRequest; |
| 31 | 31 | import javax.validation.ConstraintViolation; |
| 32 | 32 | import javax.validation.ConstraintViolationException; |
| 33 | 33 | import javax.validation.ValidationException; |
| 34 | -import java.util.Date; | |
| 34 | +import java.time.LocalDateTime; | |
| 35 | 35 | import java.util.Map; |
| 36 | 36 | |
| 37 | 37 | import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.*; |
| ... | ... | @@ -78,7 +78,7 @@ public class GlobalExceptionHandler { |
| 78 | 78 | return validationException((ValidationException) ex); |
| 79 | 79 | } |
| 80 | 80 | if (ex instanceof NoHandlerFoundException) { |
| 81 | - return noHandlerFoundExceptionHandler((NoHandlerFoundException) ex); | |
| 81 | + return noHandlerFoundExceptionHandler(request, (NoHandlerFoundException) ex); | |
| 82 | 82 | } |
| 83 | 83 | if (ex instanceof HttpRequestMethodNotSupportedException) { |
| 84 | 84 | return httpRequestMethodNotSupportedExceptionHandler((HttpRequestMethodNotSupportedException) ex); |
| ... | ... | @@ -167,7 +167,13 @@ public class GlobalExceptionHandler { |
| 167 | 167 | * 2. spring.mvc.static-path-pattern 为 /statics/** |
| 168 | 168 | */ |
| 169 | 169 | @ExceptionHandler(NoHandlerFoundException.class) |
| 170 | - public CommonResult<?> noHandlerFoundExceptionHandler(NoHandlerFoundException ex) { | |
| 170 | + public CommonResult<?> noHandlerFoundExceptionHandler(HttpServletRequest req, NoHandlerFoundException ex) { | |
| 171 | + // 情况一:部分功能未开启 | |
| 172 | + if (req.getRequestURI().contains("/bpm/")) { | |
| 173 | + return CommonResult.error(NOT_IMPLEMENTED.getCode(), "[工作流模块 yudao-module-bpm - 已禁用][参考 https://doc.iocoder.cn/bpm/ 开启]"); | |
| 174 | + } | |
| 175 | + | |
| 176 | + // 情况二:正常情况下的 404 | |
| 171 | 177 | log.warn("[noHandlerFoundExceptionHandler]", ex); |
| 172 | 178 | return CommonResult.error(NOT_FOUND.getCode(), String.format("请求地址不存在:%s", ex.getRequestURL())); |
| 173 | 179 | } |
| ... | ... | @@ -267,7 +273,7 @@ public class GlobalExceptionHandler { |
| 267 | 273 | errorLog.setRequestMethod(request.getMethod()); |
| 268 | 274 | errorLog.setUserAgent(ServletUtils.getUserAgent(request)); |
| 269 | 275 | errorLog.setUserIp(ServletUtil.getClientIP(request)); |
| 270 | - errorLog.setExceptionTime(new Date()); | |
| 276 | + errorLog.setExceptionTime(LocalDateTime.now()); | |
| 271 | 277 | } |
| 272 | 278 | |
| 273 | 279 | } | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/form/BpmFormRespVO.java
| ... | ... | @@ -7,7 +7,7 @@ import lombok.EqualsAndHashCode; |
| 7 | 7 | import lombok.ToString; |
| 8 | 8 | |
| 9 | 9 | import javax.validation.constraints.NotNull; |
| 10 | -import java.util.Date; | |
| 10 | +import java.time.LocalDateTime; | |
| 11 | 11 | import java.util.List; |
| 12 | 12 | |
| 13 | 13 | @ApiModel("管理后台 - 动态表单 Response VO") |
| ... | ... | @@ -28,6 +28,6 @@ public class BpmFormRespVO extends BpmFormBaseVO { |
| 28 | 28 | private List<String> fields; |
| 29 | 29 | |
| 30 | 30 | @ApiModelProperty(value = "创建时间", required = true) |
| 31 | - private Date createTime; | |
| 31 | + private LocalDateTime createTime; | |
| 32 | 32 | |
| 33 | 33 | } | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/group/BpmUserGroupPageReqVO.java
| ... | ... | @@ -9,7 +9,7 @@ import lombok.EqualsAndHashCode; |
| 9 | 9 | import lombok.ToString; |
| 10 | 10 | import org.springframework.format.annotation.DateTimeFormat; |
| 11 | 11 | |
| 12 | -import java.util.Date; | |
| 12 | +import java.time.LocalDateTime; | |
| 13 | 13 | |
| 14 | 14 | @ApiModel("管理后台 - 用户组分页 Request VO") |
| 15 | 15 | @Data |
| ... | ... | @@ -25,6 +25,6 @@ public class BpmUserGroupPageReqVO extends PageParam { |
| 25 | 25 | |
| 26 | 26 | @DateTimeFormat(pattern = DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 27 | 27 | @ApiModelProperty(value = "创建时间") |
| 28 | - private Date[] createTime; | |
| 28 | + private LocalDateTime[] createTime; | |
| 29 | 29 | |
| 30 | 30 | } | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/group/BpmUserGroupRespVO.java
| 1 | 1 | package cn.iocoder.yudao.module.bpm.controller.admin.definition.vo.group; |
| 2 | 2 | |
| 3 | 3 | import lombok.*; |
| 4 | -import java.util.*; | |
| 4 | + | |
| 5 | +import java.time.LocalDateTime; | |
| 6 | + | |
| 5 | 7 | import io.swagger.annotations.*; |
| 6 | 8 | |
| 7 | 9 | @ApiModel("管理后台 - 用户组 Response VO") |
| ... | ... | @@ -14,6 +16,6 @@ public class BpmUserGroupRespVO extends BpmUserGroupBaseVO { |
| 14 | 16 | private Long id; |
| 15 | 17 | |
| 16 | 18 | @ApiModelProperty(value = "创建时间", required = true) |
| 17 | - private Date createTime; | |
| 19 | + private LocalDateTime createTime; | |
| 18 | 20 | |
| 19 | 21 | } | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelPageItemRespVO.java
| ... | ... | @@ -6,7 +6,7 @@ import lombok.Data; |
| 6 | 6 | import lombok.EqualsAndHashCode; |
| 7 | 7 | import lombok.ToString; |
| 8 | 8 | |
| 9 | -import java.util.Date; | |
| 9 | +import java.time.LocalDateTime; | |
| 10 | 10 | |
| 11 | 11 | @ApiModel("管理后台 - 流程模型的分页的每一项 Response VO") |
| 12 | 12 | @Data |
| ... | ... | @@ -21,7 +21,7 @@ public class BpmModelPageItemRespVO extends BpmModelBaseVO { |
| 21 | 21 | private String formName; |
| 22 | 22 | |
| 23 | 23 | @ApiModelProperty(value = "创建时间", required = true) |
| 24 | - private Date createTime; | |
| 24 | + private LocalDateTime createTime; | |
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * 最新部署的流程定义 |
| ... | ... | @@ -39,7 +39,7 @@ public class BpmModelPageItemRespVO extends BpmModelBaseVO { |
| 39 | 39 | private Integer version; |
| 40 | 40 | |
| 41 | 41 | @ApiModelProperty(value = "部署时间", required = true) |
| 42 | - private Date deploymentTime; | |
| 42 | + private LocalDateTime deploymentTime; | |
| 43 | 43 | |
| 44 | 44 | @ApiModelProperty(value = "中断状态", required = true, example = "1", notes = "参见 SuspensionState 枚举") |
| 45 | 45 | private Integer suspensionState; | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/model/BpmModelRespVO.java
| ... | ... | @@ -6,7 +6,7 @@ import lombok.Data; |
| 6 | 6 | import lombok.EqualsAndHashCode; |
| 7 | 7 | import lombok.ToString; |
| 8 | 8 | |
| 9 | -import java.util.Date; | |
| 9 | +import java.time.LocalDateTime; | |
| 10 | 10 | |
| 11 | 11 | @ApiModel("管理后台 - 流程模型的创建 Request VO") |
| 12 | 12 | @Data |
| ... | ... | @@ -21,6 +21,6 @@ public class BpmModelRespVO extends BpmModelBaseVO { |
| 21 | 21 | private String bpmnXml; |
| 22 | 22 | |
| 23 | 23 | @ApiModelProperty(value = "创建时间", required = true) |
| 24 | - private Date createTime; | |
| 24 | + private LocalDateTime createTime; | |
| 25 | 25 | |
| 26 | 26 | } | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/vo/process/BpmProcessDefinitionPageItemRespVO.java
| ... | ... | @@ -6,7 +6,7 @@ import lombok.Data; |
| 6 | 6 | import lombok.EqualsAndHashCode; |
| 7 | 7 | import lombok.ToString; |
| 8 | 8 | |
| 9 | -import java.util.Date; | |
| 9 | +import java.time.LocalDateTime; | |
| 10 | 10 | |
| 11 | 11 | @ApiModel("管理后台 - 流程定义的分页的每一项 Response VO") |
| 12 | 12 | @Data |
| ... | ... | @@ -18,6 +18,6 @@ public class BpmProcessDefinitionPageItemRespVO extends BpmProcessDefinitionResp |
| 18 | 18 | private String formName; |
| 19 | 19 | |
| 20 | 20 | @ApiModelProperty(value = "部署时间", required = true) |
| 21 | - private Date deploymentTime; | |
| 21 | + private LocalDateTime deploymentTime; | |
| 22 | 22 | |
| 23 | 23 | } | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveBaseVO.java
| 1 | 1 | package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo; |
| 2 | 2 | |
| 3 | 3 | import lombok.*; |
| 4 | -import java.util.*; | |
| 4 | +import java.time.LocalDateTime; | |
| 5 | 5 | import io.swagger.annotations.*; |
| 6 | 6 | import javax.validation.constraints.*; |
| 7 | 7 | import org.springframework.format.annotation.DateTimeFormat; |
| ... | ... | @@ -18,11 +18,11 @@ public class BpmOALeaveBaseVO { |
| 18 | 18 | @ApiModelProperty(value = "请假的开始时间", required = true) |
| 19 | 19 | @NotNull(message = "开始时间不能为空") |
| 20 | 20 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 21 | - private Date startTime; | |
| 21 | + private LocalDateTime startTime; | |
| 22 | 22 | @ApiModelProperty(value = "请假的结束时间", required = true) |
| 23 | 23 | @NotNull(message = "结束时间不能为空") |
| 24 | 24 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 25 | - private Date endTime; | |
| 25 | + private LocalDateTime endTime; | |
| 26 | 26 | |
| 27 | 27 | @ApiModelProperty(value = "请假类型", required = true, example = "1", notes = "参见 bpm_oa_type 枚举") |
| 28 | 28 | private Integer type; | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveCreateReqVO.java
| ... | ... | @@ -15,7 +15,7 @@ public class BpmOALeaveCreateReqVO extends BpmOALeaveBaseVO { |
| 15 | 15 | |
| 16 | 16 | @AssertTrue(message = "结束时间,需要在开始时间之后") |
| 17 | 17 | public boolean isEndTimeValid() { |
| 18 | - return !getEndTime().before(getStartTime()); | |
| 18 | + return !getEndTime().isBefore(getStartTime()); | |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | 21 | } | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeavePageReqVO.java
| 1 | 1 | package cn.iocoder.yudao.module.bpm.controller.admin.oa.vo; |
| 2 | 2 | |
| 3 | 3 | import lombok.*; |
| 4 | -import java.util.*; | |
| 4 | +import java.time.LocalDateTime; | |
| 5 | 5 | import io.swagger.annotations.*; |
| 6 | 6 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 7 | 7 | import org.springframework.format.annotation.DateTimeFormat; |
| ... | ... | @@ -25,6 +25,6 @@ public class BpmOALeavePageReqVO extends PageParam { |
| 25 | 25 | |
| 26 | 26 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 27 | 27 | @ApiModelProperty(value = "申请时间") |
| 28 | - private Date[] createTime; | |
| 28 | + private LocalDateTime[] createTime; | |
| 29 | 29 | |
| 30 | 30 | } | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/oa/vo/BpmOALeaveRespVO.java
| ... | ... | @@ -5,7 +5,7 @@ import io.swagger.annotations.*; |
| 5 | 5 | import org.springframework.format.annotation.DateTimeFormat; |
| 6 | 6 | |
| 7 | 7 | import javax.validation.constraints.NotNull; |
| 8 | -import java.util.Date; | |
| 8 | +import java.time.LocalDateTime; | |
| 9 | 9 | |
| 10 | 10 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 11 | 11 | |
| ... | ... | @@ -24,7 +24,7 @@ public class BpmOALeaveRespVO extends BpmOALeaveBaseVO { |
| 24 | 24 | @ApiModelProperty(value = "申请时间", required = true) |
| 25 | 25 | @NotNull(message = "申请时间不能为空") |
| 26 | 26 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 27 | - private Date createTime; | |
| 27 | + private LocalDateTime createTime; | |
| 28 | 28 | |
| 29 | 29 | @ApiModelProperty(value = "流程id") |
| 30 | 30 | private String processInstanceId; | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/activity/BpmActivityRespVO.java
| ... | ... | @@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModel; |
| 4 | 4 | import io.swagger.annotations.ApiModelProperty; |
| 5 | 5 | import lombok.Data; |
| 6 | 6 | |
| 7 | -import java.util.Date; | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | 8 | |
| 9 | 9 | @ApiModel("管理后台 - 流程活动的 Response VO") |
| 10 | 10 | @Data |
| ... | ... | @@ -16,9 +16,9 @@ public class BpmActivityRespVO { |
| 16 | 16 | private String type; |
| 17 | 17 | |
| 18 | 18 | @ApiModelProperty(value = "流程活动的开始时间", required = true) |
| 19 | - private Date startTime; | |
| 19 | + private LocalDateTime startTime; | |
| 20 | 20 | @ApiModelProperty(value = "流程活动的结束时间", required = true) |
| 21 | - private Date endTime; | |
| 21 | + private LocalDateTime endTime; | |
| 22 | 22 | |
| 23 | 23 | @ApiModelProperty(value = "关联的流程任务的编号", example = "2048", notes = "关联的流程任务,只有 UserTask 等类型才有") |
| 24 | 24 | private String taskId; | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstanceMyPageReqVO.java
| ... | ... | @@ -8,7 +8,7 @@ import lombok.EqualsAndHashCode; |
| 8 | 8 | import lombok.ToString; |
| 9 | 9 | import org.springframework.format.annotation.DateTimeFormat; |
| 10 | 10 | |
| 11 | -import java.util.Date; | |
| 11 | +import java.time.LocalDateTime; | |
| 12 | 12 | |
| 13 | 13 | import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
| 14 | 14 | |
| ... | ... | @@ -35,6 +35,6 @@ public class BpmProcessInstanceMyPageReqVO extends PageParam { |
| 35 | 35 | |
| 36 | 36 | @ApiModelProperty(value = "创建时间") |
| 37 | 37 | @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
| 38 | - private Date[] createTime; | |
| 38 | + private LocalDateTime[] createTime; | |
| 39 | 39 | |
| 40 | 40 | } | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstancePageItemRespVO.java
| ... | ... | @@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModel; |
| 4 | 4 | import io.swagger.annotations.ApiModelProperty; |
| 5 | 5 | import lombok.Data; |
| 6 | 6 | |
| 7 | -import java.util.Date; | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | 8 | import java.util.List; |
| 9 | 9 | |
| 10 | 10 | @ApiModel("管理后台 - 流程实例的分页 Item Response VO") |
| ... | ... | @@ -30,10 +30,10 @@ public class BpmProcessInstancePageItemRespVO { |
| 30 | 30 | private Integer result; |
| 31 | 31 | |
| 32 | 32 | @ApiModelProperty(value = "提交时间", required = true) |
| 33 | - private Date createTime; | |
| 33 | + private LocalDateTime createTime; | |
| 34 | 34 | |
| 35 | 35 | @ApiModelProperty(value = "结束时间", required = true) |
| 36 | - private Date endTime; | |
| 36 | + private LocalDateTime endTime; | |
| 37 | 37 | |
| 38 | 38 | /** |
| 39 | 39 | * 当前任务 | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/task/vo/instance/BpmProcessInstanceRespVO.java
| ... | ... | @@ -4,7 +4,7 @@ import io.swagger.annotations.ApiModel; |
| 4 | 4 | import io.swagger.annotations.ApiModelProperty; |
| 5 | 5 | import lombok.Data; |
| 6 | 6 | |
| 7 | -import java.util.Date; | |
| 7 | +import java.time.LocalDateTime; | |
| 8 | 8 | import java.util.List; |
| 9 | 9 | import java.util.Map; |
| 10 | 10 | |
| ... | ... | @@ -28,10 +28,10 @@ public class BpmProcessInstanceRespVO { |
| 28 | 28 | private Integer result; |
| 29 | 29 | |
| 30 | 30 | @ApiModelProperty(value = "提交时间", required = true) |
| 31 | - private Date createTime; | |
| 31 | + private LocalDateTime createTime; | |
| 32 | 32 | |
| 33 | 33 | @ApiModelProperty(value = "结束时间", required = true) |
| 34 | - private Date endTime; | |
| 34 | + private LocalDateTime endTime; | |
| 35 | 35 | |
| 36 | 36 | @ApiModelProperty(value = "提交的表单值", required = true) |
| 37 | 37 | private Map<String, Object> formVariables; | ... | ... |