From 29910029cee1c19509d26b79f861fb953f78fefc Mon Sep 17 00:00:00 2001 From: 13693261870 <252740454@qq.com> Date: 星期五, 16 八月 2024 17:34:27 +0800 Subject: [PATCH] 1 --- se-common/se-common-redis/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports | 2 se-common/se-common-log/src/main/java/com/se/common/log/service/AsyncLogService.java | 29 se-modules/se-gen/src/main/resources/logback.xml | 0 se-modules/se-system/src/main/resources/mapper/system/SysUserMapper.xml | 0 se-modules/se-system/src/main/java/com/se/system/mapper/SysRoleMapper.java | 0 se-common/se-common-log/pom.xml | 4 se-modules/se-system/src/main/resources/mapper/system/SysUserRoleMapper.xml | 0 se-modules/se-gen/src/main/java/com/se/gen/util/VelocityInitializer.java | 0 se-modules/se-system/src/main/java/com/se/system/mapper/SysDeptMapper.java | 0 se-modules/se-job/pom.xml | 4 se-modules/se-system/src/main/java/com/se/system/service/ISysConfigService.java | 0 se-common/se-common-core/src/main/java/com/se/common/core/utils/sql/SqlUtil.java | 70 se-common/se-common-log/src/main/java/com/se/common/log/enums/BusinessStatus.java | 20 se-common/se-common-log/src/main/java/com/se/common/log/aspect/LogAspect.java | 250 +++ se-common/se-common-core/pom.xml | 4 se-modules/se-gen/src/main/java/com/se/gen/config/GenConfig.java | 0 se-common/se-common-core/src/main/java/com/se/common/core/text/CharsetKit.java | 86 + se-common/se-common-core/src/main/java/com/se/common/core/exception/base/BaseException.java | 79 se-modules/se-system/src/main/java/com/se/system/mapper/SysUserMapper.java | 0 se-modules/se-system/src/main/java/com/se/system/service/ISysMenuService.java | 0 se-common/se-common-log/src/main/java/com/se/common/log/enums/BusinessType.java | 59 se-modules/se-gen/src/main/java/com/se/gen/mapper/GenTableMapper.java | 0 se-modules/se-gen/src/main/resources/banner.txt | 0 se-common/se-common-swagger/src/main/java/com/se/common/swagger/annotation/EnableCustomSwagger2.java | 20 se-modules/se-system/src/main/java/com/se/system/domain/SysUserRole.java | 0 se-modules/se-system/src/main/java/com/se/system/mapper/SysUserPostMapper.java | 0 se-modules/se-gen/src/main/resources/mapper/generator/GenTableColumnMapper.xml | 0 se-modules/se-system/src/main/java/com/se/system/service/ISysLogininforService.java | 0 se-modules/se-job/src/main/resources/bootstrap.yml | 0 se-modules/se-system/src/main/java/com/se/system/service/impl/SysDictTypeServiceImpl.java | 0 se-modules/se-system/src/main/resources/mapper/system/SysDictDataMapper.xml | 0 se-modules/se-system/src/main/java/com/se/system/service/ISysPermissionService.java | 0 se-modules/se-job/src/main/java/com/se/job/util/JobInvokeUtil.java | 0 se-modules/se-system/src/main/java/com/se/system/service/ISysPostService.java | 0 se-modules/se-system/src/main/resources/mapper/system/SysNoticeMapper.xml | 0 se-modules/se-system/src/main/java/com/se/system/service/ISysUserService.java | 0 se-modules/se-system/src/main/resources/mapper/system/SysRoleMapper.xml | 0 pom.xml | 15 se-common/se-common-core/src/main/java/com/se/common/core/constant/TokenConstants.java | 25 se-common/se-common-redis/pom.xml | 4 se-modules/se-file/src/main/java/com/se/file/SeFileApplication.java | 0 se-modules/se-gen/src/main/resources/vm/vue/index-tree.vue.vm | 0 se-modules/se-job/src/main/java/com/se/job/domain/SysJob.java | 0 se-modules/se-job/src/main/java/com/se/job/service/SysJobServiceImpl.java | 0 se-modules/se-job/src/main/java/com/se/job/service/SysJobLogServiceImpl.java | 0 se-modules/se-system/src/main/java/com/se/system/service/impl/SysMenuServiceImpl.java | 0 se-modules/se-gen/src/main/java/com/se/gen/util/GenUtils.java | 0 se-modules/se-file/src/main/java/com/se/file/service/LocalSysFileServiceImpl.java | 0 se-common/se-common-swagger/pom.xml | 4 se-modules/se-system/src/main/java/com/se/system/domain/SysPost.java | 0 se-modules/se-system/src/main/java/com/se/system/controller/SysLogininforController.java | 0 se-modules/se-system/src/main/resources/mapper/system/SysConfigMapper.xml | 0 se-modules/se-system/src/main/resources/mapper/system/SysPostMapper.xml | 0 se-modules/se-system/src/main/java/com/se/system/service/ISysDictDataService.java | 0 se-modules/se-system/src/main/java/com/se/system/mapper/SysRoleMenuMapper.java | 0 se-common/se-common-core/src/main/java/com/se/common/core/exception/job/TaskException.java | 34 se-common/se-common-sensitive/pom.xml | 4 se-modules/se-gen/src/main/resources/vm/vue/v3/index-tree.vue.vm | 0 se-modules/se-system/src/main/java/com/se/system/domain/vo/RouterVo.java | 0 se-modules/se-job/src/main/java/com/se/job/task/RyTask.java | 0 se-common/se-common-security/pom.xml | 4 se-modules/se-system/src/main/java/com/se/system/controller/SysUserOnlineController.java | 0 se-modules/se-gen/src/main/java/com/se/gen/service/GenTableServiceImpl.java | 0 se-common/se-common-core/src/main/java/com/se/common/core/utils/poi/ExcelUtil.java | 1538 ++++++++++++++++++ se-modules/se-gen/src/main/java/com/se/gen/domain/GenTableColumn.java | 0 se-modules/se-file/src/main/java/com/se/file/service/ISysFileService.java | 0 se-common/se-common-datascope/pom.xml | 4 se-common/se-common-security/src/main/java/com/se/common/security/annotation/InnerAuth.java | 19 se-modules/se-gen/src/main/java/com/se/gen/service/IGenTableService.java | 0 se-modules/pom.xml | 12 se-common/se-common-core/src/main/java/com/se/common/core/constant/GenConstants.java | 117 + se-common/se-common-security/src/main/java/com/se/common/security/aspect/InnerAuthAspect.java | 51 se-common/se-common-datascope/src/main/java/com/se/common/datascope/aspect/DataScopeAspect.java | 185 ++ se-common/se-common-log/src/main/java/com/se/common/log/annotation/Log.java | 51 se-modules/se-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml | 0 se-common/se-common-sensitive/src/main/java/com/se/common/sensitive/utils/DesensitizedUtil.java | 51 se-modules/se-file/src/main/java/com/se/file/service/FastDfsSysFileServiceImpl.java | 0 se-modules/se-gen/src/main/java/com/se/gen/SeGenApplication.java | 0 se-modules/se-system/pom.xml | 4 se-modules/se-file/src/main/java/com/se/file/controller/SysFileController.java | 0 se-modules/se-file/src/main/resources/logback.xml | 0 se-modules/se-system/src/main/java/com/se/system/controller/SysDeptController.java | 0 se-modules/se-system/src/main/java/com/se/system/controller/SysRoleController.java | 0 se-modules/se-system/src/main/resources/logback.xml | 0 se-common/se-common-core/src/main/java/com/se/common/core/xss/XssValidator.java | 39 se-common/se-common-swagger/src/main/java/com/se/common/swagger/config/SwaggerBeanPostProcessor.java | 52 se-common/se-common-core/src/main/java/com/se/common/core/constant/CacheConstants.java | 59 se-common/se-common-core/src/main/java/com/se/common/core/exception/user/UserException.java | 18 se-modules/se-system/src/main/java/com/se/system/service/impl/SysRoleServiceImpl.java | 0 se-common/se-common-core/src/main/java/com/se/common/core/exception/UtilException.java | 26 se-modules/se-system/src/main/java/com/se/system/controller/SysOperlogController.java | 0 se-modules/se-system/src/main/resources/mapper/system/SysMenuMapper.xml | 0 se-modules/se-gen/src/main/resources/vm/java/mapper.java.vm | 0 se-visual/se-monitor/src/main/java/com/se/modules/monitor/SeMonitorApplication.java | 11 se-common/se-common-core/src/main/java/com/se/common/core/utils/bean/BeanValidators.java | 24 se-common/se-common-core/src/main/java/com/se/common/core/exception/PreAuthorizeException.java | 15 se-modules/se-system/src/main/java/com/se/system/service/ISysRoleService.java | 0 se-modules/se-system/src/main/java/com/se/system/domain/SysConfig.java | 0 se-modules/se-system/src/main/resources/mapper/system/SysUserPostMapper.xml | 0 se-modules/se-job/src/main/java/com/se/job/service/ISysJobLogService.java | 0 se-common/se-common-sensitive/src/main/java/com/se/common/sensitive/config/SensitiveJsonSerializer.java | 67 se-visual/se-monitor/pom.xml | 4 se-modules/se-file/src/main/java/com/se/file/config/ResourcesConfig.java | 0 se-modules/se-gen/src/main/resources/vm/java/serviceImpl.java.vm | 0 se-modules/se-system/src/main/resources/mapper/system/SysLogininforMapper.xml | 0 se-modules/se-gen/src/main/java/com/se/gen/controller/GenController.java | 0 se-modules/se-system/src/main/java/com/se/system/mapper/SysPostMapper.java | 0 se-modules/se-system/src/main/java/com/se/system/service/impl/SysConfigServiceImpl.java | 0 se-modules/se-system/src/main/java/com/se/system/service/impl/SysOperLogServiceImpl.java | 0 se-modules/se-system/src/main/java/com/se/system/controller/SysNoticeController.java | 0 se-modules/se-system/src/main/resources/bootstrap.yml | 0 se-modules/se-system/src/main/java/com/se/system/controller/SysDictDataController.java | 0 se-common/se-common-core/src/main/java/com/se/common/core/context/SecurityContextHolder.java | 98 + se-common/se-common-core/src/main/java/com/se/common/core/constant/ScheduleConstants.java | 50 se-common/pom.xml | 22 se-common/se-common-security/src/main/java/com/se/common/security/utils/DictUtils.java | 75 se-modules/se-job/src/main/java/com/se/job/util/ScheduleUtils.java | 0 se-modules/se-file/pom.xml | 4 se-modules/se-job/src/main/java/com/se/job/util/QuartzJobExecution.java | 0 se-modules/se-gen/src/main/resources/vm/sql/sql.vm | 0 se-modules/se-system/src/main/java/com/se/system/service/impl/SysPermissionServiceImpl.java | 0 se-common/se-common-core/src/main/java/com/se/common/core/exception/user/UserPasswordNotMatchException.java | 16 se-modules/se-system/src/main/java/com/se/system/service/ISysDictTypeService.java | 0 se-common/se-common-core/src/main/java/com/se/common/core/utils/JwtUtils.java | 123 + se-modules/se-system/src/main/java/com/se/system/service/ISysOperLogService.java | 0 se-modules/se-gen/src/main/java/com/se/gen/service/GenTableColumnServiceImpl.java | 0 se-modules/se-file/src/main/resources/banner.txt | 0 se-modules/se-job/src/main/java/com/se/job/config/ScheduleConfig.java | 0 se-modules/se-system/src/main/java/com/se/system/service/impl/SysUserOnlineServiceImpl.java | 0 se-modules/se-system/src/main/java/com/se/system/mapper/SysDictTypeMapper.java | 0 se-common/se-common-log/src/main/java/com/se/common/log/enums/OperatorType.java | 24 se-modules/se-job/src/main/java/com/se/job/util/CronUtils.java | 0 se-common/se-common-core/src/main/java/com/se/common/core/xss/Xss.java | 27 se-modules/se-system/src/main/java/com/se/system/mapper/SysOperLogMapper.java | 0 se-modules/se-job/src/main/java/com/se/job/mapper/SysJobLogMapper.java | 0 se-modules/se-file/src/main/java/com/se/file/service/MinioSysFileServiceImpl.java | 0 se-modules/se-gen/src/main/resources/vm/vue/index.vue.vm | 0 se-modules/se-system/src/main/java/com/se/system/domain/SysMenu.java | 0 se-modules/se-gen/src/main/java/com/se/gen/util/VelocityUtils.java | 0 se-modules/se-system/src/main/java/com/se/system/domain/vo/TreeSelect.java | 0 se-modules/se-system/src/main/java/com/se/system/service/ISysDeptService.java | 0 se-common/se-common-core/src/main/java/com/se/common/core/utils/file/MimeTypeUtils.java | 59 se-modules/se-system/src/main/java/com/se/system/controller/SysMenuController.java | 0 se-modules/se-system/src/main/java/com/se/system/domain/SysUserPost.java | 0 se-modules/se-system/src/main/java/com/se/system/service/impl/SysUserServiceImpl.java | 0 se-modules/se-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml | 0 se-common/se-common-sensitive/src/main/java/com/se/common/sensitive/enums/DesensitizedType.java | 59 se-modules/se-system/src/main/java/com/se/system/service/impl/SysDeptServiceImpl.java | 0 se-modules/se-job/src/main/java/com/se/job/controller/SysJobController.java | 0 se-common/se-common-datasource/pom.xml | 35 se-modules/se-gen/src/main/java/com/se/gen/mapper/GenTableColumnMapper.java | 0 se-gateway/pom.xml | 4 se-modules/se-job/src/main/resources/mapper/job/SysJobLogMapper.xml | 0 se-modules/se-system/src/main/java/com/se/system/RuoYiSystemApplication.java | 0 se-common/se-common-security/src/main/java/com/se/common/security/handler/GlobalExceptionHandler.java | 166 ++ se-auth/pom.xml | 4 se-modules/se-system/src/main/java/com/se/system/service/impl/SysDictDataServiceImpl.java | 0 se-modules/se-gen/src/main/resources/vm/vue/v3/index.vue.vm | 0 se-modules/se-system/src/main/java/com/se/system/mapper/SysRoleDeptMapper.java | 0 se-modules/se-system/src/main/java/com/se/system/controller/SysPostController.java | 0 se-modules/se-job/src/main/java/com/se/job/SeJobApplication.java | 0 se-modules/se-system/src/main/java/com/se/system/service/ISysUserOnlineService.java | 0 se-modules/se-system/src/main/java/com/se/system/controller/SysProfileController.java | 0 se-modules/se-gen/src/main/resources/vm/java/sub-domain.java.vm | 0 se-modules/se-job/src/main/java/com/se/job/service/ISysJobService.java | 0 se-modules/se-system/src/main/java/com/se/system/service/impl/SysPostServiceImpl.java | 0 se-modules/se-system/src/main/java/com/se/system/service/impl/SysNoticeServiceImpl.java | 0 se-modules/se-system/src/main/resources/banner.txt | 0 se-modules/se-gen/pom.xml | 4 se-modules/se-gen/src/main/resources/mapper/generator/GenTableMapper.xml | 0 se-modules/se-system/src/main/java/com/se/system/controller/SysDictTypeController.java | 0 se-modules/se-system/src/main/java/com/se/system/service/impl/SysLogininforServiceImpl.java | 0 se-common/se-common-core/src/main/java/com/se/common/core/utils/sign/Base64.java | 291 +++ se-modules/se-system/src/main/java/com/se/system/domain/vo/MetaVo.java | 0 se-common/se-common-core/src/main/java/com/se/common/core/exception/auth/NotLoginException.java | 16 se-common/se-common-datasource/src/main/java/com/se/common/datasource/annotation/Master.java | 22 se-modules/se-job/src/main/java/com/se/job/util/QuartzDisallowConcurrentExecution.java | 0 se-modules/se-system/src/main/java/com/se/system/domain/SysNotice.java | 0 se-api/pom.xml | 4 se-visual/pom.xml | 6 se-common/se-common-core/src/main/java/com/se/common/core/exception/InnerAuthException.java | 16 se-common/se-common-core/src/main/java/com/se/common/core/exception/file/FileUploadException.java | 61 se-modules/se-gen/src/main/resources/vm/xml/mapper.xml.vm | 0 se-modules/se-job/src/main/java/com/se/job/domain/SysJobLog.java | 0 se-modules/se-system/src/main/java/com/se/system/mapper/SysConfigMapper.java | 0 se-modules/se-system/src/main/java/com/se/system/domain/SysRoleDept.java | 0 se-modules/se-system/src/main/java/com/se/system/controller/SysUserController.java | 0 se-common/se-common-seata/pom.xml | 27 se-modules/se-gen/src/main/resources/vm/java/service.java.vm | 0 se-modules/se-system/src/main/java/com/se/system/controller/SysConfigController.java | 0 se-modules/se-job/src/main/resources/logback.xml | 0 se-common/se-common-core/src/main/java/com/se/common/core/exception/DemoModeException.java | 15 se-common/se-common-core/src/main/java/com/se/common/core/constant/HttpStatus.java | 94 + se-modules/se-gen/src/main/resources/bootstrap.yml | 0 se-modules/se-system/src/main/java/com/se/system/service/ISysNoticeService.java | 0 se-modules/se-system/src/main/java/com/se/system/mapper/SysNoticeMapper.java | 0 se-modules/se-job/src/main/java/com/se/job/util/AbstractQuartzJob.java | 0 se-modules/se-system/src/main/resources/mapper/system/SysOperLogMapper.xml | 0 se-modules/se-system/src/main/java/com/se/system/domain/SysRoleMenu.java | 0 se-modules/se-system/src/main/resources/mapper/system/SysDeptMapper.xml | 0 se-modules/se-gen/src/main/resources/vm/java/domain.java.vm | 0 se-modules/se-system/src/main/java/com/se/system/mapper/SysLogininforMapper.java | 0 se-modules/se-system/src/main/resources/mapper/system/SysDictTypeMapper.xml | 0 se-modules/se-job/src/main/resources/mapper/job/SysJobMapper.xml | 0 se-modules/se-system/src/main/java/com/se/system/mapper/SysDictDataMapper.java | 0 se-modules/se-gen/src/main/resources/vm/java/controller.java.vm | 0 se-modules/se-system/src/main/java/com/se/system/mapper/SysUserRoleMapper.java | 0 se-modules/se-job/src/main/resources/banner.txt | 0 se-modules/se-gen/src/main/java/com/se/gen/service/IGenTableColumnService.java | 0 se-modules/se-job/src/main/java/com/se/job/mapper/SysJobMapper.java | 0 se-modules/se-gen/src/main/resources/vm/js/api.js.vm | 0 se-modules/se-gen/src/main/java/com/se/gen/domain/GenTable.java | 0 se-modules/se-system/src/main/java/com/se/system/mapper/SysMenuMapper.java | 0 se-modules/se-file/src/main/java/com/se/file/utils/FileUploadUtils.java | 0 se-common/se-common-core/src/main/java/com/se/common/core/utils/reflect/ReflectUtils.java | 410 +++++ se-modules/se-file/src/main/resources/bootstrap.yml | 0 se-modules/se-file/src/main/java/com/se/file/config/MinioConfig.java | 0 se-modules/se-system/src/main/java/com/se/system/domain/SysUserOnline.java | 0 se-common/se-common-core/src/main/java/com/se/common/core/exception/file/FileException.java | 19 se-modules/se-job/src/main/java/com/se/job/controller/SysJobLogController.java | 0 220 files changed, 4,747 insertions(+), 68 deletions(-) diff --git a/pom.xml b/pom.xml index 1eac4d6..083c442 100644 --- a/pom.xml +++ b/pom.xml @@ -9,8 +9,7 @@ <version>3.6.4</version> <name>ruoyi</name> - <url>http://www.ruoyi.vip</url> - <description>鑻ヤ緷寰湇鍔$郴缁�</description> + <description>寰湇鍔$郴缁�</description> <properties> <ruoyi.version>3.6.4</ruoyi.version> @@ -227,12 +226,12 @@ </dependencyManagement> <modules> - <module>ruoyi-auth</module> - <module>ruoyi-gateway</module> - <module>ruoyi-visual</module> - <module>ruoyi-modules</module> - <module>ruoyi-api</module> - <module>ruoyi-common</module> + <module>se-auth</module> + <module>se-gateway</module> + <module>se-visual</module> + <module>se-modules</module> + <module>se-api</module> + <module>se-common</module> </modules> <packaging>pom</packaging> diff --git a/se-api/pom.xml b/se-api/pom.xml index 6846163..1cfce0c 100644 --- a/se-api/pom.xml +++ b/se-api/pom.xml @@ -9,10 +9,10 @@ <modelVersion>4.0.0</modelVersion> <modules> - <module>ruoyi-api-system</module> + <module>se-api-system</module> </modules> - <artifactId>ruoyi-api</artifactId> + <artifactId>se-api</artifactId> <packaging>pom</packaging> <description> diff --git a/se-auth/pom.xml b/se-auth/pom.xml index 068bb95..3424107 100644 --- a/se-auth/pom.xml +++ b/se-auth/pom.xml @@ -8,10 +8,10 @@ </parent> <modelVersion>4.0.0</modelVersion> - <artifactId>ruoyi-auth</artifactId> + <artifactId>se-auth</artifactId> <description> - ruoyi-auth璁よ瘉鎺堟潈涓績 + se-auth璁よ瘉鎺堟潈涓績 </description> <dependencies> diff --git a/se-common/pom.xml b/se-common/pom.xml index 034bd43..ad5f345 100644 --- a/se-common/pom.xml +++ b/se-common/pom.xml @@ -9,22 +9,22 @@ <modelVersion>4.0.0</modelVersion> <modules> - <module>ruoyi-common-log</module> - <module>ruoyi-common-core</module> - <module>ruoyi-common-redis</module> - <module>ruoyi-common-seata</module> - <module>ruoyi-common-swagger</module> - <module>ruoyi-common-security</module> - <module>ruoyi-common-sensitive</module> - <module>ruoyi-common-datascope</module> - <module>ruoyi-common-datasource</module> + <module>se-common-log</module> + <module>se-common-core</module> + <module>se-common-redis</module> + <module>se-common-seata</module> + <module>se-common-swagger</module> + <module>se-common-security</module> + <module>se-common-sensitive</module> + <module>se-common-datascope</module> + <module>se-common-datasource</module> </modules> - <artifactId>ruoyi-common</artifactId> + <artifactId>se-common</artifactId> <packaging>pom</packaging> <description> - ruoyi-common閫氱敤妯″潡 + se-common閫氱敤妯″潡 </description> </project> diff --git a/se-common/se-common-core/pom.xml b/se-common/se-common-core/pom.xml index b04ce3e..a93e4e3 100644 --- a/se-common/se-common-core/pom.xml +++ b/se-common/se-common-core/pom.xml @@ -9,10 +9,10 @@ </parent> <modelVersion>4.0.0</modelVersion> - <artifactId>ruoyi-common-core</artifactId> + <artifactId>se-common-core</artifactId> <description> - ruoyi-common-core鏍稿績妯″潡 + se-common-core鏍稿績妯″潡 </description> <dependencies> diff --git a/se-common/se-common-core/src/main/java/com/se/common/core/constant/CacheConstants.java b/se-common/se-common-core/src/main/java/com/se/common/core/constant/CacheConstants.java new file mode 100644 index 0000000..0ba0696 --- /dev/null +++ b/se-common/se-common-core/src/main/java/com/se/common/core/constant/CacheConstants.java @@ -0,0 +1,59 @@ +package com.se.common.core.constant; + +/** + * 缂撳瓨甯搁噺淇℃伅 + * + * @author admin + */ +public class CacheConstants +{ + /** + * 缂撳瓨鏈夋晥鏈燂紝榛樿720锛堝垎閽燂級 + */ + public final static long EXPIRATION = 720; + + /** + * 缂撳瓨鍒锋柊鏃堕棿锛岄粯璁�120锛堝垎閽燂級 + */ + public final static long REFRESH_TIME = 120; + + /** + * 瀵嗙爜鏈�澶ч敊璇鏁� + */ + public final static int PASSWORD_MAX_RETRY_COUNT = 5; + + /** + * 瀵嗙爜閿佸畾鏃堕棿锛岄粯璁�10锛堝垎閽燂級 + */ + public final static long PASSWORD_LOCK_TIME = 10; + + /** + * 鏉冮檺缂撳瓨鍓嶇紑 + */ + public final static String LOGIN_TOKEN_KEY = "login_tokens:"; + + /** + * 楠岃瘉鐮� redis key + */ + public static final String CAPTCHA_CODE_KEY = "captcha_codes:"; + + /** + * 鍙傛暟绠$悊 cache key + */ + public static final String SYS_CONFIG_KEY = "sys_config:"; + + /** + * 瀛楀吀绠$悊 cache key + */ + public static final String SYS_DICT_KEY = "sys_dict:"; + + /** + * 鐧诲綍璐︽埛瀵嗙爜閿欒娆℃暟 redis key + */ + public static final String PWD_ERR_CNT_KEY = "pwd_err_cnt:"; + + /** + * 鐧诲綍IP榛戝悕鍗� cache key + */ + public static final String SYS_LOGIN_BLACKIPLIST = SYS_CONFIG_KEY + "sys.login.blackIPList"; +} diff --git a/se-common/se-common-core/src/main/java/com/se/common/core/constant/GenConstants.java b/se-common/se-common-core/src/main/java/com/se/common/core/constant/GenConstants.java new file mode 100644 index 0000000..d6653ba --- /dev/null +++ b/se-common/se-common-core/src/main/java/com/se/common/core/constant/GenConstants.java @@ -0,0 +1,117 @@ +package com.se.common.core.constant; + +/** + * 浠g爜鐢熸垚閫氱敤甯搁噺 + * + * @author admin + */ +public class GenConstants +{ + /** 鍗曡〃锛堝鍒犳敼鏌ワ級 */ + public static final String TPL_CRUD = "crud"; + + /** 鏍戣〃锛堝鍒犳敼鏌ワ級 */ + public static final String TPL_TREE = "tree"; + + /** 涓诲瓙琛紙澧炲垹鏀规煡锛� */ + public static final String TPL_SUB = "sub"; + + /** 鏍戠紪鐮佸瓧娈� */ + public static final String TREE_CODE = "treeCode"; + + /** 鏍戠埗缂栫爜瀛楁 */ + public static final String TREE_PARENT_CODE = "treeParentCode"; + + /** 鏍戝悕绉板瓧娈� */ + public static final String TREE_NAME = "treeName"; + + /** 涓婄骇鑿滃崟ID瀛楁 */ + public static final String PARENT_MENU_ID = "parentMenuId"; + + /** 涓婄骇鑿滃崟鍚嶇О瀛楁 */ + public static final String PARENT_MENU_NAME = "parentMenuName"; + + /** 鏁版嵁搴撳瓧绗︿覆绫诲瀷 */ + public static final String[] COLUMNTYPE_STR = { "char", "varchar", "nvarchar", "varchar2" }; + + /** 鏁版嵁搴撴枃鏈被鍨� */ + public static final String[] COLUMNTYPE_TEXT = { "tinytext", "text", "mediumtext", "longtext" }; + + /** 鏁版嵁搴撴椂闂寸被鍨� */ + public static final String[] COLUMNTYPE_TIME = { "datetime", "time", "date", "timestamp" }; + + /** 鏁版嵁搴撴暟瀛楃被鍨� */ + public static final String[] COLUMNTYPE_NUMBER = { "tinyint", "smallint", "mediumint", "int", "number", "integer", + "bit", "bigint", "float", "double", "decimal" }; + + /** 椤甸潰涓嶉渶瑕佺紪杈戝瓧娈� */ + public static final String[] COLUMNNAME_NOT_EDIT = { "id", "create_by", "create_time", "del_flag" }; + + /** 椤甸潰涓嶉渶瑕佹樉绀虹殑鍒楄〃瀛楁 */ + public static final String[] COLUMNNAME_NOT_LIST = { "id", "create_by", "create_time", "del_flag", "update_by", + "update_time" }; + + /** 椤甸潰涓嶉渶瑕佹煡璇㈠瓧娈� */ + public static final String[] COLUMNNAME_NOT_QUERY = { "id", "create_by", "create_time", "del_flag", "update_by", + "update_time", "remark" }; + + /** Entity鍩虹被瀛楁 */ + public static final String[] BASE_ENTITY = { "createBy", "createTime", "updateBy", "updateTime", "remark" }; + + /** Tree鍩虹被瀛楁 */ + public static final String[] TREE_ENTITY = { "parentName", "parentId", "orderNum", "ancestors" }; + + /** 鏂囨湰妗� */ + public static final String HTML_INPUT = "input"; + + /** 鏂囨湰鍩� */ + public static final String HTML_TEXTAREA = "textarea"; + + /** 涓嬫媺妗� */ + public static final String HTML_SELECT = "select"; + + /** 鍗曢�夋 */ + public static final String HTML_RADIO = "radio"; + + /** 澶嶉�夋 */ + public static final String HTML_CHECKBOX = "checkbox"; + + /** 鏃ユ湡鎺т欢 */ + public static final String HTML_DATETIME = "datetime"; + + /** 鍥剧墖涓婁紶鎺т欢 */ + public static final String HTML_IMAGE_UPLOAD = "imageUpload"; + + /** 鏂囦欢涓婁紶鎺т欢 */ + public static final String HTML_FILE_UPLOAD = "fileUpload"; + + /** 瀵屾枃鏈帶浠� */ + public static final String HTML_EDITOR = "editor"; + + /** 瀛楃涓茬被鍨� */ + public static final String TYPE_STRING = "String"; + + /** 鏁村瀷 */ + public static final String TYPE_INTEGER = "Integer"; + + /** 闀挎暣鍨� */ + public static final String TYPE_LONG = "Long"; + + /** 娴偣鍨� */ + public static final String TYPE_DOUBLE = "Double"; + + /** 楂樼簿搴﹁绠楃被鍨� */ + public static final String TYPE_BIGDECIMAL = "BigDecimal"; + + /** 鏃堕棿绫诲瀷 */ + public static final String TYPE_DATE = "Date"; + + /** 妯$硦鏌ヨ */ + public static final String QUERY_LIKE = "LIKE"; + + /** 鐩哥瓑鏌ヨ */ + public static final String QUERY_EQ = "EQ"; + + /** 闇�瑕� */ + public static final String REQUIRE = "1"; +} diff --git a/se-common/se-common-core/src/main/java/com/se/common/core/constant/HttpStatus.java b/se-common/se-common-core/src/main/java/com/se/common/core/constant/HttpStatus.java new file mode 100644 index 0000000..1d16bab --- /dev/null +++ b/se-common/se-common-core/src/main/java/com/se/common/core/constant/HttpStatus.java @@ -0,0 +1,94 @@ +package com.se.common.core.constant; + +/** + * 杩斿洖鐘舵�佺爜 + * + * @author admin + */ +public class HttpStatus +{ + /** + * 鎿嶄綔鎴愬姛 + */ + public static final int SUCCESS = 200; + + /** + * 瀵硅薄鍒涘缓鎴愬姛 + */ + public static final int CREATED = 201; + + /** + * 璇锋眰宸茬粡琚帴鍙� + */ + public static final int ACCEPTED = 202; + + /** + * 鎿嶄綔宸茬粡鎵ц鎴愬姛锛屼絾鏄病鏈夎繑鍥炴暟鎹� + */ + public static final int NO_CONTENT = 204; + + /** + * 璧勬簮宸茶绉婚櫎 + */ + public static final int MOVED_PERM = 301; + + /** + * 閲嶅畾鍚� + */ + public static final int SEE_OTHER = 303; + + /** + * 璧勬簮娌℃湁琚慨鏀� + */ + public static final int NOT_MODIFIED = 304; + + /** + * 鍙傛暟鍒楄〃閿欒锛堢己灏戯紝鏍煎紡涓嶅尮閰嶏級 + */ + public static final int BAD_REQUEST = 400; + + /** + * 鏈巿鏉� + */ + public static final int UNAUTHORIZED = 401; + + /** + * 璁块棶鍙楅檺锛屾巿鏉冭繃鏈� + */ + public static final int FORBIDDEN = 403; + + /** + * 璧勬簮锛屾湇鍔℃湭鎵惧埌 + */ + public static final int NOT_FOUND = 404; + + /** + * 涓嶅厑璁哥殑http鏂规硶 + */ + public static final int BAD_METHOD = 405; + + /** + * 璧勬簮鍐茬獊锛屾垨鑰呰祫婧愯閿� + */ + public static final int CONFLICT = 409; + + /** + * 涓嶆敮鎸佺殑鏁版嵁锛屽獟浣撶被鍨� + */ + public static final int UNSUPPORTED_TYPE = 415; + + /** + * 绯荤粺鍐呴儴閿欒 + */ + public static final int ERROR = 500; + + /** + * 鎺ュ彛鏈疄鐜� + */ + public static final int NOT_IMPLEMENTED = 501; + + /** + * 绯荤粺璀﹀憡娑堟伅 + */ + public static final int WARN = 601; +} diff --git a/se-common/se-common-core/src/main/java/com/se/common/core/constant/ScheduleConstants.java b/se-common/se-common-core/src/main/java/com/se/common/core/constant/ScheduleConstants.java new file mode 100644 index 0000000..2fe9da4 --- /dev/null +++ b/se-common/se-common-core/src/main/java/com/se/common/core/constant/ScheduleConstants.java @@ -0,0 +1,50 @@ +package com.se.common.core.constant; + +/** + * 浠诲姟璋冨害閫氱敤甯搁噺 + * + * @author admin + */ +public class ScheduleConstants +{ + public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME"; + + /** 鎵ц鐩爣key */ + public static final String TASK_PROPERTIES = "TASK_PROPERTIES"; + + /** 榛樿 */ + public static final String MISFIRE_DEFAULT = "0"; + + /** 绔嬪嵆瑙﹀彂鎵ц */ + public static final String MISFIRE_IGNORE_MISFIRES = "1"; + + /** 瑙﹀彂涓�娆℃墽琛� */ + public static final String MISFIRE_FIRE_AND_PROCEED = "2"; + + /** 涓嶈Е鍙戠珛鍗虫墽琛� */ + public static final String MISFIRE_DO_NOTHING = "3"; + + public enum Status + { + /** + * 姝e父 + */ + NORMAL("0"), + /** + * 鏆傚仠 + */ + PAUSE("1"); + + private String value; + + private Status(String value) + { + this.value = value; + } + + public String getValue() + { + return value; + } + } +} diff --git a/se-common/se-common-core/src/main/java/com/se/common/core/constant/TokenConstants.java b/se-common/se-common-core/src/main/java/com/se/common/core/constant/TokenConstants.java new file mode 100644 index 0000000..626e5a9 --- /dev/null +++ b/se-common/se-common-core/src/main/java/com/se/common/core/constant/TokenConstants.java @@ -0,0 +1,25 @@ +package com.se.common.core.constant; + +/** + * Token鐨凨ey甯搁噺 + * + * @author admin + */ +public class TokenConstants +{ + /** + * 浠ょ墝鑷畾涔夋爣璇� + */ + public static final String AUTHENTICATION = "Authorization"; + + /** + * 浠ょ墝鍓嶇紑 + */ + public static final String PREFIX = "Bearer "; + + /** + * 浠ょ墝绉橀挜 + */ + public final static String SECRET = "abcdefghijklmnopqrstuvwxyz"; + +} diff --git a/se-common/se-common-core/src/main/java/com/se/common/core/context/SecurityContextHolder.java b/se-common/se-common-core/src/main/java/com/se/common/core/context/SecurityContextHolder.java new file mode 100644 index 0000000..d15b590 --- /dev/null +++ b/se-common/se-common-core/src/main/java/com/se/common/core/context/SecurityContextHolder.java @@ -0,0 +1,98 @@ +package com.se.common.core.context; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import com.alibaba.ttl.TransmittableThreadLocal; +import com.se.common.core.constant.SecurityConstants; +import com.se.common.core.text.Convert; +import com.se.common.core.utils.StringUtils; + +/** + * 鑾峰彇褰撳墠绾跨▼鍙橀噺涓殑 鐢ㄦ埛id銆佺敤鎴峰悕绉般�乀oken绛変俊鎭� + * 娉ㄦ剰锛� 蹇呴』鍦ㄧ綉鍏抽�氳繃璇锋眰澶寸殑鏂规硶浼犲叆锛屽悓鏃跺湪HeaderInterceptor鎷︽埅鍣ㄨ缃�笺�� 鍚﹀垯杩欓噷鏃犳硶鑾峰彇 + * + * @author admin + */ +public class SecurityContextHolder +{ + private static final TransmittableThreadLocal<Map<String, Object>> THREAD_LOCAL = new TransmittableThreadLocal<>(); + + public static void set(String key, Object value) + { + Map<String, Object> map = getLocalMap(); + map.put(key, value == null ? StringUtils.EMPTY : value); + } + + public static String get(String key) + { + Map<String, Object> map = getLocalMap(); + return Convert.toStr(map.getOrDefault(key, StringUtils.EMPTY)); + } + + public static <T> T get(String key, Class<T> clazz) + { + Map<String, Object> map = getLocalMap(); + return StringUtils.cast(map.getOrDefault(key, null)); + } + + public static Map<String, Object> getLocalMap() + { + Map<String, Object> map = THREAD_LOCAL.get(); + if (map == null) + { + map = new ConcurrentHashMap<String, Object>(); + THREAD_LOCAL.set(map); + } + return map; + } + + public static void setLocalMap(Map<String, Object> threadLocalMap) + { + THREAD_LOCAL.set(threadLocalMap); + } + + public static Long getUserId() + { + return Convert.toLong(get(SecurityConstants.DETAILS_USER_ID), 0L); + } + + public static void setUserId(String account) + { + set(SecurityConstants.DETAILS_USER_ID, account); + } + + public static String getUserName() + { + return get(SecurityConstants.DETAILS_USERNAME); + } + + public static void setUserName(String username) + { + set(SecurityConstants.DETAILS_USERNAME, username); + } + + public static String getUserKey() + { + return get(SecurityConstants.USER_KEY); + } + + public static void setUserKey(String userKey) + { + set(SecurityConstants.USER_KEY, userKey); + } + + public static String getPermission() + { + return get(SecurityConstants.ROLE_PERMISSION); + } + + public static void setPermission(String permissions) + { + set(SecurityConstants.ROLE_PERMISSION, permissions); + } + + public static void remove() + { + THREAD_LOCAL.remove(); + } +} diff --git a/se-common/se-common-core/src/main/java/com/se/common/core/exception/DemoModeException.java b/se-common/se-common-core/src/main/java/com/se/common/core/exception/DemoModeException.java new file mode 100644 index 0000000..375bcf5 --- /dev/null +++ b/se-common/se-common-core/src/main/java/com/se/common/core/exception/DemoModeException.java @@ -0,0 +1,15 @@ +package com.se.common.core.exception; + +/** + * 婕旂ず妯″紡寮傚父 + * + * @author admin + */ +public class DemoModeException extends RuntimeException +{ + private static final long serialVersionUID = 1L; + + public DemoModeException() + { + } +} diff --git a/se-common/se-common-core/src/main/java/com/se/common/core/exception/InnerAuthException.java b/se-common/se-common-core/src/main/java/com/se/common/core/exception/InnerAuthException.java new file mode 100644 index 0000000..b182a5a --- /dev/null +++ b/se-common/se-common-core/src/main/java/com/se/common/core/exception/InnerAuthException.java @@ -0,0 +1,16 @@ +package com.se.common.core.exception; + +/** + * 鍐呴儴璁よ瘉寮傚父 + * + * @author admin + */ +public class InnerAuthException extends RuntimeException +{ + private static final long serialVersionUID = 1L; + + public InnerAuthException(String message) + { + super(message); + } +} diff --git a/se-common/se-common-core/src/main/java/com/se/common/core/exception/PreAuthorizeException.java b/se-common/se-common-core/src/main/java/com/se/common/core/exception/PreAuthorizeException.java new file mode 100644 index 0000000..7bc5473 --- /dev/null +++ b/se-common/se-common-core/src/main/java/com/se/common/core/exception/PreAuthorizeException.java @@ -0,0 +1,15 @@ +package com.se.common.core.exception; + +/** + * 鏉冮檺寮傚父 + * + * @author admin + */ +public class PreAuthorizeException extends RuntimeException +{ + private static final long serialVersionUID = 1L; + + public PreAuthorizeException() + { + } +} diff --git a/se-common/se-common-core/src/main/java/com/se/common/core/exception/UtilException.java b/se-common/se-common-core/src/main/java/com/se/common/core/exception/UtilException.java new file mode 100644 index 0000000..d66fde1 --- /dev/null +++ b/se-common/se-common-core/src/main/java/com/se/common/core/exception/UtilException.java @@ -0,0 +1,26 @@ +package com.se.common.core.exception; + +/** + * 宸ュ叿绫诲紓甯� + * + * @author admin + */ +public class UtilException extends RuntimeException +{ + private static final long serialVersionUID = 8247610319171014183L; + + public UtilException(Throwable e) + { + super(e.getMessage(), e); + } + + public UtilException(String message) + { + super(message); + } + + public UtilException(String message, Throwable throwable) + { + super(message, throwable); + } +} diff --git a/se-common/se-common-core/src/main/java/com/se/common/core/exception/auth/NotLoginException.java b/se-common/se-common-core/src/main/java/com/se/common/core/exception/auth/NotLoginException.java new file mode 100644 index 0000000..2c7ab19 --- /dev/null +++ b/se-common/se-common-core/src/main/java/com/se/common/core/exception/auth/NotLoginException.java @@ -0,0 +1,16 @@ +package com.se.common.core.exception.auth; + +/** + * 鏈兘閫氳繃鐨勭櫥褰曡璇佸紓甯� + * + * @author admin + */ +public class NotLoginException extends RuntimeException +{ + private static final long serialVersionUID = 1L; + + public NotLoginException(String message) + { + super(message); + } +} diff --git a/se-common/se-common-core/src/main/java/com/se/common/core/exception/base/BaseException.java b/se-common/se-common-core/src/main/java/com/se/common/core/exception/base/BaseException.java new file mode 100644 index 0000000..a9e2f9b --- /dev/null +++ b/se-common/se-common-core/src/main/java/com/se/common/core/exception/base/BaseException.java @@ -0,0 +1,79 @@ +package com.se.common.core.exception.base; + +/** + * 鍩虹寮傚父 + * + * @author admin + */ +public class BaseException extends RuntimeException +{ + private static final long serialVersionUID = 1L; + + /** + * 鎵�灞炴ā鍧� + */ + private String module; + + /** + * 閿欒鐮� + */ + private String code; + + /** + * 閿欒鐮佸搴旂殑鍙傛暟 + */ + private Object[] args; + + /** + * 閿欒娑堟伅 + */ + private String defaultMessage; + + public BaseException(String module, String code, Object[] args, String defaultMessage) + { + this.module = module; + this.code = code; + this.args = args; + this.defaultMessage = defaultMessage; + } + + public BaseException(String module, String code, Object[] args) + { + this(module, code, args, null); + } + + public BaseException(String module, String defaultMessage) + { + this(module, null, null, defaultMessage); + } + + public BaseException(String code, Object[] args) + { + this(null, code, args, null); + } + + public BaseException(String defaultMessage) + { + this(null, null, null, defaultMessage); + } + + public String getModule() + { + return module; + } + + public String getCode() + { + return code; + } + + public Object[] getArgs() + { + return args; + } + + public String getDefaultMessage() + { + return defaultMessage; + } +} diff --git a/se-common/se-common-core/src/main/java/com/se/common/core/exception/file/FileException.java b/se-common/se-common-core/src/main/java/com/se/common/core/exception/file/FileException.java new file mode 100644 index 0000000..4f09efe --- /dev/null +++ b/se-common/se-common-core/src/main/java/com/se/common/core/exception/file/FileException.java @@ -0,0 +1,19 @@ +package com.se.common.core.exception.file; + +import com.se.common.core.exception.base.BaseException; + +/** + * 鏂囦欢淇℃伅寮傚父绫� + * + * @author admin + */ +public class FileException extends BaseException +{ + private static final long serialVersionUID = 1L; + + public FileException(String code, Object[] args, String msg) + { + super("file", code, args, msg); + } + +} diff --git a/se-common/se-common-core/src/main/java/com/se/common/core/exception/file/FileUploadException.java b/se-common/se-common-core/src/main/java/com/se/common/core/exception/file/FileUploadException.java new file mode 100644 index 0000000..b5976bc --- /dev/null +++ b/se-common/se-common-core/src/main/java/com/se/common/core/exception/file/FileUploadException.java @@ -0,0 +1,61 @@ +package com.se.common.core.exception.file; + +import java.io.PrintStream; +import java.io.PrintWriter; + +/** + * 鏂囦欢涓婁紶寮傚父绫� + * + * @author admin + */ +public class FileUploadException extends Exception +{ + + private static final long serialVersionUID = 1L; + + private final Throwable cause; + + public FileUploadException() + { + this(null, null); + } + + public FileUploadException(final String msg) + { + this(msg, null); + } + + public FileUploadException(String msg, Throwable cause) + { + super(msg); + this.cause = cause; + } + + @Override + public void printStackTrace(PrintStream stream) + { + super.printStackTrace(stream); + if (cause != null) + { + stream.println("Caused by:"); + cause.printStackTrace(stream); + } + } + + @Override + public void printStackTrace(PrintWriter writer) + { + super.printStackTrace(writer); + if (cause != null) + { + writer.println("Caused by:"); + cause.printStackTrace(writer); + } + } + + @Override + public Throwable getCause() + { + return cause; + } +} diff --git a/se-common/se-common-core/src/main/java/com/se/common/core/exception/job/TaskException.java b/se-common/se-common-core/src/main/java/com/se/common/core/exception/job/TaskException.java new file mode 100644 index 0000000..f09f52d --- /dev/null +++ b/se-common/se-common-core/src/main/java/com/se/common/core/exception/job/TaskException.java @@ -0,0 +1,34 @@ +package com.se.common.core.exception.job; + +/** + * 璁″垝绛栫暐寮傚父 + * + * @author admin + */ +public class TaskException extends Exception +{ + private static final long serialVersionUID = 1L; + + private Code code; + + public TaskException(String msg, Code code) + { + this(msg, code, null); + } + + public TaskException(String msg, Code code, Exception nestedEx) + { + super(msg, nestedEx); + this.code = code; + } + + public Code getCode() + { + return code; + } + + public enum Code + { + TASK_EXISTS, NO_TASK_EXISTS, TASK_ALREADY_STARTED, UNKNOWN, CONFIG_ERROR, TASK_NODE_NOT_AVAILABLE + } +} \ No newline at end of file diff --git a/se-common/se-common-core/src/main/java/com/se/common/core/exception/user/UserException.java b/se-common/se-common-core/src/main/java/com/se/common/core/exception/user/UserException.java new file mode 100644 index 0000000..03a35d4 --- /dev/null +++ b/se-common/se-common-core/src/main/java/com/se/common/core/exception/user/UserException.java @@ -0,0 +1,18 @@ +package com.se.common.core.exception.user; + +import com.se.common.core.exception.base.BaseException; + +/** + * 鐢ㄦ埛淇℃伅寮傚父绫� + * + * @author admin + */ +public class UserException extends BaseException +{ + private static final long serialVersionUID = 1L; + + public UserException(String code, Object[] args) + { + super("user", code, args, null); + } +} diff --git a/se-common/se-common-core/src/main/java/com/se/common/core/exception/user/UserPasswordNotMatchException.java b/se-common/se-common-core/src/main/java/com/se/common/core/exception/user/UserPasswordNotMatchException.java new file mode 100644 index 0000000..84633a4 --- /dev/null +++ b/se-common/se-common-core/src/main/java/com/se/common/core/exception/user/UserPasswordNotMatchException.java @@ -0,0 +1,16 @@ +package com.se.common.core.exception.user; + +/** + * 鐢ㄦ埛瀵嗙爜涓嶆纭垨涓嶇鍚堣鑼冨紓甯哥被 + * + * @author admin + */ +public class UserPasswordNotMatchException extends UserException +{ + private static final long serialVersionUID = 1L; + + public UserPasswordNotMatchException() + { + super("user.password.not.match", null); + } +} diff --git a/se-common/se-common-core/src/main/java/com/se/common/core/text/CharsetKit.java b/se-common/se-common-core/src/main/java/com/se/common/core/text/CharsetKit.java new file mode 100644 index 0000000..3086837 --- /dev/null +++ b/se-common/se-common-core/src/main/java/com/se/common/core/text/CharsetKit.java @@ -0,0 +1,86 @@ +package com.se.common.core.text; + +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; +import com.se.common.core.utils.StringUtils; + +/** + * 瀛楃闆嗗伐鍏风被 + * + * @author admin + */ +public class CharsetKit +{ + /** ISO-8859-1 */ + public static final String ISO_8859_1 = "ISO-8859-1"; + /** UTF-8 */ + public static final String UTF_8 = "UTF-8"; + /** GBK */ + public static final String GBK = "GBK"; + + /** ISO-8859-1 */ + public static final Charset CHARSET_ISO_8859_1 = Charset.forName(ISO_8859_1); + /** UTF-8 */ + public static final Charset CHARSET_UTF_8 = Charset.forName(UTF_8); + /** GBK */ + public static final Charset CHARSET_GBK = Charset.forName(GBK); + + /** + * 杞崲涓篊harset瀵硅薄 + * + * @param charset 瀛楃闆嗭紝涓虹┖鍒欒繑鍥為粯璁ゅ瓧绗﹂泦 + * @return Charset + */ + public static Charset charset(String charset) + { + return StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset); + } + + /** + * 杞崲瀛楃涓茬殑瀛楃闆嗙紪鐮� + * + * @param source 瀛楃涓� + * @param srcCharset 婧愬瓧绗﹂泦锛岄粯璁SO-8859-1 + * @param destCharset 鐩爣瀛楃闆嗭紝榛樿UTF-8 + * @return 杞崲鍚庣殑瀛楃闆� + */ + public static String convert(String source, String srcCharset, String destCharset) + { + return convert(source, Charset.forName(srcCharset), Charset.forName(destCharset)); + } + + /** + * 杞崲瀛楃涓茬殑瀛楃闆嗙紪鐮� + * + * @param source 瀛楃涓� + * @param srcCharset 婧愬瓧绗﹂泦锛岄粯璁SO-8859-1 + * @param destCharset 鐩爣瀛楃闆嗭紝榛樿UTF-8 + * @return 杞崲鍚庣殑瀛楃闆� + */ + public static String convert(String source, Charset srcCharset, Charset destCharset) + { + if (null == srcCharset) + { + srcCharset = StandardCharsets.ISO_8859_1; + } + + if (null == destCharset) + { + destCharset = StandardCharsets.UTF_8; + } + + if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset)) + { + return source; + } + return new String(source.getBytes(srcCharset), destCharset); + } + + /** + * @return 绯荤粺瀛楃闆嗙紪鐮� + */ + public static String systemCharset() + { + return Charset.defaultCharset().name(); + } +} diff --git a/se-common/se-common-core/src/main/java/com/se/common/core/utils/JwtUtils.java b/se-common/se-common-core/src/main/java/com/se/common/core/utils/JwtUtils.java new file mode 100644 index 0000000..9711970 --- /dev/null +++ b/se-common/se-common-core/src/main/java/com/se/common/core/utils/JwtUtils.java @@ -0,0 +1,123 @@ +package com.se.common.core.utils; + +import java.util.Map; +import com.se.common.core.constant.SecurityConstants; +import com.se.common.core.constant.TokenConstants; +import com.se.common.core.text.Convert; +import io.jsonwebtoken.Claims; +import io.jsonwebtoken.Jwts; +import io.jsonwebtoken.SignatureAlgorithm; + +/** + * Jwt宸ュ叿绫� + * + * @author admin + */ +public class JwtUtils +{ + public static String secret = TokenConstants.SECRET; + + /** + * 浠庢暟鎹0鏄庣敓鎴愪护鐗� + * + * @param claims 鏁版嵁澹版槑 + * @return 浠ょ墝 + */ + public static String createToken(Map<String, Object> claims) + { + String token = Jwts.builder().setClaims(claims).signWith(SignatureAlgorithm.HS512, secret).compact(); + return token; + } + + /** + * 浠庝护鐗屼腑鑾峰彇鏁版嵁澹版槑 + * + * @param token 浠ょ墝 + * @return 鏁版嵁澹版槑 + */ + public static Claims parseToken(String token) + { + return Jwts.parser().setSigningKey(secret).parseClaimsJws(token).getBody(); + } + + /** + * 鏍规嵁浠ょ墝鑾峰彇鐢ㄦ埛鏍囪瘑 + * + * @param token 浠ょ墝 + * @return 鐢ㄦ埛ID + */ + public static String getUserKey(String token) + { + Claims claims = parseToken(token); + return getValue(claims, SecurityConstants.USER_KEY); + } + + /** + * 鏍规嵁浠ょ墝鑾峰彇鐢ㄦ埛鏍囪瘑 + * + * @param claims 韬唤淇℃伅 + * @return 鐢ㄦ埛ID + */ + public static String getUserKey(Claims claims) + { + return getValue(claims, SecurityConstants.USER_KEY); + } + + /** + * 鏍规嵁浠ょ墝鑾峰彇鐢ㄦ埛ID + * + * @param token 浠ょ墝 + * @return 鐢ㄦ埛ID + */ + public static String getUserId(String token) + { + Claims claims = parseToken(token); + return getValue(claims, SecurityConstants.DETAILS_USER_ID); + } + + /** + * 鏍规嵁韬唤淇℃伅鑾峰彇鐢ㄦ埛ID + * + * @param claims 韬唤淇℃伅 + * @return 鐢ㄦ埛ID + */ + public static String getUserId(Claims claims) + { + return getValue(claims, SecurityConstants.DETAILS_USER_ID); + } + + /** + * 鏍规嵁浠ょ墝鑾峰彇鐢ㄦ埛鍚� + * + * @param token 浠ょ墝 + * @return 鐢ㄦ埛鍚� + */ + public static String getUserName(String token) + { + Claims claims = parseToken(token); + return getValue(claims, SecurityConstants.DETAILS_USERNAME); + } + + /** + * 鏍规嵁韬唤淇℃伅鑾峰彇鐢ㄦ埛鍚� + * + * @param claims 韬唤淇℃伅 + * @return 鐢ㄦ埛鍚� + */ + public static String getUserName(Claims claims) + { + return getValue(claims, SecurityConstants.DETAILS_USERNAME); + } + + /** + * 鏍规嵁韬唤淇℃伅鑾峰彇閿�� + * + * @param claims 韬唤淇℃伅 + * @param key 閿� + * @return 鍊� + */ + public static String getValue(Claims claims, String key) + { + return Convert.toStr(claims.get(key), ""); + } +} diff --git a/se-common/se-common-core/src/main/java/com/se/common/core/utils/bean/BeanValidators.java b/se-common/se-common-core/src/main/java/com/se/common/core/utils/bean/BeanValidators.java new file mode 100644 index 0000000..0f9a62b --- /dev/null +++ b/se-common/se-common-core/src/main/java/com/se/common/core/utils/bean/BeanValidators.java @@ -0,0 +1,24 @@ +package com.se.common.core.utils.bean; + +import java.util.Set; +import javax.validation.ConstraintViolation; +import javax.validation.ConstraintViolationException; +import javax.validation.Validator; + +/** + * bean瀵硅薄灞炴�ч獙璇� + * + * @author admin + */ +public class BeanValidators +{ + public static void validateWithException(Validator validator, Object object, Class<?>... groups) + throws ConstraintViolationException + { + Set<ConstraintViolation<Object>> constraintViolations = validator.validate(object, groups); + if (!constraintViolations.isEmpty()) + { + throw new ConstraintViolationException(constraintViolations); + } + } +} diff --git a/se-common/se-common-core/src/main/java/com/se/common/core/utils/file/MimeTypeUtils.java b/se-common/se-common-core/src/main/java/com/se/common/core/utils/file/MimeTypeUtils.java new file mode 100644 index 0000000..f168746 --- /dev/null +++ b/se-common/se-common-core/src/main/java/com/se/common/core/utils/file/MimeTypeUtils.java @@ -0,0 +1,59 @@ +package com.se.common.core.utils.file; + +/** + * 濯掍綋绫诲瀷宸ュ叿绫� + * + * @author admin + */ +public class MimeTypeUtils +{ + public static final String IMAGE_PNG = "image/png"; + + public static final String IMAGE_JPG = "image/jpg"; + + public static final String IMAGE_JPEG = "image/jpeg"; + + public static final String IMAGE_BMP = "image/bmp"; + + public static final String IMAGE_GIF = "image/gif"; + + public static final String[] IMAGE_EXTENSION = { "bmp", "gif", "jpg", "jpeg", "png" }; + + public static final String[] FLASH_EXTENSION = { "swf", "flv" }; + + public static final String[] MEDIA_EXTENSION = { "swf", "flv", "mp3", "wav", "wma", "wmv", "mid", "avi", "mpg", + "asf", "rm", "rmvb" }; + + public static final String[] VIDEO_EXTENSION = { "mp4", "avi", "rmvb" }; + + public static final String[] DEFAULT_ALLOWED_EXTENSION = { + // 鍥剧墖 + "bmp", "gif", "jpg", "jpeg", "png", + // word excel powerpoint + "doc", "docx", "xls", "xlsx", "ppt", "pptx", "html", "htm", "txt", + // 鍘嬬缉鏂囦欢 + "rar", "zip", "gz", "bz2", + // 瑙嗛鏍煎紡 + "mp4", "avi", "rmvb", + // pdf + "pdf" }; + + public static String getExtension(String prefix) + { + switch (prefix) + { + case IMAGE_PNG: + return "png"; + case IMAGE_JPG: + return "jpg"; + case IMAGE_JPEG: + return "jpeg"; + case IMAGE_BMP: + return "bmp"; + case IMAGE_GIF: + return "gif"; + default: + return ""; + } + } +} diff --git a/se-common/se-common-core/src/main/java/com/se/common/core/utils/poi/ExcelUtil.java b/se-common/se-common-core/src/main/java/com/se/common/core/utils/poi/ExcelUtil.java new file mode 100644 index 0000000..09539b6 --- /dev/null +++ b/se-common/se-common-core/src/main/java/com/se/common/core/utils/poi/ExcelUtil.java @@ -0,0 +1,1538 @@ +package com.se.common.core.utils.poi; + +import java.io.IOException; +import java.io.InputStream; +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.ParameterizedType; +import java.math.BigDecimal; +import java.text.DecimalFormat; +import java.time.LocalDate; +import java.time.LocalDateTime; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.Comparator; +import java.util.Date; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; +import javax.servlet.http.HttpServletResponse; + +import com.se.common.core.annotation.Excel; +import com.se.common.core.annotation.Excels; +import com.se.common.core.exception.UtilException; +import com.se.common.core.text.Convert; +import com.se.common.core.utils.file.FileTypeUtils; +import com.se.common.core.utils.file.ImageUtils; +import com.se.common.core.utils.reflect.ReflectUtils; +import org.apache.commons.lang3.ArrayUtils; +import org.apache.commons.lang3.RegExUtils; +import org.apache.commons.lang3.reflect.FieldUtils; +import org.apache.poi.ss.usermodel.BorderStyle; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.CellStyle; +import org.apache.poi.ss.usermodel.CellType; +import org.apache.poi.ss.usermodel.ClientAnchor; +import org.apache.poi.ss.usermodel.DataFormat; +import org.apache.poi.ss.usermodel.DataValidation; +import org.apache.poi.ss.usermodel.DataValidationConstraint; +import org.apache.poi.ss.usermodel.DataValidationHelper; +import org.apache.poi.ss.usermodel.DateUtil; +import org.apache.poi.ss.usermodel.Drawing; +import org.apache.poi.ss.usermodel.FillPatternType; +import org.apache.poi.ss.usermodel.Font; +import org.apache.poi.ss.usermodel.HorizontalAlignment; +import org.apache.poi.ss.usermodel.IndexedColors; +import org.apache.poi.ss.usermodel.Name; +import org.apache.poi.ss.usermodel.Row; +import org.apache.poi.ss.usermodel.Sheet; +import org.apache.poi.ss.usermodel.VerticalAlignment; +import org.apache.poi.ss.usermodel.Workbook; +import org.apache.poi.ss.usermodel.WorkbookFactory; +import org.apache.poi.ss.util.CellRangeAddress; +import org.apache.poi.ss.util.CellRangeAddressList; +import org.apache.poi.util.IOUtils; +import org.apache.poi.xssf.streaming.SXSSFWorkbook; +import org.apache.poi.xssf.usermodel.XSSFClientAnchor; +import org.apache.poi.xssf.usermodel.XSSFDataValidation; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.se.common.core.utils.DateUtils; +import com.se.common.core.utils.StringUtils; + +/** + * Excel鐩稿叧澶勭悊 + * + * @author admin + */ +public class ExcelUtil<T> +{ + private static final Logger log = LoggerFactory.getLogger(ExcelUtil.class); + + public static final String FORMULA_REGEX_STR = "=|-|\\+|@"; + + public static final String[] FORMULA_STR = { "=", "-", "+", "@" }; + + /** + * Excel sheet鏈�澶ц鏁帮紝榛樿65536 + */ + public static final int sheetSize = 65536; + + /** + * 宸ヤ綔琛ㄥ悕绉� + */ + private String sheetName; + + /** + * 瀵煎嚭绫诲瀷锛圗XPORT:瀵煎嚭鏁版嵁锛汭MPORT锛氬鍏ユā鏉匡級 + */ + private Excel.Type type; + + /** + * 宸ヤ綔钖勫璞� + */ + private Workbook wb; + + /** + * 宸ヤ綔琛ㄥ璞� + */ + private Sheet sheet; + + /** + * 鏍峰紡鍒楄〃 + */ + private Map<String, CellStyle> styles; + + /** + * 瀵煎叆瀵煎嚭鏁版嵁鍒楄〃 + */ + private List<T> list; + + /** + * 娉ㄨВ鍒楄〃 + */ + private List<Object[]> fields; + + /** + * 褰撳墠琛屽彿 + */ + private int rownum; + + /** + * 鏍囬 + */ + private String title; + + /** + * 鏈�澶ч珮搴� + */ + private short maxHeight; + + /** + * 鍚堝苟鍚庢渶鍚庤鏁� + */ + private int subMergedLastRowNum = 0; + + /** + * 鍚堝苟鍚庡紑濮嬭鏁� + */ + private int subMergedFirstRowNum = 1; + + /** + * 瀵硅薄鐨勫瓙鍒楄〃鏂规硶 + */ + private Method subMethod; + + /** + * 瀵硅薄鐨勫瓙鍒楄〃灞炴�� + */ + private List<Field> subFields; + + /** + * 缁熻鍒楄〃 + */ + private Map<Integer, Double> statistics = new HashMap<Integer, Double>(); + + /** + * 鏁板瓧鏍煎紡 + */ + private static final DecimalFormat DOUBLE_FORMAT = new DecimalFormat("######0.00"); + + /** + * 瀹炰綋瀵硅薄 + */ + public Class<T> clazz; + + /** + * 闇�瑕佹帓闄ゅ垪灞炴�� + */ + public String[] excludeFields; + + public ExcelUtil(Class<T> clazz) + { + this.clazz = clazz; + } + + /** + * 闅愯棌Excel涓垪灞炴�� + * + * @param fields 鍒楀睘鎬у悕 绀轰緥[鍗曚釜"name"/澶氫釜"id","name"] + * @throws Exception + */ + public void hideColumn(String... fields) + { + this.excludeFields = fields; + } + + public void init(List<T> list, String sheetName, String title, Excel.Type type) + { + if (list == null) + { + list = new ArrayList<T>(); + } + this.list = list; + this.sheetName = sheetName; + this.type = type; + this.title = title; + createExcelField(); + createWorkbook(); + createTitle(); + createSubHead(); + } + + /** + * 鍒涘缓excel绗竴琛屾爣棰� + */ + public void createTitle() + { + if (StringUtils.isNotEmpty(title)) + { + subMergedFirstRowNum++; + subMergedLastRowNum++; + int titleLastCol = this.fields.size() - 1; + if (isSubList()) + { + titleLastCol = titleLastCol + subFields.size() - 1; + } + Row titleRow = sheet.createRow(rownum == 0 ? rownum++ : 0); + titleRow.setHeightInPoints(30); + Cell titleCell = titleRow.createCell(0); + titleCell.setCellStyle(styles.get("title")); + titleCell.setCellValue(title); + sheet.addMergedRegion(new CellRangeAddress(titleRow.getRowNum(), titleRow.getRowNum(), titleRow.getRowNum(), titleLastCol)); + } + } + + /** + * 鍒涘缓瀵硅薄鐨勫瓙鍒楄〃鍚嶇О + */ + public void createSubHead() + { + if (isSubList()) + { + subMergedFirstRowNum++; + subMergedLastRowNum++; + Row subRow = sheet.createRow(rownum); + int excelNum = 0; + for (Object[] objects : fields) + { + Excel attr = (Excel) objects[1]; + Cell headCell1 = subRow.createCell(excelNum); + headCell1.setCellValue(attr.name()); + headCell1.setCellStyle(styles.get(StringUtils.format("header_{}_{}", attr.headerColor(), attr.headerBackgroundColor()))); + excelNum++; + } + int headFirstRow = excelNum - 1; + int headLastRow = headFirstRow + subFields.size() - 1; + if (headLastRow > headFirstRow) + { + sheet.addMergedRegion(new CellRangeAddress(rownum, rownum, headFirstRow, headLastRow)); + } + rownum++; + } + } + + /** + * 瀵筫xcel琛ㄥ崟榛樿绗竴涓储寮曞悕杞崲鎴恖ist + * + * @param is 杈撳叆娴� + * @return 杞崲鍚庨泦鍚� + */ + public List<T> importExcel(InputStream is) + { + List<T> list = null; + try + { + list = importExcel(is, 0); + } + catch (Exception e) + { + log.error("瀵煎叆Excel寮傚父{}", e.getMessage()); + throw new UtilException(e.getMessage()); + } + finally + { + IOUtils.closeQuietly(is); + } + return list; + } + + /** + * 瀵筫xcel琛ㄥ崟榛樿绗竴涓储寮曞悕杞崲鎴恖ist + * + * @param is 杈撳叆娴� + * @param titleNum 鏍囬鍗犵敤琛屾暟 + * @return 杞崲鍚庨泦鍚� + */ + public List<T> importExcel(InputStream is, int titleNum) throws Exception + { + return importExcel(StringUtils.EMPTY, is, titleNum); + } + + /** + * 瀵筫xcel琛ㄥ崟鎸囧畾琛ㄦ牸绱㈠紩鍚嶈浆鎹㈡垚list + * + * @param sheetName 琛ㄦ牸绱㈠紩鍚� + * @param titleNum 鏍囬鍗犵敤琛屾暟 + * @param is 杈撳叆娴� + * @return 杞崲鍚庨泦鍚� + */ + public List<T> importExcel(String sheetName, InputStream is, int titleNum) throws Exception + { + this.type = Excel.Type.IMPORT; + this.wb = WorkbookFactory.create(is); + List<T> list = new ArrayList<T>(); + // 濡傛灉鎸囧畾sheet鍚�,鍒欏彇鎸囧畾sheet涓殑鍐呭 鍚﹀垯榛樿鎸囧悜绗�1涓猻heet + Sheet sheet = StringUtils.isNotEmpty(sheetName) ? wb.getSheet(sheetName) : wb.getSheetAt(0); + if (sheet == null) + { + throw new IOException("鏂囦欢sheet涓嶅瓨鍦�"); + } + + // 鑾峰彇鏈�鍚庝竴涓潪绌鸿鐨勮涓嬫爣锛屾瘮濡傛�昏鏁颁负n锛屽垯杩斿洖鐨勪负n-1 + int rows = sheet.getLastRowNum(); + if (rows > 0) + { + // 瀹氫箟涓�涓猰ap鐢ㄤ簬瀛樻斁excel鍒楃殑搴忓彿鍜宖ield. + Map<String, Integer> cellMap = new HashMap<String, Integer>(); + // 鑾峰彇琛ㄥご + Row heard = sheet.getRow(titleNum); + for (int i = 0; i < heard.getPhysicalNumberOfCells(); i++) + { + Cell cell = heard.getCell(i); + if (StringUtils.isNotNull(cell)) + { + String value = this.getCellValue(heard, i).toString(); + cellMap.put(value, i); + } + else + { + cellMap.put(null, i); + } + } + // 鏈夋暟鎹椂鎵嶅鐞� 寰楀埌绫荤殑鎵�鏈塮ield. + List<Object[]> fields = this.getFields(); + Map<Integer, Object[]> fieldsMap = new HashMap<Integer, Object[]>(); + for (Object[] objects : fields) + { + Excel attr = (Excel) objects[1]; + Integer column = cellMap.get(attr.name()); + if (column != null) + { + fieldsMap.put(column, objects); + } + } + for (int i = titleNum + 1; i <= rows; i++) + { + // 浠庣2琛屽紑濮嬪彇鏁版嵁,榛樿绗竴琛屾槸琛ㄥご. + Row row = sheet.getRow(i); + // 鍒ゆ柇褰撳墠琛屾槸鍚︽槸绌鸿 + if (isRowEmpty(row)) + { + continue; + } + T entity = null; + for (Map.Entry<Integer, Object[]> entry : fieldsMap.entrySet()) + { + Object val = this.getCellValue(row, entry.getKey()); + + // 濡傛灉涓嶅瓨鍦ㄥ疄渚嬪垯鏂板缓. + entity = (entity == null ? clazz.newInstance() : entity); + // 浠巑ap涓緱鍒板搴斿垪鐨刦ield. + Field field = (Field) entry.getValue()[0]; + Excel attr = (Excel) entry.getValue()[1]; + // 鍙栧緱绫诲瀷,骞舵牴鎹璞$被鍨嬭缃��. + Class<?> fieldType = field.getType(); + if (String.class == fieldType) + { + String s = Convert.toStr(val); + if (StringUtils.endsWith(s, ".0")) + { + val = StringUtils.substringBefore(s, ".0"); + } + else + { + String dateFormat = field.getAnnotation(Excel.class).dateFormat(); + if (StringUtils.isNotEmpty(dateFormat)) + { + val = parseDateToStr(dateFormat, val); + } + else + { + val = Convert.toStr(val); + } + } + } + else if ((Integer.TYPE == fieldType || Integer.class == fieldType) && StringUtils.isNumeric(Convert.toStr(val))) + { + val = Convert.toInt(val); + } + else if ((Long.TYPE == fieldType || Long.class == fieldType) && StringUtils.isNumeric(Convert.toStr(val))) + { + val = Convert.toLong(val); + } + else if (Double.TYPE == fieldType || Double.class == fieldType) + { + val = Convert.toDouble(val); + } + else if (Float.TYPE == fieldType || Float.class == fieldType) + { + val = Convert.toFloat(val); + } + else if (BigDecimal.class == fieldType) + { + val = Convert.toBigDecimal(val); + } + else if (Date.class == fieldType) + { + if (val instanceof String) + { + val = DateUtils.parseDate(val); + } + else if (val instanceof Double) + { + val = DateUtil.getJavaDate((Double) val); + } + } + else if (Boolean.TYPE == fieldType || Boolean.class == fieldType) + { + val = Convert.toBool(val, false); + } + if (StringUtils.isNotNull(fieldType)) + { + String propertyName = field.getName(); + if (StringUtils.isNotEmpty(attr.targetAttr())) + { + propertyName = field.getName() + "." + attr.targetAttr(); + } + if (StringUtils.isNotEmpty(attr.readConverterExp())) + { + val = reverseByExp(Convert.toStr(val), attr.readConverterExp(), attr.separator()); + } + else if (!attr.handler().equals(ExcelHandlerAdapter.class)) + { + val = dataFormatHandlerAdapter(val, attr, null); + } + ReflectUtils.invokeSetter(entity, propertyName, val); + } + } + list.add(entity); + } + } + return list; + } + + /** + * 瀵筶ist鏁版嵁婧愬皢鍏堕噷闈㈢殑鏁版嵁瀵煎叆鍒癳xcel琛ㄥ崟 + * + * @param response 杩斿洖鏁版嵁 + * @param list 瀵煎嚭鏁版嵁闆嗗悎 + * @param sheetName 宸ヤ綔琛ㄧ殑鍚嶇О + * @return 缁撴灉 + */ + public void exportExcel(HttpServletResponse response, List<T> list, String sheetName) + { + exportExcel(response, list, sheetName, StringUtils.EMPTY); + } + + /** + * 瀵筶ist鏁版嵁婧愬皢鍏堕噷闈㈢殑鏁版嵁瀵煎叆鍒癳xcel琛ㄥ崟 + * + * @param response 杩斿洖鏁版嵁 + * @param list 瀵煎嚭鏁版嵁闆嗗悎 + * @param sheetName 宸ヤ綔琛ㄧ殑鍚嶇О + * @param title 鏍囬 + * @return 缁撴灉 + */ + public void exportExcel(HttpServletResponse response, List<T> list, String sheetName, String title) + { + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setCharacterEncoding("utf-8"); + this.init(list, sheetName, title, Excel.Type.EXPORT); + exportExcel(response); + } + + /** + * 瀵筶ist鏁版嵁婧愬皢鍏堕噷闈㈢殑鏁版嵁瀵煎叆鍒癳xcel琛ㄥ崟 + * + * @param sheetName 宸ヤ綔琛ㄧ殑鍚嶇О + * @return 缁撴灉 + */ + public void importTemplateExcel(HttpServletResponse response, String sheetName) + { + importTemplateExcel(response, sheetName, StringUtils.EMPTY); + } + + /** + * 瀵筶ist鏁版嵁婧愬皢鍏堕噷闈㈢殑鏁版嵁瀵煎叆鍒癳xcel琛ㄥ崟 + * + * @param sheetName 宸ヤ綔琛ㄧ殑鍚嶇О + * @param title 鏍囬 + * @return 缁撴灉 + */ + public void importTemplateExcel(HttpServletResponse response, String sheetName, String title) + { + response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); + response.setCharacterEncoding("utf-8"); + this.init(null, sheetName, title, Excel.Type.IMPORT); + exportExcel(response); + } + + /** + * 瀵筶ist鏁版嵁婧愬皢鍏堕噷闈㈢殑鏁版嵁瀵煎叆鍒癳xcel琛ㄥ崟 + * + * @return 缁撴灉 + */ + public void exportExcel(HttpServletResponse response) + { + try + { + writeSheet(); + wb.write(response.getOutputStream()); + } + catch (Exception e) + { + log.error("瀵煎嚭Excel寮傚父{}", e.getMessage()); + } + finally + { + IOUtils.closeQuietly(wb); + } + } + + /** + * 鍒涘缓鍐欏叆鏁版嵁鍒癝heet + */ + public void writeSheet() + { + // 鍙栧嚭涓�鍏辨湁澶氬皯涓猻heet. + int sheetNo = Math.max(1, (int) Math.ceil(list.size() * 1.0 / sheetSize)); + for (int index = 0; index < sheetNo; index++) + { + createSheet(sheetNo, index); + + // 浜х敓涓�琛� + Row row = sheet.createRow(rownum); + int column = 0; + // 鍐欏叆鍚勪釜瀛楁鐨勫垪澶村悕绉� + for (Object[] os : fields) + { + Field field = (Field) os[0]; + Excel excel = (Excel) os[1]; + if (Collection.class.isAssignableFrom(field.getType())) + { + for (Field subField : subFields) + { + Excel subExcel = subField.getAnnotation(Excel.class); + this.createHeadCell(subExcel, row, column++); + } + } + else + { + this.createHeadCell(excel, row, column++); + } + } + if (Excel.Type.EXPORT.equals(type)) + { + fillExcelData(index, row); + addStatisticsRow(); + } + } + } + + /** + * 濉厖excel鏁版嵁 + * + * @param index 搴忓彿 + * @param row 鍗曞厓鏍艰 + */ + @SuppressWarnings("unchecked") + public void fillExcelData(int index, Row row) + { + int startNo = index * sheetSize; + int endNo = Math.min(startNo + sheetSize, list.size()); + int rowNo = (1 + rownum) - startNo; + for (int i = startNo; i < endNo; i++) + { + rowNo = isSubList() ? (i > 1 ? rowNo + 1 : rowNo + i) : i + 1 + rownum - startNo; + row = sheet.createRow(rowNo); + // 寰楀埌瀵煎嚭瀵硅薄. + T vo = (T) list.get(i); + Collection<?> subList = null; + if (isSubList()) + { + if (isSubListValue(vo)) + { + subList = getListCellValue(vo); + subMergedLastRowNum = subMergedLastRowNum + subList.size(); + } + else + { + subMergedFirstRowNum++; + subMergedLastRowNum++; + } + } + int column = 0; + for (Object[] os : fields) + { + Field field = (Field) os[0]; + Excel excel = (Excel) os[1]; + if (Collection.class.isAssignableFrom(field.getType()) && StringUtils.isNotNull(subList)) + { + boolean subFirst = false; + for (Object obj : subList) + { + if (subFirst) + { + rowNo++; + row = sheet.createRow(rowNo); + } + List<Field> subFields = FieldUtils.getFieldsListWithAnnotation(obj.getClass(), Excel.class); + int subIndex = 0; + for (Field subField : subFields) + { + if (subField.isAnnotationPresent(Excel.class)) + { + subField.setAccessible(true); + Excel attr = subField.getAnnotation(Excel.class); + this.addCell(attr, row, (T) obj, subField, column + subIndex); + } + subIndex++; + } + subFirst = true; + } + this.subMergedFirstRowNum = this.subMergedFirstRowNum + subList.size(); + } + else + { + this.addCell(excel, row, vo, field, column++); + } + } + } + } + + /** + * 鍒涘缓琛ㄦ牸鏍峰紡 + * + * @param wb 宸ヤ綔钖勫璞� + * @return 鏍峰紡鍒楄〃 + */ + private Map<String, CellStyle> createStyles(Workbook wb) + { + // 鍐欏叆鍚勬潯璁板綍,姣忔潯璁板綍瀵瑰簲excel琛ㄤ腑鐨勪竴琛� + Map<String, CellStyle> styles = new HashMap<String, CellStyle>(); + CellStyle style = wb.createCellStyle(); + style.setAlignment(HorizontalAlignment.CENTER); + style.setVerticalAlignment(VerticalAlignment.CENTER); + Font titleFont = wb.createFont(); + titleFont.setFontName("Arial"); + titleFont.setFontHeightInPoints((short) 16); + titleFont.setBold(true); + style.setFont(titleFont); + DataFormat dataFormat = wb.createDataFormat(); + style.setDataFormat(dataFormat.getFormat("@")); + styles.put("title", style); + + style = wb.createCellStyle(); + style.setAlignment(HorizontalAlignment.CENTER); + style.setVerticalAlignment(VerticalAlignment.CENTER); + style.setBorderRight(BorderStyle.THIN); + style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); + style.setBorderLeft(BorderStyle.THIN); + style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); + style.setBorderTop(BorderStyle.THIN); + style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); + style.setBorderBottom(BorderStyle.THIN); + style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); + Font dataFont = wb.createFont(); + dataFont.setFontName("Arial"); + dataFont.setFontHeightInPoints((short) 10); + style.setFont(dataFont); + styles.put("data", style); + + style = wb.createCellStyle(); + style.setAlignment(HorizontalAlignment.CENTER); + style.setVerticalAlignment(VerticalAlignment.CENTER); + Font totalFont = wb.createFont(); + totalFont.setFontName("Arial"); + totalFont.setFontHeightInPoints((short) 10); + style.setFont(totalFont); + styles.put("total", style); + + styles.putAll(annotationHeaderStyles(wb, styles)); + + styles.putAll(annotationDataStyles(wb)); + + return styles; + } + + /** + * 鏍规嵁Excel娉ㄨВ鍒涘缓琛ㄦ牸澶存牱寮� + * + * @param wb 宸ヤ綔钖勫璞� + * @return 鑷畾涔夋牱寮忓垪琛� + */ + private Map<String, CellStyle> annotationHeaderStyles(Workbook wb, Map<String, CellStyle> styles) + { + Map<String, CellStyle> headerStyles = new HashMap<String, CellStyle>(); + for (Object[] os : fields) + { + Excel excel = (Excel) os[1]; + String key = StringUtils.format("header_{}_{}", excel.headerColor(), excel.headerBackgroundColor()); + if (!headerStyles.containsKey(key)) + { + CellStyle style = wb.createCellStyle(); + style.cloneStyleFrom(styles.get("data")); + style.setAlignment(HorizontalAlignment.CENTER); + style.setVerticalAlignment(VerticalAlignment.CENTER); + style.setFillForegroundColor(excel.headerBackgroundColor().index); + style.setFillPattern(FillPatternType.SOLID_FOREGROUND); + Font headerFont = wb.createFont(); + headerFont.setFontName("Arial"); + headerFont.setFontHeightInPoints((short) 10); + headerFont.setBold(true); + headerFont.setColor(excel.headerColor().index); + style.setFont(headerFont); + // 璁剧疆琛ㄦ牸澶村崟鍏冩牸鏂囨湰褰㈠紡 + DataFormat dataFormat = wb.createDataFormat(); + style.setDataFormat(dataFormat.getFormat("@")); + headerStyles.put(key, style); + } + } + return headerStyles; + } + + /** + * 鏍规嵁Excel娉ㄨВ鍒涘缓琛ㄦ牸鍒楁牱寮� + * + * @param wb 宸ヤ綔钖勫璞� + * @return 鑷畾涔夋牱寮忓垪琛� + */ + private Map<String, CellStyle> annotationDataStyles(Workbook wb) + { + Map<String, CellStyle> styles = new HashMap<String, CellStyle>(); + for (Object[] os : fields) + { + Field field = (Field) os[0]; + Excel excel = (Excel) os[1]; + if (Collection.class.isAssignableFrom(field.getType())) + { + ParameterizedType pt = (ParameterizedType) field.getGenericType(); + Class<?> subClass = (Class<?>) pt.getActualTypeArguments()[0]; + List<Field> subFields = FieldUtils.getFieldsListWithAnnotation(subClass, Excel.class); + for (Field subField : subFields) + { + Excel subExcel = subField.getAnnotation(Excel.class); + annotationDataStyles(styles, subField, subExcel); + } + } + else + { + annotationDataStyles(styles, field, excel); + } + } + return styles; + } + + /** + * 鏍规嵁Excel娉ㄨВ鍒涘缓琛ㄦ牸鍒楁牱寮� + * + * @param styles 鑷畾涔夋牱寮忓垪琛� + * @param field 灞炴�у垪淇℃伅 + * @param excel 娉ㄨВ淇℃伅 + */ + public void annotationDataStyles(Map<String, CellStyle> styles, Field field, Excel excel) + { + String key = StringUtils.format("data_{}_{}_{}_{}", excel.align(), excel.color(), excel.backgroundColor(), excel.cellType()); + if (!styles.containsKey(key)) + { + CellStyle style = wb.createCellStyle(); + style.setAlignment(excel.align()); + style.setVerticalAlignment(VerticalAlignment.CENTER); + style.setBorderRight(BorderStyle.THIN); + style.setRightBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); + style.setBorderLeft(BorderStyle.THIN); + style.setLeftBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); + style.setBorderTop(BorderStyle.THIN); + style.setTopBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); + style.setBorderBottom(BorderStyle.THIN); + style.setBottomBorderColor(IndexedColors.GREY_50_PERCENT.getIndex()); + style.setFillPattern(FillPatternType.SOLID_FOREGROUND); + style.setFillForegroundColor(excel.backgroundColor().getIndex()); + Font dataFont = wb.createFont(); + dataFont.setFontName("Arial"); + dataFont.setFontHeightInPoints((short) 10); + dataFont.setColor(excel.color().index); + style.setFont(dataFont); + if (Excel.ColumnType.TEXT == excel.cellType()) + { + DataFormat dataFormat = wb.createDataFormat(); + style.setDataFormat(dataFormat.getFormat("@")); + } + styles.put(key, style); + } + } + + /** + * 鍒涘缓鍗曞厓鏍� + */ + public Cell createHeadCell(Excel attr, Row row, int column) + { + // 鍒涘缓鍒� + Cell cell = row.createCell(column); + // 鍐欏叆鍒椾俊鎭� + cell.setCellValue(attr.name()); + setDataValidation(attr, row, column); + cell.setCellStyle(styles.get(StringUtils.format("header_{}_{}", attr.headerColor(), attr.headerBackgroundColor()))); + if (isSubList()) + { + // 濉厖榛樿鏍峰紡锛岄槻姝㈠悎骞跺崟鍏冩牸鏍峰紡澶辨晥 + sheet.setDefaultColumnStyle(column, styles.get(StringUtils.format("data_{}_{}_{}_{}", attr.align(), attr.color(), attr.backgroundColor(), attr.cellType()))); + if (attr.needMerge()) + { + sheet.addMergedRegion(new CellRangeAddress(rownum - 1, rownum, column, column)); + } + } + return cell; + } + + /** + * 璁剧疆鍗曞厓鏍间俊鎭� + * + * @param value 鍗曞厓鏍煎�� + * @param attr 娉ㄨВ鐩稿叧 + * @param cell 鍗曞厓鏍间俊鎭� + */ + public void setCellVo(Object value, Excel attr, Cell cell) + { + if (Excel.ColumnType.STRING == attr.cellType() || Excel.ColumnType.TEXT == attr.cellType()) + { + String cellValue = Convert.toStr(value); + // 瀵逛簬浠讳綍浠ヨ〃杈惧紡瑙﹀彂瀛楃 =-+@寮�澶寸殑鍗曞厓鏍硷紝鐩存帴浣跨敤tab瀛楃浣滀负鍓嶇紑锛岄槻姝SV娉ㄥ叆銆� + if (StringUtils.startsWithAny(cellValue, FORMULA_STR)) + { + cellValue = RegExUtils.replaceFirst(cellValue, FORMULA_REGEX_STR, "\t$0"); + } + if (value instanceof Collection && StringUtils.equals("[]", cellValue)) + { + cellValue = StringUtils.EMPTY; + } + cell.setCellValue(StringUtils.isNull(cellValue) ? attr.defaultValue() : cellValue + attr.suffix()); + } + else if (Excel.ColumnType.NUMERIC == attr.cellType()) + { + if (StringUtils.isNotNull(value)) + { + cell.setCellValue(StringUtils.contains(Convert.toStr(value), ".") ? Convert.toDouble(value) : Convert.toInt(value)); + } + } + else if (Excel.ColumnType.IMAGE == attr.cellType()) + { + ClientAnchor anchor = new XSSFClientAnchor(0, 0, 0, 0, (short) cell.getColumnIndex(), cell.getRow().getRowNum(), (short) (cell.getColumnIndex() + 1), cell.getRow().getRowNum() + 1); + String imagePath = Convert.toStr(value); + if (StringUtils.isNotEmpty(imagePath)) + { + byte[] data = ImageUtils.getImage(imagePath); + getDrawingPatriarch(cell.getSheet()).createPicture(anchor, + cell.getSheet().getWorkbook().addPicture(data, getImageType(data))); + } + } + } + + /** + * 鑾峰彇鐢诲竷 + */ + public static Drawing<?> getDrawingPatriarch(Sheet sheet) + { + if (sheet.getDrawingPatriarch() == null) + { + sheet.createDrawingPatriarch(); + } + return sheet.getDrawingPatriarch(); + } + + /** + * 鑾峰彇鍥剧墖绫诲瀷,璁剧疆鍥剧墖鎻掑叆绫诲瀷 + */ + public int getImageType(byte[] value) + { + String type = FileTypeUtils.getFileExtendName(value); + if ("JPG".equalsIgnoreCase(type)) + { + return Workbook.PICTURE_TYPE_JPEG; + } + else if ("PNG".equalsIgnoreCase(type)) + { + return Workbook.PICTURE_TYPE_PNG; + } + return Workbook.PICTURE_TYPE_JPEG; + } + + /** + * 鍒涘缓琛ㄦ牸鏍峰紡 + */ + public void setDataValidation(Excel attr, Row row, int column) + { + if (attr.name().indexOf("娉細") >= 0) + { + sheet.setColumnWidth(column, 6000); + } + else + { + // 璁剧疆鍒楀 + sheet.setColumnWidth(column, (int) ((attr.width() + 0.72) * 256)); + } + if (StringUtils.isNotEmpty(attr.prompt()) || attr.combo().length > 0) + { + if (attr.combo().length > 15 || StringUtils.join(attr.combo()).length() > 255) + { + // 濡傛灉涓嬫媺鏁板ぇ浜�15鎴栧瓧绗︿覆闀垮害澶т簬255锛屽垯浣跨敤涓�涓柊sheet瀛樺偍锛岄伩鍏嶇敓鎴愮殑妯℃澘涓嬫媺鍊艰幏鍙栦笉鍒� + setXSSFValidationWithHidden(sheet, attr.combo(), attr.prompt(), 1, 100, column, column); + } + else + { + // 鎻愮ず淇℃伅鎴栧彧鑳介�夋嫨涓嶈兘杈撳叆鐨勫垪鍐呭. + setPromptOrValidation(sheet, attr.combo(), attr.prompt(), 1, 100, column, column); + } + } + } + + /** + * 娣诲姞鍗曞厓鏍� + */ + public Cell addCell(Excel attr, Row row, T vo, Field field, int column) + { + Cell cell = null; + try + { + // 璁剧疆琛岄珮 + row.setHeight(maxHeight); + // 鏍规嵁Excel涓缃儏鍐靛喅瀹氭槸鍚﹀鍑�,鏈変簺鎯呭喌闇�瑕佷繚鎸佷负绌�,甯屾湜鐢ㄦ埛濉啓杩欎竴鍒�. + if (attr.isExport()) + { + // 鍒涘缓cell + cell = row.createCell(column); + if (isSubListValue(vo) && getListCellValue(vo).size() > 1 && attr.needMerge()) + { + CellRangeAddress cellAddress = new CellRangeAddress(subMergedFirstRowNum, subMergedLastRowNum, column, column); + sheet.addMergedRegion(cellAddress); + } + cell.setCellStyle(styles.get(StringUtils.format("data_{}_{}_{}_{}", attr.align(), attr.color(), attr.backgroundColor(), attr.cellType()))); + + // 鐢ㄤ簬璇诲彇瀵硅薄涓殑灞炴�� + Object value = getTargetValue(vo, field, attr); + String dateFormat = attr.dateFormat(); + String readConverterExp = attr.readConverterExp(); + String separator = attr.separator(); + if (StringUtils.isNotEmpty(dateFormat) && StringUtils.isNotNull(value)) + { + cell.setCellValue(parseDateToStr(dateFormat, value)); + } + else if (StringUtils.isNotEmpty(readConverterExp) && StringUtils.isNotNull(value)) + { + cell.setCellValue(convertByExp(Convert.toStr(value), readConverterExp, separator)); + } + else if (value instanceof BigDecimal && -1 != attr.scale()) + { + cell.setCellValue((((BigDecimal) value).setScale(attr.scale(), attr.roundingMode())).doubleValue()); + } + else if (!attr.handler().equals(ExcelHandlerAdapter.class)) + { + cell.setCellValue(dataFormatHandlerAdapter(value, attr, cell)); + } + else + { + // 璁剧疆鍒楃被鍨� + setCellVo(value, attr, cell); + } + addStatisticsData(column, Convert.toStr(value), attr); + } + } + catch (Exception e) + { + log.error("瀵煎嚭Excel澶辫触{}", e); + } + return cell; + } + + /** + * 璁剧疆 POI XSSFSheet 鍗曞厓鏍兼彁绀烘垨閫夋嫨妗� + * + * @param sheet 琛ㄥ崟 + * @param textlist 涓嬫媺妗嗘樉绀虹殑鍐呭 + * @param promptContent 鎻愮ず鍐呭 + * @param firstRow 寮�濮嬭 + * @param endRow 缁撴潫琛� + * @param firstCol 寮�濮嬪垪 + * @param endCol 缁撴潫鍒� + */ + public void setPromptOrValidation(Sheet sheet, String[] textlist, String promptContent, int firstRow, int endRow, + int firstCol, int endCol) + { + DataValidationHelper helper = sheet.getDataValidationHelper(); + DataValidationConstraint constraint = textlist.length > 0 ? helper.createExplicitListConstraint(textlist) : helper.createCustomConstraint("DD1"); + CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol); + DataValidation dataValidation = helper.createValidation(constraint, regions); + if (StringUtils.isNotEmpty(promptContent)) + { + // 濡傛灉璁剧疆浜嗘彁绀轰俊鎭垯榧犳爣鏀句笂鍘绘彁绀� + dataValidation.createPromptBox("", promptContent); + dataValidation.setShowPromptBox(true); + } + // 澶勭悊Excel鍏煎鎬ч棶棰� + if (dataValidation instanceof XSSFDataValidation) + { + dataValidation.setSuppressDropDownArrow(true); + dataValidation.setShowErrorBox(true); + } + else + { + dataValidation.setSuppressDropDownArrow(false); + } + sheet.addValidationData(dataValidation); + } + + /** + * 璁剧疆鏌愪簺鍒楃殑鍊煎彧鑳借緭鍏ラ鍒剁殑鏁版嵁,鏄剧ず涓嬫媺妗嗭紙鍏煎瓒呭嚭涓�瀹氭暟閲忕殑涓嬫媺妗嗭級. + * + * @param sheet 瑕佽缃殑sheet. + * @param textlist 涓嬫媺妗嗘樉绀虹殑鍐呭 + * @param promptContent 鎻愮ず鍐呭 + * @param firstRow 寮�濮嬭 + * @param endRow 缁撴潫琛� + * @param firstCol 寮�濮嬪垪 + * @param endCol 缁撴潫鍒� + */ + public void setXSSFValidationWithHidden(Sheet sheet, String[] textlist, String promptContent, int firstRow, int endRow, int firstCol, int endCol) + { + String hideSheetName = "combo_" + firstCol + "_" + endCol; + Sheet hideSheet = wb.createSheet(hideSheetName); // 鐢ㄤ簬瀛樺偍 涓嬫媺鑿滃崟鏁版嵁 + for (int i = 0; i < textlist.length; i++) + { + hideSheet.createRow(i).createCell(0).setCellValue(textlist[i]); + } + // 鍒涘缓鍚嶇О锛屽彲琚叾浠栧崟鍏冩牸寮曠敤 + Name name = wb.createName(); + name.setNameName(hideSheetName + "_data"); + name.setRefersToFormula(hideSheetName + "!$A$1:$A$" + textlist.length); + DataValidationHelper helper = sheet.getDataValidationHelper(); + // 鍔犺浇涓嬫媺鍒楄〃鍐呭 + DataValidationConstraint constraint = helper.createFormulaListConstraint(hideSheetName + "_data"); + // 璁剧疆鏁版嵁鏈夋晥鎬у姞杞藉湪鍝釜鍗曞厓鏍间笂,鍥涗釜鍙傛暟鍒嗗埆鏄細璧峰琛屻�佺粓姝㈣銆佽捣濮嬪垪銆佺粓姝㈠垪 + CellRangeAddressList regions = new CellRangeAddressList(firstRow, endRow, firstCol, endCol); + // 鏁版嵁鏈夋晥鎬у璞� + DataValidation dataValidation = helper.createValidation(constraint, regions); + if (StringUtils.isNotEmpty(promptContent)) + { + // 濡傛灉璁剧疆浜嗘彁绀轰俊鎭垯榧犳爣鏀句笂鍘绘彁绀� + dataValidation.createPromptBox("", promptContent); + dataValidation.setShowPromptBox(true); + } + // 澶勭悊Excel鍏煎鎬ч棶棰� + if (dataValidation instanceof XSSFDataValidation) + { + dataValidation.setSuppressDropDownArrow(true); + dataValidation.setShowErrorBox(true); + } + else + { + dataValidation.setSuppressDropDownArrow(false); + } + + sheet.addValidationData(dataValidation); + // 璁剧疆hiddenSheet闅愯棌 + wb.setSheetHidden(wb.getSheetIndex(hideSheet), true); + } + + /** + * 瑙f瀽瀵煎嚭鍊� 0=鐢�,1=濂�,2=鏈煡 + * + * @param propertyValue 鍙傛暟鍊� + * @param converterExp 缈昏瘧娉ㄨВ + * @param separator 鍒嗛殧绗� + * @return 瑙f瀽鍚庡�� + */ + public static String convertByExp(String propertyValue, String converterExp, String separator) + { + StringBuilder propertyString = new StringBuilder(); + String[] convertSource = converterExp.split(","); + for (String item : convertSource) + { + String[] itemArray = item.split("="); + if (StringUtils.containsAny(propertyValue, separator)) + { + for (String value : propertyValue.split(separator)) + { + if (itemArray[0].equals(value)) + { + propertyString.append(itemArray[1] + separator); + break; + } + } + } + else + { + if (itemArray[0].equals(propertyValue)) + { + return itemArray[1]; + } + } + } + return StringUtils.stripEnd(propertyString.toString(), separator); + } + + /** + * 鍙嶅悜瑙f瀽鍊� 鐢�=0,濂�=1,鏈煡=2 + * + * @param propertyValue 鍙傛暟鍊� + * @param converterExp 缈昏瘧娉ㄨВ + * @param separator 鍒嗛殧绗� + * @return 瑙f瀽鍚庡�� + */ + public static String reverseByExp(String propertyValue, String converterExp, String separator) + { + StringBuilder propertyString = new StringBuilder(); + String[] convertSource = converterExp.split(","); + for (String item : convertSource) + { + String[] itemArray = item.split("="); + if (StringUtils.containsAny(propertyValue, separator)) + { + for (String value : propertyValue.split(separator)) + { + if (itemArray[1].equals(value)) + { + propertyString.append(itemArray[0] + separator); + break; + } + } + } + else + { + if (itemArray[1].equals(propertyValue)) + { + return itemArray[0]; + } + } + } + return StringUtils.stripEnd(propertyString.toString(), separator); + } + + /** + * 鏁版嵁澶勭悊鍣� + * + * @param value 鏁版嵁鍊� + * @param excel 鏁版嵁娉ㄨВ + * @return + */ + public String dataFormatHandlerAdapter(Object value, Excel excel, Cell cell) + { + try + { + Object instance = excel.handler().newInstance(); + Method formatMethod = excel.handler().getMethod("format", new Class[] { Object.class, String[].class, Cell.class, Workbook.class }); + value = formatMethod.invoke(instance, value, excel.args(), cell, this.wb); + } + catch (Exception e) + { + log.error("涓嶈兘鏍煎紡鍖栨暟鎹� " + excel.handler(), e.getMessage()); + } + return Convert.toStr(value); + } + + /** + * 鍚堣缁熻淇℃伅 + */ + private void addStatisticsData(Integer index, String text, Excel entity) + { + if (entity != null && entity.isStatistics()) + { + Double temp = 0D; + if (!statistics.containsKey(index)) + { + statistics.put(index, temp); + } + try + { + temp = Double.valueOf(text); + } + catch (NumberFormatException e) + { + } + statistics.put(index, statistics.get(index) + temp); + } + } + + /** + * 鍒涘缓缁熻琛� + */ + public void addStatisticsRow() + { + if (statistics.size() > 0) + { + Row row = sheet.createRow(sheet.getLastRowNum() + 1); + Set<Integer> keys = statistics.keySet(); + Cell cell = row.createCell(0); + cell.setCellStyle(styles.get("total")); + cell.setCellValue("鍚堣"); + + for (Integer key : keys) + { + cell = row.createCell(key); + cell.setCellStyle(styles.get("total")); + cell.setCellValue(DOUBLE_FORMAT.format(statistics.get(key))); + } + statistics.clear(); + } + } + + /** + * 鑾峰彇bean涓殑灞炴�у�� + * + * @param vo 瀹炰綋瀵硅薄 + * @param field 瀛楁 + * @param excel 娉ㄨВ + * @return 鏈�缁堢殑灞炴�у�� + * @throws Exception + */ + private Object getTargetValue(T vo, Field field, Excel excel) throws Exception + { + Object o = field.get(vo); + if (StringUtils.isNotEmpty(excel.targetAttr())) + { + String target = excel.targetAttr(); + if (target.contains(".")) + { + String[] targets = target.split("[.]"); + for (String name : targets) + { + o = getValue(o, name); + } + } + else + { + o = getValue(o, target); + } + } + return o; + } + + /** + * 浠ョ被鐨勫睘鎬х殑get鏂规硶鏂规硶褰㈠紡鑾峰彇鍊� + * + * @param o + * @param name + * @return value + * @throws Exception + */ + private Object getValue(Object o, String name) throws Exception + { + if (StringUtils.isNotNull(o) && StringUtils.isNotEmpty(name)) + { + Class<?> clazz = o.getClass(); + Field field = clazz.getDeclaredField(name); + field.setAccessible(true); + o = field.get(o); + } + return o; + } + + /** + * 寰楀埌鎵�鏈夊畾涔夊瓧娈� + */ + private void createExcelField() + { + this.fields = getFields(); + this.fields = this.fields.stream().sorted(Comparator.comparing(objects -> ((Excel) objects[1]).sort())).collect(Collectors.toList()); + this.maxHeight = getRowHeight(); + } + + /** + * 鑾峰彇瀛楁娉ㄨВ淇℃伅 + */ + public List<Object[]> getFields() + { + List<Object[]> fields = new ArrayList<Object[]>(); + List<Field> tempFields = new ArrayList<>(); + tempFields.addAll(Arrays.asList(clazz.getSuperclass().getDeclaredFields())); + tempFields.addAll(Arrays.asList(clazz.getDeclaredFields())); + for (Field field : tempFields) + { + if (!ArrayUtils.contains(this.excludeFields, field.getName())) + { + // 鍗曟敞瑙� + if (field.isAnnotationPresent(Excel.class)) + { + Excel attr = field.getAnnotation(Excel.class); + if (attr != null && (attr.type() == Excel.Type.ALL || attr.type() == type)) + { + field.setAccessible(true); + fields.add(new Object[] { field, attr }); + } + if (Collection.class.isAssignableFrom(field.getType())) + { + subMethod = getSubMethod(field.getName(), clazz); + ParameterizedType pt = (ParameterizedType) field.getGenericType(); + Class<?> subClass = (Class<?>) pt.getActualTypeArguments()[0]; + this.subFields = FieldUtils.getFieldsListWithAnnotation(subClass, Excel.class); + } + } + + // 澶氭敞瑙� + if (field.isAnnotationPresent(Excels.class)) + { + Excels attrs = field.getAnnotation(Excels.class); + Excel[] excels = attrs.value(); + for (Excel attr : excels) + { + if (!ArrayUtils.contains(this.excludeFields, field.getName() + "." + attr.targetAttr()) + && (attr != null && (attr.type() == Excel.Type.ALL || attr.type() == type))) + { + field.setAccessible(true); + fields.add(new Object[] { field, attr }); + } + } + } + } + } + return fields; + } + + /** + * 鏍规嵁娉ㄨВ鑾峰彇鏈�澶ц楂� + */ + public short getRowHeight() + { + double maxHeight = 0; + for (Object[] os : this.fields) + { + Excel excel = (Excel) os[1]; + maxHeight = Math.max(maxHeight, excel.height()); + } + return (short) (maxHeight * 20); + } + + /** + * 鍒涘缓涓�涓伐浣滅翱 + */ + public void createWorkbook() + { + this.wb = new SXSSFWorkbook(500); + this.sheet = wb.createSheet(); + wb.setSheetName(0, sheetName); + this.styles = createStyles(wb); + } + + /** + * 鍒涘缓宸ヤ綔琛� + * + * @param sheetNo sheet鏁伴噺 + * @param index 搴忓彿 + */ + public void createSheet(int sheetNo, int index) + { + // 璁剧疆宸ヤ綔琛ㄧ殑鍚嶇О. + if (sheetNo > 1 && index > 0) + { + this.sheet = wb.createSheet(); + this.createTitle(); + wb.setSheetName(index, sheetName + index); + } + } + + /** + * 鑾峰彇鍗曞厓鏍煎�� + * + * @param row 鑾峰彇鐨勮 + * @param column 鑾峰彇鍗曞厓鏍煎垪鍙� + * @return 鍗曞厓鏍煎�� + */ + public Object getCellValue(Row row, int column) + { + if (row == null) + { + return row; + } + Object val = ""; + try + { + Cell cell = row.getCell(column); + if (StringUtils.isNotNull(cell)) + { + if (cell.getCellType() == CellType.NUMERIC || cell.getCellType() == CellType.FORMULA) + { + val = cell.getNumericCellValue(); + if (DateUtil.isCellDateFormatted(cell)) + { + val = DateUtil.getJavaDate((Double) val); // POI Excel 鏃ユ湡鏍煎紡杞崲 + } + else + { + if ((Double) val % 1 != 0) + { + val = new BigDecimal(val.toString()); + } + else + { + val = new DecimalFormat("0").format(val); + } + } + } + else if (cell.getCellType() == CellType.STRING) + { + val = cell.getStringCellValue(); + } + else if (cell.getCellType() == CellType.BOOLEAN) + { + val = cell.getBooleanCellValue(); + } + else if (cell.getCellType() == CellType.ERROR) + { + val = cell.getErrorCellValue(); + } + + } + } + catch (Exception e) + { + return val; + } + return val; + } + + /** + * 鍒ゆ柇鏄惁鏄┖琛� + * + * @param row 鍒ゆ柇鐨勮 + * @return + */ + private boolean isRowEmpty(Row row) + { + if (row == null) + { + return true; + } + for (int i = row.getFirstCellNum(); i < row.getLastCellNum(); i++) + { + Cell cell = row.getCell(i); + if (cell != null && cell.getCellType() != CellType.BLANK) + { + return false; + } + } + return true; + } + + /** + * 鏍煎紡鍖栦笉鍚岀被鍨嬬殑鏃ユ湡瀵硅薄 + * + * @param dateFormat 鏃ユ湡鏍煎紡 + * @param val 琚牸寮忓寲鐨勬棩鏈熷璞� + * @return 鏍煎紡鍖栧悗鐨勬棩鏈熷瓧绗� + */ + public String parseDateToStr(String dateFormat, Object val) + { + if (val == null) + { + return ""; + } + String str; + if (val instanceof Date) + { + str = DateUtils.parseDateToStr(dateFormat, (Date) val); + } + else if (val instanceof LocalDateTime) + { + str = DateUtils.parseDateToStr(dateFormat, DateUtils.toDate((LocalDateTime) val)); + } + else if (val instanceof LocalDate) + { + str = DateUtils.parseDateToStr(dateFormat, DateUtils.toDate((LocalDate) val)); + } + else + { + str = val.toString(); + } + return str; + } + + /** + * 鏄惁鏈夊璞$殑瀛愬垪琛� + */ + public boolean isSubList() + { + return StringUtils.isNotNull(subFields) && subFields.size() > 0; + } + + /** + * 鏄惁鏈夊璞$殑瀛愬垪琛紝闆嗗悎涓嶄负绌� + */ + public boolean isSubListValue(T vo) + { + return StringUtils.isNotNull(subFields) && subFields.size() > 0 && StringUtils.isNotNull(getListCellValue(vo)) && getListCellValue(vo).size() > 0; + } + + /** + * 鑾峰彇闆嗗悎鐨勫�� + */ + public Collection<?> getListCellValue(Object obj) + { + Object value; + try + { + value = subMethod.invoke(obj, new Object[] {}); + } + catch (Exception e) + { + return new ArrayList<Object>(); + } + return (Collection<?>) value; + } + + /** + * 鑾峰彇瀵硅薄鐨勫瓙鍒楄〃鏂规硶 + * + * @param name 鍚嶇О + * @param pojoClass 绫诲璞� + * @return 瀛愬垪琛ㄦ柟娉� + */ + public Method getSubMethod(String name, Class<?> pojoClass) + { + StringBuffer getMethodName = new StringBuffer("get"); + getMethodName.append(name.substring(0, 1).toUpperCase()); + getMethodName.append(name.substring(1)); + Method method = null; + try + { + method = pojoClass.getMethod(getMethodName.toString(), new Class[] {}); + } + catch (Exception e) + { + log.error("鑾峰彇瀵硅薄寮傚父{}", e.getMessage()); + } + return method; + } +} diff --git a/se-common/se-common-core/src/main/java/com/se/common/core/utils/reflect/ReflectUtils.java b/se-common/se-common-core/src/main/java/com/se/common/core/utils/reflect/ReflectUtils.java new file mode 100644 index 0000000..4edf4d0 --- /dev/null +++ b/se-common/se-common-core/src/main/java/com/se/common/core/utils/reflect/ReflectUtils.java @@ -0,0 +1,410 @@ +package com.se.common.core.utils.reflect; + +import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.lang.reflect.Modifier; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.util.Date; +import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.Validate; +import org.apache.poi.ss.usermodel.DateUtil; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import com.se.common.core.text.Convert; +import com.se.common.core.utils.DateUtils; + +/** + * 鍙嶅皠宸ュ叿绫�. 鎻愪緵璋冪敤getter/setter鏂规硶, 璁块棶绉佹湁鍙橀噺, 璋冪敤绉佹湁鏂规硶, 鑾峰彇娉涘瀷绫诲瀷Class, 琚獳OP杩囩殑鐪熷疄绫荤瓑宸ュ叿鍑芥暟. + * + * @author admin + */ +@SuppressWarnings("rawtypes") +public class ReflectUtils +{ + private static final String SETTER_PREFIX = "set"; + + private static final String GETTER_PREFIX = "get"; + + private static final String CGLIB_CLASS_SEPARATOR = "$$"; + + private static Logger logger = LoggerFactory.getLogger(ReflectUtils.class); + + /** + * 璋冪敤Getter鏂规硶. + * 鏀寔澶氱骇锛屽锛氬璞″悕.瀵硅薄鍚�.鏂规硶 + */ + @SuppressWarnings("unchecked") + public static <E> E invokeGetter(Object obj, String propertyName) + { + Object object = obj; + for (String name : StringUtils.split(propertyName, ".")) + { + String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(name); + object = invokeMethod(object, getterMethodName, new Class[] {}, new Object[] {}); + } + return (E) object; + } + + /** + * 璋冪敤Setter鏂规硶, 浠呭尮閰嶆柟娉曞悕銆� + * 鏀寔澶氱骇锛屽锛氬璞″悕.瀵硅薄鍚�.鏂规硶 + */ + public static <E> void invokeSetter(Object obj, String propertyName, E value) + { + Object object = obj; + String[] names = StringUtils.split(propertyName, "."); + for (int i = 0; i < names.length; i++) + { + if (i < names.length - 1) + { + String getterMethodName = GETTER_PREFIX + StringUtils.capitalize(names[i]); + object = invokeMethod(object, getterMethodName, new Class[] {}, new Object[] {}); + } + else + { + String setterMethodName = SETTER_PREFIX + StringUtils.capitalize(names[i]); + invokeMethodByName(object, setterMethodName, new Object[] { value }); + } + } + } + + /** + * 鐩存帴璇诲彇瀵硅薄灞炴�у��, 鏃犺private/protected淇グ绗�, 涓嶇粡杩噂etter鍑芥暟. + */ + @SuppressWarnings("unchecked") + public static <E> E getFieldValue(final Object obj, final String fieldName) + { + Field field = getAccessibleField(obj, fieldName); + if (field == null) + { + logger.debug("鍦� [" + obj.getClass() + "] 涓紝娌℃湁鎵惧埌 [" + fieldName + "] 瀛楁 "); + return null; + } + E result = null; + try + { + result = (E) field.get(obj); + } + catch (IllegalAccessException e) + { + logger.error("涓嶅彲鑳芥姏鍑虹殑寮傚父{}", e.getMessage()); + } + return result; + } + + /** + * 鐩存帴璁剧疆瀵硅薄灞炴�у��, 鏃犺private/protected淇グ绗�, 涓嶇粡杩噑etter鍑芥暟. + */ + public static <E> void setFieldValue(final Object obj, final String fieldName, final E value) + { + Field field = getAccessibleField(obj, fieldName); + if (field == null) + { + // throw new IllegalArgumentException("鍦� [" + obj.getClass() + "] 涓紝娌℃湁鎵惧埌 [" + fieldName + "] 瀛楁 "); + logger.debug("鍦� [" + obj.getClass() + "] 涓紝娌℃湁鎵惧埌 [" + fieldName + "] 瀛楁 "); + return; + } + try + { + field.set(obj, value); + } + catch (IllegalAccessException e) + { + logger.error("涓嶅彲鑳芥姏鍑虹殑寮傚父: {}", e.getMessage()); + } + } + + /** + * 鐩存帴璋冪敤瀵硅薄鏂规硶, 鏃犺private/protected淇グ绗�. + * 鐢ㄤ簬涓�娆℃�ц皟鐢ㄧ殑鎯呭喌锛屽惁鍒欏簲浣跨敤getAccessibleMethod()鍑芥暟鑾峰緱Method鍚庡弽澶嶈皟鐢�. + * 鍚屾椂鍖归厤鏂规硶鍚�+鍙傛暟绫诲瀷锛� + */ + @SuppressWarnings("unchecked") + public static <E> E invokeMethod(final Object obj, final String methodName, final Class<?>[] parameterTypes, + final Object[] args) + { + if (obj == null || methodName == null) + { + return null; + } + Method method = getAccessibleMethod(obj, methodName, parameterTypes); + if (method == null) + { + logger.debug("鍦� [" + obj.getClass() + "] 涓紝娌℃湁鎵惧埌 [" + methodName + "] 鏂规硶 "); + return null; + } + try + { + return (E) method.invoke(obj, args); + } + catch (Exception e) + { + String msg = "method: " + method + ", obj: " + obj + ", args: " + args + ""; + throw convertReflectionExceptionToUnchecked(msg, e); + } + } + + /** + * 鐩存帴璋冪敤瀵硅薄鏂规硶, 鏃犺private/protected淇グ绗︼紝 + * 鐢ㄤ簬涓�娆℃�ц皟鐢ㄧ殑鎯呭喌锛屽惁鍒欏簲浣跨敤getAccessibleMethodByName()鍑芥暟鑾峰緱Method鍚庡弽澶嶈皟鐢�. + * 鍙尮閰嶅嚱鏁板悕锛屽鏋滄湁澶氫釜鍚屽悕鍑芥暟璋冪敤绗竴涓�� + */ + @SuppressWarnings("unchecked") + public static <E> E invokeMethodByName(final Object obj, final String methodName, final Object[] args) + { + Method method = getAccessibleMethodByName(obj, methodName, args.length); + if (method == null) + { + // 濡傛灉涓虹┖涓嶆姤閿欙紝鐩存帴杩斿洖绌恒�� + logger.debug("鍦� [" + obj.getClass() + "] 涓紝娌℃湁鎵惧埌 [" + methodName + "] 鏂规硶 "); + return null; + } + try + { + // 绫诲瀷杞崲锛堝皢鍙傛暟鏁版嵁绫诲瀷杞崲涓虹洰鏍囨柟娉曞弬鏁扮被鍨嬶級 + Class<?>[] cs = method.getParameterTypes(); + for (int i = 0; i < cs.length; i++) + { + if (args[i] != null && !args[i].getClass().equals(cs[i])) + { + if (cs[i] == String.class) + { + args[i] = Convert.toStr(args[i]); + if (StringUtils.endsWith((String) args[i], ".0")) + { + args[i] = StringUtils.substringBefore((String) args[i], ".0"); + } + } + else if (cs[i] == Integer.class) + { + args[i] = Convert.toInt(args[i]); + } + else if (cs[i] == Long.class) + { + args[i] = Convert.toLong(args[i]); + } + else if (cs[i] == Double.class) + { + args[i] = Convert.toDouble(args[i]); + } + else if (cs[i] == Float.class) + { + args[i] = Convert.toFloat(args[i]); + } + else if (cs[i] == Date.class) + { + if (args[i] instanceof String) + { + args[i] = DateUtils.parseDate(args[i]); + } + else + { + args[i] = DateUtil.getJavaDate((Double) args[i]); + } + } + else if (cs[i] == boolean.class || cs[i] == Boolean.class) + { + args[i] = Convert.toBool(args[i]); + } + } + } + return (E) method.invoke(obj, args); + } + catch (Exception e) + { + String msg = "method: " + method + ", obj: " + obj + ", args: " + args + ""; + throw convertReflectionExceptionToUnchecked(msg, e); + } + } + + /** + * 寰幆鍚戜笂杞瀷, 鑾峰彇瀵硅薄鐨凞eclaredField, 骞跺己鍒惰缃负鍙闂�. + * 濡傚悜涓婅浆鍨嬪埌Object浠嶆棤娉曟壘鍒�, 杩斿洖null. + */ + public static Field getAccessibleField(final Object obj, final String fieldName) + { + // 涓虹┖涓嶆姤閿欍�傜洿鎺ヨ繑鍥� null + if (obj == null) + { + return null; + } + Validate.notBlank(fieldName, "fieldName can't be blank"); + for (Class<?> superClass = obj.getClass(); superClass != Object.class; superClass = superClass.getSuperclass()) + { + try + { + Field field = superClass.getDeclaredField(fieldName); + makeAccessible(field); + return field; + } + catch (NoSuchFieldException e) + { + continue; + } + } + return null; + } + + /** + * 寰幆鍚戜笂杞瀷, 鑾峰彇瀵硅薄鐨凞eclaredMethod,骞跺己鍒惰缃负鍙闂�. + * 濡傚悜涓婅浆鍨嬪埌Object浠嶆棤娉曟壘鍒�, 杩斿洖null. + * 鍖归厤鍑芥暟鍚�+鍙傛暟绫诲瀷銆� + * 鐢ㄤ簬鏂规硶闇�瑕佽澶氭璋冪敤鐨勬儏鍐�. 鍏堜娇鐢ㄦ湰鍑芥暟鍏堝彇寰桵ethod,鐒跺悗璋冪敤Method.invoke(Object obj, Object... args) + */ + public static Method getAccessibleMethod(final Object obj, final String methodName, + final Class<?>... parameterTypes) + { + // 涓虹┖涓嶆姤閿欍�傜洿鎺ヨ繑鍥� null + if (obj == null) + { + return null; + } + Validate.notBlank(methodName, "methodName can't be blank"); + for (Class<?> searchType = obj.getClass(); searchType != Object.class; searchType = searchType.getSuperclass()) + { + try + { + Method method = searchType.getDeclaredMethod(methodName, parameterTypes); + makeAccessible(method); + return method; + } + catch (NoSuchMethodException e) + { + continue; + } + } + return null; + } + + /** + * 寰幆鍚戜笂杞瀷, 鑾峰彇瀵硅薄鐨凞eclaredMethod,骞跺己鍒惰缃负鍙闂�. + * 濡傚悜涓婅浆鍨嬪埌Object浠嶆棤娉曟壘鍒�, 杩斿洖null. + * 鍙尮閰嶅嚱鏁板悕銆� + * 鐢ㄤ簬鏂规硶闇�瑕佽澶氭璋冪敤鐨勬儏鍐�. 鍏堜娇鐢ㄦ湰鍑芥暟鍏堝彇寰桵ethod,鐒跺悗璋冪敤Method.invoke(Object obj, Object... args) + */ + public static Method getAccessibleMethodByName(final Object obj, final String methodName, int argsNum) + { + // 涓虹┖涓嶆姤閿欍�傜洿鎺ヨ繑鍥� null + if (obj == null) + { + return null; + } + Validate.notBlank(methodName, "methodName can't be blank"); + for (Class<?> searchType = obj.getClass(); searchType != Object.class; searchType = searchType.getSuperclass()) + { + Method[] methods = searchType.getDeclaredMethods(); + for (Method method : methods) + { + if (method.getName().equals(methodName) && method.getParameterTypes().length == argsNum) + { + makeAccessible(method); + return method; + } + } + } + return null; + } + + /** + * 鏀瑰彉private/protected鐨勬柟娉曚负public锛屽敖閲忎笉璋冪敤瀹為檯鏀瑰姩鐨勮鍙ワ紝閬垮厤JDK鐨凷ecurityManager鎶辨�ㄣ�� + */ + public static void makeAccessible(Method method) + { + if ((!Modifier.isPublic(method.getModifiers()) || !Modifier.isPublic(method.getDeclaringClass().getModifiers())) + && !method.isAccessible()) + { + method.setAccessible(true); + } + } + + /** + * 鏀瑰彉private/protected鐨勬垚鍛樺彉閲忎负public锛屽敖閲忎笉璋冪敤瀹為檯鏀瑰姩鐨勮鍙ワ紝閬垮厤JDK鐨凷ecurityManager鎶辨�ㄣ�� + */ + public static void makeAccessible(Field field) + { + if ((!Modifier.isPublic(field.getModifiers()) || !Modifier.isPublic(field.getDeclaringClass().getModifiers()) + || Modifier.isFinal(field.getModifiers())) && !field.isAccessible()) + { + field.setAccessible(true); + } + } + + /** + * 閫氳繃鍙嶅皠, 鑾峰緱Class瀹氫箟涓0鏄庣殑娉涘瀷鍙傛暟鐨勭被鍨�, 娉ㄦ剰娉涘瀷蹇呴』瀹氫箟鍦ㄧ埗绫诲 + * 濡傛棤娉曟壘鍒�, 杩斿洖Object.class. + */ + @SuppressWarnings("unchecked") + public static <T> Class<T> getClassGenricType(final Class clazz) + { + return getClassGenricType(clazz, 0); + } + + /** + * 閫氳繃鍙嶅皠, 鑾峰緱Class瀹氫箟涓0鏄庣殑鐖剁被鐨勬硾鍨嬪弬鏁扮殑绫诲瀷. + * 濡傛棤娉曟壘鍒�, 杩斿洖Object.class. + */ + public static Class getClassGenricType(final Class clazz, final int index) + { + Type genType = clazz.getGenericSuperclass(); + + if (!(genType instanceof ParameterizedType)) + { + logger.debug(clazz.getSimpleName() + "'s superclass not ParameterizedType"); + return Object.class; + } + + Type[] params = ((ParameterizedType) genType).getActualTypeArguments(); + + if (index >= params.length || index < 0) + { + logger.debug("Index: " + index + ", Size of " + clazz.getSimpleName() + "'s Parameterized Type: " + + params.length); + return Object.class; + } + if (!(params[index] instanceof Class)) + { + logger.debug(clazz.getSimpleName() + " not set the actual class on superclass generic parameter"); + return Object.class; + } + + return (Class) params[index]; + } + + public static Class<?> getUserClass(Object instance) + { + if (instance == null) + { + throw new RuntimeException("Instance must not be null"); + } + Class clazz = instance.getClass(); + if (clazz != null && clazz.getName().contains(CGLIB_CLASS_SEPARATOR)) + { + Class<?> superClass = clazz.getSuperclass(); + if (superClass != null && !Object.class.equals(superClass)) + { + return superClass; + } + } + return clazz; + + } + + /** + * 灏嗗弽灏勬椂鐨刢hecked exception杞崲涓簎nchecked exception. + */ + public static RuntimeException convertReflectionExceptionToUnchecked(String msg, Exception e) + { + if (e instanceof IllegalAccessException || e instanceof IllegalArgumentException + || e instanceof NoSuchMethodException) + { + return new IllegalArgumentException(msg, e); + } + else if (e instanceof InvocationTargetException) + { + return new RuntimeException(msg, ((InvocationTargetException) e).getTargetException()); + } + return new RuntimeException(msg, e); + } +} diff --git a/se-common/se-common-core/src/main/java/com/se/common/core/utils/sign/Base64.java b/se-common/se-common-core/src/main/java/com/se/common/core/utils/sign/Base64.java new file mode 100644 index 0000000..2bd161e --- /dev/null +++ b/se-common/se-common-core/src/main/java/com/se/common/core/utils/sign/Base64.java @@ -0,0 +1,291 @@ +package com.se.common.core.utils.sign; + +/** + * Base64宸ュ叿绫� + * + * @author admin + */ +public final class Base64 +{ + static private final int BASELENGTH = 128; + static private final int LOOKUPLENGTH = 64; + static private final int TWENTYFOURBITGROUP = 24; + static private final int EIGHTBIT = 8; + static private final int SIXTEENBIT = 16; + static private final int FOURBYTE = 4; + static private final int SIGN = -128; + static private final char PAD = '='; + static final private byte[] base64Alphabet = new byte[BASELENGTH]; + static final private char[] lookUpBase64Alphabet = new char[LOOKUPLENGTH]; + + static + { + for (int i = 0; i < BASELENGTH; ++i) + { + base64Alphabet[i] = -1; + } + for (int i = 'Z'; i >= 'A'; i--) + { + base64Alphabet[i] = (byte) (i - 'A'); + } + for (int i = 'z'; i >= 'a'; i--) + { + base64Alphabet[i] = (byte) (i - 'a' + 26); + } + + for (int i = '9'; i >= '0'; i--) + { + base64Alphabet[i] = (byte) (i - '0' + 52); + } + + base64Alphabet['+'] = 62; + base64Alphabet['/'] = 63; + + for (int i = 0; i <= 25; i++) + { + lookUpBase64Alphabet[i] = (char) ('A' + i); + } + + for (int i = 26, j = 0; i <= 51; i++, j++) + { + lookUpBase64Alphabet[i] = (char) ('a' + j); + } + + for (int i = 52, j = 0; i <= 61; i++, j++) + { + lookUpBase64Alphabet[i] = (char) ('0' + j); + } + lookUpBase64Alphabet[62] = (char) '+'; + lookUpBase64Alphabet[63] = (char) '/'; + } + + private static boolean isWhiteSpace(char octect) + { + return (octect == 0x20 || octect == 0xd || octect == 0xa || octect == 0x9); + } + + private static boolean isPad(char octect) + { + return (octect == PAD); + } + + private static boolean isData(char octect) + { + return (octect < BASELENGTH && base64Alphabet[octect] != -1); + } + + /** + * Encodes hex octects into Base64 + * + * @param binaryData Array containing binaryData + * @return Encoded Base64 array + */ + public static String encode(byte[] binaryData) + { + if (binaryData == null) + { + return null; + } + + int lengthDataBits = binaryData.length * EIGHTBIT; + if (lengthDataBits == 0) + { + return ""; + } + + int fewerThan24bits = lengthDataBits % TWENTYFOURBITGROUP; + int numberTriplets = lengthDataBits / TWENTYFOURBITGROUP; + int numberQuartet = fewerThan24bits != 0 ? numberTriplets + 1 : numberTriplets; + char encodedData[] = null; + + encodedData = new char[numberQuartet * 4]; + + byte k = 0, l = 0, b1 = 0, b2 = 0, b3 = 0; + + int encodedIndex = 0; + int dataIndex = 0; + + for (int i = 0; i < numberTriplets; i++) + { + b1 = binaryData[dataIndex++]; + b2 = binaryData[dataIndex++]; + b3 = binaryData[dataIndex++]; + + l = (byte) (b2 & 0x0f); + k = (byte) (b1 & 0x03); + + byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); + byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0); + byte val3 = ((b3 & SIGN) == 0) ? (byte) (b3 >> 6) : (byte) ((b3) >> 6 ^ 0xfc); + + encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[(l << 2) | val3]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[b3 & 0x3f]; + } + + // form integral number of 6-bit groups + if (fewerThan24bits == EIGHTBIT) + { + b1 = binaryData[dataIndex]; + k = (byte) (b1 & 0x03); + byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); + encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[k << 4]; + encodedData[encodedIndex++] = PAD; + encodedData[encodedIndex++] = PAD; + } + else if (fewerThan24bits == SIXTEENBIT) + { + b1 = binaryData[dataIndex]; + b2 = binaryData[dataIndex + 1]; + l = (byte) (b2 & 0x0f); + k = (byte) (b1 & 0x03); + + byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); + byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0); + + encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)]; + encodedData[encodedIndex++] = lookUpBase64Alphabet[l << 2]; + encodedData[encodedIndex++] = PAD; + } + return new String(encodedData); + } + + /** + * Decodes Base64 data into octects + * + * @param encoded string containing Base64 data + * @return Array containind decoded data. + */ + public static byte[] decode(String encoded) + { + if (encoded == null) + { + return null; + } + + char[] base64Data = encoded.toCharArray(); + // remove white spaces + int len = removeWhiteSpace(base64Data); + + if (len % FOURBYTE != 0) + { + return null;// should be divisible by four + } + + int numberQuadruple = (len / FOURBYTE); + + if (numberQuadruple == 0) + { + return new byte[0]; + } + + byte decodedData[] = null; + byte b1 = 0, b2 = 0, b3 = 0, b4 = 0; + char d1 = 0, d2 = 0, d3 = 0, d4 = 0; + + int i = 0; + int encodedIndex = 0; + int dataIndex = 0; + decodedData = new byte[(numberQuadruple) * 3]; + + for (; i < numberQuadruple - 1; i++) + { + + if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++])) + || !isData((d3 = base64Data[dataIndex++])) || !isData((d4 = base64Data[dataIndex++]))) + { + return null; + } // if found "no data" just return null + + b1 = base64Alphabet[d1]; + b2 = base64Alphabet[d2]; + b3 = base64Alphabet[d3]; + b4 = base64Alphabet[d4]; + + decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); + decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); + decodedData[encodedIndex++] = (byte) (b3 << 6 | b4); + } + + if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))) + { + return null;// if found "no data" just return null + } + + b1 = base64Alphabet[d1]; + b2 = base64Alphabet[d2]; + + d3 = base64Data[dataIndex++]; + d4 = base64Data[dataIndex++]; + if (!isData((d3)) || !isData((d4))) + {// Check if they are PAD characters + if (isPad(d3) && isPad(d4)) + { + if ((b2 & 0xf) != 0)// last 4 bits should be zero + { + return null; + } + byte[] tmp = new byte[i * 3 + 1]; + System.arraycopy(decodedData, 0, tmp, 0, i * 3); + tmp[encodedIndex] = (byte) (b1 << 2 | b2 >> 4); + return tmp; + } + else if (!isPad(d3) && isPad(d4)) + { + b3 = base64Alphabet[d3]; + if ((b3 & 0x3) != 0)// last 2 bits should be zero + { + return null; + } + byte[] tmp = new byte[i * 3 + 2]; + System.arraycopy(decodedData, 0, tmp, 0, i * 3); + tmp[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); + tmp[encodedIndex] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); + return tmp; + } + else + { + return null; + } + } + else + { // No PAD e.g 3cQl + b3 = base64Alphabet[d3]; + b4 = base64Alphabet[d4]; + decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); + decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); + decodedData[encodedIndex++] = (byte) (b3 << 6 | b4); + + } + return decodedData; + } + + /** + * remove WhiteSpace from MIME containing encoded Base64 data. + * + * @param data the byte array of base64 data (with WS) + * @return the new length + */ + private static int removeWhiteSpace(char[] data) + { + if (data == null) + { + return 0; + } + + // count characters that's not whitespace + int newSize = 0; + int len = data.length; + for (int i = 0; i < len; i++) + { + if (!isWhiteSpace(data[i])) + { + data[newSize++] = data[i]; + } + } + return newSize; + } +} diff --git a/se-common/se-common-core/src/main/java/com/se/common/core/utils/sql/SqlUtil.java b/se-common/se-common-core/src/main/java/com/se/common/core/utils/sql/SqlUtil.java new file mode 100644 index 0000000..1aa9edd --- /dev/null +++ b/se-common/se-common-core/src/main/java/com/se/common/core/utils/sql/SqlUtil.java @@ -0,0 +1,70 @@ +package com.se.common.core.utils.sql; + +import com.se.common.core.exception.UtilException; +import com.se.common.core.utils.StringUtils; + +/** + * sql鎿嶄綔宸ュ叿绫� + * + * @author admin + */ +public class SqlUtil +{ + /** + * 瀹氫箟甯哥敤鐨� sql鍏抽敭瀛� + */ + public static String SQL_REGEX = "and |extractvalue|updatexml|exec |insert |select |delete |update |drop |count |chr |mid |master |truncate |char |declare |or |+|user()"; + + /** + * 浠呮敮鎸佸瓧姣嶃�佹暟瀛椼�佷笅鍒掔嚎銆佺┖鏍笺�侀�楀彿銆佸皬鏁扮偣锛堟敮鎸佸涓瓧娈垫帓搴忥級 + */ + public static String SQL_PATTERN = "[a-zA-Z0-9_\\ \\,\\.]+"; + + /** + * 闄愬埗orderBy鏈�澶ч暱搴� + */ + private static final int ORDER_BY_MAX_LENGTH = 500; + + /** + * 妫�鏌ュ瓧绗︼紝闃叉娉ㄥ叆缁曡繃 + */ + public static String escapeOrderBySql(String value) + { + if (StringUtils.isNotEmpty(value) && !isValidOrderBySql(value)) + { + throw new UtilException("鍙傛暟涓嶇鍚堣鑼冿紝涓嶈兘杩涜鏌ヨ"); + } + if (StringUtils.length(value) > ORDER_BY_MAX_LENGTH) + { + throw new UtilException("鍙傛暟宸茶秴杩囨渶澶ч檺鍒讹紝涓嶈兘杩涜鏌ヨ"); + } + return value; + } + + /** + * 楠岃瘉 order by 璇硶鏄惁绗﹀悎瑙勮寖 + */ + public static boolean isValidOrderBySql(String value) + { + return value.matches(SQL_PATTERN); + } + + /** + * SQL鍏抽敭瀛楁鏌� + */ + public static void filterKeyword(String value) + { + if (StringUtils.isEmpty(value)) + { + return; + } + String[] sqlKeywords = StringUtils.split(SQL_REGEX, "\\|"); + for (String sqlKeyword : sqlKeywords) + { + if (StringUtils.indexOfIgnoreCase(value, sqlKeyword) > -1) + { + throw new UtilException("鍙傛暟瀛樺湪SQL娉ㄥ叆椋庨櫓"); + } + } + } +} diff --git a/se-common/se-common-core/src/main/java/com/se/common/core/xss/Xss.java b/se-common/se-common-core/src/main/java/com/se/common/core/xss/Xss.java new file mode 100644 index 0000000..f7e2508 --- /dev/null +++ b/se-common/se-common-core/src/main/java/com/se/common/core/xss/Xss.java @@ -0,0 +1,27 @@ +package com.se.common.core.xss; + +import javax.validation.Constraint; +import javax.validation.Payload; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 鑷畾涔墄ss鏍¢獙娉ㄨВ + * + * @author admin + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(value = { ElementType.METHOD, ElementType.FIELD, ElementType.CONSTRUCTOR, ElementType.PARAMETER }) +@Constraint(validatedBy = { XssValidator.class }) +public @interface Xss +{ + String message() + + default "涓嶅厑璁镐换浣曡剼鏈繍琛�"; + + Class<?>[] groups() default {}; + + Class<? extends Payload>[] payload() default {}; +} diff --git a/se-common/se-common-core/src/main/java/com/se/common/core/xss/XssValidator.java b/se-common/se-common-core/src/main/java/com/se/common/core/xss/XssValidator.java new file mode 100644 index 0000000..8160cbb --- /dev/null +++ b/se-common/se-common-core/src/main/java/com/se/common/core/xss/XssValidator.java @@ -0,0 +1,39 @@ +package com.se.common.core.xss; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import javax.validation.ConstraintValidator; +import javax.validation.ConstraintValidatorContext; +import com.se.common.core.utils.StringUtils; + +/** + * 鑷畾涔墄ss鏍¢獙娉ㄨВ瀹炵幇 + * + * @author admin + */ +public class XssValidator implements ConstraintValidator<Xss, String> +{ + private static final String HTML_PATTERN = "<(\\S*?)[^>]*>.*?|<.*? />"; + + @Override + public boolean isValid(String value, ConstraintValidatorContext constraintValidatorContext) + { + if (StringUtils.isBlank(value)) + { + return true; + } + return !containsHtml(value); + } + + public static boolean containsHtml(String value) + { + StringBuilder sHtml = new StringBuilder(); + Pattern pattern = Pattern.compile(HTML_PATTERN); + Matcher matcher = pattern.matcher(value); + while (matcher.find()) + { + sHtml.append(matcher.group()); + } + return pattern.matcher(sHtml).matches(); + } +} \ No newline at end of file diff --git a/se-common/se-common-datascope/pom.xml b/se-common/se-common-datascope/pom.xml index cdd5fe8..93a3f39 100644 --- a/se-common/se-common-datascope/pom.xml +++ b/se-common/se-common-datascope/pom.xml @@ -9,10 +9,10 @@ </parent> <modelVersion>4.0.0</modelVersion> - <artifactId>ruoyi-common-datascope</artifactId> + <artifactId>se-common-datascope</artifactId> <description> - ruoyi-common-datascope鏉冮檺鑼冨洿 + se-common-datascope鏉冮檺鑼冨洿 </description> <dependencies> diff --git a/se-common/se-common-datascope/src/main/java/com/se/common/datascope/aspect/DataScopeAspect.java b/se-common/se-common-datascope/src/main/java/com/se/common/datascope/aspect/DataScopeAspect.java new file mode 100644 index 0000000..c75c177 --- /dev/null +++ b/se-common/se-common-datascope/src/main/java/com/se/common/datascope/aspect/DataScopeAspect.java @@ -0,0 +1,185 @@ +package com.se.common.datascope.aspect; + +import java.util.ArrayList; +import java.util.List; + +import com.se.common.datascope.annotation.DataScope; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; +import org.springframework.stereotype.Component; +import com.se.common.core.context.SecurityContextHolder; +import com.se.common.core.text.Convert; +import com.se.common.core.utils.StringUtils; +import com.se.common.core.web.domain.BaseEntity; +import com.se.common.security.utils.SecurityUtils; +import com.se.system.api.domain.SysRole; +import com.se.system.api.domain.SysUser; +import com.se.system.api.model.LoginUser; + +/** + * 鏁版嵁杩囨护澶勭悊 + * + * @author admin + */ +@Aspect +@Component +public class DataScopeAspect +{ + /** + * 鍏ㄩ儴鏁版嵁鏉冮檺 + */ + public static final String DATA_SCOPE_ALL = "1"; + + /** + * 鑷畾鏁版嵁鏉冮檺 + */ + public static final String DATA_SCOPE_CUSTOM = "2"; + + /** + * 閮ㄩ棬鏁版嵁鏉冮檺 + */ + public static final String DATA_SCOPE_DEPT = "3"; + + /** + * 閮ㄩ棬鍙婁互涓嬫暟鎹潈闄� + */ + public static final String DATA_SCOPE_DEPT_AND_CHILD = "4"; + + /** + * 浠呮湰浜烘暟鎹潈闄� + */ + public static final String DATA_SCOPE_SELF = "5"; + + /** + * 鏁版嵁鏉冮檺杩囨护鍏抽敭瀛� + */ + public static final String DATA_SCOPE = "dataScope"; + + @Before("@annotation(controllerDataScope)") + public void doBefore(JoinPoint point, DataScope controllerDataScope) throws Throwable + { + clearDataScope(point); + handleDataScope(point, controllerDataScope); + } + + protected void handleDataScope(final JoinPoint joinPoint, DataScope controllerDataScope) + { + // 鑾峰彇褰撳墠鐨勭敤鎴� + LoginUser loginUser = SecurityUtils.getLoginUser(); + if (StringUtils.isNotNull(loginUser)) + { + SysUser currentUser = loginUser.getSysUser(); + // 濡傛灉鏄秴绾х鐞嗗憳锛屽垯涓嶈繃婊ゆ暟鎹� + if (StringUtils.isNotNull(currentUser) && !currentUser.isAdmin()) + { + String permission = StringUtils.defaultIfEmpty(controllerDataScope.permission(), SecurityContextHolder.getPermission()); + dataScopeFilter(joinPoint, currentUser, controllerDataScope.deptAlias(), + controllerDataScope.userAlias(), permission); + } + } + } + + /** + * 鏁版嵁鑼冨洿杩囨护 + * + * @param joinPoint 鍒囩偣 + * @param user 鐢ㄦ埛 + * @param deptAlias 閮ㄩ棬鍒悕 + * @param userAlias 鐢ㄦ埛鍒悕 + * @param permission 鏉冮檺瀛楃 + */ + public static void dataScopeFilter(JoinPoint joinPoint, SysUser user, String deptAlias, String userAlias, String permission) + { + StringBuilder sqlString = new StringBuilder(); + List<String> conditions = new ArrayList<String>(); + List<String> scopeCustomIds = new ArrayList<String>(); + user.getRoles().forEach(role -> { + if (DATA_SCOPE_CUSTOM.equals(role.getDataScope()) && StringUtils.containsAny(role.getPermissions(), Convert.toStrArray(permission))) + { + scopeCustomIds.add(Convert.toStr(role.getRoleId())); + } + }); + + for (SysRole role : user.getRoles()) + { + String dataScope = role.getDataScope(); + if (conditions.contains(dataScope)) + { + continue; + } + if (!StringUtils.containsAny(role.getPermissions(), Convert.toStrArray(permission))) + { + continue; + } + if (DATA_SCOPE_ALL.equals(dataScope)) + { + sqlString = new StringBuilder(); + conditions.add(dataScope); + break; + } + else if (DATA_SCOPE_CUSTOM.equals(dataScope)) + { + if (scopeCustomIds.size() > 1) + { + // 澶氫釜鑷畾鏁版嵁鏉冮檺浣跨敤in鏌ヨ锛岄伩鍏嶅娆℃嫾鎺ャ�� + sqlString.append(StringUtils.format(" OR {}.dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id in ({}) ) ", deptAlias, String.join(",", scopeCustomIds))); + } + else + { + sqlString.append(StringUtils.format(" OR {}.dept_id IN ( SELECT dept_id FROM sys_role_dept WHERE role_id = {} ) ", deptAlias, role.getRoleId())); + } + } + else if (DATA_SCOPE_DEPT.equals(dataScope)) + { + sqlString.append(StringUtils.format(" OR {}.dept_id = {} ", deptAlias, user.getDeptId())); + } + else if (DATA_SCOPE_DEPT_AND_CHILD.equals(dataScope)) + { + sqlString.append(StringUtils.format(" OR {}.dept_id IN ( SELECT dept_id FROM sys_dept WHERE dept_id = {} or find_in_set( {} , ancestors ) )", deptAlias, user.getDeptId(), user.getDeptId())); + } + else if (DATA_SCOPE_SELF.equals(dataScope)) + { + if (StringUtils.isNotBlank(userAlias)) + { + sqlString.append(StringUtils.format(" OR {}.user_id = {} ", userAlias, user.getUserId())); + } + else + { + // 鏁版嵁鏉冮檺涓轰粎鏈汉涓旀病鏈塽serAlias鍒悕涓嶆煡璇换浣曟暟鎹� + sqlString.append(StringUtils.format(" OR {}.dept_id = 0 ", deptAlias)); + } + } + conditions.add(dataScope); + } + + // 瑙掕壊閮戒笉鍖呭惈浼犻�掕繃鏉ョ殑鏉冮檺瀛楃锛岃繖涓椂鍊檚qlString涔熶細涓虹┖锛屾墍浠ヨ闄愬埗涓�涓�,涓嶆煡璇换浣曟暟鎹� + if (StringUtils.isEmpty(conditions)) + { + sqlString.append(StringUtils.format(" OR {}.dept_id = 0 ", deptAlias)); + } + + if (StringUtils.isNotBlank(sqlString.toString())) + { + Object params = joinPoint.getArgs()[0]; + if (StringUtils.isNotNull(params) && params instanceof BaseEntity) + { + BaseEntity baseEntity = (BaseEntity) params; + baseEntity.getParams().put(DATA_SCOPE, " AND (" + sqlString.substring(4) + ")"); + } + } + } + + /** + * 鎷兼帴鏉冮檺sql鍓嶅厛娓呯┖params.dataScope鍙傛暟闃叉娉ㄥ叆 + */ + private void clearDataScope(final JoinPoint joinPoint) + { + Object params = joinPoint.getArgs()[0]; + if (StringUtils.isNotNull(params) && params instanceof BaseEntity) + { + BaseEntity baseEntity = (BaseEntity) params; + baseEntity.getParams().put(DATA_SCOPE, ""); + } + } +} diff --git a/se-common/se-common-datasource/pom.xml b/se-common/se-common-datasource/pom.xml new file mode 100644 index 0000000..ff73faa --- /dev/null +++ b/se-common/se-common-datasource/pom.xml @@ -0,0 +1,35 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://maven.apache.org/POM/4.0.0" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <groupId>com.ruoyi</groupId> + <artifactId>ruoyi-common</artifactId> + <version>3.6.4</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>se-common-datasource</artifactId> + + <description> + se-common-datasource澶氭暟鎹簮 + </description> + + <dependencies> + + <!-- Druid --> + <dependency> + <groupId>com.alibaba</groupId> + <artifactId>druid-spring-boot-starter</artifactId> + <version>${druid.version}</version> + </dependency> + + <!-- Dynamic DataSource --> + <dependency> + <groupId>com.baomidou</groupId> + <artifactId>dynamic-datasource-spring-boot-starter</artifactId> + <version>${dynamic-ds.version}</version> + </dependency> + + </dependencies> +</project> \ No newline at end of file diff --git a/se-common/se-common-datasource/src/main/java/com/se/common/datasource/annotation/Master.java b/se-common/se-common-datasource/src/main/java/com/se/common/datasource/annotation/Master.java new file mode 100644 index 0000000..f923309 --- /dev/null +++ b/se-common/se-common-datasource/src/main/java/com/se/common/datasource/annotation/Master.java @@ -0,0 +1,22 @@ +package com.se.common.datasource.annotation; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import com.baomidou.dynamic.datasource.annotation.DS; + +/** + * 涓诲簱鏁版嵁婧� + * + * @author admin + */ +@Target({ ElementType.TYPE, ElementType.METHOD }) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@DS("master") +public @interface Master +{ + +} \ No newline at end of file diff --git a/se-common/se-common-log/pom.xml b/se-common/se-common-log/pom.xml index a4f5126..ba69fc6 100644 --- a/se-common/se-common-log/pom.xml +++ b/se-common/se-common-log/pom.xml @@ -9,10 +9,10 @@ </parent> <modelVersion>4.0.0</modelVersion> - <artifactId>ruoyi-common-log</artifactId> + <artifactId>se-common-log</artifactId> <description> - ruoyi-common-log鏃ュ織璁板綍 + se-common-log鏃ュ織璁板綍 </description> <dependencies> diff --git a/se-common/se-common-log/src/main/java/com/se/common/log/annotation/Log.java b/se-common/se-common-log/src/main/java/com/se/common/log/annotation/Log.java new file mode 100644 index 0000000..694ec32 --- /dev/null +++ b/se-common/se-common-log/src/main/java/com/se/common/log/annotation/Log.java @@ -0,0 +1,51 @@ +package com.se.common.log.annotation; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import com.se.common.log.enums.BusinessType; +import com.se.common.log.enums.OperatorType; + +/** + * 鑷畾涔夋搷浣滄棩蹇楄褰曟敞瑙� + * + * @author admin + * + */ +@Target({ ElementType.PARAMETER, ElementType.METHOD }) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface Log +{ + /** + * 妯″潡 + */ + public String title() default ""; + + /** + * 鍔熻兘 + */ + public BusinessType businessType() default BusinessType.OTHER; + + /** + * 鎿嶄綔浜虹被鍒� + */ + public OperatorType operatorType() default OperatorType.MANAGE; + + /** + * 鏄惁淇濆瓨璇锋眰鐨勫弬鏁� + */ + public boolean isSaveRequestData() default true; + + /** + * 鏄惁淇濆瓨鍝嶅簲鐨勫弬鏁� + */ + public boolean isSaveResponseData() default true; + + /** + * 鎺掗櫎鎸囧畾鐨勮姹傚弬鏁� + */ + public String[] excludeParamNames() default {}; +} diff --git a/se-common/se-common-log/src/main/java/com/se/common/log/aspect/LogAspect.java b/se-common/se-common-log/src/main/java/com/se/common/log/aspect/LogAspect.java new file mode 100644 index 0000000..a2829b8 --- /dev/null +++ b/se-common/se-common-log/src/main/java/com/se/common/log/aspect/LogAspect.java @@ -0,0 +1,250 @@ +package com.se.common.log.aspect; + +import java.util.Collection; +import java.util.Map; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import com.se.common.log.enums.BusinessStatus; +import com.se.common.log.filter.PropertyPreExcludeFilter; +import org.apache.commons.lang3.ArrayUtils; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.AfterReturning; +import org.aspectj.lang.annotation.AfterThrowing; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Before; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.NamedThreadLocal; +import org.springframework.http.HttpMethod; +import org.springframework.stereotype.Component; +import org.springframework.validation.BindingResult; +import org.springframework.web.multipart.MultipartFile; +import com.alibaba.fastjson2.JSON; +import com.se.common.core.utils.ServletUtils; +import com.se.common.core.utils.StringUtils; +import com.se.common.core.utils.ip.IpUtils; +import com.se.common.log.annotation.Log; +import com.se.common.log.service.AsyncLogService; +import com.se.common.security.utils.SecurityUtils; +import com.se.system.api.domain.SysOperLog; + +/** + * 鎿嶄綔鏃ュ織璁板綍澶勭悊 + * + * @author admin + */ +@Aspect +@Component +public class LogAspect +{ + private static final Logger log = LoggerFactory.getLogger(LogAspect.class); + + /** 鎺掗櫎鏁忔劅灞炴�у瓧娈� */ + public static final String[] EXCLUDE_PROPERTIES = { "password", "oldPassword", "newPassword", "confirmPassword" }; + + /** 璁$畻鎿嶄綔娑堣�楁椂闂� */ + private static final ThreadLocal<Long> TIME_THREADLOCAL = new NamedThreadLocal<Long>("Cost Time"); + + @Autowired + private AsyncLogService asyncLogService; + + /** + * 澶勭悊璇锋眰鍓嶆墽琛� + */ + @Before(value = "@annotation(controllerLog)") + public void boBefore(JoinPoint joinPoint, Log controllerLog) + { + TIME_THREADLOCAL.set(System.currentTimeMillis()); + } + + /** + * 澶勭悊瀹岃姹傚悗鎵ц + * + * @param joinPoint 鍒囩偣 + */ + @AfterReturning(pointcut = "@annotation(controllerLog)", returning = "jsonResult") + public void doAfterReturning(JoinPoint joinPoint, Log controllerLog, Object jsonResult) + { + handleLog(joinPoint, controllerLog, null, jsonResult); + } + + /** + * 鎷︽埅寮傚父鎿嶄綔 + * + * @param joinPoint 鍒囩偣 + * @param e 寮傚父 + */ + @AfterThrowing(value = "@annotation(controllerLog)", throwing = "e") + public void doAfterThrowing(JoinPoint joinPoint, Log controllerLog, Exception e) + { + handleLog(joinPoint, controllerLog, e, null); + } + + protected void handleLog(final JoinPoint joinPoint, Log controllerLog, final Exception e, Object jsonResult) + { + try + { + // *========鏁版嵁搴撴棩蹇�=========*// + SysOperLog operLog = new SysOperLog(); + operLog.setStatus(BusinessStatus.SUCCESS.ordinal()); + // 璇锋眰鐨勫湴鍧� + String ip = IpUtils.getIpAddr(); + operLog.setOperIp(ip); + operLog.setOperUrl(StringUtils.substring(ServletUtils.getRequest().getRequestURI(), 0, 255)); + String username = SecurityUtils.getUsername(); + if (StringUtils.isNotBlank(username)) + { + operLog.setOperName(username); + } + + if (e != null) + { + operLog.setStatus(BusinessStatus.FAIL.ordinal()); + operLog.setErrorMsg(StringUtils.substring(e.getMessage(), 0, 2000)); + } + // 璁剧疆鏂规硶鍚嶇О + String className = joinPoint.getTarget().getClass().getName(); + String methodName = joinPoint.getSignature().getName(); + operLog.setMethod(className + "." + methodName + "()"); + // 璁剧疆璇锋眰鏂瑰紡 + operLog.setRequestMethod(ServletUtils.getRequest().getMethod()); + // 澶勭悊璁剧疆娉ㄨВ涓婄殑鍙傛暟 + getControllerMethodDescription(joinPoint, controllerLog, operLog, jsonResult); + // 璁剧疆娑堣�楁椂闂� + operLog.setCostTime(System.currentTimeMillis() - TIME_THREADLOCAL.get()); + // 淇濆瓨鏁版嵁搴� + asyncLogService.saveSysLog(operLog); + } + catch (Exception exp) + { + // 璁板綍鏈湴寮傚父鏃ュ織 + log.error("寮傚父淇℃伅:{}", exp.getMessage()); + exp.printStackTrace(); + } + finally + { + TIME_THREADLOCAL.remove(); + } + } + + /** + * 鑾峰彇娉ㄨВ涓鏂规硶鐨勬弿杩颁俊鎭� 鐢ㄤ簬Controller灞傛敞瑙� + * + * @param log 鏃ュ織 + * @param operLog 鎿嶄綔鏃ュ織 + * @throws Exception + */ + public void getControllerMethodDescription(JoinPoint joinPoint, Log log, SysOperLog operLog, Object jsonResult) throws Exception + { + // 璁剧疆action鍔ㄤ綔 + operLog.setBusinessType(log.businessType().ordinal()); + // 璁剧疆鏍囬 + operLog.setTitle(log.title()); + // 璁剧疆鎿嶄綔浜虹被鍒� + operLog.setOperatorType(log.operatorType().ordinal()); + // 鏄惁闇�瑕佷繚瀛榬equest锛屽弬鏁板拰鍊� + if (log.isSaveRequestData()) + { + // 鑾峰彇鍙傛暟鐨勪俊鎭紝浼犲叆鍒版暟鎹簱涓�� + setRequestValue(joinPoint, operLog, log.excludeParamNames()); + } + // 鏄惁闇�瑕佷繚瀛榬esponse锛屽弬鏁板拰鍊� + if (log.isSaveResponseData() && StringUtils.isNotNull(jsonResult)) + { + operLog.setJsonResult(StringUtils.substring(JSON.toJSONString(jsonResult), 0, 2000)); + } + } + + /** + * 鑾峰彇璇锋眰鐨勫弬鏁帮紝鏀惧埌log涓� + * + * @param operLog 鎿嶄綔鏃ュ織 + * @throws Exception 寮傚父 + */ + private void setRequestValue(JoinPoint joinPoint, SysOperLog operLog, String[] excludeParamNames) throws Exception + { + String requestMethod = operLog.getRequestMethod(); + Map<?, ?> paramsMap = ServletUtils.getParamMap(ServletUtils.getRequest()); + if (StringUtils.isEmpty(paramsMap) + && (HttpMethod.PUT.name().equals(requestMethod) || HttpMethod.POST.name().equals(requestMethod))) + { + String params = argsArrayToString(joinPoint.getArgs(), excludeParamNames); + operLog.setOperParam(StringUtils.substring(params, 0, 2000)); + } + else + { + operLog.setOperParam(StringUtils.substring(JSON.toJSONString(paramsMap, excludePropertyPreFilter(excludeParamNames)), 0, 2000)); + } + } + + /** + * 鍙傛暟鎷艰 + */ + private String argsArrayToString(Object[] paramsArray, String[] excludeParamNames) + { + String params = ""; + if (paramsArray != null && paramsArray.length > 0) + { + for (Object o : paramsArray) + { + if (StringUtils.isNotNull(o) && !isFilterObject(o)) + { + try + { + String jsonObj = JSON.toJSONString(o, excludePropertyPreFilter(excludeParamNames)); + params += jsonObj.toString() + " "; + } + catch (Exception e) + { + } + } + } + } + return params.trim(); + } + + /** + * 蹇界暐鏁忔劅灞炴�� + */ + public PropertyPreExcludeFilter excludePropertyPreFilter(String[] excludeParamNames) + { + return new PropertyPreExcludeFilter().addExcludes(ArrayUtils.addAll(EXCLUDE_PROPERTIES, excludeParamNames)); + } + + /** + * 鍒ゆ柇鏄惁闇�瑕佽繃婊ょ殑瀵硅薄銆� + * + * @param o 瀵硅薄淇℃伅銆� + * @return 濡傛灉鏄渶瑕佽繃婊ょ殑瀵硅薄锛屽垯杩斿洖true锛涘惁鍒欒繑鍥瀎alse銆� + */ + @SuppressWarnings("rawtypes") + public boolean isFilterObject(final Object o) + { + Class<?> clazz = o.getClass(); + if (clazz.isArray()) + { + return clazz.getComponentType().isAssignableFrom(MultipartFile.class); + } + else if (Collection.class.isAssignableFrom(clazz)) + { + Collection collection = (Collection) o; + for (Object value : collection) + { + return value instanceof MultipartFile; + } + } + else if (Map.class.isAssignableFrom(clazz)) + { + Map map = (Map) o; + for (Object value : map.entrySet()) + { + Map.Entry entry = (Map.Entry) value; + return entry.getValue() instanceof MultipartFile; + } + } + return o instanceof MultipartFile || o instanceof HttpServletRequest || o instanceof HttpServletResponse + || o instanceof BindingResult; + } +} diff --git a/se-common/se-common-log/src/main/java/com/se/common/log/enums/BusinessStatus.java b/se-common/se-common-log/src/main/java/com/se/common/log/enums/BusinessStatus.java new file mode 100644 index 0000000..11b8cb3 --- /dev/null +++ b/se-common/se-common-log/src/main/java/com/se/common/log/enums/BusinessStatus.java @@ -0,0 +1,20 @@ +package com.se.common.log.enums; + +/** + * 鎿嶄綔鐘舵�� + * + * @author admin + * + */ +public enum BusinessStatus +{ + /** + * 鎴愬姛 + */ + SUCCESS, + + /** + * 澶辫触 + */ + FAIL, +} diff --git a/se-common/se-common-log/src/main/java/com/se/common/log/enums/BusinessType.java b/se-common/se-common-log/src/main/java/com/se/common/log/enums/BusinessType.java new file mode 100644 index 0000000..00b7a6a --- /dev/null +++ b/se-common/se-common-log/src/main/java/com/se/common/log/enums/BusinessType.java @@ -0,0 +1,59 @@ +package com.se.common.log.enums; + +/** + * 涓氬姟鎿嶄綔绫诲瀷 + * + * @author admin + */ +public enum BusinessType +{ + /** + * 鍏跺畠 + */ + OTHER, + + /** + * 鏂板 + */ + INSERT, + + /** + * 淇敼 + */ + UPDATE, + + /** + * 鍒犻櫎 + */ + DELETE, + + /** + * 鎺堟潈 + */ + GRANT, + + /** + * 瀵煎嚭 + */ + EXPORT, + + /** + * 瀵煎叆 + */ + IMPORT, + + /** + * 寮洪�� + */ + FORCE, + + /** + * 鐢熸垚浠g爜 + */ + GENCODE, + + /** + * 娓呯┖鏁版嵁 + */ + CLEAN, +} diff --git a/se-common/se-common-log/src/main/java/com/se/common/log/enums/OperatorType.java b/se-common/se-common-log/src/main/java/com/se/common/log/enums/OperatorType.java new file mode 100644 index 0000000..5b15a93 --- /dev/null +++ b/se-common/se-common-log/src/main/java/com/se/common/log/enums/OperatorType.java @@ -0,0 +1,24 @@ +package com.se.common.log.enums; + +/** + * 鎿嶄綔浜虹被鍒� + * + * @author admin + */ +public enum OperatorType +{ + /** + * 鍏跺畠 + */ + OTHER, + + /** + * 鍚庡彴鐢ㄦ埛 + */ + MANAGE, + + /** + * 鎵嬫満绔敤鎴� + */ + MOBILE +} diff --git a/se-common/se-common-log/src/main/java/com/se/common/log/service/AsyncLogService.java b/se-common/se-common-log/src/main/java/com/se/common/log/service/AsyncLogService.java new file mode 100644 index 0000000..462750d --- /dev/null +++ b/se-common/se-common-log/src/main/java/com/se/common/log/service/AsyncLogService.java @@ -0,0 +1,29 @@ +package com.se.common.log.service; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; +import com.se.common.core.constant.SecurityConstants; +import com.se.system.api.RemoteLogService; +import com.se.system.api.domain.SysOperLog; + +/** + * 寮傛璋冪敤鏃ュ織鏈嶅姟 + * + * @author admin + */ +@Service +public class AsyncLogService +{ + @Autowired + private RemoteLogService remoteLogService; + + /** + * 淇濆瓨绯荤粺鏃ュ織璁板綍 + */ + @Async + public void saveSysLog(SysOperLog sysOperLog) throws Exception + { + remoteLogService.saveLog(sysOperLog, SecurityConstants.INNER); + } +} diff --git a/se-common/se-common-redis/pom.xml b/se-common/se-common-redis/pom.xml index 3a97c56..7c9fa60 100644 --- a/se-common/se-common-redis/pom.xml +++ b/se-common/se-common-redis/pom.xml @@ -9,10 +9,10 @@ </parent> <modelVersion>4.0.0</modelVersion> - <artifactId>ruoyi-common-redis</artifactId> + <artifactId>se-common-redis</artifactId> <description> - ruoyi-common-redis缂撳瓨鏈嶅姟 + se-common-redis缂撳瓨鏈嶅姟 </description> <dependencies> diff --git a/se-common/se-common-redis/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/se-common/se-common-redis/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..6e95521 --- /dev/null +++ b/se-common/se-common-redis/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports @@ -0,0 +1,2 @@ +com.se.common.redis.configure.RedisConfig +com.se.common.redis.service.RedisService diff --git a/se-common/se-common-seata/pom.xml b/se-common/se-common-seata/pom.xml new file mode 100644 index 0000000..6db044e --- /dev/null +++ b/se-common/se-common-seata/pom.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://maven.apache.org/POM/4.0.0" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <groupId>com.ruoyi</groupId> + <artifactId>ruoyi-common</artifactId> + <version>3.6.4</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <artifactId>se-common-seata</artifactId> + + <description> + se-common-seata鍒嗗竷寮忎簨鍔� + </description> + + <dependencies> + + <!-- SpringBoot Seata --> + <dependency> + <groupId>com.alibaba.cloud</groupId> + <artifactId>spring-cloud-starter-alibaba-seata</artifactId> + </dependency> + + </dependencies> +</project> \ No newline at end of file diff --git a/se-common/se-common-security/pom.xml b/se-common/se-common-security/pom.xml index 963e909..e92dd9e 100644 --- a/se-common/se-common-security/pom.xml +++ b/se-common/se-common-security/pom.xml @@ -8,10 +8,10 @@ </parent> <modelVersion>4.0.0</modelVersion> - <artifactId>ruoyi-common-security</artifactId> + <artifactId>se-common-security</artifactId> <description> - ruoyi-common-security瀹夊叏妯″潡 + se-common-security瀹夊叏妯″潡 </description> <dependencies> diff --git a/se-common/se-common-security/src/main/java/com/se/common/security/annotation/InnerAuth.java b/se-common/se-common-security/src/main/java/com/se/common/security/annotation/InnerAuth.java new file mode 100644 index 0000000..f366d11 --- /dev/null +++ b/se-common/se-common-security/src/main/java/com/se/common/security/annotation/InnerAuth.java @@ -0,0 +1,19 @@ +package com.se.common.security.annotation; + +import java.lang.annotation.*; + +/** + * 鍐呴儴璁よ瘉娉ㄨВ + * + * @author admin + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface InnerAuth +{ + /** + * 鏄惁鏍¢獙鐢ㄦ埛淇℃伅 + */ + boolean isUser() default false; +} \ No newline at end of file diff --git a/se-common/se-common-security/src/main/java/com/se/common/security/aspect/InnerAuthAspect.java b/se-common/se-common-security/src/main/java/com/se/common/security/aspect/InnerAuthAspect.java new file mode 100644 index 0000000..05a645f --- /dev/null +++ b/se-common/se-common-security/src/main/java/com/se/common/security/aspect/InnerAuthAspect.java @@ -0,0 +1,51 @@ +package com.se.common.security.aspect; + +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.springframework.core.Ordered; +import org.springframework.stereotype.Component; +import com.se.common.core.constant.SecurityConstants; +import com.se.common.core.exception.InnerAuthException; +import com.se.common.core.utils.ServletUtils; +import com.se.common.core.utils.StringUtils; +import com.se.common.security.annotation.InnerAuth; + +/** + * 鍐呴儴鏈嶅姟璋冪敤楠岃瘉澶勭悊 + * + * @author admin + */ +@Aspect +@Component +public class InnerAuthAspect implements Ordered +{ + @Around("@annotation(innerAuth)") + public Object innerAround(ProceedingJoinPoint point, InnerAuth innerAuth) throws Throwable + { + String source = ServletUtils.getRequest().getHeader(SecurityConstants.FROM_SOURCE); + // 鍐呴儴璇锋眰楠岃瘉 + if (!StringUtils.equals(SecurityConstants.INNER, source)) + { + throw new InnerAuthException("娌℃湁鍐呴儴璁块棶鏉冮檺锛屼笉鍏佽璁块棶"); + } + + String userid = ServletUtils.getRequest().getHeader(SecurityConstants.DETAILS_USER_ID); + String username = ServletUtils.getRequest().getHeader(SecurityConstants.DETAILS_USERNAME); + // 鐢ㄦ埛淇℃伅楠岃瘉 + if (innerAuth.isUser() && (StringUtils.isEmpty(userid) || StringUtils.isEmpty(username))) + { + throw new InnerAuthException("娌℃湁璁剧疆鐢ㄦ埛淇℃伅锛屼笉鍏佽璁块棶 "); + } + return point.proceed(); + } + + /** + * 纭繚鍦ㄦ潈闄愯璇乤op鎵ц鍓嶆墽琛� + */ + @Override + public int getOrder() + { + return Ordered.HIGHEST_PRECEDENCE + 1; + } +} diff --git a/se-common/se-common-security/src/main/java/com/se/common/security/handler/GlobalExceptionHandler.java b/se-common/se-common-security/src/main/java/com/se/common/security/handler/GlobalExceptionHandler.java new file mode 100644 index 0000000..b8f6135 --- /dev/null +++ b/se-common/se-common-security/src/main/java/com/se/common/security/handler/GlobalExceptionHandler.java @@ -0,0 +1,166 @@ +package com.se.common.security.handler; + +import javax.servlet.http.HttpServletRequest; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.validation.BindException; +import org.springframework.web.HttpRequestMethodNotSupportedException; +import org.springframework.web.bind.MethodArgumentNotValidException; +import org.springframework.web.bind.MissingPathVariableException; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.RestControllerAdvice; +import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException; +import com.se.common.core.constant.HttpStatus; +import com.se.common.core.exception.DemoModeException; +import com.se.common.core.exception.InnerAuthException; +import com.se.common.core.exception.ServiceException; +import com.se.common.core.exception.auth.NotPermissionException; +import com.se.common.core.exception.auth.NotRoleException; +import com.se.common.core.text.Convert; +import com.se.common.core.utils.StringUtils; +import com.se.common.core.utils.html.EscapeUtil; +import com.se.common.core.web.domain.AjaxResult; + +/** + * 鍏ㄥ眬寮傚父澶勭悊鍣� + * + * @author admin + */ +@RestControllerAdvice +public class GlobalExceptionHandler +{ + private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class); + + /** + * 鏉冮檺鐮佸紓甯� + */ + @ExceptionHandler(NotPermissionException.class) + public AjaxResult handleNotPermissionException(NotPermissionException e, HttpServletRequest request) + { + String requestURI = request.getRequestURI(); + log.error("璇锋眰鍦板潃'{}',鏉冮檺鐮佹牎楠屽け璐�'{}'", requestURI, e.getMessage()); + return AjaxResult.error(HttpStatus.FORBIDDEN, "娌℃湁璁块棶鏉冮檺锛岃鑱旂郴绠$悊鍛樻巿鏉�"); + } + + /** + * 瑙掕壊鏉冮檺寮傚父 + */ + @ExceptionHandler(NotRoleException.class) + public AjaxResult handleNotRoleException(NotRoleException e, HttpServletRequest request) + { + String requestURI = request.getRequestURI(); + log.error("璇锋眰鍦板潃'{}',瑙掕壊鏉冮檺鏍¢獙澶辫触'{}'", requestURI, e.getMessage()); + return AjaxResult.error(HttpStatus.FORBIDDEN, "娌℃湁璁块棶鏉冮檺锛岃鑱旂郴绠$悊鍛樻巿鏉�"); + } + + /** + * 璇锋眰鏂瑰紡涓嶆敮鎸� + */ + @ExceptionHandler(HttpRequestMethodNotSupportedException.class) + public AjaxResult handleHttpRequestMethodNotSupported(HttpRequestMethodNotSupportedException e, HttpServletRequest request) + { + String requestURI = request.getRequestURI(); + log.error("璇锋眰鍦板潃'{}',涓嶆敮鎸�'{}'璇锋眰", requestURI, e.getMethod()); + return AjaxResult.error(e.getMessage()); + } + + /** + * 涓氬姟寮傚父 + */ + @ExceptionHandler(ServiceException.class) + public AjaxResult handleServiceException(ServiceException e, HttpServletRequest request) + { + log.error(e.getMessage(), e); + Integer code = e.getCode(); + return StringUtils.isNotNull(code) ? AjaxResult.error(code, e.getMessage()) : AjaxResult.error(e.getMessage()); + } + + /** + * 璇锋眰璺緞涓己灏戝繀闇�鐨勮矾寰勫彉閲� + */ + @ExceptionHandler(MissingPathVariableException.class) + public AjaxResult handleMissingPathVariableException(MissingPathVariableException e, HttpServletRequest request) + { + String requestURI = request.getRequestURI(); + log.error("璇锋眰璺緞涓己灏戝繀闇�鐨勮矾寰勫彉閲�'{}',鍙戠敓绯荤粺寮傚父.", requestURI, e); + return AjaxResult.error(String.format("璇锋眰璺緞涓己灏戝繀闇�鐨勮矾寰勫彉閲廩%s]", e.getVariableName())); + } + + /** + * 璇锋眰鍙傛暟绫诲瀷涓嶅尮閰� + */ + @ExceptionHandler(MethodArgumentTypeMismatchException.class) + public AjaxResult handleMethodArgumentTypeMismatchException(MethodArgumentTypeMismatchException e, HttpServletRequest request) + { + String requestURI = request.getRequestURI(); + String value = Convert.toStr(e.getValue()); + if (StringUtils.isNotEmpty(value)) + { + value = EscapeUtil.clean(value); + } + log.error("璇锋眰鍙傛暟绫诲瀷涓嶅尮閰�'{}',鍙戠敓绯荤粺寮傚父.", requestURI, e); + return AjaxResult.error(String.format("璇锋眰鍙傛暟绫诲瀷涓嶅尮閰嶏紝鍙傛暟[%s]瑕佹眰绫诲瀷涓猴細'%s'锛屼絾杈撳叆鍊间负锛�'%s'", e.getName(), e.getRequiredType().getName(), value)); + } + + /** + * 鎷︽埅鏈煡鐨勮繍琛屾椂寮傚父 + */ + @ExceptionHandler(RuntimeException.class) + public AjaxResult handleRuntimeException(RuntimeException e, HttpServletRequest request) + { + String requestURI = request.getRequestURI(); + log.error("璇锋眰鍦板潃'{}',鍙戠敓鏈煡寮傚父.", requestURI, e); + return AjaxResult.error(e.getMessage()); + } + + /** + * 绯荤粺寮傚父 + */ + @ExceptionHandler(Exception.class) + public AjaxResult handleException(Exception e, HttpServletRequest request) + { + String requestURI = request.getRequestURI(); + log.error("璇锋眰鍦板潃'{}',鍙戠敓绯荤粺寮傚父.", requestURI, e); + return AjaxResult.error(e.getMessage()); + } + + /** + * 鑷畾涔夐獙璇佸紓甯� + */ + @ExceptionHandler(BindException.class) + public AjaxResult handleBindException(BindException e) + { + log.error(e.getMessage(), e); + String message = e.getAllErrors().get(0).getDefaultMessage(); + return AjaxResult.error(message); + } + + /** + * 鑷畾涔夐獙璇佸紓甯� + */ + @ExceptionHandler(MethodArgumentNotValidException.class) + public Object handleMethodArgumentNotValidException(MethodArgumentNotValidException e) + { + log.error(e.getMessage(), e); + String message = e.getBindingResult().getFieldError().getDefaultMessage(); + return AjaxResult.error(message); + } + + /** + * 鍐呴儴璁よ瘉寮傚父 + */ + @ExceptionHandler(InnerAuthException.class) + public AjaxResult handleInnerAuthException(InnerAuthException e) + { + return AjaxResult.error(e.getMessage()); + } + + /** + * 婕旂ず妯″紡寮傚父 + */ + @ExceptionHandler(DemoModeException.class) + public AjaxResult handleDemoModeException(DemoModeException e) + { + return AjaxResult.error("婕旂ず妯″紡锛屼笉鍏佽鎿嶄綔"); + } +} diff --git a/se-common/se-common-security/src/main/java/com/se/common/security/utils/DictUtils.java b/se-common/se-common-security/src/main/java/com/se/common/security/utils/DictUtils.java new file mode 100644 index 0000000..c22f1e9 --- /dev/null +++ b/se-common/se-common-security/src/main/java/com/se/common/security/utils/DictUtils.java @@ -0,0 +1,75 @@ +package com.se.common.security.utils; + +import java.util.Collection; +import java.util.List; +import com.alibaba.fastjson2.JSONArray; +import com.se.common.core.constant.CacheConstants; +import com.se.common.core.utils.SpringUtils; +import com.se.common.core.utils.StringUtils; +import com.se.common.redis.service.RedisService; +import com.se.system.api.domain.SysDictData; + +/** + * 瀛楀吀宸ュ叿绫� + * + * @author admin + */ +public class DictUtils +{ + /** + * 璁剧疆瀛楀吀缂撳瓨 + * + * @param key 鍙傛暟閿� + * @param dictDatas 瀛楀吀鏁版嵁鍒楄〃 + */ + public static void setDictCache(String key, List<SysDictData> dictDatas) + { + SpringUtils.getBean(RedisService.class).setCacheObject(getCacheKey(key), dictDatas); + } + + /** + * 鑾峰彇瀛楀吀缂撳瓨 + * + * @param key 鍙傛暟閿� + * @return dictDatas 瀛楀吀鏁版嵁鍒楄〃 + */ + public static List<SysDictData> getDictCache(String key) + { + JSONArray arrayCache = SpringUtils.getBean(RedisService.class).getCacheObject(getCacheKey(key)); + if (StringUtils.isNotNull(arrayCache)) + { + return arrayCache.toList(SysDictData.class); + } + return null; + } + + /** + * 鍒犻櫎鎸囧畾瀛楀吀缂撳瓨 + * + * @param key 瀛楀吀閿� + */ + public static void removeDictCache(String key) + { + SpringUtils.getBean(RedisService.class).deleteObject(getCacheKey(key)); + } + + /** + * 娓呯┖瀛楀吀缂撳瓨 + */ + public static void clearDictCache() + { + Collection<String> keys = SpringUtils.getBean(RedisService.class).keys(CacheConstants.SYS_DICT_KEY + "*"); + SpringUtils.getBean(RedisService.class).deleteObject(keys); + } + + /** + * 璁剧疆cache key + * + * @param configKey 鍙傛暟閿� + * @return 缂撳瓨閿甼ey + */ + public static String getCacheKey(String configKey) + { + return CacheConstants.SYS_DICT_KEY + configKey; + } +} diff --git a/se-common/se-common-sensitive/pom.xml b/se-common/se-common-sensitive/pom.xml index f5f5c1d..266dde0 100644 --- a/se-common/se-common-sensitive/pom.xml +++ b/se-common/se-common-sensitive/pom.xml @@ -9,10 +9,10 @@ </parent> <modelVersion>4.0.0</modelVersion> - <artifactId>ruoyi-common-sensitive</artifactId> + <artifactId>se-common-sensitive</artifactId> <description> - ruoyi-common-sensitive鏁版嵁鑴辨晱 + se-common-sensitive鏁版嵁鑴辨晱 </description> <dependencies> diff --git a/se-common/se-common-sensitive/src/main/java/com/se/common/sensitive/config/SensitiveJsonSerializer.java b/se-common/se-common-sensitive/src/main/java/com/se/common/sensitive/config/SensitiveJsonSerializer.java new file mode 100644 index 0000000..163527c --- /dev/null +++ b/se-common/se-common-sensitive/src/main/java/com/se/common/sensitive/config/SensitiveJsonSerializer.java @@ -0,0 +1,67 @@ +package com.se.common.sensitive.config; + +import java.io.IOException; +import java.util.Objects; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.BeanProperty; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; +import com.fasterxml.jackson.databind.ser.ContextualSerializer; +import com.se.common.security.utils.SecurityUtils; +import com.se.common.sensitive.annotation.Sensitive; +import com.se.common.sensitive.enums.DesensitizedType; +import com.se.system.api.model.LoginUser; + +/** + * 鏁版嵁鑴辨晱搴忓垪鍖栬繃婊� + * + * @author admin + */ +public class SensitiveJsonSerializer extends JsonSerializer<String> implements ContextualSerializer +{ + private DesensitizedType desensitizedType; + + @Override + public void serialize(String value, JsonGenerator gen, SerializerProvider serializers) throws IOException + { + if (desensitization()) + { + gen.writeString(desensitizedType.desensitizer().apply(value)); + } + else + { + gen.writeString(value); + } + } + + @Override + public JsonSerializer<?> createContextual(SerializerProvider prov, BeanProperty property) + throws JsonMappingException + { + Sensitive annotation = property.getAnnotation(Sensitive.class); + if (Objects.nonNull(annotation) && Objects.equals(String.class, property.getType().getRawClass())) + { + this.desensitizedType = annotation.desensitizedType(); + return this; + } + return prov.findValueSerializer(property.getType(), property); + } + + /** + * 鏄惁闇�瑕佽劚鏁忓鐞� + */ + private boolean desensitization() + { + try + { + LoginUser securityUser = SecurityUtils.getLoginUser(); + // 绠$悊鍛樹笉鑴辨晱 + return !securityUser.getSysUser().isAdmin(); + } + catch (Exception e) + { + return true; + } + } +} diff --git a/se-common/se-common-sensitive/src/main/java/com/se/common/sensitive/enums/DesensitizedType.java b/se-common/se-common-sensitive/src/main/java/com/se/common/sensitive/enums/DesensitizedType.java new file mode 100644 index 0000000..4143531 --- /dev/null +++ b/se-common/se-common-sensitive/src/main/java/com/se/common/sensitive/enums/DesensitizedType.java @@ -0,0 +1,59 @@ +package com.se.common.sensitive.enums; + +import java.util.function.Function; +import com.se.common.sensitive.utils.DesensitizedUtil; + +/** + * 鑴辨晱绫诲瀷 + * + * @author admin + */ +public enum DesensitizedType +{ + /** + * 濮撳悕锛岀2浣嶆槦鍙锋浛鎹� + */ + USERNAME(s -> s.replaceAll("(\\S)\\S(\\S*)", "$1*$2")), + + /** + * 瀵嗙爜锛屽叏閮ㄥ瓧绗﹂兘鐢�*浠f浛 + */ + PASSWORD(DesensitizedUtil::password), + + /** + * 韬唤璇侊紝涓棿10浣嶆槦鍙锋浛鎹� + */ + ID_CARD(s -> s.replaceAll("(\\d{4})\\d{10}(\\d{4})", "$1** **** ****$2")), + + /** + * 鎵嬫満鍙凤紝涓棿4浣嶆槦鍙锋浛鎹� + */ + PHONE(s -> s.replaceAll("(\\d{3})\\d{4}(\\d{4})", "$1****$2")), + + /** + * 鐢靛瓙閭锛屼粎鏄剧ず绗竴涓瓧姣嶅拰@鍚庨潰鐨勫湴鍧�鏄剧ず锛屽叾浠栨槦鍙锋浛鎹� + */ + EMAIL(s -> s.replaceAll("(^.)[^@]*(@.*$)", "$1****$2")), + + /** + * 閾惰鍗″彿锛屼繚鐣欐渶鍚�4浣嶏紝鍏朵粬鏄熷彿鏇挎崲 + */ + BANK_CARD(s -> s.replaceAll("\\d{15}(\\d{3})", "**** **** **** **** $1")), + + /** + * 杞︾墝鍙风爜锛屽寘鍚櫘閫氳溅杈嗐�佹柊鑳芥簮杞﹁締 + */ + CAR_LICENSE(DesensitizedUtil::carLicense); + + private final Function<String, String> desensitizer; + + DesensitizedType(Function<String, String> desensitizer) + { + this.desensitizer = desensitizer; + } + + public Function<String, String> desensitizer() + { + return desensitizer; + } +} diff --git a/se-common/se-common-sensitive/src/main/java/com/se/common/sensitive/utils/DesensitizedUtil.java b/se-common/se-common-sensitive/src/main/java/com/se/common/sensitive/utils/DesensitizedUtil.java new file mode 100644 index 0000000..57d4707 --- /dev/null +++ b/se-common/se-common-sensitive/src/main/java/com/se/common/sensitive/utils/DesensitizedUtil.java @@ -0,0 +1,51 @@ +package com.se.common.sensitive.utils; + +import com.se.common.core.utils.StringUtils; + +/** + * 鑴辨晱宸ュ叿绫� + * + * @author admin + */ +public class DesensitizedUtil +{ + /** + * 瀵嗙爜鐨勫叏閮ㄥ瓧绗﹂兘鐢�*浠f浛锛屾瘮濡傦細****** + * + * @param password 瀵嗙爜 + * @return 鑴辨晱鍚庣殑瀵嗙爜 + */ + public static String password(String password) + { + if (StringUtils.isBlank(password)) + { + return StringUtils.EMPTY; + } + return StringUtils.repeat('*', password.length()); + } + + /** + * 杞︾墝涓棿鐢�*浠f浛锛屽鏋滄槸閿欒鐨勮溅鐗岋紝涓嶅鐞� + * + * @param carLicense 瀹屾暣鐨勮溅鐗屽彿 + * @return 鑴辨晱鍚庣殑杞︾墝 + */ + public static String carLicense(String carLicense) + { + if (StringUtils.isBlank(carLicense)) + { + return StringUtils.EMPTY; + } + // 鏅�氳溅鐗� + if (carLicense.length() == 7) + { + carLicense = StringUtils.hide(carLicense, 3, 6); + } + else if (carLicense.length() == 8) + { + // 鏂拌兘婧愯溅鐗� + carLicense = StringUtils.hide(carLicense, 3, 7); + } + return carLicense; + } +} diff --git a/se-common/se-common-swagger/pom.xml b/se-common/se-common-swagger/pom.xml index cc48257..81d4ad3 100644 --- a/se-common/se-common-swagger/pom.xml +++ b/se-common/se-common-swagger/pom.xml @@ -9,10 +9,10 @@ </parent> <modelVersion>4.0.0</modelVersion> - <artifactId>ruoyi-common-swagger</artifactId> + <artifactId>se-common-swagger</artifactId> <description> - ruoyi-common-swagger绯荤粺鎺ュ彛 + se-common-swagger绯荤粺鎺ュ彛 </description> <dependencies> diff --git a/se-common/se-common-swagger/src/main/java/com/se/common/swagger/annotation/EnableCustomSwagger2.java b/se-common/se-common-swagger/src/main/java/com/se/common/swagger/annotation/EnableCustomSwagger2.java new file mode 100644 index 0000000..4a4d3ce --- /dev/null +++ b/se-common/se-common-swagger/src/main/java/com/se/common/swagger/annotation/EnableCustomSwagger2.java @@ -0,0 +1,20 @@ +package com.se.common.swagger.annotation; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Inherited; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; +import org.springframework.context.annotation.Import; +import com.se.common.swagger.config.SwaggerAutoConfiguration; + +@Target({ ElementType.TYPE }) +@Retention(RetentionPolicy.RUNTIME) +@Documented +@Inherited +@Import({ SwaggerAutoConfiguration.class }) +public @interface EnableCustomSwagger2 +{ + +} diff --git a/se-common/se-common-swagger/src/main/java/com/se/common/swagger/config/SwaggerBeanPostProcessor.java b/se-common/se-common-swagger/src/main/java/com/se/common/swagger/config/SwaggerBeanPostProcessor.java new file mode 100644 index 0000000..90ef0d9 --- /dev/null +++ b/se-common/se-common-swagger/src/main/java/com/se/common/swagger/config/SwaggerBeanPostProcessor.java @@ -0,0 +1,52 @@ +package com.se.common.swagger.config; + +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.config.BeanPostProcessor; +import org.springframework.util.ReflectionUtils; +import org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping; +import springfox.documentation.spring.web.plugins.WebFluxRequestHandlerProvider; +import springfox.documentation.spring.web.plugins.WebMvcRequestHandlerProvider; +import java.lang.reflect.Field; +import java.util.List; +import java.util.stream.Collectors; + +/** + * swagger 鍦� springboot 2.6.x 涓嶅吋瀹归棶棰樼殑澶勭悊 + * + * @author admin + */ +public class SwaggerBeanPostProcessor implements BeanPostProcessor +{ + @Override + public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException + { + if (bean instanceof WebMvcRequestHandlerProvider || bean instanceof WebFluxRequestHandlerProvider) + { + customizeSpringfoxHandlerMappings(getHandlerMappings(bean)); + } + return bean; + } + + private <T extends RequestMappingInfoHandlerMapping> void customizeSpringfoxHandlerMappings(List<T> mappings) + { + List<T> copy = mappings.stream().filter(mapping -> mapping.getPatternParser() == null) + .collect(Collectors.toList()); + mappings.clear(); + mappings.addAll(copy); + } + + @SuppressWarnings("unchecked") + private List<RequestMappingInfoHandlerMapping> getHandlerMappings(Object bean) + { + try + { + Field field = ReflectionUtils.findField(bean.getClass(), "handlerMappings"); + field.setAccessible(true); + return (List<RequestMappingInfoHandlerMapping>) field.get(bean); + } + catch (IllegalArgumentException | IllegalAccessException e) + { + throw new IllegalStateException(e); + } + } +} diff --git a/se-gateway/pom.xml b/se-gateway/pom.xml index 52a871c..94a4dfa 100644 --- a/se-gateway/pom.xml +++ b/se-gateway/pom.xml @@ -8,10 +8,10 @@ </parent> <modelVersion>4.0.0</modelVersion> - <artifactId>ruoyi-gateway</artifactId> + <artifactId>se-gateway</artifactId> <description> - ruoyi-gateway缃戝叧妯″潡 + se-gateway缃戝叧妯″潡 </description> <dependencies> diff --git a/ruoyi-modules/pom.xml b/se-modules/pom.xml similarity index 70% rename from ruoyi-modules/pom.xml rename to se-modules/pom.xml index b3637b1..0357c0d 100644 --- a/ruoyi-modules/pom.xml +++ b/se-modules/pom.xml @@ -9,17 +9,17 @@ <modelVersion>4.0.0</modelVersion> <modules> - <module>ruoyi-system</module> - <module>ruoyi-gen</module> - <module>ruoyi-job</module> - <module>ruoyi-file</module> + <module>se-system</module> + <module>se-gen</module> + <module>se-job</module> + <module>se-file</module> </modules> - <artifactId>ruoyi-modules</artifactId> + <artifactId>se-modules</artifactId> <packaging>pom</packaging> <description> - ruoyi-modules涓氬姟妯″潡 + se-modules涓氬姟妯″潡 </description> </project> diff --git a/ruoyi-modules/se-file/pom.xml b/se-modules/se-file/pom.xml similarity index 96% rename from ruoyi-modules/se-file/pom.xml rename to se-modules/se-file/pom.xml index 2b9d51c..957d1c8 100644 --- a/ruoyi-modules/se-file/pom.xml +++ b/se-modules/se-file/pom.xml @@ -9,10 +9,10 @@ </parent> <modelVersion>4.0.0</modelVersion> - <artifactId>ruoyi-modules-file</artifactId> + <artifactId>se-modules-file</artifactId> <description> - ruoyi-modules-file鏂囦欢鏈嶅姟 + se-modules-file鏂囦欢鏈嶅姟 </description> <dependencies> diff --git a/ruoyi-modules/se-file/src/main/java/com/se/file/SeFileApplication.java b/se-modules/se-file/src/main/java/com/se/file/SeFileApplication.java similarity index 100% rename from ruoyi-modules/se-file/src/main/java/com/se/file/SeFileApplication.java rename to se-modules/se-file/src/main/java/com/se/file/SeFileApplication.java diff --git a/ruoyi-modules/se-file/src/main/java/com/se/file/config/MinioConfig.java b/se-modules/se-file/src/main/java/com/se/file/config/MinioConfig.java similarity index 100% rename from ruoyi-modules/se-file/src/main/java/com/se/file/config/MinioConfig.java rename to se-modules/se-file/src/main/java/com/se/file/config/MinioConfig.java diff --git a/ruoyi-modules/se-file/src/main/java/com/se/file/config/ResourcesConfig.java b/se-modules/se-file/src/main/java/com/se/file/config/ResourcesConfig.java similarity index 100% rename from ruoyi-modules/se-file/src/main/java/com/se/file/config/ResourcesConfig.java rename to se-modules/se-file/src/main/java/com/se/file/config/ResourcesConfig.java diff --git a/ruoyi-modules/se-file/src/main/java/com/se/file/controller/SysFileController.java b/se-modules/se-file/src/main/java/com/se/file/controller/SysFileController.java similarity index 100% rename from ruoyi-modules/se-file/src/main/java/com/se/file/controller/SysFileController.java rename to se-modules/se-file/src/main/java/com/se/file/controller/SysFileController.java diff --git a/ruoyi-modules/se-file/src/main/java/com/se/file/service/FastDfsSysFileServiceImpl.java b/se-modules/se-file/src/main/java/com/se/file/service/FastDfsSysFileServiceImpl.java similarity index 100% rename from ruoyi-modules/se-file/src/main/java/com/se/file/service/FastDfsSysFileServiceImpl.java rename to se-modules/se-file/src/main/java/com/se/file/service/FastDfsSysFileServiceImpl.java diff --git a/ruoyi-modules/se-file/src/main/java/com/se/file/service/ISysFileService.java b/se-modules/se-file/src/main/java/com/se/file/service/ISysFileService.java similarity index 100% rename from ruoyi-modules/se-file/src/main/java/com/se/file/service/ISysFileService.java rename to se-modules/se-file/src/main/java/com/se/file/service/ISysFileService.java diff --git a/ruoyi-modules/se-file/src/main/java/com/se/file/service/LocalSysFileServiceImpl.java b/se-modules/se-file/src/main/java/com/se/file/service/LocalSysFileServiceImpl.java similarity index 100% rename from ruoyi-modules/se-file/src/main/java/com/se/file/service/LocalSysFileServiceImpl.java rename to se-modules/se-file/src/main/java/com/se/file/service/LocalSysFileServiceImpl.java diff --git a/ruoyi-modules/se-file/src/main/java/com/se/file/service/MinioSysFileServiceImpl.java b/se-modules/se-file/src/main/java/com/se/file/service/MinioSysFileServiceImpl.java similarity index 100% rename from ruoyi-modules/se-file/src/main/java/com/se/file/service/MinioSysFileServiceImpl.java rename to se-modules/se-file/src/main/java/com/se/file/service/MinioSysFileServiceImpl.java diff --git a/ruoyi-modules/se-file/src/main/java/com/se/file/utils/FileUploadUtils.java b/se-modules/se-file/src/main/java/com/se/file/utils/FileUploadUtils.java similarity index 100% rename from ruoyi-modules/se-file/src/main/java/com/se/file/utils/FileUploadUtils.java rename to se-modules/se-file/src/main/java/com/se/file/utils/FileUploadUtils.java diff --git a/ruoyi-modules/se-file/src/main/resources/banner.txt b/se-modules/se-file/src/main/resources/banner.txt similarity index 100% rename from ruoyi-modules/se-file/src/main/resources/banner.txt rename to se-modules/se-file/src/main/resources/banner.txt diff --git a/ruoyi-modules/se-file/src/main/resources/bootstrap.yml b/se-modules/se-file/src/main/resources/bootstrap.yml similarity index 100% rename from ruoyi-modules/se-file/src/main/resources/bootstrap.yml rename to se-modules/se-file/src/main/resources/bootstrap.yml diff --git a/ruoyi-modules/se-file/src/main/resources/logback.xml b/se-modules/se-file/src/main/resources/logback.xml similarity index 100% rename from ruoyi-modules/se-file/src/main/resources/logback.xml rename to se-modules/se-file/src/main/resources/logback.xml diff --git a/ruoyi-modules/se-gen/pom.xml b/se-modules/se-gen/pom.xml similarity index 96% rename from ruoyi-modules/se-gen/pom.xml rename to se-modules/se-gen/pom.xml index a724a42..f962c93 100644 --- a/ruoyi-modules/se-gen/pom.xml +++ b/se-modules/se-gen/pom.xml @@ -9,10 +9,10 @@ </parent> <modelVersion>4.0.0</modelVersion> - <artifactId>ruoyi-modules-gen</artifactId> + <artifactId>se-modules-gen</artifactId> <description> - ruoyi-modules-gen浠g爜鐢熸垚 + se-modules-gen浠g爜鐢熸垚 </description> <dependencies> diff --git a/ruoyi-modules/se-gen/src/main/java/com/se/gen/SeGenApplication.java b/se-modules/se-gen/src/main/java/com/se/gen/SeGenApplication.java similarity index 100% rename from ruoyi-modules/se-gen/src/main/java/com/se/gen/SeGenApplication.java rename to se-modules/se-gen/src/main/java/com/se/gen/SeGenApplication.java diff --git a/ruoyi-modules/se-gen/src/main/java/com/se/gen/config/GenConfig.java b/se-modules/se-gen/src/main/java/com/se/gen/config/GenConfig.java similarity index 100% rename from ruoyi-modules/se-gen/src/main/java/com/se/gen/config/GenConfig.java rename to se-modules/se-gen/src/main/java/com/se/gen/config/GenConfig.java diff --git a/ruoyi-modules/se-gen/src/main/java/com/se/gen/controller/GenController.java b/se-modules/se-gen/src/main/java/com/se/gen/controller/GenController.java similarity index 100% rename from ruoyi-modules/se-gen/src/main/java/com/se/gen/controller/GenController.java rename to se-modules/se-gen/src/main/java/com/se/gen/controller/GenController.java diff --git a/ruoyi-modules/se-gen/src/main/java/com/se/gen/domain/GenTable.java b/se-modules/se-gen/src/main/java/com/se/gen/domain/GenTable.java similarity index 100% rename from ruoyi-modules/se-gen/src/main/java/com/se/gen/domain/GenTable.java rename to se-modules/se-gen/src/main/java/com/se/gen/domain/GenTable.java diff --git a/ruoyi-modules/se-gen/src/main/java/com/se/gen/domain/GenTableColumn.java b/se-modules/se-gen/src/main/java/com/se/gen/domain/GenTableColumn.java similarity index 100% rename from ruoyi-modules/se-gen/src/main/java/com/se/gen/domain/GenTableColumn.java rename to se-modules/se-gen/src/main/java/com/se/gen/domain/GenTableColumn.java diff --git a/ruoyi-modules/se-gen/src/main/java/com/se/gen/mapper/GenTableColumnMapper.java b/se-modules/se-gen/src/main/java/com/se/gen/mapper/GenTableColumnMapper.java similarity index 100% rename from ruoyi-modules/se-gen/src/main/java/com/se/gen/mapper/GenTableColumnMapper.java rename to se-modules/se-gen/src/main/java/com/se/gen/mapper/GenTableColumnMapper.java diff --git a/ruoyi-modules/se-gen/src/main/java/com/se/gen/mapper/GenTableMapper.java b/se-modules/se-gen/src/main/java/com/se/gen/mapper/GenTableMapper.java similarity index 100% rename from ruoyi-modules/se-gen/src/main/java/com/se/gen/mapper/GenTableMapper.java rename to se-modules/se-gen/src/main/java/com/se/gen/mapper/GenTableMapper.java diff --git a/ruoyi-modules/se-gen/src/main/java/com/se/gen/service/GenTableColumnServiceImpl.java b/se-modules/se-gen/src/main/java/com/se/gen/service/GenTableColumnServiceImpl.java similarity index 100% rename from ruoyi-modules/se-gen/src/main/java/com/se/gen/service/GenTableColumnServiceImpl.java rename to se-modules/se-gen/src/main/java/com/se/gen/service/GenTableColumnServiceImpl.java diff --git a/ruoyi-modules/se-gen/src/main/java/com/se/gen/service/GenTableServiceImpl.java b/se-modules/se-gen/src/main/java/com/se/gen/service/GenTableServiceImpl.java similarity index 100% rename from ruoyi-modules/se-gen/src/main/java/com/se/gen/service/GenTableServiceImpl.java rename to se-modules/se-gen/src/main/java/com/se/gen/service/GenTableServiceImpl.java diff --git a/ruoyi-modules/se-gen/src/main/java/com/se/gen/service/IGenTableColumnService.java b/se-modules/se-gen/src/main/java/com/se/gen/service/IGenTableColumnService.java similarity index 100% rename from ruoyi-modules/se-gen/src/main/java/com/se/gen/service/IGenTableColumnService.java rename to se-modules/se-gen/src/main/java/com/se/gen/service/IGenTableColumnService.java diff --git a/ruoyi-modules/se-gen/src/main/java/com/se/gen/service/IGenTableService.java b/se-modules/se-gen/src/main/java/com/se/gen/service/IGenTableService.java similarity index 100% rename from ruoyi-modules/se-gen/src/main/java/com/se/gen/service/IGenTableService.java rename to se-modules/se-gen/src/main/java/com/se/gen/service/IGenTableService.java diff --git a/ruoyi-modules/se-gen/src/main/java/com/se/gen/util/GenUtils.java b/se-modules/se-gen/src/main/java/com/se/gen/util/GenUtils.java similarity index 100% rename from ruoyi-modules/se-gen/src/main/java/com/se/gen/util/GenUtils.java rename to se-modules/se-gen/src/main/java/com/se/gen/util/GenUtils.java diff --git a/ruoyi-modules/se-gen/src/main/java/com/se/gen/util/VelocityInitializer.java b/se-modules/se-gen/src/main/java/com/se/gen/util/VelocityInitializer.java similarity index 100% rename from ruoyi-modules/se-gen/src/main/java/com/se/gen/util/VelocityInitializer.java rename to se-modules/se-gen/src/main/java/com/se/gen/util/VelocityInitializer.java diff --git a/ruoyi-modules/se-gen/src/main/java/com/se/gen/util/VelocityUtils.java b/se-modules/se-gen/src/main/java/com/se/gen/util/VelocityUtils.java similarity index 100% rename from ruoyi-modules/se-gen/src/main/java/com/se/gen/util/VelocityUtils.java rename to se-modules/se-gen/src/main/java/com/se/gen/util/VelocityUtils.java diff --git a/ruoyi-modules/se-gen/src/main/resources/banner.txt b/se-modules/se-gen/src/main/resources/banner.txt similarity index 100% rename from ruoyi-modules/se-gen/src/main/resources/banner.txt rename to se-modules/se-gen/src/main/resources/banner.txt diff --git a/ruoyi-modules/se-gen/src/main/resources/bootstrap.yml b/se-modules/se-gen/src/main/resources/bootstrap.yml similarity index 100% rename from ruoyi-modules/se-gen/src/main/resources/bootstrap.yml rename to se-modules/se-gen/src/main/resources/bootstrap.yml diff --git a/ruoyi-modules/se-gen/src/main/resources/logback.xml b/se-modules/se-gen/src/main/resources/logback.xml similarity index 100% rename from ruoyi-modules/se-gen/src/main/resources/logback.xml rename to se-modules/se-gen/src/main/resources/logback.xml diff --git a/ruoyi-modules/se-gen/src/main/resources/mapper/generator/GenTableColumnMapper.xml b/se-modules/se-gen/src/main/resources/mapper/generator/GenTableColumnMapper.xml similarity index 100% rename from ruoyi-modules/se-gen/src/main/resources/mapper/generator/GenTableColumnMapper.xml rename to se-modules/se-gen/src/main/resources/mapper/generator/GenTableColumnMapper.xml diff --git a/ruoyi-modules/se-gen/src/main/resources/mapper/generator/GenTableMapper.xml b/se-modules/se-gen/src/main/resources/mapper/generator/GenTableMapper.xml similarity index 100% rename from ruoyi-modules/se-gen/src/main/resources/mapper/generator/GenTableMapper.xml rename to se-modules/se-gen/src/main/resources/mapper/generator/GenTableMapper.xml diff --git a/ruoyi-modules/se-gen/src/main/resources/vm/java/controller.java.vm b/se-modules/se-gen/src/main/resources/vm/java/controller.java.vm similarity index 100% rename from ruoyi-modules/se-gen/src/main/resources/vm/java/controller.java.vm rename to se-modules/se-gen/src/main/resources/vm/java/controller.java.vm diff --git a/ruoyi-modules/se-gen/src/main/resources/vm/java/domain.java.vm b/se-modules/se-gen/src/main/resources/vm/java/domain.java.vm similarity index 100% rename from ruoyi-modules/se-gen/src/main/resources/vm/java/domain.java.vm rename to se-modules/se-gen/src/main/resources/vm/java/domain.java.vm diff --git a/ruoyi-modules/se-gen/src/main/resources/vm/java/mapper.java.vm b/se-modules/se-gen/src/main/resources/vm/java/mapper.java.vm similarity index 100% rename from ruoyi-modules/se-gen/src/main/resources/vm/java/mapper.java.vm rename to se-modules/se-gen/src/main/resources/vm/java/mapper.java.vm diff --git a/ruoyi-modules/se-gen/src/main/resources/vm/java/service.java.vm b/se-modules/se-gen/src/main/resources/vm/java/service.java.vm similarity index 100% rename from ruoyi-modules/se-gen/src/main/resources/vm/java/service.java.vm rename to se-modules/se-gen/src/main/resources/vm/java/service.java.vm diff --git a/ruoyi-modules/se-gen/src/main/resources/vm/java/serviceImpl.java.vm b/se-modules/se-gen/src/main/resources/vm/java/serviceImpl.java.vm similarity index 100% rename from ruoyi-modules/se-gen/src/main/resources/vm/java/serviceImpl.java.vm rename to se-modules/se-gen/src/main/resources/vm/java/serviceImpl.java.vm diff --git a/ruoyi-modules/se-gen/src/main/resources/vm/java/sub-domain.java.vm b/se-modules/se-gen/src/main/resources/vm/java/sub-domain.java.vm similarity index 100% rename from ruoyi-modules/se-gen/src/main/resources/vm/java/sub-domain.java.vm rename to se-modules/se-gen/src/main/resources/vm/java/sub-domain.java.vm diff --git a/ruoyi-modules/se-gen/src/main/resources/vm/js/api.js.vm b/se-modules/se-gen/src/main/resources/vm/js/api.js.vm similarity index 100% rename from ruoyi-modules/se-gen/src/main/resources/vm/js/api.js.vm rename to se-modules/se-gen/src/main/resources/vm/js/api.js.vm diff --git a/ruoyi-modules/se-gen/src/main/resources/vm/sql/sql.vm b/se-modules/se-gen/src/main/resources/vm/sql/sql.vm similarity index 100% rename from ruoyi-modules/se-gen/src/main/resources/vm/sql/sql.vm rename to se-modules/se-gen/src/main/resources/vm/sql/sql.vm diff --git a/ruoyi-modules/se-gen/src/main/resources/vm/vue/index-tree.vue.vm b/se-modules/se-gen/src/main/resources/vm/vue/index-tree.vue.vm similarity index 100% rename from ruoyi-modules/se-gen/src/main/resources/vm/vue/index-tree.vue.vm rename to se-modules/se-gen/src/main/resources/vm/vue/index-tree.vue.vm diff --git a/ruoyi-modules/se-gen/src/main/resources/vm/vue/index.vue.vm b/se-modules/se-gen/src/main/resources/vm/vue/index.vue.vm similarity index 100% rename from ruoyi-modules/se-gen/src/main/resources/vm/vue/index.vue.vm rename to se-modules/se-gen/src/main/resources/vm/vue/index.vue.vm diff --git a/ruoyi-modules/se-gen/src/main/resources/vm/vue/v3/index-tree.vue.vm b/se-modules/se-gen/src/main/resources/vm/vue/v3/index-tree.vue.vm similarity index 100% rename from ruoyi-modules/se-gen/src/main/resources/vm/vue/v3/index-tree.vue.vm rename to se-modules/se-gen/src/main/resources/vm/vue/v3/index-tree.vue.vm diff --git a/ruoyi-modules/se-gen/src/main/resources/vm/vue/v3/index.vue.vm b/se-modules/se-gen/src/main/resources/vm/vue/v3/index.vue.vm similarity index 100% rename from ruoyi-modules/se-gen/src/main/resources/vm/vue/v3/index.vue.vm rename to se-modules/se-gen/src/main/resources/vm/vue/v3/index.vue.vm diff --git a/ruoyi-modules/se-gen/src/main/resources/vm/xml/mapper.xml.vm b/se-modules/se-gen/src/main/resources/vm/xml/mapper.xml.vm similarity index 100% rename from ruoyi-modules/se-gen/src/main/resources/vm/xml/mapper.xml.vm rename to se-modules/se-gen/src/main/resources/vm/xml/mapper.xml.vm diff --git a/ruoyi-modules/se-job/pom.xml b/se-modules/se-job/pom.xml similarity index 97% rename from ruoyi-modules/se-job/pom.xml rename to se-modules/se-job/pom.xml index 76c5568..f9b87f4 100644 --- a/ruoyi-modules/se-job/pom.xml +++ b/se-modules/se-job/pom.xml @@ -9,10 +9,10 @@ </parent> <modelVersion>4.0.0</modelVersion> - <artifactId>ruoyi-modules-job</artifactId> + <artifactId>se-modules-job</artifactId> <description> - ruoyi-modules-job瀹氭椂浠诲姟 + se-modules-job瀹氭椂浠诲姟 </description> <dependencies> diff --git a/ruoyi-modules/se-job/src/main/java/com/se/job/SeJobApplication.java b/se-modules/se-job/src/main/java/com/se/job/SeJobApplication.java similarity index 100% rename from ruoyi-modules/se-job/src/main/java/com/se/job/SeJobApplication.java rename to se-modules/se-job/src/main/java/com/se/job/SeJobApplication.java diff --git a/ruoyi-modules/se-job/src/main/java/com/se/job/config/ScheduleConfig.java b/se-modules/se-job/src/main/java/com/se/job/config/ScheduleConfig.java similarity index 100% rename from ruoyi-modules/se-job/src/main/java/com/se/job/config/ScheduleConfig.java rename to se-modules/se-job/src/main/java/com/se/job/config/ScheduleConfig.java diff --git a/ruoyi-modules/se-job/src/main/java/com/se/job/controller/SysJobController.java b/se-modules/se-job/src/main/java/com/se/job/controller/SysJobController.java similarity index 100% rename from ruoyi-modules/se-job/src/main/java/com/se/job/controller/SysJobController.java rename to se-modules/se-job/src/main/java/com/se/job/controller/SysJobController.java diff --git a/ruoyi-modules/se-job/src/main/java/com/se/job/controller/SysJobLogController.java b/se-modules/se-job/src/main/java/com/se/job/controller/SysJobLogController.java similarity index 100% rename from ruoyi-modules/se-job/src/main/java/com/se/job/controller/SysJobLogController.java rename to se-modules/se-job/src/main/java/com/se/job/controller/SysJobLogController.java diff --git a/ruoyi-modules/se-job/src/main/java/com/se/job/domain/SysJob.java b/se-modules/se-job/src/main/java/com/se/job/domain/SysJob.java similarity index 100% rename from ruoyi-modules/se-job/src/main/java/com/se/job/domain/SysJob.java rename to se-modules/se-job/src/main/java/com/se/job/domain/SysJob.java diff --git a/ruoyi-modules/se-job/src/main/java/com/se/job/domain/SysJobLog.java b/se-modules/se-job/src/main/java/com/se/job/domain/SysJobLog.java similarity index 100% rename from ruoyi-modules/se-job/src/main/java/com/se/job/domain/SysJobLog.java rename to se-modules/se-job/src/main/java/com/se/job/domain/SysJobLog.java diff --git a/ruoyi-modules/se-job/src/main/java/com/se/job/mapper/SysJobLogMapper.java b/se-modules/se-job/src/main/java/com/se/job/mapper/SysJobLogMapper.java similarity index 100% rename from ruoyi-modules/se-job/src/main/java/com/se/job/mapper/SysJobLogMapper.java rename to se-modules/se-job/src/main/java/com/se/job/mapper/SysJobLogMapper.java diff --git a/ruoyi-modules/se-job/src/main/java/com/se/job/mapper/SysJobMapper.java b/se-modules/se-job/src/main/java/com/se/job/mapper/SysJobMapper.java similarity index 100% rename from ruoyi-modules/se-job/src/main/java/com/se/job/mapper/SysJobMapper.java rename to se-modules/se-job/src/main/java/com/se/job/mapper/SysJobMapper.java diff --git a/ruoyi-modules/se-job/src/main/java/com/se/job/service/ISysJobLogService.java b/se-modules/se-job/src/main/java/com/se/job/service/ISysJobLogService.java similarity index 100% rename from ruoyi-modules/se-job/src/main/java/com/se/job/service/ISysJobLogService.java rename to se-modules/se-job/src/main/java/com/se/job/service/ISysJobLogService.java diff --git a/ruoyi-modules/se-job/src/main/java/com/se/job/service/ISysJobService.java b/se-modules/se-job/src/main/java/com/se/job/service/ISysJobService.java similarity index 100% rename from ruoyi-modules/se-job/src/main/java/com/se/job/service/ISysJobService.java rename to se-modules/se-job/src/main/java/com/se/job/service/ISysJobService.java diff --git a/ruoyi-modules/se-job/src/main/java/com/se/job/service/SysJobLogServiceImpl.java b/se-modules/se-job/src/main/java/com/se/job/service/SysJobLogServiceImpl.java similarity index 100% rename from ruoyi-modules/se-job/src/main/java/com/se/job/service/SysJobLogServiceImpl.java rename to se-modules/se-job/src/main/java/com/se/job/service/SysJobLogServiceImpl.java diff --git a/ruoyi-modules/se-job/src/main/java/com/se/job/service/SysJobServiceImpl.java b/se-modules/se-job/src/main/java/com/se/job/service/SysJobServiceImpl.java similarity index 100% rename from ruoyi-modules/se-job/src/main/java/com/se/job/service/SysJobServiceImpl.java rename to se-modules/se-job/src/main/java/com/se/job/service/SysJobServiceImpl.java diff --git a/ruoyi-modules/se-job/src/main/java/com/se/job/task/RyTask.java b/se-modules/se-job/src/main/java/com/se/job/task/RyTask.java similarity index 100% rename from ruoyi-modules/se-job/src/main/java/com/se/job/task/RyTask.java rename to se-modules/se-job/src/main/java/com/se/job/task/RyTask.java diff --git a/ruoyi-modules/se-job/src/main/java/com/se/job/util/AbstractQuartzJob.java b/se-modules/se-job/src/main/java/com/se/job/util/AbstractQuartzJob.java similarity index 100% rename from ruoyi-modules/se-job/src/main/java/com/se/job/util/AbstractQuartzJob.java rename to se-modules/se-job/src/main/java/com/se/job/util/AbstractQuartzJob.java diff --git a/ruoyi-modules/se-job/src/main/java/com/se/job/util/CronUtils.java b/se-modules/se-job/src/main/java/com/se/job/util/CronUtils.java similarity index 100% rename from ruoyi-modules/se-job/src/main/java/com/se/job/util/CronUtils.java rename to se-modules/se-job/src/main/java/com/se/job/util/CronUtils.java diff --git a/ruoyi-modules/se-job/src/main/java/com/se/job/util/JobInvokeUtil.java b/se-modules/se-job/src/main/java/com/se/job/util/JobInvokeUtil.java similarity index 100% rename from ruoyi-modules/se-job/src/main/java/com/se/job/util/JobInvokeUtil.java rename to se-modules/se-job/src/main/java/com/se/job/util/JobInvokeUtil.java diff --git a/ruoyi-modules/se-job/src/main/java/com/se/job/util/QuartzDisallowConcurrentExecution.java b/se-modules/se-job/src/main/java/com/se/job/util/QuartzDisallowConcurrentExecution.java similarity index 100% rename from ruoyi-modules/se-job/src/main/java/com/se/job/util/QuartzDisallowConcurrentExecution.java rename to se-modules/se-job/src/main/java/com/se/job/util/QuartzDisallowConcurrentExecution.java diff --git a/ruoyi-modules/se-job/src/main/java/com/se/job/util/QuartzJobExecution.java b/se-modules/se-job/src/main/java/com/se/job/util/QuartzJobExecution.java similarity index 100% rename from ruoyi-modules/se-job/src/main/java/com/se/job/util/QuartzJobExecution.java rename to se-modules/se-job/src/main/java/com/se/job/util/QuartzJobExecution.java diff --git a/ruoyi-modules/se-job/src/main/java/com/se/job/util/ScheduleUtils.java b/se-modules/se-job/src/main/java/com/se/job/util/ScheduleUtils.java similarity index 100% rename from ruoyi-modules/se-job/src/main/java/com/se/job/util/ScheduleUtils.java rename to se-modules/se-job/src/main/java/com/se/job/util/ScheduleUtils.java diff --git a/ruoyi-modules/se-job/src/main/resources/banner.txt b/se-modules/se-job/src/main/resources/banner.txt similarity index 100% rename from ruoyi-modules/se-job/src/main/resources/banner.txt rename to se-modules/se-job/src/main/resources/banner.txt diff --git a/ruoyi-modules/se-job/src/main/resources/bootstrap.yml b/se-modules/se-job/src/main/resources/bootstrap.yml similarity index 100% rename from ruoyi-modules/se-job/src/main/resources/bootstrap.yml rename to se-modules/se-job/src/main/resources/bootstrap.yml diff --git a/ruoyi-modules/se-job/src/main/resources/logback.xml b/se-modules/se-job/src/main/resources/logback.xml similarity index 100% rename from ruoyi-modules/se-job/src/main/resources/logback.xml rename to se-modules/se-job/src/main/resources/logback.xml diff --git a/ruoyi-modules/se-job/src/main/resources/mapper/job/SysJobLogMapper.xml b/se-modules/se-job/src/main/resources/mapper/job/SysJobLogMapper.xml similarity index 100% rename from ruoyi-modules/se-job/src/main/resources/mapper/job/SysJobLogMapper.xml rename to se-modules/se-job/src/main/resources/mapper/job/SysJobLogMapper.xml diff --git a/ruoyi-modules/se-job/src/main/resources/mapper/job/SysJobMapper.xml b/se-modules/se-job/src/main/resources/mapper/job/SysJobMapper.xml similarity index 100% rename from ruoyi-modules/se-job/src/main/resources/mapper/job/SysJobMapper.xml rename to se-modules/se-job/src/main/resources/mapper/job/SysJobMapper.xml diff --git a/ruoyi-modules/se-system/pom.xml b/se-modules/se-system/pom.xml similarity index 96% rename from ruoyi-modules/se-system/pom.xml rename to se-modules/se-system/pom.xml index 9b665d3..55f7ed5 100644 --- a/ruoyi-modules/se-system/pom.xml +++ b/se-modules/se-system/pom.xml @@ -9,10 +9,10 @@ </parent> <modelVersion>4.0.0</modelVersion> - <artifactId>ruoyi-modules-system</artifactId> + <artifactId>se-modules-system</artifactId> <description> - ruoyi-modules-system绯荤粺妯″潡 + se-modules-system绯荤粺妯″潡 </description> <dependencies> diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/RuoYiSystemApplication.java b/se-modules/se-system/src/main/java/com/se/system/RuoYiSystemApplication.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/RuoYiSystemApplication.java rename to se-modules/se-system/src/main/java/com/se/system/RuoYiSystemApplication.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/controller/SysConfigController.java b/se-modules/se-system/src/main/java/com/se/system/controller/SysConfigController.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/controller/SysConfigController.java rename to se-modules/se-system/src/main/java/com/se/system/controller/SysConfigController.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/controller/SysDeptController.java b/se-modules/se-system/src/main/java/com/se/system/controller/SysDeptController.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/controller/SysDeptController.java rename to se-modules/se-system/src/main/java/com/se/system/controller/SysDeptController.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/controller/SysDictDataController.java b/se-modules/se-system/src/main/java/com/se/system/controller/SysDictDataController.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/controller/SysDictDataController.java rename to se-modules/se-system/src/main/java/com/se/system/controller/SysDictDataController.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/controller/SysDictTypeController.java b/se-modules/se-system/src/main/java/com/se/system/controller/SysDictTypeController.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/controller/SysDictTypeController.java rename to se-modules/se-system/src/main/java/com/se/system/controller/SysDictTypeController.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/controller/SysLogininforController.java b/se-modules/se-system/src/main/java/com/se/system/controller/SysLogininforController.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/controller/SysLogininforController.java rename to se-modules/se-system/src/main/java/com/se/system/controller/SysLogininforController.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/controller/SysMenuController.java b/se-modules/se-system/src/main/java/com/se/system/controller/SysMenuController.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/controller/SysMenuController.java rename to se-modules/se-system/src/main/java/com/se/system/controller/SysMenuController.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/controller/SysNoticeController.java b/se-modules/se-system/src/main/java/com/se/system/controller/SysNoticeController.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/controller/SysNoticeController.java rename to se-modules/se-system/src/main/java/com/se/system/controller/SysNoticeController.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/controller/SysOperlogController.java b/se-modules/se-system/src/main/java/com/se/system/controller/SysOperlogController.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/controller/SysOperlogController.java rename to se-modules/se-system/src/main/java/com/se/system/controller/SysOperlogController.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/controller/SysPostController.java b/se-modules/se-system/src/main/java/com/se/system/controller/SysPostController.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/controller/SysPostController.java rename to se-modules/se-system/src/main/java/com/se/system/controller/SysPostController.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/controller/SysProfileController.java b/se-modules/se-system/src/main/java/com/se/system/controller/SysProfileController.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/controller/SysProfileController.java rename to se-modules/se-system/src/main/java/com/se/system/controller/SysProfileController.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/controller/SysRoleController.java b/se-modules/se-system/src/main/java/com/se/system/controller/SysRoleController.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/controller/SysRoleController.java rename to se-modules/se-system/src/main/java/com/se/system/controller/SysRoleController.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/controller/SysUserController.java b/se-modules/se-system/src/main/java/com/se/system/controller/SysUserController.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/controller/SysUserController.java rename to se-modules/se-system/src/main/java/com/se/system/controller/SysUserController.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/controller/SysUserOnlineController.java b/se-modules/se-system/src/main/java/com/se/system/controller/SysUserOnlineController.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/controller/SysUserOnlineController.java rename to se-modules/se-system/src/main/java/com/se/system/controller/SysUserOnlineController.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/domain/SysConfig.java b/se-modules/se-system/src/main/java/com/se/system/domain/SysConfig.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/domain/SysConfig.java rename to se-modules/se-system/src/main/java/com/se/system/domain/SysConfig.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/domain/SysMenu.java b/se-modules/se-system/src/main/java/com/se/system/domain/SysMenu.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/domain/SysMenu.java rename to se-modules/se-system/src/main/java/com/se/system/domain/SysMenu.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/domain/SysNotice.java b/se-modules/se-system/src/main/java/com/se/system/domain/SysNotice.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/domain/SysNotice.java rename to se-modules/se-system/src/main/java/com/se/system/domain/SysNotice.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/domain/SysPost.java b/se-modules/se-system/src/main/java/com/se/system/domain/SysPost.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/domain/SysPost.java rename to se-modules/se-system/src/main/java/com/se/system/domain/SysPost.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/domain/SysRoleDept.java b/se-modules/se-system/src/main/java/com/se/system/domain/SysRoleDept.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/domain/SysRoleDept.java rename to se-modules/se-system/src/main/java/com/se/system/domain/SysRoleDept.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/domain/SysRoleMenu.java b/se-modules/se-system/src/main/java/com/se/system/domain/SysRoleMenu.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/domain/SysRoleMenu.java rename to se-modules/se-system/src/main/java/com/se/system/domain/SysRoleMenu.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/domain/SysUserOnline.java b/se-modules/se-system/src/main/java/com/se/system/domain/SysUserOnline.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/domain/SysUserOnline.java rename to se-modules/se-system/src/main/java/com/se/system/domain/SysUserOnline.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/domain/SysUserPost.java b/se-modules/se-system/src/main/java/com/se/system/domain/SysUserPost.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/domain/SysUserPost.java rename to se-modules/se-system/src/main/java/com/se/system/domain/SysUserPost.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/domain/SysUserRole.java b/se-modules/se-system/src/main/java/com/se/system/domain/SysUserRole.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/domain/SysUserRole.java rename to se-modules/se-system/src/main/java/com/se/system/domain/SysUserRole.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/domain/vo/MetaVo.java b/se-modules/se-system/src/main/java/com/se/system/domain/vo/MetaVo.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/domain/vo/MetaVo.java rename to se-modules/se-system/src/main/java/com/se/system/domain/vo/MetaVo.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/domain/vo/RouterVo.java b/se-modules/se-system/src/main/java/com/se/system/domain/vo/RouterVo.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/domain/vo/RouterVo.java rename to se-modules/se-system/src/main/java/com/se/system/domain/vo/RouterVo.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/domain/vo/TreeSelect.java b/se-modules/se-system/src/main/java/com/se/system/domain/vo/TreeSelect.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/domain/vo/TreeSelect.java rename to se-modules/se-system/src/main/java/com/se/system/domain/vo/TreeSelect.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysConfigMapper.java b/se-modules/se-system/src/main/java/com/se/system/mapper/SysConfigMapper.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysConfigMapper.java rename to se-modules/se-system/src/main/java/com/se/system/mapper/SysConfigMapper.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysDeptMapper.java b/se-modules/se-system/src/main/java/com/se/system/mapper/SysDeptMapper.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysDeptMapper.java rename to se-modules/se-system/src/main/java/com/se/system/mapper/SysDeptMapper.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysDictDataMapper.java b/se-modules/se-system/src/main/java/com/se/system/mapper/SysDictDataMapper.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysDictDataMapper.java rename to se-modules/se-system/src/main/java/com/se/system/mapper/SysDictDataMapper.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysDictTypeMapper.java b/se-modules/se-system/src/main/java/com/se/system/mapper/SysDictTypeMapper.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysDictTypeMapper.java rename to se-modules/se-system/src/main/java/com/se/system/mapper/SysDictTypeMapper.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysLogininforMapper.java b/se-modules/se-system/src/main/java/com/se/system/mapper/SysLogininforMapper.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysLogininforMapper.java rename to se-modules/se-system/src/main/java/com/se/system/mapper/SysLogininforMapper.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysMenuMapper.java b/se-modules/se-system/src/main/java/com/se/system/mapper/SysMenuMapper.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysMenuMapper.java rename to se-modules/se-system/src/main/java/com/se/system/mapper/SysMenuMapper.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysNoticeMapper.java b/se-modules/se-system/src/main/java/com/se/system/mapper/SysNoticeMapper.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysNoticeMapper.java rename to se-modules/se-system/src/main/java/com/se/system/mapper/SysNoticeMapper.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysOperLogMapper.java b/se-modules/se-system/src/main/java/com/se/system/mapper/SysOperLogMapper.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysOperLogMapper.java rename to se-modules/se-system/src/main/java/com/se/system/mapper/SysOperLogMapper.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysPostMapper.java b/se-modules/se-system/src/main/java/com/se/system/mapper/SysPostMapper.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysPostMapper.java rename to se-modules/se-system/src/main/java/com/se/system/mapper/SysPostMapper.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysRoleDeptMapper.java b/se-modules/se-system/src/main/java/com/se/system/mapper/SysRoleDeptMapper.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysRoleDeptMapper.java rename to se-modules/se-system/src/main/java/com/se/system/mapper/SysRoleDeptMapper.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysRoleMapper.java b/se-modules/se-system/src/main/java/com/se/system/mapper/SysRoleMapper.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysRoleMapper.java rename to se-modules/se-system/src/main/java/com/se/system/mapper/SysRoleMapper.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysRoleMenuMapper.java b/se-modules/se-system/src/main/java/com/se/system/mapper/SysRoleMenuMapper.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysRoleMenuMapper.java rename to se-modules/se-system/src/main/java/com/se/system/mapper/SysRoleMenuMapper.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysUserMapper.java b/se-modules/se-system/src/main/java/com/se/system/mapper/SysUserMapper.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysUserMapper.java rename to se-modules/se-system/src/main/java/com/se/system/mapper/SysUserMapper.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysUserPostMapper.java b/se-modules/se-system/src/main/java/com/se/system/mapper/SysUserPostMapper.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysUserPostMapper.java rename to se-modules/se-system/src/main/java/com/se/system/mapper/SysUserPostMapper.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysUserRoleMapper.java b/se-modules/se-system/src/main/java/com/se/system/mapper/SysUserRoleMapper.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/mapper/SysUserRoleMapper.java rename to se-modules/se-system/src/main/java/com/se/system/mapper/SysUserRoleMapper.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/service/ISysConfigService.java b/se-modules/se-system/src/main/java/com/se/system/service/ISysConfigService.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/service/ISysConfigService.java rename to se-modules/se-system/src/main/java/com/se/system/service/ISysConfigService.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/service/ISysDeptService.java b/se-modules/se-system/src/main/java/com/se/system/service/ISysDeptService.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/service/ISysDeptService.java rename to se-modules/se-system/src/main/java/com/se/system/service/ISysDeptService.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/service/ISysDictDataService.java b/se-modules/se-system/src/main/java/com/se/system/service/ISysDictDataService.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/service/ISysDictDataService.java rename to se-modules/se-system/src/main/java/com/se/system/service/ISysDictDataService.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/service/ISysDictTypeService.java b/se-modules/se-system/src/main/java/com/se/system/service/ISysDictTypeService.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/service/ISysDictTypeService.java rename to se-modules/se-system/src/main/java/com/se/system/service/ISysDictTypeService.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/service/ISysLogininforService.java b/se-modules/se-system/src/main/java/com/se/system/service/ISysLogininforService.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/service/ISysLogininforService.java rename to se-modules/se-system/src/main/java/com/se/system/service/ISysLogininforService.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/service/ISysMenuService.java b/se-modules/se-system/src/main/java/com/se/system/service/ISysMenuService.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/service/ISysMenuService.java rename to se-modules/se-system/src/main/java/com/se/system/service/ISysMenuService.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/service/ISysNoticeService.java b/se-modules/se-system/src/main/java/com/se/system/service/ISysNoticeService.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/service/ISysNoticeService.java rename to se-modules/se-system/src/main/java/com/se/system/service/ISysNoticeService.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/service/ISysOperLogService.java b/se-modules/se-system/src/main/java/com/se/system/service/ISysOperLogService.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/service/ISysOperLogService.java rename to se-modules/se-system/src/main/java/com/se/system/service/ISysOperLogService.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/service/ISysPermissionService.java b/se-modules/se-system/src/main/java/com/se/system/service/ISysPermissionService.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/service/ISysPermissionService.java rename to se-modules/se-system/src/main/java/com/se/system/service/ISysPermissionService.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/service/ISysPostService.java b/se-modules/se-system/src/main/java/com/se/system/service/ISysPostService.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/service/ISysPostService.java rename to se-modules/se-system/src/main/java/com/se/system/service/ISysPostService.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/service/ISysRoleService.java b/se-modules/se-system/src/main/java/com/se/system/service/ISysRoleService.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/service/ISysRoleService.java rename to se-modules/se-system/src/main/java/com/se/system/service/ISysRoleService.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/service/ISysUserOnlineService.java b/se-modules/se-system/src/main/java/com/se/system/service/ISysUserOnlineService.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/service/ISysUserOnlineService.java rename to se-modules/se-system/src/main/java/com/se/system/service/ISysUserOnlineService.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/service/ISysUserService.java b/se-modules/se-system/src/main/java/com/se/system/service/ISysUserService.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/service/ISysUserService.java rename to se-modules/se-system/src/main/java/com/se/system/service/ISysUserService.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/service/impl/SysConfigServiceImpl.java b/se-modules/se-system/src/main/java/com/se/system/service/impl/SysConfigServiceImpl.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/service/impl/SysConfigServiceImpl.java rename to se-modules/se-system/src/main/java/com/se/system/service/impl/SysConfigServiceImpl.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/service/impl/SysDeptServiceImpl.java b/se-modules/se-system/src/main/java/com/se/system/service/impl/SysDeptServiceImpl.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/service/impl/SysDeptServiceImpl.java rename to se-modules/se-system/src/main/java/com/se/system/service/impl/SysDeptServiceImpl.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/service/impl/SysDictDataServiceImpl.java b/se-modules/se-system/src/main/java/com/se/system/service/impl/SysDictDataServiceImpl.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/service/impl/SysDictDataServiceImpl.java rename to se-modules/se-system/src/main/java/com/se/system/service/impl/SysDictDataServiceImpl.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/service/impl/SysDictTypeServiceImpl.java b/se-modules/se-system/src/main/java/com/se/system/service/impl/SysDictTypeServiceImpl.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/service/impl/SysDictTypeServiceImpl.java rename to se-modules/se-system/src/main/java/com/se/system/service/impl/SysDictTypeServiceImpl.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/service/impl/SysLogininforServiceImpl.java b/se-modules/se-system/src/main/java/com/se/system/service/impl/SysLogininforServiceImpl.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/service/impl/SysLogininforServiceImpl.java rename to se-modules/se-system/src/main/java/com/se/system/service/impl/SysLogininforServiceImpl.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/service/impl/SysMenuServiceImpl.java b/se-modules/se-system/src/main/java/com/se/system/service/impl/SysMenuServiceImpl.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/service/impl/SysMenuServiceImpl.java rename to se-modules/se-system/src/main/java/com/se/system/service/impl/SysMenuServiceImpl.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/service/impl/SysNoticeServiceImpl.java b/se-modules/se-system/src/main/java/com/se/system/service/impl/SysNoticeServiceImpl.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/service/impl/SysNoticeServiceImpl.java rename to se-modules/se-system/src/main/java/com/se/system/service/impl/SysNoticeServiceImpl.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/service/impl/SysOperLogServiceImpl.java b/se-modules/se-system/src/main/java/com/se/system/service/impl/SysOperLogServiceImpl.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/service/impl/SysOperLogServiceImpl.java rename to se-modules/se-system/src/main/java/com/se/system/service/impl/SysOperLogServiceImpl.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/service/impl/SysPermissionServiceImpl.java b/se-modules/se-system/src/main/java/com/se/system/service/impl/SysPermissionServiceImpl.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/service/impl/SysPermissionServiceImpl.java rename to se-modules/se-system/src/main/java/com/se/system/service/impl/SysPermissionServiceImpl.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/service/impl/SysPostServiceImpl.java b/se-modules/se-system/src/main/java/com/se/system/service/impl/SysPostServiceImpl.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/service/impl/SysPostServiceImpl.java rename to se-modules/se-system/src/main/java/com/se/system/service/impl/SysPostServiceImpl.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/service/impl/SysRoleServiceImpl.java b/se-modules/se-system/src/main/java/com/se/system/service/impl/SysRoleServiceImpl.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/service/impl/SysRoleServiceImpl.java rename to se-modules/se-system/src/main/java/com/se/system/service/impl/SysRoleServiceImpl.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/service/impl/SysUserOnlineServiceImpl.java b/se-modules/se-system/src/main/java/com/se/system/service/impl/SysUserOnlineServiceImpl.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/service/impl/SysUserOnlineServiceImpl.java rename to se-modules/se-system/src/main/java/com/se/system/service/impl/SysUserOnlineServiceImpl.java diff --git a/ruoyi-modules/se-system/src/main/java/com/se/system/service/impl/SysUserServiceImpl.java b/se-modules/se-system/src/main/java/com/se/system/service/impl/SysUserServiceImpl.java similarity index 100% rename from ruoyi-modules/se-system/src/main/java/com/se/system/service/impl/SysUserServiceImpl.java rename to se-modules/se-system/src/main/java/com/se/system/service/impl/SysUserServiceImpl.java diff --git a/ruoyi-modules/se-system/src/main/resources/banner.txt b/se-modules/se-system/src/main/resources/banner.txt similarity index 100% rename from ruoyi-modules/se-system/src/main/resources/banner.txt rename to se-modules/se-system/src/main/resources/banner.txt diff --git a/ruoyi-modules/se-system/src/main/resources/bootstrap.yml b/se-modules/se-system/src/main/resources/bootstrap.yml similarity index 100% rename from ruoyi-modules/se-system/src/main/resources/bootstrap.yml rename to se-modules/se-system/src/main/resources/bootstrap.yml diff --git a/ruoyi-modules/se-system/src/main/resources/logback.xml b/se-modules/se-system/src/main/resources/logback.xml similarity index 100% rename from ruoyi-modules/se-system/src/main/resources/logback.xml rename to se-modules/se-system/src/main/resources/logback.xml diff --git a/ruoyi-modules/se-system/src/main/resources/mapper/system/SysConfigMapper.xml b/se-modules/se-system/src/main/resources/mapper/system/SysConfigMapper.xml similarity index 100% rename from ruoyi-modules/se-system/src/main/resources/mapper/system/SysConfigMapper.xml rename to se-modules/se-system/src/main/resources/mapper/system/SysConfigMapper.xml diff --git a/ruoyi-modules/se-system/src/main/resources/mapper/system/SysDeptMapper.xml b/se-modules/se-system/src/main/resources/mapper/system/SysDeptMapper.xml similarity index 100% rename from ruoyi-modules/se-system/src/main/resources/mapper/system/SysDeptMapper.xml rename to se-modules/se-system/src/main/resources/mapper/system/SysDeptMapper.xml diff --git a/ruoyi-modules/se-system/src/main/resources/mapper/system/SysDictDataMapper.xml b/se-modules/se-system/src/main/resources/mapper/system/SysDictDataMapper.xml similarity index 100% rename from ruoyi-modules/se-system/src/main/resources/mapper/system/SysDictDataMapper.xml rename to se-modules/se-system/src/main/resources/mapper/system/SysDictDataMapper.xml diff --git a/ruoyi-modules/se-system/src/main/resources/mapper/system/SysDictTypeMapper.xml b/se-modules/se-system/src/main/resources/mapper/system/SysDictTypeMapper.xml similarity index 100% rename from ruoyi-modules/se-system/src/main/resources/mapper/system/SysDictTypeMapper.xml rename to se-modules/se-system/src/main/resources/mapper/system/SysDictTypeMapper.xml diff --git a/ruoyi-modules/se-system/src/main/resources/mapper/system/SysLogininforMapper.xml b/se-modules/se-system/src/main/resources/mapper/system/SysLogininforMapper.xml similarity index 100% rename from ruoyi-modules/se-system/src/main/resources/mapper/system/SysLogininforMapper.xml rename to se-modules/se-system/src/main/resources/mapper/system/SysLogininforMapper.xml diff --git a/ruoyi-modules/se-system/src/main/resources/mapper/system/SysMenuMapper.xml b/se-modules/se-system/src/main/resources/mapper/system/SysMenuMapper.xml similarity index 100% rename from ruoyi-modules/se-system/src/main/resources/mapper/system/SysMenuMapper.xml rename to se-modules/se-system/src/main/resources/mapper/system/SysMenuMapper.xml diff --git a/ruoyi-modules/se-system/src/main/resources/mapper/system/SysNoticeMapper.xml b/se-modules/se-system/src/main/resources/mapper/system/SysNoticeMapper.xml similarity index 100% rename from ruoyi-modules/se-system/src/main/resources/mapper/system/SysNoticeMapper.xml rename to se-modules/se-system/src/main/resources/mapper/system/SysNoticeMapper.xml diff --git a/ruoyi-modules/se-system/src/main/resources/mapper/system/SysOperLogMapper.xml b/se-modules/se-system/src/main/resources/mapper/system/SysOperLogMapper.xml similarity index 100% rename from ruoyi-modules/se-system/src/main/resources/mapper/system/SysOperLogMapper.xml rename to se-modules/se-system/src/main/resources/mapper/system/SysOperLogMapper.xml diff --git a/ruoyi-modules/se-system/src/main/resources/mapper/system/SysPostMapper.xml b/se-modules/se-system/src/main/resources/mapper/system/SysPostMapper.xml similarity index 100% rename from ruoyi-modules/se-system/src/main/resources/mapper/system/SysPostMapper.xml rename to se-modules/se-system/src/main/resources/mapper/system/SysPostMapper.xml diff --git a/ruoyi-modules/se-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml b/se-modules/se-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml similarity index 100% rename from ruoyi-modules/se-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml rename to se-modules/se-system/src/main/resources/mapper/system/SysRoleDeptMapper.xml diff --git a/ruoyi-modules/se-system/src/main/resources/mapper/system/SysRoleMapper.xml b/se-modules/se-system/src/main/resources/mapper/system/SysRoleMapper.xml similarity index 100% rename from ruoyi-modules/se-system/src/main/resources/mapper/system/SysRoleMapper.xml rename to se-modules/se-system/src/main/resources/mapper/system/SysRoleMapper.xml diff --git a/ruoyi-modules/se-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml b/se-modules/se-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml similarity index 100% rename from ruoyi-modules/se-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml rename to se-modules/se-system/src/main/resources/mapper/system/SysRoleMenuMapper.xml diff --git a/ruoyi-modules/se-system/src/main/resources/mapper/system/SysUserMapper.xml b/se-modules/se-system/src/main/resources/mapper/system/SysUserMapper.xml similarity index 100% rename from ruoyi-modules/se-system/src/main/resources/mapper/system/SysUserMapper.xml rename to se-modules/se-system/src/main/resources/mapper/system/SysUserMapper.xml diff --git a/ruoyi-modules/se-system/src/main/resources/mapper/system/SysUserPostMapper.xml b/se-modules/se-system/src/main/resources/mapper/system/SysUserPostMapper.xml similarity index 100% rename from ruoyi-modules/se-system/src/main/resources/mapper/system/SysUserPostMapper.xml rename to se-modules/se-system/src/main/resources/mapper/system/SysUserPostMapper.xml diff --git a/ruoyi-modules/se-system/src/main/resources/mapper/system/SysUserRoleMapper.xml b/se-modules/se-system/src/main/resources/mapper/system/SysUserRoleMapper.xml similarity index 100% rename from ruoyi-modules/se-system/src/main/resources/mapper/system/SysUserRoleMapper.xml rename to se-modules/se-system/src/main/resources/mapper/system/SysUserRoleMapper.xml diff --git a/se-visual/pom.xml b/se-visual/pom.xml index bdc98d9..525ed8d 100644 --- a/se-visual/pom.xml +++ b/se-visual/pom.xml @@ -9,14 +9,14 @@ <modelVersion>4.0.0</modelVersion> <modules> - <module>ruoyi-monitor</module> + <module>se-monitor</module> </modules> - <artifactId>ruoyi-visual</artifactId> + <artifactId>se-visual</artifactId> <packaging>pom</packaging> <description> - ruoyi-visual鍥惧舰鍖栫鐞嗘ā鍧� + se-visual鍥惧舰鍖栫鐞嗘ā鍧� </description> </project> diff --git a/se-visual/se-monitor/pom.xml b/se-visual/se-monitor/pom.xml index b8a3610..aa337d9 100644 --- a/se-visual/se-monitor/pom.xml +++ b/se-visual/se-monitor/pom.xml @@ -8,10 +8,10 @@ </parent> <modelVersion>4.0.0</modelVersion> - <artifactId>ruoyi-visual-monitor</artifactId> + <artifactId>se-visual-monitor</artifactId> <description> - ruoyi-visual-monitor鐩戞帶涓績 + se-visual-monitor鐩戞帶涓績 </description> <dependencies> diff --git a/se-visual/se-monitor/src/main/java/com/se/modules/monitor/SeMonitorApplication.java b/se-visual/se-monitor/src/main/java/com/se/modules/monitor/SeMonitorApplication.java index b0a56ca..d4a03c0 100644 --- a/se-visual/se-monitor/src/main/java/com/se/modules/monitor/SeMonitorApplication.java +++ b/se-visual/se-monitor/src/main/java/com/se/modules/monitor/SeMonitorApplication.java @@ -16,15 +16,6 @@ public static void main(String[] args) { SpringApplication.run(SeMonitorApplication.class, args); - System.out.println("(鈾モ棤鈥库棤)锞夛緸 鐩戞帶涓績鍚姩鎴愬姛 醿�(麓凇`醿�)锞� \n" + - " .-------. ____ __ \n" + - " | _ _ \\ \\ \\ / / \n" + - " | ( ' ) | \\ _. / ' \n" + - " |(_ o _) / _( )_ .' \n" + - " | (_,_).' __ ___(_ o _)' \n" + - " | |\\ \\ | || |(_,_)' \n" + - " | | \\ `' /| `-' / \n" + - " | | \\ / \\ / \n" + - " ''-' `'-' `-..-' "); + System.out.println(" 鐩戞帶涓績鍚姩鎴愬姛 "); } } -- Gitblit v1.9.3