From 9bc9b2ac6bb717a4205bdf8ae0917cd48e5bab5b Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 31 Jan 2022 17:57:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E6=A8=A1=E5=9D=97=E9=87=8D=E6=9E=84?= =?UTF-8?q?=205=EF=BC=9Ainfra=20=E6=A8=A1=E5=9D=97=E7=9A=84=E4=BF=AE?= =?UTF-8?q?=E6=94=B9~~~?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- yudao-admin-server/pom.xml | 11 -- .../adminserver/AdminServerApplication.java | 2 +- .../src/main/resources/application-dev.yaml | 2 +- .../src/main/resources/application-local.yaml | 2 +- .../src/main/resources/application.yaml | 7 +- .../src/test/resources/sql/clean.sql | 7 +- .../src/test/resources/sql/create_tables.sql | 66 -------- yudao-core-service/pom.xml | 4 - .../coreservice/BaseDbAndRedisUnitTest.java | 48 ------ .../yudao/coreservice/BaseDbUnitTest.java | 39 ----- .../yudao/coreservice/BaseRedisUnitTest.java | 32 ---- .../config/RedisTestConfiguration.java | 30 ---- .../service/file/InfFileCoreServiceTest.java | 86 ---------- .../InfApiAccessLogCoreServiceTest.java | 45 ------ .../logger/InfApiErrorLogCoreServiceTest.java | 45 ------ .../modules/infra/service/package-info.java | 1 - .../apollo/internals/DBConfigRepository.java | 3 +- .../config/YudaoMybatisAutoConfiguration.java | 2 +- .../framework/web/config/WebProperties.java | 4 +- .../web/config/YudaoWebAutoConfiguration.java | 4 +- .../yudao/module/infra/api/file/FileApi.java | 31 ++++ .../yudao/module/infra/api/package-info.java | 4 + .../module/infra/enums/DictTypeConstants.java | 0 .../infra/enums/ErrorCodeConstants.java} | 6 +- .../yudao-module-infra-impl/pom.xml | 21 ++- .../module/infra/api/file/FileApiImpl.java | 27 ++++ .../yudao/module/infra/api/package-info.java | 1 + .../admin/config/ConfigController.java | 29 ++-- .../admin/config/vo/ConfigExportReqVO.java | 2 +- .../admin/config/vo/ConfigPageReqVO.java | 2 +- .../admin/config/vo/ConfigRespVO.java | 2 +- .../admin/config/vo/ConfigUpdateReqVO.java | 2 +- ...ocController.java => DbDocController.java} | 5 +- ...ileController.java => FileController.java} | 31 ++-- ...fFilePageReqVO.java => FilePageReqVO.java} | 4 +- .../admin/file/vo/FileRespVO.java} | 6 +- ...fJobController.java => JobController.java} | 46 +++--- ...gController.java => JobLogController.java} | 46 +++--- .../job/{InfJobBaseVO.java => JobBaseVO.java} | 2 +- ...obCreateReqVO.java => JobCreateReqVO.java} | 4 +- .../{InfJobExcelVO.java => JobExcelVO.java} | 2 +- ...obExportReqVO.java => JobExportReqVO.java} | 8 +- ...InfJobPageReqVO.java => JobPageReqVO.java} | 4 +- .../job/{InfJobRespVO.java => JobRespVO.java} | 4 +- ...obUpdateReqVO.java => JobUpdateReqVO.java} | 4 +- ...InfJobLogBaseVO.java => JobLogBaseVO.java} | 2 +- ...fJobLogExcelVO.java => JobLogExcelVO.java} | 2 +- ...xportReqVO.java => JobLogExportReqVO.java} | 4 +- ...LogPageReqVO.java => JobLogPageReqVO.java} | 4 +- ...InfJobLogRespVO.java => JobLogRespVO.java} | 4 +- ...oller.java => ApiAccessLogController.java} | 34 ++-- ...roller.java => ApiErrorLogController.java} | 34 ++-- ...LogBaseVO.java => ApiAccessLogBaseVO.java} | 2 +- ...gExcelVO.java => ApiAccessLogExcelVO.java} | 2 +- ...eqVO.java => ApiAccessLogExportReqVO.java} | 4 +- ...eReqVO.java => ApiAccessLogPageReqVO.java} | 4 +- ...LogRespVO.java => ApiAccessLogRespVO.java} | 4 +- ...rLogBaseVO.java => ApiErrorLogBaseVO.java} | 2 +- ...ogExcelVO.java => ApiErrorLogExcelVO.java} | 5 +- ...ReqVO.java => ApiErrorLogExportReqVO.java} | 4 +- ...geReqVO.java => ApiErrorLogPageReqVO.java} | 4 +- ...rLogRespVO.java => ApiErrorLogRespVO.java} | 4 +- .../admin/redis/RedisController.http | 2 + .../admin/redis/RedisController.java | 10 +- ...edisKeyRespVO.java => RedisKeyRespVO.java} | 6 +- ...torRespVO.java => RedisMonitorRespVO.java} | 4 +- ...fConfigConvert.java => ConfigConvert.java} | 16 +- .../infra/convert/file/FileConvert.java | 18 +++ .../infra/convert/file/InfFileConvert.java | 18 --- .../infra/convert/job/InfJobConvert.java | 36 ----- .../infra/convert/job/InfJobLogConvert.java | 30 ---- .../module/infra/convert/job/JobConvert.java | 36 +++++ .../infra/convert/job/JobLogConvert.java | 30 ++++ .../convert/logger/ApiAccessLogConvert.java | 33 ++++ .../convert/logger/ApiErrorLogConvert.java | 31 ++++ .../logger/InfApiAccessLogConvert.java | 30 ---- .../logger/InfApiAccessLogCoreConvert.java | 15 -- .../convert/logger/InfApiErrorLogConvert.java | 28 ---- .../logger/InfApiErrorLogCoreConvert.java | 15 -- .../infra/convert/redis/RedisConvert.java | 12 +- .../{InfConfigDO.java => ConfigDO.java} | 4 +- .../file/{InfFileDO.java => FileDO.java} | 5 +- .../job/{InfJobDO.java => JobDO.java} | 8 +- .../job/{InfJobLogDO.java => JobLogDO.java} | 14 +- ...piAccessLogDO.java => ApiAccessLogDO.java} | 4 +- ...fApiErrorLogDO.java => ApiErrorLogDO.java} | 5 +- ...oreDAOImpl.java => ConfigCoreDAOImpl.java} | 4 +- ...InfConfigMapper.java => ConfigMapper.java} | 16 +- .../infra/dal/mysql/file/FileMapper.java | 44 ++++++ .../dal/mysql/file/InfFileCoreMapper.java | 28 ---- .../infra/dal/mysql/file/InfFileMapper.java | 24 --- .../infra/dal/mysql/job/InfJobMapper.java | 41 ----- ...InfJobLogMapper.java => JobLogMapper.java} | 16 +- .../module/infra/dal/mysql/job/JobMapper.java | 41 +++++ ...LogMapper.java => ApiAccessLogMapper.java} | 16 +- ...rLogMapper.java => ApiErrorLogMapper.java} | 16 +- .../logger/InfApiAccessLogCoreMapper.java | 14 -- .../logger/InfApiErrorLogCoreMapper.java | 9 -- .../infra/enums/SysErrorCodeConstants.java | 16 -- ...onfigTypeEnum.java => ConfigTypeEnum.java} | 2 +- ...gStatusEnum.java => JobLogStatusEnum.java} | 2 +- ...fJobStatusEnum.java => JobStatusEnum.java} | 5 +- ...java => ApiErrorLogProcessStatusEnum.java} | 2 +- .../file/config/FileConfiguration.java | 2 +- .../file/config/FileProperties.java | 2 +- .../{ => framework}/file/package-info.java | 2 +- ...nsumer.java => ConfigRefreshConsumer.java} | 8 +- ...Message.java => ConfigRefreshMessage.java} | 2 +- ...onfigProducer.java => ConfigProducer.java} | 8 +- ...fConfigService.java => ConfigService.java} | 12 +- ...erviceImpl.java => ConfigServiceImpl.java} | 54 +++---- .../infra/service/file/FileService.java | 46 ++++++ ...eServiceImpl.java => FileServiceImpl.java} | 30 ++-- .../service/file/InfFileCoreService.java | 35 ---- .../infra/service/file/InfFileService.java | 22 --- .../service/file/impl/InfFileServiceImpl.java | 29 ---- ...fJobLogService.java => JobLogService.java} | 16 +- ...erviceImpl.java => JobLogServiceImpl.java} | 33 ++-- .../{InfJobService.java => JobService.java} | 24 +-- ...obServiceImpl.java => JobServiceImpl.java} | 67 ++++---- ...gService.java => ApiAccessLogService.java} | 13 +- .../logger/ApiAccessLogServiceImpl.java | 46 ++++++ ...ogService.java => ApiErrorLogService.java} | 13 +- .../logger/ApiErrorLogServiceImpl.java | 65 ++++++++ .../logger/InfApiAccessLogCoreService.java | 12 -- .../logger/InfApiErrorLogCoreService.java | 12 -- .../impl/InfApiAccessLogCoreServiceImpl.java | 35 ---- .../impl/InfApiAccessLogServiceImpl.java | 37 ----- .../impl/InfApiErrorLogCoreServiceImpl.java | 37 ----- .../impl/InfApiErrorLogServiceImpl.java | 57 ------- .../yudao/module/infra/package-info.java | 1 - ...erviceTest.java => ConfigServiceTest.java} | 88 +++++------ .../infra/service/file/FileServiceTest.java | 126 +++++++++++++++ .../service/file/InfFileServiceTest.java | 70 -------- ...erviceTest.java => JobLogServiceTest.java} | 78 +++++---- ...obServiceTest.java => JobServiceTest.java} | 149 ++++++++---------- ....java => ApiAccessLogServiceImplTest.java} | 87 +++++----- ...t.java => ApiErrorLogServiceImplTest.java} | 84 ++++++---- .../test/resources/application-unit-test.yaml | 54 +++++++ .../src/test/resources/logback-spring.xml | 4 + .../src/test/resources/sql/clean.sql | 6 + .../src/test/resources/sql/create_tables.sql | 67 ++++++++ .../yudao-module-member-impl/pom.xml | 16 +- .../service/user/MemberUserServiceImpl.java | 6 +- .../user/MemberUserServiceImplTest.java | 9 +- .../test/resources/application-unit-test.yaml | 3 +- .../system/enums/DictTypeConstants.java | 1 - .../yudao-module-system-impl/pom.xml | 18 ++- .../admin/common/CaptchaController.http | 1 + .../service/user/AdminUserServiceImpl.java | 7 +- .../service/user/UserServiceImplTest.java | 6 +- .../test/resources/application-unit-test.yaml | 3 +- 更新日志.md | 1 + 153 files changed, 1420 insertions(+), 1742 deletions(-) delete mode 100644 yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/BaseDbAndRedisUnitTest.java delete mode 100644 yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/BaseDbUnitTest.java delete mode 100644 yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/BaseRedisUnitTest.java delete mode 100644 yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/config/RedisTestConfiguration.java delete mode 100644 yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/infra/service/file/InfFileCoreServiceTest.java delete mode 100644 yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/infra/service/logger/InfApiAccessLogCoreServiceTest.java delete mode 100644 yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/infra/service/logger/InfApiErrorLogCoreServiceTest.java delete mode 100644 yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/infra/service/package-info.java create mode 100644 yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/file/FileApi.java create mode 100644 yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/package-info.java rename yudao-module-infra/{yudao-module-infra-impl => yudao-module-infra-api}/src/main/java/cn/iocoder/yudao/module/infra/enums/DictTypeConstants.java (100%) rename yudao-module-infra/{yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/InfErrorCodeConstants.java => yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/enums/ErrorCodeConstants.java} (86%) create mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/api/file/FileApiImpl.java create mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/api/package-info.java rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/doc/{InfDbDocController.java => DbDocController.java} (98%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/{InfFileController.java => FileController.java} (72%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/{InfFilePageReqVO.java => FilePageReqVO.java} (91%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/{vo/InfFileRespVO.java => controller/admin/file/vo/FileRespVO.java} (69%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/{InfJobController.java => JobController.java} (76%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/{InfJobLogController.java => JobLogController.java} (64%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/{InfJobBaseVO.java => JobBaseVO.java} (97%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/{InfJobCreateReqVO.java => JobCreateReqVO.java} (83%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/{InfJobExcelVO.java => JobExcelVO.java} (97%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/{InfJobExportReqVO.java => JobExportReqVO.java} (58%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/{InfJobPageReqVO.java => JobPageReqVO.java} (88%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/{InfJobRespVO.java => JobRespVO.java} (90%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/{InfJobUpdateReqVO.java => JobUpdateReqVO.java} (82%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/{InfJobLogBaseVO.java => JobLogBaseVO.java} (98%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/{InfJobLogExcelVO.java => JobLogExcelVO.java} (97%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/{InfJobLogExportReqVO.java => JobLogExportReqVO.java} (85%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/{InfJobLogPageReqVO.java => JobLogPageReqVO.java} (91%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/{InfJobLogRespVO.java => JobLogRespVO.java} (83%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/{InfApiAccessLogController.java => ApiAccessLogController.java} (62%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/{InfApiErrorLogController.java => ApiErrorLogController.java} (70%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/{InfApiAccessLogBaseVO.java => ApiAccessLogBaseVO.java} (98%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/{InfApiAccessLogExcelVO.java => ApiAccessLogExcelVO.java} (97%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/{InfApiAccessLogExportReqVO.java => ApiAccessLogExportReqVO.java} (88%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/{InfApiAccessLogPageReqVO.java => ApiAccessLogPageReqVO.java} (92%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/{InfApiAccessLogRespVO.java => ApiAccessLogRespVO.java} (82%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/{InfApiErrorLogBaseVO.java => ApiErrorLogBaseVO.java} (99%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/{InfApiErrorLogExcelVO.java => ApiErrorLogExcelVO.java} (94%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/{InfApiErrorLogExportReqVO.java => ApiErrorLogExportReqVO.java} (87%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/{InfApiErrorLogPageReqVO.java => ApiErrorLogPageReqVO.java} (92%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/{InfApiErrorLogRespVO.java => ApiErrorLogRespVO.java} (86%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/vo/{InfRedisKeyRespVO.java => RedisKeyRespVO.java} (90%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/vo/{InfRedisMonitorRespVO.java => RedisMonitorRespVO.java} (92%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/config/{InfConfigConvert.java => ConfigConvert.java} (53%) create mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/file/FileConvert.java delete mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/file/InfFileConvert.java delete mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/job/InfJobConvert.java delete mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/job/InfJobLogConvert.java create mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/job/JobConvert.java create mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/job/JobLogConvert.java create mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/ApiAccessLogConvert.java create mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/ApiErrorLogConvert.java delete mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/InfApiAccessLogConvert.java delete mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/InfApiAccessLogCoreConvert.java delete mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/InfApiErrorLogConvert.java delete mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/InfApiErrorLogCoreConvert.java rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/config/{InfConfigDO.java => ConfigDO.java} (94%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/file/{InfFileDO.java => FileDO.java} (86%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/job/{InfJobDO.java => JobDO.java} (89%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/job/{InfJobLogDO.java => JobLogDO.java} (81%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/{InfApiAccessLogDO.java => ApiAccessLogDO.java} (96%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/{InfApiErrorLogDO.java => ApiErrorLogDO.java} (94%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/config/{InfConfigCoreDAOImpl.java => ConfigCoreDAOImpl.java} (88%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/config/{InfConfigMapper.java => ConfigMapper.java} (67%) create mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileMapper.java delete mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/InfFileCoreMapper.java delete mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/InfFileMapper.java delete mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/job/InfJobMapper.java rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/job/{InfJobLogMapper.java => JobLogMapper.java} (73%) create mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/job/JobMapper.java rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/{InfApiAccessLogMapper.java => ApiAccessLogMapper.java} (74%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/{InfApiErrorLogMapper.java => ApiErrorLogMapper.java} (73%) delete mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/InfApiAccessLogCoreMapper.java delete mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/InfApiErrorLogCoreMapper.java delete mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/SysErrorCodeConstants.java rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/config/{InfConfigTypeEnum.java => ConfigTypeEnum.java} (89%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/job/{InfJobLogStatusEnum.java => JobLogStatusEnum.java} (91%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/job/{InfJobStatusEnum.java => JobStatusEnum.java} (90%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/logger/{InfApiErrorLogProcessStatusEnum.java => ApiErrorLogProcessStatusEnum.java} (90%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/{ => framework}/file/config/FileConfiguration.java (81%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/{ => framework}/file/config/FileProperties.java (88%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/{ => framework}/file/package-info.java (92%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/mq/consumer/config/{InfConfigRefreshConsumer.java => ConfigRefreshConsumer.java} (61%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/mq/message/config/{InfConfigRefreshMessage.java => ConfigRefreshMessage.java} (80%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/mq/producer/config/{InfConfigProducer.java => ConfigProducer.java} (64%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/config/{InfConfigService.java => ConfigService.java} (80%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/config/{impl/InfConfigServiceImpl.java => ConfigServiceImpl.java} (59%) create mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileService.java rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/{impl/InfFileCoreServiceImpl.java => FileServiceImpl.java} (59%) delete mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/InfFileCoreService.java delete mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/InfFileService.java delete mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/impl/InfFileServiceImpl.java rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/{InfJobLogService.java => JobLogService.java} (68%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/{impl/InfJobLogServiceImpl.java => JobLogServiceImpl.java} (55%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/{InfJobService.java => JobService.java} (75%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/{impl/InfJobServiceImpl.java => JobServiceImpl.java} (68%) rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/{InfApiAccessLogService.java => ApiAccessLogService.java} (57%) create mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogServiceImpl.java rename yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/{InfApiErrorLogService.java => ApiErrorLogService.java} (65%) create mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImpl.java delete mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/InfApiAccessLogCoreService.java delete mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/InfApiErrorLogCoreService.java delete mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/impl/InfApiAccessLogCoreServiceImpl.java delete mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/impl/InfApiAccessLogServiceImpl.java delete mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/impl/InfApiErrorLogCoreServiceImpl.java delete mode 100644 yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/impl/InfApiErrorLogServiceImpl.java delete mode 100644 yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/package-info.java rename yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/config/{InfConfigServiceTest.java => ConfigServiceTest.java} (73%) create mode 100644 yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileServiceTest.java delete mode 100644 yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/file/InfFileServiceTest.java rename yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/job/{InfJobLogServiceTest.java => JobLogServiceTest.java} (67%) rename yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/job/{InfJobServiceTest.java => JobServiceTest.java} (62%) rename yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/logger/{InfApiAccessLogServiceImplTest.java => ApiAccessLogServiceImplTest.java} (54%) rename yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/logger/{InfApiErrorLogServiceImplTest.java => ApiErrorLogServiceImplTest.java} (65%) create mode 100644 yudao-module-infra/yudao-module-infra-impl/src/test/resources/application-unit-test.yaml create mode 100644 yudao-module-infra/yudao-module-infra-impl/src/test/resources/logback-spring.xml create mode 100644 yudao-module-infra/yudao-module-infra-impl/src/test/resources/sql/clean.sql create mode 100644 yudao-module-infra/yudao-module-infra-impl/src/test/resources/sql/create_tables.sql rename yudao-module-system/{yudao-module-system-impl => yudao-module-system-api}/src/main/java/cn/iocoder/yudao/module/system/enums/DictTypeConstants.java (99%) diff --git a/yudao-admin-server/pom.xml b/yudao-admin-server/pom.xml index 00e1edeb0..dd73b5178 100644 --- a/yudao-admin-server/pom.xml +++ b/yudao-admin-server/pom.xml @@ -99,12 +99,6 @@ yudao-spring-boot-starter-redis - - - cn.iocoder.boot - yudao-spring-boot-starter-config - - cn.iocoder.boot @@ -152,11 +146,6 @@ velocity-engine-core - - cn.smallbun.screw - screw-core - - diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/AdminServerApplication.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/AdminServerApplication.java index a37d220b4..2adf77b80 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/AdminServerApplication.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/AdminServerApplication.java @@ -5,7 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; @SuppressWarnings("SpringComponentScan") // 忽略 IDEA 无法识别 ${yudao.info.base-package} 和 ${yudao.core-service.base-package} @SpringBootApplication(scanBasePackages = {"${yudao.info.base-package}", "${yudao.core-service.base-package}", - "${yudao.info.member-package}", "${yudao.info.system-package}"}) // TODO 芋艿:重构 + "${yudao.info.base-package2}"}) // TODO 芋艿:重构 public class AdminServerApplication { public static void main(String[] args) { diff --git a/yudao-admin-server/src/main/resources/application-dev.yaml b/yudao-admin-server/src/main/resources/application-dev.yaml index a49807904..246d5e883 100644 --- a/yudao-admin-server/src/main/resources/application-dev.yaml +++ b/yudao-admin-server/src/main/resources/application-dev.yaml @@ -100,7 +100,7 @@ apollo: eagerLoad: enabled: true # 设置 Apollo 在日志初始化前生效,可以实现日志的动态级别配置 jdbc: # 自定义的 JDBC 配置项,用于数据库的地址 - dao: cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.config.InfConfigCoreDAOImpl + dao: cn.iocoder.yudao.module.infra.dal.mysql.config.ConfigCoreDAOImpl url: ${spring.datasource.dynamic.datasource.master.url} username: ${spring.datasource.dynamic.datasource.master.username} password: ${spring.datasource.dynamic.datasource.master.password} diff --git a/yudao-admin-server/src/main/resources/application-local.yaml b/yudao-admin-server/src/main/resources/application-local.yaml index 411f2a6a3..9bdeb775b 100644 --- a/yudao-admin-server/src/main/resources/application-local.yaml +++ b/yudao-admin-server/src/main/resources/application-local.yaml @@ -113,7 +113,7 @@ apollo: eagerLoad: enabled: true # 设置 Apollo 在日志初始化前生效,可以实现日志的动态级别配置 jdbc: # 自定义的 JDBC 配置项,用于数据库的地址 - dao: cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.config.InfConfigCoreDAOImpl + dao: cn.iocoder.yudao.module.infra.dal.mysql.config.ConfigCoreDAOImpl url: ${spring.datasource.dynamic.datasource.master.url} username: ${spring.datasource.dynamic.datasource.master.username} password: ${spring.datasource.dynamic.datasource.master.password} diff --git a/yudao-admin-server/src/main/resources/application.yaml b/yudao-admin-server/src/main/resources/application.yaml index 81ec74b2c..b352943a8 100644 --- a/yudao-admin-server/src/main/resources/application.yaml +++ b/yudao-admin-server/src/main/resources/application.yaml @@ -48,17 +48,16 @@ yudao: info: version: 1.0.0 base-package: cn.iocoder.yudao.adminserver - member-package: cn.iocoder.yudao.module.member - system-package: cn.iocoder.yudao.module.system + base-package2: cn.iocoder.yudao.module core-service: base-package: cn.iocoder.yudao.coreservice web: admin-api: prefix: /admin-api - controller: cn.iocoder.yudao.module.system.controller.admin # TODO 芋艿:需要改造 + controller: '**.controller.admin.**' app-api: prefix: /app-api - controller: cn.iocoder.yudao.module.member.controller.app # TODO 芋艿:需要改造 + controller: '**.controller.app.**' swagger: title: 管理后台 diff --git a/yudao-admin-server/src/test/resources/sql/clean.sql b/yudao-admin-server/src/test/resources/sql/clean.sql index c0149d424..9e0718a86 100644 --- a/yudao-admin-server/src/test/resources/sql/clean.sql +++ b/yudao-admin-server/src/test/resources/sql/clean.sql @@ -1,10 +1,5 @@ -- inf 开头的 DB -DELETE FROM "inf_config"; -DELETE FROM "inf_file"; -DELETE FROM "inf_job"; -DELETE FROM "inf_job_log"; -DELETE FROM "inf_api_access_log"; -DELETE FROM "inf_api_error_log"; + -- pay 开头的 DB DELETE FROM pay_merchant; diff --git a/yudao-admin-server/src/test/resources/sql/create_tables.sql b/yudao-admin-server/src/test/resources/sql/create_tables.sql index b8b92e3b1..850146fec 100644 --- a/yudao-admin-server/src/test/resources/sql/create_tables.sql +++ b/yudao-admin-server/src/test/resources/sql/create_tables.sql @@ -1,71 +1,5 @@ -- inf 开头的 DB -CREATE TABLE IF NOT EXISTS "inf_config" ( - "id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY, - "group" varchar(50) NOT NULL, - "type" tinyint NOT NULL, - "name" varchar(100) NOT NULL DEFAULT '', - "key" varchar(100) NOT NULL DEFAULT '', - "value" varchar(500) NOT NULL DEFAULT '', - "sensitive" bit NOT NULL, - "remark" varchar(500) DEFAULT NULL, - "creator" varchar(64) DEFAULT '', - "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updater" varchar(64) DEFAULT '', - "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - "deleted" bit NOT NULL DEFAULT FALSE, - PRIMARY KEY ("id") -) COMMENT '参数配置表'; - -CREATE TABLE IF NOT EXISTS "inf_file" ( - "id" varchar(188) NOT NULL, - "type" varchar(63) DEFAULT NULL, - "content" blob NOT NULL, - "creator" varchar(64) DEFAULT '', - "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - "updater" varchar(64) DEFAULT '', - "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - "deleted" bit NOT NULL DEFAULT FALSE, - "tenant_id" bigint not null default '0', - PRIMARY KEY ("id") -) COMMENT '文件表'; - -CREATE TABLE IF NOT EXISTS "inf_job" ( - "id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '任务编号', - "name" varchar(32) NOT NULL COMMENT '任务名称', - "status" tinyint(4) NOT NULL COMMENT '任务状态', - "handler_name" varchar(64) NOT NULL COMMENT '处理器的名字', - "handler_param" varchar(255) DEFAULT NULL COMMENT '处理器的参数', - "cron_expression" varchar(32) NOT NULL COMMENT 'CRON 表达式', - "retry_count" int(11) NOT NULL DEFAULT '0' COMMENT '重试次数', - "retry_interval" int(11) NOT NULL DEFAULT '0' COMMENT '重试间隔', - "monitor_timeout" int(11) NOT NULL DEFAULT '0' COMMENT '监控超时时间', - "creator" varchar(64) DEFAULT '' COMMENT '创建者', - "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - "updater" varchar(64) DEFAULT '' COMMENT '更新者', - "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - "deleted" bit NOT NULL DEFAULT FALSE COMMENT '是否删除', - PRIMARY KEY ("id") -) COMMENT='定时任务表'; - -CREATE TABLE IF NOT EXISTS "inf_job_log" ( - "id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '日志编号', - "job_id" bigint(20) NOT NULL COMMENT '任务编号', - "handler_name" varchar(64) NOT NULL COMMENT '处理器的名字', - "handler_param" varchar(255) DEFAULT NULL COMMENT '处理器的参数', - "execute_index" tinyint(4) NOT NULL DEFAULT '1' COMMENT '第几次执行', - "begin_time" datetime NOT NULL COMMENT '开始执行时间', - "end_time" datetime DEFAULT NULL COMMENT '结束执行时间', - "duration" int(11) DEFAULT NULL COMMENT '执行时长', - "status" tinyint(4) NOT NULL COMMENT '任务状态', - "result" varchar(4000) DEFAULT '' COMMENT '结果数据', - "creator" varchar(64) DEFAULT '' COMMENT '创建者', - "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', - "updater" varchar(64) DEFAULT '' COMMENT '更新者', - "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', - "deleted" bit(1) NOT NULL DEFAULT FALSE COMMENT '是否删除', - PRIMARY KEY ("id") -)COMMENT='定时任务日志表'; CREATE TABLE IF NOT EXISTS "pay_merchant" ( diff --git a/yudao-core-service/pom.xml b/yudao-core-service/pom.xml index aaec8d2a6..ccb1e1600 100644 --- a/yudao-core-service/pom.xml +++ b/yudao-core-service/pom.xml @@ -40,10 +40,6 @@ cn.iocoder.boot yudao-spring-boot-starter-biz-tenant - - cn.iocoder.boot - yudao-spring-boot-starter-biz-social - diff --git a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/BaseDbAndRedisUnitTest.java b/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/BaseDbAndRedisUnitTest.java deleted file mode 100644 index 8b9177cf5..000000000 --- a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/BaseDbAndRedisUnitTest.java +++ /dev/null @@ -1,48 +0,0 @@ -package cn.iocoder.yudao.coreservice; - -import cn.iocoder.yudao.coreservice.config.RedisTestConfiguration; -import cn.iocoder.yudao.framework.datasource.config.YudaoDataSourceAutoConfiguration; -import cn.iocoder.yudao.framework.mybatis.config.YudaoMybatisAutoConfiguration; -import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration; -import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure; -import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration; -import org.redisson.spring.starter.RedissonAutoConfiguration; -import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; -import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; -import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.annotation.Import; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.jdbc.Sql; - -/** - * 依赖内存 DB + Redis 的单元测试 - * - * 相比 {@link BaseDbUnitTest} 来说,额外增加了内存 Redis - * - * @author 芋道源码 - */ -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = BaseDbAndRedisUnitTest.Application.class) -@ActiveProfiles("unit-test") // 设置使用 application-unit-test 配置文件 -@Sql(scripts = "/sql/clean.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) // 每个单元测试结束后,清理 DB -public class BaseDbAndRedisUnitTest { - - @Import({ - // DB 配置类 - YudaoDataSourceAutoConfiguration.class, // 自己的 DB 配置类 - DataSourceAutoConfiguration.class, // Spring DB 自动配置类 - DataSourceTransactionManagerAutoConfiguration.class, // Spring 事务自动配置类 - DruidDataSourceAutoConfigure.class, // Druid 自动配置类 - // MyBatis 配置类 - YudaoMybatisAutoConfiguration.class, // 自己的 MyBatis 配置类 - MybatisPlusAutoConfiguration.class, // MyBatis 的自动配置类 - // Redis 配置类 - RedisTestConfiguration.class, // Redis 测试配置类,用于启动 RedisServer - RedisAutoConfiguration.class, // Spring Redis 自动配置类 - YudaoRedisAutoConfiguration.class, // 自己的 Redis 配置类 - RedissonAutoConfiguration.class, // Redisson 自动高配置类 - }) - public static class Application { - } - -} diff --git a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/BaseDbUnitTest.java b/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/BaseDbUnitTest.java deleted file mode 100644 index 94d6d3107..000000000 --- a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/BaseDbUnitTest.java +++ /dev/null @@ -1,39 +0,0 @@ -package cn.iocoder.yudao.coreservice; - -import cn.iocoder.yudao.framework.datasource.config.YudaoDataSourceAutoConfiguration; -import cn.iocoder.yudao.framework.mybatis.config.YudaoMybatisAutoConfiguration; -import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure; -import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration; -import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; -import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.annotation.Import; -import org.springframework.test.context.ActiveProfiles; -import org.springframework.test.context.jdbc.Sql; - -/** - * 依赖内存 DB 的单元测试 - * - * 注意,Service 层同样适用。对于 Service 层的单元测试,我们针对自己模块的 Mapper 走的是 H2 内存数据库,针对别的模块的 Service 走的是 Mock 方法 - * - * @author 芋道源码 - */ -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = BaseDbUnitTest.Application.class) -@ActiveProfiles("unit-test") // 设置使用 application-unit-test 配置文件 -@Sql(scripts = "/sql/clean.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) // 每个单元测试结束后,清理 DB -public class BaseDbUnitTest { - - @Import({ - // DB 配置类 - YudaoDataSourceAutoConfiguration.class, // 自己的 DB 配置类 - DataSourceAutoConfiguration.class, // Spring DB 自动配置类 - DataSourceTransactionManagerAutoConfiguration.class, // Spring 事务自动配置类 - DruidDataSourceAutoConfigure.class, // Druid 自动配置类 - // MyBatis 配置类 - YudaoMybatisAutoConfiguration.class, // 自己的 MyBatis 配置类 - MybatisPlusAutoConfiguration.class, // MyBatis 的自动配置类 - }) - public static class Application { - } - -} diff --git a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/BaseRedisUnitTest.java b/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/BaseRedisUnitTest.java deleted file mode 100644 index e95e6d787..000000000 --- a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/BaseRedisUnitTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package cn.iocoder.yudao.coreservice; - -import cn.iocoder.yudao.coreservice.config.RedisTestConfiguration; -import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration; -import org.redisson.spring.starter.RedissonAutoConfiguration; -import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.context.annotation.Import; -import org.springframework.test.context.ActiveProfiles; - -/** - * 依赖内存 Redis 的单元测试 - * - * 相比 {@link BaseDbUnitTest} 来说,从内存 DB 改成了内存 Redis - * - * @author 芋道源码 - */ -@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = BaseRedisUnitTest.Application.class) -@ActiveProfiles("unit-test") // 设置使用 application-unit-test 配置文件 -public class BaseRedisUnitTest { - - @Import({ - // Redis 配置类 - RedisTestConfiguration.class, // Redis 测试配置类,用于启动 RedisServer - RedisAutoConfiguration.class, // Spring Redis 自动配置类 - YudaoRedisAutoConfiguration.class, // 自己的 Redis 配置类 - RedissonAutoConfiguration.class, // Redisson 自动高配置类 - }) - public static class Application { - } - -} diff --git a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/config/RedisTestConfiguration.java b/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/config/RedisTestConfiguration.java deleted file mode 100644 index eb0791974..000000000 --- a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/config/RedisTestConfiguration.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.iocoder.yudao.coreservice.config; - -import com.github.fppt.jedismock.RedisServer; -import org.springframework.boot.autoconfigure.data.redis.RedisProperties; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Lazy; - -import java.io.IOException; - -@Configuration(proxyBeanMethods = false) -@Lazy(false) // 禁止延迟加载 -@EnableConfigurationProperties(RedisProperties.class) -public class RedisTestConfiguration { - - /** - * 创建模拟的 Redis Server 服务器 - */ - @Bean - public RedisServer redisServer(RedisProperties properties) throws IOException { - RedisServer redisServer = new RedisServer(properties.getPort()); - // TODO 芋艿:一次执行多个单元测试时,貌似创建多个 spring 容器,导致不进行 stop。这样,就导致端口被占用,无法启动。。。 - try { - redisServer.start(); - } catch (Exception ignore) {} - return redisServer; - } - -} 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 deleted file mode 100644 index 232ccf5f4..000000000 --- a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/infra/service/file/InfFileCoreServiceTest.java +++ /dev/null @@ -1,86 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.infra.service.file; - -import cn.hutool.core.io.resource.ResourceUtil; -import cn.iocoder.yudao.coreservice.BaseDbUnitTest; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO; -import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.file.InfFileCoreMapper; -import cn.iocoder.yudao.coreservice.modules.infra.framework.file.config.FileProperties; -import cn.iocoder.yudao.coreservice.modules.infra.service.file.impl.InfFileCoreServiceImpl; -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 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; -import static org.junit.jupiter.api.Assertions.*; - -@Import({InfFileCoreServiceImpl.class, FileProperties.class}) -public class InfFileCoreServiceTest extends BaseDbUnitTest { - - @Resource - private InfFileCoreService fileCoreService; - - @MockBean - private FileProperties fileProperties; - - @Resource - private InfFileCoreMapper fileMapper; - - @Test - public void testCreateFile_success() { - // 准备参数 - String path = randomString(); - byte[] content = ResourceUtil.readBytes("file/erweima.jpg"); - - // 调用 - String url = fileCoreService.createFile(path, content); - // 断言 - assertEquals(fileProperties.getBasePath() + path, url); - // 校验数据 - InfFileDO file = fileMapper.selectById(path); - assertEquals(path, file.getId()); - assertEquals("jpg", file.getType()); - assertArrayEquals(content, file.getContent()); - } - - @Test - public void testCreateFile_exists() { - // mock 数据 - InfFileDO dbFile = randomPojo(InfFileDO.class); - fileMapper.insert(dbFile); - // 准备参数 - String path = dbFile.getId(); // 模拟已存在 - byte[] content = ResourceUtil.readBytes("file/erweima.jpg"); - - // 调用,并断言异常 - assertServiceException(() -> fileCoreService.createFile(path, content), FILE_PATH_EXISTS); - } - - @Test - public void testDeleteFile_success() { - // mock 数据 - InfFileDO dbFile = randomPojo(InfFileDO.class); - fileMapper.insert(dbFile);// @Sql: 先插入出一条存在的数据 - // 准备参数 - String id = dbFile.getId(); - - // 调用 - fileCoreService.deleteFile(id); - // 校验数据不存在了 - assertNull(fileMapper.selectById(id)); - } - - @Test - public void testDeleteFile_notExists() { - // 准备参数 - String id = randomString(); - - // 调用, 并断言异常 - assertServiceException(() -> fileCoreService.deleteFile(id), FILE_NOT_EXISTS); - } - -} diff --git a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/infra/service/logger/InfApiAccessLogCoreServiceTest.java b/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/infra/service/logger/InfApiAccessLogCoreServiceTest.java deleted file mode 100644 index c7b2620eb..000000000 --- a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/infra/service/logger/InfApiAccessLogCoreServiceTest.java +++ /dev/null @@ -1,45 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.infra.service.logger; - -import cn.hutool.core.util.RandomUtil; -import cn.iocoder.yudao.coreservice.BaseDbUnitTest; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; -import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.logger.InfApiAccessLogCoreMapper; -import cn.iocoder.yudao.coreservice.modules.infra.service.logger.impl.InfApiAccessLogCoreServiceImpl; -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateReqDTO; -import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; -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.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -/** - * {@link InfApiAccessLogCoreServiceImpl} 单元测试 - */ -@Import(InfApiAccessLogCoreServiceImpl.class) -public class InfApiAccessLogCoreServiceTest extends BaseDbUnitTest { - - @Resource - private InfApiAccessLogCoreService apiAccessLogCoreService; - - @Resource - private InfApiAccessLogCoreMapper apiAccessLogCoreMapper; - - @Test - public void testCreateApiAccessLogAsync() { - // 准备参数 - ApiAccessLogCreateReqDTO createDTO = RandomUtils.randomPojo(ApiAccessLogCreateReqDTO.class, - dto -> dto.setUserType(RandomUtil.randomEle(UserTypeEnum.values()).getValue())); - - // 调用 - apiAccessLogCoreService.createApiAccessLogAsync(createDTO); - // 断言 - InfApiAccessLogDO infApiAccessLogDO = apiAccessLogCoreMapper.selectOne(null); - assertNotNull(infApiAccessLogDO); - assertPojoEquals(createDTO, infApiAccessLogDO); - } - -} diff --git a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/infra/service/logger/InfApiErrorLogCoreServiceTest.java b/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/infra/service/logger/InfApiErrorLogCoreServiceTest.java deleted file mode 100644 index 6379ab32a..000000000 --- a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/infra/service/logger/InfApiErrorLogCoreServiceTest.java +++ /dev/null @@ -1,45 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.infra.service.logger; - -import cn.hutool.core.util.RandomUtil; -import cn.iocoder.yudao.coreservice.BaseDbUnitTest; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO; -import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.logger.InfApiErrorLogCoreMapper; -import cn.iocoder.yudao.coreservice.modules.infra.service.logger.impl.InfApiErrorLogCoreServiceImpl; -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateReqDTO; -import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; -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.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; -import static org.junit.jupiter.api.Assertions.assertNotNull; - -/** - * {@link InfApiErrorLogCoreServiceImpl} 单元测试 - */ -@Import(InfApiErrorLogCoreServiceImpl.class) -public class InfApiErrorLogCoreServiceTest extends BaseDbUnitTest { - - @Resource - private InfApiErrorLogCoreService apiErrorLogCoreService; - - @Resource - private InfApiErrorLogCoreMapper infApiErrorLogCoreMapper; - - @Test - public void testCreateApiErrorLogAsync() { - // 准备参数 - ApiErrorLogCreateReqDTO createDTO = RandomUtils.randomPojo(ApiErrorLogCreateReqDTO.class, - dto -> dto.setUserType(RandomUtil.randomEle(UserTypeEnum.values()).getValue())); - - // 调用 - apiErrorLogCoreService.createApiErrorLogAsync(createDTO); - // 断言 - InfApiErrorLogDO infApiErrorLogDO = infApiErrorLogCoreMapper.selectOne(null); - assertNotNull(infApiErrorLogDO); - assertPojoEquals(createDTO, infApiErrorLogDO); - } - -} diff --git a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/infra/service/package-info.java b/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/infra/service/package-info.java deleted file mode 100644 index c3da3526c..000000000 --- a/yudao-core-service/src/test/java/cn/iocoder/yudao/coreservice/modules/infra/service/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package cn.iocoder.yudao.coreservice.modules.infra.service; diff --git a/yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/internals/DBConfigRepository.java b/yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/internals/DBConfigRepository.java index c88038da9..08573d33d 100644 --- a/yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/internals/DBConfigRepository.java +++ b/yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/internals/DBConfigRepository.java @@ -24,6 +24,7 @@ import java.util.List; import java.util.Properties; import java.util.concurrent.Executors; import java.util.concurrent.ScheduledExecutorService; +import java.util.function.Predicate; @Slf4j public class DBConfigRepository extends AbstractConfigRepository { @@ -135,7 +136,7 @@ public class DBConfigRepository extends AbstractConfigRepository { private Properties buildProperties(List configs) { Properties properties = propertiesFactory.getPropertiesInstance(); - configs.stream().filter(ConfigRespDTO::getDeleted) // 过滤掉被删除的配置 + configs.stream().filter(config -> !config.getDeleted()) // 过滤掉被删除的配置 .forEach(config -> properties.put(config.getKey(), config.getValue())); return properties; } diff --git a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/config/YudaoMybatisAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/config/YudaoMybatisAutoConfiguration.java index 9bd5202e4..7e2576137 100644 --- a/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/config/YudaoMybatisAutoConfiguration.java +++ b/yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/mybatis/config/YudaoMybatisAutoConfiguration.java @@ -16,7 +16,7 @@ import org.springframework.context.annotation.Configuration; */ @Configuration @MapperScan(value = {"${yudao.info.base-package}", "${yudao.core-service.base-package}", - "${yudao.info.member-package}", "${yudao.info.system-package}"}, + "${yudao.info.base-package2}"}, annotationClass = Mapper.class, lazyInitialization = "${mybatis.lazy-initialization:false}") // Mapper 懒加载,目前仅用于单元测试 public class YudaoMybatisAutoConfiguration { diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/config/WebProperties.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/config/WebProperties.java index 23a4aff4a..a7058871e 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/config/WebProperties.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/config/WebProperties.java @@ -36,11 +36,9 @@ public class WebProperties { private String prefix; /** - * Controller 所在包 + * Controller 所在包的 Ant 路径规则 * * 主要目的是,给该 Controller 设置指定的 {@link #prefix} - * - * 因为我们有多个 modules 包里会包含 Controller,所以只需要写到 cn.iocoder.yudao 这样的层级 */ @NotEmpty(message = "Controller 所在包不能为空") private String controller; diff --git a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/config/YudaoWebAutoConfiguration.java b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/config/YudaoWebAutoConfiguration.java index c3bcb2009..a6f932dd0 100644 --- a/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/config/YudaoWebAutoConfiguration.java +++ b/yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/config/YudaoWebAutoConfiguration.java @@ -13,6 +13,7 @@ import org.springframework.boot.context.properties.EnableConfigurationProperties import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.util.AntPathMatcher; import org.springframework.util.PathMatcher; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.cors.CorsConfiguration; @@ -49,8 +50,9 @@ public class YudaoWebAutoConfiguration implements WebMvcConfigurer { * @param api API 配置 */ private void configurePathMatch(PathMatchConfigurer configurer, WebProperties.Api api) { + AntPathMatcher antPathMatcher = new AntPathMatcher("."); configurer.addPathPrefix(api.getPrefix(), clazz -> clazz.isAnnotationPresent(RestController.class) - && clazz.getPackage().getName().startsWith(api.getController())); // 仅仅匹配 controller 包 + && antPathMatcher.match(api.getController(), clazz.getPackage().getName())); // 仅仅匹配 controller 包 } @Bean diff --git a/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/file/FileApi.java b/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/file/FileApi.java new file mode 100644 index 000000000..5d55c5731 --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/file/FileApi.java @@ -0,0 +1,31 @@ +package cn.iocoder.yudao.module.infra.api.file; + +import cn.hutool.core.util.IdUtil; + +/** + * 文件 API 接口 + * + * @author 芋道源码 + */ +public interface FileApi { + + /** + * 保存文件,并返回文件的访问路径 + * + * @param content 文件内容 + * @return 文件路径 + */ + default String createFile(byte[] content) { + return createFile(IdUtil.fastUUID(), content); + } + + /** + * 保存文件,并返回文件的访问路径 + * + * @param path 文件路径 + * @param content 文件内容 + * @return 文件路径 + */ + String createFile(String path, byte[] content); + +} diff --git a/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/package-info.java b/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/package-info.java new file mode 100644 index 000000000..9ed9a778e --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/api/package-info.java @@ -0,0 +1,4 @@ +/** + * infra API 包,定义暴露给其它模块的 API + */ +package cn.iocoder.yudao.module.infra.api; diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/DictTypeConstants.java b/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/enums/DictTypeConstants.java similarity index 100% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/DictTypeConstants.java rename to yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/enums/DictTypeConstants.java diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/InfErrorCodeConstants.java b/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/enums/ErrorCodeConstants.java similarity index 86% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/InfErrorCodeConstants.java rename to yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/enums/ErrorCodeConstants.java index 0eeaa7408..03eefe17f 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/InfErrorCodeConstants.java +++ b/yudao-module-infra/yudao-module-infra-api/src/main/java/cn/iocoder/yudao/module/infra/enums/ErrorCodeConstants.java @@ -7,7 +7,7 @@ import cn.iocoder.yudao.framework.common.exception.ErrorCode; * * infra 系统,使用 1-001-000-000 段 */ -public interface InfErrorCodeConstants { +public interface ErrorCodeConstants { // ========== 参数配置 1001000000 ========== ErrorCode CONFIG_NOT_EXISTS = new ErrorCode(1001000001, "参数配置不存在"); @@ -27,4 +27,8 @@ public interface InfErrorCodeConstants { ErrorCode API_ERROR_LOG_NOT_FOUND = new ErrorCode(1001002000, "API 错误日志不存在"); ErrorCode API_ERROR_LOG_PROCESSED = new ErrorCode(1001002001, "API 错误日志已处理"); + // ========= 文件相关 1001003000================= + ErrorCode FILE_PATH_EXISTS = new ErrorCode(1001003000, "文件路径已存在"); + ErrorCode FILE_NOT_EXISTS = new ErrorCode(1001003001, "文件不存在"); + } diff --git a/yudao-module-infra/yudao-module-infra-impl/pom.xml b/yudao-module-infra/yudao-module-infra-impl/pom.xml index 9c98f6d62..69dbc4ec4 100644 --- a/yudao-module-infra/yudao-module-infra-impl/pom.xml +++ b/yudao-module-infra/yudao-module-infra-impl/pom.xml @@ -23,19 +23,26 @@ yudao-module-member-api ${revision} - cn.iocoder.boot yudao-module-system-api ${revision} + + cn.iocoder.boot + yudao-module-infra-api + ${revision} + - cn.iocoder.boot yudao-spring-boot-starter-biz-operatelog + + cn.iocoder.boot + yudao-spring-boot-starter-biz-tenant + @@ -54,6 +61,12 @@ yudao-spring-boot-starter-redis + + + cn.iocoder.boot + yudao-spring-boot-starter-config + + cn.iocoder.boot @@ -73,6 +86,10 @@ yudao-spring-boot-starter-excel + + cn.smallbun.screw + screw-core + diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/api/file/FileApiImpl.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/api/file/FileApiImpl.java new file mode 100644 index 000000000..c5ce8db19 --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/api/file/FileApiImpl.java @@ -0,0 +1,27 @@ +package cn.iocoder.yudao.module.infra.api.file; + +import cn.iocoder.yudao.module.infra.api.file.FileApi; +import cn.iocoder.yudao.module.infra.service.file.FileService; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; + +/** + * 文件 API 实现类 + * + * @author 芋道源码 + */ +@Service +@Validated +public class FileApiImpl implements FileApi { + + @Resource + private FileService fileService; + + @Override + public String createFile(String path, byte[] content) { + return fileService.createFile(path, content); + } + +} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/api/package-info.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/api/package-info.java new file mode 100644 index 000000000..af01680f6 --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/api/package-info.java @@ -0,0 +1 @@ +package cn.iocoder.yudao.module.infra.api; diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/ConfigController.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/ConfigController.java index 5bad8d83c..73c3a2e52 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/ConfigController.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/ConfigController.java @@ -1,17 +1,15 @@ package cn.iocoder.yudao.module.infra.controller.admin.config; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.config.InfConfigDO; import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; 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; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; -import cn.iocoder.yudao.adminserver.modules.infra.controller.config.vo.*; import cn.iocoder.yudao.module.infra.controller.admin.config.vo.*; -import cn.iocoder.yudao.module.infra.convert.config.InfConfigConvert; -import cn.iocoder.yudao.module.infra.service.config.InfConfigService; -import cn.iocoder.yudao.module.infra.controller.config.vo.*; -import cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants; +import cn.iocoder.yudao.module.infra.convert.config.ConfigConvert; +import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO; +import cn.iocoder.yudao.module.infra.service.config.ConfigService; +import cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; @@ -25,18 +23,17 @@ import javax.validation.Valid; import java.io.IOException; import java.util.List; -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; -@Api(tags = "参数配置") +@Api(tags = "管理后台 - 参数配置") @RestController @RequestMapping("/infra/config") @Validated public class ConfigController { @Resource - private InfConfigService configService; + private ConfigService configService; @PostMapping("/create") @ApiOperation("创建参数配置") @@ -67,19 +64,19 @@ public class ConfigController { @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) @PreAuthorize("@ss.hasPermission('infra:config:query')") public CommonResult getConfig(@RequestParam("id") Long id) { - return success(InfConfigConvert.INSTANCE.convert(configService.getConfig(id))); + return success(ConfigConvert.INSTANCE.convert(configService.getConfig(id))); } @GetMapping(value = "/get-value-by-key") @ApiOperation(value = "根据参数键名查询参数值", notes = "敏感配置,不允许返回给前端") @ApiImplicitParam(name = "key", value = "参数键", required = true, example = "yunai.biz.username", dataTypeClass = String.class) public CommonResult getConfigKey(@RequestParam("key") String key) { - InfConfigDO config = configService.getConfigByKey(key); + ConfigDO config = configService.getConfigByKey(key); if (config == null) { return null; } if (config.getSensitive()) { - throw ServiceExceptionUtil.exception(InfErrorCodeConstants.CONFIG_GET_VALUE_ERROR_IF_SENSITIVE); + throw ServiceExceptionUtil.exception(ErrorCodeConstants.CONFIG_GET_VALUE_ERROR_IF_SENSITIVE); } return success(config.getValue()); } @@ -88,8 +85,8 @@ public class ConfigController { @ApiOperation("获取参数配置分页") @PreAuthorize("@ss.hasPermission('infra:config:query')") public CommonResult> getConfigPage(@Valid ConfigPageReqVO reqVO) { - PageResult page = configService.getConfigPage(reqVO); - return success(InfConfigConvert.INSTANCE.convertPage(page)); + PageResult page = configService.getConfigPage(reqVO); + return success(ConfigConvert.INSTANCE.convertPage(page)); } @GetMapping("/export") @@ -98,9 +95,9 @@ public class ConfigController { @OperateLog(type = EXPORT) public void exportSysConfig(@Valid ConfigExportReqVO reqVO, HttpServletResponse response) throws IOException { - List list = configService.getConfigList(reqVO); + List list = configService.getConfigList(reqVO); // 拼接数据 - List datas = InfConfigConvert.INSTANCE.convertList(list); + List datas = ConfigConvert.INSTANCE.convertList(list); // 输出 ExcelUtils.write(response, "参数配置.xls", "数据", ConfigExcelVO.class, datas); } diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigExportReqVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigExportReqVO.java index 73ee016cd..2e328e6d9 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigExportReqVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigExportReqVO.java @@ -9,7 +9,7 @@ import java.util.Date; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; -@ApiModel("参数配置导出 Request VO") +@ApiModel("管理后台 - 参数配置导出 Request VO") @Data public class ConfigExportReqVO { diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigPageReqVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigPageReqVO.java index e97585f74..87d4ce928 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigPageReqVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigPageReqVO.java @@ -12,7 +12,7 @@ import java.util.Date; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; -@ApiModel("参数配置分页 Request VO") +@ApiModel("管理后台 - 参数配置分页 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigRespVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigRespVO.java index 464eb030d..03196e060 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigRespVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigRespVO.java @@ -9,7 +9,7 @@ import javax.validation.constraints.NotBlank; import javax.validation.constraints.Size; import java.util.Date; -@ApiModel("参数配置信息 Response VO") +@ApiModel("管理后台 - 参数配置信息 Response VO") @Data @EqualsAndHashCode(callSuper = true) public class ConfigRespVO extends ConfigBaseVO { diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigUpdateReqVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigUpdateReqVO.java index 5de7ea3b7..2335d6169 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigUpdateReqVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/config/vo/ConfigUpdateReqVO.java @@ -8,7 +8,7 @@ import lombok.ToString; import javax.validation.constraints.NotNull; -@ApiModel("参数配置创建 Request VO") +@ApiModel("管理后台 - 参数配置创建 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/doc/InfDbDocController.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/doc/DbDocController.java similarity index 98% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/doc/InfDbDocController.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/doc/DbDocController.java index e8533e5cc..57cad489f 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/doc/InfDbDocController.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/doc/DbDocController.java @@ -16,7 +16,6 @@ import com.zaxxer.hikari.HikariDataSource; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; -import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -28,10 +27,10 @@ import java.io.File; import java.io.IOException; import java.util.Collections; -@Api(tags = "数据库文档") +@Api(tags = "管理后台 - 数据库文档") @RestController @RequestMapping("/infra/db-doc") -public class InfDbDocController { +public class DbDocController { @Resource private DynamicDataSourceProperties dynamicDataSourceProperties; diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/InfFileController.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java similarity index 72% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/InfFileController.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java index 7d7d46b83..32789f1af 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/InfFileController.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/FileController.java @@ -1,16 +1,15 @@ package cn.iocoder.yudao.module.infra.controller.admin.file; import cn.hutool.core.io.IoUtil; -import cn.iocoder.yudao.module.infra.controller.admin.file.vo.InfFilePageReqVO; -import cn.iocoder.yudao.module.infra.service.file.InfFileService; -import cn.iocoder.yudao.coreservice.modules.infra.controller.file.vo.InfFileRespVO; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO; -import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.infra.convert.file.InfFileConvert; import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; +import cn.iocoder.yudao.module.infra.controller.admin.file.vo.FilePageReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.file.vo.FileRespVO; +import cn.iocoder.yudao.module.infra.convert.file.FileConvert; +import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO; +import cn.iocoder.yudao.module.infra.service.file.FileService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -29,17 +28,15 @@ import java.io.IOException; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; -@Api(tags = "文件存储") +@Api(tags = "管理后台 - 文件存储") @RestController @RequestMapping("/infra/file") @Validated @Slf4j -public class InfFileController { +public class FileController { @Resource - private InfFileService fileService; - @Resource - private InfFileCoreService fileCoreService; + private FileService fileService; @PostMapping("/upload") @ApiOperation("上传文件") @@ -49,7 +46,7 @@ public class InfFileController { }) public CommonResult uploadFile(@RequestParam("file") MultipartFile file, @RequestParam("path") String path) throws IOException { - return success(fileCoreService.createFile(path, IoUtil.readBytes(file.getInputStream()))); + return success(fileService.createFile(path, IoUtil.readBytes(file.getInputStream()))); } @DeleteMapping("/delete") @@ -57,7 +54,7 @@ public class InfFileController { @ApiImplicitParam(name = "id", value = "编号", required = true, dataTypeClass = String.class) @PreAuthorize("@ss.hasPermission('infra:file:delete')") public CommonResult deleteFile(@RequestParam("id") String id) { - fileCoreService.deleteFile(id); + fileService.deleteFile(id); return success(true); } @@ -66,7 +63,7 @@ public class InfFileController { @ApiImplicitParam(name = "path", value = "文件附件", required = true, dataTypeClass = MultipartFile.class) public void getFile(HttpServletResponse response, @PathVariable("path") String path) throws IOException { TenantContextHolder.setNullTenantId(); - InfFileDO file = fileCoreService.getFile(path); + FileDO file = fileService.getFile(path); if (file == null) { log.warn("[getFile][path({}) 文件不存在]", path); response.setStatus(HttpStatus.NOT_FOUND.value()); @@ -78,9 +75,9 @@ public class InfFileController { @GetMapping("/page") @ApiOperation("获得文件分页") @PreAuthorize("@ss.hasPermission('infra:file:query')") - public CommonResult> getFilePage(@Valid InfFilePageReqVO pageVO) { - PageResult pageResult = fileService.getFilePage(pageVO); - return success(InfFileConvert.INSTANCE.convertPage(pageResult)); + public CommonResult> getFilePage(@Valid FilePageReqVO pageVO) { + PageResult pageResult = fileService.getFilePage(pageVO); + return success(FileConvert.INSTANCE.convertPage(pageResult)); } } diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/InfFilePageReqVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/FilePageReqVO.java similarity index 91% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/InfFilePageReqVO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/FilePageReqVO.java index 5b639cc39..bf67300ab 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/InfFilePageReqVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/FilePageReqVO.java @@ -12,11 +12,11 @@ import java.util.Date; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; -@ApiModel("文件分页 Request VO") +@ApiModel("管理后台 - 文件分页 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class InfFilePageReqVO extends PageParam { +public class FilePageReqVO extends PageParam { @ApiModelProperty(value = "文件路径", example = "yudao", notes = "模糊匹配") private String id; diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/vo/InfFileRespVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/FileRespVO.java similarity index 69% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/vo/InfFileRespVO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/FileRespVO.java index dfd914791..838f3272b 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/vo/InfFileRespVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/file/vo/FileRespVO.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.infra.vo; +package cn.iocoder.yudao.module.infra.controller.admin.file.vo; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -6,9 +6,9 @@ import lombok.Data; import java.util.Date; -@ApiModel(value = "文件 Response VO", description = "不返回 content 字段,太大") +@ApiModel(value = "管理后台 - 文件 Response VO", description = "不返回 content 字段,太大") @Data -public class InfFileRespVO { +public class FileRespVO { @ApiModelProperty(value = "文件路径", required = true, example = "yudao.jpg") private String id; diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/InfJobController.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/JobController.java similarity index 76% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/InfJobController.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/JobController.java index f153f3f6e..47ef687dd 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/InfJobController.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/JobController.java @@ -5,12 +5,10 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; import cn.iocoder.yudao.framework.quartz.core.util.CronUtils; -import cn.iocoder.yudao.adminserver.modules.infra.controller.job.vo.job.*; import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.*; -import cn.iocoder.yudao.module.infra.convert.job.InfJobConvert; -import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobDO; -import cn.iocoder.yudao.module.infra.service.job.InfJobService; -import cn.iocoder.yudao.module.infra.controller.job.vo.job.*; +import cn.iocoder.yudao.module.infra.convert.job.JobConvert; +import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO; +import cn.iocoder.yudao.module.infra.service.job.JobService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -32,19 +30,19 @@ import java.util.List; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; -@Api(tags = "定时任务") +@Api(tags = "管理后台 - 定时任务") @RestController @RequestMapping("/infra/job") @Validated -public class InfJobController { +public class JobController { @Resource - private InfJobService jobService; + private JobService jobService; @PostMapping("/create") @ApiOperation("创建定时任务") @PreAuthorize("@ss.hasPermission('infra:job:create')") - public CommonResult createJob(@Valid @RequestBody InfJobCreateReqVO createReqVO) + public CommonResult createJob(@Valid @RequestBody JobCreateReqVO createReqVO) throws SchedulerException { return success(jobService.createJob(createReqVO)); } @@ -52,7 +50,7 @@ public class InfJobController { @PutMapping("/update") @ApiOperation("更新定时任务") @PreAuthorize("@ss.hasPermission('infra:job:update')") - public CommonResult updateJob(@Valid @RequestBody InfJobUpdateReqVO updateReqVO) + public CommonResult updateJob(@Valid @RequestBody JobUpdateReqVO updateReqVO) throws SchedulerException { jobService.updateJob(updateReqVO); return success(true); @@ -94,38 +92,38 @@ public class InfJobController { @ApiOperation("获得定时任务") @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) @PreAuthorize("@ss.hasPermission('infra:job:query')") - public CommonResult getJob(@RequestParam("id") Long id) { - InfJobDO job = jobService.getJob(id); - return success(InfJobConvert.INSTANCE.convert(job)); + public CommonResult getJob(@RequestParam("id") Long id) { + JobDO job = jobService.getJob(id); + return success(JobConvert.INSTANCE.convert(job)); } @GetMapping("/list") @ApiOperation("获得定时任务列表") @ApiImplicitParam(name = "ids", value = "编号列表", required = true, dataTypeClass = List.class) @PreAuthorize("@ss.hasPermission('infra:job:query')") - public CommonResult> getJobList(@RequestParam("ids") Collection ids) { - List list = jobService.getJobList(ids); - return success(InfJobConvert.INSTANCE.convertList(list)); + public CommonResult> getJobList(@RequestParam("ids") Collection ids) { + List list = jobService.getJobList(ids); + return success(JobConvert.INSTANCE.convertList(list)); } @GetMapping("/page") @ApiOperation("获得定时任务分页") @PreAuthorize("@ss.hasPermission('infra:job:query')") - public CommonResult> getJobPage(@Valid InfJobPageReqVO pageVO) { - PageResult pageResult = jobService.getJobPage(pageVO); - return success(InfJobConvert.INSTANCE.convertPage(pageResult)); + public CommonResult> getJobPage(@Valid JobPageReqVO pageVO) { + PageResult pageResult = jobService.getJobPage(pageVO); + return success(JobConvert.INSTANCE.convertPage(pageResult)); } @GetMapping("/export-excel") @ApiOperation("导出定时任务 Excel") @PreAuthorize("@ss.hasPermission('infra:job:export')") @OperateLog(type = EXPORT) - public void exportJobExcel(@Valid InfJobExportReqVO exportReqVO, + public void exportJobExcel(@Valid JobExportReqVO exportReqVO, HttpServletResponse response) throws IOException { - List list = jobService.getJobList(exportReqVO); + List list = jobService.getJobList(exportReqVO); // 导出 Excel - List datas = InfJobConvert.INSTANCE.convertList02(list); - ExcelUtils.write(response, "定时任务.xls", "数据", InfJobExcelVO.class, datas); + List datas = JobConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "定时任务.xls", "数据", JobExcelVO.class, datas); } @GetMapping("/get_next_times") @@ -137,7 +135,7 @@ public class InfJobController { @PreAuthorize("@ss.hasPermission('infra:job:query')") public CommonResult> getJobNextTimes(@RequestParam("id") Long id, @RequestParam(value = "count", required = false, defaultValue = "5") Integer count) { - InfJobDO job = jobService.getJob(id); + JobDO job = jobService.getJob(id); if (job == null) { return success(Collections.emptyList()); } diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/InfJobLogController.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/JobLogController.java similarity index 64% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/InfJobLogController.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/JobLogController.java index eb1211f32..40de986cf 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/InfJobLogController.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/JobLogController.java @@ -4,13 +4,13 @@ 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; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogExcelVO; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogExportReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogPageReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogRespVO; -import cn.iocoder.yudao.module.infra.convert.job.InfJobLogConvert; -import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobLogDO; -import cn.iocoder.yudao.module.infra.service.job.InfJobLogService; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExcelVO; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogRespVO; +import cn.iocoder.yudao.module.infra.convert.job.JobLogConvert; +import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO; +import cn.iocoder.yudao.module.infra.service.job.JobLogService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiOperation; @@ -31,51 +31,51 @@ import java.util.List; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; -@Api(tags = "定时任务日志") +@Api(tags = "管理后台 - 定时任务日志") @RestController @RequestMapping("/infra/job-log") @Validated -public class InfJobLogController { +public class JobLogController { @Resource - private InfJobLogService jobLogService; + private JobLogService jobLogService; @GetMapping("/get") @ApiOperation("获得定时任务日志") @ApiImplicitParam(name = "id", value = "编号", required = true, example = "1024", dataTypeClass = Long.class) @PreAuthorize("@ss.hasPermission('infra:job:query')") - public CommonResult getJobLog(@RequestParam("id") Long id) { - InfJobLogDO jobLog = jobLogService.getJobLog(id); - return success(InfJobLogConvert.INSTANCE.convert(jobLog)); + public CommonResult getJobLog(@RequestParam("id") Long id) { + JobLogDO jobLog = jobLogService.getJobLog(id); + return success(JobLogConvert.INSTANCE.convert(jobLog)); } @GetMapping("/list") @ApiOperation("获得定时任务日志列表") @ApiImplicitParam(name = "ids", value = "编号列表", required = true, example = "1024,2048", dataTypeClass = List.class) @PreAuthorize("@ss.hasPermission('infra:job:query')") - public CommonResult> getJobLogList(@RequestParam("ids") Collection ids) { - List list = jobLogService.getJobLogList(ids); - return success(InfJobLogConvert.INSTANCE.convertList(list)); + public CommonResult> getJobLogList(@RequestParam("ids") Collection ids) { + List list = jobLogService.getJobLogList(ids); + return success(JobLogConvert.INSTANCE.convertList(list)); } @GetMapping("/page") @ApiOperation("获得定时任务日志分页") @PreAuthorize("@ss.hasPermission('infra:job:query')") - public CommonResult> getJobLogPage(@Valid InfJobLogPageReqVO pageVO) { - PageResult pageResult = jobLogService.getJobLogPage(pageVO); - return success(InfJobLogConvert.INSTANCE.convertPage(pageResult)); + public CommonResult> getJobLogPage(@Valid JobLogPageReqVO pageVO) { + PageResult pageResult = jobLogService.getJobLogPage(pageVO); + return success(JobLogConvert.INSTANCE.convertPage(pageResult)); } @GetMapping("/export-excel") @ApiOperation("导出定时任务日志 Excel") @PreAuthorize("@ss.hasPermission('infra:job:export')") @OperateLog(type = EXPORT) - public void exportJobLogExcel(@Valid InfJobLogExportReqVO exportReqVO, + public void exportJobLogExcel(@Valid JobLogExportReqVO exportReqVO, HttpServletResponse response) throws IOException { - List list = jobLogService.getJobLogList(exportReqVO); + List list = jobLogService.getJobLogList(exportReqVO); // 导出 Excel - List datas = InfJobLogConvert.INSTANCE.convertList02(list); - ExcelUtils.write(response, "任务日志.xls", "数据", InfJobLogExcelVO.class, datas); + List datas = JobLogConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "任务日志.xls", "数据", JobLogExcelVO.class, datas); } } diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/InfJobBaseVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobBaseVO.java similarity index 97% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/InfJobBaseVO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobBaseVO.java index b0e0ead2b..db3fcac1d 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/InfJobBaseVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobBaseVO.java @@ -10,7 +10,7 @@ import javax.validation.constraints.NotNull; * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 */ @Data -public class InfJobBaseVO { +public class JobBaseVO { @ApiModelProperty(value = "任务名称", required = true, example = "测试任务") @NotNull(message = "任务名称不能为空") diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/InfJobCreateReqVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobCreateReqVO.java similarity index 83% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/InfJobCreateReqVO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobCreateReqVO.java index 5548c257c..0e9f45741 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/InfJobCreateReqVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobCreateReqVO.java @@ -8,11 +8,11 @@ import lombok.ToString; import javax.validation.constraints.NotNull; -@ApiModel("定时任务创建 Request VO") +@ApiModel("管理后台 - 定时任务创建 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class InfJobCreateReqVO extends InfJobBaseVO { +public class JobCreateReqVO extends JobBaseVO { @ApiModelProperty(value = "处理器的名字", required = true, example = "sysUserSessionTimeoutJob") @NotNull(message = "处理器的名字不能为空") diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/InfJobExcelVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobExcelVO.java similarity index 97% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/InfJobExcelVO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobExcelVO.java index bffaaba23..6b5a6a0b1 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/InfJobExcelVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobExcelVO.java @@ -14,7 +14,7 @@ import java.util.Date; * @author 芋道源码 */ @Data -public class InfJobExcelVO { +public class JobExcelVO { @ExcelProperty("任务编号") private Long id; diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/InfJobExportReqVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobExportReqVO.java similarity index 58% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/InfJobExportReqVO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobExportReqVO.java index f30839f85..1155311d1 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/InfJobExportReqVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobExportReqVO.java @@ -4,17 +4,17 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; -@ApiModel(value = "定时任务 Excel 导出 Request VO", description = "参数和 InfJobPageReqVO 是一致的") +@ApiModel(value = "管理后台 - 定时任务 Excel 导出 Request VO", description = "参数和 InfJobPageReqVO 是一致的") @Data -public class InfJobExportReqVO { +public class JobExportReqVO { @ApiModelProperty(value = "任务名称", example = "测试任务", notes = "模糊匹配") private String name; - @ApiModelProperty(value = "任务状态", example = "1", notes = "参见 InfJobStatusEnum 枚举") + @ApiModelProperty(value = "任务状态", example = "1", notes = "参见 JobStatusEnum 枚举") private Integer status; - @ApiModelProperty(value = "处理器的名字", example = "sysUserSessionTimeoutJob", notes = "模糊匹配") + @ApiModelProperty(value = "处理器的名字", example = "UserSessionTimeoutJob", notes = "模糊匹配") private String handlerName; } diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/InfJobPageReqVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobPageReqVO.java similarity index 88% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/InfJobPageReqVO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobPageReqVO.java index edfc425a5..0d8dd53e3 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/InfJobPageReqVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobPageReqVO.java @@ -7,11 +7,11 @@ import lombok.Data; import lombok.EqualsAndHashCode; import lombok.ToString; -@ApiModel("定时任务分页 Request VO") +@ApiModel("管理后台 - 定时任务分页 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class InfJobPageReqVO extends PageParam { +public class JobPageReqVO extends PageParam { @ApiModelProperty(value = "任务名称", example = "测试任务", notes = "模糊匹配") private String name; diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/InfJobRespVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobRespVO.java similarity index 90% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/InfJobRespVO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobRespVO.java index 0b59518f3..586134278 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/InfJobRespVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobRespVO.java @@ -9,11 +9,11 @@ import lombok.ToString; import javax.validation.constraints.NotNull; import java.util.Date; -@ApiModel("定时任务 Response VO") +@ApiModel("管理后台 - 定时任务 Response VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class InfJobRespVO extends InfJobBaseVO { +public class JobRespVO extends JobBaseVO { @ApiModelProperty(value = "任务编号", required = true, example = "1024") private Long id; diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/InfJobUpdateReqVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobUpdateReqVO.java similarity index 82% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/InfJobUpdateReqVO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobUpdateReqVO.java index 1722bbf31..f26cd226c 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/InfJobUpdateReqVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/job/JobUpdateReqVO.java @@ -8,11 +8,11 @@ import lombok.ToString; import javax.validation.constraints.NotNull; -@ApiModel("定时任务更新 Request VO") +@ApiModel("管理后台 - 定时任务更新 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class InfJobUpdateReqVO extends InfJobBaseVO { +public class JobUpdateReqVO extends JobBaseVO { @ApiModelProperty(value = "任务编号", required = true, example = "1024") @NotNull(message = "任务编号不能为空") diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/InfJobLogBaseVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogBaseVO.java similarity index 98% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/InfJobLogBaseVO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogBaseVO.java index 78a33107e..496969d73 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/InfJobLogBaseVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogBaseVO.java @@ -14,7 +14,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 */ @Data -public class InfJobLogBaseVO { +public class JobLogBaseVO { @ApiModelProperty(value = "任务编号", required = true, example = "1024") @NotNull(message = "任务编号不能为空") diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/InfJobLogExcelVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogExcelVO.java similarity index 97% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/InfJobLogExcelVO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogExcelVO.java index 7c10bdc98..25eed2a3f 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/InfJobLogExcelVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogExcelVO.java @@ -14,7 +14,7 @@ import java.util.Date; * @author 芋艿 */ @Data -public class InfJobLogExcelVO { +public class JobLogExcelVO { @ExcelProperty("日志编号") private Long id; diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/InfJobLogExportReqVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogExportReqVO.java similarity index 85% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/InfJobLogExportReqVO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogExportReqVO.java index 432b2d6da..32aa9619b 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/InfJobLogExportReqVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogExportReqVO.java @@ -9,9 +9,9 @@ import java.util.Date; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; -@ApiModel(value = "定时任务 Excel 导出 Request VO", description = "参数和 InfJobLogPageReqVO 是一致的") +@ApiModel(value = "管理后台 - 定时任务 Excel 导出 Request VO", description = "参数和 InfJobLogPageReqVO 是一致的") @Data -public class InfJobLogExportReqVO { +public class JobLogExportReqVO { @ApiModelProperty(value = "任务编号", example = "10") private Long jobId; diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/InfJobLogPageReqVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogPageReqVO.java similarity index 91% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/InfJobLogPageReqVO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogPageReqVO.java index da3d5e3a6..f17f35886 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/InfJobLogPageReqVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogPageReqVO.java @@ -12,11 +12,11 @@ import java.util.Date; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; -@ApiModel("定时任务日志分页 Request VO") +@ApiModel("管理后台 - 定时任务日志分页 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class InfJobLogPageReqVO extends PageParam { +public class JobLogPageReqVO extends PageParam { @ApiModelProperty(value = "任务编号", example = "10") private Long jobId; diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/InfJobLogRespVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogRespVO.java similarity index 83% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/InfJobLogRespVO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogRespVO.java index fa0e959d8..c806a209a 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/InfJobLogRespVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/job/vo/log/JobLogRespVO.java @@ -8,11 +8,11 @@ import lombok.ToString; import java.util.Date; -@ApiModel("定时任务日志 Response VO") +@ApiModel("管理后台 - 定时任务日志 Response VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class InfJobLogRespVO extends InfJobLogBaseVO { +public class JobLogRespVO extends JobLogBaseVO { @ApiModelProperty(value = "日志编号", required = true, example = "1024") private Long id; diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/InfApiAccessLogController.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/ApiAccessLogController.java similarity index 62% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/InfApiAccessLogController.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/ApiAccessLogController.java index 1c3ef1a06..5046ea5af 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/InfApiAccessLogController.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/ApiAccessLogController.java @@ -1,16 +1,16 @@ package cn.iocoder.yudao.module.infra.controller.admin.logger; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; 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; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogExcelVO; -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogExportReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogPageReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogRespVO; -import cn.iocoder.yudao.module.infra.convert.logger.InfApiAccessLogConvert; -import cn.iocoder.yudao.module.infra.service.logger.InfApiAccessLogService; +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExcelVO; +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogRespVO; +import cn.iocoder.yudao.module.infra.convert.logger.ApiAccessLogConvert; +import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO; +import cn.iocoder.yudao.module.infra.service.logger.ApiAccessLogService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.security.access.prepost.PreAuthorize; @@ -28,33 +28,33 @@ import java.util.List; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; -@Api(tags = "API 访问日志") +@Api(tags = "管理后台 - API 访问日志") @RestController @RequestMapping("/infra/api-access-log") @Validated -public class InfApiAccessLogController { +public class ApiAccessLogController { @Resource - private InfApiAccessLogService apiAccessLogService; + private ApiAccessLogService apiAccessLogService; @GetMapping("/page") @ApiOperation("获得API 访问日志分页") @PreAuthorize("@ss.hasPermission('infra:api-access-log:query')") - public CommonResult> getApiAccessLogPage(@Valid InfApiAccessLogPageReqVO pageVO) { - PageResult pageResult = apiAccessLogService.getApiAccessLogPage(pageVO); - return success(InfApiAccessLogConvert.INSTANCE.convertPage(pageResult)); + public CommonResult> getApiAccessLogPage(@Valid ApiAccessLogPageReqVO pageVO) { + PageResult pageResult = apiAccessLogService.getApiAccessLogPage(pageVO); + return success(ApiAccessLogConvert.INSTANCE.convertPage(pageResult)); } @GetMapping("/export-excel") @ApiOperation("导出API 访问日志 Excel") @PreAuthorize("@ss.hasPermission('infra:api-access-log:export')") @OperateLog(type = EXPORT) - public void exportApiAccessLogExcel(@Valid InfApiAccessLogExportReqVO exportReqVO, + public void exportApiAccessLogExcel(@Valid ApiAccessLogExportReqVO exportReqVO, HttpServletResponse response) throws IOException { - List list = apiAccessLogService.getApiAccessLogList(exportReqVO); + List list = apiAccessLogService.getApiAccessLogList(exportReqVO); // 导出 Excel - List datas = InfApiAccessLogConvert.INSTANCE.convertList02(list); - ExcelUtils.write(response, "API 访问日志.xls", "数据", InfApiAccessLogExcelVO.class, datas); + List datas = ApiAccessLogConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "API 访问日志.xls", "数据", ApiAccessLogExcelVO.class, datas); } } diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/InfApiErrorLogController.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/ApiErrorLogController.java similarity index 70% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/InfApiErrorLogController.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/ApiErrorLogController.java index db46bb253..d592836b2 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/InfApiErrorLogController.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/ApiErrorLogController.java @@ -1,16 +1,16 @@ package cn.iocoder.yudao.module.infra.controller.admin.logger; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO; 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; import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog; -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogExcelVO; -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogExportReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogPageReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogRespVO; -import cn.iocoder.yudao.module.infra.convert.logger.InfApiErrorLogConvert; -import cn.iocoder.yudao.module.infra.service.logger.InfApiErrorLogService; +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExcelVO; +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogRespVO; +import cn.iocoder.yudao.module.infra.convert.logger.ApiErrorLogConvert; +import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO; +import cn.iocoder.yudao.module.infra.service.logger.ApiErrorLogService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.ApiImplicitParams; @@ -29,14 +29,14 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; -@Api(tags = "API 错误日志") +@Api(tags = "管理后台 - API 错误日志") @RestController @RequestMapping("/infra/api-error-log") @Validated -public class InfApiErrorLogController { +public class ApiErrorLogController { @Resource - private InfApiErrorLogService apiErrorLogService; + private ApiErrorLogService apiErrorLogService; @PutMapping("/update-status") @ApiOperation("更新 API 错误日志的状态") @@ -54,21 +54,21 @@ public class InfApiErrorLogController { @GetMapping("/page") @ApiOperation("获得 API 错误日志分页") @PreAuthorize("@ss.hasPermission('infra:api-error-log:query')") - public CommonResult> getApiErrorLogPage(@Valid InfApiErrorLogPageReqVO pageVO) { - PageResult pageResult = apiErrorLogService.getApiErrorLogPage(pageVO); - return success(InfApiErrorLogConvert.INSTANCE.convertPage(pageResult)); + public CommonResult> getApiErrorLogPage(@Valid ApiErrorLogPageReqVO pageVO) { + PageResult pageResult = apiErrorLogService.getApiErrorLogPage(pageVO); + return success(ApiErrorLogConvert.INSTANCE.convertPage(pageResult)); } @GetMapping("/export-excel") @ApiOperation("导出 API 错误日志 Excel") @PreAuthorize("@ss.hasPermission('infra:api-error-log:export')") @OperateLog(type = EXPORT) - public void exportApiErrorLogExcel(@Valid InfApiErrorLogExportReqVO exportReqVO, + public void exportApiErrorLogExcel(@Valid ApiErrorLogExportReqVO exportReqVO, HttpServletResponse response) throws IOException { - List list = apiErrorLogService.getApiErrorLogList(exportReqVO); + List list = apiErrorLogService.getApiErrorLogList(exportReqVO); // 导出 Excel - List datas = InfApiErrorLogConvert.INSTANCE.convertList02(list); - ExcelUtils.write(response, "API 错误日志.xls", "数据", InfApiErrorLogExcelVO.class, datas); + List datas = ApiErrorLogConvert.INSTANCE.convertList02(list); + ExcelUtils.write(response, "API 错误日志.xls", "数据", ApiErrorLogExcelVO.class, datas); } } diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/InfApiAccessLogBaseVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogBaseVO.java similarity index 98% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/InfApiAccessLogBaseVO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogBaseVO.java index 6e44f4eb0..619dea65a 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/InfApiAccessLogBaseVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogBaseVO.java @@ -14,7 +14,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 */ @Data -public class InfApiAccessLogBaseVO { +public class ApiAccessLogBaseVO { @ApiModelProperty(value = "链路追踪编号", required = true, example = "66600cb6-7852-11eb-9439-0242ac130002") @NotNull(message = "链路追踪编号不能为空") diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/InfApiAccessLogExcelVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExcelVO.java similarity index 97% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/InfApiAccessLogExcelVO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExcelVO.java index 1d4e8b530..5c1995c6a 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/InfApiAccessLogExcelVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExcelVO.java @@ -14,7 +14,7 @@ import java.util.Date; * @author 芋道源码 */ @Data -public class InfApiAccessLogExcelVO { +public class ApiAccessLogExcelVO { @ExcelProperty("日志主键") private Long id; diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/InfApiAccessLogExportReqVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExportReqVO.java similarity index 88% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/InfApiAccessLogExportReqVO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExportReqVO.java index 37ddddc01..8c6ac4879 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/InfApiAccessLogExportReqVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogExportReqVO.java @@ -9,9 +9,9 @@ import java.util.Date; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; -@ApiModel(value = "API 访问日志 Excel 导出 Request VO", description = "参数和 InfApiAccessLogPageReqVO 是一致的") +@ApiModel(value = "管理后台 - API 访问日志 Excel 导出 Request VO", description = "参数和 InfApiAccessLogPageReqVO 是一致的") @Data -public class InfApiAccessLogExportReqVO { +public class ApiAccessLogExportReqVO { @ApiModelProperty(value = "用户编号", example = "666") private Long userId; diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/InfApiAccessLogPageReqVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogPageReqVO.java similarity index 92% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/InfApiAccessLogPageReqVO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogPageReqVO.java index 385dab1f0..d318bfa92 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/InfApiAccessLogPageReqVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogPageReqVO.java @@ -12,11 +12,11 @@ import java.util.Date; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; -@ApiModel("API 访问日志分页 Request VO") +@ApiModel("管理后台 - API 访问日志分页 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class InfApiAccessLogPageReqVO extends PageParam { +public class ApiAccessLogPageReqVO extends PageParam { @ApiModelProperty(value = "用户编号", example = "666") private Long userId; diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/InfApiAccessLogRespVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogRespVO.java similarity index 82% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/InfApiAccessLogRespVO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogRespVO.java index c6b74d48d..0458affb0 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/InfApiAccessLogRespVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apiaccesslog/ApiAccessLogRespVO.java @@ -8,11 +8,11 @@ import lombok.ToString; import java.util.Date; -@ApiModel("API 访问日志 Response VO") +@ApiModel("管理后台 - API 访问日志 Response VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class InfApiAccessLogRespVO extends InfApiAccessLogBaseVO { +public class ApiAccessLogRespVO extends ApiAccessLogBaseVO { @ApiModelProperty(value = "日志主键", required = true, example = "1024") private Long id; diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/InfApiErrorLogBaseVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogBaseVO.java similarity index 99% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/InfApiErrorLogBaseVO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogBaseVO.java index d5d6d3ce1..08fbdace8 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/InfApiErrorLogBaseVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogBaseVO.java @@ -14,7 +14,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_ * 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 */ @Data -public class InfApiErrorLogBaseVO { +public class ApiErrorLogBaseVO { @ApiModelProperty(value = "链路追踪编号", required = true, example = "66600cb6-7852-11eb-9439-0242ac130002") @NotNull(message = "链路追踪编号不能为空") diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/InfApiErrorLogExcelVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExcelVO.java similarity index 94% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/InfApiErrorLogExcelVO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExcelVO.java index 06b1da33b..7e1e2ef0c 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/InfApiErrorLogExcelVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExcelVO.java @@ -3,7 +3,6 @@ package cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog; import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; import cn.iocoder.yudao.module.infra.enums.DictTypeConstants; -import cn.iocoder.yudao.module.system.enums.DictTypeConstants; import com.alibaba.excel.annotation.ExcelProperty; import lombok.Data; @@ -15,7 +14,7 @@ import java.util.Date; * @author 芋道源码 */ @Data -public class InfApiErrorLogExcelVO { +public class ApiErrorLogExcelVO { @ExcelProperty("编号") private Integer id; @@ -27,7 +26,7 @@ public class InfApiErrorLogExcelVO { private Integer userId; @ExcelProperty(value = "用户类型", converter = DictConvert.class) - @DictFormat(DictTypeConstants.USER_TYPE) + @DictFormat(cn.iocoder.yudao.module.system.enums.DictTypeConstants.USER_TYPE) private Integer userType; @ExcelProperty("应用名") diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/InfApiErrorLogExportReqVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExportReqVO.java similarity index 87% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/InfApiErrorLogExportReqVO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExportReqVO.java index dcb00a69f..dd66ff6f3 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/InfApiErrorLogExportReqVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogExportReqVO.java @@ -9,9 +9,9 @@ import java.util.Date; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; -@ApiModel(value = "API 错误日志 Excel 导出 Request VO", description = "参数和 InfApiErrorLogPageReqVO 是一致的") +@ApiModel(value = "管理后台 - API 错误日志 Excel 导出 Request VO", description = "参数和 InfApiErrorLogPageReqVO 是一致的") @Data -public class InfApiErrorLogExportReqVO { +public class ApiErrorLogExportReqVO { @ApiModelProperty(value = "用户编号", example = "666") private Long userId; diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/InfApiErrorLogPageReqVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogPageReqVO.java similarity index 92% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/InfApiErrorLogPageReqVO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogPageReqVO.java index 964fee2c8..e9a36af96 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/InfApiErrorLogPageReqVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogPageReqVO.java @@ -12,11 +12,11 @@ import java.util.Date; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; -@ApiModel("API 错误日志分页 Request VO") +@ApiModel("管理后台 - API 错误日志分页 Request VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class InfApiErrorLogPageReqVO extends PageParam { +public class ApiErrorLogPageReqVO extends PageParam { @ApiModelProperty(value = "用户编号", example = "666") private Long userId; diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/InfApiErrorLogRespVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogRespVO.java similarity index 86% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/InfApiErrorLogRespVO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogRespVO.java index ad70bb772..0f0c2724d 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/InfApiErrorLogRespVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/logger/vo/apierrorlog/ApiErrorLogRespVO.java @@ -8,11 +8,11 @@ import lombok.ToString; import java.util.Date; -@ApiModel("API 错误日志 Response VO") +@ApiModel("管理后台 - API 错误日志 Response VO") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class InfApiErrorLogRespVO extends InfApiErrorLogBaseVO { +public class ApiErrorLogRespVO extends ApiErrorLogBaseVO { @ApiModelProperty(value = "编号", required = true, example = "1024") private Integer id; diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/RedisController.http b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/RedisController.http index 1c474e93f..0310dea58 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/RedisController.http +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/RedisController.http @@ -1,7 +1,9 @@ ### 请求 /infra/redis/get-monitor-info 接口 => 成功 GET {{baseUrl}}/infra/redis/get-monitor-info Authorization: Bearer {{token}} +tenant-id: {{adminTenentId}} ### 请求 /infra/redis/get-key-list 接口 => 成功 GET {{baseUrl}}/infra/redis/get-key-list Authorization: Bearer {{token}} +tenant-id: {{adminTenentId}} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/RedisController.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/RedisController.java index b7e499bd6..303e67184 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/RedisController.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/RedisController.java @@ -3,8 +3,8 @@ package cn.iocoder.yudao.module.infra.controller.admin.redis; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.redis.core.RedisKeyDefine; import cn.iocoder.yudao.framework.redis.core.RedisKeyRegistry; -import cn.iocoder.yudao.module.infra.controller.admin.redis.vo.InfRedisKeyRespVO; -import cn.iocoder.yudao.module.infra.controller.admin.redis.vo.InfRedisMonitorRespVO; +import cn.iocoder.yudao.module.infra.controller.admin.redis.vo.RedisKeyRespVO; +import cn.iocoder.yudao.module.infra.controller.admin.redis.vo.RedisMonitorRespVO; import cn.iocoder.yudao.module.infra.convert.redis.RedisConvert; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -22,7 +22,7 @@ import java.util.Properties; import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; -@Api(tags = "Redis 监控") +@Api(tags = "管理后台 - Redis 监控") @RestController @RequestMapping("/infra/redis") public class RedisController { @@ -33,7 +33,7 @@ public class RedisController { @GetMapping("/get-monitor-info") @ApiOperation("获得 Redis 监控信息") @PreAuthorize("@ss.hasPermission('infra:redis:get-monitor-info')") - public CommonResult getRedisMonitorInfo() { + public CommonResult getRedisMonitorInfo() { // 获得 Redis 统计信息 Properties info = stringRedisTemplate.execute((RedisCallback) RedisServerCommands::info); Long dbSize = stringRedisTemplate.execute(RedisServerCommands::dbSize); @@ -47,7 +47,7 @@ public class RedisController { @GetMapping("/get-key-list") @ApiOperation("获得 Redis Key 列表") @PreAuthorize("@ss.hasPermission('infra:redis:get-key-list')") - public CommonResult> getKeyList() { + public CommonResult> getKeyList() { List keyDefines = RedisKeyRegistry.list(); return success(RedisConvert.INSTANCE.convertList(keyDefines)); } diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/vo/InfRedisKeyRespVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/vo/RedisKeyRespVO.java similarity index 90% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/vo/InfRedisKeyRespVO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/vo/RedisKeyRespVO.java index 4f35768a4..6fb71fe9a 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/vo/InfRedisKeyRespVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/vo/RedisKeyRespVO.java @@ -9,11 +9,11 @@ import lombok.Data; import java.time.Duration; -@ApiModel("Redis Key 信息 Response VO") +@ApiModel("管理后台 - Redis Key 信息 Response VO") @Data @Builder @AllArgsConstructor -public class InfRedisKeyRespVO { +public class RedisKeyRespVO { @ApiModelProperty(value = "login_user:%s", required = true, example = "String") private String keyTemplate; @@ -22,7 +22,7 @@ public class InfRedisKeyRespVO { private RedisKeyDefine.KeyTypeEnum keyType; @ApiModelProperty(value = "Value 类型", required = true, example = "java.lang.String") - private Class valueType; + private Class valueType; @ApiModelProperty(value = "超时类型", required = true, example = "1") private RedisKeyDefine.TimeoutTypeEnum timeoutType; diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/vo/InfRedisMonitorRespVO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/vo/RedisMonitorRespVO.java similarity index 92% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/vo/InfRedisMonitorRespVO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/vo/RedisMonitorRespVO.java index bee54013c..703a697dc 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/vo/InfRedisMonitorRespVO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/controller/admin/redis/vo/RedisMonitorRespVO.java @@ -9,11 +9,11 @@ import lombok.Data; import java.util.List; import java.util.Properties; -@ApiModel("Redis 监控信息 Response VO") +@ApiModel("管理后台 - Redis 监控信息 Response VO") @Data @Builder @AllArgsConstructor -public class InfRedisMonitorRespVO { +public class RedisMonitorRespVO { @ApiModelProperty(value = "Redis info 指令结果", required = true, notes = "具体字段,查看 Redis 文档") private Properties info; diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/config/InfConfigConvert.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/config/ConfigConvert.java similarity index 53% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/config/InfConfigConvert.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/config/ConfigConvert.java index 4dbd0dc53..8e16af1a3 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/config/InfConfigConvert.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/config/ConfigConvert.java @@ -1,29 +1,29 @@ package cn.iocoder.yudao.module.infra.convert.config; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.config.InfConfigDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigCreateReqVO; import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigExcelVO; import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigRespVO; import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigUpdateReqVO; +import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; import java.util.List; @Mapper -public interface InfConfigConvert { +public interface ConfigConvert { - InfConfigConvert INSTANCE = Mappers.getMapper(InfConfigConvert.class); + ConfigConvert INSTANCE = Mappers.getMapper(ConfigConvert.class); - PageResult convertPage(PageResult page); + PageResult convertPage(PageResult page); - ConfigRespVO convert(InfConfigDO bean); + ConfigRespVO convert(ConfigDO bean); - InfConfigDO convert(ConfigCreateReqVO bean); + ConfigDO convert(ConfigCreateReqVO bean); - InfConfigDO convert(ConfigUpdateReqVO bean); + ConfigDO convert(ConfigUpdateReqVO bean); - List convertList(List list); + List convertList(List list); } diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/file/FileConvert.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/file/FileConvert.java new file mode 100644 index 000000000..affeddba4 --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/file/FileConvert.java @@ -0,0 +1,18 @@ +package cn.iocoder.yudao.module.infra.convert.file; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.infra.controller.admin.file.vo.FileRespVO; +import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +@Mapper +public interface FileConvert { + + FileConvert INSTANCE = Mappers.getMapper(FileConvert.class); + + FileRespVO convert(FileDO bean); + + PageResult convertPage(PageResult page); + +} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/file/InfFileConvert.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/file/InfFileConvert.java deleted file mode 100644 index cbc2298b3..000000000 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/file/InfFileConvert.java +++ /dev/null @@ -1,18 +0,0 @@ -package cn.iocoder.yudao.module.infra.convert.file; - -import cn.iocoder.yudao.coreservice.modules.infra.controller.file.vo.InfFileRespVO; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -@Mapper -public interface InfFileConvert { - - InfFileConvert INSTANCE = Mappers.getMapper(InfFileConvert.class); - - InfFileRespVO convert(InfFileDO bean); - - PageResult convertPage(PageResult page); - -} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/job/InfJobConvert.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/job/InfJobConvert.java deleted file mode 100644 index 5ad7680c2..000000000 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/job/InfJobConvert.java +++ /dev/null @@ -1,36 +0,0 @@ -package cn.iocoder.yudao.module.infra.convert.job; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobCreateReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobExcelVO; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobRespVO; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobUpdateReqVO; -import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobDO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -/** - * 定时任务 Convert - * - * @author 芋道源码 - */ -@Mapper -public interface InfJobConvert { - - InfJobConvert INSTANCE = Mappers.getMapper(InfJobConvert.class); - - InfJobDO convert(InfJobCreateReqVO bean); - - InfJobDO convert(InfJobUpdateReqVO bean); - - InfJobRespVO convert(InfJobDO bean); - - List convertList(List list); - - PageResult convertPage(PageResult page); - - List convertList02(List list); - -} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/job/InfJobLogConvert.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/job/InfJobLogConvert.java deleted file mode 100644 index 5134e6cd4..000000000 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/job/InfJobLogConvert.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.iocoder.yudao.module.infra.convert.job; - -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogExcelVO; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogRespVO; -import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobLogDO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -/** - * 定时任务日志 Convert - * - * @author 芋艿 - */ -@Mapper -public interface InfJobLogConvert { - - InfJobLogConvert INSTANCE = Mappers.getMapper(InfJobLogConvert.class); - - InfJobLogRespVO convert(InfJobLogDO bean); - - List convertList(List list); - - PageResult convertPage(PageResult page); - - List convertList02(List list); - -} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/job/JobConvert.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/job/JobConvert.java new file mode 100644 index 000000000..2c7aa0297 --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/job/JobConvert.java @@ -0,0 +1,36 @@ +package cn.iocoder.yudao.module.infra.convert.job; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobCreateReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobExcelVO; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobRespVO; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobUpdateReqVO; +import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +/** + * 定时任务 Convert + * + * @author 芋道源码 + */ +@Mapper +public interface JobConvert { + + JobConvert INSTANCE = Mappers.getMapper(JobConvert.class); + + JobDO convert(JobCreateReqVO bean); + + JobDO convert(JobUpdateReqVO bean); + + JobRespVO convert(JobDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/job/JobLogConvert.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/job/JobLogConvert.java new file mode 100644 index 000000000..3f32c526d --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/job/JobLogConvert.java @@ -0,0 +1,30 @@ +package cn.iocoder.yudao.module.infra.convert.job; + +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExcelVO; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogRespVO; +import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +/** + * 定时任务日志 Convert + * + * @author 芋艿 + */ +@Mapper +public interface JobLogConvert { + + JobLogConvert INSTANCE = Mappers.getMapper(JobLogConvert.class); + + JobLogRespVO convert(JobLogDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + +} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/ApiAccessLogConvert.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/ApiAccessLogConvert.java new file mode 100644 index 000000000..7162d4d9a --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/ApiAccessLogConvert.java @@ -0,0 +1,33 @@ +package cn.iocoder.yudao.module.infra.convert.logger; + +import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateReqDTO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExcelVO; +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogRespVO; +import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +/** + * API 访问日志 Convert + * + * @author 芋道源码 + */ +@Mapper +public interface ApiAccessLogConvert { + + ApiAccessLogConvert INSTANCE = Mappers.getMapper(ApiAccessLogConvert.class); + + ApiAccessLogRespVO convert(ApiAccessLogDO bean); + + List convertList(List list); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + + ApiAccessLogDO convert(ApiAccessLogCreateReqDTO bean); + +} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/ApiErrorLogConvert.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/ApiErrorLogConvert.java new file mode 100644 index 000000000..8eef7463a --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/ApiErrorLogConvert.java @@ -0,0 +1,31 @@ +package cn.iocoder.yudao.module.infra.convert.logger; + +import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateReqDTO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExcelVO; +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogRespVO; +import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO; +import org.mapstruct.Mapper; +import org.mapstruct.factory.Mappers; + +import java.util.List; + +/** + * API 错误日志 Convert + * + * @author 芋道源码 + */ +@Mapper +public interface ApiErrorLogConvert { + + ApiErrorLogConvert INSTANCE = Mappers.getMapper(ApiErrorLogConvert.class); + + ApiErrorLogRespVO convert(ApiErrorLogDO bean); + + PageResult convertPage(PageResult page); + + List convertList02(List list); + + ApiErrorLogDO convert(ApiErrorLogCreateReqDTO bean); + +} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/InfApiAccessLogConvert.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/InfApiAccessLogConvert.java deleted file mode 100644 index a1ca188ae..000000000 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/InfApiAccessLogConvert.java +++ /dev/null @@ -1,30 +0,0 @@ -package cn.iocoder.yudao.module.infra.convert.logger; - -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogExcelVO; -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogRespVO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -/** - * API 访问日志 Convert - * - * @author 芋道源码 - */ -@Mapper -public interface InfApiAccessLogConvert { - - InfApiAccessLogConvert INSTANCE = Mappers.getMapper(InfApiAccessLogConvert.class); - - InfApiAccessLogRespVO convert(InfApiAccessLogDO bean); - - List convertList(List list); - - PageResult convertPage(PageResult page); - - List convertList02(List list); - -} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/InfApiAccessLogCoreConvert.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/InfApiAccessLogCoreConvert.java deleted file mode 100644 index f8a331a33..000000000 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/InfApiAccessLogCoreConvert.java +++ /dev/null @@ -1,15 +0,0 @@ -package cn.iocoder.yudao.module.infra.convert.logger; - -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateReqDTO; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -@Mapper -public interface InfApiAccessLogCoreConvert { - - InfApiAccessLogCoreConvert INSTANCE = Mappers.getMapper(InfApiAccessLogCoreConvert.class); - - InfApiAccessLogDO convert(ApiAccessLogCreateReqDTO bean); - -} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/InfApiErrorLogConvert.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/InfApiErrorLogConvert.java deleted file mode 100644 index 1b8d33b6d..000000000 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/InfApiErrorLogConvert.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.iocoder.yudao.module.infra.convert.logger; - -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogExcelVO; -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogRespVO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -import java.util.List; - -/** - * API 错误日志 Convert - * - * @author 芋道源码 - */ -@Mapper -public interface InfApiErrorLogConvert { - - InfApiErrorLogConvert INSTANCE = Mappers.getMapper(InfApiErrorLogConvert.class); - - InfApiErrorLogRespVO convert(InfApiErrorLogDO bean); - - PageResult convertPage(PageResult page); - - List convertList02(List list); - -} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/InfApiErrorLogCoreConvert.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/InfApiErrorLogCoreConvert.java deleted file mode 100644 index cf8225f0a..000000000 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/logger/InfApiErrorLogCoreConvert.java +++ /dev/null @@ -1,15 +0,0 @@ -package cn.iocoder.yudao.module.infra.convert.logger; - -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateReqDTO; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO; -import org.mapstruct.Mapper; -import org.mapstruct.factory.Mappers; - -@Mapper -public interface InfApiErrorLogCoreConvert { - - InfApiErrorLogCoreConvert INSTANCE = Mappers.getMapper(InfApiErrorLogCoreConvert.class); - - InfApiErrorLogDO convert(ApiErrorLogCreateReqDTO bean); - -} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/redis/RedisConvert.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/redis/RedisConvert.java index f5030a059..e1c931184 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/redis/RedisConvert.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/convert/redis/RedisConvert.java @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.infra.convert.redis; import cn.hutool.core.util.StrUtil; import cn.iocoder.yudao.framework.redis.core.RedisKeyDefine; -import cn.iocoder.yudao.module.infra.controller.admin.redis.vo.InfRedisKeyRespVO; -import cn.iocoder.yudao.module.infra.controller.admin.redis.vo.InfRedisMonitorRespVO; +import cn.iocoder.yudao.module.infra.controller.admin.redis.vo.RedisKeyRespVO; +import cn.iocoder.yudao.module.infra.controller.admin.redis.vo.RedisMonitorRespVO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; @@ -16,11 +16,11 @@ public interface RedisConvert { RedisConvert INSTANCE = Mappers.getMapper(RedisConvert.class); - default InfRedisMonitorRespVO build(Properties info, Long dbSize, Properties commandStats) { - InfRedisMonitorRespVO respVO = InfRedisMonitorRespVO.builder().info(info).dbSize(dbSize) + default RedisMonitorRespVO build(Properties info, Long dbSize, Properties commandStats) { + RedisMonitorRespVO respVO = RedisMonitorRespVO.builder().info(info).dbSize(dbSize) .commandStats(new ArrayList<>(commandStats.size())).build(); commandStats.forEach((key, value) -> { - respVO.getCommandStats().add(InfRedisMonitorRespVO.CommandStat.builder() + respVO.getCommandStats().add(RedisMonitorRespVO.CommandStat.builder() .command(StrUtil.subAfter((String) key, "cmdstat_", false)) .calls(Integer.valueOf(StrUtil.subBetween((String) value, "calls=", ","))) .usec(Long.valueOf(StrUtil.subBetween((String) value, "usec=", ","))) @@ -29,6 +29,6 @@ public interface RedisConvert { return respVO; } - List convertList(List list); + List convertList(List list); } diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/config/InfConfigDO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/config/ConfigDO.java similarity index 94% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/config/InfConfigDO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/config/ConfigDO.java index 4f5107e61..dbcdfed56 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/config/InfConfigDO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/config/ConfigDO.java @@ -13,11 +13,11 @@ import lombok.ToString; * * @author 芋道源码 */ -@TableName("inf_config") +@TableName("infra_config") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) -public class InfConfigDO extends BaseDO { +public class ConfigDO extends BaseDO { /** * 参数主键 diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/file/InfFileDO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/file/FileDO.java similarity index 86% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/file/InfFileDO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/file/FileDO.java index 98aab4252..47eb2403e 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/file/InfFileDO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/file/FileDO.java @@ -1,6 +1,5 @@ package cn.iocoder.yudao.module.infra.dal.dataobject.file; -import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; @@ -16,13 +15,13 @@ import java.io.InputStream; * @author 芋道源码 */ @Data -@TableName("inf_file") +@TableName("infra_file") @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) @Builder @NoArgsConstructor @AllArgsConstructor -public class InfFileDO extends TenantBaseDO { +public class FileDO extends TenantBaseDO { /** * 文件路径 diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/job/InfJobDO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/job/JobDO.java similarity index 89% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/job/InfJobDO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/job/JobDO.java index 43bc2a0b7..c419b1fdb 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/job/InfJobDO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/job/JobDO.java @@ -1,7 +1,7 @@ package cn.iocoder.yudao.module.infra.dal.dataobject.job; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; -import cn.iocoder.yudao.module.infra.enums.job.InfJobStatusEnum; +import cn.iocoder.yudao.module.infra.enums.job.JobStatusEnum; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.*; @@ -11,14 +11,14 @@ import lombok.*; * * @author 芋道源码 */ -@TableName("inf_job") +@TableName("infra_job") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) @Builder @NoArgsConstructor @AllArgsConstructor -public class InfJobDO extends BaseDO { +public class JobDO extends BaseDO { /** * 任务编号 @@ -32,7 +32,7 @@ public class InfJobDO extends BaseDO { /** * 任务状态 * - * 枚举 {@link InfJobStatusEnum} + * 枚举 {@link JobStatusEnum} */ private Integer status; /** diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/job/InfJobLogDO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/job/JobLogDO.java similarity index 81% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/job/InfJobLogDO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/job/JobLogDO.java index ecbe209dd..fa79b9b64 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/job/InfJobLogDO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/job/JobLogDO.java @@ -2,7 +2,7 @@ package cn.iocoder.yudao.module.infra.dal.dataobject.job; import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; import cn.iocoder.yudao.framework.quartz.core.handler.JobHandler; -import cn.iocoder.yudao.module.infra.enums.job.InfJobLogStatusEnum; +import cn.iocoder.yudao.module.infra.enums.job.JobLogStatusEnum; import com.baomidou.mybatisplus.annotation.TableName; import lombok.*; @@ -13,14 +13,14 @@ import java.util.Date; * * @author 芋道源码 */ -@TableName("inf_job_log") +@TableName("infra_job_log") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) @Builder @NoArgsConstructor @AllArgsConstructor -public class InfJobLogDO extends BaseDO { +public class JobLogDO extends BaseDO { /** * 日志编号 @@ -29,19 +29,19 @@ public class InfJobLogDO extends BaseDO { /** * 任务编号 * - * 关联 {@link InfJobDO#getId()} + * 关联 {@link JobDO#getId()} */ private Long jobId; /** * 处理器的名字 * - * 冗余字段 {@link InfJobDO#getHandlerName()} + * 冗余字段 {@link JobDO#getHandlerName()} */ private String handlerName; /** * 处理器的参数 * - * 冗余字段 {@link InfJobDO#getHandlerParam()} + * 冗余字段 {@link JobDO#getHandlerParam()} */ private String handlerParam; /** @@ -66,7 +66,7 @@ public class InfJobLogDO extends BaseDO { /** * 状态 * - * 枚举 {@link InfJobLogStatusEnum} + * 枚举 {@link JobLogStatusEnum} */ private Integer status; /** diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/InfApiAccessLogDO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/ApiAccessLogDO.java similarity index 96% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/InfApiAccessLogDO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/ApiAccessLogDO.java index eea09b6bd..2ad8a326d 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/InfApiAccessLogDO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/ApiAccessLogDO.java @@ -14,14 +14,14 @@ import java.util.Date; * * @author 芋道源码 */ -@TableName("inf_api_access_log") +@TableName("infra_api_access_log") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) @Builder @NoArgsConstructor @AllArgsConstructor -public class InfApiAccessLogDO extends TenantBaseDO { +public class ApiAccessLogDO extends TenantBaseDO { /** * 编号 diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/InfApiErrorLogDO.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/ApiErrorLogDO.java similarity index 94% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/InfApiErrorLogDO.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/ApiErrorLogDO.java index bcf394cd6..fa5b162a5 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/InfApiErrorLogDO.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/dataobject/logger/ApiErrorLogDO.java @@ -1,6 +1,5 @@ package cn.iocoder.yudao.module.infra.dal.dataobject.logger; -import cn.iocoder.yudao.coreservice.modules.infra.enums.logger.InfApiErrorLogProcessStatusEnum; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO; import com.baomidou.mybatisplus.annotation.TableId; @@ -14,14 +13,14 @@ import java.util.Date; * * @author 芋道源码 */ -@TableName("inf_api_error_log") +@TableName("infra_api_error_log") @Data @EqualsAndHashCode(callSuper = true) @ToString(callSuper = true) @Builder @NoArgsConstructor @AllArgsConstructor -public class InfApiErrorLogDO extends TenantBaseDO { +public class ApiErrorLogDO extends TenantBaseDO { /** * 编号 diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/config/InfConfigCoreDAOImpl.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/config/ConfigCoreDAOImpl.java similarity index 88% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/config/InfConfigCoreDAOImpl.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/config/ConfigCoreDAOImpl.java index a4c0377e4..fe531b402 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/config/InfConfigCoreDAOImpl.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/config/ConfigCoreDAOImpl.java @@ -16,11 +16,11 @@ import java.util.List; * * @author 芋道源码 */ -public class InfConfigCoreDAOImpl implements ConfigFrameworkDAO { +public class ConfigCoreDAOImpl implements ConfigFrameworkDAO { private final JdbcTemplate jdbcTemplate; - public InfConfigCoreDAOImpl(String jdbcUrl, String username, String password) { + public ConfigCoreDAOImpl(String jdbcUrl, String username, String password) { DataSource dataSource = new DriverManagerDataSource(jdbcUrl, username, password); this.jdbcTemplate = new JdbcTemplate(dataSource); } diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/config/InfConfigMapper.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/config/ConfigMapper.java similarity index 67% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/config/InfConfigMapper.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/config/ConfigMapper.java index f3d2e2970..aad99ccba 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/config/InfConfigMapper.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/config/ConfigMapper.java @@ -1,33 +1,33 @@ package cn.iocoder.yudao.module.infra.dal.mysql.config; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.config.InfConfigDO; 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 cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigExportReqVO; import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO; +import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import org.apache.ibatis.annotations.Mapper; import java.util.List; @Mapper -public interface InfConfigMapper extends BaseMapperX { +public interface ConfigMapper extends BaseMapperX { - default InfConfigDO selectByKey(String key) { - return selectOne(new QueryWrapper().eq("`key`", key)); + default ConfigDO selectByKey(String key) { + return selectOne(new QueryWrapper().eq("`key`", key)); } - default PageResult selectPage(ConfigPageReqVO reqVO) { - return selectPage(reqVO, new QueryWrapperX() + default PageResult selectPage(ConfigPageReqVO reqVO) { + return selectPage(reqVO, new QueryWrapperX() .likeIfPresent("name", reqVO.getName()) .likeIfPresent("`key`", reqVO.getKey()) .eqIfPresent("`type`", reqVO.getType()) .betweenIfPresent("create_time", reqVO.getBeginTime(), reqVO.getEndTime())); } - default List selectList(ConfigExportReqVO reqVO) { - return selectList(new QueryWrapperX() + default List selectList(ConfigExportReqVO reqVO) { + return selectList(new QueryWrapperX() .likeIfPresent("name", reqVO.getName()) .likeIfPresent("`key`", reqVO.getKey()) .eqIfPresent("`type`", reqVO.getType()) diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileMapper.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileMapper.java new file mode 100644 index 000000000..06e887dde --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/FileMapper.java @@ -0,0 +1,44 @@ +package cn.iocoder.yudao.module.infra.dal.mysql.file; + +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 cn.iocoder.yudao.module.infra.controller.admin.file.vo.FilePageReqVO; +import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO; +import com.baomidou.mybatisplus.annotation.InterceptorIgnore; +import org.apache.ibatis.annotations.Mapper; + +/** + * 文件操作 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface FileMapper extends BaseMapperX { + + default PageResult selectPage(FilePageReqVO reqVO) { + return selectPage(reqVO, new QueryWrapperX() + .likeIfPresent("id", reqVO.getId()) + .likeIfPresent("type", reqVO.getType()) + .betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) + .orderByDesc("create_time")); + } + + default Integer selectCountById(String id) { + return selectCount(FileDO::getId, id); + } + + /** + * 基于 Path 获取文件 + * 实际上,是基于 ID 查询 + * 由于前端使用 的方式获取图片,所以需要忽略租户的查询 + * + * @param path 路径 + * @return 文件 + */ + @InterceptorIgnore(tenantLine = "true") + default FileDO selectByPath(String path) { + return selectById(path); + } + +} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/InfFileCoreMapper.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/InfFileCoreMapper.java deleted file mode 100644 index 065ec0d4f..000000000 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/InfFileCoreMapper.java +++ /dev/null @@ -1,28 +0,0 @@ -package cn.iocoder.yudao.module.infra.dal.mysql.file; - -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO; -import com.baomidou.mybatisplus.annotation.InterceptorIgnore; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface InfFileCoreMapper extends BaseMapperX { - - default Integer selectCountById(String id) { - return selectCount(InfFileDO::getId, id); - } - - /** - * 基于 Path 获取文件 - * 实际上,是基于 ID 查询 - * 由于前端使用 的方式获取图片,所以需要忽略租户的查询 - * - * @param path 路径 - * @return 文件 - */ - @InterceptorIgnore(tenantLine = "true") - default InfFileDO selectByPath(String path) { - return selectById(path); - } - -} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/InfFileMapper.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/InfFileMapper.java deleted file mode 100644 index c987a8e30..000000000 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/file/InfFileMapper.java +++ /dev/null @@ -1,24 +0,0 @@ -package cn.iocoder.yudao.module.infra.dal.mysql.file; - -import cn.iocoder.yudao.module.infra.controller.admin.file.vo.InfFilePageReqVO; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO; -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; - -/** - * admin 文件操作 Mapper - * - * @author 芋道源码 - */ -@Mapper -public interface InfFileMapper extends BaseMapperX { - default PageResult selectPage(InfFilePageReqVO reqVO) { - return selectPage(reqVO, new QueryWrapperX() - .likeIfPresent("id", reqVO.getId()) - .likeIfPresent("type", reqVO.getType()) - .betweenIfPresent("create_time", reqVO.getBeginCreateTime(), reqVO.getEndCreateTime()) - .orderByDesc("create_time")); - } -} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/job/InfJobMapper.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/job/InfJobMapper.java deleted file mode 100644 index 2f2ac91c1..000000000 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/job/InfJobMapper.java +++ /dev/null @@ -1,41 +0,0 @@ -package cn.iocoder.yudao.module.infra.dal.mysql.job; - -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobExportReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobPageReqVO; -import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobDO; -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 org.apache.ibatis.annotations.Mapper; - -import java.util.List; - -/** - * 定时任务 Mapper - * - * @author 芋道源码 - */ -@Mapper -public interface InfJobMapper extends BaseMapperX { - - default InfJobDO selectByHandlerName(String handlerName) { - return selectOne(InfJobDO::getHandlerName, handlerName); - } - - default PageResult selectPage(InfJobPageReqVO reqVO) { - return selectPage(reqVO, new LambdaQueryWrapperX() - .likeIfPresent(InfJobDO::getName, reqVO.getName()) - .eqIfPresent(InfJobDO::getStatus, reqVO.getStatus()) - .likeIfPresent(InfJobDO::getHandlerName, reqVO.getHandlerName()) - ); - } - - default List selectList(InfJobExportReqVO reqVO) { - return selectList(new LambdaQueryWrapperX() - .likeIfPresent(InfJobDO::getName, reqVO.getName()) - .eqIfPresent(InfJobDO::getStatus, reqVO.getStatus()) - .likeIfPresent(InfJobDO::getHandlerName, reqVO.getHandlerName()) - ); - } - -} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/job/InfJobLogMapper.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/job/JobLogMapper.java similarity index 73% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/job/InfJobLogMapper.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/job/JobLogMapper.java index 8d607c79f..fe196df35 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/job/InfJobLogMapper.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/job/JobLogMapper.java @@ -3,9 +3,9 @@ package cn.iocoder.yudao.module.infra.dal.mysql.job; 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 cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogExportReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogPageReqVO; -import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobLogDO; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO; +import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO; import org.apache.ibatis.annotations.Mapper; import java.util.List; @@ -16,10 +16,10 @@ import java.util.List; * @author 芋道源码 */ @Mapper -public interface InfJobLogMapper extends BaseMapperX { +public interface JobLogMapper extends BaseMapperX { - default PageResult selectPage(InfJobLogPageReqVO reqVO) { - return selectPage(reqVO, new QueryWrapperX() + default PageResult selectPage(JobLogPageReqVO reqVO) { + return selectPage(reqVO, new QueryWrapperX() .eqIfPresent("job_id", reqVO.getJobId()) .likeIfPresent("handler_name", reqVO.getHandlerName()) .geIfPresent("begin_time", reqVO.getBeginTime()) @@ -29,8 +29,8 @@ public interface InfJobLogMapper extends BaseMapperX { ); } - default List selectList(InfJobLogExportReqVO reqVO) { - return selectList(new QueryWrapperX() + default List selectList(JobLogExportReqVO reqVO) { + return selectList(new QueryWrapperX() .eqIfPresent("job_id", reqVO.getJobId()) .likeIfPresent("handler_name", reqVO.getHandlerName()) .geIfPresent("begin_time", reqVO.getBeginTime()) diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/job/JobMapper.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/job/JobMapper.java new file mode 100644 index 000000000..883906a01 --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/job/JobMapper.java @@ -0,0 +1,41 @@ +package cn.iocoder.yudao.module.infra.dal.mysql.job; + +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobExportReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobPageReqVO; +import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO; +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 org.apache.ibatis.annotations.Mapper; + +import java.util.List; + +/** + * 定时任务 Mapper + * + * @author 芋道源码 + */ +@Mapper +public interface JobMapper extends BaseMapperX { + + default JobDO selectByHandlerName(String handlerName) { + return selectOne(JobDO::getHandlerName, handlerName); + } + + default PageResult selectPage(JobPageReqVO reqVO) { + return selectPage(reqVO, new LambdaQueryWrapperX() + .likeIfPresent(JobDO::getName, reqVO.getName()) + .eqIfPresent(JobDO::getStatus, reqVO.getStatus()) + .likeIfPresent(JobDO::getHandlerName, reqVO.getHandlerName()) + ); + } + + default List selectList(JobExportReqVO reqVO) { + return selectList(new LambdaQueryWrapperX() + .likeIfPresent(JobDO::getName, reqVO.getName()) + .eqIfPresent(JobDO::getStatus, reqVO.getStatus()) + .likeIfPresent(JobDO::getHandlerName, reqVO.getHandlerName()) + ); + } + +} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/InfApiAccessLogMapper.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/ApiAccessLogMapper.java similarity index 74% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/InfApiAccessLogMapper.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/ApiAccessLogMapper.java index 60e080bea..8f00fbebc 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/InfApiAccessLogMapper.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/ApiAccessLogMapper.java @@ -1,11 +1,11 @@ package cn.iocoder.yudao.module.infra.dal.mysql.logger; -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogExportReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogPageReqVO; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO; 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 cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO; import org.apache.ibatis.annotations.Mapper; import java.util.List; @@ -16,10 +16,10 @@ import java.util.List; * @author 芋道源码 */ @Mapper -public interface InfApiAccessLogMapper extends BaseMapperX { +public interface ApiAccessLogMapper extends BaseMapperX { - default PageResult selectPage(InfApiAccessLogPageReqVO reqVO) { - return selectPage(reqVO, new QueryWrapperX() + default PageResult selectPage(ApiAccessLogPageReqVO reqVO) { + return selectPage(reqVO, new QueryWrapperX() .eqIfPresent("user_id", reqVO.getUserId()) .eqIfPresent("user_type", reqVO.getUserType()) .eqIfPresent("application_name", reqVO.getApplicationName()) @@ -31,8 +31,8 @@ public interface InfApiAccessLogMapper extends BaseMapperX { ); } - default List selectList(InfApiAccessLogExportReqVO reqVO) { - return selectList(new QueryWrapperX() + default List selectList(ApiAccessLogExportReqVO reqVO) { + return selectList(new QueryWrapperX() .eqIfPresent("user_id", reqVO.getUserId()) .eqIfPresent("user_type", reqVO.getUserType()) .eqIfPresent("application_name", reqVO.getApplicationName()) diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/InfApiErrorLogMapper.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/ApiErrorLogMapper.java similarity index 73% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/InfApiErrorLogMapper.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/ApiErrorLogMapper.java index a9f80b129..7e4ab62c3 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/InfApiErrorLogMapper.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/ApiErrorLogMapper.java @@ -1,11 +1,11 @@ package cn.iocoder.yudao.module.infra.dal.mysql.logger; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO; 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 cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogExportReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogPageReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO; +import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO; import org.apache.ibatis.annotations.Mapper; import java.util.List; @@ -16,10 +16,10 @@ import java.util.List; * @author 芋道源码 */ @Mapper -public interface InfApiErrorLogMapper extends BaseMapperX { +public interface ApiErrorLogMapper extends BaseMapperX { - default PageResult selectPage(InfApiErrorLogPageReqVO reqVO) { - return selectPage(reqVO, new QueryWrapperX() + default PageResult selectPage(ApiErrorLogPageReqVO reqVO) { + return selectPage(reqVO, new QueryWrapperX() .eqIfPresent("user_id", reqVO.getUserId()) .eqIfPresent("user_type", reqVO.getUserType()) .eqIfPresent("application_name", reqVO.getApplicationName()) @@ -30,8 +30,8 @@ public interface InfApiErrorLogMapper extends BaseMapperX { ); } - default List selectList(InfApiErrorLogExportReqVO reqVO) { - return selectList(new QueryWrapperX() + default List selectList(ApiErrorLogExportReqVO reqVO) { + return selectList(new QueryWrapperX() .eqIfPresent("user_id", reqVO.getUserId()) .eqIfPresent("user_type", reqVO.getUserType()) .eqIfPresent("application_name", reqVO.getApplicationName()) diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/InfApiAccessLogCoreMapper.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/InfApiAccessLogCoreMapper.java deleted file mode 100644 index 52945f26b..000000000 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/InfApiAccessLogCoreMapper.java +++ /dev/null @@ -1,14 +0,0 @@ -package cn.iocoder.yudao.module.infra.dal.mysql.logger; - -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; -import org.apache.ibatis.annotations.Mapper; - -/** - * API 访问日志 Mapper - * - * @author 芋道源码 - */ -@Mapper -public interface InfApiAccessLogCoreMapper extends BaseMapperX { -} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/InfApiErrorLogCoreMapper.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/InfApiErrorLogCoreMapper.java deleted file mode 100644 index f7124e9b8..000000000 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/dal/mysql/logger/InfApiErrorLogCoreMapper.java +++ /dev/null @@ -1,9 +0,0 @@ -package cn.iocoder.yudao.module.infra.dal.mysql.logger; - -import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO; -import org.apache.ibatis.annotations.Mapper; - -@Mapper -public interface InfApiErrorLogCoreMapper extends BaseMapperX { -} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/SysErrorCodeConstants.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/SysErrorCodeConstants.java deleted file mode 100644 index d9a41b38f..000000000 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/SysErrorCodeConstants.java +++ /dev/null @@ -1,16 +0,0 @@ -package cn.iocoder.yudao.module.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-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/config/InfConfigTypeEnum.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/config/ConfigTypeEnum.java similarity index 89% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/config/InfConfigTypeEnum.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/config/ConfigTypeEnum.java index 242fd7b1c..15c20152f 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/config/InfConfigTypeEnum.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/config/ConfigTypeEnum.java @@ -5,7 +5,7 @@ import lombok.Getter; @Getter @AllArgsConstructor -public enum InfConfigTypeEnum { +public enum ConfigTypeEnum { /** * 系统配置 diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/job/InfJobLogStatusEnum.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/job/JobLogStatusEnum.java similarity index 91% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/job/InfJobLogStatusEnum.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/job/JobLogStatusEnum.java index 8dee1d355..95670539e 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/job/InfJobLogStatusEnum.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/job/JobLogStatusEnum.java @@ -10,7 +10,7 @@ import lombok.Getter; */ @Getter @AllArgsConstructor -public enum InfJobLogStatusEnum { +public enum JobLogStatusEnum { RUNNING(0), // 运行中 SUCCESS(1), // 成功 diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/job/InfJobStatusEnum.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/job/JobStatusEnum.java similarity index 90% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/job/InfJobStatusEnum.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/job/JobStatusEnum.java index 870bde22a..3d9ec3f75 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/job/InfJobStatusEnum.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/job/JobStatusEnum.java @@ -3,12 +3,11 @@ package cn.iocoder.yudao.module.infra.enums.job; import com.google.common.collect.Sets; import lombok.AllArgsConstructor; import lombok.Getter; +import org.quartz.impl.jdbcjobstore.Constants; import java.util.Collections; import java.util.Set; -import static org.quartz.impl.jdbcjobstore.Constants.*; - /** * 任务状态的枚举 * @@ -16,7 +15,7 @@ import static org.quartz.impl.jdbcjobstore.Constants.*; */ @Getter @AllArgsConstructor -public enum InfJobStatusEnum { +public enum JobStatusEnum { /** * 初始化中 diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/logger/InfApiErrorLogProcessStatusEnum.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/logger/ApiErrorLogProcessStatusEnum.java similarity index 90% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/logger/InfApiErrorLogProcessStatusEnum.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/logger/ApiErrorLogProcessStatusEnum.java index b047ae105..b3097534c 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/logger/InfApiErrorLogProcessStatusEnum.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/enums/logger/ApiErrorLogProcessStatusEnum.java @@ -10,7 +10,7 @@ import lombok.Getter; */ @AllArgsConstructor @Getter -public enum InfApiErrorLogProcessStatusEnum { +public enum ApiErrorLogProcessStatusEnum { INIT(0, "未处理"), DONE(1, "已处理"), diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/file/config/FileConfiguration.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/framework/file/config/FileConfiguration.java similarity index 81% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/file/config/FileConfiguration.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/framework/file/config/FileConfiguration.java index f2bc7c2eb..f944daa23 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/file/config/FileConfiguration.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/framework/file/config/FileConfiguration.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.infra.file.config; +package cn.iocoder.yudao.module.infra.framework.file.config; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Configuration; diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/file/config/FileProperties.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/framework/file/config/FileProperties.java similarity index 88% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/file/config/FileProperties.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/framework/file/config/FileProperties.java index 10640751a..7d76a3baf 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/file/config/FileProperties.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/framework/file/config/FileProperties.java @@ -1,4 +1,4 @@ -package cn.iocoder.yudao.module.infra.file.config; +package cn.iocoder.yudao.module.infra.framework.file.config; import lombok.Data; import org.springframework.boot.context.properties.ConfigurationProperties; diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/file/package-info.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/framework/file/package-info.java similarity index 92% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/file/package-info.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/framework/file/package-info.java index 2c2798ee6..ee21b922e 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/file/package-info.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/framework/file/package-info.java @@ -13,4 +13,4 @@ * 综合考虑,暂时使用方案 3 的方式,比较适合这样一个 all in one 的项目。 * 随着文件的量级大了之后,还是推荐采用云服务。 */ -package cn.iocoder.yudao.coreservice.modules.infra.framework.file; +package cn.iocoder.yudao.module.infra.framework.file; diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/mq/consumer/config/InfConfigRefreshConsumer.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/mq/consumer/config/ConfigRefreshConsumer.java similarity index 61% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/mq/consumer/config/InfConfigRefreshConsumer.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/mq/consumer/config/ConfigRefreshConsumer.java index f68cdb4d7..d13003afb 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/mq/consumer/config/InfConfigRefreshConsumer.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/mq/consumer/config/ConfigRefreshConsumer.java @@ -2,21 +2,21 @@ package cn.iocoder.yudao.module.infra.mq.consumer.config; import cn.iocoder.yudao.framework.apollo.internals.DBConfigRepository; import cn.iocoder.yudao.framework.mq.core.pubsub.AbstractChannelMessageListener; -import cn.iocoder.yudao.module.infra.mq.message.config.InfConfigRefreshMessage; +import cn.iocoder.yudao.module.infra.mq.message.config.ConfigRefreshMessage; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Component; /** - * 针对 {@link InfConfigRefreshMessage} 的消费者 + * 针对 {@link ConfigRefreshMessage} 的消费者 * * @author 芋道源码 */ @Component @Slf4j -public class InfConfigRefreshConsumer extends AbstractChannelMessageListener { +public class ConfigRefreshConsumer extends AbstractChannelMessageListener { @Override - public void onMessage(InfConfigRefreshMessage message) { + public void onMessage(ConfigRefreshMessage message) { log.info("[onMessage][收到 Config 刷新消息]"); DBConfigRepository.noticeSync(); } diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/mq/message/config/InfConfigRefreshMessage.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/mq/message/config/ConfigRefreshMessage.java similarity index 80% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/mq/message/config/InfConfigRefreshMessage.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/mq/message/config/ConfigRefreshMessage.java index 36b51db1a..380a1736b 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/mq/message/config/InfConfigRefreshMessage.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/mq/message/config/ConfigRefreshMessage.java @@ -7,7 +7,7 @@ import lombok.Data; * 配置数据刷新 Message */ @Data -public class InfConfigRefreshMessage extends AbstractChannelMessage { +public class ConfigRefreshMessage extends AbstractChannelMessage { @Override public String getChannel() { diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/mq/producer/config/InfConfigProducer.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/mq/producer/config/ConfigProducer.java similarity index 64% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/mq/producer/config/InfConfigProducer.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/mq/producer/config/ConfigProducer.java index e77557111..92d0e34b6 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/mq/producer/config/InfConfigProducer.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/mq/producer/config/ConfigProducer.java @@ -1,6 +1,6 @@ package cn.iocoder.yudao.module.infra.mq.producer.config; -import cn.iocoder.yudao.module.infra.mq.message.config.InfConfigRefreshMessage; +import cn.iocoder.yudao.module.infra.mq.message.config.ConfigRefreshMessage; import cn.iocoder.yudao.framework.mq.core.RedisMQTemplate; import org.springframework.stereotype.Component; @@ -10,16 +10,16 @@ import javax.annotation.Resource; * Config 配置相关消息的 Producer */ @Component -public class InfConfigProducer { +public class ConfigProducer { @Resource private RedisMQTemplate redisMQTemplate; /** - * 发送 {@link InfConfigRefreshMessage} 消息 + * 发送 {@link ConfigRefreshMessage} 消息 */ public void sendConfigRefreshMessage() { - InfConfigRefreshMessage message = new InfConfigRefreshMessage(); + ConfigRefreshMessage message = new ConfigRefreshMessage(); redisMQTemplate.send(message); } diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/config/InfConfigService.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/config/ConfigService.java similarity index 80% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/config/InfConfigService.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/config/ConfigService.java index 8d3995e1c..abd82e54a 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/config/InfConfigService.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/config/ConfigService.java @@ -1,11 +1,11 @@ package cn.iocoder.yudao.module.infra.service.config; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.config.InfConfigDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigCreateReqVO; import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigExportReqVO; import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO; import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigUpdateReqVO; +import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO; import javax.validation.Valid; import java.util.List; @@ -15,7 +15,7 @@ import java.util.List; * * @author 芋道源码 */ -public interface InfConfigService { +public interface ConfigService { /** * 创建参数配置 @@ -45,7 +45,7 @@ public interface InfConfigService { * @param id 配置编号 * @return 参数配置 */ - InfConfigDO getConfig(Long id); + ConfigDO getConfig(Long id); /** * 根据参数键,获得参数配置 @@ -53,7 +53,7 @@ public interface InfConfigService { * @param key 配置键 * @return 参数配置 */ - InfConfigDO getConfigByKey(String key); + ConfigDO getConfigByKey(String key); /** * 获得参数配置分页列表 @@ -61,7 +61,7 @@ public interface InfConfigService { * @param reqVO 分页条件 * @return 分页列表 */ - PageResult getConfigPage(@Valid ConfigPageReqVO reqVO); + PageResult getConfigPage(@Valid ConfigPageReqVO reqVO); /** * 获得参数配置列表 @@ -69,7 +69,7 @@ public interface InfConfigService { * @param reqVO 列表 * @return 列表 */ - List getConfigList(@Valid ConfigExportReqVO reqVO); + List getConfigList(@Valid ConfigExportReqVO reqVO); } diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/config/impl/InfConfigServiceImpl.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/config/ConfigServiceImpl.java similarity index 59% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/config/impl/InfConfigServiceImpl.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/config/ConfigServiceImpl.java index 191135760..f6eb43cd5 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/config/impl/InfConfigServiceImpl.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/config/ConfigServiceImpl.java @@ -1,25 +1,23 @@ -package cn.iocoder.yudao.module.infra.service.config.impl; +package cn.iocoder.yudao.module.infra.service.config; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.config.InfConfigDO; import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigCreateReqVO; import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigExportReqVO; import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO; import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigUpdateReqVO; -import cn.iocoder.yudao.module.infra.convert.config.InfConfigConvert; -import cn.iocoder.yudao.module.infra.dal.mysql.config.InfConfigMapper; -import cn.iocoder.yudao.module.infra.enums.config.InfConfigTypeEnum; -import cn.iocoder.yudao.module.infra.mq.producer.config.InfConfigProducer; -import cn.iocoder.yudao.module.infra.service.config.InfConfigService; -import cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants; +import cn.iocoder.yudao.module.infra.convert.config.ConfigConvert; +import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO; +import cn.iocoder.yudao.module.infra.dal.mysql.config.ConfigMapper; +import cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants; +import cn.iocoder.yudao.module.infra.enums.config.ConfigTypeEnum; +import cn.iocoder.yudao.module.infra.mq.producer.config.ConfigProducer; import com.google.common.annotations.VisibleForTesting; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; - import java.util.List; /** @@ -28,21 +26,21 @@ import java.util.List; @Service @Slf4j @Validated -public class InfConfigServiceImpl implements InfConfigService { +public class ConfigServiceImpl implements ConfigService { @Resource - private InfConfigMapper configMapper; + private ConfigMapper configMapper; @Resource - private InfConfigProducer configProducer; + private ConfigProducer configProducer; @Override public Long createConfig(ConfigCreateReqVO reqVO) { // 校验正确性 checkCreateOrUpdate(null, reqVO.getKey()); // 插入参数配置 - InfConfigDO config = InfConfigConvert.INSTANCE.convert(reqVO); - config.setType(InfConfigTypeEnum.CUSTOM.getType()); + ConfigDO config = ConfigConvert.INSTANCE.convert(reqVO); + config.setType(ConfigTypeEnum.CUSTOM.getType()); configMapper.insert(config); // 发送刷新消息 configProducer.sendConfigRefreshMessage(); @@ -54,7 +52,7 @@ public class InfConfigServiceImpl implements InfConfigService { // 校验正确性 checkCreateOrUpdate(reqVO.getId(), null); // 不允许更新 key // 更新参数配置 - InfConfigDO updateObj = InfConfigConvert.INSTANCE.convert(reqVO); + ConfigDO updateObj = ConfigConvert.INSTANCE.convert(reqVO); configMapper.updateById(updateObj); // 发送刷新消息 configProducer.sendConfigRefreshMessage(); @@ -63,10 +61,10 @@ public class InfConfigServiceImpl implements InfConfigService { @Override public void deleteConfig(Long id) { // 校验配置存在 - InfConfigDO config = checkConfigExists(id); + ConfigDO config = checkConfigExists(id); // 内置配置,不允许删除 - if (InfConfigTypeEnum.SYSTEM.getType().equals(config.getType())) { - throw ServiceExceptionUtil.exception(InfErrorCodeConstants.CONFIG_CAN_NOT_DELETE_SYSTEM_TYPE); + if (ConfigTypeEnum.SYSTEM.getType().equals(config.getType())) { + throw ServiceExceptionUtil.exception(ErrorCodeConstants.CONFIG_CAN_NOT_DELETE_SYSTEM_TYPE); } // 删除 configMapper.deleteById(id); @@ -75,22 +73,22 @@ public class InfConfigServiceImpl implements InfConfigService { } @Override - public InfConfigDO getConfig(Long id) { + public ConfigDO getConfig(Long id) { return configMapper.selectById(id); } @Override - public InfConfigDO getConfigByKey(String key) { + public ConfigDO getConfigByKey(String key) { return configMapper.selectByKey(key); } @Override - public PageResult getConfigPage(ConfigPageReqVO reqVO) { + public PageResult getConfigPage(ConfigPageReqVO reqVO) { return configMapper.selectPage(reqVO); } @Override - public List getConfigList(ConfigExportReqVO reqVO) { + public List getConfigList(ConfigExportReqVO reqVO) { return configMapper.selectList(reqVO); } @@ -102,29 +100,29 @@ public class InfConfigServiceImpl implements InfConfigService { } @VisibleForTesting - public InfConfigDO checkConfigExists(Long id) { + public ConfigDO checkConfigExists(Long id) { if (id == null) { return null; } - InfConfigDO config = configMapper.selectById(id); + ConfigDO config = configMapper.selectById(id); if (config == null) { - throw ServiceExceptionUtil.exception(InfErrorCodeConstants.CONFIG_NOT_EXISTS); + throw ServiceExceptionUtil.exception(ErrorCodeConstants.CONFIG_NOT_EXISTS); } return config; } @VisibleForTesting public void checkConfigKeyUnique(Long id, String key) { - InfConfigDO config = configMapper.selectByKey(key); + ConfigDO config = configMapper.selectByKey(key); if (config == null) { return; } // 如果 id 为空,说明不用比较是否为相同 id 的参数配置 if (id == null) { - throw ServiceExceptionUtil.exception(InfErrorCodeConstants.CONFIG_KEY_DUPLICATE); + throw ServiceExceptionUtil.exception(ErrorCodeConstants.CONFIG_KEY_DUPLICATE); } if (!config.getId().equals(id)) { - throw ServiceExceptionUtil.exception(InfErrorCodeConstants.CONFIG_KEY_DUPLICATE); + throw ServiceExceptionUtil.exception(ErrorCodeConstants.CONFIG_KEY_DUPLICATE); } } diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileService.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileService.java new file mode 100644 index 000000000..4fb658aa5 --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileService.java @@ -0,0 +1,46 @@ +package cn.iocoder.yudao.module.infra.service.file; + +import cn.iocoder.yudao.module.infra.controller.admin.file.vo.FilePageReqVO; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO; + +/** + * 文件 Service 接口 + * + * @author 芋道源码 + */ +public interface FileService { + + /** + * 获得文件分页 + * + * @param pageReqVO 分页查询 + * @return 文件分页 + */ + PageResult getFilePage(FilePageReqVO pageReqVO); + + /** + * 保存文件,并返回文件的访问路径 + * + * @param path 文件路径 + * @param content 文件内容 + * @return 文件路径 + */ + String createFile(String path, byte[] content); + + /** + * 删除文件 + * + * @param id 编号 + */ + void deleteFile(String id); + + /** + * 获得文件 + * + * @param path 文件路径 + * @return 文件 + */ + FileDO getFile(String path); + +} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/impl/InfFileCoreServiceImpl.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileServiceImpl.java similarity index 59% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/impl/InfFileCoreServiceImpl.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileServiceImpl.java index 251563fd4..1f1724ecd 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/impl/InfFileCoreServiceImpl.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/FileServiceImpl.java @@ -1,39 +1,45 @@ -package cn.iocoder.yudao.module.infra.service.file.impl; +package cn.iocoder.yudao.module.infra.service.file; import cn.hutool.core.io.FileTypeUtil; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO; -import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.file.InfFileCoreMapper; -import cn.iocoder.yudao.coreservice.modules.infra.framework.file.config.FileProperties; -import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.infra.controller.admin.file.vo.FilePageReqVO; +import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO; +import cn.iocoder.yudao.module.infra.dal.mysql.file.FileMapper; +import cn.iocoder.yudao.module.infra.framework.file.config.FileProperties; import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.io.ByteArrayInputStream; -import static cn.iocoder.yudao.coreservice.modules.infra.enums.SysErrorCodeConstants.*; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; +import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*; /** - * core service 文件实现类 + * 文件 Service 实现类 * - * @author 宋天 + * @author 芋道源码 */ @Service -public class InfFileCoreServiceImpl implements InfFileCoreService { +public class FileServiceImpl implements FileService { @Resource - private InfFileCoreMapper fileMapper; + private FileMapper fileMapper; @Resource private FileProperties fileProperties; + @Override + public PageResult getFilePage(FilePageReqVO pageReqVO) { + return fileMapper.selectPage(pageReqVO); + } + @Override public String createFile(String path, byte[] content) { if (fileMapper.selectCountById(path) > 0) { throw exception(FILE_PATH_EXISTS); } // 保存到数据库 - InfFileDO file = new InfFileDO(); + FileDO file = new FileDO(); file.setId(path); file.setType(FileTypeUtil.getType(new ByteArrayInputStream(content))); file.setContent(content); @@ -57,7 +63,7 @@ public class InfFileCoreServiceImpl implements InfFileCoreService { } @Override - public InfFileDO getFile(String path) { + public FileDO getFile(String path) { return fileMapper.selectByPath(path); } diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/InfFileCoreService.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/InfFileCoreService.java deleted file mode 100644 index 95f2998c1..000000000 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/InfFileCoreService.java +++ /dev/null @@ -1,35 +0,0 @@ -package cn.iocoder.yudao.module.infra.service.file; - -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO; - -/** - * core service 文件接口 - * - * @author 宋天 - */ -public interface InfFileCoreService { - - /** - * 保存文件,并返回文件的访问路径 - * - * @param path 文件路径 - * @param content 文件内容 - * @return 文件路径 - */ - String createFile(String path, byte[] content); - - /** - * 删除文件 - * - * @param id 编号 - */ - void deleteFile(String id); - - /** - * 获得文件 - * - * @param path 文件路径 - * @return 文件 - */ - InfFileDO getFile(String path); -} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/InfFileService.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/InfFileService.java deleted file mode 100644 index f37a422ce..000000000 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/InfFileService.java +++ /dev/null @@ -1,22 +0,0 @@ -package cn.iocoder.yudao.module.infra.service.file; - -import cn.iocoder.yudao.module.infra.controller.admin.file.vo.InfFilePageReqVO; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; - -/** - * 文件 Service 接口 - * - * @author 芋道源码 - */ -public interface InfFileService { - - /** - * 获得文件分页 - * - * @param pageReqVO 分页查询 - * @return 文件分页 - */ - PageResult getFilePage(InfFilePageReqVO pageReqVO); - -} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/impl/InfFileServiceImpl.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/impl/InfFileServiceImpl.java deleted file mode 100644 index acd6dfb88..000000000 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/file/impl/InfFileServiceImpl.java +++ /dev/null @@ -1,29 +0,0 @@ -package cn.iocoder.yudao.module.infra.service.file.impl; - -import cn.iocoder.yudao.module.infra.dal.mysql.file.InfFileMapper; -import cn.iocoder.yudao.module.infra.service.file.InfFileService; -import cn.iocoder.yudao.module.infra.controller.admin.file.vo.InfFilePageReqVO; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO; -import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService; -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import org.springframework.stereotype.Service; - -import javax.annotation.Resource; - -/** - * 文件 Service 实现类 - * - * @author 芋道源码 - */ -@Service -public class InfFileServiceImpl implements InfFileService { - - @Resource - private InfFileMapper fileMapper; - - @Override - public PageResult getFilePage(InfFilePageReqVO pageReqVO) { - return fileMapper.selectPage(pageReqVO); - } - -} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/InfJobLogService.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobLogService.java similarity index 68% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/InfJobLogService.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobLogService.java index b75897d10..e2e9e73e4 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/InfJobLogService.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobLogService.java @@ -2,9 +2,9 @@ package cn.iocoder.yudao.module.infra.service.job; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.quartz.core.service.JobLogFrameworkService; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogExportReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogPageReqVO; -import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobLogDO; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO; +import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO; import java.util.Collection; import java.util.List; @@ -14,7 +14,7 @@ import java.util.List; * * @author 芋道源码 */ -public interface InfJobLogService extends JobLogFrameworkService { +public interface JobLogService extends JobLogFrameworkService { /** * 获得定时任务 @@ -22,7 +22,7 @@ public interface InfJobLogService extends JobLogFrameworkService { * @param id 编号 * @return 定时任务 */ - InfJobLogDO getJobLog(Long id); + JobLogDO getJobLog(Long id); /** * 获得定时任务列表 @@ -30,7 +30,7 @@ public interface InfJobLogService extends JobLogFrameworkService { * @param ids 编号 * @return 定时任务列表 */ - List getJobLogList(Collection ids); + List getJobLogList(Collection ids); /** * 获得定时任务分页 @@ -38,7 +38,7 @@ public interface InfJobLogService extends JobLogFrameworkService { * @param pageReqVO 分页查询 * @return 定时任务分页 */ - PageResult getJobLogPage(InfJobLogPageReqVO pageReqVO); + PageResult getJobLogPage(JobLogPageReqVO pageReqVO); /** * 获得定时任务列表, 用于 Excel 导出 @@ -46,6 +46,6 @@ public interface InfJobLogService extends JobLogFrameworkService { * @param exportReqVO 查询条件 * @return 定时任务分页 */ - List getJobLogList(InfJobLogExportReqVO exportReqVO); + List getJobLogList(JobLogExportReqVO exportReqVO); } diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/impl/InfJobLogServiceImpl.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobLogServiceImpl.java similarity index 55% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/impl/InfJobLogServiceImpl.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobLogServiceImpl.java index cbc6a38a3..8b3c2ef88 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/impl/InfJobLogServiceImpl.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobLogServiceImpl.java @@ -1,12 +1,11 @@ -package cn.iocoder.yudao.module.infra.service.job.impl; +package cn.iocoder.yudao.module.infra.service.job; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogExportReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogPageReqVO; -import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobLogDO; -import cn.iocoder.yudao.module.infra.dal.mysql.job.InfJobLogMapper; -import cn.iocoder.yudao.module.infra.enums.job.InfJobLogStatusEnum; -import cn.iocoder.yudao.module.infra.service.job.InfJobLogService; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO; +import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO; +import cn.iocoder.yudao.module.infra.dal.mysql.job.JobLogMapper; +import cn.iocoder.yudao.module.infra.enums.job.JobLogStatusEnum; import lombok.extern.slf4j.Slf4j; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; @@ -25,15 +24,15 @@ import java.util.List; @Service @Validated @Slf4j -public class InfJobLogServiceImpl implements InfJobLogService { +public class JobLogServiceImpl implements JobLogService { @Resource - private InfJobLogMapper jobLogMapper; + private JobLogMapper jobLogMapper; @Override public Long createJobLog(Long jobId, Date beginTime, String jobHandlerName, String jobHandlerParam, Integer executeIndex) { - InfJobLogDO log = InfJobLogDO.builder().jobId(jobId).handlerName(jobHandlerName).handlerParam(jobHandlerParam).executeIndex(executeIndex) - .beginTime(beginTime).status(InfJobLogStatusEnum.RUNNING.getStatus()).build(); + JobLogDO log = JobLogDO.builder().jobId(jobId).handlerName(jobHandlerName).handlerParam(jobHandlerParam).executeIndex(executeIndex) + .beginTime(beginTime).status(JobLogStatusEnum.RUNNING.getStatus()).build(); jobLogMapper.insert(log); return log.getId(); } @@ -42,8 +41,8 @@ public class InfJobLogServiceImpl implements InfJobLogService { @Async public void updateJobLogResultAsync(Long logId, Date endTime, Integer duration, boolean success, String result) { try { - InfJobLogDO updateObj = InfJobLogDO.builder().id(logId).endTime(endTime).duration(duration) - .status(success ? InfJobLogStatusEnum.SUCCESS.getStatus() : InfJobLogStatusEnum.FAILURE.getStatus()).result(result).build(); + JobLogDO updateObj = JobLogDO.builder().id(logId).endTime(endTime).duration(duration) + .status(success ? JobLogStatusEnum.SUCCESS.getStatus() : JobLogStatusEnum.FAILURE.getStatus()).result(result).build(); jobLogMapper.updateById(updateObj); } catch (Exception ex) { log.error("[updateJobLogResultAsync][logId({}) endTime({}) duration({}) success({}) result({})]", @@ -52,22 +51,22 @@ public class InfJobLogServiceImpl implements InfJobLogService { } @Override - public InfJobLogDO getJobLog(Long id) { + public JobLogDO getJobLog(Long id) { return jobLogMapper.selectById(id); } @Override - public List getJobLogList(Collection ids) { + public List getJobLogList(Collection ids) { return jobLogMapper.selectBatchIds(ids); } @Override - public PageResult getJobLogPage(InfJobLogPageReqVO pageReqVO) { + public PageResult getJobLogPage(JobLogPageReqVO pageReqVO) { return jobLogMapper.selectPage(pageReqVO); } @Override - public List getJobLogList(InfJobLogExportReqVO exportReqVO) { + public List getJobLogList(JobLogExportReqVO exportReqVO) { return jobLogMapper.selectList(exportReqVO); } diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/InfJobService.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobService.java similarity index 75% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/InfJobService.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobService.java index bfacab3be..bd5dd646d 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/InfJobService.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobService.java @@ -1,11 +1,11 @@ package cn.iocoder.yudao.module.infra.service.job; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobCreateReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobExportReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobPageReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobUpdateReqVO; -import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobDO; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobCreateReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobExportReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobPageReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobUpdateReqVO; +import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO; import org.quartz.SchedulerException; import javax.validation.Valid; @@ -17,7 +17,7 @@ import java.util.List; * * @author 芋道源码 */ -public interface InfJobService { +public interface JobService { /** * 创建定时任务 @@ -25,14 +25,14 @@ public interface InfJobService { * @param createReqVO 创建信息 * @return 编号 */ - Long createJob(@Valid InfJobCreateReqVO createReqVO) throws SchedulerException; + Long createJob(@Valid JobCreateReqVO createReqVO) throws SchedulerException; /** * 更新定时任务 * * @param updateReqVO 更新信息 */ - void updateJob(@Valid InfJobUpdateReqVO updateReqVO) throws SchedulerException; + void updateJob(@Valid JobUpdateReqVO updateReqVO) throws SchedulerException; /** * 更新定时任务的状态 @@ -62,7 +62,7 @@ public interface InfJobService { * @param id 编号 * @return 定时任务 */ - InfJobDO getJob(Long id); + JobDO getJob(Long id); /** * 获得定时任务列表 @@ -70,7 +70,7 @@ public interface InfJobService { * @param ids 编号 * @return 定时任务列表 */ - List getJobList(Collection ids); + List getJobList(Collection ids); /** * 获得定时任务分页 @@ -78,7 +78,7 @@ public interface InfJobService { * @param pageReqVO 分页查询 * @return 定时任务分页 */ - PageResult getJobPage(InfJobPageReqVO pageReqVO); + PageResult getJobPage(JobPageReqVO pageReqVO); /** * 获得定时任务列表, 用于 Excel 导出 @@ -86,6 +86,6 @@ public interface InfJobService { * @param exportReqVO 查询条件 * @return 定时任务分页 */ - List getJobList(InfJobExportReqVO exportReqVO); + List getJobList(JobExportReqVO exportReqVO); } diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/impl/InfJobServiceImpl.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobServiceImpl.java similarity index 68% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/impl/InfJobServiceImpl.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobServiceImpl.java index 39e77f1ea..e0a245750 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/impl/InfJobServiceImpl.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/job/JobServiceImpl.java @@ -1,17 +1,16 @@ -package cn.iocoder.yudao.module.infra.service.job.impl; +package cn.iocoder.yudao.module.infra.service.job; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.quartz.core.scheduler.SchedulerManager; import cn.iocoder.yudao.framework.quartz.core.util.CronUtils; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobCreateReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobExportReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobPageReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobUpdateReqVO; -import cn.iocoder.yudao.module.infra.convert.job.InfJobConvert; -import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobDO; -import cn.iocoder.yudao.module.infra.dal.mysql.job.InfJobMapper; -import cn.iocoder.yudao.module.infra.enums.job.InfJobStatusEnum; -import cn.iocoder.yudao.module.infra.service.job.InfJobService; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobCreateReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobExportReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobPageReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobUpdateReqVO; +import cn.iocoder.yudao.module.infra.convert.job.JobConvert; +import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO; +import cn.iocoder.yudao.module.infra.dal.mysql.job.JobMapper; +import cn.iocoder.yudao.module.infra.enums.job.JobStatusEnum; import org.quartz.SchedulerException; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -22,7 +21,7 @@ import java.util.Collection; import java.util.List; import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; -import static cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants.*; +import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*; import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.containsAny; /** @@ -32,25 +31,25 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils. */ @Service @Validated -public class InfJobServiceImpl implements InfJobService { +public class JobServiceImpl implements JobService { @Resource - private InfJobMapper jobMapper; + private JobMapper jobMapper; @Resource private SchedulerManager schedulerManager; @Override @Transactional(rollbackFor = Exception.class) - public Long createJob(InfJobCreateReqVO createReqVO) throws SchedulerException { + public Long createJob(JobCreateReqVO createReqVO) throws SchedulerException { validateCronExpression(createReqVO.getCronExpression()); // 校验唯一性 if (jobMapper.selectByHandlerName(createReqVO.getHandlerName()) != null) { throw exception(JOB_HANDLER_EXISTS); } // 插入 - InfJobDO job = InfJobConvert.INSTANCE.convert(createReqVO); - job.setStatus(InfJobStatusEnum.INIT.getStatus()); + JobDO job = JobConvert.INSTANCE.convert(createReqVO); + job.setStatus(JobStatusEnum.INIT.getStatus()); fillJobMonitorTimeoutEmpty(job); jobMapper.insert(job); @@ -58,7 +57,7 @@ public class InfJobServiceImpl implements InfJobService { schedulerManager.addJob(job.getId(), job.getHandlerName(), job.getHandlerParam(), job.getCronExpression(), createReqVO.getRetryCount(), createReqVO.getRetryInterval()); // 更新 - InfJobDO updateObj = InfJobDO.builder().id(job.getId()).status(InfJobStatusEnum.NORMAL.getStatus()).build(); + JobDO updateObj = JobDO.builder().id(job.getId()).status(JobStatusEnum.NORMAL.getStatus()).build(); jobMapper.updateById(updateObj); // 返回 @@ -67,16 +66,16 @@ public class InfJobServiceImpl implements InfJobService { @Override @Transactional(rollbackFor = Exception.class) - public void updateJob(InfJobUpdateReqVO updateReqVO) throws SchedulerException { + public void updateJob(JobUpdateReqVO updateReqVO) throws SchedulerException { validateCronExpression(updateReqVO.getCronExpression()); // 校验存在 - InfJobDO job = this.validateJobExists(updateReqVO.getId()); + JobDO job = this.validateJobExists(updateReqVO.getId()); // 只有开启状态,才可以修改.原因是,如果出暂停状态,修改 Quartz Job 时,会导致任务又开始执行 - if (!job.getStatus().equals(InfJobStatusEnum.NORMAL.getStatus())) { + if (!job.getStatus().equals(JobStatusEnum.NORMAL.getStatus())) { throw exception(JOB_UPDATE_ONLY_NORMAL_STATUS); } // 更新 - InfJobDO updateObj = InfJobConvert.INSTANCE.convert(updateReqVO); + JobDO updateObj = JobConvert.INSTANCE.convert(updateReqVO); fillJobMonitorTimeoutEmpty(updateObj); jobMapper.updateById(updateObj); @@ -89,21 +88,21 @@ public class InfJobServiceImpl implements InfJobService { @Transactional(rollbackFor = Exception.class) public void updateJobStatus(Long id, Integer status) throws SchedulerException { // 校验 status - if (!containsAny(status, InfJobStatusEnum.NORMAL.getStatus(), InfJobStatusEnum.STOP.getStatus())) { + if (!containsAny(status, JobStatusEnum.NORMAL.getStatus(), JobStatusEnum.STOP.getStatus())) { throw exception(JOB_CHANGE_STATUS_INVALID); } // 校验存在 - InfJobDO job = this.validateJobExists(id); + JobDO job = this.validateJobExists(id); // 校验是否已经为当前状态 if (job.getStatus().equals(status)) { throw exception(JOB_CHANGE_STATUS_EQUALS); } // 更新 Job 状态 - InfJobDO updateObj = InfJobDO.builder().id(id).status(status).build(); + JobDO updateObj = JobDO.builder().id(id).status(status).build(); jobMapper.updateById(updateObj); // 更新状态 Job 到 Quartz 中 - if (InfJobStatusEnum.NORMAL.getStatus().equals(status)) { // 开启 + if (JobStatusEnum.NORMAL.getStatus().equals(status)) { // 开启 schedulerManager.resumeJob(job.getHandlerName()); } else { // 暂停 schedulerManager.pauseJob(job.getHandlerName()); @@ -113,7 +112,7 @@ public class InfJobServiceImpl implements InfJobService { @Override public void triggerJob(Long id) throws SchedulerException { // 校验存在 - InfJobDO job = this.validateJobExists(id); + JobDO job = this.validateJobExists(id); // 触发 Quartz 中的 Job schedulerManager.triggerJob(job.getId(), job.getHandlerName(), job.getHandlerParam()); @@ -123,7 +122,7 @@ public class InfJobServiceImpl implements InfJobService { @Transactional(rollbackFor = Exception.class) public void deleteJob(Long id) throws SchedulerException { // 校验存在 - InfJobDO job = this.validateJobExists(id); + JobDO job = this.validateJobExists(id); // 更新 jobMapper.deleteById(id); @@ -131,8 +130,8 @@ public class InfJobServiceImpl implements InfJobService { schedulerManager.deleteJob(job.getHandlerName()); } - private InfJobDO validateJobExists(Long id) { - InfJobDO job = jobMapper.selectById(id); + private JobDO validateJobExists(Long id) { + JobDO job = jobMapper.selectById(id); if (job == null) { throw exception(JOB_NOT_EXISTS); } @@ -146,26 +145,26 @@ public class InfJobServiceImpl implements InfJobService { } @Override - public InfJobDO getJob(Long id) { + public JobDO getJob(Long id) { return jobMapper.selectById(id); } @Override - public List getJobList(Collection ids) { + public List getJobList(Collection ids) { return jobMapper.selectBatchIds(ids); } @Override - public PageResult getJobPage(InfJobPageReqVO pageReqVO) { + public PageResult getJobPage(JobPageReqVO pageReqVO) { return jobMapper.selectPage(pageReqVO); } @Override - public List getJobList(InfJobExportReqVO exportReqVO) { + public List getJobList(JobExportReqVO exportReqVO) { return jobMapper.selectList(exportReqVO); } - private static void fillJobMonitorTimeoutEmpty(InfJobDO job) { + private static void fillJobMonitorTimeoutEmpty(JobDO job) { if (job.getMonitorTimeout() == null) { job.setMonitorTimeout(0); } diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/InfApiAccessLogService.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogService.java similarity index 57% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/InfApiAccessLogService.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogService.java index 91229efea..22aea79b4 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/InfApiAccessLogService.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogService.java @@ -1,9 +1,10 @@ package cn.iocoder.yudao.module.infra.service.logger; -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogExportReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogPageReqVO; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; +import cn.iocoder.yudao.framework.apilog.core.service.ApiAccessLogFrameworkService; +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO; import java.util.List; @@ -12,7 +13,7 @@ import java.util.List; * * @author 芋道源码 */ -public interface InfApiAccessLogService { +public interface ApiAccessLogService extends ApiAccessLogFrameworkService { /** * 获得 API 访问日志分页 @@ -20,7 +21,7 @@ public interface InfApiAccessLogService { * @param pageReqVO 分页查询 * @return API 访问日志分页 */ - PageResult getApiAccessLogPage(InfApiAccessLogPageReqVO pageReqVO); + PageResult getApiAccessLogPage(ApiAccessLogPageReqVO pageReqVO); /** * 获得 API 访问日志列表, 用于 Excel 导出 @@ -28,6 +29,6 @@ public interface InfApiAccessLogService { * @param exportReqVO 查询条件 * @return API 访问日志分页 */ - List getApiAccessLogList(InfApiAccessLogExportReqVO exportReqVO); + List getApiAccessLogList(ApiAccessLogExportReqVO exportReqVO); } diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogServiceImpl.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogServiceImpl.java new file mode 100644 index 000000000..64df85ac0 --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogServiceImpl.java @@ -0,0 +1,46 @@ +package cn.iocoder.yudao.module.infra.service.logger; + +import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateReqDTO; +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO; +import cn.iocoder.yudao.module.infra.convert.logger.ApiAccessLogConvert; +import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO; +import cn.iocoder.yudao.module.infra.dal.mysql.logger.ApiAccessLogMapper; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.List; + +/** + * API 访问日志 Service 实现类 + * + * @author 芋道源码 + */ +@Service +@Validated +public class ApiAccessLogServiceImpl implements ApiAccessLogService { + + @Resource + private ApiAccessLogMapper apiAccessLogMapper; + + @Override + public PageResult getApiAccessLogPage(ApiAccessLogPageReqVO pageReqVO) { + return apiAccessLogMapper.selectPage(pageReqVO); + } + + @Override + public List getApiAccessLogList(ApiAccessLogExportReqVO exportReqVO) { + return apiAccessLogMapper.selectList(exportReqVO); + } + + @Override + @Async + public void createApiAccessLogAsync(ApiAccessLogCreateReqDTO createDTO) { + ApiAccessLogDO apiAccessLog = ApiAccessLogConvert.INSTANCE.convert(createDTO); + apiAccessLogMapper.insert(apiAccessLog); + } + +} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/InfApiErrorLogService.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogService.java similarity index 65% rename from yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/InfApiErrorLogService.java rename to yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogService.java index 2920f3fc7..2ad0479fe 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/InfApiErrorLogService.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogService.java @@ -1,9 +1,10 @@ package cn.iocoder.yudao.module.infra.service.logger; -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogExportReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogPageReqVO; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO; +import cn.iocoder.yudao.framework.apilog.core.service.ApiErrorLogFrameworkService; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO; +import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO; import java.util.List; @@ -12,7 +13,7 @@ import java.util.List; * * @author 芋道源码 */ -public interface InfApiErrorLogService { +public interface ApiErrorLogService extends ApiErrorLogFrameworkService { /** * 获得 API 错误日志分页 @@ -20,7 +21,7 @@ public interface InfApiErrorLogService { * @param pageReqVO 分页查询 * @return API 错误日志分页 */ - PageResult getApiErrorLogPage(InfApiErrorLogPageReqVO pageReqVO); + PageResult getApiErrorLogPage(ApiErrorLogPageReqVO pageReqVO); /** * 获得 API 错误日志列表, 用于 Excel 导出 @@ -28,7 +29,7 @@ public interface InfApiErrorLogService { * @param exportReqVO 查询条件 * @return API 错误日志分页 */ - List getApiErrorLogList(InfApiErrorLogExportReqVO exportReqVO); + List getApiErrorLogList(ApiErrorLogExportReqVO exportReqVO); /** * 更新 API 错误日志已处理 diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImpl.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImpl.java new file mode 100644 index 000000000..038f47a38 --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImpl.java @@ -0,0 +1,65 @@ +package cn.iocoder.yudao.module.infra.service.logger; + +import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateReqDTO; +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO; +import cn.iocoder.yudao.module.infra.convert.logger.ApiErrorLogConvert; +import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO; +import cn.iocoder.yudao.module.infra.dal.mysql.logger.ApiErrorLogMapper; +import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants; +import cn.iocoder.yudao.module.infra.enums.logger.ApiErrorLogProcessStatusEnum; +import org.springframework.scheduling.annotation.Async; +import org.springframework.stereotype.Service; +import org.springframework.validation.annotation.Validated; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; + +/** + * API 错误日志 Service 实现类 + * + * @author 芋道源码 + */ +@Service +@Validated +public class ApiErrorLogServiceImpl implements ApiErrorLogService { + + @Resource + private ApiErrorLogMapper apiErrorLogMapper; + + @Override + public PageResult getApiErrorLogPage(ApiErrorLogPageReqVO pageReqVO) { + return apiErrorLogMapper.selectPage(pageReqVO); + } + + @Override + public List getApiErrorLogList(ApiErrorLogExportReqVO exportReqVO) { + return apiErrorLogMapper.selectList(exportReqVO); + } + + @Override + public void updateApiErrorLogProcess(Long id, Integer processStatus, Long processUserId) { + ApiErrorLogDO errorLog = apiErrorLogMapper.selectById(id); + if (errorLog == null) { + throw ServiceExceptionUtil.exception(ErrorCodeConstants.API_ERROR_LOG_NOT_FOUND); + } + if (!ApiErrorLogProcessStatusEnum.INIT.getStatus().equals(errorLog.getProcessStatus())) { + throw ServiceExceptionUtil.exception(ErrorCodeConstants.API_ERROR_LOG_PROCESSED); + } + // 标记处理 + apiErrorLogMapper.updateById(ApiErrorLogDO.builder().id(id).processStatus(processStatus) + .processUserId(processUserId).processTime(new Date()).build()); + } + + @Override + @Async + public void createApiErrorLogAsync(ApiErrorLogCreateReqDTO createDTO) { + ApiErrorLogDO apiErrorLog = ApiErrorLogConvert.INSTANCE.convert(createDTO); + apiErrorLog.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus()); + apiErrorLogMapper.insert(apiErrorLog); + } + +} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/InfApiAccessLogCoreService.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/InfApiAccessLogCoreService.java deleted file mode 100644 index c38963e4e..000000000 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/InfApiAccessLogCoreService.java +++ /dev/null @@ -1,12 +0,0 @@ -package cn.iocoder.yudao.module.infra.service.logger; - -import cn.iocoder.yudao.framework.apilog.core.service.ApiAccessLogFrameworkService; - -/** - * API 访问日志 Service 接口 - * - * @author 芋道源码 - */ -public interface InfApiAccessLogCoreService extends ApiAccessLogFrameworkService { - -} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/InfApiErrorLogCoreService.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/InfApiErrorLogCoreService.java deleted file mode 100644 index 3ba698e7d..000000000 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/InfApiErrorLogCoreService.java +++ /dev/null @@ -1,12 +0,0 @@ -package cn.iocoder.yudao.module.infra.service.logger; - -import cn.iocoder.yudao.framework.apilog.core.service.ApiErrorLogFrameworkService; - -/** - * API 错误日志 Service 接口 - * - * @author 芋道源码 - */ -public interface InfApiErrorLogCoreService extends ApiErrorLogFrameworkService { - -} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/impl/InfApiAccessLogCoreServiceImpl.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/impl/InfApiAccessLogCoreServiceImpl.java deleted file mode 100644 index 6779de2e3..000000000 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/impl/InfApiAccessLogCoreServiceImpl.java +++ /dev/null @@ -1,35 +0,0 @@ -package cn.iocoder.yudao.module.infra.service.logger.impl; - -import cn.iocoder.yudao.coreservice.modules.infra.convert.logger.InfApiAccessLogCoreConvert; -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateReqDTO; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; -import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.logger.InfApiAccessLogCoreMapper; -import cn.iocoder.yudao.coreservice.modules.infra.service.logger.InfApiAccessLogCoreService; -import lombok.extern.slf4j.Slf4j; -import org.springframework.scheduling.annotation.Async; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -import javax.annotation.Resource; - -/** - * API 访问日志 Service 实现类 - * - * @author 芋道源码 - */ -@Service -@Validated -@Slf4j -public class InfApiAccessLogCoreServiceImpl implements InfApiAccessLogCoreService { - - @Resource - private InfApiAccessLogCoreMapper apiAccessLogMapper; - - @Override - @Async - public void createApiAccessLogAsync(ApiAccessLogCreateReqDTO createDTO) { - InfApiAccessLogDO apiAccessLog = InfApiAccessLogCoreConvert.INSTANCE.convert(createDTO); - apiAccessLogMapper.insert(apiAccessLog); - } - -} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/impl/InfApiAccessLogServiceImpl.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/impl/InfApiAccessLogServiceImpl.java deleted file mode 100644 index 87856f35b..000000000 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/impl/InfApiAccessLogServiceImpl.java +++ /dev/null @@ -1,37 +0,0 @@ -package cn.iocoder.yudao.module.infra.service.logger.impl; - -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogExportReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogPageReqVO; -import cn.iocoder.yudao.module.infra.dal.mysql.logger.InfApiAccessLogMapper; -import cn.iocoder.yudao.module.infra.service.logger.InfApiAccessLogService; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -import javax.annotation.Resource; -import java.util.List; - -/** - * API 访问日志 Service 实现类 - * - * @author 芋道源码 - */ -@Service -@Validated -public class InfApiAccessLogServiceImpl implements InfApiAccessLogService { - - @Resource - private InfApiAccessLogMapper apiAccessLogMapper; - - @Override - public PageResult getApiAccessLogPage(InfApiAccessLogPageReqVO pageReqVO) { - return apiAccessLogMapper.selectPage(pageReqVO); - } - - @Override - public List getApiAccessLogList(InfApiAccessLogExportReqVO exportReqVO) { - return apiAccessLogMapper.selectList(exportReqVO); - } - -} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/impl/InfApiErrorLogCoreServiceImpl.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/impl/InfApiErrorLogCoreServiceImpl.java deleted file mode 100644 index ddb8b0cf1..000000000 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/impl/InfApiErrorLogCoreServiceImpl.java +++ /dev/null @@ -1,37 +0,0 @@ -package cn.iocoder.yudao.module.infra.service.logger.impl; - -import cn.iocoder.yudao.coreservice.modules.infra.convert.logger.InfApiErrorLogCoreConvert; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO; -import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.logger.InfApiErrorLogCoreMapper; -import cn.iocoder.yudao.coreservice.modules.infra.enums.logger.InfApiErrorLogProcessStatusEnum; -import cn.iocoder.yudao.coreservice.modules.infra.service.logger.InfApiErrorLogCoreService; -import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateReqDTO; -import lombok.extern.slf4j.Slf4j; -import org.springframework.scheduling.annotation.Async; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -import javax.annotation.Resource; - -/** - * API 错误日志 Service 实现类 - * - * @author 芋道源码 - */ -@Service -@Validated -@Slf4j -public class InfApiErrorLogCoreServiceImpl implements InfApiErrorLogCoreService { - - @Resource - private InfApiErrorLogCoreMapper apiErrorLogMapper; - - @Override - @Async - public void createApiErrorLogAsync(ApiErrorLogCreateReqDTO createDTO) { - InfApiErrorLogDO apiErrorLog = InfApiErrorLogCoreConvert.INSTANCE.convert(createDTO); - apiErrorLog.setProcessStatus(InfApiErrorLogProcessStatusEnum.INIT.getStatus()); - apiErrorLogMapper.insert(apiErrorLog); - } - -} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/impl/InfApiErrorLogServiceImpl.java b/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/impl/InfApiErrorLogServiceImpl.java deleted file mode 100644 index 85e21cc99..000000000 --- a/yudao-module-infra/yudao-module-infra-impl/src/main/java/cn/iocoder/yudao/module/infra/service/logger/impl/InfApiErrorLogServiceImpl.java +++ /dev/null @@ -1,57 +0,0 @@ -package cn.iocoder.yudao.module.infra.service.logger.impl; - -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogExportReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogPageReqVO; -import cn.iocoder.yudao.module.infra.dal.mysql.logger.InfApiErrorLogMapper; -import cn.iocoder.yudao.module.infra.enums.logger.InfApiErrorLogProcessStatusEnum; -import cn.iocoder.yudao.module.infra.service.logger.InfApiErrorLogService; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO; -import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants; -import org.springframework.stereotype.Service; -import org.springframework.validation.annotation.Validated; - -import javax.annotation.Resource; -import java.util.Date; -import java.util.List; - -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; - -/** - * API 错误日志 Service 实现类 - * - * @author 芋道源码 - */ -@Service -@Validated -public class InfApiErrorLogServiceImpl implements InfApiErrorLogService { - - @Resource - private InfApiErrorLogMapper apiErrorLogMapper; - - @Override - public PageResult getApiErrorLogPage(InfApiErrorLogPageReqVO pageReqVO) { - return apiErrorLogMapper.selectPage(pageReqVO); - } - - @Override - public List getApiErrorLogList(InfApiErrorLogExportReqVO exportReqVO) { - return apiErrorLogMapper.selectList(exportReqVO); - } - - @Override - public void updateApiErrorLogProcess(Long id, Integer processStatus, Long processUserId) { - InfApiErrorLogDO errorLog = apiErrorLogMapper.selectById(id); - if (errorLog == null) { - throw ServiceExceptionUtil.exception(InfErrorCodeConstants.API_ERROR_LOG_NOT_FOUND); - } - if (!InfApiErrorLogProcessStatusEnum.INIT.getStatus().equals(errorLog.getProcessStatus())) { - throw ServiceExceptionUtil.exception(InfErrorCodeConstants.API_ERROR_LOG_PROCESSED); - } - // 标记处理 - apiErrorLogMapper.updateById(InfApiErrorLogDO.builder().id(id).processStatus(processStatus) - .processUserId(processUserId).processTime(new Date()).build()); - } - -} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/package-info.java b/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/package-info.java deleted file mode 100644 index 9ce8230c4..000000000 --- a/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/package-info.java +++ /dev/null @@ -1 +0,0 @@ -package cn.iocoder.yudao.module.infra; diff --git a/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/config/InfConfigServiceTest.java b/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/config/ConfigServiceTest.java similarity index 73% rename from yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/config/InfConfigServiceTest.java rename to yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/config/ConfigServiceTest.java index d50f5b15a..1eeae4199 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/config/InfConfigServiceTest.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/config/ConfigServiceTest.java @@ -1,19 +1,18 @@ package cn.iocoder.yudao.module.infra.service.config; -import cn.iocoder.yudao.adminserver.BaseDbUnitTest; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.config.InfConfigDO; import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; +import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; import cn.iocoder.yudao.framework.test.core.util.RandomUtils; import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigCreateReqVO; import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigExportReqVO; import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigPageReqVO; import cn.iocoder.yudao.module.infra.controller.admin.config.vo.ConfigUpdateReqVO; -import cn.iocoder.yudao.module.infra.dal.mysql.config.InfConfigMapper; -import cn.iocoder.yudao.module.infra.enums.config.InfConfigTypeEnum; -import cn.iocoder.yudao.module.infra.mq.producer.config.InfConfigProducer; -import cn.iocoder.yudao.module.infra.service.config.impl.InfConfigServiceImpl; -import cn.iocoder.yudao.framework.common.util.collection.ArrayUtils; -import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; +import cn.iocoder.yudao.module.infra.dal.dataobject.config.ConfigDO; +import cn.iocoder.yudao.module.infra.dal.mysql.config.ConfigMapper; +import cn.iocoder.yudao.module.infra.enums.config.ConfigTypeEnum; +import cn.iocoder.yudao.module.infra.mq.producer.config.ConfigProducer; +import cn.iocoder.yudao.module.infra.test.BaseDbUnitTest; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.springframework.boot.test.mock.mockito.MockBean; @@ -24,30 +23,25 @@ import java.util.List; import java.util.function.Consumer; import static cn.hutool.core.util.RandomUtil.randomEle; -import static cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants.*; +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.AssertUtils.assertServiceException; -import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.*; +import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; -/** - * {@link InfConfigServiceImpl} 的单元测试类 - * - * @author 芋道源码 - */ -@Import(InfConfigServiceImpl.class) -public class InfConfigServiceTest extends BaseDbUnitTest { +@Import(ConfigServiceImpl.class) +public class ConfigServiceTest extends BaseDbUnitTest { @Resource - private InfConfigServiceImpl configService; + private ConfigServiceImpl configService; @Resource - private InfConfigMapper configMapper; + private ConfigMapper configMapper; @MockBean - private InfConfigProducer configProducer; + private ConfigProducer configProducer; @Test public void testCreateConfig_success() { @@ -59,9 +53,9 @@ public class InfConfigServiceTest extends BaseDbUnitTest { // 断言 assertNotNull(configId); // 校验记录的属性是否正确 - InfConfigDO config = configMapper.selectById(configId); + ConfigDO config = configMapper.selectById(configId); assertPojoEquals(reqVO, config); - Assertions.assertEquals(InfConfigTypeEnum.CUSTOM.getType(), config.getType()); + Assertions.assertEquals(ConfigTypeEnum.CUSTOM.getType(), config.getType()); // 校验调用 verify(configProducer, times(1)).sendConfigRefreshMessage(); } @@ -69,7 +63,7 @@ public class InfConfigServiceTest extends BaseDbUnitTest { @Test public void testUpdateConfig_success() { // mock 数据 - InfConfigDO dbConfig = randomInfConfigDO(); + ConfigDO dbConfig = randomConfigDO(); configMapper.insert(dbConfig);// @Sql: 先插入出一条存在的数据 // 准备参数 ConfigUpdateReqVO reqVO = randomPojo(ConfigUpdateReqVO.class, o -> { @@ -79,7 +73,7 @@ public class InfConfigServiceTest extends BaseDbUnitTest { // 调用 configService.updateConfig(reqVO); // 校验是否更新正确 - InfConfigDO config = configMapper.selectById(reqVO.getId()); // 获取最新的 + ConfigDO config = configMapper.selectById(reqVO.getId()); // 获取最新的 assertPojoEquals(reqVO, config); // 校验调用 verify(configProducer, times(1)).sendConfigRefreshMessage(); @@ -88,8 +82,8 @@ public class InfConfigServiceTest extends BaseDbUnitTest { @Test public void testDeleteConfig_success() { // mock 数据 - InfConfigDO dbConfig = randomInfConfigDO(o -> { - o.setType(InfConfigTypeEnum.CUSTOM.getType()); // 只能删除 CUSTOM 类型 + ConfigDO dbConfig = randomConfigDO(o -> { + o.setType(ConfigTypeEnum.CUSTOM.getType()); // 只能删除 CUSTOM 类型 }); configMapper.insert(dbConfig);// @Sql: 先插入出一条存在的数据 // 准备参数 @@ -106,8 +100,8 @@ public class InfConfigServiceTest extends BaseDbUnitTest { @Test public void testDeleteConfig_canNotDeleteSystemType() { // mock 数据 - InfConfigDO dbConfig = randomInfConfigDO(o -> { - o.setType(InfConfigTypeEnum.SYSTEM.getType()); // SYSTEM 不允许删除 + ConfigDO dbConfig = randomConfigDO(o -> { + o.setType(ConfigTypeEnum.SYSTEM.getType()); // SYSTEM 不允许删除 }); configMapper.insert(dbConfig);// @Sql: 先插入出一条存在的数据 // 准备参数 @@ -120,7 +114,7 @@ public class InfConfigServiceTest extends BaseDbUnitTest { @Test public void testCheckConfigExists_success() { // mock 数据 - InfConfigDO dbConfigDO = randomInfConfigDO(); + ConfigDO dbConfigDO = randomConfigDO(); configMapper.insert(dbConfigDO);// @Sql: 先插入出一条存在的数据 // 调用成功 @@ -143,7 +137,7 @@ public class InfConfigServiceTest extends BaseDbUnitTest { // 准备参数 String key = randomString(); // mock 数据 - configMapper.insert(randomInfConfigDO(o -> o.setKey(key))); + configMapper.insert(randomConfigDO(o -> o.setKey(key))); // 调用,校验异常 assertServiceException(() -> configService.checkConfigKeyUnique(null, key), @@ -156,7 +150,7 @@ public class InfConfigServiceTest extends BaseDbUnitTest { Long id = randomLongId(); String key = randomString(); // mock 数据 - configMapper.insert(randomInfConfigDO(o -> o.setKey(key))); + configMapper.insert(randomConfigDO(o -> o.setKey(key))); // 调用,校验异常 assertServiceException(() -> configService.checkConfigKeyUnique(id, key), @@ -166,10 +160,10 @@ public class InfConfigServiceTest extends BaseDbUnitTest { @Test public void testGetConfigPage() { // mock 数据 - InfConfigDO dbConfig = randomInfConfigDO(o -> { // 等会查询到 + ConfigDO dbConfig = randomConfigDO(o -> { // 等会查询到 o.setName("芋艿"); o.setKey("yunai"); - o.setType(InfConfigTypeEnum.SYSTEM.getType()); + o.setType(ConfigTypeEnum.SYSTEM.getType()); o.setCreateTime(buildTime(2021, 2, 1)); }); configMapper.insert(dbConfig); @@ -178,19 +172,19 @@ public class InfConfigServiceTest extends BaseDbUnitTest { // 测试 key 不匹配 configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setKey("tudou"))); // 测试 type 不匹配 - configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setType(InfConfigTypeEnum.CUSTOM.getType()))); + configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setType(ConfigTypeEnum.CUSTOM.getType()))); // 测试 createTime 不匹配 configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setCreateTime(buildTime(2021, 1, 1)))); // 准备参数 ConfigPageReqVO reqVO = new ConfigPageReqVO(); reqVO.setName("艿"); reqVO.setKey("nai"); - reqVO.setType(InfConfigTypeEnum.SYSTEM.getType()); + reqVO.setType(ConfigTypeEnum.SYSTEM.getType()); reqVO.setBeginTime(buildTime(2021, 1, 15)); reqVO.setEndTime(buildTime(2021, 2, 15)); // 调用 - PageResult pageResult = configService.getConfigPage(reqVO); + PageResult pageResult = configService.getConfigPage(reqVO); // 断言 assertEquals(1, pageResult.getTotal()); assertEquals(1, pageResult.getList().size()); @@ -200,10 +194,10 @@ public class InfConfigServiceTest extends BaseDbUnitTest { @Test public void testGetConfigList() { // mock 数据 - InfConfigDO dbConfig = randomInfConfigDO(o -> { // 等会查询到 + ConfigDO dbConfig = randomConfigDO(o -> { // 等会查询到 o.setName("芋艿"); o.setKey("yunai"); - o.setType(InfConfigTypeEnum.SYSTEM.getType()); + o.setType(ConfigTypeEnum.SYSTEM.getType()); o.setCreateTime(buildTime(2021, 2, 1)); }); configMapper.insert(dbConfig); @@ -212,19 +206,19 @@ public class InfConfigServiceTest extends BaseDbUnitTest { // 测试 key 不匹配 configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setKey("tudou"))); // 测试 type 不匹配 - configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setType(InfConfigTypeEnum.CUSTOM.getType()))); + configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setType(ConfigTypeEnum.CUSTOM.getType()))); // 测试 createTime 不匹配 configMapper.insert(ObjectUtils.cloneIgnoreId(dbConfig, o -> o.setCreateTime(buildTime(2021, 1, 1)))); // 准备参数 ConfigExportReqVO reqVO = new ConfigExportReqVO(); reqVO.setName("艿"); reqVO.setKey("nai"); - reqVO.setType(InfConfigTypeEnum.SYSTEM.getType()); + reqVO.setType(ConfigTypeEnum.SYSTEM.getType()); reqVO.setBeginTime(buildTime(2021, 1, 15)); reqVO.setEndTime(buildTime(2021, 2, 15)); // 调用 - List list = configService.getConfigList(reqVO); + List list = configService.getConfigList(reqVO); // 断言 assertEquals(1, list.size()); assertPojoEquals(dbConfig, list.get(0)); @@ -233,13 +227,13 @@ public class InfConfigServiceTest extends BaseDbUnitTest { @Test public void testGetConfigByKey() { // mock 数据 - InfConfigDO dbConfig = randomInfConfigDO(); + ConfigDO dbConfig = randomConfigDO(); configMapper.insert(dbConfig);// @Sql: 先插入出一条存在的数据 // 准备参数 String key = dbConfig.getKey(); // 调用 - InfConfigDO config = configService.getConfigByKey(key); + ConfigDO config = configService.getConfigByKey(key); // 断言 assertNotNull(config); assertPojoEquals(dbConfig, config); @@ -248,11 +242,11 @@ public class InfConfigServiceTest extends BaseDbUnitTest { // ========== 随机对象 ========== @SafeVarargs - private static InfConfigDO randomInfConfigDO(Consumer... consumers) { - Consumer consumer = (o) -> { - o.setType(randomEle(InfConfigTypeEnum.values()).getType()); // 保证 key 的范围 + private static ConfigDO randomConfigDO(Consumer... consumers) { + Consumer consumer = (o) -> { + o.setType(randomEle(ConfigTypeEnum.values()).getType()); // 保证 key 的范围 }; - return RandomUtils.randomPojo(InfConfigDO.class, ArrayUtils.append(consumer, consumers)); + return RandomUtils.randomPojo(ConfigDO.class, ArrayUtils.append(consumer, consumers)); } } diff --git a/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileServiceTest.java b/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileServiceTest.java new file mode 100644 index 000000000..8356957e4 --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/file/FileServiceTest.java @@ -0,0 +1,126 @@ +package cn.iocoder.yudao.module.infra.service.file; + +import cn.hutool.core.io.resource.ResourceUtil; +import cn.iocoder.yudao.framework.common.pojo.PageResult; +import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; +import cn.iocoder.yudao.framework.test.core.util.AssertUtils; +import cn.iocoder.yudao.module.infra.controller.admin.file.vo.FilePageReqVO; +import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO; +import cn.iocoder.yudao.module.infra.dal.mysql.file.FileMapper; +import cn.iocoder.yudao.module.infra.framework.file.config.FileProperties; +import cn.iocoder.yudao.module.infra.test.BaseDbUnitTest; +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 static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; +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; +import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*; +import static org.junit.jupiter.api.Assertions.*; + +@Import({FileServiceImpl.class, FileProperties.class}) +public class FileServiceTest extends BaseDbUnitTest { + + @Resource + private FileService fileService; + + @MockBean + private FileProperties fileProperties; + + @Resource + private FileMapper fileMapper; + + @Test + public void testGetFilePage() { + // mock 数据 + FileDO dbFile = randomPojo(FileDO.class, o -> { // 等会查询到 + o.setId("yudao"); + o.setType("jpg"); + o.setCreateTime(buildTime(2021, 1, 15)); + }); + fileMapper.insert(dbFile); + // 测试 id 不匹配 + fileMapper.insert(ObjectUtils.cloneIgnoreId(dbFile, o -> o.setId("tudou"))); + // 测试 type 不匹配 + fileMapper.insert(ObjectUtils.cloneIgnoreId(dbFile, o -> { + o.setId("yudao02"); + o.setType("png"); + })); + // 测试 createTime 不匹配 + fileMapper.insert(ObjectUtils.cloneIgnoreId(dbFile, o -> { + o.setId("yudao03"); + o.setCreateTime(buildTime(2020, 1, 15)); + })); + // 准备参数 + FilePageReqVO reqVO = new FilePageReqVO(); + reqVO.setId("yudao"); + reqVO.setType("jp"); + reqVO.setBeginCreateTime(buildTime(2021, 1, 10)); + reqVO.setEndCreateTime(buildTime(2021, 1, 20)); + + // 调用 + PageResult pageResult = fileService.getFilePage(reqVO); + // 断言 + assertEquals(1, pageResult.getTotal()); + assertEquals(1, pageResult.getList().size()); + AssertUtils.assertPojoEquals(dbFile, pageResult.getList().get(0), "content"); + } + + @Test + public void testCreateFile_success() { + // 准备参数 + String path = randomString(); + byte[] content = ResourceUtil.readBytes("file/erweima.jpg"); + + // 调用 + String url = fileService.createFile(path, content); + // 断言 + assertEquals(fileProperties.getBasePath() + path, url); + // 校验数据 + FileDO file = fileMapper.selectById(path); + assertEquals(path, file.getId()); + assertEquals("jpg", file.getType()); + assertArrayEquals(content, file.getContent()); + } + + @Test + public void testCreateFile_exists() { + // mock 数据 + FileDO dbFile = randomPojo(FileDO.class); + fileMapper.insert(dbFile); + // 准备参数 + String path = dbFile.getId(); // 模拟已存在 + byte[] content = ResourceUtil.readBytes("file/erweima.jpg"); + + // 调用,并断言异常 + assertServiceException(() -> fileService.createFile(path, content), FILE_PATH_EXISTS); + } + + @Test + public void testDeleteFile_success() { + // mock 数据 + FileDO dbFile = randomPojo(FileDO.class); + fileMapper.insert(dbFile);// @Sql: 先插入出一条存在的数据 + // 准备参数 + String id = dbFile.getId(); + + // 调用 + fileService.deleteFile(id); + // 校验数据不存在了 + assertNull(fileMapper.selectById(id)); + } + + @Test + public void testDeleteFile_notExists() { + // 准备参数 + String id = randomString(); + + // 调用, 并断言异常 + assertServiceException(() -> fileService.deleteFile(id), FILE_NOT_EXISTS); + } + +} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/file/InfFileServiceTest.java b/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/file/InfFileServiceTest.java deleted file mode 100644 index 314193f66..000000000 --- a/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/file/InfFileServiceTest.java +++ /dev/null @@ -1,70 +0,0 @@ -package cn.iocoder.yudao.module.infra.service.file; - -import cn.iocoder.yudao.adminserver.BaseDbUnitTest; -import cn.iocoder.yudao.framework.test.core.util.AssertUtils; -import cn.iocoder.yudao.module.infra.controller.admin.file.vo.InfFilePageReqVO; -import cn.iocoder.yudao.module.infra.service.file.impl.InfFileServiceImpl; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.file.InfFileDO; -import cn.iocoder.yudao.coreservice.modules.infra.dal.mysql.file.InfFileCoreMapper; -import cn.iocoder.yudao.coreservice.modules.infra.framework.file.config.FileProperties; -import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; -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 static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; -import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; -import static org.junit.jupiter.api.Assertions.assertEquals; - -@Import({InfFileServiceImpl.class, FileProperties.class}) -public class InfFileServiceTest extends BaseDbUnitTest { - - @Resource - private InfFileService fileService; - - @MockBean - private FileProperties fileProperties; - - @Resource - private InfFileCoreMapper fileMapper; - - @Test - public void testGetFilePage() { - // mock 数据 - InfFileDO dbFile = randomPojo(InfFileDO.class, o -> { // 等会查询到 - o.setId("yudao"); - o.setType("jpg"); - o.setCreateTime(buildTime(2021, 1, 15)); - }); - fileMapper.insert(dbFile); - // 测试 id 不匹配 - fileMapper.insert(ObjectUtils.cloneIgnoreId(dbFile, o -> o.setId("tudou"))); - // 测试 type 不匹配 - fileMapper.insert(ObjectUtils.cloneIgnoreId(dbFile, o -> { - o.setId("yudao02"); - o.setType("png"); - })); - // 测试 createTime 不匹配 - fileMapper.insert(ObjectUtils.cloneIgnoreId(dbFile, o -> { - o.setId("yudao03"); - o.setCreateTime(buildTime(2020, 1, 15)); - })); - // 准备参数 - InfFilePageReqVO reqVO = new InfFilePageReqVO(); - reqVO.setId("yudao"); - reqVO.setType("jp"); - reqVO.setBeginCreateTime(buildTime(2021, 1, 10)); - reqVO.setEndCreateTime(buildTime(2021, 1, 20)); - - // 调用 - PageResult pageResult = fileService.getFilePage(reqVO); - // 断言 - assertEquals(1, pageResult.getTotal()); - assertEquals(1, pageResult.getList().size()); - AssertUtils.assertPojoEquals(dbFile, pageResult.getList().get(0), "content"); - } - -} diff --git a/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/job/InfJobLogServiceTest.java b/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/job/JobLogServiceTest.java similarity index 67% rename from yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/job/InfJobLogServiceTest.java rename to yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/job/JobLogServiceTest.java index 60edcef09..27bda4965 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/job/InfJobLogServiceTest.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/job/JobLogServiceTest.java @@ -14,36 +14,30 @@ import java.util.List; import javax.annotation.Resource; +import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobLogDO; +import cn.iocoder.yudao.module.infra.test.BaseDbUnitTest; import org.junit.jupiter.api.Test; import org.springframework.context.annotation.Import; -import cn.iocoder.yudao.adminserver.BaseDbUnitTest; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogExportReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.InfJobLogPageReqVO; -import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobLogDO; -import cn.iocoder.yudao.module.infra.dal.mysql.job.InfJobLogMapper; -import cn.iocoder.yudao.module.infra.enums.job.InfJobLogStatusEnum; -import cn.iocoder.yudao.module.infra.service.job.impl.InfJobLogServiceImpl; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogExportReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.log.JobLogPageReqVO; +import cn.iocoder.yudao.module.infra.dal.mysql.job.JobLogMapper; +import cn.iocoder.yudao.module.infra.enums.job.JobLogStatusEnum; import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; -/** - * {@link InfJobLogServiceImpl} 的单元测试 - * - * @author neilz - */ -@Import(InfJobLogServiceImpl.class) -public class InfJobLogServiceTest extends BaseDbUnitTest { +@Import(JobLogServiceImpl.class) +public class JobLogServiceTest extends BaseDbUnitTest { @Resource - private InfJobLogServiceImpl jobLogService; + private JobLogServiceImpl jobLogService; @Resource - private InfJobLogMapper jobLogMapper; + private JobLogMapper jobLogMapper; @Test public void testCreateJobLog_success() { // 准备参数 - InfJobLogDO reqVO = randomPojo(InfJobLogDO.class, o -> { + JobLogDO reqVO = randomPojo(JobLogDO.class, o -> { o.setExecuteIndex(1); }); // 调用 @@ -51,40 +45,40 @@ public class InfJobLogServiceTest extends BaseDbUnitTest { // 断言 assertNotNull(jobLogId); // 校验记录的属性是否正确 - InfJobLogDO job = jobLogMapper.selectById(jobLogId); - assertEquals(InfJobLogStatusEnum.RUNNING.getStatus(), job.getStatus()); + JobLogDO job = jobLogMapper.selectById(jobLogId); + assertEquals(JobLogStatusEnum.RUNNING.getStatus(), job.getStatus()); } @Test public void testUpdateJobLogResultAsync_success() { // 准备参数 - InfJobLogDO reqVO = randomPojo(InfJobLogDO.class, o -> { + JobLogDO reqVO = randomPojo(JobLogDO.class, o -> { o.setExecuteIndex(1); }); - InfJobLogDO log = InfJobLogDO.builder().jobId(reqVO.getJobId()).handlerName(reqVO.getHandlerName()).handlerParam(reqVO.getHandlerParam()).executeIndex(reqVO.getExecuteIndex()) - .beginTime(reqVO.getBeginTime()).status(InfJobLogStatusEnum.RUNNING.getStatus()).build(); + JobLogDO log = JobLogDO.builder().jobId(reqVO.getJobId()).handlerName(reqVO.getHandlerName()).handlerParam(reqVO.getHandlerParam()).executeIndex(reqVO.getExecuteIndex()) + .beginTime(reqVO.getBeginTime()).status(JobLogStatusEnum.RUNNING.getStatus()).build(); jobLogMapper.insert(log); // 调用 jobLogService.updateJobLogResultAsync(log.getId(), reqVO.getBeginTime(), reqVO.getDuration(), true,reqVO.getResult()); // 校验记录的属性是否正确 - InfJobLogDO job = jobLogMapper.selectById(log.getId()); - assertEquals(InfJobLogStatusEnum.SUCCESS.getStatus(), job.getStatus()); + JobLogDO job = jobLogMapper.selectById(log.getId()); + assertEquals(JobLogStatusEnum.SUCCESS.getStatus(), job.getStatus()); // 调用 jobLogService.updateJobLogResultAsync(log.getId(), reqVO.getBeginTime(), reqVO.getDuration(), false,reqVO.getResult()); // 校验记录的属性是否正确 - InfJobLogDO job2 = jobLogMapper.selectById(log.getId()); - assertEquals(InfJobLogStatusEnum.FAILURE.getStatus(), job2.getStatus()); + JobLogDO job2 = jobLogMapper.selectById(log.getId()); + assertEquals(JobLogStatusEnum.FAILURE.getStatus(), job2.getStatus()); } @Test public void testGetJobLogListByIds_success() { // mock 数据 - InfJobLogDO dbJobLog = randomPojo(InfJobLogDO.class, o -> { + JobLogDO dbJobLog = randomPojo(JobLogDO.class, o -> { o.setExecuteIndex(1); - o.setStatus(randomEle(InfJobLogStatusEnum.values()).getStatus()); // 保证 status 的范围 + o.setStatus(randomEle(JobLogStatusEnum.values()).getStatus()); // 保证 status 的范围 }); - InfJobLogDO cloneJobLog = ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setHandlerName(randomString())); + JobLogDO cloneJobLog = ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setHandlerName(randomString())); jobLogMapper.insert(dbJobLog); // 测试 handlerName 不匹配 jobLogMapper.insert(cloneJobLog); @@ -93,7 +87,7 @@ public class InfJobLogServiceTest extends BaseDbUnitTest { ids.add(dbJobLog.getId()); ids.add(cloneJobLog.getId()); // 调用 - List list = jobLogService.getJobLogList(ids); + List list = jobLogService.getJobLogList(ids); // 断言 assertEquals(2, list.size()); assertPojoEquals(dbJobLog, list.get(0)); @@ -102,10 +96,10 @@ public class InfJobLogServiceTest extends BaseDbUnitTest { @Test public void testGetJobPage_success() { // mock 数据 - InfJobLogDO dbJobLog = randomPojo(InfJobLogDO.class, o -> { + JobLogDO dbJobLog = randomPojo(JobLogDO.class, o -> { o.setExecuteIndex(1); o.setHandlerName("handlerName 单元测试"); - o.setStatus(InfJobLogStatusEnum.SUCCESS.getStatus()); + o.setStatus(JobLogStatusEnum.SUCCESS.getStatus()); o.setBeginTime(buildTime(2021, 1, 8)); o.setEndTime(buildTime(2021, 1, 8)); }); @@ -119,16 +113,16 @@ public class InfJobLogServiceTest extends BaseDbUnitTest { // 测试 endTime 不匹配 jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setEndTime(buildTime(2021, 1, 9)))); // 测试 status 不匹配 - jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setStatus(InfJobLogStatusEnum.FAILURE.getStatus()))); + jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setStatus(JobLogStatusEnum.FAILURE.getStatus()))); // 准备参数 - InfJobLogPageReqVO reqVo = new InfJobLogPageReqVO(); + JobLogPageReqVO reqVo = new JobLogPageReqVO(); reqVo.setJobId(dbJobLog.getJobId()); reqVo.setHandlerName("单元"); reqVo.setBeginTime(dbJobLog.getBeginTime()); reqVo.setEndTime(dbJobLog.getEndTime()); - reqVo.setStatus(InfJobLogStatusEnum.SUCCESS.getStatus()); + reqVo.setStatus(JobLogStatusEnum.SUCCESS.getStatus()); // 调用 - PageResult pageResult = jobLogService.getJobLogPage(reqVo); + PageResult pageResult = jobLogService.getJobLogPage(reqVo); // 断言 assertEquals(1, pageResult.getTotal()); assertEquals(1, pageResult.getList().size()); @@ -138,10 +132,10 @@ public class InfJobLogServiceTest extends BaseDbUnitTest { @Test public void testGetJobListForExport_success() { // mock 数据 - InfJobLogDO dbJobLog = randomPojo(InfJobLogDO.class, o -> { + JobLogDO dbJobLog = randomPojo(JobLogDO.class, o -> { o.setExecuteIndex(1); o.setHandlerName("handlerName 单元测试"); - o.setStatus(InfJobLogStatusEnum.SUCCESS.getStatus()); + o.setStatus(JobLogStatusEnum.SUCCESS.getStatus()); o.setBeginTime(buildTime(2021, 1, 8)); o.setEndTime(buildTime(2021, 1, 8)); }); @@ -155,16 +149,16 @@ public class InfJobLogServiceTest extends BaseDbUnitTest { // 测试 endTime 不匹配 jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setEndTime(buildTime(2021, 1, 9)))); // 测试 status 不匹配 - jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setStatus(InfJobLogStatusEnum.FAILURE.getStatus()))); + jobLogMapper.insert(ObjectUtils.cloneIgnoreId(dbJobLog, o -> o.setStatus(JobLogStatusEnum.FAILURE.getStatus()))); // 准备参数 - InfJobLogExportReqVO reqVo = new InfJobLogExportReqVO(); + JobLogExportReqVO reqVo = new JobLogExportReqVO(); reqVo.setJobId(dbJobLog.getJobId()); reqVo.setHandlerName("单元"); reqVo.setBeginTime(dbJobLog.getBeginTime()); reqVo.setEndTime(dbJobLog.getEndTime()); - reqVo.setStatus(InfJobLogStatusEnum.SUCCESS.getStatus()); + reqVo.setStatus(JobLogStatusEnum.SUCCESS.getStatus()); // 调用 - List list = jobLogService.getJobLogList(reqVo); + List list = jobLogService.getJobLogList(reqVo); // 断言 assertEquals(1, list.size()); assertPojoEquals(dbJobLog, list.get(0)); diff --git a/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/job/InfJobServiceTest.java b/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/job/JobServiceTest.java similarity index 62% rename from yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/job/InfJobServiceTest.java rename to yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/job/JobServiceTest.java index 6fd5acaea..cfbeb307b 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/job/InfJobServiceTest.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/job/JobServiceTest.java @@ -1,12 +1,7 @@ package cn.iocoder.yudao.module.infra.service.job; import static cn.hutool.core.util.RandomUtil.randomEle; -import static cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants.JOB_CHANGE_STATUS_EQUALS; -import static cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants.JOB_CHANGE_STATUS_INVALID; -import static cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants.JOB_CRON_EXPRESSION_VALID; -import static cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants.JOB_HANDLER_EXISTS; -import static cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants.JOB_NOT_EXISTS; -import static cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants.JOB_UPDATE_ONLY_NORMAL_STATUS; +import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.*; import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertServiceException; import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; @@ -23,44 +18,38 @@ import java.util.List; import javax.annotation.Resource; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobCreateReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobUpdateReqVO; +import cn.iocoder.yudao.module.infra.convert.job.JobConvert; +import cn.iocoder.yudao.module.infra.dal.dataobject.job.JobDO; +import cn.iocoder.yudao.module.infra.test.BaseDbUnitTest; import org.junit.jupiter.api.Test; import org.quartz.SchedulerException; import org.springframework.boot.test.mock.mockito.MockBean; import org.springframework.context.annotation.Import; -import cn.iocoder.yudao.adminserver.BaseDbUnitTest; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.quartz.core.scheduler.SchedulerManager; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobCreateReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobExportReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobPageReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.InfJobUpdateReqVO; -import cn.iocoder.yudao.module.infra.convert.job.InfJobConvert; -import cn.iocoder.yudao.module.infra.dal.dataobject.job.InfJobDO; -import cn.iocoder.yudao.module.infra.dal.mysql.job.InfJobMapper; -import cn.iocoder.yudao.module.infra.enums.job.InfJobStatusEnum; -import cn.iocoder.yudao.module.infra.service.job.impl.InfJobServiceImpl; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobExportReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.job.vo.job.JobPageReqVO; +import cn.iocoder.yudao.module.infra.dal.mysql.job.JobMapper; +import cn.iocoder.yudao.module.infra.enums.job.JobStatusEnum; import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; -/** - * {@link InfJobServiceImpl} 的单元测试 - * - * @author neilz - */ -@Import(InfJobServiceImpl.class) -public class InfJobServiceTest extends BaseDbUnitTest { +@Import(JobServiceImpl.class) +public class JobServiceTest extends BaseDbUnitTest { @Resource - private InfJobServiceImpl jobService; + private JobServiceImpl jobService; @Resource - private InfJobMapper jobMapper; + private JobMapper jobMapper; @MockBean private SchedulerManager schedulerManager; @Test public void testCreateJob_cronExpressionValid() { // 准备参数。Cron 表达式为 String 类型,默认随机字符串。 - InfJobCreateReqVO reqVO = randomPojo(InfJobCreateReqVO.class); + JobCreateReqVO reqVO = randomPojo(JobCreateReqVO.class); // 调用,并断言异常 assertServiceException(() -> jobService.createJob(reqVO), JOB_CRON_EXPRESSION_VALID); } @@ -68,7 +57,7 @@ public class InfJobServiceTest extends BaseDbUnitTest { @Test public void testCreateJob_jobHandlerExists() throws SchedulerException { // 准备参数 指定 Cron 表达式 - InfJobCreateReqVO reqVO = randomPojo(InfJobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); + JobCreateReqVO reqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); // 调用 jobService.createJob(reqVO); // 调用,并断言异常 @@ -78,15 +67,15 @@ public class InfJobServiceTest extends BaseDbUnitTest { @Test public void testCreateJob_success() throws SchedulerException { // 准备参数 指定 Cron 表达式 - InfJobCreateReqVO reqVO = randomPojo(InfJobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); + JobCreateReqVO reqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); // 调用 Long jobId = jobService.createJob(reqVO); // 断言 assertNotNull(jobId); // 校验记录的属性是否正确 - InfJobDO job = jobMapper.selectById(jobId); + JobDO job = jobMapper.selectById(jobId); assertPojoEquals(reqVO, job); - assertEquals(InfJobStatusEnum.NORMAL.getStatus(), job.getStatus()); + assertEquals(JobStatusEnum.NORMAL.getStatus(), job.getStatus()); // 校验调用 verify(schedulerManager, times(1)).addJob(eq(job.getId()), eq(job.getHandlerName()), eq(job.getHandlerParam()), eq(job.getCronExpression()), eq(reqVO.getRetryCount()), eq(reqVO.getRetryInterval())); @@ -95,7 +84,7 @@ public class InfJobServiceTest extends BaseDbUnitTest { @Test public void testUpdateJob_jobNotExists(){ // 准备参数 - InfJobUpdateReqVO reqVO = randomPojo(InfJobUpdateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); + JobUpdateReqVO reqVO = randomPojo(JobUpdateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); // 调用,并断言异常 assertServiceException(() -> jobService.updateJob(reqVO), JOB_NOT_EXISTS); } @@ -103,13 +92,13 @@ public class InfJobServiceTest extends BaseDbUnitTest { @Test public void testUpdateJob_onlyNormalStatus(){ // mock 数据 - InfJobCreateReqVO createReqVO = randomPojo(InfJobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); - InfJobDO job = InfJobConvert.INSTANCE.convert(createReqVO); - job.setStatus(InfJobStatusEnum.INIT.getStatus()); + JobCreateReqVO createReqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); + JobDO job = JobConvert.INSTANCE.convert(createReqVO); + job.setStatus(JobStatusEnum.INIT.getStatus()); fillJobMonitorTimeoutEmpty(job); jobMapper.insert(job); // 准备参数 - InfJobUpdateReqVO updateReqVO = randomPojo(InfJobUpdateReqVO.class, o -> { + JobUpdateReqVO updateReqVO = randomPojo(JobUpdateReqVO.class, o -> { o.setId(job.getId()); o.setName(createReqVO.getName()); o.setCronExpression(createReqVO.getCronExpression()); @@ -121,13 +110,13 @@ public class InfJobServiceTest extends BaseDbUnitTest { @Test public void testUpdateJob_success() throws SchedulerException { // mock 数据 - InfJobCreateReqVO createReqVO = randomPojo(InfJobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); - InfJobDO job = InfJobConvert.INSTANCE.convert(createReqVO); - job.setStatus(InfJobStatusEnum.NORMAL.getStatus()); + JobCreateReqVO createReqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); + JobDO job = JobConvert.INSTANCE.convert(createReqVO); + job.setStatus(JobStatusEnum.NORMAL.getStatus()); fillJobMonitorTimeoutEmpty(job); jobMapper.insert(job); // 准备参数 - InfJobUpdateReqVO updateReqVO = randomPojo(InfJobUpdateReqVO.class, o -> { + JobUpdateReqVO updateReqVO = randomPojo(JobUpdateReqVO.class, o -> { o.setId(job.getId()); o.setName(createReqVO.getName()); o.setCronExpression(createReqVO.getCronExpression()); @@ -135,7 +124,7 @@ public class InfJobServiceTest extends BaseDbUnitTest { // 调用 jobService.updateJob(updateReqVO); // 校验记录的属性是否正确 - InfJobDO updateJob = jobMapper.selectById(updateReqVO.getId()); + JobDO updateJob = jobMapper.selectById(updateReqVO.getId()); assertPojoEquals(updateReqVO, updateJob); // 校验调用 verify(schedulerManager, times(1)).updateJob(eq(job.getHandlerName()), eq(updateReqVO.getHandlerParam()), eq(updateReqVO.getCronExpression()), @@ -145,15 +134,15 @@ public class InfJobServiceTest extends BaseDbUnitTest { @Test public void testUpdateJobStatus_changeStatusInvalid() { // 调用,并断言异常 - assertServiceException(() -> jobService.updateJobStatus(1l, InfJobStatusEnum.INIT.getStatus()), JOB_CHANGE_STATUS_INVALID); + assertServiceException(() -> jobService.updateJobStatus(1L, JobStatusEnum.INIT.getStatus()), JOB_CHANGE_STATUS_INVALID); } @Test public void testUpdateJobStatus_changeStatusEquals() { // mock 数据 - InfJobCreateReqVO createReqVO = randomPojo(InfJobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); - InfJobDO job = InfJobConvert.INSTANCE.convert(createReqVO); - job.setStatus(InfJobStatusEnum.NORMAL.getStatus()); + JobCreateReqVO createReqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); + JobDO job = JobConvert.INSTANCE.convert(createReqVO); + job.setStatus(JobStatusEnum.NORMAL.getStatus()); fillJobMonitorTimeoutEmpty(job); jobMapper.insert(job); // 调用,并断言异常 @@ -163,16 +152,16 @@ public class InfJobServiceTest extends BaseDbUnitTest { @Test public void testUpdateJobStatus_NormalToStop_success() throws SchedulerException { // mock 数据 - InfJobCreateReqVO createReqVO = randomPojo(InfJobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); - InfJobDO job = InfJobConvert.INSTANCE.convert(createReqVO); - job.setStatus(InfJobStatusEnum.NORMAL.getStatus()); + JobCreateReqVO createReqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); + JobDO job = JobConvert.INSTANCE.convert(createReqVO); + job.setStatus(JobStatusEnum.NORMAL.getStatus()); fillJobMonitorTimeoutEmpty(job); jobMapper.insert(job); // 调用 - jobService.updateJobStatus(job.getId(), InfJobStatusEnum.STOP.getStatus()); + jobService.updateJobStatus(job.getId(), JobStatusEnum.STOP.getStatus()); // 校验记录的属性是否正确 - InfJobDO updateJob = jobMapper.selectById(job.getId()); - assertEquals(InfJobStatusEnum.STOP.getStatus(), updateJob.getStatus()); + JobDO updateJob = jobMapper.selectById(job.getId()); + assertEquals(JobStatusEnum.STOP.getStatus(), updateJob.getStatus()); // 校验调用 verify(schedulerManager, times(1)).pauseJob(eq(job.getHandlerName())); } @@ -180,16 +169,16 @@ public class InfJobServiceTest extends BaseDbUnitTest { @Test public void testUpdateJobStatus_StopToNormal_success() throws SchedulerException { // mock 数据 - InfJobCreateReqVO createReqVO = randomPojo(InfJobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); - InfJobDO job = InfJobConvert.INSTANCE.convert(createReqVO); - job.setStatus(InfJobStatusEnum.STOP.getStatus()); + JobCreateReqVO createReqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); + JobDO job = JobConvert.INSTANCE.convert(createReqVO); + job.setStatus(JobStatusEnum.STOP.getStatus()); fillJobMonitorTimeoutEmpty(job); jobMapper.insert(job); // 调用 - jobService.updateJobStatus(job.getId(), InfJobStatusEnum.NORMAL.getStatus()); + jobService.updateJobStatus(job.getId(), JobStatusEnum.NORMAL.getStatus()); // 校验记录的属性是否正确 - InfJobDO updateJob = jobMapper.selectById(job.getId()); - assertEquals(InfJobStatusEnum.NORMAL.getStatus(), updateJob.getStatus()); + JobDO updateJob = jobMapper.selectById(job.getId()); + assertEquals(JobStatusEnum.NORMAL.getStatus(), updateJob.getStatus()); // 校验调用 verify(schedulerManager, times(1)).resumeJob(eq(job.getHandlerName())); } @@ -197,9 +186,9 @@ public class InfJobServiceTest extends BaseDbUnitTest { @Test public void testTriggerJob_success() throws SchedulerException { // mock 数据 - InfJobCreateReqVO createReqVO = randomPojo(InfJobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); - InfJobDO job = InfJobConvert.INSTANCE.convert(createReqVO); - job.setStatus(InfJobStatusEnum.NORMAL.getStatus()); + JobCreateReqVO createReqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); + JobDO job = JobConvert.INSTANCE.convert(createReqVO); + job.setStatus(JobStatusEnum.NORMAL.getStatus()); fillJobMonitorTimeoutEmpty(job); jobMapper.insert(job); // 调用 @@ -211,9 +200,9 @@ public class InfJobServiceTest extends BaseDbUnitTest { @Test public void testDeleteJob_success() throws SchedulerException { // mock 数据 - InfJobCreateReqVO createReqVO = randomPojo(InfJobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); - InfJobDO job = InfJobConvert.INSTANCE.convert(createReqVO); - job.setStatus(InfJobStatusEnum.NORMAL.getStatus()); + JobCreateReqVO createReqVO = randomPojo(JobCreateReqVO.class, o -> o.setCronExpression("0 0/1 * * * ? *")); + JobDO job = JobConvert.INSTANCE.convert(createReqVO); + job.setStatus(JobStatusEnum.NORMAL.getStatus()); fillJobMonitorTimeoutEmpty(job); jobMapper.insert(job); // 调用 UPDATE inf_job SET deleted=1 WHERE id=? AND deleted=0 @@ -227,19 +216,19 @@ public class InfJobServiceTest extends BaseDbUnitTest { @Test public void testGetJobListByIds_success() { // mock 数据 - InfJobDO dbJob = randomPojo(InfJobDO.class, o -> { - o.setStatus(randomEle(InfJobStatusEnum.values()).getStatus()); // 保证 status 的范围 + JobDO dbJob = randomPojo(JobDO.class, o -> { + o.setStatus(randomEle(JobStatusEnum.values()).getStatus()); // 保证 status 的范围 }); - InfJobDO cloneJob = ObjectUtils.cloneIgnoreId(dbJob, o -> o.setHandlerName(randomString())); + JobDO cloneJob = ObjectUtils.cloneIgnoreId(dbJob, o -> o.setHandlerName(randomString())); jobMapper.insert(dbJob); // 测试 handlerName 不匹配 jobMapper.insert(cloneJob); // 准备参数 - ArrayList ids = new ArrayList<>(); + ArrayList ids = new ArrayList<>(); ids.add(dbJob.getId()); ids.add(cloneJob.getId()); // 调用 - List list = jobService.getJobList(ids); + List list = jobService.getJobList(ids); // 断言 assertEquals(2, list.size()); assertPojoEquals(dbJob, list.get(0)); @@ -248,25 +237,25 @@ public class InfJobServiceTest extends BaseDbUnitTest { @Test public void testGetJobPage_success() { // mock 数据 - InfJobDO dbJob = randomPojo(InfJobDO.class, o -> { + JobDO dbJob = randomPojo(JobDO.class, o -> { o.setName("定时任务测试"); o.setHandlerName("handlerName 单元测试"); - o.setStatus(InfJobStatusEnum.INIT.getStatus()); + o.setStatus(JobStatusEnum.INIT.getStatus()); }); jobMapper.insert(dbJob); // 测试 name 不匹配 jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setName("土豆"))); // 测试 status 不匹配 - jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setStatus(InfJobStatusEnum.NORMAL.getStatus()))); + jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setStatus(JobStatusEnum.NORMAL.getStatus()))); // 测试 handlerName 不匹配 jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setHandlerName(randomString()))); // 准备参数 - InfJobPageReqVO reqVo = new InfJobPageReqVO(); + JobPageReqVO reqVo = new JobPageReqVO(); reqVo.setName("定时"); - reqVo.setStatus(InfJobStatusEnum.INIT.getStatus()); + reqVo.setStatus(JobStatusEnum.INIT.getStatus()); reqVo.setHandlerName("单元"); // 调用 - PageResult pageResult = jobService.getJobPage(reqVo); + PageResult pageResult = jobService.getJobPage(reqVo); // 断言 assertEquals(1, pageResult.getTotal()); assertEquals(1, pageResult.getList().size()); @@ -276,31 +265,31 @@ public class InfJobServiceTest extends BaseDbUnitTest { @Test public void testGetJobListForExport_success() { // mock 数据 - InfJobDO dbJob = randomPojo(InfJobDO.class, o -> { + JobDO dbJob = randomPojo(JobDO.class, o -> { o.setName("定时任务测试"); o.setHandlerName("handlerName 单元测试"); - o.setStatus(InfJobStatusEnum.INIT.getStatus()); + o.setStatus(JobStatusEnum.INIT.getStatus()); }); jobMapper.insert(dbJob); // 测试 name 不匹配 jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setName("土豆"))); // 测试 status 不匹配 - jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setStatus(InfJobStatusEnum.NORMAL.getStatus()))); + jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setStatus(JobStatusEnum.NORMAL.getStatus()))); // 测试 handlerName 不匹配 jobMapper.insert(ObjectUtils.cloneIgnoreId(dbJob, o -> o.setHandlerName(randomString()))); // 准备参数 - InfJobExportReqVO reqVo = new InfJobExportReqVO(); + JobExportReqVO reqVo = new JobExportReqVO(); reqVo.setName("定时"); - reqVo.setStatus(InfJobStatusEnum.INIT.getStatus()); + reqVo.setStatus(JobStatusEnum.INIT.getStatus()); reqVo.setHandlerName("单元"); // 调用 - List list = jobService.getJobList(reqVo); + List list = jobService.getJobList(reqVo); // 断言 assertEquals(1, list.size()); assertPojoEquals(dbJob, list.get(0)); } - private static void fillJobMonitorTimeoutEmpty(InfJobDO job) { + private static void fillJobMonitorTimeoutEmpty(JobDO job) { if (job.getMonitorTimeout() == null) { job.setMonitorTimeout(0); } diff --git a/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/logger/InfApiAccessLogServiceImplTest.java b/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogServiceImplTest.java similarity index 54% rename from yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/logger/InfApiAccessLogServiceImplTest.java rename to yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogServiceImplTest.java index 86e2fa9dd..0b1b3d932 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/logger/InfApiAccessLogServiceImplTest.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/logger/ApiAccessLogServiceImplTest.java @@ -1,16 +1,17 @@ package cn.iocoder.yudao.module.infra.service.logger; -import cn.iocoder.yudao.adminserver.BaseDbUnitTest; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiAccessLogDO; +import cn.hutool.core.util.RandomUtil; +import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiAccessLogCreateReqDTO; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants; import cn.iocoder.yudao.framework.common.pojo.PageResult; -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogExportReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.InfApiAccessLogPageReqVO; -import cn.iocoder.yudao.module.infra.dal.mysql.logger.InfApiAccessLogMapper; -import cn.iocoder.yudao.module.infra.service.logger.impl.InfApiAccessLogServiceImpl; -import cn.iocoder.yudao.framework.test.core.util.RandomUtils; import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; +import cn.iocoder.yudao.framework.test.core.util.RandomUtils; +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogExportReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apiaccesslog.ApiAccessLogPageReqVO; +import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiAccessLogDO; +import cn.iocoder.yudao.module.infra.dal.mysql.logger.ApiAccessLogMapper; +import cn.iocoder.yudao.module.infra.test.BaseDbUnitTest; import org.junit.jupiter.api.Test; import org.springframework.context.annotation.Import; @@ -18,22 +19,19 @@ import javax.annotation.Resource; import java.util.Date; import java.util.List; -import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; import static cn.iocoder.yudao.framework.common.util.date.DateUtils.buildTime; +import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertNotNull; -/** - * {@link InfApiAccessLogServiceImpl} 单元测试 - */ -@Import(InfApiAccessLogServiceImpl.class) -public class InfApiAccessLogServiceImplTest extends BaseDbUnitTest { +@Import(ApiAccessLogServiceImpl.class) +public class ApiAccessLogServiceImplTest extends BaseDbUnitTest { @Resource - private InfApiAccessLogService infApiAccessLogServiceImpl; + private ApiAccessLogService apiAccessLogService; @Resource - private InfApiAccessLogMapper infApiAccessLogMapper; + private ApiAccessLogMapper apiAccessLogMapper; @Test public void testGetApiAccessLogPage() { @@ -46,7 +44,7 @@ public class InfApiAccessLogServiceImplTest extends BaseDbUnitTest { int duration = 1000; int resultCode = GlobalErrorCodeConstants.SUCCESS.getCode(); - InfApiAccessLogDO infApiAccessLogDO = RandomUtils.randomPojo(InfApiAccessLogDO.class, dto -> { + ApiAccessLogDO infApiAccessLogDO = RandomUtils.randomPojo(ApiAccessLogDO.class, dto -> { dto.setUserId(userId); dto.setUserType(userType); dto.setApplicationName(applicationName); @@ -55,26 +53,26 @@ public class InfApiAccessLogServiceImplTest extends BaseDbUnitTest { dto.setDuration(duration); dto.setResultCode(resultCode); }); - infApiAccessLogMapper.insert(infApiAccessLogDO); + apiAccessLogMapper.insert(infApiAccessLogDO); // 下面几个都是不匹配的数据 // userId 不同的 - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setUserId(3344L))); + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setUserId(3344L))); // userType - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setUserType(UserTypeEnum.MEMBER.getValue()))); + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setUserType(UserTypeEnum.MEMBER.getValue()))); // applicationName 不同的 - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setApplicationName("test"))); + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setApplicationName("test"))); // requestUrl 不同的 - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setRequestUrl("bar"))); + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setRequestUrl("bar"))); // 构造一个早期时间 2021-02-06 00:00:00 - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setBeginTime(buildTime(2021, 2, 6)))); + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setBeginTime(buildTime(2021, 2, 6)))); // duration 不同的 - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setDuration(100))); + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setDuration(100))); // resultCode 不同的 - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setResultCode(2))); + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setResultCode(2))); // 构造调用参数 - InfApiAccessLogPageReqVO reqVO = new InfApiAccessLogPageReqVO(); + ApiAccessLogPageReqVO reqVO = new ApiAccessLogPageReqVO(); reqVO.setUserId(userId); reqVO.setUserType(userType); reqVO.setApplicationName(applicationName); @@ -85,7 +83,7 @@ public class InfApiAccessLogServiceImplTest extends BaseDbUnitTest { reqVO.setResultCode(resultCode); // 调用service方法 - PageResult pageResult = infApiAccessLogServiceImpl.getApiAccessLogPage(reqVO); + PageResult pageResult = apiAccessLogService.getApiAccessLogPage(reqVO); // 断言,只查到了一条符合条件的 assertEquals(1, pageResult.getTotal()); @@ -104,7 +102,7 @@ public class InfApiAccessLogServiceImplTest extends BaseDbUnitTest { int duration = 1000; int resultCode = GlobalErrorCodeConstants.SUCCESS.getCode(); - InfApiAccessLogDO infApiAccessLogDO = RandomUtils.randomPojo(InfApiAccessLogDO.class, dto -> { + ApiAccessLogDO infApiAccessLogDO = RandomUtils.randomPojo(ApiAccessLogDO.class, dto -> { dto.setUserId(userId); dto.setUserType(userType); dto.setApplicationName(applicationName); @@ -113,26 +111,26 @@ public class InfApiAccessLogServiceImplTest extends BaseDbUnitTest { dto.setDuration(duration); dto.setResultCode(resultCode); }); - infApiAccessLogMapper.insert(infApiAccessLogDO); + apiAccessLogMapper.insert(infApiAccessLogDO); // 下面几个都是不匹配的数据 // userId 不同的 - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setUserId(3344L))); + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setUserId(3344L))); // userType - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setUserType(UserTypeEnum.MEMBER.getValue()))); + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setUserType(UserTypeEnum.MEMBER.getValue()))); // applicationName 不同的 - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setApplicationName("test"))); + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setApplicationName("test"))); // requestUrl 不同的 - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setRequestUrl("bar"))); + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setRequestUrl("bar"))); // 构造一个早期时间 2021-02-06 00:00:00 - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setBeginTime(buildTime(2021, 2, 6)))); + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setBeginTime(buildTime(2021, 2, 6)))); // duration 不同的 - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setDuration(100))); + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setDuration(100))); // resultCode 不同的 - infApiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setResultCode(2))); + apiAccessLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiAccessLogDO, logDO -> logDO.setResultCode(2))); // 构造调用参数 - InfApiAccessLogExportReqVO reqVO = new InfApiAccessLogExportReqVO(); + ApiAccessLogExportReqVO reqVO = new ApiAccessLogExportReqVO(); reqVO.setUserId(userId); reqVO.setUserType(userType); reqVO.setApplicationName(applicationName); @@ -143,11 +141,26 @@ public class InfApiAccessLogServiceImplTest extends BaseDbUnitTest { reqVO.setResultCode(resultCode); // 调用service方法 - List list = infApiAccessLogServiceImpl.getApiAccessLogList(reqVO); + List list = apiAccessLogService.getApiAccessLogList(reqVO); // 断言,只查到了一条符合条件的 assertEquals(1, list.size()); assertPojoEquals(infApiAccessLogDO, list.get(0)); } + @Test + public void testCreateApiAccessLogAsync() { + // 准备参数 + ApiAccessLogCreateReqDTO createDTO = RandomUtils.randomPojo(ApiAccessLogCreateReqDTO.class, + dto -> dto.setUserType(RandomUtil.randomEle(UserTypeEnum.values()).getValue())); + + // 调用 + apiAccessLogService.createApiAccessLogAsync(createDTO); + // 断言 + ApiAccessLogDO infApiAccessLogDO = apiAccessLogMapper.selectOne(null); + assertNotNull(infApiAccessLogDO); + assertPojoEquals(createDTO, infApiAccessLogDO); + } + + } diff --git a/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/logger/InfApiErrorLogServiceImplTest.java b/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImplTest.java similarity index 65% rename from yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/logger/InfApiErrorLogServiceImplTest.java rename to yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImplTest.java index 89081277a..9b24d5987 100644 --- a/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/logger/InfApiErrorLogServiceImplTest.java +++ b/yudao-module-infra/yudao-module-infra-impl/src/test/java/cn/iocoder/yudao/module/infra/service/logger/ApiErrorLogServiceImplTest.java @@ -1,16 +1,17 @@ package cn.iocoder.yudao.module.infra.service.logger; -import cn.iocoder.yudao.adminserver.BaseDbUnitTest; -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogExportReqVO; -import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.InfApiErrorLogPageReqVO; -import cn.iocoder.yudao.module.infra.dal.mysql.logger.InfApiErrorLogMapper; -import cn.iocoder.yudao.module.infra.enums.logger.InfApiErrorLogProcessStatusEnum; -import cn.iocoder.yudao.module.infra.service.logger.impl.InfApiErrorLogServiceImpl; -import cn.iocoder.yudao.coreservice.modules.infra.dal.dataobject.logger.InfApiErrorLogDO; +import cn.hutool.core.util.RandomUtil; +import cn.iocoder.yudao.framework.apilog.core.service.dto.ApiErrorLogCreateReqDTO; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.pojo.PageResult; import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; import cn.iocoder.yudao.framework.test.core.util.RandomUtils; +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogExportReqVO; +import cn.iocoder.yudao.module.infra.controller.admin.logger.vo.apierrorlog.ApiErrorLogPageReqVO; +import cn.iocoder.yudao.module.infra.dal.dataobject.logger.ApiErrorLogDO; +import cn.iocoder.yudao.module.infra.dal.mysql.logger.ApiErrorLogMapper; +import cn.iocoder.yudao.module.infra.enums.logger.ApiErrorLogProcessStatusEnum; +import cn.iocoder.yudao.module.infra.test.BaseDbUnitTest; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.springframework.context.annotation.Import; @@ -19,24 +20,22 @@ import javax.annotation.Resource; import java.util.Date; import java.util.List; -import static cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants.API_ERROR_LOG_NOT_FOUND; -import static cn.iocoder.yudao.module.infra.enums.InfErrorCodeConstants.API_ERROR_LOG_PROCESSED; 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.AssertUtils.assertServiceException; +import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.API_ERROR_LOG_NOT_FOUND; +import static cn.iocoder.yudao.module.infra.enums.ErrorCodeConstants.API_ERROR_LOG_PROCESSED; import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; -/** - * {@link InfApiErrorLogServiceImpl} 单元测试 - */ -@Import(InfApiErrorLogServiceImpl.class) -public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { +@Import(ApiErrorLogServiceImpl.class) +public class ApiErrorLogServiceImplTest extends BaseDbUnitTest { @Resource - private InfApiErrorLogService infApiErrorLogServiceImpl; + private ApiErrorLogServiceImpl apiErrorLogService; @Resource - private InfApiErrorLogMapper infApiErrorLogMapper; + private ApiErrorLogMapper infApiErrorLogMapper; @Test public void testGetApiErrorLogPage() { @@ -46,9 +45,9 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { String applicationName = "yudao-test"; String requestUrl = "foo"; Date beginTime = buildTime(2021, 3, 13); - int progressStatus = InfApiErrorLogProcessStatusEnum.INIT.getStatus(); + int progressStatus = ApiErrorLogProcessStatusEnum.INIT.getStatus(); - InfApiErrorLogDO infApiErrorLogDO = RandomUtils.randomPojo(InfApiErrorLogDO.class, logDO -> { + ApiErrorLogDO infApiErrorLogDO = RandomUtils.randomPojo(ApiErrorLogDO.class, logDO -> { logDO.setUserId(userId); logDO.setUserType(userType); logDO.setApplicationName(applicationName); @@ -70,10 +69,10 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { // 构造一个早期时间 2021-02-06 00:00:00 infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setExceptionTime(buildTime(2021, 2, 6)))); // progressStatus 不同的 - infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setProcessStatus(InfApiErrorLogProcessStatusEnum.DONE.getStatus()))); + infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setProcessStatus(ApiErrorLogProcessStatusEnum.DONE.getStatus()))); // 构造调用参数 - InfApiErrorLogPageReqVO reqVO = new InfApiErrorLogPageReqVO(); + ApiErrorLogPageReqVO reqVO = new ApiErrorLogPageReqVO(); reqVO.setUserId(userId); reqVO.setUserType(userType); reqVO.setApplicationName(applicationName); @@ -83,7 +82,7 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { reqVO.setProcessStatus(progressStatus); // 调用service方法 - PageResult pageResult = infApiErrorLogServiceImpl.getApiErrorLogPage(reqVO); + PageResult pageResult = apiErrorLogService.getApiErrorLogPage(reqVO); // 断言,只查到了一条符合条件的 assertEquals(1, pageResult.getTotal()); @@ -99,9 +98,9 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { String applicationName = "yudao-test"; String requestUrl = "foo"; Date beginTime = buildTime(2021, 3, 13); - int progressStatus = InfApiErrorLogProcessStatusEnum.INIT.getStatus(); + int progressStatus = ApiErrorLogProcessStatusEnum.INIT.getStatus(); - InfApiErrorLogDO infApiErrorLogDO = RandomUtils.randomPojo(InfApiErrorLogDO.class, logDO -> { + ApiErrorLogDO infApiErrorLogDO = RandomUtils.randomPojo(ApiErrorLogDO.class, logDO -> { logDO.setUserId(userId); logDO.setUserType(userType); logDO.setApplicationName(applicationName); @@ -123,10 +122,10 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { // 构造一个早期时间 2021-02-06 00:00:00 infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setExceptionTime(buildTime(2021, 2, 6)))); // progressStatus 不同的 - infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setProcessStatus(InfApiErrorLogProcessStatusEnum.DONE.getStatus()))); + infApiErrorLogMapper.insert(ObjectUtils.cloneIgnoreId(infApiErrorLogDO, logDO -> logDO.setProcessStatus(ApiErrorLogProcessStatusEnum.DONE.getStatus()))); // 构造调用参数 - InfApiErrorLogExportReqVO reqVO = new InfApiErrorLogExportReqVO(); + ApiErrorLogExportReqVO reqVO = new ApiErrorLogExportReqVO(); reqVO.setUserId(userId); reqVO.setUserType(userType); reqVO.setApplicationName(applicationName); @@ -136,7 +135,7 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { reqVO.setProcessStatus(progressStatus); // 调用service方法 - List list = infApiErrorLogServiceImpl.getApiErrorLogList(reqVO); + List list = apiErrorLogService.getApiErrorLogList(reqVO); // 断言,只查到了一条符合条件的 assertEquals(1, list.size()); @@ -144,22 +143,23 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { } + // TODO 芋艿:单元测试,可以拆小一点 @Test public void testUpdateApiErrorLogProcess() { // 先构造两条数据,第一条用于抛出异常,第二条用于正常的执行update操作 Long processUserId = 2233L; - InfApiErrorLogDO first = RandomUtils.randomPojo(InfApiErrorLogDO.class, logDO -> { + ApiErrorLogDO first = RandomUtils.randomPojo(ApiErrorLogDO.class, logDO -> { logDO.setProcessUserId(processUserId); logDO.setUserType(UserTypeEnum.ADMIN.getValue()); - logDO.setProcessStatus(InfApiErrorLogProcessStatusEnum.DONE.getStatus()); + logDO.setProcessStatus(ApiErrorLogProcessStatusEnum.DONE.getStatus()); }); infApiErrorLogMapper.insert(first); - InfApiErrorLogDO second = RandomUtils.randomPojo(InfApiErrorLogDO.class, logDO -> { + ApiErrorLogDO second = RandomUtils.randomPojo(ApiErrorLogDO.class, logDO -> { logDO.setProcessUserId(1122L); logDO.setUserType(UserTypeEnum.ADMIN.getValue()); - logDO.setProcessStatus(InfApiErrorLogProcessStatusEnum.INIT.getStatus()); + logDO.setProcessStatus(ApiErrorLogProcessStatusEnum.INIT.getStatus()); }); infApiErrorLogMapper.insert(second); @@ -167,17 +167,31 @@ public class InfApiErrorLogServiceImplTest extends BaseDbUnitTest { Long secondId = second.getId(); // 执行正常的 update 操作 - infApiErrorLogServiceImpl.updateApiErrorLogProcess(secondId, InfApiErrorLogProcessStatusEnum.DONE.getStatus(), processUserId); - InfApiErrorLogDO secondSelect = infApiErrorLogMapper.selectOne("id", secondId); + apiErrorLogService.updateApiErrorLogProcess(secondId, ApiErrorLogProcessStatusEnum.DONE.getStatus(), processUserId); + ApiErrorLogDO secondSelect = infApiErrorLogMapper.selectOne("id", secondId); // id 为 0 查询不到,应该抛出异常 API_ERROR_LOG_NOT_FOUND - assertServiceException(() -> infApiErrorLogServiceImpl.updateApiErrorLogProcess(0L, InfApiErrorLogProcessStatusEnum.DONE.getStatus(), processUserId), API_ERROR_LOG_NOT_FOUND); + assertServiceException(() -> apiErrorLogService.updateApiErrorLogProcess(0L, ApiErrorLogProcessStatusEnum.DONE.getStatus(), processUserId), API_ERROR_LOG_NOT_FOUND); // id 为 first 的 progressStatus 为 DONE ,应该抛出 API_ERROR_LOG_PROCESSED - assertServiceException(() -> infApiErrorLogServiceImpl.updateApiErrorLogProcess(firstId, InfApiErrorLogProcessStatusEnum.DONE.getStatus(), processUserId), API_ERROR_LOG_PROCESSED); + assertServiceException(() -> apiErrorLogService.updateApiErrorLogProcess(firstId, ApiErrorLogProcessStatusEnum.DONE.getStatus(), processUserId), API_ERROR_LOG_PROCESSED); // 验证 progressStatus 是否修改成功 - Assertions.assertEquals(InfApiErrorLogProcessStatusEnum.DONE.getStatus(), secondSelect.getProcessStatus()); + Assertions.assertEquals(ApiErrorLogProcessStatusEnum.DONE.getStatus(), secondSelect.getProcessStatus()); // 验证 progressUserId 是否修改成功 Assertions.assertEquals(processUserId, secondSelect.getProcessUserId()); } + @Test + public void testCreateApiErrorLogAsync() { + // 准备参数 + ApiErrorLogCreateReqDTO createDTO = RandomUtils.randomPojo(ApiErrorLogCreateReqDTO.class, + dto -> dto.setUserType(RandomUtil.randomEle(UserTypeEnum.values()).getValue())); + + // 调用 + apiErrorLogService.createApiErrorLogAsync(createDTO); + // 断言 + ApiErrorLogDO infApiErrorLogDO = infApiErrorLogMapper.selectOne(null); + assertNotNull(infApiErrorLogDO); + assertPojoEquals(createDTO, infApiErrorLogDO); + } + } diff --git a/yudao-module-infra/yudao-module-infra-impl/src/test/resources/application-unit-test.yaml b/yudao-module-infra/yudao-module-infra-impl/src/test/resources/application-unit-test.yaml new file mode 100644 index 000000000..6f83b473a --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-impl/src/test/resources/application-unit-test.yaml @@ -0,0 +1,54 @@ +spring: + main: + lazy-initialization: true # 开启懒加载,加快速度 + banner-mode: off # 单元测试,禁用 Banner + +--- #################### 数据库相关配置 #################### + +spring: + # 数据源配置项 + datasource: + name: ruoyi-vue-pro + url: jdbc:h2:mem:testdb;MODE=MYSQL;DATABASE_TO_UPPER=false; # MODE 使用 MySQL 模式;DATABASE_TO_UPPER 配置表和字段使用小写 + driver-class-name: org.h2.Driver + username: sa + password: + schema: classpath:sql/create_tables.sql # MySQL 转 H2 的语句,使用 https://www.jooq.org/translate/ 工具 + druid: + async-init: true # 单元测试,异步初始化 Druid 连接池,提升启动速度 + initial-size: 1 # 单元测试,配置为 1,提升启动速度 + + # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 + redis: + host: 127.0.0.1 # 地址 + port: 16379 # 端口(单元测试,使用 16379 端口) + database: 0 # 数据库索引 + +mybatis: + lazy-initialization: true # 单元测试,设置 MyBatis Mapper 延迟加载,加速每个单元测试 + +--- #################### 定时任务相关配置 #################### + +--- #################### 配置中心相关配置 #################### + +--- #################### 服务保障相关配置 #################### + +# Lock4j 配置项(单元测试,禁用 Lock4j) + +# Resilience4j 配置项 + +--- #################### 监控相关配置 #################### + +--- #################### 芋道相关配置 #################### + +# 芋道配置项,设置当前项目所有自定义的配置 +yudao: + info: + base-package: cn.iocoder.yudao.module.member.dal.mysql + base-package2: cn.iocoder.yudao.module + core-service: + base-package: cn.iocoder.yudao.module.member.dal.mysql # TODO 芋艿:要清理掉 + captcha: + timeout: 5m + width: 160 + height: 60 diff --git a/yudao-module-infra/yudao-module-infra-impl/src/test/resources/logback-spring.xml b/yudao-module-infra/yudao-module-infra-impl/src/test/resources/logback-spring.xml new file mode 100644 index 000000000..daf756bff --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-impl/src/test/resources/logback-spring.xml @@ -0,0 +1,4 @@ + + + + diff --git a/yudao-module-infra/yudao-module-infra-impl/src/test/resources/sql/clean.sql b/yudao-module-infra/yudao-module-infra-impl/src/test/resources/sql/clean.sql new file mode 100644 index 000000000..edf0e8ddf --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-impl/src/test/resources/sql/clean.sql @@ -0,0 +1,6 @@ +DELETE FROM "infra_config"; +DELETE FROM "infra_file"; +DELETE FROM "infra_job"; +DELETE FROM "infra_job_log"; +DELETE FROM "infra_api_access_log"; +DELETE FROM "infra_api_error_log"; diff --git a/yudao-module-infra/yudao-module-infra-impl/src/test/resources/sql/create_tables.sql b/yudao-module-infra/yudao-module-infra-impl/src/test/resources/sql/create_tables.sql new file mode 100644 index 000000000..2ec26d220 --- /dev/null +++ b/yudao-module-infra/yudao-module-infra-impl/src/test/resources/sql/create_tables.sql @@ -0,0 +1,67 @@ + +CREATE TABLE IF NOT EXISTS "infra_config" ( + "id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY, + "group" varchar(50) NOT NULL, + "type" tinyint NOT NULL, + "name" varchar(100) NOT NULL DEFAULT '', + "key" varchar(100) NOT NULL DEFAULT '', + "value" varchar(500) NOT NULL DEFAULT '', + "sensitive" bit NOT NULL, + "remark" varchar(500) DEFAULT NULL, + "creator" varchar(64) DEFAULT '', + "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updater" varchar(64) DEFAULT '', + "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + "deleted" bit NOT NULL DEFAULT FALSE, + PRIMARY KEY ("id") + ) COMMENT '参数配置表'; + +CREATE TABLE IF NOT EXISTS "infra_file" ( + "id" varchar(188) NOT NULL, + "type" varchar(63) DEFAULT NULL, + "content" blob NOT NULL, + "creator" varchar(64) DEFAULT '', + "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + "updater" varchar(64) DEFAULT '', + "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, + "deleted" bit NOT NULL DEFAULT FALSE, + "tenant_id" bigint not null default '0', + PRIMARY KEY ("id") + ) COMMENT '文件表'; + +CREATE TABLE IF NOT EXISTS "infra_job" ( + "id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '任务编号', + "name" varchar(32) NOT NULL COMMENT '任务名称', + "status" tinyint(4) NOT NULL COMMENT '任务状态', + "handler_name" varchar(64) NOT NULL COMMENT '处理器的名字', + "handler_param" varchar(255) DEFAULT NULL COMMENT '处理器的参数', + "cron_expression" varchar(32) NOT NULL COMMENT 'CRON 表达式', + "retry_count" int(11) NOT NULL DEFAULT '0' COMMENT '重试次数', + "retry_interval" int(11) NOT NULL DEFAULT '0' COMMENT '重试间隔', + "monitor_timeout" int(11) NOT NULL DEFAULT '0' COMMENT '监控超时时间', + "creator" varchar(64) DEFAULT '' COMMENT '创建者', + "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + "updater" varchar(64) DEFAULT '' COMMENT '更新者', + "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + "deleted" bit NOT NULL DEFAULT FALSE COMMENT '是否删除', + PRIMARY KEY ("id") + ) COMMENT='定时任务表'; + +CREATE TABLE IF NOT EXISTS "infra_job_log" ( + "id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY COMMENT '日志编号', + "job_id" bigint(20) NOT NULL COMMENT '任务编号', + "handler_name" varchar(64) NOT NULL COMMENT '处理器的名字', + "handler_param" varchar(255) DEFAULT NULL COMMENT '处理器的参数', + "execute_index" tinyint(4) NOT NULL DEFAULT '1' COMMENT '第几次执行', + "begin_time" datetime NOT NULL COMMENT '开始执行时间', + "end_time" datetime DEFAULT NULL COMMENT '结束执行时间', + "duration" int(11) DEFAULT NULL COMMENT '执行时长', + "status" tinyint(4) NOT NULL COMMENT '任务状态', + "result" varchar(4000) DEFAULT '' COMMENT '结果数据', + "creator" varchar(64) DEFAULT '' COMMENT '创建者', + "create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + "updater" varchar(64) DEFAULT '' COMMENT '更新者', + "update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + "deleted" bit(1) NOT NULL DEFAULT FALSE COMMENT '是否删除', + PRIMARY KEY ("id") + )COMMENT='定时任务日志表'; diff --git a/yudao-module-member/yudao-module-member-impl/pom.xml b/yudao-module-member/yudao-module-member-impl/pom.xml index d3b6bd7ee..9307d30d4 100644 --- a/yudao-module-member/yudao-module-member-impl/pom.xml +++ b/yudao-module-member/yudao-module-member-impl/pom.xml @@ -23,28 +23,30 @@ yudao-module-member-api ${revision} - cn.iocoder.boot yudao-module-system-api ${revision} + + cn.iocoder.boot + yudao-module-infra-api + ${revision} + - - cn.iocoder.boot - yudao-core-service - - cn.iocoder.boot yudao-spring-boot-starter-biz-operatelog - cn.iocoder.boot yudao-spring-boot-starter-biz-weixin + + cn.iocoder.boot + yudao-spring-boot-starter-biz-tenant + diff --git a/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java b/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java index 625daf878..ad12b40a6 100644 --- a/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java +++ b/yudao-module-member/yudao-module-member-impl/src/main/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImpl.java @@ -2,8 +2,8 @@ package cn.iocoder.yudao.module.member.service.user; import cn.hutool.core.io.IoUtil; import cn.hutool.core.util.IdUtil; -import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; +import cn.iocoder.yudao.module.infra.api.file.FileApi; import cn.iocoder.yudao.module.member.controller.app.user.vo.AppUserUpdateMobileReqVO; import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO; import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper; @@ -39,7 +39,7 @@ public class MemberUserServiceImpl implements MemberUserService { private MemberUserMapper memberUserMapper; @Resource - private InfFileCoreService fileCoreService; + private FileApi fileApi; @Resource private SmsCodeApi smsCodeApi; @@ -103,7 +103,7 @@ public class MemberUserServiceImpl implements MemberUserService { public String updateUserAvatar(Long userId, InputStream avatarFile) { this.checkUserExists(userId); // 创建文件 - String avatar = fileCoreService.createFile(IdUtil.fastUUID(), IoUtil.readBytes(avatarFile)); + String avatar = fileApi.createFile(IoUtil.readBytes(avatarFile)); // 更新头像路径 memberUserMapper.updateById(MemberUserDO.builder().id(userId).avatar(avatar).build()); return avatar; diff --git a/yudao-module-member/yudao-module-member-impl/src/test/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImplTest.java b/yudao-module-member/yudao-module-member-impl/src/test/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImplTest.java index f470e95ae..46d72091c 100644 --- a/yudao-module-member/yudao-module-member-impl/src/test/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImplTest.java +++ b/yudao-module-member/yudao-module-member-impl/src/test/java/cn/iocoder/yudao/module/member/service/user/MemberUserServiceImplTest.java @@ -1,10 +1,10 @@ package cn.iocoder.yudao.module.member.service.user; import cn.hutool.core.util.RandomUtil; -import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService; 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; +import cn.iocoder.yudao.module.infra.api.file.FileApi; import cn.iocoder.yudao.module.member.controller.app.user.vo.AppUserUpdateMobileReqVO; import cn.iocoder.yudao.module.member.dal.dataobject.user.MemberUserDO; import cn.iocoder.yudao.module.member.dal.mysql.user.MemberUserMapper; @@ -48,14 +48,13 @@ public class MemberUserServiceImplTest extends BaseDbAndRedisUnitTest { @MockBean private MemberAuthServiceImpl authService; - @MockBean - private InfFileCoreService fileCoreService; - @MockBean private PasswordEncoder passwordEncoder; @MockBean private SmsCodeApi smsCodeApi; + @MockBean + private FileApi fileApi; @Test public void testUpdateNickName_success(){ @@ -86,7 +85,7 @@ public class MemberUserServiceImplTest extends BaseDbAndRedisUnitTest { ByteArrayInputStream avatarFile = new ByteArrayInputStream(avatarFileBytes); // mock 方法 String avatar = randomString(); - when(fileCoreService.createFile(anyString(), eq(avatarFileBytes))).thenReturn(avatar); + when(fileApi.createFile(eq(avatarFileBytes))).thenReturn(avatar); // 调用 String str = memberUserService.updateUserAvatar(userId, avatarFile); // 断言 diff --git a/yudao-module-member/yudao-module-member-impl/src/test/resources/application-unit-test.yaml b/yudao-module-member/yudao-module-member-impl/src/test/resources/application-unit-test.yaml index 212a9312b..42e5e356d 100644 --- a/yudao-module-member/yudao-module-member-impl/src/test/resources/application-unit-test.yaml +++ b/yudao-module-member/yudao-module-member-impl/src/test/resources/application-unit-test.yaml @@ -45,7 +45,6 @@ mybatis: yudao: info: base-package: cn.iocoder.yudao.module.member.dal.mysql - member-package: cn.iocoder.yudao.module.member # TODO 芋艿:要清理掉 - system-package: cn.iocoder.yudao.module.system # TODO 芋艿:要清理掉 + base-package2: cn.iocoder.yudao.module core-service: base-package: cn.iocoder.yudao.module.member.dal.mysql # TODO 芋艿:要清理掉 diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/enums/DictTypeConstants.java b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/DictTypeConstants.java similarity index 99% rename from yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/enums/DictTypeConstants.java rename to yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/DictTypeConstants.java index 7ae00aa2a..9b73264e1 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/enums/DictTypeConstants.java +++ b/yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/DictTypeConstants.java @@ -15,7 +15,6 @@ public interface DictTypeConstants { String LOGIN_TYPE = "sys_login_type"; // 登录日志的类型 String LOGIN_RESULT = "sys_login_result"; // 登录结果 - String SMS_CHANNEL_CODE = "sys_sms_channel_code"; // 短信渠道编码 String SMS_TEMPLATE_TYPE = "sys_sms_template_type"; // 短信模板类型 String SMS_SEND_STATUS = "sys_sms_send_status"; // 短信发送状态 diff --git a/yudao-module-system/yudao-module-system-impl/pom.xml b/yudao-module-system/yudao-module-system-impl/pom.xml index 40f9d8aaa..ecf9d967f 100644 --- a/yudao-module-system/yudao-module-system-impl/pom.xml +++ b/yudao-module-system/yudao-module-system-impl/pom.xml @@ -28,13 +28,13 @@ yudao-module-member-api ${revision} - - cn.iocoder.boot - yudao-core-service + yudao-module-infra-api + ${revision} + cn.iocoder.boot yudao-spring-boot-starter-biz-operatelog @@ -43,10 +43,22 @@ cn.iocoder.boot yudao-spring-boot-starter-biz-sms + + cn.iocoder.boot + yudao-spring-boot-starter-biz-dict + cn.iocoder.boot yudao-spring-boot-starter-biz-data-permission + + cn.iocoder.boot + yudao-spring-boot-starter-biz-tenant + + + cn.iocoder.boot + yudao-spring-boot-starter-biz-social + diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/common/CaptchaController.http b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/common/CaptchaController.http index 0b1cf854b..2033fac31 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/common/CaptchaController.http +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/controller/admin/common/CaptchaController.http @@ -1,2 +1,3 @@ ### 请求 /captcha/get-image 接口 => 成功 GET {{baseUrl}}/system/captcha/get-image +tenant-id: {{adminTenentId}} diff --git a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java index e150d598d..8f308a0c7 100644 --- a/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java +++ b/yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/user/AdminUserServiceImpl.java @@ -4,11 +4,11 @@ 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.coreservice.modules.infra.service.file.InfFileCoreService; 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.infra.api.file.FileApi; 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.*; @@ -56,8 +56,9 @@ public class AdminUserServiceImpl implements AdminUserService { private PermissionService permissionService; @Resource private PasswordEncoder passwordEncoder; + @Resource - private InfFileCoreService fileService; + private FileApi fileApi; @Override public Long createUser(UserCreateReqVO reqVO) { @@ -111,7 +112,7 @@ public class AdminUserServiceImpl implements AdminUserService { public String updateUserAvatar(Long id, InputStream avatarFile) { this.checkUserExists(id); // 存储文件 - String avatar = fileService.createFile(IdUtil.fastUUID(), IoUtil.readBytes(avatarFile)); + String avatar = fileApi.createFile(IoUtil.readBytes(avatarFile)); // 更新路径 AdminUserDO sysUserDO = new AdminUserDO(); sysUserDO.setId(id); 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 ffff7e2bd..0beb281c5 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 @@ -1,13 +1,13 @@ package cn.iocoder.yudao.module.system.service.user; import cn.hutool.core.util.RandomUtil; -import cn.iocoder.yudao.coreservice.modules.infra.service.file.InfFileCoreService; 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.ArrayUtils; import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; +import cn.iocoder.yudao.module.infra.api.file.FileApi; 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.*; @@ -63,7 +63,7 @@ public class UserServiceImplTest extends BaseDbUnitTest { @MockBean private PasswordEncoder passwordEncoder; @MockBean - private InfFileCoreService fileService; + private FileApi fileApi; @Test public void testCreatUser_success() { @@ -182,7 +182,7 @@ public class UserServiceImplTest extends BaseDbUnitTest { ByteArrayInputStream avatarFile = new ByteArrayInputStream(avatarFileBytes); // mock 方法 String avatar = randomString(); - when(fileService.createFile(anyString(), eq(avatarFileBytes))).thenReturn(avatar); + when(fileApi.createFile(eq(avatarFileBytes))).thenReturn(avatar); // 调用 userService.updateUserAvatar(userId, avatarFile); diff --git a/yudao-module-system/yudao-module-system-impl/src/test/resources/application-unit-test.yaml b/yudao-module-system/yudao-module-system-impl/src/test/resources/application-unit-test.yaml index 9164b07e6..6f83b473a 100644 --- a/yudao-module-system/yudao-module-system-impl/src/test/resources/application-unit-test.yaml +++ b/yudao-module-system/yudao-module-system-impl/src/test/resources/application-unit-test.yaml @@ -45,8 +45,7 @@ mybatis: yudao: info: base-package: cn.iocoder.yudao.module.member.dal.mysql - member-package: cn.iocoder.yudao.module.member # TODO 芋艿:要清理掉 - system-package: cn.iocoder.yudao.module.system # TODO 芋艿:要清理掉 + base-package2: cn.iocoder.yudao.module core-service: base-package: cn.iocoder.yudao.module.member.dal.mysql # TODO 芋艿:要清理掉 captcha: diff --git a/更新日志.md b/更新日志.md index 13fc8320b..cf1588515 100644 --- a/更新日志.md +++ b/更新日志.md @@ -27,6 +27,7 @@ *【修复】用户无权限访问 指定 API 时,未返回 FORBIDDEN 结果码 *【修复】定时任务刷新本地缓存时,无租户上线文,导致查询报错 +*【修复】配置中心只加载了删除的配置 ### 🔨 Dependency Upgrades