From ab6ec2f0edaf13c1338ec3235b26ad4516db8508 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sun, 30 Jan 2022 00:49:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E6=A8=A1=E5=9D=97=E9=87=8D=E6=9E=84?= =?UTF-8?q?=204=EF=BC=9Asystem=20=E6=A8=A1=E5=9D=97=E7=9A=84=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=EF=BC=8C=E5=8E=BB=E9=99=A4=20Sys?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../config/vo/InfConfigExcelVO.java | 6 +- .../apiaccesslog/InfApiAccessLogExcelVO.java | 4 +- .../vo/apierrorlog/InfApiErrorLogExcelVO.java | 4 +- .../order/vo/order/PayOrderExcelVO.java | 8 +- .../order/vo/refund/vo/PayRefundExcelVO.java | 8 +- .../test/vo/ToolTestDemoExcelVO.java | 6 +- .../redis/core/stream/RedisStreamTest.java | 2 +- .../sms/SysSmsServiceIntegrationTest.java | 2 +- .../infra/enums/SysErrorCodeConstants.java | 16 ++ .../modules/infra/enums/package-info.java | 4 - .../file/impl/InfFileCoreServiceImpl.java | 2 +- .../logger/SysLoginLogCoreConvert.java | 15 -- .../modules/system/convert/package-info.java | 6 - ...‹é“ Spring Boot å¯¹è±¡è½¬æ¢ MapStruct 入门》.md | 1 - .../system/dal/dataobject/package-info.java | 1 - .../dal/mysql/dict/SysDictDataCoreMapper.java | 19 --- .../system/dal/mysql/package-info.java | 1 - .../dal/mysql/sms/SysSmsLogCoreMapper.java | 13 -- .../mysql/sms/SysSmsTemplateCoreMapper.java | 16 -- .../dal/mysql/user/SysUserCoreMapper.java | 17 -- .../dal/redis/SysRedisKeyCoreConstants.java | 29 ---- .../system/mq/message/package-info.java | 4 - .../system/mq/producer/package-info.java | 4 - .../mq/producer/sms/SysSmsCoreProducer.java | 41 ----- .../modules/system/package-info.java | 7 - .../auth/SysUserSessionCoreService.java | 52 ------ .../impl/SysUserSessionCoreServiceImpl.java | 93 ----------- .../service/dict/SysDictDataCoreService.java | 29 ---- .../dict/impl/SysDictDataCoreServiceImpl.java | 145 ----------------- .../logger/SysLoginLogCoreService.java | 17 -- .../impl/SysLoginLogCoreServiceImpl.java | 30 ---- .../service/sms/SysSmsLogCoreService.java | 56 ------- .../sms/SysSmsTemplateCoreService.java | 36 ----- .../sms/impl/SysSmsLogCoreServiceImpl.java | 72 --------- .../impl/SysSmsTemplateCoreServiceImpl.java | 105 ------------ .../service/user/SysUserCoreService.java | 70 -------- .../user/impl/SysUserCoreServiceImpl.java | 82 ---------- .../service/file/InfFileCoreServiceTest.java | 3 +- .../auth/SysUserSessionCoreServiceTest.java | 125 --------------- .../dict/SysDictDataCoreServiceTest.java | 78 --------- .../logger/SysLoginLogServiceImplTest.java | 47 ------ .../modules/system/service/package-info.java | 1 - .../service/sms/SysSmsLogCoreServiceTest.java | 149 ------------------ .../sms/SysSmsTemplateServiceTest.java | 71 --------- .../convert/message/BpmMessageConvert.java | 2 +- .../task/BpmProcessInstanceConvert.java | 4 +- .../bpm/convert/task/BpmTaskConvert.java | 4 +- .../dal/dataobject/leave/BpmOALeaveDO.java | 2 +- .../bpm/enums/message/BpmMessageEnum.java | 2 +- .../config/BpmActivitiConfiguration.java | 6 +- .../behavior/BpmActivityBehaviorFactory.java | 6 +- .../behavior/BpmUserTaskActivitiBehavior.java | 10 +- .../BpmTaskAssignLeaderAbstractScript.java | 9 +- .../impl/BpmTaskAssignRuleServiceImpl.java | 14 +- .../message/impl/BpmMessageServiceImpl.java | 2 +- .../impl/BpmProcessInstanceServiceImpl.java | 8 +- .../service/task/impl/BpmTaskServiceImpl.java | 8 +- .../BpmUserTaskActivitiBehaviorTest.java | 10 +- .../impl/BpmTaskAssignLeaderX2ScriptTest.java | 8 +- .../yudao-module-member-impl/pom.xml | 6 + .../app/auth/AppAuthController.java | 3 - .../app/auth/vo/AppAuthSocialBindReqVO.java | 1 - .../app/auth/vo/AppAuthSocialLogin2ReqVO.java | 4 +- .../app/auth/vo/AppAuthSocialLoginReqVO.java | 4 +- .../app/auth/vo/AppAuthSocialUnbindReqVO.java | 4 +- .../member/service/auth/AuthServiceImpl.java | 15 +- .../service/sms/SysSmsCodeServiceImpl.java | 2 +- .../service/auth/SysAuthServiceTest.java | 6 +- .../system/enums/ErrorCodeConstants.java | 0 .../system/enums/SysErrorCodeConstants.java | 10 +- .../system/enums/social/SocialTypeEnum.java | 8 +- .../controller/admin/auth/AuthController.java | 17 +- .../admin/auth/UserSessionController.java | 25 ++- .../auth/vo/auth/AuthSocialBindReqVO.java | 4 +- .../auth/vo/auth/AuthSocialLogin2ReqVO.java | 4 +- .../auth/vo/auth/AuthSocialLoginReqVO.java | 4 +- .../auth/vo/auth/AuthSocialUnbindReqVO.java | 4 +- .../controller/admin/dept/DeptController.java | 4 +- .../controller/admin/dept/PostController.java | 2 +- .../admin/dept/vo/post/PostExcelVO.java | 4 +- .../admin/dict/DictDataController.java | 2 +- .../admin/dict/vo/data/DictDataExcelVO.java | 4 +- .../admin/dict/vo/type/DictTypeExcelVO.java | 4 +- .../admin/logger/LoginLogController.java | 2 +- .../admin/logger/OperateLogController.java | 14 +- .../logger/vo/loginlog/LoginLogExcelVO.java | 6 +- .../vo/operatelog/OperateLogExcelVO.java | 4 +- .../admin/permission/RoleController.java | 2 +- .../admin/permission/vo/role/RoleExcelVO.java | 4 +- .../admin/sms/SmsCallbackController.java | 4 +- .../admin/sms/SmsChannelController.java | 2 +- .../admin/sms/SmsLogController.java | 2 +- .../admin/sms/SmsTemplateController.java | 6 +- .../admin/sms/vo/log/SmsLogExcelVO.java | 10 +- .../sms/vo/template/SmsTemplateExcelVO.java | 8 +- .../admin/tenant/TenantController.java | 2 +- .../controller/admin/user/UserController.java | 30 ++-- .../admin/user/UserProfileController.java | 25 ++- .../admin/user/vo/user/UserExcelVO.java | 6 +- .../admin/user/vo/user/UserImportExcelVO.java | 6 +- .../system/convert/auth/AuthConvert.java | 10 +- .../convert/auth/UserSessionConvert.java | 2 +- .../system/convert/dept/DeptConvert.java | 2 +- .../system/convert/dept/PostConvert.java | 2 +- .../system/convert/dict/DictDataConvert.java | 2 +- .../convert/dict/SysDictDataCoreConvert.java | 4 +- .../convert/logger/LoginLogConvert.java | 2 +- .../convert/logger/OperateLogConvert.java | 4 +- .../logger/SysLoginLogCoreConvert.java | 15 ++ .../convert/permission/RoleConvert.java | 2 +- .../system/convert/sms/SmsChannelConvert.java | 2 +- .../system/convert/sms/SmsLogConvert.java | 2 +- .../convert/sms/SmsTemplateConvert.java | 2 +- .../system/convert/tenant/TenantConvert.java | 2 +- .../system/convert/user/UserConvert.java | 28 ++-- .../dal/dataobject/auth/SysUserSessionDO.java | 2 +- .../system/dal/dataobject/dept/SysDeptDO.java | 6 +- .../system/dal/dataobject/dept/SysPostDO.java | 2 +- .../dal/dataobject/dict/SysDictDataDO.java | 2 +- .../dal/dataobject/logger/OperateLogDO.java | 4 +- .../dal/dataobject/logger/SysLoginLogDO.java | 6 +- .../system/dal/dataobject/package-info.java | 1 + .../dal/dataobject/permission/SysRoleDO.java | 2 +- .../dataobject/permission/SysUserRoleDO.java | 2 +- .../dal/dataobject/sms/SysSmsChannelDO.java | 2 +- .../dal/dataobject/sms/SysSmsLogDO.java | 6 +- .../dal/dataobject/sms/SysSmsTemplateDO.java | 4 +- .../dataobject/social/SysSocialUserDO.java | 6 +- .../dal/dataobject/tenant/SysTenantDO.java | 2 +- .../system/dal/dataobject/user/UserDO.java | 6 +- .../mysql/auth/SysUserSessionCoreMapper.java | 4 +- .../dal/mysql/auth/SysUserSessionMapper.java | 2 +- .../dal/mysql/dept/SysDeptCoreMapper.java | 4 +- .../system/dal/mysql/dept/SysDeptMapper.java | 2 +- .../dal/mysql/dept/SysPostCoreMapper.java | 4 +- .../system/dal/mysql/dept/SysPostMapper.java | 2 +- .../dal/mysql/dict/SysDictDataMapper.java | 3 +- .../dal/mysql/logger/LoginLogMapper.java | 2 +- .../mysql/logger/SysLoginLogCoreMapper.java | 4 +- .../module/system/dal/mysql/package-info.java | 1 + .../mysql/permission/SysRoleCoreMapper.java | 4 +- .../dal/mysql/permission/SysRoleMapper.java | 2 +- .../permission/SysUserRoleCoreMapper.java | 4 +- .../mysql/permission/SysUserRoleMapper.java | 2 +- .../dal/mysql/sms/SysSmsChannelMapper.java | 2 +- .../system/dal/mysql/sms/SysSmsLogMapper.java | 2 +- .../dal/mysql/sms/SysSmsTemplateMapper.java | 12 +- .../dal/mysql/social/SysSocialUserMapper.java | 6 +- .../dal/mysql/tenant/SysTenantCoreMapper.java | 4 +- .../dal/mysql/tenant/SysTenantMapper.java | 2 +- .../system/dal/mysql/user/SysUserMapper.java | 77 --------- .../system/dal/mysql/user/UserMapper.java | 68 ++++++++ .../dal/redis/SysRedisKeyConstants.java | 16 ++ .../dal/redis/SysRedisKeyCoreConstants.java | 18 +++ .../dal/redis/auth/LoginUserRedisDAO.java | 6 +- .../redis/social/SocialAuthUserRedisDAO.java | 7 +- .../system/enums/DictTypeConstants.java | 4 +- .../system/enums/common/SysSexEnum.java | 2 +- .../enums/logger/SysLoginLogTypeEnum.java | 2 +- .../enums/logger/SysLoginResultEnum.java | 2 +- .../enums/sms/SysSmsReceiveStatusEnum.java | 2 +- .../enums/sms/SysSmsSendStatusEnum.java | 2 +- .../enums/sms/SysSmsTemplateTypeEnum.java | 2 +- .../config/DataPermissionConfiguration.java | 6 +- .../dict/DictDataRefreshConsumer.java | 6 +- .../mq/consumer/sms/SmsSendConsumer.java | 12 +- .../sms/SmsTemplateRefreshConsumer.java | 6 +- .../system/mq/message/sms/SmsSendMessage.java | 4 +- .../system/mq/producer/package-info.java | 4 + .../system/mq/producer/sms/SmsProducer.java | 19 +++ .../system/service/auth/AuthServiceImpl.java | 95 +++++------ .../service/auth/UserSessionService.java | 43 ++++- .../service/auth/UserSessionServiceImpl.java | 92 +++++++++-- .../system/service/dept/DeptService.java | 2 +- .../system/service/dept/DeptServiceImpl.java | 2 +- .../system/service/dept/PostService.java | 2 +- .../system/service/dept/PostServiceImpl.java | 2 +- .../service/dept/SysDeptCoreService.java | 4 +- .../service/dept/SysPostCoreService.java | 2 +- .../dept/impl/SysDeptCoreServiceImpl.java | 13 +- .../dept/impl/SysPostCoreServiceImpl.java | 12 +- .../system/service/dict/DictDataService.java | 21 ++- .../service/dict/DictDataServiceImpl.java | 121 ++++++++++++-- .../service/dict/DictTypeServiceImpl.java | 6 +- .../service/logger/LoginLogService.java | 10 +- .../service/logger/LoginLogServiceImpl.java | 12 +- .../service/logger/OperateLogServiceImpl.java | 6 +- .../logger/dto/LoginLogCreateReqDTO.java | 4 +- .../permission/PermissionServiceImpl.java | 6 +- .../service/permission/RoleService.java | 2 +- .../service/permission/RoleServiceImpl.java | 2 +- .../permission/SysPermissionCoreService.java | 2 +- .../permission/SysRoleCoreService.java | 2 +- .../impl/SysPermissionCoreServiceImpl.java | 8 +- .../impl/SysRoleCoreServiceImpl.java | 12 +- .../system/service/sms/SmsChannelService.java | 2 +- .../service/sms/SmsChannelServiceImpl.java | 2 +- .../system/service/sms/SmsLogService.java | 45 +++++- .../system/service/sms/SmsLogServiceImpl.java | 54 ++++++- .../service/sms/SmsTemplateService.java | 25 ++- .../service/sms/SmsTemplateServiceImpl.java | 86 +++++++++- .../system/service/sms/SysSmsSendService.java | 13 +- .../service/sms/SysSmsSendServiceImpl.java | 50 +++--- .../service/social/SocialUserService.java | 20 +-- .../service/social/SocialUserServiceImpl.java | 31 ++-- .../service/tenant/SysTenantCoreService.java | 2 +- .../system/service/tenant/TenantService.java | 2 +- .../service/tenant/TenantServiceImpl.java | 2 +- .../tenant/impl/SysTenantCoreServiceImpl.java | 8 +- .../system/service/user/UserService.java | 72 +++++++-- .../system/service/user/UserServiceImpl.java | 121 +++++++++----- .../service/auth/AuthServiceImplTest.java | 42 +++-- .../auth/UserSessionServiceImplTest.java | 116 ++++++++++++-- .../system/service/dept/DeptServiceTest.java | 2 +- .../system/service/dept/PostServiceTest.java | 2 +- .../service/dict/DictDataServiceTest.java | 36 ++++- .../logger/LoginLogServiceImplTest.java | 30 +++- .../logger/OperateLogServiceImplTest.java | 8 +- .../permission/PermissionServiceTest.java | 6 +- .../service/permission/RoleServiceTest.java | 2 +- .../service/sms/SmsChannelServiceTest.java | 2 +- .../system/service/sms/SmsLogServiceTest.java | 103 +++++++++++- .../service/sms/SmsTemplateServiceTest.java | 31 +++- .../service/sms/SysSmsSendServiceTest.java | 62 ++++---- .../service/social/SocialUsererviceTest.java | 36 ++--- .../service/tenant/TenantServiceTest.java | 2 +- .../service/user/UserServiceImplTest.java | 70 ++++---- 227 files changed, 1649 insertions(+), 2252 deletions(-) create mode 100644 yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/enums/SysErrorCodeConstants.java delete mode 100644 yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/enums/package-info.java delete mode 100644 yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/convert/logger/SysLoginLogCoreConvert.java delete mode 100644 yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/convert/package-info.java delete mode 100644 yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/convert/ã€ŠèŠ‹é“ Spring Boot å¯¹è±¡è½¬æ¢ MapStruct 入门》.md delete mode 100644 yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/package-info.java delete mode 100644 yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/dict/SysDictDataCoreMapper.java delete mode 100644 yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/package-info.java delete mode 100644 yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/sms/SysSmsLogCoreMapper.java delete mode 100644 yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/sms/SysSmsTemplateCoreMapper.java delete mode 100644 yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/user/SysUserCoreMapper.java delete mode 100644 yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/redis/SysRedisKeyCoreConstants.java delete mode 100644 yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/mq/message/package-info.java delete mode 100644 yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/mq/producer/package-info.java delete mode 100644 yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/mq/producer/sms/SysSmsCoreProducer.java delete mode 100644 yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/package-info.java delete mode 100644 yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/auth/SysUserSessionCoreService.java delete mode 100644 yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/auth/impl/SysUserSessionCoreServiceImpl.java delete mode 100644 yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/dict/SysDictDataCoreService.java delete mode 100644 yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/dict/impl/SysDictDataCoreServiceImpl.java delete mode 100644 yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/logger/SysLoginLogCoreService.java delete mode 100644 yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/logger/impl/SysLoginLogCoreServiceImpl.java delete mode 100644 yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/SysSmsLogCoreService.java delete mode 100644 yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/SysSmsTemplateCoreService.java delete mode 100644 yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/impl/SysSmsLogCoreServiceImpl.java delete mode 100644 yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/impl/SysSmsTemplateCoreServiceImpl.java delete mode 100644 yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/user/SysUserCoreService.java delete mode 100644 yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/user/impl/SysUserCoreServiceImpl.java delete mode 100644 yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/auth/SysUserSessionCoreServiceTest.java delete mode 100644 yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/dict/SysDictDataCoreServiceTest.java delete mode 100644 yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/logger/SysLoginLogServiceImplTest.java delete mode 100644 yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/package-info.java delete mode 100644 yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/SysSmsLogCoreServiceTest.java delete mode 100644 yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/SysSmsTemplateServiceTest.java rename yudao-module-system/{yudao-module-system-impl => yudao-module-system-api}/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java (100%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module}/system/enums/SysErrorCodeConstants.java (76%) rename yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/social/SysSocialTypeEnum.java => yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/social/SocialTypeEnum.java (89%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/convert/dict/SysDictDataCoreConvert.java (74%) create mode 100644 yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/logger/SysLoginLogCoreConvert.java rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/dal/dataobject/auth/SysUserSessionDO.java (95%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/dal/dataobject/dept/SysDeptDO.java (84%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/dal/dataobject/dept/SysPostDO.java (92%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/dal/dataobject/dict/SysDictDataDO.java (93%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/dal/dataobject/logger/SysLoginLogDO.java (83%) create mode 100644 yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/package-info.java rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/dal/dataobject/permission/SysRoleDO.java (95%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/dal/dataobject/permission/SysUserRoleDO.java (88%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/dal/dataobject/sms/SysSmsChannelDO.java (94%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/dal/dataobject/sms/SysSmsLogDO.java (94%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/dal/dataobject/sms/SysSmsTemplateDO.java (92%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/dal/dataobject/social/SysSocialUserDO.java (90%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/dal/dataobject/tenant/SysTenantDO.java (91%) rename yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/user/SysUserDO.java => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/user/UserDO.java (90%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/dal/mysql/auth/SysUserSessionCoreMapper.java (56%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/dal/mysql/dept/SysDeptCoreMapper.java (56%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/dal/mysql/dept/SysPostCoreMapper.java (56%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/dal/mysql/logger/SysLoginLogCoreMapper.java (55%) create mode 100644 yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/package-info.java rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/dal/mysql/permission/SysRoleCoreMapper.java (54%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/dal/mysql/permission/SysUserRoleCoreMapper.java (70%) rename yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/social/SysSocialUserCoreMapper.java => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/social/SysSocialUserMapper.java (80%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/dal/mysql/tenant/SysTenantCoreMapper.java (55%) delete mode 100644 yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/SysUserMapper.java create mode 100644 yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/UserMapper.java create mode 100644 yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/redis/SysRedisKeyCoreConstants.java rename yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/redis/auth/SysLoginUserCoreRedisDAO.java => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/redis/auth/LoginUserRedisDAO.java (85%) rename yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/redis/social/SysSocialAuthUserRedisDAO.java => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/redis/social/SocialAuthUserRedisDAO.java (83%) rename yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/SysDictTypeConstants.java => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/enums/DictTypeConstants.java (94%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/enums/common/SysSexEnum.java (83%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/enums/logger/SysLoginLogTypeEnum.java (89%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/enums/logger/SysLoginResultEnum.java (88%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/enums/sms/SysSmsReceiveStatusEnum.java (84%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/enums/sms/SysSmsSendStatusEnum.java (85%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/enums/sms/SysSmsTemplateTypeEnum.java (84%) rename yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/mq/message/sms/SysSmsSendMessage.java => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/mq/message/sms/SmsSendMessage.java (88%) create mode 100644 yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/mq/producer/package-info.java rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/service/dept/SysDeptCoreService.java (90%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/service/dept/SysPostCoreService.java (84%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/service/dept/impl/SysDeptCoreServiceImpl.java (74%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/service/dept/impl/SysPostCoreServiceImpl.java (71%) rename yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/logger/dto/SysLoginLogCreateReqDTO.java => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/logger/dto/LoginLogCreateReqDTO.java (91%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/service/permission/SysPermissionCoreService.java (86%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/service/permission/SysRoleCoreService.java (83%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/service/permission/impl/SysPermissionCoreServiceImpl.java (64%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/service/permission/impl/SysRoleCoreServiceImpl.java (70%) rename yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/SysSmsCoreService.java => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SysSmsSendService.java (79%) rename yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/impl/SysSmsCoreServiceImpl.java => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SysSmsSendServiceImpl.java (76%) rename yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/social/SysSocialCoreService.java => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialUserService.java (76%) rename yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/social/impl/SysSocialCoreServiceImpl.java => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialUserServiceImpl.java (84%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/service/tenant/SysTenantCoreService.java (75%) rename {yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules => yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module}/system/service/tenant/impl/SysTenantCoreServiceImpl.java (63%) rename yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/SysSmsCoreServiceTest.java => yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/sms/SysSmsSendServiceTest.java (70%) rename yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/social/SysSocialCoreServiceTest.java => yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/social/SocialUsererviceTest.java (80%) diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/config/vo/InfConfigExcelVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/config/vo/InfConfigExcelVO.java index 28c10b2dc..63b808744 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/config/vo/InfConfigExcelVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/config/vo/InfConfigExcelVO.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.adminserver.modules.infra.controller.config.vo; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; -import cn.iocoder.yudao.coreservice.modules.system.enums.SysDictTypeConstants; +import cn.iocoder.yudao.module.system.enums.DictTypeConstants; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; @@ -30,11 +30,11 @@ public class InfConfigExcelVO { private String value; @ExcelProperty(value = "å‚数类型", converter = DictConvert.class) - @DictFormat(SysDictTypeConstants.CONFIG_TYPE) + @DictFormat(DictTypeConstants.CONFIG_TYPE) private Integer type; @ExcelProperty(value = "是å¦æ•æ„Ÿ", converter = DictConvert.class) - @DictFormat(SysDictTypeConstants.BOOLEAN_STRING) + @DictFormat(DictTypeConstants.BOOLEAN_STRING) private Boolean sensitive; @ExcelProperty("备注") diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/logger/vo/apiaccesslog/InfApiAccessLogExcelVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/logger/vo/apiaccesslog/InfApiAccessLogExcelVO.java index d48dc44b0..c69969b4b 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/logger/vo/apiaccesslog/InfApiAccessLogExcelVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/logger/vo/apiaccesslog/InfApiAccessLogExcelVO.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.adminserver.modules.infra.controller.logger.vo.apiacces import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; -import cn.iocoder.yudao.coreservice.modules.system.enums.SysDictTypeConstants; +import cn.iocoder.yudao.module.system.enums.DictTypeConstants; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; @@ -26,7 +26,7 @@ public class InfApiAccessLogExcelVO { private Long userId; @ExcelProperty(value = "用户类型", converter = DictConvert.class) - @DictFormat(SysDictTypeConstants.USER_TYPE) + @DictFormat(DictTypeConstants.USER_TYPE) private Integer userType; @ExcelProperty("应用å") diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/logger/vo/apierrorlog/InfApiErrorLogExcelVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/logger/vo/apierrorlog/InfApiErrorLogExcelVO.java index c33e73dce..dfae3311a 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/logger/vo/apierrorlog/InfApiErrorLogExcelVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/infra/controller/logger/vo/apierrorlog/InfApiErrorLogExcelVO.java @@ -3,7 +3,7 @@ package cn.iocoder.yudao.adminserver.modules.infra.controller.logger.vo.apierror import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; import cn.iocoder.yudao.adminserver.modules.infra.enums.InfDictTypeConstants; -import cn.iocoder.yudao.coreservice.modules.system.enums.SysDictTypeConstants; +import cn.iocoder.yudao.module.system.enums.DictTypeConstants; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; @@ -27,7 +27,7 @@ public class InfApiErrorLogExcelVO { private Integer userId; @ExcelProperty(value = "用户类型", converter = DictConvert.class) - @DictFormat(SysDictTypeConstants.USER_TYPE) + @DictFormat(DictTypeConstants.USER_TYPE) private Integer userType; @ExcelProperty("应用å") diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderExcelVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderExcelVO.java index 28e5e7c61..f6836bc8c 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderExcelVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/order/PayOrderExcelVO.java @@ -1,6 +1,6 @@ package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.order; -import cn.iocoder.yudao.coreservice.modules.system.enums.SysDictTypeConstants; +import cn.iocoder.yudao.module.system.enums.DictTypeConstants; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; import com.alibaba.excel.annotation.ExcelProperty; @@ -46,11 +46,11 @@ public class PayOrderExcelVO { @ExcelProperty("渠é“手续费,å•ä½ï¼šç™¾åˆ†æ¯”") private String channelFeeRate; - @DictFormat(SysDictTypeConstants.PAY_ORDER_STATUS) + @DictFormat(DictTypeConstants.PAY_ORDER_STATUS) @ExcelProperty(value = "支付状æ€", converter = DictConvert.class) private Integer status; - @DictFormat(SysDictTypeConstants.PAY_ORDER_NOTIFY_STATUS) + @DictFormat(DictTypeConstants.PAY_ORDER_NOTIFY_STATUS) @ExcelProperty(value = "通知商户支付结果的回调状æ€", converter = DictConvert.class) private Integer notifyStatus; @@ -75,7 +75,7 @@ public class PayOrderExcelVO { @ExcelProperty("用户 IP") private String userIp; - @DictFormat(SysDictTypeConstants.PAY_ORDER_REFUND_STATUS) + @DictFormat(DictTypeConstants.PAY_ORDER_REFUND_STATUS) @ExcelProperty(value = "退款状æ€", converter = DictConvert.class) private Integer refundStatus; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundExcelVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundExcelVO.java index b0b2c18e1..793493eaa 100755 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundExcelVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/pay/controller/order/vo/refund/vo/PayRefundExcelVO.java @@ -1,6 +1,6 @@ package cn.iocoder.yudao.adminserver.modules.pay.controller.order.vo.refund.vo; -import cn.iocoder.yudao.coreservice.modules.system.enums.SysDictTypeConstants; +import cn.iocoder.yudao.module.system.enums.DictTypeConstants; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; import com.alibaba.excel.annotation.ExcelProperty; @@ -43,15 +43,15 @@ public class PayRefundExcelVO { @ExcelProperty("异步通知商户地å€") private String notifyUrl; - @DictFormat(SysDictTypeConstants.PAY_ORDER_NOTIFY_STATUS) + @DictFormat(DictTypeConstants.PAY_ORDER_NOTIFY_STATUS) @ExcelProperty(value = "商户退款结果回调状æ€", converter = DictConvert.class) private Integer notifyStatus; - @DictFormat(SysDictTypeConstants.PAY_REFUND_ORDER_STATUS) + @DictFormat(DictTypeConstants.PAY_REFUND_ORDER_STATUS) @ExcelProperty(value = "退款状æ€", converter = DictConvert.class) private Integer status; - @DictFormat(SysDictTypeConstants.PAY_REFUND_ORDER_TYPE) + @DictFormat(DictTypeConstants.PAY_REFUND_ORDER_TYPE) @ExcelProperty(value = "退款类型", converter = DictConvert.class) private Integer type; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/tool/controller/test/vo/ToolTestDemoExcelVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/tool/controller/test/vo/ToolTestDemoExcelVO.java index 87e827440..e7a98b6f1 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/tool/controller/test/vo/ToolTestDemoExcelVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/tool/controller/test/vo/ToolTestDemoExcelVO.java @@ -3,7 +3,7 @@ package cn.iocoder.yudao.adminserver.modules.tool.controller.test.vo; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; import cn.iocoder.yudao.adminserver.modules.infra.enums.InfDictTypeConstants; -import cn.iocoder.yudao.coreservice.modules.system.enums.SysDictTypeConstants; +import cn.iocoder.yudao.module.system.enums.DictTypeConstants; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; @@ -24,11 +24,11 @@ public class ToolTestDemoExcelVO { private String name; @ExcelProperty(value = "状æ€", converter = DictConvert.class) - @DictFormat(SysDictTypeConstants.COMMON_STATUS) + @DictFormat(DictTypeConstants.COMMON_STATUS) private Integer status; @ExcelProperty(value = "类型", converter = DictConvert.class) - @DictFormat(SysDictTypeConstants.OPERATE_TYPE) + @DictFormat(DictTypeConstants.OPERATE_TYPE) private Integer type; @ExcelProperty(value = "分类", converter = DictConvert.class) diff --git a/yudao-admin-server/src/test-integration/java/cn/iocoder/yudao/adminserver/framework/redis/core/stream/RedisStreamTest.java b/yudao-admin-server/src/test-integration/java/cn/iocoder/yudao/adminserver/framework/redis/core/stream/RedisStreamTest.java index 3f1bb7fb9..a99c65e47 100644 --- a/yudao-admin-server/src/test-integration/java/cn/iocoder/yudao/adminserver/framework/redis/core/stream/RedisStreamTest.java +++ b/yudao-admin-server/src/test-integration/java/cn/iocoder/yudao/adminserver/framework/redis/core/stream/RedisStreamTest.java @@ -5,7 +5,7 @@ import cn.iocoder.yudao.adminserver.BaseRedisIntegrationTest; import cn.iocoder.yudao.module.system.mq.consumer.mail.SysMailSendConsumer; import cn.iocoder.yudao.module.system.mq.consumer.sms.SysSmsSendConsumer; import cn.iocoder.yudao.module.system.mq.message.mail.SysMailSendMessage; -import cn.iocoder.yudao.coreservice.modules.system.mq.message.sms.SysSmsSendMessage; +import cn.iocoder.yudao.module.system.mq.message.sms.SysSmsSendMessage; import cn.iocoder.yudao.framework.mq.core.util.RedisMessageUtils; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; diff --git a/yudao-admin-server/src/test-integration/java/cn/iocoder/yudao/adminserver/modules/system/service/sms/SysSmsServiceIntegrationTest.java b/yudao-admin-server/src/test-integration/java/cn/iocoder/yudao/adminserver/modules/system/service/sms/SysSmsServiceIntegrationTest.java index a6b4c47a2..ad63132b9 100644 --- a/yudao-admin-server/src/test-integration/java/cn/iocoder/yudao/adminserver/modules/system/service/sms/SysSmsServiceIntegrationTest.java +++ b/yudao-admin-server/src/test-integration/java/cn/iocoder/yudao/adminserver/modules/system/service/sms/SysSmsServiceIntegrationTest.java @@ -9,7 +9,7 @@ import cn.iocoder.yudao.module.system.service.sms.impl.SysSmsChannelServiceImpl; import cn.iocoder.yudao.module.system.service.sms.impl.SysSmsLogServiceImpl; import cn.iocoder.yudao.module.system.service.sms.impl.SysSmsTemplateServiceImpl; import cn.iocoder.yudao.module.system.service.user.SysUserService; -import cn.iocoder.yudao.coreservice.modules.system.service.sms.impl.SysSmsCoreServiceImpl; +import cn.iocoder.yudao.module.system.service.sms.impl.SysSmsCoreServiceImpl; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.sms.config.YudaoSmsAutoConfiguration; import org.junit.jupiter.api.Test; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/enums/SysErrorCodeConstants.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/enums/SysErrorCodeConstants.java new file mode 100644 index 000000000..4cafc58e4 --- /dev/null +++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/enums/SysErrorCodeConstants.java @@ -0,0 +1,16 @@ +package cn.iocoder.yudao.coreservice.modules.infra.enums; + +import cn.iocoder.yudao.framework.common.exception.ErrorCode; + +/** + * System 错误ç æžšä¸¾ç±» + * + * system 系统,使用 1-006-000-000 段 + */ +public interface SysErrorCodeConstants { + + // ========= 文件相关 1006001000================= + ErrorCode FILE_PATH_EXISTS = new ErrorCode(1006001000, "文件路径已存在"); + ErrorCode FILE_NOT_EXISTS = new ErrorCode(1006001002, "文件ä¸å­˜åœ¨"); + +} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/enums/package-info.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/enums/package-info.java deleted file mode 100644 index 6231dae91..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/enums/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * å ä½ç±»ï¼Œå¯ä»¥æ— è§† - */ -package cn.iocoder.yudao.coreservice.modules.infra.enums; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/service/file/impl/InfFileCoreServiceImpl.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/service/file/impl/InfFileCoreServiceImpl.java index 3e2c7ead4..f58685346 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/service/file/impl/InfFileCoreServiceImpl.java +++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/infra/service/file/impl/InfFileCoreServiceImpl.java @@ -10,7 +10,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.io.ByteArrayInputStream; -import static cn.iocoder.yudao.coreservice.modules.system.enums.SysErrorCodeConstants.*; +import static cn.iocoder.yudao.coreservice.modules.infra.enums.SysErrorCodeConstants.*; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; /** diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/convert/logger/SysLoginLogCoreConvert.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/convert/logger/SysLoginLogCoreConvert.java deleted file mode 100644 index 9c1992738..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/convert/logger/SysLoginLogCoreConvert.java +++ /dev/null @@ -1,15 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.system.convert.logger; - -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.logger.SysLoginLogDO; -import cn.iocoder.yudao.coreservice.modules.system.service.logger.dto.SysLoginLogCreateReqDTO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -@Mapper -public interface SysLoginLogCoreConvert { - - SysLoginLogCoreConvert INSTANCE = Mappers.getMapper(SysLoginLogCoreConvert.class); - - SysLoginLogDO convert(SysLoginLogCreateReqDTO bean); - -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/convert/package-info.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/convert/package-info.java deleted file mode 100644 index 87914750a..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/convert/package-info.java +++ /dev/null @@ -1,6 +0,0 @@ -/** - * æä¾› POJO ç±»çš„å®žä½“è½¬æ¢ - * - * ç›®å‰ä½¿ç”¨ MapStruct 框架 - */ -package cn.iocoder.yudao.coreservice.modules.system.convert; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/convert/ã€ŠèŠ‹é“ Spring Boot å¯¹è±¡è½¬æ¢ MapStruct 入门》.md b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/convert/ã€ŠèŠ‹é“ Spring Boot å¯¹è±¡è½¬æ¢ MapStruct 入门》.md deleted file mode 100644 index 8153487b7..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/convert/ã€ŠèŠ‹é“ Spring Boot å¯¹è±¡è½¬æ¢ MapStruct 入门》.md +++ /dev/null @@ -1 +0,0 @@ - diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/package-info.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/package-info.java deleted file mode 100644 index f2ed88035..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.dataobject; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/dict/SysDictDataCoreMapper.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/dict/SysDictDataCoreMapper.java deleted file mode 100644 index bda1a9142..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/dict/SysDictDataCoreMapper.java +++ /dev/null @@ -1,19 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.mysql.dict; - - -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dict.SysDictDataDO; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import org.apache.ibatis.annotations.Mapper; - -import java.util.Date; - -@Mapper -public interface SysDictDataCoreMapper extends BaseMapperX { - - default boolean selectExistsByUpdateTimeAfter(Date maxUpdateTime) { - return selectOne(new QueryWrapper().select("id") - .gt("update_time", maxUpdateTime).last("LIMIT 1")) != null; - } - -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/package-info.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/package-info.java deleted file mode 100644 index 144a05407..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.mysql; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/sms/SysSmsLogCoreMapper.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/sms/SysSmsLogCoreMapper.java deleted file mode 100644 index d09554575..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/sms/SysSmsLogCoreMapper.java +++ /dev/null @@ -1,13 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.mysql.sms; - -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsLogDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; -import org.apache.ibatis.annotations.Mapper; - -import java.util.List; - -@Mapper -public interface SysSmsLogCoreMapper extends BaseMapperX { -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/sms/SysSmsTemplateCoreMapper.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/sms/SysSmsTemplateCoreMapper.java deleted file mode 100644 index 4e064b40d..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/sms/SysSmsTemplateCoreMapper.java +++ /dev/null @@ -1,16 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.mysql.sms; - -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsTemplateDO; -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import org.apache.ibatis.annotations.Mapper; -import org.apache.ibatis.annotations.Select; - -import java.util.Date; - -@Mapper -public interface SysSmsTemplateCoreMapper extends BaseMapperX { - - @Select("SELECT id FROM sys_sms_template WHERE update_time > #{maxUpdateTime} LIMIT 1") - Long selectExistsByUpdateTimeAfter(Date maxUpdateTime); - -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/user/SysUserCoreMapper.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/user/SysUserCoreMapper.java deleted file mode 100644 index e4afd992a..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/user/SysUserCoreMapper.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.mysql.user; - -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; -import org.apache.ibatis.annotations.Mapper; - -import java.util.Collection; -import java.util.List; - -@Mapper -public interface SysUserCoreMapper extends BaseMapperX { - - default List selectListByDeptIds(Collection deptIds) { - return selectList(SysUserDO::getDeptId, deptIds); - } -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/redis/SysRedisKeyCoreConstants.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/redis/SysRedisKeyCoreConstants.java deleted file mode 100644 index 5db3e9fd4..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/redis/SysRedisKeyCoreConstants.java +++ /dev/null @@ -1,29 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.redis; - -import cn.iocoder.yudao.framework.redis.core.RedisKeyDefine; -import cn.iocoder.yudao.framework.security.core.LoginUser; -import me.zhyd.oauth.model.AuthUser; - -import java.time.Duration; - -import static cn.iocoder.yudao.framework.redis.core.RedisKeyDefine.KeyTypeEnum.STRING; - -/** - * System Redis Key 枚举类 - * - * @author 芋é“æºç  - */ -public interface SysRedisKeyCoreConstants { - - RedisKeyDefine LOGIN_USER = new RedisKeyDefine("登录用户的缓存", - "login_user:%s", // å‚数为 sessionId - STRING, LoginUser.class, RedisKeyDefine.TimeoutTypeEnum.DYNAMIC); - - RedisKeyDefine SOCIAL_AUTH_USER = new RedisKeyDefine("社交登陆的授æƒç”¨æˆ·", - "social_auth_user:%d:%s", // å‚数为 type,code - STRING, AuthUser.class, Duration.ofDays(1)); - - RedisKeyDefine SOCIAL_AUTH_STATE = new RedisKeyDefine("社交登陆的 state", - "social_auth_state:%s", // å‚数为 state - STRING, String.class, Duration.ofHours(24)); // 值为 state -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/mq/message/package-info.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/mq/message/package-info.java deleted file mode 100644 index 2e18f1adf..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/mq/message/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * å ä½ - */ -package cn.iocoder.yudao.coreservice.modules.system.mq.message; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/mq/producer/package-info.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/mq/producer/package-info.java deleted file mode 100644 index 2fe4aa305..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/mq/producer/package-info.java +++ /dev/null @@ -1,4 +0,0 @@ -/** - * å ä½ - */ -package cn.iocoder.yudao.coreservice.modules.system.mq.producer; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/mq/producer/sms/SysSmsCoreProducer.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/mq/producer/sms/SysSmsCoreProducer.java deleted file mode 100644 index 9ecf64706..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/mq/producer/sms/SysSmsCoreProducer.java +++ /dev/null @@ -1,41 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.system.mq.producer.sms; - -import cn.iocoder.yudao.coreservice.modules.system.mq.message.sms.SysSmsSendMessage; -import cn.iocoder.yudao.framework.common.core.KeyValue; -import cn.iocoder.yudao.framework.mq.core.RedisMQTemplate; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Component; - -import javax.annotation.Resource; -import java.util.List; - -/** - * Sms 短信相关消æ¯çš„ Core Producer - * - * @author zzf - * @date 2021/3/9 16:35 - */ -@Slf4j -@Component -public class SysSmsCoreProducer { - - @Resource - private RedisMQTemplate redisMQTemplate; - - /** - * å‘é€ {@link SysSmsSendMessage} æ¶ˆæ¯ - * - * @param logId çŸ­ä¿¡æ—¥å¿—ç¼–å· - * @param mobile æ‰‹æœºå· - * @param channelId 渠é“ç¼–å· - * @param apiTemplateId 短信模æ¿ç¼–å· - * @param templateParams 短信模æ¿å‚æ•° - */ - public void sendSmsSendMessage(Long logId, String mobile, - Long channelId, String apiTemplateId, List> templateParams) { - SysSmsSendMessage message = new SysSmsSendMessage().setLogId(logId).setMobile(mobile); - message.setChannelId(channelId).setApiTemplateId(apiTemplateId).setTemplateParams(templateParams); - redisMQTemplate.send(message); - } - -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/package-info.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/package-info.java deleted file mode 100644 index 3b8777935..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/package-info.java +++ /dev/null @@ -1,7 +0,0 @@ -/** - * system 包下,我们放通用业务,支撑上层的核心业务。 - * 例如说:用户ã€éƒ¨é—¨ã€æƒé™ã€æ•°æ®å­—典等等 - * - * 缩写:sys - */ -package cn.iocoder.yudao.coreservice.modules.system; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/auth/SysUserSessionCoreService.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/auth/SysUserSessionCoreService.java deleted file mode 100644 index 5106af7a3..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/auth/SysUserSessionCoreService.java +++ /dev/null @@ -1,52 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.auth; - -import cn.iocoder.yudao.framework.security.core.LoginUser; - -/** - * 在线用户 Session Core Service æŽ¥å£ - * - * @author 芋é“æºç  - */ -public interface SysUserSessionCoreService { - - /** - * 创建在线用户 Session - * - * @param loginUser 登录用户 - * @param userIp 用户 IP - * @param userAgent 用户 UA - * @return Session ç¼–å· - */ - String createUserSession(LoginUser loginUser, String userIp, String userAgent); - - /** - * 刷新在线用户 Session 的更新时间 - * - * @param sessionId Session ç¼–å· - * @param loginUser 登录用户 - */ - void refreshUserSession(String sessionId, LoginUser loginUser); - - /** - * 删除在线用户 Session - * - * @param sessionId Session ç¼–å· - */ - void deleteUserSession(String sessionId); - - /** - * 获得 Session ç¼–å·å¯¹åº”的在线用户 - * - * @param sessionId Session ç¼–å· - * @return 在线用户 - */ - LoginUser getLoginUser(String sessionId); - - /** - * 获得 Session 超时时间,å•ä½ï¼šæ¯«ç§’ - * - * @return 超时时间 - */ - Long getSessionTimeoutMillis(); - -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/auth/impl/SysUserSessionCoreServiceImpl.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/auth/impl/SysUserSessionCoreServiceImpl.java deleted file mode 100644 index f26c6afc3..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/auth/impl/SysUserSessionCoreServiceImpl.java +++ /dev/null @@ -1,93 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.auth.impl; - -import cn.hutool.core.util.IdUtil; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.auth.SysUserSessionDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.mysql.auth.SysUserSessionCoreMapper; -import cn.iocoder.yudao.coreservice.modules.system.dal.redis.auth.SysLoginUserCoreRedisDAO; -import cn.iocoder.yudao.coreservice.modules.system.service.auth.SysUserSessionCoreService; -import cn.iocoder.yudao.framework.security.config.SecurityProperties; -import cn.iocoder.yudao.framework.security.core.LoginUser; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.time.Duration; -import java.util.Date; - -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.addTime; - -/** - * 在线用户 Session Core Service 实现类 - * - * @author 芋é“æºç  - */ -@Service -public class SysUserSessionCoreServiceImpl implements SysUserSessionCoreService { - - @Resource - private SysUserSessionCoreMapper userSessionCoreMapper; - - @Resource - private SysLoginUserCoreRedisDAO loginUserCoreRedisDAO; - - @Resource - private SecurityProperties securityProperties; - - @Override - public String createUserSession(LoginUser loginUser, String userIp, String userAgent) { - // ç”Ÿæˆ Session ç¼–å· - String sessionId = generateSessionId(); - // 写入 Redis 缓存 - loginUser.setUpdateTime(new Date()); - loginUserCoreRedisDAO.set(sessionId, loginUser); - // 写入 DB 中 - SysUserSessionDO userSession = SysUserSessionDO.builder().id(sessionId) - .userId(loginUser.getId()).userType(loginUser.getUserType()) - .userIp(userIp).userAgent(userAgent).username(loginUser.getUsername()) - .sessionTimeout(addTime(Duration.ofMillis(getSessionTimeoutMillis()))) - .build(); - userSessionCoreMapper.insert(userSession); - // 返回 Session ç¼–å· - return sessionId; - } - - @Override - public void refreshUserSession(String sessionId, LoginUser loginUser) { - // 写入 Redis 缓存 - loginUser.setUpdateTime(new Date()); - loginUserCoreRedisDAO.set(sessionId, loginUser); - // æ›´æ–° DB 中 - SysUserSessionDO updateObj = SysUserSessionDO.builder().id(sessionId).build(); - updateObj.setUsername(loginUser.getUsername()); - updateObj.setUpdateTime(new Date()); - updateObj.setSessionTimeout(addTime(Duration.ofMillis(getSessionTimeoutMillis()))); - userSessionCoreMapper.updateById(updateObj); - } - - @Override - public void deleteUserSession(String sessionId) { - // 删除 Redis 缓存 - loginUserCoreRedisDAO.delete(sessionId); - // 删除 DB 记录 - userSessionCoreMapper.deleteById(sessionId); - } - - @Override - public LoginUser getLoginUser(String sessionId) { - return loginUserCoreRedisDAO.get(sessionId); - } - - @Override - public Long getSessionTimeoutMillis() { - return securityProperties.getSessionTimeout().toMillis(); - } - - /** - * ç”Ÿæˆ Session ç¼–å·ï¼Œç›®å‰é‡‡ç”¨ UUID 算法 - * - * @return Session ç¼–å· - */ - private static String generateSessionId() { - return IdUtil.fastSimpleUUID(); - } - -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/dict/SysDictDataCoreService.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/dict/SysDictDataCoreService.java deleted file mode 100644 index bcac11c59..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/dict/SysDictDataCoreService.java +++ /dev/null @@ -1,29 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.dict; - -import cn.iocoder.yudao.framework.dict.core.service.DictDataFrameworkService; - -import java.util.Collection; - -/** - * å­—å…¸æ•°æ® Service æŽ¥å£ - * - * @author 芋é“æºç  - */ -public interface SysDictDataCoreService extends DictDataFrameworkService { - - /** - * åˆå§‹åŒ–字典数æ®çš„本地缓存 - */ - void initLocalCache(); - - /** - * 校验字典数æ®ä»¬æ˜¯å¦æœ‰æ•ˆã€‚如下情况,视为无效: - * 1. 字典数æ®ä¸å­˜åœ¨ - * 2. 字典数æ®è¢«ç¦ç”¨ - * - * @param dictType 字典类型 - * @param values 字典数æ®å€¼çš„数组 - */ - void validDictDatas(String dictType, Collection values); - -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/dict/impl/SysDictDataCoreServiceImpl.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/dict/impl/SysDictDataCoreServiceImpl.java deleted file mode 100644 index 328cac56b..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/dict/impl/SysDictDataCoreServiceImpl.java +++ /dev/null @@ -1,145 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.dict.impl; - -import cn.hutool.core.collection.CollUtil; -import cn.iocoder.yudao.coreservice.modules.system.convert.dict.SysDictDataCoreConvert; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dict.SysDictDataDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.mysql.dict.SysDictDataCoreMapper; -import cn.iocoder.yudao.coreservice.modules.system.service.dict.SysDictDataCoreService; -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; -import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; -import cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO; -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableTable; -import lombok.extern.slf4j.Slf4j; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Service; - -import javax.annotation.PostConstruct; -import javax.annotation.Resource; -import java.util.*; - -import static cn.iocoder.yudao.coreservice.modules.system.enums.SysErrorCodeConstants.DICT_DATA_NOT_ENABLE; -import static cn.iocoder.yudao.coreservice.modules.system.enums.SysErrorCodeConstants.DICT_DATA_NOT_EXISTS; -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; - -/** - * å­—å…¸æ•°æ® Service 实现类 - * - * @author 芋é“æºç  - */ -@Service -@Slf4j -public class SysDictDataCoreServiceImpl implements SysDictDataCoreService { - - /** - * 定时执行 {@link #schedulePeriodicRefresh()} 的周期 - * 因为已ç»é€šè¿‡ Redis Pub/Sub 机制,所以频率ä¸éœ€è¦é«˜ - */ - private static final long SCHEDULER_PERIOD = 5 * 60 * 1000L; - - /** - * 字典数æ®ç¼“存,第二个 key 使用 label - * - * key1:字典类型 dictType - * key2:字典标签 label - */ - private ImmutableTable labelDictDataCache; - /** - * 字典数æ®ç¼“存,第二个 key 使用 value - * - * key1:字典类型 dictType - * key2:字典值 value - */ - private ImmutableTable valueDictDataCache; - /** - * 缓存字典数æ®çš„最大更新时间,用于åŽç»­çš„增é‡è½®è¯¢ï¼Œåˆ¤æ–­æ˜¯å¦æœ‰æ›´æ–° - */ - private volatile Date maxUpdateTime; - - @Resource - private SysDictDataCoreMapper dictDataCoreMapper; - - @Override - @PostConstruct - public synchronized void initLocalCache() { - // 获å–字典数æ®åˆ—表,如果有更新 - List dataList = this.loadDictDataIfUpdate(maxUpdateTime); - if (CollUtil.isEmpty(dataList)) { - return; - } - - // 构建缓存 - ImmutableTable.Builder labelDictDataBuilder = ImmutableTable.builder(); - ImmutableTable.Builder valueDictDataBuilder = ImmutableTable.builder(); - dataList.forEach(dictData -> { - labelDictDataBuilder.put(dictData.getDictType(), dictData.getLabel(), dictData); - valueDictDataBuilder.put(dictData.getDictType(), dictData.getValue(), dictData); - }); - labelDictDataCache = labelDictDataBuilder.build(); - valueDictDataCache = valueDictDataBuilder.build(); - assert dataList.size() > 0; // 断言,é¿å…å‘Šè­¦ - maxUpdateTime = dataList.stream().max(Comparator.comparing(BaseDO::getUpdateTime)).get().getUpdateTime(); - log.info("[initLocalCache][缓存字典数æ®ï¼Œæ•°é‡ä¸º:{}]", dataList.size()); - } - - @Scheduled(fixedDelay = SCHEDULER_PERIOD, initialDelay = SCHEDULER_PERIOD) - public void schedulePeriodicRefresh() { - initLocalCache(); - } - - /** - * 如果字典数æ®å‘生å˜åŒ–,从数æ®åº“中获å–最新的全é‡å­—典数æ®ã€‚ - * 如果未å‘生å˜åŒ–,则返回空 - * - * @param maxUpdateTime 当å‰å­—典数æ®çš„最大更新时间 - * @return 字典数æ®åˆ—表 - */ - private List loadDictDataIfUpdate(Date maxUpdateTime) { - // 第一步,判断是å¦è¦æ›´æ–°ã€‚ - if (maxUpdateTime == null) { // 如果更新时间为空,说明 DB ä¸€å®šæœ‰æ–°æ•°æ® - log.info("[loadDictDataIfUpdate][首次加载全é‡å­—典数æ®]"); - } else { // 判断数æ®åº“中是å¦æœ‰æ›´æ–°çš„å­—å…¸æ•°æ® - if (!dictDataCoreMapper.selectExistsByUpdateTimeAfter(maxUpdateTime)) { - return null; - } - log.info("[loadDictDataIfUpdate][增é‡åŠ è½½å…¨é‡å­—典数æ®]"); - } - // 第二步,如果有更新,则从数æ®åº“åŠ è½½æ‰€æœ‰å­—å…¸æ•°æ® - return dictDataCoreMapper.selectList(); - } - - @Override - public DictDataRespDTO getDictDataFromCache(String type, String value) { - return SysDictDataCoreConvert.INSTANCE.convert02(valueDictDataCache.get(type, value)); - } - - @Override - public DictDataRespDTO parseDictDataFromCache(String type, String label) { - return SysDictDataCoreConvert.INSTANCE.convert02(labelDictDataCache.get(type, label)); - } - - @Override - public List listDictDatasFromCache(String type) { - return SysDictDataCoreConvert.INSTANCE.convertList03(labelDictDataCache.row(type).values()); - } - - @Override - public void validDictDatas(String dictType, Collection values) { - if (CollUtil.isEmpty(values)) { - return; - } - ImmutableMap dictDataMap = valueDictDataCache.row(dictType); - // 校验 - values.forEach(value -> { - SysDictDataDO dictData = dictDataMap.get(value); - if (dictData == null) { - throw exception(DICT_DATA_NOT_EXISTS); - } - if (!CommonStatusEnum.ENABLE.getStatus().equals(dictData.getStatus())) { - throw exception(DICT_DATA_NOT_ENABLE, dictData.getLabel()); - } - }); - } - -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/logger/SysLoginLogCoreService.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/logger/SysLoginLogCoreService.java deleted file mode 100644 index decc2739e..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/logger/SysLoginLogCoreService.java +++ /dev/null @@ -1,17 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.logger; - -import cn.iocoder.yudao.coreservice.modules.system.service.logger.dto.SysLoginLogCreateReqDTO; - -/** - * 登录日志 Core Service æŽ¥å£ - */ -public interface SysLoginLogCoreService { - - /** - * 创建登录日志 - * - * @param reqDTO æ—¥å¿—ä¿¡æ¯ - */ - void createLoginLog(SysLoginLogCreateReqDTO reqDTO); - -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/logger/impl/SysLoginLogCoreServiceImpl.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/logger/impl/SysLoginLogCoreServiceImpl.java deleted file mode 100644 index 7c866e8d6..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/logger/impl/SysLoginLogCoreServiceImpl.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.logger.impl; - -import cn.iocoder.yudao.coreservice.modules.system.convert.logger.SysLoginLogCoreConvert; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.logger.SysLoginLogDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.mysql.logger.SysLoginLogCoreMapper; -import cn.iocoder.yudao.coreservice.modules.system.service.logger.SysLoginLogCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.logger.dto.SysLoginLogCreateReqDTO; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; - -/** - * 登录日志 Service Core 实现 - * - * @author 芋é“æºç  - */ -@Service -public class SysLoginLogCoreServiceImpl implements SysLoginLogCoreService { - - @Resource - private SysLoginLogCoreMapper loginLogMapper; - - @Override - public void createLoginLog(SysLoginLogCreateReqDTO reqDTO) { - SysLoginLogDO loginLog = SysLoginLogCoreConvert.INSTANCE.convert(reqDTO); - // æ’å…¥ - loginLogMapper.insert(loginLog); - } - -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/SysSmsLogCoreService.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/SysSmsLogCoreService.java deleted file mode 100644 index 02a8c2696..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/SysSmsLogCoreService.java +++ /dev/null @@ -1,56 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.sms; - -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsTemplateDO; - -import java.util.Date; -import java.util.Map; - -/** - * 短信日志 Core Service æŽ¥å£ - * - * @author zzf - * @date 13:48 2021/3/2 - */ -public interface SysSmsLogCoreService { - - /** - * 创建短信日志 - * - * @param mobile æ‰‹æœºå· - * @param userId ç”¨æˆ·ç¼–å· - * @param userType 用户类型 - * @param isSend 是å¦å‘é€ - * @param template çŸ­ä¿¡æ¨¡æ¿ - * @param templateContent 短信内容 - * @param templateParams 短信å‚æ•° - * @return å‘é€æ—¥å¿—ç¼–å· - */ - Long createSmsLog(String mobile, Long userId, Integer userType, Boolean isSend, - SysSmsTemplateDO template, String templateContent, Map templateParams); - - /** - * 更新日志的å‘é€ç»“æžœ - * - * @param id æ—¥å¿—ç¼–å· - * @param sendCode å‘é€ç»“æžœçš„ç¼–ç  - * @param sendMsg å‘é€ç»“果的æ示 - * @param apiSendCode 短信 API å‘é€ç»“æžœçš„ç¼–ç  - * @param apiSendMsg 短信 API å‘é€å¤±è´¥çš„æ示 - * @param apiRequestId 短信 API å‘é€è¿”回的唯一请求 ID - * @param apiSerialNo 短信 API å‘é€è¿”回的åºå· - */ - void updateSmsSendResult(Long id, Integer sendCode, String sendMsg, - String apiSendCode, String apiSendMsg, String apiRequestId, String apiSerialNo); - - /** - * 更新日志的接收结果 - * - * @param id æ—¥å¿—ç¼–å· - * @param success 是å¦æŽ¥æ”¶æˆåŠŸ - * @param receiveTime 用户接收时间 - * @param apiReceiveCode API æŽ¥æ”¶ç»“æžœçš„ç¼–ç  - * @param apiReceiveMsg API 接收结果的说明 - */ - void updateSmsReceiveResult(Long id, Boolean success, Date receiveTime, String apiReceiveCode, String apiReceiveMsg); - -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/SysSmsTemplateCoreService.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/SysSmsTemplateCoreService.java deleted file mode 100644 index 9a3a16099..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/SysSmsTemplateCoreService.java +++ /dev/null @@ -1,36 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.sms; - -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsTemplateDO; - -import java.util.Map; - -/** - * çŸ­ä¿¡æ¨¡æ¿ Core Service æŽ¥å£ - * - * @author 芋é“æºç  - */ -public interface SysSmsTemplateCoreService { - - /** - * åˆå§‹åŒ–短信模æ¿çš„本地缓存 - */ - void initLocalCache(); - - /** - * 获得短信模æ¿ï¼Œä»Žç¼“存中 - * - * @param code 模æ¿ç¼–ç  - * @return çŸ­ä¿¡æ¨¡æ¿ - */ - SysSmsTemplateDO getSmsTemplateByCodeFromCache(String code); - - /** - * æ ¼å¼åŒ–短信内容 - * - * @param content 短信模æ¿çš„内容 - * @param params 内容的å‚æ•° - * @return æ ¼å¼åŒ–åŽçš„内容 - */ - String formatSmsTemplateContent(String content, Map params); - -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/impl/SysSmsLogCoreServiceImpl.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/impl/SysSmsLogCoreServiceImpl.java deleted file mode 100644 index de318ed62..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/impl/SysSmsLogCoreServiceImpl.java +++ /dev/null @@ -1,72 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.sms.impl; - -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsLogDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsTemplateDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.mysql.sms.SysSmsLogCoreMapper; -import cn.iocoder.yudao.coreservice.modules.system.enums.sms.SysSmsReceiveStatusEnum; -import cn.iocoder.yudao.coreservice.modules.system.enums.sms.SysSmsSendStatusEnum; -import cn.iocoder.yudao.coreservice.modules.system.service.sms.SysSmsLogCoreService; -import cn.iocoder.yudao.framework.common.pojo.CommonResult; -import lombok.extern.slf4j.Slf4j; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.Date; -import java.util.Map; -import java.util.Objects; - -/** - * 短信日志 Core Service 实现类 - * - * @author zzf - * @date 2021/1/25 9:25 - */ -@Slf4j -@Service -public class SysSmsLogCoreServiceImpl implements SysSmsLogCoreService { - - @Resource - private SysSmsLogCoreMapper smsLogCoreMapper; - - @Override - public Long createSmsLog(String mobile, Long userId, Integer userType, Boolean isSend, - SysSmsTemplateDO template, String templateContent, Map templateParams) { - SysSmsLogDO.SysSmsLogDOBuilder logBuilder = SysSmsLogDO.builder(); - // æ ¹æ®æ˜¯å¦è¦å‘é€ï¼Œè®¾ç½®çŠ¶æ€ - logBuilder.sendStatus(Objects.equals(isSend, true) ? SysSmsSendStatusEnum.INIT.getStatus() - : SysSmsSendStatusEnum.IGNORE.getStatus()); - // 设置手机相关字段 - logBuilder.mobile(mobile).userId(userId).userType(userType); - // 设置模æ¿ç›¸å…³å­—段 - logBuilder.templateId(template.getId()).templateCode(template.getCode()).templateType(template.getType()); - logBuilder.templateContent(templateContent).templateParams(templateParams).apiTemplateId(template.getApiTemplateId()); - // 设置渠é“相关字段 - logBuilder.channelId(template.getChannelId()).channelCode(template.getChannelCode()); - // 设置接收相关字段 - logBuilder.receiveStatus(SysSmsReceiveStatusEnum.INIT.getStatus()); - - // æ’入数æ®åº“ - SysSmsLogDO logDO = logBuilder.build(); - smsLogCoreMapper.insert(logDO); - return logDO.getId(); - } - - @Override - public void updateSmsSendResult(Long id, Integer sendCode, String sendMsg, - String apiSendCode, String apiSendMsg, String apiRequestId, String apiSerialNo) { - SysSmsSendStatusEnum sendStatus = CommonResult.isSuccess(sendCode) ? SysSmsSendStatusEnum.SUCCESS - : SysSmsSendStatusEnum.FAILURE; - smsLogCoreMapper.updateById(SysSmsLogDO.builder().id(id).sendStatus(sendStatus.getStatus()).sendTime(new Date()) - .sendCode(sendCode).sendMsg(sendMsg).apiSendCode(apiSendCode).apiSendMsg(apiSendMsg) - .apiRequestId(apiRequestId).apiSerialNo(apiSerialNo).build()); - } - - @Override - public void updateSmsReceiveResult(Long id, Boolean success, Date receiveTime, String apiReceiveCode, String apiReceiveMsg) { - SysSmsReceiveStatusEnum receiveStatus = Objects.equals(success, true) ? SysSmsReceiveStatusEnum.SUCCESS - : SysSmsReceiveStatusEnum.FAILURE; - smsLogCoreMapper.updateById(SysSmsLogDO.builder().id(id).receiveStatus(receiveStatus.getStatus()).receiveTime(receiveTime) - .apiReceiveCode(apiReceiveCode).apiReceiveMsg(apiReceiveMsg).build()); - } - -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/impl/SysSmsTemplateCoreServiceImpl.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/impl/SysSmsTemplateCoreServiceImpl.java deleted file mode 100644 index aa1a28b38..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/impl/SysSmsTemplateCoreServiceImpl.java +++ /dev/null @@ -1,105 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.sms.impl; - -import cn.hutool.core.collection.CollUtil; -import cn.hutool.core.util.StrUtil; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsTemplateDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.mysql.sms.SysSmsTemplateCoreMapper; -import cn.iocoder.yudao.coreservice.modules.system.service.sms.SysSmsTemplateCoreService; -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; -import com.google.common.collect.ImmutableMap; -import lombok.extern.slf4j.Slf4j; -import org.springframework.scheduling.annotation.Scheduled; -import org.springframework.stereotype.Service; - -import javax.annotation.PostConstruct; -import javax.annotation.Resource; -import java.util.Comparator; -import java.util.Date; -import java.util.List; -import java.util.Map; - -/** - * çŸ­ä¿¡æ¨¡æ¿ Core Service æŽ¥å£ - * - * @author 芋é“æºç  - */ -@Service -@Slf4j -public class SysSmsTemplateCoreServiceImpl implements SysSmsTemplateCoreService { - - /** - * 定时执行 {@link #schedulePeriodicRefresh()} 的周期 - * 因为已ç»é€šè¿‡ Redis Pub/Sub 机制,所以频率ä¸éœ€è¦é«˜ - */ - private static final long SCHEDULER_PERIOD = 5 * 60 * 1000L; - - /** - * 短信模æ¿ç¼“å­˜ - * key:短信模æ¿ç¼–ç  {@link SysSmsTemplateDO#getCode()} - * - * 这里声明 volatile 修饰的原因是,æ¯æ¬¡åˆ·æ–°æ—¶ï¼Œç›´æŽ¥ä¿®æ”¹æŒ‡å‘ - */ - private volatile Map smsTemplateCache; - /** - * 缓存短信模æ¿çš„最大更新时间,用于åŽç»­çš„增é‡è½®è¯¢ï¼Œåˆ¤æ–­æ˜¯å¦æœ‰æ›´æ–° - */ - private volatile Date maxUpdateTime; - - @Resource - private SysSmsTemplateCoreMapper smsTemplateCoreMapper; - - @Override - @PostConstruct - public void initLocalCache() { - // 获å–短信模æ¿åˆ—表,如果有更新 - List smsTemplateList = this.loadSmsTemplateIfUpdate(maxUpdateTime); - if (CollUtil.isEmpty(smsTemplateList)) { - return; - } - - // 写入缓存 - ImmutableMap.Builder builder = ImmutableMap.builder(); - smsTemplateList.forEach(sysSmsTemplateDO -> builder.put(sysSmsTemplateDO.getCode(), sysSmsTemplateDO)); - smsTemplateCache = builder.build(); - assert smsTemplateList.size() > 0; // 断言,é¿å…å‘Šè­¦ - maxUpdateTime = smsTemplateList.stream().max(Comparator.comparing(BaseDO::getUpdateTime)).get().getUpdateTime(); - log.info("[initLocalCache][åˆå§‹åŒ– SmsTemplate æ•°é‡ä¸º {}]", smsTemplateList.size()); - } - - /** - * 如果短信模æ¿å‘生å˜åŒ–,从数æ®åº“中获å–最新的全é‡çŸ­ä¿¡æ¨¡æ¿ã€‚ - * 如果未å‘生å˜åŒ–,则返回空 - * - * @param maxUpdateTime 当å‰çŸ­ä¿¡æ¨¡æ¿çš„最大更新时间 - * @return 短信模æ¿åˆ—表 - */ - private List loadSmsTemplateIfUpdate(Date maxUpdateTime) { - // 第一步,判断是å¦è¦æ›´æ–°ã€‚ - if (maxUpdateTime == null) { // 如果更新时间为空,说明 DB ä¸€å®šæœ‰æ–°æ•°æ® - log.info("[loadSmsTemplateIfUpdate][首次加载全é‡çŸ­ä¿¡æ¨¡æ¿]"); - } else { // 判断数æ®åº“中是å¦æœ‰æ›´æ–°çš„çŸ­ä¿¡æ¨¡æ¿ - if (smsTemplateCoreMapper.selectExistsByUpdateTimeAfter(maxUpdateTime) == null) { - return null; - } - log.info("[loadSmsTemplateIfUpdate][增é‡åŠ è½½å…¨é‡çŸ­ä¿¡æ¨¡æ¿]"); - } - // 第二步,如果有更新,则从数æ®åº“åŠ è½½æ‰€æœ‰çŸ­ä¿¡æ¨¡æ¿ - return smsTemplateCoreMapper.selectList(); - } - - @Scheduled(fixedDelay = SCHEDULER_PERIOD, initialDelay = SCHEDULER_PERIOD) - public void schedulePeriodicRefresh() { - initLocalCache(); - } - - @Override - public SysSmsTemplateDO getSmsTemplateByCodeFromCache(String code) { - return smsTemplateCache.get(code); - } - - @Override - public String formatSmsTemplateContent(String content, Map params) { - return StrUtil.format(content, params); - } - -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/user/SysUserCoreService.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/user/SysUserCoreService.java deleted file mode 100644 index c86e7a84b..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/user/SysUserCoreService.java +++ /dev/null @@ -1,70 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.user; - -import cn.hutool.core.collection.CollUtil; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; -import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; - -import java.util.*; - -/** - * åŽå°ç”¨æˆ· Service Core æŽ¥å£ - * - * @author 芋é“æºç  - */ -public interface SysUserCoreService { - - /** - * 通过用户 ID 查询用户 - * - * @param id 用户ID - * @return ç”¨æˆ·å¯¹è±¡ä¿¡æ¯ - */ - SysUserDO getUser(Long id); - - /** - * 获得指定部门的用户数组 - * - * @param deptIds 部门数组 - * @return 用户数组 - */ - List getUsersByDeptIds(Collection deptIds); - - /** - * 获得指定岗ä½çš„用户数组 - * - * @param postIds å²—ä½æ•°ç»„ - * @return 用户数组 - */ - List getUsersByPostIds(Collection postIds); - - /** - * 获得用户列表 - * - * @param ids 用户编å·æ•°ç»„ - * @return 用户列表 - */ - List getUsers(Collection ids); - - /** - * 校验用户们是å¦æœ‰æ•ˆã€‚如下情况,视为无效: - * 1. 用户编å·ä¸å­˜åœ¨ - * 2. 用户被ç¦ç”¨ - * - * @param ids 用户编å·æ•°ç»„ - */ - void validUsers(Set ids); - - /** - * 获得用户 Map - * - * @param ids 用户编å·æ•°ç»„ - * @return 用户 Map - */ - default Map getUserMap(Collection ids) { - if (CollUtil.isEmpty(ids)) { - return new HashMap<>(); - } - return CollectionUtils.convertMap(getUsers(ids), SysUserDO::getId); - } - -} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/user/impl/SysUserCoreServiceImpl.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/user/impl/SysUserCoreServiceImpl.java deleted file mode 100644 index c2b5b054d..000000000 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/user/impl/SysUserCoreServiceImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.user.impl; - -import cn.hutool.core.collection.CollUtil; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.mysql.user.SysUserCoreMapper; -import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService; -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; -import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; -import java.util.*; - -import static cn.iocoder.yudao.coreservice.modules.system.enums.SysErrorCodeConstants.USER_IS_DISABLE; -import static cn.iocoder.yudao.coreservice.modules.system.enums.SysErrorCodeConstants.USER_NOT_EXISTS; -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; - -/** - * åŽå°ç”¨æˆ· Service Core 实现 - * - * @author 芋é“æºç  - */ -@Service -public class SysUserCoreServiceImpl implements SysUserCoreService { - - @Resource - private SysUserCoreMapper userCoreMapper; - - @Override - public SysUserDO getUser(Long id) { - return userCoreMapper.selectById(id); - } - - @Override - public List getUsersByDeptIds(Collection deptIds) { - if (CollUtil.isEmpty(deptIds)) { - return Collections.emptyList(); - } - return userCoreMapper.selectListByDeptIds(deptIds); - } - - @Override - public List getUsersByPostIds(Collection postIds) { - if (CollUtil.isEmpty(postIds)) { - return Collections.emptyList(); - } - // 过滤ä¸ç¬¦åˆæ¡ä»¶çš„ - // TODO 芋艿:暂时åªèƒ½å†…存过滤。解决方案:1ã€æ–°å»ºä¸€ä¸ªå…³è”表;2ã€åŸºäºŽ where + 函数;3ã€json å­—æ®µï¼Œé€‚åˆ mysql 8+ 版本 - List users = userCoreMapper.selectList(); - users.removeIf(user -> !CollUtil.containsAny(user.getPostIds(), postIds)); - return users; - } - - @Override - public List getUsers(Collection ids) { - if (CollUtil.isEmpty(ids)) { - return Collections.emptyList(); - } - return userCoreMapper.selectBatchIds(ids); - } - - @Override - public void validUsers(Set ids) { - if (CollUtil.isEmpty(ids)) { - return; - } - // 获得岗ä½ä¿¡æ¯ - List users = userCoreMapper.selectBatchIds(ids); - Map userMap = CollectionUtils.convertMap(users, SysUserDO::getId); - // 校验 - ids.forEach(id -> { - SysUserDO user = userMap.get(id); - if (user == null) { - throw exception(USER_NOT_EXISTS); - } - if (!CommonStatusEnum.ENABLE.getStatus().equals(user.getStatus())) { - throw exception(USER_IS_DISABLE, user.getNickname()); - } - }); - } - -} diff --git a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/infra/service/file/InfFileCoreServiceTest.java b/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/infra/service/file/InfFileCoreServiceTest.java index ce3d69395..232ccf5f4 100644 --- a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/infra/service/file/InfFileCoreServiceTest.java +++ b/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/infra/service/file/InfFileCoreServiceTest.java @@ -12,8 +12,7 @@ import org.springframework.context.annotation.Import; import javax.annotation.Resource; -import static cn.iocoder.yudao.coreservice.modules.system.enums.SysErrorCodeConstants.FILE_NOT_EXISTS; -import static cn.iocoder.yudao.coreservice.modules.system.enums.SysErrorCodeConstants.FILE_PATH_EXISTS; +import static cn.iocoder.yudao.coreservice.modules.infra.enums.SysErrorCodeConstants.*; import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomString; diff --git a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/auth/SysUserSessionCoreServiceTest.java b/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/auth/SysUserSessionCoreServiceTest.java deleted file mode 100644 index d8aada358..000000000 --- a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/auth/SysUserSessionCoreServiceTest.java +++ /dev/null @@ -1,125 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.auth; - -import cn.iocoder.yudao.coreservice.BaseDbAndRedisUnitTest; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.auth.SysUserSessionDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.mysql.auth.SysUserSessionCoreMapper; -import cn.iocoder.yudao.coreservice.modules.system.dal.redis.auth.SysLoginUserCoreRedisDAO; -import cn.iocoder.yudao.coreservice.modules.system.service.auth.impl.SysUserSessionCoreServiceImpl; -import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; -import cn.iocoder.yudao.framework.security.config.SecurityProperties; -import cn.iocoder.yudao.framework.security.core.LoginUser; -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.context.annotation.Import; - -import javax.annotation.Resource; -import java.time.Duration; -import java.util.Date; - -import static cn.hutool.core.util.RandomUtil.randomEle; -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.addTime; -import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; -import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; -import static org.junit.jupiter.api.Assertions.*; -import static org.mockito.Mockito.when; - -@Import({SysUserSessionCoreServiceImpl.class, SysLoginUserCoreRedisDAO.class}) -public class SysUserSessionCoreServiceTest extends BaseDbAndRedisUnitTest { - - @Resource - private SysUserSessionCoreServiceImpl userSessionCoreService; - - @Resource - private SysUserSessionCoreMapper userSessionCoreMapper; - @Resource - private SysLoginUserCoreRedisDAO loginUserCoreRedisDAO; - - @MockBean - private SecurityProperties securityProperties; - - @Test - public void testCreateUserSession_success() { - // 准备å‚æ•° - String userIp = randomString(); - String userAgent = randomString(); - LoginUser loginUser = randomPojo(LoginUser.class, o -> { - o.setUserType(randomEle(UserTypeEnum.values()).getValue()); - o.setTenantId(0L); // 租户设置为 0,因为暂未å¯ç”¨å¤šç§Ÿæˆ·ç»„件 - }); - // mock 方法 - when(securityProperties.getSessionTimeout()).thenReturn(Duration.ofDays(1)); - - // 调用 - String sessionId = userSessionCoreService.createUserSession(loginUser, userIp, userAgent); - // 校验 SysUserSessionDO 记录 - SysUserSessionDO userSessionDO = userSessionCoreMapper.selectById(sessionId); - assertPojoEquals(loginUser, userSessionDO, "id", "updateTime"); - assertEquals(sessionId, userSessionDO.getId()); - assertEquals(userIp, userSessionDO.getUserIp()); - assertEquals(userAgent, userSessionDO.getUserAgent()); - // 校验 LoginUser 缓存 - LoginUser redisLoginUser = loginUserCoreRedisDAO.get(sessionId); - assertPojoEquals(loginUser, redisLoginUser, "username", "password"); - } - - @Test - public void testCreateRefreshUserSession_success() { - // 准备å‚æ•° - String sessionId = randomString(); - String userIp = randomString(); - String userAgent = randomString(); - long timeLong = randomLongId(); - String userName = randomString(); - Date date = randomDate(); - LoginUser loginUser = randomPojo(LoginUser.class, o -> o.setUserType(randomEle(UserTypeEnum.values()).getValue())); - // mock 方法 - when(securityProperties.getSessionTimeout()).thenReturn(Duration.ofDays(1)); - // mock æ•°æ® - loginUser.setUpdateTime(date); - loginUserCoreRedisDAO.set(sessionId, loginUser); - SysUserSessionDO userSession = SysUserSessionDO.builder().id(sessionId) - .userId(loginUser.getId()).userType(loginUser.getUserType()) - .userIp(userIp).userAgent(userAgent).username(userName) - .sessionTimeout(addTime(Duration.ofMillis(timeLong))) - .build(); - userSessionCoreMapper.insert(userSession); - - // 调用 - userSessionCoreService.refreshUserSession(sessionId, loginUser); - // 校验 LoginUser 缓存 - LoginUser redisLoginUser = loginUserCoreRedisDAO.get(sessionId); - assertNotEquals(redisLoginUser.getUpdateTime(), date); - // 校验 SysUserSessionDO 记录 - SysUserSessionDO updateDO = userSessionCoreMapper.selectById(sessionId); - assertEquals(updateDO.getUsername(), loginUser.getUsername()); - assertNotEquals(updateDO.getUpdateTime(), userSession.getUpdateTime()); - assertNotEquals(updateDO.getSessionTimeout(), addTime(Duration.ofMillis(timeLong))); - } - - @Test - public void testDeleteUserSession_success() { - // 准备å‚æ•° - String sessionId = randomString(); - String userIp = randomString(); - String userAgent = randomString(); - Long timeLong = randomLongId(); - LoginUser loginUser = randomPojo(LoginUser.class, o -> o.setUserType(randomEle(UserTypeEnum.values()).getValue())); - // mock 存入 Redis - when(securityProperties.getSessionTimeout()).thenReturn(Duration.ofDays(1)); - // mock æ•°æ® - loginUserCoreRedisDAO.set(sessionId, loginUser); - SysUserSessionDO userSession = SysUserSessionDO.builder().id(sessionId) - .userId(loginUser.getId()).userType(loginUser.getUserType()) - .userIp(userIp).userAgent(userAgent).username(loginUser.getUsername()) - .sessionTimeout(addTime(Duration.ofMillis(timeLong))) - .build(); - userSessionCoreMapper.insert(userSession); - - // 调用 - userSessionCoreService.deleteUserSession(sessionId); - // 校验数æ®ä¸å­˜åœ¨äº† - assertNull(loginUserCoreRedisDAO.get(sessionId)); - assertNull(userSessionCoreMapper.selectById(sessionId)); - } - -} diff --git a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/dict/SysDictDataCoreServiceTest.java b/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/dict/SysDictDataCoreServiceTest.java deleted file mode 100644 index 410c592f5..000000000 --- a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/dict/SysDictDataCoreServiceTest.java +++ /dev/null @@ -1,78 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.dict; - -import cn.iocoder.yudao.coreservice.BaseDbUnitTest; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dict.SysDictDataDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.mysql.dict.SysDictDataCoreMapper; -import cn.iocoder.yudao.coreservice.modules.system.service.dict.impl.SysDictDataCoreServiceImpl; -import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; -import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; -import com.google.common.collect.ImmutableTable; -import org.junit.jupiter.api.Test; -import org.springframework.context.annotation.Import; - -import javax.annotation.Resource; -import java.util.Date; -import java.util.function.Consumer; - -import static cn.hutool.core.bean.BeanUtil.getFieldValue; -import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; -import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomCommonStatus; -import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** -* {@link SysDictDataCoreServiceImpl} çš„å•å…ƒæµ‹è¯•ç±» -* -* @author 芋é“æºç  -*/ -@Import(SysDictDataCoreServiceImpl.class) -public class SysDictDataCoreServiceTest extends BaseDbUnitTest { - - @Resource - private SysDictDataCoreServiceImpl dictDataCoreService; - - @Resource - private SysDictDataCoreMapper dictDataMapper; - - /** - * 测试加载到新的字典数æ®çš„情况 - */ - @Test - @SuppressWarnings("unchecked") - public void testInitLocalCache() { - // mock æ•°æ® - SysDictDataDO dictData01 = randomDictDataDO(); - dictDataMapper.insert(dictData01); - SysDictDataDO dictData02 = randomDictDataDO(); - dictDataMapper.insert(dictData02); - - // 调用 - dictDataCoreService.initLocalCache(); - // 断言 labelDictDataCache 缓存 - ImmutableTable labelDictDataCache = - (ImmutableTable) getFieldValue(dictDataCoreService, "labelDictDataCache"); - assertEquals(2, labelDictDataCache.size()); - assertPojoEquals(dictData01, labelDictDataCache.get(dictData01.getDictType(), dictData01.getLabel())); - assertPojoEquals(dictData02, labelDictDataCache.get(dictData02.getDictType(), dictData02.getLabel())); - // 断言 valueDictDataCache 缓存 - ImmutableTable valueDictDataCache = - (ImmutableTable) getFieldValue(dictDataCoreService, "valueDictDataCache"); - assertEquals(2, valueDictDataCache.size()); - assertPojoEquals(dictData01, valueDictDataCache.get(dictData01.getDictType(), dictData01.getValue())); - assertPojoEquals(dictData02, valueDictDataCache.get(dictData02.getDictType(), dictData02.getValue())); - // 断言 maxUpdateTime 缓存 - Date maxUpdateTime = (Date) getFieldValue(dictDataCoreService, "maxUpdateTime"); - assertEquals(ObjectUtils.max(dictData01.getUpdateTime(), dictData02.getUpdateTime()), maxUpdateTime); - } - - // ========== éšæœºå¯¹è±¡ ========== - - @SafeVarargs - private static SysDictDataDO randomDictDataDO(Consumer... consumers) { - Consumer consumer = (o) -> { - o.setStatus(randomCommonStatus()); // ä¿è¯ status 的范围 - }; - return randomPojo(SysDictDataDO.class, ArrayUtils.append(consumer, consumers)); - } - -} diff --git a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/logger/SysLoginLogServiceImplTest.java b/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/logger/SysLoginLogServiceImplTest.java deleted file mode 100644 index 1da56c264..000000000 --- a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/logger/SysLoginLogServiceImplTest.java +++ /dev/null @@ -1,47 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.logger; - -import cn.iocoder.yudao.coreservice.BaseDbUnitTest; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.logger.SysLoginLogDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.mysql.logger.SysLoginLogCoreMapper; -import cn.iocoder.yudao.coreservice.modules.system.enums.logger.SysLoginLogTypeEnum; -import cn.iocoder.yudao.coreservice.modules.system.enums.logger.SysLoginResultEnum; -import cn.iocoder.yudao.coreservice.modules.system.service.logger.dto.SysLoginLogCreateReqDTO; -import cn.iocoder.yudao.coreservice.modules.system.service.logger.impl.SysLoginLogCoreServiceImpl; -import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; -import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils; -import cn.iocoder.yudao.framework.test.core.util.RandomUtils; -import org.junit.jupiter.api.Test; -import org.springframework.context.annotation.Import; - -import javax.annotation.Resource; - -import static cn.hutool.core.util.RandomUtil.randomEle; -import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; - -@Import(SysLoginLogCoreServiceImpl.class) -public class SysLoginLogServiceImplTest extends BaseDbUnitTest { - - @Resource - private SysLoginLogCoreServiceImpl loginLogCoreService; - - @Resource - private SysLoginLogCoreMapper loginLogCoreMapper; - - @Test - public void testCreateLoginLog() { - SysLoginLogCreateReqDTO reqDTO = RandomUtils.randomPojo(SysLoginLogCreateReqDTO.class, vo -> { - // 指定éšæœºçš„范围,é¿å…超出范围入库失败 - vo.setUserType(randomEle(UserTypeEnum.values()).getValue()); - vo.setLogType(randomEle(SysLoginLogTypeEnum.values()).getType()); - vo.setResult(randomEle(SysLoginResultEnum.values()).getResult()); - vo.setTraceId(TracerUtils.getTraceId()); - }); - - // 调用 - loginLogCoreService.createLoginLog(reqDTO); - // 断言,忽略基本字段 - SysLoginLogDO sysLoginLogDO = loginLogCoreMapper.selectOne(null); - assertPojoEquals(reqDTO, sysLoginLogDO); - } - -} diff --git a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/package-info.java b/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/package-info.java deleted file mode 100644 index 8b5f8b010..000000000 --- a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.system.service; diff --git a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/SysSmsLogCoreServiceTest.java b/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/SysSmsLogCoreServiceTest.java deleted file mode 100644 index 896f0c6d3..000000000 --- a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/SysSmsLogCoreServiceTest.java +++ /dev/null @@ -1,149 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.sms; - -import cn.hutool.core.map.MapUtil; -import cn.iocoder.yudao.coreservice.BaseDbUnitTest; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsLogDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsTemplateDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.mysql.sms.SysSmsLogCoreMapper; -import cn.iocoder.yudao.coreservice.modules.system.enums.sms.SysSmsReceiveStatusEnum; -import cn.iocoder.yudao.coreservice.modules.system.enums.sms.SysSmsSendStatusEnum; -import cn.iocoder.yudao.coreservice.modules.system.enums.sms.SysSmsTemplateTypeEnum; -import cn.iocoder.yudao.coreservice.modules.system.service.sms.impl.SysSmsLogCoreServiceImpl; -import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; -import cn.iocoder.yudao.framework.common.pojo.CommonResult; -import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; -import org.junit.jupiter.api.Test; -import org.springframework.context.annotation.Import; - -import javax.annotation.Resource; -import java.util.Date; -import java.util.Map; -import java.util.function.Consumer; - -import static cn.hutool.core.util.RandomUtil.randomBoolean; -import static cn.hutool.core.util.RandomUtil.randomEle; -import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -/** -* {@link SysSmsLogCoreServiceImpl} çš„å•å…ƒæµ‹è¯•ç±» -* -* @author 芋é“æºç  -*/ -@Import(SysSmsLogCoreServiceImpl.class) -public class SysSmsLogCoreServiceTest extends BaseDbUnitTest { - - @Resource - private SysSmsLogCoreServiceImpl smsLogCoreService; - - @Resource - private SysSmsLogCoreMapper smsLogCoreMapper; - - @Test - public void testCreateSmsLog() { - // 准备å‚æ•° - String mobile = randomString(); - Long userId = randomLongId(); - Integer userType = randomEle(UserTypeEnum.values()).getValue(); - Boolean isSend = randomBoolean(); - SysSmsTemplateDO templateDO = randomPojo(SysSmsTemplateDO.class, - o -> o.setType(randomEle(SysSmsTemplateTypeEnum.values()).getType())); - String templateContent = randomString(); - Map templateParams = randomTemplateParams(); - // mock 方法 - - // 调用 - Long logId = smsLogCoreService.createSmsLog(mobile, userId, userType, isSend, - templateDO, templateContent, templateParams); - // 断言 - SysSmsLogDO logDO = smsLogCoreMapper.selectById(logId); - assertEquals(isSend ? SysSmsSendStatusEnum.INIT.getStatus() : SysSmsSendStatusEnum.IGNORE.getStatus(), - logDO.getSendStatus()); - assertEquals(mobile, logDO.getMobile()); - assertEquals(userType, logDO.getUserType()); - assertEquals(userId, logDO.getUserId()); - assertEquals(templateDO.getId(), logDO.getTemplateId()); - assertEquals(templateDO.getCode(), logDO.getTemplateCode()); - assertEquals(templateDO.getType(), logDO.getTemplateType()); - assertEquals(templateDO.getChannelId(), logDO.getChannelId()); - assertEquals(templateDO.getChannelCode(), logDO.getChannelCode()); - assertEquals(templateContent, logDO.getTemplateContent()); - assertEquals(templateParams, logDO.getTemplateParams()); - assertEquals(SysSmsReceiveStatusEnum.INIT.getStatus(), logDO.getReceiveStatus()); - } - - @Test - public void testUpdateSmsSendResult() { - // mock æ•°æ® - SysSmsLogDO dbSmsLog = randomSmsLogDO( - o -> o.setSendStatus(SysSmsSendStatusEnum.IGNORE.getStatus())); - smsLogCoreMapper.insert(dbSmsLog); - // 准备å‚æ•° - Long id = dbSmsLog.getId(); - Integer sendCode = randomInteger(); - String sendMsg = randomString(); - String apiSendCode = randomString(); - String apiSendMsg = randomString(); - String apiRequestId = randomString(); - String apiSerialNo = randomString(); - - // 调用 - smsLogCoreService.updateSmsSendResult(id, sendCode, sendMsg, - apiSendCode, apiSendMsg, apiRequestId, apiSerialNo); - // 断言 - dbSmsLog = smsLogCoreMapper.selectById(id); - assertEquals(CommonResult.isSuccess(sendCode) ? SysSmsSendStatusEnum.SUCCESS.getStatus() - : SysSmsSendStatusEnum.FAILURE.getStatus(), dbSmsLog.getSendStatus()); - assertNotNull(dbSmsLog.getSendTime()); - assertEquals(sendMsg, dbSmsLog.getSendMsg()); - assertEquals(apiSendCode, dbSmsLog.getApiSendCode()); - assertEquals(apiSendMsg, dbSmsLog.getApiSendMsg()); - assertEquals(apiRequestId, dbSmsLog.getApiRequestId()); - assertEquals(apiSerialNo, dbSmsLog.getApiSerialNo()); - } - - @Test - public void testUpdateSmsReceiveResult() { - // mock æ•°æ® - SysSmsLogDO dbSmsLog = randomSmsLogDO( - o -> o.setReceiveStatus(SysSmsReceiveStatusEnum.INIT.getStatus())); - smsLogCoreMapper.insert(dbSmsLog); - // 准备å‚æ•° - Long id = dbSmsLog.getId(); - Boolean success = randomBoolean(); - Date receiveTime = randomDate(); - String apiReceiveCode = randomString(); - String apiReceiveMsg = randomString(); - - // 调用 - smsLogCoreService.updateSmsReceiveResult(id, success, receiveTime, apiReceiveCode, apiReceiveMsg); - // 断言 - dbSmsLog = smsLogCoreMapper.selectById(id); - assertEquals(success ? SysSmsReceiveStatusEnum.SUCCESS.getStatus() - : SysSmsReceiveStatusEnum.FAILURE.getStatus(), dbSmsLog.getReceiveStatus()); - assertEquals(receiveTime, dbSmsLog.getReceiveTime()); - assertEquals(apiReceiveCode, dbSmsLog.getApiReceiveCode()); - assertEquals(apiReceiveMsg, dbSmsLog.getApiReceiveMsg()); - } - - // ========== éšæœºå¯¹è±¡ ========== - - @SafeVarargs - private static SysSmsLogDO randomSmsLogDO(Consumer... consumers) { - Consumer consumer = (o) -> { - o.setTemplateParams(randomTemplateParams()); - o.setTemplateType(randomEle(SysSmsTemplateTypeEnum.values()).getType()); // ä¿è¯ templateType 的范围 - o.setUserType(randomEle(UserTypeEnum.values()).getValue()); // ä¿è¯ userType 的范围 - o.setSendStatus(randomEle(SysSmsSendStatusEnum.values()).getStatus()); // ä¿è¯ sendStatus 的范围 - o.setReceiveStatus(randomEle(SysSmsReceiveStatusEnum.values()).getStatus()); // ä¿è¯ receiveStatus 的范围 - }; - return randomPojo(SysSmsLogDO.class, ArrayUtils.append(consumer, consumers)); - } - - - private static Map randomTemplateParams() { - return MapUtil.builder().put(randomString(), randomString()) - .put(randomString(), randomString()).build(); - } -} diff --git a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/SysSmsTemplateServiceTest.java b/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/SysSmsTemplateServiceTest.java deleted file mode 100644 index 1bcdb442d..000000000 --- a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/SysSmsTemplateServiceTest.java +++ /dev/null @@ -1,71 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.sms; - -import cn.iocoder.yudao.coreservice.BaseDbUnitTest; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsTemplateDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.mysql.sms.SysSmsTemplateCoreMapper; -import cn.iocoder.yudao.coreservice.modules.system.enums.sms.SysSmsTemplateTypeEnum; -import cn.iocoder.yudao.coreservice.modules.system.service.sms.impl.SysSmsTemplateCoreServiceImpl; -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; -import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; -import org.junit.jupiter.api.Test; -import org.springframework.context.annotation.Import; - -import javax.annotation.Resource; -import java.util.Date; -import java.util.Map; -import java.util.function.Consumer; - -import static cn.hutool.core.bean.BeanUtil.getFieldValue; -import static cn.hutool.core.util.RandomUtil.randomEle; -import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.max; -import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; -import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; -import static org.junit.jupiter.api.Assertions.assertEquals; - -/** -* {@link SysSmsTemplateCoreServiceImpl} çš„å•å…ƒæµ‹è¯•ç±» -* -* @author 芋é“æºç  -*/ -@Import(SysSmsTemplateCoreServiceImpl.class) -public class SysSmsTemplateServiceTest extends BaseDbUnitTest { - - @Resource - private SysSmsTemplateCoreServiceImpl smsTemplateCoreService; - - @Resource - private SysSmsTemplateCoreMapper smsTemplateCoreMapper; - - @Test - @SuppressWarnings("unchecked") - void testInitLocalCache() { - // mock æ•°æ® - SysSmsTemplateDO smsTemplate01 = randomSmsTemplateDO(); - smsTemplateCoreMapper.insert(smsTemplate01); - SysSmsTemplateDO smsTemplate02 = randomSmsTemplateDO(); - smsTemplateCoreMapper.insert(smsTemplate02); - - // 调用 - smsTemplateCoreService.initLocalCache(); - // 断言 deptCache 缓存 - Map smsTemplateCache = (Map) getFieldValue(smsTemplateCoreService, "smsTemplateCache"); - assertEquals(2, smsTemplateCache.size()); - assertPojoEquals(smsTemplate01, smsTemplateCache.get(smsTemplate01.getCode())); - assertPojoEquals(smsTemplate02, smsTemplateCache.get(smsTemplate02.getCode())); - // 断言 maxUpdateTime 缓存 - Date maxUpdateTime = (Date) getFieldValue(smsTemplateCoreService, "maxUpdateTime"); - assertEquals(max(smsTemplate01.getUpdateTime(), smsTemplate02.getUpdateTime()), maxUpdateTime); - } - - // ========== éšæœºå¯¹è±¡ ========== - - @SafeVarargs - private static SysSmsTemplateDO randomSmsTemplateDO(Consumer... consumers) { - Consumer consumer = (o) -> { - o.setStatus(randomEle(CommonStatusEnum.values()).getStatus()); // ä¿è¯ status 的范围 - o.setType(randomEle(SysSmsTemplateTypeEnum.values()).getType()); // ä¿è¯ type çš„ 范围 - }; - return randomPojo(SysSmsTemplateDO.class, ArrayUtils.append(consumer, consumers)); - } - -} diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/message/BpmMessageConvert.java b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/message/BpmMessageConvert.java index 7d7f1518f..469424e67 100644 --- a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/message/BpmMessageConvert.java +++ b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/message/BpmMessageConvert.java @@ -3,7 +3,7 @@ package cn.iocoder.yudao.adminserver.modules.bpm.convert.message; import cn.iocoder.yudao.adminserver.modules.bpm.service.message.dto.BpmMessageSendWhenProcessInstanceApproveReqDTO; import cn.iocoder.yudao.adminserver.modules.bpm.service.message.dto.BpmMessageSendWhenProcessInstanceRejectReqDTO; import cn.iocoder.yudao.adminserver.modules.bpm.service.message.dto.BpmMessageSendWhenTaskCreatedReqDTO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.SysUserDO; import org.activiti.api.task.model.Task; import org.activiti.engine.runtime.ProcessInstance; import org.mapstruct.Mapper; diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/task/BpmProcessInstanceConvert.java b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/task/BpmProcessInstanceConvert.java index e54e850b2..cd0839fe0 100644 --- a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/task/BpmProcessInstanceConvert.java +++ b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/task/BpmProcessInstanceConvert.java @@ -5,8 +5,8 @@ import cn.iocoder.yudao.adminserver.modules.bpm.controller.task.vo.instance.BpmP import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.definition.BpmProcessDefinitionExtDO; import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.task.BpmProcessInstanceExtDO; import cn.iocoder.yudao.adminserver.modules.bpm.framework.activiti.core.event.BpmProcessInstanceResultEvent; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysDeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.SysUserDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import org.activiti.engine.history.HistoricProcessInstance; import org.activiti.engine.repository.ProcessDefinition; diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/task/BpmTaskConvert.java b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/task/BpmTaskConvert.java index 424ae2517..117d2c1cf 100644 --- a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/task/BpmTaskConvert.java +++ b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/convert/task/BpmTaskConvert.java @@ -4,8 +4,8 @@ import cn.iocoder.yudao.adminserver.modules.bpm.controller.task.vo.task.BpmTaskD import cn.iocoder.yudao.adminserver.modules.bpm.controller.task.vo.task.BpmTaskRespVO; import cn.iocoder.yudao.adminserver.modules.bpm.controller.task.vo.task.BpmTaskTodoPageItemRespVO; import cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.task.BpmTaskExtDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysDeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.SysUserDO; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.framework.common.util.number.NumberUtils; import org.activiti.engine.history.HistoricProcessInstance; diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/dataobject/leave/BpmOALeaveDO.java b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/dataobject/leave/BpmOALeaveDO.java index 53f8b7d75..f5ce1a91e 100644 --- a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/dataobject/leave/BpmOALeaveDO.java +++ b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/dal/dataobject/leave/BpmOALeaveDO.java @@ -1,6 +1,6 @@ package cn.iocoder.yudao.adminserver.modules.bpm.dal.dataobject.leave; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.SysUserDO; import lombok.*; import java.util.*; import com.baomidou.mybatisplus.annotation.*; diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/message/BpmMessageEnum.java b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/message/BpmMessageEnum.java index 79afd41cb..e95764a79 100644 --- a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/message/BpmMessageEnum.java +++ b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/enums/message/BpmMessageEnum.java @@ -1,6 +1,6 @@ package cn.iocoder.yudao.adminserver.modules.bpm.enums.message; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsTemplateDO; +import cn.iocoder.yudao.module.system.dal.dataobject.sms.SysSmsTemplateDO; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/config/BpmActivitiConfiguration.java b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/config/BpmActivitiConfiguration.java index 2e1da6f4a..e7da58405 100644 --- a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/config/BpmActivitiConfiguration.java +++ b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/config/BpmActivitiConfiguration.java @@ -7,9 +7,9 @@ import cn.iocoder.yudao.adminserver.modules.bpm.framework.activiti.core.identity import cn.iocoder.yudao.adminserver.modules.bpm.framework.activiti.core.listener.BpmTackActivitiEventListener; import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmTaskAssignRuleService; import cn.iocoder.yudao.coreservice.modules.bpm.api.group.BpmUserGroupServiceApi; -import cn.iocoder.yudao.coreservice.modules.system.service.dept.SysDeptCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.permission.SysPermissionCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService; +import cn.iocoder.yudao.module.system.service.dept.SysDeptCoreService; +import cn.iocoder.yudao.module.system.service.permission.SysPermissionCoreService; +import cn.iocoder.yudao.module.system.service.user.SysUserCoreService; import org.activiti.api.runtime.shared.identity.UserGroupManager; import org.activiti.spring.boot.ProcessEngineConfigurationConfigurer; import org.springframework.context.ApplicationEventPublisher; diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/core/behavior/BpmActivityBehaviorFactory.java b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/core/behavior/BpmActivityBehaviorFactory.java index c426a23ee..bc3d95691 100644 --- a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/core/behavior/BpmActivityBehaviorFactory.java +++ b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/core/behavior/BpmActivityBehaviorFactory.java @@ -3,9 +3,9 @@ package cn.iocoder.yudao.adminserver.modules.bpm.framework.activiti.core.behavio import cn.iocoder.yudao.adminserver.modules.bpm.framework.activiti.core.behavior.script.BpmTaskAssignScript; import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmTaskAssignRuleService; import cn.iocoder.yudao.coreservice.modules.bpm.api.group.BpmUserGroupServiceApi; -import cn.iocoder.yudao.coreservice.modules.system.service.dept.SysDeptCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.permission.SysPermissionCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService; +import cn.iocoder.yudao.module.system.service.dept.SysDeptCoreService; +import cn.iocoder.yudao.module.system.service.permission.SysPermissionCoreService; +import cn.iocoder.yudao.module.system.service.user.SysUserCoreService; import lombok.Data; import lombok.EqualsAndHashCode; import lombok.Setter; diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/core/behavior/BpmUserTaskActivitiBehavior.java b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/core/behavior/BpmUserTaskActivitiBehavior.java index e2beba8e0..aa6cb1f13 100644 --- a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/core/behavior/BpmUserTaskActivitiBehavior.java +++ b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/core/behavior/BpmUserTaskActivitiBehavior.java @@ -9,11 +9,11 @@ import cn.iocoder.yudao.adminserver.modules.bpm.framework.activiti.core.behavior import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmTaskAssignRuleService; import cn.iocoder.yudao.coreservice.modules.bpm.api.group.BpmUserGroupServiceApi; import cn.iocoder.yudao.coreservice.modules.bpm.api.group.dto.BpmUserGroupDTO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; -import cn.iocoder.yudao.coreservice.modules.system.service.dept.SysDeptCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.permission.SysPermissionCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysDeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.SysUserDO; +import cn.iocoder.yudao.module.system.service.dept.SysDeptCoreService; +import cn.iocoder.yudao.module.system.service.permission.SysPermissionCoreService; +import cn.iocoder.yudao.module.system.service.user.SysUserCoreService; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import com.google.common.annotations.VisibleForTesting; import lombok.Setter; diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/core/behavior/script/impl/BpmTaskAssignLeaderAbstractScript.java b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/core/behavior/script/impl/BpmTaskAssignLeaderAbstractScript.java index eeb8b40bd..465be3b4a 100644 --- a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/core/behavior/script/impl/BpmTaskAssignLeaderAbstractScript.java +++ b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/core/behavior/script/impl/BpmTaskAssignLeaderAbstractScript.java @@ -2,17 +2,16 @@ package cn.iocoder.yudao.adminserver.modules.bpm.framework.activiti.core.behavio import cn.iocoder.yudao.adminserver.modules.bpm.framework.activiti.core.behavior.script.BpmTaskAssignScript; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; -import cn.iocoder.yudao.coreservice.modules.system.service.dept.SysDeptCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysDeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.SysUserDO; +import cn.iocoder.yudao.module.system.service.dept.SysDeptCoreService; +import cn.iocoder.yudao.module.system.service.user.SysUserCoreService; import org.activiti.engine.impl.persistence.entity.TaskEntity; import org.springframework.util.Assert; import javax.annotation.Resource; import java.util.Set; -import static cn.iocoder.yudao.framework.common.util.collection.SetUtils.asSet; import static java.util.Collections.emptySet; /** diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmTaskAssignRuleServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmTaskAssignRuleServiceImpl.java index dac572f1a..2364339ed 100644 --- a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmTaskAssignRuleServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/definition/impl/BpmTaskAssignRuleServiceImpl.java @@ -14,12 +14,12 @@ import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmModelServi import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmProcessDefinitionService; import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmTaskAssignRuleService; import cn.iocoder.yudao.coreservice.modules.bpm.api.group.BpmUserGroupServiceApi; -import cn.iocoder.yudao.coreservice.modules.system.enums.SysDictTypeConstants; -import cn.iocoder.yudao.coreservice.modules.system.service.dept.SysDeptCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.dept.SysPostCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.dict.SysDictDataCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.permission.SysRoleCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService; +import cn.iocoder.yudao.module.system.enums.SysDictTypeConstants; +import cn.iocoder.yudao.module.system.service.dept.SysDeptCoreService; +import cn.iocoder.yudao.module.system.service.dept.SysPostCoreService; +import cn.iocoder.yudao.module.system.service.dict.DictDataCoreService; +import cn.iocoder.yudao.module.system.service.permission.SysRoleCoreService; +import cn.iocoder.yudao.module.system.service.user.SysUserCoreService; import cn.iocoder.yudao.framework.activiti.core.util.ActivitiUtils; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; @@ -64,7 +64,7 @@ public class BpmTaskAssignRuleServiceImpl implements BpmTaskAssignRuleService { @Resource private BpmUserGroupServiceApi userGroupServiceApi; @Resource - private SysDictDataCoreService dictDataCoreService; + private DictDataCoreService dictDataCoreService; @Override public List getTaskAssignRuleListByProcessDefinitionId(String processDefinitionId, diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/message/impl/BpmMessageServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/message/impl/BpmMessageServiceImpl.java index c16fd476f..1c8829876 100644 --- a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/message/impl/BpmMessageServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/message/impl/BpmMessageServiceImpl.java @@ -5,7 +5,7 @@ import cn.iocoder.yudao.adminserver.modules.bpm.service.message.BpmMessageServic import cn.iocoder.yudao.adminserver.modules.bpm.service.message.dto.BpmMessageSendWhenProcessInstanceApproveReqDTO; import cn.iocoder.yudao.adminserver.modules.bpm.service.message.dto.BpmMessageSendWhenProcessInstanceRejectReqDTO; import cn.iocoder.yudao.adminserver.modules.bpm.service.message.dto.BpmMessageSendWhenTaskCreatedReqDTO; -import cn.iocoder.yudao.coreservice.modules.system.service.sms.SysSmsCoreService; +import cn.iocoder.yudao.module.system.service.sms.SysSmsCoreService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/impl/BpmProcessInstanceServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/impl/BpmProcessInstanceServiceImpl.java index 08d115b09..df4453783 100644 --- a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/impl/BpmProcessInstanceServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/impl/BpmProcessInstanceServiceImpl.java @@ -18,10 +18,10 @@ import cn.iocoder.yudao.adminserver.modules.bpm.service.message.BpmMessageServic import cn.iocoder.yudao.adminserver.modules.bpm.service.task.BpmProcessInstanceService; import cn.iocoder.yudao.adminserver.modules.bpm.service.task.BpmTaskService; import cn.iocoder.yudao.adminserver.modules.bpm.service.task.dto.BpmProcessInstanceCreateReqDTO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; -import cn.iocoder.yudao.coreservice.modules.system.service.dept.SysDeptCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysDeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.SysUserDO; +import cn.iocoder.yudao.module.system.service.dept.SysDeptCoreService; +import cn.iocoder.yudao.module.system.service.user.SysUserCoreService; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.number.NumberUtils; import lombok.extern.slf4j.Slf4j; diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/impl/BpmTaskServiceImpl.java b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/impl/BpmTaskServiceImpl.java index dfac6455e..5f97a2561 100644 --- a/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/impl/BpmTaskServiceImpl.java +++ b/yudao-module-bpm/yudao-module-bpm-activiti/src/main/java/cn/iocoder/yudao/adminserver/modules/bpm/service/task/impl/BpmTaskServiceImpl.java @@ -12,10 +12,10 @@ import cn.iocoder.yudao.adminserver.modules.bpm.service.message.BpmMessageServic import cn.iocoder.yudao.adminserver.modules.bpm.service.task.BpmProcessInstanceService; import cn.iocoder.yudao.adminserver.modules.bpm.service.task.BpmTaskService; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; -import cn.iocoder.yudao.coreservice.modules.system.service.dept.SysDeptCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysDeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.SysUserDO; +import cn.iocoder.yudao.module.system.service.dept.SysDeptCoreService; +import cn.iocoder.yudao.module.system.service.user.SysUserCoreService; import cn.iocoder.yudao.framework.activiti.core.util.ActivitiUtils; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.number.NumberUtils; diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/test/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/core/behavior/BpmUserTaskActivitiBehaviorTest.java b/yudao-module-bpm/yudao-module-bpm-activiti/src/test/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/core/behavior/BpmUserTaskActivitiBehaviorTest.java index b9b9a1475..082d9c948 100644 --- a/yudao-module-bpm/yudao-module-bpm-activiti/src/test/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/core/behavior/BpmUserTaskActivitiBehaviorTest.java +++ b/yudao-module-bpm/yudao-module-bpm-activiti/src/test/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/core/behavior/BpmUserTaskActivitiBehaviorTest.java @@ -8,11 +8,11 @@ import cn.iocoder.yudao.adminserver.modules.bpm.framework.activiti.core.behavior import cn.iocoder.yudao.adminserver.modules.bpm.service.definition.BpmTaskAssignRuleService; import cn.iocoder.yudao.coreservice.modules.bpm.api.group.BpmUserGroupServiceApi; import cn.iocoder.yudao.coreservice.modules.bpm.api.group.dto.BpmUserGroupDTO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; -import cn.iocoder.yudao.coreservice.modules.system.service.dept.SysDeptCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.permission.SysPermissionCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysDeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.SysUserDO; +import cn.iocoder.yudao.module.system.service.dept.SysDeptCoreService; +import cn.iocoder.yudao.module.system.service.permission.SysPermissionCoreService; +import cn.iocoder.yudao.module.system.service.user.SysUserCoreService; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest; diff --git a/yudao-module-bpm/yudao-module-bpm-activiti/src/test/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/core/behavior/script/impl/BpmTaskAssignLeaderX2ScriptTest.java b/yudao-module-bpm/yudao-module-bpm-activiti/src/test/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/core/behavior/script/impl/BpmTaskAssignLeaderX2ScriptTest.java index 2652524c0..bc0ab21e6 100644 --- a/yudao-module-bpm/yudao-module-bpm-activiti/src/test/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/core/behavior/script/impl/BpmTaskAssignLeaderX2ScriptTest.java +++ b/yudao-module-bpm/yudao-module-bpm-activiti/src/test/java/cn/iocoder/yudao/adminserver/modules/bpm/framework/activiti/core/behavior/script/impl/BpmTaskAssignLeaderX2ScriptTest.java @@ -1,9 +1,9 @@ package cn.iocoder.yudao.adminserver.modules.bpm.framework.activiti.core.behavior.script.impl; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; -import cn.iocoder.yudao.coreservice.modules.system.service.dept.SysDeptCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysDeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.SysUserDO; +import cn.iocoder.yudao.module.system.service.dept.SysDeptCoreService; +import cn.iocoder.yudao.module.system.service.user.SysUserCoreService; import cn.iocoder.yudao.framework.test.core.ut.BaseMockitoUnitTest; import org.activiti.engine.impl.persistence.entity.ExecutionEntityImpl; import org.activiti.engine.impl.persistence.entity.TaskEntity; diff --git a/yudao-module-member/yudao-module-member-impl/pom.xml b/yudao-module-member/yudao-module-member-impl/pom.xml index 37a4e7286..d3b6bd7ee 100644 --- a/yudao-module-member/yudao-module-member-impl/pom.xml +++ b/yudao-module-member/yudao-module-member-impl/pom.xml @@ -24,6 +24,12 @@ ${revision} + + cn.iocoder.boot + yudao-module-system-api + ${revision} + + cn.iocoder.boot diff --git a/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/auth/AppAuthController.java b/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/auth/AppAuthController.java index fd698e202..e2924b82a 100644 --- a/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/auth/AppAuthController.java +++ b/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/auth/AppAuthController.java @@ -1,11 +1,9 @@ package cn.iocoder.yudao.module.member.controller.app.auth; -import cn.iocoder.yudao.coreservice.modules.system.service.social.SysSocialCoreService; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated; -import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.module.member.controller.app.auth.vo.*; import cn.iocoder.yudao.module.member.service.auth.AuthService; import cn.iocoder.yudao.module.member.service.sms.SysSmsCodeService; @@ -15,7 +13,6 @@ import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; diff --git a/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/auth/vo/AppAuthSocialBindReqVO.java b/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/auth/vo/AppAuthSocialBindReqVO.java index 55e23ac4c..46ad9b627 100644 --- a/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/auth/vo/AppAuthSocialBindReqVO.java +++ b/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/auth/vo/AppAuthSocialBindReqVO.java @@ -1,6 +1,5 @@ package cn.iocoder.yudao.module.member.controller.app.auth.vo; -import cn.iocoder.yudao.coreservice.modules.system.enums.social.SysSocialTypeEnum; import cn.iocoder.yudao.framework.common.validation.InEnum; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/auth/vo/AppAuthSocialLogin2ReqVO.java b/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/auth/vo/AppAuthSocialLogin2ReqVO.java index d6bdaf009..b9a854ec1 100644 --- a/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/auth/vo/AppAuthSocialLogin2ReqVO.java +++ b/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/auth/vo/AppAuthSocialLogin2ReqVO.java @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.member.controller.app.auth.vo; -import cn.iocoder.yudao.coreservice.modules.system.enums.social.SysSocialTypeEnum; import cn.iocoder.yudao.framework.common.validation.InEnum; +import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; @@ -22,7 +22,7 @@ import javax.validation.constraints.Pattern; public class AppAuthSocialLogin2ReqVO { @ApiModelProperty(value = "社交平å°çš„类型", required = true, example = "10", notes = "å‚è§ SysUserSocialTypeEnum 枚举值") - @InEnum(SysSocialTypeEnum.class) + @InEnum(SocialTypeEnum.class) @NotNull(message = "社交平å°çš„类型ä¸èƒ½ä¸ºç©º") private Integer type; diff --git a/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/auth/vo/AppAuthSocialLoginReqVO.java b/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/auth/vo/AppAuthSocialLoginReqVO.java index b919bf275..e262765a9 100644 --- a/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/auth/vo/AppAuthSocialLoginReqVO.java +++ b/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/auth/vo/AppAuthSocialLoginReqVO.java @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.member.controller.app.auth.vo; -import cn.iocoder.yudao.coreservice.modules.system.enums.social.SysSocialTypeEnum; import cn.iocoder.yudao.framework.common.validation.InEnum; +import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; @@ -20,7 +20,7 @@ import javax.validation.constraints.NotNull; public class AppAuthSocialLoginReqVO { @ApiModelProperty(value = "社交平å°çš„类型", required = true, example = "10", notes = "å‚è§ SysUserSocialTypeEnum 枚举值") - @InEnum(SysSocialTypeEnum.class) + @InEnum(SocialTypeEnum.class) @NotNull(message = "社交平å°çš„类型ä¸èƒ½ä¸ºç©º") private Integer type; diff --git a/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/auth/vo/AppAuthSocialUnbindReqVO.java b/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/auth/vo/AppAuthSocialUnbindReqVO.java index ac4308e6a..245417820 100644 --- a/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/auth/vo/AppAuthSocialUnbindReqVO.java +++ b/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/controller/app/auth/vo/AppAuthSocialUnbindReqVO.java @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.member.controller.app.auth.vo; -import cn.iocoder.yudao.coreservice.modules.system.enums.social.SysSocialTypeEnum; import cn.iocoder.yudao.framework.common.validation.InEnum; +import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; @@ -20,7 +20,7 @@ import javax.validation.constraints.NotNull; public class AppAuthSocialUnbindReqVO { @ApiModelProperty(value = "社交平å°çš„类型", required = true, example = "10", notes = "å‚è§ SysUserSocialTypeEnum 枚举值") - @InEnum(SysSocialTypeEnum.class) + @InEnum(SocialTypeEnum.class) @NotNull(message = "社交平å°çš„类型ä¸èƒ½ä¸ºç©º") private Integer type; diff --git a/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/auth/AuthServiceImpl.java b/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/auth/AuthServiceImpl.java index dfeb7f040..0cf21d1a9 100644 --- a/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/auth/AuthServiceImpl.java +++ b/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/auth/AuthServiceImpl.java @@ -2,13 +2,13 @@ package cn.iocoder.yudao.module.member.service.auth; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.lang.Assert; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.social.SysSocialUserDO; -import cn.iocoder.yudao.coreservice.modules.system.enums.logger.SysLoginLogTypeEnum; -import cn.iocoder.yudao.coreservice.modules.system.enums.logger.SysLoginResultEnum; -import cn.iocoder.yudao.coreservice.modules.system.service.auth.SysUserSessionCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.logger.SysLoginLogCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.logger.dto.SysLoginLogCreateReqDTO; -import cn.iocoder.yudao.coreservice.modules.system.service.social.SysSocialCoreService; +import cn.iocoder.yudao.module.system.dal.dataobject.social.SysSocialUserDO; +import cn.iocoder.yudao.module.system.enums.logger.SysLoginLogTypeEnum; +import cn.iocoder.yudao.module.system.enums.logger.SysLoginResultEnum; +import cn.iocoder.yudao.module.system.service.auth.SysUserSessionCoreService; +import cn.iocoder.yudao.module.system.service.logger.SysLoginLogCoreService; +import cn.iocoder.yudao.module.system.service.logger.dto.SysLoginLogCreateReqDTO; +import cn.iocoder.yudao.module.system.service.social.SysSocialCoreService; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils; @@ -29,7 +29,6 @@ import org.springframework.context.annotation.Lazy; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.BadCredentialsException; import org.springframework.security.authentication.DisabledException; -import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; import org.springframework.security.core.userdetails.UserDetails; diff --git a/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/sms/SysSmsCodeServiceImpl.java b/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/sms/SysSmsCodeServiceImpl.java index 41049656d..b15f48568 100644 --- a/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/sms/SysSmsCodeServiceImpl.java +++ b/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/sms/SysSmsCodeServiceImpl.java @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.member.service.sms; import cn.hutool.core.map.MapUtil; -import cn.iocoder.yudao.coreservice.modules.system.service.sms.SysSmsCoreService; +import cn.iocoder.yudao.module.system.service.sms.SysSmsCoreService; import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; import cn.iocoder.yudao.module.member.dal.dataobject.sms.SysSmsCodeDO; import cn.iocoder.yudao.module.member.dal.dataobject.user.UserDO; diff --git a/yudao-module-member/yudao-module-member-impl/src/test/java/cn/iocoder/yudao/module/member/service/auth/SysAuthServiceTest.java b/yudao-module-member/yudao-module-member-impl/src/test/java/cn/iocoder/yudao/module/member/service/auth/SysAuthServiceTest.java index aa38ab936..93eb2878e 100644 --- a/yudao-module-member/yudao-module-member-impl/src/test/java/cn/iocoder/yudao/module/member/service/auth/SysAuthServiceTest.java +++ b/yudao-module-member/yudao-module-member-impl/src/test/java/cn/iocoder/yudao/module/member/service/auth/SysAuthServiceTest.java @@ -1,8 +1,8 @@ package cn.iocoder.yudao.module.member.service.auth; -import cn.iocoder.yudao.coreservice.modules.system.service.auth.SysUserSessionCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.logger.SysLoginLogCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.social.SysSocialCoreService; +import cn.iocoder.yudao.module.system.service.auth.SysUserSessionCoreService; +import cn.iocoder.yudao.module.system.service.logger.SysLoginLogCoreService; +import cn.iocoder.yudao.module.system.service.social.SysSocialCoreService; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java similarity index 100% rename from yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java rename to yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/ErrorCodeConstants.java diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/SysErrorCodeConstants.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/SysErrorCodeConstants.java similarity index 76% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/SysErrorCodeConstants.java rename to yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/SysErrorCodeConstants.java index e2dbf3417..218ef6d31 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/SysErrorCodeConstants.java +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/SysErrorCodeConstants.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.system.enums; +package cn.iocoder.yudao.module.system.enums; import cn.iocoder.yudao.framework.common.exception.ErrorCode; @@ -14,10 +14,6 @@ public interface SysErrorCodeConstants { ErrorCode SMS_SEND_MOBILE_TEMPLATE_PARAM_MISS = new ErrorCode(1006000001, "模æ¿å‚æ•°({})缺失"); ErrorCode SMS_SEND_TEMPLATE_NOT_EXISTS = new ErrorCode(1006000000, "短信模æ¿ä¸å­˜åœ¨"); - // ========= 文件相关 1006001000================= - ErrorCode FILE_PATH_EXISTS = new ErrorCode(1006001000, "文件路径已存在"); - ErrorCode FILE_NOT_EXISTS = new ErrorCode(1006001002, "文件ä¸å­˜åœ¨"); - // ========== ç¤¾äº¤æ¨¡å— 1006002000 ========== ErrorCode SOCIAL_AUTH_FAILURE = new ErrorCode(1006002000, "社交授æƒå¤±è´¥ï¼ŒåŽŸå› æ˜¯ï¼š{}"); ErrorCode SOCIAL_UNBIND_NOT_SELF = new ErrorCode(1006002001, "社交解绑失败,éžå½“å‰ç”¨æˆ·ç»‘定"); @@ -34,10 +30,6 @@ public interface SysErrorCodeConstants { ErrorCode ROLE_NOT_EXISTS = new ErrorCode(1006005000, "角色ä¸å­˜åœ¨"); ErrorCode ROLE_IS_DISABLE = new ErrorCode(1006005001, "å字为ã€{}】的角色已被ç¦ç”¨"); - // ========== 字典类型 1006006000 ========== - ErrorCode DICT_DATA_NOT_EXISTS = new ErrorCode(1006006000, "当å‰å­—典数æ®ä¸å­˜åœ¨"); - ErrorCode DICT_DATA_NOT_ENABLE = new ErrorCode(1006006001, "字典数æ®({})ä¸å¤„于开å¯çŠ¶æ€ï¼Œä¸å…许选择"); - // ========== å²—ä½æ¨¡å— 1006007000 ========== ErrorCode POST_NOT_FOUND = new ErrorCode(1006007000, "当å‰å²—ä½ä¸å­˜åœ¨"); ErrorCode POST_NOT_ENABLE = new ErrorCode(1006007001, "å²—ä½({}) ä¸å¤„于开å¯çŠ¶æ€ï¼Œä¸å…许选择"); diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/social/SysSocialTypeEnum.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/social/SocialTypeEnum.java similarity index 89% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/social/SysSocialTypeEnum.java rename to yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/social/SocialTypeEnum.java index 3dba5bda0..8744c3509 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/social/SysSocialTypeEnum.java +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/social/SocialTypeEnum.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.system.enums.social; +package cn.iocoder.yudao.module.system.enums.social; import cn.hutool.core.collection.ListUtil; import cn.hutool.core.util.ArrayUtil; @@ -16,7 +16,7 @@ import java.util.List; */ @Getter @AllArgsConstructor -public enum SysSocialTypeEnum implements IntArrayValuable { +public enum SocialTypeEnum implements IntArrayValuable { /** * Gitee @@ -51,7 +51,7 @@ public enum SysSocialTypeEnum implements IntArrayValuable { WECHAT_MINI_PROGRAM(33, "WECHAT_MINI_PROGRAM"), ; - public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(SysSocialTypeEnum::getType).toArray(); + public static final int[] ARRAYS = Arrays.stream(values()).mapToInt(SocialTypeEnum::getType).toArray(); public static final List WECHAT_ALL = ListUtil.toList(WECHAT_ENTERPRISE.type, WECHAT_MP.type, WECHAT_OPEN.type, WECHAT_MINI_PROGRAM.type); @@ -70,7 +70,7 @@ public enum SysSocialTypeEnum implements IntArrayValuable { return ARRAYS; } - public static SysSocialTypeEnum valueOfType(Integer type) { + public static SocialTypeEnum valueOfType(Integer type) { return ArrayUtil.firstMatch(o -> o.getType().equals(type), values()); } diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java index 6829c6ce9..6f72c3eb6 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/AuthController.java @@ -3,19 +3,19 @@ package cn.iocoder.yudao.module.system.controller.admin.auth; import cn.iocoder.yudao.module.system.controller.admin.auth.vo.auth.*; import cn.iocoder.yudao.module.system.convert.auth.AuthConvert; import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.permission.SysRoleDO; +import cn.iocoder.yudao.module.system.dal.dataobject.permission.SysRoleDO; import cn.iocoder.yudao.module.system.enums.permission.MenuTypeEnum; import cn.iocoder.yudao.module.system.service.auth.AuthService; import cn.iocoder.yudao.module.system.service.permission.PermissionService; import cn.iocoder.yudao.module.system.service.permission.RoleService; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; -import cn.iocoder.yudao.coreservice.modules.system.service.social.SysSocialCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService; +import cn.iocoder.yudao.module.system.dal.dataobject.user.UserDO; +import cn.iocoder.yudao.module.system.service.social.SocialUserService; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.util.collection.SetUtils; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import cn.iocoder.yudao.module.system.service.user.UserService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -45,14 +45,15 @@ public class AuthController { @Autowired @SuppressWarnings("SpringJavaAutowiredFieldsWarningInspection") // AuthService 存在é‡å private AuthService authService; - @Resource - private SysUserCoreService userCoreService; + @Autowired + @SuppressWarnings("SpringJavaAutowiredFieldsWarningInspection") // UserService 存在é‡å + private UserService userService; @Resource private RoleService roleService; @Resource private PermissionService permissionService; @Resource - private SysSocialCoreService socialCoreService; + private SocialUserService socialCoreService; @PostMapping("/login") @ApiOperation("使用账å·å¯†ç ç™»å½•") @@ -67,7 +68,7 @@ public class AuthController { @ApiOperation("获å–登录用户的æƒé™ä¿¡æ¯") public CommonResult getPermissionInfo() { // èŽ·å¾—ç”¨æˆ·ä¿¡æ¯ - SysUserDO user = userCoreService.getUser(getLoginUserId()); + UserDO user = userService.getUser(getLoginUserId()); if (user == null) { return null; } diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/UserSessionController.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/UserSessionController.java index 415e5b285..eeca9ac8e 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/UserSessionController.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/UserSessionController.java @@ -3,19 +3,19 @@ package cn.iocoder.yudao.module.system.controller.admin.auth; import cn.iocoder.yudao.module.system.controller.admin.auth.vo.session.UserSessionPageItemRespVO; import cn.iocoder.yudao.module.system.controller.admin.auth.vo.session.UserSessionPageReqVO; import cn.iocoder.yudao.module.system.convert.auth.UserSessionConvert; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysDeptDO; import cn.iocoder.yudao.module.system.service.auth.UserSessionService; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.auth.SysUserSessionDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; -import cn.iocoder.yudao.coreservice.modules.system.service.auth.SysUserSessionCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.dept.SysDeptCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService; +import cn.iocoder.yudao.module.system.dal.dataobject.auth.SysUserSessionDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.UserDO; +import cn.iocoder.yudao.module.system.service.dept.SysDeptCoreService; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.MapUtils; +import cn.iocoder.yudao.module.system.service.user.UserService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -35,10 +35,9 @@ public class UserSessionController { @Resource private UserSessionService userSessionService; - @Resource - private SysUserSessionCoreService userSessionCoreService; - @Resource - private SysUserCoreService userCoreService; + @Autowired + @SuppressWarnings("SpringJavaAutowiredFieldsWarningInspection") // UserService 存在é‡å + private UserService userService; @Resource private SysDeptCoreService deptCoreService; @@ -51,10 +50,10 @@ public class UserSessionController { PageResult pageResult = userSessionService.getUserSessionPage(reqVO); // 获得拼接需è¦çš„æ•°æ® - Map userMap = userCoreService.getUserMap( + Map userMap = userService.getUserMap( convertList(pageResult.getList(), SysUserSessionDO::getUserId)); Map deptMap = deptCoreService.getDeptMap( - convertList(userMap.values(), SysUserDO::getDeptId)); + convertList(userMap.values(), UserDO::getDeptId)); // 拼接结果返回 List sessionList = new ArrayList<>(pageResult.getList().size()); pageResult.getList().forEach(session -> { @@ -76,7 +75,7 @@ public class UserSessionController { example = "fe50b9f6-d177-44b1-8da9-72ea34f63db7") @PreAuthorize("@ss.hasPermission('system:user-session:delete')") public CommonResult deleteUserSession(@RequestParam("id") String id) { - userSessionCoreService.deleteUserSession(id); + userSessionService.deleteUserSession(id); return success(true); } diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthSocialBindReqVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthSocialBindReqVO.java index 3bb408c0b..5debf6b20 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthSocialBindReqVO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthSocialBindReqVO.java @@ -1,6 +1,6 @@ package cn.iocoder.yudao.module.system.controller.admin.auth.vo.auth; -import cn.iocoder.yudao.coreservice.modules.system.enums.social.SysSocialTypeEnum; +import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum; import cn.iocoder.yudao.framework.common.validation.InEnum; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -20,7 +20,7 @@ import javax.validation.constraints.NotNull; public class AuthSocialBindReqVO { @ApiModelProperty(value = "社交平å°çš„类型", required = true, example = "10", notes = "å‚è§ SysUserSocialTypeEnum 枚举值") - @InEnum(SysSocialTypeEnum.class) + @InEnum(SocialTypeEnum.class) @NotNull(message = "社交平å°çš„类型ä¸èƒ½ä¸ºç©º") private Integer type; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthSocialLogin2ReqVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthSocialLogin2ReqVO.java index 74955a6c5..90ce2cf88 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthSocialLogin2ReqVO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthSocialLogin2ReqVO.java @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.system.controller.admin.auth.vo.auth; -import cn.iocoder.yudao.coreservice.modules.system.enums.social.SysSocialTypeEnum; import cn.iocoder.yudao.framework.common.validation.InEnum; +import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; @@ -22,7 +22,7 @@ import javax.validation.constraints.Pattern; public class AuthSocialLogin2ReqVO { @ApiModelProperty(value = "社交平å°çš„类型", required = true, example = "10", notes = "å‚è§ SysUserSocialTypeEnum 枚举值") - @InEnum(SysSocialTypeEnum.class) + @InEnum(SocialTypeEnum.class) @NotNull(message = "社交平å°çš„类型ä¸èƒ½ä¸ºç©º") private Integer type; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthSocialLoginReqVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthSocialLoginReqVO.java index 4f7b8d76d..bc1247d67 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthSocialLoginReqVO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthSocialLoginReqVO.java @@ -1,6 +1,6 @@ package cn.iocoder.yudao.module.system.controller.admin.auth.vo.auth; -import cn.iocoder.yudao.coreservice.modules.system.enums.social.SysSocialTypeEnum; +import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum; import cn.iocoder.yudao.framework.common.validation.InEnum; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -20,7 +20,7 @@ import javax.validation.constraints.NotNull; public class AuthSocialLoginReqVO { @ApiModelProperty(value = "社交平å°çš„类型", required = true, example = "10", notes = "å‚è§ SysUserSocialTypeEnum 枚举值") - @InEnum(SysSocialTypeEnum.class) + @InEnum(SocialTypeEnum.class) @NotNull(message = "社交平å°çš„类型ä¸èƒ½ä¸ºç©º") private Integer type; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthSocialUnbindReqVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthSocialUnbindReqVO.java index b16f1ef77..eb43a2d27 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthSocialUnbindReqVO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/auth/vo/auth/AuthSocialUnbindReqVO.java @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.system.controller.admin.auth.vo.auth; -import cn.iocoder.yudao.coreservice.modules.system.enums.social.SysSocialTypeEnum; import cn.iocoder.yudao.framework.common.validation.InEnum; +import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.AllArgsConstructor; @@ -20,7 +20,7 @@ import javax.validation.constraints.NotNull; public class AuthSocialUnbindReqVO { @ApiModelProperty(value = "社交平å°çš„类型", required = true, example = "10", notes = "å‚è§ SysUserSocialTypeEnum 枚举值") - @InEnum(SysSocialTypeEnum.class) + @InEnum(SocialTypeEnum.class) @NotNull(message = "社交平å°çš„类型ä¸èƒ½ä¸ºç©º") private Integer type; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/DeptController.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/DeptController.java index 2459736a5..837a825ee 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/DeptController.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/DeptController.java @@ -1,11 +1,11 @@ package cn.iocoder.yudao.module.system.controller.admin.dept; -import cn.iocoder.yudao.coreservice.modules.system.service.dept.SysDeptCoreService; +import cn.iocoder.yudao.module.system.service.dept.SysDeptCoreService; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.*; import cn.iocoder.yudao.module.system.convert.dept.DeptConvert; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysDeptDO; import cn.iocoder.yudao.module.system.service.dept.DeptService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/PostController.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/PostController.java index 9191ce25f..e5b179e32 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/PostController.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/PostController.java @@ -7,7 +7,7 @@ import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.*; import cn.iocoder.yudao.module.system.convert.dept.PostConvert; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysPostDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysPostDO; import cn.iocoder.yudao.module.system.service.dept.PostService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/vo/post/PostExcelVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/vo/post/PostExcelVO.java index b9c2696df..0053a7895 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/vo/post/PostExcelVO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dept/vo/post/PostExcelVO.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.system.controller.admin.dept.vo.post; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; -import cn.iocoder.yudao.coreservice.modules.system.enums.SysDictTypeConstants; +import cn.iocoder.yudao.module.system.enums.DictTypeConstants; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; @@ -25,7 +25,7 @@ public class PostExcelVO { private Integer sort; @ExcelProperty(value = "状æ€", converter = DictConvert.class) - @DictFormat(SysDictTypeConstants.COMMON_STATUS) + @DictFormat(DictTypeConstants.COMMON_STATUS) private String status; } diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/DictDataController.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/DictDataController.java index 81d7cc247..08fca2c47 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/DictDataController.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/DictDataController.java @@ -1,6 +1,6 @@ package cn.iocoder.yudao.module.system.controller.admin.dict; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dict.SysDictDataDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dict.SysDictDataDO; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/vo/data/DictDataExcelVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/vo/data/DictDataExcelVO.java index ee907eaa7..6dcb9bb50 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/vo/data/DictDataExcelVO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/vo/data/DictDataExcelVO.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.system.controller.admin.dict.vo.data; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; -import cn.iocoder.yudao.coreservice.modules.system.enums.SysDictTypeConstants; +import cn.iocoder.yudao.module.system.enums.DictTypeConstants; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; @@ -28,7 +28,7 @@ public class DictDataExcelVO { private String dictType; @ExcelProperty(value = "状æ€", converter = DictConvert.class) - @DictFormat(SysDictTypeConstants.COMMON_STATUS) + @DictFormat(DictTypeConstants.COMMON_STATUS) private Integer status; } diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/vo/type/DictTypeExcelVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/vo/type/DictTypeExcelVO.java index fbda72b2e..b7db46d0e 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/vo/type/DictTypeExcelVO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/dict/vo/type/DictTypeExcelVO.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.system.controller.admin.dict.vo.type; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; -import cn.iocoder.yudao.coreservice.modules.system.enums.SysDictTypeConstants; +import cn.iocoder.yudao.module.system.enums.DictTypeConstants; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; @@ -22,7 +22,7 @@ public class DictTypeExcelVO { private String type; @ExcelProperty(value = "状æ€", converter = DictConvert.class) - @DictFormat(SysDictTypeConstants.COMMON_STATUS) + @DictFormat(DictTypeConstants.COMMON_STATUS) private Integer status; } diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/LoginLogController.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/LoginLogController.java index ad7816835..9890247c8 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/LoginLogController.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/LoginLogController.java @@ -1,6 +1,6 @@ package cn.iocoder.yudao.module.system.controller.admin.logger; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.logger.SysLoginLogDO; +import cn.iocoder.yudao.module.system.dal.dataobject.logger.SysLoginLogDO; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/OperateLogController.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/OperateLogController.java index 2eca78fc1..935b48baf 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/OperateLogController.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/OperateLogController.java @@ -7,16 +7,17 @@ import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.Oper import cn.iocoder.yudao.module.system.convert.logger.OperateLogConvert; import cn.iocoder.yudao.module.system.dal.dataobject.logger.OperateLogDO; import cn.iocoder.yudao.module.system.service.logger.OperateLogService; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; -import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService; +import cn.iocoder.yudao.module.system.dal.dataobject.user.UserDO; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.framework.common.util.collection.MapUtils; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; +import cn.iocoder.yudao.module.system.service.user.UserService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; @@ -43,8 +44,9 @@ public class OperateLogController { @Resource private OperateLogService operateLogService; - @Resource - private SysUserCoreService userCoreService; + @Autowired + @SuppressWarnings("SpringJavaAutowiredFieldsWarningInspection") // UserService 存在é‡å + private UserService userService; @GetMapping("/page") @ApiOperation("查看æ“作日志分页列表") @@ -54,7 +56,7 @@ public class OperateLogController { // 获得拼接需è¦çš„æ•°æ® Collection userIds = CollectionUtils.convertList(pageResult.getList(), OperateLogDO::getUserId); - Map userMap = userCoreService.getUserMap(userIds); + Map userMap = userService.getUserMap(userIds); // æ‹¼æŽ¥æ•°æ® List list = new ArrayList<>(pageResult.getList().size()); pageResult.getList().forEach(operateLog -> { @@ -75,7 +77,7 @@ public class OperateLogController { // 获得拼接需è¦çš„æ•°æ® Collection userIds = CollectionUtils.convertList(list, OperateLogDO::getUserId); - Map userMap = userCoreService.getUserMap(userIds); + Map userMap = userService.getUserMap(userIds); // æ‹¼æŽ¥æ•°æ® List excelDataList = OperateLogConvert.INSTANCE.convertList(list, userMap); // 输出 diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/loginlog/LoginLogExcelVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/loginlog/LoginLogExcelVO.java index 2a16454fc..300cd088d 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/loginlog/LoginLogExcelVO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/loginlog/LoginLogExcelVO.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.system.controller.admin.logger.vo.loginlog; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; -import cn.iocoder.yudao.coreservice.modules.system.enums.SysDictTypeConstants; +import cn.iocoder.yudao.module.system.enums.DictTypeConstants; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; @@ -21,11 +21,11 @@ public class LoginLogExcelVO { private String username; @ExcelProperty(value = "日志类型", converter = DictConvert.class) - @DictFormat(SysDictTypeConstants.LOGIN_TYPE) + @DictFormat(DictTypeConstants.LOGIN_TYPE) private Integer logType; @ExcelProperty(value = "登录结果", converter = DictConvert.class) - @DictFormat(SysDictTypeConstants.LOGIN_RESULT) + @DictFormat(DictTypeConstants.LOGIN_RESULT) private Integer result; @ExcelProperty("登录 IP") diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/operatelog/OperateLogExcelVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/operatelog/OperateLogExcelVO.java index 40546b2d9..7f38cfc79 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/operatelog/OperateLogExcelVO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/logger/vo/operatelog/OperateLogExcelVO.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; -import cn.iocoder.yudao.coreservice.modules.system.enums.SysDictTypeConstants; +import cn.iocoder.yudao.module.system.enums.DictTypeConstants; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; @@ -24,7 +24,7 @@ public class OperateLogExcelVO { private String name; @ExcelProperty(value = "æ“作类型", converter = DictConvert.class) - @DictFormat(SysDictTypeConstants.OPERATE_TYPE) + @DictFormat(DictTypeConstants.OPERATE_TYPE) private String type; @ExcelProperty("æ“作人") diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/RoleController.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/RoleController.java index ac7dce635..54cdb6b53 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/RoleController.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/RoleController.java @@ -7,7 +7,7 @@ import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.*; import cn.iocoder.yudao.module.system.convert.permission.RoleConvert; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.permission.SysRoleDO; +import cn.iocoder.yudao.module.system.dal.dataobject.permission.SysRoleDO; import cn.iocoder.yudao.module.system.service.permission.RoleService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/vo/role/RoleExcelVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/vo/role/RoleExcelVO.java index bb82f4ab1..d22cf9bf2 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/vo/role/RoleExcelVO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/permission/vo/role/RoleExcelVO.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.system.controller.admin.permission.vo.role; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; -import cn.iocoder.yudao.coreservice.modules.system.enums.SysDictTypeConstants; +import cn.iocoder.yudao.module.system.enums.DictTypeConstants; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; @@ -28,7 +28,7 @@ public class RoleExcelVO { private Integer dataScope; @ExcelProperty(value = "角色状æ€", converter = DictConvert.class) - @DictFormat(SysDictTypeConstants.COMMON_STATUS) + @DictFormat(DictTypeConstants.COMMON_STATUS) private String status; } diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/SmsCallbackController.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/SmsCallbackController.java index f13f188c4..6e2602cf0 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/SmsCallbackController.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/SmsCallbackController.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.system.controller.admin.sms; import cn.hutool.core.util.URLUtil; import cn.hutool.extra.servlet.ServletUtil; -import cn.iocoder.yudao.coreservice.modules.system.service.sms.SysSmsCoreService; +import cn.iocoder.yudao.module.system.service.sms.SysSmsSendService; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; import cn.iocoder.yudao.framework.sms.core.enums.SmsChannelEnum; @@ -25,7 +25,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; public class SmsCallbackController { @Resource - private SysSmsCoreService smsCoreService; + private SysSmsSendService smsCoreService; @PostMapping("/sms/yunpian") @ApiOperation(value = "云片短信的回调", notes = "å‚è§ https://www.yunpian.com/official/document/sms/zh_cn/domestic_push_report 文档") diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/SmsChannelController.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/SmsChannelController.java index 86c9eee6e..4774fcf59 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/SmsChannelController.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/SmsChannelController.java @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.system.controller.admin.sms; import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.*; import cn.iocoder.yudao.module.system.convert.sms.SmsChannelConvert; import cn.iocoder.yudao.module.system.service.sms.SmsChannelService; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsChannelDO; +import cn.iocoder.yudao.module.system.dal.dataobject.sms.SysSmsChannelDO; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import io.swagger.annotations.Api; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/SmsLogController.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/SmsLogController.java index 557e6d31e..ef93cfc3d 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/SmsLogController.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/SmsLogController.java @@ -6,7 +6,7 @@ import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogPageReqV import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SysSmsLogRespVO; import cn.iocoder.yudao.module.system.convert.sms.SmsLogConvert; import cn.iocoder.yudao.module.system.service.sms.SmsLogService; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsLogDO; +import cn.iocoder.yudao.module.system.dal.dataobject.sms.SysSmsLogDO; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/SmsTemplateController.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/SmsTemplateController.java index 2d0adc427..f16bfb2c9 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/SmsTemplateController.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/SmsTemplateController.java @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.system.controller.admin.sms; import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.*; import cn.iocoder.yudao.module.system.convert.sms.SmsTemplateConvert; import cn.iocoder.yudao.module.system.service.sms.SmsTemplateService; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsTemplateDO; -import cn.iocoder.yudao.coreservice.modules.system.service.sms.SysSmsCoreService; +import cn.iocoder.yudao.module.system.dal.dataobject.sms.SysSmsTemplateDO; +import cn.iocoder.yudao.module.system.service.sms.SysSmsSendService; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; @@ -32,7 +32,7 @@ public class SmsTemplateController { @Resource private SmsTemplateService smsTemplateService; @Resource - private SysSmsCoreService smsCoreService; + private SysSmsSendService smsCoreService; @PostMapping("/create") @ApiOperation("创建短信模æ¿") diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/log/SmsLogExcelVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/log/SmsLogExcelVO.java index 9fb8515df..f638f58fc 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/log/SmsLogExcelVO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/log/SmsLogExcelVO.java @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.system.controller.admin.sms.vo.log; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; import cn.iocoder.yudao.framework.excel.core.convert.JsonConvert; -import cn.iocoder.yudao.coreservice.modules.system.enums.SysDictTypeConstants; +import cn.iocoder.yudao.module.system.enums.DictTypeConstants; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; @@ -34,7 +34,7 @@ public class SmsLogExcelVO { private String templateCode; @ExcelProperty(value = "短信类型", converter = DictConvert.class) - @DictFormat(SysDictTypeConstants.SMS_TEMPLATE_TYPE) + @DictFormat(DictTypeConstants.SMS_TEMPLATE_TYPE) private Integer templateType; @ExcelProperty("短信内容") @@ -53,11 +53,11 @@ public class SmsLogExcelVO { private Long userId; @ExcelProperty(value = "用户类型", converter = DictConvert.class) - @DictFormat(SysDictTypeConstants.USER_TYPE) + @DictFormat(DictTypeConstants.USER_TYPE) private Integer userType; @ExcelProperty(value = "å‘é€çŠ¶æ€", converter = DictConvert.class) - @DictFormat(SysDictTypeConstants.SMS_SEND_STATUS) + @DictFormat(DictTypeConstants.SMS_SEND_STATUS) private Integer sendStatus; @ExcelProperty("å‘é€æ—¶é—´") @@ -82,7 +82,7 @@ public class SmsLogExcelVO { private String apiSerialNo; @ExcelProperty(value = "接收状æ€", converter = DictConvert.class) - @DictFormat(SysDictTypeConstants.SMS_RECEIVE_STATUS) + @DictFormat(DictTypeConstants.SMS_RECEIVE_STATUS) private Integer receiveStatus; @ExcelProperty("接收时间") diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/template/SmsTemplateExcelVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/template/SmsTemplateExcelVO.java index eb28c63cb..a640a93c1 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/template/SmsTemplateExcelVO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/sms/vo/template/SmsTemplateExcelVO.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.system.controller.admin.sms.vo.template; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; -import cn.iocoder.yudao.coreservice.modules.system.enums.SysDictTypeConstants; +import cn.iocoder.yudao.module.system.enums.DictTypeConstants; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; @@ -20,11 +20,11 @@ public class SmsTemplateExcelVO { private Long id; @ExcelProperty(value = "短信签å", converter = DictConvert.class) - @DictFormat(SysDictTypeConstants.SMS_TEMPLATE_TYPE) + @DictFormat(DictTypeConstants.SMS_TEMPLATE_TYPE) private Integer type; @ExcelProperty(value = "å¼€å¯çŠ¶æ€", converter = DictConvert.class) - @DictFormat(SysDictTypeConstants.COMMON_STATUS) + @DictFormat(DictTypeConstants.COMMON_STATUS) private Integer status; @ExcelProperty("模æ¿ç¼–ç ") @@ -46,7 +46,7 @@ public class SmsTemplateExcelVO { private Long channelId; @ExcelProperty(value = "短信渠é“ç¼–ç ", converter = DictConvert.class) - @DictFormat(SysDictTypeConstants.SMS_CHANNEL_CODE) + @DictFormat(DictTypeConstants.SMS_CHANNEL_CODE) private String channelCode; @ExcelProperty("创建时间") diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/TenantController.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/TenantController.java index 2b5fc204c..bd2fcb430 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/TenantController.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenant/TenantController.java @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.system.controller.admin.tenant; import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.*; import cn.iocoder.yudao.module.system.convert.tenant.TenantConvert; import cn.iocoder.yudao.module.system.service.tenant.TenantService; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.tenant.SysTenantDO; +import cn.iocoder.yudao.module.system.dal.dataobject.tenant.SysTenantDO; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java index ddf19aec8..61c54e293 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserController.java @@ -3,12 +3,11 @@ package cn.iocoder.yudao.module.system.controller.admin.user; import cn.hutool.core.collection.CollUtil; import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.*; import cn.iocoder.yudao.module.system.convert.user.UserConvert; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysDeptDO; import cn.iocoder.yudao.module.system.service.user.UserService; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; -import cn.iocoder.yudao.coreservice.modules.system.enums.common.SysSexEnum; -import cn.iocoder.yudao.coreservice.modules.system.service.dept.SysDeptCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService; +import cn.iocoder.yudao.module.system.dal.dataobject.user.UserDO; +import cn.iocoder.yudao.module.system.enums.common.SysSexEnum; +import cn.iocoder.yudao.module.system.service.dept.SysDeptCoreService; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; @@ -19,6 +18,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; @@ -41,11 +41,10 @@ import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.E @Validated public class UserController { - @Resource + @Autowired + @SuppressWarnings("SpringJavaAutowiredFieldsWarningInspection") // UserService 存在é‡å private UserService userService; @Resource - private SysUserCoreService userCoreService; - @Resource private SysDeptCoreService deptCoreService; @PostMapping("/create") @@ -94,13 +93,13 @@ public class UserController { @PreAuthorize("@ss.hasPermission('system:user:list')") public CommonResult> getUserPage(@Valid UserPageReqVO reqVO) { // 获得用户分页列表 - PageResult pageResult = userService.getUserPage(reqVO); + PageResult pageResult = userService.getUserPage(reqVO); if (CollUtil.isEmpty(pageResult.getList())) { return success(new PageResult<>(pageResult.getTotal())); // 返回空 } // 获得拼接需è¦çš„æ•°æ® - Collection deptIds = convertList(pageResult.getList(), SysUserDO::getDeptId); + Collection deptIds = convertList(pageResult.getList(), UserDO::getDeptId); Map deptMap = deptCoreService.getDeptMap(deptIds); // 拼接结果返回 List userList = new ArrayList<>(pageResult.getList().size()); @@ -116,7 +115,7 @@ public class UserController { @ApiOperation(value = "获å–用户精简信æ¯åˆ—表", notes = "åªåŒ…å«è¢«å¼€å¯çš„用户,主è¦ç”¨äºŽå‰ç«¯çš„下拉选项") public CommonResult> getSimpleUsers() { // 获用户门列表,åªè¦å¼€å¯çŠ¶æ€çš„ - List list = userService.getUsersByStatus(CommonStatusEnum.ENABLE.getStatus()); + List list = userService.getUsersByStatus(CommonStatusEnum.ENABLE.getStatus()); // 排åºåŽï¼Œè¿”回给å‰ç«¯ return success(UserConvert.INSTANCE.convertList04(list)); } @@ -126,7 +125,7 @@ public class UserController { @ApiImplicitParam(name = "id", value = "ç¼–å·", required = true, example = "1024", dataTypeClass = Long.class) @PreAuthorize("@ss.hasPermission('system:user:query')") public CommonResult getInfo(@RequestParam("id") Long id) { - return success(UserConvert.INSTANCE.convert(userCoreService.getUser(id))); + return success(UserConvert.INSTANCE.convert(userService.getUser(id))); } @GetMapping("/export") @@ -136,12 +135,13 @@ public class UserController { public void exportUsers(@Validated UserExportReqVO reqVO, HttpServletResponse response) throws IOException { // 获得用户列表 - List users = userService.getUsers(reqVO); + List users = userService.getUsers(reqVO); // 获得拼接需è¦çš„æ•°æ® - Collection deptIds = convertList(users, SysUserDO::getDeptId); + Collection deptIds = convertList(users, UserDO::getDeptId); Map deptMap = deptCoreService.getDeptMap(deptIds); - Map deptLeaderUserMap = userCoreService.getUserMap(convertSet(deptMap.values(), SysDeptDO::getLeaderUserId)); + Map deptLeaderUserMap = userService.getUserMap( + convertSet(deptMap.values(), SysDeptDO::getLeaderUserId)); // æ‹¼æŽ¥æ•°æ® List excelUsers = new ArrayList<>(users.size()); users.forEach(user -> { diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserProfileController.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserProfileController.java index 4745b2f5b..ffb6b0d1c 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserProfileController.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/UserProfileController.java @@ -9,20 +9,20 @@ import cn.iocoder.yudao.module.system.service.dept.PostService; import cn.iocoder.yudao.module.system.service.permission.PermissionService; import cn.iocoder.yudao.module.system.service.permission.RoleService; import cn.iocoder.yudao.module.system.service.user.UserService; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysPostDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.permission.SysRoleDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.social.SysSocialUserDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; -import cn.iocoder.yudao.coreservice.modules.system.service.dept.SysDeptCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.social.SysSocialCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysDeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysPostDO; +import cn.iocoder.yudao.module.system.dal.dataobject.permission.SysRoleDO; +import cn.iocoder.yudao.module.system.dal.dataobject.social.SysSocialUserDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.UserDO; +import cn.iocoder.yudao.module.system.service.dept.SysDeptCoreService; +import cn.iocoder.yudao.module.system.service.social.SocialUserService; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -43,11 +43,10 @@ import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUti @Slf4j public class UserProfileController { - @Resource + @Autowired + @SuppressWarnings("SpringJavaAutowiredFieldsWarningInspection") // UserService 存在é‡å private UserService userService; @Resource - private SysUserCoreService userCoreService; - @Resource private SysDeptCoreService deptCoreService; @Resource @@ -57,13 +56,13 @@ public class UserProfileController { @Resource private RoleService roleService; @Resource - private SysSocialCoreService socialService; + private SocialUserService socialService; @GetMapping("/get") @ApiOperation("获得登录用户信æ¯") public CommonResult profile() { // èŽ·å¾—ç”¨æˆ·åŸºæœ¬ä¿¡æ¯ - SysUserDO user = userCoreService.getUser(getLoginUserId()); + UserDO user = userService.getUser(getLoginUserId()); UserProfileRespVO resp = UserConvert.INSTANCE.convert03(user); // 获得用户角色 List userRoles = roleService.getRolesFromCache(permissionService.getUserRoleIdListByUserId(user.getId())); diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserExcelVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserExcelVO.java index b67010ca6..a9163cb6c 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserExcelVO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserExcelVO.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.system.controller.admin.user.vo.user; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; -import cn.iocoder.yudao.coreservice.modules.system.enums.SysDictTypeConstants; +import cn.iocoder.yudao.module.system.enums.DictTypeConstants; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; @@ -30,11 +30,11 @@ public class UserExcelVO { private String mobile; @ExcelProperty(value = "用户性别", converter = DictConvert.class) - @DictFormat(SysDictTypeConstants.USER_SEX) + @DictFormat(DictTypeConstants.USER_SEX) private Integer sex; @ExcelProperty(value = "å¸å·çŠ¶æ€", converter = DictConvert.class) - @DictFormat(SysDictTypeConstants.COMMON_STATUS) + @DictFormat(DictTypeConstants.COMMON_STATUS) private Integer status; @ExcelProperty("最åŽç™»å½•IP") diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserImportExcelVO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserImportExcelVO.java index b2e084af0..a360f1af2 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserImportExcelVO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/user/vo/user/UserImportExcelVO.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.system.controller.admin.user.vo.user; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; -import cn.iocoder.yudao.coreservice.modules.system.enums.SysDictTypeConstants; +import cn.iocoder.yudao.module.system.enums.DictTypeConstants; import com.alibaba.excel.annotation.ExcelProperty; import lombok.AllArgsConstructor; import lombok.Builder; @@ -36,11 +36,11 @@ public class UserImportExcelVO { private String mobile; @ExcelProperty(value = "用户性别", converter = DictConvert.class) - @DictFormat(SysDictTypeConstants.USER_SEX) + @DictFormat(DictTypeConstants.USER_SEX) private Integer sex; @ExcelProperty(value = "è´¦å·çŠ¶æ€", converter = DictConvert.class) - @DictFormat(SysDictTypeConstants.COMMON_STATUS) + @DictFormat(DictTypeConstants.COMMON_STATUS) private Integer status; } diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/auth/AuthConvert.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/auth/AuthConvert.java index be76b5fdd..14310514d 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/auth/AuthConvert.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/auth/AuthConvert.java @@ -3,9 +3,9 @@ package cn.iocoder.yudao.module.system.convert.auth; import cn.iocoder.yudao.module.system.controller.admin.auth.vo.auth.AuthMenuRespVO; import cn.iocoder.yudao.module.system.controller.admin.auth.vo.auth.AuthPermissionInfoRespVO; import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.permission.SysRoleDO; +import cn.iocoder.yudao.module.system.dal.dataobject.permission.SysRoleDO; import cn.iocoder.yudao.module.system.enums.permission.MenuIdEnum; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.UserDO; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.framework.security.core.LoginUser; @@ -22,14 +22,14 @@ public interface AuthConvert { AuthConvert INSTANCE = Mappers.getMapper(AuthConvert.class); @Mapping(source = "updateTime", target = "updateTime", ignore = true) // 字段相åŒï¼Œä½†æ˜¯å«ä¹‰ä¸åŒï¼Œå¿½ç•¥ - LoginUser convert0(SysUserDO bean); + LoginUser convert0(UserDO bean); - default LoginUser convert(SysUserDO bean) { + default LoginUser convert(UserDO bean) { // 目的,为了设置 UserTypeEnum.ADMIN.getValue() return convert0(bean).setUserType(UserTypeEnum.ADMIN.getValue()); } - default AuthPermissionInfoRespVO convert(SysUserDO user, List roleList, List menuList) { + default AuthPermissionInfoRespVO convert(UserDO user, List roleList, List menuList) { return AuthPermissionInfoRespVO.builder() .user(AuthPermissionInfoRespVO.UserVO.builder().id(user.getId()).nickname(user.getNickname()).avatar(user.getAvatar()).build()) .roles(CollectionUtils.convertSet(roleList, SysRoleDO::getCode)) diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/auth/UserSessionConvert.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/auth/UserSessionConvert.java index 37cec9ee4..b287d8adc 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/auth/UserSessionConvert.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/auth/UserSessionConvert.java @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.system.convert.auth; import cn.iocoder.yudao.module.system.controller.admin.auth.vo.session.UserSessionPageItemRespVO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.auth.SysUserSessionDO; +import cn.iocoder.yudao.module.system.dal.dataobject.auth.SysUserSessionDO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/dept/DeptConvert.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/dept/DeptConvert.java index 2d1c4d6c1..cd66acd9f 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/dept/DeptConvert.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/dept/DeptConvert.java @@ -4,7 +4,7 @@ import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptCreateRe import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptRespVO; import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptSimpleRespVO; import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptUpdateReqVO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysDeptDO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/dept/PostConvert.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/dept/PostConvert.java index 99af8b91a..d3680dae5 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/dept/PostConvert.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/dept/PostConvert.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.system.convert.dept; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.*; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysPostDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysPostDO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/dict/DictDataConvert.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/dict/DictDataConvert.java index 33958c325..94f67657f 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/dict/DictDataConvert.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/dict/DictDataConvert.java @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.system.convert.dict; import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.*; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dict.SysDictDataDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dict.SysDictDataDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO; import org.mapstruct.Mapper; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/convert/dict/SysDictDataCoreConvert.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/dict/SysDictDataCoreConvert.java similarity index 74% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/convert/dict/SysDictDataCoreConvert.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/dict/SysDictDataCoreConvert.java index e68e165d3..c61d654cf 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/convert/dict/SysDictDataCoreConvert.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/dict/SysDictDataCoreConvert.java @@ -1,6 +1,6 @@ -package cn.iocoder.yudao.coreservice.modules.system.convert.dict; +package cn.iocoder.yudao.module.system.convert.dict; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dict.SysDictDataDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dict.SysDictDataDO; import cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/logger/LoginLogConvert.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/logger/LoginLogConvert.java index 3d375b004..3208276cc 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/logger/LoginLogConvert.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/logger/LoginLogConvert.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.system.convert.logger; import cn.iocoder.yudao.module.system.controller.admin.logger.vo.loginlog.LoginLogExcelVO; import cn.iocoder.yudao.module.system.controller.admin.logger.vo.loginlog.LoginLogRespVO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.logger.SysLoginLogDO; +import cn.iocoder.yudao.module.system.dal.dataobject.logger.SysLoginLogDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/logger/OperateLogConvert.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/logger/OperateLogConvert.java index bc5cd690e..1c2261afd 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/logger/OperateLogConvert.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/logger/OperateLogConvert.java @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.system.convert.logger; import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.OperateLogExcelVO; import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.OperateLogRespVO; import cn.iocoder.yudao.module.system.dal.dataobject.logger.OperateLogDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.UserDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.MapUtils; import cn.iocoder.yudao.framework.operatelog.core.dto.OperateLogCreateReqDTO; @@ -27,7 +27,7 @@ public interface OperateLogConvert { OperateLogRespVO convert(OperateLogDO bean); - default List convertList(List list, Map userMap) { + default List convertList(List list, Map userMap) { return list.stream().map(operateLog -> { OperateLogExcelVO excelVO = convert02(operateLog); MapUtils.findAndThen(userMap, operateLog.getId(), user -> excelVO.setUserNickname(user.getNickname())); diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/logger/SysLoginLogCoreConvert.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/logger/SysLoginLogCoreConvert.java new file mode 100644 index 000000000..bfdeea7e8 --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/logger/SysLoginLogCoreConvert.java @@ -0,0 +1,15 @@ +package cn.iocoder.yudao.module.system.convert.logger; + +import cn.iocoder.yudao.module.system.dal.dataobject.logger.SysLoginLogDO; +import cn.iocoder.yudao.module.system.service.logger.dto.LoginLogCreateReqDTO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +@Mapper +public interface SysLoginLogCoreConvert { + + SysLoginLogCoreConvert INSTANCE = Mappers.getMapper(SysLoginLogCoreConvert.class); + + SysLoginLogDO convert(LoginLogCreateReqDTO bean); + +} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/permission/RoleConvert.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/permission/RoleConvert.java index c9e1098ae..5dcbf12fc 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/permission/RoleConvert.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/permission/RoleConvert.java @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.system.convert.permission; import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.*; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.permission.SysRoleDO; +import cn.iocoder.yudao.module.system.dal.dataobject.permission.SysRoleDO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/sms/SmsChannelConvert.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/sms/SmsChannelConvert.java index 3885b7a1c..6979ed002 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/sms/SmsChannelConvert.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/sms/SmsChannelConvert.java @@ -4,7 +4,7 @@ import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannel import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelRespVO; import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelSimpleRespVO; import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelUpdateReqVO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsChannelDO; +import cn.iocoder.yudao.module.system.dal.dataobject.sms.SysSmsChannelDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.sms.core.property.SmsChannelProperties; import org.mapstruct.Mapper; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/sms/SmsLogConvert.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/sms/SmsLogConvert.java index f5110b371..425ac3197 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/sms/SmsLogConvert.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/sms/SmsLogConvert.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.system.convert.sms; import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogExcelVO; import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SysSmsLogRespVO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsLogDO; +import cn.iocoder.yudao.module.system.dal.dataobject.sms.SysSmsLogDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/sms/SmsTemplateConvert.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/sms/SmsTemplateConvert.java index bc83e1e85..8cca0f01f 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/sms/SmsTemplateConvert.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/sms/SmsTemplateConvert.java @@ -4,7 +4,7 @@ import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTempla import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateExcelVO; import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateRespVO; import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateUpdateReqVO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsTemplateDO; +import cn.iocoder.yudao.module.system.dal.dataobject.sms.SysSmsTemplateDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/tenant/TenantConvert.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/tenant/TenantConvert.java index 62e28b469..53de4517a 100755 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/tenant/TenantConvert.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/tenant/TenantConvert.java @@ -4,7 +4,7 @@ import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.TenantCreateReq import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.TenantExcelVO; import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.TenantRespVO; import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.TenantUpdateReqVO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.tenant.SysTenantDO; +import cn.iocoder.yudao.module.system.dal.dataobject.tenant.SysTenantDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/user/UserConvert.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/user/UserConvert.java index e57cb8648..10d4b16d6 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/user/UserConvert.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/convert/user/UserConvert.java @@ -4,11 +4,11 @@ import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfi import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.*; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysPostDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.permission.SysRoleDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.social.SysSocialUserDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysDeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysPostDO; +import cn.iocoder.yudao.module.system.dal.dataobject.permission.SysRoleDO; +import cn.iocoder.yudao.module.system.dal.dataobject.social.SysSocialUserDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.UserDO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; @@ -19,31 +19,31 @@ public interface UserConvert { UserConvert INSTANCE = Mappers.getMapper(UserConvert.class); - UserPageItemRespVO convert(SysUserDO bean); + UserPageItemRespVO convert(UserDO bean); UserPageItemRespVO.Dept convert(SysDeptDO bean); - SysUserDO convert(UserCreateReqVO bean); + UserDO convert(UserCreateReqVO bean); - SysUserDO convert(UserUpdateReqVO bean); + UserDO convert(UserUpdateReqVO bean); - UserExcelVO convert02(SysUserDO bean); + UserExcelVO convert02(UserDO bean); - SysUserDO convert(UserImportExcelVO bean); + UserDO convert(UserImportExcelVO bean); - UserProfileRespVO convert03(SysUserDO bean); + UserProfileRespVO convert03(UserDO bean); List convertList(List list); UserProfileRespVO.Dept convert02(SysDeptDO bean); - SysUserDO convert(UserProfileUpdateReqVO bean); + UserDO convert(UserProfileUpdateReqVO bean); - SysUserDO convert(UserProfileUpdatePasswordReqVO bean); + UserDO convert(UserProfileUpdatePasswordReqVO bean); List convertList02(List list); List convertList03(List list); - List convertList04(List list); + List convertList04(List list); } diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/auth/SysUserSessionDO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/auth/SysUserSessionDO.java similarity index 95% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/auth/SysUserSessionDO.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/auth/SysUserSessionDO.java index d30d38491..9de10295b 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/auth/SysUserSessionDO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/auth/SysUserSessionDO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.auth; +package cn.iocoder.yudao.module.system.dal.dataobject.auth; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.security.core.LoginUser; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/dept/SysDeptDO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/dept/SysDeptDO.java similarity index 84% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/dept/SysDeptDO.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/dept/SysDeptDO.java index ced8296da..797dfa206 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/dept/SysDeptDO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/dept/SysDeptDO.java @@ -1,6 +1,6 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept; +package cn.iocoder.yudao.module.system.dal.dataobject.dept; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.UserDO; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; import com.baomidou.mybatisplus.annotation.TableId; @@ -41,7 +41,7 @@ public class SysDeptDO extends TenantBaseDO { /** * 负责人 * - * å…³è” {@link SysUserDO#getId()} + * å…³è” {@link UserDO#getId()} */ private Long leaderUserId; /** diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/dept/SysPostDO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/dept/SysPostDO.java similarity index 92% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/dept/SysPostDO.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/dept/SysPostDO.java index 6e47b1da4..233ba361b 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/dept/SysPostDO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/dept/SysPostDO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept; +package cn.iocoder.yudao.module.system.dal.dataobject.dept; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/dict/SysDictDataDO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/dict/SysDictDataDO.java similarity index 93% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/dict/SysDictDataDO.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/dict/SysDictDataDO.java index d398d5ef3..fe12ce472 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/dict/SysDictDataDO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/dict/SysDictDataDO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dict; +package cn.iocoder.yudao.module.system.dal.dataobject.dict; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/logger/OperateLogDO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/logger/OperateLogDO.java index ec799ec46..5c12f825c 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/logger/OperateLogDO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/logger/OperateLogDO.java @@ -1,6 +1,6 @@ package cn.iocoder.yudao.module.system.dal.dataobject.logger; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.UserDO; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum; import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; @@ -48,7 +48,7 @@ public class OperateLogDO extends TenantBaseDO { /** * ç”¨æˆ·ç¼–å· * - * {@link SysUserDO#getId()} + * {@link UserDO#getId()} */ private Long userId; /** diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/logger/SysLoginLogDO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/logger/SysLoginLogDO.java similarity index 83% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/logger/SysLoginLogDO.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/logger/SysLoginLogDO.java index e7e7a4144..0a1518646 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/logger/SysLoginLogDO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/logger/SysLoginLogDO.java @@ -1,9 +1,9 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.logger; +package cn.iocoder.yudao.module.system.dal.dataobject.logger; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; -import cn.iocoder.yudao.coreservice.modules.system.enums.logger.SysLoginLogTypeEnum; -import cn.iocoder.yudao.coreservice.modules.system.enums.logger.SysLoginResultEnum; +import cn.iocoder.yudao.module.system.enums.logger.SysLoginLogTypeEnum; +import cn.iocoder.yudao.module.system.enums.logger.SysLoginResultEnum; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.EqualsAndHashCode; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/package-info.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/package-info.java new file mode 100644 index 000000000..000c252fc --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/package-info.java @@ -0,0 +1 @@ +package cn.iocoder.yudao.module.system.dal.dataobject; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/permission/SysRoleDO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/permission/SysRoleDO.java similarity index 95% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/permission/SysRoleDO.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/permission/SysRoleDO.java index c27f588ab..6b2d3eb9a 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/permission/SysRoleDO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/permission/SysRoleDO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.permission; +package cn.iocoder.yudao.module.system.dal.dataobject.permission; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/permission/SysUserRoleDO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/permission/SysUserRoleDO.java similarity index 88% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/permission/SysUserRoleDO.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/permission/SysUserRoleDO.java index ac18d8c9c..9c298ad9d 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/permission/SysUserRoleDO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/permission/SysUserRoleDO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.permission; +package cn.iocoder.yudao.module.system.dal.dataobject.permission; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import com.baomidou.mybatisplus.annotation.TableId; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/sms/SysSmsChannelDO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/sms/SysSmsChannelDO.java similarity index 94% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/sms/SysSmsChannelDO.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/sms/SysSmsChannelDO.java index 87b67cd7f..57fe9789e 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/sms/SysSmsChannelDO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/sms/SysSmsChannelDO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms; +package cn.iocoder.yudao.module.system.dal.dataobject.sms; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/sms/SysSmsLogDO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/sms/SysSmsLogDO.java similarity index 94% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/sms/SysSmsLogDO.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/sms/SysSmsLogDO.java index 6567ee215..a6daa0c74 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/sms/SysSmsLogDO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/sms/SysSmsLogDO.java @@ -1,7 +1,7 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms; +package cn.iocoder.yudao.module.system.dal.dataobject.sms; -import cn.iocoder.yudao.coreservice.modules.system.enums.sms.SysSmsReceiveStatusEnum; -import cn.iocoder.yudao.coreservice.modules.system.enums.sms.SysSmsSendStatusEnum; +import cn.iocoder.yudao.module.system.enums.sms.SysSmsReceiveStatusEnum; +import cn.iocoder.yudao.module.system.enums.sms.SysSmsSendStatusEnum; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.sms.core.enums.SmsFrameworkErrorCodeConstants; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/sms/SysSmsTemplateDO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/sms/SysSmsTemplateDO.java similarity index 92% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/sms/SysSmsTemplateDO.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/sms/SysSmsTemplateDO.java index 9e1dd35c7..72fcafcd9 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/sms/SysSmsTemplateDO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/sms/SysSmsTemplateDO.java @@ -1,6 +1,6 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms; +package cn.iocoder.yudao.module.system.dal.dataobject.sms; -import cn.iocoder.yudao.coreservice.modules.system.enums.sms.SysSmsTemplateTypeEnum; +import cn.iocoder.yudao.module.system.enums.sms.SysSmsTemplateTypeEnum; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import com.baomidou.mybatisplus.annotation.TableField; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/social/SysSocialUserDO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/social/SysSocialUserDO.java similarity index 90% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/social/SysSocialUserDO.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/social/SysSocialUserDO.java index d1772a132..336211ed1 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/social/SysSocialUserDO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/social/SysSocialUserDO.java @@ -1,6 +1,6 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.social; +package cn.iocoder.yudao.module.system.dal.dataobject.social; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.UserDO; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import com.baomidou.mybatisplus.annotation.TableId; @@ -9,7 +9,7 @@ import lombok.*; /** * 社交用户 - * 通过 {@link SysSocialUserDO#getUserId()} å…³è”到对应的 {@link SysUserDO} + * 通过 {@link SysSocialUserDO#getUserId()} å…³è”到对应的 {@link UserDO} * * @author weir */ diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/tenant/SysTenantDO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/tenant/SysTenantDO.java similarity index 91% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/tenant/SysTenantDO.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/tenant/SysTenantDO.java index c0b5298c8..ebff2004c 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/tenant/SysTenantDO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/tenant/SysTenantDO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.tenant; +package cn.iocoder.yudao.module.system.dal.dataobject.tenant; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/user/SysUserDO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/user/UserDO.java similarity index 90% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/user/SysUserDO.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/user/UserDO.java index bb5e6854c..0f9d6e3f3 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/dataobject/user/SysUserDO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/user/UserDO.java @@ -1,6 +1,6 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user; +package cn.iocoder.yudao.module.system.dal.dataobject.user; -import cn.iocoder.yudao.coreservice.modules.system.enums.common.SysSexEnum; +import cn.iocoder.yudao.module.system.enums.common.SysSexEnum; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.mybatis.core.type.JsonLongSetTypeHandler; import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; @@ -24,7 +24,7 @@ import java.util.Set; @Builder @NoArgsConstructor @AllArgsConstructor -public class SysUserDO extends TenantBaseDO { +public class UserDO extends TenantBaseDO { /** * 用户ID diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/auth/SysUserSessionCoreMapper.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/auth/SysUserSessionCoreMapper.java similarity index 56% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/auth/SysUserSessionCoreMapper.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/auth/SysUserSessionCoreMapper.java index 69b5c5acb..a589d1e9e 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/auth/SysUserSessionCoreMapper.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/auth/SysUserSessionCoreMapper.java @@ -1,6 +1,6 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.mysql.auth; +package cn.iocoder.yudao.module.system.dal.mysql.auth; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.auth.SysUserSessionDO; +import cn.iocoder.yudao.module.system.dal.dataobject.auth.SysUserSessionDO; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import org.apache.ibatis.annotations.Mapper; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/auth/SysUserSessionMapper.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/auth/SysUserSessionMapper.java index 7d231be88..23e0ba1e5 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/auth/SysUserSessionMapper.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/auth/SysUserSessionMapper.java @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.system.dal.mysql.auth; import cn.iocoder.yudao.module.system.controller.admin.auth.vo.session.UserSessionPageReqVO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.auth.SysUserSessionDO; +import cn.iocoder.yudao.module.system.dal.dataobject.auth.SysUserSessionDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/dept/SysDeptCoreMapper.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dept/SysDeptCoreMapper.java similarity index 56% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/dept/SysDeptCoreMapper.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dept/SysDeptCoreMapper.java index ab98c6512..489733bbf 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/dept/SysDeptCoreMapper.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dept/SysDeptCoreMapper.java @@ -1,6 +1,6 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.mysql.dept; +package cn.iocoder.yudao.module.system.dal.mysql.dept; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysDeptDO; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import org.apache.ibatis.annotations.Mapper; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dept/SysDeptMapper.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dept/SysDeptMapper.java index 0bd2d024c..e2d0678e7 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dept/SysDeptMapper.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dept/SysDeptMapper.java @@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.mybatis.core.enums.SqlConstants; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptListReqVO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysDeptDO; import com.baomidou.mybatisplus.annotation.InterceptorIgnore; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.apache.ibatis.annotations.Mapper; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/dept/SysPostCoreMapper.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dept/SysPostCoreMapper.java similarity index 56% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/dept/SysPostCoreMapper.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dept/SysPostCoreMapper.java index 94a4747e9..5ce2d2152 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/dept/SysPostCoreMapper.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dept/SysPostCoreMapper.java @@ -1,6 +1,6 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.mysql.dept; +package cn.iocoder.yudao.module.system.dal.mysql.dept; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysPostDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysPostDO; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import org.apache.ibatis.annotations.Mapper; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dept/SysPostMapper.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dept/SysPostMapper.java index b3657d1f4..1a5665863 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dept/SysPostMapper.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dept/SysPostMapper.java @@ -5,7 +5,7 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostExportReqVO; import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostPageReqVO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysPostDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysPostDO; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.apache.ibatis.annotations.Mapper; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dict/SysDictDataMapper.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dict/SysDictDataMapper.java index c8abca94b..602a77342 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dict/SysDictDataMapper.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/dict/SysDictDataMapper.java @@ -3,11 +3,12 @@ package cn.iocoder.yudao.module.system.dal.mysql.dict; import cn.iocoder.yudao.framework.mybatis.core.enums.SqlConstants; import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataExportReqVO; import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataPageReqVO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dict.SysDictDataDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dict.SysDictDataDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.apache.ibatis.annotations.Mapper; import java.util.Arrays; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/logger/LoginLogMapper.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/logger/LoginLogMapper.java index f26023388..8473caccf 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/logger/LoginLogMapper.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/logger/LoginLogMapper.java @@ -1,6 +1,6 @@ package cn.iocoder.yudao.module.system.dal.mysql.logger; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.logger.SysLoginLogDO; +import cn.iocoder.yudao.module.system.dal.dataobject.logger.SysLoginLogDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/logger/SysLoginLogCoreMapper.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/logger/SysLoginLogCoreMapper.java similarity index 55% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/logger/SysLoginLogCoreMapper.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/logger/SysLoginLogCoreMapper.java index e6dd1ff51..6ef40e834 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/logger/SysLoginLogCoreMapper.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/logger/SysLoginLogCoreMapper.java @@ -1,6 +1,6 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.mysql.logger; +package cn.iocoder.yudao.module.system.dal.mysql.logger; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.logger.SysLoginLogDO; +import cn.iocoder.yudao.module.system.dal.dataobject.logger.SysLoginLogDO; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import org.apache.ibatis.annotations.Mapper; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/package-info.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/package-info.java new file mode 100644 index 000000000..b47bbaac1 --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/package-info.java @@ -0,0 +1 @@ +package cn.iocoder.yudao.module.system.dal.mysql; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/permission/SysRoleCoreMapper.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/SysRoleCoreMapper.java similarity index 54% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/permission/SysRoleCoreMapper.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/SysRoleCoreMapper.java index 69196d8f7..51c3cb2ee 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/permission/SysRoleCoreMapper.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/SysRoleCoreMapper.java @@ -1,6 +1,6 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.mysql.permission; +package cn.iocoder.yudao.module.system.dal.mysql.permission; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.permission.SysRoleDO; +import cn.iocoder.yudao.module.system.dal.dataobject.permission.SysRoleDO; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import org.apache.ibatis.annotations.Mapper; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/SysRoleMapper.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/SysRoleMapper.java index 45af3afad..659f11588 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/SysRoleMapper.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/SysRoleMapper.java @@ -5,7 +5,7 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RoleExportReqVO; import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RolePageReqVO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.permission.SysRoleDO; +import cn.iocoder.yudao.module.system.dal.dataobject.permission.SysRoleDO; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.apache.ibatis.annotations.Mapper; import org.springframework.lang.Nullable; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/permission/SysUserRoleCoreMapper.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/SysUserRoleCoreMapper.java similarity index 70% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/permission/SysUserRoleCoreMapper.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/SysUserRoleCoreMapper.java index 1327efde9..6139498e6 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/permission/SysUserRoleCoreMapper.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/SysUserRoleCoreMapper.java @@ -1,6 +1,6 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.mysql.permission; +package cn.iocoder.yudao.module.system.dal.mysql.permission; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.permission.SysUserRoleDO; +import cn.iocoder.yudao.module.system.dal.dataobject.permission.SysUserRoleDO; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import org.apache.ibatis.annotations.Mapper; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/SysUserRoleMapper.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/SysUserRoleMapper.java index 71b25f2d1..6578515bd 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/SysUserRoleMapper.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/permission/SysUserRoleMapper.java @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.system.dal.mysql.permission; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.permission.SysUserRoleDO; +import cn.iocoder.yudao.module.system.dal.dataobject.permission.SysUserRoleDO; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.apache.ibatis.annotations.Mapper; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sms/SysSmsChannelMapper.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sms/SysSmsChannelMapper.java index 8d183fcb9..49a7d9f40 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sms/SysSmsChannelMapper.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sms/SysSmsChannelMapper.java @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.system.dal.mysql.sms; import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelPageReqVO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsChannelDO; +import cn.iocoder.yudao.module.system.dal.dataobject.sms.SysSmsChannelDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sms/SysSmsLogMapper.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sms/SysSmsLogMapper.java index ffed02912..86f54dc24 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sms/SysSmsLogMapper.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sms/SysSmsLogMapper.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.system.dal.mysql.sms; import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogExportReqVO; import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogPageReqVO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsLogDO; +import cn.iocoder.yudao.module.system.dal.dataobject.sms.SysSmsLogDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.QueryWrapperX; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sms/SysSmsTemplateMapper.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sms/SysSmsTemplateMapper.java index a2559bd47..c4ba4071a 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sms/SysSmsTemplateMapper.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/sms/SysSmsTemplateMapper.java @@ -1,23 +1,27 @@ package cn.iocoder.yudao.module.system.dal.mysql.sms; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateExportReqVO; import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplatePageReqVO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsTemplateDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.system.dal.dataobject.sms.SysSmsTemplateDO; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Select; +import java.util.Date; import java.util.List; @Mapper public interface SysSmsTemplateMapper extends BaseMapperX { + @Select("SELECT id FROM sys_sms_template WHERE update_time > #{maxUpdateTime} LIMIT 1") + Long selectExistsByUpdateTimeAfter(Date maxUpdateTime); + default SysSmsTemplateDO selectByCode(String code) { return selectOne(SysSmsTemplateDO::getCode, code); } - // TODO è¿™ç§å‚数都一样的得想办法å°è£…一下 default PageResult selectPage(SmsTemplatePageReqVO reqVO) { return selectPage(reqVO, new LambdaQueryWrapperX() .eqIfPresent(SysSmsTemplateDO::getType, reqVO.getType()) diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/social/SysSocialUserCoreMapper.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/social/SysSocialUserMapper.java similarity index 80% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/social/SysSocialUserCoreMapper.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/social/SysSocialUserMapper.java index 727c38e67..dc92ddb30 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/social/SysSocialUserCoreMapper.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/social/SysSocialUserMapper.java @@ -1,6 +1,6 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.mysql.social; +package cn.iocoder.yudao.module.system.dal.mysql.social; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.social.SysSocialUserDO; +import cn.iocoder.yudao.module.system.dal.dataobject.social.SysSocialUserDO; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.apache.ibatis.annotations.Mapper; @@ -9,7 +9,7 @@ import java.util.Collection; import java.util.List; @Mapper -public interface SysSocialUserCoreMapper extends BaseMapperX { +public interface SysSocialUserMapper extends BaseMapperX { default List selectListByTypeAndUnionId(Integer userType, Collection types, String unionId) { return selectList(new QueryWrapper().eq("user_type", userType) diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/tenant/SysTenantCoreMapper.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenant/SysTenantCoreMapper.java similarity index 55% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/tenant/SysTenantCoreMapper.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenant/SysTenantCoreMapper.java index 197f893fa..de7656f40 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/mysql/tenant/SysTenantCoreMapper.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenant/SysTenantCoreMapper.java @@ -1,6 +1,6 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.mysql.tenant; +package cn.iocoder.yudao.module.system.dal.mysql.tenant; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.tenant.SysTenantDO; +import cn.iocoder.yudao.module.system.dal.dataobject.tenant.SysTenantDO; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import org.apache.ibatis.annotations.Mapper; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenant/SysTenantMapper.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenant/SysTenantMapper.java index d92f660f9..f913d625d 100755 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenant/SysTenantMapper.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/tenant/SysTenantMapper.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.system.dal.mysql.tenant; import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.TenantExportReqVO; import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.TenantPageReqVO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.tenant.SysTenantDO; +import cn.iocoder.yudao.module.system.dal.dataobject.tenant.SysTenantDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/SysUserMapper.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/SysUserMapper.java deleted file mode 100644 index 1d7eb74bf..000000000 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/SysUserMapper.java +++ /dev/null @@ -1,77 +0,0 @@ -package cn.iocoder.yudao.module.system.dal.mysql.user; - -import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserExportReqVO; -import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; -import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; -import jodd.util.StringPool; -import org.apache.ibatis.annotations.Mapper; - -import java.util.Collection; -import java.util.List; -import java.util.Optional; - -@Mapper -public interface SysUserMapper extends BaseMapperX { - - default SysUserDO selectByUsername(String username) { - return selectOne(new LambdaQueryWrapper().eq(SysUserDO::getUsername, username)); - } - - default SysUserDO selectByEmail(String email) { - return selectOne(new LambdaQueryWrapper().eq(SysUserDO::getEmail, email)); - } - - default SysUserDO selectByMobile(String mobile) { - return selectOne(new LambdaQueryWrapper().eq(SysUserDO::getMobile, mobile)); - } - - default PageResult selectPage(UserPageReqVO reqVO, Collection deptIds) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .likeIfPresent(SysUserDO::getUsername, reqVO.getUsername()) - .likeIfPresent(SysUserDO::getMobile, reqVO.getMobile()) - .eqIfPresent(SysUserDO::getStatus, reqVO.getStatus()) - .betweenIfPresent(SysUserDO::getCreateTime, reqVO.getBeginTime(), reqVO.getEndTime()) - .inIfPresent(SysUserDO::getDeptId, deptIds)); - } - - default List selectList(UserExportReqVO reqVO, Collection deptIds) { - return selectList(new LambdaQueryWrapperX() - .likeIfPresent(SysUserDO::getUsername, reqVO.getUsername()) - .likeIfPresent(SysUserDO::getMobile, reqVO.getMobile()) - .eqIfPresent(SysUserDO::getStatus, reqVO.getStatus()) - .betweenIfPresent(SysUserDO::getCreateTime, reqVO.getBeginTime(), reqVO.getEndTime()) - .inIfPresent(SysUserDO::getDeptId, deptIds)); - } - - default List selectListByNickname(String nickname) { - return selectList(new LambdaQueryWrapperX().like(SysUserDO::getNickname, nickname)); - } - - default List selectListByUsername(String username) { - return selectList(new LambdaQueryWrapperX().like(SysUserDO::getUsername, username)); - } - - // TODO 芋艿:å¯åºŸå¼ƒè¯¥æ–¹æ³• - default List selectListByDepartIdAndPostId(Long departId, Long postId) { - return selectList(new LambdaQueryWrapperX() - .eq(SysUserDO::getStatus, CommonStatusEnum.ENABLE.getStatus()) - .eq(SysUserDO::getDeptId, departId) - // TODO @jason: å°è£…一个 StringUtils .toString 。如果空的时候,设置为 nullã€‚ä¼šæ›´ç®€æ´ - .likeIfPresent(SysUserDO::getPostIds, Optional.ofNullable(postId).map(t -> String.valueOf(postId)).orElse(StringPool.EMPTY))); - } - - default List selectListByStatus(Integer status) { - return selectList(SysUserDO::getStatus, status); - } - - default List selectListByDeptIds(Collection deptIds) { - return selectList(SysUserDO::getDeptId, deptIds); - } - -} - diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/UserMapper.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/UserMapper.java new file mode 100644 index 000000000..7cd0fe426 --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/mysql/user/UserMapper.java @@ -0,0 +1,68 @@ +package cn.iocoder.yudao.module.system.dal.mysql.user; + +import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserExportReqVO; +import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.UserPageReqVO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.UserDO; +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import jodd.util.StringPool; +import org.apache.ibatis.annotations.Mapper; + +import java.util.Collection; +import java.util.List; +import java.util.Optional; + +@Mapper +public interface UserMapper extends BaseMapperX { + + default UserDO selectByUsername(String username) { + return selectOne(new LambdaQueryWrapper().eq(UserDO::getUsername, username)); + } + + default UserDO selectByEmail(String email) { + return selectOne(new LambdaQueryWrapper().eq(UserDO::getEmail, email)); + } + + default UserDO selectByMobile(String mobile) { + return selectOne(new LambdaQueryWrapper().eq(UserDO::getMobile, mobile)); + } + + default PageResult selectPage(UserPageReqVO reqVO, Collection deptIds) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(UserDO::getUsername, reqVO.getUsername()) + .likeIfPresent(UserDO::getMobile, reqVO.getMobile()) + .eqIfPresent(UserDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(UserDO::getCreateTime, reqVO.getBeginTime(), reqVO.getEndTime()) + .inIfPresent(UserDO::getDeptId, deptIds)); + } + + default List selectList(UserExportReqVO reqVO, Collection deptIds) { + return selectList(new LambdaQueryWrapperX() + .likeIfPresent(UserDO::getUsername, reqVO.getUsername()) + .likeIfPresent(UserDO::getMobile, reqVO.getMobile()) + .eqIfPresent(UserDO::getStatus, reqVO.getStatus()) + .betweenIfPresent(UserDO::getCreateTime, reqVO.getBeginTime(), reqVO.getEndTime()) + .inIfPresent(UserDO::getDeptId, deptIds)); + } + + default List selectListByNickname(String nickname) { + return selectList(new LambdaQueryWrapperX().like(UserDO::getNickname, nickname)); + } + + default List selectListByUsername(String username) { + return selectList(new LambdaQueryWrapperX().like(UserDO::getUsername, username)); + } + + default List selectListByStatus(Integer status) { + return selectList(UserDO::getStatus, status); + } + + default List selectListByDeptIds(Collection deptIds) { + return selectList(UserDO::getDeptId, deptIds); + } + +} + diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/redis/SysRedisKeyConstants.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/redis/SysRedisKeyConstants.java index 16baa4638..78b1ca24f 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/redis/SysRedisKeyConstants.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/redis/SysRedisKeyConstants.java @@ -1,6 +1,10 @@ package cn.iocoder.yudao.module.system.dal.redis; import cn.iocoder.yudao.framework.redis.core.RedisKeyDefine; +import cn.iocoder.yudao.framework.security.core.LoginUser; +import me.zhyd.oauth.model.AuthUser; + +import java.time.Duration; import static cn.iocoder.yudao.framework.redis.core.RedisKeyDefine.KeyTypeEnum.STRING; @@ -14,5 +18,17 @@ public interface SysRedisKeyConstants { RedisKeyDefine CAPTCHA_CODE = new RedisKeyDefine("验è¯ç çš„缓存", "captcha_code:%s", // å‚数为 uuid STRING, String.class, RedisKeyDefine.TimeoutTypeEnum.DYNAMIC); + + RedisKeyDefine LOGIN_USER = new RedisKeyDefine("登录用户的缓存", + "login_user:%s", // å‚数为 sessionId + STRING, LoginUser.class, RedisKeyDefine.TimeoutTypeEnum.DYNAMIC); + + RedisKeyDefine SOCIAL_AUTH_USER = new RedisKeyDefine("社交登陆的授æƒç”¨æˆ·", + "social_auth_user:%d:%s", // å‚数为 type,code + STRING, AuthUser.class, Duration.ofDays(1)); + + RedisKeyDefine SOCIAL_AUTH_STATE = new RedisKeyDefine("社交登陆的 state", + "social_auth_state:%s", // å‚数为 state + STRING, String.class, Duration.ofHours(24)); // 值为 state } diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/redis/SysRedisKeyCoreConstants.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/redis/SysRedisKeyCoreConstants.java new file mode 100644 index 000000000..735adcc91 --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/redis/SysRedisKeyCoreConstants.java @@ -0,0 +1,18 @@ +package cn.iocoder.yudao.module.system.dal.redis; + +import cn.iocoder.yudao.framework.redis.core.RedisKeyDefine; +import cn.iocoder.yudao.framework.security.core.LoginUser; +import me.zhyd.oauth.model.AuthUser; + +import java.time.Duration; + +import static cn.iocoder.yudao.framework.redis.core.RedisKeyDefine.KeyTypeEnum.STRING; + +/** + * System Redis Key 枚举类 + * + * @author 芋é“æºç  + */ +public interface SysRedisKeyCoreConstants { + +} diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/redis/auth/SysLoginUserCoreRedisDAO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/redis/auth/LoginUserRedisDAO.java similarity index 85% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/redis/auth/SysLoginUserCoreRedisDAO.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/redis/auth/LoginUserRedisDAO.java index 921492c9d..ead1d0287 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/redis/auth/SysLoginUserCoreRedisDAO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/redis/auth/LoginUserRedisDAO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.redis.auth; +package cn.iocoder.yudao.module.system.dal.redis.auth; import cn.iocoder.yudao.framework.common.util.json.JsonUtils; import cn.iocoder.yudao.framework.security.config.SecurityProperties; @@ -8,7 +8,7 @@ import org.springframework.stereotype.Repository; import javax.annotation.Resource; -import static cn.iocoder.yudao.coreservice.modules.system.dal.redis.SysRedisKeyCoreConstants.LOGIN_USER; +import static cn.iocoder.yudao.module.system.dal.redis.SysRedisKeyConstants.LOGIN_USER; /** * {@link LoginUser} çš„ RedisDAO @@ -16,7 +16,7 @@ import static cn.iocoder.yudao.coreservice.modules.system.dal.redis.SysRedisKeyC * @author 芋é“æºç  */ @Repository -public class SysLoginUserCoreRedisDAO { +public class LoginUserRedisDAO { @Resource private StringRedisTemplate stringRedisTemplate; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/redis/social/SysSocialAuthUserRedisDAO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/redis/social/SocialAuthUserRedisDAO.java similarity index 83% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/redis/social/SysSocialAuthUserRedisDAO.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/redis/social/SocialAuthUserRedisDAO.java index 0c033f89e..12cdc9486 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/dal/redis/social/SysSocialAuthUserRedisDAO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/dal/redis/social/SocialAuthUserRedisDAO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.system.dal.redis.social; +package cn.iocoder.yudao.module.system.dal.redis.social; import cn.iocoder.yudao.framework.common.util.json.JsonUtils; import me.zhyd.oauth.model.AuthCallback; @@ -8,7 +8,8 @@ import org.springframework.stereotype.Repository; import javax.annotation.Resource; -import static cn.iocoder.yudao.coreservice.modules.system.dal.redis.SysRedisKeyCoreConstants.SOCIAL_AUTH_USER; +import static cn.iocoder.yudao.module.system.dal.redis.SysRedisKeyConstants.SOCIAL_AUTH_USER; + /** * 社交 {@link me.zhyd.oauth.model.AuthUser} çš„ RedisDAO @@ -16,7 +17,7 @@ import static cn.iocoder.yudao.coreservice.modules.system.dal.redis.SysRedisKeyC * @author 芋é“æºç  */ @Repository -public class SysSocialAuthUserRedisDAO { +public class SocialAuthUserRedisDAO { @Resource private StringRedisTemplate stringRedisTemplate; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/SysDictTypeConstants.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/enums/DictTypeConstants.java similarity index 94% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/SysDictTypeConstants.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/enums/DictTypeConstants.java index 766e0fe5c..fc9cb3385 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/SysDictTypeConstants.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/enums/DictTypeConstants.java @@ -1,11 +1,11 @@ -package cn.iocoder.yudao.coreservice.modules.system.enums; +package cn.iocoder.yudao.module.system.enums; /** * System 字典类型的枚举类 * * @author 芋é“æºç  */ -public interface SysDictTypeConstants { +public interface DictTypeConstants { String USER_TYPE = "user_type"; // 用户类型 String COMMON_STATUS = "sys_common_status"; // ç³»ç»ŸçŠ¶æ€ diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/common/SysSexEnum.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/enums/common/SysSexEnum.java similarity index 83% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/common/SysSexEnum.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/enums/common/SysSexEnum.java index a7b0a9c29..7fd76247a 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/common/SysSexEnum.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/enums/common/SysSexEnum.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.system.enums.common; +package cn.iocoder.yudao.module.system.enums.common; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/logger/SysLoginLogTypeEnum.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/enums/logger/SysLoginLogTypeEnum.java similarity index 89% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/logger/SysLoginLogTypeEnum.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/enums/logger/SysLoginLogTypeEnum.java index 5a844f181..ff29ab558 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/logger/SysLoginLogTypeEnum.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/enums/logger/SysLoginLogTypeEnum.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.system.enums.logger; +package cn.iocoder.yudao.module.system.enums.logger; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/logger/SysLoginResultEnum.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/enums/logger/SysLoginResultEnum.java similarity index 88% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/logger/SysLoginResultEnum.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/enums/logger/SysLoginResultEnum.java index 290931038..f1c8356ff 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/logger/SysLoginResultEnum.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/enums/logger/SysLoginResultEnum.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.system.enums.logger; +package cn.iocoder.yudao.module.system.enums.logger; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/sms/SysSmsReceiveStatusEnum.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/enums/sms/SysSmsReceiveStatusEnum.java similarity index 84% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/sms/SysSmsReceiveStatusEnum.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/enums/sms/SysSmsReceiveStatusEnum.java index 48fd0c84c..2b75a45e7 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/sms/SysSmsReceiveStatusEnum.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/enums/sms/SysSmsReceiveStatusEnum.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.system.enums.sms; +package cn.iocoder.yudao.module.system.enums.sms; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/sms/SysSmsSendStatusEnum.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/enums/sms/SysSmsSendStatusEnum.java similarity index 85% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/sms/SysSmsSendStatusEnum.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/enums/sms/SysSmsSendStatusEnum.java index f30e61301..ea57fa8cc 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/sms/SysSmsSendStatusEnum.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/enums/sms/SysSmsSendStatusEnum.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.system.enums.sms; +package cn.iocoder.yudao.module.system.enums.sms; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/sms/SysSmsTemplateTypeEnum.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/enums/sms/SysSmsTemplateTypeEnum.java similarity index 84% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/sms/SysSmsTemplateTypeEnum.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/enums/sms/SysSmsTemplateTypeEnum.java index b3811e5ec..5f853e2d7 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/enums/sms/SysSmsTemplateTypeEnum.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/enums/sms/SysSmsTemplateTypeEnum.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.system.enums.sms; +package cn.iocoder.yudao.module.system.enums.sms; import lombok.AllArgsConstructor; import lombok.Getter; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/framework/datapermission/config/DataPermissionConfiguration.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/framework/datapermission/config/DataPermissionConfiguration.java index cd67fdc82..81bd82068 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/framework/datapermission/config/DataPermissionConfiguration.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/framework/datapermission/config/DataPermissionConfiguration.java @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.system.framework.datapermission.config; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysDeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.UserDO; import cn.iocoder.yudao.framework.datapermission.core.dept.rule.DeptDataPermissionRuleCustomizer; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -17,7 +17,7 @@ public class DataPermissionConfiguration { @Bean public DeptDataPermissionRuleCustomizer sysDeptDataPermissionRuleCustomizer() { return rule -> { - rule.addDeptColumn(SysUserDO.class); + rule.addDeptColumn(UserDO.class); rule.addDeptColumn(SysDeptDO.class, "id"); }; } diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/mq/consumer/dict/DictDataRefreshConsumer.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/mq/consumer/dict/DictDataRefreshConsumer.java index 6fe1c7c6a..e466f96b2 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/mq/consumer/dict/DictDataRefreshConsumer.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/mq/consumer/dict/DictDataRefreshConsumer.java @@ -1,8 +1,8 @@ package cn.iocoder.yudao.module.system.mq.consumer.dict; -import cn.iocoder.yudao.coreservice.modules.system.service.dict.SysDictDataCoreService; import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener; import cn.iocoder.yudao.module.system.mq.message.dict.DictDataRefreshMessage; +import cn.iocoder.yudao.module.system.service.dict.DictDataService; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; @@ -18,12 +18,12 @@ import javax.annotation.Resource; public class DictDataRefreshConsumer extends AbstractChannelMessageListener { @Resource - private SysDictDataCoreService dictDataCoreService; + private DictDataService dictDataService; @Override public void onMessage(DictDataRefreshMessage message) { log.info("[onMessage][收到 DictData 刷新消æ¯]"); - dictDataCoreService.initLocalCache(); + dictDataService.initLocalCache(); } } diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/mq/consumer/sms/SmsSendConsumer.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/mq/consumer/sms/SmsSendConsumer.java index 2239eecc1..6779549db 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/mq/consumer/sms/SmsSendConsumer.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/mq/consumer/sms/SmsSendConsumer.java @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.system.mq.consumer.sms; -import cn.iocoder.yudao.coreservice.modules.system.mq.message.sms.SysSmsSendMessage; -import cn.iocoder.yudao.coreservice.modules.system.service.sms.SysSmsCoreService; +import cn.iocoder.yudao.module.system.mq.message.sms.SmsSendMessage; +import cn.iocoder.yudao.module.system.service.sms.SysSmsSendService; import cn.iocoder.yudao.framework.mq.core.stream.AbstractStreamMessageListener; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; @@ -9,20 +9,20 @@ import org.springframework.stereotype.Component; import javax.annotation.Resource; /** - * 针对 {@link SysSmsSendMessage} 的消费者 + * 针对 {@link SmsSendMessage} 的消费者 * * @author zzf * @date 2021/3/9 16:35 */ @Component @Slf4j -public class SmsSendConsumer extends AbstractStreamMessageListener { +public class SmsSendConsumer extends AbstractStreamMessageListener { @Resource - private SysSmsCoreService smsCoreService; + private SysSmsSendService smsCoreService; @Override - public void onMessage(SysSmsSendMessage message) { + public void onMessage(SmsSendMessage message) { log.info("[onMessage][消æ¯å†…容({})]", message); smsCoreService.doSendSms(message); } diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/mq/consumer/sms/SmsTemplateRefreshConsumer.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/mq/consumer/sms/SmsTemplateRefreshConsumer.java index 52840189a..02bc59984 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/mq/consumer/sms/SmsTemplateRefreshConsumer.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/mq/consumer/sms/SmsTemplateRefreshConsumer.java @@ -1,8 +1,8 @@ package cn.iocoder.yudao.module.system.mq.consumer.sms; import cn.iocoder.yudao.module.system.mq.message.sms.SmsTemplateRefreshMessage; -import cn.iocoder.yudao.coreservice.modules.system.service.sms.SysSmsTemplateCoreService; import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener; +import cn.iocoder.yudao.module.system.service.sms.SmsTemplateService; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; @@ -18,12 +18,12 @@ import javax.annotation.Resource; public class SmsTemplateRefreshConsumer extends AbstractChannelMessageListener { @Resource - private SysSmsTemplateCoreService smsTemplateCoreService; + private SmsTemplateService smsTemplateService; @Override public void onMessage(SmsTemplateRefreshMessage message) { log.info("[onMessage][收到 SmsTemplate 刷新消æ¯]"); - smsTemplateCoreService.initLocalCache(); + smsTemplateService.initLocalCache(); } } diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/mq/message/sms/SysSmsSendMessage.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/mq/message/sms/SmsSendMessage.java similarity index 88% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/mq/message/sms/SysSmsSendMessage.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/mq/message/sms/SmsSendMessage.java index 19c7d044c..42a32623a 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/mq/message/sms/SysSmsSendMessage.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/mq/message/sms/SmsSendMessage.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.system.mq.message.sms; +package cn.iocoder.yudao.module.system.mq.message.sms; import cn.iocoder.yudao.framework.common.core.KeyValue; import cn.iocoder.yudao.framework.mq.core.stream.AbstractStreamMessage; @@ -15,7 +15,7 @@ import java.util.List; */ @Data @EqualsAndHashCode(callSuper = true) -public class SysSmsSendMessage extends AbstractStreamMessage { +public class SmsSendMessage extends AbstractStreamMessage { /** * çŸ­ä¿¡æ—¥å¿—ç¼–å· diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/mq/producer/package-info.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/mq/producer/package-info.java new file mode 100644 index 000000000..255ab310c --- /dev/null +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/mq/producer/package-info.java @@ -0,0 +1,4 @@ +/** + * å ä½ + */ +package cn.iocoder.yudao.module.system.mq.producer; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/mq/producer/sms/SmsProducer.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/mq/producer/sms/SmsProducer.java index 117e666b9..e14fb953b 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/mq/producer/sms/SmsProducer.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/mq/producer/sms/SmsProducer.java @@ -1,12 +1,15 @@ package cn.iocoder.yudao.module.system.mq.producer.sms; +import cn.iocoder.yudao.framework.common.core.KeyValue; import cn.iocoder.yudao.module.system.mq.message.sms.SmsChannelRefreshMessage; +import cn.iocoder.yudao.module.system.mq.message.sms.SmsSendMessage; import cn.iocoder.yudao.module.system.mq.message.sms.SmsTemplateRefreshMessage; import cn.iocoder.yudao.framework.mq.core.RedisMQTemplate; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; import javax.annotation.Resource; +import java.util.List; /** * Sms 短信相关消æ¯çš„ Producer @@ -37,4 +40,20 @@ public class SmsProducer { redisMQTemplate.send(message); } + /** + * å‘é€ {@link SmsSendMessage} æ¶ˆæ¯ + * + * @param logId çŸ­ä¿¡æ—¥å¿—ç¼–å· + * @param mobile æ‰‹æœºå· + * @param channelId 渠é“ç¼–å· + * @param apiTemplateId 短信模æ¿ç¼–å· + * @param templateParams 短信模æ¿å‚æ•° + */ + public void sendSmsSendMessage(Long logId, String mobile, + Long channelId, String apiTemplateId, List> templateParams) { + SmsSendMessage message = new SmsSendMessage().setLogId(logId).setMobile(mobile); + message.setChannelId(channelId).setApiTemplateId(apiTemplateId).setTemplateParams(templateParams); + redisMQTemplate.send(message); + } + } diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/auth/AuthServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/auth/AuthServiceImpl.java index a0a45e7d7..1d1df6139 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/auth/AuthServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/auth/AuthServiceImpl.java @@ -1,33 +1,30 @@ package cn.iocoder.yudao.module.system.service.auth; import cn.hutool.core.collection.CollUtil; -import cn.iocoder.yudao.module.system.controller.admin.auth.vo.auth.AuthLoginReqVO; -import cn.iocoder.yudao.module.system.controller.admin.auth.vo.auth.AuthSocialBindReqVO; -import cn.iocoder.yudao.module.system.controller.admin.auth.vo.auth.AuthSocialLogin2ReqVO; -import cn.iocoder.yudao.module.system.controller.admin.auth.vo.auth.AuthSocialLoginReqVO; -import cn.iocoder.yudao.module.system.convert.auth.AuthConvert; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysPostDO; -import cn.iocoder.yudao.module.system.enums.logger.LoginLogTypeEnum; -import cn.iocoder.yudao.module.system.enums.logger.LoginResultEnum; -import cn.iocoder.yudao.module.system.service.common.CaptchaService; -import cn.iocoder.yudao.module.system.service.dept.PostService; -import cn.iocoder.yudao.module.system.service.permission.PermissionService; -import cn.iocoder.yudao.module.system.service.user.UserService; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.social.SysSocialUserDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; -import cn.iocoder.yudao.coreservice.modules.system.service.auth.SysUserSessionCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.logger.SysLoginLogCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.logger.dto.SysLoginLogCreateReqDTO; -import cn.iocoder.yudao.coreservice.modules.system.service.social.SysSocialCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils; import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.security.core.authentication.MultiUsernamePasswordAuthenticationToken; +import cn.iocoder.yudao.module.system.controller.admin.auth.vo.auth.AuthLoginReqVO; +import cn.iocoder.yudao.module.system.controller.admin.auth.vo.auth.AuthSocialBindReqVO; +import cn.iocoder.yudao.module.system.controller.admin.auth.vo.auth.AuthSocialLogin2ReqVO; +import cn.iocoder.yudao.module.system.controller.admin.auth.vo.auth.AuthSocialLoginReqVO; +import cn.iocoder.yudao.module.system.convert.auth.AuthConvert; +import cn.iocoder.yudao.module.system.dal.dataobject.social.SysSocialUserDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.UserDO; +import cn.iocoder.yudao.module.system.enums.logger.LoginLogTypeEnum; +import cn.iocoder.yudao.module.system.enums.logger.LoginResultEnum; +import cn.iocoder.yudao.module.system.service.common.CaptchaService; +import cn.iocoder.yudao.module.system.service.logger.LoginLogService; +import cn.iocoder.yudao.module.system.service.logger.dto.LoginLogCreateReqDTO; +import cn.iocoder.yudao.module.system.service.permission.PermissionService; +import cn.iocoder.yudao.module.system.service.social.SocialUserService; +import cn.iocoder.yudao.module.system.service.user.UserService; import lombok.extern.slf4j.Slf4j; import me.zhyd.oauth.model.AuthUser; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.authentication.BadCredentialsException; @@ -40,14 +37,12 @@ import org.springframework.stereotype.Service; import org.springframework.util.Assert; import javax.annotation.Resource; -import java.util.Collections; import java.util.List; import java.util.Objects; import java.util.Set; -import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; import static java.util.Collections.singleton; /** @@ -63,27 +58,24 @@ public class AuthServiceImpl implements AuthService { @Lazy // 延迟加载,因为存在相互ä¾èµ–的问题 private AuthenticationManager authenticationManager; - @Resource + @Autowired + @SuppressWarnings("SpringJavaAutowiredFieldsWarningInspection") // UserService 存在é‡å private UserService userService; @Resource - private SysUserCoreService userCoreService; - @Resource private PermissionService permissionService; @Resource private CaptchaService captchaService; @Resource - private SysLoginLogCoreService loginLogCoreService; + private LoginLogService loginLogService; @Resource - private SysUserSessionCoreService userSessionCoreService; + private UserSessionService userSessionService; @Resource - private PostService postService; - @Resource - private SysSocialCoreService socialService; + private SocialUserService socialService; @Override public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { // èŽ·å– username 对应的 SysUserDO - SysUserDO user = userService.getUserByUsername(username); + UserDO user = userService.getUserByUsername(username); if (user == null) { throw new UsernameNotFoundException(username); } @@ -94,7 +86,7 @@ public class AuthServiceImpl implements AuthService { @Override public LoginUser mockLogin(Long userId) { // 获å–用户编å·å¯¹åº”çš„ SysUserDO - SysUserDO user = userCoreService.getUser(userId); + UserDO user = userService.getUser(userId); if (user == null) { throw new UsernameNotFoundException(String.valueOf(userId)); } @@ -113,14 +105,7 @@ public class AuthServiceImpl implements AuthService { LoginUser loginUser = this.login0(reqVO.getUsername(), reqVO.getPassword()); // 缓存登陆用户到 Redis 中,返回 sessionId ç¼–å· - return userSessionCoreService.createUserSession(loginUser, userIp, userAgent); - } - - private List getUserPosts(Set postIds) { - if (CollUtil.isEmpty(postIds)) { - return Collections.emptyList(); - } - return convertList(postService.getPosts(postIds), SysPostDO::getCode); + return userSessionService.createUserSession(loginUser, userIp, userAgent); } private void verifyCaptcha(String username, String captchaUUID, String captchaCode) { @@ -175,9 +160,9 @@ public class AuthServiceImpl implements AuthService { private void createLoginLog(String username, LoginLogTypeEnum logTypeEnum, LoginResultEnum loginResult) { // 获得用户 - SysUserDO user = userService.getUserByUsername(username); + UserDO user = userService.getUserByUsername(username); // æ’入登录日志 - SysLoginLogCreateReqDTO reqDTO = new SysLoginLogCreateReqDTO(); + LoginLogCreateReqDTO reqDTO = new LoginLogCreateReqDTO(); reqDTO.setLogType(logTypeEnum.getType()); reqDTO.setTraceId(TracerUtils.getTraceId()); if (user != null) { @@ -188,7 +173,7 @@ public class AuthServiceImpl implements AuthService { reqDTO.setUserAgent(ServletUtils.getUserAgent()); reqDTO.setUserIp(ServletUtils.getClientIP()); reqDTO.setResult(loginResult.getResult()); - loginLogCoreService.createLoginLog(reqDTO); + loginLogService.createLoginLog(reqDTO); // 更新最åŽç™»å½•æ—¶é—´ if (user != null && Objects.equals(LoginResultEnum.SUCCESS.getResult(), loginResult.getResult())) { userService.updateUserLogin(user.getId(), ServletUtils.getClientIP()); @@ -219,7 +204,7 @@ public class AuthServiceImpl implements AuthService { } // 自动登录 - SysUserDO user = userCoreService.getUser(socialUsers.get(0).getUserId()); + UserDO user = userService.getUser(socialUsers.get(0).getUserId()); if (user == null) { throw exception(USER_NOT_EXISTS); } @@ -232,7 +217,7 @@ public class AuthServiceImpl implements AuthService { socialService.bindSocialUser(loginUser.getId(), reqVO.getType(), authUser, getUserType()); // 缓存登录用户到 Redis 中,返回 sessionId ç¼–å· - return userSessionCoreService.createUserSession(loginUser, userIp, userAgent); + return userSessionService.createUserSession(loginUser, userIp, userAgent); } @Override @@ -248,7 +233,7 @@ public class AuthServiceImpl implements AuthService { socialService.bindSocialUser(loginUser.getId(), reqVO.getType(), authUser, getUserType()); // 缓存登录用户到 Redis 中,返回 sessionId ç¼–å· - return userSessionCoreService.createUserSession(loginUser, userIp, userAgent); + return userSessionService.createUserSession(loginUser, userIp, userAgent); } @Override @@ -264,12 +249,12 @@ public class AuthServiceImpl implements AuthService { @Override public void logout(String token) { // æŸ¥è¯¢ç”¨æˆ·ä¿¡æ¯ - LoginUser loginUser = userSessionCoreService.getLoginUser(token); + LoginUser loginUser = userSessionService.getLoginUser(token); if (loginUser == null) { return; } // 删除 session - userSessionCoreService.deleteUserSession(token); + userSessionService.deleteUserSession(token); // 记录登出日志 this.createLogoutLog(loginUser.getId(), loginUser.getUsername()); } @@ -280,7 +265,7 @@ public class AuthServiceImpl implements AuthService { } private void createLogoutLog(Long userId, String username) { - SysLoginLogCreateReqDTO reqDTO = new SysLoginLogCreateReqDTO(); + LoginLogCreateReqDTO reqDTO = new LoginLogCreateReqDTO(); reqDTO.setLogType(LoginLogTypeEnum.LOGOUT_SELF.getType()); reqDTO.setTraceId(TracerUtils.getTraceId()); reqDTO.setUserId(userId); @@ -289,13 +274,13 @@ public class AuthServiceImpl implements AuthService { reqDTO.setUserAgent(ServletUtils.getUserAgent()); reqDTO.setUserIp(ServletUtils.getClientIP()); reqDTO.setResult(LoginResultEnum.SUCCESS.getResult()); - loginLogCoreService.createLoginLog(reqDTO); + loginLogService.createLoginLog(reqDTO); } @Override public LoginUser verifyTokenAndRefresh(String token) { // 获得 LoginUser - LoginUser loginUser = userSessionCoreService.getLoginUser(token); + LoginUser loginUser = userSessionService.getLoginUser(token); if (loginUser == null) { return null; } @@ -306,23 +291,23 @@ public class AuthServiceImpl implements AuthService { private LoginUser refreshLoginUserCache(String token, LoginUser loginUser) { // æ¯ 1/3 çš„ Session 超时时间,刷新 LoginUser 缓存 if (System.currentTimeMillis() - loginUser.getUpdateTime().getTime() < - userSessionCoreService.getSessionTimeoutMillis() / 3) { + userSessionService.getSessionTimeoutMillis() / 3) { return loginUser; } // é‡æ–°åŠ è½½ SysUserDO ä¿¡æ¯ - SysUserDO user = userCoreService.getUser(loginUser.getId()); + UserDO user = userService.getUser(loginUser.getId()); if (user == null || CommonStatusEnum.DISABLE.getStatus().equals(user.getStatus())) { throw exception(AUTH_TOKEN_EXPIRED); // 校验 token 时,用户被ç¦ç”¨çš„情况下,也认为 token 过期,方便å‰ç«¯è·³è½¬åˆ°ç™»å½•ç•Œé¢ } // 刷新 LoginUser 缓存 LoginUser newLoginUser= this.buildLoginUser(user); - userSessionCoreService.refreshUserSession(token, newLoginUser); + userSessionService.refreshUserSession(token, newLoginUser); return newLoginUser; } - private LoginUser buildLoginUser(SysUserDO user) { + private LoginUser buildLoginUser(UserDO user) { LoginUser loginUser = AuthConvert.INSTANCE.convert(user); // 补全字段 loginUser.setDeptId(user.getDeptId()); diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/auth/UserSessionService.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/auth/UserSessionService.java index af318fec4..ef9e92caa 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/auth/UserSessionService.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/auth/UserSessionService.java @@ -1,7 +1,8 @@ package cn.iocoder.yudao.module.system.service.auth; +import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.module.system.controller.admin.auth.vo.session.UserSessionPageReqVO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.auth.SysUserSessionDO; +import cn.iocoder.yudao.module.system.dal.dataobject.auth.SysUserSessionDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; /** @@ -26,4 +27,44 @@ public interface UserSessionService { **/ long clearSessionTimeout(); + /** + * 创建在线用户 Session + * + * @param loginUser 登录用户 + * @param userIp 用户 IP + * @param userAgent 用户 UA + * @return Session ç¼–å· + */ + String createUserSession(LoginUser loginUser, String userIp, String userAgent); + + /** + * 刷新在线用户 Session 的更新时间 + * + * @param sessionId Session ç¼–å· + * @param loginUser 登录用户 + */ + void refreshUserSession(String sessionId, LoginUser loginUser); + + /** + * 删除在线用户 Session + * + * @param sessionId Session ç¼–å· + */ + void deleteUserSession(String sessionId); + + /** + * 获得 Session ç¼–å·å¯¹åº”的在线用户 + * + * @param sessionId Session ç¼–å· + * @return 在线用户 + */ + LoginUser getLoginUser(String sessionId); + + /** + * 获得 Session 超时时间,å•ä½ï¼šæ¯«ç§’ + * + * @return 超时时间 + */ + Long getSessionTimeoutMillis(); + } diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/auth/UserSessionServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/auth/UserSessionServiceImpl.java index 23d68cd6e..cadc899d5 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/auth/UserSessionServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/auth/UserSessionServiceImpl.java @@ -1,17 +1,20 @@ package cn.iocoder.yudao.module.system.service.auth; import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; +import cn.iocoder.yudao.framework.security.config.SecurityProperties; +import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.module.system.controller.admin.auth.vo.session.UserSessionPageReqVO; import cn.iocoder.yudao.module.system.dal.mysql.auth.SysUserSessionMapper; import cn.iocoder.yudao.module.system.enums.logger.LoginLogTypeEnum; import cn.iocoder.yudao.module.system.enums.logger.LoginResultEnum; +import cn.iocoder.yudao.module.system.service.logger.LoginLogService; import cn.iocoder.yudao.module.system.service.user.UserService; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.auth.SysUserSessionDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.redis.auth.SysLoginUserCoreRedisDAO; -import cn.iocoder.yudao.coreservice.modules.system.service.logger.SysLoginLogCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.logger.dto.SysLoginLogCreateReqDTO; +import cn.iocoder.yudao.module.system.dal.dataobject.auth.SysUserSessionDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.UserDO; +import cn.iocoder.yudao.module.system.dal.redis.auth.LoginUserRedisDAO; +import cn.iocoder.yudao.module.system.service.logger.dto.LoginLogCreateReqDTO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils; import com.google.common.collect.Lists; @@ -19,13 +22,12 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Map; +import java.time.Duration; +import java.util.*; import java.util.stream.Collectors; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.addTime; /** * 在线用户 Session Service 实现类 @@ -38,20 +40,24 @@ public class UserSessionServiceImpl implements UserSessionService { @Resource private SysUserSessionMapper userSessionMapper; + @Resource private UserService userService; @Resource - private SysLoginLogCoreService loginLogCoreService; + private LoginLogService loginLogService; @Resource - private SysLoginUserCoreRedisDAO loginUserCoreRedisDAO; + private LoginUserRedisDAO loginUserCoreRedisDAO; + + @Resource + private SecurityProperties securityProperties; @Override public PageResult getUserSessionPage(UserSessionPageReqVO reqVO) { // 处ç†åŸºäºŽç”¨æˆ·æ˜µç§°çš„查询 Collection userIds = null; if (StrUtil.isNotEmpty(reqVO.getUsername())) { - userIds = convertSet(userService.getUsersByUsername(reqVO.getUsername()), SysUserDO::getId); + userIds = convertSet(userService.getUsersByUsername(reqVO.getUsername()), UserDO::getId); if (CollUtil.isEmpty(userIds)) { return PageResult.empty(); } @@ -80,7 +86,7 @@ public class UserSessionServiceImpl implements UserSessionService { private void createTimeoutLogoutLog(Collection timeoutSessionDOS) { for (SysUserSessionDO timeoutSessionDO : timeoutSessionDOS) { - SysLoginLogCreateReqDTO reqDTO = new SysLoginLogCreateReqDTO(); + LoginLogCreateReqDTO reqDTO = new LoginLogCreateReqDTO(); reqDTO.setLogType(LoginLogTypeEnum.LOGOUT_TIMEOUT.getType()); reqDTO.setTraceId(TracerUtils.getTraceId()); reqDTO.setUserId(timeoutSessionDO.getUserId()); @@ -89,8 +95,66 @@ public class UserSessionServiceImpl implements UserSessionService { reqDTO.setUserAgent(timeoutSessionDO.getUserAgent()); reqDTO.setUserIp(timeoutSessionDO.getUserIp()); reqDTO.setResult(LoginResultEnum.SUCCESS.getResult()); - loginLogCoreService.createLoginLog(reqDTO); + loginLogService.createLoginLog(reqDTO); } } + @Override + public String createUserSession(LoginUser loginUser, String userIp, String userAgent) { + // ç”Ÿæˆ Session ç¼–å· + String sessionId = generateSessionId(); + // 写入 Redis 缓存 + loginUser.setUpdateTime(new Date()); + loginUserCoreRedisDAO.set(sessionId, loginUser); + // 写入 DB 中 + SysUserSessionDO userSession = SysUserSessionDO.builder().id(sessionId) + .userId(loginUser.getId()).userType(loginUser.getUserType()) + .userIp(userIp).userAgent(userAgent).username(loginUser.getUsername()) + .sessionTimeout(addTime(Duration.ofMillis(getSessionTimeoutMillis()))) + .build(); + userSessionMapper.insert(userSession); + // 返回 Session ç¼–å· + return sessionId; + } + + @Override + public void refreshUserSession(String sessionId, LoginUser loginUser) { + // 写入 Redis 缓存 + loginUser.setUpdateTime(new Date()); + loginUserCoreRedisDAO.set(sessionId, loginUser); + // æ›´æ–° DB 中 + SysUserSessionDO updateObj = SysUserSessionDO.builder().id(sessionId).build(); + updateObj.setUsername(loginUser.getUsername()); + updateObj.setUpdateTime(new Date()); + updateObj.setSessionTimeout(addTime(Duration.ofMillis(getSessionTimeoutMillis()))); + userSessionMapper.updateById(updateObj); + } + + @Override + public void deleteUserSession(String sessionId) { + // 删除 Redis 缓存 + loginUserCoreRedisDAO.delete(sessionId); + // 删除 DB 记录 + userSessionMapper.deleteById(sessionId); + } + + @Override + public LoginUser getLoginUser(String sessionId) { + return loginUserCoreRedisDAO.get(sessionId); + } + + @Override + public Long getSessionTimeoutMillis() { + return securityProperties.getSessionTimeout().toMillis(); + } + + /** + * ç”Ÿæˆ Session ç¼–å·ï¼Œç›®å‰é‡‡ç”¨ UUID 算法 + * + * @return Session ç¼–å· + */ + private static String generateSessionId() { + return IdUtil.fastSimpleUUID(); + } + } diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptService.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptService.java index e8397b542..33ef52f8e 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptService.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptService.java @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.system.service.dept; import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptCreateReqVO; import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptListReqVO; import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptUpdateReqVO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysDeptDO; import java.util.List; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java index 2f9c1a713..bd269d9cc 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceImpl.java @@ -9,7 +9,7 @@ import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptListReqV import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptUpdateReqVO; import cn.iocoder.yudao.module.system.convert.dept.DeptConvert; import cn.iocoder.yudao.module.system.dal.mysql.dept.SysDeptMapper; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysDeptDO; import cn.iocoder.yudao.module.system.enums.dept.DeptIdEnum; import cn.iocoder.yudao.module.system.mq.producer.dept.DeptProducer; import com.google.common.collect.ImmutableMap; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/PostService.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/PostService.java index 73e9759b7..5e2dc33e7 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/PostService.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/PostService.java @@ -6,7 +6,7 @@ import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostCreateRe import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostExportReqVO; import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostPageReqVO; import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostUpdateReqVO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysPostDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysPostDO; import org.springframework.lang.Nullable; import java.util.Collection; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/PostServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/PostServiceImpl.java index 971743a29..a498ce3dc 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/PostServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/PostServiceImpl.java @@ -8,7 +8,7 @@ import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostPageReqV import cn.iocoder.yudao.module.system.controller.admin.dept.vo.post.PostUpdateReqVO; import cn.iocoder.yudao.module.system.convert.dept.PostConvert; import cn.iocoder.yudao.module.system.dal.mysql.dept.SysPostMapper; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysPostDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysPostDO; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/dept/SysDeptCoreService.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/SysDeptCoreService.java similarity index 90% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/dept/SysDeptCoreService.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/SysDeptCoreService.java index e963e51e0..92c0fdbc0 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/dept/SysDeptCoreService.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/SysDeptCoreService.java @@ -1,7 +1,7 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.dept; +package cn.iocoder.yudao.module.system.service.dept; import cn.hutool.core.collection.CollUtil; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysDeptDO; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import java.util.Collection; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/dept/SysPostCoreService.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/SysPostCoreService.java similarity index 84% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/dept/SysPostCoreService.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/SysPostCoreService.java index 14a0653ad..5ce996ed5 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/dept/SysPostCoreService.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/SysPostCoreService.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.dept; +package cn.iocoder.yudao.module.system.service.dept; import java.util.Collection; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/dept/impl/SysDeptCoreServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/impl/SysDeptCoreServiceImpl.java similarity index 74% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/dept/impl/SysDeptCoreServiceImpl.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/impl/SysDeptCoreServiceImpl.java index 4cfa49ed2..032e5e378 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/dept/impl/SysDeptCoreServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/impl/SysDeptCoreServiceImpl.java @@ -1,22 +1,21 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.dept.impl; +package cn.iocoder.yudao.module.system.service.dept.impl; import cn.hutool.core.collection.CollUtil; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.mysql.dept.SysDeptCoreMapper; -import cn.iocoder.yudao.coreservice.modules.system.service.dept.SysDeptCoreService; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysDeptDO; +import cn.iocoder.yudao.module.system.dal.mysql.dept.SysDeptCoreMapper; +import cn.iocoder.yudao.module.system.service.dept.SysDeptCoreService; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; import java.util.Collection; import java.util.List; import java.util.Map; -import static cn.iocoder.yudao.coreservice.modules.system.enums.SysErrorCodeConstants.DEPT_NOT_ENABLE; -import static cn.iocoder.yudao.coreservice.modules.system.enums.SysErrorCodeConstants.DEPT_NOT_FOUND; +import static cn.iocoder.yudao.module.system.enums.SysErrorCodeConstants.DEPT_NOT_ENABLE; +import static cn.iocoder.yudao.module.system.enums.SysErrorCodeConstants.DEPT_NOT_FOUND; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; /** diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/dept/impl/SysPostCoreServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/impl/SysPostCoreServiceImpl.java similarity index 71% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/dept/impl/SysPostCoreServiceImpl.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/impl/SysPostCoreServiceImpl.java index 0e2b2b928..d0bc19874 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/dept/impl/SysPostCoreServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dept/impl/SysPostCoreServiceImpl.java @@ -1,9 +1,9 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.dept.impl; +package cn.iocoder.yudao.module.system.service.dept.impl; import cn.hutool.core.collection.CollUtil; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysPostDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.mysql.dept.SysPostCoreMapper; -import cn.iocoder.yudao.coreservice.modules.system.service.dept.SysPostCoreService; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysPostDO; +import cn.iocoder.yudao.module.system.dal.mysql.dept.SysPostCoreMapper; +import cn.iocoder.yudao.module.system.service.dept.SysPostCoreService; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import org.springframework.stereotype.Service; @@ -13,8 +13,8 @@ import java.util.Collection; import java.util.List; import java.util.Map; -import static cn.iocoder.yudao.coreservice.modules.system.enums.SysErrorCodeConstants.POST_NOT_ENABLE; -import static cn.iocoder.yudao.coreservice.modules.system.enums.SysErrorCodeConstants.POST_NOT_FOUND; +import static cn.iocoder.yudao.module.system.enums.SysErrorCodeConstants.POST_NOT_ENABLE; +import static cn.iocoder.yudao.module.system.enums.SysErrorCodeConstants.POST_NOT_FOUND; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; /** diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataService.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataService.java index c7b60e0ad..8d20c5aab 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataService.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataService.java @@ -1,12 +1,14 @@ package cn.iocoder.yudao.module.system.service.dict; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dict.SysDictDataDO; +import cn.iocoder.yudao.framework.dict.core.service.DictDataFrameworkService; +import cn.iocoder.yudao.module.system.dal.dataobject.dict.SysDictDataDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataCreateReqVO; import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataExportReqVO; import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataPageReqVO; import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataUpdateReqVO; +import java.util.Collection; import java.util.List; /** @@ -14,7 +16,12 @@ import java.util.List; * * @author ruoyi */ -public interface DictDataService { +public interface DictDataService extends DictDataFrameworkService { + + /** + * åˆå§‹åŒ–字典数æ®çš„本地缓存 + */ + void initLocalCache(); /** * åˆ›å»ºå­—å…¸æ•°æ® @@ -77,4 +84,14 @@ public interface DictDataService { */ int countByDictType(String dictType); + /** + * 校验字典数æ®ä»¬æ˜¯å¦æœ‰æ•ˆã€‚如下情况,视为无效: + * 1. 字典数æ®ä¸å­˜åœ¨ + * 2. 字典数æ®è¢«ç¦ç”¨ + * + * @param dictType 字典类型 + * @param values 字典数æ®å€¼çš„数组 + */ + void validDictDatas(String dictType, Collection values); + } diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceImpl.java index 0d25f87ca..b483f4167 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceImpl.java @@ -1,27 +1,36 @@ package cn.iocoder.yudao.module.system.service.dict; +import cn.hutool.core.collection.CollUtil; +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataCreateReqVO; import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataExportReqVO; import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataPageReqVO; import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataUpdateReqVO; import cn.iocoder.yudao.module.system.convert.dict.DictDataConvert; +import cn.iocoder.yudao.module.system.convert.dict.SysDictDataCoreConvert; import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictTypeDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dict.SysDictDataDO; import cn.iocoder.yudao.module.system.dal.mysql.dict.SysDictDataMapper; import cn.iocoder.yudao.module.system.mq.producer.dict.DictDataProducer; -import cn.iocoder.yudao.module.system.service.dict.DictDataService; -import cn.iocoder.yudao.module.system.service.dict.DictTypeService; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dict.SysDictDataDO; -import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; -import cn.iocoder.yudao.framework.common.pojo.PageResult; import com.google.common.annotations.VisibleForTesting; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableTable; import lombok.extern.slf4j.Slf4j; +import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; +import javax.annotation.PostConstruct; import javax.annotation.Resource; -import java.util.*; +import java.util.Collection; +import java.util.Comparator; +import java.util.Date; +import java.util.List; -import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; /** * å­—å…¸æ•°æ® Service 实现类 @@ -39,6 +48,12 @@ public class DictDataServiceImpl implements DictDataService { .comparing(SysDictDataDO::getDictType) .thenComparingInt(SysDictDataDO::getSort); + /** + * 定时执行 {@link #schedulePeriodicRefresh()} 的周期 + * 因为已ç»é€šè¿‡ Redis Pub/Sub 机制,所以频率ä¸éœ€è¦é«˜ + */ + private static final long SCHEDULER_PERIOD = 5 * 60 * 1000L; + @Resource private DictTypeService dictTypeService; @@ -48,6 +63,48 @@ public class DictDataServiceImpl implements DictDataService { @Resource private DictDataProducer dictDataProducer; + /** + * 字典数æ®ç¼“存,第二个 key 使用 label + * + * key1:字典类型 dictType + * key2:字典标签 label + */ + private ImmutableTable labelDictDataCache; + /** + * 字典数æ®ç¼“存,第二个 key 使用 value + * + * key1:字典类型 dictType + * key2:字典值 value + */ + private ImmutableTable valueDictDataCache; + /** + * 缓存字典数æ®çš„最大更新时间,用于åŽç»­çš„增é‡è½®è¯¢ï¼Œåˆ¤æ–­æ˜¯å¦æœ‰æ›´æ–° + */ + private volatile Date maxUpdateTime; + + @Override + @PostConstruct + public synchronized void initLocalCache() { + // 获å–字典数æ®åˆ—表,如果有更新 + List dataList = loadDictDataIfUpdate(maxUpdateTime); + if (CollUtil.isEmpty(dataList)) { + return; + } + + // 构建缓存 + ImmutableTable.Builder labelDictDataBuilder = ImmutableTable.builder(); + ImmutableTable.Builder valueDictDataBuilder = ImmutableTable.builder(); + dataList.forEach(dictData -> { + labelDictDataBuilder.put(dictData.getDictType(), dictData.getLabel(), dictData); + valueDictDataBuilder.put(dictData.getDictType(), dictData.getValue(), dictData); + }); + labelDictDataCache = labelDictDataBuilder.build(); + valueDictDataCache = valueDictDataBuilder.build(); + assert dataList.size() > 0; // 断言,é¿å…å‘Šè­¦ + maxUpdateTime = dataList.stream().max(Comparator.comparing(BaseDO::getUpdateTime)).get().getUpdateTime(); + log.info("[initLocalCache][缓存字典数æ®ï¼Œæ•°é‡ä¸º:{}]", dataList.size()); + } + /** * 如果字典数æ®å‘生å˜åŒ–,从数æ®åº“中获å–最新的全é‡å­—典数æ®ã€‚ * 如果未å‘生å˜åŒ–,则返回空 @@ -69,6 +126,11 @@ public class DictDataServiceImpl implements DictDataService { return dictDataMapper.selectList(); } + @Scheduled(fixedDelay = SCHEDULER_PERIOD, initialDelay = SCHEDULER_PERIOD) + public void schedulePeriodicRefresh() { + initLocalCache(); + } + @Override public List getDictDatas() { List list = dictDataMapper.selectList(); @@ -93,13 +155,30 @@ public class DictDataServiceImpl implements DictDataService { return dictDataMapper.selectById(id); } + @Override + public DictDataRespDTO getDictDataFromCache(String type, String value) { + return SysDictDataCoreConvert.INSTANCE.convert02(valueDictDataCache.get(type, value)); + } + + @Override + public DictDataRespDTO parseDictDataFromCache(String type, String label) { + return SysDictDataCoreConvert.INSTANCE.convert02(labelDictDataCache.get(type, label)); + } + + @Override + public List listDictDatasFromCache(String type) { + return SysDictDataCoreConvert.INSTANCE.convertList03(labelDictDataCache.row(type).values()); + } + @Override public Long createDictData(DictDataCreateReqVO reqVO) { // 校验正确性 - this.checkCreateOrUpdate(null, reqVO.getValue(), reqVO.getDictType()); + checkCreateOrUpdate(null, reqVO.getValue(), reqVO.getDictType()); + // æ’入字典类型 SysDictDataDO dictData = DictDataConvert.INSTANCE.convert(reqVO); dictDataMapper.insert(dictData); + // å‘é€åˆ·æ–°æ¶ˆæ¯ dictDataProducer.sendDictDataRefreshMessage(); return dictData.getId(); @@ -108,10 +187,12 @@ public class DictDataServiceImpl implements DictDataService { @Override public void updateDictData(DictDataUpdateReqVO reqVO) { // 校验正确性 - this.checkCreateOrUpdate(reqVO.getId(), reqVO.getValue(), reqVO.getDictType()); + checkCreateOrUpdate(reqVO.getId(), reqVO.getValue(), reqVO.getDictType()); + // 更新字典类型 SysDictDataDO updateObj = DictDataConvert.INSTANCE.convert(reqVO); dictDataMapper.updateById(updateObj); + // å‘é€åˆ·æ–°æ¶ˆæ¯ dictDataProducer.sendDictDataRefreshMessage(); } @@ -119,9 +200,11 @@ public class DictDataServiceImpl implements DictDataService { @Override public void deleteDictData(Long id) { // 校验是å¦å­˜åœ¨ - this.checkDictDataExists(id); + checkDictDataExists(id); + // åˆ é™¤å­—å…¸æ•°æ® dictDataMapper.deleteById(id); + // å‘é€åˆ·æ–°æ¶ˆæ¯ dictDataProducer.sendDictDataRefreshMessage(); } @@ -178,4 +261,22 @@ public class DictDataServiceImpl implements DictDataService { } } + @Override + public void validDictDatas(String dictType, Collection values) { + if (CollUtil.isEmpty(values)) { + return; + } + ImmutableMap dictDataMap = valueDictDataCache.row(dictType); + // 校验 + values.forEach(value -> { + SysDictDataDO dictData = dictDataMap.get(value); + if (dictData == null) { + throw exception(DICT_DATA_NOT_EXISTS); + } + if (!CommonStatusEnum.ENABLE.getStatus().equals(dictData.getStatus())) { + throw exception(DICT_DATA_NOT_ENABLE, dictData.getLabel()); + } + }); + } + } diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictTypeServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictTypeServiceImpl.java index 222269b51..b9bcaf61e 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictTypeServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/dict/DictTypeServiceImpl.java @@ -54,7 +54,7 @@ public class DictTypeServiceImpl implements DictTypeService { @Override public Long createDictType(DictTypeCreateReqVO reqVO) { // 校验正确性 - this.checkCreateOrUpdate(null, reqVO.getName(), reqVO.getType()); + checkCreateOrUpdate(null, reqVO.getName(), reqVO.getType()); // æ’入字典类型 DictTypeDO dictType = DictTypeConvert.INSTANCE.convert(reqVO); dictTypeMapper.insert(dictType); @@ -64,7 +64,7 @@ public class DictTypeServiceImpl implements DictTypeService { @Override public void updateDictType(DictTypeUpdateReqVO reqVO) { // 校验正确性 - this.checkCreateOrUpdate(reqVO.getId(), reqVO.getName(), null); + checkCreateOrUpdate(reqVO.getId(), reqVO.getName(), null); // 更新字典类型 DictTypeDO updateObj = DictTypeConvert.INSTANCE.convert(reqVO); dictTypeMapper.updateById(updateObj); @@ -73,7 +73,7 @@ public class DictTypeServiceImpl implements DictTypeService { @Override public void deleteDictType(Long id) { // 校验是å¦å­˜åœ¨ - DictTypeDO dictType = this.checkDictTypeExists(id); + DictTypeDO dictType = checkDictTypeExists(id); // 校验是å¦æœ‰å­—å…¸æ•°æ® if (dictDataService.countByDictType(dictType.getType()) > 0) { throw exception(DICT_TYPE_HAS_CHILDREN); diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/logger/LoginLogService.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/logger/LoginLogService.java index 7643fe115..f900f0bae 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/logger/LoginLogService.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/logger/LoginLogService.java @@ -2,8 +2,9 @@ package cn.iocoder.yudao.module.system.service.logger; import cn.iocoder.yudao.module.system.controller.admin.logger.vo.loginlog.LoginLogExportReqVO; import cn.iocoder.yudao.module.system.controller.admin.logger.vo.loginlog.LoginLogPageReqVO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.logger.SysLoginLogDO; +import cn.iocoder.yudao.module.system.dal.dataobject.logger.SysLoginLogDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.system.service.logger.dto.LoginLogCreateReqDTO; import java.util.List; @@ -28,4 +29,11 @@ public interface LoginLogService { */ List getLoginLogList(LoginLogExportReqVO reqVO); + /** + * 创建登录日志 + * + * @param reqDTO æ—¥å¿—ä¿¡æ¯ + */ + void createLoginLog(LoginLogCreateReqDTO reqDTO); + } diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/logger/LoginLogServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/logger/LoginLogServiceImpl.java index d2f35aee8..c35274872 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/logger/LoginLogServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/logger/LoginLogServiceImpl.java @@ -2,9 +2,12 @@ package cn.iocoder.yudao.module.system.service.logger; import cn.iocoder.yudao.module.system.controller.admin.logger.vo.loginlog.LoginLogExportReqVO; import cn.iocoder.yudao.module.system.controller.admin.logger.vo.loginlog.LoginLogPageReqVO; +import cn.iocoder.yudao.module.system.convert.logger.SysLoginLogCoreConvert; import cn.iocoder.yudao.module.system.dal.mysql.logger.LoginLogMapper; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.logger.SysLoginLogDO; +import cn.iocoder.yudao.module.system.dal.dataobject.logger.SysLoginLogDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.system.dal.mysql.logger.SysLoginLogCoreMapper; +import cn.iocoder.yudao.module.system.service.logger.dto.LoginLogCreateReqDTO; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -29,4 +32,11 @@ public class LoginLogServiceImpl implements LoginLogService { return loginLogMapper.selectList(reqVO); } + @Override + public void createLoginLog(LoginLogCreateReqDTO reqDTO) { + SysLoginLogDO loginLog = SysLoginLogCoreConvert.INSTANCE.convert(reqDTO); + // æ’å…¥ + loginLogMapper.insert(loginLog); + } + } diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/logger/OperateLogServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/logger/OperateLogServiceImpl.java index fab8ddfaa..d32b0e505 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/logger/OperateLogServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/logger/OperateLogServiceImpl.java @@ -8,7 +8,7 @@ import cn.iocoder.yudao.module.system.convert.logger.OperateLogConvert; import cn.iocoder.yudao.module.system.dal.dataobject.logger.OperateLogDO; import cn.iocoder.yudao.module.system.dal.mysql.logger.OperateLogMapper; import cn.iocoder.yudao.module.system.service.user.UserService; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.UserDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.string.StrUtils; import cn.iocoder.yudao.framework.operatelog.core.dto.OperateLogCreateReqDTO; @@ -58,7 +58,7 @@ public class OperateLogServiceImpl implements OperateLogService { // 处ç†åŸºäºŽç”¨æˆ·æ˜µç§°çš„查询 Collection userIds = null; if (StrUtil.isNotEmpty(reqVO.getUserNickname())) { - userIds = convertSet(userService.getUsersByNickname(reqVO.getUserNickname()), SysUserDO::getId); + userIds = convertSet(userService.getUsersByNickname(reqVO.getUserNickname()), UserDO::getId); if (CollUtil.isEmpty(userIds)) { return PageResult.empty(); } @@ -72,7 +72,7 @@ public class OperateLogServiceImpl implements OperateLogService { // 处ç†åŸºäºŽç”¨æˆ·æ˜µç§°çš„查询 Collection userIds = null; if (StrUtil.isNotEmpty(reqVO.getUserNickname())) { - userIds = convertSet(userService.getUsersByNickname(reqVO.getUserNickname()), SysUserDO::getId); + userIds = convertSet(userService.getUsersByNickname(reqVO.getUserNickname()), UserDO::getId); if (CollUtil.isEmpty(userIds)) { return Collections.emptyList(); } diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/logger/dto/SysLoginLogCreateReqDTO.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/logger/dto/LoginLogCreateReqDTO.java similarity index 91% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/logger/dto/SysLoginLogCreateReqDTO.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/logger/dto/LoginLogCreateReqDTO.java index 4dddf9df8..5072053c9 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/logger/dto/SysLoginLogCreateReqDTO.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/logger/dto/LoginLogCreateReqDTO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.logger.dto; +package cn.iocoder.yudao.module.system.service.logger.dto; import lombok.Data; @@ -13,7 +13,7 @@ import javax.validation.constraints.Size; * @author 芋é“æºç  */ @Data -public class SysLoginLogCreateReqDTO { +public class LoginLogCreateReqDTO { /** * 日志类型 diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/permission/PermissionServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/permission/PermissionServiceImpl.java index b8da08730..d68e84993 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/permission/PermissionServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/permission/PermissionServiceImpl.java @@ -3,11 +3,11 @@ package cn.iocoder.yudao.module.system.service.permission; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ArrayUtil; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysDeptDO; import cn.iocoder.yudao.module.system.dal.dataobject.permission.MenuDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.permission.SysRoleDO; +import cn.iocoder.yudao.module.system.dal.dataobject.permission.SysRoleDO; import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleMenuDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.permission.SysUserRoleDO; +import cn.iocoder.yudao.module.system.dal.dataobject.permission.SysUserRoleDO; import cn.iocoder.yudao.module.system.dal.mysql.permission.SysRoleMenuMapper; import cn.iocoder.yudao.module.system.dal.mysql.permission.SysUserRoleMapper; import cn.iocoder.yudao.module.system.mq.producer.permission.PermissionProducer; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleService.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleService.java index 0bf13785d..def01146a 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleService.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleService.java @@ -5,7 +5,7 @@ import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RoleCr import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RoleExportReqVO; import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RolePageReqVO; import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RoleUpdateReqVO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.permission.SysRoleDO; +import cn.iocoder.yudao.module.system.dal.dataobject.permission.SysRoleDO; import org.springframework.lang.Nullable; import java.util.Collection; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleServiceImpl.java index cd8cbe819..095e87ddb 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/permission/RoleServiceImpl.java @@ -11,7 +11,7 @@ import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RolePa import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RoleUpdateReqVO; import cn.iocoder.yudao.module.system.convert.permission.RoleConvert; import cn.iocoder.yudao.module.system.dal.mysql.permission.SysRoleMapper; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.permission.SysRoleDO; +import cn.iocoder.yudao.module.system.dal.dataobject.permission.SysRoleDO; import cn.iocoder.yudao.module.system.enums.permission.RoleCodeEnum; import cn.iocoder.yudao.module.system.enums.permission.RoleTypeEnum; import cn.iocoder.yudao.module.system.mq.producer.permission.RoleProducer; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/permission/SysPermissionCoreService.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/permission/SysPermissionCoreService.java similarity index 86% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/permission/SysPermissionCoreService.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/permission/SysPermissionCoreService.java index 9f3032965..5898038c4 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/permission/SysPermissionCoreService.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/permission/SysPermissionCoreService.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.permission; +package cn.iocoder.yudao.module.system.service.permission; import java.util.Collection; import java.util.Set; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/permission/SysRoleCoreService.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/permission/SysRoleCoreService.java similarity index 83% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/permission/SysRoleCoreService.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/permission/SysRoleCoreService.java index 1b43e42f7..17e8adb87 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/permission/SysRoleCoreService.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/permission/SysRoleCoreService.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.permission; +package cn.iocoder.yudao.module.system.service.permission; import java.util.Collection; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/permission/impl/SysPermissionCoreServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/permission/impl/SysPermissionCoreServiceImpl.java similarity index 64% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/permission/impl/SysPermissionCoreServiceImpl.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/permission/impl/SysPermissionCoreServiceImpl.java index b9618a93d..100e076af 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/permission/impl/SysPermissionCoreServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/permission/impl/SysPermissionCoreServiceImpl.java @@ -1,8 +1,8 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.permission.impl; +package cn.iocoder.yudao.module.system.service.permission.impl; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.permission.SysUserRoleDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.mysql.permission.SysUserRoleCoreMapper; -import cn.iocoder.yudao.coreservice.modules.system.service.permission.SysPermissionCoreService; +import cn.iocoder.yudao.module.system.dal.dataobject.permission.SysUserRoleDO; +import cn.iocoder.yudao.module.system.dal.mysql.permission.SysUserRoleCoreMapper; +import cn.iocoder.yudao.module.system.service.permission.SysPermissionCoreService; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import org.springframework.stereotype.Service; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/permission/impl/SysRoleCoreServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/permission/impl/SysRoleCoreServiceImpl.java similarity index 70% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/permission/impl/SysRoleCoreServiceImpl.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/permission/impl/SysRoleCoreServiceImpl.java index ebeb7ea20..865eeb81e 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/permission/impl/SysRoleCoreServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/permission/impl/SysRoleCoreServiceImpl.java @@ -1,9 +1,9 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.permission.impl; +package cn.iocoder.yudao.module.system.service.permission.impl; import cn.hutool.core.collection.CollUtil; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.permission.SysRoleDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.mysql.permission.SysRoleCoreMapper; -import cn.iocoder.yudao.coreservice.modules.system.service.permission.SysRoleCoreService; +import cn.iocoder.yudao.module.system.dal.dataobject.permission.SysRoleDO; +import cn.iocoder.yudao.module.system.dal.mysql.permission.SysRoleCoreMapper; +import cn.iocoder.yudao.module.system.service.permission.SysRoleCoreService; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import org.springframework.stereotype.Service; @@ -13,8 +13,8 @@ import java.util.Collection; import java.util.List; import java.util.Map; -import static cn.iocoder.yudao.coreservice.modules.system.enums.SysErrorCodeConstants.ROLE_IS_DISABLE; -import static cn.iocoder.yudao.coreservice.modules.system.enums.SysErrorCodeConstants.ROLE_NOT_EXISTS; +import static cn.iocoder.yudao.module.system.enums.SysErrorCodeConstants.ROLE_IS_DISABLE; +import static cn.iocoder.yudao.module.system.enums.SysErrorCodeConstants.ROLE_NOT_EXISTS; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; /** diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsChannelService.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsChannelService.java index d57a990c8..f5950a23d 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsChannelService.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsChannelService.java @@ -1,6 +1,6 @@ package cn.iocoder.yudao.module.system.service.sms; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsChannelDO; +import cn.iocoder.yudao.module.system.dal.dataobject.sms.SysSmsChannelDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelCreateReqVO; import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelPageReqVO; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsChannelServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsChannelServiceImpl.java index 6c26e8203..ef95af5f2 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsChannelServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsChannelServiceImpl.java @@ -7,7 +7,7 @@ import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannel import cn.iocoder.yudao.module.system.convert.sms.SmsChannelConvert; import cn.iocoder.yudao.module.system.dal.mysql.sms.SysSmsChannelMapper; import cn.iocoder.yudao.module.system.mq.producer.sms.SmsProducer; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsChannelDO; +import cn.iocoder.yudao.module.system.dal.dataobject.sms.SysSmsChannelDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.sms.core.client.SmsClientFactory; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsLogService.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsLogService.java index fcd66e7a1..42c3457b6 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsLogService.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsLogService.java @@ -2,10 +2,13 @@ package cn.iocoder.yudao.module.system.service.sms; import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogExportReqVO; import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogPageReqVO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsLogDO; +import cn.iocoder.yudao.module.system.dal.dataobject.sms.SysSmsLogDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.system.dal.dataobject.sms.SysSmsTemplateDO; +import java.util.Date; import java.util.List; +import java.util.Map; /** * 短信日志 Service æŽ¥å£ @@ -15,6 +18,46 @@ import java.util.List; */ public interface SmsLogService { + /** + * 创建短信日志 + * + * @param mobile æ‰‹æœºå· + * @param userId ç”¨æˆ·ç¼–å· + * @param userType 用户类型 + * @param isSend 是å¦å‘é€ + * @param template çŸ­ä¿¡æ¨¡æ¿ + * @param templateContent 短信内容 + * @param templateParams 短信å‚æ•° + * @return å‘é€æ—¥å¿—ç¼–å· + */ + Long createSmsLog(String mobile, Long userId, Integer userType, Boolean isSend, + SysSmsTemplateDO template, String templateContent, Map templateParams); + + /** + * 更新日志的å‘é€ç»“æžœ + * + * @param id æ—¥å¿—ç¼–å· + * @param sendCode å‘é€ç»“æžœçš„ç¼–ç  + * @param sendMsg å‘é€ç»“果的æ示 + * @param apiSendCode 短信 API å‘é€ç»“æžœçš„ç¼–ç  + * @param apiSendMsg 短信 API å‘é€å¤±è´¥çš„æ示 + * @param apiRequestId 短信 API å‘é€è¿”回的唯一请求 ID + * @param apiSerialNo 短信 API å‘é€è¿”回的åºå· + */ + void updateSmsSendResult(Long id, Integer sendCode, String sendMsg, + String apiSendCode, String apiSendMsg, String apiRequestId, String apiSerialNo); + + /** + * 更新日志的接收结果 + * + * @param id æ—¥å¿—ç¼–å· + * @param success 是å¦æŽ¥æ”¶æˆåŠŸ + * @param receiveTime 用户接收时间 + * @param apiReceiveCode API æŽ¥æ”¶ç»“æžœçš„ç¼–ç  + * @param apiReceiveMsg API 接收结果的说明 + */ + void updateSmsReceiveResult(Long id, Boolean success, Date receiveTime, String apiReceiveCode, String apiReceiveMsg); + /** * 获得短信日志分页 * diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsLogServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsLogServiceImpl.java index d09b77e1d..a90f69f09 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsLogServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsLogServiceImpl.java @@ -1,21 +1,27 @@ package cn.iocoder.yudao.module.system.service.sms; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogExportReqVO; import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogPageReqVO; +import cn.iocoder.yudao.module.system.dal.dataobject.sms.SysSmsTemplateDO; import cn.iocoder.yudao.module.system.dal.mysql.sms.SysSmsLogMapper; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsLogDO; +import cn.iocoder.yudao.module.system.dal.dataobject.sms.SysSmsLogDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.system.enums.sms.SysSmsReceiveStatusEnum; +import cn.iocoder.yudao.module.system.enums.sms.SysSmsSendStatusEnum; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.Date; import java.util.List; +import java.util.Map; +import java.util.Objects; /** * 短信日志 Service 实现类 * * @author zzf - * @date 2021/1/25 9:25 */ @Slf4j @Service @@ -24,6 +30,50 @@ public class SmsLogServiceImpl implements SmsLogService { @Resource private SysSmsLogMapper smsLogMapper; + @Override + public Long createSmsLog(String mobile, Long userId, Integer userType, Boolean isSend, + SysSmsTemplateDO template, String templateContent, Map templateParams) { + SysSmsLogDO.SysSmsLogDOBuilder logBuilder = SysSmsLogDO.builder(); + // æ ¹æ®æ˜¯å¦è¦å‘é€ï¼Œè®¾ç½®çŠ¶æ€ + logBuilder.sendStatus(Objects.equals(isSend, true) ? SysSmsSendStatusEnum.INIT.getStatus() + : SysSmsSendStatusEnum.IGNORE.getStatus()); + // 设置手机相关字段 + logBuilder.mobile(mobile).userId(userId).userType(userType); + // 设置模æ¿ç›¸å…³å­—段 + logBuilder.templateId(template.getId()).templateCode(template.getCode()).templateType(template.getType()); + logBuilder.templateContent(templateContent).templateParams(templateParams).apiTemplateId(template.getApiTemplateId()); + // 设置渠é“相关字段 + logBuilder.channelId(template.getChannelId()).channelCode(template.getChannelCode()); + // 设置接收相关字段 + logBuilder.receiveStatus(SysSmsReceiveStatusEnum.INIT.getStatus()); + + // æ’入数æ®åº“ + SysSmsLogDO logDO = logBuilder.build(); + smsLogMapper.insert(logDO); + return logDO.getId(); + } + + @Override + public void updateSmsSendResult(Long id, Integer sendCode, String sendMsg, + String apiSendCode, String apiSendMsg, + String apiRequestId, String apiSerialNo) { + SysSmsSendStatusEnum sendStatus = CommonResult.isSuccess(sendCode) ? + SysSmsSendStatusEnum.SUCCESS : SysSmsSendStatusEnum.FAILURE; + smsLogMapper.updateById(SysSmsLogDO.builder().id(id).sendStatus(sendStatus.getStatus()) + .sendTime(new Date()).sendCode(sendCode).sendMsg(sendMsg) + .apiSendCode(apiSendCode).apiSendMsg(apiSendMsg) + .apiRequestId(apiRequestId).apiSerialNo(apiSerialNo).build()); + } + + @Override + public void updateSmsReceiveResult(Long id, Boolean success, Date receiveTime, + String apiReceiveCode, String apiReceiveMsg) { + SysSmsReceiveStatusEnum receiveStatus = Objects.equals(success, true) ? + SysSmsReceiveStatusEnum.SUCCESS : SysSmsReceiveStatusEnum.FAILURE; + smsLogMapper.updateById(SysSmsLogDO.builder().id(id).receiveStatus(receiveStatus.getStatus()) + .receiveTime(receiveTime).apiReceiveCode(apiReceiveCode).apiReceiveMsg(apiReceiveMsg).build()); + } + @Override public PageResult getSmsLogPage(SmsLogPageReqVO pageReqVO) { return smsLogMapper.selectPage(pageReqVO); diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsTemplateService.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsTemplateService.java index 397ff9faa..bf00dabff 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsTemplateService.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsTemplateService.java @@ -4,12 +4,13 @@ import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTempla import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateExportReqVO; import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplatePageReqVO; import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateUpdateReqVO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsTemplateDO; +import cn.iocoder.yudao.module.system.dal.dataobject.sms.SysSmsTemplateDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import javax.validation.Valid; import java.util.Collection; import java.util.List; +import java.util.Map; /** * çŸ­ä¿¡æ¨¡æ¿ Service æŽ¥å£ @@ -19,6 +20,28 @@ import java.util.List; */ public interface SmsTemplateService { + /** + * åˆå§‹åŒ–短信模æ¿çš„本地缓存 + */ + void initLocalCache(); + + /** + * 获得短信模æ¿ï¼Œä»Žç¼“存中 + * + * @param code 模æ¿ç¼–ç  + * @return çŸ­ä¿¡æ¨¡æ¿ + */ + SysSmsTemplateDO getSmsTemplateByCodeFromCache(String code); + + /** + * æ ¼å¼åŒ–短信内容 + * + * @param content 短信模æ¿çš„内容 + * @param params 内容的å‚æ•° + * @return æ ¼å¼åŒ–åŽçš„内容 + */ + String formatSmsTemplateContent(String content, Map params); + /** * èŽ·å¾—çŸ­ä¿¡æ¨¡æ¿ * diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsTemplateServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsTemplateServiceImpl.java index cc145d97e..24589abe4 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsTemplateServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SmsTemplateServiceImpl.java @@ -1,6 +1,9 @@ package cn.iocoder.yudao.module.system.service.sms; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.ReUtil; +import cn.hutool.core.util.StrUtil; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateCreateReqVO; import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateExportReqVO; import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplatePageReqVO; @@ -8,8 +11,8 @@ import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTempla import cn.iocoder.yudao.module.system.convert.sms.SmsTemplateConvert; import cn.iocoder.yudao.module.system.dal.mysql.sms.SysSmsTemplateMapper; import cn.iocoder.yudao.module.system.mq.producer.sms.SmsProducer; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsChannelDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsTemplateDO; +import cn.iocoder.yudao.module.system.dal.dataobject.sms.SysSmsChannelDO; +import cn.iocoder.yudao.module.system.dal.dataobject.sms.SysSmsTemplateDO; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.sms.core.client.SmsClient; @@ -17,14 +20,15 @@ import cn.iocoder.yudao.framework.sms.core.client.SmsClientFactory; import cn.iocoder.yudao.framework.sms.core.client.SmsCommonResult; import cn.iocoder.yudao.framework.sms.core.client.dto.SmsTemplateRespDTO; import com.google.common.annotations.VisibleForTesting; +import com.google.common.collect.ImmutableMap; import lombok.extern.slf4j.Slf4j; +import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Service; import org.springframework.util.Assert; +import javax.annotation.PostConstruct; import javax.annotation.Resource; -import java.util.Collection; -import java.util.List; -import java.util.Objects; +import java.util.*; import java.util.regex.Pattern; import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; @@ -40,6 +44,12 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU @Slf4j public class SmsTemplateServiceImpl implements SmsTemplateService { + /** + * 定时执行 {@link #schedulePeriodicRefresh()} 的周期 + * 因为已ç»é€šè¿‡ Redis Pub/Sub 机制,所以频率ä¸éœ€è¦é«˜ + */ + private static final long SCHEDULER_PERIOD = 5 * 60 * 1000L; + /** * 正则表达å¼ï¼ŒåŒ¹é… {} 中的å˜é‡ */ @@ -57,6 +67,72 @@ public class SmsTemplateServiceImpl implements SmsTemplateService { @Resource private SmsProducer smsProducer; + /** + * 短信模æ¿ç¼“å­˜ + * key:短信模æ¿ç¼–ç  {@link SysSmsTemplateDO#getCode()} + * + * 这里声明 volatile 修饰的原因是,æ¯æ¬¡åˆ·æ–°æ—¶ï¼Œç›´æŽ¥ä¿®æ”¹æŒ‡å‘ + */ + private volatile Map smsTemplateCache; + /** + * 缓存短信模æ¿çš„最大更新时间,用于åŽç»­çš„增é‡è½®è¯¢ï¼Œåˆ¤æ–­æ˜¯å¦æœ‰æ›´æ–° + */ + private volatile Date maxUpdateTime; + + @Override + @PostConstruct + public void initLocalCache() { + // 获å–短信模æ¿åˆ—表,如果有更新 + List smsTemplateList = this.loadSmsTemplateIfUpdate(maxUpdateTime); + if (CollUtil.isEmpty(smsTemplateList)) { + return; + } + + // 写入缓存 + ImmutableMap.Builder builder = ImmutableMap.builder(); + smsTemplateList.forEach(sysSmsTemplateDO -> builder.put(sysSmsTemplateDO.getCode(), sysSmsTemplateDO)); + smsTemplateCache = builder.build(); + assert smsTemplateList.size() > 0; // 断言,é¿å…å‘Šè­¦ + maxUpdateTime = smsTemplateList.stream().max(Comparator.comparing(BaseDO::getUpdateTime)).get().getUpdateTime(); + log.info("[initLocalCache][åˆå§‹åŒ– SmsTemplate æ•°é‡ä¸º {}]", smsTemplateList.size()); + } + + /** + * 如果短信模æ¿å‘生å˜åŒ–,从数æ®åº“中获å–最新的全é‡çŸ­ä¿¡æ¨¡æ¿ã€‚ + * 如果未å‘生å˜åŒ–,则返回空 + * + * @param maxUpdateTime 当å‰çŸ­ä¿¡æ¨¡æ¿çš„最大更新时间 + * @return 短信模æ¿åˆ—表 + */ + private List loadSmsTemplateIfUpdate(Date maxUpdateTime) { + // 第一步,判断是å¦è¦æ›´æ–°ã€‚ + if (maxUpdateTime == null) { // 如果更新时间为空,说明 DB ä¸€å®šæœ‰æ–°æ•°æ® + log.info("[loadSmsTemplateIfUpdate][首次加载全é‡çŸ­ä¿¡æ¨¡æ¿]"); + } else { // 判断数æ®åº“中是å¦æœ‰æ›´æ–°çš„çŸ­ä¿¡æ¨¡æ¿ + if (smsTemplateMapper.selectExistsByUpdateTimeAfter(maxUpdateTime) == null) { + return null; + } + log.info("[loadSmsTemplateIfUpdate][增é‡åŠ è½½å…¨é‡çŸ­ä¿¡æ¨¡æ¿]"); + } + // 第二步,如果有更新,则从数æ®åº“åŠ è½½æ‰€æœ‰çŸ­ä¿¡æ¨¡æ¿ + return smsTemplateMapper.selectList(); + } + + @Scheduled(fixedDelay = SCHEDULER_PERIOD, initialDelay = SCHEDULER_PERIOD) + public void schedulePeriodicRefresh() { + initLocalCache(); + } + + @Override + public SysSmsTemplateDO getSmsTemplateByCodeFromCache(String code) { + return smsTemplateCache.get(code); + } + + @Override + public String formatSmsTemplateContent(String content, Map params) { + return StrUtil.format(content, params); + } + @Override public SysSmsTemplateDO getSmsTemplateByCode(String code) { return smsTemplateMapper.selectByCode(code); diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/SysSmsCoreService.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SysSmsSendService.java similarity index 79% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/SysSmsCoreService.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SysSmsSendService.java index 55f4d41e0..4c673935a 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/SysSmsCoreService.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SysSmsSendService.java @@ -1,19 +1,16 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.sms; +package cn.iocoder.yudao.module.system.service.sms; -import cn.iocoder.yudao.coreservice.modules.system.mq.message.sms.SysSmsSendMessage; +import cn.iocoder.yudao.module.system.mq.message.sms.SmsSendMessage; import java.util.List; import java.util.Map; /** - * 短信 Service Core æŽ¥å£ - * - * 接入方,通过调用 send 开头的方法,创建å‘é€çŸ­ä¿¡çš„任务到 MQ 中 - * åŽç»­ï¼Œyudao-admin-server ç›‘å¬ MQ,执行真正的短信å‘é€é€»è¾‘ + * 短信 Service å‘é€æŽ¥å£ * * @author 芋é“æºç  */ -public interface SysSmsCoreService { +public interface SysSmsSendService { /** * å‘é€å•æ¡çŸ­ä¿¡ç»™åŽå°ç”¨æˆ· @@ -49,7 +46,7 @@ public interface SysSmsCoreService { void sendBatchSms(List mobiles, List userIds, Integer userType, String templateCode, Map templateParams); - void doSendSms(SysSmsSendMessage message); + void doSendSms(SmsSendMessage message); /** * 接收短信的接收结果 diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/impl/SysSmsCoreServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SysSmsSendServiceImpl.java similarity index 76% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/impl/SysSmsCoreServiceImpl.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SysSmsSendServiceImpl.java index 787d2a1d9..b6737fbdf 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/impl/SysSmsCoreServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/sms/SysSmsSendServiceImpl.java @@ -1,15 +1,10 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.sms.impl; +package cn.iocoder.yudao.module.system.service.sms; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsTemplateDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; -import cn.iocoder.yudao.coreservice.modules.system.mq.message.sms.SysSmsSendMessage; -import cn.iocoder.yudao.coreservice.modules.system.mq.producer.sms.SysSmsCoreProducer; -import cn.iocoder.yudao.coreservice.modules.system.service.sms.SysSmsCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.sms.SysSmsLogCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.sms.SysSmsTemplateCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService; +import cn.iocoder.yudao.module.system.dal.dataobject.sms.SysSmsTemplateDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.UserDO; +import cn.iocoder.yudao.module.system.mq.message.sms.SmsSendMessage; import cn.iocoder.yudao.framework.common.core.KeyValue; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; @@ -18,7 +13,10 @@ import cn.iocoder.yudao.framework.sms.core.client.SmsClientFactory; import cn.iocoder.yudao.framework.sms.core.client.SmsCommonResult; import cn.iocoder.yudao.framework.sms.core.client.dto.SmsReceiveRespDTO; import cn.iocoder.yudao.framework.sms.core.client.dto.SmsSendRespDTO; +import cn.iocoder.yudao.module.system.mq.producer.sms.SmsProducer; +import cn.iocoder.yudao.module.system.service.user.UserService; import com.google.common.annotations.VisibleForTesting; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.util.Assert; @@ -27,35 +25,36 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; -import static cn.iocoder.yudao.coreservice.modules.system.enums.SysErrorCodeConstants.*; +import static cn.iocoder.yudao.module.system.enums.SysErrorCodeConstants.*; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; /** - * 短信 Service Core 实现 + * 短信 Service å‘é€çš„实现 * * @author 芋é“æºç  */ @Service -public class SysSmsCoreServiceImpl implements SysSmsCoreService { +public class SysSmsSendServiceImpl implements SysSmsSendService { + @Autowired + @SuppressWarnings("SpringJavaAutowiredFieldsWarningInspection") // UserService 存在é‡å + private UserService userService; @Resource - private SysUserCoreService sysUserCoreService; + private SmsTemplateService smsTemplateService; @Resource - private SysSmsTemplateCoreService smsTemplateCoreService; - @Resource - private SysSmsLogCoreService smsLogCoreService; + private SmsLogService smsLogService; @Resource private SmsClientFactory smsClientFactory; @Resource - private SysSmsCoreProducer smsCoreProducer; + private SmsProducer smsProducer; @Override public Long sendSingleSmsToAdmin(String mobile, Long userId, String templateCode, Map templateParams) { // 如果 mobile 为空,则加载用户编å·å¯¹åº”çš„æ‰‹æœºå· if (StrUtil.isEmpty(mobile)) { - SysUserDO user = sysUserCoreService.getUser(userId); + UserDO user = userService.getUser(userId); if (user != null) { mobile = user.getMobile(); } @@ -90,12 +89,12 @@ public class SysSmsCoreServiceImpl implements SysSmsCoreService { // 创建å‘é€æ—¥å¿— Boolean isSend = CommonStatusEnum.ENABLE.getStatus().equals(template.getStatus()); // 如果模æ¿è¢«ç¦ç”¨ï¼Œåˆ™ä¸å‘é€çŸ­ä¿¡ï¼Œåªè®°å½•æ—¥å¿— - String content = smsTemplateCoreService.formatSmsTemplateContent(template.getContent(), templateParams); - Long sendLogId = smsLogCoreService.createSmsLog(mobile, userId, userType, isSend, template, content, templateParams); + String content = smsTemplateService.formatSmsTemplateContent(template.getContent(), templateParams); + Long sendLogId = smsLogService.createSmsLog(mobile, userId, userType, isSend, template, content, templateParams); // å‘é€ MQ 消æ¯ï¼Œå¼‚步执行å‘é€çŸ­ä¿¡ if (isSend) { - smsCoreProducer.sendSmsSendMessage(sendLogId, mobile, template.getChannelId(), + smsProducer.sendSmsSendMessage(sendLogId, mobile, template.getChannelId(), template.getApiTemplateId(), newTemplateParams); } return sendLogId; @@ -110,7 +109,7 @@ public class SysSmsCoreServiceImpl implements SysSmsCoreService { @VisibleForTesting public SysSmsTemplateDO checkSmsTemplateValid(String templateCode) { // 获得短信模æ¿ã€‚è€ƒè™‘åˆ°æ•ˆçŽ‡ï¼Œä»Žç¼“å­˜ä¸­èŽ·å– - SysSmsTemplateDO template = smsTemplateCoreService.getSmsTemplateByCodeFromCache(templateCode); + SysSmsTemplateDO template = smsTemplateService.getSmsTemplateByCodeFromCache(templateCode); // 短信模æ¿ä¸å­˜åœ¨ if (template == null) { throw exception(SMS_SEND_TEMPLATE_NOT_EXISTS); @@ -146,16 +145,15 @@ public class SysSmsCoreServiceImpl implements SysSmsCoreService { return mobile; } - @Override - public void doSendSms(SysSmsSendMessage message) { + public void doSendSms(SmsSendMessage message) { // 获得渠é“对应的 SmsClient 客户端 SmsClient smsClient = smsClientFactory.getSmsClient(message.getChannelId()); Assert.notNull(smsClient, String.format("短信客户端(%d) ä¸å­˜åœ¨", message.getChannelId())); // å‘é€çŸ­ä¿¡ SmsCommonResult sendResult = smsClient.sendSms(message.getLogId(), message.getMobile(), message.getApiTemplateId(), message.getTemplateParams()); - smsLogCoreService.updateSmsSendResult(message.getLogId(), sendResult.getCode(), sendResult.getMsg(), + smsLogService.updateSmsSendResult(message.getLogId(), sendResult.getCode(), sendResult.getMsg(), sendResult.getApiCode(), sendResult.getApiMsg(), sendResult.getApiRequestId(), sendResult.getData() != null ? sendResult.getData().getSerialNo() : null); } @@ -171,7 +169,7 @@ public class SysSmsCoreServiceImpl implements SysSmsCoreService { return; } // 更新短信日志的接收结果. 因为é‡ä¸€èˆ¬ä¸å¤§ï¼Œæ‰€ä»¥å…ˆä½¿ç”¨ for 循环更新 - receiveResults.forEach(result -> smsLogCoreService.updateSmsReceiveResult(result.getLogId(), + receiveResults.forEach(result -> smsLogService.updateSmsReceiveResult(result.getLogId(), result.getSuccess(), result.getReceiveTime(), result.getErrorCode(), result.getErrorCode())); } diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/social/SysSocialCoreService.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialUserService.java similarity index 76% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/social/SysSocialCoreService.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialUserService.java index 17634b320..a6010503c 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/social/SysSocialCoreService.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialUserService.java @@ -1,8 +1,8 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.social; +package cn.iocoder.yudao.module.system.service.social; import cn.hutool.core.util.StrUtil; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.social.SysSocialUserDO; -import cn.iocoder.yudao.coreservice.modules.system.enums.social.SysSocialTypeEnum; +import cn.iocoder.yudao.module.system.dal.dataobject.social.SysSocialUserDO; +import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.exception.ServiceException; import me.zhyd.oauth.model.AuthUser; @@ -11,16 +11,16 @@ import javax.validation.constraints.NotNull; import java.util.List; /** - * 社交 Service 接å£ï¼Œä¾‹å¦‚说社交平å°çš„授æƒç™»å½• + * 社交用户 Service 接å£ï¼Œä¾‹å¦‚说社交平å°çš„授æƒç™»å½• * * @author 芋é“æºç  */ -public interface SysSocialCoreService { +public interface SocialUserService { /** * 获得社交平å°çš„æŽˆæƒ URL * - * @param type 社交平å°çš„类型 {@link SysSocialTypeEnum} + * @param type 社交平å°çš„类型 {@link SocialTypeEnum} * @param redirectUri é‡å®šå‘ URL * @return 社交平å°çš„æŽˆæƒ URL */ @@ -30,7 +30,7 @@ public interface SysSocialCoreService { * 获得授æƒçš„用户 * 如果授æƒå¤±è´¥ï¼Œåˆ™ä¼šæŠ›å‡º {@link ServiceException} 异常 * - * @param type 社交平å°çš„类型 {@link SysSocialTypeEnum} + * @param type 社交平å°çš„类型 {@link SocialTypeEnum} * @param code 授æƒç  * @param state state * @return 授æƒç”¨æˆ· @@ -46,7 +46,7 @@ public interface SysSocialCoreService { * 获得 unionId 对应的æŸä¸ªç¤¾äº¤å¹³å°çš„“所有â€ç¤¾äº¤ç”¨æˆ· * 注æ„,这里的“所有â€ï¼ŒæŒ‡çš„是类似ã€å¾®ä¿¡ã€‘å¹³å°ï¼ŒåŒ…括了å°ç¨‹åºã€å…¬ä¼—å·ã€PC 网站,他们的 unionId 是一致的 * - * @param type 社交平å°çš„类型 {@link SysSocialTypeEnum} + * @param type 社交平å°çš„类型 {@link SocialTypeEnum} * @param unionId 社交平å°çš„ unionId * @return 社交用户列表 * @param userTypeEnum 全局用户类型 @@ -66,7 +66,7 @@ public interface SysSocialCoreService { * 绑定社交用户 * * @param userId ç”¨æˆ·ç¼–å· - * @param type 社交平å°çš„类型 {@link SysSocialTypeEnum} + * @param type 社交平å°çš„类型 {@link SocialTypeEnum} * @param authUser 授æƒç”¨æˆ· * @param userTypeEnum 全局用户类型 */ @@ -76,7 +76,7 @@ public interface SysSocialCoreService { * å–消绑定社交用户 * * @param userId ç”¨æˆ·ç¼–å· - * @param type 社交平å°çš„类型 {@link SysSocialTypeEnum} + * @param type 社交平å°çš„类型 {@link SocialTypeEnum} * @param unionId 社交平å°çš„ unionId * @param userTypeEnum 全局用户类型 */ diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/social/impl/SysSocialCoreServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialUserServiceImpl.java similarity index 84% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/social/impl/SysSocialCoreServiceImpl.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialUserServiceImpl.java index 2d0979912..c5ccf20d0 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/social/impl/SysSocialCoreServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/social/SocialUserServiceImpl.java @@ -1,11 +1,10 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.social.impl; +package cn.iocoder.yudao.module.system.service.social; import cn.hutool.core.collection.CollUtil; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.social.SysSocialUserDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.mysql.social.SysSocialUserCoreMapper; -import cn.iocoder.yudao.coreservice.modules.system.dal.redis.social.SysSocialAuthUserRedisDAO; -import cn.iocoder.yudao.coreservice.modules.system.enums.social.SysSocialTypeEnum; -import cn.iocoder.yudao.coreservice.modules.system.service.social.SysSocialCoreService; +import cn.iocoder.yudao.module.system.dal.dataobject.social.SysSocialUserDO; +import cn.iocoder.yudao.module.system.dal.mysql.social.SysSocialUserMapper; +import cn.iocoder.yudao.module.system.dal.redis.social.SocialAuthUserRedisDAO; +import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.framework.common.util.http.HttpUtils; @@ -25,34 +24,34 @@ import javax.annotation.Resource; import java.util.List; import java.util.Objects; -import static cn.iocoder.yudao.coreservice.modules.system.enums.SysErrorCodeConstants.SOCIAL_AUTH_FAILURE; -import static cn.iocoder.yudao.coreservice.modules.system.enums.SysErrorCodeConstants.SOCIAL_UNBIND_NOT_SELF; +import static cn.iocoder.yudao.module.system.enums.SysErrorCodeConstants.SOCIAL_AUTH_FAILURE; +import static cn.iocoder.yudao.module.system.enums.SysErrorCodeConstants.SOCIAL_UNBIND_NOT_SELF; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.util.json.JsonUtils.toJsonString; /** - * 社交 Service 实现类 + * 社交用户 Service 实现类 * * @author 芋é“æºç  */ @Service @Validated @Slf4j -public class SysSocialCoreServiceImpl implements SysSocialCoreService { +public class SocialUserServiceImpl implements SocialUserService { @Resource private AuthRequestFactory authRequestFactory; @Resource - private SysSocialAuthUserRedisDAO authSocialUserRedisDAO; + private SocialAuthUserRedisDAO authSocialUserRedisDAO; @Resource - private SysSocialUserCoreMapper socialUserMapper; + private SysSocialUserMapper socialUserMapper; @Override public String getAuthorizeUrl(Integer type, String redirectUri) { // 获得对应的 AuthRequest 实现 - AuthRequest authRequest = authRequestFactory.get(SysSocialTypeEnum.valueOfType(type).getSource()); + AuthRequest authRequest = authRequestFactory.get(SocialTypeEnum.valueOfType(type).getSource()); // 生æˆè·³è½¬åœ°å€ String authorizeUri = authRequest.authorize(AuthStateUtils.createState()); return HttpUtils.replaceUrlQuery(authorizeUri, "redirect_uri", redirectUri); @@ -76,7 +75,7 @@ public class SysSocialCoreServiceImpl implements SysSocialCoreService { @Override public List getAllSocialUserList(Integer type, String unionId,UserTypeEnum userTypeEnum) { - List types = SysSocialTypeEnum.getRelationTypes(type); + List types = SocialTypeEnum.getRelationTypes(type); return socialUserMapper.selectListByTypeAndUnionId(userTypeEnum.getValue(), types, unionId); } @@ -141,7 +140,7 @@ public class SysSocialCoreServiceImpl implements SysSocialCoreService { @VisibleForTesting public void unbindOldSocialUser(Long userId, Integer type, String newUnionId, UserTypeEnum userTypeEnum) { - List types = SysSocialTypeEnum.getRelationTypes(type); + List types = SocialTypeEnum.getRelationTypes(type); List oldSocialUsers = socialUserMapper.selectListByTypeAndUserId( userTypeEnum.getValue(), types, userId); // 如果新è€çš„ unionId 是一致的,说明无需解绑 @@ -161,7 +160,7 @@ public class SysSocialCoreServiceImpl implements SysSocialCoreService { * @return 授æƒçš„用户 */ private AuthUser getAuthUser0(Integer type, AuthCallback authCallback) { - AuthRequest authRequest = authRequestFactory.get(SysSocialTypeEnum.valueOfType(type).getSource()); + AuthRequest authRequest = authRequestFactory.get(SocialTypeEnum.valueOfType(type).getSource()); AuthResponse authResponse = authRequest.login(authCallback); log.info("[getAuthUser0][è¯·æ±‚ç¤¾äº¤å¹³å° type({}) request({}) response({})]", type, toJsonString(authCallback), toJsonString(authResponse)); diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/tenant/SysTenantCoreService.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/tenant/SysTenantCoreService.java similarity index 75% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/tenant/SysTenantCoreService.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/tenant/SysTenantCoreService.java index f7bbab6ef..030531d85 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/tenant/SysTenantCoreService.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/tenant/SysTenantCoreService.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.tenant; +package cn.iocoder.yudao.module.system.service.tenant; import cn.iocoder.yudao.framework.tenant.core.service.TenantFrameworkService; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantService.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantService.java index 63ebfd5f3..8d2005ba6 100755 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantService.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantService.java @@ -4,7 +4,7 @@ import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.TenantCreateReq import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.TenantExportReqVO; import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.TenantPageReqVO; import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.TenantUpdateReqVO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.tenant.SysTenantDO; +import cn.iocoder.yudao.module.system.dal.dataobject.tenant.SysTenantDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import javax.validation.Valid; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantServiceImpl.java index 297dbbbcc..4b40236a1 100755 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/tenant/TenantServiceImpl.java @@ -6,7 +6,7 @@ import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.TenantPageReqVO import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.TenantUpdateReqVO; import cn.iocoder.yudao.module.system.convert.tenant.TenantConvert; import cn.iocoder.yudao.module.system.dal.mysql.tenant.SysTenantMapper; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.tenant.SysTenantDO; +import cn.iocoder.yudao.module.system.dal.dataobject.tenant.SysTenantDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/tenant/impl/SysTenantCoreServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/tenant/impl/SysTenantCoreServiceImpl.java similarity index 63% rename from yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/tenant/impl/SysTenantCoreServiceImpl.java rename to yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/tenant/impl/SysTenantCoreServiceImpl.java index 046e4187c..67b5acfe4 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/tenant/impl/SysTenantCoreServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/tenant/impl/SysTenantCoreServiceImpl.java @@ -1,8 +1,8 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.tenant.impl; +package cn.iocoder.yudao.module.system.service.tenant.impl; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.tenant.SysTenantDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.mysql.tenant.SysTenantCoreMapper; -import cn.iocoder.yudao.coreservice.modules.system.service.tenant.SysTenantCoreService; +import cn.iocoder.yudao.module.system.dal.dataobject.tenant.SysTenantDO; +import cn.iocoder.yudao.module.system.dal.mysql.tenant.SysTenantCoreMapper; +import cn.iocoder.yudao.module.system.service.tenant.SysTenantCoreService; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import org.springframework.stereotype.Service; diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/UserService.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/UserService.java index 15d62caf2..f4e9c63df 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/UserService.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/UserService.java @@ -1,10 +1,12 @@ package cn.iocoder.yudao.module.system.service.user; +import cn.hutool.core.collection.CollUtil; +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.*; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.system.dal.dataobject.user.UserDO; import java.io.InputStream; import java.util.*; @@ -92,7 +94,7 @@ public interface UserService { * @param username 用户å * @return ç”¨æˆ·å¯¹è±¡ä¿¡æ¯ */ - SysUserDO getUserByUsername(String username); + UserDO getUserByUsername(String username); /** * 获得用户分页列表 @@ -100,15 +102,61 @@ public interface UserService { * @param reqVO 分页æ¡ä»¶ * @return 分页列表 */ - PageResult getUserPage(UserPageReqVO reqVO); + PageResult getUserPage(UserPageReqVO reqVO); /** - * 获得用户 + * 通过用户 ID 查询用户 * - * @param id ç”¨æˆ·ç¼–å· - * @return 用户 + * @param id 用户ID + * @return ç”¨æˆ·å¯¹è±¡ä¿¡æ¯ */ - SysUserDO getUser(Long id); + UserDO getUser(Long id); + + /** + * 获得指定部门的用户数组 + * + * @param deptIds 部门数组 + * @return 用户数组 + */ + List getUsersByDeptIds(Collection deptIds); + + /** + * 获得指定岗ä½çš„用户数组 + * + * @param postIds å²—ä½æ•°ç»„ + * @return 用户数组 + */ + List getUsersByPostIds(Collection postIds); + + /** + * 获得用户列表 + * + * @param ids 用户编å·æ•°ç»„ + * @return 用户列表 + */ + List getUsers(Collection ids); + + /** + * 校验用户们是å¦æœ‰æ•ˆã€‚如下情况,视为无效: + * 1. 用户编å·ä¸å­˜åœ¨ + * 2. 用户被ç¦ç”¨ + * + * @param ids 用户编å·æ•°ç»„ + */ + void validUsers(Set ids); + + /** + * 获得用户 Map + * + * @param ids 用户编å·æ•°ç»„ + * @return 用户 Map + */ + default Map getUserMap(Collection ids) { + if (CollUtil.isEmpty(ids)) { + return new HashMap<>(); + } + return CollectionUtils.convertMap(getUsers(ids), UserDO::getId); + } /** * 获得用户列表 @@ -116,9 +164,7 @@ public interface UserService { * @param reqVO 列表请求 * @return 用户列表 */ - List getUsers(UserExportReqVO reqVO); - - + List getUsers(UserExportReqVO reqVO); /** * èŽ·å¾—ç”¨æˆ·åˆ—è¡¨ï¼ŒåŸºäºŽæ˜µç§°æ¨¡ç³ŠåŒ¹é… @@ -126,7 +172,7 @@ public interface UserService { * @param nickname 昵称 * @return 用户列表 */ - List getUsersByNickname(String nickname); + List getUsersByNickname(String nickname); /** * 获得用户列表,基于用户账å·æ¨¡ç³ŠåŒ¹é… @@ -134,7 +180,7 @@ public interface UserService { * @param username ç”¨æˆ·è´¦å· * @return 用户列表 */ - List getUsersByUsername(String username); + List getUsersByUsername(String username); /** * 批é‡å¯¼å…¥ç”¨æˆ· @@ -151,6 +197,6 @@ public interface UserService { * @param status çŠ¶æ€ * @return 用户们 */ - List getUsersByStatus(Integer status); + List getUsersByStatus(Integer status); } diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/UserServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/UserServiceImpl.java index d5d7faefc..1530d3bca 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/UserServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/UserServiceImpl.java @@ -4,23 +4,23 @@ import cn.hutool.core.collection.CollUtil; import cn.hutool.core.io.IoUtil; import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.StrUtil; -import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO; -import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO; -import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.*; -import cn.iocoder.yudao.module.system.convert.user.UserConvert; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysPostDO; -import cn.iocoder.yudao.module.system.dal.mysql.user.SysUserMapper; -import cn.iocoder.yudao.module.system.service.dept.DeptService; -import cn.iocoder.yudao.module.system.service.dept.PostService; -import cn.iocoder.yudao.module.system.service.permission.PermissionService; import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; -import cn.iocoder.yudao.coreservice.modules.system.service.dept.SysDeptCoreService; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.exception.ServiceException; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; +import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO; +import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO; +import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.*; +import cn.iocoder.yudao.module.system.convert.user.UserConvert; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysDeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysPostDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.UserDO; +import cn.iocoder.yudao.module.system.dal.mysql.user.UserMapper; +import cn.iocoder.yudao.module.system.service.dept.DeptService; +import cn.iocoder.yudao.module.system.service.dept.PostService; +import cn.iocoder.yudao.module.system.service.dept.SysDeptCoreService; +import cn.iocoder.yudao.module.system.service.permission.PermissionService; import com.google.common.annotations.VisibleForTesting; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; @@ -32,8 +32,10 @@ import javax.annotation.Resource; import java.io.InputStream; import java.util.*; -import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; +import static cn.iocoder.yudao.module.system.enums.SysErrorCodeConstants.USER_IS_DISABLE; +import static cn.iocoder.yudao.module.system.enums.SysErrorCodeConstants.USER_NOT_EXISTS; /** * 管ç†å‘˜ç”¨æˆ· Service 实现类 @@ -48,7 +50,7 @@ public class UserServiceImpl implements UserService { private String userInitPassword; @Resource(name = "sysUserMapper") // userMapper 存在é‡å - private SysUserMapper userMapper; + private UserMapper userMapper; @Resource private DeptService deptService; @@ -70,7 +72,7 @@ public class UserServiceImpl implements UserService { this.checkCreateOrUpdate(null, reqVO.getUsername(), reqVO.getMobile(), reqVO.getEmail(), reqVO.getDeptId(), reqVO.getPostIds()); // æ’入用户 - SysUserDO user = UserConvert.INSTANCE.convert(reqVO); + UserDO user = UserConvert.INSTANCE.convert(reqVO); user.setStatus(CommonStatusEnum.ENABLE.getStatus()); // é»˜è®¤å¼€å¯ user.setPassword(passwordEncoder.encode(reqVO.getPassword())); // åŠ å¯†å¯†ç  userMapper.insert(user); @@ -83,13 +85,13 @@ public class UserServiceImpl implements UserService { this.checkCreateOrUpdate(reqVO.getId(), reqVO.getUsername(), reqVO.getMobile(), reqVO.getEmail(), reqVO.getDeptId(), reqVO.getPostIds()); // 更新用户 - SysUserDO updateObj = UserConvert.INSTANCE.convert(reqVO); + UserDO updateObj = UserConvert.INSTANCE.convert(reqVO); userMapper.updateById(updateObj); } @Override public void updateUserLogin(Long id, String loginIp) { - userMapper.updateById(new SysUserDO().setId(id).setLoginIp(loginIp).setLoginDate(new Date())); + userMapper.updateById(new UserDO().setId(id).setLoginIp(loginIp).setLoginDate(new Date())); } @Override @@ -107,7 +109,7 @@ public class UserServiceImpl implements UserService { // 校验旧密ç å¯†ç  this.checkOldPassword(id, reqVO.getOldPassword()); // 执行更新 - SysUserDO updateObj = new SysUserDO().setId(id); + UserDO updateObj = new UserDO().setId(id); updateObj.setPassword(passwordEncoder.encode(reqVO.getNewPassword())); // åŠ å¯†å¯†ç  userMapper.updateById(updateObj); } @@ -118,7 +120,7 @@ public class UserServiceImpl implements UserService { // 存储文件 String avatar = fileService.createFile(IdUtil.fastUUID(), IoUtil.readBytes(avatarFile)); // 更新路径 - SysUserDO sysUserDO = new SysUserDO(); + UserDO sysUserDO = new UserDO(); sysUserDO.setId(id); sysUserDO.setAvatar(avatar); userMapper.updateById(sysUserDO); @@ -130,7 +132,7 @@ public class UserServiceImpl implements UserService { // 校验用户存在 this.checkUserExists(id); // æ›´æ–°å¯†ç  - SysUserDO updateObj = new SysUserDO(); + UserDO updateObj = new UserDO(); updateObj.setId(id); updateObj.setPassword(passwordEncoder.encode(password)); // åŠ å¯†å¯†ç  userMapper.updateById(updateObj); @@ -141,7 +143,7 @@ public class UserServiceImpl implements UserService { // 校验用户存在 this.checkUserExists(id); // æ›´æ–°çŠ¶æ€ - SysUserDO updateObj = new SysUserDO(); + UserDO updateObj = new UserDO(); updateObj.setId(id); updateObj.setStatus(status); userMapper.updateById(updateObj); @@ -158,33 +160,80 @@ public class UserServiceImpl implements UserService { } @Override - public SysUserDO getUserByUsername(String username) { + public UserDO getUserByUsername(String username) { return userMapper.selectByUsername(username); } @Override - public PageResult getUserPage(UserPageReqVO reqVO) { + public PageResult getUserPage(UserPageReqVO reqVO) { return userMapper.selectPage(reqVO, this.getDeptCondition(reqVO.getDeptId())); } @Override - public SysUserDO getUser(Long id) { + public UserDO getUser(Long id) { return userMapper.selectById(id); } @Override - public List getUsers(UserExportReqVO reqVO) { + public List getUsersByDeptIds(Collection deptIds) { + if (CollUtil.isEmpty(deptIds)) { + return Collections.emptyList(); + } + return userMapper.selectListByDeptIds(deptIds); + } + + @Override + public List getUsersByPostIds(Collection postIds) { + if (CollUtil.isEmpty(postIds)) { + return Collections.emptyList(); + } + // 过滤ä¸ç¬¦åˆæ¡ä»¶çš„ + // TODO 芋艿:暂时åªèƒ½å†…存过滤。解决方案:1ã€æ–°å»ºä¸€ä¸ªå…³è”表;2ã€åŸºäºŽ where + 函数;3ã€json å­—æ®µï¼Œé€‚åˆ mysql 8+ 版本 + List users = userMapper.selectList(); + users.removeIf(user -> !CollUtil.containsAny(user.getPostIds(), postIds)); + return users; + } + + @Override + public List getUsers(Collection ids) { + if (CollUtil.isEmpty(ids)) { + return Collections.emptyList(); + } + return userMapper.selectBatchIds(ids); + } + + @Override + public void validUsers(Set ids) { + if (CollUtil.isEmpty(ids)) { + return; + } + // 获得岗ä½ä¿¡æ¯ + List users = userMapper.selectBatchIds(ids); + Map userMap = CollectionUtils.convertMap(users, UserDO::getId); + // 校验 + ids.forEach(id -> { + UserDO user = userMap.get(id); + if (user == null) { + throw exception(USER_NOT_EXISTS); + } + if (!CommonStatusEnum.ENABLE.getStatus().equals(user.getStatus())) { + throw exception(USER_IS_DISABLE, user.getNickname()); + } + }); + } + + @Override + public List getUsers(UserExportReqVO reqVO) { return userMapper.selectList(reqVO, this.getDeptCondition(reqVO.getDeptId())); } - @Override - public List getUsersByNickname(String nickname) { + public List getUsersByNickname(String nickname) { return userMapper.selectListByNickname(nickname); } @Override - public List getUsersByUsername(String username) { + public List getUsersByUsername(String username) { return userMapper.selectListByUsername(username); } @@ -225,7 +274,7 @@ public class UserServiceImpl implements UserService { if (id == null) { return; } - SysUserDO user = userMapper.selectById(id); + UserDO user = userMapper.selectById(id); if (user == null) { throw exception(USER_NOT_EXISTS); } @@ -236,7 +285,7 @@ public class UserServiceImpl implements UserService { if (StrUtil.isBlank(username)) { return; } - SysUserDO user = userMapper.selectByUsername(username); + UserDO user = userMapper.selectByUsername(username); if (user == null) { return; } @@ -254,7 +303,7 @@ public class UserServiceImpl implements UserService { if (StrUtil.isBlank(email)) { return; } - SysUserDO user = userMapper.selectByEmail(email); + UserDO user = userMapper.selectByEmail(email); if (user == null) { return; } @@ -272,7 +321,7 @@ public class UserServiceImpl implements UserService { if (StrUtil.isBlank(mobile)) { return; } - SysUserDO user = userMapper.selectByMobile(mobile); + UserDO user = userMapper.selectByMobile(mobile); if (user == null) { return; } @@ -328,7 +377,7 @@ public class UserServiceImpl implements UserService { */ @VisibleForTesting public void checkOldPassword(Long id, String oldPassword) { - SysUserDO user = userMapper.selectById(id); + UserDO user = userMapper.selectById(id); if (user == null) { throw exception(USER_NOT_EXISTS); } @@ -355,7 +404,7 @@ public class UserServiceImpl implements UserService { return; } // 判断如果ä¸å­˜åœ¨ï¼Œåœ¨è¿›è¡Œæ’å…¥ - SysUserDO existUser = userMapper.selectByUsername(importUser.getUsername()); + UserDO existUser = userMapper.selectByUsername(importUser.getUsername()); if (existUser == null) { userMapper.insert(UserConvert.INSTANCE.convert(importUser) .setPassword(passwordEncoder.encode(userInitPassword))); // è®¾ç½®é»˜è®¤å¯†ç  @@ -367,7 +416,7 @@ public class UserServiceImpl implements UserService { respVO.getFailureUsernames().put(importUser.getUsername(), USER_USERNAME_EXISTS.getMsg()); return; } - SysUserDO updateUser = UserConvert.INSTANCE.convert(importUser); + UserDO updateUser = UserConvert.INSTANCE.convert(importUser); updateUser.setId(existUser.getId()); userMapper.updateById(updateUser); respVO.getUpdateUsernames().add(importUser.getUsername()); @@ -376,7 +425,7 @@ public class UserServiceImpl implements UserService { } @Override - public List getUsersByStatus(Integer status) { + public List getUsersByStatus(Integer status) { return userMapper.selectListByStatus(status); } diff --git a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/auth/AuthServiceImplTest.java b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/auth/AuthServiceImplTest.java index a306eea49..1ad03c06e 100644 --- a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/auth/AuthServiceImplTest.java +++ b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/auth/AuthServiceImplTest.java @@ -5,13 +5,11 @@ import cn.iocoder.yudao.module.system.enums.logger.LoginLogTypeEnum; import cn.iocoder.yudao.module.system.enums.logger.LoginResultEnum; import cn.iocoder.yudao.module.system.service.common.CaptchaService; import cn.iocoder.yudao.module.system.service.dept.PostService; +import cn.iocoder.yudao.module.system.service.logger.LoginLogService; import cn.iocoder.yudao.module.system.service.permission.PermissionService; import cn.iocoder.yudao.module.system.service.user.UserService; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; -import cn.iocoder.yudao.coreservice.modules.system.service.auth.SysUserSessionCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.logger.SysLoginLogCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.social.SysSocialCoreService; -import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService; +import cn.iocoder.yudao.module.system.dal.dataobject.user.UserDO; +import cn.iocoder.yudao.module.system.service.social.SocialUserService; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.framework.test.core.util.AssertUtils; @@ -48,8 +46,6 @@ public class AuthServiceImplTest extends BaseDbUnitTest { @MockBean private UserService userService; @MockBean - private SysUserCoreService userCoreService; - @MockBean private PermissionService permissionService; @MockBean private AuthenticationManager authenticationManager; @@ -58,11 +54,11 @@ public class AuthServiceImplTest extends BaseDbUnitTest { @MockBean private CaptchaService captchaService; @MockBean - private SysLoginLogCoreService loginLogCoreService; + private LoginLogService loginLogService; @MockBean - private SysUserSessionCoreService userSessionCoreService; + private UserSessionService userSessionService; @MockBean - private SysSocialCoreService socialService; + private SocialUserService socialService; @MockBean private PostService postService; @@ -76,7 +72,7 @@ public class AuthServiceImplTest extends BaseDbUnitTest { // 准备å‚æ•° String username = randomString(); // mock 方法 - SysUserDO user = randomPojo(SysUserDO.class, o -> o.setUsername(username)); + UserDO user = randomPojo(UserDO.class, o -> o.setUsername(username)); when(userService.getUserByUsername(eq(username))).thenReturn(user); // 调用 @@ -102,8 +98,8 @@ public class AuthServiceImplTest extends BaseDbUnitTest { // 准备å‚æ•° Long userId = randomLongId(); // mock 方法 01 - SysUserDO user = randomPojo(SysUserDO.class, o -> o.setId(userId)); - when(userCoreService.getUser(eq(userId))).thenReturn(user); + UserDO user = randomPojo(UserDO.class, o -> o.setId(userId)); + when(userService.getUser(eq(userId))).thenReturn(user); // mock 方法 02 Set roleIds = randomSet(Long.class); when(permissionService.getUserRoleIds(eq(userId), eq(singleton(CommonStatusEnum.ENABLE.getStatus())))) @@ -137,7 +133,7 @@ public class AuthServiceImplTest extends BaseDbUnitTest { // 调用, 并断言异常 assertServiceException(() -> authService.login(reqVO, userIp, userAgent), AUTH_LOGIN_CAPTCHA_NOT_FOUND); // 校验调用å‚æ•° - verify(loginLogCoreService, times(1)).createLoginLog( + verify(loginLogService, times(1)).createLoginLog( argThat(o -> o.getLogType().equals(LoginLogTypeEnum.LOGIN_USERNAME.getType()) && o.getResult().equals(LoginResultEnum.CAPTCHA_NOT_FOUND.getResult())) ); @@ -155,7 +151,7 @@ public class AuthServiceImplTest extends BaseDbUnitTest { // 调用, 并断言异常 assertServiceException(() -> authService.login(reqVO, userIp, userAgent), AUTH_LOGIN_CAPTCHA_CODE_ERROR); // 校验调用å‚æ•° - verify(loginLogCoreService, times(1)).createLoginLog( + verify(loginLogService, times(1)).createLoginLog( argThat(o -> o.getLogType().equals(LoginLogTypeEnum.LOGIN_USERNAME.getType()) && o.getResult().equals(LoginResultEnum.CAPTCHA_CODE_ERROR.getResult())) ); @@ -176,7 +172,7 @@ public class AuthServiceImplTest extends BaseDbUnitTest { assertServiceException(() -> authService.login(reqVO, userIp, userAgent), AUTH_LOGIN_BAD_CREDENTIALS); // 校验调用å‚æ•° verify(captchaService, times(1)).deleteCaptchaCode(reqVO.getUuid()); - verify(loginLogCoreService, times(1)).createLoginLog( + verify(loginLogService, times(1)).createLoginLog( argThat(o -> o.getLogType().equals(LoginLogTypeEnum.LOGIN_USERNAME.getType()) && o.getResult().equals(LoginResultEnum.BAD_CREDENTIALS.getResult())) ); @@ -197,7 +193,7 @@ public class AuthServiceImplTest extends BaseDbUnitTest { assertServiceException(() -> authService.login(reqVO, userIp, userAgent), AUTH_LOGIN_USER_DISABLED); // 校验调用å‚æ•° verify(captchaService, times(1)).deleteCaptchaCode(reqVO.getUuid()); - verify(loginLogCoreService, times(1)).createLoginLog( + verify(loginLogService, times(1)).createLoginLog( argThat(o -> o.getLogType().equals(LoginLogTypeEnum.LOGIN_USERNAME.getType()) && o.getResult().equals(LoginResultEnum.USER_DISABLED.getResult())) ); @@ -218,7 +214,7 @@ public class AuthServiceImplTest extends BaseDbUnitTest { assertServiceException(() -> authService.login(reqVO, userIp, userAgent), AUTH_LOGIN_FAIL_UNKNOWN); // 校验调用å‚æ•° verify(captchaService, times(1)).deleteCaptchaCode(reqVO.getUuid()); - verify(loginLogCoreService, times(1)).createLoginLog( + verify(loginLogService, times(1)).createLoginLog( argThat(o -> o.getLogType().equals(LoginLogTypeEnum.LOGIN_USERNAME.getType()) && o.getResult().equals(LoginResultEnum.UNKNOWN_ERROR.getResult())) ); @@ -246,13 +242,13 @@ public class AuthServiceImplTest extends BaseDbUnitTest { // mock 获得 User 拥有的角色编å·æ•°ç»„ when(permissionService.getUserRoleIds(userId, singleton(CommonStatusEnum.ENABLE.getStatus()))).thenReturn(userRoleIds); // mock 缓存登录用户到 Redis - when(userSessionCoreService.createUserSession(loginUser, userIp, userAgent)).thenReturn(sessionId); + when(userSessionService.createUserSession(loginUser, userIp, userAgent)).thenReturn(sessionId); // 调用, 并断言异常 String login = authService.login(reqVO, userIp, userAgent); assertEquals(sessionId, login); // 校验调用å‚æ•° verify(captchaService, times(1)).deleteCaptchaCode(reqVO.getUuid()); - verify(loginLogCoreService, times(1)).createLoginLog( + verify(loginLogService, times(1)).createLoginLog( argThat(o -> o.getLogType().equals(LoginLogTypeEnum.LOGIN_USERNAME.getType()) && o.getResult().equals(LoginResultEnum.SUCCESS.getResult())) ); @@ -264,12 +260,12 @@ public class AuthServiceImplTest extends BaseDbUnitTest { String token = randomString(); LoginUser loginUser = randomPojo(LoginUser.class); // mock - when(userSessionCoreService.getLoginUser(token)).thenReturn(loginUser); + when(userSessionService.getLoginUser(token)).thenReturn(loginUser); // 调用 authService.logout(token); // 校验调用å‚æ•° - verify(userSessionCoreService, times(1)).deleteUserSession(token); - verify(loginLogCoreService, times(1)).createLoginLog( + verify(userSessionService, times(1)).deleteUserSession(token); + verify(loginLogService, times(1)).createLoginLog( argThat(o -> o.getLogType().equals(LoginLogTypeEnum.LOGOUT_SELF.getType()) && o.getResult().equals(LoginResultEnum.SUCCESS.getResult())) ); diff --git a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/auth/UserSessionServiceImplTest.java b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/auth/UserSessionServiceImplTest.java index eea61a408..4ca912721 100644 --- a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/auth/UserSessionServiceImplTest.java +++ b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/auth/UserSessionServiceImplTest.java @@ -1,14 +1,16 @@ package cn.iocoder.yudao.module.system.service.auth; import cn.hutool.core.date.DateUtil; +import cn.iocoder.yudao.framework.security.config.SecurityProperties; +import cn.iocoder.yudao.framework.security.core.LoginUser; import cn.iocoder.yudao.module.system.controller.admin.auth.vo.session.UserSessionPageReqVO; import cn.iocoder.yudao.module.system.dal.mysql.auth.SysUserSessionMapper; +import cn.iocoder.yudao.module.system.service.logger.LoginLogService; import cn.iocoder.yudao.module.system.service.user.UserService; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.auth.SysUserSessionDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.redis.auth.SysLoginUserCoreRedisDAO; -import cn.iocoder.yudao.coreservice.modules.system.enums.common.SysSexEnum; -import cn.iocoder.yudao.coreservice.modules.system.service.logger.SysLoginLogCoreService; +import cn.iocoder.yudao.module.system.dal.dataobject.auth.SysUserSessionDO; +import cn.iocoder.yudao.module.system.dal.dataobject.user.UserDO; +import cn.iocoder.yudao.module.system.dal.redis.auth.LoginUserRedisDAO; +import cn.iocoder.yudao.module.system.enums.common.SysSexEnum; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.pojo.PageResult; @@ -19,17 +21,19 @@ import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; import javax.annotation.Resource; +import java.time.Duration; import java.util.Date; import java.util.List; import java.util.stream.Collectors; import java.util.stream.Stream; import static cn.hutool.core.util.RandomUtil.randomEle; +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.addTime; import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; -import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; -import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomString; +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; import static java.util.Collections.singletonList; -import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; @@ -38,7 +42,7 @@ import static org.mockito.Mockito.when; * * @author Lyon */ -@Import({UserSessionServiceImpl.class}) +@Import({UserSessionServiceImpl.class, LoginUserRedisDAO.class}) public class UserSessionServiceImplTest extends BaseDbAndRedisUnitTest { @Resource @@ -50,14 +54,17 @@ public class UserSessionServiceImplTest extends BaseDbAndRedisUnitTest { @MockBean private UserService userService; @MockBean - private SysLoginLogCoreService loginLogCoreService; + private LoginLogService loginLogService; @MockBean - private SysLoginUserCoreRedisDAO loginUserCoreRedisDAO; + private LoginUserRedisDAO loginUserRedisDAO; + + @MockBean + private SecurityProperties securityProperties; @Test public void testGetUserSessionPage_success() { // mock æ•°æ® - SysUserDO dbUser = randomPojo(SysUserDO.class, o -> { + UserDO dbUser = randomPojo(UserDO.class, o -> { o.setSex(randomEle(SysSexEnum.values()).getSex()); o.setStatus(CommonStatusEnum.ENABLE.getStatus()); }); @@ -124,4 +131,89 @@ public class UserSessionServiceImplTest extends BaseDbAndRedisUnitTest { assertPojoEquals(sessionDO, userSessionDOS.get(0), "updateTime"); } + @Test + public void testCreateUserSession_success() { + // 准备å‚æ•° + String userIp = randomString(); + String userAgent = randomString(); + LoginUser loginUser = randomPojo(LoginUser.class, o -> { + o.setUserType(randomEle(UserTypeEnum.values()).getValue()); + o.setTenantId(0L); // 租户设置为 0,因为暂未å¯ç”¨å¤šç§Ÿæˆ·ç»„件 + }); + // mock 方法 + when(securityProperties.getSessionTimeout()).thenReturn(Duration.ofDays(1)); + + // 调用 + String sessionId = userSessionService.createUserSession(loginUser, userIp, userAgent); + // 校验 SysUserSessionDO 记录 + SysUserSessionDO userSessionDO = userSessionMapper.selectById(sessionId); + assertPojoEquals(loginUser, userSessionDO, "id", "updateTime"); + assertEquals(sessionId, userSessionDO.getId()); + assertEquals(userIp, userSessionDO.getUserIp()); + assertEquals(userAgent, userSessionDO.getUserAgent()); + // 校验 LoginUser 缓存 + LoginUser redisLoginUser = loginUserRedisDAO.get(sessionId); + assertPojoEquals(loginUser, redisLoginUser, "username", "password"); + } + + @Test + public void testCreateRefreshUserSession_success() { + // 准备å‚æ•° + String sessionId = randomString(); + String userIp = randomString(); + String userAgent = randomString(); + long timeLong = randomLongId(); + String userName = randomString(); + Date date = randomDate(); + LoginUser loginUser = randomPojo(LoginUser.class, o -> o.setUserType(randomEle(UserTypeEnum.values()).getValue())); + // mock 方法 + when(securityProperties.getSessionTimeout()).thenReturn(Duration.ofDays(1)); + // mock æ•°æ® + loginUser.setUpdateTime(date); + loginUserRedisDAO.set(sessionId, loginUser); + SysUserSessionDO userSession = SysUserSessionDO.builder().id(sessionId) + .userId(loginUser.getId()).userType(loginUser.getUserType()) + .userIp(userIp).userAgent(userAgent).username(userName) + .sessionTimeout(addTime(Duration.ofMillis(timeLong))) + .build(); + userSessionMapper.insert(userSession); + + // 调用 + userSessionService.refreshUserSession(sessionId, loginUser); + // 校验 LoginUser 缓存 + LoginUser redisLoginUser = loginUserRedisDAO.get(sessionId); + assertNotEquals(redisLoginUser.getUpdateTime(), date); + // 校验 SysUserSessionDO 记录 + SysUserSessionDO updateDO = userSessionMapper.selectById(sessionId); + assertEquals(updateDO.getUsername(), loginUser.getUsername()); + assertNotEquals(updateDO.getUpdateTime(), userSession.getUpdateTime()); + assertNotEquals(updateDO.getSessionTimeout(), addTime(Duration.ofMillis(timeLong))); + } + + @Test + public void testDeleteUserSession_success() { + // 准备å‚æ•° + String sessionId = randomString(); + String userIp = randomString(); + String userAgent = randomString(); + Long timeLong = randomLongId(); + LoginUser loginUser = randomPojo(LoginUser.class, o -> o.setUserType(randomEle(UserTypeEnum.values()).getValue())); + // mock 存入 Redis + when(securityProperties.getSessionTimeout()).thenReturn(Duration.ofDays(1)); + // mock æ•°æ® + loginUserRedisDAO.set(sessionId, loginUser); + SysUserSessionDO userSession = SysUserSessionDO.builder().id(sessionId) + .userId(loginUser.getId()).userType(loginUser.getUserType()) + .userIp(userIp).userAgent(userAgent).username(loginUser.getUsername()) + .sessionTimeout(addTime(Duration.ofMillis(timeLong))) + .build(); + userSessionMapper.insert(userSession); + + // 调用 + userSessionService.deleteUserSession(sessionId); + // 校验数æ®ä¸å­˜åœ¨äº† + assertNull(loginUserRedisDAO.get(sessionId)); + assertNull(userSessionMapper.selectById(sessionId)); + } + } diff --git a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceTest.java b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceTest.java index fe49ea2b3..bfda1290e 100644 --- a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceTest.java +++ b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/dept/DeptServiceTest.java @@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptCreateReqVO; import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptListReqVO; import cn.iocoder.yudao.module.system.controller.admin.dept.vo.dept.DeptUpdateReqVO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysDeptDO; import cn.iocoder.yudao.module.system.dal.mysql.dept.SysDeptMapper; import cn.iocoder.yudao.module.system.enums.dept.DeptIdEnum; import cn.iocoder.yudao.module.system.mq.producer.dept.DeptProducer; diff --git a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/dept/PostServiceTest.java b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/dept/PostServiceTest.java index df64ed2b1..d6bbab6f7 100644 --- a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/dept/PostServiceTest.java +++ b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/dept/PostServiceTest.java @@ -1,6 +1,6 @@ package cn.iocoder.yudao.module.system.service.dept; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysPostDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysPostDO; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; diff --git a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceTest.java b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceTest.java index 42217d3b7..e0f3d0e2b 100644 --- a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceTest.java +++ b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/dict/DictDataServiceTest.java @@ -1,6 +1,6 @@ package cn.iocoder.yudao.module.system.service.dict; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dict.SysDictDataDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dict.SysDictDataDO; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.system.controller.admin.dict.vo.data.DictDataCreateReqVO; @@ -13,14 +13,17 @@ import cn.iocoder.yudao.module.system.mq.producer.dict.DictDataProducer; import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; import cn.iocoder.yudao.module.system.test.BaseDbUnitTest; +import com.google.common.collect.ImmutableTable; import org.junit.jupiter.api.Test; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; import javax.annotation.Resource; +import java.util.Date; import java.util.List; import java.util.function.Consumer; +import static cn.hutool.core.bean.BeanUtil.getFieldValue; import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; @@ -42,6 +45,37 @@ public class DictDataServiceTest extends BaseDbUnitTest { @MockBean private DictDataProducer dictDataProducer; + /** + * 测试加载到新的字典数æ®çš„情况 + */ + @Test + @SuppressWarnings("unchecked") + public void testInitLocalCache() { + // mock æ•°æ® + SysDictDataDO dictData01 = randomDictDataDO(); + dictDataMapper.insert(dictData01); + SysDictDataDO dictData02 = randomDictDataDO(); + dictDataMapper.insert(dictData02); + + // 调用 + dictDataService.initLocalCache(); + // 断言 labelDictDataCache 缓存 + ImmutableTable labelDictDataCache = + (ImmutableTable) getFieldValue(dictDataService, "labelDictDataCache"); + assertEquals(2, labelDictDataCache.size()); + assertPojoEquals(dictData01, labelDictDataCache.get(dictData01.getDictType(), dictData01.getLabel())); + assertPojoEquals(dictData02, labelDictDataCache.get(dictData02.getDictType(), dictData02.getLabel())); + // 断言 valueDictDataCache 缓存 + ImmutableTable valueDictDataCache = + (ImmutableTable) getFieldValue(dictDataService, "valueDictDataCache"); + assertEquals(2, valueDictDataCache.size()); + assertPojoEquals(dictData01, valueDictDataCache.get(dictData01.getDictType(), dictData01.getValue())); + assertPojoEquals(dictData02, valueDictDataCache.get(dictData02.getDictType(), dictData02.getValue())); + // 断言 maxUpdateTime 缓存 + Date maxUpdateTime = (Date) getFieldValue(dictDataService, "maxUpdateTime"); + assertEquals(ObjectUtils.max(dictData01.getUpdateTime(), dictData02.getUpdateTime()), maxUpdateTime); + } + @Test public void testGetDictDataPage() { // mock æ•°æ® diff --git a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/logger/LoginLogServiceImplTest.java b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/logger/LoginLogServiceImplTest.java index 94778ef49..fdaf676da 100644 --- a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/logger/LoginLogServiceImplTest.java +++ b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/logger/LoginLogServiceImplTest.java @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.system.service.logger; import cn.hutool.core.util.RandomUtil; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.logger.SysLoginLogDO; +import cn.iocoder.yudao.module.system.dal.dataobject.logger.SysLoginLogDO; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils; @@ -12,6 +12,9 @@ import cn.iocoder.yudao.module.system.enums.logger.LoginLogTypeEnum; import cn.iocoder.yudao.module.system.enums.logger.LoginResultEnum; import cn.iocoder.yudao.framework.test.core.util.RandomUtils; import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; +import cn.iocoder.yudao.module.system.enums.logger.SysLoginLogTypeEnum; +import cn.iocoder.yudao.module.system.enums.logger.SysLoginResultEnum; +import cn.iocoder.yudao.module.system.service.logger.dto.LoginLogCreateReqDTO; import cn.iocoder.yudao.module.system.test.BaseDbUnitTest; import org.junit.jupiter.api.Test; import org.springframework.context.annotation.Import; @@ -19,6 +22,7 @@ import org.springframework.context.annotation.Import; import javax.annotation.Resource; import java.util.List; +import static cn.hutool.core.util.RandomUtil.randomEle; import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -27,7 +31,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; public class LoginLogServiceImplTest extends BaseDbUnitTest { @Resource - private LoginLogServiceImpl sysLoginLogService; + private LoginLogServiceImpl loginLogService; @Resource private LoginLogMapper loginLogMapper; @@ -68,7 +72,7 @@ public class LoginLogServiceImplTest extends BaseDbUnitTest { reqVO.setEndTime(buildTime(2021, 3, 7)); // 调用service方法 - PageResult pageResult = sysLoginLogService.getLoginLogPage(reqVO); + PageResult pageResult = loginLogService.getLoginLogPage(reqVO); // 断言,åªæŸ¥åˆ°äº†ä¸€æ¡ç¬¦åˆæ¡ä»¶çš„ assertEquals(1, pageResult.getTotal()); @@ -114,10 +118,28 @@ public class LoginLogServiceImplTest extends BaseDbUnitTest { // 调用service方法 - List loginLogList = sysLoginLogService.getLoginLogList(reqVO); + List loginLogList = loginLogService.getLoginLogList(reqVO); // 断言 assertEquals(1, loginLogList.size()); assertPojoEquals(loginLogDO, loginLogList.get(0)); } + + @Test + public void testCreateLoginLog() { + LoginLogCreateReqDTO reqDTO = RandomUtils.randomPojo(LoginLogCreateReqDTO.class, vo -> { + // 指定éšæœºçš„范围,é¿å…超出范围入库失败 + vo.setUserType(randomEle(UserTypeEnum.values()).getValue()); + vo.setLogType(randomEle(SysLoginLogTypeEnum.values()).getType()); + vo.setResult(randomEle(SysLoginResultEnum.values()).getResult()); + vo.setTraceId(TracerUtils.getTraceId()); + }); + + // 调用 + loginLogService.createLoginLog(reqDTO); + // 断言,忽略基本字段 + SysLoginLogDO sysLoginLogDO = loginLogMapper.selectOne(null); + assertPojoEquals(reqDTO, sysLoginLogDO); + } + } diff --git a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/logger/OperateLogServiceImplTest.java b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/logger/OperateLogServiceImplTest.java index 6f6edf4cf..2c9c2369a 100644 --- a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/logger/OperateLogServiceImplTest.java +++ b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/logger/OperateLogServiceImplTest.java @@ -6,8 +6,8 @@ import cn.iocoder.yudao.module.system.controller.admin.logger.vo.operatelog.Oper import cn.iocoder.yudao.module.system.dal.dataobject.logger.OperateLogDO; import cn.iocoder.yudao.module.system.dal.mysql.logger.OperateLogMapper; import cn.iocoder.yudao.module.system.service.user.UserService; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; -import cn.iocoder.yudao.coreservice.modules.system.enums.common.SysSexEnum; +import cn.iocoder.yudao.module.system.dal.dataobject.user.UserDO; +import cn.iocoder.yudao.module.system.enums.common.SysSexEnum; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants; import cn.iocoder.yudao.framework.common.pojo.PageResult; @@ -66,7 +66,7 @@ public class OperateLogServiceImplTest extends BaseDbUnitTest { public void testGetOperateLogPage() { // æž„é€ æµ‹è¯•æ•°æ® // 先构造用户 - SysUserDO user = RandomUtils.randomPojo(SysUserDO.class, o -> { + UserDO user = RandomUtils.randomPojo(UserDO.class, o -> { o.setNickname("wangkai"); o.setSex(SysSexEnum.MALE.getSex()); o.setStatus(CommonStatusEnum.ENABLE.getStatus()); @@ -117,7 +117,7 @@ public class OperateLogServiceImplTest extends BaseDbUnitTest { public void testGetOperateLogs() { // æž„é€ æµ‹è¯•æ•°æ® // 先构造用户 - SysUserDO user = RandomUtils.randomPojo(SysUserDO.class, o -> { + UserDO user = RandomUtils.randomPojo(UserDO.class, o -> { o.setNickname("wangkai"); o.setSex(SysSexEnum.MALE.getSex()); o.setStatus(CommonStatusEnum.ENABLE.getStatus()); diff --git a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/permission/PermissionServiceTest.java b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/permission/PermissionServiceTest.java index 3652c2ba3..9ff7d5d4c 100644 --- a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/permission/PermissionServiceTest.java +++ b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/permission/PermissionServiceTest.java @@ -1,10 +1,10 @@ package cn.iocoder.yudao.module.system.service.permission; import cn.hutool.core.collection.CollUtil; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.permission.SysRoleDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysDeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.permission.SysRoleDO; import cn.iocoder.yudao.module.system.dal.dataobject.permission.RoleMenuDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.permission.SysUserRoleDO; +import cn.iocoder.yudao.module.system.dal.dataobject.permission.SysUserRoleDO; import cn.iocoder.yudao.module.system.dal.mysql.permission.SysRoleMenuMapper; import cn.iocoder.yudao.module.system.dal.mysql.permission.SysUserRoleMapper; import cn.iocoder.yudao.module.system.mq.producer.permission.PermissionProducer; diff --git a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/permission/RoleServiceTest.java b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/permission/RoleServiceTest.java index 68e55926a..5c8475dfd 100644 --- a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/permission/RoleServiceTest.java +++ b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/permission/RoleServiceTest.java @@ -7,7 +7,7 @@ import cn.iocoder.yudao.framework.security.core.enums.DataScopeEnum; import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RoleCreateReqVO; import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RolePageReqVO; import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RoleUpdateReqVO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.permission.SysRoleDO; +import cn.iocoder.yudao.module.system.dal.dataobject.permission.SysRoleDO; import cn.iocoder.yudao.module.system.dal.mysql.permission.SysRoleMapper; import cn.iocoder.yudao.module.system.enums.permission.RoleTypeEnum; import cn.iocoder.yudao.module.system.mq.producer.permission.RoleProducer; diff --git a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsChannelServiceTest.java b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsChannelServiceTest.java index 28d6b2703..1233b2a76 100644 --- a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsChannelServiceTest.java +++ b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsChannelServiceTest.java @@ -6,7 +6,7 @@ import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannel import cn.iocoder.yudao.module.system.controller.admin.sms.vo.channel.SmsChannelUpdateReqVO; import cn.iocoder.yudao.module.system.dal.mysql.sms.SysSmsChannelMapper; import cn.iocoder.yudao.module.system.mq.producer.sms.SmsProducer; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsChannelDO; +import cn.iocoder.yudao.module.system.dal.dataobject.sms.SysSmsChannelDO; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; diff --git a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsLogServiceTest.java b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsLogServiceTest.java index e74389731..e06b9b0f4 100644 --- a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsLogServiceTest.java +++ b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsLogServiceTest.java @@ -1,13 +1,15 @@ package cn.iocoder.yudao.module.system.service.sms; import cn.hutool.core.map.MapUtil; +import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogExportReqVO; import cn.iocoder.yudao.module.system.controller.admin.sms.vo.log.SmsLogPageReqVO; +import cn.iocoder.yudao.module.system.dal.dataobject.sms.SysSmsTemplateDO; import cn.iocoder.yudao.module.system.dal.mysql.sms.SysSmsLogMapper; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsLogDO; -import cn.iocoder.yudao.coreservice.modules.system.enums.sms.SysSmsReceiveStatusEnum; -import cn.iocoder.yudao.coreservice.modules.system.enums.sms.SysSmsSendStatusEnum; -import cn.iocoder.yudao.coreservice.modules.system.enums.sms.SysSmsTemplateTypeEnum; +import cn.iocoder.yudao.module.system.dal.dataobject.sms.SysSmsLogDO; +import cn.iocoder.yudao.module.system.enums.sms.SysSmsReceiveStatusEnum; +import cn.iocoder.yudao.module.system.enums.sms.SysSmsSendStatusEnum; +import cn.iocoder.yudao.module.system.enums.sms.SysSmsTemplateTypeEnum; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; @@ -17,16 +19,18 @@ import org.junit.jupiter.api.Test; import org.springframework.context.annotation.Import; import javax.annotation.Resource; +import java.util.Date; import java.util.List; import java.util.Map; import java.util.function.Consumer; +import static cn.hutool.core.util.RandomUtil.randomBoolean; import static cn.hutool.core.util.RandomUtil.randomEle; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; -import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; -import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomString; +import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; @Import(SmsLogServiceImpl.class) public class SmsLogServiceTest extends BaseDbUnitTest { @@ -130,6 +134,93 @@ public class SmsLogServiceTest extends BaseDbUnitTest { assertPojoEquals(dbSmsLog, list.get(0)); } + @Test + public void testCreateSmsLog() { + // 准备å‚æ•° + String mobile = randomString(); + Long userId = randomLongId(); + Integer userType = randomEle(UserTypeEnum.values()).getValue(); + Boolean isSend = randomBoolean(); + SysSmsTemplateDO templateDO = randomPojo(SysSmsTemplateDO.class, + o -> o.setType(randomEle(SysSmsTemplateTypeEnum.values()).getType())); + String templateContent = randomString(); + Map templateParams = randomTemplateParams(); + // mock 方法 + + // 调用 + Long logId = smsLogService.createSmsLog(mobile, userId, userType, isSend, + templateDO, templateContent, templateParams); + // 断言 + SysSmsLogDO logDO = smsLogMapper.selectById(logId); + assertEquals(isSend ? SysSmsSendStatusEnum.INIT.getStatus() : SysSmsSendStatusEnum.IGNORE.getStatus(), + logDO.getSendStatus()); + assertEquals(mobile, logDO.getMobile()); + assertEquals(userType, logDO.getUserType()); + assertEquals(userId, logDO.getUserId()); + assertEquals(templateDO.getId(), logDO.getTemplateId()); + assertEquals(templateDO.getCode(), logDO.getTemplateCode()); + assertEquals(templateDO.getType(), logDO.getTemplateType()); + assertEquals(templateDO.getChannelId(), logDO.getChannelId()); + assertEquals(templateDO.getChannelCode(), logDO.getChannelCode()); + assertEquals(templateContent, logDO.getTemplateContent()); + assertEquals(templateParams, logDO.getTemplateParams()); + assertEquals(SysSmsReceiveStatusEnum.INIT.getStatus(), logDO.getReceiveStatus()); + } + + @Test + public void testUpdateSmsSendResult() { + // mock æ•°æ® + SysSmsLogDO dbSmsLog = randomSmsLogDO( + o -> o.setSendStatus(SysSmsSendStatusEnum.IGNORE.getStatus())); + smsLogMapper.insert(dbSmsLog); + // 准备å‚æ•° + Long id = dbSmsLog.getId(); + Integer sendCode = randomInteger(); + String sendMsg = randomString(); + String apiSendCode = randomString(); + String apiSendMsg = randomString(); + String apiRequestId = randomString(); + String apiSerialNo = randomString(); + + // 调用 + smsLogService.updateSmsSendResult(id, sendCode, sendMsg, + apiSendCode, apiSendMsg, apiRequestId, apiSerialNo); + // 断言 + dbSmsLog = smsLogMapper.selectById(id); + assertEquals(CommonResult.isSuccess(sendCode) ? SysSmsSendStatusEnum.SUCCESS.getStatus() + : SysSmsSendStatusEnum.FAILURE.getStatus(), dbSmsLog.getSendStatus()); + assertNotNull(dbSmsLog.getSendTime()); + assertEquals(sendMsg, dbSmsLog.getSendMsg()); + assertEquals(apiSendCode, dbSmsLog.getApiSendCode()); + assertEquals(apiSendMsg, dbSmsLog.getApiSendMsg()); + assertEquals(apiRequestId, dbSmsLog.getApiRequestId()); + assertEquals(apiSerialNo, dbSmsLog.getApiSerialNo()); + } + + @Test + public void testUpdateSmsReceiveResult() { + // mock æ•°æ® + SysSmsLogDO dbSmsLog = randomSmsLogDO( + o -> o.setReceiveStatus(SysSmsReceiveStatusEnum.INIT.getStatus())); + smsLogMapper.insert(dbSmsLog); + // 准备å‚æ•° + Long id = dbSmsLog.getId(); + Boolean success = randomBoolean(); + Date receiveTime = randomDate(); + String apiReceiveCode = randomString(); + String apiReceiveMsg = randomString(); + + // 调用 + smsLogService.updateSmsReceiveResult(id, success, receiveTime, apiReceiveCode, apiReceiveMsg); + // 断言 + dbSmsLog = smsLogMapper.selectById(id); + assertEquals(success ? SysSmsReceiveStatusEnum.SUCCESS.getStatus() + : SysSmsReceiveStatusEnum.FAILURE.getStatus(), dbSmsLog.getReceiveStatus()); + assertEquals(receiveTime, dbSmsLog.getReceiveTime()); + assertEquals(apiReceiveCode, dbSmsLog.getApiReceiveCode()); + assertEquals(apiReceiveMsg, dbSmsLog.getApiReceiveMsg()); + } + // ========== éšæœºå¯¹è±¡ ========== @SafeVarargs diff --git a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsTemplateServiceTest.java b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsTemplateServiceTest.java index 540c9a372..bd1ca2c58 100644 --- a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsTemplateServiceTest.java +++ b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/sms/SmsTemplateServiceTest.java @@ -6,9 +6,9 @@ import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTempla import cn.iocoder.yudao.module.system.controller.admin.sms.vo.template.SmsTemplateUpdateReqVO; import cn.iocoder.yudao.module.system.dal.mysql.sms.SysSmsTemplateMapper; import cn.iocoder.yudao.module.system.mq.producer.sms.SmsProducer; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsChannelDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsTemplateDO; -import cn.iocoder.yudao.coreservice.modules.system.enums.sms.SysSmsTemplateTypeEnum; +import cn.iocoder.yudao.module.system.dal.dataobject.sms.SysSmsChannelDO; +import cn.iocoder.yudao.module.system.dal.dataobject.sms.SysSmsTemplateDO; +import cn.iocoder.yudao.module.system.enums.sms.SysSmsTemplateTypeEnum; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants; import cn.iocoder.yudao.framework.common.pojo.PageResult; @@ -25,10 +25,14 @@ import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; import javax.annotation.Resource; +import java.util.Date; import java.util.List; +import java.util.Map; import java.util.function.Consumer; +import static cn.hutool.core.bean.BeanUtil.getFieldValue; import static cn.hutool.core.util.RandomUtil.randomEle; +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.max; import static cn.iocoder.yudao.module.system.enums.ErrorCodeConstants.*; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; @@ -56,6 +60,27 @@ public class SmsTemplateServiceTest extends BaseDbUnitTest { @MockBean private SmsProducer smsProducer; + @Test + @SuppressWarnings("unchecked") + void testInitLocalCache() { + // mock æ•°æ® + SysSmsTemplateDO smsTemplate01 = randomSmsTemplateDO(); + smsTemplateMapper.insert(smsTemplate01); + SysSmsTemplateDO smsTemplate02 = randomSmsTemplateDO(); + smsTemplateMapper.insert(smsTemplate02); + + // 调用 + smsTemplateService.initLocalCache(); + // 断言 deptCache 缓存 + Map smsTemplateCache = (Map) getFieldValue(smsTemplateService, "smsTemplateCache"); + assertEquals(2, smsTemplateCache.size()); + assertPojoEquals(smsTemplate01, smsTemplateCache.get(smsTemplate01.getCode())); + assertPojoEquals(smsTemplate02, smsTemplateCache.get(smsTemplate02.getCode())); + // 断言 maxUpdateTime 缓存 + Date maxUpdateTime = (Date) getFieldValue(smsTemplateService, "maxUpdateTime"); + assertEquals(max(smsTemplate01.getUpdateTime(), smsTemplate02.getUpdateTime()), maxUpdateTime); + } + @Test public void testParseTemplateContentParams() { // 准备å‚æ•° diff --git a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/SysSmsCoreServiceTest.java b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/sms/SysSmsSendServiceTest.java similarity index 70% rename from yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/SysSmsCoreServiceTest.java rename to yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/sms/SysSmsSendServiceTest.java index 97e1e3703..8cbe9b34e 100644 --- a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/sms/SysSmsCoreServiceTest.java +++ b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/sms/SysSmsSendServiceTest.java @@ -1,10 +1,9 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.sms; +package cn.iocoder.yudao.module.system.service.sms; import cn.hutool.core.map.MapUtil; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.sms.SysSmsTemplateDO; -import cn.iocoder.yudao.coreservice.modules.system.mq.message.sms.SysSmsSendMessage; -import cn.iocoder.yudao.coreservice.modules.system.mq.producer.sms.SysSmsCoreProducer; -import cn.iocoder.yudao.coreservice.modules.system.service.sms.impl.SysSmsCoreServiceImpl; +import cn.iocoder.yudao.module.system.dal.dataobject.sms.SysSmsTemplateDO; +import cn.iocoder.yudao.module.system.mq.message.sms.SmsSendMessage; +import cn.iocoder.yudao.module.system.mq.producer.sms.SmsProducer; import cn.iocoder.yudao.framework.common.core.KeyValue; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; @@ -24,29 +23,24 @@ import java.util.List; import java.util.Map; import static cn.hutool.core.util.RandomUtil.randomEle; -import static cn.iocoder.yudao.coreservice.modules.system.enums.SysErrorCodeConstants.*; +import static cn.iocoder.yudao.module.system.enums.SysErrorCodeConstants.*; import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.*; -/** - * {@link SysSmsCoreService} çš„å•å…ƒæµ‹è¯•ç±» - * - * @author 芋é“æºç  - */ -public class SysSmsCoreServiceTest extends BaseMockitoUnitTest { +public class SysSmsSendServiceTest extends BaseMockitoUnitTest { @InjectMocks - private SysSmsCoreServiceImpl smsCoreService; + private SysSmsSendServiceImpl smsService; @Mock - private SysSmsTemplateCoreService smsTemplateCoreService; + private SmsTemplateService smsTemplateService; @Mock - private SysSmsLogCoreService smsLogCoreService; + private SmsLogService smsLogService; @Mock - private SysSmsCoreProducer smsCoreProducer; + private SmsProducer smsProducer; @Mock private SmsClientFactory smsClientFactory; @@ -68,21 +62,21 @@ public class SysSmsCoreServiceTest extends BaseMockitoUnitTest { o.setContent("验è¯ç ä¸º{code}, æ“作为{op}"); o.setParams(Lists.newArrayList("code", "op")); }); - when(smsTemplateCoreService.getSmsTemplateByCodeFromCache(eq(templateCode))).thenReturn(template); + when(smsTemplateService.getSmsTemplateByCodeFromCache(eq(templateCode))).thenReturn(template); String content = randomString(); - when(smsTemplateCoreService.formatSmsTemplateContent(eq(template.getContent()), eq(templateParams))) + when(smsTemplateService.formatSmsTemplateContent(eq(template.getContent()), eq(templateParams))) .thenReturn(content); // mock SmsLogService 的方法 Long smsLogId = randomLongId(); - when(smsLogCoreService.createSmsLog(eq(mobile), eq(userId), eq(userType), eq(Boolean.TRUE), eq(template), + when(smsLogService.createSmsLog(eq(mobile), eq(userId), eq(userType), eq(Boolean.TRUE), eq(template), eq(content), eq(templateParams))).thenReturn(smsLogId); // 调用 - Long resultSmsLogId = smsCoreService.sendSingleSms(mobile, userId, userType, templateCode, templateParams); + Long resultSmsLogId = smsService.sendSingleSms(mobile, userId, userType, templateCode, templateParams); // 断言 assertEquals(smsLogId, resultSmsLogId); // 断言调用 - verify(smsCoreProducer, times(1)).sendSmsSendMessage(eq(smsLogId), eq(mobile), + verify(smsProducer, times(1)).sendSmsSendMessage(eq(smsLogId), eq(mobile), eq(template.getChannelId()), eq(template.getApiTemplateId()), eq(Lists.newArrayList(new KeyValue<>("code", "1234"), new KeyValue<>("op", "login")))); } @@ -105,21 +99,21 @@ public class SysSmsCoreServiceTest extends BaseMockitoUnitTest { o.setContent("验è¯ç ä¸º{code}, æ“作为{op}"); o.setParams(Lists.newArrayList("code", "op")); }); - when(smsTemplateCoreService.getSmsTemplateByCodeFromCache(eq(templateCode))).thenReturn(template); + when(smsTemplateService.getSmsTemplateByCodeFromCache(eq(templateCode))).thenReturn(template); String content = randomString(); - when(smsTemplateCoreService.formatSmsTemplateContent(eq(template.getContent()), eq(templateParams))) + when(smsTemplateService.formatSmsTemplateContent(eq(template.getContent()), eq(templateParams))) .thenReturn(content); // mock SmsLogService 的方法 Long smsLogId = randomLongId(); - when(smsLogCoreService.createSmsLog(eq(mobile), eq(userId), eq(userType), eq(Boolean.FALSE), eq(template), + when(smsLogService.createSmsLog(eq(mobile), eq(userId), eq(userType), eq(Boolean.FALSE), eq(template), eq(content), eq(templateParams))).thenReturn(smsLogId); // 调用 - Long resultSmsLogId = smsCoreService.sendSingleSms(mobile, userId, userType, templateCode, templateParams); + Long resultSmsLogId = smsService.sendSingleSms(mobile, userId, userType, templateCode, templateParams); // 断言 assertEquals(smsLogId, resultSmsLogId); // 断言调用 - verify(smsCoreProducer, times(0)).sendSmsSendMessage(anyLong(), anyString(), + verify(smsProducer, times(0)).sendSmsSendMessage(anyLong(), anyString(), anyLong(), any(), anyList()); } @@ -130,7 +124,7 @@ public class SysSmsCoreServiceTest extends BaseMockitoUnitTest { // mock 方法 // 调用,并断言异常 - assertServiceException(() -> smsCoreService.checkSmsTemplateValid(templateCode), + assertServiceException(() -> smsService.checkSmsTemplateValid(templateCode), SMS_SEND_TEMPLATE_NOT_EXISTS); } @@ -143,7 +137,7 @@ public class SysSmsCoreServiceTest extends BaseMockitoUnitTest { // mock 方法 // 调用,并断言异常 - assertServiceException(() -> smsCoreService.buildTemplateParams(template, templateParams), + assertServiceException(() -> smsService.buildTemplateParams(template, templateParams), SMS_SEND_MOBILE_TEMPLATE_PARAM_MISS, "code"); } @@ -153,7 +147,7 @@ public class SysSmsCoreServiceTest extends BaseMockitoUnitTest { // mock 方法 // 调用,并断言异常 - assertServiceException(() -> smsCoreService.checkMobile(null), + assertServiceException(() -> smsService.checkMobile(null), SMS_SEND_MOBILE_NOT_EXISTS); } @@ -161,7 +155,7 @@ public class SysSmsCoreServiceTest extends BaseMockitoUnitTest { @SuppressWarnings("unchecked") public void testDoSendSms() { // 准备å‚æ•° - SysSmsSendMessage message = randomPojo(SysSmsSendMessage.class); + SmsSendMessage message = randomPojo(SmsSendMessage.class); // mock SmsClientFactory 的方法 SmsClient smsClient = spy(SmsClient.class); when(smsClientFactory.getSmsClient(eq(message.getChannelId()))).thenReturn(smsClient); @@ -171,9 +165,9 @@ public class SysSmsCoreServiceTest extends BaseMockitoUnitTest { eq(message.getTemplateParams()))).thenReturn(sendResult); // 调用 - smsCoreService.doSendSms(message); + smsService.doSendSms(message); // 断言 - verify(smsLogCoreService, times(1)).updateSmsSendResult(eq(message.getLogId()), + verify(smsLogService, times(1)).updateSmsSendResult(eq(message.getLogId()), eq(sendResult.getCode()), eq(sendResult.getMsg()), eq(sendResult.getApiCode()), eq(sendResult.getApiMsg()), eq(sendResult.getApiRequestId()), eq(sendResult.getData().getSerialNo())); } @@ -190,9 +184,9 @@ public class SysSmsCoreServiceTest extends BaseMockitoUnitTest { List receiveResults = randomPojoList(SmsReceiveRespDTO.class); // 调用 - smsCoreService.receiveSmsStatus(channelCode, text); + smsService.receiveSmsStatus(channelCode, text); // 断言 - receiveResults.forEach(result -> smsLogCoreService.updateSmsReceiveResult(eq(result.getLogId()), eq(result.getSuccess()), + receiveResults.forEach(result -> smsLogService.updateSmsReceiveResult(eq(result.getLogId()), eq(result.getSuccess()), eq(result.getReceiveTime()), eq(result.getErrorCode()), eq(result.getErrorCode()))); } diff --git a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/social/SysSocialCoreServiceTest.java b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/social/SocialUsererviceTest.java similarity index 80% rename from yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/social/SysSocialCoreServiceTest.java rename to yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/social/SocialUsererviceTest.java index 2a33dd869..dc6d3a2d0 100644 --- a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/system/service/social/SysSocialCoreServiceTest.java +++ b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/social/SocialUsererviceTest.java @@ -1,12 +1,11 @@ -package cn.iocoder.yudao.coreservice.modules.system.service.social; +package cn.iocoder.yudao.module.system.service.social; -import cn.iocoder.yudao.coreservice.BaseDbAndRedisUnitTest; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.social.SysSocialUserDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.mysql.social.SysSocialUserCoreMapper; -import cn.iocoder.yudao.coreservice.modules.system.dal.redis.social.SysSocialAuthUserRedisDAO; -import cn.iocoder.yudao.coreservice.modules.system.enums.social.SysSocialTypeEnum; -import cn.iocoder.yudao.coreservice.modules.system.service.social.impl.SysSocialCoreServiceImpl; +import cn.iocoder.yudao.module.system.dal.dataobject.social.SysSocialUserDO; +import cn.iocoder.yudao.module.system.dal.mysql.social.SysSocialUserMapper; +import cn.iocoder.yudao.module.system.dal.redis.social.SocialAuthUserRedisDAO; +import cn.iocoder.yudao.module.system.enums.social.SocialTypeEnum; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; +import cn.iocoder.yudao.module.system.test.BaseDbAndRedisUnitTest; import com.xkcoding.justauth.AuthRequestFactory; import me.zhyd.oauth.model.AuthUser; import org.junit.jupiter.api.Test; @@ -23,19 +22,14 @@ import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; import static org.junit.jupiter.api.Assertions.assertEquals; -/** - * {@link SysSocialCoreServiceImpl} çš„å•å…ƒæµ‹è¯•ç±» - * - * @author 芋é“æºç  - */ -@Import({SysSocialCoreServiceImpl.class, SysSocialAuthUserRedisDAO.class}) -public class SysSocialCoreServiceTest extends BaseDbAndRedisUnitTest { +@Import({SocialUserServiceImpl.class, SocialAuthUserRedisDAO.class}) +public class SocialUsererviceTest extends BaseDbAndRedisUnitTest { @Resource - private SysSocialCoreServiceImpl socialService; + private SocialUserServiceImpl socialService; @Resource - private SysSocialUserCoreMapper socialUserMapper; + private SysSocialUserMapper socialUserMapper; @MockBean private AuthRequestFactory authRequestFactory; @@ -48,7 +42,7 @@ public class SysSocialCoreServiceTest extends BaseDbAndRedisUnitTest { // mock æ•°æ® // 准备å‚æ•° Long userId = randomLongId(); - Integer type = randomEle(SysSocialTypeEnum.values()).getType(); + Integer type = randomEle(SocialTypeEnum.values()).getType(); AuthUser authUser = randomPojo(AuthUser.class); // mock 方法 @@ -68,7 +62,7 @@ public class SysSocialCoreServiceTest extends BaseDbAndRedisUnitTest { // mock æ•°æ® SysSocialUserDO dbSocialUser = randomPojo(SysSocialUserDO.class, socialUserDO -> { socialUserDO.setUserType(UserTypeEnum.ADMIN.getValue()); - socialUserDO.setType(randomEle(SysSocialTypeEnum.values()).getType()); + socialUserDO.setType(randomEle(SocialTypeEnum.values()).getType()); }); socialUserMapper.insert(dbSocialUser); // 准备å‚æ•° @@ -93,7 +87,7 @@ public class SysSocialCoreServiceTest extends BaseDbAndRedisUnitTest { // mock æ•°æ® SysSocialUserDO dbSocialUser = randomPojo(SysSocialUserDO.class, socialUserDO -> { socialUserDO.setUserType(UserTypeEnum.ADMIN.getValue()); - socialUserDO.setType(randomEle(SysSocialTypeEnum.values()).getType()); + socialUserDO.setType(randomEle(SocialTypeEnum.values()).getType()); }); socialUserMapper.insert(dbSocialUser); // 准备å‚æ•° @@ -131,7 +125,7 @@ public class SysSocialCoreServiceTest extends BaseDbAndRedisUnitTest { // mock æ•°æ® SysSocialUserDO oldSocialUser = randomPojo(SysSocialUserDO.class, socialUserDO -> { socialUserDO.setUserType(UserTypeEnum.ADMIN.getValue()); - socialUserDO.setType(randomEle(SysSocialTypeEnum.values()).getType()); + socialUserDO.setType(randomEle(SocialTypeEnum.values()).getType()); }); socialUserMapper.insert(oldSocialUser); // 准备å‚æ•° @@ -154,7 +148,7 @@ public class SysSocialCoreServiceTest extends BaseDbAndRedisUnitTest { // mock æ•°æ® SysSocialUserDO oldSocialUser = randomPojo(SysSocialUserDO.class, socialUserDO -> { socialUserDO.setUserType(UserTypeEnum.ADMIN.getValue()); - socialUserDO.setType(randomEle(SysSocialTypeEnum.values()).getType()); + socialUserDO.setType(randomEle(SocialTypeEnum.values()).getType()); }); socialUserMapper.insert(oldSocialUser); // 准备å‚æ•° diff --git a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/tenant/TenantServiceTest.java b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/tenant/TenantServiceTest.java index 93b31c074..49c96cc5a 100644 --- a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/tenant/TenantServiceTest.java +++ b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/tenant/TenantServiceTest.java @@ -5,7 +5,7 @@ import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.TenantExportReq import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.TenantPageReqVO; import cn.iocoder.yudao.module.system.controller.admin.tenant.vo.TenantUpdateReqVO; import cn.iocoder.yudao.module.system.dal.mysql.tenant.SysTenantMapper; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.tenant.SysTenantDO; +import cn.iocoder.yudao.module.system.dal.dataobject.tenant.SysTenantDO; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.system.test.BaseDbUnitTest; diff --git a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/user/UserServiceImplTest.java b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/user/UserServiceImplTest.java index 8256f1de5..0667193f9 100644 --- a/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/user/UserServiceImplTest.java +++ b/yudao-module-system/yudao-module-system-impl/src/test/java/cn/iocoder/yudao/module/system/service/user/UserServiceImplTest.java @@ -5,16 +5,16 @@ import cn.hutool.core.util.RandomUtil; import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdatePasswordReqVO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.profile.UserProfileUpdateReqVO; import cn.iocoder.yudao.module.system.controller.admin.user.vo.user.*; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysDeptDO; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.dept.SysPostDO; -import cn.iocoder.yudao.module.system.dal.mysql.user.SysUserMapper; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysDeptDO; +import cn.iocoder.yudao.module.system.dal.dataobject.dept.SysPostDO; +import cn.iocoder.yudao.module.system.dal.mysql.user.UserMapper; import cn.iocoder.yudao.module.system.service.dept.DeptService; import cn.iocoder.yudao.module.system.service.dept.PostService; import cn.iocoder.yudao.module.system.service.permission.PermissionService; import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService; -import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; -import cn.iocoder.yudao.coreservice.modules.system.enums.common.SysSexEnum; -import cn.iocoder.yudao.coreservice.modules.system.service.dept.SysDeptCoreService; +import cn.iocoder.yudao.module.system.dal.dataobject.user.UserDO; +import cn.iocoder.yudao.module.system.enums.common.SysSexEnum; +import cn.iocoder.yudao.module.system.service.dept.SysDeptCoreService; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; @@ -52,7 +52,7 @@ public class UserServiceImplTest extends BaseDbUnitTest { private UserServiceImpl userService; @Resource - private SysUserMapper userMapper; + private UserMapper userMapper; @MockBean private DeptService deptService; @@ -94,7 +94,7 @@ public class UserServiceImplTest extends BaseDbUnitTest { // 调用 Long userId = userService.createUser(reqVO); // 断言 - SysUserDO user = userMapper.selectById(userId); + UserDO user = userMapper.selectById(userId); assertPojoEquals(reqVO, user, "password"); assertEquals("yudaoyuanma", user.getPassword()); assertEquals(CommonStatusEnum.ENABLE.getStatus(), user.getStatus()); @@ -103,7 +103,7 @@ public class UserServiceImplTest extends BaseDbUnitTest { @Test public void testUpdateUser_success() { // mock æ•°æ® - SysUserDO dbUser = randomSysUserDO(); + UserDO dbUser = randomSysUserDO(); userMapper.insert(dbUser); // 准备å‚æ•° UserUpdateReqVO reqVO = randomPojo(UserUpdateReqVO.class, o -> { @@ -128,14 +128,14 @@ public class UserServiceImplTest extends BaseDbUnitTest { // 调用 userService.updateUser(reqVO); // 断言 - SysUserDO user = userMapper.selectById(reqVO.getId()); + UserDO user = userMapper.selectById(reqVO.getId()); assertPojoEquals(reqVO, user); } @Test public void testUpdateUserProfile_success() { // mock æ•°æ® - SysUserDO dbUser = randomSysUserDO(); + UserDO dbUser = randomSysUserDO(); userMapper.insert(dbUser); // 准备å‚æ•° Long userId = dbUser.getId(); @@ -147,14 +147,14 @@ public class UserServiceImplTest extends BaseDbUnitTest { // 调用 userService.updateUserProfile(userId, reqVO); // 断言 - SysUserDO user = userMapper.selectById(userId); + UserDO user = userMapper.selectById(userId); assertPojoEquals(reqVO, user); } @Test public void testUpdateUserPassword_success() { // mock æ•°æ® - SysUserDO dbUser = randomSysUserDO(o -> o.setPassword("encode:yudao")); + UserDO dbUser = randomSysUserDO(o -> o.setPassword("encode:yudao")); userMapper.insert(dbUser); // 准备å‚æ•° Long userId = dbUser.getId(); @@ -170,14 +170,14 @@ public class UserServiceImplTest extends BaseDbUnitTest { // 调用 userService.updateUserPassword(userId, reqVO); // 断言 - SysUserDO user = userMapper.selectById(userId); + UserDO user = userMapper.selectById(userId); assertEquals("encode:yuanma", user.getPassword()); } @Test public void testUpdateUserAvatar_success() { // mock æ•°æ® - SysUserDO dbUser = randomSysUserDO(); + UserDO dbUser = randomSysUserDO(); userMapper.insert(dbUser); // 准备å‚æ•° Long userId = dbUser.getId(); @@ -190,14 +190,14 @@ public class UserServiceImplTest extends BaseDbUnitTest { // 调用 userService.updateUserAvatar(userId, avatarFile); // 断言 - SysUserDO user = userMapper.selectById(userId); + UserDO user = userMapper.selectById(userId); assertEquals(avatar, user.getAvatar()); } @Test public void testUpdateUserPassword02_success() { // mock æ•°æ® - SysUserDO dbUser = randomSysUserDO(); + UserDO dbUser = randomSysUserDO(); userMapper.insert(dbUser); // 准备å‚æ•° Long userId = dbUser.getId(); @@ -209,14 +209,14 @@ public class UserServiceImplTest extends BaseDbUnitTest { // 调用 userService.updateUserPassword(userId, password); // 断言 - SysUserDO user = userMapper.selectById(userId); + UserDO user = userMapper.selectById(userId); assertEquals("encode:" + password, user.getPassword()); } @Test public void testUpdateUserStatus() { // mock æ•°æ® - SysUserDO dbUser = randomSysUserDO(); + UserDO dbUser = randomSysUserDO(); userMapper.insert(dbUser); // 准备å‚æ•° Long userId = dbUser.getId(); @@ -225,14 +225,14 @@ public class UserServiceImplTest extends BaseDbUnitTest { // 调用 userService.updateUserStatus(userId, status); // 断言 - SysUserDO user = userMapper.selectById(userId); + UserDO user = userMapper.selectById(userId); assertEquals(status, user.getStatus()); } @Test public void testDeleteUser_success(){ // mock æ•°æ® - SysUserDO dbUser = randomSysUserDO(); + UserDO dbUser = randomSysUserDO(); userMapper.insert(dbUser); // 准备å‚æ•° Long userId = dbUser.getId(); @@ -248,7 +248,7 @@ public class UserServiceImplTest extends BaseDbUnitTest { @Test public void testGetUserPage() { // mock æ•°æ® - SysUserDO dbUser = initGetUserPageData(); + UserDO dbUser = initGetUserPageData(); // 准备å‚æ•° UserPageReqVO reqVO = new UserPageReqVO(); reqVO.setUsername("yudao"); @@ -262,7 +262,7 @@ public class UserServiceImplTest extends BaseDbUnitTest { when(deptService.getDeptsByParentIdFromCache(eq(reqVO.getDeptId()), eq(true))).thenReturn(deptList); // 调用 - PageResult pageResult = userService.getUserPage(reqVO); + PageResult pageResult = userService.getUserPage(reqVO); // 断言 assertEquals(1, pageResult.getTotal()); assertEquals(1, pageResult.getList().size()); @@ -272,7 +272,7 @@ public class UserServiceImplTest extends BaseDbUnitTest { @Test public void testGetUsers() { // mock æ•°æ® - SysUserDO dbUser = initGetUserPageData(); + UserDO dbUser = initGetUserPageData(); // 准备å‚æ•° UserExportReqVO reqVO = new UserExportReqVO(); reqVO.setUsername("yudao"); @@ -286,7 +286,7 @@ public class UserServiceImplTest extends BaseDbUnitTest { when(deptService.getDeptsByParentIdFromCache(eq(reqVO.getDeptId()), eq(true))).thenReturn(deptList); // 调用 - List list = userService.getUsers(reqVO); + List list = userService.getUsers(reqVO); // 断言 assertEquals(1, list.size()); assertPojoEquals(dbUser, list.get(0)); @@ -295,9 +295,9 @@ public class UserServiceImplTest extends BaseDbUnitTest { /** * åˆå§‹åŒ– getUserPage æ–¹æ³•çš„æµ‹è¯•æ•°æ® */ - private SysUserDO initGetUserPageData() { + private UserDO initGetUserPageData() { // mock æ•°æ® - SysUserDO dbUser = randomSysUserDO(o -> { // 等会查询到 + UserDO dbUser = randomSysUserDO(o -> { // 等会查询到 o.setUsername("yudaoyuanma"); o.setMobile("15601691300"); o.setStatus(CommonStatusEnum.ENABLE.getStatus()); @@ -359,7 +359,7 @@ public class UserServiceImplTest extends BaseDbUnitTest { UserImportRespVO respVO = userService.importUsers(newArrayList(importUser), true); // 断言 assertEquals(1, respVO.getCreateUsernames().size()); - SysUserDO user = userMapper.selectByUsername(respVO.getCreateUsernames().get(0)); + UserDO user = userMapper.selectByUsername(respVO.getCreateUsernames().get(0)); assertPojoEquals(importUser, user); assertEquals("java", user.getPassword()); assertEquals(0, respVO.getUpdateUsernames().size()); @@ -372,7 +372,7 @@ public class UserServiceImplTest extends BaseDbUnitTest { @Test public void testImportUsers_03() { // mock æ•°æ® - SysUserDO dbUser = randomSysUserDO(); + UserDO dbUser = randomSysUserDO(); userMapper.insert(dbUser); // 准备å‚æ•° UserImportExcelVO importUser = randomPojo(UserImportExcelVO.class, o -> { @@ -402,7 +402,7 @@ public class UserServiceImplTest extends BaseDbUnitTest { @Test public void testImportUsers_04() { // mock æ•°æ® - SysUserDO dbUser = randomSysUserDO(); + UserDO dbUser = randomSysUserDO(); userMapper.insert(dbUser); // 准备å‚æ•° UserImportExcelVO importUser = randomPojo(UserImportExcelVO.class, o -> { @@ -422,7 +422,7 @@ public class UserServiceImplTest extends BaseDbUnitTest { // 断言 assertEquals(0, respVO.getCreateUsernames().size()); assertEquals(1, respVO.getUpdateUsernames().size()); - SysUserDO user = userMapper.selectByUsername(respVO.getUpdateUsernames().get(0)); + UserDO user = userMapper.selectByUsername(respVO.getUpdateUsernames().get(0)); assertPojoEquals(importUser, user); assertEquals(0, respVO.getFailureUsernames().size()); } @@ -561,7 +561,7 @@ public class UserServiceImplTest extends BaseDbUnitTest { @Test public void testCheckOldPassword_passwordFailed() { // mock æ•°æ® - SysUserDO user = randomSysUserDO(); + UserDO user = randomSysUserDO(); userMapper.insert(user); // 准备å‚æ•° Long id = user.getId(); @@ -594,12 +594,12 @@ public class UserServiceImplTest extends BaseDbUnitTest { // ========== éšæœºå¯¹è±¡ ========== @SafeVarargs - private static SysUserDO randomSysUserDO(Consumer... consumers) { - Consumer consumer = (o) -> { + private static UserDO randomSysUserDO(Consumer... consumers) { + Consumer consumer = (o) -> { o.setStatus(randomEle(CommonStatusEnum.values()).getStatus()); // ä¿è¯ status 的范围 o.setSex(randomEle(SysSexEnum.values()).getSex()); // ä¿è¯ sex 的范围 }; - return randomPojo(SysUserDO.class, ArrayUtils.append(consumer, consumers)); + return randomPojo(UserDO.class, ArrayUtils.append(consumer, consumers)); } }