From 7c8c16663774ef62f5de653a97656cbc82531c14 Mon Sep 17 00:00:00 2001 From: iqudoo Date: Fri, 5 Jun 2026 17:18:53 +0800 Subject: [PATCH] init commit --- .eslintignore | 0 .gitignore | 37 + README.md | 2 + ddl.sql | 151 ++ pom.xml | 388 ++++ ...-mybatis-generator-plugin-1.0-SNAPSHOT.jar | Bin 0 -> 41182 bytes .../java/com/iqudoo/framework/tape/Tape.java | 172 ++ .../base/action/annotation/ActionConfig.java | 33 + .../base/action/annotation/ActionMapping.java | 24 + .../base/action/annotation/ActionRetry.java | 21 + .../tape/base/action/bean/ActionAuthInfo.java | 80 + .../tape/base/action/bean/ActionDocInfo.java | 43 + .../tape/base/action/bean/ActionParam.java | 164 ++ .../base/action/bean/ActionParameter.java | 56 + .../tape/base/action/bean/ActionRequest.java | 101 + .../tape/base/action/bean/ActionResponse.java | 90 + .../action/bean/ActionServletRequest.java | 87 + .../action/bean/ActionServletResponse.java | 17 + .../tape/base/action/bean/ActionState.java | 69 + .../base/action/bean/ActionStateCanRetry.java | 13 + .../base/action/bean/ActionTokenInfo.java | 41 + .../tape/base/action/bean/_Attribute.java | 39 + .../base/action/handler/ActionHandler.java | 169 ++ .../action/handler/DefaultActionHandler.java | 5 + .../action/handler/ProtoActionHandler.java | 7 + .../action/handler/SimpleActionHandler.java | 19 + .../handler/SimpleProtoActionHandler.java | 21 + .../base/action/interfaces/IActionCall.java | 12 + .../action/interfaces/IActionDiscover.java | 15 + .../action/interfaces/IActionDispatch.java | 16 + .../base/action/interfaces/IActionToken.java | 33 + .../annotation/ApiDocActionConfiguration.java | 15 + .../ApiDocControllerConfiguration.java | 21 + .../annotation/ApiDocEnumConfiguration.java | 15 + .../annotation/ApiDocFieldConfiguration.java | 27 + .../tape/base/docs/bean/ApiDocActionInfo.java | 300 +++ .../base/docs/bean/ApiDocControllerInfo.java | 61 + .../tape/base/docs/bean/ApiDocEnumInfo.java | 36 + .../tape/base/docs/interfaces/IDocAction.java | 13 + .../base/docs/interfaces/IDocController.java | 11 + .../tape/base/docs/interfaces/IDocEnum.java | 15 + .../framework/tape/modules/IModuleAsync.java | 12 + .../framework/tape/modules/IModuleCache.java | 18 + .../tape/modules/IModuleCrawler.java | 10 + .../tape/modules/IModuleFactory.java | 51 + .../tape/modules/IModuleFileManager.java | 26 + .../framework/tape/modules/IModuleLock.java | 13 + .../tape/modules/IModuleSession.java | 12 + .../tape/modules/IModuleSetting.java | 382 ++++ .../modules/annotation/FactoryMapping.java | 24 + .../annotation/SettingConfiguration.java | 45 + .../tape/modules/annotation/SettingField.java | 62 + .../tape/modules/asserts/AssertUtil.java | 223 ++ .../tape/modules/asserts/AssertValidator.java | 46 + .../asserts/AssertValidatorArrayEmpty.java | 22 + .../asserts/AssertValidatorListEmpty.java | 24 + .../tape/modules/async/AsyncHandler.java | 19 + .../tape/modules/async/AsyncScheduler.java | 11 + .../framework/tape/modules/cache/Cache.java | 68 + .../tape/modules/cache/CacheKey.java | 52 + .../tape/modules/cache/CacheLoader.java | 22 + .../tape/modules/crawler/Crawler.java | 68 + .../tape/modules/crawler/CrawlerKey.java | 65 + .../tape/modules/crawler/CrawlerLoader.java | 22 + .../framework/tape/modules/crud/JoinUtil.java | 109 + .../framework/tape/modules/crud/PageData.java | 177 ++ .../framework/tape/modules/crud/PageUtil.java | 58 + .../excel/BaseEasyExcelIgnoreError.java | 9 + .../BaseEasyExcelReadAbstractListener.java | 125 ++ .../excel/BaseEasyExcelReadResponse.java | 27 + .../excel/BaseExcelCellWriteHandler.java | 23 + .../excel/BaseExcelHeaderFooterHandler.java | 76 + .../tape/modules/excel/EasyExcelUtil.java | 75 + .../tape/modules/fileManager/FileConfig.java | 79 + .../tape/modules/fileManager/FileInfo.java | 42 + .../framework/tape/modules/proto/Proto.java | 66 + .../tape/modules/proto/ProtoLoader.java | 80 + .../tape/modules/proto/ProtoUtil.java | 78 + .../LongListToStringListSerializer.java | 31 + .../serializer/ToJsonArraySerializer.java | 29 + .../serializer/ToJsonObjSerializer.java | 30 + .../modules/serializer/ToJsonSerializer.java | 37 + .../tape/modules/session/GetSessionParam.java | 33 + .../modules/session/RefreshSessionParam.java | 61 + .../tape/modules/utils/AddressUtil.java | 940 +++++++++ .../tape/modules/utils/ArrayUtil.java | 357 ++++ .../tape/modules/utils/Base64Util.java | 129 ++ .../tape/modules/utils/DateTimeUtil.java | 192 ++ .../tape/modules/utils/DateUtil.java | 192 ++ .../tape/modules/utils/DebounceUtil.java | 96 + .../tape/modules/utils/DecimalUtil.java | 33 + .../tape/modules/utils/DigestUtil.java | 168 ++ .../tape/modules/utils/FileUtil.java | 124 ++ .../tape/modules/utils/HttpUtil.java | 613 ++++++ .../tape/modules/utils/JsonUtil.java | 152 ++ .../framework/tape/modules/utils/LogUtil.java | 156 ++ .../tape/modules/utils/ObjectUtil.java | 12 + .../tape/modules/utils/PatternUtil.java | 78 + .../tape/modules/utils/PerfUtils.java | 170 ++ .../tape/modules/utils/RandomUtil.java | 34 + .../tape/modules/utils/ReflectUtil.java | 115 ++ .../tape/modules/utils/ServletUtil.java | 124 ++ .../tape/modules/utils/SnowflakeUtil.java | 242 +++ .../tape/modules/utils/ThrowableUtil.java | 26 + .../framework/tape/service/ICacheService.java | 19 + .../tape/service/ICrawlerService.java | 13 + .../tape/service/IInterceptorService.java | 16 + .../tape/service/ILauncherService.java | 7 + .../tape/service/ISessionService.java | 12 + .../tape/service/ISettingService.java | 8 + .../framework/tape/service/ITokenService.java | 19 + .../iqudoo/framework/tape/spring/Runner.java | 33 + .../tape/spring/RunnerApplication.java | 162 ++ .../framework/tape/spring/RunnerContext.java | 89 + .../spring/actions/GetActionDetailAction.java | 59 + .../spring/actions/GetActionListAction.java | 78 + .../actions/GetControllerListAction.java | 37 + .../spring/actions/GetEnumDetailAction.java | 57 + .../spring/actions/GetEnumListAction.java | 36 + .../tape/spring/actions/GetNodeIdAction.java | 51 + .../spring/actions/GetNodeInfoAction.java | 63 + .../spring/actions/PingRequestAction.java | 25 + .../spring/actions/RefreshTokenAction.java | 35 + .../annotation/EnableTapeCorsFilter.java | 15 + .../spring/annotation/EnableTapeRunner.java | 52 + .../tape/spring/conf/ConfCorsFilter.java | 27 + .../tape/spring/conf/TapeConfig.java | 14 + .../tape/spring/controller/ApiController.java | 159 ++ .../tape/spring/docs/DocActionImpl.java | 226 +++ .../tape/spring/docs/DocControllerImpl.java | 73 + .../tape/spring/docs/DocEnumImpl.java | 106 + .../tape/spring/impl/ActionCallImpl.java | 377 ++++ .../tape/spring/impl/ActionDiscoverImpl.java | 164 ++ .../tape/spring/impl/ActionDispatchImpl.java | 109 + .../tape/spring/impl/ActionTokenImpl.java | 42 + .../tape/spring/impl/ModuleAsyncImpl.java | 101 + .../tape/spring/impl/ModuleCacheImpl.java | 98 + .../tape/spring/impl/ModuleCrawlerImpl.java | 69 + .../tape/spring/impl/ModuleFactoryImpl.java | 150 ++ .../tape/spring/impl/ModuleLockImpl.java | 53 + .../tape/spring/impl/ModuleSessionImpl.java | 25 + .../tape/spring/impl/ModuleSettingImpl.java | 208 ++ .../com/iqudoo/platform/application/App.java | 26 + .../application/config/AsyncConfig.java | 46 + .../application/config/WebConfig.java | 18 + .../application/constants/BizConstants.java | 21 + .../application/constants/ErrorConstants.java | 16 + .../controller/StaticFileController.java | 338 +++ .../mapper/SystemAdminInfoMapper.java | 100 + .../mapper/SystemAsyncTaskInfoMapper.java | 124 ++ .../mapper/SystemCrawlerCacheDataMapper.java | 124 ++ .../mapper/SystemGlobalCacheMapper.java | 124 ++ .../SystemGlobalFileTransferMapper.java | 100 + .../mapper/SystemGlobalSessionMapper.java | 100 + .../mapper/SystemGlobalSettingMapper.java | 124 ++ .../mapper/SystemGlobalVerifyMapper.java | 100 + .../database/model/SystemAdminInfo.java | 542 +++++ .../model/SystemAdminInfoExample.java | 1386 +++++++++++++ .../database/model/SystemAsyncTaskInfo.java | 830 ++++++++ .../model/SystemAsyncTaskInfoExample.java | 1806 +++++++++++++++++ .../model/SystemCrawlerCacheData.java | 434 ++++ .../model/SystemCrawlerCacheDataExample.java | 1126 ++++++++++ .../database/model/SystemGlobalCache.java | 434 ++++ .../model/SystemGlobalCacheExample.java | 1116 ++++++++++ .../model/SystemGlobalFileTransfer.java | 434 ++++ .../SystemGlobalFileTransferExample.java | 1186 +++++++++++ .../database/model/SystemGlobalSession.java | 506 +++++ .../model/SystemGlobalSessionExample.java | 1326 ++++++++++++ .../database/model/SystemGlobalSetting.java | 398 ++++ .../model/SystemGlobalSettingExample.java | 1066 ++++++++++ .../database/model/SystemGlobalVerify.java | 470 +++++ .../model/SystemGlobalVerifyExample.java | 1246 ++++++++++++ .../ApiSystemAdminInfoCreateAction.java | 37 + .../ApiSystemAdminInfoDeleteAction.java | 36 + .../ApiSystemAdminInfoDetailAction.java | 37 + .../ApiSystemAdminInfoListAction.java | 39 + .../ApiSystemAdminInfoRecoverAction.java | 36 + .../ApiSystemAdminInfoUpdateAction.java | 36 + ...SystemAdminInfoAuthEditPasswordAction.java | 36 + ...iSystemAdminInfoAuthEditProfileAction.java | 36 + .../ApiSystemAdminInfoAuthLoginAction.java | 29 + .../ApiSystemAdminInfoAuthProfileAction.java | 39 + .../ApiSystemAsyncTaskInfoCancelAction.java | 36 + .../ApiSystemAsyncTaskInfoDeleteAction.java | 36 + .../ApiSystemAsyncTaskInfoDetailAction.java | 36 + .../ApiSystemAsyncTaskInfoListAction.java | 38 + .../ApiSystemAsyncTaskInfoLogsAction.java | 36 + .../ApiSystemAsyncTaskInfoRestartAction.java | 36 + .../ApiSystemGlobalFileTransferAction.java | 36 + .../ApiSystemGlobalFileUploadAction.java | 36 + .../ApiSystemGlobalSettingDetailAction.java | 37 + .../ApiSystemGlobalSettingEditAction.java | 37 + .../ApiSystemGlobalSettingListAction.java | 38 + .../domain/asyncTask/package-info.java | 1 + .../domain/changeLog/ChangeLogAop.java | 64 + .../domain/changeLog/ChangeLogContext.java | 49 + .../domain/changeLog/ChangeLogOperator.java | 56 + .../domain/changeLog/ChangeLogRecord.java | 43 + .../component/CommonCacheServiceImpl.java | 109 + .../component/CommonCrawlerServiceImpl.java | 84 + .../component/CommonInterceptorService.java | 38 + .../component/CommonLauncherServiceImpl.java | 30 + .../component/CommonSessionServiceImpl.java | 80 + .../component/CommonSettingServiceImpl.java | 35 + .../component/CommonTokenServiceImpl.java | 117 ++ .../FileUploadAliossProviderImpl.java | 33 + .../provider/FileUploadLocalProviderImpl.java | 34 + .../PermissionSystemAdminProviderImpl.java | 68 + .../SystemAdminInfoRepositoryImpl.java | 638 ++++++ .../SystemAsyncTaskInfoRepositoryImpl.java | 744 +++++++ .../SystemCrawlerCacheDataRepositoryImpl.java | 623 ++++++ .../SystemGlobalCacheRepositoryImpl.java | 623 ++++++ ...ystemGlobalFileTransferRepositoryImpl.java | 605 ++++++ .../SystemGlobalSessionRepositoryImpl.java | 627 ++++++ .../SystemGlobalSettingRepositoryImpl.java | 631 ++++++ .../SystemAdminInfoAuthServiceImpl.java | 188 ++ .../service/SystemAdminInfoServiceImpl.java | 213 ++ .../SystemAsyncTaskInfoServiceImpl.java | 301 +++ .../service/SystemGlobalFileServiceImpl.java | 43 + .../SystemGlobalSessionServiceImpl.java | 153 ++ .../SystemGlobalSettingServiceImpl.java | 138 ++ .../SystemAdminInfoTransactional.java | 132 ++ .../SystemAsyncTaskInfoTransactional.java | 398 ++++ .../SystemGlobalFileTransactional.java | 164 ++ .../application/facade/base/BaseParam.java | 28 + .../facade/enums/AuthTokenGroupEnum.java | 39 + .../enums/SystemAdminInfoOptStatusEnum.java | 37 + .../enums/SystemAdminInfoOptSuperEnum.java | 37 + .../SystemAsyncTaskInfoOptStatusEnum.java | 41 + .../SystemGlobalFileUploadFileTypeEnum.java | 41 + .../excel/exportModel/package-info.java | 1 + .../excel/importModel/package-info.java | 1 + .../facade/provider/IFileUploadProvider.java | 9 + .../facade/provider/IPaymentProvider.java | 144 ++ .../facade/provider/IPermissionProvider.java | 12 + .../facade/provider/package-info.java | 1 + .../ISystemAdminInfoRepository.java | 41 + .../ISystemAsyncTaskInfoRepository.java | 41 + .../ISystemCrawlerCacheDataRepository.java | 41 + .../ISystemGlobalCacheRepository.java | 41 + .../ISystemGlobalFileTransferRepository.java | 41 + .../ISystemGlobalSessionRepository.java | 41 + .../ISystemGlobalSettingRepository.java | 41 + .../SystemAdminInfoAuthEditPasswordParam.java | 22 + .../SystemAdminInfoAuthEditProfileParam.java | 19 + .../SystemAdminInfoAuthLoginParam.java | 19 + .../request/SystemAdminInfoCreateParam.java | 34 + .../request/SystemAdminInfoDeleteParam.java | 15 + .../request/SystemAdminInfoDetailParam.java | 15 + .../request/SystemAdminInfoListParam.java | 49 + .../request/SystemAdminInfoRecoverParam.java | 15 + .../request/SystemAdminInfoUpdateParam.java | 37 + .../SystemAsyncTaskInfoCancelParam.java | 21 + .../SystemAsyncTaskInfoClearParam.java | 11 + .../SystemAsyncTaskInfoCreateParam.java | 33 + .../SystemAsyncTaskInfoDeleteParam.java | 21 + .../SystemAsyncTaskInfoDetailParam.java | 24 + .../request/SystemAsyncTaskInfoListParam.java | 44 + .../request/SystemAsyncTaskInfoLogsParam.java | 24 + .../SystemAsyncTaskInfoResetParam.java | 11 + .../SystemAsyncTaskInfoRestartParam.java | 30 + .../SystemAsyncTaskInfoScheduleParam.java | 11 + .../request/SystemAsyncTaskInfoTickParam.java | 11 + .../SystemGlobalFileTransferParam.java | 17 + .../request/SystemGlobalFileUploadParam.java | 29 + .../SystemGlobalSessionDeleteParam.java | 16 + .../SystemGlobalSessionDetailParam.java | 22 + .../request/SystemGlobalSessionLastParam.java | 19 + .../request/SystemGlobalSessionListParam.java | 33 + .../SystemGlobalSettingDetailParam.java | 16 + .../request/SystemGlobalSettingEditParam.java | 23 + .../SystemAdminInfoAuthLoginResponse.java | 21 + .../SystemAdminInfoDetailResponse.java | 50 + .../SystemAsyncTaskInfoDetailResponse.java | 74 + .../SystemAsyncTaskInfoLogsResponse.java | 12 + .../SystemGlobalFileTransferResponse.java | 14 + .../SystemGlobalFileUploadResponse.java | 15 + .../SystemGlobalSessionDetailResponse.java | 43 + .../SystemGlobalSettingDetailResponse.java | 22 + .../service/ISystemAdminInfoAuthService.java | 17 + .../service/ISystemAdminInfoService.java | 22 + .../service/ISystemAsyncTaskInfoService.java | 33 + .../service/ISystemGlobalFileService.java | 15 + .../service/ISystemGlobalSessionService.java | 21 + .../service/ISystemGlobalSettingService.java | 19 + .../facade/task/IAsyncTaskHandler.java | 130 ++ .../facade/task/IAsyncTaskScheduler.java | 9 + .../application/fileMgr/LocalFileUtil.java | 387 ++++ .../application/fileMgr/OssFileUtil.java | 698 +++++++ .../application/properties/AppProperties.java | 15 + .../scheduling/LoopScheduling.java | 61 + .../setting/SystemGlobalFileUploadConfig.java | 81 + .../setting/SystemGlobalStaticFileConfig.java | 33 + src/main/resources/application-local.yml | 15 + src/main/resources/application-pre.yml | 15 + src/main/resources/application-prod.yml | 15 + src/main/resources/application-qa.yml | 15 + src/main/resources/application.yml | 29 + src/main/resources/environment.properties | 3 + src/main/resources/logback-spring.xml | 201 ++ src/main/resources/mybatis.generator.xml | 182 ++ src/main/resources/mybatis.properties | 5 + .../mybatis/mapper/SystemAdminInfoMapper.xml | 449 ++++ .../mapper/SystemAsyncTaskInfoMapper.xml | 679 +++++++ .../mapper/SystemCrawlerCacheDataMapper.xml | 483 +++++ .../mapper/SystemGlobalCacheMapper.xml | 483 +++++ .../mapper/SystemGlobalFileTransferMapper.xml | 402 ++++ .../mapper/SystemGlobalSessionMapper.xml | 434 ++++ .../mapper/SystemGlobalSettingMapper.xml | 466 +++++ .../wsdl/CxfWebServiceImplApiService.wsdl | 1474 ++++++++++++++ src/main/resources/wsdl/README.md | 8 + 311 files changed, 43782 insertions(+) create mode 100644 .eslintignore create mode 100644 .gitignore create mode 100644 README.md create mode 100644 ddl.sql create mode 100644 pom.xml create mode 100644 src/lib/tape-mybatis-generator-plugin-1.0-SNAPSHOT.jar create mode 100644 src/main/java/com/iqudoo/framework/tape/Tape.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/action/annotation/ActionConfig.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/action/annotation/ActionMapping.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/action/annotation/ActionRetry.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionAuthInfo.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionDocInfo.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionParam.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionParameter.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionRequest.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionResponse.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionServletRequest.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionServletResponse.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionState.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionStateCanRetry.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionTokenInfo.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/action/bean/_Attribute.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/action/handler/ActionHandler.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/action/handler/DefaultActionHandler.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/action/handler/ProtoActionHandler.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/action/handler/SimpleActionHandler.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/action/handler/SimpleProtoActionHandler.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/action/interfaces/IActionCall.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/action/interfaces/IActionDiscover.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/action/interfaces/IActionDispatch.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/action/interfaces/IActionToken.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/docs/annotation/ApiDocActionConfiguration.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/docs/annotation/ApiDocControllerConfiguration.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/docs/annotation/ApiDocEnumConfiguration.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/docs/annotation/ApiDocFieldConfiguration.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/docs/bean/ApiDocActionInfo.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/docs/bean/ApiDocControllerInfo.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/docs/bean/ApiDocEnumInfo.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/docs/interfaces/IDocAction.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/docs/interfaces/IDocController.java create mode 100644 src/main/java/com/iqudoo/framework/tape/base/docs/interfaces/IDocEnum.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/IModuleAsync.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/IModuleCache.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/IModuleCrawler.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/IModuleFactory.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/IModuleFileManager.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/IModuleLock.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/IModuleSession.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/IModuleSetting.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/annotation/FactoryMapping.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/annotation/SettingConfiguration.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/annotation/SettingField.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/asserts/AssertUtil.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/asserts/AssertValidator.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/asserts/AssertValidatorArrayEmpty.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/asserts/AssertValidatorListEmpty.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/async/AsyncHandler.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/async/AsyncScheduler.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/cache/Cache.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/cache/CacheKey.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/cache/CacheLoader.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/crawler/Crawler.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/crawler/CrawlerKey.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/crawler/CrawlerLoader.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/crud/JoinUtil.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/crud/PageData.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/crud/PageUtil.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/excel/BaseEasyExcelIgnoreError.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/excel/BaseEasyExcelReadAbstractListener.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/excel/BaseEasyExcelReadResponse.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/excel/BaseExcelCellWriteHandler.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/excel/BaseExcelHeaderFooterHandler.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/excel/EasyExcelUtil.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/fileManager/FileConfig.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/fileManager/FileInfo.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/proto/Proto.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/proto/ProtoLoader.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/proto/ProtoUtil.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/serializer/LongListToStringListSerializer.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/serializer/ToJsonArraySerializer.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/serializer/ToJsonObjSerializer.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/serializer/ToJsonSerializer.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/session/GetSessionParam.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/session/RefreshSessionParam.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/utils/AddressUtil.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/utils/ArrayUtil.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/utils/Base64Util.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/utils/DateTimeUtil.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/utils/DateUtil.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/utils/DebounceUtil.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/utils/DecimalUtil.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/utils/DigestUtil.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/utils/FileUtil.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/utils/HttpUtil.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/utils/JsonUtil.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/utils/LogUtil.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/utils/ObjectUtil.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/utils/PatternUtil.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/utils/PerfUtils.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/utils/RandomUtil.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/utils/ReflectUtil.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/utils/ServletUtil.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/utils/SnowflakeUtil.java create mode 100644 src/main/java/com/iqudoo/framework/tape/modules/utils/ThrowableUtil.java create mode 100644 src/main/java/com/iqudoo/framework/tape/service/ICacheService.java create mode 100644 src/main/java/com/iqudoo/framework/tape/service/ICrawlerService.java create mode 100644 src/main/java/com/iqudoo/framework/tape/service/IInterceptorService.java create mode 100644 src/main/java/com/iqudoo/framework/tape/service/ILauncherService.java create mode 100644 src/main/java/com/iqudoo/framework/tape/service/ISessionService.java create mode 100644 src/main/java/com/iqudoo/framework/tape/service/ISettingService.java create mode 100644 src/main/java/com/iqudoo/framework/tape/service/ITokenService.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/Runner.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/RunnerApplication.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/RunnerContext.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/actions/GetActionDetailAction.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/actions/GetActionListAction.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/actions/GetControllerListAction.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/actions/GetEnumDetailAction.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/actions/GetEnumListAction.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/actions/GetNodeIdAction.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/actions/GetNodeInfoAction.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/actions/PingRequestAction.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/actions/RefreshTokenAction.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/annotation/EnableTapeCorsFilter.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/annotation/EnableTapeRunner.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/conf/ConfCorsFilter.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/conf/TapeConfig.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/controller/ApiController.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/docs/DocActionImpl.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/docs/DocControllerImpl.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/docs/DocEnumImpl.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/impl/ActionCallImpl.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/impl/ActionDiscoverImpl.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/impl/ActionDispatchImpl.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/impl/ActionTokenImpl.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/impl/ModuleAsyncImpl.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/impl/ModuleCacheImpl.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/impl/ModuleCrawlerImpl.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/impl/ModuleFactoryImpl.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/impl/ModuleLockImpl.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/impl/ModuleSessionImpl.java create mode 100644 src/main/java/com/iqudoo/framework/tape/spring/impl/ModuleSettingImpl.java create mode 100644 src/main/java/com/iqudoo/platform/application/App.java create mode 100644 src/main/java/com/iqudoo/platform/application/config/AsyncConfig.java create mode 100644 src/main/java/com/iqudoo/platform/application/config/WebConfig.java create mode 100644 src/main/java/com/iqudoo/platform/application/constants/BizConstants.java create mode 100644 src/main/java/com/iqudoo/platform/application/constants/ErrorConstants.java create mode 100644 src/main/java/com/iqudoo/platform/application/controller/StaticFileController.java create mode 100644 src/main/java/com/iqudoo/platform/application/database/mapper/SystemAdminInfoMapper.java create mode 100644 src/main/java/com/iqudoo/platform/application/database/mapper/SystemAsyncTaskInfoMapper.java create mode 100644 src/main/java/com/iqudoo/platform/application/database/mapper/SystemCrawlerCacheDataMapper.java create mode 100644 src/main/java/com/iqudoo/platform/application/database/mapper/SystemGlobalCacheMapper.java create mode 100644 src/main/java/com/iqudoo/platform/application/database/mapper/SystemGlobalFileTransferMapper.java create mode 100644 src/main/java/com/iqudoo/platform/application/database/mapper/SystemGlobalSessionMapper.java create mode 100644 src/main/java/com/iqudoo/platform/application/database/mapper/SystemGlobalSettingMapper.java create mode 100644 src/main/java/com/iqudoo/platform/application/database/mapper/SystemGlobalVerifyMapper.java create mode 100644 src/main/java/com/iqudoo/platform/application/database/model/SystemAdminInfo.java create mode 100644 src/main/java/com/iqudoo/platform/application/database/model/SystemAdminInfoExample.java create mode 100644 src/main/java/com/iqudoo/platform/application/database/model/SystemAsyncTaskInfo.java create mode 100644 src/main/java/com/iqudoo/platform/application/database/model/SystemAsyncTaskInfoExample.java create mode 100644 src/main/java/com/iqudoo/platform/application/database/model/SystemCrawlerCacheData.java create mode 100644 src/main/java/com/iqudoo/platform/application/database/model/SystemCrawlerCacheDataExample.java create mode 100644 src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalCache.java create mode 100644 src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalCacheExample.java create mode 100644 src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalFileTransfer.java create mode 100644 src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalFileTransferExample.java create mode 100644 src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalSession.java create mode 100644 src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalSessionExample.java create mode 100644 src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalSetting.java create mode 100644 src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalSettingExample.java create mode 100644 src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalVerify.java create mode 100644 src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalVerifyExample.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfo/ApiSystemAdminInfoCreateAction.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfo/ApiSystemAdminInfoDeleteAction.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfo/ApiSystemAdminInfoDetailAction.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfo/ApiSystemAdminInfoListAction.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfo/ApiSystemAdminInfoRecoverAction.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfo/ApiSystemAdminInfoUpdateAction.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfoAuth/ApiSystemAdminInfoAuthEditPasswordAction.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfoAuth/ApiSystemAdminInfoAuthEditProfileAction.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfoAuth/ApiSystemAdminInfoAuthLoginAction.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfoAuth/ApiSystemAdminInfoAuthProfileAction.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAsyncTaskInfo/ApiSystemAsyncTaskInfoCancelAction.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAsyncTaskInfo/ApiSystemAsyncTaskInfoDeleteAction.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAsyncTaskInfo/ApiSystemAsyncTaskInfoDetailAction.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAsyncTaskInfo/ApiSystemAsyncTaskInfoListAction.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAsyncTaskInfo/ApiSystemAsyncTaskInfoLogsAction.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAsyncTaskInfo/ApiSystemAsyncTaskInfoRestartAction.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemGlobalFile/ApiSystemGlobalFileTransferAction.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemGlobalFile/ApiSystemGlobalFileUploadAction.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemGlobalSetting/ApiSystemGlobalSettingDetailAction.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemGlobalSetting/ApiSystemGlobalSettingEditAction.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemGlobalSetting/ApiSystemGlobalSettingListAction.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/asyncTask/package-info.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/changeLog/ChangeLogAop.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/changeLog/ChangeLogContext.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/changeLog/ChangeLogOperator.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/changeLog/ChangeLogRecord.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/component/CommonCacheServiceImpl.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/component/CommonCrawlerServiceImpl.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/component/CommonInterceptorService.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/component/CommonLauncherServiceImpl.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/component/CommonSessionServiceImpl.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/component/CommonSettingServiceImpl.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/component/CommonTokenServiceImpl.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/provider/FileUploadAliossProviderImpl.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/provider/FileUploadLocalProviderImpl.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/provider/PermissionSystemAdminProviderImpl.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/repository/SystemAdminInfoRepositoryImpl.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/repository/SystemAsyncTaskInfoRepositoryImpl.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/repository/SystemCrawlerCacheDataRepositoryImpl.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/repository/SystemGlobalCacheRepositoryImpl.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/repository/SystemGlobalFileTransferRepositoryImpl.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/repository/SystemGlobalSessionRepositoryImpl.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/repository/SystemGlobalSettingRepositoryImpl.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/service/SystemAdminInfoAuthServiceImpl.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/service/SystemAdminInfoServiceImpl.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/service/SystemAsyncTaskInfoServiceImpl.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/service/SystemGlobalFileServiceImpl.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/service/SystemGlobalSessionServiceImpl.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/service/SystemGlobalSettingServiceImpl.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/transactionals/SystemAdminInfoTransactional.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/transactionals/SystemAsyncTaskInfoTransactional.java create mode 100644 src/main/java/com/iqudoo/platform/application/domain/transactionals/SystemGlobalFileTransactional.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/base/BaseParam.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/enums/AuthTokenGroupEnum.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/enums/SystemAdminInfoOptStatusEnum.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/enums/SystemAdminInfoOptSuperEnum.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/enums/SystemAsyncTaskInfoOptStatusEnum.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/enums/SystemGlobalFileUploadFileTypeEnum.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/excel/exportModel/package-info.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/excel/importModel/package-info.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/provider/IFileUploadProvider.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/provider/IPaymentProvider.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/provider/IPermissionProvider.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/provider/package-info.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/repository/ISystemAdminInfoRepository.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/repository/ISystemAsyncTaskInfoRepository.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/repository/ISystemCrawlerCacheDataRepository.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/repository/ISystemGlobalCacheRepository.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/repository/ISystemGlobalFileTransferRepository.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/repository/ISystemGlobalSessionRepository.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/repository/ISystemGlobalSettingRepository.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoAuthEditPasswordParam.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoAuthEditProfileParam.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoAuthLoginParam.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoCreateParam.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoDeleteParam.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoDetailParam.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoListParam.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoRecoverParam.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoUpdateParam.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoCancelParam.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoClearParam.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoCreateParam.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoDeleteParam.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoDetailParam.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoListParam.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoLogsParam.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoResetParam.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoRestartParam.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoScheduleParam.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoTickParam.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalFileTransferParam.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalFileUploadParam.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalSessionDeleteParam.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalSessionDetailParam.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalSessionLastParam.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalSessionListParam.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalSettingDetailParam.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalSettingEditParam.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/response/SystemAdminInfoAuthLoginResponse.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/response/SystemAdminInfoDetailResponse.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/response/SystemAsyncTaskInfoDetailResponse.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/response/SystemAsyncTaskInfoLogsResponse.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/response/SystemGlobalFileTransferResponse.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/response/SystemGlobalFileUploadResponse.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/response/SystemGlobalSessionDetailResponse.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/response/SystemGlobalSettingDetailResponse.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/service/ISystemAdminInfoAuthService.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/service/ISystemAdminInfoService.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/service/ISystemAsyncTaskInfoService.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/service/ISystemGlobalFileService.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/service/ISystemGlobalSessionService.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/service/ISystemGlobalSettingService.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/task/IAsyncTaskHandler.java create mode 100644 src/main/java/com/iqudoo/platform/application/facade/task/IAsyncTaskScheduler.java create mode 100644 src/main/java/com/iqudoo/platform/application/fileMgr/LocalFileUtil.java create mode 100644 src/main/java/com/iqudoo/platform/application/fileMgr/OssFileUtil.java create mode 100644 src/main/java/com/iqudoo/platform/application/properties/AppProperties.java create mode 100644 src/main/java/com/iqudoo/platform/application/scheduling/LoopScheduling.java create mode 100644 src/main/java/com/iqudoo/platform/application/setting/SystemGlobalFileUploadConfig.java create mode 100644 src/main/java/com/iqudoo/platform/application/setting/SystemGlobalStaticFileConfig.java create mode 100644 src/main/resources/application-local.yml create mode 100644 src/main/resources/application-pre.yml create mode 100644 src/main/resources/application-prod.yml create mode 100644 src/main/resources/application-qa.yml create mode 100644 src/main/resources/application.yml create mode 100644 src/main/resources/environment.properties create mode 100644 src/main/resources/logback-spring.xml create mode 100644 src/main/resources/mybatis.generator.xml create mode 100644 src/main/resources/mybatis.properties create mode 100644 src/main/resources/mybatis/mapper/SystemAdminInfoMapper.xml create mode 100644 src/main/resources/mybatis/mapper/SystemAsyncTaskInfoMapper.xml create mode 100644 src/main/resources/mybatis/mapper/SystemCrawlerCacheDataMapper.xml create mode 100644 src/main/resources/mybatis/mapper/SystemGlobalCacheMapper.xml create mode 100644 src/main/resources/mybatis/mapper/SystemGlobalFileTransferMapper.xml create mode 100644 src/main/resources/mybatis/mapper/SystemGlobalSessionMapper.xml create mode 100644 src/main/resources/mybatis/mapper/SystemGlobalSettingMapper.xml create mode 100644 src/main/resources/wsdl/CxfWebServiceImplApiService.wsdl create mode 100644 src/main/resources/wsdl/README.md diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..e69de29 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9aab581 --- /dev/null +++ b/.gitignore @@ -0,0 +1,37 @@ +#### Release And Logs ### +target/ +logs/ +opt/ +runtime/ + +#### Maven ### +.mvn/ + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +nbproject/private/ +build/ +nbbuild/ +dist/ +nbdist/ +.nb-gradle/ + +### PID log +hs_err_pid* +replay_pid* + +### MAC OS +.DS_Store diff --git a/README.md b/README.md new file mode 100644 index 0000000..eb77b23 --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# tape-springboot-framework +> 后端服务 \ No newline at end of file diff --git a/ddl.sql b/ddl.sql new file mode 100644 index 0000000..3c3bd40 --- /dev/null +++ b/ddl.sql @@ -0,0 +1,151 @@ +-- ---------------------------- +-- Table structure for t_system_admin_info +-- ---------------------------- +DROP TABLE IF EXISTS `t_system_admin_info`; +CREATE TABLE `t_system_admin_info` ( + `guid` bigint unsigned NOT NULL DEFAULT '0' COMMENT 'GUID', + `username` varchar(32) NOT NULL DEFAULT '' COMMENT '登录账号', + `nickname` varchar(128) NOT NULL DEFAULT '' COMMENT '账号昵称', + `pwd_md5` varchar(32) NOT NULL DEFAULT '' COMMENT '密码密文', + `pwd_slot` varchar(32) NOT NULL DEFAULT '' COMMENT '加密盐数', + `opt_remark` varchar(256) NOT NULL DEFAULT '' COMMENT '备注信息', + `opt_status` int NOT NULL DEFAULT '0' COMMENT '状态标志', + `opt_super` int NOT NULL DEFAULT '0' COMMENT '超管标志', + `is_hidden` int NOT NULL DEFAULT '0' COMMENT '隐藏标志', + `is_delete` int NOT NULL DEFAULT '0' COMMENT '删除标志', + `delete_token` varchar(32) NOT NULL DEFAULT '' COMMENT '删除令牌', + `data_version` int NOT NULL DEFAULT '0' COMMENT '数据版本', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`guid`) USING BTREE, + UNIQUE KEY `idx_unique_username` (`username`,`delete_token`) USING BTREE, + KEY `idx_create_time` (`create_time`) USING BTREE, + KEY `idx_update_time` (`update_time`) USING BTREE, + KEY `idx_hidden_delete` (`is_hidden`,`is_delete`) USING BTREE +) ENGINE=InnoDB COMMENT='系统管理员信息表'; + +-- ---------------------------- +-- Table structure for t_system_async_task_info +-- ---------------------------- +DROP TABLE IF EXISTS `t_system_async_task_info`; +CREATE TABLE `t_system_async_task_info` ( + `guid` bigint unsigned NOT NULL DEFAULT '0' COMMENT 'GUID', + `biz_type` varchar(128) NOT NULL DEFAULT '' COMMENT '业务类型', + `biz_id` varchar(128) NOT NULL DEFAULT '' COMMENT '业务编号', + `trans_id` varchar(128) NOT NULL DEFAULT '' COMMENT '任务编号', + `task_type` varchar(64) NOT NULL DEFAULT '' COMMENT '任务类型', + `task_params` mediumtext CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '任务参数', + `call_timing` bigint NOT NULL DEFAULT '0' COMMENT '定时执行', + `start_time` bigint NOT NULL DEFAULT '0' COMMENT '开始时间', + `end_time` bigint NOT NULL DEFAULT '0' COMMENT '结束时间', + `use_time` bigint NOT NULL DEFAULT '0' COMMENT '总共耗时', + `total_count` int NOT NULL DEFAULT '0' COMMENT '总共数量', + `success_count` int NOT NULL DEFAULT '0' COMMENT '成功数量', + `failure_count` int NOT NULL DEFAULT '0' COMMENT '失败数量', + `ignore_count` int NOT NULL DEFAULT '0' COMMENT '忽略数量', + `retry_count` int NOT NULL DEFAULT '0' COMMENT '重试次数', + `opt_status` int NOT NULL DEFAULT '0' COMMENT '状态标志', + `is_hidden` int NOT NULL DEFAULT '0' COMMENT '隐藏标志', + `is_delete` int NOT NULL DEFAULT '0' COMMENT '删除标志', + `delete_token` varchar(32) NOT NULL DEFAULT '' COMMENT '删除令牌', + `data_version` int NOT NULL DEFAULT '0' COMMENT '数据版本', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`guid`) USING BTREE +) ENGINE=InnoDB COMMENT='系统异步任务信息表'; + +-- ---------------------------- +-- Table structure for t_system_crawler_cache_data +-- ---------------------------- +DROP TABLE IF EXISTS `t_system_crawler_cache_data`; +CREATE TABLE `t_system_crawler_cache_data` ( + `guid` bigint unsigned NOT NULL DEFAULT '0' COMMENT 'GUID', + `crawler_time` bigint unsigned NOT NULL DEFAULT '0' COMMENT '抓取时间', + `crawler_type` varchar(128) NOT NULL DEFAULT '' COMMENT '抓取类型', + `crawler_keyword` varchar(128) NOT NULL DEFAULT '' COMMENT '抓取关键词', + `cache_data` mediumtext NOT NULL COMMENT '缓存内容', + `is_hidden` int NOT NULL DEFAULT '0' COMMENT '隐藏标志', + `is_delete` int NOT NULL DEFAULT '0' COMMENT '删除标志', + `delete_token` varchar(32) DEFAULT '' COMMENT '删除令牌', + `data_version` int NOT NULL DEFAULT '0' COMMENT '数据版本', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`guid`) USING BTREE +) ENGINE=InnoDB COMMENT='系统爬虫数据缓存信息'; + +-- ---------------------------- +-- Table structure for t_system_global_cache +-- ---------------------------- +DROP TABLE IF EXISTS `t_system_global_cache`; +CREATE TABLE `t_system_global_cache` ( + `guid` bigint unsigned NOT NULL DEFAULT '0' COMMENT 'GUID', + `cache_time` bigint unsigned NOT NULL DEFAULT '0' COMMENT '缓存时间', + `expire_time` bigint unsigned NOT NULL DEFAULT '0' COMMENT '过期时间', + `cache_key` varchar(128) NOT NULL DEFAULT '' COMMENT '缓存主键', + `cache_data` mediumtext NOT NULL COMMENT '缓存内容', + `is_hidden` int NOT NULL DEFAULT '0' COMMENT '隐藏标志', + `is_delete` int NOT NULL DEFAULT '0' COMMENT '删除标志', + `delete_token` varchar(32) NOT NULL DEFAULT '' COMMENT '删除令牌', + `data_version` int NOT NULL DEFAULT '0' COMMENT '数据版本', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`guid`) USING BTREE +) ENGINE=InnoDB COMMENT='系统通用缓存信息表'; + +-- ---------------------------- +-- Table structure for t_system_global_file_transfer +-- ---------------------------- +DROP TABLE IF EXISTS `t_system_global_file_transfer`; +CREATE TABLE `t_system_global_file_transfer` ( + `guid` bigint unsigned NOT NULL DEFAULT '0' COMMENT 'GUID', + `original_url` varchar(512) NOT NULL DEFAULT '' COMMENT '原来地址', + `saved_url` varchar(512) NOT NULL DEFAULT '' COMMENT '转存地址', + `file_size` bigint unsigned NOT NULL DEFAULT '0' COMMENT '文件大小', + `file_hash` varchar(32) NOT NULL DEFAULT '' COMMENT '文件哈希', + `is_hidden` int NOT NULL DEFAULT '0' COMMENT '隐藏标志', + `is_delete` int NOT NULL DEFAULT '0' COMMENT '删除标志', + `delete_token` varchar(32) NOT NULL DEFAULT '' COMMENT '删除令牌', + `data_version` int NOT NULL DEFAULT '0' COMMENT '数据版本', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`guid`) USING BTREE +) ENGINE=InnoDB COMMENT='系统文件转存关系表'; + +-- ---------------------------- +-- Table structure for t_system_global_session +-- ---------------------------- +DROP TABLE IF EXISTS `t_system_global_session`; +CREATE TABLE `t_system_global_session` ( + `guid` bigint unsigned NOT NULL DEFAULT '0' COMMENT 'GUID', + `user_guid` bigint unsigned NOT NULL DEFAULT '0' COMMENT '账号GUID', + `user_group` varchar(32) NOT NULL DEFAULT '' COMMENT '账号分组', + `session_key` varchar(128) NOT NULL DEFAULT '' COMMENT '会话KEY', + `origin_platform` varchar(32) NOT NULL DEFAULT '' COMMENT '来源平台', + `origin_domain` varchar(128) NOT NULL DEFAULT '' COMMENT '来源域名', + `origin_ip` varchar(128) NOT NULL DEFAULT '' COMMENT '来源IP地址', + `is_hidden` int NOT NULL DEFAULT '0' COMMENT '隐藏标志', + `is_delete` int NOT NULL DEFAULT '0' COMMENT '删除标志', + `delete_token` varchar(32) NOT NULL DEFAULT '' COMMENT '删除令牌', + `data_version` int NOT NULL DEFAULT '0' COMMENT '数据版本', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`guid`) USING BTREE +) ENGINE=InnoDB COMMENT='系统全局会话信息表'; + +-- ---------------------------- +-- Table structure for t_system_global_setting +-- ---------------------------- +DROP TABLE IF EXISTS `t_system_global_setting`; +CREATE TABLE `t_system_global_setting` ( + `guid` bigint unsigned NOT NULL DEFAULT '0' COMMENT 'GUID', + `setting_key` varchar(128) NOT NULL DEFAULT '' COMMENT '配置KEY', + `setting_value` mediumtext NOT NULL COMMENT '配置内容', + `opt_remark` varchar(256) NOT NULL DEFAULT '' COMMENT '备注信息', + `is_hidden` int NOT NULL DEFAULT '0' COMMENT '隐藏标志', + `is_delete` int NOT NULL DEFAULT '0' COMMENT '删除标志', + `delete_token` varchar(32) NOT NULL DEFAULT '' COMMENT '删除令牌', + `data_version` int NOT NULL DEFAULT '0' COMMENT '数据版本', + `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`guid`) USING BTREE +) ENGINE=InnoDB COMMENT='系统全局配置信息表'; \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..7822ac2 --- /dev/null +++ b/pom.xml @@ -0,0 +1,388 @@ + + + + 4.0.0 + + org.springframework.boot + spring-boot-starter-parent + 2.7.18 + + + + com.iqudoo.platform + tape-springboot-framework + 1.0-SNAPSHOT + Tape SpringBoot Backend Framework + war + + + 3.4.0 + 1.2.73 + 2.2.2 + 4.9.2 + UTF-8 + 17 + 17 + + + + + local + + true + + + 9081 + local + Asia/Shanghai + 200 + + + + qa + + false + + + 9080 + qa + Asia/Shanghai + 200 + + + + pre + + false + + + 9080 + pre + Asia/Shanghai + 200 + + + + prod + + false + + + 9080 + prod + Asia/Shanghai + 200 + + + + + + + + org.antlr + antlr4-runtime + ${antlr4.version} + + + + + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-tomcat + + + + + org.springframework.boot + spring-boot-starter-tomcat + provided + + + org.springframework.boot + spring-boot-configuration-processor + true + + + org.springframework.boot + spring-boot-starter-aop + + + org.springframework.boot + spring-boot-starter-data-redis + + + org.springframework.boot + spring-boot-starter-webflux + + + org.mybatis.spring.boot + mybatis-spring-boot-starter + ${mybatis-spring-boot.version} + + + org.antlr + antlr4-runtime + + + + + + org.springframework.retry + spring-retry + 1.3.4 + + + org.aspectj + aspectjweaver + + + org.antlr + antlr4-runtime + ${antlr4.version} + + + com.alibaba + fastjson + ${fastjson.version} + + + com.auth0 + java-jwt + ${jwtauth.version} + + + mysql + mysql-connector-java + runtime + 8.0.33 + + + org.mybatis.generator + mybatis-generator-core + 1.4.2 + + + org.projectlombok + lombok + 1.18.30 + true + + + com.squareup.okhttp3 + okhttp + 4.12.0 + + + + + org.apache.sshd + sshd-core + 2.17.1 + + + org.bouncycastle + bcprov-jdk18on + 1.84 + + + + + org.apache.commons + commons-lang3 + 3.12.0 + + + + + com.github.oshi + oshi-core + 6.4.0 + + + net.java.dev.jna + jna + 5.13.0 + + + net.java.dev.jna + jna-platform + 5.13.0 + + + + + com.aliyun.oss + aliyun-sdk-oss + 3.11.1 + + + + + com.alibaba + easyexcel + 3.1.1 + + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.junit.vintage + junit-vintage-engine + + + + + + + application + + + org.apache.maven.plugins + maven-resources-plugin + 3.1.0 + + + default-resources + package + + copy-resources + + + target/classes + false + + @ + + + + src/main/java + + **/*.yml + **/*.xml + + true + + + src/main/resources/ + true + + **/*.yml + **/*.xml + + + + src/main/resources/ + + **/*.yml + **/*.xml + + + + + + + + + org.apache.maven.plugins + maven-war-plugin + 3.2.3 + + + WEB-INF/classes/mybatis.properties, + WEB-INF/classes/mybatis.generator.xml + + + + src/lib + WEB-INF/lib/ + + **/*.jar + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + 3.11.0 + + ${maven.compiler.source} + ${maven.compiler.target} + ${project.build.sourceEncoding} + true + + + + org.springframework.boot + spring-boot-maven-plugin + 2.7.18 + + ${outputDirectory} + true + + + + + repackage + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.1.2 + + true + + + + + org.mybatis.generator + mybatis-generator-maven-plugin + 1.4.0 + + src/main/resources/mybatis.generator.xml + true + true + + + + Generate MyBatis Artifacts + deploy + + generate + + + + + + mysql + mysql-connector-java + runtime + 8.0.33 + + + com.iqudoo.framework + tape-mybaits-generator-plugin + 1.0-SNAPSHOT + ${project.basedir}/src/lib/tape-mybatis-generator-plugin-1.0-SNAPSHOT.jar + + system + + + + + + diff --git a/src/lib/tape-mybatis-generator-plugin-1.0-SNAPSHOT.jar b/src/lib/tape-mybatis-generator-plugin-1.0-SNAPSHOT.jar new file mode 100644 index 0000000000000000000000000000000000000000..d12002582ab0434a19144bff526e9d271ce6855a GIT binary patch literal 41182 zcma&M1x#i^&?O3k```@j?(XjH?(Q%+AMWn%?(XjH@Zm7HyTjmb*8bhMZ+G8z(n;s$ z)amM~PWq6(MidRGsp?aONooA zsM5=cKgdl_$;!~tFCfU!QO{1#H7PSLvFsi>(M!wGO35v_RyHf&%F)WqsN71^DnpM` z$<0lxFs`utsQ67iGcC37Bt5Z$Krbl=Y0Y|aw14yiMDd>ou>U*&`OhBw+w?yM%)ixt zc<|q0UH=^Y56r&>_`hl5V8`&kN5K78gw=0XQwN9t0}%cH4K#N$vNLmcaI*P7nBe{I zOzb?3ja;mp{|}}l|9_^gE>^bxBf)=4(LbC27)bwC{}CWNBR4bq|6#ZP8BF^B1^t$$aJ?;rnvO5}e{(|>pAzlBouAFUX zK30>uB2F2f(omFDP2(qeW*SvSMn>Hc=A_BakWStbwwnBpWDt2n$Vs4b+IxSkvOEjZDeh45BV_ zpj}P#=G4|N+kIJcYCNe@4KePT)LeRUdz48t@))#6l1^faDMgz{T$wkC3{|2}vxQj? zVyh03#^MF?n1TjbGAf!LQe*`ki?WQ$s!S*YeI4R$dtd+s#cZsS1YvOTz|vP%1M-BbW_48LAEmj!7!kv{O=S z3Av7mO|c59b|b?OS|6AwbHaJ+22j0AJcFa$CuJVin%%NQiq3^s#RChx0VOSmm&Ae_ zO?abj35r-Klp=gkorMh^bvd8SGf@ZNmbFX=R=CtcUQ?80D5x{M6npdY&H+m`#CO9G zIN<`@d_zxjfx9w>{`Ax5f|YwKpG7t@+~H_#VPBNkT#OWG#p9%J7GT%d@1~``NQj0o z75?Ft*J)%l^gJ-Z6j3Y5YJX7%p;IQ5#u!7hG`*i|S-mBlIzOUHDv*}t0^#$c z%c;0)Gjb^MJhT~x)AacDOxj}w*hHeYg;GXes*vH*Qr({?-~OX3mEUgOLiUZ;2eGzi z2Txy?cDbI_+*RxD5&Kl=x!ls)ZfWDZ+GXYTPdy+guXZRlqNbf96@!PelwlqLa?29P z-f5NBrI9NX0aFuGT8NXgRpqgKey~cb*Jysm1nnZyFz)^1=LX%H+`eKl^hp%?mUtUW z3itR*V>x;du^UohcpT&U*lqd%yb+Zl2ae#$}u zmfg&Rz~>_;FZIGg04Y%6Q<2^6KAG|zCMg$l=Y7V#>@6iqkv@S`|sc8mgp~Rnd?n$~(=Cd17-d;Q+1m$v^LA;Tx zeE!6B*CJj=|NY4hU9wrcGSOMB3Q!|PZ&?gt2_1Ic_GKg$anr2Rx0#QU+zgA}D@$|D z*E+Gz4}P9Ehe6+AKjT56@UD{A{qv_;^v!_ftm}~*7h_`v0nRzJx%|gVvfkM{bOFxR zr#I5)d@+aV6xv%=jf(=ay~D6T=mf=+7iAAsX60PEjO9jPylB$=02F5QG%7%V>8z|# zACj#R1%<|U%%6HEl4z) zzr(zY2j1B!79*KARvi&FHx#SK*55=>(i0?WefCr#KiNo1?`}JIsOJ% z@_SOY|H?p^y7_$E8OLeHGjpGr4~!4T4f+m(XB~q*iOAAHSsa=2YzWTtLU2FN@+lj(Qn ze5P5P0yeiRKD`+iyqh|8`phiyzoA}=omtr3B^_36GF!1mN5Gj#f|;NM%kAc zGa`%Xd@`|0a$4Ysl>)c>cZAu?L@$OzfB-ITH0lCsY+wxX9R5B>ymaV+n3lg9YzUHU$m^QEf$ipF;#KsV*QdhoI4zO6KRP@PU@7g?YZz zG#6Eu11EdefVuY;IgM3EblxDEla`G3l}w_Nt-*pMXiyoEg=K6h@WHM*q@YIF#FKep zk&fQT4uMXZoTLZawBYywUKJlN!nAy{1k2hPC#C>2=}d~fP;(}0ctCQv#GT-Qkc*Sp zJy(=BDm3Gd)CJQ~p=Pz=C}J{M<6n44xAfFtej-;wcB4H{+a;2+seqfMu$3$BDM(nX zjcL^*%JTR}W161j#{G^*6WNA>Ma<>UVd8rbT);2q2^`y&4gVW?m@h?m*3T?+G^ee# z&Zg0PtM&7$o$T<@Dr%7g51zl1t0kkd+=Fui@&j5-Cxi30blENiLM~#Rt9awLt&DPu zkVYiysjxER@%3q|z-i8bEBTR2&Ip^Ay_leuoV59cq1EO^ODWg3#+$`SE zJZKS!WgG7jCZ^X^3fjp?%m7@D6 z>KM-FO_Nyq_@@x!oJ zWUi~lt=FB{OI00f7vJf_v7a|Hp_bPO-gL+)3$=6C7BTPQK^v5tyYT9YWx%+#aH6}(%$uGf77^O(iGiCu%6mxnMJ3xp3UlKdUwtz|J2%h3+@jt85C(r;KhBJ9|6NCLoiolE_B~phkmzV&tc0c5pFc(_?Zplr87gkk6&08vV*gI zvfDJ5(F~?zt}!T$Xj#$|1%@Hu3^rAwOQoFb%N|)|L-;D5N4zS%Cope?rWSE4San+U7IkS`JC~q;?M${^^3^F5s_U}YDdL;`c6_bth?6Md$Qe;V@ zE1gtgl+jPav@z^tOOg`UDc4n6ga+eE#IvlU8L7>nOjFF9;;=0$@2D*|U5@|QLL1fI z=G)mtWR{cvvTm#>Ew2#a*-XBPpNN&j@h<0dwu~KT&JJSH+J$ACQB7%#ktO(;D!!zR z0#?Evz5Y51>b`@Dd}K0tuq3UR9xq8 z9-SLn+?L@SgDT8n>b>caX`BUW-J-DX+zcqO6)1##Lnd`XDy2`2Tc(R? zmhJND9z+i)(yd#pT^(piLrQD5!E&aN!qHjo=TFe9P?xnuYFL(~tUrAne&YJ047WIa z?u*%EY9pCpukh>jBfIIjHde?hl??`O7%v!+!@t(D{|O$blXnM-zvBmkbG361Fmep; z2v+k05xT_m3Z+&gm=mbg>JGpXsh91kWeTSA2=j~^3v43vqc2{**Hcb88zxkh)|139 z-VGLNB^%vCmb11pmoiEtE9eg!K(HK}hG%s4fG{eqGNK5G(45!o#EWEdDJWx@N$x15 zpHebUAS@*;Wwe+XxRZ6Q#Q2)mTR%zwa;~x5X;#@eP93$$Cg5f8W<2h9p?NHC%de%K zf_mYfj0OQ(Wgm0*_3AFp4HfiCX~fv2j~0%}*m8{>diIqxqT?oz<%5W$lx;q()t|5> zE>>+_R_m35Ioc&Yd?Z6!3A=K+f2SM__?g?P{Y1_h4KA>4@( z^vy~bI~szgkJHiijT#+{ri20R3)z-Y!z<#7 zayAZql%Mv$hqw;iBVAsdv6I>j^#UjjqT-{&i~QAI?(=lP-#Pv?{2?4Pp)s({povV^ zksqXRk#f6Q>*>9XM_pn6@~V@8$M_T94gZM^L+p8MJJqqOvaxJk;(VTb%jl$`W!F<8r;(`H=3lJhLNAheBMk)SsP2cQNg|0Yjzp(j|=qK~if zY&)NVpzo`qJ@N)<|DoCOidQz}xnz)dKjr7g7pcDe_w=NWQ(+!jUTpHm=`a#fB5Y-2 z%(5(1$*PI4S%~;x-V+=i2bdCE*Xj#&FX7JOU(H|GNfqk=jMpCxZJUQM1os39S>iWs z#J6~n*j)|TVUQHs;79XeFj5*}WdRIKpenyzv=(d|@&7!@;an(B}Gj8Tq_*sV~ zkq^u-+C$i^hU8mhNjv7XV0({LkY8m{ZpT_GGm5)xPLv+>O-$p_z-z5PqCIcx#p4WZ zH|eoY7yBI7)mRw4P+G}7l5XzKHD<|exeF^YMERR%?w_s{2!HvATj@iHE{-cihDYA= z1j;rie}G|rR?p8Z4By}U4qvvoYeo5tK55VN-N&9gFkMP+6Ob=qD>6?NkUv6#D}2NC zr5P_u;A2gVw89OK)yR{Gvnr~(SbFkkd<*OZ#S(tgjE1I}Y!bl&s(NDs5=U`u;<(d+ zol16KAz93-B`4;Oe+oC-3LW62S3q3UJe?&Q;lB1l{_j?y5;9GYDigh zB0jQ^XN(w0qM_9(9zt!bsmYgk#l;2W&?1&pWk+;6d}+pXpdCuyYMK=Vp-k>GSR*RS zLo1!Z(cH+@@8ba3XKn{GQ73zZ9CUvqpjwu$if`pKXG~b%J(-UJu7`5$Z;J6;eOwOZ zwcCppSgfGN)fZ_q<;FN0Yl6=stQ+>ZPs?(Jv2r5rtgD^b@nWB57vS+irH~*N4OH8# zQjzAy4;@{*Iz^hi+B;FBY33`{41^65-k1S06{jMwzgSoM{`5CX)Aw@QaA6mV_M6MC zp|3RJ{aRnM&PywTW?`wQxK=hG>M(8bQM8V&hf?G@2U)_$OU^7>0bNSHOv_C4d)QO# zB5>g6EfZlIV*>={Zt!a_pCSMXitSW!AB825>?jJkzvi}10z10^)c#`CV(QJX%nv#gz=OM@j=QhedCIT%d<*z zoN;H4XqQ+U(2@<{;vB`=Q(xHhe%dX*L*MD)BcO-<__Sb#o;R#Opto$fbX{y?U-%n6 z&o8(Z2|#1NE!D>UHYDUnu%(17Y>*SA4#w^Nw7`eXV>_+eUg7EZ`6vjg`5OAN?z~W6 zJ}lnJ5nY;my{7miUcK?JU+9RjiD@XmDxjfgveVkI!S)P67_|GnT}C$3F>^m-PpsZ% z-U{{p2DJOFD%`YQ7Yne(BE~-R%Q>%Ns(ol&02D^vPd{u9P8}UtDOEp)gy?=$g2chZ z{`UXQfWSvZj78q<0YL=l&NmD+;3Hrgt{9pO4K#qjIVyoJ{2utN4+YFB;ikvMEgOj8 zZ9E7%&}$sQw)f`b)E|nWB*cM-)N3r!Y8-H6EFX|KPRRM0y_<+vvPT{qgvzRG=>K?5 z{pJ*W;ygcU7z+|-qjxitW|SJp5jJQdY}8Zck2`#k2#1mAT#UOLAwmv?ewdV%O_sJW zx)gBugO@H$-@mL2yrAM98F3_tbtEGnYxjKRsTU+nXB9^q(RaF`7nje~Bfkn1$7 zKnZtOs5}_O4+V7Ym-$8!lqqFT@=tdwny=j7l&1 zB6~eI$c1BP;#`2R0UDwX4MbquhG-_OhGd~-t6sZoF@V_k^?Hq0iER73!N>k(;R;V!>K!L?n-zrIgem#%q z`V+P*2`hh8kK}a+5-@KJ{3B5LJtpdYJ`YuJ4;p+>98(v6uRAQ0z8Hkt4v*-jozX6v z3|vI{6&tR;ex5S$vgEXj<@T)S?Q?NfR(~6pX{b(Lo>c9AoQ749g^n#?*hon)7`9{ zi()-SVj28-+aHpQ51PlP%ML}M}^X}`e``MxyTV*B=2a_YMM zI4w!0g{>5H-s0eZ)vn4aBfb>V5^g8tmE3qJ2gw{is;4{rFZb+Y#UJasDC>gQDZ^Y# zQke4?ox$`&57HmLnYH;0K(%JDxv(?q^D>(=&o|tj*b^KVydE)*`7Rfl&k*~f9v4h6 zE1tM~ulDTgBdW)rbNOLhvT?VzfaH@!6K{CF*{X`TRTY6e`L6b$+F)>uQRRQ z@ZM34`PEnKH%Px+{oSn7EN`Bk@y#=`-aP%iu~RkQMEw(ogIDfPe?J+A`@B;+-@NT( zq%*pa$5?EcKDDG%JvEt|3W&#EZDE4)gHwWYaNbp*fLe5lbfbpeWO;SF?ACD65+1Mi zR?NvKuR7lt>N0+Aq3`hG@{MOHAa3X!td@b9OP4j$0(1EeSuD)SM2UoflKa;ji-*#J zXLt803V-dXw7!-LLoU)ij2OdRXQ76t$O6*qQlZ~1WU>|V98C6Y^+9o2QX8OlAC5O~ zFN&}20X_HRFZLY%SM&)&@Ad=F_VFvr&OTZ15KrXIee6M3kD7O1TaY`zqb&0>%+We2R=m}dF&1~;`f6AVRSSus_cY~G#FAolDo9BL z+Iq$KLRIhpK3Tp>{Gx>UOP423?V}HFg;IljHtfv5EI#2YSf_h9l4k@Wft{)L=1AHH zOC@L)0@?=&8~8)y+Conx*kebQa*UZ)sple9!1fgEc7htK#H`LU2JKJlvf@5VDdK9& z?1j2qMFrx|8dkS*JxkB>*>(}WkkqteERM>u1eEvk^>)!K@u_^8n3D6VMqaAPhGB9Rq*yxPfc&=3iQUsdn*8uE=l5VZV`nNda_fPL(&^}JM}^Gjp-8tT~L%a z-MJ@Skd1fL5}aksewKGwg+rm*z@`t&GJf+9u_9iDDoin9F$<6VbFu`*g`nJubF+l_ zut@#Ac**fat)&TPQQ_RpsB_N($?=C!KwerzaCfo(p2&aP*rl7xG?#u7VhhXuO)T-!pBa6x&*#okBT8>=S6NDcV;_>(c9&-cGfLol}5rt>k z$DdqQ>TImSAy$c%MH!X3v8o8ovNMI~=RdW}5KGFrqi5B_79k|d>D44mW62v*r#Bd! zSNH<~%P$MctV!}}0)kcHD@r+UMB4b%Ruza6_=~sn61Elr1>be=;uJIS}WTccV+(U@uK82KVBT>PWNvmLn(}%~31fe`<^1aQ9 zA5PeNaDaC-YY~IIOv0$PxO@y1E(`&Jb8W$rbIQvdiAB*CXs;n-Zs=dCns_44%gUFZ zQ&uJ1soH9&InmXXay9ugl^LDO(sa=#S0Sdszf%EV@7x!ucF;uJLZ6y9OHfKp0F|31 zXQI=*@;u>q8mmz1q1hv61#lUew0{sih-djT+9Wiz~C8av3n=oOPp6zRYIn*W)kr z0=vqXYvrq@I@%2|mTxAP=h{f(@9pU9ciG&sPLBrZTiE5An$n;{fkak=o)Ta39kBR0 z&gY<&x#dk`0n7Dgm4TRZOeb?$RL@p`#3#x#OHkEP-TXa}Hn-R}#(PY{o#=rJzSevm zs#%;)bgIs-GLyH&OX>YoRHCLHNerPA%P;)&1;t0QC6xQr;Z{3U#xpj~&A&bU8LYlZ zEv}r+eL^C8!?(pKjGqaieDSbZA!n~!?2-ck2$?KDCa*_&Mhy@qLJ!+}s_^Kw(Yavq zP31Rk;p65jmk?>#pMUl=5VRAb9B*%BQ4p`8L-W^eQ;gVdNXQ#%pNIaw$;|G^Dg z+ajy?qpTNA>Dq}~Oiu`BnS!dIw$ORG?9|wmO|POhz`9Os@~;*2a}(F>m*D6+!8qqT zSZw1;z_vqkQ=V|uvO`M~1>??*i?%Pl`OOq3kMVx_5aE^cQb+9c4P>-8KA=nR*y3hB z?x9(CSuFZ(5sxz7##N>u|9#0U20wvbv`X(Bbzk|X-Dn9gR)&jD1G1+B4?PbFkc}|; z)T&_CeTDrYjSFPRbBh~*K<>3&%hdpTx?OEKcs*P`<|!&$X2k|{f&w~`0i7@JoaOO(D!*B)Tb zQm>|!EMsALv(}`*?7|xV@y+W>v+C6OT<oz5FE>@k`)8sb~JXETbvZ@bAGtJw|jn2#DDKjVwde$k^6Q z+04%>@jBWzt7vUxam0Q&=pqntLwcvsUv85=bgL0yqukO zH+RcB@qUYYCjj^N8EL8L_xBRS+Wo;HoTum^|NCiw{mYV3nU_Kl75crXz_Fo^U6Z$= z(q6vaTr;GP9UGdY9SXuGaDfP#m&2hGvs-n&%%BfVGK3Wg3$j>*Cb;0J;Cz3V$rZgo z@weHU0iGrn>|EQa!qX~b>6?WH1UZzoNCF{3vxkeVq%&*qw4|ElUU8?O$8Rmm*=#`% z>w0egcqR6^zJ3GUqq+Y*G{7SVF`N_ap}@GMJMpH=e$P_8O`W`- zfOpqxz)5NZSAGs;f&+69P75Wo6q4evL*u#E7s|RoxvVoId`jtSOAz^xpPTNCBl0Pw zWeol`;>xRFMI+A(2P!2Ok~8NAC#kQA)<|4T*Ve!=yEmSrQ;7*%x!c=4YL zjycwBOa4L0Ai^yRhOUe#2&riylP6=Dh!T_=SEipz-?o0D6D0ZSzQLd*WJ)4i4W;bZ z1?@+}r}lywgPLH7sY}2a9gGg6YxURp#sl<`*P6; zDM;B+s^WkIK~)AkVSRfor(sH@WmU)%w2M%%hf*&??7?lhA-ITc57B&}fd)EXy2mdu z)CUO|D`g{U$BFd<$mw9M;dS136XOCHL{cTFk^n15PTBi@A0^i2u0}1}`ssw5$vBFj!7}2a0SW8id;Wh$IhX&+>oYUTya<gSh1dF~l9L?=(7u;n9S#A{j)5hdEQVui~e$EhT;5#&5D6b7NAZAFr}o%vI0eZOK@J6Q5_%Sn;%#X z+QP_#;p`;HxT01+_s>B7`O!vz z4V^xu3tkhL8}vQG9xZ8I6M!Fapf^%Vt(g~b@C;du z-K?r=8hWS+&<_EiI)*gD6g}XrgznYD4w2qg_bGJub`$2y-thU{ng{XvzDw0l=ex{` z1s`sTqq=!NKV-AGD{nw6Zi&3fQM2ZdTIH}bl*Z{m?=?T=4*oLhRcETE~>;A-R4gTasV>nYjA_c)w1xT!7VQ4C;5JF z+%`6p91dtR>sZ_bBo3j0sW8cr!v~b--1=kC8T=5^rjwQ6tcT#sX{R|GA7)2Kfc1!| zVTWuTfuCF$cO3sAY*gXD1Y#r^g(V}Oi}h&CW0yzGL!bD3Ht?Km*X)1ZF6d%kJ{X0E ztXyd1XL@}*VnU8MpGwM)NCwG;FfE^V;1k|rP(<%WuRD(pyh0N+pjWuVCn+7WhZC((2^w0o`_2}>9ueUM}C2`iga@(T_=Z~Tc7S3iAt$i zfEPJaOkRN$H?QGUM<`P7jTDvBXTU8&`x-~9*Lq)Te%9;Csqja8B*@O_Y3K+^UWrY5 z@MJ#iMY%dMhp6ZCV(SVjO&(yeI_5?zbECw?=!U}P#(Qh_@r@j)W;4*)^fp&(2jfG@ zRaDiKnDQ|PH6kmoO4`qcb32ETDiXcqJKdXJ)CVBLbeM!B?}L}~m|PRqAv1({2~m2a_s*svHT zherh^o8ULg>=+^%iY6RNrJR0rf6WD%OLGG_yDm43$)mmU1_~yvD}m#a?h{+FoQv0D zGLQnrj+A9R8^1>&^@&@GMMTeS8L>%gQz_+`C`eZynZY!OOZxP+Ra!Wya~;m4GeKeW zjdoL;`rHfI9RS-`%Ypc}xg z0Az32jmm9RCb-B5GpIV1aLo>{WY$HQAdZa6p7I~#UG)#e5YrYlYl~7Jdn>C(JOJ@m z!{fhp@uSuHz_82u2@9CO7{mAg6vjfJ#8SWw?dvWLSf4sl<%vdo*ZnSgaL>Ld`Qklf z6`1w`1jJ)OWv8WKp#V1rdLNT>w*mYIx*rRP z4oe%(pG)zb>p|!Y-fKq3GTeV{M1>5QyKL@n5$SO~u|@`_QB&pF@rRdro06k=mmJ`( z<0t}o`qUrvXuCJna_3;|NyX8RiqEn`V^jPfPc7IQZ&uPY=}6tSY9e}?h$&-FKSNj< zlhCjdoN9ENnE5ShWqu8OZPAF*zS2R0T1vJ$lH=KRC8&79DQvct7|6txhE~Wa!wj_h zdDAe4*h#^58~a7QdqkXTqvUTl7iO*kc14x}*(*(`m4%^3gjUQ8w9W9=jS1JZZaR3V zBG49#B-6$)1cB;ms(Y|3&0PBGsxViU^f*`dTr1jGQLyFW^8)Tfz0?vAR4H&Y-9$tU zq(|n-c9mxSB>E=(>b9^aCe7MtOqL`UBD~rZ4K+6XRED?;H3NeZ0ZlbbL`mnrq3F^z z7g6y$-67f&jffY134R+tXB)mCH+AeUTM@*iQ4wp`dyl`wltdeuD8AT1-+wO}BHCfNiiplKIS}G@fPS7(zo6}O_ab&uy4s024L_5^HRmgUx zLdQYee|Y9O)(ew;i3T`X6Yb#KGE0{ua!=Hajm43 z>M^k!zg;AZ{fw7IIC?H(PeR>@CO0>kBRgSH(jj;J7tv8b)0e-1_nY z^^aWE*HWnRb91_7iuX8o=g0|hN5WKQ7G_q0F|TNHg^H4>fSfJuxyqJE6RM?Rg(wQp&aqlMcKHRWwBhJd6p3fTkV2*}W1$^}Xjs?J)Z0)=wUuw#u&iNm z0^52Cx$WUrfdJlPEo0^yZ6ip_nY`i>zID*hVl2DXCAxvdlz}I0IyhC7c;XeZOVF&? z^&V|vT5?_N(L2`Lm#S;nFm2KV-d%7qr5RA73vS1t@7B@DOm<_Yk=Q+RRbNr?dOx~+ zA1ZL3hYu}b>e63Zk|67qeB_+ba$rCrR_ z#K!i9_zspt@-UzWo%0lg{QKC+xfF>8hlg0AHDAn{zy|pwRW&_#3w3o=IqFWgVs?qu z@V=RT+dPvkBbXf_nRp^c$AI)4Nx}@w4&5BJV!JZU){EebrQ>JbMz_jacK~b4_@DNv zk_6KtsGo0CfvyRHEQj7c2PDdMVbE+P5To1(cT#j7!-iRF<_~MG(vAO=C|7$%_K9tJ zYbM2Nll^&waEu%&k%zkqzb>t~Jix-#1rX7f#1srzlBjVV?)ED=*(LU((l zDxq4p3KN40xcbV&W$;1`kgDjB`%JOp*XD@bC-b=SIl*K(#w8DT`J7pM?-}13BG}`H$RCapb7x7vwVw=R;oz2V*E9(AW zGt}|Dzu9D!cV3w!V)HZZn+@Wn3Pp)+1g?vsK7Sx|6IF7#_O0-U2=X zYUDp>pjA;lot(}E2AmO&jI_2x!ezleJ&K-JaXLE+R4k{&NLF0ZzCvQ)C#~nqh&!^s z=W;4Y28*)^$gP3s^}ILo>k$7VBV_^Pl4BQ>zALFqOjk#hCgb`mu7JZ+DB74E4GLyN z&=F1^i1sGy;IW1*;(ffCNfMZnqFrWtA%~|k;jXlA6q?pn@Z>K3ix;dQ$#!w87@LY2 zPq$lv=gj|J_6*?ZHVkdWCh2$iB2vrikV5K_HzU{oMdt<7i(-g7a31aR%9vOv4~xiT|e#ShIo{# z)UNFPd>)qlI`onUL2$1Wu5aU6g8d|?|BXZ-CH+d_{Y3s~o1g@nw_hV#&mX#c$_hNm z6@nWhIBXZFO}u4a!vmEzkJ14sR6{b}r~8892j=j3TotqdsudsN$1>v+L8zf4d za5HajTw!+~p~VIu&${BAw$%Z6@Ru0V(L>4@HJLh+v4wCtv6+kj`g_u$&EuQ;eKDga zwJ3>v0>goH7 zbTir_JM!qCN`L>hs=1tMsYH`y4qIHvrU_Ow!y1`NhEq`eka1FYN4OEm;3LE*B>ujH zOFrYG|8ON!<~i|XN)B86<^JhrwJwiYT-qiKm~T?lYbg5K3{9qR-hyVpO3J}!Wv&+G zvrLpZZfxLU@1L!Y4$;cW{c4+H3E(Oj+)5($C$ZZlLf0F~)QX51v;ug`4w_sgnZ!{Q zT-jz-(!EEta%tmr3Du?rF%N7_bsoeaqOu%@v&6In6)-Tl_xjwHN z=*`9j^d>XvTKCQIL__tc zlk&OT8~D5Q3L&WEtT0xd|7r|{0`xT@Sx-__vfD2KOd=AZ zeAVdeI%nli?U+vY0`5yi%9A5Zl1IwOo&=L9ZJgI9nIrwenKsW?>EQiRlVbAyjH#qc zrgFkv=^qcJZ2TD(J=&eRHHLTYk(TnSlOFu7Z+8@QQWSrmp!FVwGYi_qA#^BxO%k_$ zvV|<0nn<~c;08@*3)@HE>KulqA8!LDV$%C!yh}#9pYp}JcNTDON{{}KwGBL$x2{%L z{^`1sO21Ny67LP09|IPW`nqrB!GbImvJ*bqW;pjDfm#vcNcPaVe}W)_&z6m$SBOfDi zp&RSbQJ>;`!p{O(M7n6soI1X_^6F^GldEuDUy`DR61Wx&V@;_c#9*)^#)!E6F2-33 zn8uGBV%-)NY9B}3cy9%v=uIc0c3Gj)QS*O zjh)Mpn7|hBOt7B8WlllbqQCr^w1Q~4$6&+M>kSL(h)%4=k#sEVpt;9+y)v0G#B{i;%)l_a0 zy)(vM*w>m;iIR1ek!p%xY>f${v7KN!KibCV4POvMPRFinYytOzq{Obe?68o;`VB}O6z`O7E6*wp-C13z zX7_X`4Sht2@e~F4F-rIP5k!!YLicRjo$JR?1NXeHmutm4xCYdrSjOeN6S7gEr4uHT z%9ALEpGJw(jvdQ8s&mMpSQTEW6B_nr3gAQrKPiS%>(Ha?s&et5FXBF#Cxwr`D$jg@ z+MO#LVlMXaC}&1yes}KlhnP@s#Z~uHFFMT5sB;+)=1M^!Z?10l{1J0Ujp16-u<*8NCdz!=p;`2#t8O-u#*ahM_KyACjEe#vDX<|Hjzxt*sprtXV1O* z$jE%}%eqLPcyVK_w=#MDE9I&1o@h-YlFd@$y)5O!z!+=J9jXSUzrvE z1T;@CDyxGzxt08GuSMQ!2F}EB$ZM*xv$EY|!?9q9=d1(P%k~2Y<53pm(yFPUCCSki zYG^Ut(g$0|^{f9K8>`r&^yhV$-kQ=0+`u8`%Wf7qF_vpLEv;+yg4e(PCOoZMSq)uG zEBELkT9uaB!5k7Z4Nl)h-Hp6lwltvRVQc@9>)G84CV%R{;T|RC-t^`QTWG8e#Lj}E zS6@Ny9G79y-Hv*!Wi6iCEJ;Y3^*IA&xyIt&f(AElLDBXFQ(wMhT|J|2I%6l{u>u}rq|FN@`TkC;;}VCF%)OIFsw%z?^*dk*AeTSg)4z!KGY ziI_8nkK0ZBvQGaz-XYQsNONi5*?gq6>{n$nHP3lt6uq;{x;gqw+?IKH2|bA1 zM;0!6P`w|~_!s#azT(&1<8yPTU5JqnEYJE-@5dIGeTazDb6CxYp@$amI#4CAzlv4{ z(m$d_RtDO;j^>S7Kk(xSFqq1zHz4~_%TdVwj&{$2*P=o zdN*EK#RQZd1R7^r3S{d0WdgU^)jPGSU6T5Ei`E3V$uTcQrbsgY(Wx5>LD4q;>&=-i zYEl|h=hPv!$Mb4BuFI*l$3Qg(*X5|%K$n!d+WRwWe7zP8jjJU*-+IP7}h94*HQ^jy28!)o{3~AzJ`bP$^e}O#;g|!dm&8Dd)NrWE18WetRY2Q%gD#VhZ>F!`L?kXBIZy1{2%1 zZA>_^ZQC{{wv#uuZQHgdHYa*xCuhF@TpZM?`cKu<)wTA%+PnIqSM}3tk?n3s3M)!c z{u~g=qM|m4U;3dy6_h>cC#p!d5qijn)L+8pC4ND}CN?@r!={ImrjT(y+wLsA@7?Z= z(axs5nZ_={u(D6yL}vLKM;^?r9ed4ou3hxJRD{>;$aaic8F~+P9YU(jeP9h3SrPKi zgmfy2-5=zDajCAKS*RChF?LDr^C+&^7Sgb%^-0j)(j;vZGveP;KbUlH^H7g{QGf$z8A^ei*ie-T?(XMBdhXYrczbmWH2)MYq|$Q8Gf-SJax25gHnyECZNYWRw zxH1EJ#E5f`k@WA~uSzI;(!>IEyiYBeX+nk%O6kKn_7qp^uPaDR1!(W@_Mpf5z{`3^ z1cq<2N8s8E0+5~Gv(ciIzRKTd@@^uX3u6Wp6~+v;~x zK(b4)H#6t{JcEe<^pl!|d~q~)kNUA56Hk%L)n7(Y5xQRSJb)F0EU;OWY2F3f*o^?R zlghNtJF#^@H^*yuqM=;;O0UC3nf$7x7p5k`m#zBYNLn*Q6B1gM6fj#n!W&I*0)Ycu zcSO$y9~WyXtg4*~>|<*FHn;(5-Z<@3A~Q~o zA*TzY5fRcEY77wCG+L)@7o|APNtu4L&FK7er9<=KG`#Vij&8ZA+Q6{r66L>UP%9;b zN_UkZ*YjxAS#sk&?=*3Jr>zWTS8D@Q>ZrKssD?{c=Gw-W{&iA*WFM)y8W8$B0DJ*| z4YqC5^Jo9TwNJ)pq~H}pN;|-3EU9=c;XW_5 z?4-fmW=XQQcCReW`dgfp>5E$-U-?f@p;GM8P>O?rS58F^a0SOP(_HE)=b|jPq`E|3 zX_i!(XlGd&mQ%Tat~MmKGOvmd{nt~9gP&JVMXpUn&LPUW6JXt0nrW|;LtW82XwiE zO|^AZB^fu&+Lm;iT{11Yj$CX`i#Oy|>@1XOl2w};o7h+AsaC3wRGX6EsHT2urV`Re zLr!6;Gf!gE7rl9(fj%p}bfHiVfTR2HOWJ>UXcft6XUhGk|g8G?f?QuQv*;>>MAwH2@7Q3E!MXk(8CXqVyJHIeL~o{`rziRxipC$^KwaApI(c!&cv zdh{E^h8OhrNV_$Ik3gTUMn@tIg{?m+@$VgPhoH3sp7}Q9sqK`9zci4cIxzPQ|J-s9 zyTKy5)s||9 z!Y+EZ->8zL1;A~Ih>42QNWKp~R+JZI;vqTbFkvdr1bcM(8k4MaPg7lEMwh1!Vn${d zv#cnu-v>qi6B{|?es?(&q6`EYg&2Q7@$G62Vt!Sv~M|Pv8!;wzGuj zL!K&MOd6i4PpD3je)WYDP1naM6x7#YoclpV zsZbY>bx<6goNg92$VY+_s_O{!Qu0!ui9CA7&=;vHv)2?kG)_Ux*4O?%+>6ilj(QlE z;oMVhoI{gk)00=g1(Gjuc|zWH!^?P1&Ilx0i~!^uWHdZH|l8TeZHwN`;L zF|m;AEp?5)Vxt|3P)28>{LFT)vu=No?XD!OBhfyOQkQORb7)OuXyilithv7vKRurL ztIQa<5YV>Hblu1}UN=>0gXXZj>A=4Cdv*#cI}M4KiHnzs$U|SCBm*7c#rB|_i6^TU z)rOWye@;Hq;&0k7rb%d;qJHbMXpVZKFhgdc4N3SR^q4`g>fn-gXvX0Y$DfRWHn*CZ zv10>=?a79>KZ5$r#vOl_9z>=GQW80^c{>$2dCA$duFh%xyWL~;n1(hvmm5ekEKJ(wA8a| zYOyuZ{#O9J(sfo<8O0)5WU$H>RhVX;;GA&H6lvJUY(~xx;3q2?hXErQ2lSJb`a}E1 z5G`z$?pg=7ooVuipYVNWH3MT2y<6qpZS`^s+P+%M2Sp+NFWvY}nkq`=^@b1~8du6MLYua#VLN+I zR%g3p&-ROqtVX0%?K$XWt**!F&zP2K7hB>~GAL&q@Rg?As)9LBUM6~l^=#ZN+vT=E z3_jPk4cB%o-0B&)7MBPOK&vh|!L2rM-)$bME?l@9bkdPSb||X=(IN2IlTJ6NZJ@`K zihb{@p718X1IS3RBCUNYFb~&9>D6BDSH&$MRZpf%GK+DV_@it<>A;s_fCrnFG2h32 zGVB=ztFk*Czhi?u(MRJ(8|S&}fHcTPwI#Zyr^>$HKb#dw_wRs*`vBjo|FGm^f81KF zBof8q)wf<^W1+udu{97g;(-wLyoY?zjeOA?)e1b)l|RyzEb;*q^*oq-F@(!*2$5sO4ssc|| zwpYb(K{{eX6@J-7>G1BUFr()Mf(XD_9Jtg&=9OtaL%cv6gxuUx{P4xm*{55>F;L@S z9@RZde<*j)q~WiWLN>1~9murCt*-b_LS5dLp2T;gmb&vE#GsH`O+=>*#YJc|d(E{~ zpv2Ri3*&j#f8%VpA4Ie^4jyS$$e0KlleG?c>~B`*?7RiYa&neJWLzR|-pg{zr=hw2 zjGUx@mX@3_RZ$P-1<29ej-HpB&X^jCHyW9bvJWqV)meL`oAi^pdL=V{cG8zM5^t)^ zfjJ2&lsTdR5$^0Agn518cn&uc!f*N=eX%I_eVF5uQUSN%?VxS_SM4b=Um|M}L`tj= zEWVL>hM2Dxj4wD(gL8==)Yst#`@dMfS^j1VO-v|<2&Iz3E9a(FXv?BN(lF7f)(F!L z5+7G>59!esx$) z)nauTbdVz4O>Fg5*ti3?nu;%G5KL_S5Z<_>vzl@!X4sU{aZhNyB)5AdARG~-mfI1t zqQ~J9xg5cMGQ)p10fS=WN@b0gGZELsWgA>fM@b!x`KRU+Qo=$;AB$sTH4Un5qHkBt z!ZgfrvRcY+{_%|)oAF-v2RjuOQYP4aI$)Nb;7*ecdscghd=>Mg0iHXJmzxF%c%Ony09!ui1xP^O98iQfOzGiSuCTCniUM2tvK^*rN#1s zOCVzj@NKn8?787k5i&dXeT_9F1=w7j69i=D70G2@ZfZK3$S(DXE6&PU?4MmK^Q>4c zfbky z+$Aj|TbF%`6MGayth~8s+!C5GHkZj>N2>9IU=?b}c&9uo%U?F^8Q<~&bUX+8rplb; zN}T9}z-f};&%F&+R71}ijns!d20vB{TCEGzhhD+uHGC#Cfv%+x1dy!-a!04^`EnxL ztQqP~gzaHm5_bn83~jDEcBiErh;xDwnUURUapD@7nE)j?F+CcCwYc1&@x~@KF+O7( zZ!fty19PS+8!>EAyCUSwHR@?>(Xu9U&6n1vY$1KJ2qs&bGVs^vA?R9?U;H6GqEmi= z(~R$-7|m-40McU-5GF2nD1i`3oi-t`I{9R!T+*~)l1J5)z;rm*XaDi> zU34lKn7fHOUv9#!MD!(N`KE#|XF;jaV}Og)rqle%V3bTSq4fOxLfw@q`mZ1Q zCA>`rEf+_=%paxrY)NhA7ty%xh*}lUqzS@kn&S8~3mk7v*HhvvfGjKgP6Btcp7wIQ zvLR$;&k=Jlc%3Dr-3Y!3I(MefldWp#bRFy?f?+ssjr1dh!H9pYp_)r)GHUJC7KAqt z!DwoYx;5MJNpx@tu$CCol5(l4J|u5)TEDbTaS88E#0&U6IeTE=8q{WNasPCQzmt+P z<-nf`YP2rXm#H%+Fkn35UZ zW&xd0xcJF-&p{%xJZ10XK8R?XliULjxPP1Xtlb=2$J9cc4}I(r&6B&dOG{4igr60n zt?Yz6O9RT3nVg9U?LLx`i8dH#=?Lh&WWV@kk!xhEm6NS(w26r}KHk#7S~}*~XfyY} z_YEupQ?5U!TsfvzSLq)wD{ZefMmNnytF)vr(>>~$Q!U1_+@mzQ*tO-eJkd4roa*Hj zKrS@XR{X1DqICx7Z`AY1gNr+W*K|e^$*Kwr=R2L#ZuJQh_ikGMcE^4qnr;w1E*dUpxyM=7V`m?&7WF&bH?|DcR*wrU%rrx9VV0yb|+G%MjnB0&IYu2(v%Kz=zw9 z`#&O}U4i*u;_1`sA{bpb>h(H%r0#Ub3vEh-zj==rJo=k18DBDM0*ThQ*D`BHeBF`c zO`nY^bi(0a)Kcpo+oQI_|1`Yc{%j3&YE3L@fP&c|BDM5SM=*&;&UPT>-krv*mwG(GBGj zj8)I|>iL8z^tt)r{Djz-+cV{0^1c6D|NH{^B(OUzus2uF@WI=f@;xemJ}!VsbBVT) z`P(`N@+$(04l5z7ra`j<1pK}s#~Jh-$RV%HNUU~XH4ULC*9B5(h4qW$3aq?T4`k(G z2V_OP+=Hc}Q~?2jBv}X8xLY60EyY7}Oe~zxiIz)YxGQDp@D`yi6=2XCku|Jv8F24D z;FqvyinMMje}UQo(SW8h9UJkOdf^$WX)7no*wmwSub~^>dn4^@H@~mU`Z}PkF_j&5 zUjo79+buFiMJdK9@YDR_HdV##r(Rk(<;_nzocf8UaGlnOEZO9S)!*>m`bD=Uk18k-HAQYj7B)S1JK+4*{}?jIJGKI9%m6M~wv z^AWrvWY_Sq?QHA^{{@PqEY_rFtlhgaaq2j)ZerT|Y%rcZYBGTyRo^eVjOw9i$|ZTq zv!%*RC%SsGOJ*sIHm+J#Q}v8Row|lD0u$MClm-u{y0Vl8g;R&FUcSyu*RDcSUzuKy4d<*%)wI;wJjwC@BvX8!#Wwpg%;mX5>j*+vSpPCu|T zhxFP5x^7Xg2ddh!hz@98xD`ei_z*mtgO7o(?jXlFCSEq`qnnLrUXVI-Z0kea1e?=M zYi!B>-GjVI_Y>wscRg!q-E8lH9!9*L8na$pxud`N03N3~o`^RCK6hX{(L{qj_cYx| z2K_Ftw|wz=llQMbAC6G<$BB-AzlL{5_)kQ?B6Sn(4!pz7K4V(>5(x<_)UOxG&2@FGnl&6^ z8R&accuokiS>P5<;0gP)9id&RZ`d89LHr!Q%I)7=<rogQF%wCzJ}1S2QIu z!|Dz_IHyt)%78W8a7^mszrBM~ZeVP)@bMZiKC+a$E`z} z&83dIt;1(9@9xsQU6DB5?GT^4Nxc}6O@P!Ze-vR#Tz%;Z;fajKpfk@QUNg)@& zSkAgsw>C1=EypB&SqPxQzEEQiNDQI)!mHjkIMNDY&+do!Q*^`E9vtpb3J?;W zqV0JJpa>iS=BKDk@B|=u?<&p?mzdKO#(uvPa3{^s$FL1)_et*+h)-$5=0hW6FB3CsZ^ksJEdgdnn$i<5WADl|$m1Un zqihe81=_O?w3r4x|HCqr?Qyd8fwGSL8GFC~Jp#bk6QgZOQoev>?1`8LA^pRoXj`(B zFVq=(CZ<9002l!w$`|sCJr&a+g?~VV@`XNQ&&4!o4gk~pi}HmuV^793i0K~?rhK8z z*t;+da!7#beHFA0LK=}x_)?)9U$P^zZr%EU)~c_KU(bo|(erG7MO8<@@ z-`d0BH!67R)xPPSx5WGT433`)FE^nJ6cvi~Y85}yLO@#8)cfJd5;X1|d8~B!*BGz8 zt*vcq84~CFgV7i*XDoVFcDI1`w+GnR;Wz(YIyzLG?AH+?==hTSiZ!MrVTf^MugI@E zM$id=XvrNiVlN`;S13pBU9kIC3FLjEq0kSs_H2LHKlgKcoL@irhWY|DUebVw->~k$ zy2N`2=2(Xz*)N9BfAbmYPyVnMr1pgG2r6J6Q2Gnbey{I9$CuZBpH~yF7vOf(*A)1H z1PkzJSc0g(|Is-0!{iV2tUYE>4GLqce*5~+;E(`{{!^@^kzlmyQ#fqQ95Hjk0)f1pXeFb4uHzFmG2q%D=cRDL6PJf*DH^kDMrMvX($@1ZXZ zW(rWACv;fKue|Uei>%*ozP~>nk-rZ5h&c4WGzv$nd;)N3KalMPka6baO@%EM5Mf0z zlcS!PwM>WT8?dG^bM{18Q`p3?{;e~FwiM!RG5OX@xrUdCA^MVd_dgd>Jz@6LOFoQ( z79z=Gcwu9{dX`Z4BNQ^(V~V}>P>)^}5?zqKHHi%G*ygTVkM{Tv+j=ig_Z^bz6jd}#y?b@{*} zlKuKRbKq?Znssdpn66Wep>U)obHs+a!}63z|0gd)iOMZY>XoB74i;$60R2A zQ7!*tU7005hxDYWNerV)Q?&`9Fw72<w3Ib7w z!Ewzxa7Y~vzg2q==< zWk07Ov@BEKv+`U4s@&YK%)H;tI#I8=lxa+UPj5GiC_du4l}O6!;D_IH-OAUq{GQ;_ zF;?e?blUFOozCfROkT-PeFNV3ucYaaZ%ZPkr&J_AvdE9ivtfU^sIO)FuIrBq7scMC z_3!vnV*9qTh72&*3Dj#iy-vXF5=_RR&5U;OhWPIGc?~nW%1qAAqHco(cs65Q)gDGPIaP1NM!oWwA z3$2Fs_$#Js3y~2>PHkILv|(`DFwX=63PNL-;h{_RTWDSlTjR8-nM>{;;3h_u$Nz#6s^#CYq;OIvaW52gIzjM z``b0a!0S~ZPmc@Y?k+dvooycI8+(Efi*>}oA8(!0#5#{+V7*aQiLe_w7nb z@aybv@BYsW#=iMujm{78v|XN?EXwNz?p^L3X=rIN`>ophZ(a1ttBs=n93FvUt3QNx ze`1{jO0U|03ZiwTpPVQo(v(s7x1~5?x=*n=4dnw^h0+gG2)W1{g?e{!9#NZVJ7#$$tjfI{ah*4B&H7K=9_GG|TZ zBkuPIQG4E6Xs})YnO?-9E__)BH{m|2XX;dFTjy5$>hZw4p8nR6^gx+j#Y-a{!mfMC zAr#{#Cx(4PZ^D-GZ<3CYH(_U)Y0C0ayCCZZCi1r70~udAf07BHoUcqcfZ#0hV}0eg zl}N+pAiA*qFO?tU`mzGOIjo!I;pzgo-i=*q!wuzd@8i=AiRQ;2I9Bo~{>$N?Gxm9Q(dO1dsRdn<&ZqeV~p!98pgU9Ns?ORc>X*x># zcWZT6igNy3AZ{lf;Qeb5j@e&!YxQ4=TZ2JkBrW;+@R~5SK^)qGaP8$-P^-}c#aR%l zD>pyK{983*k0%4!HIO7d9veT??F&XMNIHVl*)xC8;L;&TNoriLzm&|x=Sdu%F1>^@ z;1f--NJZ-2fB%=6!~fbMU!V`DPKO5p8U1IH!2aKDk^fJ#191muJ0n+B2M1f1|EcL; zq6Oorx`Od_GfmEv!6yv;0~#3=OV+%R*bo^^sMV5~9yKO_xSKrwXoBA81R}VFIyJS^ zp@u_DOiZ?ArEv9^D8uS%OO1BT_NBcIR+mH6ueV)ZCV(mGL`>3+&s5Lz$LW^Km&>)+ z&=gg!FJwPF%MKjY7A_ypVgh4=OGU#BH5_(9X(PsCS|&p4uQz-;)Abav>%l@ECf0jDg`VMRA&D9g|87M=D5|c5QRn;u`^eTocB#2D#*bC(WZ4=FD8SXCa ziA)`#VjR|DRdx`Q*45>D`(m77HscE{U>#s32tOKHTRFpq%(BSD=ez0g*HQmajTD-x z?Mu$rYlIJh3ZLM`#sepU{OnJ$M-XPo2FQ`i3?Y?wWWgJ z05E6N;RIfkpRT}j)`cch>_U2pDsoC!m*|+d?Lj)4YhcI2$5^RhD0{8G1h^zePI}ACene09 zj%;zai7h1OlF^ZZ4Kul&?W&Q~U1^q1q#RlsaXv{oS%{HQ%bQlCRI+#(fJD4QW#`i zlV(orTfjNAbhjRlK=fQ<&x48X{m;-95ugb(_wlK%ul^WEJEyuyC0-Tjz9GKHfMU3? zKb9)IFs0S~_P>jYnd&R{4!TwTDyuDNem|T^Blb0Hscqe!=DeCm5zDLm$W|*!F7iSLeF8ck+1F z2px+b+HzW9ZBtWz1W1yxLqEyxU6tAkMqx85as9={f*aQ*ZJ^V|$>9t}{;=~^AENl` z^*=8>(ZfTP^vz!2pks@~4eNt9fUjtgIyy<0eM&Hy8A}W;N_0LxIpn6K*$ojZ#UgMB-^EI zASGp1!33@Vz;dq_3u~5tyNZajxUJEw9d7eeugpFP>yS!`X#tVg?7&grF1$MS40%0xG4sT4N4HBtC zMju*H-Wa>r#c+r_I_4Om0)G&V9<}R!p#XRe_0^yj{^9((9=C*{mlPH)#D)_a5hg6Y z(28w*86U&$Qsn(g)cX1B`D~{3YcVE6PR+4R#}rRPA%RLXlF8)8)<$qUb7=yb4NpTY zK@r7dm^^leIaTIH;x(hf#hD);Qw>2GdezS{VT&9ST?vnQjjc$Tk}+-kc(3F!btCjT zi+OMhQld~`0d&g8mrgvYttgE|#PfSNyPSTq?6 z?6COPU}B&1k*npHVnxAO`p1Cr4or4sfi&=3WEns70$lb;P3+krIMM8a*z{*S?d*+2 zYTqFd`1sx2z}}_M9wYHqrJv*XU?1AvSMc}fp03JXoKyT|2mLcF#v;Xa$MDWVp3Dfp z?#9nez>OECT@U>&g_o6H`$|dvgbV~fn_$j-a$2@8Vd$%N!-1K6?wA|W-TmSuKfyS|?4M;z zbNx&Ul@1FH+!eub44=fD)5!f@yg#*RM_wO#FNJtLThWGKbr(3N2-Rq532t}|&{^0? z-tV+sRmV>zLE-52z4Be0~Si{HAMqGpKFbuA9>RWQnh@!X5wtg56Lrd*3d3HkG zAqq_)m&8bQq;>8UjyRYqE4a=^?f=J3T*W zU6__I{un6&?@u6TV+E&#Pagd3BvCd#tUlRyc1&3ca1>h4==84{<|9Y}V z2Zbzn?iv5=%ufeDKmDI#E<4wctpKpC@sPgANIy8Vk5z6bIA-DYPzgKR&JD!mTb`}4 z;(~j50OI}RxB9+b>H;OH%=Bk%$MqywpGaLqU%$~GY^g2z%c7O{WG##FKTRt<26ICK zo^X6wC+>#gpiE}Je~dR7p-J}MIvY3Rs{pKp0jynH#k(zN_m^uj;akC8=yiqsG7Wj~o&nRB#NUMELxiMF*Q8a1qmP~; zNl=c0geq}aLQpY7kcp#w&p?MRI;ga0FY8eeG~aBks6W3hUM* zD%FAtE^~9#(NrVFA&g-(7tT4j6l0Aej#@HeaoGFW$-M1luCv>xHx&v~TPY)m&+6#U zb&60MiBxpUf%1H*?;$+hi+m{%^jNx{iiZ7}R3>|6VyjpdD&QX^w}PL4cHE2* zkZQyfL%D6$&I)L8O^#5LFkD1>*{bEbbmo9val2At73mL>CU~L0)*hx87s%ls+m>Q8 zjB=yYQAWiq4G($7=}md~+IJqj%6D%?-n_oN@Z98h-v1JIc(l*ku`a}(S`;%8>n&Vv z{|5g*^|G!$Huv^GK|nCUK|oml|Co;2KXbSLjpw8&2`Qinp?`(tT(!0&!(!4$pdT2~ z;Bm5yf+tXp4y!DPXdpUgGTIQVT@SiqEq3`2R$(#e%EnL}UYPg_93bt2jt|VA zdNQ7SpL?EXeEUAULHAHrC)0zD12hba`W1Q6%Le1c7M~3s5Q~^is4vGw&Fvtk^mdnk z#t;qjs)w-8KSQ!j4G7eck>hUgxVC3RJ)7y` zIo3ByqjVlZ-m<`!9OT_I zD&D2veb$9%3Zg&tpeh2-OagOP0;%@+{E1J9qltxjRwi(BliyFa9AXj-rdY1pCzQ?#wl#D)3)_&s4W&272&qI)W%PCz<0_cd_CnVmx^gi_y$*wyk91!;8Ep ztr-VcRV6iR4I$K7r}Mg}_f{CP2t{6tm#${{q{@e{P}ONPV>yaV-Y_ApB<0+!CFqT2 zdp<-{f?CQc7o}ME*J%-PU^w7gLUA@vsL3L8mI3d^*M^lF}hLYPG!W5q^dL^aQL zD{XGmW4xe%uHf!Y4Sq_@(KQ3DBQDa zPaBXR_0V?p4anB%`J->EhP)rGuf0`CwZffet5T1#iJdxc%1eSEL>!n;?_JG=Z(n1j^%tQ^5KlULHd4to8iaQhh^qqhnne`4i7OHTqhq9<7V| zZCSHghhrr~T3lp%SSlE{jXFSrXLkR^vRmPz`w<>b}Ml~)KbyG=-DOHS+vJ97>`NXq< zo(w~|DGA+Hf$8>|vlgNQLg}1Dn>Se%Z`0eitf=*#0VQHB>0S95L3*P`_=(Jwdq&+^ zB)S0&n+Mv$GUnC%y94>_>;1q{e7KF|>OP3vck>LmP}{ck1+h0m$as$8vcEl^OeI3c zC(=xWCWbRxNjDmf=tTK4){RP@_AL0+;~sH^zuCn8IVcJU?NNjDaLbPjqKlO)@10=1 zz(5d<0?^N!i>L_xjK@E6#VGMhsTXGAa=y;iuPLe#wo?hJR2aTdWk6xlRDgY5?l5B9n-;{J)3_G;c4@BS%mTqi z`LBTyzPdd&9F`6G(8&vOi@WJ zaRU_~sfFq+zkpY~UeOi`nRp$<2jZD5)f>msInz|(XaMewnw%bc##3=tII14+g4SxZ zIqjTxrN$pb-k{ZOdYV$Vu4Vrum4|aV$L;Fk1ezM%FY2yo10;hV$nU_g>6VX1>4dF1f?@e>ZI1bT(eesPss1NB3RpyRhOj1@1N5b$L z;u0Axtm`Iw!M4dMOKMrWDN4n-yx(eD6*DL?;)GdfHQCb`Y^4J8{Aux_qPv$Qv%r&K zyBq1JnOYuo8STqzi=jUZV6eY!e(?9n_YFRnKRhkR1ncDsq0BBdY06ISu|@TOGVS9% zJnd(_q`G**U7ZN0WU@#uGlD`6-)elS_ z+!uI7Q9sj=4I{!B_c_B2>LXXMOH6tl*`lV_jLn)jV zVo(Xx^HoUigxxLcAm!=77wkupqLes?=nCUN{jK@ph#}~VEFh-*!zQpk6`8XG{2E!p z6QehvD=q+H>$Gf*T3D$*G@)fcVRsbc0mf74V_>q?0CGY41KR^mln$bml;vPe*VQkv z|76yvYHuy>{sszabJr>_-X^R6Ng%53oxpM-AnS5P2qf4|E;ry*+N7aM=}zYBfK3w> z_)>x(w-dm-M=%5~LE--NCU_51O={L}&nnL(ecsfPEwGka5FgWpCHK&ag#^ROfIft9 z6qdKA=0qBl$J0!zrH%42U4St#cZ+M4&;Zld&qSb|Lfsk1yO*L!Yg7~hK=q?A;^oI7 z@CQ5)p8oC?d4@?+o!-Xkj9Mv(+n{5p6>r<^Ie`CY@p}%VRFLau3)`017CkrMP|+&{ z%o@>;fU@2)Lr5vtmlyNPNd2vY>5>S6l&}b&ascvJop7HPoH0Vs|a33d!R0<}g9B)=+}DqOAFZuepP|fR_3!*qAIoGVPFuJy~8vFyEy} zXFc4^n*ALiFY)W6_vS#JG>t&wQTh*6@#Pa%;!)bqd!U5x70N_9{ukagd zG6tf~kTTB<+N^#l`w@kh!;CX6rE$x1)vv{}tCB^S>}$IBEiqp|d;>pqP0FZ0aC>W>7J z6cTFFoB&d5Qev2B%K&Il_;T)v?vTI<+4Kx#$C?^-8@npE3hj$UYdbL=Q7OeO>#Ca8 zl~#AGF3pX~mDTGkyT0#^o7pK@)cY+FLo9PrNxrm^yH_dLX>Ys^~$M~|Dax7MGa$yiSW}<4XAor z|1*Z2v6!qX*R@Fu9ffH!$4HEil54c1Entzo=RMeVORVYH_w24^L;36eb`Z%x__?YW z-^6+FP~+@v~Ikl|X>xFdC^yg`62_e+bD%R*s$ga$%&bPz0u{7~GSnNX4vYAusmd^GI))d)hPB~udXs>D>qu~fx0lZ8ZCw<4-AC5cGSWH|}A7F3UM zGA=jtBOVcgf_gOBUrw9(zeu=dN}Wl#Mt-N&XvDuX6eV)(5JU|(M$FY)m6Bff;sttA z02~}OSJgIE$u1~Qwf}S$K}846|6*NGqPn>lu5PqXm1|0|S1u4u16WH9bMX?;4E%-R zoGCyXpgu3oJZMO6;vZ4fTFAz0Be>PHD6W!Mu>JQl7o}v!;^Cdgwc5td;UC3SEPka@ z%*#pT)wn{7Oxa3vz2B!Dc|eZni`j#T*-~tu1n;WTD74E2)XKMju^* zdTWa0I|5VX_7k3;b|teJVk;a`XL%-h7fTw%$th&BerYFqpawf;nCDPHT6wZqKdV)V zNM%MSxKEQziz>`AcC08MAo3_lGNgVaDhdGywZ;}}*8y8VxnoCy_Y4fc*nCdfnO^b6 zj1DeS=9YCVElZ^ub2POfKZG?foE8EBGv@z-XZABF+S5 zvwu=-qR*8!EEY{T`Q;UU-3QN7`h^X0p(7$q;Ny@?N+_&9KzQTE@lP|>(=3^MzearB z#8wlfBHS73q_?PC!hsc((w6=TYHu*>Qd*(GS;oG>QU z*1?k!-*B^2UTZ9E@X|tKU9@!1>gg0B|LBzy%qNomeO1f~Ge?l}7KV&&cV)q2hECUH zQahihyeq-96ivDsZ}$fCnQTSB1xbjk0Nu<2IyRyNlbYoloGt8M+QUY@gM)s|$&xOr+Wg}T@o>mf! z-73Kx&0<<%Tachx>Dt;hgl>`4s4zSQ-ugz{#kdapn0Q9InEJ8*lZ8Gsw|mLPMl0KtiDYo^92AD)B}h z*LZdCEgAB`B@^1xm}p`rAm2~2XmlYz7+pX)CmJh=TP~4pxpp8OGI)|Alg6lT=G4-> zA{Q5L;mE)j9z5xSNYzKglSJ%&PoHHWbH=Ho&Y;s(@5X{niX3o(pQV8AiUqn|H6lR3 z>YX%0HB}zEK!K9Y#ZU`Xu4|Om4{F$w52B8ss_9EB3B@aVpVH{pI|DZilpu!)OH}=# ztd}2iV=w92Ie#K9E?l3lQi8AMAEyqmM?D_lWJ(0IGvVF@nE&!4X$?xn;$Q}W=W zSVYP4FP)g{*TzZP8yg%zjy5mZzZ!^S(7j1#>AY0Kd!=@Q5;M%re#h{Ae_Gr2bmgsZ zw%y^n5js6Dkq^-HWW9g&U5;)~^JM*x)~-9Mscd_LQly05Q9w|7uhKh62|b|`>7Y^# zNDWOuDT2~LT7Xal6anc1(v%`iijm#}2!!7G#pld8&o{rB_s2U~cdc`?*7tqq-m|mM zUAcRo-M=J`;4;n7P)F_}kmp+Q`ihaT`)EnmdQx_Oy9wz9yoAScIx@HyBqR~~(fw^6 z8joE_BO09;wWUKlmPKL>Kf^O0h~ryMSJz&1m4X^I)OO64GT4z*S$h=Lj&-}}u#yvK ztuAoUsJpWiy(EINh)IT|4%2RFhF)&$SSrE^v$^GGD-*MW3GB7e9^TDwY24k-VaZzDjlUQF z*uf+~$Vf&$xObe9I^;7?w19p3bq(ow?QjaNy8V=g1J60D;0BL-a*$j0+UieQP(bzP zp;D4pIjVg&!_H+%Xdod0SGA?|S(-f}!ILx3i9r@mO#D4sp0Hob-Nr_+Me_H&I8#g{ z&~$J*W1+ymi!TulV!mXha=Z&a!bT(F#sl~u%U0>7pY{NDv({D}3$;^=YaZU9<2rKb z2kOJGhng_^$$M&_(hc`&1C)!rGG=r)c<*Z{tB^N@J1dGO-Hn&z@YY#{BacE9vUy8M z6Y)zfvpu`q71tIU>28sBMfyqSwZ{Z{BV<|Gcg&zH7y_>g0yWb!@af)P#;&FmlryYf-_f~Tf7`y(0kxA3@?f!TVYPA1i7rQXHdev4yq z*HiI95`{r>A%4A}XAL*Z)pbL%mU69ZTZgrK$l)QtN2Na81C*;u_W0Q)1o`5U>D}N8 z-4@F<;$Fi1xsZXkJ~yte#CE(Op*p?Zn5;q0;fziRPQAWmM!l&;GN%c@&#oXXtxrZ0 zk~vXr7nNT3@m0>7;Y|lI2`co?DJY@YVQ1_Jw;e)_!-|%w%hXr@k`*7t0L)Oj4VYNS z>pKNxG=H4F#7U{6Yh=lwQ{r^Dd+!Xly_xUk;lmk`yps=A;L(8orOh2uy^qpgu}AWc zA2nK8HQwKW?ZN%E=)8(Q$}3qg+;~H19$wv;hv<-RWlE=bntCIcdJj8yyQEJ(;qv4- zzt?e$y1(J=&|;t*Ox03hOW^+b&E};n=E>+tU;L&JxzE0>>H<5A;uo5!$hqnacbbHR zybiZnI)=n*)^Rr#<6Eb?WA#JcABqcY()*h$j}A`p59*}?nd!lhCpI4j3op!#^Vm|+ zy5bjU7nk}9=iuBzby@UbiJ9?lbUH%{o6*xiSl3d}mc0H`A44fD7A$H}xL&xSY~%FY2fJ;HM9zA>K8i6T<+<_v4uNpzlmkbr{V3Xz@bYPmY|L` zjbJ{Vs1Et0cLT|zK@%^5!1C(U*9PGq=xsWvXHN%RS4+Fgi0yIP(AZxX?8-PCYrA;( z_3H*qmb!}9JbCBxHwW7YmtLwaPMwa7#TLxtjg+tzmtD!ivFMm4BA|{kgi;ID0IzAd z<`s8>MpQ{okw=vSZn6%Ig&h?G$;Wr9mL492QEpYgZEezT>vn`k#pogphQy7^yB^5} zhFlIL4HSU1R^}`F3{Wsh+ieuLNysv%}G81lS!$4j|jOZ_JA7b1BEC8D7(_Bt0?b66KUSGJwZUbc&gNr80w)R=Ch zmUX`V{B7G0q;03&mbSX}E+kmt#-vB(UhBH(x_^3+Bp+qet2TM4Z6MA)%Tb~TY_z)y zxkcAhCV(`1HfP@=Ax2*w*)3?R;ka)P-m|t)u=O(DA2IY$Um5|Ls+Tv!QRq8G;HVbw zQi~v`q>uD9M+3Qr8|r!=Iq4sSzHbsNWjG7W#fOb}E%JV%d#1$KbjEbB`h|}vY9iZ( zFDeIdHNkRi#=a{Due1+ohsqwgZQb@Xg{3lRmBpW+LwNW3(kcZH)+`aff}jdmiM-Lw za<;bJ@v89lOV(J#v(wI)qANjKPQ+#rr%&}{Io6g3k4?+7MfNJy->FK0$M(pQ|m zc|KmGwrLO}lEncAkQpbX`xh0JK-ZZVF!|lqq`(sHz0F)MP(jyvt^x?PD+{#%Id?FX zlyH|#DtnOciGH-{+n#|d3|>BO zgnCi|+^oGQAGQp!?ai)f8Pz(yzN}oZj_34h(vZ~DEo`bKA0zt(m6%@8w**1)NS)8- z-*RNCVRu1$Sl1xcaZ7Ij10VfY5=$aciL2^PS&Dk^ox?KHab(Fs^KJlfqi8{rXc`{mF=%4lP0p3D+Uv}Fi06krLX`86 z-LI>7%40<=&$z%3w8E$E7PSggbi?&aFmfBxYq&~^^#V()H<#OK-Y#8BYvl$e@Gw&+ zm#L)xbq~1drZTLqP{NbL@5pB~w4-|!X4VAv7O0+7!mVx)e1kSk=Ok@hp$pKj>=Ch+ zG(D6ih4)4>(du#W;ixbOO{pYRU16{)!71`g^N}hO(}|cVH7m@q4}M>vCTr%a7PdyY zsaLF#!I5xXg31i}Qh}Yc-xM_BJmSqS!Cctq;#**AT(g*>W?Vy^*a@zoPTnsq|DyH8 zy!bWrKBA>SGhQV3nZuQus}7K29O7E2EVd(kA;S(!4xnNwI#`o8`tTZ|67OxVGL8}F z9Ip6^>q+84%l!R1{N2Wm3O)O^qqGw?;i&Q!GQ9X29Oy6y;Xs2 z+TCIMhK+*I<5Q$%)GigvE@4xX?T7YhaWWIqT#4XWNvtll-dm*TrGT650gZh58l9Jv zahR2D6Q??u5&ogTu~3bBxo_gCbkOUz`cwL`?3N)|cSRY1xn5Zku^Lv%$sE&q3x^EG<`s)RbH9o%9BB&YVcuL24#M6d)yh4>WgcwKVQRAKV% z*p*B^?O+pDMOuR>{ye$*h_}O*P=d+GDO;#mU_yBT^UxkN*fj?-4D1G{G#u})Z@+yT zt@?^Snv4aYcac?LvVMt4mr-k=8@~`grl1?ah?1IzRuQ&VkC{Xy6S#Ub%3l^O&wcHI z7$kOUAaZ>@VG@FMLDwe)X5cd-_C+u_TKDdUzV7h?Aw*&%Q2N)N8!M+2FTQe=>Iw){71qnkF7_J3*0dBn~wfNe1oEE*uQY z<8YnzD!q;&dSsK^tY^sEOI8{K4#T7S)YpI<6k zj-Wk=&|`I2;iw5J5*V?O+s_&|rQScN(adZ^t7p1n+mfATw%1NqK>PHLd7vv?8-mCI;np2( zTUj$2a8O9rXstYB;AguDxDr#`tD1fEBjPG1394b4;&&e)H`r&`PF3w?>ayb!mj``V zkyob3a`1faimzU7(}!%fK_T+G(_JEWx(LT!aB^GG&!ivQ1fgBa*OuqcI*!f)LXV}# zAnUDrRHWqq{tj3czF)^#00SI_B~VfmUOxRP*;dnxu&tg+3bwqQs7tLIg@`^b^QMBU$Oo%J)b`#o7xeQK!Ga#$ zoiA+pf~_)^&4z4J8yj4M5)DA{&j?NY6W*z~4H~0d{4h~LZ5L1Zj%D5V@#R9#+lNv8 zEl5c1lXF6%3rp*zw(@JTy;b=SSj`wk9n7enZX4Z;jcOV)n_DuhN-i0XPL8T&r$!sh zUyU&}YU^THX8lB?ICa+P+o{$*wYH)$AHeo#{Di{tewA$&z?)AEzf)7sQ+wW%*8ZxY zm)s!Z2%9Nekl@nR@v3sy$TN-+CcEd6N?ckIz1;Hv)20WNevFlVxusU>YW=Y@jj-2S z044c$U(qn46>a`}CX;RU{lQ6#m?G<8LklH=EjnbsEy{~&c|>L)IYoV1uikNF=sYfY z?PADm6-iMBw%1aIWx&0r^H(|GnWh>AF`2N9ZXNz=<%H{Kh@r1r$FyFLjyc`3sWiM+$P+nK|F){U%mOOFU?jX` z8M>^pLnEatwfWI%cM5vQGv8B5(-hS1Yi!>~89k{rtS+**djI*@Z9vTWmbKVko~fbR zK!3*W&JwZfb|XmMjZqlZ0K=rpZd9D+JNVYv_-^LBm&<6K%xD_c;vuyoIPg6S(358# z>X%i1M6bv4R`l_t;iqq+lq}`S&=;zdKH}Fpx(q4j4*cYviK8_hU*Q<`mJ4@P`{vFe zF(4bjE!(oQvL=)Lu8n9VE`WiAKlbX3szqz`k+#+Qm%dzXGsAUZDQFtGumrj$GOG(Y zt53`e)B&=u7UC{f^`lKs8D7oRRLluX+$DP@#A|ggX5OpQPVVcih_84&ByA0<3R==v z%#ex$&tsk!no0TR6jb7yeRJIxM69k`Gun3t@@~fT(#Z-^PkoLW`oO0Ewjm%{yxL#R zSS@j_1lGHsejPV|pTW>S7UdV-JJboYBdb2aD|5N~IXzOXtXTgZro&K;z%d?qLoVP;!+H&(^sHbq|k`qPu?YJBghXV)m!XR z8EjBFH#~!y0nk;|q%X0W5)mchPccO*-gTR!Zt4v5yvWb?h=O%AtuMO-2p?eAd<_}A z)-sD5Aim`*2WihZqMKbOQIx zJ{PHjk6sZIm|7kl!7XTD7!M?jN1oB*NRpJ|$aMVD6M@G%=u>94`T+j5Ot4p&OI~$Dl}aL73-ROlJcG( zZ7_b*im*Xt3`hKCqWA)Qncfe4Z=PN+{^Zq}*nDWiQ5_8C(IE$W2izbDZb?xQIXj&+ zFV@MDe_<|IF#}feIPbp0a8ePid+vNJ=sxpt6?X0`-)se8$v;K)kb@ve=nRx^bGZO? zQ~am~ueI4j@09ID#s#wfqT7Gs!`FLMrC(iqMw*1C_IgG0V0r6S>2<7zG`4S~l6aOj z@{!o{A2^te7<^Ol8l@3OqBQ=Py}3^b(tB$RgEw>10ywyl4Ml02Y6Kpnd)tL5;diuN zUmV>-ziM2*mHBP)Bp7v)v>~nk?Nk1|kNlh&Hu8Y}>Clc{ecy^`ea^C2)!=x(;1?~T zm@A!xC}FAA@zM>!{UNArG&!iF1J)mU66^Znt4X!ZRKcWC_X)mOM%9;vz*52RwB z#7~gJOOPW-kRwTu!%mRfgNQj>NH1Ooc2f##bIVJQ(UuSd%94m{ z;Ic8xl3OAY=`(F)nGTw9xt>o*<+R2gL;BhiTy{u^C&a$_N! zd^PdoXu1AJbs6_dK{a&CyYx8lD0W5#1Ci6i*DYgCQHX@W+T)}6uT8UFvdlPO7rwB&ay~YD8_RpSN{G9SkO6x#|m}gzr59FQ%3O(Y|JjWZSZMSw{OA7r>)Dy)DIe)`&zO1oVl z7y(|rZI3%2I)f+tNG=8B=)}O+90;?3`5r2|+XLvj)}GY6)3_D0AMTpHP4~1FgHU%B z^A+U~dy(0B(y`CA`u3F@U(lF!SpTO+@gf9C-w=|5A@61&V8y!fDo6_&dYNy4w^-#~Z_&cS=nMA5wLaK}L` zXL?g;0|p8b4L!%+8Zgf`O@;)!Iv;!d>NMYm1KE9;|0 zMoINU$khw%pEllT)?qO#$}DMuv2AnAq4z(tad%HQcY9B$v;6}=w<3vxAQ@JR|HV)Q z{;gUM#rOC$FTV`9mhqwemtH{N~L5b~J3iGyQ8cHvdHRBc1clWBYXiNdJv64@3CJ1pIKme+RztZ{UId1plSy z{yRoYw8wAl`>mqDtO>si=Pw!mel7T+_rrp}8&YheAcM?xEG$!u31g}&|IzY8JTZEI zJ2l?}O@KevoWCrt{HxTj6`X(9$`2vH+`E62`futv|0?-wy6;a(U7LT9{C|>ve^vN3 z%>Ji>q}zX`@JrDBfAIejmi?38+2g;DfD|7EPvpB4Y=5$C7k tcJlwi$bWm_`Lpa_tvWwtN7MdSvOm`#JuO_k?+O%{4=<+oBK`Z>{{gCB=XC%8 literal 0 HcmV?d00001 diff --git a/src/main/java/com/iqudoo/framework/tape/Tape.java b/src/main/java/com/iqudoo/framework/tape/Tape.java new file mode 100644 index 0000000..3f6f513 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/Tape.java @@ -0,0 +1,172 @@ +package com.iqudoo.framework.tape; + +import com.iqudoo.framework.tape.base.action.bean.ActionState; +import com.iqudoo.framework.tape.spring.RunnerContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.util.StringUtils; + +import java.io.*; +import java.net.NetworkInterface; +import java.nio.charset.StandardCharsets; +import java.security.MessageDigest; +import java.util.Enumeration; +import java.util.UUID; + +public class Tape { + + public static T getService(Class clazz) throws Throwable { + return getService(clazz, null); + } + + public static T getService(Class clazz, String name) throws Throwable { + T service = null; + try { + if (name != null && !name.isEmpty()) { + service = RunnerContext.getBean(name, clazz); + } else { + service = RunnerContext.getBean(clazz); + } + } catch (Throwable ignored) { + } + if (service == null) { + throw new ActionState(clazz.getName() + " not found"); + } + return service; + } + + public static Logger getLogger(Class clazz) { + return LoggerFactory.getLogger(clazz); + } + + public static String getNodeId() { + return PersistentNodeIdGenerator.getPersistentNodeId(); + } + + private static class PersistentNodeIdGenerator { + + // 适配系统目录分隔符(Windows下自动转为\,Linux下为/) + private static final String NODE_ID_DIR = "." + File.separator + "runtime" + File.separator + "opt"; + private static final String NODE_ID_FILE = NODE_ID_DIR + File.separator + "node-id.dat"; + private static final String HASH_ALGORITHM = "SHA-256"; + private static final int NODE_ID_LENGTH = 16; + + /** + * 获取持久化的节点ID(核心方法:首次生成,永久不变) + * + * @return 唯一且不变的节点ID + */ + public static String getPersistentNodeId() { + // 1. 先读取持久化文件中的ID(优先) + String nodeId = readNodeIdFromFile(); + if (StringUtils.hasText(nodeId)) { + return nodeId; + } + + // 2. 无文件则生成唯一ID + nodeId = generateUniqueId(); + + // 3. 写入文件持久化(自动创建目录) + writeNodeIdToFile(nodeId); + + return nodeId; + } + + /** + * 从持久化文件读取节点ID + */ + private static String readNodeIdFromFile() { + File file = new File(NODE_ID_FILE); + if (!file.exists()) { + return null; + } + try (BufferedReader reader = new BufferedReader(new FileReader(file, StandardCharsets.UTF_8))) { + String id = reader.readLine(); + // 校验ID格式(避免文件被篡改) + if (id != null && id.trim().length() == NODE_ID_LENGTH) { + return id.trim(); + } + return null; + } catch (IOException e) { + System.err.println("读取节点ID文件失败:" + e.getMessage()); + return null; + } + } + + /** + * 将节点ID写入持久化文件(核心:自动创建父目录) + */ + private static void writeNodeIdToFile(String nodeId) { + // 1. 先创建父目录(递归创建,确保多级目录都能生成) + File dir = new File(NODE_ID_DIR); + if (!dir.exists()) { + boolean dirCreated = dir.mkdirs(); + if (!dirCreated) { + throw new RuntimeException("自动创建节点ID目录失败:" + NODE_ID_DIR + ",请检查目录权限"); + } + } + // 2. 写入文件 + File file = new File(NODE_ID_FILE); + try (BufferedWriter writer = new BufferedWriter(new FileWriter(file, StandardCharsets.UTF_8))) { + writer.write(nodeId); + } catch (IOException e) { + throw new RuntimeException("写入节点ID文件失败:" + e.getMessage() + ",请检查目录读写权限"); + } + } + + /** + * 生成唯一ID(首次生成时使用) + */ + private static String generateUniqueId() { + try { + // 拼接硬件特征(MAC+系统信息,提升唯一性) + String hardwareInfo = getSystemIdentifier(); + MessageDigest digest = MessageDigest.getInstance(HASH_ALGORITHM); + byte[] hashBytes = digest.digest(hardwareInfo.getBytes(StandardCharsets.UTF_8)); + // 转为16进制并截取固定长度 + StringBuilder hexStr = new StringBuilder(); + for (byte b : hashBytes) { + hexStr.append(String.format("%02x", b)); + } + return hexStr.substring(0, NODE_ID_LENGTH); + } catch (Exception e) { + // 极端兜底:直接用UUID前16位 + return UUID.randomUUID().toString().replace("-", "").substring(0, NODE_ID_LENGTH); + } + } + + /** + * 获取稳定的系统标识(优先环境变量,其次MAC) + */ + private static String getSystemIdentifier() { + // 优先读取环境变量(容器化部署时手动指定,最稳定) + String envId = System.getenv("NODE_ID"); + if (StringUtils.hasText(envId)) { + return envId; + } + // 兜底:读取MAC地址 + return getMacAddress(); + } + + private static String getMacAddress() { + try { + Enumeration interfaces = NetworkInterface.getNetworkInterfaces(); + while (interfaces.hasMoreElements()) { + NetworkInterface ni = interfaces.nextElement(); + if (!ni.isLoopback() && ni.isUp() && ni.getHardwareAddress() != null) { + byte[] mac = ni.getHardwareAddress(); + StringBuilder macStr = new StringBuilder(); + for (byte b : mac) { + macStr.append(String.format("%02x", b)); + } + return macStr.toString(); + } + } + } catch (Exception e) { + // 忽略异常 + } + return ""; + } + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/action/annotation/ActionConfig.java b/src/main/java/com/iqudoo/framework/tape/base/action/annotation/ActionConfig.java new file mode 100644 index 0000000..523c0c7 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/action/annotation/ActionConfig.java @@ -0,0 +1,33 @@ +package com.iqudoo.framework.tape.base.action.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface ActionConfig { + + /* 标签 */ + String[] tag() default ""; + + /* 场景 */ + String[] scene() default {}; + + /* 用户组 */ + String[] group() default {}; + + /* 原始数据 */ + boolean isRaw() default false; + + /* 模拟模式 */ + boolean isMock() default false; + + /* 忽略请求限流 */ + boolean ignoreLimit() default false; + + /* 可选认证状态 */ + boolean ignoreAuth() default false; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/action/annotation/ActionMapping.java b/src/main/java/com/iqudoo/framework/tape/base/action/annotation/ActionMapping.java new file mode 100644 index 0000000..16b6f2d --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/action/annotation/ActionMapping.java @@ -0,0 +1,24 @@ +package com.iqudoo.framework.tape.base.action.annotation; + +import org.springframework.stereotype.Component; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Component +public @interface ActionMapping { + + /* 方法名 */ + String[] action(); + + /* 支持环境 */ + String[] actives() default {}; + + /* 排序 */ + int sort() default 0; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/action/annotation/ActionRetry.java b/src/main/java/com/iqudoo/framework/tape/base/action/annotation/ActionRetry.java new file mode 100644 index 0000000..d8c1ad7 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/action/annotation/ActionRetry.java @@ -0,0 +1,21 @@ +package com.iqudoo.framework.tape.base.action.annotation; + +import org.springframework.stereotype.Component; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Component +public @interface ActionRetry { + + /* 失败重试次数 */ + int failRetry() default 0; + + /* 重试失败错误消息 */ + String failRetryErrorMsg() default ""; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionAuthInfo.java b/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionAuthInfo.java new file mode 100644 index 0000000..286bfc4 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionAuthInfo.java @@ -0,0 +1,80 @@ +package com.iqudoo.framework.tape.base.action.bean; + +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.base.action.interfaces.IActionToken; + +import java.util.HashMap; +import java.util.Map; + +@SuppressWarnings({"LombokGetterMayBeUsed", "LombokSetterMayBeUsed"}) +public class ActionAuthInfo { + + private Long userGuid; + private String userGroup; + private String originPlatform; + private String sessionKey; + private Map attribute; + + public Long getUserGuid() { + return userGuid; + } + + public void setUserGuid(Long userGuid) { + this.userGuid = userGuid; + } + + public String getUserGroup() { + return userGroup; + } + + public void setUserGroup(String group) { + this.userGroup = group; + } + + public String getOriginPlatform() { + return originPlatform; + } + + public void setOriginPlatform(String platform) { + this.originPlatform = platform; + } + + public String getSessionKey() { + return sessionKey; + } + + public void setSessionKey(String sessionKey) { + this.sessionKey = sessionKey; + } + + public void setAttribute(String name, String value) { + if (value == null) { + return; + } + if (attribute == null) { + attribute = new HashMap<>(); + } + attribute.put(name, value); + } + + public String getAttribute(String name, String defValue) { + if (attribute == null) { + return defValue; + } + String value = attribute.get(name); + if (value == null) { + return defValue; + } + try { + return value; + } catch (Throwable ignored) { + } + return defValue; + } + + public ActionTokenInfo createToken() throws Throwable { + return Tape.getService(IActionToken.class) + .createToken(this); + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionDocInfo.java b/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionDocInfo.java new file mode 100644 index 0000000..2192835 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionDocInfo.java @@ -0,0 +1,43 @@ +package com.iqudoo.framework.tape.base.action.bean; + + +public class ActionDocInfo { + + private String apiDocId = ""; + private String[] apiDocActions = new String[0]; + private Class apiDocResponseClass = Void.class; + private Class[] apiDocResponseParametricTypes = new Class[]{}; + + public String getApiDocId() { + return apiDocId; + } + + public void setApiDocId(String apiDocId) { + this.apiDocId = apiDocId; + } + + public String[] getApiDocActions() { + return apiDocActions; + } + + public void setApiDocActions(String[] apiDocActions) { + this.apiDocActions = apiDocActions; + } + + public Class getApiDocResponseClass() { + return apiDocResponseClass; + } + + public void setApiDocResponseClass(Class apiDocResponseClass) { + this.apiDocResponseClass = apiDocResponseClass; + } + + public Class[] getApiDocResponseParametricTypes() { + return apiDocResponseParametricTypes; + } + + public void setApiDocResponseParametricTypes(Class[] apiDocResponseParametricTypes) { + this.apiDocResponseParametricTypes = apiDocResponseParametricTypes; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionParam.java b/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionParam.java new file mode 100644 index 0000000..d00131b --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionParam.java @@ -0,0 +1,164 @@ +package com.iqudoo.framework.tape.base.action.bean; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.base.action.handler.ActionHandler; +import org.slf4j.Logger; + +import java.io.Serializable; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +@SuppressWarnings({"LombokSetterMayBeUsed", "LombokGetterMayBeUsed", "unused", "unchecked", "MissingSerialAnnotation"}) +public class ActionParam implements Serializable { + + private static final long serialVersionUID = 1L; + + @JsonIgnore + private Logger logger = null; + @JsonIgnore + private ActionRequest actionRequest; + @JsonIgnore + private ActionHandler actionHandler; + @JsonIgnore + private ActionAuthInfo actionAuthInfo; + @JsonIgnore + private final Map attribute = new ConcurrentHashMap<>(); + // 是否抛出异常 + private boolean throwThrowable = false; + + /** + * 设置属性值 + * + * @param name 属性名 + * @param value 属性值 + */ + public void setAttribute(String name, Object value) { + if (value == null) { + return; + } + attribute.put(name, value); + } + + /** + * 获取属性值 + * + * @param name 属性名 + * @param def 默认值 + * @param 属性值类型 + * @return 属性值 + */ + public T getAttribute(String name, T def) { + Object value = attribute.get(name); + if (value == null) { + return def; + } + try { + return (T) value; + } catch (Throwable ignored) { + } + return def; + } + + public ActionRequest getActionRequest() { + return actionRequest; + } + + public void setActionRequest(ActionRequest actionRequest) { + this.actionRequest = actionRequest; + } + + public ActionHandler getActionHandler() { + return actionHandler; + } + + public void setActionHandler(ActionHandler actionHandler) { + this.actionHandler = actionHandler; + } + + public void setThrowThrowable(boolean throwThrowable) { + this.throwThrowable = throwThrowable; + } + + public boolean isThrowThrowable() { + return throwThrowable; + } + + public ActionAuthInfo getActionAuthInfo() { + if (actionAuthInfo == null) { + actionAuthInfo = new ActionAuthInfo(); + actionAuthInfo.setUserGuid(0L); + actionAuthInfo.setUserGroup("unknown"); + actionAuthInfo.setOriginPlatform("unknown"); + actionAuthInfo.setSessionKey("unknown"); + return actionAuthInfo; + } + return actionAuthInfo; + } + + public void setActionAuthInfo(ActionAuthInfo actionAuthInfo) { + this.actionAuthInfo = actionAuthInfo; + } + + public Logger getLogger() { + if (logger == null) { + logger = Tape.getLogger(getClass()); + } + return logger; + } + + public Long getCurrentUserGuid() { + try { + if (actionAuthInfo == null) { + return 0L; + } + return actionAuthInfo.getUserGuid(); + } catch (Throwable ignored) { + } + return 0L; + } + + public String getCurrentUserGroup() { + try { + if (actionAuthInfo == null) { + return "unknown"; + } + return actionAuthInfo.getUserGroup(); + } catch (Throwable ignored) { + } + return "unknown"; + } + + public String getClientIpAddress() { + String ip = "unknown"; + if (actionRequest != null) { + ip = actionRequest.getReqIp(); + } + return ip; + } + + public String getClientDomain() { + String originDomain = "unknown"; + if (actionRequest != null) { + originDomain = actionRequest.getReqDomain(); + } + return originDomain; + } + + public String getRequestPlatform() { + String platform = "unknown"; + if (actionRequest != null) { + platform = actionRequest.getReqPlatform(); + } + return platform; + } + + public String getSessionPlatform() { + String platform = "unknown"; + if (actionAuthInfo != null) { + platform = actionAuthInfo.getOriginPlatform(); + } + return platform; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionParameter.java b/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionParameter.java new file mode 100644 index 0000000..901b19e --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionParameter.java @@ -0,0 +1,56 @@ +package com.iqudoo.framework.tape.base.action.bean; + +import com.alibaba.fastjson.JSONObject; + +public class ActionParameter { + + private String transId; + private String token; + private String action; + private String platform; + private JSONObject params; + + public String getTransId() { + return transId; + } + + public void setTransId(String transId) { + this.transId = transId; + } + + public String getToken() { + return token; + } + + public void setPlatform(String platform) { + this.platform = platform; + } + + public String getPlatform() { + if (platform == null) { + return "unknown"; + } + return platform; + } + + public void setToken(String token) { + this.token = token; + } + + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public JSONObject getParams() { + return params; + } + + public void setParams(JSONObject params) { + this.params = params; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionRequest.java b/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionRequest.java new file mode 100644 index 0000000..4d8dbf1 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionRequest.java @@ -0,0 +1,101 @@ +package com.iqudoo.framework.tape.base.action.bean; + +import com.alibaba.fastjson.JSONObject; + +import java.util.HashMap; +import java.util.Map; + +public class ActionRequest extends _Attribute { + + private int retryIndex = 0; + private ActionServletRequest actionServletRequest; + + public ActionRequest(ActionParameter actionParameter, ActionServletRequest servletRequest) { + if (servletRequest != null) { + setAttribute("request-headers", servletRequest.getHeaders()); + setAttribute("request-params", actionParameter.getParams()); + setAttribute("request-platform", actionParameter.getPlatform()); + setAttribute("request-domain", servletRequest.getOriginDomain()); + setAttribute("request-ip", servletRequest.getIpAddress()); + this.actionServletRequest = servletRequest; + } + setAttribute("request-parameter", actionParameter); + } + + public ActionServletRequest getActionServletRequest() { + return actionServletRequest; + } + + public Long getTimestamp() { + return getAttribute("request-timestamp", 0L); + } + + public void setTimestamp(Long timestamp) { + setAttribute("request-timestamp", timestamp); + } + + public ActionParameter getActionParameter() { + return getAttribute("request-parameter", null); + } + + public ActionAuthInfo getAuthInfo() { + return getAttribute("request-auth-info", null); + } + + public void setAuthInfo(ActionAuthInfo authInfo) { + setAttribute("request-auth-info", authInfo); + } + + public Throwable getAuthError() { + return getAttribute("request-auth-error", null); + } + + public void setAuthError(Throwable throwable) { + setAttribute("request-auth-error", throwable); + } + + public String getReqIp() { + return getAttribute("request-ip", ""); + } + + public String getReqDomain() { + return getAttribute("request-domain", ""); + } + + public String getReqPlatform() { + return getAttribute("request-platform", ""); + } + + public JSONObject getReqParams() { + return getAttribute("request-params", new JSONObject()); + } + + public Map getReqHeaders() { + return getAttribute("request-headers", new HashMap<>()); + } + + public String getReqHeader(String name) { + try { + return getReqHeaders().get(name); + } catch (Throwable ignored) { + } + return null; + } + + public String getReqParam(String name) { + try { + return getReqParams().getString(name); + } catch (Throwable ignored) { + } + return null; + } + + public int getRetryIndex() { + return retryIndex; + } + + public void setRetryIndex(int retryIndex) { + this.retryIndex = retryIndex; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionResponse.java b/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionResponse.java new file mode 100644 index 0000000..ff57ddb --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionResponse.java @@ -0,0 +1,90 @@ +package com.iqudoo.framework.tape.base.action.bean; + +import java.io.Serializable; + +@SuppressWarnings({"LombokGetterMayBeUsed", "LombokSetterMayBeUsed"}) +public class ActionResponse implements Serializable { + + private int code; + private String msg; + private String action; + private String transId; + private String nodeId; + private Integer retryCount; + private Long timestamp; + private Long useTime; + private DATA data; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public String getAction() { + return action; + } + + public void setAction(String action) { + this.action = action; + } + + public String getTransId() { + return transId; + } + + public void setTransId(String transId) { + this.transId = transId; + } + + public String getNodeId() { + return nodeId; + } + + public void setNodeId(String nodeId) { + this.nodeId = nodeId; + } + + public Integer getRetryCount() { + return retryCount; + } + + public void setRetryCount(Integer retryCount) { + this.retryCount = retryCount; + } + + public Long getTimestamp() { + return timestamp; + } + + public void setTimestamp(Long timestamp) { + this.timestamp = timestamp; + } + + public Long getUseTime() { + return useTime; + } + + public void setUseTime(Long useTime) { + this.useTime = useTime; + } + + public DATA getData() { + return data; + } + + public void setData(DATA data) { + this.data = data; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionServletRequest.java b/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionServletRequest.java new file mode 100644 index 0000000..516c0c6 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionServletRequest.java @@ -0,0 +1,87 @@ +package com.iqudoo.framework.tape.base.action.bean; + +import com.iqudoo.framework.tape.modules.utils.ServletUtil; + +import javax.servlet.http.HttpServletRequest; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.Map; + +public class ActionServletRequest { + + private String ipAddress; + private String originDomain; + private Map queryParams; + private Map headers; + + private final String rawBody; + private final HttpServletRequest servletRequest; + + public ActionServletRequest(HttpServletRequest servletRequest, String rawBody) { + this.servletRequest = servletRequest; + this.rawBody = rawBody; + // queryParams + Map qParams = new HashMap<>(); + Map requestParams = servletRequest.getParameterMap(); + if (requestParams != null && !requestParams.isEmpty()) { + for (Map.Entry entry : requestParams.entrySet()) { + qParams.put(entry.getKey(), entry.getValue()[0]); + } + } + setQueryParams(qParams); + // headerMap + Map headerMap = new HashMap<>(); + Enumeration headerNames = servletRequest.getHeaderNames(); + while (headerNames.hasMoreElements()) { + String headerName = headerNames.nextElement(); + String headerValue = servletRequest.getHeader(headerName); + headerMap.put(headerName, headerValue); + } + setHeaders(headerMap); + // ipAddress + setIpAddress(ServletUtil.getIpAddress(servletRequest)); + // originDomain + setOriginDomain(ServletUtil.getDomain(servletRequest)); + } + + public String getIpAddress() { + return ipAddress; + } + + public void setIpAddress(String ipAddress) { + this.ipAddress = ipAddress; + } + + public String getOriginDomain() { + return originDomain; + } + + public void setOriginDomain(String originDomain) { + this.originDomain = originDomain; + } + + public Map getQueryParams() { + return queryParams; + } + + public void setQueryParams(Map queryParams) { + this.queryParams = queryParams; + } + + public Map getHeaders() { + return headers; + } + + public void setHeaders(Map headers) { + this.headers = headers; + } + + public HttpServletRequest getServletRequest() { + return servletRequest; + } + + public String getRawBody() { + return rawBody; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionServletResponse.java b/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionServletResponse.java new file mode 100644 index 0000000..7067c74 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionServletResponse.java @@ -0,0 +1,17 @@ +package com.iqudoo.framework.tape.base.action.bean; + +import javax.servlet.http.HttpServletResponse; + +public class ActionServletResponse { + + private final HttpServletResponse servletResponse; + + public ActionServletResponse(HttpServletResponse servletResponse) { + this.servletResponse = servletResponse; + } + + public HttpServletResponse getServletResponse() { + return servletResponse; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionState.java b/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionState.java new file mode 100644 index 0000000..06fa1bf --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionState.java @@ -0,0 +1,69 @@ +package com.iqudoo.framework.tape.base.action.bean; + +@SuppressWarnings({"unused", "LombokGetterMayBeUsed"}) +public class ActionState extends Throwable { + + /* 成功 */ + public final static ActionState SUCCESS = new ActionState(0, "成功"); + /* 错误码:未知错误 */ + public final static ActionState UNKNOWN_ERROR = new ActionState(-1, "未知错误"); + /* 错误码:空指针异常 */ + public static final ActionState NULL_POINTER_ERROR = new ActionState(-2, "服务器空指针异常"); + /* 错误码:数据已存在 */ + public static final ActionState DATABASE_RECORD_EXISTS = new ActionState(98, "数据已存在,请检查"); + /* 错误码:数据库SQL错误 */ + public static final ActionState DATABASE_SQL_ERROR = new ActionState(99, "数据库SQL错误"); + /* 错误码:无效的事件 */ + public final static ActionState INVALID_ACTION = new ActionState(100, "找不到接口"); + /* 错误码:无效的参数 */ + public final static ActionState INVALID_PARAMS = new ActionState(101, "无效的参数"); + /* 错误码:鉴权失败 */ + public final static ActionState UN_AUTHORIZED = new ActionState(103, "鉴权失败,请重新登录"); + /* 错误码:没有权限 */ + public final static ActionState NO_PERMISSION = new ActionState(104, "没有权限访问该接口"); + /* 错误码:请求超过限流 */ + public final static ActionState REQUEST_LIMIT = new ActionState(400, "服务器繁忙,请稍后再试"); + /* 错误码:多次重试失败 */ + public static final ActionState REQUEST_TOO_MANY_FAIL = new ActionState(401, "服务器繁忙,请稍后再试"); + + /* 错误码:请求过于频繁,乐观锁 */ + public static ActionState getRequestToFrequentError() { + return new ActionState(402, "请求过于频繁,请稍后再试"); + } + + private final int code; + private final String msg; + + public ActionState(String message) { + super(message); + this.code = UNKNOWN_ERROR.getCode(); + this.msg = message; + } + + public ActionState(int code, String message) { + super(message); + this.code = code; + this.msg = message; + } + + public ActionState(String message, Throwable cause) { + super(message, cause); + this.code = UNKNOWN_ERROR.getCode(); + this.msg = message; + } + + public ActionState(int code, String message, Throwable cause) { + super(message, cause); + this.code = code; + this.msg = message; + } + + public int getCode() { + return code; + } + + public String getMsg() { + return msg; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionStateCanRetry.java b/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionStateCanRetry.java new file mode 100644 index 0000000..d8713e9 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionStateCanRetry.java @@ -0,0 +1,13 @@ +package com.iqudoo.framework.tape.base.action.bean; + +public class ActionStateCanRetry extends ActionState { + + public ActionStateCanRetry(int code, String message) { + super(code, message); + } + + public ActionStateCanRetry(int code, String message, Throwable cause) { + super(code, message, cause); + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionTokenInfo.java b/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionTokenInfo.java new file mode 100644 index 0000000..0b489f2 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/action/bean/ActionTokenInfo.java @@ -0,0 +1,41 @@ +package com.iqudoo.framework.tape.base.action.bean; + +public class ActionTokenInfo { + + private String token; + private String refreshToken; + private Long expiresIn; + private Long refreshExpiresIn; + + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + public String getRefreshToken() { + return refreshToken; + } + + public void setRefreshToken(String refreshToken) { + this.refreshToken = refreshToken; + } + + public Long getExpiresIn() { + return expiresIn; + } + + public void setExpiresIn(Long expiresIn) { + this.expiresIn = expiresIn; + } + + public Long getRefreshExpiresIn() { + return refreshExpiresIn; + } + + public void setRefreshExpiresIn(Long refreshExpiresIn) { + this.refreshExpiresIn = refreshExpiresIn; + } +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/action/bean/_Attribute.java b/src/main/java/com/iqudoo/framework/tape/base/action/bean/_Attribute.java new file mode 100644 index 0000000..95d6d03 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/action/bean/_Attribute.java @@ -0,0 +1,39 @@ +package com.iqudoo.framework.tape.base.action.bean; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +@SuppressWarnings("LombokGetterMayBeUsed") +class _Attribute { + + private final Map attribute = new ConcurrentHashMap<>(); + + public void removeAttribute(String name) { + attribute.remove(name); + } + + public void setAttribute(String name, Object value) { + if (value == null) { + return; + } + attribute.put(name, value); + } + + @SuppressWarnings("unchecked") + public T getAttribute(String name, T def) { + Object value = attribute.get(name); + if (value == null) { + return def; + } + try { + return (T) value; + } catch (Throwable ignored) { + } + return def; + } + + public Map getAttribute() { + return attribute; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/action/handler/ActionHandler.java b/src/main/java/com/iqudoo/framework/tape/base/action/handler/ActionHandler.java new file mode 100644 index 0000000..3a57a31 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/action/handler/ActionHandler.java @@ -0,0 +1,169 @@ +package com.iqudoo.framework.tape.base.action.handler; + +import com.iqudoo.framework.tape.base.action.bean.ActionDocInfo; +import com.iqudoo.framework.tape.base.action.bean.ActionRequest; +import com.iqudoo.framework.tape.base.action.bean.ActionServletResponse; + +import java.io.OutputStream; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; + +@SuppressWarnings({"BooleanMethodIsAlwaysInverted", "LombokGetterMayBeUsed", "LombokSetterMayBeUsed"}) +public abstract class ActionHandler { + + private int sort; + private String[] actions = new String[0]; + private String[] groups = new String[0]; + private String[] scenes = new String[0]; + private String[] tag = new String[0]; + private int failRetry = 0; + private String failRetryErrorMsg; + private boolean rawData = false; + private boolean mockData = false; + private boolean ignoreLimit = false; + private boolean ignoreAuth = false; + private ActionDocInfo actionDocInfo; + private ActionRequest actionRequest; + private ActionServletResponse actionServletResponse; + + public int getSort() { + return sort; + } + + public void setSort(int sort) { + this.sort = sort; + } + + public String[] getActions() { + return actions; + } + + public void setActions(String[] actions) { + this.actions = actions; + } + + public String[] getGroups() { + return groups; + } + + public void setGroups(String[] groups) { + this.groups = groups; + } + + public String[] getScenes() { + return scenes; + } + + public void setScenes(String[] scenes) { + this.scenes = scenes; + } + + public String[] getTag() { + return tag; + } + + public void setTag(String[] tag) { + this.tag = tag; + } + + public int getFailRetry() { + return failRetry; + } + + public void setFailRetry(int failRetry) { + this.failRetry = failRetry; + } + + public String getFailRetryErrorMsg() { + return failRetryErrorMsg; + } + + public void setFailRetryErrorMsg(String failRetryErrorMsg) { + this.failRetryErrorMsg = failRetryErrorMsg; + } + + public boolean isRawData() { + return rawData; + } + + public void setRawData(boolean rawData) { + this.rawData = rawData; + } + + public boolean isMockData() { + return mockData; + } + + public void setMockData(boolean mockData) { + this.mockData = mockData; + } + + public boolean isIgnoreLimit() { + return ignoreLimit; + } + + public void setIgnoreLimit(boolean ignoreLimit) { + this.ignoreLimit = ignoreLimit; + } + + public boolean isIgnoreAuth() { + return ignoreAuth; + } + + public void setIgnoreAuth(boolean ignoreAuth) { + this.ignoreAuth = ignoreAuth; + } + + public ActionDocInfo getActionDocInfo() { + return actionDocInfo; + } + + public void setActionDocInfo(ActionDocInfo actionDocInfo) { + this.actionDocInfo = actionDocInfo; + } + + public ActionRequest getActionRequest() { + return actionRequest; + } + + public void setActionRequest(ActionRequest actionRequest) { + this.actionRequest = actionRequest; + } + + public ActionServletResponse getActionServletResponse() { + return actionServletResponse; + } + + public void setActionServletResponse(ActionServletResponse actionServletResponse) { + this.actionServletResponse = actionServletResponse; + } + + public OutputStream getServletOutputStream() throws Throwable { + return getActionServletResponse().getServletResponse().getOutputStream(); + } + + public R onMockRequest(T param) throws Throwable { + return null; + } + + public void onPreValidateRequest(T param) throws Throwable { + // pre validate request + } + + public void onValidateRequest(T param) throws Throwable { + // validate request + } + + public abstract R onHandleRequest(T param) throws Throwable; + + public Type getParamType() { + Type type = null; + Type superType = getClass().getGenericSuperclass(); + if (superType instanceof ParameterizedType) { + Type[] types = ((ParameterizedType) superType).getActualTypeArguments(); + type = types[0]; + } + return type; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/action/handler/DefaultActionHandler.java b/src/main/java/com/iqudoo/framework/tape/base/action/handler/DefaultActionHandler.java new file mode 100644 index 0000000..faa6f1a --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/action/handler/DefaultActionHandler.java @@ -0,0 +1,5 @@ +package com.iqudoo.framework.tape.base.action.handler; + +public abstract class DefaultActionHandler extends SimpleActionHandler { + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/action/handler/ProtoActionHandler.java b/src/main/java/com/iqudoo/framework/tape/base/action/handler/ProtoActionHandler.java new file mode 100644 index 0000000..1fd290b --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/action/handler/ProtoActionHandler.java @@ -0,0 +1,7 @@ +package com.iqudoo.framework.tape.base.action.handler; + +import com.iqudoo.framework.tape.modules.proto.Proto; + +public abstract class ProtoActionHandler extends ActionHandler> { + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/action/handler/SimpleActionHandler.java b/src/main/java/com/iqudoo/framework/tape/base/action/handler/SimpleActionHandler.java new file mode 100644 index 0000000..4bd8393 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/action/handler/SimpleActionHandler.java @@ -0,0 +1,19 @@ +package com.iqudoo.framework.tape.base.action.handler; + +import java.lang.reflect.Type; + +public abstract class SimpleActionHandler extends ActionHandler { + + @Override + public T onHandleRequest(Void param) throws Throwable { + return onSimpleHandle(); + } + + public abstract T onSimpleHandle() throws Throwable; + + @Override + public Type getParamType() { + return Void.class; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/action/handler/SimpleProtoActionHandler.java b/src/main/java/com/iqudoo/framework/tape/base/action/handler/SimpleProtoActionHandler.java new file mode 100644 index 0000000..f9ad6a6 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/action/handler/SimpleProtoActionHandler.java @@ -0,0 +1,21 @@ +package com.iqudoo.framework.tape.base.action.handler; + +import com.iqudoo.framework.tape.modules.proto.Proto; + +import java.lang.reflect.Type; + +public abstract class SimpleProtoActionHandler extends ProtoActionHandler { + + @Override + public Proto onHandleRequest(Void param) throws Throwable { + return onSimpleHandle(); + } + + public abstract Proto onSimpleHandle() throws Throwable; + + @Override + public Type getParamType() { + return Void.class; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/action/interfaces/IActionCall.java b/src/main/java/com/iqudoo/framework/tape/base/action/interfaces/IActionCall.java new file mode 100644 index 0000000..97efc5e --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/action/interfaces/IActionCall.java @@ -0,0 +1,12 @@ +package com.iqudoo.framework.tape.base.action.interfaces; + +import com.iqudoo.framework.tape.base.action.bean.ActionParameter; +import com.iqudoo.framework.tape.base.action.bean.ActionServletRequest; +import com.iqudoo.framework.tape.base.action.bean.ActionServletResponse; + +public interface IActionCall { + + Object call(ActionParameter actionParameter, ActionServletRequest servletRequest, + ActionServletResponse servletResponse); + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/action/interfaces/IActionDiscover.java b/src/main/java/com/iqudoo/framework/tape/base/action/interfaces/IActionDiscover.java new file mode 100644 index 0000000..2f52791 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/action/interfaces/IActionDiscover.java @@ -0,0 +1,15 @@ +package com.iqudoo.framework.tape.base.action.interfaces; + +import com.iqudoo.framework.tape.base.action.handler.ActionHandler; + +import java.util.List; + +public interface IActionDiscover { + + List> getHandlerList(); + + ActionHandler getActionHandlerByAction(String action); + + ActionHandler getActionHandlerByApiDocId(String action); + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/action/interfaces/IActionDispatch.java b/src/main/java/com/iqudoo/framework/tape/base/action/interfaces/IActionDispatch.java new file mode 100644 index 0000000..2921bf0 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/action/interfaces/IActionDispatch.java @@ -0,0 +1,16 @@ +package com.iqudoo.framework.tape.base.action.interfaces; + +import com.alibaba.fastjson.JSONObject; +import com.iqudoo.framework.tape.base.action.bean.ActionServletRequest; +import com.iqudoo.framework.tape.base.action.bean.ActionServletResponse; + +import java.util.Map; + +public interface IActionDispatch { + + Object doRequest(JSONObject body, + Map params, + ActionServletRequest servletRequest, + ActionServletResponse servletResponse) throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/action/interfaces/IActionToken.java b/src/main/java/com/iqudoo/framework/tape/base/action/interfaces/IActionToken.java new file mode 100644 index 0000000..01a45d6 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/action/interfaces/IActionToken.java @@ -0,0 +1,33 @@ +package com.iqudoo.framework.tape.base.action.interfaces; + +import com.iqudoo.framework.tape.base.action.bean.ActionAuthInfo; +import com.iqudoo.framework.tape.base.action.bean.ActionTokenInfo; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; + +public interface IActionToken { + + ActionTokenInfo createToken(ActionAuthInfo actionAuthInfo) throws Throwable; + + ActionTokenInfo refreshToken(String refreshToken) throws Throwable; + + ActionAuthInfo parseToken(String token) throws Throwable; + + Throwable getAuthError(); + + @SuppressWarnings({"LombokGetterMayBeUsed", "LombokSetterMayBeUsed"}) + class RefreshTokenParam { + + @ApiDocFieldConfiguration(desc = "刷新TOKEN") + private String refreshToken; + + public String getRefreshToken() { + return refreshToken; + } + + public void setRefreshToken(String refreshToken) { + this.refreshToken = refreshToken; + } + + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/docs/annotation/ApiDocActionConfiguration.java b/src/main/java/com/iqudoo/framework/tape/base/docs/annotation/ApiDocActionConfiguration.java new file mode 100644 index 0000000..ca7afa1 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/docs/annotation/ApiDocActionConfiguration.java @@ -0,0 +1,15 @@ +package com.iqudoo.framework.tape.base.docs.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface ApiDocActionConfiguration { + + /* 返回值类型 */ + Class[] response() default Void.class; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/docs/annotation/ApiDocControllerConfiguration.java b/src/main/java/com/iqudoo/framework/tape/base/docs/annotation/ApiDocControllerConfiguration.java new file mode 100644 index 0000000..1a36e6a --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/docs/annotation/ApiDocControllerConfiguration.java @@ -0,0 +1,21 @@ +package com.iqudoo.framework.tape.base.docs.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.METHOD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface ApiDocControllerConfiguration { + + /* 接口名称 */ + String name(); + + /* 接口描述 */ + String desc() default ""; + + /* 接口排序 */ + int sort() default 0; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/docs/annotation/ApiDocEnumConfiguration.java b/src/main/java/com/iqudoo/framework/tape/base/docs/annotation/ApiDocEnumConfiguration.java new file mode 100644 index 0000000..c532a3d --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/docs/annotation/ApiDocEnumConfiguration.java @@ -0,0 +1,15 @@ +package com.iqudoo.framework.tape.base.docs.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface ApiDocEnumConfiguration { + + /* 枚举别名 */ + String[] alias() default ""; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/docs/annotation/ApiDocFieldConfiguration.java b/src/main/java/com/iqudoo/framework/tape/base/docs/annotation/ApiDocFieldConfiguration.java new file mode 100644 index 0000000..d0f3674 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/docs/annotation/ApiDocFieldConfiguration.java @@ -0,0 +1,27 @@ +package com.iqudoo.framework.tape.base.docs.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface ApiDocFieldConfiguration { + + /* 描述 */ + String desc() default ""; + + /* 是否必填 */ + boolean required() default false; + + /* 忽略字段 */ + boolean ignore() default false; + + /* 泛型位置 */ + int[] parametricIndex() default {}; + + /* 枚举类型 */ + Class enumClass() default Void.class; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/docs/bean/ApiDocActionInfo.java b/src/main/java/com/iqudoo/framework/tape/base/docs/bean/ApiDocActionInfo.java new file mode 100644 index 0000000..c04fdde --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/docs/bean/ApiDocActionInfo.java @@ -0,0 +1,300 @@ +package com.iqudoo.framework.tape.base.docs.bean; + +import java.io.Serializable; +import java.util.List; + +@SuppressWarnings({"LombokGetterMayBeUsed", "LombokSetterMayBeUsed", "unused"}) +public class ApiDocActionInfo { + + private String id; + private String[] action; + private String[] groups; + private String[] scenes; + private Class param; + private Class response; + private Class handler; + private BeamInfo paramModel; + private BeamInfo responseModel; + + private int sort; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String[] getAction() { + return action; + } + + public void setAction(String[] action) { + this.action = action; + } + + public String[] getGroups() { + return groups; + } + + public void setGroups(String[] groups) { + this.groups = groups; + } + + public String[] getScenes() { + return scenes; + } + + public void setScenes(String[] scenes) { + this.scenes = scenes; + } + + public Class getParam() { + return param; + } + + public void setParam(Class param) { + this.param = param; + } + + public Class getResponse() { + return response; + } + + public void setResponse(Class response) { + this.response = response; + } + + public Class getHandler() { + return handler; + } + + public void setHandler(Class handler) { + this.handler = handler; + } + + public BeamInfo getParamModel() { + return paramModel; + } + + public void setParamModel(BeamInfo paramModel) { + this.paramModel = paramModel; + } + + public BeamInfo getResponseModel() { + return responseModel; + } + + public void setResponseModel(BeamInfo responseModel) { + this.responseModel = responseModel; + } + + public int getSort() { + return sort; + } + + public void setSort(int sort) { + this.sort = sort; + } + + public static class BeamInfo implements Serializable { + + private String modelPath; + private String className; + private String simpleName; + private boolean basicProperty; + private List fields; + private List> parametricTypes; + private List parametricModels; + private int parametricLength; + + public String getModelPath() { + return modelPath; + } + + public void setModelPath(String modelPath) { + this.modelPath = modelPath; + } + + public String getClassName() { + return className; + } + + public void setClassName(String className) { + this.className = className; + } + + public String getSimpleName() { + return simpleName; + } + + public void setSimpleName(String simpleName) { + this.simpleName = simpleName; + } + + public boolean isBasicProperty() { + return basicProperty; + } + + public void setBasicProperty(boolean basicProperty) { + this.basicProperty = basicProperty; + } + + public List getFields() { + return fields; + } + + public void setFields(List fields) { + this.fields = fields; + } + + public List> getParametricTypes() { + return parametricTypes; + } + + public void setParametricTypes(List> parametricTypes) { + this.parametricTypes = parametricTypes; + } + + public List getParametricModels() { + return parametricModels; + } + + public void setParametricModels(List parametricModels) { + this.parametricModels = parametricModels; + } + + public int getParametricLength() { + return parametricLength; + } + + public void setParametricLength(int parametricLength) { + this.parametricLength = parametricLength; + } + + } + + public static class BeamField implements Serializable { + + private String fieldPath; + private String name; + private String typeName; + private String desc; + private Class type; + private boolean required; + private boolean basicProperty; + private Object defaultValue; + private BeamInfo model; + private List> parametricTypes; + private List parametricModels; + private int parametricLength; + private ApiDocEnumInfo enumInfo; + + public String getFieldPath() { + return fieldPath; + } + + public void setFieldPath(String fieldPath) { + this.fieldPath = fieldPath; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getTypeName() { + return typeName; + } + + public void setTypeName(String typeName) { + this.typeName = typeName; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public Class getType() { + return type; + } + + public void setType(Class type) { + this.type = type; + } + + public boolean isRequired() { + return required; + } + + public void setRequired(boolean required) { + this.required = required; + } + + public boolean isBasicProperty() { + return basicProperty; + } + + public void setBasicProperty(boolean basicProperty) { + this.basicProperty = basicProperty; + } + + public Object getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(Object defaultValue) { + this.defaultValue = defaultValue; + } + + public BeamInfo getModel() { + return model; + } + + public void setModel(BeamInfo model) { + this.model = model; + } + + public List> getParametricTypes() { + return parametricTypes; + } + + public void setParametricTypes(List> parametricTypes) { + this.parametricTypes = parametricTypes; + } + + public List getParametricModels() { + return parametricModels; + } + + public void setParametricModels(List parametricModels) { + this.parametricModels = parametricModels; + } + + public int getParametricLength() { + return parametricLength; + } + + public void setParametricLength(int parametricLength) { + this.parametricLength = parametricLength; + } + + public ApiDocEnumInfo getEnumInfo() { + return enumInfo; + } + + public void setEnumInfo(ApiDocEnumInfo enumInfo) { + this.enumInfo = enumInfo; + } + + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/docs/bean/ApiDocControllerInfo.java b/src/main/java/com/iqudoo/framework/tape/base/docs/bean/ApiDocControllerInfo.java new file mode 100644 index 0000000..a8e033c --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/docs/bean/ApiDocControllerInfo.java @@ -0,0 +1,61 @@ +package com.iqudoo.framework.tape.base.docs.bean; + +public class ApiDocControllerInfo { + + private String name; + private Class controller; + private String path; + private String method; + private String desc; + + private int sort; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public Class getController() { + return controller; + } + + public void setController(Class controller) { + this.controller = controller; + } + + public String getMethod() { + return method; + } + + public void setMethod(String method) { + this.method = method; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public int getSort() { + return sort; + } + + public void setSort(int sort) { + this.sort = sort; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/docs/bean/ApiDocEnumInfo.java b/src/main/java/com/iqudoo/framework/tape/base/docs/bean/ApiDocEnumInfo.java new file mode 100644 index 0000000..15e08cc --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/docs/bean/ApiDocEnumInfo.java @@ -0,0 +1,36 @@ +package com.iqudoo.framework.tape.base.docs.bean; + +import java.util.List; +import java.util.Map; + +public class ApiDocEnumInfo { + + private String name; + private Class type; + private List> properties; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Class getType() { + return type; + } + + public void setType(Class type) { + this.type = type; + } + + public List> getProperties() { + return properties; + } + + public void setProperties(List> properties) { + this.properties = properties; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/docs/interfaces/IDocAction.java b/src/main/java/com/iqudoo/framework/tape/base/docs/interfaces/IDocAction.java new file mode 100644 index 0000000..2669b36 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/docs/interfaces/IDocAction.java @@ -0,0 +1,13 @@ +package com.iqudoo.framework.tape.base.docs.interfaces; + +import com.iqudoo.framework.tape.base.docs.bean.ApiDocActionInfo; + +import java.util.List; + +public interface IDocAction { + + List getActionList() throws Throwable; + + ApiDocActionInfo getActionById(String id) throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/docs/interfaces/IDocController.java b/src/main/java/com/iqudoo/framework/tape/base/docs/interfaces/IDocController.java new file mode 100644 index 0000000..de41158 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/docs/interfaces/IDocController.java @@ -0,0 +1,11 @@ +package com.iqudoo.framework.tape.base.docs.interfaces; + +import com.iqudoo.framework.tape.base.docs.bean.ApiDocControllerInfo; + +import java.util.List; + +public interface IDocController { + + List getControllerList() throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/base/docs/interfaces/IDocEnum.java b/src/main/java/com/iqudoo/framework/tape/base/docs/interfaces/IDocEnum.java new file mode 100644 index 0000000..c52b20f --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/base/docs/interfaces/IDocEnum.java @@ -0,0 +1,15 @@ +package com.iqudoo.framework.tape.base.docs.interfaces; + +import com.iqudoo.framework.tape.base.docs.bean.ApiDocEnumInfo; + +import java.util.List; + +public interface IDocEnum { + + ApiDocEnumInfo getEnumInfo(Class clazz) throws Throwable; + + List getEnumList() throws Throwable; + + ApiDocEnumInfo getEnumByName(String enumName) throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/IModuleAsync.java b/src/main/java/com/iqudoo/framework/tape/modules/IModuleAsync.java new file mode 100644 index 0000000..39fc63e --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/IModuleAsync.java @@ -0,0 +1,12 @@ +package com.iqudoo.framework.tape.modules; + +import com.iqudoo.framework.tape.modules.async.AsyncHandler; +import com.iqudoo.framework.tape.modules.async.AsyncScheduler; + +public interface IModuleAsync { + + void doAsyncTask(T params, AsyncHandler asyncHandler) throws Throwable; + + void doScheduleTask(AsyncScheduler asyncScheduler) throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/IModuleCache.java b/src/main/java/com/iqudoo/framework/tape/modules/IModuleCache.java new file mode 100644 index 0000000..95a36f9 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/IModuleCache.java @@ -0,0 +1,18 @@ +package com.iqudoo.framework.tape.modules; + +import com.iqudoo.framework.tape.modules.cache.CacheKey; +import com.iqudoo.framework.tape.modules.cache.CacheLoader; + +public interface IModuleCache { + + void setCacheData(CacheKey key, Object value) throws Throwable; + + D getCacheData(CacheKey key, T params, CacheLoader cacheLoader) throws Throwable; + + void removeCacheDataByPrefix(String prefix) throws Throwable; + + void removeCacheData(CacheKey key) throws Throwable; + + void clearCache() throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/IModuleCrawler.java b/src/main/java/com/iqudoo/framework/tape/modules/IModuleCrawler.java new file mode 100644 index 0000000..ed980a5 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/IModuleCrawler.java @@ -0,0 +1,10 @@ +package com.iqudoo.framework.tape.modules; + +import com.iqudoo.framework.tape.modules.crawler.CrawlerKey; +import com.iqudoo.framework.tape.modules.crawler.CrawlerLoader; + +public interface IModuleCrawler { + + D getCrawlerData(CrawlerKey key, T params, CrawlerLoader crawlerLoader) throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/IModuleFactory.java b/src/main/java/com/iqudoo/framework/tape/modules/IModuleFactory.java new file mode 100644 index 0000000..daa8755 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/IModuleFactory.java @@ -0,0 +1,51 @@ +package com.iqudoo.framework.tape.modules; + +import java.util.List; + +public interface IModuleFactory { + + void register(Object object, Class factoryClass, String name, String description); + + T get(Class factoryClass, String name) throws Throwable; + + List getList(Class factoryClass) throws Throwable; + + String getName(Class factoryClass, Object factoryObject) throws Throwable; + + List getNameList(Class factoryClass) throws Throwable; + + boolean has(Class factoryClass, String name) throws Throwable; + + FactoryInfo getFactoryInfo(Class factoryClass, String name) throws Throwable; + + class FactoryInfo { + + private String name; + private String description; + private Class factoryClass; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Class getFactoryClass() { + return factoryClass; + } + + public void setFactoryClass(Class factoryClass) { + this.factoryClass = factoryClass; + } + } +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/IModuleFileManager.java b/src/main/java/com/iqudoo/framework/tape/modules/IModuleFileManager.java new file mode 100644 index 0000000..9292289 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/IModuleFileManager.java @@ -0,0 +1,26 @@ +package com.iqudoo.framework.tape.modules; + +import com.iqudoo.framework.tape.modules.fileManager.FileConfig; +import com.iqudoo.framework.tape.modules.fileManager.FileInfo; + +import java.util.List; + +public interface IModuleFileManager { + + FileInfo getFile(String filePath, FileConfig config); + + List getFiles(String folderPath, FileConfig config); + + void createFolder(String folderPath, FileConfig config) throws Throwable; + + void renameFile(String targetPath, String filePath, FileConfig config) throws Throwable; + + void deleteFile(String targetPath, FileConfig config) throws Throwable; + + boolean hasFile(String filePath, FileConfig config); + + boolean hasFolder(String filePath, FileConfig config) throws Throwable; + + boolean isFolder(String filePath, FileConfig config) throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/IModuleLock.java b/src/main/java/com/iqudoo/framework/tape/modules/IModuleLock.java new file mode 100644 index 0000000..bebbd55 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/IModuleLock.java @@ -0,0 +1,13 @@ +package com.iqudoo.framework.tape.modules; + +public interface IModuleLock { + + void lock(String key) throws Throwable; + + void lock(String key, long timeoutMs) throws Throwable; + + void lock(String key, long timeoutMs, Throwable throwable) throws Throwable; + + void unlock(String key) throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/IModuleSession.java b/src/main/java/com/iqudoo/framework/tape/modules/IModuleSession.java new file mode 100644 index 0000000..0f73263 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/IModuleSession.java @@ -0,0 +1,12 @@ +package com.iqudoo.framework.tape.modules; + +import com.iqudoo.framework.tape.modules.session.GetSessionParam; +import com.iqudoo.framework.tape.modules.session.RefreshSessionParam; + +public interface IModuleSession { + + String getSession(GetSessionParam param) throws Throwable; + + String refreshSession(RefreshSessionParam param) throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/IModuleSetting.java b/src/main/java/com/iqudoo/framework/tape/modules/IModuleSetting.java new file mode 100644 index 0000000..15281d9 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/IModuleSetting.java @@ -0,0 +1,382 @@ +package com.iqudoo.framework.tape.modules; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; + +import java.util.List; + +public interface IModuleSetting { + + List getList(String group); + + SettingInfo getSettingInfo(String group, String key); + + D getSetting(Class type, String... bizArgs) throws Throwable; + + void clearCache(String key, String... bizArgs); + + @SuppressWarnings({"LombokGetterMayBeUsed", "LombokSetterMayBeUsed", "unused"}) + class SettingInfo { + + @ApiDocFieldConfiguration(desc = "配置KEY") + private String key; + @ApiDocFieldConfiguration(desc = "配置类型") + private Class type; + @ApiDocFieldConfiguration(desc = "配置标题") + private String title; + @ApiDocFieldConfiguration(desc = "配置说明") + private String desc; + @ApiDocFieldConfiguration(desc = "备注信息") + private String readme; + @ApiDocFieldConfiguration(desc = "排序编号") + private int sort = 0; + @ApiDocFieldConfiguration(desc = "是否隐藏: 0或1") + private boolean isHidden; + @ApiDocFieldConfiguration(desc = "是否公开") + private boolean isPublic; + @ApiDocFieldConfiguration(desc = "字段列表") + private List fields; + @ApiDocFieldConfiguration(desc = "默认值") + private String defaultValue; + @ApiDocFieldConfiguration(desc = "刷新页面") + private boolean refreshPage; + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public Class getType() { + return type; + } + + public void setType(Class type) { + this.type = type; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getDesc() { + return desc; + } + + public void setDesc(String desc) { + this.desc = desc; + } + + public String getReadme() { + return readme; + } + + public void setReadme(String readme) { + this.readme = readme; + } + + public int getSort() { + return sort; + } + + public void setSort(int sort) { + this.sort = sort; + } + + public boolean isHidden() { + return isHidden; + } + + public void setHidden(boolean hidden) { + isHidden = hidden; + } + + public boolean isPublic() { + return isPublic; + } + + public void setPublic(boolean aPublic) { + isPublic = aPublic; + } + + public List getFields() { + return fields; + } + + public void setFields(List fields) { + this.fields = fields; + } + + public String getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + } + + public boolean isRefreshPage() { + return refreshPage; + } + + public void setRefreshPage(boolean refreshPage) { + this.refreshPage = refreshPage; + } + + } + + @SuppressWarnings({"LombokGetterMayBeUsed", "LombokSetterMayBeUsed", "unused"}) + class FieldInfo { + + @ApiDocFieldConfiguration(desc = "字段名称") + private String name; + + @ApiDocFieldConfiguration(desc = "字段标题") + private String label; + + @ApiDocFieldConfiguration(desc = "提示文案") + private String tips; + + @ApiDocFieldConfiguration(desc = "字段类型", + enumClass = SettingFieldType.class) + private String type; + + @ApiDocFieldConfiguration(desc = "选择项:每行一个选项,key|value分割") + private String options; + + @ApiDocFieldConfiguration(desc = "文本最大长度") + private int textLenMax; + + @ApiDocFieldConfiguration(desc = "文本行数") + private int textRows; + + @ApiDocFieldConfiguration(desc = "文件大小限制,单位M") + private int fileSize; + + @ApiDocFieldConfiguration(desc = "文件数量限制") + private int fileCount; + + @ApiDocFieldConfiguration(desc = "数值最大值") + private double numMax; + + @ApiDocFieldConfiguration(desc = "数值最小值") + private double numMin; + + @ApiDocFieldConfiguration(desc = "数值步进大小") + private double numStep; + + @ApiDocFieldConfiguration(desc = "数值小数点位数") + private int numPrecision; + + @ApiDocFieldConfiguration(desc = "默认值") + private Object defaultValue; + + @ApiDocFieldConfiguration(desc = "显示公式") + private String show; + + @ApiDocFieldConfiguration(desc = "是否必填") + private boolean required; + + @ApiDocFieldConfiguration(desc = "是否禁用") + private boolean disabled; + + @ApiDocFieldConfiguration(desc = "是否敏感") + private boolean isSensitive; + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public String getTips() { + return tips; + } + + public void setTips(String tips) { + this.tips = tips; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getOptions() { + return options; + } + + public void setOptions(String options) { + this.options = options; + } + + public int getTextLenMax() { + return textLenMax; + } + + public void setTextLenMax(int textLenMax) { + this.textLenMax = textLenMax; + } + + public int getFileSize() { + return fileSize; + } + + public void setFileSize(int fileSize) { + this.fileSize = fileSize; + } + + public int getFileCount() { + return fileCount; + } + + public void setFileCount(int fileCount) { + this.fileCount = fileCount; + } + + public double getNumMax() { + return numMax; + } + + public void setNumMax(double numMax) { + this.numMax = numMax; + } + + public double getNumMin() { + return numMin; + } + + public void setNumMin(double numMin) { + this.numMin = numMin; + } + + public double getNumStep() { + return numStep; + } + + public void setNumStep(double numStep) { + this.numStep = numStep; + } + + public int getNumPrecision() { + return numPrecision; + } + + public void setNumPrecision(int numPrecision) { + this.numPrecision = numPrecision; + } + + public int getTextRows() { + return textRows; + } + + public void setTextRows(int textRows) { + this.textRows = textRows; + } + + public Object getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(Object defaultValue) { + this.defaultValue = defaultValue; + } + + public String getShow() { + return show; + } + + public void setShow(String show) { + this.show = show; + } + + public boolean isRequired() { + return required; + } + + public void setRequired(boolean required) { + this.required = required; + } + + public boolean isDisabled() { + return disabled; + } + + public void setDisabled(boolean disabled) { + this.disabled = disabled; + } + + public boolean isSensitive() { + return isSensitive; + } + + public void setSensitive(boolean sensitive) { + isSensitive = sensitive; + } + + } + + @SuppressWarnings("LombokGetterMayBeUsed") + enum SettingFieldType { + + // 自动类型 + AUTO("auto", "自动"), + // 单行文本 + TYPE_TEXT("text", "单行文本"), + // 多行文本 + TYPE_TEXTAREA("textarea", "多行文本"), + // 开关类型 + TYPE_BOOLEAN("boolean", "开关"), + // 数字类型 + TYPE_NUMBER("number", "数字"), + // 单选框 + TYPE_RADIO("radio", "单选框"), + // 时间类型 + TYPE_TIMESTAMP("timestamp", "时间戳"), + // 多选框 + TYPE_CHECKBOX("checkbox", "多选框"), + // 下拉选择 + TYPE_SELECT("select", "下拉选择"), + // 图片类型 + TYPE_IMAGE("image", "图片"), + // 文件类型 + TYPE_FILE("file", "文件"), + // 文件Base64类型 + TYPE_FILE_BASE64("fileBase64", "文件Base64"); + + private final String value; + private final String desc; + + SettingFieldType(String value, String desc) { + this.value = value; + this.desc = desc; + } + + public String getValue() { + return value; + } + + public String getDesc() { + return desc; + } + + } +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/annotation/FactoryMapping.java b/src/main/java/com/iqudoo/framework/tape/modules/annotation/FactoryMapping.java new file mode 100644 index 0000000..f7d5b54 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/annotation/FactoryMapping.java @@ -0,0 +1,24 @@ +package com.iqudoo.framework.tape.modules.annotation; + +import org.springframework.stereotype.Component; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Component +public @interface FactoryMapping { + + /* 方法名 */ + String name(); + + /* 支持环境 */ + String[] actives() default {}; + + /* 说明信息 */ + String description() default ""; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/annotation/SettingConfiguration.java b/src/main/java/com/iqudoo/framework/tape/modules/annotation/SettingConfiguration.java new file mode 100644 index 0000000..7fdd6df --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/annotation/SettingConfiguration.java @@ -0,0 +1,45 @@ +package com.iqudoo.framework.tape.modules.annotation; + +import org.springframework.stereotype.Component; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +@Component +public @interface SettingConfiguration { + + /* 配置分类 */ + String group(); + + /* 配置KEY */ + String key(); + + /* 配置标题 */ + String title() default ""; + + /* 配置说明 */ + String desc() default ""; + + /* 配置提示 */ + String readme() default ""; + + /* 排序 */ + int sort() default 0; + + /* 是否隐藏 */ + boolean isHidden() default false; + + /* 是否公开 */ + boolean isPublic() default false; + + /* 刷新页面 */ + boolean refreshPage() default false; + + /* 缓存时长 */ + long cacheTime() default 10000; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/annotation/SettingField.java b/src/main/java/com/iqudoo/framework/tape/modules/annotation/SettingField.java new file mode 100644 index 0000000..0a3194b --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/annotation/SettingField.java @@ -0,0 +1,62 @@ +package com.iqudoo.framework.tape.modules.annotation; + +import com.iqudoo.framework.tape.modules.IModuleSetting; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target({ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +public @interface SettingField { + + /* 备注说明 */ + String label() default ""; + + /* 输入提示 */ + String tips() default ""; + + /* 选项信息 */ + String[] options() default ""; + + /* 是否显示 */ + String show() default "(record) => true"; + + /* 是否必填 */ + boolean required() default false; + + /* 是否禁用 */ + boolean disabled() default false; + + /* 是否敏感 */ + boolean isSensitive() default false; + + /* 最大长度 */ + int lenMax() default Integer.MAX_VALUE; + + /* 文件大小(MB) */ + int fileSize() default 2; + + /* 文件大小 */ + int fileCount() default 1; + + /* 最大数字 */ + double numMax() default Integer.MAX_VALUE; + + /* 最小数字 */ + double numMin() default Integer.MIN_VALUE; + + /* 数字步长 */ + float numStep() default 1; + + /* 保留小数 */ + int numPrecision() default 0; + + /* 输入行数 */ + int rows() default 2; + + /* 属性类型 */ + IModuleSetting.SettingFieldType type() default IModuleSetting.SettingFieldType.AUTO; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/asserts/AssertUtil.java b/src/main/java/com/iqudoo/framework/tape/modules/asserts/AssertUtil.java new file mode 100644 index 0000000..ff9f514 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/asserts/AssertUtil.java @@ -0,0 +1,223 @@ +package com.iqudoo.framework.tape.modules.asserts; + +import java.util.List; + + +/** + * 断言工具类 + */ +public class AssertUtil { + + /** + * 断言对象不是无效的 + * + * @param obj 对象 + * @param checker 断言处理器 + */ + public static void oneNotInvalid(T obj, AssertValidator checker) { + oneNotInvalidCustom(new Object[]{obj}, new AssertNotInvalidValidator<>(null, new AssertValidator() { + @Override + @SuppressWarnings("unchecked") + public boolean assertFlag(Object obj) { + return checker.check((T) obj); + } + + @Override + public String assertMessage() { + if (checker != null) { + return checker.assertMessage(); + } + return null; + } + })); + } + + /** + * 断言对象不是无效的 + * + * @param obj 对象 + * @param message 错误提示 + */ + public static void oneNotInvalid(Object obj, String message) { + oneNotInvalidCustom(new Object[]{obj}, new AssertNotInvalidValidator<>(message)); + } + + /** + * 断言至少一个对象不是无效的 + * + * @param obj1 对象1 + * @param obj2 对象2 + * @param message 错误提示 + */ + public static void oneNotInvalid(Object obj1, Object obj2, String message) { + oneNotInvalidCustom(new Object[]{obj1, obj2}, new AssertNotInvalidValidator<>(message)); + } + + /** + * 断言至少一个对象不是无效的 + * + * @param obj1 对象1 + * @param obj2 对象2 + * @param checker 断言处理器 + */ + public static void oneNotInvalid(Object obj1, Object obj2, AssertValidator checker) { + oneNotInvalidCustom(new Object[]{obj1, obj2}, new AssertNotInvalidValidator<>(null, checker)); + } + + /** + * 断言至少一个对象不是无效的 + * + * @param obj1 对象1 + * @param obj2 对象2 + * @param obj3 对象3 + * @param message 错误提示 + */ + public static void oneNotInvalid(Object obj1, Object obj2, Object obj3, String message) { + oneNotInvalidCustom(new Object[]{obj1, obj2, obj3}, new AssertNotInvalidValidator<>(message)); + } + + /** + * 断言至少一个对象不是无效的 + * + * @param obj1 对象1 + * @param obj2 对象2 + * @param obj3 对象3 + * @param checker 断言处理器 + */ + public static void oneNotInvalid(Object obj1, Object obj2, Object obj3, AssertValidator checker) { + oneNotInvalidCustom(new Object[]{obj1, obj2, obj3}, new AssertNotInvalidValidator<>(null, checker)); + } + + /** + * 断言至少一个对象不是无效的 + * + * @param obj 对象数组 + * @param checker 断言处理器 + */ + public static void oneNotInvalidCustom(T[] obj, AssertValidator checker) { + boolean assertFlag = true; + for (T object : obj) { + if (!checker.check(object)) { + assertFlag = false; + break; + } + } + if (!assertFlag) { + return; + } + throw new IllegalArgumentException(checker.getAssertMessage()); + } + + /////////////////////////////////////////////////////////////// + /////////////////////////////////////////////////////////////// + + /** + * 断言全部对象不是无效的 + * + * @param obj1 对象1 + * @param obj2 对象2 + * @param message 错误提示 + */ + public static void allNotInvalid(Object obj1, Object obj2, String message) { + allNotInvalidCustom(new Object[]{obj1, obj2}, new AssertNotInvalidValidator<>(message)); + } + + + /** + * 断言全部对象不是无效的 + * + * @param obj1 对象1 + * @param obj2 对象2 + * @param checker 断言处理器 + */ + public static void allNotInvalid(Object obj1, Object obj2, AssertValidator checker) { + allNotInvalidCustom(new Object[]{obj1, obj2}, new AssertNotInvalidValidator<>(null, checker)); + } + + /** + * 断言全部对象不是无效的 + * + * @param obj1 对象1 + * @param obj2 对象2 + * @param obj3 对象3 + * @param message 错误提示 + */ + public static void allNotInvalid(Object obj1, Object obj2, Object obj3, String message) { + allNotInvalidCustom(new Object[]{obj1, obj2, obj3}, new AssertNotInvalidValidator<>(message)); + } + + + /** + * 断言全部对象不是无效的 + * + * @param obj1 对象1 + * @param obj2 对象2 + * @param obj3 对象3 + * @param checker 断言处理器 + */ + public static void allNotInvalid(Object obj1, Object obj2, Object obj3, AssertValidator checker) { + allNotInvalidCustom(new Object[]{obj1, obj2, obj3}, new AssertNotInvalidValidator<>(null, checker)); + } + + /** + * 断言全部对象不是无效的 + * + * @param obj 对象数组 + * @param checker 断言处理器 + */ + public static void allNotInvalidCustom(T[] obj, AssertValidator checker) { + boolean assertFlag = false; + for (T object : obj) { + if (checker.check(object)) { + assertFlag = true; + break; + } + } + if (!assertFlag) { + return; + } + throw new IllegalArgumentException(checker.getAssertMessage()); + } + + /** + * 默认的不为NULL断言验证器 + * + * @param 对象类型 + */ + private static class AssertNotInvalidValidator extends AssertValidator { + + private final String message; + + + public AssertNotInvalidValidator(String message) { + this(message, null); + } + + + public AssertNotInvalidValidator(String message, AssertValidator next) { + super(next); + this.message = message; + } + + @Override + public String assertMessage() { + return message; + } + + @Override + public boolean assertFlag(T obj) { + if (obj == null) { + return true; + } + if (obj instanceof String) { + return ((String) obj).trim().length() == 0; + } + if (obj instanceof List) { + return ((List) obj).size() == 0; + } + return false; + } + + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/asserts/AssertValidator.java b/src/main/java/com/iqudoo/framework/tape/modules/asserts/AssertValidator.java new file mode 100644 index 0000000..6db6b1b --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/asserts/AssertValidator.java @@ -0,0 +1,46 @@ +package com.iqudoo.framework.tape.modules.asserts; + +public abstract class AssertValidator { + + private final AssertValidator next; + + public AssertValidator() { + this.next = null; + } + + public AssertValidator(AssertValidator next) { + this.next = next; + } + + public abstract boolean assertFlag(T obj); + + public abstract String assertMessage(); + + ///////////////////////////////////////////////// + ///////////////////////////////////////////////// + + protected boolean check(T obj) { + try { + if (assertFlag(obj)) { + return true; + } + } catch (Throwable ignored) { + return true; + } + if (next != null) { + return next.check(obj); + } + return false; + } + + protected String getAssertMessage() { + String assertMessage = assertMessage(); + if (assertMessage == null) { + if (next != null) { + assertMessage = next.getAssertMessage(); + } + } + return assertMessage; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/asserts/AssertValidatorArrayEmpty.java b/src/main/java/com/iqudoo/framework/tape/modules/asserts/AssertValidatorArrayEmpty.java new file mode 100644 index 0000000..2443aa5 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/asserts/AssertValidatorArrayEmpty.java @@ -0,0 +1,22 @@ +package com.iqudoo.framework.tape.modules.asserts; + +public class AssertValidatorArrayEmpty extends AssertValidator { + + private final String message; + + public AssertValidatorArrayEmpty(String message) { + super(null); + this.message = message; + } + + @Override + public boolean assertFlag(T[] obj) { + return obj.length <= 0; + } + + @Override + public String assertMessage() { + return message; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/asserts/AssertValidatorListEmpty.java b/src/main/java/com/iqudoo/framework/tape/modules/asserts/AssertValidatorListEmpty.java new file mode 100644 index 0000000..ecc66cc --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/asserts/AssertValidatorListEmpty.java @@ -0,0 +1,24 @@ +package com.iqudoo.framework.tape.modules.asserts; + +import java.util.List; + +public class AssertValidatorListEmpty extends AssertValidator> { + + private final String message; + + public AssertValidatorListEmpty(String message) { + super(null); + this.message = message; + } + + @Override + public boolean assertFlag(List obj) { + return obj.size() <= 0; + } + + @Override + public String assertMessage() { + return message; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/async/AsyncHandler.java b/src/main/java/com/iqudoo/framework/tape/modules/async/AsyncHandler.java new file mode 100644 index 0000000..2511455 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/async/AsyncHandler.java @@ -0,0 +1,19 @@ +package com.iqudoo.framework.tape.modules.async; + +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; + +import java.util.List; + +public interface AsyncHandler { + + ThreadPoolTaskExecutor taskExecutor(); + + long sleepTime() throws Throwable; + + void doExecute(D data) throws Throwable; + + void onComplete(T params) throws Throwable; + + List loadTasks(T params, int poolSize) throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/async/AsyncScheduler.java b/src/main/java/com/iqudoo/framework/tape/modules/async/AsyncScheduler.java new file mode 100644 index 0000000..2ac84a6 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/async/AsyncScheduler.java @@ -0,0 +1,11 @@ +package com.iqudoo.framework.tape.modules.async; + +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; + +public interface AsyncScheduler { + + ThreadPoolTaskExecutor taskExecutor(); + + void scheduleTask() throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/cache/Cache.java b/src/main/java/com/iqudoo/framework/tape/modules/cache/Cache.java new file mode 100644 index 0000000..968bb94 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/cache/Cache.java @@ -0,0 +1,68 @@ +package com.iqudoo.framework.tape.modules.cache; + +import com.fasterxml.jackson.databind.JavaType; + +/** + * 缓存数据 + * + * @param + */ +public class Cache { + + private final GetterCacheProxy getterCacheProxy; + private final SetterCacheProxy setterCacheProxy; + private final CacheLoader cacheLoader; + + + public Cache(GetterCacheProxy getterCacheProxy, + SetterCacheProxy setterCacheProxy, + CacheLoader cacheLoader) { + this.getterCacheProxy = getterCacheProxy; + this.setterCacheProxy = setterCacheProxy; + this.cacheLoader = cacheLoader; + } + + public GetterCacheProxy getGetterCacheProxy() { + return getterCacheProxy; + } + + public SetterCacheProxy getSetterCacheProxy() { + return setterCacheProxy; + } + + public CacheLoader getCacheLoader() { + return cacheLoader; + } + + public D readData(CacheKey cacheKey, T loadParams) throws Throwable { + D data = null; + if (getGetterCacheProxy().has(cacheKey)) { + try { + data = getGetterCacheProxy().onGet(cacheKey, getCacheLoader().getType()); + } catch (Throwable ignored) { + } + } + if (data == null) { + data = getCacheLoader().onLoad(cacheKey, loadParams); + if (data != null) { + getSetterCacheProxy().onSet(cacheKey, data, loadParams); + } + } + return data; + } + + public abstract static class GetterCacheProxy { + + public abstract boolean has(CacheKey cacheKey) throws Throwable; + + public abstract D onGet(CacheKey cacheKey, JavaType resultType) throws Throwable; + + } + + public abstract static class SetterCacheProxy { + + public abstract void onSet(CacheKey cacheKey, D newValue, T params) throws Throwable; + + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/cache/CacheKey.java b/src/main/java/com/iqudoo/framework/tape/modules/cache/CacheKey.java new file mode 100644 index 0000000..16d50d3 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/cache/CacheKey.java @@ -0,0 +1,52 @@ +package com.iqudoo.framework.tape.modules.cache; + +public class CacheKey { + + public static CacheKey builder(String key) { + return new CacheKey().setCacheKey(key); + } + + public static CacheKey builder(String format, Object... args) { + return new CacheKey().setCacheKey(String.format(format, args)); + } + + private String cacheKey; + private boolean forceRequest = false; + private long expireMillis = 0L; + + private CacheKey() { + } + + public String getCacheKey() { + return cacheKey; + } + + public CacheKey setCacheKey(String cacheKey) { + this.cacheKey = cacheKey; + return this; + } + + public boolean isForceRequest() { + return forceRequest; + } + + public CacheKey setForceRequest(boolean forceRequest) { + this.forceRequest = forceRequest; + return this; + } + + public long getExpireMillis() { + return expireMillis; + } + + public CacheKey setExpireMillis(long expireMillis) { + this.expireMillis = expireMillis; + return this; + } + + @Override + public String toString() { + return this.cacheKey; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/cache/CacheLoader.java b/src/main/java/com/iqudoo/framework/tape/modules/cache/CacheLoader.java new file mode 100644 index 0000000..f2d412b --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/cache/CacheLoader.java @@ -0,0 +1,22 @@ +package com.iqudoo.framework.tape.modules.cache; + +import com.fasterxml.jackson.databind.JavaType; +import com.iqudoo.framework.tape.modules.utils.JsonUtil; +import com.iqudoo.framework.tape.modules.utils.ReflectUtil; + +import java.lang.reflect.Type; + +public abstract class CacheLoader { + + public JavaType getType() { + try { + Type type = ReflectUtil.getType(getClass(), 0); + return JsonUtil.constructJavaType(type); + } catch (Throwable ignored) { + } + return null; + } + + public abstract D onLoad(CacheKey cacheKey, T params) throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/crawler/Crawler.java b/src/main/java/com/iqudoo/framework/tape/modules/crawler/Crawler.java new file mode 100644 index 0000000..b8cea93 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/crawler/Crawler.java @@ -0,0 +1,68 @@ +package com.iqudoo.framework.tape.modules.crawler; + +import com.fasterxml.jackson.databind.JavaType; + +/** + * 缓存数据 + * + * @param + */ +public class Crawler { + + private final GetterCrawlerProxy getterCrawlerProxy; + private final SetterCrawlerProxy setterCrawlerProxy; + private final CrawlerLoader crawlerLoader; + + + public Crawler(GetterCrawlerProxy getterCrawlerProxy, + SetterCrawlerProxy setterCrawlerProxy, + CrawlerLoader crawlerLoader) { + this.getterCrawlerProxy = getterCrawlerProxy; + this.setterCrawlerProxy = setterCrawlerProxy; + this.crawlerLoader = crawlerLoader; + } + + public GetterCrawlerProxy getGetterCrawlerProxy() { + return getterCrawlerProxy; + } + + public SetterCrawlerProxy getSetterCrawlerProxy() { + return setterCrawlerProxy; + } + + public CrawlerLoader getCrawlerLoader() { + return crawlerLoader; + } + + public D readData(CrawlerKey crawlerKey, T loadParams) throws Throwable { + D data = null; + if (getGetterCrawlerProxy().has(crawlerKey)) { + try { + data = getGetterCrawlerProxy().onGet(crawlerKey, getCrawlerLoader().getJavaType()); + } catch (Throwable ignored) { + } + } + if (data == null) { + data = getCrawlerLoader().onLoad(crawlerKey, loadParams); + if (data != null) { + getSetterCrawlerProxy().onSet(crawlerKey, data, loadParams); + } + } + return data; + } + + public abstract static class GetterCrawlerProxy { + + public abstract boolean has(CrawlerKey crawlerKey) throws Throwable; + + public abstract D onGet(CrawlerKey crawlerKey, JavaType resultType) throws Throwable; + + } + + public abstract static class SetterCrawlerProxy { + + public abstract void onSet(CrawlerKey crawlerKey, D newValue, T params) throws Throwable; + + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/crawler/CrawlerKey.java b/src/main/java/com/iqudoo/framework/tape/modules/crawler/CrawlerKey.java new file mode 100644 index 0000000..758541d --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/crawler/CrawlerKey.java @@ -0,0 +1,65 @@ +package com.iqudoo.framework.tape.modules.crawler; + +public class CrawlerKey { + + public static CrawlerKey builder(String type, String keyword) { + return new CrawlerKey().setCrawlerType(type) + .setCrawlerKeyword(keyword); + } + + public static CrawlerKey builder(String type, String keyword, long expire) { + return new CrawlerKey().setCrawlerType(type) + .setCrawlerKeyword(keyword) + .setExpireMillis(expire); + } + + private String crawlerType; + private String crawlerKeyword; + private boolean forceRequest = false; + private long expireMillis = 0L; + + private CrawlerKey() { + } + + public String getCrawlerType() { + return crawlerType; + } + + public CrawlerKey setCrawlerType(String crawlerType) { + this.crawlerType = crawlerType; + return this; + } + + public String getCrawlerKeyword() { + return crawlerKeyword; + } + + public CrawlerKey setCrawlerKeyword(String crawlerKeyword) { + this.crawlerKeyword = crawlerKeyword; + return this; + } + + public long getExpireMillis() { + return expireMillis; + } + + public CrawlerKey setExpireMillis(long expireMillis) { + this.expireMillis = expireMillis; + return this; + } + + public CrawlerKey setForceRequest(boolean forceRequest) { + this.forceRequest = forceRequest; + return this; + } + + public boolean isForceRequest() { + return forceRequest; + } + + @Override + public String toString() { + return this.crawlerType + "_" + this.crawlerKeyword; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/crawler/CrawlerLoader.java b/src/main/java/com/iqudoo/framework/tape/modules/crawler/CrawlerLoader.java new file mode 100644 index 0000000..81d54c2 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/crawler/CrawlerLoader.java @@ -0,0 +1,22 @@ +package com.iqudoo.framework.tape.modules.crawler; + +import com.fasterxml.jackson.databind.JavaType; +import com.iqudoo.framework.tape.modules.utils.JsonUtil; +import com.iqudoo.framework.tape.modules.utils.ReflectUtil; + +import java.lang.reflect.Type; + +public abstract class CrawlerLoader { + + public JavaType getJavaType() { + try { + Type type = ReflectUtil.getType(getClass(), 0); + return JsonUtil.constructJavaType(type); + } catch (Throwable ignored) { + } + return null; + } + + public abstract D onLoad(CrawlerKey crawlerKey, T params) throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/crud/JoinUtil.java b/src/main/java/com/iqudoo/framework/tape/modules/crud/JoinUtil.java new file mode 100644 index 0000000..b8b80fe --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/crud/JoinUtil.java @@ -0,0 +1,109 @@ +package com.iqudoo.framework.tape.modules.crud; + +import com.iqudoo.framework.tape.modules.utils.ReflectUtil; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.List; + +@SuppressWarnings("SizeReplaceableByIsEmpty") +public class JoinUtil { + + public static abstract class JoinLoader { + + public abstract List selectJoinData(List targetList, P joinParam) throws Throwable; + + public abstract boolean checkJoin(T target, D data) throws Throwable; + + public abstract void onJoined(T target, D data) throws Throwable; + + public void onDefault(T target, P joinParam) throws Throwable { + + } + + } + + public static abstract class JoinDefaultLoader { + + public void onDefault(T target, P joinParam) throws Throwable { + + } + + } + + public static abstract class JoinListLoader { + + public abstract List selectJoinData(List targetList, P joinParam) throws Throwable; + + public abstract boolean checkJoin(T target, D data) throws Throwable; + + public abstract void onJoined(T target, List data) throws Throwable; + + } + + public static void joinOne(P joinParam, List targetList, JoinLoader loader) { + try { + if (targetList == null || targetList.size() == 0) { + return; + } + List selectList = loader.selectJoinData(targetList, joinParam); + for (T target : targetList) { + boolean joinedFlag = false; + if (selectList != null && selectList.size() > 0) { + for (D data : selectList) { + try { + if (loader.checkJoin(target, data)) { + loader.onJoined(target, data); + joinedFlag = true; + } + } catch (Throwable ignored) { + } + } + } + if (!joinedFlag) { + loader.onDefault(target, joinParam); + } + } + } catch (Throwable ignored) { + } + } + + public static void joinDefault(P joinParam, List targetList, JoinDefaultLoader loader) { + try { + if (targetList == null || targetList.size() == 0) { + return; + } + for (T target : targetList) { + loader.onDefault(target, joinParam); + } + } catch (Throwable ignored) { + } + } + + + public static void joinList(P joinParam, List targetList, JoinListLoader loader) { + try { + if (targetList == null || targetList.size() == 0) { + return; + } + List selectList = loader.selectJoinData(targetList, joinParam); + if (selectList != null && selectList.size() > 0) { + for (T target : targetList) { + List joinedList = new ArrayList<>(); + for (D data : selectList) { + try { + if (loader.checkJoin(target, data)) { + joinedList.add(data); + } + } catch (Throwable ignored) { + } + } + loader.onJoined(target, joinedList); + } + } + } catch (Throwable ignored) { + } + } + + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/crud/PageData.java b/src/main/java/com/iqudoo/framework/tape/modules/crud/PageData.java new file mode 100644 index 0000000..6726b6f --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/crud/PageData.java @@ -0,0 +1,177 @@ +package com.iqudoo.framework.tape.modules.crud; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + +@SuppressWarnings({"LombokGetterMayBeUsed", "LombokSetterMayBeUsed", "DuplicatedCode"}) +public class PageData { + + public interface FilterHandler { + boolean filter(T t) throws Throwable; + } + + public interface DistinctHandler { + String distinctKey(T t); + } + + public interface MapHandler { + D map(T t) throws Throwable; + } + + /** + * 页码 + **/ + @ApiDocFieldConfiguration(desc = "分页页码") + private int page; + /** + * 每页数量 + **/ + @ApiDocFieldConfiguration(desc = "每页数量") + private int size; + /** + * 结果数量 + **/ + @ApiDocFieldConfiguration(desc = "列表数量") + private long count; + /** + * 总数量 + **/ + @ApiDocFieldConfiguration(desc = "总计数量") + private long total; + /** + * 分页游标 + **/ + @ApiDocFieldConfiguration(desc = "分页游标") + private long cursor; + /** + * 结果列表 + **/ + @ApiDocFieldConfiguration(desc = "数据列表", parametricIndex = {0}) + private List list; + + public PageData() { + } + + public PageData map(MapHandler handler) throws Throwable { + if (handler != null) { + PageData mPagination = new PageData<>(); + mPagination.list = new ArrayList<>(); + for (T t : this.list) { + mPagination.list.add(handler.map(t)); + } + mPagination.page = this.page; + mPagination.size = this.size; + mPagination.count = this.count; + mPagination.total = Math.max(this.total, mPagination.count); + mPagination.cursor = this.cursor; + return mPagination; + } + return null; + } + + public PageData filter(FilterHandler handler) throws Throwable { + if (handler != null) { + PageData mPagination = new PageData<>(); + mPagination.list = new ArrayList<>(); + for (T t : this.list) { + if (handler.filter(t)) { + mPagination.list.add(t); + } + } + mPagination.page = this.page; + mPagination.size = this.size; + mPagination.count = mPagination.list.size(); + mPagination.total = Math.max(this.total, mPagination.count); + mPagination.cursor = this.cursor; + return mPagination; + } + return null; + } + + public PageData distinct(DistinctHandler handler) throws Throwable { + if (handler != null) { + PageData mPagination = new PageData<>(); + mPagination.list = new ArrayList<>(); + List distinctKeyList = new ArrayList<>(); + for (T t : this.list) { + String key = handler.distinctKey(t); + if (!distinctKeyList.contains(key)) { + distinctKeyList.add(key); + mPagination.list.add(t); + } + } + mPagination.page = this.page; + mPagination.size = this.size; + mPagination.count = mPagination.list.size(); + mPagination.total = Math.max(this.total, mPagination.count); + mPagination.cursor = this.cursor; + return mPagination; + } + return null; + } + + public PageData joinOne(P joinParam, JoinUtil.JoinLoader loader) { + JoinUtil.joinOne(joinParam, getList(), loader); + return this; + } + + public PageData joinList(P joinParam, JoinUtil.JoinListLoader loader) { + JoinUtil.joinList(joinParam, getList(), loader); + return this; + } + + + public int getPage() { + return page; + } + + public void setPage(int page) { + this.page = page; + } + + public int getSize() { + return size; + } + + public void setSize(int size) { + this.size = size; + } + + public long getCount() { + return count; + } + + public void setCount(long count) { + this.count = count; + } + + public long getCursor() { + return cursor; + } + + public void setCursor(long cursor) { + this.cursor = cursor; + } + + public long getTotal() { + return total; + } + + public void setTotal(long total) { + this.total = total; + } + + public List getList() { + return list; + } + + public void setList(List list) { + this.list = list; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/crud/PageUtil.java b/src/main/java/com/iqudoo/framework/tape/modules/crud/PageUtil.java new file mode 100644 index 0000000..37d9750 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/crud/PageUtil.java @@ -0,0 +1,58 @@ +package com.iqudoo.framework.tape.modules.crud; + +import java.util.List; + +@SuppressWarnings({"DuplicatedCode", "unused"}) +public class PageUtil { + + public static PageData pagination(List list, Integer totalCount, Integer pageNum, Integer pageSize) { + return createPagination(list, + totalCount == null ? 0L : totalCount, + pageNum == null ? 0 : pageNum, + pageSize == null ? 0 : pageSize, + 0L + ); + } + + public static PageData pagination(List list, Long totalCount, Integer pageNum, Integer pageSize) { + return createPagination(list, + totalCount == null ? 0L : totalCount, + pageNum == null ? 0 : pageNum, + pageSize == null ? 0 : pageSize, + 0L + ); + } + + public static PageData pagination(List list, Integer totalCount, Integer pageNum, Integer pageSize, Long pageCursor) { + return createPagination(list, + totalCount == null ? 0L : totalCount, + pageNum == null ? 0 : pageNum, + pageSize == null ? 0 : pageSize, + pageCursor == null ? 0L : pageCursor + ); + } + + public static PageData pagination(List list, Long totalCount, Integer pageNum, Integer pageSize, Long pageCursor) { + return createPagination(list, + totalCount == null ? 0L : totalCount, + pageNum == null ? 0 : pageNum, + pageSize == null ? 0 : pageSize, + pageCursor == null ? 0L : pageCursor + ); + } + + + private static PageData createPagination(List list, long totalCount, int pageNum, int pageSize, long pageCursor) { + PageData pageData = new PageData<>(); + if (list != null) { + pageData.setList(list); + pageData.setPage(pageNum); + pageData.setSize(pageSize); + pageData.setCount(list.size()); + pageData.setTotal(Math.max(totalCount, list.size())); + pageData.setCursor(pageCursor); + } + return pageData; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/excel/BaseEasyExcelIgnoreError.java b/src/main/java/com/iqudoo/framework/tape/modules/excel/BaseEasyExcelIgnoreError.java new file mode 100644 index 0000000..4164dbb --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/excel/BaseEasyExcelIgnoreError.java @@ -0,0 +1,9 @@ +package com.iqudoo.framework.tape.modules.excel; + +public class BaseEasyExcelIgnoreError extends Throwable { + + public BaseEasyExcelIgnoreError(String message) { + super(message); + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/excel/BaseEasyExcelReadAbstractListener.java b/src/main/java/com/iqudoo/framework/tape/modules/excel/BaseEasyExcelReadAbstractListener.java new file mode 100644 index 0000000..e25a470 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/excel/BaseEasyExcelReadAbstractListener.java @@ -0,0 +1,125 @@ +package com.iqudoo.framework.tape.modules.excel; + +import com.alibaba.excel.context.AnalysisContext; +import com.alibaba.excel.event.AnalysisEventListener; +import com.iqudoo.framework.tape.modules.utils.ThrowableUtil; +import lombok.Data; + +import java.util.*; + +public abstract class BaseEasyExcelReadAbstractListener extends AnalysisEventListener { + + @Data + public static class ErrorInfo { + String message; + String errorMsg; + int errorCount; + } + + public enum Result { + + IGNORE(0, "忽略处理"), + SUCCESS(1, "导入成功"); + + private final int value; + private final String desc; + + Result(int value, String desc) { + this.value = value; + this.desc = desc; + } + + public int getValue() { + return value; + } + + public String getDesc() { + return desc; + } + + } + + private final P param; + + public BaseEasyExcelReadAbstractListener(P param) { + this.param = param; + } + + private long startTime = 0; + private Integer totalCount = 0; + private Integer ignoreCount = 0; + private Integer successCount = 0; + private Integer failureCount = 0; + private final List ignoreList = new ArrayList<>(); + + private final Map errorMap = new HashMap<>(); + + private final BaseEasyExcelReadResponse response = new BaseEasyExcelReadResponse(); + + public BaseEasyExcelReadResponse getResponse() { + return response; + } + + public abstract Result handleInvoke(T model, P param) throws Throwable; + + @Override + public void doAfterAllAnalysed(AnalysisContext analysisContext) { + if (startTime > 0) { + response.setUseTime(new Date().getTime() - startTime); + } else { + response.setUseTime(0); + } + response.setTotalCount(totalCount); + response.setSuccessCount(successCount); + response.setIgnoreCount(ignoreCount); + response.setFailureCount(failureCount); + response.setIgnoreList(ignoreList); + List errorInfos = new ArrayList<>(); + for (Map.Entry entry : errorMap.entrySet()) { + BaseEasyExcelReadResponse.ErrorInfo errorInfo + = new BaseEasyExcelReadResponse.ErrorInfo(); + errorInfo.setMessage(entry.getValue().getMessage()); + errorInfo.setErrorMsg(entry.getValue().getErrorMsg()); + errorInfo.setErrorCount(entry.getValue().getErrorCount()); + errorInfos.add(errorInfo); + } + response.setErrors(errorInfos); + } + + @Override + public void invoke(T t, AnalysisContext analysisContext) { + if (startTime == 0) { + startTime = new Date().getTime(); + } + try { + totalCount += 1; + Result result = handleInvoke(t, this.param); + if (result == Result.SUCCESS) { + successCount += 1; + } else { + ignoreCount += 1; + ignoreList.add(t); + } + } catch (Throwable throwable) { + if (throwable instanceof BaseEasyExcelIgnoreError) { + ignoreCount += 1; + ignoreList.add(t); + } else { + failureCount += 1; + } + String message = throwable.getMessage(); + if (errorMap.containsKey(message)) { + ErrorInfo errorInfo = errorMap.get(message); + errorInfo.setErrorCount(errorInfo.getErrorCount() + 1); + errorMap.put(message, errorInfo); + } else { + ErrorInfo errorInfo = new ErrorInfo(); + errorInfo.setMessage(message); + errorInfo.setErrorMsg(ThrowableUtil.getStackTraceToString(throwable)); + errorInfo.setErrorCount(1); + errorMap.put(message, errorInfo); + } + } + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/excel/BaseEasyExcelReadResponse.java b/src/main/java/com/iqudoo/framework/tape/modules/excel/BaseEasyExcelReadResponse.java new file mode 100644 index 0000000..806f611 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/excel/BaseEasyExcelReadResponse.java @@ -0,0 +1,27 @@ +package com.iqudoo.framework.tape.modules.excel; + +import lombok.Data; + +import java.util.List; + +@Data +public class BaseEasyExcelReadResponse { + + private long useTime; + + private Integer totalCount; + private Integer successCount; + private Integer failureCount; + private Integer ignoreCount; + + private List errors; + private List ignoreList; + + @Data + public static class ErrorInfo { + String message; + String errorMsg; + Integer errorCount; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/excel/BaseExcelCellWriteHandler.java b/src/main/java/com/iqudoo/framework/tape/modules/excel/BaseExcelCellWriteHandler.java new file mode 100644 index 0000000..d7713a2 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/excel/BaseExcelCellWriteHandler.java @@ -0,0 +1,23 @@ +package com.iqudoo.framework.tape.modules.excel; + +import com.alibaba.excel.metadata.Head; +import com.alibaba.excel.metadata.data.WriteCellData; +import com.alibaba.excel.write.metadata.holder.WriteSheetHolder; +import com.alibaba.excel.write.style.column.AbstractColumnWidthStyleStrategy; +import org.apache.poi.ss.usermodel.Cell; +import org.apache.poi.ss.usermodel.Sheet; + +import java.util.List; + +public class BaseExcelCellWriteHandler extends AbstractColumnWidthStyleStrategy { + + @Override + protected void setColumnWidth(WriteSheetHolder writeSheetHolder, List> cellDataList, Cell cell, Head head, Integer relativeRowIndex, Boolean isHead) { + Sheet sheet = writeSheetHolder.getSheet(); + int columnWidth = sheet.getColumnWidth(cell.getColumnIndex()); + if (columnWidth == 0) { + sheet.setColumnWidth(cell.getColumnIndex(), 5000); + } + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/excel/BaseExcelHeaderFooterHandler.java b/src/main/java/com/iqudoo/framework/tape/modules/excel/BaseExcelHeaderFooterHandler.java new file mode 100644 index 0000000..c5a4375 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/excel/BaseExcelHeaderFooterHandler.java @@ -0,0 +1,76 @@ +package com.iqudoo.framework.tape.modules.excel; + +import com.alibaba.excel.write.handler.SheetWriteHandler; +import com.alibaba.excel.write.metadata.holder.WriteSheetHolder; +import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder; +import org.apache.poi.ss.usermodel.Footer; +import org.apache.poi.ss.usermodel.Header; +import org.apache.poi.ss.usermodel.Sheet; + +public class BaseExcelHeaderFooterHandler implements SheetWriteHandler { + private final String headerCenter; + private final String headerLeft; + private final String headerRight; + private final String footerCenter; + private final String footerLeft; + private final String footerRight; + + /** + * 构造函数,传入页眉页脚内容 + */ + public BaseExcelHeaderFooterHandler(String headerCenter, String footerCenter) { + this.headerCenter = headerCenter; + this.headerLeft = ""; + this.headerRight = ""; + this.footerCenter = footerCenter; + this.footerLeft = ""; + this.footerRight = ""; + } + + /** + * 构造函数,传入页眉页脚内容 + */ + public BaseExcelHeaderFooterHandler(String headerCenter, String headerLeft, String headerRight, + String footerCenter, String footerLeft, String footerRight) { + this.headerCenter = headerCenter; + this.headerLeft = headerLeft; + this.headerRight = headerRight; + this.footerCenter = footerCenter; + this.footerLeft = footerLeft; + this.footerRight = footerRight; + } + + @Override + public void beforeSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) { + // 无需操作 + } + + @Override + public void afterSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) { + Sheet sheet = writeSheetHolder.getSheet(); + Header header = sheet.getHeader(); + if (headerLeft != null) { + header.setLeft(headerLeft); + } + if (headerCenter != null) { + header.setCenter(headerCenter); + } + if (headerRight != null) { + header.setRight(headerRight); + } + // 设置页脚 + Footer footer = sheet.getFooter(); + if (footerLeft != null) { + footer.setLeft(footerLeft); + } + if (footerCenter != null) { + footer.setCenter(footerCenter); + } + if (footerRight != null) { + footer.setRight(footerRight); + } + sheet.setFitToPage(true); + sheet.setHorizontallyCenter(true); + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/excel/EasyExcelUtil.java b/src/main/java/com/iqudoo/framework/tape/modules/excel/EasyExcelUtil.java new file mode 100644 index 0000000..6199746 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/excel/EasyExcelUtil.java @@ -0,0 +1,75 @@ +package com.iqudoo.framework.tape.modules.excel; + +import com.alibaba.excel.EasyExcel; +import com.alibaba.excel.ExcelWriter; +import com.alibaba.excel.write.metadata.WriteSheet; +import com.alibaba.excel.write.metadata.style.WriteCellStyle; +import com.alibaba.excel.write.style.HorizontalCellStyleStrategy; +import org.apache.poi.ss.usermodel.BorderStyle; +import org.apache.poi.ss.usermodel.HorizontalAlignment; +import org.apache.poi.ss.usermodel.IndexedColors; +import org.apache.poi.ss.usermodel.VerticalAlignment; + +import javax.servlet.http.HttpServletResponse; +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; + +@SuppressWarnings("unused") +public class EasyExcelUtil { + + public static BaseEasyExcelReadResponse readSheet(InputStream inputStream, Class clazz, BaseEasyExcelReadAbstractListener excelListener) throws IOException { + EasyExcel.read(inputStream, clazz, excelListener).sheet(0).doRead(); + return excelListener.getResponse(); + } + + public static BaseEasyExcelReadResponse readSheet(InputStream inputStream, String sheetName, Class clazz, BaseEasyExcelReadAbstractListener excelListener) throws IOException { + EasyExcel.read(inputStream, clazz, excelListener).sheet(sheetName).doRead(); + return excelListener.getResponse(); + } + + public static BaseEasyExcelReadResponse readAll(InputStream inputStream, Class clazz, BaseEasyExcelReadAbstractListener excelListener) throws IOException { + EasyExcel.read(inputStream, clazz, excelListener).doReadAll(); + return excelListener.getResponse(); + } + + @SuppressWarnings("UnusedAssignment") + public static void exportExcel(HttpServletResponse servletResponse, Class clazz, List dataList, String fileName) throws Throwable { + // 输出流 + OutputStream outputStream = null; + try { + outputStream = servletResponse.getOutputStream(); + WriteCellStyle headWriteCellStyle = new WriteCellStyle(); + headWriteCellStyle.setFillForegroundColor(IndexedColors.PALE_BLUE.getIndex()); + WriteCellStyle contentWriteCellStyle = new WriteCellStyle(); + contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER); + contentWriteCellStyle.setHorizontalAlignment(HorizontalAlignment.CENTER); + contentWriteCellStyle.setBorderLeft(BorderStyle.THIN); + contentWriteCellStyle.setBorderTop(BorderStyle.THIN); + contentWriteCellStyle.setBorderRight(BorderStyle.THIN); + contentWriteCellStyle.setBorderBottom(BorderStyle.THIN); + HorizontalCellStyleStrategy horizontalCellStyleStrategy + = new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle); + ExcelWriter excelWriter = EasyExcel.write(outputStream).build(); + WriteSheet listSheet = EasyExcel.writerSheet("Sheet1") + .head(clazz) + .registerWriteHandler(new BaseExcelCellWriteHandler()) + .registerWriteHandler(horizontalCellStyleStrategy) + .build(); + excelWriter.write(dataList, listSheet); + servletResponse.setHeader("Content-Disposition", "attachment;filename=" + fileName + ".xlsx"); + servletResponse.setContentType("application/vnd.ms-excel"); + servletResponse.setCharacterEncoding("utf-8"); + excelWriter.finish(); + outputStream.flush(); + outputStream.close(); + } finally { + if (outputStream != null) { + outputStream.close(); + outputStream = null; + } + } + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/fileManager/FileConfig.java b/src/main/java/com/iqudoo/framework/tape/modules/fileManager/FileConfig.java new file mode 100644 index 0000000..89cfbc1 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/fileManager/FileConfig.java @@ -0,0 +1,79 @@ +package com.iqudoo.framework.tape.modules.fileManager; + +@SuppressWarnings({"unused", "LombokGetterMayBeUsed", "LombokSetterMayBeUsed"}) +public class FileConfig { + + private String type; + private String ossEndpoint = ""; + private String ossAccessKeyId = ""; + private String ossAccessKeySecret = ""; + private String ossBucketName = ""; + private String localRootPath = ""; + + private String domainProtocol = ""; + private String domainName = ""; + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getOssEndpoint() { + return ossEndpoint; + } + + public void setOssEndpoint(String ossEndpoint) { + this.ossEndpoint = ossEndpoint; + } + + public String getOssAccessKeyId() { + return ossAccessKeyId; + } + + public void setOssAccessKeyId(String ossAccessKeyId) { + this.ossAccessKeyId = ossAccessKeyId; + } + + public String getOssAccessKeySecret() { + return ossAccessKeySecret; + } + + public void setOssAccessKeySecret(String ossAccessKeySecret) { + this.ossAccessKeySecret = ossAccessKeySecret; + } + + public String getOssBucketName() { + return ossBucketName; + } + + public void setOssBucketName(String ossBucketName) { + this.ossBucketName = ossBucketName; + } + + public String getLocalRootPath() { + return localRootPath; + } + + public void setLocalRootPath(String localRootPath) { + this.localRootPath = localRootPath; + } + + public String getDomainProtocol() { + return domainProtocol; + } + + public void setDomainProtocol(String domainProtocol) { + this.domainProtocol = domainProtocol; + } + + public String getDomainName() { + return domainName; + } + + public void setDomainName(String domainName) { + this.domainName = domainName; + } +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/fileManager/FileInfo.java b/src/main/java/com/iqudoo/framework/tape/modules/fileManager/FileInfo.java new file mode 100644 index 0000000..941198c --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/fileManager/FileInfo.java @@ -0,0 +1,42 @@ +package com.iqudoo.framework.tape.modules.fileManager; + +@SuppressWarnings({"LombokGetterMayBeUsed", "LombokSetterMayBeUsed"}) +public class FileInfo { + + private String fileType; + private String fileName; + private long fileSize; + private long lastModified; + + public String getFileType() { + return fileType; + } + + public void setFileType(String fileType) { + this.fileType = fileType; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public long getFileSize() { + return fileSize; + } + + public void setFileSize(long fileSize) { + this.fileSize = fileSize; + } + + public long getLastModified() { + return lastModified; + } + + public void setLastModified(long lastModified) { + this.lastModified = lastModified; + } +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/proto/Proto.java b/src/main/java/com/iqudoo/framework/tape/modules/proto/Proto.java new file mode 100644 index 0000000..e668183 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/proto/Proto.java @@ -0,0 +1,66 @@ +package com.iqudoo.framework.tape.modules.proto; + +import java.io.Serializable; + +@SuppressWarnings({"LombokGetterMayBeUsed", "LombokSetterMayBeUsed"}) +public class Proto implements Serializable { + + public static final int SUCCESS_CODE = 0; + public static final int FAILURE_CODE = -1; + + private int code; + private long useTime; + private Throwable err; + private D data; + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + public long getUseTime() { + return useTime; + } + + public void setUseTime(long useTime) { + this.useTime = useTime; + } + + public Throwable getErr() { + return err; + } + + public void setErr(Throwable err) { + this.err = err; + } + + public D getData() { + return data; + } + + public void setData(D data) { + this.data = data; + } + + public boolean isSuccess() { + return code == SUCCESS_CODE; + } + + public static Proto resolve(D data) { + return resolve(data, 0L); + } + + public static Proto resolve(D data, long useTime) { + Proto proto = new Proto<>(); + proto.setErr(null); + proto.setCode(SUCCESS_CODE); + proto.setData(data); + proto.setUseTime(useTime); + return proto; + } + + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/proto/ProtoLoader.java b/src/main/java/com/iqudoo/framework/tape/modules/proto/ProtoLoader.java new file mode 100644 index 0000000..dd68aef --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/proto/ProtoLoader.java @@ -0,0 +1,80 @@ +package com.iqudoo.framework.tape.modules.proto; + +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.modules.IModuleLock; +import com.iqudoo.framework.tape.modules.utils.ReflectUtil; + +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.List; + +public abstract class ProtoLoader { + + /** + * 锁键缓存 + */ + private final List LOCK_KEYS = new ArrayList<>(); + + /** + * 验证并设置锁,会在执行结束后自动释放,不存在锁时,才会通过锁验证并设置新的锁 + * + * @param key 锁键 + * @throws Throwable 锁异常 + */ + public void lock(String key) throws Throwable { + if (key == null || key.isEmpty()) { + return; + } + Tape.getService(IModuleLock.class) + .lock(key, 0); + this.LOCK_KEYS.add(key); + } + + /** + * 验证并设置超时锁,超时锁不会自动释放,只有过了超时时间,才会通过锁验证并设置新的超时锁 + * + * @param key 锁键 + * @param timeoutMs 超时时间 + * @throws Throwable 锁异常 + */ + public void timeoutLock(String key, long timeoutMs) throws Throwable { + if (key == null || key.isEmpty()) { + return; + } + if (timeoutMs <= 0) { + return; + } + Tape.getService(IModuleLock.class) + .lock(key, timeoutMs); + } + + /** + * 强制移除锁 + * + * @param key 锁键 + * @throws Throwable 锁异常 + */ + public void removeLock(String key) throws Throwable { + if (key == null || key.isEmpty()) { + return; + } + // only can unlock self add lock + Tape.getService(IModuleLock.class) + .unlock(key); + this.LOCK_KEYS.remove(key); + } + + public abstract T onLoad(P loadParam) throws Throwable; + + public void handleResponseAfter(T t, P params) throws Throwable { + } + + protected Type getType(int index) { + return ReflectUtil.getType(getClass(), index); + } + + public List getLockKeys() { + return LOCK_KEYS; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/proto/ProtoUtil.java b/src/main/java/com/iqudoo/framework/tape/modules/proto/ProtoUtil.java new file mode 100644 index 0000000..2770834 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/proto/ProtoUtil.java @@ -0,0 +1,78 @@ +package com.iqudoo.framework.tape.modules.proto; + +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.base.action.bean.ActionParam; +import com.iqudoo.framework.tape.base.action.bean.ActionState; +import com.iqudoo.framework.tape.modules.IModuleLock; +import org.slf4j.Logger; + +import java.util.Date; + +public class ProtoUtil { + + private static final Logger LOGGER = Tape.getLogger(ProtoUtil.class); + + public static Proto load(P params, ProtoLoader loader) throws Throwable { + if (params instanceof ActionParam) { + return load(params, loader, ((ActionParam) params).isThrowThrowable()); + } + return load(params, loader, false); + } + + public static Proto load(P params, ProtoLoader loader, boolean throwThrowable) throws Throwable { + String actionString = null; + if (params instanceof ActionParam actionParam) { + if (actionParam.getActionRequest() != null && actionParam.getActionRequest().getActionParameter() != null) { + actionString = actionParam.getActionRequest().getActionParameter().getAction(); + } + } + if (actionString != null) { + actionString = "\n\t|-> action: " + actionString; + } else { + actionString = ""; + } + Proto proto = new Proto<>(); + long startTime = new Date().getTime(); + try { + T data = loader.onLoad(params); + loader.handleResponseAfter(data, params); + proto.setCode(Proto.SUCCESS_CODE); + proto.setData(data); + } catch (Throwable e) { + if (throwThrowable) { + throw e; + } + if (!(e instanceof ActionState) + && !(e instanceof IllegalArgumentException)) { + LOGGER.error("[PROTO] load error" + + actionString + + "\n\t|-> param type: {}" + + "\n\t|-----------------------------------", params, e); + } + proto.setCode(Proto.FAILURE_CODE); + proto.setErr(e); + } finally { + // release lock + try { + IModuleLock moduleLock = Tape.getService(IModuleLock.class); + for (String key : loader.getLockKeys()) { + moduleLock.unlock(key); + } + loader.getLockKeys().clear(); + } catch (Throwable ignored) { + } + } + long useTime = new Date().getTime() - startTime; + if (useTime > 2000) { + LOGGER.error("[PROTO] handle proto load use long time" + + actionString + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-> return type: " + loader.getType(0) + + "\n\t|-> param type: " + loader.getType(1) + + "\n\t|-----------------------------------"); + } + proto.setUseTime(useTime); + return proto; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/serializer/LongListToStringListSerializer.java b/src/main/java/com/iqudoo/framework/tape/modules/serializer/LongListToStringListSerializer.java new file mode 100644 index 0000000..4986214 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/serializer/LongListToStringListSerializer.java @@ -0,0 +1,31 @@ +package com.iqudoo.framework.tape.modules.serializer; + +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +import java.io.IOException; +import java.util.List; +import java.util.function.Function; +import java.util.stream.Collectors; + +public class LongListToStringListSerializer extends JsonSerializer> { + + @Override + public void serialize(List longs, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { + if (null != jsonGenerator) { + // try to parse as JSONArray + List stringList = longs.stream() + .map(new Function() { + @Override + public String apply(Long aLong) { + return aLong + ""; + } + }) + .collect(Collectors.toList()); + jsonGenerator.writeObject(stringList); + } + } + + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/serializer/ToJsonArraySerializer.java b/src/main/java/com/iqudoo/framework/tape/modules/serializer/ToJsonArraySerializer.java new file mode 100644 index 0000000..e6a2e18 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/serializer/ToJsonArraySerializer.java @@ -0,0 +1,29 @@ +package com.iqudoo.framework.tape.modules.serializer; + +import com.alibaba.fastjson.JSONArray; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +import java.io.IOException; + +public class ToJsonArraySerializer extends JsonSerializer { + + @Override + public void serialize(String s, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { + if (null != jsonGenerator) { + // try to parse as JSONArray + JSONArray jsonArray = null; + try { + jsonArray = JSONArray.parseArray(s); + } catch (Throwable ignored) { + } + if (jsonArray != null) { + jsonGenerator.writeObject(jsonArray); + } else { + jsonGenerator.writeObject(new JSONArray()); + } + } + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/serializer/ToJsonObjSerializer.java b/src/main/java/com/iqudoo/framework/tape/modules/serializer/ToJsonObjSerializer.java new file mode 100644 index 0000000..6f4411b --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/serializer/ToJsonObjSerializer.java @@ -0,0 +1,30 @@ +package com.iqudoo.framework.tape.modules.serializer; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +import java.io.IOException; + +public class ToJsonObjSerializer extends JsonSerializer { + + @Override + public void serialize(String s, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { + if (null != jsonGenerator) { + // try to parse as JSONObject + JSONObject jsonObject = null; + try { + jsonObject = JSON.parseObject(s); + } catch (Throwable ignored) { + } + if (null != jsonObject) { + jsonGenerator.writeObject(jsonObject); + } else { + jsonGenerator.writeObject(new JSONObject()); + } + } + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/serializer/ToJsonSerializer.java b/src/main/java/com/iqudoo/framework/tape/modules/serializer/ToJsonSerializer.java new file mode 100644 index 0000000..de8cf7a --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/serializer/ToJsonSerializer.java @@ -0,0 +1,37 @@ +package com.iqudoo.framework.tape.modules.serializer; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.fasterxml.jackson.core.JsonGenerator; +import com.fasterxml.jackson.databind.JsonSerializer; +import com.fasterxml.jackson.databind.SerializerProvider; + +import java.io.IOException; + +public class ToJsonSerializer extends JsonSerializer { + + @Override + public void serialize(String s, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException { + if (null != jsonGenerator) { + // try to parse as JSONObject + JSONObject jsonObject = null; + try { + jsonObject = JSON.parseObject(s); + } catch (Throwable ignored) { + } + if (null != jsonObject) { + jsonGenerator.writeObject(jsonObject); + } else { + // try to parse as JSONArray + JSONArray jsonArray = null; + try { + jsonArray = JSONArray.parseArray(s); + } catch (Throwable ignored) { + } + jsonGenerator.writeObject(jsonArray); + } + } + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/session/GetSessionParam.java b/src/main/java/com/iqudoo/framework/tape/modules/session/GetSessionParam.java new file mode 100644 index 0000000..53aaf4c --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/session/GetSessionParam.java @@ -0,0 +1,33 @@ +package com.iqudoo.framework.tape.modules.session; + +@SuppressWarnings({"LombokGetterMayBeUsed", "LombokSetterMayBeUsed"}) +public class GetSessionParam { + + private Long userGuid; + private String userGroup; + private String originPlatform; + + public Long getUserGuid() { + return userGuid; + } + + public void setUserGuid(Long userGuid) { + this.userGuid = userGuid; + } + + public String getUserGroup() { + return userGroup; + } + + public void setUserGroup(String userGroup) { + this.userGroup = userGroup; + } + + public String getOriginPlatform() { + return originPlatform; + } + + public void setOriginPlatform(String originPlatform) { + this.originPlatform = originPlatform; + } +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/session/RefreshSessionParam.java b/src/main/java/com/iqudoo/framework/tape/modules/session/RefreshSessionParam.java new file mode 100644 index 0000000..a05d315 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/session/RefreshSessionParam.java @@ -0,0 +1,61 @@ +package com.iqudoo.framework.tape.modules.session; + +@SuppressWarnings({"LombokGetterMayBeUsed", "LombokSetterMayBeUsed"}) +public class RefreshSessionParam { + + private Long userGuid; + private String userGroup; + private String originPlatform; + private String originDomain; + private String originIp; + private boolean refresh; + + public Long getUserGuid() { + return userGuid; + } + + public void setUserGuid(Long userGuid) { + this.userGuid = userGuid; + } + + public String getUserGroup() { + return userGroup; + } + + public void setUserGroup(String userGroup) { + this.userGroup = userGroup; + } + + public String getOriginPlatform() { + return originPlatform; + } + + public void setOriginPlatform(String originPlatform) { + this.originPlatform = originPlatform; + } + + public String getOriginDomain() { + return originDomain; + } + + public void setOriginDomain(String originDomain) { + this.originDomain = originDomain; + } + + public String getOriginIp() { + return originIp; + } + + public void setOriginIp(String originIp) { + this.originIp = originIp; + } + + public boolean isRefresh() { + return refresh; + } + + public void setRefresh(boolean refresh) { + this.refresh = refresh; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/utils/AddressUtil.java b/src/main/java/com/iqudoo/framework/tape/modules/utils/AddressUtil.java new file mode 100644 index 0000000..f2524ca --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/utils/AddressUtil.java @@ -0,0 +1,940 @@ +package com.iqudoo.framework.tape.modules.utils; + +import java.util.*; +import java.util.regex.Pattern; + +@SuppressWarnings({"DuplicatedCode", "unused"}) +public class AddressUtil { + + private static final List PROVINCE_KEYWORDS = Arrays.asList("省", "自治区", "特别行政区"); + private static final List MUNICIPALITIES = Arrays.asList("北京", "上海", "天津", "重庆"); + private static final List CITY_KEYWORDS = Arrays.asList("市", "自治州", "地区", "盟"); + private static final List DISTRICT_KEYWORDS = Arrays.asList("区", "县", "旗", "自治县", "自治旗"); + private static final List SPECIAL_DISTRICT = Arrays.asList("新区", "开发区", "高新区", "工业园区", "示范区"); + private static final Set CHINA_PROVINCES = new HashSet<>(Arrays.asList( + "北京市", "上海市", "天津市", "重庆市", + "黑龙江省", "吉林省", "辽宁省", "河北省", "河南省", "山东省", "山西省", + "陕西省", "甘肃省", "青海省", "四川省", "贵州省", "云南省", "湖南省", + "湖北省", "江西省", "安徽省", "江苏省", "浙江省", "福建省", "广东省", + "海南省", + "内蒙古自治区", "广西壮族自治区", "西藏自治区", "宁夏回族自治区", "新疆维吾尔自治区", + "香港特别行政区", "澳门特别行政区" + )); + // 完整的省份简称/全称列表(用于清理城市名中的省份前缀) + private static final List PROVINCE_PREFIXES = Arrays.asList( + "北京市", "上海市", "天津市", "重庆市", + "黑龙江省", "吉林省", "辽宁省", "河北省", "河南省", "山东省", "山西省", + "陕西省", "甘肃省", "青海省", "四川省", "贵州省", "云南省", "湖南省", + "湖北省", "江西省", "安徽省", "江苏省", "浙江省", "福建省", "广东省", + "海南省", "台湾省", + "内蒙古自治区", "广西壮族自治区", "西藏自治区", "宁夏回族自治区", "新疆维吾尔自治区", + "香港特别行政区", "澳门特别行政区", + "黑龙江", "吉林", "辽宁", "河北", "河南", "山东", "山西", + "陕西", "甘肃", "青海", "四川", "贵州", "云南", "湖南", + "湖北", "江西", "安徽", "江苏", "浙江", "福建", "广东", "海南", + "新疆", "西藏", "内蒙古", "广西", "宁夏", "香港", "澳门" + ); + + private static final Pattern CLEAN_PATTERN = Pattern.compile("^[^\\u4e00-\\u9fa5a-zA-Z0-9]+"); + private static final Pattern SPACE_PATTERN = Pattern.compile("\\s+"); + + public static AddressInfo parse(String fullAddress) { + if (fullAddress == null || fullAddress.trim().isEmpty()) return null; + String address = preprocessAddress(fullAddress); + String province = null; + String city = null; + String district = null; + String detail = address; + try { + // 1. 解析省 + province = parseProvince(address); + if (province != null) { + detail = address.substring(province.length()); + } + // 2. 解析市 + if (isMunicipality(province)) { + city = province.replace("市", ""); + } else if (detail != null && !detail.isEmpty()) { + String originalCity = parseCity(detail); + if (originalCity != null) { + // 安全清理省份前缀 + String cleanCity = cleanProvincePrefix(originalCity); + int prefixLen = getProvincePrefixLength(originalCity); + detail = detail.substring(originalCity.length()); + city = cleanCity; + } + } + + // 3. 解析区/县(修复版:只取区县名,不包含前面的城市名) + if (detail != null && !detail.isEmpty()) { + district = parseDistrictV2(detail); + if (district != null) { + detail = detail.substring(district.length()); + } + } + + // 4. 补全省份 + if (province == null && city != null) { + province = inferProvinceByCity(city); + } + + } catch (Exception e) { + return new AddressInfo(province, city, district, fullAddress); + } + + detail = cleanupDetail(detail); + return new AddressInfo(province, city, district, detail); + } + + /** + * 清理城市名中的省份前缀 + */ + private static String cleanProvincePrefix(String city) { + if (city == null) return null; + for (String prefix : PROVINCE_PREFIXES) { + if (city.startsWith(prefix)) { + String result = city.substring(prefix.length()); + if (result.endsWith("市") && result.length() > 1) { + return result; + } + } + } + return city; + } + + /** + * 获取省份前缀的长度 + */ + private static int getProvincePrefixLength(String city) { + if (city == null) return 0; + for (String prefix : PROVINCE_PREFIXES) { + if (city.startsWith(prefix)) { + return prefix.length(); + } + } + return 0; + } + + private static String preprocessAddress(String address) { + if (address == null) return null; + String res = convertFullWidthToHalfWidth(address); + res = SPACE_PATTERN.matcher(res).replaceAll(""); + res = CLEAN_PATTERN.matcher(res).replaceFirst(""); + return res.trim(); + } + + private static String convertFullWidthToHalfWidth(String input) { + char[] c = input.toCharArray(); + for (int i = 0; i < c.length; i++) { + if (c[i] == ' ') c[i] = ' '; + else if (c[i] >= 'A' && c[i] <= 'Z') c[i] -= 65248; + else if (c[i] >= 'a' && c[i] <= 'z') c[i] -= 65248; + else if (c[i] >= '0' && c[i] <= '9') c[i] -= 65248; + } + return new String(c); + } + + private static String parseProvince(String address) { + for (String p : CHINA_PROVINCES) if (address.startsWith(p)) return p; + for (String m : MUNICIPALITIES) if (address.startsWith(m)) return m + "市"; + for (String k : PROVINCE_KEYWORDS) { + int idx = address.indexOf(k); + if (idx > 0 && idx < 15) return address.substring(0, idx + k.length()); + } + return null; + } + + private static String parseCity(String address) { + int min = Integer.MAX_VALUE; + String match = null; + for (String k : CITY_KEYWORDS) { + int idx = address.indexOf(k); + if (idx > 0 && idx < min) { + min = idx; + match = address.substring(0, idx + k.length()); + } + } + return (match != null && match.length() <= 20) ? match : null; + } + + /** + * 解析区县(修复版) + * 只提取区县名称,不包含前面的内容 + */ + private static String parseDistrictV2(String address) { + if (address == null || address.isEmpty()) return null; + + // 特殊区县级关键词 + for (String key : SPECIAL_DISTRICT) { + int idx = address.indexOf(key); + if (idx > 0 && idx <= 10) { + // 向前查找区名的起始位置 + int start = idx; + for (int i = idx - 1; i >= 0; i--) { + char ch = address.charAt(i); + if (ch < 0x4E00 || ch > 0x9FA5 || idx - i > 5) { + break; + } + start = i; + } + String district = address.substring(start, idx + key.length()); + // 验证区名不包含"市"字 + if (district.length() >= 2 && district.length() <= 12) { + if (!district.contains("市") || district.equals("市区")) { + return district; + } + } + } + } + + // 标准区县级关键词 + for (String key : DISTRICT_KEYWORDS) { + int idx = address.indexOf(key); + if (idx > 0 && idx <= 8) { + // 向前查找区名的起始位置 + int start = idx; + for (int i = idx - 1; i >= 0; i--) { + char ch = address.charAt(i); + if (ch < 0x4E00 || ch > 0x9FA5 || idx - i > 4) { + break; + } + start = i; + } + String district = address.substring(start, idx + key.length()); + // 验证区名合理性 + if (district.length() >= 2 && district.length() <= 8) { + if (!district.contains("市") || district.equals("市区")) { + return district; + } + } + } + } + + return null; + } + + private static String inferProvinceByCity(String city) { + if (city == null) return null; + Map map = buildFullCityMap(); + // 直接匹配 + String res = map.get(city); + if (res != null) return res; + // 去掉"市"字匹配 + if (city.endsWith("市")) { + res = map.get(city.substring(0, city.length() - 1)); + return res; + } + return null; + } + + private static Map buildFullCityMap() { + Map map = new HashMap<>(); + + // 直辖市 + map.put("北京", "北京市"); + map.put("北京市", "北京市"); + map.put("上海", "上海市"); + map.put("上海市", "上海市"); + map.put("天津", "天津市"); + map.put("天津市", "天津市"); + map.put("重庆", "重庆市"); + map.put("重庆市", "重庆市"); + + // 江苏 + map.put("南京", "江苏省"); + map.put("南京市", "江苏省"); + map.put("苏州", "江苏省"); + map.put("苏州市", "江苏省"); + map.put("昆山", "江苏省"); + map.put("昆山市", "江苏省"); + map.put("无锡", "江苏省"); + map.put("无锡市", "江苏省"); + map.put("常州", "江苏省"); + map.put("常州市", "江苏省"); + map.put("镇江", "江苏省"); + map.put("镇江市", "江苏省"); + map.put("南通", "江苏省"); + map.put("南通市", "江苏省"); + map.put("扬州", "江苏省"); + map.put("扬州市", "江苏省"); + map.put("盐城", "江苏省"); + map.put("盐城市", "江苏省"); + map.put("徐州", "江苏省"); + map.put("徐州市", "江苏省"); + map.put("淮安", "江苏省"); + map.put("淮安市", "江苏省"); + map.put("连云港", "江苏省"); + map.put("连云港市", "江苏省"); + map.put("泰州", "江苏省"); + map.put("泰州市", "江苏省"); + map.put("宿迁", "江苏省"); + map.put("宿迁市", "江苏省"); + + // 浙江 + map.put("杭州", "浙江省"); + map.put("杭州市", "浙江省"); + map.put("宁波", "浙江省"); + map.put("宁波市", "浙江省"); + map.put("温州", "浙江省"); + map.put("温州市", "浙江省"); + map.put("嘉兴", "浙江省"); + map.put("嘉兴市", "浙江省"); + map.put("湖州", "浙江省"); + map.put("湖州市", "浙江省"); + map.put("绍兴", "浙江省"); + map.put("绍兴市", "浙江省"); + map.put("金华", "浙江省"); + map.put("金华市", "浙江省"); + map.put("衢州", "浙江省"); + map.put("衢州市", "浙江省"); + map.put("舟山", "浙江省"); + map.put("舟山市", "浙江省"); + map.put("台州", "浙江省"); + map.put("台州市", "浙江省"); + map.put("丽水", "浙江省"); + map.put("丽水市", "浙江省"); + + // 广东 + map.put("广州", "广东省"); + map.put("广州市", "广东省"); + map.put("深圳", "广东省"); + map.put("深圳市", "广东省"); + map.put("珠海", "广东省"); + map.put("珠海市", "广东省"); + map.put("汕头", "广东省"); + map.put("汕头市", "广东省"); + map.put("佛山", "广东省"); + map.put("佛山市", "广东省"); + map.put("韶关", "广东省"); + map.put("韶关市", "广东省"); + map.put("湛江", "广东省"); + map.put("湛江市", "广东省"); + map.put("肇庆", "广东省"); + map.put("肇庆市", "广东省"); + map.put("江门", "广东省"); + map.put("江门市", "广东省"); + map.put("茂名", "广东省"); + map.put("茂名市", "广东省"); + map.put("惠州", "广东省"); + map.put("惠州市", "广东省"); + map.put("梅州", "广东省"); + map.put("梅州市", "广东省"); + map.put("汕尾", "广东省"); + map.put("汕尾市", "广东省"); + map.put("河源", "广东省"); + map.put("河源市", "广东省"); + map.put("阳江", "广东省"); + map.put("阳江市", "广东省"); + map.put("清远", "广东省"); + map.put("清远市", "广东省"); + map.put("东莞", "广东省"); + map.put("东莞市", "广东省"); + map.put("中山", "广东省"); + map.put("中山市", "广东省"); + map.put("潮州", "广东省"); + map.put("潮州市", "广东省"); + map.put("揭阳", "广东省"); + map.put("揭阳市", "广东省"); + map.put("云浮", "广东省"); + map.put("云浮市", "广东省"); + + // 四川 + map.put("成都", "四川省"); + map.put("成都市", "四川省"); + map.put("自贡", "四川省"); + map.put("自贡市", "四川省"); + map.put("攀枝花", "四川省"); + map.put("攀枝花市", "四川省"); + map.put("泸州", "四川省"); + map.put("泸州市", "四川省"); + map.put("德阳", "四川省"); + map.put("德阳市", "四川省"); + map.put("绵阳", "四川省"); + map.put("绵阳市", "四川省"); + map.put("广元", "四川省"); + map.put("广元市", "四川省"); + map.put("遂宁", "四川省"); + map.put("遂宁市", "四川省"); + map.put("内江", "四川省"); + map.put("内江市", "四川省"); + map.put("乐山", "四川省"); + map.put("乐山市", "四川省"); + map.put("南充", "四川省"); + map.put("南充市", "四川省"); + map.put("眉山", "四川省"); + map.put("眉山市", "四川省"); + map.put("宜宾", "四川省"); + map.put("宜宾市", "四川省"); + map.put("广安", "四川省"); + map.put("广安市", "四川省"); + map.put("达州", "四川省"); + map.put("达州市", "四川省"); + map.put("雅安", "四川省"); + map.put("雅安市", "四川省"); + map.put("巴中", "四川省"); + map.put("巴中市", "四川省"); + map.put("资阳", "四川省"); + map.put("资阳市", "四川省"); + + // 湖北 + map.put("武汉", "湖北省"); + map.put("武汉市", "湖北省"); + map.put("黄石", "湖北省"); + map.put("黄石市", "湖北省"); + map.put("十堰", "湖北省"); + map.put("十堰市", "湖北省"); + map.put("宜昌", "湖北省"); + map.put("宜昌市", "湖北省"); + map.put("襄阳", "湖北省"); + map.put("襄阳市", "湖北省"); + map.put("鄂州", "湖北省"); + map.put("鄂州市", "湖北省"); + map.put("荆门", "湖北省"); + map.put("荆门市", "湖北省"); + map.put("孝感", "湖北省"); + map.put("孝感市", "湖北省"); + map.put("荆州", "湖北省"); + map.put("荆州市", "湖北省"); + map.put("黄冈", "湖北省"); + map.put("黄冈市", "湖北省"); + map.put("咸宁", "湖北省"); + map.put("咸宁市", "湖北省"); + map.put("随州", "湖北省"); + map.put("随州市", "湖北省"); + + // 湖南 + map.put("长沙", "湖南省"); + map.put("长沙市", "湖南省"); + map.put("株洲", "湖南省"); + map.put("株洲市", "湖南省"); + map.put("湘潭", "湖南省"); + map.put("湘潭市", "湖南省"); + map.put("衡阳", "湖南省"); + map.put("衡阳市", "湖南省"); + map.put("邵阳", "湖南省"); + map.put("邵阳市", "湖南省"); + map.put("岳阳", "湖南省"); + map.put("岳阳市", "湖南省"); + map.put("常德", "湖南省"); + map.put("常德市", "湖南省"); + map.put("张家界", "湖南省"); + map.put("张家界市", "湖南省"); + map.put("益阳", "湖南省"); + map.put("益阳市", "湖南省"); + map.put("郴州", "湖南省"); + map.put("郴州市", "湖南省"); + map.put("永州", "湖南省"); + map.put("永州市", "湖南省"); + map.put("怀化", "湖南省"); + map.put("怀化市", "湖南省"); + map.put("娄底", "湖南省"); + map.put("娄底市", "湖南省"); + + // 福建 + map.put("福州", "福建省"); + map.put("福州市", "福建省"); + map.put("厦门", "福建省"); + map.put("厦门市", "福建省"); + map.put("莆田", "福建省"); + map.put("莆田市", "福建省"); + map.put("三明", "福建省"); + map.put("三明市", "福建省"); + map.put("泉州", "福建省"); + map.put("泉州市", "福建省"); + map.put("漳州", "福建省"); + map.put("漳州市", "福建省"); + map.put("南平", "福建省"); + map.put("南平市", "福建省"); + map.put("龙岩", "福建省"); + map.put("龙岩市", "福建省"); + map.put("宁德", "福建省"); + map.put("宁德市", "福建省"); + + // 安徽 + map.put("合肥", "安徽省"); + map.put("合肥市", "安徽省"); + map.put("芜湖", "安徽省"); + map.put("芜湖市", "安徽省"); + map.put("蚌埠", "安徽省"); + map.put("蚌埠市", "安徽省"); + map.put("淮南", "安徽省"); + map.put("淮南市", "安徽省"); + map.put("马鞍山", "安徽省"); + map.put("马鞍山市", "安徽省"); + map.put("淮北", "安徽省"); + map.put("淮北市", "安徽省"); + map.put("铜陵", "安徽省"); + map.put("铜陵市", "安徽省"); + map.put("安庆", "安徽省"); + map.put("安庆市", "安徽省"); + map.put("黄山", "安徽省"); + map.put("黄山市", "安徽省"); + map.put("滁州", "安徽省"); + map.put("滁州市", "安徽省"); + map.put("阜阳", "安徽省"); + map.put("阜阳市", "安徽省"); + map.put("宿州", "安徽省"); + map.put("宿州市", "安徽省"); + map.put("六安", "安徽省"); + map.put("六安市", "安徽省"); + map.put("亳州", "安徽省"); + map.put("亳州市", "安徽省"); + map.put("池州", "安徽省"); + map.put("池州市", "安徽省"); + map.put("宣城", "安徽省"); + map.put("宣城市", "安徽省"); + + // 江西 + map.put("南昌", "江西省"); + map.put("南昌市", "江西省"); + map.put("景德镇", "江西省"); + map.put("景德镇市", "江西省"); + map.put("萍乡", "江西省"); + map.put("萍乡市", "江西省"); + map.put("九江", "江西省"); + map.put("九江市", "江西省"); + map.put("新余", "江西省"); + map.put("新余市", "江西省"); + map.put("鹰潭", "江西省"); + map.put("鹰潭市", "江西省"); + map.put("赣州", "江西省"); + map.put("赣州市", "江西省"); + map.put("吉安", "江西省"); + map.put("吉安市", "江西省"); + map.put("宜春", "江西省"); + map.put("宜春市", "江西省"); + map.put("抚州", "江西省"); + map.put("抚州市", "江西省"); + map.put("上饶", "江西省"); + map.put("上饶市", "江西省"); + + // 山东 + map.put("济南", "山东省"); + map.put("济南市", "山东省"); + map.put("青岛", "山东省"); + map.put("青岛市", "山东省"); + map.put("淄博", "山东省"); + map.put("淄博市", "山东省"); + map.put("枣庄", "山东省"); + map.put("枣庄市", "山东省"); + map.put("东营", "山东省"); + map.put("东营市", "山东省"); + map.put("烟台", "山东省"); + map.put("烟台市", "山东省"); + map.put("潍坊", "山东省"); + map.put("潍坊市", "山东省"); + map.put("济宁", "山东省"); + map.put("济宁市", "山东省"); + map.put("泰安", "山东省"); + map.put("泰安市", "山东省"); + map.put("威海", "山东省"); + map.put("威海市", "山东省"); + map.put("日照", "山东省"); + map.put("日照市", "山东省"); + map.put("临沂", "山东省"); + map.put("临沂市", "山东省"); + map.put("德州", "山东省"); + map.put("德州市", "山东省"); + map.put("聊城", "山东省"); + map.put("聊城市", "山东省"); + map.put("滨州", "山东省"); + map.put("滨州市", "山东省"); + map.put("菏泽", "山东省"); + map.put("菏泽市", "山东省"); + + // 西藏 + map.put("拉萨", "西藏自治区"); + map.put("拉萨市", "西藏自治区"); + map.put("山南", "西藏自治区"); + map.put("山南市", "西藏自治区"); + map.put("日喀则", "西藏自治区"); + map.put("日喀则市", "西藏自治区"); + map.put("昌都", "西藏自治区"); + map.put("昌都市", "西藏自治区"); + map.put("林芝", "西藏自治区"); + map.put("林芝市", "西藏自治区"); + map.put("那曲", "西藏自治区"); + map.put("那曲市", "西藏自治区"); + + // 新疆 + map.put("乌鲁木齐", "新疆维吾尔自治区"); + map.put("乌鲁木齐市", "新疆维吾尔自治区"); + map.put("克拉玛依", "新疆维吾尔自治区"); + map.put("克拉玛依市", "新疆维吾尔自治区"); + map.put("吐鲁番", "新疆维吾尔自治区"); + map.put("吐鲁番市", "新疆维吾尔自治区"); + map.put("哈密", "新疆维吾尔自治区"); + map.put("哈密市", "新疆维吾尔自治区"); + + // 广西 + map.put("南宁", "广西壮族自治区"); + map.put("南宁市", "广西壮族自治区"); + map.put("柳州", "广西壮族自治区"); + map.put("柳州市", "广西壮族自治区"); + map.put("桂林", "广西壮族自治区"); + map.put("桂林市", "广西壮族自治区"); + map.put("梧州", "广西壮族自治区"); + map.put("梧州市", "广西壮族自治区"); + map.put("北海", "广西壮族自治区"); + map.put("北海市", "广西壮族自治区"); + map.put("防城港", "广西壮族自治区"); + map.put("防城港市", "广西壮族自治区"); + map.put("钦州", "广西壮族自治区"); + map.put("钦州市", "广西壮族自治区"); + map.put("贵港", "广西壮族自治区"); + map.put("贵港市", "广西壮族自治区"); + map.put("玉林", "广西壮族自治区"); + map.put("玉林市", "广西壮族自治区"); + map.put("百色", "广西壮族自治区"); + map.put("百色市", "广西壮族自治区"); + map.put("贺州", "广西壮族自治区"); + map.put("贺州市", "广西壮族自治区"); + map.put("河池", "广西壮族自治区"); + map.put("河池市", "广西壮族自治区"); + map.put("来宾", "广西壮族自治区"); + map.put("来宾市", "广西壮族自治区"); + map.put("崇左", "广西壮族自治区"); + map.put("崇左市", "广西壮族自治区"); + + // 内蒙古 + map.put("呼和浩特", "内蒙古自治区"); + map.put("呼和浩特市", "内蒙古自治区"); + map.put("包头", "内蒙古自治区"); + map.put("包头市", "内蒙古自治区"); + map.put("乌海", "内蒙古自治区"); + map.put("乌海市", "内蒙古自治区"); + map.put("赤峰", "内蒙古自治区"); + map.put("赤峰市", "内蒙古自治区"); + map.put("通辽", "内蒙古自治区"); + map.put("通辽市", "内蒙古自治区"); + map.put("鄂尔多斯", "内蒙古自治区"); + map.put("鄂尔多斯市", "内蒙古自治区"); + map.put("呼伦贝尔", "内蒙古自治区"); + map.put("呼伦贝尔市", "内蒙古自治区"); + map.put("巴彦淖尔", "内蒙古自治区"); + map.put("巴彦淖尔市", "内蒙古自治区"); + map.put("乌兰察布", "内蒙古自治区"); + map.put("乌兰察布市", "内蒙古自治区"); + + // 宁夏 + map.put("银川", "宁夏回族自治区"); + map.put("银川市", "宁夏回族自治区"); + map.put("石嘴山", "宁夏回族自治区"); + map.put("石嘴山市", "宁夏回族自治区"); + map.put("吴忠", "宁夏回族自治区"); + map.put("吴忠市", "宁夏回族自治区"); + map.put("固原", "宁夏回族自治区"); + map.put("固原市", "宁夏回族自治区"); + map.put("中卫", "宁夏回族自治区"); + map.put("中卫市", "宁夏回族自治区"); + + // 海南 + map.put("海口", "海南省"); + map.put("海口市", "海南省"); + map.put("三亚", "海南省"); + map.put("三亚市", "海南省"); + map.put("三沙", "海南省"); + map.put("三沙市", "海南省"); + map.put("儋州", "海南省"); + map.put("儋州市", "海南省"); + + // 贵州 + map.put("贵阳", "贵州省"); + map.put("贵阳市", "贵州省"); + map.put("六盘水", "贵州省"); + map.put("六盘水市", "贵州省"); + map.put("遵义", "贵州省"); + map.put("遵义市", "贵州省"); + map.put("安顺", "贵州省"); + map.put("安顺市", "贵州省"); + map.put("毕节", "贵州省"); + map.put("毕节市", "贵州省"); + map.put("铜仁", "贵州省"); + map.put("铜仁市", "贵州省"); + + // 云南 + map.put("昆明", "云南省"); + map.put("昆明市", "云南省"); + map.put("曲靖", "云南省"); + map.put("曲靖市", "云南省"); + map.put("玉溪", "云南省"); + map.put("玉溪市", "云南省"); + map.put("保山", "云南省"); + map.put("保山市", "云南省"); + map.put("昭通", "云南省"); + map.put("昭通市", "云南省"); + map.put("丽江", "云南省"); + map.put("丽江市", "云南省"); + map.put("普洱", "云南省"); + map.put("普洱市", "云南省"); + map.put("临沧", "云南省"); + map.put("临沧市", "云南省"); + + // 甘肃 + map.put("兰州", "甘肃省"); + map.put("兰州市", "甘肃省"); + map.put("嘉峪关", "甘肃省"); + map.put("嘉峪关市", "甘肃省"); + map.put("金昌", "甘肃省"); + map.put("金昌市", "甘肃省"); + map.put("白银", "甘肃省"); + map.put("白银市", "甘肃省"); + map.put("天水", "甘肃省"); + map.put("天水市", "甘肃省"); + map.put("武威", "甘肃省"); + map.put("武威市", "甘肃省"); + map.put("张掖", "甘肃省"); + map.put("张掖市", "甘肃省"); + map.put("平凉", "甘肃省"); + map.put("平凉市", "甘肃省"); + map.put("酒泉", "甘肃省"); + map.put("酒泉市", "甘肃省"); + map.put("庆阳", "甘肃省"); + map.put("庆阳市", "甘肃省"); + map.put("定西", "甘肃省"); + map.put("定西市", "甘肃省"); + map.put("陇南", "甘肃省"); + map.put("陇南市", "甘肃省"); + + // 青海 + map.put("西宁", "青海省"); + map.put("西宁市", "青海省"); + map.put("海东", "青海省"); + map.put("海东市", "青海省"); + + // 陕西 + map.put("西安", "陕西省"); + map.put("西安市", "陕西省"); + map.put("铜川", "陕西省"); + map.put("铜川市", "陕西省"); + map.put("宝鸡", "陕西省"); + map.put("宝鸡市", "陕西省"); + map.put("咸阳", "陕西省"); + map.put("咸阳市", "陕西省"); + map.put("渭南", "陕西省"); + map.put("渭南市", "陕西省"); + map.put("延安", "陕西省"); + map.put("延安市", "陕西省"); + map.put("汉中", "陕西省"); + map.put("汉中市", "陕西省"); + map.put("榆林", "陕西省"); + map.put("榆林市", "陕西省"); + map.put("安康", "陕西省"); + map.put("安康市", "陕西省"); + map.put("商洛", "陕西省"); + map.put("商洛市", "陕西省"); + + // 辽宁 + map.put("沈阳", "辽宁省"); + map.put("沈阳市", "辽宁省"); + map.put("大连", "辽宁省"); + map.put("大连市", "辽宁省"); + map.put("鞍山", "辽宁省"); + map.put("鞍山市", "辽宁省"); + map.put("抚顺", "辽宁省"); + map.put("抚顺市", "辽宁省"); + map.put("本溪", "辽宁省"); + map.put("本溪市", "辽宁省"); + map.put("丹东", "辽宁省"); + map.put("丹东市", "辽宁省"); + map.put("锦州", "辽宁省"); + map.put("锦州市", "辽宁省"); + map.put("营口", "辽宁省"); + map.put("营口市", "辽宁省"); + map.put("阜新", "辽宁省"); + map.put("阜新市", "辽宁省"); + map.put("辽阳", "辽宁省"); + map.put("辽阳市", "辽宁省"); + map.put("盘锦", "辽宁省"); + map.put("盘锦市", "辽宁省"); + map.put("铁岭", "辽宁省"); + map.put("铁岭市", "辽宁省"); + map.put("朝阳", "辽宁省"); + map.put("朝阳市", "辽宁省"); + map.put("葫芦岛", "辽宁省"); + map.put("葫芦岛市", "辽宁省"); + + // 吉林 + map.put("长春", "吉林省"); + map.put("长春市", "吉林省"); + map.put("吉林", "吉林省"); + map.put("吉林市", "吉林省"); + map.put("四平", "吉林省"); + map.put("四平市", "吉林省"); + map.put("辽源", "吉林省"); + map.put("辽源市", "吉林省"); + map.put("通化", "吉林省"); + map.put("通化市", "吉林省"); + map.put("白山", "吉林省"); + map.put("白山市", "吉林省"); + map.put("松原", "吉林省"); + map.put("松原市", "吉林省"); + map.put("白城", "吉林省"); + map.put("白城市", "吉林省"); + + // 黑龙江 + map.put("哈尔滨", "黑龙江省"); + map.put("哈尔滨市", "黑龙江省"); + map.put("齐齐哈尔", "黑龙江省"); + map.put("齐齐哈尔市", "黑龙江省"); + map.put("鸡西", "黑龙江省"); + map.put("鸡西市", "黑龙江省"); + map.put("鹤岗", "黑龙江省"); + map.put("鹤岗市", "黑龙江省"); + map.put("双鸭山", "黑龙江省"); + map.put("双鸭山市", "黑龙江省"); + map.put("大庆", "黑龙江省"); + map.put("大庆市", "黑龙江省"); + map.put("伊春", "黑龙江省"); + map.put("伊春市", "黑龙江省"); + map.put("佳木斯", "黑龙江省"); + map.put("佳木斯市", "黑龙江省"); + map.put("七台河", "黑龙江省"); + map.put("七台河市", "黑龙江省"); + map.put("牡丹江", "黑龙江省"); + map.put("牡丹江市", "黑龙江省"); + map.put("黑河", "黑龙江省"); + map.put("黑河市", "黑龙江省"); + map.put("绥化", "黑龙江省"); + map.put("绥化市", "黑龙江省"); + + // 河北 + map.put("石家庄", "河北省"); + map.put("石家庄市", "河北省"); + map.put("唐山", "河北省"); + map.put("唐山市", "河北省"); + map.put("秦皇岛", "河北省"); + map.put("秦皇岛市", "河北省"); + map.put("邯郸", "河北省"); + map.put("邯郸市", "河北省"); + map.put("邢台", "河北省"); + map.put("邢台市", "河北省"); + map.put("保定", "河北省"); + map.put("保定市", "河北省"); + map.put("张家口", "河北省"); + map.put("张家口市", "河北省"); + map.put("承德", "河北省"); + map.put("承德市", "河北省"); + map.put("沧州", "河北省"); + map.put("沧州市", "河北省"); + map.put("廊坊", "河北省"); + map.put("廊坊市", "河北省"); + map.put("衡水", "河北省"); + map.put("衡水市", "河北省"); + + // 山西 + map.put("太原", "山西省"); + map.put("太原市", "山西省"); + map.put("大同", "山西省"); + map.put("大同市", "山西省"); + map.put("阳泉", "山西省"); + map.put("阳泉市", "山西省"); + map.put("长治", "山西省"); + map.put("长治市", "山西省"); + map.put("晋城", "山西省"); + map.put("晋城市", "山西省"); + map.put("朔州", "山西省"); + map.put("朔州市", "山西省"); + map.put("晋中", "山西省"); + map.put("晋中市", "山西省"); + map.put("运城", "山西省"); + map.put("运城市", "山西省"); + map.put("忻州", "山西省"); + map.put("忻州市", "山西省"); + map.put("临汾", "山西省"); + map.put("临汾市", "山西省"); + map.put("吕梁", "山西省"); + map.put("吕梁市", "山西省"); + + // 河南 + map.put("郑州", "河南省"); + map.put("郑州市", "河南省"); + map.put("开封", "河南省"); + map.put("开封市", "河南省"); + map.put("洛阳", "河南省"); + map.put("洛阳市", "河南省"); + map.put("平顶山", "河南省"); + map.put("平顶山市", "河南省"); + map.put("安阳", "河南省"); + map.put("安阳市", "河南省"); + map.put("鹤壁", "河南省"); + map.put("鹤壁市", "河南省"); + map.put("新乡", "河南省"); + map.put("新乡市", "河南省"); + map.put("焦作", "河南省"); + map.put("焦作市", "河南省"); + map.put("濮阳", "河南省"); + map.put("濮阳市", "河南省"); + map.put("许昌", "河南省"); + map.put("许昌市", "河南省"); + map.put("漯河", "河南省"); + map.put("漯河市", "河南省"); + map.put("三门峡", "河南省"); + map.put("三门峡市", "河南省"); + map.put("南阳", "河南省"); + map.put("南阳市", "河南省"); + map.put("商丘", "河南省"); + map.put("商丘市", "河南省"); + map.put("信阳", "河南省"); + map.put("信阳市", "河南省"); + map.put("周口", "河南省"); + map.put("周口市", "河南省"); + map.put("驻马店", "河南省"); + map.put("驻马店市", "河南省"); + + return map; + } + + private static String cleanupDetail(String detail) { + if (detail == null) return null; + String res = CLEAN_PATTERN.matcher(detail).replaceFirst("").trim(); + return res.isEmpty() ? null : res; + } + + private static boolean isMunicipality(String province) { + if (province == null) return false; + for (String m : MUNICIPALITIES) if (province.equals(m + "市")) return true; + return false; + } + + // ===================== 结果类 ===================== + @SuppressWarnings("LombokGetterMayBeUsed") + public static class AddressInfo { + private final String province; + private final String city; + private final String district; + private final String detail; + + public AddressInfo(String province, String city, String district, String detail) { + this.province = province; + this.city = city; + this.district = district; + this.detail = detail; + } + + public String getProvince() { + return province; + } + + public String getCity() { + return city; + } + + public String getDistrict() { + return district; + } + + public String getDetail() { + return detail; + } + + @Override + public String toString() { + return String.format("省:%s\n市:%s\n区:%s\n详情:%s", + province == null ? "未识别" : province, + city == null ? "未识别" : city, + district == null ? "未识别" : district, + detail == null ? "无" : detail); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/framework/tape/modules/utils/ArrayUtil.java b/src/main/java/com/iqudoo/framework/tape/modules/utils/ArrayUtil.java new file mode 100644 index 0000000..0799a3f --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/utils/ArrayUtil.java @@ -0,0 +1,357 @@ +package com.iqudoo.framework.tape.modules.utils; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.function.Predicate; + +/** + * 数组工具类 + */ +@SuppressWarnings({"unchecked", "unused", "DuplicatedCode"}) +public class ArrayUtil { + + public interface ForHandler { + + boolean filter(T t); + + void handle(T t); + + } + + public interface FilterHandler { + boolean filter(T t); + } + + public interface DistinctHandler { + String distinctKey(T t); + } + + public interface MapHandler { + R map(T t); + } + + public static abstract class ToHandler implements MapHandler, FilterHandler, DistinctHandler { + + @Override + public boolean filter(T t) { + return true; + } + + @Override + public String distinctKey(R r) { + return null; + } + + public boolean filterNewValue(R t) { + return true; + } + + } + + + public static boolean in(List array, T target) { + for (T val : array) { + if (val != null && val.equals(target)) { + return true; + } + } + return false; + } + + public static boolean in(T[] array, T target) { + for (T val : array) { + if (val != null && val.equals(target)) { + return true; + } + } + return false; + } + + public static List to(List collection, ToHandler handler) { + return filter(distinct(map(filter(collection, handler), handler), handler), new FilterHandler() { + @Override + public boolean filter(R r) { + return handler.filterNewValue(r); + } + }); + } + + public static List map(List collection, MapHandler handler) { + List list = new ArrayList<>(); + if (handler == null) { + return list; + } + if (collection != null) { + for (E e : collection) { + R r = handler.map(e); + if (r != null) { + list.add(r); + } + } + } + return list; + } + + public static void foreach(List collection, ForHandler handler) { + if (handler == null) { + return; + } + if (collection != null) { + for (int i = collection.size() - 1; i >= 0; i--) { + E e = collection.get(i); + if (handler.filter(e)) { + handler.handle(e); + } + } + } + } + + public static List distinct(List collection, DistinctHandler handler) { + if (handler == null) { + return collection; + } + List list = new ArrayList<>(); + if (collection != null) { + List distinctKeyList = new ArrayList<>(); + for (E e : collection) { + String key = handler.distinctKey(e); + if (key == null) { + list.add(e); + } else if (!distinctKeyList.contains(key)) { + distinctKeyList.add(key); + list.add(e); + } + } + } + return list; + } + + public static List filter(List collection, FilterHandler handler) { + if (handler == null) { + return collection; + } + List list = new ArrayList<>(); + if (collection != null) { + for (E e : collection) { + if (handler.filter(e)) { + list.add(e); + } + } + } + return list; + } + + public static boolean hasIf(List collection, FilterHandler handler) { + if (handler == null) { + return false; + } + if (collection != null) { + for (int i = collection.size() - 1; i >= 0; i--) { + E e = collection.get(i); + if (handler.filter(e)) { + return true; + } + } + } + return false; + } + + public static int indexIf(List collection, FilterHandler handler) { + if (handler == null) { + return -1; + } + if (collection != null) { + for (int i = collection.size() - 1; i >= 0; i--) { + E e = collection.get(i); + if (handler.filter(e)) { + return i; + } + } + } + return -1; + } + + public static E findIf(List collection, FilterHandler handler) { + if (handler == null) { + return null; + } + if (collection != null) { + for (int i = collection.size() - 1; i >= 0; i--) { + E e = collection.get(i); + if (handler.filter(e)) { + return e; + } + } + } + return null; + } + + public static List removeIf(List collection, FilterHandler handler) { + if (handler == null) { + return collection; + } + List newCollection = new ArrayList<>(collection); + newCollection.removeIf(new Predicate() { + @Override + public boolean test(E e) { + return handler.filter(e); + } + }); + return collection; + } + + + public static List split(String valStr, String... splitDelimiter) { + List list = new ArrayList<>(); + // 新增空值判断 + if (valStr == null) { + return list; + } + if (splitDelimiter == null || splitDelimiter.length == 0) { + splitDelimiter = new String[]{","}; + } + String[] nextSlitDelimiter = new String[splitDelimiter.length - 1]; + System.arraycopy(splitDelimiter, 1, nextSlitDelimiter, 0, nextSlitDelimiter.length); + List splitList = splitToString(valStr, splitDelimiter[0]); + if (nextSlitDelimiter.length > 0) { + for (String str : splitList) { + list.addAll(split(str, nextSlitDelimiter)); + } + } else { + list.addAll(splitList); + } + return list; + } + + public static List splitTo(String valStr, Class clazz, String... splitDelimiter) { + List stringList = split(valStr, splitDelimiter); + return ArrayUtil.to(stringList, new ToHandler() { + + @Override + public boolean filterNewValue(T t) { + return t != null; + } + + @Override + public T map(String val) { + try { + if (clazz == String.class) { + return (T) val; + } else if (clazz == Integer.class) { + return (T) Integer.valueOf(val); + } else if (clazz == Long.class) { + return (T) Long.valueOf(val); + } else if (clazz == Double.class) { + return (T) Double.valueOf(val); + } else if (clazz == Float.class) { + return (T) Float.valueOf(val); + } else if (clazz == Boolean.class) { + return (T) Boolean.valueOf(val); + } + } catch (Throwable ignored) { + } + return null; + } + }); + } + + + private static List splitToString(String valStr, String splitDelimiter) { + if (valStr != null) { + String[] valArr = valStr.split(splitDelimiter); + List list = new ArrayList<>(); + for (String val : valArr) { + val = val.trim(); + if (val.isEmpty()) { + continue; + } + list.add(val); + } + return list; + } + return null; + } + + + /** + * 计算多个List的交集 + * 交集定义:所有子列表中都共同包含的元素 + * + * @param list list + * @param checkList checkList + * @return 交集 + */ + public static List getListIntersection(List list, List... checkList) { + if (list == null || list.isEmpty()) { + return new ArrayList<>(); + } + if (checkList == null || checkList.length == 0) { + return list; + } + Set intersectionSet = new HashSet<>(checkList[0]); + for (int i = 1; i < checkList.length; i++) { + List currentList = checkList[i]; + if (currentList == null || currentList.isEmpty()) { + return new ArrayList<>(); + } + intersectionSet.retainAll(currentList); + if (intersectionSet.isEmpty()) { + break; + } + } + return new ArrayList<>(intersectionSet); + } + + /** + * 计算 List> 中所有子集合的交集 + * 交集定义:所有子列表中都共同包含的元素 + * + * @param multiList 多维集合 + * @return 交集 + */ + public static List getListIntersection(List> multiList) { + if (multiList == null || multiList.isEmpty()) { + return new ArrayList<>(); + } + if (multiList.size() == 1) { + return new ArrayList<>(multiList.get(0)); + } + Set intersectionSet = new HashSet<>(multiList.get(0)); + for (int i = 1; i < multiList.size(); i++) { + List currentList = multiList.get(i); + if (currentList == null || currentList.isEmpty()) { + return new ArrayList<>(); + } + intersectionSet.retainAll(currentList); + if (intersectionSet.isEmpty()) { + break; + } + } + return new ArrayList<>(intersectionSet); + } + + /** + * 将List拆分成多个子列表 + * + * @param list 原始列表 + * @param chunkSize 个子列表的最大容量 + * @return 拆分后的列表集合 + */ + public static List> getChunkList(List list, int chunkSize) { + List> result = new ArrayList<>(); + if (list == null || list.isEmpty()) { + return result; + } + int totalSize = list.size(); + int chunkCount = (totalSize + chunkSize - 1) / chunkSize; + for (int i = 0; i < chunkCount; i++) { + int start = i * chunkSize; + int end = Math.min(start + chunkSize, totalSize); + result.add(list.subList(start, end)); + } + return result; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/utils/Base64Util.java b/src/main/java/com/iqudoo/framework/tape/modules/utils/Base64Util.java new file mode 100644 index 0000000..929a7d3 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/utils/Base64Util.java @@ -0,0 +1,129 @@ +package com.iqudoo.framework.tape.modules.utils; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.OutputStream; + +/** + * Base64工具类 + */ +public final class Base64Util { + + private static final char[] DEFAULT_LEGAL_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" + .toCharArray(); + + public static String encode(byte[] data) { + return encode(data, DEFAULT_LEGAL_CHARS); + } + + public static byte[] decode(String string) { + return decode(string, DEFAULT_LEGAL_CHARS); + } + + public static String encode(byte[] data, char[] legalChars) { + int start = 0; + int len = data.length; + StringBuilder buf = new StringBuilder(data.length * 3 / 2); + + int end = len - 3; + int i = start; + + while (i <= end) { + int d = ((((int) data[i]) & 0x0ff) << 16) | ((((int) data[i + 1]) & 0x0ff) << 8) + | (((int) data[i + 2]) & 0x0ff); + + buf.append(legalChars[(d >> 18) & 63]); + buf.append(legalChars[(d >> 12) & 63]); + buf.append(legalChars[(d >> 6) & 63]); + buf.append(legalChars[d & 63]); + + i += 3; + } + + if (i == start + len - 2) { + int d = ((((int) data[i]) & 0x0ff) << 16) | ((((int) data[i + 1]) & 255) << 8); + + buf.append(legalChars[(d >> 18) & 63]); + buf.append(legalChars[(d >> 12) & 63]); + buf.append(legalChars[(d >> 6) & 63]); + buf.append("="); + } else if (i == start + len - 1) { + int d = (((int) data[i]) & 0x0ff) << 16; + + buf.append(legalChars[(d >> 18) & 63]); + buf.append(legalChars[(d >> 12) & 63]); + buf.append("=="); + } + + return buf.toString(); + } + + @SuppressWarnings("UnusedAssignment") + public static byte[] decode(String string, char[] legalChars) { + ByteArrayOutputStream bos = new ByteArrayOutputStream(); + try { + decode(string, legalChars, bos); + } catch (IOException e) { + throw new RuntimeException(); + } + byte[] decodedBytes = bos.toByteArray(); + try { + bos.close(); + bos = null; + } catch (IOException ignored) { + } + return decodedBytes; + } + + //////////////////////////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////// Private ///////////////////////////////////////////////// + //////////////////////////////////////////////////////////////////////////////////////////////////// + + private static void decode(String s, char[] legalChars, OutputStream os) throws IOException { + int i = 0; + + int len = s.length(); + + while (true) { + while (i < len && s.charAt(i) <= ' ') + i++; + + if (i == len) + break; + + int tri = (decode(s.charAt(i), legalChars) << 18) + (decode(s.charAt(i + 1), legalChars) << 12) + (decode(s.charAt(i + 2), legalChars) << 6) + + (decode(s.charAt(i + 3), legalChars)); + + os.write((tri >> 16) & 255); + if (s.charAt(i + 2) == '=') + break; + os.write((tri >> 8) & 255); + if (s.charAt(i + 3) == '=') + break; + os.write(tri & 255); + + i += 4; + } + } + + private static int decode(char c, char[] legalChars) { + if (c >= 'A' && c <= 'Z') + return ((int) c) - 65; + else if (c >= 'a' && c <= 'z') + return ((int) c) - 97 + 26; + else if (c >= '0' && c <= '9') + return ((int) c) - 48 + 26 + 26; + else { + if (c == legalChars[62]) { + return 62; + } else if (c == legalChars[63]) { + return 63; + } else if (c == '=') { + return 0; + } else { + throw new RuntimeException("unexpected code: " + c); + } + } + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/utils/DateTimeUtil.java b/src/main/java/com/iqudoo/framework/tape/modules/utils/DateTimeUtil.java new file mode 100644 index 0000000..bb15f97 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/utils/DateTimeUtil.java @@ -0,0 +1,192 @@ +package com.iqudoo.framework.tape.modules.utils; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.Locale; +import java.util.TimeZone; + +@SuppressWarnings("EnhancedSwitchMigration") +public class DateTimeUtil { + + public static String getWeekOfDay(Date date) { + Calendar c = Calendar.getInstance(); + c.setTime(date); + switch (c.get(Calendar.DAY_OF_WEEK)) { + case Calendar.MONDAY: + return "1"; + case Calendar.TUESDAY: + return "2"; + case Calendar.WEDNESDAY: + return "3"; + case Calendar.THURSDAY: + return "4"; + case Calendar.FRIDAY: + return "5"; + case Calendar.SATURDAY: + return "6"; + case Calendar.SUNDAY: + return "7"; + } + return ""; + } + + public static long getDateStartTime(String dateStr) { + return getDateStartTime(dateStr, "yyyy-MM-dd"); + } + + public static long getDateStartTime(String dateStr, String formatStr) { + Date date = parseDate(dateStr, formatStr); + if (date != null) { + return getStartOfDay(date); + } + return 0L; + } + + public static long getDateEndTime(String dateStr) { + return getDateEndTime(dateStr, "yyyy-MM-dd"); + } + + public static long getDateEndTime(String dateStr, String formatStr) { + Date date = parseDate(dateStr, formatStr); + if (date != null) { + return getEndOfDay(date); + } + return 0L; + } + + public static long getStartOfDay(Date date) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); + return calendar.getTimeInMillis(); + } + + public static long getEndOfDay(Date date) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.set(Calendar.HOUR_OF_DAY, 23); + calendar.set(Calendar.MINUTE, 59); + calendar.set(Calendar.SECOND, 59); + calendar.set(Calendar.MILLISECOND, 999); + return calendar.getTimeInMillis() + 1; + } + + /** + * 获取指定日期所属月份的开始时间戳(当月1日 00:00:00) + * + * @param date 目标日期 + * @return 月份开始时间戳(毫秒),若date为null则返回0 + */ + public static long getStartOfMonth(Date date) { + if (date == null) { + return 0L; + } + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.set(Calendar.DAY_OF_MONTH, 1); + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); + return calendar.getTimeInMillis(); + } + + /** + * 获取指定日期所属月份的结束时间戳(当月最后一日 23:59:59 999毫秒) + * + * @param date 目标日期 + * @return 月份结束时间戳(毫秒),若date为null则返回0 + */ + public static long getEndOfMonth(Date date) { + if (date == null) { + return 0L; + } + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.set(Calendar.DAY_OF_MONTH, 1); + calendar.add(Calendar.MONTH, 1); + calendar.add(Calendar.MILLISECOND, -1); + return calendar.getTimeInMillis(); + } + + public static Date parseDate(String date) { + return parseDate(date, "yyyy-MM-dd HH:mm:ss"); + } + + public static Date parseDate(String date, String formatStr) { + Date date1 = null; + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(formatStr); + try { + date1 = simpleDateFormat.parse(date); + } catch (Throwable ignored) { + } + return date1; + } + + public static String formatDate(long timeMs) { + return formatDate(timeMs, "yyyy-MM-dd HH:mm:ss"); + } + + public static String formatDate(Date date) { + return formatDate(date, "yyyy-MM-dd HH:mm:ss"); + } + + public static String formatDate(long timeMs, String formatStr) { + return formatDate(new Date(timeMs), formatStr); + } + + public static String formatDate(Date date, String formatStr) { + if (formatStr == null) { + formatStr = "yyyy-MM-dd HH:mm:ss"; + } + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(formatStr); + return simpleDateFormat.format(date); + } + + ///////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////// + + /** + * Format of http head. + */ + public static final String FORMAT_HTTP_DATA = "EEE, dd MMM y HH:mm:ss 'GMT'"; + + /** + * Commmon TimeZone for GMT. + */ + public static final TimeZone GMT_TIME_ZONE = TimeZone.getTimeZone("GMT"); + + /** + * Parsing the TimeZone of time in milliseconds. + * + * @param gmtTime GRM Time, Format such as: {@value #FORMAT_HTTP_DATA}. + * @return The number of milliseconds from 1970.1.1. + * @throws ParseException if an error occurs during parsing. + */ + public static long parseGMTToMillis(String gmtTime) throws ParseException { + SimpleDateFormat formatter = new SimpleDateFormat(FORMAT_HTTP_DATA, Locale.US); + formatter.setTimeZone(GMT_TIME_ZONE); + Date date = formatter.parse(gmtTime); + return date.getTime(); + } + + /** + * Parsing the TimeZone of time from milliseconds. + * + * @param milliseconds the number of milliseconds from 1970.1.1. + * @return GRM Time, Format such as: {@value #FORMAT_HTTP_DATA}. + */ + public static String formatMillisToGMT(long milliseconds) { + Date date = new Date(milliseconds); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(FORMAT_HTTP_DATA, Locale.US); + simpleDateFormat.setTimeZone(GMT_TIME_ZONE); + return simpleDateFormat.format(date); + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/utils/DateUtil.java b/src/main/java/com/iqudoo/framework/tape/modules/utils/DateUtil.java new file mode 100644 index 0000000..f8581f0 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/utils/DateUtil.java @@ -0,0 +1,192 @@ +package com.iqudoo.framework.tape.modules.utils; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Calendar; +import java.util.Date; +import java.util.Locale; +import java.util.TimeZone; + +@SuppressWarnings({"DuplicatedCode", "EnhancedSwitchMigration", "unused"}) +public class DateUtil { + + public static String getWeekOfDay(Date date) { + Calendar c = Calendar.getInstance(); + c.setTime(date); + switch (c.get(Calendar.DAY_OF_WEEK)) { + case Calendar.MONDAY: + return "1"; + case Calendar.TUESDAY: + return "2"; + case Calendar.WEDNESDAY: + return "3"; + case Calendar.THURSDAY: + return "4"; + case Calendar.FRIDAY: + return "5"; + case Calendar.SATURDAY: + return "6"; + case Calendar.SUNDAY: + return "7"; + } + return ""; + } + + public static long getDateStartTime(String dateStr) { + return getDateStartTime(dateStr, "yyyy-MM-dd"); + } + + public static long getDateStartTime(String dateStr, String formatStr) { + Date date = parseDate(dateStr, formatStr); + if (date != null) { + return getStartOfDay(date); + } + return 0L; + } + + public static long getDateEndTime(String dateStr) { + return getDateEndTime(dateStr, "yyyy-MM-dd"); + } + + public static long getDateEndTime(String dateStr, String formatStr) { + Date date = parseDate(dateStr, formatStr); + if (date != null) { + return getEndOfDay(date); + } + return 0L; + } + + public static long getStartOfDay(Date date) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); + return calendar.getTimeInMillis(); + } + + public static long getEndOfDay(Date date) { + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.set(Calendar.HOUR_OF_DAY, 23); + calendar.set(Calendar.MINUTE, 59); + calendar.set(Calendar.SECOND, 59); + calendar.set(Calendar.MILLISECOND, 999); + return calendar.getTimeInMillis() + 1; + } + + /** + * 获取指定日期所属月份的开始时间戳(当月1日 00:00:00) + * + * @param date 目标日期 + * @return 月份开始时间戳(毫秒),若date为null则返回0 + */ + public static long getStartOfMonth(Date date) { + if (date == null) { + return 0L; + } + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.set(Calendar.DAY_OF_MONTH, 1); + calendar.set(Calendar.HOUR_OF_DAY, 0); + calendar.set(Calendar.MINUTE, 0); + calendar.set(Calendar.SECOND, 0); + calendar.set(Calendar.MILLISECOND, 0); + return calendar.getTimeInMillis(); + } + + /** + * 获取指定日期所属月份的结束时间戳(当月最后一日 23:59:59 999毫秒) + * + * @param date 目标日期 + * @return 月份结束时间戳(毫秒),若date为null则返回0 + */ + public static long getEndOfMonth(Date date) { + if (date == null) { + return 0L; + } + Calendar calendar = Calendar.getInstance(); + calendar.setTime(date); + calendar.set(Calendar.DAY_OF_MONTH, 1); + calendar.add(Calendar.MONTH, 1); + calendar.add(Calendar.MILLISECOND, -1); + return calendar.getTimeInMillis(); + } + + public static Date parseDate(String date) { + return parseDate(date, "yyyy-MM-dd HH:mm:ss"); + } + + public static Date parseDate(String date, String formatStr) { + Date date1 = null; + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(formatStr); + try { + date1 = simpleDateFormat.parse(date); + } catch (Throwable ignored) { + } + return date1; + } + + public static String formatDate(long timeMs) { + return formatDate(timeMs, "yyyy-MM-dd HH:mm:ss"); + } + + public static String formatDate(Date date) { + return formatDate(date, "yyyy-MM-dd HH:mm:ss"); + } + + public static String formatDate(long timeMs, String formatStr) { + return formatDate(new Date(timeMs), formatStr); + } + + public static String formatDate(Date date, String formatStr) { + if (formatStr == null) { + formatStr = "yyyy-MM-dd HH:mm:ss"; + } + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(formatStr); + return simpleDateFormat.format(date); + } + + ///////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////////// + + /** + * Format of http head. + */ + public static final String FORMAT_HTTP_DATA = "EEE, dd MMM y HH:mm:ss 'GMT'"; + + /** + * Commmon TimeZone for GMT. + */ + public static final TimeZone GMT_TIME_ZONE = TimeZone.getTimeZone("GMT"); + + /** + * Parsing the TimeZone of time in milliseconds. + * + * @param gmtTime GRM Time, Format such as: {@value #FORMAT_HTTP_DATA}. + * @return The number of milliseconds from 1970.1.1. + * @throws ParseException if an error occurs during parsing. + */ + public static long parseGMTToMillis(String gmtTime) throws ParseException { + SimpleDateFormat formatter = new SimpleDateFormat(FORMAT_HTTP_DATA, Locale.US); + formatter.setTimeZone(GMT_TIME_ZONE); + Date date = formatter.parse(gmtTime); + return date.getTime(); + } + + /** + * Parsing the TimeZone of time from milliseconds. + * + * @param milliseconds the number of milliseconds from 1970.1.1. + * @return GRM Time, Format such as: {@value #FORMAT_HTTP_DATA}. + */ + public static String formatMillisToGMT(long milliseconds) { + Date date = new Date(milliseconds); + SimpleDateFormat simpleDateFormat = new SimpleDateFormat(FORMAT_HTTP_DATA, Locale.US); + simpleDateFormat.setTimeZone(GMT_TIME_ZONE); + return simpleDateFormat.format(date); + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/utils/DebounceUtil.java b/src/main/java/com/iqudoo/framework/tape/modules/utils/DebounceUtil.java new file mode 100644 index 0000000..5b22a49 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/utils/DebounceUtil.java @@ -0,0 +1,96 @@ +package com.iqudoo.framework.tape.modules.utils; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Map; +import java.util.concurrent.*; + +/** + * 内存级防抖工具(最后一次调用后等待 waitTime 再执行) + * 适用于:重复点击、重复上报、频繁更新、频繁查询等场景 + */ +@SuppressWarnings("unused") +public class DebounceUtil { + + public interface DebounceRunner { + + void onRun() throws Throwable; + + } + + private static final Logger LOGGER = LoggerFactory.getLogger(DebounceUtil.class); + + // 防抖任务缓存 key -> future任务 + private static final Map> DEBOUNCE_MAP = new ConcurrentHashMap<>(); + private static final ScheduledExecutorService SCHEDULER = Executors.newScheduledThreadPool( + Runtime.getRuntime().availableProcessors(), + r -> { + Thread thread = new Thread(r, "debounce-thread"); + thread.setDaemon(true); + return thread; + } + ); + + /** + * 防抖执行(最后一次调用后等待 waitTime 毫秒再执行) + * + * @param key 防抖唯一标识(不同业务用不同key) + * @param waitTime 防抖等待时间(毫秒) + * @param runnable 要执行的任务 + */ + public static void debounce(String key, long waitTime, DebounceRunner runnable) { + if (key == null || key.isBlank() || waitTime <= 0 || runnable == null) { + return; + } + + // 包装任务:执行后自动清除map + Runnable wrapperTask = () -> { + try { + runnable.onRun(); + } catch (Throwable e) { + LOGGER.error("Debounce task execute error, key:{}", key, e); + } finally { + DEBOUNCE_MAP.remove(key); + } + }; + + // 加锁保证原子性 + synchronized (key.intern()) { + // 1. 取消旧任务 + Future oldFuture = DEBOUNCE_MAP.get(key); + if (oldFuture != null && !oldFuture.isDone()) { + oldFuture.cancel(false); + } + // 2. 提交新延迟任务 + ScheduledFuture newFuture = SCHEDULER.schedule( + wrapperTask, + waitTime, + TimeUnit.MILLISECONDS + ); + DEBOUNCE_MAP.put(key, newFuture); + } + } + + /** + * 立即移除某个key的防抖任务 + */ + public static void remove(String key) { + if (key == null) return; + synchronized (key.intern()) { + Future future = DEBOUNCE_MAP.remove(key); + if (future != null) { + future.cancel(false); + } + } + } + + /** + * 清空所有防抖任务 + */ + public static void clearAll() { + DEBOUNCE_MAP.forEach((k, f) -> f.cancel(false)); + DEBOUNCE_MAP.clear(); + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/utils/DecimalUtil.java b/src/main/java/com/iqudoo/framework/tape/modules/utils/DecimalUtil.java new file mode 100644 index 0000000..ecbdb90 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/utils/DecimalUtil.java @@ -0,0 +1,33 @@ +package com.iqudoo.framework.tape.modules.utils; + +import java.math.BigDecimal; +import java.math.RoundingMode; +import java.text.DecimalFormat; + +public class DecimalUtil { + + public static String format(BigDecimal bigDecimal) { + if (bigDecimal == null) { + return "0"; + } + DecimalFormat df = new DecimalFormat("#.##"); + df.setRoundingMode(RoundingMode.HALF_UP); + return df.format(bigDecimal); + } + + public static String formatAmount(BigDecimal bigDecimal) { + if (bigDecimal == null) { + return "0.00"; + } + // 0.00 代表强制保留2位小数 + DecimalFormat df = new DecimalFormat("0.00"); + df.setRoundingMode(RoundingMode.HALF_UP); + return df.format(bigDecimal); + } + + public static BigDecimal customSetScale(BigDecimal number, int newScale, RoundingMode roundingMode) { + BigDecimal factor = BigDecimal.ONE.movePointRight(newScale); + return number.divide(factor, roundingMode).multiply(factor); + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/utils/DigestUtil.java b/src/main/java/com/iqudoo/framework/tape/modules/utils/DigestUtil.java new file mode 100644 index 0000000..7e9699c --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/utils/DigestUtil.java @@ -0,0 +1,168 @@ +package com.iqudoo.framework.tape.modules.utils; + +import java.io.IOException; +import java.io.InputStream; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; + +public class DigestUtil { + + private static final String MD5_ALGORITHM_NAME = "MD5"; + + private static final char[] HEX_CHARS = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; + + + /** + * Return a hexadecimal string representation of the MD5 digest of string. + * + * @param string string to calculate the digest over. + * @return a hexadecimal digest string. + */ + public static String md5DigestAsHex(String string) { + return md5DigestAsHex(string.getBytes()); + } + + /** + * Return a hexadecimal string representation of the MD5 digest of the given bytes. + * + * @param bytes the bytes to calculate the digest over. + * @return a hexadecimal digest string. + */ + public static String md5DigestAsHex(byte[] bytes) { + return digestAsHexString(MD5_ALGORITHM_NAME, bytes); + } + + /** + * Return a hexadecimal string representation of the MD5 digest of the given stream. + * + * @param inputStream the InputStream to calculate the digest over. + * @return a hexadecimal digest string. + */ + public static String md5DigestAsHex(InputStream inputStream) throws IOException { + return digestAsHexString(MD5_ALGORITHM_NAME, inputStream); + } + + /** + * Calculate the MD5 digest of string. + * + * @param string string to calculate the digest over. + * @return the digest. + */ + public static byte[] md5Digest(String string) { + return md5Digest(string.getBytes()); + } + + /** + * Calculate the MD5 digest of the given bytes. + * + * @param bytes the bytes to calculate the digest over. + * @return the digest. + */ + public static byte[] md5Digest(byte[] bytes) { + return digest(MD5_ALGORITHM_NAME, bytes); + } + + /** + * Calculate the MD5 digest of the given stream. + * + * @param inputStream the InputStream to calculate the digest over. + * @return the digest. + */ + public static byte[] md5Digest(InputStream inputStream) throws IOException { + return digest(MD5_ALGORITHM_NAME, inputStream); + } + + /** + * Append a hexadecimal string representation of the MD5 digest of the given + * bytes to the given {@link StringBuilder}. + * + * @param bytes the bytes to calculate the digest over. + * @param builder the string builder to append the digest to. + * @return the given string builder. + */ + public static StringBuilder appendMd5DigestAsHex(byte[] bytes, StringBuilder builder) { + return appendDigestAsHex(MD5_ALGORITHM_NAME, bytes, builder); + } + + /** + * Append a hexadecimal string representation of the MD5 digest of the given + * getInputStream to the given {@link StringBuilder}. + * + * @param inputStream the getInputStream to calculate the digest over. + * @param builder the string builder to append the digest to. + * @return the given string builder. + */ + public static StringBuilder appendMd5DigestAsHex(InputStream inputStream, StringBuilder builder) throws IOException { + return appendDigestAsHex(MD5_ALGORITHM_NAME, inputStream, builder); + } + + + /** + * Create a new {@link MessageDigest} with the given algorithm. + * Necessary because {@code MessageDigest} is not thread-safe. + */ + private static MessageDigest getDigest(String algorithm) { + try { + return MessageDigest.getInstance(algorithm); + } catch (NoSuchAlgorithmException ex) { + throw new IllegalStateException("Could not find MessageDigest with algorithm \"" + algorithm + "\"", ex); + } + } + + private static byte[] digest(String algorithm, byte[] bytes) { + return getDigest(algorithm).digest(bytes); + } + + private static byte[] digest(String algorithm, InputStream inputStream) throws IOException { + MessageDigest messageDigest = getDigest(algorithm); + final byte[] buffer = new byte[2048]; + int bytesRead; + while ((bytesRead = inputStream.read(buffer)) != -1) { + messageDigest.update(buffer, 0, bytesRead); + } + return messageDigest.digest(); + } + + private static String digestAsHexString(String algorithm, byte[] bytes) { + char[] hexDigest = digestAsHexChars(algorithm, bytes); + return new String(hexDigest); + } + + private static String digestAsHexString(String algorithm, InputStream inputStream) throws IOException { + char[] hexDigest = digestAsHexChars(algorithm, inputStream); + return new String(hexDigest); + } + + private static StringBuilder appendDigestAsHex(String algorithm, byte[] bytes, StringBuilder builder) { + char[] hexDigest = digestAsHexChars(algorithm, bytes); + return builder.append(hexDigest); + } + + private static StringBuilder appendDigestAsHex(String algorithm, InputStream inputStream, StringBuilder builder) + throws IOException { + + char[] hexDigest = digestAsHexChars(algorithm, inputStream); + return builder.append(hexDigest); + } + + private static char[] digestAsHexChars(String algorithm, byte[] bytes) { + byte[] digest = digest(algorithm, bytes); + return encodeHex(digest); + } + + private static char[] digestAsHexChars(String algorithm, InputStream inputStream) throws IOException { + byte[] digest = digest(algorithm, inputStream); + return encodeHex(digest); + } + + private static char[] encodeHex(byte[] bytes) { + char chars[] = new char[32]; + for (int i = 0; i < chars.length; i = i + 2) { + byte b = bytes[i / 2]; + chars[i] = HEX_CHARS[(b >>> 0x4) & 0xf]; + chars[i + 1] = HEX_CHARS[b & 0xf]; + } + return chars; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/utils/FileUtil.java b/src/main/java/com/iqudoo/framework/tape/modules/utils/FileUtil.java new file mode 100644 index 0000000..d9e7877 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/utils/FileUtil.java @@ -0,0 +1,124 @@ +package com.iqudoo.framework.tape.modules.utils; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; +import java.net.HttpURLConnection; +import java.net.URL; + +@SuppressWarnings("ResultOfMethodCallIgnored") +public class FileUtil { + + @SuppressWarnings("LombokGetterMayBeUsed") + public static class FileData { + byte[] fileBytes; + String fileName; + + FileData(byte[] fileBytes, String fileName) { + this.fileBytes = fileBytes; + this.fileName = fileName; + } + + public byte[] getFileBytes() { + return fileBytes; + } + + public String getFileName() { + return fileName; + } + + } + + @SuppressWarnings("resource") + public static FileData getFileData(String fileUrl) throws Throwable { + if (fileUrl.startsWith("//")) { + fileUrl = "http:" + fileUrl; + } + InputStream input = createInputStreamByUrl(fileUrl); + ByteArrayOutputStream output = new ByteArrayOutputStream(); + byte[] buf = new byte[1024]; + int numBytesRead; + while ((numBytesRead = input.read(buf)) != -1) { + output.write(buf, 0, numBytesRead); + } + String fileName = extractFileName(fileUrl); + return new FileData(output.toByteArray(), fileName); + } + + private static InputStream createInputStreamByUrl(String url) throws Throwable { + URL uri = new URL(url); + // 建立http连接 + HttpURLConnection conn = (HttpURLConnection) uri.openConnection(); + // 设置允许输出 + conn.setDoOutput(true); + // 设置允许输入 + conn.setDoInput(true); + // 设置不用缓存 + conn.setUseCaches(false); + // 设置传递方式 + conn.setRequestMethod("GET"); + // 设置维持长连接 + conn.setRequestProperty("Connection", "Keep-Alive"); + // 设置文件字符集: + conn.setRequestProperty("Charset", "UTF-8"); + // 开始连接请求 + conn.connect(); + if (conn.getResponseCode() == 200) { + return conn.getInputStream(); + } else { + throw new Throwable("get request failure: " + "\nurl: " + url + + "\nstatusCode: " + conn.getResponseCode()); + } + } + + private static String extractFileName(String imageUrl) { + String[] parts = imageUrl.split("/"); + String fileName = parts[parts.length - 1]; + // 去除文件名中的查询参数 + fileName = fileName.split("\\?")[0]; + return fileName; + } + + public static void saveFile(String filePath, byte[] fileData) throws Throwable { + File file = new File(filePath); + File parentDir = file.getParentFile(); + if (!parentDir.exists()) { + parentDir.mkdirs(); + } + if (file.exists()) { + file.delete(); + } + try (FileOutputStream fos = new FileOutputStream(file)) { + fos.write(fileData, 0, fileData.length); + fos.flush(); + } + } + + /** + * 获取文件的后缀名 + * + * @param fileName 文件名名称 + * @return 文件后缀名 + */ + public static String getFileSuffix(String fileName) { + int indexOf = fileName.lastIndexOf("."); + String suffix = ""; + if (indexOf >= 0) { + suffix = fileName.substring(indexOf); + } + return suffix.toLowerCase(); + } + + public static String getFileName(String videoUrl) { + if (videoUrl != null) { + int index = videoUrl.lastIndexOf("/"); + if (index >= 0) { + return videoUrl.substring(index + 1); + } + return videoUrl; + } + return null; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/utils/HttpUtil.java b/src/main/java/com/iqudoo/framework/tape/modules/utils/HttpUtil.java new file mode 100644 index 0000000..4711712 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/utils/HttpUtil.java @@ -0,0 +1,613 @@ +package com.iqudoo.framework.tape.modules.utils; + +import okhttp3.*; +import org.apache.sshd.client.SshClient; +import org.apache.sshd.client.session.ClientSession; +import org.apache.sshd.common.config.keys.FilePasswordProvider; +import org.apache.sshd.common.util.io.resource.PathResource; +import org.apache.sshd.common.util.net.SshdSocketAddress; +import org.apache.sshd.common.util.security.SecurityUtils; +import org.springframework.util.StringUtils; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.net.Proxy; +import java.net.ServerSocket; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.Map; +import java.util.TreeMap; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.concurrent.locks.ReentrantLock; + +/** + * 基于OkHttp实现的HTTP请求工具类 + * 替代原HttpURLConnection实现,提升请求稳定性和可维护性 + */ +@SuppressWarnings({"UastIncorrectHttpHeaderInspection", "unused", "resource"}) +public class HttpUtil { + + // 私有构造器:禁止实例化 + private HttpUtil() { + } + + public static String getSortedParams(Map params) { + if (params != null) { + Map sortedParams = new TreeMap<>(params); + StringBuilder builder = new StringBuilder(); + for (Map.Entry entry : sortedParams.entrySet()) { + builder.append(entry.getKey()).append("=") + .append(entry.getValue()).append("&"); + } + if (!builder.isEmpty()) { + builder.setLength(builder.length() - 1); + } + return builder.toString(); + } + return null; + } + + private static final ConnectionPool connectionPool = new ConnectionPool(5, + 5, TimeUnit.MINUTES); + + public interface BodyHandler { + + D toBody(String body) throws Throwable; + + } + + private static OkHttpClient getClient(long connectTimeout, long readWriteTimeout) { + return new OkHttpClient.Builder() + .connectTimeout(connectTimeout, TimeUnit.MILLISECONDS) + .readTimeout(readWriteTimeout, TimeUnit.MILLISECONDS) + .writeTimeout(readWriteTimeout, TimeUnit.MILLISECONDS) + .connectionPool(connectionPool) + .retryOnConnectionFailure(true) + .followRedirects(false) + .build(); + } + + /** + * SSH 隧道配置(通过动态 SOCKS5 转发发起网络请求) + * - 适用于 HTTP/HTTPS(HTTPS 不会因改为 localhost 而导致证书/SNI 失败) + * - 认证方式支持:密码 / 公钥 / 密码+公钥 + */ + @SuppressWarnings({"LombokGetterMayBeUsed", "UnusedReturnValue"}) + public static class SshTunnelConfig { + private String host; + private Integer port = 22; + private String username; + private AuthMethod authMethod = AuthMethod.PASSWORD; + private String password; + /** + * 私钥内容(PEM/OpenSSH 文本) + */ + private String publicKey; + + /** + * SSH 连接超时(毫秒) + */ + private Integer connectTimeoutMs = 10_000; + + public enum AuthMethod { + PASSWORD, + PUBLIC_KEY, + PASSWORD_AND_PUBLIC_KEY + } + + public String getHost() { + return host; + } + + public SshTunnelConfig setHost(String host) { + this.host = host; + return this; + } + + public Integer getPort() { + return port; + } + + public SshTunnelConfig setPort(Integer port) { + this.port = port; + return this; + } + + public String getUsername() { + return username; + } + + public SshTunnelConfig setUsername(String username) { + this.username = username; + return this; + } + + public AuthMethod getAuthMethod() { + return authMethod; + } + + public SshTunnelConfig setAuthMethod(AuthMethod authMethod) { + this.authMethod = authMethod; + return this; + } + + public String getPassword() { + return password; + } + + public SshTunnelConfig setPassword(String password) { + this.password = password; + return this; + } + + public String getPublicKey() { + return publicKey; + } + + public SshTunnelConfig setPublicKey(String publicKey) { + this.publicKey = publicKey; + return this; + } + + public Integer getConnectTimeoutMs() { + return connectTimeoutMs; + } + + public SshTunnelConfig setConnectTimeoutMs(Integer connectTimeoutMs) { + this.connectTimeoutMs = connectTimeoutMs; + return this; + } + + void validate() throws HttpException { + if (!StringUtils.hasText(host)) { + throw new HttpException("SSH隧道配置错误:host不能为空"); + } + if (port == null || port <= 0) { + throw new HttpException("SSH隧道配置错误:port不合法"); + } + if (!StringUtils.hasText(username)) { + throw new HttpException("SSH隧道配置错误:username不能为空"); + } + if (authMethod == null) { + throw new HttpException("SSH隧道配置错误:authMethod不能为空"); + } + if (authMethod == AuthMethod.PASSWORD || authMethod == AuthMethod.PASSWORD_AND_PUBLIC_KEY) { + if (!StringUtils.hasText(password)) { + throw new HttpException("SSH隧道配置错误:password不能为空"); + } + } + if (authMethod == AuthMethod.PUBLIC_KEY || authMethod == AuthMethod.PASSWORD_AND_PUBLIC_KEY) { + if (!StringUtils.hasText(publicKey)) { + throw new HttpException("SSH隧道配置错误:publicKey不能为空"); + } + } + } + } + + private static final ConcurrentHashMap TUNNEL_POOL = new ConcurrentHashMap<>(); + private static final ReentrantLock TUNNEL_CREATE_LOCK = new ReentrantLock(); + + private static class TunnelRef { + final AtomicInteger refCount = new AtomicInteger(0); + volatile SshClient client; + volatile ClientSession session; + volatile int socksPort; + volatile boolean started; + } + + private static class TunnelLease implements AutoCloseable { + private final String key; + private final Proxy proxy; + private boolean closed; + + TunnelLease(String key, Proxy proxy) { + this.key = key; + this.proxy = proxy; + } + + Proxy getProxy() { + return proxy; + } + + @Override + public void close() { + if (closed) { + return; + } + closed = true; + TunnelRef ref = TUNNEL_POOL.get(key); + if (ref == null) { + return; + } + int left = ref.refCount.decrementAndGet(); + if (left > 0) { + return; + } + // 关闭会话并移除 + TUNNEL_CREATE_LOCK.lock(); + try { + TunnelRef now = TUNNEL_POOL.get(key); + if (now != null && now.refCount.get() <= 0) { + try { + if (now.session != null) { + now.session.close(); + } + } catch (Throwable ignored) { + } + try { + if (now.client != null) { + now.client.stop(); + } + } catch (Throwable ignored) { + } + TUNNEL_POOL.remove(key); + } + } finally { + TUNNEL_CREATE_LOCK.unlock(); + } + } + } + + private static TunnelLease acquireSocksTunnel(SshTunnelConfig cfg) throws HttpException { + cfg.validate(); + String key = buildTunnelKey(cfg); + TunnelRef ref = TUNNEL_POOL.computeIfAbsent(key, k -> new TunnelRef()); + ref.refCount.incrementAndGet(); + + try { + if (!ref.started || ref.session == null || !ref.session.isOpen()) { + startTunnelIfNeeded(ref, cfg); + } + Proxy proxy = new Proxy(Proxy.Type.SOCKS, new InetSocketAddress("127.0.0.1", ref.socksPort)); + return new TunnelLease(key, proxy); + } catch (Throwable e) { + // 启动失败,回滚引用计数并尽量清理 + try { + int left = ref.refCount.decrementAndGet(); + if (left <= 0) { + TUNNEL_POOL.remove(key); + } + } catch (Throwable ignored) { + } + if (e instanceof HttpException) { + throw (HttpException) e; + } + throw new HttpException("建立SSH隧道失败:" + e.getMessage(), e); + } + } + + private static void startTunnelIfNeeded(TunnelRef ref, SshTunnelConfig cfg) throws HttpException { + TUNNEL_CREATE_LOCK.lock(); + try { + if (ref.started && ref.session != null && ref.session.isOpen()) { + return; + } + // 清理旧会话 + try { + if (ref.session != null) { + ref.session.close(); + } + } catch (Throwable ignored) { + } + try { + if (ref.client != null && ref.client.isOpen()) { + ref.client.stop(); + } + } catch (Throwable ignored) { + } + + SshClient client = SshClient.setUpDefaultClient(); + client.start(); + ClientSession session = null; + try { + session = client.connect(cfg.username, cfg.host, cfg.port) + .verify((cfg.connectTimeoutMs == null ? 10_000 : cfg.connectTimeoutMs)) + .getSession(); + + // public key + if (cfg.authMethod == SshTunnelConfig.AuthMethod.PUBLIC_KEY + || cfg.authMethod == SshTunnelConfig.AuthMethod.PASSWORD_AND_PUBLIC_KEY) { + Path keyFile = writeTempKeyFile(cfg.publicKey); + FilePasswordProvider provider = FilePasswordProvider.EMPTY; + if (StringUtils.hasText(cfg.password)) { + provider = (sessionContext, resourceKey, retryIndex) -> cfg.password; + } + try (var in = Files.newInputStream(keyFile)) { + Iterable keyPairs = SecurityUtils.loadKeyPairIdentities( + session, + new PathResource(keyFile), + in, + provider + ); + for (java.security.KeyPair kp : keyPairs) { + session.addPublicKeyIdentity(kp); + } + } + } + // password + if (cfg.authMethod == SshTunnelConfig.AuthMethod.PASSWORD + || cfg.authMethod == SshTunnelConfig.AuthMethod.PASSWORD_AND_PUBLIC_KEY) { + session.addPasswordIdentity(cfg.password); + } + + session.auth().verify((cfg.connectTimeoutMs == null ? 10_000 : cfg.connectTimeoutMs)); + + // 动态转发(SOCKS5) + SshdSocketAddress local = new SshdSocketAddress("127.0.0.1", 0); + SshdSocketAddress bound = session.startDynamicPortForwarding(local); + + ref.client = client; + ref.session = session; + ref.socksPort = bound.getPort(); + ref.started = true; + } catch (Throwable e) { + try { + if (session != null) { + session.close(); + } + } catch (Throwable ignored) { + } + try { + client.stop(); + } catch (Throwable ignored) { + } + throw new HttpException("建立SSH隧道失败:" + e.getMessage(), e); + } + } finally { + TUNNEL_CREATE_LOCK.unlock(); + } + } + + private static int allocateFreePort() throws HttpException { + try (ServerSocket ss = new ServerSocket(0)) { + ss.setReuseAddress(true); + return ss.getLocalPort(); + } catch (IOException e) { + throw new HttpException("分配本地端口失败:" + e.getMessage(), e); + } + } + + private static Path writeTempKeyFile(String keyText) throws HttpException { + try { + Path tmp = Files.createTempFile("ssh-key-", ".key"); + Files.writeString(tmp, keyText, StandardCharsets.UTF_8); + tmp.toFile().deleteOnExit(); + return tmp; + } catch (IOException e) { + throw new HttpException("写入临时私钥文件失败:" + e.getMessage(), e); + } + } + + private static String buildTunnelKey(SshTunnelConfig cfg) { + // 避免把私钥全文做 key;这里只做基本区分,足够用于复用/隔离 + int keyHash = cfg.publicKey == null ? 0 : cfg.publicKey.hashCode(); + return cfg.host + ":" + cfg.port + ":" + cfg.username + ":" + cfg.authMethod + ":" + keyHash; + } + + /** + * POST请求并转化为指定响应值 + * + * @param url 请求地址 + * @param jsonValue JSON请求体 + * @param headers 自定义请求头 + * @param connectTimeout 连接超时时间 + * @param readWriteTimeout 读写超时时间 + * @param bodyHandler 请求结果处理器 + * @param 响应结果类型 + * @return 响应结果示例 + * @throws HttpException 异常 + */ + public static D postRequest(String url, String jsonValue, Map headers, long connectTimeout, long readWriteTimeout, BodyHandler bodyHandler) throws HttpException { + return postRequest(url, jsonValue, headers, connectTimeout, readWriteTimeout, bodyHandler, null); + } + + /** + * POST请求并转化为指定响应值 + * + * @param url 请求地址 + * @param jsonValue JSON请求体 + * @param headers 自定义请求头 + * @param connectTimeout 连接超时时间 + * @param readWriteTimeout 读写超时时间 + * @param bodyHandler 请求结果处理器 + * @param sshTunnelConfig SSH隧道配置(可为空) + * @param 响应结果类型 + * @return 响应结果示例 + * @throws HttpException 异常 + */ + public static D postRequest(String url, String jsonValue, Map headers, long connectTimeout, long readWriteTimeout, BodyHandler bodyHandler, SshTunnelConfig sshTunnelConfig) throws HttpException { + String bodyString = postString(url, jsonValue, headers, connectTimeout, readWriteTimeout, sshTunnelConfig); + try { + return bodyHandler.toBody(bodyString); + } catch (Throwable e) { + throw new HttpException("解析请求响应结果失败", e); + } + } + + /** + * GET请求并转化为指定响应值 + * + * @param url 请求地址 + * @param headers 自定义请求头 + * @param connectTimeout 连接超时时间 + * @param readWriteTimeout 读写超时时间 + * @param bodyHandler 请求结果处理器 + * @param 响应结果类型 + * @return 响应结果示例 + * @throws HttpException 异常 + */ + public static D getRequest(String url, Map headers, long connectTimeout, long readWriteTimeout, BodyHandler bodyHandler) throws HttpException { + return getRequest(url, headers, connectTimeout, readWriteTimeout, bodyHandler, null); + } + + /** + * GET请求并转化为指定响应值 + * + * @param url 请求地址 + * @param headers 自定义请求头 + * @param connectTimeout 连接超时时间 + * @param readWriteTimeout 读写超时时间 + * @param bodyHandler 请求结果处理器 + * @param sshTunnelConfig SSH隧道配置(可为空) + * @param 响应结果类型 + * @return 响应结果示例 + * @throws HttpException 异常 + */ + public static D getRequest(String url, Map headers, long connectTimeout, long readWriteTimeout, BodyHandler bodyHandler, SshTunnelConfig sshTunnelConfig) throws HttpException { + String bodyString = getString(url, headers, connectTimeout, readWriteTimeout, sshTunnelConfig); + try { + return bodyHandler.toBody(bodyString); + } catch (Throwable e) { + throw new HttpException("解析请求响应结果失败", e); + } + } + + /** + * POST请求(JSON体) + * + * @param url 请求地址 + * @param jsonValue JSON请求体 + * @param headers 自定义请求头 + * @param connectTimeout 连接超时时间 + * @param readWriteTimeout 读写超时时间 + * @return 响应体字符串 + * @throws RuntimeException 请求失败时抛出 + */ + public static String postString(String url, String jsonValue, Map headers, long connectTimeout, long readWriteTimeout) throws HttpException { + return postString(url, jsonValue, headers, connectTimeout, readWriteTimeout, null); + } + + /** + * POST请求(JSON体) + * + * @param url 请求地址 + * @param jsonValue JSON请求体 + * @param headers 自定义请求头 + * @param connectTimeout 连接超时时间 + * @param readWriteTimeout 读写超时时间 + * @param sshTunnelConfig SSH隧道配置(可为空) + * @return 响应体字符串 + * @throws RuntimeException 请求失败时抛出 + */ + public static String postString(String url, String jsonValue, Map headers, long connectTimeout, long readWriteTimeout, SshTunnelConfig sshTunnelConfig) throws HttpException { + if (!StringUtils.hasText(url)) { + throw new HttpException("POST请求失败:请求地址不能为空"); + } + RequestBody requestBody = RequestBody.create( + StringUtils.hasText(jsonValue) ? jsonValue : "", + MediaType.parse("application/json; charset=utf-8") + ); + Request request = buildRequest(url, "POST", requestBody, headers); + return executeRequest(request, connectTimeout, readWriteTimeout, sshTunnelConfig); + } + + /** + * GET请求 + * + * @param url 请求地址 + * @param headers 自定义请求头 + * @param connectTimeout 连接超时时间 + * @param readWriteTimeout 读写超时时间 + * @return 响应体字符串 + * @throws RuntimeException 请求失败时抛出 + */ + public static String getString(String url, Map headers, long connectTimeout, long readWriteTimeout) throws HttpException { + return getString(url, headers, connectTimeout, readWriteTimeout, null); + } + + /** + * GET请求 + * + * @param url 请求地址 + * @param headers 自定义请求头 + * @param connectTimeout 连接超时时间 + * @param readWriteTimeout 读写超时时间 + * @param sshTunnelConfig SSH隧道配置(可为空) + * @return 响应体字符串 + * @throws RuntimeException 请求失败时抛出 + */ + public static String getString(String url, Map headers, long connectTimeout, long readWriteTimeout, SshTunnelConfig sshTunnelConfig) throws HttpException { + if (!StringUtils.hasText(url)) { + throw new RuntimeException("GET请求失败:请求地址不能为空"); + } + Request request = buildRequest(url, "GET", null, headers); + return executeRequest(request, connectTimeout, readWriteTimeout, sshTunnelConfig); + } + + /** + * 构建请求对象(统一处理Method、Header、Cookie、请求体) + */ + private static Request buildRequest(String url, String method, RequestBody requestBody, + Map headers) { + Request.Builder requestBuilder = new Request.Builder().url(url); + switch (method.toUpperCase()) { + case "POST": + requestBuilder.post(requestBody); + break; + case "GET": + requestBuilder.get(); + break; + default: + throw new RuntimeException("不支持的请求方法:" + method); + } + requestBuilder.header("Connection", "Keep-Alive") + .header("Charset", "UTF-8"); + if (headers != null && !headers.isEmpty()) { + headers.forEach(requestBuilder::header); + } + return requestBuilder.build(); + } + + /** + * 执行请求并处理响应/异常(核心执行逻辑) + */ + private static String executeRequest(Request request, long connectTimeout, long readWriteTimeout) throws HttpException { + return executeRequest(request, connectTimeout, readWriteTimeout, null); + } + + private static String executeRequest(Request request, long connectTimeout, long readWriteTimeout, SshTunnelConfig sshTunnelConfig) throws HttpException { + TunnelLease lease = null; + try { + OkHttpClient.Builder builder = getClient(connectTimeout, readWriteTimeout).newBuilder(); + if (sshTunnelConfig != null) { + lease = acquireSocksTunnel(sshTunnelConfig); + builder.proxy(lease.getProxy()); + } + OkHttpClient httpClient = builder.build(); + Response response = httpClient.newCall(request).execute(); + if (!response.isSuccessful()) { + throw new HttpException(String.format("请求失败,状态码:%d,请求地址:%s", + response.code(), request.url())); + } + ResponseBody responseBody = response.body(); + return responseBody == null ? "" : responseBody.string(); + } catch (IOException e) { + throw new HttpException(String.format("请求IO异常,地址:%s,原因:%s", request.url(), e.getMessage()), e); + } catch (Exception e) { + throw new HttpException(String.format("请求未知异常,地址:%s,原因:%s", request.url(), e.getMessage()), e); + } finally { + if (lease != null) { + try { + lease.close(); + } catch (Throwable ignored) { + } + } + } + } + + public static class HttpException extends Throwable { + + public HttpException(String message) { + super(message); + } + + public HttpException(String message, Throwable cause) { + super(message, cause); + } + + } + +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/framework/tape/modules/utils/JsonUtil.java b/src/main/java/com/iqudoo/framework/tape/modules/utils/JsonUtil.java new file mode 100644 index 0000000..b3f4164 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/utils/JsonUtil.java @@ -0,0 +1,152 @@ +package com.iqudoo.framework.tape.modules.utils; + +import com.alibaba.fastjson.JSONObject; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.iqudoo.framework.tape.base.action.bean.ActionState; + +import java.lang.reflect.Type; +import java.util.concurrent.atomic.AtomicReference; + +public class JsonUtil { + + public static class JsonThrowable extends ActionState { + + public JsonThrowable(String message) { + super(488, message); + } + + } + + private static final AtomicReference MAPPER = new AtomicReference<>(null); + + /** + * getMapper + * + * @return ObjectMapper + */ + private static ObjectMapper getMapper() { + if (MAPPER.get() == null) { + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + MAPPER.set(objectMapper); + } + return MAPPER.get(); + } + + /** + * 合并JSON + * + * @return JSONObject + */ + public static JSONObject mergedJson(JSONObject target, JSONObject... jsonValues) { + // 合并json1和json2 + if (jsonValues != null && jsonValues.length > 0) { + JSONObject mergedJson = new JSONObject(); + for (String key : target.keySet()) { + mergedJson.put(key, target.get(key)); + } + for (JSONObject srcJson : jsonValues) { + if (srcJson != null) { + for (String key : srcJson.keySet()) { + mergedJson.put(key, srcJson.get(key)); + } + } + } + return mergedJson; + } + return target; + } + + + /** + * 将字符串转化为JSONObject + * + * @param data 字符串 + * @return JSONObject + */ + public static JSONObject toJSONObject(String data) { + JSONObject jsonObject = null; + try { + jsonObject = JSONObject.parseObject(data); + } catch (Throwable ignored) { + } + if (jsonObject == null) { + jsonObject = new JSONObject(); + } + return jsonObject; + } + + /** + * 将对象转化为json字符串 + * + * @param data 对象 + * @return json字符串 + */ + public static String toJSONString(Object data) throws Throwable { + return getMapper().writeValueAsString(data); + } + + /** + * 将json转化为单个对象 + * + * @param jsonData json字符串 + * @param javaType 类的类型 + * @return 对象 + */ + public static T toBeanObject(String jsonData, JavaType javaType) throws Throwable { + try { + return getMapper().readValue(jsonData, javaType); + } catch (Throwable throwable) { + throw new JsonThrowable(jsonData + " can not cast to " + javaType.getTypeName()); + } + } + + /** + * 将json转化为单个对象 + * + * @param jsonData json字符串 + * @param beanType 类的类型 + * @return 对象 + */ + public static T toBeanObject(String jsonData, Type beanType) throws Throwable { + JavaType javaType = constructJavaType(beanType); + try { + return getMapper().readValue(jsonData, javaType); + } catch (Throwable throwable) { + throw new JsonThrowable(jsonData + " can not cast to " + javaType.getTypeName()); + } + } + + + /** + * JSON字符串转化为泛型对象 + * + * @param jsonData json字符串 + * @param rawType 类型的类 + * @param parametricTypes 泛型的类 + * @param 键的泛型 + * @return 泛型对象 + */ + public static T toBeanObjectParametric(String jsonData, Class rawType, Class... parametricTypes) throws Throwable { + try { + JavaType javaType = getMapper().getTypeFactory() + .constructParametricType(rawType, parametricTypes); + return getMapper().readValue(jsonData, javaType); + } catch (Throwable throwable) { + throw new JsonThrowable(jsonData + " can not cast to " + rawType.getTypeName()); + } + } + + /** + * 类型转化为JavaType + * + * @param type 类型 + * @return JavaType + */ + public static JavaType constructJavaType(Type type) { + return getMapper().getTypeFactory().constructType(type); + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/utils/LogUtil.java b/src/main/java/com/iqudoo/framework/tape/modules/utils/LogUtil.java new file mode 100644 index 0000000..903a7b3 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/utils/LogUtil.java @@ -0,0 +1,156 @@ +package com.iqudoo.framework.tape.modules.utils; + +import java.io.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.util.*; + +@SuppressWarnings("unused") +public class LogUtil { + + private static final String LOG_DIR = "." + File.separator + "runtime" + File.separator + "logs"; + private static final Map tempLogMap = new HashMap<>(); + + // 配置文件数量阈值(超过此数量触发清理) + private static final int MAX_LOG_FILES = 200; + + // 清理时保留的文件数量(删除最旧的,保留最新的80%) + private static final int KEEP_FILES_COUNT = 160; + + public static String readLog(String id) { + // 构建日志文件路径 + File logFile = new File(LOG_DIR, id + ".log"); + // 检查文件是否存在 + if (!logFile.exists()) { + return ""; + } + // 读取文件内容 + StringBuilder content = new StringBuilder(); + try (BufferedReader reader = new BufferedReader( + new InputStreamReader( + new FileInputStream(logFile), + StandardCharsets.UTF_8))) { + String line; + while ((line = reader.readLine()) != null) { + if (!content.isEmpty()) { + content.append("\n"); + } + content.append(line); + } + } catch (IOException e) { + return ""; + } + return content.toString(); + } + + /** + * 防抖打印日志(30ms 合并输出,减少IO) + * + * @param id 日志唯一标识(生成文件名:id.log) + * @param logContent 日志内容 + */ + public static void printLog(String id, String logContent) { + // 加锁保证线程安全 + synchronized (tempLogMap) { + String log = tempLogMap.getOrDefault(id, ""); + // 拼接新日志(换行分隔) + log = log + (log.isEmpty() ? "" : "\n") + logContent; + tempLogMap.put(id, log); + } + // 30ms 防抖执行写入 + DebounceUtil.debounce("log-util-" + id, 30, new DebounceUtil.DebounceRunner() { + @SuppressWarnings("ResultOfMethodCallIgnored") + @Override + public void onRun() throws Throwable { + String appendLog; + // 原子性取出并清空缓存 + synchronized (tempLogMap) { + appendLog = tempLogMap.remove(id); + } + // 无内容直接返回 + if (appendLog == null || appendLog.isEmpty()) { + return; + } + // 1. 创建日志目录(不存在则创建) + File dir = new File(LOG_DIR); + if (!dir.exists()) { + dir.mkdirs(); + } + + // 2. 清理旧日志文件(如果文件数量超过阈值) + cleanOldLogFilesIfNeeded(dir); + + // 3. 日志文件 + File logFile = new File(dir, id + ".log"); + // 4. 追加写入文件(UTF-8,自动创建文件) + try (FileOutputStream fos = new FileOutputStream(logFile, true); + OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8); + PrintWriter pw = new PrintWriter(osw)) { + pw.println(appendLog); + pw.flush(); + } + } + }); + } + + /** + * 清理旧的日志文件(当文件数量超过阈值时) + * + * @param logDir 日志目录 + */ + private static void cleanOldLogFilesIfNeeded(File logDir) { + File[] logFiles = logDir.listFiles((dir, name) -> name.endsWith(".log")); + if (logFiles == null || logFiles.length <= MAX_LOG_FILES) { + return; + } + + // 异步清理,避免阻塞日志写入 + new Thread(() -> { + synchronized (LogUtil.class) { + try { + // 二次检查(防止并发清理) + File[] currentFiles = logDir.listFiles((dir, name) -> name.endsWith(".log")); + if (currentFiles == null || currentFiles.length <= MAX_LOG_FILES) { + return; + } + + // 按最后修改时间排序(最早的在前) + List sortedFiles = Arrays.stream(currentFiles) + .sorted(Comparator.comparingLong(File::lastModified)) + .toList(); + + // 计算需要删除的文件数量 + int filesToDelete = sortedFiles.size() - KEEP_FILES_COUNT; + if (filesToDelete <= 0) { + return; + } + + // 删除最旧的 N 个文件 + for (int i = 0; i < filesToDelete; i++) { + File fileToDelete = sortedFiles.get(i); + try { + Files.deleteIfExists(fileToDelete.toPath()); + } catch (IOException e) { + // 删除失败时记录错误但不影响主流程 + System.err.println("Failed to delete old log file: " + fileToDelete.getName()); + } + } + } catch (Exception e) { + // 清理失败不影响日志写入 + System.err.println("Error during log cleanup: " + e.getMessage()); + } + } + }, "LogCleanup-Thread").start(); + } + + /** + * 手动触发日志清理(可在应用启动时调用) + */ + public static void manualCleanup() { + File dir = new File(LOG_DIR); + if (dir.exists()) { + cleanOldLogFilesIfNeeded(dir); + } + } + +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/framework/tape/modules/utils/ObjectUtil.java b/src/main/java/com/iqudoo/framework/tape/modules/utils/ObjectUtil.java new file mode 100644 index 0000000..3473bd7 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/utils/ObjectUtil.java @@ -0,0 +1,12 @@ +package com.iqudoo.framework.tape.modules.utils; + +public class ObjectUtil { + + public static D objectCopy(T sourceObject, Class targetClass) throws Throwable { + // 1. 将对象转换为JSON字符串 + String json = JsonUtil.toJSONString(sourceObject); + // 2. 将JSON字符串转换为对象 + return JsonUtil.toBeanObject(json, targetClass); + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/utils/PatternUtil.java b/src/main/java/com/iqudoo/framework/tape/modules/utils/PatternUtil.java new file mode 100644 index 0000000..3526e61 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/utils/PatternUtil.java @@ -0,0 +1,78 @@ +package com.iqudoo.framework.tape.modules.utils; + +import java.util.regex.Pattern; + +public class PatternUtil { + + public static class PatternInfo { + Pattern regex; + String errorMsg; + boolean isPositive; + + public PatternInfo(String regex, String errorMsg) { + this.regex = Pattern.compile(regex); + this.errorMsg = errorMsg; + this.isPositive = true; + } + + public PatternInfo(String regex, String errorMsg, boolean isPositive) { + this.regex = Pattern.compile(regex); + this.errorMsg = errorMsg; + this.isPositive = isPositive; + } + + public PatternInfo(Pattern regex, String errorMsg) { + this.regex = regex; + this.errorMsg = errorMsg; + this.isPositive = true; + } + + public PatternInfo(Pattern regex, String errorMsg, boolean isPositive) { + this.regex = regex; + this.errorMsg = errorMsg; + this.isPositive = isPositive; + } + + public Pattern getRegex() { + return regex; + } + + public void setRegex(Pattern regex) { + this.regex = regex; + } + + public String getErrorMsg() { + return errorMsg; + } + + public void setErrorMsg(String errorMsg) { + this.errorMsg = errorMsg; + } + + public boolean isPositive() { + return isPositive; + } + + public void setPositive(boolean positive) { + isPositive = positive; + } + + } + + public static void validateString(String value, PatternInfo... patternInfos) { + for (PatternInfo patternInfo : patternInfos) { + if (patternInfo.getRegex() == null) { + continue; + } + if (value == null) { + throw new IllegalArgumentException(patternInfo.getErrorMsg()); + } + boolean isMatch = patternInfo.getRegex().matcher(value).matches(); + if ((!isMatch && patternInfo.isPositive()) + || (isMatch && !patternInfo.isPositive())) { + throw new IllegalArgumentException(patternInfo.getErrorMsg()); + } + } + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/utils/PerfUtils.java b/src/main/java/com/iqudoo/framework/tape/modules/utils/PerfUtils.java new file mode 100644 index 0000000..6b0aa78 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/utils/PerfUtils.java @@ -0,0 +1,170 @@ +package com.iqudoo.framework.tape.modules.utils; + +import oshi.SystemInfo; +import oshi.hardware.CentralProcessor; +import oshi.hardware.HardwareAbstractionLayer; +import oshi.hardware.NetworkIF; +import oshi.software.os.NetworkParams; +import oshi.software.os.OperatingSystem; +import oshi.util.Util; + +import java.lang.management.ManagementFactory; +import java.lang.management.MemoryMXBean; +import java.lang.management.MemoryUsage; +import java.text.DecimalFormat; +import java.util.List; + +/** + * 服务器性能信息获取工具类(修正版本) + */ +public class PerfUtils { + + // 格式化数字,保留两位小数 + private static final DecimalFormat DF = new DecimalFormat("#.00"); + // 系统信息入口 + private static final SystemInfo SI = new SystemInfo(); + // 硬件抽象层 + private static final HardwareAbstractionLayer HAL = SI.getHardware(); + // 操作系统信息 + private static final OperatingSystem OS = SI.getOperatingSystem(); + + /** + * 获取JVM内存使用信息 + * + * @return 内存信息字符串 + */ + public static String getJvmMemoryInfo() { + try { + MemoryMXBean memoryBean = ManagementFactory.getMemoryMXBean(); + MemoryUsage heapUsage = memoryBean.getHeapMemoryUsage(); // 堆内存 + MemoryUsage nonHeapUsage = memoryBean.getNonHeapMemoryUsage(); // 非堆内存 + return "=== JVM 内存信息 ===\n" + + "堆内存总量: " + formatBytes(heapUsage.getInit()) + "\n" + + "堆内存已使用: " + formatBytes(heapUsage.getUsed()) + "\n" + + "堆内存最大值: " + formatBytes(heapUsage.getMax()) + "\n" + + "堆内存使用率: " + DF.format((double) heapUsage.getUsed() / heapUsage.getMax() * 100) + "%\n" + + "非堆内存已使用: " + formatBytes(nonHeapUsage.getUsed()) + "\n" + + "\n"; + } catch (Throwable throwable) { + return ""; + } + } + + /** + * 获取系统内存信息(物理内存) + * + * @return 内存信息字符串 + */ + public static String getSystemMemoryInfo() { + try { + oshi.hardware.GlobalMemory memory = HAL.getMemory(); + long total = memory.getTotal(); + long available = memory.getAvailable(); + long used = total - available; + return "=== 物理内存信息 ===\n" + + "物理内存总量: " + formatBytes(total) + "\n" + + "物理内存已使用: " + formatBytes(used) + "\n" + + "物理可用内存: " + formatBytes(available) + "\n" + + "物理内存使用率: " + DF.format((double) used / total * 100) + "%\n" + + "\n"; + } catch (Throwable throwable) { + return ""; + } + } + + /** + * 获取CPU使用信息(修正方法参数问题) + * + * @return CPU信息字符串 + */ + public static String getCpuInfo() { + try { + CentralProcessor processor = HAL.getProcessor(); + // 获取CPU核心数、型号等基础信息 + StringBuilder sb = new StringBuilder(); + sb.append("=== CPU 信息 ===\n"); + sb.append("CPU型号: ").append(processor.getProcessorIdentifier().getName()).append("\n"); + sb.append("物理核心数: ").append(processor.getPhysicalProcessorCount()).append("\n"); + sb.append("逻辑核心数: ").append(processor.getLogicalProcessorCount()).append("\n"); + // 1. 获取总体CPU使用率(单参数版本,无格式问题) + long[] prevTicks = processor.getSystemCpuLoadTicks(); + Util.sleep(1000); // 休眠1秒确保数据有效 + double cpuTotalLoad = processor.getSystemCpuLoadBetweenTicks(prevTicks) * 100; + sb.append("CPU使用率: ").append(DF.format(cpuTotalLoad)).append("%\n"); + // 2. 获取各核心使用率(改用getProcessorCpuLoad()方法,避免二维数组校验问题) + double[] coreLoads = processor.getProcessorCpuLoad(1000); // 直接获取1秒内各核心使用率 + for (int i = 0; i < coreLoads.length; i++) { + sb.append("CPU核心").append(i + 1).append(": ") + .append(DF.format(coreLoads[i] * 100)) + .append("%\n"); + } + sb.append("\n"); + return sb.toString(); + } catch (Throwable throwable) { + return ""; + } + } + + /** + * 获取网络信息(IP、网卡、收发字节数等) + * + * @return 网络信息字符串 + */ + public static String getNetworkInfo() { + try { + // 网络参数(IP、网关、DNS等) + NetworkParams networkParams = OS.getNetworkParams(); + // 获取所有网卡信息,避免下标越界 + List networkIFs = HAL.getNetworkIFs(); + StringBuilder sb = new StringBuilder(); + sb.append("=== 网络信息 ===\n"); + sb.append("主机名: ").append(networkParams.getHostName()).append("\n"); + sb.append("DNS服务器: ").append(String.join(",", networkParams.getDnsServers())).append("\n"); + // 遍历网卡,展示每个网卡的收发数据 + for (int i = 0; i < networkIFs.size(); i++) { + NetworkIF netIf = networkIFs.get(i); + sb.append("网卡").append(i).append("(").append(netIf.getName()).append("): ") + .append("接收: ").append(formatBytes(netIf.getBytesRecv())) + .append(" | 发送: ").append(formatBytes(netIf.getBytesSent())).append("\n"); + } + sb.append("\n"); + return sb.toString(); + } catch (Throwable throwable) { + return ""; + } + } + + /** + * 统一入口:获取所有服务器性能信息 + * + * @return 所有性能信息汇总 + */ + public static String getAllServerPerformanceInfo() { + return getJvmMemoryInfo() + "\n" + + getSystemMemoryInfo() + "\n" + + getCpuInfo() + "\n" + + getNetworkInfo(); + } + + /** + * 字节数格式化,转换为KB/MB/GB/TB + * + * @param bytes 原始字节数 + * @return 格式化后的字符串 + */ + private static String formatBytes(long bytes) { + if (bytes < 0) return "0 B"; // 处理负数情况 + if (bytes < 1024) { + return bytes + " B"; + } else if (bytes < 1024 * 1024) { + return DF.format((double) bytes / 1024) + " KB"; + } else if (bytes < 1024 * 1024 * 1024) { + return DF.format((double) bytes / (1024 * 1024)) + " MB"; + } else if (bytes < 1024 * 1024 * 1024 * 1024L) { + return DF.format((double) bytes / (1024 * 1024 * 1024)) + " GB"; + } else { + return DF.format((double) bytes / (1024 * 1024 * 1024 * 1024L)) + " TB"; + } + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/utils/RandomUtil.java b/src/main/java/com/iqudoo/framework/tape/modules/utils/RandomUtil.java new file mode 100644 index 0000000..ca5f82d --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/utils/RandomUtil.java @@ -0,0 +1,34 @@ +package com.iqudoo.framework.tape.modules.utils; + +import java.util.List; +import java.util.Random; + +public class RandomUtil { + + public static int getRandomInt(int maxSize) { + Random random = new Random(); + return random.nextInt(maxSize); + } + + public static String getRandomString(int length) { + return getRandomString(length, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); + } + + public static String getRandomString(int length, String str) { + Random random = new Random(); + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < length; i++) { + int number = random.nextInt(str.length()); + sb.append(str.charAt(number)); + } + return sb.toString(); + } + + public static T getRandom(List list) { + if (list == null || list.isEmpty()) { + return null; + } + return list.get(getRandomInt(list.size())); + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/utils/ReflectUtil.java b/src/main/java/com/iqudoo/framework/tape/modules/utils/ReflectUtil.java new file mode 100644 index 0000000..19df318 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/utils/ReflectUtil.java @@ -0,0 +1,115 @@ +package com.iqudoo.framework.tape.modules.utils; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.math.BigDecimal; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; + +public class ReflectUtil { + + private static final HashMap HAS_CLASS_CACHE = new HashMap<>(); + + public static boolean hasClass(String className) { + try { + Boolean foundClass = HAS_CLASS_CACHE.get(className); + if (foundClass != null && foundClass) { + return true; + } + Class.forName(className); + HAS_CLASS_CACHE.put(className, true); + return true; + } catch (Throwable ignored) { + } + return false; + } + + public static Type getType(Class clazz, int position) { + Type type = null; + Class superType = clazz; + while (superType != Object.class && !(superType.getGenericSuperclass() instanceof ParameterizedType)) { + superType = superType.getSuperclass(); + } + Type superGenericSuperclass = superType.getGenericSuperclass(); + if (superGenericSuperclass instanceof ParameterizedType) { + Type[] types = ((ParameterizedType) superGenericSuperclass).getActualTypeArguments(); + type = types[position]; + } + return type; + } + + public static synchronized String getStringValue(String fieldName, Object obj) throws ReflectiveOperationException { + Object objectValue = getValueByGetter(fieldName, obj); + if (objectValue == null) { + return ""; + } + String result = objectValue.toString(); + //如果类型为BigDecimal,去掉末尾的0 + if (objectValue instanceof BigDecimal) { + BigDecimal value = (BigDecimal) objectValue; + value = value.stripTrailingZeros(); + result = value.toPlainString(); + } else if (objectValue instanceof Date) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); + result = sdf.format((Date) objectValue).replace(" 00:00:00", ""); + } + return result.trim(); + } + + public static Object getValueByGetter(String fieldName, Object obj) throws ReflectiveOperationException { + Method getter = getGetter(fieldName, obj.getClass()); + if (getter != null) { + return getter.invoke(obj); + } + return null; + } + + + public static Object setValueBySetter(String fieldName, Object obj) throws ReflectiveOperationException { + Method setter = getSetter(fieldName, obj.getClass()); + if (setter == null) { + throw new ReflectiveOperationException("没有set方法"); + } + return setter.invoke(obj); + } + + public static Method getGetter(String fieldName, Class cls) { + for (Method method : cls.getMethods()) { + if (method.getName().equalsIgnoreCase("get".concat(fieldName)) && method.getParameterTypes().length == 0) { + return method; + } + } + return null; + } + + public static Method getSetter(String fieldName, Class cls) { + for (Method method : cls.getMethods()) { + if (method.getName().equalsIgnoreCase("set".concat(fieldName)) && method.getParameterTypes().length == 0) { + return method; + } + } + return null; + } + + public static synchronized Field getFieldByName(String fieldName, Class cls) { + Field[] fields = cls.getDeclaredFields(); + for (Field field : fields) { + if (field.getName().equals(fieldName)) { + return field; + } + } + if (cls.getSuperclass() != null) { + return getFieldByName(fieldName, cls.getSuperclass()); + } + return null; + } + + + public static boolean fieldExist(String fieldName, Class cls) { + return getFieldByName(fieldName, cls) != null; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/utils/ServletUtil.java b/src/main/java/com/iqudoo/framework/tape/modules/utils/ServletUtil.java new file mode 100644 index 0000000..e1bbe36 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/utils/ServletUtil.java @@ -0,0 +1,124 @@ +package com.iqudoo.framework.tape.modules.utils; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.OutputStream; +import java.net.InetAddress; +import java.util.zip.GZIPOutputStream; + +/** + * 获取ID地址工具类 + */ +public class ServletUtil { + + private static final String IP_UTILS_FLAG = ","; + private static final String UNKNOWN = "unknown"; + private static final String LOCALHOST_IP = "0:0:0:0:0:0:0:1"; + private static final String LOCALHOST_IP1 = "127.0.0.1"; + + private static final String ACCEPT_ENCODING = "Accept-Encoding"; + private static final String CONTENT_ENCODING = "Content-Encoding"; + private static final String GZIP = "gzip"; + + /** + * 获取Servlet输出流,支持GZip压缩 + * + * @param servletRequest HttpServletRequest对象 + * @param servletResponse HttpServletResponse对象 + * @param enable 是否启用GZip压缩 + * @return Servlet输出流 + * @throws Throwable 可能抛出的异常 + */ + public static OutputStream getServletOutputStreamWithGZip(HttpServletRequest servletRequest, HttpServletResponse servletResponse, boolean enable) throws Throwable { + OutputStream servletOutputStream = servletResponse.getOutputStream(); + if (enable && validateIfGzip(servletRequest)) { + servletResponse.setHeader(CONTENT_ENCODING, GZIP); + return new GZIPOutputStream(servletOutputStream); + } + return servletOutputStream; + } + + /** + * 获取域名 + * + * @param request HttpServletRequest对象 + * @return 域名,如:saas.company.com + */ + public static String getDomain(HttpServletRequest request) { + // 获取主机名(域名/IP),如:saas.company.com 或 192.168.1.1 + String serverName = request.getServerName(); + // 获取端口号,如:8080(默认端口 80/443 时可能返回 -1 或对应默认值,视容器而定) + int serverPort = request.getServerPort(); + // 处理默认端口(HTTP默认80,HTTPS默认443),避免冗余显示 + if ((request.getScheme().equals("http") && serverPort == 80) + || (request.getScheme().equals("https") && serverPort == 443)) { + return serverName; + // 不显示默认端口,如:saas.company.com + } else { + return serverName + ":" + serverPort; + // 非默认端口需显式拼接,如:saas.company.com:8080 + } + } + + /** + * 获取IP地址 + * + * @param request HttpServletRequest对象 + * @return IP地址,如:192.168.1.1 + */ + public static String getIpAddress(HttpServletRequest request) { + String ip = null; + try { + ip = request.getHeader("X-Original-Forwarded-For"); + if (isEmpty(ip) || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getHeader("X-Forwarded-For"); + } + if (isEmpty(ip) || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getHeader("x-forwarded-for"); + } + if (isEmpty(ip) || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getHeader("Proxy-Client-IP"); + } + if (isEmpty(ip) || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getHeader("WL-Proxy-Client-IP"); + } + if (isEmpty(ip) || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getHeader("HTTP_CLIENT_IP"); + } + if (isEmpty(ip) || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getHeader("HTTP_X_FORWARDED_FOR"); + } + if (isEmpty(ip) || UNKNOWN.equalsIgnoreCase(ip)) { + ip = request.getRemoteAddr(); + if (LOCALHOST_IP1.equalsIgnoreCase(ip) || LOCALHOST_IP.equalsIgnoreCase(ip)) { + InetAddress iNet = null; + try { + iNet = InetAddress.getLocalHost(); + } catch (Throwable ignored) { + } + if (iNet != null) { + ip = iNet.getHostAddress(); + } + } + } + } catch (Throwable ignored) { + } + if (!isEmpty(ip) && ip.indexOf(IP_UTILS_FLAG) > 0) { + ip = ip.substring(0, ip.indexOf(IP_UTILS_FLAG)); + } + return ip; + } + + private static boolean isEmpty(String str) { + return !(str != null && str.length() > 0); + } + + private static boolean validateIfGzip(HttpServletRequest request) { + String acceptEncoding = request.getHeader(ACCEPT_ENCODING); + if (acceptEncoding == null) { + return false; + } + return acceptEncoding.contains(GZIP); + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/modules/utils/SnowflakeUtil.java b/src/main/java/com/iqudoo/framework/tape/modules/utils/SnowflakeUtil.java new file mode 100644 index 0000000..1191108 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/utils/SnowflakeUtil.java @@ -0,0 +1,242 @@ +package com.iqudoo.framework.tape.modules.utils; + +import java.lang.management.ManagementFactory; +import java.net.InetAddress; +import java.net.NetworkInterface; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.concurrent.atomic.AtomicLong; + +@SuppressWarnings({"FieldCanBeLocal", "unused"}) +public class SnowflakeUtil { + + private final long maxDatacenterId = 31L; + private final long maxWorkerId = 31L; + private final long maxSequence = 4095L; + private final long timestampShift = 22L; + private final long datacenterIdShift = 17L; + private final long workerIdShift = 12L; + private final long epoch = 1451606400000L; + private final long datacenterId; + private final long workerId; + private long sequence = 0L; + private long lastTimestamp = -1L; + private final AtomicLong waitCount = new AtomicLong(0L); + private static final SnowflakeUtil snowflakeGenerator = new SnowflakeUtil(); + + /** + * 生成下一个唯一ID(线程安全) + * + * @return 唯一ID + */ + private synchronized long getNextId() { + long currTimestamp = this.timestampGen(); + + // 时钟回拨处理 + if (currTimestamp < this.lastTimestamp) { + long offset = this.lastTimestamp - currTimestamp; + // 允许小范围(5ms)的时钟回拨,通过等待解决 + if (offset <= 5) { + currTimestamp = this.waitNextMillis(currTimestamp); + } else { + throw new IllegalStateException(String.format( + "Clock moved backwards. Refusing to generate id for %d milliseconds", + offset)); + } + } + + if (currTimestamp == this.lastTimestamp) { + this.sequence = (this.sequence + 1) & this.maxSequence; + if (this.sequence == 0L) { + // 当前毫秒内序列号用完,等待下一毫秒 + currTimestamp = this.waitNextMillis(currTimestamp); + // 注意:waitNextMillis 已经重置了 sequence 为 0 + } + } else { + this.sequence = 0L; + } + + this.lastTimestamp = currTimestamp; + + // 生成ID + return ((currTimestamp - this.epoch) << this.timestampShift) + | (this.datacenterId << this.datacenterIdShift) + | (this.workerId << this.workerIdShift) + | this.sequence; + } + + private SnowflakeUtil() { + this.datacenterId = getDatacenterId(this.maxDatacenterId); + this.workerId = getMaxWorkerId(this.datacenterId, this.maxWorkerId); + } + + private long getWaitCount() { + return this.waitCount.get(); + } + + /** + * 等待下一毫秒(修复版本) + * + * @param currTimestamp 当前时间戳 + * @return 下一毫秒的时间戳 + */ + private long waitNextMillis(long currTimestamp) { + this.waitCount.incrementAndGet(); + while (currTimestamp <= this.lastTimestamp) { + currTimestamp = this.timestampGen(); + } + // 关键修复:等待到新毫秒后重置序列号 + this.sequence = 0L; + return currTimestamp; + } + + private long timestampGen() { + return System.currentTimeMillis(); // 使用 System.currentTimeMillis() 性能更好 + } + + public String toString() { + return "Snowflake Settings [timestampBits=41, datacenterIdBits=5, workerIdBits=5, sequenceBits=12, epoch=1451606400000, datacenterId=" + this.datacenterId + ", workerId=" + this.workerId + "] "; + } + + private long getEpoch() { + return 1451606400000L; + } + + private long[] parseId(long id) { + long[] arr = new long[5]; + arr[4] = (id & this.diode(1L, 41L)) >> 22; + arr[0] = arr[4] + 1451606400000L; + arr[1] = (id & this.diode(42L, 5L)) >> 17; + arr[2] = (id & this.diode(47L, 5L)) >> 12; + arr[3] = id & this.diode(52L, 12L); + return arr; + } + + private String formatId(long id) { + long[] arr = this.parseId(id); + String tmf = (new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS")).format(new Date(arr[0])); + return String.format("%s, #%d, @(%d,%d)", tmf, arr[3], arr[1], arr[2]); + } + + private long diode(long offset, long length) { + int lb = (int) (64L - offset); + int rb = (int) (64L - (offset + length)); + return -1L << lb ^ -1L << rb; + } + + /** + * 获取数据中心ID(基于MAC地址) + * + * @param maxDatacenterId 最大数据中心ID + * @return 数据中心ID + */ + private static long getDatacenterId(long maxDatacenterId) { + long id = 0L; + + try { + InetAddress ip = InetAddress.getLocalHost(); + NetworkInterface network = NetworkInterface.getByInetAddress(ip); + if (network == null) { + // Fallback: 使用主机名的哈希值 + id = Math.abs(InetAddress.getLocalHost().getHostName().hashCode()) % (maxDatacenterId + 1); + } else { + byte[] mac = network.getHardwareAddress(); + if (null != mac && mac.length >= 2) { + id = ((0xFFL & (long) mac[mac.length - 1]) + | (0xFF00L & (long) mac[mac.length - 2] << 8)) >> 6; + id = id % (maxDatacenterId + 1); + } else { + // Fallback: 使用IP地址的哈希值 + id = Math.abs(ip.getHostAddress().hashCode()) % (maxDatacenterId + 1); + } + } + } catch (Throwable var7) { + // 最终fallback: 使用线程ID和系统纳秒时间 + id = (Math.abs(Thread.currentThread().getId() + System.nanoTime()) + % (maxDatacenterId + 1)); + } + + return id; + } + + /** + * 获取工作节点ID(基于进程ID) + * + * @param datacenterId 数据中心ID + * @param maxWorkerId 最大工作节点ID + * @return 工作节点ID + */ + private static long getMaxWorkerId(long datacenterId, long maxWorkerId) { + StringBuilder mid = new StringBuilder(); + mid.append(datacenterId); + String name = ManagementFactory.getRuntimeMXBean().getName(); + if (name != null && !name.isEmpty()) { + String[] parts = name.split("@"); + if (parts.length > 0) { + mid.append(parts[0]); + } + } + // 增加随机因子,减少碰撞概率 + mid.append(System.nanoTime()); + long workerId = (long) (Math.abs(mid.toString().hashCode()) & 0xFFFF) % (maxWorkerId + 1); + // 最后的碰撞检测和修正 + if (workerId > maxWorkerId) { + workerId = (Math.abs(Thread.currentThread().hashCode()) % (maxWorkerId + 1)); + } + return workerId; + } + + /** + * 对外公开的生成ID方法 + * + * @return 唯一ID + */ + public static long nextId() { + return snowflakeGenerator.getNextId(); + } + + /** + * 批量生成ID(用于测试) + * + * @param count 生成数量 + * @return ID数组 + */ + public static long[] nextIds(int count) { + if (count <= 0) { + return new long[0]; + } + long[] ids = new long[count]; + for (int i = 0; i < count; i++) { + ids[i] = nextId(); + } + return ids; + } + + /** + * 解析ID,获取生成时间、数据中心ID、工作节点ID、序列号 + * + * @param id Snowflake ID + * @return 包含时间戳、数据中心ID、工作节点ID、序列号的数组 + */ + public static long[] parse(long id) { + return snowflakeGenerator.parseId(id); + } + + /** + * 格式化ID为可读字符串 + * + * @param id Snowflake ID + * @return 格式化后的字符串 + */ + public static String format(long id) { + return snowflakeGenerator.formatId(id); + } + + /** + * 获取当前实例的配置信息 + */ + public static String getConfig() { + return snowflakeGenerator.toString(); + } + +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/framework/tape/modules/utils/ThrowableUtil.java b/src/main/java/com/iqudoo/framework/tape/modules/utils/ThrowableUtil.java new file mode 100644 index 0000000..4326222 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/modules/utils/ThrowableUtil.java @@ -0,0 +1,26 @@ +package com.iqudoo.framework.tape.modules.utils; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; + +public class ThrowableUtil { + + public static String getStackTraceToString(Throwable throwable) { + ByteArrayOutputStream out = new ByteArrayOutputStream(); + PrintStream pout = new PrintStream(out); + throwable.printStackTrace(pout); + pout.flush(); + String var3; + try { + var3 = out.toString(); + } finally { + try { + out.close(); + } catch (IOException ignored) { + } + } + return var3; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/service/ICacheService.java b/src/main/java/com/iqudoo/framework/tape/service/ICacheService.java new file mode 100644 index 0000000..864978b --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/service/ICacheService.java @@ -0,0 +1,19 @@ +package com.iqudoo.framework.tape.service; + +import com.iqudoo.framework.tape.modules.cache.CacheKey; + +public interface ICacheService { + + void setCache(CacheKey cacheKey, String value) throws Throwable; + + String getCache(CacheKey cacheKey) throws Throwable; + + boolean hasCache(CacheKey cacheKey) throws Throwable; + + void removeCache(CacheKey cacheKey) throws Throwable; + + void removeCacheByPrefix(String prefix) throws Throwable; + + void clearCache() throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/service/ICrawlerService.java b/src/main/java/com/iqudoo/framework/tape/service/ICrawlerService.java new file mode 100644 index 0000000..868fad5 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/service/ICrawlerService.java @@ -0,0 +1,13 @@ +package com.iqudoo.framework.tape.service; + +import com.iqudoo.framework.tape.modules.crawler.CrawlerKey; + +public interface ICrawlerService { + + void saveCrawler(CrawlerKey crawlerKey, String value) throws Throwable; + + String getCrawler(CrawlerKey crawlerKey) throws Throwable; + + boolean hasCrawler(CrawlerKey crawlerKey) throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/service/IInterceptorService.java b/src/main/java/com/iqudoo/framework/tape/service/IInterceptorService.java new file mode 100644 index 0000000..5558694 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/service/IInterceptorService.java @@ -0,0 +1,16 @@ +package com.iqudoo.framework.tape.service; + +import com.iqudoo.framework.tape.base.action.bean.ActionParam; +import com.iqudoo.framework.tape.base.action.bean.ActionRequest; +import com.iqudoo.framework.tape.base.action.bean.ActionResponse; +import com.iqudoo.framework.tape.base.action.handler.ActionHandler; + +public interface IInterceptorService { + + void onInterceptBefore(ActionHandler actionHandler, ActionRequest actionRequest, ActionParam param) throws Throwable; + + void onInterceptAfter(ActionHandler actionHandler, ActionRequest actionRequest, ActionParam param, ActionResponse response) throws Throwable; + + void onInterceptError(ActionHandler actionHandler, ActionRequest actionRequest, ActionParam param, Throwable throwable) throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/service/ILauncherService.java b/src/main/java/com/iqudoo/framework/tape/service/ILauncherService.java new file mode 100644 index 0000000..aa4a0f3 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/service/ILauncherService.java @@ -0,0 +1,7 @@ +package com.iqudoo.framework.tape.service; + +public interface ILauncherService { + + void onLaunch(String[] args) throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/service/ISessionService.java b/src/main/java/com/iqudoo/framework/tape/service/ISessionService.java new file mode 100644 index 0000000..5a34a29 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/service/ISessionService.java @@ -0,0 +1,12 @@ +package com.iqudoo.framework.tape.service; + +import com.iqudoo.framework.tape.modules.session.GetSessionParam; +import com.iqudoo.framework.tape.modules.session.RefreshSessionParam; + +public interface ISessionService { + + String getSession(GetSessionParam param) throws Throwable; + + String refreshSession(RefreshSessionParam param) throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/service/ISettingService.java b/src/main/java/com/iqudoo/framework/tape/service/ISettingService.java new file mode 100644 index 0000000..49dd2d0 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/service/ISettingService.java @@ -0,0 +1,8 @@ +package com.iqudoo.framework.tape.service; + + +public interface ISettingService { + + String getSettingValue(String key, String group, String... bizArgs) throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/service/ITokenService.java b/src/main/java/com/iqudoo/framework/tape/service/ITokenService.java new file mode 100644 index 0000000..1c12a63 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/service/ITokenService.java @@ -0,0 +1,19 @@ +package com.iqudoo.framework.tape.service; + +import com.iqudoo.framework.tape.base.action.bean.ActionAuthInfo; +import com.iqudoo.framework.tape.base.action.bean.ActionParam; +import com.iqudoo.framework.tape.base.action.bean.ActionTokenInfo; + +public interface ITokenService { + + void checkUserPermission(ActionAuthInfo actionAuthInfo, ActionParam param) throws Throwable; + + ActionTokenInfo createToken(ActionAuthInfo userInfo) throws Throwable; + + ActionTokenInfo refreshToken(String refreshToken) throws Throwable; + + ActionAuthInfo parseToken(String token) throws Throwable; + + Throwable getAuthError(); + +} diff --git a/src/main/java/com/iqudoo/framework/tape/spring/Runner.java b/src/main/java/com/iqudoo/framework/tape/spring/Runner.java new file mode 100644 index 0000000..5e35b2b --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/Runner.java @@ -0,0 +1,33 @@ +package com.iqudoo.framework.tape.spring; + +import com.iqudoo.framework.tape.service.ILauncherService; +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; +import org.springframework.stereotype.Component; + +@Component +public final class Runner implements ApplicationRunner { + + @Override + public void run(ApplicationArguments args) throws Exception { + RunnerApplication.run(getClass(), args.getSourceArgs()); + ILauncherService runService = getRunService(); + if (runService != null) { + try { + runService.onLaunch(args.getSourceArgs()); + } catch (Throwable throwable) { + throwable.printStackTrace(); + } + } + } + + private static ILauncherService getRunService() { + ILauncherService runService = null; + try { + runService = RunnerContext.getBean(ILauncherService.class); + } catch (Throwable ignored) { + } + return runService; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/spring/RunnerApplication.java b/src/main/java/com/iqudoo/framework/tape/spring/RunnerApplication.java new file mode 100644 index 0000000..0a703eb --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/RunnerApplication.java @@ -0,0 +1,162 @@ +package com.iqudoo.framework.tape.spring; + +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.base.action.interfaces.IActionDiscover; +import org.slf4j.Logger; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.core.io.Resource; +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; +import org.springframework.core.io.support.ResourcePatternResolver; +import org.springframework.core.type.classreading.CachingMetadataReaderFactory; +import org.springframework.core.type.classreading.MetadataReader; +import org.springframework.core.type.classreading.MetadataReaderFactory; +import org.springframework.util.ClassUtils; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; + +public final class RunnerApplication { + + /* 类文件 */ + private static final String RESOURCE_PATTERN = "/**/*.class"; + /* 日志输出 */ + private static final Logger LOGGER = Tape.getLogger(RunnerApplication.class); + /* 扫描的类列表 */ + private static final List> CLASS_LIST = new ArrayList<>(); + + /** + * 启动服务 + * + * @param clazz 入口类 + * @param args 其他参数 + */ + public static void run(Class clazz, String... args) { + run(new Class[]{clazz, RunnerApplication.class}, args); + } + + /** + * 启动服务 + * + * @param classes 入口类 + * @param args 其他参数 + */ + public static void run(Class[] classes, String... args) { + List packageNames = getComponentScanPackageNames(true, classes); + packageNames.addAll(getComponentScanPackageNames(true, RunnerContext.getBootClasses())); + String tapePackageName = RunnerApplication.class.getPackage().getName(); + if (!packageNames.contains(tapePackageName)) { + packageNames.add(tapePackageName); + } + CLASS_LIST.addAll(getClassListByPackageNames(packageNames)); + try { + Tape.getService(IActionDiscover.class).getHandlerList(); + LOGGER.info("Started, args:" + Arrays.toString(args) + + ", activeProfile:" + RunnerContext.getActiveProfile() + + ", nodeId:" + Tape.getNodeId()); + } catch (Throwable throwable) { + LOGGER.error("Started failed", throwable); + System.exit(1); + } + } + + /** + * 获取当前服务的类列表 + * + * @return 类列表 + */ + public static List> getClassList() { + return CLASS_LIST; + } + + /** + * 获取组件扫描的包目录 + * + * @param recursion 是否递归 + * @param classes 入口类 + * @return 包列表 + */ + private static List getComponentScanPackageNames(boolean recursion, Class... classes) { + List packageNames = new ArrayList<>(); + for (Class cls : classes) { + ComponentScan componentScan = cls.getAnnotation(ComponentScan.class); + if (!recursion || componentScan == null) { + String packageName = cls.getPackage().getName(); + if (!packageNames.contains(packageName)) { + packageNames.add(packageName); + } + } else { + Class[] basePackageClasses = componentScan.basePackageClasses(); + if (basePackageClasses.length > 0) { + for (String packageName : getComponentScanPackageNames(false, basePackageClasses)) { + if (!packageNames.contains(packageName)) { + packageNames.add(packageName); + } + } + } + String[] basePackages = componentScan.basePackages(); + if (basePackages.length > 0) { + for (String packageName : basePackages) { + if (!packageNames.contains(packageName)) { + packageNames.add(packageName); + } + } + } + } + SpringBootApplication springBootApplication = cls.getAnnotation(SpringBootApplication.class); + if (springBootApplication != null) { + Class[] scanBasePackageClasses = springBootApplication.scanBasePackageClasses(); + if (scanBasePackageClasses.length > 0) { + for (Class clz : scanBasePackageClasses) { + packageNames.add(clz.getName()); + } + } + String[] scanBasePackages = springBootApplication.scanBasePackages(); + if (scanBasePackages.length > 0) { + Collections.addAll(packageNames, scanBasePackages); + } + packageNames.add(cls.getName()); + } + } + return packageNames; + } + + /** + * 根据包名查找类列表 + * + * @param packageNames 包名列表 + * @return 类列表 + */ + private static List> getClassListByPackageNames(List packageNames) { + List> classList = new ArrayList<>(); + ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver(); + MetadataReaderFactory readerFactory = new CachingMetadataReaderFactory(resourcePatternResolver); + for (String packageName : packageNames) { + try { + String pattern = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX + + ClassUtils.convertClassNameToResourcePath(packageName) + RESOURCE_PATTERN; + Resource[] resources = resourcePatternResolver.getResources(pattern); + for (Resource resource : resources) { + try { + if (!resource.isReadable()) { + continue; + } + MetadataReader reader = readerFactory.getMetadataReader(resource); + String classname = reader.getClassMetadata().getClassName(); + if (classname.contains("$")) { + continue; + } + Class clazz = Class.forName(classname); + classList.add(clazz); + } catch (Throwable ignored) { + } + } + } catch (Throwable ignored) { + } + } + return classList; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/spring/RunnerContext.java b/src/main/java/com/iqudoo/framework/tape/spring/RunnerContext.java new file mode 100644 index 0000000..afa284d --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/RunnerContext.java @@ -0,0 +1,89 @@ +package com.iqudoo.framework.tape.spring; + +import org.springframework.beans.BeansException; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +@Component +public class RunnerContext implements ApplicationContextAware { + + private static ApplicationContext applicationContext; + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + if (RunnerContext.applicationContext == null) { + RunnerContext.applicationContext = applicationContext; + } + } + + /** + * 获取applicationContext + */ + public static ApplicationContext getApplicationContext() { + return applicationContext; + } + + /** + * 获取 Bean. + * + * @param name 别名 + */ + public static Object getBean(String name) { + return getApplicationContext().getBean(name); + } + + /** + * 获取 Bean. + * + * @param clazz 类 + */ + public static T getBean(Class clazz) { + return getApplicationContext().getBean(clazz); + } + + /** + * 获取 Bean. + * + * @param name 别名 + * @param clazz 类 + */ + public static T getBean(String name, Class clazz) { + if (name != null && name.length() > 0) { + return getApplicationContext().getBean(name, clazz); + } + return getApplicationContext().getBean(clazz); + } + + /** + * 获取当前环境 + */ + public static String getActiveProfile() { + try { + return getApplicationContext().getEnvironment().getActiveProfiles()[0]; + } catch (Throwable ignored) { + } + return null; + } + + /** + * 获取SpringBootApplication实现类 + */ + public static Class[] getBootClasses() { + List> classes = new ArrayList<>(); + Map annotatedBeans = getApplicationContext().getBeansWithAnnotation(SpringBootApplication.class); + if (annotatedBeans.isEmpty()) { + return new Class[0]; + } + for (Map.Entry entry : annotatedBeans.entrySet()) { + classes.add(entry.getValue().getClass()); + } + return classes.toArray(new Class[0]); + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/spring/actions/GetActionDetailAction.java b/src/main/java/com/iqudoo/framework/tape/spring/actions/GetActionDetailAction.java new file mode 100644 index 0000000..5d058f6 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/actions/GetActionDetailAction.java @@ -0,0 +1,59 @@ +package com.iqudoo.framework.tape.spring.actions; + +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.bean.ActionState; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.framework.tape.base.docs.bean.ApiDocActionInfo; +import com.iqudoo.framework.tape.base.docs.interfaces.IDocAction; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.framework.tape.modules.proto.ProtoLoader; +import com.iqudoo.framework.tape.modules.proto.ProtoUtil; + +@ActionMapping(action = "getActionDetail") +@ApiDocActionConfiguration( + response = { + ApiDocActionInfo.class + } +) +public class GetActionDetailAction extends ProtoActionHandler { + + @Override + public Proto onHandleRequest(Param param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + + @Override + public Object onLoad(Param loadParam) throws Throwable { + if (loadParam.getId() == null || loadParam.getId().length() <= 0) { + throw new IllegalArgumentException("GUID不能为空"); + } + ApiDocActionInfo apiDocActionInfo = Tape.getService(IDocAction.class) + .getActionById(loadParam.getId()); + if (apiDocActionInfo == null) { + throw new ActionState("找不到接口信息"); + } + return apiDocActionInfo; + } + + }); + } + + @SuppressWarnings({"LombokGetterMayBeUsed", "LombokSetterMayBeUsed"}) + public static class Param { + + @ApiDocFieldConfiguration(desc = "接口编号") + private String id; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/spring/actions/GetActionListAction.java b/src/main/java/com/iqudoo/framework/tape/spring/actions/GetActionListAction.java new file mode 100644 index 0000000..e1755f9 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/actions/GetActionListAction.java @@ -0,0 +1,78 @@ +package com.iqudoo.framework.tape.spring.actions; + +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.framework.tape.base.docs.bean.ApiDocActionInfo; +import com.iqudoo.framework.tape.base.docs.interfaces.IDocAction; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.framework.tape.modules.proto.ProtoLoader; +import com.iqudoo.framework.tape.modules.proto.ProtoUtil; +import com.iqudoo.framework.tape.modules.utils.ArrayUtil; + +import java.util.List; + +@ActionMapping(action = "getActionList") +@ApiDocActionConfiguration( + response = { + List.class, + ApiDocActionInfo.class + } +) +public class GetActionListAction extends ProtoActionHandler { + + @Override + public Proto onHandleRequest(GetActionListAction.Param param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + + @Override + public Object onLoad(GetActionListAction.Param loadParam) throws Throwable { + return ArrayUtil.filter(Tape.getService(IDocAction.class) + .getActionList(), new ArrayUtil.FilterHandler() { + @Override + public boolean filter(ApiDocActionInfo apiDocActionInfo) { + boolean inGroup = true; + boolean inScene = true; + if (loadParam.getGroup() != null && !loadParam.getGroup().isEmpty()) { + inGroup = ArrayUtil.in(apiDocActionInfo.getGroups(), loadParam.getGroup()); + } + if (loadParam.getScene() != null && !loadParam.getScene().isEmpty()) { + inScene = ArrayUtil.in(apiDocActionInfo.getScenes(), loadParam.getScene()); + } + return inGroup && inScene; + } + }); + } + + }); + } + + @SuppressWarnings({"LombokGetterMayBeUsed", "LombokSetterMayBeUsed"}) + public static class Param { + + @ApiDocFieldConfiguration(desc = "用户组") + private String group; + + @ApiDocFieldConfiguration(desc = "场景组") + private String scene; + + public String getGroup() { + return group; + } + + public void setGroup(String group) { + this.group = group; + } + + public String getScene() { + return scene; + } + + public void setScene(String scene) { + this.scene = scene; + } + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/spring/actions/GetControllerListAction.java b/src/main/java/com/iqudoo/framework/tape/spring/actions/GetControllerListAction.java new file mode 100644 index 0000000..a4c1f7e --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/actions/GetControllerListAction.java @@ -0,0 +1,37 @@ +package com.iqudoo.framework.tape.spring.actions; + +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.base.docs.bean.ApiDocActionInfo; +import com.iqudoo.framework.tape.base.docs.bean.ApiDocControllerInfo; +import com.iqudoo.framework.tape.base.docs.interfaces.IDocController; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.framework.tape.modules.proto.ProtoLoader; +import com.iqudoo.framework.tape.modules.proto.ProtoUtil; + +import java.util.List; + +@ActionMapping(action = "getControllerList") +@ApiDocActionConfiguration( + response = { + List.class, + ApiDocControllerInfo.class + } +) +public class GetControllerListAction extends ProtoActionHandler { + + @Override + public Proto onHandleRequest(Void unused) throws Throwable { + return ProtoUtil.load(unused, new ProtoLoader() { + @Override + public Object onLoad(Void unused) throws Throwable { + return Tape.getService(IDocController.class) + .getControllerList(); + } + + }); + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/spring/actions/GetEnumDetailAction.java b/src/main/java/com/iqudoo/framework/tape/spring/actions/GetEnumDetailAction.java new file mode 100644 index 0000000..8174275 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/actions/GetEnumDetailAction.java @@ -0,0 +1,57 @@ +package com.iqudoo.framework.tape.spring.actions; + +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.bean.ActionState; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.framework.tape.base.docs.bean.ApiDocEnumInfo; +import com.iqudoo.framework.tape.base.docs.interfaces.IDocEnum; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.framework.tape.modules.proto.ProtoLoader; +import com.iqudoo.framework.tape.modules.proto.ProtoUtil; + +@ActionMapping(action = "getEnumDetail") +@ApiDocActionConfiguration( + response = { + ApiDocEnumInfo.class + } +) +public class GetEnumDetailAction extends ProtoActionHandler { + + @Override + public Proto onHandleRequest(Param param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + @Override + public Object onLoad(Param loadParam) throws Throwable { + if (loadParam.getEnumName() == null || loadParam.getEnumName().length() <= 0) { + throw new IllegalArgumentException("枚举名称不能为空"); + } + ApiDocEnumInfo apiDocEnumInfo = Tape.getService(IDocEnum.class) + .getEnumByName(loadParam.getEnumName()); + if (apiDocEnumInfo == null) { + throw new ActionState("找不到枚举信息"); + } + return apiDocEnumInfo; + } + + }); + } + + @SuppressWarnings({"LombokGetterMayBeUsed", "LombokSetterMayBeUsed"}) + public static class Param { + + @ApiDocFieldConfiguration(desc = "枚举名称") + private String enumName; + + public String getEnumName() { + return enumName; + } + + public void setEnumName(String enumName) { + this.enumName = enumName; + } + + } +} diff --git a/src/main/java/com/iqudoo/framework/tape/spring/actions/GetEnumListAction.java b/src/main/java/com/iqudoo/framework/tape/spring/actions/GetEnumListAction.java new file mode 100644 index 0000000..f9ba884 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/actions/GetEnumListAction.java @@ -0,0 +1,36 @@ +package com.iqudoo.framework.tape.spring.actions; + +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.base.docs.bean.ApiDocEnumInfo; +import com.iqudoo.framework.tape.base.docs.interfaces.IDocEnum; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.framework.tape.modules.proto.ProtoLoader; +import com.iqudoo.framework.tape.modules.proto.ProtoUtil; + +import java.util.List; + +@ActionMapping(action = "getEnumList") +@ApiDocActionConfiguration( + response = { + List.class, + ApiDocEnumInfo.class + } +) +public class GetEnumListAction extends ProtoActionHandler { + + @Override + public Proto onHandleRequest(Void unused) throws Throwable { + return ProtoUtil.load(unused, new ProtoLoader() { + @Override + public Object onLoad(Void unused) throws Throwable { + return Tape.getService(IDocEnum.class) + .getEnumList(); + } + + }); + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/spring/actions/GetNodeIdAction.java b/src/main/java/com/iqudoo/framework/tape/spring/actions/GetNodeIdAction.java new file mode 100644 index 0000000..e817017 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/actions/GetNodeIdAction.java @@ -0,0 +1,51 @@ +package com.iqudoo.framework.tape.spring.actions; + +import com.alibaba.fastjson.JSONObject; +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.framework.tape.base.docs.bean.ApiDocEnumInfo; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.framework.tape.modules.proto.ProtoLoader; +import com.iqudoo.framework.tape.modules.proto.ProtoUtil; + +@ActionMapping(action = "getNodeId") +@ApiDocActionConfiguration( + response = { + GetNodeIdAction.NodeId.class + } +) +public class GetNodeIdAction extends ProtoActionHandler { + + @SuppressWarnings({"LombokGetterMayBeUsed", "LombokSetterMayBeUsed"}) + public static class NodeId { + + @ApiDocFieldConfiguration(desc = "节点编号") + private String nodeId; + + public String getNodeId() { + return nodeId; + } + + public void setNodeId(String nodeId) { + this.nodeId = nodeId; + } + + } + + @Override + public Proto onHandleRequest(Void param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + @Override + public Object onLoad(Void loadParam) throws Throwable { + NodeId nodeInfo = new NodeId(); + nodeInfo.setNodeId(Tape.getNodeId()); + return nodeInfo; + } + + }); + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/spring/actions/GetNodeInfoAction.java b/src/main/java/com/iqudoo/framework/tape/spring/actions/GetNodeInfoAction.java new file mode 100644 index 0000000..714a323 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/actions/GetNodeInfoAction.java @@ -0,0 +1,63 @@ +package com.iqudoo.framework.tape.spring.actions; + +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.framework.tape.modules.proto.ProtoLoader; +import com.iqudoo.framework.tape.modules.proto.ProtoUtil; +import com.iqudoo.framework.tape.modules.utils.PerfUtils; + +@ActionMapping(action = "getNodeInfo") +@ApiDocActionConfiguration( + response = { + GetNodeInfoAction.NodeInfo.class + } +) +public class GetNodeInfoAction extends ProtoActionHandler { + + + @SuppressWarnings({"LombokGetterMayBeUsed", "LombokSetterMayBeUsed"}) + public static class NodeInfo { + + @ApiDocFieldConfiguration(desc = "节点编号") + private String nodeId; + + @ApiDocFieldConfiguration(desc = "性能信息") + private String perfInfo; + + public String getNodeId() { + return nodeId; + } + + public void setNodeId(String nodeId) { + this.nodeId = nodeId; + } + + public String getPerfInfo() { + return perfInfo; + } + + public void setPerfInfo(String perfInfo) { + this.perfInfo = perfInfo; + } + } + + @Override + public Proto onHandleRequest(Void param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + @Override + public Object onLoad(Void loadParam) throws Throwable { + String performanceInfo = PerfUtils.getAllServerPerformanceInfo(); + NodeInfo nodeInfo = new NodeInfo(); + nodeInfo.setNodeId(Tape.getNodeId()); + nodeInfo.setPerfInfo(performanceInfo); + return nodeInfo; + } + + }); + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/spring/actions/PingRequestAction.java b/src/main/java/com/iqudoo/framework/tape/spring/actions/PingRequestAction.java new file mode 100644 index 0000000..bbfcd54 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/actions/PingRequestAction.java @@ -0,0 +1,25 @@ +package com.iqudoo.framework.tape.spring.actions; + +import com.alibaba.fastjson.JSONObject; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.modules.proto.Proto; + +@ActionMapping(action = "pingRequest") +@ApiDocActionConfiguration( + response = { + JSONObject.class, + } +) +public class PingRequestAction extends ProtoActionHandler { + + @Override + public Proto onHandleRequest(JSONObject param) throws Throwable { + if (param == null) { + param = new JSONObject(); + } + return Proto.resolve(param); + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/spring/actions/RefreshTokenAction.java b/src/main/java/com/iqudoo/framework/tape/spring/actions/RefreshTokenAction.java new file mode 100644 index 0000000..e04e845 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/actions/RefreshTokenAction.java @@ -0,0 +1,35 @@ +package com.iqudoo.framework.tape.spring.actions; + +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.bean.ActionTokenInfo; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.action.interfaces.IActionToken; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.modules.asserts.AssertUtil; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.framework.tape.modules.proto.ProtoLoader; +import com.iqudoo.framework.tape.modules.proto.ProtoUtil; + +@ActionMapping(action = "refreshToken") +@ApiDocActionConfiguration( + response = { + ActionTokenInfo.class + } +) +public class RefreshTokenAction extends ProtoActionHandler { + + @Override + public Proto onHandleRequest(IActionToken.RefreshTokenParam param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + @Override + public Object onLoad(IActionToken.RefreshTokenParam refreshTokenParam) throws Throwable { + AssertUtil.oneNotInvalid(refreshTokenParam.getRefreshToken(), "refreshToken不能为空"); + return Tape.getService(IActionToken.class) + .refreshToken(refreshTokenParam.getRefreshToken()); + } + + }); + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/spring/annotation/EnableTapeCorsFilter.java b/src/main/java/com/iqudoo/framework/tape/spring/annotation/EnableTapeCorsFilter.java new file mode 100644 index 0000000..cac3c61 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/annotation/EnableTapeCorsFilter.java @@ -0,0 +1,15 @@ +package com.iqudoo.framework.tape.spring.annotation; + +import com.iqudoo.framework.tape.spring.conf.ConfCorsFilter; +import org.springframework.context.annotation.Import; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Import(value = {ConfCorsFilter.class}) +@Target({ElementType.METHOD, ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface EnableTapeCorsFilter { +} diff --git a/src/main/java/com/iqudoo/framework/tape/spring/annotation/EnableTapeRunner.java b/src/main/java/com/iqudoo/framework/tape/spring/annotation/EnableTapeRunner.java new file mode 100644 index 0000000..9575149 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/annotation/EnableTapeRunner.java @@ -0,0 +1,52 @@ +package com.iqudoo.framework.tape.spring.annotation; + +import com.iqudoo.framework.tape.spring.Runner; +import com.iqudoo.framework.tape.spring.RunnerContext; +import com.iqudoo.framework.tape.spring.actions.*; +import com.iqudoo.framework.tape.spring.conf.TapeConfig; +import com.iqudoo.framework.tape.spring.controller.ApiController; +import com.iqudoo.framework.tape.spring.docs.DocActionImpl; +import com.iqudoo.framework.tape.spring.docs.DocControllerImpl; +import com.iqudoo.framework.tape.spring.docs.DocEnumImpl; +import com.iqudoo.framework.tape.spring.impl.*; +import org.springframework.context.annotation.Import; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Import(value = { + TapeConfig.class, + RunnerContext.class, + ActionCallImpl.class, + ActionDiscoverImpl.class, + ActionDispatchImpl.class, + ActionTokenImpl.class, + DocActionImpl.class, + DocControllerImpl.class, + DocEnumImpl.class, + ModuleAsyncImpl.class, + ModuleCacheImpl.class, + ModuleCrawlerImpl.class, + ModuleFactoryImpl.class, + ModuleSessionImpl.class, + ModuleSettingImpl.class, + ModuleLockImpl.class, + GetActionListAction.class, + GetActionDetailAction.class, + GetControllerListAction.class, + GetEnumDetailAction.class, + GetEnumListAction.class, + GetNodeIdAction.class, + GetNodeInfoAction.class, + RefreshTokenAction.class, + PingRequestAction.class, + ApiController.class, + Runner.class, +}) +@Target({ElementType.METHOD, ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface EnableTapeRunner { + +} diff --git a/src/main/java/com/iqudoo/framework/tape/spring/conf/ConfCorsFilter.java b/src/main/java/com/iqudoo/framework/tape/spring/conf/ConfCorsFilter.java new file mode 100644 index 0000000..2e1146f --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/conf/ConfCorsFilter.java @@ -0,0 +1,27 @@ +package com.iqudoo.framework.tape.spring.conf; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.cors.CorsConfiguration; +import org.springframework.web.cors.UrlBasedCorsConfigurationSource; +import org.springframework.web.filter.CorsFilter; + +@Configuration +public class ConfCorsFilter { + + @Bean + public CorsFilter corsFilter() { + UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); + source.registerCorsConfiguration("/**", buildCorsConfig()); + return new CorsFilter(source); + } + + private CorsConfiguration buildCorsConfig() { + CorsConfiguration corsConfiguration = new CorsConfiguration(); + corsConfiguration.addAllowedHeader("*"); + corsConfiguration.addAllowedMethod("*"); + corsConfiguration.addAllowedOrigin("*"); + return corsConfiguration; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/spring/conf/TapeConfig.java b/src/main/java/com/iqudoo/framework/tape/spring/conf/TapeConfig.java new file mode 100644 index 0000000..2c10f09 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/conf/TapeConfig.java @@ -0,0 +1,14 @@ +package com.iqudoo.framework.tape.spring.conf; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +@Data +@Configuration +@ConfigurationProperties(prefix = "tape") +public class TapeConfig { + + private int reqLimit = 0; + +} diff --git a/src/main/java/com/iqudoo/framework/tape/spring/controller/ApiController.java b/src/main/java/com/iqudoo/framework/tape/spring/controller/ApiController.java new file mode 100644 index 0000000..4b19dd2 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/controller/ApiController.java @@ -0,0 +1,159 @@ +package com.iqudoo.framework.tape.spring.controller; + +import com.alibaba.fastjson.JSONObject; +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.base.action.bean.ActionServletRequest; +import com.iqudoo.framework.tape.base.action.bean.ActionServletResponse; +import com.iqudoo.framework.tape.base.action.interfaces.IActionDispatch; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; +import java.util.regex.Pattern; +import java.util.stream.Collectors; + +@RestController +public final class ApiController { + + // Base64 字符模式(仅包含Base64允许的字符) + private static final Pattern BASE64_PATTERN = Pattern.compile("^[A-Za-z0-9+/=]+$"); + + /** + * 接口统一入口函数,支持URL编码参数和Base64数据 + */ + @RequestMapping(value = "/api", method = { + RequestMethod.GET, + RequestMethod.POST, + RequestMethod.OPTIONS + }) + public Object doApiRequest(@RequestParam(required = false) Map requestParam, + HttpServletRequest servletRequest, + HttpServletResponse servletResponse) throws Throwable { + + if (Objects.equals(servletRequest.getMethod(), RequestMethod.OPTIONS.name())) { + return null; + } + + // 读取原始请求体 + String rawBody = readRequestBody(servletRequest); + + // 解析并处理请求体(区分JSON中的普通字段和Base64字段) + JSONObject requestBody = parseAndProcessRequestBody(servletRequest, rawBody); + + // 处理请求参数(区分普通参数和Base64参数) + Map processedParams = processRequestParams(requestParam); + + // 执行分发处理请求 + return Tape.getService(IActionDispatch.class) + .doRequest(requestBody, processedParams, + new ActionServletRequest(servletRequest, rawBody), + new ActionServletResponse(servletResponse)); + } + + /** + * 解析并处理请求体,对普通字段解码,保留Base64字段 + */ + private JSONObject parseAndProcessRequestBody(HttpServletRequest request, String rawBody) { + String contentType = request.getContentType(); + if (contentType == null) { + return new JSONObject(); + } + try { + if (contentType.contains("application/json")) { + JSONObject jsonObject = JSONObject.parseObject(rawBody); + // 遍历JSON字段,区分处理 + for (String key : jsonObject.keySet()) { + Object value = jsonObject.get(key); + if (value instanceof String) { + String strValue = (String) value; + // 判断是否为Base64字段 + if (isBase64Param(strValue)) { + // 保留原始值,不进行URL解码 + jsonObject.put(key, strValue); + } else { + // 普通字段进行URL解码 + jsonObject.put(key, safeUrlDecode(strValue)); + } + } + } + return jsonObject; + } + } catch (Exception ignored) { + } + return new JSONObject(); + } + + /** + * 处理请求参数,对普通参数解码,保留Base64参数 + */ + private Map processRequestParams(Map params) { + if (params == null || params.isEmpty()) { + return new HashMap<>(0); + } + + Map processedParams = new HashMap<>(params.size()); + for (Map.Entry entry : params.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + // 判断是否为Base64参数 + if (isBase64Param(value)) { + // 保留原始值,不进行URL解码 + processedParams.put(key, value); + } else { + // 普通参数进行URL解码 + processedParams.put(safeUrlDecode(key), + safeUrlDecode(value)); + } + } + return processedParams; + } + + /** + * 判断是否为Base64参数 + * + * @param value 参数值 + * @return 是否为Base64参数 + */ + private boolean isBase64Param(String value) { + if (value == null || value.isEmpty()) { + return false; + } + String normalizedValue = value.replace('-', '+').replace('_', '/'); + return BASE64_PATTERN.matcher(normalizedValue).matches() + && (normalizedValue.length() % 4 == 0); // Base64长度通常是4的倍数 + } + + /** + * 安全的URL解码 + */ + private String safeUrlDecode(String value) { + if (value == null) { + return null; + } + try { + return URLDecoder.decode(value, StandardCharsets.UTF_8.name()); + } catch (UnsupportedEncodingException | IllegalArgumentException e) { + return value; + } + } + + private String readRequestBody(HttpServletRequest request) { + try { + return request.getReader().lines() + .collect(Collectors.joining(System.lineSeparator())); + } catch (Exception e) { + return ""; + } + } + + +} diff --git a/src/main/java/com/iqudoo/framework/tape/spring/docs/DocActionImpl.java b/src/main/java/com/iqudoo/framework/tape/spring/docs/DocActionImpl.java new file mode 100644 index 0000000..3f278cb --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/docs/DocActionImpl.java @@ -0,0 +1,226 @@ +package com.iqudoo.framework.tape.spring.docs; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.base.action.bean.ActionState; +import com.iqudoo.framework.tape.base.action.handler.ActionHandler; +import com.iqudoo.framework.tape.base.action.interfaces.IActionDiscover; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.framework.tape.base.docs.bean.ApiDocActionInfo; +import com.iqudoo.framework.tape.base.docs.bean.ApiDocEnumInfo; +import com.iqudoo.framework.tape.base.docs.interfaces.IDocAction; +import com.iqudoo.framework.tape.base.docs.interfaces.IDocEnum; +import com.iqudoo.framework.tape.modules.utils.ArrayUtil; +import com.iqudoo.framework.tape.modules.utils.DigestUtil; +import org.springframework.stereotype.Component; + +import java.lang.reflect.Field; +import java.lang.reflect.ParameterizedType; +import java.lang.reflect.Type; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; + +@SuppressWarnings({"FieldCanBeLocal", "SameParameterValue"}) +@Component +public class DocActionImpl implements IDocAction { + + private final int DEFAULT_FIELD_LEVEL = 10; + private final AtomicBoolean INIT_FLAG = new AtomicBoolean(false); + private final List ACTION_LIST = new ArrayList<>(); + + @Override + public List getActionList() throws Throwable { + if (INIT_FLAG.get()) { + return ACTION_LIST; + } + List apiDocActionInfoList = new ArrayList<>(); + List> actionHandlerList = Tape.getService(IActionDiscover.class) + .getHandlerList(); + for (ActionHandler actionHandler : actionHandlerList) { + ApiDocActionInfo apiDocActionInfo = getApiDocActionInfo(actionHandler, DEFAULT_FIELD_LEVEL); + if (apiDocActionInfo != null) { + apiDocActionInfoList.add(apiDocActionInfo); + } + } + apiDocActionInfoList.sort(new Comparator() { + @Override + public int compare(ApiDocActionInfo o1, ApiDocActionInfo o2) { + if (o1 == null || o2 == null) { + return 0; + } + try { + return o2.getSort() - o1.getSort(); + } catch (Throwable ignored) { + } + return 0; + } + }); + if (!apiDocActionInfoList.isEmpty()) { + ACTION_LIST.clear(); + ACTION_LIST.addAll(apiDocActionInfoList); + INIT_FLAG.set(true); + } + return ACTION_LIST; + } + + @Override + public ApiDocActionInfo getActionById(String id) throws Throwable { + ActionHandler actionHandler = Tape.getService(IActionDiscover.class) + .getActionHandlerByApiDocId(id); + if (actionHandler == null) { + throw new ActionState("Not found handler by apiDoc id: " + id); + } + ApiDocActionInfo apiDocActionInfo = getApiDocActionInfo(actionHandler, DEFAULT_FIELD_LEVEL); + if (apiDocActionInfo == null) { + throw new ActionState("Not found apiDoc by id: " + id); + } + return apiDocActionInfo; + } + + private ApiDocActionInfo getApiDocActionInfo(ActionHandler actionHandler, int fieldLevel) throws Throwable { + if (actionHandler.getActionDocInfo() != null) { + try { + ApiDocActionInfo apiDocActionInfo = new ApiDocActionInfo(); + apiDocActionInfo.setId(actionHandler.getActionDocInfo().getApiDocId()); + apiDocActionInfo.setResponse(actionHandler.getActionDocInfo().getApiDocResponseClass()); + apiDocActionInfo.setParam((Class) actionHandler.getParamType()); + apiDocActionInfo.setParamModel(getApiDocBeamInfo("", apiDocActionInfo.getParam(), new ArrayList<>(), new ArrayList<>(), fieldLevel)); + apiDocActionInfo.setResponseModel(getApiDocBeamInfo("", apiDocActionInfo.getResponse(), Arrays.asList(actionHandler.getActionDocInfo() + .getApiDocResponseParametricTypes()), new ArrayList<>(), fieldLevel)); + apiDocActionInfo.setAction(actionHandler.getActions()); + apiDocActionInfo.setScenes(actionHandler.getScenes()); + apiDocActionInfo.setGroups(actionHandler.getGroups()); + apiDocActionInfo.setHandler(actionHandler.getClass()); + apiDocActionInfo.setSort(actionHandler.getSort()); + return apiDocActionInfo; + } catch (Throwable ignored) { + } + } + return null; + } + + private ApiDocActionInfo.BeamInfo getApiDocBeamInfo(String parentPath, Class clazz, List> parametricTypes, List refModelNames, int fieldLevel) throws Throwable { + String parametricHash = DigestUtil.md5DigestAsHex(String.join(",", ArrayUtil.map(parametricTypes, new ArrayUtil.MapHandler, String>() { + @Override + public String map(Class aClass) { + return aClass.getName(); + } + }))); + String classHash = clazz.getName() + "::" + parametricHash; + String modelPath = parentPath + "/" + classHash + "::" + fieldLevel + "::"; + ApiDocActionInfo.BeamInfo beamInfo = new ApiDocActionInfo.BeamInfo(); + beamInfo.setModelPath(modelPath); + beamInfo.setClassName(clazz.getName()); + beamInfo.setSimpleName(clazz.getSimpleName()); + beamInfo.setBasicProperty(isBasicPropertyClass(clazz)); + beamInfo.setParametricLength(parametricTypes.size()); + beamInfo.setParametricTypes(parametricTypes); + if (!refModelNames.contains(classHash)) { + refModelNames.add(classHash); + if (!isBasicPropertyClass(clazz)) { + beamInfo.setFields(getApiDocBeamFields(parentPath, beamInfo, clazz, + refModelNames, fieldLevel - 1)); + } + List parametricModels = new ArrayList<>(); + for (Class parametricType : parametricTypes) { + parametricModels.add(getApiDocBeamInfo(modelPath, parametricType, new ArrayList<>(), + refModelNames, fieldLevel - 1)); + } + beamInfo.setParametricModels(parametricModels); + } + return beamInfo; + } + + private List getApiDocBeamFields(String parentPath, ApiDocActionInfo.BeamInfo actionModel, Class clazz, List refModelNames, int fieldLevel) throws Throwable { + if (fieldLevel < 0) { + return null; + } + if (isBasicPropertyClass(clazz)) { + return null; + } + String fieldPath = parentPath + "/" + clazz.getName() + "::" + fieldLevel; + List fieldList = new ArrayList<>(); + for (Field field : clazz.getDeclaredFields()) { + field.setAccessible(true); + ApiDocActionInfo.BeamField docActionField = new ApiDocActionInfo.BeamField(); + docActionField.setFieldPath(fieldPath + "#" + field.getName()); + docActionField.setName(field.getName()); + docActionField.setType(field.getType()); + docActionField.setTypeName(field.getType().getSimpleName()); + docActionField.setBasicProperty(isBasicPropertyClass(field.getType())); + List parametricModels = new ArrayList<>(); + List> parametricTypes = new ArrayList<>(); + try { + Type fieldGenericType = field.getGenericType(); + if (fieldGenericType instanceof ParameterizedType) { + Type[] types = ((ParameterizedType) fieldGenericType).getActualTypeArguments(); + for (Type type : types) { + if (type instanceof Class) { + parametricTypes.add((Class) type); + parametricModels.add(getApiDocBeamInfo(docActionField.getFieldPath(), (Class) type, + new ArrayList<>(), + refModelNames, fieldLevel - 1)); + } + } + } + } catch (Throwable ignored) { + } + ApiDocFieldConfiguration apiDocFieldConfiguration = field.getAnnotation(ApiDocFieldConfiguration.class); + boolean ignoreFailed = (apiDocFieldConfiguration != null && apiDocFieldConfiguration.ignore()); + if (!ignoreFailed) { + if (apiDocFieldConfiguration != null) { + docActionField.setDesc(apiDocFieldConfiguration.desc()); + docActionField.setRequired(apiDocFieldConfiguration.required()); + ApiDocEnumInfo apiDocEnumInfo = Tape.getService(IDocEnum.class) + .getEnumInfo(apiDocFieldConfiguration.enumClass()); + if (apiDocEnumInfo != null) { + docActionField.setEnumInfo(apiDocEnumInfo); + } + if (parametricModels.size() <= 0) { + try { + int[] parametricIndex = apiDocFieldConfiguration.parametricIndex(); + for (int index : parametricIndex) { + if (actionModel.getParametricTypes() != null + && actionModel.getParametricTypes().size() > index) { + Class parameterType = actionModel.getParametricTypes().get(index); + parametricTypes.add(parameterType); + parametricModels.add(getApiDocBeamInfo(docActionField.getFieldPath(), parameterType, + new ArrayList<>(), refModelNames, fieldLevel - 1)); + } + } + } catch (Throwable ignored) { + } + } + } + docActionField.setModel(getApiDocBeamInfo(docActionField.getFieldPath(), field.getType(), + parametricTypes, refModelNames, fieldLevel)); + docActionField.setParametricModels(parametricModels); + docActionField.setParametricTypes(parametricTypes); + docActionField.setParametricLength(parametricTypes.size()); + fieldList.add(docActionField); + } + } + return fieldList; + } + + private static boolean isBasicPropertyClass(Class clazz) { + return clazz.isPrimitive() + || clazz.getName().startsWith("java.") + || clazz.isAssignableFrom(Boolean.class) + || clazz.isAssignableFrom(Byte.class) + || clazz.isAssignableFrom(Short.class) + || clazz.isAssignableFrom(Integer.class) + || clazz.isAssignableFrom(Long.class) + || clazz.isAssignableFrom(Float.class) + || clazz.isAssignableFrom(Double.class) + || clazz.isAssignableFrom(Character.class) + || clazz.equals(JSONObject.class) + || clazz.equals(JSONArray.class) + || clazz.equals(String.class); + } + +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/framework/tape/spring/docs/DocControllerImpl.java b/src/main/java/com/iqudoo/framework/tape/spring/docs/DocControllerImpl.java new file mode 100644 index 0000000..adbaa5a --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/docs/DocControllerImpl.java @@ -0,0 +1,73 @@ +package com.iqudoo.framework.tape.spring.docs; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocControllerConfiguration; +import com.iqudoo.framework.tape.base.docs.bean.ApiDocControllerInfo; +import com.iqudoo.framework.tape.base.docs.interfaces.IDocController; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.method.HandlerMethod; +import org.springframework.web.servlet.mvc.method.RequestMappingInfo; +import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; + +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.Map; +import java.util.concurrent.atomic.AtomicBoolean; + +@Component +public class DocControllerImpl implements IDocController { + + private final RequestMappingHandlerMapping handlerMapping; + + @Autowired + public DocControllerImpl(RequestMappingHandlerMapping handlerMapping) { + this.handlerMapping = handlerMapping; + } + + private final AtomicBoolean mInit = new AtomicBoolean(false); + private final List mPathList = new ArrayList<>(); + + @Override + public List getControllerList() { + if (mInit.get()) { + return mPathList; + } + List apiDocControllerInfoList = new ArrayList<>(); + Map handlerMappingHandlerMethods + = handlerMapping.getHandlerMethods(); + for (Map.Entry entry : handlerMappingHandlerMethods.entrySet()) { + Method method = entry.getValue().getMethod(); + ApiDocControllerConfiguration apiDocControllerConfiguration = method.getAnnotation(ApiDocControllerConfiguration.class); + if (apiDocControllerConfiguration == null) { + continue; + } + ApiDocControllerInfo apiDocControllerInfo = new ApiDocControllerInfo(); + apiDocControllerInfo.setSort(apiDocControllerConfiguration.sort()); + apiDocControllerInfo.setName(apiDocControllerConfiguration.name()); + apiDocControllerInfo.setDesc(apiDocControllerConfiguration.desc()); + apiDocControllerInfo.setPath(entry.getKey().toString()); + apiDocControllerInfo.setController(entry.getValue().getBeanType()); + apiDocControllerInfo.setMethod(entry.getValue().getMethod().getName()); + apiDocControllerInfoList.add(apiDocControllerInfo); + } + apiDocControllerInfoList.sort(new Comparator() { + @Override + public int compare(ApiDocControllerInfo o1, ApiDocControllerInfo o2) { + try { + return o2.getSort() - o1.getSort(); + } catch (Throwable ignored) { + } + return 0; + } + }); + if (!apiDocControllerInfoList.isEmpty()) { + mPathList.clear(); + mPathList.addAll(apiDocControllerInfoList); + mInit.set(true); + } + return mPathList; + } + +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/framework/tape/spring/docs/DocEnumImpl.java b/src/main/java/com/iqudoo/framework/tape/spring/docs/DocEnumImpl.java new file mode 100644 index 0000000..bee2cda --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/docs/DocEnumImpl.java @@ -0,0 +1,106 @@ +package com.iqudoo.framework.tape.spring.docs; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocEnumConfiguration; +import com.iqudoo.framework.tape.base.docs.bean.ApiDocEnumInfo; +import com.iqudoo.framework.tape.base.docs.interfaces.IDocEnum; +import com.iqudoo.framework.tape.modules.utils.ArrayUtil; +import com.iqudoo.framework.tape.spring.RunnerApplication; +import org.springframework.stereotype.Component; + +import java.lang.reflect.Field; +import java.util.*; +import java.util.concurrent.atomic.AtomicBoolean; + +@Component +public class DocEnumImpl implements IDocEnum { + + private final AtomicBoolean INIT_FLAG = new AtomicBoolean(false); + private final List ENUM_LIST = new ArrayList<>(); + + @Override + public ApiDocEnumInfo getEnumInfo(Class clazz) throws Throwable { + List apiDocEnumInfoList = getEnumList(); + for (ApiDocEnumInfo apiDocEnumInfo : apiDocEnumInfoList) { + if (apiDocEnumInfo.getType() == clazz) { + return apiDocEnumInfo; + } + } + return null; + } + + @Override + public List getEnumList() { + if (INIT_FLAG.get()) { + return ENUM_LIST; + } + List apiDocEnumInfoList = new ArrayList<>(); + List> classList = RunnerApplication.getClassList(); + if (classList != null && !classList.isEmpty()) { + for (Class clazz : classList) { + ApiDocEnumConfiguration apiDocEnumConfiguration = clazz.getAnnotation(ApiDocEnumConfiguration.class); + if (apiDocEnumConfiguration != null && clazz.isEnum()) { + List enumNameList = new ArrayList<>(); + String[] enumAlias = apiDocEnumConfiguration.alias(); + if (enumAlias != null && enumAlias.length > 0) { + enumNameList.addAll(Arrays.asList(enumAlias)); + } + boolean hasSimpleName = ArrayUtil.hasIf(enumNameList, new ArrayUtil.FilterHandler() { + @Override + public boolean filter(String s) { + return Objects.equals(s, clazz.getSimpleName()); + } + }); + if (!hasSimpleName) { + enumNameList.add(clazz.getSimpleName()); + } + List> properties = new ArrayList<>(); + for (Object enumObj : clazz.getEnumConstants()) { + Map property = new LinkedHashMap<>(); + property.put("$_NAME", enumObj); + Field[] fields = clazz.getDeclaredFields(); + for (Field field : fields) { + try { + field.setAccessible(true); + String name = field.getName(); + String value = field.get(enumObj).toString(); + if (!name.equals(value) && !name.equals("$VALUES")) { + property.put(field.getName(), field.get(enumObj)); + } + } catch (Throwable ignored) { + } + } + properties.add(property); + } + for (String enumName : enumNameList) { + if (enumName != null && !enumName.isEmpty()) { + ApiDocEnumInfo apiDocEnumInfo = new ApiDocEnumInfo(); + apiDocEnumInfo.setType(clazz); + apiDocEnumInfo.setName(enumName); + apiDocEnumInfo.setProperties(properties); + apiDocEnumInfoList.add(apiDocEnumInfo); + } + } + } + } + } + if (!apiDocEnumInfoList.isEmpty()) { + ENUM_LIST.clear(); + ENUM_LIST.addAll(apiDocEnumInfoList); + INIT_FLAG.set(true); + } + return ENUM_LIST; + } + + @Override + public ApiDocEnumInfo getEnumByName(String enumName) throws Throwable { + List apiDocEnumInfoList = getEnumList(); + for (ApiDocEnumInfo apiDocEnumInfo : apiDocEnumInfoList) { + if (apiDocEnumInfo.getName().equals(enumName)) { + return apiDocEnumInfo; + } + } + return null; + } + + +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/framework/tape/spring/impl/ActionCallImpl.java b/src/main/java/com/iqudoo/framework/tape/spring/impl/ActionCallImpl.java new file mode 100644 index 0000000..f263a4d --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/impl/ActionCallImpl.java @@ -0,0 +1,377 @@ +package com.iqudoo.framework.tape.spring.impl; + +import com.alibaba.fastjson.JSONObject; +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.base.action.bean.*; +import com.iqudoo.framework.tape.base.action.handler.ActionHandler; +import com.iqudoo.framework.tape.base.action.interfaces.IActionCall; +import com.iqudoo.framework.tape.base.action.interfaces.IActionDiscover; +import com.iqudoo.framework.tape.base.action.interfaces.IActionToken; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.framework.tape.modules.utils.ArrayUtil; +import com.iqudoo.framework.tape.modules.utils.JsonUtil; +import com.iqudoo.framework.tape.service.IInterceptorService; +import com.iqudoo.framework.tape.service.ITokenService; +import com.iqudoo.framework.tape.spring.conf.TapeConfig; +import org.slf4j.Logger; +import org.springframework.dao.DuplicateKeyException; +import org.springframework.dao.NonTransientDataAccessException; +import org.springframework.stereotype.Component; + +import java.lang.reflect.Type; +import java.sql.SQLException; +import java.util.Date; +import java.util.concurrent.atomic.AtomicInteger; + +@Component +public class ActionCallImpl implements IActionCall { + + + private static final Logger LOGGER = Tape.getLogger(ActionCallImpl.class); + + private final AtomicInteger curRequestCount = new AtomicInteger(0); + + /** + * 请求服务 + * + * @param servletRequest HTTP请求体 + * @param actionParameter 请求参数 + * @return 请求响应 + */ + @Override + @SuppressWarnings("unchecked") + public Object call(ActionParameter actionParameter, ActionServletRequest servletRequest, + ActionServletResponse servletResponse) { + if (actionParameter == null) { + ActionResponse response = new ActionResponse<>(); + response.setCode(ActionState.INVALID_ACTION.getCode()); + response.setMsg(ActionState.INVALID_ACTION.getMsg()); + response.setTimestamp(new Date().getTime()); + response.setUseTime(0L); + return response; + } + int retryCount = 0; + long beginTime = new Date().getTime(); + ActionRequest request = new ActionRequest(actionParameter, servletRequest); + IInterceptorService interceptorService = null; + try { + interceptorService = Tape.getService(IInterceptorService.class); + } catch (Throwable ignored) { + } + ActionParam actionParam = null; + ActionHandler handler = null; + try { + Object data = null; + handler = Tape.getService(IActionDiscover.class) + .getActionHandlerByAction(actionParameter.getAction()); + request.setTimestamp(new Date().getTime()); + T paramsBody = null; + if (handler == null) { + throw ActionState.INVALID_ACTION; + } else { + handler.setActionRequest(request); + handler.setActionServletResponse(servletResponse); + Type type = handler.getParamType(); + if (actionParameter.getParams() != null) { + if (type == JSONObject.class) { + try { + paramsBody = (T) actionParameter.getParams(); + } catch (Throwable ignored) { + } + } else if (type == String.class) { + try { + paramsBody = (T) actionParameter.getParams().toJSONString(); + } catch (Throwable ignored) { + } + } else if (type != Void.class) { + try { + String jsonData = actionParameter.getParams().toJSONString(); + paramsBody = JsonUtil.toBeanObject(jsonData, handler.getParamType()); + } catch (Throwable ignored) { + } + if (paramsBody == null) { + throw ActionState.INVALID_PARAMS; + } + } + } + if (paramsBody instanceof ActionParam) { + actionParam = (ActionParam) paramsBody; + } else { + actionParam = new ActionParam(); + } + if (handler.isMockData()) { + data = handler.onMockRequest(paramsBody); + } else { + String token = request.getActionParameter().getToken(); + if (token == null || token.length() <= 0) { + token = request.getReqHeader("x-token"); + } + if (token == null || token.length() <= 0) { + token = request.getReqParam("token"); + } + if (token == null || token.length() <= 0) { + String authorizationValue = request.getReqHeader("authorization"); + if (authorizationValue != null) { + String[] authorizationValues = authorizationValue.split(" "); + token = authorizationValues[authorizationValues.length - 1]; + } + } + if (token != null && !token.isEmpty()) { + try { + ActionAuthInfo actionAuthInfo = Tape.getService(IActionToken.class).parseToken(token); + if (actionAuthInfo != null && ArrayUtil.in(handler.getGroups(), actionAuthInfo.getUserGroup())) { + request.setAuthInfo(actionAuthInfo); + } + } catch (Throwable throwable) { + request.setAuthError(throwable); + } + } + actionParam.setActionHandler(handler); + actionParam.setActionRequest(request); + if (request.getAuthInfo() != null) { + actionParam.setActionAuthInfo(request.getAuthInfo()); + } + if (interceptorService != null) { + interceptorService.onInterceptBefore(handler, request, actionParam); + } + boolean callEnd = false; + while (!callEnd) { + try { + handler.getActionRequest().setRetryIndex(retryCount); + try { + if (!handler.isIgnoreLimit()) { + // 全局接口限流处理 + int requestSize = curRequestCount.incrementAndGet(); + TapeConfig tapeConfig = Tape.getService(TapeConfig.class); + if (tapeConfig.getReqLimit() > 0 && requestSize > tapeConfig.getReqLimit()) { + // 命中限流,支持重试(如果接口配置了重试次数) + throw new ActionStateCanRetry(ActionState.REQUEST_LIMIT.getCode(), + ActionState.REQUEST_LIMIT.getMessage()); + } + } + handler.onPreValidateRequest(paramsBody); + try { + if (request.getAuthInfo() == null) { + if (request.getAuthError() != null) { + throw request.getAuthError(); + } + throw Tape.getService(IActionToken.class).getAuthError(); + } + Tape.getService(ITokenService.class) + .checkUserPermission(request.getAuthInfo(), actionParam); + } catch (Throwable throwable) { + if (!handler.isIgnoreAuth()) { + throw throwable; + } + } + handler.onValidateRequest(paramsBody); + data = parseProtoData(handler.onHandleRequest(paramsBody)); + } finally { + if (!handler.isIgnoreLimit()) { + curRequestCount.decrementAndGet(); + } + } + callEnd = true; + } catch (Throwable throwable) { + if (throwable instanceof ActionStateCanRetry + && retryCount < handler.getFailRetry()) { + retryCount++; + } else { + if (throwable instanceof ActionStateCanRetry) { + if (handler.getFailRetryErrorMsg() != null + && !handler.getFailRetryErrorMsg().isEmpty()) { + throw new ActionState(ActionState.REQUEST_TOO_MANY_FAIL.getCode(), + handler.getFailRetryErrorMsg(), throwable); + } else { + throw new ActionState(ActionState.REQUEST_TOO_MANY_FAIL.getCode(), + ActionState.REQUEST_TOO_MANY_FAIL.getMessage(), throwable); + } + } + throw throwable; + } + } + } + } + } + ActionResponse response = new ActionResponse<>(); + response.setMsg(ActionState.SUCCESS.getMsg()); + response.setCode(ActionState.SUCCESS.getCode()); + response.setData(data); + response.setTimestamp(new Date().getTime()); + response.setAction(actionParameter.getAction()); + response.setTransId(actionParameter.getTransId()); + response.setNodeId(Tape.getNodeId()); + response.setRetryCount(retryCount); + response.setUseTime(new Date().getTime() - beginTime); + if (interceptorService != null) { + interceptorService.onInterceptAfter(handler, request, actionParam, response); + } + if (handler.isRawData()) { + return response.getData(); + } + return response; + } catch (Throwable throwable) { + try { + if (handler != null && interceptorService != null) { + interceptorService.onInterceptError(handler, request, + actionParam, throwable); + } + } catch (Throwable ignored) { + } + // 包装响应 + ActionResponse response = handleError(request, throwable); + response.setRetryCount(retryCount); + // 打印日志 + if (!(throwable instanceof ActionState) + && !(throwable instanceof IllegalArgumentException)) { + failureLog(actionParameter, response, throwable); + } + return response; + } + } + + private void failureLog(ActionParameter actionParameter, ActionResponse response, Throwable throwable) { + LOGGER.error("==========================================================="); + if (actionParameter != null) { + try { + LOGGER.error("action: {}", actionParameter.getAction()); + } catch (Throwable ignored) { + } + try { + LOGGER.error(" |__> parameter: {}", JsonUtil.toJSONString(actionParameter)); + } catch (Throwable ignored) { + } + } + if (response != null) { + try { + LOGGER.error(" |__> response: {}", JsonUtil.toJSONString(response)); + } catch (Throwable ignored) { + } + } + LOGGER.error(" |__> error: ", throwable); + } + + private Object parseProtoData(Object data) throws Throwable { + if (data instanceof Proto responseData) { + if (responseData.isSuccess()) { + return responseData.getData(); + } else { + if (responseData.getErr() instanceof ActionStateCanRetry) { + throw responseData.getErr(); + } + throw responseData.getErr(); + } + } + return data; + } + + /** + * 处理错误信息 + * + * @param request 请求参数 + * @param throwable 异常信息 + */ + private ActionResponse handleError(ActionRequest request, Throwable throwable) { + try { + ActionResponse response = new ActionResponse<>(); + response.setTimestamp(new Date().getTime()); + response.setNodeId(Tape.getNodeId()); + response.setCode(parseResponseCode(throwable)); + response.setMsg(parseResponseMessage(throwable)); + // request info + if (request != null) { + response.setAction(request.getActionParameter().getAction()); + response.setTransId(request.getActionParameter().getTransId()); + response.setUseTime(new Date().getTime() - request.getTimestamp()); + } + return response; + } catch (Throwable e) { + ActionResponse httpResponse = new ActionResponse<>(); + httpResponse.setCode(ActionState.UNKNOWN_ERROR.getCode()); + httpResponse.setMsg(ActionState.UNKNOWN_ERROR.getMsg()); + httpResponse.setTimestamp(new Date().getTime()); + return httpResponse; + } + } + + /** + * 解析错误码 + * + * @param throwable 错误信息 + */ + private int parseResponseCode(Throwable throwable) { + int respCode; + if (throwable instanceof IllegalArgumentException) { + respCode = ActionState.INVALID_PARAMS.getCode(); + } else if (throwable instanceof NullPointerException) { + return ActionState.NULL_POINTER_ERROR.getCode(); + } else if (throwable instanceof DuplicateKeyException) { + return ActionState.DATABASE_RECORD_EXISTS.getCode(); + } else if ((throwable instanceof SQLException) + || (throwable instanceof NonTransientDataAccessException)) { + return ActionState.DATABASE_SQL_ERROR.getCode(); + } else if (throwable instanceof ActionState) { + respCode = ((ActionState) throwable).getCode(); + } else { + respCode = ActionState.UNKNOWN_ERROR.getCode(); + } + return respCode; + } + + /** + * 解析错误码说明 + * + * @param throwable 错误信息 + */ + private String parseResponseMessage(Throwable throwable) { + String respMsg; + if (throwable instanceof ActionState) { + respMsg = ((ActionState) throwable).getMsg(); + } else if (throwable instanceof IllegalArgumentException) { + respMsg = throwable.getMessage(); + if (respMsg == null || respMsg.length() <= 0) { + respMsg = ActionState.INVALID_PARAMS.getMsg(); + } + } else if (throwable instanceof NullPointerException) { + respMsg = ActionState.NULL_POINTER_ERROR.getMsg(); + } else if (throwable instanceof DuplicateKeyException) { + respMsg = ActionState.DATABASE_RECORD_EXISTS.getMsg(); + String duplicateKey = parseDuplicateKey(throwable.getMessage()); + if (duplicateKey != null && !duplicateKey.isEmpty()) { + respMsg += ": " + duplicateKey; + } + } else if ((throwable instanceof SQLException) + || (throwable instanceof NonTransientDataAccessException)) { + respMsg = ActionState.DATABASE_SQL_ERROR.getMsg(); + } else if (throwable instanceof RuntimeException) { + respMsg = throwable.getMessage(); + } else { + respMsg = ActionState.UNKNOWN_ERROR.getMsg(); + } + return respMsg; + } + + + private String parseDuplicateKey(String errorMessage) { + // 提取重复的值 + try { + String errorMsg = ""; + String duplicateValue = errorMessage.substring( + errorMessage.indexOf("'") + 1, + errorMessage.indexOf("' for key") + ); + // 提取唯一键约束名 + String uniqueKey = errorMessage.substring( + errorMessage.lastIndexOf(".") + 1, + errorMessage.lastIndexOf("'") + ); + if (!uniqueKey.isEmpty()) { + errorMsg += "字段[" + uniqueKey + "]对应的值"; + } + return errorMsg + "[" + duplicateValue + "]在数据库中已存在"; + } catch (Exception ignored) { + } + return null; + } + +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/framework/tape/spring/impl/ActionDiscoverImpl.java b/src/main/java/com/iqudoo/framework/tape/spring/impl/ActionDiscoverImpl.java new file mode 100644 index 0000000..98068c3 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/impl/ActionDiscoverImpl.java @@ -0,0 +1,164 @@ +package com.iqudoo.framework.tape.spring.impl; + +import com.iqudoo.framework.tape.base.action.annotation.ActionConfig; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.annotation.ActionRetry; +import com.iqudoo.framework.tape.base.action.bean.ActionDocInfo; +import com.iqudoo.framework.tape.base.action.handler.ActionHandler; +import com.iqudoo.framework.tape.base.action.interfaces.IActionDiscover; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.modules.utils.ArrayUtil; +import com.iqudoo.framework.tape.modules.utils.DigestUtil; +import com.iqudoo.framework.tape.spring.RunnerApplication; +import com.iqudoo.framework.tape.spring.RunnerContext; +import org.springframework.stereotype.Component; + +import java.util.*; +import java.util.concurrent.atomic.AtomicReference; + +@Component +@SuppressWarnings({"unchecked", "PatternVariableCanBeUsed"}) +public class ActionDiscoverImpl implements IActionDiscover { + + private final AtomicReference>> mActionHandles = new AtomicReference<>(); + private final Map> mActionMaps = new HashMap<>(); + + @Override + public List> getHandlerList() { + if (mActionHandles.get() != null) { + return mActionHandles.get(); + } + List> handlerList = new ArrayList<>(); + List> classList = RunnerApplication.getClassList(); + if (classList != null && !classList.isEmpty()) { + for (Class clazz : classList) { + ActionMapping actionMapping = clazz.getAnnotation(ActionMapping.class); + if (actionMapping != null) { + Object object = RunnerContext.getBean(clazz); + if (object instanceof ActionHandler) { + ActionHandler handler = (ActionHandler) object; + String currentActive = RunnerContext.getActiveProfile(); + String[] actives = actionMapping.actives(); + if (actives.length == 0 || ArrayUtil.in(actives, currentActive)) { + if (clazz.isAnnotationPresent(ApiDocActionConfiguration.class)) { + ActionDocInfo actionDocInfo = new ActionDocInfo(); + ApiDocActionConfiguration apiDocActionConfiguration = clazz.getAnnotation(ApiDocActionConfiguration.class); + actionDocInfo.setApiDocId(DigestUtil.md5DigestAsHex(String.join(",", actionMapping.action()))); + actionDocInfo.setApiDocActions(actionMapping.action()); + Class[] docResponse = apiDocActionConfiguration.response(); + if (docResponse.length == 1) { + actionDocInfo.setApiDocResponseClass(docResponse[0]); + actionDocInfo.setApiDocResponseParametricTypes(new Class[]{}); + } else { + Class[] parametricTypes = new Class[docResponse.length - 1]; + System.arraycopy(docResponse, 1, parametricTypes, + 0, docResponse.length - 1); + actionDocInfo.setApiDocResponseClass(docResponse[0]); + actionDocInfo.setApiDocResponseParametricTypes(parametricTypes); + } + handler.setActionDocInfo(actionDocInfo); + } + if (clazz.isAnnotationPresent(ActionRetry.class)) { + ActionRetry retry = clazz.getAnnotation(ActionRetry.class); + handler.setFailRetry(retry.failRetry()); + handler.setFailRetryErrorMsg(retry.failRetryErrorMsg()); + } + if (clazz.isAnnotationPresent(ActionConfig.class)) { + ActionConfig configuration = clazz.getAnnotation(ActionConfig.class); + boolean forceAuth = !configuration.ignoreAuth() && configuration.group().length > 0; + handler.setTag(configuration.tag()); + handler.setGroups(configuration.group()); + handler.setScenes(configuration.scene()); + handler.setRawData(configuration.isRaw()); + handler.setMockData(configuration.isMock()); + handler.setIgnoreLimit(configuration.ignoreLimit()); + handler.setIgnoreAuth(!forceAuth); + } else { + handler.setRawData(false); + handler.setMockData(false); + handler.setIgnoreLimit(false); + handler.setIgnoreAuth(true); + } + handler.setSort(actionMapping.sort()); + handler.setActions(actionMapping.action()); + handlerList.add(handler); + } + } + } + } + } + handlerList.sort(new Comparator>() { + @Override + public int compare(ActionHandler o1, ActionHandler o2) { + try { + return o2.getSort() - o1.getSort(); + } catch (Throwable ignored) { + } + return 0; + } + }); + if (!handlerList.isEmpty()) { + mActionHandles.set(handlerList); + } + return handlerList; + } + + @Override + public ActionHandler getActionHandlerByAction(String action) { + try { + if (mActionMaps.containsKey(action)) { + return (ActionHandler) mActionMaps.get(action); + } else { + List> handlerList = new ArrayList<>(); + List> allHandlers = getHandlerList(); + for (ActionHandler item : allHandlers) { + if (ArrayUtil.in(item.getActions(), action)) { + handlerList.add(item); + } + } + ActionHandler handler = (ActionHandler) getFirstActionHandler(handlerList); + if (handler != null) { + mActionMaps.put(action, handler); + return handler; + } + } + } catch (Throwable ignored) { + } + return null; + } + + @Override + public ActionHandler getActionHandlerByApiDocId(String apiDocId) { + try { + List> handlerList = new ArrayList<>(); + List> allHandlers = getHandlerList(); + for (ActionHandler item : allHandlers) { + if (item.getActionDocInfo() != null + && Objects.equals(item.getActionDocInfo().getApiDocId(), + apiDocId)) { + handlerList.add(item); + } + } + return (ActionHandler) getFirstActionHandler(handlerList); + } catch (Throwable ignored) { + } + return null; + } + + private ActionHandler getFirstActionHandler(List> handlerList) { + ActionHandler handler = null; + if (!handlerList.isEmpty()) { + handlerList.sort(new Comparator>() { + @Override + public int compare(ActionHandler o1, ActionHandler o2) { + return o2.getSort() - o1.getSort(); + } + }); + if (!handlerList.isEmpty()) { + handler = handlerList.get(0); + } + } + return handler; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/spring/impl/ActionDispatchImpl.java b/src/main/java/com/iqudoo/framework/tape/spring/impl/ActionDispatchImpl.java new file mode 100644 index 0000000..dac156d --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/impl/ActionDispatchImpl.java @@ -0,0 +1,109 @@ +package com.iqudoo.framework.tape.spring.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.base.action.bean.ActionParameter; +import com.iqudoo.framework.tape.base.action.bean.ActionResponse; +import com.iqudoo.framework.tape.base.action.bean.ActionServletRequest; +import com.iqudoo.framework.tape.base.action.bean.ActionServletResponse; +import com.iqudoo.framework.tape.base.action.interfaces.IActionCall; +import com.iqudoo.framework.tape.base.action.interfaces.IActionDispatch; +import com.iqudoo.framework.tape.modules.utils.JsonUtil; +import org.springframework.stereotype.Component; + +import javax.servlet.http.HttpServletResponse; +import java.util.Map; +import java.util.UUID; + +@SuppressWarnings("UastIncorrectHttpHeaderInspection") +@Component +public class ActionDispatchImpl implements IActionDispatch { + + private String getValue(JSONObject paramBody, String key) { + try { + if (paramBody.containsKey(key)) { + return paramBody.getString(key); + } + } catch (Throwable ignored) { + } + return null; + } + + @Override + public Object doRequest(JSONObject requestBody, + Map queryData, + ActionServletRequest servletRequest, + ActionServletResponse servletResponse) throws Throwable { + ActionParameter actionParameter = new ActionParameter(); + JSONObject reqParams = requestBody; + if (reqParams == null) { + reqParams = new JSONObject(); + } + if (queryData.size() > 0) { + JSONObject reqQuery = null; + try { + reqQuery = new JSONObject(); + reqQuery.putAll(queryData); + } catch (Throwable ignored) { + } + if (reqQuery != null) { + reqParams = JsonUtil.mergedJson(reqParams, reqQuery); + } + } + if (requestBody != null + && requestBody.containsKey("params") + && requestBody.get("params") != null) { + JSONObject bodyParams = null; + try { + bodyParams = requestBody.getJSONObject("params"); + } catch (Throwable ignored) { + } + if (bodyParams != null) { + reqParams = JsonUtil.mergedJson(reqParams, bodyParams); + } + } + if (queryData.containsKey("params") + && queryData.get("params") != null) { + JSONObject queryParams = null; + try { + queryParams = JSON.parseObject(queryData.get("params")); + } catch (Throwable ignored) { + } + if (queryParams != null) { + reqParams = JsonUtil.mergedJson(reqParams, queryParams); + } + } + if (reqParams.containsKey("__extras__")) { + JSONObject reqExtras = null; + try { + reqExtras = reqParams.getJSONObject("__extras__"); + } catch (Throwable ignored) { + } + if (reqExtras != null) { + reqParams = JsonUtil.mergedJson(reqParams, reqExtras); + } + } + reqParams.remove("params"); + reqParams.remove("__extras__"); + actionParameter.setParams(reqParams); + actionParameter.setTransId(getValue(reqParams, "transId")); + actionParameter.setPlatform(getValue(reqParams, "platform")); + actionParameter.setAction(getValue(reqParams, "action")); + actionParameter.setToken(getValue(reqParams, "token")); + if (actionParameter.getTransId() == null) { + actionParameter.setTransId(UUID.randomUUID().toString()); + } + HttpServletResponse httpServletResponse = servletResponse.getServletResponse(); + httpServletResponse.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); + Object object = Tape.getService(IActionCall.class) + .call(actionParameter, servletRequest, servletResponse); + if (object instanceof ActionResponse) { + httpServletResponse.setHeader("Content-Disposition", null); + httpServletResponse.setContentType("application/json"); + httpServletResponse.setCharacterEncoding("utf-8"); + } + return object; + } + +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/framework/tape/spring/impl/ActionTokenImpl.java b/src/main/java/com/iqudoo/framework/tape/spring/impl/ActionTokenImpl.java new file mode 100644 index 0000000..57cd939 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/impl/ActionTokenImpl.java @@ -0,0 +1,42 @@ +package com.iqudoo.framework.tape.spring.impl; + +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.base.action.bean.ActionAuthInfo; +import com.iqudoo.framework.tape.base.action.bean.ActionState; +import com.iqudoo.framework.tape.base.action.bean.ActionTokenInfo; +import com.iqudoo.framework.tape.base.action.interfaces.IActionToken; +import com.iqudoo.framework.tape.service.ITokenService; +import org.springframework.stereotype.Component; + +@Component +public class ActionTokenImpl implements IActionToken { + + @Override + public ActionTokenInfo createToken(ActionAuthInfo actionAuthInfo) throws Throwable { + ITokenService tokenService = Tape.getService(ITokenService.class); + return tokenService.createToken(actionAuthInfo); + } + + @Override + public ActionTokenInfo refreshToken(String refreshToken) throws Throwable { + ITokenService tokenService = Tape.getService(ITokenService.class); + return tokenService.refreshToken(refreshToken); + } + + @Override + public ActionAuthInfo parseToken(String token) throws Throwable { + ITokenService tokenService = Tape.getService(ITokenService.class); + return tokenService.parseToken(token); + } + + @Override + public Throwable getAuthError() { + try { + ITokenService tokenService = Tape.getService(ITokenService.class); + return tokenService.getAuthError(); + } catch (Throwable throwable) { + return ActionState.UN_AUTHORIZED; + } + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/spring/impl/ModuleAsyncImpl.java b/src/main/java/com/iqudoo/framework/tape/spring/impl/ModuleAsyncImpl.java new file mode 100644 index 0000000..d1a468f --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/impl/ModuleAsyncImpl.java @@ -0,0 +1,101 @@ +package com.iqudoo.framework.tape.spring.impl; + +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.modules.IModuleAsync; +import com.iqudoo.framework.tape.modules.async.AsyncHandler; +import com.iqudoo.framework.tape.modules.async.AsyncScheduler; +import org.slf4j.Logger; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.List; + +@Component +public class ModuleAsyncImpl implements IModuleAsync { + + + private static final Logger LOGGER = Tape.getLogger(ModuleAsyncImpl.class); + + @Override + public void doAsyncTask(T params, AsyncHandler asyncHandler) throws Throwable { + ThreadPoolTaskExecutor taskExecutor = asyncHandler.taskExecutor(); + taskExecutor.execute(new Runnable() { + @Override + public void run() { + List taskData = new ArrayList<>(); + try { + int pollCount = taskExecutor.getMaxPoolSize() + - taskExecutor.getActiveCount(); + if (pollCount <= 0) { + return; + } + taskData = asyncHandler.loadTasks(params, pollCount); + } catch (Throwable throwable) { + LOGGER.error("async task [loadTasks] failure: {}", throwable.getMessage()); + } + if (taskData != null && !taskData.isEmpty()) { + try { + for (D data : taskData) { + TaskRunner taskRunner = new TaskRunner<>(data, params, asyncHandler); + taskExecutor.execute(taskRunner); + } + } catch (Throwable throwable) { + LOGGER.error("async task [execute] failure", throwable); + } + } + try { + if (asyncHandler.sleepTime() > 0) { + Thread.sleep(asyncHandler.sleepTime()); + } else { + Thread.sleep(20); + } + } catch (Throwable ignored) { + } + } + }); + } + + @Override + public void doScheduleTask(AsyncScheduler asyncScheduler) throws Throwable { + ThreadPoolTaskExecutor taskExecutor = asyncScheduler.taskExecutor(); + taskExecutor.execute(new Runnable() { + @Override + public void run() { + try { + asyncScheduler.scheduleTask(); + } catch (Throwable throwable) { + LOGGER.error("async task [scheduleTask] failure", throwable); + } + } + }); + } + + private static class TaskRunner implements Runnable { + + private final AsyncHandler asyncHandler; + private final T params; + private final D data; + + public TaskRunner(D data, T params, AsyncHandler asyncHandler) { + this.params = params; + this.data = data; + this.asyncHandler = asyncHandler; + } + + @Override + public void run() { + try { + asyncHandler.doExecute(data); + } catch (Throwable throwable) { + LOGGER.error("execute async task[doExecute] failure", throwable); + } + try { + asyncHandler.onComplete(params); + } catch (Throwable throwable) { + LOGGER.error("execute async task[onComplete] failure", throwable); + } + } + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/spring/impl/ModuleCacheImpl.java b/src/main/java/com/iqudoo/framework/tape/spring/impl/ModuleCacheImpl.java new file mode 100644 index 0000000..0f5079c --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/impl/ModuleCacheImpl.java @@ -0,0 +1,98 @@ +package com.iqudoo.framework.tape.spring.impl; + +import com.fasterxml.jackson.databind.JavaType; +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.modules.IModuleCache; +import com.iqudoo.framework.tape.modules.cache.Cache; +import com.iqudoo.framework.tape.modules.cache.CacheKey; +import com.iqudoo.framework.tape.modules.cache.CacheLoader; +import com.iqudoo.framework.tape.modules.utils.JsonUtil; +import com.iqudoo.framework.tape.service.ICacheService; +import org.springframework.stereotype.Component; + +@Component +public class ModuleCacheImpl implements IModuleCache { + + @Override + public void setCacheData(CacheKey key, Object value) throws Throwable { + ICacheService tempService = Tape.getService(ICacheService.class); + tempService.setCache(key, JsonUtil.toJSONString(value)); + } + + /** + * 从缓存中获取数据 + * + * @param key 缓存KEY + * @param params 数据参数 + * @param cacheLoader 缓存数据处理器 + */ + @Override + public D getCacheData(CacheKey key, T params, CacheLoader cacheLoader) throws Throwable { + Cache cacheWarp = new Cache<>(new Cache.GetterCacheProxy() { + @Override + public boolean has(CacheKey cacheKey) throws Throwable { + ICacheService tempService = Tape.getService(ICacheService.class); + return tempService.hasCache(cacheKey); + } + + @Override + public D onGet(CacheKey cacheKey, JavaType resultType) throws Throwable { + ICacheService tempService = Tape.getService(ICacheService.class); + String value = tempService.getCache(cacheKey); + if (value == null) { + throw new Throwable("Not found cache value: " + cacheKey.getCacheKey()); + } + return JsonUtil.toBeanObject(value, resultType); + } + + }, new Cache.SetterCacheProxy() { + @Override + public void onSet(CacheKey cacheKey, D newValue, T params) throws Throwable { + ICacheService tempService = Tape.getService(ICacheService.class); + tempService.setCache(cacheKey, JsonUtil.toJSONString(newValue)); + } + }, new CacheLoader() { + + @Override + public JavaType getType() { + if (cacheLoader != null) { + return cacheLoader.getType(); + } + return super.getType(); + } + + @Override + public D onLoad(CacheKey cacheKey, T params) throws Throwable { + if (cacheLoader != null) { + return cacheLoader.onLoad(cacheKey, params); + } + return null; + } + }); + return cacheWarp.readData(key, params); + } + + /** + * 通过缓存KEY移除缓存的数据 + * + * @param key 缓存key + */ + @Override + public void removeCacheData(CacheKey key) throws Throwable { + ICacheService tempService = Tape.getService(ICacheService.class); + tempService.removeCache(key); + } + + @Override + public void removeCacheDataByPrefix(String prefix) throws Throwable { + ICacheService tempService = Tape.getService(ICacheService.class); + tempService.removeCacheByPrefix(prefix); + } + + @Override + public void clearCache() throws Throwable { + ICacheService tempService = Tape.getService(ICacheService.class); + tempService.clearCache(); + } + +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/framework/tape/spring/impl/ModuleCrawlerImpl.java b/src/main/java/com/iqudoo/framework/tape/spring/impl/ModuleCrawlerImpl.java new file mode 100644 index 0000000..ab12ef3 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/impl/ModuleCrawlerImpl.java @@ -0,0 +1,69 @@ +package com.iqudoo.framework.tape.spring.impl; + +import com.fasterxml.jackson.databind.JavaType; +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.modules.IModuleCrawler; +import com.iqudoo.framework.tape.modules.crawler.Crawler; +import com.iqudoo.framework.tape.modules.crawler.CrawlerKey; +import com.iqudoo.framework.tape.modules.crawler.CrawlerLoader; +import com.iqudoo.framework.tape.modules.utils.JsonUtil; +import com.iqudoo.framework.tape.service.ICrawlerService; +import org.springframework.stereotype.Component; + +@Component +public class ModuleCrawlerImpl implements IModuleCrawler { + + /** + * 从缓存中获取数据 + * + * @param crawlerKey 爬虫KEY + * @param params 数据参数 + * @param crawlerLoader 缓存数据处理器 + */ + @Override + public D getCrawlerData(CrawlerKey crawlerKey, T params, CrawlerLoader crawlerLoader) throws Throwable { + Crawler crawlerWarp = new Crawler<>(new Crawler.GetterCrawlerProxy() { + @Override + public boolean has(CrawlerKey crawlerKey) throws Throwable { + ICrawlerService tempService = Tape.getService(ICrawlerService.class); + return tempService.hasCrawler(crawlerKey); + } + + @Override + public D onGet(CrawlerKey crawlerKey, JavaType resultType) throws Throwable { + ICrawlerService tempService = Tape.getService(ICrawlerService.class); + String value = tempService.getCrawler(crawlerKey); + if (value == null) { + throw new Throwable("Not found crawler cache data: " + crawlerKey); + } + return JsonUtil.toBeanObject(value, resultType); + } + + }, new Crawler.SetterCrawlerProxy() { + @Override + public void onSet(CrawlerKey crawlerKey, D newValue, T params) throws Throwable { + ICrawlerService tempService = Tape.getService(ICrawlerService.class); + tempService.saveCrawler(crawlerKey, JsonUtil.toJSONString(newValue)); + } + }, new CrawlerLoader() { + + @Override + public JavaType getJavaType() { + if (crawlerLoader != null) { + return crawlerLoader.getJavaType(); + } + return super.getJavaType(); + } + + @Override + public D onLoad(CrawlerKey crawlerKey, T params) throws Throwable { + if (crawlerLoader != null) { + return crawlerLoader.onLoad(crawlerKey, params); + } + return null; + } + }); + return crawlerWarp.readData(crawlerKey, params); + } + +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/framework/tape/spring/impl/ModuleFactoryImpl.java b/src/main/java/com/iqudoo/framework/tape/spring/impl/ModuleFactoryImpl.java new file mode 100644 index 0000000..86e4338 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/impl/ModuleFactoryImpl.java @@ -0,0 +1,150 @@ +package com.iqudoo.framework.tape.spring.impl; + +import com.iqudoo.framework.tape.base.action.bean.ActionState; +import com.iqudoo.framework.tape.modules.IModuleFactory; +import com.iqudoo.framework.tape.modules.annotation.FactoryMapping; +import com.iqudoo.framework.tape.modules.utils.ArrayUtil; +import com.iqudoo.framework.tape.spring.RunnerApplication; +import com.iqudoo.framework.tape.spring.RunnerContext; +import org.springframework.stereotype.Component; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@SuppressWarnings("unchecked") +@Component +public class ModuleFactoryImpl implements IModuleFactory { + + private final Map> mInfo = new HashMap<>(); + private final Map> mFactory = new HashMap<>(); + + public void autoRegisterFactory(Class factoryClass) { + List> classList = RunnerApplication.getClassList(); + if (classList != null && classList.size() > 0) { + for (Class clazz : classList) { + FactoryMapping factoryMapping = clazz.getAnnotation(FactoryMapping.class); + if (factoryMapping != null) { + String currentActive = RunnerContext.getActiveProfile(); + String[] actives = factoryMapping.actives(); + if ((actives.length == 0 || ArrayUtil.in(actives, currentActive)) + && factoryClass.isAssignableFrom(clazz)) { + Object object = RunnerContext.getBean(clazz); + register(object, factoryClass, factoryMapping.name(), + factoryMapping.description()); + } + } + } + } + } + + @Override + public void register(Object object, Class factoryClass, String name, String description) { + String factoryName = factoryClass.getName(); + // info + FactoryInfo factoryInfo = new FactoryInfo(); + factoryInfo.setName(name); + factoryInfo.setDescription(description); + factoryInfo.setFactoryClass(factoryClass); + if (mInfo.containsKey(factoryName)) { + mInfo.get(factoryName).put(name, factoryInfo); + } else { + Map factoryInfoMap = new HashMap<>(); + factoryInfoMap.put(name, factoryInfo); + mInfo.put(factoryName, factoryInfoMap); + } + // factory + if (mFactory.containsKey(factoryName)) { + mFactory.get(factoryName).put(name, object); + } else { + Map map = new HashMap<>(); + map.put(name, object); + mFactory.put(factoryName, map); + } + } + + @Override + public T get(Class factoryClass, String name) throws Throwable { + String factoryName = factoryClass.getName(); + if (!mFactory.containsKey(factoryName) + || !mFactory.get(factoryName).containsKey(name)) { + autoRegisterFactory(factoryClass); + } + if (mFactory.containsKey(factoryName) + && mFactory.get(factoryName).containsKey(name)) { + return (T) mFactory.get(factoryName).get(name); + } + throw new ActionState("找不到\"" + name + "\"模块的实现"); + } + + @Override + public boolean has(Class factoryClass, String name) throws Throwable { + String factoryName = factoryClass.getName(); + if (!mFactory.containsKey(factoryName) + || !mFactory.get(factoryName).containsKey(name)) { + autoRegisterFactory(factoryClass); + } + return mFactory.containsKey(factoryName) + && mFactory.get(factoryName).containsKey(name); + } + + @Override + public List getList(Class factoryClass) throws Throwable { + String factoryName = factoryClass.getName(); + if (!mFactory.containsKey(factoryName)) { + autoRegisterFactory(factoryClass); + } + List objList = new ArrayList<>(); + Map objectMap = mFactory.get(factoryName); + if (objectMap != null) { + for (Object obj : objectMap.values()) { + objList.add((T) obj); + } + } + return objList; + } + + @Override + public String getName(Class factoryClass, Object factoryObject) throws Throwable { + String factoryName = factoryClass.getName(); + if (!mFactory.containsKey(factoryName)) { + autoRegisterFactory(factoryClass); + } + Map objectMap = mFactory.get(factoryName); + for (Map.Entry entry : objectMap.entrySet()) { + if (entry.getValue() != null + && entry.getValue().equals(factoryObject)) { + return entry.getKey(); + } + } + return null; + } + + @Override + public List getNameList(Class factoryClass) throws Throwable { + String factoryName = factoryClass.getName(); + if (!mFactory.containsKey(factoryName)) { + autoRegisterFactory(factoryClass); + } + if (!mFactory.containsKey(factoryName)) { + return new ArrayList<>(); + } + return new ArrayList<>(mFactory.get(factoryName).keySet()); + } + + @Override + public FactoryInfo getFactoryInfo(Class factoryClass, String name) throws Throwable { + String factoryName = factoryClass.getName(); + if (!mInfo.containsKey(factoryName) + || !mInfo.get(factoryName).containsKey(name)) { + autoRegisterFactory(factoryClass); + } + if (mInfo.containsKey(factoryName) + && mInfo.get(factoryName).containsKey(name)) { + return mInfo.get(factoryName).get(name); + } + return null; + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/spring/impl/ModuleLockImpl.java b/src/main/java/com/iqudoo/framework/tape/spring/impl/ModuleLockImpl.java new file mode 100644 index 0000000..ea8c00b --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/impl/ModuleLockImpl.java @@ -0,0 +1,53 @@ +package com.iqudoo.framework.tape.spring.impl; + +import com.iqudoo.framework.tape.base.action.bean.ActionState; +import com.iqudoo.framework.tape.modules.IModuleLock; +import org.springframework.stereotype.Component; + +import java.util.Date; +import java.util.HashMap; +import java.util.Map; + +@Component +public class ModuleLockImpl implements IModuleLock { + + private static final Map LOCK_MAP = new HashMap<>(); + + @Override + public void lock(String key) throws Throwable { + lock(key, 0, null); + } + + @Override + public void lock(String key, long timeoutMs) throws Throwable { + lock(key, timeoutMs, null); + } + + @Override + public void lock(String key, long timeoutMs, Throwable throwable) throws Throwable { + if (key == null || key.isEmpty()) { + throw new ActionState("The lock key cannot be empty"); + } + if (key.length() > 128) { + throw new ActionState("The lock key length cannot exceed 128 bytes"); + } + Long exTime = LOCK_MAP.get("LOCK_" + key); + if (exTime != null) { + boolean isEx = exTime > 0 && exTime <= new Date().getTime(); + if (!isEx) { + if (throwable != null) { + throw throwable; + } + throw ActionState.getRequestToFrequentError(); + } + } + LOCK_MAP.put("LOCK_" + key, timeoutMs > 0 ? new Date().getTime() + timeoutMs : 0); + } + + + @Override + public void unlock(String key) throws Throwable { + LOCK_MAP.remove(key); + } + +} diff --git a/src/main/java/com/iqudoo/framework/tape/spring/impl/ModuleSessionImpl.java b/src/main/java/com/iqudoo/framework/tape/spring/impl/ModuleSessionImpl.java new file mode 100644 index 0000000..b5a09a6 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/impl/ModuleSessionImpl.java @@ -0,0 +1,25 @@ +package com.iqudoo.framework.tape.spring.impl; + +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.modules.IModuleSession; +import com.iqudoo.framework.tape.modules.session.GetSessionParam; +import com.iqudoo.framework.tape.modules.session.RefreshSessionParam; +import com.iqudoo.framework.tape.service.ISessionService; +import org.springframework.stereotype.Component; + +@Component +public class ModuleSessionImpl implements IModuleSession { + + @Override + public String getSession(GetSessionParam param) throws Throwable { + ISessionService tempService = Tape.getService(ISessionService.class); + return tempService.getSession(param); + } + + @Override + public String refreshSession(RefreshSessionParam param) throws Throwable { + ISessionService tempService = Tape.getService(ISessionService.class); + return tempService.refreshSession(param); + } + +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/framework/tape/spring/impl/ModuleSettingImpl.java b/src/main/java/com/iqudoo/framework/tape/spring/impl/ModuleSettingImpl.java new file mode 100644 index 0000000..c867214 --- /dev/null +++ b/src/main/java/com/iqudoo/framework/tape/spring/impl/ModuleSettingImpl.java @@ -0,0 +1,208 @@ +package com.iqudoo.framework.tape.spring.impl; + +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONObject; +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.modules.IModuleCache; +import com.iqudoo.framework.tape.modules.IModuleSetting; +import com.iqudoo.framework.tape.modules.annotation.SettingConfiguration; +import com.iqudoo.framework.tape.modules.annotation.SettingField; +import com.iqudoo.framework.tape.modules.cache.CacheKey; +import com.iqudoo.framework.tape.modules.cache.CacheLoader; +import com.iqudoo.framework.tape.service.ISettingService; +import com.iqudoo.framework.tape.spring.RunnerApplication; +import org.springframework.stereotype.Component; + +import java.lang.reflect.Field; +import java.util.*; + +@SuppressWarnings("Convert2Lambda") +@Component +public class ModuleSettingImpl implements IModuleSetting { + + private final Map> mSettingInfoMap = new HashMap<>(); + + @Override + public SettingInfo getSettingInfo(String group, String key) { + SettingInfo info = null; + try { + List settingInfos = getList(group); + for (SettingInfo settingInfo : settingInfos) { + if (Objects.equals(settingInfo.getKey(), key)) { + info = settingInfo; + } + } + } catch (Throwable ignored) { + } + return info; + } + + @Override + public List getList(String group) { + if (mSettingInfoMap.containsKey(group)) { + return mSettingInfoMap.get(group); + } + List settingInfoList = new ArrayList<>(); + List> classList = RunnerApplication.getClassList(); + if (classList != null && !classList.isEmpty()) { + for (Class clazz : classList) { + SettingConfiguration settingConfiguration = clazz.getAnnotation(SettingConfiguration.class); + if (settingConfiguration != null && Objects.equals(settingConfiguration.group(), group)) { + SettingInfo settingInfo = new SettingInfo(); + settingInfo.setType(clazz); + settingInfo.setKey(settingConfiguration.key()); + settingInfo.setTitle(settingConfiguration.title()); + settingInfo.setDesc(settingConfiguration.desc()); + settingInfo.setReadme(settingConfiguration.readme()); + settingInfo.setSort(settingConfiguration.sort()); + settingInfo.setHidden(settingConfiguration.isHidden()); + settingInfo.setPublic(settingConfiguration.isPublic()); + settingInfo.setRefreshPage(settingConfiguration.refreshPage()); + Object defInstance = null; + try { + defInstance = Tape.getService(clazz); + settingInfo.setDefaultValue(JSON.toJSONString(defInstance)); + } catch (Throwable ignored) { + } + List fieldList = new ArrayList<>(); + for (Field field : clazz.getDeclaredFields()) { + field.setAccessible(true); + FieldInfo settingField = new FieldInfo(); + settingField.setName(field.getName()); + if (field.isAnnotationPresent(SettingField.class)) { + SettingField settingFieldDesc = field.getAnnotation(SettingField.class); + settingField.setLabel(settingFieldDesc.label()); + settingField.setTips(settingFieldDesc.tips()); + settingField.setTextLenMax(settingFieldDesc.lenMax()); + settingField.setFileSize(settingFieldDesc.fileSize()); + settingField.setFileCount(settingFieldDesc.fileCount()); + settingField.setNumMin(settingFieldDesc.numMin()); + settingField.setNumMax(settingFieldDesc.numMax()); + settingField.setNumStep(settingFieldDesc.numStep()); + settingField.setNumPrecision(settingFieldDesc.numPrecision()); + settingField.setTextRows(settingFieldDesc.rows()); + settingField.setShow(settingFieldDesc.show()); + settingField.setRequired(settingFieldDesc.required()); + settingField.setDisabled(settingFieldDesc.disabled()); + settingField.setSensitive(settingFieldDesc.isSensitive()); + settingField.setType(settingFieldDesc.type().getValue()); + settingField.setOptions(String.join("\n", settingFieldDesc.options())); + if (defInstance != null) { + try { + Object defaultValue = field.get(defInstance); + settingField.setDefaultValue(defaultValue); + } catch (Throwable ignored) { + } + } + if (settingField.getType() != null + && settingField.getType().equals(SettingFieldType.AUTO.getValue())) { + settingField.setType(null); + } + if (settingField.getType() == null + && settingField.getDefaultValue() != null) { + try { + if (settingField.getDefaultValue() instanceof Number) { + settingField.setType(SettingFieldType.TYPE_NUMBER.getValue()); + } else if (settingField.getDefaultValue() instanceof Boolean) { + settingField.setType(SettingFieldType.TYPE_BOOLEAN.getValue()); + } else { + settingField.setType(SettingFieldType.TYPE_TEXTAREA.getValue()); + } + } catch (Throwable ignored) { + } + } + if (settingField.getType() == null) { + settingField.setType(SettingFieldType.TYPE_TEXTAREA.getValue()); + } + fieldList.add(settingField); + } + } + settingInfo.setFields(fieldList); + settingInfoList.add(settingInfo); + } + } + } + settingInfoList.sort(new Comparator() { + @Override + public int compare(SettingInfo o1, SettingInfo o2) { + try { + return o2.getSort() - o1.getSort(); + } catch (Throwable ignored) { + } + return 0; + } + }); + if (!settingInfoList.isEmpty()) { + mSettingInfoMap.put(group, settingInfoList); + } + return settingInfoList; + } + + ///////////////////////////////////////////////////////////// + ///////////////////////////////////////////////////////////// + + @SuppressWarnings("LombokGetterMayBeUsed") + private static class SettingParams { + private final String key; + private final String group; + private final String[] bizArgs; + + public SettingParams(String key, String group, String[] bizArgs) { + this.key = key; + this.group = group; + this.bizArgs = bizArgs; + } + + public String getKey() { + return key; + } + + public String getGroup() { + return group; + } + + public String[] getBizArgs() { + return bizArgs; + } + } + + @Override + public D getSetting(Class clazz, String... bizArgs) throws Throwable { + if (clazz.isAnnotationPresent(SettingConfiguration.class)) { + SettingConfiguration configuration = clazz.getAnnotation(SettingConfiguration.class); + CacheKey cacheKey = CacheKey.builder("setting_" + configuration.key() + + "_" + String.join("_", bizArgs)).setExpireMillis(configuration.cacheTime()); + CacheLoader cacheLoader = new CacheLoader() { + @Override + public String onLoad(CacheKey cacheKey, SettingParams params) throws Throwable { + try { + return Tape.getService(ISettingService.class) + .getSettingValue(params.getKey(), + params.getGroup(), params.getBizArgs()); + } catch (Throwable ignored) { + } + return null; + } + }; + String settingValue = Tape.getService(IModuleCache.class) + .getCacheData(cacheKey, new SettingParams(configuration.key(), configuration.group(), + bizArgs), cacheLoader); + if (settingValue != null) { + return JSONObject.parseObject(settingValue, clazz); + } + return clazz.getDeclaredConstructor().newInstance(); + } + return null; + } + + @Override + public void clearCache(String key, String... bizArgs) { + try { + CacheKey cacheKey = CacheKey.builder("setting_" + key + + "_" + String.join("_", bizArgs)); + Tape.getService(IModuleCache.class).removeCacheData(cacheKey); + } catch (Throwable ignored) { + } + } + +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/App.java b/src/main/java/com/iqudoo/platform/application/App.java new file mode 100644 index 0000000..d714e4b --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/App.java @@ -0,0 +1,26 @@ +package com.iqudoo.platform.application; + +import com.iqudoo.framework.tape.spring.annotation.EnableTapeCorsFilter; +import com.iqudoo.framework.tape.spring.annotation.EnableTapeRunner; +import org.mybatis.spring.annotation.MapperScan; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; +import org.springframework.boot.web.servlet.support.SpringBootServletInitializer; +import org.springframework.retry.annotation.EnableRetry; +import org.springframework.scheduling.annotation.EnableScheduling; + +@EnableTapeRunner +@EnableTapeCorsFilter +@EnableScheduling +@SpringBootApplication +@MapperScan(value = {"${app.mybatis-mapper-scan}"}) +@EnableRetry // 开启重试 +public class App extends SpringBootServletInitializer { + + public static void main(String[] args) { + new SpringApplicationBuilder(App.class) + .allowCircularReferences(true) + .run(args); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/config/AsyncConfig.java b/src/main/java/com/iqudoo/platform/application/config/AsyncConfig.java new file mode 100644 index 0000000..ba5dbb9 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/config/AsyncConfig.java @@ -0,0 +1,46 @@ +package com.iqudoo.platform.application.config; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.annotation.EnableAsync; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; + +import java.util.concurrent.ThreadPoolExecutor; + +@Configuration +@EnableAsync +public class AsyncConfig { + + // 获取服务器 CPU 核心数 + private static final int CPU_COUNT = Runtime.getRuntime().availableProcessors(); + + /** + * IO 密集型线程池(适用于:WebService、HTTP调用、数据库、文件等) + */ + @Bean(name = "asyncTaskExecutor") + public ThreadPoolTaskExecutor asyncTaskExecutor() { + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + // ===================== 自动计算线程池参数 ===================== + // 核心线程数:IO密集型 = CPU核心数 * 2 + 1(行业标准) + int corePoolSize = CPU_COUNT * 2 + 1; + // 最大线程数:核心线程 * 2(根据并发量可调整) + int maxPoolSize = corePoolSize * 2; + // 队列容量:根据线程数自动设置 + int queueCapacity = corePoolSize * 10; + // 空闲时间:默认60秒 + int keepAliveSeconds = 60; + // 线程名称前缀 + String threadNamePrefix = "async-task-"; + // ============================================================== + executor.setCorePoolSize(corePoolSize); + executor.setMaxPoolSize(maxPoolSize); + executor.setQueueCapacity(queueCapacity); + executor.setKeepAliveSeconds(keepAliveSeconds); + executor.setThreadNamePrefix(threadNamePrefix); + // 拒绝策略:调用者线程执行(最安全,不丢任务) + executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); + executor.initialize(); + return executor; + } + +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/config/WebConfig.java b/src/main/java/com/iqudoo/platform/application/config/WebConfig.java new file mode 100644 index 0000000..19fe48a --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/config/WebConfig.java @@ -0,0 +1,18 @@ +package com.iqudoo.platform.application.config; + +import org.springframework.context.annotation.Configuration; +import org.springframework.http.converter.HttpMessageConverter; +import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +import java.util.List; + +@Configuration +public class WebConfig implements WebMvcConfigurer { + + @Override + public void configureMessageConverters(List> converters) { + converters.add(new MappingJackson2HttpMessageConverter()); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/constants/BizConstants.java b/src/main/java/com/iqudoo/platform/application/constants/BizConstants.java new file mode 100644 index 0000000..d6dcd0e --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/constants/BizConstants.java @@ -0,0 +1,21 @@ +package com.iqudoo.platform.application.constants; + +public class BizConstants { + + ///////////////////////////////////////// + // 账号类型 + ///////////////////////////////////////// + + // 系统管理员 + public static final String AUTH_GROUP_SYS_ADMIN = "group-sys-admin"; + // 系统超级管理员权限 + public static final String AUTH_TAG_SYS_ADMIN_SUPER = "group-sys-admin-super"; + + ///////////////////////////////////////// + // 配置类型 + ///////////////////////////////////////// + + // 系统基础配置 + public static final String SETTING_GROUP_SYSTEM = "sys-setting"; + +} diff --git a/src/main/java/com/iqudoo/platform/application/constants/ErrorConstants.java b/src/main/java/com/iqudoo/platform/application/constants/ErrorConstants.java new file mode 100644 index 0000000..618201c --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/constants/ErrorConstants.java @@ -0,0 +1,16 @@ +package com.iqudoo.platform.application.constants; + + +import com.iqudoo.framework.tape.base.action.bean.ActionState; + +public class ErrorConstants { + + public static final ActionState NO_PERMISSION = new ActionState(ActionState.NO_PERMISSION.getCode(), "权限不足,请联系管理员"); + public static final ActionState UN_AUTHORIZED = new ActionState(ActionState.UN_AUTHORIZED.getCode(), "认证失败,请登录账号"); + public static final ActionState UN_AUTHORIZED_PLATFORM_NON_MATCH = new ActionState(ActionState.UN_AUTHORIZED.getCode(), "认证失败,请登录账号[登录端不匹配] "); + public static final ActionState AUTH_USER_NOT_EXIST = new ActionState(201, "账号或密码错误"); + public static final ActionState AUTH_USER_NOT_ENABLE = new ActionState(202, "账号已被禁用"); + public static final ActionState AUTH_USER_PASSWORD_ERROR = new ActionState(203, "账号或密码错误"); + public static final ActionState AUTH_USER_NEW_PASSWORD_ERROR = new ActionState(204, "新密码不能和原密码一致"); + +} diff --git a/src/main/java/com/iqudoo/platform/application/controller/StaticFileController.java b/src/main/java/com/iqudoo/platform/application/controller/StaticFileController.java new file mode 100644 index 0000000..e6c2fc8 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/controller/StaticFileController.java @@ -0,0 +1,338 @@ +package com.iqudoo.platform.application.controller; + +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocControllerConfiguration; +import com.iqudoo.framework.tape.modules.IModuleSetting; +import com.iqudoo.framework.tape.modules.utils.DateTimeUtil; +import com.iqudoo.framework.tape.modules.utils.DigestUtil; +import com.iqudoo.framework.tape.modules.utils.ServletUtil; +import com.iqudoo.platform.application.setting.SystemGlobalStaticFileConfig; +import org.apache.catalina.connector.ClientAbortException; +import org.slf4j.Logger; +import org.springframework.core.io.ClassPathResource; +import org.springframework.http.*; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RestController; + +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.InputStream; +import java.io.OutputStream; +import java.nio.file.Files; +import java.nio.file.attribute.BasicFileAttributes; +import java.text.ParseException; +import java.util.*; +import java.util.function.Function; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.zip.GZIPOutputStream; + +@RestController +public class StaticFileController { + + @SuppressWarnings({"LombokGetterMayBeUsed", "LombokSetterMayBeUsed"}) + private static class FileResource { + private long contentLength; + private long lastModified; + private String absolutePath; + private InputStream inputStream; + + public long getContentLength() { + return contentLength; + } + + public void setContentLength(long contentLength) { + this.contentLength = contentLength; + } + + public void setAbsolutePath(String absolutePath) { + this.absolutePath = absolutePath; + } + + public String getAbsolutePath() { + return absolutePath; + } + + public long getLastModified() { + return lastModified; + } + + public void setLastModified(long lastModified) { + this.lastModified = lastModified; + } + + public InputStream getInputStream() { + return inputStream; + } + + public void setInputStream(InputStream inputStream) { + this.inputStream = inputStream; + } + + + } + + private static final Logger LOGGER = Tape.getLogger(StaticFileController.class); + private static final String CACHE_CONTROL = "Cache-Control"; + private static final String CONTENT_TYPE = "Content-Type"; + private static final String LAST_MODIFIED = "Last-Modified"; + private static final String IF_MODIFIED_SINCE = "If-Modified-Since"; + private static final String IF_NONE_MATCH = "If-None-Match"; + private static final String E_TAG = "ETag"; + + public String getUploadPath() { + return "upload-files"; + } + + public String getUploadRoute() { + return "files"; + } + + @SuppressWarnings("unused") + @GetMapping(value = {"/", "/{firstDir:^(?!api).*}/**"}) + @ApiDocControllerConfiguration(name = "/*", desc = "静态文件访问路径,参考全局配置中静态文件配置", sort = 999999) + public Object staticWith(@PathVariable(required = false) String firstDir, HttpServletRequest servletRequest, HttpServletResponse servletResponse) throws Throwable { + SystemGlobalStaticFileConfig staticFileConfig = Tape.getService(IModuleSetting.class) + .getSetting(SystemGlobalStaticFileConfig.class); + HttpHeaders headers = new HttpHeaders(); + try { + String[] paths = (servletRequest.getServletPath() + "#END#").split("/"); + if (paths.length > 0) { + String lastPath = paths[paths.length - 1].replaceAll("#END#", ""); + if (lastPath.length() <= 0) { + lastPath = "index.html"; + } + paths[paths.length - 1] = lastPath; + } + List filePaths = new ArrayList<>(Arrays.asList(paths).subList(1, paths.length)); + String filePath = String.join("/", filePaths); + String[] staticFolderList = staticFileConfig.getStaticFileFolder().split("\n"); + FileResource targetFile = null; + for (String folder : staticFolderList) { + targetFile = getTargetFileResource(filePath, folder); + if (targetFile != null) { + break; + } + } + if (targetFile == null) { + targetFile = getTargetFileResource(filePath, "[" + getUploadRoute() + + "]" + getUploadPath()); + } + if (targetFile != null) { + responseFileStream(servletRequest, servletResponse, + targetFile, staticFileConfig.isStaticFileGzipEnable()); + return null; + } + headers.setContentType(MediaType.APPLICATION_JSON); + return new ResponseEntity<>("{\"code\":404,\"msg\": \"Not found\"}", headers, HttpStatus.NOT_FOUND); + } catch (Throwable throwable) { + return new ResponseEntity<>("{\"code\":500,\"msg\": \"Internal Server Error\"}", headers, HttpStatus.INTERNAL_SERVER_ERROR); + } + } + + private FileResource getTargetFileResource(String filePath, String folder) { + FileResource targetFile = null; + try { + String folderPath = folder.trim(); + String curFilePath = filePath; + Map folderMap = parseKeyValue(folder); + if (folderMap.containsKey("key") + && folderMap.containsKey("value")) { + folderPath = folderMap.get("value"); + String folderKey = folderMap.get("key") + "/"; + if (filePath.indexOf(folderKey) == 0) { + curFilePath = curFilePath.substring(folderKey.length()); + } else { + return null; + } + } + if (folderPath.startsWith("classpath:")) { + // WAR包资源文件 + String resourcePath = folderPath.substring("classpath:".length()) + curFilePath; + ClassPathResource classPathResource = new ClassPathResource(resourcePath); + if (classPathResource.exists()) { + try { + targetFile = new FileResource(); + targetFile.setAbsolutePath(resourcePath); + targetFile.setContentLength(classPathResource.contentLength()); + targetFile.setLastModified(classPathResource.lastModified()); + targetFile.setInputStream(classPathResource.getInputStream()); + } catch (Throwable ignored) { + } + } + } else { + File file = new File(folderPath, curFilePath); + if (file.isFile() && file.exists()) { + try { + BasicFileAttributes basicFileAttributes = Files.readAttributes(file.toPath(), + BasicFileAttributes.class); + targetFile = new FileResource(); + targetFile.setAbsolutePath(file.getAbsolutePath()); + targetFile.setContentLength(basicFileAttributes.size()); + targetFile.setLastModified(basicFileAttributes.lastModifiedTime().toMillis()); + targetFile.setInputStream(Files.newInputStream(file.toPath())); + } catch (Throwable ignored) { + } + } + } + } catch (Throwable ignored) { + } + return targetFile; + } + + private void responseFileStream(HttpServletRequest servletRequest, HttpServletResponse servletResponse, FileResource fileResource, boolean gzipEnable) throws Throwable { + String sourceETag = getETag(fileResource); + long sourceLastModified = getLastModified(fileResource); + String ifModifiedSinceHeader = servletRequest.getHeader(IF_MODIFIED_SINCE); + String ifNoneMatchHeader = servletRequest.getHeader(IF_NONE_MATCH); + if (ifModifiedSinceHeader != null && ifNoneMatchHeader != null) { + if (validateIfModifiedSince(servletRequest, sourceLastModified) && validateIfNoneMatch(servletRequest, sourceETag)) { + servletResponse.addHeader(CACHE_CONTROL, "public"); + servletResponse.addHeader(LAST_MODIFIED, generateLastModified(sourceLastModified)); + servletResponse.addHeader(E_TAG, generateETag(sourceETag)); + servletResponse.getOutputStream().write(new byte[0]); + servletResponse.setStatus(304); + return; + } + } + if (ifModifiedSinceHeader != null) { + if (validateIfModifiedSince(servletRequest, sourceLastModified)) { + servletResponse.addHeader(CACHE_CONTROL, "public"); + servletResponse.addHeader(LAST_MODIFIED, generateLastModified(sourceLastModified)); + servletResponse.getOutputStream().write(new byte[0]); + servletResponse.setStatus(304); + return; + } + } + servletResponse.addHeader(LAST_MODIFIED, generateLastModified(sourceLastModified)); + servletResponse.addHeader(E_TAG, generateETag(sourceETag)); + servletResponse.addHeader(CACHE_CONTROL, "public"); + servletResponse.addHeader(CONTENT_TYPE, getContentTypeByFileName(fileResource.getAbsolutePath())); + OutputStream outputStream = null; + InputStream inputStream = null; + try { + int readLen; + inputStream = fileResource.getInputStream(); + byte[] buffer = new byte[1024 * 1024 * 5]; + outputStream = ServletUtil.getServletOutputStreamWithGZip(servletRequest, servletResponse, gzipEnable); + if (!(outputStream instanceof GZIPOutputStream)) { + servletResponse.setContentLengthLong(inputStream.available()); + } + while ((readLen = inputStream.read(buffer)) != -1) { + outputStream.write(buffer, 0, readLen); + } + outputStream.flush(); + } catch (Throwable e) { + if (!(e instanceof ClientAbortException)) { + LOGGER.error("response file to stream error:" + e); + } + } finally { + try { + if (outputStream != null) { + outputStream.close(); + } + if (inputStream != null) { + inputStream.close(); + } + } catch (Throwable ignored) { + } + } + } + + private String getETag(FileResource file) { + if (file != null) { + long sourceSize = file.getContentLength(); + String sourcePath = file.getAbsolutePath(); + long lastModified = file.getLastModified(); + return DigestUtil.md5DigestAsHex(sourceSize + + sourcePath + lastModified); + } + return ""; + } + + @SuppressWarnings({"Convert2Lambda", "Anonymous2MethodRef"}) + public String getContentTypeByFileName(String fileName) { + try { + Optional mediaTypeOptional = MediaTypeFactory.getMediaType(fileName); + return mediaTypeOptional.map(new Function() { + @Override + public String apply(MediaType mediaType) { + return mediaType.toString(); + } + }).orElse(null); + } catch (Throwable ignored) { + } + return null; + } + + private long getLastModified(FileResource file) { + if (file != null) { + return file.getLastModified(); + } + return -1; + } + + private String generateETag(String tag) { + return "\"0" + DigestUtil.md5DigestAsHex(tag) + '"'; + } + + private boolean validateIfNoneMatch(HttpServletRequest request, String sourceETag) { + String eTagHeader = request.getHeader(IF_NONE_MATCH); + if (sourceETag == null && eTagHeader == null) { + return true; + } + if (sourceETag != null && eTagHeader != null) { + return sourceETag.equalsIgnoreCase(eTagHeader); + } + return false; + } + + private String generateLastModified(long lastModified) { + return DateTimeUtil.formatMillisToGMT(lastModified); + } + + private boolean validateIfModifiedSince(HttpServletRequest request, long sourceLastModify) { + if (sourceLastModify < 0) { + return false; + } + long ifModifiedSince = parseDateHeader(request, IF_MODIFIED_SINCE); + if (ifModifiedSince < 0) { + return false; + } + return ifModifiedSince >= (sourceLastModify / 1000 * 1000); + } + + @SuppressWarnings("SameParameterValue") + private long parseDateHeader(HttpServletRequest request, String headerName) { + String dateValue = request.getHeader(headerName); + if (dateValue != null) { + try { + return DateTimeUtil.parseGMTToMillis(dateValue); + } catch (ParseException ex) { + int separatorIndex = dateValue.indexOf(';'); + if (separatorIndex != -1) { + String datePart = dateValue.substring(0, separatorIndex); + try { + return DateTimeUtil.parseGMTToMillis(datePart); + } catch (ParseException ignored) { + } + } + } + } + return -1; + } + + public static Map parseKeyValue(String input) { + Map result = new HashMap<>(); + Pattern pattern = Pattern.compile("\\[(.*)](.*)"); + Matcher matcher = pattern.matcher(input); + if (matcher.find()) { + result.put("key", matcher.group(1)); + result.put("value", matcher.group(2)); + } + return result; + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/database/mapper/SystemAdminInfoMapper.java b/src/main/java/com/iqudoo/platform/application/database/mapper/SystemAdminInfoMapper.java new file mode 100644 index 0000000..117cde7 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/database/mapper/SystemAdminInfoMapper.java @@ -0,0 +1,100 @@ +package com.iqudoo.platform.application.database.mapper; + +import com.iqudoo.platform.application.database.model.SystemAdminInfo; +import com.iqudoo.platform.application.database.model.SystemAdminInfoExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface SystemAdminInfoMapper { + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_admin_info + * + * @mbg.generated + */ + long countByExample(SystemAdminInfoExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_admin_info + * + * @mbg.generated + */ + int deleteByExample(SystemAdminInfoExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_admin_info + * + * @mbg.generated + */ + int deleteByPrimaryKey(Long guid); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_admin_info + * + * @mbg.generated + */ + int insert(SystemAdminInfo record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_admin_info + * + * @mbg.generated + */ + int insertSelective(SystemAdminInfo record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_admin_info + * + * @mbg.generated + */ + List selectByExample(SystemAdminInfoExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_admin_info + * + * @mbg.generated + */ + SystemAdminInfo selectByPrimaryKey(Long guid); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_admin_info + * + * @mbg.generated + */ + int updateByExampleSelective(@Param("record") SystemAdminInfo record, @Param("example") SystemAdminInfoExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_admin_info + * + * @mbg.generated + */ + int updateByExample(@Param("record") SystemAdminInfo record, @Param("example") SystemAdminInfoExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_admin_info + * + * @mbg.generated + */ + int updateByPrimaryKeySelective(SystemAdminInfo record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_admin_info + * + * @mbg.generated + */ + int updateByPrimaryKey(SystemAdminInfo record); + + int batchInsert(@Param("records") List records); + + List selectPrimaryKeyByExample(SystemAdminInfoExample example); +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/database/mapper/SystemAsyncTaskInfoMapper.java b/src/main/java/com/iqudoo/platform/application/database/mapper/SystemAsyncTaskInfoMapper.java new file mode 100644 index 0000000..6794337 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/database/mapper/SystemAsyncTaskInfoMapper.java @@ -0,0 +1,124 @@ +package com.iqudoo.platform.application.database.mapper; + +import com.iqudoo.platform.application.database.model.SystemAsyncTaskInfo; +import com.iqudoo.platform.application.database.model.SystemAsyncTaskInfoExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface SystemAsyncTaskInfoMapper { + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + long countByExample(SystemAsyncTaskInfoExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + int deleteByExample(SystemAsyncTaskInfoExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + int deleteByPrimaryKey(Long guid); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + int insert(SystemAsyncTaskInfo record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + int insertSelective(SystemAsyncTaskInfo record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + List selectByExampleWithBLOBs(SystemAsyncTaskInfoExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + List selectByExample(SystemAsyncTaskInfoExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + SystemAsyncTaskInfo selectByPrimaryKey(Long guid); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + int updateByExampleSelective(@Param("record") SystemAsyncTaskInfo record, @Param("example") SystemAsyncTaskInfoExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + int updateByExampleWithBLOBs(@Param("record") SystemAsyncTaskInfo record, @Param("example") SystemAsyncTaskInfoExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + int updateByExample(@Param("record") SystemAsyncTaskInfo record, @Param("example") SystemAsyncTaskInfoExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + int updateByPrimaryKeySelective(SystemAsyncTaskInfo record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + int updateByPrimaryKeyWithBLOBs(SystemAsyncTaskInfo record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + int updateByPrimaryKey(SystemAsyncTaskInfo record); + + int batchInsert(@Param("records") List records); + + List selectPrimaryKeyByExample(SystemAsyncTaskInfoExample example); +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/database/mapper/SystemCrawlerCacheDataMapper.java b/src/main/java/com/iqudoo/platform/application/database/mapper/SystemCrawlerCacheDataMapper.java new file mode 100644 index 0000000..db18e56 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/database/mapper/SystemCrawlerCacheDataMapper.java @@ -0,0 +1,124 @@ +package com.iqudoo.platform.application.database.mapper; + +import com.iqudoo.platform.application.database.model.SystemCrawlerCacheData; +import com.iqudoo.platform.application.database.model.SystemCrawlerCacheDataExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface SystemCrawlerCacheDataMapper { + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + long countByExample(SystemCrawlerCacheDataExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + int deleteByExample(SystemCrawlerCacheDataExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + int deleteByPrimaryKey(Long guid); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + int insert(SystemCrawlerCacheData record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + int insertSelective(SystemCrawlerCacheData record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + List selectByExampleWithBLOBs(SystemCrawlerCacheDataExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + List selectByExample(SystemCrawlerCacheDataExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + SystemCrawlerCacheData selectByPrimaryKey(Long guid); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + int updateByExampleSelective(@Param("record") SystemCrawlerCacheData record, @Param("example") SystemCrawlerCacheDataExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + int updateByExampleWithBLOBs(@Param("record") SystemCrawlerCacheData record, @Param("example") SystemCrawlerCacheDataExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + int updateByExample(@Param("record") SystemCrawlerCacheData record, @Param("example") SystemCrawlerCacheDataExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + int updateByPrimaryKeySelective(SystemCrawlerCacheData record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + int updateByPrimaryKeyWithBLOBs(SystemCrawlerCacheData record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + int updateByPrimaryKey(SystemCrawlerCacheData record); + + int batchInsert(@Param("records") List records); + + List selectPrimaryKeyByExample(SystemCrawlerCacheDataExample example); +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/database/mapper/SystemGlobalCacheMapper.java b/src/main/java/com/iqudoo/platform/application/database/mapper/SystemGlobalCacheMapper.java new file mode 100644 index 0000000..e8708f9 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/database/mapper/SystemGlobalCacheMapper.java @@ -0,0 +1,124 @@ +package com.iqudoo.platform.application.database.mapper; + +import com.iqudoo.platform.application.database.model.SystemGlobalCache; +import com.iqudoo.platform.application.database.model.SystemGlobalCacheExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface SystemGlobalCacheMapper { + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + long countByExample(SystemGlobalCacheExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + int deleteByExample(SystemGlobalCacheExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + int deleteByPrimaryKey(Long guid); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + int insert(SystemGlobalCache record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + int insertSelective(SystemGlobalCache record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + List selectByExampleWithBLOBs(SystemGlobalCacheExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + List selectByExample(SystemGlobalCacheExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + SystemGlobalCache selectByPrimaryKey(Long guid); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + int updateByExampleSelective(@Param("record") SystemGlobalCache record, @Param("example") SystemGlobalCacheExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + int updateByExampleWithBLOBs(@Param("record") SystemGlobalCache record, @Param("example") SystemGlobalCacheExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + int updateByExample(@Param("record") SystemGlobalCache record, @Param("example") SystemGlobalCacheExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + int updateByPrimaryKeySelective(SystemGlobalCache record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + int updateByPrimaryKeyWithBLOBs(SystemGlobalCache record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + int updateByPrimaryKey(SystemGlobalCache record); + + int batchInsert(@Param("records") List records); + + List selectPrimaryKeyByExample(SystemGlobalCacheExample example); +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/database/mapper/SystemGlobalFileTransferMapper.java b/src/main/java/com/iqudoo/platform/application/database/mapper/SystemGlobalFileTransferMapper.java new file mode 100644 index 0000000..ba8da83 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/database/mapper/SystemGlobalFileTransferMapper.java @@ -0,0 +1,100 @@ +package com.iqudoo.platform.application.database.mapper; + +import com.iqudoo.platform.application.database.model.SystemGlobalFileTransfer; +import com.iqudoo.platform.application.database.model.SystemGlobalFileTransferExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface SystemGlobalFileTransferMapper { + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated + */ + long countByExample(SystemGlobalFileTransferExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated + */ + int deleteByExample(SystemGlobalFileTransferExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated + */ + int deleteByPrimaryKey(Long guid); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated + */ + int insert(SystemGlobalFileTransfer record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated + */ + int insertSelective(SystemGlobalFileTransfer record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated + */ + List selectByExample(SystemGlobalFileTransferExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated + */ + SystemGlobalFileTransfer selectByPrimaryKey(Long guid); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated + */ + int updateByExampleSelective(@Param("record") SystemGlobalFileTransfer record, @Param("example") SystemGlobalFileTransferExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated + */ + int updateByExample(@Param("record") SystemGlobalFileTransfer record, @Param("example") SystemGlobalFileTransferExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated + */ + int updateByPrimaryKeySelective(SystemGlobalFileTransfer record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated + */ + int updateByPrimaryKey(SystemGlobalFileTransfer record); + + int batchInsert(@Param("records") List records); + + List selectPrimaryKeyByExample(SystemGlobalFileTransferExample example); +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/database/mapper/SystemGlobalSessionMapper.java b/src/main/java/com/iqudoo/platform/application/database/mapper/SystemGlobalSessionMapper.java new file mode 100644 index 0000000..5a37b40 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/database/mapper/SystemGlobalSessionMapper.java @@ -0,0 +1,100 @@ +package com.iqudoo.platform.application.database.mapper; + +import com.iqudoo.platform.application.database.model.SystemGlobalSession; +import com.iqudoo.platform.application.database.model.SystemGlobalSessionExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface SystemGlobalSessionMapper { + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_session + * + * @mbg.generated + */ + long countByExample(SystemGlobalSessionExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_session + * + * @mbg.generated + */ + int deleteByExample(SystemGlobalSessionExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_session + * + * @mbg.generated + */ + int deleteByPrimaryKey(Long guid); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_session + * + * @mbg.generated + */ + int insert(SystemGlobalSession record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_session + * + * @mbg.generated + */ + int insertSelective(SystemGlobalSession record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_session + * + * @mbg.generated + */ + List selectByExample(SystemGlobalSessionExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_session + * + * @mbg.generated + */ + SystemGlobalSession selectByPrimaryKey(Long guid); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_session + * + * @mbg.generated + */ + int updateByExampleSelective(@Param("record") SystemGlobalSession record, @Param("example") SystemGlobalSessionExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_session + * + * @mbg.generated + */ + int updateByExample(@Param("record") SystemGlobalSession record, @Param("example") SystemGlobalSessionExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_session + * + * @mbg.generated + */ + int updateByPrimaryKeySelective(SystemGlobalSession record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_session + * + * @mbg.generated + */ + int updateByPrimaryKey(SystemGlobalSession record); + + int batchInsert(@Param("records") List records); + + List selectPrimaryKeyByExample(SystemGlobalSessionExample example); +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/database/mapper/SystemGlobalSettingMapper.java b/src/main/java/com/iqudoo/platform/application/database/mapper/SystemGlobalSettingMapper.java new file mode 100644 index 0000000..4f4ac30 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/database/mapper/SystemGlobalSettingMapper.java @@ -0,0 +1,124 @@ +package com.iqudoo.platform.application.database.mapper; + +import com.iqudoo.platform.application.database.model.SystemGlobalSetting; +import com.iqudoo.platform.application.database.model.SystemGlobalSettingExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface SystemGlobalSettingMapper { + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + long countByExample(SystemGlobalSettingExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + int deleteByExample(SystemGlobalSettingExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + int deleteByPrimaryKey(Long guid); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + int insert(SystemGlobalSetting record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + int insertSelective(SystemGlobalSetting record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + List selectByExampleWithBLOBs(SystemGlobalSettingExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + List selectByExample(SystemGlobalSettingExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + SystemGlobalSetting selectByPrimaryKey(Long guid); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + int updateByExampleSelective(@Param("record") SystemGlobalSetting record, @Param("example") SystemGlobalSettingExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + int updateByExampleWithBLOBs(@Param("record") SystemGlobalSetting record, @Param("example") SystemGlobalSettingExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + int updateByExample(@Param("record") SystemGlobalSetting record, @Param("example") SystemGlobalSettingExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + int updateByPrimaryKeySelective(SystemGlobalSetting record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + int updateByPrimaryKeyWithBLOBs(SystemGlobalSetting record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + int updateByPrimaryKey(SystemGlobalSetting record); + + int batchInsert(@Param("records") List records); + + List selectPrimaryKeyByExample(SystemGlobalSettingExample example); +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/database/mapper/SystemGlobalVerifyMapper.java b/src/main/java/com/iqudoo/platform/application/database/mapper/SystemGlobalVerifyMapper.java new file mode 100644 index 0000000..19ad615 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/database/mapper/SystemGlobalVerifyMapper.java @@ -0,0 +1,100 @@ +package com.iqudoo.platform.application.database.mapper; + +import com.iqudoo.platform.application.database.model.SystemGlobalVerify; +import com.iqudoo.platform.application.database.model.SystemGlobalVerifyExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface SystemGlobalVerifyMapper { + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_verify + * + * @mbg.generated + */ + long countByExample(SystemGlobalVerifyExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_verify + * + * @mbg.generated + */ + int deleteByExample(SystemGlobalVerifyExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_verify + * + * @mbg.generated + */ + int deleteByPrimaryKey(Long guid); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_verify + * + * @mbg.generated + */ + int insert(SystemGlobalVerify record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_verify + * + * @mbg.generated + */ + int insertSelective(SystemGlobalVerify record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_verify + * + * @mbg.generated + */ + List selectByExample(SystemGlobalVerifyExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_verify + * + * @mbg.generated + */ + SystemGlobalVerify selectByPrimaryKey(Long guid); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_verify + * + * @mbg.generated + */ + int updateByExampleSelective(@Param("record") SystemGlobalVerify record, @Param("example") SystemGlobalVerifyExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_verify + * + * @mbg.generated + */ + int updateByExample(@Param("record") SystemGlobalVerify record, @Param("example") SystemGlobalVerifyExample example); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_verify + * + * @mbg.generated + */ + int updateByPrimaryKeySelective(SystemGlobalVerify record); + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_verify + * + * @mbg.generated + */ + int updateByPrimaryKey(SystemGlobalVerify record); + + int batchInsert(@Param("records") List records); + + List selectPrimaryKeyByExample(SystemGlobalVerifyExample example); +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/database/model/SystemAdminInfo.java b/src/main/java/com/iqudoo/platform/application/database/model/SystemAdminInfo.java new file mode 100644 index 0000000..56956f0 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/database/model/SystemAdminInfo.java @@ -0,0 +1,542 @@ +package com.iqudoo.platform.application.database.model; + +import java.io.Serializable; +import java.util.Date; + +/** + * Database Table Remarks: + * 系统管理员信息表 + * + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_admin_info + */ +public class SystemAdminInfo implements Serializable { + /** + * Database Column Remarks: + * GUID + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_admin_info.guid + * + * @mbg.generated + */ + private Long guid; + + /** + * Database Column Remarks: + * 登录账号 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_admin_info.username + * + * @mbg.generated + */ + private String username; + + /** + * Database Column Remarks: + * 账号昵称 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_admin_info.nickname + * + * @mbg.generated + */ + private String nickname; + + /** + * Database Column Remarks: + * 密码密文 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_admin_info.pwd_md5 + * + * @mbg.generated + */ + private String pwdMd5; + + /** + * Database Column Remarks: + * 加密盐数 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_admin_info.pwd_slot + * + * @mbg.generated + */ + private String pwdSlot; + + /** + * Database Column Remarks: + * 备注信息 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_admin_info.opt_remark + * + * @mbg.generated + */ + private String optRemark; + + /** + * Database Column Remarks: + * 状态标志 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_admin_info.opt_status + * + * @mbg.generated + */ + private Integer optStatus; + + /** + * Database Column Remarks: + * 超管标志 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_admin_info.opt_super + * + * @mbg.generated + */ + private Integer optSuper; + + /** + * Database Column Remarks: + * 隐藏标志 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_admin_info.is_hidden + * + * @mbg.generated + */ + private Integer isHidden; + + /** + * Database Column Remarks: + * 删除标志 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_admin_info.is_delete + * + * @mbg.generated + */ + private Integer isDelete; + + /** + * Database Column Remarks: + * 删除令牌 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_admin_info.delete_token + * + * @mbg.generated + */ + private String deleteToken; + + /** + * Database Column Remarks: + * 数据版本 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_admin_info.data_version + * + * @mbg.generated + */ + private Integer dataVersion; + + /** + * Database Column Remarks: + * 创建时间 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_admin_info.create_time + * + * @mbg.generated + */ + private Date createTime; + + /** + * Database Column Remarks: + * 更新时间 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_admin_info.update_time + * + * @mbg.generated + */ + private Date updateTime; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_admin_info + * + * @mbg.generated + */ + private static final long serialVersionUID = 1L; + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_admin_info.guid + * + * @return the value of t_system_admin_info.guid + * + * @mbg.generated + */ + public Long getGuid() { + return guid; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_admin_info.guid + * + * @param guid the value for t_system_admin_info.guid + * + * @mbg.generated + */ + public void setGuid(Long guid) { + this.guid = guid; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_admin_info.username + * + * @return the value of t_system_admin_info.username + * + * @mbg.generated + */ + public String getUsername() { + return username; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_admin_info.username + * + * @param username the value for t_system_admin_info.username + * + * @mbg.generated + */ + public void setUsername(String username) { + this.username = username == null ? null : username.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_admin_info.nickname + * + * @return the value of t_system_admin_info.nickname + * + * @mbg.generated + */ + public String getNickname() { + return nickname; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_admin_info.nickname + * + * @param nickname the value for t_system_admin_info.nickname + * + * @mbg.generated + */ + public void setNickname(String nickname) { + this.nickname = nickname == null ? null : nickname.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_admin_info.pwd_md5 + * + * @return the value of t_system_admin_info.pwd_md5 + * + * @mbg.generated + */ + public String getPwdMd5() { + return pwdMd5; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_admin_info.pwd_md5 + * + * @param pwdMd5 the value for t_system_admin_info.pwd_md5 + * + * @mbg.generated + */ + public void setPwdMd5(String pwdMd5) { + this.pwdMd5 = pwdMd5 == null ? null : pwdMd5.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_admin_info.pwd_slot + * + * @return the value of t_system_admin_info.pwd_slot + * + * @mbg.generated + */ + public String getPwdSlot() { + return pwdSlot; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_admin_info.pwd_slot + * + * @param pwdSlot the value for t_system_admin_info.pwd_slot + * + * @mbg.generated + */ + public void setPwdSlot(String pwdSlot) { + this.pwdSlot = pwdSlot == null ? null : pwdSlot.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_admin_info.opt_remark + * + * @return the value of t_system_admin_info.opt_remark + * + * @mbg.generated + */ + public String getOptRemark() { + return optRemark; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_admin_info.opt_remark + * + * @param optRemark the value for t_system_admin_info.opt_remark + * + * @mbg.generated + */ + public void setOptRemark(String optRemark) { + this.optRemark = optRemark == null ? null : optRemark.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_admin_info.opt_status + * + * @return the value of t_system_admin_info.opt_status + * + * @mbg.generated + */ + public Integer getOptStatus() { + return optStatus; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_admin_info.opt_status + * + * @param optStatus the value for t_system_admin_info.opt_status + * + * @mbg.generated + */ + public void setOptStatus(Integer optStatus) { + this.optStatus = optStatus; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_admin_info.opt_super + * + * @return the value of t_system_admin_info.opt_super + * + * @mbg.generated + */ + public Integer getOptSuper() { + return optSuper; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_admin_info.opt_super + * + * @param optSuper the value for t_system_admin_info.opt_super + * + * @mbg.generated + */ + public void setOptSuper(Integer optSuper) { + this.optSuper = optSuper; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_admin_info.is_hidden + * + * @return the value of t_system_admin_info.is_hidden + * + * @mbg.generated + */ + public Integer getIsHidden() { + return isHidden; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_admin_info.is_hidden + * + * @param isHidden the value for t_system_admin_info.is_hidden + * + * @mbg.generated + */ + public void setIsHidden(Integer isHidden) { + this.isHidden = isHidden; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_admin_info.is_delete + * + * @return the value of t_system_admin_info.is_delete + * + * @mbg.generated + */ + public Integer getIsDelete() { + return isDelete; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_admin_info.is_delete + * + * @param isDelete the value for t_system_admin_info.is_delete + * + * @mbg.generated + */ + public void setIsDelete(Integer isDelete) { + this.isDelete = isDelete; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_admin_info.delete_token + * + * @return the value of t_system_admin_info.delete_token + * + * @mbg.generated + */ + public String getDeleteToken() { + return deleteToken; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_admin_info.delete_token + * + * @param deleteToken the value for t_system_admin_info.delete_token + * + * @mbg.generated + */ + public void setDeleteToken(String deleteToken) { + this.deleteToken = deleteToken == null ? null : deleteToken.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_admin_info.data_version + * + * @return the value of t_system_admin_info.data_version + * + * @mbg.generated + */ + public Integer getDataVersion() { + return dataVersion; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_admin_info.data_version + * + * @param dataVersion the value for t_system_admin_info.data_version + * + * @mbg.generated + */ + public void setDataVersion(Integer dataVersion) { + this.dataVersion = dataVersion; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_admin_info.create_time + * + * @return the value of t_system_admin_info.create_time + * + * @mbg.generated + */ + public Date getCreateTime() { + return createTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_admin_info.create_time + * + * @param createTime the value for t_system_admin_info.create_time + * + * @mbg.generated + */ + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_admin_info.update_time + * + * @return the value of t_system_admin_info.update_time + * + * @mbg.generated + */ + public Date getUpdateTime() { + return updateTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_admin_info.update_time + * + * @param updateTime the value for t_system_admin_info.update_time + * + * @mbg.generated + */ + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_admin_info + * + * @mbg.generated + */ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", guid=").append(guid); + sb.append(", username=").append(username); + sb.append(", nickname=").append(nickname); + sb.append(", pwdMd5=").append(pwdMd5); + sb.append(", pwdSlot=").append(pwdSlot); + sb.append(", optRemark=").append(optRemark); + sb.append(", optStatus=").append(optStatus); + sb.append(", optSuper=").append(optSuper); + sb.append(", isHidden=").append(isHidden); + sb.append(", isDelete=").append(isDelete); + sb.append(", deleteToken=").append(deleteToken); + sb.append(", dataVersion=").append(dataVersion); + sb.append(", createTime=").append(createTime); + sb.append(", updateTime=").append(updateTime); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/database/model/SystemAdminInfoExample.java b/src/main/java/com/iqudoo/platform/application/database/model/SystemAdminInfoExample.java new file mode 100644 index 0000000..cde888f --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/database/model/SystemAdminInfoExample.java @@ -0,0 +1,1386 @@ +package com.iqudoo.platform.application.database.model; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Objects; + +public class SystemAdminInfoExample { + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_admin_info + * + * @mbg.generated + */ + protected String orderByClause; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_admin_info + * + * @mbg.generated + */ + protected boolean distinct; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_admin_info + * + * @mbg.generated + */ + protected List oredCriteria; + + protected String resultType = null; + + protected Integer maxPageSize = 100; + + protected Integer ignorePageSize = 10000; + + protected Integer startPageNum = 1; + + protected Integer offset = null; + + protected Integer rows = null; + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_admin_info + * + * @mbg.generated + */ + public SystemAdminInfoExample() { + oredCriteria = new ArrayList<>(); + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_admin_info + * + * @mbg.generated + */ + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_admin_info + * + * @mbg.generated + */ + public String getOrderByClause() { + return orderByClause; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_admin_info + * + * @mbg.generated + */ + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_admin_info + * + * @mbg.generated + */ + public boolean isDistinct() { + return distinct; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_admin_info + * + * @mbg.generated + */ + public List getOredCriteria() { + return oredCriteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_admin_info + * + * @mbg.generated + */ + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_admin_info + * + * @mbg.generated + */ + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_admin_info + * + * @mbg.generated + */ + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_admin_info + * + * @mbg.generated + */ + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_admin_info + * + * @mbg.generated + */ + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + rows = null; + offset = null; + resultType = null; + } + + public void setMaxPageSize(Integer maxPageSize) { + this.maxPageSize = maxPageSize; + } + + public Integer getMaxPageSize() { + return this.maxPageSize; + } + + public void setIgnorePageSize(Integer ignorePageSize) { + this.ignorePageSize = ignorePageSize; + } + + public Integer getIgnorePageSize() { + return this.ignorePageSize; + } + + public void setStartPageNum(Integer startPageNum) { + this.startPageNum = startPageNum; + } + + public Integer getStartPageNum() { + return this.startPageNum; + } + + public SystemAdminInfoExample setResultType(String type) { + this.resultType = type; + return this; + } + + public SystemAdminInfoExample resultValid() { + this.resultType = "valid"; + return this; + } + + public Boolean isResultValid() { + return !this.isResultAny() && !this.isResultTrash(); + } + + public SystemAdminInfoExample resultTrash() { + this.resultType = "trash"; + return this; + } + + public Boolean isResultTrash() { + return Objects.equals(this.resultType, "trash"); + } + + public SystemAdminInfoExample resultAny() { + this.resultType = "any"; + return this; + } + + public Boolean isResultAny() { + return Objects.equals(this.resultType, "any"); + } + + public SystemAdminInfoExample limit(Integer rows) { + this.offset = null; + this.rows = rows; + return this; + } + + public SystemAdminInfoExample limit(Integer offset, Integer rows) { + this.offset = offset; + this.rows = rows; + return this; + } + + public SystemAdminInfoExample limitOffset(Integer offset, Integer rows) { + this.offset = offset; + this.rows = 999999999; + return this; + } + + public SystemAdminInfoExample usePage(Integer pageNum, Integer pageSize) { + pageSize = pageSize == null || pageSize <= 0 ? 1 : pageSize; + pageNum = pageNum == null || pageNum < this.startPageNum ? this.startPageNum : pageNum; + if (pageSize >= this.ignorePageSize) { + this.rows = null; + this.offset = null; + return this; + } + int cPageSize = pageSize > this.maxPageSize ? this.maxPageSize: pageSize; + this.offset = (pageNum - this.startPageNum) * cPageSize; + this.rows = cPageSize; + return this; + } + + public Integer getPageNum() { + if (this.rows == null || this.offset == null || this.rows == 0) { + return this.startPageNum; + } + return this.offset / this.rows + this.startPageNum; + } + + public Integer getPageSize() { + if (this.rows == null) { + return this.ignorePageSize; + } + return this.rows; + } + + public Integer getRows() { + return this.rows; + } + + public Integer getOffset() { + return this.offset; + } + + public String getLimitString() { + if (getRows() != null) { + if (getOffset() != null) { + return getOffset() + "," + getRows(); + } else { + return getRows() + ""; + } + } + return null; + } + + public String getWhereString() { + if (getOredCriteria() != null) { + List whereGroup = new ArrayList<>(); + for (Criteria criteria : getOredCriteria()) { + List criterionList = new ArrayList<>(); + for (Criterion criterion : criteria.getAllCriteria()) { + if (criterion.isNoValue()) { + criterionList.add(criterion.getCondition()); + } else if (criterion.isBetweenValue()) { + criterionList.add(criterion.getCondition() + " " + criterion.getValue() + "," + criterion.getSecondValue()); + } else { + criterionList.add(criterion.getCondition() + " " + criterion.getValue()); + } + } + whereGroup.add(String.join(" and ", criterionList)); + } + if (whereGroup.size() > 1) { + List mapWhereGroup = new ArrayList<>(); + for (String where : whereGroup) { + mapWhereGroup.add("(" + where + ")"); + } + whereGroup = mapWhereGroup; + } + return String.join(" or ", whereGroup); + } + return null; + } + + public SystemAdminInfoExample cloneExample() { + SystemAdminInfoExample newExample = new SystemAdminInfoExample(); + newExample.rows = this.rows; + newExample.offset = this.offset; + newExample.maxPageSize = this.maxPageSize; + newExample.ignorePageSize = this.ignorePageSize; + newExample.startPageNum = this.startPageNum; + newExample.resultType = this.resultType; + + if (this.getOredCriteria() != null && !this.getOredCriteria().isEmpty()) { + for (SystemAdminInfoExample.Criteria oldCriteria : this.getOredCriteria()) { + SystemAdminInfoExample.Criteria newCriteria = newExample.or(); + newCriteria.getCriteria().addAll(oldCriteria.getCriteria()); + } + } + newExample.setOrderByClause(this.getOrderByClause()); + return newExample; + } + + /** + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_admin_info + * + * @mbg.generated + */ + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList<>(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andGuidIsNull() { + addCriterion("guid is null"); + return (Criteria) this; + } + + public Criteria andGuidIsNotNull() { + addCriterion("guid is not null"); + return (Criteria) this; + } + + public Criteria andGuidEqualTo(Long value) { + addCriterion("guid =", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidNotEqualTo(Long value) { + addCriterion("guid <>", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidGreaterThan(Long value) { + addCriterion("guid >", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidGreaterThanOrEqualTo(Long value) { + addCriterion("guid >=", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidLessThan(Long value) { + addCriterion("guid <", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidLessThanOrEqualTo(Long value) { + addCriterion("guid <=", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidIn(List values) { + addCriterion("guid in", values, "guid"); + return (Criteria) this; + } + + public Criteria andGuidNotIn(List values) { + addCriterion("guid not in", values, "guid"); + return (Criteria) this; + } + + public Criteria andGuidBetween(Long value1, Long value2) { + addCriterion("guid between", value1, value2, "guid"); + return (Criteria) this; + } + + public Criteria andGuidNotBetween(Long value1, Long value2) { + addCriterion("guid not between", value1, value2, "guid"); + return (Criteria) this; + } + + public Criteria andUsernameIsNull() { + addCriterion("username is null"); + return (Criteria) this; + } + + public Criteria andUsernameIsNotNull() { + addCriterion("username is not null"); + return (Criteria) this; + } + + public Criteria andUsernameEqualTo(String value) { + addCriterion("username =", value, "username"); + return (Criteria) this; + } + + public Criteria andUsernameNotEqualTo(String value) { + addCriterion("username <>", value, "username"); + return (Criteria) this; + } + + public Criteria andUsernameGreaterThan(String value) { + addCriterion("username >", value, "username"); + return (Criteria) this; + } + + public Criteria andUsernameGreaterThanOrEqualTo(String value) { + addCriterion("username >=", value, "username"); + return (Criteria) this; + } + + public Criteria andUsernameLessThan(String value) { + addCriterion("username <", value, "username"); + return (Criteria) this; + } + + public Criteria andUsernameLessThanOrEqualTo(String value) { + addCriterion("username <=", value, "username"); + return (Criteria) this; + } + + public Criteria andUsernameLike(String value) { + addCriterion("username like", value, "username"); + return (Criteria) this; + } + + public Criteria andUsernameNotLike(String value) { + addCriterion("username not like", value, "username"); + return (Criteria) this; + } + + public Criteria andUsernameIn(List values) { + addCriterion("username in", values, "username"); + return (Criteria) this; + } + + public Criteria andUsernameNotIn(List values) { + addCriterion("username not in", values, "username"); + return (Criteria) this; + } + + public Criteria andUsernameBetween(String value1, String value2) { + addCriterion("username between", value1, value2, "username"); + return (Criteria) this; + } + + public Criteria andUsernameNotBetween(String value1, String value2) { + addCriterion("username not between", value1, value2, "username"); + return (Criteria) this; + } + + public Criteria andNicknameIsNull() { + addCriterion("nickname is null"); + return (Criteria) this; + } + + public Criteria andNicknameIsNotNull() { + addCriterion("nickname is not null"); + return (Criteria) this; + } + + public Criteria andNicknameEqualTo(String value) { + addCriterion("nickname =", value, "nickname"); + return (Criteria) this; + } + + public Criteria andNicknameNotEqualTo(String value) { + addCriterion("nickname <>", value, "nickname"); + return (Criteria) this; + } + + public Criteria andNicknameGreaterThan(String value) { + addCriterion("nickname >", value, "nickname"); + return (Criteria) this; + } + + public Criteria andNicknameGreaterThanOrEqualTo(String value) { + addCriterion("nickname >=", value, "nickname"); + return (Criteria) this; + } + + public Criteria andNicknameLessThan(String value) { + addCriterion("nickname <", value, "nickname"); + return (Criteria) this; + } + + public Criteria andNicknameLessThanOrEqualTo(String value) { + addCriterion("nickname <=", value, "nickname"); + return (Criteria) this; + } + + public Criteria andNicknameLike(String value) { + addCriterion("nickname like", value, "nickname"); + return (Criteria) this; + } + + public Criteria andNicknameNotLike(String value) { + addCriterion("nickname not like", value, "nickname"); + return (Criteria) this; + } + + public Criteria andNicknameIn(List values) { + addCriterion("nickname in", values, "nickname"); + return (Criteria) this; + } + + public Criteria andNicknameNotIn(List values) { + addCriterion("nickname not in", values, "nickname"); + return (Criteria) this; + } + + public Criteria andNicknameBetween(String value1, String value2) { + addCriterion("nickname between", value1, value2, "nickname"); + return (Criteria) this; + } + + public Criteria andNicknameNotBetween(String value1, String value2) { + addCriterion("nickname not between", value1, value2, "nickname"); + return (Criteria) this; + } + + public Criteria andPwdMd5IsNull() { + addCriterion("pwd_md5 is null"); + return (Criteria) this; + } + + public Criteria andPwdMd5IsNotNull() { + addCriterion("pwd_md5 is not null"); + return (Criteria) this; + } + + public Criteria andPwdMd5EqualTo(String value) { + addCriterion("pwd_md5 =", value, "pwdMd5"); + return (Criteria) this; + } + + public Criteria andPwdMd5NotEqualTo(String value) { + addCriterion("pwd_md5 <>", value, "pwdMd5"); + return (Criteria) this; + } + + public Criteria andPwdMd5GreaterThan(String value) { + addCriterion("pwd_md5 >", value, "pwdMd5"); + return (Criteria) this; + } + + public Criteria andPwdMd5GreaterThanOrEqualTo(String value) { + addCriterion("pwd_md5 >=", value, "pwdMd5"); + return (Criteria) this; + } + + public Criteria andPwdMd5LessThan(String value) { + addCriterion("pwd_md5 <", value, "pwdMd5"); + return (Criteria) this; + } + + public Criteria andPwdMd5LessThanOrEqualTo(String value) { + addCriterion("pwd_md5 <=", value, "pwdMd5"); + return (Criteria) this; + } + + public Criteria andPwdMd5Like(String value) { + addCriterion("pwd_md5 like", value, "pwdMd5"); + return (Criteria) this; + } + + public Criteria andPwdMd5NotLike(String value) { + addCriterion("pwd_md5 not like", value, "pwdMd5"); + return (Criteria) this; + } + + public Criteria andPwdMd5In(List values) { + addCriterion("pwd_md5 in", values, "pwdMd5"); + return (Criteria) this; + } + + public Criteria andPwdMd5NotIn(List values) { + addCriterion("pwd_md5 not in", values, "pwdMd5"); + return (Criteria) this; + } + + public Criteria andPwdMd5Between(String value1, String value2) { + addCriterion("pwd_md5 between", value1, value2, "pwdMd5"); + return (Criteria) this; + } + + public Criteria andPwdMd5NotBetween(String value1, String value2) { + addCriterion("pwd_md5 not between", value1, value2, "pwdMd5"); + return (Criteria) this; + } + + public Criteria andPwdSlotIsNull() { + addCriterion("pwd_slot is null"); + return (Criteria) this; + } + + public Criteria andPwdSlotIsNotNull() { + addCriterion("pwd_slot is not null"); + return (Criteria) this; + } + + public Criteria andPwdSlotEqualTo(String value) { + addCriterion("pwd_slot =", value, "pwdSlot"); + return (Criteria) this; + } + + public Criteria andPwdSlotNotEqualTo(String value) { + addCriterion("pwd_slot <>", value, "pwdSlot"); + return (Criteria) this; + } + + public Criteria andPwdSlotGreaterThan(String value) { + addCriterion("pwd_slot >", value, "pwdSlot"); + return (Criteria) this; + } + + public Criteria andPwdSlotGreaterThanOrEqualTo(String value) { + addCriterion("pwd_slot >=", value, "pwdSlot"); + return (Criteria) this; + } + + public Criteria andPwdSlotLessThan(String value) { + addCriterion("pwd_slot <", value, "pwdSlot"); + return (Criteria) this; + } + + public Criteria andPwdSlotLessThanOrEqualTo(String value) { + addCriterion("pwd_slot <=", value, "pwdSlot"); + return (Criteria) this; + } + + public Criteria andPwdSlotLike(String value) { + addCriterion("pwd_slot like", value, "pwdSlot"); + return (Criteria) this; + } + + public Criteria andPwdSlotNotLike(String value) { + addCriterion("pwd_slot not like", value, "pwdSlot"); + return (Criteria) this; + } + + public Criteria andPwdSlotIn(List values) { + addCriterion("pwd_slot in", values, "pwdSlot"); + return (Criteria) this; + } + + public Criteria andPwdSlotNotIn(List values) { + addCriterion("pwd_slot not in", values, "pwdSlot"); + return (Criteria) this; + } + + public Criteria andPwdSlotBetween(String value1, String value2) { + addCriterion("pwd_slot between", value1, value2, "pwdSlot"); + return (Criteria) this; + } + + public Criteria andPwdSlotNotBetween(String value1, String value2) { + addCriterion("pwd_slot not between", value1, value2, "pwdSlot"); + return (Criteria) this; + } + + public Criteria andOptRemarkIsNull() { + addCriterion("opt_remark is null"); + return (Criteria) this; + } + + public Criteria andOptRemarkIsNotNull() { + addCriterion("opt_remark is not null"); + return (Criteria) this; + } + + public Criteria andOptRemarkEqualTo(String value) { + addCriterion("opt_remark =", value, "optRemark"); + return (Criteria) this; + } + + public Criteria andOptRemarkNotEqualTo(String value) { + addCriterion("opt_remark <>", value, "optRemark"); + return (Criteria) this; + } + + public Criteria andOptRemarkGreaterThan(String value) { + addCriterion("opt_remark >", value, "optRemark"); + return (Criteria) this; + } + + public Criteria andOptRemarkGreaterThanOrEqualTo(String value) { + addCriterion("opt_remark >=", value, "optRemark"); + return (Criteria) this; + } + + public Criteria andOptRemarkLessThan(String value) { + addCriterion("opt_remark <", value, "optRemark"); + return (Criteria) this; + } + + public Criteria andOptRemarkLessThanOrEqualTo(String value) { + addCriterion("opt_remark <=", value, "optRemark"); + return (Criteria) this; + } + + public Criteria andOptRemarkLike(String value) { + addCriterion("opt_remark like", value, "optRemark"); + return (Criteria) this; + } + + public Criteria andOptRemarkNotLike(String value) { + addCriterion("opt_remark not like", value, "optRemark"); + return (Criteria) this; + } + + public Criteria andOptRemarkIn(List values) { + addCriterion("opt_remark in", values, "optRemark"); + return (Criteria) this; + } + + public Criteria andOptRemarkNotIn(List values) { + addCriterion("opt_remark not in", values, "optRemark"); + return (Criteria) this; + } + + public Criteria andOptRemarkBetween(String value1, String value2) { + addCriterion("opt_remark between", value1, value2, "optRemark"); + return (Criteria) this; + } + + public Criteria andOptRemarkNotBetween(String value1, String value2) { + addCriterion("opt_remark not between", value1, value2, "optRemark"); + return (Criteria) this; + } + + public Criteria andOptStatusIsNull() { + addCriterion("opt_status is null"); + return (Criteria) this; + } + + public Criteria andOptStatusIsNotNull() { + addCriterion("opt_status is not null"); + return (Criteria) this; + } + + public Criteria andOptStatusEqualTo(Integer value) { + addCriterion("opt_status =", value, "optStatus"); + return (Criteria) this; + } + + public Criteria andOptStatusNotEqualTo(Integer value) { + addCriterion("opt_status <>", value, "optStatus"); + return (Criteria) this; + } + + public Criteria andOptStatusGreaterThan(Integer value) { + addCriterion("opt_status >", value, "optStatus"); + return (Criteria) this; + } + + public Criteria andOptStatusGreaterThanOrEqualTo(Integer value) { + addCriterion("opt_status >=", value, "optStatus"); + return (Criteria) this; + } + + public Criteria andOptStatusLessThan(Integer value) { + addCriterion("opt_status <", value, "optStatus"); + return (Criteria) this; + } + + public Criteria andOptStatusLessThanOrEqualTo(Integer value) { + addCriterion("opt_status <=", value, "optStatus"); + return (Criteria) this; + } + + public Criteria andOptStatusIn(List values) { + addCriterion("opt_status in", values, "optStatus"); + return (Criteria) this; + } + + public Criteria andOptStatusNotIn(List values) { + addCriterion("opt_status not in", values, "optStatus"); + return (Criteria) this; + } + + public Criteria andOptStatusBetween(Integer value1, Integer value2) { + addCriterion("opt_status between", value1, value2, "optStatus"); + return (Criteria) this; + } + + public Criteria andOptStatusNotBetween(Integer value1, Integer value2) { + addCriterion("opt_status not between", value1, value2, "optStatus"); + return (Criteria) this; + } + + public Criteria andOptSuperIsNull() { + addCriterion("opt_super is null"); + return (Criteria) this; + } + + public Criteria andOptSuperIsNotNull() { + addCriterion("opt_super is not null"); + return (Criteria) this; + } + + public Criteria andOptSuperEqualTo(Integer value) { + addCriterion("opt_super =", value, "optSuper"); + return (Criteria) this; + } + + public Criteria andOptSuperNotEqualTo(Integer value) { + addCriterion("opt_super <>", value, "optSuper"); + return (Criteria) this; + } + + public Criteria andOptSuperGreaterThan(Integer value) { + addCriterion("opt_super >", value, "optSuper"); + return (Criteria) this; + } + + public Criteria andOptSuperGreaterThanOrEqualTo(Integer value) { + addCriterion("opt_super >=", value, "optSuper"); + return (Criteria) this; + } + + public Criteria andOptSuperLessThan(Integer value) { + addCriterion("opt_super <", value, "optSuper"); + return (Criteria) this; + } + + public Criteria andOptSuperLessThanOrEqualTo(Integer value) { + addCriterion("opt_super <=", value, "optSuper"); + return (Criteria) this; + } + + public Criteria andOptSuperIn(List values) { + addCriterion("opt_super in", values, "optSuper"); + return (Criteria) this; + } + + public Criteria andOptSuperNotIn(List values) { + addCriterion("opt_super not in", values, "optSuper"); + return (Criteria) this; + } + + public Criteria andOptSuperBetween(Integer value1, Integer value2) { + addCriterion("opt_super between", value1, value2, "optSuper"); + return (Criteria) this; + } + + public Criteria andOptSuperNotBetween(Integer value1, Integer value2) { + addCriterion("opt_super not between", value1, value2, "optSuper"); + return (Criteria) this; + } + + public Criteria andIsHiddenIsNull() { + addCriterion("is_hidden is null"); + return (Criteria) this; + } + + public Criteria andIsHiddenIsNotNull() { + addCriterion("is_hidden is not null"); + return (Criteria) this; + } + + public Criteria andIsHiddenEqualTo(Integer value) { + addCriterion("is_hidden =", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenNotEqualTo(Integer value) { + addCriterion("is_hidden <>", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenGreaterThan(Integer value) { + addCriterion("is_hidden >", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenGreaterThanOrEqualTo(Integer value) { + addCriterion("is_hidden >=", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenLessThan(Integer value) { + addCriterion("is_hidden <", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenLessThanOrEqualTo(Integer value) { + addCriterion("is_hidden <=", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenIn(List values) { + addCriterion("is_hidden in", values, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenNotIn(List values) { + addCriterion("is_hidden not in", values, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenBetween(Integer value1, Integer value2) { + addCriterion("is_hidden between", value1, value2, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenNotBetween(Integer value1, Integer value2) { + addCriterion("is_hidden not between", value1, value2, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsDeleteIsNull() { + addCriterion("is_delete is null"); + return (Criteria) this; + } + + public Criteria andIsDeleteIsNotNull() { + addCriterion("is_delete is not null"); + return (Criteria) this; + } + + public Criteria andIsDeleteEqualTo(Integer value) { + addCriterion("is_delete =", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteNotEqualTo(Integer value) { + addCriterion("is_delete <>", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteGreaterThan(Integer value) { + addCriterion("is_delete >", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteGreaterThanOrEqualTo(Integer value) { + addCriterion("is_delete >=", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteLessThan(Integer value) { + addCriterion("is_delete <", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteLessThanOrEqualTo(Integer value) { + addCriterion("is_delete <=", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteIn(List values) { + addCriterion("is_delete in", values, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteNotIn(List values) { + addCriterion("is_delete not in", values, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteBetween(Integer value1, Integer value2) { + addCriterion("is_delete between", value1, value2, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteNotBetween(Integer value1, Integer value2) { + addCriterion("is_delete not between", value1, value2, "isDelete"); + return (Criteria) this; + } + + public Criteria andDeleteTokenIsNull() { + addCriterion("delete_token is null"); + return (Criteria) this; + } + + public Criteria andDeleteTokenIsNotNull() { + addCriterion("delete_token is not null"); + return (Criteria) this; + } + + public Criteria andDeleteTokenEqualTo(String value) { + addCriterion("delete_token =", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotEqualTo(String value) { + addCriterion("delete_token <>", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenGreaterThan(String value) { + addCriterion("delete_token >", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenGreaterThanOrEqualTo(String value) { + addCriterion("delete_token >=", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenLessThan(String value) { + addCriterion("delete_token <", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenLessThanOrEqualTo(String value) { + addCriterion("delete_token <=", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenLike(String value) { + addCriterion("delete_token like", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotLike(String value) { + addCriterion("delete_token not like", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenIn(List values) { + addCriterion("delete_token in", values, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotIn(List values) { + addCriterion("delete_token not in", values, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenBetween(String value1, String value2) { + addCriterion("delete_token between", value1, value2, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotBetween(String value1, String value2) { + addCriterion("delete_token not between", value1, value2, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDataVersionIsNull() { + addCriterion("data_version is null"); + return (Criteria) this; + } + + public Criteria andDataVersionIsNotNull() { + addCriterion("data_version is not null"); + return (Criteria) this; + } + + public Criteria andDataVersionEqualTo(Integer value) { + addCriterion("data_version =", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionNotEqualTo(Integer value) { + addCriterion("data_version <>", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionGreaterThan(Integer value) { + addCriterion("data_version >", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionGreaterThanOrEqualTo(Integer value) { + addCriterion("data_version >=", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionLessThan(Integer value) { + addCriterion("data_version <", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionLessThanOrEqualTo(Integer value) { + addCriterion("data_version <=", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionIn(List values) { + addCriterion("data_version in", values, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionNotIn(List values) { + addCriterion("data_version not in", values, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionBetween(Integer value1, Integer value2) { + addCriterion("data_version between", value1, value2, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionNotBetween(Integer value1, Integer value2) { + addCriterion("data_version not between", value1, value2, "dataVersion"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Date value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Date value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Date value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Date value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Date value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Date value1, Date value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } + } + + /** + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_admin_info + * + * @mbg.generated do_not_delete_during_merge + */ + public static class Criteria extends GeneratedCriteria { + protected Criteria() { + super(); + } + } + + /** + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_admin_info + * + * @mbg.generated + */ + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/database/model/SystemAsyncTaskInfo.java b/src/main/java/com/iqudoo/platform/application/database/model/SystemAsyncTaskInfo.java new file mode 100644 index 0000000..6295e54 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/database/model/SystemAsyncTaskInfo.java @@ -0,0 +1,830 @@ +package com.iqudoo.platform.application.database.model; + +import java.io.Serializable; +import java.util.Date; + +/** + * Database Table Remarks: + * 系统异步任务信息表 + * + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_async_task_info + */ +public class SystemAsyncTaskInfo implements Serializable { + /** + * Database Column Remarks: + * GUID + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_async_task_info.guid + * + * @mbg.generated + */ + private Long guid; + + /** + * Database Column Remarks: + * 业务类型 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_async_task_info.biz_type + * + * @mbg.generated + */ + private String bizType; + + /** + * Database Column Remarks: + * 业务编号 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_async_task_info.biz_id + * + * @mbg.generated + */ + private String bizId; + + /** + * Database Column Remarks: + * 任务编号 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_async_task_info.trans_id + * + * @mbg.generated + */ + private String transId; + + /** + * Database Column Remarks: + * 任务类型 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_async_task_info.task_type + * + * @mbg.generated + */ + private String taskType; + + /** + * Database Column Remarks: + * 定时执行 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_async_task_info.call_timing + * + * @mbg.generated + */ + private Long callTiming; + + /** + * Database Column Remarks: + * 开始时间 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_async_task_info.start_time + * + * @mbg.generated + */ + private Long startTime; + + /** + * Database Column Remarks: + * 结束时间 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_async_task_info.end_time + * + * @mbg.generated + */ + private Long endTime; + + /** + * Database Column Remarks: + * 总共耗时 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_async_task_info.use_time + * + * @mbg.generated + */ + private Long useTime; + + /** + * Database Column Remarks: + * 总共数量 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_async_task_info.total_count + * + * @mbg.generated + */ + private Integer totalCount; + + /** + * Database Column Remarks: + * 成功数量 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_async_task_info.success_count + * + * @mbg.generated + */ + private Integer successCount; + + /** + * Database Column Remarks: + * 失败数量 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_async_task_info.failure_count + * + * @mbg.generated + */ + private Integer failureCount; + + /** + * Database Column Remarks: + * 忽略数量 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_async_task_info.ignore_count + * + * @mbg.generated + */ + private Integer ignoreCount; + + /** + * Database Column Remarks: + * 重试次数 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_async_task_info.retry_count + * + * @mbg.generated + */ + private Integer retryCount; + + /** + * Database Column Remarks: + * 状态标志 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_async_task_info.opt_status + * + * @mbg.generated + */ + private Integer optStatus; + + /** + * Database Column Remarks: + * 隐藏标志 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_async_task_info.is_hidden + * + * @mbg.generated + */ + private Integer isHidden; + + /** + * Database Column Remarks: + * 删除标志 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_async_task_info.is_delete + * + * @mbg.generated + */ + private Integer isDelete; + + /** + * Database Column Remarks: + * 删除令牌 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_async_task_info.delete_token + * + * @mbg.generated + */ + private String deleteToken; + + /** + * Database Column Remarks: + * 数据版本 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_async_task_info.data_version + * + * @mbg.generated + */ + private Integer dataVersion; + + /** + * Database Column Remarks: + * 创建时间 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_async_task_info.create_time + * + * @mbg.generated + */ + private Date createTime; + + /** + * Database Column Remarks: + * 更新时间 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_async_task_info.update_time + * + * @mbg.generated + */ + private Date updateTime; + + /** + * Database Column Remarks: + * 任务参数 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_async_task_info.task_params + * + * @mbg.generated + */ + private String taskParams; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + private static final long serialVersionUID = 1L; + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_async_task_info.guid + * + * @return the value of t_system_async_task_info.guid + * + * @mbg.generated + */ + public Long getGuid() { + return guid; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_async_task_info.guid + * + * @param guid the value for t_system_async_task_info.guid + * + * @mbg.generated + */ + public void setGuid(Long guid) { + this.guid = guid; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_async_task_info.biz_type + * + * @return the value of t_system_async_task_info.biz_type + * + * @mbg.generated + */ + public String getBizType() { + return bizType; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_async_task_info.biz_type + * + * @param bizType the value for t_system_async_task_info.biz_type + * + * @mbg.generated + */ + public void setBizType(String bizType) { + this.bizType = bizType == null ? null : bizType.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_async_task_info.biz_id + * + * @return the value of t_system_async_task_info.biz_id + * + * @mbg.generated + */ + public String getBizId() { + return bizId; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_async_task_info.biz_id + * + * @param bizId the value for t_system_async_task_info.biz_id + * + * @mbg.generated + */ + public void setBizId(String bizId) { + this.bizId = bizId == null ? null : bizId.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_async_task_info.trans_id + * + * @return the value of t_system_async_task_info.trans_id + * + * @mbg.generated + */ + public String getTransId() { + return transId; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_async_task_info.trans_id + * + * @param transId the value for t_system_async_task_info.trans_id + * + * @mbg.generated + */ + public void setTransId(String transId) { + this.transId = transId == null ? null : transId.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_async_task_info.task_type + * + * @return the value of t_system_async_task_info.task_type + * + * @mbg.generated + */ + public String getTaskType() { + return taskType; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_async_task_info.task_type + * + * @param taskType the value for t_system_async_task_info.task_type + * + * @mbg.generated + */ + public void setTaskType(String taskType) { + this.taskType = taskType == null ? null : taskType.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_async_task_info.call_timing + * + * @return the value of t_system_async_task_info.call_timing + * + * @mbg.generated + */ + public Long getCallTiming() { + return callTiming; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_async_task_info.call_timing + * + * @param callTiming the value for t_system_async_task_info.call_timing + * + * @mbg.generated + */ + public void setCallTiming(Long callTiming) { + this.callTiming = callTiming; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_async_task_info.start_time + * + * @return the value of t_system_async_task_info.start_time + * + * @mbg.generated + */ + public Long getStartTime() { + return startTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_async_task_info.start_time + * + * @param startTime the value for t_system_async_task_info.start_time + * + * @mbg.generated + */ + public void setStartTime(Long startTime) { + this.startTime = startTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_async_task_info.end_time + * + * @return the value of t_system_async_task_info.end_time + * + * @mbg.generated + */ + public Long getEndTime() { + return endTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_async_task_info.end_time + * + * @param endTime the value for t_system_async_task_info.end_time + * + * @mbg.generated + */ + public void setEndTime(Long endTime) { + this.endTime = endTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_async_task_info.use_time + * + * @return the value of t_system_async_task_info.use_time + * + * @mbg.generated + */ + public Long getUseTime() { + return useTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_async_task_info.use_time + * + * @param useTime the value for t_system_async_task_info.use_time + * + * @mbg.generated + */ + public void setUseTime(Long useTime) { + this.useTime = useTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_async_task_info.total_count + * + * @return the value of t_system_async_task_info.total_count + * + * @mbg.generated + */ + public Integer getTotalCount() { + return totalCount; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_async_task_info.total_count + * + * @param totalCount the value for t_system_async_task_info.total_count + * + * @mbg.generated + */ + public void setTotalCount(Integer totalCount) { + this.totalCount = totalCount; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_async_task_info.success_count + * + * @return the value of t_system_async_task_info.success_count + * + * @mbg.generated + */ + public Integer getSuccessCount() { + return successCount; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_async_task_info.success_count + * + * @param successCount the value for t_system_async_task_info.success_count + * + * @mbg.generated + */ + public void setSuccessCount(Integer successCount) { + this.successCount = successCount; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_async_task_info.failure_count + * + * @return the value of t_system_async_task_info.failure_count + * + * @mbg.generated + */ + public Integer getFailureCount() { + return failureCount; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_async_task_info.failure_count + * + * @param failureCount the value for t_system_async_task_info.failure_count + * + * @mbg.generated + */ + public void setFailureCount(Integer failureCount) { + this.failureCount = failureCount; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_async_task_info.ignore_count + * + * @return the value of t_system_async_task_info.ignore_count + * + * @mbg.generated + */ + public Integer getIgnoreCount() { + return ignoreCount; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_async_task_info.ignore_count + * + * @param ignoreCount the value for t_system_async_task_info.ignore_count + * + * @mbg.generated + */ + public void setIgnoreCount(Integer ignoreCount) { + this.ignoreCount = ignoreCount; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_async_task_info.retry_count + * + * @return the value of t_system_async_task_info.retry_count + * + * @mbg.generated + */ + public Integer getRetryCount() { + return retryCount; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_async_task_info.retry_count + * + * @param retryCount the value for t_system_async_task_info.retry_count + * + * @mbg.generated + */ + public void setRetryCount(Integer retryCount) { + this.retryCount = retryCount; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_async_task_info.opt_status + * + * @return the value of t_system_async_task_info.opt_status + * + * @mbg.generated + */ + public Integer getOptStatus() { + return optStatus; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_async_task_info.opt_status + * + * @param optStatus the value for t_system_async_task_info.opt_status + * + * @mbg.generated + */ + public void setOptStatus(Integer optStatus) { + this.optStatus = optStatus; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_async_task_info.is_hidden + * + * @return the value of t_system_async_task_info.is_hidden + * + * @mbg.generated + */ + public Integer getIsHidden() { + return isHidden; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_async_task_info.is_hidden + * + * @param isHidden the value for t_system_async_task_info.is_hidden + * + * @mbg.generated + */ + public void setIsHidden(Integer isHidden) { + this.isHidden = isHidden; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_async_task_info.is_delete + * + * @return the value of t_system_async_task_info.is_delete + * + * @mbg.generated + */ + public Integer getIsDelete() { + return isDelete; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_async_task_info.is_delete + * + * @param isDelete the value for t_system_async_task_info.is_delete + * + * @mbg.generated + */ + public void setIsDelete(Integer isDelete) { + this.isDelete = isDelete; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_async_task_info.delete_token + * + * @return the value of t_system_async_task_info.delete_token + * + * @mbg.generated + */ + public String getDeleteToken() { + return deleteToken; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_async_task_info.delete_token + * + * @param deleteToken the value for t_system_async_task_info.delete_token + * + * @mbg.generated + */ + public void setDeleteToken(String deleteToken) { + this.deleteToken = deleteToken == null ? null : deleteToken.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_async_task_info.data_version + * + * @return the value of t_system_async_task_info.data_version + * + * @mbg.generated + */ + public Integer getDataVersion() { + return dataVersion; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_async_task_info.data_version + * + * @param dataVersion the value for t_system_async_task_info.data_version + * + * @mbg.generated + */ + public void setDataVersion(Integer dataVersion) { + this.dataVersion = dataVersion; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_async_task_info.create_time + * + * @return the value of t_system_async_task_info.create_time + * + * @mbg.generated + */ + public Date getCreateTime() { + return createTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_async_task_info.create_time + * + * @param createTime the value for t_system_async_task_info.create_time + * + * @mbg.generated + */ + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_async_task_info.update_time + * + * @return the value of t_system_async_task_info.update_time + * + * @mbg.generated + */ + public Date getUpdateTime() { + return updateTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_async_task_info.update_time + * + * @param updateTime the value for t_system_async_task_info.update_time + * + * @mbg.generated + */ + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_async_task_info.task_params + * + * @return the value of t_system_async_task_info.task_params + * + * @mbg.generated + */ + public String getTaskParams() { + return taskParams; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_async_task_info.task_params + * + * @param taskParams the value for t_system_async_task_info.task_params + * + * @mbg.generated + */ + public void setTaskParams(String taskParams) { + this.taskParams = taskParams == null ? null : taskParams.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", guid=").append(guid); + sb.append(", bizType=").append(bizType); + sb.append(", bizId=").append(bizId); + sb.append(", transId=").append(transId); + sb.append(", taskType=").append(taskType); + sb.append(", callTiming=").append(callTiming); + sb.append(", startTime=").append(startTime); + sb.append(", endTime=").append(endTime); + sb.append(", useTime=").append(useTime); + sb.append(", totalCount=").append(totalCount); + sb.append(", successCount=").append(successCount); + sb.append(", failureCount=").append(failureCount); + sb.append(", ignoreCount=").append(ignoreCount); + sb.append(", retryCount=").append(retryCount); + sb.append(", optStatus=").append(optStatus); + sb.append(", isHidden=").append(isHidden); + sb.append(", isDelete=").append(isDelete); + sb.append(", deleteToken=").append(deleteToken); + sb.append(", dataVersion=").append(dataVersion); + sb.append(", createTime=").append(createTime); + sb.append(", updateTime=").append(updateTime); + sb.append(", taskParams=").append(taskParams); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/database/model/SystemAsyncTaskInfoExample.java b/src/main/java/com/iqudoo/platform/application/database/model/SystemAsyncTaskInfoExample.java new file mode 100644 index 0000000..d76df20 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/database/model/SystemAsyncTaskInfoExample.java @@ -0,0 +1,1806 @@ +package com.iqudoo.platform.application.database.model; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Objects; + +public class SystemAsyncTaskInfoExample { + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + protected String orderByClause; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + protected boolean distinct; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + protected List oredCriteria; + + protected String resultType = null; + + protected Integer maxPageSize = 100; + + protected Integer ignorePageSize = 10000; + + protected Integer startPageNum = 1; + + protected Integer offset = null; + + protected Integer rows = null; + + protected Boolean withBLOBs = true; + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + public SystemAsyncTaskInfoExample() { + oredCriteria = new ArrayList<>(); + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + public String getOrderByClause() { + return orderByClause; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + public boolean isDistinct() { + return distinct; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + public List getOredCriteria() { + return oredCriteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + rows = null; + offset = null; + resultType = null; + } + + public void setWithBLOBs(Boolean withBLOBs) { + this.withBLOBs = withBLOBs; + } + + public boolean isWithBLOBs() { + return this.withBLOBs != null && this.withBLOBs; + } + + public void setMaxPageSize(Integer maxPageSize) { + this.maxPageSize = maxPageSize; + } + + public Integer getMaxPageSize() { + return this.maxPageSize; + } + + public void setIgnorePageSize(Integer ignorePageSize) { + this.ignorePageSize = ignorePageSize; + } + + public Integer getIgnorePageSize() { + return this.ignorePageSize; + } + + public void setStartPageNum(Integer startPageNum) { + this.startPageNum = startPageNum; + } + + public Integer getStartPageNum() { + return this.startPageNum; + } + + public SystemAsyncTaskInfoExample setResultType(String type) { + this.resultType = type; + return this; + } + + public SystemAsyncTaskInfoExample resultValid() { + this.resultType = "valid"; + return this; + } + + public Boolean isResultValid() { + return !this.isResultAny() && !this.isResultTrash(); + } + + public SystemAsyncTaskInfoExample resultTrash() { + this.resultType = "trash"; + return this; + } + + public Boolean isResultTrash() { + return Objects.equals(this.resultType, "trash"); + } + + public SystemAsyncTaskInfoExample resultAny() { + this.resultType = "any"; + return this; + } + + public Boolean isResultAny() { + return Objects.equals(this.resultType, "any"); + } + + public SystemAsyncTaskInfoExample limit(Integer rows) { + this.offset = null; + this.rows = rows; + return this; + } + + public SystemAsyncTaskInfoExample limit(Integer offset, Integer rows) { + this.offset = offset; + this.rows = rows; + return this; + } + + public SystemAsyncTaskInfoExample limitOffset(Integer offset, Integer rows) { + this.offset = offset; + this.rows = 999999999; + return this; + } + + public SystemAsyncTaskInfoExample usePage(Integer pageNum, Integer pageSize) { + pageSize = pageSize == null || pageSize <= 0 ? 1 : pageSize; + pageNum = pageNum == null || pageNum < this.startPageNum ? this.startPageNum : pageNum; + if (pageSize >= this.ignorePageSize) { + this.rows = null; + this.offset = null; + return this; + } + int cPageSize = pageSize > this.maxPageSize ? this.maxPageSize: pageSize; + this.offset = (pageNum - this.startPageNum) * cPageSize; + this.rows = cPageSize; + return this; + } + + public Integer getPageNum() { + if (this.rows == null || this.offset == null || this.rows == 0) { + return this.startPageNum; + } + return this.offset / this.rows + this.startPageNum; + } + + public Integer getPageSize() { + if (this.rows == null) { + return this.ignorePageSize; + } + return this.rows; + } + + public Integer getRows() { + return this.rows; + } + + public Integer getOffset() { + return this.offset; + } + + public String getLimitString() { + if (getRows() != null) { + if (getOffset() != null) { + return getOffset() + "," + getRows(); + } else { + return getRows() + ""; + } + } + return null; + } + + public String getWhereString() { + if (getOredCriteria() != null) { + List whereGroup = new ArrayList<>(); + for (Criteria criteria : getOredCriteria()) { + List criterionList = new ArrayList<>(); + for (Criterion criterion : criteria.getAllCriteria()) { + if (criterion.isNoValue()) { + criterionList.add(criterion.getCondition()); + } else if (criterion.isBetweenValue()) { + criterionList.add(criterion.getCondition() + " " + criterion.getValue() + "," + criterion.getSecondValue()); + } else { + criterionList.add(criterion.getCondition() + " " + criterion.getValue()); + } + } + whereGroup.add(String.join(" and ", criterionList)); + } + if (whereGroup.size() > 1) { + List mapWhereGroup = new ArrayList<>(); + for (String where : whereGroup) { + mapWhereGroup.add("(" + where + ")"); + } + whereGroup = mapWhereGroup; + } + return String.join(" or ", whereGroup); + } + return null; + } + + public SystemAsyncTaskInfoExample cloneExample() { + SystemAsyncTaskInfoExample newExample = new SystemAsyncTaskInfoExample(); + newExample.rows = this.rows; + newExample.offset = this.offset; + newExample.maxPageSize = this.maxPageSize; + newExample.ignorePageSize = this.ignorePageSize; + newExample.startPageNum = this.startPageNum; + newExample.resultType = this.resultType; + newExample.withBLOBs = withBLOBs; + if (this.getOredCriteria() != null && !this.getOredCriteria().isEmpty()) { + for (SystemAsyncTaskInfoExample.Criteria oldCriteria : this.getOredCriteria()) { + SystemAsyncTaskInfoExample.Criteria newCriteria = newExample.or(); + newCriteria.getCriteria().addAll(oldCriteria.getCriteria()); + } + } + newExample.setOrderByClause(this.getOrderByClause()); + return newExample; + } + + /** + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList<>(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andGuidIsNull() { + addCriterion("guid is null"); + return (Criteria) this; + } + + public Criteria andGuidIsNotNull() { + addCriterion("guid is not null"); + return (Criteria) this; + } + + public Criteria andGuidEqualTo(Long value) { + addCriterion("guid =", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidNotEqualTo(Long value) { + addCriterion("guid <>", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidGreaterThan(Long value) { + addCriterion("guid >", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidGreaterThanOrEqualTo(Long value) { + addCriterion("guid >=", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidLessThan(Long value) { + addCriterion("guid <", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidLessThanOrEqualTo(Long value) { + addCriterion("guid <=", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidIn(List values) { + addCriterion("guid in", values, "guid"); + return (Criteria) this; + } + + public Criteria andGuidNotIn(List values) { + addCriterion("guid not in", values, "guid"); + return (Criteria) this; + } + + public Criteria andGuidBetween(Long value1, Long value2) { + addCriterion("guid between", value1, value2, "guid"); + return (Criteria) this; + } + + public Criteria andGuidNotBetween(Long value1, Long value2) { + addCriterion("guid not between", value1, value2, "guid"); + return (Criteria) this; + } + + public Criteria andBizTypeIsNull() { + addCriterion("biz_type is null"); + return (Criteria) this; + } + + public Criteria andBizTypeIsNotNull() { + addCriterion("biz_type is not null"); + return (Criteria) this; + } + + public Criteria andBizTypeEqualTo(String value) { + addCriterion("biz_type =", value, "bizType"); + return (Criteria) this; + } + + public Criteria andBizTypeNotEqualTo(String value) { + addCriterion("biz_type <>", value, "bizType"); + return (Criteria) this; + } + + public Criteria andBizTypeGreaterThan(String value) { + addCriterion("biz_type >", value, "bizType"); + return (Criteria) this; + } + + public Criteria andBizTypeGreaterThanOrEqualTo(String value) { + addCriterion("biz_type >=", value, "bizType"); + return (Criteria) this; + } + + public Criteria andBizTypeLessThan(String value) { + addCriterion("biz_type <", value, "bizType"); + return (Criteria) this; + } + + public Criteria andBizTypeLessThanOrEqualTo(String value) { + addCriterion("biz_type <=", value, "bizType"); + return (Criteria) this; + } + + public Criteria andBizTypeLike(String value) { + addCriterion("biz_type like", value, "bizType"); + return (Criteria) this; + } + + public Criteria andBizTypeNotLike(String value) { + addCriterion("biz_type not like", value, "bizType"); + return (Criteria) this; + } + + public Criteria andBizTypeIn(List values) { + addCriterion("biz_type in", values, "bizType"); + return (Criteria) this; + } + + public Criteria andBizTypeNotIn(List values) { + addCriterion("biz_type not in", values, "bizType"); + return (Criteria) this; + } + + public Criteria andBizTypeBetween(String value1, String value2) { + addCriterion("biz_type between", value1, value2, "bizType"); + return (Criteria) this; + } + + public Criteria andBizTypeNotBetween(String value1, String value2) { + addCriterion("biz_type not between", value1, value2, "bizType"); + return (Criteria) this; + } + + public Criteria andBizIdIsNull() { + addCriterion("biz_id is null"); + return (Criteria) this; + } + + public Criteria andBizIdIsNotNull() { + addCriterion("biz_id is not null"); + return (Criteria) this; + } + + public Criteria andBizIdEqualTo(String value) { + addCriterion("biz_id =", value, "bizId"); + return (Criteria) this; + } + + public Criteria andBizIdNotEqualTo(String value) { + addCriterion("biz_id <>", value, "bizId"); + return (Criteria) this; + } + + public Criteria andBizIdGreaterThan(String value) { + addCriterion("biz_id >", value, "bizId"); + return (Criteria) this; + } + + public Criteria andBizIdGreaterThanOrEqualTo(String value) { + addCriterion("biz_id >=", value, "bizId"); + return (Criteria) this; + } + + public Criteria andBizIdLessThan(String value) { + addCriterion("biz_id <", value, "bizId"); + return (Criteria) this; + } + + public Criteria andBizIdLessThanOrEqualTo(String value) { + addCriterion("biz_id <=", value, "bizId"); + return (Criteria) this; + } + + public Criteria andBizIdLike(String value) { + addCriterion("biz_id like", value, "bizId"); + return (Criteria) this; + } + + public Criteria andBizIdNotLike(String value) { + addCriterion("biz_id not like", value, "bizId"); + return (Criteria) this; + } + + public Criteria andBizIdIn(List values) { + addCriterion("biz_id in", values, "bizId"); + return (Criteria) this; + } + + public Criteria andBizIdNotIn(List values) { + addCriterion("biz_id not in", values, "bizId"); + return (Criteria) this; + } + + public Criteria andBizIdBetween(String value1, String value2) { + addCriterion("biz_id between", value1, value2, "bizId"); + return (Criteria) this; + } + + public Criteria andBizIdNotBetween(String value1, String value2) { + addCriterion("biz_id not between", value1, value2, "bizId"); + return (Criteria) this; + } + + public Criteria andTransIdIsNull() { + addCriterion("trans_id is null"); + return (Criteria) this; + } + + public Criteria andTransIdIsNotNull() { + addCriterion("trans_id is not null"); + return (Criteria) this; + } + + public Criteria andTransIdEqualTo(String value) { + addCriterion("trans_id =", value, "transId"); + return (Criteria) this; + } + + public Criteria andTransIdNotEqualTo(String value) { + addCriterion("trans_id <>", value, "transId"); + return (Criteria) this; + } + + public Criteria andTransIdGreaterThan(String value) { + addCriterion("trans_id >", value, "transId"); + return (Criteria) this; + } + + public Criteria andTransIdGreaterThanOrEqualTo(String value) { + addCriterion("trans_id >=", value, "transId"); + return (Criteria) this; + } + + public Criteria andTransIdLessThan(String value) { + addCriterion("trans_id <", value, "transId"); + return (Criteria) this; + } + + public Criteria andTransIdLessThanOrEqualTo(String value) { + addCriterion("trans_id <=", value, "transId"); + return (Criteria) this; + } + + public Criteria andTransIdLike(String value) { + addCriterion("trans_id like", value, "transId"); + return (Criteria) this; + } + + public Criteria andTransIdNotLike(String value) { + addCriterion("trans_id not like", value, "transId"); + return (Criteria) this; + } + + public Criteria andTransIdIn(List values) { + addCriterion("trans_id in", values, "transId"); + return (Criteria) this; + } + + public Criteria andTransIdNotIn(List values) { + addCriterion("trans_id not in", values, "transId"); + return (Criteria) this; + } + + public Criteria andTransIdBetween(String value1, String value2) { + addCriterion("trans_id between", value1, value2, "transId"); + return (Criteria) this; + } + + public Criteria andTransIdNotBetween(String value1, String value2) { + addCriterion("trans_id not between", value1, value2, "transId"); + return (Criteria) this; + } + + public Criteria andTaskTypeIsNull() { + addCriterion("task_type is null"); + return (Criteria) this; + } + + public Criteria andTaskTypeIsNotNull() { + addCriterion("task_type is not null"); + return (Criteria) this; + } + + public Criteria andTaskTypeEqualTo(String value) { + addCriterion("task_type =", value, "taskType"); + return (Criteria) this; + } + + public Criteria andTaskTypeNotEqualTo(String value) { + addCriterion("task_type <>", value, "taskType"); + return (Criteria) this; + } + + public Criteria andTaskTypeGreaterThan(String value) { + addCriterion("task_type >", value, "taskType"); + return (Criteria) this; + } + + public Criteria andTaskTypeGreaterThanOrEqualTo(String value) { + addCriterion("task_type >=", value, "taskType"); + return (Criteria) this; + } + + public Criteria andTaskTypeLessThan(String value) { + addCriterion("task_type <", value, "taskType"); + return (Criteria) this; + } + + public Criteria andTaskTypeLessThanOrEqualTo(String value) { + addCriterion("task_type <=", value, "taskType"); + return (Criteria) this; + } + + public Criteria andTaskTypeLike(String value) { + addCriterion("task_type like", value, "taskType"); + return (Criteria) this; + } + + public Criteria andTaskTypeNotLike(String value) { + addCriterion("task_type not like", value, "taskType"); + return (Criteria) this; + } + + public Criteria andTaskTypeIn(List values) { + addCriterion("task_type in", values, "taskType"); + return (Criteria) this; + } + + public Criteria andTaskTypeNotIn(List values) { + addCriterion("task_type not in", values, "taskType"); + return (Criteria) this; + } + + public Criteria andTaskTypeBetween(String value1, String value2) { + addCriterion("task_type between", value1, value2, "taskType"); + return (Criteria) this; + } + + public Criteria andTaskTypeNotBetween(String value1, String value2) { + addCriterion("task_type not between", value1, value2, "taskType"); + return (Criteria) this; + } + + public Criteria andCallTimingIsNull() { + addCriterion("call_timing is null"); + return (Criteria) this; + } + + public Criteria andCallTimingIsNotNull() { + addCriterion("call_timing is not null"); + return (Criteria) this; + } + + public Criteria andCallTimingEqualTo(Long value) { + addCriterion("call_timing =", value, "callTiming"); + return (Criteria) this; + } + + public Criteria andCallTimingNotEqualTo(Long value) { + addCriterion("call_timing <>", value, "callTiming"); + return (Criteria) this; + } + + public Criteria andCallTimingGreaterThan(Long value) { + addCriterion("call_timing >", value, "callTiming"); + return (Criteria) this; + } + + public Criteria andCallTimingGreaterThanOrEqualTo(Long value) { + addCriterion("call_timing >=", value, "callTiming"); + return (Criteria) this; + } + + public Criteria andCallTimingLessThan(Long value) { + addCriterion("call_timing <", value, "callTiming"); + return (Criteria) this; + } + + public Criteria andCallTimingLessThanOrEqualTo(Long value) { + addCriterion("call_timing <=", value, "callTiming"); + return (Criteria) this; + } + + public Criteria andCallTimingIn(List values) { + addCriterion("call_timing in", values, "callTiming"); + return (Criteria) this; + } + + public Criteria andCallTimingNotIn(List values) { + addCriterion("call_timing not in", values, "callTiming"); + return (Criteria) this; + } + + public Criteria andCallTimingBetween(Long value1, Long value2) { + addCriterion("call_timing between", value1, value2, "callTiming"); + return (Criteria) this; + } + + public Criteria andCallTimingNotBetween(Long value1, Long value2) { + addCriterion("call_timing not between", value1, value2, "callTiming"); + return (Criteria) this; + } + + public Criteria andStartTimeIsNull() { + addCriterion("start_time is null"); + return (Criteria) this; + } + + public Criteria andStartTimeIsNotNull() { + addCriterion("start_time is not null"); + return (Criteria) this; + } + + public Criteria andStartTimeEqualTo(Long value) { + addCriterion("start_time =", value, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeNotEqualTo(Long value) { + addCriterion("start_time <>", value, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeGreaterThan(Long value) { + addCriterion("start_time >", value, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeGreaterThanOrEqualTo(Long value) { + addCriterion("start_time >=", value, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeLessThan(Long value) { + addCriterion("start_time <", value, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeLessThanOrEqualTo(Long value) { + addCriterion("start_time <=", value, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeIn(List values) { + addCriterion("start_time in", values, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeNotIn(List values) { + addCriterion("start_time not in", values, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeBetween(Long value1, Long value2) { + addCriterion("start_time between", value1, value2, "startTime"); + return (Criteria) this; + } + + public Criteria andStartTimeNotBetween(Long value1, Long value2) { + addCriterion("start_time not between", value1, value2, "startTime"); + return (Criteria) this; + } + + public Criteria andEndTimeIsNull() { + addCriterion("end_time is null"); + return (Criteria) this; + } + + public Criteria andEndTimeIsNotNull() { + addCriterion("end_time is not null"); + return (Criteria) this; + } + + public Criteria andEndTimeEqualTo(Long value) { + addCriterion("end_time =", value, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeNotEqualTo(Long value) { + addCriterion("end_time <>", value, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeGreaterThan(Long value) { + addCriterion("end_time >", value, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeGreaterThanOrEqualTo(Long value) { + addCriterion("end_time >=", value, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeLessThan(Long value) { + addCriterion("end_time <", value, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeLessThanOrEqualTo(Long value) { + addCriterion("end_time <=", value, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeIn(List values) { + addCriterion("end_time in", values, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeNotIn(List values) { + addCriterion("end_time not in", values, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeBetween(Long value1, Long value2) { + addCriterion("end_time between", value1, value2, "endTime"); + return (Criteria) this; + } + + public Criteria andEndTimeNotBetween(Long value1, Long value2) { + addCriterion("end_time not between", value1, value2, "endTime"); + return (Criteria) this; + } + + public Criteria andUseTimeIsNull() { + addCriterion("use_time is null"); + return (Criteria) this; + } + + public Criteria andUseTimeIsNotNull() { + addCriterion("use_time is not null"); + return (Criteria) this; + } + + public Criteria andUseTimeEqualTo(Long value) { + addCriterion("use_time =", value, "useTime"); + return (Criteria) this; + } + + public Criteria andUseTimeNotEqualTo(Long value) { + addCriterion("use_time <>", value, "useTime"); + return (Criteria) this; + } + + public Criteria andUseTimeGreaterThan(Long value) { + addCriterion("use_time >", value, "useTime"); + return (Criteria) this; + } + + public Criteria andUseTimeGreaterThanOrEqualTo(Long value) { + addCriterion("use_time >=", value, "useTime"); + return (Criteria) this; + } + + public Criteria andUseTimeLessThan(Long value) { + addCriterion("use_time <", value, "useTime"); + return (Criteria) this; + } + + public Criteria andUseTimeLessThanOrEqualTo(Long value) { + addCriterion("use_time <=", value, "useTime"); + return (Criteria) this; + } + + public Criteria andUseTimeIn(List values) { + addCriterion("use_time in", values, "useTime"); + return (Criteria) this; + } + + public Criteria andUseTimeNotIn(List values) { + addCriterion("use_time not in", values, "useTime"); + return (Criteria) this; + } + + public Criteria andUseTimeBetween(Long value1, Long value2) { + addCriterion("use_time between", value1, value2, "useTime"); + return (Criteria) this; + } + + public Criteria andUseTimeNotBetween(Long value1, Long value2) { + addCriterion("use_time not between", value1, value2, "useTime"); + return (Criteria) this; + } + + public Criteria andTotalCountIsNull() { + addCriterion("total_count is null"); + return (Criteria) this; + } + + public Criteria andTotalCountIsNotNull() { + addCriterion("total_count is not null"); + return (Criteria) this; + } + + public Criteria andTotalCountEqualTo(Integer value) { + addCriterion("total_count =", value, "totalCount"); + return (Criteria) this; + } + + public Criteria andTotalCountNotEqualTo(Integer value) { + addCriterion("total_count <>", value, "totalCount"); + return (Criteria) this; + } + + public Criteria andTotalCountGreaterThan(Integer value) { + addCriterion("total_count >", value, "totalCount"); + return (Criteria) this; + } + + public Criteria andTotalCountGreaterThanOrEqualTo(Integer value) { + addCriterion("total_count >=", value, "totalCount"); + return (Criteria) this; + } + + public Criteria andTotalCountLessThan(Integer value) { + addCriterion("total_count <", value, "totalCount"); + return (Criteria) this; + } + + public Criteria andTotalCountLessThanOrEqualTo(Integer value) { + addCriterion("total_count <=", value, "totalCount"); + return (Criteria) this; + } + + public Criteria andTotalCountIn(List values) { + addCriterion("total_count in", values, "totalCount"); + return (Criteria) this; + } + + public Criteria andTotalCountNotIn(List values) { + addCriterion("total_count not in", values, "totalCount"); + return (Criteria) this; + } + + public Criteria andTotalCountBetween(Integer value1, Integer value2) { + addCriterion("total_count between", value1, value2, "totalCount"); + return (Criteria) this; + } + + public Criteria andTotalCountNotBetween(Integer value1, Integer value2) { + addCriterion("total_count not between", value1, value2, "totalCount"); + return (Criteria) this; + } + + public Criteria andSuccessCountIsNull() { + addCriterion("success_count is null"); + return (Criteria) this; + } + + public Criteria andSuccessCountIsNotNull() { + addCriterion("success_count is not null"); + return (Criteria) this; + } + + public Criteria andSuccessCountEqualTo(Integer value) { + addCriterion("success_count =", value, "successCount"); + return (Criteria) this; + } + + public Criteria andSuccessCountNotEqualTo(Integer value) { + addCriterion("success_count <>", value, "successCount"); + return (Criteria) this; + } + + public Criteria andSuccessCountGreaterThan(Integer value) { + addCriterion("success_count >", value, "successCount"); + return (Criteria) this; + } + + public Criteria andSuccessCountGreaterThanOrEqualTo(Integer value) { + addCriterion("success_count >=", value, "successCount"); + return (Criteria) this; + } + + public Criteria andSuccessCountLessThan(Integer value) { + addCriterion("success_count <", value, "successCount"); + return (Criteria) this; + } + + public Criteria andSuccessCountLessThanOrEqualTo(Integer value) { + addCriterion("success_count <=", value, "successCount"); + return (Criteria) this; + } + + public Criteria andSuccessCountIn(List values) { + addCriterion("success_count in", values, "successCount"); + return (Criteria) this; + } + + public Criteria andSuccessCountNotIn(List values) { + addCriterion("success_count not in", values, "successCount"); + return (Criteria) this; + } + + public Criteria andSuccessCountBetween(Integer value1, Integer value2) { + addCriterion("success_count between", value1, value2, "successCount"); + return (Criteria) this; + } + + public Criteria andSuccessCountNotBetween(Integer value1, Integer value2) { + addCriterion("success_count not between", value1, value2, "successCount"); + return (Criteria) this; + } + + public Criteria andFailureCountIsNull() { + addCriterion("failure_count is null"); + return (Criteria) this; + } + + public Criteria andFailureCountIsNotNull() { + addCriterion("failure_count is not null"); + return (Criteria) this; + } + + public Criteria andFailureCountEqualTo(Integer value) { + addCriterion("failure_count =", value, "failureCount"); + return (Criteria) this; + } + + public Criteria andFailureCountNotEqualTo(Integer value) { + addCriterion("failure_count <>", value, "failureCount"); + return (Criteria) this; + } + + public Criteria andFailureCountGreaterThan(Integer value) { + addCriterion("failure_count >", value, "failureCount"); + return (Criteria) this; + } + + public Criteria andFailureCountGreaterThanOrEqualTo(Integer value) { + addCriterion("failure_count >=", value, "failureCount"); + return (Criteria) this; + } + + public Criteria andFailureCountLessThan(Integer value) { + addCriterion("failure_count <", value, "failureCount"); + return (Criteria) this; + } + + public Criteria andFailureCountLessThanOrEqualTo(Integer value) { + addCriterion("failure_count <=", value, "failureCount"); + return (Criteria) this; + } + + public Criteria andFailureCountIn(List values) { + addCriterion("failure_count in", values, "failureCount"); + return (Criteria) this; + } + + public Criteria andFailureCountNotIn(List values) { + addCriterion("failure_count not in", values, "failureCount"); + return (Criteria) this; + } + + public Criteria andFailureCountBetween(Integer value1, Integer value2) { + addCriterion("failure_count between", value1, value2, "failureCount"); + return (Criteria) this; + } + + public Criteria andFailureCountNotBetween(Integer value1, Integer value2) { + addCriterion("failure_count not between", value1, value2, "failureCount"); + return (Criteria) this; + } + + public Criteria andIgnoreCountIsNull() { + addCriterion("ignore_count is null"); + return (Criteria) this; + } + + public Criteria andIgnoreCountIsNotNull() { + addCriterion("ignore_count is not null"); + return (Criteria) this; + } + + public Criteria andIgnoreCountEqualTo(Integer value) { + addCriterion("ignore_count =", value, "ignoreCount"); + return (Criteria) this; + } + + public Criteria andIgnoreCountNotEqualTo(Integer value) { + addCriterion("ignore_count <>", value, "ignoreCount"); + return (Criteria) this; + } + + public Criteria andIgnoreCountGreaterThan(Integer value) { + addCriterion("ignore_count >", value, "ignoreCount"); + return (Criteria) this; + } + + public Criteria andIgnoreCountGreaterThanOrEqualTo(Integer value) { + addCriterion("ignore_count >=", value, "ignoreCount"); + return (Criteria) this; + } + + public Criteria andIgnoreCountLessThan(Integer value) { + addCriterion("ignore_count <", value, "ignoreCount"); + return (Criteria) this; + } + + public Criteria andIgnoreCountLessThanOrEqualTo(Integer value) { + addCriterion("ignore_count <=", value, "ignoreCount"); + return (Criteria) this; + } + + public Criteria andIgnoreCountIn(List values) { + addCriterion("ignore_count in", values, "ignoreCount"); + return (Criteria) this; + } + + public Criteria andIgnoreCountNotIn(List values) { + addCriterion("ignore_count not in", values, "ignoreCount"); + return (Criteria) this; + } + + public Criteria andIgnoreCountBetween(Integer value1, Integer value2) { + addCriterion("ignore_count between", value1, value2, "ignoreCount"); + return (Criteria) this; + } + + public Criteria andIgnoreCountNotBetween(Integer value1, Integer value2) { + addCriterion("ignore_count not between", value1, value2, "ignoreCount"); + return (Criteria) this; + } + + public Criteria andRetryCountIsNull() { + addCriterion("retry_count is null"); + return (Criteria) this; + } + + public Criteria andRetryCountIsNotNull() { + addCriterion("retry_count is not null"); + return (Criteria) this; + } + + public Criteria andRetryCountEqualTo(Integer value) { + addCriterion("retry_count =", value, "retryCount"); + return (Criteria) this; + } + + public Criteria andRetryCountNotEqualTo(Integer value) { + addCriterion("retry_count <>", value, "retryCount"); + return (Criteria) this; + } + + public Criteria andRetryCountGreaterThan(Integer value) { + addCriterion("retry_count >", value, "retryCount"); + return (Criteria) this; + } + + public Criteria andRetryCountGreaterThanOrEqualTo(Integer value) { + addCriterion("retry_count >=", value, "retryCount"); + return (Criteria) this; + } + + public Criteria andRetryCountLessThan(Integer value) { + addCriterion("retry_count <", value, "retryCount"); + return (Criteria) this; + } + + public Criteria andRetryCountLessThanOrEqualTo(Integer value) { + addCriterion("retry_count <=", value, "retryCount"); + return (Criteria) this; + } + + public Criteria andRetryCountIn(List values) { + addCriterion("retry_count in", values, "retryCount"); + return (Criteria) this; + } + + public Criteria andRetryCountNotIn(List values) { + addCriterion("retry_count not in", values, "retryCount"); + return (Criteria) this; + } + + public Criteria andRetryCountBetween(Integer value1, Integer value2) { + addCriterion("retry_count between", value1, value2, "retryCount"); + return (Criteria) this; + } + + public Criteria andRetryCountNotBetween(Integer value1, Integer value2) { + addCriterion("retry_count not between", value1, value2, "retryCount"); + return (Criteria) this; + } + + public Criteria andOptStatusIsNull() { + addCriterion("opt_status is null"); + return (Criteria) this; + } + + public Criteria andOptStatusIsNotNull() { + addCriterion("opt_status is not null"); + return (Criteria) this; + } + + public Criteria andOptStatusEqualTo(Integer value) { + addCriterion("opt_status =", value, "optStatus"); + return (Criteria) this; + } + + public Criteria andOptStatusNotEqualTo(Integer value) { + addCriterion("opt_status <>", value, "optStatus"); + return (Criteria) this; + } + + public Criteria andOptStatusGreaterThan(Integer value) { + addCriterion("opt_status >", value, "optStatus"); + return (Criteria) this; + } + + public Criteria andOptStatusGreaterThanOrEqualTo(Integer value) { + addCriterion("opt_status >=", value, "optStatus"); + return (Criteria) this; + } + + public Criteria andOptStatusLessThan(Integer value) { + addCriterion("opt_status <", value, "optStatus"); + return (Criteria) this; + } + + public Criteria andOptStatusLessThanOrEqualTo(Integer value) { + addCriterion("opt_status <=", value, "optStatus"); + return (Criteria) this; + } + + public Criteria andOptStatusIn(List values) { + addCriterion("opt_status in", values, "optStatus"); + return (Criteria) this; + } + + public Criteria andOptStatusNotIn(List values) { + addCriterion("opt_status not in", values, "optStatus"); + return (Criteria) this; + } + + public Criteria andOptStatusBetween(Integer value1, Integer value2) { + addCriterion("opt_status between", value1, value2, "optStatus"); + return (Criteria) this; + } + + public Criteria andOptStatusNotBetween(Integer value1, Integer value2) { + addCriterion("opt_status not between", value1, value2, "optStatus"); + return (Criteria) this; + } + + public Criteria andIsHiddenIsNull() { + addCriterion("is_hidden is null"); + return (Criteria) this; + } + + public Criteria andIsHiddenIsNotNull() { + addCriterion("is_hidden is not null"); + return (Criteria) this; + } + + public Criteria andIsHiddenEqualTo(Integer value) { + addCriterion("is_hidden =", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenNotEqualTo(Integer value) { + addCriterion("is_hidden <>", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenGreaterThan(Integer value) { + addCriterion("is_hidden >", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenGreaterThanOrEqualTo(Integer value) { + addCriterion("is_hidden >=", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenLessThan(Integer value) { + addCriterion("is_hidden <", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenLessThanOrEqualTo(Integer value) { + addCriterion("is_hidden <=", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenIn(List values) { + addCriterion("is_hidden in", values, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenNotIn(List values) { + addCriterion("is_hidden not in", values, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenBetween(Integer value1, Integer value2) { + addCriterion("is_hidden between", value1, value2, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenNotBetween(Integer value1, Integer value2) { + addCriterion("is_hidden not between", value1, value2, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsDeleteIsNull() { + addCriterion("is_delete is null"); + return (Criteria) this; + } + + public Criteria andIsDeleteIsNotNull() { + addCriterion("is_delete is not null"); + return (Criteria) this; + } + + public Criteria andIsDeleteEqualTo(Integer value) { + addCriterion("is_delete =", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteNotEqualTo(Integer value) { + addCriterion("is_delete <>", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteGreaterThan(Integer value) { + addCriterion("is_delete >", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteGreaterThanOrEqualTo(Integer value) { + addCriterion("is_delete >=", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteLessThan(Integer value) { + addCriterion("is_delete <", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteLessThanOrEqualTo(Integer value) { + addCriterion("is_delete <=", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteIn(List values) { + addCriterion("is_delete in", values, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteNotIn(List values) { + addCriterion("is_delete not in", values, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteBetween(Integer value1, Integer value2) { + addCriterion("is_delete between", value1, value2, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteNotBetween(Integer value1, Integer value2) { + addCriterion("is_delete not between", value1, value2, "isDelete"); + return (Criteria) this; + } + + public Criteria andDeleteTokenIsNull() { + addCriterion("delete_token is null"); + return (Criteria) this; + } + + public Criteria andDeleteTokenIsNotNull() { + addCriterion("delete_token is not null"); + return (Criteria) this; + } + + public Criteria andDeleteTokenEqualTo(String value) { + addCriterion("delete_token =", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotEqualTo(String value) { + addCriterion("delete_token <>", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenGreaterThan(String value) { + addCriterion("delete_token >", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenGreaterThanOrEqualTo(String value) { + addCriterion("delete_token >=", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenLessThan(String value) { + addCriterion("delete_token <", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenLessThanOrEqualTo(String value) { + addCriterion("delete_token <=", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenLike(String value) { + addCriterion("delete_token like", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotLike(String value) { + addCriterion("delete_token not like", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenIn(List values) { + addCriterion("delete_token in", values, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotIn(List values) { + addCriterion("delete_token not in", values, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenBetween(String value1, String value2) { + addCriterion("delete_token between", value1, value2, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotBetween(String value1, String value2) { + addCriterion("delete_token not between", value1, value2, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDataVersionIsNull() { + addCriterion("data_version is null"); + return (Criteria) this; + } + + public Criteria andDataVersionIsNotNull() { + addCriterion("data_version is not null"); + return (Criteria) this; + } + + public Criteria andDataVersionEqualTo(Integer value) { + addCriterion("data_version =", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionNotEqualTo(Integer value) { + addCriterion("data_version <>", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionGreaterThan(Integer value) { + addCriterion("data_version >", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionGreaterThanOrEqualTo(Integer value) { + addCriterion("data_version >=", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionLessThan(Integer value) { + addCriterion("data_version <", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionLessThanOrEqualTo(Integer value) { + addCriterion("data_version <=", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionIn(List values) { + addCriterion("data_version in", values, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionNotIn(List values) { + addCriterion("data_version not in", values, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionBetween(Integer value1, Integer value2) { + addCriterion("data_version between", value1, value2, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionNotBetween(Integer value1, Integer value2) { + addCriterion("data_version not between", value1, value2, "dataVersion"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Date value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Date value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Date value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Date value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Date value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Date value1, Date value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } + } + + /** + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_async_task_info + * + * @mbg.generated do_not_delete_during_merge + */ + public static class Criteria extends GeneratedCriteria { + protected Criteria() { + super(); + } + } + + /** + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_async_task_info + * + * @mbg.generated + */ + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/database/model/SystemCrawlerCacheData.java b/src/main/java/com/iqudoo/platform/application/database/model/SystemCrawlerCacheData.java new file mode 100644 index 0000000..daf085e --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/database/model/SystemCrawlerCacheData.java @@ -0,0 +1,434 @@ +package com.iqudoo.platform.application.database.model; + +import java.io.Serializable; +import java.util.Date; + +/** + * Database Table Remarks: + * 系统爬虫数据缓存信息 + * + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_crawler_cache_data + */ +public class SystemCrawlerCacheData implements Serializable { + /** + * Database Column Remarks: + * GUID + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_crawler_cache_data.guid + * + * @mbg.generated + */ + private Long guid; + + /** + * Database Column Remarks: + * 抓取时间 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_crawler_cache_data.crawler_time + * + * @mbg.generated + */ + private Long crawlerTime; + + /** + * Database Column Remarks: + * 抓取类型 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_crawler_cache_data.crawler_type + * + * @mbg.generated + */ + private String crawlerType; + + /** + * Database Column Remarks: + * 抓取关键词 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_crawler_cache_data.crawler_keyword + * + * @mbg.generated + */ + private String crawlerKeyword; + + /** + * Database Column Remarks: + * 隐藏标志 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_crawler_cache_data.is_hidden + * + * @mbg.generated + */ + private Integer isHidden; + + /** + * Database Column Remarks: + * 删除标志 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_crawler_cache_data.is_delete + * + * @mbg.generated + */ + private Integer isDelete; + + /** + * Database Column Remarks: + * 删除令牌 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_crawler_cache_data.delete_token + * + * @mbg.generated + */ + private String deleteToken; + + /** + * Database Column Remarks: + * 数据版本 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_crawler_cache_data.data_version + * + * @mbg.generated + */ + private Integer dataVersion; + + /** + * Database Column Remarks: + * 创建时间 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_crawler_cache_data.create_time + * + * @mbg.generated + */ + private Date createTime; + + /** + * Database Column Remarks: + * 更新时间 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_crawler_cache_data.update_time + * + * @mbg.generated + */ + private Date updateTime; + + /** + * Database Column Remarks: + * 缓存内容 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_crawler_cache_data.cache_data + * + * @mbg.generated + */ + private String cacheData; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + private static final long serialVersionUID = 1L; + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_crawler_cache_data.guid + * + * @return the value of t_system_crawler_cache_data.guid + * + * @mbg.generated + */ + public Long getGuid() { + return guid; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_crawler_cache_data.guid + * + * @param guid the value for t_system_crawler_cache_data.guid + * + * @mbg.generated + */ + public void setGuid(Long guid) { + this.guid = guid; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_crawler_cache_data.crawler_time + * + * @return the value of t_system_crawler_cache_data.crawler_time + * + * @mbg.generated + */ + public Long getCrawlerTime() { + return crawlerTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_crawler_cache_data.crawler_time + * + * @param crawlerTime the value for t_system_crawler_cache_data.crawler_time + * + * @mbg.generated + */ + public void setCrawlerTime(Long crawlerTime) { + this.crawlerTime = crawlerTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_crawler_cache_data.crawler_type + * + * @return the value of t_system_crawler_cache_data.crawler_type + * + * @mbg.generated + */ + public String getCrawlerType() { + return crawlerType; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_crawler_cache_data.crawler_type + * + * @param crawlerType the value for t_system_crawler_cache_data.crawler_type + * + * @mbg.generated + */ + public void setCrawlerType(String crawlerType) { + this.crawlerType = crawlerType == null ? null : crawlerType.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_crawler_cache_data.crawler_keyword + * + * @return the value of t_system_crawler_cache_data.crawler_keyword + * + * @mbg.generated + */ + public String getCrawlerKeyword() { + return crawlerKeyword; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_crawler_cache_data.crawler_keyword + * + * @param crawlerKeyword the value for t_system_crawler_cache_data.crawler_keyword + * + * @mbg.generated + */ + public void setCrawlerKeyword(String crawlerKeyword) { + this.crawlerKeyword = crawlerKeyword == null ? null : crawlerKeyword.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_crawler_cache_data.is_hidden + * + * @return the value of t_system_crawler_cache_data.is_hidden + * + * @mbg.generated + */ + public Integer getIsHidden() { + return isHidden; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_crawler_cache_data.is_hidden + * + * @param isHidden the value for t_system_crawler_cache_data.is_hidden + * + * @mbg.generated + */ + public void setIsHidden(Integer isHidden) { + this.isHidden = isHidden; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_crawler_cache_data.is_delete + * + * @return the value of t_system_crawler_cache_data.is_delete + * + * @mbg.generated + */ + public Integer getIsDelete() { + return isDelete; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_crawler_cache_data.is_delete + * + * @param isDelete the value for t_system_crawler_cache_data.is_delete + * + * @mbg.generated + */ + public void setIsDelete(Integer isDelete) { + this.isDelete = isDelete; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_crawler_cache_data.delete_token + * + * @return the value of t_system_crawler_cache_data.delete_token + * + * @mbg.generated + */ + public String getDeleteToken() { + return deleteToken; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_crawler_cache_data.delete_token + * + * @param deleteToken the value for t_system_crawler_cache_data.delete_token + * + * @mbg.generated + */ + public void setDeleteToken(String deleteToken) { + this.deleteToken = deleteToken == null ? null : deleteToken.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_crawler_cache_data.data_version + * + * @return the value of t_system_crawler_cache_data.data_version + * + * @mbg.generated + */ + public Integer getDataVersion() { + return dataVersion; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_crawler_cache_data.data_version + * + * @param dataVersion the value for t_system_crawler_cache_data.data_version + * + * @mbg.generated + */ + public void setDataVersion(Integer dataVersion) { + this.dataVersion = dataVersion; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_crawler_cache_data.create_time + * + * @return the value of t_system_crawler_cache_data.create_time + * + * @mbg.generated + */ + public Date getCreateTime() { + return createTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_crawler_cache_data.create_time + * + * @param createTime the value for t_system_crawler_cache_data.create_time + * + * @mbg.generated + */ + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_crawler_cache_data.update_time + * + * @return the value of t_system_crawler_cache_data.update_time + * + * @mbg.generated + */ + public Date getUpdateTime() { + return updateTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_crawler_cache_data.update_time + * + * @param updateTime the value for t_system_crawler_cache_data.update_time + * + * @mbg.generated + */ + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_crawler_cache_data.cache_data + * + * @return the value of t_system_crawler_cache_data.cache_data + * + * @mbg.generated + */ + public String getCacheData() { + return cacheData; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_crawler_cache_data.cache_data + * + * @param cacheData the value for t_system_crawler_cache_data.cache_data + * + * @mbg.generated + */ + public void setCacheData(String cacheData) { + this.cacheData = cacheData == null ? null : cacheData.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", guid=").append(guid); + sb.append(", crawlerTime=").append(crawlerTime); + sb.append(", crawlerType=").append(crawlerType); + sb.append(", crawlerKeyword=").append(crawlerKeyword); + sb.append(", isHidden=").append(isHidden); + sb.append(", isDelete=").append(isDelete); + sb.append(", deleteToken=").append(deleteToken); + sb.append(", dataVersion=").append(dataVersion); + sb.append(", createTime=").append(createTime); + sb.append(", updateTime=").append(updateTime); + sb.append(", cacheData=").append(cacheData); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/database/model/SystemCrawlerCacheDataExample.java b/src/main/java/com/iqudoo/platform/application/database/model/SystemCrawlerCacheDataExample.java new file mode 100644 index 0000000..5ba34b6 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/database/model/SystemCrawlerCacheDataExample.java @@ -0,0 +1,1126 @@ +package com.iqudoo.platform.application.database.model; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Objects; + +public class SystemCrawlerCacheDataExample { + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + protected String orderByClause; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + protected boolean distinct; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + protected List oredCriteria; + + protected String resultType = null; + + protected Integer maxPageSize = 100; + + protected Integer ignorePageSize = 10000; + + protected Integer startPageNum = 1; + + protected Integer offset = null; + + protected Integer rows = null; + + protected Boolean withBLOBs = true; + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + public SystemCrawlerCacheDataExample() { + oredCriteria = new ArrayList<>(); + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + public String getOrderByClause() { + return orderByClause; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + public boolean isDistinct() { + return distinct; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + public List getOredCriteria() { + return oredCriteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + rows = null; + offset = null; + resultType = null; + } + + public void setWithBLOBs(Boolean withBLOBs) { + this.withBLOBs = withBLOBs; + } + + public boolean isWithBLOBs() { + return this.withBLOBs != null && this.withBLOBs; + } + + public void setMaxPageSize(Integer maxPageSize) { + this.maxPageSize = maxPageSize; + } + + public Integer getMaxPageSize() { + return this.maxPageSize; + } + + public void setIgnorePageSize(Integer ignorePageSize) { + this.ignorePageSize = ignorePageSize; + } + + public Integer getIgnorePageSize() { + return this.ignorePageSize; + } + + public void setStartPageNum(Integer startPageNum) { + this.startPageNum = startPageNum; + } + + public Integer getStartPageNum() { + return this.startPageNum; + } + + public SystemCrawlerCacheDataExample setResultType(String type) { + this.resultType = type; + return this; + } + + public SystemCrawlerCacheDataExample resultValid() { + this.resultType = "valid"; + return this; + } + + public Boolean isResultValid() { + return !this.isResultAny() && !this.isResultTrash(); + } + + public SystemCrawlerCacheDataExample resultTrash() { + this.resultType = "trash"; + return this; + } + + public Boolean isResultTrash() { + return Objects.equals(this.resultType, "trash"); + } + + public SystemCrawlerCacheDataExample resultAny() { + this.resultType = "any"; + return this; + } + + public Boolean isResultAny() { + return Objects.equals(this.resultType, "any"); + } + + public SystemCrawlerCacheDataExample limit(Integer rows) { + this.offset = null; + this.rows = rows; + return this; + } + + public SystemCrawlerCacheDataExample limit(Integer offset, Integer rows) { + this.offset = offset; + this.rows = rows; + return this; + } + + public SystemCrawlerCacheDataExample limitOffset(Integer offset, Integer rows) { + this.offset = offset; + this.rows = 999999999; + return this; + } + + public SystemCrawlerCacheDataExample usePage(Integer pageNum, Integer pageSize) { + pageSize = pageSize == null || pageSize <= 0 ? 1 : pageSize; + pageNum = pageNum == null || pageNum < this.startPageNum ? this.startPageNum : pageNum; + if (pageSize >= this.ignorePageSize) { + this.rows = null; + this.offset = null; + return this; + } + int cPageSize = pageSize > this.maxPageSize ? this.maxPageSize: pageSize; + this.offset = (pageNum - this.startPageNum) * cPageSize; + this.rows = cPageSize; + return this; + } + + public Integer getPageNum() { + if (this.rows == null || this.offset == null || this.rows == 0) { + return this.startPageNum; + } + return this.offset / this.rows + this.startPageNum; + } + + public Integer getPageSize() { + if (this.rows == null) { + return this.ignorePageSize; + } + return this.rows; + } + + public Integer getRows() { + return this.rows; + } + + public Integer getOffset() { + return this.offset; + } + + public String getLimitString() { + if (getRows() != null) { + if (getOffset() != null) { + return getOffset() + "," + getRows(); + } else { + return getRows() + ""; + } + } + return null; + } + + public String getWhereString() { + if (getOredCriteria() != null) { + List whereGroup = new ArrayList<>(); + for (Criteria criteria : getOredCriteria()) { + List criterionList = new ArrayList<>(); + for (Criterion criterion : criteria.getAllCriteria()) { + if (criterion.isNoValue()) { + criterionList.add(criterion.getCondition()); + } else if (criterion.isBetweenValue()) { + criterionList.add(criterion.getCondition() + " " + criterion.getValue() + "," + criterion.getSecondValue()); + } else { + criterionList.add(criterion.getCondition() + " " + criterion.getValue()); + } + } + whereGroup.add(String.join(" and ", criterionList)); + } + if (whereGroup.size() > 1) { + List mapWhereGroup = new ArrayList<>(); + for (String where : whereGroup) { + mapWhereGroup.add("(" + where + ")"); + } + whereGroup = mapWhereGroup; + } + return String.join(" or ", whereGroup); + } + return null; + } + + public SystemCrawlerCacheDataExample cloneExample() { + SystemCrawlerCacheDataExample newExample = new SystemCrawlerCacheDataExample(); + newExample.rows = this.rows; + newExample.offset = this.offset; + newExample.maxPageSize = this.maxPageSize; + newExample.ignorePageSize = this.ignorePageSize; + newExample.startPageNum = this.startPageNum; + newExample.resultType = this.resultType; + newExample.withBLOBs = withBLOBs; + if (this.getOredCriteria() != null && !this.getOredCriteria().isEmpty()) { + for (SystemCrawlerCacheDataExample.Criteria oldCriteria : this.getOredCriteria()) { + SystemCrawlerCacheDataExample.Criteria newCriteria = newExample.or(); + newCriteria.getCriteria().addAll(oldCriteria.getCriteria()); + } + } + newExample.setOrderByClause(this.getOrderByClause()); + return newExample; + } + + /** + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList<>(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andGuidIsNull() { + addCriterion("guid is null"); + return (Criteria) this; + } + + public Criteria andGuidIsNotNull() { + addCriterion("guid is not null"); + return (Criteria) this; + } + + public Criteria andGuidEqualTo(Long value) { + addCriterion("guid =", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidNotEqualTo(Long value) { + addCriterion("guid <>", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidGreaterThan(Long value) { + addCriterion("guid >", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidGreaterThanOrEqualTo(Long value) { + addCriterion("guid >=", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidLessThan(Long value) { + addCriterion("guid <", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidLessThanOrEqualTo(Long value) { + addCriterion("guid <=", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidIn(List values) { + addCriterion("guid in", values, "guid"); + return (Criteria) this; + } + + public Criteria andGuidNotIn(List values) { + addCriterion("guid not in", values, "guid"); + return (Criteria) this; + } + + public Criteria andGuidBetween(Long value1, Long value2) { + addCriterion("guid between", value1, value2, "guid"); + return (Criteria) this; + } + + public Criteria andGuidNotBetween(Long value1, Long value2) { + addCriterion("guid not between", value1, value2, "guid"); + return (Criteria) this; + } + + public Criteria andCrawlerTimeIsNull() { + addCriterion("crawler_time is null"); + return (Criteria) this; + } + + public Criteria andCrawlerTimeIsNotNull() { + addCriterion("crawler_time is not null"); + return (Criteria) this; + } + + public Criteria andCrawlerTimeEqualTo(Long value) { + addCriterion("crawler_time =", value, "crawlerTime"); + return (Criteria) this; + } + + public Criteria andCrawlerTimeNotEqualTo(Long value) { + addCriterion("crawler_time <>", value, "crawlerTime"); + return (Criteria) this; + } + + public Criteria andCrawlerTimeGreaterThan(Long value) { + addCriterion("crawler_time >", value, "crawlerTime"); + return (Criteria) this; + } + + public Criteria andCrawlerTimeGreaterThanOrEqualTo(Long value) { + addCriterion("crawler_time >=", value, "crawlerTime"); + return (Criteria) this; + } + + public Criteria andCrawlerTimeLessThan(Long value) { + addCriterion("crawler_time <", value, "crawlerTime"); + return (Criteria) this; + } + + public Criteria andCrawlerTimeLessThanOrEqualTo(Long value) { + addCriterion("crawler_time <=", value, "crawlerTime"); + return (Criteria) this; + } + + public Criteria andCrawlerTimeIn(List values) { + addCriterion("crawler_time in", values, "crawlerTime"); + return (Criteria) this; + } + + public Criteria andCrawlerTimeNotIn(List values) { + addCriterion("crawler_time not in", values, "crawlerTime"); + return (Criteria) this; + } + + public Criteria andCrawlerTimeBetween(Long value1, Long value2) { + addCriterion("crawler_time between", value1, value2, "crawlerTime"); + return (Criteria) this; + } + + public Criteria andCrawlerTimeNotBetween(Long value1, Long value2) { + addCriterion("crawler_time not between", value1, value2, "crawlerTime"); + return (Criteria) this; + } + + public Criteria andCrawlerTypeIsNull() { + addCriterion("crawler_type is null"); + return (Criteria) this; + } + + public Criteria andCrawlerTypeIsNotNull() { + addCriterion("crawler_type is not null"); + return (Criteria) this; + } + + public Criteria andCrawlerTypeEqualTo(String value) { + addCriterion("crawler_type =", value, "crawlerType"); + return (Criteria) this; + } + + public Criteria andCrawlerTypeNotEqualTo(String value) { + addCriterion("crawler_type <>", value, "crawlerType"); + return (Criteria) this; + } + + public Criteria andCrawlerTypeGreaterThan(String value) { + addCriterion("crawler_type >", value, "crawlerType"); + return (Criteria) this; + } + + public Criteria andCrawlerTypeGreaterThanOrEqualTo(String value) { + addCriterion("crawler_type >=", value, "crawlerType"); + return (Criteria) this; + } + + public Criteria andCrawlerTypeLessThan(String value) { + addCriterion("crawler_type <", value, "crawlerType"); + return (Criteria) this; + } + + public Criteria andCrawlerTypeLessThanOrEqualTo(String value) { + addCriterion("crawler_type <=", value, "crawlerType"); + return (Criteria) this; + } + + public Criteria andCrawlerTypeLike(String value) { + addCriterion("crawler_type like", value, "crawlerType"); + return (Criteria) this; + } + + public Criteria andCrawlerTypeNotLike(String value) { + addCriterion("crawler_type not like", value, "crawlerType"); + return (Criteria) this; + } + + public Criteria andCrawlerTypeIn(List values) { + addCriterion("crawler_type in", values, "crawlerType"); + return (Criteria) this; + } + + public Criteria andCrawlerTypeNotIn(List values) { + addCriterion("crawler_type not in", values, "crawlerType"); + return (Criteria) this; + } + + public Criteria andCrawlerTypeBetween(String value1, String value2) { + addCriterion("crawler_type between", value1, value2, "crawlerType"); + return (Criteria) this; + } + + public Criteria andCrawlerTypeNotBetween(String value1, String value2) { + addCriterion("crawler_type not between", value1, value2, "crawlerType"); + return (Criteria) this; + } + + public Criteria andCrawlerKeywordIsNull() { + addCriterion("crawler_keyword is null"); + return (Criteria) this; + } + + public Criteria andCrawlerKeywordIsNotNull() { + addCriterion("crawler_keyword is not null"); + return (Criteria) this; + } + + public Criteria andCrawlerKeywordEqualTo(String value) { + addCriterion("crawler_keyword =", value, "crawlerKeyword"); + return (Criteria) this; + } + + public Criteria andCrawlerKeywordNotEqualTo(String value) { + addCriterion("crawler_keyword <>", value, "crawlerKeyword"); + return (Criteria) this; + } + + public Criteria andCrawlerKeywordGreaterThan(String value) { + addCriterion("crawler_keyword >", value, "crawlerKeyword"); + return (Criteria) this; + } + + public Criteria andCrawlerKeywordGreaterThanOrEqualTo(String value) { + addCriterion("crawler_keyword >=", value, "crawlerKeyword"); + return (Criteria) this; + } + + public Criteria andCrawlerKeywordLessThan(String value) { + addCriterion("crawler_keyword <", value, "crawlerKeyword"); + return (Criteria) this; + } + + public Criteria andCrawlerKeywordLessThanOrEqualTo(String value) { + addCriterion("crawler_keyword <=", value, "crawlerKeyword"); + return (Criteria) this; + } + + public Criteria andCrawlerKeywordLike(String value) { + addCriterion("crawler_keyword like", value, "crawlerKeyword"); + return (Criteria) this; + } + + public Criteria andCrawlerKeywordNotLike(String value) { + addCriterion("crawler_keyword not like", value, "crawlerKeyword"); + return (Criteria) this; + } + + public Criteria andCrawlerKeywordIn(List values) { + addCriterion("crawler_keyword in", values, "crawlerKeyword"); + return (Criteria) this; + } + + public Criteria andCrawlerKeywordNotIn(List values) { + addCriterion("crawler_keyword not in", values, "crawlerKeyword"); + return (Criteria) this; + } + + public Criteria andCrawlerKeywordBetween(String value1, String value2) { + addCriterion("crawler_keyword between", value1, value2, "crawlerKeyword"); + return (Criteria) this; + } + + public Criteria andCrawlerKeywordNotBetween(String value1, String value2) { + addCriterion("crawler_keyword not between", value1, value2, "crawlerKeyword"); + return (Criteria) this; + } + + public Criteria andIsHiddenIsNull() { + addCriterion("is_hidden is null"); + return (Criteria) this; + } + + public Criteria andIsHiddenIsNotNull() { + addCriterion("is_hidden is not null"); + return (Criteria) this; + } + + public Criteria andIsHiddenEqualTo(Integer value) { + addCriterion("is_hidden =", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenNotEqualTo(Integer value) { + addCriterion("is_hidden <>", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenGreaterThan(Integer value) { + addCriterion("is_hidden >", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenGreaterThanOrEqualTo(Integer value) { + addCriterion("is_hidden >=", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenLessThan(Integer value) { + addCriterion("is_hidden <", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenLessThanOrEqualTo(Integer value) { + addCriterion("is_hidden <=", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenIn(List values) { + addCriterion("is_hidden in", values, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenNotIn(List values) { + addCriterion("is_hidden not in", values, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenBetween(Integer value1, Integer value2) { + addCriterion("is_hidden between", value1, value2, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenNotBetween(Integer value1, Integer value2) { + addCriterion("is_hidden not between", value1, value2, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsDeleteIsNull() { + addCriterion("is_delete is null"); + return (Criteria) this; + } + + public Criteria andIsDeleteIsNotNull() { + addCriterion("is_delete is not null"); + return (Criteria) this; + } + + public Criteria andIsDeleteEqualTo(Integer value) { + addCriterion("is_delete =", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteNotEqualTo(Integer value) { + addCriterion("is_delete <>", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteGreaterThan(Integer value) { + addCriterion("is_delete >", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteGreaterThanOrEqualTo(Integer value) { + addCriterion("is_delete >=", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteLessThan(Integer value) { + addCriterion("is_delete <", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteLessThanOrEqualTo(Integer value) { + addCriterion("is_delete <=", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteIn(List values) { + addCriterion("is_delete in", values, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteNotIn(List values) { + addCriterion("is_delete not in", values, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteBetween(Integer value1, Integer value2) { + addCriterion("is_delete between", value1, value2, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteNotBetween(Integer value1, Integer value2) { + addCriterion("is_delete not between", value1, value2, "isDelete"); + return (Criteria) this; + } + + public Criteria andDeleteTokenIsNull() { + addCriterion("delete_token is null"); + return (Criteria) this; + } + + public Criteria andDeleteTokenIsNotNull() { + addCriterion("delete_token is not null"); + return (Criteria) this; + } + + public Criteria andDeleteTokenEqualTo(String value) { + addCriterion("delete_token =", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotEqualTo(String value) { + addCriterion("delete_token <>", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenGreaterThan(String value) { + addCriterion("delete_token >", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenGreaterThanOrEqualTo(String value) { + addCriterion("delete_token >=", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenLessThan(String value) { + addCriterion("delete_token <", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenLessThanOrEqualTo(String value) { + addCriterion("delete_token <=", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenLike(String value) { + addCriterion("delete_token like", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotLike(String value) { + addCriterion("delete_token not like", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenIn(List values) { + addCriterion("delete_token in", values, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotIn(List values) { + addCriterion("delete_token not in", values, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenBetween(String value1, String value2) { + addCriterion("delete_token between", value1, value2, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotBetween(String value1, String value2) { + addCriterion("delete_token not between", value1, value2, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDataVersionIsNull() { + addCriterion("data_version is null"); + return (Criteria) this; + } + + public Criteria andDataVersionIsNotNull() { + addCriterion("data_version is not null"); + return (Criteria) this; + } + + public Criteria andDataVersionEqualTo(Integer value) { + addCriterion("data_version =", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionNotEqualTo(Integer value) { + addCriterion("data_version <>", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionGreaterThan(Integer value) { + addCriterion("data_version >", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionGreaterThanOrEqualTo(Integer value) { + addCriterion("data_version >=", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionLessThan(Integer value) { + addCriterion("data_version <", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionLessThanOrEqualTo(Integer value) { + addCriterion("data_version <=", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionIn(List values) { + addCriterion("data_version in", values, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionNotIn(List values) { + addCriterion("data_version not in", values, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionBetween(Integer value1, Integer value2) { + addCriterion("data_version between", value1, value2, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionNotBetween(Integer value1, Integer value2) { + addCriterion("data_version not between", value1, value2, "dataVersion"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Date value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Date value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Date value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Date value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Date value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Date value1, Date value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } + } + + /** + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated do_not_delete_during_merge + */ + public static class Criteria extends GeneratedCriteria { + protected Criteria() { + super(); + } + } + + /** + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_crawler_cache_data + * + * @mbg.generated + */ + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalCache.java b/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalCache.java new file mode 100644 index 0000000..5752803 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalCache.java @@ -0,0 +1,434 @@ +package com.iqudoo.platform.application.database.model; + +import java.io.Serializable; +import java.util.Date; + +/** + * Database Table Remarks: + * 系统通用缓存信息表 + * + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_global_cache + */ +public class SystemGlobalCache implements Serializable { + /** + * Database Column Remarks: + * GUID + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_cache.guid + * + * @mbg.generated + */ + private Long guid; + + /** + * Database Column Remarks: + * 缓存时间 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_cache.cache_time + * + * @mbg.generated + */ + private Long cacheTime; + + /** + * Database Column Remarks: + * 过期时间 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_cache.expire_time + * + * @mbg.generated + */ + private Long expireTime; + + /** + * Database Column Remarks: + * 缓存主键 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_cache.cache_key + * + * @mbg.generated + */ + private String cacheKey; + + /** + * Database Column Remarks: + * 隐藏标志 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_cache.is_hidden + * + * @mbg.generated + */ + private Integer isHidden; + + /** + * Database Column Remarks: + * 删除标志 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_cache.is_delete + * + * @mbg.generated + */ + private Integer isDelete; + + /** + * Database Column Remarks: + * 删除令牌 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_cache.delete_token + * + * @mbg.generated + */ + private String deleteToken; + + /** + * Database Column Remarks: + * 数据版本 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_cache.data_version + * + * @mbg.generated + */ + private Integer dataVersion; + + /** + * Database Column Remarks: + * 创建时间 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_cache.create_time + * + * @mbg.generated + */ + private Date createTime; + + /** + * Database Column Remarks: + * 更新时间 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_cache.update_time + * + * @mbg.generated + */ + private Date updateTime; + + /** + * Database Column Remarks: + * 缓存内容 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_cache.cache_data + * + * @mbg.generated + */ + private String cacheData; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + private static final long serialVersionUID = 1L; + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_cache.guid + * + * @return the value of t_system_global_cache.guid + * + * @mbg.generated + */ + public Long getGuid() { + return guid; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_cache.guid + * + * @param guid the value for t_system_global_cache.guid + * + * @mbg.generated + */ + public void setGuid(Long guid) { + this.guid = guid; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_cache.cache_time + * + * @return the value of t_system_global_cache.cache_time + * + * @mbg.generated + */ + public Long getCacheTime() { + return cacheTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_cache.cache_time + * + * @param cacheTime the value for t_system_global_cache.cache_time + * + * @mbg.generated + */ + public void setCacheTime(Long cacheTime) { + this.cacheTime = cacheTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_cache.expire_time + * + * @return the value of t_system_global_cache.expire_time + * + * @mbg.generated + */ + public Long getExpireTime() { + return expireTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_cache.expire_time + * + * @param expireTime the value for t_system_global_cache.expire_time + * + * @mbg.generated + */ + public void setExpireTime(Long expireTime) { + this.expireTime = expireTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_cache.cache_key + * + * @return the value of t_system_global_cache.cache_key + * + * @mbg.generated + */ + public String getCacheKey() { + return cacheKey; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_cache.cache_key + * + * @param cacheKey the value for t_system_global_cache.cache_key + * + * @mbg.generated + */ + public void setCacheKey(String cacheKey) { + this.cacheKey = cacheKey == null ? null : cacheKey.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_cache.is_hidden + * + * @return the value of t_system_global_cache.is_hidden + * + * @mbg.generated + */ + public Integer getIsHidden() { + return isHidden; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_cache.is_hidden + * + * @param isHidden the value for t_system_global_cache.is_hidden + * + * @mbg.generated + */ + public void setIsHidden(Integer isHidden) { + this.isHidden = isHidden; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_cache.is_delete + * + * @return the value of t_system_global_cache.is_delete + * + * @mbg.generated + */ + public Integer getIsDelete() { + return isDelete; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_cache.is_delete + * + * @param isDelete the value for t_system_global_cache.is_delete + * + * @mbg.generated + */ + public void setIsDelete(Integer isDelete) { + this.isDelete = isDelete; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_cache.delete_token + * + * @return the value of t_system_global_cache.delete_token + * + * @mbg.generated + */ + public String getDeleteToken() { + return deleteToken; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_cache.delete_token + * + * @param deleteToken the value for t_system_global_cache.delete_token + * + * @mbg.generated + */ + public void setDeleteToken(String deleteToken) { + this.deleteToken = deleteToken == null ? null : deleteToken.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_cache.data_version + * + * @return the value of t_system_global_cache.data_version + * + * @mbg.generated + */ + public Integer getDataVersion() { + return dataVersion; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_cache.data_version + * + * @param dataVersion the value for t_system_global_cache.data_version + * + * @mbg.generated + */ + public void setDataVersion(Integer dataVersion) { + this.dataVersion = dataVersion; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_cache.create_time + * + * @return the value of t_system_global_cache.create_time + * + * @mbg.generated + */ + public Date getCreateTime() { + return createTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_cache.create_time + * + * @param createTime the value for t_system_global_cache.create_time + * + * @mbg.generated + */ + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_cache.update_time + * + * @return the value of t_system_global_cache.update_time + * + * @mbg.generated + */ + public Date getUpdateTime() { + return updateTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_cache.update_time + * + * @param updateTime the value for t_system_global_cache.update_time + * + * @mbg.generated + */ + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_cache.cache_data + * + * @return the value of t_system_global_cache.cache_data + * + * @mbg.generated + */ + public String getCacheData() { + return cacheData; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_cache.cache_data + * + * @param cacheData the value for t_system_global_cache.cache_data + * + * @mbg.generated + */ + public void setCacheData(String cacheData) { + this.cacheData = cacheData == null ? null : cacheData.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", guid=").append(guid); + sb.append(", cacheTime=").append(cacheTime); + sb.append(", expireTime=").append(expireTime); + sb.append(", cacheKey=").append(cacheKey); + sb.append(", isHidden=").append(isHidden); + sb.append(", isDelete=").append(isDelete); + sb.append(", deleteToken=").append(deleteToken); + sb.append(", dataVersion=").append(dataVersion); + sb.append(", createTime=").append(createTime); + sb.append(", updateTime=").append(updateTime); + sb.append(", cacheData=").append(cacheData); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalCacheExample.java b/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalCacheExample.java new file mode 100644 index 0000000..f3b57b8 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalCacheExample.java @@ -0,0 +1,1116 @@ +package com.iqudoo.platform.application.database.model; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Objects; + +public class SystemGlobalCacheExample { + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + protected String orderByClause; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + protected boolean distinct; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + protected List oredCriteria; + + protected String resultType = null; + + protected Integer maxPageSize = 100; + + protected Integer ignorePageSize = 10000; + + protected Integer startPageNum = 1; + + protected Integer offset = null; + + protected Integer rows = null; + + protected Boolean withBLOBs = true; + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + public SystemGlobalCacheExample() { + oredCriteria = new ArrayList<>(); + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + public String getOrderByClause() { + return orderByClause; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + public boolean isDistinct() { + return distinct; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + public List getOredCriteria() { + return oredCriteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + rows = null; + offset = null; + resultType = null; + } + + public void setWithBLOBs(Boolean withBLOBs) { + this.withBLOBs = withBLOBs; + } + + public boolean isWithBLOBs() { + return this.withBLOBs != null && this.withBLOBs; + } + + public void setMaxPageSize(Integer maxPageSize) { + this.maxPageSize = maxPageSize; + } + + public Integer getMaxPageSize() { + return this.maxPageSize; + } + + public void setIgnorePageSize(Integer ignorePageSize) { + this.ignorePageSize = ignorePageSize; + } + + public Integer getIgnorePageSize() { + return this.ignorePageSize; + } + + public void setStartPageNum(Integer startPageNum) { + this.startPageNum = startPageNum; + } + + public Integer getStartPageNum() { + return this.startPageNum; + } + + public SystemGlobalCacheExample setResultType(String type) { + this.resultType = type; + return this; + } + + public SystemGlobalCacheExample resultValid() { + this.resultType = "valid"; + return this; + } + + public Boolean isResultValid() { + return !this.isResultAny() && !this.isResultTrash(); + } + + public SystemGlobalCacheExample resultTrash() { + this.resultType = "trash"; + return this; + } + + public Boolean isResultTrash() { + return Objects.equals(this.resultType, "trash"); + } + + public SystemGlobalCacheExample resultAny() { + this.resultType = "any"; + return this; + } + + public Boolean isResultAny() { + return Objects.equals(this.resultType, "any"); + } + + public SystemGlobalCacheExample limit(Integer rows) { + this.offset = null; + this.rows = rows; + return this; + } + + public SystemGlobalCacheExample limit(Integer offset, Integer rows) { + this.offset = offset; + this.rows = rows; + return this; + } + + public SystemGlobalCacheExample limitOffset(Integer offset, Integer rows) { + this.offset = offset; + this.rows = 999999999; + return this; + } + + public SystemGlobalCacheExample usePage(Integer pageNum, Integer pageSize) { + pageSize = pageSize == null || pageSize <= 0 ? 1 : pageSize; + pageNum = pageNum == null || pageNum < this.startPageNum ? this.startPageNum : pageNum; + if (pageSize >= this.ignorePageSize) { + this.rows = null; + this.offset = null; + return this; + } + int cPageSize = pageSize > this.maxPageSize ? this.maxPageSize: pageSize; + this.offset = (pageNum - this.startPageNum) * cPageSize; + this.rows = cPageSize; + return this; + } + + public Integer getPageNum() { + if (this.rows == null || this.offset == null || this.rows == 0) { + return this.startPageNum; + } + return this.offset / this.rows + this.startPageNum; + } + + public Integer getPageSize() { + if (this.rows == null) { + return this.ignorePageSize; + } + return this.rows; + } + + public Integer getRows() { + return this.rows; + } + + public Integer getOffset() { + return this.offset; + } + + public String getLimitString() { + if (getRows() != null) { + if (getOffset() != null) { + return getOffset() + "," + getRows(); + } else { + return getRows() + ""; + } + } + return null; + } + + public String getWhereString() { + if (getOredCriteria() != null) { + List whereGroup = new ArrayList<>(); + for (Criteria criteria : getOredCriteria()) { + List criterionList = new ArrayList<>(); + for (Criterion criterion : criteria.getAllCriteria()) { + if (criterion.isNoValue()) { + criterionList.add(criterion.getCondition()); + } else if (criterion.isBetweenValue()) { + criterionList.add(criterion.getCondition() + " " + criterion.getValue() + "," + criterion.getSecondValue()); + } else { + criterionList.add(criterion.getCondition() + " " + criterion.getValue()); + } + } + whereGroup.add(String.join(" and ", criterionList)); + } + if (whereGroup.size() > 1) { + List mapWhereGroup = new ArrayList<>(); + for (String where : whereGroup) { + mapWhereGroup.add("(" + where + ")"); + } + whereGroup = mapWhereGroup; + } + return String.join(" or ", whereGroup); + } + return null; + } + + public SystemGlobalCacheExample cloneExample() { + SystemGlobalCacheExample newExample = new SystemGlobalCacheExample(); + newExample.rows = this.rows; + newExample.offset = this.offset; + newExample.maxPageSize = this.maxPageSize; + newExample.ignorePageSize = this.ignorePageSize; + newExample.startPageNum = this.startPageNum; + newExample.resultType = this.resultType; + newExample.withBLOBs = withBLOBs; + if (this.getOredCriteria() != null && !this.getOredCriteria().isEmpty()) { + for (SystemGlobalCacheExample.Criteria oldCriteria : this.getOredCriteria()) { + SystemGlobalCacheExample.Criteria newCriteria = newExample.or(); + newCriteria.getCriteria().addAll(oldCriteria.getCriteria()); + } + } + newExample.setOrderByClause(this.getOrderByClause()); + return newExample; + } + + /** + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList<>(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andGuidIsNull() { + addCriterion("guid is null"); + return (Criteria) this; + } + + public Criteria andGuidIsNotNull() { + addCriterion("guid is not null"); + return (Criteria) this; + } + + public Criteria andGuidEqualTo(Long value) { + addCriterion("guid =", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidNotEqualTo(Long value) { + addCriterion("guid <>", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidGreaterThan(Long value) { + addCriterion("guid >", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidGreaterThanOrEqualTo(Long value) { + addCriterion("guid >=", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidLessThan(Long value) { + addCriterion("guid <", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidLessThanOrEqualTo(Long value) { + addCriterion("guid <=", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidIn(List values) { + addCriterion("guid in", values, "guid"); + return (Criteria) this; + } + + public Criteria andGuidNotIn(List values) { + addCriterion("guid not in", values, "guid"); + return (Criteria) this; + } + + public Criteria andGuidBetween(Long value1, Long value2) { + addCriterion("guid between", value1, value2, "guid"); + return (Criteria) this; + } + + public Criteria andGuidNotBetween(Long value1, Long value2) { + addCriterion("guid not between", value1, value2, "guid"); + return (Criteria) this; + } + + public Criteria andCacheTimeIsNull() { + addCriterion("cache_time is null"); + return (Criteria) this; + } + + public Criteria andCacheTimeIsNotNull() { + addCriterion("cache_time is not null"); + return (Criteria) this; + } + + public Criteria andCacheTimeEqualTo(Long value) { + addCriterion("cache_time =", value, "cacheTime"); + return (Criteria) this; + } + + public Criteria andCacheTimeNotEqualTo(Long value) { + addCriterion("cache_time <>", value, "cacheTime"); + return (Criteria) this; + } + + public Criteria andCacheTimeGreaterThan(Long value) { + addCriterion("cache_time >", value, "cacheTime"); + return (Criteria) this; + } + + public Criteria andCacheTimeGreaterThanOrEqualTo(Long value) { + addCriterion("cache_time >=", value, "cacheTime"); + return (Criteria) this; + } + + public Criteria andCacheTimeLessThan(Long value) { + addCriterion("cache_time <", value, "cacheTime"); + return (Criteria) this; + } + + public Criteria andCacheTimeLessThanOrEqualTo(Long value) { + addCriterion("cache_time <=", value, "cacheTime"); + return (Criteria) this; + } + + public Criteria andCacheTimeIn(List values) { + addCriterion("cache_time in", values, "cacheTime"); + return (Criteria) this; + } + + public Criteria andCacheTimeNotIn(List values) { + addCriterion("cache_time not in", values, "cacheTime"); + return (Criteria) this; + } + + public Criteria andCacheTimeBetween(Long value1, Long value2) { + addCriterion("cache_time between", value1, value2, "cacheTime"); + return (Criteria) this; + } + + public Criteria andCacheTimeNotBetween(Long value1, Long value2) { + addCriterion("cache_time not between", value1, value2, "cacheTime"); + return (Criteria) this; + } + + public Criteria andExpireTimeIsNull() { + addCriterion("expire_time is null"); + return (Criteria) this; + } + + public Criteria andExpireTimeIsNotNull() { + addCriterion("expire_time is not null"); + return (Criteria) this; + } + + public Criteria andExpireTimeEqualTo(Long value) { + addCriterion("expire_time =", value, "expireTime"); + return (Criteria) this; + } + + public Criteria andExpireTimeNotEqualTo(Long value) { + addCriterion("expire_time <>", value, "expireTime"); + return (Criteria) this; + } + + public Criteria andExpireTimeGreaterThan(Long value) { + addCriterion("expire_time >", value, "expireTime"); + return (Criteria) this; + } + + public Criteria andExpireTimeGreaterThanOrEqualTo(Long value) { + addCriterion("expire_time >=", value, "expireTime"); + return (Criteria) this; + } + + public Criteria andExpireTimeLessThan(Long value) { + addCriterion("expire_time <", value, "expireTime"); + return (Criteria) this; + } + + public Criteria andExpireTimeLessThanOrEqualTo(Long value) { + addCriterion("expire_time <=", value, "expireTime"); + return (Criteria) this; + } + + public Criteria andExpireTimeIn(List values) { + addCriterion("expire_time in", values, "expireTime"); + return (Criteria) this; + } + + public Criteria andExpireTimeNotIn(List values) { + addCriterion("expire_time not in", values, "expireTime"); + return (Criteria) this; + } + + public Criteria andExpireTimeBetween(Long value1, Long value2) { + addCriterion("expire_time between", value1, value2, "expireTime"); + return (Criteria) this; + } + + public Criteria andExpireTimeNotBetween(Long value1, Long value2) { + addCriterion("expire_time not between", value1, value2, "expireTime"); + return (Criteria) this; + } + + public Criteria andCacheKeyIsNull() { + addCriterion("cache_key is null"); + return (Criteria) this; + } + + public Criteria andCacheKeyIsNotNull() { + addCriterion("cache_key is not null"); + return (Criteria) this; + } + + public Criteria andCacheKeyEqualTo(String value) { + addCriterion("cache_key =", value, "cacheKey"); + return (Criteria) this; + } + + public Criteria andCacheKeyNotEqualTo(String value) { + addCriterion("cache_key <>", value, "cacheKey"); + return (Criteria) this; + } + + public Criteria andCacheKeyGreaterThan(String value) { + addCriterion("cache_key >", value, "cacheKey"); + return (Criteria) this; + } + + public Criteria andCacheKeyGreaterThanOrEqualTo(String value) { + addCriterion("cache_key >=", value, "cacheKey"); + return (Criteria) this; + } + + public Criteria andCacheKeyLessThan(String value) { + addCriterion("cache_key <", value, "cacheKey"); + return (Criteria) this; + } + + public Criteria andCacheKeyLessThanOrEqualTo(String value) { + addCriterion("cache_key <=", value, "cacheKey"); + return (Criteria) this; + } + + public Criteria andCacheKeyLike(String value) { + addCriterion("cache_key like", value, "cacheKey"); + return (Criteria) this; + } + + public Criteria andCacheKeyNotLike(String value) { + addCriterion("cache_key not like", value, "cacheKey"); + return (Criteria) this; + } + + public Criteria andCacheKeyIn(List values) { + addCriterion("cache_key in", values, "cacheKey"); + return (Criteria) this; + } + + public Criteria andCacheKeyNotIn(List values) { + addCriterion("cache_key not in", values, "cacheKey"); + return (Criteria) this; + } + + public Criteria andCacheKeyBetween(String value1, String value2) { + addCriterion("cache_key between", value1, value2, "cacheKey"); + return (Criteria) this; + } + + public Criteria andCacheKeyNotBetween(String value1, String value2) { + addCriterion("cache_key not between", value1, value2, "cacheKey"); + return (Criteria) this; + } + + public Criteria andIsHiddenIsNull() { + addCriterion("is_hidden is null"); + return (Criteria) this; + } + + public Criteria andIsHiddenIsNotNull() { + addCriterion("is_hidden is not null"); + return (Criteria) this; + } + + public Criteria andIsHiddenEqualTo(Integer value) { + addCriterion("is_hidden =", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenNotEqualTo(Integer value) { + addCriterion("is_hidden <>", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenGreaterThan(Integer value) { + addCriterion("is_hidden >", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenGreaterThanOrEqualTo(Integer value) { + addCriterion("is_hidden >=", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenLessThan(Integer value) { + addCriterion("is_hidden <", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenLessThanOrEqualTo(Integer value) { + addCriterion("is_hidden <=", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenIn(List values) { + addCriterion("is_hidden in", values, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenNotIn(List values) { + addCriterion("is_hidden not in", values, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenBetween(Integer value1, Integer value2) { + addCriterion("is_hidden between", value1, value2, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenNotBetween(Integer value1, Integer value2) { + addCriterion("is_hidden not between", value1, value2, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsDeleteIsNull() { + addCriterion("is_delete is null"); + return (Criteria) this; + } + + public Criteria andIsDeleteIsNotNull() { + addCriterion("is_delete is not null"); + return (Criteria) this; + } + + public Criteria andIsDeleteEqualTo(Integer value) { + addCriterion("is_delete =", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteNotEqualTo(Integer value) { + addCriterion("is_delete <>", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteGreaterThan(Integer value) { + addCriterion("is_delete >", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteGreaterThanOrEqualTo(Integer value) { + addCriterion("is_delete >=", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteLessThan(Integer value) { + addCriterion("is_delete <", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteLessThanOrEqualTo(Integer value) { + addCriterion("is_delete <=", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteIn(List values) { + addCriterion("is_delete in", values, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteNotIn(List values) { + addCriterion("is_delete not in", values, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteBetween(Integer value1, Integer value2) { + addCriterion("is_delete between", value1, value2, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteNotBetween(Integer value1, Integer value2) { + addCriterion("is_delete not between", value1, value2, "isDelete"); + return (Criteria) this; + } + + public Criteria andDeleteTokenIsNull() { + addCriterion("delete_token is null"); + return (Criteria) this; + } + + public Criteria andDeleteTokenIsNotNull() { + addCriterion("delete_token is not null"); + return (Criteria) this; + } + + public Criteria andDeleteTokenEqualTo(String value) { + addCriterion("delete_token =", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotEqualTo(String value) { + addCriterion("delete_token <>", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenGreaterThan(String value) { + addCriterion("delete_token >", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenGreaterThanOrEqualTo(String value) { + addCriterion("delete_token >=", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenLessThan(String value) { + addCriterion("delete_token <", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenLessThanOrEqualTo(String value) { + addCriterion("delete_token <=", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenLike(String value) { + addCriterion("delete_token like", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotLike(String value) { + addCriterion("delete_token not like", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenIn(List values) { + addCriterion("delete_token in", values, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotIn(List values) { + addCriterion("delete_token not in", values, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenBetween(String value1, String value2) { + addCriterion("delete_token between", value1, value2, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotBetween(String value1, String value2) { + addCriterion("delete_token not between", value1, value2, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDataVersionIsNull() { + addCriterion("data_version is null"); + return (Criteria) this; + } + + public Criteria andDataVersionIsNotNull() { + addCriterion("data_version is not null"); + return (Criteria) this; + } + + public Criteria andDataVersionEqualTo(Integer value) { + addCriterion("data_version =", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionNotEqualTo(Integer value) { + addCriterion("data_version <>", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionGreaterThan(Integer value) { + addCriterion("data_version >", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionGreaterThanOrEqualTo(Integer value) { + addCriterion("data_version >=", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionLessThan(Integer value) { + addCriterion("data_version <", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionLessThanOrEqualTo(Integer value) { + addCriterion("data_version <=", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionIn(List values) { + addCriterion("data_version in", values, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionNotIn(List values) { + addCriterion("data_version not in", values, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionBetween(Integer value1, Integer value2) { + addCriterion("data_version between", value1, value2, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionNotBetween(Integer value1, Integer value2) { + addCriterion("data_version not between", value1, value2, "dataVersion"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Date value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Date value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Date value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Date value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Date value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Date value1, Date value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } + } + + /** + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_global_cache + * + * @mbg.generated do_not_delete_during_merge + */ + public static class Criteria extends GeneratedCriteria { + protected Criteria() { + super(); + } + } + + /** + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_global_cache + * + * @mbg.generated + */ + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalFileTransfer.java b/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalFileTransfer.java new file mode 100644 index 0000000..66ab061 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalFileTransfer.java @@ -0,0 +1,434 @@ +package com.iqudoo.platform.application.database.model; + +import java.io.Serializable; +import java.util.Date; + +/** + * Database Table Remarks: + * 系统文件转存关系表 + * + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_global_file_transfer + */ +public class SystemGlobalFileTransfer implements Serializable { + /** + * Database Column Remarks: + * GUID + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_file_transfer.guid + * + * @mbg.generated + */ + private Long guid; + + /** + * Database Column Remarks: + * 原来地址 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_file_transfer.original_url + * + * @mbg.generated + */ + private String originalUrl; + + /** + * Database Column Remarks: + * 转存地址 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_file_transfer.saved_url + * + * @mbg.generated + */ + private String savedUrl; + + /** + * Database Column Remarks: + * 文件大小 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_file_transfer.file_size + * + * @mbg.generated + */ + private Long fileSize; + + /** + * Database Column Remarks: + * 文件哈希 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_file_transfer.file_hash + * + * @mbg.generated + */ + private String fileHash; + + /** + * Database Column Remarks: + * 隐藏标志 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_file_transfer.is_hidden + * + * @mbg.generated + */ + private Integer isHidden; + + /** + * Database Column Remarks: + * 删除标志 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_file_transfer.is_delete + * + * @mbg.generated + */ + private Integer isDelete; + + /** + * Database Column Remarks: + * 删除令牌 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_file_transfer.delete_token + * + * @mbg.generated + */ + private String deleteToken; + + /** + * Database Column Remarks: + * 数据版本 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_file_transfer.data_version + * + * @mbg.generated + */ + private Integer dataVersion; + + /** + * Database Column Remarks: + * 创建时间 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_file_transfer.create_time + * + * @mbg.generated + */ + private Date createTime; + + /** + * Database Column Remarks: + * 更新时间 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_file_transfer.update_time + * + * @mbg.generated + */ + private Date updateTime; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated + */ + private static final long serialVersionUID = 1L; + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_file_transfer.guid + * + * @return the value of t_system_global_file_transfer.guid + * + * @mbg.generated + */ + public Long getGuid() { + return guid; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_file_transfer.guid + * + * @param guid the value for t_system_global_file_transfer.guid + * + * @mbg.generated + */ + public void setGuid(Long guid) { + this.guid = guid; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_file_transfer.original_url + * + * @return the value of t_system_global_file_transfer.original_url + * + * @mbg.generated + */ + public String getOriginalUrl() { + return originalUrl; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_file_transfer.original_url + * + * @param originalUrl the value for t_system_global_file_transfer.original_url + * + * @mbg.generated + */ + public void setOriginalUrl(String originalUrl) { + this.originalUrl = originalUrl == null ? null : originalUrl.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_file_transfer.saved_url + * + * @return the value of t_system_global_file_transfer.saved_url + * + * @mbg.generated + */ + public String getSavedUrl() { + return savedUrl; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_file_transfer.saved_url + * + * @param savedUrl the value for t_system_global_file_transfer.saved_url + * + * @mbg.generated + */ + public void setSavedUrl(String savedUrl) { + this.savedUrl = savedUrl == null ? null : savedUrl.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_file_transfer.file_size + * + * @return the value of t_system_global_file_transfer.file_size + * + * @mbg.generated + */ + public Long getFileSize() { + return fileSize; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_file_transfer.file_size + * + * @param fileSize the value for t_system_global_file_transfer.file_size + * + * @mbg.generated + */ + public void setFileSize(Long fileSize) { + this.fileSize = fileSize; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_file_transfer.file_hash + * + * @return the value of t_system_global_file_transfer.file_hash + * + * @mbg.generated + */ + public String getFileHash() { + return fileHash; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_file_transfer.file_hash + * + * @param fileHash the value for t_system_global_file_transfer.file_hash + * + * @mbg.generated + */ + public void setFileHash(String fileHash) { + this.fileHash = fileHash == null ? null : fileHash.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_file_transfer.is_hidden + * + * @return the value of t_system_global_file_transfer.is_hidden + * + * @mbg.generated + */ + public Integer getIsHidden() { + return isHidden; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_file_transfer.is_hidden + * + * @param isHidden the value for t_system_global_file_transfer.is_hidden + * + * @mbg.generated + */ + public void setIsHidden(Integer isHidden) { + this.isHidden = isHidden; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_file_transfer.is_delete + * + * @return the value of t_system_global_file_transfer.is_delete + * + * @mbg.generated + */ + public Integer getIsDelete() { + return isDelete; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_file_transfer.is_delete + * + * @param isDelete the value for t_system_global_file_transfer.is_delete + * + * @mbg.generated + */ + public void setIsDelete(Integer isDelete) { + this.isDelete = isDelete; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_file_transfer.delete_token + * + * @return the value of t_system_global_file_transfer.delete_token + * + * @mbg.generated + */ + public String getDeleteToken() { + return deleteToken; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_file_transfer.delete_token + * + * @param deleteToken the value for t_system_global_file_transfer.delete_token + * + * @mbg.generated + */ + public void setDeleteToken(String deleteToken) { + this.deleteToken = deleteToken == null ? null : deleteToken.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_file_transfer.data_version + * + * @return the value of t_system_global_file_transfer.data_version + * + * @mbg.generated + */ + public Integer getDataVersion() { + return dataVersion; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_file_transfer.data_version + * + * @param dataVersion the value for t_system_global_file_transfer.data_version + * + * @mbg.generated + */ + public void setDataVersion(Integer dataVersion) { + this.dataVersion = dataVersion; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_file_transfer.create_time + * + * @return the value of t_system_global_file_transfer.create_time + * + * @mbg.generated + */ + public Date getCreateTime() { + return createTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_file_transfer.create_time + * + * @param createTime the value for t_system_global_file_transfer.create_time + * + * @mbg.generated + */ + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_file_transfer.update_time + * + * @return the value of t_system_global_file_transfer.update_time + * + * @mbg.generated + */ + public Date getUpdateTime() { + return updateTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_file_transfer.update_time + * + * @param updateTime the value for t_system_global_file_transfer.update_time + * + * @mbg.generated + */ + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated + */ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", guid=").append(guid); + sb.append(", originalUrl=").append(originalUrl); + sb.append(", savedUrl=").append(savedUrl); + sb.append(", fileSize=").append(fileSize); + sb.append(", fileHash=").append(fileHash); + sb.append(", isHidden=").append(isHidden); + sb.append(", isDelete=").append(isDelete); + sb.append(", deleteToken=").append(deleteToken); + sb.append(", dataVersion=").append(dataVersion); + sb.append(", createTime=").append(createTime); + sb.append(", updateTime=").append(updateTime); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalFileTransferExample.java b/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalFileTransferExample.java new file mode 100644 index 0000000..860b134 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalFileTransferExample.java @@ -0,0 +1,1186 @@ +package com.iqudoo.platform.application.database.model; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Objects; + +public class SystemGlobalFileTransferExample { + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated + */ + protected String orderByClause; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated + */ + protected boolean distinct; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated + */ + protected List oredCriteria; + + protected String resultType = null; + + protected Integer maxPageSize = 100; + + protected Integer ignorePageSize = 10000; + + protected Integer startPageNum = 1; + + protected Integer offset = null; + + protected Integer rows = null; + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated + */ + public SystemGlobalFileTransferExample() { + oredCriteria = new ArrayList<>(); + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated + */ + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated + */ + public String getOrderByClause() { + return orderByClause; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated + */ + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated + */ + public boolean isDistinct() { + return distinct; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated + */ + public List getOredCriteria() { + return oredCriteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated + */ + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated + */ + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated + */ + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated + */ + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated + */ + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + rows = null; + offset = null; + resultType = null; + } + + public void setMaxPageSize(Integer maxPageSize) { + this.maxPageSize = maxPageSize; + } + + public Integer getMaxPageSize() { + return this.maxPageSize; + } + + public void setIgnorePageSize(Integer ignorePageSize) { + this.ignorePageSize = ignorePageSize; + } + + public Integer getIgnorePageSize() { + return this.ignorePageSize; + } + + public void setStartPageNum(Integer startPageNum) { + this.startPageNum = startPageNum; + } + + public Integer getStartPageNum() { + return this.startPageNum; + } + + public SystemGlobalFileTransferExample setResultType(String type) { + this.resultType = type; + return this; + } + + public SystemGlobalFileTransferExample resultValid() { + this.resultType = "valid"; + return this; + } + + public Boolean isResultValid() { + return !this.isResultAny() && !this.isResultTrash(); + } + + public SystemGlobalFileTransferExample resultTrash() { + this.resultType = "trash"; + return this; + } + + public Boolean isResultTrash() { + return Objects.equals(this.resultType, "trash"); + } + + public SystemGlobalFileTransferExample resultAny() { + this.resultType = "any"; + return this; + } + + public Boolean isResultAny() { + return Objects.equals(this.resultType, "any"); + } + + public SystemGlobalFileTransferExample limit(Integer rows) { + this.offset = null; + this.rows = rows; + return this; + } + + public SystemGlobalFileTransferExample limit(Integer offset, Integer rows) { + this.offset = offset; + this.rows = rows; + return this; + } + + public SystemGlobalFileTransferExample limitOffset(Integer offset, Integer rows) { + this.offset = offset; + this.rows = 999999999; + return this; + } + + public SystemGlobalFileTransferExample usePage(Integer pageNum, Integer pageSize) { + pageSize = pageSize == null || pageSize <= 0 ? 1 : pageSize; + pageNum = pageNum == null || pageNum < this.startPageNum ? this.startPageNum : pageNum; + if (pageSize >= this.ignorePageSize) { + this.rows = null; + this.offset = null; + return this; + } + int cPageSize = pageSize > this.maxPageSize ? this.maxPageSize: pageSize; + this.offset = (pageNum - this.startPageNum) * cPageSize; + this.rows = cPageSize; + return this; + } + + public Integer getPageNum() { + if (this.rows == null || this.offset == null || this.rows == 0) { + return this.startPageNum; + } + return this.offset / this.rows + this.startPageNum; + } + + public Integer getPageSize() { + if (this.rows == null) { + return this.ignorePageSize; + } + return this.rows; + } + + public Integer getRows() { + return this.rows; + } + + public Integer getOffset() { + return this.offset; + } + + public String getLimitString() { + if (getRows() != null) { + if (getOffset() != null) { + return getOffset() + "," + getRows(); + } else { + return getRows() + ""; + } + } + return null; + } + + public String getWhereString() { + if (getOredCriteria() != null) { + List whereGroup = new ArrayList<>(); + for (Criteria criteria : getOredCriteria()) { + List criterionList = new ArrayList<>(); + for (Criterion criterion : criteria.getAllCriteria()) { + if (criterion.isNoValue()) { + criterionList.add(criterion.getCondition()); + } else if (criterion.isBetweenValue()) { + criterionList.add(criterion.getCondition() + " " + criterion.getValue() + "," + criterion.getSecondValue()); + } else { + criterionList.add(criterion.getCondition() + " " + criterion.getValue()); + } + } + whereGroup.add(String.join(" and ", criterionList)); + } + if (whereGroup.size() > 1) { + List mapWhereGroup = new ArrayList<>(); + for (String where : whereGroup) { + mapWhereGroup.add("(" + where + ")"); + } + whereGroup = mapWhereGroup; + } + return String.join(" or ", whereGroup); + } + return null; + } + + public SystemGlobalFileTransferExample cloneExample() { + SystemGlobalFileTransferExample newExample = new SystemGlobalFileTransferExample(); + newExample.rows = this.rows; + newExample.offset = this.offset; + newExample.maxPageSize = this.maxPageSize; + newExample.ignorePageSize = this.ignorePageSize; + newExample.startPageNum = this.startPageNum; + newExample.resultType = this.resultType; + + if (this.getOredCriteria() != null && !this.getOredCriteria().isEmpty()) { + for (SystemGlobalFileTransferExample.Criteria oldCriteria : this.getOredCriteria()) { + SystemGlobalFileTransferExample.Criteria newCriteria = newExample.or(); + newCriteria.getCriteria().addAll(oldCriteria.getCriteria()); + } + } + newExample.setOrderByClause(this.getOrderByClause()); + return newExample; + } + + /** + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated + */ + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList<>(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andGuidIsNull() { + addCriterion("guid is null"); + return (Criteria) this; + } + + public Criteria andGuidIsNotNull() { + addCriterion("guid is not null"); + return (Criteria) this; + } + + public Criteria andGuidEqualTo(Long value) { + addCriterion("guid =", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidNotEqualTo(Long value) { + addCriterion("guid <>", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidGreaterThan(Long value) { + addCriterion("guid >", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidGreaterThanOrEqualTo(Long value) { + addCriterion("guid >=", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidLessThan(Long value) { + addCriterion("guid <", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidLessThanOrEqualTo(Long value) { + addCriterion("guid <=", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidIn(List values) { + addCriterion("guid in", values, "guid"); + return (Criteria) this; + } + + public Criteria andGuidNotIn(List values) { + addCriterion("guid not in", values, "guid"); + return (Criteria) this; + } + + public Criteria andGuidBetween(Long value1, Long value2) { + addCriterion("guid between", value1, value2, "guid"); + return (Criteria) this; + } + + public Criteria andGuidNotBetween(Long value1, Long value2) { + addCriterion("guid not between", value1, value2, "guid"); + return (Criteria) this; + } + + public Criteria andOriginalUrlIsNull() { + addCriterion("original_url is null"); + return (Criteria) this; + } + + public Criteria andOriginalUrlIsNotNull() { + addCriterion("original_url is not null"); + return (Criteria) this; + } + + public Criteria andOriginalUrlEqualTo(String value) { + addCriterion("original_url =", value, "originalUrl"); + return (Criteria) this; + } + + public Criteria andOriginalUrlNotEqualTo(String value) { + addCriterion("original_url <>", value, "originalUrl"); + return (Criteria) this; + } + + public Criteria andOriginalUrlGreaterThan(String value) { + addCriterion("original_url >", value, "originalUrl"); + return (Criteria) this; + } + + public Criteria andOriginalUrlGreaterThanOrEqualTo(String value) { + addCriterion("original_url >=", value, "originalUrl"); + return (Criteria) this; + } + + public Criteria andOriginalUrlLessThan(String value) { + addCriterion("original_url <", value, "originalUrl"); + return (Criteria) this; + } + + public Criteria andOriginalUrlLessThanOrEqualTo(String value) { + addCriterion("original_url <=", value, "originalUrl"); + return (Criteria) this; + } + + public Criteria andOriginalUrlLike(String value) { + addCriterion("original_url like", value, "originalUrl"); + return (Criteria) this; + } + + public Criteria andOriginalUrlNotLike(String value) { + addCriterion("original_url not like", value, "originalUrl"); + return (Criteria) this; + } + + public Criteria andOriginalUrlIn(List values) { + addCriterion("original_url in", values, "originalUrl"); + return (Criteria) this; + } + + public Criteria andOriginalUrlNotIn(List values) { + addCriterion("original_url not in", values, "originalUrl"); + return (Criteria) this; + } + + public Criteria andOriginalUrlBetween(String value1, String value2) { + addCriterion("original_url between", value1, value2, "originalUrl"); + return (Criteria) this; + } + + public Criteria andOriginalUrlNotBetween(String value1, String value2) { + addCriterion("original_url not between", value1, value2, "originalUrl"); + return (Criteria) this; + } + + public Criteria andSavedUrlIsNull() { + addCriterion("saved_url is null"); + return (Criteria) this; + } + + public Criteria andSavedUrlIsNotNull() { + addCriterion("saved_url is not null"); + return (Criteria) this; + } + + public Criteria andSavedUrlEqualTo(String value) { + addCriterion("saved_url =", value, "savedUrl"); + return (Criteria) this; + } + + public Criteria andSavedUrlNotEqualTo(String value) { + addCriterion("saved_url <>", value, "savedUrl"); + return (Criteria) this; + } + + public Criteria andSavedUrlGreaterThan(String value) { + addCriterion("saved_url >", value, "savedUrl"); + return (Criteria) this; + } + + public Criteria andSavedUrlGreaterThanOrEqualTo(String value) { + addCriterion("saved_url >=", value, "savedUrl"); + return (Criteria) this; + } + + public Criteria andSavedUrlLessThan(String value) { + addCriterion("saved_url <", value, "savedUrl"); + return (Criteria) this; + } + + public Criteria andSavedUrlLessThanOrEqualTo(String value) { + addCriterion("saved_url <=", value, "savedUrl"); + return (Criteria) this; + } + + public Criteria andSavedUrlLike(String value) { + addCriterion("saved_url like", value, "savedUrl"); + return (Criteria) this; + } + + public Criteria andSavedUrlNotLike(String value) { + addCriterion("saved_url not like", value, "savedUrl"); + return (Criteria) this; + } + + public Criteria andSavedUrlIn(List values) { + addCriterion("saved_url in", values, "savedUrl"); + return (Criteria) this; + } + + public Criteria andSavedUrlNotIn(List values) { + addCriterion("saved_url not in", values, "savedUrl"); + return (Criteria) this; + } + + public Criteria andSavedUrlBetween(String value1, String value2) { + addCriterion("saved_url between", value1, value2, "savedUrl"); + return (Criteria) this; + } + + public Criteria andSavedUrlNotBetween(String value1, String value2) { + addCriterion("saved_url not between", value1, value2, "savedUrl"); + return (Criteria) this; + } + + public Criteria andFileSizeIsNull() { + addCriterion("file_size is null"); + return (Criteria) this; + } + + public Criteria andFileSizeIsNotNull() { + addCriterion("file_size is not null"); + return (Criteria) this; + } + + public Criteria andFileSizeEqualTo(Long value) { + addCriterion("file_size =", value, "fileSize"); + return (Criteria) this; + } + + public Criteria andFileSizeNotEqualTo(Long value) { + addCriterion("file_size <>", value, "fileSize"); + return (Criteria) this; + } + + public Criteria andFileSizeGreaterThan(Long value) { + addCriterion("file_size >", value, "fileSize"); + return (Criteria) this; + } + + public Criteria andFileSizeGreaterThanOrEqualTo(Long value) { + addCriterion("file_size >=", value, "fileSize"); + return (Criteria) this; + } + + public Criteria andFileSizeLessThan(Long value) { + addCriterion("file_size <", value, "fileSize"); + return (Criteria) this; + } + + public Criteria andFileSizeLessThanOrEqualTo(Long value) { + addCriterion("file_size <=", value, "fileSize"); + return (Criteria) this; + } + + public Criteria andFileSizeIn(List values) { + addCriterion("file_size in", values, "fileSize"); + return (Criteria) this; + } + + public Criteria andFileSizeNotIn(List values) { + addCriterion("file_size not in", values, "fileSize"); + return (Criteria) this; + } + + public Criteria andFileSizeBetween(Long value1, Long value2) { + addCriterion("file_size between", value1, value2, "fileSize"); + return (Criteria) this; + } + + public Criteria andFileSizeNotBetween(Long value1, Long value2) { + addCriterion("file_size not between", value1, value2, "fileSize"); + return (Criteria) this; + } + + public Criteria andFileHashIsNull() { + addCriterion("file_hash is null"); + return (Criteria) this; + } + + public Criteria andFileHashIsNotNull() { + addCriterion("file_hash is not null"); + return (Criteria) this; + } + + public Criteria andFileHashEqualTo(String value) { + addCriterion("file_hash =", value, "fileHash"); + return (Criteria) this; + } + + public Criteria andFileHashNotEqualTo(String value) { + addCriterion("file_hash <>", value, "fileHash"); + return (Criteria) this; + } + + public Criteria andFileHashGreaterThan(String value) { + addCriterion("file_hash >", value, "fileHash"); + return (Criteria) this; + } + + public Criteria andFileHashGreaterThanOrEqualTo(String value) { + addCriterion("file_hash >=", value, "fileHash"); + return (Criteria) this; + } + + public Criteria andFileHashLessThan(String value) { + addCriterion("file_hash <", value, "fileHash"); + return (Criteria) this; + } + + public Criteria andFileHashLessThanOrEqualTo(String value) { + addCriterion("file_hash <=", value, "fileHash"); + return (Criteria) this; + } + + public Criteria andFileHashLike(String value) { + addCriterion("file_hash like", value, "fileHash"); + return (Criteria) this; + } + + public Criteria andFileHashNotLike(String value) { + addCriterion("file_hash not like", value, "fileHash"); + return (Criteria) this; + } + + public Criteria andFileHashIn(List values) { + addCriterion("file_hash in", values, "fileHash"); + return (Criteria) this; + } + + public Criteria andFileHashNotIn(List values) { + addCriterion("file_hash not in", values, "fileHash"); + return (Criteria) this; + } + + public Criteria andFileHashBetween(String value1, String value2) { + addCriterion("file_hash between", value1, value2, "fileHash"); + return (Criteria) this; + } + + public Criteria andFileHashNotBetween(String value1, String value2) { + addCriterion("file_hash not between", value1, value2, "fileHash"); + return (Criteria) this; + } + + public Criteria andIsHiddenIsNull() { + addCriterion("is_hidden is null"); + return (Criteria) this; + } + + public Criteria andIsHiddenIsNotNull() { + addCriterion("is_hidden is not null"); + return (Criteria) this; + } + + public Criteria andIsHiddenEqualTo(Integer value) { + addCriterion("is_hidden =", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenNotEqualTo(Integer value) { + addCriterion("is_hidden <>", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenGreaterThan(Integer value) { + addCriterion("is_hidden >", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenGreaterThanOrEqualTo(Integer value) { + addCriterion("is_hidden >=", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenLessThan(Integer value) { + addCriterion("is_hidden <", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenLessThanOrEqualTo(Integer value) { + addCriterion("is_hidden <=", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenIn(List values) { + addCriterion("is_hidden in", values, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenNotIn(List values) { + addCriterion("is_hidden not in", values, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenBetween(Integer value1, Integer value2) { + addCriterion("is_hidden between", value1, value2, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenNotBetween(Integer value1, Integer value2) { + addCriterion("is_hidden not between", value1, value2, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsDeleteIsNull() { + addCriterion("is_delete is null"); + return (Criteria) this; + } + + public Criteria andIsDeleteIsNotNull() { + addCriterion("is_delete is not null"); + return (Criteria) this; + } + + public Criteria andIsDeleteEqualTo(Integer value) { + addCriterion("is_delete =", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteNotEqualTo(Integer value) { + addCriterion("is_delete <>", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteGreaterThan(Integer value) { + addCriterion("is_delete >", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteGreaterThanOrEqualTo(Integer value) { + addCriterion("is_delete >=", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteLessThan(Integer value) { + addCriterion("is_delete <", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteLessThanOrEqualTo(Integer value) { + addCriterion("is_delete <=", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteIn(List values) { + addCriterion("is_delete in", values, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteNotIn(List values) { + addCriterion("is_delete not in", values, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteBetween(Integer value1, Integer value2) { + addCriterion("is_delete between", value1, value2, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteNotBetween(Integer value1, Integer value2) { + addCriterion("is_delete not between", value1, value2, "isDelete"); + return (Criteria) this; + } + + public Criteria andDeleteTokenIsNull() { + addCriterion("delete_token is null"); + return (Criteria) this; + } + + public Criteria andDeleteTokenIsNotNull() { + addCriterion("delete_token is not null"); + return (Criteria) this; + } + + public Criteria andDeleteTokenEqualTo(String value) { + addCriterion("delete_token =", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotEqualTo(String value) { + addCriterion("delete_token <>", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenGreaterThan(String value) { + addCriterion("delete_token >", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenGreaterThanOrEqualTo(String value) { + addCriterion("delete_token >=", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenLessThan(String value) { + addCriterion("delete_token <", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenLessThanOrEqualTo(String value) { + addCriterion("delete_token <=", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenLike(String value) { + addCriterion("delete_token like", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotLike(String value) { + addCriterion("delete_token not like", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenIn(List values) { + addCriterion("delete_token in", values, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotIn(List values) { + addCriterion("delete_token not in", values, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenBetween(String value1, String value2) { + addCriterion("delete_token between", value1, value2, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotBetween(String value1, String value2) { + addCriterion("delete_token not between", value1, value2, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDataVersionIsNull() { + addCriterion("data_version is null"); + return (Criteria) this; + } + + public Criteria andDataVersionIsNotNull() { + addCriterion("data_version is not null"); + return (Criteria) this; + } + + public Criteria andDataVersionEqualTo(Integer value) { + addCriterion("data_version =", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionNotEqualTo(Integer value) { + addCriterion("data_version <>", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionGreaterThan(Integer value) { + addCriterion("data_version >", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionGreaterThanOrEqualTo(Integer value) { + addCriterion("data_version >=", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionLessThan(Integer value) { + addCriterion("data_version <", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionLessThanOrEqualTo(Integer value) { + addCriterion("data_version <=", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionIn(List values) { + addCriterion("data_version in", values, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionNotIn(List values) { + addCriterion("data_version not in", values, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionBetween(Integer value1, Integer value2) { + addCriterion("data_version between", value1, value2, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionNotBetween(Integer value1, Integer value2) { + addCriterion("data_version not between", value1, value2, "dataVersion"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Date value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Date value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Date value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Date value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Date value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Date value1, Date value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } + } + + /** + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated do_not_delete_during_merge + */ + public static class Criteria extends GeneratedCriteria { + protected Criteria() { + super(); + } + } + + /** + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_global_file_transfer + * + * @mbg.generated + */ + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalSession.java b/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalSession.java new file mode 100644 index 0000000..a41bc92 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalSession.java @@ -0,0 +1,506 @@ +package com.iqudoo.platform.application.database.model; + +import java.io.Serializable; +import java.util.Date; + +/** + * Database Table Remarks: + * 系统全局会话信息表 + * + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_global_session + */ +public class SystemGlobalSession implements Serializable { + /** + * Database Column Remarks: + * GUID + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_session.guid + * + * @mbg.generated + */ + private Long guid; + + /** + * Database Column Remarks: + * 账号GUID + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_session.user_guid + * + * @mbg.generated + */ + private Long userGuid; + + /** + * Database Column Remarks: + * 账号分组 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_session.user_group + * + * @mbg.generated + */ + private String userGroup; + + /** + * Database Column Remarks: + * 会话KEY + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_session.session_key + * + * @mbg.generated + */ + private String sessionKey; + + /** + * Database Column Remarks: + * 来源平台 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_session.origin_platform + * + * @mbg.generated + */ + private String originPlatform; + + /** + * Database Column Remarks: + * 来源域名 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_session.origin_domain + * + * @mbg.generated + */ + private String originDomain; + + /** + * Database Column Remarks: + * 来源IP地址 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_session.origin_ip + * + * @mbg.generated + */ + private String originIp; + + /** + * Database Column Remarks: + * 隐藏标志 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_session.is_hidden + * + * @mbg.generated + */ + private Integer isHidden; + + /** + * Database Column Remarks: + * 删除标志 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_session.is_delete + * + * @mbg.generated + */ + private Integer isDelete; + + /** + * Database Column Remarks: + * 删除令牌 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_session.delete_token + * + * @mbg.generated + */ + private String deleteToken; + + /** + * Database Column Remarks: + * 数据版本 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_session.data_version + * + * @mbg.generated + */ + private Integer dataVersion; + + /** + * Database Column Remarks: + * 创建时间 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_session.create_time + * + * @mbg.generated + */ + private Date createTime; + + /** + * Database Column Remarks: + * 更新时间 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_session.update_time + * + * @mbg.generated + */ + private Date updateTime; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_global_session + * + * @mbg.generated + */ + private static final long serialVersionUID = 1L; + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_session.guid + * + * @return the value of t_system_global_session.guid + * + * @mbg.generated + */ + public Long getGuid() { + return guid; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_session.guid + * + * @param guid the value for t_system_global_session.guid + * + * @mbg.generated + */ + public void setGuid(Long guid) { + this.guid = guid; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_session.user_guid + * + * @return the value of t_system_global_session.user_guid + * + * @mbg.generated + */ + public Long getUserGuid() { + return userGuid; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_session.user_guid + * + * @param userGuid the value for t_system_global_session.user_guid + * + * @mbg.generated + */ + public void setUserGuid(Long userGuid) { + this.userGuid = userGuid; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_session.user_group + * + * @return the value of t_system_global_session.user_group + * + * @mbg.generated + */ + public String getUserGroup() { + return userGroup; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_session.user_group + * + * @param userGroup the value for t_system_global_session.user_group + * + * @mbg.generated + */ + public void setUserGroup(String userGroup) { + this.userGroup = userGroup == null ? null : userGroup.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_session.session_key + * + * @return the value of t_system_global_session.session_key + * + * @mbg.generated + */ + public String getSessionKey() { + return sessionKey; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_session.session_key + * + * @param sessionKey the value for t_system_global_session.session_key + * + * @mbg.generated + */ + public void setSessionKey(String sessionKey) { + this.sessionKey = sessionKey == null ? null : sessionKey.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_session.origin_platform + * + * @return the value of t_system_global_session.origin_platform + * + * @mbg.generated + */ + public String getOriginPlatform() { + return originPlatform; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_session.origin_platform + * + * @param originPlatform the value for t_system_global_session.origin_platform + * + * @mbg.generated + */ + public void setOriginPlatform(String originPlatform) { + this.originPlatform = originPlatform == null ? null : originPlatform.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_session.origin_domain + * + * @return the value of t_system_global_session.origin_domain + * + * @mbg.generated + */ + public String getOriginDomain() { + return originDomain; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_session.origin_domain + * + * @param originDomain the value for t_system_global_session.origin_domain + * + * @mbg.generated + */ + public void setOriginDomain(String originDomain) { + this.originDomain = originDomain == null ? null : originDomain.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_session.origin_ip + * + * @return the value of t_system_global_session.origin_ip + * + * @mbg.generated + */ + public String getOriginIp() { + return originIp; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_session.origin_ip + * + * @param originIp the value for t_system_global_session.origin_ip + * + * @mbg.generated + */ + public void setOriginIp(String originIp) { + this.originIp = originIp == null ? null : originIp.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_session.is_hidden + * + * @return the value of t_system_global_session.is_hidden + * + * @mbg.generated + */ + public Integer getIsHidden() { + return isHidden; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_session.is_hidden + * + * @param isHidden the value for t_system_global_session.is_hidden + * + * @mbg.generated + */ + public void setIsHidden(Integer isHidden) { + this.isHidden = isHidden; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_session.is_delete + * + * @return the value of t_system_global_session.is_delete + * + * @mbg.generated + */ + public Integer getIsDelete() { + return isDelete; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_session.is_delete + * + * @param isDelete the value for t_system_global_session.is_delete + * + * @mbg.generated + */ + public void setIsDelete(Integer isDelete) { + this.isDelete = isDelete; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_session.delete_token + * + * @return the value of t_system_global_session.delete_token + * + * @mbg.generated + */ + public String getDeleteToken() { + return deleteToken; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_session.delete_token + * + * @param deleteToken the value for t_system_global_session.delete_token + * + * @mbg.generated + */ + public void setDeleteToken(String deleteToken) { + this.deleteToken = deleteToken == null ? null : deleteToken.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_session.data_version + * + * @return the value of t_system_global_session.data_version + * + * @mbg.generated + */ + public Integer getDataVersion() { + return dataVersion; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_session.data_version + * + * @param dataVersion the value for t_system_global_session.data_version + * + * @mbg.generated + */ + public void setDataVersion(Integer dataVersion) { + this.dataVersion = dataVersion; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_session.create_time + * + * @return the value of t_system_global_session.create_time + * + * @mbg.generated + */ + public Date getCreateTime() { + return createTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_session.create_time + * + * @param createTime the value for t_system_global_session.create_time + * + * @mbg.generated + */ + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_session.update_time + * + * @return the value of t_system_global_session.update_time + * + * @mbg.generated + */ + public Date getUpdateTime() { + return updateTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_session.update_time + * + * @param updateTime the value for t_system_global_session.update_time + * + * @mbg.generated + */ + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_session + * + * @mbg.generated + */ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", guid=").append(guid); + sb.append(", userGuid=").append(userGuid); + sb.append(", userGroup=").append(userGroup); + sb.append(", sessionKey=").append(sessionKey); + sb.append(", originPlatform=").append(originPlatform); + sb.append(", originDomain=").append(originDomain); + sb.append(", originIp=").append(originIp); + sb.append(", isHidden=").append(isHidden); + sb.append(", isDelete=").append(isDelete); + sb.append(", deleteToken=").append(deleteToken); + sb.append(", dataVersion=").append(dataVersion); + sb.append(", createTime=").append(createTime); + sb.append(", updateTime=").append(updateTime); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalSessionExample.java b/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalSessionExample.java new file mode 100644 index 0000000..acd1544 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalSessionExample.java @@ -0,0 +1,1326 @@ +package com.iqudoo.platform.application.database.model; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Objects; + +public class SystemGlobalSessionExample { + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_global_session + * + * @mbg.generated + */ + protected String orderByClause; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_global_session + * + * @mbg.generated + */ + protected boolean distinct; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_global_session + * + * @mbg.generated + */ + protected List oredCriteria; + + protected String resultType = null; + + protected Integer maxPageSize = 100; + + protected Integer ignorePageSize = 10000; + + protected Integer startPageNum = 1; + + protected Integer offset = null; + + protected Integer rows = null; + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_session + * + * @mbg.generated + */ + public SystemGlobalSessionExample() { + oredCriteria = new ArrayList<>(); + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_session + * + * @mbg.generated + */ + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_session + * + * @mbg.generated + */ + public String getOrderByClause() { + return orderByClause; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_session + * + * @mbg.generated + */ + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_session + * + * @mbg.generated + */ + public boolean isDistinct() { + return distinct; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_session + * + * @mbg.generated + */ + public List getOredCriteria() { + return oredCriteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_session + * + * @mbg.generated + */ + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_session + * + * @mbg.generated + */ + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_session + * + * @mbg.generated + */ + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_session + * + * @mbg.generated + */ + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_session + * + * @mbg.generated + */ + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + rows = null; + offset = null; + resultType = null; + } + + public void setMaxPageSize(Integer maxPageSize) { + this.maxPageSize = maxPageSize; + } + + public Integer getMaxPageSize() { + return this.maxPageSize; + } + + public void setIgnorePageSize(Integer ignorePageSize) { + this.ignorePageSize = ignorePageSize; + } + + public Integer getIgnorePageSize() { + return this.ignorePageSize; + } + + public void setStartPageNum(Integer startPageNum) { + this.startPageNum = startPageNum; + } + + public Integer getStartPageNum() { + return this.startPageNum; + } + + public SystemGlobalSessionExample setResultType(String type) { + this.resultType = type; + return this; + } + + public SystemGlobalSessionExample resultValid() { + this.resultType = "valid"; + return this; + } + + public Boolean isResultValid() { + return !this.isResultAny() && !this.isResultTrash(); + } + + public SystemGlobalSessionExample resultTrash() { + this.resultType = "trash"; + return this; + } + + public Boolean isResultTrash() { + return Objects.equals(this.resultType, "trash"); + } + + public SystemGlobalSessionExample resultAny() { + this.resultType = "any"; + return this; + } + + public Boolean isResultAny() { + return Objects.equals(this.resultType, "any"); + } + + public SystemGlobalSessionExample limit(Integer rows) { + this.offset = null; + this.rows = rows; + return this; + } + + public SystemGlobalSessionExample limit(Integer offset, Integer rows) { + this.offset = offset; + this.rows = rows; + return this; + } + + public SystemGlobalSessionExample limitOffset(Integer offset, Integer rows) { + this.offset = offset; + this.rows = 999999999; + return this; + } + + public SystemGlobalSessionExample usePage(Integer pageNum, Integer pageSize) { + pageSize = pageSize == null || pageSize <= 0 ? 1 : pageSize; + pageNum = pageNum == null || pageNum < this.startPageNum ? this.startPageNum : pageNum; + if (pageSize >= this.ignorePageSize) { + this.rows = null; + this.offset = null; + return this; + } + int cPageSize = pageSize > this.maxPageSize ? this.maxPageSize: pageSize; + this.offset = (pageNum - this.startPageNum) * cPageSize; + this.rows = cPageSize; + return this; + } + + public Integer getPageNum() { + if (this.rows == null || this.offset == null || this.rows == 0) { + return this.startPageNum; + } + return this.offset / this.rows + this.startPageNum; + } + + public Integer getPageSize() { + if (this.rows == null) { + return this.ignorePageSize; + } + return this.rows; + } + + public Integer getRows() { + return this.rows; + } + + public Integer getOffset() { + return this.offset; + } + + public String getLimitString() { + if (getRows() != null) { + if (getOffset() != null) { + return getOffset() + "," + getRows(); + } else { + return getRows() + ""; + } + } + return null; + } + + public String getWhereString() { + if (getOredCriteria() != null) { + List whereGroup = new ArrayList<>(); + for (Criteria criteria : getOredCriteria()) { + List criterionList = new ArrayList<>(); + for (Criterion criterion : criteria.getAllCriteria()) { + if (criterion.isNoValue()) { + criterionList.add(criterion.getCondition()); + } else if (criterion.isBetweenValue()) { + criterionList.add(criterion.getCondition() + " " + criterion.getValue() + "," + criterion.getSecondValue()); + } else { + criterionList.add(criterion.getCondition() + " " + criterion.getValue()); + } + } + whereGroup.add(String.join(" and ", criterionList)); + } + if (whereGroup.size() > 1) { + List mapWhereGroup = new ArrayList<>(); + for (String where : whereGroup) { + mapWhereGroup.add("(" + where + ")"); + } + whereGroup = mapWhereGroup; + } + return String.join(" or ", whereGroup); + } + return null; + } + + public SystemGlobalSessionExample cloneExample() { + SystemGlobalSessionExample newExample = new SystemGlobalSessionExample(); + newExample.rows = this.rows; + newExample.offset = this.offset; + newExample.maxPageSize = this.maxPageSize; + newExample.ignorePageSize = this.ignorePageSize; + newExample.startPageNum = this.startPageNum; + newExample.resultType = this.resultType; + + if (this.getOredCriteria() != null && !this.getOredCriteria().isEmpty()) { + for (SystemGlobalSessionExample.Criteria oldCriteria : this.getOredCriteria()) { + SystemGlobalSessionExample.Criteria newCriteria = newExample.or(); + newCriteria.getCriteria().addAll(oldCriteria.getCriteria()); + } + } + newExample.setOrderByClause(this.getOrderByClause()); + return newExample; + } + + /** + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_global_session + * + * @mbg.generated + */ + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList<>(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andGuidIsNull() { + addCriterion("guid is null"); + return (Criteria) this; + } + + public Criteria andGuidIsNotNull() { + addCriterion("guid is not null"); + return (Criteria) this; + } + + public Criteria andGuidEqualTo(Long value) { + addCriterion("guid =", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidNotEqualTo(Long value) { + addCriterion("guid <>", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidGreaterThan(Long value) { + addCriterion("guid >", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidGreaterThanOrEqualTo(Long value) { + addCriterion("guid >=", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidLessThan(Long value) { + addCriterion("guid <", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidLessThanOrEqualTo(Long value) { + addCriterion("guid <=", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidIn(List values) { + addCriterion("guid in", values, "guid"); + return (Criteria) this; + } + + public Criteria andGuidNotIn(List values) { + addCriterion("guid not in", values, "guid"); + return (Criteria) this; + } + + public Criteria andGuidBetween(Long value1, Long value2) { + addCriterion("guid between", value1, value2, "guid"); + return (Criteria) this; + } + + public Criteria andGuidNotBetween(Long value1, Long value2) { + addCriterion("guid not between", value1, value2, "guid"); + return (Criteria) this; + } + + public Criteria andUserGuidIsNull() { + addCriterion("user_guid is null"); + return (Criteria) this; + } + + public Criteria andUserGuidIsNotNull() { + addCriterion("user_guid is not null"); + return (Criteria) this; + } + + public Criteria andUserGuidEqualTo(Long value) { + addCriterion("user_guid =", value, "userGuid"); + return (Criteria) this; + } + + public Criteria andUserGuidNotEqualTo(Long value) { + addCriterion("user_guid <>", value, "userGuid"); + return (Criteria) this; + } + + public Criteria andUserGuidGreaterThan(Long value) { + addCriterion("user_guid >", value, "userGuid"); + return (Criteria) this; + } + + public Criteria andUserGuidGreaterThanOrEqualTo(Long value) { + addCriterion("user_guid >=", value, "userGuid"); + return (Criteria) this; + } + + public Criteria andUserGuidLessThan(Long value) { + addCriterion("user_guid <", value, "userGuid"); + return (Criteria) this; + } + + public Criteria andUserGuidLessThanOrEqualTo(Long value) { + addCriterion("user_guid <=", value, "userGuid"); + return (Criteria) this; + } + + public Criteria andUserGuidIn(List values) { + addCriterion("user_guid in", values, "userGuid"); + return (Criteria) this; + } + + public Criteria andUserGuidNotIn(List values) { + addCriterion("user_guid not in", values, "userGuid"); + return (Criteria) this; + } + + public Criteria andUserGuidBetween(Long value1, Long value2) { + addCriterion("user_guid between", value1, value2, "userGuid"); + return (Criteria) this; + } + + public Criteria andUserGuidNotBetween(Long value1, Long value2) { + addCriterion("user_guid not between", value1, value2, "userGuid"); + return (Criteria) this; + } + + public Criteria andUserGroupIsNull() { + addCriterion("user_group is null"); + return (Criteria) this; + } + + public Criteria andUserGroupIsNotNull() { + addCriterion("user_group is not null"); + return (Criteria) this; + } + + public Criteria andUserGroupEqualTo(String value) { + addCriterion("user_group =", value, "userGroup"); + return (Criteria) this; + } + + public Criteria andUserGroupNotEqualTo(String value) { + addCriterion("user_group <>", value, "userGroup"); + return (Criteria) this; + } + + public Criteria andUserGroupGreaterThan(String value) { + addCriterion("user_group >", value, "userGroup"); + return (Criteria) this; + } + + public Criteria andUserGroupGreaterThanOrEqualTo(String value) { + addCriterion("user_group >=", value, "userGroup"); + return (Criteria) this; + } + + public Criteria andUserGroupLessThan(String value) { + addCriterion("user_group <", value, "userGroup"); + return (Criteria) this; + } + + public Criteria andUserGroupLessThanOrEqualTo(String value) { + addCriterion("user_group <=", value, "userGroup"); + return (Criteria) this; + } + + public Criteria andUserGroupLike(String value) { + addCriterion("user_group like", value, "userGroup"); + return (Criteria) this; + } + + public Criteria andUserGroupNotLike(String value) { + addCriterion("user_group not like", value, "userGroup"); + return (Criteria) this; + } + + public Criteria andUserGroupIn(List values) { + addCriterion("user_group in", values, "userGroup"); + return (Criteria) this; + } + + public Criteria andUserGroupNotIn(List values) { + addCriterion("user_group not in", values, "userGroup"); + return (Criteria) this; + } + + public Criteria andUserGroupBetween(String value1, String value2) { + addCriterion("user_group between", value1, value2, "userGroup"); + return (Criteria) this; + } + + public Criteria andUserGroupNotBetween(String value1, String value2) { + addCriterion("user_group not between", value1, value2, "userGroup"); + return (Criteria) this; + } + + public Criteria andSessionKeyIsNull() { + addCriterion("session_key is null"); + return (Criteria) this; + } + + public Criteria andSessionKeyIsNotNull() { + addCriterion("session_key is not null"); + return (Criteria) this; + } + + public Criteria andSessionKeyEqualTo(String value) { + addCriterion("session_key =", value, "sessionKey"); + return (Criteria) this; + } + + public Criteria andSessionKeyNotEqualTo(String value) { + addCriterion("session_key <>", value, "sessionKey"); + return (Criteria) this; + } + + public Criteria andSessionKeyGreaterThan(String value) { + addCriterion("session_key >", value, "sessionKey"); + return (Criteria) this; + } + + public Criteria andSessionKeyGreaterThanOrEqualTo(String value) { + addCriterion("session_key >=", value, "sessionKey"); + return (Criteria) this; + } + + public Criteria andSessionKeyLessThan(String value) { + addCriterion("session_key <", value, "sessionKey"); + return (Criteria) this; + } + + public Criteria andSessionKeyLessThanOrEqualTo(String value) { + addCriterion("session_key <=", value, "sessionKey"); + return (Criteria) this; + } + + public Criteria andSessionKeyLike(String value) { + addCriterion("session_key like", value, "sessionKey"); + return (Criteria) this; + } + + public Criteria andSessionKeyNotLike(String value) { + addCriterion("session_key not like", value, "sessionKey"); + return (Criteria) this; + } + + public Criteria andSessionKeyIn(List values) { + addCriterion("session_key in", values, "sessionKey"); + return (Criteria) this; + } + + public Criteria andSessionKeyNotIn(List values) { + addCriterion("session_key not in", values, "sessionKey"); + return (Criteria) this; + } + + public Criteria andSessionKeyBetween(String value1, String value2) { + addCriterion("session_key between", value1, value2, "sessionKey"); + return (Criteria) this; + } + + public Criteria andSessionKeyNotBetween(String value1, String value2) { + addCriterion("session_key not between", value1, value2, "sessionKey"); + return (Criteria) this; + } + + public Criteria andOriginPlatformIsNull() { + addCriterion("origin_platform is null"); + return (Criteria) this; + } + + public Criteria andOriginPlatformIsNotNull() { + addCriterion("origin_platform is not null"); + return (Criteria) this; + } + + public Criteria andOriginPlatformEqualTo(String value) { + addCriterion("origin_platform =", value, "originPlatform"); + return (Criteria) this; + } + + public Criteria andOriginPlatformNotEqualTo(String value) { + addCriterion("origin_platform <>", value, "originPlatform"); + return (Criteria) this; + } + + public Criteria andOriginPlatformGreaterThan(String value) { + addCriterion("origin_platform >", value, "originPlatform"); + return (Criteria) this; + } + + public Criteria andOriginPlatformGreaterThanOrEqualTo(String value) { + addCriterion("origin_platform >=", value, "originPlatform"); + return (Criteria) this; + } + + public Criteria andOriginPlatformLessThan(String value) { + addCriterion("origin_platform <", value, "originPlatform"); + return (Criteria) this; + } + + public Criteria andOriginPlatformLessThanOrEqualTo(String value) { + addCriterion("origin_platform <=", value, "originPlatform"); + return (Criteria) this; + } + + public Criteria andOriginPlatformLike(String value) { + addCriterion("origin_platform like", value, "originPlatform"); + return (Criteria) this; + } + + public Criteria andOriginPlatformNotLike(String value) { + addCriterion("origin_platform not like", value, "originPlatform"); + return (Criteria) this; + } + + public Criteria andOriginPlatformIn(List values) { + addCriterion("origin_platform in", values, "originPlatform"); + return (Criteria) this; + } + + public Criteria andOriginPlatformNotIn(List values) { + addCriterion("origin_platform not in", values, "originPlatform"); + return (Criteria) this; + } + + public Criteria andOriginPlatformBetween(String value1, String value2) { + addCriterion("origin_platform between", value1, value2, "originPlatform"); + return (Criteria) this; + } + + public Criteria andOriginPlatformNotBetween(String value1, String value2) { + addCriterion("origin_platform not between", value1, value2, "originPlatform"); + return (Criteria) this; + } + + public Criteria andOriginDomainIsNull() { + addCriterion("origin_domain is null"); + return (Criteria) this; + } + + public Criteria andOriginDomainIsNotNull() { + addCriterion("origin_domain is not null"); + return (Criteria) this; + } + + public Criteria andOriginDomainEqualTo(String value) { + addCriterion("origin_domain =", value, "originDomain"); + return (Criteria) this; + } + + public Criteria andOriginDomainNotEqualTo(String value) { + addCriterion("origin_domain <>", value, "originDomain"); + return (Criteria) this; + } + + public Criteria andOriginDomainGreaterThan(String value) { + addCriterion("origin_domain >", value, "originDomain"); + return (Criteria) this; + } + + public Criteria andOriginDomainGreaterThanOrEqualTo(String value) { + addCriterion("origin_domain >=", value, "originDomain"); + return (Criteria) this; + } + + public Criteria andOriginDomainLessThan(String value) { + addCriterion("origin_domain <", value, "originDomain"); + return (Criteria) this; + } + + public Criteria andOriginDomainLessThanOrEqualTo(String value) { + addCriterion("origin_domain <=", value, "originDomain"); + return (Criteria) this; + } + + public Criteria andOriginDomainLike(String value) { + addCriterion("origin_domain like", value, "originDomain"); + return (Criteria) this; + } + + public Criteria andOriginDomainNotLike(String value) { + addCriterion("origin_domain not like", value, "originDomain"); + return (Criteria) this; + } + + public Criteria andOriginDomainIn(List values) { + addCriterion("origin_domain in", values, "originDomain"); + return (Criteria) this; + } + + public Criteria andOriginDomainNotIn(List values) { + addCriterion("origin_domain not in", values, "originDomain"); + return (Criteria) this; + } + + public Criteria andOriginDomainBetween(String value1, String value2) { + addCriterion("origin_domain between", value1, value2, "originDomain"); + return (Criteria) this; + } + + public Criteria andOriginDomainNotBetween(String value1, String value2) { + addCriterion("origin_domain not between", value1, value2, "originDomain"); + return (Criteria) this; + } + + public Criteria andOriginIpIsNull() { + addCriterion("origin_ip is null"); + return (Criteria) this; + } + + public Criteria andOriginIpIsNotNull() { + addCriterion("origin_ip is not null"); + return (Criteria) this; + } + + public Criteria andOriginIpEqualTo(String value) { + addCriterion("origin_ip =", value, "originIp"); + return (Criteria) this; + } + + public Criteria andOriginIpNotEqualTo(String value) { + addCriterion("origin_ip <>", value, "originIp"); + return (Criteria) this; + } + + public Criteria andOriginIpGreaterThan(String value) { + addCriterion("origin_ip >", value, "originIp"); + return (Criteria) this; + } + + public Criteria andOriginIpGreaterThanOrEqualTo(String value) { + addCriterion("origin_ip >=", value, "originIp"); + return (Criteria) this; + } + + public Criteria andOriginIpLessThan(String value) { + addCriterion("origin_ip <", value, "originIp"); + return (Criteria) this; + } + + public Criteria andOriginIpLessThanOrEqualTo(String value) { + addCriterion("origin_ip <=", value, "originIp"); + return (Criteria) this; + } + + public Criteria andOriginIpLike(String value) { + addCriterion("origin_ip like", value, "originIp"); + return (Criteria) this; + } + + public Criteria andOriginIpNotLike(String value) { + addCriterion("origin_ip not like", value, "originIp"); + return (Criteria) this; + } + + public Criteria andOriginIpIn(List values) { + addCriterion("origin_ip in", values, "originIp"); + return (Criteria) this; + } + + public Criteria andOriginIpNotIn(List values) { + addCriterion("origin_ip not in", values, "originIp"); + return (Criteria) this; + } + + public Criteria andOriginIpBetween(String value1, String value2) { + addCriterion("origin_ip between", value1, value2, "originIp"); + return (Criteria) this; + } + + public Criteria andOriginIpNotBetween(String value1, String value2) { + addCriterion("origin_ip not between", value1, value2, "originIp"); + return (Criteria) this; + } + + public Criteria andIsHiddenIsNull() { + addCriterion("is_hidden is null"); + return (Criteria) this; + } + + public Criteria andIsHiddenIsNotNull() { + addCriterion("is_hidden is not null"); + return (Criteria) this; + } + + public Criteria andIsHiddenEqualTo(Integer value) { + addCriterion("is_hidden =", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenNotEqualTo(Integer value) { + addCriterion("is_hidden <>", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenGreaterThan(Integer value) { + addCriterion("is_hidden >", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenGreaterThanOrEqualTo(Integer value) { + addCriterion("is_hidden >=", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenLessThan(Integer value) { + addCriterion("is_hidden <", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenLessThanOrEqualTo(Integer value) { + addCriterion("is_hidden <=", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenIn(List values) { + addCriterion("is_hidden in", values, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenNotIn(List values) { + addCriterion("is_hidden not in", values, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenBetween(Integer value1, Integer value2) { + addCriterion("is_hidden between", value1, value2, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenNotBetween(Integer value1, Integer value2) { + addCriterion("is_hidden not between", value1, value2, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsDeleteIsNull() { + addCriterion("is_delete is null"); + return (Criteria) this; + } + + public Criteria andIsDeleteIsNotNull() { + addCriterion("is_delete is not null"); + return (Criteria) this; + } + + public Criteria andIsDeleteEqualTo(Integer value) { + addCriterion("is_delete =", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteNotEqualTo(Integer value) { + addCriterion("is_delete <>", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteGreaterThan(Integer value) { + addCriterion("is_delete >", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteGreaterThanOrEqualTo(Integer value) { + addCriterion("is_delete >=", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteLessThan(Integer value) { + addCriterion("is_delete <", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteLessThanOrEqualTo(Integer value) { + addCriterion("is_delete <=", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteIn(List values) { + addCriterion("is_delete in", values, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteNotIn(List values) { + addCriterion("is_delete not in", values, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteBetween(Integer value1, Integer value2) { + addCriterion("is_delete between", value1, value2, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteNotBetween(Integer value1, Integer value2) { + addCriterion("is_delete not between", value1, value2, "isDelete"); + return (Criteria) this; + } + + public Criteria andDeleteTokenIsNull() { + addCriterion("delete_token is null"); + return (Criteria) this; + } + + public Criteria andDeleteTokenIsNotNull() { + addCriterion("delete_token is not null"); + return (Criteria) this; + } + + public Criteria andDeleteTokenEqualTo(String value) { + addCriterion("delete_token =", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotEqualTo(String value) { + addCriterion("delete_token <>", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenGreaterThan(String value) { + addCriterion("delete_token >", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenGreaterThanOrEqualTo(String value) { + addCriterion("delete_token >=", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenLessThan(String value) { + addCriterion("delete_token <", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenLessThanOrEqualTo(String value) { + addCriterion("delete_token <=", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenLike(String value) { + addCriterion("delete_token like", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotLike(String value) { + addCriterion("delete_token not like", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenIn(List values) { + addCriterion("delete_token in", values, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotIn(List values) { + addCriterion("delete_token not in", values, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenBetween(String value1, String value2) { + addCriterion("delete_token between", value1, value2, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotBetween(String value1, String value2) { + addCriterion("delete_token not between", value1, value2, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDataVersionIsNull() { + addCriterion("data_version is null"); + return (Criteria) this; + } + + public Criteria andDataVersionIsNotNull() { + addCriterion("data_version is not null"); + return (Criteria) this; + } + + public Criteria andDataVersionEqualTo(Integer value) { + addCriterion("data_version =", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionNotEqualTo(Integer value) { + addCriterion("data_version <>", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionGreaterThan(Integer value) { + addCriterion("data_version >", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionGreaterThanOrEqualTo(Integer value) { + addCriterion("data_version >=", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionLessThan(Integer value) { + addCriterion("data_version <", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionLessThanOrEqualTo(Integer value) { + addCriterion("data_version <=", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionIn(List values) { + addCriterion("data_version in", values, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionNotIn(List values) { + addCriterion("data_version not in", values, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionBetween(Integer value1, Integer value2) { + addCriterion("data_version between", value1, value2, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionNotBetween(Integer value1, Integer value2) { + addCriterion("data_version not between", value1, value2, "dataVersion"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Date value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Date value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Date value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Date value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Date value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Date value1, Date value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } + } + + /** + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_global_session + * + * @mbg.generated do_not_delete_during_merge + */ + public static class Criteria extends GeneratedCriteria { + protected Criteria() { + super(); + } + } + + /** + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_global_session + * + * @mbg.generated + */ + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalSetting.java b/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalSetting.java new file mode 100644 index 0000000..a495ee3 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalSetting.java @@ -0,0 +1,398 @@ +package com.iqudoo.platform.application.database.model; + +import java.io.Serializable; +import java.util.Date; + +/** + * Database Table Remarks: + * 系统全局配置信息表 + * + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_global_setting + */ +public class SystemGlobalSetting implements Serializable { + /** + * Database Column Remarks: + * GUID + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_setting.guid + * + * @mbg.generated + */ + private Long guid; + + /** + * Database Column Remarks: + * 配置KEY + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_setting.setting_key + * + * @mbg.generated + */ + private String settingKey; + + /** + * Database Column Remarks: + * 备注信息 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_setting.opt_remark + * + * @mbg.generated + */ + private String optRemark; + + /** + * Database Column Remarks: + * 隐藏标志 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_setting.is_hidden + * + * @mbg.generated + */ + private Integer isHidden; + + /** + * Database Column Remarks: + * 删除标志 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_setting.is_delete + * + * @mbg.generated + */ + private Integer isDelete; + + /** + * Database Column Remarks: + * 删除令牌 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_setting.delete_token + * + * @mbg.generated + */ + private String deleteToken; + + /** + * Database Column Remarks: + * 数据版本 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_setting.data_version + * + * @mbg.generated + */ + private Integer dataVersion; + + /** + * Database Column Remarks: + * 创建时间 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_setting.create_time + * + * @mbg.generated + */ + private Date createTime; + + /** + * Database Column Remarks: + * 更新时间 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_setting.update_time + * + * @mbg.generated + */ + private Date updateTime; + + /** + * Database Column Remarks: + * 配置内容 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_setting.setting_value + * + * @mbg.generated + */ + private String settingValue; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + private static final long serialVersionUID = 1L; + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_setting.guid + * + * @return the value of t_system_global_setting.guid + * + * @mbg.generated + */ + public Long getGuid() { + return guid; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_setting.guid + * + * @param guid the value for t_system_global_setting.guid + * + * @mbg.generated + */ + public void setGuid(Long guid) { + this.guid = guid; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_setting.setting_key + * + * @return the value of t_system_global_setting.setting_key + * + * @mbg.generated + */ + public String getSettingKey() { + return settingKey; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_setting.setting_key + * + * @param settingKey the value for t_system_global_setting.setting_key + * + * @mbg.generated + */ + public void setSettingKey(String settingKey) { + this.settingKey = settingKey == null ? null : settingKey.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_setting.opt_remark + * + * @return the value of t_system_global_setting.opt_remark + * + * @mbg.generated + */ + public String getOptRemark() { + return optRemark; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_setting.opt_remark + * + * @param optRemark the value for t_system_global_setting.opt_remark + * + * @mbg.generated + */ + public void setOptRemark(String optRemark) { + this.optRemark = optRemark == null ? null : optRemark.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_setting.is_hidden + * + * @return the value of t_system_global_setting.is_hidden + * + * @mbg.generated + */ + public Integer getIsHidden() { + return isHidden; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_setting.is_hidden + * + * @param isHidden the value for t_system_global_setting.is_hidden + * + * @mbg.generated + */ + public void setIsHidden(Integer isHidden) { + this.isHidden = isHidden; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_setting.is_delete + * + * @return the value of t_system_global_setting.is_delete + * + * @mbg.generated + */ + public Integer getIsDelete() { + return isDelete; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_setting.is_delete + * + * @param isDelete the value for t_system_global_setting.is_delete + * + * @mbg.generated + */ + public void setIsDelete(Integer isDelete) { + this.isDelete = isDelete; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_setting.delete_token + * + * @return the value of t_system_global_setting.delete_token + * + * @mbg.generated + */ + public String getDeleteToken() { + return deleteToken; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_setting.delete_token + * + * @param deleteToken the value for t_system_global_setting.delete_token + * + * @mbg.generated + */ + public void setDeleteToken(String deleteToken) { + this.deleteToken = deleteToken == null ? null : deleteToken.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_setting.data_version + * + * @return the value of t_system_global_setting.data_version + * + * @mbg.generated + */ + public Integer getDataVersion() { + return dataVersion; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_setting.data_version + * + * @param dataVersion the value for t_system_global_setting.data_version + * + * @mbg.generated + */ + public void setDataVersion(Integer dataVersion) { + this.dataVersion = dataVersion; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_setting.create_time + * + * @return the value of t_system_global_setting.create_time + * + * @mbg.generated + */ + public Date getCreateTime() { + return createTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_setting.create_time + * + * @param createTime the value for t_system_global_setting.create_time + * + * @mbg.generated + */ + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_setting.update_time + * + * @return the value of t_system_global_setting.update_time + * + * @mbg.generated + */ + public Date getUpdateTime() { + return updateTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_setting.update_time + * + * @param updateTime the value for t_system_global_setting.update_time + * + * @mbg.generated + */ + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_setting.setting_value + * + * @return the value of t_system_global_setting.setting_value + * + * @mbg.generated + */ + public String getSettingValue() { + return settingValue; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_setting.setting_value + * + * @param settingValue the value for t_system_global_setting.setting_value + * + * @mbg.generated + */ + public void setSettingValue(String settingValue) { + this.settingValue = settingValue == null ? null : settingValue.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", guid=").append(guid); + sb.append(", settingKey=").append(settingKey); + sb.append(", optRemark=").append(optRemark); + sb.append(", isHidden=").append(isHidden); + sb.append(", isDelete=").append(isDelete); + sb.append(", deleteToken=").append(deleteToken); + sb.append(", dataVersion=").append(dataVersion); + sb.append(", createTime=").append(createTime); + sb.append(", updateTime=").append(updateTime); + sb.append(", settingValue=").append(settingValue); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalSettingExample.java b/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalSettingExample.java new file mode 100644 index 0000000..8667322 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalSettingExample.java @@ -0,0 +1,1066 @@ +package com.iqudoo.platform.application.database.model; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Objects; + +public class SystemGlobalSettingExample { + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + protected String orderByClause; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + protected boolean distinct; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + protected List oredCriteria; + + protected String resultType = null; + + protected Integer maxPageSize = 100; + + protected Integer ignorePageSize = 10000; + + protected Integer startPageNum = 1; + + protected Integer offset = null; + + protected Integer rows = null; + + protected Boolean withBLOBs = true; + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + public SystemGlobalSettingExample() { + oredCriteria = new ArrayList<>(); + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + public String getOrderByClause() { + return orderByClause; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + public boolean isDistinct() { + return distinct; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + public List getOredCriteria() { + return oredCriteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + rows = null; + offset = null; + resultType = null; + } + + public void setWithBLOBs(Boolean withBLOBs) { + this.withBLOBs = withBLOBs; + } + + public boolean isWithBLOBs() { + return this.withBLOBs != null && this.withBLOBs; + } + + public void setMaxPageSize(Integer maxPageSize) { + this.maxPageSize = maxPageSize; + } + + public Integer getMaxPageSize() { + return this.maxPageSize; + } + + public void setIgnorePageSize(Integer ignorePageSize) { + this.ignorePageSize = ignorePageSize; + } + + public Integer getIgnorePageSize() { + return this.ignorePageSize; + } + + public void setStartPageNum(Integer startPageNum) { + this.startPageNum = startPageNum; + } + + public Integer getStartPageNum() { + return this.startPageNum; + } + + public SystemGlobalSettingExample setResultType(String type) { + this.resultType = type; + return this; + } + + public SystemGlobalSettingExample resultValid() { + this.resultType = "valid"; + return this; + } + + public Boolean isResultValid() { + return !this.isResultAny() && !this.isResultTrash(); + } + + public SystemGlobalSettingExample resultTrash() { + this.resultType = "trash"; + return this; + } + + public Boolean isResultTrash() { + return Objects.equals(this.resultType, "trash"); + } + + public SystemGlobalSettingExample resultAny() { + this.resultType = "any"; + return this; + } + + public Boolean isResultAny() { + return Objects.equals(this.resultType, "any"); + } + + public SystemGlobalSettingExample limit(Integer rows) { + this.offset = null; + this.rows = rows; + return this; + } + + public SystemGlobalSettingExample limit(Integer offset, Integer rows) { + this.offset = offset; + this.rows = rows; + return this; + } + + public SystemGlobalSettingExample limitOffset(Integer offset, Integer rows) { + this.offset = offset; + this.rows = 999999999; + return this; + } + + public SystemGlobalSettingExample usePage(Integer pageNum, Integer pageSize) { + pageSize = pageSize == null || pageSize <= 0 ? 1 : pageSize; + pageNum = pageNum == null || pageNum < this.startPageNum ? this.startPageNum : pageNum; + if (pageSize >= this.ignorePageSize) { + this.rows = null; + this.offset = null; + return this; + } + int cPageSize = pageSize > this.maxPageSize ? this.maxPageSize: pageSize; + this.offset = (pageNum - this.startPageNum) * cPageSize; + this.rows = cPageSize; + return this; + } + + public Integer getPageNum() { + if (this.rows == null || this.offset == null || this.rows == 0) { + return this.startPageNum; + } + return this.offset / this.rows + this.startPageNum; + } + + public Integer getPageSize() { + if (this.rows == null) { + return this.ignorePageSize; + } + return this.rows; + } + + public Integer getRows() { + return this.rows; + } + + public Integer getOffset() { + return this.offset; + } + + public String getLimitString() { + if (getRows() != null) { + if (getOffset() != null) { + return getOffset() + "," + getRows(); + } else { + return getRows() + ""; + } + } + return null; + } + + public String getWhereString() { + if (getOredCriteria() != null) { + List whereGroup = new ArrayList<>(); + for (Criteria criteria : getOredCriteria()) { + List criterionList = new ArrayList<>(); + for (Criterion criterion : criteria.getAllCriteria()) { + if (criterion.isNoValue()) { + criterionList.add(criterion.getCondition()); + } else if (criterion.isBetweenValue()) { + criterionList.add(criterion.getCondition() + " " + criterion.getValue() + "," + criterion.getSecondValue()); + } else { + criterionList.add(criterion.getCondition() + " " + criterion.getValue()); + } + } + whereGroup.add(String.join(" and ", criterionList)); + } + if (whereGroup.size() > 1) { + List mapWhereGroup = new ArrayList<>(); + for (String where : whereGroup) { + mapWhereGroup.add("(" + where + ")"); + } + whereGroup = mapWhereGroup; + } + return String.join(" or ", whereGroup); + } + return null; + } + + public SystemGlobalSettingExample cloneExample() { + SystemGlobalSettingExample newExample = new SystemGlobalSettingExample(); + newExample.rows = this.rows; + newExample.offset = this.offset; + newExample.maxPageSize = this.maxPageSize; + newExample.ignorePageSize = this.ignorePageSize; + newExample.startPageNum = this.startPageNum; + newExample.resultType = this.resultType; + newExample.withBLOBs = withBLOBs; + if (this.getOredCriteria() != null && !this.getOredCriteria().isEmpty()) { + for (SystemGlobalSettingExample.Criteria oldCriteria : this.getOredCriteria()) { + SystemGlobalSettingExample.Criteria newCriteria = newExample.or(); + newCriteria.getCriteria().addAll(oldCriteria.getCriteria()); + } + } + newExample.setOrderByClause(this.getOrderByClause()); + return newExample; + } + + /** + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList<>(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andGuidIsNull() { + addCriterion("guid is null"); + return (Criteria) this; + } + + public Criteria andGuidIsNotNull() { + addCriterion("guid is not null"); + return (Criteria) this; + } + + public Criteria andGuidEqualTo(Long value) { + addCriterion("guid =", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidNotEqualTo(Long value) { + addCriterion("guid <>", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidGreaterThan(Long value) { + addCriterion("guid >", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidGreaterThanOrEqualTo(Long value) { + addCriterion("guid >=", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidLessThan(Long value) { + addCriterion("guid <", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidLessThanOrEqualTo(Long value) { + addCriterion("guid <=", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidIn(List values) { + addCriterion("guid in", values, "guid"); + return (Criteria) this; + } + + public Criteria andGuidNotIn(List values) { + addCriterion("guid not in", values, "guid"); + return (Criteria) this; + } + + public Criteria andGuidBetween(Long value1, Long value2) { + addCriterion("guid between", value1, value2, "guid"); + return (Criteria) this; + } + + public Criteria andGuidNotBetween(Long value1, Long value2) { + addCriterion("guid not between", value1, value2, "guid"); + return (Criteria) this; + } + + public Criteria andSettingKeyIsNull() { + addCriterion("setting_key is null"); + return (Criteria) this; + } + + public Criteria andSettingKeyIsNotNull() { + addCriterion("setting_key is not null"); + return (Criteria) this; + } + + public Criteria andSettingKeyEqualTo(String value) { + addCriterion("setting_key =", value, "settingKey"); + return (Criteria) this; + } + + public Criteria andSettingKeyNotEqualTo(String value) { + addCriterion("setting_key <>", value, "settingKey"); + return (Criteria) this; + } + + public Criteria andSettingKeyGreaterThan(String value) { + addCriterion("setting_key >", value, "settingKey"); + return (Criteria) this; + } + + public Criteria andSettingKeyGreaterThanOrEqualTo(String value) { + addCriterion("setting_key >=", value, "settingKey"); + return (Criteria) this; + } + + public Criteria andSettingKeyLessThan(String value) { + addCriterion("setting_key <", value, "settingKey"); + return (Criteria) this; + } + + public Criteria andSettingKeyLessThanOrEqualTo(String value) { + addCriterion("setting_key <=", value, "settingKey"); + return (Criteria) this; + } + + public Criteria andSettingKeyLike(String value) { + addCriterion("setting_key like", value, "settingKey"); + return (Criteria) this; + } + + public Criteria andSettingKeyNotLike(String value) { + addCriterion("setting_key not like", value, "settingKey"); + return (Criteria) this; + } + + public Criteria andSettingKeyIn(List values) { + addCriterion("setting_key in", values, "settingKey"); + return (Criteria) this; + } + + public Criteria andSettingKeyNotIn(List values) { + addCriterion("setting_key not in", values, "settingKey"); + return (Criteria) this; + } + + public Criteria andSettingKeyBetween(String value1, String value2) { + addCriterion("setting_key between", value1, value2, "settingKey"); + return (Criteria) this; + } + + public Criteria andSettingKeyNotBetween(String value1, String value2) { + addCriterion("setting_key not between", value1, value2, "settingKey"); + return (Criteria) this; + } + + public Criteria andOptRemarkIsNull() { + addCriterion("opt_remark is null"); + return (Criteria) this; + } + + public Criteria andOptRemarkIsNotNull() { + addCriterion("opt_remark is not null"); + return (Criteria) this; + } + + public Criteria andOptRemarkEqualTo(String value) { + addCriterion("opt_remark =", value, "optRemark"); + return (Criteria) this; + } + + public Criteria andOptRemarkNotEqualTo(String value) { + addCriterion("opt_remark <>", value, "optRemark"); + return (Criteria) this; + } + + public Criteria andOptRemarkGreaterThan(String value) { + addCriterion("opt_remark >", value, "optRemark"); + return (Criteria) this; + } + + public Criteria andOptRemarkGreaterThanOrEqualTo(String value) { + addCriterion("opt_remark >=", value, "optRemark"); + return (Criteria) this; + } + + public Criteria andOptRemarkLessThan(String value) { + addCriterion("opt_remark <", value, "optRemark"); + return (Criteria) this; + } + + public Criteria andOptRemarkLessThanOrEqualTo(String value) { + addCriterion("opt_remark <=", value, "optRemark"); + return (Criteria) this; + } + + public Criteria andOptRemarkLike(String value) { + addCriterion("opt_remark like", value, "optRemark"); + return (Criteria) this; + } + + public Criteria andOptRemarkNotLike(String value) { + addCriterion("opt_remark not like", value, "optRemark"); + return (Criteria) this; + } + + public Criteria andOptRemarkIn(List values) { + addCriterion("opt_remark in", values, "optRemark"); + return (Criteria) this; + } + + public Criteria andOptRemarkNotIn(List values) { + addCriterion("opt_remark not in", values, "optRemark"); + return (Criteria) this; + } + + public Criteria andOptRemarkBetween(String value1, String value2) { + addCriterion("opt_remark between", value1, value2, "optRemark"); + return (Criteria) this; + } + + public Criteria andOptRemarkNotBetween(String value1, String value2) { + addCriterion("opt_remark not between", value1, value2, "optRemark"); + return (Criteria) this; + } + + public Criteria andIsHiddenIsNull() { + addCriterion("is_hidden is null"); + return (Criteria) this; + } + + public Criteria andIsHiddenIsNotNull() { + addCriterion("is_hidden is not null"); + return (Criteria) this; + } + + public Criteria andIsHiddenEqualTo(Integer value) { + addCriterion("is_hidden =", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenNotEqualTo(Integer value) { + addCriterion("is_hidden <>", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenGreaterThan(Integer value) { + addCriterion("is_hidden >", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenGreaterThanOrEqualTo(Integer value) { + addCriterion("is_hidden >=", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenLessThan(Integer value) { + addCriterion("is_hidden <", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenLessThanOrEqualTo(Integer value) { + addCriterion("is_hidden <=", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenIn(List values) { + addCriterion("is_hidden in", values, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenNotIn(List values) { + addCriterion("is_hidden not in", values, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenBetween(Integer value1, Integer value2) { + addCriterion("is_hidden between", value1, value2, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenNotBetween(Integer value1, Integer value2) { + addCriterion("is_hidden not between", value1, value2, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsDeleteIsNull() { + addCriterion("is_delete is null"); + return (Criteria) this; + } + + public Criteria andIsDeleteIsNotNull() { + addCriterion("is_delete is not null"); + return (Criteria) this; + } + + public Criteria andIsDeleteEqualTo(Integer value) { + addCriterion("is_delete =", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteNotEqualTo(Integer value) { + addCriterion("is_delete <>", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteGreaterThan(Integer value) { + addCriterion("is_delete >", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteGreaterThanOrEqualTo(Integer value) { + addCriterion("is_delete >=", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteLessThan(Integer value) { + addCriterion("is_delete <", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteLessThanOrEqualTo(Integer value) { + addCriterion("is_delete <=", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteIn(List values) { + addCriterion("is_delete in", values, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteNotIn(List values) { + addCriterion("is_delete not in", values, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteBetween(Integer value1, Integer value2) { + addCriterion("is_delete between", value1, value2, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteNotBetween(Integer value1, Integer value2) { + addCriterion("is_delete not between", value1, value2, "isDelete"); + return (Criteria) this; + } + + public Criteria andDeleteTokenIsNull() { + addCriterion("delete_token is null"); + return (Criteria) this; + } + + public Criteria andDeleteTokenIsNotNull() { + addCriterion("delete_token is not null"); + return (Criteria) this; + } + + public Criteria andDeleteTokenEqualTo(String value) { + addCriterion("delete_token =", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotEqualTo(String value) { + addCriterion("delete_token <>", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenGreaterThan(String value) { + addCriterion("delete_token >", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenGreaterThanOrEqualTo(String value) { + addCriterion("delete_token >=", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenLessThan(String value) { + addCriterion("delete_token <", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenLessThanOrEqualTo(String value) { + addCriterion("delete_token <=", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenLike(String value) { + addCriterion("delete_token like", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotLike(String value) { + addCriterion("delete_token not like", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenIn(List values) { + addCriterion("delete_token in", values, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotIn(List values) { + addCriterion("delete_token not in", values, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenBetween(String value1, String value2) { + addCriterion("delete_token between", value1, value2, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotBetween(String value1, String value2) { + addCriterion("delete_token not between", value1, value2, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDataVersionIsNull() { + addCriterion("data_version is null"); + return (Criteria) this; + } + + public Criteria andDataVersionIsNotNull() { + addCriterion("data_version is not null"); + return (Criteria) this; + } + + public Criteria andDataVersionEqualTo(Integer value) { + addCriterion("data_version =", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionNotEqualTo(Integer value) { + addCriterion("data_version <>", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionGreaterThan(Integer value) { + addCriterion("data_version >", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionGreaterThanOrEqualTo(Integer value) { + addCriterion("data_version >=", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionLessThan(Integer value) { + addCriterion("data_version <", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionLessThanOrEqualTo(Integer value) { + addCriterion("data_version <=", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionIn(List values) { + addCriterion("data_version in", values, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionNotIn(List values) { + addCriterion("data_version not in", values, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionBetween(Integer value1, Integer value2) { + addCriterion("data_version between", value1, value2, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionNotBetween(Integer value1, Integer value2) { + addCriterion("data_version not between", value1, value2, "dataVersion"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Date value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Date value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Date value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Date value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Date value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Date value1, Date value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } + } + + /** + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_global_setting + * + * @mbg.generated do_not_delete_during_merge + */ + public static class Criteria extends GeneratedCriteria { + protected Criteria() { + super(); + } + } + + /** + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_global_setting + * + * @mbg.generated + */ + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalVerify.java b/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalVerify.java new file mode 100644 index 0000000..9b29798 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalVerify.java @@ -0,0 +1,470 @@ +package com.iqudoo.platform.application.database.model; + +import java.io.Serializable; +import java.util.Date; + +/** + * Database Table Remarks: + * 系统全局验证码信息表 + * + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_global_verify + */ +public class SystemGlobalVerify implements Serializable { + /** + * Database Column Remarks: + * GUID + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_verify.guid + * + * @mbg.generated + */ + private Long guid; + + /** + * Database Column Remarks: + * 验证类型 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_verify.verify_type + * + * @mbg.generated + */ + private String verifyType; + + /** + * Database Column Remarks: + * 验证目标 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_verify.verify_target + * + * @mbg.generated + */ + private String verifyTarget; + + /** + * Database Column Remarks: + * 过期时间 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_verify.expires_time + * + * @mbg.generated + */ + private Long expiresTime; + + /** + * Database Column Remarks: + * 验证码值 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_verify.code_value + * + * @mbg.generated + */ + private String codeValue; + + /** + * Database Column Remarks: + * 使用标志 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_verify.opt_used + * + * @mbg.generated + */ + private Integer optUsed; + + /** + * Database Column Remarks: + * 隐藏标志 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_verify.is_hidden + * + * @mbg.generated + */ + private Integer isHidden; + + /** + * Database Column Remarks: + * 删除标志 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_verify.is_delete + * + * @mbg.generated + */ + private Integer isDelete; + + /** + * Database Column Remarks: + * 删除令牌 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_verify.delete_token + * + * @mbg.generated + */ + private String deleteToken; + + /** + * Database Column Remarks: + * 数据版本 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_verify.data_version + * + * @mbg.generated + */ + private Integer dataVersion; + + /** + * Database Column Remarks: + * 创建时间 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_verify.create_time + * + * @mbg.generated + */ + private Date createTime; + + /** + * Database Column Remarks: + * 更新时间 + * + * This field was generated by MyBatis Generator. + * This field corresponds to the database column t_system_global_verify.update_time + * + * @mbg.generated + */ + private Date updateTime; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_global_verify + * + * @mbg.generated + */ + private static final long serialVersionUID = 1L; + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_verify.guid + * + * @return the value of t_system_global_verify.guid + * + * @mbg.generated + */ + public Long getGuid() { + return guid; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_verify.guid + * + * @param guid the value for t_system_global_verify.guid + * + * @mbg.generated + */ + public void setGuid(Long guid) { + this.guid = guid; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_verify.verify_type + * + * @return the value of t_system_global_verify.verify_type + * + * @mbg.generated + */ + public String getVerifyType() { + return verifyType; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_verify.verify_type + * + * @param verifyType the value for t_system_global_verify.verify_type + * + * @mbg.generated + */ + public void setVerifyType(String verifyType) { + this.verifyType = verifyType == null ? null : verifyType.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_verify.verify_target + * + * @return the value of t_system_global_verify.verify_target + * + * @mbg.generated + */ + public String getVerifyTarget() { + return verifyTarget; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_verify.verify_target + * + * @param verifyTarget the value for t_system_global_verify.verify_target + * + * @mbg.generated + */ + public void setVerifyTarget(String verifyTarget) { + this.verifyTarget = verifyTarget == null ? null : verifyTarget.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_verify.expires_time + * + * @return the value of t_system_global_verify.expires_time + * + * @mbg.generated + */ + public Long getExpiresTime() { + return expiresTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_verify.expires_time + * + * @param expiresTime the value for t_system_global_verify.expires_time + * + * @mbg.generated + */ + public void setExpiresTime(Long expiresTime) { + this.expiresTime = expiresTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_verify.code_value + * + * @return the value of t_system_global_verify.code_value + * + * @mbg.generated + */ + public String getCodeValue() { + return codeValue; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_verify.code_value + * + * @param codeValue the value for t_system_global_verify.code_value + * + * @mbg.generated + */ + public void setCodeValue(String codeValue) { + this.codeValue = codeValue == null ? null : codeValue.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_verify.opt_used + * + * @return the value of t_system_global_verify.opt_used + * + * @mbg.generated + */ + public Integer getOptUsed() { + return optUsed; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_verify.opt_used + * + * @param optUsed the value for t_system_global_verify.opt_used + * + * @mbg.generated + */ + public void setOptUsed(Integer optUsed) { + this.optUsed = optUsed; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_verify.is_hidden + * + * @return the value of t_system_global_verify.is_hidden + * + * @mbg.generated + */ + public Integer getIsHidden() { + return isHidden; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_verify.is_hidden + * + * @param isHidden the value for t_system_global_verify.is_hidden + * + * @mbg.generated + */ + public void setIsHidden(Integer isHidden) { + this.isHidden = isHidden; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_verify.is_delete + * + * @return the value of t_system_global_verify.is_delete + * + * @mbg.generated + */ + public Integer getIsDelete() { + return isDelete; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_verify.is_delete + * + * @param isDelete the value for t_system_global_verify.is_delete + * + * @mbg.generated + */ + public void setIsDelete(Integer isDelete) { + this.isDelete = isDelete; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_verify.delete_token + * + * @return the value of t_system_global_verify.delete_token + * + * @mbg.generated + */ + public String getDeleteToken() { + return deleteToken; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_verify.delete_token + * + * @param deleteToken the value for t_system_global_verify.delete_token + * + * @mbg.generated + */ + public void setDeleteToken(String deleteToken) { + this.deleteToken = deleteToken == null ? null : deleteToken.trim(); + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_verify.data_version + * + * @return the value of t_system_global_verify.data_version + * + * @mbg.generated + */ + public Integer getDataVersion() { + return dataVersion; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_verify.data_version + * + * @param dataVersion the value for t_system_global_verify.data_version + * + * @mbg.generated + */ + public void setDataVersion(Integer dataVersion) { + this.dataVersion = dataVersion; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_verify.create_time + * + * @return the value of t_system_global_verify.create_time + * + * @mbg.generated + */ + public Date getCreateTime() { + return createTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_verify.create_time + * + * @param createTime the value for t_system_global_verify.create_time + * + * @mbg.generated + */ + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method returns the value of the database column t_system_global_verify.update_time + * + * @return the value of t_system_global_verify.update_time + * + * @mbg.generated + */ + public Date getUpdateTime() { + return updateTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method sets the value of the database column t_system_global_verify.update_time + * + * @param updateTime the value for t_system_global_verify.update_time + * + * @mbg.generated + */ + public void setUpdateTime(Date updateTime) { + this.updateTime = updateTime; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_verify + * + * @mbg.generated + */ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append(getClass().getSimpleName()); + sb.append(" ["); + sb.append("Hash = ").append(hashCode()); + sb.append(", guid=").append(guid); + sb.append(", verifyType=").append(verifyType); + sb.append(", verifyTarget=").append(verifyTarget); + sb.append(", expiresTime=").append(expiresTime); + sb.append(", codeValue=").append(codeValue); + sb.append(", optUsed=").append(optUsed); + sb.append(", isHidden=").append(isHidden); + sb.append(", isDelete=").append(isDelete); + sb.append(", deleteToken=").append(deleteToken); + sb.append(", dataVersion=").append(dataVersion); + sb.append(", createTime=").append(createTime); + sb.append(", updateTime=").append(updateTime); + sb.append(", serialVersionUID=").append(serialVersionUID); + sb.append("]"); + return sb.toString(); + } +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalVerifyExample.java b/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalVerifyExample.java new file mode 100644 index 0000000..5a1059a --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/database/model/SystemGlobalVerifyExample.java @@ -0,0 +1,1246 @@ +package com.iqudoo.platform.application.database.model; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; +import java.util.Objects; + +public class SystemGlobalVerifyExample { + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_global_verify + * + * @mbg.generated + */ + protected String orderByClause; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_global_verify + * + * @mbg.generated + */ + protected boolean distinct; + + /** + * This field was generated by MyBatis Generator. + * This field corresponds to the database table t_system_global_verify + * + * @mbg.generated + */ + protected List oredCriteria; + + protected String resultType = null; + + protected Integer maxPageSize = 100; + + protected Integer ignorePageSize = 10000; + + protected Integer startPageNum = 1; + + protected Integer offset = null; + + protected Integer rows = null; + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_verify + * + * @mbg.generated + */ + public SystemGlobalVerifyExample() { + oredCriteria = new ArrayList<>(); + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_verify + * + * @mbg.generated + */ + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_verify + * + * @mbg.generated + */ + public String getOrderByClause() { + return orderByClause; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_verify + * + * @mbg.generated + */ + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_verify + * + * @mbg.generated + */ + public boolean isDistinct() { + return distinct; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_verify + * + * @mbg.generated + */ + public List getOredCriteria() { + return oredCriteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_verify + * + * @mbg.generated + */ + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_verify + * + * @mbg.generated + */ + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_verify + * + * @mbg.generated + */ + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_verify + * + * @mbg.generated + */ + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + /** + * This method was generated by MyBatis Generator. + * This method corresponds to the database table t_system_global_verify + * + * @mbg.generated + */ + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + rows = null; + offset = null; + resultType = null; + } + + public void setMaxPageSize(Integer maxPageSize) { + this.maxPageSize = maxPageSize; + } + + public Integer getMaxPageSize() { + return this.maxPageSize; + } + + public void setIgnorePageSize(Integer ignorePageSize) { + this.ignorePageSize = ignorePageSize; + } + + public Integer getIgnorePageSize() { + return this.ignorePageSize; + } + + public void setStartPageNum(Integer startPageNum) { + this.startPageNum = startPageNum; + } + + public Integer getStartPageNum() { + return this.startPageNum; + } + + public SystemGlobalVerifyExample setResultType(String type) { + this.resultType = type; + return this; + } + + public SystemGlobalVerifyExample resultValid() { + this.resultType = "valid"; + return this; + } + + public Boolean isResultValid() { + return !this.isResultAny() && !this.isResultTrash(); + } + + public SystemGlobalVerifyExample resultTrash() { + this.resultType = "trash"; + return this; + } + + public Boolean isResultTrash() { + return Objects.equals(this.resultType, "trash"); + } + + public SystemGlobalVerifyExample resultAny() { + this.resultType = "any"; + return this; + } + + public Boolean isResultAny() { + return Objects.equals(this.resultType, "any"); + } + + public SystemGlobalVerifyExample limit(Integer rows) { + this.offset = null; + this.rows = rows; + return this; + } + + public SystemGlobalVerifyExample limit(Integer offset, Integer rows) { + this.offset = offset; + this.rows = rows; + return this; + } + + public SystemGlobalVerifyExample limitOffset(Integer offset, Integer rows) { + this.offset = offset; + this.rows = 999999999; + return this; + } + + public SystemGlobalVerifyExample usePage(Integer pageNum, Integer pageSize) { + pageSize = pageSize == null || pageSize <= 0 ? 1 : pageSize; + pageNum = pageNum == null || pageNum < this.startPageNum ? this.startPageNum : pageNum; + if (pageSize >= this.ignorePageSize) { + this.rows = null; + this.offset = null; + return this; + } + int cPageSize = pageSize > this.maxPageSize ? this.maxPageSize: pageSize; + this.offset = (pageNum - this.startPageNum) * cPageSize; + this.rows = cPageSize; + return this; + } + + public Integer getPageNum() { + if (this.rows == null || this.offset == null || this.rows == 0) { + return this.startPageNum; + } + return this.offset / this.rows + this.startPageNum; + } + + public Integer getPageSize() { + if (this.rows == null) { + return this.ignorePageSize; + } + return this.rows; + } + + public Integer getRows() { + return this.rows; + } + + public Integer getOffset() { + return this.offset; + } + + public String getLimitString() { + if (getRows() != null) { + if (getOffset() != null) { + return getOffset() + "," + getRows(); + } else { + return getRows() + ""; + } + } + return null; + } + + public String getWhereString() { + if (getOredCriteria() != null) { + List whereGroup = new ArrayList<>(); + for (Criteria criteria : getOredCriteria()) { + List criterionList = new ArrayList<>(); + for (Criterion criterion : criteria.getAllCriteria()) { + if (criterion.isNoValue()) { + criterionList.add(criterion.getCondition()); + } else if (criterion.isBetweenValue()) { + criterionList.add(criterion.getCondition() + " " + criterion.getValue() + "," + criterion.getSecondValue()); + } else { + criterionList.add(criterion.getCondition() + " " + criterion.getValue()); + } + } + whereGroup.add(String.join(" and ", criterionList)); + } + if (whereGroup.size() > 1) { + List mapWhereGroup = new ArrayList<>(); + for (String where : whereGroup) { + mapWhereGroup.add("(" + where + ")"); + } + whereGroup = mapWhereGroup; + } + return String.join(" or ", whereGroup); + } + return null; + } + + public SystemGlobalVerifyExample cloneExample() { + SystemGlobalVerifyExample newExample = new SystemGlobalVerifyExample(); + newExample.rows = this.rows; + newExample.offset = this.offset; + newExample.maxPageSize = this.maxPageSize; + newExample.ignorePageSize = this.ignorePageSize; + newExample.startPageNum = this.startPageNum; + newExample.resultType = this.resultType; + + if (this.getOredCriteria() != null && !this.getOredCriteria().isEmpty()) { + for (SystemGlobalVerifyExample.Criteria oldCriteria : this.getOredCriteria()) { + SystemGlobalVerifyExample.Criteria newCriteria = newExample.or(); + newCriteria.getCriteria().addAll(oldCriteria.getCriteria()); + } + } + newExample.setOrderByClause(this.getOrderByClause()); + return newExample; + } + + /** + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_global_verify + * + * @mbg.generated + */ + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList<>(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andGuidIsNull() { + addCriterion("guid is null"); + return (Criteria) this; + } + + public Criteria andGuidIsNotNull() { + addCriterion("guid is not null"); + return (Criteria) this; + } + + public Criteria andGuidEqualTo(Long value) { + addCriterion("guid =", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidNotEqualTo(Long value) { + addCriterion("guid <>", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidGreaterThan(Long value) { + addCriterion("guid >", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidGreaterThanOrEqualTo(Long value) { + addCriterion("guid >=", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidLessThan(Long value) { + addCriterion("guid <", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidLessThanOrEqualTo(Long value) { + addCriterion("guid <=", value, "guid"); + return (Criteria) this; + } + + public Criteria andGuidIn(List values) { + addCriterion("guid in", values, "guid"); + return (Criteria) this; + } + + public Criteria andGuidNotIn(List values) { + addCriterion("guid not in", values, "guid"); + return (Criteria) this; + } + + public Criteria andGuidBetween(Long value1, Long value2) { + addCriterion("guid between", value1, value2, "guid"); + return (Criteria) this; + } + + public Criteria andGuidNotBetween(Long value1, Long value2) { + addCriterion("guid not between", value1, value2, "guid"); + return (Criteria) this; + } + + public Criteria andVerifyTypeIsNull() { + addCriterion("verify_type is null"); + return (Criteria) this; + } + + public Criteria andVerifyTypeIsNotNull() { + addCriterion("verify_type is not null"); + return (Criteria) this; + } + + public Criteria andVerifyTypeEqualTo(String value) { + addCriterion("verify_type =", value, "verifyType"); + return (Criteria) this; + } + + public Criteria andVerifyTypeNotEqualTo(String value) { + addCriterion("verify_type <>", value, "verifyType"); + return (Criteria) this; + } + + public Criteria andVerifyTypeGreaterThan(String value) { + addCriterion("verify_type >", value, "verifyType"); + return (Criteria) this; + } + + public Criteria andVerifyTypeGreaterThanOrEqualTo(String value) { + addCriterion("verify_type >=", value, "verifyType"); + return (Criteria) this; + } + + public Criteria andVerifyTypeLessThan(String value) { + addCriterion("verify_type <", value, "verifyType"); + return (Criteria) this; + } + + public Criteria andVerifyTypeLessThanOrEqualTo(String value) { + addCriterion("verify_type <=", value, "verifyType"); + return (Criteria) this; + } + + public Criteria andVerifyTypeLike(String value) { + addCriterion("verify_type like", value, "verifyType"); + return (Criteria) this; + } + + public Criteria andVerifyTypeNotLike(String value) { + addCriterion("verify_type not like", value, "verifyType"); + return (Criteria) this; + } + + public Criteria andVerifyTypeIn(List values) { + addCriterion("verify_type in", values, "verifyType"); + return (Criteria) this; + } + + public Criteria andVerifyTypeNotIn(List values) { + addCriterion("verify_type not in", values, "verifyType"); + return (Criteria) this; + } + + public Criteria andVerifyTypeBetween(String value1, String value2) { + addCriterion("verify_type between", value1, value2, "verifyType"); + return (Criteria) this; + } + + public Criteria andVerifyTypeNotBetween(String value1, String value2) { + addCriterion("verify_type not between", value1, value2, "verifyType"); + return (Criteria) this; + } + + public Criteria andVerifyTargetIsNull() { + addCriterion("verify_target is null"); + return (Criteria) this; + } + + public Criteria andVerifyTargetIsNotNull() { + addCriterion("verify_target is not null"); + return (Criteria) this; + } + + public Criteria andVerifyTargetEqualTo(String value) { + addCriterion("verify_target =", value, "verifyTarget"); + return (Criteria) this; + } + + public Criteria andVerifyTargetNotEqualTo(String value) { + addCriterion("verify_target <>", value, "verifyTarget"); + return (Criteria) this; + } + + public Criteria andVerifyTargetGreaterThan(String value) { + addCriterion("verify_target >", value, "verifyTarget"); + return (Criteria) this; + } + + public Criteria andVerifyTargetGreaterThanOrEqualTo(String value) { + addCriterion("verify_target >=", value, "verifyTarget"); + return (Criteria) this; + } + + public Criteria andVerifyTargetLessThan(String value) { + addCriterion("verify_target <", value, "verifyTarget"); + return (Criteria) this; + } + + public Criteria andVerifyTargetLessThanOrEqualTo(String value) { + addCriterion("verify_target <=", value, "verifyTarget"); + return (Criteria) this; + } + + public Criteria andVerifyTargetLike(String value) { + addCriterion("verify_target like", value, "verifyTarget"); + return (Criteria) this; + } + + public Criteria andVerifyTargetNotLike(String value) { + addCriterion("verify_target not like", value, "verifyTarget"); + return (Criteria) this; + } + + public Criteria andVerifyTargetIn(List values) { + addCriterion("verify_target in", values, "verifyTarget"); + return (Criteria) this; + } + + public Criteria andVerifyTargetNotIn(List values) { + addCriterion("verify_target not in", values, "verifyTarget"); + return (Criteria) this; + } + + public Criteria andVerifyTargetBetween(String value1, String value2) { + addCriterion("verify_target between", value1, value2, "verifyTarget"); + return (Criteria) this; + } + + public Criteria andVerifyTargetNotBetween(String value1, String value2) { + addCriterion("verify_target not between", value1, value2, "verifyTarget"); + return (Criteria) this; + } + + public Criteria andExpiresTimeIsNull() { + addCriterion("expires_time is null"); + return (Criteria) this; + } + + public Criteria andExpiresTimeIsNotNull() { + addCriterion("expires_time is not null"); + return (Criteria) this; + } + + public Criteria andExpiresTimeEqualTo(Long value) { + addCriterion("expires_time =", value, "expiresTime"); + return (Criteria) this; + } + + public Criteria andExpiresTimeNotEqualTo(Long value) { + addCriterion("expires_time <>", value, "expiresTime"); + return (Criteria) this; + } + + public Criteria andExpiresTimeGreaterThan(Long value) { + addCriterion("expires_time >", value, "expiresTime"); + return (Criteria) this; + } + + public Criteria andExpiresTimeGreaterThanOrEqualTo(Long value) { + addCriterion("expires_time >=", value, "expiresTime"); + return (Criteria) this; + } + + public Criteria andExpiresTimeLessThan(Long value) { + addCriterion("expires_time <", value, "expiresTime"); + return (Criteria) this; + } + + public Criteria andExpiresTimeLessThanOrEqualTo(Long value) { + addCriterion("expires_time <=", value, "expiresTime"); + return (Criteria) this; + } + + public Criteria andExpiresTimeIn(List values) { + addCriterion("expires_time in", values, "expiresTime"); + return (Criteria) this; + } + + public Criteria andExpiresTimeNotIn(List values) { + addCriterion("expires_time not in", values, "expiresTime"); + return (Criteria) this; + } + + public Criteria andExpiresTimeBetween(Long value1, Long value2) { + addCriterion("expires_time between", value1, value2, "expiresTime"); + return (Criteria) this; + } + + public Criteria andExpiresTimeNotBetween(Long value1, Long value2) { + addCriterion("expires_time not between", value1, value2, "expiresTime"); + return (Criteria) this; + } + + public Criteria andCodeValueIsNull() { + addCriterion("code_value is null"); + return (Criteria) this; + } + + public Criteria andCodeValueIsNotNull() { + addCriterion("code_value is not null"); + return (Criteria) this; + } + + public Criteria andCodeValueEqualTo(String value) { + addCriterion("code_value =", value, "codeValue"); + return (Criteria) this; + } + + public Criteria andCodeValueNotEqualTo(String value) { + addCriterion("code_value <>", value, "codeValue"); + return (Criteria) this; + } + + public Criteria andCodeValueGreaterThan(String value) { + addCriterion("code_value >", value, "codeValue"); + return (Criteria) this; + } + + public Criteria andCodeValueGreaterThanOrEqualTo(String value) { + addCriterion("code_value >=", value, "codeValue"); + return (Criteria) this; + } + + public Criteria andCodeValueLessThan(String value) { + addCriterion("code_value <", value, "codeValue"); + return (Criteria) this; + } + + public Criteria andCodeValueLessThanOrEqualTo(String value) { + addCriterion("code_value <=", value, "codeValue"); + return (Criteria) this; + } + + public Criteria andCodeValueLike(String value) { + addCriterion("code_value like", value, "codeValue"); + return (Criteria) this; + } + + public Criteria andCodeValueNotLike(String value) { + addCriterion("code_value not like", value, "codeValue"); + return (Criteria) this; + } + + public Criteria andCodeValueIn(List values) { + addCriterion("code_value in", values, "codeValue"); + return (Criteria) this; + } + + public Criteria andCodeValueNotIn(List values) { + addCriterion("code_value not in", values, "codeValue"); + return (Criteria) this; + } + + public Criteria andCodeValueBetween(String value1, String value2) { + addCriterion("code_value between", value1, value2, "codeValue"); + return (Criteria) this; + } + + public Criteria andCodeValueNotBetween(String value1, String value2) { + addCriterion("code_value not between", value1, value2, "codeValue"); + return (Criteria) this; + } + + public Criteria andOptUsedIsNull() { + addCriterion("opt_used is null"); + return (Criteria) this; + } + + public Criteria andOptUsedIsNotNull() { + addCriterion("opt_used is not null"); + return (Criteria) this; + } + + public Criteria andOptUsedEqualTo(Integer value) { + addCriterion("opt_used =", value, "optUsed"); + return (Criteria) this; + } + + public Criteria andOptUsedNotEqualTo(Integer value) { + addCriterion("opt_used <>", value, "optUsed"); + return (Criteria) this; + } + + public Criteria andOptUsedGreaterThan(Integer value) { + addCriterion("opt_used >", value, "optUsed"); + return (Criteria) this; + } + + public Criteria andOptUsedGreaterThanOrEqualTo(Integer value) { + addCriterion("opt_used >=", value, "optUsed"); + return (Criteria) this; + } + + public Criteria andOptUsedLessThan(Integer value) { + addCriterion("opt_used <", value, "optUsed"); + return (Criteria) this; + } + + public Criteria andOptUsedLessThanOrEqualTo(Integer value) { + addCriterion("opt_used <=", value, "optUsed"); + return (Criteria) this; + } + + public Criteria andOptUsedIn(List values) { + addCriterion("opt_used in", values, "optUsed"); + return (Criteria) this; + } + + public Criteria andOptUsedNotIn(List values) { + addCriterion("opt_used not in", values, "optUsed"); + return (Criteria) this; + } + + public Criteria andOptUsedBetween(Integer value1, Integer value2) { + addCriterion("opt_used between", value1, value2, "optUsed"); + return (Criteria) this; + } + + public Criteria andOptUsedNotBetween(Integer value1, Integer value2) { + addCriterion("opt_used not between", value1, value2, "optUsed"); + return (Criteria) this; + } + + public Criteria andIsHiddenIsNull() { + addCriterion("is_hidden is null"); + return (Criteria) this; + } + + public Criteria andIsHiddenIsNotNull() { + addCriterion("is_hidden is not null"); + return (Criteria) this; + } + + public Criteria andIsHiddenEqualTo(Integer value) { + addCriterion("is_hidden =", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenNotEqualTo(Integer value) { + addCriterion("is_hidden <>", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenGreaterThan(Integer value) { + addCriterion("is_hidden >", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenGreaterThanOrEqualTo(Integer value) { + addCriterion("is_hidden >=", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenLessThan(Integer value) { + addCriterion("is_hidden <", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenLessThanOrEqualTo(Integer value) { + addCriterion("is_hidden <=", value, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenIn(List values) { + addCriterion("is_hidden in", values, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenNotIn(List values) { + addCriterion("is_hidden not in", values, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenBetween(Integer value1, Integer value2) { + addCriterion("is_hidden between", value1, value2, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsHiddenNotBetween(Integer value1, Integer value2) { + addCriterion("is_hidden not between", value1, value2, "isHidden"); + return (Criteria) this; + } + + public Criteria andIsDeleteIsNull() { + addCriterion("is_delete is null"); + return (Criteria) this; + } + + public Criteria andIsDeleteIsNotNull() { + addCriterion("is_delete is not null"); + return (Criteria) this; + } + + public Criteria andIsDeleteEqualTo(Integer value) { + addCriterion("is_delete =", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteNotEqualTo(Integer value) { + addCriterion("is_delete <>", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteGreaterThan(Integer value) { + addCriterion("is_delete >", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteGreaterThanOrEqualTo(Integer value) { + addCriterion("is_delete >=", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteLessThan(Integer value) { + addCriterion("is_delete <", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteLessThanOrEqualTo(Integer value) { + addCriterion("is_delete <=", value, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteIn(List values) { + addCriterion("is_delete in", values, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteNotIn(List values) { + addCriterion("is_delete not in", values, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteBetween(Integer value1, Integer value2) { + addCriterion("is_delete between", value1, value2, "isDelete"); + return (Criteria) this; + } + + public Criteria andIsDeleteNotBetween(Integer value1, Integer value2) { + addCriterion("is_delete not between", value1, value2, "isDelete"); + return (Criteria) this; + } + + public Criteria andDeleteTokenIsNull() { + addCriterion("delete_token is null"); + return (Criteria) this; + } + + public Criteria andDeleteTokenIsNotNull() { + addCriterion("delete_token is not null"); + return (Criteria) this; + } + + public Criteria andDeleteTokenEqualTo(String value) { + addCriterion("delete_token =", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotEqualTo(String value) { + addCriterion("delete_token <>", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenGreaterThan(String value) { + addCriterion("delete_token >", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenGreaterThanOrEqualTo(String value) { + addCriterion("delete_token >=", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenLessThan(String value) { + addCriterion("delete_token <", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenLessThanOrEqualTo(String value) { + addCriterion("delete_token <=", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenLike(String value) { + addCriterion("delete_token like", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotLike(String value) { + addCriterion("delete_token not like", value, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenIn(List values) { + addCriterion("delete_token in", values, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotIn(List values) { + addCriterion("delete_token not in", values, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenBetween(String value1, String value2) { + addCriterion("delete_token between", value1, value2, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDeleteTokenNotBetween(String value1, String value2) { + addCriterion("delete_token not between", value1, value2, "deleteToken"); + return (Criteria) this; + } + + public Criteria andDataVersionIsNull() { + addCriterion("data_version is null"); + return (Criteria) this; + } + + public Criteria andDataVersionIsNotNull() { + addCriterion("data_version is not null"); + return (Criteria) this; + } + + public Criteria andDataVersionEqualTo(Integer value) { + addCriterion("data_version =", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionNotEqualTo(Integer value) { + addCriterion("data_version <>", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionGreaterThan(Integer value) { + addCriterion("data_version >", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionGreaterThanOrEqualTo(Integer value) { + addCriterion("data_version >=", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionLessThan(Integer value) { + addCriterion("data_version <", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionLessThanOrEqualTo(Integer value) { + addCriterion("data_version <=", value, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionIn(List values) { + addCriterion("data_version in", values, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionNotIn(List values) { + addCriterion("data_version not in", values, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionBetween(Integer value1, Integer value2) { + addCriterion("data_version between", value1, value2, "dataVersion"); + return (Criteria) this; + } + + public Criteria andDataVersionNotBetween(Integer value1, Integer value2) { + addCriterion("data_version not between", value1, value2, "dataVersion"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Date value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Date value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Date value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Date value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Date value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Date value1, Date value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Date value1, Date value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Date value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Date value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Date value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Date value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Date value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Date value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Date value1, Date value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Date value1, Date value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } + } + + /** + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_global_verify + * + * @mbg.generated do_not_delete_during_merge + */ + public static class Criteria extends GeneratedCriteria { + protected Criteria() { + super(); + } + } + + /** + * This class was generated by MyBatis Generator. + * This class corresponds to the database table t_system_global_verify + * + * @mbg.generated + */ + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfo/ApiSystemAdminInfoCreateAction.java b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfo/ApiSystemAdminInfoCreateAction.java new file mode 100644 index 0000000..6cb97ed --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfo/ApiSystemAdminInfoCreateAction.java @@ -0,0 +1,37 @@ +package com.iqudoo.platform.application.domain.actions.apiSystemAdminInfo; + +import com.iqudoo.framework.tape.base.action.annotation.ActionConfig; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.platform.application.constants.BizConstants; +import com.iqudoo.platform.application.facade.request.SystemAdminInfoCreateParam; +import com.iqudoo.platform.application.facade.response.SystemAdminInfoDetailResponse; +import com.iqudoo.platform.application.facade.service.ISystemAdminInfoService; + +import javax.annotation.Resource; + +@ActionMapping(action = "api.system.admin.info.create") +@ActionConfig( + tag = BizConstants.AUTH_TAG_SYS_ADMIN_SUPER, + group = { + BizConstants.AUTH_GROUP_SYS_ADMIN + } +) +@ApiDocActionConfiguration( + response = { + SystemAdminInfoDetailResponse.class, + } +) +public class ApiSystemAdminInfoCreateAction extends ProtoActionHandler { + + @Resource + private ISystemAdminInfoService systemAdminInfoService; + + @Override + public Proto onHandleRequest(SystemAdminInfoCreateParam param) throws Throwable { + return systemAdminInfoService.doCreate(param); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfo/ApiSystemAdminInfoDeleteAction.java b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfo/ApiSystemAdminInfoDeleteAction.java new file mode 100644 index 0000000..51ed92b --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfo/ApiSystemAdminInfoDeleteAction.java @@ -0,0 +1,36 @@ +package com.iqudoo.platform.application.domain.actions.apiSystemAdminInfo; + +import com.iqudoo.framework.tape.base.action.annotation.ActionConfig; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.platform.application.constants.BizConstants; +import com.iqudoo.platform.application.facade.request.SystemAdminInfoDeleteParam; +import com.iqudoo.platform.application.facade.service.ISystemAdminInfoService; + +import javax.annotation.Resource; + +@ActionMapping(action = "api.system.admin.info.delete") +@ActionConfig( + tag = BizConstants.AUTH_TAG_SYS_ADMIN_SUPER, + group = { + BizConstants.AUTH_GROUP_SYS_ADMIN + } +) +@ApiDocActionConfiguration( + response = { + Void.class, + } +) +public class ApiSystemAdminInfoDeleteAction extends ProtoActionHandler { + + @Resource + private ISystemAdminInfoService systemAdminInfoService; + + @Override + public Proto onHandleRequest(SystemAdminInfoDeleteParam param) throws Throwable { + return systemAdminInfoService.doDelete(param); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfo/ApiSystemAdminInfoDetailAction.java b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfo/ApiSystemAdminInfoDetailAction.java new file mode 100644 index 0000000..b356db0 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfo/ApiSystemAdminInfoDetailAction.java @@ -0,0 +1,37 @@ +package com.iqudoo.platform.application.domain.actions.apiSystemAdminInfo; + +import com.iqudoo.framework.tape.base.action.annotation.ActionConfig; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.platform.application.constants.BizConstants; +import com.iqudoo.platform.application.facade.request.SystemAdminInfoDetailParam; +import com.iqudoo.platform.application.facade.response.SystemAdminInfoDetailResponse; +import com.iqudoo.platform.application.facade.service.ISystemAdminInfoService; + +import javax.annotation.Resource; + +@ActionMapping(action = "api.system.admin.info.detail") +@ActionConfig( + tag = BizConstants.AUTH_TAG_SYS_ADMIN_SUPER, + group = { + BizConstants.AUTH_GROUP_SYS_ADMIN + } +) +@ApiDocActionConfiguration( + response = { + SystemAdminInfoDetailResponse.class, + } +) +public class ApiSystemAdminInfoDetailAction extends ProtoActionHandler { + + @Resource + private ISystemAdminInfoService systemAdminInfoService; + + @Override + public Proto onHandleRequest(SystemAdminInfoDetailParam param) throws Throwable { + return systemAdminInfoService.getDetail(param); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfo/ApiSystemAdminInfoListAction.java b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfo/ApiSystemAdminInfoListAction.java new file mode 100644 index 0000000..afaa946 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfo/ApiSystemAdminInfoListAction.java @@ -0,0 +1,39 @@ +package com.iqudoo.platform.application.domain.actions.apiSystemAdminInfo; + +import com.iqudoo.framework.tape.base.action.annotation.ActionConfig; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.modules.crud.PageData; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.platform.application.constants.BizConstants; +import com.iqudoo.platform.application.facade.request.SystemAdminInfoListParam; +import com.iqudoo.platform.application.facade.response.SystemAdminInfoDetailResponse; +import com.iqudoo.platform.application.facade.service.ISystemAdminInfoService; + +import javax.annotation.Resource; + +@ActionMapping(action = "api.system.admin.info.list") +@ActionConfig( + tag = BizConstants.AUTH_TAG_SYS_ADMIN_SUPER, + group = { + BizConstants.AUTH_GROUP_SYS_ADMIN + } +) +@ApiDocActionConfiguration( + response = { + PageData.class, + SystemAdminInfoDetailResponse.class, + } +) +public class ApiSystemAdminInfoListAction extends ProtoActionHandler { + + @Resource + private ISystemAdminInfoService systemAdminInfoService; + + @Override + public Proto onHandleRequest(SystemAdminInfoListParam param) throws Throwable { + return systemAdminInfoService.getList(param); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfo/ApiSystemAdminInfoRecoverAction.java b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfo/ApiSystemAdminInfoRecoverAction.java new file mode 100644 index 0000000..01072c7 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfo/ApiSystemAdminInfoRecoverAction.java @@ -0,0 +1,36 @@ +package com.iqudoo.platform.application.domain.actions.apiSystemAdminInfo; + +import com.iqudoo.framework.tape.base.action.annotation.ActionConfig; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.platform.application.constants.BizConstants; +import com.iqudoo.platform.application.facade.request.SystemAdminInfoRecoverParam; +import com.iqudoo.platform.application.facade.service.ISystemAdminInfoService; + +import javax.annotation.Resource; + +@ActionMapping(action = "api.system.admin.info.recover") +@ActionConfig( + tag = BizConstants.AUTH_TAG_SYS_ADMIN_SUPER, + group = { + BizConstants.AUTH_GROUP_SYS_ADMIN + } +) +@ApiDocActionConfiguration( + response = { + Void.class, + } +) +public class ApiSystemAdminInfoRecoverAction extends ProtoActionHandler { + + @Resource + private ISystemAdminInfoService systemAdminInfoService; + + @Override + public Proto onHandleRequest(SystemAdminInfoRecoverParam param) throws Throwable { + return systemAdminInfoService.doRecover(param); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfo/ApiSystemAdminInfoUpdateAction.java b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfo/ApiSystemAdminInfoUpdateAction.java new file mode 100644 index 0000000..66908e6 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfo/ApiSystemAdminInfoUpdateAction.java @@ -0,0 +1,36 @@ +package com.iqudoo.platform.application.domain.actions.apiSystemAdminInfo; + +import com.iqudoo.framework.tape.base.action.annotation.ActionConfig; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.platform.application.constants.BizConstants; +import com.iqudoo.platform.application.facade.request.SystemAdminInfoUpdateParam; +import com.iqudoo.platform.application.facade.service.ISystemAdminInfoService; + +import javax.annotation.Resource; + +@ActionMapping(action = "api.system.admin.info.update") +@ActionConfig( + tag = BizConstants.AUTH_TAG_SYS_ADMIN_SUPER, + group = { + BizConstants.AUTH_GROUP_SYS_ADMIN + } +) +@ApiDocActionConfiguration( + response = { + Void.class, + } +) +public class ApiSystemAdminInfoUpdateAction extends ProtoActionHandler { + + @Resource + private ISystemAdminInfoService systemAdminInfoService; + + @Override + public Proto onHandleRequest(SystemAdminInfoUpdateParam param) throws Throwable { + return systemAdminInfoService.doUpdate(param); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfoAuth/ApiSystemAdminInfoAuthEditPasswordAction.java b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfoAuth/ApiSystemAdminInfoAuthEditPasswordAction.java new file mode 100644 index 0000000..ac1165b --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfoAuth/ApiSystemAdminInfoAuthEditPasswordAction.java @@ -0,0 +1,36 @@ +package com.iqudoo.platform.application.domain.actions.apiSystemAdminInfoAuth; + +import com.iqudoo.framework.tape.base.action.annotation.ActionConfig; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.platform.application.constants.BizConstants; +import com.iqudoo.platform.application.facade.request.SystemAdminInfoAuthEditPasswordParam; +import com.iqudoo.platform.application.facade.service.ISystemAdminInfoAuthService; + +import javax.annotation.Resource; + +@ActionMapping(action = "api.system.admin.info.auth.editPassword") +@ActionConfig( + group = { + BizConstants.AUTH_GROUP_SYS_ADMIN + } +) +@ApiDocActionConfiguration( + response = { + Void.class, + } +) +public class ApiSystemAdminInfoAuthEditPasswordAction extends ProtoActionHandler { + + @Resource + private ISystemAdminInfoAuthService systemAdminInfoAuthService; + + @Override + public Proto onHandleRequest(SystemAdminInfoAuthEditPasswordParam param) throws Throwable { + param.setGuid(param.getCurrentUserGuid()); + return systemAdminInfoAuthService.doEditPassword(param); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfoAuth/ApiSystemAdminInfoAuthEditProfileAction.java b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfoAuth/ApiSystemAdminInfoAuthEditProfileAction.java new file mode 100644 index 0000000..57a8699 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfoAuth/ApiSystemAdminInfoAuthEditProfileAction.java @@ -0,0 +1,36 @@ +package com.iqudoo.platform.application.domain.actions.apiSystemAdminInfoAuth; + +import com.iqudoo.framework.tape.base.action.annotation.ActionConfig; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.platform.application.constants.BizConstants; +import com.iqudoo.platform.application.facade.request.SystemAdminInfoAuthEditProfileParam; +import com.iqudoo.platform.application.facade.service.ISystemAdminInfoAuthService; + +import javax.annotation.Resource; + +@ActionMapping(action = "api.system.admin.info.auth.editProfile") +@ActionConfig( + group = { + BizConstants.AUTH_GROUP_SYS_ADMIN + } +) +@ApiDocActionConfiguration( + response = { + Void.class, + } +) +public class ApiSystemAdminInfoAuthEditProfileAction extends ProtoActionHandler { + + @Resource + private ISystemAdminInfoAuthService systemAdminInfoAuthService; + + @Override + public Proto onHandleRequest(SystemAdminInfoAuthEditProfileParam param) throws Throwable { + param.setGuid(param.getCurrentUserGuid()); + return systemAdminInfoAuthService.doEditProfile(param); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfoAuth/ApiSystemAdminInfoAuthLoginAction.java b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfoAuth/ApiSystemAdminInfoAuthLoginAction.java new file mode 100644 index 0000000..263f5fe --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfoAuth/ApiSystemAdminInfoAuthLoginAction.java @@ -0,0 +1,29 @@ +package com.iqudoo.platform.application.domain.actions.apiSystemAdminInfoAuth; + +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.platform.application.facade.request.SystemAdminInfoAuthLoginParam; +import com.iqudoo.platform.application.facade.response.SystemAdminInfoAuthLoginResponse; +import com.iqudoo.platform.application.facade.service.ISystemAdminInfoAuthService; + +import javax.annotation.Resource; + +@ActionMapping(action = "api.system.admin.info.auth.login") +@ApiDocActionConfiguration( + response = { + SystemAdminInfoAuthLoginResponse.class, + } +) +public class ApiSystemAdminInfoAuthLoginAction extends ProtoActionHandler { + + @Resource + private ISystemAdminInfoAuthService systemAdminInfoAuthService; + + @Override + public Proto onHandleRequest(SystemAdminInfoAuthLoginParam param) throws Throwable { + return systemAdminInfoAuthService.doLogin(param); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfoAuth/ApiSystemAdminInfoAuthProfileAction.java b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfoAuth/ApiSystemAdminInfoAuthProfileAction.java new file mode 100644 index 0000000..e3f5db1 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAdminInfoAuth/ApiSystemAdminInfoAuthProfileAction.java @@ -0,0 +1,39 @@ +package com.iqudoo.platform.application.domain.actions.apiSystemAdminInfoAuth; + +import com.iqudoo.framework.tape.base.action.annotation.ActionConfig; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.platform.application.constants.BizConstants; +import com.iqudoo.platform.application.facade.request.SystemAdminInfoDetailParam; +import com.iqudoo.platform.application.facade.response.SystemAdminInfoDetailResponse; +import com.iqudoo.platform.application.facade.service.ISystemAdminInfoService; + +import javax.annotation.Resource; + +@ActionMapping(action = "api.system.admin.info.auth.profile") +@ActionConfig( + group = { + BizConstants.AUTH_GROUP_SYS_ADMIN + } +) +@ApiDocActionConfiguration( + response = { + SystemAdminInfoDetailResponse.class, + } +) +public class ApiSystemAdminInfoAuthProfileAction extends ProtoActionHandler { + + @Resource + private ISystemAdminInfoService systemAdminInfoService; + + @Override + public Proto onHandleRequest(SystemAdminInfoDetailParam param) throws Throwable { + if (param.getCurrentSystemAdminInfo() != null) { + param.setGuid(param.getCurrentSystemAdminInfo().getGuid()); + } + return systemAdminInfoService.getDetail(param); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAsyncTaskInfo/ApiSystemAsyncTaskInfoCancelAction.java b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAsyncTaskInfo/ApiSystemAsyncTaskInfoCancelAction.java new file mode 100644 index 0000000..d470788 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAsyncTaskInfo/ApiSystemAsyncTaskInfoCancelAction.java @@ -0,0 +1,36 @@ +package com.iqudoo.platform.application.domain.actions.apiSystemAsyncTaskInfo; + +import com.iqudoo.framework.tape.base.action.annotation.ActionConfig; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.platform.application.constants.BizConstants; +import com.iqudoo.platform.application.facade.request.SystemAsyncTaskInfoCancelParam; +import com.iqudoo.platform.application.facade.response.SystemAsyncTaskInfoDetailResponse; +import com.iqudoo.platform.application.facade.service.ISystemAsyncTaskInfoService; + +import javax.annotation.Resource; + +@ActionMapping(action = "api.system.async.task.info.cancel") +@ActionConfig( + group = { + BizConstants.AUTH_GROUP_SYS_ADMIN + } +) +@ApiDocActionConfiguration( + response = { + SystemAsyncTaskInfoDetailResponse.class + } +) +public class ApiSystemAsyncTaskInfoCancelAction extends ProtoActionHandler { + + @Resource + private ISystemAsyncTaskInfoService systemAsyncTaskInfoService; + + @Override + public Proto onHandleRequest(SystemAsyncTaskInfoCancelParam param) throws Throwable { + return systemAsyncTaskInfoService.doCancel(param); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAsyncTaskInfo/ApiSystemAsyncTaskInfoDeleteAction.java b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAsyncTaskInfo/ApiSystemAsyncTaskInfoDeleteAction.java new file mode 100644 index 0000000..831dab7 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAsyncTaskInfo/ApiSystemAsyncTaskInfoDeleteAction.java @@ -0,0 +1,36 @@ +package com.iqudoo.platform.application.domain.actions.apiSystemAsyncTaskInfo; + +import com.iqudoo.framework.tape.base.action.annotation.ActionConfig; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.platform.application.constants.BizConstants; +import com.iqudoo.platform.application.facade.request.SystemAsyncTaskInfoDeleteParam; +import com.iqudoo.platform.application.facade.response.SystemAsyncTaskInfoDetailResponse; +import com.iqudoo.platform.application.facade.service.ISystemAsyncTaskInfoService; + +import javax.annotation.Resource; + +@ActionMapping(action = "api.system.async.task.info.delete") +@ActionConfig( + group = { + BizConstants.AUTH_GROUP_SYS_ADMIN, + } +) +@ApiDocActionConfiguration( + response = { + SystemAsyncTaskInfoDetailResponse.class + } +) +public class ApiSystemAsyncTaskInfoDeleteAction extends ProtoActionHandler { + + @Resource + private ISystemAsyncTaskInfoService systemAsyncTaskInfoService; + + @Override + public Proto onHandleRequest(SystemAsyncTaskInfoDeleteParam param) throws Throwable { + return systemAsyncTaskInfoService.doDelete(param); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAsyncTaskInfo/ApiSystemAsyncTaskInfoDetailAction.java b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAsyncTaskInfo/ApiSystemAsyncTaskInfoDetailAction.java new file mode 100644 index 0000000..29e230d --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAsyncTaskInfo/ApiSystemAsyncTaskInfoDetailAction.java @@ -0,0 +1,36 @@ +package com.iqudoo.platform.application.domain.actions.apiSystemAsyncTaskInfo; + +import com.iqudoo.framework.tape.base.action.annotation.ActionConfig; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.platform.application.constants.BizConstants; +import com.iqudoo.platform.application.facade.request.SystemAsyncTaskInfoDetailParam; +import com.iqudoo.platform.application.facade.response.SystemAsyncTaskInfoDetailResponse; +import com.iqudoo.platform.application.facade.service.ISystemAsyncTaskInfoService; + +import javax.annotation.Resource; + +@ActionMapping(action = "api.system.async.task.info.detail") +@ActionConfig( + group = { + BizConstants.AUTH_GROUP_SYS_ADMIN, + } +) +@ApiDocActionConfiguration( + response = { + SystemAsyncTaskInfoDetailResponse.class + } +) +public class ApiSystemAsyncTaskInfoDetailAction extends ProtoActionHandler { + + @Resource + private ISystemAsyncTaskInfoService systemAsyncTaskInfoService; + + @Override + public Proto onHandleRequest(SystemAsyncTaskInfoDetailParam param) throws Throwable { + return systemAsyncTaskInfoService.getDetail(param); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAsyncTaskInfo/ApiSystemAsyncTaskInfoListAction.java b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAsyncTaskInfo/ApiSystemAsyncTaskInfoListAction.java new file mode 100644 index 0000000..2131636 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAsyncTaskInfo/ApiSystemAsyncTaskInfoListAction.java @@ -0,0 +1,38 @@ +package com.iqudoo.platform.application.domain.actions.apiSystemAsyncTaskInfo; + +import com.iqudoo.framework.tape.base.action.annotation.ActionConfig; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.modules.crud.PageData; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.platform.application.constants.BizConstants; +import com.iqudoo.platform.application.facade.request.SystemAsyncTaskInfoListParam; +import com.iqudoo.platform.application.facade.response.SystemAsyncTaskInfoDetailResponse; +import com.iqudoo.platform.application.facade.service.ISystemAsyncTaskInfoService; + +import javax.annotation.Resource; + +@ActionMapping(action = "api.system.async.task.info.list") +@ActionConfig( + group = { + BizConstants.AUTH_GROUP_SYS_ADMIN, + } +) +@ApiDocActionConfiguration( + response = { + PageData.class, + SystemAsyncTaskInfoDetailResponse.class + } +) +public class ApiSystemAsyncTaskInfoListAction extends ProtoActionHandler { + + @Resource + private ISystemAsyncTaskInfoService systemAsyncTaskInfoService; + + @Override + public Proto onHandleRequest(SystemAsyncTaskInfoListParam param) throws Throwable { + return systemAsyncTaskInfoService.getList(param); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAsyncTaskInfo/ApiSystemAsyncTaskInfoLogsAction.java b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAsyncTaskInfo/ApiSystemAsyncTaskInfoLogsAction.java new file mode 100644 index 0000000..0547419 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAsyncTaskInfo/ApiSystemAsyncTaskInfoLogsAction.java @@ -0,0 +1,36 @@ +package com.iqudoo.platform.application.domain.actions.apiSystemAsyncTaskInfo; + +import com.iqudoo.framework.tape.base.action.annotation.ActionConfig; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.platform.application.constants.BizConstants; +import com.iqudoo.platform.application.facade.request.SystemAsyncTaskInfoLogsParam; +import com.iqudoo.platform.application.facade.response.SystemAsyncTaskInfoLogsResponse; +import com.iqudoo.platform.application.facade.service.ISystemAsyncTaskInfoService; + +import javax.annotation.Resource; + +@ActionMapping(action = "api.system.async.task.info.logs") +@ActionConfig( + group = { + BizConstants.AUTH_GROUP_SYS_ADMIN, + } +) +@ApiDocActionConfiguration( + response = { + SystemAsyncTaskInfoLogsResponse.class + } +) +public class ApiSystemAsyncTaskInfoLogsAction extends ProtoActionHandler { + + @Resource + private ISystemAsyncTaskInfoService systemAsyncTaskInfoService; + + @Override + public Proto onHandleRequest(SystemAsyncTaskInfoLogsParam param) throws Throwable { + return systemAsyncTaskInfoService.getLogs(param); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAsyncTaskInfo/ApiSystemAsyncTaskInfoRestartAction.java b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAsyncTaskInfo/ApiSystemAsyncTaskInfoRestartAction.java new file mode 100644 index 0000000..529db12 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemAsyncTaskInfo/ApiSystemAsyncTaskInfoRestartAction.java @@ -0,0 +1,36 @@ +package com.iqudoo.platform.application.domain.actions.apiSystemAsyncTaskInfo; + +import com.iqudoo.framework.tape.base.action.annotation.ActionConfig; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.platform.application.constants.BizConstants; +import com.iqudoo.platform.application.facade.request.SystemAsyncTaskInfoRestartParam; +import com.iqudoo.platform.application.facade.response.SystemAsyncTaskInfoDetailResponse; +import com.iqudoo.platform.application.facade.service.ISystemAsyncTaskInfoService; + +import javax.annotation.Resource; + +@ActionMapping(action = "api.system.async.task.info.restart") +@ActionConfig( + group = { + BizConstants.AUTH_GROUP_SYS_ADMIN, + } +) +@ApiDocActionConfiguration( + response = { + Void.class + } +) +public class ApiSystemAsyncTaskInfoRestartAction extends ProtoActionHandler { + + @Resource + private ISystemAsyncTaskInfoService systemAsyncTaskInfoService; + + @Override + public Proto onHandleRequest(SystemAsyncTaskInfoRestartParam param) throws Throwable { + return systemAsyncTaskInfoService.doRestart(param); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemGlobalFile/ApiSystemGlobalFileTransferAction.java b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemGlobalFile/ApiSystemGlobalFileTransferAction.java new file mode 100644 index 0000000..083dca2 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemGlobalFile/ApiSystemGlobalFileTransferAction.java @@ -0,0 +1,36 @@ +package com.iqudoo.platform.application.domain.actions.apiSystemGlobalFile; + +import com.iqudoo.framework.tape.base.action.annotation.ActionConfig; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.platform.application.constants.BizConstants; +import com.iqudoo.platform.application.facade.request.SystemGlobalFileTransferParam; +import com.iqudoo.platform.application.facade.response.SystemGlobalFileTransferResponse; +import com.iqudoo.platform.application.facade.service.ISystemGlobalFileService; + +import javax.annotation.Resource; + +@ActionMapping(action = "api.system.global.file.transfer") +@ActionConfig( + group = { + BizConstants.AUTH_GROUP_SYS_ADMIN, + } +) +@ApiDocActionConfiguration( + response = { + SystemGlobalFileTransferResponse.class, + } +) +public class ApiSystemGlobalFileTransferAction extends ProtoActionHandler { + + @Resource + private ISystemGlobalFileService systemGlobalFileService; + + @Override + public Proto onHandleRequest(SystemGlobalFileTransferParam param) throws Throwable { + return systemGlobalFileService.doFileTransfer(param); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemGlobalFile/ApiSystemGlobalFileUploadAction.java b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemGlobalFile/ApiSystemGlobalFileUploadAction.java new file mode 100644 index 0000000..ccea986 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemGlobalFile/ApiSystemGlobalFileUploadAction.java @@ -0,0 +1,36 @@ +package com.iqudoo.platform.application.domain.actions.apiSystemGlobalFile; + +import com.iqudoo.framework.tape.base.action.annotation.ActionConfig; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.platform.application.constants.BizConstants; +import com.iqudoo.platform.application.facade.request.SystemGlobalFileUploadParam; +import com.iqudoo.platform.application.facade.response.SystemGlobalFileUploadResponse; +import com.iqudoo.platform.application.facade.service.ISystemGlobalFileService; + +import javax.annotation.Resource; + +@ActionMapping(action = "api.system.global.file.upload") +@ActionConfig( + group = { + BizConstants.AUTH_GROUP_SYS_ADMIN, + } +) +@ApiDocActionConfiguration( + response = { + SystemGlobalFileUploadResponse.class, + } +) +public class ApiSystemGlobalFileUploadAction extends ProtoActionHandler { + + @Resource + private ISystemGlobalFileService systemGlobalFileService; + + @Override + public Proto onHandleRequest(SystemGlobalFileUploadParam param) throws Throwable { + return systemGlobalFileService.doFileUpload(param); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemGlobalSetting/ApiSystemGlobalSettingDetailAction.java b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemGlobalSetting/ApiSystemGlobalSettingDetailAction.java new file mode 100644 index 0000000..0bd0294 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemGlobalSetting/ApiSystemGlobalSettingDetailAction.java @@ -0,0 +1,37 @@ +package com.iqudoo.platform.application.domain.actions.apiSystemGlobalSetting; + +import com.iqudoo.framework.tape.base.action.annotation.ActionConfig; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.platform.application.constants.BizConstants; +import com.iqudoo.platform.application.facade.request.SystemGlobalSettingDetailParam; +import com.iqudoo.platform.application.facade.response.SystemGlobalSettingDetailResponse; +import com.iqudoo.platform.application.facade.service.ISystemGlobalSettingService; + +import javax.annotation.Resource; + +@ActionMapping(action = "api.system.global.setting.detail") +@ActionConfig( + tag = BizConstants.AUTH_TAG_SYS_ADMIN_SUPER, + group = { + BizConstants.AUTH_GROUP_SYS_ADMIN + } +) +@ApiDocActionConfiguration( + response = { + SystemGlobalSettingDetailResponse.class, + } +) +public class ApiSystemGlobalSettingDetailAction extends ProtoActionHandler { + + @Resource + private ISystemGlobalSettingService systemGlobalSettingService; + + @Override + public Proto onHandleRequest(SystemGlobalSettingDetailParam param) throws Throwable { + return systemGlobalSettingService.getDetail(param); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemGlobalSetting/ApiSystemGlobalSettingEditAction.java b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemGlobalSetting/ApiSystemGlobalSettingEditAction.java new file mode 100644 index 0000000..e4378ae --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemGlobalSetting/ApiSystemGlobalSettingEditAction.java @@ -0,0 +1,37 @@ +package com.iqudoo.platform.application.domain.actions.apiSystemGlobalSetting; + +import com.iqudoo.framework.tape.base.action.annotation.ActionConfig; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.platform.application.constants.BizConstants; +import com.iqudoo.platform.application.facade.request.SystemGlobalSettingEditParam; +import com.iqudoo.platform.application.facade.response.SystemGlobalSettingDetailResponse; +import com.iqudoo.platform.application.facade.service.ISystemGlobalSettingService; + +import javax.annotation.Resource; + +@ActionMapping(action = "api.system.global.setting.edit") +@ActionConfig( + tag = BizConstants.AUTH_TAG_SYS_ADMIN_SUPER, + group = { + BizConstants.AUTH_GROUP_SYS_ADMIN + } +) +@ApiDocActionConfiguration( + response = { + SystemGlobalSettingDetailResponse.class, + } +) +public class ApiSystemGlobalSettingEditAction extends ProtoActionHandler { + + @Resource + private ISystemGlobalSettingService systemGlobalSettingService; + + @Override + public Proto onHandleRequest(SystemGlobalSettingEditParam param) throws Throwable { + return systemGlobalSettingService.doEdit(param); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemGlobalSetting/ApiSystemGlobalSettingListAction.java b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemGlobalSetting/ApiSystemGlobalSettingListAction.java new file mode 100644 index 0000000..7864c89 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/actions/apiSystemGlobalSetting/ApiSystemGlobalSettingListAction.java @@ -0,0 +1,38 @@ +package com.iqudoo.platform.application.domain.actions.apiSystemGlobalSetting; + +import com.iqudoo.framework.tape.base.action.annotation.ActionConfig; +import com.iqudoo.framework.tape.base.action.annotation.ActionMapping; +import com.iqudoo.framework.tape.base.action.handler.ProtoActionHandler; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocActionConfiguration; +import com.iqudoo.framework.tape.modules.IModuleSetting; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.platform.application.constants.BizConstants; +import com.iqudoo.platform.application.facade.service.ISystemGlobalSettingService; + +import javax.annotation.Resource; +import java.util.List; + +@ActionMapping(action = "api.system.global.setting.list") +@ActionConfig( + tag = BizConstants.AUTH_TAG_SYS_ADMIN_SUPER, + group = { + BizConstants.AUTH_GROUP_SYS_ADMIN + } +) +@ApiDocActionConfiguration( + response = { + List.class, + IModuleSetting.SettingInfo.class, + } +) +public class ApiSystemGlobalSettingListAction extends ProtoActionHandler { + + @Resource + private ISystemGlobalSettingService systemGlobalSettingService; + + @Override + public Proto onHandleRequest(Void param) throws Throwable { + return systemGlobalSettingService.getList(); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/asyncTask/package-info.java b/src/main/java/com/iqudoo/platform/application/domain/asyncTask/package-info.java new file mode 100644 index 0000000..c162322 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/asyncTask/package-info.java @@ -0,0 +1 @@ +package com.iqudoo.platform.application.domain.asyncTask; \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/domain/changeLog/ChangeLogAop.java b/src/main/java/com/iqudoo/platform/application/domain/changeLog/ChangeLogAop.java new file mode 100644 index 0000000..922a26c --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/changeLog/ChangeLogAop.java @@ -0,0 +1,64 @@ +package com.iqudoo.platform.application.domain.changeLog; + +import com.iqudoo.framework.tape.modules.utils.JsonUtil; +import lombok.extern.slf4j.Slf4j; +import org.aspectj.lang.ProceedingJoinPoint; +import org.aspectj.lang.annotation.Around; +import org.aspectj.lang.annotation.Aspect; +import org.aspectj.lang.annotation.Pointcut; +import org.springframework.stereotype.Component; + +@Aspect +@Component +@Slf4j +public class ChangeLogAop { + + /** + * 拦截所有 Repository 的写方法 + */ + @Pointcut("execution(* com.iqudoo.platform.application.domain.repository..*.update*(..)) || " + + "execution(* com.iqudoo.platform.application.domain.repository..*.insert*(..)) || " + + "execution(* com.iqudoo.platform.application.domain.repository..*.delete*(..)) || " + + "execution(* com.iqudoo.platform.application.domain.repository..*.trash*(..)) || " + + "execution(* com.iqudoo.platform.application.domain.repository..*.recover*(..)) || " + + "execution(* com.iqudoo.platform.application.domain.repository..*.batch*(..))") + public void repositoryWritePointcut() { + } + + @Around("repositoryWritePointcut()") + public Object aroundRepositoryWrite(ProceedingJoinPoint joinPoint) throws Throwable { + boolean needStart = !ChangeLogContext.isCollecting(); + if (needStart) { + ChangeLogContext.startCollect(); + } + try { + // 执行 Repository 方法 + return joinPoint.proceed(); + } finally { + // ============================== + // 最终方案:方法执行完立刻保存日志 + // 不管有没有事务!一定执行! + // ============================== + if (needStart) { + try { + // 取出变更 + var records = ChangeLogContext.getAndClear(); + if (!records.isEmpty()) { + // 取出操作人 + var operator = ChangeLogOperator.getOperator(); + // ========== 你的日志打印/保存 ========== +// log.error("变更日志:{}", JsonUtil.toJSONString(records)); +// log.error("操作人:{}", operator); + // 这里调用你的保存方法 + // changeLogSaveService.save(records, operator); + } + } catch (Exception e) { + log.error("记录变更日志失败", e); + } finally { + ChangeLogOperator.clear(); + } + } + } + } + +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/domain/changeLog/ChangeLogContext.java b/src/main/java/com/iqudoo/platform/application/domain/changeLog/ChangeLogContext.java new file mode 100644 index 0000000..2157903 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/changeLog/ChangeLogContext.java @@ -0,0 +1,49 @@ +package com.iqudoo.platform.application.domain.changeLog; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Map; + +public class ChangeLogContext { + + private static final ThreadLocal> RECORD_LOCAL = new ThreadLocal<>(); + + /** + * 开始收集变更 + */ + public static void startCollect() { + RECORD_LOCAL.set(new ArrayList<>()); + } + + /** + * 当前是否正在收集变更日志 + */ + @SuppressWarnings("BooleanMethodIsAlwaysInverted") + public static boolean isCollecting() { + return RECORD_LOCAL.get() != null; + } + + /** + * 添加一条变更 + */ + public static void addLog(String tableName, String eventType, Long dataGuid, Map fieldChanges) { + if (!ChangeLogContext.isCollecting()) { + return; + } + List list = RECORD_LOCAL.get(); + if (list != null) { + list.add(new ChangeLogRecord(tableName, eventType, dataGuid, fieldChanges)); + } + } + + /** + * 获取并清空(必须调用,防止线程复用污染) + */ + public static List getAndClear() { + List records = RECORD_LOCAL.get(); + RECORD_LOCAL.remove(); + return records == null ? Collections.emptyList() : records; + } + +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/domain/changeLog/ChangeLogOperator.java b/src/main/java/com/iqudoo/platform/application/domain/changeLog/ChangeLogOperator.java new file mode 100644 index 0000000..c534044 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/changeLog/ChangeLogOperator.java @@ -0,0 +1,56 @@ +package com.iqudoo.platform.application.domain.changeLog; + +import lombok.AllArgsConstructor; +import lombok.Data; + +public class ChangeLogOperator { + + private static final ThreadLocal OPERATOR_LOCAL = new ThreadLocal<>(); + + @Data + public static class Operator { + private String type; + private String action; + private String transId; + private String username; + private Long userId; + + public Operator(String type, String action, String transId, String username, Long userId) { + this.type = type; + this.action = action; + this.transId = transId; + this.username = username; + this.userId = userId; + } + } + + // ====================== 外部设置 ====================== + + public static void setUser(String action, String transId, String username, Long userId) { + OPERATOR_LOCAL.set(new Operator("USER", action, transId, username, userId)); + } + + public static void setSystem(String transId) { + OPERATOR_LOCAL.set(new Operator("SYSTEM", "", transId, "系统操作", 0L)); + } + + public static void setTask(String transId) { + OPERATOR_LOCAL.set(new Operator("TASK", "", transId, "定时任务", 0L)); + } + + public static void setAsync(String transId) { + OPERATOR_LOCAL.set(new Operator("ASYNC", "", transId, "异步任务", 0L)); + } + + // ====================== 获取 ====================== + + public static Operator getOperator() { + Operator operator = OPERATOR_LOCAL.get(); + return operator == null ? new Operator("UNKNOWN", "", "", "未知操作人", 0L) : operator; + } + + public static void clear() { + OPERATOR_LOCAL.remove(); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/changeLog/ChangeLogRecord.java b/src/main/java/com/iqudoo/platform/application/domain/changeLog/ChangeLogRecord.java new file mode 100644 index 0000000..a6dbd13 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/changeLog/ChangeLogRecord.java @@ -0,0 +1,43 @@ +package com.iqudoo.platform.application.domain.changeLog; + +import lombok.Data; + +import java.util.Map; + +@Data +public class ChangeLogRecord { + + /** + * 表名 + */ + private String tableName; + + /** + * 数据主键ID + */ + private Long dataGuid; + + /** + * 表名 + */ + private String eventType; + + /** + * 变更字段对比:key=字段名, value=[旧值, 新值] + */ + private Map fieldChanges; + + /** + * @param tableName 数据表 + * @param eventType 操作类型 + * @param dataGuid 数据编号 + * @param fieldChanges 变更内容 + */ + public ChangeLogRecord(String tableName, String eventType, Long dataGuid, Map fieldChanges) { + this.tableName = tableName; + this.eventType = eventType; + this.dataGuid = dataGuid; + this.fieldChanges = fieldChanges; + } + +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/domain/component/CommonCacheServiceImpl.java b/src/main/java/com/iqudoo/platform/application/domain/component/CommonCacheServiceImpl.java new file mode 100644 index 0000000..691b060 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/component/CommonCacheServiceImpl.java @@ -0,0 +1,109 @@ +package com.iqudoo.platform.application.domain.component; + +import com.iqudoo.framework.tape.modules.cache.CacheKey; +import com.iqudoo.framework.tape.service.ICacheService; +import com.iqudoo.platform.application.database.model.SystemGlobalCache; +import com.iqudoo.platform.application.database.model.SystemGlobalCacheExample; +import com.iqudoo.platform.application.facade.repository.ISystemGlobalCacheRepository; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Date; + +@Service +public class CommonCacheServiceImpl implements ICacheService { + + @Resource + private ISystemGlobalCacheRepository systemGlobalCacheRepository; + + @Override + public void setCache(CacheKey cacheKey, String value) throws Throwable { + String realKey = cacheKey.getCacheKey(); + if (hasCache(cacheKey)) { + SystemGlobalCacheExample systemGlobalCacheExample + = new SystemGlobalCacheExample(); + systemGlobalCacheExample.createCriteria() + .andCacheKeyEqualTo(realKey); + SystemGlobalCache systemGlobalCache = new SystemGlobalCache(); + systemGlobalCache.setCacheTime(new Date().getTime()); + systemGlobalCache.setExpireTime(new Date().getTime() + cacheKey.getExpireMillis()); + systemGlobalCache.setCacheData(value); + systemGlobalCacheRepository.updateByExampleSelective(systemGlobalCache, systemGlobalCacheExample); + } else { + SystemGlobalCache systemGlobalCache = new SystemGlobalCache(); + systemGlobalCache.setCacheKey(realKey); + systemGlobalCache.setCacheTime(new Date().getTime()); + systemGlobalCache.setExpireTime(new Date().getTime() + cacheKey.getExpireMillis()); + systemGlobalCache.setCacheData(value); + systemGlobalCacheRepository.insert(systemGlobalCache); + } + } + + @Override + public String getCache(CacheKey cacheKey) throws Throwable { + if (cacheKey == null) { + return null; + } + String realKey = cacheKey.getCacheKey(); + SystemGlobalCacheExample systemGlobalCacheExample + = new SystemGlobalCacheExample(); + systemGlobalCacheExample.createCriteria() + .andCacheKeyEqualTo(realKey); + SystemGlobalCache systemGlobalCache + = systemGlobalCacheRepository.findOne(systemGlobalCacheExample); + if (systemGlobalCache != null + && systemGlobalCache.getExpireTime() > new Date().getTime()) { + return systemGlobalCache.getCacheData(); + } + return null; + } + + @Override + public boolean hasCache(CacheKey cacheKey) throws Throwable { + if (cacheKey == null) { + return false; + } + String realKey = cacheKey.getCacheKey(); + SystemGlobalCacheExample systemGlobalCacheExample + = new SystemGlobalCacheExample(); + systemGlobalCacheExample.createCriteria() + .andCacheKeyEqualTo(realKey); + return systemGlobalCacheRepository.count(systemGlobalCacheExample) > 0; + } + + @Override + public void removeCache(CacheKey cacheKey) throws Throwable { + if (cacheKey == null) { + return; + } + String realKey = cacheKey.getCacheKey(); + SystemGlobalCacheExample systemGlobalCacheExample + = new SystemGlobalCacheExample(); + systemGlobalCacheExample.createCriteria() + .andCacheKeyEqualTo(realKey); + systemGlobalCacheRepository.deleteAll(systemGlobalCacheExample, true); + } + + @Override + public void removeCacheByPrefix(String prefix) throws Throwable { + if (prefix == null || prefix.isEmpty()) { + return; + } + if (prefix.contains("%")) { + return; + } + SystemGlobalCacheExample systemGlobalCacheExample + = new SystemGlobalCacheExample(); + systemGlobalCacheExample.createCriteria() + .andCacheKeyLike(prefix + "%"); + systemGlobalCacheRepository.deleteAll(systemGlobalCacheExample, true); + } + + @Override + public void clearCache() throws Throwable { + SystemGlobalCacheExample systemGlobalCacheExample + = new SystemGlobalCacheExample(); + systemGlobalCacheRepository.deleteAll(systemGlobalCacheExample, true); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/component/CommonCrawlerServiceImpl.java b/src/main/java/com/iqudoo/platform/application/domain/component/CommonCrawlerServiceImpl.java new file mode 100644 index 0000000..797f17b --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/component/CommonCrawlerServiceImpl.java @@ -0,0 +1,84 @@ +package com.iqudoo.platform.application.domain.component; + +import com.iqudoo.framework.tape.base.action.bean.ActionState; +import com.iqudoo.framework.tape.modules.crawler.CrawlerKey; +import com.iqudoo.framework.tape.service.ICrawlerService; +import com.iqudoo.platform.application.database.model.SystemCrawlerCacheData; +import com.iqudoo.platform.application.database.model.SystemCrawlerCacheDataExample; +import com.iqudoo.platform.application.facade.repository.ISystemCrawlerCacheDataRepository; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Date; + +@SuppressWarnings("DuplicatedCode") +@Service +public class CommonCrawlerServiceImpl implements ICrawlerService { + + @Resource + private ISystemCrawlerCacheDataRepository systemCrawlerCacheDataRepository; + + @Override + public void saveCrawler(CrawlerKey crawlerKey, String value) throws Throwable { + SystemCrawlerCacheDataExample systemCrawlerCacheDataExample + = new SystemCrawlerCacheDataExample(); + systemCrawlerCacheDataExample.createCriteria() + .andCrawlerTypeEqualTo(crawlerKey.getCrawlerType()) + .andCrawlerKeywordEqualTo(crawlerKey.getCrawlerKeyword()); + SystemCrawlerCacheData systemCrawlerCacheData = systemCrawlerCacheDataRepository + .findOne(systemCrawlerCacheDataExample); + if (systemCrawlerCacheData == null) { + systemCrawlerCacheData = new SystemCrawlerCacheData(); + systemCrawlerCacheData.setCrawlerTime(new Date().getTime()); + systemCrawlerCacheData.setCrawlerType(crawlerKey.getCrawlerType()); + systemCrawlerCacheData.setCrawlerKeyword(crawlerKey.getCrawlerKeyword()); + systemCrawlerCacheData.setCacheData(value); + systemCrawlerCacheDataRepository.insert(systemCrawlerCacheData); + } else { + systemCrawlerCacheData.setCrawlerTime(new Date().getTime()); + systemCrawlerCacheData.setCacheData(value); + int update = systemCrawlerCacheDataRepository.update(systemCrawlerCacheData); + if (update <= 0) { + throw ActionState.getRequestToFrequentError(); + } + } + + } + + @Override + public String getCrawler(CrawlerKey crawlerKey) throws Throwable { + SystemCrawlerCacheDataExample systemCrawlerCacheDataExample + = new SystemCrawlerCacheDataExample(); + SystemCrawlerCacheDataExample.Criteria criteria = systemCrawlerCacheDataExample.createCriteria() + .andCrawlerTypeEqualTo(crawlerKey.getCrawlerType()) + .andCrawlerKeywordEqualTo(crawlerKey.getCrawlerKeyword()); + if (crawlerKey.getExpireMillis() > 0) { + criteria.andCrawlerTimeGreaterThan(new Date().getTime() - crawlerKey.getExpireMillis()); + } + SystemCrawlerCacheData systemCrawlerCacheData = systemCrawlerCacheDataRepository + .findOne(systemCrawlerCacheDataExample); + if (systemCrawlerCacheData != null) { + return systemCrawlerCacheData.getCacheData(); + } + return null; + } + + @Override + public boolean hasCrawler(CrawlerKey crawlerKey) throws Throwable { + if (crawlerKey.isForceRequest()) { + return false; + } + SystemCrawlerCacheDataExample systemCrawlerCacheDataExample + = new SystemCrawlerCacheDataExample(); + SystemCrawlerCacheDataExample.Criteria criteria = systemCrawlerCacheDataExample.createCriteria() + .andCrawlerTypeEqualTo(crawlerKey.getCrawlerType()) + .andCrawlerKeywordEqualTo(crawlerKey.getCrawlerKeyword()); + if (crawlerKey.getExpireMillis() > 0) { + criteria.andCrawlerTimeGreaterThan(new Date().getTime() - crawlerKey.getExpireMillis()); + } + long cacheData = systemCrawlerCacheDataRepository + .count(systemCrawlerCacheDataExample); + return cacheData > 0; + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/component/CommonInterceptorService.java b/src/main/java/com/iqudoo/platform/application/domain/component/CommonInterceptorService.java new file mode 100644 index 0000000..5cc2a6b --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/component/CommonInterceptorService.java @@ -0,0 +1,38 @@ +package com.iqudoo.platform.application.domain.component; + +import com.iqudoo.framework.tape.base.action.bean.ActionParam; +import com.iqudoo.framework.tape.base.action.bean.ActionRequest; +import com.iqudoo.framework.tape.base.action.bean.ActionResponse; +import com.iqudoo.framework.tape.base.action.handler.ActionHandler; +import com.iqudoo.framework.tape.service.IInterceptorService; +import com.iqudoo.platform.application.domain.changeLog.ChangeLogOperator; +import org.springframework.stereotype.Service; + +@Service +public class CommonInterceptorService implements IInterceptorService { + + @Override + public void onInterceptBefore(ActionHandler actionHandler, ActionRequest actionRequest, ActionParam param) throws Throwable { + if (actionRequest != null && actionRequest.getAuthInfo() != null) { + String action = null; + String transId = null; + if (actionRequest.getActionParameter() != null) { + action = actionRequest.getActionParameter().getAction(); + transId = actionRequest.getActionParameter().getTransId(); + } + ChangeLogOperator.setUser(action, transId, + actionRequest.getAuthInfo().getUserGroup(), + actionRequest.getAuthInfo().getUserGuid()); + } + } + + @Override + public void onInterceptAfter(ActionHandler actionHandler, ActionRequest actionRequest, ActionParam param, ActionResponse response) throws Throwable { + + } + + @Override + public void onInterceptError(ActionHandler actionHandler, ActionRequest actionRequest, ActionParam param, Throwable throwable) throws Throwable { + + } +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/component/CommonLauncherServiceImpl.java b/src/main/java/com/iqudoo/platform/application/domain/component/CommonLauncherServiceImpl.java new file mode 100644 index 0000000..bc6c8eb --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/component/CommonLauncherServiceImpl.java @@ -0,0 +1,30 @@ +package com.iqudoo.platform.application.domain.component; + +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.service.ILauncherService; +import com.iqudoo.platform.application.properties.AppProperties; +import org.slf4j.Logger; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.util.TimeZone; + +@Component +public class CommonLauncherServiceImpl implements ILauncherService { + + private static final Logger LOGGER = Tape.getLogger(CommonLauncherServiceImpl.class); + + @Resource + private AppProperties appProperties; + + @Override + public void onLaunch(String[] args) throws Throwable { + TimeZone.setDefault(TimeZone.getTimeZone(appProperties.getTimeZone())); + LOGGER.info("==============================="); + LOGGER.info("mapper scan: {}", appProperties.getMybatisMapperScan()); + LOGGER.info("current timeZone: {}/{}", TimeZone.getDefault().getID(), + TimeZone.getDefault().getDisplayName()); + LOGGER.info("Launcher started"); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/component/CommonSessionServiceImpl.java b/src/main/java/com/iqudoo/platform/application/domain/component/CommonSessionServiceImpl.java new file mode 100644 index 0000000..82ab509 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/component/CommonSessionServiceImpl.java @@ -0,0 +1,80 @@ +package com.iqudoo.platform.application.domain.component; + +import com.iqudoo.framework.tape.base.action.bean.ActionState; +import com.iqudoo.framework.tape.modules.session.GetSessionParam; +import com.iqudoo.framework.tape.modules.session.RefreshSessionParam; +import com.iqudoo.framework.tape.modules.utils.RandomUtil; +import com.iqudoo.framework.tape.service.ISessionService; +import com.iqudoo.platform.application.database.model.SystemGlobalSession; +import com.iqudoo.platform.application.database.model.SystemGlobalSessionExample; +import com.iqudoo.platform.application.facade.repository.ISystemGlobalSessionRepository; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; + +@SuppressWarnings("DuplicatedCode") +@Service +public class CommonSessionServiceImpl implements ISessionService { + + @Resource + private ISystemGlobalSessionRepository systemGlobalSessionRepository; + + @Override + public String getSession(GetSessionParam param) throws Throwable { + SystemGlobalSessionExample sessionExample = new SystemGlobalSessionExample(); + sessionExample.createCriteria() + .andUserGuidEqualTo(param.getUserGuid()) + .andUserGroupEqualTo(param.getUserGroup()) + .andOriginPlatformEqualTo(param.getOriginPlatform()); + List systemGlobalSessionList + = systemGlobalSessionRepository.getList(sessionExample); + SystemGlobalSession systemGlobalSession = null; + if (systemGlobalSessionList != null && !systemGlobalSessionList.isEmpty()) { + systemGlobalSession = systemGlobalSessionList.get(0); + } + if (systemGlobalSession == null) { + throw new ActionState("找不到登录信息"); + } + return systemGlobalSession.getSessionKey(); + } + + @Override + public String refreshSession(RefreshSessionParam param) throws Throwable { + SystemGlobalSessionExample sessionExample = new SystemGlobalSessionExample(); + sessionExample.createCriteria() + .andUserGuidEqualTo(param.getUserGuid()) + .andUserGroupEqualTo(param.getUserGroup()) + .andOriginPlatformEqualTo(param.getOriginPlatform()); + SystemGlobalSession systemGlobalSession = systemGlobalSessionRepository + .findOne(sessionExample); + if (param.getOriginDomain() == null) { + param.setOriginDomain(""); + } + if (param.getOriginIp() == null) { + param.setOriginIp(""); + } + if (systemGlobalSession == null) { + SystemGlobalSession newDo = new SystemGlobalSession(); + newDo.setUserGuid(param.getUserGuid()); + newDo.setUserGroup(param.getUserGroup()); + newDo.setSessionKey(RandomUtil.getRandomString(12)); + newDo.setOriginPlatform(param.getOriginPlatform()); + newDo.setOriginDomain(param.getOriginDomain()); + newDo.setOriginIp(param.getOriginIp()); + systemGlobalSession = systemGlobalSessionRepository.insert(newDo); + } else { + if (param.isRefresh()) { + systemGlobalSession.setSessionKey(RandomUtil.getRandomString(12)); + } + systemGlobalSession.setOriginDomain(param.getOriginDomain()); + systemGlobalSession.setOriginIp(param.getOriginIp()); + int update = systemGlobalSessionRepository.update(systemGlobalSession); + if (update <= 0) { + throw ActionState.getRequestToFrequentError(); + } + } + return systemGlobalSession.getSessionKey(); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/component/CommonSettingServiceImpl.java b/src/main/java/com/iqudoo/platform/application/domain/component/CommonSettingServiceImpl.java new file mode 100644 index 0000000..74b90b8 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/component/CommonSettingServiceImpl.java @@ -0,0 +1,35 @@ +package com.iqudoo.platform.application.domain.component; + +import com.iqudoo.framework.tape.service.ISettingService; +import com.iqudoo.platform.application.constants.BizConstants; +import com.iqudoo.platform.application.database.model.SystemGlobalSetting; +import com.iqudoo.platform.application.database.model.SystemGlobalSettingExample; +import com.iqudoo.platform.application.facade.repository.ISystemGlobalSettingRepository; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Objects; + +@Service +public class CommonSettingServiceImpl implements ISettingService { + + @Resource + private ISystemGlobalSettingRepository systemGlobalSettingRepository; + + @Override + public String getSettingValue(String key, String group, String... bizArgs) throws Throwable { + if (Objects.equals(group, BizConstants.SETTING_GROUP_SYSTEM)) { + SystemGlobalSettingExample systemGlobalSettingExample = new SystemGlobalSettingExample(); + systemGlobalSettingExample.createCriteria() + .andSettingKeyEqualTo(key); + SystemGlobalSetting systemGlobalSetting = systemGlobalSettingRepository + .findOne(systemGlobalSettingExample); + if (systemGlobalSetting != null) { + return systemGlobalSetting.getSettingValue(); + } + } + return null; + } + + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/component/CommonTokenServiceImpl.java b/src/main/java/com/iqudoo/platform/application/domain/component/CommonTokenServiceImpl.java new file mode 100644 index 0000000..c4b1464 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/component/CommonTokenServiceImpl.java @@ -0,0 +1,117 @@ +package com.iqudoo.platform.application.domain.component; + +import com.auth0.jwt.JWT; +import com.auth0.jwt.algorithms.Algorithm; +import com.auth0.jwt.interfaces.DecodedJWT; +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.base.action.bean.ActionAuthInfo; +import com.iqudoo.framework.tape.base.action.bean.ActionParam; +import com.iqudoo.framework.tape.base.action.bean.ActionState; +import com.iqudoo.framework.tape.base.action.bean.ActionTokenInfo; +import com.iqudoo.framework.tape.base.action.handler.ActionHandler; +import com.iqudoo.framework.tape.modules.IModuleFactory; +import com.iqudoo.framework.tape.modules.utils.ArrayUtil; +import com.iqudoo.framework.tape.modules.utils.JsonUtil; +import com.iqudoo.framework.tape.service.ITokenService; +import com.iqudoo.platform.application.constants.ErrorConstants; +import com.iqudoo.platform.application.facade.base.BaseParam; +import com.iqudoo.platform.application.facade.provider.IPermissionProvider; +import org.springframework.stereotype.Service; + +import java.util.Date; +import java.util.List; +import java.util.Objects; + +@SuppressWarnings("DuplicatedCode") +@Service +public class CommonTokenServiceImpl implements ITokenService { + + private static final String ACCESS_TOKEN_TYPE = "access_token"; + private static final String REFRESH_TOKEN_TYPE = "refresh_token"; + private static final String PLATFORM_COMMON = "common"; + + @Override + public void checkUserPermission(ActionAuthInfo actionAuthInfo, ActionParam param) throws Throwable { + ActionHandler actionHandler = param.getActionHandler(); + if (!ArrayUtil.in(actionHandler.getGroups(), actionAuthInfo.getUserGroup())) { + throw ErrorConstants.NO_PERMISSION; + } + if (param instanceof BaseParam baseParam) { + baseParam.setTag(actionHandler.getTag()); + } + String requestPlatform = param.getRequestPlatform(); + String tokenPlatform = param.getSessionPlatform(); + if (tokenPlatform == null || !tokenPlatform.equals(PLATFORM_COMMON)) { + // platform is common ignore match + if (requestPlatform != null + && tokenPlatform != null + && !Objects.equals(requestPlatform, tokenPlatform)) { + throw ErrorConstants.UN_AUTHORIZED_PLATFORM_NON_MATCH; + } + } + Tape.getService(IModuleFactory.class) + .get(IPermissionProvider.class, actionAuthInfo.getUserGroup()) + .checkPermission(actionAuthInfo, param); + } + + @Override + public ActionTokenInfo createToken(ActionAuthInfo actionAuthInfo) throws Throwable { + ActionTokenInfo actionTokenInfo = new ActionTokenInfo(); + long tokenExpires = 60 * 60 * 1000L; + long refreshTokenExpires = 3 * 24 * 60 * 60 * 1000L; + String token = JWT.create() + .withAudience(ACCESS_TOKEN_TYPE, JsonUtil.toJSONString(actionAuthInfo)) + .withExpiresAt(new Date(new Date().getTime() + tokenExpires)) + .sign(Algorithm.HMAC256(actionAuthInfo.getSessionKey())); + String refreshToken = JWT.create() + .withAudience(REFRESH_TOKEN_TYPE, JsonUtil.toJSONString(actionAuthInfo)) + .withExpiresAt(new Date(new Date().getTime() + refreshTokenExpires)) + .sign(Algorithm.HMAC256(actionAuthInfo.getSessionKey())); + actionTokenInfo.setToken(token); + actionTokenInfo.setRefreshToken(refreshToken); + actionTokenInfo.setExpiresIn(tokenExpires); + actionTokenInfo.setRefreshExpiresIn(refreshTokenExpires); + return actionTokenInfo; + } + + @Override + public ActionTokenInfo refreshToken(String refreshToken) throws Throwable { + DecodedJWT decodedJWT = JWT.decode(refreshToken); + List audiences = decodedJWT.getAudience(); + String tokenType = audiences.get(0); + if (!Objects.equals(tokenType, REFRESH_TOKEN_TYPE)) { + throw ActionState.UN_AUTHORIZED; + } + ActionAuthInfo actionAuthInfo = JsonUtil.toBeanObject(audiences.get(1), ActionAuthInfo.class); + Tape.getService(IModuleFactory.class) + .get(IPermissionProvider.class, actionAuthInfo.getUserGroup()) + .checkSessionKey(actionAuthInfo); + return createToken(actionAuthInfo); + } + + @Override + public ActionAuthInfo parseToken(String token) throws Throwable { + try { + DecodedJWT decodedJWT = JWT.decode(token); + List audiences = decodedJWT.getAudience(); + String tokenType = audiences.get(0); + if (!Objects.equals(tokenType, ACCESS_TOKEN_TYPE)) { + throw ActionState.UN_AUTHORIZED; + } + ActionAuthInfo actionAuthInfo = JsonUtil.toBeanObject(audiences.get(1), ActionAuthInfo.class); + if (actionAuthInfo == null) { + throw ActionState.UN_AUTHORIZED; + } + JWT.require(Algorithm.HMAC256(actionAuthInfo.getSessionKey())).build().verify(token); + return actionAuthInfo; + } catch (Throwable throwable) { + throw ActionState.UN_AUTHORIZED; + } + } + + @Override + public Throwable getAuthError() { + return ErrorConstants.UN_AUTHORIZED; + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/provider/FileUploadAliossProviderImpl.java b/src/main/java/com/iqudoo/platform/application/domain/provider/FileUploadAliossProviderImpl.java new file mode 100644 index 0000000..6114035 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/provider/FileUploadAliossProviderImpl.java @@ -0,0 +1,33 @@ +package com.iqudoo.platform.application.domain.provider; + +import com.aliyun.oss.model.CannedAccessControlList; +import com.iqudoo.framework.tape.modules.annotation.FactoryMapping; +import com.iqudoo.framework.tape.modules.utils.DateTimeUtil; +import com.iqudoo.platform.application.facade.provider.IFileUploadProvider; +import com.iqudoo.platform.application.fileMgr.OssFileUtil; +import com.iqudoo.platform.application.setting.SystemGlobalFileUploadConfig; + +import java.util.Date; + +@SuppressWarnings({"DuplicatedCode", "SpellCheckingInspection"}) +@FactoryMapping(name = "ali-oss", description = "阿里云OSS文件上传") +public class FileUploadAliossProviderImpl implements IFileUploadProvider { + + @Override + public String upload(SystemGlobalFileUploadConfig config, byte[] fileBytes, String filePath) throws Throwable { + OssFileUtil.Config aliOssConfig = new OssFileUtil.Config(); + aliOssConfig.setDomainName(config.getAliOssDomainName()); + aliOssConfig.setAccessKeyId(config.getAliOssAccessKeyId()); + aliOssConfig.setAccessKeySecret(config.getAliOssAccessKeySecret()); + aliOssConfig.setEndpoint(config.getAliOssEndpoint()); + aliOssConfig.setBucketName(config.getAliOssBucketName()); + aliOssConfig.setProtocolType(config.getAliOssProtocolType()); + aliOssConfig.setObjectAcl(CannedAccessControlList.PublicRead); + String curDate = DateTimeUtil.formatDate(new Date(), "yyyy-MM-dd"); + String targetPath = config.getAliOssBaseFolder() + "/" + filePath; + targetPath = targetPath.replaceAll("\\{\\{date}}", curDate) + .replaceAll("//", "/"); + return OssFileUtil.uploadFile(fileBytes, targetPath, aliOssConfig); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/provider/FileUploadLocalProviderImpl.java b/src/main/java/com/iqudoo/platform/application/domain/provider/FileUploadLocalProviderImpl.java new file mode 100644 index 0000000..8e5657d --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/provider/FileUploadLocalProviderImpl.java @@ -0,0 +1,34 @@ +package com.iqudoo.platform.application.domain.provider; + +import com.iqudoo.framework.tape.modules.annotation.FactoryMapping; +import com.iqudoo.framework.tape.modules.utils.DateTimeUtil; +import com.iqudoo.platform.application.controller.StaticFileController; +import com.iqudoo.platform.application.facade.provider.IFileUploadProvider; +import com.iqudoo.platform.application.fileMgr.LocalFileUtil; +import com.iqudoo.platform.application.setting.SystemGlobalFileUploadConfig; + +import javax.annotation.Resource; +import java.util.Date; + +@SuppressWarnings({"DuplicatedCode"}) +@FactoryMapping(name = "local", description = "本地文件上传") +public class FileUploadLocalProviderImpl implements IFileUploadProvider { + + @Resource + private StaticFileController staticFileController; + + @Override + public String upload(SystemGlobalFileUploadConfig config, byte[] fileBytes, String filePath) throws Throwable { + LocalFileUtil.Config aliOssConfig = new LocalFileUtil.Config(); + aliOssConfig.setDomainName(config.getLocalDomainName()); + aliOssConfig.setProtocolType(config.getLocalProtocolType()); + aliOssConfig.setBucketName(staticFileController.getUploadRoute()); + aliOssConfig.setSavePath(staticFileController.getUploadPath()); + String curDate = DateTimeUtil.formatDate(new Date(), "yyyy-MM-dd"); + String targetPath = config.getLocalBaseFolder() + "/" + filePath; + targetPath = targetPath.replaceAll("\\{\\{date}}", curDate) + .replaceAll("//", "/"); + return LocalFileUtil.uploadFile(fileBytes, targetPath, aliOssConfig); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/provider/PermissionSystemAdminProviderImpl.java b/src/main/java/com/iqudoo/platform/application/domain/provider/PermissionSystemAdminProviderImpl.java new file mode 100644 index 0000000..195e684 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/provider/PermissionSystemAdminProviderImpl.java @@ -0,0 +1,68 @@ +package com.iqudoo.platform.application.domain.provider; + +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.base.action.bean.ActionAuthInfo; +import com.iqudoo.framework.tape.base.action.bean.ActionParam; +import com.iqudoo.framework.tape.modules.IModuleSession; +import com.iqudoo.framework.tape.modules.annotation.FactoryMapping; +import com.iqudoo.framework.tape.modules.session.GetSessionParam; +import com.iqudoo.framework.tape.modules.utils.ArrayUtil; +import com.iqudoo.platform.application.constants.BizConstants; +import com.iqudoo.platform.application.constants.ErrorConstants; +import com.iqudoo.platform.application.database.model.SystemAdminInfo; +import com.iqudoo.platform.application.facade.base.BaseParam; +import com.iqudoo.platform.application.facade.enums.SystemAdminInfoOptStatusEnum; +import com.iqudoo.platform.application.facade.enums.SystemAdminInfoOptSuperEnum; +import com.iqudoo.platform.application.facade.provider.IPermissionProvider; +import com.iqudoo.platform.application.facade.repository.ISystemAdminInfoRepository; + +import javax.annotation.Resource; + +@FactoryMapping(name = BizConstants.AUTH_GROUP_SYS_ADMIN, description = "系统管理员") +public class PermissionSystemAdminProviderImpl implements IPermissionProvider { + + @Resource + private ISystemAdminInfoRepository systemAdminInfoRepository; + + @Override + public void checkPermission(ActionAuthInfo actionAuthInfo, ActionParam actionParam) throws Throwable { + // 系统权限验证 + SystemAdminInfo systemAdminInfo = systemAdminInfoRepository.findValidById(actionAuthInfo.getUserGuid()); + if (systemAdminInfo == null) { + throw ErrorConstants.AUTH_USER_NOT_EXIST; + } + if (systemAdminInfo.getOptStatus() != SystemAdminInfoOptStatusEnum.ENABLE.getValue()) { + throw ErrorConstants.AUTH_USER_NOT_ENABLE; + } + boolean isSuper = systemAdminInfo.getOptSuper() != null + && systemAdminInfo.getOptSuper() == SystemAdminInfoOptSuperEnum.SUPER.getValue(); + if (!isSuper && ArrayUtil.in(actionParam.getActionHandler().getTag(), + BizConstants.AUTH_TAG_SYS_ADMIN_SUPER)) { + throw ErrorConstants.NO_PERMISSION; + } + if (actionParam instanceof BaseParam baseParam) { + baseParam.setCurrentSystemAdminInfo(systemAdminInfo); + } + } + + @Override + public void checkSessionKey(ActionAuthInfo actionAuthInfo) throws Throwable { + SystemAdminInfo aDo = systemAdminInfoRepository.findValidById(actionAuthInfo.getUserGuid()); + if (aDo == null) { + throw ErrorConstants.AUTH_USER_NOT_EXIST; + } + if (aDo.getOptStatus() != SystemAdminInfoOptStatusEnum.ENABLE.getValue()) { + throw ErrorConstants.AUTH_USER_NOT_ENABLE; + } + GetSessionParam getSessionParam = new GetSessionParam(); + getSessionParam.setUserGuid(actionAuthInfo.getUserGuid()); + getSessionParam.setUserGroup(actionAuthInfo.getUserGroup()); + getSessionParam.setOriginPlatform(actionAuthInfo.getOriginPlatform()); + String curSessionKey = Tape.getService(IModuleSession.class) + .getSession(getSessionParam) + aDo.getPwdSlot(); + if (!curSessionKey.equals(actionAuthInfo.getSessionKey())) { + throw ErrorConstants.UN_AUTHORIZED; + } + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/repository/SystemAdminInfoRepositoryImpl.java b/src/main/java/com/iqudoo/platform/application/domain/repository/SystemAdminInfoRepositoryImpl.java new file mode 100644 index 0000000..812c02c --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/repository/SystemAdminInfoRepositoryImpl.java @@ -0,0 +1,638 @@ +package com.iqudoo.platform.application.domain.repository; + +import com.iqudoo.framework.tape.modules.utils.SnowflakeUtil; +import com.iqudoo.platform.application.database.mapper.SystemAdminInfoMapper; +import com.iqudoo.platform.application.database.model.SystemAdminInfo; +import com.iqudoo.platform.application.database.model.SystemAdminInfoExample; +import com.iqudoo.platform.application.domain.changeLog.ChangeLogContext; +import com.iqudoo.platform.application.facade.repository.ISystemAdminInfoRepository; +import java.util.*; +import javax.annotation.Resource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Repository; + +@SuppressWarnings("DuplicatedCode") +@Repository +public class SystemAdminInfoRepositoryImpl implements ISystemAdminInfoRepository { + private static final Logger LOGGER = LoggerFactory.getLogger(SystemAdminInfoRepositoryImpl.class); + + @Resource + private SystemAdminInfoMapper systemAdminInfoMapper; + + @Override + public SystemAdminInfo findAnyById(long guid) throws Throwable { + SystemAdminInfo aDo = null; + SystemAdminInfoExample example + = new SystemAdminInfoExample(); + example.createCriteria() + .andIsDeleteEqualTo(0) + .andGuidEqualTo(guid); + List recordList + = systemAdminInfoMapper.selectByExample(example); + if (recordList != null && !recordList.isEmpty()) { + aDo = recordList.get(0); + } + return aDo; + } + + @Override + public SystemAdminInfo findValidById(long guid) throws Throwable { + SystemAdminInfo aDo = null; + SystemAdminInfoExample example + = new SystemAdminInfoExample(); + example.createCriteria() + .andIsHiddenEqualTo(0) + .andIsDeleteEqualTo(0) + .andGuidEqualTo(guid); + List recordList + = systemAdminInfoMapper.selectByExample(example); + if (recordList != null && !recordList.isEmpty()) { + aDo = recordList.get(0); + } + return aDo; + } + + @Override + public SystemAdminInfo findTrashById(long guid) throws Throwable { + SystemAdminInfo aDo = null; + SystemAdminInfoExample example + = new SystemAdminInfoExample(); + example.createCriteria() + .andIsHiddenEqualTo(1) + .andIsDeleteEqualTo(0) + .andGuidEqualTo(guid); + List recordList + = systemAdminInfoMapper.selectByExample(example); + if (recordList != null && !recordList.isEmpty()) { + aDo = recordList.get(0); + } + return aDo; + } + + @Override + public SystemAdminInfo insert(SystemAdminInfo record) throws Throwable { + SystemAdminInfo aDo = new SystemAdminInfo(); + if (record.getGuid() != null) { + aDo.setGuid(record.getGuid()); + } else { + Long guid = SnowflakeUtil.nextId(); + aDo.setGuid(guid); + } + aDo.setUsername(record.getUsername()); + aDo.setNickname(record.getNickname()); + aDo.setPwdMd5(record.getPwdMd5()); + aDo.setPwdSlot(record.getPwdSlot()); + aDo.setOptRemark(record.getOptRemark()); + aDo.setOptStatus(record.getOptStatus()); + aDo.setOptSuper(record.getOptSuper()); + aDo.setIsDelete(0); + aDo.setIsHidden(0); + aDo.setDeleteToken("VALID"); + aDo.setDataVersion(1); + aDo.setCreateTime(new Date()); + aDo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int count = systemAdminInfoMapper.insert(aDo); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] insert SystemAdminInfo long time" + + "\n\t|-> table name: t_system_admin_info" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (count > 0) { + ChangeLogContext.addLog("t_system_admin_info", + "insert", aDo.getGuid(), new HashMap<>()); + return aDo; + } + throw new Throwable("Insert failed, SystemAdminInfo: " + aDo); + } + + @Override + public List batchInsert(List records) throws Throwable { + if (records == null || records.isEmpty()) { + return new ArrayList<>(); + } + List batch = new ArrayList<>(); + for (SystemAdminInfo record : records) { + SystemAdminInfo aDo = new SystemAdminInfo(); + if (record.getGuid() != null) { + aDo.setGuid(record.getGuid()); + } else { + Long guid = SnowflakeUtil.nextId(); + aDo.setGuid(guid); + } + aDo.setUsername(record.getUsername()); + aDo.setNickname(record.getNickname()); + aDo.setPwdMd5(record.getPwdMd5()); + aDo.setPwdSlot(record.getPwdSlot()); + aDo.setOptRemark(record.getOptRemark()); + aDo.setOptStatus(record.getOptStatus()); + aDo.setOptSuper(record.getOptSuper()); + aDo.setIsDelete(0); + aDo.setIsHidden(0); + aDo.setDeleteToken("VALID"); + aDo.setDataVersion(1); + aDo.setCreateTime(new Date()); + aDo.setUpdateTime(new Date()); + batch.add(aDo); + } + long startTime = new Date().getTime(); + int count = systemAdminInfoMapper.batchInsert(batch); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] batch insert SystemAdminInfo long time" + + "\n\t|-> table name: t_system_admin_info" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (count == batch.size()) { + for (SystemAdminInfo aDo : batch) { + ChangeLogContext.addLog("t_system_admin_info", + "batchInsert", aDo.getGuid(), new HashMap<>()); + } + return batch; + } + throw new Throwable("Batch insert failed, SystemAdminInfo affected: " + count + ", expected: " + batch.size()); + } + + @Override + public int update(SystemAdminInfo record) throws Throwable { + SystemAdminInfo aDo + = systemAdminInfoMapper.selectByPrimaryKey(record.getGuid()); + if (aDo == null || aDo.getIsDelete() == 1) { + throw new Throwable("Record not found, SystemAdminInfo GUID:" + record.getGuid()); + } + Map changeDiff = new HashMap<>(); + if (record.getUsername() != null) { + if (!Objects.equals(record.getUsername(), aDo.getUsername())) { + changeDiff.put("username", new Object[]{aDo.getUsername(), record.getUsername()}); + } + aDo.setUsername(record.getUsername()); + } + if (record.getNickname() != null) { + if (!Objects.equals(record.getNickname(), aDo.getNickname())) { + changeDiff.put("nickname", new Object[]{aDo.getNickname(), record.getNickname()}); + } + aDo.setNickname(record.getNickname()); + } + if (record.getPwdMd5() != null) { + if (!Objects.equals(record.getPwdMd5(), aDo.getPwdMd5())) { + changeDiff.put("pwdMd5", new Object[]{aDo.getPwdMd5(), record.getPwdMd5()}); + } + aDo.setPwdMd5(record.getPwdMd5()); + } + if (record.getPwdSlot() != null) { + if (!Objects.equals(record.getPwdSlot(), aDo.getPwdSlot())) { + changeDiff.put("pwdSlot", new Object[]{aDo.getPwdSlot(), record.getPwdSlot()}); + } + aDo.setPwdSlot(record.getPwdSlot()); + } + if (record.getOptRemark() != null) { + if (!Objects.equals(record.getOptRemark(), aDo.getOptRemark())) { + changeDiff.put("optRemark", new Object[]{aDo.getOptRemark(), record.getOptRemark()}); + } + aDo.setOptRemark(record.getOptRemark()); + } + if (record.getOptStatus() != null) { + if (!Objects.equals(record.getOptStatus(), aDo.getOptStatus())) { + changeDiff.put("optStatus", new Object[]{aDo.getOptStatus(), record.getOptStatus()}); + } + aDo.setOptStatus(record.getOptStatus()); + } + if (record.getOptSuper() != null) { + if (!Objects.equals(record.getOptSuper(), aDo.getOptSuper())) { + changeDiff.put("optSuper", new Object[]{aDo.getOptSuper(), record.getOptSuper()}); + } + aDo.setOptSuper(record.getOptSuper()); + } + SystemAdminInfoExample updateWhere = new SystemAdminInfoExample(); + Integer lockDataVersion = record.getDataVersion(); + if (lockDataVersion == null) { + lockDataVersion = aDo.getDataVersion(); + } + updateWhere.createCriteria() + .andGuidEqualTo(aDo.getGuid()) + .andDataVersionEqualTo(lockDataVersion); + aDo.setDataVersion(aDo.getDataVersion() + 1); + aDo.setUpdateTime(new Date()); + // update data version + record.setDataVersion(aDo.getDataVersion()); + record.setUpdateTime(aDo.getUpdateTime()); + long startTime = new Date().getTime(); + int update = systemAdminInfoMapper.updateByExample(aDo, updateWhere); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] update SystemAdminInfo long time" + + "\n\t|-> table name: t_system_admin_info" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0 && !changeDiff.isEmpty()) { + ChangeLogContext.addLog("t_system_admin_info", + "update", aDo.getGuid(), changeDiff); + } + return update; + } + + @Override + public int updateByExampleSelective(SystemAdminInfo record, SystemAdminInfoExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemAdminInfoExample.Criteria criteria : example.getOredCriteria()) { + criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(0); + } + List guidList = systemAdminInfoMapper + .selectPrimaryKeyByExample(example); + if (guidList.isEmpty()) { + return 0; + } + example = new SystemAdminInfoExample(); + example.createCriteria().andGuidIn(guidList); + List recordList + = systemAdminInfoMapper.selectByExample(example); + Map> diffGroup = new HashMap<>(); + for (SystemAdminInfo aDo : recordList) { + Map changeDiff = new HashMap<>(); + if (record.getUsername() != null && !Objects.equals(record.getUsername(), aDo.getUsername())) { + changeDiff.put("username", new Object[]{aDo.getUsername(), record.getUsername()}); + } + if (record.getNickname() != null && !Objects.equals(record.getNickname(), aDo.getNickname())) { + changeDiff.put("nickname", new Object[]{aDo.getNickname(), record.getNickname()}); + } + if (record.getPwdMd5() != null && !Objects.equals(record.getPwdMd5(), aDo.getPwdMd5())) { + changeDiff.put("pwdMd5", new Object[]{aDo.getPwdMd5(), record.getPwdMd5()}); + } + if (record.getPwdSlot() != null && !Objects.equals(record.getPwdSlot(), aDo.getPwdSlot())) { + changeDiff.put("pwdSlot", new Object[]{aDo.getPwdSlot(), record.getPwdSlot()}); + } + if (record.getOptRemark() != null && !Objects.equals(record.getOptRemark(), aDo.getOptRemark())) { + changeDiff.put("optRemark", new Object[]{aDo.getOptRemark(), record.getOptRemark()}); + } + if (record.getOptStatus() != null && !Objects.equals(record.getOptStatus(), aDo.getOptStatus())) { + changeDiff.put("optStatus", new Object[]{aDo.getOptStatus(), record.getOptStatus()}); + } + if (record.getOptSuper() != null && !Objects.equals(record.getOptSuper(), aDo.getOptSuper())) { + changeDiff.put("optSuper", new Object[]{aDo.getOptSuper(), record.getOptSuper()}); + } + diffGroup.put(aDo.getGuid(), changeDiff); + } + // reset data version, with optimistic locking + record.setDataVersion((int) (new Date().getTime() % 1000)); + // It is not supported to directly modify the following columns + record.setUpdateTime(new Date()); + record.setIsHidden(null); + record.setIsDelete(null); + record.setDeleteToken(null); + record.setCreateTime(null); + record.setGuid(null); + long startTime = new Date().getTime(); + int update = systemAdminInfoMapper.updateByExampleSelective(record, example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + String exampleString = ""; + if (example.getWhereString() != null) { + exampleString += "\n\t|-> where: " + example.getWhereString(); + } + LOGGER.error("[SQL] updateByExampleSelective SystemAdminInfo long time" + + "\n\t|-> table name: t_system_admin_info" + + "\n\t|-> use time: " + useTime + "ms" + + exampleString + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + for (Map.Entry> diffEntry : diffGroup.entrySet()) { + if (diffEntry.getValue() != null && !diffEntry.getValue().isEmpty()) { + ChangeLogContext.addLog("t_system_admin_info", + "updateByExampleSelective", diffEntry.getKey(), diffEntry.getValue()); + } + } + } + return update; + } + + @Override + public int deleteById(long id, boolean release) throws Throwable { + SystemAdminInfo aDo = findAnyById(id); + if (aDo == null) { + return 0; + } + if (release) { + return systemAdminInfoMapper.deleteByPrimaryKey(aDo.getGuid()); + } + SystemAdminInfoExample updateWhere + = new SystemAdminInfoExample(); + Integer lockDataVersion = aDo.getDataVersion(); + updateWhere.createCriteria() + .andGuidEqualTo(aDo.getGuid()) + .andDataVersionEqualTo(lockDataVersion); + aDo.setDataVersion(aDo.getDataVersion() + 1); + aDo.setIsDelete(1); + aDo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemAdminInfoMapper.updateByExampleSelective(aDo, updateWhere); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] deleteById SystemAdminInfo long time" + + "\n\t|-> table name: t_system_admin_info" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + ChangeLogContext.addLog("t_system_admin_info", + "deleteById", aDo.getGuid(), new HashMap<>()); + } + return update; + } + + @Override + public int deleteAll(SystemAdminInfoExample example, boolean release) throws Throwable { + if (release) { + return systemAdminInfoMapper.deleteByExample(example); + } + // clone new example + example = example.cloneExample(); + for (SystemAdminInfoExample.Criteria criteria : example.getOredCriteria()) { + criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(1); + } + List guidList = systemAdminInfoMapper.selectPrimaryKeyByExample(example); + if (guidList.isEmpty()) { + return 0; + } + example = new SystemAdminInfoExample(); + example.createCriteria().andGuidIn(guidList); + SystemAdminInfo systemAdminInfo = new SystemAdminInfo(); + // reset data version, with optimistic locking + systemAdminInfo.setDataVersion((int) (new Date().getTime() % 1000)); + systemAdminInfo.setIsDelete(1); + systemAdminInfo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemAdminInfoMapper.updateByExampleSelective(systemAdminInfo, example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] deleteAll SystemAdminInfo long time" + + "\n\t|-> table name: t_system_admin_info" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + for (Long guid : guidList) { + ChangeLogContext.addLog("t_system_admin_info", + "deleteAll", guid, new HashMap<>()); + } + } + return update; + } + + @Override + public int trashById(long id) throws Throwable { + SystemAdminInfo aDo = findAnyById(id); + if (aDo == null) { + return 0; + } + if (aDo.getIsHidden() == 1) { + return 0; + } + SystemAdminInfoExample updateWhere + = new SystemAdminInfoExample(); + Integer lockDataVersion = aDo.getDataVersion(); + updateWhere.createCriteria() + .andGuidEqualTo(aDo.getGuid()) + .andDataVersionEqualTo(lockDataVersion); + aDo.setDataVersion(aDo.getDataVersion() + 1); + aDo.setIsHidden(1); + aDo.setDeleteToken(aDo.getGuid() + ""); + aDo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemAdminInfoMapper.updateByExampleSelective(aDo, updateWhere); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] trashById SystemAdminInfo long time" + + "\n\t|-> table name: t_system_admin_info" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + ChangeLogContext.addLog("t_system_admin_info", + "trashById", aDo.getGuid(), new HashMap<>()); + } + return update; + } + + @Override + public int trashAll(SystemAdminInfoExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemAdminInfoExample.Criteria criteria : example.getOredCriteria()) { + criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(0); + } + List guidList = systemAdminInfoMapper.selectPrimaryKeyByExample(example); + if (guidList.isEmpty()) { + return 0; + } + example = new SystemAdminInfoExample(); + example.createCriteria().andGuidIn(guidList); + SystemAdminInfo systemAdminInfo = new SystemAdminInfo(); + // reset data version, with optimistic locking + systemAdminInfo.setDataVersion((int) (new Date().getTime() % 1000)); + systemAdminInfo.setIsHidden(1); + systemAdminInfo.setDeleteToken(SnowflakeUtil.nextId() + ""); + systemAdminInfo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemAdminInfoMapper.updateByExampleSelective(systemAdminInfo, example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] trashAll SystemAdminInfo long time" + + "\n\t|-> table name: t_system_admin_info" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + for (Long guid : guidList) { + ChangeLogContext.addLog("t_system_admin_info", + "trashAll", guid, new HashMap<>()); + } + } + return update; + } + + @Override + public int recoverById(long id) throws Throwable { + SystemAdminInfo aDo = findAnyById(id); + if (aDo == null) { + return 0; + } + if (aDo.getIsHidden() == 0) { + return 0; + } + SystemAdminInfoExample updateWhere + = new SystemAdminInfoExample(); + Integer lockDataVersion = aDo.getDataVersion(); + updateWhere.createCriteria() + .andGuidEqualTo(aDo.getGuid()) + .andDataVersionEqualTo(lockDataVersion); + aDo.setDataVersion(aDo.getDataVersion() + 1); + aDo.setIsHidden(0); + aDo.setDeleteToken("VALID"); + aDo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemAdminInfoMapper.updateByExampleSelective(aDo, updateWhere); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] recoverById SystemAdminInfo long time" + + "\n\t|-> table name: t_system_admin_info" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + ChangeLogContext.addLog("t_system_admin_info", + "recoverById", aDo.getGuid(), new HashMap<>()); + } + return update; + } + + @Override + public int recoverAll(SystemAdminInfoExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemAdminInfoExample.Criteria criteria : example.getOredCriteria()) { + criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(1); + } + List guidList = systemAdminInfoMapper.selectPrimaryKeyByExample(example); + if (guidList.isEmpty()) { + return 0; + } + example = new SystemAdminInfoExample(); + example.createCriteria().andGuidIn(guidList); + SystemAdminInfo systemAdminInfo = new SystemAdminInfo(); + // reset data version, with optimistic locking + systemAdminInfo.setDataVersion((int) (new Date().getTime() % 1000)); + systemAdminInfo.setIsHidden(0); + systemAdminInfo.setDeleteToken("VALID"); + systemAdminInfo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemAdminInfoMapper.updateByExampleSelective(systemAdminInfo, example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] recoverAll SystemAdminInfo long time" + + "\n\t|-> table name: t_system_admin_info" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + for (Long guid : guidList) { + ChangeLogContext.addLog("t_system_admin_info", + "recoverAll", guid, new HashMap<>()); + } + } + return update; + } + + @Override + public SystemAdminInfo findOne(SystemAdminInfoExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + example.usePage(1, 1); + List dataList = getList(example); + if (dataList != null && !dataList.isEmpty()) { + return dataList.get(0); + } + return null; + } + + @Override + public List getList(SystemAdminInfoExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemAdminInfoExample.Criteria criteria : example.getOredCriteria()) { + if (example.isResultTrash()) { + criteria.andIsHiddenEqualTo(1) + .andIsDeleteEqualTo(0); + } else if (example.isResultValid()) { + criteria.andIsHiddenEqualTo(0) + .andIsDeleteEqualTo(0); + } else { + criteria.andIsDeleteEqualTo(0); + } + } + List result = null; + long startTime = new Date().getTime(); + result = systemAdminInfoMapper.selectByExample(example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + String exampleString = ""; + if (example.getWhereString() != null) { + exampleString += "\n\t|-> where: " + example.getWhereString(); + } + if (example.getOrderByClause() != null) { + exampleString += "\n\t|-> order by: " + example.getOrderByClause(); + } + if (example.getLimitString() != null) { + exampleString += "\n\t|-> limit: " + example.getLimitString(); + } + LOGGER.error("[SQL] select SystemAdminInfo list long time" + + "\n\t|-> table name: t_system_admin_info" + + "\n\t|-> use time: " + useTime + "ms" + + exampleString + + "\n\t|-----------------------------------" + ); + } + return result; + } + + @Override + public long count(SystemAdminInfoExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemAdminInfoExample.Criteria criteria : example.getOredCriteria()) { + if (example.isResultTrash()) { + criteria.andIsHiddenEqualTo(1) + .andIsDeleteEqualTo(0); + } else if (example.isResultValid()) { + criteria.andIsHiddenEqualTo(0) + .andIsDeleteEqualTo(0); + } else { + criteria.andIsDeleteEqualTo(0); + } + } + long startTime = new Date().getTime(); + long count = systemAdminInfoMapper.countByExample(example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + String exampleString = ""; + if (example.getWhereString() != null) { + exampleString += "\n\t|-> where: " + example.getWhereString(); + } + if (example.getOrderByClause() != null) { + exampleString += "\n\t|-> order by: " + example.getOrderByClause(); + } + LOGGER.error("[SQL] select SystemAdminInfo count long time" + + "\n\t|-> table name: t_system_admin_info" + + "\n\t|-> use time: " + useTime + "ms" + + exampleString + + "\n\t|-----------------------------------" + ); + } + return count; + } + + @Override + public long countWithPage(SystemAdminInfoExample example) throws Throwable { + // When not paginated, the count query returns 0 to avoid unnecessary queries + if (example.getRows() != null && example.getOffset() != null) { + return count(example); + } + return 0L; + } +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/domain/repository/SystemAsyncTaskInfoRepositoryImpl.java b/src/main/java/com/iqudoo/platform/application/domain/repository/SystemAsyncTaskInfoRepositoryImpl.java new file mode 100644 index 0000000..fd6f827 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/repository/SystemAsyncTaskInfoRepositoryImpl.java @@ -0,0 +1,744 @@ +package com.iqudoo.platform.application.domain.repository; + +import com.iqudoo.framework.tape.modules.utils.SnowflakeUtil; +import com.iqudoo.platform.application.database.mapper.SystemAsyncTaskInfoMapper; +import com.iqudoo.platform.application.database.model.SystemAsyncTaskInfo; +import com.iqudoo.platform.application.database.model.SystemAsyncTaskInfoExample; +import com.iqudoo.platform.application.domain.changeLog.ChangeLogContext; +import com.iqudoo.platform.application.facade.repository.ISystemAsyncTaskInfoRepository; +import java.util.*; +import javax.annotation.Resource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Repository; + +@SuppressWarnings("DuplicatedCode") +@Repository +public class SystemAsyncTaskInfoRepositoryImpl implements ISystemAsyncTaskInfoRepository { + private static final Logger LOGGER = LoggerFactory.getLogger(SystemAsyncTaskInfoRepositoryImpl.class); + + @Resource + private SystemAsyncTaskInfoMapper systemAsyncTaskInfoMapper; + + @Override + public SystemAsyncTaskInfo findAnyById(long guid) throws Throwable { + SystemAsyncTaskInfo aDo = null; + SystemAsyncTaskInfoExample example + = new SystemAsyncTaskInfoExample(); + example.createCriteria() + .andIsDeleteEqualTo(0) + .andGuidEqualTo(guid); + List recordList + = systemAsyncTaskInfoMapper.selectByExampleWithBLOBs(example); + if (recordList != null && !recordList.isEmpty()) { + aDo = recordList.get(0); + } + return aDo; + } + + @Override + public SystemAsyncTaskInfo findValidById(long guid) throws Throwable { + SystemAsyncTaskInfo aDo = null; + SystemAsyncTaskInfoExample example + = new SystemAsyncTaskInfoExample(); + example.createCriteria() + .andIsHiddenEqualTo(0) + .andIsDeleteEqualTo(0) + .andGuidEqualTo(guid); + List recordList + = systemAsyncTaskInfoMapper.selectByExampleWithBLOBs(example); + if (recordList != null && !recordList.isEmpty()) { + aDo = recordList.get(0); + } + return aDo; + } + + @Override + public SystemAsyncTaskInfo findTrashById(long guid) throws Throwable { + SystemAsyncTaskInfo aDo = null; + SystemAsyncTaskInfoExample example + = new SystemAsyncTaskInfoExample(); + example.createCriteria() + .andIsHiddenEqualTo(1) + .andIsDeleteEqualTo(0) + .andGuidEqualTo(guid); + List recordList + = systemAsyncTaskInfoMapper.selectByExampleWithBLOBs(example); + if (recordList != null && !recordList.isEmpty()) { + aDo = recordList.get(0); + } + return aDo; + } + + @Override + public SystemAsyncTaskInfo insert(SystemAsyncTaskInfo record) throws Throwable { + SystemAsyncTaskInfo aDo = new SystemAsyncTaskInfo(); + if (record.getGuid() != null) { + aDo.setGuid(record.getGuid()); + } else { + Long guid = SnowflakeUtil.nextId(); + aDo.setGuid(guid); + } + aDo.setBizType(record.getBizType()); + aDo.setBizId(record.getBizId()); + aDo.setTransId(record.getTransId()); + aDo.setTaskType(record.getTaskType()); + aDo.setCallTiming(record.getCallTiming()); + aDo.setStartTime(record.getStartTime()); + aDo.setEndTime(record.getEndTime()); + aDo.setUseTime(record.getUseTime()); + aDo.setTotalCount(record.getTotalCount()); + aDo.setSuccessCount(record.getSuccessCount()); + aDo.setFailureCount(record.getFailureCount()); + aDo.setIgnoreCount(record.getIgnoreCount()); + aDo.setRetryCount(record.getRetryCount()); + aDo.setOptStatus(record.getOptStatus()); + aDo.setTaskParams(record.getTaskParams()); + aDo.setIsDelete(0); + aDo.setIsHidden(0); + aDo.setDeleteToken("VALID"); + aDo.setDataVersion(1); + aDo.setCreateTime(new Date()); + aDo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int count = systemAsyncTaskInfoMapper.insert(aDo); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] insert SystemAsyncTaskInfo long time" + + "\n\t|-> table name: t_system_async_task_info" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (count > 0) { + ChangeLogContext.addLog("t_system_async_task_info", + "insert", aDo.getGuid(), new HashMap<>()); + return aDo; + } + throw new Throwable("Insert failed, SystemAsyncTaskInfo: " + aDo); + } + + @Override + public List batchInsert(List records) throws Throwable { + if (records == null || records.isEmpty()) { + return new ArrayList<>(); + } + List batch = new ArrayList<>(); + for (SystemAsyncTaskInfo record : records) { + SystemAsyncTaskInfo aDo = new SystemAsyncTaskInfo(); + if (record.getGuid() != null) { + aDo.setGuid(record.getGuid()); + } else { + Long guid = SnowflakeUtil.nextId(); + aDo.setGuid(guid); + } + aDo.setBizType(record.getBizType()); + aDo.setBizId(record.getBizId()); + aDo.setTransId(record.getTransId()); + aDo.setTaskType(record.getTaskType()); + aDo.setCallTiming(record.getCallTiming()); + aDo.setStartTime(record.getStartTime()); + aDo.setEndTime(record.getEndTime()); + aDo.setUseTime(record.getUseTime()); + aDo.setTotalCount(record.getTotalCount()); + aDo.setSuccessCount(record.getSuccessCount()); + aDo.setFailureCount(record.getFailureCount()); + aDo.setIgnoreCount(record.getIgnoreCount()); + aDo.setRetryCount(record.getRetryCount()); + aDo.setOptStatus(record.getOptStatus()); + aDo.setTaskParams(record.getTaskParams()); + aDo.setIsDelete(0); + aDo.setIsHidden(0); + aDo.setDeleteToken("VALID"); + aDo.setDataVersion(1); + aDo.setCreateTime(new Date()); + aDo.setUpdateTime(new Date()); + batch.add(aDo); + } + long startTime = new Date().getTime(); + int count = systemAsyncTaskInfoMapper.batchInsert(batch); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] batch insert SystemAsyncTaskInfo long time" + + "\n\t|-> table name: t_system_async_task_info" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (count == batch.size()) { + for (SystemAsyncTaskInfo aDo : batch) { + ChangeLogContext.addLog("t_system_async_task_info", + "batchInsert", aDo.getGuid(), new HashMap<>()); + } + return batch; + } + throw new Throwable("Batch insert failed, SystemAsyncTaskInfo affected: " + count + ", expected: " + batch.size()); + } + + @Override + public int update(SystemAsyncTaskInfo record) throws Throwable { + SystemAsyncTaskInfo aDo + = systemAsyncTaskInfoMapper.selectByPrimaryKey(record.getGuid()); + if (aDo == null || aDo.getIsDelete() == 1) { + throw new Throwable("Record not found, SystemAsyncTaskInfo GUID:" + record.getGuid()); + } + Map changeDiff = new HashMap<>(); + if (record.getBizType() != null) { + if (!Objects.equals(record.getBizType(), aDo.getBizType())) { + changeDiff.put("bizType", new Object[]{aDo.getBizType(), record.getBizType()}); + } + aDo.setBizType(record.getBizType()); + } + if (record.getBizId() != null) { + if (!Objects.equals(record.getBizId(), aDo.getBizId())) { + changeDiff.put("bizId", new Object[]{aDo.getBizId(), record.getBizId()}); + } + aDo.setBizId(record.getBizId()); + } + if (record.getTransId() != null) { + if (!Objects.equals(record.getTransId(), aDo.getTransId())) { + changeDiff.put("transId", new Object[]{aDo.getTransId(), record.getTransId()}); + } + aDo.setTransId(record.getTransId()); + } + if (record.getTaskType() != null) { + if (!Objects.equals(record.getTaskType(), aDo.getTaskType())) { + changeDiff.put("taskType", new Object[]{aDo.getTaskType(), record.getTaskType()}); + } + aDo.setTaskType(record.getTaskType()); + } + if (record.getCallTiming() != null) { + if (!Objects.equals(record.getCallTiming(), aDo.getCallTiming())) { + changeDiff.put("callTiming", new Object[]{aDo.getCallTiming(), record.getCallTiming()}); + } + aDo.setCallTiming(record.getCallTiming()); + } + if (record.getStartTime() != null) { + if (!Objects.equals(record.getStartTime(), aDo.getStartTime())) { + changeDiff.put("startTime", new Object[]{aDo.getStartTime(), record.getStartTime()}); + } + aDo.setStartTime(record.getStartTime()); + } + if (record.getEndTime() != null) { + if (!Objects.equals(record.getEndTime(), aDo.getEndTime())) { + changeDiff.put("endTime", new Object[]{aDo.getEndTime(), record.getEndTime()}); + } + aDo.setEndTime(record.getEndTime()); + } + if (record.getUseTime() != null) { + if (!Objects.equals(record.getUseTime(), aDo.getUseTime())) { + changeDiff.put("useTime", new Object[]{aDo.getUseTime(), record.getUseTime()}); + } + aDo.setUseTime(record.getUseTime()); + } + if (record.getTotalCount() != null) { + if (!Objects.equals(record.getTotalCount(), aDo.getTotalCount())) { + changeDiff.put("totalCount", new Object[]{aDo.getTotalCount(), record.getTotalCount()}); + } + aDo.setTotalCount(record.getTotalCount()); + } + if (record.getSuccessCount() != null) { + if (!Objects.equals(record.getSuccessCount(), aDo.getSuccessCount())) { + changeDiff.put("successCount", new Object[]{aDo.getSuccessCount(), record.getSuccessCount()}); + } + aDo.setSuccessCount(record.getSuccessCount()); + } + if (record.getFailureCount() != null) { + if (!Objects.equals(record.getFailureCount(), aDo.getFailureCount())) { + changeDiff.put("failureCount", new Object[]{aDo.getFailureCount(), record.getFailureCount()}); + } + aDo.setFailureCount(record.getFailureCount()); + } + if (record.getIgnoreCount() != null) { + if (!Objects.equals(record.getIgnoreCount(), aDo.getIgnoreCount())) { + changeDiff.put("ignoreCount", new Object[]{aDo.getIgnoreCount(), record.getIgnoreCount()}); + } + aDo.setIgnoreCount(record.getIgnoreCount()); + } + if (record.getRetryCount() != null) { + if (!Objects.equals(record.getRetryCount(), aDo.getRetryCount())) { + changeDiff.put("retryCount", new Object[]{aDo.getRetryCount(), record.getRetryCount()}); + } + aDo.setRetryCount(record.getRetryCount()); + } + if (record.getOptStatus() != null) { + if (!Objects.equals(record.getOptStatus(), aDo.getOptStatus())) { + changeDiff.put("optStatus", new Object[]{aDo.getOptStatus(), record.getOptStatus()}); + } + aDo.setOptStatus(record.getOptStatus()); + } + if (record.getTaskParams() != null) { + if (!Objects.equals(record.getTaskParams(), aDo.getTaskParams())) { + changeDiff.put("taskParams", new Object[]{aDo.getTaskParams(), record.getTaskParams()}); + } + aDo.setTaskParams(record.getTaskParams()); + } + SystemAsyncTaskInfoExample updateWhere = new SystemAsyncTaskInfoExample(); + updateWhere.createCriteria() + .andGuidEqualTo(aDo.getGuid()); + aDo.setDataVersion(aDo.getDataVersion() + 1); + aDo.setUpdateTime(new Date()); + // update data version + record.setDataVersion(aDo.getDataVersion()); + record.setUpdateTime(aDo.getUpdateTime()); + long startTime = new Date().getTime(); + int update = systemAsyncTaskInfoMapper.updateByExampleWithBLOBs(aDo, updateWhere); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] update SystemAsyncTaskInfo long time" + + "\n\t|-> table name: t_system_async_task_info" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0 && !changeDiff.isEmpty()) { + ChangeLogContext.addLog("t_system_async_task_info", + "update", aDo.getGuid(), changeDiff); + } + return update; + } + + @Override + public int updateByExampleSelective(SystemAsyncTaskInfo record, SystemAsyncTaskInfoExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemAsyncTaskInfoExample.Criteria criteria : example.getOredCriteria()) { + criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(0); + } + List guidList = systemAsyncTaskInfoMapper + .selectPrimaryKeyByExample(example); + if (guidList.isEmpty()) { + return 0; + } + example = new SystemAsyncTaskInfoExample(); + example.createCriteria().andGuidIn(guidList); + List recordList + = systemAsyncTaskInfoMapper.selectByExampleWithBLOBs(example); + Map> diffGroup = new HashMap<>(); + for (SystemAsyncTaskInfo aDo : recordList) { + Map changeDiff = new HashMap<>(); + if (record.getBizType() != null && !Objects.equals(record.getBizType(), aDo.getBizType())) { + changeDiff.put("bizType", new Object[]{aDo.getBizType(), record.getBizType()}); + } + if (record.getBizId() != null && !Objects.equals(record.getBizId(), aDo.getBizId())) { + changeDiff.put("bizId", new Object[]{aDo.getBizId(), record.getBizId()}); + } + if (record.getTransId() != null && !Objects.equals(record.getTransId(), aDo.getTransId())) { + changeDiff.put("transId", new Object[]{aDo.getTransId(), record.getTransId()}); + } + if (record.getTaskType() != null && !Objects.equals(record.getTaskType(), aDo.getTaskType())) { + changeDiff.put("taskType", new Object[]{aDo.getTaskType(), record.getTaskType()}); + } + if (record.getCallTiming() != null && !Objects.equals(record.getCallTiming(), aDo.getCallTiming())) { + changeDiff.put("callTiming", new Object[]{aDo.getCallTiming(), record.getCallTiming()}); + } + if (record.getStartTime() != null && !Objects.equals(record.getStartTime(), aDo.getStartTime())) { + changeDiff.put("startTime", new Object[]{aDo.getStartTime(), record.getStartTime()}); + } + if (record.getEndTime() != null && !Objects.equals(record.getEndTime(), aDo.getEndTime())) { + changeDiff.put("endTime", new Object[]{aDo.getEndTime(), record.getEndTime()}); + } + if (record.getUseTime() != null && !Objects.equals(record.getUseTime(), aDo.getUseTime())) { + changeDiff.put("useTime", new Object[]{aDo.getUseTime(), record.getUseTime()}); + } + if (record.getTotalCount() != null && !Objects.equals(record.getTotalCount(), aDo.getTotalCount())) { + changeDiff.put("totalCount", new Object[]{aDo.getTotalCount(), record.getTotalCount()}); + } + if (record.getSuccessCount() != null && !Objects.equals(record.getSuccessCount(), aDo.getSuccessCount())) { + changeDiff.put("successCount", new Object[]{aDo.getSuccessCount(), record.getSuccessCount()}); + } + if (record.getFailureCount() != null && !Objects.equals(record.getFailureCount(), aDo.getFailureCount())) { + changeDiff.put("failureCount", new Object[]{aDo.getFailureCount(), record.getFailureCount()}); + } + if (record.getIgnoreCount() != null && !Objects.equals(record.getIgnoreCount(), aDo.getIgnoreCount())) { + changeDiff.put("ignoreCount", new Object[]{aDo.getIgnoreCount(), record.getIgnoreCount()}); + } + if (record.getRetryCount() != null && !Objects.equals(record.getRetryCount(), aDo.getRetryCount())) { + changeDiff.put("retryCount", new Object[]{aDo.getRetryCount(), record.getRetryCount()}); + } + if (record.getOptStatus() != null && !Objects.equals(record.getOptStatus(), aDo.getOptStatus())) { + changeDiff.put("optStatus", new Object[]{aDo.getOptStatus(), record.getOptStatus()}); + } + if (record.getTaskParams() != null && !Objects.equals(record.getTaskParams(), aDo.getTaskParams())) { + changeDiff.put("taskParams", new Object[]{aDo.getTaskParams(), record.getTaskParams()}); + } + diffGroup.put(aDo.getGuid(), changeDiff); + } + // It is not supported to directly modify the following columns + record.setUpdateTime(new Date()); + record.setIsHidden(null); + record.setIsDelete(null); + record.setDeleteToken(null); + record.setCreateTime(null); + record.setGuid(null); + long startTime = new Date().getTime(); + int update = systemAsyncTaskInfoMapper.updateByExampleSelective(record, example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + String exampleString = ""; + if (example.getWhereString() != null) { + exampleString += "\n\t|-> where: " + example.getWhereString(); + } + LOGGER.error("[SQL] updateByExampleSelective SystemAsyncTaskInfo long time" + + "\n\t|-> table name: t_system_async_task_info" + + "\n\t|-> use time: " + useTime + "ms" + + exampleString + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + for (Map.Entry> diffEntry : diffGroup.entrySet()) { + if (diffEntry.getValue() != null && !diffEntry.getValue().isEmpty()) { + ChangeLogContext.addLog("t_system_async_task_info", + "updateByExampleSelective", diffEntry.getKey(), diffEntry.getValue()); + } + } + } + return update; + } + + @Override + public int deleteById(long id, boolean release) throws Throwable { + SystemAsyncTaskInfo aDo = findAnyById(id); + if (aDo == null) { + return 0; + } + if (release) { + return systemAsyncTaskInfoMapper.deleteByPrimaryKey(aDo.getGuid()); + } + SystemAsyncTaskInfoExample updateWhere + = new SystemAsyncTaskInfoExample(); + updateWhere.createCriteria() + .andGuidEqualTo(aDo.getGuid()); + aDo.setDataVersion(aDo.getDataVersion() + 1); + aDo.setIsDelete(1); + aDo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemAsyncTaskInfoMapper.updateByExampleSelective(aDo, updateWhere); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] deleteById SystemAsyncTaskInfo long time" + + "\n\t|-> table name: t_system_async_task_info" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + ChangeLogContext.addLog("t_system_async_task_info", + "deleteById", aDo.getGuid(), new HashMap<>()); + } + return update; + } + + @Override + public int deleteAll(SystemAsyncTaskInfoExample example, boolean release) throws Throwable { + if (release) { + return systemAsyncTaskInfoMapper.deleteByExample(example); + } + // clone new example + example = example.cloneExample(); + for (SystemAsyncTaskInfoExample.Criteria criteria : example.getOredCriteria()) { + criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(1); + } + List guidList = systemAsyncTaskInfoMapper.selectPrimaryKeyByExample(example); + if (guidList.isEmpty()) { + return 0; + } + example = new SystemAsyncTaskInfoExample(); + example.createCriteria().andGuidIn(guidList); + SystemAsyncTaskInfo systemAsyncTaskInfo = new SystemAsyncTaskInfo(); + systemAsyncTaskInfo.setIsDelete(1); + systemAsyncTaskInfo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemAsyncTaskInfoMapper.updateByExampleSelective(systemAsyncTaskInfo, example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] deleteAll SystemAsyncTaskInfo long time" + + "\n\t|-> table name: t_system_async_task_info" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + for (Long guid : guidList) { + ChangeLogContext.addLog("t_system_async_task_info", + "deleteAll", guid, new HashMap<>()); + } + } + return update; + } + + @Override + public int trashById(long id) throws Throwable { + SystemAsyncTaskInfo aDo = findAnyById(id); + if (aDo == null) { + return 0; + } + if (aDo.getIsHidden() == 1) { + return 0; + } + SystemAsyncTaskInfoExample updateWhere + = new SystemAsyncTaskInfoExample(); + updateWhere.createCriteria() + .andGuidEqualTo(aDo.getGuid()); + aDo.setDataVersion(aDo.getDataVersion() + 1); + aDo.setIsHidden(1); + aDo.setDeleteToken(aDo.getGuid() + ""); + aDo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemAsyncTaskInfoMapper.updateByExampleSelective(aDo, updateWhere); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] trashById SystemAsyncTaskInfo long time" + + "\n\t|-> table name: t_system_async_task_info" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + ChangeLogContext.addLog("t_system_async_task_info", + "trashById", aDo.getGuid(), new HashMap<>()); + } + return update; + } + + @Override + public int trashAll(SystemAsyncTaskInfoExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemAsyncTaskInfoExample.Criteria criteria : example.getOredCriteria()) { + criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(0); + } + List guidList = systemAsyncTaskInfoMapper.selectPrimaryKeyByExample(example); + if (guidList.isEmpty()) { + return 0; + } + example = new SystemAsyncTaskInfoExample(); + example.createCriteria().andGuidIn(guidList); + SystemAsyncTaskInfo systemAsyncTaskInfo = new SystemAsyncTaskInfo(); + systemAsyncTaskInfo.setIsHidden(1); + systemAsyncTaskInfo.setDeleteToken(SnowflakeUtil.nextId() + ""); + systemAsyncTaskInfo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemAsyncTaskInfoMapper.updateByExampleSelective(systemAsyncTaskInfo, example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] trashAll SystemAsyncTaskInfo long time" + + "\n\t|-> table name: t_system_async_task_info" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + for (Long guid : guidList) { + ChangeLogContext.addLog("t_system_async_task_info", + "trashAll", guid, new HashMap<>()); + } + } + return update; + } + + @Override + public int recoverById(long id) throws Throwable { + SystemAsyncTaskInfo aDo = findAnyById(id); + if (aDo == null) { + return 0; + } + if (aDo.getIsHidden() == 0) { + return 0; + } + SystemAsyncTaskInfoExample updateWhere + = new SystemAsyncTaskInfoExample(); + updateWhere.createCriteria() + .andGuidEqualTo(aDo.getGuid()); + aDo.setDataVersion(aDo.getDataVersion() + 1); + aDo.setIsHidden(0); + aDo.setDeleteToken("VALID"); + aDo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemAsyncTaskInfoMapper.updateByExampleSelective(aDo, updateWhere); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] recoverById SystemAsyncTaskInfo long time" + + "\n\t|-> table name: t_system_async_task_info" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + ChangeLogContext.addLog("t_system_async_task_info", + "recoverById", aDo.getGuid(), new HashMap<>()); + } + return update; + } + + @Override + public int recoverAll(SystemAsyncTaskInfoExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemAsyncTaskInfoExample.Criteria criteria : example.getOredCriteria()) { + criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(1); + } + List guidList = systemAsyncTaskInfoMapper.selectPrimaryKeyByExample(example); + if (guidList.isEmpty()) { + return 0; + } + example = new SystemAsyncTaskInfoExample(); + example.createCriteria().andGuidIn(guidList); + SystemAsyncTaskInfo systemAsyncTaskInfo = new SystemAsyncTaskInfo(); + systemAsyncTaskInfo.setIsHidden(0); + systemAsyncTaskInfo.setDeleteToken("VALID"); + systemAsyncTaskInfo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemAsyncTaskInfoMapper.updateByExampleSelective(systemAsyncTaskInfo, example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] recoverAll SystemAsyncTaskInfo long time" + + "\n\t|-> table name: t_system_async_task_info" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + for (Long guid : guidList) { + ChangeLogContext.addLog("t_system_async_task_info", + "recoverAll", guid, new HashMap<>()); + } + } + return update; + } + + @Override + public SystemAsyncTaskInfo findOne(SystemAsyncTaskInfoExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + example.usePage(1, 1); + List dataList = getList(example); + if (dataList != null && !dataList.isEmpty()) { + return dataList.get(0); + } + return null; + } + + @Override + public List getList(SystemAsyncTaskInfoExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemAsyncTaskInfoExample.Criteria criteria : example.getOredCriteria()) { + if (example.isResultTrash()) { + criteria.andIsHiddenEqualTo(1) + .andIsDeleteEqualTo(0); + } else if (example.isResultValid()) { + criteria.andIsHiddenEqualTo(0) + .andIsDeleteEqualTo(0); + } else { + criteria.andIsDeleteEqualTo(0); + } + } + List result = null; + long startTime = new Date().getTime(); + if (example.getRows() != null && example.getOffset() != null) { + List primaryKeyList = systemAsyncTaskInfoMapper.selectPrimaryKeyByExample(example); + if (primaryKeyList == null || primaryKeyList.isEmpty()) { + return new ArrayList<>(); + } + long findPrimaryKeyTime = new Date().getTime() - startTime; + if (findPrimaryKeyTime > 300) { + String exampleString = ""; + if (example.getWhereString() != null) { + exampleString += "\n\t|-> where: " + example.getWhereString(); + } + if (example.getOrderByClause() != null) { + exampleString += "\n\t|-> order by: " + example.getOrderByClause(); + } + if (example.getLimitString() != null) { + exampleString += "\n\t|-> limit: " + example.getLimitString(); + } + LOGGER.error("[SQL] select SystemAsyncTaskInfo list primary key long time" + + "\n\t|-> table name: t_system_async_task_info" + + "\n\t|-> use time: " + findPrimaryKeyTime + "ms" + + exampleString + + "\n\t|-----------------------------------" + ); + } + // reset start time + startTime = new Date().getTime(); + String oldOrderByClause = example.getOrderByClause(); + Boolean withBLOBsFlag = example.isWithBLOBs(); + example = new SystemAsyncTaskInfoExample(); + example.createCriteria().andGuidIn(primaryKeyList); + example.setOrderByClause(oldOrderByClause); + example.setWithBLOBs(withBLOBsFlag); + } + if (example.isWithBLOBs()) { + result = systemAsyncTaskInfoMapper.selectByExampleWithBLOBs(example); + } else { + result = systemAsyncTaskInfoMapper.selectByExample(example); + } + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + String exampleString = ""; + if (example.getWhereString() != null) { + exampleString += "\n\t|-> where: " + example.getWhereString(); + } + if (example.getOrderByClause() != null) { + exampleString += "\n\t|-> order by: " + example.getOrderByClause(); + } + if (example.getLimitString() != null) { + exampleString += "\n\t|-> limit: " + example.getLimitString(); + } + LOGGER.error("[SQL] select SystemAsyncTaskInfo list long time" + + "\n\t|-> table name: t_system_async_task_info" + + "\n\t|-> use time: " + useTime + "ms" + + exampleString + + "\n\t|-----------------------------------" + ); + } + return result; + } + + @Override + public long count(SystemAsyncTaskInfoExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemAsyncTaskInfoExample.Criteria criteria : example.getOredCriteria()) { + if (example.isResultTrash()) { + criteria.andIsHiddenEqualTo(1) + .andIsDeleteEqualTo(0); + } else if (example.isResultValid()) { + criteria.andIsHiddenEqualTo(0) + .andIsDeleteEqualTo(0); + } else { + criteria.andIsDeleteEqualTo(0); + } + } + long startTime = new Date().getTime(); + long count = systemAsyncTaskInfoMapper.countByExample(example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + String exampleString = ""; + if (example.getWhereString() != null) { + exampleString += "\n\t|-> where: " + example.getWhereString(); + } + if (example.getOrderByClause() != null) { + exampleString += "\n\t|-> order by: " + example.getOrderByClause(); + } + LOGGER.error("[SQL] select SystemAsyncTaskInfo count long time" + + "\n\t|-> table name: t_system_async_task_info" + + "\n\t|-> use time: " + useTime + "ms" + + exampleString + + "\n\t|-----------------------------------" + ); + } + return count; + } + + @Override + public long countWithPage(SystemAsyncTaskInfoExample example) throws Throwable { + // When not paginated, the count query returns 0 to avoid unnecessary queries + if (example.getRows() != null && example.getOffset() != null) { + return count(example); + } + return 0L; + } +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/domain/repository/SystemCrawlerCacheDataRepositoryImpl.java b/src/main/java/com/iqudoo/platform/application/domain/repository/SystemCrawlerCacheDataRepositoryImpl.java new file mode 100644 index 0000000..1343cae --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/repository/SystemCrawlerCacheDataRepositoryImpl.java @@ -0,0 +1,623 @@ +package com.iqudoo.platform.application.domain.repository; + +import com.iqudoo.framework.tape.modules.utils.SnowflakeUtil; +import com.iqudoo.platform.application.database.mapper.SystemCrawlerCacheDataMapper; +import com.iqudoo.platform.application.database.model.SystemCrawlerCacheData; +import com.iqudoo.platform.application.database.model.SystemCrawlerCacheDataExample; +import com.iqudoo.platform.application.domain.changeLog.ChangeLogContext; +import com.iqudoo.platform.application.facade.repository.ISystemCrawlerCacheDataRepository; +import java.util.*; +import javax.annotation.Resource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Repository; + +@SuppressWarnings("DuplicatedCode") +@Repository +public class SystemCrawlerCacheDataRepositoryImpl implements ISystemCrawlerCacheDataRepository { + private static final Logger LOGGER = LoggerFactory.getLogger(SystemCrawlerCacheDataRepositoryImpl.class); + + @Resource + private SystemCrawlerCacheDataMapper systemCrawlerCacheDataMapper; + + @Override + public SystemCrawlerCacheData findAnyById(long guid) throws Throwable { + SystemCrawlerCacheData aDo = null; + SystemCrawlerCacheDataExample example + = new SystemCrawlerCacheDataExample(); + example.createCriteria() + .andIsDeleteEqualTo(0) + .andGuidEqualTo(guid); + List recordList + = systemCrawlerCacheDataMapper.selectByExampleWithBLOBs(example); + if (recordList != null && !recordList.isEmpty()) { + aDo = recordList.get(0); + } + return aDo; + } + + @Override + public SystemCrawlerCacheData findValidById(long guid) throws Throwable { + SystemCrawlerCacheData aDo = null; + SystemCrawlerCacheDataExample example + = new SystemCrawlerCacheDataExample(); + example.createCriteria() + .andIsHiddenEqualTo(0) + .andIsDeleteEqualTo(0) + .andGuidEqualTo(guid); + List recordList + = systemCrawlerCacheDataMapper.selectByExampleWithBLOBs(example); + if (recordList != null && !recordList.isEmpty()) { + aDo = recordList.get(0); + } + return aDo; + } + + @Override + public SystemCrawlerCacheData findTrashById(long guid) throws Throwable { + SystemCrawlerCacheData aDo = null; + SystemCrawlerCacheDataExample example + = new SystemCrawlerCacheDataExample(); + example.createCriteria() + .andIsHiddenEqualTo(1) + .andIsDeleteEqualTo(0) + .andGuidEqualTo(guid); + List recordList + = systemCrawlerCacheDataMapper.selectByExampleWithBLOBs(example); + if (recordList != null && !recordList.isEmpty()) { + aDo = recordList.get(0); + } + return aDo; + } + + @Override + public SystemCrawlerCacheData insert(SystemCrawlerCacheData record) throws Throwable { + SystemCrawlerCacheData aDo = new SystemCrawlerCacheData(); + if (record.getGuid() != null) { + aDo.setGuid(record.getGuid()); + } else { + Long guid = SnowflakeUtil.nextId(); + aDo.setGuid(guid); + } + aDo.setCrawlerTime(record.getCrawlerTime()); + aDo.setCrawlerType(record.getCrawlerType()); + aDo.setCrawlerKeyword(record.getCrawlerKeyword()); + aDo.setCacheData(record.getCacheData()); + aDo.setIsDelete(0); + aDo.setIsHidden(0); + aDo.setDeleteToken("VALID"); + aDo.setDataVersion(1); + aDo.setCreateTime(new Date()); + aDo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int count = systemCrawlerCacheDataMapper.insert(aDo); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] insert SystemCrawlerCacheData long time" + + "\n\t|-> table name: t_system_crawler_cache_data" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (count > 0) { + ChangeLogContext.addLog("t_system_crawler_cache_data", + "insert", aDo.getGuid(), new HashMap<>()); + return aDo; + } + throw new Throwable("Insert failed, SystemCrawlerCacheData: " + aDo); + } + + @Override + public List batchInsert(List records) throws Throwable { + if (records == null || records.isEmpty()) { + return new ArrayList<>(); + } + List batch = new ArrayList<>(); + for (SystemCrawlerCacheData record : records) { + SystemCrawlerCacheData aDo = new SystemCrawlerCacheData(); + if (record.getGuid() != null) { + aDo.setGuid(record.getGuid()); + } else { + Long guid = SnowflakeUtil.nextId(); + aDo.setGuid(guid); + } + aDo.setCrawlerTime(record.getCrawlerTime()); + aDo.setCrawlerType(record.getCrawlerType()); + aDo.setCrawlerKeyword(record.getCrawlerKeyword()); + aDo.setCacheData(record.getCacheData()); + aDo.setIsDelete(0); + aDo.setIsHidden(0); + aDo.setDeleteToken("VALID"); + aDo.setDataVersion(1); + aDo.setCreateTime(new Date()); + aDo.setUpdateTime(new Date()); + batch.add(aDo); + } + long startTime = new Date().getTime(); + int count = systemCrawlerCacheDataMapper.batchInsert(batch); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] batch insert SystemCrawlerCacheData long time" + + "\n\t|-> table name: t_system_crawler_cache_data" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (count == batch.size()) { + for (SystemCrawlerCacheData aDo : batch) { + ChangeLogContext.addLog("t_system_crawler_cache_data", + "batchInsert", aDo.getGuid(), new HashMap<>()); + } + return batch; + } + throw new Throwable("Batch insert failed, SystemCrawlerCacheData affected: " + count + ", expected: " + batch.size()); + } + + @Override + public int update(SystemCrawlerCacheData record) throws Throwable { + SystemCrawlerCacheData aDo + = systemCrawlerCacheDataMapper.selectByPrimaryKey(record.getGuid()); + if (aDo == null || aDo.getIsDelete() == 1) { + throw new Throwable("Record not found, SystemCrawlerCacheData GUID:" + record.getGuid()); + } + Map changeDiff = new HashMap<>(); + if (record.getCrawlerTime() != null) { + if (!Objects.equals(record.getCrawlerTime(), aDo.getCrawlerTime())) { + changeDiff.put("crawlerTime", new Object[]{aDo.getCrawlerTime(), record.getCrawlerTime()}); + } + aDo.setCrawlerTime(record.getCrawlerTime()); + } + if (record.getCrawlerType() != null) { + if (!Objects.equals(record.getCrawlerType(), aDo.getCrawlerType())) { + changeDiff.put("crawlerType", new Object[]{aDo.getCrawlerType(), record.getCrawlerType()}); + } + aDo.setCrawlerType(record.getCrawlerType()); + } + if (record.getCrawlerKeyword() != null) { + if (!Objects.equals(record.getCrawlerKeyword(), aDo.getCrawlerKeyword())) { + changeDiff.put("crawlerKeyword", new Object[]{aDo.getCrawlerKeyword(), record.getCrawlerKeyword()}); + } + aDo.setCrawlerKeyword(record.getCrawlerKeyword()); + } + if (record.getCacheData() != null) { + if (!Objects.equals(record.getCacheData(), aDo.getCacheData())) { + changeDiff.put("cacheData", new Object[]{aDo.getCacheData(), record.getCacheData()}); + } + aDo.setCacheData(record.getCacheData()); + } + SystemCrawlerCacheDataExample updateWhere = new SystemCrawlerCacheDataExample(); + updateWhere.createCriteria() + .andGuidEqualTo(aDo.getGuid()); + aDo.setDataVersion(aDo.getDataVersion() + 1); + aDo.setUpdateTime(new Date()); + // update data version + record.setDataVersion(aDo.getDataVersion()); + record.setUpdateTime(aDo.getUpdateTime()); + long startTime = new Date().getTime(); + int update = systemCrawlerCacheDataMapper.updateByExampleWithBLOBs(aDo, updateWhere); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] update SystemCrawlerCacheData long time" + + "\n\t|-> table name: t_system_crawler_cache_data" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0 && !changeDiff.isEmpty()) { + ChangeLogContext.addLog("t_system_crawler_cache_data", + "update", aDo.getGuid(), changeDiff); + } + return update; + } + + @Override + public int updateByExampleSelective(SystemCrawlerCacheData record, SystemCrawlerCacheDataExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemCrawlerCacheDataExample.Criteria criteria : example.getOredCriteria()) { + criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(0); + } + List guidList = systemCrawlerCacheDataMapper + .selectPrimaryKeyByExample(example); + if (guidList.isEmpty()) { + return 0; + } + example = new SystemCrawlerCacheDataExample(); + example.createCriteria().andGuidIn(guidList); + List recordList + = systemCrawlerCacheDataMapper.selectByExampleWithBLOBs(example); + Map> diffGroup = new HashMap<>(); + for (SystemCrawlerCacheData aDo : recordList) { + Map changeDiff = new HashMap<>(); + if (record.getCrawlerTime() != null && !Objects.equals(record.getCrawlerTime(), aDo.getCrawlerTime())) { + changeDiff.put("crawlerTime", new Object[]{aDo.getCrawlerTime(), record.getCrawlerTime()}); + } + if (record.getCrawlerType() != null && !Objects.equals(record.getCrawlerType(), aDo.getCrawlerType())) { + changeDiff.put("crawlerType", new Object[]{aDo.getCrawlerType(), record.getCrawlerType()}); + } + if (record.getCrawlerKeyword() != null && !Objects.equals(record.getCrawlerKeyword(), aDo.getCrawlerKeyword())) { + changeDiff.put("crawlerKeyword", new Object[]{aDo.getCrawlerKeyword(), record.getCrawlerKeyword()}); + } + if (record.getCacheData() != null && !Objects.equals(record.getCacheData(), aDo.getCacheData())) { + changeDiff.put("cacheData", new Object[]{aDo.getCacheData(), record.getCacheData()}); + } + diffGroup.put(aDo.getGuid(), changeDiff); + } + // It is not supported to directly modify the following columns + record.setUpdateTime(new Date()); + record.setIsHidden(null); + record.setIsDelete(null); + record.setDeleteToken(null); + record.setCreateTime(null); + record.setGuid(null); + long startTime = new Date().getTime(); + int update = systemCrawlerCacheDataMapper.updateByExampleSelective(record, example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + String exampleString = ""; + if (example.getWhereString() != null) { + exampleString += "\n\t|-> where: " + example.getWhereString(); + } + LOGGER.error("[SQL] updateByExampleSelective SystemCrawlerCacheData long time" + + "\n\t|-> table name: t_system_crawler_cache_data" + + "\n\t|-> use time: " + useTime + "ms" + + exampleString + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + for (Map.Entry> diffEntry : diffGroup.entrySet()) { + if (diffEntry.getValue() != null && !diffEntry.getValue().isEmpty()) { + ChangeLogContext.addLog("t_system_crawler_cache_data", + "updateByExampleSelective", diffEntry.getKey(), diffEntry.getValue()); + } + } + } + return update; + } + + @Override + public int deleteById(long id, boolean release) throws Throwable { + SystemCrawlerCacheData aDo = findAnyById(id); + if (aDo == null) { + return 0; + } + if (release) { + return systemCrawlerCacheDataMapper.deleteByPrimaryKey(aDo.getGuid()); + } + SystemCrawlerCacheDataExample updateWhere + = new SystemCrawlerCacheDataExample(); + updateWhere.createCriteria() + .andGuidEqualTo(aDo.getGuid()); + aDo.setDataVersion(aDo.getDataVersion() + 1); + aDo.setIsDelete(1); + aDo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemCrawlerCacheDataMapper.updateByExampleSelective(aDo, updateWhere); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] deleteById SystemCrawlerCacheData long time" + + "\n\t|-> table name: t_system_crawler_cache_data" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + ChangeLogContext.addLog("t_system_crawler_cache_data", + "deleteById", aDo.getGuid(), new HashMap<>()); + } + return update; + } + + @Override + public int deleteAll(SystemCrawlerCacheDataExample example, boolean release) throws Throwable { + if (release) { + return systemCrawlerCacheDataMapper.deleteByExample(example); + } + // clone new example + example = example.cloneExample(); + for (SystemCrawlerCacheDataExample.Criteria criteria : example.getOredCriteria()) { + criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(1); + } + List guidList = systemCrawlerCacheDataMapper.selectPrimaryKeyByExample(example); + if (guidList.isEmpty()) { + return 0; + } + example = new SystemCrawlerCacheDataExample(); + example.createCriteria().andGuidIn(guidList); + SystemCrawlerCacheData systemCrawlerCacheData = new SystemCrawlerCacheData(); + systemCrawlerCacheData.setIsDelete(1); + systemCrawlerCacheData.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemCrawlerCacheDataMapper.updateByExampleSelective(systemCrawlerCacheData, example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] deleteAll SystemCrawlerCacheData long time" + + "\n\t|-> table name: t_system_crawler_cache_data" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + for (Long guid : guidList) { + ChangeLogContext.addLog("t_system_crawler_cache_data", + "deleteAll", guid, new HashMap<>()); + } + } + return update; + } + + @Override + public int trashById(long id) throws Throwable { + SystemCrawlerCacheData aDo = findAnyById(id); + if (aDo == null) { + return 0; + } + if (aDo.getIsHidden() == 1) { + return 0; + } + SystemCrawlerCacheDataExample updateWhere + = new SystemCrawlerCacheDataExample(); + updateWhere.createCriteria() + .andGuidEqualTo(aDo.getGuid()); + aDo.setDataVersion(aDo.getDataVersion() + 1); + aDo.setIsHidden(1); + aDo.setDeleteToken(aDo.getGuid() + ""); + aDo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemCrawlerCacheDataMapper.updateByExampleSelective(aDo, updateWhere); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] trashById SystemCrawlerCacheData long time" + + "\n\t|-> table name: t_system_crawler_cache_data" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + ChangeLogContext.addLog("t_system_crawler_cache_data", + "trashById", aDo.getGuid(), new HashMap<>()); + } + return update; + } + + @Override + public int trashAll(SystemCrawlerCacheDataExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemCrawlerCacheDataExample.Criteria criteria : example.getOredCriteria()) { + criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(0); + } + List guidList = systemCrawlerCacheDataMapper.selectPrimaryKeyByExample(example); + if (guidList.isEmpty()) { + return 0; + } + example = new SystemCrawlerCacheDataExample(); + example.createCriteria().andGuidIn(guidList); + SystemCrawlerCacheData systemCrawlerCacheData = new SystemCrawlerCacheData(); + systemCrawlerCacheData.setIsHidden(1); + systemCrawlerCacheData.setDeleteToken(SnowflakeUtil.nextId() + ""); + systemCrawlerCacheData.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemCrawlerCacheDataMapper.updateByExampleSelective(systemCrawlerCacheData, example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] trashAll SystemCrawlerCacheData long time" + + "\n\t|-> table name: t_system_crawler_cache_data" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + for (Long guid : guidList) { + ChangeLogContext.addLog("t_system_crawler_cache_data", + "trashAll", guid, new HashMap<>()); + } + } + return update; + } + + @Override + public int recoverById(long id) throws Throwable { + SystemCrawlerCacheData aDo = findAnyById(id); + if (aDo == null) { + return 0; + } + if (aDo.getIsHidden() == 0) { + return 0; + } + SystemCrawlerCacheDataExample updateWhere + = new SystemCrawlerCacheDataExample(); + updateWhere.createCriteria() + .andGuidEqualTo(aDo.getGuid()); + aDo.setDataVersion(aDo.getDataVersion() + 1); + aDo.setIsHidden(0); + aDo.setDeleteToken("VALID"); + aDo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemCrawlerCacheDataMapper.updateByExampleSelective(aDo, updateWhere); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] recoverById SystemCrawlerCacheData long time" + + "\n\t|-> table name: t_system_crawler_cache_data" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + ChangeLogContext.addLog("t_system_crawler_cache_data", + "recoverById", aDo.getGuid(), new HashMap<>()); + } + return update; + } + + @Override + public int recoverAll(SystemCrawlerCacheDataExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemCrawlerCacheDataExample.Criteria criteria : example.getOredCriteria()) { + criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(1); + } + List guidList = systemCrawlerCacheDataMapper.selectPrimaryKeyByExample(example); + if (guidList.isEmpty()) { + return 0; + } + example = new SystemCrawlerCacheDataExample(); + example.createCriteria().andGuidIn(guidList); + SystemCrawlerCacheData systemCrawlerCacheData = new SystemCrawlerCacheData(); + systemCrawlerCacheData.setIsHidden(0); + systemCrawlerCacheData.setDeleteToken("VALID"); + systemCrawlerCacheData.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemCrawlerCacheDataMapper.updateByExampleSelective(systemCrawlerCacheData, example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] recoverAll SystemCrawlerCacheData long time" + + "\n\t|-> table name: t_system_crawler_cache_data" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + for (Long guid : guidList) { + ChangeLogContext.addLog("t_system_crawler_cache_data", + "recoverAll", guid, new HashMap<>()); + } + } + return update; + } + + @Override + public SystemCrawlerCacheData findOne(SystemCrawlerCacheDataExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + example.usePage(1, 1); + List dataList = getList(example); + if (dataList != null && !dataList.isEmpty()) { + return dataList.get(0); + } + return null; + } + + @Override + public List getList(SystemCrawlerCacheDataExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemCrawlerCacheDataExample.Criteria criteria : example.getOredCriteria()) { + if (example.isResultTrash()) { + criteria.andIsHiddenEqualTo(1) + .andIsDeleteEqualTo(0); + } else if (example.isResultValid()) { + criteria.andIsHiddenEqualTo(0) + .andIsDeleteEqualTo(0); + } else { + criteria.andIsDeleteEqualTo(0); + } + } + List result = null; + long startTime = new Date().getTime(); + if (example.getRows() != null && example.getOffset() != null) { + List primaryKeyList = systemCrawlerCacheDataMapper.selectPrimaryKeyByExample(example); + if (primaryKeyList == null || primaryKeyList.isEmpty()) { + return new ArrayList<>(); + } + long findPrimaryKeyTime = new Date().getTime() - startTime; + if (findPrimaryKeyTime > 300) { + String exampleString = ""; + if (example.getWhereString() != null) { + exampleString += "\n\t|-> where: " + example.getWhereString(); + } + if (example.getOrderByClause() != null) { + exampleString += "\n\t|-> order by: " + example.getOrderByClause(); + } + if (example.getLimitString() != null) { + exampleString += "\n\t|-> limit: " + example.getLimitString(); + } + LOGGER.error("[SQL] select SystemCrawlerCacheData list primary key long time" + + "\n\t|-> table name: t_system_crawler_cache_data" + + "\n\t|-> use time: " + findPrimaryKeyTime + "ms" + + exampleString + + "\n\t|-----------------------------------" + ); + } + // reset start time + startTime = new Date().getTime(); + String oldOrderByClause = example.getOrderByClause(); + Boolean withBLOBsFlag = example.isWithBLOBs(); + example = new SystemCrawlerCacheDataExample(); + example.createCriteria().andGuidIn(primaryKeyList); + example.setOrderByClause(oldOrderByClause); + example.setWithBLOBs(withBLOBsFlag); + } + if (example.isWithBLOBs()) { + result = systemCrawlerCacheDataMapper.selectByExampleWithBLOBs(example); + } else { + result = systemCrawlerCacheDataMapper.selectByExample(example); + } + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + String exampleString = ""; + if (example.getWhereString() != null) { + exampleString += "\n\t|-> where: " + example.getWhereString(); + } + if (example.getOrderByClause() != null) { + exampleString += "\n\t|-> order by: " + example.getOrderByClause(); + } + if (example.getLimitString() != null) { + exampleString += "\n\t|-> limit: " + example.getLimitString(); + } + LOGGER.error("[SQL] select SystemCrawlerCacheData list long time" + + "\n\t|-> table name: t_system_crawler_cache_data" + + "\n\t|-> use time: " + useTime + "ms" + + exampleString + + "\n\t|-----------------------------------" + ); + } + return result; + } + + @Override + public long count(SystemCrawlerCacheDataExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemCrawlerCacheDataExample.Criteria criteria : example.getOredCriteria()) { + if (example.isResultTrash()) { + criteria.andIsHiddenEqualTo(1) + .andIsDeleteEqualTo(0); + } else if (example.isResultValid()) { + criteria.andIsHiddenEqualTo(0) + .andIsDeleteEqualTo(0); + } else { + criteria.andIsDeleteEqualTo(0); + } + } + long startTime = new Date().getTime(); + long count = systemCrawlerCacheDataMapper.countByExample(example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + String exampleString = ""; + if (example.getWhereString() != null) { + exampleString += "\n\t|-> where: " + example.getWhereString(); + } + if (example.getOrderByClause() != null) { + exampleString += "\n\t|-> order by: " + example.getOrderByClause(); + } + LOGGER.error("[SQL] select SystemCrawlerCacheData count long time" + + "\n\t|-> table name: t_system_crawler_cache_data" + + "\n\t|-> use time: " + useTime + "ms" + + exampleString + + "\n\t|-----------------------------------" + ); + } + return count; + } + + @Override + public long countWithPage(SystemCrawlerCacheDataExample example) throws Throwable { + // When not paginated, the count query returns 0 to avoid unnecessary queries + if (example.getRows() != null && example.getOffset() != null) { + return count(example); + } + return 0L; + } +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/domain/repository/SystemGlobalCacheRepositoryImpl.java b/src/main/java/com/iqudoo/platform/application/domain/repository/SystemGlobalCacheRepositoryImpl.java new file mode 100644 index 0000000..fbbae7f --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/repository/SystemGlobalCacheRepositoryImpl.java @@ -0,0 +1,623 @@ +package com.iqudoo.platform.application.domain.repository; + +import com.iqudoo.framework.tape.modules.utils.SnowflakeUtil; +import com.iqudoo.platform.application.database.mapper.SystemGlobalCacheMapper; +import com.iqudoo.platform.application.database.model.SystemGlobalCache; +import com.iqudoo.platform.application.database.model.SystemGlobalCacheExample; +import com.iqudoo.platform.application.domain.changeLog.ChangeLogContext; +import com.iqudoo.platform.application.facade.repository.ISystemGlobalCacheRepository; +import java.util.*; +import javax.annotation.Resource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Repository; + +@SuppressWarnings("DuplicatedCode") +@Repository +public class SystemGlobalCacheRepositoryImpl implements ISystemGlobalCacheRepository { + private static final Logger LOGGER = LoggerFactory.getLogger(SystemGlobalCacheRepositoryImpl.class); + + @Resource + private SystemGlobalCacheMapper systemGlobalCacheMapper; + + @Override + public SystemGlobalCache findAnyById(long guid) throws Throwable { + SystemGlobalCache aDo = null; + SystemGlobalCacheExample example + = new SystemGlobalCacheExample(); + example.createCriteria() + .andIsDeleteEqualTo(0) + .andGuidEqualTo(guid); + List recordList + = systemGlobalCacheMapper.selectByExampleWithBLOBs(example); + if (recordList != null && !recordList.isEmpty()) { + aDo = recordList.get(0); + } + return aDo; + } + + @Override + public SystemGlobalCache findValidById(long guid) throws Throwable { + SystemGlobalCache aDo = null; + SystemGlobalCacheExample example + = new SystemGlobalCacheExample(); + example.createCriteria() + .andIsHiddenEqualTo(0) + .andIsDeleteEqualTo(0) + .andGuidEqualTo(guid); + List recordList + = systemGlobalCacheMapper.selectByExampleWithBLOBs(example); + if (recordList != null && !recordList.isEmpty()) { + aDo = recordList.get(0); + } + return aDo; + } + + @Override + public SystemGlobalCache findTrashById(long guid) throws Throwable { + SystemGlobalCache aDo = null; + SystemGlobalCacheExample example + = new SystemGlobalCacheExample(); + example.createCriteria() + .andIsHiddenEqualTo(1) + .andIsDeleteEqualTo(0) + .andGuidEqualTo(guid); + List recordList + = systemGlobalCacheMapper.selectByExampleWithBLOBs(example); + if (recordList != null && !recordList.isEmpty()) { + aDo = recordList.get(0); + } + return aDo; + } + + @Override + public SystemGlobalCache insert(SystemGlobalCache record) throws Throwable { + SystemGlobalCache aDo = new SystemGlobalCache(); + if (record.getGuid() != null) { + aDo.setGuid(record.getGuid()); + } else { + Long guid = SnowflakeUtil.nextId(); + aDo.setGuid(guid); + } + aDo.setCacheTime(record.getCacheTime()); + aDo.setExpireTime(record.getExpireTime()); + aDo.setCacheKey(record.getCacheKey()); + aDo.setCacheData(record.getCacheData()); + aDo.setIsDelete(0); + aDo.setIsHidden(0); + aDo.setDeleteToken("VALID"); + aDo.setDataVersion(1); + aDo.setCreateTime(new Date()); + aDo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int count = systemGlobalCacheMapper.insert(aDo); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] insert SystemGlobalCache long time" + + "\n\t|-> table name: t_system_global_cache" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (count > 0) { + ChangeLogContext.addLog("t_system_global_cache", + "insert", aDo.getGuid(), new HashMap<>()); + return aDo; + } + throw new Throwable("Insert failed, SystemGlobalCache: " + aDo); + } + + @Override + public List batchInsert(List records) throws Throwable { + if (records == null || records.isEmpty()) { + return new ArrayList<>(); + } + List batch = new ArrayList<>(); + for (SystemGlobalCache record : records) { + SystemGlobalCache aDo = new SystemGlobalCache(); + if (record.getGuid() != null) { + aDo.setGuid(record.getGuid()); + } else { + Long guid = SnowflakeUtil.nextId(); + aDo.setGuid(guid); + } + aDo.setCacheTime(record.getCacheTime()); + aDo.setExpireTime(record.getExpireTime()); + aDo.setCacheKey(record.getCacheKey()); + aDo.setCacheData(record.getCacheData()); + aDo.setIsDelete(0); + aDo.setIsHidden(0); + aDo.setDeleteToken("VALID"); + aDo.setDataVersion(1); + aDo.setCreateTime(new Date()); + aDo.setUpdateTime(new Date()); + batch.add(aDo); + } + long startTime = new Date().getTime(); + int count = systemGlobalCacheMapper.batchInsert(batch); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] batch insert SystemGlobalCache long time" + + "\n\t|-> table name: t_system_global_cache" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (count == batch.size()) { + for (SystemGlobalCache aDo : batch) { + ChangeLogContext.addLog("t_system_global_cache", + "batchInsert", aDo.getGuid(), new HashMap<>()); + } + return batch; + } + throw new Throwable("Batch insert failed, SystemGlobalCache affected: " + count + ", expected: " + batch.size()); + } + + @Override + public int update(SystemGlobalCache record) throws Throwable { + SystemGlobalCache aDo + = systemGlobalCacheMapper.selectByPrimaryKey(record.getGuid()); + if (aDo == null || aDo.getIsDelete() == 1) { + throw new Throwable("Record not found, SystemGlobalCache GUID:" + record.getGuid()); + } + Map changeDiff = new HashMap<>(); + if (record.getCacheTime() != null) { + if (!Objects.equals(record.getCacheTime(), aDo.getCacheTime())) { + changeDiff.put("cacheTime", new Object[]{aDo.getCacheTime(), record.getCacheTime()}); + } + aDo.setCacheTime(record.getCacheTime()); + } + if (record.getExpireTime() != null) { + if (!Objects.equals(record.getExpireTime(), aDo.getExpireTime())) { + changeDiff.put("expireTime", new Object[]{aDo.getExpireTime(), record.getExpireTime()}); + } + aDo.setExpireTime(record.getExpireTime()); + } + if (record.getCacheKey() != null) { + if (!Objects.equals(record.getCacheKey(), aDo.getCacheKey())) { + changeDiff.put("cacheKey", new Object[]{aDo.getCacheKey(), record.getCacheKey()}); + } + aDo.setCacheKey(record.getCacheKey()); + } + if (record.getCacheData() != null) { + if (!Objects.equals(record.getCacheData(), aDo.getCacheData())) { + changeDiff.put("cacheData", new Object[]{aDo.getCacheData(), record.getCacheData()}); + } + aDo.setCacheData(record.getCacheData()); + } + SystemGlobalCacheExample updateWhere = new SystemGlobalCacheExample(); + updateWhere.createCriteria() + .andGuidEqualTo(aDo.getGuid()); + aDo.setDataVersion(aDo.getDataVersion() + 1); + aDo.setUpdateTime(new Date()); + // update data version + record.setDataVersion(aDo.getDataVersion()); + record.setUpdateTime(aDo.getUpdateTime()); + long startTime = new Date().getTime(); + int update = systemGlobalCacheMapper.updateByExampleWithBLOBs(aDo, updateWhere); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] update SystemGlobalCache long time" + + "\n\t|-> table name: t_system_global_cache" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0 && !changeDiff.isEmpty()) { + ChangeLogContext.addLog("t_system_global_cache", + "update", aDo.getGuid(), changeDiff); + } + return update; + } + + @Override + public int updateByExampleSelective(SystemGlobalCache record, SystemGlobalCacheExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemGlobalCacheExample.Criteria criteria : example.getOredCriteria()) { + criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(0); + } + List guidList = systemGlobalCacheMapper + .selectPrimaryKeyByExample(example); + if (guidList.isEmpty()) { + return 0; + } + example = new SystemGlobalCacheExample(); + example.createCriteria().andGuidIn(guidList); + List recordList + = systemGlobalCacheMapper.selectByExampleWithBLOBs(example); + Map> diffGroup = new HashMap<>(); + for (SystemGlobalCache aDo : recordList) { + Map changeDiff = new HashMap<>(); + if (record.getCacheTime() != null && !Objects.equals(record.getCacheTime(), aDo.getCacheTime())) { + changeDiff.put("cacheTime", new Object[]{aDo.getCacheTime(), record.getCacheTime()}); + } + if (record.getExpireTime() != null && !Objects.equals(record.getExpireTime(), aDo.getExpireTime())) { + changeDiff.put("expireTime", new Object[]{aDo.getExpireTime(), record.getExpireTime()}); + } + if (record.getCacheKey() != null && !Objects.equals(record.getCacheKey(), aDo.getCacheKey())) { + changeDiff.put("cacheKey", new Object[]{aDo.getCacheKey(), record.getCacheKey()}); + } + if (record.getCacheData() != null && !Objects.equals(record.getCacheData(), aDo.getCacheData())) { + changeDiff.put("cacheData", new Object[]{aDo.getCacheData(), record.getCacheData()}); + } + diffGroup.put(aDo.getGuid(), changeDiff); + } + // It is not supported to directly modify the following columns + record.setUpdateTime(new Date()); + record.setIsHidden(null); + record.setIsDelete(null); + record.setDeleteToken(null); + record.setCreateTime(null); + record.setGuid(null); + long startTime = new Date().getTime(); + int update = systemGlobalCacheMapper.updateByExampleSelective(record, example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + String exampleString = ""; + if (example.getWhereString() != null) { + exampleString += "\n\t|-> where: " + example.getWhereString(); + } + LOGGER.error("[SQL] updateByExampleSelective SystemGlobalCache long time" + + "\n\t|-> table name: t_system_global_cache" + + "\n\t|-> use time: " + useTime + "ms" + + exampleString + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + for (Map.Entry> diffEntry : diffGroup.entrySet()) { + if (diffEntry.getValue() != null && !diffEntry.getValue().isEmpty()) { + ChangeLogContext.addLog("t_system_global_cache", + "updateByExampleSelective", diffEntry.getKey(), diffEntry.getValue()); + } + } + } + return update; + } + + @Override + public int deleteById(long id, boolean release) throws Throwable { + SystemGlobalCache aDo = findAnyById(id); + if (aDo == null) { + return 0; + } + if (release) { + return systemGlobalCacheMapper.deleteByPrimaryKey(aDo.getGuid()); + } + SystemGlobalCacheExample updateWhere + = new SystemGlobalCacheExample(); + updateWhere.createCriteria() + .andGuidEqualTo(aDo.getGuid()); + aDo.setDataVersion(aDo.getDataVersion() + 1); + aDo.setIsDelete(1); + aDo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemGlobalCacheMapper.updateByExampleSelective(aDo, updateWhere); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] deleteById SystemGlobalCache long time" + + "\n\t|-> table name: t_system_global_cache" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + ChangeLogContext.addLog("t_system_global_cache", + "deleteById", aDo.getGuid(), new HashMap<>()); + } + return update; + } + + @Override + public int deleteAll(SystemGlobalCacheExample example, boolean release) throws Throwable { + if (release) { + return systemGlobalCacheMapper.deleteByExample(example); + } + // clone new example + example = example.cloneExample(); + for (SystemGlobalCacheExample.Criteria criteria : example.getOredCriteria()) { + criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(1); + } + List guidList = systemGlobalCacheMapper.selectPrimaryKeyByExample(example); + if (guidList.isEmpty()) { + return 0; + } + example = new SystemGlobalCacheExample(); + example.createCriteria().andGuidIn(guidList); + SystemGlobalCache systemGlobalCache = new SystemGlobalCache(); + systemGlobalCache.setIsDelete(1); + systemGlobalCache.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemGlobalCacheMapper.updateByExampleSelective(systemGlobalCache, example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] deleteAll SystemGlobalCache long time" + + "\n\t|-> table name: t_system_global_cache" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + for (Long guid : guidList) { + ChangeLogContext.addLog("t_system_global_cache", + "deleteAll", guid, new HashMap<>()); + } + } + return update; + } + + @Override + public int trashById(long id) throws Throwable { + SystemGlobalCache aDo = findAnyById(id); + if (aDo == null) { + return 0; + } + if (aDo.getIsHidden() == 1) { + return 0; + } + SystemGlobalCacheExample updateWhere + = new SystemGlobalCacheExample(); + updateWhere.createCriteria() + .andGuidEqualTo(aDo.getGuid()); + aDo.setDataVersion(aDo.getDataVersion() + 1); + aDo.setIsHidden(1); + aDo.setDeleteToken(aDo.getGuid() + ""); + aDo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemGlobalCacheMapper.updateByExampleSelective(aDo, updateWhere); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] trashById SystemGlobalCache long time" + + "\n\t|-> table name: t_system_global_cache" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + ChangeLogContext.addLog("t_system_global_cache", + "trashById", aDo.getGuid(), new HashMap<>()); + } + return update; + } + + @Override + public int trashAll(SystemGlobalCacheExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemGlobalCacheExample.Criteria criteria : example.getOredCriteria()) { + criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(0); + } + List guidList = systemGlobalCacheMapper.selectPrimaryKeyByExample(example); + if (guidList.isEmpty()) { + return 0; + } + example = new SystemGlobalCacheExample(); + example.createCriteria().andGuidIn(guidList); + SystemGlobalCache systemGlobalCache = new SystemGlobalCache(); + systemGlobalCache.setIsHidden(1); + systemGlobalCache.setDeleteToken(SnowflakeUtil.nextId() + ""); + systemGlobalCache.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemGlobalCacheMapper.updateByExampleSelective(systemGlobalCache, example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] trashAll SystemGlobalCache long time" + + "\n\t|-> table name: t_system_global_cache" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + for (Long guid : guidList) { + ChangeLogContext.addLog("t_system_global_cache", + "trashAll", guid, new HashMap<>()); + } + } + return update; + } + + @Override + public int recoverById(long id) throws Throwable { + SystemGlobalCache aDo = findAnyById(id); + if (aDo == null) { + return 0; + } + if (aDo.getIsHidden() == 0) { + return 0; + } + SystemGlobalCacheExample updateWhere + = new SystemGlobalCacheExample(); + updateWhere.createCriteria() + .andGuidEqualTo(aDo.getGuid()); + aDo.setDataVersion(aDo.getDataVersion() + 1); + aDo.setIsHidden(0); + aDo.setDeleteToken("VALID"); + aDo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemGlobalCacheMapper.updateByExampleSelective(aDo, updateWhere); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] recoverById SystemGlobalCache long time" + + "\n\t|-> table name: t_system_global_cache" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + ChangeLogContext.addLog("t_system_global_cache", + "recoverById", aDo.getGuid(), new HashMap<>()); + } + return update; + } + + @Override + public int recoverAll(SystemGlobalCacheExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemGlobalCacheExample.Criteria criteria : example.getOredCriteria()) { + criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(1); + } + List guidList = systemGlobalCacheMapper.selectPrimaryKeyByExample(example); + if (guidList.isEmpty()) { + return 0; + } + example = new SystemGlobalCacheExample(); + example.createCriteria().andGuidIn(guidList); + SystemGlobalCache systemGlobalCache = new SystemGlobalCache(); + systemGlobalCache.setIsHidden(0); + systemGlobalCache.setDeleteToken("VALID"); + systemGlobalCache.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemGlobalCacheMapper.updateByExampleSelective(systemGlobalCache, example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] recoverAll SystemGlobalCache long time" + + "\n\t|-> table name: t_system_global_cache" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + for (Long guid : guidList) { + ChangeLogContext.addLog("t_system_global_cache", + "recoverAll", guid, new HashMap<>()); + } + } + return update; + } + + @Override + public SystemGlobalCache findOne(SystemGlobalCacheExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + example.usePage(1, 1); + List dataList = getList(example); + if (dataList != null && !dataList.isEmpty()) { + return dataList.get(0); + } + return null; + } + + @Override + public List getList(SystemGlobalCacheExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemGlobalCacheExample.Criteria criteria : example.getOredCriteria()) { + if (example.isResultTrash()) { + criteria.andIsHiddenEqualTo(1) + .andIsDeleteEqualTo(0); + } else if (example.isResultValid()) { + criteria.andIsHiddenEqualTo(0) + .andIsDeleteEqualTo(0); + } else { + criteria.andIsDeleteEqualTo(0); + } + } + List result = null; + long startTime = new Date().getTime(); + if (example.getRows() != null && example.getOffset() != null) { + List primaryKeyList = systemGlobalCacheMapper.selectPrimaryKeyByExample(example); + if (primaryKeyList == null || primaryKeyList.isEmpty()) { + return new ArrayList<>(); + } + long findPrimaryKeyTime = new Date().getTime() - startTime; + if (findPrimaryKeyTime > 300) { + String exampleString = ""; + if (example.getWhereString() != null) { + exampleString += "\n\t|-> where: " + example.getWhereString(); + } + if (example.getOrderByClause() != null) { + exampleString += "\n\t|-> order by: " + example.getOrderByClause(); + } + if (example.getLimitString() != null) { + exampleString += "\n\t|-> limit: " + example.getLimitString(); + } + LOGGER.error("[SQL] select SystemGlobalCache list primary key long time" + + "\n\t|-> table name: t_system_global_cache" + + "\n\t|-> use time: " + findPrimaryKeyTime + "ms" + + exampleString + + "\n\t|-----------------------------------" + ); + } + // reset start time + startTime = new Date().getTime(); + String oldOrderByClause = example.getOrderByClause(); + Boolean withBLOBsFlag = example.isWithBLOBs(); + example = new SystemGlobalCacheExample(); + example.createCriteria().andGuidIn(primaryKeyList); + example.setOrderByClause(oldOrderByClause); + example.setWithBLOBs(withBLOBsFlag); + } + if (example.isWithBLOBs()) { + result = systemGlobalCacheMapper.selectByExampleWithBLOBs(example); + } else { + result = systemGlobalCacheMapper.selectByExample(example); + } + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + String exampleString = ""; + if (example.getWhereString() != null) { + exampleString += "\n\t|-> where: " + example.getWhereString(); + } + if (example.getOrderByClause() != null) { + exampleString += "\n\t|-> order by: " + example.getOrderByClause(); + } + if (example.getLimitString() != null) { + exampleString += "\n\t|-> limit: " + example.getLimitString(); + } + LOGGER.error("[SQL] select SystemGlobalCache list long time" + + "\n\t|-> table name: t_system_global_cache" + + "\n\t|-> use time: " + useTime + "ms" + + exampleString + + "\n\t|-----------------------------------" + ); + } + return result; + } + + @Override + public long count(SystemGlobalCacheExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemGlobalCacheExample.Criteria criteria : example.getOredCriteria()) { + if (example.isResultTrash()) { + criteria.andIsHiddenEqualTo(1) + .andIsDeleteEqualTo(0); + } else if (example.isResultValid()) { + criteria.andIsHiddenEqualTo(0) + .andIsDeleteEqualTo(0); + } else { + criteria.andIsDeleteEqualTo(0); + } + } + long startTime = new Date().getTime(); + long count = systemGlobalCacheMapper.countByExample(example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + String exampleString = ""; + if (example.getWhereString() != null) { + exampleString += "\n\t|-> where: " + example.getWhereString(); + } + if (example.getOrderByClause() != null) { + exampleString += "\n\t|-> order by: " + example.getOrderByClause(); + } + LOGGER.error("[SQL] select SystemGlobalCache count long time" + + "\n\t|-> table name: t_system_global_cache" + + "\n\t|-> use time: " + useTime + "ms" + + exampleString + + "\n\t|-----------------------------------" + ); + } + return count; + } + + @Override + public long countWithPage(SystemGlobalCacheExample example) throws Throwable { + // When not paginated, the count query returns 0 to avoid unnecessary queries + if (example.getRows() != null && example.getOffset() != null) { + return count(example); + } + return 0L; + } +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/domain/repository/SystemGlobalFileTransferRepositoryImpl.java b/src/main/java/com/iqudoo/platform/application/domain/repository/SystemGlobalFileTransferRepositoryImpl.java new file mode 100644 index 0000000..a21d6f2 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/repository/SystemGlobalFileTransferRepositoryImpl.java @@ -0,0 +1,605 @@ +package com.iqudoo.platform.application.domain.repository; + +import com.iqudoo.framework.tape.modules.utils.SnowflakeUtil; +import com.iqudoo.platform.application.database.mapper.SystemGlobalFileTransferMapper; +import com.iqudoo.platform.application.database.model.SystemGlobalFileTransfer; +import com.iqudoo.platform.application.database.model.SystemGlobalFileTransferExample; +import com.iqudoo.platform.application.domain.changeLog.ChangeLogContext; +import com.iqudoo.platform.application.facade.repository.ISystemGlobalFileTransferRepository; +import java.util.*; +import javax.annotation.Resource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Repository; + +@SuppressWarnings("DuplicatedCode") +@Repository +public class SystemGlobalFileTransferRepositoryImpl implements ISystemGlobalFileTransferRepository { + private static final Logger LOGGER = LoggerFactory.getLogger(SystemGlobalFileTransferRepositoryImpl.class); + + @Resource + private SystemGlobalFileTransferMapper systemGlobalFileTransferMapper; + + @Override + public SystemGlobalFileTransfer findAnyById(long guid) throws Throwable { + SystemGlobalFileTransfer aDo = null; + SystemGlobalFileTransferExample example + = new SystemGlobalFileTransferExample(); + example.createCriteria() + .andIsDeleteEqualTo(0) + .andGuidEqualTo(guid); + List recordList + = systemGlobalFileTransferMapper.selectByExample(example); + if (recordList != null && !recordList.isEmpty()) { + aDo = recordList.get(0); + } + return aDo; + } + + @Override + public SystemGlobalFileTransfer findValidById(long guid) throws Throwable { + SystemGlobalFileTransfer aDo = null; + SystemGlobalFileTransferExample example + = new SystemGlobalFileTransferExample(); + example.createCriteria() + .andIsHiddenEqualTo(0) + .andIsDeleteEqualTo(0) + .andGuidEqualTo(guid); + List recordList + = systemGlobalFileTransferMapper.selectByExample(example); + if (recordList != null && !recordList.isEmpty()) { + aDo = recordList.get(0); + } + return aDo; + } + + @Override + public SystemGlobalFileTransfer findTrashById(long guid) throws Throwable { + SystemGlobalFileTransfer aDo = null; + SystemGlobalFileTransferExample example + = new SystemGlobalFileTransferExample(); + example.createCriteria() + .andIsHiddenEqualTo(1) + .andIsDeleteEqualTo(0) + .andGuidEqualTo(guid); + List recordList + = systemGlobalFileTransferMapper.selectByExample(example); + if (recordList != null && !recordList.isEmpty()) { + aDo = recordList.get(0); + } + return aDo; + } + + @Override + public SystemGlobalFileTransfer insert(SystemGlobalFileTransfer record) throws Throwable { + SystemGlobalFileTransfer aDo = new SystemGlobalFileTransfer(); + if (record.getGuid() != null) { + aDo.setGuid(record.getGuid()); + } else { + Long guid = SnowflakeUtil.nextId(); + aDo.setGuid(guid); + } + aDo.setOriginalUrl(record.getOriginalUrl()); + aDo.setSavedUrl(record.getSavedUrl()); + aDo.setFileSize(record.getFileSize()); + aDo.setFileHash(record.getFileHash()); + aDo.setIsDelete(0); + aDo.setIsHidden(0); + aDo.setDeleteToken("VALID"); + aDo.setDataVersion(1); + aDo.setCreateTime(new Date()); + aDo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int count = systemGlobalFileTransferMapper.insert(aDo); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] insert SystemGlobalFileTransfer long time" + + "\n\t|-> table name: t_system_global_file_transfer" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (count > 0) { + ChangeLogContext.addLog("t_system_global_file_transfer", + "insert", aDo.getGuid(), new HashMap<>()); + return aDo; + } + throw new Throwable("Insert failed, SystemGlobalFileTransfer: " + aDo); + } + + @Override + public List batchInsert(List records) throws Throwable { + if (records == null || records.isEmpty()) { + return new ArrayList<>(); + } + List batch = new ArrayList<>(); + for (SystemGlobalFileTransfer record : records) { + SystemGlobalFileTransfer aDo = new SystemGlobalFileTransfer(); + if (record.getGuid() != null) { + aDo.setGuid(record.getGuid()); + } else { + Long guid = SnowflakeUtil.nextId(); + aDo.setGuid(guid); + } + aDo.setOriginalUrl(record.getOriginalUrl()); + aDo.setSavedUrl(record.getSavedUrl()); + aDo.setFileSize(record.getFileSize()); + aDo.setFileHash(record.getFileHash()); + aDo.setIsDelete(0); + aDo.setIsHidden(0); + aDo.setDeleteToken("VALID"); + aDo.setDataVersion(1); + aDo.setCreateTime(new Date()); + aDo.setUpdateTime(new Date()); + batch.add(aDo); + } + long startTime = new Date().getTime(); + int count = systemGlobalFileTransferMapper.batchInsert(batch); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] batch insert SystemGlobalFileTransfer long time" + + "\n\t|-> table name: t_system_global_file_transfer" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (count == batch.size()) { + for (SystemGlobalFileTransfer aDo : batch) { + ChangeLogContext.addLog("t_system_global_file_transfer", + "batchInsert", aDo.getGuid(), new HashMap<>()); + } + return batch; + } + throw new Throwable("Batch insert failed, SystemGlobalFileTransfer affected: " + count + ", expected: " + batch.size()); + } + + @Override + public int update(SystemGlobalFileTransfer record) throws Throwable { + SystemGlobalFileTransfer aDo + = systemGlobalFileTransferMapper.selectByPrimaryKey(record.getGuid()); + if (aDo == null || aDo.getIsDelete() == 1) { + throw new Throwable("Record not found, SystemGlobalFileTransfer GUID:" + record.getGuid()); + } + Map changeDiff = new HashMap<>(); + if (record.getOriginalUrl() != null) { + if (!Objects.equals(record.getOriginalUrl(), aDo.getOriginalUrl())) { + changeDiff.put("originalUrl", new Object[]{aDo.getOriginalUrl(), record.getOriginalUrl()}); + } + aDo.setOriginalUrl(record.getOriginalUrl()); + } + if (record.getSavedUrl() != null) { + if (!Objects.equals(record.getSavedUrl(), aDo.getSavedUrl())) { + changeDiff.put("savedUrl", new Object[]{aDo.getSavedUrl(), record.getSavedUrl()}); + } + aDo.setSavedUrl(record.getSavedUrl()); + } + if (record.getFileSize() != null) { + if (!Objects.equals(record.getFileSize(), aDo.getFileSize())) { + changeDiff.put("fileSize", new Object[]{aDo.getFileSize(), record.getFileSize()}); + } + aDo.setFileSize(record.getFileSize()); + } + if (record.getFileHash() != null) { + if (!Objects.equals(record.getFileHash(), aDo.getFileHash())) { + changeDiff.put("fileHash", new Object[]{aDo.getFileHash(), record.getFileHash()}); + } + aDo.setFileHash(record.getFileHash()); + } + SystemGlobalFileTransferExample updateWhere = new SystemGlobalFileTransferExample(); + Integer lockDataVersion = record.getDataVersion(); + if (lockDataVersion == null) { + lockDataVersion = aDo.getDataVersion(); + } + updateWhere.createCriteria() + .andGuidEqualTo(aDo.getGuid()) + .andDataVersionEqualTo(lockDataVersion); + aDo.setDataVersion(aDo.getDataVersion() + 1); + aDo.setUpdateTime(new Date()); + // update data version + record.setDataVersion(aDo.getDataVersion()); + record.setUpdateTime(aDo.getUpdateTime()); + long startTime = new Date().getTime(); + int update = systemGlobalFileTransferMapper.updateByExample(aDo, updateWhere); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] update SystemGlobalFileTransfer long time" + + "\n\t|-> table name: t_system_global_file_transfer" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0 && !changeDiff.isEmpty()) { + ChangeLogContext.addLog("t_system_global_file_transfer", + "update", aDo.getGuid(), changeDiff); + } + return update; + } + + @Override + public int updateByExampleSelective(SystemGlobalFileTransfer record, SystemGlobalFileTransferExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemGlobalFileTransferExample.Criteria criteria : example.getOredCriteria()) { + criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(0); + } + List guidList = systemGlobalFileTransferMapper + .selectPrimaryKeyByExample(example); + if (guidList.isEmpty()) { + return 0; + } + example = new SystemGlobalFileTransferExample(); + example.createCriteria().andGuidIn(guidList); + List recordList + = systemGlobalFileTransferMapper.selectByExample(example); + Map> diffGroup = new HashMap<>(); + for (SystemGlobalFileTransfer aDo : recordList) { + Map changeDiff = new HashMap<>(); + if (record.getOriginalUrl() != null && !Objects.equals(record.getOriginalUrl(), aDo.getOriginalUrl())) { + changeDiff.put("originalUrl", new Object[]{aDo.getOriginalUrl(), record.getOriginalUrl()}); + } + if (record.getSavedUrl() != null && !Objects.equals(record.getSavedUrl(), aDo.getSavedUrl())) { + changeDiff.put("savedUrl", new Object[]{aDo.getSavedUrl(), record.getSavedUrl()}); + } + if (record.getFileSize() != null && !Objects.equals(record.getFileSize(), aDo.getFileSize())) { + changeDiff.put("fileSize", new Object[]{aDo.getFileSize(), record.getFileSize()}); + } + if (record.getFileHash() != null && !Objects.equals(record.getFileHash(), aDo.getFileHash())) { + changeDiff.put("fileHash", new Object[]{aDo.getFileHash(), record.getFileHash()}); + } + diffGroup.put(aDo.getGuid(), changeDiff); + } + // reset data version, with optimistic locking + record.setDataVersion((int) (new Date().getTime() % 1000)); + // It is not supported to directly modify the following columns + record.setUpdateTime(new Date()); + record.setIsHidden(null); + record.setIsDelete(null); + record.setDeleteToken(null); + record.setCreateTime(null); + record.setGuid(null); + long startTime = new Date().getTime(); + int update = systemGlobalFileTransferMapper.updateByExampleSelective(record, example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + String exampleString = ""; + if (example.getWhereString() != null) { + exampleString += "\n\t|-> where: " + example.getWhereString(); + } + LOGGER.error("[SQL] updateByExampleSelective SystemGlobalFileTransfer long time" + + "\n\t|-> table name: t_system_global_file_transfer" + + "\n\t|-> use time: " + useTime + "ms" + + exampleString + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + for (Map.Entry> diffEntry : diffGroup.entrySet()) { + if (diffEntry.getValue() != null && !diffEntry.getValue().isEmpty()) { + ChangeLogContext.addLog("t_system_global_file_transfer", + "updateByExampleSelective", diffEntry.getKey(), diffEntry.getValue()); + } + } + } + return update; + } + + @Override + public int deleteById(long id, boolean release) throws Throwable { + SystemGlobalFileTransfer aDo = findAnyById(id); + if (aDo == null) { + return 0; + } + if (release) { + return systemGlobalFileTransferMapper.deleteByPrimaryKey(aDo.getGuid()); + } + SystemGlobalFileTransferExample updateWhere + = new SystemGlobalFileTransferExample(); + Integer lockDataVersion = aDo.getDataVersion(); + updateWhere.createCriteria() + .andGuidEqualTo(aDo.getGuid()) + .andDataVersionEqualTo(lockDataVersion); + aDo.setDataVersion(aDo.getDataVersion() + 1); + aDo.setIsDelete(1); + aDo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemGlobalFileTransferMapper.updateByExampleSelective(aDo, updateWhere); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] deleteById SystemGlobalFileTransfer long time" + + "\n\t|-> table name: t_system_global_file_transfer" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + ChangeLogContext.addLog("t_system_global_file_transfer", + "deleteById", aDo.getGuid(), new HashMap<>()); + } + return update; + } + + @Override + public int deleteAll(SystemGlobalFileTransferExample example, boolean release) throws Throwable { + if (release) { + return systemGlobalFileTransferMapper.deleteByExample(example); + } + // clone new example + example = example.cloneExample(); + for (SystemGlobalFileTransferExample.Criteria criteria : example.getOredCriteria()) { + criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(1); + } + List guidList = systemGlobalFileTransferMapper.selectPrimaryKeyByExample(example); + if (guidList.isEmpty()) { + return 0; + } + example = new SystemGlobalFileTransferExample(); + example.createCriteria().andGuidIn(guidList); + SystemGlobalFileTransfer systemGlobalFileTransfer = new SystemGlobalFileTransfer(); + // reset data version, with optimistic locking + systemGlobalFileTransfer.setDataVersion((int) (new Date().getTime() % 1000)); + systemGlobalFileTransfer.setIsDelete(1); + systemGlobalFileTransfer.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemGlobalFileTransferMapper.updateByExampleSelective(systemGlobalFileTransfer, example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] deleteAll SystemGlobalFileTransfer long time" + + "\n\t|-> table name: t_system_global_file_transfer" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + for (Long guid : guidList) { + ChangeLogContext.addLog("t_system_global_file_transfer", + "deleteAll", guid, new HashMap<>()); + } + } + return update; + } + + @Override + public int trashById(long id) throws Throwable { + SystemGlobalFileTransfer aDo = findAnyById(id); + if (aDo == null) { + return 0; + } + if (aDo.getIsHidden() == 1) { + return 0; + } + SystemGlobalFileTransferExample updateWhere + = new SystemGlobalFileTransferExample(); + Integer lockDataVersion = aDo.getDataVersion(); + updateWhere.createCriteria() + .andGuidEqualTo(aDo.getGuid()) + .andDataVersionEqualTo(lockDataVersion); + aDo.setDataVersion(aDo.getDataVersion() + 1); + aDo.setIsHidden(1); + aDo.setDeleteToken(aDo.getGuid() + ""); + aDo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemGlobalFileTransferMapper.updateByExampleSelective(aDo, updateWhere); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] trashById SystemGlobalFileTransfer long time" + + "\n\t|-> table name: t_system_global_file_transfer" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + ChangeLogContext.addLog("t_system_global_file_transfer", + "trashById", aDo.getGuid(), new HashMap<>()); + } + return update; + } + + @Override + public int trashAll(SystemGlobalFileTransferExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemGlobalFileTransferExample.Criteria criteria : example.getOredCriteria()) { + criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(0); + } + List guidList = systemGlobalFileTransferMapper.selectPrimaryKeyByExample(example); + if (guidList.isEmpty()) { + return 0; + } + example = new SystemGlobalFileTransferExample(); + example.createCriteria().andGuidIn(guidList); + SystemGlobalFileTransfer systemGlobalFileTransfer = new SystemGlobalFileTransfer(); + // reset data version, with optimistic locking + systemGlobalFileTransfer.setDataVersion((int) (new Date().getTime() % 1000)); + systemGlobalFileTransfer.setIsHidden(1); + systemGlobalFileTransfer.setDeleteToken(SnowflakeUtil.nextId() + ""); + systemGlobalFileTransfer.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemGlobalFileTransferMapper.updateByExampleSelective(systemGlobalFileTransfer, example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] trashAll SystemGlobalFileTransfer long time" + + "\n\t|-> table name: t_system_global_file_transfer" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + for (Long guid : guidList) { + ChangeLogContext.addLog("t_system_global_file_transfer", + "trashAll", guid, new HashMap<>()); + } + } + return update; + } + + @Override + public int recoverById(long id) throws Throwable { + SystemGlobalFileTransfer aDo = findAnyById(id); + if (aDo == null) { + return 0; + } + if (aDo.getIsHidden() == 0) { + return 0; + } + SystemGlobalFileTransferExample updateWhere + = new SystemGlobalFileTransferExample(); + Integer lockDataVersion = aDo.getDataVersion(); + updateWhere.createCriteria() + .andGuidEqualTo(aDo.getGuid()) + .andDataVersionEqualTo(lockDataVersion); + aDo.setDataVersion(aDo.getDataVersion() + 1); + aDo.setIsHidden(0); + aDo.setDeleteToken("VALID"); + aDo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemGlobalFileTransferMapper.updateByExampleSelective(aDo, updateWhere); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] recoverById SystemGlobalFileTransfer long time" + + "\n\t|-> table name: t_system_global_file_transfer" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + ChangeLogContext.addLog("t_system_global_file_transfer", + "recoverById", aDo.getGuid(), new HashMap<>()); + } + return update; + } + + @Override + public int recoverAll(SystemGlobalFileTransferExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemGlobalFileTransferExample.Criteria criteria : example.getOredCriteria()) { + criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(1); + } + List guidList = systemGlobalFileTransferMapper.selectPrimaryKeyByExample(example); + if (guidList.isEmpty()) { + return 0; + } + example = new SystemGlobalFileTransferExample(); + example.createCriteria().andGuidIn(guidList); + SystemGlobalFileTransfer systemGlobalFileTransfer = new SystemGlobalFileTransfer(); + // reset data version, with optimistic locking + systemGlobalFileTransfer.setDataVersion((int) (new Date().getTime() % 1000)); + systemGlobalFileTransfer.setIsHidden(0); + systemGlobalFileTransfer.setDeleteToken("VALID"); + systemGlobalFileTransfer.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemGlobalFileTransferMapper.updateByExampleSelective(systemGlobalFileTransfer, example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] recoverAll SystemGlobalFileTransfer long time" + + "\n\t|-> table name: t_system_global_file_transfer" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + for (Long guid : guidList) { + ChangeLogContext.addLog("t_system_global_file_transfer", + "recoverAll", guid, new HashMap<>()); + } + } + return update; + } + + @Override + public SystemGlobalFileTransfer findOne(SystemGlobalFileTransferExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + example.usePage(1, 1); + List dataList = getList(example); + if (dataList != null && !dataList.isEmpty()) { + return dataList.get(0); + } + return null; + } + + @Override + public List getList(SystemGlobalFileTransferExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemGlobalFileTransferExample.Criteria criteria : example.getOredCriteria()) { + if (example.isResultTrash()) { + criteria.andIsHiddenEqualTo(1) + .andIsDeleteEqualTo(0); + } else if (example.isResultValid()) { + criteria.andIsHiddenEqualTo(0) + .andIsDeleteEqualTo(0); + } else { + criteria.andIsDeleteEqualTo(0); + } + } + List result = null; + long startTime = new Date().getTime(); + result = systemGlobalFileTransferMapper.selectByExample(example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + String exampleString = ""; + if (example.getWhereString() != null) { + exampleString += "\n\t|-> where: " + example.getWhereString(); + } + if (example.getOrderByClause() != null) { + exampleString += "\n\t|-> order by: " + example.getOrderByClause(); + } + if (example.getLimitString() != null) { + exampleString += "\n\t|-> limit: " + example.getLimitString(); + } + LOGGER.error("[SQL] select SystemGlobalFileTransfer list long time" + + "\n\t|-> table name: t_system_global_file_transfer" + + "\n\t|-> use time: " + useTime + "ms" + + exampleString + + "\n\t|-----------------------------------" + ); + } + return result; + } + + @Override + public long count(SystemGlobalFileTransferExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemGlobalFileTransferExample.Criteria criteria : example.getOredCriteria()) { + if (example.isResultTrash()) { + criteria.andIsHiddenEqualTo(1) + .andIsDeleteEqualTo(0); + } else if (example.isResultValid()) { + criteria.andIsHiddenEqualTo(0) + .andIsDeleteEqualTo(0); + } else { + criteria.andIsDeleteEqualTo(0); + } + } + long startTime = new Date().getTime(); + long count = systemGlobalFileTransferMapper.countByExample(example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + String exampleString = ""; + if (example.getWhereString() != null) { + exampleString += "\n\t|-> where: " + example.getWhereString(); + } + if (example.getOrderByClause() != null) { + exampleString += "\n\t|-> order by: " + example.getOrderByClause(); + } + LOGGER.error("[SQL] select SystemGlobalFileTransfer count long time" + + "\n\t|-> table name: t_system_global_file_transfer" + + "\n\t|-> use time: " + useTime + "ms" + + exampleString + + "\n\t|-----------------------------------" + ); + } + return count; + } + + @Override + public long countWithPage(SystemGlobalFileTransferExample example) throws Throwable { + // When not paginated, the count query returns 0 to avoid unnecessary queries + if (example.getRows() != null && example.getOffset() != null) { + return count(example); + } + return 0L; + } +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/domain/repository/SystemGlobalSessionRepositoryImpl.java b/src/main/java/com/iqudoo/platform/application/domain/repository/SystemGlobalSessionRepositoryImpl.java new file mode 100644 index 0000000..8a66beb --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/repository/SystemGlobalSessionRepositoryImpl.java @@ -0,0 +1,627 @@ +package com.iqudoo.platform.application.domain.repository; + +import com.iqudoo.framework.tape.modules.utils.SnowflakeUtil; +import com.iqudoo.platform.application.database.mapper.SystemGlobalSessionMapper; +import com.iqudoo.platform.application.database.model.SystemGlobalSession; +import com.iqudoo.platform.application.database.model.SystemGlobalSessionExample; +import com.iqudoo.platform.application.domain.changeLog.ChangeLogContext; +import com.iqudoo.platform.application.facade.repository.ISystemGlobalSessionRepository; +import java.util.*; +import javax.annotation.Resource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Repository; + +@SuppressWarnings("DuplicatedCode") +@Repository +public class SystemGlobalSessionRepositoryImpl implements ISystemGlobalSessionRepository { + private static final Logger LOGGER = LoggerFactory.getLogger(SystemGlobalSessionRepositoryImpl.class); + + @Resource + private SystemGlobalSessionMapper systemGlobalSessionMapper; + + @Override + public SystemGlobalSession findAnyById(long guid) throws Throwable { + SystemGlobalSession aDo = null; + SystemGlobalSessionExample example + = new SystemGlobalSessionExample(); + example.createCriteria() + .andIsDeleteEqualTo(0) + .andGuidEqualTo(guid); + List recordList + = systemGlobalSessionMapper.selectByExample(example); + if (recordList != null && !recordList.isEmpty()) { + aDo = recordList.get(0); + } + return aDo; + } + + @Override + public SystemGlobalSession findValidById(long guid) throws Throwable { + SystemGlobalSession aDo = null; + SystemGlobalSessionExample example + = new SystemGlobalSessionExample(); + example.createCriteria() + .andIsHiddenEqualTo(0) + .andIsDeleteEqualTo(0) + .andGuidEqualTo(guid); + List recordList + = systemGlobalSessionMapper.selectByExample(example); + if (recordList != null && !recordList.isEmpty()) { + aDo = recordList.get(0); + } + return aDo; + } + + @Override + public SystemGlobalSession findTrashById(long guid) throws Throwable { + SystemGlobalSession aDo = null; + SystemGlobalSessionExample example + = new SystemGlobalSessionExample(); + example.createCriteria() + .andIsHiddenEqualTo(1) + .andIsDeleteEqualTo(0) + .andGuidEqualTo(guid); + List recordList + = systemGlobalSessionMapper.selectByExample(example); + if (recordList != null && !recordList.isEmpty()) { + aDo = recordList.get(0); + } + return aDo; + } + + @Override + public SystemGlobalSession insert(SystemGlobalSession record) throws Throwable { + SystemGlobalSession aDo = new SystemGlobalSession(); + if (record.getGuid() != null) { + aDo.setGuid(record.getGuid()); + } else { + Long guid = SnowflakeUtil.nextId(); + aDo.setGuid(guid); + } + aDo.setUserGuid(record.getUserGuid()); + aDo.setUserGroup(record.getUserGroup()); + aDo.setSessionKey(record.getSessionKey()); + aDo.setOriginPlatform(record.getOriginPlatform()); + aDo.setOriginDomain(record.getOriginDomain()); + aDo.setOriginIp(record.getOriginIp()); + aDo.setIsDelete(0); + aDo.setIsHidden(0); + aDo.setDeleteToken("VALID"); + aDo.setDataVersion(1); + aDo.setCreateTime(new Date()); + aDo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int count = systemGlobalSessionMapper.insert(aDo); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] insert SystemGlobalSession long time" + + "\n\t|-> table name: t_system_global_session" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (count > 0) { + ChangeLogContext.addLog("t_system_global_session", + "insert", aDo.getGuid(), new HashMap<>()); + return aDo; + } + throw new Throwable("Insert failed, SystemGlobalSession: " + aDo); + } + + @Override + public List batchInsert(List records) throws Throwable { + if (records == null || records.isEmpty()) { + return new ArrayList<>(); + } + List batch = new ArrayList<>(); + for (SystemGlobalSession record : records) { + SystemGlobalSession aDo = new SystemGlobalSession(); + if (record.getGuid() != null) { + aDo.setGuid(record.getGuid()); + } else { + Long guid = SnowflakeUtil.nextId(); + aDo.setGuid(guid); + } + aDo.setUserGuid(record.getUserGuid()); + aDo.setUserGroup(record.getUserGroup()); + aDo.setSessionKey(record.getSessionKey()); + aDo.setOriginPlatform(record.getOriginPlatform()); + aDo.setOriginDomain(record.getOriginDomain()); + aDo.setOriginIp(record.getOriginIp()); + aDo.setIsDelete(0); + aDo.setIsHidden(0); + aDo.setDeleteToken("VALID"); + aDo.setDataVersion(1); + aDo.setCreateTime(new Date()); + aDo.setUpdateTime(new Date()); + batch.add(aDo); + } + long startTime = new Date().getTime(); + int count = systemGlobalSessionMapper.batchInsert(batch); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] batch insert SystemGlobalSession long time" + + "\n\t|-> table name: t_system_global_session" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (count == batch.size()) { + for (SystemGlobalSession aDo : batch) { + ChangeLogContext.addLog("t_system_global_session", + "batchInsert", aDo.getGuid(), new HashMap<>()); + } + return batch; + } + throw new Throwable("Batch insert failed, SystemGlobalSession affected: " + count + ", expected: " + batch.size()); + } + + @Override + public int update(SystemGlobalSession record) throws Throwable { + SystemGlobalSession aDo + = systemGlobalSessionMapper.selectByPrimaryKey(record.getGuid()); + if (aDo == null || aDo.getIsDelete() == 1) { + throw new Throwable("Record not found, SystemGlobalSession GUID:" + record.getGuid()); + } + Map changeDiff = new HashMap<>(); + if (record.getUserGuid() != null) { + if (!Objects.equals(record.getUserGuid(), aDo.getUserGuid())) { + changeDiff.put("userGuid", new Object[]{aDo.getUserGuid(), record.getUserGuid()}); + } + aDo.setUserGuid(record.getUserGuid()); + } + if (record.getUserGroup() != null) { + if (!Objects.equals(record.getUserGroup(), aDo.getUserGroup())) { + changeDiff.put("userGroup", new Object[]{aDo.getUserGroup(), record.getUserGroup()}); + } + aDo.setUserGroup(record.getUserGroup()); + } + if (record.getSessionKey() != null) { + if (!Objects.equals(record.getSessionKey(), aDo.getSessionKey())) { + changeDiff.put("sessionKey", new Object[]{aDo.getSessionKey(), record.getSessionKey()}); + } + aDo.setSessionKey(record.getSessionKey()); + } + if (record.getOriginPlatform() != null) { + if (!Objects.equals(record.getOriginPlatform(), aDo.getOriginPlatform())) { + changeDiff.put("originPlatform", new Object[]{aDo.getOriginPlatform(), record.getOriginPlatform()}); + } + aDo.setOriginPlatform(record.getOriginPlatform()); + } + if (record.getOriginDomain() != null) { + if (!Objects.equals(record.getOriginDomain(), aDo.getOriginDomain())) { + changeDiff.put("originDomain", new Object[]{aDo.getOriginDomain(), record.getOriginDomain()}); + } + aDo.setOriginDomain(record.getOriginDomain()); + } + if (record.getOriginIp() != null) { + if (!Objects.equals(record.getOriginIp(), aDo.getOriginIp())) { + changeDiff.put("originIp", new Object[]{aDo.getOriginIp(), record.getOriginIp()}); + } + aDo.setOriginIp(record.getOriginIp()); + } + SystemGlobalSessionExample updateWhere = new SystemGlobalSessionExample(); + Integer lockDataVersion = record.getDataVersion(); + if (lockDataVersion == null) { + lockDataVersion = aDo.getDataVersion(); + } + updateWhere.createCriteria() + .andGuidEqualTo(aDo.getGuid()) + .andDataVersionEqualTo(lockDataVersion); + aDo.setDataVersion(aDo.getDataVersion() + 1); + aDo.setUpdateTime(new Date()); + // update data version + record.setDataVersion(aDo.getDataVersion()); + record.setUpdateTime(aDo.getUpdateTime()); + long startTime = new Date().getTime(); + int update = systemGlobalSessionMapper.updateByExample(aDo, updateWhere); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] update SystemGlobalSession long time" + + "\n\t|-> table name: t_system_global_session" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0 && !changeDiff.isEmpty()) { + ChangeLogContext.addLog("t_system_global_session", + "update", aDo.getGuid(), changeDiff); + } + return update; + } + + @Override + public int updateByExampleSelective(SystemGlobalSession record, SystemGlobalSessionExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemGlobalSessionExample.Criteria criteria : example.getOredCriteria()) { + criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(0); + } + List guidList = systemGlobalSessionMapper + .selectPrimaryKeyByExample(example); + if (guidList.isEmpty()) { + return 0; + } + example = new SystemGlobalSessionExample(); + example.createCriteria().andGuidIn(guidList); + List recordList + = systemGlobalSessionMapper.selectByExample(example); + Map> diffGroup = new HashMap<>(); + for (SystemGlobalSession aDo : recordList) { + Map changeDiff = new HashMap<>(); + if (record.getUserGuid() != null && !Objects.equals(record.getUserGuid(), aDo.getUserGuid())) { + changeDiff.put("userGuid", new Object[]{aDo.getUserGuid(), record.getUserGuid()}); + } + if (record.getUserGroup() != null && !Objects.equals(record.getUserGroup(), aDo.getUserGroup())) { + changeDiff.put("userGroup", new Object[]{aDo.getUserGroup(), record.getUserGroup()}); + } + if (record.getSessionKey() != null && !Objects.equals(record.getSessionKey(), aDo.getSessionKey())) { + changeDiff.put("sessionKey", new Object[]{aDo.getSessionKey(), record.getSessionKey()}); + } + if (record.getOriginPlatform() != null && !Objects.equals(record.getOriginPlatform(), aDo.getOriginPlatform())) { + changeDiff.put("originPlatform", new Object[]{aDo.getOriginPlatform(), record.getOriginPlatform()}); + } + if (record.getOriginDomain() != null && !Objects.equals(record.getOriginDomain(), aDo.getOriginDomain())) { + changeDiff.put("originDomain", new Object[]{aDo.getOriginDomain(), record.getOriginDomain()}); + } + if (record.getOriginIp() != null && !Objects.equals(record.getOriginIp(), aDo.getOriginIp())) { + changeDiff.put("originIp", new Object[]{aDo.getOriginIp(), record.getOriginIp()}); + } + diffGroup.put(aDo.getGuid(), changeDiff); + } + // reset data version, with optimistic locking + record.setDataVersion((int) (new Date().getTime() % 1000)); + // It is not supported to directly modify the following columns + record.setUpdateTime(new Date()); + record.setIsHidden(null); + record.setIsDelete(null); + record.setDeleteToken(null); + record.setCreateTime(null); + record.setGuid(null); + long startTime = new Date().getTime(); + int update = systemGlobalSessionMapper.updateByExampleSelective(record, example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + String exampleString = ""; + if (example.getWhereString() != null) { + exampleString += "\n\t|-> where: " + example.getWhereString(); + } + LOGGER.error("[SQL] updateByExampleSelective SystemGlobalSession long time" + + "\n\t|-> table name: t_system_global_session" + + "\n\t|-> use time: " + useTime + "ms" + + exampleString + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + for (Map.Entry> diffEntry : diffGroup.entrySet()) { + if (diffEntry.getValue() != null && !diffEntry.getValue().isEmpty()) { + ChangeLogContext.addLog("t_system_global_session", + "updateByExampleSelective", diffEntry.getKey(), diffEntry.getValue()); + } + } + } + return update; + } + + @Override + public int deleteById(long id, boolean release) throws Throwable { + SystemGlobalSession aDo = findAnyById(id); + if (aDo == null) { + return 0; + } + if (release) { + return systemGlobalSessionMapper.deleteByPrimaryKey(aDo.getGuid()); + } + SystemGlobalSessionExample updateWhere + = new SystemGlobalSessionExample(); + Integer lockDataVersion = aDo.getDataVersion(); + updateWhere.createCriteria() + .andGuidEqualTo(aDo.getGuid()) + .andDataVersionEqualTo(lockDataVersion); + aDo.setDataVersion(aDo.getDataVersion() + 1); + aDo.setIsDelete(1); + aDo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemGlobalSessionMapper.updateByExampleSelective(aDo, updateWhere); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] deleteById SystemGlobalSession long time" + + "\n\t|-> table name: t_system_global_session" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + ChangeLogContext.addLog("t_system_global_session", + "deleteById", aDo.getGuid(), new HashMap<>()); + } + return update; + } + + @Override + public int deleteAll(SystemGlobalSessionExample example, boolean release) throws Throwable { + if (release) { + return systemGlobalSessionMapper.deleteByExample(example); + } + // clone new example + example = example.cloneExample(); + for (SystemGlobalSessionExample.Criteria criteria : example.getOredCriteria()) { + criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(1); + } + List guidList = systemGlobalSessionMapper.selectPrimaryKeyByExample(example); + if (guidList.isEmpty()) { + return 0; + } + example = new SystemGlobalSessionExample(); + example.createCriteria().andGuidIn(guidList); + SystemGlobalSession systemGlobalSession = new SystemGlobalSession(); + // reset data version, with optimistic locking + systemGlobalSession.setDataVersion((int) (new Date().getTime() % 1000)); + systemGlobalSession.setIsDelete(1); + systemGlobalSession.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemGlobalSessionMapper.updateByExampleSelective(systemGlobalSession, example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] deleteAll SystemGlobalSession long time" + + "\n\t|-> table name: t_system_global_session" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + for (Long guid : guidList) { + ChangeLogContext.addLog("t_system_global_session", + "deleteAll", guid, new HashMap<>()); + } + } + return update; + } + + @Override + public int trashById(long id) throws Throwable { + SystemGlobalSession aDo = findAnyById(id); + if (aDo == null) { + return 0; + } + if (aDo.getIsHidden() == 1) { + return 0; + } + SystemGlobalSessionExample updateWhere + = new SystemGlobalSessionExample(); + Integer lockDataVersion = aDo.getDataVersion(); + updateWhere.createCriteria() + .andGuidEqualTo(aDo.getGuid()) + .andDataVersionEqualTo(lockDataVersion); + aDo.setDataVersion(aDo.getDataVersion() + 1); + aDo.setIsHidden(1); + aDo.setDeleteToken(aDo.getGuid() + ""); + aDo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemGlobalSessionMapper.updateByExampleSelective(aDo, updateWhere); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] trashById SystemGlobalSession long time" + + "\n\t|-> table name: t_system_global_session" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + ChangeLogContext.addLog("t_system_global_session", + "trashById", aDo.getGuid(), new HashMap<>()); + } + return update; + } + + @Override + public int trashAll(SystemGlobalSessionExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemGlobalSessionExample.Criteria criteria : example.getOredCriteria()) { + criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(0); + } + List guidList = systemGlobalSessionMapper.selectPrimaryKeyByExample(example); + if (guidList.isEmpty()) { + return 0; + } + example = new SystemGlobalSessionExample(); + example.createCriteria().andGuidIn(guidList); + SystemGlobalSession systemGlobalSession = new SystemGlobalSession(); + // reset data version, with optimistic locking + systemGlobalSession.setDataVersion((int) (new Date().getTime() % 1000)); + systemGlobalSession.setIsHidden(1); + systemGlobalSession.setDeleteToken(SnowflakeUtil.nextId() + ""); + systemGlobalSession.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemGlobalSessionMapper.updateByExampleSelective(systemGlobalSession, example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] trashAll SystemGlobalSession long time" + + "\n\t|-> table name: t_system_global_session" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + for (Long guid : guidList) { + ChangeLogContext.addLog("t_system_global_session", + "trashAll", guid, new HashMap<>()); + } + } + return update; + } + + @Override + public int recoverById(long id) throws Throwable { + SystemGlobalSession aDo = findAnyById(id); + if (aDo == null) { + return 0; + } + if (aDo.getIsHidden() == 0) { + return 0; + } + SystemGlobalSessionExample updateWhere + = new SystemGlobalSessionExample(); + Integer lockDataVersion = aDo.getDataVersion(); + updateWhere.createCriteria() + .andGuidEqualTo(aDo.getGuid()) + .andDataVersionEqualTo(lockDataVersion); + aDo.setDataVersion(aDo.getDataVersion() + 1); + aDo.setIsHidden(0); + aDo.setDeleteToken("VALID"); + aDo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemGlobalSessionMapper.updateByExampleSelective(aDo, updateWhere); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] recoverById SystemGlobalSession long time" + + "\n\t|-> table name: t_system_global_session" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + ChangeLogContext.addLog("t_system_global_session", + "recoverById", aDo.getGuid(), new HashMap<>()); + } + return update; + } + + @Override + public int recoverAll(SystemGlobalSessionExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemGlobalSessionExample.Criteria criteria : example.getOredCriteria()) { + criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(1); + } + List guidList = systemGlobalSessionMapper.selectPrimaryKeyByExample(example); + if (guidList.isEmpty()) { + return 0; + } + example = new SystemGlobalSessionExample(); + example.createCriteria().andGuidIn(guidList); + SystemGlobalSession systemGlobalSession = new SystemGlobalSession(); + // reset data version, with optimistic locking + systemGlobalSession.setDataVersion((int) (new Date().getTime() % 1000)); + systemGlobalSession.setIsHidden(0); + systemGlobalSession.setDeleteToken("VALID"); + systemGlobalSession.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemGlobalSessionMapper.updateByExampleSelective(systemGlobalSession, example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] recoverAll SystemGlobalSession long time" + + "\n\t|-> table name: t_system_global_session" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + for (Long guid : guidList) { + ChangeLogContext.addLog("t_system_global_session", + "recoverAll", guid, new HashMap<>()); + } + } + return update; + } + + @Override + public SystemGlobalSession findOne(SystemGlobalSessionExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + example.usePage(1, 1); + List dataList = getList(example); + if (dataList != null && !dataList.isEmpty()) { + return dataList.get(0); + } + return null; + } + + @Override + public List getList(SystemGlobalSessionExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemGlobalSessionExample.Criteria criteria : example.getOredCriteria()) { + if (example.isResultTrash()) { + criteria.andIsHiddenEqualTo(1) + .andIsDeleteEqualTo(0); + } else if (example.isResultValid()) { + criteria.andIsHiddenEqualTo(0) + .andIsDeleteEqualTo(0); + } else { + criteria.andIsDeleteEqualTo(0); + } + } + List result = null; + long startTime = new Date().getTime(); + result = systemGlobalSessionMapper.selectByExample(example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + String exampleString = ""; + if (example.getWhereString() != null) { + exampleString += "\n\t|-> where: " + example.getWhereString(); + } + if (example.getOrderByClause() != null) { + exampleString += "\n\t|-> order by: " + example.getOrderByClause(); + } + if (example.getLimitString() != null) { + exampleString += "\n\t|-> limit: " + example.getLimitString(); + } + LOGGER.error("[SQL] select SystemGlobalSession list long time" + + "\n\t|-> table name: t_system_global_session" + + "\n\t|-> use time: " + useTime + "ms" + + exampleString + + "\n\t|-----------------------------------" + ); + } + return result; + } + + @Override + public long count(SystemGlobalSessionExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemGlobalSessionExample.Criteria criteria : example.getOredCriteria()) { + if (example.isResultTrash()) { + criteria.andIsHiddenEqualTo(1) + .andIsDeleteEqualTo(0); + } else if (example.isResultValid()) { + criteria.andIsHiddenEqualTo(0) + .andIsDeleteEqualTo(0); + } else { + criteria.andIsDeleteEqualTo(0); + } + } + long startTime = new Date().getTime(); + long count = systemGlobalSessionMapper.countByExample(example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + String exampleString = ""; + if (example.getWhereString() != null) { + exampleString += "\n\t|-> where: " + example.getWhereString(); + } + if (example.getOrderByClause() != null) { + exampleString += "\n\t|-> order by: " + example.getOrderByClause(); + } + LOGGER.error("[SQL] select SystemGlobalSession count long time" + + "\n\t|-> table name: t_system_global_session" + + "\n\t|-> use time: " + useTime + "ms" + + exampleString + + "\n\t|-----------------------------------" + ); + } + return count; + } + + @Override + public long countWithPage(SystemGlobalSessionExample example) throws Throwable { + // When not paginated, the count query returns 0 to avoid unnecessary queries + if (example.getRows() != null && example.getOffset() != null) { + return count(example); + } + return 0L; + } +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/domain/repository/SystemGlobalSettingRepositoryImpl.java b/src/main/java/com/iqudoo/platform/application/domain/repository/SystemGlobalSettingRepositoryImpl.java new file mode 100644 index 0000000..3fadd43 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/repository/SystemGlobalSettingRepositoryImpl.java @@ -0,0 +1,631 @@ +package com.iqudoo.platform.application.domain.repository; + +import com.iqudoo.framework.tape.modules.utils.SnowflakeUtil; +import com.iqudoo.platform.application.database.mapper.SystemGlobalSettingMapper; +import com.iqudoo.platform.application.database.model.SystemGlobalSetting; +import com.iqudoo.platform.application.database.model.SystemGlobalSettingExample; +import com.iqudoo.platform.application.domain.changeLog.ChangeLogContext; +import com.iqudoo.platform.application.facade.repository.ISystemGlobalSettingRepository; +import java.util.*; +import javax.annotation.Resource; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Repository; + +@SuppressWarnings("DuplicatedCode") +@Repository +public class SystemGlobalSettingRepositoryImpl implements ISystemGlobalSettingRepository { + private static final Logger LOGGER = LoggerFactory.getLogger(SystemGlobalSettingRepositoryImpl.class); + + @Resource + private SystemGlobalSettingMapper systemGlobalSettingMapper; + + @Override + public SystemGlobalSetting findAnyById(long guid) throws Throwable { + SystemGlobalSetting aDo = null; + SystemGlobalSettingExample example + = new SystemGlobalSettingExample(); + example.createCriteria() + .andIsDeleteEqualTo(0) + .andGuidEqualTo(guid); + List recordList + = systemGlobalSettingMapper.selectByExampleWithBLOBs(example); + if (recordList != null && !recordList.isEmpty()) { + aDo = recordList.get(0); + } + return aDo; + } + + @Override + public SystemGlobalSetting findValidById(long guid) throws Throwable { + SystemGlobalSetting aDo = null; + SystemGlobalSettingExample example + = new SystemGlobalSettingExample(); + example.createCriteria() + .andIsHiddenEqualTo(0) + .andIsDeleteEqualTo(0) + .andGuidEqualTo(guid); + List recordList + = systemGlobalSettingMapper.selectByExampleWithBLOBs(example); + if (recordList != null && !recordList.isEmpty()) { + aDo = recordList.get(0); + } + return aDo; + } + + @Override + public SystemGlobalSetting findTrashById(long guid) throws Throwable { + SystemGlobalSetting aDo = null; + SystemGlobalSettingExample example + = new SystemGlobalSettingExample(); + example.createCriteria() + .andIsHiddenEqualTo(1) + .andIsDeleteEqualTo(0) + .andGuidEqualTo(guid); + List recordList + = systemGlobalSettingMapper.selectByExampleWithBLOBs(example); + if (recordList != null && !recordList.isEmpty()) { + aDo = recordList.get(0); + } + return aDo; + } + + @Override + public SystemGlobalSetting insert(SystemGlobalSetting record) throws Throwable { + SystemGlobalSetting aDo = new SystemGlobalSetting(); + if (record.getGuid() != null) { + aDo.setGuid(record.getGuid()); + } else { + Long guid = SnowflakeUtil.nextId(); + aDo.setGuid(guid); + } + aDo.setSettingKey(record.getSettingKey()); + aDo.setOptRemark(record.getOptRemark()); + aDo.setSettingValue(record.getSettingValue()); + aDo.setIsDelete(0); + aDo.setIsHidden(0); + aDo.setDeleteToken("VALID"); + aDo.setDataVersion(1); + aDo.setCreateTime(new Date()); + aDo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int count = systemGlobalSettingMapper.insert(aDo); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] insert SystemGlobalSetting long time" + + "\n\t|-> table name: t_system_global_setting" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (count > 0) { + ChangeLogContext.addLog("t_system_global_setting", + "insert", aDo.getGuid(), new HashMap<>()); + return aDo; + } + throw new Throwable("Insert failed, SystemGlobalSetting: " + aDo); + } + + @Override + public List batchInsert(List records) throws Throwable { + if (records == null || records.isEmpty()) { + return new ArrayList<>(); + } + List batch = new ArrayList<>(); + for (SystemGlobalSetting record : records) { + SystemGlobalSetting aDo = new SystemGlobalSetting(); + if (record.getGuid() != null) { + aDo.setGuid(record.getGuid()); + } else { + Long guid = SnowflakeUtil.nextId(); + aDo.setGuid(guid); + } + aDo.setSettingKey(record.getSettingKey()); + aDo.setOptRemark(record.getOptRemark()); + aDo.setSettingValue(record.getSettingValue()); + aDo.setIsDelete(0); + aDo.setIsHidden(0); + aDo.setDeleteToken("VALID"); + aDo.setDataVersion(1); + aDo.setCreateTime(new Date()); + aDo.setUpdateTime(new Date()); + batch.add(aDo); + } + long startTime = new Date().getTime(); + int count = systemGlobalSettingMapper.batchInsert(batch); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] batch insert SystemGlobalSetting long time" + + "\n\t|-> table name: t_system_global_setting" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (count == batch.size()) { + for (SystemGlobalSetting aDo : batch) { + ChangeLogContext.addLog("t_system_global_setting", + "batchInsert", aDo.getGuid(), new HashMap<>()); + } + return batch; + } + throw new Throwable("Batch insert failed, SystemGlobalSetting affected: " + count + ", expected: " + batch.size()); + } + + @Override + public int update(SystemGlobalSetting record) throws Throwable { + SystemGlobalSetting aDo + = systemGlobalSettingMapper.selectByPrimaryKey(record.getGuid()); + if (aDo == null || aDo.getIsDelete() == 1) { + throw new Throwable("Record not found, SystemGlobalSetting GUID:" + record.getGuid()); + } + Map changeDiff = new HashMap<>(); + if (record.getSettingKey() != null) { + if (!Objects.equals(record.getSettingKey(), aDo.getSettingKey())) { + changeDiff.put("settingKey", new Object[]{aDo.getSettingKey(), record.getSettingKey()}); + } + aDo.setSettingKey(record.getSettingKey()); + } + if (record.getOptRemark() != null) { + if (!Objects.equals(record.getOptRemark(), aDo.getOptRemark())) { + changeDiff.put("optRemark", new Object[]{aDo.getOptRemark(), record.getOptRemark()}); + } + aDo.setOptRemark(record.getOptRemark()); + } + if (record.getSettingValue() != null) { + if (!Objects.equals(record.getSettingValue(), aDo.getSettingValue())) { + changeDiff.put("settingValue", new Object[]{aDo.getSettingValue(), record.getSettingValue()}); + } + aDo.setSettingValue(record.getSettingValue()); + } + SystemGlobalSettingExample updateWhere = new SystemGlobalSettingExample(); + Integer lockDataVersion = record.getDataVersion(); + if (lockDataVersion == null) { + lockDataVersion = aDo.getDataVersion(); + } + updateWhere.createCriteria() + .andGuidEqualTo(aDo.getGuid()) + .andDataVersionEqualTo(lockDataVersion); + aDo.setDataVersion(aDo.getDataVersion() + 1); + aDo.setUpdateTime(new Date()); + // update data version + record.setDataVersion(aDo.getDataVersion()); + record.setUpdateTime(aDo.getUpdateTime()); + long startTime = new Date().getTime(); + int update = systemGlobalSettingMapper.updateByExampleWithBLOBs(aDo, updateWhere); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] update SystemGlobalSetting long time" + + "\n\t|-> table name: t_system_global_setting" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0 && !changeDiff.isEmpty()) { + ChangeLogContext.addLog("t_system_global_setting", + "update", aDo.getGuid(), changeDiff); + } + return update; + } + + @Override + public int updateByExampleSelective(SystemGlobalSetting record, SystemGlobalSettingExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemGlobalSettingExample.Criteria criteria : example.getOredCriteria()) { + criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(0); + } + List guidList = systemGlobalSettingMapper + .selectPrimaryKeyByExample(example); + if (guidList.isEmpty()) { + return 0; + } + example = new SystemGlobalSettingExample(); + example.createCriteria().andGuidIn(guidList); + List recordList + = systemGlobalSettingMapper.selectByExampleWithBLOBs(example); + Map> diffGroup = new HashMap<>(); + for (SystemGlobalSetting aDo : recordList) { + Map changeDiff = new HashMap<>(); + if (record.getSettingKey() != null && !Objects.equals(record.getSettingKey(), aDo.getSettingKey())) { + changeDiff.put("settingKey", new Object[]{aDo.getSettingKey(), record.getSettingKey()}); + } + if (record.getOptRemark() != null && !Objects.equals(record.getOptRemark(), aDo.getOptRemark())) { + changeDiff.put("optRemark", new Object[]{aDo.getOptRemark(), record.getOptRemark()}); + } + if (record.getSettingValue() != null && !Objects.equals(record.getSettingValue(), aDo.getSettingValue())) { + changeDiff.put("settingValue", new Object[]{aDo.getSettingValue(), record.getSettingValue()}); + } + diffGroup.put(aDo.getGuid(), changeDiff); + } + // reset data version, with optimistic locking + record.setDataVersion((int) (new Date().getTime() % 1000)); + // It is not supported to directly modify the following columns + record.setUpdateTime(new Date()); + record.setIsHidden(null); + record.setIsDelete(null); + record.setDeleteToken(null); + record.setCreateTime(null); + record.setGuid(null); + long startTime = new Date().getTime(); + int update = systemGlobalSettingMapper.updateByExampleSelective(record, example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + String exampleString = ""; + if (example.getWhereString() != null) { + exampleString += "\n\t|-> where: " + example.getWhereString(); + } + LOGGER.error("[SQL] updateByExampleSelective SystemGlobalSetting long time" + + "\n\t|-> table name: t_system_global_setting" + + "\n\t|-> use time: " + useTime + "ms" + + exampleString + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + for (Map.Entry> diffEntry : diffGroup.entrySet()) { + if (diffEntry.getValue() != null && !diffEntry.getValue().isEmpty()) { + ChangeLogContext.addLog("t_system_global_setting", + "updateByExampleSelective", diffEntry.getKey(), diffEntry.getValue()); + } + } + } + return update; + } + + @Override + public int deleteById(long id, boolean release) throws Throwable { + SystemGlobalSetting aDo = findAnyById(id); + if (aDo == null) { + return 0; + } + if (release) { + return systemGlobalSettingMapper.deleteByPrimaryKey(aDo.getGuid()); + } + SystemGlobalSettingExample updateWhere + = new SystemGlobalSettingExample(); + Integer lockDataVersion = aDo.getDataVersion(); + updateWhere.createCriteria() + .andGuidEqualTo(aDo.getGuid()) + .andDataVersionEqualTo(lockDataVersion); + aDo.setDataVersion(aDo.getDataVersion() + 1); + aDo.setIsDelete(1); + aDo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemGlobalSettingMapper.updateByExampleSelective(aDo, updateWhere); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] deleteById SystemGlobalSetting long time" + + "\n\t|-> table name: t_system_global_setting" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + ChangeLogContext.addLog("t_system_global_setting", + "deleteById", aDo.getGuid(), new HashMap<>()); + } + return update; + } + + @Override + public int deleteAll(SystemGlobalSettingExample example, boolean release) throws Throwable { + if (release) { + return systemGlobalSettingMapper.deleteByExample(example); + } + // clone new example + example = example.cloneExample(); + for (SystemGlobalSettingExample.Criteria criteria : example.getOredCriteria()) { + criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(1); + } + List guidList = systemGlobalSettingMapper.selectPrimaryKeyByExample(example); + if (guidList.isEmpty()) { + return 0; + } + example = new SystemGlobalSettingExample(); + example.createCriteria().andGuidIn(guidList); + SystemGlobalSetting systemGlobalSetting = new SystemGlobalSetting(); + // reset data version, with optimistic locking + systemGlobalSetting.setDataVersion((int) (new Date().getTime() % 1000)); + systemGlobalSetting.setIsDelete(1); + systemGlobalSetting.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemGlobalSettingMapper.updateByExampleSelective(systemGlobalSetting, example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] deleteAll SystemGlobalSetting long time" + + "\n\t|-> table name: t_system_global_setting" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + for (Long guid : guidList) { + ChangeLogContext.addLog("t_system_global_setting", + "deleteAll", guid, new HashMap<>()); + } + } + return update; + } + + @Override + public int trashById(long id) throws Throwable { + SystemGlobalSetting aDo = findAnyById(id); + if (aDo == null) { + return 0; + } + if (aDo.getIsHidden() == 1) { + return 0; + } + SystemGlobalSettingExample updateWhere + = new SystemGlobalSettingExample(); + Integer lockDataVersion = aDo.getDataVersion(); + updateWhere.createCriteria() + .andGuidEqualTo(aDo.getGuid()) + .andDataVersionEqualTo(lockDataVersion); + aDo.setDataVersion(aDo.getDataVersion() + 1); + aDo.setIsHidden(1); + aDo.setDeleteToken(aDo.getGuid() + ""); + aDo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemGlobalSettingMapper.updateByExampleSelective(aDo, updateWhere); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] trashById SystemGlobalSetting long time" + + "\n\t|-> table name: t_system_global_setting" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + ChangeLogContext.addLog("t_system_global_setting", + "trashById", aDo.getGuid(), new HashMap<>()); + } + return update; + } + + @Override + public int trashAll(SystemGlobalSettingExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemGlobalSettingExample.Criteria criteria : example.getOredCriteria()) { + criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(0); + } + List guidList = systemGlobalSettingMapper.selectPrimaryKeyByExample(example); + if (guidList.isEmpty()) { + return 0; + } + example = new SystemGlobalSettingExample(); + example.createCriteria().andGuidIn(guidList); + SystemGlobalSetting systemGlobalSetting = new SystemGlobalSetting(); + // reset data version, with optimistic locking + systemGlobalSetting.setDataVersion((int) (new Date().getTime() % 1000)); + systemGlobalSetting.setIsHidden(1); + systemGlobalSetting.setDeleteToken(SnowflakeUtil.nextId() + ""); + systemGlobalSetting.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemGlobalSettingMapper.updateByExampleSelective(systemGlobalSetting, example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] trashAll SystemGlobalSetting long time" + + "\n\t|-> table name: t_system_global_setting" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + for (Long guid : guidList) { + ChangeLogContext.addLog("t_system_global_setting", + "trashAll", guid, new HashMap<>()); + } + } + return update; + } + + @Override + public int recoverById(long id) throws Throwable { + SystemGlobalSetting aDo = findAnyById(id); + if (aDo == null) { + return 0; + } + if (aDo.getIsHidden() == 0) { + return 0; + } + SystemGlobalSettingExample updateWhere + = new SystemGlobalSettingExample(); + Integer lockDataVersion = aDo.getDataVersion(); + updateWhere.createCriteria() + .andGuidEqualTo(aDo.getGuid()) + .andDataVersionEqualTo(lockDataVersion); + aDo.setDataVersion(aDo.getDataVersion() + 1); + aDo.setIsHidden(0); + aDo.setDeleteToken("VALID"); + aDo.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemGlobalSettingMapper.updateByExampleSelective(aDo, updateWhere); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] recoverById SystemGlobalSetting long time" + + "\n\t|-> table name: t_system_global_setting" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + ChangeLogContext.addLog("t_system_global_setting", + "recoverById", aDo.getGuid(), new HashMap<>()); + } + return update; + } + + @Override + public int recoverAll(SystemGlobalSettingExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemGlobalSettingExample.Criteria criteria : example.getOredCriteria()) { + criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(1); + } + List guidList = systemGlobalSettingMapper.selectPrimaryKeyByExample(example); + if (guidList.isEmpty()) { + return 0; + } + example = new SystemGlobalSettingExample(); + example.createCriteria().andGuidIn(guidList); + SystemGlobalSetting systemGlobalSetting = new SystemGlobalSetting(); + // reset data version, with optimistic locking + systemGlobalSetting.setDataVersion((int) (new Date().getTime() % 1000)); + systemGlobalSetting.setIsHidden(0); + systemGlobalSetting.setDeleteToken("VALID"); + systemGlobalSetting.setUpdateTime(new Date()); + long startTime = new Date().getTime(); + int update = systemGlobalSettingMapper.updateByExampleSelective(systemGlobalSetting, example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + LOGGER.error("[SQL] recoverAll SystemGlobalSetting long time" + + "\n\t|-> table name: t_system_global_setting" + + "\n\t|-> use time: " + useTime + "ms" + + "\n\t|-----------------------------------" + ); + } + if (update > 0) { + for (Long guid : guidList) { + ChangeLogContext.addLog("t_system_global_setting", + "recoverAll", guid, new HashMap<>()); + } + } + return update; + } + + @Override + public SystemGlobalSetting findOne(SystemGlobalSettingExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + example.usePage(1, 1); + List dataList = getList(example); + if (dataList != null && !dataList.isEmpty()) { + return dataList.get(0); + } + return null; + } + + @Override + public List getList(SystemGlobalSettingExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemGlobalSettingExample.Criteria criteria : example.getOredCriteria()) { + if (example.isResultTrash()) { + criteria.andIsHiddenEqualTo(1) + .andIsDeleteEqualTo(0); + } else if (example.isResultValid()) { + criteria.andIsHiddenEqualTo(0) + .andIsDeleteEqualTo(0); + } else { + criteria.andIsDeleteEqualTo(0); + } + } + List result = null; + long startTime = new Date().getTime(); + if (example.getRows() != null && example.getOffset() != null) { + List primaryKeyList = systemGlobalSettingMapper.selectPrimaryKeyByExample(example); + if (primaryKeyList == null || primaryKeyList.isEmpty()) { + return new ArrayList<>(); + } + long findPrimaryKeyTime = new Date().getTime() - startTime; + if (findPrimaryKeyTime > 300) { + String exampleString = ""; + if (example.getWhereString() != null) { + exampleString += "\n\t|-> where: " + example.getWhereString(); + } + if (example.getOrderByClause() != null) { + exampleString += "\n\t|-> order by: " + example.getOrderByClause(); + } + if (example.getLimitString() != null) { + exampleString += "\n\t|-> limit: " + example.getLimitString(); + } + LOGGER.error("[SQL] select SystemGlobalSetting list primary key long time" + + "\n\t|-> table name: t_system_global_setting" + + "\n\t|-> use time: " + findPrimaryKeyTime + "ms" + + exampleString + + "\n\t|-----------------------------------" + ); + } + // reset start time + startTime = new Date().getTime(); + String oldOrderByClause = example.getOrderByClause(); + Boolean withBLOBsFlag = example.isWithBLOBs(); + example = new SystemGlobalSettingExample(); + example.createCriteria().andGuidIn(primaryKeyList); + example.setOrderByClause(oldOrderByClause); + example.setWithBLOBs(withBLOBsFlag); + } + if (example.isWithBLOBs()) { + result = systemGlobalSettingMapper.selectByExampleWithBLOBs(example); + } else { + result = systemGlobalSettingMapper.selectByExample(example); + } + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + String exampleString = ""; + if (example.getWhereString() != null) { + exampleString += "\n\t|-> where: " + example.getWhereString(); + } + if (example.getOrderByClause() != null) { + exampleString += "\n\t|-> order by: " + example.getOrderByClause(); + } + if (example.getLimitString() != null) { + exampleString += "\n\t|-> limit: " + example.getLimitString(); + } + LOGGER.error("[SQL] select SystemGlobalSetting list long time" + + "\n\t|-> table name: t_system_global_setting" + + "\n\t|-> use time: " + useTime + "ms" + + exampleString + + "\n\t|-----------------------------------" + ); + } + return result; + } + + @Override + public long count(SystemGlobalSettingExample example) throws Throwable { + // clone new example + example = example.cloneExample(); + for (SystemGlobalSettingExample.Criteria criteria : example.getOredCriteria()) { + if (example.isResultTrash()) { + criteria.andIsHiddenEqualTo(1) + .andIsDeleteEqualTo(0); + } else if (example.isResultValid()) { + criteria.andIsHiddenEqualTo(0) + .andIsDeleteEqualTo(0); + } else { + criteria.andIsDeleteEqualTo(0); + } + } + long startTime = new Date().getTime(); + long count = systemGlobalSettingMapper.countByExample(example); + long useTime = new Date().getTime() - startTime; + if (useTime > 300) { + String exampleString = ""; + if (example.getWhereString() != null) { + exampleString += "\n\t|-> where: " + example.getWhereString(); + } + if (example.getOrderByClause() != null) { + exampleString += "\n\t|-> order by: " + example.getOrderByClause(); + } + LOGGER.error("[SQL] select SystemGlobalSetting count long time" + + "\n\t|-> table name: t_system_global_setting" + + "\n\t|-> use time: " + useTime + "ms" + + exampleString + + "\n\t|-----------------------------------" + ); + } + return count; + } + + @Override + public long countWithPage(SystemGlobalSettingExample example) throws Throwable { + // When not paginated, the count query returns 0 to avoid unnecessary queries + if (example.getRows() != null && example.getOffset() != null) { + return count(example); + } + return 0L; + } +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/domain/service/SystemAdminInfoAuthServiceImpl.java b/src/main/java/com/iqudoo/platform/application/domain/service/SystemAdminInfoAuthServiceImpl.java new file mode 100644 index 0000000..a6a4276 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/service/SystemAdminInfoAuthServiceImpl.java @@ -0,0 +1,188 @@ +package com.iqudoo.platform.application.domain.service; + +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.base.action.bean.ActionAuthInfo; +import com.iqudoo.framework.tape.base.action.bean.ActionState; +import com.iqudoo.framework.tape.base.action.bean.ActionTokenInfo; +import com.iqudoo.framework.tape.modules.IModuleSession; +import com.iqudoo.framework.tape.modules.asserts.AssertUtil; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.framework.tape.modules.proto.ProtoLoader; +import com.iqudoo.framework.tape.modules.proto.ProtoUtil; +import com.iqudoo.framework.tape.modules.session.RefreshSessionParam; +import com.iqudoo.framework.tape.modules.utils.DigestUtil; +import com.iqudoo.framework.tape.modules.utils.RandomUtil; +import com.iqudoo.platform.application.constants.ErrorConstants; +import com.iqudoo.platform.application.database.model.SystemAdminInfo; +import com.iqudoo.platform.application.database.model.SystemAdminInfoExample; +import com.iqudoo.platform.application.facade.enums.AuthTokenGroupEnum; +import com.iqudoo.platform.application.facade.enums.SystemAdminInfoOptStatusEnum; +import com.iqudoo.platform.application.facade.enums.SystemAdminInfoOptSuperEnum; +import com.iqudoo.platform.application.facade.repository.ISystemAdminInfoRepository; +import com.iqudoo.platform.application.facade.request.SystemAdminInfoAuthEditPasswordParam; +import com.iqudoo.platform.application.facade.request.SystemAdminInfoAuthEditProfileParam; +import com.iqudoo.platform.application.facade.request.SystemAdminInfoAuthLoginParam; +import com.iqudoo.platform.application.facade.request.SystemAdminInfoCreateParam; +import com.iqudoo.platform.application.facade.response.SystemAdminInfoAuthLoginResponse; +import com.iqudoo.platform.application.facade.response.SystemAdminInfoDetailResponse; +import com.iqudoo.platform.application.facade.service.ISystemAdminInfoAuthService; +import com.iqudoo.platform.application.facade.service.ISystemAdminInfoService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Objects; + +@Service +@SuppressWarnings("DuplicatedCode") +public class SystemAdminInfoAuthServiceImpl implements ISystemAdminInfoAuthService { + + private final String initAdminNickname = "超级管理员"; + private final String initAdminUsername = "admin"; + private final String initAdminPassword = "admin"; + @Resource + private ISystemAdminInfoRepository systemAdminInfoRepository; + @Resource + private ISystemAdminInfoService systemAdminInfoService; + + @Override + public Proto doLogin(SystemAdminInfoAuthLoginParam param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + @Override + public SystemAdminInfoAuthLoginResponse onLoad(SystemAdminInfoAuthLoginParam loadParam) throws Throwable { + AssertUtil.oneNotInvalid(loadParam.getUsername(), "账号不能为空"); + AssertUtil.oneNotInvalid(loadParam.getPassword(), "密码不能为空"); + SystemAdminInfoExample systemAdminInfoExample = new SystemAdminInfoExample(); + systemAdminInfoExample.createCriteria() + .andOptSuperEqualTo(SystemAdminInfoOptSuperEnum.SUPER.getValue()); + long superCount = systemAdminInfoRepository.count(systemAdminInfoExample); + if (superCount <= 0) { + if (Objects.equals(loadParam.getUsername(), initAdminUsername) + && (Objects.equals(loadParam.getPassword(), + initAdminPassword) || Objects.equals(loadParam.getPassword(), + DigestUtil.md5DigestAsHex(initAdminPassword)))) { + SystemAdminInfoCreateParam createParam = new SystemAdminInfoCreateParam(); + createParam.setNickname(initAdminNickname); + createParam.setUsername(initAdminUsername); + createParam.setPassword(initAdminPassword); + createParam.setOptStatus(SystemAdminInfoOptStatusEnum.ENABLE.getValue()); + createParam.setOptSuper(SystemAdminInfoOptSuperEnum.SUPER.getValue()); + Proto systemAdminInfoDetailResponseProto + = systemAdminInfoService.doCreate(createParam); + if (!systemAdminInfoDetailResponseProto.isSuccess()) { + throw systemAdminInfoDetailResponseProto.getErr(); + } + } + } + SystemAdminInfoExample whereDoExample = new SystemAdminInfoExample(); + whereDoExample.createCriteria() + .andUsernameEqualTo(loadParam.getUsername()); + SystemAdminInfo aDo = systemAdminInfoRepository + .findOne(whereDoExample); + if (aDo == null) { + throw ErrorConstants.AUTH_USER_NOT_EXIST; + } + // check password + String passwordHash = loadParam.getPassword(); + String passwordEncode = DigestUtil.md5DigestAsHex(aDo.getPwdSlot() + + passwordHash); + if (!aDo.getPwdMd5().equals(passwordEncode)) { + throw ErrorConstants.AUTH_USER_PASSWORD_ERROR; + } + // check status + if (aDo.getOptStatus() == SystemAdminInfoOptStatusEnum.DISABLE.getValue()) { + throw ErrorConstants.AUTH_USER_NOT_ENABLE; + } + String userGroup = AuthTokenGroupEnum.SYS_ADMIN.getValue(); + String originPlatform = loadParam.getRequestPlatform(); + String originDomain = loadParam.getClientDomain(); + String originIp = loadParam.getClientIpAddress(); + RefreshSessionParam refreshSessionParam = new RefreshSessionParam(); + refreshSessionParam.setUserGuid(aDo.getGuid()); + refreshSessionParam.setUserGroup(userGroup); + refreshSessionParam.setOriginPlatform(originPlatform); + refreshSessionParam.setOriginDomain(originDomain); + refreshSessionParam.setOriginIp(originIp); + refreshSessionParam.setRefresh(false); + String curSessionKey = Tape.getService(IModuleSession.class) + .refreshSession(refreshSessionParam) + aDo.getPwdSlot(); + ActionAuthInfo actionAuthInfo = new ActionAuthInfo(); + actionAuthInfo.setOriginPlatform(originPlatform); + actionAuthInfo.setUserGroup(userGroup); + actionAuthInfo.setUserGuid(aDo.getGuid()); + actionAuthInfo.setSessionKey(curSessionKey); + // login success + ActionTokenInfo actionTokenInfo = actionAuthInfo.createToken(); + SystemAdminInfoAuthLoginResponse systemAdminLoginResponse = new SystemAdminInfoAuthLoginResponse(); + systemAdminLoginResponse.setToken(actionTokenInfo.getToken()); + systemAdminLoginResponse.setRefreshToken(actionTokenInfo.getRefreshToken()); + systemAdminLoginResponse.setExpiresIn(actionTokenInfo.getExpiresIn()); + systemAdminLoginResponse.setRefreshExpiresIn(actionTokenInfo.getRefreshExpiresIn()); + // set user info + loadParam.getActionRequest().setAuthInfo(actionAuthInfo); + return systemAdminLoginResponse; + } + + }); + } + + @Override + public Proto doEditPassword(SystemAdminInfoAuthEditPasswordParam param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + @Override + public Void onLoad(SystemAdminInfoAuthEditPasswordParam loadParam) throws Throwable { + AssertUtil.oneNotInvalid(loadParam.getGuid(), "GUID不能为空"); + AssertUtil.oneNotInvalid(loadParam.getPassword(), "密码不能为空"); + AssertUtil.oneNotInvalid(loadParam.getNewPassword(), "新密码不能为空"); + SystemAdminInfo systemAdminInfo = systemAdminInfoRepository.findValidById(loadParam.getGuid()); + if (systemAdminInfo == null) { + throw ErrorConstants.AUTH_USER_NOT_EXIST; + } + // check old password + String passwordHash = loadParam.getPassword(); + String newPasswordHash = loadParam.getNewPassword(); + String passwordEncode = DigestUtil.md5DigestAsHex(systemAdminInfo.getPwdSlot() + + passwordHash); + if (!systemAdminInfo.getPwdMd5().equals(passwordEncode)) { + throw ErrorConstants.AUTH_USER_PASSWORD_ERROR; + } + if (passwordHash.equals(newPasswordHash)) { + throw ErrorConstants.AUTH_USER_NEW_PASSWORD_ERROR; + } + String pwdSlot = RandomUtil.getRandomString(6); + systemAdminInfo.setPwdMd5(DigestUtil.md5DigestAsHex(pwdSlot + + loadParam.getNewPassword())); + systemAdminInfo.setPwdSlot(pwdSlot); + int update = systemAdminInfoRepository.update(systemAdminInfo); + if (update == 0) { + throw ActionState.getRequestToFrequentError(); + } + return null; + } + + }); + } + + @Override + public Proto doEditProfile(SystemAdminInfoAuthEditProfileParam param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + @Override + public Void onLoad(SystemAdminInfoAuthEditProfileParam loadParam) throws Throwable { + AssertUtil.oneNotInvalid(loadParam.getGuid(), "GUID不能为空"); + SystemAdminInfo systemAdminInfo = systemAdminInfoRepository.findValidById(loadParam.getGuid()); + if (systemAdminInfo == null) { + throw new ActionState("账号不存在"); + } + if (loadParam.getNickname() != null && !loadParam.getNickname().isEmpty()) { + systemAdminInfo.setNickname(loadParam.getNickname()); + } + int update = systemAdminInfoRepository.update(systemAdminInfo); + if (update == 0) { + throw ActionState.getRequestToFrequentError(); + } + return null; + } + + }); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/service/SystemAdminInfoServiceImpl.java b/src/main/java/com/iqudoo/platform/application/domain/service/SystemAdminInfoServiceImpl.java new file mode 100644 index 0000000..aa8bfb6 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/service/SystemAdminInfoServiceImpl.java @@ -0,0 +1,213 @@ +package com.iqudoo.platform.application.domain.service; + +import com.iqudoo.framework.tape.base.action.bean.ActionState; +import com.iqudoo.framework.tape.modules.asserts.AssertUtil; +import com.iqudoo.framework.tape.modules.crud.PageData; +import com.iqudoo.framework.tape.modules.crud.PageUtil; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.framework.tape.modules.proto.ProtoLoader; +import com.iqudoo.framework.tape.modules.proto.ProtoUtil; +import com.iqudoo.framework.tape.modules.utils.ArrayUtil; +import com.iqudoo.platform.application.database.model.SystemAdminInfo; +import com.iqudoo.platform.application.database.model.SystemAdminInfoExample; +import com.iqudoo.platform.application.domain.transactionals.SystemAdminInfoTransactional; +import com.iqudoo.platform.application.facade.enums.AuthTokenGroupEnum; +import com.iqudoo.platform.application.facade.repository.ISystemAdminInfoRepository; +import com.iqudoo.platform.application.facade.request.*; +import com.iqudoo.platform.application.facade.response.SystemAdminInfoDetailResponse; +import com.iqudoo.platform.application.facade.response.SystemGlobalSessionDetailResponse; +import com.iqudoo.platform.application.facade.service.ISystemAdminInfoService; +import com.iqudoo.platform.application.facade.service.ISystemGlobalSessionService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.List; + +@SuppressWarnings("DuplicatedCode") +@Service +public class SystemAdminInfoServiceImpl implements ISystemAdminInfoService { + + @Resource + private SystemAdminInfoTransactional systemAdminInfoTransactional; + @Resource + private ISystemAdminInfoRepository systemAdminInfoRepository; + @Resource + private ISystemGlobalSessionService systemGlobalSessionService; + + @Override + public Proto> getList(SystemAdminInfoListParam param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader, SystemAdminInfoListParam>() { + @Override + public PageData onLoad(SystemAdminInfoListParam loadParam) throws Throwable { + SystemAdminInfoExample whereExample = new SystemAdminInfoExample(); + if (loadParam.getPageNum() != null && loadParam.getPageSize() != null) { + whereExample.usePage(loadParam.getPageNum(), loadParam.getPageSize()); + } else { + whereExample.usePage(1, 20); + } + if (loadParam.getPageCursor() == null || loadParam.getPageCursor() == 0 || whereExample.getPageNum() == 1) { + loadParam.setPageCursor(new Date().getTime()); + } + SystemAdminInfoExample.Criteria criteria = whereExample.createCriteria(); + List excludeGuidList = ArrayUtil.splitTo(loadParam.getExcludeGuidList(), Long.class); + if (excludeGuidList != null && !excludeGuidList.isEmpty()) { + criteria.andGuidNotIn(excludeGuidList); + } + if (loadParam.getOptStatus() != null) { + criteria.andOptStatusEqualTo(loadParam.getOptStatus()); + } + if (loadParam.getOptSuper() != null) { + criteria.andOptSuperEqualTo(loadParam.getOptSuper()); + } + if (loadParam.getUsernameLike() != null && !loadParam.getUsernameLike().isEmpty()) { + criteria.andUsernameLike("%" + loadParam.getUsernameLike() + "%"); + } + if (loadParam.getNicknameLike() != null && !loadParam.getNicknameLike().isEmpty()) { + criteria.andNicknameLike("%" + loadParam.getNicknameLike() + "%"); + } + if (loadParam.getOptRemarkLike() != null && !loadParam.getOptRemarkLike().isEmpty()) { + criteria.andOptRemarkLike("%" + loadParam.getOptRemarkLike() + "%"); + } + criteria.andCreateTimeLessThanOrEqualTo(new Date(loadParam.getPageCursor())); + // order by + if (loadParam.getOrderBy() == null || loadParam.getOrderBy().isEmpty()) { + loadParam.setOrderBy("create_time desc"); + } + if (!loadParam.getOrderBy().contains("create_time")) { + loadParam.setOrderBy(loadParam.getOrderBy() + ",create_time desc"); + } + if (loadParam.getResultType() != null && !loadParam.getResultType().isEmpty()) { + whereExample.setResultType(loadParam.getResultType()); + } + whereExample.setOrderByClause(loadParam.getOrderBy()); + return PageUtil.pagination(systemAdminInfoRepository.getList(whereExample), + systemAdminInfoRepository.countWithPage(whereExample), + whereExample.getPageNum(), + whereExample.getPageSize(), + loadParam.getPageCursor()).map(new PageData.MapHandler() { + @Override + public SystemAdminInfoDetailResponse map(SystemAdminInfo d) throws Throwable { + return wrapResponse(d); + } + }); + } + + @Override + public void handleResponseAfter(PageData systemAdminInfoDetailResponsePageData, SystemAdminInfoListParam params) throws Throwable { + super.handleResponseAfter(systemAdminInfoDetailResponsePageData, params); + for (SystemAdminInfoDetailResponse detailResponse : systemAdminInfoDetailResponsePageData.getList()) { + try { + SystemGlobalSessionLastParam lastSessionParam + = new SystemGlobalSessionLastParam(); + lastSessionParam.setUserGroup(AuthTokenGroupEnum.SYS_ADMIN.getValue()); + lastSessionParam.setUserGuid(detailResponse.getGuid()); + Proto systemGlobalSessionDetailResponseProto + = systemGlobalSessionService.getLast(lastSessionParam); + if (systemGlobalSessionDetailResponseProto.isSuccess()) { + detailResponse.setLastSession(systemGlobalSessionDetailResponseProto.getData()); + } + } catch (Throwable ignored) { + } + } + } + + }); + } + + @Override + public Proto doCreate(SystemAdminInfoCreateParam param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + @Override + public SystemAdminInfoDetailResponse onLoad(SystemAdminInfoCreateParam loadParam) throws Throwable { + SystemAdminInfo aDo = systemAdminInfoTransactional.handleCreate(loadParam); + return wrapResponse(aDo); + } + + }); + } + + @Override + public Proto getDetail(SystemAdminInfoDetailParam param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + @Override + public SystemAdminInfoDetailResponse onLoad(SystemAdminInfoDetailParam loadParam) throws Throwable { + AssertUtil.oneNotInvalid(loadParam.getGuid(), "GUID不能为空"); + SystemAdminInfo systemAdminInfo = systemAdminInfoRepository.findAnyById(loadParam.getGuid()); + if (systemAdminInfo == null) { + throw new ActionState("账号不存在"); + } + return wrapResponse(systemAdminInfo); + } + + @Override + public void handleResponseAfter(SystemAdminInfoDetailResponse systemAdminInfoDetailResponse, SystemAdminInfoDetailParam params) throws Throwable { + super.handleResponseAfter(systemAdminInfoDetailResponse, params); + try { + SystemGlobalSessionLastParam lastSessionParam + = new SystemGlobalSessionLastParam(); + lastSessionParam.setUserGroup(AuthTokenGroupEnum.SYS_ADMIN.getValue()); + lastSessionParam.setUserGuid(systemAdminInfoDetailResponse.getGuid()); + Proto systemGlobalSessionDetailResponseProto + = systemGlobalSessionService.getLast(lastSessionParam); + if (systemGlobalSessionDetailResponseProto.isSuccess()) { + systemAdminInfoDetailResponse.setLastSession(systemGlobalSessionDetailResponseProto.getData()); + } + } catch (Throwable ignored) { + } + } + }); + } + + @Override + public Proto doUpdate(SystemAdminInfoUpdateParam param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + @Override + public Void onLoad(SystemAdminInfoUpdateParam loadParam) throws Throwable { + systemAdminInfoTransactional.handleUpdate(loadParam); + return null; + } + + }); + } + + @Override + public Proto doDelete(SystemAdminInfoDeleteParam param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + @Override + public Void onLoad(SystemAdminInfoDeleteParam loadParam) throws Throwable { + systemAdminInfoTransactional.handleDelete(loadParam); + return null; + } + + }); + } + + @Override + public Proto doRecover(SystemAdminInfoRecoverParam param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + @Override + public Void onLoad(SystemAdminInfoRecoverParam loadParam) throws Throwable { + systemAdminInfoTransactional.handleRecover(loadParam); + return null; + } + + }); + } + + private SystemAdminInfoDetailResponse wrapResponse(SystemAdminInfo systemAdminInfo) { + SystemAdminInfoDetailResponse systemAdminInfoDetailResponse = new SystemAdminInfoDetailResponse(); + systemAdminInfoDetailResponse.setGuid(systemAdminInfo.getGuid()); + systemAdminInfoDetailResponse.setUsername(systemAdminInfo.getUsername()); + systemAdminInfoDetailResponse.setNickname(systemAdminInfo.getNickname()); + systemAdminInfoDetailResponse.setOptRemark(systemAdminInfo.getOptRemark()); + systemAdminInfoDetailResponse.setOptStatus(systemAdminInfo.getOptStatus()); + systemAdminInfoDetailResponse.setOptSuper(systemAdminInfo.getOptSuper()); + systemAdminInfoDetailResponse.setIsDelete(systemAdminInfo.getIsDelete()); + systemAdminInfoDetailResponse.setIsHidden(systemAdminInfo.getIsHidden()); + systemAdminInfoDetailResponse.setUpdateTime(systemAdminInfo.getUpdateTime().getTime()); + systemAdminInfoDetailResponse.setCreateTime(systemAdminInfo.getCreateTime().getTime()); + return systemAdminInfoDetailResponse; + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/service/SystemAsyncTaskInfoServiceImpl.java b/src/main/java/com/iqudoo/platform/application/domain/service/SystemAsyncTaskInfoServiceImpl.java new file mode 100644 index 0000000..8ae1814 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/service/SystemAsyncTaskInfoServiceImpl.java @@ -0,0 +1,301 @@ +package com.iqudoo.platform.application.domain.service; + +import com.iqudoo.framework.tape.base.action.bean.ActionState; +import com.iqudoo.framework.tape.modules.asserts.AssertUtil; +import com.iqudoo.framework.tape.modules.crud.PageData; +import com.iqudoo.framework.tape.modules.crud.PageUtil; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.framework.tape.modules.proto.ProtoLoader; +import com.iqudoo.framework.tape.modules.proto.ProtoUtil; +import com.iqudoo.framework.tape.modules.utils.LogUtil; +import com.iqudoo.platform.application.database.model.SystemAsyncTaskInfo; +import com.iqudoo.platform.application.database.model.SystemAsyncTaskInfoExample; +import com.iqudoo.platform.application.domain.transactionals.SystemAsyncTaskInfoTransactional; +import com.iqudoo.platform.application.facade.enums.SystemAsyncTaskInfoOptStatusEnum; +import com.iqudoo.platform.application.facade.repository.ISystemAsyncTaskInfoRepository; +import com.iqudoo.platform.application.facade.request.*; +import com.iqudoo.platform.application.facade.response.SystemAsyncTaskInfoDetailResponse; +import com.iqudoo.platform.application.facade.response.SystemAsyncTaskInfoLogsResponse; +import com.iqudoo.platform.application.facade.service.ISystemAsyncTaskInfoService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Date; +import java.util.Objects; + +@SuppressWarnings("DuplicatedCode") +@Service +public class SystemAsyncTaskInfoServiceImpl implements ISystemAsyncTaskInfoService { + + @Resource + private SystemAsyncTaskInfoTransactional systemAsyncTaskInfoTransactional; + @Resource + private ISystemAsyncTaskInfoRepository systemAsyncTaskInfoRepository; + + @Override + public Proto> getList(SystemAsyncTaskInfoListParam param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader, SystemAsyncTaskInfoListParam>() { + @Override + public PageData onLoad(SystemAsyncTaskInfoListParam loadParam) throws Throwable { + SystemAsyncTaskInfoExample whereExample = new SystemAsyncTaskInfoExample(); + if (loadParam.getSearchKeyword() != null + && !loadParam.getSearchKeyword().isEmpty()) { + whereExample.createCriteria().andTaskTypeLike("%" + + loadParam.getSearchKeyword() + "%"); + whereExample.or().andBizTypeLike("%" + + loadParam.getSearchKeyword() + "%"); + whereExample.or().andBizIdLike("%" + + loadParam.getSearchKeyword() + "%"); + whereExample.or().andTransIdLike("%" + + loadParam.getSearchKeyword() + "%"); + Long guid = null; + try { + guid = Long.parseLong(loadParam.getSearchKeyword()); + } catch (Throwable ignored) { + } + if (guid != null) { + whereExample.or().andGuidEqualTo(guid); + } + } else { + whereExample.createCriteria(); + } + if (loadParam.getPageNum() != null && loadParam.getPageSize() != null) { + whereExample.usePage(loadParam.getPageNum(), loadParam.getPageSize()); + } else { + whereExample.usePage(1, 20); + } + if (loadParam.getPageCursor() == null || loadParam.getPageCursor() == 0 || whereExample.getPageNum() == 1) { + loadParam.setPageCursor(new Date().getTime()); + } + for (SystemAsyncTaskInfoExample.Criteria criteria : whereExample.getOredCriteria()) { + if (loadParam.getBizType() != null && !loadParam.getBizType().isEmpty()) { + criteria.andBizTypeEqualTo(loadParam.getBizType()); + } + if (loadParam.getBizId() != null && !loadParam.getBizId().isEmpty()) { + criteria.andBizIdEqualTo(loadParam.getBizId()); + } + if (loadParam.getTaskTypeLike() != null && !loadParam.getTaskTypeLike().isEmpty()) { + criteria.andTaskTypeLike("%" + loadParam.getTaskTypeLike() + "%"); + } + if (loadParam.getOptStatus() != null) { + criteria.andOptStatusEqualTo(loadParam.getOptStatus()); + } + criteria.andCreateTimeLessThanOrEqualTo(new Date(loadParam.getPageCursor())); + } + // order by + if (loadParam.getOrderBy() == null || loadParam.getOrderBy().isEmpty()) { + loadParam.setOrderBy("create_time desc"); + } + if (!loadParam.getOrderBy().contains("create_time")) { + loadParam.setOrderBy(loadParam.getOrderBy() + ",create_time desc"); + } + if (loadParam.getResultType() != null && !loadParam.getResultType().isEmpty()) { + whereExample.setResultType(loadParam.getResultType()); + } + whereExample.setOrderByClause(loadParam.getOrderBy()); + return PageUtil.pagination(systemAsyncTaskInfoRepository.getList(whereExample), + systemAsyncTaskInfoRepository.countWithPage(whereExample), + whereExample.getPageNum(), + whereExample.getPageSize(), + loadParam.getPageCursor()).map(new PageData.MapHandler() { + @Override + public SystemAsyncTaskInfoDetailResponse map(SystemAsyncTaskInfo d) throws Throwable { + return wrapResponse(d); + } + }); + } + + }); + } + + @Override + public Proto getDetail(SystemAsyncTaskInfoDetailParam param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + @Override + public SystemAsyncTaskInfoDetailResponse onLoad(SystemAsyncTaskInfoDetailParam loadParam) throws Throwable { + AssertUtil.oneNotInvalid(loadParam.getGuid(), "GUID不能为空"); + SystemAsyncTaskInfo systemAsyncTaskInfo = systemAsyncTaskInfoRepository.findAnyById(loadParam.getGuid()); + if (systemAsyncTaskInfo == null) { + throw new ActionState("异步任务不存在"); + } + if (loadParam.getBizType() != null + && !Objects.equals(loadParam.getBizType(), systemAsyncTaskInfo.getBizType())) { + throw new ActionState("异步任务业务类型不匹配"); + } + if (loadParam.getBizId() != null + && !Objects.equals(loadParam.getBizId(), systemAsyncTaskInfo.getBizId())) { + throw new ActionState("异步任务业务编号不匹配"); + } + return wrapResponse(systemAsyncTaskInfo); + } + + }); + } + + @Override + public Proto getLogs(SystemAsyncTaskInfoLogsParam param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + @Override + public SystemAsyncTaskInfoLogsResponse onLoad(SystemAsyncTaskInfoLogsParam loadParam) throws Throwable { + AssertUtil.oneNotInvalid(loadParam.getGuid(), "GUID不能为空"); + SystemAsyncTaskInfo systemAsyncTaskInfo = systemAsyncTaskInfoRepository.findAnyById(loadParam.getGuid()); + if (systemAsyncTaskInfo == null) { + throw new ActionState("异步任务不存在"); + } + if (loadParam.getBizType() != null + && !Objects.equals(loadParam.getBizType(), systemAsyncTaskInfo.getBizType())) { + throw new ActionState("异步任务业务类型不匹配"); + } + if (loadParam.getBizId() != null + && !Objects.equals(loadParam.getBizId(), systemAsyncTaskInfo.getBizId())) { + throw new ActionState("异步任务业务编号不匹配"); + } + SystemAsyncTaskInfoLogsResponse logsResponse = new SystemAsyncTaskInfoLogsResponse(); + logsResponse.setLogsContent(LogUtil.readLog(systemAsyncTaskInfo.getGuid() + "")); + return logsResponse; + } + }); + } + + @Override + public Proto doRestart(SystemAsyncTaskInfoRestartParam param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + @Override + public Void onLoad(SystemAsyncTaskInfoRestartParam loadParam) throws Throwable { + systemAsyncTaskInfoTransactional.handleRestart(loadParam); + return null; + } + + }); + } + + @Override + public Proto doCreate(SystemAsyncTaskInfoCreateParam param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + @Override + public Void onLoad(SystemAsyncTaskInfoCreateParam loadParam) throws Throwable { + systemAsyncTaskInfoTransactional.handleCreate(loadParam); + return null; + } + + }); + } + + @Override + public Proto doCancel(SystemAsyncTaskInfoCancelParam param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + @Override + public Void onLoad(SystemAsyncTaskInfoCancelParam loadParam) throws Throwable { + systemAsyncTaskInfoTransactional.handleCancel(loadParam); + return null; + } + + }); + } + + @Override + public Proto doDelete(SystemAsyncTaskInfoDeleteParam param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + @Override + public Void onLoad(SystemAsyncTaskInfoDeleteParam loadParam) throws Throwable { + AssertUtil.oneNotInvalid(loadParam.getGuid(), "GUID不能为空"); + SystemAsyncTaskInfo systemAsyncTaskInfo + = systemAsyncTaskInfoRepository.findValidById(loadParam.getGuid()); + if (systemAsyncTaskInfo == null) { + throw new ActionState("异步任务不存在"); + } + if (loadParam.getBizType() != null + && !Objects.equals(loadParam.getBizType(), systemAsyncTaskInfo.getBizType())) { + throw new ActionState("异步任务业务类型不匹配"); + } + if (loadParam.getBizId() != null + && !Objects.equals(loadParam.getBizId(), systemAsyncTaskInfo.getBizId())) { + throw new ActionState("异步任务业务编号不匹配"); + } + if (systemAsyncTaskInfo.getOptStatus() == SystemAsyncTaskInfoOptStatusEnum.RUNNING.getValue()) { + throw new ActionState("执行中的异步任务不能删除"); + } + int update = systemAsyncTaskInfoRepository.trashById(systemAsyncTaskInfo.getGuid()); + if (update == 0) { + throw ActionState.getRequestToFrequentError(); + } + return null; + } + + }); + } + + @Override + public Proto doReset(SystemAsyncTaskInfoResetParam param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + + @Override + public Void onLoad(SystemAsyncTaskInfoResetParam loadParam) throws Throwable { + systemAsyncTaskInfoTransactional.handleResetTask(loadParam); + return null; + } + }); + } + + @Override + public Proto doTick(SystemAsyncTaskInfoTickParam param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + + @Override + public Void onLoad(SystemAsyncTaskInfoTickParam loadParam) throws Throwable { + systemAsyncTaskInfoTransactional.handleTick(loadParam); + return null; + } + }); + } + + @Override + public Proto doSchedule(SystemAsyncTaskInfoScheduleParam param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + + @Override + public Void onLoad(SystemAsyncTaskInfoScheduleParam loadParam) throws Throwable { + systemAsyncTaskInfoTransactional.handleSchedule(loadParam); + return null; + } + }); + } + + @Override + public Proto doClear(SystemAsyncTaskInfoClearParam param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + + @Override + public Void onLoad(SystemAsyncTaskInfoClearParam loadParam) throws Throwable { + systemAsyncTaskInfoTransactional.handleClear(loadParam); + return null; + } + }); + } + + private SystemAsyncTaskInfoDetailResponse wrapResponse(SystemAsyncTaskInfo systemAsyncTaskInfo) { + SystemAsyncTaskInfoDetailResponse systemAsyncTaskInfoDetailResponse = new SystemAsyncTaskInfoDetailResponse(); + systemAsyncTaskInfoDetailResponse.setGuid(systemAsyncTaskInfo.getGuid()); + systemAsyncTaskInfoDetailResponse.setBizType(systemAsyncTaskInfo.getBizType()); + systemAsyncTaskInfoDetailResponse.setBizId(systemAsyncTaskInfo.getBizId()); + systemAsyncTaskInfoDetailResponse.setTransId(systemAsyncTaskInfo.getTransId()); + systemAsyncTaskInfoDetailResponse.setTaskType(systemAsyncTaskInfo.getTaskType()); + systemAsyncTaskInfoDetailResponse.setTaskParams(systemAsyncTaskInfo.getTaskParams()); + systemAsyncTaskInfoDetailResponse.setCallTiming(systemAsyncTaskInfo.getCallTiming()); + systemAsyncTaskInfoDetailResponse.setStartTime(systemAsyncTaskInfo.getStartTime()); + systemAsyncTaskInfoDetailResponse.setEndTime(systemAsyncTaskInfo.getEndTime()); + systemAsyncTaskInfoDetailResponse.setUseTime(systemAsyncTaskInfo.getUseTime()); + systemAsyncTaskInfoDetailResponse.setTotalCount(systemAsyncTaskInfo.getTotalCount()); + systemAsyncTaskInfoDetailResponse.setSuccessCount(systemAsyncTaskInfo.getSuccessCount()); + systemAsyncTaskInfoDetailResponse.setFailureCount(systemAsyncTaskInfo.getFailureCount()); + systemAsyncTaskInfoDetailResponse.setIgnoreCount(systemAsyncTaskInfo.getIgnoreCount()); + systemAsyncTaskInfoDetailResponse.setRetryCount(systemAsyncTaskInfo.getRetryCount()); + systemAsyncTaskInfoDetailResponse.setOptStatus(systemAsyncTaskInfo.getOptStatus()); + systemAsyncTaskInfoDetailResponse.setIsDelete(systemAsyncTaskInfo.getIsDelete()); + systemAsyncTaskInfoDetailResponse.setIsHidden(systemAsyncTaskInfo.getIsHidden()); + systemAsyncTaskInfoDetailResponse.setUpdateTime(systemAsyncTaskInfo.getUpdateTime().getTime()); + systemAsyncTaskInfoDetailResponse.setCreateTime(systemAsyncTaskInfo.getCreateTime().getTime()); + return systemAsyncTaskInfoDetailResponse; + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/service/SystemGlobalFileServiceImpl.java b/src/main/java/com/iqudoo/platform/application/domain/service/SystemGlobalFileServiceImpl.java new file mode 100644 index 0000000..b2689d6 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/service/SystemGlobalFileServiceImpl.java @@ -0,0 +1,43 @@ +package com.iqudoo.platform.application.domain.service; + +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.framework.tape.modules.proto.ProtoLoader; +import com.iqudoo.framework.tape.modules.proto.ProtoUtil; +import com.iqudoo.platform.application.domain.transactionals.SystemGlobalFileTransactional; +import com.iqudoo.platform.application.facade.request.SystemGlobalFileTransferParam; +import com.iqudoo.platform.application.facade.request.SystemGlobalFileUploadParam; +import com.iqudoo.platform.application.facade.response.SystemGlobalFileTransferResponse; +import com.iqudoo.platform.application.facade.response.SystemGlobalFileUploadResponse; +import com.iqudoo.platform.application.facade.service.ISystemGlobalFileService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; + +@Service +public class SystemGlobalFileServiceImpl implements ISystemGlobalFileService { + + @Resource + private SystemGlobalFileTransactional systemGlobalFileTransactional; + + @Override + public Proto doFileUpload(SystemGlobalFileUploadParam param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + @Override + public SystemGlobalFileUploadResponse onLoad(SystemGlobalFileUploadParam loadParam) throws Throwable { + return systemGlobalFileTransactional.handleFileUpload(loadParam); + } + + }); + } + + @Override + public Proto doFileTransfer(SystemGlobalFileTransferParam param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + @Override + public SystemGlobalFileTransferResponse onLoad(SystemGlobalFileTransferParam loadParam) throws Throwable { + return systemGlobalFileTransactional.handleFileTransfer(loadParam); + } + }); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/service/SystemGlobalSessionServiceImpl.java b/src/main/java/com/iqudoo/platform/application/domain/service/SystemGlobalSessionServiceImpl.java new file mode 100644 index 0000000..ce148e3 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/service/SystemGlobalSessionServiceImpl.java @@ -0,0 +1,153 @@ +package com.iqudoo.platform.application.domain.service; + +import com.iqudoo.framework.tape.base.action.bean.ActionState; +import com.iqudoo.framework.tape.modules.asserts.AssertUtil; +import com.iqudoo.framework.tape.modules.crud.PageData; +import com.iqudoo.framework.tape.modules.crud.PageUtil; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.framework.tape.modules.proto.ProtoLoader; +import com.iqudoo.framework.tape.modules.proto.ProtoUtil; +import com.iqudoo.platform.application.database.model.SystemGlobalSession; +import com.iqudoo.platform.application.database.model.SystemGlobalSessionExample; +import com.iqudoo.platform.application.facade.repository.ISystemGlobalSessionRepository; +import com.iqudoo.platform.application.facade.request.SystemGlobalSessionDeleteParam; +import com.iqudoo.platform.application.facade.request.SystemGlobalSessionDetailParam; +import com.iqudoo.platform.application.facade.request.SystemGlobalSessionLastParam; +import com.iqudoo.platform.application.facade.request.SystemGlobalSessionListParam; +import com.iqudoo.platform.application.facade.response.SystemGlobalSessionDetailResponse; +import com.iqudoo.platform.application.facade.service.ISystemGlobalSessionService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Date; + +@SuppressWarnings("DuplicatedCode") +@Service +public class SystemGlobalSessionServiceImpl implements ISystemGlobalSessionService { + + @Resource + private ISystemGlobalSessionRepository systemGlobalSessionRepository; + + @Override + public Proto> getList(SystemGlobalSessionListParam param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader, SystemGlobalSessionListParam>() { + + @Override + public PageData onLoad(SystemGlobalSessionListParam loadParam) throws Throwable { + SystemGlobalSessionExample whereExample = new SystemGlobalSessionExample(); + if (loadParam.getPageNum() != null && loadParam.getPageSize() != null) { + whereExample.usePage(loadParam.getPageNum(), loadParam.getPageSize()); + } else { + whereExample.usePage(1, 20); + } + if (loadParam.getPageCursor() == null || loadParam.getPageCursor() == 0 || whereExample.getPageNum() == 1) { + loadParam.setPageCursor(new Date().getTime()); + } + SystemGlobalSessionExample.Criteria criteria = whereExample.createCriteria(); + if (loadParam.getUserGuid() != null) { + criteria.andUserGuidEqualTo(loadParam.getUserGuid()); + } + if (loadParam.getUserGroup() != null && !loadParam.getUserGroup().isEmpty()) { + criteria.andUserGroupEqualTo(loadParam.getUserGroup()); + } + criteria.andCreateTimeLessThanOrEqualTo(new Date(loadParam.getPageCursor())); + // order by + if (loadParam.getOrderBy() == null || loadParam.getOrderBy().isEmpty()) { + loadParam.setOrderBy("create_time desc"); + } + if (!loadParam.getOrderBy().contains("create_time")) { + loadParam.setOrderBy(loadParam.getOrderBy() + ",create_time desc"); + } + if (loadParam.getResultType() != null && !loadParam.getResultType().isEmpty()) { + whereExample.setResultType(loadParam.getResultType()); + } + whereExample.setOrderByClause(loadParam.getOrderBy()); + return PageUtil.pagination(systemGlobalSessionRepository.getList(whereExample), + systemGlobalSessionRepository.countWithPage(whereExample), + whereExample.getPageNum(), + whereExample.getPageSize(), + loadParam.getPageCursor()).map(new PageData.MapHandler() { + @Override + public SystemGlobalSessionDetailResponse map(SystemGlobalSession d) throws Throwable { + return wrapResponse(d); + } + }); + } + + }); + } + + @Override + public Proto getDetail(SystemGlobalSessionDetailParam param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + @Override + public SystemGlobalSessionDetailResponse onLoad(SystemGlobalSessionDetailParam loadParam) throws Throwable { + AssertUtil.oneNotInvalid(loadParam.getGuid(), "登录会话GUID不能为空"); + SystemGlobalSession systemGlobalSession = systemGlobalSessionRepository.findAnyById(loadParam.getGuid()); + if (systemGlobalSession == null) { + throw new ActionState("登录会话不存在"); + } + return wrapResponse(systemGlobalSession); + } + + }); + } + + @Override + public Proto getLast(SystemGlobalSessionLastParam param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + @Override + public SystemGlobalSessionDetailResponse onLoad(SystemGlobalSessionLastParam loadParam) throws Throwable { + AssertUtil.oneNotInvalid(loadParam.getUserGroup(), "会话分组不能为空"); + AssertUtil.oneNotInvalid(loadParam.getUserGuid(), "会话用户不能为空"); + SystemGlobalSessionExample systemGlobalSessionExample + = new SystemGlobalSessionExample(); + systemGlobalSessionExample.createCriteria() + .andUserGroupEqualTo(loadParam.getUserGroup()) + .andUserGuidEqualTo(loadParam.getUserGuid()); + SystemGlobalSession systemGlobalSession = systemGlobalSessionRepository.findOne(systemGlobalSessionExample); + if (systemGlobalSession == null) { + throw new ActionState("登录会话不存在"); + } + return wrapResponse(systemGlobalSession); + } + + }); + } + + @Override + public Proto doDelete(SystemGlobalSessionDeleteParam param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + @Override + public Void onLoad(SystemGlobalSessionDeleteParam loadParam) throws Throwable { + AssertUtil.oneNotInvalid(loadParam.getGuid(), "GUID不能为空"); + SystemGlobalSession systemGlobalSession = systemGlobalSessionRepository.findValidById(loadParam.getGuid()); + if (systemGlobalSession == null) { + throw new ActionState("会话不存在"); + } + int update = systemGlobalSessionRepository.trashById(systemGlobalSession.getGuid()); + if (update == 0) { + throw ActionState.getRequestToFrequentError(); + } + return null; + } + + }); + } + + private SystemGlobalSessionDetailResponse wrapResponse(SystemGlobalSession systemGlobalSession) { + SystemGlobalSessionDetailResponse systemGlobalSessionDetailResponse = new SystemGlobalSessionDetailResponse(); + systemGlobalSessionDetailResponse.setGuid(systemGlobalSession.getGuid()); + systemGlobalSessionDetailResponse.setUserGuid(systemGlobalSession.getUserGuid()); + systemGlobalSessionDetailResponse.setUserGroup(systemGlobalSession.getUserGroup()); + systemGlobalSessionDetailResponse.setOriginPlatform(systemGlobalSession.getOriginPlatform()); + systemGlobalSessionDetailResponse.setOriginDomain(systemGlobalSession.getOriginDomain()); + systemGlobalSessionDetailResponse.setOriginIp(systemGlobalSession.getOriginIp()); + systemGlobalSessionDetailResponse.setIsHidden(systemGlobalSession.getIsHidden()); + systemGlobalSessionDetailResponse.setIsDelete(systemGlobalSession.getIsDelete()); + systemGlobalSessionDetailResponse.setCreateTime(systemGlobalSession.getCreateTime().getTime()); + systemGlobalSessionDetailResponse.setUpdateTime(systemGlobalSession.getUpdateTime().getTime()); + return systemGlobalSessionDetailResponse; + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/service/SystemGlobalSettingServiceImpl.java b/src/main/java/com/iqudoo/platform/application/domain/service/SystemGlobalSettingServiceImpl.java new file mode 100644 index 0000000..a5fc38c --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/service/SystemGlobalSettingServiceImpl.java @@ -0,0 +1,138 @@ +package com.iqudoo.platform.application.domain.service; + +import com.alibaba.fastjson.JSONObject; +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.base.action.bean.ActionState; +import com.iqudoo.framework.tape.modules.IModuleSetting; +import com.iqudoo.framework.tape.modules.asserts.AssertUtil; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.framework.tape.modules.proto.ProtoLoader; +import com.iqudoo.framework.tape.modules.proto.ProtoUtil; +import com.iqudoo.platform.application.constants.BizConstants; +import com.iqudoo.platform.application.database.model.SystemGlobalSetting; +import com.iqudoo.platform.application.database.model.SystemGlobalSettingExample; +import com.iqudoo.platform.application.facade.enums.AuthTokenGroupEnum; +import com.iqudoo.platform.application.facade.repository.ISystemGlobalSettingRepository; +import com.iqudoo.platform.application.facade.request.SystemGlobalSettingDetailParam; +import com.iqudoo.platform.application.facade.request.SystemGlobalSettingEditParam; +import com.iqudoo.platform.application.facade.response.SystemGlobalSettingDetailResponse; +import com.iqudoo.platform.application.facade.service.ISystemGlobalSettingService; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.List; +import java.util.Objects; + +@SuppressWarnings("DuplicatedCode") +@Service +public class SystemGlobalSettingServiceImpl implements ISystemGlobalSettingService { + + @Resource + private ISystemGlobalSettingRepository systemGlobalSettingRepository; + + @Override + public Proto> getList() throws Throwable { + return ProtoUtil.load(null, new ProtoLoader, Void>() { + @Override + public List onLoad(Void loadParam) throws Throwable { + return Tape.getService(IModuleSetting.class) + .getList(BizConstants.SETTING_GROUP_SYSTEM); + } + + }); + } + + @Override + public Proto doEdit(SystemGlobalSettingEditParam param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + @Override + public SystemGlobalSettingDetailResponse onLoad(SystemGlobalSettingEditParam loadParam) throws Throwable { + AssertUtil.oneNotInvalid(loadParam.getSettingKey(), "配置Key不能为空"); + AssertUtil.oneNotInvalid(loadParam.getSettingValue(), "配置Value不能为空"); + IModuleSetting.SettingInfo settingInfo = Tape.getService(IModuleSetting.class) + .getSettingInfo(BizConstants.SETTING_GROUP_SYSTEM, loadParam.getSettingKey()); + if (settingInfo == null) { + throw new ActionState("未定义的配置信息"); + } + SystemGlobalSettingExample systemGlobalSettingExample = new SystemGlobalSettingExample(); + systemGlobalSettingExample.createCriteria() + .andSettingKeyEqualTo(loadParam.getSettingKey()); + SystemGlobalSetting systemGlobalSetting = systemGlobalSettingRepository + .findOne(systemGlobalSettingExample); + if (systemGlobalSetting != null) { + if (loadParam.getSettingValue() != null) { + systemGlobalSetting.setSettingValue(loadParam.getSettingValue()); + } + if (loadParam.getOptRemark() != null) { + systemGlobalSetting.setOptRemark(loadParam.getOptRemark()); + } + int update = systemGlobalSettingRepository.update(systemGlobalSetting); + if (update <= 0) { + throw ActionState.getRequestToFrequentError(); + } + } else { + systemGlobalSetting = new SystemGlobalSetting(); + systemGlobalSetting.setSettingKey(loadParam.getSettingKey()); + systemGlobalSetting.setSettingValue(loadParam.getSettingValue()); + if (loadParam.getOptRemark() != null) { + systemGlobalSetting.setOptRemark(loadParam.getOptRemark()); + } else { + systemGlobalSetting.setOptRemark(""); + } + systemGlobalSetting = systemGlobalSettingRepository.insert(systemGlobalSetting); + } + // 清除配置信息的缓存 + Tape.getService(IModuleSetting.class) + .clearCache(loadParam.getSettingKey()); + return wrapResponse(systemGlobalSetting); + } + + }); + } + + @Override + public Proto getDetail(SystemGlobalSettingDetailParam param) throws Throwable { + return ProtoUtil.load(param, new ProtoLoader() { + @Override + public SystemGlobalSettingDetailResponse onLoad(SystemGlobalSettingDetailParam loadParam) throws Throwable { + AssertUtil.oneNotInvalid(loadParam.getSettingKey(), "配置Key不能为空"); + IModuleSetting.SettingInfo settingInfo = Tape.getService(IModuleSetting.class) + .getSettingInfo(BizConstants.SETTING_GROUP_SYSTEM, loadParam.getSettingKey()); + if (settingInfo == null) { + throw new ActionState("未定义的配置信息"); + } + String userGroup = loadParam.getActionAuthInfo().getUserGroup(); + boolean isSysAdmin = Objects.equals(userGroup, AuthTokenGroupEnum.SYS_ADMIN.getValue()); + if (!isSysAdmin && !settingInfo.isPublic()) { + throw new ActionState("系统配置信息未公开"); + } + Object obj = Tape.getService(IModuleSetting.class).getSetting(settingInfo.getType()); + SystemGlobalSettingExample systemGlobalSettingExample = new SystemGlobalSettingExample(); + systemGlobalSettingExample.createCriteria() + .andSettingKeyEqualTo(loadParam.getSettingKey()); + SystemGlobalSetting aDo = systemGlobalSettingRepository + .findOne(systemGlobalSettingExample); + SystemGlobalSettingDetailResponse detailResponse; + if (aDo == null) { + detailResponse = new SystemGlobalSettingDetailResponse(); + detailResponse.setSettingKey(settingInfo.getKey()); + detailResponse.setSettingValue(JSONObject.toJSONString(obj)); + } else { + detailResponse = wrapResponse(aDo); + } + detailResponse.setSettingInfo(settingInfo); + return detailResponse; + } + + }); + } + + private SystemGlobalSettingDetailResponse wrapResponse(SystemGlobalSetting systemGlobalSetting) { + SystemGlobalSettingDetailResponse systemGlobalSettingDetailResponse = new SystemGlobalSettingDetailResponse(); + systemGlobalSettingDetailResponse.setSettingKey(systemGlobalSetting.getSettingKey()); + systemGlobalSettingDetailResponse.setSettingValue(systemGlobalSetting.getSettingValue()); + systemGlobalSettingDetailResponse.setOptRemark(systemGlobalSetting.getOptRemark()); + return systemGlobalSettingDetailResponse; + } + +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/domain/transactionals/SystemAdminInfoTransactional.java b/src/main/java/com/iqudoo/platform/application/domain/transactionals/SystemAdminInfoTransactional.java new file mode 100644 index 0000000..f8f4ead --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/transactionals/SystemAdminInfoTransactional.java @@ -0,0 +1,132 @@ +package com.iqudoo.platform.application.domain.transactionals; + +import com.iqudoo.framework.tape.base.action.bean.ActionState; +import com.iqudoo.framework.tape.modules.asserts.AssertUtil; +import com.iqudoo.framework.tape.modules.utils.DigestUtil; +import com.iqudoo.framework.tape.modules.utils.RandomUtil; +import com.iqudoo.platform.application.database.model.SystemAdminInfo; +import com.iqudoo.platform.application.facade.enums.AuthTokenGroupEnum; +import com.iqudoo.platform.application.facade.enums.SystemAdminInfoOptStatusEnum; +import com.iqudoo.platform.application.facade.enums.SystemAdminInfoOptSuperEnum; +import com.iqudoo.platform.application.facade.repository.ISystemAdminInfoRepository; +import com.iqudoo.platform.application.facade.request.SystemAdminInfoCreateParam; +import com.iqudoo.platform.application.facade.request.SystemAdminInfoDeleteParam; +import com.iqudoo.platform.application.facade.request.SystemAdminInfoRecoverParam; +import com.iqudoo.platform.application.facade.request.SystemAdminInfoUpdateParam; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.Objects; + +@SuppressWarnings("DuplicatedCode") +@Component +public class SystemAdminInfoTransactional { + + @Resource + private ISystemAdminInfoRepository systemAdminInfoRepository; + + @Transactional(rollbackFor = Throwable.class) + public SystemAdminInfo handleCreate(SystemAdminInfoCreateParam loadParam) throws Throwable { + AssertUtil.oneNotInvalid(loadParam.getUsername(), "系统管理员账号不能为空"); + AssertUtil.oneNotInvalid(loadParam.getPassword(), "密码不能为空"); + SystemAdminInfo systemAdminInfo = new SystemAdminInfo(); + systemAdminInfo.setUsername(loadParam.getUsername()); + systemAdminInfo.setNickname(loadParam.getNickname()); + String pwdSlot = RandomUtil.getRandomString(6); + systemAdminInfo.setPwdSlot(pwdSlot); + systemAdminInfo.setPwdMd5(DigestUtil.md5DigestAsHex(pwdSlot + + loadParam.getPassword())); + if (loadParam.getOptRemark() != null) { + systemAdminInfo.setOptRemark(loadParam.getOptRemark()); + } else { + systemAdminInfo.setOptRemark(""); + } + if (loadParam.getOptStatus() != null) { + systemAdminInfo.setOptStatus(loadParam.getOptStatus()); + } else { + systemAdminInfo.setOptStatus(SystemAdminInfoOptStatusEnum.ENABLE.getValue()); + } + if (loadParam.getOptSuper() != null) { + systemAdminInfo.setOptSuper(loadParam.getOptSuper()); + } else { + systemAdminInfo.setOptSuper(SystemAdminInfoOptSuperEnum.NONE.getValue()); + } + return systemAdminInfoRepository.insert(systemAdminInfo); + } + + @Transactional(rollbackFor = Throwable.class) + public void handleUpdate(SystemAdminInfoUpdateParam loadParam) throws Throwable { + AssertUtil.oneNotInvalid(loadParam.getGuid(), "GUID不能为空"); + SystemAdminInfo systemAdminInfo + = systemAdminInfoRepository.findValidById(loadParam.getGuid()); + if (systemAdminInfo == null) { + throw new ActionState("系统管理员不存在"); + } + if (loadParam.getUsername() != null && !loadParam.getUsername().isEmpty()) { + systemAdminInfo.setUsername(loadParam.getUsername()); + } + if (loadParam.getNickname() != null && !loadParam.getNickname().isEmpty()) { + systemAdminInfo.setNickname(loadParam.getNickname()); + } + if (loadParam.getPassword() != null && !loadParam.getPassword().isEmpty()) { + String pwdSlot = RandomUtil.getRandomString(6); + systemAdminInfo.setPwdMd5(DigestUtil.md5DigestAsHex(pwdSlot + + loadParam.getPassword())); + systemAdminInfo.setPwdSlot(pwdSlot); + } + if (loadParam.getOptRemark() != null) { + systemAdminInfo.setOptRemark(loadParam.getOptRemark()); + } + Long userGuid = loadParam.getActionAuthInfo().getUserGuid(); + String userGroup = loadParam.getActionAuthInfo().getUserGroup(); + boolean isSelf = Objects.equals(systemAdminInfo.getGuid(), userGuid) + && Objects.equals(userGroup, AuthTokenGroupEnum.SYS_ADMIN.getValue()); + if (!isSelf) { + if (loadParam.getOptSuper() != null) { + systemAdminInfo.setOptSuper(loadParam.getOptSuper()); + } + if (loadParam.getOptStatus() != null) { + systemAdminInfo.setOptStatus(loadParam.getOptStatus()); + } + } + int update = systemAdminInfoRepository.update(systemAdminInfo); + if (update == 0) { + throw ActionState.getRequestToFrequentError(); + } + } + + @Transactional(rollbackFor = Throwable.class) + public void handleDelete(SystemAdminInfoDeleteParam loadParam) throws Throwable { + AssertUtil.oneNotInvalid(loadParam.getGuid(), "GUID不能为空"); + SystemAdminInfo systemAdminInfo = systemAdminInfoRepository.findValidById(loadParam.getGuid()); + if (systemAdminInfo == null) { + throw new ActionState("系统管理员不存在"); + } + Long userGuid = loadParam.getActionAuthInfo().getUserGuid(); + String userGroup = loadParam.getActionAuthInfo().getUserGroup(); + boolean isSelf = Objects.equals(systemAdminInfo.getGuid(), userGuid) + && Objects.equals(userGroup, AuthTokenGroupEnum.SYS_ADMIN.getValue()); + if (isSelf) { + throw new ActionState("不能删除自己的信息"); + } + int update = systemAdminInfoRepository.trashById(systemAdminInfo.getGuid()); + if (update == 0) { + throw ActionState.getRequestToFrequentError(); + } + } + + @Transactional(rollbackFor = Throwable.class) + public void handleRecover(SystemAdminInfoRecoverParam loadParam) throws Throwable { + AssertUtil.oneNotInvalid(loadParam.getGuid(), "GUID不能为空"); + SystemAdminInfo systemAdminInfo = systemAdminInfoRepository.findValidById(loadParam.getGuid()); + if (systemAdminInfo == null) { + throw new ActionState("系统管理员不存在"); + } + int update = systemAdminInfoRepository.recoverById(systemAdminInfo.getGuid()); + if (update == 0) { + throw ActionState.getRequestToFrequentError(); + } + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/transactionals/SystemAsyncTaskInfoTransactional.java b/src/main/java/com/iqudoo/platform/application/domain/transactionals/SystemAsyncTaskInfoTransactional.java new file mode 100644 index 0000000..4372c39 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/transactionals/SystemAsyncTaskInfoTransactional.java @@ -0,0 +1,398 @@ +package com.iqudoo.platform.application.domain.transactionals; + +import com.alibaba.fastjson.JSONObject; +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.base.action.bean.ActionState; +import com.iqudoo.framework.tape.modules.IModuleAsync; +import com.iqudoo.framework.tape.modules.IModuleFactory; +import com.iqudoo.framework.tape.modules.asserts.AssertUtil; +import com.iqudoo.framework.tape.modules.async.AsyncHandler; +import com.iqudoo.framework.tape.modules.async.AsyncScheduler; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.framework.tape.modules.utils.ArrayUtil; +import com.iqudoo.framework.tape.modules.utils.DigestUtil; +import com.iqudoo.framework.tape.modules.utils.LogUtil; +import com.iqudoo.framework.tape.modules.utils.ThrowableUtil; +import com.iqudoo.platform.application.database.model.SystemAsyncTaskInfo; +import com.iqudoo.platform.application.database.model.SystemAsyncTaskInfoExample; +import com.iqudoo.platform.application.facade.enums.SystemAsyncTaskInfoOptStatusEnum; +import com.iqudoo.platform.application.facade.repository.ISystemAsyncTaskInfoRepository; +import com.iqudoo.platform.application.facade.request.*; +import com.iqudoo.platform.application.facade.service.ISystemAsyncTaskInfoService; +import com.iqudoo.platform.application.facade.task.IAsyncTaskHandler; +import com.iqudoo.platform.application.facade.task.IAsyncTaskScheduler; +import org.slf4j.Logger; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.*; + +@SuppressWarnings({"DuplicatedCode", "ExtractMethodRecommender", "unused"}) +@Component +public class SystemAsyncTaskInfoTransactional { + + private static final Logger LOGGER = Tape.getLogger(SystemAsyncTaskInfoTransactional.class); + + @Resource(name = "asyncTaskExecutor") + private ThreadPoolTaskExecutor asyncTaskExecutor; + @Resource + private ISystemAsyncTaskInfoRepository systemAsyncTaskInfoRepository; + @Resource + private ISystemAsyncTaskInfoService systemAsyncTaskInfoService; + + private final Map asyncTaskScheduleTime = new HashMap<>(); + + @Transactional(rollbackFor = Throwable.class) + public void handleCreate(SystemAsyncTaskInfoCreateParam loadParam) throws Throwable { + AssertUtil.oneNotInvalid(loadParam.getTaskType(), "同步类型不能为空"); + if (loadParam.getTaskParams() == null) { + loadParam.setTaskParams(""); + } + if (loadParam.getTransId() == null) { + loadParam.setTransId(DigestUtil.md5DigestAsHex(loadParam.getTaskParams() + + "$" + loadParam.getTaskType())); + } + if (loadParam.isCallSync()) { + // 同步执行异步任务 + JSONObject taskParams = new JSONObject(); + try { + taskParams = JSONObject.parseObject(loadParam.getTaskParams()); + } catch (Throwable ignored) { + } + IAsyncTaskHandler.TaskProgressive taskProgressive = new IAsyncTaskHandler.TaskProgressive<>(null) { + @Override + protected void onProgressSubmit() throws Throwable { + // NO CODE + } + }; + Tape.getService(IModuleFactory.class) + .get(IAsyncTaskHandler.class, loadParam.getTaskType()) + .doTask(taskParams, taskProgressive); + taskProgressive.setFulfilled(); + taskProgressive.commitSubmit(); + LOGGER.info("Sync call async task, task:{}", loadParam.getTaskType()); + return; + } + SystemAsyncTaskInfoExample pendingExample + = new SystemAsyncTaskInfoExample(); + pendingExample.createCriteria() + .andTaskTypeEqualTo(loadParam.getTaskType()) + .andTransIdEqualTo(loadParam.getTransId()) + .andOptStatusIn(Arrays.asList(SystemAsyncTaskInfoOptStatusEnum.PENDING.getValue(), + SystemAsyncTaskInfoOptStatusEnum.WAIL_RETRY.getValue())); + long count = systemAsyncTaskInfoRepository.count(pendingExample); + if (count > 0) { + // 存在待处理或重试任务,直接返回 + return; + } + SystemAsyncTaskInfoExample runningExample + = new SystemAsyncTaskInfoExample(); + runningExample.createCriteria() + .andTaskTypeEqualTo(loadParam.getTaskType()) + .andTransIdEqualTo(loadParam.getTransId()) + .andOptStatusEqualTo(SystemAsyncTaskInfoOptStatusEnum.RUNNING.getValue()); + long runningCount = systemAsyncTaskInfoRepository.count(runningExample); + if (runningCount > 0) { + throw new ActionState("当前任务已在运行中,不能重复创建"); + } + if (loadParam.getCallTiming() == null) { + loadParam.setCallTiming(0L); + } + if (loadParam.getBizType() == null || loadParam.getBizType().isEmpty()) { + loadParam.setBizType("unknown"); + } + if (loadParam.getBizId() == null || loadParam.getBizId().isEmpty()) { + loadParam.setBizId("unknown"); + } + SystemAsyncTaskInfo systemAsyncTaskInfo = new SystemAsyncTaskInfo(); + systemAsyncTaskInfo.setBizType(loadParam.getBizType()); + systemAsyncTaskInfo.setBizId(loadParam.getBizId()); + systemAsyncTaskInfo.setTransId(loadParam.getTransId()); + systemAsyncTaskInfo.setTaskType(loadParam.getTaskType()); + systemAsyncTaskInfo.setTaskParams(loadParam.getTaskParams()); + systemAsyncTaskInfo.setCallTiming(loadParam.getCallTiming()); + systemAsyncTaskInfo.setUseTime(0L); + systemAsyncTaskInfo.setStartTime(0L); + systemAsyncTaskInfo.setEndTime(0L); + systemAsyncTaskInfo.setTotalCount(0); + systemAsyncTaskInfo.setSuccessCount(0); + systemAsyncTaskInfo.setFailureCount(0); + systemAsyncTaskInfo.setIgnoreCount(0); + systemAsyncTaskInfo.setRetryCount(0); + systemAsyncTaskInfo.setOptStatus(SystemAsyncTaskInfoOptStatusEnum.PENDING.getValue()); + systemAsyncTaskInfoRepository.insert(systemAsyncTaskInfo); + // 检测是否需要立即执行 + if (systemAsyncTaskInfo.getCallTiming() <= new Date().getTime()) { + SystemAsyncTaskInfoTickParam systemAsyncTaskInfoTickParam + = new SystemAsyncTaskInfoTickParam(); + systemAsyncTaskInfoTickParam.setThrowThrowable(true); + Proto voidProto = systemAsyncTaskInfoService.doTick(systemAsyncTaskInfoTickParam); + if (!voidProto.isSuccess()) { + throw voidProto.getErr(); + } + } + } + + public void handleCancel(SystemAsyncTaskInfoCancelParam loadParam) throws Throwable { + AssertUtil.oneNotInvalid(loadParam.getGuid(), "GUID不能为空"); + SystemAsyncTaskInfo systemAsyncTaskInfo + = systemAsyncTaskInfoRepository.findValidById(loadParam.getGuid()); + if (systemAsyncTaskInfo == null) { + throw new ActionState("异步任务不存在"); + } + if (loadParam.getBizType() != null + && !Objects.equals(loadParam.getBizType(), systemAsyncTaskInfo.getBizType())) { + throw new ActionState("异步任务业务类型不匹配"); + } + if (loadParam.getBizId() != null + && !Objects.equals(loadParam.getBizId(), systemAsyncTaskInfo.getBizId())) { + throw new ActionState("异步任务业务编号不匹配"); + } + if (systemAsyncTaskInfo.getOptStatus() == SystemAsyncTaskInfoOptStatusEnum.WAIL_RETRY.getValue() + || systemAsyncTaskInfo.getOptStatus() == SystemAsyncTaskInfoOptStatusEnum.RUNNING.getValue() + || systemAsyncTaskInfo.getOptStatus() == SystemAsyncTaskInfoOptStatusEnum.PENDING.getValue()) { + systemAsyncTaskInfo.setOptStatus(SystemAsyncTaskInfoOptStatusEnum.CANCELING.getValue()); + int update = systemAsyncTaskInfoRepository.update(systemAsyncTaskInfo); + if (update <= 0) { + throw ActionState.getRequestToFrequentError(); + } + } + } + + public void handleRestart(SystemAsyncTaskInfoRestartParam loadParam) throws Throwable { + AssertUtil.oneNotInvalid(loadParam.getGuid(), "GUID不能为空"); + SystemAsyncTaskInfo systemAsyncTaskInfo + = systemAsyncTaskInfoRepository.findValidById(loadParam.getGuid()); + if (systemAsyncTaskInfo == null) { + throw new ActionState("异步任务不存在"); + } + if (loadParam.getBizType() != null + && !Objects.equals(loadParam.getBizType(), systemAsyncTaskInfo.getBizType())) { + throw new ActionState("异步任务业务类型不匹配"); + } + if (loadParam.getBizId() != null + && !Objects.equals(loadParam.getBizId(), systemAsyncTaskInfo.getBizId())) { + throw new ActionState("异步任务业务编号不匹配"); + } + SystemAsyncTaskInfoCreateParam systemAsyncTaskInfoCreateParam + = new SystemAsyncTaskInfoCreateParam(); + systemAsyncTaskInfoCreateParam.setTransId(systemAsyncTaskInfo.getTransId()); + systemAsyncTaskInfoCreateParam.setTaskType(systemAsyncTaskInfo.getTaskType()); + systemAsyncTaskInfoCreateParam.setTaskParams(systemAsyncTaskInfo.getTaskParams()); + systemAsyncTaskInfoCreateParam.setBizType(systemAsyncTaskInfo.getBizType()); + systemAsyncTaskInfoCreateParam.setBizId(systemAsyncTaskInfo.getBizId()); + systemAsyncTaskInfoCreateParam.setCallSync(loadParam.isCallSync()); + systemAsyncTaskInfoCreateParam.setCallTiming(loadParam.getCallTiming()); + Proto voidProto = systemAsyncTaskInfoService.doCreate(systemAsyncTaskInfoCreateParam); + if (!voidProto.isSuccess()) { + throw voidProto.getErr(); + } + } + + @Transactional(rollbackFor = Throwable.class) + public void handleResetTask(SystemAsyncTaskInfoResetParam loadParam) throws Throwable { + SystemAsyncTaskInfoExample runningTaskExample + = new SystemAsyncTaskInfoExample(); + runningTaskExample.createCriteria() + .andOptStatusEqualTo(SystemAsyncTaskInfoOptStatusEnum.RUNNING.getValue()); + List systemAsyncTaskInfoList + = systemAsyncTaskInfoRepository.getList(runningTaskExample); + for (SystemAsyncTaskInfo systemAsyncTaskInfo : systemAsyncTaskInfoList) { + systemAsyncTaskInfo.setOptStatus(SystemAsyncTaskInfoOptStatusEnum.WAIL_RETRY.getValue()); + systemAsyncTaskInfo.setCallTiming(new Date().getTime()); + long resetUpdate = systemAsyncTaskInfoRepository.update(systemAsyncTaskInfo); + if (resetUpdate <= 0) { + throw ActionState.getRequestToFrequentError(); + } + } + } + + public void handleClear(SystemAsyncTaskInfoClearParam loadParam) throws Throwable { + // 大于24小时的已完成的异步任务,定时清除记录 + SystemAsyncTaskInfoExample clearTaskExample + = new SystemAsyncTaskInfoExample(); + clearTaskExample.createCriteria() + .andCreateTimeLessThanOrEqualTo(new Date(new Date().getTime() + - 24 * 60 * 60 * 1000L)) + .andOptStatusEqualTo(SystemAsyncTaskInfoOptStatusEnum.FULFILLED.getValue()); + long count = systemAsyncTaskInfoRepository.count(clearTaskExample); + if (count > 0) { + systemAsyncTaskInfoRepository.deleteAll(clearTaskExample, true); + } + } + + @Transactional(rollbackFor = Throwable.class) + public void handleTick(SystemAsyncTaskInfoTickParam loadParam) throws Throwable { + Tape.getService(IModuleAsync.class).doAsyncTask(loadParam, new AsyncHandler() { + + @Override + public ThreadPoolTaskExecutor taskExecutor() { + return asyncTaskExecutor; + } + + @Override + public long sleepTime() throws Throwable { + return 500L; + } + + @Override + public void doExecute(SystemAsyncTaskInfo taskInfo) throws Throwable { + if (taskInfo == null) { + throw new ActionState("找不到任务信息"); + } + try { + JSONObject taskParams = new JSONObject(); + try { + taskParams = JSONObject.parseObject(taskInfo.getTaskParams()); + } catch (Throwable ignored) { + } + IAsyncTaskHandler.TaskProgressive taskProgressive + = new IAsyncTaskHandler.TaskProgressive<>(taskInfo) { + @Override + public void onProgressSubmit() throws Throwable { + // 重新获取任务信息,避免并发问题 + SystemAsyncTaskInfo taskInfo = systemAsyncTaskInfoRepository + .findValidById(getTaskInfo().getGuid()); + if (taskInfo.getOptStatus() == SystemAsyncTaskInfoOptStatusEnum.CANCELING.getValue()) { + setCanceling(); + } + taskInfo.setUseTime(new Date().getTime() - getStartTime()); + taskInfo.setTotalCount(getTotalCount()); + taskInfo.setSuccessCount(getSuccessCount()); + taskInfo.setFailureCount(getFailureCount()); + taskInfo.setIgnoreCount(getIgnoreCount()); + // 将日志取出打印 + printLogger(taskInfo.getGuid(), String.join("\n", getRunLogs())); + // 清除日志记录 + clearLogs(); + // 检测任务是否结束 + if (isFulfilled()) { + taskInfo.setEndTime(new Date().getTime()); + if (isCanceled()) { + taskInfo.setOptStatus(SystemAsyncTaskInfoOptStatusEnum.CANCELED.getValue()); + } else { + taskInfo.setOptStatus(SystemAsyncTaskInfoOptStatusEnum.FULFILLED.getValue()); + } + } + int fulfilled = systemAsyncTaskInfoRepository.update(taskInfo); + if (fulfilled <= 0) { + throw ActionState.getRequestToFrequentError(); + } + } + }; + // 开始执行 + Tape.getService(IModuleFactory.class) + .get(IAsyncTaskHandler.class, taskInfo.getTaskType()) + .doTask(taskParams, taskProgressive); + // 提交结果 + taskProgressive.setFulfilled(); + taskProgressive.commitSubmit(); + } catch (Throwable e) { + // 重新获取任务信息,避免并发问题 + taskInfo = systemAsyncTaskInfoRepository.findValidById(taskInfo.getGuid()); + taskInfo.setRetryCount(taskInfo.getRetryCount() + 1); + int maxRetryCount = 5; + if (taskInfo.getRetryCount() <= maxRetryCount) { + // 约:5秒, 40秒,2分钟,5分钟,10分钟 + long time = 5000L * taskInfo.getRetryCount() + * taskInfo.getRetryCount() * taskInfo.getRetryCount(); + taskInfo.setCallTiming(new Date().getTime() + time); + taskInfo.setOptStatus(SystemAsyncTaskInfoOptStatusEnum.WAIL_RETRY.getValue()); + String runLogs = "[" + taskInfo.getRetryCount() + "/" + maxRetryCount + "] Execution failed, retry in " + + ((int) time / 1000L) + " seconds. " + ThrowableUtil.getStackTraceToString(e); + printLogger(taskInfo.getGuid(), runLogs); + } else { + String runLogs = "[" + taskInfo.getRetryCount() + "/" + maxRetryCount + " Execution failed, retry in 3 seconds. " + + ThrowableUtil.getStackTraceToString(e); + taskInfo.setOptStatus(SystemAsyncTaskInfoOptStatusEnum.FULFILLED.getValue()); + printLogger(taskInfo.getGuid(), runLogs); + } + systemAsyncTaskInfoRepository.update(taskInfo); + } + } + + @Override + public void onComplete(SystemAsyncTaskInfoTickParam params) throws Throwable { + // 继续执行下一个任务 + SystemAsyncTaskInfoTickParam systemAsyncTaskInfoStartAsyncParam + = new SystemAsyncTaskInfoTickParam(); + systemAsyncTaskInfoStartAsyncParam.setThrowThrowable(true); + Proto voidProto = systemAsyncTaskInfoService.doTick(systemAsyncTaskInfoStartAsyncParam); + if (!voidProto.isSuccess()) { + throw voidProto.getErr(); + } + } + + @Override + public List loadTasks(SystemAsyncTaskInfoTickParam params, int poolSize) throws Throwable { + SystemAsyncTaskInfoExample pendingTaskExample + = new SystemAsyncTaskInfoExample(); + pendingTaskExample.createCriteria() + .andCallTimingLessThanOrEqualTo(new Date().getTime()) + .andOptStatusIn(Arrays.asList(SystemAsyncTaskInfoOptStatusEnum.PENDING.getValue(), + SystemAsyncTaskInfoOptStatusEnum.WAIL_RETRY.getValue())); + pendingTaskExample.usePage(1, poolSize); + pendingTaskExample.setOrderByClause("call_timing asc,create_time asc"); + List systemAsyncTaskInfoList + = systemAsyncTaskInfoRepository.getList(pendingTaskExample); + if (systemAsyncTaskInfoList == null || systemAsyncTaskInfoList.isEmpty()) { + return new ArrayList<>(); + } + SystemAsyncTaskInfoExample updateExample = new SystemAsyncTaskInfoExample(); + updateExample.createCriteria() + .andGuidIn(ArrayUtil.map(systemAsyncTaskInfoList, new ArrayUtil.MapHandler() { + @Override + public Long map(SystemAsyncTaskInfo systemAsyncTaskInfo) { + return systemAsyncTaskInfo.getGuid(); + } + })); + SystemAsyncTaskInfo systemAsyncTaskInfo = new SystemAsyncTaskInfo(); + systemAsyncTaskInfo.setStartTime(new Date().getTime()); + systemAsyncTaskInfo.setOptStatus(SystemAsyncTaskInfoOptStatusEnum.RUNNING.getValue()); + systemAsyncTaskInfoRepository.updateByExampleSelective(systemAsyncTaskInfo, updateExample); + return systemAsyncTaskInfoList; + } + + }); + } + + public void printLogger(Long taskGuid, String logContent) { + // 打印日志到文件 + LogUtil.printLog(taskGuid + "", logContent); + } + + public void handleSchedule(SystemAsyncTaskInfoScheduleParam loadParam) throws Throwable { + Tape.getService(IModuleAsync.class).doScheduleTask(new AsyncScheduler() { + @Override + public ThreadPoolTaskExecutor taskExecutor() { + return asyncTaskExecutor; + } + + @Override + public void scheduleTask() throws Throwable { + // 自动定时任务逻辑 + List asyncTaskDiscoverList + = Tape.getService(IModuleFactory.class) + .getList(IAsyncTaskScheduler.class); + for (IAsyncTaskScheduler asyncTaskDiscover : asyncTaskDiscoverList) { + String key = asyncTaskDiscover.getClass().getName(); + Long lastScheduleQueryTime = asyncTaskScheduleTime.get(key); + if (lastScheduleQueryTime == null) { + lastScheduleQueryTime = 0L; + } + long sleepTime = asyncTaskDiscover.sleepTime(); + if (new Date().getTime() - lastScheduleQueryTime < sleepTime) { + continue; + } + asyncTaskScheduleTime.put(key, new Date().getTime()); + asyncTaskDiscover.doScheduler(); + } + } + + }); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/domain/transactionals/SystemGlobalFileTransactional.java b/src/main/java/com/iqudoo/platform/application/domain/transactionals/SystemGlobalFileTransactional.java new file mode 100644 index 0000000..f637642 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/domain/transactionals/SystemGlobalFileTransactional.java @@ -0,0 +1,164 @@ +package com.iqudoo.platform.application.domain.transactionals; + +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.base.action.bean.ActionState; +import com.iqudoo.framework.tape.modules.IModuleFactory; +import com.iqudoo.framework.tape.modules.IModuleSetting; +import com.iqudoo.framework.tape.modules.asserts.AssertUtil; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.framework.tape.modules.utils.ArrayUtil; +import com.iqudoo.framework.tape.modules.utils.Base64Util; +import com.iqudoo.framework.tape.modules.utils.DigestUtil; +import com.iqudoo.framework.tape.modules.utils.FileUtil; +import com.iqudoo.platform.application.database.model.SystemGlobalFileTransfer; +import com.iqudoo.platform.application.database.model.SystemGlobalFileTransferExample; +import com.iqudoo.platform.application.facade.enums.SystemGlobalFileUploadFileTypeEnum; +import com.iqudoo.platform.application.facade.provider.IFileUploadProvider; +import com.iqudoo.platform.application.facade.repository.ISystemGlobalFileTransferRepository; +import com.iqudoo.platform.application.facade.request.SystemGlobalFileTransferParam; +import com.iqudoo.platform.application.facade.request.SystemGlobalFileUploadParam; +import com.iqudoo.platform.application.facade.response.SystemGlobalFileTransferResponse; +import com.iqudoo.platform.application.facade.response.SystemGlobalFileUploadResponse; +import com.iqudoo.platform.application.facade.service.ISystemGlobalFileService; +import com.iqudoo.platform.application.setting.SystemGlobalFileUploadConfig; +import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +@SuppressWarnings("DuplicatedCode") +@Component +public class SystemGlobalFileTransactional { + + @Resource + private ISystemGlobalFileTransferRepository systemGlobalFileTransferRepository; + @Resource + private ISystemGlobalFileService systemGlobalFileService; + + @Transactional(rollbackFor = Throwable.class) + public SystemGlobalFileUploadResponse handleFileUpload(SystemGlobalFileUploadParam loadParam) throws Throwable { + AssertUtil.oneNotInvalid(loadParam.getFileName(), "文件名称不能为空"); + AssertUtil.oneNotInvalid(loadParam.getType(), "文件类型不能为空"); + SystemGlobalFileUploadFileTypeEnum fileType + = SystemGlobalFileUploadFileTypeEnum.getByValue(loadParam.getType()); + if (fileType == null) { + throw new ActionState("无效的文件类型"); + } + SystemGlobalFileUploadConfig fileUploadConfig + = Tape.getService(IModuleSetting.class) + .getSetting(SystemGlobalFileUploadConfig.class); + if (!fileUploadConfig.isEnableFlag()) { + throw new ActionState("系统未启用资源文件上传配置"); + } + byte[] fileBytes; + if (loadParam.getFileBytes() != null && loadParam.getFileBytes().length > 0) { + fileBytes = loadParam.getFileBytes(); + } else if (loadParam.getFileBase64() != null && !loadParam.getFileBase64().isEmpty()) { + fileBytes = Base64Util.decode(loadParam.getFileBase64()); + } else { + throw new ActionState("文件内容不能为空"); + } + String fileHashValue = DigestUtil.md5DigestAsHex(fileBytes); + String folderName = loadParam.getFolderName(); + if (folderName == null || folderName.isEmpty()) { + folderName = "file"; + } + String lastName = fileHashValue + FileUtil.getFileSuffix(loadParam.getFileName()); + String targetPath = folderName + "/" + fileType.getValue() + "/" + lastName; + String url = Tape.getService(IModuleFactory.class).get(IFileUploadProvider.class, + fileUploadConfig.getSaveType()) + .upload(fileUploadConfig, fileBytes, targetPath); + SystemGlobalFileUploadResponse response = new SystemGlobalFileUploadResponse(); + response.setUrl(url); + response.setFileName(loadParam.getFileName()); + return response; + } + + public SystemGlobalFileTransferResponse handleFileTransfer(SystemGlobalFileTransferParam loadParam) throws Throwable { + if (loadParam.getUrls() == null || loadParam.getUrls().isEmpty()) { + // 地址列表为空 + SystemGlobalFileTransferResponse systemGlobalFileTransferResponse + = new SystemGlobalFileTransferResponse(); + systemGlobalFileTransferResponse.setSavedUrls(new ArrayList<>()); + return systemGlobalFileTransferResponse; + } + SystemGlobalFileUploadConfig fileUploadConfig + = Tape.getService(IModuleSetting.class) + .getSetting(SystemGlobalFileUploadConfig.class); + if (!fileUploadConfig.isEnableFlag()) { + // 未开启文件上传 + SystemGlobalFileTransferResponse systemGlobalFileTransferResponse + = new SystemGlobalFileTransferResponse(); + systemGlobalFileTransferResponse.setSavedUrls(loadParam.getUrls()); + return systemGlobalFileTransferResponse; + } + SystemGlobalFileTransferResponse response = new SystemGlobalFileTransferResponse(); + List savedUrls = new ArrayList<>(); + for (String url : loadParam.getUrls()) { + if (url == null || url.isEmpty()) { + // 跳过空地址 + continue; + } + String[] delimiter = new String[]{"\n", ","}; + List whiteList = ArrayUtil.split(fileUploadConfig.getFileTransferDomainWhiteList(), delimiter); + String fileDomain = Objects.equals(fileUploadConfig.getSaveType(), "local") ? fileUploadConfig.getLocalDomainName() : + fileUploadConfig.getAliOssDomainName(); + boolean inWhite = url.contains(fileDomain) || ArrayUtil.hasIf(whiteList, new ArrayUtil.FilterHandler() { + @Override + public boolean filter(String s) { + return s != null && !s.isEmpty() && url.contains(s); + } + }); + if (inWhite) { + savedUrls.add(url); + } else { + SystemGlobalFileTransferExample systemGlobalFileTransferExample + = new SystemGlobalFileTransferExample(); + systemGlobalFileTransferExample.createCriteria() + .andOriginalUrlEqualTo(url); + SystemGlobalFileTransfer systemGlobalFileTransfer = systemGlobalFileTransferRepository + .findOne(systemGlobalFileTransferExample); + if (systemGlobalFileTransfer == null) { + // 未找到转存记录,则下载文件内容并上传到OSS中 + FileUtil.FileData data = FileUtil.getFileData(url); + long fileLength = data.getFileBytes().length; + String fileHash = DigestUtil.md5DigestAsHex(data.getFileBytes()); + SystemGlobalFileTransferExample checkFileHashExample + = new SystemGlobalFileTransferExample(); + checkFileHashExample.createCriteria() + .andFileHashEqualTo(fileHash); + SystemGlobalFileTransfer equalFileHashFile = systemGlobalFileTransferRepository + .findOne(checkFileHashExample); + String savedUrl; + if (equalFileHashFile != null) { + savedUrl = equalFileHashFile.getSavedUrl(); + } else { + SystemGlobalFileUploadParam uploadParam + = new SystemGlobalFileUploadParam(); + Proto systemGlobalFileUploadResponseProto + = systemGlobalFileService.doFileUpload(uploadParam); + if (!systemGlobalFileUploadResponseProto.isSuccess()) { + throw systemGlobalFileUploadResponseProto.getErr(); + } + savedUrl = systemGlobalFileUploadResponseProto.getData().getUrl(); + } + systemGlobalFileTransfer = new SystemGlobalFileTransfer(); + systemGlobalFileTransfer.setOriginalUrl(url); + systemGlobalFileTransfer.setSavedUrl(savedUrl); + systemGlobalFileTransfer.setFileSize(fileLength); + systemGlobalFileTransfer.setFileHash(fileHash); + systemGlobalFileTransfer = systemGlobalFileTransferRepository.insert(systemGlobalFileTransfer); + } + if (systemGlobalFileTransfer != null) { + savedUrls.add(systemGlobalFileTransfer.getSavedUrl()); + } + } + } + response.setSavedUrls(savedUrls); + return response; + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/base/BaseParam.java b/src/main/java/com/iqudoo/platform/application/facade/base/BaseParam.java new file mode 100644 index 0000000..9534956 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/base/BaseParam.java @@ -0,0 +1,28 @@ +package com.iqudoo.platform.application.facade.base; + +import com.iqudoo.framework.tape.base.action.bean.ActionParam; +import com.iqudoo.platform.application.database.model.SystemAdminInfo; + +@SuppressWarnings({"LombokGetterMayBeUsed", "LombokSetterMayBeUsed"}) +public class BaseParam extends ActionParam { + + private String[] tag; + private SystemAdminInfo currentSystemAdminInfo; + + public String[] getTag() { + return tag; + } + + public void setTag(String[] tag) { + this.tag = tag; + } + + public SystemAdminInfo getCurrentSystemAdminInfo() { + return currentSystemAdminInfo; + } + + public void setCurrentSystemAdminInfo(SystemAdminInfo currentSystemAdminInfo) { + this.currentSystemAdminInfo = currentSystemAdminInfo; + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/enums/AuthTokenGroupEnum.java b/src/main/java/com/iqudoo/platform/application/facade/enums/AuthTokenGroupEnum.java new file mode 100644 index 0000000..3192c3d --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/enums/AuthTokenGroupEnum.java @@ -0,0 +1,39 @@ +package com.iqudoo.platform.application.facade.enums; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocEnumConfiguration; +import com.iqudoo.platform.application.constants.BizConstants; + +import java.util.Objects; + +@ApiDocEnumConfiguration +@SuppressWarnings({"LombokGetterMayBeUsed", "unused"}) +public enum AuthTokenGroupEnum { + + SYS_ADMIN(BizConstants.AUTH_GROUP_SYS_ADMIN, "系统管理员"); + + public static AuthTokenGroupEnum getByValue(String value) { + for (AuthTokenGroupEnum enumObj : values()) { + if (Objects.equals(enumObj.getValue(), value)) { + return enumObj; + } + } + return null; + } + + private final String value; + private final String desc; + + AuthTokenGroupEnum(String value, String desc) { + this.value = value; + this.desc = desc; + } + + public String getValue() { + return value; + } + + public String getDesc() { + return desc; + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/enums/SystemAdminInfoOptStatusEnum.java b/src/main/java/com/iqudoo/platform/application/facade/enums/SystemAdminInfoOptStatusEnum.java new file mode 100644 index 0000000..15bc479 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/enums/SystemAdminInfoOptStatusEnum.java @@ -0,0 +1,37 @@ +package com.iqudoo.platform.application.facade.enums; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocEnumConfiguration; + +@ApiDocEnumConfiguration +@SuppressWarnings("LombokGetterMayBeUsed") +public enum SystemAdminInfoOptStatusEnum { + + DISABLE(0, "禁用"), + ENABLE(1, "启用"); + + public static SystemAdminInfoOptStatusEnum getByValue(Integer value) { + for (SystemAdminInfoOptStatusEnum enumObj : values()) { + if (enumObj.getValue() == value) { + return enumObj; + } + } + return null; + } + + private final int value; + private final String desc; + + SystemAdminInfoOptStatusEnum(int value, String desc) { + this.value = value; + this.desc = desc; + } + + public int getValue() { + return value; + } + + public String getDesc() { + return desc; + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/enums/SystemAdminInfoOptSuperEnum.java b/src/main/java/com/iqudoo/platform/application/facade/enums/SystemAdminInfoOptSuperEnum.java new file mode 100644 index 0000000..56f3ae4 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/enums/SystemAdminInfoOptSuperEnum.java @@ -0,0 +1,37 @@ +package com.iqudoo.platform.application.facade.enums; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocEnumConfiguration; + +@ApiDocEnumConfiguration +@SuppressWarnings("LombokGetterMayBeUsed") +public enum SystemAdminInfoOptSuperEnum { + + NONE(0, ""), + SUPER(1, "超级管理员"); + + public static SystemAdminInfoOptSuperEnum getByValue(Integer value) { + for (SystemAdminInfoOptSuperEnum enumObj : values()) { + if (enumObj.getValue() == value) { + return enumObj; + } + } + return null; + } + + private final int value; + private final String desc; + + SystemAdminInfoOptSuperEnum(int value, String desc) { + this.value = value; + this.desc = desc; + } + + public int getValue() { + return value; + } + + public String getDesc() { + return desc; + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/enums/SystemAsyncTaskInfoOptStatusEnum.java b/src/main/java/com/iqudoo/platform/application/facade/enums/SystemAsyncTaskInfoOptStatusEnum.java new file mode 100644 index 0000000..3d9bf1d --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/enums/SystemAsyncTaskInfoOptStatusEnum.java @@ -0,0 +1,41 @@ +package com.iqudoo.platform.application.facade.enums; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocEnumConfiguration; + +@ApiDocEnumConfiguration +@SuppressWarnings("LombokGetterMayBeUsed") +public enum SystemAsyncTaskInfoOptStatusEnum { + + PENDING(0, "待处理"), + RUNNING(1, "处理中"), + FULFILLED(2, "已结束"), + WAIL_RETRY(3, "待重试"), + CANCELING(4, "取消中"), + CANCELED(5, "已取消"); + + public static SystemAsyncTaskInfoOptStatusEnum getByValue(Integer value) { + for (SystemAsyncTaskInfoOptStatusEnum enumObj : values()) { + if (enumObj.getValue() == value) { + return enumObj; + } + } + return null; + } + + private final int value; + private final String desc; + + SystemAsyncTaskInfoOptStatusEnum(int value, String desc) { + this.value = value; + this.desc = desc; + } + + public int getValue() { + return value; + } + + public String getDesc() { + return desc; + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/enums/SystemGlobalFileUploadFileTypeEnum.java b/src/main/java/com/iqudoo/platform/application/facade/enums/SystemGlobalFileUploadFileTypeEnum.java new file mode 100644 index 0000000..1253831 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/enums/SystemGlobalFileUploadFileTypeEnum.java @@ -0,0 +1,41 @@ +package com.iqudoo.platform.application.facade.enums; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocEnumConfiguration; + +import java.util.Objects; + +@ApiDocEnumConfiguration +@SuppressWarnings("LombokGetterMayBeUsed") +public enum SystemGlobalFileUploadFileTypeEnum { + + IMAGE("image", "图片"), + VIDEO("video", "视频"), + DOCUMENT("document", "文档"), + FILE("file", "文本"); + + public static SystemGlobalFileUploadFileTypeEnum getByValue(String value) { + for (SystemGlobalFileUploadFileTypeEnum enumObj : values()) { + if (Objects.equals(enumObj.getValue(), value)) { + return enumObj; + } + } + return null; + } + + private final String value; + private final String desc; + + SystemGlobalFileUploadFileTypeEnum(String value, String desc) { + this.value = value; + this.desc = desc; + } + + public String getValue() { + return value; + } + + public String getDesc() { + return desc; + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/excel/exportModel/package-info.java b/src/main/java/com/iqudoo/platform/application/facade/excel/exportModel/package-info.java new file mode 100644 index 0000000..022f912 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/excel/exportModel/package-info.java @@ -0,0 +1 @@ +package com.iqudoo.platform.application.facade.excel.exportModel; \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/facade/excel/importModel/package-info.java b/src/main/java/com/iqudoo/platform/application/facade/excel/importModel/package-info.java new file mode 100644 index 0000000..899e3c1 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/excel/importModel/package-info.java @@ -0,0 +1 @@ +package com.iqudoo.platform.application.facade.excel.importModel; \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/facade/provider/IFileUploadProvider.java b/src/main/java/com/iqudoo/platform/application/facade/provider/IFileUploadProvider.java new file mode 100644 index 0000000..10e81e1 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/provider/IFileUploadProvider.java @@ -0,0 +1,9 @@ +package com.iqudoo.platform.application.facade.provider; + +import com.iqudoo.platform.application.setting.SystemGlobalFileUploadConfig; + +public interface IFileUploadProvider { + + String upload(SystemGlobalFileUploadConfig config, byte[] fileBytes, String targetPath) throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/provider/IPaymentProvider.java b/src/main/java/com/iqudoo/platform/application/facade/provider/IPaymentProvider.java new file mode 100644 index 0000000..376a038 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/provider/IPaymentProvider.java @@ -0,0 +1,144 @@ +package com.iqudoo.platform.application.facade.provider; + +public interface IPaymentProvider { + + @SuppressWarnings("LombokGetterMayBeUsed") + enum PaymentStatus { + + WAITING(0), + SUCCESS(1), + FAIL(2), + CLOSED(3); + + + private final int value; + + PaymentStatus(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + } + + + @SuppressWarnings("LombokGetterMayBeUsed") + enum RefundStatus { + + WAITING(0), + SUCCESS(1), + FAIL(2); + + + private final int value; + + RefundStatus(int value) { + this.value = value; + } + + public int getValue() { + return value; + } + } + + @SuppressWarnings({"LombokGetterMayBeUsed", "LombokSetterMayBeUsed"}) + class PaymentResult { + // 支付APP_ID + private String channelId; + // 支付单号 + private String transactionId; + // 支付状态 + private PaymentStatus status; + // 原始结果 + private String rawResult; + + public String getChannelId() { + return channelId; + } + + public void setChannelId(String channelId) { + this.channelId = channelId; + } + + public String getTransactionId() { + return transactionId; + } + + public void setTransactionId(String transactionId) { + this.transactionId = transactionId; + } + + public PaymentStatus getStatus() { + return status; + } + + public void setStatus(PaymentStatus status) { + this.status = status; + } + + public String getRawResult() { + return rawResult; + } + + public void setRawResult(String rawResult) { + this.rawResult = rawResult; + } + } + + @SuppressWarnings({"LombokGetterMayBeUsed", "LombokSetterMayBeUsed"}) + class RefundResult { + // 支付APP_ID + private String channelId; + // 退款单号 + private String refundId; + // 退款状态 + private RefundStatus status; + // 原始结果 + private String rawResult; + + public String getChannelId() { + return channelId; + } + + public void setChannelId(String channelId) { + this.channelId = channelId; + } + + public String getRefundId() { + return refundId; + } + + public void setRefundId(String refundId) { + this.refundId = refundId; + } + + public RefundStatus getStatus() { + return status; + } + + public void setStatus(RefundStatus status) { + this.status = status; + } + + public String getRawResult() { + return rawResult; + } + + public void setRawResult(String rawResult) { + this.rawResult = rawResult; + } + + } + + String createPayment(Long paymentGuid) throws Throwable; + + PaymentResult queryPaymentResult(Long paymentGuid) throws Throwable; + + void closePayment(Long paymentGuid) throws Throwable; + + void createRefund(Long refundGuid) throws Throwable; + + RefundResult queryRefund(Long refundGuid) throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/provider/IPermissionProvider.java b/src/main/java/com/iqudoo/platform/application/facade/provider/IPermissionProvider.java new file mode 100644 index 0000000..2a4a404 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/provider/IPermissionProvider.java @@ -0,0 +1,12 @@ +package com.iqudoo.platform.application.facade.provider; + +import com.iqudoo.framework.tape.base.action.bean.ActionAuthInfo; +import com.iqudoo.framework.tape.base.action.bean.ActionParam; + +public interface IPermissionProvider { + + void checkPermission(ActionAuthInfo actionAuthInfo, ActionParam actionParam) throws Throwable; + + void checkSessionKey(ActionAuthInfo actionAuthInfo) throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/provider/package-info.java b/src/main/java/com/iqudoo/platform/application/facade/provider/package-info.java new file mode 100644 index 0000000..ea58e97 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/provider/package-info.java @@ -0,0 +1 @@ +package com.iqudoo.platform.application.facade.provider; \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/facade/repository/ISystemAdminInfoRepository.java b/src/main/java/com/iqudoo/platform/application/facade/repository/ISystemAdminInfoRepository.java new file mode 100644 index 0000000..9e77b4f --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/repository/ISystemAdminInfoRepository.java @@ -0,0 +1,41 @@ +package com.iqudoo.platform.application.facade.repository; + +import com.iqudoo.platform.application.database.model.SystemAdminInfo; +import com.iqudoo.platform.application.database.model.SystemAdminInfoExample; +import java.util.List; + +public interface ISystemAdminInfoRepository { + int trashById(long id) throws Throwable; + + int trashAll(SystemAdminInfoExample example) throws Throwable; + + int deleteById(long id, boolean release) throws Throwable; + + int deleteAll(SystemAdminInfoExample example, boolean release) throws Throwable; + + int recoverById(long id) throws Throwable; + + int recoverAll(SystemAdminInfoExample example) throws Throwable; + + SystemAdminInfo findAnyById(long id) throws Throwable; + + SystemAdminInfo findValidById(long id) throws Throwable; + + SystemAdminInfo findTrashById(long id) throws Throwable; + + SystemAdminInfo findOne(SystemAdminInfoExample example) throws Throwable; + + List getList(SystemAdminInfoExample example) throws Throwable; + + long count(SystemAdminInfoExample example) throws Throwable; + + long countWithPage(SystemAdminInfoExample example) throws Throwable; + + SystemAdminInfo insert(SystemAdminInfo record) throws Throwable; + + List batchInsert(List records) throws Throwable; + + int update(SystemAdminInfo record) throws Throwable; + + int updateByExampleSelective(SystemAdminInfo record, SystemAdminInfoExample example) throws Throwable; +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/facade/repository/ISystemAsyncTaskInfoRepository.java b/src/main/java/com/iqudoo/platform/application/facade/repository/ISystemAsyncTaskInfoRepository.java new file mode 100644 index 0000000..66cf295 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/repository/ISystemAsyncTaskInfoRepository.java @@ -0,0 +1,41 @@ +package com.iqudoo.platform.application.facade.repository; + +import com.iqudoo.platform.application.database.model.SystemAsyncTaskInfo; +import com.iqudoo.platform.application.database.model.SystemAsyncTaskInfoExample; +import java.util.List; + +public interface ISystemAsyncTaskInfoRepository { + int trashById(long id) throws Throwable; + + int trashAll(SystemAsyncTaskInfoExample example) throws Throwable; + + int deleteById(long id, boolean release) throws Throwable; + + int deleteAll(SystemAsyncTaskInfoExample example, boolean release) throws Throwable; + + int recoverById(long id) throws Throwable; + + int recoverAll(SystemAsyncTaskInfoExample example) throws Throwable; + + SystemAsyncTaskInfo findAnyById(long id) throws Throwable; + + SystemAsyncTaskInfo findValidById(long id) throws Throwable; + + SystemAsyncTaskInfo findTrashById(long id) throws Throwable; + + SystemAsyncTaskInfo findOne(SystemAsyncTaskInfoExample example) throws Throwable; + + List getList(SystemAsyncTaskInfoExample example) throws Throwable; + + long count(SystemAsyncTaskInfoExample example) throws Throwable; + + long countWithPage(SystemAsyncTaskInfoExample example) throws Throwable; + + SystemAsyncTaskInfo insert(SystemAsyncTaskInfo record) throws Throwable; + + List batchInsert(List records) throws Throwable; + + int update(SystemAsyncTaskInfo record) throws Throwable; + + int updateByExampleSelective(SystemAsyncTaskInfo record, SystemAsyncTaskInfoExample example) throws Throwable; +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/facade/repository/ISystemCrawlerCacheDataRepository.java b/src/main/java/com/iqudoo/platform/application/facade/repository/ISystemCrawlerCacheDataRepository.java new file mode 100644 index 0000000..bd4d5d5 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/repository/ISystemCrawlerCacheDataRepository.java @@ -0,0 +1,41 @@ +package com.iqudoo.platform.application.facade.repository; + +import com.iqudoo.platform.application.database.model.SystemCrawlerCacheData; +import com.iqudoo.platform.application.database.model.SystemCrawlerCacheDataExample; +import java.util.List; + +public interface ISystemCrawlerCacheDataRepository { + int trashById(long id) throws Throwable; + + int trashAll(SystemCrawlerCacheDataExample example) throws Throwable; + + int deleteById(long id, boolean release) throws Throwable; + + int deleteAll(SystemCrawlerCacheDataExample example, boolean release) throws Throwable; + + int recoverById(long id) throws Throwable; + + int recoverAll(SystemCrawlerCacheDataExample example) throws Throwable; + + SystemCrawlerCacheData findAnyById(long id) throws Throwable; + + SystemCrawlerCacheData findValidById(long id) throws Throwable; + + SystemCrawlerCacheData findTrashById(long id) throws Throwable; + + SystemCrawlerCacheData findOne(SystemCrawlerCacheDataExample example) throws Throwable; + + List getList(SystemCrawlerCacheDataExample example) throws Throwable; + + long count(SystemCrawlerCacheDataExample example) throws Throwable; + + long countWithPage(SystemCrawlerCacheDataExample example) throws Throwable; + + SystemCrawlerCacheData insert(SystemCrawlerCacheData record) throws Throwable; + + List batchInsert(List records) throws Throwable; + + int update(SystemCrawlerCacheData record) throws Throwable; + + int updateByExampleSelective(SystemCrawlerCacheData record, SystemCrawlerCacheDataExample example) throws Throwable; +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/facade/repository/ISystemGlobalCacheRepository.java b/src/main/java/com/iqudoo/platform/application/facade/repository/ISystemGlobalCacheRepository.java new file mode 100644 index 0000000..9f956cd --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/repository/ISystemGlobalCacheRepository.java @@ -0,0 +1,41 @@ +package com.iqudoo.platform.application.facade.repository; + +import com.iqudoo.platform.application.database.model.SystemGlobalCache; +import com.iqudoo.platform.application.database.model.SystemGlobalCacheExample; +import java.util.List; + +public interface ISystemGlobalCacheRepository { + int trashById(long id) throws Throwable; + + int trashAll(SystemGlobalCacheExample example) throws Throwable; + + int deleteById(long id, boolean release) throws Throwable; + + int deleteAll(SystemGlobalCacheExample example, boolean release) throws Throwable; + + int recoverById(long id) throws Throwable; + + int recoverAll(SystemGlobalCacheExample example) throws Throwable; + + SystemGlobalCache findAnyById(long id) throws Throwable; + + SystemGlobalCache findValidById(long id) throws Throwable; + + SystemGlobalCache findTrashById(long id) throws Throwable; + + SystemGlobalCache findOne(SystemGlobalCacheExample example) throws Throwable; + + List getList(SystemGlobalCacheExample example) throws Throwable; + + long count(SystemGlobalCacheExample example) throws Throwable; + + long countWithPage(SystemGlobalCacheExample example) throws Throwable; + + SystemGlobalCache insert(SystemGlobalCache record) throws Throwable; + + List batchInsert(List records) throws Throwable; + + int update(SystemGlobalCache record) throws Throwable; + + int updateByExampleSelective(SystemGlobalCache record, SystemGlobalCacheExample example) throws Throwable; +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/facade/repository/ISystemGlobalFileTransferRepository.java b/src/main/java/com/iqudoo/platform/application/facade/repository/ISystemGlobalFileTransferRepository.java new file mode 100644 index 0000000..f007be3 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/repository/ISystemGlobalFileTransferRepository.java @@ -0,0 +1,41 @@ +package com.iqudoo.platform.application.facade.repository; + +import com.iqudoo.platform.application.database.model.SystemGlobalFileTransfer; +import com.iqudoo.platform.application.database.model.SystemGlobalFileTransferExample; +import java.util.List; + +public interface ISystemGlobalFileTransferRepository { + int trashById(long id) throws Throwable; + + int trashAll(SystemGlobalFileTransferExample example) throws Throwable; + + int deleteById(long id, boolean release) throws Throwable; + + int deleteAll(SystemGlobalFileTransferExample example, boolean release) throws Throwable; + + int recoverById(long id) throws Throwable; + + int recoverAll(SystemGlobalFileTransferExample example) throws Throwable; + + SystemGlobalFileTransfer findAnyById(long id) throws Throwable; + + SystemGlobalFileTransfer findValidById(long id) throws Throwable; + + SystemGlobalFileTransfer findTrashById(long id) throws Throwable; + + SystemGlobalFileTransfer findOne(SystemGlobalFileTransferExample example) throws Throwable; + + List getList(SystemGlobalFileTransferExample example) throws Throwable; + + long count(SystemGlobalFileTransferExample example) throws Throwable; + + long countWithPage(SystemGlobalFileTransferExample example) throws Throwable; + + SystemGlobalFileTransfer insert(SystemGlobalFileTransfer record) throws Throwable; + + List batchInsert(List records) throws Throwable; + + int update(SystemGlobalFileTransfer record) throws Throwable; + + int updateByExampleSelective(SystemGlobalFileTransfer record, SystemGlobalFileTransferExample example) throws Throwable; +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/facade/repository/ISystemGlobalSessionRepository.java b/src/main/java/com/iqudoo/platform/application/facade/repository/ISystemGlobalSessionRepository.java new file mode 100644 index 0000000..27be45f --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/repository/ISystemGlobalSessionRepository.java @@ -0,0 +1,41 @@ +package com.iqudoo.platform.application.facade.repository; + +import com.iqudoo.platform.application.database.model.SystemGlobalSession; +import com.iqudoo.platform.application.database.model.SystemGlobalSessionExample; +import java.util.List; + +public interface ISystemGlobalSessionRepository { + int trashById(long id) throws Throwable; + + int trashAll(SystemGlobalSessionExample example) throws Throwable; + + int deleteById(long id, boolean release) throws Throwable; + + int deleteAll(SystemGlobalSessionExample example, boolean release) throws Throwable; + + int recoverById(long id) throws Throwable; + + int recoverAll(SystemGlobalSessionExample example) throws Throwable; + + SystemGlobalSession findAnyById(long id) throws Throwable; + + SystemGlobalSession findValidById(long id) throws Throwable; + + SystemGlobalSession findTrashById(long id) throws Throwable; + + SystemGlobalSession findOne(SystemGlobalSessionExample example) throws Throwable; + + List getList(SystemGlobalSessionExample example) throws Throwable; + + long count(SystemGlobalSessionExample example) throws Throwable; + + long countWithPage(SystemGlobalSessionExample example) throws Throwable; + + SystemGlobalSession insert(SystemGlobalSession record) throws Throwable; + + List batchInsert(List records) throws Throwable; + + int update(SystemGlobalSession record) throws Throwable; + + int updateByExampleSelective(SystemGlobalSession record, SystemGlobalSessionExample example) throws Throwable; +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/facade/repository/ISystemGlobalSettingRepository.java b/src/main/java/com/iqudoo/platform/application/facade/repository/ISystemGlobalSettingRepository.java new file mode 100644 index 0000000..138d412 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/repository/ISystemGlobalSettingRepository.java @@ -0,0 +1,41 @@ +package com.iqudoo.platform.application.facade.repository; + +import com.iqudoo.platform.application.database.model.SystemGlobalSetting; +import com.iqudoo.platform.application.database.model.SystemGlobalSettingExample; +import java.util.List; + +public interface ISystemGlobalSettingRepository { + int trashById(long id) throws Throwable; + + int trashAll(SystemGlobalSettingExample example) throws Throwable; + + int deleteById(long id, boolean release) throws Throwable; + + int deleteAll(SystemGlobalSettingExample example, boolean release) throws Throwable; + + int recoverById(long id) throws Throwable; + + int recoverAll(SystemGlobalSettingExample example) throws Throwable; + + SystemGlobalSetting findAnyById(long id) throws Throwable; + + SystemGlobalSetting findValidById(long id) throws Throwable; + + SystemGlobalSetting findTrashById(long id) throws Throwable; + + SystemGlobalSetting findOne(SystemGlobalSettingExample example) throws Throwable; + + List getList(SystemGlobalSettingExample example) throws Throwable; + + long count(SystemGlobalSettingExample example) throws Throwable; + + long countWithPage(SystemGlobalSettingExample example) throws Throwable; + + SystemGlobalSetting insert(SystemGlobalSetting record) throws Throwable; + + List batchInsert(List records) throws Throwable; + + int update(SystemGlobalSetting record) throws Throwable; + + int updateByExampleSelective(SystemGlobalSetting record, SystemGlobalSettingExample example) throws Throwable; +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoAuthEditPasswordParam.java b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoAuthEditPasswordParam.java new file mode 100644 index 0000000..b2fec13 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoAuthEditPasswordParam.java @@ -0,0 +1,22 @@ +package com.iqudoo.platform.application.facade.request; + + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.platform.application.facade.base.BaseParam; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class SystemAdminInfoAuthEditPasswordParam extends BaseParam { + + @ApiDocFieldConfiguration(desc = "GUID", required = true) + private Long guid; + + @ApiDocFieldConfiguration(desc = "旧的密码", required = true) + private String password; + + @ApiDocFieldConfiguration(desc = "新的密码", required = true) + private String newPassword; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoAuthEditProfileParam.java b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoAuthEditProfileParam.java new file mode 100644 index 0000000..4b5e28a --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoAuthEditProfileParam.java @@ -0,0 +1,19 @@ +package com.iqudoo.platform.application.facade.request; + + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.platform.application.facade.base.BaseParam; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class SystemAdminInfoAuthEditProfileParam extends BaseParam { + + @ApiDocFieldConfiguration(desc = "GUID", required = true) + private Long guid; + + @ApiDocFieldConfiguration(desc = "新的昵称", required = true) + private String nickname; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoAuthLoginParam.java b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoAuthLoginParam.java new file mode 100644 index 0000000..bf136a1 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoAuthLoginParam.java @@ -0,0 +1,19 @@ +package com.iqudoo.platform.application.facade.request; + + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.platform.application.facade.base.BaseParam; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class SystemAdminInfoAuthLoginParam extends BaseParam { + + @ApiDocFieldConfiguration(desc = "登录账号", required = true) + private String username; + + @ApiDocFieldConfiguration(desc = "账号密码", required = true) + private String password; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoCreateParam.java b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoCreateParam.java new file mode 100644 index 0000000..cdecf94 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoCreateParam.java @@ -0,0 +1,34 @@ +package com.iqudoo.platform.application.facade.request; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.platform.application.facade.base.BaseParam; +import com.iqudoo.platform.application.facade.enums.SystemAdminInfoOptStatusEnum; +import com.iqudoo.platform.application.facade.enums.SystemAdminInfoOptSuperEnum; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class SystemAdminInfoCreateParam extends BaseParam { + + @ApiDocFieldConfiguration(desc = "登录账号", required = true) + private String username; + + @ApiDocFieldConfiguration(desc = "账号昵称", required = true) + private String nickname; + + @ApiDocFieldConfiguration(desc = "账号密码", required = true) + private String password; + + @ApiDocFieldConfiguration(desc = "备注信息") + private String optRemark; + + @ApiDocFieldConfiguration(desc = "账号状态", + enumClass = SystemAdminInfoOptStatusEnum.class) + private Integer optStatus; + + @ApiDocFieldConfiguration(desc = "超管标志", + enumClass = SystemAdminInfoOptSuperEnum.class) + private Integer optSuper; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoDeleteParam.java b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoDeleteParam.java new file mode 100644 index 0000000..3f2b16f --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoDeleteParam.java @@ -0,0 +1,15 @@ +package com.iqudoo.platform.application.facade.request; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.platform.application.facade.base.BaseParam; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class SystemAdminInfoDeleteParam extends BaseParam { + + @ApiDocFieldConfiguration(desc = "GUID", required = true) + private Long guid; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoDetailParam.java b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoDetailParam.java new file mode 100644 index 0000000..ad63936 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoDetailParam.java @@ -0,0 +1,15 @@ +package com.iqudoo.platform.application.facade.request; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.platform.application.facade.base.BaseParam; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class SystemAdminInfoDetailParam extends BaseParam { + + @ApiDocFieldConfiguration(desc = "GUID", required = true) + private Long guid; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoListParam.java b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoListParam.java new file mode 100644 index 0000000..04a5cfe --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoListParam.java @@ -0,0 +1,49 @@ +package com.iqudoo.platform.application.facade.request; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.platform.application.facade.base.BaseParam; +import com.iqudoo.platform.application.facade.enums.SystemAdminInfoOptStatusEnum; +import com.iqudoo.platform.application.facade.enums.SystemAdminInfoOptSuperEnum; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class SystemAdminInfoListParam extends BaseParam { + + @ApiDocFieldConfiguration(desc = "分页页码", required = true) + private Integer pageNum; + + @ApiDocFieldConfiguration(desc = "每页数量", required = true) + private Integer pageSize; + + @ApiDocFieldConfiguration(desc = "分页游标", required = true) + private Long pageCursor; + + @ApiDocFieldConfiguration(desc = "排除GUID列表,逗号分割") + private String excludeGuidList; + + @ApiDocFieldConfiguration(desc = "登录账号模糊查询") + private String usernameLike; + + @ApiDocFieldConfiguration(desc = "账号昵称模糊查询") + private String nicknameLike; + + @ApiDocFieldConfiguration(desc = "备注信息模糊查询") + private String optRemarkLike; + + @ApiDocFieldConfiguration(desc = "账号状态", + enumClass = SystemAdminInfoOptStatusEnum.class) + private Integer optStatus; + + @ApiDocFieldConfiguration(desc = "超管标志", + enumClass = SystemAdminInfoOptSuperEnum.class) + private Integer optSuper; + + @ApiDocFieldConfiguration(desc = "排序字段") + private String orderBy; + + @ApiDocFieldConfiguration(desc = "返回类型:any, trash, valid(默认)") + private String resultType; + +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoRecoverParam.java b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoRecoverParam.java new file mode 100644 index 0000000..53f6962 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoRecoverParam.java @@ -0,0 +1,15 @@ +package com.iqudoo.platform.application.facade.request; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.platform.application.facade.base.BaseParam; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class SystemAdminInfoRecoverParam extends BaseParam { + + @ApiDocFieldConfiguration(desc = "GUID", required = true) + private Long guid; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoUpdateParam.java b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoUpdateParam.java new file mode 100644 index 0000000..9d21cda --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAdminInfoUpdateParam.java @@ -0,0 +1,37 @@ +package com.iqudoo.platform.application.facade.request; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.platform.application.facade.base.BaseParam; +import com.iqudoo.platform.application.facade.enums.SystemAdminInfoOptStatusEnum; +import com.iqudoo.platform.application.facade.enums.SystemAdminInfoOptSuperEnum; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class SystemAdminInfoUpdateParam extends BaseParam { + + @ApiDocFieldConfiguration(desc = "GUID", required = true) + private Long guid; + + @ApiDocFieldConfiguration(desc = "登录账号") + private String username; + + @ApiDocFieldConfiguration(desc = "账号昵称") + private String nickname; + + @ApiDocFieldConfiguration(desc = "账号密码") + private String password; + + @ApiDocFieldConfiguration(desc = "备注信息") + private String optRemark; + + @ApiDocFieldConfiguration(desc = "账号状态", + enumClass = SystemAdminInfoOptStatusEnum.class) + private Integer optStatus; + + @ApiDocFieldConfiguration(desc = "超管标志", + enumClass = SystemAdminInfoOptSuperEnum.class) + private Integer optSuper; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoCancelParam.java b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoCancelParam.java new file mode 100644 index 0000000..815ff31 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoCancelParam.java @@ -0,0 +1,21 @@ +package com.iqudoo.platform.application.facade.request; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.platform.application.facade.base.BaseParam; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class SystemAsyncTaskInfoCancelParam extends BaseParam { + + @ApiDocFieldConfiguration(desc = "GUID", required = true) + private Long guid; + + @ApiDocFieldConfiguration(desc = "业务类型") + private String bizType; + + @ApiDocFieldConfiguration(desc = "业务编号") + private String bizId; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoClearParam.java b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoClearParam.java new file mode 100644 index 0000000..4e1d32c --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoClearParam.java @@ -0,0 +1,11 @@ +package com.iqudoo.platform.application.facade.request; + +import com.iqudoo.platform.application.facade.base.BaseParam; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class SystemAsyncTaskInfoClearParam extends BaseParam { + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoCreateParam.java b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoCreateParam.java new file mode 100644 index 0000000..3c2e8b3 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoCreateParam.java @@ -0,0 +1,33 @@ +package com.iqudoo.platform.application.facade.request; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.platform.application.facade.base.BaseParam; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class SystemAsyncTaskInfoCreateParam extends BaseParam { + + @ApiDocFieldConfiguration(desc = "业务ID", required = true) + private String bizId; + + @ApiDocFieldConfiguration(desc = "业务类型", required = true) + private String bizType; + + @ApiDocFieldConfiguration(desc = "事务ID", required = true) + private String transId; + + @ApiDocFieldConfiguration(desc = "任务类型", required = true) + private String taskType; + + @ApiDocFieldConfiguration(desc = "任务参数") + private String taskParams; + + @ApiDocFieldConfiguration(desc = "定时时间") + private Long callTiming; + + @ApiDocFieldConfiguration(desc = "是否同步执行") + private boolean callSync; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoDeleteParam.java b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoDeleteParam.java new file mode 100644 index 0000000..bbff87c --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoDeleteParam.java @@ -0,0 +1,21 @@ +package com.iqudoo.platform.application.facade.request; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.platform.application.facade.base.BaseParam; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class SystemAsyncTaskInfoDeleteParam extends BaseParam { + + @ApiDocFieldConfiguration(desc = "GUID", required = true) + private Long guid; + + @ApiDocFieldConfiguration(desc = "业务类型") + private String bizType; + + @ApiDocFieldConfiguration(desc = "业务编号") + private String bizId; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoDetailParam.java b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoDetailParam.java new file mode 100644 index 0000000..599450b --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoDetailParam.java @@ -0,0 +1,24 @@ +package com.iqudoo.platform.application.facade.request; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.platform.application.facade.base.BaseParam; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class SystemAsyncTaskInfoDetailParam extends BaseParam { + + @ApiDocFieldConfiguration(desc = "GUID", required = true) + private Long guid; + + @ApiDocFieldConfiguration(desc = "组织GUID") + private Long organizationGuid; + + @ApiDocFieldConfiguration(desc = "业务类型") + private String bizType; + + @ApiDocFieldConfiguration(desc = "业务编号") + private String bizId; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoListParam.java b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoListParam.java new file mode 100644 index 0000000..ac58ad9 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoListParam.java @@ -0,0 +1,44 @@ +package com.iqudoo.platform.application.facade.request; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.platform.application.facade.base.BaseParam; +import com.iqudoo.platform.application.facade.enums.SystemAsyncTaskInfoOptStatusEnum; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class SystemAsyncTaskInfoListParam extends BaseParam { + + @ApiDocFieldConfiguration(desc = "分页页码", required = true) + private Integer pageNum; + + @ApiDocFieldConfiguration(desc = "每页数量", required = true) + private Integer pageSize; + + @ApiDocFieldConfiguration(desc = "分页游标", required = true) + private Long pageCursor; + + @ApiDocFieldConfiguration(desc = "查询关键词") + private String searchKeyword; + + @ApiDocFieldConfiguration(desc = "业务类型") + private String bizType; + + @ApiDocFieldConfiguration(desc = "业务编号") + private String bizId; + + @ApiDocFieldConfiguration(desc = "任务类型模糊查询") + private String taskTypeLike; + + @ApiDocFieldConfiguration(desc = "任务状态", + enumClass = SystemAsyncTaskInfoOptStatusEnum.class) + private Integer optStatus; + + @ApiDocFieldConfiguration(desc = "排序字段") + private String orderBy; + + @ApiDocFieldConfiguration(desc = "返回类型:any, trash, valid(默认)") + private String resultType; + +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoLogsParam.java b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoLogsParam.java new file mode 100644 index 0000000..aa919bb --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoLogsParam.java @@ -0,0 +1,24 @@ +package com.iqudoo.platform.application.facade.request; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.platform.application.facade.base.BaseParam; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class SystemAsyncTaskInfoLogsParam extends BaseParam { + + @ApiDocFieldConfiguration(desc = "GUID", required = true) + private Long guid; + + @ApiDocFieldConfiguration(desc = "组织GUID") + private Long organizationGuid; + + @ApiDocFieldConfiguration(desc = "业务类型") + private String bizType; + + @ApiDocFieldConfiguration(desc = "业务编号") + private String bizId; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoResetParam.java b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoResetParam.java new file mode 100644 index 0000000..7433738 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoResetParam.java @@ -0,0 +1,11 @@ +package com.iqudoo.platform.application.facade.request; + +import com.iqudoo.platform.application.facade.base.BaseParam; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class SystemAsyncTaskInfoResetParam extends BaseParam { + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoRestartParam.java b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoRestartParam.java new file mode 100644 index 0000000..2c603bb --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoRestartParam.java @@ -0,0 +1,30 @@ +package com.iqudoo.platform.application.facade.request; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.platform.application.facade.base.BaseParam; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class SystemAsyncTaskInfoRestartParam extends BaseParam { + + @ApiDocFieldConfiguration(desc = "GUID", required = true) + private Long guid; + + @ApiDocFieldConfiguration(desc = "组织GUID") + private Long organizationGuid; + + @ApiDocFieldConfiguration(desc = "业务类型") + private String bizType; + + @ApiDocFieldConfiguration(desc = "业务编号") + private String bizId; + + @ApiDocFieldConfiguration(desc = "定时时间") + private Long callTiming; + + @ApiDocFieldConfiguration(desc = "是否同步执行") + private boolean callSync; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoScheduleParam.java b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoScheduleParam.java new file mode 100644 index 0000000..f86d18f --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoScheduleParam.java @@ -0,0 +1,11 @@ +package com.iqudoo.platform.application.facade.request; + +import com.iqudoo.platform.application.facade.base.BaseParam; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class SystemAsyncTaskInfoScheduleParam extends BaseParam { + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoTickParam.java b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoTickParam.java new file mode 100644 index 0000000..b412a7b --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/request/SystemAsyncTaskInfoTickParam.java @@ -0,0 +1,11 @@ +package com.iqudoo.platform.application.facade.request; + +import com.iqudoo.platform.application.facade.base.BaseParam; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class SystemAsyncTaskInfoTickParam extends BaseParam { + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalFileTransferParam.java b/src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalFileTransferParam.java new file mode 100644 index 0000000..875cad4 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalFileTransferParam.java @@ -0,0 +1,17 @@ +package com.iqudoo.platform.application.facade.request; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.platform.application.facade.base.BaseParam; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.List; + +@Data +@EqualsAndHashCode(callSuper = false) +public class SystemGlobalFileTransferParam extends BaseParam { + + @ApiDocFieldConfiguration(desc = "需要转存的地址列表", required = true) + private List urls; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalFileUploadParam.java b/src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalFileUploadParam.java new file mode 100644 index 0000000..78e91c9 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalFileUploadParam.java @@ -0,0 +1,29 @@ +package com.iqudoo.platform.application.facade.request; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.platform.application.facade.base.BaseParam; +import com.iqudoo.platform.application.facade.enums.SystemGlobalFileUploadFileTypeEnum; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class SystemGlobalFileUploadParam extends BaseParam { + + @ApiDocFieldConfiguration(desc = "目录名称", required = true) + private String folderName; + + @ApiDocFieldConfiguration(desc = "文件Base64编码字符串", required = true) + private String fileBase64; + + @ApiDocFieldConfiguration(desc = "文件字节数组", required = true) + private byte[] fileBytes; + + @ApiDocFieldConfiguration(desc = "文件名称", required = true) + private String fileName; + + @ApiDocFieldConfiguration(desc = "文件类型", required = true, + enumClass = SystemGlobalFileUploadFileTypeEnum.class) + private String type; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalSessionDeleteParam.java b/src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalSessionDeleteParam.java new file mode 100644 index 0000000..551bd6d --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalSessionDeleteParam.java @@ -0,0 +1,16 @@ +package com.iqudoo.platform.application.facade.request; + + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.platform.application.facade.base.BaseParam; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class SystemGlobalSessionDeleteParam extends BaseParam { + + @ApiDocFieldConfiguration(desc = "GUID", required = true) + private Long guid; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalSessionDetailParam.java b/src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalSessionDetailParam.java new file mode 100644 index 0000000..a27a727 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalSessionDetailParam.java @@ -0,0 +1,22 @@ +package com.iqudoo.platform.application.facade.request; + + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.platform.application.facade.base.BaseParam; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class SystemGlobalSessionDetailParam extends BaseParam { + + @ApiDocFieldConfiguration(desc = "GUID", required = true) + private Long guid; + + @ApiDocFieldConfiguration(desc = "账号分组") + private String group; + + @ApiDocFieldConfiguration(desc = "账号ID") + private String userid; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalSessionLastParam.java b/src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalSessionLastParam.java new file mode 100644 index 0000000..0054c80 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalSessionLastParam.java @@ -0,0 +1,19 @@ +package com.iqudoo.platform.application.facade.request; + + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.platform.application.facade.base.BaseParam; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class SystemGlobalSessionLastParam extends BaseParam { + + @ApiDocFieldConfiguration(desc = "账号分组") + private String userGroup; + + @ApiDocFieldConfiguration(desc = "账号ID") + private Long userGuid; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalSessionListParam.java b/src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalSessionListParam.java new file mode 100644 index 0000000..a4def22 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalSessionListParam.java @@ -0,0 +1,33 @@ +package com.iqudoo.platform.application.facade.request; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.platform.application.facade.base.BaseParam; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class SystemGlobalSessionListParam extends BaseParam { + + @ApiDocFieldConfiguration(desc = "分页页码", required = true) + private Integer pageNum; + + @ApiDocFieldConfiguration(desc = "每页数量", required = true) + private Integer pageSize; + + @ApiDocFieldConfiguration(desc = "分页游标", required = true) + private Long pageCursor; + + @ApiDocFieldConfiguration(desc = "用户GUID") + private Long userGuid; + + @ApiDocFieldConfiguration(desc = "账号分组") + private String userGroup; + + @ApiDocFieldConfiguration(desc = "排序字段") + private String orderBy; + + @ApiDocFieldConfiguration(desc = "返回类型:any, trash, valid(默认)") + private String resultType; + +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalSettingDetailParam.java b/src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalSettingDetailParam.java new file mode 100644 index 0000000..43d14e0 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalSettingDetailParam.java @@ -0,0 +1,16 @@ +package com.iqudoo.platform.application.facade.request; + + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.platform.application.facade.base.BaseParam; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class SystemGlobalSettingDetailParam extends BaseParam { + + @ApiDocFieldConfiguration(desc = "配置KEY") + private String settingKey; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalSettingEditParam.java b/src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalSettingEditParam.java new file mode 100644 index 0000000..c8e499f --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/request/SystemGlobalSettingEditParam.java @@ -0,0 +1,23 @@ +package com.iqudoo.platform.application.facade.request; + + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.platform.application.facade.base.BaseParam; +import lombok.Data; +import lombok.EqualsAndHashCode; + +@Data +@EqualsAndHashCode(callSuper = false) +public class SystemGlobalSettingEditParam extends BaseParam { + + + @ApiDocFieldConfiguration(desc = "配置KEY", required = true) + private String settingKey; + + @ApiDocFieldConfiguration(desc = "配置VALUE", required = true) + private String settingValue; + + @ApiDocFieldConfiguration(desc = "备注信息") + private String optRemark; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/response/SystemAdminInfoAuthLoginResponse.java b/src/main/java/com/iqudoo/platform/application/facade/response/SystemAdminInfoAuthLoginResponse.java new file mode 100644 index 0000000..6ed44cb --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/response/SystemAdminInfoAuthLoginResponse.java @@ -0,0 +1,21 @@ +package com.iqudoo.platform.application.facade.response; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import lombok.Data; + +@Data +public class SystemAdminInfoAuthLoginResponse { + + @ApiDocFieldConfiguration(desc = "鉴权TOKEN") + private String token; + + @ApiDocFieldConfiguration(desc = "刷新Token") + private String refreshToken; + + @ApiDocFieldConfiguration(desc = "鉴权Token过期时间,单位秒") + private long expiresIn; + + @ApiDocFieldConfiguration(desc = "刷新Token过期时间,单位秒") + private long refreshExpiresIn; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/response/SystemAdminInfoDetailResponse.java b/src/main/java/com/iqudoo/platform/application/facade/response/SystemAdminInfoDetailResponse.java new file mode 100644 index 0000000..8b1d830 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/response/SystemAdminInfoDetailResponse.java @@ -0,0 +1,50 @@ +package com.iqudoo.platform.application.facade.response; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.platform.application.facade.enums.SystemAdminInfoOptStatusEnum; +import com.iqudoo.platform.application.facade.enums.SystemAdminInfoOptSuperEnum; +import lombok.Data; + +@Data +public class SystemAdminInfoDetailResponse { + + @ApiDocFieldConfiguration(desc = "GUID") + @JsonSerialize(using = ToStringSerializer.class) + private Long guid; + + @ApiDocFieldConfiguration(desc = "登录账号") + private String username; + + @ApiDocFieldConfiguration(desc = "账号昵称") + private String nickname; + + @ApiDocFieldConfiguration(desc = "备注信息") + private String optRemark; + + @ApiDocFieldConfiguration(desc = "最后登陆") + private SystemGlobalSessionDetailResponse lastSession; + + @ApiDocFieldConfiguration(desc = "账号状态", + enumClass = SystemAdminInfoOptStatusEnum.class) + private Integer optStatus; + + @ApiDocFieldConfiguration(desc = "超级管理", + enumClass = SystemAdminInfoOptSuperEnum.class) + private Integer optSuper; + + @ApiDocFieldConfiguration(desc = "是否删除: 0或1") + private Integer isDelete; + + @ApiDocFieldConfiguration(desc = "是否隐藏: 0或1") + private Integer isHidden; + + @ApiDocFieldConfiguration(desc = "创建时间") + private long createTime; + + @ApiDocFieldConfiguration(desc = "更新时间") + private long updateTime; + + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/response/SystemAsyncTaskInfoDetailResponse.java b/src/main/java/com/iqudoo/platform/application/facade/response/SystemAsyncTaskInfoDetailResponse.java new file mode 100644 index 0000000..b175b27 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/response/SystemAsyncTaskInfoDetailResponse.java @@ -0,0 +1,74 @@ +package com.iqudoo.platform.application.facade.response; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.platform.application.facade.enums.SystemAsyncTaskInfoOptStatusEnum; +import lombok.Data; + +@Data +public class SystemAsyncTaskInfoDetailResponse { + + @ApiDocFieldConfiguration(desc = "GUID") + @JsonSerialize(using = ToStringSerializer.class) + private Long guid; + + @ApiDocFieldConfiguration(desc = "业务类型") + private String bizType; + + @ApiDocFieldConfiguration(desc = "业务编号") + private String bizId; + + @ApiDocFieldConfiguration(desc = "事务编号") + private String transId; + + @ApiDocFieldConfiguration(desc = "任务类型") + private String taskType; + + @ApiDocFieldConfiguration(desc = "任务参数") + private String taskParams; + + @ApiDocFieldConfiguration(desc = "定时执行") + private long callTiming; + + @ApiDocFieldConfiguration(desc = "开始时间") + private long startTime; + + @ApiDocFieldConfiguration(desc = "结束时间") + private long endTime; + + @ApiDocFieldConfiguration(desc = "合计耗时") + private long useTime; + + @ApiDocFieldConfiguration(desc = "合计数量") + private int totalCount; + + @ApiDocFieldConfiguration(desc = "成功数量") + private int successCount; + + @ApiDocFieldConfiguration(desc = "忽略数量") + private int ignoreCount; + + @ApiDocFieldConfiguration(desc = "失败数量") + private int failureCount; + + @ApiDocFieldConfiguration(desc = "重试次数") + private int retryCount; + + @ApiDocFieldConfiguration(desc = "任务状态", + enumClass = SystemAsyncTaskInfoOptStatusEnum.class) + private Integer optStatus; + + @ApiDocFieldConfiguration(desc = "是否删除: 0或1") + private Integer isDelete; + + @ApiDocFieldConfiguration(desc = "是否隐藏: 0或1") + private Integer isHidden; + + @ApiDocFieldConfiguration(desc = "创建时间") + private long createTime; + + @ApiDocFieldConfiguration(desc = "更新时间") + private long updateTime; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/response/SystemAsyncTaskInfoLogsResponse.java b/src/main/java/com/iqudoo/platform/application/facade/response/SystemAsyncTaskInfoLogsResponse.java new file mode 100644 index 0000000..7b9eed3 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/response/SystemAsyncTaskInfoLogsResponse.java @@ -0,0 +1,12 @@ +package com.iqudoo.platform.application.facade.response; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import lombok.Data; + +@Data +public class SystemAsyncTaskInfoLogsResponse { + + @ApiDocFieldConfiguration(desc = "日志内容") + private String logsContent; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/response/SystemGlobalFileTransferResponse.java b/src/main/java/com/iqudoo/platform/application/facade/response/SystemGlobalFileTransferResponse.java new file mode 100644 index 0000000..720711a --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/response/SystemGlobalFileTransferResponse.java @@ -0,0 +1,14 @@ +package com.iqudoo.platform.application.facade.response; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import lombok.Data; + +import java.util.List; + +@Data +public class SystemGlobalFileTransferResponse { + + @ApiDocFieldConfiguration(desc = "转存后的地址列表") + private List savedUrls; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/response/SystemGlobalFileUploadResponse.java b/src/main/java/com/iqudoo/platform/application/facade/response/SystemGlobalFileUploadResponse.java new file mode 100644 index 0000000..ea809db --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/response/SystemGlobalFileUploadResponse.java @@ -0,0 +1,15 @@ +package com.iqudoo.platform.application.facade.response; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import lombok.Data; + +@Data +public class SystemGlobalFileUploadResponse { + + @ApiDocFieldConfiguration(desc = "文件地址") + private String url; + + @ApiDocFieldConfiguration(desc = "文件名称") + private String fileName; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/response/SystemGlobalSessionDetailResponse.java b/src/main/java/com/iqudoo/platform/application/facade/response/SystemGlobalSessionDetailResponse.java new file mode 100644 index 0000000..fd0504d --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/response/SystemGlobalSessionDetailResponse.java @@ -0,0 +1,43 @@ +package com.iqudoo.platform.application.facade.response; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import lombok.Data; + +@Data +public class SystemGlobalSessionDetailResponse { + + @ApiDocFieldConfiguration(desc = "GUID") + @JsonSerialize(using = ToStringSerializer.class) + private Long guid; + + @ApiDocFieldConfiguration(desc = "用户GUID") + @JsonSerialize(using = ToStringSerializer.class) + private Long userGuid; + + @ApiDocFieldConfiguration(desc = "账号类型") + private String userGroup; + + @ApiDocFieldConfiguration(desc = "来源平台") + private String originPlatform; + + @ApiDocFieldConfiguration(desc = "来源域名") + private String originDomain; + + @ApiDocFieldConfiguration(desc = "来源IP地址") + private String originIp; + + @ApiDocFieldConfiguration(desc = "是否删除: 0或1") + private Integer isDelete; + + @ApiDocFieldConfiguration(desc = "是否隐藏: 0或1") + private Integer isHidden; + + @ApiDocFieldConfiguration(desc = "创建时间") + private long createTime; + + @ApiDocFieldConfiguration(desc = "更新时间") + private long updateTime; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/response/SystemGlobalSettingDetailResponse.java b/src/main/java/com/iqudoo/platform/application/facade/response/SystemGlobalSettingDetailResponse.java new file mode 100644 index 0000000..bf80a51 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/response/SystemGlobalSettingDetailResponse.java @@ -0,0 +1,22 @@ +package com.iqudoo.platform.application.facade.response; + +import com.iqudoo.framework.tape.base.docs.annotation.ApiDocFieldConfiguration; +import com.iqudoo.framework.tape.modules.IModuleSetting; +import lombok.Data; + +@Data +public class SystemGlobalSettingDetailResponse { + + @ApiDocFieldConfiguration(desc = "配置KEY") + private String settingKey; + + @ApiDocFieldConfiguration(desc = "配置信息") + private IModuleSetting.SettingInfo settingInfo; + + @ApiDocFieldConfiguration(desc = "配置内容") + private String settingValue; + + @ApiDocFieldConfiguration(desc = "备注信息") + private String optRemark; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/service/ISystemAdminInfoAuthService.java b/src/main/java/com/iqudoo/platform/application/facade/service/ISystemAdminInfoAuthService.java new file mode 100644 index 0000000..a745104 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/service/ISystemAdminInfoAuthService.java @@ -0,0 +1,17 @@ +package com.iqudoo.platform.application.facade.service; + +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.platform.application.facade.request.SystemAdminInfoAuthEditPasswordParam; +import com.iqudoo.platform.application.facade.request.SystemAdminInfoAuthEditProfileParam; +import com.iqudoo.platform.application.facade.request.SystemAdminInfoAuthLoginParam; +import com.iqudoo.platform.application.facade.response.SystemAdminInfoAuthLoginResponse; + +public interface ISystemAdminInfoAuthService { + + Proto doLogin(SystemAdminInfoAuthLoginParam param) throws Throwable; + + Proto doEditProfile(SystemAdminInfoAuthEditProfileParam param) throws Throwable; + + Proto doEditPassword(SystemAdminInfoAuthEditPasswordParam param) throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/service/ISystemAdminInfoService.java b/src/main/java/com/iqudoo/platform/application/facade/service/ISystemAdminInfoService.java new file mode 100644 index 0000000..164adcb --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/service/ISystemAdminInfoService.java @@ -0,0 +1,22 @@ +package com.iqudoo.platform.application.facade.service; + +import com.iqudoo.framework.tape.modules.crud.PageData; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.platform.application.facade.request.*; +import com.iqudoo.platform.application.facade.response.SystemAdminInfoDetailResponse; + +public interface ISystemAdminInfoService { + + Proto> getList(SystemAdminInfoListParam param) throws Throwable; + + Proto doCreate(SystemAdminInfoCreateParam param) throws Throwable; + + Proto getDetail(SystemAdminInfoDetailParam param) throws Throwable; + + Proto doUpdate(SystemAdminInfoUpdateParam param) throws Throwable; + + Proto doDelete(SystemAdminInfoDeleteParam param) throws Throwable; + + Proto doRecover(SystemAdminInfoRecoverParam param) throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/service/ISystemAsyncTaskInfoService.java b/src/main/java/com/iqudoo/platform/application/facade/service/ISystemAsyncTaskInfoService.java new file mode 100644 index 0000000..2171edf --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/service/ISystemAsyncTaskInfoService.java @@ -0,0 +1,33 @@ +package com.iqudoo.platform.application.facade.service; + +import com.iqudoo.framework.tape.modules.crud.PageData; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.platform.application.facade.request.*; +import com.iqudoo.platform.application.facade.response.SystemAsyncTaskInfoDetailResponse; +import com.iqudoo.platform.application.facade.response.SystemAsyncTaskInfoLogsResponse; + +public interface ISystemAsyncTaskInfoService { + + Proto> getList(SystemAsyncTaskInfoListParam param) throws Throwable; + + Proto getDetail(SystemAsyncTaskInfoDetailParam param) throws Throwable; + + Proto getLogs(SystemAsyncTaskInfoLogsParam param) throws Throwable; + + Proto doRestart(SystemAsyncTaskInfoRestartParam param) throws Throwable; + + Proto doCreate(SystemAsyncTaskInfoCreateParam param) throws Throwable; + + Proto doCancel(SystemAsyncTaskInfoCancelParam param) throws Throwable; + + Proto doDelete(SystemAsyncTaskInfoDeleteParam param) throws Throwable; + + Proto doReset(SystemAsyncTaskInfoResetParam param) throws Throwable; + + Proto doTick(SystemAsyncTaskInfoTickParam param) throws Throwable; + + Proto doSchedule(SystemAsyncTaskInfoScheduleParam param) throws Throwable; + + Proto doClear(SystemAsyncTaskInfoClearParam param) throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/service/ISystemGlobalFileService.java b/src/main/java/com/iqudoo/platform/application/facade/service/ISystemGlobalFileService.java new file mode 100644 index 0000000..2e30dab --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/service/ISystemGlobalFileService.java @@ -0,0 +1,15 @@ +package com.iqudoo.platform.application.facade.service; + +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.platform.application.facade.request.SystemGlobalFileTransferParam; +import com.iqudoo.platform.application.facade.request.SystemGlobalFileUploadParam; +import com.iqudoo.platform.application.facade.response.SystemGlobalFileTransferResponse; +import com.iqudoo.platform.application.facade.response.SystemGlobalFileUploadResponse; + +public interface ISystemGlobalFileService { + + Proto doFileUpload(SystemGlobalFileUploadParam param) throws Throwable; + + Proto doFileTransfer(SystemGlobalFileTransferParam param) throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/service/ISystemGlobalSessionService.java b/src/main/java/com/iqudoo/platform/application/facade/service/ISystemGlobalSessionService.java new file mode 100644 index 0000000..1d90c45 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/service/ISystemGlobalSessionService.java @@ -0,0 +1,21 @@ +package com.iqudoo.platform.application.facade.service; + +import com.iqudoo.framework.tape.modules.crud.PageData; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.platform.application.facade.request.SystemGlobalSessionDeleteParam; +import com.iqudoo.platform.application.facade.request.SystemGlobalSessionDetailParam; +import com.iqudoo.platform.application.facade.request.SystemGlobalSessionListParam; +import com.iqudoo.platform.application.facade.request.SystemGlobalSessionLastParam; +import com.iqudoo.platform.application.facade.response.SystemGlobalSessionDetailResponse; + +public interface ISystemGlobalSessionService { + + Proto> getList(SystemGlobalSessionListParam param) throws Throwable; + + Proto getDetail(SystemGlobalSessionDetailParam param) throws Throwable; + + Proto getLast(SystemGlobalSessionLastParam param) throws Throwable; + + Proto doDelete(SystemGlobalSessionDeleteParam param) throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/service/ISystemGlobalSettingService.java b/src/main/java/com/iqudoo/platform/application/facade/service/ISystemGlobalSettingService.java new file mode 100644 index 0000000..15db268 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/service/ISystemGlobalSettingService.java @@ -0,0 +1,19 @@ +package com.iqudoo.platform.application.facade.service; + +import com.iqudoo.framework.tape.modules.IModuleSetting; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.platform.application.facade.request.SystemGlobalSettingDetailParam; +import com.iqudoo.platform.application.facade.request.SystemGlobalSettingEditParam; +import com.iqudoo.platform.application.facade.response.SystemGlobalSettingDetailResponse; + +import java.util.List; + +public interface ISystemGlobalSettingService { + + Proto> getList() throws Throwable; + + Proto doEdit(SystemGlobalSettingEditParam param) throws Throwable; + + Proto getDetail(SystemGlobalSettingDetailParam param) throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/task/IAsyncTaskHandler.java b/src/main/java/com/iqudoo/platform/application/facade/task/IAsyncTaskHandler.java new file mode 100644 index 0000000..cc37ae0 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/task/IAsyncTaskHandler.java @@ -0,0 +1,130 @@ +package com.iqudoo.platform.application.facade.task; + +import com.alibaba.fastjson.JSONObject; +import com.iqudoo.framework.tape.modules.utils.DebounceUtil; + +import java.util.*; +import java.util.concurrent.atomic.AtomicBoolean; + +public interface IAsyncTaskHandler { + + void doTask(JSONObject params, TaskProgressive progressive) throws Throwable; + + @SuppressWarnings({"unused", "LombokGetterMayBeUsed"}) + abstract class TaskProgressive { + + private final String debounceKey; + private final AtomicBoolean fulfilledFlag = new AtomicBoolean(false); + private final AtomicBoolean cancelingFlag = new AtomicBoolean(false); + private final AtomicBoolean canceledFlag = new AtomicBoolean(false); + private final List runLogs = new ArrayList<>(); + private final T taskInfo; + private final long startTime; + private int totalCount = 0; + private int successCount = 0; + private int ignoreCount = 0; + private int failureCount = 0; + + public TaskProgressive(T taskInfo) { + this.debounceKey = UUID.randomUUID() + "-" + new Date().getTime(); + this.taskInfo = taskInfo; + this.startTime = new Date().getTime(); + } + + protected abstract void onProgressSubmit() throws Throwable; + + public T getTaskInfo() { + return taskInfo; + } + + public long getStartTime() { + return startTime; + } + + public List getRunLogs() { + return runLogs; + } + + public boolean isFulfilled() { + return fulfilledFlag.get(); + } + + public boolean isCanceled() { + return canceledFlag.get(); + } + + public boolean isCanceling() { + return cancelingFlag.get(); + } + + public int getTotalCount() { + return totalCount; + } + + public int getSuccessCount() { + return successCount; + } + + public int getIgnoreCount() { + return ignoreCount; + } + + public int getFailureCount() { + return failureCount; + } + + public void addLog(String logContent) { + runLogs.add(new Date().toString()); + runLogs.add(logContent); + commitSubmit(); + } + + public void recordSuccess() { + totalCount += 1; + successCount += 1; + commitSubmit(); + } + + public void recordFailure() { + totalCount += 1; + failureCount += 1; + commitSubmit(); + } + + public void recordIgnore() { + totalCount += 1; + ignoreCount += 1; + commitSubmit(); + } + + public void clearLogs() { + runLogs.clear(); + } + + public void setFulfilled() { + fulfilledFlag.set(true); + commitSubmit(); + } + + public void setCanceled() { + canceledFlag.set(true); + commitSubmit(); + } + + public void setCanceling() { + cancelingFlag.set(true); + commitSubmit(); + } + + public void commitSubmit() { + DebounceUtil.debounce(this.debounceKey, 30, new DebounceUtil.DebounceRunner() { + @Override + public void onRun() throws Throwable { + onProgressSubmit(); + } + }); + } + + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/facade/task/IAsyncTaskScheduler.java b/src/main/java/com/iqudoo/platform/application/facade/task/IAsyncTaskScheduler.java new file mode 100644 index 0000000..24f5ed4 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/facade/task/IAsyncTaskScheduler.java @@ -0,0 +1,9 @@ +package com.iqudoo.platform.application.facade.task; + +public interface IAsyncTaskScheduler { + + long sleepTime(); + + void doScheduler() throws Throwable; + +} diff --git a/src/main/java/com/iqudoo/platform/application/fileMgr/LocalFileUtil.java b/src/main/java/com/iqudoo/platform/application/fileMgr/LocalFileUtil.java new file mode 100644 index 0000000..40c9402 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/fileMgr/LocalFileUtil.java @@ -0,0 +1,387 @@ +package com.iqudoo.platform.application.fileMgr; + +import java.io.IOException; +import java.nio.file.*; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.Objects; +import java.util.stream.Stream; + +/** + * 本地文件工具类 + */ +@SuppressWarnings({"DuplicatedCode", "HttpUrlsUsage", "unused"}) +public class LocalFileUtil { + + @SuppressWarnings({"LombokGetterMayBeUsed", "LombokSetterMayBeUsed"}) + public static class Config { + + /** + * 本地文件存储根目录 + */ + private String savePath = ""; + private String bucketName = ""; + private String domainName = ""; + private String protocolType = ""; + + public String getSavePath() { + return savePath; + } + + public void setSavePath(String savePath) { + this.savePath = savePath; + } + + public String getBucketName() { + return bucketName; + } + + public void setBucketName(String bucketName) { + this.bucketName = bucketName; + } + + public String getDomainName() { + return domainName; + } + + public void setDomainName(String domainName) { + this.domainName = domainName; + } + + public String getProtocolType() { + return protocolType; + } + + public void setProtocolType(String protocolType) { + this.protocolType = protocolType; + } + + } + + @SuppressWarnings({"LombokGetterMayBeUsed", "LombokSetterMayBeUsed"}) + public static class FileInfo { + private String fileType; + private String fileName; + private long fileSize; + private long lastModified; + + public String getFileType() { + return fileType; + } + + public void setFileType(String fileType) { + this.fileType = fileType; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public long getFileSize() { + return fileSize; + } + + public void setFileSize(long fileSize) { + this.fileSize = fileSize; + } + + public long getLastModified() { + return lastModified; + } + + public void setLastModified(long lastModified) { + this.lastModified = lastModified; + } + } + + public static FileInfo getFile(String filePath, Config config) throws Throwable { + if (!hasFile(filePath, config)) { + throw new IllegalArgumentException("文件不存在"); + } + try { + Path file = resolvePath(filePath, config); + FileInfo fileInfo = new FileInfo(); + fileInfo.setFileType("file"); + fileInfo.setFileName(getFileName(filePath)); + fileInfo.setFileSize(Files.size(file)); + fileInfo.setLastModified(Files.getLastModifiedTime(file).toMillis()); + return fileInfo; + } catch (IOException e) { + throw new Throwable("本地文件操作异常:" + e.getMessage(), e); + } + } + + public static List getFiles(String folderPath, Config config) throws Throwable { + try { + Path folder = resolvePath(folderPath, config); + List result = new ArrayList<>(); + if (!Files.exists(folder, LinkOption.NOFOLLOW_LINKS)) { + return result; + } + if (!Files.isDirectory(folder, LinkOption.NOFOLLOW_LINKS)) { + throw new IllegalArgumentException("目录路径不是文件夹"); + } + try (Stream stream = Files.list(folder)) { + stream.sorted(Comparator.comparing(path -> path.getFileName().toString())) + .forEach(path -> result.add(toFileInfo(path))); + } + return result; + } catch (IOException e) { + throw new Throwable("本地文件操作异常:" + e.getMessage(), e); + } + } + + public static void createFolder(String folderPath, Config config) throws Throwable { + if (hasFolder(folderPath, config)) { + return; + } + if (folderPath.trim().isEmpty()) { + throw new IllegalArgumentException("文件夹路径不能为空"); + } + try { + Files.createDirectories(resolvePath(folderPath, config)); + } catch (IOException e) { + throw new Throwable("本地文件操作异常:" + e.getMessage(), e); + } + } + + public static void renameFile(String targetPath, String filePath, String fileType, Config config) throws Throwable { + if (targetPath == null || targetPath.trim().isEmpty()) { + throw new IllegalArgumentException("目标路径不能为空"); + } + if (filePath == null || filePath.trim().isEmpty()) { + throw new IllegalArgumentException("文件路径不能为空"); + } + if (!"file".equals(fileType) && !"folder".equals(fileType)) { + throw new IllegalArgumentException("文件类型必须为file或folder"); + } + String sourcePath = trimFolderSuffix(filePath, fileType); + String destinationPath = trimFolderSuffix(targetPath, fileType); + if (Objects.equals(sourcePath, destinationPath)) { + return; + } + try { + Path source = resolvePath(sourcePath, config); + Path destination = resolvePath(destinationPath, config); + if (!Files.exists(source, LinkOption.NOFOLLOW_LINKS)) { + throw new RuntimeException(("file".equals(fileType) ? "文件不存在:" : "文件夹不存在:") + sourcePath); + } + if ("file".equals(fileType) && !Files.isRegularFile(source, LinkOption.NOFOLLOW_LINKS)) { + throw new RuntimeException("文件路径不是文件:" + sourcePath); + } + if ("folder".equals(fileType) && !Files.isDirectory(source, LinkOption.NOFOLLOW_LINKS)) { + throw new RuntimeException("文件夹路径不是目录:" + sourcePath); + } + Path parent = destination.getParent(); + if (parent != null) { + Files.createDirectories(parent); + } + if ("folder".equals(fileType) && Files.exists(destination, LinkOption.NOFOLLOW_LINKS)) { + throw new RuntimeException("文件夹已存在:" + destinationPath); + } + if ("file".equals(fileType)) { + Files.move(source, destination, StandardCopyOption.REPLACE_EXISTING); + } else { + Files.move(source, destination); + } + } catch (IOException e) { + throw new Throwable("本地文件操作异常:" + e.getMessage(), e); + } + } + + public static void deleteFile(String targetPath, String fileType, Config config) throws Throwable { + if (targetPath == null || targetPath.trim().isEmpty()) { + throw new IllegalArgumentException("目标路径不能为空"); + } + if (!"file".equals(fileType) && !"folder".equals(fileType)) { + throw new IllegalArgumentException("文件类型必须为file或folder"); + } + try { + Path target = resolvePath(trimFolderSuffix(targetPath, fileType), config); + if ("file".equals(fileType)) { + if (!Files.isRegularFile(target, LinkOption.NOFOLLOW_LINKS)) { + throw new RuntimeException("文件不存在:" + targetPath); + } + Files.delete(target); + } else if (Files.exists(target, LinkOption.NOFOLLOW_LINKS)) { + deleteRecursively(target); + } + } catch (IOException e) { + throw new Throwable("本地文件操作异常:" + e.getMessage(), e); + } + } + + public static String uploadFile(byte[] content, String targetPath, Config config) throws Throwable { + if (content == null) { + throw new IllegalArgumentException("文件内容不能为空"); + } + if (targetPath == null || targetPath.trim().isEmpty()) { + throw new IllegalArgumentException("目标路径不能为空"); + } + try { + Path target = resolvePath(targetPath, config); + Path parent = target.getParent(); + if (parent != null) { + Files.createDirectories(parent); + } + Files.write(target, content); + return buildFileUrl(targetPath, config); + } catch (IOException e) { + throw new Throwable("本地文件操作异常:" + e.getMessage(), e); + } + } + + public static boolean hasFile(String filePath, Config config) throws Throwable { + if (filePath == null || filePath.trim().isEmpty()) { + throw new IllegalArgumentException("文件路径不能为空"); + } + try { + return Files.isRegularFile(resolvePath(filePath, config), LinkOption.NOFOLLOW_LINKS); + } catch (RuntimeException e) { + throw e; + } catch (Throwable e) { + throw new Throwable("本地文件操作异常:" + e.getMessage(), e); + } + } + + public static boolean hasFolder(String filePath, Config config) throws Throwable { + if (filePath == null || filePath.trim().isEmpty()) { + throw new IllegalArgumentException("目录路径不能为空"); + } + try { + return Files.isDirectory(resolvePath(trimFolderSuffix(filePath, "folder"), config), LinkOption.NOFOLLOW_LINKS); + } catch (RuntimeException e) { + throw e; + } catch (Throwable e) { + throw new Throwable("本地文件操作异常:" + e.getMessage(), e); + } + } + + private static FileInfo toFileInfo(Path path) { + FileInfo fileInfo = new FileInfo(); + boolean directory = Files.isDirectory(path, LinkOption.NOFOLLOW_LINKS); + fileInfo.setFileType(directory ? "folder" : "file"); + fileInfo.setFileName(path.getFileName().toString()); + try { + fileInfo.setFileSize(directory ? 0 : Files.size(path)); + fileInfo.setLastModified(Files.getLastModifiedTime(path).toMillis()); + } catch (IOException e) { + fileInfo.setFileSize(0); + fileInfo.setLastModified(0); + } + return fileInfo; + } + + private static void deleteRecursively(Path target) throws IOException { + try (Stream stream = Files.walk(target)) { + List paths = stream.sorted(Comparator.reverseOrder()).toList(); + for (Path path : paths) { + Files.deleteIfExists(path); + } + } + } + + private static Path resolvePath(String filePath, Config config) { + Path rootPath = resolveRootPath(config); + String relativePath = normalizeRelativePath(filePath); + Path target = rootPath.resolve(relativePath).normalize(); + if (!target.startsWith(rootPath)) { + throw new IllegalArgumentException("文件路径不能超出本地存储根目录"); + } + return target; + } + + private static Path resolveRootPath(Config config) { + if (config == null) { + throw new IllegalArgumentException("本地文件配置不能为空"); + } + String rootPath = config.getSavePath(); + if (rootPath == null || rootPath.trim().isEmpty()) { + throw new IllegalArgumentException("rootPath不能为空"); + } + return Paths.get(rootPath.trim()).toAbsolutePath().normalize(); + } + + private static String normalizeRelativePath(String filePath) { + if (filePath == null) { + return ""; + } + String relativePath = filePath.trim().replace('\\', '/'); + while (relativePath.startsWith("/")) { + relativePath = relativePath.substring(1); + } + if (relativePath.isEmpty()) { + return ""; + } + Path path = Paths.get(relativePath).normalize(); + if (path.isAbsolute() || path.startsWith("..")) { + throw new IllegalArgumentException("无效的文件路径"); + } + return path.toString(); + } + + private static String trimFolderSuffix(String filePath, String fileType) { + if (!"folder".equals(fileType) || filePath == null) { + return filePath; + } + String result = filePath.trim(); + while (result.endsWith("/") || result.endsWith("\\")) { + result = result.substring(0, result.length() - 1); + } + return result; + } + + private static String buildFileUrl(String targetPath, Config config) { + String normalizedPath = normalizeRelativePath(targetPath).replace('\\', '/'); + String domainName = config.getDomainName(); + if (domainName != null && !domainName.trim().isEmpty()) { + String domain = domainName.trim(); + if (!domain.startsWith("http://") && !domain.startsWith("https://") && !domain.startsWith("//")) { + domain = getProtocolType(config) + domain; + } + return joinUrl(domain, getBucketName(config) + "/" + normalizedPath); + } + return normalizedPath; + } + + private static String joinUrl(String domain, String path) { + if (domain.endsWith("/")) { + return domain + path; + } + return domain + "/" + path; + } + + private static String getProtocolType(Config config) { + String protocolType = config.getProtocolType(); + if (protocolType == null || protocolType.trim().isEmpty()) { + return ""; + } + return protocolType.trim(); + } + + private static String getBucketName(Config config) { + String bucketName = config.getBucketName(); + if (bucketName == null || bucketName.trim().isEmpty()) { + return ""; + } + return bucketName.trim(); + } + + private static String getFileName(String filePath) { + if (filePath == null || filePath.isEmpty()) { + return ""; + } + String normalizedPath = filePath.replace('\\', '/'); + int lastSeparatorIndex = normalizedPath.lastIndexOf('/'); + if (lastSeparatorIndex == -1) { + return normalizedPath; + } + return normalizedPath.substring(lastSeparatorIndex + 1); + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/fileMgr/OssFileUtil.java b/src/main/java/com/iqudoo/platform/application/fileMgr/OssFileUtil.java new file mode 100644 index 0000000..50cd0a7 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/fileMgr/OssFileUtil.java @@ -0,0 +1,698 @@ +package com.iqudoo.platform.application.fileMgr; + +import com.alibaba.fastjson.JSONObject; +import com.aliyun.oss.ClientException; +import com.aliyun.oss.OSS; +import com.aliyun.oss.OSSClientBuilder; +import com.aliyun.oss.OSSException; +import com.aliyun.oss.model.*; +import com.iqudoo.framework.tape.modules.utils.ArrayUtil; + +import java.io.ByteArrayInputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/** + * 阿里云OSS工具类 + */ +@SuppressWarnings({"DuplicatedCode", "ExtractMethodRecommender", "EnhancedSwitchMigration", "BooleanMethodIsAlwaysInverted", "unused"}) +public class OssFileUtil { + + @SuppressWarnings({"LombokGetterMayBeUsed", "LombokSetterMayBeUsed"}) + public static class Config { + + private String endpoint = ""; + private String domainName = ""; + private String accessKeyId = ""; + private String accessKeySecret = ""; + private String bucketName = ""; + private String protocolType = ""; + private String contentTypeMap = ""; + private CannedAccessControlList objectAcl = CannedAccessControlList.Default; + + public String getDomainName() { + return domainName; + } + + public void setDomainName(String domainName) { + this.domainName = domainName; + } + + public String getEndpoint() { + return endpoint; + } + + public void setEndpoint(String endpoint) { + this.endpoint = endpoint; + } + + public String getAccessKeyId() { + return accessKeyId; + } + + public void setAccessKeyId(String accessKeyId) { + this.accessKeyId = accessKeyId; + } + + public String getAccessKeySecret() { + return accessKeySecret; + } + + public void setAccessKeySecret(String accessKeySecret) { + this.accessKeySecret = accessKeySecret; + } + + public String getBucketName() { + return bucketName; + } + + public void setBucketName(String bucketName) { + this.bucketName = bucketName; + } + + public String getContentTypeMap() { + return contentTypeMap; + } + + public void setContentTypeMap(String contentTypeMap) { + this.contentTypeMap = contentTypeMap; + } + + public String getProtocolType() { + return protocolType; + } + + public void setProtocolType(String protocolType) { + this.protocolType = protocolType; + } + + public CannedAccessControlList getObjectAcl() { + return objectAcl; + } + + public void setObjectAcl(CannedAccessControlList objectAcl) { + this.objectAcl = objectAcl; + } + + } + + @SuppressWarnings({"LombokGetterMayBeUsed", "LombokSetterMayBeUsed"}) + public static class FileInfo { + private String fileType; + private String fileName; + private long fileSize; + private long lastModified; + + public String getFileType() { + return fileType; + } + + public void setFileType(String fileType) { + this.fileType = fileType; + } + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public long getFileSize() { + return fileSize; + } + + public void setFileSize(long fileSize) { + this.fileSize = fileSize; + } + + public long getLastModified() { + return lastModified; + } + + public void setLastModified(long lastModified) { + this.lastModified = lastModified; + } + } + + + public static FileInfo getFile(String filePath, Config config) throws Throwable { + if (!hasFile(filePath, config)) { + throw new IllegalArgumentException("文件不存在"); + } + String bucketName = config.getBucketName(); + if (bucketName == null || bucketName.trim().isEmpty()) { + throw new IllegalArgumentException("bucketName不能为空"); + } + OSS ossClient = new OSSClientBuilder().build( + config.getEndpoint(), + config.getAccessKeyId(), + config.getAccessKeySecret() + ); + try { + String fileKey = filePath.trim(); + ObjectMetadata summary = ossClient.getObjectMetadata(bucketName, fileKey); + long lastModified = summary.getLastModified().getTime(); + long fileSize = summary.getContentLength(); + FileInfo fileInfo = new FileInfo(); + fileInfo.setFileType("file"); + fileInfo.setFileName(getFileName(fileKey)); + fileInfo.setFileSize(fileSize); + fileInfo.setLastModified(lastModified); + return fileInfo; + } catch (OSSException | ClientException e) { + throw new Throwable("OSS操作异常:" + e.getMessage(), e); + } finally { + // 关闭客户端释放资源 + if (ossClient != null) { + ossClient.shutdown(); + } + } + } + + + public static List getFiles(String folderPath, Config config) throws Throwable { + String bucketName = config.getBucketName(); + if (bucketName == null || bucketName.trim().isEmpty()) { + throw new IllegalArgumentException("bucketName不能为空"); + } + // 创建OSS客户端(3.x版本使用OSSClientBuilder) + OSS ossClient = new OSSClientBuilder().build( + config.getEndpoint(), + config.getAccessKeyId(), + config.getAccessKeySecret() + ); + List result = new ArrayList<>(); + try { + int pageSize = 500; + boolean hasMore = true; + String startAfter = null; + while (hasMore) { + String prefix = folderPath; + if (prefix == null || prefix.trim().isEmpty()) { + prefix = ""; + } else if (!prefix.endsWith("/")) { + prefix += "/"; + } + ListObjectsV2Request request = new ListObjectsV2Request(bucketName) + .withPrefix(prefix) // 指定当前目录前缀 + .withDelimiter("/") // 分隔符:仅返回当前目录的直接子对象 + .withMaxKeys(pageSize); // 最大返回数量(OSS限制) + if (startAfter != null) { + request.withStartAfter(startAfter); + } + ListObjectsV2Result resultV2 = ossClient.listObjectsV2(request); + List commonPrefixes = resultV2.getCommonPrefixes(); + for (String commonPrefix : commonPrefixes) { + if (!commonPrefix.equals(prefix)) { + String folderName = commonPrefix.substring(prefix.length()); + if (folderName.endsWith("/")) { + folderName = folderName.substring(0, folderName.length() - 1); + } + long fileSize = 0; + long lastModified = 0; + FileInfo fileInfo = new FileInfo(); + fileInfo.setFileType("folder"); + fileInfo.setFileName(folderName); + fileInfo.setFileSize(fileSize); + fileInfo.setLastModified(lastModified); + result.add(fileInfo); + } + } + List objectSummaries = resultV2.getObjectSummaries(); + if (!objectSummaries.isEmpty()) { + for (OSSObjectSummary summary : objectSummaries) { + String objectKey = summary.getKey(); + if (!objectKey.equals(prefix)) { + String relativePath = objectKey.substring(prefix.length()); + long fileSize = summary.getSize(); + long lastModified = summary.getLastModified().getTime(); + FileInfo fileInfo = new FileInfo(); + fileInfo.setFileType("file"); + fileInfo.setFileName(relativePath); + fileInfo.setFileSize(fileSize); + fileInfo.setLastModified(lastModified); + result.add(fileInfo); + } + startAfter = objectKey; + } + } else { + startAfter = null; + hasMore = false; + } + } + } catch (OSSException | ClientException e) { + throw new Throwable("OSS操作异常:" + e.getMessage(), e); + } finally { + if (ossClient != null) { + ossClient.shutdown(); + } + } + return ArrayUtil.distinct(result, new ArrayUtil.DistinctHandler() { + @Override + public String distinctKey(FileInfo fileInfo) { + return fileInfo.getFileType() + "/" + fileInfo.getFileName(); + } + }); + } + + public static void createFolder(String folderPath, Config config) throws Throwable { + // 参数校验 + if (hasFolder(folderPath, config)) { + // 目录已经存在,直接返回,忽略处理 + return; + } + if (folderPath.trim().isEmpty()) { + throw new IllegalArgumentException("文件夹路径不能为空"); + } + String bucketName = config.getBucketName(); + if (bucketName == null || bucketName.trim().isEmpty()) { + throw new IllegalArgumentException("bucketName不能为空"); + } + OSS ossClient = new OSSClientBuilder().build( + config.getEndpoint(), + config.getAccessKeyId(), + config.getAccessKeySecret() + ); + try { + String folderKey = folderPath.trim(); + if (!folderKey.endsWith("/")) { + folderKey += "/"; + } + if (ossClient.doesObjectExist(bucketName, folderKey)) { + throw new RuntimeException("文件夹已存在:" + folderPath); + } + ObjectMetadata metadata = new ObjectMetadata(); + metadata.setContentLength(0); + ossClient.putObject(bucketName, folderKey, new java.io.ByteArrayInputStream(new byte[0]), metadata); + } catch (OSSException e) { + throw new Throwable(String.format("OSS服务异常: 错误码=%s, 信息=%s", e.getErrorCode(), e.getMessage()), e); + } catch (ClientException e) { + throw new Throwable("OSS客户端异常: " + e.getMessage(), e); + } finally { + if (ossClient != null) { + ossClient.shutdown(); + } + } + } + + public static void renameFile(String targetPath, String filePath, String fileType, Config config) throws Throwable { + // 参数校验 + if (targetPath == null || targetPath.trim().isEmpty()) { + throw new IllegalArgumentException("目标路径不能为空"); + } + if (filePath == null || filePath.trim().isEmpty()) { + throw new IllegalArgumentException("文件路径不能为空"); + } + if ((!"file".equals(fileType) && !"folder".equals(fileType))) { + throw new IllegalArgumentException("文件类型必须为file或folder"); + } + String bucketName = config.getBucketName(); + if (bucketName == null || bucketName.trim().isEmpty()) { + throw new IllegalArgumentException("bucketName不能为空"); + } + OSS ossClient = new OSSClientBuilder().build( + config.getEndpoint(), + config.getAccessKeyId(), + config.getAccessKeySecret() + ); + try { + if ("folder".equals(fileType)) { + if (!filePath.endsWith("/")) { + filePath += "/"; + } + if (!targetPath.endsWith("/")) { + targetPath += "/"; + } + } + if (Objects.equals(filePath, targetPath)) { + // 文件名称一致,直接忽略 + return; + } + CopyObjectRequest copyRequest = new CopyObjectRequest(bucketName, filePath, + bucketName, targetPath); + CopyObjectResult copyResult = ossClient.copyObject(copyRequest); + if (copyResult == null) { + throw new RuntimeException("复制对象失败,无法完成重命名"); + } + ossClient.setObjectAcl(bucketName, targetPath, config.getObjectAcl()); + ossClient.deleteObject(bucketName, filePath); + } catch (OSSException e) { + throw new Throwable(String.format("OSS服务异常: 错误码=%s, 错误信息=%s", + e.getErrorCode(), e.getMessage()), e); + } catch (ClientException e) { + throw new Throwable("OSS客户端异常: " + e.getMessage(), e); + } finally { + if (ossClient != null) { + ossClient.shutdown(); + } + } + } + + public static void deleteFile(String targetPath, String fileType, Config config) throws Throwable { + // 参数校验 + if (targetPath == null || targetPath.trim().isEmpty()) { + throw new IllegalArgumentException("目标路径不能为空"); + } + if ((!"file".equals(fileType) && !"folder".equals(fileType))) { + throw new IllegalArgumentException("文件类型必须为file或folder"); + } + String bucketName = config.getBucketName(); + if (bucketName == null || bucketName.trim().isEmpty()) { + throw new IllegalArgumentException("bucketName不能为空"); + } + OSS ossClient = new OSSClientBuilder().build( + config.getEndpoint(), + config.getAccessKeyId(), + config.getAccessKeySecret() + ); + try { + String targetKey = targetPath.trim(); + if ("folder".equals(fileType) && !targetKey.endsWith("/")) { + targetKey += "/"; + } + if ("file".equals(fileType)) { + if (!ossClient.doesObjectExist(bucketName, targetKey)) { + throw new RuntimeException("文件不存在:" + targetKey); + } + ossClient.deleteObject(bucketName, targetKey); + } else { + List allObjectKeys = new ArrayList<>(); + String continuationToken = null; + do { + ListObjectsV2Request listRequest = new ListObjectsV2Request(bucketName) + .withPrefix(targetKey) // 只列举目标文件夹下的内容 + .withMaxKeys(1000); // 每页最大数量 + if (continuationToken != null) { + listRequest.withContinuationToken(continuationToken); + } + ListObjectsV2Result listResult = ossClient.listObjectsV2(listRequest); + List summaries = listResult.getObjectSummaries(); + for (OSSObjectSummary summary : summaries) { + allObjectKeys.add(summary.getKey()); + } + List commonPrefixes = listResult.getCommonPrefixes(); + allObjectKeys.addAll(commonPrefixes); + continuationToken = listResult.getNextContinuationToken(); + } while (continuationToken != null); + if (!allObjectKeys.isEmpty()) { + DeleteObjectsRequest deleteRequest = new DeleteObjectsRequest(bucketName) + .withKeys(allObjectKeys); + ossClient.deleteObjects(deleteRequest); + } + if (ossClient.doesObjectExist(bucketName, targetKey)) { + ossClient.deleteObject(bucketName, targetKey); + } + } + } catch (OSSException e) { + throw new Throwable(String.format("OSS服务异常: 错误码=%s, 信息=%s", + e.getErrorCode(), e.getMessage()), e); + } catch (ClientException e) { + throw new Throwable("OSS客户端异常: " + e.getMessage(), e); + } finally { + if (ossClient != null) { + ossClient.shutdown(); + } + } + } + + public static String uploadFile(byte[] content, String targetPath, Config config) throws Throwable { + if (content == null) { + throw new IllegalArgumentException("文件内容不能为空"); + } + if (targetPath == null || targetPath.trim().isEmpty()) { + throw new IllegalArgumentException("目标路径不能为空"); + } + String bucketName = config.getBucketName(); + if (bucketName == null || bucketName.trim().isEmpty()) { + throw new IllegalArgumentException("bucketName不能为空"); + } + OSS ossClient = new OSSClientBuilder().build( + config.getEndpoint(), + config.getAccessKeyId(), + config.getAccessKeySecret() + ); + try { + ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(content); + ObjectMetadata objectMetadata = new ObjectMetadata(); + objectMetadata.setContentLength(byteArrayInputStream.available()); + objectMetadata.setCacheControl("no-cache"); + objectMetadata.setHeader("Pragma", "no-cache"); + objectMetadata.setContentType(getContentType(targetPath, config.getContentTypeMap())); + objectMetadata.setContentDisposition("inline;filename=" + getFileName(targetPath)); + ossClient.putObject(bucketName, targetPath, byteArrayInputStream, objectMetadata); + ossClient.setObjectAcl(bucketName, targetPath, config.getObjectAcl()); + byteArrayInputStream.close(); + String url = config.getProtocolType() + config.getBucketName() + + "." + config.getEndpoint() + "/" + targetPath; + if (config.getDomainName() != null && !config.getDomainName().isEmpty()) { + url = url.replaceFirst(config.getBucketName() + "." + + config.getEndpoint(), config.getDomainName()); + } + return url; + } catch (OSSException e) { + throw new Throwable(String.format("OSS服务异常: 错误码=%s, 信息=%s", + e.getErrorCode(), e.getMessage()), e); + } catch (ClientException e) { + throw new Throwable("OSS客户端异常: " + e.getMessage(), e); + } finally { + if (ossClient != null) { + ossClient.shutdown(); + } + } + } + + public static boolean hasFile(String filePath, Config config) throws Throwable { + // 参数校验 + if (filePath == null || filePath.trim().isEmpty()) { + throw new IllegalArgumentException("文件路径不能为空"); + } + String bucketName = config.getBucketName(); + if (bucketName == null || bucketName.trim().isEmpty()) { + throw new IllegalArgumentException("bucketName不能为空"); + } + OSS ossClient = new OSSClientBuilder().build( + config.getEndpoint(), + config.getAccessKeyId(), + config.getAccessKeySecret() + ); + try { + String fileKey = filePath.trim(); + return ossClient.doesObjectExist(bucketName, fileKey); + } catch (OSSException e) { + throw new Throwable(String.format("OSS服务异常: 错误码=%s, 信息=%s", + e.getErrorCode(), e.getMessage()), e); + } catch (ClientException e) { + throw new Throwable("OSS客户端异常: " + e.getMessage(), e); + } finally { + if (ossClient != null) { + ossClient.shutdown(); + } + } + } + + public static boolean hasFolder(String filePath, Config config) throws Throwable { + // 参数校验 + if (filePath == null || filePath.trim().isEmpty()) { + throw new IllegalArgumentException("目录路径不能为空"); + } + String bucketName = config.getBucketName(); + if (bucketName == null || bucketName.trim().isEmpty()) { + throw new IllegalArgumentException("bucketName不能为空"); + } + OSS ossClient = new OSSClientBuilder().build( + config.getEndpoint(), + config.getAccessKeyId(), + config.getAccessKeySecret() + ); + try { + String folderKey = filePath.trim(); + if (!folderKey.endsWith("/")) { + folderKey += "/"; + } + if (ossClient.doesObjectExist(bucketName, folderKey)) { + return true; + } + ListObjectsV2Request request = new ListObjectsV2Request(bucketName) + .withPrefix(folderKey) // 仅列举该目录前缀下的对象 + .withDelimiter("/") // 按目录分隔 + .withMaxKeys(1); // 仅需查询1条数据,提升效率 + ListObjectsV2Result result = ossClient.listObjectsV2(request); + return !result.getObjectSummaries().isEmpty() || !result.getCommonPrefixes().isEmpty(); + } catch (OSSException e) { + throw new Throwable(String.format("OSS服务异常: 错误码=%s, 信息=%s", + e.getErrorCode(), e.getMessage()), e); + } catch (ClientException e) { + throw new Throwable("OSS客户端异常: " + + e.getMessage(), e); + } finally { + if (ossClient != null) { + ossClient.shutdown(); + } + } + } + + /** + * 获取文件的后缀名 + * + * @param fileName 文件名名称 + * @return 文件后缀名 + */ + public static String getFileSuffix(String fileName) { + int indexOf = fileName.lastIndexOf("."); + String suffix = ""; + if (indexOf >= 0) { + suffix = fileName.substring(indexOf); + } + return suffix.toLowerCase(); + } + + private static String getFileName(String filePath) { + if (filePath == null || filePath.isEmpty()) { + return ""; + } + String normalizedPath = filePath.replace('\\', '/'); + int lastSeparatorIndex = normalizedPath.lastIndexOf('/'); + if (lastSeparatorIndex == -1) { + return normalizedPath; + } + return normalizedPath.substring(lastSeparatorIndex + 1); + } + + /** + * 获取文件的内容类型 + * + * @param fileName 文件名称 + * @return 文件的内容类型 + */ + private static String getContentType(String fileName, String contentTypeMap) { + String contentType = null; + String suffix = getFileSuffix(fileName).toLowerCase(); + try { + if (contentTypeMap != null && !contentTypeMap.isEmpty()) { + JSONObject jsonObject = JSONObject.parseObject(contentTypeMap); + if (jsonObject.containsKey(suffix)) { + contentType = jsonObject.getString(suffix); + } + if (contentType != null && !contentType.isEmpty()) { + return contentType; + } + } + } catch (Throwable ignored) { + } + switch (suffix) { + case ".bmp": + contentType = "image/bmp"; + break; + case ".gif": + contentType = "image/gif"; + break; + case ".png": + contentType = "image/png"; + break; + case ".jpg": + case ".jpeg": + contentType = "image/jpeg"; + break; + case ".webp": + contentType = "image/webp"; + break; + case ".svg": + contentType = "image/svg+xml"; + break; + case ".css": + contentType = "text/css"; + break; + case ".js": + contentType = "application/javascript"; + break; + case ".json": + contentType = "application/json"; + break; + case ".jsonld": + contentType = "application/ld+json"; + break; + case ".woff": + contentType = "font/woff"; + break; + case ".woff2": + contentType = "font/woff2"; + break; + case ".ttf": + contentType = "font/ttf"; + break; + case ".otf": + contentType = "font/otf"; + break; + case ".eot": + contentType = "application/vnd.ms-fontobject"; + break; + case ".mp4": + contentType = "video/mp4"; + break; + case ".webm": + contentType = "video/webm"; + break; + case ".mp3": + contentType = "audio/mpeg"; + break; + case ".wav": + contentType = "audio/wav"; + break; + case ".ogg": + contentType = "audio/ogg"; + break; + case ".html": + case ".htm": + contentType = "text/html"; + break; + case ".xml": + contentType = "text/xml"; + break; + case ".pdf": + contentType = "application/pdf"; + break; + case ".vsd": + contentType = "application/vnd.visio"; + break; + case ".ppt": + contentType = "application/vnd.ms-powerpoint"; + break; + case ".pptx": + contentType = "application/vnd.openxmlformats-officedocument.presentationml.presentation"; + break; + case ".doc": + contentType = "application/msword"; + break; + case ".docx": + contentType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; + break; + // 其他常见文件类型 + case ".txt": + contentType = "text/plain"; + break; + case ".zip": + contentType = "application/zip"; + break; + case ".rar": + contentType = "application/x-rar-compressed"; + break; + case ".csv": + contentType = "text/csv"; + break; + case ".xlsx": + contentType = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; + break; + case ".xls": + contentType = "application/vnd.ms-excel"; + break; + default: + contentType = "application/octet-stream"; + break; + } + return contentType; + } + +} \ No newline at end of file diff --git a/src/main/java/com/iqudoo/platform/application/properties/AppProperties.java b/src/main/java/com/iqudoo/platform/application/properties/AppProperties.java new file mode 100644 index 0000000..67a19a2 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/properties/AppProperties.java @@ -0,0 +1,15 @@ +package com.iqudoo.platform.application.properties; + +import lombok.Data; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; + +@Data +@Configuration +@ConfigurationProperties(prefix = "app") +public class AppProperties { + + private String timeZone = "Asia/Shanghai"; + private String mybatisMapperScan = "com.*.database.mapper"; + +} diff --git a/src/main/java/com/iqudoo/platform/application/scheduling/LoopScheduling.java b/src/main/java/com/iqudoo/platform/application/scheduling/LoopScheduling.java new file mode 100644 index 0000000..caf4e62 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/scheduling/LoopScheduling.java @@ -0,0 +1,61 @@ +package com.iqudoo.platform.application.scheduling; + +import com.iqudoo.framework.tape.Tape; +import com.iqudoo.framework.tape.modules.proto.Proto; +import com.iqudoo.platform.application.facade.request.*; +import com.iqudoo.platform.application.facade.service.ISystemAsyncTaskInfoService; +import org.slf4j.Logger; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +@Component +public class LoopScheduling { + + private static final Logger LOGGER = Tape.getLogger(LoopScheduling.class); + + @Resource + private ISystemAsyncTaskInfoService systemAsyncTaskInfoService; + + private boolean resetTaskFlag = false; + + /** + * 执行异步任务心跳检查 + * 优化:从2秒改为5秒,减少CPU占用和数据库查询频率 + * 如果业务需要更频繁的检查,可以适当调整,但不建议低于5秒 + */ + @Scheduled(fixedRate = 5 * 1000, initialDelay = 10 * 1000) + public void delayCheckAsyncTask() throws Throwable { + if (!resetTaskFlag) { + resetTaskFlag = true; + // reset async task + SystemAsyncTaskInfoResetParam systemAsyncTaskInfoResetParam + = new SystemAsyncTaskInfoResetParam(); + Proto resetTaskProto + = systemAsyncTaskInfoService.doReset(systemAsyncTaskInfoResetParam); + if (!resetTaskProto.isSuccess()) { + LOGGER.error("重启上次未执行完成的异步任务", resetTaskProto.getErr()); + } + } + SystemAsyncTaskInfoScheduleParam systemAsyncTaskInfoScheduleParam = new SystemAsyncTaskInfoScheduleParam(); + systemAsyncTaskInfoScheduleParam.setThrowThrowable(true); + Proto scheduleProto = systemAsyncTaskInfoService.doSchedule(systemAsyncTaskInfoScheduleParam); + if (!scheduleProto.isSuccess()) { + LOGGER.error("检查异步任务调度失败", scheduleProto.getErr()); + } + SystemAsyncTaskInfoTickParam systemAsyncTaskInfoTickParam = new SystemAsyncTaskInfoTickParam(); + systemAsyncTaskInfoTickParam.setThrowThrowable(true); + Proto tickProto = systemAsyncTaskInfoService.doTick(systemAsyncTaskInfoTickParam); + if (!tickProto.isSuccess()) { + LOGGER.error("检查异步任务心跳失败", tickProto.getErr()); + } + SystemAsyncTaskInfoClearParam systemAsyncTaskInfoClearParam = new SystemAsyncTaskInfoClearParam(); + systemAsyncTaskInfoClearParam.setThrowThrowable(true); + Proto clearProto = systemAsyncTaskInfoService.doClear(systemAsyncTaskInfoClearParam); + if (!clearProto.isSuccess()) { + LOGGER.error("检查清理异步任务失败", clearProto.getErr()); + } + } + +} diff --git a/src/main/java/com/iqudoo/platform/application/setting/SystemGlobalFileUploadConfig.java b/src/main/java/com/iqudoo/platform/application/setting/SystemGlobalFileUploadConfig.java new file mode 100644 index 0000000..d2653e4 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/setting/SystemGlobalFileUploadConfig.java @@ -0,0 +1,81 @@ +package com.iqudoo.platform.application.setting; + +import com.iqudoo.framework.tape.modules.IModuleSetting; +import com.iqudoo.framework.tape.modules.annotation.SettingConfiguration; +import com.iqudoo.framework.tape.modules.annotation.SettingField; +import com.iqudoo.platform.application.constants.BizConstants; +import lombok.Data; + +@SuppressWarnings("HttpUrlsUsage") +@Data +@SettingConfiguration(group = BizConstants.SETTING_GROUP_SYSTEM, + key = "system_global_file_upload_config", + title = "文件上传配置", + desc = "文件上传到服务器或0SS存储配置", + sort = 999998) +public class SystemGlobalFileUploadConfig { + + @SettingField(label = "功能开关") + private boolean enableFlag = false; + + @SettingField(label = "存储类型", + show = "record.enableFlag", + tips = "本地存储适用与单节点服务器,如多节点服务,请适用其他云存储", + type = IModuleSetting.SettingFieldType.TYPE_RADIO, + options = "本地存储|local\n阿里云OSS|ali-oss") + private String saveType = "local"; + + @SettingField(label = "阿里云请求协议protocolType", + show = "record.enableFlag && record.saveType == 'ali-oss'", + type = IModuleSetting.SettingFieldType.TYPE_RADIO, + options = "HTTPS://|https://\nHTTP://|http://\n自动(//)|//") + private String aliOssProtocolType = "//"; + + @SettingField(label = "阿里云accessKeyId", + show = "record.enableFlag && record.saveType == 'ali-oss'") + private String aliOssAccessKeyId = ""; + + @SettingField(label = "阿里云accessKeySecret", + show = "record.enableFlag && record.saveType == 'ali-oss'") + private String aliOssAccessKeySecret = ""; + + @SettingField(label = "阿里云bucketName", + show = "record.enableFlag && record.saveType == 'ali-oss'") + private String aliOssBucketName = ""; + + @SettingField(label = "阿里云服务节点endpoint", + show = "record.enableFlag && record.saveType == 'ali-oss'") + private String aliOssEndpoint = ""; + + @SettingField(label = "阿里云存储路径baseFolder", + show = "record.enableFlag && record.saveType == 'ali-oss'", + tips = "文件存储路径,支持{{date}}待日期变量,日期格式2025-10-01") + private String aliOssBaseFolder = "upload/{{date}}"; + + @SettingField(label = "阿里云绑定域名domainName", + show = "record.enableFlag && record.saveType == 'ali-oss'") + private String aliOssDomainName = ""; + + @SettingField(label = "本地文件协议protocolType", + show = "record.enableFlag && record.saveType == 'local'", + type = IModuleSetting.SettingFieldType.TYPE_RADIO, + options = "HTTPS://|https://\nHTTP://|http://\n自动(//)|//") + private String localProtocolType = "//"; + + @SettingField(label = "本地文件路径baseFolder", + show = "record.enableFlag && record.saveType == 'local'", + tips = "文件存储路径,支持{{date}}待日期变量,日期格式2025-10-01") + private String localBaseFolder = "upload/{{date}}"; + + @SettingField(label = "本地文件域名domainName", + show = "record.enableFlag && record.saveType == 'local'") + private String localDomainName = ""; + + @SettingField(label = "文件转存域名白名单", + tips = "文件转存域名白名单,在白名单内的域名不做文件转存,配合文件转存接口使用,逗号分隔或换行分隔", + type = IModuleSetting.SettingFieldType.TYPE_TEXTAREA, + show = "record.enableFlag", + rows = 4) + private String fileTransferDomainWhiteList = ""; + +} diff --git a/src/main/java/com/iqudoo/platform/application/setting/SystemGlobalStaticFileConfig.java b/src/main/java/com/iqudoo/platform/application/setting/SystemGlobalStaticFileConfig.java new file mode 100644 index 0000000..20b3537 --- /dev/null +++ b/src/main/java/com/iqudoo/platform/application/setting/SystemGlobalStaticFileConfig.java @@ -0,0 +1,33 @@ +package com.iqudoo.platform.application.setting; + +import com.iqudoo.framework.tape.modules.IModuleSetting; +import com.iqudoo.framework.tape.modules.annotation.SettingConfiguration; +import com.iqudoo.framework.tape.modules.annotation.SettingField; +import com.iqudoo.platform.application.constants.BizConstants; +import lombok.Data; + +@Data +@SettingConfiguration(group = BizConstants.SETTING_GROUP_SYSTEM, + key = "system_global_static_file_config", + title = "静态文件配置", + desc = "静态文件路由转发配置", + sort = 999999) +public class SystemGlobalStaticFileConfig { + + @SettingField(label = "支持GZip压缩", + tips = "静态文件支持gzip压缩,推荐开启") + private boolean staticFileGzipEnable = true; + + @SettingField(label = "静态资源挂载", + tips = "静态文件目录,多目录时换行,支持classpath:路径,格式如下:[访问路径]文件路径", + type = IModuleSetting.SettingFieldType.TYPE_TEXTAREA, + rows = 10) + private String staticFileFolder = """ + web-www + [docs]api-docs + [admin]web-admin + [doctor]web-doctor + [workbench]web-workbench + """; + +} diff --git a/src/main/resources/application-local.yml b/src/main/resources/application-local.yml new file mode 100644 index 0000000..d74e752 --- /dev/null +++ b/src/main/resources/application-local.yml @@ -0,0 +1,15 @@ +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://47.100.5.233:33306/t_logistics_local?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai + username: t_logistics_local + password: jw873PYBFYYDiCQB + hikari: + connection-timeout: 10000 + validation-timeout: 3000 + idle-timeout: 60000 + login-timeout: 5 + max-lifetime: 60000 + maximum-pool-size: 100 + minimum-idle: 5 + read-only: false diff --git a/src/main/resources/application-pre.yml b/src/main/resources/application-pre.yml new file mode 100644 index 0000000..bbf1775 --- /dev/null +++ b/src/main/resources/application-pre.yml @@ -0,0 +1,15 @@ +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://47.100.5.233:33306/t_logistics_local?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai + username: t_logistics_local + password: jw873PYBFYYDiCQB + hikari: + connection-timeout: 10000 + validation-timeout: 3000 + idle-timeout: 60000 + login-timeout: 5 + max-lifetime: 60000 + maximum-pool-size: 10 + minimum-idle: 5 + read-only: false diff --git a/src/main/resources/application-prod.yml b/src/main/resources/application-prod.yml new file mode 100644 index 0000000..6a9f41e --- /dev/null +++ b/src/main/resources/application-prod.yml @@ -0,0 +1,15 @@ +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://1Panel-mysql-VU9g:3306/t_logistics_local?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true + username: t_logistics_local + password: jw873PYBFYYDiCQB + hikari: + connection-timeout: 10000 + validation-timeout: 3000 + idle-timeout: 60000 + login-timeout: 5 + max-lifetime: 60000 + maximum-pool-size: 10 + minimum-idle: 5 + read-only: false diff --git a/src/main/resources/application-qa.yml b/src/main/resources/application-qa.yml new file mode 100644 index 0000000..bbf1775 --- /dev/null +++ b/src/main/resources/application-qa.yml @@ -0,0 +1,15 @@ +spring: + datasource: + driver-class-name: com.mysql.cj.jdbc.Driver + url: jdbc:mysql://47.100.5.233:33306/t_logistics_local?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=Asia/Shanghai + username: t_logistics_local + password: jw873PYBFYYDiCQB + hikari: + connection-timeout: 10000 + validation-timeout: 3000 + idle-timeout: 60000 + login-timeout: 5 + max-lifetime: 60000 + maximum-pool-size: 10 + minimum-idle: 5 + read-only: false diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..6ae7b9d --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,29 @@ +server: + port: @server-port@ + +spring: + profiles: + active: @spring-environment@ + mvc: + servlet: + load-on-startup: 1 + jackson: + deserialization: + FAIL_ON_UNKNOWN_PROPERTIES: false + default-property-inclusion: NON_NULL + +logging: + level: + org.apache.cxf: WARN + +app: + time-zone: @app-time-zone@ + mybatis-mapper-scan: com.**.database.mapper + +tape: + req-limit: @tape-req-limit@ + +mybatis: + mapper-locations: classpath:mybatis/mapper/*.xml + configuration: + cache-enabled: true diff --git a/src/main/resources/environment.properties b/src/main/resources/environment.properties new file mode 100644 index 0000000..728052f --- /dev/null +++ b/src/main/resources/environment.properties @@ -0,0 +1,3 @@ +tokenFilePath=data/sankuai/openapi/ +isSig=1 +env=1 \ No newline at end of file diff --git a/src/main/resources/logback-spring.xml b/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..ccc56c1 --- /dev/null +++ b/src/main/resources/logback-spring.xml @@ -0,0 +1,201 @@ + + + + + + + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + + + DEBUG + ACCEPT + DENY + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + + + WARN + ACCEPT + DENY + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + + + ERROR + ACCEPT + DENY + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + + ${LOG_HOME}/all.log + + ${LOG_HOME}/info.%d{yyyy-MM-dd}.%i.log.gz + 30 + + 100MB + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + + ${LOG_HOME}/warn.log + + WARN + ACCEPT + DENY + + + ${LOG_HOME}/warn.%d{yyyy-MM-dd}.%i.log.gz + 30 + + 100MB + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + + ${LOG_HOME}/debug.log + + DEBUG + ACCEPT + DENY + + + ${LOG_HOME}/debug.%d{yyyy-MM-dd}.%i.log.gz + 30 + + 100MB + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + + ${LOG_HOME}/error.log + + ERROR + ACCEPT + DENY + + + ${LOG_HOME}/error.%d{yyyy-MM-dd}.%i.log.gz + 30 + + 100MB + + + + %d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n + UTF-8 + + + + + + true + 2048 + 0 + + + + true + 2048 + 0 + + + + true + 2048 + 0 + + + + true + 2048 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/mybatis.generator.xml b/src/main/resources/mybatis.generator.xml new file mode 100644 index 0000000..d421a0f --- /dev/null +++ b/src/main/resources/mybatis.generator.xml @@ -0,0 +1,182 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + +
+ + + + +
+ + + + + +
+ + + + + +
+ + + + + +
+ + + + +
+ + + + + + +
+
\ No newline at end of file diff --git a/src/main/resources/mybatis.properties b/src/main/resources/mybatis.properties new file mode 100644 index 0000000..62d5c7a --- /dev/null +++ b/src/main/resources/mybatis.properties @@ -0,0 +1,5 @@ +mybatis.generator.package-name=com.iqudoo.platform.application.database +mybatis.generator.driver-class-name=com.mysql.cj.jdbc.Driver +mybatis.generator.url=jdbc:mysql://47.100.5.233:33306/t_vet_local?useUnicode=true&characterEncoding=utf-8 +mybatis.generator.username=t_vet_local +mybatis.generator.password=hp7pNKyfYHbHa8A5 diff --git a/src/main/resources/mybatis/mapper/SystemAdminInfoMapper.xml b/src/main/resources/mybatis/mapper/SystemAdminInfoMapper.xml new file mode 100644 index 0000000..a34cb14 --- /dev/null +++ b/src/main/resources/mybatis/mapper/SystemAdminInfoMapper.xml @@ -0,0 +1,449 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + guid, username, nickname, pwd_md5, pwd_slot, opt_remark, opt_status, opt_super, is_hidden, + is_delete, delete_token, data_version, create_time, update_time + + + + + + delete from t_system_admin_info + where guid = #{guid,jdbcType=BIGINT} + + + + delete from t_system_admin_info + + + + + + + insert into t_system_admin_info (guid, username, nickname, + pwd_md5, pwd_slot, opt_remark, + opt_status, opt_super, is_hidden, + is_delete, delete_token, data_version, + create_time, update_time) + values (#{guid,jdbcType=BIGINT}, #{username,jdbcType=VARCHAR}, #{nickname,jdbcType=VARCHAR}, + #{pwdMd5,jdbcType=VARCHAR}, #{pwdSlot,jdbcType=VARCHAR}, #{optRemark,jdbcType=VARCHAR}, + #{optStatus,jdbcType=INTEGER}, #{optSuper,jdbcType=INTEGER}, #{isHidden,jdbcType=INTEGER}, + #{isDelete,jdbcType=INTEGER}, #{deleteToken,jdbcType=VARCHAR}, #{dataVersion,jdbcType=INTEGER}, + #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}) + + + + insert into t_system_admin_info + + + guid, + + + username, + + + nickname, + + + pwd_md5, + + + pwd_slot, + + + opt_remark, + + + opt_status, + + + opt_super, + + + is_hidden, + + + is_delete, + + + delete_token, + + + data_version, + + + create_time, + + + update_time, + + + + + #{guid,jdbcType=BIGINT}, + + + #{username,jdbcType=VARCHAR}, + + + #{nickname,jdbcType=VARCHAR}, + + + #{pwdMd5,jdbcType=VARCHAR}, + + + #{pwdSlot,jdbcType=VARCHAR}, + + + #{optRemark,jdbcType=VARCHAR}, + + + #{optStatus,jdbcType=INTEGER}, + + + #{optSuper,jdbcType=INTEGER}, + + + #{isHidden,jdbcType=INTEGER}, + + + #{isDelete,jdbcType=INTEGER}, + + + #{deleteToken,jdbcType=VARCHAR}, + + + #{dataVersion,jdbcType=INTEGER}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{updateTime,jdbcType=TIMESTAMP}, + + + + + + + update t_system_admin_info + + + guid = #{record.guid,jdbcType=BIGINT}, + + + username = #{record.username,jdbcType=VARCHAR}, + + + nickname = #{record.nickname,jdbcType=VARCHAR}, + + + pwd_md5 = #{record.pwdMd5,jdbcType=VARCHAR}, + + + pwd_slot = #{record.pwdSlot,jdbcType=VARCHAR}, + + + opt_remark = #{record.optRemark,jdbcType=VARCHAR}, + + + opt_status = #{record.optStatus,jdbcType=INTEGER}, + + + opt_super = #{record.optSuper,jdbcType=INTEGER}, + + + is_hidden = #{record.isHidden,jdbcType=INTEGER}, + + + is_delete = #{record.isDelete,jdbcType=INTEGER}, + + + delete_token = #{record.deleteToken,jdbcType=VARCHAR}, + + + data_version = #{record.dataVersion,jdbcType=INTEGER}, + + + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + + + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + + + + + + + + + update t_system_admin_info + set guid = #{record.guid,jdbcType=BIGINT}, + username = #{record.username,jdbcType=VARCHAR}, + nickname = #{record.nickname,jdbcType=VARCHAR}, + pwd_md5 = #{record.pwdMd5,jdbcType=VARCHAR}, + pwd_slot = #{record.pwdSlot,jdbcType=VARCHAR}, + opt_remark = #{record.optRemark,jdbcType=VARCHAR}, + opt_status = #{record.optStatus,jdbcType=INTEGER}, + opt_super = #{record.optSuper,jdbcType=INTEGER}, + is_hidden = #{record.isHidden,jdbcType=INTEGER}, + is_delete = #{record.isDelete,jdbcType=INTEGER}, + delete_token = #{record.deleteToken,jdbcType=VARCHAR}, + data_version = #{record.dataVersion,jdbcType=INTEGER}, + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + update_time = #{record.updateTime,jdbcType=TIMESTAMP} + + + + + + + update t_system_admin_info + + + username = #{username,jdbcType=VARCHAR}, + + + nickname = #{nickname,jdbcType=VARCHAR}, + + + pwd_md5 = #{pwdMd5,jdbcType=VARCHAR}, + + + pwd_slot = #{pwdSlot,jdbcType=VARCHAR}, + + + opt_remark = #{optRemark,jdbcType=VARCHAR}, + + + opt_status = #{optStatus,jdbcType=INTEGER}, + + + opt_super = #{optSuper,jdbcType=INTEGER}, + + + is_hidden = #{isHidden,jdbcType=INTEGER}, + + + is_delete = #{isDelete,jdbcType=INTEGER}, + + + delete_token = #{deleteToken,jdbcType=VARCHAR}, + + + data_version = #{dataVersion,jdbcType=INTEGER}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + + + where guid = #{guid,jdbcType=BIGINT} + + + + update t_system_admin_info + set username = #{username,jdbcType=VARCHAR}, + nickname = #{nickname,jdbcType=VARCHAR}, + pwd_md5 = #{pwdMd5,jdbcType=VARCHAR}, + pwd_slot = #{pwdSlot,jdbcType=VARCHAR}, + opt_remark = #{optRemark,jdbcType=VARCHAR}, + opt_status = #{optStatus,jdbcType=INTEGER}, + opt_super = #{optSuper,jdbcType=INTEGER}, + is_hidden = #{isHidden,jdbcType=INTEGER}, + is_delete = #{isDelete,jdbcType=INTEGER}, + delete_token = #{deleteToken,jdbcType=VARCHAR}, + data_version = #{dataVersion,jdbcType=INTEGER}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + update_time = #{updateTime,jdbcType=TIMESTAMP} + where guid = #{guid,jdbcType=BIGINT} + + + insert into t_system_admin_info (guid, username, nickname, pwd_md5, pwd_slot, opt_remark, opt_status, opt_super, is_hidden, is_delete, delete_token, data_version, create_time, update_time) values + + (#{item.guid}, #{item.username}, #{item.nickname}, #{item.pwdMd5}, #{item.pwdSlot}, #{item.optRemark}, #{item.optStatus}, #{item.optSuper}, #{item.isHidden}, #{item.isDelete}, #{item.deleteToken}, #{item.dataVersion}, #{item.createTime}, #{item.updateTime}) + + + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/SystemAsyncTaskInfoMapper.xml b/src/main/resources/mybatis/mapper/SystemAsyncTaskInfoMapper.xml new file mode 100644 index 0000000..0364b29 --- /dev/null +++ b/src/main/resources/mybatis/mapper/SystemAsyncTaskInfoMapper.xml @@ -0,0 +1,679 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + guid, biz_type, biz_id, trans_id, task_type, call_timing, start_time, end_time, use_time, + total_count, success_count, failure_count, ignore_count, retry_count, opt_status, + is_hidden, is_delete, delete_token, data_version, create_time, update_time + + + + task_params + + + + + + + delete from t_system_async_task_info + where guid = #{guid,jdbcType=BIGINT} + + + + delete from t_system_async_task_info + + + + + + + insert into t_system_async_task_info (guid, biz_type, biz_id, + trans_id, task_type, call_timing, + start_time, end_time, use_time, + total_count, success_count, failure_count, + ignore_count, retry_count, opt_status, + is_hidden, is_delete, delete_token, + data_version, create_time, update_time, + task_params) + values (#{guid,jdbcType=BIGINT}, #{bizType,jdbcType=VARCHAR}, #{bizId,jdbcType=VARCHAR}, + #{transId,jdbcType=VARCHAR}, #{taskType,jdbcType=VARCHAR}, #{callTiming,jdbcType=BIGINT}, + #{startTime,jdbcType=BIGINT}, #{endTime,jdbcType=BIGINT}, #{useTime,jdbcType=BIGINT}, + #{totalCount,jdbcType=INTEGER}, #{successCount,jdbcType=INTEGER}, #{failureCount,jdbcType=INTEGER}, + #{ignoreCount,jdbcType=INTEGER}, #{retryCount,jdbcType=INTEGER}, #{optStatus,jdbcType=INTEGER}, + #{isHidden,jdbcType=INTEGER}, #{isDelete,jdbcType=INTEGER}, #{deleteToken,jdbcType=VARCHAR}, + #{dataVersion,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, + #{taskParams,jdbcType=LONGVARCHAR}) + + + + insert into t_system_async_task_info + + + guid, + + + biz_type, + + + biz_id, + + + trans_id, + + + task_type, + + + call_timing, + + + start_time, + + + end_time, + + + use_time, + + + total_count, + + + success_count, + + + failure_count, + + + ignore_count, + + + retry_count, + + + opt_status, + + + is_hidden, + + + is_delete, + + + delete_token, + + + data_version, + + + create_time, + + + update_time, + + + task_params, + + + + + #{guid,jdbcType=BIGINT}, + + + #{bizType,jdbcType=VARCHAR}, + + + #{bizId,jdbcType=VARCHAR}, + + + #{transId,jdbcType=VARCHAR}, + + + #{taskType,jdbcType=VARCHAR}, + + + #{callTiming,jdbcType=BIGINT}, + + + #{startTime,jdbcType=BIGINT}, + + + #{endTime,jdbcType=BIGINT}, + + + #{useTime,jdbcType=BIGINT}, + + + #{totalCount,jdbcType=INTEGER}, + + + #{successCount,jdbcType=INTEGER}, + + + #{failureCount,jdbcType=INTEGER}, + + + #{ignoreCount,jdbcType=INTEGER}, + + + #{retryCount,jdbcType=INTEGER}, + + + #{optStatus,jdbcType=INTEGER}, + + + #{isHidden,jdbcType=INTEGER}, + + + #{isDelete,jdbcType=INTEGER}, + + + #{deleteToken,jdbcType=VARCHAR}, + + + #{dataVersion,jdbcType=INTEGER}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{updateTime,jdbcType=TIMESTAMP}, + + + #{taskParams,jdbcType=LONGVARCHAR}, + + + + + + + update t_system_async_task_info + + + guid = #{record.guid,jdbcType=BIGINT}, + + + biz_type = #{record.bizType,jdbcType=VARCHAR}, + + + biz_id = #{record.bizId,jdbcType=VARCHAR}, + + + trans_id = #{record.transId,jdbcType=VARCHAR}, + + + task_type = #{record.taskType,jdbcType=VARCHAR}, + + + call_timing = #{record.callTiming,jdbcType=BIGINT}, + + + start_time = #{record.startTime,jdbcType=BIGINT}, + + + end_time = #{record.endTime,jdbcType=BIGINT}, + + + use_time = #{record.useTime,jdbcType=BIGINT}, + + + total_count = #{record.totalCount,jdbcType=INTEGER}, + + + success_count = #{record.successCount,jdbcType=INTEGER}, + + + failure_count = #{record.failureCount,jdbcType=INTEGER}, + + + ignore_count = #{record.ignoreCount,jdbcType=INTEGER}, + + + retry_count = #{record.retryCount,jdbcType=INTEGER}, + + + opt_status = #{record.optStatus,jdbcType=INTEGER}, + + + is_hidden = #{record.isHidden,jdbcType=INTEGER}, + + + is_delete = #{record.isDelete,jdbcType=INTEGER}, + + + delete_token = #{record.deleteToken,jdbcType=VARCHAR}, + + + data_version = #{record.dataVersion,jdbcType=INTEGER}, + + + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + + + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + + + task_params = #{record.taskParams,jdbcType=LONGVARCHAR}, + + + + + + + + + update t_system_async_task_info + set guid = #{record.guid,jdbcType=BIGINT}, + biz_type = #{record.bizType,jdbcType=VARCHAR}, + biz_id = #{record.bizId,jdbcType=VARCHAR}, + trans_id = #{record.transId,jdbcType=VARCHAR}, + task_type = #{record.taskType,jdbcType=VARCHAR}, + call_timing = #{record.callTiming,jdbcType=BIGINT}, + start_time = #{record.startTime,jdbcType=BIGINT}, + end_time = #{record.endTime,jdbcType=BIGINT}, + use_time = #{record.useTime,jdbcType=BIGINT}, + total_count = #{record.totalCount,jdbcType=INTEGER}, + success_count = #{record.successCount,jdbcType=INTEGER}, + failure_count = #{record.failureCount,jdbcType=INTEGER}, + ignore_count = #{record.ignoreCount,jdbcType=INTEGER}, + retry_count = #{record.retryCount,jdbcType=INTEGER}, + opt_status = #{record.optStatus,jdbcType=INTEGER}, + is_hidden = #{record.isHidden,jdbcType=INTEGER}, + is_delete = #{record.isDelete,jdbcType=INTEGER}, + delete_token = #{record.deleteToken,jdbcType=VARCHAR}, + data_version = #{record.dataVersion,jdbcType=INTEGER}, + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + task_params = #{record.taskParams,jdbcType=LONGVARCHAR} + + + + + + + update t_system_async_task_info + set guid = #{record.guid,jdbcType=BIGINT}, + biz_type = #{record.bizType,jdbcType=VARCHAR}, + biz_id = #{record.bizId,jdbcType=VARCHAR}, + trans_id = #{record.transId,jdbcType=VARCHAR}, + task_type = #{record.taskType,jdbcType=VARCHAR}, + call_timing = #{record.callTiming,jdbcType=BIGINT}, + start_time = #{record.startTime,jdbcType=BIGINT}, + end_time = #{record.endTime,jdbcType=BIGINT}, + use_time = #{record.useTime,jdbcType=BIGINT}, + total_count = #{record.totalCount,jdbcType=INTEGER}, + success_count = #{record.successCount,jdbcType=INTEGER}, + failure_count = #{record.failureCount,jdbcType=INTEGER}, + ignore_count = #{record.ignoreCount,jdbcType=INTEGER}, + retry_count = #{record.retryCount,jdbcType=INTEGER}, + opt_status = #{record.optStatus,jdbcType=INTEGER}, + is_hidden = #{record.isHidden,jdbcType=INTEGER}, + is_delete = #{record.isDelete,jdbcType=INTEGER}, + delete_token = #{record.deleteToken,jdbcType=VARCHAR}, + data_version = #{record.dataVersion,jdbcType=INTEGER}, + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + update_time = #{record.updateTime,jdbcType=TIMESTAMP} + + + + + + + update t_system_async_task_info + + + biz_type = #{bizType,jdbcType=VARCHAR}, + + + biz_id = #{bizId,jdbcType=VARCHAR}, + + + trans_id = #{transId,jdbcType=VARCHAR}, + + + task_type = #{taskType,jdbcType=VARCHAR}, + + + call_timing = #{callTiming,jdbcType=BIGINT}, + + + start_time = #{startTime,jdbcType=BIGINT}, + + + end_time = #{endTime,jdbcType=BIGINT}, + + + use_time = #{useTime,jdbcType=BIGINT}, + + + total_count = #{totalCount,jdbcType=INTEGER}, + + + success_count = #{successCount,jdbcType=INTEGER}, + + + failure_count = #{failureCount,jdbcType=INTEGER}, + + + ignore_count = #{ignoreCount,jdbcType=INTEGER}, + + + retry_count = #{retryCount,jdbcType=INTEGER}, + + + opt_status = #{optStatus,jdbcType=INTEGER}, + + + is_hidden = #{isHidden,jdbcType=INTEGER}, + + + is_delete = #{isDelete,jdbcType=INTEGER}, + + + delete_token = #{deleteToken,jdbcType=VARCHAR}, + + + data_version = #{dataVersion,jdbcType=INTEGER}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + + + task_params = #{taskParams,jdbcType=LONGVARCHAR}, + + + where guid = #{guid,jdbcType=BIGINT} + + + + update t_system_async_task_info + set biz_type = #{bizType,jdbcType=VARCHAR}, + biz_id = #{bizId,jdbcType=VARCHAR}, + trans_id = #{transId,jdbcType=VARCHAR}, + task_type = #{taskType,jdbcType=VARCHAR}, + call_timing = #{callTiming,jdbcType=BIGINT}, + start_time = #{startTime,jdbcType=BIGINT}, + end_time = #{endTime,jdbcType=BIGINT}, + use_time = #{useTime,jdbcType=BIGINT}, + total_count = #{totalCount,jdbcType=INTEGER}, + success_count = #{successCount,jdbcType=INTEGER}, + failure_count = #{failureCount,jdbcType=INTEGER}, + ignore_count = #{ignoreCount,jdbcType=INTEGER}, + retry_count = #{retryCount,jdbcType=INTEGER}, + opt_status = #{optStatus,jdbcType=INTEGER}, + is_hidden = #{isHidden,jdbcType=INTEGER}, + is_delete = #{isDelete,jdbcType=INTEGER}, + delete_token = #{deleteToken,jdbcType=VARCHAR}, + data_version = #{dataVersion,jdbcType=INTEGER}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + update_time = #{updateTime,jdbcType=TIMESTAMP}, + task_params = #{taskParams,jdbcType=LONGVARCHAR} + where guid = #{guid,jdbcType=BIGINT} + + + + update t_system_async_task_info + set biz_type = #{bizType,jdbcType=VARCHAR}, + biz_id = #{bizId,jdbcType=VARCHAR}, + trans_id = #{transId,jdbcType=VARCHAR}, + task_type = #{taskType,jdbcType=VARCHAR}, + call_timing = #{callTiming,jdbcType=BIGINT}, + start_time = #{startTime,jdbcType=BIGINT}, + end_time = #{endTime,jdbcType=BIGINT}, + use_time = #{useTime,jdbcType=BIGINT}, + total_count = #{totalCount,jdbcType=INTEGER}, + success_count = #{successCount,jdbcType=INTEGER}, + failure_count = #{failureCount,jdbcType=INTEGER}, + ignore_count = #{ignoreCount,jdbcType=INTEGER}, + retry_count = #{retryCount,jdbcType=INTEGER}, + opt_status = #{optStatus,jdbcType=INTEGER}, + is_hidden = #{isHidden,jdbcType=INTEGER}, + is_delete = #{isDelete,jdbcType=INTEGER}, + delete_token = #{deleteToken,jdbcType=VARCHAR}, + data_version = #{dataVersion,jdbcType=INTEGER}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + update_time = #{updateTime,jdbcType=TIMESTAMP} + where guid = #{guid,jdbcType=BIGINT} + + + insert into t_system_async_task_info (guid, biz_type, biz_id, trans_id, task_type, call_timing, start_time, end_time, use_time, total_count, success_count, failure_count, ignore_count, retry_count, opt_status, is_hidden, is_delete, delete_token, data_version, create_time, update_time, task_params) values + + (#{item.guid}, #{item.bizType}, #{item.bizId}, #{item.transId}, #{item.taskType}, #{item.callTiming}, #{item.startTime}, #{item.endTime}, #{item.useTime}, #{item.totalCount}, #{item.successCount}, #{item.failureCount}, #{item.ignoreCount}, #{item.retryCount}, #{item.optStatus}, #{item.isHidden}, #{item.isDelete}, #{item.deleteToken}, #{item.dataVersion}, #{item.createTime}, #{item.updateTime}, #{item.taskParams}) + + + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/SystemCrawlerCacheDataMapper.xml b/src/main/resources/mybatis/mapper/SystemCrawlerCacheDataMapper.xml new file mode 100644 index 0000000..43c08c8 --- /dev/null +++ b/src/main/resources/mybatis/mapper/SystemCrawlerCacheDataMapper.xml @@ -0,0 +1,483 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + guid, crawler_time, crawler_type, crawler_keyword, is_hidden, is_delete, delete_token, + data_version, create_time, update_time + + + + cache_data + + + + + + + delete from t_system_crawler_cache_data + where guid = #{guid,jdbcType=BIGINT} + + + + delete from t_system_crawler_cache_data + + + + + + + insert into t_system_crawler_cache_data (guid, crawler_time, crawler_type, + crawler_keyword, is_hidden, is_delete, + delete_token, data_version, create_time, + update_time, cache_data) + values (#{guid,jdbcType=BIGINT}, #{crawlerTime,jdbcType=BIGINT}, #{crawlerType,jdbcType=VARCHAR}, + #{crawlerKeyword,jdbcType=VARCHAR}, #{isHidden,jdbcType=INTEGER}, #{isDelete,jdbcType=INTEGER}, + #{deleteToken,jdbcType=VARCHAR}, #{dataVersion,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, + #{updateTime,jdbcType=TIMESTAMP}, #{cacheData,jdbcType=LONGVARCHAR}) + + + + insert into t_system_crawler_cache_data + + + guid, + + + crawler_time, + + + crawler_type, + + + crawler_keyword, + + + is_hidden, + + + is_delete, + + + delete_token, + + + data_version, + + + create_time, + + + update_time, + + + cache_data, + + + + + #{guid,jdbcType=BIGINT}, + + + #{crawlerTime,jdbcType=BIGINT}, + + + #{crawlerType,jdbcType=VARCHAR}, + + + #{crawlerKeyword,jdbcType=VARCHAR}, + + + #{isHidden,jdbcType=INTEGER}, + + + #{isDelete,jdbcType=INTEGER}, + + + #{deleteToken,jdbcType=VARCHAR}, + + + #{dataVersion,jdbcType=INTEGER}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{updateTime,jdbcType=TIMESTAMP}, + + + #{cacheData,jdbcType=LONGVARCHAR}, + + + + + + + update t_system_crawler_cache_data + + + guid = #{record.guid,jdbcType=BIGINT}, + + + crawler_time = #{record.crawlerTime,jdbcType=BIGINT}, + + + crawler_type = #{record.crawlerType,jdbcType=VARCHAR}, + + + crawler_keyword = #{record.crawlerKeyword,jdbcType=VARCHAR}, + + + is_hidden = #{record.isHidden,jdbcType=INTEGER}, + + + is_delete = #{record.isDelete,jdbcType=INTEGER}, + + + delete_token = #{record.deleteToken,jdbcType=VARCHAR}, + + + data_version = #{record.dataVersion,jdbcType=INTEGER}, + + + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + + + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + + + cache_data = #{record.cacheData,jdbcType=LONGVARCHAR}, + + + + + + + + + update t_system_crawler_cache_data + set guid = #{record.guid,jdbcType=BIGINT}, + crawler_time = #{record.crawlerTime,jdbcType=BIGINT}, + crawler_type = #{record.crawlerType,jdbcType=VARCHAR}, + crawler_keyword = #{record.crawlerKeyword,jdbcType=VARCHAR}, + is_hidden = #{record.isHidden,jdbcType=INTEGER}, + is_delete = #{record.isDelete,jdbcType=INTEGER}, + delete_token = #{record.deleteToken,jdbcType=VARCHAR}, + data_version = #{record.dataVersion,jdbcType=INTEGER}, + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + cache_data = #{record.cacheData,jdbcType=LONGVARCHAR} + + + + + + + update t_system_crawler_cache_data + set guid = #{record.guid,jdbcType=BIGINT}, + crawler_time = #{record.crawlerTime,jdbcType=BIGINT}, + crawler_type = #{record.crawlerType,jdbcType=VARCHAR}, + crawler_keyword = #{record.crawlerKeyword,jdbcType=VARCHAR}, + is_hidden = #{record.isHidden,jdbcType=INTEGER}, + is_delete = #{record.isDelete,jdbcType=INTEGER}, + delete_token = #{record.deleteToken,jdbcType=VARCHAR}, + data_version = #{record.dataVersion,jdbcType=INTEGER}, + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + update_time = #{record.updateTime,jdbcType=TIMESTAMP} + + + + + + + update t_system_crawler_cache_data + + + crawler_time = #{crawlerTime,jdbcType=BIGINT}, + + + crawler_type = #{crawlerType,jdbcType=VARCHAR}, + + + crawler_keyword = #{crawlerKeyword,jdbcType=VARCHAR}, + + + is_hidden = #{isHidden,jdbcType=INTEGER}, + + + is_delete = #{isDelete,jdbcType=INTEGER}, + + + delete_token = #{deleteToken,jdbcType=VARCHAR}, + + + data_version = #{dataVersion,jdbcType=INTEGER}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + + + cache_data = #{cacheData,jdbcType=LONGVARCHAR}, + + + where guid = #{guid,jdbcType=BIGINT} + + + + update t_system_crawler_cache_data + set crawler_time = #{crawlerTime,jdbcType=BIGINT}, + crawler_type = #{crawlerType,jdbcType=VARCHAR}, + crawler_keyword = #{crawlerKeyword,jdbcType=VARCHAR}, + is_hidden = #{isHidden,jdbcType=INTEGER}, + is_delete = #{isDelete,jdbcType=INTEGER}, + delete_token = #{deleteToken,jdbcType=VARCHAR}, + data_version = #{dataVersion,jdbcType=INTEGER}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + update_time = #{updateTime,jdbcType=TIMESTAMP}, + cache_data = #{cacheData,jdbcType=LONGVARCHAR} + where guid = #{guid,jdbcType=BIGINT} + + + + update t_system_crawler_cache_data + set crawler_time = #{crawlerTime,jdbcType=BIGINT}, + crawler_type = #{crawlerType,jdbcType=VARCHAR}, + crawler_keyword = #{crawlerKeyword,jdbcType=VARCHAR}, + is_hidden = #{isHidden,jdbcType=INTEGER}, + is_delete = #{isDelete,jdbcType=INTEGER}, + delete_token = #{deleteToken,jdbcType=VARCHAR}, + data_version = #{dataVersion,jdbcType=INTEGER}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + update_time = #{updateTime,jdbcType=TIMESTAMP} + where guid = #{guid,jdbcType=BIGINT} + + + insert into t_system_crawler_cache_data (guid, crawler_time, crawler_type, crawler_keyword, is_hidden, is_delete, delete_token, data_version, create_time, update_time, cache_data) values + + (#{item.guid}, #{item.crawlerTime}, #{item.crawlerType}, #{item.crawlerKeyword}, #{item.isHidden}, #{item.isDelete}, #{item.deleteToken}, #{item.dataVersion}, #{item.createTime}, #{item.updateTime}, #{item.cacheData}) + + + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/SystemGlobalCacheMapper.xml b/src/main/resources/mybatis/mapper/SystemGlobalCacheMapper.xml new file mode 100644 index 0000000..78f3bae --- /dev/null +++ b/src/main/resources/mybatis/mapper/SystemGlobalCacheMapper.xml @@ -0,0 +1,483 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + guid, cache_time, expire_time, cache_key, is_hidden, is_delete, delete_token, data_version, + create_time, update_time + + + + cache_data + + + + + + + delete from t_system_global_cache + where guid = #{guid,jdbcType=BIGINT} + + + + delete from t_system_global_cache + + + + + + + insert into t_system_global_cache (guid, cache_time, expire_time, + cache_key, is_hidden, is_delete, + delete_token, data_version, create_time, + update_time, cache_data) + values (#{guid,jdbcType=BIGINT}, #{cacheTime,jdbcType=BIGINT}, #{expireTime,jdbcType=BIGINT}, + #{cacheKey,jdbcType=VARCHAR}, #{isHidden,jdbcType=INTEGER}, #{isDelete,jdbcType=INTEGER}, + #{deleteToken,jdbcType=VARCHAR}, #{dataVersion,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, + #{updateTime,jdbcType=TIMESTAMP}, #{cacheData,jdbcType=LONGVARCHAR}) + + + + insert into t_system_global_cache + + + guid, + + + cache_time, + + + expire_time, + + + cache_key, + + + is_hidden, + + + is_delete, + + + delete_token, + + + data_version, + + + create_time, + + + update_time, + + + cache_data, + + + + + #{guid,jdbcType=BIGINT}, + + + #{cacheTime,jdbcType=BIGINT}, + + + #{expireTime,jdbcType=BIGINT}, + + + #{cacheKey,jdbcType=VARCHAR}, + + + #{isHidden,jdbcType=INTEGER}, + + + #{isDelete,jdbcType=INTEGER}, + + + #{deleteToken,jdbcType=VARCHAR}, + + + #{dataVersion,jdbcType=INTEGER}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{updateTime,jdbcType=TIMESTAMP}, + + + #{cacheData,jdbcType=LONGVARCHAR}, + + + + + + + update t_system_global_cache + + + guid = #{record.guid,jdbcType=BIGINT}, + + + cache_time = #{record.cacheTime,jdbcType=BIGINT}, + + + expire_time = #{record.expireTime,jdbcType=BIGINT}, + + + cache_key = #{record.cacheKey,jdbcType=VARCHAR}, + + + is_hidden = #{record.isHidden,jdbcType=INTEGER}, + + + is_delete = #{record.isDelete,jdbcType=INTEGER}, + + + delete_token = #{record.deleteToken,jdbcType=VARCHAR}, + + + data_version = #{record.dataVersion,jdbcType=INTEGER}, + + + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + + + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + + + cache_data = #{record.cacheData,jdbcType=LONGVARCHAR}, + + + + + + + + + update t_system_global_cache + set guid = #{record.guid,jdbcType=BIGINT}, + cache_time = #{record.cacheTime,jdbcType=BIGINT}, + expire_time = #{record.expireTime,jdbcType=BIGINT}, + cache_key = #{record.cacheKey,jdbcType=VARCHAR}, + is_hidden = #{record.isHidden,jdbcType=INTEGER}, + is_delete = #{record.isDelete,jdbcType=INTEGER}, + delete_token = #{record.deleteToken,jdbcType=VARCHAR}, + data_version = #{record.dataVersion,jdbcType=INTEGER}, + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + cache_data = #{record.cacheData,jdbcType=LONGVARCHAR} + + + + + + + update t_system_global_cache + set guid = #{record.guid,jdbcType=BIGINT}, + cache_time = #{record.cacheTime,jdbcType=BIGINT}, + expire_time = #{record.expireTime,jdbcType=BIGINT}, + cache_key = #{record.cacheKey,jdbcType=VARCHAR}, + is_hidden = #{record.isHidden,jdbcType=INTEGER}, + is_delete = #{record.isDelete,jdbcType=INTEGER}, + delete_token = #{record.deleteToken,jdbcType=VARCHAR}, + data_version = #{record.dataVersion,jdbcType=INTEGER}, + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + update_time = #{record.updateTime,jdbcType=TIMESTAMP} + + + + + + + update t_system_global_cache + + + cache_time = #{cacheTime,jdbcType=BIGINT}, + + + expire_time = #{expireTime,jdbcType=BIGINT}, + + + cache_key = #{cacheKey,jdbcType=VARCHAR}, + + + is_hidden = #{isHidden,jdbcType=INTEGER}, + + + is_delete = #{isDelete,jdbcType=INTEGER}, + + + delete_token = #{deleteToken,jdbcType=VARCHAR}, + + + data_version = #{dataVersion,jdbcType=INTEGER}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + + + cache_data = #{cacheData,jdbcType=LONGVARCHAR}, + + + where guid = #{guid,jdbcType=BIGINT} + + + + update t_system_global_cache + set cache_time = #{cacheTime,jdbcType=BIGINT}, + expire_time = #{expireTime,jdbcType=BIGINT}, + cache_key = #{cacheKey,jdbcType=VARCHAR}, + is_hidden = #{isHidden,jdbcType=INTEGER}, + is_delete = #{isDelete,jdbcType=INTEGER}, + delete_token = #{deleteToken,jdbcType=VARCHAR}, + data_version = #{dataVersion,jdbcType=INTEGER}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + update_time = #{updateTime,jdbcType=TIMESTAMP}, + cache_data = #{cacheData,jdbcType=LONGVARCHAR} + where guid = #{guid,jdbcType=BIGINT} + + + + update t_system_global_cache + set cache_time = #{cacheTime,jdbcType=BIGINT}, + expire_time = #{expireTime,jdbcType=BIGINT}, + cache_key = #{cacheKey,jdbcType=VARCHAR}, + is_hidden = #{isHidden,jdbcType=INTEGER}, + is_delete = #{isDelete,jdbcType=INTEGER}, + delete_token = #{deleteToken,jdbcType=VARCHAR}, + data_version = #{dataVersion,jdbcType=INTEGER}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + update_time = #{updateTime,jdbcType=TIMESTAMP} + where guid = #{guid,jdbcType=BIGINT} + + + insert into t_system_global_cache (guid, cache_time, expire_time, cache_key, is_hidden, is_delete, delete_token, data_version, create_time, update_time, cache_data) values + + (#{item.guid}, #{item.cacheTime}, #{item.expireTime}, #{item.cacheKey}, #{item.isHidden}, #{item.isDelete}, #{item.deleteToken}, #{item.dataVersion}, #{item.createTime}, #{item.updateTime}, #{item.cacheData}) + + + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/SystemGlobalFileTransferMapper.xml b/src/main/resources/mybatis/mapper/SystemGlobalFileTransferMapper.xml new file mode 100644 index 0000000..65f219e --- /dev/null +++ b/src/main/resources/mybatis/mapper/SystemGlobalFileTransferMapper.xml @@ -0,0 +1,402 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + guid, original_url, saved_url, file_size, file_hash, is_hidden, is_delete, delete_token, + data_version, create_time, update_time + + + + + + delete from t_system_global_file_transfer + where guid = #{guid,jdbcType=BIGINT} + + + + delete from t_system_global_file_transfer + + + + + + + insert into t_system_global_file_transfer (guid, original_url, saved_url, + file_size, file_hash, is_hidden, + is_delete, delete_token, data_version, + create_time, update_time) + values (#{guid,jdbcType=BIGINT}, #{originalUrl,jdbcType=VARCHAR}, #{savedUrl,jdbcType=VARCHAR}, + #{fileSize,jdbcType=BIGINT}, #{fileHash,jdbcType=VARCHAR}, #{isHidden,jdbcType=INTEGER}, + #{isDelete,jdbcType=INTEGER}, #{deleteToken,jdbcType=VARCHAR}, #{dataVersion,jdbcType=INTEGER}, + #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}) + + + + insert into t_system_global_file_transfer + + + guid, + + + original_url, + + + saved_url, + + + file_size, + + + file_hash, + + + is_hidden, + + + is_delete, + + + delete_token, + + + data_version, + + + create_time, + + + update_time, + + + + + #{guid,jdbcType=BIGINT}, + + + #{originalUrl,jdbcType=VARCHAR}, + + + #{savedUrl,jdbcType=VARCHAR}, + + + #{fileSize,jdbcType=BIGINT}, + + + #{fileHash,jdbcType=VARCHAR}, + + + #{isHidden,jdbcType=INTEGER}, + + + #{isDelete,jdbcType=INTEGER}, + + + #{deleteToken,jdbcType=VARCHAR}, + + + #{dataVersion,jdbcType=INTEGER}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{updateTime,jdbcType=TIMESTAMP}, + + + + + + + update t_system_global_file_transfer + + + guid = #{record.guid,jdbcType=BIGINT}, + + + original_url = #{record.originalUrl,jdbcType=VARCHAR}, + + + saved_url = #{record.savedUrl,jdbcType=VARCHAR}, + + + file_size = #{record.fileSize,jdbcType=BIGINT}, + + + file_hash = #{record.fileHash,jdbcType=VARCHAR}, + + + is_hidden = #{record.isHidden,jdbcType=INTEGER}, + + + is_delete = #{record.isDelete,jdbcType=INTEGER}, + + + delete_token = #{record.deleteToken,jdbcType=VARCHAR}, + + + data_version = #{record.dataVersion,jdbcType=INTEGER}, + + + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + + + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + + + + + + + + + update t_system_global_file_transfer + set guid = #{record.guid,jdbcType=BIGINT}, + original_url = #{record.originalUrl,jdbcType=VARCHAR}, + saved_url = #{record.savedUrl,jdbcType=VARCHAR}, + file_size = #{record.fileSize,jdbcType=BIGINT}, + file_hash = #{record.fileHash,jdbcType=VARCHAR}, + is_hidden = #{record.isHidden,jdbcType=INTEGER}, + is_delete = #{record.isDelete,jdbcType=INTEGER}, + delete_token = #{record.deleteToken,jdbcType=VARCHAR}, + data_version = #{record.dataVersion,jdbcType=INTEGER}, + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + update_time = #{record.updateTime,jdbcType=TIMESTAMP} + + + + + + + update t_system_global_file_transfer + + + original_url = #{originalUrl,jdbcType=VARCHAR}, + + + saved_url = #{savedUrl,jdbcType=VARCHAR}, + + + file_size = #{fileSize,jdbcType=BIGINT}, + + + file_hash = #{fileHash,jdbcType=VARCHAR}, + + + is_hidden = #{isHidden,jdbcType=INTEGER}, + + + is_delete = #{isDelete,jdbcType=INTEGER}, + + + delete_token = #{deleteToken,jdbcType=VARCHAR}, + + + data_version = #{dataVersion,jdbcType=INTEGER}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + + + where guid = #{guid,jdbcType=BIGINT} + + + + update t_system_global_file_transfer + set original_url = #{originalUrl,jdbcType=VARCHAR}, + saved_url = #{savedUrl,jdbcType=VARCHAR}, + file_size = #{fileSize,jdbcType=BIGINT}, + file_hash = #{fileHash,jdbcType=VARCHAR}, + is_hidden = #{isHidden,jdbcType=INTEGER}, + is_delete = #{isDelete,jdbcType=INTEGER}, + delete_token = #{deleteToken,jdbcType=VARCHAR}, + data_version = #{dataVersion,jdbcType=INTEGER}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + update_time = #{updateTime,jdbcType=TIMESTAMP} + where guid = #{guid,jdbcType=BIGINT} + + + insert into t_system_global_file_transfer (guid, original_url, saved_url, file_size, file_hash, is_hidden, is_delete, delete_token, data_version, create_time, update_time) values + + (#{item.guid}, #{item.originalUrl}, #{item.savedUrl}, #{item.fileSize}, #{item.fileHash}, #{item.isHidden}, #{item.isDelete}, #{item.deleteToken}, #{item.dataVersion}, #{item.createTime}, #{item.updateTime}) + + + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/SystemGlobalSessionMapper.xml b/src/main/resources/mybatis/mapper/SystemGlobalSessionMapper.xml new file mode 100644 index 0000000..0634729 --- /dev/null +++ b/src/main/resources/mybatis/mapper/SystemGlobalSessionMapper.xml @@ -0,0 +1,434 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + guid, user_guid, user_group, session_key, origin_platform, origin_domain, origin_ip, + is_hidden, is_delete, delete_token, data_version, create_time, update_time + + + + + + delete from t_system_global_session + where guid = #{guid,jdbcType=BIGINT} + + + + delete from t_system_global_session + + + + + + + insert into t_system_global_session (guid, user_guid, user_group, + session_key, origin_platform, origin_domain, + origin_ip, is_hidden, is_delete, + delete_token, data_version, create_time, + update_time) + values (#{guid,jdbcType=BIGINT}, #{userGuid,jdbcType=BIGINT}, #{userGroup,jdbcType=VARCHAR}, + #{sessionKey,jdbcType=VARCHAR}, #{originPlatform,jdbcType=VARCHAR}, #{originDomain,jdbcType=VARCHAR}, + #{originIp,jdbcType=VARCHAR}, #{isHidden,jdbcType=INTEGER}, #{isDelete,jdbcType=INTEGER}, + #{deleteToken,jdbcType=VARCHAR}, #{dataVersion,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, + #{updateTime,jdbcType=TIMESTAMP}) + + + + insert into t_system_global_session + + + guid, + + + user_guid, + + + user_group, + + + session_key, + + + origin_platform, + + + origin_domain, + + + origin_ip, + + + is_hidden, + + + is_delete, + + + delete_token, + + + data_version, + + + create_time, + + + update_time, + + + + + #{guid,jdbcType=BIGINT}, + + + #{userGuid,jdbcType=BIGINT}, + + + #{userGroup,jdbcType=VARCHAR}, + + + #{sessionKey,jdbcType=VARCHAR}, + + + #{originPlatform,jdbcType=VARCHAR}, + + + #{originDomain,jdbcType=VARCHAR}, + + + #{originIp,jdbcType=VARCHAR}, + + + #{isHidden,jdbcType=INTEGER}, + + + #{isDelete,jdbcType=INTEGER}, + + + #{deleteToken,jdbcType=VARCHAR}, + + + #{dataVersion,jdbcType=INTEGER}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{updateTime,jdbcType=TIMESTAMP}, + + + + + + + update t_system_global_session + + + guid = #{record.guid,jdbcType=BIGINT}, + + + user_guid = #{record.userGuid,jdbcType=BIGINT}, + + + user_group = #{record.userGroup,jdbcType=VARCHAR}, + + + session_key = #{record.sessionKey,jdbcType=VARCHAR}, + + + origin_platform = #{record.originPlatform,jdbcType=VARCHAR}, + + + origin_domain = #{record.originDomain,jdbcType=VARCHAR}, + + + origin_ip = #{record.originIp,jdbcType=VARCHAR}, + + + is_hidden = #{record.isHidden,jdbcType=INTEGER}, + + + is_delete = #{record.isDelete,jdbcType=INTEGER}, + + + delete_token = #{record.deleteToken,jdbcType=VARCHAR}, + + + data_version = #{record.dataVersion,jdbcType=INTEGER}, + + + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + + + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + + + + + + + + + update t_system_global_session + set guid = #{record.guid,jdbcType=BIGINT}, + user_guid = #{record.userGuid,jdbcType=BIGINT}, + user_group = #{record.userGroup,jdbcType=VARCHAR}, + session_key = #{record.sessionKey,jdbcType=VARCHAR}, + origin_platform = #{record.originPlatform,jdbcType=VARCHAR}, + origin_domain = #{record.originDomain,jdbcType=VARCHAR}, + origin_ip = #{record.originIp,jdbcType=VARCHAR}, + is_hidden = #{record.isHidden,jdbcType=INTEGER}, + is_delete = #{record.isDelete,jdbcType=INTEGER}, + delete_token = #{record.deleteToken,jdbcType=VARCHAR}, + data_version = #{record.dataVersion,jdbcType=INTEGER}, + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + update_time = #{record.updateTime,jdbcType=TIMESTAMP} + + + + + + + update t_system_global_session + + + user_guid = #{userGuid,jdbcType=BIGINT}, + + + user_group = #{userGroup,jdbcType=VARCHAR}, + + + session_key = #{sessionKey,jdbcType=VARCHAR}, + + + origin_platform = #{originPlatform,jdbcType=VARCHAR}, + + + origin_domain = #{originDomain,jdbcType=VARCHAR}, + + + origin_ip = #{originIp,jdbcType=VARCHAR}, + + + is_hidden = #{isHidden,jdbcType=INTEGER}, + + + is_delete = #{isDelete,jdbcType=INTEGER}, + + + delete_token = #{deleteToken,jdbcType=VARCHAR}, + + + data_version = #{dataVersion,jdbcType=INTEGER}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + + + where guid = #{guid,jdbcType=BIGINT} + + + + update t_system_global_session + set user_guid = #{userGuid,jdbcType=BIGINT}, + user_group = #{userGroup,jdbcType=VARCHAR}, + session_key = #{sessionKey,jdbcType=VARCHAR}, + origin_platform = #{originPlatform,jdbcType=VARCHAR}, + origin_domain = #{originDomain,jdbcType=VARCHAR}, + origin_ip = #{originIp,jdbcType=VARCHAR}, + is_hidden = #{isHidden,jdbcType=INTEGER}, + is_delete = #{isDelete,jdbcType=INTEGER}, + delete_token = #{deleteToken,jdbcType=VARCHAR}, + data_version = #{dataVersion,jdbcType=INTEGER}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + update_time = #{updateTime,jdbcType=TIMESTAMP} + where guid = #{guid,jdbcType=BIGINT} + + + insert into t_system_global_session (guid, user_guid, user_group, session_key, origin_platform, origin_domain, origin_ip, is_hidden, is_delete, delete_token, data_version, create_time, update_time) values + + (#{item.guid}, #{item.userGuid}, #{item.userGroup}, #{item.sessionKey}, #{item.originPlatform}, #{item.originDomain}, #{item.originIp}, #{item.isHidden}, #{item.isDelete}, #{item.deleteToken}, #{item.dataVersion}, #{item.createTime}, #{item.updateTime}) + + + + \ No newline at end of file diff --git a/src/main/resources/mybatis/mapper/SystemGlobalSettingMapper.xml b/src/main/resources/mybatis/mapper/SystemGlobalSettingMapper.xml new file mode 100644 index 0000000..de8454e --- /dev/null +++ b/src/main/resources/mybatis/mapper/SystemGlobalSettingMapper.xml @@ -0,0 +1,466 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + guid, setting_key, opt_remark, is_hidden, is_delete, delete_token, data_version, + create_time, update_time + + + + setting_value + + + + + + + delete from t_system_global_setting + where guid = #{guid,jdbcType=BIGINT} + + + + delete from t_system_global_setting + + + + + + + insert into t_system_global_setting (guid, setting_key, opt_remark, + is_hidden, is_delete, delete_token, + data_version, create_time, update_time, + setting_value) + values (#{guid,jdbcType=BIGINT}, #{settingKey,jdbcType=VARCHAR}, #{optRemark,jdbcType=VARCHAR}, + #{isHidden,jdbcType=INTEGER}, #{isDelete,jdbcType=INTEGER}, #{deleteToken,jdbcType=VARCHAR}, + #{dataVersion,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}, + #{settingValue,jdbcType=LONGVARCHAR}) + + + + insert into t_system_global_setting + + + guid, + + + setting_key, + + + opt_remark, + + + is_hidden, + + + is_delete, + + + delete_token, + + + data_version, + + + create_time, + + + update_time, + + + setting_value, + + + + + #{guid,jdbcType=BIGINT}, + + + #{settingKey,jdbcType=VARCHAR}, + + + #{optRemark,jdbcType=VARCHAR}, + + + #{isHidden,jdbcType=INTEGER}, + + + #{isDelete,jdbcType=INTEGER}, + + + #{deleteToken,jdbcType=VARCHAR}, + + + #{dataVersion,jdbcType=INTEGER}, + + + #{createTime,jdbcType=TIMESTAMP}, + + + #{updateTime,jdbcType=TIMESTAMP}, + + + #{settingValue,jdbcType=LONGVARCHAR}, + + + + + + + update t_system_global_setting + + + guid = #{record.guid,jdbcType=BIGINT}, + + + setting_key = #{record.settingKey,jdbcType=VARCHAR}, + + + opt_remark = #{record.optRemark,jdbcType=VARCHAR}, + + + is_hidden = #{record.isHidden,jdbcType=INTEGER}, + + + is_delete = #{record.isDelete,jdbcType=INTEGER}, + + + delete_token = #{record.deleteToken,jdbcType=VARCHAR}, + + + data_version = #{record.dataVersion,jdbcType=INTEGER}, + + + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + + + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + + + setting_value = #{record.settingValue,jdbcType=LONGVARCHAR}, + + + + + + + + + update t_system_global_setting + set guid = #{record.guid,jdbcType=BIGINT}, + setting_key = #{record.settingKey,jdbcType=VARCHAR}, + opt_remark = #{record.optRemark,jdbcType=VARCHAR}, + is_hidden = #{record.isHidden,jdbcType=INTEGER}, + is_delete = #{record.isDelete,jdbcType=INTEGER}, + delete_token = #{record.deleteToken,jdbcType=VARCHAR}, + data_version = #{record.dataVersion,jdbcType=INTEGER}, + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + update_time = #{record.updateTime,jdbcType=TIMESTAMP}, + setting_value = #{record.settingValue,jdbcType=LONGVARCHAR} + + + + + + + update t_system_global_setting + set guid = #{record.guid,jdbcType=BIGINT}, + setting_key = #{record.settingKey,jdbcType=VARCHAR}, + opt_remark = #{record.optRemark,jdbcType=VARCHAR}, + is_hidden = #{record.isHidden,jdbcType=INTEGER}, + is_delete = #{record.isDelete,jdbcType=INTEGER}, + delete_token = #{record.deleteToken,jdbcType=VARCHAR}, + data_version = #{record.dataVersion,jdbcType=INTEGER}, + create_time = #{record.createTime,jdbcType=TIMESTAMP}, + update_time = #{record.updateTime,jdbcType=TIMESTAMP} + + + + + + + update t_system_global_setting + + + setting_key = #{settingKey,jdbcType=VARCHAR}, + + + opt_remark = #{optRemark,jdbcType=VARCHAR}, + + + is_hidden = #{isHidden,jdbcType=INTEGER}, + + + is_delete = #{isDelete,jdbcType=INTEGER}, + + + delete_token = #{deleteToken,jdbcType=VARCHAR}, + + + data_version = #{dataVersion,jdbcType=INTEGER}, + + + create_time = #{createTime,jdbcType=TIMESTAMP}, + + + update_time = #{updateTime,jdbcType=TIMESTAMP}, + + + setting_value = #{settingValue,jdbcType=LONGVARCHAR}, + + + where guid = #{guid,jdbcType=BIGINT} + + + + update t_system_global_setting + set setting_key = #{settingKey,jdbcType=VARCHAR}, + opt_remark = #{optRemark,jdbcType=VARCHAR}, + is_hidden = #{isHidden,jdbcType=INTEGER}, + is_delete = #{isDelete,jdbcType=INTEGER}, + delete_token = #{deleteToken,jdbcType=VARCHAR}, + data_version = #{dataVersion,jdbcType=INTEGER}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + update_time = #{updateTime,jdbcType=TIMESTAMP}, + setting_value = #{settingValue,jdbcType=LONGVARCHAR} + where guid = #{guid,jdbcType=BIGINT} + + + + update t_system_global_setting + set setting_key = #{settingKey,jdbcType=VARCHAR}, + opt_remark = #{optRemark,jdbcType=VARCHAR}, + is_hidden = #{isHidden,jdbcType=INTEGER}, + is_delete = #{isDelete,jdbcType=INTEGER}, + delete_token = #{deleteToken,jdbcType=VARCHAR}, + data_version = #{dataVersion,jdbcType=INTEGER}, + create_time = #{createTime,jdbcType=TIMESTAMP}, + update_time = #{updateTime,jdbcType=TIMESTAMP} + where guid = #{guid,jdbcType=BIGINT} + + + insert into t_system_global_setting (guid, setting_key, opt_remark, is_hidden, is_delete, delete_token, data_version, create_time, update_time, setting_value) values + + (#{item.guid}, #{item.settingKey}, #{item.optRemark}, #{item.isHidden}, #{item.isDelete}, #{item.deleteToken}, #{item.dataVersion}, #{item.createTime}, #{item.updateTime}, #{item.settingValue}) + + + + \ No newline at end of file diff --git a/src/main/resources/wsdl/CxfWebServiceImplApiService.wsdl b/src/main/resources/wsdl/CxfWebServiceImplApiService.wsdl new file mode 100644 index 0000000..6a677c1 --- /dev/null +++ b/src/main/resources/wsdl/CxfWebServiceImplApiService.wsdl @@ -0,0 +1,1474 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/resources/wsdl/README.md b/src/main/resources/wsdl/README.md new file mode 100644 index 0000000..12dbea0 --- /dev/null +++ b/src/main/resources/wsdl/README.md @@ -0,0 +1,8 @@ +## 兽药追溯接口 + +***1***,根据wsdl文件,生成最新的接口 +```shell +wsimport -encoding utf-8 -s ./src/main/java/ -p com.iqudoo.platform.application.domain.veterinary.wsdl -extension ./src/main/resources/wsdl/CxfWebServiceImplApiService.wsdl +``` +***2***, 找到文件`CxfWebServiceImplApiService.java`中查询`resources`的绝对路径,并替换为`classpath:`相对路径 +