From a8ba678a3fe5a39da2c732014cebbb66e408e97c Mon Sep 17 00:00:00 2001 From: WangHan <wwh_work@126,com> Date: 星期三, 02 四月 2025 18:45:12 +0800 Subject: [PATCH] 问题与漏洞修改 --- consum-base/src/main/java/com/consum/base/controller/FinSysTenantUserController.java | 23 consum-base/src/main/java/com/consum/base/service/impl/LWhFormInventoryServiceImpl.java | 4 iplatform-base/src/main/java/com/iplatform/base/config/JacksonConfig.java | 27 iplatform-base-tcp/src/main/java/com/iplatform/tcp/Constants.java | 16 iplatform-base-security-consum/src/main/java/com/iplatform/security/DefaultAuthenticationFailureHandler.java | 6 consum-base/src/main/java/com/consum/base/pojo/request/baseGoodModel.java | 12 iplatform-base/src/main/resources/images/jigsaw_bg/6.jpg | 0 iplatform-core/src/main/java/com/iplatform/core/TokenEntity.java | 43 iplatform-base/src/main/resources/images/jigsaw_block/9.png | 0 iplatform-base/src/main/java/com/iplatform/base/util/UserUtils.java | 244 iplatform-base/src/main/java/com/iplatform/base/PlatformAdapterController.java | 189 iplatform-base/src/main/java/com/iplatform/base/SystemController.java | 551 iplatform-file-server/src/main/java/com/iplatform/file/support/QnOssFileEngine.java | 53 iplatform-base-tcp/src/test/java/com/ctoms/tcp/DemoWebsocketClient.java | 81 iplatform-base-admin/src/main/java/com/iplatform/base/controller/UserController.java | 386 iplatform-file-server/src/main/java/com/iplatform/model/po/S_file.java | 310 iplatform-base/src/main/java/com/iplatform/base/util/TextUtils.java | 83 iplatform-base/src/main/java/com/iplatform/base/pojo/log/LoginLogParam.java | 147 iplatform-base/src/main/java/com/iplatform/base/pojo/RequestLogin.java | 184 iplatform-base-tcp/src/main/resources/application-dev.yml | 476 iplatform-base/src/main/java/com/iplatform/base/LocalDatabaseMetaEngine.java | 100 iplatform-base/src/test/java/com/iplatform/base/TestMenu.java | 194 iplatform-base/src/main/java/com/iplatform/base/SecurityConstants.java | 38 iplatform-base-tcp/src/main/java/com/iplatform/tcp/config/TcpBeanPostProcessorConfig.java | 29 iplatform-base/src/main/java/com/iplatform/base/pojo/role/RoleParam.java | 42 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_chat_mapper.java | 311 consum-base/src/main/java/com/consum/base/controller/FinWarehouseLedgerController.java | 6 iplatform-base/src/main/java/com/iplatform/base/service/CodeServiceImpl.java | 187 iplatform-base/src/main/java/com/iplatform/base/util/RoleUtils.java | 41 consum-base/src/main/java/com/consum/base/controller/LWhWarningController.java | 7 iplatform-file-server/src/main/java/com/iplatform/file/FileStoreCallback.java | 25 iplatform-base/src/main/resources/images/jigsaw_block/13.png | 0 iplatform-base-admin/src/main/java/com/iplatform/base/controller/DeptController.java | 283 consum-base/src/main/java/com/consum/base/pojo/FinSysTenantDepartmentParam.java | 3 iplatform-base/src/main/java/com/iplatform/base/config/CacheConfiguration.java | 64 iplatform-base/src/main/resources/images/jigsaw_block/21.png | 0 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dialog_history.java | 273 consum-base/src/main/java/com/consum/base/pojo/response/UsingFormBackGoodsTemplateInfo.java | 4 iplatform-base/src/main/java/com/iplatform/base/cache/LocalUserOnlineProvider.java | 88 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_user_login.java | 199 iplatform-base-admin/src/main/java/com/iplatform/base/config/SwaggerProperties.java | 35 iplatform-base/src/main/java/com/iplatform/base/pojo/group/GroupData.java | 30 iplatform-base/src/main/java/com/iplatform/base/support/strategy/MobileOnceLoginStrategy.java | 51 iplatform-base/src/main/java/com/iplatform/base/service/ApiTimeServiceImpl.java | 96 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_config_mapper.java | 327 pom.xml | 162 consum-base/src/main/java/com/consum/base/pojo/WhWarningConfigParam.java | 6 consum-base/src/main/java/com/consum/base/service/core/DepFormScrappedCoreService.java | 3 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_message_mapper.java | 431 iplatform-base/src/main/java/com/iplatform/base/cache/LocalCategoryCacheProvider.java | 144 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_group_data.java | 222 iplatform-base/src/main/java/com/iplatform/base/SystemGroupCache.java | 20 iplatform-base/src/main/java/com/iplatform/base/AbstractSecurityController.java | 129 iplatform-base/src/main/resources/images/jigsaw_block/1.png | 0 iplatform-model-pojo/src/main/java/com/iplatform/model/vo/ConfigFormItemConfigRegListVo.java | 31 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_user_core.java | 948 iplatform-base/src/main/java/com/iplatform/base/captcha/NoneCaptchaProvider.java | 29 iplatform-base/src/main/java/com/iplatform/base/controller/TestMenuController.java | 57 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_oper_log.java | 744 iplatform-base/src/main/java/com/iplatform/base/cache/MenuCacheProvider.java | 597 iplatform-base/src/main/java/com/iplatform/base/util/cache/CategorySortComparator.java | 23 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_category_mapper.java | 371 consum-base/src/main/java/com/consum/base/pojo/LWFormsOutputGoodsModelParam.java | 16 iplatform-base/src/main/java/com/iplatform/base/util/menu/SystemMenu.java | 41 iplatform-base-admin/src/main/java/com/iplatform/base/controller/SchedulerController.java | 74 iplatform-base-tcp/src/main/java/com/iplatform/tcp/support/WebSocketPush.java | 131 iplatform-base/src/main/java/com/iplatform/base/pojo/role/RoleAuthParam.java | 31 consum-base/src/main/java/com/consum/base/pojo/query/TransferQry.java | 38 iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/LoginRequest.java | 34 iplatform-base/src/main/resources/images/jigsaw/original/4.png | 0 consum-base/src/main/java/com/consum/base/controller/BaseWarehouseManagerController.java | 22 iplatform-base/src/main/resources/images/jigsaw_bg/13.jpg | 0 iplatform-base/src/main/java/com/iplatform/base/pojo/KeywordsParam.java | 28 iplatform-model-pojo/src/main/java/com/iplatform/model/to/UserAndDeptTo.java | 165 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_category.java | 332 iplatform-base/src/main/java/com/iplatform/base/service/UserServiceImpl.java | 386 iplatform-base/src/main/resources/images/jigsaw/slidingBlock/6.png | 0 iplatform-core/src/main/java/com/iplatform/core/PlatformConfiguration.java | 15 iplatform-model-pojo/src/main/java/com/iplatform/model/po/TcpEquipHistory.java | 332 iplatform-base/src/main/resources/images/jigsaw_block/8.png | 0 iplatform-file-server/src/main/java/com/iplatform/file/config/FileWebConfig.java | 40 iplatform-base/src/main/java/com/iplatform/base/util/RestTemplateUtils.java | 61 consum-base/src/main/java/com/consum/base/pojo/LWhFormScrappedParam.java | 20 iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/StepTimeFilter.java | 32 iplatform-base/src/main/java/com/iplatform/base/cache/RedisMenuUpdateCache.java | 42 consum-base/src/main/java/com/consum/base/pojo/response/DepartGoodsUseInfo.java | 4 iplatform-base/pom.xml | 277 iplatform-base/src/main/java/com/iplatform/base/controller/CaptchaController.java | 246 consum-base/src/main/java/com/consum/base/controller/LWhFormTransferController.java | 86 iplatform-base/src/main/java/com/iplatform/base/exception/CaptchaException.java | 20 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_message.java | 441 iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/OfflineResponse.java | 29 iplatform-base/src/main/resources/images/jigsaw_bg/11.png | 0 consum-base/src/main/java/com/consum/base/service/impl/LWhGoodsRecordDetailsService.java | 3 iplatform-model-pojo/src/main/java/com/iplatform/model/po/TcpEquip.java | 332 consum-base/src/main/java/com/consum/base/pojo/LWhProcureModelUserParam.java | 4 iplatform-core/src/main/java/com/iplatform/core/LoginStrategy.java | 39 iplatform-base/src/main/java/com/iplatform/base/config/LocalCacheConfig.java | 176 deploy-jar-single/pom.xml | 88 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dialog_run_mapper.java | 307 iplatform-file-server/src/main/java/com/iplatform/file/controller/AttachmentController.java | 121 iplatform-base/src/main/java/com/iplatform/base/pojo/log/OperateLogParam.java | 154 iplatform-core/pom.xml | 196 consum-base/src/main/java/com/consum/base/controller/FinSysTenantController.java | 18 iplatform-base/src/main/java/com/iplatform/base/service/MenuServiceImpl.java | 107 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_login_info_mapper.java | 527 iplatform-base-tcp/src/main/java/com/iplatform/tcp/config/TcpConfig.java | 213 iplatform-base/src/main/java/com/iplatform/base/AbstractController.java | 360 iplatform-model-pojo/src/main/java/com/iplatform/model/po/TcpEquipHistory_mapper.java | 381 consum-base/src/main/java/com/consum/base/pojo/LWhProcureModelParam.java | 18 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_role_mapper.java | 387 iplatform-base-admin/src/main/java/com/iplatform/base/controller/CacheController.java | 154 iplatform-file-server/src/main/java/com/iplatform/model/po/SfAttachment.java | 376 iplatform-base-tcp/src/main/java/com/iplatform/tcp/EngineType.java | 37 iplatform-base/src/main/java/com/iplatform/base/cache/DictCacheProvider.java | 277 iplatform-base/src/main/java/com/iplatform/base/pojo/role/RoleUserParam.java | 25 iplatform-base-tcp/src/main/java/com/iplatform/tcp/cache/LocalEquipmentCacheProvider.java | 57 consum-base/src/main/java/com/consum/base/pojo/response/LWHFromTransferExtendVO.java | 64 iplatform-base/src/main/java/com/iplatform/base/config/CacheProperties.java | 63 consum-base/src/main/java/com/consum/base/pojo/DepFormScrappedGoodsParam.java | 7 consum-base/src/main/java/com/consum/base/pojo/request/RecordInfoParam.java | 4 iplatform-base/src/main/resources/images/jigsaw/slidingBlock/1.png | 0 iplatform-base/src/main/java/com/iplatform/base/service/LoginServiceImpl.java | 99 consum-base/src/main/java/com/consum/base/pojo/response/UsingFormBackDetailListVO.java | 4 consum-base/src/main/java/com/consum/base/pojo/request/LWhFormInventoryParam.java | 3 iplatform-model-pojo/src/main/java/com/iplatform/model/po/SfTemplateMessage_mapper.java | 321 iplatform-file-server/src/main/java/com/iplatform/file/util/FileStoreUtils.java | 51 iplatform-base/src/main/java/com/iplatform/base/config/ThreadPoolConfig.java | 58 iplatform-base/src/main/java/com/iplatform/base/di/PlatformDataImportEngine.java | 22 iplatform-base/src/main/resources/images/jigsaw_block/14.png | 0 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dict_type.java | 221 iplatform-model-pojo/src/main/java/com/iplatform/model/vo/NotificationTemplateVo.java | 105 iplatform-base/src/main/java/com/iplatform/base/config/RestTemplateProperties.java | 73 iplatform-base/src/main/java/com/iplatform/base/PushCacheProvider.java | 13 consum-base/src/main/java/com/consum/base/service/impl/LWhFormProcureServiceImpl.java | 3 consum-base/src/main/java/com/consum/base/pojo/query/LWhFormInventoryQry.java | 3 iplatform-base/src/main/java/com/iplatform/base/config/CaptchaProperties.java | 42 consum-base/src/main/java/com/consum/base/controller/LWhProcureModelController.java | 7 iplatform-model-pojo/src/main/java/com/iplatform/model/vo/NotificationConfigVo.java | 88 iplatform-base/src/main/java/com/iplatform/base/support/strategy/LoginStrategyManager.java | 81 iplatform-base-tcp/src/main/java/com/iplatform/tcp/lb/MqResponseUtils.java | 18 iplatform-base-tcp/src/test/java/com/ctoms/AppTest.java | 16 iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/WebBroadCastResponse.java | 50 iplatform-base/src/main/resources/images/jigsaw_bg/14.jpg | 0 iplatform-core/src/main/java/com/iplatform/core/workflow/AbstractContext.java | 126 iplatform-base/src/main/java/com/iplatform/base/config/PushConfig.java | 129 iplatform-base/src/main/java/com/iplatform/base/cache/RedisPushCacheProvider.java | 35 iplatform-base/src/main/java/com/iplatform/base/controller/WechatCallbackApi.java | 47 iplatform-base/src/main/java/com/iplatform/base/config/BeanPostProcessorConfig.java | 82 iplatform-base-tcp/src/main/java/com/iplatform/tcp/lb/DefaultMqListener.java | 96 iplatform-base/src/main/java/com/iplatform/base/pojo/form/FormData.java | 56 iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/TestHelloAction.java | 19 iplatform-base/src/main/resources/images/jigsaw_block/20.png | 0 consum-base/src/main/java/com/consum/base/controller/LWhWarningConfigController.java | 7 iplatform-base/src/main/java/com/iplatform/base/config/PushProperties.java | 83 iplatform-base/src/main/java/com/iplatform/base/service/ConfigArgumentServiceImpl.java | 70 iplatform-base/src/main/resources/images/jigsaw/slidingBlock/5.png | 0 iplatform-base/src/main/resources/images/jigsaw_block/19.png | 0 iplatform-base-tcp/src/main/java/com/iplatform/tcp/lb/MqConnectionMeta.java | 81 iplatform-model-pojo/src/main/java/com/iplatform/model/vo/CopyRightVo.java | 31 consum-base/src/main/java/com/consum/base/service/core/LWhWarningCoreService.java | 3 iplatform-base/src/main/java/com/iplatform/base/captcha/AbstractCaptchaProvider.java | 78 iplatform-base-security-consum/src/main/java/com/iplatform/security/config/WebSecurityConfig.java | 128 consum-base/src/main/java/com/consum/base/pojo/LWFormsOutputGoodsInfoParam.java | 12 iplatform-base/src/main/java/com/iplatform/base/PlatformRuntimeException.java | 19 consum-base/src/main/java/com/consum/base/controller/BaseGoodsTemplateController.java | 19 iplatform-base-security-consum/src/main/java/com/iplatform/security/DefaultLogoutSuccessHandler.java | 6 iplatform-model-pojo/src/main/java/com/iplatform/model/vo/SystemGroupVo.java | 42 iplatform-core/src/main/java/com/iplatform/core/config/enc/PropertySourceWrapper.java | 40 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_class_ext.java | 155 iplatform-model-pojo/src/main/java/com/iplatform/model/po/SfTemplateMessage.java | 260 consum-base/src/main/java/com/consum/base/pojo/query/WhWarningConfigQry.java | 22 iplatform-base/src/main/java/com/iplatform/base/callback/SecurityCallback.java | 69 iplatform-base/src/main/java/com/iplatform/base/cache/RedisNotificationTemplateCache.java | 103 iplatform-file-server/src/main/java/com/iplatform/file/DefaultFileOperateSpi.java | 231 iplatform-base/src/main/java/com/iplatform/base/util/dict/SystemDictData.java | 18 iplatform-base/src/main/resources/images/jigsaw_block/12.png | 0 consum-base/src/main/java/com/consum/base/pojo/response/LWhFormScrappedExtendVO.java | 4 iplatform-base/src/main/resources/images/jigsaw_block/7.png | 0 iplatform-file-server/src/main/java/com/iplatform/file/support/AliOssFileEngine.java | 32 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_user_core_mapper.java | 771 iplatform-base/src/main/java/com/iplatform/base/captcha/DefaultCaptchaProvider.java | 37 consum-base/src/main/java/com/consum/base/pojo/LWhFormScrappedGoodsModelParams.java | 4 consum-base/src/main/java/com/consum/base/service/core/LWhFormTransferCoreService.java | 9 iplatform-base/src/main/java/com/iplatform/base/service/CategoryServiceImpl.java | 212 iplatform-base/src/main/resources/images/jigsaw_bg/11.jpg | 0 iplatform-base/src/main/java/com/iplatform/base/util/PlatformRSAUtils.java | 134 iplatform-base-tcp/pom.xml | 225 iplatform-base-security-consum/src/main/java/com/iplatform/security/FailedAuthenticationEntryPoint.java | 8 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_class_ext_mapper.java | 247 iplatform-base/src/main/resources/images/jigsaw_bg/1.jpg | 0 iplatform-core/src/main/java/com/iplatform/core/RegularConstants.java | 97 iplatform-base/src/main/java/com/iplatform/base/VariableConstants.java | 37 consum-base/src/main/java/com/consum/base/pojo/response/GoodsStatisticsInfoVO.java | 26 iplatform-base/src/main/java/com/iplatform/base/config/CaptchaConfig.java | 103 consum-base/src/main/java/com/consum/base/pojo/query/WarehouseQry.java | 18 iplatform-base/src/main/java/com/iplatform/base/DeptCacheProvider.java | 47 iplatform-base/src/main/java/com/iplatform/base/di/AbstractDataImportEngine.java | 78 iplatform-base/src/main/java/com/iplatform/base/config/ThirdPartyConfig.java | 26 iplatform-base/src/main/java/com/iplatform/base/service/PushServiceImpl.java | 14 iplatform-base/src/main/java/com/iplatform/base/PushData.java | 99 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_role.java | 336 iplatform-base/src/main/java/com/iplatform/base/util/menu/MenuOrderNumComparator.java | 18 iplatform-base/src/main/java/com/iplatform/base/UserCacheProvider.java | 27 iplatform-base/src/main/java/com/iplatform/base/callback/UserProfileCallback.java | 16 consum-base/src/main/java/com/consum/base/pojo/request/WarehouseManagerParam.java | 10 iplatform-base/src/main/java/com/iplatform/base/support/PlatformOperationInterceptor.java | 54 iplatform-base/src/main/java/com/iplatform/base/config/DataImportConfig.java | 51 iplatform-base/src/main/java/com/iplatform/base/pojo/CaptchaParam.java | 88 iplatform-base/src/main/java/com/iplatform/base/util/user/SystemUser.java | 26 iplatform-core/src/main/java/com/iplatform/core/workflow/WorkflowCallback.java | 30 iplatform-base/src/main/resources/images/jigsaw/slidingBlock/2.png | 0 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_chat.java | 231 consum-base/src/main/java/com/consum/base/controller/DepFormScrappedController.java | 29 consum-base/src/main/java/com/consum/base/pojo/response/FinSysTenantUserVO.java | 20 iplatform-model-pojo/src/main/java/com/iplatform/model/vo/OrderCenterNumVo.java | 77 iplatform-model-pojo/src/main/java/com/iplatform/model/to/UserAndDeptToResult.java | 47 iplatform-file-server/src/main/java/com/iplatform/App.java | 13 iplatform-model-pojo/src/main/java/com/iplatform/model/vo/RouterVo.java | 148 iplatform-base-admin/src/main/java/com/iplatform/base/controller/CategoryController.java | 155 iplatform-base/src/main/java/com/iplatform/base/support/TimeStatisticsInterceptor.java | 95 consum-base/src/main/java/com/consum/base/pojo/query/LWhLedgerQry.java | 24 iplatform-base/src/main/java/com/iplatform/base/cache/LocalDeptCacheProvider.java | 146 iplatform-base/src/main/java/com/iplatform/base/cache/LocalUserCacheProvider.java | 81 consum-base/src/main/java/com/consum/base/pojo/response/FormTransferVO.java | 4 consum-base/src/main/java/com/consum/base/pojo/response/GoodsTemplateVO.java | 4 consum-base/src/main/java/com/consum/base/service/core/LWhFormProcureCoreService.java | 6 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dict_data_mapper.java | 371 consum-base/src/main/java/com/consum/base/pojo/query/FormProcureQry.java | 30 iplatform-base/src/main/java/com/iplatform/base/Constants.java | 214 iplatform-base/src/main/java/com/iplatform/base/cache/LocalSystemGroupCache.java | 81 iplatform-base-admin/src/main/java/com/iplatform/base/controller/LoginInfoController.java | 47 iplatform-base/src/main/resources/images/jigsaw/slidingBlock/4.png | 0 iplatform-core/src/main/java/com/iplatform/core/config/LoadBalanceProperties.java | 25 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_menu_mapper.java | 439 iplatform-file-server/src/main/java/com/iplatform/file/controller/FileController.java | 44 iplatform-base/src/main/java/com/iplatform/base/captcha/SmsCaptchaProvider.java | 83 consum-base/src/main/java/com/consum/base/pojo/response/WarehouseFlowVO.java | 26 iplatform-base/src/main/resources/images/jigsaw_block/11.png | 0 iplatform-base/src/main/resources/images/jigsaw_block/6.png | 0 iplatform-base/src/main/resources/images/demo.txt | 0 iplatform-base/src/main/java/com/iplatform/base/api/UserAndDeptApi.java | 40 iplatform-base/src/main/java/com/iplatform/base/support/strategy/AbstractLoginStrategy.java | 41 iplatform-model-pojo/src/main/java/com/iplatform/model/vo/CategoryTreeVo.java | 137 iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/LoginAction.java | 29 iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/OnlineResponse.java | 29 iplatform-model-pojo/src/main/java/com/iplatform/model/po/TcpEquipStatus_mapper.java | 381 consum-base/src/main/java/com/consum/base/controller/LWhFormProcureController.java | 34 iplatform-base-admin/src/main/java/com/iplatform/base/controller/GroupController.java | 164 iplatform-base/src/main/java/com/iplatform/base/util/RandomUtils.java | 16 consum-base/src/main/java/com/consum/base/controller/LWhHomeStatisticsController.java | 7 iplatform-base/src/main/java/com/iplatform/base/pojo/UserParam.java | 48 iplatform-base/src/main/java/com/iplatform/base/FileOperateSpi.java | 82 iplatform-base/src/main/java/com/iplatform/base/di/TemplateInfo.java | 43 iplatform-base/src/test/java/com/iplatform/base/MenuCacheProvider.java | 529 iplatform-base-tcp/src/main/java/com/iplatform/tcp/cache/RedisEquipmentCacheProvider.java | 69 iplatform-base/src/main/java/com/iplatform/base/service/UserDeptApiServiceImpl.java | 152 iplatform-base/src/main/java/com/iplatform/base/config/FileProperties.java | 109 consum-base/src/main/java/com/consum/base/service/impl/UsingFormBackServiceImpl.java | 3 iplatform-base/src/main/java/com/iplatform/base/WechatBaseController.java | 217 consum-base/src/main/java/com/consum/base/pojo/WarnConfImEntity.java | 18 deploy-jar-single/src/main/resources/application.yml | 2 iplatform-base/src/main/java/com/iplatform/base/RootConfigBean.java | 83 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dict_type_mapper.java | 291 iplatform-base-tcp/src/main/java/com/iplatform/CtomsTcpApplication.java | 23 iplatform-base/src/main/java/com/iplatform/base/UserLoginCache.java | 20 iplatform-core/src/main/java/com/iplatform/core/util/AESUtils.java | 197 iplatform-base/src/main/resources/images/jigsaw_bg/12.jpg | 0 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_host.java | 265 consum-base/src/main/java/com/consum/base/pojo/LWhFormScrappedGoodsInfoParam.java | 8 consum-base/src/main/java/com/consum/base/core/utils/CommonUtil.java | 5 consum-base/src/main/java/com/consum/base/pojo/query/LDeptFormScrappedQry.java | 5 iplatform-base/src/main/java/com/iplatform/base/util/CategoryUtils.java | 87 iplatform-base-admin/src/main/java/com/iplatform/base/controller/ConfigController.java | 175 iplatform-base/src/main/resources/images/jigsaw_bg/2.jpg | 0 iplatform-base/doc/iplatform_base.sql | 35 iplatform-model-pojo/src/main/java/com/iplatform/model/po/SfNotification_mapper.java | 373 iplatform-base/src/main/java/com/iplatform/base/service/ConfigFormServiceImpl.java | 35 iplatform-base/src/main/java/com/iplatform/base/PlatformLoginCallback.java | 61 admin-web/src/api/foudation/material.js | 5 iplatform-base-tcp/src/main/java/com/iplatform/tcp/support/PlatformSharpProtocolResolver.java | 55 iplatform-base/src/main/resources/images/jigsaw/slidingBlock/3.png | 0 iplatform-base-tcp/src/main/java/com/iplatform/tcp/EquipmentCacheProvider.java | 17 iplatform-base/src/main/java/com/iplatform/base/config/WebCommonConfig.java | 282 iplatform-base/src/main/java/com/iplatform/base/service_api/UserAndDeptServiceApi.java | 27 iplatform-base/src/main/java/com/iplatform/base/WechatConstants.java | 490 iplatform-base/src/main/java/com/iplatform/base/config/ApiProperties.java | 17 iplatform-base/src/main/java/com/iplatform/base/config/LogProperties.java | 27 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_host_mapper.java | 319 iplatform-model-pojo/src/main/java/com/iplatform/model/vo/MetaVo.java | 102 iplatform-base-tcp/src/main/java/com/iplatform/tcp/service/TcpEquipStatusServiceImpl.java | 8 consum-base/src/main/java/com/consum/base/pojo/response/GoodsTemplateInfoVO.java | 4 consum-base/src/main/java/com/consum/base/pojo/response/FormScrappedGoodsDetailVO.java | 4 iplatform-base/src/main/java/com/iplatform/base/config/SecurityUserProperties.java | 36 iplatform-core/src/main/java/com/iplatform/core/UserMerchantType.java | 78 iplatform-base-tcp/src/main/java/com/iplatform/tcp/lb/DefaultLbConnectionManager.java | 31 iplatform-file-server/src/main/java/com/iplatform/file/support/AwsOssFileEngine.java | 359 consum-base/src/main/java/com/consum/base/core/CodeGeneratorService.java | 3 iplatform-base/src/main/java/com/iplatform/base/pojo/notify/NotificationParam.java | 18 consum-base/src/main/java/com/consum/base/pojo/response/LWhFormScrappedVO.java | 4 iplatform-base/src/main/java/com/iplatform/base/cache/LocalPushCacheProvider.java | 43 iplatform-core/src/main/java/com/iplatform/core/config/enc/PropertySourcePostProcessor.java | 89 consum-base/src/main/java/com/consum/base/pojo/response/FormOutputVO.java | 4 iplatform-base/src/main/java/com/iplatform/base/service/GroupServiceImpl.java | 78 consum-base/src/main/java/com/consum/base/pojo/response/TransferInfoVO.java | 18 iplatform-base/src/main/resources/images/jigsaw_block/17.png | 0 iplatform-base/src/main/java/com/iplatform/base/pojo/MenuParam.java | 29 iplatform-core/src/main/java/com/iplatform/core/workflow/WorkflowForm.java | 157 iplatform-base/src/main/java/com/iplatform/base/push/MockSmsPush.java | 48 consum-base/src/main/java/com/consum/base/pojo/response/LWhFormOutputExtendVO.java | 4 iplatform-base-tcp/src/main/java/com/iplatform/tcp/controller/TestTcpController.java | 179 iplatform-base-tcp/src/main/java/com/iplatform/tcp/service/TcpEquipServiceImpl.java | 9 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_group_data_mapper.java | 303 iplatform-base-admin/pom.xml | 32 iplatform-base/src/main/java/com/iplatform/base/cache/LocalHostCacheProvider.java | 50 consum-model-pojo/pom.xml | 8 iplatform-base/src/main/java/com/iplatform/base/util/dept/SystemDept.java | 42 iplatform-base/src/main/resources/images/jigsaw_block/10.png | 0 consum-base/src/main/java/com/consum/base/pojo/request/UsingFormBackGoodsInfo.java | 4 iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/LoginResponse.java | 43 iplatform-base/src/main/java/com/iplatform/base/support/strategy/WebOnceLoginStrategy.java | 48 iplatform-base/src/main/resources/images/jigsaw_bg/10.jpg | 0 consum-base/src/main/java/com/consum/base/pojo/response/GoodsModelVO.java | 18 iplatform-base/src/main/java/com/iplatform/base/di/FileDataImportEngine.java | 14 consum-base/src/main/java/com/consum/base/pojo/query/LWhFormScrappedQry.java | 4 iplatform-base/src/main/resources/images/jigsaw/original/1.png | 0 iplatform-base/src/main/java/com/iplatform/base/callback/PlatformCallbackPostProcessor.java | 120 iplatform-base-tcp/src/main/resources/application-test.yml | 485 iplatform-model-pojo/src/main/java/com/iplatform/model/po/TcpEquipStatus.java | 332 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_code_mapper.java | 309 iplatform-base/src/main/java/com/iplatform/base/cache/RedisSystemGroupCache.java | 95 iplatform-base/src/main/java/com/iplatform/base/pojo/DeptParam.java | 59 iplatform-base/src/main/java/com/iplatform/base/AsyncManager.java | 67 iplatform-base/src/main/java/com/iplatform/base/cache/RedisCategoryCacheProvider.java | 123 iplatform-base/src/main/java/com/iplatform/base/exception/LoginException.java | 37 iplatform-base-admin/src/main/java/com/iplatform/base/controller/PermitController.java | 128 iplatform-core/src/main/java/com/iplatform/core/config/PropertyPostProcessorConfig.java | 16 iplatform-file-server/src/main/java/com/iplatform/model/vo/FileResultVo.java | 75 iplatform-base/src/main/java/com/iplatform/base/support/DeptTreeGenerator.java | 24 iplatform-base/src/main/java/com/iplatform/base/CategoryCacheProvider.java | 34 iplatform-base/src/main/java/com/iplatform/base/support/RedisArgumentsManager.java | 158 iplatform-base/src/main/java/com/iplatform/base/pojo/ConfigParam.java | 39 admin-web/src/views/foundation/material/edit.vue | 2 iplatform-base/src/main/java/com/iplatform/base/config/LoginStrategyProperties.java | 41 iplatform-base/src/main/resources/images/jigsaw_bg/3.jpg | 0 iplatform-base-tcp/src/main/java/com/iplatform/tcp/cache/RedisEquipStatusCacheProvider.java | 69 iplatform-base-tcp/src/main/java/com/iplatform/tcp/config/WebsocketConfig.java | 147 consum-base/src/main/java/com/consum/base/pojo/query/WhWarningQry.java | 28 consum-base/src/main/java/com/consum/base/pojo/LDeptFormScrappedParam.java | 14 consum-base/src/main/java/com/consum/base/pojo/LWhTransferModelParam.java | 22 iplatform-base/src/main/java/com/iplatform/base/callback/TestAfterLoginCallback.java | 28 iplatform-base/src/main/java/com/iplatform/base/util/DeptUtils.java | 56 consum-base/pom.xml | 29 iplatform-base/src/main/java/com/iplatform/base/util/NotificationUtils.java | 167 iplatform-base/src/main/resources/images/jigsaw_block/5.png | 0 iplatform-base-tcp/src/main/java/com/iplatform/tcp/config/RedisTcpCacheConfig.java | 69 iplatform-core/src/main/java/com/iplatform/core/workflow/Context.java | 96 consum-base/src/main/java/com/consum/base/controller/LWhFormInventoryGoodsController.java | 7 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_config.java | 288 iplatform-base/src/main/java/com/iplatform/base/pojo/UserInfo.java | 112 iplatform-model-pojo/src/main/java/com/iplatform/model/vo/MenuVo.java | 129 iplatform-base/src/main/java/com/iplatform/base/pojo/form/FormDataItem.java | 59 iplatform-base-tcp/src/main/java/com/iplatform/tcp/controller/ConnectionManagerController.java | 42 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_oper_log_mapper.java | 623 iplatform-base/src/main/java/com/iplatform/base/cache/LocalCaptchaCacheProvider.java | 47 iplatform-base/src/main/java/com/iplatform/base/pojo/dict/DictParam.java | 83 iplatform-base/src/main/java/com/iplatform/base/pojo/UserInfoRequest.java | 43 consum-base/src/main/java/com/consum/base/service/core/LWhFormOutputCoreService.java | 6 iplatform-base/src/main/java/com/iplatform/base/config/TcpProperties.java | 163 iplatform-base/src/main/java/com/iplatform/base/service/NotificationServiceImpl.java | 41 deploy-jar-single/src/main/resources/application-dev.yml | 22 iplatform-base-admin/src/main/java/com/iplatform/base/controller/OperateLogController.java | 57 consum-base/src/main/java/com/consum/base/pojo/response/FormInventoryDetailVO.java | 3 iplatform-base/src/main/resources/images/jigsaw_block/18.png | 0 iplatform-base-tcp/src/main/java/com/iplatform/tcp/EquipmentStatusCacheProvider.java | 17 iplatform-base/src/main/java/com/iplatform/base/DefaultUserPrincipal.java | 148 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_login_info.java | 604 iplatform-base/src/main/java/com/iplatform/base/cache/LocalUserLoginCache.java | 46 iplatform-core/src/main/java/com/iplatform/core/SimpleVariable.java | 124 iplatform-base/src/main/resources/images/jigsaw/original/2.png | 0 iplatform-base-tcp/src/main/java/com/iplatform/tcp/pojo/EquipParam.java | 16 iplatform-file-server/src/main/java/com/iplatform/model/po/SfAttachment_mapper.java | 387 iplatform-base/src/main/java/com/iplatform/base/config/SpiConfig.java | 97 consum-base/src/main/java/com/consum/base/pojo/request/LWhFormTransferParam.java | 28 consum-base/src/main/java/com/consum/base/pojo/response/UsingFormBackModelInfo.java | 4 iplatform-file-server/src/main/java/com/iplatform/file/util/ImageUtils.java | 84 iplatform-file-server/src/main/java/com/iplatform/file/config/FileConfig.java | 208 iplatform-base-admin/src/main/java/com/iplatform/base/controller/ApiTimeController.java | 49 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_user_profile_mapper.java | 439 consum-base/src/main/java/com/consum/base/controller/BaseGoodsModelsController.java | 6 iplatform-base/src/main/java/com/iplatform/base/push/DefaultPushManager.java | 90 iplatform-base/src/main/java/com/iplatform/base/service/RoleServiceImpl.java | 303 iplatform-base/src/main/resources/images/jigsaw_bg/9.jpg | 0 iplatform-base/src/main/java/com/iplatform/base/cache/LocalNotificationTemplateCache.java | 88 iplatform-file-server/src/main/java/com/iplatform/file/config/FtpProperties.java | 66 consum-base/src/main/java/com/consum/base/controller/LWhFormOutputController.java | 38 iplatform-base/src/test/java/com/iplatform/base/TestCaptcha.java | 29 iplatform-model-pojo/src/main/java/com/iplatform/model/vo/ConfigFormItemVo.java | 80 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dialog_run.java | 231 iplatform-base/src/main/java/com/iplatform/base/config/PushWechatConfig.java | 36 consum-base/src/main/java/com/consum/base/controller/LOrgSupplierController.java | 6 iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/WebDataResponse.java | 20 iplatform-file-server/src/test/java/com/iplatform/file/TestOss.java | 65 consum-base/src/main/java/com/consum/base/pojo/response/FormInventoryVO.java | 14 iplatform-base/src/main/java/com/iplatform/base/cache/RedisUserCacheProvider.java | 133 consum-base/src/main/java/com/consum/base/pojo/request/UsingFormBackParam.java | 20 iplatform-base-admin/src/main/java/com/iplatform/base/controller/NotificationController.java | 133 iplatform-base/src/main/java/com/iplatform/base/cache/RedisDeptCacheProvider.java | 213 consum-base/src/main/java/com/consum/base/pojo/query/LWhGoodsStatisQry.java | 24 iplatform-base/src/main/java/com/iplatform/base/util/DataImportUtils.java | 220 consum-base/src/main/java/com/consum/base/pojo/WarehouseManagerInfo.java | 8 iplatform-base/src/main/java/com/iplatform/base/pojo/notify/InfoParam.java | 35 iplatform-base/src/main/java/com/iplatform/base/support/LogAspect.java | 233 iplatform-base-admin/src/main/java/com/iplatform/base/Test1.java | 7 iplatform-core/src/main/java/com/iplatform/core/PlatformException.java | 15 iplatform-base-admin/src/main/java/com/iplatform/base/IdUtil.java | 78 iplatform-base-admin/src/main/java/com/iplatform/base/controller/ConfigFormController.java | 127 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dept.java | 442 iplatform-core/src/main/java/com/iplatform/core/config/enc/EncryptionWrapperDetector.java | 40 iplatform-base-tcp/src/main/java/com/iplatform/tcp/controller/EquipController.java | 43 consum-base/src/main/java/com/consum/base/pojo/LWhFormTransferGoodsInfoParam.java | 10 iplatform-base/src/main/java/com/iplatform/base/support/DictTreeGenerator.java | 24 iplatform-base-admin/src/main/java/com/iplatform/base/controller/UserProfileController.java | 201 iplatform-base/src/main/java/com/iplatform/base/callback/TestUserCallback.java | 31 iplatform-base/src/main/java/com/iplatform/base/util/menu/ParentMenuComparator.java | 24 iplatform-base/src/main/java/com/iplatform/base/di/DataImportEngine.java | 44 consum-base/src/main/java/com/consum/base/controller/BaseCategoryController.java | 3 iplatform-base-tcp/src/main/java/com/iplatform/tcp/support/TestConnectionCallback.java | 32 iplatform-model-pojo/src/main/java/com/iplatform/model/vo/ConfigFormVo.java | 140 consum-base/src/main/java/com/consum/base/service/core/LWarehouseFlowCoreService.java | 3 iplatform-base-tcp/src/test/java/com/ctoms/tcp/WebsocketClientTest.java | 101 iplatform-base/src/main/resources/images/jigsaw_bg/4.jpg | 0 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_config_form_mapper.java | 279 iplatform-base-security-consum/pom.xml | 66 iplatform-core/src/main/java/com/iplatform/core/util/ThreadUtils.java | 98 iplatform-file-server/src/main/java/com/iplatform/file/support/JdbcCallback.java | 124 iplatform-base/src/main/java/com/iplatform/base/util/role/SystemRole.java | 52 iplatform-core/src/main/java/com/iplatform/core/workflow/Actorable.java | 66 iplatform-base-tcp/src/main/java/com/iplatform/tcp/cache/LocalEquipStatusCacheProvider.java | 57 iplatform-base-tcp/src/main/resources/application-line-prod.yml | 480 iplatform-base/src/main/java/com/iplatform/base/callback/GeneralLoginCallback.java | 92 iplatform-file-server/src/main/java/com/iplatform/model/po/S_file_mapper.java | 341 consum-base/src/main/java/com/consum/base/controller/LWhFormScrappedController.java | 37 iplatform-base/src/main/java/com/iplatform/base/service/DataImportServiceImpl.java | 17 consum-base/src/main/java/com/consum/base/controller/FinSysTenantDepartmentController.java | 19 iplatform-base-tcp/src/test/java/com/ctoms/tcp/DemoLoginResponse.java | 51 iplatform-base/src/main/java/com/iplatform/base/NotificationTemplateCache.java | 19 iplatform-base/src/main/resources/images/jigsaw_block/4.png | 0 iplatform-base/src/main/java/com/iplatform/base/captcha/BlockPuzzleCaptchaProvider.java | 375 iplatform-base-admin/src/main/java/com/iplatform/base/controller/OnlineUserController.java | 48 iplatform-base/src/main/java/com/iplatform/base/cache/RedisCaptchaCacheProvider.java | 35 iplatform-base-tcp/src/main/java/com/iplatform/tcp/LiveStatus.java | 44 iplatform-base-tcp/src/main/java/com/iplatform/tcp/lb/DefaultResponseWriter.java | 51 iplatform-file-server/src/main/java/com/iplatform/file/support/AttachmentJdbcCallback.java | 130 iplatform-base/src/main/java/com/iplatform/base/util/cache/CacheInfo.java | 69 iplatform-base-security-consum/src/main/java/com/iplatform/security/controller/SecurityController.java | 2 iplatform-core/src/main/java/com/iplatform/core/TokenAwareContext.java | 26 iplatform-file-server/src/main/java/com/iplatform/file/controller/OssFileApi.java | 116 consum-base/src/main/java/com/consum/base/pojo/LWhFormOutputParam.java | 14 iplatform-file-server/src/main/java/com/iplatform/file/support/TxOssFileEngine.java | 32 iplatform-base/src/main/java/com/iplatform/base/pojo/GroupDataParam.java | 31 iplatform-base/src/main/resources/images/jigsaw_bg/15.jpg | 0 iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/LocationNowAction.java | 28 iplatform-base/src/main/java/com/iplatform/base/SecuritySpi.java | 81 iplatform-base-admin/src/main/java/com/iplatform/base/excel/UserDataImportor.java | 126 iplatform-base/src/main/java/com/iplatform/base/NotifyConstants.java | 22 iplatform-base/src/main/resources/images/jigsaw/original/3.png | 0 iplatform-base/src/main/java/com/iplatform/base/ThirdPartyAuthentication.java | 38 iplatform-base/src/main/java/com/iplatform/base/captcha/TextCaptchaProvider.java | 37 iplatform-base-tcp/src/main/java/com/iplatform/tcp/lb/SimpleMqListener.java | 144 iplatform-base/src/main/java/com/iplatform/base/event/RoleSecurityChangeEvent.java | 21 consum-base/src/main/java/com/consum/base/pojo/query/UsingFormBackQry.java | 30 consum-base/src/main/java/com/consum/base/service/core/LWhFormInventoryCoreService.java | 4 consum-base/src/main/java/com/consum/base/controller/BaseWarehouseController.java | 19 iplatform-base/src/main/java/com/iplatform/base/di/PlatformExcelTemplateGenerator.java | 71 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_menu.java | 453 iplatform-base/src/main/java/com/iplatform/base/util/TokenUtils.java | 129 consum-base/src/main/java/com/consum/base/service/core/DepUsingFormBackCoreService.java | 3 iplatform-base/src/test/java/com/iplatform/base/TestEntity.java | 28 iplatform-base-tcp/src/main/java/com/iplatform/tcp/config/LoadBalanceMQConfig.java | 82 iplatform-base/src/main/resources/images/jigsaw_bg/8.jpg | 0 consum-base/src/main/java/com/consum/base/pojo/response/GoodsTemplateCountVO.java | 20 iplatform-base-tcp/src/main/java/com/iplatform/tcp/config/LocalTcpCacheConfig.java | 43 iplatform-base/src/test/java/com/iplatform/base/redis/MenuCacheProvider.java | 541 consum-base/src/main/java/com/consum/base/controller/FinFileController.java | 8 iplatform-model-pojo/src/main/java/com/iplatform/model/vo/ApiTime.java | 75 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dept_mapper.java | 435 iplatform-base/src/main/resources/images/jigsaw_block/3.png | 0 consum-base/src/main/java/com/consum/base/controller/LWhFormInventoryController.java | 70 iplatform-file-server/src/main/java/com/iplatform/file/support/AbstractOssFileEngine.java | 58 consum-base/src/main/java/com/consum/base/service/impl/DepFormScrappedServiceImpl.java | 3 consum-base/src/main/java/com/consum/base/pojo/query/LWhFormOutputQry.java | 36 deploy-jar-single/src/main/resources/application-prod.yml | 12 iplatform-base-tcp/src/main/resources/application.yml | 7 consum-base/src/main/java/com/consum/base/pojo/LWarehouseFlowParam.java | 38 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_group.java | 200 iplatform-model-pojo/src/main/java/com/iplatform/model/vo/ConfigFormItemConfigVo.java | 152 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_user_profile.java | 463 iplatform-base/src/main/java/com/iplatform/base/ArgumentsConstants.java | 103 iplatform-base/src/main/java/com/iplatform/base/cache/RedisHostCacheProvider.java | 61 iplatform-base/src/main/java/com/iplatform/base/WechatCacheProvider.java | 56 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dialog_history_mapper.java | 339 consum-base/src/main/java/com/consum/base/pojo/query/LWhProcureModelQry.java | 12 consum-base/src/main/java/com/consum/base/pojo/response/FormInventoryGoodsVO.java | 24 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_group_mapper.java | 283 deploy-jar-single/src/main/resources/application-test.yml | 12 iplatform-base/src/main/resources/images/jigsaw/original/6.png | 0 consum-base/src/main/java/com/consum/base/controller/LWarehouseFlowController.java | 6 iplatform-base-admin/src/main/java/com/iplatform/base/controller/CodeController.java | 237 iplatform-base/src/main/java/com/iplatform/base/config/DruidMonitorConfig.java | 119 iplatform-base/src/main/java/com/iplatform/base/config/RedisCacheConfig.java | 288 consum-base/src/main/java/com/consum/base/controller/FinSysServerController.java | 7 iplatform-base/src/main/resources/images/jigsaw_block/15.png | 0 iplatform-base-admin/src/main/java/com/iplatform/base/controller/MenuController.java | 154 iplatform-base/src/main/resources/images/jigsaw_bg/5.jpg | 0 iplatform-base/src/main/java/com/iplatform/base/util/CaptchaUtils.java | 22 iplatform-core/src/main/java/com/iplatform/core/BeanContextAware.java | 51 iplatform-base/src/main/java/com/iplatform/base/cache/RedisUserOnlineProvider.java | 169 iplatform-file-server/src/main/java/com/iplatform/file/support/DefaultFileSystemEngine.java | 34 iplatform-base/src/main/java/com/iplatform/base/util/ConfigFormValidateUtils.java | 83 iplatform-base/src/main/java/com/iplatform/base/support/DatabaseArgumentsManager.java | 116 consum-base/src/main/java/com/consum/base/pojo/response/FormProcureVO.java | 4 consum-base/src/main/java/com/consum/base/pojo/response/UseInfo.java | 4 iplatform-base/src/main/resources/images/jigsaw_bg/16.jpg | 0 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_code.java | 243 iplatform-base/src/main/java/com/iplatform/base/support/CtomsDataSource.java | 167 iplatform-base-security-consum/src/main/java/com/iplatform/security/DefaultSecuritySpi.java | 2 iplatform-base/src/main/java/com/iplatform/base/PushController.java | 106 iplatform-model-pojo/src/main/java/com/iplatform/model/po/TcpEquip_mapper.java | 365 iplatform-file-server/src/main/java/com/iplatform/file/util/FileResultUtils.java | 32 iplatform-model-pojo/src/main/java/com/iplatform/model/vo/WeChatAccessTokenVo.java | 63 iplatform-base/src/main/java/com/iplatform/base/PlatformUserCallback.java | 34 iplatform-base/src/main/java/com/iplatform/base/service/CommonServiceImpl.java | 13 iplatform-base/src/main/resources/images/jigsaw_bg/7.jpg | 0 iplatform-base/src/main/java/com/iplatform/base/service/DeptServiceImpl.java | 105 consum-base/src/main/java/com/consum/base/pojo/request/FormInventoryParam.java | 14 iplatform-base-tcp/src/main/resources/application-line-dev.yml | 480 iplatform-base/src/main/java/com/iplatform/base/util/menu/MenuTree.java | 67 consum-base/src/main/java/com/consum/base/controller/FinDepartLedgerController.java | 7 iplatform-base/src/main/java/com/iplatform/base/push/DefaultPushListener.java | 184 consum-base/src/main/java/com/consum/base/controller/UsingFormBackController.java | 14 iplatform-base/src/main/java/com/iplatform/base/cache/RedisUserLoginCache.java | 44 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dict_data.java | 353 iplatform-model-pojo/src/main/java/com/iplatform/model/po/SfNotification.java | 326 iplatform-base/src/main/java/com/iplatform/base/ThirdPartyManager.java | 57 iplatform-base/src/main/java/com/iplatform/base/util/MenuUtils.java | 272 consum-base/src/main/java/com/consum/base/pojo/DepFormScrappedModelParam.java | 24 iplatform-model-pojo/pom.xml | 73 iplatform-base-tcp/src/main/resources/wk_sn_lic.bin | 2 iplatform-base/src/main/java/com/iplatform/base/util/ArgumentsManagerUtils.java | 40 iplatform-base/src/main/java/com/iplatform/base/captcha/ThirdPartyCaptchaProvider.java | 16 iplatform-base/src/main/java/com/iplatform/base/cache/FormCacheProvider.java | 135 iplatform-base/src/main/java/com/iplatform/base/callback/AfterLoginCallback.java | 42 iplatform-base-security-consum/src/main/java/com/iplatform/security/JwtAuthenticationTokenFilter.java | 8 iplatform-base-security-consum/src/main/java/com/iplatform/security/DefaultAuthenticationSuccessHandler.java | 7 iplatform-file-server/src/main/java/com/iplatform/file/support/DefaultFtpFileEngine.java | 39 iplatform-core/src/main/java/com/iplatform/core/config/BasicConfig.java | 33 iplatform-base-admin/src/main/java/com/iplatform/base/config/SwaggerConfig.java | 70 iplatform-base/src/main/resources/images/jigsaw_block/2.png | 0 iplatform-base-tcp/src/main/java/com/iplatform/tcp/lb/SendStatusCallback.java | 26 iplatform-base/src/main/java/com/iplatform/base/cache/RedisWechatCache.java | 66 iplatform-file-server/src/main/java/com/iplatform/file/service/FileServiceImpl.java | 72 iplatform-base-tcp/src/main/java/com/iplatform/tcp/TcpBaseController.java | 6 iplatform-base/src/main/java/com/iplatform/base/config/DatabaseMetaConfig.java | 43 iplatform-base-tcp/src/main/java/com/iplatform/tcp/support/PersistentConnectionManager.java | 133 iplatform-base/src/main/resources/images/jigsaw_block/22.png | 0 admin-web/public/static/config.js | 8 iplatform-base/src/main/java/com/iplatform/base/di/JdbcExcelDataImportor.java | 183 iplatform-base/src/main/java/com/iplatform/base/support/LoadBalanceFileOperateSpi.java | 103 iplatform-base/src/main/java/com/iplatform/base/controller/IndexController.java | 14 iplatform-base-admin/src/main/java/com/iplatform/base/controller/RoleController.java | 189 iplatform-base/src/main/resources/images/jigsaw/original/5.png | 0 iplatform-base-tcp/src/test/java/com/ctoms/tcp/WebsocketDemo.java | 22 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_user_login_mapper.java | 279 iplatform-base/src/main/resources/images/jigsaw_block/16.png | 0 consum-base/src/main/java/com/consum/base/service/LGoodsUserRecordCoreService.java | 3 iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_config_form.java | 200 iplatform-base/src/main/java/com/iplatform/base/cache/LocalWechatCache.java | 63 iplatform-base/src/main/java/com/iplatform/base/captcha/JigsawResult.java | 48 iplatform-core/src/main/java/com/iplatform/core/workflow/Constants.java | 92 iplatform-base/src/main/java/com/iplatform/base/util/ResponseValueUtils.java | 15 iplatform-base/src/main/java/com/iplatform/base/util/VerifyImgUtil.java | 209 iplatform-base/src/main/java/com/iplatform/base/captcha/JigsawCaptchaProvider.java | 101 iplatform-base/src/main/java/com/iplatform/base/support/NothingSecuritySpi.java | 65 iplatform-file-server/pom.xml | 40 consum-base/src/main/java/com/consum/base/aop/DictDataAop.java | 3 iplatform-base/src/main/java/com/iplatform/base/push/SystemPush.java | 45 iplatform-base-security-consum/src/main/java/com/iplatform/security/DefaultAuthenticationFilter.java | 5 iplatform-file-server/src/main/java/com/iplatform/file/FileEngineFactory.java | 301 consum-base/src/main/java/com/consum/base/controller/LWhGoodsStatisticsController.java | 8 iplatform-base/src/main/java/com/iplatform/base/service/LogServiceImpl.java | 112 iplatform-base/src/main/java/com/iplatform/base/AbstractFileOperateSpiController.java | 339 iplatform-base/src/main/java/com/iplatform/base/pojo/form/RequestForm.java | 54 593 files changed, 56,201 insertions(+), 1,031 deletions(-) diff --git a/admin-web/public/static/config.js b/admin-web/public/static/config.js index 3e156e6..c927d1d 100644 --- a/admin-web/public/static/config.js +++ b/admin-web/public/static/config.js @@ -9,8 +9,8 @@ // 鎺ュ彛璇锋眰鍦板潃 - // ftpUrl: 'http://172.16.20.9:8083/lowConsum',//寮�鍙� - // apiBaseURL: 'http://172.16.20.9:8083/lowConsum',//寮�鍙� + ftpUrl: 'http://127.0.0.1:8083/lowConsum',//寮�鍙� + apiBaseURL: 'http://127.0.0.1:8083/lowConsum',//寮�鍙� // apiBaseURL: 'http://172.16.60.110:8083/lowConsum',//寮�鍙� @@ -20,8 +20,8 @@ // apiBaseURL: protocol + '//'+ host + '/lowapi',// 姝e紡, - ftpUrl: protocol + '//'+ host + '/lowapi',// 姝e紡, - apiBaseURL: protocol + '//'+ host + '/lowapi',// 姝e紡, + // ftpUrl: protocol + '//'+ host + '/lowapi',// 姝e紡, + // apiBaseURL: protocol + '//'+ host + '/lowapi',// 姝e紡, debug: false //璋冭瘯寮�鍏� true鏃朵細杈撳嚭璇锋眰鏃ュ織 }; diff --git a/admin-web/src/api/foudation/material.js b/admin-web/src/api/foudation/material.js index 33ca53c..2a287d7 100644 --- a/admin-web/src/api/foudation/material.js +++ b/admin-web/src/api/foudation/material.js @@ -37,10 +37,11 @@ /* * 鐗╁搧璇︽儏 * */ -export function goodsDetail(data) { +export function goodsDetail(params) { return request({ - url: `/pc/base/goods/template/detail/?id=${data}`, + url: `/pc/base/goods/template/detail`, method: 'get', + params }) } diff --git a/admin-web/src/views/foundation/material/edit.vue b/admin-web/src/views/foundation/material/edit.vue index 7ea95fd..be3049c 100644 --- a/admin-web/src/views/foundation/material/edit.vue +++ b/admin-web/src/views/foundation/material/edit.vue @@ -107,7 +107,7 @@ }, async created() { if (this.setting.id) { - await goodsDetail(this.setting.id).then(res => { + await goodsDetail({'id': this.setting.id}).then(res => { this.formData = res if (!this.formData.agencyId) { this.formData.agencyId = this.userInfo.tenantId diff --git a/consum-base/pom.xml b/consum-base/pom.xml index 8c0f307..433e057 100644 --- a/consum-base/pom.xml +++ b/consum-base/pom.xml @@ -29,7 +29,22 @@ <artifactId>snakeyaml</artifactId> <groupId>org.yaml</groupId> </exclusion> + <exclusion> + <artifactId>jjwt</artifactId> + <groupId>io.jsonwebtoken</groupId> + </exclusion> </exclusions> + </dependency> + <dependency> + <groupId>io.jsonwebtoken</groupId> + <artifactId>jjwt</artifactId> + <version>0.12.6</version> + </dependency> + <!-- EasyExcel 鏍稿績搴� --> + <dependency> + <groupId>com.alibaba</groupId> + <artifactId>easyexcel</artifactId> + <version>3.2.1</version> </dependency> <dependency> <groupId>org.yaml</groupId> @@ -38,8 +53,9 @@ </dependency> <!-- 寮曞叆web瀹夊叏璁よ瘉妯″潡锛屽鏋滀笉寮曞叆鍒欎笉浼氬仛浠讳綍鏉冮檺鎷︽埅锛堣繖绉嶆ā寮忛�氬父鍙敤浜庡揩閫熸祴璇曪級, 2022/10/31 --> <dependency> - <groupId>com.iplatform</groupId> + <groupId>com.consum</groupId> <artifactId>iplatform-base-security-consum</artifactId> + <version>3.2.0</version> <exclusions> <exclusion> <artifactId>spring-security-crypto</artifactId> @@ -63,7 +79,7 @@ <dependency> <artifactId>spring-security-crypto</artifactId> <groupId>org.springframework.security</groupId> - <version>5.7.12</version> + <version>6.2.7</version> </dependency> <dependency> <artifactId>spring-security-core</artifactId> @@ -74,7 +90,6 @@ </exclusion> </exclusions> <groupId>org.springframework.security</groupId> - <version>5.7.12</version> </dependency> <dependency> <artifactId>spring-security-config</artifactId> @@ -85,7 +100,7 @@ </exclusion> </exclusions> <groupId>org.springframework.security</groupId> - <version>5.7.12</version> + <version>6.2.7</version> </dependency> <dependency> <artifactId>spring-security-web</artifactId> @@ -96,7 +111,7 @@ </exclusion> </exclusions> <groupId>org.springframework.security</groupId> - <version>5.7.12</version> + <version>6.2.7</version> </dependency> <!-- 绯荤粺鍩虹妯″潡鐣岄潰绠$悊鎺у埗妯″潡锛屽鏋滀笉寮曞叆涔熶笉浼氭湁swagger鏂囨。鍔熻兘!锛�2023/03/05 --> @@ -115,7 +130,9 @@ <dependency> <groupId>com.walkersoft</groupId> <artifactId>walker-support-redis</artifactId> - <optional>true</optional> + <version>3.2.0</version> + <systemPath>${project.basedir}/src/main/resources/lib/walker-support-redis-3.2.0.jar</systemPath> + <scope>system</scope> <exclusions> <exclusion> <groupId>com.walkersoft</groupId> diff --git a/consum-base/src/main/java/com/consum/base/aop/DictDataAop.java b/consum-base/src/main/java/com/consum/base/aop/DictDataAop.java index fd89f8c..bae8fc5 100644 --- a/consum-base/src/main/java/com/consum/base/aop/DictDataAop.java +++ b/consum-base/src/main/java/com/consum/base/aop/DictDataAop.java @@ -1,6 +1,7 @@ package com.consum.base.aop; import cn.hutool.core.util.ReflectUtil; +import com.consum.base.core.utils.IdUtil; import com.iplatform.base.cache.DictCacheProvider; import com.iplatform.core.BeanContextAware; import com.iplatform.model.po.S_dict_data; @@ -54,7 +55,7 @@ try { S_dict_data dictData = (S_dict_data) args[0]; if (dictData.getDict_code() == null) { - dictData.setDict_code(NumberGenerator.getLongSequenceNumber()); + dictData.setDict_code(IdUtil.generateId()); } } catch (Exception e) { e.getMessage(); diff --git a/consum-base/src/main/java/com/consum/base/controller/BaseCategoryController.java b/consum-base/src/main/java/com/consum/base/controller/BaseCategoryController.java index a2ea411..b38cc57 100644 --- a/consum-base/src/main/java/com/consum/base/controller/BaseCategoryController.java +++ b/consum-base/src/main/java/com/consum/base/controller/BaseCategoryController.java @@ -29,7 +29,6 @@ import com.walker.db.page.GenericPager; import com.walker.infrastructure.utils.StringUtils; import com.walker.web.ResponseValue; -import io.swagger.annotations.Api; import org.springframework.web.multipart.MultipartFile; /** @@ -37,7 +36,7 @@ * @Author 鍗㈠簡闃� * @Date 2023/10/23 */ -@Api(value = "鐗╁搧鍒嗙被", tags = "鐗╁搧鍒嗙被") +// @Api(value = "鐗╁搧鍒嗙被", tags = "鐗╁搧鍒嗙被") @RestController @RequestMapping("/pc/base/category") public class BaseCategoryController extends BaseController { diff --git a/consum-base/src/main/java/com/consum/base/controller/BaseGoodsModelsController.java b/consum-base/src/main/java/com/consum/base/controller/BaseGoodsModelsController.java index 099c6a2..a4f9263 100644 --- a/consum-base/src/main/java/com/consum/base/controller/BaseGoodsModelsController.java +++ b/consum-base/src/main/java/com/consum/base/controller/BaseGoodsModelsController.java @@ -18,14 +18,12 @@ import com.walker.infrastructure.utils.StringUtils; import com.walker.web.ResponseValue; -import io.swagger.annotations.Api; - /** * @Description 瑙勬牸鍨嬪彿 * @Author 鍗㈠簡闃� * @Date 2023/10/25 */ -@Api(value = "瑙勬牸鍨嬪彿", tags = "瑙勬牸鍨嬪彿") +// @Api(value = "瑙勬牸鍨嬪彿", tags = "瑙勬牸鍨嬪彿") @RestController @RequestMapping("/pc/base/goods/models") public class BaseGoodsModelsController extends BaseController { @@ -82,7 +80,7 @@ /** * 淇敼鐘舵�� - * + * * @author 鍗㈠簡闃� * @date 2023/10/25 */ diff --git a/consum-base/src/main/java/com/consum/base/controller/BaseGoodsTemplateController.java b/consum-base/src/main/java/com/consum/base/controller/BaseGoodsTemplateController.java index dc5f66b..98ba61f 100644 --- a/consum-base/src/main/java/com/consum/base/controller/BaseGoodsTemplateController.java +++ b/consum-base/src/main/java/com/consum/base/controller/BaseGoodsTemplateController.java @@ -43,17 +43,12 @@ import com.walker.infrastructure.utils.StringUtils; import com.walker.web.ResponseValue; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; - /** * @Description 鐗╁搧妯℃澘 * @Author 鍗㈠簡闃� * @Date 2023/10/24 */ -@Api(value = "鐗╁搧妯℃澘", tags = "鐗╁搧妯℃澘") +// @Api(value = "鐗╁搧妯℃澘", tags = "鐗╁搧妯℃澘") @RestController @RequestMapping("/pc/base/goods/template") public class BaseGoodsTemplateController extends BaseController { @@ -272,12 +267,12 @@ return ResponseValue.success("鏌ヨ鎴愬姛!", list); } - @ApiOperation(value = "璋冩嫧鏌ヨ鏈烘瀯涓嬫墍鏈変粨搴撲笅鐨勫垎绫绘ā鏉夸俊鎭�", notes = "璋冩嫧鏌ヨ鏈烘瀯涓嬫墍鏈変粨搴撲笅鐨勫垎绫绘ā鏉夸俊鎭�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "agencyId", value = "鐖剁骇鏈烘瀯id", required = true, dataType = "java.lang.Long", - paramType = "query"), - @ApiImplicitParam(name = "categoryId", value = "鍒嗙被id", required = true, dataType = "Long", - paramType = "query")}) +// // @ApiOperation(value = "璋冩嫧鏌ヨ鏈烘瀯涓嬫墍鏈変粨搴撲笅鐨勫垎绫绘ā鏉夸俊鎭�", notes = "璋冩嫧鏌ヨ鏈烘瀯涓嬫墍鏈変粨搴撲笅鐨勫垎绫绘ā鏉夸俊鎭�") +// @ApiImplicitParams({ +// @ApiImplicitParam(name = "agencyId", value = "鐖剁骇鏈烘瀯id", required = true, dataType = "java.lang.Long", +// paramType = "query"), +// @ApiImplicitParam(name = "categoryId", value = "鍒嗙被id", required = true, dataType = "Long", +// paramType = "query")}) @GetMapping("/query/warehouse/goods") public ResponseValue queryWarehouseGoods(Long agencyId, Long categoryId) { diff --git a/consum-base/src/main/java/com/consum/base/controller/BaseWarehouseController.java b/consum-base/src/main/java/com/consum/base/controller/BaseWarehouseController.java index 127a948..5802deb 100644 --- a/consum-base/src/main/java/com/consum/base/controller/BaseWarehouseController.java +++ b/consum-base/src/main/java/com/consum/base/controller/BaseWarehouseController.java @@ -30,17 +30,12 @@ import com.walker.infrastructure.utils.StringUtils; import com.walker.web.ResponseValue; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; - /** * @Description 浠撳簱绠$悊 * @Author 鍗㈠簡闃� * @Date 2023/10/26 */ -@Api(value = "浠撳簱绠$悊", tags = "浠撳簱绠$悊") +// @Api(value = "浠撳簱绠$悊", tags = "浠撳簱绠$悊") @RestController @RequestMapping("/pc/base/warehouse") @Slf4j @@ -253,9 +248,9 @@ return ResponseValue.success("鏌ヨ鎴愬姛!", list); } - @ApiOperation(value = "鏍规嵁浠撳簱id鍜屽瀷鍙穒d 鏌ヨ搴撳瓨", notes = "鏍规嵁浠撳簱id鍜屽瀷鍙穒d 鏌ヨ搴撳瓨") - @ApiImplicitParams({@ApiImplicitParam(name = "warehouseQry", value = "浠撳簱id鍜屽瀷鍙穒d", required = true, - dataType = "WarehouseQry", paramType = "query")}) +// // @ApiOperation(value = "鏍规嵁浠撳簱id鍜屽瀷鍙穒d 鏌ヨ搴撳瓨", notes = "鏍规嵁浠撳簱id鍜屽瀷鍙穒d 鏌ヨ搴撳瓨") +// @ApiImplicitParams({@ApiImplicitParam(name = "warehouseQry", value = "浠撳簱id鍜屽瀷鍙穒d", required = true, +// dataType = "WarehouseQry", paramType = "query")}) @GetMapping("/select/number") public ResponseValue selectNumber() { WarehouseQry warehouseQry = CommonUtil.getObjFromReq(WarehouseQry.class); @@ -279,9 +274,9 @@ return ResponseValue.success(num); } - @ApiOperation(value = "鏍规嵁浠撳簱id鍜屽瀷鍙穒d 鏌ヨ搴撳瓨", notes = "鏍规嵁浠撳簱id鍜屽瀷鍙穒d 鏌ヨ搴撳瓨") - @ApiImplicitParams({@ApiImplicitParam(name = "warehouseQry", value = "浠撳簱id鍜屽瀷鍙穒d", required = true, - dataType = "WarehouseQry", paramType = "query")}) +// // @ApiOperation(value = "鏍规嵁浠撳簱id鍜屽瀷鍙穒d 鏌ヨ搴撳瓨", notes = "鏍规嵁浠撳簱id鍜屽瀷鍙穒d 鏌ヨ搴撳瓨") +// @ApiImplicitParams({@ApiImplicitParam(name = "warehouseQry", value = "浠撳簱id鍜屽瀷鍙穒d", required = true, +// dataType = "WarehouseQry", paramType = "query")}) @GetMapping("/select/in/warehouse/num") public ResponseValue selectAllNumber() { WarehouseQry warehouseQry = CommonUtil.getObjFromReq(WarehouseQry.class); diff --git a/consum-base/src/main/java/com/consum/base/controller/BaseWarehouseManagerController.java b/consum-base/src/main/java/com/consum/base/controller/BaseWarehouseManagerController.java index 8eb34a3..4904f1e 100644 --- a/consum-base/src/main/java/com/consum/base/controller/BaseWarehouseManagerController.java +++ b/consum-base/src/main/java/com/consum/base/controller/BaseWarehouseManagerController.java @@ -17,10 +17,6 @@ import com.consum.base.core.utils.CommonUtil; import com.consum.base.pojo.request.WarehouseManagerParam; import com.walker.web.ResponseValue; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; /** * @Description 搴撶鍛� @@ -28,7 +24,7 @@ * @Date 2023/10/26 * <p> */ -@Api(value = "搴撶鍛�", tags = "搴撶鍛�") +// @Api(value = "搴撶鍛�", tags = "搴撶鍛�") @RestController @RequestMapping("/pc/base/warehouse/manager") @Slf4j @@ -48,9 +44,9 @@ * @Author 鍗㈠簡闃� * @Date 2023/10/26 */ - @ApiOperation(value = "鏂板", notes = "鏂板") - @ApiImplicitParam(name = "warehouseManagerParam", value = "搴撶鍛樹俊鎭�", required = true, - dataType = "WarehouseManagerParam", paramType = "body") +// // @ApiOperation(value = "鏂板", notes = "鏂板") +// @ApiImplicitParam(name = "warehouseManagerParam", value = "搴撶鍛樹俊鎭�", required = true, +// dataType = "WarehouseManagerParam", paramType = "body") @PostMapping("/save") public ResponseValue add() throws Exception { WarehouseManagerParam param = CommonUtil.getObjFromReqBody(WarehouseManagerParam.class); @@ -447,8 +443,8 @@ } - @ApiOperation(value = "鏍规嵁浠撳簱id鏌ヨ搴撶鍛�", notes = "鏍规嵁浠撳簱id鏌ヨ搴撶鍛�") - @ApiImplicitParam(name = "warehouseId", value = "浠撳簱id", required = true, dataType = "Long") +// // @ApiOperation(value = "鏍规嵁浠撳簱id鏌ヨ搴撶鍛�", notes = "鏍规嵁浠撳簱id鏌ヨ搴撶鍛�") +// @ApiImplicitParam(name = "warehouseId", value = "浠撳簱id", required = true, dataType = "Long") @GetMapping("/list") public ResponseValue select(Long warehouseId) { List<BaseWarehouseManager> baseWarehouseManagerList = @@ -456,9 +452,9 @@ return ResponseValue.success(baseWarehouseManagerList); } - @ApiOperation(value = "鏍规嵁浠撳簱,鏈烘瀯id鏌ヨ搴撶鍛�", notes = "鏍规嵁浠撳簱,鏈烘瀯id鏌ヨ搴撶鍛�") - @ApiImplicitParams({@ApiImplicitParam(name = "warehouseId", value = "浠撳簱id", required = true, dataType = "Long"), - @ApiImplicitParam(name = "agencyId", value = "鏈烘瀯id", required = true, dataType = "Long")}) +// // @ApiOperation(value = "鏍规嵁浠撳簱,鏈烘瀯id鏌ヨ搴撶鍛�", notes = "鏍规嵁浠撳簱,鏈烘瀯id鏌ヨ搴撶鍛�") +// @ApiImplicitParams({@ApiImplicitParam(name = "warehouseId", value = "浠撳簱id", required = true, dataType = "Long"), +// @ApiImplicitParam(name = "agencyId", value = "鏈烘瀯id", required = true, dataType = "Long")}) @GetMapping("/query") public ResponseValue selectManagerList(Long warehouseId, Long agencyId) { List<BaseWarehouseManager> baseWarehouseManagerList = diff --git a/consum-base/src/main/java/com/consum/base/controller/DepFormScrappedController.java b/consum-base/src/main/java/com/consum/base/controller/DepFormScrappedController.java index fbb78f4..f866c33 100644 --- a/consum-base/src/main/java/com/consum/base/controller/DepFormScrappedController.java +++ b/consum-base/src/main/java/com/consum/base/controller/DepFormScrappedController.java @@ -1,15 +1,12 @@ package com.consum.base.controller; -import java.io.OutputStream; -import java.net.URLEncoder; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; - +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletResponse; import org.apache.poi.ss.usermodel.Workbook; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -32,10 +29,6 @@ import cn.afterturn.easypoi.excel.entity.TemplateExportParams; import cn.hutool.core.convert.Convert; import cn.hutool.core.util.ReflectUtil; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; /** * @ClassName DepFormScrappedController @@ -44,14 +37,14 @@ * @Description * @Version 1.0 **/ -@Api(value = "閮ㄩ棬鎶ュ簾", tags = "閮ㄩ棬鎶ュ簾") +// @Api(value = "閮ㄩ棬鎶ュ簾", tags = "閮ㄩ棬鎶ュ簾") @RestController @RequestMapping("/pc/l/wh/form/scrapped") public class DepFormScrappedController extends BaseController { @Resource private DepFormScrappedService depFormScrappedService; - @ApiOperation(value = "鏂板鎶ュ簾鍗�", notes = "鏂板鎶ュ簾鍗�") + // @ApiOperation(value = "鏂板鎶ュ簾鍗�", notes = "鏂板鎶ュ簾鍗�") @PostMapping("/deptAdd") public ResponseValue deptAdd() throws Exception { LDeptFormScrappedParam param = CommonUtil.getObjFromReqBody(LDeptFormScrappedParam.class); @@ -69,9 +62,9 @@ * @Description 鍒楄〃鏌ヨ 1.鏌ヨ鎶ュ簾鍗� 2.鏌ヨ鎶ュ簾鍗曠墿鍝� * @Date */ - @ApiOperation(value = "鍒楄〃鏌ヨ", notes = "鍒楄〃鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "param", value = "鏌ヨ鏉′欢", dataType = "LWhFormScrappedQry", paramType = "query")}) + // @ApiOperation(value = "鍒楄〃鏌ヨ", notes = "鍒楄〃鏌ヨ") +// @ApiImplicitParams({ +// @ApiImplicitParam(name = "param", value = "鏌ヨ鏉′欢", dataType = "LWhFormScrappedQry", paramType = "query")}) @GetMapping("/deptList") public ResponseValue queryList() { LDeptFormScrappedQry param = CommonUtil.getObjFromReq(LDeptFormScrappedQry.class); @@ -133,8 +126,8 @@ /** * @Description 鏍规嵁id鏌ヨ璇︽儏 */ - @ApiOperation(value = "鏍规嵁id鏌ヨ璇︽儏", notes = "鏍规嵁id鏌ヨ璇︽儏") - @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "鎶ュ簾鍗昳d", dataType = "Long", paramType = "query")}) + // @ApiOperation(value = "鏍规嵁id鏌ヨ璇︽儏", notes = "鏍规嵁id鏌ヨ璇︽儏") + // @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "鎶ュ簾鍗昳d", dataType = "Long", paramType = "query")}) @GetMapping("/deptDetail") public ResponseValue getById(Long id) { if (id == null) { @@ -143,8 +136,8 @@ return ResponseValue.success(this.depFormScrappedService.getById(id)); } - @ApiOperation(value = "瀵煎嚭鎶ュ簾鍗�", notes = "瀵煎嚭鎶ュ簾鍗�") - @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "鎶ュ簾鍗昳d", dataType = "Long", paramType = "query")}) + // @ApiOperation(value = "瀵煎嚭鎶ュ簾鍗�", notes = "瀵煎嚭鎶ュ簾鍗�") + // @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "鎶ュ簾鍗昳d", dataType = "Long", paramType = "query")}) @GetMapping("/deptList/export") public ResponseValue<String> export(Long id, HttpServletResponse response) throws Exception { if (id == null) { diff --git a/consum-base/src/main/java/com/consum/base/controller/FinDepartLedgerController.java b/consum-base/src/main/java/com/consum/base/controller/FinDepartLedgerController.java index 69dbf3f..5258e6a 100644 --- a/consum-base/src/main/java/com/consum/base/controller/FinDepartLedgerController.java +++ b/consum-base/src/main/java/com/consum/base/controller/FinDepartLedgerController.java @@ -10,15 +10,14 @@ import com.iplatform.model.po.S_user_core; import com.walker.db.page.GenericPager; import com.walker.web.ResponseValue; -import io.swagger.annotations.Api; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletResponse; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.springframework.core.io.ClassPathResource; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; import java.io.InputStream; import java.io.OutputStream; import java.net.URLEncoder; @@ -29,7 +28,7 @@ /** * 閮ㄩ棬鍙拌处 */ -@Api(value = "閮ㄩ棬鍙拌处", tags = "閮ㄩ棬鍙拌处") +// @Api(value = "閮ㄩ棬鍙拌处", tags = "閮ㄩ棬鍙拌处") @RestController @RequestMapping("/pc/fin/warehouse/departLedger") public class FinDepartLedgerController extends BaseController { diff --git a/consum-base/src/main/java/com/consum/base/controller/FinFileController.java b/consum-base/src/main/java/com/consum/base/controller/FinFileController.java index d003b80..55b01c0 100644 --- a/consum-base/src/main/java/com/consum/base/controller/FinFileController.java +++ b/consum-base/src/main/java/com/consum/base/controller/FinFileController.java @@ -3,11 +3,11 @@ import com.consum.base.BaseController; import com.consum.base.service.FinFileService; import com.consum.model.po.FinFile; +import com.iplatform.base.IdUtil; import com.walker.file.FileInfo; import com.walker.infrastructure.utils.DateUtils; import com.walker.infrastructure.utils.NumberGenerator; import com.walker.web.ResponseValue; -import io.swagger.annotations.Api; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -20,7 +20,7 @@ * @Author wh * @Date 2023/8/1 10:33 */ -@Api(value = "鏂囦欢涓婁紶", tags = "鏂囦欢涓婁紶") +// @Api(value = "鏂囦欢涓婁紶", tags = "鏂囦欢涓婁紶") @RestController @RequestMapping("/pc/fin/file") public class FinFileController extends BaseController { @@ -44,7 +44,7 @@ } if (fileInfo != null) { FinFile finFile = new FinFile(); - finFile.setId(NumberGenerator.getLongSequenceNumberNano()); + finFile.setId(IdUtil.generateId()); finFile.setCreateTime(DateUtils.getDateTimeNumber(System.currentTimeMillis())); finFile.setUserName("-1"); finFile.setContentType(finFile.getContentType()); @@ -75,7 +75,7 @@ for (int i = 0; i < uploadfs.length; i++) { FileInfo fileInfo = uploadfs[i]; FinFile finFile = new FinFile(); - finFile.setId(NumberGenerator.getLongSequenceNumberNano()); + finFile.setId(IdUtil.generateId()); finFile.setCreateTime(DateUtils.getDateTimeNumber(System.currentTimeMillis())); finFile.setUserName("-1"); finFile.setContentType(finFile.getContentType()); diff --git a/consum-base/src/main/java/com/consum/base/controller/FinSysServerController.java b/consum-base/src/main/java/com/consum/base/controller/FinSysServerController.java index e40e043..35b1657 100644 --- a/consum-base/src/main/java/com/consum/base/controller/FinSysServerController.java +++ b/consum-base/src/main/java/com/consum/base/controller/FinSysServerController.java @@ -2,6 +2,7 @@ import java.util.List; +import com.consum.base.core.utils.IdUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; @@ -21,9 +22,9 @@ import com.walker.infrastructure.utils.NumberGenerator; import com.walker.web.ResponseValue; -import io.swagger.annotations.Api; +// -@Api(value = "绯荤粺鏈嶅姟淇℃伅", tags = "绯荤粺鏈嶅姟淇℃伅") +// @Api(value = "绯荤粺鏈嶅姟淇℃伅", tags = "绯荤粺鏈嶅姟淇℃伅") @RestController @RequestMapping("/pc/fin/sys/server") public class FinSysServerController extends BaseController { @@ -104,7 +105,7 @@ if (param == null) { return ResponseValue.error("鍙傛暟涓虹┖"); } - param.setId(NumberGenerator.getLongSequenceNumber()); + param.setId(IdUtil.generateId()); param.setCreatedTime(DateUtils.getDateTimeNumber(System.currentTimeMillis())); param.setCreatedBy(this.getCurrentUser().getUser_name()); param.setLv(param.getParentId() + 1); diff --git a/consum-base/src/main/java/com/consum/base/controller/FinSysTenantController.java b/consum-base/src/main/java/com/consum/base/controller/FinSysTenantController.java index 0607533..ec416fa 100644 --- a/consum-base/src/main/java/com/consum/base/controller/FinSysTenantController.java +++ b/consum-base/src/main/java/com/consum/base/controller/FinSysTenantController.java @@ -12,6 +12,7 @@ import java.util.Objects; import java.util.TreeMap; +import cn.hutool.core.convert.Convert; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.core.io.ClassPathResource; @@ -49,17 +50,12 @@ import com.walker.infrastructure.utils.StringUtils; import com.walker.web.ResponseValue; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; - /** * @Description 鏈烘瀯 * @Author wh * @Date 2023/7/13 19:51 */ -@Api(value = "鏈烘瀯绠$悊", tags = "鏈烘瀯绠$悊") +// @Api(value = "鏈烘瀯绠$悊", tags = "鏈烘瀯绠$悊") @RestController @RequestMapping("/pc/fin/sys/tenant") public class FinSysTenantController extends BaseController { @@ -102,9 +98,9 @@ // 鑾峰彇褰撳墠鐢ㄦ埛淇℃伅 String tenantId = user.getTenantId(); FinSysTenant finSysTenant = new FinSysTenant(); - finSysTenant.setId(new Long(tenantId)); + finSysTenant.setId(Convert.toLong(tenantId)); // 涓婚敭鏄疶empId - finSysTenant.setTempId(new Long(tenantId)); + finSysTenant.setTempId(Convert.toLong(tenantId)); // 鏌ヨ褰撳墠鐢ㄦ埛鐨勬満鏋� FinSysTenant userTenant = finSysTenantService.get(finSysTenant); // 鏍戝垪琛� @@ -113,7 +109,7 @@ if (userTenant.getLv() != 1 && userTenant.getParentId() != 0) { rootMap.clear(); this.childMap.clear(); - this.defaultParentId = new Long(user.getTenantId()); + this.defaultParentId = Convert.toLong(user.getTenantId()); // 鏍规嵁鐖剁骇鑾峰彇瀛愰泦 setEntityList(finSysTenantList); treeRootList = getTreeRootList(); @@ -635,9 +631,7 @@ return ResponseValue.success(finSysTenantUserResults); } - @ApiOperation(value = "鑾峰彇鐖剁骇鏈烘瀯", notes = "鑾峰彇鐖剁骇鏈烘瀯") - @ApiImplicitParams({ - @ApiImplicitParam(name = "Authorization", value = "token", dataType = "String", paramType = "header"),}) + // @ApiOperation(value = "鑾峰彇鐖剁骇鏈烘瀯", notes = "鑾峰彇鐖剁骇鏈烘瀯") @GetMapping("/get/parent/tenant") public ResponseValue getParentTenant() { FinSysTenantUser sysInfo = getSysInfo(); diff --git a/consum-base/src/main/java/com/consum/base/controller/FinSysTenantDepartmentController.java b/consum-base/src/main/java/com/consum/base/controller/FinSysTenantDepartmentController.java index 1984228..77d3a81 100644 --- a/consum-base/src/main/java/com/consum/base/controller/FinSysTenantDepartmentController.java +++ b/consum-base/src/main/java/com/consum/base/controller/FinSysTenantDepartmentController.java @@ -21,17 +21,12 @@ import com.walker.infrastructure.utils.StringUtils; import com.walker.web.ResponseValue; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; - /** * @Description 閮ㄩ棬绠$悊 * @Author 鍗㈠簡闃� * @Date 2023/10/26 */ -@Api(value = "閮ㄩ棬绠$悊", tags = "閮ㄩ棬绠$悊") +// @Api(value = "閮ㄩ棬绠$悊", tags = "閮ㄩ棬绠$悊") @RestController @RequestMapping("/pc/fin/sys/tenant/department") public class FinSysTenantDepartmentController extends BaseController { @@ -44,9 +39,9 @@ * @Author 鍗㈠簡闃� * @Date 2023/10/26 */ - @ApiOperation(value = "鏂板", notes = "鏂板") - @ApiImplicitParams(value = { - @ApiImplicitParam(name = "param", value = "閮ㄩ棬淇℃伅", required = true, dataType = "FinSysTenantDepartmentParam")}) + // @ApiOperation(value = "鏂板", notes = "鏂板") +// @ApiImplicitParams(value = { +// @ApiImplicitParam(name = "param", value = "閮ㄩ棬淇℃伅", required = true, dataType = "FinSysTenantDepartmentParam")}) @PostMapping("/add") public ResponseValue add() { FinSysTenantDepartmentParam param = CommonUtil.getObjFromReqBody(FinSysTenantDepartmentParam.class); @@ -106,9 +101,9 @@ return ResponseValue.success(pager); } - @ApiOperation(value = "鏍规嵁鏈烘瀯id鏌ヨ鎵�鏈夐儴闂ㄥ垪琛ㄤ俊鎭�", notes = "鏍规嵁鏈烘瀯id鏌ヨ鎵�鏈夐儴闂ㄥ垪琛ㄤ俊鎭�") - @ApiImplicitParams(value = { - @ApiImplicitParam(name = "param", value = "閮ㄩ棬淇℃伅", required = true, dataType = "FinSysTenantDepartmentParam")}) + // @ApiOperation(value = "鏍规嵁鏈烘瀯id鏌ヨ鎵�鏈夐儴闂ㄥ垪琛ㄤ俊鎭�", notes = "鏍规嵁鏈烘瀯id鏌ヨ鎵�鏈夐儴闂ㄥ垪琛ㄤ俊鎭�") +// @ApiImplicitParams(value = { +// @ApiImplicitParam(name = "param", value = "閮ㄩ棬淇℃伅", required = true, dataType = "FinSysTenantDepartmentParam")}) @GetMapping("/list/all") public ResponseValue queryAllDepartment(Long tenantId) { FinSysTenantUser sysInfo = this.getSysInfo(); diff --git a/consum-base/src/main/java/com/consum/base/controller/FinSysTenantUserController.java b/consum-base/src/main/java/com/consum/base/controller/FinSysTenantUserController.java index 647a285..a1a90d9 100644 --- a/consum-base/src/main/java/com/consum/base/controller/FinSysTenantUserController.java +++ b/consum-base/src/main/java/com/consum/base/controller/FinSysTenantUserController.java @@ -13,6 +13,7 @@ import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.TypeReference; +import com.consum.base.core.utils.IdUtil; import lombok.extern.slf4j.Slf4j; import org.apache.commons.compress.utils.Lists; import org.apache.commons.lang3.ObjectUtils; @@ -65,17 +66,12 @@ import com.walker.infrastructure.utils.PhoneNumberUtils; import com.walker.infrastructure.utils.StringUtils; import com.walker.web.ResponseValue; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; /** * @Description 绯荤粺鐢ㄦ埛 * @Author wh * @Date 2023/7/17 14:16 */ -@Api(value = "鏈烘瀯鐢ㄦ埛淇℃伅", tags = "鏈烘瀯鐢ㄦ埛淇℃伅") @RestController @RequestMapping("/pc/fin/sys/tenant/user") @Slf4j @@ -134,9 +130,8 @@ return ResponseValue.success(pager); } - @ApiOperation(value = "鏍规嵁鏈烘瀯id鏌ヨ鐢ㄦ埛", notes = "鏍规嵁鏈烘瀯id鏌ヨ鐢ㄦ埛") - @ApiImplicitParam(name = "tenantId", value = "鏈烘瀯id", required = true, dataType = "Long", paramType = "query") - @GetMapping("/query/user") + // @ApiOperation(value = "鏍规嵁鏈烘瀯id鏌ヨ鐢ㄦ埛", notes = "鏍规嵁鏈烘瀯id鏌ヨ鐢ㄦ埛") + @GetMapping("/query/user") public ResponseValue queryUserByTenantId(Long tenantId) { FinSysTenantUser finSysTenantUser = new FinSysTenantUser(); @@ -438,14 +433,14 @@ private void buildTenantUser(FinSysTenantUser tenantUser, FinSysTenantUser sysInfo) { - tenantUser.setId(NumberGenerator.getLongSequenceNumber()); + tenantUser.setId(IdUtil.generateId()); tenantUser.setCreateTime(DateUtils.getDateTimeNumber(System.currentTimeMillis())); tenantUser.setCreateBy(this.getCurrentUser().getUser_name()); tenantUser.setUpdateTime(DateUtils.getDateTimeNumber(System.currentTimeMillis())); tenantUser.setUpdateBy(this.getCurrentUser().getUser_name()); // 鏄惁鍒犻櫎 0鏄� 1鍚� tenantUser.setIsDelete(0); - tenantUser.setSysUserId(NumberGenerator.getLongSequenceNumber()); + tenantUser.setSysUserId(IdUtil.generateId()); setUserPhone(tenantUser, tenantUser.getUserPhone()); String tenantId = tenantUser.getTenantId(); FinSysTenant finSysTenant = finSysTenantService.selectById(Long.valueOf(tenantId)); @@ -577,14 +572,14 @@ roles.stream().filter(role -> role.getRole_name().equals(data.getRoleName())).findFirst(); user.setRoleList(Arrays.asList(sRole.orElse(new S_role()).getRole_id())); - user.setId(NumberGenerator.getLongSequenceNumber()); + user.setId(IdUtil.generateId()); user.setCreateTime(DateUtils.getDateTimeNumber(System.currentTimeMillis())); user.setCreateBy(currentUser.getUser_name()); user.setUpdateTime(DateUtils.getDateTimeNumber(System.currentTimeMillis())); user.setUpdateBy(currentUser.getUser_name()); user.setStatus(1);// 0绂佺敤 1鍚敤 user.setIsDelete(0);// 鏄惁鍒犻櫎 0鏄� 1鍚� - user.setSysUserId(NumberGenerator.getLongSequenceNumber()); + user.setSysUserId(IdUtil.generateId()); user.setRemark("鎵归噺瀵煎叆"); // 鍔犲瘑鎵嬫満鍙� setUserPhone(user, data.getUserPhone()); @@ -1066,9 +1061,7 @@ return ResponseValue.success(1); } - @ApiOperation(value = "鏍规嵁鏈烘瀯id鏌ヨ閮ㄩ棬涓殑鐢ㄦ埛", notes = "鏍规嵁鏈烘瀯id鏌ヨ閮ㄩ棬涓殑鐢ㄦ埛") - @ApiImplicitParams({ - @ApiImplicitParam(name = "agencyId", value = "鏈烘瀯id", required = true, dataType = "Long", paramType = "query")}) + // @ApiOperation(value = "鏍规嵁鏈烘瀯id鏌ヨ閮ㄩ棬涓殑鐢ㄦ埛", notes = "鏍规嵁鏈烘瀯id鏌ヨ閮ㄩ棬涓殑鐢ㄦ埛") @GetMapping("/select/department") public ResponseValue selectDepartment(Long agencyId, String isFilter) { FinSysTenantVO finSysTenantVO = new FinSysTenantVO(); diff --git a/consum-base/src/main/java/com/consum/base/controller/FinWarehouseLedgerController.java b/consum-base/src/main/java/com/consum/base/controller/FinWarehouseLedgerController.java index 0c353bf..4bf2765 100644 --- a/consum-base/src/main/java/com/consum/base/controller/FinWarehouseLedgerController.java +++ b/consum-base/src/main/java/com/consum/base/controller/FinWarehouseLedgerController.java @@ -10,15 +10,14 @@ import com.iplatform.model.po.S_user_core; import com.walker.db.page.GenericPager; import com.walker.web.ResponseValue; -import io.swagger.annotations.Api; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletResponse; import org.apache.poi.ss.usermodel.Workbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.springframework.core.io.ClassPathResource; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; import java.io.InputStream; import java.io.OutputStream; import java.net.URLEncoder; @@ -34,7 +33,6 @@ * @Description 浠撳簱鍙拌处 * @Version 1.0 **/ -@Api(value = "浠撳簱鍙拌处", tags = "浠撳簱鍙拌处") @RestController @RequestMapping("/pc/fin/warehouse/ledger") public class FinWarehouseLedgerController extends BaseController { diff --git a/consum-base/src/main/java/com/consum/base/controller/LOrgSupplierController.java b/consum-base/src/main/java/com/consum/base/controller/LOrgSupplierController.java index 4f2b81c..267f8eb 100644 --- a/consum-base/src/main/java/com/consum/base/controller/LOrgSupplierController.java +++ b/consum-base/src/main/java/com/consum/base/controller/LOrgSupplierController.java @@ -4,12 +4,10 @@ import com.consum.base.service.LOrgSupplierServiceImpl; import com.iplatform.model.po.S_user_core; import com.walker.web.ResponseValue; -import io.swagger.annotations.Api; +import jakarta.annotation.Resource; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; - -import javax.annotation.Resource; /** * @ClassName LOrgSupplierController @@ -18,7 +16,7 @@ * @Description * @Version 1.0 **/ -@Api(value = "渚涘簲鍟�", tags = "渚涘簲鍟�") +// @Api(value = "渚涘簲鍟�", tags = "渚涘簲鍟�") @RestController @RequestMapping("/pc/orgSupplier") public class LOrgSupplierController extends BaseController { diff --git a/consum-base/src/main/java/com/consum/base/controller/LWarehouseFlowController.java b/consum-base/src/main/java/com/consum/base/controller/LWarehouseFlowController.java index 3d9c761..1b426e5 100644 --- a/consum-base/src/main/java/com/consum/base/controller/LWarehouseFlowController.java +++ b/consum-base/src/main/java/com/consum/base/controller/LWarehouseFlowController.java @@ -4,8 +4,7 @@ import java.util.ArrayList; import java.util.Map; -import javax.annotation.Resource; - +import jakarta.annotation.Resource; import org.apache.commons.compress.utils.Lists; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -23,7 +22,6 @@ import com.walker.web.ResponseValue; import cn.hutool.core.util.ReflectUtil; -import io.swagger.annotations.Api; /** * @ClassName lWarehouseFlowController @@ -31,7 +29,7 @@ * @Description * @Version 1.0 **/ -@Api(value = "浠撳簱娴佹按", tags = "浠撳簱娴佹按") +// @Api(value = "浠撳簱娴佹按", tags = "浠撳簱娴佹按") @RestController @RequestMapping("/pc/warehouse/flow") public class LWarehouseFlowController extends BaseController { diff --git a/consum-base/src/main/java/com/consum/base/controller/LWhFormInventoryController.java b/consum-base/src/main/java/com/consum/base/controller/LWhFormInventoryController.java index 7693076..44e7ae3 100644 --- a/consum-base/src/main/java/com/consum/base/controller/LWhFormInventoryController.java +++ b/consum-base/src/main/java/com/consum/base/controller/LWhFormInventoryController.java @@ -6,8 +6,7 @@ import java.util.Objects; import java.util.Optional; -import javax.servlet.http.HttpServletResponse; - +import jakarta.servlet.http.HttpServletResponse; import org.apache.poi.ss.usermodel.Workbook; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -39,18 +38,13 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.entity.TemplateExportParams; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiResponse; /** * @Description 鐩樼偣 * @Author 鍗㈠簡闃� * @Date 2023/10/23 */ -@Api(value = "鐩樼偣", tags = "鐩樼偣") +// @Api(value = "鐩樼偣", tags = "鐩樼偣") @RestController @RequestMapping("/pc/l/wh/form/inventory") public class LWhFormInventoryController extends BaseController { @@ -65,8 +59,8 @@ * @Author 鍗㈠簡闃� * @Date 2023/10/31 */ - @ApiOperation(value = "鏂板鐩樼偣", notes = "鏂板鐩樼偣") - @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "鐩樼偣鍗曚俊鎭�", dataType = "FormInventoryParam")}) + // @ApiOperation(value = "鏂板鐩樼偣", notes = "鏂板鐩樼偣") + // @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "鐩樼偣鍗曚俊鎭�", dataType = "FormInventoryParam")}) @PostMapping("/add") public ResponseValue add() { @@ -101,9 +95,9 @@ * @Author 鍗㈠簡闃� * @Date 2023/10/31 */ - @ApiOperation(value = "鐩樼偣鍗曞垪琛ㄦ煡璇�", notes = "鐩樼偣鍗曞垪琛ㄦ煡璇�") - @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "鐩樼偣鏉′欢", dataType = "LWhFormInventoryParam", - required = true, paramType = "query")}) + // @ApiOperation(value = "鐩樼偣鍗曞垪琛ㄦ煡璇�", notes = "鐩樼偣鍗曞垪琛ㄦ煡璇�") + // @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "鐩樼偣鏉′欢", dataType = "LWhFormInventoryParam", + // required = true, paramType = "query")}) @GetMapping("/list") public ResponseValue queryList() { LWhFormInventoryQry param = CommonUtil.getObjFromReq(LWhFormInventoryQry.class); @@ -124,9 +118,9 @@ * * @return */ - @ApiOperation(value = "鏌ヨ姝よ处鍙疯鑹诧紝鏄惁鐜板湪杩樺彲浠ュ鍔犵洏鐐逛换鍔�", notes = "鏌ヨ姝よ处鍙疯鑹诧紝鏄惁鐜板湪杩樺彲浠ュ鍔犵洏鐐逛换鍔�") - @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "鐩樼偣鏉′欢", dataType = "LWhFormInventoryParam", - required = true, paramType = "query")}) + // @ApiOperation(value = "鏌ヨ姝よ处鍙疯鑹诧紝鏄惁鐜板湪杩樺彲浠ュ鍔犵洏鐐逛换鍔�", notes = "鏌ヨ姝よ处鍙疯鑹诧紝鏄惁鐜板湪杩樺彲浠ュ鍔犵洏鐐逛换鍔�") +// @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "鐩樼偣鏉′欢", dataType = "LWhFormInventoryParam", +// required = true, paramType = "query")}) @GetMapping("/isAddInventory") public ResponseValue isAddInventory() { LWhFormInventoryQry param = CommonUtil.getObjFromReq(LWhFormInventoryQry.class); @@ -141,10 +135,10 @@ return ResponseValue.success(res); } - @ApiOperation(value = "鐩樼偣鍗曠墿鍝佸垪琛ㄦ煡璇�", notes = "鐩樼偣鍗曠墿鍝佸垪琛ㄦ煡璇�", response = FormInventoryVO.class) - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "鐩樼偣鍗昳d", dataType = "Long", required = true, paramType = "query")}) - @ApiResponse(code = 200, message = "鎴愬姛", response = FormInventoryVO.class) + // @ApiOperation(value = "鐩樼偣鍗曠墿鍝佸垪琛ㄦ煡璇�", notes = "鐩樼偣鍗曠墿鍝佸垪琛ㄦ煡璇�", response = FormInventoryVO.class) +// @ApiImplicitParams({ +// @ApiImplicitParam(name = "id", value = "鐩樼偣鍗昳d", dataType = "Long", required = true, paramType = "query")}) +// @ApiResponse(code = 200, message = "鎴愬姛", response = FormInventoryVO.class) @GetMapping("/query") public ResponseValue queryInventBaseGoodTemplate(Long id) { FinSysTenantUser sysInfo = this.getSysInfo(); @@ -167,8 +161,8 @@ * @Author 鍗㈠簡闃� * @Date 2023/10/31 */ - @ApiOperation(value = "缂栬緫鐩樼偣", notes = "缂栬緫鐩樼偣") - @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "鐩樼偣鍗曚俊鎭�", dataType = "FormInventoryParam")}) + // @ApiOperation(value = "缂栬緫鐩樼偣", notes = "缂栬緫鐩樼偣") + // @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "鐩樼偣鍗曚俊鎭�", dataType = "FormInventoryParam")}) @PostMapping("/edit") public ResponseValue edit() { FormInventoryParam param = CommonUtil.getObjFromReqBody(FormInventoryParam.class); @@ -208,9 +202,9 @@ /** * @Description 鏍规嵁id鍒犻櫎 */ - @ApiOperation(value = "鏍规嵁id鍒犻櫎鐩樼偣", notes = "鏍规嵁id鍒犻櫎鐩樼偣") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "鐩樼偣鍗昳d", dataType = "Long", required = true, paramType = "query")}) + // @ApiOperation(value = "鏍规嵁id鍒犻櫎鐩樼偣", notes = "鏍规嵁id鍒犻櫎鐩樼偣") +// @ApiImplicitParams({ +// @ApiImplicitParam(name = "id", value = "鐩樼偣鍗昳d", dataType = "Long", required = true, paramType = "query")}) @DeleteMapping("/del") public ResponseValue delById(Long id) { if (id == null) { @@ -237,8 +231,8 @@ * @author 鍗㈠簡闃� * @date 2023/10/31 */ - @ApiOperation(value = "鐩樼偣鏆傚瓨", notes = "鐩樼偣鏆傚瓨") - @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "鐩樼偣鍗曚俊鎭�", dataType = "LWhFormInventoryDto")}) + // @ApiOperation(value = "鐩樼偣鏆傚瓨", notes = "鐩樼偣鏆傚瓨") + // @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "鐩樼偣鍗曚俊鎭�", dataType = "LWhFormInventoryDto")}) @PostMapping("/temporary/storage") public ResponseValue updateTemporaryStorage() { LWhFormInventoryParam param = CommonUtil.getObjFromReqBody(LWhFormInventoryParam.class); @@ -260,8 +254,8 @@ * @author 鍗㈠簡闃� * @date 2023/10/31 */ - @ApiOperation(value = "瀹屾垚鐩樼偣", notes = "瀹屾垚鐩樼偣") - @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "鐩樼偣鍗曚俊鎭�", dataType = "LWhFormInventoryDto")}) + // @ApiOperation(value = "瀹屾垚鐩樼偣", notes = "瀹屾垚鐩樼偣") + // @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "鐩樼偣鍗曚俊鎭�", dataType = "LWhFormInventoryDto")}) @PostMapping("/finish") public ResponseValue updateFinishPd() { LWhFormInventoryParam param = CommonUtil.getObjFromReqBody(LWhFormInventoryParam.class); @@ -284,9 +278,9 @@ * @Author 鍗㈠簡闃� * @Date 2023/11/1 */ - @ApiOperation(value = "寮傚父鏄庣粏鍒楄〃鏌ヨ", notes = "寮傚父鏄庣粏鍒楄〃鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "param", value = "鐩樼偣鏉′欢", dataType = "LWhFormInventoryParam", paramType = "query")}) + // @ApiOperation(value = "寮傚父鏄庣粏鍒楄〃鏌ヨ", notes = "寮傚父鏄庣粏鍒楄〃鏌ヨ") +// @ApiImplicitParams({ +// @ApiImplicitParam(name = "param", value = "鐩樼偣鏉′欢", dataType = "LWhFormInventoryParam", paramType = "query")}) @GetMapping("/list/PdDetail") public ResponseValue queryPdDetailList() { LWhFormInventoryQry param = CommonUtil.getObjFromReq(LWhFormInventoryQry.class); @@ -302,9 +296,9 @@ return ResponseValue.success(result); } - @ApiOperation(value = "鏍规嵁id鏌ヨ鐩樼偣鐗╁搧璇︾粏淇℃伅", notes = "鏍规嵁id鏌ヨ鐩樼偣鐗╁搧璇︾粏淇℃伅") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "鐩樼偣id", dataType = "Long", required = true, paramType = "query")}) + // @ApiOperation(value = "鏍规嵁id鏌ヨ鐩樼偣鐗╁搧璇︾粏淇℃伅", notes = "鏍规嵁id鏌ヨ鐩樼偣鐗╁搧璇︾粏淇℃伅") +// @ApiImplicitParams({ +// @ApiImplicitParam(name = "id", value = "鐩樼偣id", dataType = "Long", required = true, paramType = "query")}) @GetMapping("/detail") public ResponseValue selectDetailById(Long id) { FinSysTenantUser sysInfo = this.getSysInfo(); @@ -325,9 +319,9 @@ return ResponseValue.success(formInventoryVO); } - @ApiOperation(value = "鐩樼偣鍗曞鍑�", notes = "鐩樼偣鍗曞鍑�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "鐩樼偣鍗昳d", dataType = "Long", required = true, paramType = "query")}) + // @ApiOperation(value = "鐩樼偣鍗曞鍑�", notes = "鐩樼偣鍗曞鍑�") +// @ApiImplicitParams({ +// @ApiImplicitParam(name = "id", value = "鐩樼偣鍗昳d", dataType = "Long", required = true, paramType = "query")}) @GetMapping("/list/export") public ResponseValue<String> export(Long id, HttpServletResponse response) throws Exception { diff --git a/consum-base/src/main/java/com/consum/base/controller/LWhFormInventoryGoodsController.java b/consum-base/src/main/java/com/consum/base/controller/LWhFormInventoryGoodsController.java index 20b4cbf..3a600f5 100644 --- a/consum-base/src/main/java/com/consum/base/controller/LWhFormInventoryGoodsController.java +++ b/consum-base/src/main/java/com/consum/base/controller/LWhFormInventoryGoodsController.java @@ -13,15 +13,12 @@ import com.consum.model.po.LWhFormInventoryGoods; import com.walker.web.ResponseValue; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; - /** * @Description 鐩樼偣鍗曠墿鍝� * @Author 鍗㈠簡闃� * @Date 2023/10/31 */ -@Api(value = "鐩樼偣", tags = "鐩樼偣") +// @Api(value = "鐩樼偣", tags = "鐩樼偣") @RestController @RequestMapping("/pc/l/wh/form/inventory/goods") public class LWhFormInventoryGoodsController extends BaseController { @@ -35,7 +32,7 @@ * @Author 鍗㈠簡闃� * @Date 2023/10/31 */ - @ApiOperation(value = "鏌ヨ鐩樼偣鍗曠墿鍝�(缁х画鐩樼偣)", notes = "鏌ヨ鐩樼偣鍗曠墿鍝�(缁х画鐩樼偣)") + // @ApiOperation(value = "鏌ヨ鐩樼偣鍗曠墿鍝�(缁х画鐩樼偣)", notes = "鏌ヨ鐩樼偣鍗曠墿鍝�(缁х画鐩樼偣)") @GetMapping("/list") public ResponseValue queryList(Long id) { FinSysTenantUser sysInfo = this.getSysInfo(); diff --git a/consum-base/src/main/java/com/consum/base/controller/LWhFormOutputController.java b/consum-base/src/main/java/com/consum/base/controller/LWhFormOutputController.java index b8d85e1..e5dc74e 100644 --- a/consum-base/src/main/java/com/consum/base/controller/LWhFormOutputController.java +++ b/consum-base/src/main/java/com/consum/base/controller/LWhFormOutputController.java @@ -9,9 +9,8 @@ import java.util.Optional; import java.util.stream.Collectors; -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; - +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.compress.utils.Lists; import org.apache.poi.hssf.usermodel.HSSFWorkbook; import org.apache.poi.ss.usermodel.Workbook; @@ -50,17 +49,14 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.entity.TemplateExportParams; import cn.hutool.core.util.ReflectUtil; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; + /** * @Description 鍑哄簱鍗� * @Author 鍗㈠簡闃� * @Date 2023/10/27 */ -@Api(value = "鍑哄簱鍗�", tags = "鍑哄簱鍗�") +// @Api(value = "鍑哄簱鍗�", tags = "鍑哄簱鍗�") @RestController @RequestMapping("/pc/l/wh/form/output") public class LWhFormOutputController extends BaseController { @@ -77,9 +73,9 @@ * @Author 鍗㈠簡闃� * @Date 2023/10/27 */ - @ApiOperation(value = "鏂板鍑哄簱鍗�", notes = "鏂板鍑哄簱鍗�") - @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "鍑哄簱鍗曞疄浣�", dataType = "lWhFormOutputParam", - dataTypeClass = LWhFormOutputParam.class, paramType = "body")}) + // @ApiOperation(value = "鏂板鍑哄簱鍗�", notes = "鏂板鍑哄簱鍗�") +// @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "鍑哄簱鍗曞疄浣�", dataType = "lWhFormOutputParam", +// dataTypeClass = LWhFormOutputParam.class, paramType = "body")}) @PostMapping("/add") public ResponseValue add() { LWhFormOutputParam param = CommonUtil.getObjFromReqBody(LWhFormOutputParam.class); @@ -97,9 +93,9 @@ /** * @Description 鍒楄〃鏌ヨ */ - @ApiOperation(value = "鍒楄〃鏌ヨ", notes = "鍒楄〃鏌ヨ") - @ApiImplicitParam(name = "param", value = "鍑哄簱鍗曞疄浣�", required = true, dataType = "LWhFormOutputParam", - paramType = "query") + // @ApiOperation(value = "鍒楄〃鏌ヨ", notes = "鍒楄〃鏌ヨ") +// @ApiImplicitParam(name = "param", value = "鍑哄簱鍗曞疄浣�", required = true, dataType = "LWhFormOutputParam", +// paramType = "query") @GetMapping("/list") public ResponseValue queryFormOutputList() { LWhFormOutputQry param = CommonUtil.getObjFromReq(LWhFormOutputQry.class); @@ -142,8 +138,8 @@ /** * 鏍规嵁id鏌ヨ璇︽儏 */ - @ApiOperation(value = "鏍规嵁id鏌ヨ璇︽儏", notes = "鏍规嵁id鏌ヨ璇︽儏") - @ApiImplicitParam(name = "id", value = "鍑哄簱鍗昳d", required = true, dataType = "Long", paramType = "query") + // @ApiOperation(value = "鏍规嵁id鏌ヨ璇︽儏", notes = "鏍规嵁id鏌ヨ璇︽儏") + // @ApiImplicitParam(name = "id", value = "鍑哄簱鍗昳d", required = true, dataType = "Long", paramType = "query") @GetMapping("/detail") public ResponseValue getById(Long id) throws Exception { if (id == null) { @@ -195,9 +191,9 @@ return goodsTemplateInfoVO; } - @ApiOperation(value = "鏌ヨ鍑哄簱鍗曡鎯呮槑缁�", notes = "鏌ヨ鍑哄簱鍗曡鎯呮槑缁�") - @ApiImplicitParam(name = "formOutputQry", value = "鍑哄簱鍗曡鎯呮煡璇㈡潯浠�", required = true, dataType = "LWhFormOutputQry", - paramType = "query") + // @ApiOperation(value = "鏌ヨ鍑哄簱鍗曡鎯呮槑缁�", notes = "鏌ヨ鍑哄簱鍗曡鎯呮槑缁�") +// @ApiImplicitParam(name = "formOutputQry", value = "鍑哄簱鍗曡鎯呮煡璇㈡潯浠�", required = true, dataType = "LWhFormOutputQry", +// paramType = "query") @GetMapping("/detail/list") public ResponseValue queryFormOutputDetailList() { LWhFormOutputQry formOutputQry = CommonUtil.getObjFromReq(LWhFormOutputQry.class); @@ -210,8 +206,8 @@ return ResponseValue.success(genericPager); } - @ApiOperation(value = "鍑哄簱鍗曞鍑�", notes = "鍑哄簱鍗曞鍑�") - @ApiImplicitParam(name = "id", value = "鍑哄簱鍗昳d", required = true, dataType = "Long", paramType = "query") + // @ApiOperation(value = "鍑哄簱鍗曞鍑�", notes = "鍑哄簱鍗曞鍑�") + // @ApiImplicitParam(name = "id", value = "鍑哄簱鍗昳d", required = true, dataType = "Long", paramType = "query") @GetMapping("/list/export") public ResponseValue export(Long id, HttpServletResponse response) throws Exception { FinSysTenantUser sysInfo = this.getSysInfo(); diff --git a/consum-base/src/main/java/com/consum/base/controller/LWhFormProcureController.java b/consum-base/src/main/java/com/consum/base/controller/LWhFormProcureController.java index 7d7b63b..a626df3 100644 --- a/consum-base/src/main/java/com/consum/base/controller/LWhFormProcureController.java +++ b/consum-base/src/main/java/com/consum/base/controller/LWhFormProcureController.java @@ -8,8 +8,6 @@ import java.util.List; import java.util.Map; import java.util.Optional; -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.StrUtil; @@ -20,6 +18,8 @@ import com.consum.base.service.*; import com.consum.base.util.DateUtil; import com.consum.model.po.*; +import jakarta.annotation.Resource; +import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.compress.utils.Lists; import org.apache.poi.ss.usermodel.Workbook; import org.springframework.beans.BeanUtils; @@ -55,10 +55,10 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.entity.TemplateExportParams; import cn.hutool.core.util.ReflectUtil; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; + + + + /** * @ClassName LWhFormProcureController @@ -66,7 +66,7 @@ * @Description * @Version 1.0 **/ -@Api(value = "浠撳簱琛ㄥ崟閲囪喘", tags = "浠撳簱琛ㄥ崟閲囪喘") +//@Api(value = "浠撳簱琛ㄥ崟閲囪喘", tags = "浠撳簱琛ㄥ崟閲囪喘") @RestController @RequestMapping("/pc/whForm/procure") public class LWhFormProcureController extends BaseController { @@ -130,9 +130,9 @@ /** * @Description 鍒楄〃鏌ヨ */ - @ApiOperation(value = "閲囪喘鍗曞垪琛ㄦ煡璇�", notes = "閲囪喘鍗曞垪琛ㄦ煡璇�") - @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "閲囪喘鏌ヨ鏉′欢", required = true, - dataType = "FormProcureQryDto", paramType = "query")}) + // @ApiOperation(value = "閲囪喘鍗曞垪琛ㄦ煡璇�", notes = "閲囪喘鍗曞垪琛ㄦ煡璇�") +// @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "閲囪喘鏌ヨ鏉′欢", required = true, +// dataType = "FormProcureQryDto", paramType = "query")}) @GetMapping("/list") public ResponseValue queryFormProcureList() { FormProcureQry param = CommonUtil.getObjFromReq(FormProcureQry.class); @@ -291,9 +291,9 @@ return goodsModelVO; } - @ApiOperation(value = "閲囪喘鍗曟槑缁嗘煡璇�", notes = "閲囪喘鍗曟槑缁嗘煡璇�") - @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "閲囪喘鍗曟槑缁嗘煡璇�", required = true, - dataType = "FormProcureQryDto", paramType = "query")}) + // @ApiOperation(value = "閲囪喘鍗曟槑缁嗘煡璇�", notes = "閲囪喘鍗曟槑缁嗘煡璇�") +// @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "閲囪喘鍗曟槑缁嗘煡璇�", required = true, +// dataType = "FormProcureQryDto", paramType = "query")}) @GetMapping("detail/list") public ResponseValue queryFormProcureDetailList() { FormProcureQry formProcureQry = CommonUtil.getObjFromReq(FormProcureQry.class); @@ -312,9 +312,9 @@ return ResponseValue.success(genericPager); } - @ApiOperation(value = "閲囪喘鍗曞鍑�", notes = "閲囪喘鍗曞鍑�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "閲囪喘鍗昳d", required = true, dataType = "Long", paramType = "query")}) + // @ApiOperation(value = "閲囪喘鍗曞鍑�", notes = "閲囪喘鍗曞鍑�") +// @ApiImplicitParams({ +// @ApiImplicitParam(name = "id", value = "閲囪喘鍗昳d", required = true, dataType = "Long", paramType = "query")}) @GetMapping("/list/export") public ResponseValue<String> export(Long id, HttpServletResponse response) throws Exception { TemplateExportParams params = new TemplateExportParams("import/閲囪喘鍏ュ簱鍗�.xls"); @@ -358,7 +358,7 @@ * @param file * @return */ - @ApiOperation(value = "閲囪喘鍗曞鍏�", notes = "閲囪喘鍗曞鍏�") + // @ApiOperation(value = "閲囪喘鍗曞鍏�", notes = "閲囪喘鍗曞鍏�") @PostMapping("/import") public ResponseValue upload(MultipartFile file) { String originalFilename = file.getOriginalFilename(); diff --git a/consum-base/src/main/java/com/consum/base/controller/LWhFormScrappedController.java b/consum-base/src/main/java/com/consum/base/controller/LWhFormScrappedController.java index 08ea887..802d15f 100644 --- a/consum-base/src/main/java/com/consum/base/controller/LWhFormScrappedController.java +++ b/consum-base/src/main/java/com/consum/base/controller/LWhFormScrappedController.java @@ -5,8 +5,7 @@ import java.util.Map; import java.util.Optional; -import javax.servlet.http.HttpServletResponse; - +import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.compress.utils.Lists; import org.apache.poi.ss.usermodel.Workbook; import org.springframework.beans.BeanUtils; @@ -34,17 +33,17 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.entity.TemplateExportParams; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; + + + + /** * @Description 鎶ュ簾鍗� * @Author 鍗㈠簡闃� * @Date 2023/11/1 */ -@Api(value = "鎶ュ簾鍗�", tags = "鎶ュ簾鍗�") +// @Api(value = "鎶ュ簾鍗�", tags = "鎶ュ簾鍗�") @RestController @RequestMapping("/pc/l/wh/form/scrapped") public class LWhFormScrappedController extends BaseController { @@ -57,8 +56,8 @@ * @Author 鍗㈠簡闃� * @Date 2023/11/1 */ - @ApiOperation(value = "鏂板鎶ュ簾鍗�", notes = "鏂板鎶ュ簾鍗�") - @ApiImplicitParams({@ApiImplicitParam(name = "param")}) + // @ApiOperation(value = "鏂板鎶ュ簾鍗�", notes = "鏂板鎶ュ簾鍗�") + // @ApiImplicitParams({@ApiImplicitParam(name = "param")}) @PostMapping("/add") public ResponseValue add() { LWhFormScrappedParam param = CommonUtil.getObjFromReqBody(LWhFormScrappedParam.class); @@ -80,9 +79,9 @@ * <p> * </>1.鏌ヨ鎶ュ簾鍗� 2.鏌ヨ鎶ュ簾鍗曠墿鍝� */ - @ApiOperation(value = "鍒楄〃鏌ヨ", notes = "鍒楄〃鏌ヨ") - @ApiImplicitParams({ - @ApiImplicitParam(name = "param", value = "鏌ヨ鏉′欢", dataType = "LWhFormScrappedQry", paramType = "query")}) + // @ApiOperation(value = "鍒楄〃鏌ヨ", notes = "鍒楄〃鏌ヨ") +// @ApiImplicitParams({ +// @ApiImplicitParam(name = "param", value = "鏌ヨ鏉′欢", dataType = "LWhFormScrappedQry", paramType = "query")}) @GetMapping("/list") public ResponseValue queryList() { LWhFormScrappedQry param = CommonUtil.getObjFromReq(LWhFormScrappedQry.class); @@ -117,8 +116,8 @@ * @Author 鍗㈠簡闃� * @Date 2023/11/2 */ - @ApiOperation(value = "鏍规嵁id鏌ヨ璇︽儏", notes = "鏍规嵁id鏌ヨ璇︽儏") - @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "鎶ュ簾鍗昳d", dataType = "Long", paramType = "query")}) + // @ApiOperation(value = "鏍规嵁id鏌ヨ璇︽儏", notes = "鏍规嵁id鏌ヨ璇︽儏") + // @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "鎶ュ簾鍗昳d", dataType = "Long", paramType = "query")}) @GetMapping("/detail") public ResponseValue getById(Long id) { if (id == null) { @@ -134,9 +133,9 @@ * @param * @return */ - @ApiOperation(value = "鎶ュ簾鏄庣粏", notes = "鎶ュ簾鏄庣粏") - @ApiImplicitParams({ - @ApiImplicitParam(name = "param", value = "鏌ヨ鏉′欢", dataType = "LWhFormScrappedQry", paramType = "query")}) + // @ApiOperation(value = "鎶ュ簾鏄庣粏", notes = "鎶ュ簾鏄庣粏") +// @ApiImplicitParams({ +// @ApiImplicitParam(name = "param", value = "鏌ヨ鏉′欢", dataType = "LWhFormScrappedQry", paramType = "query")}) @GetMapping("/list/detailList") public ResponseValue queryDetailList() { LWhFormScrappedQry param = CommonUtil.getObjFromReq(LWhFormScrappedQry.class); @@ -152,8 +151,8 @@ return ResponseValue.success(pageUtil); } - @ApiOperation(value = "瀵煎嚭鎶ュ簾鍗�", notes = "瀵煎嚭鎶ュ簾鍗�") - @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "鎶ュ簾鍗昳d", dataType = "Long", paramType = "query")}) + // @ApiOperation(value = "瀵煎嚭鎶ュ簾鍗�", notes = "瀵煎嚭鎶ュ簾鍗�") +// @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "鎶ュ簾鍗昳d", dataType = "Long", paramType = "query")}) @GetMapping("/list/export") public ResponseValue<String> export(Long id, HttpServletResponse response) throws Exception { if (id == null) { diff --git a/consum-base/src/main/java/com/consum/base/controller/LWhFormTransferController.java b/consum-base/src/main/java/com/consum/base/controller/LWhFormTransferController.java index dd2a671..a0ca7c2 100644 --- a/consum-base/src/main/java/com/consum/base/controller/LWhFormTransferController.java +++ b/consum-base/src/main/java/com/consum/base/controller/LWhFormTransferController.java @@ -1,7 +1,6 @@ package com.consum.base.controller; import java.lang.reflect.Field; -import java.math.BigDecimal; import java.util.ArrayList; import java.util.Comparator; import java.util.HashMap; @@ -10,9 +9,6 @@ import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; -import javax.servlet.http.HttpServletResponse; - -import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.convert.Convert; import cn.hutool.core.util.StrUtil; import com.alibaba.excel.EasyExcelFactory; @@ -22,13 +18,13 @@ import com.alibaba.excel.exception.ExcelDataConvertException; import com.alibaba.fastjson.JSONObject; import com.consum.base.pojo.*; -import com.consum.base.pojo.excel.ImportProcureOrderTemplate; import com.consum.base.pojo.excel.LWhFormTransferTemplate; import com.consum.base.pojo.query.WarehouseQry; import com.consum.base.service.*; import com.consum.base.util.DateUtil; import com.consum.base.util.ExcelStyleUtil; import com.consum.model.po.*; +import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.compress.utils.Lists; import org.apache.commons.lang3.ObjectUtils; import org.apache.poi.ss.usermodel.Workbook; @@ -62,10 +58,6 @@ import cn.afterturn.easypoi.excel.ExcelExportUtil; import cn.afterturn.easypoi.excel.entity.TemplateExportParams; import cn.hutool.core.util.ReflectUtil; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiImplicitParam; -import io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; import org.springframework.web.multipart.MultipartFile; /** @@ -75,7 +67,7 @@ */ @RestController @RequestMapping("/pc/l/wh/form/transfer") -@Api(value = "璋冩嫧鍒嗗彂绠$悊", tags = "璋冩嫧鍒嗗彂绠$悊") +// @Api(value = "璋冩嫧鍒嗗彂绠$悊", tags = "璋冩嫧鍒嗗彂绠$悊") public class LWhFormTransferController extends BaseController { @Autowired @@ -106,8 +98,8 @@ /** * @Description 鏂板 */ - @ApiOperation(value = "鍗曟嵁鏂板", notes = "鍗曟嵁鏂板") - @ApiImplicitParam(name = "param", value = "鍗曟嵁鏂板", required = true, dataType = "LWhFormTransferParam") + // @ApiOperation(value = "鍗曟嵁鏂板", notes = "鍗曟嵁鏂板") + // @ApiImplicitParam(name = "param", value = "鍗曟嵁鏂板", required = true, dataType = "LWhFormTransferParam") @PostMapping("/add") @Transactional(rollbackFor = Exception.class) public ResponseValue add() throws Exception { @@ -237,7 +229,7 @@ * @return * @throws Exception */ - @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "璋冩嫧鍗昳d", required = true, dataType = "Long"),}) + // @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "璋冩嫧鍗昳d", required = true, dataType = "Long"),}) @Transactional(rollbackFor = Exception.class) @PostMapping("import") public ResponseValue upload(@RequestBody String idStr) throws Exception { @@ -310,10 +302,10 @@ * <p> * 2.鏌ヨ鐗╁搧鍨嬪彿 */ - @ApiOperation(value = "鍗曟嵁鍒楄〃鏌ヨ", notes = "鍗曟嵁鍒楄〃鏌ヨ") - @ApiImplicitParams({@ApiImplicitParam(name = "page", value = "椤电爜", required = true, dataType = "int"), - @ApiImplicitParam(name = "size", value = "姣忛〉鏉℃暟", required = true, dataType = "int"), - @ApiImplicitParam(name = "param", value = "鏉′欢鍙傛暟", required = true, dataType = "TransferQry"),}) + // @ApiOperation(value = "鍗曟嵁鍒楄〃鏌ヨ", notes = "鍗曟嵁鍒楄〃鏌ヨ") +// @ApiImplicitParams({@ApiImplicitParam(name = "page", value = "椤电爜", required = true, dataType = "int"), +// @ApiImplicitParam(name = "size", value = "姣忛〉鏉℃暟", required = true, dataType = "int"), +// @ApiImplicitParam(name = "param", value = "鏉′欢鍙傛暟", required = true, dataType = "TransferQry"),}) @GetMapping("/list") public ResponseValue queryFormTransferList() { TransferQry param = CommonUtil.getObjFromReq(TransferQry.class); @@ -359,8 +351,8 @@ * @Author 鍗㈠簡闃� * @Date 2023/10/30 */ - @ApiOperation(value = "鏍规嵁id鏌ヨ璇︽儏", notes = "鏍规嵁id鏌ヨ璇︽儏") - @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "璋冩嫧鍗昳d", required = true, dataType = "Long"),}) + // @ApiOperation(value = "鏍规嵁id鏌ヨ璇︽儏", notes = "鏍规嵁id鏌ヨ璇︽儏") + // @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "璋冩嫧鍗昳d", required = true, dataType = "Long"),}) @GetMapping("/detail") public ResponseValue getById(Long id) { if (id == null) { @@ -370,8 +362,8 @@ return ResponseValue.success(vo); } - @ApiOperation(value = "璋冩嫧鏄庣粏鍒楄〃", notes = "璋冩嫧鏄庣粏鍒楄〃") - @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "鏉′欢", required = true, dataType = "TransferQry"),}) + // @ApiOperation(value = "璋冩嫧鏄庣粏鍒楄〃", notes = "璋冩嫧鏄庣粏鍒楄〃") + // @ApiImplicitParams({@ApiImplicitParam(name = "param", value = "鏉′欢", required = true, dataType = "TransferQry"),}) @GetMapping("/detail/list") public ResponseValue queryFormTransferDetailList() { TransferQry param = CommonUtil.getObjFromReq(TransferQry.class); @@ -398,8 +390,8 @@ * @author 鍗㈠簡闃� * @date 2023/10/31 */ - @ApiOperation(value = "鎾ら攢", notes = "鎾ら攢") - @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "璋冩嫧鍗昳d", required = true, dataType = "Long"),}) + // @ApiOperation(value = "鎾ら攢", notes = "鎾ら攢") + // @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "璋冩嫧鍗昳d", required = true, dataType = "Long"),}) @PostMapping("/updStatus") public ResponseValue updateStatus(Long id) { if (id == null) { @@ -419,8 +411,8 @@ * @Author 鍗㈠簡闃� * @Date 2023/10/31 */ - @ApiOperation(value = "璋冩嫧鍏ュ簱", notes = "璋冩嫧鍏ュ簱") - @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "璋冩嫧鍗昳d", required = true, dataType = "Long"),}) + // @ApiOperation(value = "璋冩嫧鍏ュ簱", notes = "璋冩嫧鍏ュ簱") + // @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "璋冩嫧鍗昳d", required = true, dataType = "Long"),}) @PostMapping("/income") public ResponseValue income(Long id) throws Exception { lWhFormTransferCoreService.doTransferInPut(id, getCurrentUser(), null); @@ -432,8 +424,8 @@ * @Author 鍗㈠簡闃� * @Date 2023/10/31 */ - @ApiOperation(value = "璋冩嫧鍑哄簱", notes = "璋冩嫧鍑哄簱") - @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "璋冩嫧鍗昳d", required = true, dataType = "Long"),}) + // @ApiOperation(value = "璋冩嫧鍑哄簱", notes = "璋冩嫧鍑哄簱") + // @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "璋冩嫧鍗昳d", required = true, dataType = "Long"),}) @PostMapping("/output") public ResponseValue output(Long id) throws Exception { @@ -464,9 +456,9 @@ return ResponseValue.success(); } - @ApiOperation(value = "璋冩嫧鍗曞鍑�", notes = "璋冩嫧鍗曞鍑�") - @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "璋冩嫧鍗昳d", required = true, dataType = "Long"), - @ApiImplicitParam(name = "type", value = "瀵煎嚭绫诲瀷 1 鍏ュ簱 2 鍑哄簱", required = true, dataType = "Integer"),}) + // @ApiOperation(value = "璋冩嫧鍗曞鍑�", notes = "璋冩嫧鍗曞鍑�") +// @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "璋冩嫧鍗昳d", required = true, dataType = "Long"), +// @ApiImplicitParam(name = "type", value = "瀵煎嚭绫诲瀷 1 鍏ュ簱 2 鍑哄簱", required = true, dataType = "Integer"),}) @GetMapping("/list/export") public ResponseValue<String> export(Long id, Integer type, HttpServletResponse response) throws Exception { @@ -517,8 +509,8 @@ * @param * @return */ - @ApiOperation(value = "閮ㄩ棬鐗╁搧鍒嗗彂鍒楄〃鏄庣粏", notes = "閮ㄩ棬鐗╁搧鍒嗗彂鍒楄〃鏄庣粏") - @ApiImplicitParams({@ApiImplicitParam(name = "transferQryDto", value = "璋冩嫧鍗曟煡璇㈡潯浠�", required = true)}) + // @ApiOperation(value = "閮ㄩ棬鐗╁搧鍒嗗彂鍒楄〃鏄庣粏", notes = "閮ㄩ棬鐗╁搧鍒嗗彂鍒楄〃鏄庣粏") + // @ApiImplicitParams({@ApiImplicitParam(name = "transferQryDto", value = "璋冩嫧鍗曟煡璇㈡潯浠�", required = true)}) @GetMapping("/department/list") public ResponseValue departmentTransferList() { TransferQry param = CommonUtil.getObjFromReq(TransferQry.class); @@ -539,8 +531,8 @@ return ResponseValue.success(transferInfoDetailsVoGenericPager); } - @ApiOperation(value = "浣跨敤浜轰慨鏀�", notes = "浣跨敤浜轰慨鏀�") - @ApiImplicitParams({@ApiImplicitParam(name = "procureModelInfoDto", value = "浣跨敤淇℃伅", required = true)}) + // @ApiOperation(value = "浣跨敤浜轰慨鏀�", notes = "浣跨敤浜轰慨鏀�") + // @ApiImplicitParams({@ApiImplicitParam(name = "procureModelInfoDto", value = "浣跨敤淇℃伅", required = true)}) @PostMapping("/useInfo/update") public ResponseValue infoUpdate() { @@ -611,8 +603,8 @@ * @param transferOrderId * @return */ - @ApiOperation(value = "閮ㄩ棬鐗╁搧浣跨敤浜鸿褰�", notes = "閮ㄩ棬鐗╁搧浣跨敤浜鸿褰�") - @ApiImplicitParams({@ApiImplicitParam(name = "transferOrderId", value = "璋冩嫧鍗昳d", required = true)}) + // @ApiOperation(value = "閮ㄩ棬鐗╁搧浣跨敤浜鸿褰�", notes = "閮ㄩ棬鐗╁搧浣跨敤浜鸿褰�") + // @ApiImplicitParams({@ApiImplicitParam(name = "transferOrderId", value = "璋冩嫧鍗昳d", required = true)}) @GetMapping("/use/record") public ResponseValue useRecord(Long transferOrderId) { S_user_core currentUser = this.getCurrentUser(); @@ -669,9 +661,9 @@ return ResponseValue.success(goodsUseRecordList); } - @ApiOperation(value = "鏌ヨ閮ㄩ棬涓嬬殑鍒嗗彂鍗�", notes = "鏌ヨ閮ㄩ棬涓嬬殑鍒嗗彂鍗�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "agencyId", value = "鏈烘瀯id", required = true, dataType = "Long", paramType = "query")}) + // @ApiOperation(value = "鏌ヨ閮ㄩ棬涓嬬殑鍒嗗彂鍗�", notes = "鏌ヨ閮ㄩ棬涓嬬殑鍒嗗彂鍗�") +// @ApiImplicitParams({ +// @ApiImplicitParam(name = "agencyId", value = "鏈烘瀯id", required = true, dataType = "Long", paramType = "query")}) @GetMapping("/query/transfList") public ResponseValue queryDepartmentTransferOrderList() { @@ -687,7 +679,7 @@ * @param file * @return */ - @ApiOperation(value = "鍒嗗彂鍗曞鍏�", notes = "鍒嗗彂鍗曞鍏�") + // @ApiOperation(value = "鍒嗗彂鍗曞鍏�", notes = "鍒嗗彂鍗曞鍏�") @PostMapping("/import2") public ResponseValue import2(MultipartFile file) { String originalFilename = file.getOriginalFilename(); @@ -845,7 +837,7 @@ LWhProcureModelUserParam lWhProcureModelUserParam = new LWhProcureModelUserParam(); lWhProcureModelUserParam.setGoodsNum(Integer.valueOf(num)); lWhProcureModelUserParam.setNowUserName(user); - lWhProcureModelUserParam.setNowUserPhone(new Long(userContactPhone)); + lWhProcureModelUserParam.setNowUserPhone(Convert.toLong(userContactPhone)); Integer counts1 = optional3.get().getCounts(); Integer num1 = optional3.get().getNum(); optional3.get().setCounts(Integer.valueOf(num) + counts1); @@ -879,11 +871,11 @@ // 鏌ヨ搴撳瓨鏁伴噺 Integer nowNum = selectAllNumber(lWhFormTransferParam.getOutAgencyId(), selByModelNameAndGoodsTemplatesId.getId()); - if(nowNum<new Integer(num)){ + if(nowNum< Convert.toInt(num)){ throw new ExcelAnalysisException("绗�" + index + "鏉℃暟鎹�" + "鍝佸悕锛歔" + goodsName + "] 瑙勬牸鍨嬪彿锛歔" + goodModelName + "] 搴撳瓨鏁伴噺涓嶈冻锛歔"+nowNum+"]"); } lWhProcureModelUserParam.setNowUserName(user); - lWhProcureModelUserParam.setNowUserPhone(new Long(userContactPhone)); + lWhProcureModelUserParam.setNowUserPhone(Convert.toLong(userContactPhone)); addLWhProcureModelUserParam.add(lWhProcureModelUserParam); lWhTransferModelParam.setProcureModelUserList(addLWhProcureModelUserParam); optional.get().getModels().add(lWhTransferModelParam); @@ -909,20 +901,20 @@ // 瑙勬牸id lWhTransferModelParam.setBaseGoodsModelsId(selByModelNameAndGoodsTemplatesId.getId()); // 鏂板鐨勬椂鍊欓粯璁や竴鏉� - lWhTransferModelParam.setCounts(new Integer(num)); - lWhTransferModelParam.setNum(new Integer(num)); + lWhTransferModelParam.setCounts(Convert.toInt(num)); + lWhTransferModelParam.setNum(Convert.toInt(num)); List<LWhProcureModelUserParam> lWhFormProcureGoodsInfoParam = new ArrayList<>(); LWhProcureModelUserParam lWhProcureModelUserParam = new LWhProcureModelUserParam(); lWhProcureModelUserParam.setGoodsNum(Integer.valueOf(num)); // 鏌ヨ搴撳瓨鏁伴噺 Integer nowNum = selectAllNumber(lWhFormTransferParam.getOutAgencyId(), selByModelNameAndGoodsTemplatesId.getId()); - if(nowNum<new Integer(num)){ + if(nowNum<Convert.toInt(num)){ throw new ExcelAnalysisException("绗�" + index + "鏉℃暟鎹� " + "鍝佸悕锛歔" + goodsName + "] 瑙勬牸鍨嬪彿锛歔" + goodModelName + "] 搴撳瓨鏁伴噺涓嶈冻锛歔"+nowNum+"]"); } lWhProcureModelUserParam.setNowUserName(user); - lWhProcureModelUserParam.setNowUserPhone(new Long(userContactPhone)); + lWhProcureModelUserParam.setNowUserPhone(Convert.toLong(userContactPhone)); lWhFormProcureGoodsInfoParam.add(lWhProcureModelUserParam); lWhTransferModelParam.setProcureModelUserList(lWhFormProcureGoodsInfoParam); lWhTransferModelParam.setBaseGoodsModelsName(goodModelName); diff --git a/consum-base/src/main/java/com/consum/base/controller/LWhGoodsStatisticsController.java b/consum-base/src/main/java/com/consum/base/controller/LWhGoodsStatisticsController.java index 66eecd4..bb59978 100644 --- a/consum-base/src/main/java/com/consum/base/controller/LWhGoodsStatisticsController.java +++ b/consum-base/src/main/java/com/consum/base/controller/LWhGoodsStatisticsController.java @@ -1,7 +1,5 @@ package com.consum.base.controller; - -import javax.annotation.Resource; - +import jakarta.annotation.Resource; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -14,7 +12,7 @@ import com.iplatform.model.po.S_user_core; import com.walker.web.ResponseValue; -import io.swagger.annotations.Api; + /** * @ClassName LWhGoodsStatisticsController @@ -23,7 +21,7 @@ * @Description 鐗╁搧缁熻 * @Version 1.0 **/ -@Api(value = "鐗╁搧缁熻", tags = "鐗╁搧缁熻") +// @Api(value = "鐗╁搧缁熻", tags = "鐗╁搧缁熻") @RestController @RequestMapping("/pc/warehouse/goodsStatistics") public class LWhGoodsStatisticsController extends BaseController { diff --git a/consum-base/src/main/java/com/consum/base/controller/LWhHomeStatisticsController.java b/consum-base/src/main/java/com/consum/base/controller/LWhHomeStatisticsController.java index f178344..b0c2212 100644 --- a/consum-base/src/main/java/com/consum/base/controller/LWhHomeStatisticsController.java +++ b/consum-base/src/main/java/com/consum/base/controller/LWhHomeStatisticsController.java @@ -3,8 +3,7 @@ import java.util.List; import java.util.Map; -import javax.annotation.Resource; - +import jakarta.annotation.Resource; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -16,7 +15,7 @@ import com.walker.web.ResponseValue; import cn.hutool.core.convert.Convert; -import io.swagger.annotations.Api; + /** * @ClassName LWhHomeStatisticsController @@ -28,7 +27,7 @@ @RestController @RequestMapping("/pc/warehouse/homeStatistics") -@Api(value = "棣栭〉缁熻", tags = "棣栭〉缁熻") +// @Api(value = "棣栭〉缁熻", tags = "棣栭〉缁熻") public class LWhHomeStatisticsController extends BaseController { @Resource private LWhGoodsService lWhGoodsService; diff --git a/consum-base/src/main/java/com/consum/base/controller/LWhProcureModelController.java b/consum-base/src/main/java/com/consum/base/controller/LWhProcureModelController.java index 2fc80d8..542376f 100644 --- a/consum-base/src/main/java/com/consum/base/controller/LWhProcureModelController.java +++ b/consum-base/src/main/java/com/consum/base/controller/LWhProcureModelController.java @@ -4,8 +4,7 @@ import java.util.Map; import java.util.stream.Collectors; -import javax.annotation.Resource; - +import jakarta.annotation.Resource; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -17,9 +16,7 @@ import com.walker.infrastructure.utils.CollectionUtils; import com.walker.web.ResponseValue; -import io.swagger.annotations.Api; - -@Api(value = "鐗╁搧鍨嬪彿", tags = "鐗╁搧鍨嬪彿") +// @Api(value = "鐗╁搧鍨嬪彿", tags = "鐗╁搧鍨嬪彿") @RestController @RequestMapping("/pc/warehouse/procureModel") public class LWhProcureModelController extends BaseController { diff --git a/consum-base/src/main/java/com/consum/base/controller/LWhWarningConfigController.java b/consum-base/src/main/java/com/consum/base/controller/LWhWarningConfigController.java index 91b671b..5a3626c 100644 --- a/consum-base/src/main/java/com/consum/base/controller/LWhWarningConfigController.java +++ b/consum-base/src/main/java/com/consum/base/controller/LWhWarningConfigController.java @@ -10,8 +10,7 @@ import java.util.Map; import java.util.stream.Collectors; -import javax.annotation.Resource; - +import jakarta.annotation.Resource; import org.apache.commons.lang3.StringUtils; import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.InputStreamResource; @@ -50,7 +49,7 @@ import cn.afterturn.easypoi.excel.entity.ImportParams; import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; import cn.hutool.core.convert.Convert; -import io.swagger.annotations.Api; + /** * @ClassName LWhWarningConfigController @@ -61,7 +60,7 @@ **/ @RestController @RequestMapping("/pc/warehouse/warningConfig") -@Api(value = "搴撳瓨闃�鍊�", tags = "搴撳瓨闃�鍊�") +// @Api(value = "搴撳瓨闃�鍊�", tags = "搴撳瓨闃�鍊�") public class LWhWarningConfigController extends BaseController { @Resource diff --git a/consum-base/src/main/java/com/consum/base/controller/LWhWarningController.java b/consum-base/src/main/java/com/consum/base/controller/LWhWarningController.java index 7ea7202..d0f0eb1 100644 --- a/consum-base/src/main/java/com/consum/base/controller/LWhWarningController.java +++ b/consum-base/src/main/java/com/consum/base/controller/LWhWarningController.java @@ -2,8 +2,7 @@ import java.util.Map; -import javax.annotation.Resource; - +import jakarta.annotation.Resource; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -18,7 +17,7 @@ import com.walker.infrastructure.utils.DateUtils; import com.walker.web.ResponseValue; -import io.swagger.annotations.Api; + /** * @ClassName LWhWarningConfigController @@ -29,7 +28,7 @@ **/ @RestController @RequestMapping("/pc/warehouse/warning") -@Api(value = "棰勮鏌ヨ", tags = "棰勮鏌ヨ") +// @Api(value = "棰勮鏌ヨ", tags = "棰勮鏌ヨ") public class LWhWarningController extends BaseController { @Resource diff --git a/consum-base/src/main/java/com/consum/base/controller/UsingFormBackController.java b/consum-base/src/main/java/com/consum/base/controller/UsingFormBackController.java index e6ba5ac..4339553 100644 --- a/consum-base/src/main/java/com/consum/base/controller/UsingFormBackController.java +++ b/consum-base/src/main/java/com/consum/base/controller/UsingFormBackController.java @@ -16,8 +16,8 @@ import com.consum.model.po.FinSysTenantUser; import com.walker.web.ResponseValue; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; + + /** * @author asus @@ -25,7 +25,7 @@ * @description: 閮ㄩ棬鐗╁搧閫�鍥炲崟 * @date 2023/12/1 11:36 */ -@Api(value = "閮ㄩ棬鐗╁搧閫�鍥�", tags = "閮ㄩ棬鐗╁搧閫�鍥�") +// @Api(value = "閮ㄩ棬鐗╁搧閫�鍥�", tags = "閮ㄩ棬鐗╁搧閫�鍥�") @RestController @RequestMapping("/pc/l/wh/using/form/back") public class UsingFormBackController extends BaseController { @@ -33,7 +33,7 @@ @Autowired private UsingFormBackService usingFormBackService; - @ApiOperation(value = "閮ㄩ棬鐗╁搧閫�鍥炲崟鏂板鎺ュ彛", notes = "閮ㄩ棬鐗╁搧閫�鍥炲崟鏂板鎺ュ彛") + // @ApiOperation(value = "閮ㄩ棬鐗╁搧閫�鍥炲崟鏂板鎺ュ彛", notes = "閮ㄩ棬鐗╁搧閫�鍥炲崟鏂板鎺ュ彛") @PostMapping("/add") public ResponseValue add() { UsingFormBackParam usingFormBackParam = CommonUtil.getObjFromReqBody(UsingFormBackParam.class); @@ -49,7 +49,7 @@ return ResponseValue.success(); } - @ApiOperation(value = "閮ㄩ棬鐗╁搧閫�鍥炲崟鏌ヨ鎺ュ彛", notes = "閮ㄩ棬鐗╁搧閫�鍥炲崟鏌ヨ鎺ュ彛") + // @ApiOperation(value = "閮ㄩ棬鐗╁搧閫�鍥炲崟鏌ヨ鎺ュ彛", notes = "閮ㄩ棬鐗╁搧閫�鍥炲崟鏌ヨ鎺ュ彛") @GetMapping("/list") public ResponseValue query() { UsingFormBackQry usingFormBackParam = CommonUtil.getObjFromReq(UsingFormBackQry.class); @@ -66,7 +66,7 @@ return ResponseValue.success(page); } - @ApiOperation(value = "閮ㄩ棬鐗╁搧閫�鍥炲崟璇︽儏鎺ュ彛", notes = "閮ㄩ棬鐗╁搧閫�鍥炲崟璇︽儏鎺ュ彛") + // @ApiOperation(value = "閮ㄩ棬鐗╁搧閫�鍥炲崟璇︽儏鎺ュ彛", notes = "閮ㄩ棬鐗╁搧閫�鍥炲崟璇︽儏鎺ュ彛") @GetMapping("/detail") public ResponseValue detail(Long id) { FinSysTenantUser sysInfo = getSysInfo(); @@ -77,7 +77,7 @@ return ResponseValue.success(detail); } - @ApiOperation(value = "閮ㄩ棬鐗╁搧閫�鍥炴槑缁嗘煡璇㈡帴鍙�", notes = "閮ㄩ棬鐗╁搧閫�鍥炴槑缁嗘煡璇㈡帴鍙�") + // @ApiOperation(value = "閮ㄩ棬鐗╁搧閫�鍥炴槑缁嗘煡璇㈡帴鍙�", notes = "閮ㄩ棬鐗╁搧閫�鍥炴槑缁嗘煡璇㈡帴鍙�") @GetMapping("/list/detail") public ResponseValue queryListDetail() { UsingFormBackQry usingFormBackParam = CommonUtil.getObjFromReq(UsingFormBackQry.class); diff --git a/consum-base/src/main/java/com/consum/base/core/CodeGeneratorService.java b/consum-base/src/main/java/com/consum/base/core/CodeGeneratorService.java index c909105..059dbcf 100644 --- a/consum-base/src/main/java/com/consum/base/core/CodeGeneratorService.java +++ b/consum-base/src/main/java/com/consum/base/core/CodeGeneratorService.java @@ -1,5 +1,6 @@ package com.consum.base.core; +import com.consum.base.core.utils.IdUtil; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; @@ -26,7 +27,7 @@ get(sql, new SqlParameter().put("CODE_PREFIX", CODE_PREFIX), new BaseCodeIndexing()); if (codeIndexing == null) { codeIndexing = new BaseCodeIndexing(); - codeIndexing.setId(NumberGenerator.getLongSequenceNumber()); + codeIndexing.setId(IdUtil.generateId()); codeIndexing.setCodePrefix(CODE_PREFIX); codeIndexing.setCodeIndex(1); insert(codeIndexing); diff --git a/consum-base/src/main/java/com/consum/base/core/utils/CommonUtil.java b/consum-base/src/main/java/com/consum/base/core/utils/CommonUtil.java index f55c199..95db530 100644 --- a/consum-base/src/main/java/com/consum/base/core/utils/CommonUtil.java +++ b/consum-base/src/main/java/com/consum/base/core/utils/CommonUtil.java @@ -4,13 +4,10 @@ import cn.hutool.core.util.ReflectUtil; import com.fasterxml.jackson.databind.DeserializationFeature; import com.fasterxml.jackson.databind.ObjectMapper; -import org.springframework.beans.BeanUtils; +import jakarta.servlet.ServletInputStream;import jakarta.servlet.http.HttpServletRequest;import jakarta.servlet.http.HttpServletResponse;import org.springframework.beans.BeanUtils; import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.ServletRequestAttributes; -import javax.servlet.ServletInputStream; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; diff --git a/consum-base/src/main/java/com/consum/base/pojo/DepFormScrappedGoodsParam.java b/consum-base/src/main/java/com/consum/base/pojo/DepFormScrappedGoodsParam.java index 6a9fb43..de837ea 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/DepFormScrappedGoodsParam.java +++ b/consum-base/src/main/java/com/consum/base/pojo/DepFormScrappedGoodsParam.java @@ -2,7 +2,6 @@ import java.util.List; -import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** @@ -15,14 +14,14 @@ @Data public class DepFormScrappedGoodsParam { - @ApiModelProperty("鍒嗙被id") + // @ApiModelProperty("鍒嗙被id") private Long baseCategoryId; - @ApiModelProperty("鐗╁搧妯$増缂栧彿") + // @ApiModelProperty("鐗╁搧妯$増缂栧彿") private Long baseGoodsTemplateId; private String goodsTemplateName; - @ApiModelProperty("璋冩嫧鍗旾d") + // @ApiModelProperty("璋冩嫧鍗旾d") private Long transBusinessId; /** diff --git a/consum-base/src/main/java/com/consum/base/pojo/DepFormScrappedModelParam.java b/consum-base/src/main/java/com/consum/base/pojo/DepFormScrappedModelParam.java index cd9991c..a3adbe9 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/DepFormScrappedModelParam.java +++ b/consum-base/src/main/java/com/consum/base/pojo/DepFormScrappedModelParam.java @@ -1,6 +1,4 @@ package com.consum.base.pojo; - -import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** @@ -12,37 +10,37 @@ **/ @Data public class DepFormScrappedModelParam { - @ApiModelProperty("鐗╁搧鍨嬪彿id") + // @ApiModelProperty("鐗╁搧鍨嬪彿id") private Long baseGoodsModelsId; - @ApiModelProperty("浠峰�肩被鍨�") + // @ApiModelProperty("浠峰�肩被鍨�") private String classification;// "B绫�" - @ApiModelProperty("鎶ュ簾鏁伴噺") + // @ApiModelProperty("鎶ュ簾鏁伴噺") private Integer counts; - @ApiModelProperty("鍒嗗彂鏁伴噺") + // @ApiModelProperty("鍒嗗彂鏁伴噺") private Integer goodsNum; - @ApiModelProperty("鍦ㄧ敤鏁伴噺") + // @ApiModelProperty("鍦ㄧ敤鏁伴噺") private Integer userUseCount; - @ApiModelProperty("鐗╁搧id") + // @ApiModelProperty("鐗╁搧id") private Long goodsTemplatesId; - @ApiModelProperty("鐗╁搧鍨嬪彿") + // @ApiModelProperty("鐗╁搧鍨嬪彿") private String modelName; - @ApiModelProperty("璋冩嫧浣跨敤浜鸿〃涓璉D(A绫荤墿鍝佸~)") + // @ApiModelProperty("璋冩嫧浣跨敤浜鸿〃涓璉D(A绫荤墿鍝佸~)") private Long modelUserId; - @ApiModelProperty("浣跨敤浜哄憳鍚嶇О(鍙笉濉�)") + // @ApiModelProperty("浣跨敤浜哄憳鍚嶇О(鍙笉濉�)") private String nowUserName; - @ApiModelProperty("鎶ュ簾鍘熷洜CODE") + // @ApiModelProperty("鎶ュ簾鍘熷洜CODE") private Long scrappedCode; - @ApiModelProperty("璁¢噺鍗曚綅") + // @ApiModelProperty("璁¢噺鍗曚綅") private String unit; } diff --git a/consum-base/src/main/java/com/consum/base/pojo/FinSysTenantDepartmentParam.java b/consum-base/src/main/java/com/consum/base/pojo/FinSysTenantDepartmentParam.java index c72318d..4617aab 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/FinSysTenantDepartmentParam.java +++ b/consum-base/src/main/java/com/consum/base/pojo/FinSysTenantDepartmentParam.java @@ -1,9 +1,8 @@ package com.consum.base.pojo; import com.walker.web.param.ParamRequest; -import io.swagger.annotations.ApiModel; -@ApiModel(value = "FinSysTenantDepartmentParam") +// // @ApiModel(value = "FinSysTenantDepartmentParam") public class FinSysTenantDepartmentParam extends ParamRequest { /** diff --git a/consum-base/src/main/java/com/consum/base/pojo/LDeptFormScrappedParam.java b/consum-base/src/main/java/com/consum/base/pojo/LDeptFormScrappedParam.java index 6532580..51169a5 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/LDeptFormScrappedParam.java +++ b/consum-base/src/main/java/com/consum/base/pojo/LDeptFormScrappedParam.java @@ -1,36 +1,34 @@ package com.consum.base.pojo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.List; @Data -@ApiModel(value = "鏂板鎶ュ簾鍗曚俊鎭�") +// // @ApiModel(value = "鏂板鎶ュ簾鍗曚俊鎭�") public class LDeptFormScrappedParam { - @ApiModelProperty(value = "閮ㄩ棬id") + // // @ApiModelProperty(value = "閮ㄩ棬id") private Long departmentId; /** * 鎶ュ簾鏃堕棿 */ - @ApiModelProperty(value = "鎶ュ簾鏃堕棿") + // // @ApiModelProperty(value = "鎶ュ簾鏃堕棿") private Long dealTime; /** * 鎵嬬画 */ - @ApiModelProperty(value = "鎵嬬画") + // // @ApiModelProperty(value = "鎵嬬画") private String procureDoc; /** * 鎿嶄綔浜� */ -// @ApiModelProperty(value = "鎿嶄綔浜�") +// // @ApiModelProperty(value = "鎿嶄綔浜�") // private String operatorName; - @ApiModelProperty(value = "鎶ュ簾鍟嗗搧淇℃伅") + // // @ApiModelProperty(value = "鎶ュ簾鍟嗗搧淇℃伅") private List<DepFormScrappedGoodsParam> goods; diff --git a/consum-base/src/main/java/com/consum/base/pojo/LWFormsOutputGoodsInfoParam.java b/consum-base/src/main/java/com/consum/base/pojo/LWFormsOutputGoodsInfoParam.java index b87eff9..c3d47e4 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/LWFormsOutputGoodsInfoParam.java +++ b/consum-base/src/main/java/com/consum/base/pojo/LWFormsOutputGoodsInfoParam.java @@ -1,7 +1,7 @@ package com.consum.base.pojo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; + + import java.util.List; import lombok.Data; @@ -10,7 +10,7 @@ * @Author 鍗㈠簡闃� * @Date 2023/11/2 */ -@ApiModel(value = "璁板綍鐗╁搧淇℃伅鍜岃鏍煎瀷鍙�") +// // @ApiModel(value = "璁板綍鐗╁搧淇℃伅鍜岃鏍煎瀷鍙�") @Data public class LWFormsOutputGoodsInfoParam { @@ -18,18 +18,18 @@ /** * 鐗╁搧id */ - @ApiModelProperty(value = "鐗╁搧id") + // @ApiModelProperty(value = "鐗╁搧id") private Long baseGoodsTemplateId; /** * 鐗╁搧妯$増鍚嶇О */ - @ApiModelProperty(value = "鐗╁搧妯$増鍚嶇О") + // @ApiModelProperty(value = "鐗╁搧妯$増鍚嶇О") private String goodsTemplateName; /** * 鍒嗙被id */ - @ApiModelProperty(value = "鍒嗙被id") + // @ApiModelProperty(value = "鍒嗙被id") private Long baseCategoryId; /** diff --git a/consum-base/src/main/java/com/consum/base/pojo/LWFormsOutputGoodsModelParam.java b/consum-base/src/main/java/com/consum/base/pojo/LWFormsOutputGoodsModelParam.java index 1505609..a3a1829 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/LWFormsOutputGoodsModelParam.java +++ b/consum-base/src/main/java/com/consum/base/pojo/LWFormsOutputGoodsModelParam.java @@ -1,7 +1,7 @@ package com.consum.base.pojo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; + + import lombok.Data; /** @@ -11,23 +11,23 @@ * @date 2023/11/13 11:29 */ @Data -@ApiModel(value = "鍑哄簱鐗╁搧鍨嬪彿") +// // @ApiModel(value = "鍑哄簱鐗╁搧鍨嬪彿") public class LWFormsOutputGoodsModelParam { //瑙勬牸鍨嬪彿缂栧彿 - @ApiModelProperty(value = "瑙勬牸鍨嬪彿缂栧彿") + // // @ApiModelProperty(value = "瑙勬牸鍨嬪彿缂栧彿") private Long baseGoodsModelsId; // 璁¢噺鍗曚綅 - @ApiModelProperty(value = "璁¢噺鍗曚綅") + // // @ApiModelProperty(value = "璁¢噺鍗曚綅") private String baseUnit; //搴撳瓨鏁伴噺 - @ApiModelProperty(value = "搴撳瓨鏁伴噺") + // @ApiModelProperty(value = "搴撳瓨鏁伴噺") private Long warehouseNum; //鏁伴噺 - @ApiModelProperty(value = "鎿嶄綔鏁伴噺") + // @ApiModelProperty(value = "鎿嶄綔鏁伴噺") private Integer counts; - @ApiModelProperty(value = "閲囪喘绫诲瀷") + // @ApiModelProperty(value = "閲囪喘绫诲瀷") private Integer procureModelBusinessType; } diff --git a/consum-base/src/main/java/com/consum/base/pojo/LWarehouseFlowParam.java b/consum-base/src/main/java/com/consum/base/pojo/LWarehouseFlowParam.java index db950c9..187832c 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/LWarehouseFlowParam.java +++ b/consum-base/src/main/java/com/consum/base/pojo/LWarehouseFlowParam.java @@ -1,8 +1,6 @@ package com.consum.base.pojo; import com.walker.web.param.ParamRequest; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** @@ -11,63 +9,63 @@ * @Description * @Version 1.0 **/ -@ApiModel(value = "搴撳瓨娴佹按鏌ヨ鍙傛暟") +// @ApiModel(value = "搴撳瓨娴佹按鏌ヨ鍙傛暟") @Data public class LWarehouseFlowParam extends ParamRequest { //鍗曟嵁绫诲瀷 1 閲囪喘2 璋冩嫧 3鍑哄簱4閮ㄩ棬鍒嗗彂 5鎶ュ簾 - @ApiModelProperty(value = "鍗曟嵁绫诲瀷 1 閲囪喘2 璋冩嫧 3鍑哄簱4閮ㄩ棬鍒嗗彂 5鎶ュ簾") + // @ApiModelProperty(value = "鍗曟嵁绫诲瀷 1 閲囪喘2 璋冩嫧 3鍑哄簱4閮ㄩ棬鍒嗗彂 5鎶ュ簾") private Short businessType; // 涓氬姟鍗曟嵁缂栧彿 - @ApiModelProperty(value = "涓氬姟鍗曟嵁缂栧彿") + // @ApiModelProperty(value = "涓氬姟鍗曟嵁缂栧彿") private String businessFormCode; //鐗╁搧鍚嶇О - @ApiModelProperty(value = "鐗╁搧鍚嶇О") + // @ApiModelProperty(value = "鐗╁搧鍚嶇О") private String goodsTemplateName; private Long goodsTemplateId; //瑙勬牸鍨嬪彿 - @ApiModelProperty(value = "瑙勬牸鍨嬪彿") + // @ApiModelProperty(value = "瑙勬牸鍨嬪彿") private String baseGoodsModelsName; // 鏈烘瀯 - @ApiModelProperty(value = "鏈烘瀯") + // @ApiModelProperty(value = "鏈烘瀯") private Long agencyId; - @ApiModelProperty("閮ㄩ棬ID") + // @ApiModelProperty("閮ㄩ棬ID") private Long departmentId; - @ApiModelProperty("浠撳簱绫诲瀷") + // @ApiModelProperty("浠撳簱绫诲瀷") private Long warehouseType; - @ApiModelProperty("浠撳簱id") + // @ApiModelProperty("浠撳簱id") private Long baseWarehouseId; - @ApiModelProperty("瑙勬牸鍨嬪彿") + // @ApiModelProperty("瑙勬牸鍨嬪彿") private Long baseGoodsModelsId; - @ApiModelProperty("浠峰�肩被鍨�") + // @ApiModelProperty("浠峰�肩被鍨�") private Short costType; - @ApiModelProperty("鍚岀爜琛紝1閲囪喘鍏ュ簱 2閫�杩樺叆搴� 3璋冩嫧鍏ュ簱 4鐩樼泩鍏ュ簱 5鐢抽鍑哄簱 6璋冩嫧鍑哄簱 7鐩樹簭鍑哄簱 8鎶ュ簾鍑哄簱 9鍏朵粬鍑哄簱") + // @ApiModelProperty("鍚岀爜琛紝1閲囪喘鍏ュ簱 2閫�杩樺叆搴� 3璋冩嫧鍏ュ簱 4鐩樼泩鍏ュ簱 5鐢抽鍑哄簱 6璋冩嫧鍑哄簱 7鐩樹簭鍑哄簱 8鎶ュ簾鍑哄簱 9鍏朵粬鍑哄簱") private Short flowType; - @ApiModelProperty("鍚岀爜琛紝1 鐗╁搧鐢抽 2 鐗╁搧鍒嗗彂 3 鐗╁搧閫�杩� 4 鐗╁搧鎶ュ簾") + // @ApiModelProperty("鍚岀爜琛紝1 鐗╁搧鐢抽 2 鐗╁搧鍒嗗彂 3 鐗╁搧閫�杩� 4 鐗╁搧鎶ュ簾") private Short depFlowType; //鍒涘缓浜� - @ApiModelProperty(value = "鍒涘缓浜�") + // @ApiModelProperty(value = "鍒涘缓浜�") private String createdName; // 鎿嶄綔鏃堕棿 - @ApiModelProperty(value = "鎿嶄綔鏃堕棿") + // @ApiModelProperty(value = "鎿嶄綔鏃堕棿") private Long dealTimeStart; - @ApiModelProperty(value = "鎿嶄綔鏃堕棿") + // @ApiModelProperty(value = "鎿嶄綔鏃堕棿") private Long dealTimeEnd; - @ApiModelProperty(value = "姣忛〉鏄剧ず鏉℃暟") + // @ApiModelProperty(value = "姣忛〉鏄剧ず鏉℃暟") private Integer pageSize = 10; - @ApiModelProperty(value = "褰撳墠椤垫暟") + // @ApiModelProperty(value = "褰撳墠椤垫暟") private Integer pageNum = 1; } diff --git a/consum-base/src/main/java/com/consum/base/pojo/LWhFormOutputParam.java b/consum-base/src/main/java/com/consum/base/pojo/LWhFormOutputParam.java index e81b07f..abf6c16 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/LWhFormOutputParam.java +++ b/consum-base/src/main/java/com/consum/base/pojo/LWhFormOutputParam.java @@ -1,8 +1,8 @@ package com.consum.base.pojo; import com.walker.web.param.ParamRequest; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; + + import java.util.List; import lombok.Data; @@ -11,29 +11,29 @@ * @Author 鍗㈠簡闃� * @Date 2023/10/27 */ -@ApiModel +// @ApiModel @Data public class LWhFormOutputParam extends ParamRequest { /** * 浠撳簱id */ - @ApiModelProperty(value = "浠撳簱id") + // @ApiModelProperty(value = "浠撳簱id") private Long warehouseId; /** * 鍑哄簱鏃堕棿 */ - @ApiModelProperty(value = "鍑哄簱鏃堕棿") + // @ApiModelProperty(value = "鍑哄簱鏃堕棿") private Long dealTime; /** * 鍑哄簱鎵嬬画 */ - @ApiModelProperty(value = "鍑哄簱鎵嬬画") + // @ApiModelProperty(value = "鍑哄簱鎵嬬画") private String doc; /** * 璁板綍鐗╁搧淇℃伅鍜岃鏍煎瀷鍙� */ - @ApiModelProperty(value = "璁板綍鐗╁搧淇℃伅鍜岃鏍煎瀷鍙�") + // @ApiModelProperty(value = "璁板綍鐗╁搧淇℃伅鍜岃鏍煎瀷鍙�") private List<LWFormsOutputGoodsInfoParam> goods; diff --git a/consum-base/src/main/java/com/consum/base/pojo/LWhFormScrappedGoodsInfoParam.java b/consum-base/src/main/java/com/consum/base/pojo/LWhFormScrappedGoodsInfoParam.java index e4065cb..2f88c72 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/LWhFormScrappedGoodsInfoParam.java +++ b/consum-base/src/main/java/com/consum/base/pojo/LWhFormScrappedGoodsInfoParam.java @@ -1,7 +1,7 @@ package com.consum.base.pojo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; + + import java.util.List; import lombok.Data; @@ -12,7 +12,7 @@ * @date 2023/11/21 16:06 */ @Data -@ApiModel(value = "LWhFormScrappedGoodsInfoParam", description = "鎶ュ簾鍗曠墿鍝佷俊鎭�") +// @ApiModel(value = "LWhFormScrappedGoodsInfoParam", description = "鎶ュ簾鍗曠墿鍝佷俊鎭�") public class LWhFormScrappedGoodsInfoParam { /** @@ -23,7 +23,7 @@ * 鐗╁搧id */ private Long baseGoodsTemplateId; - @ApiModelProperty(value = "瑙勬牸鍨嬪彿缂栧彿") + // @ApiModelProperty(value = "瑙勬牸鍨嬪彿缂栧彿") private Long baseGoodsModelsId; /** * 鎶ュ簾鍗曠墿鍝� diff --git a/consum-base/src/main/java/com/consum/base/pojo/LWhFormScrappedGoodsModelParams.java b/consum-base/src/main/java/com/consum/base/pojo/LWhFormScrappedGoodsModelParams.java index 0edaa02..075642d 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/LWhFormScrappedGoodsModelParams.java +++ b/consum-base/src/main/java/com/consum/base/pojo/LWhFormScrappedGoodsModelParams.java @@ -1,10 +1,10 @@ package com.consum.base.pojo; -import io.swagger.annotations.ApiModel; + import lombok.Data; @Data -@ApiModel(value = "LWhFormScrappedGoodsParams", description = "鎶ュ簾鍟嗗搧鍙傛暟") +// @ApiModel(value = "LWhFormScrappedGoodsParams", description = "鎶ュ簾鍟嗗搧鍙傛暟") public class LWhFormScrappedGoodsModelParams { //瑙勬牸鍨嬪彿缂栧彿 diff --git a/consum-base/src/main/java/com/consum/base/pojo/LWhFormScrappedParam.java b/consum-base/src/main/java/com/consum/base/pojo/LWhFormScrappedParam.java index 42581d6..479095c 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/LWhFormScrappedParam.java +++ b/consum-base/src/main/java/com/consum/base/pojo/LWhFormScrappedParam.java @@ -1,46 +1,46 @@ package com.consum.base.pojo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; + + import lombok.Data; import java.util.List; @Data -@ApiModel(value = "鏂板鎶ュ簾鍗曚俊鎭�") +// @ApiModel(value = "鏂板鎶ュ簾鍗曚俊鎭�") public class LWhFormScrappedParam { /** * 鏈烘瀯id */ - @ApiModelProperty(value = "鏈烘瀯id") + // @ApiModelProperty(value = "鏈烘瀯id") private Long agencyId; - @ApiModelProperty(value = "閮ㄩ棬id") + // @ApiModelProperty(value = "閮ㄩ棬id") private Long departmentId; /** * 浠撳簱缂栧彿 */ - @ApiModelProperty(value = "浠撳簱缂栧彿") + // @ApiModelProperty(value = "浠撳簱缂栧彿") private Long warehouseId; /** * 鎿嶄綔浜� */ - @ApiModelProperty(value = "鎿嶄綔浜�") + // @ApiModelProperty(value = "鎿嶄綔浜�") private Long operatorId; /** * 鎶ュ簾鏃堕棿 */ - @ApiModelProperty(value = "鎶ュ簾鏃堕棿") + // @ApiModelProperty(value = "鎶ュ簾鏃堕棿") private Long dealTime; /** * 闄勪欢 */ - @ApiModelProperty(value = "闄勪欢") + // @ApiModelProperty(value = "闄勪欢") private String uploadFiles; - @ApiModelProperty(value = "鎶ュ簾鍟嗗搧淇℃伅") + // @ApiModelProperty(value = "鎶ュ簾鍟嗗搧淇℃伅") private List<LWhFormScrappedGoodsInfoParam> scrappedGoodsInfo; diff --git a/consum-base/src/main/java/com/consum/base/pojo/LWhFormTransferGoodsInfoParam.java b/consum-base/src/main/java/com/consum/base/pojo/LWhFormTransferGoodsInfoParam.java index f17066e..1df76b9 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/LWhFormTransferGoodsInfoParam.java +++ b/consum-base/src/main/java/com/consum/base/pojo/LWhFormTransferGoodsInfoParam.java @@ -1,7 +1,7 @@ package com.consum.base.pojo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; + + import java.util.List; import lombok.Data; @@ -12,7 +12,7 @@ * @Version 1.0 **/ @Data -@ApiModel(value = "璋冩嫧鍗曞瀷鍙�") +// @ApiModel(value = "璋冩嫧鍗曞瀷鍙�") public class LWhFormTransferGoodsInfoParam { // 涓婚敭 @@ -28,10 +28,10 @@ //渚涘簲鍟� private String supplier; - @ApiModelProperty(value = "鍗曟嵁绫诲瀷 1 閲囪喘2 璋冩嫧 3鍑哄簱4閮ㄩ棬鍒嗗彂") + // @ApiModelProperty(value = "鍗曟嵁绫诲瀷 1 閲囪喘2 璋冩嫧 3鍑哄簱4閮ㄩ棬鍒嗗彂") private Integer procureModelBusinessType; - @ApiModelProperty(value = "瑙勬牸鍨嬪彿缂栧彿") + // @ApiModelProperty(value = "瑙勬牸鍨嬪彿缂栧彿") private Long baseGoodsModelsId; private List<LWhTransferModelParam> models; diff --git a/consum-base/src/main/java/com/consum/base/pojo/LWhProcureModelParam.java b/consum-base/src/main/java/com/consum/base/pojo/LWhProcureModelParam.java index e8cb9ab..b8a772a 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/LWhProcureModelParam.java +++ b/consum-base/src/main/java/com/consum/base/pojo/LWhProcureModelParam.java @@ -1,7 +1,7 @@ package com.consum.base.pojo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; + + import java.util.List; import lombok.Data; @@ -11,27 +11,27 @@ * @Description * @Version 1.0 **/ -@ApiModel(value = "璋冩嫧鍗曡鏍煎瀷鍙�") +// @ApiModel(value = "璋冩嫧鍗曡鏍煎瀷鍙�") @Data public class LWhProcureModelParam { //瑙勬牸鍨嬪彿缂栧彿 - @ApiModelProperty(value = "瑙勬牸鍨嬪彿缂栧彿") + // @ApiModelProperty(value = "瑙勬牸鍨嬪彿缂栧彿") private Long baseGoodsModelsId; //浠锋牸 - @ApiModelProperty(value = "浠锋牸") + // @ApiModelProperty(value = "浠锋牸") private Long price; //鏁伴噺 - @ApiModelProperty(value = "鏁伴噺") + // @ApiModelProperty(value = "鏁伴噺") private Integer counts; // 鍗曟嵁绫诲瀷 1 閲囪喘2 璋冩嫧 3鍑哄簱4閮ㄩ棬鍒嗗彂 - @ApiModelProperty(value = "鍗曟嵁绫诲瀷 1 閲囪喘2 璋冩嫧 3鍑哄簱4閮ㄩ棬鍒嗗彂") + // @ApiModelProperty(value = "鍗曟嵁绫诲瀷 1 閲囪喘2 璋冩嫧 3鍑哄簱4閮ㄩ棬鍒嗗彂") private Integer procureModelBusinessType; // 璁¢噺鍗曚綅 - @ApiModelProperty(value = "璁¢噺鍗曚綅") + // @ApiModelProperty(value = "璁¢噺鍗曚綅") private String baseUnit; - @ApiModelProperty(value = "鐢ㄦ埛瑙勬牸鍨嬪彿") + // @ApiModelProperty(value = "鐢ㄦ埛瑙勬牸鍨嬪彿") private List<LWhProcureModelUserParam> procureModelUserList; } diff --git a/consum-base/src/main/java/com/consum/base/pojo/LWhProcureModelUserParam.java b/consum-base/src/main/java/com/consum/base/pojo/LWhProcureModelUserParam.java index ac1dea0..4bbebb3 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/LWhProcureModelUserParam.java +++ b/consum-base/src/main/java/com/consum/base/pojo/LWhProcureModelUserParam.java @@ -1,6 +1,6 @@ package com.consum.base.pojo; -import io.swagger.annotations.ApiModel; + import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; @@ -14,7 +14,7 @@ @Data @AllArgsConstructor @NoArgsConstructor -@ApiModel(value = "鐗╁搧鍒嗗彂浣跨敤浜轰俊鎭�") +// // @ApiModel(value = "鐗╁搧鍒嗗彂浣跨敤浜轰俊鎭�") public class LWhProcureModelUserParam { /** diff --git a/consum-base/src/main/java/com/consum/base/pojo/LWhTransferModelParam.java b/consum-base/src/main/java/com/consum/base/pojo/LWhTransferModelParam.java index 27ca891..6fab2fd 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/LWhTransferModelParam.java +++ b/consum-base/src/main/java/com/consum/base/pojo/LWhTransferModelParam.java @@ -1,7 +1,7 @@ package com.consum.base.pojo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; + + import java.util.List; import lombok.Data; @@ -12,31 +12,31 @@ * @description: 璋冩嫧鍗曡鏍煎瀷鍙� * @date 2023/11/6 9:28 */ -@ApiModel(value = "璋冩嫧鍗曡鏍煎瀷鍙�") +// @ApiModel(value = "璋冩嫧鍗曡鏍煎瀷鍙�") @Data public class LWhTransferModelParam { // //瑙勬牸鍨嬪彿缂栧彿 - @ApiModelProperty(value = "瑙勬牸鍨嬪彿缂栧彿") + // @ApiModelProperty(value = "瑙勬牸鍨嬪彿缂栧彿") private Long baseGoodsModelsId; - @ApiModelProperty(value = "瑙勬牸鍨嬪彿鍚嶅瓧") + // @ApiModelProperty(value = "瑙勬牸鍨嬪彿鍚嶅瓧") private String baseGoodsModelsName; //浠锋牸 - @ApiModelProperty(value = "浠锋牸") + // @ApiModelProperty(value = "浠锋牸") private Long price; //鏁伴噺 - @ApiModelProperty(value = "鏁伴噺") + // @ApiModelProperty(value = "鏁伴噺") private Integer counts; // 鍗曟嵁绫诲瀷 1 閲囪喘2 璋冩嫧 3鍑哄簱4閮ㄩ棬鍒嗗彂 - @ApiModelProperty(value = "鍗曟嵁绫诲瀷 1 閲囪喘2 璋冩嫧 3鍑哄簱4閮ㄩ棬鍒嗗彂") + // @ApiModelProperty(value = "鍗曟嵁绫诲瀷 1 閲囪喘2 璋冩嫧 3鍑哄簱4閮ㄩ棬鍒嗗彂") private Integer procureModelBusinessType; // 璁¢噺鍗曚綅 - @ApiModelProperty(value = "璁¢噺鍗曚綅") + // @ApiModelProperty(value = "璁¢噺鍗曚綅") private String baseUnit; - @ApiModelProperty(value = "鍓╀綑鏁伴噺") + // @ApiModelProperty(value = "鍓╀綑鏁伴噺") private Integer num; - @ApiModelProperty(value = "鐢ㄦ埛瑙勬牸鍨嬪彿") + // @ApiModelProperty(value = "鐢ㄦ埛瑙勬牸鍨嬪彿") private List<LWhProcureModelUserParam> procureModelUserList; } diff --git a/consum-base/src/main/java/com/consum/base/pojo/WarehouseManagerInfo.java b/consum-base/src/main/java/com/consum/base/pojo/WarehouseManagerInfo.java index fb0f337..34f586e 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/WarehouseManagerInfo.java +++ b/consum-base/src/main/java/com/consum/base/pojo/WarehouseManagerInfo.java @@ -1,7 +1,5 @@ package com.consum.base.pojo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** @@ -11,12 +9,12 @@ * @date 2023/11/17 13:07 */ @Data -@ApiModel(value = "搴撶鍛樹俊鎭�") +// @ApiModel(value = "搴撶鍛樹俊鎭�") public class WarehouseManagerInfo { - @ApiModelProperty(value = "搴撶鍛榠d") + // @ApiModelProperty(value = "搴撶鍛榠d") private Long managerId; - @ApiModelProperty(value = "搴撶鍛樺鍚�") + // @ApiModelProperty(value = "搴撶鍛樺鍚�") private String managerName; } diff --git a/consum-base/src/main/java/com/consum/base/pojo/WarnConfImEntity.java b/consum-base/src/main/java/com/consum/base/pojo/WarnConfImEntity.java index 690da82..a2e82b0 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/WarnConfImEntity.java +++ b/consum-base/src/main/java/com/consum/base/pojo/WarnConfImEntity.java @@ -3,7 +3,7 @@ import cn.afterturn.easypoi.excel.annotation.Excel; import cn.afterturn.easypoi.handler.inter.IExcelDataModel; import cn.afterturn.easypoi.handler.inter.IExcelModel; -import io.swagger.annotations.ApiModelProperty; + import lombok.Data; /** @@ -16,33 +16,33 @@ @Data public class WarnConfImEntity implements IExcelDataModel, IExcelModel { - @ApiModelProperty("浠撳簱鍚嶇О") + // @ApiModelProperty("浠撳簱鍚嶇О") @Excel(name = "浠撳簱鍚嶇О") private String warehouseName; @Excel(name = "鐗╁搧鍚嶇О") - @ApiModelProperty(value = "鐗╁搧鍚嶇О") + // @ApiModelProperty(value = "鐗╁搧鍚嶇О") private String goodsTemplateName; @Excel(name = "鍨嬪彿鍚嶇О") - @ApiModelProperty("鍨嬪彿鍚嶇О") + // @ApiModelProperty("鍨嬪彿鍚嶇О") private String goodsModelName; @Excel(name = "淇濆簳搴撳瓨") - @ApiModelProperty("淇濆簳搴撳瓨") + // @ApiModelProperty("淇濆簳搴撳瓨") private Integer lowerLimit; @Excel(name = "灏侀《搴撳瓨") - @ApiModelProperty("灏侀《搴撳瓨") + // @ApiModelProperty("灏侀《搴撳瓨") private Integer upperLimit; - @ApiModelProperty("鐗╁搧id") + // @ApiModelProperty("鐗╁搧id") private Long goodsTemplateId; - @ApiModelProperty("浠撳簱id") + // @ApiModelProperty("浠撳簱id") private Long baseWarehouseId; - @ApiModelProperty("鐗╁搧鍨嬪彿id") + // @ApiModelProperty("鐗╁搧鍨嬪彿id") private Long baseGoodsModelsId; diff --git a/consum-base/src/main/java/com/consum/base/pojo/WhWarningConfigParam.java b/consum-base/src/main/java/com/consum/base/pojo/WhWarningConfigParam.java index 8bbc0e7..edb720b 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/WhWarningConfigParam.java +++ b/consum-base/src/main/java/com/consum/base/pojo/WhWarningConfigParam.java @@ -1,6 +1,6 @@ package com.consum.base.pojo; -import io.swagger.annotations.ApiModelProperty; + import lombok.Data; /** @@ -12,10 +12,10 @@ **/ @Data public class WhWarningConfigParam { - @ApiModelProperty("浠撳簱绫诲瀷") + // @ApiModelProperty("浠撳簱绫诲瀷") private Long warehouseType; - @ApiModelProperty("浠撳簱id") + // @ApiModelProperty("浠撳簱id") private Long baseWarehouseId; private Long baseGoodsTemplateId; diff --git a/consum-base/src/main/java/com/consum/base/pojo/query/FormProcureQry.java b/consum-base/src/main/java/com/consum/base/pojo/query/FormProcureQry.java index 28e426d..9989143 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/query/FormProcureQry.java +++ b/consum-base/src/main/java/com/consum/base/pojo/query/FormProcureQry.java @@ -1,8 +1,8 @@ package com.consum.base.pojo.query; import com.fasterxml.jackson.annotation.JsonFormat; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; + + import lombok.Data; /** @@ -11,64 +11,64 @@ * @description: 閲囪喘鏌ヨ鏉′欢 * @date 2023/11/10 16:51 */ -@ApiModel(value = "閲囪喘鏌ヨ鏉′欢") +// @ApiModel(value = "閲囪喘鏌ヨ鏉′欢") @Data public class FormProcureQry { - @ApiModelProperty(value = "涓婚敭") + // @ApiModelProperty(value = "涓婚敭") private Long id; /** * 浠撳簱缂栧彿 */ - @ApiModelProperty(value = "浠撳簱缂栧彿") + // @ApiModelProperty(value = "浠撳簱缂栧彿") private Long warehouseId; /** * 鍏ュ簱鍗曞彿 */ - @ApiModelProperty(value = "鍏ュ簱鍗曞彿") + // @ApiModelProperty(value = "鍏ュ簱鍗曞彿") private String businessFormCode; /** * 鐗╁搧妯$増鍚嶇О */ - @ApiModelProperty(value = "鐗╁搧妯$増鍚嶇О") + // @ApiModelProperty(value = "鐗╁搧妯$増鍚嶇О") private String goodsTemplateName; /** * 鏈烘瀯 */ - @ApiModelProperty(value = "鏈烘瀯") + // @ApiModelProperty(value = "鏈烘瀯") private Long agencyId; /** * 鍒涘缓浜� */ - @ApiModelProperty(value = "鍒涘缓浜�") + // @ApiModelProperty(value = "鍒涘缓浜�") private String createName; /** * 1=寰呭叆搴擄紱2=宸插叆搴� */ - @ApiModelProperty(value = "1=寰呭叆搴擄紱2=宸插叆搴�") + // @ApiModelProperty(value = "1=寰呭叆搴擄紱2=宸插叆搴�") private Integer states; /** * 鍏ュ簱鏃堕棿 寮�濮� */ - @ApiModelProperty(value = "鍏ュ簱鏃堕棿 寮�濮�") + // @ApiModelProperty(value = "鍏ュ簱鏃堕棿 寮�濮�") @JsonFormat(pattern = "yyyyMMdd", timezone = "GMT+8") private Long startTime; /** * 鍏ュ簱鏃堕棿 缁撴潫 */ - @ApiModelProperty(value = "鍏ュ簱鏃堕棿 缁撴潫") + // @ApiModelProperty(value = "鍏ュ簱鏃堕棿 缁撴潫") @JsonFormat(pattern = "yyyyMMdd", timezone = "GMT+8") private Long endTime; /** * 瑙勬牸鍨嬪彿id */ - @ApiModelProperty(value = "瑙勬牸鍨嬪彿id") + // @ApiModelProperty(value = "瑙勬牸鍨嬪彿id") private Long baseGoodsModelsId; - @ApiModelProperty(value = "姣忛〉鏄剧ず鏉℃暟") + // @ApiModelProperty(value = "姣忛〉鏄剧ず鏉℃暟") private Integer pageSize = 10; - @ApiModelProperty(value = "褰撳墠椤垫暟") + // @ApiModelProperty(value = "褰撳墠椤垫暟") private Integer pageNum = 1; } diff --git a/consum-base/src/main/java/com/consum/base/pojo/query/LDeptFormScrappedQry.java b/consum-base/src/main/java/com/consum/base/pojo/query/LDeptFormScrappedQry.java index 0f83176..b442baf 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/query/LDeptFormScrappedQry.java +++ b/consum-base/src/main/java/com/consum/base/pojo/query/LDeptFormScrappedQry.java @@ -1,6 +1,5 @@ package com.consum.base.pojo.query; -import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** @@ -42,10 +41,10 @@ */ private String agencyId; - @ApiModelProperty("瑙勬牸鍨嬪彿") + // @ApiModelProperty("瑙勬牸鍨嬪彿") private Long baseGoodsModelsId; - @ApiModelProperty("閮ㄩ棬ID") + // @ApiModelProperty("閮ㄩ棬ID") private Long departmentId; private Integer pageSize = 10; diff --git a/consum-base/src/main/java/com/consum/base/pojo/query/LWhFormInventoryQry.java b/consum-base/src/main/java/com/consum/base/pojo/query/LWhFormInventoryQry.java index ef266c5..512423c 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/query/LWhFormInventoryQry.java +++ b/consum-base/src/main/java/com/consum/base/pojo/query/LWhFormInventoryQry.java @@ -1,10 +1,9 @@ package com.consum.base.pojo.query; -import io.swagger.annotations.ApiModel; import lombok.Data; @Data -@ApiModel(value = "鐩樼偣鍗曟潯浠跺弬鏁�") +// @ApiModel(value = "鐩樼偣鍗曟潯浠跺弬鏁�") public class LWhFormInventoryQry { private Long id; diff --git a/consum-base/src/main/java/com/consum/base/pojo/query/LWhFormOutputQry.java b/consum-base/src/main/java/com/consum/base/pojo/query/LWhFormOutputQry.java index 4d2e391..aa9df23 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/query/LWhFormOutputQry.java +++ b/consum-base/src/main/java/com/consum/base/pojo/query/LWhFormOutputQry.java @@ -1,7 +1,5 @@ package com.consum.base.pojo.query; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** @@ -10,51 +8,51 @@ * @Date 2023/10/27 */ @Data -@ApiModel(value = "鍑哄簱鍗曞弬鏁�") +// @ApiModel(value = "鍑哄簱鍗曞弬鏁�") public class LWhFormOutputQry { - @ApiModelProperty(value = "涓婚敭") + // @ApiModelProperty(value = "涓婚敭") private Long id; /** * 浠撳簱缂栧彿 */ - @ApiModelProperty(value = "浠撳簱缂栧彿") + // @ApiModelProperty(value = "浠撳簱缂栧彿") private Long warehouseId; /** * 鍏ュ簱鍗曞彿 */ - @ApiModelProperty(value = "鍏ュ簱鍗曞彿") + // @ApiModelProperty(value = "鍏ュ簱鍗曞彿") private String businessFormCode; /** * 鐗╁搧妯$増鍚嶇О */ - @ApiModelProperty(value = "鐗╁搧妯$増鍚嶇О") + // @ApiModelProperty(value = "鐗╁搧妯$増鍚嶇О") private String goodsTempName; /** * 鐗╁搧妯$増鍚嶇О */ - @ApiModelProperty(value = "鐗╁搧妯$増id") + // @ApiModelProperty(value = "鐗╁搧妯$増id") private String goodsTemplateId; /** * 鐗╁搧妯$増鍚嶇О */ - @ApiModelProperty(value = "鐗╁搧妯$増鍚嶇О") + // @ApiModelProperty(value = "鐗╁搧妯$増鍚嶇О") private String goodsName; /** * 鐗╁搧妯$増鍚嶇О */ - @ApiModelProperty(value = "鐗╁搧妯$増id") + // @ApiModelProperty(value = "鐗╁搧妯$増id") private String baseGoodsId; /** * 鏈烘瀯 */ - @ApiModelProperty(value = "鏈烘瀯") + // @ApiModelProperty(value = "鏈烘瀯") private Long agencyId; /** * 鍒涘缓浜� */ - @ApiModelProperty(value = "鍒涘缓浜�") + // @ApiModelProperty(value = "鍒涘缓浜�") private String createName; /** * 閲囪喘鍏ュ簱 map.put("1" + "1", "1") @@ -65,31 +63,31 @@ * 閫�杩樺叆搴� map.put("4" + "1", "6") * 鐢抽鍑哄簱 map.put("4" + "2", "7") */ - @ApiModelProperty(value = "1閲囪喘鍏ュ簱 2閫�杩樺叆搴� 3璋冩嫧鍏ュ簱 4鐩樼泩鍏ュ簱 5鐢抽鍑哄簱 6璋冩嫧鍑哄簱 7鐩樹簭鍑哄簱 8鎶ュ簾鍑哄簱 9鍏朵粬鍑哄簱") + // @ApiModelProperty(value = "1閲囪喘鍏ュ簱 2閫�杩樺叆搴� 3璋冩嫧鍏ュ簱 4鐩樼泩鍏ュ簱 5鐢抽鍑哄簱 6璋冩嫧鍑哄簱 7鐩樹簭鍑哄簱 8鎶ュ簾鍑哄簱 9鍏朵粬鍑哄簱") private Integer flowType; - @ApiModelProperty(value = "鐘舵��") + // @ApiModelProperty(value = "鐘舵��") private Integer states; /** * 鍏ュ簱鏃堕棿 寮�濮� */ - @ApiModelProperty(value = "寮�濮嬫椂闂�") + // @ApiModelProperty(value = "寮�濮嬫椂闂�") private Long startTime; /** * 鍏ュ簱鏃堕棿 缁撴潫 */ - @ApiModelProperty(value = "缁撴潫鏃堕棿") + // @ApiModelProperty(value = "缁撴潫鏃堕棿") private Long endTime; /** * 瑙勬牸鍨嬪彿id */ - @ApiModelProperty(value = "瑙勬牸鍨嬪彿id") + // @ApiModelProperty(value = "瑙勬牸鍨嬪彿id") private Long baseGoodsModelsId; - @ApiModelProperty(value = "姣忛〉鏄剧ず鏉℃暟") + // @ApiModelProperty(value = "姣忛〉鏄剧ず鏉℃暟") private Integer pageSize = 10; - @ApiModelProperty(value = "褰撳墠椤垫暟") + // @ApiModelProperty(value = "褰撳墠椤垫暟") private Integer pageNum = 1; } diff --git a/consum-base/src/main/java/com/consum/base/pojo/query/LWhFormScrappedQry.java b/consum-base/src/main/java/com/consum/base/pojo/query/LWhFormScrappedQry.java index 72f98d8..e71b133 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/query/LWhFormScrappedQry.java +++ b/consum-base/src/main/java/com/consum/base/pojo/query/LWhFormScrappedQry.java @@ -1,6 +1,6 @@ package com.consum.base.pojo.query; -import io.swagger.annotations.ApiModel; + import lombok.Data; /** @@ -10,7 +10,7 @@ * @date 2023/11/21 15:00 */ @Data -@ApiModel(value = "LWhFormScrappedQry", description = "鎶ュ簾鍗曟煡璇㈡潯浠�") +// @ApiModel(value = "LWhFormScrappedQry", description = "鎶ュ簾鍗曟煡璇㈡潯浠�") public class LWhFormScrappedQry { /** diff --git a/consum-base/src/main/java/com/consum/base/pojo/query/LWhGoodsStatisQry.java b/consum-base/src/main/java/com/consum/base/pojo/query/LWhGoodsStatisQry.java index ba9feb0..51d7e6c 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/query/LWhGoodsStatisQry.java +++ b/consum-base/src/main/java/com/consum/base/pojo/query/LWhGoodsStatisQry.java @@ -1,7 +1,7 @@ package com.consum.base.pojo.query; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; + + import lombok.Data; /** @@ -11,35 +11,35 @@ * @Description * @Version 1.0 **/ -@ApiModel(value = "鐗╁搧缁熻鏌ヨ鍙傛暟") +// @ApiModel(value = "鐗╁搧缁熻鏌ヨ鍙傛暟") @Data public class LWhGoodsStatisQry { - @ApiModelProperty(value = "鏈烘瀯") + // @ApiModelProperty(value = "鏈烘瀯") private Long agencyId; - @ApiModelProperty(value = "閮ㄩ棬id") + // @ApiModelProperty(value = "閮ㄩ棬id") private Long departmentId; - @ApiModelProperty("浠撳簱id") + // @ApiModelProperty("浠撳簱id") private Long baseWarehouseId; - @ApiModelProperty(value = "鐗╁搧鍚嶇О") + // @ApiModelProperty(value = "鐗╁搧鍚嶇О") private String goodsTemplateName; private Long goodsTemplateId; - @ApiModelProperty(value = "瑙勬牸鍨嬪彿") + // @ApiModelProperty(value = "瑙勬牸鍨嬪彿") private String baseGoodsModelsName; - @ApiModelProperty("瑙勬牸鍨嬪彿") + // @ApiModelProperty("瑙勬牸鍨嬪彿") private Long baseGoodsModelsId; - @ApiModelProperty("浠峰�肩被鍨�") + // @ApiModelProperty("浠峰�肩被鍨�") private Short costType; - @ApiModelProperty(value = "鎿嶄綔鏃堕棿") + // @ApiModelProperty(value = "鎿嶄綔鏃堕棿") private Long dealTimeStart; - @ApiModelProperty(value = "鎿嶄綔鏃堕棿") + // @ApiModelProperty(value = "鎿嶄綔鏃堕棿") private Long dealTimeEnd; } diff --git a/consum-base/src/main/java/com/consum/base/pojo/query/LWhLedgerQry.java b/consum-base/src/main/java/com/consum/base/pojo/query/LWhLedgerQry.java index 229a3fa..848f78f 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/query/LWhLedgerQry.java +++ b/consum-base/src/main/java/com/consum/base/pojo/query/LWhLedgerQry.java @@ -1,8 +1,6 @@ package com.consum.base.pojo.query; import com.walker.web.param.ParamRequest; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.List; @@ -15,38 +13,38 @@ * @Version 1.0 **/ @Data -@ApiModel(value = "鏈烘瀯鍙拌处鍙傛暟") +// @ApiModel(value = "鏈烘瀯鍙拌处鍙傛暟") public class LWhLedgerQry extends ParamRequest { - @ApiModelProperty("鏈烘瀯") + // @ApiModelProperty("鏈烘瀯") private Long agencyId; - @ApiModelProperty("閮ㄩ棬ID") + // @ApiModelProperty("閮ㄩ棬ID") private Long departmentId; - @ApiModelProperty("浠撳簱绫诲瀷") + // @ApiModelProperty("浠撳簱绫诲瀷") private Short warehouseType; - @ApiModelProperty("浠撳簱id") + // @ApiModelProperty("浠撳簱id") private Long warehouseId; - @ApiModelProperty("鐗╁搧鍚嶇О") + // @ApiModelProperty("鐗╁搧鍚嶇О") private String goodsTemplateName; private Long goodsTemplateId; - @ApiModelProperty("鍒嗙被") + // @ApiModelProperty("鍒嗙被") private Long categoryId; - @ApiModelProperty("浠峰�肩被鍨�") + // @ApiModelProperty("浠峰�肩被鍨�") private Short costType; - @ApiModelProperty("鐘舵�侊紙0=鍦ㄩ�旇皟鎷紱1=鍏ュ簱鏈垎鍙戯紱2=宸蹭笅鍙戯紱3=鎶ュ簾 4 闆舵槦鍑哄簱锛�") + // @ApiModelProperty("鐘舵�侊紙0=鍦ㄩ�旇皟鎷紱1=鍏ュ簱鏈垎鍙戯紱2=宸蹭笅鍙戯紱3=鎶ュ簾 4 闆舵槦鍑哄簱锛�") private Short states; private List<Short> statesList; - @ApiModelProperty(value = "姣忛〉鏄剧ず鏉℃暟") + // @ApiModelProperty(value = "姣忛〉鏄剧ず鏉℃暟") private Integer pageSize = 10; - @ApiModelProperty(value = "褰撳墠椤垫暟") + // @ApiModelProperty(value = "褰撳墠椤垫暟") private Integer pageNum = 1; } diff --git a/consum-base/src/main/java/com/consum/base/pojo/query/LWhProcureModelQry.java b/consum-base/src/main/java/com/consum/base/pojo/query/LWhProcureModelQry.java index 871c225..e4a11d2 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/query/LWhProcureModelQry.java +++ b/consum-base/src/main/java/com/consum/base/pojo/query/LWhProcureModelQry.java @@ -1,8 +1,8 @@ package com.consum.base.pojo.query; import com.walker.web.param.ParamRequest; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; + + import lombok.Data; /** @@ -13,16 +13,16 @@ * @Version 1.0 **/ @Data -@ApiModel(value = "鍙傛暟") +// @ApiModel(value = "鍙傛暟") public class LWhProcureModelQry extends ParamRequest { - @ApiModelProperty("鐗╁搧鍚嶇О") + // @ApiModelProperty("鐗╁搧鍚嶇О") private String goodsTemplateName; private Long baseGoodsTemplateId; - @ApiModelProperty("閮ㄩ棬ID") + // @ApiModelProperty("閮ㄩ棬ID") private Long departmentId; - @ApiModelProperty("鍒嗗彂鍗旾D") + // @ApiModelProperty("鍒嗗彂鍗旾D") private Long transBusinessId; } diff --git a/consum-base/src/main/java/com/consum/base/pojo/query/TransferQry.java b/consum-base/src/main/java/com/consum/base/pojo/query/TransferQry.java index afcef93..8b45311 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/query/TransferQry.java +++ b/consum-base/src/main/java/com/consum/base/pojo/query/TransferQry.java @@ -1,7 +1,7 @@ package com.consum.base.pojo.query; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; + + import lombok.Data; /** @@ -10,88 +10,88 @@ * @description: 璋冩嫧鍗曟煡璇㈡潯浠� * @date 2023/11/6 11:47 */ -@ApiModel(value = "璋冩嫧鍗曟煡璇㈡潯浠�") +// @ApiModel(value = "璋冩嫧鍗曟煡璇㈡潯浠�") @Data public class TransferQry { /** * 璋冩嫧鍗曞彿/鍒嗗彂鍗曞彿 */ - @ApiModelProperty(value = "璋冩嫧鍗曞彿/鍒嗗彂鍗曞彿") + // @ApiModelProperty(value = "璋冩嫧鍗曞彿/鍒嗗彂鍗曞彿") private String businessFormCode; /** * 鐗╁搧妯$増鍚嶇О */ - @ApiModelProperty(value = "鐗╁搧妯$増鍚嶇О") + // @ApiModelProperty(value = "鐗╁搧妯$増鍚嶇О") private String goodsTemplateName; /** * 鐗╁搧妯$増id */ - @ApiModelProperty(value = "鐗╁搧妯$増id") + // @ApiModelProperty(value = "鐗╁搧妯$増id") private Long goodsTemplateId; /** * 鍑哄簱浠撳簱鏈烘瀯缂栧彿锛堣皟鎷ㄦ満鏋勶級 */ - @ApiModelProperty(value = "鍑哄簱浠撳簱鏈烘瀯缂栧彿锛堣皟鎷ㄦ満鏋勶級") + // @ApiModelProperty(value = "鍑哄簱浠撳簱鏈烘瀯缂栧彿锛堣皟鎷ㄦ満鏋勶級") private Long outAgencyId; /** * 鎺ユ敹鏈烘瀯 */ - @ApiModelProperty(value = "鎺ユ敹鏈烘瀯") + // @ApiModelProperty(value = "鎺ユ敹鏈烘瀯") private Long inAgencyId; /** * 鐘舵�� 0=寰呭嚭搴擄紱1=寰呮帴鏀讹紱2=宸插叆搴撳簱:4=宸叉挙閿� */ - @ApiModelProperty(value = "鐘舵�� 0=寰呭嚭搴擄紱1=寰呮帴鏀讹紱2=宸插叆搴撳簱:4=宸叉挙閿�") + // @ApiModelProperty(value = "鐘舵�� 0=寰呭嚭搴擄紱1=寰呮帴鏀讹紱2=宸插叆搴撳簱:4=宸叉挙閿�") private Short states; /** * 鍒涘缓浜�/鍒嗗彂浜� */ - @ApiModelProperty(value = "鍒涘缓浜�/鍒嗗彂浜�") + // @ApiModelProperty(value = "鍒涘缓浜�/鍒嗗彂浜�") private String operatorName; /** * 鐢宠鏃堕棿 寮�濮� */ - @ApiModelProperty(value = "鐢宠鏃堕棿 寮�濮�") + // @ApiModelProperty(value = "鐢宠鏃堕棿 寮�濮�") private Long createTimeStart; /** * 鐢宠鏃堕棿 缁撴潫 */ - @ApiModelProperty(value = "鐢宠鏃堕棿 缁撴潫") + // @ApiModelProperty(value = "鐢宠鏃堕棿 缁撴潫") private Long createTimeEnd; /** * 鎺ユ敹鏃堕棿 寮�濮� */ - @ApiModelProperty(value = "鎺ユ敹鏃堕棿 寮�濮�") + // @ApiModelProperty(value = "鎺ユ敹鏃堕棿 寮�濮�") private Long startTime; /** * 鎺ユ敹鏃堕棿 缁撴潫 */ - @ApiModelProperty(value = "鎺ユ敹鏃堕棿 缁撴潫") + // @ApiModelProperty(value = "鎺ユ敹鏃堕棿 缁撴潫") private Long endTime; /** * 瑙勬牸鍨嬪彿id */ - @ApiModelProperty(value = "瑙勬牸鍨嬪彿id") + // @ApiModelProperty(value = "瑙勬牸鍨嬪彿id") private Long baseGoodsModelsId; /** * 椤电爜 */ - @ApiModelProperty(value = "椤电爜") + // @ApiModelProperty(value = "椤电爜") private Integer pageNum; /** * 椤靛ぇ灏� */ - @ApiModelProperty(value = "椤靛ぇ灏�") + // @ApiModelProperty(value = "椤靛ぇ灏�") private Integer pageSize; - @ApiModelProperty(value = "鏌ヨ绫诲瀷") + // @ApiModelProperty(value = "鏌ヨ绫诲瀷") private Integer qryType; - @ApiModelProperty(value = "鍒嗗彂閮ㄩ棬,閮ㄩ棬鍒嗗彂鏃朵粨搴搃d灏辨槸鍒嗗彂閮ㄩ棬") + // @ApiModelProperty(value = "鍒嗗彂閮ㄩ棬,閮ㄩ棬鍒嗗彂鏃朵粨搴搃d灏辨槸鍒嗗彂閮ㄩ棬") private Long departmentId; } diff --git a/consum-base/src/main/java/com/consum/base/pojo/query/UsingFormBackQry.java b/consum-base/src/main/java/com/consum/base/pojo/query/UsingFormBackQry.java index 843c2b8..b5cf7f5 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/query/UsingFormBackQry.java +++ b/consum-base/src/main/java/com/consum/base/pojo/query/UsingFormBackQry.java @@ -2,8 +2,8 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; + + import lombok.Data; /** @@ -13,67 +13,67 @@ * @date 2023/12/1 15:32 */ @Data -@ApiModel +// @ApiModel @JsonIgnoreProperties(ignoreUnknown = true) public class UsingFormBackQry { - @ApiModelProperty(value = "涓婚敭") + // @ApiModelProperty(value = "涓婚敭") private Long id; /** * 閫�鍥炲崟鍙� */ - @ApiModelProperty(value = "閫�鍥炲崟鍙�") + // @ApiModelProperty(value = "閫�鍥炲崟鍙�") private String businessFormCode; /** * 鍒嗗彂閮ㄩ棬id */ - @ApiModelProperty(value = "鍒嗗彂閮ㄩ棬id") + // @ApiModelProperty(value = "鍒嗗彂閮ㄩ棬id") private Long departmentId; /** * 鐗╁搧妯$増鍚嶇О */ - @ApiModelProperty(value = "鐗╁搧妯$増鍚嶇О") + // @ApiModelProperty(value = "鐗╁搧妯$増鍚嶇О") private String goodsTemplateName; /** * 鐗╁搧妯$増id */ - @ApiModelProperty(value = "鐗╁搧妯$増id") + // @ApiModelProperty(value = "鐗╁搧妯$増id") private String goodsTemplateId; /** * 寮�濮嬫椂闂� */ - @ApiModelProperty(value = "寮�濮嬫椂闂�") + // @ApiModelProperty(value = "寮�濮嬫椂闂�") private Long startTime; /** * 缁撴潫鏃堕棿 */ - @ApiModelProperty(value = "缁撴潫鏃堕棿") + // @ApiModelProperty(value = "缁撴潫鏃堕棿") private Long endTime; /** * 瑙勬牸鍨嬪彿id */ - @ApiModelProperty(value = "瑙勬牸鍨嬪彿id") + // @ApiModelProperty(value = "瑙勬牸鍨嬪彿id") private Long baseGoodsModelsId; /** * 鏈烘瀯 */ - @ApiModelProperty(value = "鏈烘瀯") + // @ApiModelProperty(value = "鏈烘瀯") private Long agencyId; /** * 鍒涘缓浜� */ - @ApiModelProperty(value = "鍒涘缓浜�") + // @ApiModelProperty(value = "鍒涘缓浜�") private String createName; /** * 椤电爜 */ - @ApiModelProperty(value = "椤电爜") + // @ApiModelProperty(value = "椤电爜") private Integer pageNum; /** * 椤靛ぇ灏� */ - @ApiModelProperty(value = "椤靛ぇ灏�") + // @ApiModelProperty(value = "椤靛ぇ灏�") private Integer pageSize; } diff --git a/consum-base/src/main/java/com/consum/base/pojo/query/WarehouseQry.java b/consum-base/src/main/java/com/consum/base/pojo/query/WarehouseQry.java index c3a28f7..744c49c 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/query/WarehouseQry.java +++ b/consum-base/src/main/java/com/consum/base/pojo/query/WarehouseQry.java @@ -1,7 +1,7 @@ package com.consum.base.pojo.query; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; + + import javax.validation.constraints.NotNull; import lombok.Data; @@ -12,24 +12,24 @@ * @date 2023/11/16 10:18 */ @Data -@ApiModel(value = "搴撳瓨鏌ヨ鏉′欢") +// @ApiModel(value = "搴撳瓨鏌ヨ鏉′欢") public class WarehouseQry { - @ApiModelProperty(value = "浠撳簱id") + // @ApiModelProperty(value = "浠撳簱id") private Long warehouseId; - @ApiModelProperty(value = "鍟嗗搧鍨嬪彿id") + // @ApiModelProperty(value = "鍟嗗搧鍨嬪彿id") @NotNull(message = "鍟嗗搧鍨嬪彿id涓嶈兘涓虹┖") private Long baseGoodsModelsId; //浠撳簱绫诲瀷 0鏈烘瀯1閮ㄩ棬 - @ApiModelProperty(value = "浠撳簱绫诲瀷 0鏈烘瀯1閮ㄩ棬") + // @ApiModelProperty(value = "浠撳簱绫诲瀷 0鏈烘瀯1閮ㄩ棬") private Integer warehouseType; //锛�0=鍦ㄩ�旇皟鎷紱1=鍏ュ簱鏈垎鍙戯紱2=宸蹭笅鍙戯紱3=鎶ュ簾锛� - @ApiModelProperty(value = "锛�0=鍦ㄩ�旇皟鎷紱1=鍏ュ簱鏈垎鍙戯紱2=宸蹭笅鍙戯紱3=鎶ュ簾锛�") + // @ApiModelProperty(value = "锛�0=鍦ㄩ�旇皟鎷紱1=鍏ュ簱鏈垎鍙戯紱2=宸蹭笅鍙戯紱3=鎶ュ簾锛�") private Integer states; //閲囪喘鏂瑰紡锛�1锛氶泦閲囷紱2=鑷噰锛� - @ApiModelProperty(value = "閲囪喘鏂瑰紡锛�1锛氶泦閲囷紱2=鑷噰锛�") + // @ApiModelProperty(value = "閲囪喘鏂瑰紡锛�1锛氶泦閲囷紱2=鑷噰锛�") private Integer buyType; - @ApiModelProperty(value = "鏈烘瀯id") + // @ApiModelProperty(value = "鏈烘瀯id") private Long agencyId; } diff --git a/consum-base/src/main/java/com/consum/base/pojo/query/WhWarningConfigQry.java b/consum-base/src/main/java/com/consum/base/pojo/query/WhWarningConfigQry.java index 3706be7..764c439 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/query/WhWarningConfigQry.java +++ b/consum-base/src/main/java/com/consum/base/pojo/query/WhWarningConfigQry.java @@ -1,8 +1,8 @@ package com.consum.base.pojo.query; import com.walker.web.param.ParamRequest; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; + + import lombok.Data; /** @@ -12,7 +12,7 @@ * @Description * @Version 1.0 **/ -@ApiModel(value = "棰勮璁剧疆鏌ヨ鍙傛暟") +// @ApiModel(value = "棰勮璁剧疆鏌ヨ鍙傛暟") @Data public class WhWarningConfigQry extends ParamRequest { // 涓婚敭 @@ -20,26 +20,26 @@ private Long baseGoodsTemplateId; private Long baseGoodsModelsId; private Integer goodsType; - @ApiModelProperty("鏈烘瀯") + // @ApiModelProperty("鏈烘瀯") private Long agencyId; - @ApiModelProperty("浠撳簱绫诲瀷") + // @ApiModelProperty("浠撳簱绫诲瀷") private Long warehouseType; - @ApiModelProperty("浠撳簱id") + // @ApiModelProperty("浠撳簱id") private Long baseWarehouseId; - @ApiModelProperty("鐗╁搧鍚嶇О") + // @ApiModelProperty("鐗╁搧鍚嶇О") private String goodsTemplateName; - @ApiModelProperty("鍒嗙被") + // @ApiModelProperty("鍒嗙被") private Long categoryId; - @ApiModelProperty("浠峰�肩被鍨�") + // @ApiModelProperty("浠峰�肩被鍨�") private Short costType; - @ApiModelProperty(value = "姣忛〉鏄剧ず鏉℃暟") + // @ApiModelProperty(value = "姣忛〉鏄剧ず鏉℃暟") private Integer pageSize = 10; - @ApiModelProperty(value = "褰撳墠椤垫暟") + // @ApiModelProperty(value = "褰撳墠椤垫暟") private Integer pageNum = 1; } diff --git a/consum-base/src/main/java/com/consum/base/pojo/query/WhWarningQry.java b/consum-base/src/main/java/com/consum/base/pojo/query/WhWarningQry.java index 4495408..935fb47 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/query/WhWarningQry.java +++ b/consum-base/src/main/java/com/consum/base/pojo/query/WhWarningQry.java @@ -1,8 +1,8 @@ package com.consum.base.pojo.query; import com.walker.web.param.ParamRequest; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; + + import lombok.Data; /** @@ -12,40 +12,40 @@ * @Description * @Version 1.0 **/ -@ApiModel(value = "棰勮璁剧疆鏌ヨ鍙傛暟") +// @ApiModel(value = "棰勮璁剧疆鏌ヨ鍙傛暟") @Data public class WhWarningQry extends ParamRequest { - @ApiModelProperty("鐗╁搧鍚嶇О") + // @ApiModelProperty("鐗╁搧鍚嶇О") private String goodsTemplateName; private String goodsTemplateId; - @ApiModelProperty("瑙勬牸鍨嬪彿") + // @ApiModelProperty("瑙勬牸鍨嬪彿") private Long baseGoodsModelsId; - @ApiModelProperty("鍒嗙被") + // @ApiModelProperty("鍒嗙被") private Long categoryId; - @ApiModelProperty("浠峰�肩被鍨�") + // @ApiModelProperty("浠峰�肩被鍨�") private Short costType; - @ApiModelProperty("鏈烘瀯") + // @ApiModelProperty("鏈烘瀯") private Long agencyId; - @ApiModelProperty("浠撳簱绫诲瀷") + // @ApiModelProperty("浠撳簱绫诲瀷") private Short warehouseType; - @ApiModelProperty("浠撳簱id") + // @ApiModelProperty("浠撳簱id") private Long baseWarehouseId; - @ApiModelProperty("鐘舵�侊紙1=鏈煡鐪嬶紱2=宸叉煡鐪嬶級") + // @ApiModelProperty("鐘舵�侊紙1=鏈煡鐪嬶紱2=宸叉煡鐪嬶級") private Integer states; - @ApiModelProperty("棰勮绫诲瀷锛�1=瓒呬笂闄愶紱2=瓒呬笅闄愶級") + // @ApiModelProperty("棰勮绫诲瀷锛�1=瓒呬笂闄愶紱2=瓒呬笅闄愶級") private Short warningType; - @ApiModelProperty(value = "姣忛〉鏄剧ず鏉℃暟") + // @ApiModelProperty(value = "姣忛〉鏄剧ず鏉℃暟") private Integer pageSize = 10; - @ApiModelProperty(value = "褰撳墠椤垫暟") + // @ApiModelProperty(value = "褰撳墠椤垫暟") private Integer pageNum = 1; } diff --git a/consum-base/src/main/java/com/consum/base/pojo/request/FormInventoryParam.java b/consum-base/src/main/java/com/consum/base/pojo/request/FormInventoryParam.java index 28504f9..f158b84 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/request/FormInventoryParam.java +++ b/consum-base/src/main/java/com/consum/base/pojo/request/FormInventoryParam.java @@ -1,7 +1,5 @@ package com.consum.base.pojo.request; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -12,34 +10,34 @@ * @date 2023/11/20 13:49 */ @Data -@ApiModel(value = "鏂板鐩樼偣鍗曚俊鎭�") +// @ApiModel(value = "鏂板鐩樼偣鍗曚俊鎭�") public class FormInventoryParam { private Long id; /** * 鐩樼偣鍗曞悕 */ - @ApiModelProperty(value = "鐩樼偣鍗曞悕") + // @ApiModelProperty(value = "鐩樼偣鍗曞悕") private String businessFormName; /** * 浠撳簱缂栧彿 */ - @ApiModelProperty(value = "浠撳簱缂栧彿") + // @ApiModelProperty(value = "浠撳簱缂栧彿") private Long warehouseId; /** * 鎿嶄綔浜� */ - @ApiModelProperty(value = "鎿嶄綔浜�") + // @ApiModelProperty(value = "鎿嶄綔浜�") private Long operatorUserId; /** * 鐩戠洏浜� */ - @ApiModelProperty(value = "鐩戠洏浜�") + // @ApiModelProperty(value = "鐩戠洏浜�") private Long monitorUserId; /** * 澶囨敞 */ - @ApiModelProperty(value = "澶囨敞") + // @ApiModelProperty(value = "澶囨敞") private String remark; diff --git a/consum-base/src/main/java/com/consum/base/pojo/request/LWhFormInventoryParam.java b/consum-base/src/main/java/com/consum/base/pojo/request/LWhFormInventoryParam.java index b2be802..711de90 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/request/LWhFormInventoryParam.java +++ b/consum-base/src/main/java/com/consum/base/pojo/request/LWhFormInventoryParam.java @@ -1,12 +1,11 @@ package com.consum.base.pojo.request; import com.consum.base.pojo.response.FormInventoryGoodsVO; -import io.swagger.annotations.ApiModel; import java.util.List; import lombok.Data; @Data -@ApiModel(value = "鐩樼偣鍗�") +// @ApiModel(value = "鐩樼偣鍗�") public class LWhFormInventoryParam { // 涓婚敭 diff --git a/consum-base/src/main/java/com/consum/base/pojo/request/LWhFormTransferParam.java b/consum-base/src/main/java/com/consum/base/pojo/request/LWhFormTransferParam.java index 77e1a04..d5d0fed 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/request/LWhFormTransferParam.java +++ b/consum-base/src/main/java/com/consum/base/pojo/request/LWhFormTransferParam.java @@ -1,8 +1,8 @@ package com.consum.base.pojo.request; import com.consum.base.pojo.LWhFormTransferGoodsInfoParam; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; + + import java.util.List; import lombok.AllArgsConstructor; import lombok.Data; @@ -13,55 +13,55 @@ * @Author 鍗㈠簡闃� * @Date 2023/10/30 */ -@ApiModel(value = "璋冩嫧鍗曟嵁鏂板淇℃伅") +// @ApiModel(value = "璋冩嫧鍗曟嵁鏂板淇℃伅") @Data @AllArgsConstructor @NoArgsConstructor public class LWhFormTransferParam { - @ApiModelProperty(value = "涓婚敭") + // @ApiModelProperty(value = "涓婚敭") private Long id; /** * 鍏ュ簱浠撳簱缂栧彿 */ - @ApiModelProperty(value = "鍏ュ簱浠撳簱缂栧彿") + // @ApiModelProperty(value = "鍏ュ簱浠撳簱缂栧彿") private Long inWarehouseId; /** * 鍑哄簱浠撳簱鏈烘瀯缂栧彿锛堣皟鎷ㄦ満鏋勶級 */ - @ApiModelProperty(value = "鍑哄簱浠撳簱鏈烘瀯缂栧彿锛堣皟鎷ㄦ満鏋勶級") + // @ApiModelProperty(value = "鍑哄簱浠撳簱鏈烘瀯缂栧彿锛堣皟鎷ㄦ満鏋勶級") private Long outAgencyId; /** * 璋冩嫧鏃堕棿 */ - @ApiModelProperty(value = "璋冩嫧鏃堕棿") + // @ApiModelProperty(value = "璋冩嫧鏃堕棿") private Long createTime; /** * 璋冩嫧鎵嬬画 */ - @ApiModelProperty(value = "璋冩嫧鎵嬬画") + // @ApiModelProperty(value = "璋冩嫧鎵嬬画") private String procureDoc; /** * 鍗曟嵁绫诲瀷銆�0浠撳簱璋冩嫧锛�1閮ㄩ棬鍒嗗彂锛�2閮ㄩ棬鐗╁搧鍥為�� */ - @ApiModelProperty(value = "鍗曟嵁绫诲瀷銆�0浠撳簱璋冩嫧锛�1閮ㄩ棬鍒嗗彂锛�2閮ㄩ棬鐗╁搧鍥為��") + // @ApiModelProperty(value = "鍗曟嵁绫诲瀷銆�0浠撳簱璋冩嫧锛�1閮ㄩ棬鍒嗗彂锛�2閮ㄩ棬鐗╁搧鍥為��") private Integer transferBusinessType; - @ApiModelProperty(value = "閮ㄩ棬id") + // @ApiModelProperty(value = "閮ㄩ棬id") private Long departmentId; - @ApiModelProperty(value = "閮ㄩ棬鍚嶅瓧") + // @ApiModelProperty(value = "閮ㄩ棬鍚嶅瓧") private String departmentName; - @ApiModelProperty(value = "棰嗗彇浜哄悕瀛�") + // @ApiModelProperty(value = "棰嗗彇浜哄悕瀛�") private String operatorName; - @ApiModelProperty(value = "鑱旂郴鐢佃瘽") + // @ApiModelProperty(value = "鑱旂郴鐢佃瘽") private Long tel; /** * 璋冩嫧鍗曞瀷鍙� */ - @ApiModelProperty(value = "璋冩嫧鍗曞瀷鍙�") + // @ApiModelProperty(value = "璋冩嫧鍗曞瀷鍙�") private List<LWhFormTransferGoodsInfoParam> transferGoods; diff --git a/consum-base/src/main/java/com/consum/base/pojo/request/RecordInfoParam.java b/consum-base/src/main/java/com/consum/base/pojo/request/RecordInfoParam.java index bbc034e..9989eaf 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/request/RecordInfoParam.java +++ b/consum-base/src/main/java/com/consum/base/pojo/request/RecordInfoParam.java @@ -1,6 +1,6 @@ package com.consum.base.pojo.request; -import io.swagger.annotations.ApiModelProperty; + import java.util.List; import lombok.Data; @@ -13,7 +13,7 @@ @Data public class RecordInfoParam { - @ApiModelProperty("浣跨敤浜轰慨鏀硅褰�") + // @ApiModelProperty("浣跨敤浜轰慨鏀硅褰�") List<ProcureModelInfoParam> recordInfoList; } diff --git a/consum-base/src/main/java/com/consum/base/pojo/request/UsingFormBackGoodsInfo.java b/consum-base/src/main/java/com/consum/base/pojo/request/UsingFormBackGoodsInfo.java index dd3e40a..616e996 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/request/UsingFormBackGoodsInfo.java +++ b/consum-base/src/main/java/com/consum/base/pojo/request/UsingFormBackGoodsInfo.java @@ -2,7 +2,7 @@ import java.util.List; -import io.swagger.annotations.ApiModel; + import lombok.Data; /** @@ -12,7 +12,7 @@ * @date 2023/12/1 13:16 */ @Data -@ApiModel +// @ApiModel public class UsingFormBackGoodsInfo { // 鍒嗙被缂栧彿 diff --git a/consum-base/src/main/java/com/consum/base/pojo/request/UsingFormBackParam.java b/consum-base/src/main/java/com/consum/base/pojo/request/UsingFormBackParam.java index 149982a..2272f58 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/request/UsingFormBackParam.java +++ b/consum-base/src/main/java/com/consum/base/pojo/request/UsingFormBackParam.java @@ -4,8 +4,8 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; + + import lombok.Data; import lombok.NoArgsConstructor; @@ -17,28 +17,28 @@ */ @NoArgsConstructor @Data -@ApiModel +// @ApiModel @JsonIgnoreProperties(ignoreUnknown = true) public class UsingFormBackParam { - @ApiModelProperty(value = "鐗╁搧閫�鍥為儴闂╥d") + // @ApiModelProperty(value = "鐗╁搧閫�鍥為儴闂╥d") private Long departmentId; - @ApiModelProperty(value = "鐗╁搧閫�鍥為儴闂ㄥ悕瀛�") + // @ApiModelProperty(value = "鐗╁搧閫�鍥為儴闂ㄥ悕瀛�") private String departmentName; - @ApiModelProperty(value = "閫�鍥炰汉id") + // @ApiModelProperty(value = "閫�鍥炰汉id") private Long operatorId; - @ApiModelProperty(value = "閫�鍥炰汉鍚嶅瓧") + // @ApiModelProperty(value = "閫�鍥炰汉鍚嶅瓧") private String operatorName; - @ApiModelProperty(value = "鐗╁搧閫�鍥炴椂闂�") + // @ApiModelProperty(value = "鐗╁搧閫�鍥炴椂闂�") private Long dealTime; - @ApiModelProperty(value = "鎵嬬画") + // @ApiModelProperty(value = "鎵嬬画") private String procureDoc; - @ApiModelProperty(value = "鍒嗗彂鐗╁搧淇℃伅") + // @ApiModelProperty(value = "鍒嗗彂鐗╁搧淇℃伅") private List<UsingFormBackGoodsInfo> goods; } diff --git a/consum-base/src/main/java/com/consum/base/pojo/request/WarehouseManagerParam.java b/consum-base/src/main/java/com/consum/base/pojo/request/WarehouseManagerParam.java index 6ae3755..03b220a 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/request/WarehouseManagerParam.java +++ b/consum-base/src/main/java/com/consum/base/pojo/request/WarehouseManagerParam.java @@ -1,8 +1,8 @@ package com.consum.base.pojo.request; import com.consum.base.pojo.WarehouseManagerInfo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +// +// import java.util.List; import lombok.Data; @@ -13,13 +13,13 @@ * @date 2023/11/17 13:05 */ @Data -@ApiModel(value = "搴撶鍛樹俊鎭�") +// @ApiModel(value = "搴撶鍛樹俊鎭�") public class WarehouseManagerParam { - @ApiModelProperty(value = "浠撳簱id") + // // @ApiModelProperty(value = "浠撳簱id") private Long warehouseId; - @ApiModelProperty(value = "搴撶鍛樹俊鎭�") + // @ApiModelProperty(value = "搴撶鍛樹俊鎭�") List<WarehouseManagerInfo> warehouseManagerInfoList; } diff --git a/consum-base/src/main/java/com/consum/base/pojo/request/baseGoodModel.java b/consum-base/src/main/java/com/consum/base/pojo/request/baseGoodModel.java index 25d18c1..313fc7b 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/request/baseGoodModel.java +++ b/consum-base/src/main/java/com/consum/base/pojo/request/baseGoodModel.java @@ -1,7 +1,7 @@ package com.consum.base.pojo.request; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; + + import lombok.Data; /** @@ -11,14 +11,14 @@ * @date 2023/12/1 13:21 */ @Data -@ApiModel +// @ApiModel public class baseGoodModel { - @ApiModelProperty(value = "鍟嗗搧妯″瀷id") + // @ApiModelProperty(value = "鍟嗗搧妯″瀷id") private Long baseGoodsModelsId; - @ApiModelProperty(value = "鍗曚綅") + // @ApiModelProperty(value = "鍗曚綅") private String unit; - @ApiModelProperty(value = "鐗╁搧绫诲瀷 A,B,C") + // @ApiModelProperty(value = "鐗╁搧绫诲瀷 A,B,C") private String classification; private Long goodsTemplatesId; diff --git a/consum-base/src/main/java/com/consum/base/pojo/response/DepartGoodsUseInfo.java b/consum-base/src/main/java/com/consum/base/pojo/response/DepartGoodsUseInfo.java index f035239..8db00f5 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/response/DepartGoodsUseInfo.java +++ b/consum-base/src/main/java/com/consum/base/pojo/response/DepartGoodsUseInfo.java @@ -1,6 +1,6 @@ package com.consum.base.pojo.response; -import io.swagger.annotations.ApiModel; + import lombok.Data; /** @@ -10,7 +10,7 @@ * @date 2023/11/23 15:30 */ @Data -@ApiModel +// @ApiModel public class DepartGoodsUseInfo { private Long id; diff --git a/consum-base/src/main/java/com/consum/base/pojo/response/FinSysTenantUserVO.java b/consum-base/src/main/java/com/consum/base/pojo/response/FinSysTenantUserVO.java index 17426b0..e6d4893 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/response/FinSysTenantUserVO.java +++ b/consum-base/src/main/java/com/consum/base/pojo/response/FinSysTenantUserVO.java @@ -1,7 +1,5 @@ package com.consum.base.pojo.response; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** @@ -11,32 +9,32 @@ * @date 2023/11/16 15:46 */ @Data -@ApiModel(value = "FinSysTenantUserVO", description = "鏈烘瀯鐢ㄦ埛淇℃伅") +// // @ApiModel(value = "FinSysTenantUserVO", description = "鏈烘瀯鐢ㄦ埛淇℃伅") public class FinSysTenantUserVO { // 涓婚敭 - @ApiModelProperty(value = "涓婚敭") + // // @ApiModelProperty(value = "涓婚敭") private Long id; - @ApiModelProperty(value = "鐢ㄦ埛缂栫爜") + // // @ApiModelProperty(value = "鐢ㄦ埛缂栫爜") private String userCode; - @ApiModelProperty(value = "鐢ㄦ埛濮撳悕") + // // @ApiModelProperty(value = "鐢ㄦ埛濮撳悕") private String userName; - @ApiModelProperty(value = "鐢ㄦ埛鐧诲綍鍚�") + // // @ApiModelProperty(value = "鐢ㄦ埛鐧诲綍鍚�") private String userPhone; - @ApiModelProperty(value = "鏈烘瀯id") + // // @ApiModelProperty(value = "鏈烘瀯id") private String tenantId; - @ApiModelProperty(value = "鏈烘瀯鍚嶇О") + // // @ApiModelProperty(value = "鏈烘瀯鍚嶇О") private String tenantName; - @ApiModelProperty(value = "閮ㄩ棬鍚嶇О") + // // @ApiModelProperty(value = "閮ㄩ棬鍚嶇О") private String sysDeptName; - @ApiModelProperty(value = "鐘舵�� (0绂佺敤1鍚敤)") + // // @ApiModelProperty(value = "鐘舵�� (0绂佺敤1鍚敤)") private Integer status; } diff --git a/consum-base/src/main/java/com/consum/base/pojo/response/FormInventoryDetailVO.java b/consum-base/src/main/java/com/consum/base/pojo/response/FormInventoryDetailVO.java index 436f636..8072c71 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/response/FormInventoryDetailVO.java +++ b/consum-base/src/main/java/com/consum/base/pojo/response/FormInventoryDetailVO.java @@ -1,6 +1,5 @@ package com.consum.base.pojo.response; -import io.swagger.annotations.ApiModel; import lombok.Data; /** @@ -10,7 +9,7 @@ * @date 2023/11/21 13:20 */ @Data -@ApiModel(value = "鐩樼偣寮傚父鏄庣粏淇℃伅") +// @ApiModel(value = "鐩樼偣寮傚父鏄庣粏淇℃伅") public class FormInventoryDetailVO { private Long id; diff --git a/consum-base/src/main/java/com/consum/base/pojo/response/FormInventoryGoodsVO.java b/consum-base/src/main/java/com/consum/base/pojo/response/FormInventoryGoodsVO.java index 8b3abd6..1697341 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/response/FormInventoryGoodsVO.java +++ b/consum-base/src/main/java/com/consum/base/pojo/response/FormInventoryGoodsVO.java @@ -1,7 +1,5 @@ package com.consum.base.pojo.response; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.Data; /** @@ -11,11 +9,11 @@ * @date 2023/11/20 14:45 */ @Data -@ApiModel(value = "鐩樼偣鐗╁搧淇℃伅") +// @ApiModel(value = "鐩樼偣鐗╁搧淇℃伅") public class FormInventoryGoodsVO { // 涓婚敭 - @ApiModelProperty(value = "id") + // @ApiModelProperty(value = "id") private Long id; private Long whFormInventoryId; @@ -26,31 +24,31 @@ private Long baseGoodsTemplateId; - @ApiModelProperty(value = "鍟嗗搧妯℃澘鍚嶇О") + // @ApiModelProperty(value = "鍟嗗搧妯℃澘鍚嶇О") private String goodsTemplateName; - @ApiModelProperty(value = "鍟嗗搧鍨嬪彿鍚嶇О") + // @ApiModelProperty(value = "鍟嗗搧鍨嬪彿鍚嶇О") private String baseGoodsModelsName; - @ApiModelProperty(value = "鍟嗗搧绫诲埆") + // @ApiModelProperty(value = "鍟嗗搧绫诲埆") private String type; - @ApiModelProperty(value = "鍗曚綅") + // @ApiModelProperty(value = "鍗曚綅") private String unit; - @ApiModelProperty(value = "搴撳瓨鏁伴噺") + // @ApiModelProperty(value = "搴撳瓨鏁伴噺") private Integer inventoryCount; - @ApiModelProperty(value = "鍗曚环") + // @ApiModelProperty(value = "鍗曚环") private Integer price; - @ApiModelProperty(value = "鎬讳环") + // @ApiModelProperty(value = "鎬讳环") private Long totalAmount; - @ApiModelProperty(value = "瀹炵洏鏁伴噺") + // @ApiModelProperty(value = "瀹炵洏鏁伴噺") private Integer realNum; - @ApiModelProperty(value = "鐘舵��,") + // @ApiModelProperty(value = "鐘舵��,") private Integer status; diff --git a/consum-base/src/main/java/com/consum/base/pojo/response/FormInventoryVO.java b/consum-base/src/main/java/com/consum/base/pojo/response/FormInventoryVO.java index 5d35f1e..5cb48ef 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/response/FormInventoryVO.java +++ b/consum-base/src/main/java/com/consum/base/pojo/response/FormInventoryVO.java @@ -1,7 +1,5 @@ package com.consum.base.pojo.response; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import java.util.List; import lombok.Data; @@ -12,34 +10,34 @@ * @date 2023/11/20 14:43 */ @Data -@ApiModel(value = "鐩樼偣鐗╁搧鍗曡缁嗕俊鎭�") +// @ApiModel(value = "鐩樼偣鐗╁搧鍗曡缁嗕俊鎭�") public class FormInventoryVO { /** * 鐩樼偣鍗曞彿 */ - @ApiModelProperty(value = "鐩樼偣鍗曞彿") + // @ApiModelProperty(value = "鐩樼偣鍗曞彿") private String businessFormCode; /** * 鐩樼偣鍗曞悕 */ - @ApiModelProperty(value = "鐩樼偣鍗曞悕") + // @ApiModelProperty(value = "鐩樼偣鍗曞悕") private String businessFormName; /** * 浠撳簱缂栧彿 */ - @ApiModelProperty(value = "浠撳簱缂栧彿") + // @ApiModelProperty(value = "浠撳簱缂栧彿") private Long warehouseId; /** * 浠撳簱鍚嶅瓧 */ - @ApiModelProperty(value = "浠撳簱鍚嶅瓧") + // @ApiModelProperty(value = "浠撳簱鍚嶅瓧") private String warehouseName; /** * 鐩樼偣鐗╁搧淇℃伅 */ - @ApiModelProperty(value = "鐩樼偣鐗╁搧淇℃伅") + // @ApiModelProperty(value = "鐩樼偣鐗╁搧淇℃伅") private List<FormInventoryGoodsVO> formInventoryGoodsList; } diff --git a/consum-base/src/main/java/com/consum/base/pojo/response/FormOutputVO.java b/consum-base/src/main/java/com/consum/base/pojo/response/FormOutputVO.java index cfb788a..91688e3 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/response/FormOutputVO.java +++ b/consum-base/src/main/java/com/consum/base/pojo/response/FormOutputVO.java @@ -1,6 +1,6 @@ package com.consum.base.pojo.response; -import io.swagger.annotations.ApiModel; + import java.util.List; import lombok.Data; @@ -10,7 +10,7 @@ * @description: 鍑哄簱鍒楄〃淇℃伅 * @date 2023/11/10 11:37 */ -@ApiModel(value = "鍑哄簱鍒楄〃淇℃伅") +// @ApiModel(value = "鍑哄簱鍒楄〃淇℃伅") @Data public class FormOutputVO { diff --git a/consum-base/src/main/java/com/consum/base/pojo/response/FormProcureVO.java b/consum-base/src/main/java/com/consum/base/pojo/response/FormProcureVO.java index 3b6d58b..39d430e 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/response/FormProcureVO.java +++ b/consum-base/src/main/java/com/consum/base/pojo/response/FormProcureVO.java @@ -2,7 +2,7 @@ import java.util.List; -import io.swagger.annotations.ApiModel; + import lombok.Data; /** @@ -11,7 +11,7 @@ * @description: 閲囪喘鍒楄〃鏄庣粏淇℃伅 * @date 2023/11/10 11:37 */ -@ApiModel(value = "閲囪喘鍒楄〃鏄庣粏淇℃伅") +// @ApiModel(value = "閲囪喘鍒楄〃鏄庣粏淇℃伅") @Data public class FormProcureVO { diff --git a/consum-base/src/main/java/com/consum/base/pojo/response/FormScrappedGoodsDetailVO.java b/consum-base/src/main/java/com/consum/base/pojo/response/FormScrappedGoodsDetailVO.java index a2071e1..97a9574 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/response/FormScrappedGoodsDetailVO.java +++ b/consum-base/src/main/java/com/consum/base/pojo/response/FormScrappedGoodsDetailVO.java @@ -1,7 +1,7 @@ package com.consum.base.pojo.response; import com.fasterxml.jackson.annotation.JsonProperty; -import io.swagger.annotations.ApiModel; + import lombok.Data; import lombok.NoArgsConstructor; @@ -13,7 +13,7 @@ */ @NoArgsConstructor @Data -@ApiModel(value = "FormScrappedGoodsDetailVO") +// @ApiModel(value = "FormScrappedGoodsDetailVO") public class FormScrappedGoodsDetailVO { @JsonProperty("id") diff --git a/consum-base/src/main/java/com/consum/base/pojo/response/FormTransferVO.java b/consum-base/src/main/java/com/consum/base/pojo/response/FormTransferVO.java index 346b56c..f72fe41 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/response/FormTransferVO.java +++ b/consum-base/src/main/java/com/consum/base/pojo/response/FormTransferVO.java @@ -2,7 +2,7 @@ import java.util.List; -import io.swagger.annotations.ApiModel; + import lombok.Data; /** @@ -12,7 +12,7 @@ * @date 2023/11/15 17:27 */ @Data -@ApiModel(value = "璋冩嫧鍗曞垪琛ㄤ俊鎭�") +// @ApiModel(value = "璋冩嫧鍗曞垪琛ㄤ俊鎭�") public class FormTransferVO { // 涓婚敭 diff --git a/consum-base/src/main/java/com/consum/base/pojo/response/GoodsModelVO.java b/consum-base/src/main/java/com/consum/base/pojo/response/GoodsModelVO.java index 611513a..2cc26ea 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/response/GoodsModelVO.java +++ b/consum-base/src/main/java/com/consum/base/pojo/response/GoodsModelVO.java @@ -2,7 +2,7 @@ import java.util.List; -import io.swagger.annotations.ApiModelProperty; + import lombok.Data; /** @@ -14,29 +14,29 @@ @Data public class GoodsModelVO { - @ApiModelProperty(value = "id") + // @ApiModelProperty(value = "id") private Long id; - @ApiModelProperty(value = "鍨嬪彿鍚嶇О") + // @ApiModelProperty(value = "鍨嬪彿鍚嶇О") private String baseGoodsModelsName; - @ApiModelProperty(value = "鍗曚綅淇℃伅") + // @ApiModelProperty(value = "鍗曚綅淇℃伅") private String unit; - @ApiModelProperty(value = "鏁伴噺") + // @ApiModelProperty(value = "鏁伴噺") private Integer counts; - @ApiModelProperty(value = "鎬婚噾棰�") + // @ApiModelProperty(value = "鎬婚噾棰�") private Double totalAmount; /*閲囪喘淇℃伅*/ - @ApiModelProperty(value = "搴撳瓨鏁伴噺") + // @ApiModelProperty(value = "搴撳瓨鏁伴噺") private Integer worehouseCount; - @ApiModelProperty(value = "鍗曚环") + // @ApiModelProperty(value = "鍗曚环") private Long price; private Long baseGoodsModelsId; /*鎶ュ簾淇℃伅*/ private String scrappedName; - @ApiModelProperty(value = "閮ㄩ棬鍒嗗彂浣跨敤浜轰俊鎭�") + // @ApiModelProperty(value = "閮ㄩ棬鍒嗗彂浣跨敤浜轰俊鎭�") private List<DepartGoodsUseInfo> useInfo; } diff --git a/consum-base/src/main/java/com/consum/base/pojo/response/GoodsStatisticsInfoVO.java b/consum-base/src/main/java/com/consum/base/pojo/response/GoodsStatisticsInfoVO.java index b465960..cbca385 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/response/GoodsStatisticsInfoVO.java +++ b/consum-base/src/main/java/com/consum/base/pojo/response/GoodsStatisticsInfoVO.java @@ -1,7 +1,7 @@ package com.consum.base.pojo.response; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; + + import lombok.Data; import lombok.NoArgsConstructor; @@ -13,27 +13,27 @@ */ @NoArgsConstructor @Data -@ApiModel +// @ApiModel public class GoodsStatisticsInfoVO { - @ApiModelProperty(value = "鏈烘瀯") + // @ApiModelProperty(value = "鏈烘瀯") private String orgName; - @ApiModelProperty(value = "璋冩嫧鏁伴噺") + // @ApiModelProperty(value = "璋冩嫧鏁伴噺") private Integer diaoBoNum; - @ApiModelProperty(value = "鎬绘暟閲�") + // @ApiModelProperty(value = "鎬绘暟閲�") private Integer totalNum; - @ApiModelProperty(value = "鍦ㄥ簱鏁伴噺") + // @ApiModelProperty(value = "鍦ㄥ簱鏁伴噺") private Integer zaiKuNum; - @ApiModelProperty(value = "鐗╁搧鍨嬪彿绫诲埆锛圓绫�,B绫�..锛�") + // @ApiModelProperty(value = "鐗╁搧鍨嬪彿绫诲埆锛圓绫�,B绫�..锛�") private String costType; - @ApiModelProperty(value = "鎶ュ簾鏁伴噺") + // @ApiModelProperty(value = "鎶ュ簾鏁伴噺") private Integer baoFeiNum; - @ApiModelProperty(value = "鐗╁搧鍨嬪彿鍚嶇О") + // @ApiModelProperty(value = "鐗╁搧鍨嬪彿鍚嶇О") private String baseGoodsModelsName; - @ApiModelProperty(value = "鐗╁搧缂栫爜") + // @ApiModelProperty(value = "鐗╁搧缂栫爜") private String goodsCode; - @ApiModelProperty(value = "浠撳簱/閮ㄩ棬鍚嶇О") + // @ApiModelProperty(value = "浠撳簱/閮ㄩ棬鍚嶇О") private String warehouseName; - @ApiModelProperty(value = "鐗╁搧妯℃澘鍚嶇О") + // @ApiModelProperty(value = "鐗╁搧妯℃澘鍚嶇О") private String goodsTemplateName; } diff --git a/consum-base/src/main/java/com/consum/base/pojo/response/GoodsTemplateCountVO.java b/consum-base/src/main/java/com/consum/base/pojo/response/GoodsTemplateCountVO.java index 432029c..baddffb 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/response/GoodsTemplateCountVO.java +++ b/consum-base/src/main/java/com/consum/base/pojo/response/GoodsTemplateCountVO.java @@ -1,7 +1,7 @@ package com.consum.base.pojo.response; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; + + import lombok.Data; /** @@ -10,23 +10,23 @@ * @description: 鐗╁搧缁熻淇℃伅 * @date 2023/11/10 11:37 */ -@ApiModel +// @ApiModel @Data public class GoodsTemplateCountVO { - @ApiModelProperty(value = "id") + // @ApiModelProperty(value = "id") private Long id; - @ApiModelProperty(value = "鐗╁搧妯℃澘鍚嶇О") + // @ApiModelProperty(value = "鐗╁搧妯℃澘鍚嶇О") private String goodsName; - @ApiModelProperty(value = "鐗╁搧妯℃澘鍚嶇О") + // @ApiModelProperty(value = "鐗╁搧妯℃澘鍚嶇О") private String goodsTemplateName; - @ApiModelProperty(value = "鐗╁搧妯℃澘鍚嶇О") + // @ApiModelProperty(value = "鐗╁搧妯℃澘鍚嶇О") private String baseGoodsTemplateName; - @ApiModelProperty(value = "鍟嗗搧妯℃澘id") + // @ApiModelProperty(value = "鍟嗗搧妯℃澘id") private Long baseGoodsTemplateId; - @ApiModelProperty(value = "鐗╁搧鍐呭叏閮ㄥ瀷鍙风粺璁℃暟閲�") + // @ApiModelProperty(value = "鐗╁搧鍐呭叏閮ㄥ瀷鍙风粺璁℃暟閲�") private Integer count; - @ApiModelProperty(value = "鍗曚綅") + // @ApiModelProperty(value = "鍗曚綅") private String unit; } diff --git a/consum-base/src/main/java/com/consum/base/pojo/response/GoodsTemplateInfoVO.java b/consum-base/src/main/java/com/consum/base/pojo/response/GoodsTemplateInfoVO.java index d4b7e49..c15620e 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/response/GoodsTemplateInfoVO.java +++ b/consum-base/src/main/java/com/consum/base/pojo/response/GoodsTemplateInfoVO.java @@ -2,7 +2,7 @@ import java.util.List; -import io.swagger.annotations.ApiModel; + import lombok.Data; /** @@ -12,7 +12,7 @@ * @date 2023/11/14 13:13 */ @Data -@ApiModel(description = "杈撳嚭鐗╁搧淇℃伅") +// @ApiModel(description = "杈撳嚭鐗╁搧淇℃伅") public class GoodsTemplateInfoVO { // 涓婚敭 diff --git a/consum-base/src/main/java/com/consum/base/pojo/response/GoodsTemplateVO.java b/consum-base/src/main/java/com/consum/base/pojo/response/GoodsTemplateVO.java index dc1ae95..7ca5b5d 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/response/GoodsTemplateVO.java +++ b/consum-base/src/main/java/com/consum/base/pojo/response/GoodsTemplateVO.java @@ -1,6 +1,6 @@ package com.consum.base.pojo.response; -import io.swagger.annotations.ApiModel; + import lombok.Data; /** @@ -10,7 +10,7 @@ * @date 2023/11/15 13:38 */ @Data -@ApiModel(value = "鐗╁搧妯℃澘淇℃伅") +// @ApiModel(value = "鐗╁搧妯℃澘淇℃伅") public class GoodsTemplateVO { private Long id; diff --git a/consum-base/src/main/java/com/consum/base/pojo/response/LWHFromTransferExtendVO.java b/consum-base/src/main/java/com/consum/base/pojo/response/LWHFromTransferExtendVO.java index 1ddf8ad..62cb14f 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/response/LWHFromTransferExtendVO.java +++ b/consum-base/src/main/java/com/consum/base/pojo/response/LWHFromTransferExtendVO.java @@ -2,8 +2,8 @@ import java.util.List; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; + + import lombok.Data; /** @@ -13,97 +13,97 @@ * @date 2023/11/15 18:02 */ @Data -@ApiModel(value = "璋冩嫧鍗曟墿灞曡缁嗕俊鎭�") +// @ApiModel(value = "璋冩嫧鍗曟墿灞曡缁嗕俊鎭�") public class LWHFromTransferExtendVO { // 涓婚敭 private Long id; - @ApiModelProperty(value = "鍑哄叆搴搃d") + // @ApiModelProperty(value = "鍑哄叆搴搃d") private Long inWarehouseFormId; - @ApiModelProperty(value = "鍏ュ簱娴佹按id") + // @ApiModelProperty(value = "鍏ュ簱娴佹按id") private Long inWarehouseFlowId; - @ApiModelProperty(value = "鍑哄簱娴佹按id") + // @ApiModelProperty(value = "鍑哄簱娴佹按id") private Long outWarehouseFlowId; - @ApiModelProperty(value = "鍑哄簱鍗昳d") + // @ApiModelProperty(value = "鍑哄簱鍗昳d") private Long outWarehouseFormId; - @ApiModelProperty(value = "涓氬姟绫诲瀷0浠撳簱璋冩嫧锛�1閮ㄩ棬鍒嗗彂锛�2閮ㄩ棬鐗╁搧鍥為��") + // @ApiModelProperty(value = "涓氬姟绫诲瀷0浠撳簱璋冩嫧锛�1閮ㄩ棬鍒嗗彂锛�2閮ㄩ棬鐗╁搧鍥為��") private Integer businessType; - @ApiModelProperty(value = "涓氬姟鍗曞彿") + // @ApiModelProperty(value = "涓氬姟鍗曞彿") private String businessFormCode; - @ApiModelProperty(value = "鍏ュ簱鍗曠被鍨�0鏈烘瀯1閮ㄩ棬") + // @ApiModelProperty(value = "鍏ュ簱鍗曠被鍨�0鏈烘瀯1閮ㄩ棬") private Integer inWarehouseType; - @ApiModelProperty(value = "鍏ュ簱浠撳簱id") + // @ApiModelProperty(value = "鍏ュ簱浠撳簱id") private Long inWarehouseId; - @ApiModelProperty(value = "鍏ュ簱浠撳簱鍚嶇О") + // @ApiModelProperty(value = "鍏ュ簱浠撳簱鍚嶇О") private String inWarehouseName; - @ApiModelProperty(value = "鍑哄簱鍗曠被鍨�0鏈烘瀯1閮ㄩ棬") + // @ApiModelProperty(value = "鍑哄簱鍗曠被鍨�0鏈烘瀯1閮ㄩ棬") private Integer outWarehouseType; - @ApiModelProperty(value = "鍑哄簱浠撳簱id") + // @ApiModelProperty(value = "鍑哄簱浠撳簱id") private Long outWarehouseId; - @ApiModelProperty(value = "鍑哄簱浠撳簱鍚嶇О") + // @ApiModelProperty(value = "鍑哄簱浠撳簱鍚嶇О") private String outWarehouseName; - @ApiModelProperty(value = "鍏ュ簱鏈烘瀯id") + // @ApiModelProperty(value = "鍏ュ簱鏈烘瀯id") private Long inAgencyId; - @ApiModelProperty(value = "鍏ュ簱鏈烘瀯鍚嶇О") + // @ApiModelProperty(value = "鍏ュ簱鏈烘瀯鍚嶇О") private String inAgencyName; - @ApiModelProperty(value = "鍑哄簱鏈烘瀯id") + // @ApiModelProperty(value = "鍑哄簱鏈烘瀯id") private Long outAgencyId; - @ApiModelProperty(value = "鍑哄簱鏈烘瀯鍚嶇О") + // @ApiModelProperty(value = "鍑哄簱鏈烘瀯鍚嶇О") private String outAgencyName; - @ApiModelProperty(value = "鎿嶄綔浜篿d") + // @ApiModelProperty(value = "鎿嶄綔浜篿d") private Long operatorId; - @ApiModelProperty(value = "鎿嶄綔浜哄悕绉�") + // @ApiModelProperty(value = "鎿嶄綔浜哄悕绉�") private String operatorName; - @ApiModelProperty(value = "鍒涘缓鏃堕棿") + // @ApiModelProperty(value = "鍒涘缓鏃堕棿") private Long createTime; - @ApiModelProperty(value = "0=寰呭嚭搴擄紱1=寰呮帴鏀讹紱2=宸插叆搴撳簱:4=宸叉挙閿�") + // @ApiModelProperty(value = "0=寰呭嚭搴擄紱1=寰呮帴鏀讹紱2=宸插叆搴撳簱:4=宸叉挙閿�") private Integer states; - @ApiModelProperty(value = "鍏ュ簱鎿嶄綔浜篿d") + // @ApiModelProperty(value = "鍏ュ簱鎿嶄綔浜篿d") private Long inOperatorId; - @ApiModelProperty(value = "鍏ュ簱鎿嶄綔浜哄悕绉�") + // @ApiModelProperty(value = "鍏ュ簱鎿嶄綔浜哄悕绉�") private String inOperatorName; - @ApiModelProperty(value = "鍏ュ簱鏃堕棿") + // @ApiModelProperty(value = "鍏ュ簱鏃堕棿") private Long inTime; - @ApiModelProperty(value = "鍑哄簱鎿嶄綔浜篿d") + // @ApiModelProperty(value = "鍑哄簱鎿嶄綔浜篿d") private Long outOperatorId; - @ApiModelProperty(value = "鍑哄簱鎿嶄綔浜哄悕绉�") + // @ApiModelProperty(value = "鍑哄簱鎿嶄綔浜哄悕绉�") private String outOperatorName; - @ApiModelProperty(value = "鍑哄簱鏃堕棿") + // @ApiModelProperty(value = "鍑哄簱鏃堕棿") private Long outputTime; - @ApiModelProperty(value = "鎵嬬画") + // @ApiModelProperty(value = "鎵嬬画") private String procureDoc; - @ApiModelProperty(value = "閮ㄩ棬鍚嶇О") + // @ApiModelProperty(value = "閮ㄩ棬鍚嶇О") private String departmentName; - @ApiModelProperty(value = "鐢佃瘽") + // @ApiModelProperty(value = "鐢佃瘽") private Long tel; private List<GoodsTemplateInfoVO> formTransferGoods; diff --git a/consum-base/src/main/java/com/consum/base/pojo/response/LWhFormOutputExtendVO.java b/consum-base/src/main/java/com/consum/base/pojo/response/LWhFormOutputExtendVO.java index f877748..7ea25d6 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/response/LWhFormOutputExtendVO.java +++ b/consum-base/src/main/java/com/consum/base/pojo/response/LWhFormOutputExtendVO.java @@ -1,6 +1,6 @@ package com.consum.base.pojo.response; -import io.swagger.annotations.ApiModel; + import java.util.List; import lombok.Data; @@ -11,7 +11,7 @@ * @date 2023/11/13 16:45 */ @Data -@ApiModel(value = "鍑哄簱鍗曚俊鎭墿灞�") +// @ApiModel(value = "鍑哄簱鍗曚俊鎭墿灞�") public class LWhFormOutputExtendVO { diff --git a/consum-base/src/main/java/com/consum/base/pojo/response/LWhFormScrappedExtendVO.java b/consum-base/src/main/java/com/consum/base/pojo/response/LWhFormScrappedExtendVO.java index 08cf84f..156332d 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/response/LWhFormScrappedExtendVO.java +++ b/consum-base/src/main/java/com/consum/base/pojo/response/LWhFormScrappedExtendVO.java @@ -1,6 +1,6 @@ package com.consum.base.pojo.response; -import io.swagger.annotations.ApiModel; + import java.util.List; import lombok.Data; @@ -10,7 +10,7 @@ * @Date 2023/11/2 */ @Data -@ApiModel +// @ApiModel public class LWhFormScrappedExtendVO { diff --git a/consum-base/src/main/java/com/consum/base/pojo/response/LWhFormScrappedVO.java b/consum-base/src/main/java/com/consum/base/pojo/response/LWhFormScrappedVO.java index 745dea9..93eaea2 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/response/LWhFormScrappedVO.java +++ b/consum-base/src/main/java/com/consum/base/pojo/response/LWhFormScrappedVO.java @@ -2,7 +2,7 @@ import java.util.List; -import io.swagger.annotations.ApiModel; + import lombok.Data; /** @@ -12,7 +12,7 @@ * @date 2023/11/22 16:29 */ @Data -@ApiModel(value = "LWhFormScrappedVO", description = "LWhFormScrappedVO") +// @ApiModel(value = "LWhFormScrappedVO", description = "LWhFormScrappedVO") public class LWhFormScrappedVO { // 涓婚敭 diff --git a/consum-base/src/main/java/com/consum/base/pojo/response/TransferInfoVO.java b/consum-base/src/main/java/com/consum/base/pojo/response/TransferInfoVO.java index ac4ad92..8b8110d 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/response/TransferInfoVO.java +++ b/consum-base/src/main/java/com/consum/base/pojo/response/TransferInfoVO.java @@ -1,7 +1,7 @@ package com.consum.base.pojo.response; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; + + import lombok.Data; /** @@ -10,20 +10,20 @@ * @description: 鏈烘瀯鍒嗗彂鍗曚俊鎭� * @date 2023/11/10 15:35 */ -@ApiModel(value = "鏈烘瀯鍒嗗彂鍗曚俊鎭�") +// @ApiModel(value = "鏈烘瀯鍒嗗彂鍗曚俊鎭�") @Data public class TransferInfoVO { - @ApiModelProperty(value = "id") + // @ApiModelProperty(value = "id") private String id; - @ApiModelProperty(value = "鍗曞彿") + // @ApiModelProperty(value = "鍗曞彿") private String businessFormCode; - @ApiModelProperty(value = "鐗╁搧鍚嶇О") + // @ApiModelProperty(value = "鐗╁搧鍚嶇О") private String goodsTemplatesName; - @ApiModelProperty(value = "鍒嗗彂鏁伴噺") + // @ApiModelProperty(value = "鍒嗗彂鏁伴噺") private String num; - @ApiModelProperty(value = "鍙��鏁伴噺") + // @ApiModelProperty(value = "鍙��鏁伴噺") private String refundNum; - @ApiModelProperty(value = "鍒嗗彂鏃堕棿") + // @ApiModelProperty(value = "鍒嗗彂鏃堕棿") private String createDate; } diff --git a/consum-base/src/main/java/com/consum/base/pojo/response/UseInfo.java b/consum-base/src/main/java/com/consum/base/pojo/response/UseInfo.java index a2d353b..13730c0 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/response/UseInfo.java +++ b/consum-base/src/main/java/com/consum/base/pojo/response/UseInfo.java @@ -1,6 +1,6 @@ package com.consum.base.pojo.response; -import io.swagger.annotations.ApiModel; + import lombok.Data; /** @@ -10,7 +10,7 @@ * @date 2023/12/2 9:34 */ @Data -@ApiModel +// @ApiModel public class UseInfo { private String useName; diff --git a/consum-base/src/main/java/com/consum/base/pojo/response/UsingFormBackDetailListVO.java b/consum-base/src/main/java/com/consum/base/pojo/response/UsingFormBackDetailListVO.java index 8a7f1fe..92df297 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/response/UsingFormBackDetailListVO.java +++ b/consum-base/src/main/java/com/consum/base/pojo/response/UsingFormBackDetailListVO.java @@ -1,6 +1,6 @@ package com.consum.base.pojo.response; -import io.swagger.annotations.ApiModel; + import lombok.Data; import lombok.NoArgsConstructor; @@ -12,7 +12,7 @@ */ @NoArgsConstructor @Data -@ApiModel +// @ApiModel public class UsingFormBackDetailListVO { private Long id; diff --git a/consum-base/src/main/java/com/consum/base/pojo/response/UsingFormBackGoodsTemplateInfo.java b/consum-base/src/main/java/com/consum/base/pojo/response/UsingFormBackGoodsTemplateInfo.java index 2e128a3..64fc92b 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/response/UsingFormBackGoodsTemplateInfo.java +++ b/consum-base/src/main/java/com/consum/base/pojo/response/UsingFormBackGoodsTemplateInfo.java @@ -1,6 +1,6 @@ package com.consum.base.pojo.response; -import io.swagger.annotations.ApiModel; + import java.util.List; import lombok.Data; @@ -11,7 +11,7 @@ * @date 2023/12/2 9:18 */ @Data -@ApiModel +// @ApiModel public class UsingFormBackGoodsTemplateInfo { private Long id; diff --git a/consum-base/src/main/java/com/consum/base/pojo/response/UsingFormBackModelInfo.java b/consum-base/src/main/java/com/consum/base/pojo/response/UsingFormBackModelInfo.java index 3a5216c..141c694 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/response/UsingFormBackModelInfo.java +++ b/consum-base/src/main/java/com/consum/base/pojo/response/UsingFormBackModelInfo.java @@ -1,6 +1,6 @@ package com.consum.base.pojo.response; -import io.swagger.annotations.ApiModel; + import java.util.List; import lombok.Data; @@ -11,7 +11,7 @@ * @date 2023/12/2 9:24 */ @Data -@ApiModel +// @ApiModel public class UsingFormBackModelInfo { private Long id; diff --git a/consum-base/src/main/java/com/consum/base/pojo/response/WarehouseFlowVO.java b/consum-base/src/main/java/com/consum/base/pojo/response/WarehouseFlowVO.java index 57c73b3..098183b 100644 --- a/consum-base/src/main/java/com/consum/base/pojo/response/WarehouseFlowVO.java +++ b/consum-base/src/main/java/com/consum/base/pojo/response/WarehouseFlowVO.java @@ -1,7 +1,7 @@ package com.consum.base.pojo.response; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; + + import lombok.Data; import lombok.NoArgsConstructor; @@ -11,30 +11,30 @@ * @description: 浠撳簱娴佹按鏄庣粏淇℃伅 * @date 2023/11/11 11:26 */ -@ApiModel(value = "浠撳簱娴佹按鏄庣粏淇℃伅") +// @ApiModel(value = "浠撳簱娴佹按鏄庣粏淇℃伅") @NoArgsConstructor @Data public class WarehouseFlowVO { - @ApiModelProperty(value = "鍟嗗搧妯℃澘鍚嶇О") + // @ApiModelProperty(value = "鍟嗗搧妯℃澘鍚嶇О") private String goodsTemplateName; - @ApiModelProperty(value = "瑙勬牸鍚嶇О") + // @ApiModelProperty(value = "瑙勬牸鍚嶇О") private String baseGoodsModelsName; - @ApiModelProperty(value = "浜ゆ槗鏃堕棿") + // @ApiModelProperty(value = "浜ゆ槗鏃堕棿") private Long dealTime; - @ApiModelProperty(value = "浜ゆ槗绫诲瀷") + // @ApiModelProperty(value = "浜ゆ槗绫诲瀷") private Integer businessType; - @ApiModelProperty(value = "鍒涘缓浜�") + // @ApiModelProperty(value = "鍒涘缓浜�") private String createdName; - @ApiModelProperty(value = "鏁伴噺") + // @ApiModelProperty(value = "鏁伴噺") private Integer thisCount; - @ApiModelProperty(value = "浜ゆ槗鍗曞彿") + // @ApiModelProperty(value = "浜ゆ槗鍗曞彿") private String businessFormCode; - @ApiModelProperty(value = "缁忚惀鍗曚綅") + // @ApiModelProperty(value = "缁忚惀鍗曚綅") private String agencyName; - @ApiModelProperty(value = "浜ゆ槗鍗旾D") + // @ApiModelProperty(value = "浜ゆ槗鍗旾D") private Long businessFormId; - @ApiModelProperty(value = "浜ゆ槗绫诲瀷") + // @ApiModelProperty(value = "浜ゆ槗绫诲瀷") private Integer thisType; } diff --git a/consum-base/src/main/java/com/consum/base/service/LGoodsUserRecordCoreService.java b/consum-base/src/main/java/com/consum/base/service/LGoodsUserRecordCoreService.java index eb7f64f..93e0170 100644 --- a/consum-base/src/main/java/com/consum/base/service/LGoodsUserRecordCoreService.java +++ b/consum-base/src/main/java/com/consum/base/service/LGoodsUserRecordCoreService.java @@ -4,8 +4,7 @@ import java.util.HashMap; import java.util.List; -import javax.annotation.Resource; - +import jakarta.annotation.Resource; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.interceptor.TransactionAspectSupport; diff --git a/consum-base/src/main/java/com/consum/base/service/core/DepFormScrappedCoreService.java b/consum-base/src/main/java/com/consum/base/service/core/DepFormScrappedCoreService.java index 2f7d0ad..7859b67 100644 --- a/consum-base/src/main/java/com/consum/base/service/core/DepFormScrappedCoreService.java +++ b/consum-base/src/main/java/com/consum/base/service/core/DepFormScrappedCoreService.java @@ -8,8 +8,7 @@ import java.util.Objects; import java.util.stream.Collectors; -import javax.annotation.Resource; - +import jakarta.annotation.Resource; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; diff --git a/consum-base/src/main/java/com/consum/base/service/core/DepUsingFormBackCoreService.java b/consum-base/src/main/java/com/consum/base/service/core/DepUsingFormBackCoreService.java index bd0b89b..9e55ccb 100644 --- a/consum-base/src/main/java/com/consum/base/service/core/DepUsingFormBackCoreService.java +++ b/consum-base/src/main/java/com/consum/base/service/core/DepUsingFormBackCoreService.java @@ -7,8 +7,7 @@ import java.util.Map; import java.util.stream.Collectors; -import javax.annotation.Resource; - +import jakarta.annotation.Resource; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; diff --git a/consum-base/src/main/java/com/consum/base/service/core/LWarehouseFlowCoreService.java b/consum-base/src/main/java/com/consum/base/service/core/LWarehouseFlowCoreService.java index 97036cd..6018226 100644 --- a/consum-base/src/main/java/com/consum/base/service/core/LWarehouseFlowCoreService.java +++ b/consum-base/src/main/java/com/consum/base/service/core/LWarehouseFlowCoreService.java @@ -6,8 +6,7 @@ import java.util.Map; import java.util.stream.Collectors; -import javax.annotation.PostConstruct; - +import jakarta.annotation.PostConstruct; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.jdbc.core.JdbcTemplate; diff --git a/consum-base/src/main/java/com/consum/base/service/core/LWhFormInventoryCoreService.java b/consum-base/src/main/java/com/consum/base/service/core/LWhFormInventoryCoreService.java index dc70bb1..56229c6 100644 --- a/consum-base/src/main/java/com/consum/base/service/core/LWhFormInventoryCoreService.java +++ b/consum-base/src/main/java/com/consum/base/service/core/LWhFormInventoryCoreService.java @@ -206,7 +206,7 @@ if (CollectionUtils.isEmpty(inventoryGoodsList)) { return null; } - Long whFormProcureId = NumberGenerator.getLongSequenceNumber(); + Long whFormProcureId = IdUtil.generateId(); BaseWarehouse baseWarehouse = baseWarehouseService.getById(warehouseId); LWhFormProcure lWhFormProcure = new LWhFormProcure(); lWhFormProcure.setId(whFormProcureId); @@ -238,7 +238,7 @@ Long baseCategoryId = Long.valueOf(tempGoodsInfo.get("categoryid") + ""); LWhFormProcureGoods procureGood = new LWhFormProcureGoods(); - long fromProcureGoodsId = NumberGenerator.getLongSequenceNumber(); + long fromProcureGoodsId = IdUtil.generateId(); procureGood.setId(fromProcureGoodsId); procureGood.setWhFormProcureId(whFormProcureId); procureGood.setBaseCategoryId(baseCategoryId); diff --git a/consum-base/src/main/java/com/consum/base/service/core/LWhFormOutputCoreService.java b/consum-base/src/main/java/com/consum/base/service/core/LWhFormOutputCoreService.java index 946d68d..6ffa042 100644 --- a/consum-base/src/main/java/com/consum/base/service/core/LWhFormOutputCoreService.java +++ b/consum-base/src/main/java/com/consum/base/service/core/LWhFormOutputCoreService.java @@ -99,7 +99,7 @@ return outWarehouseFormId; } // 鍑哄簱鍗旾D - outWarehouseFormId = NumberGenerator.getLongSequenceNumberNano(); + outWarehouseFormId = IdUtil.generateId(); // 鐢宠璋冩嫧鐨勭墿鍝� List<LWhProcureModel> goodsModelNumList = lWhProcureModelService.getModelByForm(businessEnum, whFormTransferId); @@ -191,7 +191,7 @@ String nickName = currentUser.getNick_name(); // 娴佹按璁板綍鎬昏〃ID - long lWarehouseFlowId = NumberGenerator.getLongSequenceNumberNano(); + long lWarehouseFlowId = IdUtil.generateId(); long lWarehouseFlowBusinessId = outWarehouseFormId; Integer queryModelStatus = 1; Integer buyType = null; @@ -234,7 +234,7 @@ String modelName = (String)tempGoodsInfo.get("modelname"); // 鎻掑叆 鍚勮鏍肩墿鍝佺殑杩涘嚭搴撹褰� L_WH_GOODS_RECORD - long whGoodsRecordId = NumberGenerator.getLongSequenceNumberNano(); + long whGoodsRecordId = IdUtil.generateId(); LWhGoodsRecord whGoodsRecord = new LWhGoodsRecord(); whGoodsRecord.setId(whGoodsRecordId); whGoodsRecord.setWarehouseId(outWarehouseId); diff --git a/consum-base/src/main/java/com/consum/base/service/core/LWhFormProcureCoreService.java b/consum-base/src/main/java/com/consum/base/service/core/LWhFormProcureCoreService.java index cfa3d73..a4185ca 100644 --- a/consum-base/src/main/java/com/consum/base/service/core/LWhFormProcureCoreService.java +++ b/consum-base/src/main/java/com/consum/base/service/core/LWhFormProcureCoreService.java @@ -5,8 +5,8 @@ import java.util.List; import java.util.stream.Collectors; -import javax.annotation.Resource; - +import com.iplatform.base.IdUtil; +import jakarta.annotation.Resource; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; @@ -66,7 +66,7 @@ lWhProcureModelService.getModelByForm1(WhBusinessEnum.CAIGOU, whFormProcureId); // 娴佹按璁板綍鎬昏〃ID Long warehouseId = lWhFormProcure.getWarehouseId(); - long lWarehouseFlowId = NumberGenerator.getLongSequenceNumberNano(); + long lWarehouseFlowId = IdUtil.generateId(); LWarehouseFlow warehouseFlow = new LWarehouseFlow(); warehouseFlow.setId(lWarehouseFlowId); warehouseFlow.setWarehouseType(0); diff --git a/consum-base/src/main/java/com/consum/base/service/core/LWhFormTransferCoreService.java b/consum-base/src/main/java/com/consum/base/service/core/LWhFormTransferCoreService.java index 5315f90..b3d2dfd 100644 --- a/consum-base/src/main/java/com/consum/base/service/core/LWhFormTransferCoreService.java +++ b/consum-base/src/main/java/com/consum/base/service/core/LWhFormTransferCoreService.java @@ -7,8 +7,7 @@ import java.util.Map; import java.util.stream.Collectors; -import javax.annotation.Resource; - +import jakarta.annotation.Resource; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; @@ -173,7 +172,7 @@ String inWarehouseName = lWhFormTransfer.getInWarehouseName(); // 娴佹按璁板綍鎬昏〃ID - long lWarehouseFlowId = NumberGenerator.getLongSequenceNumberNano(); + long lWarehouseFlowId = IdUtil.generateId(); // 娴佹按璁板綍鎬昏〃涓� 涓氬姟ID 銆傝皟鎷ㄥ崟鏃� 淇濆瓨璋冩嫧鍗昳d 鍑哄簱鍗曟椂 淇濆瓨鍑哄簱鍗昳d long lWarehouseFlowBusinessId = whFormTransferId; @@ -204,7 +203,7 @@ String modelName = (String)tempGoodsInfo.get("modelname"); // 鎻掑叆 鍚勮鏍肩墿鍝佺殑杩涘嚭搴撹褰� L_WH_GOODS_RECORD - long whGoodsRecordId = NumberGenerator.getLongSequenceNumberNano(); + long whGoodsRecordId = IdUtil.generateId(); LWhGoodsRecord whGoodsRecord = new LWhGoodsRecord(); whGoodsRecord.setId(whGoodsRecordId); whGoodsRecord.setWarehouseId(outWarehouseId); @@ -325,7 +324,7 @@ long dealTime = DateUtils.getDateTimeNumber(System.currentTimeMillis()); // 娴佹按璁板綍鎬昏〃ID - long inWarehouseFlowId = NumberGenerator.getLongSequenceNumber(); + long inWarehouseFlowId = IdUtil.generateId(); // 鍗曟嵁绫诲瀷銆�0浠撳簱璋冩嫧锛�1閮ㄩ棬鍒嗗彂锛�2閮ㄩ棬鐗╁搧鍥為�� Integer businessType = lWhFormTransfer.getBusinessType(); // 鐘舵�侊紙0=鍦ㄩ�旇皟鎷紱1=鍏ュ簱鏈垎鍙戯紱2=宸蹭笅鍙戯紱3=鎶ュ簾 4 闆舵槦鍑哄簱锛� diff --git a/consum-base/src/main/java/com/consum/base/service/core/LWhWarningCoreService.java b/consum-base/src/main/java/com/consum/base/service/core/LWhWarningCoreService.java index a840caa..a0c15ed 100644 --- a/consum-base/src/main/java/com/consum/base/service/core/LWhWarningCoreService.java +++ b/consum-base/src/main/java/com/consum/base/service/core/LWhWarningCoreService.java @@ -5,8 +5,7 @@ import java.util.Map; import java.util.stream.Collectors; -import javax.annotation.Resource; - +import jakarta.annotation.Resource; import org.apache.commons.collections4.CollectionUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; diff --git a/consum-base/src/main/java/com/consum/base/service/impl/DepFormScrappedServiceImpl.java b/consum-base/src/main/java/com/consum/base/service/impl/DepFormScrappedServiceImpl.java index a022d48..701a0fb 100644 --- a/consum-base/src/main/java/com/consum/base/service/impl/DepFormScrappedServiceImpl.java +++ b/consum-base/src/main/java/com/consum/base/service/impl/DepFormScrappedServiceImpl.java @@ -6,8 +6,7 @@ import java.util.Map; import java.util.stream.Collectors; -import javax.annotation.Resource; - +import jakarta.annotation.Resource; import org.springframework.beans.BeanUtils; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/consum-base/src/main/java/com/consum/base/service/impl/LWhFormInventoryServiceImpl.java b/consum-base/src/main/java/com/consum/base/service/impl/LWhFormInventoryServiceImpl.java index c3f0f5a..e699f23 100644 --- a/consum-base/src/main/java/com/consum/base/service/impl/LWhFormInventoryServiceImpl.java +++ b/consum-base/src/main/java/com/consum/base/service/impl/LWhFormInventoryServiceImpl.java @@ -10,6 +10,7 @@ import cn.hutool.core.collection.CollectionUtil; import com.consum.base.pojo.query.LWhLedgerQry; import com.consum.base.service.*; +import jakarta.annotation.Resource; import org.apache.commons.compress.utils.Lists; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -42,10 +43,7 @@ import com.walker.infrastructure.utils.DateUtils; import com.walker.infrastructure.utils.StringUtils; import com.walker.jdbc.service.BaseServiceImpl; - import lombok.extern.slf4j.Slf4j; - -import javax.annotation.Resource; /** * @Description 鐩樼偣 diff --git a/consum-base/src/main/java/com/consum/base/service/impl/LWhFormProcureServiceImpl.java b/consum-base/src/main/java/com/consum/base/service/impl/LWhFormProcureServiceImpl.java index 47be0cc..1153eb7 100644 --- a/consum-base/src/main/java/com/consum/base/service/impl/LWhFormProcureServiceImpl.java +++ b/consum-base/src/main/java/com/consum/base/service/impl/LWhFormProcureServiceImpl.java @@ -8,8 +8,7 @@ import java.util.Map; import java.util.Set; -import javax.annotation.Resource; - +import jakarta.annotation.Resource; import org.apache.commons.compress.utils.Lists; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; diff --git a/consum-base/src/main/java/com/consum/base/service/impl/LWhGoodsRecordDetailsService.java b/consum-base/src/main/java/com/consum/base/service/impl/LWhGoodsRecordDetailsService.java index 03acd4e..f7efd45 100644 --- a/consum-base/src/main/java/com/consum/base/service/impl/LWhGoodsRecordDetailsService.java +++ b/consum-base/src/main/java/com/consum/base/service/impl/LWhGoodsRecordDetailsService.java @@ -3,8 +3,7 @@ import java.util.List; import java.util.Map; -import javax.annotation.PostConstruct; - +import jakarta.annotation.PostConstruct; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; diff --git a/consum-base/src/main/java/com/consum/base/service/impl/UsingFormBackServiceImpl.java b/consum-base/src/main/java/com/consum/base/service/impl/UsingFormBackServiceImpl.java index 644b65b..9e0caa9 100644 --- a/consum-base/src/main/java/com/consum/base/service/impl/UsingFormBackServiceImpl.java +++ b/consum-base/src/main/java/com/consum/base/service/impl/UsingFormBackServiceImpl.java @@ -21,13 +21,12 @@ import com.walker.infrastructure.utils.DateUtils; import com.walker.infrastructure.utils.StringUtils; import com.walker.jdbc.service.BaseServiceImpl; +import jakarta.annotation.Resource; import org.apache.commons.compress.utils.Lists; import org.springframework.beans.BeanUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; - -import javax.annotation.Resource; import java.util.ArrayList; import java.util.HashMap; import java.util.List; diff --git a/consum-model-pojo/pom.xml b/consum-model-pojo/pom.xml index 48aa192..4b4365b 100644 --- a/consum-model-pojo/pom.xml +++ b/consum-model-pojo/pom.xml @@ -45,7 +45,9 @@ <dependency> <groupId>com.walkersoft</groupId> <artifactId>walker-jdbc-common</artifactId> - <scope>provided</scope> + <version>${walker-jdbc-common.version}</version> + <systemPath>${project.basedir}/src/main/resources/lib/walker-jdbc-common-3.2.0.jar</systemPath> + <scope>system</scope> </dependency> <!-- json娉ㄨВ锛氬睘鎬х粦瀹氫緷璧� --> <dependency> @@ -53,6 +55,10 @@ <artifactId>jackson-databind</artifactId> <scope>provided</scope> </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-jdbc</artifactId> + </dependency> </dependencies> </project> diff --git a/deploy-jar-single/pom.xml b/deploy-jar-single/pom.xml index e7a2a00..6d1a5f2 100644 --- a/deploy-jar-single/pom.xml +++ b/deploy-jar-single/pom.xml @@ -32,11 +32,18 @@ </exclusion> </exclusions> </dependency> - + <dependency> + <groupId>mysql</groupId> + <artifactId>mysql-connector-java</artifactId> + <version>8.0.31</version> <!-- 浣跨敤閫傚悎鎮ㄩ」鐩殑鐗堟湰鍙� --> + </dependency> <!-- 閫氳繃鐣岄潰涓嬭浇po鐢熸垚鏂囦欢锛�2023/03/16 --> <dependency> <groupId>com.iplatform</groupId> <artifactId>iplatform-jdbc-generator</artifactId> + <version>3.2.0</version> + <systemPath>${project.basedir}/src/main/resources/lib/iplatform-jdbc-generator-2.3.0-SNAPSHOT.jar</systemPath> + <scope>system</scope> </dependency> <!-- 闃块噷druid鏁版嵁搴撹繛鎺ユ睜锛屽鏋滀娇鐢ㄧ洿鎺ュ紩鍏ュ埌涓氬姟鍙戝竷妯″潡涓紝2023-03-15 --> @@ -45,31 +52,24 @@ <artifactId>druid</artifactId> </dependency> - <!-- 濡傛灉浣跨敤Redis缂撳瓨锛屽垯寮曞叆鏀寔妯″潡 --> + <!-- redis鏀寔 --> <dependency> <groupId>com.walkersoft</groupId> <artifactId>walker-support-redis</artifactId> - <exclusions> - <exclusion> - <groupId>com.walkersoft</groupId> - <artifactId>walker-cache</artifactId> - </exclusion> - </exclusions> + <version>${walker-support-redis.version}</version> + <systemPath>${project.basedir}/src/main/resources/lib/walker-support-redis-3.2.0.jar</systemPath> + <scope>system</scope> + </dependency> + <dependency> + <groupId>com.walkersoft</groupId> + <artifactId>walker-jdbc</artifactId> + <version>3.2.0</version> + <systemPath>${project.basedir}/src/main/resources/lib/walker-jdbc-3.2.0.jar</systemPath> + <scope>system</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-autoconfigure</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-test</artifactId> - <version>2.1.6.RELEASE</version> - <exclusions> - <exclusion> - <artifactId>snakeyaml</artifactId> - <groupId>org.yaml</groupId> - </exclusion> - </exclusions> </dependency> <dependency> @@ -92,64 +92,23 @@ <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-core</artifactId> - <version>9.0.89</version> + <version>10.1.31</version> </dependency> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-el</artifactId> - <version>9.0.89</version> + <version>10.1.31</version> </dependency> <dependency> <groupId>org.apache.tomcat.embed</groupId> <artifactId>tomcat-embed-websocket</artifactId> - <version>9.0.89</version> + <version>10.1.31</version> </dependency> <dependency> <groupId>org.apache.tomcat</groupId> <artifactId>tomcat-annotations-api</artifactId> - <version>9.0.89</version> + <version>10.1.31</version> </dependency> - - - <!-- <!– 2023-06-25 浣跨敤Oracle鏁版嵁搴撻渶瑕侀厤缃紝涓嶉渶瑕佺洿鎺ユ敞閲婂嵆鍙�� –>--> -<!-- <dependency>--> -<!-- <groupId>com.walkersoft</groupId>--> -<!-- <artifactId>walker-jdbc-support-oracle</artifactId>--> -<!-- </dependency>--> - - <!-- elastic search 闇�瑕佸崟鐙紩鍏ユā鍧�, 2023/07/31 --> -<!-- <dependency>--> -<!-- <groupId>org.springframework.boot</groupId>--> -<!-- <artifactId>spring-boot-starter-web</artifactId>--> -<!-- <exclusions>--> -<!-- <exclusion>--> -<!-- <groupId>org.elasticsearch.client</groupId>--> -<!-- <artifactId>elasticsearch-rest-high-level-client</artifactId>--> -<!-- </exclusion>--> -<!-- <exclusion>--> -<!-- <groupId>org.elasticsearch</groupId>--> -<!-- <artifactId>elasticsearch</artifactId>--> -<!-- </exclusion>--> -<!-- </exclusions>--> -<!-- </dependency>--> - - <!-- 2023-08-07 涓虹幇鍦鸿皟璇曪紝鏆傛椂鍏抽棴妫�绱㈡ā鍧� --> -<!-- <dependency>--> -<!-- <groupId>org.elasticsearch.client</groupId>--> -<!-- <artifactId>elasticsearch-rest-high-level-client</artifactId>--> -<!-- <version>${es.version}</version>--> -<!-- </dependency>--> -<!-- <dependency>--> -<!-- <groupId>org.elasticsearch</groupId>--> -<!-- <artifactId>elasticsearch</artifactId>--> -<!-- <version>${es.version}</version>--> -<!-- </dependency>--> - -<!-- <!– 绉湪鎶ヨ〃鍔熻兘锛岄渶瑕佷娇鐢ㄦ墦寮�娉ㄩ噴鍗冲彲锛�2023-08-24 –>--> -<!-- <dependency>--> -<!-- <groupId>com.iplatform</groupId>--> -<!-- <artifactId>iplatform-report</artifactId>--> -<!-- </dependency>--> <!-- 閰嶇疆鏂囦欢鍔犲瘑 --> <dependency> <groupId>com.github.ulisesbocchio</groupId> @@ -183,7 +142,6 @@ <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-core</artifactId> - <version>5.7.12</version> </dependency> </dependencies> diff --git a/deploy-jar-single/src/main/resources/application-dev.yml b/deploy-jar-single/src/main/resources/application-dev.yml index d2d758a..c5b1e5e 100644 --- a/deploy-jar-single/src/main/resources/application-dev.yml +++ b/deploy-jar-single/src/main/resources/application-dev.yml @@ -8,8 +8,8 @@ dataBaseName: low_consum_manage_test24041101 username: root # Bjjmy_2020 - password: ENC(V7lFKlYcHfEzTbXsbBQhSUswgxLsbS5z) - url: jdbc:mysql://116.198.40.76:3306/${spring.datasource.dataBaseName}?useUnicode=true&characterEncoding=UTF-8&useSSL=false + password: Bjjmy_2020 + url: jdbc:mysql://116.198.40.76:3306/low_consum_manage_test24041101?useUnicode=true&characterEncoding=UTF-8&useSSL=false # Druid杩炴帴姹� type: com.walker.jdbc.ds.MyDruidDataSource druid: @@ -32,12 +32,6 @@ max-open-prepared-statements: 100 use-global-data-source-stat: true # Redis - redis: - host: 116.198.40.76 - port: 6379 - database: 11 - password: ENC(C40h1dp9Q1oLqdU+JUGSBOWUfOmj/ZO4) #Jmy2019. - mvc: pathmatch: # 鍔犺閰嶇疆鏄洜涓� swagger3 鍚姩鎶ラ敊锛�2023-02-23 @@ -50,6 +44,12 @@ multipart: max-file-size: 100MB max-request-size: 300MB + data: + redis: + host: 116.198.40.76 + port: 6379 + database: 11 + password: Jmy2019. server: port: 8083 @@ -152,7 +152,7 @@ # - /api/** # 瓒呯骇绠$悊鍛樺瘑鐮侊紝鍔犲瘑鍚庣殑绉樻枃 - supervisor-password: ENC(cDkgI4dm/vDXFDsDm5KJW23i5zAAUxIUW448ReA27tmgQ83ZLgO3k/YMK5+wIiuGDKPDIXUH9/irgKTLMKl7n7mP6XRgBnOf) + supervisor-password: $2a$10$9lSwwUFMULR6/KhPsUbTj.0PTZfTnq0fB3OtS6PWoKAibpa8hL1cy # supervisor-password: $2a$10$9lSwwUFMULR6/KhPsUbTj.0PTZfTnq0fB3OtS6PWoKAibpa8hL1cy # 鏄惁鍏佽閰嶇疆璺ㄥ煙鍝嶅簲澶�, true 鍚敤锛� false 涓嶅惎鐢ㄣ��2022-12-28 # 鍦℅ateway妯″紡涓紝闇�瑕佸叧闂法鍩熼厤缃紝鍥犱负缃戝叧涔熶細閰嶇疆銆� @@ -219,7 +219,7 @@ ip: 116.198.40.76 port: 22 user-name: mysftp - password: ENC(kEQ43JzZv6yOOmbmKNLWmsU/wQKTwA9x) + password: 123456 private-key: # ftp鏈嶅姟涓婇潰鐨勫瓨鍌ㄦ牴璺緞锛屽彧鑳芥槸linux璺緞 file-root: /progress/ @@ -249,4 +249,4 @@ # 閭欢閫氱煡鍙戦�佷俊鎭厤缃紝2023-04-26 mail-server: smtp.126.com mail-from: hnzzzhsl@126.com - mail-password: ENC(hjRDRcQmmhpUICkAaJnXUQ==) + mail-password: 123456 diff --git a/deploy-jar-single/src/main/resources/application-prod.yml b/deploy-jar-single/src/main/resources/application-prod.yml index bfbfa40..0f9b0d2 100644 --- a/deploy-jar-single/src/main/resources/application-prod.yml +++ b/deploy-jar-single/src/main/resources/application-prod.yml @@ -31,12 +31,6 @@ max-open-prepared-statements: 100 use-global-data-source-stat: true # Redis - redis: - host: 192.200.0.49 - port: 6379 - database: 11 - password: ENC(1IxlpqZ3ykMIWVknDjVydrCpK/6nccv/) #Jmy2019. - mvc: pathmatch: # 鍔犺閰嶇疆鏄洜涓� swagger3 鍚姩鎶ラ敊锛�2023-02-23 @@ -49,6 +43,12 @@ multipart: max-file-size: 100MB max-request-size: 300MB + data: + redis: + host: 192.200.0.49 + port: 6379 + database: 11 + password: ENC(1IxlpqZ3ykMIWVknDjVydrCpK/6nccv/) server: port: 9301 diff --git a/deploy-jar-single/src/main/resources/application-test.yml b/deploy-jar-single/src/main/resources/application-test.yml index ce101cc..1bb1e43 100644 --- a/deploy-jar-single/src/main/resources/application-test.yml +++ b/deploy-jar-single/src/main/resources/application-test.yml @@ -32,12 +32,6 @@ max-open-prepared-statements: 100 use-global-data-source-stat: true # Redis - redis: - host: 116.198.40.76 - port: 6379 - database: 11 - password: ENC(C40h1dp9Q1oLqdU+JUGSBOWUfOmj/ZO4) #Jmy2019. - mvc: pathmatch: # 鍔犺閰嶇疆鏄洜涓� swagger3 鍚姩鎶ラ敊锛�2023-02-23 @@ -50,6 +44,12 @@ multipart: max-file-size: 100MB max-request-size: 300MB + data: + redis: + host: 116.198.40.76 + port: 6379 + database: 11 + password: ENC(C40h1dp9Q1oLqdU+JUGSBOWUfOmj/ZO4) server: port: 8083 diff --git a/deploy-jar-single/src/main/resources/application.yml b/deploy-jar-single/src/main/resources/application.yml index fadf7d2..ad9a171 100644 --- a/deploy-jar-single/src/main/resources/application.yml +++ b/deploy-jar-single/src/main/resources/application.yml @@ -1,4 +1,4 @@ spring: profiles: - active: prod + active: dev diff --git a/iplatform-base-admin/pom.xml b/iplatform-base-admin/pom.xml new file mode 100644 index 0000000..bff2a50 --- /dev/null +++ b/iplatform-base-admin/pom.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>low-consum-manage</artifactId> + <groupId>com.consum</groupId> + <version>1.0.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <groupId>com.iplatform</groupId> + <artifactId>iplatform-base-admin</artifactId> + <name>iplatform-base-admin</name> + <packaging>jar</packaging> + <version>3.2.0</version> + + <properties> + </properties> + + <dependencies> + + <!-- 鍩虹妯″潡鐣岄潰绠$悊锛屽彧渚濊禆鍩虹妯″潡锛岃繍琛岀幆澧冨繀椤绘彁渚涖��2022/11/16 --> + <dependency> + <groupId>com.iplatform</groupId> + <artifactId>iplatform-base</artifactId> + <scope>provided</scope> + </dependency> + + </dependencies> + +</project> diff --git a/iplatform-base-admin/src/main/java/com/iplatform/base/IdUtil.java b/iplatform-base-admin/src/main/java/com/iplatform/base/IdUtil.java new file mode 100644 index 0000000..83fb83b --- /dev/null +++ b/iplatform-base-admin/src/main/java/com/iplatform/base/IdUtil.java @@ -0,0 +1,78 @@ +package com.iplatform.base; + +public class IdUtil { + + private static IdUtil instance = new IdUtil(0); + + public static IdUtil getInstance() { + return instance; + } + + public static long generateId() { + return instance.nextId(); + } + + private final static long MACHINE_BIT = 5; // max 31 + private final static long SEQUENCE_BIT = 8; // 256/10ms + + /** + * mask/max value + */ + private final static long MAX_MACHINE_NUM = -1L ^ (-1L << MACHINE_BIT); + private final static long MAX_SEQUENCE = -1L ^ (-1L << SEQUENCE_BIT); + + private final static long MACHINE_LEFT = SEQUENCE_BIT; + private final static long TIMESTMP_LEFT = MACHINE_BIT + SEQUENCE_BIT; + + private long machineId; + private long sequence = 0L; + private long lastStmp = -1L; + + private IdUtil(long machineId) { + if (machineId > MAX_MACHINE_NUM || machineId < 0) { + throw new IllegalArgumentException( + "machineId can't be greater than " + MAX_MACHINE_NUM + " or less than 0"); + } + this.machineId = machineId; + } + + /** + * generate new ID + * + * @return + */ + public synchronized long nextId() { + long currStmp = getTimestamp(); + if (currStmp < lastStmp) { + throw new RuntimeException("Clock moved backwards. Refusing to generate id"); + } + + if (currStmp == lastStmp) { + sequence = (sequence + 1) & MAX_SEQUENCE; + if (sequence == 0L) { + currStmp = getNextTimestamp(); + } + } else { + sequence = 0L; + } + + lastStmp = currStmp; + + return currStmp << TIMESTMP_LEFT // + | machineId << MACHINE_LEFT // + | sequence; + } + + private long getNextTimestamp() { + long mill = getTimestamp(); + while (mill <= lastStmp) { + mill = getTimestamp(); + } + return mill; + } + + private long getTimestamp() { + // per 10ms + return System.currentTimeMillis() / 10;// 10ms + } +} diff --git a/iplatform-base-admin/src/main/java/com/iplatform/base/Test1.java b/iplatform-base-admin/src/main/java/com/iplatform/base/Test1.java new file mode 100644 index 0000000..f087a2f --- /dev/null +++ b/iplatform-base-admin/src/main/java/com/iplatform/base/Test1.java @@ -0,0 +1,7 @@ +package com.iplatform.base; + +import com.walker.web.UserType; + +public class Test1 { + private UserType userType = UserType.User; +} diff --git a/iplatform-base-admin/src/main/java/com/iplatform/base/config/SwaggerConfig.java b/iplatform-base-admin/src/main/java/com/iplatform/base/config/SwaggerConfig.java new file mode 100644 index 0000000..9722ced --- /dev/null +++ b/iplatform-base-admin/src/main/java/com/iplatform/base/config/SwaggerConfig.java @@ -0,0 +1,70 @@ +//package com.iplatform.base.config; +// +//import com.walker.infrastructure.utils.StringUtils; +// +//import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +//import org.springframework.context.annotation.Profile; +//import springfox.documentation.builders.ApiInfoBuilder; +//import springfox.documentation.builders.PathSelectors; +//import springfox.documentation.builders.RequestHandlerSelectors; +//import springfox.documentation.oas.annotations.EnableOpenApi; +//import springfox.documentation.service.ApiInfo; +//import springfox.documentation.service.Contact; +//import springfox.documentation.spi.DocumentationType; +//import springfox.documentation.spring.web.plugins.ApiSelectorBuilder; +//import springfox.documentation.spring.web.plugins.Docket; +// +//@Configuration +//@EnableOpenApi +//@Profile({"dev"}) +//@ConditionalOnProperty(name = "iplatform.security.swagger.enable", havingValue = "true") +////@EnableSwaggerBootstrapUI//璁块棶缇庡寲锛屾柟渚挎煡鐪嬭皟璇� +//public class SwaggerConfig { +// +// @Bean +// public Docket createApi(SwaggerProperties properties) { +// ApiSelectorBuilder builder = new Docket(DocumentationType.OAS_30).apiInfo(apiInfo(properties)).select(); +// if(StringUtils.isNotEmpty(properties.getBasePackage())){ +// // 濡傛灉瀛樺湪鍖呰矾寰勶紝浼樺厛浣跨敤 +// builder.apis(RequestHandlerSelectors.basePackage(properties.getBasePackage())); +// } else { +// // 娌℃湁閰嶇疆鍖呰矾寰勶紝鍒欐煡鎵炬敞瑙PI鐨勬枃妗� +// builder.apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)); +// } +// +// Docket docket = builder.paths(PathSelectors.any()).build(); +//// docket.globalRequestParameters(getGlobalRequestParameters()); +//// docket.globalResponses(HttpMethod.POST, getGlobalResonseMessage()); +// return docket; +// +///* return new Docket(DocumentationType.OAS_30) +// .apiInfo(apiInfo(properties)) +// .select() +// // 鎸囧畾鎵弿鐨勫寘锛屼笉鎸囧畾浼氭壂鎻忓嚭 spring 妗嗘灦鐨勬帴鍙o紝鎸囧畾閿欒浼氬鑷存帴鍙f壂鎻忎笉鍑烘潵 +//// .apis(RequestHandlerSelectors.basePackage(properties.getBasePackage())) +// .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)) +// .paths(PathSelectors.any()) +// .build() +// //鍔犲叆閫氱敤鍏ュ弬 +//// .globalRequestParameters(getGlobalRequestParameters()) +// //post鏂规硶鍔犲叆閫氱敤鍝嶅簲澶� +//// .globalResponses(HttpMethod.POST, getGlobalResonseMessage()) +// ;*/ +// } +// +// @Bean +// public SwaggerProperties swaggerProperties(){ +// return new SwaggerProperties(); +// } +// +// private ApiInfo apiInfo(SwaggerProperties swaggerProperties) { +// return new ApiInfoBuilder() +// .title(swaggerProperties.getTitle()) +// .description(swaggerProperties().getDescription()) +// .contact(new Contact("鏃跺厠鑻�", "https://www.baidu.com", "28914843@qq.com")) +// .version("2.0") +// .build(); +// } +//} diff --git a/iplatform-base-admin/src/main/java/com/iplatform/base/config/SwaggerProperties.java b/iplatform-base-admin/src/main/java/com/iplatform/base/config/SwaggerProperties.java new file mode 100644 index 0000000..7f4a198 --- /dev/null +++ b/iplatform-base-admin/src/main/java/com/iplatform/base/config/SwaggerProperties.java @@ -0,0 +1,35 @@ +//package com.iplatform.base.config; +// +//import org.springframework.boot.context.properties.ConfigurationProperties; +// +//@ConfigurationProperties(prefix = "iplatform.swagger") +//public class SwaggerProperties { +// +// public String getBasePackage() { +// return basePackage; +// } +// +// public void setBasePackage(String basePackage) { +// this.basePackage = basePackage; +// } +// +// public String getTitle() { +// return title; +// } +// +// public void setTitle(String title) { +// this.title = title; +// } +// +// public String getDescription() { +// return description; +// } +// +// public void setDescription(String description) { +// this.description = description; +// } +// +// private String basePackage; +// private String title; +// private String description; +//} diff --git a/iplatform-base-admin/src/main/java/com/iplatform/base/controller/ApiTimeController.java b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/ApiTimeController.java new file mode 100644 index 0000000..333aedd --- /dev/null +++ b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/ApiTimeController.java @@ -0,0 +1,49 @@ +package com.iplatform.base.controller; + +import com.iplatform.base.SystemController; +import com.iplatform.base.service.ApiTimeServiceImpl; +import com.iplatform.model.vo.ApiTime; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.web.ResponseValue; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@RequestMapping("/test/api") +public class ApiTimeController extends SystemController { + + private ApiTimeServiceImpl apiTimeService; + + @Autowired + public ApiTimeController(ApiTimeServiceImpl apiTimeService){ + this.apiTimeService = apiTimeService; + } + + /** + * 鏌ヨ鎺ュ彛璋冪敤鏃堕棿璁板綍 + * @param currentDate 褰撳墠鏃ユ湡锛屽锛�20240229锛堝彲閫夛級 + * @param maxSize 闄愬埗杩斿洖璁板綍鏈�澶ф潯鏁帮紝濡傦細200锛堝彲閫夛級 + * @param cost 鏉′欢锛氭渶灏忚姳璐规椂闂达紝姣锛岃秴杩囪鏃堕棿鐨勮褰曪紝濡傦細200锛堝彲閫夛級 + * @return + */ + @RequestMapping("/time") + public ResponseValue getCostMostList(String currentDate, String cost, String maxSize){ + Integer dateValue = null; + Integer maxSizeValue = null; + Long costValue = null; + if(StringUtils.isNotEmpty(currentDate)){ + dateValue = Integer.parseInt(currentDate); + } + if(StringUtils.isNotEmpty(maxSize)){ + maxSizeValue = Integer.parseInt(maxSize); + } + if(StringUtils.isNotEmpty(cost)){ + costValue = Long.parseLong(cost); + } + List<ApiTime> data = this.apiTimeService.queryCostList(dateValue, maxSizeValue, costValue); + return ResponseValue.success(data); + } +} diff --git a/iplatform-base-admin/src/main/java/com/iplatform/base/controller/CacheController.java b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/CacheController.java new file mode 100644 index 0000000..f229a3c --- /dev/null +++ b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/CacheController.java @@ -0,0 +1,154 @@ +package com.iplatform.base.controller; + +import com.iplatform.base.SystemController; +import com.iplatform.base.VariableConstants; +import com.iplatform.base.config.CacheProperties; +import com.iplatform.base.util.cache.CacheInfo; +import com.walker.cache.CacheProvider; +import com.walker.cache.SimpleCacheManager; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.web.ResponseValue; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.data.redis.core.RedisCallback; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Properties; + +@RestController +@RequestMapping("/monitor/cache") +@ConditionalOnProperty(prefix = "iplatform.cache", name = "redis-enabled", havingValue = "true", matchIfMissing = false) +public class CacheController extends SystemController { + + private RedisTemplate<String, Object> redisTemplate; + private CacheProperties cacheProperties; + + @Autowired(required = false) + public CacheController(RedisTemplate<String, Object> redisTemplate, CacheProperties cacheProperties){ + this.redisTemplate = redisTemplate; + this.cacheProperties = cacheProperties; + } + + @RequestMapping("/clearCacheName") + public ResponseValue clearCacheName(String name){ + if(StringUtils.isEmpty(name)){ + return ResponseValue.error("蹇呴』鎸囧畾缂撳瓨鍚嶇О"); + } + CacheProvider<?> cacheProvider = SimpleCacheManager.getCacheProvider(name); + if(cacheProvider == null){ + return ResponseValue.error("缂撳瓨瀵硅薄涓嶅瓨鍦�"); + } + try { + cacheProvider.reload(); + return ResponseValue.success("缂撳瓨閲嶆柊鍔犺浇鎴愬姛"); + } catch (Exception e) { + logger.error("閲嶆柊鍔犺浇缂撳瓨澶辫触锛�" + e.getMessage(), e); + return ResponseValue.error("閲嶆柊鍔犺浇缂撳瓨澶辫触:" + name); + } + } + + /** + * 娓呯┖ 绯荤粺缂撳瓨锛岃鍔熻兘涓昏瀵� Redis 缂撳瓨鏂瑰紡锛岄�氳繃鎵嬪姩瑙﹀彂閲嶆瀯缂撳瓨锛屽湪寮�鍙戦樁娈典娇鐢ㄣ�� + * @return + * @date 2023-08-26 + */ + @RequestMapping("/clearCacheAll") + public ResponseValue reloadAllCacheProvider(){ + if(!this.cacheProperties.isRedisRebuild()){ + return ResponseValue.error("鏈紑鍚�'閲嶆瀯缂撳瓨'閫夐」"); + } + + // 2023-08-26 寮�鍚簡閲嶅缓redis缂撳瓨閫夐」 + Collection<CacheProvider<?>> cacheList = SimpleCacheManager.getCacheProviders(); + if(cacheList != null && cacheList.size() > 0){ + String name = null; + try{ + for(CacheProvider<?> cacheProvider : cacheList){ + name = cacheProvider.getProviderName(); + cacheProvider.reload(); + } + } catch (Exception ex){ + logger.error("閲嶆柊鍔犺浇鎵�鏈夌紦瀛橈紝鍑虹幇寮傚父:" + ex.getMessage() + ", name=" + name, ex); + return ResponseValue.error("閲嶆柊鍔犺浇缂撳瓨锛屽嚭鐜伴敊璇紝name = " + name); + } + } + return ResponseValue.success(); + } + + @RequestMapping("/getInfo") + public ResponseValue getInfo(){ + if(this.redisTemplate == null){ + return ResponseValue.error("绯荤粺鏈紑鍚疪edis鏂瑰紡缂撳瓨"); + } + + Properties info = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info()); +// Properties commandStats = (Properties) redisTemplate.execute((RedisCallback<Object>) connection -> connection.info("commandstats")); + Object dbSize = redisTemplate.execute((RedisCallback<Object>) connection -> connection.dbSize()); + + Map<String, Object> result = new HashMap<>(3); + result.put("info", info); + result.put("dbSize", dbSize); + result.put("commandStats", new ArrayList<>()); + + return ResponseValue.success(result); + } + + /** + * 杩斿洖缂撳瓨瀵硅薄鍚嶇О鍒楄〃锛屽嵆:绯荤粺鎵�鏈夌紦瀛樺畾涔夊悕绉伴泦鍚� + * @return + * @date 2023-01-04 + */ + @GetMapping("/select/getNames") + public ResponseValue getCacheNames(){ + List<CacheInfo> cacheNames = new ArrayList<>(); + Collection<CacheProvider<?>> cacheList = SimpleCacheManager.getCacheProviders(); + if(cacheList != null && cacheList.size() > 0){ + for(CacheProvider<?> cacheProvider : cacheList){ + cacheNames.add(new CacheInfo(cacheProvider.getProviderName(), cacheProvider.getProviderType().getName())); + } + } + return ResponseValue.success(cacheNames); + } + + @GetMapping("/select/getKeys/{cacheName}") + public ResponseValue getCacheKeys(@PathVariable String cacheName){ + if(StringUtils.isEmpty(cacheName)){ + return ResponseValue.error("鍙傛暟閿欒"); + } + List<String> keyList = new ArrayList<>((int) VariableConstants.MAX_CACHE_SHOW); + CacheProvider<?> cacheProvider = SimpleCacheManager.getCacheProvider(cacheName); + if(cacheProvider != null){ + if(cacheProvider.getCache().getPersistentSize() <= VariableConstants.MAX_CACHE_SHOW){ +// Cachable cachable = null; +// for(Iterator<Cachable> it = cacheProvider.getCache().getIterator(); it.hasNext();){ +// cachable = it.next(); +// keyList.add(cachable.getKey()); +// } + return ResponseValue.success(cacheProvider.getCache().getKeys()); + } else { + return ResponseValue.error("缂撳瓨鏁版嵁閲忚秴杩� " + VariableConstants.MAX_CACHE_SHOW + ", 鏆傛棤娉曟樉绀�"); + } + } + return ResponseValue.success(keyList); + } + + @GetMapping("/select/getValue/{cacheName}/{cacheKey}") + public ResponseValue getOneCacheValue(@PathVariable String cacheName, @PathVariable String cacheKey){ + CacheProvider<?> cacheProvider = SimpleCacheManager.getCacheProvider(cacheName); + if(cacheProvider != null){ + Object value = cacheProvider.getCacheData(cacheKey); + CacheInfo cacheInfo = new CacheInfo(cacheName, cacheKey, value.toString()); + return ResponseValue.success(cacheInfo); + } + return ResponseValue.success(); + } +} diff --git a/iplatform-base-admin/src/main/java/com/iplatform/base/controller/CategoryController.java b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/CategoryController.java new file mode 100644 index 0000000..17a56a4 --- /dev/null +++ b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/CategoryController.java @@ -0,0 +1,155 @@ +package com.iplatform.base.controller; + +import com.iplatform.base.CategoryCacheProvider; +import com.iplatform.base.Constants; +import com.iplatform.base.PlatformAdapterController; +import com.iplatform.base.cache.FormCacheProvider; +import com.iplatform.base.service.CategoryServiceImpl; +import com.iplatform.model.po.S_category; +import com.iplatform.model.vo.CategoryTreeVo; +import com.walker.infrastructure.utils.DateUtils; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.web.ResponseValue; +import com.walker.web.WebRuntimeException; +// +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +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 java.util.List; + +/** + * 骞冲彴绔熀纭�鍒嗙被鏈嶅姟 + * @date 2023-05-15 + */ +@RestController +@RequestMapping("/system/category") +public class CategoryController extends PlatformAdapterController { + + private CategoryServiceImpl categoryService; + private CategoryCacheProvider categoryCacheProvider; + private FormCacheProvider formCacheProvider; + + @Autowired + public CategoryController(CategoryServiceImpl categoryService + , CategoryCacheProvider categoryCacheProvider, FormCacheProvider formCacheProvider){ + this.categoryService = categoryService; + this.categoryCacheProvider = categoryCacheProvider; + this.formCacheProvider = formCacheProvider; + } + + @RequestMapping("/list/tree") + public ResponseValue getListTree(@RequestParam(name = "type") Integer type, + @RequestParam(name = "status") Integer status, + @RequestParam(name = "name", required = false) String name) { + int owner = (int)this.getOwner(); +// return ResponseValue.success(this.categoryService.getListTree(type, status, name, owner)); + // 2023-05-18 琛ㄥ姞涓婂叧鑱旇〃鍗曞悕绉般�� + List<CategoryTreeVo> data = this.categoryCacheProvider.getListTree(type, status, name, owner); + if(!StringUtils.isEmptyList(data)){ + data.stream().forEach(e -> { + if(e.getType().intValue() == Constants.CATEGORY_TYPE_CONFIG && StringUtils.isNotEmpty(e.getExtra())){ + // 骞冲彴閰嶇疆鍒嗙被锛宔xtra瀛樺偍鐨勬槸formId + e.setFormName(this.formCacheProvider.getCacheData(e.getExtra()).getName()); + if(!StringUtils.isEmptyList(e.getChild())){ + for(CategoryTreeVo child : e.getChild()){ + if(StringUtils.isNotEmpty(child.getExtra())){ + child.setFormName(this.formCacheProvider.getCacheData(child.getExtra()).getName()); + } + } + } + } + }); + } + return ResponseValue.success(data); + } + + @RequestMapping(value = "/info/{id}", method = RequestMethod.GET) + public ResponseValue getInfo(@PathVariable(value = "id") Integer id){ + S_category category = this.categoryCacheProvider.get(id); + if(category == null){ + throw new WebRuntimeException("鍒嗙被涓嶅瓨鍦�"); + } + return ResponseValue.success(category); + } + +// // @ApiOperation(value = "鏂板鍩虹鍒嗙被") + @RequestMapping(value = "/save", method = RequestMethod.POST) + public ResponseValue save(@RequestBody S_category category){ + if(category == null){ + return ResponseValue.error("鎻愪氦鍐呭閿欒"); + } + logger.debug(category.toString()); + + if(this.categoryService.queryNameUnique(category.getName(), category.getType(), (int)this.getOwner(), 0) > 0){ + return ResponseValue.error("鐩稿悓鍒嗙被宸茬粡瀛樺湪"); + } + + long dateTime = DateUtils.getDateTimeNumber(); + int id = this.categoryService.queryNextId(); + + category.setId(id); + category.setPath(this.getPathByPId(category.getPid())); + category.setOwner((int)this.getOwner()); + category.setExtra(this.clearCdnPrefix(category.getExtra())); // 杩欓噷棰濆淇濆瓨鐨勫彲鑳芥槸鏂囦欢璺緞淇℃伅锛屾竻闄や簡鍓嶇紑銆� + category.setCreate_time(dateTime); + category.setUpdate_time(dateTime); + this.categoryService.insert(category); + this.categoryCacheProvider.save(category); + + return ResponseValue.success(); + } + +// // @ApiOperation(value = "淇敼鍩虹鍒嗙被") + @RequestMapping(value = "/update", method = RequestMethod.POST) + public ResponseValue update(@RequestBody S_category category){ + if(category == null || category.getId() <= 0){ + throw new WebRuntimeException("鍒嗙被鍙傛暟閿欒"); + } + S_category exist = this.categoryCacheProvider.get(category.getId()); + if(exist == null){ + throw new WebRuntimeException("鍒嗙被鏁版嵁涓嶅瓨鍦紝id=" + category.getId()); + } + if(exist.getId().intValue() == category.getPid()){ + throw new WebRuntimeException("鍒嗙被鐖剁骇涓嶈兘鏄嚜宸�"); + } + if(!exist.getName().equals(category.getName())){ + if(this.categoryService.queryNameUnique(category.getName(), category.getType(), (int)this.getOwner(), exist.getId()) > 0){ + return ResponseValue.error("鍒嗙被鍚嶇О閲嶅"); + } + } + + if(StringUtils.isNotEmpty(category.getExtra())){ + category.setExtra(this.clearCdnPrefix(category.getExtra())); + } + category.setPath(this.getPathByPId(category.getPid())); + category.setOwner((int)this.getOwner()); + category.setUpdate_time(DateUtils.getDateTimeNumber()); + this.categoryService.execUpdateCategory(category); + this.categoryCacheProvider.update(category); + return ResponseValue.success(); + } + + @RequestMapping("/delete") + public ResponseValue delete(Integer id){ +// S_category category = this.categoryCacheProvider.get(id); + if(this.categoryService.queryChildCategorySize(id) > 0){ + return ResponseValue.error("褰撳墠鍒嗙被涓嬫湁瀛愮被锛岃鍏堝垹闄ゅ瓙绫伙紒"); + } + this.categoryService.delete(new S_category(id)); + this.categoryCacheProvider.remove(id); + return ResponseValue.success(); + } + + private String getPathByPId(Integer pid) { + S_category category = this.categoryCacheProvider.get(pid); + if (category != null) { + return category.getPath() + pid + StringUtils.FOLDER_SEPARATOR; + } + return "/0/"; + } +} diff --git a/iplatform-base-admin/src/main/java/com/iplatform/base/controller/CodeController.java b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/CodeController.java new file mode 100644 index 0000000..fd3bc18 --- /dev/null +++ b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/CodeController.java @@ -0,0 +1,237 @@ +package com.iplatform.base.controller; + +import com.iplatform.base.SystemController; +import com.iplatform.base.pojo.dict.DictParam; +import com.iplatform.base.service.CodeServiceImpl; +import com.iplatform.model.po.S_dict_data; +import com.iplatform.model.po.S_dict_type; +import com.iplatform.model.po.S_user_core; +import com.walker.db.page.GenericPager; +import com.walker.infrastructure.utils.DateUtils; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.web.DataStatus; +import com.walker.web.ResponseValue; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.ArrayList; +import java.util.List; + +@RestController +@RequestMapping("/system/dict") +public class CodeController extends SystemController { + + private CodeServiceImpl codeService; + + @Autowired + public CodeController(CodeServiceImpl codeService){ + this.codeService = codeService; + } + + /** 绫诲瀷鍒楄〃 */ + @RequestMapping("/type/list") + public ResponseValue listType(DictParam dictParam){ + logger.debug(dictParam.toString()); + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // 闇�瑕佹坊鍔犳嫤鎴櫒锛岀粺涓�閿�姣佺嚎绋嬪彉閲忓璞★紝椹笂瑕佽ˉ鍏咃紝2022-11-19 + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// this.preparePageSearch(); + + long beginTime = -1; + long endTime = -1; + if(dictParam.getParams().get("beginTime") != null){ + beginTime = this.getParamsDateTime(dictParam.getParams().get("beginTime").toString(), false); + } + if(dictParam.getParams().get("endTime") != null){ + endTime = this.getParamsDateTime(dictParam.getParams().get("endTime").toString(), false); + } + logger.debug("beginTime = " + beginTime + ", endTime = " + endTime); + + GenericPager<S_dict_type> pager = this.codeService.queryPageDictType(dictParam.getDictName() + , dictParam.getDictType(), dictParam.getStatus(), beginTime, endTime); +// return this.acquireTablePage(pager.getDatas(), pager.getTotalRows()); + return ResponseValue.success(pager); + } + + /** 鏂板绫诲瀷 */ + @PostMapping("/type/add") + public ResponseValue<?> addType(@RequestBody DictParam dictParam){ + S_user_core currentUser = getCurrentUser(); + S_dict_type byDictType = codeService.getByDictType(dictParam.getDictType()); + if (byDictType != null) { + return ResponseValue.error("瀛楀吀绫诲瀷[" + byDictType.getDict_type() + "] 宸插瓨鍦�!"); + } + S_dict_type dictType = new S_dict_type(); + dictType.setDict_type(dictParam.getDictType()); + dictType.setDict_name(dictParam.getDictName()); + if (dictParam.getStatus() == null) { + dictType.setStatus(DataStatus.CONST_NORMAL); + } else { + dictType.setStatus(dictParam.getStatus()); + } + if (currentUser != null) { + dictType.setCreate_by(currentUser.getUser_name()); + dictType.setCreate_time(DateUtils.getDateTimeNumber()); + } + dictType.setRemark(dictParam.getRemark()); + this.codeService.save(dictType); + return ResponseValue.success(null); + } + + /** 绫诲瀷淇敼 */ + @PostMapping("/type/upd") + public ResponseValue<?> updType(@RequestBody DictParam dictParam){ + S_dict_type dictType = new S_dict_type(); + dictType.setDict_id(dictParam.getDict_id()); + dictType.setDict_name(dictParam.getDictName()); + dictType.setStatus(dictParam.getStatus()); + dictType.setRemark(dictParam.getRemark()); + this.codeService.update(dictType); + return ResponseValue.success(null); + } + + /** 绫诲瀷鍒犻櫎 */ + @DeleteMapping("/type/del") + public ResponseValue<?> delType(@RequestBody DictParam dictParam) { + this.codeService.execDelType(dictParam.getDict_id()); + return ResponseValue.success(null); + } + + /** 绫诲瀷璇︽儏 */ + @RequestMapping("/type/{dictId}") + public ResponseValue detailDictType(@PathVariable Long dictId){ + if(dictId == null || dictId.longValue() <= 0){ + return ResponseValue.error("瀛楀吀id閿欒"); + } + return ResponseValue.success(this.codeService.queryOneDictType(dictId)); + } + + /** + * 鍦ㄦ暟鎹瓧鍏搁」绠$悊鐣岄潰锛屾煡璇㈡潯浠跺睍绀烘墍鏈�'瀛楀吀绫诲瀷'鍒楄〃銆�<p></p> + * 鍥犱负鏉冮檺閰嶇疆鐨勬槸: /system/dict/data/** 寮�鏀撅紝鍥犳璇ユ潈闄愪篃閰嶇疆鍒癲ata锛屽惁鍒欒繕闇�瑕佸啀鍔犱笂涓�涓潈闄愮偣銆� + * @return + * @date 2022-11-19 + */ +// @GetMapping("/type/optionselect") + @GetMapping("/data/optionselect") + public ResponseValue showDictTypeListAll(){ + List<S_dict_type> list = this.codeService.selectAll(new S_dict_type()); + return ResponseValue.success(list); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~` + + /** + * 鏍规嵁浠g爜琛ㄥ悕瀛楋紝鏌ヨ鍖呭惈鐨勪唬鐮侀」闆嗗悎銆� + * @param dictType + * @return + */ + @RequestMapping("/data/type/{dictType}") + public ResponseValue<List<S_dict_data>> dictTypeList(@PathVariable String dictType){ + logger.debug("dictType = " + dictType); + List<S_dict_data> list = this.codeService.queryDictDataByType(dictType); + if(StringUtils.isEmptyList(list)){ + list = new ArrayList<S_dict_data>(2); + } + return ResponseValue.success(list); + } + + /** 瀛楀吀鏁版嵁鍒楄〃 */ + @RequestMapping("/data/list") + public ResponseValue listData(DictParam dictParam){ +// this.preparePageSearch(); + if(StringUtils.isEmpty(dictParam.getDictType())){ + return ResponseValue.error("蹇呴』鎻愪緵瀛楀吀绫诲瀷鍙傛暟"); + } + GenericPager<S_dict_data> pager = this.codeService.queryPageDictData(dictParam.getDictType(), dictParam.getDictLabel()); +// return this.acquireTablePage(pager.getDatas(), pager.getTotalRows()); + return ResponseValue.success(pager); + } + + /** 瀛楀吀鏁版嵁鏂板 */ + @PostMapping("/add") + public ResponseValue<?> addDictData(@RequestBody S_dict_data s_dict_data){ + logger.debug(s_dict_data.toString()); +// if(s_dict_data.getDict_code() == null){ +// return ResponseValue.error("瀛楀吀id蹇呴』杈撳叆!"); +// } + if(s_dict_data.getParent_id() == null){ + return ResponseValue.error("鐖秈d蹇呴』杈撳叆!"); + } + S_dict_data dict_data = this.getDictCacheProvider().getCacheData(String.valueOf(s_dict_data.getDict_code())); + if(dict_data != null){ + return ResponseValue.error("瀛楀吀id宸插瓨鍦�!"); + } + String error = this.validateDictData(s_dict_data, true); + if(error != null){ + return ResponseValue.error(error); + } + s_dict_data.setIs_default("N"); + if(StringUtils.isEmpty(s_dict_data.getDict_value())){ + // 瀛楀吀鍊煎鏋滀笉濉紝蹇呴』鍜宨d涓�鑷� + s_dict_data.setDict_value(String.valueOf(s_dict_data.getDict_code())); + } +// s_dict_data.setDict_code(NumberGenerator.getSequenceNumber()); + s_dict_data.setCreate_time(DateUtils.getDateTimeNumber(System.currentTimeMillis())); + + this.codeService.save(s_dict_data); + this.getDictCacheProvider().putCacheData(String.valueOf(s_dict_data.getDict_code()), s_dict_data); + return ResponseValue.success(); + } + + + /** 瀛楀吀鏁版嵁璇︽儏 */ + @RequestMapping("/data/{dictCode}") + public ResponseValue getDictDataInfo(@PathVariable Long dictCode){ + S_dict_data e = this.codeService.queryOneDictData(dictCode); + return ResponseValue.success(e); + } + + /** 瀛楀吀鏁版嵁淇敼 */ + @RequestMapping("/edit") + public ResponseValue updateDictData(@RequestBody S_dict_data s_dict_data){ + String error = this.validateDictData(s_dict_data, false); + if(error != null){ + return ResponseValue.error(error); + } + this.codeService.save(s_dict_data); + this.getDictCacheProvider().updateCacheData(String.valueOf(s_dict_data.getDict_code()), s_dict_data); + return ResponseValue.success(); + } + + /** 瀛楀吀鏁版嵁鍒犻櫎 */ + @RequestMapping("/data/remove/{dictCodes}") + public ResponseValue removeDictData(@PathVariable Long[] dictCodes){ + this.codeService.execDeleteDictData(dictCodes); + return ResponseValue.success(); + } + + /** + * 鏍¢獙 + * @param s_dict_data 鏁版嵁 + * @param checkExist 鏄惁妫�鏌ュ瓨鍦� + * @return 閿欒淇℃伅 + */ + private String validateDictData(S_dict_data s_dict_data, boolean checkExist){ + if(s_dict_data == null){ + return "鎻愪氦瀛楀吀鍐呭涓虹┖"; + } + if(StringUtils.isEmpty(s_dict_data.getDict_type())){ + return "璇烽�夋嫨瀛楀吀绫诲瀷"; + } + if(StringUtils.isEmpty(s_dict_data.getDict_label())){ + return "璇疯緭鍏ュ瓧鍏告爣绛�"; + } +// if(StringUtils.isEmpty(s_dict_data.getDict_value())){ +// return "璇疯緭鍏ュ瓧鍏稿��"; +// } + + if(checkExist){ + S_dict_data exist = this.codeService.queryOneDictData(s_dict_data.getDict_type(), s_dict_data.getDict_value()); + if(exist != null){ + return "宸茬粡瀛樺湪璇ュ瓧鍏稿�硷紝璇烽噸鏂拌緭鍏�"; + } + } + return null; + } +} diff --git a/iplatform-base-admin/src/main/java/com/iplatform/base/controller/ConfigController.java b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/ConfigController.java new file mode 100644 index 0000000..0f1a15c --- /dev/null +++ b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/ConfigController.java @@ -0,0 +1,175 @@ +package com.iplatform.base.controller; + +import com.iplatform.base.SystemController; +import com.iplatform.base.cache.FormCacheProvider; +import com.iplatform.base.pojo.ConfigParam; +import com.iplatform.base.pojo.form.FormData; +import com.iplatform.base.pojo.form.FormDataItem; +import com.iplatform.base.service.ConfigArgumentServiceImpl; +import com.iplatform.model.po.S_config; +import com.walker.db.page.GenericPager; +import com.walker.infrastructure.arguments.ArgumentsManager; +import com.walker.infrastructure.arguments.Variable; +import com.walker.infrastructure.utils.DateUtils; +import com.walker.infrastructure.utils.NumberGenerator; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.web.ResponseValue; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +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 java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +@RestController +@RequestMapping("/system/config") +public class ConfigController extends SystemController { + + private ConfigArgumentServiceImpl configArgumentService; + + private ArgumentsManager argumentsManager = null; + private FormCacheProvider formCacheProvider; + + @Autowired + public ConfigController(ConfigArgumentServiceImpl configArgumentService + , ArgumentsManager argumentsManager, FormCacheProvider formCacheProvider){ + this.configArgumentService = configArgumentService; + this.argumentsManager = argumentsManager; + this.formCacheProvider = formCacheProvider; + } + + @RequestMapping("/list") + public ResponseValue list(ConfigParam configParam){ +// this.preparePageSearch(); + GenericPager<S_config> pager = this.configArgumentService.queryPageConfigList(configParam.getConfigName() + , configParam.getConfigKey(), configParam.getConfigType()); +// return this.acquireTablePage(pager.getDatas(), pager.getTotalRows()); + // 缂撳瓨鍓嶇灏佽鐨則able缁勪欢锛屽彲浠ョ洿鎺ヨ繑鍥炲垎椤靛璞°��2023-04-11 + return ResponseValue.success(pager); + } + + @RequestMapping("/view/{configId}") + public ResponseValue view(@PathVariable Long configId){ + if(configId == null || configId.longValue() <= 0){ + return ResponseValue.error("config id required!"); + } + S_config s_config = this.configArgumentService.get(new S_config(configId)); + return ResponseValue.success(s_config); + } + + @RequestMapping("/edit") + public ResponseValue saveEdit(@RequestBody S_config s_config){ + S_config exist = this.configArgumentService.get(new S_config(s_config.getConfig_id())); + if(exist == null){ + return ResponseValue.error("閰嶇疆椤逛笉瀛樺湪: " + s_config.getConfig_id()); + } + this.configArgumentService.save(s_config); + this.argumentsManager.persist(s_config.getConfig_key(), s_config.getConfig_value()); + return ResponseValue.success(); + } + + /** + * 娣诲姞淇濆瓨鏂伴厤缃」銆� + * @param s_config + * @return + */ + @RequestMapping("/add") + public ResponseValue saveAdd(@RequestBody S_config s_config){ + if(s_config == null || StringUtils.isEmpty(s_config.getConfig_key())){ + return ResponseValue.error("鎻愪氦閰嶇疆鏁版嵁閿欒"); + } + S_config exist = this.configArgumentService.queryConfigByKey(s_config.getConfig_key()); + if(exist != null){ + return ResponseValue.error("閰嶇疆椤瑰凡缁忓瓨鍦�: " + s_config.getConfig_key()); + } + s_config.setConfig_id(NumberGenerator.getSequenceNumber()); + s_config.setCreate_time(DateUtils.getDateTimeNumber(System.currentTimeMillis())); + this.configArgumentService.insert(s_config); + this.argumentsManager.persist(s_config.getConfig_key(), s_config.getConfig_value()); + return ResponseValue.success(); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + //~ 2023-05-16 鏂扮晫闈娇鐢紝鐢靛晢绯荤粺銆� + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + /** + * 鑾峰緱涓�涓敮涓�閰嶇疆椤圭殑鍊笺�� + * @param key + * @return + * @date 2023-05-15 + */ + @RequestMapping(value = "/getuniq", method = RequestMethod.GET) + public ResponseValue getConfigValue(@RequestParam String key){ + String configValue = this.getArgumentVariable(key).getStringValue(); + return ResponseValue.success("success", configValue); + } + + /** + * 鏍规嵁formId锛堝垎缁勶級鑾峰緱鍖呭惈鐨勬墍鏈夐厤缃」闆嗗悎锛屽寘鎷細key锛寁alue + * @param formId + * @return + * @date 2023-05-16 + */ + @RequestMapping(value = "/info", method = RequestMethod.GET) + public ResponseValue info(@RequestParam(value = "formId") Integer formId){ + if(formId == null){ + return ResponseValue.error("鍙傛暟閿欒"); + } + List<Variable> list = this.argumentsManager.getVariableList(String.valueOf(formId)); + if(StringUtils.isEmptyList(list)){ + return ResponseValue.success(new HashMap<>(1)); + } + + HashMap<String, String> map = new HashMap<>(8); + for (Variable systemConfig : list) { + map.put(systemConfig.getId(), systemConfig.getStringValue()); + } + map.put("id", formId.toString()); + + if(this.logger.isDebugEnabled()){ + this.logger.debug(map.toString()); + } + return ResponseValue.success(map); + } + + @RequestMapping(value = "/save/form", method = RequestMethod.POST) + public ResponseValue saveFormConfig(@RequestBody FormData formData){ + if(formData == null || formData.getId() == null || StringUtils.isEmptyList(formData.getFields())){ + return ResponseValue.error("鍙傛暟閿欒"); + } + try{ + this.formCacheProvider.validateForm(formData); + } catch (Exception ex){ + return ResponseValue.error("琛ㄥ崟閰嶇疆鏁版嵁鏍煎紡閿欒锛�" + ex.getMessage()); + } + + List<Object[]> savedConfigList = new ArrayList<>(8); + Object[] config = null; + String value = null; + for(FormDataItem formDataItem : formData.getFields()){ + value = this.clearCdnPrefix(formDataItem.getValue()); + if(StringUtils.isEmpty(value)){ + // 鍘绘帀鍥剧墖鍩熷悕涔嬪悗娌℃湁鏁版嵁鍒欒鏄庡綋鍓嶆暟鎹氨鏄浘鐗囧煙鍚� + logger.debug("閰嶇疆鐨勫�兼槸锛氬浘鐗囧煙鍚嶏紝" + formDataItem.getValue()); + value = formDataItem.getValue(); + } + config = new Object[2]; + config[0] = value; + config[1] = formDataItem.getName(); + savedConfigList.add(config); + } + + // 澶氫釜閰嶇疆椤瑰悓鏃舵洿鏂� + this.configArgumentService.execUpdateFormConfig(savedConfigList); + for(Object[] one : savedConfigList){ + this.argumentsManager.persist(one[1].toString(), one[0]); + } + return ResponseValue.success(); + } +} diff --git a/iplatform-base-admin/src/main/java/com/iplatform/base/controller/ConfigFormController.java b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/ConfigFormController.java new file mode 100644 index 0000000..6a10890 --- /dev/null +++ b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/ConfigFormController.java @@ -0,0 +1,127 @@ +package com.iplatform.base.controller; + +import com.iplatform.base.PlatformAdapterController; +import com.iplatform.base.PlatformRuntimeException; +import com.iplatform.base.cache.FormCacheProvider; +import com.iplatform.base.pojo.KeywordsParam; +import com.iplatform.base.pojo.form.RequestForm; +import com.iplatform.base.service.ConfigFormServiceImpl; +import com.iplatform.model.po.S_config_form; +import com.iplatform.model.vo.ConfigFormVo; +import com.walker.db.page.GenericPager; +import com.walker.infrastructure.utils.DateUtils; +import com.walker.infrastructure.utils.JsonUtils; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.infrastructure.utils.UrlUtils; +import com.walker.web.ResponseValue; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; +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; + +/** + * 閰嶇疆琛ㄥ崟绠$悊鍔熻兘銆� + * @author 鏃跺厠鑻� + * @date 2023-05-16 + */ +@RestController +@RequestMapping("/system/form") +public class ConfigFormController extends PlatformAdapterController { + + private ConfigFormServiceImpl configFormService; + private FormCacheProvider formCacheProvider; + + @Autowired + public ConfigFormController(ConfigFormServiceImpl configFormService, FormCacheProvider formCacheProvider){ + this.configFormService = configFormService; + this.formCacheProvider = formCacheProvider; + } + + @RequestMapping(value = "/update", method = RequestMethod.POST) + public ResponseValue edit(@RequestParam Integer id, @RequestBody RequestForm requestForm){ + if(requestForm == null || StringUtils.isEmpty(requestForm.getContent()) || id == null){ + return ResponseValue.error("鍙傛暟閿欒"); + } + + try { + JsonUtils.jsonStringToObject(requestForm.getContent(), ConfigFormVo.class); + S_config_form form = this.acquireConfigForm(requestForm, id); + this.configFormService.save(form); + this.formCacheProvider.updateCacheData(String.valueOf(form.getId()), form); + logger.info("缂栬緫琛ㄥ崟妯℃澘鎴愬姛锛�" + requestForm.getName()); + + } catch (Exception e) { + logger.error(requestForm.getContent()); + throw new PlatformRuntimeException("鏇存柊琛ㄥ崟妯℃澘鏍煎紡涓嶆纭�:" + e.getMessage(), e); + } + return ResponseValue.success(); + } + + /** + * 淇濆瓨鏂板垱寤鸿〃鍗曟ā鏉裤�� + * @param requestForm + * @return + * @date 2023-05-23 + */ + @RequestMapping(value = "/save", method = RequestMethod.POST) + public ResponseValue add(@RequestBody RequestForm requestForm){ + if(requestForm == null || StringUtils.isEmpty(requestForm.getContent())){ + return ResponseValue.error("鍙傛暟閿欒"); + } + try { + JsonUtils.jsonStringToObject(requestForm.getContent(), ConfigFormVo.class); +// S_config_form form = new S_config_form(); +// form.setName(requestForm.getName()); +// form.setInfo(requestForm.getInfo()); +// form.setContent(requestForm.getContent()); +// form.setCreate_time(DateUtils.getDateTimeNumber()); +// form.setUpdate_time(form.getCreate_time()); +// form.setId(this.configFormService.queryNextId()); + S_config_form form = this.acquireConfigForm(requestForm, this.configFormService.queryNextId()); + this.configFormService.insert(form); + this.formCacheProvider.putCacheData(String.valueOf(form.getId()), form); + logger.info("鍒涘缓琛ㄥ崟妯℃澘鎴愬姛锛�" + requestForm.getName()); + + } catch (Exception e) { + logger.error(requestForm.getContent()); + throw new PlatformRuntimeException("鍒涘缓鐨勮〃鍗曟ā鏉挎牸寮忎笉姝g‘:" + e.getMessage(), e); + } + return ResponseValue.success(); + } + + private S_config_form acquireConfigForm(RequestForm requestForm, int id){ + S_config_form form = new S_config_form(); + form.setName(requestForm.getName()); + form.setInfo(requestForm.getInfo()); + form.setContent(requestForm.getContent()); + form.setCreate_time(DateUtils.getDateTimeNumber()); + form.setUpdate_time(form.getCreate_time()); + form.setId(id); + return form; + } + + @RequestMapping(value = "/info", method = RequestMethod.GET) + public ResponseValue info(@RequestParam(value = "id") Integer id){ +// S_config_form form = this.configFormService.get(new S_config_form(id)); + if(id == null || id.intValue() <= 0){ + return ResponseValue.error(); + } + S_config_form form = this.formCacheProvider.getCacheData(id.toString()); + if(form == null){ + return ResponseValue.error("琛ㄥ崟涓嶅瓨鍦�, id=" + id); + } + return ResponseValue.success(form); + } + + @RequestMapping(value = "/list", method = RequestMethod.GET) + public ResponseValue list(KeywordsParam keywordsParam){ + String keywords = null; + if(keywordsParam != null && StringUtils.isNotEmpty(keywordsParam.getKeywords())){ + keywords = UrlUtils.decode(keywordsParam.getKeywords()); + } + GenericPager<S_config_form> pager = this.configFormService.queryPageFormList(keywords); + return ResponseValue.success(pager); + } +} diff --git a/iplatform-base-admin/src/main/java/com/iplatform/base/controller/DeptController.java b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/DeptController.java new file mode 100644 index 0000000..b15f944 --- /dev/null +++ b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/DeptController.java @@ -0,0 +1,283 @@ +package com.iplatform.base.controller; + +import com.iplatform.base.SystemController; +import com.iplatform.base.pojo.DeptParam; +import com.iplatform.base.service.DeptServiceImpl; +import com.iplatform.base.util.DeptUtils; +import com.iplatform.model.po.S_dept; +import com.iplatform.model.po.S_user_core; +import com.walker.infrastructure.tree.TreeNode; +import com.walker.infrastructure.utils.DateUtils; +import com.walker.infrastructure.utils.NumberGenerator; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.web.DataStatus; +import com.walker.web.OrgType; +import com.walker.web.ResponseValue; +import com.walker.web.UserType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/system/dept") +public class DeptController extends SystemController { + + private DeptServiceImpl deptService; + + @Autowired + public DeptController(DeptServiceImpl deptService){ + this.deptService = deptService; + } + + /** + * 鍓嶇灞曠ず鎵�鏈夐《绾у崟浣嶅垪琛紝瓒呯骇绠$悊鍛樺彲浠ラ�夋嫨鎵�鏈夋満鏋勶紝鏅�氱敤鎴峰彧鑳芥樉绀鸿嚜宸卞崟浣嶇殑銆� + * @return + * @date 2022-12-15 + */ + @GetMapping("/select/list_root_org") + public ResponseValue listOrgRoot(){ + List<S_dept> rootList = this.getOrgListScope(); + return ResponseValue.success(rootList); + } + + /** + * 鍓嶇灞曠ず閮ㄩ棬鏈烘瀯鏍�(鍗曚釜缁勭粐鏈烘瀯)锛屽湪娣诲姞鐢ㄦ埛閫夐儴闂ㄤ娇鐢ㄣ�� + * @param deptId 鎻愪緵涓�涓儴闂↖D(鐣岄潰閫夋嫨)锛岃鍙傛暟鍦ㄨ秴绾х鐞嗗憳鏃朵娇鐢ㄣ�� + * @return + * @date 2022-12-12 + */ + @GetMapping("/select/tree_dept/{deptId}") + public ResponseValue listSelectDeptTree(@PathVariable Long deptId){ + long orgId = 0; + if(this.isSupervisor()){ + if(deptId == null || deptId.longValue() <= 0){ + return ResponseValue.error("鏌ヨ涓�涓満鏋勬爲锛屽繀椤讳紶鍏ユ満鏋処D"); + } + orgId = this.getRootOrgIdByDept(deptId); + } else { + orgId = this.getCurrentUser().getOrg_id(); + } + List<S_dept> orgList = this.deptService.queryOrgListForTree(orgId); + List<TreeNode> treeNodeList = DeptUtils.getOrgDeptTree(orgList); + if(StringUtils.isEmptyList(treeNodeList)){ + // 2023-05-31 鏍戠粍浠朵笉鑳芥暟鎹负绌� + treeNodeList = new ArrayList<>(1); + } + return ResponseValue.success(treeNodeList); + } + + /** + * 閫夋嫨鏁翠釜缁勭粐鏈烘瀯鏍戯紝鍖哄垎鏄惁绠$悊鍛樸��<p></p> + * <pre> + * 1)璇ュ姛鑳芥槸鍏叡鏉冮檺锛宻ystem:dept:select:** + * 2)灞曠ず鎵�鏈夋満鏋勬爲鑺傜偣锛屽鏋滄槸瓒呯骇绠$悊鍛樺垯浼氭樉绀烘墍鏈夋牴鍗曚綅(闆嗗洟)銆� + * 3)鏅�氱敤鎴峰彧鑳界湅鍒版湰鍗曚綅鏈烘瀯鏍戙�� + * </pre> + * @return + * @date 2022-12-08 + */ + @GetMapping("/select/tree_org") + public ResponseValue listOrgRootTree(){ + List<S_dept> orgList = null; + if(this.isSupervisor()){ + orgList = this.deptService.queryOrgListForTree(-1); + } else { + long orgId = this.getCurrentUser().getOrg_id(); + orgList = this.deptService.queryOrgListForTree(orgId); + } +// DeptTreeGenerator deptTreeGenerator = new DeptTreeGenerator(null); +// deptTreeGenerator.setEntityList(orgList); +// List<TreeNode> treeNodeList = deptTreeGenerator.getTreeRootList(); + List<TreeNode> treeNodeList = DeptUtils.getOrgDeptTree(orgList); + if(StringUtils.isEmptyList(treeNodeList)){ + logger.error("鏈壘鍒颁换浣曢《绾ф満鏋勬爲鍒楄〃: treeNodeList = null"); + } else { +// logger.debug(treeNodeList.toString()); + } + return ResponseValue.success(treeNodeList); + } + + @GetMapping("/list") + public ResponseValue listOrgList(DeptParam deptParam){ + + String deptDataScope = this.getCurrentDataScope("103"); + logger.info("閮ㄩ棬绠$悊(鏁版嵁鏉冮檺) = " + deptDataScope); + + Map<String, Object> data = new HashMap<>(4); + + if(deptParam.getLoadSelect() == 1){ + // 鏉ヨ嚜涓嬫媺鏈烘瀯閫夋嫨妗嗚姹� + List<S_dept> selectParentList = this.deptService.queryRootOrgChildrenList(deptParam.getOrgId(), null); + data.put("deptList", DeptUtils.toSystemDeptList(selectParentList)); + return ResponseValue.success(data); + } + + List<S_dept> rootList = this.getOrgListScope(); + S_user_core currentUser = this.getCurrentUser(); + List<S_dept> deptSrcList = null; + + long selectedOrgRoot = 0; + if(currentUser.getUser_type().intValue() == UserType.TYPE_SUPER){ + // 瓒呯骇绠$悊鍛橈紝鍙互鐪嬪埌鎵�鏈夋牴鍗曚綅鍒楄〃 + if(deptParam != null && deptParam.getOrgId() > 0){ + // 绠$悊鍛橀�夋嫨浜嗕竴涓牴鏈烘瀯 + selectedOrgRoot = deptParam.getOrgId(); + } else if(!StringUtils.isEmptyList(rootList)){ + // 娌℃湁閫夋嫨锛屽垯榛樿鏌ヨ绗竴涓牴鏈烘瀯涓嬮潰鐨� + selectedOrgRoot = rootList.get(0).getId(); + } + deptSrcList = this.deptService.queryRootOrgChildrenList(selectedOrgRoot, deptParam.getDeptName()); + data.put("deptList", DeptUtils.toSystemDeptList(deptSrcList)); + } else { + // 鍏朵粬鐢ㄦ埛鍙兘鐪嬪埌鑷繁鎵�鍦ㄦ牴鏈烘瀯涓嬬殑鎵�鏈夋満鏋� + deptSrcList = this.deptService.queryRootOrgChildrenList(currentUser.getOrg_id(), deptParam.getDeptName()); + data.put("deptList", DeptUtils.toSystemDeptList(deptSrcList)); + } + + // 璁板綍瓒呯骇绠$悊鍛橀�夋嫨鐨勯《绾ф満鏋勶紝杩斿洖鍓嶇銆�2022-12-03 + if(deptParam.getOrgId() > 0){ + data.put("selectedRootOrgId", deptParam.getOrgId()); + } else { + data.put("selectedRootOrgId", rootList.get(0).getId()); + } + + data.put("rootOrgList", rootList); + return ResponseValue.success(data); + } + + @PostMapping("/add") + public ResponseValue saveAddDept(@RequestBody S_dept s_dept){ + if(s_dept == null || StringUtils.isEmpty(s_dept.getDept_name())){ + return ResponseValue.error("鎻愪氦淇濆瓨鏈烘瀯涓虹┖"); + } + logger.info(s_dept.toString()); + + s_dept.setId(NumberGenerator.getSequenceNumber()); + s_dept.setCreate_time(DateUtils.getDateTimeNumber(System.currentTimeMillis())); + s_dept.setCreate_by(this.getCurrentUser().getUser_name()); + + Long parentId = s_dept.getParent_id(); + if(parentId == null || parentId.longValue() == 0){ + // 璇存槑鏄牴鏈烘瀯锛屾牴鏈烘瀯: id = org_id + s_dept.setOrg_id(s_dept.getId()); + s_dept.setParent_id(0L); + s_dept.setAncestors("0"); + if(s_dept.getOrg_type().intValue() != OrgType.TYPE_ORG){ + return ResponseValue.error("椤剁骇鏈烘瀯鍙兘閫夋嫨绗竴椤�"); + } + + } else { + // 鏅�氭満鏋� + S_dept parentDept = this.deptService.queryOneDept(parentId); + if(parentDept == null){ + return ResponseValue.error("涓婄骇鍗曚綅涓嶅瓨鍦�"); + } + if(parentDept.getStatus().intValue() != DataStatus.CONST_NORMAL){ + return ResponseValue.error("璇ユ満鏋勫凡鍋滅敤锛屾棤娉曞垱寤哄瓙鏈烘瀯"); + } + s_dept.setOrg_id(parentDept.getOrg_id()); + s_dept.setAncestors(parentDept.getAncestors() + "," + s_dept.getParent_id()); + + String error = this.checkOrgType(parentDept.getOrg_type(), s_dept.getOrg_type()); + if(error != null){ + return ResponseValue.error(error); + } + } + this.deptService.insert(s_dept); +// this.deptCacheProvider.putDept(s_dept); + this.getDeptCacheProvider().putDept(s_dept); + return ResponseValue.success(); + } + + @RequestMapping("/remove/{deptId}") + public ResponseValue removeDept(@PathVariable Long deptId){ + if(deptId == null || deptId <= 0){ + return ResponseValue.error("鏈烘瀯鍙傛暟閿欒"); + } + int subDeptSize = this.deptService.querySubDeptSizeInCurrent(deptId); + if(subDeptSize > 0){ + return ResponseValue.error("璇ユ満鏋勪笅瀛樺湪瀛愭満鏋勶紝鏃犳硶鍒犻櫎"); + } + long userSize = this.deptService.queryUserSizeInCurrent(deptId); + if(userSize > 0){ + return ResponseValue.error("璇ユ満鏋勪笅瀛樺湪鐢ㄦ埛锛屾棤娉曞垹闄�"); + } + this.deptService.delete(new S_dept(deptId)); +// this.deptCacheProvider.removeDept(deptId); + this.getDeptCacheProvider().removeDept(deptId); + return ResponseValue.success(); + } + + @PostMapping("/edit") + public ResponseValue saveEdit(@RequestBody S_dept s_dept){ + if(s_dept == null){ + return ResponseValue.error("缂栬緫鐨勬満鏋勪笉瀛樺湪"); + } + Long deptId = s_dept.getId(); + if(deptId == null || deptId.longValue() <= 0){ + return ResponseValue.error("缂栬緫鐨勬満鏋処D涓嶅瓨鍦�"); + } + Long parentId = s_dept.getParent_id(); + if(parentId == null || parentId.longValue() == 0){ + // 璇存槑缂栬緫鐨勬槸椤剁骇鏈烘瀯锛屾牴鏈烘瀯: id = org_id + if(s_dept.getOrg_type().intValue() != OrgType.TYPE_ORG){ + return ResponseValue.error("椤剁骇鏈烘瀯鍙兘閫夋嫨涓�绾ф満鏋�"); + } + } else { + // 鏅�氭満鏋� + S_dept parentDept = this.deptService.queryOneDept(parentId); + if(parentDept == null){ + return ResponseValue.error("涓婄骇鍗曚綅涓嶅瓨鍦�"); + } + String error = this.checkOrgType(parentDept.getOrg_type(), s_dept.getOrg_type()); + if(error != null){ + return ResponseValue.error(error); + } + } + s_dept.setCreate_time(DateUtils.getDateTimeNumber(System.currentTimeMillis())); + this.deptService.save(s_dept); +// this.deptCacheProvider.updateDept(s_dept); + this.getDeptCacheProvider().updateDept(s_dept); + return ResponseValue.success(); + } + + @GetMapping("/view/{deptId}") + public ResponseValue viewDept(@PathVariable Long deptId){ + if(deptId == null || deptId.longValue() <= 0){ + return ResponseValue.error("鍙傛暟閿欒"); + } + S_dept s_dept = this.deptService.queryOneDept(deptId); + if(s_dept == null){ + return ResponseValue.error("鏈烘瀯涓嶅瓨鍦�"); + } + return ResponseValue.success(s_dept); + } + + private String checkOrgType(int parentOrgTypeValue, int currentOrgTypeValue){ + OrgType parentOrgType = OrgType.getType(parentOrgTypeValue); + OrgType currentOrtType = OrgType.getType(currentOrgTypeValue); + if(currentOrtType == OrgType.OrgSub){ + if(parentOrgType != OrgType.Org){ + return "浜岀骇鍗曚綅鍙兘鍦ㄩ《绾у崟浣嶄笅闈�"; + } + } else if (currentOrtType == OrgType.OrgFactory) { + if(parentOrgType != OrgType.OrgSub){ + return "涓夌骇鍗曚綅鍙兘鍦ㄤ簩绾у崟浣嶄笅闈�"; + } + } else if (currentOrtType == OrgType.OrgSubFactory) { + if(parentOrgType != OrgType.OrgFactory){ + return "鍥涚骇鍗曚綅鍙兘鍦ㄤ笁绾х骇鍗曚綅涓嬮潰"; + } + } + return null; + } +} diff --git a/iplatform-base-admin/src/main/java/com/iplatform/base/controller/GroupController.java b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/GroupController.java new file mode 100644 index 0000000..9d1e338 --- /dev/null +++ b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/GroupController.java @@ -0,0 +1,164 @@ +package com.iplatform.base.controller; + +import com.iplatform.base.PlatformAdapterController; +import com.iplatform.base.PlatformRuntimeException; +import com.iplatform.base.cache.FormCacheProvider; +import com.iplatform.base.pojo.GroupDataParam; +import com.iplatform.base.pojo.KeywordsParam; +import com.iplatform.base.pojo.form.FormData; +import com.iplatform.base.pojo.group.GroupData; +import com.iplatform.base.service.GroupServiceImpl; +import com.iplatform.model.po.S_group; +import com.iplatform.model.po.S_group_data; +import com.walker.db.page.GenericPager; +import com.walker.infrastructure.utils.DateUtils; +import com.walker.infrastructure.utils.JsonUtils; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.infrastructure.utils.UrlUtils; +import com.walker.web.ResponseValue; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.util.List; + +/** + * 骞冲彴鍒嗙粍鏁版嵁绠$悊銆� + * <p>瀹炵幇閰嶇疆鍔熻兘鍧楄兘鍖呭惈鍝簺鍐呭椤癸紝濡傦細鎵嬫満棣栭〉瀵艰埅鏍忓彲閰嶇疆绛夈��</p> + * @author 鏃跺厠鑻� + * @date 2023-05-20 + */ +@RestController +@RequestMapping("/system/group") +public class GroupController extends PlatformAdapterController { + + @Autowired + public GroupController(GroupServiceImpl groupService, FormCacheProvider formCacheProvider){ + this.groupService = groupService; + this.formCacheProvider = formCacheProvider; + } + + @RequestMapping(value = "/update", method = RequestMethod.POST) + public ResponseValue updateGroup( +// @RequestParam Integer id, + @RequestBody S_group group){ + if(group == null || StringUtils.isEmpty(group.getName()) || group.getId() == null){ + return ResponseValue.error("鍙傛暟閿欒"); + } +// group.setId(id); + group.setUpdate_time(DateUtils.getDateTimeNumber()); + this.groupService.save(group); + return ResponseValue.success(); + } + + @RequestMapping(value = "/delete", method = RequestMethod.GET) + public ResponseValue deleteGroup(Integer id){ + if(id == null){throw new IllegalArgumentException("缂哄皯鍙傛暟");} + S_group_data groupData = new S_group_data(); + groupData.setGid(id); + List<S_group_data> groupDataList = this.groupService.select(groupData); + if(!StringUtils.isEmptyList(groupDataList)){ + return ResponseValue.error("鍒嗙粍涓嬪瓨鍦ㄦ暟鎹」锛屾棤娉曞垹闄�!"); + } + this.groupService.delete(new S_group(id)); + return ResponseValue.success(); + } + + @RequestMapping(value = "/save", method = RequestMethod.POST) + public ResponseValue saveGroup(@RequestBody S_group group){ + if(group == null){ + return ResponseValue.error("鍙傛暟閿欒"); + } + group.setCreate_time(DateUtils.getDateTimeNumber()); + group.setUpdate_time(group.getCreate_time()); + group.setId(this.groupService.queryGroupNextId()); + this.groupService.insert(group); + return ResponseValue.success(); + } + + @RequestMapping(value = "/data/delete", method = RequestMethod.GET) + public ResponseValue deleteData(@RequestParam(value = "id") Integer id){ + this.groupService.delete(new S_group_data(id)); + return ResponseValue.success(); + } + + @RequestMapping(value = "/data/update", method = RequestMethod.POST) + public ResponseValue updateData(@RequestParam Integer id, @RequestBody GroupData groupData){ + if(groupData == null || id == null){ + return ResponseValue.error("鍙傛暟閿欒"); + } + + String value = this.acquireFormValue(groupData.getForm()); + + S_group_data group_data = new S_group_data(); + group_data.setGid(groupData.getGid()); + group_data.setValue(this.clearCdnPrefix(value)); + group_data.setSort(groupData.getForm().getSort()); + group_data.setStatus(groupData.getForm().getStatus()); + group_data.setUpdate_time(group_data.getCreate_time()); + group_data.setId(id); + this.groupService.save(group_data); + return ResponseValue.success(); + } + +// // @ApiOperation(value = "鏂板:鍒嗙粍鍒楄〃椤�") + @RequestMapping(value = "/data/save", method = RequestMethod.POST) + public ResponseValue saveData(@RequestBody GroupData groupData){ + if(groupData == null){ + return ResponseValue.error("鍙傛暟閿欒"); + } + String value = this.acquireFormValue(groupData.getForm()); + int nextId = this.groupService.queryGroupDataNextId(); + + S_group_data group_data = new S_group_data(); + group_data.setGid(groupData.getGid()); + group_data.setValue(this.clearCdnPrefix(value)); + group_data.setSort(groupData.getForm().getSort()); + group_data.setStatus(groupData.getForm().getStatus()); + group_data.setCreate_time(DateUtils.getDateTimeNumber()); + group_data.setUpdate_time(group_data.getCreate_time()); + group_data.setId(nextId); + this.groupService.insert(group_data); + return ResponseValue.success(); + } + + private String acquireFormValue(FormData formData){ + this.formCacheProvider.validateForm(formData); + try { + return JsonUtils.objectToJsonString(formData); + } catch (Exception e) { + throw new PlatformRuntimeException("杞崲Json瀛楃涓插け璐ワ細" + formData.getId(), e); + } + } + + @RequestMapping(value = "/data/list", method = RequestMethod.GET) + public ResponseValue listData(GroupDataParam groupDataParam){ + if(groupDataParam == null || groupDataParam.getGid() == null){ + throw new IllegalArgumentException("鍙傛暟閿欒:groupDataParam"); + } + GenericPager<S_group_data> pager = this.groupService.queryPageGroupDataList(groupDataParam.getGid(), groupDataParam.getStatus()); + pager.getDatas().stream().forEach(data -> { + try { + // 鎶妚alue杞垚Json锛岄噸鏂版牸寮忓寲涓�閬嶏紝杩斿洖鍓嶇銆� + FormData formData = JsonUtils.jsonStringToObject(data.getValue(), FormData.class); + data.setValue(JsonUtils.objectToJsonString(formData)); + logger.info(data.getValue()); + } catch (Exception e) { + throw new RuntimeException(e); + } + }); + return ResponseValue.success(pager); + } + + @RequestMapping(value = "/list", method = RequestMethod.GET) + public ResponseValue list(KeywordsParam keywordsParam){ + String keywords = null; + if(keywordsParam != null && StringUtils.isNotEmpty(keywordsParam.getKeywords())){ + keywords = UrlUtils.decode(keywordsParam.getKeywords()); + } + GenericPager<S_group> pager = this.groupService.queryPageGroupList(keywords); + return ResponseValue.success(pager); + } + + private GroupServiceImpl groupService; + private FormCacheProvider formCacheProvider; +} diff --git a/iplatform-base-admin/src/main/java/com/iplatform/base/controller/LoginInfoController.java b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/LoginInfoController.java new file mode 100644 index 0000000..d1f7a89 --- /dev/null +++ b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/LoginInfoController.java @@ -0,0 +1,47 @@ +package com.iplatform.base.controller; + +import com.iplatform.base.SystemController; +import com.iplatform.base.pojo.log.LoginLogParam; +import com.iplatform.base.service.LogServiceImpl; +import com.iplatform.model.po.S_login_info; +import com.walker.db.page.GenericPager; +import com.walker.web.ResponseValue; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +/** + * 鐧诲綍鏃ュ織鏌ヨ銆� + * @date 2023-01-04 + */ +@RestController +@RequestMapping("/monitor/login_info") +public class LoginInfoController extends SystemController { + + private LogServiceImpl logService; + + @Autowired + public LoginInfoController(LogServiceImpl logService){ + this.logService = logService; + } + + @RequestMapping("/select/clean") + public ResponseValue clear(){ + this.logService.execClearLoginLog(); + return ResponseValue.success(); + } + + @RequestMapping("/list") + public ResponseValue list(LoginLogParam loginLogParam){ +// this.preparePageSearch(); + GenericPager<S_login_info> pager = null; + if(loginLogParam == null){ + pager = this.logService.queryPageLoginLogList(null, null, null); + } else { + pager = this.logService.queryPageLoginLogList(loginLogParam.getIpaddr() + , loginLogParam.getUserName(), loginLogParam.getStatus()); + } +// return this.acquireTablePage(pager.getDatas(), pager.getTotalRows()); + return ResponseValue.success(pager); + } +} diff --git a/iplatform-base-admin/src/main/java/com/iplatform/base/controller/MenuController.java b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/MenuController.java new file mode 100644 index 0000000..ede0f1f --- /dev/null +++ b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/MenuController.java @@ -0,0 +1,154 @@ +package com.iplatform.base.controller; + +import com.iplatform.base.SystemController; +import com.iplatform.base.cache.MenuCacheProvider; +import com.iplatform.base.service.MenuServiceImpl; +import com.iplatform.base.service.RoleServiceImpl; +import com.iplatform.base.util.MenuUtils; +import com.iplatform.base.util.menu.SystemMenu; +import com.iplatform.model.po.S_menu; +import com.iplatform.model.po.S_user_core; +import com.walker.infrastructure.utils.DateUtils; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.web.DataStatus; +import com.walker.web.ResponseValue; +import com.walker.web.UserPrincipal; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("/system/menu") +public class MenuController extends SystemController { + + private MenuCacheProvider menuCacheProvider; + private RoleServiceImpl roleService; + private MenuServiceImpl menuService; + + @Autowired + public MenuController(MenuCacheProvider menuCacheProvider + , RoleServiceImpl roleService, MenuServiceImpl menuService){ + this.menuCacheProvider = menuCacheProvider; + this.roleService = roleService; + this.menuService = menuService; + } + + @RequestMapping("/remove/{menuId}") + public ResponseValue remove(@PathVariable String menuId){ + boolean existChildren = this.menuCacheProvider.isHasChildren(menuId); + if(existChildren){ + return ResponseValue.error("璇ヨ彍鍗曞瓨鍦ㄥ瓙鑿滃崟锛屾棤娉曞垹闄�"); + } + int roleMenuSize = this.menuService.queryRoleMenuSize(menuId); + if(roleMenuSize > 0){ + return ResponseValue.error("鑿滃崟宸插垎閰嶏紝鏃犳硶鍒犻櫎"); + } + this.menuService.delete(new S_menu(menuId)); + this.menuCacheProvider.removeCacheData(menuId); + return ResponseValue.success(); + } + + @RequestMapping("/view/{menuId}") + public ResponseValue view(@PathVariable String menuId){ + S_menu s_menu = this.menuService.get(new S_menu(menuId)); + if(s_menu == null){ + return ResponseValue.error("鑿滃崟涓嶅瓨鍦�:" + menuId); + } + return ResponseValue.success(new SystemMenu(s_menu)); + } + + @RequestMapping("/edit") + public ResponseValue saveEdit(@RequestBody S_menu s_menu){ + if(s_menu == null || StringUtils.isEmpty(s_menu.getParent_id()) || StringUtils.isEmpty(s_menu.getMenu_name())){ + return ResponseValue.error("鍙傛暟閿欒"); + } + S_menu exist = this.menuService.queryExistMenuInParent(s_menu.getParent_id(), s_menu.getMenu_name()); + if(exist != null && !exist.getMenu_id().equals(s_menu.getMenu_id())){ + return ResponseValue.error("鐖惰彍鍗曚笅宸叉湁鐩稿悓鍚嶇О鑿滃崟瀛樺湪:" + s_menu.getMenu_name()); + } + if(s_menu.getIs_frame().intValue() == MenuUtils.MENU_FRAME_YES && !StringUtils.isHttpLink(s_menu.getPath())){ + return ResponseValue.error("鍦板潃蹇呴』浠ttp(s)://寮�澶�"); + } + if(s_menu.getMenu_type().equals(MenuUtils.MENU_TYPE_ITEM) && StringUtils.isEmpty(s_menu.getComponent())){ + return ResponseValue.error("鑿滃崟椤瑰繀椤诲~鍐欙細缁勪欢璺緞锛坈omponent锛�"); + } + this.menuService.save(s_menu); + this.menuCacheProvider.updateCacheData(s_menu.getMenu_id(), s_menu); + return ResponseValue.success(); + } + + @RequestMapping("/add") + public ResponseValue saveAddMenu(@RequestBody S_menu s_menu){ + if(s_menu == null || StringUtils.isEmpty(s_menu.getParent_id()) || StringUtils.isEmpty(s_menu.getMenu_name())){ + return ResponseValue.error("鍙傛暟閿欒"); + } + S_menu exist = this.menuService.queryExistMenuInParent(s_menu.getParent_id(), s_menu.getMenu_name()); + if(exist != null){ + return ResponseValue.error("鐖惰彍鍗曚笅宸叉湁鐩稿悓鍚嶇О鑿滃崟瀛樺湪:" + s_menu.getMenu_name()); + } + if(s_menu.getIs_frame().intValue() == MenuUtils.MENU_FRAME_YES && !StringUtils.isHttpLink(s_menu.getPath())){ + return ResponseValue.error("鍦板潃蹇呴』浠ttp(s)://寮�澶�"); + } + if(s_menu.getMenu_type().equals(MenuUtils.MENU_TYPE_ITEM) && StringUtils.isEmpty(s_menu.getComponent())){ + return ResponseValue.error("鑿滃崟椤瑰繀椤诲~鍐欙細缁勪欢璺緞锛坈omponent锛�"); + } + s_menu.setMenu_id(DateUtils.getDateTimeSecondForShow()); + this.menuService.insert(s_menu); + S_menu saved = this.menuService.get(new S_menu(s_menu.getMenu_id())); + this.menuCacheProvider.putCacheData(s_menu.getMenu_id(), saved); + return ResponseValue.success(); + } + + /** + * 瑙掕壊缂栬緫鏃讹紝鏄剧ず宸茬粡璁剧疆鐨勫姛鑳芥爲缁撴瀯鐩綍銆� + * @param roleId + * @return + * @date 2022-12-19 + */ + @RequestMapping("/select/roleMenuTree/{roleId}") + public ResponseValue selectRoleMenuTree(@PathVariable Long roleId){ + if(roleId == null || roleId.longValue() <= 0){ + throw new IllegalArgumentException("瑙掕壊鍙傛暟涓嶅瓨鍦�"); + } + Map<String, Object> data = new HashMap<>(4); + List<String> roleMenuIds = this.roleService.queryRoleMenuIdList(roleId); + int menuScope = this.getCurrentOrgMenuScope(); + List<SystemMenu> menuTreeList = this.menuCacheProvider.getMenuTreeAll(null, true, menuScope); + data.put("checkedKeys", roleMenuIds); + data.put("menus", menuTreeList); + return ResponseValue.success(data); + } + + /** + * 杩斿洖鏁翠釜绯荤粺鑿滃崟鏍戠粨鏋勬暟鎹紝鐩墠鍓嶇瑙掕壊璁剧疆涓娇鐢ㄩ�夋嫨鍏宠仈鍔熻兘鏉冮檺銆� + * @return + * @date 2022-12-18 + */ + @RequestMapping("/select/tree") + public ResponseValue selectMenuTree(){ + int menuScope = this.getCurrentOrgMenuScope(); + List<SystemMenu> menuTreeList = this.menuCacheProvider.getMenuTreeAll(null, true, menuScope); + return ResponseValue.success(menuTreeList); + } + + @GetMapping("/list") + public ResponseValue listMenuWithoutTree(){ + List<SystemMenu> menuList = null; + UserPrincipal<S_user_core> userPrincipal = this.getCurrentUserPrincipal(); + if(this.isSupervisor()){ + menuList = this.menuCacheProvider.getMenuList(null, MenuUtils.MENU_SCOPE_ALL); + } else { + int menuScope = this.getCurrentOrgMenuScope(); + menuList = this.menuCacheProvider.getMenuList(userPrincipal.getRoleIdList(), menuScope); + } + return ResponseValue.success(menuList); + } + +} diff --git a/iplatform-base-admin/src/main/java/com/iplatform/base/controller/NotificationController.java b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/NotificationController.java new file mode 100644 index 0000000..002d80a --- /dev/null +++ b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/NotificationController.java @@ -0,0 +1,133 @@ +package com.iplatform.base.controller; + +import com.iplatform.base.Constants; +import com.iplatform.base.NotifyConstants; +import com.iplatform.base.SystemController; +import com.iplatform.base.pojo.notify.InfoParam; +import com.iplatform.base.pojo.notify.NotificationParam; +import com.iplatform.base.service.NotificationServiceImpl; +import com.iplatform.base.util.NotificationUtils; +import com.iplatform.model.po.SfNotification; +import com.iplatform.model.po.SfTemplateMessage; +import com.iplatform.model.vo.NotificationConfigVo; +import com.walker.web.ResponseValue; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +/** + * 娑堟伅閫氱煡绠$悊锛岃閫氱煡浠呮槸閽堝涓氬姟閫氱煡鍒嗙被绠$悊锛屽悓鏃惰兘瀹炵幇鍚屾寰俊娑堟伅妯℃澘銆� + * <pre> + * 1)鐩墠寰俊鍏紬鍙锋秷鎭紝渚濊禆璇ュ姛鑳戒腑鐨勫悓姝ユā鏉胯褰� + * 2)骞冲彴鎺ㄩ�佹秷鎭垪琛紝璇峰湪"娑堟伅鎺ㄩ�佽褰�" 涓煡璇€�� + * </pre> + * @author 鏃跺厠鑻� + * @date 2023-08-24 + */ +@RestController +@RequestMapping("/platform/system/notification") +public class NotificationController extends SystemController { + + private NotificationServiceImpl notificationService; + + @Autowired + public NotificationController(NotificationServiceImpl notificationService){ + this.notificationService = notificationService; + } + + @RequestMapping(value = "/sms/switch", method = RequestMethod.POST) + public ResponseValue smsSwitch(Long id){ + SfNotification notification = this.notificationService.get(new SfNotification(id)); + if (notification.getIsSms().intValue() == NotifyConstants.SWITCH_NOT_EXIST) { + return ResponseValue.error("閫氱煡娌℃湁閰嶇疆鐭俊"); + } + if(notification.getIsSms().intValue() == NotifyConstants.SWITCH_OPEN){ + notification.setIsSms(NotifyConstants.SWITCH_COLSE); + } else { + notification.setIsSms(NotifyConstants.SWITCH_OPEN); + } + this.notificationService.update(notification); + return ResponseValue.success(); + } + + @RequestMapping(value = "/routine/switch", method = RequestMethod.POST) + public ResponseValue routineSwitch(Long id){ + SfNotification notification = this.notificationService.get(new SfNotification(id)); + if (notification.getIsRoutine().intValue() == NotifyConstants.SWITCH_NOT_EXIST) { + return ResponseValue.error("閫氱煡娌℃湁閰嶇疆灏忕▼搴忚闃呮ā鏉�"); + } + if(notification.getIsRoutine().intValue() == NotifyConstants.SWITCH_OPEN){ + notification.setIsRoutine(NotifyConstants.SWITCH_COLSE); + } else { + notification.setIsRoutine(NotifyConstants.SWITCH_OPEN); + } + this.notificationService.update(notification); + return ResponseValue.success(); + } + + @RequestMapping(value = "/wechat/switch", method = RequestMethod.POST) + public ResponseValue wechatSwitch(Long id){ + SfNotification notification = this.notificationService.get(new SfNotification(id)); + if (notification.getIsWechat().intValue() == NotifyConstants.SWITCH_NOT_EXIST) { + return ResponseValue.error("閫氱煡娌℃湁閰嶇疆鍏紬鍙锋ā鏉�"); + } + if(notification.getIsWechat().intValue() == NotifyConstants.SWITCH_OPEN){ + notification.setIsWechat(NotifyConstants.SWITCH_COLSE); + } else { + notification.setIsWechat(NotifyConstants.SWITCH_OPEN); + } + this.notificationService.update(notification); + return ResponseValue.success(); + } + + @RequestMapping(value = "/detail", method = RequestMethod.GET) + public ResponseValue detail(InfoParam request){ + if(request == null || request.getId() == null){ + return ResponseValue.error(Constants.ERROR_ARGUMENT); + } + long id = request.getId(); + SfNotification notification = this.notificationService.get(new SfNotification(id)); + NotificationConfigVo vo = new NotificationConfigVo(); + SfTemplateMessage templateMessage = null; + + if (request.getDetailType().equals(NotifyConstants.DETAIL_TYPE_WECHAT)) { + if (notification.getIsWechat().intValue() == NotifyConstants.SWITCH_NOT_EXIST) { + return ResponseValue.error("璇峰厛閰嶇疆鍏紬鍙锋ā鏉挎秷鎭�"); + } + templateMessage = this.notificationService.get(new SfTemplateMessage(notification.getWechatId().longValue())); + vo = NotificationUtils.acquireNotificationConfigVo(templateMessage); + vo.setStatus(notification.getIsWechat()); + + } else if(request.getDetailType().equals(NotifyConstants.DETAIL_TYPE_ROUTINE)){ + if (notification.getIsRoutine().intValue() == NotifyConstants.SWITCH_NOT_EXIST) { + return ResponseValue.error("璇峰厛閰嶇疆灏忕▼搴忚闃呮秷鎭�"); + } + templateMessage = this.notificationService.get(new SfTemplateMessage(notification.getRoutineId().longValue())); + vo = NotificationUtils.acquireNotificationConfigVo(templateMessage); + vo.setStatus(notification.getIsRoutine()); + + } else if(request.getDetailType().equals(NotifyConstants.DETAIL_TYPE_SMS)){ + if (notification.getIsSms().intValue() == NotifyConstants.SWITCH_NOT_EXIST) { + return ResponseValue.error("璇峰厛閰嶇疆鐭俊妯℃澘"); + } + templateMessage = this.notificationService.get(new SfTemplateMessage(notification.getSmsId().longValue())); + vo = NotificationUtils.acquireNotificationConfigVo(templateMessage); + vo.setStatus(notification.getIsSms()); + } + return ResponseValue.success(vo); + } + + @RequestMapping(value = "/list", method = RequestMethod.GET) + public ResponseValue list(NotificationParam param){ + List<SfNotification> data = null; + if(param == null){ + data = this.notificationService.queryList(null); + } else { + data = this.notificationService.queryList(param.getSendType()); + } + return ResponseValue.success(data); + } +} diff --git a/iplatform-base-admin/src/main/java/com/iplatform/base/controller/OnlineUserController.java b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/OnlineUserController.java new file mode 100644 index 0000000..740939a --- /dev/null +++ b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/OnlineUserController.java @@ -0,0 +1,48 @@ +package com.iplatform.base.controller; + +import com.iplatform.base.SystemController; +import com.iplatform.base.util.UserUtils; +import com.walker.cache.AbstractCacheProvider; +import com.walker.web.ResponseValue; +import com.walker.web.UserOnlineProvider; +import com.walker.web.UserPrincipal; +import com.walker.web.WebRuntimeException; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +@RestController +@RequestMapping("/monitor/online") +public class OnlineUserController extends SystemController { + + private static final int MAX_DATA_SIZE = 64; + + private UserOnlineProvider userOnlineProvider; + + @Autowired + public OnlineUserController(UserOnlineProvider userOnlineProvider){ + this.userOnlineProvider = userOnlineProvider; + } + + @RequestMapping("/list") + public ResponseValue list(){ + AbstractCacheProvider cacheProvider = (AbstractCacheProvider)this.userOnlineProvider; + Collection<Object> list = cacheProvider.queryListLimit(MAX_DATA_SIZE); + List<UserPrincipal> data = new ArrayList<>(); + if(list != null && list.size() > 0){ + try { + for(Object up : list){ +// logger.debug(up.toString()); + data.add(UserUtils.toUserPrincipal(up.toString())); + } + } catch (Exception ex){ + throw new WebRuntimeException("鍦ㄧ嚎鐢ㄦ埛缂撳瓨瀵硅薄杞崲閿欒:"); + } + } + return this.acquireTablePage(data, data.size()); + } +} diff --git a/iplatform-base-admin/src/main/java/com/iplatform/base/controller/OperateLogController.java b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/OperateLogController.java new file mode 100644 index 0000000..49d5bc9 --- /dev/null +++ b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/OperateLogController.java @@ -0,0 +1,57 @@ +package com.iplatform.base.controller; + +import com.iplatform.base.SystemController; +import com.iplatform.base.pojo.log.OperateLogParam; +import com.iplatform.base.service.LogServiceImpl; +import com.iplatform.model.po.S_oper_log; +import com.walker.db.page.GenericPager; +import com.walker.infrastructure.utils.KeyValue; +import com.walker.web.ResponseValue; +import com.walker.web.log.BusinessType; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.List; + +@RestController +@RequestMapping("/monitor/operate_log") +public class OperateLogController extends SystemController { + + private LogServiceImpl logService; + + @Autowired + public OperateLogController(LogServiceImpl logService){ + this.logService = logService; + } + + @RequestMapping("/select/get_business_type") + public ResponseValue getBusinessTypeList(){ + List<KeyValue<Integer, String>> data = new ArrayList<>(); + for(BusinessType businessType : BusinessType.values()){ + data.add(new KeyValue<>(businessType.getIndex(), businessType.getName())); + } + return ResponseValue.success(data); + } + + @RequestMapping("/select/clean") + public ResponseValue clear(){ + this.logService.execClearOperateLog(); + return ResponseValue.success(); + } + + @RequestMapping("/list") + public ResponseValue list(OperateLogParam operateLogParam){ +// this.preparePageSearch(); + GenericPager<S_oper_log> pager = null; + if(operateLogParam == null){ + pager = this.logService.queryPageOperateLogList(null, null, null, null); + } else { + pager = this.logService.queryPageOperateLogList(operateLogParam.getOperName() + , operateLogParam.getBusinessType(), operateLogParam.getStatus(), operateLogParam.getTitile()); + } +// return this.acquireTablePage(pager.getDatas(), pager.getTotalRows()); + return ResponseValue.success(pager); + } +} diff --git a/iplatform-base-admin/src/main/java/com/iplatform/base/controller/PermitController.java b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/PermitController.java new file mode 100644 index 0000000..e86b94f --- /dev/null +++ b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/PermitController.java @@ -0,0 +1,128 @@ +package com.iplatform.base.controller; + +import com.iplatform.base.ArgumentsConstants; +import com.iplatform.base.SystemController; +import com.iplatform.base.service.CodeServiceImpl; +import com.iplatform.base.support.DictTreeGenerator; +import com.iplatform.model.po.S_dict_data; +import com.walker.file.FileInfo; +import com.walker.infrastructure.tree.TreeNode; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.web.ResponseValue; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; + +/** + * 鍏叡鏉冮檺鎿嶄綔鏂规硶銆�<p></p> + * 鍦ㄨ瀵硅薄閲岄潰鐨勬柟娉曪紝閮芥棤闇�閰嶇疆鑿滃崟鏉冮檺锛屽彧瑕佺櫥褰曠敤鎴烽兘鏈夋潈浣跨敤銆� + * <pre> + * 1锛夋瘮濡傦細鑾峰彇瀛楀吀鏍戠瓑 + * </pre> + * @author 鏃跺厠鑻� + * @date 2023-03-13 + */ +@RestController +@RequestMapping("/permit") +public class PermitController extends SystemController { + +// @RequestMapping("/copyright/get/info") +// public ResponseValue getCopyRight(){ +// CopyRightVo copyRightVo = new CopyRightVo(); +// copyRightVo.setCompanyName(this.getArgumentVariable(ArgumentsConstants.CONFIG_COPYRIGHT_COMPANY_INFO).getStringValue()); +// copyRightVo.setCompanyImage(this.getArgumentVariable(ArgumentsConstants.CONFIG_COPYRIGHT_COMPANY_IMAGE).getStringValue()); +// return ResponseValue.success(copyRightVo); +// } + + /** + * 鑾峰彇绉诲姩绔闂珯鐐瑰煙鍚嶏紙鍦板潃锛夛紝濡傦細localhost:8080 + * @return + * @date 2023-05-12 + */ + @RequestMapping("/config/front/domain") + public ResponseValue getConfigFrontDomain(){ + String data = this.getArgumentVariable(ArgumentsConstants.CONFIG_KEY_SITE_URL).getStringValue(); + return ResponseValue.success("success", data); + } + + /** + * 鏍规嵁鏂囦欢id涓嬭浇鏈湴鏂囦欢 + * @param id 鏂囦欢id锛堢郴缁熷瓨鍌ㄧ殑鍞竴缂栧彿锛� + * @throws Exception + * @date 2023-03-13 + */ + @RequestMapping("/file/{id}") + public void downloadLocalFile(@PathVariable String id) throws Exception{ + FileInfo fileInfo = this.getFileInfo(id); + if(fileInfo == null){ + throw new IllegalArgumentException("鏂囦欢鏈壘鍒帮紝id=" + id); + } + logger.info("寮�濮嬩笅杞芥湰鍦版枃浠�:{}", fileInfo); + this.downloadSimpleFile(this.getLocalFileData(fileInfo), fileInfo.getFileName()); + } + + /** + * 鏍规嵁浠g爜琛ㄥ悕瀛楋紝鏌ヨ鍖呭惈鐨勪唬鐮侀」闆嗗悎銆� + * @param dictType + * @return + * @date 2023-03-22 璇ユ帴鍙e湪瀛楀吀绠$悊涓瓨鍦紝杩欓噷闇�瑕佹斁鍦ㄥ叕鍏辨潈闄愰噷闈竴浠斤紝鏂逛究鎵�鏈夌敤鎴锋煡璇㈡煇涓瓧鍏哥被鍨嬩笅鐨勬墍鏈夐」鐩泦鍚堛�� + * @date 2023-04-15 浣跨敤缂撳瓨锛岃繖閲屽彧鑳借繑鍥炰竴绾х殑鎯呭喌锛屽鏋滃瓨鍦ㄦ爲缁撴瀯鍒欓渶瑕佽皟鐢ㄦ柟娉曪紝鍙傝�� API锛歿@linkplain PermitController#selectDictTreeList(String)} + */ + @RequestMapping("/dict/data/type/{dictType}") + public ResponseValue<List<S_dict_data>> dictTypeList(@PathVariable String dictType){ + logger.debug("dictType = " + dictType); + String id = this.getDictCacheProvider().getDictTypeId(dictType); + List<S_dict_data> list = this.getDictCacheProvider().getRootChildrenOneLevelList(id); +// List<S_dict_data> list = this.codeService.queryDictDataByType(dictType); + if(StringUtils.isEmptyList(list)){ + list = new ArrayList<S_dict_data>(2); + } + list.sort(new Comparator<S_dict_data>() { + @Override + public int compare(S_dict_data stu1, S_dict_data stu2) { + return stu1.getDict_sort() - stu2.getDict_sort(); + } + }); + return ResponseValue.success(list); + } + + /** + * 杩斿洖浠g爜鏍戠粨鏋勶紙鍒楄〃闆嗗悎锛夛紝鐢卞墠绔睍绀虹粍瑁呫�� + * @param dictType 鏁版嵁瀛楀吀绫诲瀷 + * @return + * @auth 鏃跺厠鑻� + * @date 2023-03-13 + */ + @RequestMapping("/dict/list_tree/{dictType}") + public ResponseValue selectDictTreeList(@PathVariable String dictType){ + if(StringUtils.isEmpty(dictType)){ + return ResponseValue.error("璇锋彁渚涘瓧鍏哥被鍨�!"); + } + List<TreeNode> treeNodeList = new ArrayList<>(8); +// this.getDictCacheProvider().getCodeChildrenList() + List<S_dict_data> dictDataList = this.codeService.queryDictTreeList(dictType); + if(StringUtils.isEmptyList(dictDataList)){ + return ResponseValue.success(treeNodeList); + } + + // s_dict_data琛細绗竴涓牴鑺傜偣鐨�'parent_id' + // TreeGenerator缁勪欢浣跨敤鐨勯粯璁ょ埗id=0锛屾墍浠ュ浜庡瓧鍏告潵璇达紝鐖秈d涓嶆槸0鍙兘鏄叾浠栨暟鍊硷紝鎵�浠ヨ繖閲岄渶瑕佸厛璁剧疆銆� + long defaultParentId = dictDataList.get(0).getParent_id(); + DictTreeGenerator generator = new DictTreeGenerator(null); + generator.setDefaultParentId(defaultParentId); + generator.setEntityList(dictDataList); + return ResponseValue.success(generator.getTreeRootList()); + } + + @Autowired + public PermitController(CodeServiceImpl codeService){ + this.codeService = codeService; + } + + private CodeServiceImpl codeService; +} diff --git a/iplatform-base-admin/src/main/java/com/iplatform/base/controller/RoleController.java b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/RoleController.java new file mode 100644 index 0000000..655ed35 --- /dev/null +++ b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/RoleController.java @@ -0,0 +1,189 @@ +package com.iplatform.base.controller; + +import com.iplatform.base.SystemController; +import com.iplatform.base.event.RoleSecurityChangeEvent; +import com.iplatform.base.pojo.role.RoleAuthParam; +import com.iplatform.base.pojo.role.RoleParam; +import com.iplatform.base.pojo.role.RoleUserParam; +import com.iplatform.base.service.RoleServiceImpl; +import com.iplatform.base.util.role.SystemRole; +import com.iplatform.core.BeanContextAware; +import com.iplatform.model.po.S_role; +import com.iplatform.model.po.S_user_core; +import com.walker.db.page.GenericPager; +import com.walker.infrastructure.utils.NumberGenerator; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.web.ResponseValue; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/system/role") +public class RoleController extends SystemController { + + private RoleServiceImpl roleService; + + @Autowired + public RoleController(RoleServiceImpl roleService){ + this.roleService = roleService; + } + + /** + * 鎵归噺娣诲姞鎺堟潈鐢ㄦ埛銆� + * @param roleId 瑙掕壊ID + * @param userIds 鐢ㄦ埛ID闆嗗悎 + * @return + * @date 2022-12-21 + */ + @RequestMapping("/select/authUser/all") + public ResponseValue batchAuthUserList(Long roleId, Long[] userIds){ + if(userIds == null || userIds.length == 0 || roleId == null){ + return ResponseValue.error("鍙傛暟閿欒"); + } + logger.debug(roleId + ", " + userIds); + this.roleService.execInsertRoleUserList(roleId, userIds); + return ResponseValue.success(); + } + + /** + * 鍙栨秷宸叉巿鏉冪敤鎴凤紝浠庤鑹查噷绉婚櫎銆� + * @param roleUserParam + * @return + * @date 2022-12-21 + */ + @RequestMapping("/select/authUser/cancel") + public ResponseValue cancelAuthUser(@RequestBody RoleUserParam roleUserParam){ + if(roleUserParam == null || roleUserParam.getRoleId() == null || roleUserParam.getUserId() == null){ + return ResponseValue.error("鍙傛暟閿欒"); + } + this.roleService.execDeleteRoleUser(roleUserParam.getRoleId(), roleUserParam.getUserId()); + return ResponseValue.success(); + } + + @RequestMapping("/select/authUser/unallocatedList") + public ResponseValue unallocatedList(RoleAuthParam roleAuthParam){ + if(roleAuthParam == null || roleAuthParam.getRoleId() == null){ + return ResponseValue.error(); + } + // 2023-01-28 杩欎釜鐢变簬url鍦板潃璁剧疆涓嶅悎鐞嗭紝娌¤兘鍖归厤: /list 鎵�浠ユ殏鏃朵笉鑳藉垹闄� + this.preparePageSearch(); + + S_role s_role = this.roleService.get(new S_role(roleAuthParam.getRoleId())); + GenericPager<S_user_core> pager = this.roleService.queryUnAllocatedUserList(roleAuthParam.getRoleId(), s_role.getOrg_id(), roleAuthParam.getUserName()); +// return this.acquireTablePage(pager.getDatas(), pager.getTotalRows()); + return ResponseValue.success(pager); + } + + /** + * 灞曠ず缁欏畾瑙掕壊锛屽凡鍏宠仈鐢ㄦ埛鍒楄〃銆� + * @param roleAuthParam + * @return + * @date 2022-12-21 + */ + @RequestMapping("/select/authUser/allocatedList") + public ResponseValue allocatedList(RoleAuthParam roleAuthParam){ + if(roleAuthParam == null || roleAuthParam.getRoleId() == null){ + return ResponseValue.error(); + } + // 2023-01-28 杩欎釜鐢变簬url鍦板潃璁剧疆涓嶅悎鐞嗭紝娌¤兘鍖归厤: /list 鎵�浠ユ殏鏃朵笉鑳藉垹闄� + this.preparePageSearch(); + + GenericPager<S_user_core> pager = this.roleService.queryAllocatedUserList(roleAuthParam.getRoleId(), roleAuthParam.getUserName()); +// return this.acquireTablePage(pager.getDatas(), pager.getTotalRows()); + return ResponseValue.success(pager); + } + + @RequestMapping("/edit") + public ResponseValue saveEdit(@RequestBody SystemRole systemRole){ + if(systemRole == null || StringUtils.isEmpty(systemRole.getRole_name()) || systemRole.getOrg_id() == null + || systemRole.getRole_id() == null){ + return ResponseValue.error("瑙掕壊鍙傛暟閿欒"); + } + long orgId = systemRole.getOrg_id(); + S_role existRole = this.roleService.queryRoleByName(orgId, systemRole.getRole_name()); + if(existRole != null && existRole.getRole_id().longValue() != systemRole.getRole_id().longValue()){ + return ResponseValue.error("瑙掕壊鍚嶇О宸茬粡瀛樺湪"); + } + + this.roleService.execUpdateRole(systemRole.$clone(), systemRole.getMenuIds()); + + // 鍙戦�佷簨浠堕�氱煡锛岃security閲嶆柊鍔犺浇鏉冮檺鏁版嵁 + BeanContextAware.publishEvent(new RoleSecurityChangeEvent(systemRole.getRole_id())); + + return ResponseValue.success(); + } + + @RequestMapping("/view/{roleId}") + public ResponseValue view(@PathVariable Long roleId){ + S_role s_role = this.roleService.get(new S_role(roleId)); + if(s_role == null){ + return ResponseValue.error("瑙掕壊涓嶅瓨鍦�"); + } + return ResponseValue.success(s_role); + } + + @RequestMapping("/remove/{roleId}") + public ResponseValue removeRole(@PathVariable Long roleId){ + if(roleId == null || roleId.longValue() <= 0){ + return ResponseValue.error("鍙傛暟閿欒"); + } + int roleUserCount = this.roleService.queryRoleUserSize(roleId); + if(roleUserCount > 0){ + return ResponseValue.error("瑙掕壊宸插垎閰嶇敤鎴凤紝鏃犳硶鍒犻櫎"); + } + this.roleService.execDeleteRole(roleId); + return ResponseValue.success(); + } + + @RequestMapping("/add") + public ResponseValue saveAdd(@RequestBody SystemRole systemRole){ + if(systemRole == null || StringUtils.isEmpty(systemRole.getRole_name()) || systemRole.getOrg_id() == null){ + return ResponseValue.error("瑙掕壊鍙傛暟閿欒"); + } + long orgId = systemRole.getOrg_id(); + if(orgId <= 0){ + return ResponseValue.error("瑙掕壊鎵�灞炴満鏋勫繀椤绘彁渚�"); + } + S_role existRole = this.roleService.queryRoleByName(orgId, systemRole.getRole_name()); + if(existRole != null){ + return ResponseValue.error("瑙掕壊鍚嶇О宸茬粡瀛樺湪"); + } + systemRole.setRole_id(NumberGenerator.getSequenceNumber()); + this.roleService.execInsertRole(systemRole.$clone(), systemRole.getMenuIds()); + return ResponseValue.success(); + } + + @PostMapping("/select/changeStatus") + public ResponseValue changeStatus(@RequestBody S_role s_role){ + if(s_role == null || s_role.getRole_id() == null){ + return ResponseValue.error("鍙傛暟閿欒"); + } + this.roleService.execUpdateStatus(s_role.getRole_id(), s_role.getStatus()); + return ResponseValue.success(); + } + + @GetMapping("/list") + public ResponseValue pageList(RoleParam roleParam){ + if(roleParam == null || roleParam.getOrgId() <= 0){ + return ResponseValue.error("鏃犳硶鏌ヨ瑙掕壊:娌℃湁鏉′欢"); + } +// this.preparePageSearch(); + + long orgId = 0; + if(!this.isSupervisor()){ + // 鏅�氱敤鎴凤紝鍙兘鐪嬪埌鑷繁椤剁骇鏈烘瀯鐢ㄦ埛 + orgId = this.getCurrentUser().getOrg_id(); + } else { + orgId = roleParam.getOrgId(); + } + GenericPager<S_role> pager = this.roleService.queryPageRoleList(orgId, roleParam.getStatus(), roleParam.getRoleName()); +// return this.acquireTablePage(pager.getDatas(), pager.getTotalRows()); + return ResponseValue.success(pager); + } + +} diff --git a/iplatform-base-admin/src/main/java/com/iplatform/base/controller/SchedulerController.java b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/SchedulerController.java new file mode 100644 index 0000000..7973ba0 --- /dev/null +++ b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/SchedulerController.java @@ -0,0 +1,74 @@ +//package com.iplatform.base.controller; +// +//import com.iplatform.base.SystemController; +//import com.iplatform.model.po.S_scheduler; +//import com.iplatform.scheduler.PlatformSchedulerManager; +//import com.iplatform.scheduler.pojo.SchedulerParam; +//import com.iplatform.scheduler.service.SchedulerServiceImpl; +//import com.walker.db.page.GenericPager; +//import com.walker.scheduler.Scheduler; +//import com.walker.web.ResponseValue; +//import org.springframework.beans.factory.annotation.Autowired; +//import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +//import org.springframework.web.bind.annotation.GetMapping; +//import org.springframework.web.bind.annotation.RequestBody; +//import org.springframework.web.bind.annotation.RequestMapping; +//import org.springframework.web.bind.annotation.RestController; +// +//@RestController +//@RequestMapping("/monitor/job") +//@ConditionalOnProperty(prefix = "iplatform.scheduler", name = "enabled", havingValue = "true", matchIfMissing = true) +//public class SchedulerController extends SystemController { +// +// private SchedulerServiceImpl schedulerService; +// private PlatformSchedulerManager platformSchedulerManager; +// +// @Autowired +// public SchedulerController(SchedulerServiceImpl schedulerService, PlatformSchedulerManager platformSchedulerManager){ +// this.schedulerService = schedulerService; +// this.platformSchedulerManager = platformSchedulerManager; +// } +// +// @RequestMapping("/select/run") +// public ResponseValue run(@RequestBody S_scheduler s_scheduler){ +// if(this.platformSchedulerManager == null){ +// return ResponseValue.error("璋冨害妯″潡鏈紑鍚厤缃�"); +// } +// if(s_scheduler == null){ +// return ResponseValue.error("璋冨害浠诲姟涓嶅瓨鍦�"); +// } +// Scheduler scheduler = this.platformSchedulerManager.getOneGatherScheduler(s_scheduler.getId()); +// if(scheduler == null){ +// return ResponseValue.error("璋冨害鍣ㄤ笉瀛樺湪: " + s_scheduler.getId()); +// } +// if(scheduler.isStarted() && !scheduler.isPause()){ +// return ResponseValue.error("璋冨害鍣ㄥ凡杩愯锛屾棤闇�閲嶅鍚姩"); +// } +// if(scheduler.isPause()){ +// this.platformSchedulerManager.restartScheduler(s_scheduler.getId()); +// logger.info("璋冨害浠诲姟琚殏鍋滃悗閲嶅惎锛宨d = " + s_scheduler.getId()); +// } else { +// logger.warn("璋冨害浠诲姟宸茬粡鍦ㄨ繍琛屼腑锛屾棤闇�閲嶅鍚姩锛宨d = " + s_scheduler.getId()); +// } +// return ResponseValue.success(); +// } +// +// @GetMapping("/list") +// public ResponseValue list(SchedulerParam schedulerParam){ +// if(schedulerParam == null || schedulerParam.getOrgId() <= 0){ +// return ResponseValue.error("鏃犳硶鏌ヨ璋冨害浠诲姟"); +// } +//// this.preparePageSearch(); +// +// long orgId = 0; +// if(!this.isSupervisor()){ +// // 鏅�氱敤鎴凤紝鍙兘鐪嬪埌鑷繁椤剁骇鏈烘瀯鐢ㄦ埛 +// orgId = this.getCurrentUser().getOrg_id(); +// } else { +// orgId = schedulerParam.getOrgId(); +// } +// +// GenericPager<S_scheduler> pager = this.schedulerService.queryPageSchedulerList(orgId); +// return this.acquireTablePage(pager.getDatas(), pager.getTotalRows()); +// } +//} diff --git a/iplatform-base-admin/src/main/java/com/iplatform/base/controller/UserController.java b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/UserController.java new file mode 100644 index 0000000..32b771b --- /dev/null +++ b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/UserController.java @@ -0,0 +1,386 @@ +package com.iplatform.base.controller; + +import com.iplatform.base.*; +import com.iplatform.base.excel.UserDataImportor; +import com.iplatform.base.pojo.UserParam; +import com.iplatform.base.service.LoginServiceImpl; +import com.iplatform.base.service.RoleServiceImpl; +import com.iplatform.base.service.UserServiceImpl; +import com.iplatform.base.util.UserUtils; +import com.iplatform.base.util.role.SystemRole; +import com.iplatform.base.util.user.SystemUser; +import com.iplatform.model.po.S_role; +import com.iplatform.model.po.S_user_core; +import com.walker.db.page.GenericPager; +import com.walker.di.DataImportException; +import com.walker.file.FileInfo; +import com.walker.infrastructure.utils.DateUtils; +import com.walker.infrastructure.utils.NumberGenerator; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.web.ResponseValue; +import com.walker.web.UserOnlineProvider; +import com.walker.web.log.BusinessType; +import com.walker.web.log.Log; +import com.walker.web.log.OperateUser; +// +// +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +//@Api(tags = "鐢ㄦ埛绠$悊妯″潡") +@RestController +@RequestMapping("/system/user") +public class UserController extends SystemController { + +// private DeptCacheProvider deptCacheProvider; + private UserServiceImpl userService; + private RoleServiceImpl roleService; + + // 2023-03-22 + private LoginServiceImpl loginService; + private UserOnlineProvider userOnlineProvider; + + @Autowired + public UserController(UserServiceImpl userService, RoleServiceImpl roleService +// , UserCacheProvider userCacheProvider, DeptCacheProvider deptCacheProvider + , LoginServiceImpl loginService, UserOnlineProvider userOnlineProvider){ +// this.setDeptCacheProvider(deptCacheProvider); +// this.setUserCacheProvider(userCacheProvider); + this.userService = userService; + this.roleService = roleService; + this.loginService = loginService; + this.userOnlineProvider = userOnlineProvider; + } + + @PostMapping("/import") + public ResponseValue importExcel(MultipartFile file, boolean updateSupport){ + try { + UserDataImportor dataImportor = new UserDataImportor(file.getInputStream()); + dataImportor.setId("user_import"); + this.getDataImportEngine().executeImport(dataImportor, this.getCurrentUserPrincipal().getUserName()); + logger.info("鎴愬姛瀵煎叆璁板綍:{}", dataImportor.getSuccessSize()); + logger.info("閿欒缁撴灉鏂囦欢:{}", dataImportor.getErrorFile()); + +// FileInfo errorFileInfo = this.uploadFileToRemote(dataImportor.getErrorFile()); + FileInfo errorFileInfo = this.uploadFileToRemote(dataImportor.getErrorFile(), null, String.valueOf(this.getOwner())); + if(errorFileInfo != null){ + logger.debug("鐢ㄦ埛瀵煎叆瀛樺湪'涓嶇鍚堟暟鎹�': 锛�", errorFileInfo.toString()); + logger.debug("杩欓噷鍙互杩斿洖缁欏墠绔紝璁╁墠绔偣鍑婚摼鎺ヤ笅杞�!"); + } + + return ResponseValue.success(); + + } catch (Exception e) { + if(e instanceof DataImportException){ + return ResponseValue.error("瀵煎叆鍑虹幇寮傚父:" + e.getMessage()); + } + logger.error("io寮傚父:" + e.getMessage(), e); + return ResponseValue.error("涓婁紶鏂囦欢寮傚父:" + e.getMessage()); + } + } + + /** + * 涓嬭浇瀵煎叆妯℃澘锛岃鏂规硶鍙仛鎴愮粺涓�鎺ュ彛锛岄�傚悎鍔ㄦ�佺敓鎴愮殑妯℃澘銆�<p></p> + * 瀵逛簬鐗瑰畾鑷畾涔夌殑妯℃澘锛屼笟鍔¤嚜宸辨彁渚涗笅杞藉湴鍧�銆� + * @author 鏃跺厠鑻� + * @date 2023-02-08 + */ + @PostMapping("/select/downloadTemplate") + public void downloadTemplate(){ + // 瑕佷繚瀛樼殑妯℃澘涓存椂璺緞锛屼粎浠呮彁渚涗竴涓湰鍦拌矾寰勫湴鍧�锛屼緵瀵煎叆寮曟搸鑷姩鐢熸垚骞朵繚瀛�! +// String templatePath = "d:/tmp/template_user.xlsx"; +// TemplateInfo templateInfo = new TemplateInfo(); +// templateInfo.setTemplatePath(templatePath); +// templateInfo.setTableName("s_user_core"); +// +// File templateFile = this.getDataImportEngine().generateTemplate(templateInfo); +// +// try { +// this.downloadSimpleFile(FileCopyUtils.copyToByteArray(templateFile), "绯荤粺鐢ㄦ埛瀵煎叆"); +// } catch (IOException e) { +// logger.error("涓嬭浇'瀵煎嚭鐢ㄦ埛'妯℃澘閿欒:" + e.getMessage(), e); +// ServletUtils.renderString(getResponse(), "涓嬭浇'瀵煎嚭鐢ㄦ埛'妯℃澘閿欒:" + e.getMessage()); +// } + this.downloadLocalImportTemplate("s_user_core"); + } + + /** + * 鏇存柊鐢ㄦ埛褰掑睘瑙掕壊锛岀敤鎴风鐞� --> 璁剧疆瑙掕壊 + * @param userId + * @param roleIds + * @return + * @date 2022-12-15 + */ + @PostMapping("/select/saveAuthRole") + public ResponseValue updateAuthRole(Long userId, Long[] roleIds){ + if(userId == null || userId.longValue() <= 0){ + return ResponseValue.error("鍙傛暟閿欒"); + } + + this.userService.execUpdateAuthRole(userId, roleIds); + logger.error("鏇存柊鐢ㄦ埛褰掑睘瑙掕壊鍚庯紝闇�瑕佹洿鏂扮敤鎴风櫥褰曠紦瀛樹腑瑙掕壊鍒楄〃锛岃浣忎慨鏀逛唬鐮�!"); + // 澶勭悊缂撳瓨鐨勭櫥褰曚俊鎭腑瑙掕壊鏇存柊锛�2023-03-22 + String uuid = this.loginService.queryLoginUUID(userId); + if(StringUtils.isNotEmpty(uuid)){ + List<String> roleIdList = new ArrayList<>(4); + for(long roleId : roleIds){ + roleIdList.add(String.valueOf(roleId)); + } + DefaultUserPrincipal userPrincipal = new DefaultUserPrincipal(this.getUser(userId)); + userPrincipal.setRoleIdList(roleIdList); + // 缂撳瓨鐧诲綍淇℃伅 + this.userOnlineProvider.cacheUserPrincipal(uuid, userPrincipal); + + } else { + logger.debug("鐢ㄦ埛浠庢湭鐧诲綍杩囷紝涓嶆洿鏂扮櫥褰晆uid淇℃伅锛寀serId={}", userId); + } + + return ResponseValue.success(); + } + + /** + * 鍓嶇锛岄�夊畾鐢ㄦ埛鍚庯紝鑾峰彇鎺堟潈瑙掕壊淇℃伅銆� + * @param userId + * @return + * @date 2022-12-13 + */ + @GetMapping("/select/authRole/{userId}") + public ResponseValue authRole(@PathVariable Long userId){ +// List<S_role> roleList = this.userService.queryUserRoleList(userId); + List<SystemRole> userAuthRoleList = this.userService.queryAuthRoleList(this.getUserRootOrgId(userId), userId); + Map<String, Object> data = new HashMap<>(4); + // 鏈崟浣嶆墍鏈夎鑹� + data.put("roles", userAuthRoleList); + // 鐢ㄦ埛淇℃伅 + data.put("user", this.getUserCacheProvider().getUser(userId)); + return ResponseValue.success(data); + } + +// // @ApiOperation(value = "閲嶇疆鐢ㄦ埛瀵嗙爜") + @PostMapping("/resetPwd") + public ResponseValue resetPassword(@RequestBody SystemUser systemUser){ + if(systemUser == null || systemUser.getId() == null){ + return ResponseValue.error("鍙傛暟閿欒"); + } + String initPassword = this.getArgumentVariable(ArgumentsConstants.KEY_SECURITY_PASSWORD_INIT).getStringValue(); + this.userService.execResetPassword(systemUser.getId(), initPassword); + S_user_core user_core = this.userService.get(new S_user_core(systemUser.getId())); + this.getUserCacheProvider().updateUser(user_core); + return ResponseValue.success(); + } + + @GetMapping("/remove/{userId}") + @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.Delete, isSaveRequestData = true, isSaveResponseData = true) + public ResponseValue deleteUser(@PathVariable Long userId){ + if(userId == null || userId.longValue() <= 0){ + return ResponseValue.error("鍙傛暟閿欒"); + } + this.userService.execDeleteUser(userId, this.getPlatformCallback(PlatformUserCallback.class)); + this.getUserCacheProvider().removeUser(userId); + logger.info("鍒犻櫎涓�涓敤鎴凤紝缂撳瓨宸叉洿鏂�:" + userId); + return ResponseValue.success(); + } + + @PostMapping("/edit") + public ResponseValue editUser(@RequestBody SystemUser user_core){ + if(user_core == null){ + return ResponseValue.error("鍙傛暟涓嶅瓨鍦�"); + } + if(StringUtils.isEmpty(user_core.getUser_name()) || StringUtils.isEmpty(user_core.getNick_name())){ + return ResponseValue.error("缂哄皯: 鐧诲綍ID鎴栫敤鎴锋樀绉�"); + } + if(user_core.getUser_name().equals(Constants.SUPERVISOR_NAME_DEFAULT)){ + return ResponseValue.error("鏃犳硶浣跨敤璇ョ敤鎴峰悕"); + } + S_user_core existUser = null; + String phoneNumber = user_core.getPhonenumber(); + if(StringUtils.isNotEmpty(phoneNumber)){ + existUser = this.userService.queryUserByPhone(phoneNumber); + if(existUser != null && existUser.getId().longValue() != user_core.getId().longValue()){ + return ResponseValue.error("璇ユ墜鏈哄彿宸茶鐜版湁鐢ㄦ埛浣跨敤"); + } + } + String email = user_core.getEmail(); + if(StringUtils.isNotEmpty(email)){ + existUser = this.userService.queryUserByEmail(email); + if(existUser != null && existUser.getId().longValue() != user_core.getId().longValue()){ + return ResponseValue.error("璇ラ偖绠卞湴鍧�宸茶鐜版湁鐢ㄦ埛浣跨敤"); + } + } + this.userService.execUpdateUser(user_core.$clone(), user_core.getRoleIds(), this.getPlatformCallback(PlatformUserCallback.class)); + this.getUserCacheProvider().updateUser(user_core); + logger.info("缂栬緫鐢ㄦ埛鎴愬姛锛屽苟鏇存柊缂撳瓨: " + user_core.getUser_name()); + return ResponseValue.success(); + } + + @PostMapping("/select/changeStatus") + public ResponseValue changeStatus(@RequestBody SystemUser systemUser){ + if(systemUser == null || systemUser.getId() == null || systemUser.getStatus() == null){ + return ResponseValue.error("缂哄皯鍙傛暟"); + } + this.userService.execUpdateUserStatus(systemUser.getId(), systemUser.getStatus()); + S_user_core user_core = this.userService.get(new S_user_core(systemUser.getId())); + this.getUserCacheProvider().updateUser(user_core); + return ResponseValue.success(); + } + + @PostMapping("/add") + @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.Insert, operatorType = OperateUser.Manage) + public ResponseValue saveUser(@RequestBody SystemUser user_core){ + if(user_core == null){ + return ResponseValue.error("鍙傛暟涓嶅瓨鍦�"); + } + if(StringUtils.isEmpty(user_core.getUser_name()) || StringUtils.isEmpty(user_core.getNick_name())){ + return ResponseValue.error("缂哄皯: 鐧诲綍ID鎴栫敤鎴锋樀绉�"); + } + if(user_core.getUser_name().equals(Constants.SUPERVISOR_NAME_DEFAULT)){ + return ResponseValue.error("鏃犳硶浣跨敤璇ョ敤鎴峰悕"); + } + S_user_core existUser = this.userService.queryUserByLoginId(user_core.getUser_name()); + if(existUser != null){ + return ResponseValue.error("鐧诲綍鍚嶅凡瀛樺湪"); + } + + // 妫�鏌ュ苟璁剧疆瀵嗙爜 + String encryptInitPass = null; + if(StringUtils.isEmpty(user_core.getPassword())){ + // 鐢ㄦ埛娌℃湁褰曞叆鐗瑰畾瀵嗙爜锛岀敤骞冲彴閰嶇疆鐨勯粯璁ゅ瘑鐮� + encryptInitPass = this.getArgumentVariable(ArgumentsConstants.KEY_SECURITY_PASSWORD_INIT).getStringValue(); + } else { + // 鐢ㄦ埛杈撳叆浜嗘槑鏂囧瘑鐮� + encryptInitPass = this.encryptPassword(user_core.getPassword()); + } + user_core.setPassword(encryptInitPass); + + String phoneNumber = user_core.getPhonenumber(); + if(StringUtils.isNotEmpty(phoneNumber)){ + if(this.userService.queryUserByPhone(phoneNumber) != null){ + return ResponseValue.error("璇ユ墜鏈哄彿宸茶鐜版湁鐢ㄦ埛浣跨敤"); + } + } + String email = user_core.getEmail(); + if(StringUtils.isNotEmpty(email)){ + if(this.userService.queryUserByEmail(email) != null){ + return ResponseValue.error("璇ラ偖绠卞湴鍧�宸茶鐜版湁鐢ㄦ埛浣跨敤"); + } + } + user_core.setCreate_time(DateUtils.getDateTimeNumber(System.currentTimeMillis())); + user_core.setCreate_by(this.getCurrentUser().getUser_name()); + user_core.setOrg_id(this.getRootOrgIdByDept(user_core.getDept_id())); + user_core.setId(IdUtil.generateId()); + // 娉ㄦ剰锛氳繖閲屼繚瀛樺繀椤荤敤鐢熸垚鐨� S_user_core 瀵硅薄锛屾墍浠ラ�氳繃 SystemUser鍏嬮殕涓�涓嵆鍙�� + // 鍚﹀垯鎶ラ敊, 2022-12-13 + this.userService.execSaveUser(user_core.$clone(), user_core.getRoleIds(), this.getPlatformCallback(PlatformUserCallback.class)); + // 鏇存柊缂撳瓨 + this.getUserCacheProvider().putUser(user_core); + logger.info("娣诲姞涓�涓敤鎴锋垚鍔燂紝缂撳瓨宸插姞鍏�: " + user_core.getUser_name()); + return ResponseValue.success(); + } + + /** + * 鍒涘缓鏂扮敤鎴锋椂锛岄�夋嫨瑙掕壊鍒楄〃銆� + * @param deptId + * @return + * @date 2022-12-12 + */ + @GetMapping("/select/role/{deptId}") + public ResponseValue getNewUserRoles(@PathVariable Long deptId){ + long orgId = 0; + if(deptId == null || deptId.longValue() == 0){ + //鏅�氱敤鎴� + orgId = this.getCurrentUser().getOrg_id(); + } else { + // 瓒呯骇绠$悊鍛橀�変簡鐗瑰畾鏈烘瀯 + orgId = this.getRootOrgIdByDept(deptId); + } + List<S_role> roleList = this.roleService.queryRoleList(orgId); + Map<String, Object> data = new HashMap<>(4); + data.put("roles", roleList); +// data.put("init_password", this.getArgumentVariable(ArgumentsConstants.KEY_SECURITY_PASSWORD_INIT).getStringValue()); + return ResponseValue.success(data); + } + + /** + * 缂栬緫鐢ㄦ埛鏃讹紝鑾峰緱鐢ㄦ埛淇℃伅銆� + * @param userId + * @return + * @date 2022-12-13 + */ +// @GetMapping(value = { "/view", "/view/{userId}" }) + @GetMapping("/view/{userId}") + public ResponseValue getUserInfo(@PathVariable Long userId){ + if(userId == null || userId <= 0){ + return ResponseValue.error("鍙傛暟閿欒"); + } + long orgId = this.getUserCacheProvider().getUser(userId).getOrg_id(); + List<S_role> roleList = this.roleService.queryRoleList(orgId); + List<String> roleIds = this.userService.queryUserRoleIdList(userId); + Map<String, Object> data = new HashMap<>(4); + // 鏈崟浣嶆墍鏈夎鑹� + data.put("roles", roleList); + // 鐢ㄦ埛鎵�灞炶鑹� + data.put("roleIds", UserUtils.toRoleIdLongList(roleIds)); + // 鐢ㄦ埛淇℃伅 + data.put("data", this.getUserCacheProvider().getUser(userId)); + return ResponseValue.success(data); + } + + @GetMapping("/list") + public ResponseValue list(UserParam userParam){ + if(userParam == null){ + return ResponseValue.error("鏃犳硶鏌ヨ鐢ㄦ埛:娌℃湁鏉′欢"); + } +// this.preparePageSearch(); + + long orgId = 0; + long deptId = userParam.getDeptId(); + + if(!this.isSupervisor()){ + // 鏅�氱敤鎴凤紝鍙兘鐪嬪埌鑷繁椤剁骇鏈烘瀯鐢ㄦ埛 + orgId = this.getCurrentUser().getOrg_id(); + } else { + // 瓒呯骇绠$悊鍛� + if(deptId <= 0){ + // 娌℃湁閫夋嫨鏈烘瀯鏍戯紝鏃犳硶鏌ヨ鐢ㄦ埛 + return ResponseValue.error("璇烽�夋嫨涓�涓満鏋勬煡璇�"); + } + orgId = this.getRootOrgIdByDept(deptId); + } + if(orgId == deptId){ + // 鐐瑰嚮鐨勯《绾ф満鏋� + deptId = 0; + } + return ResponseValue.error("鎮ㄦ病鏈夋潈闄愭煡璇紒"); +// GenericPager<S_user_core> pager = this.userService.queryPageUserList(orgId +// , deptId, userParam.getUserName(), userParam.getPhonenumber(), userParam.getStatus()); +// // 琛ュ厖鎵�鍦�'閮ㄩ棬鍚嶅瓧'灞炴�э紝2023-03-23 +// List<S_user_core> data = pager.getDatas(); +// if(!StringUtils.isEmptyList(data)){ +// data.stream().forEach(p -> { +// p.setParameterString("dept_name", this.getDeptName(p.getDept_id())); +// }); +// } + +// return this.acquireTablePage(pager.getDatas(), pager.getTotalRows()); +// return ResponseValue.error("鎮ㄦ病鏈夋潈闄愭煡璇紒"); + } + +// private long getRootOrgIdByDept(long deptId){ +// S_dept dept = this.deptCacheProvider.getDept(deptId); +// if(dept == null){ +// throw new IllegalStateException("缂撳瓨涓湭鎵惧埌鏈烘瀯: " + dept); +// } +// return dept.getOrg_id(); +// } +} diff --git a/iplatform-base-admin/src/main/java/com/iplatform/base/controller/UserProfileController.java b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/UserProfileController.java new file mode 100644 index 0000000..9e1c709 --- /dev/null +++ b/iplatform-base-admin/src/main/java/com/iplatform/base/controller/UserProfileController.java @@ -0,0 +1,201 @@ +package com.iplatform.base.controller; + +import com.iplatform.base.Constants; +import com.iplatform.base.SystemController; +import com.iplatform.base.callback.UserProfileCallback; +import com.iplatform.base.config.SecurityUserProperties; +import com.iplatform.base.pojo.UserInfoRequest; +import com.iplatform.base.service.UserServiceImpl; +import com.iplatform.base.util.PlatformRSAUtils; +import com.iplatform.core.BeanContextAware; +import com.iplatform.core.TokenAwareContext; +import com.iplatform.core.TokenEntity; +import com.iplatform.model.po.S_user_core; +import com.iplatform.model.po.S_user_login; +import com.walker.file.FileInfo; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.web.ResponseValue; +import com.walker.web.UserOnlineProvider; +import com.walker.web.UserPrincipal; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +//@Api(tags = "鐢ㄦ埛妗f") +@RestController +@RequestMapping("/system/user/profile") +public class UserProfileController extends SystemController { + + private UserServiceImpl userService; + private SecurityUserProperties securityUserProperties; + + @Autowired + public UserProfileController(UserServiceImpl userService, SecurityUserProperties securityUserProperties){ + this.userService = userService; + this.securityUserProperties = securityUserProperties; + } + + /** + * 杩斿洖鐧诲綍鐢ㄦ埛鍩烘湰淇℃伅銆� + * @return + * @date 2023-02-15 + */ + @GetMapping + public ResponseValue index(){ + List<String> roleIdList = this.getCurrentUserPrincipal().getRoleIdList(); + Map<String, Object> data = new HashMap<>(4); + data.put("user", this.getCurrentUser()); + if(!StringUtils.isEmptyList(roleIdList)){ + data.put("roleGroup", StringUtils.collectionToCommaDelimitedString(roleIdList)); + } else { + data.put("roleGroup", StringUtils.EMPTY_STRING); + } + return ResponseValue.success(data); + } + +// // @ApiOperation(value = "涓婁紶澶村儚") + @PostMapping("/avatar") + public ResponseValue avatar(MultipartFile file){ + if(file == null){ + return ResponseValue.error("涓婁紶澶村儚涓虹┖"); + } + long userId = this.getCurrentUserId(); + try { + FileInfo fileInfo = this.uploadFileToRemote(file.getInputStream(), "avatar.jpg", String.valueOf(userId), file.getSize(), null, String.valueOf(Constants.OWNER_PLATFORM)); + S_user_core s_user_core = new S_user_core(userId); + s_user_core.setAvatar(fileInfo.getId()); + // 鏇存柊鏁版嵁搴撶敤鎴疯褰� + this.userService.save(s_user_core); + // 鏇存柊缂撳瓨 + S_user_core cacheUser = this.getUserCacheProvider().getUser(userId); + cacheUser.setAvatar(fileInfo.getId()); + this.getUserCacheProvider().updateUser(cacheUser); + return ResponseValue.success("success","imageUrl"); + + } catch (Exception e) { + logger.error("涓婁紶澶村儚閿欒:" + e.getMessage(), e); + return ResponseValue.error("澶村儚澶勭悊寮傚父!"); + } + } + + /** + * 鍚庡彴鐢ㄦ埛淇敼璧勬枡锛氬鍚嶅拰瀵嗙爜锛屽悗缁墿灞曘�� + * @param request + * @return + * @date 2023-08-02 + */ + @RequestMapping(value = "/updateInfo", method = RequestMethod.POST) + public ResponseValue updateNameAndPassword(@RequestBody UserInfoRequest request){ + if(request == null){ + return ResponseValue.error("璇峰~鍐欐洿鏂拌祫鏂�"); + } + if(StringUtils.isEmpty(request.getRealName()) && StringUtils.isEmpty(request.getPassword())){ + return ResponseValue.error("鏈~鍐欎换浣曡祫鏂�"); + } + + S_user_core currentUser = this.getCurrentUser(); + + if(StringUtils.isNotEmpty(request.getPassword())){ + String originPassword = PlatformRSAUtils.getRsaDecryptValue(request.getPassword(), PlatformRSAUtils.PRIK); +// String error = PasswordUtils.filterText(originPassword); +// if(error != null){ +// return ResponseValue.error(error); +// } +// int passLevelConfig = this.securityUserProperties.getPassLevel(); +// if(!PasswordUtils.validateComplex(originPassword, passLevelConfig)){ +// return ResponseValue.error("瀵嗙爜绾у埆杩囦綆锛岃杈撳叆锛氬ぇ灏忓啓瀛楁瘝銆佹暟瀛椾互鍙婅嚦灏戜竴绉嶇壒娈婄鍙�"); +// } + String error = this.validatePasswordRule(originPassword); + if(error != null){ + return ResponseValue.error(error); + } + + // 璁剧疆鍔犲瘑鍚庣殑瀵嗙爜锛岀洿鎺ヤ繚瀛樻洿鏂� + request.setPassword(this.encryptPassword(originPassword)); + currentUser.setPassword(request.getPassword()); + currentUser.setModify_pwd(1); + } + + if(StringUtils.isNotEmpty(request.getRealName())){ + currentUser.setNick_name(request.getRealName()); + } + + UserProfileCallback callback = this.getPlatformCallback(UserProfileCallback.class); + this.getUserService().execUpdateUserInfo(request, currentUser.getId(), callback); + this.getUserCacheProvider().updateUser(currentUser); + logger.debug(TokenAwareContext.getCurrentToken().toString()); + return ResponseValue.success(); + } + +// /** +// * 楠岃瘉瀵嗙爜鏄惁绗﹀悎骞冲彴鏀跨瓥銆� +//// * @param encryptPassword 鍓嶇淇敼鐨勫瘑鐮侊紙瀵嗘枃锛夛紝RSA鍔犲瘑锛屽悗鍙拌瑙e瘑鐨� +// * @param originPassword 鍘熷鏄庢枃瀵嗙爜 +// * @return 杩斿洖閿欒鎻愮ず锛岃繑鍥炵┖琛ㄧず鎴愬姛 +// * @date 2023-08-05 +// */ +// protected String validatePasswordRule(String originPassword){ +//// String originPassword = PlatformRSAUtils.getRsaDecryptValue(encryptPassword, PlatformRSAUtils.PRIK); +// String error = PasswordUtils.filterText(originPassword); +// if(error != null){ +// return error; +// } +// int passLevelConfig = this.securityUserProperties.getPassLevel(); +// if(!PasswordUtils.validateComplex(originPassword, passLevelConfig)){ +// return "瀵嗙爜绾у埆杩囦綆锛岃杈撳叆锛氬ぇ灏忓啓瀛楁瘝銆佹暟瀛椾互鍙婅嚦灏戜竴绉嶇壒娈婄鍙�"; +// } +// return null; +// } + + /** + * 寮哄埗褰撳墠鐢ㄦ埛淇敼瀵嗙爜 + * @param encryptPassword + * @return + * @date 2023-08-05 + */ + @RequestMapping(value = "/force_change_pass", method = RequestMethod.POST) + public ResponseValue forceChangePassword(String encryptPassword){ + if(StringUtils.isEmpty(encryptPassword)){ + return ResponseValue.error("蹇呴』濉啓淇敼瀵嗙爜鍐呭"); + } + String originPassword = PlatformRSAUtils.getRsaDecryptValue(encryptPassword, PlatformRSAUtils.PRIK); + String error = this.validatePasswordRule(originPassword); + if(error != null){ + return ResponseValue.error(error); + } + + long userId = this.getCurrentUserId(); + this.getUserService().execForceChangePassword(userId, this.encryptPassword(originPassword)); + // 鏇存柊缂撳瓨 + S_user_core userCore = this.getUserService().get(new S_user_core(userId)); + this.getUserCacheProvider().updateUser(userCore); + + // 鏇存柊鐧诲綍鐢ㄦ埛缂撳瓨 + String uuid = null; + UserPrincipal<S_user_core> userPrincipal = null; + UserOnlineProvider userOnlineProvider = BeanContextAware.getBeanByType(UserOnlineProvider.class); + TokenEntity tokenEntity = TokenAwareContext.getCurrentToken(); + if(tokenEntity != null){ + uuid = tokenEntity.getUuid(); + userPrincipal = (UserPrincipal<S_user_core>)userOnlineProvider.getUserPrincipal(uuid); + } else { + logger.debug("TokenAwareContext 鏈幏鍙栧埌token淇℃伅锛岄渶瑕佷粠鐧诲綍缂撳瓨涓煡璇紝userId={}", userId); + S_user_login user_login = this.getLoginStrategyManager().getUserLogin(userCore.getUser_name()); + if(user_login == null){ + logger.warn("鐢ㄦ埛宸诧紙寮哄埗锛変慨鏀瑰瘑鐮侊紝浣嗘湭鎵惧埌鐧诲綍缂撳瓨(user_login)锛岄渶瑕侀噸鏂扮櫥褰曪紝user = {}", userCore.getUser_name()); + throw new IllegalStateException(""); + } + uuid = user_login.getUuid(); + userPrincipal = (UserPrincipal<S_user_core>)userOnlineProvider.getUserPrincipal(uuid); + } + userPrincipal.getUserInfo().setModify_pwd(1); + userOnlineProvider.cacheUserPrincipal(uuid, userPrincipal); + logger.debug("瀵嗙爜宸蹭慨鏀癸紝userId={}", userId); + + return ResponseValue.success(); + } +} diff --git a/iplatform-base-admin/src/main/java/com/iplatform/base/excel/UserDataImportor.java b/iplatform-base-admin/src/main/java/com/iplatform/base/excel/UserDataImportor.java new file mode 100644 index 0000000..2b7321e --- /dev/null +++ b/iplatform-base-admin/src/main/java/com/iplatform/base/excel/UserDataImportor.java @@ -0,0 +1,126 @@ +package com.iplatform.base.excel; + +import com.iplatform.base.di.JdbcExcelDataImportor; +import com.iplatform.base.util.DataImportUtils; +import com.walker.di.ErrorRecord; +import com.walker.di.UpdateResult; +import com.walker.di.UpdateType; +import com.walker.infrastructure.utils.PhoneNumberUtils; +import com.walker.infrastructure.utils.StringUtils; +import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; + +import java.io.InputStream; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 绯荤粺鐢ㄦ埛瀵煎叆鍣ㄥ疄鐜般�� + * @author 鏃跺厠鑻� + * @date 2023-02-07 + */ +public class UserDataImportor extends JdbcExcelDataImportor { + +// public UserDataImportor(File file){ +// this.setBatchEnabled(); +// this.setBatchSleepMills(200); +// this.setUpdateType(UpdateType.Override); // 璁剧疆鏇存柊绛栫暐涓�:瑕嗙洊璁板綍 +// try { +// this.setSource(new BufferedInputStream(new FileInputStream(file))); +// } catch (FileNotFoundException e) { +// throw new RuntimeException(e); +// } +// } + public UserDataImportor(InputStream inputStream){ + this.setBatchEnabled(); + this.setBatchSleepMills(200); + this.setUpdateType(UpdateType.Override); // 璁剧疆鏇存柊绛栫暐涓�:瑕嗙洊璁板綍 + this.setSource(inputStream); + } + + @Override + protected String acquireTableName() { + return "s_user_core"; + } + + @Override + protected boolean isCheckDataExist() { + return true; + } + + @Override + protected UpdateResult checkDataExist(String tableName, List<Map<String, Object>> mapList) { + // 1 - 鏍规嵁瀵煎叆鍘熷鏁版嵁鏌ヨ鏄惁鍦ㄨ〃涓瓨鍦ㄨ繖浜涜褰� + MapSqlParameterSource sqlParameterSource = new MapSqlParameterSource(); + List<String> paramUserName = DataImportUtils.acquireWhereInStringValues("user_name", mapList); + sqlParameterSource.addValue("userName", paramUserName); + List<Map<String, Object>> existList = this.getDataImportService().queryListObjectWhereIn(SQL_QUERY, sqlParameterSource); + + if(!StringUtils.isEmptyList(existList)){ + if(this.logger.isDebugEnabled()){ + for(Map<String, Object> existOne : existList){ + logger.debug("瀛樺湪涓�鏉℃暟鎹� = " + existOne); + } + } + } + + // 鍒涘缓鏇存柊缁撴灉瀵硅薄 + UpdateResult updateResult = new UpdateResult(); + + // 2 - 璁剧疆鍑嗗鏇存柊鐨�'鏉′欢瀛楁闆嗗悎'锛屽彲鏀寔澶氫釜 + List<String> whereColumnNames = Arrays.asList("user_name"); + + // 3 - 鎵惧埌鏂板啓鍏ュ拰闇�瑕佹洿鏂扮殑鏁版嵁闆嗗悎 + Object[] result = DataImportUtils.calculateInsertAndUpdateList(mapList, existList, whereColumnNames); + List<Map<String, Object>> insertList = (List<Map<String, Object>>)result[0]; + List<Map<String, Object>> updateList = (List<Map<String, Object>>)result[1]; + + // 4 - 璁剧疆瑕佸啓鍏ラ泦鍚� + updateResult.setInsertList(insertList); + + // 5 - 濡傛灉鏇存柊绛栫暐涓鸿鐩栵紝鍒欒缃鏇存柊闆嗗悎 + if(this.getUpdateType() == UpdateType.Override){ + // 濡傛灉鏇存柊鏁版嵁绛栫暐涓�: 瑕嗙洊妯″紡锛岄渶瑕佹壒閲忔洿鏂版暟鎹紝杩欓噷鑾峰緱鏇存柊闆嗗悎缁欏钩鍙般�� + updateResult.setUpdateColumnNames(Arrays.asList("dept_id", "org_id", "nick_name", "user_type", "email", "phonenumber", "sex")); + updateResult.setWhereColumnNames(whereColumnNames); + updateResult.setUpdateList(updateList); + } + + return updateResult; + } + + private static final String SQL_QUERY = "select * from s_user_core where user_name in (:userName)"; + + @Override + protected void finish(long currentDataRowCount, int readRowIndex) { + + } + + @Override + protected void emptyDataAfterValidate() { + + } + + @Override + protected void onValidateError(List<ErrorRecord> errorRecordList) { + + } + + @Override + protected String validateData(Map<String, String> data, int rowIndex) { + if(data.get("user_name") == null){ + return "鐧诲綍鍚嶄笉瀛樺湪"; + } + if(data.get("nick_name") == null){ + return "鏄电О涓嶅瓨鍦�"; + } + if(data.get("user_type") == null){ + return "鐢ㄦ埛绫诲瀷涓嶅瓨鍦�"; + } + String phoneNumber = data.get("phonenumber"); + if(StringUtils.isNotEmpty(phoneNumber) && !PhoneNumberUtils.isCellPhoneNumber(phoneNumber)){ + return "鎵嬫満鍙锋牸寮忛敊璇�"; + } + return null; + } +} diff --git a/iplatform-base-security-consum/pom.xml b/iplatform-base-security-consum/pom.xml index a5be6dc..994482a 100644 --- a/iplatform-base-security-consum/pom.xml +++ b/iplatform-base-security-consum/pom.xml @@ -3,15 +3,15 @@ <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <parent> - <artifactId>iplatform</artifactId> - <groupId>com.iplatform</groupId> - <version>2.3.0-SNAPSHOT</version> + <artifactId>low-consum-manage</artifactId> + <groupId>com.consum</groupId> + <version>1.0.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion> <artifactId>iplatform-base-security-consum</artifactId> <packaging>jar</packaging> - <version>1.0.0-SNAPSHOT</version> + <version>3.2.0</version> <properties> </properties> @@ -24,35 +24,6 @@ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <dependencies> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - - <!-- 閫氳繃鍩虹搴撳紩鍏�: spring-security, 2022/10/31 --> - <dependency> - <groupId>com.walkersoft</groupId> - <artifactId>walker-web-security</artifactId> - <exclusions> - <exclusion> - <artifactId>spring-security-core</artifactId> - <groupId>org.springframework.security</groupId> - </exclusion> - <exclusion> - <artifactId>snakeyaml</artifactId> - <groupId>org.yaml</groupId> - </exclusion> - </exclusions> - </dependency> - - <dependency> - <groupId>org.springframework.security</groupId> - <artifactId>spring-security-core</artifactId> - <version>5.7.12</version> - </dependency> - <!-- 骞冲彴鍩虹妯″潡蹇呴』瀛樺湪, 2022/10/31 --> <dependency> <groupId>com.iplatform</groupId> @@ -60,18 +31,37 @@ <scope>provided</scope> <exclusions> <exclusion> - <artifactId>snakeyaml</artifactId> - <groupId>org.yaml</groupId> + <artifactId>walker-web</artifactId> + <groupId>com.walkersoft</groupId> </exclusion> </exclusions> </dependency> <dependency> - <groupId>org.yaml</groupId> - <artifactId>snakeyaml</artifactId> - <version>2.0</version> + <groupId>io.jsonwebtoken</groupId> + <artifactId>jjwt-api</artifactId> + <version>0.11.5</version> </dependency> + <dependency> + <groupId>io.jsonwebtoken</groupId> + <artifactId>jjwt-impl</artifactId> + <version>0.11.5</version> + </dependency> + + <dependency> + <groupId>io.jsonwebtoken</groupId> + <artifactId>jjwt-jackson</artifactId> + <version>0.11.5</version> + </dependency> + + <dependency> + <groupId>com.walkersoft</groupId> + <artifactId>walker-web</artifactId> + <version>3.2.0</version> + <scope>system</scope> + <systemPath>${project.basedir}/src/main/resources/lib/walker-web-3.2.0.jar</systemPath> + </dependency> </dependencies> </project> diff --git a/iplatform-base-security-consum/src/main/java/com/iplatform/security/DefaultAuthenticationFailureHandler.java b/iplatform-base-security-consum/src/main/java/com/iplatform/security/DefaultAuthenticationFailureHandler.java index 8f0ba15..ba28898 100644 --- a/iplatform-base-security-consum/src/main/java/com/iplatform/security/DefaultAuthenticationFailureHandler.java +++ b/iplatform-base-security-consum/src/main/java/com/iplatform/security/DefaultAuthenticationFailureHandler.java @@ -5,6 +5,9 @@ import com.walker.web.ResponseCode; import com.walker.web.ResponseValue; import com.walker.web.util.ServletUtils; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.authentication.AccountExpiredException; @@ -16,9 +19,6 @@ import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.authentication.AuthenticationFailureHandler; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import java.io.IOException; public class DefaultAuthenticationFailureHandler implements AuthenticationFailureHandler { diff --git a/iplatform-base-security-consum/src/main/java/com/iplatform/security/DefaultAuthenticationFilter.java b/iplatform-base-security-consum/src/main/java/com/iplatform/security/DefaultAuthenticationFilter.java index 7748085..e2ad6e1 100644 --- a/iplatform-base-security-consum/src/main/java/com/iplatform/security/DefaultAuthenticationFilter.java +++ b/iplatform-base-security-consum/src/main/java/com/iplatform/security/DefaultAuthenticationFilter.java @@ -1,12 +1,11 @@ package com.iplatform.security; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.springframework.security.authentication.AuthenticationServiceException; import org.springframework.security.core.Authentication; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; /** * DefaultAuthenticationToken 閲嶅啓鍚庯紝鐧诲綍鎬绘槸鎶ラ敊: 鐢ㄦ埛鍚嶆垨瀵嗙爜閿欒锛屽皾璇曢噸鍐欒杩囨护鍣ㄣ�� diff --git a/iplatform-base-security-consum/src/main/java/com/iplatform/security/DefaultAuthenticationSuccessHandler.java b/iplatform-base-security-consum/src/main/java/com/iplatform/security/DefaultAuthenticationSuccessHandler.java index 6ddd13d..70e151e 100644 --- a/iplatform-base-security-consum/src/main/java/com/iplatform/security/DefaultAuthenticationSuccessHandler.java +++ b/iplatform-base-security-consum/src/main/java/com/iplatform/security/DefaultAuthenticationSuccessHandler.java @@ -2,14 +2,13 @@ import com.walker.web.TokenGenerator; import com.walker.web.UserPrincipal; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.core.Authentication; import org.springframework.security.web.authentication.AuthenticationSuccessHandler; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import java.io.IOException; @Deprecated diff --git a/iplatform-base-security-consum/src/main/java/com/iplatform/security/DefaultLogoutSuccessHandler.java b/iplatform-base-security-consum/src/main/java/com/iplatform/security/DefaultLogoutSuccessHandler.java index fd565cd..21b5605 100644 --- a/iplatform-base-security-consum/src/main/java/com/iplatform/security/DefaultLogoutSuccessHandler.java +++ b/iplatform-base-security-consum/src/main/java/com/iplatform/security/DefaultLogoutSuccessHandler.java @@ -11,14 +11,14 @@ import com.walker.web.TokenGenerator; import com.walker.web.UserOnlineProvider; import com.walker.web.util.ServletUtils; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.core.Authentication; import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import java.io.IOException; public class DefaultLogoutSuccessHandler implements LogoutSuccessHandler { diff --git a/iplatform-base-security-consum/src/main/java/com/iplatform/security/DefaultSecuritySpi.java b/iplatform-base-security-consum/src/main/java/com/iplatform/security/DefaultSecuritySpi.java index fa01fd1..4acc022 100644 --- a/iplatform-base-security-consum/src/main/java/com/iplatform/security/DefaultSecuritySpi.java +++ b/iplatform-base-security-consum/src/main/java/com/iplatform/security/DefaultSecuritySpi.java @@ -43,6 +43,7 @@ import com.walker.web.WebUserAgent; import com.walker.web.util.IdUtils; import com.walker.web.util.ServletUtils; +import jakarta.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.authentication.AuthenticationManager; @@ -52,7 +53,6 @@ import org.springframework.security.core.userdetails.UsernameNotFoundException; import org.springframework.security.crypto.password.PasswordEncoder; -import javax.servlet.http.HttpServletRequest; import java.util.HashMap; import java.util.List; import java.util.Map; diff --git a/iplatform-base-security-consum/src/main/java/com/iplatform/security/FailedAuthenticationEntryPoint.java b/iplatform-base-security-consum/src/main/java/com/iplatform/security/FailedAuthenticationEntryPoint.java index 3b627df..1c961af 100644 --- a/iplatform-base-security-consum/src/main/java/com/iplatform/security/FailedAuthenticationEntryPoint.java +++ b/iplatform-base-security-consum/src/main/java/com/iplatform/security/FailedAuthenticationEntryPoint.java @@ -4,12 +4,14 @@ import com.walker.web.ResponseCode; import com.walker.web.ResponseValue; import com.walker.web.util.ServletUtils; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.core.AuthenticationException; import org.springframework.security.web.AuthenticationEntryPoint; -import javax.servlet.ServletException; import java.io.IOException; /** @@ -22,8 +24,8 @@ protected final transient Logger logger = LoggerFactory.getLogger(getClass()); @Override - public void commence(javax.servlet.http.HttpServletRequest request - , javax.servlet.http.HttpServletResponse response + public void commence(HttpServletRequest request + , HttpServletResponse response , AuthenticationException authException) throws IOException, ServletException { String msg = "璁よ瘉澶辫触锛屾棤鏉冮檺璁块棶绯荤粺璧勬簮" + request.getRequestURI(); diff --git a/iplatform-base-security-consum/src/main/java/com/iplatform/security/JwtAuthenticationTokenFilter.java b/iplatform-base-security-consum/src/main/java/com/iplatform/security/JwtAuthenticationTokenFilter.java index 241bb83..215aa4c 100644 --- a/iplatform-base-security-consum/src/main/java/com/iplatform/security/JwtAuthenticationTokenFilter.java +++ b/iplatform-base-security-consum/src/main/java/com/iplatform/security/JwtAuthenticationTokenFilter.java @@ -17,6 +17,10 @@ import com.walker.web.UserOnlineProvider; import com.walker.web.UserPrincipal; import com.walker.web.util.ServletUtils; +import jakarta.servlet.FilterChain; +import jakarta.servlet.ServletException; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; @@ -24,10 +28,6 @@ import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; import org.springframework.web.filter.OncePerRequestFilter; -import javax.servlet.FilterChain; -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.List; diff --git a/iplatform-base-security-consum/src/main/java/com/iplatform/security/config/WebSecurityConfig.java b/iplatform-base-security-consum/src/main/java/com/iplatform/security/config/WebSecurityConfig.java index 90761ab..3078051 100644 --- a/iplatform-base-security-consum/src/main/java/com/iplatform/security/config/WebSecurityConfig.java +++ b/iplatform-base-security-consum/src/main/java/com/iplatform/security/config/WebSecurityConfig.java @@ -37,6 +37,7 @@ import com.walker.web.security.DefaultSecurityMetadataSource; import com.walker.web.security.ResourceLoadProvider; import com.walker.web.token.JwtTokenGenerator; +import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; @@ -45,6 +46,7 @@ import org.springframework.security.access.AccessDecisionManager; import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration; +import org.springframework.security.config.annotation.web.ExceptionHandlingDsl; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.http.SessionCreationPolicy; import org.springframework.security.core.userdetails.UserDetailsService; @@ -93,6 +95,13 @@ } /** + * HttpSecurity锛氬拷鐣� antMatchers 涓娇鐢ㄧ殑绔偣鐨勮韩浠介獙璇侊紝鍏朵粬瀹夊叏鍔熻兘灏嗙敓鏁堛��<br></br> + * WebSecurity锛氱洿鎺ュ拷鐣ヤ篃涓嶄細杩涜 CSRF xss绛夋敾鍑讳繚鎶ゃ�� + * @param http + * @return + * @throws Exception + */ + /** * HttpSecurity锛氬拷鐣� antMatchers 涓娇鐢ㄧ殑绔偣鐨勮韩浠介獙璇侊紝鍏朵粬瀹夊叏鍔熻兘灏嗙敓鏁堛��<br></br> * WebSecurity锛氱洿鎺ュ拷鐣ヤ篃涓嶄細杩涜 CSRF xss绛夋敾鍑讳繚鎶ゃ�� * @param http @@ -101,82 +110,89 @@ */ @Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { + // 缂撳瓨 securityProperties 鐨勭粨鏋滐紝閬垮厤閲嶅璋冪敤 + SecurityProperties securityProperties = this.securityProperties(); - DefaultUserDetailsService userDetailsService = userDetailsService(this.securityProperties(), this.userCacheProvider); + DefaultUserDetailsService userDetailsService = userDetailsService(securityProperties, this.userCacheProvider); http.userDetailsService(userDetailsService); + // CSRF绂佺敤锛屽洜涓轰笉浣跨敤session - http.csrf().disable(); - // ??? - http.headers().frameOptions().disable(); + // 娉ㄦ剰锛氱鐢–SRF闇�纭繚鎵�鏈夋帴鍙e凡閫氳繃鍏朵粬鏂瑰紡淇濇姢 + http.csrf(csrf -> csrf.disable()); - // 鐧诲綍琛屼负鐢辫嚜宸卞疄鐜帮紝鍙傝�� AuthController#login - http.formLogin().disable().httpBasic().disable(); + // 绂佺敤frameOptions浠ユ敮鎸乮frame宓屽 + // 鏇挎崲寮冪敤鐨� headers() 鏂规硶 + http.headers(headers -> headers.frameOptions(frameOptions -> frameOptions.disable())); - // 鍖垮悕璧勬簮璁块棶鏉冮檺锛岃繑鍥炴棤鏉冮檺鎻愮ず鎺ュ彛 - http.exceptionHandling().authenticationEntryPoint(failedAuthenticationEntryPoint()) - // 宸茶璇佺敤鎴锋棤鏉冮檺璁块棶閰嶇疆 - .accessDeniedHandler(this.accessDeniedHandler()) - .and() - // 鍩轰簬token锛屾墍浠ヤ笉闇�瑕乻ession - .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS); + // 绂佺敤榛樿鐧诲綍鍜孒TTP Basic璁よ瘉 + http.formLogin(formLogin -> formLogin.disable()); -// http.formLogin().loginProcessingUrl("/login") -// .failureHandler(this.authenticationFailureHandler()); - // 娉ㄦ剰锛氳繖閲屼笉鑳介厤缃笂闈㈢殑鐧诲綍锛屽惁鍒欏氨涓嶄細鎵ц鑷繁瀹炵幇鐨�/login鏂规硶銆�2022-11-11 - http.logout().logoutUrl("/logout").logoutSuccessHandler(this.logoutSuccessHandler()).permitAll(); + // 寮傚父澶勭悊閰嶇疆 + http.exceptionHandling(exceptionHandling -> exceptionHandling + .authenticationEntryPoint(failedAuthenticationEntryPoint()) + .accessDeniedHandler(this.accessDeniedHandler())); - // 鍖垮悕璁块棶闆嗗悎锛�2022-11-07 - List<String> anonymousList = this.securityProperties().getAnonymousList(); - if(!StringUtils.isEmptyList(anonymousList)){ - http.authorizeHttpRequests().antMatchers(anonymousList.toArray(new String[]{})).permitAll(); - } -// http.authorizeHttpRequests().antMatchers("/login", "/register", "/captchaImage", "/test/**").permitAll(); -// http.authorizeHttpRequests().antMatchers("/static/**", "/test/**").permitAll(); -// http.authorizeHttpRequests().antMatchers("/security/**").hasAuthority("query_user"); + // 鍩轰簬token锛屾墍浠ヤ笉闇�瑕乻ession + http.sessionManagement(sessionManagement -> sessionManagement.sessionCreationPolicy(SessionCreationPolicy.STATELESS)); - // 2023-03-21 娉ㄩ噴鎺夛紝璋冭瘯activiti7鏃跺彂鐜板拰涓嬮潰閲嶅锛� - // http.addFilterBefore(securityInterceptor(), FilterSecurityInterceptor.class); - /*http.authorizeHttpRequests().withObjectPostProcessor(new ObjectPostProcessor<FilterSecurityInterceptor>(){ - @Override - public <O extends FilterSecurityInterceptor> O postProcess(O object) { - object.setAccessDecisionManager(accessDecisionManager());//鍐崇瓥绠$悊鍣� - object.setSecurityMetadataSource(securityMetadataSource());//瀹夊叏鍏冩暟鎹簮 - return object; - } - });*/ + // 鐧诲嚭閰嶇疆 + http.logout(logout -> logout + .logoutUrl("/logout") + .logoutSuccessHandler(this.logoutSuccessHandler()) + .permitAll()); - // 2023-01-28 閰嶇疆鑷畾涔夎璇佹彁渚涜��(瀵嗙爜楠岃瘉鐢�) - http.authenticationProvider(this.authenticationProvider(userDetailsService, securityProperties())); + // 閰嶇疆鍖垮悕璁块棶鏉冮檺 + configureAnonymousAccess(http, securityProperties); + + // 閰嶇疆鑷畾涔夎璇佹彁渚涜�� + http.authenticationProvider(this.authenticationProvider(userDetailsService, securityProperties)); // 鎵�鏈夎姹傞兘闇�瑕佽璇� - http.authorizeHttpRequests().anyRequest().authenticated(); - // 浣跨敤鑷畾涔夊姩鎬佹嫤鎴櫒锛屾嫤鎴墍鏈夋潈闄愯姹傦紝2022-11-02 + http.authorizeHttpRequests(authorizeHttpRequests -> authorizeHttpRequests.anyRequest().authenticated()); + + // 娣诲姞鑷畾涔夊姩鎬佹嫤鎴櫒 http.addFilterBefore(securityInterceptor(), FilterSecurityInterceptor.class); - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - // token鎷︽埅杩囨护鍣紝2022-11-02 - // 蹇呴』鍦ㄨ繖閲屾坊鍔犳嫤鎴紝涓嶈兘鏀惧湪'FilterSecurityInterceptor'涔嬪悗锛屽洜涓哄鏋滄斁鍦ㄤ箣鍚庯紝閭d箞灏辨棤娉曡幏寰楃敤鎴蜂俊鎭紝浠庤�屾棤娉� - // 鑾峰緱鐢ㄦ埛鎵�鍏锋湁鐨勬潈闄愯鑹查泦鍚�:roleIdList銆�2022-11-14(2) + // 娣诲姞JWT璁よ瘉杩囨护鍣� http.addFilterBefore(jwtAuthenticationTokenFilter(userDetailsService), UsernamePasswordAuthenticationFilter.class); -// http.addFilterBefore(jwtAuthenticationTokenFilter(), DefaultAuthenticationFilter.class); - // 灏濊瘯璁﹋wt鍦║RL鏉冮檺涔嬪悗鎵嶆嫤鎴�, 2022-11-14(1) - // 娉ㄦ剰锛氫互涓� UsernamePasswordAuthenticationFilter 闇�瑕佸幓鎺夋墠鑳界敓鏁� -// http.addFilterAfter(jwtAuthenticationTokenFilter(), FilterSecurityInterceptor.class); - // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - if(this.securityProperties().isCorsEnabled()){ - // 瑙e喅璺ㄥ煙杩囨护鍣紝2022-11-06 - http.addFilterBefore(this.corsFilter().getFilter(), JwtAuthenticationTokenFilter.class); - // 鏈煡锛�2022-11-11 - http.addFilterBefore(this.corsFilter().getFilter(), LogoutFilter.class); - } else { - System.out.println("涓嶆坊鍔犺法鍩熻繃婊ゅ櫒: "); - } + // 閰嶇疆璺ㄥ煙杩囨护鍣� + configureCorsFilter(http, securityProperties); return http.build(); } /** + * 閰嶇疆鍖垮悕璁块棶鏉冮檺 + */ + private void configureAnonymousAccess(HttpSecurity http, SecurityProperties securityProperties) throws Exception { + List<String> anonymousList = securityProperties.getAnonymousList(); + if (!CollectionUtils.isEmpty(anonymousList)) { + http.authorizeHttpRequests(authorizeHttpRequests -> authorizeHttpRequests + .requestMatchers(anonymousList.toArray(new String[0])).permitAll()); + } + } + + /** + * 閰嶇疆璺ㄥ煙杩囨护鍣� + */ + private void configureCorsFilter(HttpSecurity http, SecurityProperties securityProperties) throws Exception { + if (securityProperties.isCorsEnabled()) { + CorsFilter corsFilter = this.corsFilter().getFilter(); + if (corsFilter != null) { + http.addFilterBefore(corsFilter, JwtAuthenticationTokenFilter.class) + .addFilterBefore(corsFilter, LogoutFilter.class); + logger.info("璺ㄥ煙杩囨护鍣ㄥ凡鍚敤"); + } else { + logger.warn("璺ㄥ煙杩囨护鍣ㄦ湭姝g‘鍒濆鍖�"); + } + } else { + logger.info("璺ㄥ煙杩囨护鍣ㄦ湭鍚敤"); + } + } + + + /** * 鑾峰彇AuthenticationManager锛堣璇佺鐞嗗櫒锛夛紝鐧诲綍鏃惰璇佷娇鐢� * @param authenticationConfiguration * @return diff --git a/iplatform-base-security-consum/src/main/java/com/iplatform/security/controller/SecurityController.java b/iplatform-base-security-consum/src/main/java/com/iplatform/security/controller/SecurityController.java index 2645ca5..e95f2f1 100644 --- a/iplatform-base-security-consum/src/main/java/com/iplatform/security/controller/SecurityController.java +++ b/iplatform-base-security-consum/src/main/java/com/iplatform/security/controller/SecurityController.java @@ -218,7 +218,7 @@ } else { // 2023-10-13 logger.debug("瀛樺湪涓氬姟鑷畾涔夋潈闄愬洖璋冿細{}", securityCallback.getClass().getName()); - Set<String> userPermission = securityCallback.loadUserPermission(userPrincipal.getUserInfo(), menuIdList); + Set<String> userPermission = securityCallback.loadUserPermission(userPrincipal.getUserInfo(), menuIdList, null); if(userPermission != null){ perms.addAll(userPermission); } diff --git a/iplatform-base-tcp/pom.xml b/iplatform-base-tcp/pom.xml new file mode 100644 index 0000000..d86e609 --- /dev/null +++ b/iplatform-base-tcp/pom.xml @@ -0,0 +1,225 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>low-consum-manage</artifactId> + <groupId>com.consum</groupId> + <version>1.0.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <groupId>com.iplatform</groupId> + <artifactId>iplatform-base-tcp</artifactId> + <name>iplatform-base-tcp</name> + <packaging>jar</packaging> + <version>3.2.0</version> + + <dependencies> + + <!-- 渚濊禆搴曞眰閫氫俊妯″潡锛�2024-01-23 --> + <dependency> + <groupId>com.walkersoft</groupId> + <artifactId>walker-tcp</artifactId> + <version>${walker-web-security.version}</version> + <systemPath>${project.basedir}/src/main/resources/lib/walker-tcp-3.2.0.jar</systemPath> + <scope>system</scope> + </dependency> + + <dependency> + <groupId>org.postgresql</groupId> + <artifactId>postgresql</artifactId> + <version>4.2</version> + <systemPath>${project.basedir}/src/main/resources/lib/tdsql-pg-connector-java8-1.0.5.jar</systemPath> + <scope>system</scope> + </dependency> + + <!-- 鎻愪緵骞冲彴鍩虹鐜锛�2023-04-16 --> + <dependency> + <groupId>com.iplatform</groupId> + <artifactId>iplatform-base</artifactId> + <exclusions> + <exclusion> + <artifactId>walker-web</artifactId> + <groupId>com.walkersoft</groupId> + </exclusion> + <exclusion> + <artifactId>jjwt</artifactId> + <groupId>io.jsonwebtoken</groupId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>com.consum</groupId> + <artifactId>iplatform-base-security-consum</artifactId> + <version>3.2.0</version> + <exclusions> + <exclusion> + <artifactId>walker-web</artifactId> + <groupId>com.walkersoft</groupId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>com.iplatform</groupId> + <artifactId>iplatform-file-server</artifactId> + </dependency> + <!-- 闃块噷druid鏁版嵁搴撹繛鎺ユ睜锛屽鏋滀娇鐢ㄧ洿鎺ュ紩鍏ュ埌涓氬姟鍙戝竷妯″潡涓紝2023-03-15 --> + <dependency> + <groupId>com.alibaba</groupId> + <artifactId>druid</artifactId> + </dependency> + + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-transport</artifactId> + <version>${netty.version}</version> + </dependency> + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-codec</artifactId> + <version>${netty.version}</version> + </dependency> + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-handler</artifactId> + <version>${netty.version}</version> + </dependency> + <dependency> + <groupId>io.netty</groupId> + <artifactId>netty-codec-http</artifactId> + <version>${netty.version}</version> + </dependency> + <!-- 鎵爜鍖呬笅闈㈢殑 TcpRequest 娉ㄨВ浣跨敤锛�2023-04-16 --> + <dependency> + <groupId>org.reflections</groupId> + <artifactId>reflections</artifactId> + <version>0.9.9</version> + </dependency> + + <!-- RocketMQ Spring 妗嗘灦渚濊禆銆�2023-09-18 --> + <dependency> + <groupId>org.apache.rocketmq</groupId> + <artifactId>rocketmq-spring-boot-starter</artifactId> + <version>2.1.0</version> + <exclusions> + <exclusion> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-autoconfigure</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-autoconfigure-processor</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-configuration-processor</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-test</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework</groupId> + <artifactId>spring-messaging</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework</groupId> + <artifactId>spring-context</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework</groupId> + <artifactId>spring-aop</artifactId> + </exclusion> + <exclusion> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-validation</artifactId> + </exclusion> + </exclusions> + + </dependency> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-messaging</artifactId> + </dependency> + + <!--websocket浣滀负瀹㈡埛绔�--> + <dependency> + <groupId>org.java-websocket</groupId> + <artifactId>Java-WebSocket</artifactId> + <version>1.5.4</version> + <scope>test</scope> + </dependency> + + </dependencies> + + <build> + <finalName>ctoms-websocket</finalName> + <plugins> + <plugin> + <!--鑳藉鑷姩瀵绘壘springboot寮曞绫伙紝鎴栬�呮墜鍔ㄦ寚瀹�--> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <version>${spring-boot.version}</version> + <executions> + <execution> + <goals> + <goal>repackage</goal> + </goals> + </execution> + </executions> + <configuration> + <!-- 2023-11-06 璇ュ弬鏁版寚瀹氫簡渚濊禆鐨勬湰鍦扮被搴擄紝涓嶅紩鍏ュ垯鎶ラ敊锛氫笉鑳芥寚鍚戞湰鍦癹ar鏂囦欢 --> + <arguments> + <argument>${project.basedir}/src/main/resources/lib</argument> + </arguments> + <!-- 2023-11-06 璇ュ弬鏁版寚瀹氾紝鎵撳寘蹇界暐 Main 鍑芥暟銆�--> + <!-- <skip>true</skip>--> + <!--鏈湴鍖呭鍏ラ厤缃�--> + <includeSystemScope>true</includeSystemScope> + <!--鑷畾涔夊垎绫诲櫒閰嶇疆锛岄槻姝㈢埗瀛愰」鐩墦鍖呭け璐�--> + <!-- <classifier>exec</classifier>--> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-deploy-plugin</artifactId> + <version>${maven-deploy-plugin.version}</version> + <executions> + <execution> + <id>default-deploy</id> + <phase>deploy</phase> + <goals> + <goal>deploy</goal> + </goals> + <!-- skip榛樿deploy鎻掍欢鐨勬墽琛� --> + <configuration> + <skip>true</skip> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/CtomsTcpApplication.java b/iplatform-base-tcp/src/main/java/com/iplatform/CtomsTcpApplication.java new file mode 100644 index 0000000..8c37edc --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/CtomsTcpApplication.java @@ -0,0 +1,23 @@ +package com.iplatform; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; +import org.springframework.scheduling.annotation.EnableAsync; + +@SpringBootApplication(scanBasePackages = {"com.walker","com.iplatform"}) +@EnableAsync +public class CtomsTcpApplication { + + public static void main(String[] args) throws Exception{ + SpringApplication.run(CtomsTcpApplication.class, args); + } + +// @Bean +// public static PropertySourcesPlaceholderConfigurer placeholderConfigurer() { +// PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer = new PropertySourcesPlaceholderConfigurer(); +// propertySourcesPlaceholderConfigurer.setIgnoreUnresolvablePlaceholders(true); +// return propertySourcesPlaceholderConfigurer; +// } +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/Constants.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/Constants.java new file mode 100644 index 0000000..ec7376a --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/Constants.java @@ -0,0 +1,16 @@ +package com.iplatform.tcp; + +public class Constants { + + public static final String CACHE_NAME_EQUIPMENT = "cache.tcp.equip"; + public static final String CACHE_NAME_EQUIPMENT_STATUS = "cache.tcp.equip_status"; + + /** + * TCP妯″潡缂撳瓨锛氶暱杩炴帴瀵硅薄缂撳瓨銆� + * @date 2023-09-23 + */ + public static final String CACHE_NAME_CONNECTION = "cache.tcp.connect"; + +// public static final String QUEUE_TYPE_MEMORY = "memory"; + +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/EngineType.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/EngineType.java new file mode 100644 index 0000000..bc24f7d --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/EngineType.java @@ -0,0 +1,37 @@ +package com.iplatform.tcp; + +/** + * TCP閫氫俊寮曟搸绫诲瀷瀹氫箟銆� + * @author 鏃跺厠鑻� + * @date 2023-04-17 + */ +public enum EngineType { + + TcpEngine{ + public int getIndex(){ + return INDEX_TCP_ENGINE; + } + }, + WebsocketEngine{ + public int getIndex(){ + return INDEX_TCP_WEBSOCKET; + } + }; + + public int getIndex(){ + throw new AbstractMethodError(); + } + + public EngineType getType(int index){ + if(index == INDEX_TCP_ENGINE){ + return TcpEngine; + } else if(index == INDEX_TCP_WEBSOCKET){ + return WebsocketEngine; + } else { + throw new UnsupportedOperationException("涓嶆敮鎸佺殑閫氫俊寮曟搸:" + index); + } + } + + public static final int INDEX_TCP_ENGINE = 1; + public static final int INDEX_TCP_WEBSOCKET = 2; +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/EquipmentCacheProvider.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/EquipmentCacheProvider.java new file mode 100644 index 0000000..140c6c1 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/EquipmentCacheProvider.java @@ -0,0 +1,17 @@ +package com.iplatform.tcp; + +import com.iplatform.model.po.TcpEquip; + +/** + * TCP璁惧缂撳瓨瀹氫箟銆�<p>璁惧缂栧彿鍞竴锛屽湪鎵�鏈夋満鏋勪腑涔熸槸鍞竴鐨�</p> + * @author 鏃跺厠鑻� + * @date 2023-04-16 + */ +public interface EquipmentCacheProvider { + + void putEquipment(String key, TcpEquip tcpEquip); + + TcpEquip getEquipment(String key); + + void removeEquipment(String key); +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/EquipmentStatusCacheProvider.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/EquipmentStatusCacheProvider.java new file mode 100644 index 0000000..2d237b9 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/EquipmentStatusCacheProvider.java @@ -0,0 +1,17 @@ +package com.iplatform.tcp; + +import com.iplatform.model.po.TcpEquipStatus; + +/** + * 璁惧鐘舵�佺紦瀛橈紝涓�涓澶囧搴斾竴鏉¤褰曘�� + * @author 鏃跺厠鑻� + * @date 2023-04-16 + */ +public interface EquipmentStatusCacheProvider { + + void putEquipmentStatus(String key, TcpEquipStatus tcpEquip); + + TcpEquipStatus getEquipmentStatus(String key); + + void removeEquipmentStatus(String key); +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/LiveStatus.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/LiveStatus.java new file mode 100644 index 0000000..59f4448 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/LiveStatus.java @@ -0,0 +1,44 @@ +package com.iplatform.tcp; + +/** + * 閫氳杩炴帴鐘舵�佹灇涓剧被鍨嬪畾涔� + * @author 鏃跺厠鑻� + * @date 2018-11-29 + * + */ +public enum LiveStatus { + + /** + * 鏈繛鎺ワ細0 + */ + NotConnect { + public int getTypeValue(){ + return CONST_NOT_CONNECT; + } + }, + + /** + * 宸茶繛鎺ワ細1 + */ + Connected { + public int getTypeValue(){ + return CONST_CONNECTED; + } + }; + + public static final int CONST_CONNECTED = 1; + public static final int CONST_NOT_CONNECT = 0; + + public int getTypeValue(){ + throw new AbstractMethodError(); + } + + public static LiveStatus getType(int index){ + if(index == CONST_CONNECTED){ + return Connected; + } else if(index == CONST_NOT_CONNECT){ + return NotConnect; + } else + throw new IllegalArgumentException("unsupported LiveStatus: " + index); + } +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/TcpBaseController.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/TcpBaseController.java new file mode 100644 index 0000000..ed4c8c0 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/TcpBaseController.java @@ -0,0 +1,6 @@ +package com.iplatform.tcp; + +import com.iplatform.base.SystemController; + +public abstract class TcpBaseController extends SystemController { +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/cache/LocalEquipStatusCacheProvider.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/cache/LocalEquipStatusCacheProvider.java new file mode 100644 index 0000000..81fb7cf --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/cache/LocalEquipStatusCacheProvider.java @@ -0,0 +1,57 @@ +package com.iplatform.tcp.cache; + +import com.iplatform.model.po.TcpEquipStatus; +import com.iplatform.tcp.Constants; +import com.iplatform.tcp.EquipmentStatusCacheProvider; +import com.iplatform.tcp.service.TcpEquipStatusServiceImpl; +import com.walker.cache.AbstractCacheProvider; +import com.walker.cache.Cache; +import com.walker.infrastructure.utils.StringUtils; + +import java.util.List; + +public class LocalEquipStatusCacheProvider extends AbstractCacheProvider<TcpEquipStatus> implements EquipmentStatusCacheProvider { + + @Override + public void putEquipmentStatus(String key, TcpEquipStatus tcpEquipStatus) { + this.putCacheData(key, tcpEquipStatus); + } + + @Override + public TcpEquipStatus getEquipmentStatus(String key) { + return this.getCacheData(key); + } + + @Override + public void removeEquipmentStatus(String key) { + this.removeCacheData(key); + } + + @Override + protected int loadDataToCache(Cache cache) { + List<TcpEquipStatus> hosts = this.tcpEquipStatusService.selectAll(new TcpEquipStatus()); + if(!StringUtils.isEmptyList(hosts)){ + for(TcpEquipStatus h : hosts){ + cache.put(h.getEquipNum(), h); + } + return hosts.size(); + } + return 0; + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_EQUIPMENT_STATUS; + } + + @Override + public Class<?> getProviderType() { + return TcpEquipStatus.class; + } + + public void setTcpEquipStatusService(TcpEquipStatusServiceImpl tcpEquipStatusService) { + this.tcpEquipStatusService = tcpEquipStatusService; + } + + private TcpEquipStatusServiceImpl tcpEquipStatusService; +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/cache/LocalEquipmentCacheProvider.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/cache/LocalEquipmentCacheProvider.java new file mode 100644 index 0000000..56dd681 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/cache/LocalEquipmentCacheProvider.java @@ -0,0 +1,57 @@ +package com.iplatform.tcp.cache; + +import com.iplatform.model.po.TcpEquip; +import com.iplatform.tcp.Constants; +import com.iplatform.tcp.EquipmentCacheProvider; +import com.iplatform.tcp.service.TcpEquipServiceImpl; +import com.walker.cache.AbstractCacheProvider; +import com.walker.cache.Cache; +import com.walker.infrastructure.utils.StringUtils; + +import java.util.List; + +public class LocalEquipmentCacheProvider extends AbstractCacheProvider<TcpEquip> implements EquipmentCacheProvider { + + @Override + protected int loadDataToCache(Cache cache) { + List<TcpEquip> hosts = this.tcpEquipService.selectAll(new TcpEquip()); + if(!StringUtils.isEmptyList(hosts)){ + for(TcpEquip h : hosts){ + cache.put(h.getNum(), h); + } + return hosts.size(); + } + return 0; + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_EQUIPMENT; + } + + @Override + public Class<?> getProviderType() { + return TcpEquip.class; + } + + public void setTcpEquipService(TcpEquipServiceImpl tcpEquipService) { + this.tcpEquipService = tcpEquipService; + } + + private TcpEquipServiceImpl tcpEquipService; + + @Override + public void putEquipment(String key, TcpEquip tcpEquip) { + this.putCacheData(key, tcpEquip); + } + + @Override + public TcpEquip getEquipment(String key) { + return this.getCacheData(key); + } + + @Override + public void removeEquipment(String key) { + this.removeCacheData(key); + } +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/cache/RedisEquipStatusCacheProvider.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/cache/RedisEquipStatusCacheProvider.java new file mode 100644 index 0000000..151e8fb --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/cache/RedisEquipStatusCacheProvider.java @@ -0,0 +1,69 @@ +package com.iplatform.tcp.cache; + +import com.iplatform.model.po.TcpEquipStatus; +import com.iplatform.tcp.Constants; +import com.iplatform.tcp.EquipmentStatusCacheProvider; +import com.iplatform.tcp.service.TcpEquipStatusServiceImpl; +import com.walker.cache.Cache; +import com.walker.support.redis.cache.RedisCacheProvider; + +public class RedisEquipStatusCacheProvider extends RedisCacheProvider<TcpEquipStatus> implements EquipmentStatusCacheProvider { + + public RedisEquipStatusCacheProvider(){ + this.setUseRedis(true); + this.setLoadPage(false); + } + + @Override + public void putEquipmentStatus(String key, TcpEquipStatus tcpEquipStatus) { + this.putCacheData(key, tcpEquipStatus); + } + + @Override + public TcpEquipStatus getEquipmentStatus(String key) { + return this.getCacheData(key); + } + + @Override + public void removeEquipmentStatus(String key) { + this.removeCacheData(key); + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_EQUIPMENT_STATUS; + } + + @Override + public Class<?> getProviderType() { + return TcpEquipStatus.class; + } + + @Override + protected int loadDataToCache(Cache cache) { +// List<TcpEquipStatus> hosts = this.tcpEquipStatusService.selectAll(new TcpEquipStatus()); +// if(!StringUtils.isEmptyList(hosts)){ +// // ------------------------- 鍒囨崲鎴愭櫘閫氱紦瀛樻楠わ細3 +// if(this.isUseRedis()){ +// // 濡傛灉redis涓紦瀛樻暟閲忓拰鏁版嵁搴撲腑涓嶄竴鑷达紙灏戯級锛屽垯娓呯┖redis缂撳瓨锛岄噸鏂板姞杞芥暟鎹簱鏁版嵁鍒扮紦瀛樹腑銆� +// long totalCache = cache.getPersistentSize(); +// if(totalCache != hosts.size()){ +// logger.info("redis缂撳瓨涓敤鎴锋暟閲忓皬浜庡疄闄呯敤鎴凤紝闇�瑕佹竻绌虹紦瀛橀噸鏂板姞杞�! cache = " + totalCache + ", db = " + hosts.size()); +// cache.clear(); +// +// for(TcpEquipStatus h : hosts){ +// cache.put(h.getEquipNum(), h); +// } +// } +// }//------------------------------------------ +// return hosts.size(); +// } + return 0; + } + + public void setTcpEquipStatusService(TcpEquipStatusServiceImpl tcpEquipStatusService) { + this.tcpEquipStatusService = tcpEquipStatusService; + } + + private TcpEquipStatusServiceImpl tcpEquipStatusService; +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/cache/RedisEquipmentCacheProvider.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/cache/RedisEquipmentCacheProvider.java new file mode 100644 index 0000000..e6fc51a --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/cache/RedisEquipmentCacheProvider.java @@ -0,0 +1,69 @@ +package com.iplatform.tcp.cache; + +import com.iplatform.model.po.TcpEquip; +import com.iplatform.tcp.Constants; +import com.iplatform.tcp.EquipmentCacheProvider; +import com.iplatform.tcp.service.TcpEquipServiceImpl; +import com.walker.cache.Cache; +import com.walker.support.redis.cache.RedisCacheProvider; + +public class RedisEquipmentCacheProvider extends RedisCacheProvider<TcpEquip> implements EquipmentCacheProvider { + + public RedisEquipmentCacheProvider(){ + this.setUseRedis(true); + this.setLoadPage(false); + } + + @Override + public void putEquipment(String key, TcpEquip tcpEquip) { + this.putCacheData(key, tcpEquip); + } + + @Override + public TcpEquip getEquipment(String key) { + return this.getCacheData(key); + } + + @Override + public void removeEquipment(String key) { + this.removeCacheData(key); + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_EQUIPMENT; + } + + @Override + public Class<?> getProviderType() { + return TcpEquip.class; + } + + @Override + protected int loadDataToCache(Cache cache) { +// List<TcpEquip> hosts = this.tcpEquipService.selectAll(new TcpEquip()); +// if(!StringUtils.isEmptyList(hosts)){ +// // ------------------------- 鍒囨崲鎴愭櫘閫氱紦瀛樻楠わ細3 +// if(this.isUseRedis()){ +// // 濡傛灉redis涓紦瀛樻暟閲忓拰鏁版嵁搴撲腑涓嶄竴鑷达紙灏戯級锛屽垯娓呯┖redis缂撳瓨锛岄噸鏂板姞杞芥暟鎹簱鏁版嵁鍒扮紦瀛樹腑銆� +// long totalCache = cache.getPersistentSize(); +// if(totalCache != hosts.size()){ +// logger.info("redis缂撳瓨涓敤鎴锋暟閲忓皬浜庡疄闄呯敤鎴凤紝闇�瑕佹竻绌虹紦瀛橀噸鏂板姞杞�! cache = " + totalCache + ", db = " + hosts.size()); +// cache.clear(); +// +// for(TcpEquip h : hosts){ +// cache.put(h.getNum(), h); +// } +// } +// }//------------------------------------------ +// return hosts.size(); +// } + return 0; + } + + public void setTcpEquipService(TcpEquipServiceImpl tcpEquipService) { + this.tcpEquipService = tcpEquipService; + } + + private TcpEquipServiceImpl tcpEquipService; +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/config/LoadBalanceMQConfig.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/config/LoadBalanceMQConfig.java new file mode 100644 index 0000000..4ac536a --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/config/LoadBalanceMQConfig.java @@ -0,0 +1,82 @@ +package com.iplatform.tcp.config; + +import com.iplatform.core.PlatformConfiguration; +import com.iplatform.tcp.lb.DefaultResponseWriter; +import com.walker.push.rocketmq.RocketMQEnhanceTemplate; +import com.walker.tcp.lb.ResponseWriter; +import org.apache.rocketmq.spring.core.RocketMQTemplate; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * 闀胯繛鎺ヨ礋杞芥柟寮忔椂锛屽惎鐢∕Q妯℃澘浠ュ強鐩稿叧閰嶇疆銆� + * @author 鏃跺厠鑻� + * @date 2023-09-26 + */ +@Configuration +@ConditionalOnProperty(prefix = "iplatform.tcp", name = "load-balance-enabled", havingValue = "true", matchIfMissing = false) +@ConditionalOnClass({RocketMQTemplate.class}) +public class LoadBalanceMQConfig extends PlatformConfiguration { + + private RocketMQTemplate rocketMQTemplate; + + @Autowired + public LoadBalanceMQConfig(RocketMQTemplate rocketMQTemplate){ + this.rocketMQTemplate = rocketMQTemplate; + } + + /** + * 榛樿RocketMQ鐩戝惉鍣ㄩ厤缃紝娴嬭瘯浣跨敤銆傛寮忛渶瑕佸垹闄� + * @param connectionManager +// * @param template + * @return + * @date 2023-09-27 + */ +// @Bean +// public DefaultMqListener defaultMqListener(ConnectionManager connectionManager, RocketMQEnhanceTemplate template){ +// DefaultMqListener listener = new DefaultMqListener(); +// listener.setConnectionManager(connectionManager); +// listener.setRocketMQEnhanceTemplate(template); +// return listener; +// } + + /** + * 鐩戝惉瀵硅薄鏀惧湪涓氬姟涓鐞嗭紝骞冲彴娉ㄩ噴璇ュ璞★紝涓氬姟閫氳繃MQ鎺ユ敹鍏朵粬鑺傜偣鍙戦�佺殑鑱婂ぉ娑堟伅銆�<br> + * + * 1锛夊鏋滆鍦ㄥ钩鍙版祴璇曡礋璐h亰澶╋紝璇锋斁寮�娉ㄩ噴锛屽惎鐢細SimpleMqListener + * @date 2023-12-14 + */ +// @Bean +// public SimpleMqListener simpleMqListener(ConnectionManager connectionManager){ +// SimpleMqListener listener = new SimpleMqListener(); +// listener.setConnectionManager(connectionManager); +// return listener; +// } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + //~ 浠ヤ笅涓烘寮忛厤缃紝涓婇潰涓烘祴璇曞唴瀹广�� + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + /** + * 闀胯繛鎺ュ搷搴旀秷鎭啓鍏ラ�氶亾鍏蜂綋瀹炵幇銆� + * <p>鐩墠鍦ㄨ礋杞芥ā寮忎腑锛屽彂閫佹秷鎭埌MQ锛屽洜涓�<code>LongConnectionMeta</code>浠嶳edis鍙嶅簭鍒楀寲鍚庯紝鏃犳硶鎵ц瀛愮被write锛屾墍浠ラ�氳繃璇ュ璞″畬鎴愬啓鍏ャ��</p> + * @return + * @date 2023-09-27 + */ + @Bean + public ResponseWriter responseWriter(){ + return new DefaultResponseWriter(); + } + + @Bean + public RocketMQEnhanceTemplate rocketMQEnhanceTemplate(){ + RocketMQEnhanceTemplate template = new RocketMQEnhanceTemplate(); + template.setTemplate(this.rocketMQTemplate); +// template.setEnabledIsolation(); +// template.setEnvironmentName(); + return template; + } +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/config/LocalTcpCacheConfig.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/config/LocalTcpCacheConfig.java new file mode 100644 index 0000000..9a88d78 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/config/LocalTcpCacheConfig.java @@ -0,0 +1,43 @@ +package com.iplatform.tcp.config; + +import com.iplatform.core.PlatformConfiguration; +import com.iplatform.tcp.EquipmentCacheProvider; +import com.iplatform.tcp.EquipmentStatusCacheProvider; +import com.iplatform.tcp.cache.LocalEquipStatusCacheProvider; +import com.iplatform.tcp.cache.LocalEquipmentCacheProvider; +import com.iplatform.tcp.service.TcpEquipServiceImpl; +import com.iplatform.tcp.service.TcpEquipStatusServiceImpl; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ConditionalOnProperty(prefix = "iplatform.cache", name = "redis-enabled", havingValue = "false", matchIfMissing = true) +public class LocalTcpCacheConfig extends PlatformConfiguration { + + /** + * 閰嶇疆TCP璁惧淇℃伅缂撳瓨 + * @param tcpEquipService + * @return + * @date 2023-04-16 + */ + @Bean + public EquipmentCacheProvider equipmentCacheProvider(TcpEquipServiceImpl tcpEquipService){ + LocalEquipmentCacheProvider localEquipmentCacheProvider = new LocalEquipmentCacheProvider(); + localEquipmentCacheProvider.setTcpEquipService(tcpEquipService); + return localEquipmentCacheProvider; + } + + /** + * 閰嶇疆璁惧鐘舵�佺紦瀛橈紝涓�涓澶囦竴鏉¤褰曘�� + * @param tcpEquipStatusService + * @return + * @date 2023-04-16 + */ + @Bean + public EquipmentStatusCacheProvider equipmentStatusCacheProvider(TcpEquipStatusServiceImpl tcpEquipStatusService){ + LocalEquipStatusCacheProvider localEquipStatusCacheProvider = new LocalEquipStatusCacheProvider(); + localEquipStatusCacheProvider.setTcpEquipStatusService(tcpEquipStatusService); + return localEquipStatusCacheProvider; + } +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/config/RedisTcpCacheConfig.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/config/RedisTcpCacheConfig.java new file mode 100644 index 0000000..28ac9c8 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/config/RedisTcpCacheConfig.java @@ -0,0 +1,69 @@ +package com.iplatform.tcp.config; + +import com.iplatform.core.PlatformConfiguration; +import com.iplatform.tcp.EquipmentCacheProvider; +import com.iplatform.tcp.EquipmentStatusCacheProvider; +import com.iplatform.tcp.cache.RedisEquipStatusCacheProvider; +import com.iplatform.tcp.cache.RedisEquipmentCacheProvider; +import com.iplatform.tcp.service.TcpEquipServiceImpl; +import com.iplatform.tcp.service.TcpEquipStatusServiceImpl; +import com.walker.support.redis.RedisHelper; +import com.walker.support.redis.cache.RedisCacheProvider; +import com.walker.tcp.lb.RedisConnectionMetaCache; +import com.walker.tcp.lb.RedisConnectionNameCache; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ConditionalOnProperty(prefix = "iplatform.cache", name = "redis-enabled", havingValue = "true", matchIfMissing = false) +@ConditionalOnClass({RedisCacheProvider.class}) +@AutoConfigureAfter(RedisAutoConfiguration.class) +public class RedisTcpCacheConfig extends PlatformConfiguration { + + /** + * 闀胯繛鎺ヨ礋杞芥ā寮忎腑锛岃繛鎺ワ紙娉ㄥ唽锛夊悕绉颁笌閫氶亾ID鍏崇郴缂撳瓨瀹氫箟銆� + * @param redisHelper + * @return + * @date 2023-09-26 + */ + @Bean + public RedisConnectionNameCache redisConnectionNameCache(RedisHelper redisHelper){ + RedisConnectionNameCache cache = new RedisConnectionNameCache(); + cache.setRedisHelper(redisHelper); + return cache; + } + + /** + * 闀胯繛鎺ヨ礋杞芥ā寮忎腑锛岃繛鎺ュ厓鏁版嵁缂撳瓨瀹氫箟銆� + * @param redisHelper + * @return + * @date 2023-09-26 + */ + @Bean + public RedisConnectionMetaCache redisConnectionMetaCache(RedisHelper redisHelper){ + RedisConnectionMetaCache cache = new RedisConnectionMetaCache(); + cache.setRedisHelper(redisHelper); +// cache.setExpiredSeconds(); + return cache; + } + + @Bean + public EquipmentCacheProvider equipmentCacheProvider(RedisHelper redisHelper, TcpEquipServiceImpl tcpEquipService){ + RedisEquipmentCacheProvider redisEquipmentCacheProvider = new RedisEquipmentCacheProvider(); + redisEquipmentCacheProvider.setRedisHelper(redisHelper); + redisEquipmentCacheProvider.setTcpEquipService(tcpEquipService); + return redisEquipmentCacheProvider; + } + + @Bean + public EquipmentStatusCacheProvider equipmentStatusCacheProvider(RedisHelper redisHelper, TcpEquipStatusServiceImpl tcpEquipStatusService){ + RedisEquipStatusCacheProvider redisEquipStatusCacheProvider = new RedisEquipStatusCacheProvider(); + redisEquipStatusCacheProvider.setRedisHelper(redisHelper); + redisEquipStatusCacheProvider.setTcpEquipStatusService(tcpEquipStatusService); + return redisEquipStatusCacheProvider; + } +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/config/TcpBeanPostProcessorConfig.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/config/TcpBeanPostProcessorConfig.java new file mode 100644 index 0000000..0161f8a --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/config/TcpBeanPostProcessorConfig.java @@ -0,0 +1,29 @@ +package com.iplatform.tcp.config; + +import com.walker.tcp.ActionCallablePostProcessor; +import com.walker.tcp.ConnectionManager; +import com.walker.tcp.ProtocolResolverPostProcessor; +import com.walker.tcp.RequestPostProcessor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class TcpBeanPostProcessorConfig { + +// public static ConnectionManager connectionManager; + + @Bean + public ProtocolResolverPostProcessor protocolResolverPostProcessor(){ + return new ProtocolResolverPostProcessor(); + } + + @Bean + public ActionCallablePostProcessor actionCallablePostProcessor(){ + return new ActionCallablePostProcessor(); + } + + @Bean + public RequestPostProcessor requestPostProcessor(){ + return new RequestPostProcessor(); + } +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/config/TcpConfig.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/config/TcpConfig.java new file mode 100644 index 0000000..ffafc19 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/config/TcpConfig.java @@ -0,0 +1,213 @@ +package com.iplatform.tcp.config; + +import com.iplatform.base.config.TcpProperties; +import com.iplatform.core.PlatformConfiguration; +import com.iplatform.core.config.LoadBalanceProperties; +import com.iplatform.tcp.EngineType; +import com.iplatform.tcp.EquipmentCacheProvider; +import com.iplatform.tcp.EquipmentStatusCacheProvider; +import com.iplatform.tcp.lb.DefaultLbConnectionManager; +import com.iplatform.tcp.service.TcpEquipStatusServiceImpl; +import com.iplatform.tcp.support.PersistentConnectionManager; +import com.iplatform.tcp.support.PlatformSharpProtocolResolver; +import com.walker.infrastructure.ApplicationRuntimeException; +import com.walker.push.rocketmq.RocketQueueManager; +import com.walker.queue.QueueManager; +import com.walker.tcp.ConnectionManager; +import com.walker.tcp.ProtocolResolver; +import com.walker.tcp.handler.LongHandler; +import com.walker.tcp.lb.RedisConnectionMetaCache; +import com.walker.tcp.lb.RedisConnectionNameCache; +import com.walker.tcp.lb.ResponseWriter; +import com.walker.tcp.netty.DefaultLongEngine; +import com.walker.tcp.netty.DefaultLongHandler; +import com.walker.tcp.netty.DefaultServerInitializer; +import com.walker.tcp.protocol.LineProtocolResolver; +import com.walker.tcp.support.MemoryQueueManager; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.lang.Nullable; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Configuration +@ConditionalOnProperty(prefix = "iplatform.tcp", name = "enabled", havingValue = "true", matchIfMissing = false) +public class TcpConfig extends PlatformConfiguration { + + // 杩佺Щ鍒癰ase涓� +// @Bean +// public TcpProperties tcpProperties(){ +// return new TcpProperties(); +// } + + /** + * 閰嶇疆璁惧杩炴帴绠$悊鍣ㄣ�� + * @param equipmentCacheProvider + * @param equipmentStatusCacheProvider + * @param tcpEquipStatusService + * @return + * @date 2023-04-16 + * @date 2023-07-19 娣诲姞鏉′欢闄愬埗锛屽鏋滆缃嚜瀹氫箟杩炴帴绠$悊鍣紝鍒欏钩鍙颁笉鍐嶅垱寤猴紝鐢变笟鍔¤嚜宸遍厤缃�� + * @date 2023-09-26 娣诲姞闀胯繛鎺ュ厓鏁版嵁缂撳瓨閰嶇疆锛屼粎鍦ㄩ泦缇ゆā寮忓彲鐢ㄣ�� + */ + @ConditionalOnProperty(prefix = "iplatform.tcp", name = "custom-connection-manager", havingValue = "false", matchIfMissing = false) + @Bean + public ConnectionManager connectionManager(EquipmentCacheProvider equipmentCacheProvider + , EquipmentStatusCacheProvider equipmentStatusCacheProvider, TcpEquipStatusServiceImpl tcpEquipStatusService + , TcpProperties tcpProperties + , @Nullable RedisConnectionMetaCache connectionMetaCache, @Nullable RedisConnectionNameCache connectionNameCache + , @Nullable ResponseWriter responseWriter){ + Map<Integer, String> connectionTypeMap = new HashMap<>(4); + connectionTypeMap.put(EngineType.INDEX_TCP_ENGINE, "TCP闀胯繛鎺�"); + connectionTypeMap.put(EngineType.INDEX_TCP_WEBSOCKET, "WebSocket杩炴帴"); + + if(tcpProperties.isLoadBalanceEnabled()){ + DefaultLbConnectionManager connectionManager = new DefaultLbConnectionManager(); + connectionManager.setMultipleEngine(true); + connectionManager.setConnectionTypeMap(connectionTypeMap); + // 涓嬮潰杩欎袱涓紦瀛樺弬鏁帮紝鍙湁鍦≧edis鍚敤鏃舵墠瀛樺湪锛屽崟鏈烘ā寮忓彲涓虹┖銆�2023-09-26 + connectionManager.setConnectionMetaCache(connectionMetaCache); + connectionManager.setConnectionNameCache(connectionNameCache); + connectionManager.setConnectionHost(tcpProperties.getConnectionHost()); + connectionManager.setResponseWriter(responseWriter); +// connectionManager.setEquipCache(equipmentCacheProvider); +// connectionManager.setStatusCache(equipmentStatusCacheProvider); +// connectionManager.setTcpEquipStatusService(tcpEquipStatusService); + logger.debug("getConnectionHost = {}", tcpProperties.getConnectionHost()); + logger.info("connectionMetaCache = {}", connectionMetaCache.getClass().getName()); + return connectionManager; + + } else { + PersistentConnectionManager connectionManager = new PersistentConnectionManager(); + connectionManager.setMultipleEngine(true); + connectionManager.setConnectionTypeMap(connectionTypeMap); + connectionManager.setEquipCache(equipmentCacheProvider); + connectionManager.setStatusCache(equipmentStatusCacheProvider); + connectionManager.setTcpEquipStatusService(tcpEquipStatusService); + return connectionManager; + } + } + + /** + * 閰嶇疆鍗忚瑙f瀽鍣細鏈�鍩烘湰鐨勬枃鏈崲琛岋紝涓�琛屾槸涓�涓秷鎭綋銆� + * @return + * @date 2023-04-16 + */ + @Bean + public LineProtocolResolver lineProtocolResolver(){ + return new LineProtocolResolver(); + } + + @Bean + public PlatformSharpProtocolResolver platformSharpProtocolResolver(){ + PlatformSharpProtocolResolver resolver = new PlatformSharpProtocolResolver(); + return resolver; + } + + /** + * 閰嶇疆娑堟伅闃熷垪绠$悊鍣ㄥ疄鐜般�� + * @param connectionManager + * @return + */ + @Bean + public QueueManager queueManager(ConnectionManager connectionManager + , TcpProperties tcpProperties, ThreadPoolTaskExecutor executor){ + if(tcpProperties.isLoadBalanceEnabled()){ + RocketQueueManager queueManager = new RocketQueueManager(); + queueManager.setConnectionManager(connectionManager); + queueManager.setId(1); + queueManager.setName("鎶ユ枃娑堟伅闃熷垪绠$悊鍣ㄣ�愰泦缇ゃ��"); + queueManager.setExecutor(executor); + queueManager.startup(); + return queueManager; + } else { + MemoryQueueManager queueManager = new MemoryQueueManager(); + queueManager.setConnectionManager(connectionManager); + queueManager.setId(1); + queueManager.setName("鎶ユ枃娑堟伅闃熷垪绠$悊鍣ㄣ�愬唴缃��"); + queueManager.setMaxWorkerThread(1); + queueManager.startup(); // 蹇呴』鍚姩 + return queueManager; + } + } + + private List<ProtocolResolver<?>> acquireProtocolResolverList(){ + List<ProtocolResolver<?>> protocolResolverList = new ArrayList<>(4); + protocolResolverList.add(lineProtocolResolver()); + protocolResolverList.add(platformSharpProtocolResolver()); + return protocolResolverList; + } + + @Bean + public LongHandler tcpServerHandler(QueueManager queueManager + , ConnectionManager connectionManager, TcpProperties tcpProperties){ + logger.debug("...... tcp_scan_packages = {}", tcpProperties.getScanPackagesTcp()); + LongHandler longHandler = new LongHandler(); + longHandler.setEmptyMsgDisconnect(false); + longHandler.setEngineId(EngineType.INDEX_TCP_ENGINE); +// longHandler.setScanPackages("com.walker.tcp,com.iplatform.tcp"); + longHandler.setScanPackages(tcpProperties.getScanPackagesTcp()); + longHandler.setQueueManager(queueManager); + longHandler.setConnectionManager(connectionManager); + longHandler.setProtocolResolverList(this.acquireProtocolResolverList()); + longHandler.setConnectionHost(tcpProperties.getConnectionHost()); + return longHandler; + } + + @Bean + public DefaultLongHandler nettyLongHandler(ConnectionManager connectionManager, LongHandler tcpServerHandler){ + DefaultLongHandler longHandler = new DefaultLongHandler(); + longHandler.setConnectionManager(connectionManager); + longHandler.setTcpServerHandler(tcpServerHandler); + return longHandler; + } + + /** + * 閰嶇疆锛歍CP 鏈嶅姟鍒濆鍖栧櫒銆� + * @param nettyLongHandler + * @return + * @date 2023-04-16 + */ + @Bean + public DefaultServerInitializer nettyServerInitializer(DefaultLongHandler nettyLongHandler, TcpProperties tcpProperties){ + DefaultServerInitializer initializer = new DefaultServerInitializer(); + initializer.setHandler(nettyLongHandler); + initializer.setProtocolResolverList(this.acquireProtocolResolverList()); + initializer.setShowLog(tcpProperties.isShowLog()); +// initializer.setTimeOutAll(); + return initializer; + } + + /** + * 閰嶇疆TCP寮曟搸銆� + * @param nettyServerInitializer + * @param connectionManager + * @return + */ + @Bean + public DefaultLongEngine tcpLongEngine(DefaultServerInitializer nettyServerInitializer + , ConnectionManager connectionManager, TcpProperties tcpProperties + , LoadBalanceProperties loadBalanceProperties){ + DefaultLongEngine longEngine = new DefaultLongEngine(); + longEngine.setId(EngineType.INDEX_TCP_ENGINE); + longEngine.setName("娴嬭瘯TCP闀胯繛鎺ュ紩鎿�"); + longEngine.setServerInitializer(nettyServerInitializer); + longEngine.setConnectionManager(connectionManager); + longEngine.setPort(tcpProperties.getPortTcp()); + longEngine.setBossThreadNum(tcpProperties.getBossThreadNum()); + longEngine.setWorkerThreadNum(tcpProperties.getWorkerThreadNum()); + longEngine.setOpenHeartBeat(tcpProperties.isOpenHeartBeat()); + try { + longEngine.start(); + } catch (Exception e) { + throw new ApplicationRuntimeException("鍚姩'DefaultLongEngine'澶辫触:" + e.getMessage(), e); + } + return longEngine; + } + +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/config/WebsocketConfig.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/config/WebsocketConfig.java new file mode 100644 index 0000000..b313748 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/config/WebsocketConfig.java @@ -0,0 +1,147 @@ +package com.iplatform.tcp.config; + +import com.iplatform.base.config.TcpProperties; +import com.iplatform.core.config.LoadBalanceProperties; +import com.iplatform.tcp.EngineType; +import com.iplatform.tcp.support.TestConnectionCallback; +import com.iplatform.tcp.support.WebSocketPush; +import com.iplatform.tcp.util.ws.LoginAction; +import com.walker.infrastructure.ApplicationRuntimeException; +import com.walker.push.PushManager; +import com.walker.push.Pushable; +import com.walker.queue.QueueManager; +import com.walker.tcp.ConnectionCallback; +import com.walker.tcp.ConnectionManager; +import com.walker.tcp.ProtocolResolver; +import com.walker.tcp.netty.WebSocketEngine; +import com.walker.tcp.netty.WebSocketNettyHandler; +import com.walker.tcp.netty.WebSocketServerInitializer; +import com.walker.tcp.websocket.WebsocketHandler; +import com.walker.tcp.websocket.WebsocketProtocolResolver; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.lang.Nullable; + +import java.util.ArrayList; +import java.util.List; + +@Configuration +@ConditionalOnProperty(prefix = "iplatform.tcp", name = "enabled", havingValue = "true", matchIfMissing = false) +public class WebsocketConfig { + + @Bean + public WebsocketProtocolResolver websocketProtocolResolver(){ + WebsocketProtocolResolver websocketProtocolResolver = new WebsocketProtocolResolver(); + websocketProtocolResolver.setPermitNotRegisterConnect(false); + return websocketProtocolResolver; + } + + private List<ProtocolResolver<?>> acquireProtocolResolverList(){ + List<ProtocolResolver<?>> protocolResolverList = new ArrayList<>(2); + protocolResolverList.add(websocketProtocolResolver()); + return protocolResolverList; + } + + /** + * 閰嶇疆涓氬姟瀹氫箟鐨勫鐞嗘柟娉曞疄鐜般�� + * @param connectionManager + * @param queueManager + * @return + * @date 2023-04-17 + */ + @Bean + public WebsocketHandler wsServerHandler(ConnectionManager connectionManager + , QueueManager queueManager, TcpProperties tcpProperties){ + WebsocketHandler websocketHandler = new WebsocketHandler(); + websocketHandler.setEmptyMsgDisconnect(false); + websocketHandler.setEngineId(EngineType.INDEX_TCP_WEBSOCKET); + websocketHandler.setConnectionManager(connectionManager); + websocketHandler.setQueueManager(queueManager); + websocketHandler.setProtocolResolverList(this.acquireProtocolResolverList()); +// websocketHandler.setScanPackages("com.iplatform.tcp.util.ws"); + websocketHandler.setScanPackages(tcpProperties.getScanPackagesWs()); + // 2023-09-27 + websocketHandler.setConnectionHost(tcpProperties.getConnectionHost()); + return websocketHandler; + } + + @Bean + public WebSocketNettyHandler wsNettyLongHandler(ConnectionManager connectionManager + , WebsocketHandler wsServerHandler, TcpProperties tcpProperties){ + WebSocketNettyHandler webSocketNettyHandler = new WebSocketNettyHandler(); + webSocketNettyHandler.setConnectionManager(connectionManager); + webSocketNettyHandler.setTcpServerHandler(wsServerHandler); + webSocketNettyHandler.setUri(tcpProperties.getWebsocketUri()); + return webSocketNettyHandler; + } + + @Bean + public WebSocketServerInitializer wsServerInitializer(WebSocketNettyHandler wsNettyLongHandler, TcpProperties tcpProperties){ + WebSocketServerInitializer webSocketServerInitializer = new WebSocketServerInitializer(); + webSocketServerInitializer.setHandler(wsNettyLongHandler); + webSocketServerInitializer.setProtocolResolverList(this.acquireProtocolResolverList()); + webSocketServerInitializer.setShowLog(tcpProperties.isShowLog()); + return webSocketServerInitializer; + } + + @Bean + public WebSocketEngine webSocketEngine(ConnectionManager connectionManager + , WebSocketServerInitializer webSocketServerInitializer + , TcpProperties tcpProperties, @Nullable ConnectionCallback connectionCallback + , LoadBalanceProperties loadBalanceProperties){ + WebSocketEngine webSocketEngine = new WebSocketEngine(); + webSocketEngine.setId(EngineType.INDEX_TCP_WEBSOCKET); + webSocketEngine.setName("websocket娴嬭瘯寮曟搸"); + webSocketEngine.setConnectionManager(connectionManager); + webSocketEngine.setServerInitializer(webSocketServerInitializer); + webSocketEngine.setOpenHeartBeat(tcpProperties.isOpenHeartBeat()); + webSocketEngine.setBossThreadNum(tcpProperties.getBossThreadNum()); + webSocketEngine.setWorkerThreadNum(tcpProperties.getWorkerThreadNum()); +// webSocketEngine.setHeartBeatTimeInterval(180000); + webSocketEngine.setHeartBeatTimeInterval(tcpProperties.getHeartBeatSeconds() * 1000); + webSocketEngine.setPort(tcpProperties.getPortWs()); + // 2023-08-25 + if(connectionCallback != null){ + webSocketEngine.setConnectionCallback(connectionCallback); + } else { + webSocketEngine.setConnectionCallback(new TestConnectionCallback()); + } + // 寤舵椂鍚姩锛屾祴璇曠敤銆傛寮忔敞閲婃帀銆�2023-09-27 + webSocketEngine.setEngineStartDelaySeconds(30); + try { + webSocketEngine.start(); + } catch (Exception e) { + throw new ApplicationRuntimeException("鍚姩'WebSocketEngine'澶辫触锛�" + e.getMessage(), e); + } + return webSocketEngine; + } + + /** + * Websocket鐧诲綍璁よ瘉鍔ㄤ綔閰嶇疆 + * @return + * @date 2023-04-17 + */ + @Bean + public LoginAction wsLoginAction(){ + LoginAction loginAction = new LoginAction(); + return loginAction; + } + + /** + * 閰嶇疆'WebSocketPush'鎺ㄩ�佸疄鐜帮紝鍚屾椂娉ㄥ唽鍒扮鐞嗗櫒涓�� + * @param webSocketEngine + * @param pushManager + * @return + * @date 2023-04-21 + */ + @Bean + public Pushable websocketPush(WebSocketEngine webSocketEngine, PushManager pushManager){ + WebSocketPush webSocketPush = new WebSocketPush(); + webSocketPush.setWebSocketEngine(webSocketEngine); + webSocketPush.startup(); + pushManager.register(webSocketPush); + return webSocketPush; + } + +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/controller/ConnectionManagerController.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/controller/ConnectionManagerController.java new file mode 100644 index 0000000..5b9a6d0 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/controller/ConnectionManagerController.java @@ -0,0 +1,42 @@ +package com.iplatform.tcp.controller; + +import com.iplatform.tcp.TcpBaseController; +import com.walker.db.page.GenericPager; +import com.walker.db.page.ListPageContext; +import com.walker.tcp.Connection; +import com.walker.tcp.ConnectionManager; +import com.walker.web.ResponseValue; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@RequestMapping("/tcp/connection") +public class ConnectionManagerController extends TcpBaseController { + + private ConnectionManager connectionManager; + + @Autowired + public ConnectionManagerController(ConnectionManager connectionManager){ + this.connectionManager = connectionManager; + } + + @RequestMapping("/list") + public ResponseValue list(){ + List<Connection> list = this.connectionManager.queryAllConnectionList(); + if(list != null && list.size() > 256){ + logger.warn("TCP杩炴帴杩囧锛屼粎灞曠ず鍓�256涓�"); + } + ListPageContext.setCurrentPageSize(256); + GenericPager<Connection> pager = ListPageContext.createGenericPager(list, 1, list.size()); + return ResponseValue.success(pager); + } + + @RequestMapping("/select/send_test") + public ResponseValue sendTestCommand(){ + + return ResponseValue.success(); + } +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/controller/EquipController.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/controller/EquipController.java new file mode 100644 index 0000000..650b74e --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/controller/EquipController.java @@ -0,0 +1,43 @@ +package com.iplatform.tcp.controller; + +import com.iplatform.model.po.TcpEquip; +import com.iplatform.tcp.TcpBaseController; +import com.iplatform.tcp.pojo.EquipParam; +import com.iplatform.tcp.service.TcpEquipServiceImpl; +import com.walker.db.page.GenericPager; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.tcp.ProtocolResolverPostProcessor; +import com.walker.web.ResponseValue; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; + +@RestController +@RequestMapping("/tcp/equip") +public class EquipController extends TcpBaseController { + + private TcpEquipServiceImpl tcpEquipService; +// private ProtocolResolverPostProcessor protocolResolverPostProcessor; + + @Autowired + public EquipController(TcpEquipServiceImpl tcpEquipService){ + this.tcpEquipService = tcpEquipService; + } + + @RequestMapping("/list") + public ResponseValue list(EquipParam equipParam){ +// PageSearch pageSearch = ListPageContext.getPageSearch(); +// GenericPager<TcpEquip> pager = this.tcpEquipService.selectSplit(new TcpEquip(), pageSearch.getPageIndex(), pageSearch.getPageSize()); + GenericPager<TcpEquip> pager = this.tcpEquipService.selectSplit(new TcpEquip()); + List<TcpEquip> data = pager.getDatas(); + if(!StringUtils.isEmptyList(data)){ + for(TcpEquip e : data){ + e.setParameterString("deptName", this.getDeptName(e.getDept())); + e.setParameterString("protocolResolverName", ProtocolResolverPostProcessor.getProtocolResolver(e.getProtocolResolver()).getName()); + } + } + return ResponseValue.success(pager); + } +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/controller/TestTcpController.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/controller/TestTcpController.java new file mode 100644 index 0000000..3f44612 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/controller/TestTcpController.java @@ -0,0 +1,179 @@ +package com.iplatform.tcp.controller; + +import com.iplatform.base.SystemController; +import com.iplatform.tcp.util.ws.WebBroadCastResponse; +import com.iplatform.tcp.util.ws.WebDataResponse; +import com.walker.infrastructure.utils.DateUtils; +import com.walker.infrastructure.utils.NumberGenerator; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.push.Notification; +import com.walker.push.NotificationChannel; +import com.walker.push.PushManager; +import com.walker.push.PushResult; +import com.walker.tcp.Connection; +import com.walker.tcp.ConnectionManager; +import com.walker.tcp.connect.LongConnection; +import com.walker.tcp.lb.LongConnectionMeta; +import com.walker.tcp.lb.RedisConnectionMetaCache; +import com.walker.tcp.lb.RedisConnectionNameCache; +import com.walker.tcp.netty.WebSocketEngine; +import com.walker.web.ResponseValue; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.lang.Nullable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.*; + +@RestController +@RequestMapping("/test/tcp") +public class TestTcpController extends SystemController { + + private WebSocketEngine webSocketEngine; + private PushManager pushManager; + private RedisConnectionMetaCache connectionMetaCache; + private RedisConnectionNameCache connectionNameCache; + + @Autowired + public TestTcpController(WebSocketEngine webSocketEngine, PushManager pushManager + , @Nullable RedisConnectionMetaCache connectionMetaCache + , @Nullable RedisConnectionNameCache connectionNameCache){ + this.webSocketEngine = webSocketEngine; + this.pushManager = pushManager; + this.connectionMetaCache = connectionMetaCache; + this.connectionNameCache = connectionNameCache; + } + + /** + * 鑾峰彇websocket鍩烘湰鎯呭喌銆� + * @return + * @date 2023-12-14 + */ + @RequestMapping("/ws/info") + public ResponseValue getWebsocketLinkInfo(){ + Map<String, Object> infoMap = new HashMap<>(8); + if(this.connectionNameCache != null){ + long totalWebsocketSize = this.connectionNameCache.getCache().getPersistentSize(); + infoMap.put("total_websocket", totalWebsocketSize); + infoMap.put("create_time", connectionNameCache.getCreateTime()); + infoMap.put("cache_name", this.connectionNameCache.getProviderName()); + } + if(this.connectionMetaCache != null){ + infoMap.put("connection_meta_size", this.connectionMetaCache.getCache().getPersistentSize()); + } + return ResponseValue.success(infoMap); + } + + /** + * 鑾峰彇涓�涓摼鎺ヤ俊鎭�� + * @param userId 杩炴帴缁戝畾鐨勭敤鎴峰悕绉帮紙name锛夛紝涓�鑸负鐢ㄦ埛ID銆� + * @return + * @date 2023-12-14 + */ + @RequestMapping("/ws/connection") + public ResponseValue getWebsocketConnection(String userId){ + if(StringUtils.isEmpty(userId)){ + return ResponseValue.error("userId is required!"); + } + Map<String, Object> infoMap = new HashMap<>(8); + + ConnectionManager connectionManager = this.webSocketEngine.getConnectionManager(); + if(connectionManager != null){ + LongConnection connection = (LongConnection) connectionManager.getConnectionByName(userId); + if(connection == null){ + return ResponseValue.success("杩炴帴涓嶅瓨鍦細" + userId); + } + + if(connection instanceof LongConnectionMeta){ + infoMap.put("type", "闆嗙兢杩炴帴瀵硅薄(LongConnectionMeta)锛屼笉鏄綋鍓嶄富鏈虹墿鐞嗚繛鎺�"); + } + infoMap.put("id", connection.getId()); + infoMap.put("host", connection.getConnectionHost()); + infoMap.put("name", connection.getName()); + infoMap.put("alreadyLogin", connection.getAlreadyLogin()); + infoMap.put("engineId", connection.getEngineId()); + infoMap.put("lastTime", connection.getLastTime()); + } else { + infoMap.put("error", "connectionManager 涓虹┖"); + } + return ResponseValue.success(infoMap); + } + + /** + * 鍚戞墍鏈夐摼鎺ュ箍鎾秷鎭�� + * @param name + * @param uid + * @return + */ + @RequestMapping("/ws/send_broadcast") + public ResponseValue sendTestCommand(String name, String uid){ + WebBroadCastResponse msg = new WebBroadCastResponse(); + msg.setMessageId(String.valueOf(NumberGenerator.getSequenceNumber())); + msg.setName(uid); + msg.setData(name + ": " + msg.getMessageId()); + webSocketEngine.sendBroadcast(msg); + return ResponseValue.success(); + } + + /** + * 鍚戞祻瑙堝櫒锛堢敤鎴凤級鎺ㄩ�佷竴涓獁ebsocket瀹炴椂娑堟伅銆� + * @param userIds + * @return + * @date 2024-01-23 + */ + @RequestMapping("/ws/send") + public ResponseValue sendToUser(String userIds){ + if (StringUtils.isNotEmpty(userIds)){ + String[] split = userIds.split(","); + List<String> ids = Arrays.asList(split); + for (String id : ids) { + Connection connection = this.webSocketEngine.getConnectionManager().getConnectionByName(id); + if (connection!=null){ + WebDataResponse msg = new WebDataResponse(); + msg.setMessageId(NumberGenerator.getLongSequenceId()); + msg.setName(id); // 鎸囧畾鐢ㄦ埛鍙戦�侊紝璇d涓庢祻瑙堝櫒绔敞鍐岀殑id淇濇寔涓�鑷淬�� + msg.setData("鏈夋柊娑堟伅锛岄�熷害鍒锋柊"); + webSocketEngine.sendResponse(msg); + } + } + } + return ResponseValue.success(); + } + + @RequestMapping("/push") + public ResponseValue pushOne(String type, String userId){ + PushResult pushResult = null; + if(type.equals("1")){ + logger.info("鎺ㄩ�佺煭淇℃祴璇曪紝user = 0"); + pushResult = this.pushManager.push(this.acquireNotification(NotificationChannel.Sms, "13838277463"), null); + } else if(type.equals("2")){ + if(StringUtils.isEmpty(userId)){ + userId = "0"; + } + pushResult = this.pushManager.push(this.acquireNotification(NotificationChannel.WebSocket, userId), null); + } else { + throw new UnsupportedOperationException("鏆備笉鏀寔鍏朵粬鎺ㄩ�佹柟寮忥細" + type); + } + return ResponseValue.success(pushResult); + } + + private Notification acquireNotification(NotificationChannel channel, String user){ + Notification n = new Notification(); + n.setId(NumberGenerator.generatorHexUUID()); + n.setCreateTime(DateUtils.getDateTimeNumber()); + n.setCreator("creator"); + n.setFrom("shikeying"); + n.setContent("杩欐槸涓�涓祴璇�"); + + List<NotificationChannel> channels = new ArrayList<>(2); + channels.add(channel); + n.setChannelList(channels); + n.setPersistent(true); + n.setTitle("title"); + + List<String> userList = new ArrayList<>(2); + userList.add(user); + n.setReceiverList(userList); + return n; + } +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/lb/DefaultLbConnectionManager.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/lb/DefaultLbConnectionManager.java new file mode 100644 index 0000000..c270c00 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/lb/DefaultLbConnectionManager.java @@ -0,0 +1,31 @@ +package com.iplatform.tcp.lb; + +import com.walker.tcp.Connection; +import com.walker.tcp.lb.LoadBalanceConnectionManager; +import com.walker.tcp.lb.LongConnectionMeta; + +/** + * 鏀寔闆嗙兢鐨勯暱杩炴帴绠$悊鍣ㄣ�� + * @author 鏃跺厠鑻� + * @date 2023-09-26 + */ +public class DefaultLbConnectionManager extends LoadBalanceConnectionManager { + +// private ResponseWriter responseWriter = new DefaultResponseWriter(); + + @Override + protected LongConnectionMeta acquireConnectionMeta(Connection connection) { + MqConnectionMeta meta = new MqConnectionMeta(connection.getId()); + meta.setEngineId(connection.getEngineId()); + meta.setName(connection.getName()); + meta.setConnectionHost(connection.getConnectionHost()); + meta.setLastTime(connection.getLastTime()); + meta.setAlreadyLogin(connection.getAlreadyLogin()); + meta.setLongConnection(true); +// meta.setProtocolResolver(connection.getProtocolResolver()); + meta.setResponseWriter(this.getResponseWriter()); + logger.debug("鍑嗗鏇存柊锛堜繚瀛樻垨鏇存柊锛変竴涓摼鎺ワ細{}", meta); + return meta; + } + +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/lb/DefaultMqListener.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/lb/DefaultMqListener.java new file mode 100644 index 0000000..1dc09e9 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/lb/DefaultMqListener.java @@ -0,0 +1,96 @@ +package com.iplatform.tcp.lb; + +import com.iplatform.base.Constants; +import com.iplatform.tcp.util.ws.LoginResponse; +import com.iplatform.tcp.util.ws.WebDataResponse; +import com.walker.infrastructure.utils.JsonUtils; +import com.walker.push.rocketmq.EnhanceMessageHandler; +import com.walker.push.rocketmq.tcp.MqResponse; +import com.walker.tcp.Connection; +import com.walker.tcp.ConnectionManager; +import com.walker.tcp.Response; +import com.walker.tcp.lb.LongConnectionMeta; +import org.apache.rocketmq.spring.core.RocketMQListener; + +import java.util.Map; + +/** + * 骞冲彴榛樿鐨凪Q闃熷垪鐩戝惉鍣紝涓氬姟闇�瑕佹牴鎹儏鍐电户鎵胯瀵硅薄锛屽疄鐜拌嚜宸辩殑涓氬姟銆� + * <p>闇�瑕侀噸鍐欐柟娉曪細{@linkplain DefaultMqListener#handleMessage(MqResponse)}</p> + * @author 鏃跺厠鑻� + * @date 2023-09-26 + * @date 2024-01-23 鏃犻渶浣跨敤闆嗙兢妯″紡锛屽崟鏈哄嵆鍙紝MQ涓嶇敤寮�鍚洃鍚�� + */ +//@RocketMQMessageListener(topic = "${iplatform.tcp.connection-host}", consumerGroup = "consumer-group") +//public class DefaultMqListener extends EnhanceMessageHandler<MqResponse> implements RocketMQListener<MqResponse> { +public class DefaultMqListener extends EnhanceMessageHandler<MqResponse> implements RocketMQListener<MqResponse> { + +// protected final transient Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Override + public void onMessage(MqResponse mqResponse) { + this.dispatchMessage(mqResponse); + } + + @Override + protected void handleMessage(MqResponse message) throws Exception { + // 鍏蜂綋鎵ц涓氬姟娑堟伅鏂规硶銆� + // 杩欓噷鑱婂ぉ涓氬姟涓紝闇�瑕佹帹閫佸埌鏈満杩炴帴鐨勫鎴风锛堟垨娴忚鍣級 +// Response<?> response = message.getResponse(); + Response<?> response = this.translateResponse(message.getResponse()); + Connection conn = connectionManager.getConnectionByName(response.getName()); + if(conn == null || !conn.isConnected()){ + logger.debug("mq娑堟伅宸叉帴鏀讹紝浣嗛暱杩炴帴涓嶅瓨鍦ㄦ棤娉曟帹閫侊紝response = {}", response); + return; + } + + if(conn instanceof LongConnectionMeta){ + throw new IllegalStateException("杩欎釜搴旇鏄湰鍦扮墿鐞嗚繛鎺ワ紝浣嗘壘鍒扮殑鏄細LongConnectionMeta锛宯ame=" + response.getName()); + } + conn.write(response); + } + + /** + * 杞崲鎴愬疄闄呭彂閫佺殑涓氬姟鏁版嵁锛屼笟鍔″彲浠ョ户鎵胯绫伙紝骞堕噸鍐欐柟娉曘�� + * @param json + * @return + * @throws Exception + */ + protected Response<?> translateResponse(String json) throws Exception{ + Map<String, Object> responseMap = JsonUtils.jsonStringToObject(json, Map.class); + if(!responseMap.containsKey(KEY_PROTOCOL_NUM)){ + throw new IllegalArgumentException("responseMap涓繀椤诲寘鍚崗璁彿瀛楁:" + KEY_PROTOCOL_NUM); + } + String protocolNum = responseMap.get(KEY_PROTOCOL_NUM).toString(); + if(protocolNum.equals("login")){ + return JsonUtils.jsonStringToObject(json, LoginResponse.class); + } else if(protocolNum.equals(Constants.PUSH_SCOPE_DATA)){ + return JsonUtils.jsonStringToObject(json, WebDataResponse.class); + } else { + throw new UnsupportedOperationException("鏈疄鐜扮殑 websocket.response瀵硅薄杞崲锛�" + json); + } + } + + private final String KEY_PROTOCOL_NUM = "protocolNum"; + + @Override + protected void handleMaxRetriesExceeded(MqResponse message) { + + } + + @Override + protected boolean isRetry() { + return false; + } + + @Override + protected boolean throwException() { + return true; + } + + public void setConnectionManager(ConnectionManager connectionManager) { + this.connectionManager = connectionManager; + } + + private ConnectionManager connectionManager; +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/lb/DefaultResponseWriter.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/lb/DefaultResponseWriter.java new file mode 100644 index 0000000..fad5a49 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/lb/DefaultResponseWriter.java @@ -0,0 +1,51 @@ +package com.iplatform.tcp.lb; + +import com.iplatform.base.PlatformRuntimeException; +import com.iplatform.core.BeanContextAware; +import com.walker.infrastructure.utils.DateUtils; +import com.walker.infrastructure.utils.JsonUtils; +import com.walker.push.rocketmq.RocketMQEnhanceTemplate; +import com.walker.push.rocketmq.tcp.MqResponse; +import com.walker.tcp.Response; +import com.walker.tcp.lb.ResponseWriter; +import com.walker.web.util.IdUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class DefaultResponseWriter implements ResponseWriter { + + private final transient SendStatusCallback callback = new SendStatusCallback(); + + protected final transient Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Override + public Object write(String type, Response<?> response, String connectionHost, String channelId) { + if(type.equals(TYPE_MQ)){ + logger.debug("+++++++++++++++++++++++++"); + BeanContextAware.getBeanByType(RocketMQEnhanceTemplate.class) + .sendAsync(connectionHost, this.acquireMqResponse(response), callback); + if(this.logger.isDebugEnabled()){ + logger.debug("MqConnectionMeta 鍙戦�佷竴涓秷鎭細{}", response); + } + } else { + throw new UnsupportedOperationException("涓嶆敮鎸佺殑 ResponseWriter.type = " + type); + } + return null; + } + + private MqResponse acquireMqResponse(Response<?> response){ + MqResponse data = new MqResponse(); +// data.setResponse(response); + try { + data.setResponse(JsonUtils.objectToJsonString(response)); + } catch (Exception e) { + throw new PlatformRuntimeException("Response<?> --> String 澶辫触锛�" + e.getMessage(), e); + } + data.setKey(IdUtils.fastSimpleUUID()); + data.setRetryTimes(1); + data.setSource(response.getProtocolNum()); + data.setSendTime(DateUtils.getDateTimeNumber()); + data.setTopic(response.getTopic()); + return data; + } +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/lb/MqConnectionMeta.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/lb/MqConnectionMeta.java new file mode 100644 index 0000000..0ebae8c --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/lb/MqConnectionMeta.java @@ -0,0 +1,81 @@ +package com.iplatform.tcp.lb; + +import com.walker.tcp.lb.LongConnectionMeta; + +/** + * 骞冲彴瀹炵幇鐨勯暱杩炴帴鍏冩暟鎹璞°�� + * <pre> + * 1) 璇ュ璞¤〃绀轰竴涓墿鐞嗚繛鎺ョ殑鏄犲皠锛屼細缂撳瓨鍒癛edis涓�� + * 2) 鏈満鑺傜偣鍙兘鑾峰彇鑷繁鐨勯摼璺繛鎺ワ紝骞堕�氳繃杩炴帴鐩存帴鍙戦�佹秷鎭�� + * 3) 杩炴帴鍏冩暟鎹綔鐢ㄦ槸锛屽湪鍏朵粬鑺傜偣涓�氳繃Redis涓褰曠殑杩炴帴鏄犲皠浠Q娑堟伅褰㈠紡鍙戦�佸嚭鍘汇�� + * </pre> + * @author 鏃跺厠鑻� + * @date 2023-09-26 + */ +public class MqConnectionMeta extends LongConnectionMeta { + +// private final transient SendStatusCallback callback = new SendStatusCallback(); + + public MqConnectionMeta(){} + + public MqConnectionMeta(String id) { + super(id); + } + +// @JsonIgnore +// @Override +// public void write(Response<?> response) { +// // 閫氳繃MQ鍙戦�佹秷鎭埌鐩爣涓绘満锛岃鐩爣灏辨槸褰撳墠杩炴帴缁戝畾鐨勪富鏈烘爣璇嗐�� +// // 鏆傛椂浣跨敤寮傛浠诲姟鍙戦�侊紝2023-09-26 +// // 杩欓噷鍙戦�佺殑涓婚灏辨槸鍏ㄥ眬杩炴帴瀵瑰簲鐨勪富鏈轰俊鎭細 +//// BeanContextAware.getBeanByType(RocketMQEnhanceTemplate.class) +//// .sendAsync(response.getTopic(), this.acquireMqResponse(response), callback); +// logger.info("+++++++++++++++++++++++++"); +// BeanContextAware.getBeanByType(RocketMQEnhanceTemplate.class) +// .sendAsync(this.getConnectionHost(), this.acquireMqResponse(response), callback); +// if(this.logger.isDebugEnabled()){ +// logger.debug("MqConnectionMeta 鍙戦�佷竴涓秷鎭細{}", response); +// } +// } + +// @Override +// protected void onWrite(Response<?> response){ +// logger.info("+++++++++++++++++++++++++"); +// BeanContextAware.getBeanByType(RocketMQEnhanceTemplate.class) +// .sendAsync(this.getConnectionHost(), this.acquireMqResponse(response), callback); +// if(this.logger.isDebugEnabled()){ +// logger.debug("MqConnectionMeta 鍙戦�佷竴涓秷鎭細{}", response); +// } +// } + +// private MqResponse acquireMqResponse(Response<?> response){ +// MqResponse data = new MqResponse(); +// data.setResponse(response); +// data.setKey(IdUtils.fastSimpleUUID()); +// data.setRetryTimes(1); +// data.setSource(response.getProtocolNum()); +// data.setSendTime(DateUtils.getDateTimeNumber()); +// data.setTopic(response.getTopic()); +// return data; +// } + + @Override + public void disconnect() { + // nothing; + } + + @Override + public boolean isConnected() { + return true; + } + + @Override + public String toString(){ + return new StringBuilder("MqConnectionMeta{id=").append(this.getId()) + .append(", alreadyLogin=").append(this.getAlreadyLogin()) + .append(", host=").append(this.getConnectionHost()) + .append(", name=").append(this.getName()) + .append(", lastTime=").append(this.getLastTime()) + .append("}").toString(); + } +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/lb/MqResponseUtils.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/lb/MqResponseUtils.java new file mode 100644 index 0000000..d17bbb8 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/lb/MqResponseUtils.java @@ -0,0 +1,18 @@ +package com.iplatform.tcp.lb; + +import com.walker.push.rocketmq.tcp.MqResponse; + +import java.util.Map; + +public class MqResponseUtils { + + public static final MqResponse acquireMqResponse(Map<String, Object> map){ + int retryTimes = Integer.parseInt(map.get("retryTimes").toString()); + MqResponse mqResponse = new MqResponse(); + mqResponse.setRetryTimes(retryTimes); + mqResponse.setKey(map.get("key").toString()); + mqResponse.setSource(map.get("source").toString()); + mqResponse.setTopic(map.get("topic") != null? map.get("topic").toString() : ""); + return mqResponse; + } +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/lb/SendStatusCallback.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/lb/SendStatusCallback.java new file mode 100644 index 0000000..3c25d18 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/lb/SendStatusCallback.java @@ -0,0 +1,26 @@ +package com.iplatform.tcp.lb; + +import org.apache.rocketmq.client.producer.SendCallback; +import org.apache.rocketmq.client.producer.SendResult; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 娑堟伅鍙戦�佸洖璋冨畾涔夈�� + * <p>鏆傛椂杩樹笉鐭ラ亾濡備綍浣跨敤锛堝湪鍝釜鍦版柟浣跨敤锛�</p> + * @date 2023-09-26 + */ +public class SendStatusCallback implements SendCallback { + + protected final transient Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Override + public void onSuccess(SendResult sendResult) { + logger.debug("娑堟伅鍙戦�佹垚鍔燂細{}", sendResult.getMsgId()); + } + + @Override + public void onException(Throwable throwable) { + logger.error("娑堟伅鍙戦�佸け璐ワ細", throwable); + } +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/lb/SimpleMqListener.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/lb/SimpleMqListener.java new file mode 100644 index 0000000..d31fdb7 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/lb/SimpleMqListener.java @@ -0,0 +1,144 @@ +package com.iplatform.tcp.lb; + +import com.iplatform.base.Constants; +import com.iplatform.base.PlatformRuntimeException; +import com.iplatform.tcp.util.ws.LoginResponse; +import com.iplatform.tcp.util.ws.WebDataResponse; +import com.walker.infrastructure.utils.JsonUtils; +import com.walker.push.rocketmq.tcp.MqResponse; +import com.walker.tcp.Connection; +import com.walker.tcp.ConnectionManager; +import com.walker.tcp.Response; +import com.walker.tcp.lb.LongConnectionMeta; +import org.apache.rocketmq.spring.annotation.RocketMQMessageListener; +import org.apache.rocketmq.spring.core.RocketMQListener; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Map; + +/** + * MQ娑堟伅鐩戝惉鎺ユ敹澶勭悊銆� + * <pre> + * 1) consumerGroup锛氭秷璐硅�呯粍锛岃繖涓槸閽堝鍚屼竴涓富棰樺拰Tag銆� + * 璧勬枡浠嬬粛: + * A.涓�涓秷璐硅�呯粍锛屼唬琛ㄧ潃涓�缇opic鐩稿悓锛宼ag鐩稿悓锛堝嵆閫昏緫鐩稿悓锛夌殑Consumer銆傞�氳繃涓�涓秷璐硅�呯粍锛屽垯鍙鏄撶殑杩涜璐熻浇鍧囪 浠ュ強瀹归敊 + * B.浣跨敤鏃讹紝涓�涓妭鐐逛笅锛屼竴涓猼opic鍔犱竴涓猼ag鍙互瀵瑰簲涓�涓猚onsumer銆備竴涓秷璐硅�呯粍灏辨槸妯悜涓婂涓妭鐐圭殑鐩稿悓consumer涓轰竴涓秷璐圭粍銆� + * </pre> + * @date 2023-10-07 淇敼娑堣垂鑰呯粍锛屽皾璇曡В鍐冲涓槦鍒楁秷鎭棤娉曟帴鏀堕棶棰樸�� + * @date 2023-12-14 鐩戝惉瀵硅薄鏀惧湪涓氬姟涓鐞嗭紝骞冲彴娉ㄩ噴璇ュ璞★紝涓氬姟閫氳繃MQ鎺ユ敹鍏朵粬鑺傜偣鍙戦�佺殑鑱婂ぉ娑堟伅銆傚鏋滆娴嬭瘯锛岃鎵撳紑娉ㄨВ銆傦紙鏍囨敞搴熷純鏄负浜嗗紩璧锋敞鎰忥紒锛� + */ +//@RocketMQMessageListener(topic = "${iplatform.tcp.connection-host}", selectorExpression = "*", consumerGroup = "${iplatform.tcp.connection-host}-consumer-group") +@Deprecated +public class SimpleMqListener implements RocketMQListener<String> { + + protected final transient Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Override + public void onMessage(String s) { + logger.debug("mq = {}", s); +// MqResponse mqResponse = null; + Map<String, Object> mqResponse = null; + try { +// mqResponse = JsonUtils.jsonStringToObject(s, MqResponse.class); + mqResponse = JsonUtils.jsonStringToObject(s, Map.class); + } catch (Exception e) { + throw new PlatformRuntimeException("mq娑堟伅杞崲json瀵硅薄澶辫触:" + e.getMessage(), e); + } + + MqResponse message = MqResponseUtils.acquireMqResponse(mqResponse); + + // 瓒呰繃鏈�澶ч噸璇曟鏁版椂璋冪敤瀛愮被鏂规硶澶勭悊 + if (message.getRetryTimes() > getMaxRetryTimes()) { + handleMaxRetriesExceeded(message); + return; + } + + Response<?> response = null; + try { + response = this.translateResponse(mqResponse.get("response").toString()); + } catch (Exception e) { + throw new PlatformRuntimeException("杞崲鎴�'Response'澶辫触锛�" + e.getMessage(), e); + } + + try { + long now = System.currentTimeMillis(); +// handleMessage(message); + Connection conn = connectionManager.getConnectionByName(response.getName()); + if(conn == null || !conn.isConnected()){ + logger.debug("mq娑堟伅宸叉帴鏀讹紝浣嗛暱杩炴帴涓嶅瓨鍦ㄦ棤娉曟帹閫侊紝response = {}", response); + return; + } + + if(conn instanceof LongConnectionMeta){ + throw new IllegalStateException("杩欎釜搴旇鏄湰鍦扮墿鐞嗚繛鎺ワ紝浣嗘壘鍒扮殑鏄細LongConnectionMeta锛宯ame=" + response.getName()); + } + conn.write(response); + + long costTime = System.currentTimeMillis() - now; + logger.debug("娑堟伅{}娑堣垂鎴愬姛锛岃�楁椂[{}ms]", message.getKey(), costTime); + + } catch (Exception e) { + logger.error("娑堟伅{}娑堣垂寮傚父", message.getKey(),e); + // 鏄崟鑾峰紓甯歌繕鏄姏鍑猴紝鐢卞瓙绫诲喅瀹� + if (throwException()) { + //鎶涘嚭寮傚父锛岀敱DefaultMessageListenerConcurrently绫诲鐞� + throw new RuntimeException(e); + } + //姝ゆ椂濡傛灉涓嶅紑鍚噸璇曟満鍒讹紝鍒欓粯璁CK浜� +// if (isRetry()) { +// handleRetry(message); +// } + } + } + + /** + * 杞崲鎴愬疄闄呭彂閫佺殑涓氬姟鏁版嵁锛屼笟鍔″彲浠ョ户鎵胯绫伙紝骞堕噸鍐欐柟娉曘�� + * @param json + * @return + * @throws Exception + */ + protected Response<?> translateResponse(String json) throws Exception{ + Map<String, Object> responseMap = JsonUtils.jsonStringToObject(json, Map.class); + if(!responseMap.containsKey(KEY_PROTOCOL_NUM)){ + throw new IllegalArgumentException("responseMap涓繀椤诲寘鍚崗璁彿瀛楁:" + KEY_PROTOCOL_NUM); + } + String protocolNum = responseMap.get(KEY_PROTOCOL_NUM).toString(); + if(protocolNum.equals("login")){ + return JsonUtils.jsonStringToObject(json, LoginResponse.class); + } else if(protocolNum.equals(Constants.PUSH_SCOPE_DATA)){ + return JsonUtils.jsonStringToObject(json, WebDataResponse.class); + } else { + throw new UnsupportedOperationException("鏈疄鐜扮殑 websocket.response瀵硅薄杞崲锛�" + json); + } + } + + protected void handleMaxRetriesExceeded(MqResponse message) { + + } + + protected boolean throwException() { + return true; + } + + /** + * 鏈�澶ч噸璇曟鏁� + * + * @return 鏈�澶ч噸璇曟鏁帮紝榛樿5娆� + */ + protected int getMaxRetryTimes() { + return MAX_RETRY_TIMES; + } + + /** + * 榛樿閲嶈瘯娆℃暟 + */ + private static final int MAX_RETRY_TIMES = 3; + + public void setConnectionManager(ConnectionManager connectionManager) { + this.connectionManager = connectionManager; + } + + private ConnectionManager connectionManager; + private final String KEY_PROTOCOL_NUM = "protocolNum"; +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/pojo/EquipParam.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/pojo/EquipParam.java new file mode 100644 index 0000000..c4c2496 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/pojo/EquipParam.java @@ -0,0 +1,16 @@ +package com.iplatform.tcp.pojo; + +import com.walker.web.param.ParamRequest; + +public class EquipParam extends ParamRequest { + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + private String name; +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/service/TcpEquipServiceImpl.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/service/TcpEquipServiceImpl.java new file mode 100644 index 0000000..7eb771d --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/service/TcpEquipServiceImpl.java @@ -0,0 +1,9 @@ +package com.iplatform.tcp.service; + +import com.walker.jdbc.service.BaseServiceImpl; +import org.springframework.stereotype.Service; + +@Service +public class TcpEquipServiceImpl extends BaseServiceImpl { + +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/service/TcpEquipStatusServiceImpl.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/service/TcpEquipStatusServiceImpl.java new file mode 100644 index 0000000..101b3e6 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/service/TcpEquipStatusServiceImpl.java @@ -0,0 +1,8 @@ +package com.iplatform.tcp.service; + +import com.walker.jdbc.service.BaseServiceImpl; +import org.springframework.stereotype.Service; + +@Service +public class TcpEquipStatusServiceImpl extends BaseServiceImpl { +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/support/PersistentConnectionManager.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/support/PersistentConnectionManager.java new file mode 100644 index 0000000..7453878 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/support/PersistentConnectionManager.java @@ -0,0 +1,133 @@ +package com.iplatform.tcp.support; + +import com.iplatform.model.po.TcpEquip; +import com.iplatform.model.po.TcpEquipStatus; +import com.iplatform.tcp.EngineType; +import com.iplatform.tcp.EquipmentCacheProvider; +import com.iplatform.tcp.EquipmentStatusCacheProvider; +import com.iplatform.tcp.LiveStatus; +import com.iplatform.tcp.service.TcpEquipStatusServiceImpl; +import com.walker.infrastructure.utils.DateUtils; +import com.walker.infrastructure.utils.NumberGenerator; +import com.walker.tcp.Connection; +import com.walker.tcp.support.SimpleEngineConnectionManager; + +/** + * 鍙寔涔呭寲瀛樺偍杩炴帴鐘舵�佺殑杩炴帴绠$悊鍣ㄥ疄鐜般�� + * @author 鏃跺厠鑻� + * @date 2018-11-29 + * + */ +public class PersistentConnectionManager extends SimpleEngineConnectionManager { + + public void setWebsocketPersistent(boolean websocketPersistent) { + this.websocketPersistent = websocketPersistent; + } + + private boolean websocketPersistent = false; + + @Override + protected void onSaveConnection(Connection connection) throws Exception { + if(connection.getEngineId() == EngineType.INDEX_TCP_WEBSOCKET && !this.websocketPersistent){ + // websocket杩炴帴涓嶉渶瑕佹寔涔呭寲 + return; + } + logger.debug("淇濆瓨浜嗕竴涓繛鎺ワ細" + connection.getName()); + String num = connection.getName(); + TcpEquipStatus cacheStatus = statusCache.getEquipmentStatus(num); + if(cacheStatus == null){ + // 鏁版嵁搴撹繕娌℃湁鐘舵�佽褰� + TcpEquipStatus newStatus = this.createStatus(connection, num); + this.tcpEquipStatusService.insert(newStatus); + statusCache.putEquipmentStatus(num, newStatus); + + } else { + // 宸茬粡瀛樺湪璁板綍锛堟洿鏂扮紦瀛樻暟鎹紝骞朵篃鏇存柊status琛級 + cacheStatus.setStartTime(Long.parseLong(DateUtils.getDateTimeSecondForShow(System.currentTimeMillis()))); + cacheStatus.setLiveStatus(LiveStatus.CONST_CONNECTED); + this.tcpEquipStatusService.save(cacheStatus); +// statusCache.updateCacheData(num, cacheStatus); + } + + this.afterSaveConnection(cacheStatus); + } + + private TcpEquipStatus createStatus(Connection connection, String num){ + TcpEquip equip = this.getEquipmentFromCache(num); + TcpEquipStatus entity = new TcpEquipStatus(); + entity.setCreateTime(NumberGenerator.getSequenceNumber()); + entity.setEquipNum(num); + entity.setId(NumberGenerator.getLongSequenceNumber()); + entity.setLiveStatus(LiveStatus.CONST_CONNECTED); + entity.setStartTime(Long.parseLong(DateUtils.getDateTimeSecondForShow(connection.getCreateTimeMills()))); + if(equip == null){ + // 娌℃湁娉ㄥ唽璁惧锛屼絾浠嶅厑璁镐笂鎶ユ暟鎹� + entity.setEquipId(0L); + entity.setDept(0L); + } else { + entity.setEquipId(equip.getId()); + entity.setDept(equip.getDept()); + } + return entity; + } + + private TcpEquip getEquipmentFromCache(String num){ + return equipCache.getEquipment(num); + } + + @Override + protected void onDeleteConnection(int engineId, String name) throws Exception { + if(engineId == EngineType.INDEX_TCP_WEBSOCKET && !this.websocketPersistent){ + // websocket杩炴帴涓嶉渶瑕佹寔涔呭寲 + return; + } + logger.debug("鍒犻櫎浜嗕竴涓繛鎺ワ細" + name); + TcpEquipStatus cacheStatus = statusCache.getEquipmentStatus(name); + cacheStatus.setEndTime(Long.parseLong(DateUtils.getDateTimeSecondForShow(System.currentTimeMillis()))); + cacheStatus.setLiveStatus(LiveStatus.CONST_NOT_CONNECT); + this.tcpEquipStatusService.save(cacheStatus); + + this.afterDeleteConnection(cacheStatus); + } + + @Override + protected void onUpdateLastTime(int engineId, String name, long lastTime) throws Exception { + logger.debug("鏇存柊浜嗕竴涓繛鎺ワ細" + name); + } + + /** + * 淇濆瓨杩炴帴涔嬪悗鍔ㄤ綔锛岀敱瀛愮被瀹炵幇銆傜洰鍓嶄负websocket鎺ㄩ�佸仛鍑嗗 + * @param cacheStatus + */ + protected void afterSaveConnection(TcpEquipStatus cacheStatus){ +// OnlineResponse response = new OnlineResponse(); +// response.setName(cacheStatus.getEquipNum()); +// this.webSocketEngine.sendBroadcast(response); + } + + /** + * 璁惧鏂紑杩炴帴涔嬪悗鍔ㄤ綔锛岀敱瀛愮被瀹炵幇銆傜洰鍓嶄负websocket鎺ㄩ�佸仛鍑嗗 + * @param cacheStatus + */ + protected void afterDeleteConnection(TcpEquipStatus cacheStatus){ +// OfflineResponse response = new OfflineResponse(); +// response.setName(cacheStatus.getEquipNum()); +// this.webSocketEngine.sendBroadcast(response); + } + + public void setStatusCache(EquipmentStatusCacheProvider statusCache) { + this.statusCache = statusCache; + } + + public void setEquipCache(EquipmentCacheProvider equipCache) { + this.equipCache = equipCache; + } + + public void setTcpEquipStatusService(TcpEquipStatusServiceImpl tcpEquipStatusService) { + this.tcpEquipStatusService = tcpEquipStatusService; + } + + private EquipmentStatusCacheProvider statusCache; + private EquipmentCacheProvider equipCache; + private TcpEquipStatusServiceImpl tcpEquipStatusService; +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/support/PlatformSharpProtocolResolver.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/support/PlatformSharpProtocolResolver.java new file mode 100644 index 0000000..65728d4 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/support/PlatformSharpProtocolResolver.java @@ -0,0 +1,55 @@ +package com.iplatform.tcp.support; + +import com.walker.tcp.littleD.Constants; +import com.walker.tcp.littleD.LittleDProtocolResolver; + +/** + * 骞冲彴TCP閫氫俊鍗忚瑙f瀽鍣ㄥ疄鐜般�� + * <p>娌跨敤灏廌鏅鸿兘缁堢鍗忚瑙勮寖锛�#涓虹粨鏉熸爣蹇楋紝鍓嶇紑鍙慨鏀癸紙2浣嶏級锛屽崗璁紪鍙�4浣�</p> + * @author 鏃跺厠鑻� + * @date 2023-04-17 + */ +public class PlatformSharpProtocolResolver extends LittleDProtocolResolver { + + public PlatformSharpProtocolResolver(){ + this.setDelimiter(Constants.DATA_END_FLAG); + this.setProtocolFeature(Constants.BODY_ID); + this.setName("骞冲彴閫氫俊瑙f瀽鍣�"); + this.setOrder(1); + } + +// @Override +// protected String onResolve(String data, int size) throws ProtocolException { +// if(size < 6){ +// throw new ProtocolException(ERR_PROTOCOL_SIZE); +// } +// +// if(!source.startsWith(this.getProtocolFeature().toString())){ +// throw new ProtocolException(ERR_PROTOCOL_FEATURE); +// } +// return source.substring(2, 6); +// } +// @Override +// protected Response<?> doCreateOneResponse() { +// // 杩斿洖蹇冭烦鍝嶅簲 +// return new HeartBeatResponse(); +// } +// @Override +// public String getAuthenticateInfo(Request<?> request) throws AuthenticateException { +// if(request instanceof LoginRequest){ +// String clientId = request.getName(); +// if(StringUtils.isEmpty(clientId)){ +// throw new AuthenticateException("璇锋眰淇℃伅涓笉瀛樺湪璁惧ID鍙凤紝鏃犳硶璁よ瘉"); +// } +// +// if(!isPermitNotRegisterConnect() && !this.isRegistered(clientId)){ +// throw new AuthenticateException("璁惧鏈湪鍒楄〃涓敞鍐岋紝鏃犳硶璁よ瘉銆俢lientId = " + clientId); +// } +// return clientId; +// +// } else { +// throw new AuthenticateException("connection閫氶亾璁よ瘉澶辫触锛岃姹備笉鏄櫥褰�"); +// } +// } + +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/support/TestConnectionCallback.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/support/TestConnectionCallback.java new file mode 100644 index 0000000..ef4a271 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/support/TestConnectionCallback.java @@ -0,0 +1,32 @@ +package com.iplatform.tcp.support; + +import com.walker.tcp.Connection; +import com.walker.tcp.ConnectionCallback; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 娴嬭瘯 Tcp 鎴� Websocket 杩炴帴鍥炶皟瀹炵幇銆� + * @author 鏃跺厠鑻� + * @date 2023-08-26 + */ +public class TestConnectionCallback implements ConnectionCallback { + + private final transient Logger logger = LoggerFactory.getLogger(getClass()); + + @Override + public void onIdle(Connection connection) { + + } + + @Override + public void onAfterLogin(Connection connection) { + logger.info("杩炴帴璁よ瘉鎴愬姛锛屽凡鍙戦�佺櫥褰曞搷搴旓紝杩欓噷鍙互鐩存帴鍐嶆鍙戦�佷笟鍔℃秷鎭��"); +// String userId = connection.getName(); +// // 鐢ㄦ埛鏄惁锛岄棬鎴峰墠绔敤鎴凤紵 +// boolean isFrontUser = false; +// if(isFrontUser){ +// connection.write(Response); +// } + } +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/support/WebSocketPush.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/support/WebSocketPush.java new file mode 100644 index 0000000..7e92335 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/support/WebSocketPush.java @@ -0,0 +1,131 @@ +package com.iplatform.tcp.support; + +import com.iplatform.tcp.util.ws.WebBroadCastResponse; +import com.iplatform.tcp.util.ws.WebDataResponse; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.push.AbstractPushObject; +import com.walker.push.Notification; +import com.walker.push.NotificationChannel; +import com.walker.push.PushException; +import com.walker.push.PushResult; +import com.walker.push.util.PushUtils; +import com.walker.tcp.netty.WebSocketEngine; + +import java.util.ArrayList; +import java.util.List; + +/** + * WebSocket鏂瑰紡瀹炵幇鐨勬帹閫佸璞°�� + * @author 鏃跺厠鑻� + * @date 2023-04-21 + */ +public class WebSocketPush extends AbstractPushObject<WebBroadCastResponse> { + + public WebSocketPush(){ + this.setId(NotificationChannel.WebSocket.getIndex()); + this.setName(NotificationChannel.WebSocket.getName() + "鎺ㄩ��"); + } + + @Override + protected PushResult doPushContent(Notification notification, List<WebBroadCastResponse> data) throws PushException { + PushResult pushResult = PushUtils.acquireSuccessPushResult(); + String error = null; + for(WebBroadCastResponse response : data){ + if(notification.getBroadcast()){ + webSocketEngine.sendBroadcast(response); + logger.debug("websocket骞挎挱鐩存帴鍙戦�侊紝娌℃湁鐘舵��"); + return pushResult; + } + + error = this.webSocketEngine.sendResponse(response); + + if(StringUtils.isNotEmpty(error)){ + if(pushResult.getCode() == 0){ + pushResult.setCode(-1); + } + // 杩欓噷鏃犻渶杞崲鐢ㄦ埛淇℃伅锛屽洜涓轰娇鐢ㄧ殑灏辨槸userId锛屼竴鑷寸殑! + pushResult.addOneFailed(response.getName()); + } + } + return pushResult; + } + +// @Override +// protected PushResult doPushContent(Notification notification) throws PushException { +// if(notification.getBroadcast()){ +// logger.debug("websocket鎺ㄩ�佸箍鎾�"); +// +// WebBroadCastResponse msg = new WebBroadCastResponse(); +// msg.setMessageId(String.valueOf(NumberGenerator.getSequenceNumber())); +// msg.setData(notification.getContent()); +// webSocketEngine.sendBroadcast(msg); +// return PushUtils.acquireSuccessPushResult(); +// } +// +// // 鏅�氭帹閫佹秷鎭� +// PushResult pushResult = new PushResult(); +// WebDataResponse response = null; +// String error = null; +// +// List<String> receiverList = notification.getReceiverList(); +// for(String user : receiverList){ +// response = new WebDataResponse(); +// response.setMessageId(String.valueOf(NumberGenerator.getSequenceNumber())); +// response.setData(notification.getContent()); +// response.setName(user); // websocket鐢ㄦ埛鏍囪瘑涓猴細userId +// error = this.webSocketEngine.sendResponse(response); +// +// if(StringUtils.isNotEmpty(error)){ +// if(pushResult.getCode() == 0){ +// pushResult.setCode(-1); +// } +// pushResult.addOneFailed(user); +// } +// } +// return pushResult; +// } + + @Override + public NotificationChannel getNotificationChannel() { + return NotificationChannel.WebSocket; + } + + @Override + public List<WebBroadCastResponse> translateToTarget(Notification notification) { + + List<WebBroadCastResponse> data = new ArrayList<>(2); + WebBroadCastResponse webBroadCastResponse = null; + + if(notification.getBroadcast()){ + logger.debug("websocket鎺ㄩ�佸箍鎾�"); + webBroadCastResponse = new WebBroadCastResponse(); + webBroadCastResponse.setMessageId(notification.getId()); + webBroadCastResponse.setData(notification.getContent()); + data.add(webBroadCastResponse); + return data; + } + + // 闈炲箍鎾紝鍒欓渶瑕佹妸鎵�鏈夋帴鏀朵汉闆嗗悎杩斿洖 + int i = 1; + for(String user: notification.getReceiverList()){ + webBroadCastResponse = new WebDataResponse(); + webBroadCastResponse.setMessageId(notification.getId() + i); + webBroadCastResponse.setData(notification.getContent()); + webBroadCastResponse.setName(user); // websocket鐢ㄦ埛鏍囪瘑涓猴細userId + data.add(webBroadCastResponse); + i++; + } + return data; + } + + @Override + public void startup() { + + } + + public void setWebSocketEngine(WebSocketEngine webSocketEngine) { + this.webSocketEngine = webSocketEngine; + } + + private WebSocketEngine webSocketEngine; +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/LocationNowAction.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/LocationNowAction.java new file mode 100644 index 0000000..28b55e8 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/LocationNowAction.java @@ -0,0 +1,28 @@ +package com.iplatform.tcp.util; + +import com.walker.tcp.Request; +import com.walker.tcp.Response; +import com.walker.tcp.support.AbstractActionCall; + +/** + * 鎸囦护涓嬪彂璇锋眰澶勭悊鍣紝缁堢鎺ュ埌鎸囦护鍚庯紝浼氬彂璧风‘璁よ姹傦紝绯荤粺浼氳皟鐢ㄨ鎺ュ彛銆�</p> + * 璇ュ鐞嗗櫒瀵瑰簲鍔熻兘锛氱珛鍗冲畾浣嶆寚浠� + * @author 鏃跺厠鑻� + * @date 2018-08-22 + * @date 2023-04-17 绉绘杩囨潵锛岀敤浜庢紨绀虹敤娉曘�� + */ +//@Component +public class LocationNowAction extends AbstractActionCall { + + @Override + public Response<?> action(Request<?> request) { + logger.info("鎺ユ敹鍒版寚浠や笅鍙戝悗鐨勶紝纭璇锋眰锛屼笉闇�瑕佸搷搴斻�傝姹備俊鎭� = " + request); + // 鍙互鍐嶆鏇存柊涓氬姟鐘舵�侊紝鎴栬�呭鐞嗚嚜宸辩殑鍟嗕笟杩囩▼ + return null; + } + + @Override + public String getRequestProtocol() { + return "AP16"; + } +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/LoginAction.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/LoginAction.java new file mode 100644 index 0000000..2953093 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/LoginAction.java @@ -0,0 +1,29 @@ +package com.iplatform.tcp.util.ws; + +import com.walker.tcp.Request; +import com.walker.tcp.Response; +import com.walker.tcp.support.AbstractActionCall; + +/** + * websocket鐧诲綍璁よ瘉璇锋眰澶勭悊鍣� + * @author 鏃跺厠鑻� + * @date 2019-01-10 + * + */ +public class LoginAction extends AbstractActionCall { + + @Override + public Response<?> action(Request<?> request) { + logger.debug("鎺ユ敹鍒扮敤鎴穡ebsocket鐧诲綍璇锋眰锛�" + request.getName()); + LoginResponse response = new LoginResponse(); + response.setName(request.getName()); + response.setStatus(0); + logger.debug(response.toString()); + return response; + } + + @Override + public String getRequestProtocol() { + return "login"; + } +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/LoginRequest.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/LoginRequest.java new file mode 100644 index 0000000..6abdac4 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/LoginRequest.java @@ -0,0 +1,34 @@ +package com.iplatform.tcp.util.ws; + +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.walker.infrastructure.utils.JsonUtils; +import com.walker.tcp.TcpRequest; +import com.walker.tcp.data.AbstractStringRequest; +import com.walker.tcp.util.WebSocketUtils; + +@TcpRequest("login") +public class LoginRequest extends AbstractStringRequest { + + /** + * + */ + private static final long serialVersionUID = 8346500913809847710L; + + @Override + protected void translateData(String source) { +// JSONObject json = JSONObject.parseObject(source); +// this.setName(json.getString(WebSocketUtils.WEB_SOCKET_KEY_UID)); + ObjectNode json = null; + try { + json = JsonUtils.jsonStringToObjectNode(source); + this.setName(json.get(WebSocketUtils.WEB_SOCKET_KEY_UID).asText()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + @Override + public String getProtocolNum() { + return "login"; + } +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/LoginResponse.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/LoginResponse.java new file mode 100644 index 0000000..9b9381f --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/LoginResponse.java @@ -0,0 +1,43 @@ +package com.iplatform.tcp.util.ws; + +import com.walker.tcp.websocket.JsonResponse; + +import java.util.Map; + +public class LoginResponse extends JsonResponse { + + /** + * + */ + private static final long serialVersionUID = 1167352207355638142L; + + private int status = 0; + + public void setStatus(int status) { + this.status = status; + } + +// @Override +// protected void translateProperties(JSONObject result) { +// result.put("status", status); +// } + + @Override + public String getProtocolNum() { + return "login"; + } + + @Override + protected void translateProperties(Map<String, Object> result) { + result.put("status", status); + } + + @Override + public String toString(){ + return new StringBuilder("[protocol=").append(this.getProtocolNum()) + .append(", name=").append(this.getName()) + .append(", messageId=").append(this.getMessageId()) + .append(", status=").append(this.status) + .append("]").toString(); + } +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/OfflineResponse.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/OfflineResponse.java new file mode 100644 index 0000000..ff77d28 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/OfflineResponse.java @@ -0,0 +1,29 @@ +package com.iplatform.tcp.util.ws; + +import com.walker.tcp.websocket.JsonResponse; + +import java.util.Map; + +/** + * 璁惧绂荤嚎鍚庯紝鎺ㄩ�佺粰websocket鐨勫搷搴斿璞″畾涔� + * @author 鏃跺厠鑻� + * @date 2019-01-10 + * + */ +public class OfflineResponse extends JsonResponse { + + /** + * + */ + private static final long serialVersionUID = -4170534196705654880L; + + @Override + protected void translateProperties(Map<String, Object> result) { + result.put("name", this.getName()); + } + + @Override + public String getProtocolNum() { + return "equip_offline"; + } +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/OnlineResponse.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/OnlineResponse.java new file mode 100644 index 0000000..104c535 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/OnlineResponse.java @@ -0,0 +1,29 @@ +package com.iplatform.tcp.util.ws; + +import com.walker.tcp.websocket.JsonResponse; + +import java.util.Map; + +/** + * 璁惧绂荤嚎鍚庯紝鎺ㄩ�佺粰websocket鐨勫搷搴斿璞″畾涔� + * @author 鏃跺厠鑻� + * @date 2019-01-10 + * + */ +public class OnlineResponse extends JsonResponse { + + /** + * + */ + private static final long serialVersionUID = -4170534196705654880L; + + @Override + protected void translateProperties(Map<String, Object> result) { + result.put("name", this.getName()); + } + + @Override + public String getProtocolNum() { + return "equip_online"; + } +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/StepTimeFilter.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/StepTimeFilter.java new file mode 100644 index 0000000..2427a06 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/StepTimeFilter.java @@ -0,0 +1,32 @@ +package com.iplatform.tcp.util.ws; + +import java.util.concurrent.TimeUnit; + +import com.walker.tcp.Context; +import com.walker.tcp.filter.DefaultFilter; + +/** + * 璁╂帴鏀舵暟鎹湁瑙勫緥闂撮殧鐨勶紝杩囨护鍣ㄥ疄鐜� + * @author Administrator + * + */ +public class StepTimeFilter extends DefaultFilter { + + @Override + public boolean doFilter(Context context) throws Exception { +// long spanTime = context.getPreviousTimeSpan(); +// if(context.getPreviousData() != null && spanTime != 0){ +// long span = Math.abs(spanTime - 600); +// TimeUnit.MILLISECONDS.sleep(span); +// logger.debug("~~~~~~~~~~~~~~杩囨护鍣ㄦ墽琛屼竴娆★紝闂撮殧锛�" + span + ", spanTime = " + spanTime); +// logger.debug(context.getPreviousData()); +// } else { +// TimeUnit.MILLISECONDS.sleep(600); +// logger.debug("~~~~~~~~~~~~~~杩囨护鍣ㄦ墽琛屼竴娆★紝闂撮殧锛�600 mills" ); +// } + + TimeUnit.MILLISECONDS.sleep(500); + return true; + } + +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/TestHelloAction.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/TestHelloAction.java new file mode 100644 index 0000000..9645957 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/TestHelloAction.java @@ -0,0 +1,19 @@ +package com.iplatform.tcp.util.ws; + +import com.walker.tcp.Request; +import com.walker.tcp.Response; +import com.walker.tcp.support.AbstractActionCall; +import com.walker.tcp.websocket.HelloResponse; + +public class TestHelloAction extends AbstractActionCall { + + @Override + public Response<?> action(Request<?> request) { + return new HelloResponse(); + } + + @Override + public String getRequestProtocol() { + return "hello"; + } +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/WebBroadCastResponse.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/WebBroadCastResponse.java new file mode 100644 index 0000000..7ccb7c3 --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/WebBroadCastResponse.java @@ -0,0 +1,50 @@ +package com.iplatform.tcp.util.ws; + +import com.iplatform.base.Constants; +import com.walker.tcp.websocket.JsonResponse; + +import java.util.Map; + +/** + * websocket骞挎挱娑堟伅鍝嶅簲瀵硅薄 + * @author 鏃跺厠鑻� + * @date 2018-10-25 + * + */ +public class WebBroadCastResponse extends JsonResponse { + + /** + * + */ + private static final long serialVersionUID = -7104409587873056275L; + + private String data; + + public String getData() { + return data; + } + + public WebBroadCastResponse(){ + this.setProtocolNum(Constants.PUSH_SCOPE_BROAD_CAST); + } + + public void setData(String say) { + this.data = say; + } + +// @Override +// protected void translateProperties(JSONObject json) { +// json.put("data", data); +// } + + // 鍦ㄦ瀯閫犳柟娉曚腑璁剧疆鍒濆鍖栵紝2023-09-28 +// @Override +// public String getProtocolNum() { +// return Constants.PUSH_SCOPE_BROAD_CAST; +// } + + @Override + protected void translateProperties(Map<String, Object> result) { + result.put("data", data); + } +} diff --git a/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/WebDataResponse.java b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/WebDataResponse.java new file mode 100644 index 0000000..970c50f --- /dev/null +++ b/iplatform-base-tcp/src/main/java/com/iplatform/tcp/util/ws/WebDataResponse.java @@ -0,0 +1,20 @@ +package com.iplatform.tcp.util.ws; + +import com.iplatform.base.Constants; + +/** + * 鎺ㄩ�佹櫘閫氱殑缃戦〉娑堟伅锛屽搷搴斿畾涔夈�� + * @author 鏃跺厠鑻� + * @date 2023-04-21 + */ +public class WebDataResponse extends WebBroadCastResponse{ + + public WebDataResponse(){ + this.setProtocolNum(Constants.PUSH_SCOPE_DATA); + } + +// @Override +// public String getProtocolNum() { +// return Constants.PUSH_SCOPE_DATA; +// } +} diff --git a/iplatform-base-tcp/src/main/resources/application-dev.yml b/iplatform-base-tcp/src/main/resources/application-dev.yml new file mode 100644 index 0000000..c0bd7de --- /dev/null +++ b/iplatform-base-tcp/src/main/resources/application-dev.yml @@ -0,0 +1,476 @@ +spring: + application: + name: deploy + datasource: + # 鏄惁鏄剧ずdao涓墦鍗扮殑SQL璇彞 + show-sql: true + +## driver-class-name: sunje.goldilocks.jdbc.GoldilocksDriver + # 娉ㄦ剰锛歁ySQL鏈嶅姟绔紝闇�瑕佽皟鏁翠袱涓弬鏁帮紝鍚﹀垯鏈嶅姟绔細涓诲姩鏂紑杩炴帴 + # wait_timeout: 瓒呰繃鏀规椂闂�(绉�)鏈嶅姟绔富鍔ㄦ柇寮� + # interactive_timeout: 瀹㈡埛绔伐鍏蜂氦浜掕秴杩囪繖涓椂闂�(绉�)浼氱鍙o紝琛ㄧ幇涓簄avicat + driver-class-name: org.postgresql.Driver + username: tbase + password: ENC(SDQnluhnbTXI2XBdvnpBMw==) +# url: jdbc:postgresql://116.198.40.76:30004/ctoms?useUnicode=true&characterEncoding=UTF-8&useSSL=false&stringtype=unspecified + url: jdbc:postgresql://116.198.40.76:30004/ctoms?targetServerType=master&useUnicode=true&characterEncoding=UTF-8&useSSL=false&stringtype=unspecified + +# username: root +# url: jdbc:mysql://116.198.40.76:3306/iplatform?useUnicode=true&characterEncoding=UTF-8&useSSL=false + + # 杈炬ⅵ鏁版嵁搴� +# driver-class-name: dm.jdbc.driver.DmDriver +# username: iplatform +# url: jdbc:dm://116.198.39.83:5236?schema=iplatform + + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # 浣跨敤 Hikari 杩炴帴姹� + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# type: com.walker.jdbc.ds.DefaultDataSource +# hikari: +# minimum-idle: 5 +# idle-timeout: 600000 +# pool-name: databasePool_walker +# # 杩炴帴鏈�澶ц秴鏃舵椂闂� +# connection-timeout: 30000 +# # 杩炴帴姹犳渶澶ф暟閲� +# maximum-pool-size: 10 +# # 鎺у埗姹犱腑杩炴帴鏈�澶х敓瀛樻湡 +# # max-lifetime: 70000 +# # 姝ゅ睘鎬ф帶鍒舵祴璇曡繛鎺ユ槸鍚︽椿璺冪殑鏈�闀挎椂闂淬�傛鍊煎繀椤诲皬浜� connectionTimeout +# validation-timeout: 10000 +# # +# connection-test-query: select 1 + + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # 浣跨敤 Druid 杩炴帴姹� + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + type: com.walker.jdbc.ds.MyDruidDataSource +# type: com.ctoms.base.support.PostgresqlDataSource +# type: com.ctoms.base.support.PostgresqlClusterDataSource + druid: + initial-size: 5 + min-idle: 10 + max-active: 20 + # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂� + max-wait: 60000 + # 閰嶇疆闂撮殧澶氫箙鎵嶈繘琛屼竴娆℃娴嬶紝妫�娴嬮渶瑕佸叧闂殑绌洪棽杩炴帴锛屽崟浣嶆槸姣 + time-between-eviction-runs-millis: 60000 + # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�灏忕敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣 瓒呰繃杩欎釜鏃堕棿姣忔浼氬洖鏀堕粯璁�3涓繛鎺� + min-evictable-idle-time-millis: 30000 + # 绾夸笂閰嶇疆鐨刴ysql鏂紑闂茬疆杩炴帴鏃堕棿涓�1灏忔椂,鏁版嵁婧愰厤缃洖鏀舵椂闂翠负3鍒嗛挓,浠ユ渶鍚庝竴娆℃椿璺冩椂闂村紑濮嬬畻 + max-evictable-idle-time-millis: 180000 + validation-query: select 1 + test-while-idle: true + test-on-borrow: false + test-on-return: false + pool-prepared-statements: true + max-open-prepared-statements: 100 + use-global-data-source-stat: true + webStatFilter: + enabled: false + statViewServlet: + enabled: false + # 璁剧疆鐧藉悕鍗曪紝涓嶅~鍒欏厑璁告墍鏈夎闂� +# allow: +# url-pattern: /druid/* +# # 鎺у埗鍙扮鐞嗙敤鎴峰悕鍜屽瘑鐮� +# login-username: ruoyi + filter: + stat: + enabled: false + # 鎱QL璁板綍 + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: true + wall: + config: + multi-statement-allow: false + + redis: + host: 116.198.40.76 + port: 6379 + password: ENC(VQ9j5YF08eKywBGZzMFq4g==) + # 鍐呯綉鐜涓嶈璇ュ弬鏁帮紝2023-11-10 +# database: 2 + + mvc: + pathmatch: + # 鍔犺閰嶇疆鏄洜涓� swagger3 鍚姩鎶ラ敊锛�2023-02-23 + matching-strategy: ant_path_matcher + + hiddenmethod: + filter: + enabled: true # 鍔犱笂璇ラ厤缃彲浠ユ帴鏀�: application/x-www-form-urlencoded璇锋眰鍙傛暟涓哄璞°�傛敮浠橀�氱煡涓娇鐢ㄣ��2023-02-26 + + servlet: + multipart: + # maxFileSize 鏄崟涓枃浠跺ぇ灏� + # maxRequestSize鏄缃�讳笂浼犵殑鏁版嵁澶у皬 + enabled: true + max-file-size: 5MB + max-request-size: 10MB + +server: + port: 8083 + servlet: + context-path: /tcp + session: + timeout: 30m + +logging: + level: + root: info + org: + springframework: info + io.swagger: error + com: + walker: debug + iplatform: debug + ctoms: debug + RocketmqRemoting: error # MQ鎵撳嵃璇ユ棩蹇楋紝鐩墠娌℃湁鎵惧埌瑙e喅璧勬枡銆�2023-09-27 + charset: + # 鎺у埗鍙扮紪鐮� + console: UTF-8 + # 杈撳嚭鏂囦欢缂栫爜 + file: UTF-8 + +# file: # logging.file.path 鍜� logging.file.name锛屽彧浼氭湁涓�涓敓鏁堬紝閰嶄簡path涓嶈閰峮ame锛岄厤浜唍ame涓嶈閰峱ath锛屽彧閰峱ath鏃秐ame榛樿涓簊pring.log锛屾兂璺緞鍜屾枃浠跺悕鍚屾椂鐢熸晥鍙厤缃甽ogging.file.name=d:/logs/mylog.log +# name: ${spring.application.name}.log #鏃ュ織鏂囦欢鍚� +# path: logs #鏃ュ織瀛樺偍璺緞 +# max-history: 30 #淇濈暀澶氬皯澶╃殑鏃ュ織 +# max-size: 10MB +# pattern: +# rolling-file-name: ${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz + logback: + rollingpolicy: + # 鍗曚釜鏂囦欢鏈�澶т负30MB锛岃秴杩囦箣鍚庝細鎵撳寘鎴愪竴涓棩蹇楁枃浠� + max-file-size: 10MB + # 鏂囦欢淇濆瓨7澶� + max-history: 1 + # 鎵撳寘鏂囦欢鏍煎紡,榛樿锛� ${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz,涔﹀啓鏍煎紡涓猴細鏂囦欢璺緞/鏂囦欢鍚�.%i.鏂囦欢鍚庣紑,鍏朵腑%i涓嶅彲鐪佸幓锛屽惁鍒欐棤鏃ュ織鏄剧ず + # 渚嬪锛� 鏃ユ湡涓猴細2023/07/13 ,鍒欐墦鍖呮枃浠朵箣鍚庝负锛� log/ota.2023-07-13.0.gz,0琛ㄧず鏃ュ織鐨勭涓�閮ㄥ垎锛屽悗缁氨鏄紝1,2,3... + # 濡傛灉鏄帇缂╁寘锛岄噷闈細澶氫竴涓悕log/ota.2023-07-13.0鐨勬棩蹇楁枃浠� + # 濡備笅闈㈢殑渚嬪瓙锛屾墦鍖呬箣鍚庝负: log/2023-07/ota.2020-07-13.0.log锛岃繖鏄竴涓棩蹇楁枃浠� + file-name-pattern: ${logging.file.path}%d{yyyy-MM}/iplatform-tcp.%d{yyyy-MM-dd}.%i.log + + file: + name: ${logging.file.path}iplatform-tcp.log + path: D:/log/ + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# 骞冲彴閰嶇疆鏀寔鍔熻兘 +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +iplatform: + + # 骞冲彴缂撳瓨锛屾槸鍚﹀惎鐢╮edis缂撳瓨锛岄粯璁や娇鐢ㄥ熀浜庡唴瀛樼紦瀛�. + # 娉ㄦ剰锛氬鏋滃紑鍚痳edis缂撳瓨锛屼笟鍔″伐绋嬪繀椤讳緷璧�(walker-support-redis) + cache: + redis-enabled: true + # redis 缂撳瓨鏄惁瑕侀噸寤猴紝濡傛灉璁剧疆 true锛屽垯绯荤粺鍚姩鍚庝細鍒犻櫎缂撳瓨锛屽苟鎵ц榛樿閲嶆柊鍔犺浇鏂规硶銆�2023-08-26 + # 娉ㄦ剰锛氳鍙傛暟涓�鑸湪娴嬭瘯闃舵浣跨敤锛屾寮忕幆澧冧笉瑕佷娇鐢紒 + redis-rebuild: true + # 鏈烘瀯鐢ㄦ埛鏄惁寰堝簽澶э紝濡傛灉鏄垯缂撳瓨涓細鍏抽棴鍒濆鍖栧姞杞斤紝鍚屾椂鏈烘瀯鏍戜篃涓嶄細鏀惧叆缂撳瓨锛�2023-07-17 + org-user-big: false + # 鍗曠嫭鍔犺浇鏈烘瀯 + org-alone-big: false + # 鐩镐技搴﹀垎鏋愭ā鍧椾娇鐢�(宸插簾寮�) +# similarity: +# # 鏄惁鍚敤鐩镐技搴︽ā鍧楋紝濡傛灉绂佺敤鍒欒纭繚娉ㄥ叆鏃舵敮鎸佷负绌� +# enabled: false +# milvus-host: 172.16.60.65 +# milvus-port: 19530 +# word-file: d:/dev_tools/ai/w2v_sogou_dim300_vocab.txt +# embedding-file: d:/dev_tools/ai/w2v_sogou_dim300.npy + + # 璋冨害鍣ㄦā鍧楋紝鏄惁鍚敤 + scheduler: + enabled: false + # 鏄惁鏀寔鏁版嵁搴撳瓨鍌ㄤ换鍔�(搴熷純璇ラ厤缃�) + database-enabled: false + + # 鏁版嵁閲囬泦妯″潡 + gather: + enabled: false + + # 鏉冮檺鎺у埗鐩稿叧 + security: + # 鍖垮悕鍙闂湴鍧�(寮�鏀惧湴鍧�) + anonymous-list: + - /login + - /register + - /captcha/* # 楠岃瘉鐮佺粺涓�鏀惧紑 + - /test/** # 寮�鍙戞祴璇曪紝浠呭紑鍙戞澘鍙敤 + - /template/ctoms/** + - /swagger-resources/** # swagger + - /swagger-ui/** # swagger + - /v3/** # swagger + - /pay/notify/** # 鏀粯閫氱煡 + - /jmreport/** # 绉湪鎶ヨ〃 + - /file/** # 鐧诲綍鐢ㄦ埛鍙闂郴缁熸枃浠讹紝2023-06-09 + - /third_party/unified/** # 绯荤粺绗笁鏂圭櫥褰曞湴鍧�锛屽墠绔幏鍙栫綉闄oken鍚庯紝璋冪敤鍚庡彴鍦板潃瀹炵幇闅愬紡鐧诲綍锛�2023-10-23 + - /door/** + - /oss/** # 娴嬭瘯浣跨敤锛屾寮忓簲閰嶇疆鍒皃ermit涓嬶紝2023-12-13 + # 鍏佽鎵�鏈夎璇佺敤鎴烽兘鍙闂湴鍧�锛岃鎱庨噸鍚﹀垯鏉冮檺閮借繃澶э紝涓�鑸珹PI閮藉簲璇ヨ缃湪杩欓噷 + permit-list: +# - /permit # 鍏敤鏉冮檺锛�2023-03-13锛屽钩鍙颁唬鐮佸凡缁忔坊鍔犺繃浜嗭紝杩欓噷涓嶉渶瑕侀厤缃� + - /getInfo + - /getRouters + - /getMenus # 鏂扮晫闈㈣彍鍗曪紝2023-05-12 + - /logout + - /api/** + - /dqyy/** #妗f湡棰勭害 + - /pxjd/** #鍩硅璧勬簮 + - /tr/** #鏁欏笀 + - /base/** #鍩哄湴 + - /bjgl/class/** #鐝骇绠$悊 + - /app/** #app + - /system/** #骞冲彴绯荤粺 + - /report/** #璐圭敤姹囨�� + - /settlement/** #璐圭敤姹囨�昏褰� + - /resource/** #璧勬簮 + - /evaluation/** #鏁欏璇勪及 + - /stat/workload/** #鏍″唴甯堣祫宸ヤ綔閲� + - /bjgl/bus/** #鎺ラ�佺珯 + - /base/statistics/report/** #鍩哄湴缁熻 + - /all/base/statistics/** #鍏ㄧ綉缁熻 + + # 瓒呯骇绠$悊鍛樺瘑鐮侊紝鍔犲瘑鍚庣殑绉樻枃 + supervisor-password: ENC(i2QGr3kEu49MbMrW7dR+Q7jiPn1WpeuIbCfemGkhy+aMTamfXxrmKyS6j4GqG2TDm/7MTF8Q/+xqQB5pvy6rqA==) + + # 鏄惁鍏佽閰嶇疆璺ㄥ煙鍝嶅簲澶�, true 鍚敤锛� false 涓嶅惎鐢ㄣ��2022-12-28 + # 鍦℅ateway妯″紡涓紝闇�瑕佸叧闂法鍩熼厤缃紝鍥犱负缃戝叧涔熶細閰嶇疆銆� + cors-enabled: true + + # 鐢ㄦ埛鍚嶅瘑鐮佹柟寮忕櫥褰曪紝閰嶇疆鐨勯獙璇佺爜绫诲瀷锛歝ode/sms/slide/jigsaw锛�2023-03-14 + login-captcha-user-pass: code + # 鎵嬫満楠岃瘉鐮佹柟寮忕櫥褰曪紝閰嶇疆鐨勯獙璇佺爜绫诲瀷锛歝ode/sms/slide/jigsaw锛�2023-03-14 + login-captcha-sms-code: sms + + # 鏄惁鍏佽鍚庡彴鐢ㄦ埛锛堥潪App锛夌櫥褰曟墜鏈虹锛�2023-03-20 + allow-pc-user-access-app: true + + # 鏄惁鏀寔鎵嬫満鐧诲綍鏃讹紙涓嶅瓨鍦ㄦ墜鏈哄彿锛夌洿鎺ユ敞鍐岋紵鐩墠鐢靛晢绯荤粺鏀寔! 2023-06-26 + allow-mobile-login-reg: true + + # PC绔痶oken澶辨晥鍒嗛挓锛岄粯璁わ細120鍒嗛挓锛�2023-03-28 + token-expire-web: 120 + # 绉诲姩绔痶oken澶辨晥鍒嗛挓锛�2023-03-28 + token-expire-mobile: 120 + + # 鐢ㄦ埛浣撶郴锛堢敤鎴峰悕锛夐兘鏄墜鏈哄彿锛�2023-06-28 + # 涓�鑸郴缁烶C绔�氬父閮戒笉鏄墜鏈哄彿浣滀负鐢ㄦ埛鍚嶏紝鍙湁鍦ㄤ簰鑱旂綉鐩稿叧绯荤粺涓細瀛樺湪鎵嬫満鍙蜂綔涓虹櫥褰曡处鍙� + user-name-is-phone: false + + # 2023-07-11 鐧诲綍绛栫暐閰嶇疆锛屽垪琛ㄤ腑瀛樺湪鐨勭瓥鐣ラ兘琛ㄧず鍚敤锛堜笉鍚敤鐨勫垹鎺夛級 + login-strategy-list: +# - com.iplatform.base.support.strategy.WebOnceLoginStrategy ##鍚屼竴璐﹀彿鍙兘鐧诲綍涓�涓猧p +# - com.iplatform.base.support.strategy.MobileOnceLoginStrategy + + # 鐢ㄦ埛鐩稿叧瀹夊叏閰嶇疆锛�2023-08-03 + user: + # 鐢ㄦ埛淇敼瀵嗙爜绛夌骇锛屽垎鍥涚骇锛�1-2-3-4锛屽父閲忥細PasswordUtils# + pass-level: 1 + # 鏄惁寮哄埗鐢ㄦ埛淇敼榛樿瀵嗙爜锛� + pass-default-modify: false + + # 浠g爜鐢熸垚锛�2022-11-26 + gen: + # 浣滆�� + author: Mike + # 榛樿鐢熸垚鍖呰矾寰� system 闇�鏀规垚鑷繁鐨勬ā鍧楀悕绉� 濡� system monitor tool + package-name: com.iplatform.model.po + # 鑷姩鍘婚櫎琛ㄥ墠缂�锛岄粯璁ゆ槸false + auto-remove-pre: false + # 琛ㄥ墠缂�锛堢敓鎴愮被鍚嶄笉浼氬寘鍚〃鍓嶇紑锛屽涓敤閫楀彿鍒嗛殧锛� + table-prefix: s_ + + log: + # 鏄惁鎵撳紑鐧诲綍鏃ュ織锛�2023-01-05 + # 濡傛灉涓嶆墦寮�锛屽垯璁惧鐧诲綍鐨剈uid鏇存柊鎿嶄綔涔熸棤娉曡幏寰楋紝鐢ㄤ簬璁板綍姣忎釜鐧诲綍鐢ㄦ埛鐨剈uid锛堢敤鎴风櫥褰曡鑹叉洿鏂帮級锛�2023-03-23 + login-enabled: false + # 鏄惁鎵撳紑鎿嶄綔鏃ュ織锛�2023-01-05 + operate-enabled: false + + # 楠岃瘉鐮佺浉鍏抽厤缃紝2023-01-27 + captcha: + # 鍥惧舰楠岃瘉鐮佸疄鐜扮被, TextCaptchaProvider | DefaultCaptchaProvider + image-captcha-class: com.iplatform.base.captcha.TextCaptchaProvider + # 鐭俊楠岃瘉鐮佸疄鐜扮被锛堥厤缃簾寮冿紝2023-04-25锛� + sms-captcha-class: com.iplatform.base.captcha.MockSmsCaptchaProvider + + # 骞冲彴鏂囦欢瀛樺偍閰嶇疆锛�2023-02-15 + file: + # FileStoreType = FileSystem 鏈湴纾佺洏瀛樺偍鏍硅矾寰� + file-root: d:/tmp/ + # 璋冪敤杩滅▼涓婁紶鏂囦欢锛屾槸鍚︽寜鐓ф湰鍦版枃浠跺鐞嗭紝2023-07-03 + # 鍦ㄦ祴璇曡繃绋嬩腑濡傛灉娌℃湁FTP绛夋湇鍔★紝鍙互璁剧疆涓簍rue涓存椂瀛樺偍鏈湴 + remote-as-local: false + + # oss瀹炵幇绫诲瀷锛歛ws_s3锛堜簹椹�婏級 | tx锛堣吘璁級 | ali锛堥樋閲岋級 | qn锛堜竷鐗涳級锛�2023-12-13 + oss-type: aws_s3 + # oss璁块棶鍓嶇紑锛屽锛歨ttp://localhost:8082/admin/oss/锛�2023-12-13 + oss-prefix: http://localhost:8082/admin/oss/ + oss-access-key: ENC(BTHETNjs5ddRjYrdMF9ltmw8DMIEYTuyXIgDOeLIHy0=) + oss-secret-key: ENC(jROCWGpiPULZrU1wBZAsXvQQovvqnhoJKWpmYD/3nbkNGDikxfEvCXW5jn3QsYnG) + # oss鏈嶅姟鍦板潃 + oss-endpoint: https://eos-beijing-1.cmecloud.cn + # oss榛樿鐨勬《鍚嶇О + oss-bucket-name: ctoms-file + protocol: https + +# # oss瀹炵幇绫诲瀷锛歛ws_s3锛堜簹椹�婏級 | tx锛堣吘璁級 | ali锛堥樋閲岋級 | qn锛堜竷鐗涳級锛�2023-12-13 +# oss-type: aws_s3 +# # oss璁块棶鍓嶇紑锛屽锛歨ttp://localhost:8082/admin/oss/锛�2023-12-13 +# oss-prefix: http://localhost:8082/admin/oss/ +# # oss鏈嶅姟鍦板潃 +# oss-endpoint: http://10.10.5.191:8080 +# # oss榛樿鐨勬《鍚嶇О +# oss-bucket-name: ctoms-file + + ftp: + ip: 116.198.40.76 + port: 22 + user-name: mysftp + password: + private-key: + # ftp鏈嶅姟涓婇潰鐨勫瓨鍌ㄦ牴璺緞锛屽彧鑳芥槸linux璺緞 +# file-root: /files/ + file-root: /train/ + + # 鎺ュ彛鏂囨。鐢熸垚锛宻wagger3锛�2023-02-23 + swagger: + enable: false + # 鍖呰矾寰勶紝鏆傛椂涓嶇敤 + base-package: com.iplatform.base.controller + title: 浜戝師鐢熷井鏈嶅姟骞冲彴 + description: 涓�涓揩閫焪eb寮�鍙戞鏋� + + # TCP閫氫俊閰嶇疆锛�2024-01-23 + tcp: + # 鏄惁寮�鍚紩鎿� + enabled: true + # 鏄惁鎵撳紑蹇冭烦 + open-heart-beat: true + # 蹇冭烦鏃堕棿锛堢锛夛紝2023-08-28 + heart-beat-seconds: 60 + # 鏄惁鏄剧ず璇︾粏鏃ュ織 + show-log: false + # 璇锋眰闃熷垪绫诲瀷锛歮emory 鍩轰簬鍐呭瓨 + queue-type: memory + # tcp鏂瑰紡瑕佹壂鎻忕殑璇锋眰瀵硅薄鐨勫寘绌洪棿 + scan-packages-tcp: com.walker.tcp,com.iplatform.tcp + # websocket鏂瑰紡瑕佹壂鎻忕殑璇锋眰瀵硅薄鐨勫寘绌洪棿 + scan-packages-ws: com.iplatform.tcp.util.ws + # tcp闀胯繛鎺ョ殑绔彛 + port-tcp: 7878 + # websocket杩炴帴绔彛 + port-ws: 60001 + # websocket杩炴帴uri +# websocket-uri: ws://jmy.jinmingyuan.com:60001/websocket + websocket-uri: ws://www.shikeying.com:60000/websocket + # 閫氫俊绾跨▼鏁伴噺 + boss-thread-num: 2 + # 涓氬姟澶勭悊绾跨▼鏁伴噺 + worker-thread-num: 4 + # 鍚敤鑷畾涔夎繛鎺ョ鐞嗗櫒锛屽鏋渢rue鍒欎笟鍔¢渶瑕佹彁渚涜嚜瀹氫箟瀹炵幇锛堥厤缃級锛�2023-07-18 + custom-connection-manager: false + # 鏄惁寮�鍚泦缇ゆā寮忥紝杩炴帴绠$悊鍣ㄤ細榛樿鍔犺浇璐熻浇鏀寔锛�2023-09-26 + load-balance-enabled: false + # 闀胯繛鎺ヤ富鏈猴紙鏍囪锛変俊鎭紝鍙互鏄换鎰忓瓧绗︿覆锛屽彧瑕侀泦缇や腑姣忎釜鏈嶅姟閰嶇疆涓嶅悓鍗冲彲銆� + # 鍦ㄩ泦缇ゆā寮忎腑锛屾瘡涓繛鎺ヨ鍔犱笂涓绘満鏍囪瘑锛屼互渚垮埆浜烘帹閫佹秷鎭椂锛岀煡閬撳湪鍝釜涓绘満涓婃帹閫併��2023-09-19 + connection-host: topic_master + + # 鎺ㄩ�佹ā鍧楅厤缃紝2023-04-25 + push: + # 鐭俊鎺ㄩ�佽�呭悕绉帮細mock_sms_push锛堟ā鎷熺煭淇★級锛宎lidy_sms_push锛堥樋閲屽ぇ楸肩煭淇★級 + sms-push-name: alidy_sms_push + # 鐭俊楠岃瘉鐮佹ā鏉縄D锛屾牴鎹疄闄呮儏鍐碉紙姣忎釜骞冲彴鍙兘涓嶅悓锛� + sms-template-code: SMS_285145505 + + # 瀵逛簬涓�鑸笟鍔℃彁閱掞紙涓嶅寘鎷細閭欢銆佺煭淇★級锛屾帹閫佺殑鏂瑰紡銆傛帹閫佽�匢D缁勫悎 + # && 琛ㄧず骞跺垪锛寍| 琛ㄧず鎴栵紙鍙涓�涓垚鍔熷氨OK锛� + # 2023-04-26锛屽彲鐢ㄧ殑 id = 'tcp', 'web_socket', 'wx', 'system' +# message-type: tcp && web_socket && wx && system + # 濡傛灉鏄垨鑰呮柟寮忥紝闇�瑕佹妸鏈�鍙潬鐨勬斁鍓嶉潰锛屽洜涓虹郴缁熶細鎵惧埌绗竴涓彂閫佹垚鍔熷嵆鍙�� + message-type: system || tcp || web_socket || wx + + # 閭欢閫氱煡鍙戦�佷俊鎭厤缃紝2023-04-26 + mail-server: smtp.126.com + mail-from: hnzzzhsl@126.com + mail-password: 123456 + + # RestTemplate杩炴帴姹犻厤缃紝2023-08-18 + rest: + # 杩炴帴淇濇寔娲诲姩鏃堕棿锛岄粯璁わ細600绉� + keep-alive-duration-seconds: 600 + # 绌洪棽杩炴帴鏁伴噺锛岄粯璁わ細200涓� + max-idle-connections: 200 + # 杩炴帴瓒呮椂锛岄粯璁わ細2绉� + connect-timeout-seconds: 2 + # 璇昏秴鏃讹紝榛樿3绉� + read-timeout-seconds: 3 + # 鍐欒秴鏃讹紝榛樿3绉� + write-timeout-seconds: 3 + + # 闆嗙兢鏀寔鐩稿叧閰嶇疆锛�2023-09-29 + lb: + # 鏈満鏈嶅姟鑺傜偣ID锛屾瘡涓富鏈轰竴涓敮涓�鏁板瓧缂栧彿锛屼粠1寮�濮� + server-id: 8 + + # 2024-02-29 api鐩戞帶鐩稿叧 + api: + # 2024-02-29 鏄惁鎵撳紑鎺ュ彛鏃堕棿缁熻璁板綍锛屽鏋滐細true 鍒欎細璁板綍鎺ュ彛璋冪敤鏃堕棿锛屽啓鍏ヨ〃锛歴_api_time + time-enabled: false + + # 缃戦櫌缁熶竴璁よ瘉閰嶇疆閫夐」锛�2023-10-23 + unified: + # 鏄惁寮�鍚祴璇曟ā寮忥紝娴嬭瘯妯″紡鐢ㄤ簬鏈湴娴嬭瘯锛屾棤娉曡繛鎺ョ綉闄㈣璇佹帴鍙� + test-mode: true + # 缃戦櫌鎻愪緵鐨勮璇佸湴鍧�锛屽叧闂祴璇曟ā寮忓悗锛岃閫夐」鐢熸晥 + remote-url: http://10.30.2.86:8001/uaa/person/current + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# RocketMQ闃熷垪閰嶇疆锛�2023-09-26 +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +rocketmq: + # 鏈嶅姟鍦板潃锛屽涓敤閫楀彿鍒嗗紑 +# name-server: 116.198.40.76:9876 + name-server: 116.198.39.83:9898 + producer: + # 鍙戦�佹秷鎭秴鏃舵椂闂达紝榛樿3000 + send-message-timeout: 3000 + # 鐢熶骇鑰呯粍 + group: producer_group + # 鍙戦�佹秷鎭け璐ラ噸璇曟鏁帮紝榛樿2 + retryTimesWhenSendFailed: 2 + # 寮傛娑堟伅閲嶈瘯姝ゅ锛岄粯璁�2 + retryTimesWhenSendAsyncFailed: 2 + # 娑堟伅鏈�澶ч暱搴︼紝榛樿1024 * 1024 * 4(榛樿4M) + # 1024 * 128 = 128K + maxMessageSize: 131072 + # 鍘嬬缉娑堟伅闃堝�硷紝榛樿4k(1024 * 4) + compressMessageBodyThreshold: 4096 + # 鏄惁鍦ㄥ唴閮ㄥ彂閫佸け璐ユ椂閲嶈瘯鍙︿竴涓猙roker锛岄粯璁alse + retryNextServer: false + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# 闆嗕腑鍩硅涓氬姟鍣ㄩ厤缃紝2023-10-26 +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +ctoms: + # 璋冨害鍣ㄩ厤缃紝2023-10-26 + scheduler: + # 鏄惁鍏佽闆嗙兢妯″紡鍚敤锛� + # true锛氳〃绀洪泦缇ら儴缃诧紝鍒欎笟鍔℃墦鍖呭彂甯冧腑涓嶅寘鍚皟搴︽ā鍧楋紙ctoms-scheduler-server锛�,璋冨害妯″潡闇�瑕佺嫭绔嬫墦鍖咃紱 + # false锛氳〃绀哄崟鏈洪儴缃诧紝璋冨害妯″潡浼氳鑷姩鎵撳寘锛堜綔涓轰竴涓被搴擄級鍙戝竷锛� + cluster-enabled: false + # 鍙戝竷绫诲瀷锛� + # single锛氫笟鍔″崟搴旂敤鎵撳寘锛岀洿鎺ヨ兘杩愯璋冨害浠诲姟 + # scheduler锛氳皟搴︿换鍔″寘锛堢嫭绔嬫墦鍖呮敮鎸侀泦缇わ級 + deploy-type: single + # 娑堟伅鎺ㄩ�佽姹傚湴鍧� + push-url: "https://push.cpoc.cn/sendv2" #浜掕仈缃� + link-app-url: "https://jmy.jinmingyuan.com/ctoms-h5/#/?" #绉诲姩璺宠浆 + link-pc-url: "https://jmy.jinmingyuan.com" +# push-url: "http://10.5.6.99:9001/sendv2" #缁煎悎缃� +# push-url: "http://push.cpoc.cn:9001/sendv2" #缁煎悎缃� diff --git a/iplatform-base-tcp/src/main/resources/application-line-dev.yml b/iplatform-base-tcp/src/main/resources/application-line-dev.yml new file mode 100644 index 0000000..3f48e52 --- /dev/null +++ b/iplatform-base-tcp/src/main/resources/application-line-dev.yml @@ -0,0 +1,480 @@ +# 瀵瑰簲閭斂鍐呯綉寮�鍙戠幆澧冮厤缃� +spring: + application: + name: deploy + datasource: + # 鏄惁鏄剧ずdao涓墦鍗扮殑SQL璇彞 + show-sql: true + + ## driver-class-name: sunje.goldilocks.jdbc.GoldilocksDriver + # 娉ㄦ剰锛歁ySQL鏈嶅姟绔紝闇�瑕佽皟鏁翠袱涓弬鏁帮紝鍚﹀垯鏈嶅姟绔細涓诲姩鏂紑杩炴帴 + # wait_timeout: 瓒呰繃鏀规椂闂�(绉�)鏈嶅姟绔富鍔ㄦ柇寮� + # interactive_timeout: 瀹㈡埛绔伐鍏蜂氦浜掕秴杩囪繖涓椂闂�(绉�)浼氱鍙o紝琛ㄧ幇涓簄avicat + + username: cent_glyyb_ctoms_uat_user + password: ENC(QlpRYCjAXS8pElGluLTsCA==) +# url: jdbc:postgresql://10.1.149.211:11023/cent_uat_db?currentSchema=cent_glyyb_ctoms_uat_schema&useUnicode=true&characterEncoding=UTF-8&useSSL=false&stringtype=unspecified + url: jdbc:postgresql://10.3.80.15:11002/cent_uat_db?currentSchema=cent_glyyb_ctoms_uat_schema&useUnicode=true&characterEncoding=UTF-8&useSSL=false&stringtype=unspecified + + # username: root + # url: jdbc:mysql://116.198.40.76:3306/iplatform?useUnicode=true&characterEncoding=UTF-8&useSSL=false + + # 杈炬ⅵ鏁版嵁搴� + # driver-class-name: dm.jdbc.driver.DmDriver + # username: iplatform + # url: jdbc:dm://116.198.39.83:5236?schema=iplatform + + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # 浣跨敤 Hikari 杩炴帴姹� + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # type: com.walker.jdbc.ds.DefaultDataSource + # hikari: + # minimum-idle: 5 + # idle-timeout: 600000 + # pool-name: databasePool_walker + # # 杩炴帴鏈�澶ц秴鏃舵椂闂� + # connection-timeout: 30000 + # # 杩炴帴姹犳渶澶ф暟閲� + # maximum-pool-size: 10 + # # 鎺у埗姹犱腑杩炴帴鏈�澶х敓瀛樻湡 + # # max-lifetime: 70000 + # # 姝ゅ睘鎬ф帶鍒舵祴璇曡繛鎺ユ槸鍚︽椿璺冪殑鏈�闀挎椂闂淬�傛鍊煎繀椤诲皬浜� connectionTimeout + # validation-timeout: 10000 + # # + # connection-test-query: select 1 + + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # 浣跨敤 Druid 杩炴帴姹� + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + type: com.walker.jdbc.ds.MyDruidDataSource + druid: + initial-size: 5 + min-idle: 10 + max-active: 20 + # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂� + max-wait: 60000 + # 閰嶇疆闂撮殧澶氫箙鎵嶈繘琛屼竴娆℃娴嬶紝妫�娴嬮渶瑕佸叧闂殑绌洪棽杩炴帴锛屽崟浣嶆槸姣 + time-between-eviction-runs-millis: 60000 + # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�灏忕敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣 瓒呰繃杩欎釜鏃堕棿姣忔浼氬洖鏀堕粯璁�3涓繛鎺� + min-evictable-idle-time-millis: 30000 + # 绾夸笂閰嶇疆鐨刴ysql鏂紑闂茬疆杩炴帴鏃堕棿涓�1灏忔椂,鏁版嵁婧愰厤缃洖鏀舵椂闂翠负3鍒嗛挓,浠ユ渶鍚庝竴娆℃椿璺冩椂闂村紑濮嬬畻 + max-evictable-idle-time-millis: 180000 + validation-query: select 1 + test-while-idle: true + test-on-borrow: false + test-on-return: false + pool-prepared-statements: true + max-open-prepared-statements: 100 + use-global-data-source-stat: true + webStatFilter: + enabled: false + statViewServlet: + enabled: false + # 璁剧疆鐧藉悕鍗曪紝涓嶅~鍒欏厑璁告墍鏈夎闂� + # allow: + # url-pattern: /druid/* + # # 鎺у埗鍙扮鐞嗙敤鎴峰悕鍜屽瘑鐮� + # login-username: ruoyi + filter: + stat: + enabled: false + # 鎱QL璁板綍 + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: true + wall: + config: + multi-statement-allow: false + + redis: + host: 10.2.38.137 + port: 31512 + password: ENC(JgSbHpKSmIUMVvqeEwbst9xY3WxyJmwcNQ70gz0aZM8=) + # 鍐呯綉鐜涓嶈璇ュ弬鏁帮紝2023-11-10 + # database: 2 + + mvc: + pathmatch: + # 鍔犺閰嶇疆鏄洜涓� swagger3 鍚姩鎶ラ敊锛�2023-02-23 + matching-strategy: ant_path_matcher + + hiddenmethod: + filter: + enabled: true # 鍔犱笂璇ラ厤缃彲浠ユ帴鏀�: application/x-www-form-urlencoded璇锋眰鍙傛暟涓哄璞°�傛敮浠橀�氱煡涓娇鐢ㄣ��2023-02-26 + + servlet: + multipart: + # maxFileSize 鏄崟涓枃浠跺ぇ灏� + # maxRequestSize鏄缃�讳笂浼犵殑鏁版嵁澶у皬 + enabled: true + max-file-size: 5MB + max-request-size: 10MB + +server: + port: 8083 + servlet: + context-path: /tcp + session: + timeout: 30m + +logging: + level: + root: info + org: + springframework: info + io.swagger: error + com: + walker: debug + iplatform: debug + ctoms: debug + RocketmqRemoting: error # MQ鎵撳嵃璇ユ棩蹇楋紝鐩墠娌℃湁鎵惧埌瑙e喅璧勬枡銆�2023-09-27 + charset: + # 鎺у埗鍙扮紪鐮� + console: UTF-8 + # 杈撳嚭鏂囦欢缂栫爜 + file: UTF-8 + + # file: # logging.file.path 鍜� logging.file.name锛屽彧浼氭湁涓�涓敓鏁堬紝閰嶄簡path涓嶈閰峮ame锛岄厤浜唍ame涓嶈閰峱ath锛屽彧閰峱ath鏃秐ame榛樿涓簊pring.log锛屾兂璺緞鍜屾枃浠跺悕鍚屾椂鐢熸晥鍙厤缃甽ogging.file.name=d:/logs/mylog.log + # name: ${spring.application.name}.log #鏃ュ織鏂囦欢鍚� + # path: logs #鏃ュ織瀛樺偍璺緞 + # max-history: 30 #淇濈暀澶氬皯澶╃殑鏃ュ織 + # max-size: 10MB + # pattern: + # rolling-file-name: ${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz + logback: + rollingpolicy: + # 鍗曚釜鏂囦欢鏈�澶т负30MB锛岃秴杩囦箣鍚庝細鎵撳寘鎴愪竴涓棩蹇楁枃浠� + max-file-size: 10MB + # 鏂囦欢淇濆瓨7澶� + max-history: 1 + # 鎵撳寘鏂囦欢鏍煎紡,榛樿锛� ${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz,涔﹀啓鏍煎紡涓猴細鏂囦欢璺緞/鏂囦欢鍚�.%i.鏂囦欢鍚庣紑,鍏朵腑%i涓嶅彲鐪佸幓锛屽惁鍒欐棤鏃ュ織鏄剧ず + # 渚嬪锛� 鏃ユ湡涓猴細2023/07/13 ,鍒欐墦鍖呮枃浠朵箣鍚庝负锛� log/ota.2023-07-13.0.gz,0琛ㄧず鏃ュ織鐨勭涓�閮ㄥ垎锛屽悗缁氨鏄紝1,2,3... + # 濡傛灉鏄帇缂╁寘锛岄噷闈細澶氫竴涓悕log/ota.2023-07-13.0鐨勬棩蹇楁枃浠� + # 濡備笅闈㈢殑渚嬪瓙锛屾墦鍖呬箣鍚庝负: log/2023-07/ota.2020-07-13.0.log锛岃繖鏄竴涓棩蹇楁枃浠� + file-name-pattern: ${logging.file.path}%d{yyyy-MM}/iplatform-tcp.%d{yyyy-MM-dd}.%i.log + + file: + name: ${logging.file.path}iplatform-tcp.log + path: D:/log/ + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# 骞冲彴閰嶇疆鏀寔鍔熻兘 +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +iplatform: + + # 骞冲彴缂撳瓨锛屾槸鍚﹀惎鐢╮edis缂撳瓨锛岄粯璁や娇鐢ㄥ熀浜庡唴瀛樼紦瀛�. + # 娉ㄦ剰锛氬鏋滃紑鍚痳edis缂撳瓨锛屼笟鍔″伐绋嬪繀椤讳緷璧�(walker-support-redis) + cache: + redis-enabled: true + # redis 缂撳瓨鏄惁瑕侀噸寤猴紝濡傛灉璁剧疆 true锛屽垯绯荤粺鍚姩鍚庝細鍒犻櫎缂撳瓨锛屽苟鎵ц榛樿閲嶆柊鍔犺浇鏂规硶銆�2023-08-26 + # 娉ㄦ剰锛氳鍙傛暟涓�鑸湪娴嬭瘯闃舵浣跨敤锛屾寮忕幆澧冧笉瑕佷娇鐢紒 + redis-rebuild: false + # 鏈烘瀯鐢ㄦ埛鏄惁寰堝簽澶э紝濡傛灉鏄垯缂撳瓨涓細鍏抽棴鍒濆鍖栧姞杞斤紝鍚屾椂鏈烘瀯鏍戜篃涓嶄細鏀惧叆缂撳瓨锛�2023-07-17 + org-user-big: true + # 鍗曠嫭鍔犺浇鏈烘瀯 + org-alone-big: true + # 鐩镐技搴﹀垎鏋愭ā鍧椾娇鐢�(宸插簾寮�) + # similarity: + # # 鏄惁鍚敤鐩镐技搴︽ā鍧楋紝濡傛灉绂佺敤鍒欒纭繚娉ㄥ叆鏃舵敮鎸佷负绌� + # enabled: false + # milvus-host: 172.16.60.65 + # milvus-port: 19530 + # word-file: d:/dev_tools/ai/w2v_sogou_dim300_vocab.txt + # embedding-file: d:/dev_tools/ai/w2v_sogou_dim300.npy + + # 璋冨害鍣ㄦā鍧楋紝鏄惁鍚敤 + scheduler: + enabled: false + # 鏄惁鏀寔鏁版嵁搴撳瓨鍌ㄤ换鍔�(搴熷純璇ラ厤缃�) + database-enabled: false + + # 鏁版嵁閲囬泦妯″潡 + gather: + enabled: false + + # 鏉冮檺鎺у埗鐩稿叧 + security: + # 鍖垮悕鍙闂湴鍧�(寮�鏀惧湴鍧�) + anonymous-list: + - /login + - /register + - /captcha/* # 楠岃瘉鐮佺粺涓�鏀惧紑 + - /test/** # 寮�鍙戞祴璇曪紝浠呭紑鍙戞澘鍙敤 + - /template/ctoms/** + - /swagger-resources/** # swagger + - /swagger-ui/** # swagger + - /v3/** # swagger + - /pay/notify/** # 鏀粯閫氱煡 + - /jmreport/** # 绉湪鎶ヨ〃 + - /file/** # 鐧诲綍鐢ㄦ埛鍙闂郴缁熸枃浠讹紝2023-06-09 + - /third_party/unified/** # 绯荤粺绗笁鏂圭櫥褰曞湴鍧�锛屽墠绔幏鍙栫綉闄oken鍚庯紝璋冪敤鍚庡彴鍦板潃瀹炵幇闅愬紡鐧诲綍锛�2023-10-23 + + + # 鍏佽鎵�鏈夎璇佺敤鎴烽兘鍙闂湴鍧�锛岃鎱庨噸鍚﹀垯鏉冮檺閮借繃澶э紝涓�鑸珹PI閮藉簲璇ヨ缃湪杩欓噷 + permit-list: + # - /permit # 鍏敤鏉冮檺锛�2023-03-13锛屽钩鍙颁唬鐮佸凡缁忔坊鍔犺繃浜嗭紝杩欓噷涓嶉渶瑕侀厤缃� + - /getInfo + - /getRouters + - /getMenus # 鏂扮晫闈㈣彍鍗曪紝2023-05-12 + - /logout + - /api/** + - /dqyy/** #妗f湡棰勭害 + - /pxjd/** #鍩硅璧勬簮 + - /tr/** #鏁欏笀 + - /base/** #鍩哄湴 + - /bjgl/class/** #鐝骇绠$悊 + - /app/** #app + - /system/** #骞冲彴绯荤粺 + - /report/** #璐圭敤姹囨�� + - /settlement/** #璐圭敤姹囨�昏褰� + - /door/** #闂ㄦ埛 + + # 瓒呯骇绠$悊鍛樺瘑鐮侊紝鍔犲瘑鍚庣殑绉樻枃 + supervisor-password: ENC(5hx5es5ySh5vySqCDFb61o1vhDVyOiA+gOBwkHjW1TbyUQwVWOVgKY+KUBOynTxOVDFFwGULPdCT8S4pJaSjGQ==) + + # 鏄惁鍏佽閰嶇疆璺ㄥ煙鍝嶅簲澶�, true 鍚敤锛� false 涓嶅惎鐢ㄣ��2022-12-28 + # 鍦℅ateway妯″紡涓紝闇�瑕佸叧闂法鍩熼厤缃紝鍥犱负缃戝叧涔熶細閰嶇疆銆� + cors-enabled: true + + # 鐢ㄦ埛鍚嶅瘑鐮佹柟寮忕櫥褰曪紝閰嶇疆鐨勯獙璇佺爜绫诲瀷锛歝ode/sms/slide/jigsaw锛�2023-03-14 + login-captcha-user-pass: code + # 鎵嬫満楠岃瘉鐮佹柟寮忕櫥褰曪紝閰嶇疆鐨勯獙璇佺爜绫诲瀷锛歝ode/sms/slide/jigsaw锛�2023-03-14 + login-captcha-sms-code: sms + + # 鏄惁鍏佽鍚庡彴鐢ㄦ埛锛堥潪App锛夌櫥褰曟墜鏈虹锛�2023-03-20 + allow-pc-user-access-app: true + + # 鏄惁鏀寔鎵嬫満鐧诲綍鏃讹紙涓嶅瓨鍦ㄦ墜鏈哄彿锛夌洿鎺ユ敞鍐岋紵鐩墠鐢靛晢绯荤粺鏀寔! 2023-06-26 + allow-mobile-login-reg: true + + # PC绔痶oken澶辨晥鍒嗛挓锛岄粯璁わ細120鍒嗛挓锛�2023-03-28 + token-expire-web: 120 + # 绉诲姩绔痶oken澶辨晥鍒嗛挓锛�2023-03-28 + token-expire-mobile: 120 + + # 鐢ㄦ埛浣撶郴锛堢敤鎴峰悕锛夐兘鏄墜鏈哄彿锛�2023-06-28 + # 涓�鑸郴缁烶C绔�氬父閮戒笉鏄墜鏈哄彿浣滀负鐢ㄦ埛鍚嶏紝鍙湁鍦ㄤ簰鑱旂綉鐩稿叧绯荤粺涓細瀛樺湪鎵嬫満鍙蜂綔涓虹櫥褰曡处鍙� + user-name-is-phone: false + + # 2023-07-11 鐧诲綍绛栫暐閰嶇疆锛屽垪琛ㄤ腑瀛樺湪鐨勭瓥鐣ラ兘琛ㄧず鍚敤锛堜笉鍚敤鐨勫垹鎺夛級 + login-strategy-list: + # - com.iplatform.base.support.strategy.WebOnceLoginStrategy ##鍚屼竴璐﹀彿鍙兘鐧诲綍涓�涓猧p + # - com.iplatform.base.support.strategy.MobileOnceLoginStrategy + + # 鐢ㄦ埛鐩稿叧瀹夊叏閰嶇疆锛�2023-08-03 + user: + # 鐢ㄦ埛淇敼瀵嗙爜绛夌骇锛屽垎鍥涚骇锛�1-2-3-4锛屽父閲忥細PasswordUtils# + pass-level: 1 + # 鏄惁寮哄埗鐢ㄦ埛淇敼榛樿瀵嗙爜锛� + pass-default-modify: false + + # 浠g爜鐢熸垚锛�2022-11-26 + gen: + # 浣滆�� + author: Mike + # 榛樿鐢熸垚鍖呰矾寰� system 闇�鏀规垚鑷繁鐨勬ā鍧楀悕绉� 濡� system monitor tool + package-name: com.iplatform.model.po + # 鑷姩鍘婚櫎琛ㄥ墠缂�锛岄粯璁ゆ槸false + auto-remove-pre: false + # 琛ㄥ墠缂�锛堢敓鎴愮被鍚嶄笉浼氬寘鍚〃鍓嶇紑锛屽涓敤閫楀彿鍒嗛殧锛� + table-prefix: s_ + + log: + # 鏄惁鎵撳紑鐧诲綍鏃ュ織锛�2023-01-05 + # 濡傛灉涓嶆墦寮�锛屽垯璁惧鐧诲綍鐨剈uid鏇存柊鎿嶄綔涔熸棤娉曡幏寰楋紝鐢ㄤ簬璁板綍姣忎釜鐧诲綍鐢ㄦ埛鐨剈uid锛堢敤鎴风櫥褰曡鑹叉洿鏂帮級锛�2023-03-23 + login-enabled: true + # 鏄惁鎵撳紑鎿嶄綔鏃ュ織锛�2023-01-05 + operate-enabled: false + + # 楠岃瘉鐮佺浉鍏抽厤缃紝2023-01-27 + captcha: + # 鍥惧舰楠岃瘉鐮佸疄鐜扮被, TextCaptchaProvider | DefaultCaptchaProvider + image-captcha-class: com.iplatform.base.captcha.TextCaptchaProvider + # 鐭俊楠岃瘉鐮佸疄鐜扮被锛堥厤缃簾寮冿紝2023-04-25锛� + sms-captcha-class: com.iplatform.base.captcha.MockSmsCaptchaProvider + + # 骞冲彴鏂囦欢瀛樺偍閰嶇疆锛�2023-02-15 + file: + # FileStoreType = FileSystem 鏈湴纾佺洏瀛樺偍鏍硅矾寰� + file-root: d:/tmp/ + # 璋冪敤杩滅▼涓婁紶鏂囦欢锛屾槸鍚︽寜鐓ф湰鍦版枃浠跺鐞嗭紝2023-07-03 + # 鍦ㄦ祴璇曡繃绋嬩腑濡傛灉娌℃湁FTP绛夋湇鍔★紝鍙互璁剧疆涓簍rue涓存椂瀛樺偍鏈湴 + remote-as-local: false + + # oss瀹炵幇绫诲瀷锛歛ws_s3锛堜簹椹�婏級 | tx锛堣吘璁級 | ali锛堥樋閲岋級 | qn锛堜竷鐗涳級锛�2023-12-13 + oss-type: aws_s3 + # oss璁块棶鍓嶇紑锛屽锛歨ttp://localhost:8082/admin/oss/锛�2023-12-13 + oss-prefix: http://localhost:8082/admin/oss/ + oss-access-key: ENC(kLcOGmTADXxiDphSUZvMevg1Hw+mUhiX7w8Z7U1FQD8=) + oss-secret-key: ENC(w+UXEgJ4OhBqDdEP/ev6y4AisCUcUUAdDsUal24SvI1Ml8POKkIVlheaQn9qeo34) + # oss鏈嶅姟鍦板潃 + oss-endpoint: http://10.2.36.9:8080 + # oss榛樿鐨勬《鍚嶇О + oss-bucket-name: ctoms-file + + ftp: + ip: 116.198.40.76 + port: 22 + user-name: mysftp + password: ENC(zHTagUyi1g+/syVY8gVOww==) + private-key: + # ftp鏈嶅姟涓婇潰鐨勫瓨鍌ㄦ牴璺緞锛屽彧鑳芥槸linux璺緞 + # file-root: /files/ + file-root: /train/ + + # 鎺ュ彛鏂囨。鐢熸垚锛宻wagger3锛�2023-02-23 + swagger: + enable: false + # 鍖呰矾寰勶紝鏆傛椂涓嶇敤 + base-package: com.iplatform.base.controller + title: 浜戝師鐢熷井鏈嶅姟骞冲彴 + description: 涓�涓揩閫焪eb寮�鍙戞鏋� + + # TCP閫氫俊閰嶇疆锛�2024-01-23 + tcp: + # 鏄惁寮�鍚紩鎿� + enabled: true + # 鏄惁鎵撳紑蹇冭烦 + open-heart-beat: true + # 蹇冭烦鏃堕棿锛堢锛夛紝2023-08-28 + heart-beat-seconds: 60 + # 鏄惁鏄剧ず璇︾粏鏃ュ織 + show-log: false + # 璇锋眰闃熷垪绫诲瀷锛歮emory 鍩轰簬鍐呭瓨 + queue-type: memory + # tcp鏂瑰紡瑕佹壂鎻忕殑璇锋眰瀵硅薄鐨勫寘绌洪棿 + scan-packages-tcp: com.walker.tcp,com.iplatform.tcp + # websocket鏂瑰紡瑕佹壂鎻忕殑璇锋眰瀵硅薄鐨勫寘绌洪棿 + scan-packages-ws: com.iplatform.tcp.util.ws + # tcp闀胯繛鎺ョ殑绔彛 + port-tcp: 7878 + # websocket杩炴帴绔彛 + port-ws: 60001 + # websocket杩炴帴uri + websocket-uri: wss://ctomsuat.chinapost.com.cn/ws + # 閫氫俊绾跨▼鏁伴噺 + boss-thread-num: 2 + # 涓氬姟澶勭悊绾跨▼鏁伴噺 + worker-thread-num: 4 + # 鍚敤鑷畾涔夎繛鎺ョ鐞嗗櫒锛屽鏋渢rue鍒欎笟鍔¢渶瑕佹彁渚涜嚜瀹氫箟瀹炵幇锛堥厤缃級锛�2023-07-18 + custom-connection-manager: false + # 鏄惁寮�鍚泦缇ゆā寮忥紝杩炴帴绠$悊鍣ㄤ細榛樿鍔犺浇璐熻浇鏀寔锛�2023-09-26 + load-balance-enabled: false + # 闀胯繛鎺ヤ富鏈猴紙鏍囪锛変俊鎭紝鍙互鏄换鎰忓瓧绗︿覆锛屽彧瑕侀泦缇や腑姣忎釜鏈嶅姟閰嶇疆涓嶅悓鍗冲彲銆� + # 鍦ㄩ泦缇ゆā寮忎腑锛屾瘡涓繛鎺ヨ鍔犱笂涓绘満鏍囪瘑锛屼互渚垮埆浜烘帹閫佹秷鎭椂锛岀煡閬撳湪鍝釜涓绘満涓婃帹閫併��2023-09-19 + connection-host: topic_master + + # 鎺ㄩ�佹ā鍧楅厤缃紝2023-04-25 + push: + # 鐭俊鎺ㄩ�佽�呭悕绉帮細mock_sms_push锛堟ā鎷熺煭淇★級锛宎lidy_sms_push锛堥樋閲屽ぇ楸肩煭淇★級 + sms-push-name: alidy_sms_push + # 鐭俊楠岃瘉鐮佹ā鏉縄D锛屾牴鎹疄闄呮儏鍐碉紙姣忎釜骞冲彴鍙兘涓嶅悓锛� + sms-template-code: SMS_285145505 + + # 瀵逛簬涓�鑸笟鍔℃彁閱掞紙涓嶅寘鎷細閭欢銆佺煭淇★級锛屾帹閫佺殑鏂瑰紡銆傛帹閫佽�匢D缁勫悎 + # && 琛ㄧず骞跺垪锛寍| 琛ㄧず鎴栵紙鍙涓�涓垚鍔熷氨OK锛� + # 2023-04-26锛屽彲鐢ㄧ殑 id = 'tcp', 'web_socket', 'wx', 'system' + # message-type: tcp && web_socket && wx && system + # 濡傛灉鏄垨鑰呮柟寮忥紝闇�瑕佹妸鏈�鍙潬鐨勬斁鍓嶉潰锛屽洜涓虹郴缁熶細鎵惧埌绗竴涓彂閫佹垚鍔熷嵆鍙�� + message-type: system || tcp || web_socket || wx + + # 閭欢閫氱煡鍙戦�佷俊鎭厤缃紝2023-04-26 + mail-server: smtp.126.com + mail-from: hnzzzhsl@126.com + mail-password: ENC(8Xr7W72lyjRVi0InopfITw==) + + # 鑱婂ぉ鐩稿叧閰嶇疆锛�2023-07-07 + # chat: + # # 鏄惁鍚敤鏈哄櫒浜虹瓟澶嶏紝2023-07-12 + # robot-enabled: true + # # 鏈哄櫒浜哄叿浣撳疄鐜板璞★紝2023-07-12 + # robot-class: com.iplatform.chat.support.TestRobot + # # 鏄惁寮�鍚痬ongo瀛樺偍锛屽鏋渇alse鍒欓粯璁や娇鐢ㄦ暟鎹簱琛� + # mongo-enabled: true + # mongo: + # ip: 116.198.40.76 + # port: 27017 + # # 鑱婂ぉ鏁版嵁搴撳悕绉帮紝榛樿锛歝hat + # database: czt_ops_test + # user-name: czt_ops_test + # password: czt_ops_test + # max-size: 10 + # min-size: 2 + # # 杩炴帴鏈�澶х┖闂叉椂闂达紝20鍒嗛挓 + # max-idle-time-seconds: 1200 + # # 杩炴帴绛夊緟鏈�澶ф椂闂达紝10绉� + # max-wait-time-seconds: 10 + + # RestTemplate杩炴帴姹犻厤缃紝2023-08-18 + rest: + # 杩炴帴淇濇寔娲诲姩鏃堕棿锛岄粯璁わ細600绉� + keep-alive-duration-seconds: 600 + # 绌洪棽杩炴帴鏁伴噺锛岄粯璁わ細200涓� + max-idle-connections: 200 + # 杩炴帴瓒呮椂锛岄粯璁わ細2绉� + connect-timeout-seconds: 2 + # 璇昏秴鏃讹紝榛樿3绉� + read-timeout-seconds: 3 + # 鍐欒秴鏃讹紝榛樿3绉� + write-timeout-seconds: 3 + + # 闆嗙兢鏀寔鐩稿叧閰嶇疆锛�2023-09-29 + lb: + # 鏈満鏈嶅姟鑺傜偣ID锛屾瘡涓富鏈轰竴涓敮涓�鏁板瓧缂栧彿锛屼粠1寮�濮� + server-id: 8 + + # 2024-02-29 api鐩戞帶鐩稿叧 + api: + # 2024-02-29 鏄惁鎵撳紑鎺ュ彛鏃堕棿缁熻璁板綍锛屽鏋滐細true 鍒欎細璁板綍鎺ュ彛璋冪敤鏃堕棿锛屽啓鍏ヨ〃锛歴_api_time + time-enabled: false + + # 缃戦櫌缁熶竴璁よ瘉閰嶇疆閫夐」锛�2023-10-23 + unified: + # 鏄惁寮�鍚祴璇曟ā寮忥紝娴嬭瘯妯″紡鐢ㄤ簬鏈湴娴嬭瘯锛屾棤娉曡繛鎺ョ綉闄㈣璇佹帴鍙� + test-mode: false + # 缃戦櫌鎻愪緵鐨勮璇佸湴鍧�锛屽叧闂祴璇曟ā寮忓悗锛岃閫夐」鐢熸晥 + remote-url: http://10.5.6.105:8001/uaa/person/current + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# RocketMQ闃熷垪閰嶇疆锛�2023-09-26 +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +rocketmq: + # 鏈嶅姟鍦板潃锛屽涓敤閫楀彿鍒嗗紑 + # name-server: 116.198.40.76:9876 + name-server: 116.198.39.83:9898 + producer: + # 鍙戦�佹秷鎭秴鏃舵椂闂达紝榛樿3000 + send-message-timeout: 3000 + # 鐢熶骇鑰呯粍 + group: producer_group + # 鍙戦�佹秷鎭け璐ラ噸璇曟鏁帮紝榛樿2 + retryTimesWhenSendFailed: 2 + # 寮傛娑堟伅閲嶈瘯姝ゅ锛岄粯璁�2 + retryTimesWhenSendAsyncFailed: 2 + # 娑堟伅鏈�澶ч暱搴︼紝榛樿1024 * 1024 * 4(榛樿4M) + # 1024 * 128 = 128K + maxMessageSize: 131072 + # 鍘嬬缉娑堟伅闃堝�硷紝榛樿4k(1024 * 4) + compressMessageBodyThreshold: 4096 + # 鏄惁鍦ㄥ唴閮ㄥ彂閫佸け璐ユ椂閲嶈瘯鍙︿竴涓猙roker锛岄粯璁alse + retryNextServer: false + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# 闆嗕腑鍩硅涓氬姟鍣ㄩ厤缃紝2023-10-26 +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +ctoms: + # 璋冨害鍣ㄩ厤缃紝2023-10-26 + scheduler: + # 鏄惁鍏佽闆嗙兢妯″紡鍚敤锛� + # true锛氳〃绀洪泦缇ら儴缃诧紝鍒欎笟鍔℃墦鍖呭彂甯冧腑涓嶅寘鍚皟搴︽ā鍧楋紙ctoms-scheduler-server锛�,璋冨害妯″潡闇�瑕佺嫭绔嬫墦鍖咃紱 + # false锛氳〃绀哄崟鏈洪儴缃诧紝璋冨害妯″潡浼氳鑷姩鎵撳寘锛堜綔涓轰竴涓被搴擄級鍙戝竷锛� + cluster-enabled: false + # 鍙戝竷绫诲瀷锛� + # single锛氫笟鍔″崟搴旂敤鎵撳寘锛岀洿鎺ヨ兘杩愯璋冨害浠诲姟 + # scheduler锛氳皟搴︿换鍔″寘锛堢嫭绔嬫墦鍖呮敮鎸侀泦缇わ級 + deploy-type: single +# push-url: "https://push.cpoc.cn/sendv2" #浜掕仈缃� + push-url: "http://10.5.6.99:9001/sendv2" #缁煎悎缃� + link-app-url: "https://ctomsuat.chinapost.com.cn/ctoms-h5/#/?" #绉诲姩璺宠浆 + link-pc-url: "http://websocket:8083/tcp/" +# push-url: "http://push.cpoc.cn:9001/sendv2" #缁煎悎缃� diff --git a/iplatform-base-tcp/src/main/resources/application-line-prod.yml b/iplatform-base-tcp/src/main/resources/application-line-prod.yml new file mode 100644 index 0000000..eb5b4e1 --- /dev/null +++ b/iplatform-base-tcp/src/main/resources/application-line-prod.yml @@ -0,0 +1,480 @@ +# 瀵瑰簲閭斂鍐呯綉寮�鍙戠幆澧冮厤缃� +spring: + application: + name: deploy + datasource: + # 鏄惁鏄剧ずdao涓墦鍗扮殑SQL璇彞 + show-sql: true + + ## driver-class-name: sunje.goldilocks.jdbc.GoldilocksDriver + # 娉ㄦ剰锛歁ySQL鏈嶅姟绔紝闇�瑕佽皟鏁翠袱涓弬鏁帮紝鍚﹀垯鏈嶅姟绔細涓诲姩鏂紑杩炴帴 + # wait_timeout: 瓒呰繃鏀规椂闂�(绉�)鏈嶅姟绔富鍔ㄦ柇寮� + # interactive_timeout: 瀹㈡埛绔伐鍏蜂氦浜掕秴杩囪繖涓椂闂�(绉�)浼氱鍙o紝琛ㄧ幇涓簄avicat + + username: cent_glyyb_ctoms_sc_user + password: ENC(Z/HgOaZnJvhO9EiwCu71jA==) + url: jdbc:postgresql://10.1.153.107:11004/cent_ctoms_sc_db?currentSchema=cent_glyyb_ctoms_sc_schema&targetServerType=primary&useUnicode=true&characterEncoding=UTF-8&useSSL=false&stringtype=unspecified + + # username: root + # url: jdbc:mysql://116.198.40.76:3306/iplatform?useUnicode=true&characterEncoding=UTF-8&useSSL=false + + # 杈炬ⅵ鏁版嵁搴� + # driver-class-name: dm.jdbc.driver.DmDriver + # username: iplatform + # url: jdbc:dm://116.198.39.83:5236?schema=iplatform + + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # 浣跨敤 Hikari 杩炴帴姹� + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # type: com.walker.jdbc.ds.DefaultDataSource + # hikari: + # minimum-idle: 5 + # idle-timeout: 600000 + # pool-name: databasePool_walker + # # 杩炴帴鏈�澶ц秴鏃舵椂闂� + # connection-timeout: 30000 + # # 杩炴帴姹犳渶澶ф暟閲� + # maximum-pool-size: 10 + # # 鎺у埗姹犱腑杩炴帴鏈�澶х敓瀛樻湡 + # # max-lifetime: 70000 + # # 姝ゅ睘鎬ф帶鍒舵祴璇曡繛鎺ユ槸鍚︽椿璺冪殑鏈�闀挎椂闂淬�傛鍊煎繀椤诲皬浜� connectionTimeout + # validation-timeout: 10000 + # # + # connection-test-query: select 1 + + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # 浣跨敤 Druid 杩炴帴姹� + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + type: com.walker.jdbc.ds.MyDruidDataSource +# type: com.ctoms.base.support.PostgresqlClusterDataSource + druid: + initial-size: 5 + min-idle: 10 + max-active: 20 + # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂� + max-wait: 60000 + # 閰嶇疆闂撮殧澶氫箙鎵嶈繘琛屼竴娆℃娴嬶紝妫�娴嬮渶瑕佸叧闂殑绌洪棽杩炴帴锛屽崟浣嶆槸姣 + time-between-eviction-runs-millis: 60000 + # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�灏忕敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣 瓒呰繃杩欎釜鏃堕棿姣忔浼氬洖鏀堕粯璁�3涓繛鎺� + min-evictable-idle-time-millis: 30000 + # 绾夸笂閰嶇疆鐨刴ysql鏂紑闂茬疆杩炴帴鏃堕棿涓�1灏忔椂,鏁版嵁婧愰厤缃洖鏀舵椂闂翠负3鍒嗛挓,浠ユ渶鍚庝竴娆℃椿璺冩椂闂村紑濮嬬畻 + max-evictable-idle-time-millis: 180000 + validation-query: select 1 + test-while-idle: true + test-on-borrow: false + test-on-return: false + pool-prepared-statements: true + max-open-prepared-statements: 100 + use-global-data-source-stat: true + webStatFilter: + enabled: false + statViewServlet: + enabled: false + # 璁剧疆鐧藉悕鍗曪紝涓嶅~鍒欏厑璁告墍鏈夎闂� + # allow: + # url-pattern: /druid/* + # # 鎺у埗鍙扮鐞嗙敤鎴峰悕鍜屽瘑鐮� + # login-username: ruoyi + filter: + stat: + enabled: false + # 鎱QL璁板綍 + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: true + wall: + config: + multi-statement-allow: false + + redis: + host: 10.2.38.137 + port: 32157 + password: ENC(Kzn/kublbAelEFPfxxw8DZoNqudtoNUpUb/AOl1/s60=) + # 鍐呯綉鐜涓嶈璇ュ弬鏁帮紝2023-11-10 + # database: 2 + + mvc: + pathmatch: + # 鍔犺閰嶇疆鏄洜涓� swagger3 鍚姩鎶ラ敊锛�2023-02-23 + matching-strategy: ant_path_matcher + + hiddenmethod: + filter: + enabled: true # 鍔犱笂璇ラ厤缃彲浠ユ帴鏀�: application/x-www-form-urlencoded璇锋眰鍙傛暟涓哄璞°�傛敮浠橀�氱煡涓娇鐢ㄣ��2023-02-26 + + servlet: + multipart: + # maxFileSize 鏄崟涓枃浠跺ぇ灏� + # maxRequestSize鏄缃�讳笂浼犵殑鏁版嵁澶у皬 + enabled: true + max-file-size: 5MB + max-request-size: 10MB + +server: + port: 8083 + servlet: + context-path: /tcp + session: + timeout: 30m + +logging: + level: + root: info + org: + springframework: info + io.swagger: error + com: + walker: debug + iplatform: debug + ctoms: debug + RocketmqRemoting: error # MQ鎵撳嵃璇ユ棩蹇楋紝鐩墠娌℃湁鎵惧埌瑙e喅璧勬枡銆�2023-09-27 + charset: + # 鎺у埗鍙扮紪鐮� + console: UTF-8 + # 杈撳嚭鏂囦欢缂栫爜 + file: UTF-8 + + # file: # logging.file.path 鍜� logging.file.name锛屽彧浼氭湁涓�涓敓鏁堬紝閰嶄簡path涓嶈閰峮ame锛岄厤浜唍ame涓嶈閰峱ath锛屽彧閰峱ath鏃秐ame榛樿涓簊pring.log锛屾兂璺緞鍜屾枃浠跺悕鍚屾椂鐢熸晥鍙厤缃甽ogging.file.name=d:/logs/mylog.log + # name: ${spring.application.name}.log #鏃ュ織鏂囦欢鍚� + # path: logs #鏃ュ織瀛樺偍璺緞 + # max-history: 30 #淇濈暀澶氬皯澶╃殑鏃ュ織 + # max-size: 10MB + # pattern: + # rolling-file-name: ${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz + logback: + rollingpolicy: + # 鍗曚釜鏂囦欢鏈�澶т负30MB锛岃秴杩囦箣鍚庝細鎵撳寘鎴愪竴涓棩蹇楁枃浠� + max-file-size: 10MB + # 鏂囦欢淇濆瓨7澶� + max-history: 1 + # 鎵撳寘鏂囦欢鏍煎紡,榛樿锛� ${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz,涔﹀啓鏍煎紡涓猴細鏂囦欢璺緞/鏂囦欢鍚�.%i.鏂囦欢鍚庣紑,鍏朵腑%i涓嶅彲鐪佸幓锛屽惁鍒欐棤鏃ュ織鏄剧ず + # 渚嬪锛� 鏃ユ湡涓猴細2023/07/13 ,鍒欐墦鍖呮枃浠朵箣鍚庝负锛� log/ota.2023-07-13.0.gz,0琛ㄧず鏃ュ織鐨勭涓�閮ㄥ垎锛屽悗缁氨鏄紝1,2,3... + # 濡傛灉鏄帇缂╁寘锛岄噷闈細澶氫竴涓悕log/ota.2023-07-13.0鐨勬棩蹇楁枃浠� + # 濡備笅闈㈢殑渚嬪瓙锛屾墦鍖呬箣鍚庝负: log/2023-07/ota.2020-07-13.0.log锛岃繖鏄竴涓棩蹇楁枃浠� + file-name-pattern: ${logging.file.path}%d{yyyy-MM}/iplatform-tcp.%d{yyyy-MM-dd}.%i.log + + file: + name: ${logging.file.path}iplatform-tcp.log + path: D:/log/ + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# 骞冲彴閰嶇疆鏀寔鍔熻兘 +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +iplatform: + + # 骞冲彴缂撳瓨锛屾槸鍚﹀惎鐢╮edis缂撳瓨锛岄粯璁や娇鐢ㄥ熀浜庡唴瀛樼紦瀛�. + # 娉ㄦ剰锛氬鏋滃紑鍚痳edis缂撳瓨锛屼笟鍔″伐绋嬪繀椤讳緷璧�(walker-support-redis) + cache: + redis-enabled: true + # redis 缂撳瓨鏄惁瑕侀噸寤猴紝濡傛灉璁剧疆 true锛屽垯绯荤粺鍚姩鍚庝細鍒犻櫎缂撳瓨锛屽苟鎵ц榛樿閲嶆柊鍔犺浇鏂规硶銆�2023-08-26 + # 娉ㄦ剰锛氳鍙傛暟涓�鑸湪娴嬭瘯闃舵浣跨敤锛屾寮忕幆澧冧笉瑕佷娇鐢紒 + redis-rebuild: false + # 鏈烘瀯鐢ㄦ埛鏄惁寰堝簽澶э紝濡傛灉鏄垯缂撳瓨涓細鍏抽棴鍒濆鍖栧姞杞斤紝鍚屾椂鏈烘瀯鏍戜篃涓嶄細鏀惧叆缂撳瓨锛�2023-07-17 + org-user-big: true + # 鍗曠嫭鍔犺浇鏈烘瀯 + org-alone-big: true + # 鐩镐技搴﹀垎鏋愭ā鍧椾娇鐢�(宸插簾寮�) + # similarity: + # # 鏄惁鍚敤鐩镐技搴︽ā鍧楋紝濡傛灉绂佺敤鍒欒纭繚娉ㄥ叆鏃舵敮鎸佷负绌� + # enabled: false + # milvus-host: 172.16.60.65 + # milvus-port: 19530 + # word-file: d:/dev_tools/ai/w2v_sogou_dim300_vocab.txt + # embedding-file: d:/dev_tools/ai/w2v_sogou_dim300.npy + + # 璋冨害鍣ㄦā鍧楋紝鏄惁鍚敤 + scheduler: + enabled: false + # 鏄惁鏀寔鏁版嵁搴撳瓨鍌ㄤ换鍔�(搴熷純璇ラ厤缃�) + database-enabled: false + + # 鏁版嵁閲囬泦妯″潡 + gather: + enabled: false + + # 鏉冮檺鎺у埗鐩稿叧 + security: + # 鍖垮悕鍙闂湴鍧�(寮�鏀惧湴鍧�) + anonymous-list: + - /login + - /register + - /captcha/* # 楠岃瘉鐮佺粺涓�鏀惧紑 + - /test/** # 寮�鍙戞祴璇曪紝浠呭紑鍙戞澘鍙敤 + - /template/ctoms/** + - /swagger-resources/** # swagger + - /swagger-ui/** # swagger + - /v3/** # swagger + - /pay/notify/** # 鏀粯閫氱煡 + - /jmreport/** # 绉湪鎶ヨ〃 + - /file/** # 鐧诲綍鐢ㄦ埛鍙闂郴缁熸枃浠讹紝2023-06-09 + - /third_party/unified/** # 绯荤粺绗笁鏂圭櫥褰曞湴鍧�锛屽墠绔幏鍙栫綉闄oken鍚庯紝璋冪敤鍚庡彴鍦板潃瀹炵幇闅愬紡鐧诲綍锛�2023-10-23 + + + # 鍏佽鎵�鏈夎璇佺敤鎴烽兘鍙闂湴鍧�锛岃鎱庨噸鍚﹀垯鏉冮檺閮借繃澶э紝涓�鑸珹PI閮藉簲璇ヨ缃湪杩欓噷 + permit-list: + # - /permit # 鍏敤鏉冮檺锛�2023-03-13锛屽钩鍙颁唬鐮佸凡缁忔坊鍔犺繃浜嗭紝杩欓噷涓嶉渶瑕侀厤缃� + - /getInfo + - /getRouters + - /getMenus # 鏂扮晫闈㈣彍鍗曪紝2023-05-12 + - /logout + - /api/** + - /dqyy/** #妗f湡棰勭害 + - /pxjd/** #鍩硅璧勬簮 + - /tr/** #鏁欏笀 + - /base/** #鍩哄湴 + - /bjgl/class/** #鐝骇绠$悊 + - /app/** #app + - /system/** #骞冲彴绯荤粺 + - /report/** #璐圭敤姹囨�� + - /settlement/** #璐圭敤姹囨�昏褰� + - /door/** #闂ㄦ埛 + + # 瓒呯骇绠$悊鍛樺瘑鐮侊紝鍔犲瘑鍚庣殑绉樻枃 + supervisor-password: ENC(5hx5es5ySh5vySqCDFb61o1vhDVyOiA+gOBwkHjW1TbyUQwVWOVgKY+KUBOynTxOVDFFwGULPdCT8S4pJaSjGQ==) + + # 鏄惁鍏佽閰嶇疆璺ㄥ煙鍝嶅簲澶�, true 鍚敤锛� false 涓嶅惎鐢ㄣ��2022-12-28 + # 鍦℅ateway妯″紡涓紝闇�瑕佸叧闂法鍩熼厤缃紝鍥犱负缃戝叧涔熶細閰嶇疆銆� + cors-enabled: true + + # 鐢ㄦ埛鍚嶅瘑鐮佹柟寮忕櫥褰曪紝閰嶇疆鐨勯獙璇佺爜绫诲瀷锛歝ode/sms/slide/jigsaw锛�2023-03-14 + login-captcha-user-pass: code + # 鎵嬫満楠岃瘉鐮佹柟寮忕櫥褰曪紝閰嶇疆鐨勯獙璇佺爜绫诲瀷锛歝ode/sms/slide/jigsaw锛�2023-03-14 + login-captcha-sms-code: sms + + # 鏄惁鍏佽鍚庡彴鐢ㄦ埛锛堥潪App锛夌櫥褰曟墜鏈虹锛�2023-03-20 + allow-pc-user-access-app: true + + # 鏄惁鏀寔鎵嬫満鐧诲綍鏃讹紙涓嶅瓨鍦ㄦ墜鏈哄彿锛夌洿鎺ユ敞鍐岋紵鐩墠鐢靛晢绯荤粺鏀寔! 2023-06-26 + allow-mobile-login-reg: true + + # PC绔痶oken澶辨晥鍒嗛挓锛岄粯璁わ細120鍒嗛挓锛�2023-03-28 + token-expire-web: 120 + # 绉诲姩绔痶oken澶辨晥鍒嗛挓锛�2023-03-28 + token-expire-mobile: 120 + + # 鐢ㄦ埛浣撶郴锛堢敤鎴峰悕锛夐兘鏄墜鏈哄彿锛�2023-06-28 + # 涓�鑸郴缁烶C绔�氬父閮戒笉鏄墜鏈哄彿浣滀负鐢ㄦ埛鍚嶏紝鍙湁鍦ㄤ簰鑱旂綉鐩稿叧绯荤粺涓細瀛樺湪鎵嬫満鍙蜂綔涓虹櫥褰曡处鍙� + user-name-is-phone: false + + # 2023-07-11 鐧诲綍绛栫暐閰嶇疆锛屽垪琛ㄤ腑瀛樺湪鐨勭瓥鐣ラ兘琛ㄧず鍚敤锛堜笉鍚敤鐨勫垹鎺夛級 + login-strategy-list: + # - com.iplatform.base.support.strategy.WebOnceLoginStrategy ##鍚屼竴璐﹀彿鍙兘鐧诲綍涓�涓猧p + # - com.iplatform.base.support.strategy.MobileOnceLoginStrategy + + # 鐢ㄦ埛鐩稿叧瀹夊叏閰嶇疆锛�2023-08-03 + user: + # 鐢ㄦ埛淇敼瀵嗙爜绛夌骇锛屽垎鍥涚骇锛�1-2-3-4锛屽父閲忥細PasswordUtils# + pass-level: 1 + # 鏄惁寮哄埗鐢ㄦ埛淇敼榛樿瀵嗙爜锛� + pass-default-modify: false + + # 浠g爜鐢熸垚锛�2022-11-26 + gen: + # 浣滆�� + author: Mike + # 榛樿鐢熸垚鍖呰矾寰� system 闇�鏀规垚鑷繁鐨勬ā鍧楀悕绉� 濡� system monitor tool + package-name: com.iplatform.model.po + # 鑷姩鍘婚櫎琛ㄥ墠缂�锛岄粯璁ゆ槸false + auto-remove-pre: false + # 琛ㄥ墠缂�锛堢敓鎴愮被鍚嶄笉浼氬寘鍚〃鍓嶇紑锛屽涓敤閫楀彿鍒嗛殧锛� + table-prefix: s_ + + log: + # 鏄惁鎵撳紑鐧诲綍鏃ュ織锛�2023-01-05 + # 濡傛灉涓嶆墦寮�锛屽垯璁惧鐧诲綍鐨剈uid鏇存柊鎿嶄綔涔熸棤娉曡幏寰楋紝鐢ㄤ簬璁板綍姣忎釜鐧诲綍鐢ㄦ埛鐨剈uid锛堢敤鎴风櫥褰曡鑹叉洿鏂帮級锛�2023-03-23 + login-enabled: true + # 鏄惁鎵撳紑鎿嶄綔鏃ュ織锛�2023-01-05 + operate-enabled: false + + # 楠岃瘉鐮佺浉鍏抽厤缃紝2023-01-27 + captcha: + # 鍥惧舰楠岃瘉鐮佸疄鐜扮被, TextCaptchaProvider | DefaultCaptchaProvider + image-captcha-class: com.iplatform.base.captcha.TextCaptchaProvider + # 鐭俊楠岃瘉鐮佸疄鐜扮被锛堥厤缃簾寮冿紝2023-04-25锛� + sms-captcha-class: com.iplatform.base.captcha.MockSmsCaptchaProvider + + # 骞冲彴鏂囦欢瀛樺偍閰嶇疆锛�2023-02-15 + file: + # FileStoreType = FileSystem 鏈湴纾佺洏瀛樺偍鏍硅矾寰� + file-root: d:/tmp/ + # 璋冪敤杩滅▼涓婁紶鏂囦欢锛屾槸鍚︽寜鐓ф湰鍦版枃浠跺鐞嗭紝2023-07-03 + # 鍦ㄦ祴璇曡繃绋嬩腑濡傛灉娌℃湁FTP绛夋湇鍔★紝鍙互璁剧疆涓簍rue涓存椂瀛樺偍鏈湴 + remote-as-local: false + + # oss瀹炵幇绫诲瀷锛歛ws_s3锛堜簹椹�婏級 | tx锛堣吘璁級 | ali锛堥樋閲岋級 | qn锛堜竷鐗涳級锛�2023-12-13 + oss-type: aws_s3 + # oss璁块棶鍓嶇紑锛屽锛歨ttp://localhost:8082/admin/oss/锛�2023-12-13 + oss-prefix: http://localhost:8082/admin/oss/ + oss-access-key: 5YOZCZF4AFDGJBAFEFF9 + oss-secret-key: aE3EXCkMflK5VtOZeAI1ySX7acWoPB1KhOBOPGgf + # oss鏈嶅姟鍦板潃 + oss-endpoint: http://10.2.36.9:8080 + # oss榛樿鐨勬《鍚嶇О + oss-bucket-name: ctoms-file + + ftp: + ip: 116.198.40.76 + port: 22 + user-name: mysftp + password: + private-key: + # ftp鏈嶅姟涓婇潰鐨勫瓨鍌ㄦ牴璺緞锛屽彧鑳芥槸linux璺緞 + # file-root: /files/ + file-root: /train/ + + # 鎺ュ彛鏂囨。鐢熸垚锛宻wagger3锛�2023-02-23 + swagger: + enable: false + # 鍖呰矾寰勶紝鏆傛椂涓嶇敤 + base-package: com.iplatform.base.controller + title: 浜戝師鐢熷井鏈嶅姟骞冲彴 + description: 涓�涓揩閫焪eb寮�鍙戞鏋� + + # TCP閫氫俊閰嶇疆锛�2024-01-23 + tcp: + # 鏄惁寮�鍚紩鎿� + enabled: true + # 鏄惁鎵撳紑蹇冭烦 + open-heart-beat: true + # 蹇冭烦鏃堕棿锛堢锛夛紝2023-08-28 + heart-beat-seconds: 60 + # 鏄惁鏄剧ず璇︾粏鏃ュ織 + show-log: false + # 璇锋眰闃熷垪绫诲瀷锛歮emory 鍩轰簬鍐呭瓨 + queue-type: memory + # tcp鏂瑰紡瑕佹壂鎻忕殑璇锋眰瀵硅薄鐨勫寘绌洪棿 + scan-packages-tcp: com.walker.tcp,com.iplatform.tcp + # websocket鏂瑰紡瑕佹壂鎻忕殑璇锋眰瀵硅薄鐨勫寘绌洪棿 + scan-packages-ws: com.iplatform.tcp.util.ws + # tcp闀胯繛鎺ョ殑绔彛 + port-tcp: 7878 + # websocket杩炴帴绔彛 + port-ws: 60001 + # websocket杩炴帴uri + websocket-uri: wss://ctoms.chinapost.com.cn/ws + # 閫氫俊绾跨▼鏁伴噺 + boss-thread-num: 2 + # 涓氬姟澶勭悊绾跨▼鏁伴噺 + worker-thread-num: 4 + # 鍚敤鑷畾涔夎繛鎺ョ鐞嗗櫒锛屽鏋渢rue鍒欎笟鍔¢渶瑕佹彁渚涜嚜瀹氫箟瀹炵幇锛堥厤缃級锛�2023-07-18 + custom-connection-manager: false + # 鏄惁寮�鍚泦缇ゆā寮忥紝杩炴帴绠$悊鍣ㄤ細榛樿鍔犺浇璐熻浇鏀寔锛�2023-09-26 + load-balance-enabled: false + # 闀胯繛鎺ヤ富鏈猴紙鏍囪锛変俊鎭紝鍙互鏄换鎰忓瓧绗︿覆锛屽彧瑕侀泦缇や腑姣忎釜鏈嶅姟閰嶇疆涓嶅悓鍗冲彲銆� + # 鍦ㄩ泦缇ゆā寮忎腑锛屾瘡涓繛鎺ヨ鍔犱笂涓绘満鏍囪瘑锛屼互渚垮埆浜烘帹閫佹秷鎭椂锛岀煡閬撳湪鍝釜涓绘満涓婃帹閫併��2023-09-19 + connection-host: topic_master + + # 鎺ㄩ�佹ā鍧楅厤缃紝2023-04-25 + push: + # 鐭俊鎺ㄩ�佽�呭悕绉帮細mock_sms_push锛堟ā鎷熺煭淇★級锛宎lidy_sms_push锛堥樋閲屽ぇ楸肩煭淇★級 + sms-push-name: alidy_sms_push + # 鐭俊楠岃瘉鐮佹ā鏉縄D锛屾牴鎹疄闄呮儏鍐碉紙姣忎釜骞冲彴鍙兘涓嶅悓锛� + sms-template-code: SMS_285145505 + + # 瀵逛簬涓�鑸笟鍔℃彁閱掞紙涓嶅寘鎷細閭欢銆佺煭淇★級锛屾帹閫佺殑鏂瑰紡銆傛帹閫佽�匢D缁勫悎 + # && 琛ㄧず骞跺垪锛寍| 琛ㄧず鎴栵紙鍙涓�涓垚鍔熷氨OK锛� + # 2023-04-26锛屽彲鐢ㄧ殑 id = 'tcp', 'web_socket', 'wx', 'system' + # message-type: tcp && web_socket && wx && system + # 濡傛灉鏄垨鑰呮柟寮忥紝闇�瑕佹妸鏈�鍙潬鐨勬斁鍓嶉潰锛屽洜涓虹郴缁熶細鎵惧埌绗竴涓彂閫佹垚鍔熷嵆鍙�� + message-type: system || tcp || web_socket || wx + + # 閭欢閫氱煡鍙戦�佷俊鎭厤缃紝2023-04-26 + mail-server: smtp.126.com + mail-from: hnzzzhsl@126.com + mail-password: + + # 鑱婂ぉ鐩稿叧閰嶇疆锛�2023-07-07 + # chat: + # # 鏄惁鍚敤鏈哄櫒浜虹瓟澶嶏紝2023-07-12 + # robot-enabled: true + # # 鏈哄櫒浜哄叿浣撳疄鐜板璞★紝2023-07-12 + # robot-class: com.iplatform.chat.support.TestRobot + # # 鏄惁寮�鍚痬ongo瀛樺偍锛屽鏋渇alse鍒欓粯璁や娇鐢ㄦ暟鎹簱琛� + # mongo-enabled: true + # mongo: + # ip: 116.198.40.76 + # port: 27017 + # # 鑱婂ぉ鏁版嵁搴撳悕绉帮紝榛樿锛歝hat + # database: czt_ops_test + # user-name: czt_ops_test + # password: czt_ops_test + # max-size: 10 + # min-size: 2 + # # 杩炴帴鏈�澶х┖闂叉椂闂达紝20鍒嗛挓 + # max-idle-time-seconds: 1200 + # # 杩炴帴绛夊緟鏈�澶ф椂闂达紝10绉� + # max-wait-time-seconds: 10 + + # RestTemplate杩炴帴姹犻厤缃紝2023-08-18 + rest: + # 杩炴帴淇濇寔娲诲姩鏃堕棿锛岄粯璁わ細600绉� + keep-alive-duration-seconds: 600 + # 绌洪棽杩炴帴鏁伴噺锛岄粯璁わ細200涓� + max-idle-connections: 200 + # 杩炴帴瓒呮椂锛岄粯璁わ細2绉� + connect-timeout-seconds: 2 + # 璇昏秴鏃讹紝榛樿3绉� + read-timeout-seconds: 3 + # 鍐欒秴鏃讹紝榛樿3绉� + write-timeout-seconds: 3 + + # 闆嗙兢鏀寔鐩稿叧閰嶇疆锛�2023-09-29 + lb: + # 鏈満鏈嶅姟鑺傜偣ID锛屾瘡涓富鏈轰竴涓敮涓�鏁板瓧缂栧彿锛屼粠1寮�濮� + server-id: 8 + + # 2024-02-29 api鐩戞帶鐩稿叧 + api: + # 2024-02-29 鏄惁鎵撳紑鎺ュ彛鏃堕棿缁熻璁板綍锛屽鏋滐細true 鍒欎細璁板綍鎺ュ彛璋冪敤鏃堕棿锛屽啓鍏ヨ〃锛歴_api_time + time-enabled: false + + # 缃戦櫌缁熶竴璁よ瘉閰嶇疆閫夐」锛�2023-10-23 + unified: + # 鏄惁寮�鍚祴璇曟ā寮忥紝娴嬭瘯妯″紡鐢ㄤ簬鏈湴娴嬭瘯锛屾棤娉曡繛鎺ョ綉闄㈣璇佹帴鍙� + test-mode: false + # 缃戦櫌鎻愪緵鐨勮璇佸湴鍧�锛屽叧闂祴璇曟ā寮忓悗锛岃閫夐」鐢熸晥 + remote-url: http://10.5.6.105:8001/uaa/person/current + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# RocketMQ闃熷垪閰嶇疆锛�2023-09-26 +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +rocketmq: + # 鏈嶅姟鍦板潃锛屽涓敤閫楀彿鍒嗗紑 + # name-server: 116.198.40.76:9876 + name-server: 116.198.39.83:9898 + producer: + # 鍙戦�佹秷鎭秴鏃舵椂闂达紝榛樿3000 + send-message-timeout: 3000 + # 鐢熶骇鑰呯粍 + group: producer_group + # 鍙戦�佹秷鎭け璐ラ噸璇曟鏁帮紝榛樿2 + retryTimesWhenSendFailed: 2 + # 寮傛娑堟伅閲嶈瘯姝ゅ锛岄粯璁�2 + retryTimesWhenSendAsyncFailed: 2 + # 娑堟伅鏈�澶ч暱搴︼紝榛樿1024 * 1024 * 4(榛樿4M) + # 1024 * 128 = 128K + maxMessageSize: 131072 + # 鍘嬬缉娑堟伅闃堝�硷紝榛樿4k(1024 * 4) + compressMessageBodyThreshold: 4096 + # 鏄惁鍦ㄥ唴閮ㄥ彂閫佸け璐ユ椂閲嶈瘯鍙︿竴涓猙roker锛岄粯璁alse + retryNextServer: false + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# 闆嗕腑鍩硅涓氬姟鍣ㄩ厤缃紝2023-10-26 +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +ctoms: + # 璋冨害鍣ㄩ厤缃紝2023-10-26 + scheduler: + # 鏄惁鍏佽闆嗙兢妯″紡鍚敤锛� + # true锛氳〃绀洪泦缇ら儴缃诧紝鍒欎笟鍔℃墦鍖呭彂甯冧腑涓嶅寘鍚皟搴︽ā鍧楋紙ctoms-scheduler-server锛�,璋冨害妯″潡闇�瑕佺嫭绔嬫墦鍖咃紱 + # false锛氳〃绀哄崟鏈洪儴缃诧紝璋冨害妯″潡浼氳鑷姩鎵撳寘锛堜綔涓轰竴涓被搴擄級鍙戝竷锛� + cluster-enabled: false + # 鍙戝竷绫诲瀷锛� + # single锛氫笟鍔″崟搴旂敤鎵撳寘锛岀洿鎺ヨ兘杩愯璋冨害浠诲姟 + # scheduler锛氳皟搴︿换鍔″寘锛堢嫭绔嬫墦鍖呮敮鎸侀泦缇わ級 + deploy-type: single +# push-url: "https://push.cpoc.cn/sendv2" #浜掕仈缃� + push-url: "http://10.5.6.99:9001/sendv2" #缁煎悎缃� + link-app-url: "https://ctoms.chinapost.com.cn/ctoms-h5/#/?" #绉诲姩璺宠浆 + link-pc-url: "http://websocket:8083/tcp/" +# push-url: "http://push.cpoc.cn:9001/sendv2" #缁煎悎缃� diff --git a/iplatform-base-tcp/src/main/resources/application-test.yml b/iplatform-base-tcp/src/main/resources/application-test.yml new file mode 100644 index 0000000..229fae3 --- /dev/null +++ b/iplatform-base-tcp/src/main/resources/application-test.yml @@ -0,0 +1,485 @@ +spring: + application: + name: deploy + datasource: + # 鏄惁鏄剧ずdao涓墦鍗扮殑SQL璇彞 + show-sql: true + + ## driver-class-name: sunje.goldilocks.jdbc.GoldilocksDriver + # 娉ㄦ剰锛歁ySQL鏈嶅姟绔紝闇�瑕佽皟鏁翠袱涓弬鏁帮紝鍚﹀垯鏈嶅姟绔細涓诲姩鏂紑杩炴帴 + # wait_timeout: 瓒呰繃鏀规椂闂�(绉�)鏈嶅姟绔富鍔ㄦ柇寮� + # interactive_timeout: 瀹㈡埛绔伐鍏蜂氦浜掕秴杩囪繖涓椂闂�(绉�)浼氱鍙o紝琛ㄧ幇涓簄avicat + + username: tbase + password: ENC(SDQnluhnbTXI2XBdvnpBMw==) + url: jdbc:postgresql://116.198.40.76:30004/ctoms-beifen?useUnicode=true&characterEncoding=UTF-8&useSSL=false&stringtype=unspecified + + # username: root + # password: Bjjmy_2020 + # url: jdbc:mysql://116.198.40.76:3306/iplatform?useUnicode=true&characterEncoding=UTF-8&useSSL=false + + # 杈炬ⅵ鏁版嵁搴� + # driver-class-name: dm.jdbc.driver.DmDriver + # username: iplatform + # password: iplatform + # url: jdbc:dm://116.198.39.83:5236?schema=iplatform + + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # 浣跨敤 Hikari 杩炴帴姹� + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # type: com.walker.jdbc.ds.DefaultDataSource + # hikari: + # minimum-idle: 5 + # idle-timeout: 600000 + # pool-name: databasePool_walker + # # 杩炴帴鏈�澶ц秴鏃舵椂闂� + # connection-timeout: 30000 + # # 杩炴帴姹犳渶澶ф暟閲� + # maximum-pool-size: 10 + # # 鎺у埗姹犱腑杩炴帴鏈�澶х敓瀛樻湡 + # # max-lifetime: 70000 + # # 姝ゅ睘鎬ф帶鍒舵祴璇曡繛鎺ユ槸鍚︽椿璺冪殑鏈�闀挎椂闂淬�傛鍊煎繀椤诲皬浜� connectionTimeout + # validation-timeout: 10000 + # # + # connection-test-query: select 1 + + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + # 浣跨敤 Druid 杩炴帴姹� + #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + type: com.walker.jdbc.ds.MyDruidDataSource + druid: + initial-size: 5 + min-idle: 10 + max-active: 20 + # 閰嶇疆鑾峰彇杩炴帴绛夊緟瓒呮椂鐨勬椂闂� + max-wait: 60000 + # 閰嶇疆闂撮殧澶氫箙鎵嶈繘琛屼竴娆℃娴嬶紝妫�娴嬮渶瑕佸叧闂殑绌洪棽杩炴帴锛屽崟浣嶆槸姣 + time-between-eviction-runs-millis: 60000 + # 閰嶇疆涓�涓繛鎺ュ湪姹犱腑鏈�灏忕敓瀛樼殑鏃堕棿锛屽崟浣嶆槸姣 瓒呰繃杩欎釜鏃堕棿姣忔浼氬洖鏀堕粯璁�3涓繛鎺� + min-evictable-idle-time-millis: 30000 + # 绾夸笂閰嶇疆鐨刴ysql鏂紑闂茬疆杩炴帴鏃堕棿涓�1灏忔椂,鏁版嵁婧愰厤缃洖鏀舵椂闂翠负3鍒嗛挓,浠ユ渶鍚庝竴娆℃椿璺冩椂闂村紑濮嬬畻 + max-evictable-idle-time-millis: 180000 + validation-query: select 1 + test-while-idle: true + test-on-borrow: false + test-on-return: false + pool-prepared-statements: true + max-open-prepared-statements: 100 + use-global-data-source-stat: true + webStatFilter: + enabled: false + statViewServlet: + enabled: false + # 璁剧疆鐧藉悕鍗曪紝涓嶅~鍒欏厑璁告墍鏈夎闂� + # allow: + # url-pattern: /druid/* + # # 鎺у埗鍙扮鐞嗙敤鎴峰悕鍜屽瘑鐮� + # login-username: ruoyi + filter: + stat: + enabled: false + # 鎱QL璁板綍 + log-slow-sql: true + slow-sql-millis: 1000 + merge-sql: true + wall: + config: + multi-statement-allow: false + + redis: + host: 116.198.40.76 + port: 6379 + password: ENC(VQ9j5YF08eKywBGZzMFq4g==) + # 鍐呯綉鐜涓嶈璇ュ弬鏁帮紝2023-11-10 + database: 2 + + mvc: + pathmatch: + # 鍔犺閰嶇疆鏄洜涓� swagger3 鍚姩鎶ラ敊锛�2023-02-23 + matching-strategy: ant_path_matcher + + hiddenmethod: + filter: + enabled: true # 鍔犱笂璇ラ厤缃彲浠ユ帴鏀�: application/x-www-form-urlencoded璇锋眰鍙傛暟涓哄璞°�傛敮浠橀�氱煡涓娇鐢ㄣ��2023-02-26 + + servlet: + multipart: + # maxFileSize 鏄崟涓枃浠跺ぇ灏� + # maxRequestSize鏄缃�讳笂浼犵殑鏁版嵁澶у皬 + enabled: true + max-file-size: 5MB + max-request-size: 10MB + +server: + port: 8088 + servlet: + context-path: /tcp + session: + timeout: 30m + +logging: + level: + root: info + org: + springframework: info + io.swagger: error + com: + walker: debug + iplatform: debug + ctoms: debug + RocketmqRemoting: error # MQ鎵撳嵃璇ユ棩蹇楋紝鐩墠娌℃湁鎵惧埌瑙e喅璧勬枡銆�2023-09-27 + charset: + # 鎺у埗鍙扮紪鐮� + console: UTF-8 + # 杈撳嚭鏂囦欢缂栫爜 + file: UTF-8 + + # file: # logging.file.path 鍜� logging.file.name锛屽彧浼氭湁涓�涓敓鏁堬紝閰嶄簡path涓嶈閰峮ame锛岄厤浜唍ame涓嶈閰峱ath锛屽彧閰峱ath鏃秐ame榛樿涓簊pring.log锛屾兂璺緞鍜屾枃浠跺悕鍚屾椂鐢熸晥鍙厤缃甽ogging.file.name=d:/logs/mylog.log + # name: ${spring.application.name}.log #鏃ュ織鏂囦欢鍚� + # path: logs #鏃ュ織瀛樺偍璺緞 + # max-history: 30 #淇濈暀澶氬皯澶╃殑鏃ュ織 + # max-size: 10MB + # pattern: + # rolling-file-name: ${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz + logback: + rollingpolicy: + # 鍗曚釜鏂囦欢鏈�澶т负30MB锛岃秴杩囦箣鍚庝細鎵撳寘鎴愪竴涓棩蹇楁枃浠� + max-file-size: 10MB + # 鏂囦欢淇濆瓨7澶� + max-history: 1 + # 鎵撳寘鏂囦欢鏍煎紡,榛樿锛� ${LOG_FILE}.%d{yyyy-MM-dd}.%i.gz,涔﹀啓鏍煎紡涓猴細鏂囦欢璺緞/鏂囦欢鍚�.%i.鏂囦欢鍚庣紑,鍏朵腑%i涓嶅彲鐪佸幓锛屽惁鍒欐棤鏃ュ織鏄剧ず + # 渚嬪锛� 鏃ユ湡涓猴細2023/07/13 ,鍒欐墦鍖呮枃浠朵箣鍚庝负锛� log/ota.2023-07-13.0.gz,0琛ㄧず鏃ュ織鐨勭涓�閮ㄥ垎锛屽悗缁氨鏄紝1,2,3... + # 濡傛灉鏄帇缂╁寘锛岄噷闈細澶氫竴涓悕log/ota.2023-07-13.0鐨勬棩蹇楁枃浠� + # 濡備笅闈㈢殑渚嬪瓙锛屾墦鍖呬箣鍚庝负: log/2023-07/ota.2020-07-13.0.log锛岃繖鏄竴涓棩蹇楁枃浠� + file-name-pattern: ${logging.file.path}%d{yyyy-MM}/iplatform-tcp.%d{yyyy-MM-dd}.%i.log + + file: + name: ${logging.file.path}iplatform-tcp.log + path: D:/log/ + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# 骞冲彴閰嶇疆鏀寔鍔熻兘 +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +iplatform: + + # 骞冲彴缂撳瓨锛屾槸鍚﹀惎鐢╮edis缂撳瓨锛岄粯璁や娇鐢ㄥ熀浜庡唴瀛樼紦瀛�. + # 娉ㄦ剰锛氬鏋滃紑鍚痳edis缂撳瓨锛屼笟鍔″伐绋嬪繀椤讳緷璧�(walker-support-redis) + cache: + redis-enabled: true + # redis 缂撳瓨鏄惁瑕侀噸寤猴紝濡傛灉璁剧疆 true锛屽垯绯荤粺鍚姩鍚庝細鍒犻櫎缂撳瓨锛屽苟鎵ц榛樿閲嶆柊鍔犺浇鏂规硶銆�2023-08-26 + # 娉ㄦ剰锛氳鍙傛暟涓�鑸湪娴嬭瘯闃舵浣跨敤锛屾寮忕幆澧冧笉瑕佷娇鐢紒 + redis-rebuild: true + # 鏈烘瀯鐢ㄦ埛鏄惁寰堝簽澶э紝濡傛灉鏄垯缂撳瓨涓細鍏抽棴鍒濆鍖栧姞杞斤紝鍚屾椂鏈烘瀯鏍戜篃涓嶄細鏀惧叆缂撳瓨锛�2023-07-17 + org-user-big: true + # 鍗曠嫭鍔犺浇鏈烘瀯 + org-alone-big: true + # 鐩镐技搴﹀垎鏋愭ā鍧椾娇鐢�(宸插簾寮�) + # similarity: + # # 鏄惁鍚敤鐩镐技搴︽ā鍧楋紝濡傛灉绂佺敤鍒欒纭繚娉ㄥ叆鏃舵敮鎸佷负绌� + # enabled: false + # milvus-host: 172.16.60.65 + # milvus-port: 19530 + # word-file: d:/dev_tools/ai/w2v_sogou_dim300_vocab.txt + # embedding-file: d:/dev_tools/ai/w2v_sogou_dim300.npy + + # 璋冨害鍣ㄦā鍧楋紝鏄惁鍚敤 + scheduler: + enabled: false + # 鏄惁鏀寔鏁版嵁搴撳瓨鍌ㄤ换鍔�(搴熷純璇ラ厤缃�) + database-enabled: false + + # 鏁版嵁閲囬泦妯″潡 + gather: + enabled: false + + security: + # 鍖垮悕鍙闂湴鍧�(寮�鏀惧湴鍧�) + anonymous-list: + - /login + - /register + - /captcha/* # 楠岃瘉鐮佺粺涓�鏀惧紑 + - /test/** # 寮�鍙戞祴璇曪紝浠呭紑鍙戞澘鍙敤 + - /template/ctoms/** + - /swagger-resources/** # swagger + - /swagger-ui/** # swagger + - /v3/** # swagger + - /pay/notify/** # 鏀粯閫氱煡 + - /jmreport/** # 绉湪鎶ヨ〃 + - /file/** # 鐧诲綍鐢ㄦ埛鍙闂郴缁熸枃浠讹紝2023-06-09 + - /third_party/unified/** # 绯荤粺绗笁鏂圭櫥褰曞湴鍧�锛屽墠绔幏鍙栫綉闄oken鍚庯紝璋冪敤鍚庡彴鍦板潃瀹炵幇闅愬紡鐧诲綍锛�2023-10-23 + - /door/** + - /oss/** # 娴嬭瘯浣跨敤锛屾寮忓簲閰嶇疆鍒皃ermit涓嬶紝2023-12-13 + # 鍏佽鎵�鏈夎璇佺敤鎴烽兘鍙闂湴鍧�锛岃鎱庨噸鍚﹀垯鏉冮檺閮借繃澶э紝涓�鑸珹PI閮藉簲璇ヨ缃湪杩欓噷 + permit-list: + # - /permit # 鍏敤鏉冮檺锛�2023-03-13锛屽钩鍙颁唬鐮佸凡缁忔坊鍔犺繃浜嗭紝杩欓噷涓嶉渶瑕侀厤缃� + - /getInfo + - /getRouters + - /getMenus # 鏂扮晫闈㈣彍鍗曪紝2023-05-12 + - /logout + - /api/** + - /dqyy/** #妗f湡棰勭害 + - /pxjd/** #鍩硅璧勬簮 + - /tr/** #鏁欏笀 + - /base/** #鍩哄湴 + - /bjgl/class/** #鐝骇绠$悊 + - /app/** #app + - /system/** #骞冲彴绯荤粺 + - /report/** #璐圭敤姹囨�� + - /settlement/** #璐圭敤姹囨�昏褰� + - /resource/** #璧勬簮 + - /evaluation/** #鏁欏璇勪及 + - /stat/workload/** #鏍″唴甯堣祫宸ヤ綔閲� + - /bjgl/bus/** #鎺ラ�佺珯 + - /all/base/statistics/** #鍏ㄧ綉缁熻 + + # 瓒呯骇绠$悊鍛樺瘑鐮侊紝鍔犲瘑鍚庣殑绉樻枃 + supervisor-password: ENC(i2QGr3kEu49MbMrW7dR+Q7jiPn1WpeuIbCfemGkhy+aMTamfXxrmKyS6j4GqG2TDm/7MTF8Q/+xqQB5pvy6rqA==) + + # 鏄惁鍏佽閰嶇疆璺ㄥ煙鍝嶅簲澶�, true 鍚敤锛� false 涓嶅惎鐢ㄣ��2022-12-28 + # 鍦℅ateway妯″紡涓紝闇�瑕佸叧闂法鍩熼厤缃紝鍥犱负缃戝叧涔熶細閰嶇疆銆� + cors-enabled: true + + # 鐢ㄦ埛鍚嶅瘑鐮佹柟寮忕櫥褰曪紝閰嶇疆鐨勯獙璇佺爜绫诲瀷锛歝ode/sms/slide/jigsaw锛�2023-03-14 + login-captcha-user-pass: code + # 鎵嬫満楠岃瘉鐮佹柟寮忕櫥褰曪紝閰嶇疆鐨勯獙璇佺爜绫诲瀷锛歝ode/sms/slide/jigsaw锛�2023-03-14 + login-captcha-sms-code: sms + + # 鏄惁鍏佽鍚庡彴鐢ㄦ埛锛堥潪App锛夌櫥褰曟墜鏈虹锛�2023-03-20 + allow-pc-user-access-app: true + + # 鏄惁鏀寔鎵嬫満鐧诲綍鏃讹紙涓嶅瓨鍦ㄦ墜鏈哄彿锛夌洿鎺ユ敞鍐岋紵鐩墠鐢靛晢绯荤粺鏀寔! 2023-06-26 + allow-mobile-login-reg: true + + # PC绔痶oken澶辨晥鍒嗛挓锛岄粯璁わ細120鍒嗛挓锛�2023-03-28 + token-expire-web: 120 + # 绉诲姩绔痶oken澶辨晥鍒嗛挓锛�2023-03-28 + token-expire-mobile: 120 + + # 鐢ㄦ埛浣撶郴锛堢敤鎴峰悕锛夐兘鏄墜鏈哄彿锛�2023-06-28 + # 涓�鑸郴缁烶C绔�氬父閮戒笉鏄墜鏈哄彿浣滀负鐢ㄦ埛鍚嶏紝鍙湁鍦ㄤ簰鑱旂綉鐩稿叧绯荤粺涓細瀛樺湪鎵嬫満鍙蜂綔涓虹櫥褰曡处鍙� + user-name-is-phone: false + + # 2023-07-11 鐧诲綍绛栫暐閰嶇疆锛屽垪琛ㄤ腑瀛樺湪鐨勭瓥鐣ラ兘琛ㄧず鍚敤锛堜笉鍚敤鐨勫垹鎺夛級 + login-strategy-list: + # - com.iplatform.base.support.strategy.WebOnceLoginStrategy ##鍚屼竴璐﹀彿鍙兘鐧诲綍涓�涓猧p + # - com.iplatform.base.support.strategy.MobileOnceLoginStrategy + + # 鐢ㄦ埛鐩稿叧瀹夊叏閰嶇疆锛�2023-08-03 + user: + # 鐢ㄦ埛淇敼瀵嗙爜绛夌骇锛屽垎鍥涚骇锛�1-2-3-4锛屽父閲忥細PasswordUtils# + pass-level: 1 + # 鏄惁寮哄埗鐢ㄦ埛淇敼榛樿瀵嗙爜锛� + pass-default-modify: false + + # 浠g爜鐢熸垚锛�2022-11-26 + gen: + # 浣滆�� + author: Mike + # 榛樿鐢熸垚鍖呰矾寰� system 闇�鏀规垚鑷繁鐨勬ā鍧楀悕绉� 濡� system monitor tool + package-name: com.iplatform.model.po + # 鑷姩鍘婚櫎琛ㄥ墠缂�锛岄粯璁ゆ槸false + auto-remove-pre: false + # 琛ㄥ墠缂�锛堢敓鎴愮被鍚嶄笉浼氬寘鍚〃鍓嶇紑锛屽涓敤閫楀彿鍒嗛殧锛� + table-prefix: s_ + + log: + # 鏄惁鎵撳紑鐧诲綍鏃ュ織锛�2023-01-05 + # 濡傛灉涓嶆墦寮�锛屽垯璁惧鐧诲綍鐨剈uid鏇存柊鎿嶄綔涔熸棤娉曡幏寰楋紝鐢ㄤ簬璁板綍姣忎釜鐧诲綍鐢ㄦ埛鐨剈uid锛堢敤鎴风櫥褰曡鑹叉洿鏂帮級锛�2023-03-23 + login-enabled: true + # 鏄惁鎵撳紑鎿嶄綔鏃ュ織锛�2023-01-05 + operate-enabled: false + + # 楠岃瘉鐮佺浉鍏抽厤缃紝2023-01-27 + captcha: + # 鍥惧舰楠岃瘉鐮佸疄鐜扮被, TextCaptchaProvider | DefaultCaptchaProvider + image-captcha-class: com.iplatform.base.captcha.TextCaptchaProvider + # 鐭俊楠岃瘉鐮佸疄鐜扮被锛堥厤缃簾寮冿紝2023-04-25锛� + sms-captcha-class: com.iplatform.base.captcha.MockSmsCaptchaProvider + + # 骞冲彴鏂囦欢瀛樺偍閰嶇疆锛�2023-02-15 + file: + # FileStoreType = FileSystem 鏈湴纾佺洏瀛樺偍鏍硅矾寰� + file-root: d:/tmp/ + # 璋冪敤杩滅▼涓婁紶鏂囦欢锛屾槸鍚︽寜鐓ф湰鍦版枃浠跺鐞嗭紝2023-07-03 + # 鍦ㄦ祴璇曡繃绋嬩腑濡傛灉娌℃湁FTP绛夋湇鍔★紝鍙互璁剧疆涓簍rue涓存椂瀛樺偍鏈湴 + remote-as-local: false + + # oss瀹炵幇绫诲瀷锛歛ws_s3锛堜簹椹�婏級 | tx锛堣吘璁級 | ali锛堥樋閲岋級 | qn锛堜竷鐗涳級锛�2023-12-13 + oss-type: aws_s3 + # oss璁块棶鍓嶇紑锛屽锛歨ttp://localhost:8082/admin/oss/锛�2023-12-13 + oss-prefix: http://localhost:8082/admin/oss/ + oss-access-key: ENC(BTHETNjs5ddRjYrdMF9ltmw8DMIEYTuyXIgDOeLIHy0=) + oss-secret-key: ENC(jROCWGpiPULZrU1wBZAsXvQQovvqnhoJKWpmYD/3nbkNGDikxfEvCXW5jn3QsYnG) + # oss鏈嶅姟鍦板潃 + oss-endpoint: https://eos-beijing-1.cmecloud.cn + # oss榛樿鐨勬《鍚嶇О + oss-bucket-name: ctoms-file + protocol: https + + ftp: + ip: 116.198.40.76 + port: 22 + user-name: mysftp + password: + private-key: + # ftp鏈嶅姟涓婇潰鐨勫瓨鍌ㄦ牴璺緞锛屽彧鑳芥槸linux璺緞 + # file-root: /files/ + file-root: /train/ + + # 鎺ュ彛鏂囨。鐢熸垚锛宻wagger3锛�2023-02-23 + swagger: + enable: false + # 鍖呰矾寰勶紝鏆傛椂涓嶇敤 + base-package: com.iplatform.base.controller + title: 浜戝師鐢熷井鏈嶅姟骞冲彴 + description: 涓�涓揩閫焪eb寮�鍙戞鏋� + + # TCP閫氫俊閰嶇疆锛�2024-01-23 + tcp: + # 鏄惁寮�鍚紩鎿� + enabled: true + # 鏄惁鎵撳紑蹇冭烦 + open-heart-beat: true + # 蹇冭烦鏃堕棿锛堢锛夛紝2023-08-28 + heart-beat-seconds: 60 + # 鏄惁鏄剧ず璇︾粏鏃ュ織 + show-log: false + # 璇锋眰闃熷垪绫诲瀷锛歮emory 鍩轰簬鍐呭瓨 + queue-type: memory + # tcp鏂瑰紡瑕佹壂鎻忕殑璇锋眰瀵硅薄鐨勫寘绌洪棿 + scan-packages-tcp: com.walker.tcp,com.iplatform.tcp + # websocket鏂瑰紡瑕佹壂鎻忕殑璇锋眰瀵硅薄鐨勫寘绌洪棿 + scan-packages-ws: com.iplatform.tcp.util.ws + # tcp闀胯繛鎺ョ殑绔彛 + port-tcp: 7878 + # websocket杩炴帴绔彛 + port-ws: 60001 + # websocket杩炴帴uri + websocket-uri: wss://jmy.jinmingyuan.com/wss + # 閫氫俊绾跨▼鏁伴噺 + boss-thread-num: 2 + # 涓氬姟澶勭悊绾跨▼鏁伴噺 + worker-thread-num: 4 + # 鍚敤鑷畾涔夎繛鎺ョ鐞嗗櫒锛屽鏋渢rue鍒欎笟鍔¢渶瑕佹彁渚涜嚜瀹氫箟瀹炵幇锛堥厤缃級锛�2023-07-18 + custom-connection-manager: false + # 鏄惁寮�鍚泦缇ゆā寮忥紝杩炴帴绠$悊鍣ㄤ細榛樿鍔犺浇璐熻浇鏀寔锛�2023-09-26 + load-balance-enabled: false + # 闀胯繛鎺ヤ富鏈猴紙鏍囪锛変俊鎭紝鍙互鏄换鎰忓瓧绗︿覆锛屽彧瑕侀泦缇や腑姣忎釜鏈嶅姟閰嶇疆涓嶅悓鍗冲彲銆� + # 鍦ㄩ泦缇ゆā寮忎腑锛屾瘡涓繛鎺ヨ鍔犱笂涓绘満鏍囪瘑锛屼互渚垮埆浜烘帹閫佹秷鎭椂锛岀煡閬撳湪鍝釜涓绘満涓婃帹閫併��2023-09-19 + connection-host: topic_master + + # 鎺ㄩ�佹ā鍧楅厤缃紝2023-04-25 + push: + # 鐭俊鎺ㄩ�佽�呭悕绉帮細mock_sms_push锛堟ā鎷熺煭淇★級锛宎lidy_sms_push锛堥樋閲屽ぇ楸肩煭淇★級 + sms-push-name: alidy_sms_push + # 鐭俊楠岃瘉鐮佹ā鏉縄D锛屾牴鎹疄闄呮儏鍐碉紙姣忎釜骞冲彴鍙兘涓嶅悓锛� + sms-template-code: SMS_285145505 + + # 瀵逛簬涓�鑸笟鍔℃彁閱掞紙涓嶅寘鎷細閭欢銆佺煭淇★級锛屾帹閫佺殑鏂瑰紡銆傛帹閫佽�匢D缁勫悎 + # && 琛ㄧず骞跺垪锛寍| 琛ㄧず鎴栵紙鍙涓�涓垚鍔熷氨OK锛� + # 2023-04-26锛屽彲鐢ㄧ殑 id = 'tcp', 'web_socket', 'wx', 'system' + # message-type: tcp && web_socket && wx && system + # 濡傛灉鏄垨鑰呮柟寮忥紝闇�瑕佹妸鏈�鍙潬鐨勬斁鍓嶉潰锛屽洜涓虹郴缁熶細鎵惧埌绗竴涓彂閫佹垚鍔熷嵆鍙�� + message-type: system || tcp || web_socket || wx + + # 閭欢閫氱煡鍙戦�佷俊鎭厤缃紝2023-04-26 + mail-server: smtp.126.com + mail-from: hnzzzhsl@126.com + mail-password: + + # 鑱婂ぉ鐩稿叧閰嶇疆锛�2023-07-07 + # chat: + # # 鏄惁鍚敤鏈哄櫒浜虹瓟澶嶏紝2023-07-12 + # robot-enabled: true + # # 鏈哄櫒浜哄叿浣撳疄鐜板璞★紝2023-07-12 + # robot-class: com.iplatform.chat.support.TestRobot + # # 鏄惁寮�鍚痬ongo瀛樺偍锛屽鏋渇alse鍒欓粯璁や娇鐢ㄦ暟鎹簱琛� + # mongo-enabled: true + # mongo: + # ip: 116.198.40.76 + # port: 27017 + # # 鑱婂ぉ鏁版嵁搴撳悕绉帮紝榛樿锛歝hat + # database: czt_ops_test + # user-name: czt_ops_test + # password: czt_ops_test + # max-size: 10 + # min-size: 2 + # # 杩炴帴鏈�澶х┖闂叉椂闂达紝20鍒嗛挓 + # max-idle-time-seconds: 1200 + # # 杩炴帴绛夊緟鏈�澶ф椂闂达紝10绉� + # max-wait-time-seconds: 10 + + # RestTemplate杩炴帴姹犻厤缃紝2023-08-18 + rest: + # 杩炴帴淇濇寔娲诲姩鏃堕棿锛岄粯璁わ細600绉� + keep-alive-duration-seconds: 600 + # 绌洪棽杩炴帴鏁伴噺锛岄粯璁わ細200涓� + max-idle-connections: 200 + # 杩炴帴瓒呮椂锛岄粯璁わ細2绉� + connect-timeout-seconds: 2 + # 璇昏秴鏃讹紝榛樿3绉� + read-timeout-seconds: 3 + # 鍐欒秴鏃讹紝榛樿3绉� + write-timeout-seconds: 3 + + # 闆嗙兢鏀寔鐩稿叧閰嶇疆锛�2023-09-29 + lb: + # 鏈満鏈嶅姟鑺傜偣ID锛屾瘡涓富鏈轰竴涓敮涓�鏁板瓧缂栧彿锛屼粠1寮�濮� + server-id: 1 + + # 2024-02-29 api鐩戞帶鐩稿叧 + api: + # 2024-02-29 鏄惁鎵撳紑鎺ュ彛鏃堕棿缁熻璁板綍锛屽鏋滐細true 鍒欎細璁板綍鎺ュ彛璋冪敤鏃堕棿锛屽啓鍏ヨ〃锛歴_api_time + time-enabled: false + + # 缃戦櫌缁熶竴璁よ瘉閰嶇疆閫夐」锛�2023-10-23 + unified: + # 鏄惁寮�鍚祴璇曟ā寮忥紝娴嬭瘯妯″紡鐢ㄤ簬鏈湴娴嬭瘯锛屾棤娉曡繛鎺ョ綉闄㈣璇佹帴鍙� + test-mode: true + # 缃戦櫌鎻愪緵鐨勮璇佸湴鍧�锛屽叧闂祴璇曟ā寮忓悗锛岃閫夐」鐢熸晥 + remote-url: https://wangyuan.com/api/unified + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# RocketMQ闃熷垪閰嶇疆锛�2023-09-26 +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +rocketmq: + # 鏈嶅姟鍦板潃锛屽涓敤閫楀彿鍒嗗紑 + # name-server: 116.198.40.76:9876 + name-server: 116.198.39.83:9898 + producer: + # 鍙戦�佹秷鎭秴鏃舵椂闂达紝榛樿3000 + send-message-timeout: 3000 + # 鐢熶骇鑰呯粍 + group: producer_group + # 鍙戦�佹秷鎭け璐ラ噸璇曟鏁帮紝榛樿2 + retryTimesWhenSendFailed: 2 + # 寮傛娑堟伅閲嶈瘯姝ゅ锛岄粯璁�2 + retryTimesWhenSendAsyncFailed: 2 + # 娑堟伅鏈�澶ч暱搴︼紝榛樿1024 * 1024 * 4(榛樿4M) + # 1024 * 128 = 128K + maxMessageSize: 131072 + # 鍘嬬缉娑堟伅闃堝�硷紝榛樿4k(1024 * 4) + compressMessageBodyThreshold: 4096 + # 鏄惁鍦ㄥ唴閮ㄥ彂閫佸け璐ユ椂閲嶈瘯鍙︿竴涓猙roker锛岄粯璁alse + retryNextServer: false + +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# 闆嗕腑鍩硅涓氬姟鍣ㄩ厤缃紝2023-10-26 +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +ctoms: + # 璋冨害鍣ㄩ厤缃紝2023-10-26 + scheduler: + # 鏄惁鍏佽闆嗙兢妯″紡鍚敤锛� + # true锛氳〃绀洪泦缇ら儴缃诧紝鍒欎笟鍔℃墦鍖呭彂甯冧腑涓嶅寘鍚皟搴︽ā鍧楋紙ctoms-scheduler-server锛�,璋冨害妯″潡闇�瑕佺嫭绔嬫墦鍖咃紱 + # false锛氳〃绀哄崟鏈洪儴缃诧紝璋冨害妯″潡浼氳鑷姩鎵撳寘锛堜綔涓轰竴涓被搴擄級鍙戝竷锛� + cluster-enabled: false + # 鍙戝竷绫诲瀷锛� + # single锛氫笟鍔″崟搴旂敤鎵撳寘锛岀洿鎺ヨ兘杩愯璋冨害浠诲姟 + # scheduler锛氳皟搴︿换鍔″寘锛堢嫭绔嬫墦鍖呮敮鎸侀泦缇わ級 + deploy-type: single + # 娑堟伅鎺ㄩ�佽姹傚湴鍧� + push-url: "https://push.cpoc.cn/sendv2" #浜掕仈缃� + link-app-url: "https://jmy.jinmingyuan.com/ctoms-h5/#/?" #绉诲姩璺宠浆 + link-pc-url: "https://jmy.jinmingyuan.com/tcp/" +# push-url: "http://10.5.6.99:9001/sendv2" #缁煎悎缃� +# push-url: "http://push.cpoc.cn:9001/sendv2" #缁煎悎缃� diff --git a/iplatform-base-tcp/src/main/resources/application.yml b/iplatform-base-tcp/src/main/resources/application.yml new file mode 100644 index 0000000..3b9c3a3 --- /dev/null +++ b/iplatform-base-tcp/src/main/resources/application.yml @@ -0,0 +1,7 @@ +spring: + profiles: +# active: oracle + active: dev +# active: test +# 榛樿鍩哄湴瓒呯骇绠$悊鍛樿鑹瞜ey +baseRole: ROLE-BASE-ADMIN diff --git a/iplatform-base-tcp/src/main/resources/wk_sn_lic.bin b/iplatform-base-tcp/src/main/resources/wk_sn_lic.bin new file mode 100644 index 0000000..06d8ace --- /dev/null +++ b/iplatform-base-tcp/src/main/resources/wk_sn_lic.bin @@ -0,0 +1,2 @@ +A拞/3鰁篳D荿坊z灅紱 O臵广y鹑蛼紙.4KU瀃仪撅孺螒鉟$q馴_h胶^+E螏�*潚 挎�>n渦4G�-# +�(|6蠻q澧gt0� b� 蟎�:?S滆}湠e_�-詯誆览�� \ No newline at end of file diff --git a/iplatform-base-tcp/src/test/java/com/ctoms/AppTest.java b/iplatform-base-tcp/src/test/java/com/ctoms/AppTest.java new file mode 100644 index 0000000..bd20039 --- /dev/null +++ b/iplatform-base-tcp/src/test/java/com/ctoms/AppTest.java @@ -0,0 +1,16 @@ +package com.ctoms; + +import com.ctoms.tcp.WebsocketClientTest; + +/** + * Unit test for simple App. + */ +public class AppTest +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + WebsocketClientTest test = new WebsocketClientTest(); + test.createBatch(); + } +} diff --git a/iplatform-base-tcp/src/test/java/com/ctoms/tcp/DemoLoginResponse.java b/iplatform-base-tcp/src/test/java/com/ctoms/tcp/DemoLoginResponse.java new file mode 100644 index 0000000..4b3502b --- /dev/null +++ b/iplatform-base-tcp/src/test/java/com/ctoms/tcp/DemoLoginResponse.java @@ -0,0 +1,51 @@ +package com.ctoms.tcp; + +public class DemoLoginResponse { + + /** + * + */ + private static final long serialVersionUID = 1167352207355638142L; + +// @Override +// protected void translateProperties(JSONObject result) { +// result.put("status", status); +// } + + @Override + public String toString(){ + return new StringBuilder("[protocol=").append(this.getProtocol()) + .append(", name=").append(this.getUid()) + .append(", status=").append(this.status) + .append("]").toString(); + } + + public String getUid() { + return uid; + } + + public void setUid(String uid) { + this.uid = uid; + } + + private String protocol; + + public String getProtocol() { + return protocol; + } + + public void setProtocol(String protocol) { + this.protocol = protocol; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + private int status = 0; + private String uid; +} diff --git a/iplatform-base-tcp/src/test/java/com/ctoms/tcp/DemoWebsocketClient.java b/iplatform-base-tcp/src/test/java/com/ctoms/tcp/DemoWebsocketClient.java new file mode 100644 index 0000000..eef98cf --- /dev/null +++ b/iplatform-base-tcp/src/test/java/com/ctoms/tcp/DemoWebsocketClient.java @@ -0,0 +1,81 @@ +package com.ctoms.tcp; + +import com.walker.infrastructure.utils.JsonUtils; +import org.java_websocket.client.WebSocketClient; +import org.java_websocket.handshake.ServerHandshake; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.net.URI; +import java.util.HashMap; +import java.util.Map; + +public class DemoWebsocketClient extends WebSocketClient { + + protected final transient Logger logger = LoggerFactory.getLogger(this.getClass()); + + public DemoWebsocketClient(URI serverUri) { + super(serverUri); + } + + @Override + public void onOpen(ServerHandshake serverHandshake) { +// logger.info("ws 杩炴帴鎴愬姛"); + String data = null; + Map<String, String> map = new HashMap<>(4); + map.put("protocol", "login"); + map.put("uid", this.uid); + try { + data = JsonUtils.objectToJsonString(map); + } catch (Exception e) { + throw new RuntimeException(e); + } + this.send(data); + logger.info("瀹㈡埛绔彂閫佺櫥褰曡姹傦紝name = {}", this.uid); + } + + @Override + public void onMessage(String s) { + if(s.indexOf("heartbeat") >= 0){ + return; + } + logger.info("ws 鏀跺埌娑堟伅:{}", s); + try { + DemoLoginResponse response = JsonUtils.jsonStringToObject(s, DemoLoginResponse.class); + if(response.getProtocol().equals("login")){ + logger.info("websocket 鐧诲綍鎴愬姛锛歿}", response.getUid()); + } + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + @Override + public void onClose(int i, String s, boolean b) { + logger.warn("杩炴帴琚叧闂細code={}, reason={}, remote={}", i, s, b); + } + + @Override + public void onError(Exception e) { + logger.error("杩炴帴閿欒锛�" + e.getMessage(), e); + } + + public String getUid() { + return uid; + } + + public void setUid(String uid) { + this.uid = uid; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + private String uid; + private String userName; +} diff --git a/iplatform-base-tcp/src/test/java/com/ctoms/tcp/WebsocketClientTest.java b/iplatform-base-tcp/src/test/java/com/ctoms/tcp/WebsocketClientTest.java new file mode 100644 index 0000000..1f48903 --- /dev/null +++ b/iplatform-base-tcp/src/test/java/com/ctoms/tcp/WebsocketClientTest.java @@ -0,0 +1,101 @@ +package com.ctoms.tcp; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.net.URI; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; + +public class WebsocketClientTest { + + protected final transient Logger logger = LoggerFactory.getLogger(this.getClass()); + +// private static final URI wsUri = URI.create("ws://127.0.0.1:60000/websocket"); +// private static final URI wsUri = URI.create("ws://116.198.40.76:60000/websocket"); +// private static final URI wsUri = URI.create("ws://10.8.4.35:60035/websocket"); +// private static final URI wsUri = URI.create("ws://www.shikeying.com:60001/websocket"); +// private static final URI wsUri = URI.create("ws://ctoms.chinapost.com.cn/ws/websocket"); +// private static final URI wsUri = URI.create("ws://localhost:60000"); +// private static final URI wsUri = URI.create("ws://116.198.40.76:60001"); + private static final URI wsUri = URI.create("wss://jmy.jinmingyuan.com/wss"); + + private static Map<String, DemoWebsocketClient> cacheClient = new ConcurrentHashMap<>(32770); + + private ExecutorService executorService = Executors.newFixedThreadPool(4); +// private static int currentSize = 20000; + private static int currentSize = 1; + private static final int TOTAL_LINES = 2; +// private static final int TOTAL_LINES = 16; +// private static final int BATCH_SIZE = 8; + private static final int BATCH_SIZE = 2; + + public void createBatch(){ + logger.info(".........寮�濮嬫祴璇曢�氫俊杩炴帴.......... TOTAL_LINES = {}, url = {}", TOTAL_LINES, wsUri); + while(currentSize < TOTAL_LINES){ + try { + this.executorService.execute(new Runnable() { + @Override + public void run() { + int count = BATCH_SIZE; + for(int i=0; i<count; i++){ + String uri = "mike" + (currentSize); + DemoWebsocketClient client = createOneClient(wsUri, uri); + logger.info("鍒涘缓浜嗕竴涓鎴风锛� " + uri); + cacheClient.put(uri, client); + currentSize ++; + } + } + }); + } catch (Exception ex){ + ex.printStackTrace(); + } finally { + try { + logger.info("currentSize = {}", currentSize); + TimeUnit.SECONDS.sleep(3); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + } + } + + logger.info("宸茬疮璁″垱寤鸿繛鎺ワ細{} 涓�", currentSize); + try { + TimeUnit.SECONDS.sleep(10); + } catch (InterruptedException e) { + throw new RuntimeException(e); + } + +// logger.info("鍑嗗鍏抽棴鎵�鏈夐摼鎺ュ璞�..."); +// for(DemoWebsocketClient client : cacheClient.values()){ +// client.close(); +// } +// logger.info("鎵ц浜嗗叧闂搷浣滐紝鎵�鏈夎繛鎺ョ◢鍚庝細瀹屽叏鍏抽棴"); + } + + private DemoWebsocketClient createOneClient(URI uri, String uid){ + DemoWebsocketClient client = new DemoWebsocketClient(uri); + client.setUid(uid); + client.setConnectionLostTimeout(0); + try { + client.connectBlocking(); + } catch (InterruptedException e) { + throw new RuntimeException("鍒涘缓client閿欒, uid=" + uid + ", " + e.getMessage(), e); + } + return client; + } + +// public void createOneClient(){ +// DemoWebsocketClient client = new DemoWebsocketClient(wsUri); +// client.setUid("mike"); +// try { +// client.connectBlocking(); +// } catch (InterruptedException e) { +// throw new RuntimeException(e); +// } +// WaitConsoleInput.waitInput(); +// } +} diff --git a/iplatform-base-tcp/src/test/java/com/ctoms/tcp/WebsocketDemo.java b/iplatform-base-tcp/src/test/java/com/ctoms/tcp/WebsocketDemo.java new file mode 100644 index 0000000..84290f4 --- /dev/null +++ b/iplatform-base-tcp/src/test/java/com/ctoms/tcp/WebsocketDemo.java @@ -0,0 +1,22 @@ +package com.ctoms.tcp; + +import com.iplatform.tcp.util.ws.WebDataResponse; +import com.walker.infrastructure.utils.JsonUtils; +import com.walker.infrastructure.utils.NumberGenerator; +import org.junit.Test; + +public class WebsocketDemo { + + @Test + public void sendDataFormat(){ + WebDataResponse msg = new WebDataResponse(); + msg.setMessageId(NumberGenerator.getLongSequenceId()); + msg.setName("shikeying"); // 鎸囧畾鐢ㄦ埛鍙戦�侊紝璇d涓庢祻瑙堝櫒绔敞鍐岀殑id淇濇寔涓�鑷淬�� + msg.setData("浣犲ソ锛岃繖鏄帹閫佺粰娴忚鍣ㄧ殑鍐呭锛屼竴鑸槸JSON鏍煎紡銆�"); + try { + System.out.println(JsonUtils.objectToJsonString(msg)); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} diff --git a/iplatform-base/doc/iplatform_base.sql b/iplatform-base/doc/iplatform_base.sql new file mode 100644 index 0000000..69e1450 --- /dev/null +++ b/iplatform-base/doc/iplatform_base.sql @@ -0,0 +1,35 @@ +-- +ALTER TABLE s_user_core + ADD UNIQUE INDEX inx_usr_login (user_name) USING BTREE ; + +ALTER TABLE s_role_user + ADD INDEX inx_ru_uid (user_id) USING BTREE ; + +ALTER TABLE s_config + ADD INDEX inx_sc_key (config_key) USING BTREE ; + +-- 鐢ㄦ埛鏍稿績琛ㄦ坊鍔犲瓧娈� 2023-03-06 +ALTER TABLE s_user_core + ADD COLUMN wx_open_id varchar(64) NULL AFTER remark; +ALTER TABLE s_user_core + ADD COLUMN wx_union_id varchar(64) NULL AFTER wx_open_id; +ALTER TABLE s_user_core + ADD COLUMN ding_user_id varchar(64) NULL AFTER wx_union_id; +ALTER TABLE s_user_core + ADD COLUMN bind_client_id varchar(64) NULL AFTER ding_user_id; +ALTER TABLE s_user_core + ADD COLUMN bind_wechat int NOT NULL DEFAULT 0 COMMENT '鏄惁缁戝畾寰俊锛�1_鏄紝 0_鍚︺��' AFTER bind_client_id; +ALTER TABLE s_user_core + ADD COLUMN modify_pwd int NOT NULL DEFAULT 0 COMMENT '鏄惁淇敼瀵嗙爜锛�0_鍚︼紝1_鏄�' AFTER bind_wechat; +ALTER TABLE s_user_core + ADD COLUMN bind_mobile int NOT NULL DEFAULT 0 COMMENT '鏄惁缁戝畾鎵嬫満锛�1_鏄紝 0_鍚︺��' AFTER modify_pwd; +ALTER TABLE s_user_core + ADD COLUMN bind_mail int NOT NULL DEFAULT 0 COMMENT '鏄惁缁戝畾閭锛�1_鏄紝 0_鍚︺��' AFTER bind_mobile; +ALTER TABLE s_user_core + ADD COLUMN profile_id bigint NOT NULL DEFAULT 0 COMMENT '鍏宠仈鐨勬。妗坕d锛�0琛ㄧず鏈叧鑱�' AFTER bind_mail; + +-- 鏁版嵁瀛楀吀 +ALTER TABLE s_dict_data + ADD COLUMN parent_id bigint NOT NULL DEFAULT 0 COMMENT '鐖惰褰昳d' AFTER remark; + +-- diff --git a/iplatform-base/pom.xml b/iplatform-base/pom.xml new file mode 100644 index 0000000..83b3109 --- /dev/null +++ b/iplatform-base/pom.xml @@ -0,0 +1,277 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>low-consum-manage</artifactId> + <groupId>com.consum</groupId> + <version>1.0.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <groupId>com.iplatform</groupId> + <artifactId>iplatform-base</artifactId> + <name>iplatform-base</name> + <packaging>jar</packaging> + <version>3.2.0</version> + + <properties> + </properties> + + <dependencies> + <!-- 骞冲彴瀹炰綋鎺ュ彛瀵硅薄, 2022/09/19 --> + <dependency> + <groupId>com.iplatform</groupId> + <artifactId>iplatform-model-pojo</artifactId> + <version>3.2.0</version> + </dependency> + + <!-- 鏍稿績妯″潡锛氭彁渚涢潪甯稿熀纭�鏈嶅姟锛堜笉杩炴帴鏁版嵁搴擄級, 2022/09/19 --> + <dependency> + <groupId>com.iplatform</groupId> + <artifactId>iplatform-core</artifactId> + <version>3.2.0</version> + </dependency> + + <dependency> + <groupId>com.walkersoft</groupId> + <artifactId>walker-infrastructure</artifactId> + <version>${walker-infrastructure.version}</version> + <systemPath>${project.basedir}/src/main/resources/lib/walker-infrastructure-3.2.0.jar</systemPath> + <scope>system</scope> + </dependency> + + <dependency> + <groupId>com.walkersoft</groupId> + <artifactId>walker-web</artifactId> + <version>3.2.0</version> + <systemPath>${project.basedir}/src/main/resources/lib/walker-web-3.2.0.jar</systemPath> + <scope>system</scope> + </dependency> + + <dependency> + <groupId>com.walkersoft</groupId> + <artifactId>walker-licence</artifactId> + <version>3.2.0</version> + <systemPath>${project.basedir}/src/main/resources/lib/walker-licence-3.2.0.jar</systemPath> + <scope>system</scope> + </dependency> + + + <!-- 鎻愪緵鏁版嵁搴撴敮鎸�, 2022/09/19 --> + <dependency> + <groupId>com.walkersoft</groupId> + <artifactId>walker-jdbc</artifactId> + <version>${walker-jdbc.version}</version> + <systemPath>${project.basedir}/src/main/resources/lib/walker-jdbc-3.2.0.jar</systemPath> + <scope>system</scope> + </dependency> + + <!-- 鎻愪緵Redis鏀寔锛岀敱涓氬姟瀛愬伐绋嬪喅瀹氭槸鍚︿緷璧�, 2022/09/20 --> + <dependency> + <groupId>com.walkersoft</groupId> + <artifactId>walker-support-redis</artifactId> + <version>3.2.0</version> + <systemPath>${project.basedir}/src/main/resources/lib/walker-support-redis-3.2.0.jar</systemPath> + <scope>system</scope> + <exclusions> + <exclusion> + <groupId>com.walkersoft</groupId> + <artifactId>walker-cache</artifactId> + </exclusion> + </exclusions> + </dependency> + + <dependency> + <groupId>com.walkersoft</groupId> + <artifactId>walker-connector</artifactId> + <version>${walker-connector.version}</version> + <systemPath>${project.basedir}/src/main/resources/lib/walker-connector-3.2.0.jar</systemPath> + <scope>system</scope> + </dependency> + + <dependency> + <groupId>com.walkersoft</groupId> + <artifactId>walker-db-meta</artifactId> + <version>${walker-db-meta.version}</version> + <systemPath>${project.basedir}/src/main/resources/lib/walker-db-meta-3.2.0.jar</systemPath> + <scope>system</scope> + </dependency> + + <dependency> + <groupId>com.walkersoft</groupId> + <artifactId>walker-web-security</artifactId> + <version>${walker-web-security.version}</version> + <systemPath>${project.basedir}/src/main/resources/lib/walker-web-security-3.2.0.jar</systemPath> + <scope>system</scope> + </dependency> + + <!-- 鍩虹妯″潡鎻愪緵web鏀寔, 2022/10/31 --> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-aop</artifactId> + <exclusions> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework</groupId> + <artifactId>spring-beans</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-redis</artifactId> + <exclusions> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + + <!-- 绠�鍗曠殑楠岃瘉鐮佸疄鐜�(鑻ヤ緷), 2022/11/06 --> + <dependency> + <groupId>com.walkersoft</groupId> + <artifactId>walker-support-kaptcha</artifactId> + <version>3.2.0</version> + <systemPath>${project.basedir}/src/main/resources/lib/walker-support-kaptcha-3.2.0.jar</systemPath> + <scope>system</scope> + </dependency> + + <!-- + csv鏁版嵁瀵煎叆鏀寔: univocity瀹炵幇, 2023/02/01 + excel瀵煎叆锛岀洰鍓嶈繖涓ょ鍏堟斁涓�璧凤紝2023/02/06 + --> + <dependency> + <groupId>com.walkersoft</groupId> + <artifactId>walker-di-support-univocity</artifactId> + <version>3.2.0</version> + <systemPath>${project.basedir}/src/main/resources/lib/walker-di-support-univocity-3.2.0.jar</systemPath> + <scope>system</scope> + </dependency> + + <dependency> + <groupId>com.walkersoft</groupId> + <artifactId>walker-security</artifactId> + <version>3.2.0</version> + <systemPath>${project.basedir}/src/main/resources/lib/walker-security-3.2.0.jar</systemPath> + <scope>system</scope> + </dependency> + <dependency> + <groupId>com.walkersoft</groupId> + <artifactId>walker-push-wx-public</artifactId> + <version>3.2.0</version> + <systemPath>${project.basedir}/src/main/resources/lib/walker-push-wx-public-3.2.0.jar</systemPath> + <scope>system</scope> + </dependency> + + <!-- 浜氶┈閫奡3 OSS 鏈嶅姟閰嶇疆锛�2023-12-12 --> + <dependency> + <groupId>com.amazonaws</groupId> + <artifactId>aws-java-sdk-s3</artifactId> + <version>1.11.126</version> + <scope>system</scope> + <systemPath>${project.basedir}/src/main/resources/lib/aws-java-sdk-s3-1.11.126-with-dependencies.jar</systemPath> + </dependency> + + <!-- 寮曞叆apache common-io, AbstractController 涓嬭浇鏂囦欢浣跨敤銆�2022-11-28 --> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + </dependency> + + <!-- easyExcel搴曞眰渚濊禆poi --> + <dependency> + <groupId>org.apache.poi</groupId> + <artifactId>poi</artifactId> + <version>${poi.version}</version> + <exclusions> + <exclusion> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </exclusion> + <exclusion> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + </exclusion> + <exclusion> + <groupId>commons-codec</groupId> + <artifactId>commons-codec</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.poi</groupId> + <artifactId>poi-ooxml</artifactId> + <version>${poi.version}</version> + </dependency> + + <!-- jwt token: 2022/10/10 --> + <dependency> + <groupId>io.jsonwebtoken</groupId> + <artifactId>jjwt-api</artifactId> + <version>0.11.5</version> + </dependency> + + <dependency> + <groupId>io.jsonwebtoken</groupId> + <artifactId>jjwt-impl</artifactId> + <version>0.11.5</version> + </dependency> + + <dependency> + <groupId>io.jsonwebtoken</groupId> + <artifactId>jjwt-jackson</artifactId> + <version>0.11.5</version> + </dependency> + + <!-- 鑾峰彇娴忚鍣ㄤ俊鎭�, WebAgent渚濊禆璇ュ璞$敤浜庤В鏋怑xcel: 2023/01/05 --> + <dependency> + <groupId>com.univocity</groupId> + <artifactId>univocity-parsers</artifactId> + </dependency> + + <!-- RestTemplate浣跨敤: 2023/08/16 --> + <dependency> + <groupId>com.squareup.okhttp3</groupId> + <artifactId>okhttp</artifactId> + </dependency> + + <dependency> + <groupId>com.alibaba</groupId> + <artifactId>druid</artifactId> + <scope>provided</scope> + </dependency> + + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <version>3.2.11</version> + <configuration> + <!-- 2023-11-06 璇ュ弬鏁版寚瀹氫簡渚濊禆鐨勬湰鍦扮被搴擄紝涓嶅紩鍏ュ垯鎶ラ敊锛氫笉鑳芥寚鍚戞湰鍦癹ar鏂囦欢 --> + <arguments> + <argument>${project.basedir}/src/main/resources/lib</argument> + </arguments> + <!-- 2023-11-06 璇ュ弬鏁版寚瀹氾紝鎵撳寘蹇界暐 Main 鍑芥暟銆�--> + <skip>true</skip> + </configuration> + </plugin> + </plugins> + </build> + +</project> diff --git a/iplatform-base/src/main/java/com/iplatform/base/AbstractController.java b/iplatform-base/src/main/java/com/iplatform/base/AbstractController.java new file mode 100644 index 0000000..ce884a9 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/AbstractController.java @@ -0,0 +1,360 @@ +package com.iplatform.base; + +import com.iplatform.base.callback.PlatformCallbackPostProcessor; +import com.iplatform.core.BeanContextAware; +import com.walker.db.page.ListPageContext; +import com.walker.db.page.PageSearch; +import com.walker.infrastructure.ApplicationRuntimeException; +import com.walker.infrastructure.arguments.ArgumentsManager; +import com.walker.infrastructure.arguments.Variable; +import com.walker.infrastructure.utils.DateUtils; +import com.walker.infrastructure.utils.FileUtils; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.web.ResponseValue; +import com.walker.web.util.ServletUtils; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import org.apache.commons.io.IOUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.InitializingBean; + +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.io.PrintWriter; +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.net.URLEncoder; +import java.util.List; + +public abstract class AbstractController implements InitializingBean { + + protected final transient Logger logger = LoggerFactory.getLogger(this.getClass()); + + private static String contextPath; + private static final Object lock = new Object(); + + /** + * 杩斿洖绗笁鏂瑰鎺ョ鐞嗗櫒瀵硅薄銆� + * @return + * @date 2023-07-03 + */ + protected ThirdPartyManager getThirdPartyManager(){ + return BeanContextAware.getBeanByType(ThirdPartyManager.class); + } + + /** + * 杩斿洖鏈嶅姟绔皟鐢ㄥ湴鍧�鍓嶇紑锛屽:<br> + * http://localhost:8080/demo + * @return + * @date 2023-01-06 + */ + protected String getServerDomain(){ + HttpServletRequest request = this.getRequest(); + return ServletUtils.getServerDomain(request); + } + + /** + * 杩斿洖缁欏畾鐨勫洖璋冨疄鐜板璞°�� + * @param clazz 瀹氫箟鐨勫洖璋冩帴鍙o紝濡�: PlatformUserCallback.class + * @return + * @param <T> + * @date 2023-01-05 + * @date 2023-01-28 璇ユ柟娉曞彧鑳借幏鍙栧崟涓被鍨婥allback锛屽浜庡瓨鍦ㄥ绉嶅疄鐜扮殑璇蜂娇鐢ㄦ柟娉�: + * {@linkplain PlatformCallbackPostProcessor#getCallbackMultipleBean(Class)} + */ + protected <T> T getPlatformCallback(Class<T> clazz){ + return PlatformCallbackPostProcessor.getCallbackObject(clazz); + } + + /** + * 杩斿洖绯荤粺閰嶇疆鍙彉鍙傛暟瀵硅薄銆� + * @param key 鍙傛暟 key + * @return + * @date 2022-11-29 + */ + protected Variable getArgumentVariable(String key){ + Variable v = this.getArgumentManager().getVariable(key); + if(v == null){ + throw new IllegalArgumentException("鍙彉閰嶇疆鍙傛暟涓嶅瓨鍦�: " + key); + } + return v; + } + + protected ArgumentsManager getArgumentManager(){ + return BeanContextAware.getBeanByType(ArgumentsManager.class); + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + //~ 鏂版坊鍔犵殑鏂规硶锛�2022-11-16 + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + /** + * 涓嬭浇绠�鍗曠殑鏂囦欢锛岄�氬父鏂囦欢涓嶅ぇ銆� + * @param data 鏂囦欢瀛楄妭鐮佸唴瀹� + * @param fileName 鏂囦欢鍚嶇О锛屽: demo.zip + * @throws IOException + * @date 2022-11-28 + */ + protected void downloadSimpleFile(byte[] data, String fileName) throws IOException{ + HttpServletResponse response = this.getResponse(); + response.reset(); + response.addHeader("Access-Control-Allow-Origin", "*"); + response.addHeader("Access-Control-Expose-Headers", "Content-Disposition"); + response.setHeader("Content-Disposition", "attachment; filename=\"" + URLEncoder.encode(fileName) + "\""); + response.addHeader("Content-Length", "" + data.length); + response.setContentType("application/octet-stream; charset=UTF-8"); + IOUtils.write(data, response.getOutputStream()); + } + + /** + * 浠庡墠绔幏寰楀垎椤垫煡璇㈡潯浠讹紝鍐欏叆绾跨▼鍙傛暟涓�� + * @author 鏃跺厠鑻� + * @date 2022-11-16 + * @date 2023-01-28 璇ユ柟娉曞簾寮冿紝鐢辨嫤鎴櫒鏍规嵁鐗瑰緛'/list'鑷姩鎵ц鍒嗛〉鍑嗗璋冪敤銆� + */ + @Deprecated + protected PageSearch preparePageSearch(){ + PageSearch pageSearch = new PageSearch(); + Integer pn = this.getIntParameter(PageSearch.PAGE_NUM); + if(pn != null){ + pageSearch.setPageIndex(pn.intValue()); + } + Integer pageSize = this.getIntParameter(PageSearch.PAGE_SIZE); + if(pageSize != null){ + pageSearch.setPageSize(pageSize.intValue()); + } + pageSearch.setOrderByColumn(this.getParameter(PageSearch.ORDER_BY_COLUMN)); + pageSearch.setOrderAsc(this.getParameter(PageSearch.IS_ASC)); +// pageSearch.setReasonable(this.getParameter(PageSearch)); + ListPageContext.setPageSearch(pageSearch); + return pageSearch; + } + + /** + * 鎶婁竴涓棩鏈熸垨鏃堕棿瀛楃涓诧紝杞崲鎴愭暟鍊笺�� + * <pre> + * 1.2022-11-16 --> 20221116000000 + * 2.2022-11-16 12:01:30 --> 20221116120130 + * </pre> + * @param dateTime 缁欏畾鏃堕棿鎴栨棩鏈熷瓧绗︿覆 + * @param isTime 鏄惁鏃堕棿锛屽惁琛ㄧず鍙湁鏃ユ湡 + * @return + */ + protected long getParamsDateTime(String dateTime, boolean isTime){ + if(StringUtils.isEmpty(dateTime)){ + return -1; + } + if(isTime){ + return DateUtils.getDateTimeNumber(dateTime); + } else { + return DateUtils.toLongDateTime(dateTime); + } + } + + /** + * 鍖呰杩斿洖甯﹀垎椤电殑琛ㄦ牸闆嗗悎锛屽姞涓妕otal灞炴��(閫傞厤鍓嶇) + * @param data + * @param total + * @return + * @param <T> + * @date 2022-11-19 + * @date 2023-05-16 浠�2.3.0涔嬪悗搴熷純锛屽洜涓轰娇鐢ㄤ簡鏂扮殑瀹屾暣鍓嶇鐣岄潰锛岃繑鍥炵殑涓氬姟鏁版嵁鏄竴涓暣浣擄紝涓嶅啀闅忔剰澧炲姞锛歊esponseValue灞炴�с�� + */ + @Deprecated + protected <T> ResponseValue<List<?>> acquireTablePage(List<T> data, long total){ + ResponseValue<List<?>> rv = ResponseValue.success(data); + rv.setTotal(total); + return rv; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~ end ~~~~~~~~~~~~~~~~~~~~~~ + + protected HttpServletRequest getRequest(){ +// ServletRequestAttributes servletRequestAttributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes(); +// HttpServletRequest request = servletRequestAttributes.getRequest(); +// return request; + return ServletUtils.getRequest(); + } + + protected HttpServletResponse getResponse(){ +// return ((ServletRequestAttributes)RequestContextHolder.getRequestAttributes()).getResponse(); + return ServletUtils.getResponse(); + } + + /** + * 寰楀埌WEB搴旂敤涓婁笅鏂囪矾寰勶紝濡傦細/web + * @return + */ + protected String getContextPath(){ + if(contextPath == null){ + synchronized (lock) { + HttpServletRequest request = getRequest(); + if(request == null) { + throw new Error("request not found: getRequest()."); + } + contextPath = request.getContextPath(); + } + } + return contextPath; + } + + protected String getParameter(String name){ + return getRequest().getParameter(name); + } + + protected String getParameterUTF8(String name) throws UnsupportedEncodingException { + String value = this.getParameter(name); + return value == null ? null : URLDecoder.decode(value, "UTF-8"); + } + + protected String[] getParameterValues(String name) { + return this.getRequest().getParameterValues(name); + } + + protected Integer getIntParameter(String name) { + String value = this.getParameter(name); + return value == null ? null : Integer.valueOf(value); + } + + protected Long getLongParameter(String name) { + String value = this.getParameter(name); + return value == null ? null : Long.valueOf(value); + } + + protected Float getFloatParameter(String name) { + String value = this.getParameter(name); + return value == null ? null : Float.valueOf(value); + } + + protected Double getDoubleParameter(String name) { + String value = this.getParameter(name); + return value == null ? null : Double.valueOf(value); + } + + /** + * @param name + * @return Attribute value + */ + protected Object getAttribute(String name) { + return this.getRequest().getAttribute(name); + } + + /** + * @param name + * @param value + */ + protected void setAttribute(String name, Object value) { + this.getRequest().setAttribute(name, value); + } + + protected void setDefaultContentType() { + this.getResponse().setContentType("text/html; charset=utf-8"); + } + + private void ajaxOutPut(ResponseFormat format, Object outputString) throws IOException { + HttpServletResponse response = this.getResponse(); + response.setCharacterEncoding(StringUtils.DEFAULT_CHARSET_UTF8); + response.setContentType(format.getValue()); + this.print(response, outputString == null ? StringUtils.EMPTY_STRING : outputString.toString()); + } + + protected void print(HttpServletResponse response, String str) throws IOException { +// ServletOutputStream outputStream = this.getResponse().getOutputStream(); + PrintWriter pw = response.getWriter(); + pw.print(str); + } + + protected void ajaxOutPutText(Object outputString) throws IOException { + this.ajaxOutPut(ResponseFormat.TextPlain, outputString); + } + + protected void ajaxOutPutJson(Object outputString) throws IOException { + this.ajaxOutPut(ResponseFormat.ApplicationJson, outputString); + } + + protected void ajaxOutPutXml(Object outputString) throws IOException { + this.ajaxOutPut(ResponseFormat.TextXml, outputString); + } + + protected void ajaxOutPutHtml(Object outputString) throws IOException { + setDefaultContentType(); + this.print(this.getResponse(), outputString == null ? StringUtils.EMPTY_STRING : outputString.toString()); + } + + protected void ajaxOutputFileStream(String contentType, String filePath){ + ajaxOutputFileStream(contentType, new File(filePath)); + } + + protected void ajaxOutputFileStream(String contentType, File file){ + HttpServletResponse response = this.getResponse(); + response.setCharacterEncoding(StringUtils.DEFAULT_CHARSET_UTF8); + response.setContentType(contentType); + byte[] content = FileUtils.getFileBytes(file); + if(content == null) { + return; + } + OutputStream out = null; + try { + out = response.getOutputStream(); + out.write(content); + out.flush(); + } catch (IOException e) { + throw new ApplicationRuntimeException("杈撳嚭鏈嶅姟鍣ㄦ枃浠舵祦鍑虹幇寮傚父!", e); + } finally { + if(out != null){ + try { + out.close(); + } catch (IOException e) {} + } + } + } + + public enum ResponseFormat{ + ApplicationJson{ + }, + ApplicationXml{ + + }, + TextXml{ + + }, + TextPlain{ + + }; +// ImagePng{ +// public String getValue(){ +// return Constants.IMAGE_PNG; +// } +// }, +// ImageJpeg{ +// public String getValue(){ +// return Constants.IMAGE_JPEG; +// } +// }, +// ImageGif{ +// public String getValue(){ +// return Constants.IMAGE_GIF; +// } +// }; + public String getValue(){ + throw new AbstractMethodError(); + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + //~ 涓鸿�佺殑freemarker鐣岄潰棰勭暀鐨勬柟娉曪紝2022-11-08 + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + /** + * 鍓嶇椤甸潰璋冪敤鐨凧S鏂归潰鍚嶇О + */ + protected static final String DEFAULT_JS_NAME = "reload"; + + /** + * 鍓嶇浣跨敤鐨勫垎椤靛璞″紩鐢ㄥ悕绉帮紝榛樿鍊� + */ + protected static final String DEFAULT_PAGER_VIEW_NAME = "pagerView"; + +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/AbstractFileOperateSpiController.java b/iplatform-base/src/main/java/com/iplatform/base/AbstractFileOperateSpiController.java new file mode 100644 index 0000000..1a32d13 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/AbstractFileOperateSpiController.java @@ -0,0 +1,339 @@ +package com.iplatform.base; + +import com.iplatform.core.BeanContextAware; +import com.walker.file.FileInfo; +import com.walker.file.FileStoreType; +import com.walker.infrastructure.utils.FileCopyUtils; +import com.walker.infrastructure.utils.FileUtils; +import com.walker.infrastructure.utils.StringUtils; +import org.springframework.web.multipart.MultipartFile; + +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.List; +import java.util.Set; + +public abstract class AbstractFileOperateSpiController extends AbstractSecurityController{ + + protected FileOperateSpi acquireFileOperateSpi(){ + return BeanContextAware.getBeanByType(FileOperateSpi.class); + } + + /** + * 娓呴櫎缁欏畾鏂囦欢鍦板潃鐨凜DN鍓嶇紑銆傚锛歨ttps://qnyun.com/oss/12345678 + * <pre> + * 鍘绘帀鍓嶇紑鍚庯紝鍙墿涓�"12345678" + * </pre> + * @param path 缁欏畾鐨勬枃浠惰祫婧愬湴鍧� + * @return + * @date 2023-05-17 + */ + protected String clearCdnPrefix(String path){ + return this.acquireFileOperateSpi().clearCdnPrefix(path); + } + + /** + * 杩斿洖瀛樺偍鏂囦欢鐨勫墠缂�锛屾牴鎹钩鍙伴厤缃弬鏁帮細鏈湴銆丗TP鎴朞SS杩滅▼瀛樺偍涓嶅悓鑰岃繑鍥炰笉鍚屽墠缂�銆� + * @return + * @date 2023-06-10 + */ + protected String getCdnUrl(){ + return this.acquireFileOperateSpi().getCdnUrl(); + } + + /** + * 鏍规嵁鏂囦欢淇℃伅锛屽姞杞芥枃浠朵簩杩涘埗鍐呭銆� + * @param fileInfo + * @return + * @date 2023-03-17 + */ + protected byte[] getLocalFileData(FileInfo fileInfo){ + String localRoot = this.acquireFileOperateSpi().getFileRootConfig(); + String absolutePath = localRoot + fileInfo.getUrl(); + try { + return FileCopyUtils.copyToByteArray(new File(absolutePath)); + } catch (IOException e) { + throw new RuntimeException("鏂囦欢鍔犺浇寮傚父锛屽彲鑳戒笉瀛樺湪:" + absolutePath, e); + } + } + + /** + * 鏍规嵁鏂囦欢id缂栧彿锛岃幏鍙栨枃浠跺熀鏈俊鎭�� + * @param id + * @return + * @date 2023-03-17 + */ + protected FileInfo getFileInfo(String id){ + if(StringUtils.isEmpty(id)){ + logger.warn("id涓虹┖锛屾棤娉曡幏寰楁枃浠朵俊鎭�"); + return null; + } + return this.acquireFileOperateSpi().getFileInfo(Long.parseLong(id)); + } + + protected List<FileInfo> getFileInfoList(List<String> ids){ + if(StringUtils.isEmptyList(ids)){ + throw new IllegalArgumentException("ids is required!"); + } + return this.acquireFileOperateSpi().getFileInfoList(ids); + } + + /** + * 涓嬭浇oss鏂囦欢 + * @param id 鏂囦欢鍞竴缂栧彿 + * @return + * @date 2023-12-13 + */ + protected byte[] getOssFileData(String id){ + return this.acquireFileOperateSpi().downloadOssFile(id); + } + + protected FileInfo uploadFileToLocal(InputStream inputStream + , String fileName, String groupId, long fileSize, Integer businessType, String owner) throws Exception{ + return this.acquireFileOperateSpi().uploadFileToLocal(inputStream, fileName, groupId, fileSize, businessType, owner); + } + protected FileInfo[] uploadFileToLocal(InputStream[] inputStream + , String[] fileName, String groupId, long[] fileSize, Integer businessType, String owner) throws Exception{ + return this.acquireFileOperateSpi().uploadFileToLocal(inputStream, fileName, groupId, fileSize, businessType, owner); + } + + /** + * 涓婁紶鏂囦欢鍒版湰鍦帮紝涓氬姟鎺у埗鍣ㄧ洿鎺ヨ皟鐢ㄨ鏂规硶銆� + * @param multipartFile + * @param groupId 鍒嗙粍ID锛屽彲閫� + * @param businessType 涓氬姟绫诲瀷锛屽彲閫夛紝璇峰弬鑰冪數鍟嗘ā鍧楋紙PID锛� + * @param owner 鏁版嵁褰掑睘锛氬钩鍙颁负-1锛屽叾浠栦负椤剁骇鏈烘瀯ID锛堝晢鎴稩D锛� + * @param fileContentType 鍓嶇浼犲叆鐨勬枃浠朵笂浼犵被鍨嬶細uploadf 琛ㄧず鏂囦欢锛屽叾浠栦负鍥剧墖 + * @return + * @throws Exception 涓婁紶澶辫触鎶涘嚭寮傚父 + * @date 2023-06-09 + */ + protected FileInfo uploadFileToLocal(MultipartFile multipartFile + , String groupId, Integer businessType, String owner, String fileContentType) throws Exception{ + this.checkMultipartFile(multipartFile); + long fileSize = multipartFile.getSize(); + String fileName = multipartFile.getOriginalFilename().toLowerCase(); + if(fileName.length() > 99){ + fileName = fileName.substring(fileName.length()-99); + } + String fileExt = this.checkFile(fileName, fileSize, fileContentType); + logger.debug("涓婁紶鏈湴鏂囦欢鎵╁睍鍚嶏細" + fileExt); + return this.uploadFileToLocal(multipartFile.getInputStream(), fileName, groupId, fileSize, businessType, owner); + } + + /** + * 涓婁紶澶氫釜鏂囦欢 + * @param multipartFile + * @param groupId + * @param businessType + * @param owner + * @param fileContentType + * @return + * @throws Exception + * @date 2023-08-01 + */ + protected FileInfo[] uploadFileToLocal(MultipartFile[] multipartFile + , String groupId, Integer businessType, String owner, String fileContentType) throws Exception{ + if(multipartFile == null || multipartFile.length == 0){ + throw new IllegalArgumentException("multipartFile鏁扮粍涓虹┖"); + } + int size = multipartFile.length; + InputStream[] inputStream = new InputStream[size]; + String[] fileName = new String[size]; + long[] fileSize = new long[size]; + for(int i=0; i<size; i++){ + inputStream[i] = multipartFile[i].getInputStream(); + fileName[i] = multipartFile[i].getOriginalFilename().toLowerCase(); + fileSize[i] = multipartFile[i].getSize(); + } + return this.uploadFileToLocal(inputStream, fileName, groupId, fileSize, businessType, owner); + } + + protected FileInfo uploadFileToRemote(InputStream inputStream + , String fileName, String groupId, long fileSize, Integer businessType, String owner) throws Exception{ +// String remoteFileStoreType = this.getArgumentVariable(ArgumentsConstants.CONFIG_UPLOAD_TYPE).getStringValue(); +// if(StringUtils.isEmpty(remoteFileStoreType)){ +// throw new PlatformRuntimeException("骞冲彴鏈厤缃换浣曡繙绋嬪瓨鍌ㄧ被鍒細" + ArgumentsConstants.CONFIG_UPLOAD_TYPE); +// } + // 2023-07-03锛屽鏋滈厤缃繙绋嬩笂浼犱负鏈湴 + if(this.acquireFileOperateSpi().isRemoteAsLocal()){ + return this.acquireFileOperateSpi().uploadFileToLocal(inputStream, fileName, groupId, fileSize, businessType, owner); + } + +// FileStoreType fileStoreType = FileStoreType.getType(remoteFileStoreType); + FileStoreType fileStoreType = FileStoreType.OssAws; + if(fileStoreType == FileStoreType.Ftp){ + return this.acquireFileOperateSpi().uploadFileToFtp(inputStream, fileName, groupId, fileSize, businessType, owner); + } else { + return this.acquireFileOperateSpi().uploadFileToOss(inputStream, fileName, groupId, fileSize, businessType, owner, fileStoreType); + } + } + + protected FileInfo[] uploadFileToRemote(InputStream[] inputStream + , String[] fileName, String groupId, long[] fileSize, Integer businessType, String owner) throws Exception{ +// String remoteFileStoreType = this.getArgumentVariable(ArgumentsConstants.CONFIG_UPLOAD_TYPE).getStringValue(); +// if(StringUtils.isEmpty(remoteFileStoreType)){ +// throw new PlatformRuntimeException("骞冲彴鏈厤缃换浣曡繙绋嬪瓨鍌ㄧ被鍒細" + ArgumentsConstants.CONFIG_UPLOAD_TYPE); +// } + // 2023-07-03锛屽鏋滈厤缃繙绋嬩笂浼犱负鏈湴 + if(this.acquireFileOperateSpi().isRemoteAsLocal()){ + return this.acquireFileOperateSpi().uploadFileToLocal(inputStream, fileName, groupId, fileSize, businessType, owner); + } + +// FileStoreType fileStoreType = FileStoreType.getType(remoteFileStoreType); + FileStoreType fileStoreType = FileStoreType.OssAws; + if(fileStoreType == FileStoreType.Ftp){ + return this.acquireFileOperateSpi().uploadFileToFtp(inputStream, fileName, groupId, fileSize, businessType, owner); + } else { + return this.acquireFileOperateSpi().uploadFileToOss(inputStream, fileName, groupId, fileSize, businessType, owner, fileStoreType); + } + } + + protected FileInfo uploadFileToRemote(MultipartFile multipartFile + , String groupId, Integer businessType, String owner, String fileContentType) throws Exception{ + this.checkMultipartFile(multipartFile); + long fileSize = multipartFile.getSize(); + String fileName = multipartFile.getOriginalFilename().toLowerCase(); + String fileExt = this.checkFile(fileName, fileSize, fileContentType); + logger.debug("涓婁紶杩滅▼鏂囦欢鎵╁睍鍚嶏細" + fileExt); + return this.uploadFileToRemote(multipartFile.getInputStream(), fileName, groupId, fileSize, businessType, owner); + } + + protected FileInfo[] uploadFileToRemote(MultipartFile[] multipartFile + , String groupId, Integer businessType, String owner, String fileContentType) throws Exception{ + int size = multipartFile.length; + InputStream[] inputStream = new InputStream[size]; + String[] fileName = new String[size]; + long[] fileSize = new long[size]; + for(int i=0; i<size; i++){ + inputStream[i] = multipartFile[i].getInputStream(); + fileName[i] = multipartFile[i].getOriginalFilename().toLowerCase(); + fileSize[i] = multipartFile[i].getSize(); + } + return this.uploadFileToRemote(inputStream, fileName, groupId, fileSize, businessType, owner); + } + + private void checkMultipartFile(MultipartFile multipartFile){ + if(multipartFile == null){ + throw new PlatformRuntimeException("涓婁紶鏂囦欢涓嶅瓨鍦�"); + } + long fileSize = multipartFile.getSize(); + if(fileSize <= 0){ + throw new PlatformRuntimeException("涓婁紶鏂囦欢澶у皬閿欒锛�" + fileSize); + } + } + + private String checkFile(String fileName, long fileSize, String fileContentType){ + String fileExt = FileUtils.getFileExt(fileName); + if(StringUtils.isEmpty(fileExt)){ + logger.error("閿欒鏂囦欢淇℃伅锛歿}" ,fileName); + throw new PlatformRuntimeException("涓嶅瓨鍦ㄦ枃浠舵墿灞曞悕锛屾棤娉曚笂浼�"); + } + + // 骞冲彴閰嶇疆鍙敮鎸佺殑鏂囦欢鍚庣紑绫诲瀷 + String extArrayConfig = null; + if(fileContentType.equals(Constants.UPLOAD_AFTER_FILE_KEYWORD)){ + extArrayConfig = this.getArgumentVariable(ArgumentsConstants.UPLOAD_FILE_EXT_STR_CONFIG_KEY).getStringValue(); + } else { + extArrayConfig = this.getArgumentVariable(ArgumentsConstants.UPLOAD_IMAGE_EXT_STR_CONFIG_KEY).getStringValue(); + } + + // 濡傛灉瀛樺湪閰嶇疆鍚庣紑闄愬埗锛屽氨瑕佹鏌ュ尮閰� + if(StringUtils.isNotEmpty(extArrayConfig)){ + Set<String> extensionList = StringUtils.commaDelimitedListToSet(extArrayConfig); + if(extensionList == null || extensionList.size() == 0){ + throw new PlatformRuntimeException("涓婁紶鏂囦欢绫诲瀷锛屽彧鑳芥槸锛�" + extArrayConfig); + } + if(!extensionList.contains(fileExt)){ + throw new PlatformRuntimeException("涓婁紶鏂囦欢绫诲瀷锛屽彧鑳芥槸锛�" + extArrayConfig); + } + } + + // 鏂囦欢澶у皬闄愬埗 + long fileSizeConfig = 0; + if(fileContentType.equals(Constants.UPLOAD_AFTER_FILE_KEYWORD)){ + fileSizeConfig = this.getArgumentVariable(ArgumentsConstants.UPLOAD_FILE_MAX_SIZE_CONFIG_KEY).getLongValue(); + } else { + fileSizeConfig = this.getArgumentVariable(ArgumentsConstants.UPLOAD_IMAGE_MAX_SIZE_CONFIG_KEY).getLongValue(); + } + // 閰嶇疆鐨勫ぇ灏忓崟浣嶏細M锛岃繖閲屾崲鎴愬瓧鑺� + fileSizeConfig = fileSizeConfig * 1024 * 1024; + if(fileSize > fileSizeConfig){ + throw new PlatformRuntimeException("涓婁紶鏂囦欢澶у皬锛�" + fileSize + "锛岃秴鍑洪檺鍒讹細" + fileSizeConfig); + } + return fileExt; + } + + /** + * 涓婁紶鏂囦欢鍒版湇鍔″櫒鏈湴纾佺洏銆� + * @param inputStream 鏂囦欢娴侊紝绯荤粺浣跨敤瀹屼細鑷姩鍏抽棴 + * @param fileName 鏂囦欢鍚嶏紝濡�: demo.txt + * @param groupId 涓氬姟ID锛屽彲閫� + * @return + * @throws Exception + * @date 2023-03-16 + */ + @Deprecated + protected FileInfo uploadFileToLocal(InputStream inputStream, String fileName, String groupId, long fileSize) throws Exception{ + return this.acquireFileOperateSpi().uploadFileToSystem(inputStream, fileName, groupId, fileSize); + } + + /** + * 涓婁紶鏂囦欢鍒拌繙绋嬫湇鍔°�� + * @param inputStream 鏂囦欢娴侊紝绯荤粺浣跨敤瀹屼細鑷姩鍏抽棴 + * @param fileName 鏂囦欢鍚嶏紝濡�: demo.txt + * @param groupId 涓氬姟ID锛屽彲閫� + * @return + * @throws Exception + * @date 2023-02-15 + */ + @Deprecated + protected FileInfo uploadFileToRemote(InputStream inputStream, String fileName, String groupId, long fileSize) throws Exception{ + if(inputStream == null){ + throw new IllegalArgumentException("涓婁紶ftp鏂囦欢娴佷负绌�!"); + } + return this.acquireFileOperateSpi().uploadFileToFtp(inputStream, fileName, groupId,fileSize); + } + + protected FileInfo uploadFileToRemote(String absoluteFilePath, Integer businessType, String owner) throws Exception{ + File uploadFile = this.checkAbsoluteFilePath(absoluteFilePath); + BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(uploadFile)); + return this.uploadFileToRemote(inputStream, uploadFile.getName(), null, uploadFile.getTotalSpace(), businessType, owner); + } + + /** + * 涓婁紶鏂囦欢鍒拌繙绋嬫湇鍔$洰褰曚腑銆� + * @param absoluteFilePath + * @return 杩斿洖涓婁紶鏂囦欢鍩烘湰淇℃伅 + * @throws Exception + * @date 2023-02-15 + */ + @Deprecated + protected FileInfo uploadFileToRemote(String absoluteFilePath) throws Exception{ +// if(StringUtils.isEmpty(absoluteFilePath)){ +// throw new IllegalArgumentException("涓婁紶鏂囦欢鍏ㄨ矾寰勪笉瀛樺湪!"); +// } +// File uploadFile = new File(absoluteFilePath); +// if(!uploadFile.exists()){ +// logger.warn("涓婁紶鏂囦欢涓嶅瓨鍦紝file=" + absoluteFilePath); +// return null; +// } + File uploadFile = this.checkAbsoluteFilePath(absoluteFilePath); + BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(uploadFile)); + return this.acquireFileOperateSpi().uploadFileToFtp(inputStream, FileUtils.getFileNameWithoutPath(absoluteFilePath), null, uploadFile.getTotalSpace()); + } + + private File checkAbsoluteFilePath(String absoluteFilePath) throws Exception{ + if(StringUtils.isEmpty(absoluteFilePath)){ + throw new IllegalArgumentException("涓婁紶鏂囦欢鍏ㄨ矾寰勪笉瀛樺湪!"); + } + File uploadFile = new File(absoluteFilePath.toLowerCase()); + if(!uploadFile.exists()){ + throw new IllegalArgumentException("涓婁紶鏂囦欢涓嶅瓨鍦�, file=" + absoluteFilePath); + } + return uploadFile; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/AbstractSecurityController.java b/iplatform-base/src/main/java/com/iplatform/base/AbstractSecurityController.java new file mode 100644 index 0000000..c39dfb7 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/AbstractSecurityController.java @@ -0,0 +1,129 @@ +package com.iplatform.base; + +import com.iplatform.base.config.SecurityUserProperties; +import com.iplatform.core.BeanContextAware; +import com.iplatform.model.po.S_user_core; +import com.walker.infrastructure.utils.PasswordUtils; +import com.walker.web.UserPrincipal; +import com.walker.web.UserType; + +import java.util.List; + +/** + * 鑾峰緱褰撳墠鐧诲綍鐢ㄦ埛璁よ瘉淇℃伅銆�<p></p> + * <pre> + * 1.濡傛灉浣犵殑鎺у埗鍣ㄥ繀椤诲湪鐢ㄦ埛璁よ瘉涔嬪悗鎵嶈兘鎿嶄綔锛屽氨蹇呴』缁ф壙璇ュ璞★紝璇峰弬鑰�: {@linkplain AbstractSecurityController} + * + * 2.濡傛灉浣犵殑鎺у埗鍣ㄦ病鏈夋潈闄愭帶鍒讹紝鍒欏彧闇�瑕侀泦鎴�<code>AbstractController</code>鍗冲彲锛� + * 璇峰弬鑰�: {@linkplain AbstractController} + * </pre> + * @author 鏃跺厠鑻� + * @date 2022-11-11 + */ +public abstract class AbstractSecurityController extends AbstractController{ + + /** + * 楠岃瘉瀵嗙爜鏄惁绗﹀悎骞冲彴鏀跨瓥銆� + // * @param encryptPassword 鍓嶇淇敼鐨勫瘑鐮侊紙瀵嗘枃锛夛紝RSA鍔犲瘑锛屽悗鍙拌瑙e瘑鐨� + * @param originPassword 鍘熷鏄庢枃瀵嗙爜 + * @return 杩斿洖閿欒鎻愮ず锛岃繑鍥炵┖琛ㄧず鎴愬姛 + * @date 2023-08-05 + */ + protected String validatePasswordRule(String originPassword){ +// String originPassword = PlatformRSAUtils.getRsaDecryptValue(encryptPassword, PlatformRSAUtils.PRIK); + String error = PasswordUtils.filterText(originPassword); + if(error != null){ + return error; + } + int passLevelConfig = this.acquireSecurityUserProperties().getPassLevel(); + if(!PasswordUtils.validateComplex(originPassword, passLevelConfig)){ + return "瀵嗙爜绾у埆杩囦綆锛岃杈撳叆锛氬ぇ灏忓啓瀛楁瘝銆佹暟瀛椾互鍙婅嚦灏戜竴绉嶇壒娈婄鍙�"; + } + return null; + } + + protected SecurityUserProperties acquireSecurityUserProperties(){ + return BeanContextAware.getBeanByType(SecurityUserProperties.class); + } + + /** + * 浠ユ祦绋嬭鑹茬櫥褰曡幏鍙栨潈闄愶紝activiti7涓撶敤锛屽悗缁細搴熷純銆� + * @date 2023-03-21 + */ + @Deprecated + protected void loginAsWorkflowRole(){ + this.acquireSecuritySpi().loginAsWorkflowRole(); + } + + /** + * 鍒ゆ柇褰撳墠鐧诲綍鐢ㄦ埛鏄惁瓒呯骇绠$悊鍛樸�� + * @return + * @date 2022-11-27 + */ + protected boolean isSupervisor(){ + S_user_core user_core = this.getCurrentUser(); + if(user_core == null){ + throw new IllegalStateException("鑾峰彇褰撳墠鐢ㄦ埛閿欒锛屾湭鎵惧埌"); + } + return user_core.getUser_type() == UserType.TYPE_SUPER; + } + + /** + * 杩斿洖褰撳墠鐢ㄦ埛鍏锋湁鐨勮鑹查泦鍚堬紝娉ㄦ剰:杩欓噷闈細鏈夋潈闄愪娇鐢ㄧ殑鐗瑰畾瑙掕壊锛屽: <p> ROLE_SUPERVISOR, ROLE_USER, ROLE_ADMIN 绛夈��</p> + * <pre> + * 鍏朵粬鐨勬槸绯荤粺瑙掕壊绠$悊鐨処D锛屽洜姝ゆ暟鎹簱閫氳繃瑙掕壊闆嗗悎鏌ヨ鑿滃崟骞朵笉褰卞搷缁撴灉銆� + * </pre> + * @return + * @date 2022-11-27 + */ + public List<String> getCurrentUserRoleIdList(){ + return this.acquireSecuritySpi().getCurrentUserRoleIdList(); + } + + public UserPrincipal<S_user_core> getCurrentUserPrincipal(){ + return this.acquireSecuritySpi().getCurrentUserPrincipal(); + } + + /** + * 杩斿洖鐢ㄦ埛鎸囧畾鑿滃崟鐨勬潈闄愭爣璇�(鏄惁瀛樺湪)锛屽鏋滀笉瀛樺湪杩斿洖绌恒�� + * @param menuId 瀵瑰簲鍔熻兘鑿滃崟ID + * @return + * @date 2022-12-21 + */ + protected String getCurrentDataScope(String menuId){ + UserPrincipal<S_user_core> userPrincipal = this.getCurrentUserPrincipal(); + return userPrincipal.getDataScope(menuId); + } + + public S_user_core getCurrentUser(){ + return this.acquireSecuritySpi().getCurrentUser(); + } + + public long getCurrentUserId(){ + return this.acquireSecuritySpi().getCurrentUserId(); + } + + /** + * 杩斿洖鍔犲瘑鍚庣殑瀵嗘枃 + * @param password 鏄庢枃瀵嗙爜 + * @return + * @date 2022-12-13 + */ + public String encryptPassword(String password){ + return this.acquireSecuritySpi().encryptPassword(password); + } + + /** + * 姣旇緝鎻愪緵鐨勬槑鏂囧瘑鐮佹槸鍚︿笌鍔犲瘑鐨勫瘑鐮佺浉鍚屻�� + * @param rawPassword 鏄庢枃鍘熷瀵嗙爜 + * @param encodedPassword 鍔犲瘑鍚庣殑瀵嗙爜 + * @return + */ + public boolean matchesPassword(String rawPassword, String encodedPassword){ + return this.acquireSecuritySpi().matchesPassword(rawPassword, encodedPassword); + } + + private SecuritySpi acquireSecuritySpi(){ + return BeanContextAware.getBeanByType(SecuritySpi.class); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/ArgumentsConstants.java b/iplatform-base/src/main/java/com/iplatform/base/ArgumentsConstants.java new file mode 100644 index 0000000..03241ea --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/ArgumentsConstants.java @@ -0,0 +1,103 @@ +package com.iplatform.base; + +/** + * 鍙彉鍙傛暟甯搁噺瀹氫箟锛屽彉閲忕殑KEY甯搁噺瀵瑰簲鏁版嵁搴撲腑鐨�: config_key 瀛楁銆� + * @author 鏃跺厠鑻� + * @date 2022-11-30 + */ +public class ArgumentsConstants { + + public static final String KEY_SECURITY_CAPTCHA_ENABLED = "security.captcha.enabled"; + + /** + * 鐢ㄦ埛鍒濆瀵嗙爜鍙傛暟锛屾槑鏂囧瘑鐮併�� + * @date 2022-12-13 + */ + public static final String KEY_SECURITY_PASSWORD_INIT = "security.password.init"; + + /** + * 瀹夊叏锛氭槸鍚﹀紑鍚敤鎴锋敞鍐� + * @date 2023-07-28 + */ + public static final String KEY_SECURITY_ACCOUNT_REGISTER = "security.account.register"; + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + //~ 骞冲彴閰嶇疆鍙傛暟锛屼互Tab鍒嗙粍鏂瑰紡灞曠ず鐨勭晫闈€��2023-05-12 + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + /** 绉诲姩绔煙鍚� */ + public static final String CONFIG_KEY_SITE_URL = "site_url"; + + /** 鍥剧墖涓婁紶绫诲瀷 1鏈湴 2涓冪墰浜� 3OSS 4COS, 榛樿鏈湴 + * <p>鏀寔绯荤粺鑷繁鐨勫畾涔夊父閲忥紝鍙傝�冿細{@linkplain com.walker.file.FileStoreType}</p> + * */ + public static final String CONFIG_UPLOAD_TYPE = "uploadType"; + + /** 鍏ㄥ眬鏈湴鍥剧墖鍩熷悕 */ + public static final String CONFIG_LOCAL_UPLOAD_URL = "localUploadUrl"; + /** 涓冪墰浜戜笂浼燯RL */ + public static final String CONFIG_QN_UPLOAD_URL = "qnUploadUrl"; + /** 闃块噷浜戜笂浼燯RL */ + public static final String CONFIG_AL_UPLOAD_URL = "alUploadUrl"; + /** 鑵捐浜戜笂浼燯RL */ + public static final String CONFIG_TX_UPLOAD_URL = "txUploadUrl"; + /** 浜氶┈閫奡3涓婁紶URL */ + public static final String CONFIG_S3_UPLOAD_URL = "s3UploadUrl"; + /** FTP涓婁紶URL */ + public static final String CONFIG_FTP_UPLOAD_URL = "ftpUploadUrl"; + + /** 鐗堟潈-鍏徃淇℃伅 */ + public static final String CONFIG_COPYRIGHT_COMPANY_INFO = "copyright_company_name"; + /** 鐗堟潈-鍏徃鍥剧墖 */ + public static final String CONFIG_COPYRIGHT_COMPANY_IMAGE = "copyright_company_image"; + + /** 鍥剧墖涓婁紶,鎷撳睍鍚� */ + public static final String UPLOAD_IMAGE_EXT_STR_CONFIG_KEY = "image_ext_str"; + /** 鍥剧墖涓婁紶,鏈�澶у昂瀵� */ + public static final String UPLOAD_IMAGE_MAX_SIZE_CONFIG_KEY = "image_max_size"; + /** 鏂囦欢涓婁紶,鎷撳睍鍚� */ + public static final String UPLOAD_FILE_EXT_STR_CONFIG_KEY = "file_ext_str"; + /** 鏂囦欢涓婁紶,鏈�澶у昂瀵� */ + public static final String UPLOAD_FILE_MAX_SIZE_CONFIG_KEY = "file_max_size"; + + /** 绉诲姩绔《閮╨ogo */ + public static final String CONFIG_KEY_MOBILE_TOP_LOGO = "mobile_top_logo"; + /** 绉诲姩绔櫥褰� logo */ + public static final String CONFIG_KEY_MOBILE_LOGIN_LOGO = "mobile_login_logo"; + /** 鍟嗗搧鍒嗙被椤甸厤缃� */ + public static final String CONFIG_CATEGORY_CONFIG = "category_page_config"; + /** 鏄惁闅愯棌涓�绾у垎绫� */ + public static final String CONFIG_IS_SHOW_CATEGORY = "is_show_category"; + /** 棣栭〉鍟嗗搧鍒楄〃妯℃澘閰嶇疆 */ + public static final String CONFIG_IS_PRODUCT_LIST_STYLE = "homePageSaleListStyle"; + + /** 搴曢儴瀵艰埅鈥旀槸鍚﹁嚜瀹氫箟 */ + public static final String CONFIG_BOTTOM_NAVIGATION_IS_CUSTOM = "bottom_navigation_is_custom"; + + /** 瀹㈡湇绫诲瀷 */ + public static final String CONFIG_CONSUMER_TYPE = "consumer_type"; + /** 瀹㈡埛绫诲瀷-H5 */ + public static final String CONSUMER_TYPE_H5 = "h5"; + /** 瀹㈡埛绫诲瀷-鐑嚎 */ + public static final String CONSUMER_TYPE_HOTLINE = "hotline"; + /** 瀹㈡湇H5閾炬帴 */ + public static final String CONFIG_CONSUMER_H5_URL = "consumer_h5_url"; + /** 瀹㈡湇鐢佃瘽 */ + public static final String CONFIG_CONSUMER_HOTLINE = "consumer_hotline"; + /** 搴楅摵琛楀紑鍏� */ + public static final String CONFIG_KEY_SHOP_STREET_SWITCH = "shop_street_switch"; + /** 瀹㈡湇鐢佃瘽 */ + public static final String CONFIG_CONSUMER_MESSAGE = "consumer_message"; + /** 瀹㈡湇閭 */ + public static final String CONFIG_CONSUMER_EMAIL = "consumer_email"; + + /** 鑷畾涔夎〃鍗曞紑鍏筹細鍏抽棴 */ + public static final String CONFIG_FORM_SWITCH_CLOSE = "'0'"; + /** 鑷畾涔夎〃鍗曞紑鍏筹細寮�鍚� */ + public static final String CONFIG_FORM_SWITCH_OPEN = "'1'"; + + /** 鍏叡寮�鍏筹細0鍏抽棴 */ + public static final String COMMON_SWITCH_CLOSE = "0"; + /** 鍏叡寮�鍏筹細1寮�鍚� */ + public static final String COMMON_SWITCH_OPEN = "1"; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/AsyncManager.java b/iplatform-base/src/main/java/com/iplatform/base/AsyncManager.java new file mode 100644 index 0000000..eaded98 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/AsyncManager.java @@ -0,0 +1,67 @@ +package com.iplatform.base; + +import com.iplatform.core.BeanContextAware; +import com.iplatform.core.util.ThreadUtils; + +import java.util.TimerTask; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; + +/** + * 寮傛浠诲姟绠$悊鍣� + * + * @author Mike + * @date 2023-01-05 + */ +public class AsyncManager +{ + /** + * 鎿嶄綔寤惰繜10姣 + */ + private final int OPERATE_DELAY_TIME = 10; + + /** + * 寮傛鎿嶄綔浠诲姟璋冨害绾跨▼姹� + */ + private ScheduledExecutorService executor = (ScheduledExecutorService)BeanContextAware.getBeanByName("scheduledExecutorService"); + + /** + * 鍗曚緥妯″紡 + */ + private AsyncManager(){} + + private static AsyncManager me = new AsyncManager(); + + public static AsyncManager me() + { + return me; + } + + /** + * 鎵ц浠诲姟 + * + * @param task 浠诲姟 + */ + public void execute(TimerTask task) + { + executor.schedule(task, OPERATE_DELAY_TIME, TimeUnit.MILLISECONDS); + } + + /** + * 鎵ц涓�涓紓姝ヤ换鍔� + * @param task 浠诲姟瀹氫箟 + * @param millSeconds 寤舵椂鎵ц锛堟绉掞級 + * @date 2023-08-17 + */ + public void execute(TimerTask task, long millSeconds){ + executor.schedule(task, millSeconds, TimeUnit.MILLISECONDS); + } + + /** + * 鍋滄浠诲姟绾跨▼姹� + */ + public void shutdown() + { + ThreadUtils.shutdownAndAwaitTermination(executor); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/CategoryCacheProvider.java b/iplatform-base/src/main/java/com/iplatform/base/CategoryCacheProvider.java new file mode 100644 index 0000000..5a3f7fb --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/CategoryCacheProvider.java @@ -0,0 +1,34 @@ +package com.iplatform.base; + +import com.iplatform.model.po.S_category; +import com.iplatform.model.vo.CategoryTreeVo; + +import java.util.List; + +/** + * 鍒嗙被缂撳瓨瀵硅薄銆� + * @author 鏃跺厠鑻� + * @date 2023-05-17 + */ +public interface CategoryCacheProvider { + + List<CategoryTreeVo> getTree(Integer type, Integer status, String name, List<Integer> categoryIdList, int owner); + + /** + * 杩斿洖鍒嗙被鏍戠粨鏋勶紙鐩墠鍙湁涓ょ骇锛� + * @param type 褰掑睘绫诲埆锛�1 浜у搧鍒嗙被锛�2 闄勪欢鍒嗙被锛�3 鏂囩珷鍒嗙被锛� 4 璁剧疆鍒嗙被锛� 5 鑿滃崟鍒嗙被锛� 6 閰嶇疆鍒嗙被锛� 7 绉掓潃閰嶇疆 + * @param status 鐘舵�侊細0姝e父锛�1澶辨晥 + * @param name 鍚嶇О锛堢洰鍓嶆湭鐭ワ級 + * @param owner 褰掑睘锛堝钩鍙版垨鍟嗘埛锛� + * @return + */ + List<CategoryTreeVo> getListTree(Integer type, Integer status, String name, int owner); + + S_category get(int id); + + void save(S_category category); + + void update(S_category category); + + void remove(int id); +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/Constants.java b/iplatform-base/src/main/java/com/iplatform/base/Constants.java new file mode 100644 index 0000000..d48635e --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/Constants.java @@ -0,0 +1,214 @@ +package com.iplatform.base; + +public class Constants { + + /** + * 瓒呯骇绠$悊鍛橀粯璁ょ殑鐧诲綍鍚嶇О銆� + * @author 鏃跺厠鑻� + * @date 2022-10-31 + */ + public static final String SUPERVISOR_NAME_DEFAULT = "supervisor"; + + /** + * 瓒呯骇绠$悊鍛業D = 0 + */ + public static final long SUPERVISOR_ID = 0L; + + /** + * 瓒呯骇绠$悊鍛樺鍚� + */ + public static final String SUPERVISOR_NAME_ZH = "涓诲璐﹀彿"; + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + /** + * 鐢ㄦ埛缂撳瓨token鍓嶇紑銆� + * @date 2022-11-01 + */ + public static final String USER_ONLINE_PREFIX = "login_token:"; + + /** + * 楠岃瘉鐮� redis key + * @date 2022-11-07 + */ + public static final String CAPTCHA_CODE_PREFIX = "captcha_codes:"; + + /** + * 褰撶粍缁囨満鏋勮〃娌℃湁璁板綍鏃讹紝榛樿鏄剧ず鏈烘瀯鍚嶇О銆� + * @date 2022-12-01 + */ + public static final String DEFAULT_ORG_NAME = "榛樿鍗曚綅"; + + /** + * 鏁版嵁鏉冮檺鍓嶇紑銆� + * @date 2022-12-21 + */ + public static final String DATA_SCOPE_NAME = "data_scope,"; + + /** + * 鍓嶇杩囨潵鐨勬彁浜ゅ弬鏁帮紝濡傛灉蹇呴』鎻愪緵鍒欓渶瑕佹鏌ワ紝杩斿洖闈炴硶鎻愮ず銆� + * @date 2023-06-01 + */ + public static final String ERROR_ARGUMENT = "鍙傛暟閿欒"; + + /** + * id鏌ヨ鏍¢獙涓嶅瓨鍦紝杩斿洖闈炴硶鎻愮ず銆� + * @date 2023-06-01 + */ + public static final String ERROR_NOT_EXIST = "淇℃伅涓嶅瓨鍦紝璇峰埛鏂板悗閲嶈瘯"; + + /** + * 鏍¢獙鐝骇缁撶彮锛岃繑鍥為潪娉曟彁绀恒�� + * @date 2023-06-01 + */ + public static final String ERROR_CLASS_IS_END = "鐝骇宸茬粨鐝紝鏃犳硶鎿嶄綔"; + + /** + * 骞冲彴闄勪欢涓婁紶锛屾槧灏勭殑娴忚璺緞銆� + * @date 2023-06-09 + */ + public static final String FILE_CONTEXT_PATH_MAPPING = "/file/**"; + /** + * 骞冲彴闄勪欢涓婁紶锛屾湰鍦版枃浠跺寘鍚殑璺緞锛岀敤浜庝粠璺緞涓垽鏂槸鍚RL鍦板潃銆� + * @date 2023-06-10 + */ + public static final String FILE_CONTEXT_PATH = "/file/"; + + /** + * 璁剧疆閿欒鏃ュ織锛屽唴瀹规渶澶ч暱搴︼紝榛樿锛�255 + * @date 2023-08-13 + */ + public static final int LOG_ERROR_MAX_SIZE = 255; + + /** 鏁版嵁鐘舵�侊細姝e父 */ + public static final int STATUS_NORMAL = 0; + /** 鏁版嵁鐘舵�侊細绂佺敤 */ + public static final int STATUS_DISABLE = 1; + /** 鏁版嵁鐘舵�侊細鍒犻櫎 */ + public static final int STATUS_DELETE = 2; + + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + //~ 缂撳瓨鍚嶇О甯搁噺锛�2023-01-04 + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + public static final String CACHE_NAME_MENU = "cache.base.menu"; + public static final String CACHE_NAME_CAPTCHA = "cache.base.captcha"; + public static final String CACHE_NAME_DEPT = "cache.base.dept"; + public static final String CACHE_NAME_HOST = "cache.system.host"; + public static final String CACHE_NAME_USER = "cache.base.user"; + public static final String CACHE_NAME_ONLINE_USER = "cache.base.user_online"; + public static final String CACHE_NAME_ARGUMENTS = "cache.base.arguments"; + public static final String CACHE_NAME_DICT = "cache.base.dict"; + public static final String CACHE_NAME_PUSH = "cache.base.push"; + public static final String CACHE_NAME_CATEGORY = "cache.base.category"; + public static final String CACHE_NAME_FORM = "cache.base.form"; + public static final String CACHE_NAME_GROUP = "cache.base.group"; + public static final String CACHE_NAME_USER_LOGIN = "cache.base.user_login"; + public static final String CACHE_NAME_WECHAT = "cache.base.wechat"; + public static final String CACHE_NAME_NOTIFICATION_TEMPLATE = "cache.notify.template"; + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + //~~ TCP 妯″潡鏍稿績甯搁噺锛�2023-04-17 + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + public static final String QUEUE_TYPE_MEMORY = "memory"; + + /** + * 鎺ㄩ�佽寖鍥村畾涔夊父閲忥細data 鏅�氬崟涓紝broadcast 骞挎挱銆� + * @date 2023-04-21 + */ + public static final String PUSH_SCOPE_DATA = "data"; + public static final String PUSH_SCOPE_BROAD_CAST = "broadcast"; + + /** + * 妯℃嫙鐭俊鎺ㄩ�佽�匢D + * @date 2023-04-25 + */ + public static final String PUSH_SMS_ID_MOCK = "mock_sms_push"; + + /** + * 鎺ㄩ�佸钩鍙版彁閱掓椂锛宖rom瀛楁榛樿鍊� + * @date 2023-04-25 + */ + public static final String PUSH_FROM_DEFAULT = "platform"; + public static final String PUSH_OPTION_TYPE_DEFAULT = "no_type"; + + /** + * 娑堟伅閫氱煡锛屽瓨鏀句复鏃剁紦瀛樺墠缂� + * @date 2023-04-27 + */ + public static final String PUSH_CACHE_PREFIX = "notification:"; + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + //~~ 瀵煎叆瀵煎嚭鐩稿叧锛�2023-05-08 + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + /** + * 鐢熸垚瀵煎叆妯℃澘鏂囦欢鍓嶇紑銆� + * @date 2023-05-08 + */ + public static final String TEMPLATE_IMPORT_PREFIX = "template_"; + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + //~~ 鐢靛晢鍩虹锛�2023-05-15 + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + /** + * 鏁版嵁褰掑睘锛氬钩鍙帮紝> 0 琛ㄧず鍟嗘埛ID + */ + public static final int OWNER_PLATFORM = -1; + + /** + * 绯荤粺鍩虹鍒嗙被鐨則ype绫诲瀷銆�<p></p> + * 绫诲瀷锛�1 浜у搧鍒嗙被锛�2 闄勪欢鍒嗙被锛�3 鏂囩珷鍒嗙被锛� 4 璁剧疆鍒嗙被锛� 5 鑿滃崟鍒嗙被锛� 6 閰嶇疆鍒嗙被锛� 7 绉掓潃閰嶇疆 + * @date 2023-05-18 + */ + public static final int CATEGORY_TYPE_CONFIG = 6; + public static final int CATEGORY_TYPE_ATTACH = 2; + + /** 鏂囦欢瀵煎嚭涓嬭浇鎷︽埅鍏抽敭瀛� */ + public static final String DOWNLOAD_FILE_KEYWORD = "downloadf"; + + /** 鏂囦欢鍓嶇涓婁紶鍚庝笅杞藉叧閿瓧 */ + public static final String UPLOAD_AFTER_FILE_KEYWORD = "uploadf"; + public static final String UPLOAD_AFTER_IMAGE_KEYWORD = "uploadi"; + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + //~~ 绯荤粺鍒嗙粍閰嶇疆椤癸紝2023-06-23 + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + /** 棣栭〉banner婊氬姩鍥� */ + public static final Integer GROUP_DATA_ID_INDEX_BANNER = 1; + /** 棣栭〉閲戝垰鍖� */ + public static final Integer GROUP_DATA_ID_INDEX_MENU = 2; + /** 鐑棬鎼滅储 */ + public static final Integer GROUP_DATA_ID_INDEX_KEYWORDS = 3; + /** 绉诲姩绔痏鍏呭�煎椁愯缃� */ + public static final Integer GROUP_DATA_ID_RECHARGE_PACKAGE = 4; + /** 涓汉涓績鑿滃崟 */ + public static final Integer GROUP_DATA_ID_USER_CENTER_MENU = 5; + /** 涓汉涓績杞挱鍥� */ + public static final Integer GROUP_DATA_ID_USER_CENTER_BANNER = 7; + /** 鍒嗛攢鎺ㄥ箍娴锋姤Banner */ + public static final Integer GROUP_DATA_ID_SPREAD_BANNER_LIST = 10; + /** 绉诲姩绔痏璁㈠崟鐘舵�乢鍥� */ + public static final Integer GROUP_DATA_ID_ORDER_STATUS_IMAGE = 13; + /** 绉诲姩绔痏搴曢儴瀵艰埅 */ + public static final Integer GROUP_DATA_ID_BOTTOM_NAVIGATION = 14; + + /** + * 鍒嗙粍閰嶇疆鏁版嵁涓紝鍥剧墖鍏抽敭璇嶅悕瀛椼�� + * @date 2023-06-24 + */ + public static final String GROUP_DATA_IMAGE = "pic"; + + /** 鍏叡寮�鍏筹細0鍏抽棴 */ + public static final String COMMON_SWITCH_CLOSE = "0"; + /** 鍏叡寮�鍏筹細1寮�鍚� */ + public static final String COMMON_SWITCH_OPEN = "1"; + + /** 鑷畾涔夎〃鍗曞紑鍏筹細鍏抽棴 */ + public static final String CONFIG_FORM_SWITCH_CLOSE = "'0'"; + /** 鑷畾涔夎〃鍗曞紑鍏筹細寮�鍚� */ + public static final String CONFIG_FORM_SWITCH_OPEN = "'1'"; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/DefaultUserPrincipal.java b/iplatform-base/src/main/java/com/iplatform/base/DefaultUserPrincipal.java new file mode 100644 index 0000000..b3d0cb2 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/DefaultUserPrincipal.java @@ -0,0 +1,148 @@ +package com.iplatform.base; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.iplatform.model.po.S_user_core; +import com.walker.web.DataStatus; +import com.walker.web.LoginType; +import com.walker.web.UserType; +import com.walker.web.principal.AbstractUserPrincipal; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 骞冲彴榛樿鐨勭敤鎴峰嚟璇佸璞★紝涓昏鐢ㄤ簬鐧诲綍璁よ瘉銆佹潈闄愭嫤鎴垽鏂娇鐢ㄣ�� + * 涓氬姟妯″潡涓嶄細浣跨敤璇ュ璞°�� + * @author 鏃跺厠鑻� + * @date 2022-10-31 + */ +public class DefaultUserPrincipal extends AbstractUserPrincipal<S_user_core> { + + private long lastLoginTime = 0; + private LoginType lastLoginType = LoginType.UserPassword; + + private List<String> roleIdList = new ArrayList<>(4); + + // 2022-12-21 鐢ㄦ埛鑿滃崟瀵瑰簲鐨勬暟鎹潈闄� + // key = menuId, value = dept_org(濡傦細鏈崟浣�) + private Map<String, String> dataScopeMap = new HashMap<>(); + + public DefaultUserPrincipal(){} + + public DefaultUserPrincipal(S_user_core user_core){ + if(user_core == null){ + throw new IllegalArgumentException("user info is required!"); + } + this.setUserInfo(user_core); + this.setId(String.valueOf(user_core.getId())); + this.setUserName(user_core.getUser_name()); + this.setPassword(user_core.getPassword()); + } + + @JsonIgnore + @Override + public boolean isEnabled() { + return this.getUserInfo().getStatus() == DataStatus.CONST_NORMAL; + } + + @JsonIgnore + @Override + public boolean isTokenExpired(String token) { + // 杩欓噷鏆傛湭瀹炵幇锛岄泦鎴愬悗鑵颁慨鏀� + return false; + } + + @JsonIgnore + @Override + public boolean isAccountLocked() { + // 杩欓噷鏆傛湭瀹炵幇锛岄泦鎴愬悗鑵颁慨鏀� + return false; + } + + @JsonIgnore + @Override + public boolean validateMd5Password(String encryption) { + return false; + } + + @Override + public long getLastLoginTime() { + return this.lastLoginTime; + } + + @Override + public LoginType getLastLoginType() { + return this.lastLoginType; + } + + public void setLastLoginTime(long loginTime){ + this.lastLoginTime = loginTime; + } + + public void setLastLoginType(LoginType loginType){ + this.lastLoginType = loginType; + } + + /** + * 杩斿洖璇ョ敤鎴锋嫢鏈夌殑瑙掕壊ID闆嗗悎銆� + * @return + */ + public List<String> getRoleIdList() { + return roleIdList; + } + + public void setRoleIdList(List<String> roleIdList) { + this.roleIdList = roleIdList; + } + + @JsonIgnore + @Override + public boolean isSupervisor() { + return this.getUserInfo().getUser_type().intValue() == UserType.TYPE_SUPER; + } + + /** + * 娣诲姞涓�鏉℃暟鎹潈闄� + * @param menuId 鑿滃崟ID锛屽搴斾竴涓姛鑳� + * @param dataScopeValue 鏁版嵁鏉冮檺鏍囪瘑 + * @date 2022-12-21 + */ + @JsonIgnore + public void addDataScope(String menuId, String dataScopeValue){ + this.dataScopeMap.put(menuId, dataScopeValue); + } + public void setDataScopeMap(Map<String, String> dataScopeMap){ + this.dataScopeMap = dataScopeMap; + } + + /** + * 鏍规嵁鑿滃崟ID锛屾煡璇㈡槸鍚﹀叿鏈夌壒瀹氱殑鏁版嵁鏉冮檺銆� + * @param menuId + * @return + * @date 2022-12-21 + */ + @JsonIgnore + @Override + public String getDataScope(String menuId){ + return this.dataScopeMap.get(menuId); + } + + public Map<String, String> getDataScopeMap(){ + return this.dataScopeMap; + } + + /** + * 璇ユ柟娉曟祴璇時edis搴忓垪鍖栦娇鐢紝鏆傛椂涓嶇敤銆� + * @param user_core + * @date 2022-11-15 + */ + @Deprecated + public void setup(S_user_core user_core){ + this.setUserInfo(user_core); + this.setId(String.valueOf(user_core.getId())); + this.setUserName(user_core.getUser_name()); + this.setPassword(user_core.getPassword()); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/DeptCacheProvider.java b/iplatform-base/src/main/java/com/iplatform/base/DeptCacheProvider.java new file mode 100644 index 0000000..b5e7a01 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/DeptCacheProvider.java @@ -0,0 +1,47 @@ +package com.iplatform.base; + +import com.iplatform.model.po.S_dept; + +import java.util.List; + +/** + * 缁勭粐鏈烘瀯缂撳瓨鎻愪緵鑰呬娇鐢ㄨ鑼冦��<p></p> + * 鍥犱负瀛樺湪澶氱瀹炵幇锛屽: Redis 鎴栬�� 鍐呭瓨锛屽洜姝ら渶瑕佹娊璞¤鎺ュ彛銆� + * @author 鏃跺厠鑻� + * @date 2022-12-03 + */ +public interface DeptCacheProvider { + + /** + * 璁剧疆鏄惁鍏佽缂撳瓨鏈烘瀯鐨勫瓙鏈烘瀯鍏崇郴锛�<br> + * 鍦ㄦ満鏋勬暟閲忛潪甯稿簽澶х殑鏃跺�欙紝鍗充究 Redis 涔熶笉澶�傚悎瀛樺偍璇ュ叧绯伙紝鍥犱负閫氬父鐣岄潰浼氬睍绀鸿緝澶氭暟鎹紝<br> + * 姝ゆ椂鍙兘閫�鍖栨垚鏁版嵁搴撴煡璇紝鎴栬�呴�氳繃鍏朵粬 NoSQL 鏁版嵁搴撳疄鐜般�� + * @param allow + * @date 2022-12-03 + */ + void setAllowCacheChildren(boolean allow); + + S_dept getDept(long deptId); + + void updateDept(S_dept s_dept); + + void removeDept(long deptId); + + void putDept(S_dept s_dept); + + /** + * 杩斿洖缁欏畾鏈烘瀯锛屼笅涓�绾у瓙鏈烘瀯ID闆嗗悎銆� + * @param deptId 缁欏畾褰撳墠鏈烘瀯ID + * @return + * @date 2022-12-03 + */ + List<String> getChildrenDeptIdOneLevel(long deptId); + + /** + * 杩斿洖缁欏畾鏈烘瀯锛屼笅涓�绾у瓙鏈烘瀯瀵硅薄闆嗗悎銆� + * @param deptId 缁欏畾褰撳墠鏈烘瀯ID + * @return + * @date 2022-12-03 + */ + List<S_dept> getChildrenDeptOneLevel(long deptId); +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/FileOperateSpi.java b/iplatform-base/src/main/java/com/iplatform/base/FileOperateSpi.java new file mode 100644 index 0000000..a122264 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/FileOperateSpi.java @@ -0,0 +1,82 @@ +package com.iplatform.base; + +import com.walker.file.FileInfo; +import com.walker.file.FileStoreType; + +import java.io.InputStream; +import java.util.List; + +/** + * 鏂囦欢鎿嶄綔鎻愪緵鑰呭畾涔夛紝鐢辩涓夋柟瀹炵幇鏂囦欢绠$悊鍔熻兘锛屽寘鎷�:涓婁紶銆佷笅杞姐�佽幏鍙栨枃浠朵俊鎭瓑銆� + * @author 鏃跺厠鑻� + * @date 2023-02-15 + */ +public interface FileOperateSpi { + + byte[] downloadOssFile(String id); + + /** + * 娓呴櫎缁欏畾鏂囦欢鍦板潃鐨凜DN鍓嶇紑銆傚锛歨ttps://qnyun.com/oss/12345678 + * <pre> + * 鍘绘帀鍓嶇紑鍚庯紝鍙墿涓�"12345678" + * </pre> + * @param path 缁欏畾鐨勬枃浠惰祫婧愬湴鍧� + * @return + * @date 2023-05-17 + */ + String clearCdnPrefix(String path); + + /** + * 鑾峰彇涓婁紶鏂囦欢鐨凜DN鍦板潃锛屾牴鎹娇鐢ㄧ殑涓嶅悓绗笁鏂规湇鍔′粠閰嶇疆涓煡鎵俱�� + * @return + * @date 2023-05-17 + */ + String getCdnUrl(); + + FileInfo uploadFileToLocal(InputStream inputStream + , String fileName, String groupId, long fileSize, Integer businessType, String owner) throws Exception; + FileInfo[] uploadFileToLocal(InputStream[] inputStream + , String[] fileName, String groupId, long[] fileSize, Integer businessType, String owner) throws Exception; + + FileInfo uploadFileToFtp(InputStream inputStream + , String fileName, String groupId, long fileSize, Integer businessType, String owner) throws Exception; + FileInfo[] uploadFileToFtp(InputStream[] inputStream + , String[] fileName, String groupId, long[] fileSize, Integer businessType, String owner) throws Exception; + + FileInfo uploadFileToOss(InputStream inputStream + , String fileName, String groupId, long fileSize, Integer businessType, String owner, FileStoreType ossType) throws Exception; + FileInfo[] uploadFileToOss(InputStream[] inputStream + , String[] fileName, String groupId, long[] fileSize, Integer businessType, String owner, FileStoreType ossType) throws Exception; + + @Deprecated + FileInfo uploadFileToSystem(InputStream inputStream, String fileName, String groupId, long fileSize) throws Exception; + + @Deprecated + FileInfo uploadFileToFtp(InputStream inputStream, String fileName, String groupId, long fileSize) throws Exception; + + FileInfo getFileInfo(long id); + + List<FileInfo> getFileInfoList(List<String> ids); + + /** + * 杩斿洖鏈湴鏂囦欢绯荤粺瀛樺偍鏍圭洰褰曪紝濡�: d:/tmp/ + * @return + * @date 2023-02-15 + */ + String getFileRootConfig(); + + /** + * 璋冪敤杩滅▼涓婁紶鏂囦欢锛屾槸鍚︽寜鐓ф湰鍦版柟寮忓鐞嗐�� + * <pre> + * 1)璇ラ�夐」涓轰簡閫傚簲娌℃湁FTP绛夋湇鍔$殑鎯呭喌锛岀壒鍒槸鍦ㄥ紑鍙戣繃绋嬶紝濡傛灉璁剧疆涓猴細true 鍒欒皟鐢ㄨ繙绋嬩笂浼犳柟娉曞悗鏂囦欢浠嶇劧淇濆瓨鍦ㄦ湰鍦般�� + * 2)濡傛灉鐢熶骇鐜瀛樺湪鍚堥�傜殑鏂囦欢瀛樺偍鏈嶅姟锛屽垯闇�瑕佽缃负锛歠alse + * </pre> + * @return + * @date 2023-07-03 + */ + boolean isRemoteAsLocal(); + + FileStoreType getOssFileStoreType(); + + String getOssPrefix(); +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/LocalDatabaseMetaEngine.java b/iplatform-base/src/main/java/com/iplatform/base/LocalDatabaseMetaEngine.java new file mode 100644 index 0000000..d074806 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/LocalDatabaseMetaEngine.java @@ -0,0 +1,100 @@ +package com.iplatform.base; + +import com.walker.connector.LocalAddress; +import com.walker.db.DatabaseType; +import com.walker.db.TableInfo; +import com.walker.db.page.GenericPager; +import com.walker.dbmeta.DatabaseMetaEngine; +import com.walker.dbmeta.FieldInfo; +import com.walker.dbmeta.support.DamengMetaEngine; +import com.walker.dbmeta.support.MySQLMetaEngine; +import com.walker.dbmeta.support.OracleMetaEngine; +import com.walker.dbmeta.support.PostgresMetaEngine; +import com.walker.dbmeta.support.SqlserverMetaEngine; +import com.walker.security.SystemLogMan; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * 瀹氫箟鏈湴鏁版嵁搴撳厓鏁版嵁寮曟搸瀵硅薄銆�<p></p> + * 鐢ㄤ簬鏌ヨ鏁版嵁搴撲腑琛ㄥ拰瀛楁璁板綍銆� + * @author 鏃跺厠鑻� + * @date 2022-11-22 + */ +public class LocalDatabaseMetaEngine { + + private DatabaseMetaEngine engine; + + private LocalAddress localAddress; + + public void setLocalAddress(LocalAddress localAddress) { + if(localAddress == null){ + throw new IllegalArgumentException("LocalAddress 蹇呴』鎻愪緵"); + } + this.localAddress = localAddress; + SystemLogMan.getInstance().checkMan(); + } + + public void setDatabaseType(DatabaseType databaseType){ + if(databaseType == DatabaseType.DERBY){ + throw new UnsupportedOperationException("涓嶆敮鎸佽鏁版嵁搴擄細" + databaseType.name()); + } else if(databaseType == DatabaseType.MYSQL){ + engine = new MySQLMetaEngine(); + + } else if(databaseType == DatabaseType.ORACLE){ + engine = new OracleMetaEngine(); + + } else if(databaseType == DatabaseType.POSTGRES){ + engine = new PostgresMetaEngine(); + + } else if(databaseType == DatabaseType.SQLSERVER){ + engine = new SqlserverMetaEngine(); + + } else if(databaseType == DatabaseType.DAMENG){ + // 2023-03-03 + engine = new DamengMetaEngine(); + + } else { + throw new IllegalArgumentException("unsupported database type: " + databaseType.name()); + } + System.out.println("鍒涘缓:" + engine.getClass().getName()); + } + + public List<FieldInfo> getFieldsObject(String tableName){ + return engine.getFieldsObject(this.localAddress, tableName); + } + + public List<String> getTableNamesByLike(String tableNameLike){ + return engine.getTableNamesByLike(this.localAddress, tableNameLike); + } + + /** + * 鍒嗛〉杩斿洖琛ㄤ俊鎭泦鍚堛�傚綋鍓嶉〉淇℃伅閫氳繃瀵硅薄: ListPageContext.getCurrentPageIndex()鏂规硶鑾峰緱銆� + * @param tableNameLike 琛ㄥ悕妯$硦鏌ヨ锛屽鏋滀负绌哄瓧绗︿覆鍒欐煡璇㈡墍鏈夈�� + * @return + * @date 2022-11-22 + */ + public GenericPager<TableInfo> queryPageTableNamesByLike(String tableNameLike +// , int pageIndex, int pageSize + ){ + return this.engine.queryPageTableNamesByLike(this.localAddress, tableNameLike); + } + + /** + * 杩斿洖鎸囧畾琛ㄥ厓鏁版嵁淇℃伅銆� + * @param tableName 琛ㄥ悕绉� + * @return + * @date 2022-11-26 + */ + public TableInfo queryOneTableInfo(String tableName){ + List<String> tableList = new ArrayList<>(2); + tableList.add(tableName); + Map<String, TableInfo> map = this.engine.getTableRows(this.localAddress, tableList); + if(map == null || map.size() == 0){ + return null; + } + return map.get(tableName); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/NotificationTemplateCache.java b/iplatform-base/src/main/java/com/iplatform/base/NotificationTemplateCache.java new file mode 100644 index 0000000..cef0083 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/NotificationTemplateCache.java @@ -0,0 +1,19 @@ +package com.iplatform.base; + +import com.iplatform.model.vo.NotificationTemplateVo; + +/** + * 閫氱煡鎻愰啋锛屾ā鏉块厤缃紦瀛樺畾涔夈�� + * @author 鏃跺厠鑻� + * @date 2023-08-25 + */ +public interface NotificationTemplateCache { + + NotificationTemplateVo get(String mark); + + void save(NotificationTemplateVo category); + + void update(NotificationTemplateVo category); + + void remove(String mark); +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/NotifyConstants.java b/iplatform-base/src/main/java/com/iplatform/base/NotifyConstants.java new file mode 100644 index 0000000..ff1ec03 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/NotifyConstants.java @@ -0,0 +1,22 @@ +package com.iplatform.base; + +/** + * 绉绘鑰佺▼搴忎唬鐮侊紝鍚庣画閫愭笎搴熷純浣跨敤銆� + * @date 2023-08-25 + */ +public class NotifyConstants { + + /** 娑堟伅寮�鍏崇姸鎬�-涓嶅瓨鍦� */ + public static int SWITCH_NOT_EXIST = 0; + /** 娑堟伅寮�鍏崇姸鎬�-寮�鍚� */ + public static int SWITCH_OPEN = 1; + /** 娑堟伅寮�鍏崇姸鎬�-鍏抽棴 */ + public static int SWITCH_COLSE = 2; + + /** 璇︽儏绫诲瀷鈥斺�斿叕浼楀彿妯℃澘娑堟伅 */ + public static String DETAIL_TYPE_WECHAT = "wechat"; + /** 璇︽儏绫诲瀷鈥斺�斿皬绋嬪簭妯℃澘娑堟伅 */ + public static String DETAIL_TYPE_ROUTINE = "routine"; + /** 璇︽儏绫诲瀷鈥斺�旂煭淇� */ + public static String DETAIL_TYPE_SMS = "sms"; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/PlatformAdapterController.java b/iplatform-base/src/main/java/com/iplatform/base/PlatformAdapterController.java new file mode 100644 index 0000000..1cf2a5b --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/PlatformAdapterController.java @@ -0,0 +1,189 @@ +package com.iplatform.base; + +import com.iplatform.base.pojo.form.FormData; +import com.iplatform.base.pojo.form.FormDataItem; +import com.iplatform.base.service.GroupServiceImpl; +import com.iplatform.core.BeanContextAware; +import com.iplatform.model.po.S_group_data; +import com.iplatform.model.vo.SystemGroupVo; +import com.walker.infrastructure.utils.JsonUtils; +import com.walker.infrastructure.utils.StringUtils; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; + +/** + * 鏂扮晫闈紝閲嶆瀯骞冲彴瀹氫箟鐨勫熀纭�鎺у埗鍣ㄣ�� + * @author 鏃跺厠鑻� + * @date 2023-05-15 + */ +public abstract class PlatformAdapterController extends SystemController{ + + protected SystemGroupCache getSystemGroupCache(){ + return BeanContextAware.getBeanByType(SystemGroupCache.class); + } + + private GroupServiceImpl getGroupService(){ + return BeanContextAware.getBeanByType(GroupServiceImpl.class); + } + + /** + * 鏍规嵁鍒嗙粍椤圭洰ID锛岃繑鍥炶浆鎹㈠悗鐨勫璞°�� + * @param groupDataId + * @param clazz + * @param cdnUrl + * @return + * @param <T> + * @date 2023-09-11 + */ + protected <T> T acquireGroupDataNormal(int groupDataId, Class<T> clazz, String cdnUrl){ + S_group_data groupData = this.getGroupService().queryGroupData(groupDataId); + if(groupData == null || groupData.getStatus().intValue() == 0){ + return null; + } + + try { + FormData formData = JsonUtils.jsonStringToObject(groupData.getValue(), FormData.class); + if(StringUtils.isEmptyList(formData.getFields())){ + return null; + } + HashMap<String, Object> map = new HashMap<>(); + for(FormDataItem item : formData.getFields()){ + if(item.getName().equals(Constants.GROUP_DATA_IMAGE)){ + map.put(item.getName(), cdnUrl + item.getValue()); + } else { + map.put(item.getName(), item.getValue()); + } + } + map.put("id", groupData.getId()); + String json = JsonUtils.objectToJsonString(map); + return JsonUtils.jsonStringToObject(json, clazz); + + } catch (Exception ex){ + throw new PlatformRuntimeException("S_group_data.value杞現ormData閿欒锛�" + ex.getMessage(), ex); + } + } + + /** + * 杩斿洖鍒嗙粍鍖呭惈鐨勫姩鎬佹坊鍔犻」鍒楄〃闆嗗悎銆� + * <pre> + * 1) 鐩墠锛屽湪鍏呭�煎姛鑳戒腑浣跨敤锛屾樉绀哄厖鍊煎椁愬垪琛ㄣ�� + * </pre> + * @param groupId 鍒嗙粍ID + * @param status 鏄惁鍙敤 + * @param clazz 杞崲缁撴灉瀵硅薄 + * @param cdnUrl 鍥剧墖鍓嶇紑 + * @return + * @param <T> + * @date 2023-09-11 + */ + protected <T> List<T> acquireGroupDataList(int groupId, boolean status, Class<T> clazz, String cdnUrl){ + SystemGroupVo vo = this.getSystemGroupCache().get(groupId); + if(vo == null){ + throw new IllegalStateException("缂撳瓨涓湭鎵惧埌鍒嗙粍璁板綍锛実roupId = " + groupId); + } + List<S_group_data> groupDataList = vo.getGroupDataList(); + if(StringUtils.isEmptyList(groupDataList)){ + return null; + } + + List<T> arrayList = new ArrayList<>(); + + try{ + FormData formData = null; + for(S_group_data data : groupDataList){ + formData = JsonUtils.jsonStringToObject(data.getValue(), FormData.class); + if(StringUtils.isEmptyList(formData.getFields())){ + continue; + } + if(status && data.getStatus().intValue() == 0){ + continue; + } + + HashMap<String, Object> map = new HashMap<>(); + T t; + for(FormDataItem item : formData.getFields()){ + if(item.getName().equals(Constants.GROUP_DATA_IMAGE)){ + map.put(item.getName(), cdnUrl + item.getValue()); + } else { + map.put(item.getName(), item.getValue()); + } + } + map.put("id", data.getId()); + String json = JsonUtils.objectToJsonString(map); + t = JsonUtils.jsonStringToObject(json, clazz); + arrayList.add(t); + } + return arrayList; + } catch (Exception ex){ + throw new PlatformRuntimeException("S_group_data.value杞現ormData閿欒锛�" + ex.getMessage(), ex); + } + } + + /** + * 鏍规嵁鍒嗙粍ID锛岃繑鍥炲垎缁勫寘鍚殑鏁版嵁椤归厤缃泦鍚堜俊鎭�備緥濡傦細 + * <pre> + * 1)閰嶇疆鐨凙PP棣栭〉搴曢儴瀵艰埅銆� + * </pre> + * @param groupId 鍒嗙粍ID + * @return + * @date 2023-06-23 + */ + protected List<HashMap<String, Object>> acquireGroupDataConfigList(int groupId, String cdnUrl){ + SystemGroupVo vo = this.getSystemGroupCache().get(groupId); + if(vo == null){ + throw new IllegalStateException("缂撳瓨涓湭鎵惧埌鍒嗙粍璁板綍锛実roupId = " + groupId); + } + List<S_group_data> groupDataList = vo.getGroupDataList(); + if(StringUtils.isEmptyList(groupDataList)){ + return new ArrayList<>(1); + } + + List<HashMap<String, Object>> arrayList = new ArrayList<>(); + + try { + FormData formData = null; + for (S_group_data data : groupDataList) { + formData = JsonUtils.jsonStringToObject(data.getValue(), FormData.class); + if(StringUtils.isEmptyList(formData.getFields())){ + continue; + } + + HashMap<String, Object> map = new HashMap<>(); + for(FormDataItem item : formData.getFields()){ + if(item.getName().equals(Constants.GROUP_DATA_IMAGE)){ + map.put(item.getName(), cdnUrl + item.getValue()); + } else { + map.put(item.getName(), item.getValue()); + } + } + map.put("id", data.getId()); + arrayList.add(map); + } + return arrayList; + + } catch (Exception ex){ + throw new PlatformRuntimeException("S_group_data.value杞現ormData閿欒锛�" + ex.getMessage(), ex); + } + } + + /** + * 杩斿洖鐢ㄦ埛褰掑睘鍊硷紝濡傛灉鏄钩鍙颁负'-1'锛屽鏋滀负绉熸埛锛堝晢鎴凤級鍒欎负瀹氫箟鐨勫晢鎴稩D銆� + * <pre> + * 娉ㄦ剰瑕佺偣锛� + * 1锛夊洜涓虹郴缁熸鏋朵腑鐢ㄦ埛鏄暱鏁村舰锛圠ong锛夛紝浣嗗晢鎴蜂腑鏄紙int锛夊洜姝ゅ湪瀹為檯娣诲姞鍟嗘埛鏁版嵁鏃讹紝闇�瑕佹寜鐓у簭鍒楁潵璁$畻锛岃繖鏍峰彧闇�瑕佹暣褰㈠嵆鍙�� + * </pre> + * @return + * @date 2023-05-15 + */ +// protected int getOwner(){ +// S_user_core user = this.getCurrentUser(); +// int userType = user.getUser_type(); +// if(userType == UserType.TYPE_SUPER_MERCHANT || userType == UserType.TYPE_MERCHANT_ADMIN){ +// return user.getMer_id().intValue(); +//// throw new UnsupportedOperationException("瀵逛簬鍏朵粬绉熸埛锛堝晢鎴凤級褰掑睘搴斾负锛歮er_id"); +// } +// return Constants.OWNER_PLATFORM; +// } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/PlatformLoginCallback.java b/iplatform-base/src/main/java/com/iplatform/base/PlatformLoginCallback.java new file mode 100644 index 0000000..2b3b711 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/PlatformLoginCallback.java @@ -0,0 +1,61 @@ +package com.iplatform.base; + +import com.iplatform.model.po.S_user_core; +import com.walker.infrastructure.ApplicationCallback; +import com.walker.web.CaptchaProvider; +import com.walker.web.CaptchaResult; +import com.walker.web.TokenException; +import com.walker.web.UserPrincipal; + +/** + * 骞冲彴鐧诲綍鍥炶皟鎺ュ彛瀹氫箟锛屼究浜庢敮鎸佸绉嶇敤鎴�(鎴栬澶�)浣跨敤鐩稿悓鏂瑰紡鐧诲綍绯荤粺銆� + * @author 鏃跺厠鑻� + * @date 2023-01-26 + */ +public interface PlatformLoginCallback extends ApplicationCallback { + + /** + * 鏄惁妫�娴嬮獙璇佺爜锛岃鏂规硶鎰忔�濇槸:鍦ㄦ彁浜ょ櫥褰曟椂锛屾槸鍚﹁楠岃瘉銆� + * <pre> + * 1)渚嬪:鍦≒C绔細瀛樺湪楠岃瘉鐮併�� + * 2)鍦ˋPP绔紝閫氳繃鐭俊鐧诲綍鏃讹紝涓嶄細鏈夐獙璇佺爜(鍙細鍦ㄧ敓鎴愮煭淇¢獙璇佺爜鏃舵墠鏈夐獙璇佹搷浣�) + * </pre> + * @return + */ + boolean isValidateCaptcha(); + + /** + * 鏍规嵁鐢ㄦ埛鐧诲綍ID锛岃繑鍥炵敤鎴风櫥褰曞熀鏈俊鎭��<p></p> + * + * @param loginId + * @return object[0] = S_user_core user, object[1] = List<String> roleIdList + */ + Object[] queryLoginUser(String loginId); + + /** + * 鏍¢獙瀵嗙爜鍥炶皟鏂规硶銆� + * @param userPrincipal + * @return + */ + boolean validatePassword(UserPrincipal<S_user_core> userPrincipal); + + /** + * 娉ㄩ攢鍥炶皟鏂规硶锛屽綋鐢ㄦ埛閫�鍑烘椂瑙﹀彂璋冪敤銆� + * @param token 瀹㈡埛绔彁浜ょ殑token + */ + void onLogout(String token) throws TokenException; + + /** + * 杩斿洖鐧诲綍鍥炶皟閰嶇疆鐨�'楠岃瘉鐮佹彁渚涜��' + * @return + * @date 2023-03-14 + */ + CaptchaProvider<CaptchaResult> getCaptchaProvider(); + + /** + * 璁剧疆鐧诲綍鍥炶皟閰嶇疆鐨�'楠岃瘉鐮佹彁渚涜��'锛屾瘡涓櫥褰曞洖璋冨璞¢兘闇�瑕侀厤缃竴涓�� + * @param captchaProvider + * @date 2023-03-14 + */ + void setCaptchaProvider(CaptchaProvider<CaptchaResult> captchaProvider); +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/PlatformRuntimeException.java b/iplatform-base/src/main/java/com/iplatform/base/PlatformRuntimeException.java new file mode 100644 index 0000000..89fa8e2 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/PlatformRuntimeException.java @@ -0,0 +1,19 @@ +package com.iplatform.base; + +import com.walker.web.WebRuntimeException; + +/** + * 骞冲彴鏈�鍩虹鐨勮繍琛屽紓甯稿畾涔夈�� + * @author 鏃跺厠鑻� + * @date 2023-05-20 + */ +public class PlatformRuntimeException extends WebRuntimeException { + + public PlatformRuntimeException(String msg) { + super(msg); + } + + public PlatformRuntimeException(String msg, Throwable caution){ + super(msg, caution); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/PlatformUserCallback.java b/iplatform-base/src/main/java/com/iplatform/base/PlatformUserCallback.java new file mode 100644 index 0000000..c85efd5 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/PlatformUserCallback.java @@ -0,0 +1,34 @@ +package com.iplatform.base; + +import com.iplatform.model.po.S_user_core; +import com.walker.infrastructure.ApplicationCallback; + +/** + * 鐢ㄦ埛鎿嶄綔鍥炶皟鎺ュ彛瀹氫箟銆� + * <pre> + * 1)涓氬姟鍙互閰嶇疆瀹炵幇鑷繁鐨勭敤鎴锋搷浣滃洖璋冨姩浣滐紝濡傦細褰撶郴缁熸坊鍔犵敤鎴锋椂锛屼笟鍔¤鍒濆璁剧疆鐢ㄦ埛榛樿绉垎绛夈�� + * 2)瀹炵幇璇ユ帴鍙e悗锛岀洿鎺ラ厤缃负<code>Sping Bean</code> 鍗冲彲銆� + * 3)娉ㄦ剰:璇ユ柟娉曚細鍦ㄦ暟鎹簱浜嬪姟涓皟鐢紝鍥犳涓氬姟灏介噺鍦ㄥ洖璋冧腑鍙搷浣滄暟鎹簱锛岄檷浣庢椂闂存搷浣滆繃闀块闄┿�� + * </pre> + * @date 2023-01-05 + */ +public interface PlatformUserCallback extends ApplicationCallback { + + /** + * 褰撶郴缁熷垱寤烘柊鐢ㄦ埛鏃讹紝鍥炶皟璇ユ帴鍙� + * @param user + */ + public void onCreateNewUser(S_user_core user); + + /** + * 褰撶郴缁熸洿鏂扮敤鎴锋椂锛屽洖璋冭鎺ュ彛 + * @param user + */ + public void onUpdateUser(S_user_core user); + + /** + * 褰撶郴缁熷垹闄ょ敤鎴锋椂锛屽洖璋冭鎺ュ彛 + * @param userId + */ + public void onDeleteUser(long userId); +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/PushCacheProvider.java b/iplatform-base/src/main/java/com/iplatform/base/PushCacheProvider.java new file mode 100644 index 0000000..28fee20 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/PushCacheProvider.java @@ -0,0 +1,13 @@ +package com.iplatform.base; + +/** + * 鎺ㄩ�佹彁閱掞紝缂撳瓨瀹氫箟銆傚瓨鍌ㄤ复鏃跺苟琛岄�氱煡鐨勬秷鎭紝2鍒嗛挓鍐呭け鏁堛�� + * @author 鏃跺厠鑻� + * @date 2023-04-27 + */ +public interface PushCacheProvider { + + void put(String key, String value); + + String get(String key); +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/PushController.java b/iplatform-base/src/main/java/com/iplatform/base/PushController.java new file mode 100644 index 0000000..148bfad --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/PushController.java @@ -0,0 +1,106 @@ +package com.iplatform.base; + +import com.iplatform.base.push.DefaultPushManager; +import com.iplatform.base.util.NotificationUtils; +import com.walker.infrastructure.utils.DateUtils; +import com.walker.infrastructure.utils.NumberGenerator; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.push.Notification; +import com.walker.push.NotificationChannel; +import com.walker.push.util.PushUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +public abstract class PushController extends SystemController{ + + /** + * 鍙戦�佺煭淇¢獙璇佺爜锛岀櫥褰曚笌鍚﹂兘鍙皟鐢ㄣ�� + * @param code 鍙戦�佺殑楠岃瘉鐮� + * @param userIdOrMobile 鐢ㄦ埛ID 鎴栬�� 鎵嬫満鍙� + * @date 2023-04-26 + */ + protected void pushSmsValidateCode(String code, String userIdOrMobile){ + String creator = this.getCurrentUserPrincipal() == null? "creator" : this.getCurrentUserPrincipal().getId(); + ((DefaultPushManager)this.getPushManager()).pushSmsValidateCode(code, userIdOrMobile, creator); + } + + /** + * 鎺ㄩ�佺煭淇″唴瀹癸紝鐧诲綍涓庡惁閮藉彲璋冪敤銆� + * @param templateCode 鐭俊妯℃澘浠g爜 + * @param param 鍙傛暟 + * @param userIdOrMobile 鐢ㄦ埛ID 鎴栬�� 鎵嬫満鍙� + * @date 2023-04-26 + */ + protected void pushSmsNotification(String templateCode, Map<String, String> param, String userIdOrMobile){ + String creator = this.getCurrentUserPrincipal() == null? "creator" : this.getCurrentUserPrincipal().getId(); + Notification notification = NotificationUtils + .acquireSmsNotification(templateCode, param, null, userIdOrMobile, creator); + this.getPushManager().pushSms(notification); + } + + /** + * 鎺ㄩ�侀偖浠堕�氱煡锛岃鏂规硶鏃犺鐧诲綍閮藉彲璋冪敤銆� + * <p>涓嶇櫥褰曠殑璇濓紝userIdOrMail 蹇呴』鏄偖浠跺湴鍧�</p> + * @param title 鏍囬 + * @param content 鍐呭 + * @param userIdOrMail 鐢ㄦ埛ID锛堟垨閭欢鍦板潃锛� + * @date 2023-04-26 + */ + protected void pushMailNotification(String title, String content, String userIdOrMail){ + if(StringUtils.isEmpty(title) + || StringUtils.isEmpty(content) + || StringUtils.isEmpty(userIdOrMail)){ + throw new IllegalArgumentException("鎺ㄩ�侀偖浠跺け璐ワ細鍙傛暟涓虹┖!"); + } + String creator = this.getCurrentUserPrincipal() == null? "creator" : this.getCurrentUserPrincipal().getId(); + Notification notification = PushUtils.acquireEmailNotificationOne(title, content + , ((DefaultPushManager)this.getPushManager()).getMailFrom(), userIdOrMail, creator); + this.getPushManager().push(notification, null); + } + + /** + * 鎺ㄩ�佸钩鍙版櫘閫氭秷鎭紝涓嶅寘鎷細閭欢鍜岀煭淇°�� + * <p>杩欎簺閫氱煡浼氫繚瀛樺埌鏁版嵁搴撲腑锛屼竴鑸负鎿嶄綔涓氬姟鐨勫悇绉嶉�氱煡锛屽锛氬緟鍔炰簨椤圭瓑銆�</p> + * @param pushData 涓氬姟浼犻�掔殑鏁版嵁 + * @date 2023-04-26 + */ + protected void pushMessageNotification(PushData pushData){ + if(pushData == null){ + throw new IllegalArgumentException("pushData is null!"); + } + if(StringUtils.isEmpty(pushData.getBusinessType()) + || StringUtils.isEmpty(pushData.getBusinessId()) + || StringUtils.isEmpty(pushData.getUserId())){ + throw new IllegalArgumentException("鎺ㄩ�佷笟鍔℃秷鎭己灏戞潯浠讹細businessType, businessId, userId"); + } + + String creator = this.getCurrentUserPrincipal() == null? "creator" : this.getCurrentUserPrincipal().getId(); + + Notification notification = new Notification(); + notification.setCreator(creator); + notification.setCreateTime(DateUtils.getDateTimeNumber()); + notification.setFrom(Constants.PUSH_FROM_DEFAULT); + notification.setTitle(pushData.getTitle()); + notification.setOptionId(pushData.getBusinessId()); + notification.setOptionType(pushData.getBusinessType()); + notification.setContent(pushData.toJson()); + notification.setId(NumberGenerator.getLongSequenceId()); + + List<String> receiverList = new ArrayList<>(2); + receiverList.add(pushData.getUserId()); + notification.setReceiverList(receiverList); + + // 鏍规嵁骞冲彴閰嶇疆瀹炵敤閫氶亾 + List<NotificationChannel> channelList = new ArrayList<>(4); + for(String index : this.getPushManager().getMessageChannelNames()){ + channelList.add(NotificationChannel.getType(index)); + } + notification.setChannelList(channelList); + // 鏄惁骞惰 + notification.setParallel(this.getPushManager().isMessageParallel()); + + this.getPushManager().push(notification, null); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/PushData.java b/iplatform-base/src/main/java/com/iplatform/base/PushData.java new file mode 100644 index 0000000..dbc223f --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/PushData.java @@ -0,0 +1,99 @@ +package com.iplatform.base; + +import com.walker.infrastructure.utils.JsonUtils; + +import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; + +/** + * 骞冲彴瀹氫箟鐨勪笟鍔℃帹閫侊紙娑堟伅锛夊璞°��<p>璇ュ璞″湪涓氬姟灞備娇鐢ㄣ��</p> + * @author 鏃跺厠鑻� + * @date 2023-04-25 + */ +public class PushData implements Serializable { + + @Override + public String toString(){ + return new StringBuilder("[userId=").append(this.userId) + .append(", bizId=").append(this.businessId) + .append(", type=").append(this.businessType) + .append(", schema=").append(this.schema) + .append(", title=").append(this.title) + .append("]").toString(); + } + + public String toJson(){ + try { + return JsonUtils.objectToJsonString(this); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public void addParameter(String key, Object value){ + if(this.parameter == null){ + this.parameter = new HashMap<>(2); + } + this.parameter.put(key, value); + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public String getBusinessId() { + return businessId; + } + + public void setBusinessId(String businessId) { + this.businessId = businessId; + } + + public String getBusinessType() { + return businessType; + } + + public void setBusinessType(String businessType) { + this.businessType = businessType; + } + + public String getSchema() { + return schema; + } + + public void setSchema(String schema) { + this.schema = schema; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Map<String, Object> getParameter() { + return parameter; + } + + public void setParameter(Map<String, Object> parameter) { + this.parameter = parameter; + } + + private String userId; + private String businessId; + private String businessType; + private String schema; + private String title; + private Map<String, Object> parameter = null; + + public static final String SCHEMA_HTTP = "https://"; + public static final String SCHEMA_APP = "app://"; + public static final String SCHEMA_SYSTEM = "system://"; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/RootConfigBean.java b/iplatform-base/src/main/java/com/iplatform/base/RootConfigBean.java new file mode 100644 index 0000000..ce9236a --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/RootConfigBean.java @@ -0,0 +1,83 @@ +package com.iplatform.base; + +import com.iplatform.base.cache.DictCacheProvider; +import com.iplatform.base.callback.PlatformCallbackPostProcessor; +import com.iplatform.base.di.PlatformDataImportEngine; +import com.walker.cache.CacheProvider; +import com.walker.push.PushManager; +import com.walker.web.CaptchaProvider; +import com.walker.web.CaptchaResult; + +import java.util.List; + +/** + * 绯荤粺涓氬姟bean閰嶇疆鎬荤鐞嗭紝鐢ㄤ簬娴嬭瘯鍦� SystemController 鍒濆鍖栧悗鑷姩缁勮涓�浜涢�氱敤缂撳瓨瀵硅薄銆�<p></p> + * 娴嬭瘯閫氳繃锛� + * @author 鏃跺厠鑻� + * @date 2023-03-10 + */ +public class RootConfigBean { + + /** + * 瑙﹀彂鑷姩璁剧疆鍚勭鍏叡 Bean 鍒扮郴缁熸帶鍒跺櫒涓紝涓嶇敤鍦ㄥ垱寤烘椂鎵嬪姩娉ㄥ叆锛屼篃涓嶉渶瑕佷緷璧� spring鐨勭壒瀹氭敞瑙c�� + * @date 2023-03-10 + */ + public void startup(){ + List<SystemController> systemControllerList = this.callbackPostProcessor.getSystemControllerList(); + if(systemControllerList != null){ + for(SystemController controller : systemControllerList){ + controller.setDictCacheProvider(this.dictCacheProvider); + controller.setDeptCacheProvider(this.deptCacheProvider); + controller.setUserCacheProvider(this.userCacheProvider); + controller.setPlatformDataImportEngine(this.platformDataImportEngine); + controller.setPushManager(this.pushManager); + controller.setSmsCaptchaProvider(this.smsCaptchaProvider); + controller.setCaptchaCacheProvider(this.captchaCacheProvider); + } + System.out.println("............... | RootConfigBean: startup()"); + } + } + + public void setCallbackPostProcessor(PlatformCallbackPostProcessor callbackPostProcessor) { + this.callbackPostProcessor = callbackPostProcessor; + } + + public void setDeptCacheProvider(DeptCacheProvider deptCacheProvider) { + this.deptCacheProvider = deptCacheProvider; + } + + public void setUserCacheProvider(UserCacheProvider userCacheProvider) { + this.userCacheProvider = userCacheProvider; + } + + public void setPlatformDataImportEngine(PlatformDataImportEngine platformDataImportEngine) { + this.platformDataImportEngine = platformDataImportEngine; + } + + public void setDictCacheProvider(DictCacheProvider dictCacheProvider) { + this.dictCacheProvider = dictCacheProvider; + } + + public void setPushManager(PushManager pushManager) { + this.pushManager = pushManager; + } + + public void setSmsCaptchaProvider(CaptchaProvider<CaptchaResult> smsCaptchaProvider) { + this.smsCaptchaProvider = smsCaptchaProvider; + } + + public void setCaptchaCacheProvider(CacheProvider<String> captchaCacheProvider) { + this.captchaCacheProvider = captchaCacheProvider; + } + + private CaptchaProvider<CaptchaResult> smsCaptchaProvider; + private CacheProvider<String> captchaCacheProvider; + + private PushManager pushManager; + private PlatformCallbackPostProcessor callbackPostProcessor = null; + + private DeptCacheProvider deptCacheProvider; + private UserCacheProvider userCacheProvider; + private PlatformDataImportEngine platformDataImportEngine; + private DictCacheProvider dictCacheProvider; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/SecurityConstants.java b/iplatform-base/src/main/java/com/iplatform/base/SecurityConstants.java new file mode 100644 index 0000000..5f7bd44 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/SecurityConstants.java @@ -0,0 +1,38 @@ +package com.iplatform.base; + +public class SecurityConstants { + + public static final String ROLE_SUPER_ADMIN = "ROLE_SUPERVISOR"; + public static final String ROLE_ADMIN = "ROLE_ADMIN"; + public static final String ROLE_USER = "ROLE_USER"; + + /** + * 椤剁骇鏈烘瀯鐗规湁鐨勬潈闄愯鑹诧紝渚嬪锛氬晢鎴风嫭绔嬭鑹诧紙绗笁鏂癸級 + * @date 2023-06-07 + */ + public static final String ROLE_MERCHANT = "ROLE_MERCHANT"; + +// /** +// * activiti7宸ヤ綔娴佸己鍒朵娇鐢ㄧ殑瑙掕壊 +// * @date 2023-03-21 +// */ +// public static final String ROLE_ACTIVITI_USER = "ROLE_ACTIVITI_USER"; + + /** + * 宸ヤ綔娴佽闂矾寰勫墠缂�銆� + * @date 2023-03-21 + */ + public static final String URL_WORKFLOW_PREFIX = "/wf/"; + + /** + * 杩斿洖鐢靛晢鍓嶇鐢ㄦ埛鍩烘湰淇℃伅锛岀敤鎴稫EY鍚嶇О銆� + * @date 2023-05-12 + */ + public static final String KEY_USER_INFO = "userInfo"; + + /** + * 绉诲姩绔敤鎴蜂俊鎭紝鍏抽敭瀛楀畾涔夈�� + * @date 2023-06-30 + */ + public static final String KEY_USER_INFO_APP = "userInfoApp"; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/SecuritySpi.java b/iplatform-base/src/main/java/com/iplatform/base/SecuritySpi.java new file mode 100644 index 0000000..8c4d3fe --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/SecuritySpi.java @@ -0,0 +1,81 @@ +package com.iplatform.base; + +import com.iplatform.base.exception.LoginException; +import com.iplatform.base.pojo.RequestLogin; +import com.iplatform.model.po.S_user_core; +import com.walker.web.UserPrincipal; + +import java.util.List; +import java.util.Map; + +/** + * 瀹夊叏鎻愪緵鑰呮帴鍙e畾涔夈��<br> + * 閫氳繃璇ユ帴鍙d娇寰� iplatform-base-security 妯″潡鍙互瑙h�︺�� + * @author 鏃跺厠鑻� + * @date 2022-11-11 + */ +public interface SecuritySpi { + + /** + * 杩斿洖褰撳墠鐧诲綍鐢ㄦ埛鍏锋湁鐨勮鑹睮D闆嗗悎銆� + * @return + */ + List<String> getCurrentUserRoleIdList(); + + /** + * 杩斿洖褰撳墠鐧诲綍鐢ㄦ埛鍑瘉淇℃伅 + * @return + */ + UserPrincipal<S_user_core> getCurrentUserPrincipal(); + + /** + * 杩斿洖褰撳墠鐧诲綍鐢ㄦ埛瀵硅薄 + * @return + */ + S_user_core getCurrentUser(); + + /** + * 杩斿洖褰撳墠鐧诲綍鐢ㄦ埛ID + * @return + */ + long getCurrentUserId(); + + /** + * 鍔犲瘑缁欏畾鐨勬槑鏂囧瘑鐮� + * @param password + * @return 杩斿洖瀵嗘枃瀵嗙爜 + */ + String encryptPassword(String password); + + /** + * 姣旇緝缁欏畾鐨勫瘑鐮佹槸鍚︿笌鍔犲瘑鐩哥瓑銆� + * @param rawPassword 鍘熷鏄庢枃瀵嗙爜 + * @param encodedPassword 鍔犲瘑鐨勫瘑鐮� + * @return + */ + boolean matchesPassword(String rawPassword, String encodedPassword); + + /** + * 鏄惁鍏佽绉诲姩绔紝鍦ㄧ櫥褰曟椂鎵嬫満鍙蜂笉瀛樺湪鐩存帴娉ㄥ唽锛� + * @return + * @date 2023-06-28 + */ + boolean isAllowMobileLoginRegister(); + + /** + * 鐢ㄦ埛鐧诲綍绯荤粺杩囩▼鏂规硶锛屾娊鍙栬鏂规硶鍙互鍦ㄨ嚜瀹氫箟鐧诲綍涓伒娲讳娇鐢ㄣ�� + * @param requestLogin + * @return + * @throws LoginException 鐧诲綍寮傚父鎶涘嚭鎻愮ず閿欒 + * @date 2023-06-28 + */ + Map<String, Object> login(RequestLogin requestLogin) throws LoginException; + + /** + * 浠ユ祦绋嬭鑹茬櫥褰曡幏鍙栨潈闄愶紝activiti7涓撶敤锛屽悗缁細搴熷純銆� + * @author 鏃跺厠鑻� + * @date 2023-03-21 + */ + @Deprecated + void loginAsWorkflowRole(); +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/SystemController.java b/iplatform-base/src/main/java/com/iplatform/base/SystemController.java new file mode 100644 index 0000000..f8ecdb2 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/SystemController.java @@ -0,0 +1,551 @@ +package com.iplatform.base; + +import com.iplatform.base.cache.DictCacheProvider; +import com.iplatform.base.di.PlatformDataImportEngine; +import com.iplatform.base.di.TemplateInfo; +import com.iplatform.base.service.DeptServiceImpl; +import com.iplatform.base.service.LogServiceImpl; +import com.iplatform.base.service.RoleServiceImpl; +import com.iplatform.base.service.UserServiceImpl; +import com.iplatform.base.support.strategy.LoginStrategyManager; +import com.iplatform.base.util.MenuUtils; +import com.iplatform.core.BeanContextAware; +import com.iplatform.model.po.S_dept; +import com.iplatform.model.po.S_dict_data; +import com.iplatform.model.po.S_oper_log; +import com.iplatform.model.po.S_user_core; +import com.iplatform.model.po.S_user_login; +import com.walker.cache.CacheProvider; +import com.walker.infrastructure.utils.DateUtils; +import com.walker.infrastructure.utils.FileCopyUtils; +import com.walker.infrastructure.utils.NumberGenerator; +import com.walker.infrastructure.utils.PhoneNumberUtils; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.push.PushManager; +import com.walker.web.CaptchaProvider; +import com.walker.web.CaptchaResult; +import com.walker.web.OrgType; +import com.walker.web.ResponseCode; +import com.walker.web.UserOnlineProvider; +import com.walker.web.UserPrincipal; +import com.walker.web.UserType; +import com.walker.web.WebAgentService; +import com.walker.web.WebUserAgent; +import com.walker.web.log.BusinessType; +import com.walker.web.log.OperateUser; +import com.walker.web.util.IdUtils; +import com.walker.web.util.ServletUtils; +import jakarta.servlet.http.HttpServletRequest; + +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.TimerTask; + +/** + * 绯荤粺鎺у埗鍣ㄥ璞★紝涓氬姟鎵�鏈� <code>Controller</code> 瀵硅薄锛岄兘瑕佺户鎵胯瀵硅薄銆� + * @author 鏃跺厠鑻� + * @date 2022-12-01 + */ +public abstract class SystemController extends AbstractFileOperateSpiController{ + + /** + * 鏇存柊缁欏畾鐢ㄦ埛鐧诲綍缂撳瓨涓殑瑙掕壊闆嗗悎鍐呭锛宺oleIds銆� + * <pre> + * 1) 褰撶敤鎴峰彉鏇磋鑹插悗锛屽彲浠ョ洿鎺ュ埛鏂扮晫闈紙閲嶆柊璇锋眰鐢ㄦ埛淇℃伅锛夎幏鍙栨柊鐨勫搴旇彍鍗曟潈闄愩�� + * </pre> + * @param userId 鐢ㄦ埛ID + * @author 鏃跺厠鑻� + * @date 2023-12-28 + */ + protected void updateLoginUserRoleListInCache(Long userId){ + S_user_core userCore = this.getUser(userId); + if(userCore == null){ + throw new PlatformRuntimeException("缂撳瓨涓湭鏌ユ壘鍒扮敤鎴凤紝杩欎笉姝e父锛寀serId = " + userId, null); + } + S_user_login userLogin = this.getLoginStrategyManager().getUserLogin(userCore.getUser_name()); + if(userLogin == null){ + if(this.logger.isDebugEnabled()){ + this.logger.debug("鐢ㄦ埛锛歿}涓嶅瓨鍦ㄧ櫥褰曠紦瀛橈紝鏃犻渶鏇存柊瑙掕壊锛坮oleId锛夌紦瀛橈紝userName={}", userId, userCore.getUser_name()); + } + return; + } + + UserPrincipal<?> existUserPrincipal = BeanContextAware.getBeanByType(UserOnlineProvider.class).getUserPrincipal(userLogin.getUuid()); + if (existUserPrincipal==null) { + return; + } + List<String> existRoleIdList = existUserPrincipal.getRoleIdList(); + +// List<String> roleIdList = this.getUserService().queryUserRoleIdList(userId); + List<String> roleIdList = BeanContextAware.getBeanByType(RoleServiceImpl.class).queryUserRoleIdList(userId); + if(this.logger.isDebugEnabled()){ + this.logger.debug("缁欏畾鐢ㄦ埛锛歿}锛屽寘鍚殑瑙掕壊锛歿}", userId, roleIdList); + } + if(StringUtils.isEmptyList(roleIdList)){ + roleIdList = new ArrayList<>(4); + } + // 鎶婂師鏉ョ敤鎴峰凡鏈夌殑绯荤粺绾ф潈闄愯鑹查噸鏂板啓鍏ワ紝鍚﹀垯鐢ㄦ埛浼氶噸鏂拌鐧诲綍 + if(existRoleIdList != null){ + for(String securityRoleName : existRoleIdList){ + if(securityRoleName.equals(SecurityConstants.ROLE_USER) + || securityRoleName.equals(SecurityConstants.ROLE_ADMIN) + || securityRoleName.equals(SecurityConstants.ROLE_SUPER_ADMIN) + || securityRoleName.equals(SecurityConstants.ROLE_MERCHANT)){ + roleIdList.add(securityRoleName); + } + } + } + + DefaultUserPrincipal userPrincipal = new DefaultUserPrincipal(userCore); + userPrincipal.setRoleIdList(roleIdList); + // 鏇存柊缂撳瓨鐨勭櫥褰曚俊鎭� + BeanContextAware.getBeanByType(UserOnlineProvider.class).cacheUserPrincipal(userLogin.getUuid(), userPrincipal, VariableConstants.DEFAULT_TOKEN_EXPIRED_MINUTES); + } + + protected UserLoginCache getUserLoginCache(){ + return BeanContextAware.getBeanByType(UserLoginCache.class); + } + + /** + * 鑾峰緱閫氱煡鎻愰啋妯℃澘閰嶇疆缂撳瓨銆� + * @return + * @date 2023-08-25 + */ + protected NotificationTemplateCache getNotificationTemplateCache(){ + return BeanContextAware.getBeanByType(NotificationTemplateCache.class); + } + + /** + * 鍐欏叆鎴愬姛鎿嶄綔鏃ュ織 + * @param userName 褰撳墠鐢ㄦ埛鍚嶏紝鍙互鏄櫥褰旾D鎴栧悕瀛楋紝鍙�� + * @param operateUser 鎿嶄綔鐢ㄦ埛绫诲瀷 + * @param businessType 涓氬姟绫诲瀷 + * @param title 鏍囬鎻忚堪锛屽彲閫� + * @param input 杈撳叆鍙傛暟锛屽彲閫� + * @param output 杈撳嚭鍙傛暟锛屽彲閫� + * @date 2023-08-13 + */ + protected void systemLogSuccess(String userName, OperateUser operateUser, BusinessType businessType + , String title, String input, String output){ + S_oper_log s_oper_log = this.acquireSystemLog(userName, operateUser, businessType, title, input, output); + AsyncManager.me().execute(new TimerTask() { + @Override + public void run() { + BeanContextAware.getBeanByType(LogServiceImpl.class).execInsertOperateLog(s_oper_log); + } + }); + } + + /** + * 鍐欏叆閿欒鏃ュ織 + * @param userName 褰撳墠鐢ㄦ埛鍚嶏紝鍙互鏄櫥褰旾D鎴栧悕瀛楋紝鍙�� + * @param operateUser 鎿嶄綔鐢ㄦ埛绫诲瀷锛屽彲閫� + * @param businessType 涓氬姟绫诲瀷锛屽彲閫� + * @param title 鏍囬鎻忚堪锛屽彲閫� + * @param input 杈撳叆鍙傛暟锛屽彲閫� + * @param error 閿欒鍐呭锛屽繀濉� + * @date 2023-08-13 + */ + protected void systemLogError(String userName, OperateUser operateUser, BusinessType businessType, String title, String input, String error){ + if(StringUtils.isEmpty(error)){ + logger.warn("璋冪敤鍐欏叆閿欒鏃ュ織锛屼絾鏈彁渚涢敊璇唴瀹癸紝鏃ュ織灏嗕笉浼氫繚瀛橈細systemLogError --> error is null!"); + return; + } + S_oper_log s_oper_log = this.acquireSystemLog(userName, operateUser, businessType, title, input, null); + s_oper_log.setStatus(ResponseCode.ERROR.getCode()); + s_oper_log.setError_msg(StringUtils.substring(error, 0, Constants.LOG_ERROR_MAX_SIZE)); + AsyncManager.me().execute(new TimerTask() { + @Override + public void run() { + BeanContextAware.getBeanByType(LogServiceImpl.class).execInsertOperateLog(s_oper_log); + } + }); + } + + private S_oper_log acquireSystemLog(String userName, OperateUser operateUser, BusinessType businessType + , String title, String input, String output){ + if(operateUser == null){ + operateUser = OperateUser.Manage; + } + if(businessType == null){ + businessType = BusinessType.Other; + } + WebUserAgent agent = this.getCurrentWebUserAgent(); + S_oper_log s_oper_log = new S_oper_log(); + s_oper_log.setOper_id(NumberGenerator.getLongSequenceNumber()); + s_oper_log.setOper_time(DateUtils.getDateTimeNumber()); + s_oper_log.setStatus(ResponseCode.SUCCESS.getCode()); + s_oper_log.setOper_name(userName); + s_oper_log.setOperate_user(operateUser.getIndex()); + s_oper_log.setBusiness_type(businessType.getIndex()); + s_oper_log.setOper_ip(agent.getIp()); + s_oper_log.setOper_location(agent.getLocation()); + s_oper_log.setRequest_method(agent.getMethod()); + s_oper_log.setOper_url(agent.getUrl()); + s_oper_log.setTitle(title); + if(StringUtils.isNotEmpty(input)){ + s_oper_log.setOper_param(input); + } + if(StringUtils.isNotEmpty(output)){ + s_oper_log.setJson_result(output); + } + return s_oper_log; + } + + /** + * 杩斿洖鐧诲綍绛栫暐绠$悊鍣ㄥ璞� + * @return + * @date 2023-08-05 + */ + protected LoginStrategyManager getLoginStrategyManager(){ + return BeanContextAware.getBeanByType(LoginStrategyManager.class); + } + + /** + * 杩斿洖褰撳墠web娴忚鍣ㄤ唬鐞嗗璞°�� + * @return + * @date 2023-07-25 + */ + protected WebUserAgent getCurrentWebUserAgent(){ + HttpServletRequest request = this.getRequest(); + return this.getWebAgentService().getWebUserAgent(request.getHeader("User-Agent"), request); + } + + protected WebAgentService getWebAgentService(){ + return BeanContextAware.getBeanByType(WebAgentService.class); + } + + /** + * 鍒ゆ柇鐭俊楠岃瘉鐮佹槸鍚︽纭�� + * @param code 楠岃瘉鐮� + * @param uuid 璇锋眰楠岃瘉鐮佹爣璇� + * @return + * @date 2023-08-07 + */ + protected boolean validateSmsCode(String code, String uuid){ + CaptchaResult captchaResult = new CaptchaResult(); + captchaResult.setCode(code); + captchaResult.setUuid(uuid); + return this.smsCaptchaProvider.validateCaptcha(captchaResult); + } + + /** + * 鍙戦�佺煭淇¢獙璇佺爜銆� + * @param phoneNumber 鎵嬫満鍙� + * @return 杩斿洖鍓嶇闇�瑕佺殑uuid锛屾彁浜ょ櫥褰曚娇鐢� + * @throws PlatformRuntimeException + * @date 2023-06-28 + */ + protected Map<String, Object> sendSmsCodeValidation(String phoneNumber){ + if(!PhoneNumberUtils.isCellPhoneNumber(phoneNumber)){ + throw new PlatformRuntimeException("鎵嬫満鍙风爜鏍煎紡閿欒锛�" + phoneNumber); + } + String uuid = IdUtils.simpleUUID(); + Map<String, Object> data = new HashMap<>(4); + data.put("uuid", uuid); + String verifyKey = Constants.CAPTCHA_CODE_PREFIX + uuid; + CaptchaResult captchaResult = this.smsCaptchaProvider.generateCaptcha(phoneNumber); + if(captchaResult == null){ +// return ResponseValue.error("鐭俊楠岃瘉鐮佺敓鎴愰敊璇�, null"); + throw new PlatformRuntimeException("鐭俊楠岃瘉鐮佺敓鎴愰敊璇�, null"); + } + // 鍐欏叆楠岃瘉鐮� key 鍜� code 鍒扮紦瀛樹腑 + this.captchaCacheProvider.putCacheData(verifyKey, captchaResult.getCode(), 120); + if(this.logger.isDebugEnabled()){ + this.logger.debug("鐢熸垚鐭俊楠岃瘉鐮�:{}, uuid:{}", captchaResult.getCode(), uuid); + } + data.put("message", "鐭俊楠岃瘉鐮佸凡鍙戦��"); + return data; + } + + /** + * 杩斿洖鐢ㄦ埛褰掑睘鍊硷紝濡傛灉鏄钩鍙颁负'-1'锛屽鏋滀负绉熸埛锛堝晢鎴凤級鍒欎负瀹氫箟鐨勫晢鎴稩D銆� + * <pre> + * 娉ㄦ剰瑕佺偣锛� + * 1锛夊洜涓虹郴缁熸鏋朵腑鐢ㄦ埛鏄暱鏁村舰锛圠ong锛夛紝浣嗗晢鎴蜂腑鏄紙int锛夊洜姝ゅ湪瀹為檯娣诲姞鍟嗘埛鏁版嵁鏃讹紝闇�瑕佹寜鐓у簭鍒楁潵璁$畻锛岃繖鏍峰彧闇�瑕佹暣褰㈠嵆鍙�� + * </pre> + * @return + * @date 2023-06-05 + */ + protected long getOwner(){ + S_user_core user = this.getCurrentUser(); + int userType = user.getUser_type(); + if(userType == UserType.TYPE_SUPER){ + return Constants.OWNER_PLATFORM; + } + // 鍏朵粬浜洪渶瑕佹牴鎹満鏋勪腑"menu_type"瀛楁鍖哄垎鏄钩鍙版満鏋勶紝杩樻槸涓氬姟鐙珛鏈烘瀯 + S_dept dept = this.getDept(user.getOrg_id()); + if(dept.getMenu_type().intValue() == MenuUtils.MENU_SCOPE_PLATFORM){ + return Constants.OWNER_PLATFORM; + } + // 鏈烘瀯ID灏辨槸涓氬姟鍒涘缓鐨勭嫭绔嬬紪鍙凤紙濡傦細鍟嗘埛id锛夛紝杩欓噷鍟嗘埛鏄痠nt锛屼絾绯荤粺鏈烘瀯涓粛鐒朵娇鐢╞igint + return dept.getId(); + } + + /** + * 杩斿洖褰撳墠鐢ㄦ埛鎵�鍦ㄩ《绾у崟浣嶏紝浣跨敤鐨勮彍鍗曡寖鍥达細骞冲彴0锛屽晢鎴凤紙椤剁骇鐙珛鍗曚綅鑿滃崟鑼冨洿锛�4锛屽悗缁彲鑳戒細鏈夊叾浠栧�笺�� + * @return + * @date 2023-06-01 + */ + protected int getCurrentOrgMenuScope(){ + long orgId = this.getCurrentUser().getOrg_id(); + if(orgId == Constants.SUPERVISOR_ID){ + // 瓒呯骇绠$悊鍛橈紝杩斿洖骞冲彴鑿滃崟鑼冨洿 + return MenuUtils.MENU_SCOPE_PLATFORM; + } + return this.getDeptCacheProvider().getDept(orgId).getMenu_type(); + } + + /** + * 鏍规嵁瀛楀吀鏁版嵁code锛岃繑鍥炲瓧鍏搁」鍚嶇О銆� + * @param dictCode 瀛楀吀椤圭紪鐮侊紙涓婚敭锛� + * @return + * @date 2023-03-26 + */ + protected String getDictName(long dictCode){ + S_dict_data dict_data = this.getDictCacheProvider().getCacheData(String.valueOf(dictCode)); + if(dict_data == null){ + throw new IllegalStateException("缂撳瓨涓湭鎵惧埌瀛楀吀鍚嶇О锛宒ict_code = " + dictCode); + } + return dict_data.getDict_label(); + } + + /** + * 杩斿洖缁欏畾鏈烘瀯鐨勫悕瀛椼�� + * @param deptId 鏈烘瀯ID + * @return + * @date 2023-03-23 + */ + protected String getDeptName(long deptId){ + S_dept dept = this.getDept(deptId); + return dept == null ? "None":dept.getDept_name(); + } + + /** + * 杩斿洖缁欏畾id鐨勯儴闂ㄥ璞� + * @param deptId 閮ㄩ棬ID + * @return + * @author 鏃跺厠鑻� + * @date 2023-03-23 + */ + protected S_dept getDept(long deptId){ + return this.getDeptCacheProvider().getDept(deptId); + } + + /** + * 浠庣紦瀛樹腑杩斿洖缁欏畾鐨勭敤鎴� + * @param userId 鐢ㄦ埛id + * @return + * @date 2023-03-22 + */ + public S_user_core getUser(long userId){ + return this.getUserCacheProvider().getUser(userId); + } + + /** + * 涓嬭浇鏁版嵁瀵煎叆妯℃澘锛岃妯℃澘鐢辩郴缁熻嚜鍔ㄧ敓鎴愩��<br> + * 涓氬姟闇�瑕佹彁渚涙暟鎹簱瀵瑰簲鐨�'琛ㄥ悕绉�'锛屽锛歴_user_core + * @param tableName 琛ㄥ悕 + * @date 2023-03-18 + */ + protected void downloadLocalImportTemplate(String tableName){ + if(StringUtils.isEmpty(tableName)){ + throw new IllegalArgumentException("璇锋彁渚涜瀵煎叆鏁版嵁鐨�'琛ㄥ悕绉�'!"); + } + // 鏈湴鏂囦欢瀛樺偍鏍硅矾寰勶紝濡�: d:/temp/ + String templatePath = this.acquireFileOperateSpi().getFileRootConfig(); + // 鐢熸垚鐨勬ā鏉挎枃浠跺悕绉帮紝濡傦細demo.xlsx + String templateFileName = Constants.TEMPLATE_IMPORT_PREFIX + tableName + "_" + DateUtils.getDateTimeSecondForShow() + ".xlsx"; + TemplateInfo templateInfo = new TemplateInfo(); + // 2023-05-07 璁剧疆妯℃澘鐢熸垚鍏蜂綋璺緞銆� + templateInfo.setTemplatePath(templatePath + templateFileName); + templateInfo.setTableName(tableName); + + logger.debug("templateInfo = {}", templateInfo); + + File templateFile = this.getDataImportEngine().generateTemplate(templateInfo); + try { + this.downloadSimpleFile(FileCopyUtils.copyToByteArray(templateFile), templateFileName); + } catch (IOException e) { + logger.error("涓嬭浇妯℃澘閿欒:" + e.getMessage() + ", tableName=" + tableName, e); + ServletUtils.renderString(getResponse(), "涓嬭浇妯℃澘閿欒:" + e.getMessage() + ", tableName=" + tableName); + } + } + + /** + * 杩斿洖鏁版嵁瀛楀吀缂撳瓨瀵硅薄銆�<p></p> + * 娉ㄦ剰锛氳繖绉嶅啓娉曞悗缁鏀规帀锛岀粺涓�鐢卞钩鍙拌嚜鍔ㄦ敞鍏ワ紝鏃犻渶鍗曠嫭璁剧疆銆� + * @return + * @date 2023-03-10 + */ + protected DictCacheProvider getDictCacheProvider(){ +// if(this.dictCacheProvider == null){ +// this.dictCacheProvider = BeanContextAware.getBeanByType(DictCacheProvider.class); +// } + return this.dictCacheProvider; + } + + /** + * 杩斿洖鏁版嵁瀵煎叆寮曟搸瀹炵幇瀵硅薄锛岀敤鏉ュ畬鎴� Excel 瀵煎叆鍔熻兘銆� + * @return + * @date 2023-02-07 + */ + protected PlatformDataImportEngine getDataImportEngine(){ +// return BeanContextAware.getBeanByType(PlatformDataImportEngine.class); + return this.platformDataImportEngine; + } + + public UserCacheProvider getUserCacheProvider() { +// if(this.userCacheProvider == null){ +// this.userCacheProvider = BeanContextAware.getBeanByType(UserCacheProvider.class); +// } + return userCacheProvider; + } + + public DeptCacheProvider getDeptCacheProvider() { +// if(this.deptCacheProvider == null){ +// this.deptCacheProvider = BeanContextAware.getBeanByType(DeptCacheProvider.class); +// } + return deptCacheProvider; + } + + /** + * 杩斿洖缁欏畾鐢ㄦ埛鐨勯《绾ф満鏋処D銆� + * @param userId + * @return + * @date 2022-12-15 + */ + protected long getUserRootOrgId(long userId){ + this.checkUserCacheProvider(); + S_user_core user_core = this.userCacheProvider.getUser(userId); + if(user_core == null){ + throw new IllegalStateException("缂撳瓨涓湭鎵惧埌鐢ㄦ埛: " + userId); + } + return user_core.getOrg_id(); + } + + /** + * 鏍规嵁鏈烘瀯(閮ㄩ棬绛夐潪椤剁骇ID)杩斿洖椤剁骇鏈烘瀯ID銆� + * @param deptId + * @return + * @date 2022-12-12 + */ + protected long getRootOrgIdByDept(long deptId){ + if(this.deptCacheProvider == null){ + throw new IllegalArgumentException("璇峰厛璁剧疆controller瀵硅薄: deptCacheProvider"); + } + S_dept dept = this.deptCacheProvider.getDept(deptId); + if(dept == null){ + throw new IllegalStateException("缂撳瓨涓湭鎵惧埌鏈烘瀯: " + deptId); + } + return dept.getOrg_id(); + } + + /** + * 杩斿洖褰撳墠鐧诲綍鐢ㄦ埛鍙�夋嫨鐨勬牴鏈烘瀯鍒楄〃锛屽嵆:绗竴绾ф満鏋勶紝閫氬父鏄泦鍥㈠叕鍙哥瓑銆�<p></p> + * 杩欎簺涔熺О涓哄绉熸埛锛岀郴缁熸彁渚涘鍗曚綅(鐙珛)缁存姢锛屼笉鍚岀嫭绔嬪崟浣嶇敱鍚勮嚜绠$悊鍛樿嚜琛岀淮鎶ゃ�� + * <pre> + * 1.瓒呯骇绠$悊鍛樺彲浠ョ湅鍒版墍鏈夌嫭绔嬫満鏋勫垪琛� + * 2.鍗曚綅鐢ㄦ埛鍙兘鐪嬪埌鏈崟浣�(涓�涓満鏋�) + * </pre> + * @return + * @date 2022-12-01 + */ + protected List<S_dept> getOrgListScope(){ + DeptServiceImpl deptService = BeanContextAware.getBeanByType(DeptServiceImpl.class); + S_user_core currentUser = this.getCurrentUser(); + List<S_dept> list = null; + if(currentUser.getUser_type().intValue() == UserType.TYPE_SUPER){ + list = deptService.queryRootOrgList(0); + } else { + list = deptService.queryRootOrgList(currentUser.getOrg_id().longValue()); + } + if(StringUtils.isEmptyList(list)){ + // 涓嶅瓨鍦ㄤ换浣曟満鏋�(鏁版嵁搴撴病鏈夎褰�)锛岄渶瑕佸垱寤洪粯璁ゆ満鏋� + list = new ArrayList<>(2); + list.add(this.createDefaultOrg()); + } + return list; + } + + private void checkUserCacheProvider(){ + if(this.userCacheProvider == null){ + throw new IllegalStateException("UserCacheProvider 蹇呴』鍏堣缃埌鎺у埗鍣ㄤ腑銆�"); + } + } + + private S_dept createDefaultOrg(){ + S_dept root = new S_dept(); + root.setId(0L); + root.setParent_id(0L); + root.setOrg_type(OrgType.TYPE_ORG); + root.setOrder_num(1); + root.setDept_name(Constants.DEFAULT_ORG_NAME); + return root; + } + + public void setDeptCacheProvider(DeptCacheProvider deptCacheProvider) { + this.deptCacheProvider = deptCacheProvider; + } + + public void setUserCacheProvider(UserCacheProvider userCacheProvider) { + this.userCacheProvider = userCacheProvider; + } + + public void setPlatformDataImportEngine(PlatformDataImportEngine platformDataImportEngine) { + this.platformDataImportEngine = platformDataImportEngine; + } + + public void setDictCacheProvider(DictCacheProvider dictCacheProvider) { + this.dictCacheProvider = dictCacheProvider; + } + + public void setPushManager(PushManager pushManager) { + this.pushManager = pushManager; + } + + public void setSmsCaptchaProvider(CaptchaProvider<CaptchaResult> smsCaptchaProvider) { + this.smsCaptchaProvider = smsCaptchaProvider; + } + + public void setCaptchaCacheProvider(CacheProvider<String> captchaCacheProvider) { + this.captchaCacheProvider = captchaCacheProvider; + } + + public CaptchaProvider<CaptchaResult> getSmsCaptchaProvider() { + return smsCaptchaProvider; + } + + public CacheProvider<String> getCaptchaCacheProvider() { + return captchaCacheProvider; + } + + protected UserServiceImpl getUserService(){ + return BeanContextAware.getBeanByType(UserServiceImpl.class); + } + + private CaptchaProvider<CaptchaResult> smsCaptchaProvider; + private CacheProvider<String> captchaCacheProvider; + + /** + * 杩斿洖鎺ㄩ�佺鐞嗗櫒瀵硅薄锛屽彧鏈夊湪鐗规畩鎯呭喌涓嬮渶瑕佷笟鍔$洿鎺ヨ皟鐢ㄨ瀵硅薄銆� + * @return + * @date 2023-04-25 + */ + protected PushManager getPushManager() { + return pushManager; + } + + private PushManager pushManager; + private DeptCacheProvider deptCacheProvider; + private UserCacheProvider userCacheProvider; + private PlatformDataImportEngine platformDataImportEngine; + private DictCacheProvider dictCacheProvider; + + @Override + public void afterPropertiesSet() throws Exception {} +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/SystemGroupCache.java b/iplatform-base/src/main/java/com/iplatform/base/SystemGroupCache.java new file mode 100644 index 0000000..97e6495 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/SystemGroupCache.java @@ -0,0 +1,20 @@ +package com.iplatform.base; + +import com.iplatform.model.vo.SystemGroupVo; + +/** + * 绯荤粺鍒嗙粍鏁版嵁缂撳瓨瀹氫箟锛岀洰鍓嶄富瑕佺數鍟嗘ā鍧椾娇鐢ㄣ�� + * <p>鍚庣画鍏朵粬妯″潡閮藉彲浠ヤ綔涓烘爣鍑嗗寲鍔熻兘浣跨敤銆�</p> + * @author 鏃跺厠鑻� + * @date 2023-06-23 + */ +public interface SystemGroupCache { + + SystemGroupVo get(int id); + + void save(SystemGroupVo category); + + void update(SystemGroupVo category); + + void remove(int id); +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/ThirdPartyAuthentication.java b/iplatform-base/src/main/java/com/iplatform/base/ThirdPartyAuthentication.java new file mode 100644 index 0000000..36fbe4c --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/ThirdPartyAuthentication.java @@ -0,0 +1,38 @@ +package com.iplatform.base; + +import com.iplatform.base.exception.LoginException; +import com.iplatform.base.pojo.RequestLogin; + +import java.util.Map; + +/** + * 绗笁鏂圭櫥褰曪紙闆嗘垚锛夎璇併�� + * <pre> + * 1)璇ユ帴鍙d富瑕佺敤浜庣涓夋柟绯荤粺鐩存帴鐧诲綍骞冲彴鏂瑰紡銆� + * 2)绗笁鏂逛紶閫掔粰骞冲彴鐩稿叧鍙傛暟锛岀劧鍚庡钩鍙扮洿鎺ョ櫥褰曞苟鐢熸垚token缁欏墠绔�� + * </pre> + * @date 2023-07-03 + */ +public interface ThirdPartyAuthentication { + + /** + * 璋冪敤绗笁鏂硅璇佹帴鍙o紝渚濇嵁鍙傛暟鑾峰緱鐢ㄦ埛璇︾粏淇℃伅锛堜互渚夸簬杞崲鎴愬钩鍙扮敤鎴疯韩浠斤級 + * @param parameter 绗笁鏂规彁渚涚殑鍙傛暟 + * @return 杩斿洖骞冲彴鐧诲綍鍙傛暟锛岃姹傜粺涓�鐧诲綍鍦板潃瀹屾垚锛堟棤鎰燂級鐧诲綍 + * @throws LoginException 濡傛灉閿欒鎶涘嚭寮傚父 + * @date 2023-07-03 + */ + RequestLogin authenticate(Map<String, Object> parameter) throws LoginException; + + /** + * 杩斿洖璁よ瘉鐨勫敮涓�鏍囪瘑锛堟垨鍚嶇О锛� + * @return + */ + String getName(); + + /** + * 杩斿洖璁よ瘉瀵硅薄鐨勬弿杩般�� + * @return + */ + String getDescription(); +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/ThirdPartyManager.java b/iplatform-base/src/main/java/com/iplatform/base/ThirdPartyManager.java new file mode 100644 index 0000000..f4ff31d --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/ThirdPartyManager.java @@ -0,0 +1,57 @@ +package com.iplatform.base; + +import com.walker.infrastructure.utils.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * 绗笁鏂圭鐞嗗櫒榛樿瀹炵幇銆� + * @author 鏃跺厠鑻� + * @date 2023-07-03 + */ +public class ThirdPartyManager { + + protected final transient Logger logger = LoggerFactory.getLogger(this.getClass()); + + private final Map<String, ThirdPartyAuthentication> authenticationMap = new ConcurrentHashMap<>(8); + + /** + * 娉ㄥ唽涓�涓涓夋柟璁よ瘉瀵硅薄鍒板钩鍙般�� + * <pre> + * 1)鍏朵腑锛宯ame灞炴�ч�氬父鏄涓夋柟璇锋眰鐧诲綍璺緞涓殑鍚庣紑閮ㄥ垎锛屽锛�/third_party/login/aaa + * 2)骞冲彴鏀寔澶氱绗笁鏂硅璇佸悓鏃朵娇鐢紝鍙鍦ㄤ笟鍔′腑娉ㄥ唽鍗冲彲銆� + * </pre> + * @param thirdPartyAuthentication + * @date 2023-07-03 + */ + public void register(ThirdPartyAuthentication thirdPartyAuthentication){ + if(thirdPartyAuthentication == null){ + throw new IllegalArgumentException("娉ㄥ唽绗笁鏂硅璇佸璞′负绌�"); + } + String key = thirdPartyAuthentication.getName(); + if(StringUtils.isEmpty(key)){ + throw new IllegalArgumentException("鑷畾涔夌涓夋柟璁よ瘉瀵硅薄鍚嶇О涓嶅瓨鍦細getName()"); + } + if(this.authenticationMap.get(key) != null){ + throw new IllegalArgumentException("宸茬粡瀛樺湪绗笁鏂硅璇佸畾涔�:" + key); + } + this.authenticationMap.put(key, thirdPartyAuthentication); + logger.info("娉ㄥ唽'绗笁鏂硅璇佸璞�' = " + key + ", " + thirdPartyAuthentication.getDescription()); + } + + /** + * 杩斿洖涓�涓涓夋柟璁よ瘉瀵硅薄 + * @param key 璁よ瘉瀵硅薄鐨勫悕绉帮紝鍙傝�冿細{@linkplain ThirdPartyAuthentication#getName()} + * @return + * @date 2023-07-03 + */ + public ThirdPartyAuthentication getThirdPartyAuthentication(String key){ + if(StringUtils.isEmpty(key)){ + throw new IllegalArgumentException("璇锋彁渚涚涓夋柟璁よ瘉鏍囪瘑"); + } + return this.authenticationMap.get(key); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/UserCacheProvider.java b/iplatform-base/src/main/java/com/iplatform/base/UserCacheProvider.java new file mode 100644 index 0000000..75d2a51 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/UserCacheProvider.java @@ -0,0 +1,27 @@ +package com.iplatform.base; + +import com.iplatform.model.po.S_user_core; + +/** + * 鐢ㄦ埛缂撳瓨缁熶竴鎶借薄锛岄拡瀵� Redis 鎴� 鍐呭瓨鍋氫笉鍚屽疄鐜般�� + * @author 鏃跺厠鑻� + * @date 2022-12-13 + */ +public interface UserCacheProvider { + + /** + * 鏍规嵁鐧诲綍id鏌ユ壘缂撳瓨鐢ㄦ埛锛屽鏋滀笉瀛樺湪闇�瑕佸厛鍒濆鍖栧姞杞芥暟鎹簱銆� + * @param loginId + * @return + * @date 2024-03-06 + */ + S_user_core getUserByLoginId(String loginId); + + S_user_core getUser(long userId); + + void updateUser(S_user_core user_core); + + void removeUser(long userId); + + void putUser(S_user_core user_core); +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/UserLoginCache.java b/iplatform-base/src/main/java/com/iplatform/base/UserLoginCache.java new file mode 100644 index 0000000..ba02003 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/UserLoginCache.java @@ -0,0 +1,20 @@ +package com.iplatform.base; + +import com.iplatform.model.po.S_user_login; + +/** + * 鐢ㄦ埛鐧诲綍璁板綍缂撳瓨瀹氫箟銆� + * <p>姣忎釜鐧诲綍ID鍙細瀛樺湪涓�鏉¤褰曘��</p> + * @author 鏃跺厠鑻� + * @date 2023-07-11 + */ +public interface UserLoginCache { + + S_user_login getUserLogin(String loginId); + + void updateUserLogin(S_user_login user_login); + + void removeUserLogin(String loginId); + + void putUserLogin(S_user_login user_login); +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/VariableConstants.java b/iplatform-base/src/main/java/com/iplatform/base/VariableConstants.java new file mode 100644 index 0000000..f635e0f --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/VariableConstants.java @@ -0,0 +1,37 @@ +package com.iplatform.base; + +/** + * 绯荤粺鍙厤缃殑鍙傛暟鍙橀噺涓存椂瀹氫箟锛岀瓑閰嶇疆鍙傛暟鍔熻兘濂戒簡闇�瑕佹浛鎹负鍔ㄦ�佸弬鏁�: ArgumentsManager. + * @date 2022-11-02 + */ +@Deprecated +public class VariableConstants { + + /** + * token绛惧悕瀵嗛挜 + */ + public static final String TOKEN_SECRET = "Ha2rEvsXPWovJH2y760OZUlzUOAx1dSnqYB9x1NWHwkGk0SqLn9divY8Rho+/tFkCKXSkUDFtwVmw9TuMbchyzJmlOAoXyDLd27lAo+Byhlysm71/mCOoLfAQIDAQAB"; + +// /** +// * 鏄惁鎵撳紑楠岃瘉鐮侀�夐」 +// */ +// public static final boolean CAPTCHA_ENABLED = true; + + /** + * 鍒涘缓token榛樿杩囨湡鏃堕棿(鍒嗛挓)<br> + * @date 2023-12-29 淇敼淇濆簳鏃堕棿锛屽敖閲忓ぇ涓�浜涳紝閬垮厤涓氬姟閰嶇疆浜�10澶╋紝浣嗙紦瀛樺嵈澶煭鏁版嵁宸茬粡涓嶅瓨鍦ㄤ簡锛� + */ + public static final long DEFAULT_TOKEN_EXPIRED_MINUTES = 60 * 24 * 30; + +// /** +// * 缂撳瓨鐢ㄦ埛鐧诲綍鏃堕棿(绉�) +// */ +// public static final long DEFAULT_CACHE_USER_SECONDS = 3600; + + /** + * 缂撳瓨绠$悊涓紝榛樿鑳芥樉绀虹殑缂撳瓨鏄庣粏璁板綍鏁伴噺锛屽洜涓哄湪redis鏂瑰紡涓嬶紝缂撳瓨鏁伴噺鍙兘澶ぇ鑰屾棤娉曞睍绀恒�� + * @date 2023-01-05 + */ + public static final long MAX_CACHE_SHOW = 256; + +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/WechatBaseController.java b/iplatform-base/src/main/java/com/iplatform/base/WechatBaseController.java new file mode 100644 index 0000000..f12858d --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/WechatBaseController.java @@ -0,0 +1,217 @@ +package com.iplatform.base; + +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.iplatform.base.util.NotificationUtils; +import com.iplatform.base.util.RestTemplateUtils; +import com.iplatform.core.BeanContextAware; +import com.iplatform.model.vo.NotificationTemplateVo; +import com.iplatform.model.vo.WeChatAccessTokenVo; +import com.walker.infrastructure.arguments.Variable; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.push.Notification; +import org.springframework.web.client.RestTemplate; + +import java.text.MessageFormat; +import java.util.List; + +public abstract class WechatBaseController extends PlatformAdapterController{ + +// public void setRestTemplate(RestTemplate restTemplate) { +// this.restTemplate = restTemplate; +// } +// private RestTemplate restTemplate; + + /** + * 骞冲彴缁熶竴鏍规嵁妯℃澘锛屽彂閫佹彁閱掗�氱煡銆� + * @param mark 閫氱煡鏍囪瘑锛屽锛氬彂璐с�佽鍗曠瓑锛屼粠锛歴f_notification 琛ㄦ煡璇� + * @param variableList 涓氬姟鏁版嵁锛宬ey锛寁alue + * @param userId 鐢ㄦ埛ID + * @date 2023-08-25 + */ + protected void pushNotificationWithTemplate(String mark, List<Variable> variableList, long userId){ + if(StringUtils.isEmpty(mark)){ + throw new IllegalArgumentException("蹇呴』杈撳叆閫氱煡妯℃澘鏍囪锛歮ark"); + } + if(StringUtils.isEmptyList(variableList)){ + throw new IllegalArgumentException("蹇呴』杈撳叆鎺ㄩ�佹秷鎭笟鍔℃暟鎹細variableList"); + } + NotificationTemplateVo templateVo = this.getNotificationTemplateCache().get(mark); + if(templateVo == null){ + logger.error("閫氱煡妯℃澘缂撳瓨涓嶅瓨鍦紝mark={}", mark); + return; + } + + // 1:瀛樺湪寰俊鍏紬鍙锋帹閫佹柟寮� + if(templateVo.getWechat()){ + String openId = this.getUser(userId).getWx_open_id(); + if(StringUtils.isEmpty(openId)){ + logger.error("鐢ㄦ埛openId涓虹┖锛屾棤娉曞彂閫佸井淇″叕浼楀彿閫氱煡, userId={}", userId); + return; + } + String accessToken = this.acquirePublicAccessToken(); + if(StringUtils.isEmpty(accessToken)){ + logger.error("鎺ㄩ�佸叕浼楀彿娑堟伅澶辫触锛宎ccessToken鑾峰彇涓虹┖锛宮ark={}, userId={}", mark, userId); + return; + } + + Notification notification = NotificationUtils.acquireWechatNotification(accessToken + , templateVo.getWechatTempId(), openId, variableList); + this.getPushManager().push(notification, null); + } + + // 2:瀛樺湪鐭俊鎺ㄩ�� + if(templateVo.getSms()){ + String userPhone = this.getUser(userId).getPhonenumber(); + if(StringUtils.isEmpty(userPhone)){ + logger.error("鐢ㄦ埛鎵嬫満鍙蜂负绌猴紝鏃犳硶鍙戦�佺煭淇¢�氱煡, userId={}", userId); + return; + } + Notification smsNotification = NotificationUtils.acquireSmsNotification(templateVo.getSmsTempId(), userPhone, variableList, "鐭俊閫氱煡"); + this.getPushManager().push(smsNotification, null); + } + + // 3:瀛樺湪寰俊灏忕▼搴忔帹閫佹柟寮� + if(templateVo.getRoutine()){ + throw new UnsupportedOperationException("鏈疄鐜板井淇″皬绋嬪簭娑堟伅閫氱煡"); + } + } + + /** + * 鑾峰彇寰俊灏忕▼搴忥紙access_token锛夛紝骞惰缃紦瀛樸�� + * @return + * @date 2023-09-16 + */ + protected String acquireMiniAccessToken(){ + String appId = this.getArgumentVariable(WechatConstants.WECHAT_MINI_APPID).getStringValue(); + if(StringUtils.isEmpty(appId)){ + throw new PlatformRuntimeException("璇峰厛閰嶇疆寰俊鍙傛暟:灏忕▼搴廰ppid"); + } + String miniAccessToken = this.getWechatCache().getMiniAccessToken(); + if(StringUtils.isNotEmpty(miniAccessToken)){ + logger.debug("缂撳瓨涓凡鏈�'access_token'锛歿}", miniAccessToken); + return miniAccessToken; + } + + String secret = this.getArgumentVariable(WechatConstants.WECHAT_MINI_APPSECRET).getStringValue(); + if (StringUtils.isEmpty(secret)) { + throw new PlatformRuntimeException("寰俊灏忕▼搴弒ecret鏈缃�"); + } +// String url = MessageFormat.format(WechatConstants.WECHAT_ACCESS_TOKEN_URL, appId, secret); +// logger.debug("url = {}", url); +// ObjectNode objectNode = RestTemplateUtils.getData(url, BeanContextAware.getBeanByType(RestTemplate.class)); +// if(objectNode == null){ +// throw new PlatformRuntimeException("寰俊骞冲彴鎺ュ彛寮傚父锛屾病浠讳綍鏁版嵁杩斿洖锛�"); +// } +// logger.debug(objectNode.toString()); + ObjectNode objectNode = this.acquireAccessTokenNode(appId, secret); + WeChatAccessTokenVo accessTokenVo = null; + + try { +// if (objectNode.has("errcode") && !objectNode.get("errcode").asText().equals("0")) { +// if (objectNode.has("errmsg")) { +// // 淇濆瓨鍒板井淇″紓甯歌〃 +//// wxExceptionDispose(data, StrUtil.format("寰俊鑾峰彇accessToken寮傚父锛寋}绔�", type)); +// throw new PlatformRuntimeException("寰俊鎺ュ彛璋冪敤澶辫触锛�" + objectNode.get("errcode") + objectNode.get("errmsg")); +// } +// } + this.checkStatusError(objectNode); + accessTokenVo = new WeChatAccessTokenVo(); + accessTokenVo.setAccessToken(objectNode.get("access_token").asText()); + accessTokenVo.setExpiresIn(objectNode.get("expires_in").asInt()); +// accessTokenVo = JsonUtils.jsonStringToObject(result, WeChatAccessTokenVo.class); + this.getWechatCache().putMiniAccessToken(accessTokenVo.getAccessToken(), accessTokenVo.getExpiresIn().longValue() - 1800L); + logger.info("璋冪敤涓�娆″井淇¤繙绋嬫帴鍙h幏鍙�'mini_accessToken'锛屽苟缂撳瓨锛歿}", accessTokenVo.getAccessToken()); + return accessTokenVo.getAccessToken(); + + } catch (Exception e) { + throw new RuntimeException("json瀛楃涓茶浆瀵硅薄閿欒锛�" + objectNode, e); + } + } + + /** + * 鑾峰彇寰俊鍏紬鍙凤紙鏅�氾級access_token + * @return + * @date 2023-08-23 + */ + protected String acquirePublicAccessToken( +// String appId, String type + ){ + String appId = this.getArgumentVariable(WechatConstants.WECHAT_PUBLIC_APPID).getStringValue(); + if(StringUtils.isEmpty(appId)){ + throw new PlatformRuntimeException("璇峰厛閰嶇疆寰俊鍙傛暟:鍏紬鍙穉ppid"); + } + String publicAccessToken = this.getWechatCache().getPublicAccessToken(); + if(StringUtils.isNotEmpty(publicAccessToken)){ + logger.debug("缂撳瓨涓凡鏈�'access_token'锛歿}", publicAccessToken); + return publicAccessToken; + } + String secret = this.getArgumentVariable(WechatConstants.WECHAT_PUBLIC_APPSECRET).getStringValue(); + if (StringUtils.isEmpty(secret)) { + throw new PlatformRuntimeException("寰俊鍏紬鍙穝ecret鏈缃�"); + } + +// String url = MessageFormat.format(WechatConstants.WECHAT_ACCESS_TOKEN_URL, appId, secret); +// logger.debug("url = {}", url); +// ObjectNode objectNode = RestTemplateUtils.getData(url, BeanContextAware.getBeanByType(RestTemplate.class)); +// if(objectNode == null){ +// throw new PlatformRuntimeException("寰俊骞冲彴鎺ュ彛寮傚父锛屾病浠讳綍鏁版嵁杩斿洖锛�"); +// } +// logger.debug(objectNode.toString()); + ObjectNode objectNode = this.acquireAccessTokenNode(appId, secret); + WeChatAccessTokenVo accessTokenVo = null; + try { +// if (objectNode.has("errcode") && !objectNode.get("errcode").asText().equals("0")) { +// if (objectNode.has("errmsg")) { +// // 淇濆瓨鍒板井淇″紓甯歌〃 +//// wxExceptionDispose(data, StrUtil.format("寰俊鑾峰彇accessToken寮傚父锛寋}绔�", type)); +// throw new PlatformRuntimeException("寰俊鎺ュ彛璋冪敤澶辫触锛�" + objectNode.get("errcode") + objectNode.get("errmsg")); +// } +// } + this.checkStatusError(objectNode); + accessTokenVo = new WeChatAccessTokenVo(); + accessTokenVo.setAccessToken(objectNode.get("access_token").asText()); + accessTokenVo.setExpiresIn(objectNode.get("expires_in").asInt()); +// accessTokenVo = JsonUtils.jsonStringToObject(result, WeChatAccessTokenVo.class); + this.getWechatCache().putPublicAccessToken(accessTokenVo.getAccessToken(), accessTokenVo.getExpiresIn().longValue() - 1800L); + logger.info("璋冪敤涓�娆″井淇¤繙绋嬫帴鍙h幏鍙�'public_accessToken'锛屽苟缂撳瓨锛歿}", accessTokenVo.getAccessToken()); + return accessTokenVo.getAccessToken(); + + } catch (Exception e) { + throw new RuntimeException("json瀛楃涓茶浆瀵硅薄閿欒锛�" + objectNode, e); + } + } + + private ObjectNode acquireAccessTokenNode(String appId, String secret){ + String url = MessageFormat.format(WechatConstants.WECHAT_ACCESS_TOKEN_URL, appId, secret); + logger.debug("url = {}", url); + ObjectNode objectNode = RestTemplateUtils.getData(url, BeanContextAware.getBeanByType(RestTemplate.class)); + if(objectNode == null){ + throw new PlatformRuntimeException("寰俊骞冲彴鎺ュ彛寮傚父锛屾病浠讳綍鏁版嵁杩斿洖锛�"); + } + logger.debug(objectNode.toString()); + return objectNode; + } + + private void checkStatusError(ObjectNode objectNode){ + // ObjectNode objectNode = JsonUtils.jsonStringToObjectNode(result); + if (objectNode.has("errcode") && !objectNode.get("errcode").asText().equals("0")) { + if (objectNode.has("errmsg")) { + // 淇濆瓨鍒板井淇″紓甯歌〃 +// wxExceptionDispose(data, StrUtil.format("寰俊鑾峰彇accessToken寮傚父锛寋}绔�", type)); + throw new PlatformRuntimeException("寰俊鎺ュ彛璋冪敤澶辫触锛�" + objectNode.get("errcode") + objectNode.get("errmsg")); + } else { + throw new PlatformRuntimeException("寰俊鎺ュ彛璋冪敤澶辫触锛�" + objectNode.get("errcode")); + } + } + } + + /** + * 杩斿洖寰俊鍩虹閰嶇疆缂撳瓨瀵硅薄銆� + * @return + * @date 2023-08-23 + */ + protected WechatCacheProvider getWechatCache(){ + return BeanContextAware.getBeanByType(WechatCacheProvider.class); + } + +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/WechatCacheProvider.java b/iplatform-base/src/main/java/com/iplatform/base/WechatCacheProvider.java new file mode 100644 index 0000000..28db9f8 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/WechatCacheProvider.java @@ -0,0 +1,56 @@ +package com.iplatform.base; + +/** + * 寰俊鐧诲綍鐩稿叧閰嶇疆缂撳瓨锛岀洰鍓嶏細ticket銆佹櫘閫� access_token + * @author 鏃跺厠鑻� + * @date 2023-08-23 浠庣數鍟嗘ā鍧楄縼绉诲埌 base + */ +public interface WechatCacheProvider { + + /** + * 鑾峰彇灏忕▼搴廰ccess_token锛岀敓鎴愬皬绋嬪簭浜岀淮鐮佷娇鐢ㄣ�� + * @return + * @date 2023-09-16 + */ + String getMiniAccessToken(); + + /** + * 杩斿洖锛欽S-SDK鐨則icket锛� + * @return + */ + String getJsApiTicket(); + + /** + * 鑾峰彇鍏叡锛堝叕浼楀彿锛塧ccessToken + * @return + * @date 2023-07-16 + */ + String getPublicAccessToken(); + + /** + * 璁剧疆鍏叡锛堝叕浼楀彿锛塧ccessToken锛�<p>缂撳瓨鏃堕棿锛歛ccessTokenVo.getExpiresIn().longValue() - 1800L</p> + * @param value + * @date 2023-07-16 + */ + void putPublicAccessToken(String value, long expiredSeconds); + + /** + * 缂撳瓨ticket锛岄粯璁わ細7100 绉掑悗杩囨湡銆� + * @param value + */ + void putJsApiTicket(String value); + + /** + * 璁剧疆锛堝皬绋嬪簭锛塧ccessToken锛�<p>缂撳瓨鏃堕棿锛歛ccessTokenVo.getExpiresIn().longValue() - 1800L</p> + * @param value + * @param expiredSeconds + * @date 2023-09-16 + */ + void putMiniAccessToken(String value, long expiredSeconds); + + /** + * 鍒犻櫎锛堝皬绋嬪簭锛塧ccessToken. + * @date 2023-09-16 + */ + void removeMiniAccessToken(); +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/WechatConstants.java b/iplatform-base/src/main/java/com/iplatform/base/WechatConstants.java new file mode 100644 index 0000000..87c91a0 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/WechatConstants.java @@ -0,0 +1,490 @@ +package com.iplatform.base; + +public class WechatConstants { + + /** 寰俊token绫诲瀷-鍏紬鍙� */ + public static final String WECHAT_TOKEN_TYPE_PUBLIC = "public"; + /** 寰俊token绫诲瀷-灏忕▼搴� */ + public static final String WECHAT_TOKEN_TYPE_MINI = "mini"; + /** 寰俊token绫诲瀷-APP */ + public static final String WECHAT_TOKEN_TYPE_APP = "app"; + + //-------------------------------------------寰俊绯荤粺閰嶇疆------------------------------------------------------------ + /** 鍏紬鍙穉ppId key */ + public static final String WECHAT_PUBLIC_APPID = "wechat_appid"; + /** 鍏紬鍙穉ppSecret key */ + public static final String WECHAT_PUBLIC_APPSECRET = "wechat_appsecret"; + /** 灏忕▼搴廰ppId key */ + public static final String WECHAT_MINI_APPID = "routine_appid"; + /** 灏忕▼搴廰ppSecret key */ + public static final String WECHAT_MINI_APPSECRET = "routine_appsecret"; + /** 灏忕▼搴� 鍚嶇О */ + public static final String WECHAT_MINI_NAME = "routine_name"; + + /** 鍏紬鍙� 鏀粯鍟嗘埛鍙� */ + public static final String WECHAT_PAY_PUBLIC_MCHID = "pay_weixin_mchid"; + /** 鍏紬鍙� 鏀粯key */ + public static final String WECHAT_PAY_PUBLIC_KEY = "pay_weixin_key"; + /** 鍏紬鍙� 鏀粯璇佷功鍦板潃 */ + public static final String WECHAT_PAY_PUBLIC_CERTIFICATE_PATH = "pay_weixin_certificate_path"; + /** 灏忕▼搴� 鏀粯鍟嗘埛鍙� */ + public static final String WECHAT_PAY_MINI_MCHID = "pay_routine_mchid"; + /** 灏忕▼搴� 鏀粯key */ + public static final String WECHAT_PAY_MINI_KEY = "pay_routine_key"; + /** 灏忕▼搴� 鏀粯璇佷功鍦板潃 */ + public static final String WECHAT_PAY_MINI_CERTIFICATE_PATH = "pay_routine_certificate_path"; + + /** 寰俊app appId */ + public static final String WECHAT_APP_APPID = "wechat_app_appid"; + /** 寰俊app 鍟嗘埛鍙� */ + public static final String WECHAT_PAY_APP_MCHID = "pay_weixin_app_mchid"; + /** 寰俊app 鏀粯key */ + public static final String WECHAT_PAY_APP_KEY = "pay_weixin_app_key"; + /** 寰俊app 鏀粯璇佷功鍦板潃 */ + public static final String WECHAT_PAY_APP_CERTIFICATE_PATH = "pay_weixin_app_certificate_path"; + + //------------------------------------------------寰俊鍏紬鍙�------------------------------------------------ + //寰俊鎺ュ彛璇锋眰鍦板潃 + public static final String API_URL = "https://api.weixin.qq.com/"; + //鑾峰彇token + public static final String API_TOKEN_URI = "cgi-bin/token?grant_type=client_credential"; + // 寰俊token 杩囨湡鏃堕棿锛屽ǘ浜嗕竴涓腑闂村�� 4000 瀹樻柟鐨�7200涓嶉潬璋� + public static final Long API_TOKEN_EXPIRES = 3000L; + //寰俊鍏紬鍙疯彍鍗曞垱寤� + public static final String PUBLIC_API_MENU_CREATE_URI = "cgi-bin/menu/create"; + //寰俊鍏紬鍙疯彍鍗曡幏鍙� + public static final String PUBLIC_API_MENU_GET_URI = "cgi-bin/menu/get"; + //寰俊鍏紬鍙疯彍鍗曞垹闄� + public static final String PUBLIC_API_MENU_DELETE_URI = "cgi-bin/menu/delete"; + //寰俊鍏紬鍙凤紝鑾峰彇鑷畾涔夎彍鍗曢厤缃帴鍙� + public static final String PUBLIC_API_MENU_SELF_SET_URI = "cgi-bin/get_current_selfmenu_info"; + //寰俊鍏紬鍙凤紝鍒涘缓涓�у寲鑿滃崟 + public static final String PUBLIC_API_MENU_ADD_CONDITIONAL_URI = "cgi-bin/menu/addconditional"; + //寰俊鍏紬鍙凤紝鍒犻櫎涓�у寲鑿滃崟 + public static final String PUBLIC_API_MENU_DEL_CONDITIONAL_URI = "cgi-bin/menu/delconditional"; + //寰俊鍏紬鍙凤紝娴嬭瘯涓�у寲鑿滃崟鍖归厤缁撴灉 + public static final String PUBLIC_API_USER_INFO_URI = "cgi-bin/menu/trymatch"; + //鑾峰彇鍏紬鍙峰凡鍒涘缓鐨勬爣绛� + public static final String PUBLIC_API_TAG_LIST_URI = "cgi-bin/tags/get"; + //鍒涘缓鏍囩 + public static final String PUBLIC_API_TAG_CREATE_URI = "cgi-bin/tags/create"; + //缂栬緫鏍囩 + public static final String PUBLIC_API_TAG_UPDATE_URI = "cgi-bin/tags/update"; + //鍒犻櫎鏍囩 + public static final String PUBLIC_API_TAG_DELETE_URI = "cgi-bin/tags/delete"; + //鑾峰彇鏍囩涓嬬矇涓濆垪琛� + public static final String PUBLIC_API_TAG_USER_GET_URI = "cgi-bin/user/tag/get"; + //鎵归噺涓虹敤鎴锋墦鏍囩 + public static final String PUBLIC_API_TAG_MEMBER_BATCH_URI = "cgi-bin/tags/members/batchtagging"; + //鎵归噺涓虹敤鎴峰彇娑堟爣绛� + public static final String PUBLIC_API_TAG_MEMBER_BATCH_UN_URI = "cgi-bin/tags/members/batchuntagging"; + //鑾峰彇鐢ㄦ埛韬笂鐨勬爣绛惧垪琛� + public static final String PUBLIC_API_TAG_GET_ID_LIST_URI = "cgi-bin/tags/getidlist"; + //鑾峰彇 JsApiTicket + public static final String PUBLIC_API_JS_API_TICKET = "cgi-bin/ticket/getticket"; + //鍙戦�佸叕浼楀彿妯℃澘娑堟伅 + public static final String PUBLIC_API_PUBLIC_TEMPLATE_MESSAGE_SEND = "cgi-bin/message/template/send"; + //鑾峰彇璁剧疆鐨勮涓氫俊鎭� + public static final String PUBLIC_API_TEMPLATE_MESSAGE_INDUSTRY = "cgi-bin/template/get_industry"; + //鏂板鍏朵粬绫诲瀷姘镐箙绱犳潗 + public static final String PUBLIC_API_MEDIA_UPLOAD = "cgi-bin/material/add_material"; + //鑾峰彇姘镐箙绱犳潗 + public static final String PUBLIC_API_MEDIA_GET = "cgi-bin/material/get_material"; + //鑾峰彇寰俊绱犳潗鎬绘暟 + public static final String PUBLIC_API_MEDIA_COUNT = "cgi-bin/material/get_materialcount"; + //鍙戦�佸鏈嶆秷鎭� + public static final String PUBLIC_API_KF_MESSAGE_SEND = "cgi-bin/message/custom/send"; + + + //------------------------------------------------寰俊灏忕▼搴�------------------------------------------------ + //灏忕▼搴忚涓氭秷鎭� + public static final String PUBLIC_API_PROGRAM_CATEGORY = "wxaapi/newtmpl/getcategory"; + //灏忕▼搴忓叕鍏辨ā鏉垮簱 + public static final String PUBLIC_API_PROGRAM_PUBLIC_TEMP = "wxaapi/newtmpl/getpubtemplatetitles"; + //灏忕▼搴忔ā鏉垮叧閿瘝鍒楄〃 + public static final String PUBLIC_API_PROGRAM_PUBLIC_TEMP_KEYWORDS = "wxaapi/newtmpl/getpubtemplatekeywords"; + //娣诲姞灏忕▼搴忚闃呮秷鎭� + public static final String PUBLIC_API_ADD_PROGRAM_TEMPLATE = "wxaapi/newtmpl/addtemplate"; + //鍒犻櫎灏忕▼搴忚闃呮秷鎭� + public static final String PUBLIC_API_DELETE_PROGRAM_TEMPLATE = "wxaapi/newtmpl/deltemplate"; + //鍙戦�佸皬绋嬪簭妯℃澘娑堟伅 + public static final String PUBLIC_API_PROGRAM_TEMPLATE_MESSAGE_SEND = "cgi-bin/message/subscribe/send"; + + //鎺堟潈鐧诲綍 + + //鑾峰彇涓存椂code璺宠浆鍦板潃 + public static final String WE_CHAT_AUTHORIZE_REDIRECT_URI_URL = "/api/front/wechat/authorize/login"; + + //鑾峰彇openId + public static final String WE_CHAT_AUTHORIZE_GET_OPEN_ID = "sns/oauth2/access_token"; + + //鑾峰彇灏忕▼搴弌penId + public static final String WE_CHAT_AUTHORIZE_PROGRAM_GET_OPEN_ID = "sns/jscode2session"; + + //鑾峰彇鐢ㄦ埛淇℃伅 + public static final String WE_CHAT_AUTHORIZE_GET_USER_INFO = "sns/userinfo"; + + //鐢熸垚浜岀淮鐮� + public static final String WE_CHAT_CREATE_QRCODE = "wxa/getwxacodeunlimit"; + + //寰俊娑堟伅瀛樺偍闃熷垪 + public static final String WE_CHAT_MESSAGE_SEND_KEY = "we_chat_message_send_list"; + + //澶у娉ㄦ剰杩欓噷娑堟伅绫诲瀷鐨勫畾涔夛紝浠� RESP 寮�澶寸殑琛ㄧず杩斿洖鐨勬秷鎭被鍨嬶紝浠� REQ 琛ㄧず寰俊鏈嶅姟鍣ㄥ彂鏉ョ殑娑堟伅绫诲瀷 + /** + * 杩斿洖娑堟伅绫诲瀷锛氭枃鏈� + */ + public static final String WE_CHAT_MESSAGE_RESP_MESSAGE_TYPE_TEXT = "text"; + /** + * 杩斿洖娑堟伅绫诲瀷锛氶煶涔� + */ + public static final String WE_CHAT_MESSAGE_RESP_MESSAGE_TYPE_MUSIC = "music"; + /** + * 杩斿洖娑堟伅绫诲瀷锛氬浘鏂� + */ + public static final String WE_CHAT_MESSAGE_RESP_MESSAGE_TYPE_NEWS = "news"; + /** + * 杩斿洖娑堟伅绫诲瀷锛氬浘鐗� + */ + public static final String WE_CHAT_MESSAGE_RESP_MESSAGE_TYPE_IMAGE = "image"; + /** + * 杩斿洖娑堟伅绫诲瀷锛氳闊� + */ + public static final String WE_CHAT_MESSAGE_RESP_MESSAGE_TYPE_VOICE = "voice"; + /** + * 杩斿洖娑堟伅绫诲瀷锛氳棰� + */ + public static final String WE_CHAT_MESSAGE_RESP_MESSAGE_TYPE_VIDEO = "video"; + /** + * 璇锋眰娑堟伅绫诲瀷锛氭枃鏈� + */ + public static final String WE_CHAT_MESSAGE_REQ_MESSAGE_TYPE_TEXT = "text"; + /** + * 璇锋眰娑堟伅绫诲瀷锛氬浘鐗� + */ + public static final String WE_CHAT_MESSAGE_REQ_MESSAGE_TYPE_IMAGE = "image"; + /** + * 璇锋眰娑堟伅绫诲瀷锛氶摼鎺� + */ + public static final String WE_CHAT_MESSAGE_REQ_MESSAGE_TYPE_LINK = "link"; + /** + * 璇锋眰娑堟伅绫诲瀷锛氬湴鐞嗕綅缃� + */ + public static final String WE_CHAT_MESSAGE_REQ_MESSAGE_TYPE_LOCATION = "location"; + /** + * 璇锋眰娑堟伅绫诲瀷锛氶煶棰� + */ + public static final String WE_CHAT_MESSAGE_REQ_MESSAGE_TYPE_VOICE = "voice"; + /** + * 璇锋眰娑堟伅绫诲瀷锛氳棰� + */ + public static final String WE_CHAT_MESSAGE_REQ_MESSAGE_TYPE_VIDEO = "video"; + /** + * 璇锋眰娑堟伅绫诲瀷锛氭帹閫� + */ + public static final String WE_CHAT_MESSAGE_REQ_MESSAGE_TYPE_EVENT = "event"; + /** + * 浜嬩欢绫诲瀷锛歴ubscribe(璁㈤槄) + */ + public static final String WE_CHAT_MESSAGE_EVENT_TYPE_SUBSCRIBE = "subscribe"; + /** + * 浜嬩欢绫诲瀷锛歶nsubscribe(鍙栨秷璁㈤槄) + */ + public static final String WE_CHAT_MESSAGE_EVENT_TYPE_UNSUBSCRIBE = "unsubscribe"; + /** + * 浜嬩欢绫诲瀷锛欳LICK(鑷畾涔夎彍鍗曠偣鍑讳簨浠�) + */ + public static final String WE_CHAT_MESSAGE_EVENT_TYPE_CLICK = "click"; + /** + * 浜嬩欢绫诲瀷锛歏IEW(鑷畾涔夎彍鍗� URl 瑙嗗浘) + */ + public static final String WE_CHAT_MESSAGE_EVENT_TYPE_VIEW = "view"; + /** + * 浜嬩欢绫诲瀷锛歀OCATION(涓婃姤鍦扮悊浣嶇疆浜嬩欢) + */ + public static final String WE_CHAT_MESSAGE_EVENT_TYPE_LOCATION = "LOCATION"; + /** + * 浜嬩欢绫诲瀷锛歀OCATION(涓婃姤鍦扮悊浣嶇疆浜嬩欢) + */ + public static final String WE_CHAT_MESSAGE_EVENT_TYPE_SCAN = "SCAN"; + + //鏃犳晥鍏抽敭瀛梜ey + public static final String WE_CHAT_MESSAGE_DEFAULT_CONTENT_KEY = "default"; + //Js sdk api 鍒楄〃 + public static final String PUBLIC_API_JS_API_SDK_LIST = "editAddress,openAddress,updateTimelineShareData,updateAppMessageShareData,onMenuShareTimeline,onMenuShareAppMessage,onMenuShareQQ,onMenuShareWeibo,onMenuShareQZone,startRecord,stopRecord,onVoiceRecordEnd,playVoice,pauseVoice,stopVoice,onVoicePlayEnd,uploadVoice,downloadVoice,chooseImage,previewImage,uploadImage,downloadImage,translateVoice,getNetworkType,openLocation,getLocation,hideOptionMenu,showOptionMenu,hideMenuItems,showMenuItems,hideAllNonBaseMenuItem,showAllNonBaseMenuItem,closeWindow,scanQRCode,chooseWXPay,openProductSpecificView,addCard,chooseCard,openCard"; + + + //token + public static final String REDIS_TOKEN_KEY = "wechat_token"; + public static final String REDIS_PROGRAM_TOKEN_KEY = "wechat_program_token"; + //tag + public static final String REDIS_TAGS_LIST_KEY = "wechat_tags_list"; + //user tag + public static final String REDIS_TAGS_LIST_USER_KEY = "wechat_tags_user_list"; + //寰俊鑿滃崟 + public static final String REDIS_PUBLIC_MENU_KEY = "wechat_public_menu_key"; + //寰俊鑷畾涔夎彍鍗� + public static final String REDIS_PUBLIC_MENU_SELF_KEY = "wechat_public_menu_self_key"; + + + + //鎺堟潈璇锋眰鍦板潃 + public static final String WE_CHAT_AUTHORIZE_URL = "https://open.weixin.qq.com/connect/oauth2/authorize?appid={$appId}&redirect_uri={$redirectUri}&response_type=code&scope=snsapi_base&state=#wechat_redirect"; + + + //-------------------------------------------寰俊鏀粯------------------------------------------------------------ + //寰俊鏀粯鎺ュ彛璇锋眰鍦板潃 + public static final String PAY_API_URL = "https://api.mch.weixin.qq.com/"; + public static final String PAY_API_URI = "pay/unifiedorder"; + public static final String PAY_NOTIFY_API_URI_WECHAT = "/api/admin/payment/callback/wechat"; + // 鍏叡鍙烽��娆� + public static final String PAY_REFUND_API_URI_WECHAT = "secapi/pay/refund"; + + public static final String PAY_TYPE_JS = "JSAPI"; + public static final String PAY_TYPE_H5 = "MWEB"; + + // -------------------------------------------------------------------------------------------------------- + // 寰俊閮ㄥ垎 + // -------------------------------------------------------------------------------------------------------- + + /** 鑾峰彇accessToken鐨剈rl */ + public static final String WECHAT_ACCESS_TOKEN_URL = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={0}&secret={1}"; + /** 寮�鏀惧钩鍙拌幏鍙朼ccessToken鐨剈rl */ + public static final String WECHAT_OAUTH2_ACCESS_TOKEN_URL = "https://api.weixin.qq.com/sns/oauth2/access_token?appid={0}&secret={1}&code={2}&grant_type=authorization_code"; + /** 寮�鏀惧钩鍙拌幏鍙栫敤鎴风殑url */ + public static final String WECHAT_SNS_USERINFO_URL = "https://api.weixin.qq.com/sns/userinfo?access_token={0}&openid={1}&lang={2}"; + + /** 鍏紬鍙穓s-sdk鑾峰彇ticket鐨剈rl */ + public static final String WECHAT_PUBLIC_JS_TICKET_URL = "https://api.weixin.qq.com/cgi-bin/ticket/getticket?access_token={0}&type=jsapi"; + /** 鍏紬鍙峰彂閫佹ā鏉挎秷鎭殑url */ + public static final String WECHAT_PUBLIC_SEND_TEMPLATE_URL = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token={}"; + /** 鍏紬鍙疯幏鍙栬嚜瀹氫箟鑿滃崟閰嶇疆鐨剈rl */ + public static final String WECHAT_PUBLIC_MENU_GET_URL = "https://api.weixin.qq.com/cgi-bin/menu/get?access_token={}"; + /** 鍏紬鍙峰垱寤鸿嚜瀹氫箟鑿滃崟鐨剈rl */ + public static final String WECHAT_PUBLIC_MENU_CREATE_URL = "https://api.weixin.qq.com/cgi-bin/menu/create?access_token={}"; + /** 鍏紬鍙峰垹闄よ嚜瀹氫箟鑿滃崟鐨剈rl */ + public static final String WECHAT_PUBLIC_MENU_DELETE_URL = "https://api.weixin.qq.com/cgi-bin/menu/delete?access_token={}"; + /** 浼佷笟鍙蜂笂浼犲叾浠栫被鍨嬫案涔呯礌鏉愮殑url */ + public static final String WECHAT_PUBLIC_QYAPI_ADD_MATERIAL_URL = "https://qyapi.weixin.qq.com/cgi-bin/material/add_material?type={}&access_token={}"; + /** 鍏紬鍙疯幏鍙栨ā鏉垮垪琛紙鑷繁鐨勶級 */ + public static final String WECHAT_PUBLIC_GET_ALL_PRIVATE_TEMPLATE_URL = "https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token={}"; + /** 鍏紬鍙峰垹闄ゆā鏉匡紙鑷繁鐨勶級 */ + public static final String WECHAT_PUBLIC_DEL_PRIVATE_TEMPLATE_URL = "https://api.weixin.qq.com/cgi-bin/template/del_private_template?access_token={}"; + /** 鍏紬鍙锋坊鍔犳ā鏉匡紙鑷繁鐨勶級 */ + public static final String WECHAT_PUBLIC_API_ADD_TEMPLATE_URL = "https://api.weixin.qq.com/cgi-bin/template/api_add_template?access_token={}"; + + + /** 灏忕▼搴忕櫥褰曞嚟璇佹牎楠岀殑url */ + public static final String WECHAT_MINI_SNS_AUTH_CODE2SESSION_URL = "https://api.weixin.qq.com/sns/jscode2session?appid={0}&secret={1}&js_code={2}&grant_type=authorization_code"; + /** 灏忕▼搴忕敓鎴愬皬绋嬪簭鐮佺殑url */ + public static final String WECHAT_MINI_QRCODE_UNLIMITED_URL = "https://api.weixin.qq.com/wxa/getwxacodeunlimit?access_token={0}"; + /** 灏忕▼搴忓彂閫佽闃呮秷鎭殑url */ + public static final String WECHAT_MINI_SEND_SUBSCRIBE_URL = "https://api.weixin.qq.com/cgi-bin/message/subscribe/send?access_token={}"; + /** 灏忕▼搴忚幏鍙栬闃呭垪琛紙鑷繁鐨勶級 */ + public static final String WECHAT_MINI_GET_ALL_PRIVATE_TEMPLATE_URL = "https://api.weixin.qq.com/wxaapi/newtmpl/gettemplate?access_token={}"; + /** 灏忕▼搴忓垹闄ゆā鏉匡紙鑷繁鐨勶級 */ + public static final String WECHAT_MINI_DEL_PRIVATE_TEMPLATE_URL = "https://api.weixin.qq.com/wxaapi/newtmpl/deltemplate?access_token={}"; + /** 灏忕▼搴忚幏鍙栬闃呮ā鏉匡紙灏忕▼搴忕殑锛� */ + public static final String WECHAT_MINI_GET_TEMPLATE_URL = "https://api.weixin.qq.com/wxaapi/newtmpl/getpubtemplatekeywords?access_token={}&tid={}"; + /** 鍏紬鍙锋坊鍔犳ā鏉匡紙鑷繁鐨勶級 */ + public static final String WECHAT_MINI_API_ADD_TEMPLATE_URL = "https://api.weixin.qq.com/wxaapi/newtmpl/addtemplate?access_token={}"; + + /** 灏忕▼搴廰ccessToken redis key */ + public static final String REDIS_WECAHT_MINI_ACCESS_TOKEN_KEY = "wechat_mini_accessToken"; + /** 鍏紬鍙穉ccessToken redis key */ + public static final String REDIS_WECAHT_PUBLIC_ACCESS_TOKEN_KEY = "wechat_public_accessToken"; + /** 鍏紬鍙稪sApiTicket redis key */ + public static final String REDIS_PUBLIC_JS_API_TICKET = "wechat_js_api_ticket"; + public static final Long REDIS_PUBLIC_JS_API_TICKET_EXPRESS = 7100L; + + /** + * -------------------------------------------------------------------------------------------------------- + * 浠ヤ笅涓鸿棰戝彿鐩稿叧閮ㄥ垎 + * -------------------------------------------------------------------------------------------------------- + */ + + /*------------------------------------------ 鐢宠鎺ュ叆鎺ュ彛 START ---------------------------------------*/ + public static final String WECHAT_SHOP_BASE_DOME = "https://api.weixin.qq.com"; + + /* 鐢宠鎺ュ叆鐢宠 */ + public static final String WECHAT_SHOP_REGISTER_APPLY = WECHAT_SHOP_BASE_DOME.concat("/shop/register/apply?access_token={}"); + /* 鑾峰彇鎺ュ叆鐘舵�� */ + public static final String WECHAT_SHOP_REGISTER_CHECK = WECHAT_SHOP_BASE_DOME.concat("/shop/register/check?access_token={}"); + /* 瀹屾垚鎺ュ叆浠诲姟 */ + public static final String WECHAT_SHOP_REGISTER_FINISH_ACCESS = WECHAT_SHOP_BASE_DOME.concat("/shop/register/finish_access_info?access_token={}"); + /* 鍦烘櫙鎺ュ叆鐢宠 鍦ㄥ皬绋嬪簭涓婄嚎涔嬪悗 骞朵笖鎵�鏈夌殑api璋冪敤閮介�氳繃浜� 鎵嶅彲浠ヤ娇鐢� 璋冪敤鐢宠鎴愬姛涔嬪悗灏卞彲浠ュ湪瑙嗛鍙风洿鎾椂閫夋嫨绾夸笂鍟嗗搧浜� */ + public static final String WECHAT_SHOP_REGISTER_APPLY_SCENE = WECHAT_SHOP_BASE_DOME.concat("/shop/register/apply_scene?access_token={}"); + + /*------------------------------------------ 鐢宠鎺ュ叆鎺ュ彛 END ---------------------------------------*/ + + + /*------------------------------------------ 鎺ュ叆鍟嗗搧鍓嶅繀椤绘帴鍙� START ---------------------------------------*/ + /** 鑾峰彇鍟嗗搧绫荤洰 */ + public static final String WECHAT_SHOP_CAT_GET_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/cat/get?access_token={}"); + /** 涓婁紶鍥剧墖 **/ + public static final String WECHAT_SHOP_IMG_UPLOAD = WECHAT_SHOP_BASE_DOME.concat("/shop/img/upload?&access_token={}"); + /** 涓婁紶鍝佺墝淇℃伅 */ + public static final String WECHAT_SHOP_AUDIT_AUDIT_BRAND = WECHAT_SHOP_BASE_DOME.concat("/shop/audit/audit_brand?&access_token={}"); + /** 涓婁紶绫荤洰璧勮川 */ + public static final String WECHAT_SHOP_AUDIT_AUDIT_CATEGORY = WECHAT_SHOP_BASE_DOME.concat("/shop/audit/audit_category?&access_token={}"); + /** 鏌ヨ绫荤洰瀹℃牳缁撴灉 */ + public static final String WECHAT_SHOP_AUDIT_RESULT= WECHAT_SHOP_BASE_DOME.concat("/shop/audit/result?access_token={}"); + /** 鑾峰彇灏忕▼搴忔彁浜よ繃鐨勫叆椹昏祫璐ㄤ俊鎭� */ + public static final String WECHAT_SHOP_AUDIT_GET_MINIAPP_CERTIFICATE= WECHAT_SHOP_BASE_DOME.concat("/shop/audit/get_miniapp_certificate?access_token={}"); + /*------------------------------------------ 鎺ュ叆鍟嗗搧鍓嶅繀椤绘帴鍙� END ---------------------------------------*/ + + + /*------------------------------------------ 鍟嗗鍏ラ┗鎺ュ彛 START ---------------------------------------*/ + /** 鑾峰彇绫荤洰鍒楄〃 */ + public static final String WECHAT_SHOP_ACCOUNT_GET_CATEGORY_LIST = WECHAT_SHOP_BASE_DOME.concat("/shop/account/get_category_list?access_token={}"); + /** 鑾峰彇鍝佺墝鍒楄〃 */ + public static final String WECHAT_SHOP_ACCOUNT_GET_BRAND_LIST = WECHAT_SHOP_BASE_DOME.concat("/shop/account/get_brand_list?access_token={}"); + /** 鏇存柊鍟嗗淇℃伅 */ + public static final String WECHAT_SHOP_ACCOUNT_UPDATE_INFO = WECHAT_SHOP_BASE_DOME.concat("/shop/account/update_info?access_token={}"); + /** 鑾峰彇鍟嗗淇℃伅 */ + public static final String WECHAT_SHOP_ACCOUNT_GET_INFO = WECHAT_SHOP_BASE_DOME.concat("/shop/account/get_info?access_token={}"); + /*------------------------------------------ 鍟嗗鍏ラ┗鎺ュ彛 END ---------------------------------------*/ + + /*------------------------------------------ SPU 鎺ュ彛 START ---------------------------------------*/ + /** 娣诲姞鍟嗗搧 */ + public static final String WECHAT_SHOP_SPU_ADD_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/spu/add?access_token={}"); + /** 鍒犻櫎鍟嗗搧 */ + public static final String WECHAT_SHOP_SPU_DEL_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/spu/del?access_token={}"); + /** 鎾ゅ洖鍟嗗搧瀹℃牳 */ + public static final String WECHAT_SHOP_SPU_DEL_AUDIT_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/spu/del_audit?access_token={}"); + /** 鑾峰彇鍟嗗搧 */ + public static final String WECHAT_SHOP_SPU_GET_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/spu/get?access_token={}"); + /** 鑾峰彇鍟嗗搧鍒楄〃 */ + public static final String WECHAT_SHOP_SPU_GET_LIST_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/spu/get_list?access_token={}"); + /** 鏇存柊鍟嗗搧 */ + public static final String WECHAT_SHOP_SPU_UPDATE_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/spu/update?access_token={}"); + /** 涓婃灦鍟嗗搧 */ + public static final String WECHAT_SHOP_SPU_LISTING_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/spu/listing?access_token={}"); + /** 涓嬫灦鍟嗗搧 */ + public static final String WECHAT_SHOP_SPU_DELISTING_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/spu/delisting?access_token={}"); + + /*------------------------------------------ SPU 鎺ュ彛 END ---------------------------------------*/ + + /*------------------------------------------ 璁㈠崟 鎺ュ彛 START ---------------------------------------*/ + /** 妫�鏌ュ満鏅�兼槸鍚﹀湪鏀粯鏍¢獙鑼冨洿鍐� */ + public static final String WECHAT_SHOP_SCENE_CHECK_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/scene/check?access_token={}"); + /** 鐢熸垚璁㈠崟骞惰幏鍙杢icket */ + public static final String WECHAT_SHOP_ORDER_ADD_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/order/add?access_token={}"); + /** 瑙嗛鍙峰拷鐣ユ鎺ュ彛 鍚屾璁㈠崟鏀粯缁撴灉 */ + public static final String WECHAT_SHOP_ORDER_PAY_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/order/pay?access_token={}"); + /** 鐢熸垚鏀粯鍙傛暟 */ + public static final String WECHAT_SHOP_ORDER_PAYMENT_PARAMS_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/order/getpaymentparams?access_token={}"); + /** 鑾峰彇璁㈠崟 */ + public static final String WECHAT_SHOP_ORDER_GET_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/order/get?access_token={}"); + /** 鎸夋帹骞垮憳鑾峰彇璁㈠崟 */ + public static final String WECHAT_SHOP_ORDER_GETBYFINDER_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/order/get_list_by_finder?access_token={}"); + /** 鎸夊垎浜憳鑾峰彇璁㈠崟 */ + public static final String WECHAT_SHOP_ORDER_GETBYSHARER_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/order/get_list_by_sharer?access_token={}"); + /** 鑾峰彇璁㈠崟鍒楄〃 */ + public static final String WECHAT_SHOP_ORDER_GET_LIST_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/order/get_list?access_token={}"); + /*------------------------------------------ 璁㈠崟 鎺ュ彛 END ---------------------------------------*/ + + /*------------------------------------------ 鐗╂祦 鎺ュ彛 START ---------------------------------------*/ + /** 鑾峰彇蹇�掑叕鍙稿垪琛� */ + public static final String WECHAT_SHOP_DELIVERY_GET_COMPANY_LIST_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/delivery/get_company_list?access_token={}"); + /** 璁㈠崟鍙戣揣 */ + public static final String WECHAT_SHOP_DELIVERY_SEND_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/delivery/send?access_token={}"); + /** 璁㈠崟纭鏀惰揣 */ + public static final String WECHAT_SHOP_DELIVERY_RECIEVE_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/delivery/recieve?access_token={}"); + /*------------------------------------------ 鐗╂祦 鎺ュ彛 END ---------------------------------------*/ + + /*------------------------------------------ 鍞悗 鎺ュ彛 START ---------------------------------------*/ + /** 鍒涘缓鍞悗 */ + public static final String WECHAT_SHOP_AFTERSALE_ADD_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/aftersale/add?access_token={}"); + /** 鑾峰彇鍞悗 */ + public static final String WECHAT_SHOP_AFTERSALE_GET_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/aftersale/get?access_token={}"); + /** 鏇存柊鍞悗 */ + public static final String WECHAT_SHOP_AFTERSALE_UPDATE_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/aftersale/update?access_token={}"); + /*------------------------------------------ 鍞悗 鎺ュ彛 END ---------------------------------------*/ + + /*------------------------------------------ 浼樻儬鍒� 鎺ュ彛 START 浜屾湡 ---------------------------------------*/ + /** 鍟嗗纭鍥炶皟棰嗗埜浜嬩欢 */ + public static final String WECHAT_SHOP_COUPON_CONFIRM_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/coupon/confirm?access_token={}"); + /** 娣诲姞浼樻儬鍒� */ + public static final String WECHAT_SHOP_COUPON_ADD_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/coupon/add?access_token={}"); + /** 鑾峰彇浼樻儬鍒镐俊鎭� */ + public static final String WECHAT_SHOP_COUPON_GET_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/coupon/get?access_token={}"); + /** 鑾峰彇浼樻儬鍒稿垪琛� */ + public static final String WECHAT_SHOP_COUPON_GET_LIST_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/coupon/get_list?access_token={}"); + /** 鏇存柊浼樻儬鍒镐俊鎭� */ + public static final String WECHAT_SHOP_COUPON_UPDATE_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/coupon/update?access_token={}"); + /** 鏇存柊浼樻儬鍒哥姸鎬� */ + public static final String WECHAT_SHOP_COUPON_UPDATE_STATUS_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/coupon/update_status?access_token={}"); + /** 鏇存柊浼樻儬鍒稿簱瀛� */ + public static final String WECHAT_SHOP_COUPON_UPDATE_STOCK_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/coupon/update_coupon_stock?access_token={}"); + /** 娣诲姞鐢ㄦ埛浼樻儬鍒� */ + public static final String WECHAT_SHOP_COUPON_ADD_USER_COUPON_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/coupon/add_user_coupon?access_token={}"); + /** 鑾峰彇鐢ㄦ埛浼樻儬鍒稿垪琛� */ + public static final String WECHAT_SHOP_COUPON_GET_USERCOUPON_LIST_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/coupon/get_usercoupon_list?access_token={}"); + /** 鏇存柊鐢ㄦ埛浼樻儬鍒� */ + public static final String WECHAT_SHOP_COUPON_UPDATE_USER_COUPON_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/coupon/update_user_coupon?access_token={}"); + /** 鏇存柊鐢ㄦ埛浼樻儬鍒哥姸鎬� */ + public static final String WECHAT_SHOP_COUPON_UPDATE_USERCOUPON_STATUS_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/coupon/update_usercoupon_status?access_token={}"); + + /*------------------------------------------ 浼樻儬鍒� 鎺ュ彛 END 浜屾湡 ---------------------------------------*/ + + /*------------------------------------------ 鎺ㄥ箍鍛� 鎺ュ彛 START 浜屾湡 ---------------------------------------*/ + /** 鑾峰彇鎺ㄥ箍鍛樺垪琛� */ + public static final String WECHAT_SHOP_COUPON_PROMOTER_LIST_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/promoter/list?access_token={}"); + /*------------------------------------------ 鎺ㄥ箍鍛� 鎺ュ彛 END 浜屾湡 ---------------------------------------*/ + + /*------------------------------------------ 鍒嗛攢鍛� 鎺ュ彛 START 浜屾湡 ---------------------------------------*/ + /** 缁戝畾鍒嗕韩鍛� */ + public static final String WECHAT_SHOP_SHARER_BIND_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/sharer/bind?access_token={}"); + /** 瑙g粦鍒嗕韩鍛� */ + public static final String WECHAT_SHOP_SHARER_UNBIND_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/sharer/unbind?access_token={}"); + /** 鑾峰彇宸茬粡缁戝畾鐨勫垎浜憳鍒楄〃*/ + public static final String WECHAT_SHOP_SHARER_GET_SHARER_LIST_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/sharer/get_sharer_list?access_token={}"); + /** 鑾峰彇鍒嗗垎浜憳 */ + public static final String WECHAT_SHOP_SHARER_SEARCH_SHARER_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/sharer/search_sharer?access_token={}"); + /** 鑾峰彇鍒嗕韩鍛樼殑涓甫璐ф暟鎹� */ + public static final String WECHAT_SHOP_SHARER_GET_SHARER_DATA_SUMMARY_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/sharer/get_sharer_data_summary?access_token={}"); + /** 鑾峰彇鍒嗕韩鍛樼殑鐩存挱闂磋鍗曟眹鎬� */ + public static final String WECHAT_SHOP_SHARER_GET_SHARER_LIVE_ORDER_LIST_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/sharer/get_sharer_live_order_list?access_token={}"); + /** 鑾峰彇鍒嗕韩鍛樼殑鐩存挱闂村甫璐ф暟鎹眹鎬� */ + public static final String WECHAT_SHOP_SHARER_GET_SHARER_LIVE_SUMMARY_LIST_URL = WECHAT_SHOP_BASE_DOME.concat("/shop/sharer/get_sharer_live_summary_list?access_token={}"); + + /*------------------------------------------ 鍒嗛攢鍛� 鎺ュ彛 END 浜屾湡 ---------------------------------------*/ + + /** 鑷畾涔夌粍浠讹紝鍟嗗搧绫诲瀷 redis key */ + public static final String REDIS_WECHAT_SHOP_CAT_KEY = "wechat_shop_cat"; + + /** 寰俊灏忕▼搴忓洖璋冿紝鍟嗗搧瀹℃牳鍥炶皟浜嬩欢 */ + public static final String WECAHT_CALLBACK_EVENT_SPU_AUDIT = "open_product_spu_audit"; + /** 寰俊灏忕▼搴忓洖璋冿紝鍝佺墝瀹℃牳鍥炶皟浜嬩欢 */ + public static final String WECAHT_CALLBACK_EVENT_BRAND_AUDIT = "open_product_brand_audit"; + + + /** 璐︽埛鎺ュ叆鍥炶皟 */ + public static final String WECHAT_CALLBACK_EVENT_OPEN_PRODUCT_ACCOUNT_REGISTER = "open_product_account_register"; + + /** 鍦烘櫙瀹℃牳鍥炶皟 */ + public static final String WECHAT_CALLBACK_EVENT_OPEN_PRODUCT_SCENE_GROUP_AUDIT = "![CDATA[open_product_scene_group_audit]]"; + + /** 璁㈠崟鏀粯鎴愬姛鍥炶皟 */ + public static final String WECHAT_CALLBACK_EVENT_OPEN_PRODUCT_ORDER_PAY = "open_product_order_pay"; + + /** 鍟嗗搧绯荤粺涓嬫灦鍥炶皟 */ + public static final String WECHAT_CALLBACK_EVENT_OPEN_PRODUCT_SPU_STATUS_UPDATE = "open_product_spu_status_update"; + /** 绫荤洰瀹℃牳鍥炶皟 */ + public static final String WECHAT_CALLBACK_EVENT_OPEN_PRODUCT_CATEGORY_AUDIT = "open_product_category_audit"; + /** 鍒嗕韩鍛樼粦瀹氳В缁戦�氱煡 */ + public static final String WECHAT_CALLBACK_EVENT_MINIPROGRAM_SHARER_BIND_STATUS_CHANGE = "miniprogram_sharer_bind_status_change"; + /** 鐢ㄦ埛棰嗗埜鍥炶皟 */ + public static final String WECHAT_CALLBACK_EVENT_OPEN_PRODUCT_RECEIVE_COUPON = "open_product_receive_coupon"; + + /** 绱犳潗涓婁紶鍥剧墖鏈�澶у�� */ + public static final Long OPEN_MEDIA_UPLOAD_IMAGE_MAX_SIZE = 1024 * 1024 * 10L; + /** 绱犳潗涓婁紶鍥剧墖鍚庣紑绫诲瀷 */ + public static final String OPEN_MEDIA_UPLOAD_IMAGE_SUFFIX_NAME = "bmp,png,jpeg,jpg,gif"; + /** 绱犳潗涓婁紶璇煶鏈�澶у�� */ + public static final Long OPEN_MEDIA_UPLOAD_VOICE_MAX_SIZE = 1024 * 1024 * 2L; + /** 绱犳潗涓婁紶璇煶鍚庣紑绫诲瀷 */ + public static final String OPEN_MEDIA_UPLOAD_VOICE_SUFFIX_NAME = "mp3,wma,wav,amr"; + +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/api/UserAndDeptApi.java b/iplatform-base/src/main/java/com/iplatform/base/api/UserAndDeptApi.java new file mode 100644 index 0000000..6f5dc31 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/api/UserAndDeptApi.java @@ -0,0 +1,40 @@ +package com.iplatform.base.api; + +import com.iplatform.base.PlatformAdapterController; +import com.iplatform.base.service.UserDeptApiServiceImpl; +import com.iplatform.model.to.UserAndDeptTo; +import com.walker.web.ResponseValue; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +/** + * 鎻愪緵瀵瑰鎺ュ彛锛屽疄鐜板骞冲彴鏈烘瀯浜哄憳鐨勬搷浣溿�� + * @author 鏃跺厠鑻� + * @date 2023-06-06 + */ +@RestController +@RequestMapping("/api/platform/user_dept") +public class UserAndDeptApi extends PlatformAdapterController +// implements UserAndDeptServiceApi +{ + + private UserDeptApiServiceImpl userDeptApiService; + + @Autowired + public UserAndDeptApi(UserDeptApiServiceImpl userDeptApiService){ + this.userDeptApiService = userDeptApiService; + } + + @RequestMapping(value = "/create", method = RequestMethod.POST) + public ResponseValue execInsertTopOrgAndAdmin(@RequestBody UserAndDeptTo userAndDeptTo) { + long loginId = this.getCurrentUserId(); + userAndDeptTo.setCreateId(String.valueOf(loginId)); + if(this.logger.isDebugEnabled()){ + logger.debug(userAndDeptTo.toString()); + } + return this.userDeptApiService.execInsertTopOrgAndAdmin(userAndDeptTo); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/cache/DictCacheProvider.java b/iplatform-base/src/main/java/com/iplatform/base/cache/DictCacheProvider.java new file mode 100644 index 0000000..5dfbaab --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/cache/DictCacheProvider.java @@ -0,0 +1,277 @@ +package com.iplatform.base.cache; + +import com.iplatform.base.Constants; +import com.iplatform.base.service.CodeServiceImpl; +import com.iplatform.model.po.S_dict_data; +import com.iplatform.model.po.S_dict_type; +import com.walker.cache.tree.AbstractCacheTreeProvider; +import com.walker.cache.tree.CacheTreeNode; +import com.walker.cache.tree.DefaultCacheTreeNode; +import com.walker.infrastructure.utils.StringUtils; + +import java.util.ArrayList; +import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +/** + * 鏁版嵁瀛楀吀缂撳瓨瀹氫箟锛岃缂撳瓨鍥犱负鏍戠粨鏋勫鏉傦紝骞舵病鏈夋彁渚�'Redis'鏂瑰紡瀹炵幇銆�<br> + * 涓嶈繃涓�鑸瓧鍏告暟鎹彉鍔ㄥ緢灏忥紝鍥犳鍦ㄩ泦缇ょ幆澧冧腑涔熸槸鐩稿瀹夊叏銆�<p></p> + * 1) 娉ㄦ剰锛氬鏋滅敓浜х幆澧冨瓧鍏稿彉鍔ㄨ緝澶э紝鑰屼笖鏄泦缇ょ幆澧冨垯蹇呴』瀹炵幇'Redis'闆嗕腑瀛樺偍缂撳瓨瀵硅薄銆� + * @author 鏃跺厠鑻� + * @date 2023-03-10 + */ +public class DictCacheProvider extends AbstractCacheTreeProvider<S_dict_data> { + + private final SortComparator sort = new SortComparator(); + private final NodeComparator nodeSort = new NodeComparator(); + + // 2023-04-15 娣诲姞瀛楀吀绫诲瀷涓巌d鏄犲皠璁板綍锛屽洜涓� + private final Map<String, String> dictTypeIdMap = new HashMap<>(); + + /** + * 鏍规嵁瀛楀吀绫诲瀷锛屾壘鍑哄搴攊d锛屽洜涓哄墠绔嫢渚濇鏋朵腑锛岄渶瑕佷紶绫诲瀷锛屼絾绯荤粺浣跨敤id鏌ヨ銆� + * @param dictType + * @return + * @date 2023-04-15 + */ + public String getDictTypeId(String dictType){ + String id = this.dictTypeIdMap.get(dictType); + if(id == null){ + throw new IllegalArgumentException("鏍规嵁瀛楀吀绫诲瀷锛屾湭鎵惧埌id锛�" + dictType); + } + return id; + } + + /** + * 杩斿洖浠g爜闆嗗悎瀵硅薄锛岄�氬父鍦ㄦ暟鎹簱涓彲鑳戒細瀛樺偍澶氫釜浠g爜ID锛屽彲浠ラ�氳繃姝� 鏂规硶鑾峰彇浠g爜闆嗗悎銆� + * @param codeIds 杈撳叆澶氫釜浠g爜ID鏁扮粍 + * @return + */ + public List<CacheTreeNode> getCodeList(String[] codeIds){ + List<CacheTreeNode> result = new ArrayList<CacheTreeNode>(2*2); + if(codeIds != null && codeIds.length > 0){ + for(String cid : codeIds){ + result.add(this.get(cid)); + } + } + return result; + } + + /** + * 杩斿洖缁欏畾浠g爜琛ㄧ殑瀛愪唬鐮侀」锛屾爲缁撴瀯 + * @param codeTableName 浠g爜琛↖D + * @return + */ + public List<CacheTreeNode> getCodeChildrenList(String codeTableName){ + CacheTreeNode node = this.getOneRootNode(codeTableName); + if(node == null){ + throw new IllegalArgumentException("not found node: " + codeTableName); + } + Collection<CacheTreeNode> list = node.getChildren(); + if(list != null){ + List<CacheTreeNode> result = new ArrayList<CacheTreeNode>(); + for(CacheTreeNode n : list){ + result.add(n); + } + Collections.sort(result, nodeSort); + return result; + } + return null; + } + + /** + * 杩斿洖浠g爜琛ㄧ殑涓嬩竴绾у瓙浠g爜闆嗗悎锛岃繑鍥炵殑鏄唬鐮佸璞� + * @param codeTableName 浠g爜琛↖D + * @return + */ + public List<S_dict_data> getRootChildrenOneLevelList(String codeTableName){ + CacheTreeNode node = this.getOneRootNode(codeTableName); +// CacheTreeNode node2 =this.getOneRootNode("101"); +// Object rootCacheNode = null; +// for(Iterator<Cachable> it = this.getCache().getIterator(); it.hasNext();){ +// rootCacheNode = it.next().getValue(); +// logger.debug("........ {}" + rootCacheNode); +// } + if(node == null){ + throw new IllegalArgumentException("not found node: " + codeTableName); + } + Collection<CacheTreeNode> list = node.getChildren(); + if(list != null){ + List<S_dict_data> result = new ArrayList<>(); + S_dict_data temp = null; + for(CacheTreeNode n : list){ + temp = (S_dict_data)n.getSource(); +// temp.setChildSum(n.getChildrenSize()); + result.add(temp); + } + Collections.sort(result, sort); + return result; + } + return null; + } + + /** + * 鏍规嵁鏌愪釜浠g爜ID锛岃繑鍥炲叾涓嬩竴绾ф墍鏈夊瓙浠g爜闆嗗悎 + * @param id + * @return + */ + public List<S_dict_data> getCodeChildrenOneLevelList(String id){ + CacheTreeNode parent = this.get(id); + if(parent == null){ + return null; + } + Collection<CacheTreeNode> list = parent.getChildren(); + if(list != null){ + List<S_dict_data> result = new ArrayList<>(); + for(CacheTreeNode n : list){ + result.add((S_dict_data)n.getSource()); + } + return result; + } + return null; + } + + /** + * 杩斿洖鏌愪釜浠g爜涓嬮潰鐨勬墍鏈変唬鐮佹爲銆� + * @param id 缁欏畾鐨勪唬鐮乮d + * @return + */ + public List<CacheTreeNode> getCodeChildrenTreeList(String id){ + CacheTreeNode parent = this.get(id); + if(parent == null){ + return null; + } + Collection<CacheTreeNode> list = parent.getChildren(); + if(list != null){ + List<CacheTreeNode> result = new ArrayList<CacheTreeNode>(); + for(CacheTreeNode n : list){ + result.add(n); + } + return result; + } + return null; + } + +// /** +// * 鎼滅储浠g爜鏍戯紝鏀寔澶氬叧閿瓧鎼滅储锛岃繑鍥為泦鍚堟暟鎹睍绀虹粰ztree锛屾敞鎰忥細杩斿洖缁撴灉鍙湁涓�绾т笉鍐嶅垎灞� +// * @param codeTableId 浠g爜琛↖D +// * @param keyLike 鏌ヨ鍏抽敭瀛楋紝濡傦細'閿呯倝' 鎴栬�� '閿呯倝 鐢� 9鍙�'锛屽鍏抽敭璇嶇敤绌烘牸鍒嗛殧 +// * @return +// */ +// public String searchLikeTreeNodeList(String codeTableId, String keyLike){ +//// Collection<CacheTreeNode> deptList = this.getRootList(); +// Collection<CacheTreeNode> deptList = this.getCodeChildrenList(codeTableId); +// JSONArray array = new JSONArray(); +// +// if(deptList != null){ +// // 杩囨护鏌愪釜鍗曚綅涓嬬殑鏍规暟鎹泦鍚堬紝鍚庣画琛ュ厖 +// // ... +// String[] keys = StringUtils.stringToArray(keyLike, " "); +// boolean multiKeys = false; +// if(keys != null && keys.length > 1){ +// multiKeys = true; +// } +// +// List<CacheTreeNode> tempList = null; +// for(CacheTreeNode node : deptList){ +// // 涓嶆槸缁欏畾鍗曚綅鐨勬暟鎹笉瑕� +//// if(((TypeTree)node.getSource()).getDept() != dept){ +//// continue; +//// } +// if(multiKeys){ +// logger.debug("------------------"); +// tempList = node.searchLike(keys); +// } else { +// tempList = node.searchLike(keyLike); +// } +// if(!StringUtils.isEmptyList(tempList)){ +// for(CacheTreeNode c : tempList){ +// array.add(CodeUtils.createJsonTree(c.getKey(), c.getText() +// , Constants.DEFAULT_TREE_ROOT_ID, false, true, CodeUtils.DEFAULT_SEARCH_ICON, false)); +// } +// } +// } +// } +// return array.toString(); +// } + + @Override + protected Map<String, CacheTreeNode> loadRootList() { + List<S_dict_type> rootList = this.codeService.queryRootCodeList(); + if(StringUtils.isEmptyList(rootList)){ + return null; + } + // 闇�瑕佽浆鎴�'S_dict_data'缁熶竴瀵硅薄锛岃�佺郴缁熶腑浠g爜琛ㄦ槸涓�涓〃锛岃繖閲屾槸涓や釜琛ㄣ��2023-03-10 + List<S_dict_data> dictList = new ArrayList<>(); + S_dict_data data = null; + for(S_dict_type type : rootList){ + data = new S_dict_data(); + data.setDict_code(type.getDict_id()); + data.setDict_label(type.getDict_name()); + data.setParent_id(0L); // 鏍硅妭鐐逛笉瀛樺湪鐖秈d锛岄粯璁わ紱0 + dictList.add(data); + // + this.dictTypeIdMap.put(type.getDict_type(), String.valueOf(type.getDict_id())); + } + return obtainMap(dictList); + } + + @Override + protected Map<String, CacheTreeNode> loadChildList() { + List<S_dict_data> list = this.codeService.queryAllCodeItemList(); + return obtainMap(list); + } + + @Override + protected CacheTreeNode toCacheTreeNode(S_dict_data entity) { + return new DefaultCacheTreeNode(entity.getDict_code().toString() + , entity.getDict_label(), entity, entity.getParent_id().toString()); + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_DICT; + } + + @Override + public Class<?> getProviderType() { + return S_dict_data.class; + } + + private Map<String, CacheTreeNode> obtainMap(List<S_dict_data> list){ + if(list != null && list.size() > 0){ + Map<String, CacheTreeNode> map = new TreeMap<String, CacheTreeNode>(); + for(S_dict_data code : list){ + map.put(code.getDict_code().toString(), toCacheTreeNode(code)); + } + return map; + } else + return null; + } + + private class SortComparator implements Comparator<S_dict_data> { + @Override + public int compare(S_dict_data o1, S_dict_data o2) { + return (int)(o1.getDict_sort() - o2.getDict_sort()); + } + } + private class NodeComparator implements Comparator<CacheTreeNode>{ + @Override + public int compare(CacheTreeNode o1, CacheTreeNode o2) { + S_dict_data n1 = (S_dict_data)o1.getSource(); + S_dict_data n2 = (S_dict_data)o2.getSource(); + return (int)(n1.getDict_sort() - n2.getDict_sort()); + } + } + + public void setCodeService(CodeServiceImpl codeService) { + this.codeService = codeService; + } + + private CodeServiceImpl codeService; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/cache/FormCacheProvider.java b/iplatform-base/src/main/java/com/iplatform/base/cache/FormCacheProvider.java new file mode 100644 index 0000000..afccb0b --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/cache/FormCacheProvider.java @@ -0,0 +1,135 @@ +package com.iplatform.base.cache; + +import com.iplatform.base.Constants; +import com.iplatform.base.PlatformRuntimeException; +import com.iplatform.base.pojo.form.FormData; +import com.iplatform.base.pojo.form.FormDataItem; +import com.iplatform.base.service.ConfigFormServiceImpl; +import com.iplatform.base.util.ConfigFormValidateUtils; +import com.iplatform.model.po.S_config_form; +import com.iplatform.model.vo.ConfigFormItemConfigRegListVo; +import com.iplatform.model.vo.ConfigFormItemVo; +import com.iplatform.model.vo.ConfigFormVo; +import com.walker.cache.AbstractCacheProvider; +import com.walker.cache.Cache; +import com.walker.infrastructure.utils.JsonUtils; +import com.walker.infrastructure.utils.StringUtils; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 鑷畾涔夎〃鍗曠紦瀛樸�� + * <p>1銆佸洜涓鸿繖涓暟鎹笉浼氬姩鎬佸彉鍔紝鍥犳涓嶉渶瑕丷edis璐熻浇鏀寔銆�</p> + * @author 鏃跺厠鑻� + * @date 2023-05-18 + */ +public class FormCacheProvider extends AbstractCacheProvider<S_config_form> { + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + //~~ 鐢ㄤ簬楠岃瘉閰嶇疆琛ㄥ崟鐨勭浉鍏虫柟娉曪紝鍚庣画闇�瑕佸鍔犺〃鍗曞紩鎿庯紙瀵硅薄锛夋潵鍗曠嫭澶勭悊锛� + //~~ 鐜板湪涓存椂浣跨敤缂撳瓨瀵硅薄澶勭悊銆�2023-05-20 + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + /** + * 鏍¢獙鎻愪氦鐨勮〃鍗曟槸鍚︽纭�� + * <pre>1) 褰撳墠鍦ㄥ姛鑳斤細鍒嗙粍锛堢粍鍚堟暟鎹級娣诲姞鏁版嵁椤规椂琚皟鐢ㄣ��</pre> + * @param formData + * @date 2023-05-20 + */ + public void validateForm(FormData formData){ + //寰幆鍙栧嚭item鏁版嵁锛� 缁勫悎鎴� key => val 鐨刴ap鏍煎紡 + Map<String, String> map = new HashMap<>(); + String formItemValue = null; + for (FormDataItem formDataItem : formData.getFields()) { + // 2023-05-21 鎶妚alue涓璲son杞瓧绗︿覆鏃讹紝鍖呭惈鐨勶細\"鍘绘帀銆� + // 鐢变簬杩樻病鏈変娇鐢ㄥ埌锛岄渶瑕佸悗缁瘎浼扮湅鐢ㄩ偅绉嶆柟娉曡兘鑾峰彇鍊笺�� +// formItemValue = formDataItem.getValue(); +// if(StringUtils.isNotEmpty(formItemValue)){ +// formDataItem.setValue(formItemValue.replaceAll("\"", StringUtils.EMPTY_STRING)); +// } + + // 绠楁硶涓存椂缂撳瓨 + map.put(formDataItem.getName(), formDataItem.getValue()); + } + + //鍙栧嚭琛ㄥ崟妯″瀷鐨勬暟鎹� + S_config_form form = this.getCacheData(formData.getId().toString()); + + //瑙f瀽琛ㄥ崟瑙勫垯杩涜楠岃瘉 + ConfigFormVo systemConfigFormVo = null; + try { + systemConfigFormVo = JsonUtils.jsonStringToObject(form.getContent(), ConfigFormVo.class); + } catch (Exception e) { + logger.error("formData.getId()=" + formData.getId() + ", " + e.getMessage(), e); + throw new PlatformRuntimeException("妯℃澘琛ㄥ崟 銆�" + form.getName() + "銆� 鍐呭涓嶆纭紝璇锋鏌SON鏍煎紡锛�", e); + } + +// ConfigFormItemVo configFormItemVo; +// for (String item : systemConfigFormVo.getFields()) { + for (ConfigFormItemVo configFormItemVo : systemConfigFormVo.getFields()) { +// systemConfigFormItemVo = JSONObject.parseObject(item, SystemConfigFormItemVo.class); +// try { +// configFormItemVo = JsonUtils.jsonStringToObject(item, ConfigFormItemVo.class); +// } catch (Exception e) { +// throw new PlatformRuntimeException("ConfigFormItemVo杞崲閿欒:" + item, e); +// } + String model = configFormItemVo.get__vModel__(); //瀛楁 name + + if(configFormItemVo.get__config__().getRequired() && map.get(model).equals(StringUtils.EMPTY_STRING)) { + throw new PlatformRuntimeException(configFormItemVo.get__config__().getLabel() + "涓嶈兘涓虹┖锛�"); + } + //姝e垯楠岃瘉 + checkRule(configFormItemVo.get__config__().getRegList(), map.get(model), configFormItemVo.get__config__().getLabel()); + } + } + + /** + * 楠岃瘉item瑙勫垯 + * @param regList List<SystemConfigFormItemConfigRegListVo 姝e垯琛ㄨ揪寮忓垪琛� + * @param value String 楠岃瘉鐨勫�� + * @param name String 鎻愮ず璇瓧娈靛悕绉� + + * @since 2020-04-16 + */ + private void checkRule(List<ConfigFormItemConfigRegListVo> regList, String value, String name) { + if(regList.size() > 0) { + for (ConfigFormItemConfigRegListVo systemConfigFormItemConfigRegListVo : regList) { + if(!ConfigFormValidateUtils.regular(value, name, systemConfigFormItemConfigRegListVo.getPattern())) { + throw new PlatformRuntimeException(systemConfigFormItemConfigRegListVo.getMessage()); + } + } + } + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ end ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + @Override + protected int loadDataToCache(Cache cache) { + List<S_config_form> hosts = this.configFormService.selectAll(new S_config_form()); + if(!StringUtils.isEmptyList(hosts)){ + for(S_config_form h : hosts){ + cache.put(String.valueOf(h.getId()), h); + } + return hosts.size(); + } + return 0; + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_FORM; + } + + @Override + public Class<?> getProviderType() { + return S_config_form.class; + } + + public void setConfigFormService(ConfigFormServiceImpl configFormService) { + this.configFormService = configFormService; + } + + private ConfigFormServiceImpl configFormService; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/cache/LocalCaptchaCacheProvider.java b/iplatform-base/src/main/java/com/iplatform/base/cache/LocalCaptchaCacheProvider.java new file mode 100644 index 0000000..e45b477 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/cache/LocalCaptchaCacheProvider.java @@ -0,0 +1,47 @@ +package com.iplatform.base.cache; + +import com.iplatform.base.Constants; +import com.walker.cache.AbstractCacheProvider; +import com.walker.cache.Cache; + +import java.util.HashMap; +import java.util.Map; + +/** + * 楠岃瘉鐮�(鏈湴)缂撳瓨瀹炵幇銆� + * @author 鏃跺厠鑻� + * @date 2022-11-07 + */ +public class LocalCaptchaCacheProvider extends AbstractCacheProvider<String> { + + private Map<String, Long> captchaKeyExpiredMap = new HashMap<>(); + + public LocalCaptchaCacheProvider(){ + this.runClearDirtyCacheTask(); + } + + @Override + protected int loadDataToCache(Cache cache) { + return 0; + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_CAPTCHA; + } + + @Override + public Class<?> getProviderType() { + return String.class; + } + + @Override + public void putCacheData(String key, String data, long expiredSeconds){ + this.putCacheData(key, data); + this.captchaKeyExpiredMap.put(key, expiredSeconds); + } + + private void runClearDirtyCacheTask(){ + logger.info("鍚姩瀹氭椂浠诲姟锛屽畾鏈熸竻鐞嗚繃鏈熺殑鎺ㄩ�佷复鏃舵暟鎹紝浣嗘殏鏈疄鐜般��"); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/cache/LocalCategoryCacheProvider.java b/iplatform-base/src/main/java/com/iplatform/base/cache/LocalCategoryCacheProvider.java new file mode 100644 index 0000000..302adb0 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/cache/LocalCategoryCacheProvider.java @@ -0,0 +1,144 @@ +package com.iplatform.base.cache; + +import com.iplatform.base.CategoryCacheProvider; +import com.iplatform.base.Constants; +import com.iplatform.base.service.CategoryServiceImpl; +import com.iplatform.base.util.CategoryUtils; +import com.iplatform.base.util.cache.CategorySortComparator; +import com.iplatform.model.po.S_category; +import com.iplatform.model.vo.CategoryTreeVo; +import com.walker.cache.AbstractCacheProvider; +import com.walker.cache.Cachable; +import com.walker.cache.Cache; +import com.walker.infrastructure.utils.StringUtils; + +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +public class LocalCategoryCacheProvider extends AbstractCacheProvider<S_category> implements CategoryCacheProvider { + + private final CategorySortComparator sortComparator = new CategorySortComparator(); + + @Override + public List<CategoryTreeVo> getTree(Integer type, Integer status, String name, List<Integer> categoryIdList, int owner) { + List<S_category> allTree = new ArrayList<>(); + S_category tempCategory = null; + + for(Iterator<Cachable> it = this.getCache().getIterator(); it.hasNext();){ + tempCategory = (S_category) it.next().getValue(); +// if(owner != tempCategory.getOwner().intValue()){ +// continue; +// } +// if(type != null && type.intValue() != tempCategory.getType().intValue()){ +// continue; +// } +// if(status != null && status.intValue() != tempCategory.getStatus().intValue()){ +// continue; +// } +// if(!StringUtils.isEmptyList(categoryIdList) && !categoryIdList.contains(tempCategory.getId())){ +// logger.debug("涓嶅寘鍚湪缁欏畾鐨勯泦鍚堜腑'categoryIdList'"); +// continue; +// } + if(CategoryUtils.isCondition(tempCategory, type, status, name, categoryIdList, owner)){ + allTree.add(tempCategory); + } + } + + return CategoryUtils.acquireListTree(allTree, sortComparator); +// // 閲嶆柊鎺掑簭 +// Collections.sort(allTree, sortComparator); +// +// // +// List<CategoryTreeVo> treeList = new ArrayList<>(); +// if(allTree.size() == 0){ +// return treeList; +// } +// +// // +// for (S_category category : allTree) { +// treeList.add(CategoryUtils.toCategoryTreeVo(category)); +// } +// +// Map<Integer, CategoryTreeVo> map = new HashMap<>(treeList.size()); +// //ID 涓� key 瀛樺偍鍒癿ap 涓� +// for (CategoryTreeVo categoryTreeVo : treeList) { +// map.put(categoryTreeVo.getId(), categoryTreeVo); +// } +// +// List<CategoryTreeVo> list = new ArrayList<>(); +// CategoryTreeVo parentTree = null; +// for (CategoryTreeVo tree : treeList) { +// //瀛愰泦ID杩斿洖瀵硅薄锛屾湁鍒欐坊鍔犮�� +// parentTree = map.get(tree.getPid()); +// if (parentTree != null) { +// parentTree.getChild().add(tree); +// } else { +// list.add(tree); +// } +// } +// return list; + } + + @Override + public List<CategoryTreeVo> getListTree(Integer type, Integer status, String name, int owner) { + if(StringUtils.isNotEmpty(name)){ + try { + name = URLDecoder.decode(name, StringUtils.DEFAULT_CHARSET_UTF8); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + } + return getTree(type, status, name, null, owner); + } + + @Override + public S_category get(int id) { + return this.getCacheData(String.valueOf(id)); + } + + @Override + public void save(S_category category) { + this.putCacheData(String.valueOf(category.getId()), category); + } + + @Override + public void update(S_category category) { + this.updateCacheData(String.valueOf(category.getId()), category); + } + + @Override + public void remove(int id) { + this.removeCacheData(String.valueOf(id)); + } + + @Override + protected int loadDataToCache(Cache cache) { + List<S_category> data = this.categoryService.selectAll(new S_category()); + if(!StringUtils.isEmptyList(data)){ + for(S_category d : data){ + cache.put(String.valueOf(d.getId()), d); + } + return data.size(); + } + return 0; + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_CATEGORY; + } + + @Override + public Class<?> getProviderType() { + return S_category.class; + } + + public void setCategoryService(CategoryServiceImpl categoryService) { + this.categoryService = categoryService; + } + + private CategoryServiceImpl categoryService; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/cache/LocalDeptCacheProvider.java b/iplatform-base/src/main/java/com/iplatform/base/cache/LocalDeptCacheProvider.java new file mode 100644 index 0000000..8786533 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/cache/LocalDeptCacheProvider.java @@ -0,0 +1,146 @@ +package com.iplatform.base.cache; + +import com.iplatform.base.Constants; +import com.iplatform.base.DeptCacheProvider; +import com.iplatform.base.service.DeptServiceImpl; +import com.iplatform.base.util.DeptUtils; +import com.iplatform.model.po.S_dept; +import com.walker.cache.AbstractCacheProvider; +import com.walker.cache.Cache; +import com.walker.infrastructure.utils.StringUtils; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +/** + * 鍩轰簬鏈湴鍐呭瓨瀹炵幇鐨勬満鏋勭紦瀛樻彁渚涜�呫�� + * @author 鏃跺厠鑻� + * @date 2022-12-05 + */ +public class LocalDeptCacheProvider extends AbstractCacheProvider<S_dept> implements DeptCacheProvider { + + private DeptServiceImpl deptService; + + private Map<String, List<String>> deptChildrenIdList = new ConcurrentHashMap<>(); + + public void setDeptService(DeptServiceImpl deptService) { + this.deptService = deptService; + } + + @Override + public void setAllowCacheChildren(boolean allow) { + + } + + @Override + public S_dept getDept(long deptId) { + if(deptId == 0){ + return DeptUtils.SUPER_VISOR_DEPT; + } + return this.getCacheData(String.valueOf(deptId)); + } + + @Override + public void updateDept(S_dept s_dept) { + this.updateCacheData(String.valueOf(s_dept.getId()), s_dept); + } + + @Override + public void removeDept(long deptId) { + String key = String.valueOf(deptId); + String keyChildren = key + DeptUtils.KEY_CHILDREN_PREFIX; + S_dept current = this.getDept(deptId); + if(current == null){ + logger.warn("鏈烘瀯缂撳瓨宸蹭笉瀛樺湪锛屾棤闇�鍒犻櫎"); + return; + } + + // 鍒犻櫎璇ユ満鏋勫瓙鏈烘瀯缂撳瓨鍒楄〃 + this.removeCacheData(keyChildren); + this.removeCacheData(key); + + // 鏇存柊鐖舵満鏋勫搴旂殑childrenList +// String parentId = String.valueOf(current.getParent_id()); + List<String> parentChildrenList = this.getChildrenDeptIdOneLevel(current.getParent_id()); + if(parentChildrenList != null){ + parentChildrenList.remove(key); + // 鐢变簬鍦ㄥ唴瀛樹腑锛屾墍浠ヤ竴鏃﹀垹闄わ紝寮曠敤涔熷氨鍙樹簡銆�2022-12-03 +// this.deptChildrenIdList.put(parentId + DeptUtils.KEY_CHILDREN_PREFIX, parentChildrenList); + } + } + + @Override + public void putDept(S_dept s_dept) { + String id = String.valueOf(s_dept.getId()); + try{ + this.putCacheData(id, s_dept); + this.deptChildrenIdList.put(id + DeptUtils.KEY_CHILDREN_PREFIX, new ArrayList<>()); + + if(s_dept.getParent_id().longValue() == 0L){ + // 椤剁骇鍗曚綅锛屾病鏈夌埗鏈烘瀯浜� + logger.debug("椤剁骇鏈烘瀯锛屼笉鐢ㄦ洿鏂扮埗鏈烘瀯鍒楄〃, " + id); + return; + } + // 鏇存柊鐖舵満鏋勫垪琛� + List<String> parentChildrenList = this.getChildrenDeptIdOneLevel(s_dept.getParent_id()); + if(StringUtils.isEmptyList(parentChildrenList)){ + parentChildrenList = new ArrayList<>(); + } + parentChildrenList.add(id); + this.deptChildrenIdList.put(String.valueOf(s_dept.getParent_id()) + DeptUtils.KEY_CHILDREN_PREFIX, parentChildrenList); + + } catch (Exception e){ + throw new RuntimeException("娣诲姞 [鏈烘瀯] 缂撳瓨閿欒:" + e.getMessage(), e); + } + } + + @Override + public List<String> getChildrenDeptIdOneLevel(long deptId) { + String key = deptId + DeptUtils.KEY_CHILDREN_PREFIX; + List<String> childrenIdList = this.deptChildrenIdList.get(key); + if(childrenIdList == null){ + logger.error("鏈壘鍒扮紦瀛樹腑瀛愭満鏋勫垪琛�: " + key); + return null; + } + return childrenIdList; + } + + @Override + public List<S_dept> getChildrenDeptOneLevel(long deptId) { + List<String> childrenIdList = this.getChildrenDeptIdOneLevel(deptId); + if(StringUtils.isEmptyList(childrenIdList)){ + return null; + } + List<S_dept> resultList = new ArrayList<>(); + S_dept s_dept = null; + for(String id : childrenIdList){ + s_dept = this.getDept(Long.parseLong(id)); + resultList.add(s_dept); + } + return resultList; + } + + @Override + protected int loadDataToCache(Cache cache) { + List<S_dept> list = this.deptService.queryAllDeptListForCache(); + if(!StringUtils.isEmptyList(list)){ + for(S_dept h : list){ + this.putDept(h); + } + return list.size(); + } + return 0; + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_DEPT; + } + + @Override + public Class<?> getProviderType() { + return S_dept.class; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/cache/LocalHostCacheProvider.java b/iplatform-base/src/main/java/com/iplatform/base/cache/LocalHostCacheProvider.java new file mode 100644 index 0000000..1d10f03 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/cache/LocalHostCacheProvider.java @@ -0,0 +1,50 @@ +package com.iplatform.base.cache; + +import com.iplatform.base.Constants; +import com.iplatform.model.po.S_host; +import com.walker.cache.AbstractCacheProvider; +import com.walker.cache.Cache; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.jdbc.service.PubService; + +import java.util.List; + +/** + * 涓绘満璧勬簮缂撳瓨瀹氫箟锛堟湰鏈哄唴瀛樼紦瀛橈級瀹炵幇銆� + * @author 鏃跺厠鑻� + * @date 2022-09-20 + */ +public class LocalHostCacheProvider extends AbstractCacheProvider<S_host> { + + private PubService pubService; + + public void setPubService(PubService pubService) { + this.pubService = pubService; + } + + public LocalHostCacheProvider(){ + this.setLoadPage(false); + } + + @Override + protected int loadDataToCache(Cache cache) { + List<S_host> hosts = this.pubService.selectAll(new S_host()); + if(!StringUtils.isEmptyList(hosts)){ + for(S_host h : hosts){ + cache.put(String.valueOf(h.getId()), h); + } + return hosts.size(); + } + return 0; + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_HOST; + } + + @Override + public Class<?> getProviderType() { + return S_host.class; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/cache/LocalNotificationTemplateCache.java b/iplatform-base/src/main/java/com/iplatform/base/cache/LocalNotificationTemplateCache.java new file mode 100644 index 0000000..cf08854 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/cache/LocalNotificationTemplateCache.java @@ -0,0 +1,88 @@ +package com.iplatform.base.cache; + +import com.iplatform.base.Constants; +import com.iplatform.base.NotificationTemplateCache; +import com.iplatform.base.NotifyConstants; +import com.iplatform.base.service.NotificationServiceImpl; +import com.iplatform.model.po.SfNotification; +import com.iplatform.model.po.SfTemplateMessage; +import com.iplatform.model.vo.NotificationTemplateVo; +import com.walker.cache.AbstractCacheProvider; +import com.walker.cache.Cache; +import com.walker.infrastructure.utils.StringUtils; + +import java.util.List; +import java.util.Map; + +public class LocalNotificationTemplateCache extends AbstractCacheProvider<NotificationTemplateVo> implements NotificationTemplateCache { + + @Override + public NotificationTemplateVo get(String mark) { + return this.getCacheData(mark); + } + + @Override + public void save(NotificationTemplateVo category) { + this.putCacheData(category.getName(), category); + } + + @Override + public void update(NotificationTemplateVo category) { + this.updateCacheData(category.getName(), category); + } + + @Override + public void remove(String mark) { + this.removeCacheData(mark); + } + + @Override + protected int loadDataToCache(Cache cache) { + List<SfNotification> notificationList = this.notificationService.selectAll(new SfNotification()); + if(!StringUtils.isEmptyList(notificationList)){ + Map<Long, SfTemplateMessage> templateMessageMap = this.notificationService.queryTemplateIdMap(); + if(templateMessageMap.size() == 0){ + logger.warn("鎻愰啋妯℃澘鏈壘鍒颁换浣曟湁鏁堟暟鎹�"); + return 0; + } + for(SfNotification h : notificationList){ + NotificationTemplateVo vo = new NotificationTemplateVo(); + vo.setName(h.getMark()); + if(h.getIsWechat().intValue() == NotifyConstants.SWITCH_OPEN){ + vo.setWechat(true); + vo.setWechatId(h.getWechatId()); + vo.setWechatTempId(templateMessageMap.get(h.getWechatId().longValue()).getTempId()); + } + if(h.getIsRoutine().intValue() == NotifyConstants.SWITCH_OPEN){ + vo.setRoutine(true); + vo.setRoutineId(h.getRoutineId()); + vo.setRoutineTempId(templateMessageMap.get(h.getRoutineId().longValue()).getTempId()); + } + if(h.getIsSms().intValue() == NotifyConstants.SWITCH_OPEN){ + vo.setSms(true); + vo.setSmsId(h.getSmsId()); + vo.setSmsTempId(templateMessageMap.get(h.getSmsId().longValue()).getTempId()); + } + cache.put(h.getMark(), vo); + } + return notificationList.size(); + } + return 0; + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_NOTIFICATION_TEMPLATE; + } + + @Override + public Class<?> getProviderType() { + return NotificationTemplateVo.class; + } + + public void setNotificationService(NotificationServiceImpl notificationService) { + this.notificationService = notificationService; + } + + private NotificationServiceImpl notificationService; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/cache/LocalPushCacheProvider.java b/iplatform-base/src/main/java/com/iplatform/base/cache/LocalPushCacheProvider.java new file mode 100644 index 0000000..4475ce6 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/cache/LocalPushCacheProvider.java @@ -0,0 +1,43 @@ +package com.iplatform.base.cache; + +import com.iplatform.base.Constants; +import com.iplatform.base.PushCacheProvider; +import com.walker.cache.AbstractCacheProvider; +import com.walker.cache.Cache; + +public class LocalPushCacheProvider extends AbstractCacheProvider<String> implements PushCacheProvider { + + public LocalPushCacheProvider(){ + this.runClearDirtyCacheTask(); + } + + @Override + protected int loadDataToCache(Cache cache) { + // 鍒濆鍖栦笉闇�瑕佸姞杞芥暟鎹紝缂撳瓨涓暟鎹�2鍒嗛挓澶辨晥 + return 0; + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_PUSH; + } + + @Override + public Class<?> getProviderType() { + return String.class; + } + + @Override + public void put(String key, String value) { + this.putCacheData(key, value, 60); + } + + @Override + public String get(String key) { + return this.getCacheData(key); + } + + private void runClearDirtyCacheTask(){ + logger.info("鍚姩瀹氭椂浠诲姟锛屽畾鏈熸竻鐞嗚繃鏈熺殑鐢ㄦ埛鐧诲綍淇℃伅锛屼絾鏆傛湭瀹炵幇銆�"); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/cache/LocalSystemGroupCache.java b/iplatform-base/src/main/java/com/iplatform/base/cache/LocalSystemGroupCache.java new file mode 100644 index 0000000..884f427 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/cache/LocalSystemGroupCache.java @@ -0,0 +1,81 @@ +package com.iplatform.base.cache; + +import com.iplatform.base.Constants; +import com.iplatform.base.SystemGroupCache; +import com.iplatform.base.service.GroupServiceImpl; +import com.iplatform.model.po.S_group; +import com.iplatform.model.po.S_group_data; +import com.iplatform.model.vo.SystemGroupVo; +import com.walker.cache.AbstractCacheProvider; +import com.walker.cache.Cache; +import com.walker.infrastructure.utils.StringUtils; + +import java.util.ArrayList; +import java.util.List; + +public class LocalSystemGroupCache extends AbstractCacheProvider<SystemGroupVo> implements SystemGroupCache { + + @Override + public SystemGroupVo get(int id) { + return this.getCacheData(String.valueOf(id)); + } + + @Override + public void save(SystemGroupVo category) { + this.putCacheData(String.valueOf(category.getId()), category); + } + + @Override + public void update(SystemGroupVo category) { + this.updateCacheData(String.valueOf(category.getId()), category); + } + + @Override + public void remove(int id) { + this.removeCacheData(String.valueOf(id)); + } + + @Override + protected int loadDataToCache(Cache cache) { + List<S_group> hosts = this.groupService.selectAll(new S_group()); + if(!StringUtils.isEmptyList(hosts)){ + List<SystemGroupVo> groupVoList = new ArrayList<>(hosts.size()); + List<S_group_data> groupDataList = this.groupService.queryAllGroupDataList(); + for(S_group h : hosts){ + groupVoList.add(new SystemGroupVo(h)); + } + + if(!StringUtils.isEmptyList(groupDataList)){ + for(S_group_data data : groupDataList){ + for(SystemGroupVo vo : groupVoList){ + if(data.getGid().intValue() == vo.getId().intValue()){ + vo.addGroupData(data); + } + } + } + } + + for(SystemGroupVo h : groupVoList){ + cache.put(String.valueOf(h.getId()), h); + } + return hosts.size(); + } + return 0; + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_GROUP; + } + + @Override + public Class<?> getProviderType() { + return SystemGroupVo.class; + } + + public void setGroupService(GroupServiceImpl groupService) { + this.groupService = groupService; + } + + private GroupServiceImpl groupService; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/cache/LocalUserCacheProvider.java b/iplatform-base/src/main/java/com/iplatform/base/cache/LocalUserCacheProvider.java new file mode 100644 index 0000000..e87f566 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/cache/LocalUserCacheProvider.java @@ -0,0 +1,81 @@ +package com.iplatform.base.cache; + +import com.iplatform.base.Constants; +import com.iplatform.base.UserCacheProvider; +import com.iplatform.base.service.UserServiceImpl; +import com.iplatform.model.po.S_user_core; +import com.walker.cache.AbstractCacheProvider; +import com.walker.cache.Cache; +import com.walker.infrastructure.utils.StringUtils; + +import java.util.List; + +/** + * 鏈湴鐢ㄦ埛缂撳瓨瀹炵幇銆� + * @author 鏃跺厠鑻� + * @date 2022-11-06 + */ +public class LocalUserCacheProvider extends AbstractCacheProvider<S_user_core> implements UserCacheProvider { + + private UserServiceImpl userService = null; + + public void setUserService(UserServiceImpl userService) { + this.userService = userService; + } + + @Override + protected int loadDataToCache(Cache cache) { + List<S_user_core> hosts = this.userService.selectAll(new S_user_core()); + if(!StringUtils.isEmptyList(hosts)){ + for(S_user_core h : hosts){ + cache.put(String.valueOf(h.getId()), h); + } + return hosts.size(); + } + return 0; + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_USER; + } + + @Override + public Class<?> getProviderType() { + return S_user_core.class; + } + + @Override + public S_user_core getUserByLoginId(String loginId) { + S_user_core userCore = this.getCacheData(loginId); + if(userCore == null){ + userCore = this.userService.queryLoginUserOnly(loginId); + if(userCore == null){ + logger.warn("浠巗_user_core鏈煡璇㈠埌鐢ㄦ埛" + "锛屾棤娉曠紦瀛橈紝loginId = {}", loginId); + return null; + } + this.putCacheData(loginId, userCore); + } + return userCore; + } + + @Override + public S_user_core getUser(long userId) { + return this.getCacheData(String.valueOf(userId)); + } + + @Override + public void updateUser(S_user_core user_core) { + this.updateCacheData(String.valueOf(user_core.getId()), user_core); + } + + @Override + public void removeUser(long userId) { + this.removeCacheData(String.valueOf(userId)); + } + + @Override + public void putUser(S_user_core user_core) { + this.putCacheData(String.valueOf(user_core.getId()), user_core); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/cache/LocalUserLoginCache.java b/iplatform-base/src/main/java/com/iplatform/base/cache/LocalUserLoginCache.java new file mode 100644 index 0000000..081e343 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/cache/LocalUserLoginCache.java @@ -0,0 +1,46 @@ +package com.iplatform.base.cache; + +import com.iplatform.base.Constants; +import com.iplatform.base.UserLoginCache; +import com.iplatform.model.po.S_user_login; +import com.walker.cache.AbstractCacheProvider; +import com.walker.cache.Cache; + +public class LocalUserLoginCache extends AbstractCacheProvider<S_user_login> implements UserLoginCache { + + @Override + public S_user_login getUserLogin(String loginId) { + return this.getCacheData(loginId); + } + + @Override + public void updateUserLogin(S_user_login user_login) { + this.updateCacheData(user_login.getUser_name(), user_login); + } + + @Override + public void removeUserLogin(String loginId) { + this.removeCacheData(loginId); + } + + @Override + public void putUserLogin(S_user_login user_login) { + this.putCacheData(user_login.getUser_name(), user_login); + } + + @Override + protected int loadDataToCache(Cache cache) { + // 鏈湴缂撳瓨鎯呭喌涓嬶紝涓嶈�冭檻閲嶅惎鍚庡姞杞界紦瀛樸�� + return 0; + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_USER_LOGIN; + } + + @Override + public Class<?> getProviderType() { + return S_user_login.class; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/cache/LocalUserOnlineProvider.java b/iplatform-base/src/main/java/com/iplatform/base/cache/LocalUserOnlineProvider.java new file mode 100644 index 0000000..250528a --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/cache/LocalUserOnlineProvider.java @@ -0,0 +1,88 @@ +package com.iplatform.base.cache; + +import com.iplatform.base.Constants; +import com.iplatform.base.VariableConstants; +import com.iplatform.base.util.TokenUtils; +import com.walker.cache.AbstractCacheProvider; +import com.walker.cache.Cache; +import com.walker.web.UserOnlineProvider; +import com.walker.web.UserPrincipal; + +import java.util.HashMap; +import java.util.Map; + +/** + * 鍩轰簬鍐呭瓨瀹炵幇鐨勫湪绾跨敤鎴锋彁渚涜�呭疄鐜般�� + * @author 鏃跺厠鑻� + * @date 2022-11-01 + */ +public class LocalUserOnlineProvider extends AbstractCacheProvider<UserPrincipal<?>> implements UserOnlineProvider { + + // 瀛樺偍鐢ㄦ埛: key --> 鐧诲綍杩囨湡鏃堕棿 + private Map<String, Long> captchaKeyExpiredMap = new HashMap<>(); + + public LocalUserOnlineProvider(){ + this.runClearDirtyCacheTask(); + } + + @Override + protected int loadDataToCache(Cache cache) { + // 鍐呭瓨鏃犳硶鎸佷箙鍖栵紝鍥犳杩欓噷鏃犻渶鍚姩鏃跺姞杞藉凡鏈夌紦瀛� + return 0; + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_ONLINE_USER; + } + + @Override + public Class<?> getProviderType() { + return UserPrincipal.class; + } + + @Override + public UserPrincipal<?> getUserPrincipal(String token) { + UserPrincipal<?> userPrincipal = this.getCacheData(token); + if(userPrincipal == null){ + logger.warn("UserOnlineProvider 缂撳瓨鐢ㄦ埛涓嶅瓨鍦�, token = " + token); + } + return userPrincipal; + } + + @Deprecated + @Override + public boolean cacheUserPrincipal(String token, UserPrincipal<?> userPrincipal) { + logger.debug("鍐欏叆鐢ㄦ埛鐧诲綍缂撳瓨: " + token + ", " + userPrincipal.getUserName()); + this.putCacheData(token, userPrincipal, TokenUtils.acquireCacheUserExpiredSeconds(VariableConstants.DEFAULT_TOKEN_EXPIRED_MINUTES)); + return true; + } + + @Override + public boolean cacheUserPrincipal(String token, UserPrincipal<?> userPrincipal, long expiredMintues) { + this.putCacheData(token, userPrincipal, TokenUtils.acquireCacheUserExpiredSeconds(expiredMintues)); + return true; + } + + @Override + public boolean updateUserPrincipalTimeStamp(String token) { + return false; + } + + @Override + public boolean removeUserPrincipal(String token) { + this.removeCacheData(token); + this.captchaKeyExpiredMap.remove(token); + return true; + } + + @Override + public void putCacheData(String key, UserPrincipal<?> userPrincipal, long expiredSeconds){ + this.putCacheData(key, userPrincipal); + this.captchaKeyExpiredMap.put(key, expiredSeconds); + } + + private void runClearDirtyCacheTask(){ + logger.info("鍚姩瀹氭椂浠诲姟锛屽畾鏈熸竻鐞嗚繃鏈熺殑鐢ㄦ埛鐧诲綍淇℃伅锛屼絾鏆傛湭瀹炵幇銆�"); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/cache/LocalWechatCache.java b/iplatform-base/src/main/java/com/iplatform/base/cache/LocalWechatCache.java new file mode 100644 index 0000000..887aea2 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/cache/LocalWechatCache.java @@ -0,0 +1,63 @@ +package com.iplatform.base.cache; + +import com.iplatform.base.Constants; +import com.iplatform.base.WechatCacheProvider; +import com.iplatform.base.WechatConstants; +import com.walker.cache.AbstractCacheProvider; +import com.walker.cache.Cache; + +public class LocalWechatCache extends AbstractCacheProvider<String> implements WechatCacheProvider { + + @Override + public String getMiniAccessToken() { + return this.getCacheData(WechatConstants.REDIS_WECAHT_MINI_ACCESS_TOKEN_KEY); + } + + @Override + public String getJsApiTicket() { + return this.getCacheData(WechatConstants.REDIS_PUBLIC_JS_API_TICKET); + } + + @Override + public String getPublicAccessToken() { +// throw new UnsupportedOperationException("璇蜂娇鐢≧edis瀹炵幇"); + return this.getCacheData(WechatConstants.REDIS_WECAHT_PUBLIC_ACCESS_TOKEN_KEY); + } + + @Override + public void putPublicAccessToken(String value, long expiredSeconds) { +// throw new UnsupportedOperationException("璇蜂娇鐢≧edis瀹炵幇"); + this.putCacheData(WechatConstants.REDIS_WECAHT_PUBLIC_ACCESS_TOKEN_KEY, value, expiredSeconds); + } + + @Override + public void putJsApiTicket(String value) { +// throw new UnsupportedOperationException("璇蜂娇鐢≧edis瀹炵幇"); + this.putCacheData(WechatConstants.REDIS_PUBLIC_JS_API_TICKET, value, WechatConstants.REDIS_PUBLIC_JS_API_TICKET_EXPRESS); + } + + @Override + public void putMiniAccessToken(String value, long expiredSeconds) { + this.putCacheData(WechatConstants.REDIS_WECAHT_MINI_ACCESS_TOKEN_KEY, value, expiredSeconds); + } + + @Override + public void removeMiniAccessToken() { + this.removeCacheData(WechatConstants.REDIS_WECAHT_MINI_ACCESS_TOKEN_KEY); + } + + @Override + protected int loadDataToCache(Cache cache) { + return 0; + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_WECHAT; + } + + @Override + public Class<?> getProviderType() { + return String.class; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/cache/MenuCacheProvider.java b/iplatform-base/src/main/java/com/iplatform/base/cache/MenuCacheProvider.java new file mode 100644 index 0000000..b6eb6d4 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/cache/MenuCacheProvider.java @@ -0,0 +1,597 @@ +package com.iplatform.base.cache; + +import com.iplatform.base.Constants; +import com.iplatform.base.SecurityConstants; +import com.iplatform.base.service.MenuServiceImpl; +import com.iplatform.base.util.MenuUtils; +import com.iplatform.base.util.menu.SystemMenu; +import com.iplatform.model.po.S_menu; +import com.iplatform.model.vo.MetaVo; +import com.iplatform.model.vo.RouterVo; +import com.walker.cache.AbstractCacheProvider; +import com.walker.cache.Cachable; +import com.walker.cache.Cache; +import com.walker.infrastructure.utils.StringUtils; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * 鑿滃崟鏈湴缂撳瓨锛屽洜涓轰笉闇�瑕侀泦缇ょ幆澧冿紝鍥犳鍙湁鍐呭瓨妯″紡(娌℃湁redis鏂瑰紡) + * @author 鏃跺厠鑻� + * @date 2022-11-01 + * @date 2024-04-09 澧炲姞淇敼鏃堕棿鎴筹紝鍦ㄩ泦缇ょ幆澧冧腑鑳借鍔ㄨЕ鍙戦噸鏂板姞杞芥湰鏈鸿妭鐐广�� + */ +public class MenuCacheProvider extends AbstractCacheProvider<S_menu> { +//public class MenuCacheProvider extends RedisCacheProvider<S_menu> { + +/* public MenuCacheProvider(){ + this.setUseRedis(true); + this.setLoadPage(false); + // 缂撳瓨鍙睍绀烘渶澶у�硷紝瓒呰繃璇ュ�艰皟鐢╣etIterator浼氭姤閿� + CacheConfig.setInitCachemapSize(20480); + }*/ + + private MenuServiceImpl menuService; + + public void setMenuService(MenuServiceImpl menuService) { + this.menuService = menuService; + } + + @Override + protected int loadDataToCache(Cache cache) { + List<S_menu> list = this.menuService.selectAll(new S_menu()); + if(!StringUtils.isEmptyList(list)){ + for(S_menu h : list){ + cache.put(h.getMenu_id(), h); + } + // 姣忔鍚姩锛岃褰曞綋鍓嶅姞杞芥暟鎹椂闂存埑 + this.reloadMills = System.currentTimeMillis(); + return list.size(); + } + return 0; + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_MENU; + } + + @Override + public Class<?> getProviderType() { + return S_menu.class; + } + + /** + * 缁欏畾鐨勮彍鍗曪紝鏄惁鍖呭惈瀛愯彍鍗曘�� + * @param menuId 缁欏畾鑿滃崟ID + * @return + * @date 2022-12-29 + */ + public boolean isHasChildren(String menuId){ + List<S_menu> menuAll = this.getCacheMenuList(true, MenuUtils.MENU_SCOPE_PLATFORM); + for(S_menu menu : menuAll){ + if(menu.getParent_id().equals(menuId)){ + return true; + } + } + return false; + } + + /** + * 杩斿洖鑿滃崟闆嗗悎鍒楄〃(涓嶆槸鏍戠粨鏋�)锛岀洰鍓嶈鏂规硶鍦ㄤ唬鐮佺敓鎴愬姛鑳戒腑浣跨敤锛屽睍绀洪�夋嫨鐢熸垚鍦ㄥ摢涓彍鍗曟ā鍧椼�� + * @param roleIdList + * @param menuScope 鑿滃崟鑼冨洿锛�0 骞冲彴锛堢洰鍓嶄篃鏈�3锛夛紝4 鐙珛鍗曚綅锛� -1 琛ㄧず鏄剧ず鎵�鏈夎彍鍗曪紝>4 琛ㄧず鏈烘瀯鐗瑰畾鑿滃崟锛屽鐝富浠昏彍鍗曘�� + * @return + * @date 2022-11-27 + * @date 2023-06-05 娣诲姞鍙傛暟 menuScope + * @date 2023-10-11 menuScope 鍙傛暟澧炲姞鍊硷紙-1锛夊彲浠ュ睍绀烘墍鏈夎彍鍗曪紝閭斂闆嗗洟妯″紡 + * @date 2023-10-24 menuScope 鍙傛暟澧炲姞鍊硷紙澶т簬4锛夛紝琛ㄧず鐗瑰畾浜哄憳鐨勭壒瀹氳彍鍗曪紙濡傦細鐝富浠荤殑鑿滃崟锛� + */ + public List<SystemMenu> getMenuList(List<String> roleIdList, int menuScope){ + if(StringUtils.isEmptyList(roleIdList)){ + // 娌℃湁缁欏畾瑙掕壊闆嗗悎锛岃鏄庢槸绠$悊鍛橈紝鏄剧ず鎵�鏈夎彍鍗曟暟鎹� + return this.toSystemMenuList(this.getCacheMenuList(true, menuScope)); + } + + // 2024-04-09 + this.checkReloadForceLocalMemory(); + + // 鏍规嵁瑙掕壊鏉冮檺鍔犺浇涓嶅悓鑿滃崟闆嗗悎 + List<SystemMenu> menuList = new ArrayList<>(32); + List<String> menuIdList = this.menuService.queryRoleMenuIdList(roleIdList); + if(StringUtils.isEmptyList(menuIdList)){ + logger.warn("鐢ㄦ埛娌℃湁浠讳綍鏉冮檺锛宮enuIdList = null, roleIdList = {}", roleIdList); + return menuList; + } + + S_menu menu = null; + for(String menuId : menuIdList){ + menu = this.getCacheData(menuId); + // 2023-10-11 澧炲姞杩欎釜if鍒ゆ柇锛屽鏋滄槸涓嶅尯鍒嗚寖鍥达紝鍒欏姞杞芥墍鏈夎彍鍗� +// if(menuScope != MenuUtils.MENU_SCOPE_ALL){ +// if(menuScope == MenuUtils.MENU_SCOPE_PLATFORM){ +// // 濡傛灉瑕佸睍绀鸿彍鍗曡寖鍥存槸锛氬钩鍙帮紝鍒欒彍鍗曚腑 >= 4鐨勫垎绫婚兘涓嶈锛岃繖浜涙槸椤剁骇鏈烘瀯涓氬姟鐙珛鑿滃崟銆� +// if(menu.getType().intValue() >= MenuUtils.MENU_SCOPE_ORG){ +// continue; +// } +// } else if(menuScope == MenuUtils.MENU_SCOPE_ORG){ +//// if(menu.getType().intValue() < MenuUtils.MENU_SCOPE_ORG){ +// if(menu.getType().intValue() != MenuUtils.MENU_SCOPE_ORG){ +// // 濡傛灉瑕佸睍绀鸿彍鍗曡寖鍥存槸锛氶《绾ф満鏋勪笟鍔$殑鐙珛鑿滃崟锛屽垯骞冲彴鑿滃崟涓嶆樉绀恒��2023-06-01 +// continue; +// } +// } else if(menuScope > MenuUtils.MENU_SCOPE_ORG){ +// // 瀵逛簬澶т簬鏈烘瀯鑿滃崟鐨勶紝閮藉睘浜庢満鏋勭壒瀹氳彍鍗曪紝蹇呴』涓庝紶鍏ヨ寖鍥村畬鍏ㄤ竴鑷达紝濡傦細鐝富浠昏彍鍗曠瓑銆�2023-10-24 +// if(menu.getType().intValue() != menuScope){ +// continue; +// } +// } +// } + if(MenuUtils.menuScopeNotMatch(menuScope, menu)){ + continue; + } + menuList.add(new SystemMenu(menu)); + } + + // 2023-10-13锛屾煡鎵炬瘡涓彍鍗曚笂绾э紝濡傛灉涓婄骇鑼冨洿绫诲瀷涓庝笅绾ц彍鍗曚笉涓�鑷达紝涔熼渶瑕佸姞鍏ュ垪琛ㄤ腑 + for(String menuId : menuIdList){ + if(MenuUtils.containMenu(menuList, menuId)){ + continue; + } + menu = this.getCacheData(menuId); + menuList.add(new SystemMenu(menu)); + } +// if(!StringUtils.isEmptyList(menuList)){ +// String pid = null; +// for(SystemMenu systemMenu : menuList){ +// pid = systemMenu.getParent_id(); +// if(pid.equals(MenuUtils.MENU_ID_ROOT)){ +// continue; +// } +// if(menuIdList.contains(pid)){ +// this.addParentMenu2Collection(menuList, pid); +// } +// } +// } + +// Collections.sort(menuList, new ParentMenuComparator()); +// Collections.sort(menuList, new MenuOrderNumComparator()); +// Collections.sort(menuList); + List<SystemMenu> collect = menuList.stream().sorted(Comparator.comparing(SystemMenu::getParent_id).thenComparing(SystemMenu::getOrder_num,Comparator.reverseOrder())).collect(Collectors.toList()); + logger.info("+++++++++++++++++++++"); + return collect; + } + +// private List<SystemMenu> addParentMenu2Collection(List<SystemMenu> menuList, String menuId){ +// List<SystemMenu> addList = null; +// boolean exist = false; +// for(SystemMenu menu : menuList){ +// if(menu.getMenu_id().equals(menuId)){ +// exist = true; +// break; +// } +// } +// if(!exist){ +// S_menu menu = this.getCacheData(menuId); +// if(addList == null){ +// addList = new ArrayList<>(8); +// } +// addList.add(new SystemMenu(menu)); +// } +// return addList; +// } + + public List<SystemMenu> toSystemMenuList(List<S_menu> srcMenuList){ + List<SystemMenu> list = new ArrayList<>(32); + if(StringUtils.isEmptyList(srcMenuList)){ + return list; + } + for(S_menu menu : srcMenuList){ + list.add(new SystemMenu(menu)); + } + return list; + } + + /** + * 鑾峰緱缂撳瓨鑿滃崟鍒楄〃 + * @param containButton 鏄惁鍖呭惈鎸夐挳鏉冮檺鑿滃崟 + * @param menuScope 鑿滃崟鑼冨洿锛屽鐙珛椤剁骇鏈烘瀯锛屽彲浠ユ樉绀烘満鏋勮缃殑鍒嗙被鑿滃崟鑼冨洿锛岀洰鍓嶆湁锛�0-骞冲彴锛堝寘鍚�3锛夛紝4-椤剁骇鍗曚綅鐙珛鑿滃崟 + * @return + * @date 2023-06-01 + */ + public List<S_menu> getCacheMenuList(boolean containButton, int menuScope){ + + // 2024-04-09 + this.checkReloadForceLocalMemory(); + + List<S_menu> data = new ArrayList<>(); + S_menu menu = null; + for(Iterator<Cachable> it = this.getCache().getIterator(); it.hasNext();){ + menu = (S_menu) it.next().getValue(); + + // 2023-10-24 + if(MenuUtils.menuScopeNotMatch(menuScope, menu)){ + continue; + } + + if(menu.getStatus().intValue() == MenuUtils.MENU_STATUS_DISABLED){ + // 鍘绘帀绂佺敤鑿滃崟 + continue; + } + if(menu.getMenu_type().equals(MenuUtils.MENU_TYPE_BUTTON)){ + if(containButton){ + data.add(menu); + } + } else { + data.add(menu); + } + } + // TODO 鍓嶇鎶ラ敊 鏆傛椂娉ㄩ噴 +// Collections.sort(data, new ParentMenuComparator()); +// Collections.sort(data, new MenuOrderNumComparator()); +// Collections.sort(data); + List<S_menu> dataOrder = data.stream().sorted(Comparator.comparing(S_menu::getParent_id).thenComparing(S_menu::getOrder_num,Comparator.reverseOrder())).collect(Collectors.toList()); + + return dataOrder; + } + + /** + * 鏍规嵁鐖惰妭鐐圭殑ID鑾峰彇鎵�鏈夊瓙鑺傜偣 + * + * @param list 鍒嗙被琛� + * @param parentId 浼犲叆鐨勭埗鑺傜偣ID + * @return String + */ + public List<SystemMenu> getChildPerms(List<SystemMenu> list, String parentId) { + List<SystemMenu> returnList = new ArrayList<>(); + for (Iterator<SystemMenu> iterator = list.iterator(); iterator.hasNext();) { + SystemMenu t = iterator.next(); + // 涓�銆佹牴鎹紶鍏ョ殑鏌愪釜鐖惰妭鐐笽D,閬嶅巻璇ョ埗鑺傜偣鐨勬墍鏈夊瓙鑺傜偣 + if (t.getParent_id().equals(parentId)) { + recursionFn(list, t); + returnList.add(t); + } + } + return returnList; + } + + /** + * 閫掑綊鍒楄〃 + * + * @param list + * @param t + */ + private void recursionFn(List<SystemMenu> list, SystemMenu t) { + // 寰楀埌瀛愯妭鐐瑰垪琛� + List<SystemMenu> childList = getChildList(list, t); + t.setChildren(childList); + for (SystemMenu tChild : childList) { + if (hasChild(list, tChild)) { + recursionFn(list, tChild); + } + } + } + + /** + * 寰楀埌瀛愯妭鐐瑰垪琛� + */ + private List<SystemMenu> getChildList(List<SystemMenu> list, SystemMenu t) { + List<SystemMenu> tlist = new ArrayList<>(); + Iterator<SystemMenu> it = list.iterator(); + while (it.hasNext()) { + SystemMenu n = it.next(); + if (n.getParent_id().equals(t.getMenu_id())) { + tlist.add(n); + } + } + return tlist; + } + + /** + * 鍒ゆ柇鏄惁鏈夊瓙鑺傜偣 + */ + private boolean hasChild(List<SystemMenu> list, SystemMenu t) { + return getChildList(list, t).size() > 0; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + //~ 浠ヤ笅涓虹敤鎴风櫥褰曡彍鍗曞睍绀轰娇鐢紝2022-11-12 + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + /** + * 杩斿洖鑿滃崟鏉冮檺鏍囪瘑瀛楃涓查泦鍚堬紝璇ユ柟娉曡嫢渚濆墠绔娇鐢ㄣ��<p></p> + * 鍚庣画浼氬幓鎺夊墠绔鏉冮檺鐐圭殑渚濊禆銆� + * @param menuIdList + * @param showAll 鏄惁鏄剧ず鎵�鏈夋潈闄愮偣 + * @param menuScope 鑿滃崟鑼冨洿锛屽鐙珛椤剁骇鏈烘瀯锛屽彲浠ユ樉绀烘満鏋勮缃殑鍒嗙被鑿滃崟鑼冨洿锛岀洰鍓嶆湁锛�0-骞冲彴锛堝寘鍚�3锛夛紝4-椤剁骇鍗曚綅鐙珛鑿滃崟 + * @return + * @date 2022-11-12 + * @date 2023-03-20 濡傛灉缁欏畾鑿滃崟id涓虹┖锛屽垯涓嶈繑鍥炰换浣曟潈闄愮偣淇℃伅銆傛椂鍏嬭嫳 + * @date 2023-06-07 瀵逛簬鐙珛鍗曚綅锛堝晢鎴凤級鍒欎細鏄剧ず鎵�鏈夎鍗曚綅鐨勮彍鍗曟潈闄愪俊鎭� + */ + public Set<String> getPermissionSet(List<String> menuIdList, boolean showAll, int menuScope){ + + // 2024-04-09 + this.checkReloadForceLocalMemory(); + + if(StringUtils.isEmptyList(menuIdList) && !showAll){ + return new HashSet<>(); + } + List<String> permsList = new ArrayList<>(64); +// List<S_menu> menuAll = this.getCacheMenuList(true, MenuUtils.MENU_SCOPE_PLATFORM); + List<S_menu> menuAll = this.getCacheMenuList(true, menuScope); + if(!StringUtils.isEmptyList(menuAll)){ + for(S_menu menu : menuAll){ + + // 2023-10-11 澧炲姞杩欎釜if鍒ゆ柇锛屽鏋滄槸涓嶅尯鍒嗚寖鍥达紝鍒欏姞杞芥墍鏈夎彍鍗� +// if(menuScope != MenuUtils.MENU_SCOPE_ALL){ +// +// // 2023-06-07 +// if(menuScope == MenuUtils.MENU_SCOPE_PLATFORM){ +// // 濡傛灉瑕佸睍绀鸿彍鍗曡寖鍥存槸锛氬钩鍙帮紝鍒欒彍鍗曚腑 >= 4鐨勫垎绫婚兘涓嶈锛岃繖浜涙槸椤剁骇鏈烘瀯涓氬姟鐙珛鑿滃崟銆� +// if(menu.getType().intValue() >= MenuUtils.MENU_SCOPE_ORG){ +// continue; +// } +// } else if(menu.getType().intValue() < MenuUtils.MENU_SCOPE_ORG){ +// // 濡傛灉瑕佸睍绀鸿彍鍗曡寖鍥存槸锛氶《绾ф満鏋勪笟鍔$殑鐙珛鑿滃崟锛屽垯骞冲彴鑿滃崟涓嶆樉绀恒��2023-06-01 +// continue; +// } +// } + // 2023-10-24 + if(MenuUtils.menuScopeNotMatch(menuScope, menu)){ + continue; + } + + if(StringUtils.isEmpty(menu.getPerms())){ + continue; + } + if(StringUtils.isEmptyList(menuIdList)){ + // 濡傛灉娌℃湁闄愬埗锛屽叏閮ㄥ姞涓� + permsList.add(menu.getPerms()); + } else if(menuIdList.contains(menu.getMenu_id())){ + // 濡傛灉闄愬埗鏈夛紝鍒欏彧娣诲姞缁欏畾鐨� + permsList.add(menu.getPerms()); + } + } + } + + Set<String> permsSet = new HashSet<>(); + for(String perms : permsList){ + if (StringUtils.isNotEmpty(perms)) { + permsSet.addAll(Arrays.asList(perms.trim().split(","))); + } + } + return permsSet; + } + + /** + * 杩斿洖鑿滃崟鏍戝舰缁撴灉锛屽垪琛ㄤ腑鍖呭惈澶氫釜鑿滃崟鏍硅妭鐐癸紝menuIdList 涓虹┖鏃讹紝鍏佽杩斿洖鎵�鏈夌殑銆� + * @param menuIdList + * @param containButton + * @return + * @date 2023-03-22 + */ + public List<SystemMenu> getMenuTreeAll(List<String> menuIdList, boolean containButton, int menuScope){ + return this.getMenuTree(menuIdList, containButton, true, menuScope); + } + + /** + * 杩斿洖鑿滃崟鏍戝舰缁撴灉锛屽垪琛ㄤ腑鍖呭惈澶氫釜鑿滃崟鏍硅妭鐐广�� + * @param menuIdList 鎸囧畾鏄剧ず鐨勮彍鍗曪紝濡傛灉涓虹┖琛ㄧず涓嶇壒鍒檺鍒� + * @param containButton 鏄惁鍖呭惈鎸夐挳鏉冮檺 + * @param showAll 褰撶粰瀹�'menuIdList'涓虹┖鏃讹紝鏄惁鏄剧ず鎵�鏈夎彍鍗� + * @return + * @date 2022-12-18 鏇存柊 + * @date 2023-03-22 娣诲姞鍙傛暟'showAll' + */ + public List<SystemMenu> getMenuTree(List<String> menuIdList, boolean containButton, boolean showAll, int menuScope){ + List<SystemMenu> menuGroupList = new ArrayList<>(32); + if(StringUtils.isEmptyList(menuIdList) && !showAll){ + // 2023-03-22 缁欏畾涓虹┖鑿滃崟id锛屽苟涓斾笉鍏佽鏄剧ず鎵�鏈夛紝杩斿洖绌鸿彍鍗曟爲銆� + return getChildPerms(menuGroupList, "0"); + } +// List<S_menu> menuAll = this.getCacheMenuList(false); + List<S_menu> menuAll = this.getCacheMenuList(containButton, menuScope); + if(!StringUtils.isEmptyList(menuAll)){ + for(S_menu menu : menuAll){ + if(menuIdList == null){ + // 濡傛灉娌℃湁闄愬埗锛屽叏閮ㄥ姞涓� + menuGroupList.add(new SystemMenu(menu)); + } else if(menuIdList.contains(menu.getMenu_id())){ + // 濡傛灉闄愬埗鏈夛紝鍒欏彧娣诲姞缁欏畾鐨� + menuGroupList.add(new SystemMenu(menu)); + } + } + } + List<SystemMenu> menuGroupListOrder = menuGroupList.stream().sorted(Comparator.comparing(SystemMenu::getParent_id).thenComparing(SystemMenu::getOrder_num,Comparator.reverseOrder())).collect(Collectors.toList()); + return getChildPerms(menuGroupListOrder, "0"); + } + + + /** + * 鏋勫缓鍓嶇璺敱鎵�闇�瑕佺殑鑿滃崟锛堣嫢渚濓級 + * + * @param menus 鑿滃崟鍒楄〃 + * @return 璺敱鍒楄〃 + */ + @Deprecated + public List<RouterVo> buildMenus(List<SystemMenu> menus) { + List<RouterVo> routers = new LinkedList<RouterVo>(); + for (SystemMenu menu : menus) { + RouterVo router = new RouterVo(); + router.setHidden(MenuUtils.MENU_INVISIBLE.equals(menu.getVisible())); + router.setName(MenuUtils.getRouteName(menu)); + router.setPath(MenuUtils.getRouterPath(menu)); + router.setComponent(MenuUtils.getComponent(menu)); + router.setQuery(menu.getQuery()); + router.setMeta(new MetaVo(menu.getMenu_name(), menu.getIcon(), menu.getIs_cache().intValue() == MenuUtils.MENU_CACHE_DISABLE, menu.getPath())); + List<SystemMenu> cMenus = menu.getChildren(); + if (!cMenus.isEmpty() && cMenus.size() > 0 && menu.getMenu_type().equals(MenuUtils.MENU_TYPE_FOLDER)) { + router.setAlwaysShow(true); + router.setRedirect("noRedirect"); + router.setChildren(buildMenus(cMenus)); + } + else if (MenuUtils.isMenuFrame(menu)) { + router.setMeta(null); + List<RouterVo> childrenList = new ArrayList<RouterVo>(); + RouterVo children = new RouterVo(); + children.setPath(menu.getPath()); + children.setComponent(menu.getComponent()); + children.setName(StringUtils.capitalize(menu.getPath())); + children.setMeta(new MetaVo(menu.getMenu_name(), menu.getIcon(), menu.getIs_cache().intValue() == MenuUtils.MENU_CACHE_DISABLE, menu.getPath())); + children.setQuery(menu.getQuery()); + childrenList.add(children); + router.setChildren(childrenList); + } + else if (menu.getParent_id().equals(MenuUtils.MENU_ID_ROOT) && MenuUtils.isInnerLink(menu)) { + router.setMeta(new MetaVo(menu.getMenu_name(), menu.getIcon())); + router.setPath("/"); + List<RouterVo> childrenList = new ArrayList<RouterVo>(); + RouterVo children = new RouterVo(); + String routerPath = MenuUtils.innerLinkReplaceEach(menu.getPath()); + children.setPath(routerPath); + children.setComponent(MenuUtils.INNER_LINK); + children.setName(StringUtils.capitalize(routerPath)); + children.setMeta(new MetaVo(menu.getMenu_name(), menu.getIcon(), menu.getPath())); + childrenList.add(children); + router.setChildren(childrenList); + } + routers.add(router); + } + return routers; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + //~ 浠ヤ笅涓虹郴缁熸潈闄愮鐞嗕娇鐢紝2022-11-02 + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + /** + * 杩斿洖绯荤粺鎵�鏈夎鑹蹭笌url鍏宠仈鏁版嵁锛宻ecurity鏉冮檺閰嶇疆瀹炵敤銆�<p></p> + * 璇ユ柟娉曚細鏈夐噸澶嶆暟鎹紝渚嬪:澶氫釜瑙掕壊鍏锋湁鐩稿悓鐨刄RL锛岀敱涓氬姟鍘婚櫎閲嶅銆�<p></p> + * list[0] = role_id, list[1] = url <p></p> + * 鍥犱负Map瀵硅薄鐩稿悓key浼氳鐩杤alue锛屾墍浠ユ崲鎴怢ist闆嗗悎杩斿洖銆� + * @return + * @date 2022-11-02 + */ + public List<String[]> getAllRoleMenuMap(){ + List<String[]> result = new ArrayList<>(); + List<Map<String, Object>> list = this.menuService.queryRolesPermList(); + if(StringUtils.isEmptyList(list)){ + return result; + } + + String perms = null; + String menuId = null; + S_menu menu = null; + + for(Map<String, Object> map : list){ + menuId = map.get("menu_id").toString(); + menu = this.getCacheData(menuId); + if(menu == null){ + throw new IllegalArgumentException("缂撳瓨涓湭鎵惧埌鑿滃崟:" + menuId); + } + perms = menu.getPerms(); + if(StringUtils.isEmpty(perms)){ + continue; + } +// result.put(map.get("role_id").toString(), MenuUtils.acquireUrlFromPerms(perms)); + result.add(new String[]{map.get("role_id").toString(), MenuUtils.acquireUrlFromPerms(perms)}); + } + + // 2023-06-07 + // 鍟嗘埛锛堥《绾ф満鏋勶級鐗规湁鐨勮彍鍗曪紝涔熼渶瑕佸姞鍏ュ埌瑙掕壊涓紝璁剧疆榛樿涓夋柟瑙掕壊锛歊OLE_MERCHANT + Set<String> merchantPermSet = this.getPermissionSet(null, true, MenuUtils.MENU_SCOPE_ORG); + if(merchantPermSet != null){ + for(String onePerms : merchantPermSet){ + result.add(new String[]{SecurityConstants.ROLE_MERCHANT, MenuUtils.acquireUrlFromPerms(onePerms)}); + } + logger.debug("娣诲姞鍟嗘埛锛堥《绾ф満鏋勶級瑙掕壊鏉冮檺锛歿}", merchantPermSet.size()); + } + return result; + } + + /** + * 杩斿洖绯荤粺鎵�鏈夎彍鍗曞寘鍚潈闄愮殑url闆嗗悎锛屽嵆:鎵�鏈塸erms瀛樺湪鐨勮彍鍗曘�� + * @return + * @date 2022-11-02 + */ + public List<String> getAllMenuUrlList(){ + // 2024-04-09 + this.checkReloadForceLocalMemory(); + + List<String> urlList = new ArrayList<>(32); + S_menu menu = null; + String perms = null; + for(Iterator<Cachable> it = this.getCache().getIterator(); it.hasNext();){ + menu = (S_menu) it.next().getValue(); + perms = menu.getPerms(); + if(StringUtils.isEmpty(perms)){ + continue; + } + urlList.add(MenuUtils.acquireUrlFromPerms(perms)); + } + return urlList; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + //~ 蹇呴』閲嶅啓鍐欏叆銆佹洿鏂版柟娉曪紝浠ヨЕ鍙戝啓鍏ユ洿鏂版椂闂存埑銆�2024-04-09 + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + @Override + public void putCacheData(String key, S_menu s_menu){ + super.putCacheData(key, s_menu); + this.menuUpdateCache.triggerTimeUpdate(); + } + + @Override + public void updateCacheData(String key, S_menu s_menu){ + super.updateCacheData(key, s_menu); + this.menuUpdateCache.triggerTimeUpdate(); + } + + /** + * <pre> + * 1) 浠庢洿鏂扮紦瀛樹腑锛屾壘鍑烘洿鏂版椂闂达紱 + * 2) 濡傛灉涓嶅瓨鍦ㄥ垯涓嶆洿鏂帮紝濡傛灉瀛樺湪姣旇緝褰撳墠鍔犺浇鏃堕棿锛屽ぇ浜庡垵濮嬪姞杞芥椂闂村垯鏇存柊 + * </pre> + * @date 2024-04-09 + */ + private void checkReloadForceLocalMemory(){ + try{ + Long timeStamp = this.menuUpdateCache.getTimeUpdate(); + if(timeStamp == null){ + return; + } + + if(timeStamp.longValue() > this.reloadMills){ + synchronized (this._lock){ + logger.info("褰撳墠鑺傜偣锛岃彍鍗曠紦瀛樺瓨鍦ㄦ洿鏂版椂闂达細{}锛岄渶瑕侀噸鏂板姞杞�...", timeStamp); + this.reload(); + logger.debug("this.reloadMills = {}", this.reloadMills); + } + } + + } catch (Exception ex){ + logger.error("鑾峰彇鑿滃崟鏇存柊鏃堕棿缂撳瓨寮傚父锛岃幏鍙栦笉鍒版椂闂达紝涓嶉噸鏂板姞杞斤細" + ex.getMessage(), ex); + return; + } + } + + public void setMenuUpdateCache(RedisMenuUpdateCache menuUpdateCache) { + this.menuUpdateCache = menuUpdateCache; + } + + private long reloadMills = 0; // 缂撳瓨閲嶆柊鍔犺浇鐨勬椂闂达紙姣鍊硷級 + private final Object _lock = new Object(); + + private RedisMenuUpdateCache menuUpdateCache; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/cache/RedisCaptchaCacheProvider.java b/iplatform-base/src/main/java/com/iplatform/base/cache/RedisCaptchaCacheProvider.java new file mode 100644 index 0000000..31eccbe --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/cache/RedisCaptchaCacheProvider.java @@ -0,0 +1,35 @@ +package com.iplatform.base.cache; + +import com.iplatform.base.Constants; +import com.walker.cache.Cache; +import com.walker.support.redis.cache.RedisCacheProvider; + +/** + * 楠岃瘉鐮�(Redis)缂撳瓨瀹炵幇銆� + * @date 2022-11-07 + */ +public class RedisCaptchaCacheProvider extends RedisCacheProvider<String> { + + public RedisCaptchaCacheProvider(){ + this.setUseRedis(true); + this.setLoadPage(false); + // 2024-01-05 璁剧疆鏀寔缂撳瓨澶辨晥锛岃鍙傛暟寰堥噸瑕侊紝濡傛灉闇�瑕佸け鏁堣�屾病鏈夎缃湪璋冪敤鍚庝細鍑虹幇鏁版嵁鏃犳硶澶辨晥锛� + this.setSupportExpiredCache(true); + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_CAPTCHA; + } + + @Override + public Class<?> getProviderType() { + return String.class; + } + + @Override + protected int loadDataToCache(Cache cache){ + // 鏃犻渶鍚姩鍔犺浇鏁版嵁 + return 0; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/cache/RedisCategoryCacheProvider.java b/iplatform-base/src/main/java/com/iplatform/base/cache/RedisCategoryCacheProvider.java new file mode 100644 index 0000000..c967140 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/cache/RedisCategoryCacheProvider.java @@ -0,0 +1,123 @@ +package com.iplatform.base.cache; + +import com.iplatform.base.CategoryCacheProvider; +import com.iplatform.base.Constants; +import com.iplatform.base.service.CategoryServiceImpl; +import com.iplatform.base.util.CategoryUtils; +import com.iplatform.base.util.cache.CategorySortComparator; +import com.iplatform.model.po.S_category; +import com.iplatform.model.vo.CategoryTreeVo; +import com.walker.cache.Cache; +import com.walker.infrastructure.ApplicationRuntimeException; +import com.walker.infrastructure.utils.JsonUtils; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.support.redis.cache.RedisCache; +import com.walker.support.redis.cache.RedisCacheProvider; + +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.util.ArrayList; +import java.util.List; + +/** + * 骞冲彴鍒嗙被鏁版嵁锛孯edis缂撳瓨瀹炵幇銆� + * @author 鏃跺厠鑻� + * @date 2023-05-17 + */ +public class RedisCategoryCacheProvider extends RedisCacheProvider<S_category> implements CategoryCacheProvider { + + private final CategorySortComparator sortComparator = new CategorySortComparator(); + + public RedisCategoryCacheProvider(){ + this.setUseRedis(true); + this.setLoadPage(false); + } + + @Override + protected int loadDataToCache(Cache cache) { + List<S_category> hosts = this.categoryService.selectAll(new S_category()); + if(!StringUtils.isEmptyList(hosts)){ + // ------------------------- 鍒囨崲鎴愭櫘閫氱紦瀛樻楠わ細3 + if(this.isUseRedis()){ + // 濡傛灉redis涓紦瀛樻暟閲忓拰鏁版嵁搴撲腑涓嶄竴鑷达紙灏戯級锛屽垯娓呯┖redis缂撳瓨锛岄噸鏂板姞杞芥暟鎹簱鏁版嵁鍒扮紦瀛樹腑銆� + long totalCache = cache.getPersistentSize(); + if(totalCache != hosts.size()){ + logger.info("redis缂撳瓨涓瑿ategory鏁伴噺灏忎簬瀹為檯鐢ㄦ埛锛岄渶瑕佹竻绌虹紦瀛橀噸鏂板姞杞�! cache = " + totalCache + ", db = " + hosts.size()); + cache.clear(); + + for(S_category h : hosts){ + cache.put(String.valueOf(h.getId()), h); + } + } + }//------------------------------------------ + return hosts.size(); + } + return 0; + } + + @Override + public List<CategoryTreeVo> getTree(Integer type, Integer status, String name, List<Integer> categoryIdList, int owner) { + List<S_category> allTree = new ArrayList<>(); + S_category tempCategory = null; + + for(String value : ((RedisCache)this.getCache()).getIterator(null)){ + try{ + tempCategory = JsonUtils.jsonStringToObject(value, S_category.class); + } catch (Exception ex){ + throw new ApplicationRuntimeException("redis瀛樺偍'S_category'瑙f瀽閿欒锛�" + value, ex); + } + if(CategoryUtils.isCondition(tempCategory, type, status, name, categoryIdList, owner)){ + allTree.add(tempCategory); + } + } + return CategoryUtils.acquireListTree(allTree, sortComparator); + } + + @Override + public List<CategoryTreeVo> getListTree(Integer type, Integer status, String name, int owner) { + if(StringUtils.isNotEmpty(name)){ + try { + name = URLDecoder.decode(name, StringUtils.DEFAULT_CHARSET_UTF8); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + } + return getTree(type, status, name, null, owner); + } + + @Override + public S_category get(int id) { + return this.getCacheData(String.valueOf(id)); + } + + @Override + public void save(S_category category) { + this.putCacheData(String.valueOf(category.getId()), category); + } + + @Override + public void update(S_category category) { + this.updateCacheData(String.valueOf(category.getId()), category); + } + + @Override + public void remove(int id) { + this.removeCacheData(String.valueOf(id)); + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_CATEGORY; + } + + @Override + public Class<?> getProviderType() { + return S_category.class; + } + + public void setCategoryService(CategoryServiceImpl categoryService) { + this.categoryService = categoryService; + } + + private CategoryServiceImpl categoryService; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/cache/RedisDeptCacheProvider.java b/iplatform-base/src/main/java/com/iplatform/base/cache/RedisDeptCacheProvider.java new file mode 100644 index 0000000..a695f79 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/cache/RedisDeptCacheProvider.java @@ -0,0 +1,213 @@ +package com.iplatform.base.cache; + +import com.iplatform.base.Constants; +import com.iplatform.base.DeptCacheProvider; +import com.iplatform.base.service.DeptServiceImpl; +import com.iplatform.base.util.DeptUtils; +import com.iplatform.model.po.S_dept; +import com.walker.cache.Cache; +import com.walker.infrastructure.utils.JsonUtils; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.support.redis.cache.RedisCacheProvider; + +import java.util.ArrayList; +import java.util.List; + +public class RedisDeptCacheProvider extends RedisCacheProvider<String> implements DeptCacheProvider { + + private boolean allowCacheChildren = true; + + private DeptServiceImpl deptService; + + public void setDeptService(DeptServiceImpl deptService) { + this.deptService = deptService; + } + + public RedisDeptCacheProvider(){ + this.setUseRedis(true); + this.setLoadPage(false); + } + + @Override + public void setAllowCacheChildren(boolean allow) { + this.allowCacheChildren = allow; + } + + @Override + public S_dept getDept(long deptId) { + // 瓒呯骇鐢ㄦ埛铏氭嫙涓�涓満鏋� + if(deptId == 0){ + return DeptUtils.SUPER_VISOR_DEPT; + } + + String data = this.getCacheData(String.valueOf(deptId)); + if(StringUtils.isEmpty(data)){ + logger.error("鏌ヨ鏈烘瀯缂撳瓨涓嶅瓨鍦紝閲嶆柊鍔犺浇:" + deptId); + S_dept s_dept = this.deptService.queryOneDept(deptId); + if(s_dept == null){ + throw new IllegalStateException("鏁版嵁搴撳姞杞芥満鏋勪笉瀛樺湪锛宨d=" + deptId); + } + try { + if(this.allowCacheChildren){ + this.putDept(s_dept); + } else { + this.putCacheData(String.valueOf(deptId), JsonUtils.objectToJsonString(s_dept)); + } + return s_dept; + } catch (Exception ex){ + throw new RuntimeException("娣诲姞 [鏈烘瀯] 缂撳瓨閿欒:" + ex.getMessage(), ex); + } + } + try { + return JsonUtils.jsonStringToObject(data, S_dept.class); + } catch (Exception e) { + throw new RuntimeException("鑾峰緱鏈烘瀯缂撳瓨閿欒:" + deptId + ", " + e.getMessage(), e); + } + } + + @Override + public void updateDept(S_dept s_dept) { + try { + this.updateCacheData(String.valueOf(s_dept.getId()), JsonUtils.objectToJsonString(s_dept)); + } catch (Exception e) { + throw new RuntimeException("鏇存柊鏈烘瀯缂撳瓨閿欒:" + s_dept.getId() + ", " + e.getMessage(), e); + } + } + + @Override + public void removeDept(long deptId) { + String key = String.valueOf(deptId); + String keyChildren = key + DeptUtils.KEY_CHILDREN_PREFIX; + + S_dept current = this.getDept(deptId); + if(current == null){ + logger.warn("鏈烘瀯缂撳瓨宸蹭笉瀛樺湪锛屾棤闇�鍒犻櫎"); + return; + } + + // 鍒犻櫎璇ユ満鏋勫瓙鏈烘瀯缂撳瓨鍒楄〃 + this.removeCacheData(keyChildren); + this.removeCacheData(key); + + if(current.getParent_id().longValue() == 0){ + return; + } + + // 2023-07-17锛岄拡瀵规満鏋勮緝澶х殑椤圭洰锛屾槸涓嶉渶瑕佹妸鏈烘瀯鏍戞斁Redis缂撳瓨鐨勩�� + if(this.allowCacheChildren){ + // 鏇存柊鐖舵満鏋勫搴旂殑childrenList + String parentId = String.valueOf(current.getParent_id()); + List<String> parentChildrenList = this.getChildrenDeptIdOneLevel(current.getParent_id()); + if(parentChildrenList != null){ + parentChildrenList.remove(String.valueOf(deptId)); + try { + this.updateCacheData(parentId + DeptUtils.KEY_CHILDREN_PREFIX, JsonUtils.objectToJsonString(parentChildrenList)); + } catch (Exception e) { + throw new RuntimeException("鍒犻櫎鏈烘瀯缂撳瓨鏃讹紝鏇存柊鐖惰妭鐐筩hildrenList鎶ラ敊:" + e.getMessage(), e); + } + } + } + } + + @Override + public void putDept(S_dept s_dept) { + String id = String.valueOf(s_dept.getId()); + try { + // 娣诲姞鏈烘瀯瀵硅薄缂撳瓨 + this.putCacheData(id, JsonUtils.objectToJsonString(s_dept)); + if(this.allowCacheChildren){ + // 2023-07-17 + // 娣诲姞鏈烘瀯瀛愭満鏋勫垪琛紝鐩墠涓虹┖鍒楄〃 + this.putCacheData(id + DeptUtils.KEY_CHILDREN_PREFIX, JsonUtils.objectToJsonString(new ArrayList<String>(2))); + } + + if(s_dept.getParent_id().longValue() == 0){ + // 椤剁骇鍗曚綅锛屾病鏈夌埗鏈烘瀯浜� + logger.debug("椤剁骇鏈烘瀯锛屼笉鐢ㄦ洿鏂扮埗鏈烘瀯鍒楄〃, " + id); + return; + } + + if(this.allowCacheChildren){ + // 2023-07-17 + // 鏇存柊鐖舵満鏋勫垪琛� + List<String> parentChildrenList = this.getChildrenDeptIdOneLevel(s_dept.getParent_id()); + if(StringUtils.isEmptyList(parentChildrenList)){ + parentChildrenList = new ArrayList<>(); + } + parentChildrenList.add(id); + this.updateCacheData(String.valueOf(s_dept.getParent_id()) + DeptUtils.KEY_CHILDREN_PREFIX, JsonUtils.objectToJsonString(parentChildrenList)); + if(logger.isDebugEnabled()){ + logger.debug("娣诲姞鏈烘瀯缂撳瓨锛宲arentChildrenList = " + parentChildrenList); + } + } + } catch (Exception e) { + throw new RuntimeException("娣诲姞 [鏈烘瀯] 缂撳瓨閿欒:" + e.getMessage(), e); + } + } + + @Override + public List<String> getChildrenDeptIdOneLevel(long deptId) { + if(this.allowCacheChildren){ + String key = String.valueOf(deptId) + DeptUtils.KEY_CHILDREN_PREFIX; + String data = this.getCacheData(key); + if(StringUtils.isEmpty(data)){ + logger.error("鏈壘鍒扮紦瀛樹腑瀛愭満鏋勫垪琛�: " + key); + return null; + } + try { + return JsonUtils.jsonStringToObject(data, List.class); + } catch (Exception e) { + throw new RuntimeException(e); + } + } else { + // 2023-07-17锛屼笉鏀寔缂撳瓨鏍戠粨鏋勶紝浠庢暟鎹簱鏌ヨ + throw new UnsupportedOperationException("鏆傛湭瀹炵幇浠g爜锛氫粠鏁版嵁搴撳姞杞斤細"+ deptId + " 涓嬩竴绾ф墍鏈夊瓙鏈烘瀯ID闆嗗悎"); + } + } + + @Override + public List<S_dept> getChildrenDeptOneLevel(long deptId) { + List<String> childrenIdList = this.getChildrenDeptIdOneLevel(deptId); + if(StringUtils.isEmptyList(childrenIdList)){ + return null; + } + + List<S_dept> resultList = new ArrayList<>(); + S_dept s_dept = null; + for(String id : childrenIdList){ + s_dept = this.getDept(Long.parseLong(id)); + resultList.add(s_dept); + } + return resultList; + } + +// @Override +// protected int loadDataToCache(Cache cache) { +// List<S_dept> list = this.deptService.queryAllDeptListForCache(); +// if(!StringUtils.isEmptyList(list)){ +// // 濡傛灉redis涓紦瀛樻暟閲忓拰鏁版嵁搴撲腑涓嶄竴鑷达紙灏戯級锛屽垯娓呯┖redis缂撳瓨锛岄噸鏂板姞杞芥暟鎹簱鏁版嵁鍒扮紦瀛樹腑銆� +// long totalCache = cache.getPersistentSize(); +// if(totalCache < list.size()){ +// logger.info("redis缂撳瓨涓璠鏈烘瀯]鏁伴噺灏忎簬瀹為檯鐢ㄦ埛锛岄渶瑕佹竻绌虹紦瀛橀噸鏂板姞杞�! cache = " + totalCache + ", db = " + list.size()); +// cache.clear(); +// for(S_dept h : list){ +// this.putDept(h); +// } +// } +// return list.size(); +// } +// return 0; +// } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_DEPT; + } + + @Override + public Class<?> getProviderType() { + return String.class; + } + +// private static final String KEY_CHILDREN_PREFIX = ".children"; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/cache/RedisHostCacheProvider.java b/iplatform-base/src/main/java/com/iplatform/base/cache/RedisHostCacheProvider.java new file mode 100644 index 0000000..0dbd307 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/cache/RedisHostCacheProvider.java @@ -0,0 +1,61 @@ +package com.iplatform.base.cache; + +import com.iplatform.base.Constants; +import com.iplatform.model.po.S_host; +import com.walker.cache.Cache; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.jdbc.service.PubService; +import com.walker.support.redis.cache.RedisCacheProvider; + +import java.util.List; + +/** + * 涓绘満璧勬簮缂撳瓨(Redis鏂瑰紡)瀹炵幇銆� + * @author 鏃跺厠鑻� + * @date 2022-09-20 + */ +public class RedisHostCacheProvider extends RedisCacheProvider<S_host> { + + private PubService pubService; + + public RedisHostCacheProvider(){ + this.setUseRedis(true); + this.setLoadPage(false); + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_HOST; + } + + @Override + public Class<?> getProviderType() { + return S_host.class; + } + + @Override + protected int loadDataToCache(Cache cache) { + List<S_host> hosts = this.pubService.selectAll(new S_host()); + if(!StringUtils.isEmptyList(hosts)){ + // ------------------------- 鍒囨崲鎴愭櫘閫氱紦瀛樻楠わ細3 + if(this.isUseRedis()){ + // 濡傛灉redis涓紦瀛樻暟閲忓拰鏁版嵁搴撲腑涓嶄竴鑷达紙灏戯級锛屽垯娓呯┖redis缂撳瓨锛岄噸鏂板姞杞芥暟鎹簱鏁版嵁鍒扮紦瀛樹腑銆� + long totalCache = cache.getPersistentSize(); + if(totalCache < hosts.size()){ + logger.info("redis缂撳瓨涓敤鎴锋暟閲忓皬浜庡疄闄呯敤鎴凤紝闇�瑕佹竻绌虹紦瀛橀噸鏂板姞杞�! cache = " + totalCache + ", db = " + hosts.size()); + cache.clear(); + + for(S_host h : hosts){ + cache.put(String.valueOf(h.getId()), h); + } + } + }//------------------------------------------ + return hosts.size(); + } + return 0; + } + + public void setPubService(PubService pubService) { + this.pubService = pubService; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/cache/RedisMenuUpdateCache.java b/iplatform-base/src/main/java/com/iplatform/base/cache/RedisMenuUpdateCache.java new file mode 100644 index 0000000..4e284a6 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/cache/RedisMenuUpdateCache.java @@ -0,0 +1,42 @@ +package com.iplatform.base.cache; + +import com.walker.infrastructure.utils.NumberGenerator; +import com.walker.support.redis.cache.RedisCacheProvider; + +/** + * 璁板綍鑿滃崟缂撳瓨鏇存柊鏃堕棿鐨勭紦瀛樸�� + * <pre> + * 1) 鐢变簬鑿滃崟缂撳瓨鏈娇鐢≧edis鎸佷箙鍖栵紝瀵艰嚧鍦ㄩ泦缇ょ幆澧冧腑锛屾棤娉曡Е鍙戝叏閲忔洿鏂般�� + * 2) 鍥犳閲囩敤璁板綍鏇存柊鏃堕棿璁板綍鍒皉edis锛屽綋鐢ㄦ埛淇敼鑿滃崟鏁版嵁鍚庯紝璁板綍淇敼鏃堕棿锛� + * 3) 鍚勪釜鑺傜偣鍦ㄨ皟鐢ㄦ柟娉曞墠锛屾鏌ユ椂闂达紝濡傛灉瀛樺湪鏂版椂闂村垯閲嶆柊鍔犺浇鏈湴缂撳瓨銆� + * </pre> + * @author 鏃跺厠鑻� + * @date 2024-04-09 + */ +public class RedisMenuUpdateCache extends RedisCacheProvider<Long> { + + public RedisMenuUpdateCache(){ + this.setUseRedis(true); + this.setLoadPage(false); + } + + @Override + public String getProviderName() { + return "cache.base.menu_update"; + } + + @Override + public Class<?> getProviderType() { + return Long.class; + } + + public void triggerTimeUpdate(){ + this.putCacheData(KEY_TIME_UPDATE, NumberGenerator.getSequenceNumber()); + } + + public Long getTimeUpdate(){ + return this.getCacheData(KEY_TIME_UPDATE); + } + + public static final String KEY_TIME_UPDATE = "time_update"; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/cache/RedisNotificationTemplateCache.java b/iplatform-base/src/main/java/com/iplatform/base/cache/RedisNotificationTemplateCache.java new file mode 100644 index 0000000..90143a2 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/cache/RedisNotificationTemplateCache.java @@ -0,0 +1,103 @@ +package com.iplatform.base.cache; + +import com.iplatform.base.Constants; +import com.iplatform.base.NotificationTemplateCache; +import com.iplatform.base.NotifyConstants; +import com.iplatform.base.service.NotificationServiceImpl; +import com.iplatform.model.po.SfNotification; +import com.iplatform.model.po.SfTemplateMessage; +import com.iplatform.model.vo.NotificationTemplateVo; +import com.walker.cache.Cache; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.support.redis.cache.RedisCacheProvider; + +import java.util.List; +import java.util.Map; + +public class RedisNotificationTemplateCache extends RedisCacheProvider<NotificationTemplateVo> implements NotificationTemplateCache { + + public RedisNotificationTemplateCache(){ + this.setUseRedis(true); + this.setLoadPage(false); + } + + @Override + protected int loadDataToCache(Cache cache) { + List<SfNotification> notificationList = this.notificationService.selectAll(new SfNotification()); + if(!StringUtils.isEmptyList(notificationList)){ + // ------------------------- 鍒囨崲鎴愭櫘閫氱紦瀛樻楠わ細3 + if(this.isUseRedis()){ + // 濡傛灉redis涓紦瀛樻暟閲忓拰鏁版嵁搴撲腑涓嶄竴鑷达紙灏戯級锛屽垯娓呯┖redis缂撳瓨锛岄噸鏂板姞杞芥暟鎹簱鏁版嵁鍒扮紦瀛樹腑銆� + long totalCache = cache.getPersistentSize(); + if(totalCache != notificationList.size()){ + logger.info(Constants.CACHE_NAME_NOTIFICATION_TEMPLATE + ": redis缂撳瓨涓敤鎴锋暟閲忓皬浜庡疄闄呯敤鎴凤紝闇�瑕佹竻绌虹紦瀛橀噸鏂板姞杞�! cache = " + totalCache + ", db = " + notificationList.size()); + cache.clear(); + + Map<Long, SfTemplateMessage> templateMessageMap = this.notificationService.queryTemplateIdMap(); + if(templateMessageMap.size() == 0){ + logger.warn("鎻愰啋妯℃澘鏈壘鍒颁换浣曟湁鏁堟暟鎹�"); + return 0; + } + for(SfNotification h : notificationList){ + NotificationTemplateVo vo = new NotificationTemplateVo(); + vo.setName(h.getMark()); + if(h.getIsWechat().intValue() == NotifyConstants.SWITCH_OPEN){ + vo.setWechat(true); + vo.setWechatId(h.getWechatId()); + vo.setWechatTempId(templateMessageMap.get(h.getWechatId().longValue()).getTempId()); + } + if(h.getIsRoutine().intValue() == NotifyConstants.SWITCH_OPEN){ + vo.setRoutine(true); + vo.setRoutineId(h.getRoutineId()); + vo.setRoutineTempId(templateMessageMap.get(h.getRoutineId().longValue()).getTempId()); + } + if(h.getIsSms().intValue() == NotifyConstants.SWITCH_OPEN){ + vo.setSms(true); + vo.setSmsId(h.getSmsId()); + vo.setSmsTempId(templateMessageMap.get(h.getSmsId().longValue()).getTempId()); + } + cache.put(h.getMark(), vo); + } + } + }//------------------------------------------ + return notificationList.size(); + } + return 0; + } + + @Override + public NotificationTemplateVo get(String mark) { + return this.getCacheData(mark); + } + + @Override + public void save(NotificationTemplateVo category) { + this.putCacheData(category.getName(), category); + } + + @Override + public void update(NotificationTemplateVo category) { + this.updateCacheData(category.getName(), category); + } + + @Override + public void remove(String mark) { + this.removeCacheData(mark); + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_NOTIFICATION_TEMPLATE; + } + + @Override + public Class<?> getProviderType() { + return NotificationTemplateVo.class; + } + + public void setNotificationService(NotificationServiceImpl notificationService) { + this.notificationService = notificationService; + } + + private NotificationServiceImpl notificationService; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/cache/RedisPushCacheProvider.java b/iplatform-base/src/main/java/com/iplatform/base/cache/RedisPushCacheProvider.java new file mode 100644 index 0000000..9f8a1ca --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/cache/RedisPushCacheProvider.java @@ -0,0 +1,35 @@ +package com.iplatform.base.cache; + +import com.iplatform.base.Constants; +import com.iplatform.base.PushCacheProvider; +import com.walker.support.redis.cache.RedisCacheProvider; + +public class RedisPushCacheProvider extends RedisCacheProvider<String> implements PushCacheProvider { + + public RedisPushCacheProvider(){ + this.setUseRedis(true); + this.setLoadPage(false); + // 2024-01-05 璁剧疆鏀寔缂撳瓨澶辨晥锛岃鍙傛暟寰堥噸瑕侊紝濡傛灉闇�瑕佸け鏁堣�屾病鏈夎缃湪璋冪敤鍚庝細鍑虹幇鏁版嵁鏃犳硶澶辨晥锛� + this.setSupportExpiredCache(true); + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_PUSH; + } + + @Override + public Class<?> getProviderType() { + return String.class; + } + + @Override + public void put(String key, String value) { + this.putCacheData(key, value, 60); + } + + @Override + public String get(String key) { + return this.getCacheData(key); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/cache/RedisSystemGroupCache.java b/iplatform-base/src/main/java/com/iplatform/base/cache/RedisSystemGroupCache.java new file mode 100644 index 0000000..1dc4c7e --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/cache/RedisSystemGroupCache.java @@ -0,0 +1,95 @@ +package com.iplatform.base.cache; + +import com.iplatform.base.Constants; +import com.iplatform.base.SystemGroupCache; +import com.iplatform.base.service.GroupServiceImpl; +import com.iplatform.model.po.S_group; +import com.iplatform.model.po.S_group_data; +import com.iplatform.model.vo.SystemGroupVo; +import com.walker.cache.Cache; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.support.redis.cache.RedisCacheProvider; + +import java.util.ArrayList; +import java.util.List; + +public class RedisSystemGroupCache extends RedisCacheProvider<SystemGroupVo> implements SystemGroupCache { + + public RedisSystemGroupCache(){ + this.setUseRedis(true); + this.setLoadPage(false); + } + + @Override + public SystemGroupVo get(int id) { + return this.getCacheData(String.valueOf(id)); + } + + @Override + public void save(SystemGroupVo category) { + this.putCacheData(String.valueOf(category.getId()), category); + } + + @Override + public void update(SystemGroupVo category) { + this.updateCacheData(String.valueOf(category.getId()), category); + } + + @Override + public void remove(int id) { + this.removeCacheData(String.valueOf(id)); + } + + @Override + protected int loadDataToCache(Cache cache) { + List<S_group> hosts = this.groupService.selectAll(new S_group()); + if(!StringUtils.isEmptyList(hosts)){ + if(this.isUseRedis()){ + // 濡傛灉redis涓紦瀛樻暟閲忓拰鏁版嵁搴撲腑涓嶄竴鑷达紙灏戯級锛屽垯娓呯┖redis缂撳瓨锛岄噸鏂板姞杞芥暟鎹簱鏁版嵁鍒扮紦瀛樹腑銆� + long totalCache = cache.getPersistentSize(); + if(totalCache != hosts.size()){ + logger.info("redis缂撳瓨涓敤鎴锋暟閲忓皬浜庡疄闄呯敤鎴凤紝闇�瑕佹竻绌虹紦瀛橀噸鏂板姞杞�! cache = " + totalCache + ", db = " + hosts.size()); + cache.clear(); + + List<SystemGroupVo> groupVoList = new ArrayList<>(hosts.size()); + List<S_group_data> groupDataList = this.groupService.queryAllGroupDataList(); + for(S_group h : hosts){ + groupVoList.add(new SystemGroupVo(h)); + } + + if(!StringUtils.isEmptyList(groupDataList)){ + for(S_group_data data : groupDataList){ + for(SystemGroupVo vo : groupVoList){ + if(data.getGid().intValue() == vo.getId().intValue()){ + vo.addGroupData(data); + } + } + } + } + + for(SystemGroupVo h : groupVoList){ + cache.put(String.valueOf(h.getId()), h); + } + } + } + return hosts.size(); + } + return 0; + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_GROUP; + } + + @Override + public Class<?> getProviderType() { + return SystemGroupVo.class; + } + + public void setGroupService(GroupServiceImpl groupService) { + this.groupService = groupService; + } + + private GroupServiceImpl groupService; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/cache/RedisUserCacheProvider.java b/iplatform-base/src/main/java/com/iplatform/base/cache/RedisUserCacheProvider.java new file mode 100644 index 0000000..5d97b58 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/cache/RedisUserCacheProvider.java @@ -0,0 +1,133 @@ +package com.iplatform.base.cache; + +import com.iplatform.base.Constants; +import com.iplatform.base.UserCacheProvider; +import com.iplatform.base.service.UserServiceImpl; +import com.iplatform.model.po.S_user_core; +import com.walker.cache.Cache; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.support.redis.cache.RedisCacheProvider; + +import java.util.List; + +/** + * Redis瀹炵幇鐨勭敤鎴风紦瀛樻彁渚涜�呫�� + * @author 鏃跺厠鑻� + * @date 2022-11-06 + */ +public class RedisUserCacheProvider extends RedisCacheProvider<S_user_core> implements UserCacheProvider { + + private UserServiceImpl userService = null; + + private boolean allowInitCache = true; + + /** + * 璁剧疆鏄惁鍏佽鍒濆鍖栧姞杞界敤鎴峰埌缂撳瓨銆� + * @param allowInitCache + * @date 2023-07-17 + */ + public void setAllowInitCache(boolean allowInitCache) { + this.allowInitCache = allowInitCache; + } + + public void setUserService(UserServiceImpl userService) { + this.userService = userService; + } + + public RedisUserCacheProvider(){ + this.setUseRedis(true); + this.setLoadPage(false); + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_USER; + } + + @Override + public Class<?> getProviderType() { + return S_user_core.class; + } + + @Override + protected int loadDataToCache(Cache cache) { + if(this.allowInitCache){ + List<S_user_core> hosts = this.userService.selectAll(new S_user_core()); + if(!StringUtils.isEmptyList(hosts)){ + // ------------------------- 鍒囨崲鎴愭櫘閫氱紦瀛樻楠わ細3 + if(this.isUseRedis()){ + // 濡傛灉redis涓紦瀛樻暟閲忓拰鏁版嵁搴撲腑涓嶄竴鑷达紙灏戯級锛屽垯娓呯┖redis缂撳瓨锛岄噸鏂板姞杞芥暟鎹簱鏁版嵁鍒扮紦瀛樹腑銆� + long totalCache = cache.getPersistentSize(); + if(totalCache != hosts.size()){ + logger.info("redis缂撳瓨涓敤鎴锋暟閲忓皬浜庡疄闄呯敤鎴凤紝闇�瑕佹竻绌虹紦瀛橀噸鏂板姞杞�! cache = " + totalCache + ", db = " + hosts.size()); + cache.clear(); + + for(S_user_core h : hosts){ + cache.put(String.valueOf(h.getId()), h); + } + } + }//------------------------------------------ + return hosts.size(); + } + } else { + logger.info("........鐢变簬鐢ㄦ埛閲忚緝澶э紝鎵�浠ラ厤缃細涓嶉渶瑕佸垵濮嬪寲鍔犺浇鐢ㄦ埛缂撳瓨!"); + } + return 0; + } + + @Override + public S_user_core getUserByLoginId(String loginId) { + S_user_core userCore = this.getCacheData(loginId); + if(userCore == null){ + userCore = this.userService.queryLoginUserOnly(loginId); + if(userCore == null){ + logger.warn("浠巗_user_core鏈煡璇㈠埌鐢ㄦ埛" + "锛屾棤娉曠紦瀛橈紝loginId = {}", loginId); + return null; + } + this.putCacheData(loginId, userCore); + } + return userCore; + } + + @Override + public S_user_core getUser(long userId) { + S_user_core user_core = this.getCacheData(String.valueOf(userId)); + if(user_core == null){ + logger.warn("缂撳瓨涓湭鎵惧埌鐢ㄦ埛瀵硅薄锛屽皾璇曚粠鏁版嵁搴撳姞杞�, userId = " + userId); + user_core = this.userService.get(new S_user_core(userId)); + this.putCacheData(String.valueOf(userId), user_core); + } + return user_core; + } + + @Override + public void updateUser(S_user_core user_core) { + if(user_core == null){ + throw new IllegalArgumentException("鏇存柊鐢ㄦ埛缂撳瓨閿欒锛寀ser_core = null"); + } + this.updateCacheData(String.valueOf(user_core.getId()), user_core); + // 2024-03-06 鍔犱笂鐧诲綍鍚峩ey缂撳瓨 + this.updateCacheData(user_core.getUser_name(), user_core); + } + + @Override + public void removeUser(long userId) { +// this.removeCacheData(String.valueOf(userId)); + // 2024-03-06 鍏堝垹闄ょ櫥褰曞悕涓簁ey鐨勭紦瀛� + S_user_core user_core = this.getCacheData(String.valueOf(userId)); + if(user_core != null){ + this.removeCacheData(user_core.getUser_name()); + } + this.removeCacheData(String.valueOf(userId)); + } + + @Override + public void putUser(S_user_core user_core) { + if(user_core == null){ + throw new IllegalArgumentException("娣诲姞鐢ㄦ埛缂撳瓨閿欒: user_core = null"); + } + this.putCacheData(String.valueOf(user_core.getId()), user_core); + // 2024-03-06 鍔犱笂鐧诲綍鍚峩ey缂撳瓨 + this.putCacheData(user_core.getUser_name(), user_core); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/cache/RedisUserLoginCache.java b/iplatform-base/src/main/java/com/iplatform/base/cache/RedisUserLoginCache.java new file mode 100644 index 0000000..5f7c5bb --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/cache/RedisUserLoginCache.java @@ -0,0 +1,44 @@ +package com.iplatform.base.cache; + +import com.iplatform.base.Constants; +import com.iplatform.base.UserLoginCache; +import com.iplatform.model.po.S_user_login; +import com.walker.support.redis.cache.RedisCacheProvider; + +public class RedisUserLoginCache extends RedisCacheProvider<S_user_login> implements UserLoginCache { + + public RedisUserLoginCache(){ + this.setUseRedis(true); + this.setLoadPage(false); + } + + @Override + public S_user_login getUserLogin(String loginId) { + return this.getCacheData(loginId); + } + + @Override + public void updateUserLogin(S_user_login user_login) { + this.updateCacheData(user_login.getUser_name(), user_login); + } + + @Override + public void removeUserLogin(String loginId) { + this.removeCacheData(loginId); + } + + @Override + public void putUserLogin(S_user_login user_login) { + this.putCacheData(user_login.getUser_name(), user_login); + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_USER_LOGIN; + } + + @Override + public Class<?> getProviderType() { + return S_user_login.class; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/cache/RedisUserOnlineProvider.java b/iplatform-base/src/main/java/com/iplatform/base/cache/RedisUserOnlineProvider.java new file mode 100644 index 0000000..f6ac489 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/cache/RedisUserOnlineProvider.java @@ -0,0 +1,169 @@ +package com.iplatform.base.cache; + +import com.iplatform.base.Constants; +import com.iplatform.base.DefaultUserPrincipal; +import com.iplatform.base.VariableConstants; +import com.iplatform.base.util.TokenUtils; +import com.iplatform.base.util.UserUtils; +import com.walker.cache.Cache; +import com.walker.infrastructure.utils.JsonUtils; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.support.redis.cache.RedisCacheProvider; +import com.walker.web.UserOnlineProvider; +import com.walker.web.UserPrincipal; + +/** + * Redis瀹炵幇鐨勭敤鎴风櫥褰曠紦瀛樻彁渚涜�呫�� + * @author 鏃跺厠鑻� + * @date 2022-11-14 + */ +public class RedisUserOnlineProvider extends RedisCacheProvider<String> implements UserOnlineProvider { + + public RedisUserOnlineProvider(){ + this.setUseRedis(true); + this.setLoadPage(false); + // 2024-01-05 璁剧疆鏀寔缂撳瓨澶辨晥锛岃鍙傛暟寰堥噸瑕侊紝濡傛灉闇�瑕佸け鏁堣�屾病鏈夎缃湪璋冪敤鍚庝細鍑虹幇鏁版嵁鏃犳硶澶辨晥锛� + this.setSupportExpiredCache(true); + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_ONLINE_USER; + } + + @Override + public Class<?> getProviderType() { + return String.class; + } + + @Override + protected int loadDataToCache(Cache cache){ + // 鍥犱负鐧诲綍缂撳瓨鍦╮edis涓紝鍥犳鍚姩鏃舵棤闇�閲嶆柊鍔犺浇 + return 0; + } + + @Override + public UserPrincipal<?> getUserPrincipal(String token) { +// UserPrincipal<?> userPrincipal = this.getCacheData(token); + String userJson = this.getCacheData(token); + if(StringUtils.isEmpty(userJson)){ + logger.warn("缂撳瓨鏈幏鍙栫櫥褰曚俊鎭�, token=" + token); + return null; + } + try { + // 鐢变簬瀛樺湪娉涘瀷锛屽洜姝ょ洿鎺ヨ皟鐢� JsonUtils.jsonStringToObject() 鏂规硶鎶ラ敊銆� + // 鍙兘杞垚JSON鑷畾涔夎В鏋愬弽搴忓垪鍖栥��2022-11-15 +// ObjectNode objectNode = JsonUtils.jsonStringToObjectNode(userJson); +// return this.createUserPrincipal(objectNode); + return UserUtils.toUserPrincipal(userJson); +// return JsonUtils.jsonStringToObject(userJson, DefaultUserPrincipal.class); + } catch (Exception e) { + throw new RuntimeException("缂撳瓨鑾峰彇鐧诲綍淇℃伅閿欒, token=" + token + ", " + e.getMessage(), e); + } + +// if(userPrincipal == null){ +// logger.warn("UserOnlineProvider 缂撳瓨鐢ㄦ埛涓嶅瓨鍦�, token = " + token); +// return null; +// } +// return userPrincipal; + } + + @Deprecated + @Override + public boolean cacheUserPrincipal(String token, UserPrincipal<?> userPrincipal) { + return this.cacheUserPrincipal(token, userPrincipal, VariableConstants.DEFAULT_TOKEN_EXPIRED_MINUTES); + } + + @Override + public boolean cacheUserPrincipal(String token, UserPrincipal<?> userPrincipal, long expiredMintues) { + logger.debug("redis鍐欏叆鐧诲綍鐢ㄦ埛缂撳瓨(token=uuid): " + token); + try { + String userJson = JsonUtils.objectToJsonString((DefaultUserPrincipal)userPrincipal); +// logger.info(userJson); + this.putCacheData(token, userJson, TokenUtils.acquireCacheUserExpiredSeconds(expiredMintues)); + } catch (Exception e) { + throw new RuntimeException("鐧诲綍淇℃伅鍐欏叆缂撳瓨閿欒: " + e.getMessage(), e); + } + return true; + } + + @Override + public boolean updateUserPrincipalTimeStamp(String token) { + return false; + } + + @Override + public boolean removeUserPrincipal(String token) { + this.removeCacheData(token); + return true; + } + + /*private DefaultUserPrincipal createUserPrincipal(ObjectNode objectNode){ + JsonNode userInfoNode = objectNode.get("userInfo"); + S_user_core user_core = new S_user_core(); + user_core.setId(userInfoNode.get("id").asLong()); + user_core.setUser_name(userInfoNode.get("user_name").asText()); + user_core.setPassword(userInfoNode.get("password").asText()); + user_core.setDept_id(userInfoNode.get("dept_id").asLong()); + user_core.setNick_name(userInfoNode.get("nick_name").asText()); + user_core.setUser_type(userInfoNode.get("user_type").asInt()); + user_core.setCreate_time(new Date(userInfoNode.get("create_time").asLong())); + user_core.setOrg_id(userInfoNode.get("org_id").asLong()); + user_core.setStatus(userInfoNode.get("status").asInt()); + user_core.setDel_flag(userInfoNode.get("del_flag").asInt()); + if(!JsonUtils.isEmptyObject(userInfoNode.get("sex"))){ + user_core.setSex(userInfoNode.get("sex").asText()); + } else { + user_core.setSex("2"); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("phonenumber"))){ + user_core.setPhonenumber(userInfoNode.get("phonenumber").asText()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("avatar"))){ + user_core.setAvatar(userInfoNode.get("avatar").asText()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("email"))){ + user_core.setEmail(userInfoNode.get("email").asText()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("remark"))){ + user_core.setRemark(userInfoNode.get("remark").asText()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("create_by"))){ + user_core.setCreate_by(userInfoNode.get("create_by").asText()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("login_date"))){ + user_core.setLogin_date(new Date(userInfoNode.get("login_date").asLong())); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("login_ip"))){ + user_core.setLogin_ip(userInfoNode.get("login_ip").asText()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("update_by"))){ + user_core.setUpdate_by(userInfoNode.get("update_by").asText()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("update_time"))){ + user_core.setUpdate_time(new Date(userInfoNode.get("update_time").asLong())); + } + JsonNode roleIdListJson = objectNode.get("roleIdList"); + List<String> roleList = new ArrayList<>(4); + if(roleIdListJson.isArray()){ + for(Iterator<JsonNode> it = roleIdListJson.iterator(); it.hasNext();){ + roleList.add(it.next().asText()); + } + } + + DefaultUserPrincipal defaultUserPrincipal = new DefaultUserPrincipal(user_core); + defaultUserPrincipal.setRoleIdList(roleList); + + // 2022-12-21 + JsonNode dataScopeMap = objectNode.get("dataScopeMap"); + if(dataScopeMap != null){ + String functionMenuId = null; + for(Iterator<String> it = dataScopeMap.fieldNames(); it.hasNext();){ + functionMenuId = it.next(); + defaultUserPrincipal.addDataScope(functionMenuId, dataScopeMap.get(functionMenuId).asText()); + } + } + + return defaultUserPrincipal; + }*/ +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/cache/RedisWechatCache.java b/iplatform-base/src/main/java/com/iplatform/base/cache/RedisWechatCache.java new file mode 100644 index 0000000..6d6810c --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/cache/RedisWechatCache.java @@ -0,0 +1,66 @@ +package com.iplatform.base.cache; + +import com.iplatform.base.Constants; +import com.iplatform.base.WechatCacheProvider; +import com.iplatform.base.WechatConstants; +import com.walker.support.redis.cache.RedisCacheProvider; + +/** + * 寰俊鐩稿叧缂撳瓨锛岀敱浜庡瓨鍦ㄧエ鎹�乼oken绛夎繃鏈熻缃紝鍥犳娴嬭瘯涔熼渶瑕佷娇鐢≧edis鏂瑰紡銆� + * @author 鏃跺厠鑻� + * @date 2023-07-16 + */ +public class RedisWechatCache extends RedisCacheProvider<String> implements WechatCacheProvider { + + public RedisWechatCache(){ + this.setUseRedis(true); + this.setLoadPage(false); + // 2024-01-05 璁剧疆鏀寔缂撳瓨澶辨晥锛岃鍙傛暟寰堥噸瑕侊紝濡傛灉闇�瑕佸け鏁堣�屾病鏈夎缃湪璋冪敤鍚庝細鍑虹幇鏁版嵁鏃犳硶澶辨晥锛� + this.setSupportExpiredCache(true); + } + + @Override + public String getMiniAccessToken() { + return this.getCacheData(WechatConstants.REDIS_WECAHT_MINI_ACCESS_TOKEN_KEY); + } + + @Override + public String getJsApiTicket() { + return this.getCacheData(WechatConstants.REDIS_PUBLIC_JS_API_TICKET); + } + + @Override + public String getPublicAccessToken() { + return this.getCacheData(WechatConstants.REDIS_WECAHT_PUBLIC_ACCESS_TOKEN_KEY); + } + + @Override + public void putPublicAccessToken(String value, long expiredSeconds) { + this.putCacheData(WechatConstants.REDIS_WECAHT_PUBLIC_ACCESS_TOKEN_KEY, value, expiredSeconds); + } + + @Override + public void putJsApiTicket(String value) { + this.putCacheData(WechatConstants.REDIS_PUBLIC_JS_API_TICKET, value, WechatConstants.REDIS_PUBLIC_JS_API_TICKET_EXPRESS); + } + + @Override + public void putMiniAccessToken(String value, long expiredSeconds) { + this.putCacheData(WechatConstants.REDIS_WECAHT_MINI_ACCESS_TOKEN_KEY, value, expiredSeconds); + } + + @Override + public void removeMiniAccessToken() { + this.removeCacheData(WechatConstants.REDIS_WECAHT_MINI_ACCESS_TOKEN_KEY); + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_WECHAT; + } + + @Override + public Class<?> getProviderType() { + return String.class; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/callback/AfterLoginCallback.java b/iplatform-base/src/main/java/com/iplatform/base/callback/AfterLoginCallback.java new file mode 100644 index 0000000..ada0cc4 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/callback/AfterLoginCallback.java @@ -0,0 +1,42 @@ +package com.iplatform.base.callback; + +import com.iplatform.base.pojo.RequestLogin; +import com.iplatform.model.po.S_user_core; +import com.walker.infrastructure.ApplicationCallback; +import com.walker.web.UserPrincipal; + + +/** + * 鐢ㄦ埛鐧诲綍鍚庣殑鍥炶皟鍑芥暟瀹氫箟銆� + * @author 鏃跺厠鑻� + * @date 2023-008-18 + */ +public interface AfterLoginCallback extends ApplicationCallback { + + /** + * 鐧诲綍鎴愬姛鏃跺洖璋� + * @param requestLogin + * @param userPrincipal + */ + void onSuccess(RequestLogin requestLogin, UserPrincipal<S_user_core> userPrincipal); + + /** + * 鐧诲綍澶辫触鍥炶皟 + * @param requestLogin + */ + void onFailed(RequestLogin requestLogin); + + /** + * 閫�鍑虹郴缁熷洖璋� + * @param userId + */ + void onLogout(String userId); + + /** + * 榛樿骞冲彴浠呰兘閰嶇疆涓�涓櫥褰曞洖璋冦�� + * @return + */ + default boolean supportMultiple() { + return false; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/callback/GeneralLoginCallback.java b/iplatform-base/src/main/java/com/iplatform/base/callback/GeneralLoginCallback.java new file mode 100644 index 0000000..c5e041e --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/callback/GeneralLoginCallback.java @@ -0,0 +1,92 @@ +package com.iplatform.base.callback; + +import com.iplatform.base.PlatformLoginCallback; +import com.iplatform.base.VariableConstants; +import com.iplatform.base.service.UserServiceImpl; +import com.iplatform.base.util.TokenUtils; +import com.walker.web.CaptchaProvider; +import com.walker.web.CaptchaResult; +import com.walker.web.CaptchaType; +import com.walker.web.TokenException; +import com.walker.web.TokenGenerator; +import com.walker.web.UserOnlineProvider; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public abstract class GeneralLoginCallback implements PlatformLoginCallback { + + protected final transient Logger logger = LoggerFactory.getLogger(getClass()); + + @Override + public boolean isValidateCaptcha() { + // web绔櫥褰曚竴瀹氬瓨鍦ㄩ獙璇佺爜鏂瑰紡 + CaptchaProvider<CaptchaResult> captchaProvider = this.getCaptchaProvider(); + if(captchaProvider == null){ + logger.warn("鐧诲綍鍥炶皟'{}'娌℃湁閰嶇疆'楠岃瘉鐮佹彁渚涜��':CaptchaProvider", this.getClass().getName()); + return false; + } + CaptchaType captchaType = captchaProvider.getCaptchaType(); + logger.debug("captchaType = {}", captchaType); + if(captchaType == CaptchaType.Slide){ + // 婊戝姩楠岃瘉锛屼笉闇�瑕佸悗鍙版牎楠� + logger.debug("slide 楠岃瘉绫诲瀷锛屽悗鍙颁笉闇�瑕佹牎楠屻��"); + return false; + } + if(captchaType == CaptchaType.SmsCode){ + // 鐭俊楠岃瘉鐮侊紝浣滀负瀵嗙爜浣跨敤锛屼笉闇�瑕佸悗鍙伴獙璇� + return false; + } + if(captchaType == CaptchaType.None){ + // 绉诲姩绔洰鍓嶈处鍙枫�佸瘑鐮佺櫥褰曪紝娌℃湁浠讳綍楠岃瘉鐮併��2023-03-20 + return false; + } + // 鍏朵粬閮介渶瑕侀獙璇� + return true; + } + + @Override + public boolean supportMultiple() { + return true; + } + + /** + * 璇ユ柟娉曟殏鏈娇鐢紝鐩墠鐪嬩笉闇�瑕侊紝鎵�鏈夐��鍑烘搷浣滈兘鏄竻绌簍oken鍜岀櫥褰曠紦瀛橈紝鍚庣画鐪嬪叾浠栨槸鍚﹀瓨鍦ㄤ笉涓�鏍锋儏鍐点��2023-01-26 + * @param token 瀹㈡埛绔彁浜ょ殑token + * @throws TokenException + */ + @Deprecated + @Override + public void onLogout(String token) throws TokenException { + String data = tokenGenerator.validateToken(token, VariableConstants.TOKEN_SECRET); + String[] userIdAndKey = TokenUtils.getUserIdAndKey(data); + this.userOnlineProvider.removeUserPrincipal(userIdAndKey[1]); + logger.debug("鐢ㄦ埛 logout success: " + userIdAndKey[0]); + } + + public void setUserOnlineProvider(UserOnlineProvider userOnlineProvider) { + this.userOnlineProvider = userOnlineProvider; + } + + public void setTokenGenerator(TokenGenerator tokenGenerator) { + this.tokenGenerator = tokenGenerator; + } + + public void setUserService(UserServiceImpl userService) { + this.userService = userService; + } + + @Override + public CaptchaProvider<CaptchaResult> getCaptchaProvider() { + return captchaProvider; + } + + @Override + public void setCaptchaProvider(CaptchaProvider<CaptchaResult> captchaProvider) { + this.captchaProvider = captchaProvider; + } + + private CaptchaProvider<CaptchaResult> captchaProvider; + protected UserServiceImpl userService = null; + private UserOnlineProvider userOnlineProvider; + private TokenGenerator tokenGenerator; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/callback/PlatformCallbackPostProcessor.java b/iplatform-base/src/main/java/com/iplatform/base/callback/PlatformCallbackPostProcessor.java new file mode 100644 index 0000000..f18f091 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/callback/PlatformCallbackPostProcessor.java @@ -0,0 +1,120 @@ +package com.iplatform.base.callback; + +import com.iplatform.base.PlatformLoginCallback; +import com.iplatform.base.PlatformUserCallback; +import com.iplatform.base.SystemController; +import com.walker.infrastructure.ApplicationCallback; +import com.walker.infrastructure.ApplicationRuntimeException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.config.BeanPostProcessor; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 搴旂敤绋嬪簭鍚庡鐞嗗櫒 - 鍥炶皟鎺ュ彛鐨勫鐞嗭紝鍚姩鎵弿鎵�鏈夐厤缃殑瀹炵幇绫汇��</p> + * 鍚屾椂鍙互浣跨敤璇ュ璞$殑闈欐�佹柟娉曡幏鍙栨煇涓猙ean銆� + * @author shikeying + * @date 2014-11-25 + * + */ +public class PlatformCallbackPostProcessor implements BeanPostProcessor { + + protected final transient Logger logger = LoggerFactory.getLogger(getClass()); + + /** 鍙湁鍗曚釜瀹炵幇鐨勬墠鏀捐繖閲岄潰 */ + private static final Map<Class<?>, Object> callbackReference = new java.util.HashMap<Class<?>, Object>(4); + + // 2023-01-26 鎵�鏈夊洖璋僢ean瀵硅薄缂撳瓨锛屾棤璁哄崟涓垨澶氫釜瀹炵幇绫诲瀷銆� + private static final Map<String, Object> multipleCallbackBeans = new HashMap<>(8); + + // 杩欓噷鏄郴缁熸敮鎸佺殑鍥炶皟鎺ュ彛瀹氫箟锛屽悗缁紑鍙戜細鍦ㄨ繖閲屾坊鍔犳柊鐨勩�� + private List<Class<?>> callbackList = Arrays.asList(PlatformUserCallback.class + , PlatformLoginCallback.class, UserProfileCallback.class, AfterLoginCallback.class + , SecurityCallback.class); + + // 2023-03-10 闆嗕腑鍒濆鍖� <code>SystemController</code> 涓殑涓�浜涢�氱敤bean + private List<SystemController> systemControllerList = new ArrayList<>(64); + + @Override + public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { + if(ApplicationCallback.class.isAssignableFrom(bean.getClass())){ + String beanClazzName = bean.getClass().getName(); + Object existBean = null; + for(Class<?> callbackClazz : callbackList){ + if(callbackClazz.isAssignableFrom(bean.getClass())){ + if(((ApplicationCallback) bean).supportMultiple()){ + multipleCallbackBeans.put(beanClazzName, bean); + } else { + existBean = callbackReference.get(callbackClazz); + if(existBean != null){ + throw new ApplicationRuntimeException("...... 鍥炶皟瀹炵幇绫诲凡缁忓姞杞斤紝涓嶈兘閲嶅閰嶇疆: " + existBean.getClass().getName()); + } + callbackReference.put(callbackClazz, bean); + } + logger.info("鍔犺浇浜�'CallbackBean'=" + beanClazzName); + } + } + } + else if(SystemController.class.isAssignableFrom(bean.getClass())){ + // 2023 +// logger.debug("+++++++++++++ 鎵惧埌涓�涓� SystemController = {}", bean.getClass().getName()); + this.systemControllerList.add((SystemController)bean); + } + return bean; + } + + @Override + public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { + return bean; + } + + /** + * 杩斿洖缁欏畾鐨勫洖璋冨疄鐜癰ean锛屽鏋滀笉瀛樺湪杩斿洖<code>null</code> + * @param callbackClass 濡�: PlatformUserCallback.class + * @return + */ + public static final <T> T getCallbackObject(Class<T> callbackClass){ + if(callbackClass == null){ + return null; + } + Object bean = callbackReference.get(callbackClass); + if(bean != null){ + return (T)bean; + } + return null; + } + + /** + * 鏍规嵁缁欏畾bean瀹炵幇绫诲瀷锛岃繑鍥炲叿浣撶殑鍥炶皟瀵硅薄銆�<p></p> + * 渚嬪: PlatformLoginCallback浼氬瓨鍦ㄥ涓疄鐜般�� + * @param callbackBean 缁欏畾鐨勭被鍨嬶紝濡�: WebLoginCallback.class + * @return + * @param <T> + * @date 2023-01-26 + */ + public static final <T> T getCallbackMultipleBean(Class<T> callbackBean){ + if(callbackBean == null){ + return null; + } + Object bean = multipleCallbackBeans.get(callbackBean.getName()); + if(bean != null){ + return (T)bean; + } + return null; + } + + /** + * 杩斿洖绯荤粺鏀堕泦鍒扮殑 <code>SystemController</code> 瀵硅薄闆嗗悎銆� + * @return + * @date 2023-03-10 + */ + public List<SystemController> getSystemControllerList(){ + return this.systemControllerList; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/callback/SecurityCallback.java b/iplatform-base/src/main/java/com/iplatform/base/callback/SecurityCallback.java new file mode 100644 index 0000000..e81438f --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/callback/SecurityCallback.java @@ -0,0 +1,69 @@ +package com.iplatform.base.callback; + +import com.iplatform.base.util.menu.SystemMenu; +import com.iplatform.model.po.S_user_core; +import com.walker.infrastructure.ApplicationCallback; + +import java.util.List; +import java.util.Map; +import java.util.Set; + +/** + * 鎺у埗鐢ㄦ埛鑷畾涔夊姞杞界郴缁熻彍鍗曠殑鍥炶皟瀹氫箟銆� + * + * @author 鏃跺厠鑻� + * @date 2023-10-12 + */ +public interface SecurityCallback extends ApplicationCallback { + + /** + * 鏍规嵁 鐢ㄦ埛id鑾峰彇瀵瑰簲鎵�灞炴満鏋刬d + * @param userId + * @return + * @author 鏃跺厠鑻� + * @date 2024-03-06 + */ + Long acquireUserOrgId(long userId); + + /** + * 鐢变笟鍔″悜 MAP 涓瓨鍌ㄨ嚜宸辩殑鐢ㄦ埛淇℃伅锛岃繑鍥炵粰鍓嶇銆� + * + * @param data + * @param user + * @date 2023-10-14 + */ + void acquireUserInfo(Map<String, Object> data, S_user_core user); + + /** + * 鐢ㄦ埛鑷畾涔夊姞杞藉姛鑳芥潈闄愶紝骞冲彴浼氳皟鐢ㄨ鍑芥暟銆� + * <pre> + * 1) 鍦ㄦ帴鍙o細getInfo()涓皟鐢ㄣ�� + * </pre> + * + * @param userCore + * @param menuIdList + * @return + */ + Set<String> loadUserPermission(S_user_core userCore, List<String> menuIdList, Map<String, Object> userInfo); + + /** + * 鐢ㄦ埛鑷畾涔夊姞杞借彍鍗曞垪琛紝骞冲彴浼氬洖璋冭鍑芥暟銆� + * <pre> + * 1) 鍦ㄦ帴鍙o細getMenu()涓皟鐢ㄣ�� + * </pre> + * + * @param userCore 骞冲彴鐢ㄦ埛瀵硅薄 + * @param roleIdList 瑙掕壊ID闆嗗悎 + * @return + */ + List<SystemMenu> loadUserMenu(S_user_core userCore, List<String> roleIdList); + + /** + * 榛樿骞冲彴浠呰兘閰嶇疆涓�涓櫥褰曞洖璋冦�� + * + * @return + */ + default boolean supportMultiple() { + return false; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/callback/TestAfterLoginCallback.java b/iplatform-base/src/main/java/com/iplatform/base/callback/TestAfterLoginCallback.java new file mode 100644 index 0000000..d06d9db --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/callback/TestAfterLoginCallback.java @@ -0,0 +1,28 @@ +package com.iplatform.base.callback; + +import com.iplatform.base.pojo.RequestLogin; +import com.iplatform.model.po.S_user_core; +import com.walker.web.UserPrincipal; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class TestAfterLoginCallback implements AfterLoginCallback{ + + protected final transient Logger logger = LoggerFactory.getLogger(getClass()); + + @Override + public void onSuccess(RequestLogin requestLogin, UserPrincipal<S_user_core> userPrincipal) { + logger.info("鐢ㄦ埛鎴愬姛鐧诲綍锛屽洖璋冿細{}", requestLogin); + } + + @Override + public void onFailed(RequestLogin requestLogin) { + + } + + @Override + public void onLogout(String userId) { + logger.info("鐢ㄦ埛鎴愬姛閫�鍑猴紝鍥炶皟锛歿}", userId); + } + +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/callback/TestUserCallback.java b/iplatform-base/src/main/java/com/iplatform/base/callback/TestUserCallback.java new file mode 100644 index 0000000..9404a15 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/callback/TestUserCallback.java @@ -0,0 +1,31 @@ +package com.iplatform.base.callback; + +import com.iplatform.base.PlatformUserCallback; +import com.iplatform.model.po.S_user_core; + +/** + * 娴嬭瘯瀵硅薄锛屼笉鑳芥敞鍐岄厤缃�� + * @date 2023-01-05 + */ +public class TestUserCallback implements PlatformUserCallback { + + @Override + public void onCreateNewUser(S_user_core user) { + System.out.println("娣诲姞鐢ㄦ埛鍥炶皟: " + user.getUser_name()); + } + + @Override + public void onUpdateUser(S_user_core user) { + System.out.println("鏇存柊鐢ㄦ埛鍥炶皟: " + user.getUser_name()); + } + + @Override + public void onDeleteUser(long userId) { + System.out.println("鍒犻櫎鐢ㄦ埛鍥炶皟: " + userId); + } + + @Override + public boolean supportMultiple() { + return false; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/callback/UserProfileCallback.java b/iplatform-base/src/main/java/com/iplatform/base/callback/UserProfileCallback.java new file mode 100644 index 0000000..5847feb --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/callback/UserProfileCallback.java @@ -0,0 +1,16 @@ +package com.iplatform.base.callback; + +import com.iplatform.base.pojo.UserInfoRequest; +import com.iplatform.model.po.S_user_core; +import com.walker.infrastructure.ApplicationCallback; + +/** + * 淇敼鐢ㄦ埛璧勬枡鍥炶皟鎺ュ彛瀹氫箟銆� + * <p>褰撳湪骞冲彴锛岀敤鎴蜂慨鏀逛釜浜轰俊鎭椂锛屽寘鎷細濮撳悕銆佸瘑鐮併�佺瓑涓汉璧勬枡銆�</p> + * @author 鏃跺厠鑻� + * @date 2023-08-03 + */ +public interface UserProfileCallback extends ApplicationCallback { + + void onUpdateUser(S_user_core user, UserInfoRequest request); +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/captcha/AbstractCaptchaProvider.java b/iplatform-base/src/main/java/com/iplatform/base/captcha/AbstractCaptchaProvider.java new file mode 100644 index 0000000..5f27e83 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/captcha/AbstractCaptchaProvider.java @@ -0,0 +1,78 @@ +package com.iplatform.base.captcha; + +import com.iplatform.base.util.CaptchaUtils; +import com.walker.cache.CacheProvider; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.web.CaptchaProvider; +import com.walker.web.CaptchaResult; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.core.io.DefaultResourceLoader; +import org.springframework.core.io.ResourceLoader; + +import javax.imageio.ImageIO; +import java.awt.Font; +import java.awt.image.BufferedImage; +import java.util.Map; +import java.util.Random; +import java.util.concurrent.ConcurrentHashMap; + +public abstract class AbstractCaptchaProvider implements CaptchaProvider<CaptchaResult> { + + protected final transient Logger logger = LoggerFactory.getLogger(this.getClass()); + + protected final ResourceLoader resourceLoader = new DefaultResourceLoader(); + + // 鎵�鏈夐獙璇佸浘鐗囬兘鍔犲叆鍐呭瓨锛岄檷浣庣鐩樿鍐� +// protected Map<String, BufferedImage> imageCacheMap = new ConcurrentHashMap<>(32); + + protected final Random bgRandom = new Random(); + protected final Random blockRandom = new Random(); + + protected static final String IMAGE_TYPE_PNG = "png"; + protected static final String IMAGE_TYPE_JPG = "jpg"; + // 璇ュ瓧娈靛惈涔変笉璇︼紒 + protected static int captchaInterferenceOptions = 0; + + protected static final int SLIP_OFFSET = 6; + + protected static String waterMark = "鎴戠殑姘村嵃"; + protected static String waterMarkFontStr = "WenQuanZhengHei.ttf"; + protected Font waterMarkFont;//姘村嵃瀛椾綋 + + @Override + public boolean validateCaptcha(CaptchaResult data) { + String verifyKey = CaptchaUtils.getVerifyKey(data); + String xSource = this.captchaCacheProvider.getCacheData(verifyKey); + if(StringUtils.isEmpty(xSource)){ + logger.error("鎷煎浘楠岃瘉淇℃伅宸插け鏁�!"); + return false; + } + + // 鍒犻櫎缂撳瓨鐨勯獙璇佺爜 + // 娉ㄦ剰锛氳繖閲屼笉鑳藉垹闄ょ紦瀛橀獙璇佺粨鏋滐紝鍥犱负鐧诲綍鎺ュ彛杩樿鍐嶆浣跨敤銆�2023-04-07 +// this.captchaCacheProvider.removeCacheData(verifyKey); + + // 鍓嶇浼犺繃鏉ョ殑鏁板瓧锛屽彲鑳藉寘鍚皬鏁帮紝鎵�浠ヤ笉鑳界洿鎺�'Integer.parseInt'杞崲銆� + int xValidate = Double.valueOf(data.getCode()).intValue(); + int xGenerate = Integer.parseInt(xSource); + + if ((xValidate - xGenerate) <= SLIP_OFFSET && (xValidate - xGenerate) >= -SLIP_OFFSET) { + return true; + } + return false; + } + + BufferedImage loadBufferedImage(String imageName) throws Exception{ + if(StringUtils.isEmpty(imageName)){ + throw new IllegalArgumentException("楠岃瘉鐮佸浘鐗囧悕绉板弬鏁扮己澶憋細imageName"); + } + return ImageIO.read(resourceLoader.getResource(imageName).getInputStream()); + } + + public void setCaptchaCacheProvider(CacheProvider<String> captchaCacheProvider) { + this.captchaCacheProvider = captchaCacheProvider; + } + + protected CacheProvider<String> captchaCacheProvider; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/captcha/BlockPuzzleCaptchaProvider.java b/iplatform-base/src/main/java/com/iplatform/base/captcha/BlockPuzzleCaptchaProvider.java new file mode 100644 index 0000000..b4c6743 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/captcha/BlockPuzzleCaptchaProvider.java @@ -0,0 +1,375 @@ +package com.iplatform.base.captcha; + +import com.iplatform.base.PlatformRuntimeException; +import com.iplatform.base.util.RandomUtils; +import com.iplatform.base.util.VerifyImgUtil; +import com.walker.infrastructure.utils.Base64Utils; +import com.walker.web.CaptchaResult; +import com.walker.web.CaptchaType; +import com.walker.web.util.IdUtils; + +import javax.imageio.ImageIO; +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.RenderingHints; +import java.awt.Transparency; +import java.awt.image.BufferedImage; +import java.io.ByteArrayOutputStream; +import java.util.Objects; +import java.util.Random; + +/** + * 鐢靛晢妯″潡浣跨敤鐨勬嫾鍥鹃獙璇侊紝鎻愪緵鑰呭疄鐜般�� + * @author 鏃跺厠鑻� + * @date 2023-06-27 + */ +public class BlockPuzzleCaptchaProvider extends AbstractCaptchaProvider{ + + private final static int IMAGE_BG_SIZE = 6; + + public BlockPuzzleCaptchaProvider(){ +// String imageName = null; +// try{ +// BufferedImage image = null; +// for(int i=1; i<IMAGE_BG_SIZE+1; i++){ +// imageName = "images/jigsaw/original/" + i + ".png"; +// image = this.loadBufferedImage(imageName); +// this.imageCacheMap.put(imageName, image); +// } +// +// for(int j=1; j<IMAGE_BG_SIZE+1; j++){ +// imageName = "images/jigsaw/slidingBlock/" + j + ".png"; +// image = this.loadBufferedImage(imageName); +// this.imageCacheMap.put(imageName, image); +// } +// logger.info("鍏卞姞杞介獙璇佺爜鎷煎浘鏂囦欢'{}'涓�", this.imageCacheMap.size()); +// +// } catch (Exception ex){ +// throw new ApplicationRuntimeException("楠岃瘉鐮佸浘鐗囧姞杞介敊璇紝imageName=" + imageName, ex); +// } + } + + @Override + public CaptchaResult generateCaptcha(Object param) { + int n = this.bgRandom.nextInt(IMAGE_BG_SIZE) + 1; //鑳屾櫙 + int m = this.blockRandom.nextInt(IMAGE_BG_SIZE) + 1; //婊戝潡 + if(n > IMAGE_BG_SIZE){ + n = IMAGE_BG_SIZE; + } + if(m > IMAGE_BG_SIZE){ + m = IMAGE_BG_SIZE; + } + + try{ + //鍘熷浘 + String sourceName = "images/jigsaw/original/" + n + ".png"; + // 娉ㄦ剰锛氫笉鑳介噸澶嶄娇鐢ㄧ紦瀛樺浘鐗囷紝鍥犱负闇�瑕佷慨鏀瑰浘鐗囪儗鏅紝鎵�浠ュ繀椤绘瘡娆″姞杞藉師濮嬪浘鐗囥�� +// BufferedImage sourceImg = this.imageCacheMap.get(sourceName); + BufferedImage sourceImg = this.loadBufferedImage(sourceName); + //鎶犲浘妯$増 + String blockName = "images/jigsaw/slidingBlock/" + m + ".png"; +// BufferedImage templateImg = this.imageCacheMap.get(blockName); + BufferedImage templateImg = this.loadBufferedImage(blockName); + if(sourceImg == null || templateImg == null){ + logger.error("鏈姞杞藉埌鎷煎浘楠岃瘉鍥剧墖璧勬簮:" + sourceName + ", or " + blockName); + return null; + } + return this.pictureTemplatesCut(sourceImg, templateImg, VerifyImgUtil.getBase64(templateImg)); + + } catch (Exception ex){ + throw new PlatformRuntimeException("鎷煎浘楠岃瘉鐢熸垚澶辫触锛�" + ex.getMessage(), ex); + } + } + +// @Override +// public boolean validateCaptcha(CaptchaResult data) { +// return false; +// } + + @Override + public CaptchaType getCaptchaType() { + return CaptchaType.JigsawMobile; + } + + private JigsawResult pictureTemplatesCut(BufferedImage originalImage, BufferedImage jigsawImage, String jigsawImageBase64) { + JigsawResult jigsawResult = new JigsawResult(); + try { +// CaptchaVO dataVO = new CaptchaVO(); + int originalWidth = originalImage.getWidth(); + int originalHeight = originalImage.getHeight(); + int jigsawWidth = jigsawImage.getWidth(); + int jigsawHeight = jigsawImage.getHeight(); + + //闅忔満鐢熸垚鎷煎浘鍧愭爣 + jigsawResult = generateJigsawPoint(originalWidth, originalHeight, jigsawWidth, jigsawHeight); + int x = jigsawResult.getX(); + int y = jigsawResult.getY(); + + //鐢熸垚鏂扮殑鎷煎浘鍥惧儚 + BufferedImage newJigsawImage = new BufferedImage(jigsawWidth, jigsawHeight, jigsawImage.getType()); + Graphics2D graphics = newJigsawImage.createGraphics(); + + int bold = 5; + //濡傛灉闇�瑕佺敓鎴怰GB鏍煎紡锛岄渶瑕佸仛濡備笅閰嶇疆,Transparency 璁剧疆閫忔槑 + newJigsawImage = graphics.getDeviceConfiguration().createCompatibleImage(jigsawWidth, jigsawHeight, Transparency.TRANSLUCENT); + // 鏂板缓鐨勫浘鍍忔牴鎹ā鏉块鑹茶祴鍊�,婧愬浘鐢熸垚閬僵 + cutByTemplate(originalImage, jigsawImage, newJigsawImage, x, 0); + if (captchaInterferenceOptions > 0) { + int position = 0; + if (originalWidth - x - 5 > jigsawWidth * 2) { + //鍦ㄥ師鎵e浘鍙宠竟鎻掑叆骞叉壈鍥� + position = RandomUtils.getRandomInt(x + jigsawWidth + 5, originalWidth - jigsawWidth); + } else { + //鍦ㄥ師鎵e浘宸﹁竟鎻掑叆骞叉壈鍥� + position = RandomUtils.getRandomInt(100, x - jigsawWidth - 5); + } + while (true) { +// String s = ImageUtils.getslidingBlock(); + String s = this.getSlidingBlock(); + if (!jigsawImageBase64.equals(s)) { + interferenceByTemplate(originalImage, Objects.requireNonNull(VerifyImgUtil.getBase64StrToImage(s)), position, 0); + break; + } + } + } + if (captchaInterferenceOptions > 1) { + while (true) { + String s = this.getSlidingBlock(); + if (!jigsawImageBase64.equals(s)) { + Integer randomInt = RandomUtils.getRandomInt(jigsawWidth, 100 - jigsawWidth); + interferenceByTemplate(originalImage, Objects.requireNonNull(VerifyImgUtil.getBase64StrToImage(s)), + randomInt, 0); + break; + } + } + } + + // 璁剧疆鈥滄姉閿娇鈥濈殑灞炴�� + graphics.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + graphics.setStroke(new BasicStroke(bold, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL)); + graphics.drawImage(newJigsawImage, 0, 0, null); + graphics.dispose(); + + ByteArrayOutputStream os = new ByteArrayOutputStream();//鏂板缓娴併�� + ImageIO.write(newJigsawImage, IMAGE_TYPE_PNG, os);//鍒╃敤ImageIO绫绘彁渚涚殑write鏂规硶锛屽皢bi浠ng鍥剧墖鐨勬暟鎹ā寮忓啓鍏ユ祦銆� + byte[] jigsawImages = os.toByteArray(); + + ByteArrayOutputStream oriImagesOs = new ByteArrayOutputStream();//鏂板缓娴併�� + ImageIO.write(originalImage, IMAGE_TYPE_JPG, oriImagesOs);//鍒╃敤ImageIO绫绘彁渚涚殑write鏂规硶锛屽皢bi浠pg鍥剧墖鐨勬暟鎹ā寮忓啓鍏ユ祦銆� + byte[] oriCopyImages = oriImagesOs.toByteArray(); +// Base64.Encoder encoder = Base64.getEncoder(); +// dataVO.setOriginalImageBase64(encoder.encodeToString(oriCopyImages).replaceAll("\r|\n", "")); + jigsawResult.setImageSourceBase64(Base64Utils.encode(oriCopyImages)); + //point淇℃伅涓嶄紶鍒板墠绔紝鍙仛鍚庣check鏍¢獙 +// dataVO.setPoint(point); +// dataVO.setJigsawImageBase64(encoder.encodeToString(jigsawImages).replaceAll("\r|\n", "")); + jigsawResult.setImageBlockBase64(Base64Utils.encode(jigsawImages)); +// dataVO.setToken(RandomUtils.getUUID()); + jigsawResult.setUuid(IdUtils.simpleUUID()); +// dataVO.setSecretKey(point.getSecretKey()); +// base64StrToImage(encoder.encodeToString(oriCopyImages), "D:\\鍘熷浘.png"); +// base64StrToImage(encoder.encodeToString(jigsawImages), "D:\\婊戝姩.png"); + + //灏嗗潗鏍囦俊鎭瓨鍏edis涓� +// String codeKey = String.format(REDIS_CAPTCHA_KEY, dataVO.getToken()); +// CaptchaServiceFactory.getCache(cacheType).set(codeKey, JsonUtil.toJSONString(point), EXPIRESIN_SECONDS); + logger.debug("token锛歿},point:{}", jigsawResult.getUuid(), jigsawResult.getX(), jigsawResult.getY()); + return jigsawResult; + + } catch (Exception e) { + logger.error("鐢熸垚楠岃瘉鎷煎浘閿欒锛�" + e.getMessage(), e); + return null; + } + } + + private String getSlidingBlock() throws Exception{ +// String[] strings = fileNameMap.get(CaptchaBaseMapEnum.SLIDING_BLOCK.getCodeValue()); +// if (null == strings || strings.length == 0) { +// return null; +// } + Integer randomInt = RandomUtils.getRandomInt(0, IMAGE_BG_SIZE); + String blockName = "images/jigsaw/slidingBlock/" + randomInt + ".png"; +// BufferedImage image = this.imageCacheMap.get(blockName); + BufferedImage image = this.loadBufferedImage(blockName); + if(image == null){ + image = this.loadBufferedImage("images/jigsaw/slidingBlock/1.png"); + } + return VerifyImgUtil.getBase64(image); + } + + /** + * 闅忔満鐢熸垚鎷煎浘鍧愭爣 + * + * @param originalWidth + * @param originalHeight + * @param jigsawWidth + * @param jigsawHeight + * @return + */ + private static JigsawResult generateJigsawPoint(int originalWidth, int originalHeight, int jigsawWidth, int jigsawHeight) { + Random random = new Random(); + int widthDifference = originalWidth - jigsawWidth; + int heightDifference = originalHeight - jigsawHeight; + int x, y = 0; + if (widthDifference <= 0) { + x = 5; + } else { + x = random.nextInt(originalWidth - jigsawWidth - 100) + 100; + } + if (heightDifference <= 0) { + y = 5; + } else { + y = random.nextInt(originalHeight - jigsawHeight) + 5; + } +// String key = null; +// if (captchaAesStatus) { +// key = AESUtil.getKey(); +// } +// return new PointVO(x, y, key); + JigsawResult jigsawResult = new JigsawResult(); + jigsawResult.setX(x); + jigsawResult.setY(y); + return jigsawResult; + } + + /** + * @param oriImage 鍘熷浘 + * @param templateImage 妯℃澘鍥� + * @param newImage 鏂版姞鍑虹殑灏忓浘 + * @param x 闅忔満鎵e彇鍧愭爣X + * @param y 闅忔満鎵e彇鍧愭爣y + * @throws Exception + */ + private static void cutByTemplate(BufferedImage oriImage, BufferedImage templateImage, BufferedImage newImage, int x, int y) { + //涓存椂鏁扮粍閬嶅巻鐢ㄤ簬楂樻柉妯$硦瀛樺懆杈瑰儚绱犲�� + int[][] martrix = new int[3][3]; + int[] values = new int[9]; + + int xLength = templateImage.getWidth(); + int yLength = templateImage.getHeight(); + // 妯℃澘鍥惧儚瀹藉害 + for (int i = 0; i < xLength; i++) { + // 妯℃澘鍥剧墖楂樺害 + for (int j = 0; j < yLength; j++) { + // 濡傛灉妯℃澘鍥惧儚褰撳墠鍍忕礌鐐逛笉鏄�忔槑鑹� copy婧愭枃浠朵俊鎭埌鐩爣鍥剧墖涓� + int rgb = templateImage.getRGB(i, j); + if (rgb < 0) { + newImage.setRGB(i, j, oriImage.getRGB(x + i, y + j)); + + //鎶犲浘鍖哄煙楂樻柉妯$硦 + readPixel(oriImage, x + i, y + j, values); + fillMatrix(martrix, values); + oriImage.setRGB(x + i, y + j, avgMatrix(martrix)); + } + + //闃叉鏁扮粍瓒婄晫鍒ゆ柇 + if (i == (xLength - 1) || j == (yLength - 1)) { + continue; + } + int rightRgb = templateImage.getRGB(i + 1, j); + int downRgb = templateImage.getRGB(i, j + 1); + //鎻忚竟澶勭悊锛�,鍙栧甫鍍忕礌鍜屾棤鍍忕礌鐨勭晫鐐癸紝鍒ゆ柇璇ョ偣鏄笉鏄复鐣岃疆寤撶偣,濡傛灉鏄缃鍧愭爣鍍忕礌鏄櫧鑹� + if ((rgb >= 0 && rightRgb < 0) || (rgb < 0 && rightRgb >= 0) || (rgb >= 0 && downRgb < 0) || (rgb < 0 && downRgb >= 0)) { + newImage.setRGB(i, j, Color.white.getRGB()); + oriImage.setRGB(x + i, y + j, Color.white.getRGB()); + } + } + } + } + + private static void readPixel(BufferedImage img, int x, int y, int[] pixels) { + int xStart = x - 1; + int yStart = y - 1; + int current = 0; + for (int i = xStart; i < 3 + xStart; i++) { + for (int j = yStart; j < 3 + yStart; j++) { + int tx = i; + if (tx < 0) { + tx = -tx; + + } else if (tx >= img.getWidth()) { + tx = x; + } + int ty = j; + if (ty < 0) { + ty = -ty; + } else if (ty >= img.getHeight()) { + ty = y; + } + pixels[current++] = img.getRGB(tx, ty); + } + } + } + + private static void fillMatrix(int[][] matrix, int[] values) { + int filled = 0; + for (int i = 0; i < matrix.length; i++) { + int[] x = matrix[i]; + for (int j = 0; j < x.length; j++) { + x[j] = values[filled++]; + } + } + } + + private static int avgMatrix(int[][] matrix) { + int r = 0; + int g = 0; + int b = 0; + for (int i = 0; i < matrix.length; i++) { + int[] x = matrix[i]; + for (int j = 0; j < x.length; j++) { + if (j == 1) { + continue; + } + Color c = new Color(x[j]); + r += c.getRed(); + g += c.getGreen(); + b += c.getBlue(); + } + } + return new Color(r / 8, g / 8, b / 8).getRGB(); + } + + /** + * 骞叉壈鎶犲浘澶勭悊 + * + * @param oriImage 鍘熷浘 + * @param templateImage 妯℃澘鍥� + * @param x 闅忔満鎵e彇鍧愭爣X + * @param y 闅忔満鎵e彇鍧愭爣y + * @throws Exception + */ + private static void interferenceByTemplate(BufferedImage oriImage, BufferedImage templateImage, int x, int y) { + //涓存椂鏁扮粍閬嶅巻鐢ㄤ簬楂樻柉妯$硦瀛樺懆杈瑰儚绱犲�� + int[][] martrix = new int[3][3]; + int[] values = new int[9]; + + int xLength = templateImage.getWidth(); + int yLength = templateImage.getHeight(); + // 妯℃澘鍥惧儚瀹藉害 + for (int i = 0; i < xLength; i++) { + // 妯℃澘鍥剧墖楂樺害 + for (int j = 0; j < yLength; j++) { + // 濡傛灉妯℃澘鍥惧儚褰撳墠鍍忕礌鐐逛笉鏄�忔槑鑹� copy婧愭枃浠朵俊鎭埌鐩爣鍥剧墖涓� + int rgb = templateImage.getRGB(i, j); + if (rgb < 0) { + //鎶犲浘鍖哄煙楂樻柉妯$硦 + readPixel(oriImage, x + i, y + j, values); + fillMatrix(martrix, values); + oriImage.setRGB(x + i, y + j, avgMatrix(martrix)); + } + //闃叉鏁扮粍瓒婄晫鍒ゆ柇 + if (i == (xLength - 1) || j == (yLength - 1)) { + continue; + } + int rightRgb = templateImage.getRGB(i + 1, j); + int downRgb = templateImage.getRGB(i, j + 1); + //鎻忚竟澶勭悊锛�,鍙栧甫鍍忕礌鍜屾棤鍍忕礌鐨勭晫鐐癸紝鍒ゆ柇璇ョ偣鏄笉鏄复鐣岃疆寤撶偣,濡傛灉鏄缃鍧愭爣鍍忕礌鏄櫧鑹� + if ((rgb >= 0 && rightRgb < 0) || (rgb < 0 && rightRgb >= 0) || (rgb >= 0 && downRgb < 0) || (rgb < 0 && downRgb >= 0)) { + oriImage.setRGB(x + i, y + j, Color.white.getRGB()); + } + } + } + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/captcha/DefaultCaptchaProvider.java b/iplatform-base/src/main/java/com/iplatform/base/captcha/DefaultCaptchaProvider.java new file mode 100644 index 0000000..49eb4b7 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/captcha/DefaultCaptchaProvider.java @@ -0,0 +1,37 @@ +package com.iplatform.base.captcha; + +import com.iplatform.base.util.CaptchaUtils; +import com.iplatform.core.BeanContextAware; +import com.walker.cache.CacheProvider; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.support.kaptcha.SimpleKaptchaProvider; +import com.walker.web.CaptchaResult; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 閲嶆柊瀹炵幇楠岃瘉鐮� 楠岃瘉鏂规硶锛屼箣鍓嶄竴鐩存病鏈変娇鐢紝杩欐缁熶竴浣跨敤鎻愪緵鑰呴獙璇併�� + * @author 鏃跺厠鑻� + * @date 2023-04-07 + */ +public class DefaultCaptchaProvider extends SimpleKaptchaProvider { + + protected final transient Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Override + public boolean validateCaptcha(CaptchaResult data) { + String verifyKey = CaptchaUtils.getVerifyKey(data); + CacheProvider<String> captchaCacheProvider = (CacheProvider<String>) BeanContextAware.getBeanByName("captchaCacheProvider"); + String codeGenerate = captchaCacheProvider.getCacheData(verifyKey); + if(StringUtils.isEmpty(codeGenerate)){ + logger.error("DefaultCaptchaProvider锛氬浘鍍忛獙璇佷俊鎭凡澶辨晥!"); + return false; + } + + if(codeGenerate.equalsIgnoreCase(data.getCode())){ + logger.debug("鍥惧儚楠岃瘉閫氳繃锛歿}", data.getCode()); + return true; + } + return false; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/captcha/JigsawCaptchaProvider.java b/iplatform-base/src/main/java/com/iplatform/base/captcha/JigsawCaptchaProvider.java new file mode 100644 index 0000000..cf1fe8e --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/captcha/JigsawCaptchaProvider.java @@ -0,0 +1,101 @@ +package com.iplatform.base.captcha; + +import com.iplatform.base.util.VerifyImgUtil; +import com.walker.web.CaptchaResult; +import com.walker.web.CaptchaType; + +import java.awt.image.BufferedImage; +import java.util.Map; + +/** + * 鎷煎浘婊戝姩楠岃瘉鐮侊紝鎻愪緵鑰呭疄鐜般��<p></p> + * 鎵�鏈夐獙璇佹嫾鍥惧浘鍍忓湪鍒濆鍖栨椂鍔犺浇濡傚唴瀛橈紝鎻愰珮鎬ц兘銆� + * @author 鏃跺厠鑻� + * @date 2023-04-06 + */ +//public class JigsawCaptchaProvider implements CaptchaProvider<CaptchaResult> { +public class JigsawCaptchaProvider extends AbstractCaptchaProvider { + + private final static int IMAGE_BG_SIZE = 10; + private final static int IMAGE_BLOCK_SIZE = 21; + + /** + * 涓嶈兘缂撳瓨鍥剧墖锛屽洜涓鸿鍦ㄥ師鍥句笂鎵h儗鏅紝鍥犳蹇呴』姣忔鍔犺浇鍘熷鍥剧墖銆� + * @date 2023-06-27 + */ + public JigsawCaptchaProvider(){ +// String imageName = null; +// try{ +// BufferedImage image = null; +// for(int i=1; i<IMAGE_BG_SIZE+2; i++){ +// imageName = "images/jigsaw_bg/" + i + ".jpg"; +// image = this.loadBufferedImage(imageName); +// this.imageCacheMap.put(imageName, image); +// } +// +// for(int j=1; j<IMAGE_BLOCK_SIZE+2; j++){ +// imageName = "images/jigsaw_block/" + j + ".png"; +// image = this.loadBufferedImage(imageName); +// this.imageCacheMap.put(imageName, image); +// } +// logger.info("鍏卞姞杞介獙璇佺爜鎷煎浘鏂囦欢'{}'涓�", this.imageCacheMap.size()); +// +// } catch (Exception ex){ +// throw new ApplicationRuntimeException("楠岃瘉鐮佸浘鐗囧姞杞介敊璇紝imageName=" + imageName, ex); +// } + } + + @Override + public CaptchaResult generateCaptcha(Object param) { + int n = this.bgRandom.nextInt(10) + 1; //鑳屾櫙 + int m = this.blockRandom.nextInt(21) + 1; //婊戝潡 + + try{ + //鍘熷浘 + String sourceName = "images/jigsaw_bg/" + n + ".jpg"; +// BufferedImage sourceImg = this.imageCacheMap.get(sourceName); + BufferedImage sourceImg = this.loadBufferedImage(sourceName); + //鎶犲浘妯$増 + String blockName = "images/jigsaw_block/" + m + ".png"; + BufferedImage templateImg = this.loadBufferedImage(blockName); + if(sourceImg == null || templateImg == null){ + logger.error("鏈姞杞藉埌鎷煎浘楠岃瘉鍥剧墖璧勬簮:" + sourceName + ", or " + blockName); + return null; + } + + int w = templateImg.getWidth(); + int h = templateImg.getHeight(); + + //鑾峰彇鎶犲浘鍧愭爣 + Map<String, Integer> coord = VerifyImgUtil.generateCutoutCoordinates(w, h); + int x = coord.get("x"); + int y = coord.get("y"); + + //鑾峰彇鎶犲浘鍥惧舰鐭╅樀 + int[][] templateData = VerifyImgUtil.getTemplateData(templateImg); + //鎶犲浘 + Map<String, BufferedImage> r = VerifyImgUtil.initSlidingBlock(sourceImg, templateData, x, y, w, h); + +// Map result = new HashMap(); +// result.put("y", y); +// result.put("slider", VerifyImgUtil.getBase64(r.get("newTemplateImg"))); +// result.put("bg", VerifyImgUtil.getBase64(r.get("newSourceImg"))); + + JigsawResult jigsawResult = new JigsawResult(); + jigsawResult.setX(x); + jigsawResult.setY(y); + jigsawResult.setImageSourceBase64(VerifyImgUtil.getBase64(r.get("newSourceImg"))); + jigsawResult.setImageBlockBase64(VerifyImgUtil.getBase64(r.get("newTemplateImg"))); + return jigsawResult; + + } catch (Exception ex){ + logger.error("澶勭悊鎷煎浘楠岃瘉鍥惧儚閿欒, blockName={}", ex); + return null; + } + } + + @Override + public CaptchaType getCaptchaType() { + return CaptchaType.Jigsaw; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/captcha/JigsawResult.java b/iplatform-base/src/main/java/com/iplatform/base/captcha/JigsawResult.java new file mode 100644 index 0000000..6171b4c --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/captcha/JigsawResult.java @@ -0,0 +1,48 @@ +package com.iplatform.base.captcha; + +import com.walker.web.CaptchaResult; + +/** + * 鎷煎浘婊戝潡鐨勯獙璇佽繑鍥炵粨鏋滐紝鍥犱负闈炲父鐗规畩锛屾墍浠ラ渶瑕佸畾鍒躲�� + * @author 鏃跺厠鑻� + * @date 2023-04-06 + */ +public class JigsawResult extends CaptchaResult { + + public int getX() { + return x; + } + + public void setX(int x) { + this.x = x; + } + + public int getY() { + return y; + } + + public void setY(int y) { + this.y = y; + } + + public String getImageSourceBase64() { + return imageSourceBase64; + } + + public void setImageSourceBase64(String imageSourceBase64) { + this.imageSourceBase64 = imageSourceBase64; + } + + public String getImageBlockBase64() { + return imageBlockBase64; + } + + public void setImageBlockBase64(String imageBlockBase64) { + this.imageBlockBase64 = imageBlockBase64; + } + + private int x = 0; + private int y = 0; + private String imageSourceBase64; + private String imageBlockBase64; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/captcha/NoneCaptchaProvider.java b/iplatform-base/src/main/java/com/iplatform/base/captcha/NoneCaptchaProvider.java new file mode 100644 index 0000000..019dcb3 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/captcha/NoneCaptchaProvider.java @@ -0,0 +1,29 @@ +package com.iplatform.base.captcha; + +import com.walker.web.CaptchaProvider; +import com.walker.web.CaptchaResult; +import com.walker.web.CaptchaType; + +/** + * 绌虹殑楠岃瘉鐮佹彁渚涜�咃紝鎵嬫満绔瘑鐮佺櫥褰曪紝娌℃湁浠讳綍楠岃瘉鐮侊紙鏆傛椂锛夈�� + * @author 鏃跺厠鑻� + * @date 2023-03-20 + */ +public class NoneCaptchaProvider implements CaptchaProvider<CaptchaResult> { + + @Override + public CaptchaResult generateCaptcha(Object param) { + return null; + } + + @Override + public boolean validateCaptcha(CaptchaResult data) { + // 姘歌繙鎴愬姛 + return true; + } + + @Override + public CaptchaType getCaptchaType() { + return CaptchaType.None; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/captcha/SmsCaptchaProvider.java b/iplatform-base/src/main/java/com/iplatform/base/captcha/SmsCaptchaProvider.java new file mode 100644 index 0000000..5d733e9 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/captcha/SmsCaptchaProvider.java @@ -0,0 +1,83 @@ +package com.iplatform.base.captcha; + +import com.iplatform.base.push.DefaultPushManager; +import com.iplatform.base.util.CaptchaUtils; +import com.iplatform.base.util.NotificationUtils; +import com.iplatform.core.BeanContextAware; +import com.walker.cache.CacheProvider; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.push.Notification; +import com.walker.push.PushManager; +import com.walker.web.CaptchaProvider; +import com.walker.web.CaptchaResult; +import com.walker.web.CaptchaType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 妯℃嫙鐭俊鐨� 楠岃瘉鐮佹彁渚涜�呭疄鐜般�� + * @author 鏃跺厠鑻� + * @date 2023-01-27 + * @date 2023-04-25 閲嶆瀯涓烘寮忕煭淇¢獙璇佹彁渚涜�咃紝鐢辨帹閫佺鐞嗗櫒閫夋嫨鐭俊閫氶亾锛堟寮忋�佹ā鎷燂紝鏍规嵁閰嶇疆鍙傛暟鏉ワ級 + */ +public class SmsCaptchaProvider implements CaptchaProvider<CaptchaResult> { + + protected final Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Override + public CaptchaResult generateCaptcha(Object param) { + if(param == null){ + throw new IllegalArgumentException("鎵嬫満鍙风爜蹇呴』鎻愪緵"); + } + String mobile = param.toString(); + if(StringUtils.isEmpty(mobile)){ + throw new IllegalArgumentException("鎵嬫満鍙风爜涓虹┖锛屾棤娉曞彂閫侀獙璇佺煭淇�"); + } + + // 鐢熸垚妯℃嫙鐭俊楠岃瘉鐮�(4浣嶆暟瀛�) + String code = StringUtils.generateRandomNumber(4); + + // 2023-04-25锛岃皟鐢ㄧ煭淇℃帹閫佽�� + // 鐢变簬楠岃瘉鐮佺洿鎺ユ彁渚涚殑鎵嬫満鍙凤紝鎵�浠ヨ繖閲岀洰鏍囩敤鎴锋棤娉曞彇鍒帮紝鍙兘鐢ㄦ墜鏈哄彿銆� + if(this.pushManager instanceof DefaultPushManager){ + ((DefaultPushManager)this.pushManager).pushSmsValidateCode(code, mobile, "creator"); + } else { + Notification notification = NotificationUtils.acquireSmsValidateCode("templateId", code, mobile, "creator"); + // 2023-04-27 楠岃瘉鐮佷笉淇濆瓨鏁版嵁搴� + notification.setPersistent(false); + this.pushManager.pushSms(notification); + } + + CaptchaResult captchaResult = new CaptchaResult(); + captchaResult.setCode(code); + captchaResult.setImage(null); + + return captchaResult; + } + + @Override + public boolean validateCaptcha(CaptchaResult data) { + CacheProvider<String> captchaCacheProvider = (CacheProvider<String>) BeanContextAware.getBeanByName("captchaCacheProvider"); + String smsCodeGenerate = captchaCacheProvider.getCacheData(CaptchaUtils.getVerifyKey(data)); + if(StringUtils.isEmpty(smsCodeGenerate)){ + logger.error("SmsCaptchaProvider锛氱煭淇¢獙璇佷俊鎭凡澶辨晥!"); + return false; + } + if(smsCodeGenerate.equals(data.getCode())){ + logger.debug("app楠岃瘉瀵嗙爜鎴愬姛锛宻msCode={}, input={}", smsCodeGenerate, data.getCode()); + return true; + } + return false; + } + + @Override + public CaptchaType getCaptchaType() { + return CaptchaType.SmsCode; + } + + public void setPushManager(PushManager pushManager) { + this.pushManager = pushManager; + } + + private PushManager pushManager; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/captcha/TextCaptchaProvider.java b/iplatform-base/src/main/java/com/iplatform/base/captcha/TextCaptchaProvider.java new file mode 100644 index 0000000..1c3e5dd --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/captcha/TextCaptchaProvider.java @@ -0,0 +1,37 @@ +package com.iplatform.base.captcha; + +import com.iplatform.base.util.CaptchaUtils; +import com.iplatform.core.BeanContextAware; +import com.walker.cache.CacheProvider; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.support.kaptcha.WordCaptchaProvider; +import com.walker.web.CaptchaResult; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 鏅�氬瓧绗﹂獙璇佺爜瀹炵幇銆� + * @author 鏃跺厠鑻� + * @date 2023-05-12 + */ +public class TextCaptchaProvider extends WordCaptchaProvider { + + protected final transient Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Override + public boolean validateCaptcha(CaptchaResult data) { +// String verifyKey = CaptchaUtils.getVerifyKey(data); + CacheProvider<String> captchaCacheProvider = (CacheProvider<String>) BeanContextAware.getBeanByName("captchaCacheProvider"); + String codeGenerate = captchaCacheProvider.getCacheData(CaptchaUtils.getVerifyKey(data)); + if(StringUtils.isEmpty(codeGenerate)){ + logger.error("DefaultCaptchaProvider锛氬浘鍍忛獙璇佷俊鎭凡澶辨晥!"); + return false; + } + + if(codeGenerate.equalsIgnoreCase(data.getCode())){ + logger.debug("鏂囨湰楠岃瘉閫氳繃锛歿}", data.getCode()); + return true; + } + return false; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/captcha/ThirdPartyCaptchaProvider.java b/iplatform-base/src/main/java/com/iplatform/base/captcha/ThirdPartyCaptchaProvider.java new file mode 100644 index 0000000..2798653 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/captcha/ThirdPartyCaptchaProvider.java @@ -0,0 +1,16 @@ +package com.iplatform.base.captcha; + +import com.walker.web.CaptchaType; + +/** + * 绗笁鏂硅璇佸鎺ョ櫥褰曢獙璇佹彁渚涜�呫�傦紙鏆傛椂涓洪绠椾竴浣撳寲瀵规帴浣跨敤锛屽悗缁渶瑕佹娊璞★級 + * @author 鏃跺厠鑻� + * @date 2023-07-03 + */ +public class ThirdPartyCaptchaProvider extends NoneCaptchaProvider{ + + @Override + public CaptchaType getCaptchaType() { + return CaptchaType.ThirdParty; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/config/ApiProperties.java b/iplatform-base/src/main/java/com/iplatform/base/config/ApiProperties.java new file mode 100644 index 0000000..2a10f11 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/config/ApiProperties.java @@ -0,0 +1,17 @@ +package com.iplatform.base.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +@ConfigurationProperties(prefix = "iplatform.api") +public class ApiProperties { + + public boolean isTimeEnabled() { + return timeEnabled; + } + + public void setTimeEnabled(boolean timeEnabled) { + this.timeEnabled = timeEnabled; + } + + private boolean timeEnabled = false; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/config/BeanPostProcessorConfig.java b/iplatform-base/src/main/java/com/iplatform/base/config/BeanPostProcessorConfig.java new file mode 100644 index 0000000..0d8879a --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/config/BeanPostProcessorConfig.java @@ -0,0 +1,82 @@ +package com.iplatform.base.config; + +import com.iplatform.base.DeptCacheProvider; +import com.iplatform.base.RootConfigBean; +import com.iplatform.base.UserCacheProvider; +import com.iplatform.base.cache.DictCacheProvider; +import com.iplatform.base.callback.PlatformCallbackPostProcessor; +import com.iplatform.base.di.PlatformDataImportEngine; +import com.walker.cache.CacheProvider; +import com.walker.cache.CacheProviderPostProcessor; +import com.walker.push.PushManager; +import com.walker.web.CaptchaProvider; +import com.walker.web.CaptchaResult; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * 鎵�鏈� <code>BeanPostProcessor</code> 瀵硅薄蹇呴』缁熶竴鍦ㄨ繖閲屽鐞嗭紝涓嶈兘娣峰悎鍒颁笟鍔ean锛屽惁鍒欎細鎻愮ず:<br> + * ### is not eligible for getting processed by all BeanPostProcessors. + * <pre> + * 1)娉ㄦ剰:璇ラ厤缃璞″苟娌℃湁浣跨敤 <code>@Configuration</code> 娉ㄨВ锛� + * 2)瀹冨皢琚綔涓烘櫘閫氬伐鍘傜被鏉ュ姞杞芥櫘閫欱ean瀵硅薄锛� + * 3)浠ヤ笂鍐呭涓鸿В鍐抽棶棰樻椂鐨勬弿杩拌褰曪紝鏆傛湭鍒犻櫎 + * =========================================================== + * </pre> + * @date 2023-01-05 + */ +@Configuration +public class BeanPostProcessorConfig { + + /** + * 閰嶇疆璇ean锛屼笉浼氱洿鎺ヤ娇鐢紝浠呬粎浣跨郴缁熸帶鍒跺櫒鑳借鑷姩缁勮銆� + * @param platformCallbackPostProcessor + * @param userCacheProvider + * @param deptCacheProvider + * @param dictCacheProvider + * @param platformDataImportEngine + * @return + * @date 2023-03-10 + */ + @Bean + public RootConfigBean rootConfigBean(PlatformCallbackPostProcessor platformCallbackPostProcessor + , UserCacheProvider userCacheProvider, DeptCacheProvider deptCacheProvider, DictCacheProvider dictCacheProvider + , PlatformDataImportEngine platformDataImportEngine + , PushManager pushManager, CaptchaProvider<CaptchaResult> smsCaptchaProvider, CacheProvider<String> captchaCacheProvider){ + RootConfigBean rootConfigBean = new RootConfigBean(); + rootConfigBean.setCallbackPostProcessor(platformCallbackPostProcessor); + rootConfigBean.setDeptCacheProvider(deptCacheProvider); + rootConfigBean.setUserCacheProvider(userCacheProvider); + rootConfigBean.setDictCacheProvider(dictCacheProvider); + rootConfigBean.setPlatformDataImportEngine(platformDataImportEngine); + // 2023-04-25 + rootConfigBean.setPushManager(pushManager); + // 2023-06-28 + rootConfigBean.setSmsCaptchaProvider(smsCaptchaProvider); + rootConfigBean.setCaptchaCacheProvider(captchaCacheProvider); + rootConfigBean.startup(); + return rootConfigBean; + } + + /** + * 閰嶇疆骞冲彴鍥炶皟鎺ュ彛澶勭悊鍣ㄥ璞★紝鍔犺浇绯荤粺鎵�鏈夊疄鐜板洖璋冪殑闆嗗悎銆� + * @return + * @date 2023-01-05 + */ + @Bean +// @Role(BeanDefinition.ROLE_INFRASTRUCTURE) + public PlatformCallbackPostProcessor platformCallbackPostProcessor(){ + return new PlatformCallbackPostProcessor(); + } + + /** + * 娉ㄥ唽璇ュ璞″悗锛屽彲浠ュ惎鍔ㄦ椂鏀堕泦绯荤粺娉ㄥ唽鐨勭紦瀛樺璞★紝骞堕�氳繃 SimpleCacheManager 鑾峰彇缂撳瓨瀵硅薄銆� + * @return 杩斿洖缂撳瓨鎻愪緵鑰呭悗澶勭悊鍣�<p></p>鍏蜂綋浣跨敤锛� + * {@link com.walker.cache.SimpleCacheManager#getCacheProvider(Class)} + */ + @Bean + public CacheProviderPostProcessor cacheProviderPostProcessor(){ + return new CacheProviderPostProcessor(); + } + +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/config/CacheConfiguration.java b/iplatform-base/src/main/java/com/iplatform/base/config/CacheConfiguration.java new file mode 100644 index 0000000..29151e6 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/config/CacheConfiguration.java @@ -0,0 +1,64 @@ +package com.iplatform.base.config; + +import com.iplatform.base.cache.DictCacheProvider; +import com.iplatform.base.cache.FormCacheProvider; +import com.iplatform.base.service.CodeServiceImpl; +import com.iplatform.base.service.ConfigFormServiceImpl; +import com.iplatform.core.PlatformConfiguration; +import org.springframework.context.annotation.Bean; + +/** + * 骞冲彴缂撳瓨閰嶇疆鍩虹銆� + * @author 鏃跺厠鑻� + * @date 2022-09-21 + */ +public abstract class CacheConfiguration extends PlatformConfiguration { + + /** + * 娣诲姞缂撳瓨鍙傛暟閰嶇疆锛岃拷鍔犱簡鏈烘瀯鐢ㄦ埛缂撳瓨鍙傛暟 + * @return + * @date 2023-07-17 + */ + @Bean + public CacheProperties cacheProperties(){ + return new CacheProperties(); + } + + /** + * 绯荤粺鑷畾涔夎〃鍗曠紦瀛橀厤缃�� + * @param configFormService + * @return + * @date 2023-05-18 + */ + @Bean + public FormCacheProvider formCacheProvider(ConfigFormServiceImpl configFormService){ + FormCacheProvider formCacheProvider = new FormCacheProvider(); + formCacheProvider.setConfigFormService(configFormService); + return formCacheProvider; + } + + /** + * 鏁版嵁瀛楀吀缂撳瓨閰嶇疆锛岀洿鎺ュ唴瀛樼紦瀛橈紝鍦ㄩ泦缇ょ幆澧冧笅鏃犳硶瀹炵幇鍔ㄦ�佺紪杈戯紙濡傛灉缂栬緫闇�瑕佸疄鐜癛edis鏂瑰紡锛夈�� + * @param codeService + * @return + * @date 2023-03-10 + */ + @Bean + public DictCacheProvider dictCacheProvider(CodeServiceImpl codeService){ + DictCacheProvider dictCacheProvider = new DictCacheProvider(); + dictCacheProvider.setCodeService(codeService); + return dictCacheProvider; + } + + /** + * 杩佺Щ鍒皉edis缂撳瓨閰嶇疆鏂囦欢涓紝2024-04-09 + * @param menuService + * @return + */ +// @Bean +// public MenuCacheProvider menuCacheProvider(MenuServiceImpl menuService){ +// MenuCacheProvider menuCacheProvider = new MenuCacheProvider(); +// menuCacheProvider.setMenuService(menuService); +// return menuCacheProvider; +// } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/config/CacheProperties.java b/iplatform-base/src/main/java/com/iplatform/base/config/CacheProperties.java new file mode 100644 index 0000000..1af92e3 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/config/CacheProperties.java @@ -0,0 +1,63 @@ +package com.iplatform.base.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * 缂撳瓨鍙傛暟 + * @author 鏃跺厠鑻� + * @date 2023-07-17 娣诲姞 + */ +@ConfigurationProperties(prefix = "iplatform.cache") +public class CacheProperties { + + /** + * 鏄惁鍚敤 Redis + * @return + */ + public boolean isRedisEnabled() { + return redisEnabled; + } + + public void setRedisEnabled(boolean redisEnabled) { + this.redisEnabled = redisEnabled; + } + + /** + * 鏈烘瀯鐢ㄦ埛鏄惁寰堝簽澶э紝濡傛灉鏄垯缂撳瓨涓細鍏抽棴鍒濆鍖栧姞杞斤紝鍚屾椂鏈烘瀯鏍戜篃涓嶄細鏀惧叆缂撳瓨锛�2023-07-17 + * @return + * @date 2023-07-17 + */ + public boolean isOrgUserBig() { + return orgUserBig; + } + + public void setOrgUserBig(boolean orgUserBig) { + this.orgUserBig = orgUserBig; + } + + public boolean isOrgAloneBig() { + return orgAloneBig; + } + + public void setOrgAloneBig(boolean orgAloneBig) { + this.orgAloneBig = orgAloneBig; + } + + /** + * redis 缂撳瓨鏄惁閲嶅缓锛屽鏋滄槸鍒欏惎鍔ㄦ椂浼氬垹闄edis宸叉湁缂撳瓨锛屽苟閲嶆柊鎵ц榛樿鍔犺浇鏂规硶銆� + * @return + * @date 2023-08-26 + */ + public boolean isRedisRebuild() { + return redisRebuild; + } + + public void setRedisRebuild(boolean redisRebuild) { + this.redisRebuild = redisRebuild; + } + + private boolean redisRebuild = false; + private boolean redisEnabled = false; + private boolean orgUserBig = false; + private boolean orgAloneBig = false; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/config/CaptchaConfig.java b/iplatform-base/src/main/java/com/iplatform/base/config/CaptchaConfig.java new file mode 100644 index 0000000..5f3b39c --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/config/CaptchaConfig.java @@ -0,0 +1,103 @@ +package com.iplatform.base.config; + +import com.iplatform.base.captcha.BlockPuzzleCaptchaProvider; +import com.iplatform.base.captcha.JigsawCaptchaProvider; +import com.iplatform.base.captcha.SmsCaptchaProvider; +import com.iplatform.core.PlatformConfiguration; +import com.walker.cache.CacheProvider; +import com.walker.infrastructure.utils.ClassUtils; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.push.PushManager; +import com.walker.web.CaptchaProvider; +import com.walker.web.CaptchaResult; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.lang.reflect.Constructor; + +@Configuration +public class CaptchaConfig extends PlatformConfiguration { + + @Bean + public CaptchaProperties captchaProperties(){ + return new CaptchaProperties(); + } + + /** + * 绉诲姩绔娇鐢ㄧ殑鎷煎浘楠岃瘉缁勪欢瀹炵幇锛岀洰鍓嶆兂鏇挎崲宸叉湁鑰佺殑锛孭C绔鍦ㄥ皾璇曟浛鎹€�� + * @param captchaCacheProvider + * @return + * @date 2023-06-27 + */ + @Bean + public BlockPuzzleCaptchaProvider blockPuzzleCaptchaProvider(CacheProvider<String> captchaCacheProvider){ + BlockPuzzleCaptchaProvider captchaProvider = new BlockPuzzleCaptchaProvider(); + captchaProvider.setCaptchaCacheProvider(captchaCacheProvider); + return captchaProvider; + } + + /** + * 鎷煎浘婊戝潡楠岃瘉锛屾彁渚涜�呭畾涔夈�� + * @return + * @date 2023-04-06 + * @date 2023-06-27 鍑嗗浣跨敤鏂扮殑锛欽igsawMobile鎷煎浘楠岃瘉缁勪欢鏇挎崲璇ョ粍浠躲�� + */ + @Deprecated + @Bean + public JigsawCaptchaProvider jigsawCaptchaProvider(CacheProvider<String> captchaCacheProvider){ + JigsawCaptchaProvider jigsawCaptchaProvider = new JigsawCaptchaProvider(); + jigsawCaptchaProvider.setCaptchaCacheProvider(captchaCacheProvider); + return jigsawCaptchaProvider; + } + + /** + * 鐭俊楠岃瘉鐮佺敓鎴愭彁渚涜�呫�� + * @return + * @date 2023-01-27 + * @date 2023-04-25 閲嶆瀯瀵硅薄锛屽簳灞傛帹閫佺敱'PushManger'瀹屾垚銆� + */ + @Bean("smsCaptchaProvider") + public SmsCaptchaProvider smsCaptchaProvider(PushManager pushManager){ + SmsCaptchaProvider smsCaptchaProvider = new SmsCaptchaProvider(); + smsCaptchaProvider.setPushManager(pushManager); + return smsCaptchaProvider; + } +// public CaptchaProvider<CaptchaResult> smsCaptchaProvider(CaptchaProperties captchaProperties){ +// String smsCaptchaClass = captchaProperties.getSmsCaptchaClass(); +// if(StringUtils.isEmpty(smsCaptchaClass)){ +// throw new IllegalArgumentException("鐭俊楠岃瘉鐮佹彁渚涜�呯被鏈厤缃�: CaptchaProperties --> smsCaptchaClass"); +// } +// try { +// logger.info("鍒涘缓'鐭俊楠岃瘉鐮佹彁渚涜��' = " + smsCaptchaClass); +// Class<?> captchaProviderClass = ClassUtils.forName(smsCaptchaClass, CaptchaConfig.class.getClassLoader()); +// Constructor<CaptchaProvider<CaptchaResult>> constructor = (Constructor<CaptchaProvider<CaptchaResult>>)captchaProviderClass.getConstructor(); +// return constructor.newInstance(); +// } catch (Exception e) { +// throw new RuntimeException("鍒涘缓'鐭俊楠岃瘉鐮�'鎻愪緵鑰呭疄渚嬪紓甯�:" + e.getMessage(), e); +// } +// } + + /** + * 绠�鍗曞浘鍍忛獙璇佺爜鐢熸垚鎻愪緵鑰� + * @return + * @author 鏃跺厠鑻� + * @date 2022-11-06 + * @date 2023-01-27 閫氳繃閰嶇疆鏂囦欢锛屽姩鎬佸垱寤烘彁渚涜�呭璞°�� + */ + @Bean("imageCaptchaProvider") + public CaptchaProvider<CaptchaResult> imageCaptchaProvider(CaptchaProperties captchaProperties){ + String imageCaptchaClass = captchaProperties.getImageCaptchaClass(); + if(StringUtils.isEmpty(imageCaptchaClass)){ + throw new IllegalArgumentException("鍥惧儚楠岃瘉鐮佹彁渚涜�呯被鏈厤缃�: CaptchaProperties --> imageCaptchaClass"); + } + try { + logger.info("鍒涘缓'鍥惧儚楠岃瘉鐮佹彁渚涜��' = " + imageCaptchaClass); + Class<?> captchaProviderClass = ClassUtils.forName(imageCaptchaClass, CaptchaConfig.class.getClassLoader()); + Constructor<CaptchaProvider<CaptchaResult>> constructor = (Constructor<CaptchaProvider<CaptchaResult>>)captchaProviderClass.getConstructor(); + return constructor.newInstance(); + } catch (Exception e) { + throw new RuntimeException("鍒涘缓'鍥惧儚楠岃瘉鐮�'鎻愪緵鑰呭疄渚嬪紓甯�:" + e.getMessage(), e); + } +// return new SimpleKaptchaProvider(); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/config/CaptchaProperties.java b/iplatform-base/src/main/java/com/iplatform/base/config/CaptchaProperties.java new file mode 100644 index 0000000..68b5e43 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/config/CaptchaProperties.java @@ -0,0 +1,42 @@ +package com.iplatform.base.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * 楠岃瘉鐮侀厤缃浉鍏冲弬鏁般�� + * @author 鏃跺厠鑻� + * @date 2023-01-27 + */ +@ConfigurationProperties(prefix = "iplatform.captcha") +public class CaptchaProperties { + + /** + * 鍥惧儚楠岃瘉鐮佸疄鐜扮被瀵硅薄锛屽: com.walker.support.kaptcha.SimpleKaptchaProvider + * @return + */ + public String getImageCaptchaClass() { + return imageCaptchaClass; + } + + public void setImageCaptchaClass(String imageCaptchaClass) { + this.imageCaptchaClass = imageCaptchaClass; + } + + /** + * 鐭俊楠岃瘉鐮佹彁渚涜�呭疄鐜扮被瀵硅薄 + * @return + */ + @Deprecated + public String getSmsCaptchaClass() { + return smsCaptchaClass; + } + + public void setSmsCaptchaClass(String smsCaptchaClass) { + this.smsCaptchaClass = smsCaptchaClass; + } + + private String imageCaptchaClass; + + @Deprecated + private String smsCaptchaClass; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/config/DataImportConfig.java b/iplatform-base/src/main/java/com/iplatform/base/config/DataImportConfig.java new file mode 100644 index 0000000..73acc52 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/config/DataImportConfig.java @@ -0,0 +1,51 @@ +package com.iplatform.base.config; + +import com.iplatform.base.LocalDatabaseMetaEngine; +import com.iplatform.base.di.PlatformDataImportEngine; +import com.iplatform.base.di.PlatformExcelTemplateGenerator; +import com.walker.di.excel.ExcelTemplateGenerator; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * 鏁版嵁瀵煎叆銆佸鍑洪厤缃�� + * @author 鏃跺厠鑻� + * @date 2023-02-07 + */ +@Configuration +public class DataImportConfig { + + /** + * 閰嶇疆瀵煎叆鏁版嵁寮曟搸瀵硅薄锛岃礋璐f暣涓狤xcel瀵煎叆鍔熻兘銆� + * @param excelTemplateGenerator +// * @param fileOperateSpi 鏂囦欢鎿嶄綔鏈嶅姟鎻愪緵鑰呮帴鍙� + * @param fileProperties 鏂囦欢绠$悊閰嶇疆灞炴�� + * @return + * @date 2023-02-07 + * @date 2023-02-15 + */ + @Bean + public PlatformDataImportEngine dataImportEngine(ExcelTemplateGenerator excelTemplateGenerator +// , FileOperateSpi fileOperateSpi + , FileProperties fileProperties){ + PlatformDataImportEngine dataImportEngine = new PlatformDataImportEngine(); +// dataImportEngine.setSaveFileRoot("d:/tmp/"); + /** 杩欓噷鍙兘璁剧疆鏈満纾佺洏璺緞锛屽洜涓哄鍏ユ枃浠堕兘鏄湰鏈烘搷浣�(鍒版暟鎹簱)鐨勶紝涓嶄細娑夊強鏈嶅姟闆嗙兢銆�2023-02-15 */ + dataImportEngine.setSaveFileRoot(fileProperties.getFileRoot()); + dataImportEngine.setTemplateGenerator(excelTemplateGenerator); + return dataImportEngine; + } + + /** + * Excel瀵煎叆绯荤粺鏍规嵁琛ㄥ悕鑷姩鐢熸垚瀵煎叆妯℃澘銆� + * @param localDatabaseMetaEngine + * @return + * @date 2023-02-07 + */ + @Bean + public ExcelTemplateGenerator excelTemplateGenerator(LocalDatabaseMetaEngine localDatabaseMetaEngine){ + PlatformExcelTemplateGenerator excelTemplateGenerator = new PlatformExcelTemplateGenerator(); + excelTemplateGenerator.setLocalDatabaseMetaEngine(localDatabaseMetaEngine); + return excelTemplateGenerator; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/config/DatabaseMetaConfig.java b/iplatform-base/src/main/java/com/iplatform/base/config/DatabaseMetaConfig.java new file mode 100644 index 0000000..f12d341 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/config/DatabaseMetaConfig.java @@ -0,0 +1,43 @@ +package com.iplatform.base.config; + +import com.iplatform.base.LocalDatabaseMetaEngine; +import com.iplatform.core.PlatformConfiguration; +import com.walker.connector.LocalAddress; +import com.walker.jdbc.JdbcInspector; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * 鏁版嵁搴撳厓鏁版嵁鐩稿叧閰嶇疆銆� + * @author 鏃跺厠鑻� + * @date 2023-02-06 + */ +@Configuration +public class DatabaseMetaConfig extends PlatformConfiguration { + + private JdbcInspector jdbcInspector; + + @Autowired + public DatabaseMetaConfig(JdbcInspector jdbcInspector){ + this.jdbcInspector = jdbcInspector; + } + + /** + * 鍒涘缓鏈湴鏁版嵁搴撳厓鏁版嵁寮曟搸(鍗曚緥)瀵硅薄銆� + * @return + * @date 2022-11-22 + * @date 2023-02-06 浠� iplatform-jdbc-generator 妯″潡杩佺Щ杩囨潵銆� + */ + @Bean + public LocalDatabaseMetaEngine localDatabaseMetaEngine(){ + LocalAddress localAddress = new LocalAddress(jdbcInspector.getPrimaryDataSourceMeta()); + + LocalDatabaseMetaEngine localDatabaseMetaEngine = new LocalDatabaseMetaEngine(); + localDatabaseMetaEngine.setDatabaseType(jdbcInspector.getPrimaryDatabaseType()); + localDatabaseMetaEngine.setLocalAddress(localAddress); + logger.info("鍒涘缓: localDatabaseMetaEngine = " + localDatabaseMetaEngine); + return localDatabaseMetaEngine; + } + +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/config/DruidMonitorConfig.java b/iplatform-base/src/main/java/com/iplatform/base/config/DruidMonitorConfig.java new file mode 100644 index 0000000..2627fde --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/config/DruidMonitorConfig.java @@ -0,0 +1,119 @@ +//package com.iplatform.base.config; +// +//import com.alibaba.druid.support.http.StatViewServlet; +//import com.alibaba.druid.support.http.WebStatFilter; +//import com.alibaba.druid.wall.WallConfig; +//import com.alibaba.druid.wall.WallFilter; +//import com.iplatform.core.PlatformConfiguration; +//import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +//import org.springframework.boot.web.servlet.FilterRegistrationBean; +//import org.springframework.boot.web.servlet.ServletRegistrationBean; +//import org.springframework.context.annotation.Bean; +//import org.springframework.context.annotation.Configuration; +// +//import javax.sql.DataSource; +//import java.util.HashMap; +//import java.util.Map; +// +//@Configuration +//@ConditionalOnProperty(prefix = "iplatform.api", name = "time-enabled", havingValue = "true", matchIfMissing = false) +//public class DruidMonitorConfig extends PlatformConfiguration { +// +//// @Bean(name="dataSource") +//// public DataSource dataSource(){ +//// return (DataSource)JdbcInspector.getInstance().getPrimaryDataSourceMeta(); +//// } +// +// /** +// * MethodName: statViewServlet +// * Description: 閰嶇疆 Druid 鐩戞帶绠$悊鍚庡彴鐨凷ervlet, +// * 鍐呯疆 Servlet 瀹瑰櫒鏃舵病鏈墂eb.xml鏂囦欢锛屾墍浠ヤ娇鐢� Spring Boot 鐨勬敞鍐� Servlet 鏂瑰紡 +// * +// * @return org.springframework.boot.web.servlet.ServletRegistrationBean +// * @author Tianjiao +// * @date 2021/5/27 10:11 +// * @params: [] +// */ +// @Bean +// public ServletRegistrationBean<StatViewServlet> statViewServlet() { +// ServletRegistrationBean<StatViewServlet> bean = new ServletRegistrationBean<>(new StatViewServlet(), "/druid/*"); +// +// // 杩欎簺鍙傛暟鍙互鍦� com.alibaba.druid.support.http.StatViewServlet +// // 鐨勭埗绫� com.alibaba.druid.support.http.ResourceServlet 涓壘鍒� +// Map<String, String> initParams = new HashMap<>(); +// //鍚庡彴绠$悊鐣岄潰鐨勭櫥褰曡处鍙� +// initParams.put("loginUsername", "druid"); +// //鍚庡彴绠$悊鐣岄潰鐨勭櫥褰曞瘑鐮� +// initParams.put("loginPassword", "druid"); +// +// //鍚庡彴鍏佽璋佸彲浠ヨ闂� +// //initParams.put("allow", "localhost")锛氳〃绀哄彧鏈夋湰鏈哄彲浠ヨ闂� +// //initParams.put("allow", "")锛氫负绌烘垨鑰呬负null鏃讹紝琛ㄧず鍏佽鎵�鏈夎闂� +// initParams.put("allow", ""); +// //deny锛欴ruid 鍚庡彴鎷掔粷璋佽闂� +// //initParams.put("tianjiao", "192.168.1.20");琛ㄧず绂佹姝p璁块棶 +// +// //璁剧疆鍒濆鍖栧弬鏁� +// bean.setInitParameters(initParams); +// logger.info("druid鐩戞帶璁剧疆鍙傛暟 = {}", initParams); +// return bean; +// } +// +// @Bean("webStatFilter") +// public FilterRegistrationBean<WebStatFilter> webStatFilter(DataSource dataSource) { +// FilterRegistrationBean<WebStatFilter> bean = new FilterRegistrationBean<>(); +//// WebStatFilter webStatFilter = new WebStatFilter(); +//// WebAppStat webAppStat = new WebAppStat(); +// bean.setFilter(new WebStatFilter()); +// Map<String, String> initParams = new HashMap<>(); +//// 杩欎簺涓滆タ涓嶈繘琛岀粺璁� +// initParams.put("exclusions", "*.js,*.css,/druid/*"); +// bean.setInitParameters(initParams); +//// bean.setUrlPatterns(Arrays.asList("/*")); +// bean.addUrlPatterns("/*"); +// logger.info("druid WebStatFilter = {}", initParams); +// +//// List<Filter> filters = new ArrayList<>(4); +//// filters.add(bean.getFilter()); +//// DruidDataSource druidDataSource = (DruidDataSource)dataSource; +//// druidDataSource.setProxyFilters(filters); +// return bean; +// } +// +// @Bean +// public WallFilter wallFilter(){ +// WallFilter wallFilter = new WallFilter(); +// wallFilter.setConfig(wallConfig()); +// +// // +//// DruidDataSource druidDataSource = (DruidDataSource)dataSource; +//// try { +//// druidDataSource.setFilters("webStatFilter"); +//// } catch (SQLException e) { +//// throw new RuntimeException(e); +//// } +// +//// StatFilter statFilter = new StatFilter(); +//// statFilter.setLogSlowSql(true); +//// statFilter.setSlowSqlMillis(200); +//// +//// List<Filter> filters = new ArrayList<>(4); +//// filters.add(statFilter); +//// druidDataSource.setProxyFilters(filters); +//// logger.info("--------------> 璁剧疆浜哾ruid杩囨护鍣�!"); +// +// return wallFilter; +// } +// +// @Bean +// public WallConfig wallConfig(){ +// WallConfig wallConfig = new WallConfig(); +// wallConfig.setMultiStatementAllow(true); +// //鍏佽涓�娆℃墽琛屽鏉¤鍙� +// wallConfig.setNoneBaseStatementAllow(true); +// //鏄惁鍏佽闈炰互涓婂熀鏈鍙ョ殑鍏朵粬璇彞 +// wallConfig.setStrictSyntaxCheck(false); +// //鏄惁杩涜涓ユ牸鐨勮娉曟娴� +// return wallConfig; +// } +//} diff --git a/iplatform-base/src/main/java/com/iplatform/base/config/FileProperties.java b/iplatform-base/src/main/java/com/iplatform/base/config/FileProperties.java new file mode 100644 index 0000000..fa6579a --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/config/FileProperties.java @@ -0,0 +1,109 @@ +package com.iplatform.base.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +@ConfigurationProperties(prefix = "iplatform.file") +public class FileProperties { + + public String getFileRoot() { + return fileRoot; + } + + public void setFileRoot(String fileRoot) { + this.fileRoot = fileRoot; + } + + /** + * 璋冪敤杩滅▼涓婁紶鏂囦欢锛屾槸鍚︽寜鐓ф湰鍦版柟寮忓鐞嗐�� + * <pre> + * 1)璇ラ�夐」涓轰簡閫傚簲娌℃湁FTP绛夋湇鍔$殑鎯呭喌锛岀壒鍒槸鍦ㄥ紑鍙戣繃绋嬶紝濡傛灉璁剧疆涓猴細true 鍒欒皟鐢ㄨ繙绋嬩笂浼犳柟娉曞悗鏂囦欢浠嶇劧淇濆瓨鍦ㄦ湰鍦般�� + * 2)濡傛灉鐢熶骇鐜瀛樺湪鍚堥�傜殑鏂囦欢瀛樺偍鏈嶅姟锛屽垯闇�瑕佽缃负锛歠alse + * </pre> + * @return + * @date 2023-07-03 + */ + public boolean isRemoteAsLocal() { + return remoteAsLocal; + } + + public void setRemoteAsLocal(boolean remoteAsLocal) { + this.remoteAsLocal = remoteAsLocal; + } + + /** + * oss瀹炵幇绫诲瀷锛歛ws_s3锛堜簹椹�婏級 | tx锛堣吘璁級 | ali锛堥樋閲岋級 | qn锛堜竷鐗涳級 + * @return + * @date 2023-12-13 + */ + public String getOssType() { + return ossType; + } + + public void setOssType(String ossType) { + this.ossType = ossType; + } + + /** + * oss璁块棶鍓嶇紑锛屽锛歨ttp://localhost:8082/admin/oss/ + * @return + * @date 2023-12-13 + */ + public String getOssPrefix() { + return ossPrefix; + } + + public void setOssPrefix(String ossPrefix) { + this.ossPrefix = ossPrefix; + } + + public String getOssAccessKey() { + return ossAccessKey; + } + + public void setOssAccessKey(String ossAccessKey) { + this.ossAccessKey = ossAccessKey; + } + + public String getOssSecretKey() { + return ossSecretKey; + } + + public void setOssSecretKey(String ossSecretKey) { + this.ossSecretKey = ossSecretKey; + } + + public String getOssEndpoint() { + return ossEndpoint; + } + + public void setOssEndpoint(String ossEndpoint) { + this.ossEndpoint = ossEndpoint; + } + + public String getOssBucketName() { + return ossBucketName; + } + + public void setOssBucketName(String ossBucketName) { + this.ossBucketName = ossBucketName; + } + + public String getProtocolStr() { + return protocolStr; + } + + public void setProtocolStr(String protocolStr) { + this.protocolStr = protocolStr; + } + + private String ossAccessKey; + private String ossSecretKey; + private String ossEndpoint; + private String ossBucketName; + private String ossType; + private String ossPrefix; + private boolean remoteAsLocal = true; + private String fileRoot = null; + private String protocolStr = "http"; + +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/config/JacksonConfig.java b/iplatform-base/src/main/java/com/iplatform/base/config/JacksonConfig.java new file mode 100644 index 0000000..a9e70fe --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/config/JacksonConfig.java @@ -0,0 +1,27 @@ +package com.iplatform.base.config; + +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.math.BigDecimal; + +/** + * Fasterxml搴忓垪鍖栫浉鍏抽厤缃��<p>鏄惁鏈夌敤杩樻湭娴嬭瘯銆�</p>鐢靛晢鍔熻兘鐢ㄥ埌锛岃〃鍗曢厤缃� + * @date 2023-05-21 + */ +@Configuration +public class JacksonConfig { + + /** + * Jackson鍏ㄥ眬杞寲BigDecimal绫诲瀷涓篠tring锛岃В鍐砵ackson搴忓垪鍖栨椂BigDecimal绫诲瀷缂哄け绮惧害闂 + * + * @return Jackson2ObjectMapperBuilderCustomizer 娉ㄥ叆鐨勫璞� + */ + @Bean + public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() { + return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.serializerByType(BigDecimal.class, ToStringSerializer.instance); + } + +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/config/LocalCacheConfig.java b/iplatform-base/src/main/java/com/iplatform/base/config/LocalCacheConfig.java new file mode 100644 index 0000000..708b0e6 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/config/LocalCacheConfig.java @@ -0,0 +1,176 @@ +package com.iplatform.base.config; + +import com.iplatform.base.CategoryCacheProvider; +import com.iplatform.base.NotificationTemplateCache; +import com.iplatform.base.PushCacheProvider; +import com.iplatform.base.SystemGroupCache; +import com.iplatform.base.UserCacheProvider; +import com.iplatform.base.UserLoginCache; +import com.iplatform.base.cache.LocalCaptchaCacheProvider; +import com.iplatform.base.cache.LocalCategoryCacheProvider; +import com.iplatform.base.cache.LocalDeptCacheProvider; +import com.iplatform.base.cache.LocalHostCacheProvider; +import com.iplatform.base.cache.LocalNotificationTemplateCache; +import com.iplatform.base.cache.LocalPushCacheProvider; +import com.iplatform.base.cache.LocalSystemGroupCache; +import com.iplatform.base.cache.LocalUserCacheProvider; +import com.iplatform.base.cache.LocalUserLoginCache; +import com.iplatform.base.cache.LocalUserOnlineProvider; +import com.iplatform.base.service.CategoryServiceImpl; +import com.iplatform.base.service.ConfigArgumentServiceImpl; +import com.iplatform.base.service.DeptServiceImpl; +import com.iplatform.base.service.GroupServiceImpl; +import com.iplatform.base.service.NotificationServiceImpl; +import com.iplatform.base.service.UserServiceImpl; +import com.iplatform.base.support.DatabaseArgumentsManager; +import com.iplatform.model.po.S_host; +import com.walker.cache.CacheProvider; +import com.walker.jdbc.service.PubService; +import com.walker.web.UserOnlineProvider; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ConditionalOnProperty(prefix = "iplatform.cache", name = "redis-enabled", havingValue = "false", matchIfMissing = true) +//@ConditionalOnMissingClass("com.walker.support.redis.cache.RedisCacheProvider") +public class LocalCacheConfig extends CacheConfiguration { + + /** + * 閫氱煡鎻愰啋妯℃澘閰嶇疆缂撳瓨銆� + * @param notificationService + * @return + * @date 2023-08-25 + */ + @Bean + public NotificationTemplateCache notificationTemplateCache(NotificationServiceImpl notificationService){ + LocalNotificationTemplateCache cache = new LocalNotificationTemplateCache(); + cache.setNotificationService(notificationService); + return cache; + } + + /** + * 鐢ㄦ埛鐧诲綍璁板綍缂撳瓨锛岀敤浜庡垽鏂櫥褰曠瓥鐣ャ�� + * @return + * @date 2023-07-11 + */ + @Bean + public UserLoginCache userLoginCache(){ + LocalUserLoginCache cache = new LocalUserLoginCache(); + return cache; + } + + @Bean + public SystemGroupCache systemGroupCache(GroupServiceImpl groupService){ + LocalSystemGroupCache cache = new LocalSystemGroupCache(); + cache.setGroupService(groupService); + return cache; + } + + /** + * 骞冲彴鍒嗙被鏁版嵁锛屾湰鍦扮紦瀛樺疄鐜般�� + * @param categoryService + * @return + * @date 2023-05-17 + */ + @Bean + public CategoryCacheProvider localCategoryCacheProvider(CategoryServiceImpl categoryService){ + LocalCategoryCacheProvider categoryCacheProvider = new LocalCategoryCacheProvider(); + categoryCacheProvider.setCategoryService(categoryService); + return categoryCacheProvider; + } + + /** + * 鎺ㄩ�佹彁閱掍复鏃舵暟鎹紦瀛樺畾涔夈�� + * @return + * @date 2023-04-27 + */ + @Bean + public PushCacheProvider pushCacheProvider(){ + return new LocalPushCacheProvider(); + } + + @Bean + public UserOnlineProvider userOnlineProvider(){ + return new LocalUserOnlineProvider(); + } + + @Bean("captchaCacheProvider") + public CacheProvider<String> cacheProviderCaptchaLocal(){ + return new LocalCaptchaCacheProvider(); + } + + /** + * 鍒涘缓鍩轰簬鍐呭瓨鐨勬満鏋勭紦瀛樼鐞嗗櫒銆� + * @param deptService + * @return + * @date 2022-12-05 + */ + @Bean + public LocalDeptCacheProvider localDeptCacheProvider(DeptServiceImpl deptService){ + LocalDeptCacheProvider localDeptCacheProvider = new LocalDeptCacheProvider(); + localDeptCacheProvider.setDeptService(deptService); + return localDeptCacheProvider; + } + + /** + * 鍩轰簬鍐呭瓨瀹炵幇鐨� ArgumentsManager 绠$悊鍣ㄣ�� + * @param configArgumentService + * @return + * @date 2022-11-29 + */ + @Bean + public DatabaseArgumentsManager databaseArgumentsManager(ConfigArgumentServiceImpl configArgumentService){ + DatabaseArgumentsManager databaseArgumentsManager = new DatabaseArgumentsManager(); + databaseArgumentsManager.setConfigArgumentService(configArgumentService); + return databaseArgumentsManager; + } + + /** + * 鍔犺浇鏈湴鐢ㄦ埛缂撳瓨 + * @param userService + * @return + * @date 2022-11-06 + */ + @Bean + public UserCacheProvider userCacheProviderForLocal(UserServiceImpl userService){ + LocalUserCacheProvider localUserCacheProvider = new LocalUserCacheProvider(); + localUserCacheProvider.setUserService(userService); + return localUserCacheProvider; + } + + /** + * 榛樿鍔犺浇缂撳瓨(鍐呭瓨鏂瑰紡) + * @param pubService + * @return + * @throws Exception + * @date 2022-09-20 + */ + @Bean + public CacheProvider<S_host> cacheProviderHostLocal(PubService pubService) throws Exception{ + LocalHostCacheProvider localHostCacheProvider = new LocalHostCacheProvider(); + localHostCacheProvider.setPubService(pubService); + /** 娉ㄦ剰锛氳繖閲屾棤闇�鎵嬪姩璋冪敤FactoryBean鐨勫垵濮嬪寲鏂规硶锛宻pring浼氳嚜鍔ㄨ皟鐢� 2022-09-20 */ +// hostLocalCacheProvider.afterPropertiesSet(); + logger.info("鍒濆鍖栫紦瀛�: HostLocalCacheProvider"); + return localHostCacheProvider; + } + +// /** +// * 濡傛灉瀛樺湪閰嶇疆椤�(鎵撳紑redis缂撳瓨)锛屽悓鏃跺瓨鍦ㄥ寘(walker-support-redis)鍒欎娇鐢╮edis缂撳瓨瀵硅薄銆� +// * @param pubService +// * @return +// * @throws Exception +// * @date 2022-09-20 +// */ +// @Bean +// @ConditionalOnProperty(prefix = "iplatform.cache", name = "redis-enabled", havingValue = "true", matchIfMissing = false) +// @ConditionalOnClass({RedisCacheProvider.class}) +// public CacheProvider<S_host> cacheProviderHostRedis(PubService pubService) throws Exception{ +// HostRedisCacheProvider hostRedisCacheProvider = new HostRedisCacheProvider(); +// hostRedisCacheProvider.setPubService(pubService); +//// hostRedisCacheProvider.afterPropertiesSet(); +// logger.info("鍒濆鍖栫紦瀛�: HostRedisCacheProvider"); +// return hostRedisCacheProvider; +// } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/config/LogProperties.java b/iplatform-base/src/main/java/com/iplatform/base/config/LogProperties.java new file mode 100644 index 0000000..db6c343 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/config/LogProperties.java @@ -0,0 +1,27 @@ +package com.iplatform.base.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +@ConfigurationProperties(prefix = "iplatform.log") +public class LogProperties { + + public boolean isLoginEnabled() { + return loginEnabled; + } + + public void setLoginEnabled(boolean loginEnabled) { + this.loginEnabled = loginEnabled; + } + + public boolean isOperateEnabled() { + return operateEnabled; + } + + public void setOperateEnabled(boolean operateEnabled) { + this.operateEnabled = operateEnabled; + } + + private boolean loginEnabled = false; + private boolean operateEnabled = false; + +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/config/LoginStrategyProperties.java b/iplatform-base/src/main/java/com/iplatform/base/config/LoginStrategyProperties.java new file mode 100644 index 0000000..419f9ee --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/config/LoginStrategyProperties.java @@ -0,0 +1,41 @@ +package com.iplatform.base.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +import java.util.List; + +@ConfigurationProperties(prefix = "iplatform.security") +public class LoginStrategyProperties { + + /** + * 杩斿洖鐧诲綍绛栫暐鍚嶇О闆嗗悎銆� + * @return + */ + public List<String> getLoginStrategyList() { + return loginStrategyList; + } + + public void setLoginStrategyList(List<String> loginStrategyList) { + this.loginStrategyList = loginStrategyList; + } + + public long getTokenExpireWeb() { + return tokenExpireWeb; + } + + public void setTokenExpireWeb(long tokenExpireWeb) { + this.tokenExpireWeb = tokenExpireWeb; + } + + public long getTokenExpireMobile() { + return tokenExpireMobile; + } + + public void setTokenExpireMobile(long tokenExpireMobile) { + this.tokenExpireMobile = tokenExpireMobile; + } + + private long tokenExpireWeb = 120; // PC绔粯璁�2灏忔椂 + private long tokenExpireMobile = 60 * 24 * 15; // 绉诲姩绔粯璁�15澶� + private List<String> loginStrategyList = null; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/config/PushConfig.java b/iplatform-base/src/main/java/com/iplatform/base/config/PushConfig.java new file mode 100644 index 0000000..e7068dd --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/config/PushConfig.java @@ -0,0 +1,129 @@ +package com.iplatform.base.config; + +import com.iplatform.base.PushCacheProvider; +import com.iplatform.base.push.DefaultPushListener; +import com.iplatform.base.push.DefaultPushManager; +import com.iplatform.base.push.MockSmsPush; +import com.iplatform.base.push.SystemPush; +import com.iplatform.base.service.PushServiceImpl; +import com.iplatform.base.util.NotificationUtils; +import com.iplatform.core.PlatformConfiguration; +import com.walker.push.PushManager; +import com.walker.push.PushStatusListener; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; + +import java.util.ArrayList; +import java.util.List; + +@Configuration +public class PushConfig extends PlatformConfiguration { + + /** + * 鎺ㄩ�佸弬鏁伴厤缃� + * @return + */ + @Bean + public PushProperties pushProperties(){ + return new PushProperties(); + } + + /** + * 閰嶇疆鎺ㄩ�佺鐞嗗櫒瀵硅薄 + * @return + * @date 2023-04-21 + */ + @Bean + public PushManager pushManager(ThreadPoolTaskExecutor threadPoolTaskExecutor + , PushProperties pushProperties, PushStatusListener pushStatusListener){ + DefaultPushManager pushManager = new DefaultPushManager(); + pushManager.setSmsId(pushProperties.getSmsPushName()); + pushManager.setSmsTemplateCode(pushProperties.getSmsTemplateCode()); + + Object[] data = NotificationUtils.acquireMessagePushRules(pushProperties.getMessageType()); + pushManager.setMessageParallel((Boolean) data[0]); + + String[] indexList = (String[])data[1]; + if(indexList == null || indexList.length == 0){ + throw new IllegalStateException("鎺ㄩ�侊紙鏅�氭秷鎭級閰嶇疆瑙勫垯涓嶅瓨鍦�!"); + } + + List<String> channelNameList = new ArrayList<>(4); + for(String index: indexList){ + channelNameList.add(index); + } + pushManager.setMessageChannelNames(channelNameList); + pushManager.setThreadPoolTaskExecutor(threadPoolTaskExecutor); + pushManager.setAsyncListener(pushStatusListener); + + // + pushManager.setMailFrom(pushProperties.getMailFrom()); + + return pushManager; + } + +/* *//** + * 閰嶇疆榛樿鐭俊鎺ㄩ�佸疄鐜帮紙涓�涓�氶亾鍙互鏈夊涓疄鐜帮級 + * @return + * @date 2023-04-24 + *//* + @Bean + public Pushable mailPush(PushManager pushManager, PushProperties pushProperties, UserCacheProvider userCacheProvider){ + DefaultMailPush mailPush = new DefaultMailPush(); +// mailPush.setMailServerHost("smtp.126.com"); +// mailPush.setMailServerPort("25"); +// mailPush.setFromAddress("hnzzzhsl@126.com"); +// mailPush.setFromPassword("UWBUXNLFJEANRCXX"); + mailPush.setMailServerHost(pushProperties.getMailServer()); + mailPush.setMailServerPort("25"); + mailPush.setFromAddress(pushProperties.getMailFrom()); + mailPush.setFromPassword(pushProperties.getMailPassword()); + mailPush.setUserCacheProvider(userCacheProvider); + mailPush.startup(); + + pushManager.register(mailPush); + return mailPush; + }*/ + + /** + * 閰嶇疆鎺ㄩ�佺洃鍚櫒锛屼粎寮傛鎺ㄩ�佽�呴渶瑕佷娇鐢� + * @return + * @date 2023-04-24 + */ + @Bean + public PushStatusListener pushStatusListener(PushCacheProvider pushCacheProvider, PushServiceImpl pushService){ + DefaultPushListener pushListener = new DefaultPushListener(); + pushListener.setPushService(pushService); + pushListener.setPushCacheProvider(pushCacheProvider); + return pushListener; + } + + /** + * 娉ㄥ唽'妯℃嫙鐭俊'鎺ㄩ�佽�� + * @param pushManager + * @return + * @date 2023-04-24 + */ + @Bean + public MockSmsPush mockSmsPush(PushManager pushManager){ + MockSmsPush mockSmsPush = new MockSmsPush(); + mockSmsPush.startup(); + pushManager.register(mockSmsPush); + return mockSmsPush; + } + + /** + * 娉ㄥ唽榛樿鐨�'绯荤粺娑堟伅'鎺ㄩ�佽�咃紝鍏跺疄骞朵笉鎺ㄩ�併�� + * @param pushManager + * @return + * @date 2023-04-24 + */ + @Bean + public SystemPush systemPush(PushManager pushManager){ + SystemPush systemPush = new SystemPush(); + systemPush.startup(); + pushManager.register(systemPush); + return systemPush; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/config/PushProperties.java b/iplatform-base/src/main/java/com/iplatform/base/config/PushProperties.java new file mode 100644 index 0000000..5bb5afc --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/config/PushProperties.java @@ -0,0 +1,83 @@ +package com.iplatform.base.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +@ConfigurationProperties(prefix = "iplatform.push") +public class PushProperties { + + /** + * 鐭俊鎺ㄩ�佽�呭悕绉帮紝鐢ㄤ簬閰嶇疆鍒囨崲銆� + * <pre> + * 鍗筹細Pushable.getId(); + * </pre> + * @return + */ + public String getSmsPushName() { + return smsPushName; + } + + public void setSmsPushName(String smsPushName) { + this.smsPushName = smsPushName; + } + + /** + * 鐭俊楠岃瘉鐮侊紙鍙戦�侊級妯℃澘ID锛屼竴鑸簯骞冲彴浼氭煡鍒般�� + * @return + */ + public String getSmsTemplateCode() { + return smsTemplateCode; + } + + public void setSmsTemplateCode(String smsTemplateCode) { + this.smsTemplateCode = smsTemplateCode; + } + + /** + * 閰嶇疆鏅�氫笟鍔℃秷鎭紝鎺ㄩ�佹柟寮忚鍒欍�� + * <p>瀵逛簬涓�鑸笟鍔℃彁閱掞紙涓嶅寘鎷細閭欢銆佺煭淇★級锛屾帹閫佺殑鏂瑰紡銆傛帹閫佽�匢D缁勫悎</p> + * <pre> + * 1) tcp && web_socket && wx && system 琛ㄧず杩欏嚑绉嶉�氶亾鍚屾椂鎺ㄩ�� + * 2) tcp || web_socket || wx || system 琛ㄧず杩欏嚑绉嶉�氶亾鍙涓�涓帹閫佸氨OK + * </pre> + * @return + * @date 2023-04-26 + */ + public String getMessageType() { + return messageType; + } + + public void setMessageType(String messageType) { + this.messageType = messageType; + } + + public String getMailServer() { + return mailServer; + } + + public void setMailServer(String mailServer) { + this.mailServer = mailServer; + } + + public String getMailFrom() { + return mailFrom; + } + + public void setMailFrom(String mailFrom) { + this.mailFrom = mailFrom; + } + + public String getMailPassword() { + return mailPassword; + } + + public void setMailPassword(String mailPassword) { + this.mailPassword = mailPassword; + } + + private String mailServer; + private String mailFrom; + private String mailPassword; + private String messageType; + private String smsTemplateCode; + private String smsPushName; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/config/PushWechatConfig.java b/iplatform-base/src/main/java/com/iplatform/base/config/PushWechatConfig.java new file mode 100644 index 0000000..b96b580 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/config/PushWechatConfig.java @@ -0,0 +1,36 @@ +package com.iplatform.base.config; + +import com.walker.push.PushManager; +import com.walker.push.Pushable; +import com.walker.push.wx.WeixinPublicPush; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.client.RestTemplate; + +/** + * 寰俊鍏紬鍙锋帹閫佺嫭绔嬮厤缃紝鍙湁寮曞叆妯″潡鎵嶄細鐢熸晥銆� + * <p>walker-push-wx-public</p> + * @author 鏃跺厠鑻� + * @date 2023-08-23 + */ +@Configuration +@ConditionalOnClass({WeixinPublicPush.class}) +public class PushWechatConfig { + + /** + * 寰俊鍏紬鍙锋帹閫侀厤缃�� + * @param restTemplate + * @param pushManager + * @return + */ + @Bean + public Pushable wechatPublicPush(RestTemplate restTemplate, PushManager pushManager){ + WeixinPublicPush push = new WeixinPublicPush(); + push.setRestTemplate(restTemplate); + push.startup(); + + pushManager.register(push); + return push; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/config/RedisCacheConfig.java b/iplatform-base/src/main/java/com/iplatform/base/config/RedisCacheConfig.java new file mode 100644 index 0000000..df99574 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/config/RedisCacheConfig.java @@ -0,0 +1,288 @@ +package com.iplatform.base.config; + +import com.iplatform.base.CategoryCacheProvider; +import com.iplatform.base.NotificationTemplateCache; +import com.iplatform.base.PushCacheProvider; +import com.iplatform.base.SystemGroupCache; +import com.iplatform.base.UserCacheProvider; +import com.iplatform.base.UserLoginCache; +import com.iplatform.base.WechatCacheProvider; +import com.iplatform.base.cache.MenuCacheProvider; +import com.iplatform.base.cache.RedisCaptchaCacheProvider; +import com.iplatform.base.cache.RedisCategoryCacheProvider; +import com.iplatform.base.cache.RedisDeptCacheProvider; +import com.iplatform.base.cache.RedisHostCacheProvider; +import com.iplatform.base.cache.RedisMenuUpdateCache; +import com.iplatform.base.cache.RedisNotificationTemplateCache; +import com.iplatform.base.cache.RedisPushCacheProvider; +import com.iplatform.base.cache.RedisSystemGroupCache; +import com.iplatform.base.cache.RedisUserCacheProvider; +import com.iplatform.base.cache.RedisUserLoginCache; +import com.iplatform.base.cache.RedisUserOnlineProvider; +import com.iplatform.base.cache.RedisWechatCache; +import com.iplatform.base.service.CategoryServiceImpl; +import com.iplatform.base.service.ConfigArgumentServiceImpl; +import com.iplatform.base.service.DeptServiceImpl; +import com.iplatform.base.service.GroupServiceImpl; +import com.iplatform.base.service.MenuServiceImpl; +import com.iplatform.base.service.NotificationServiceImpl; +import com.iplatform.base.service.UserServiceImpl; +import com.iplatform.base.support.RedisArgumentsManager; +import com.iplatform.model.po.S_host; +import com.walker.cache.CacheProvider; +import com.walker.jdbc.service.PubService; +import com.walker.support.redis.RedisHelper; +import com.walker.support.redis.cache.RedisCacheProvider; +import org.springframework.boot.autoconfigure.AutoConfigureAfter; +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.serializer.StringRedisSerializer; + +@Configuration +@ConditionalOnProperty(prefix = "iplatform.cache", name = "redis-enabled", havingValue = "true", matchIfMissing = false) +@ConditionalOnClass({RedisCacheProvider.class}) +@AutoConfigureAfter(RedisAutoConfiguration.class) +public class RedisCacheConfig extends CacheConfiguration { + + @Bean + public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory redisConnectionFactory){ + RedisTemplate<String, Object> template = new RedisTemplate<String, Object>(); + template.setConnectionFactory(redisConnectionFactory); + StringRedisSerializer stringRedisSerializer = new StringRedisSerializer(); + // key閲囩敤String鐨勫簭鍒楀寲鏂瑰紡 + template.setKeySerializer(stringRedisSerializer); + // hash鐨刱ey涔熼噰鐢⊿tring鐨勫簭鍒楀寲鏂瑰紡 + template.setHashKeySerializer(stringRedisSerializer); + // value搴忓垪鍖栨柟寮忛噰鐢╦ackson +// template.setValueSerializer(jackson2JsonRedisSerializer); + template.setValueSerializer(stringRedisSerializer); + // hash鐨剉alue搴忓垪鍖栨柟寮忛噰鐢╦ackson +// template.setHashValueSerializer(jackson2JsonRedisSerializer); + template.setHashValueSerializer(stringRedisSerializer); + template.afterPropertiesSet(); + return template; + } + + @Bean + public RedisHelper redisHelper(RedisTemplate<String, Object> redisTemplate){ + RedisHelper redisHelper = new RedisHelper(redisTemplate); + return redisHelper; + } + + /** + * 濡傛灉瀛樺湪閰嶇疆椤�(鎵撳紑redis缂撳瓨)锛屽悓鏃跺瓨鍦ㄥ寘(walker-support-redis)鍒欎娇鐢╮edis缂撳瓨瀵硅薄銆� + * @param pubService + * @return + * @throws Exception + * @date 2022-09-20 + */ + @Bean + public CacheProvider<S_host> cacheProviderHostRedis(PubService pubService, RedisHelper redisHelper) throws Exception{ + RedisHostCacheProvider redisHostCacheProvider = new RedisHostCacheProvider(); + redisHostCacheProvider.setRedisHelper(redisHelper); + redisHostCacheProvider.setPubService(pubService); +// hostRedisCacheProvider.afterPropertiesSet(); + logger.info("鍒濆鍖栫紦瀛�: HostRedisCacheProvider"); + return redisHostCacheProvider; + } + + /** + * 鍔犺浇Redis鐢ㄦ埛缂撳瓨鎻愪緵鑰呫�� + * @param userService + * @param redisHelper + * @return + * @date 2022-11-06 + * @date 2023-07-17 娣诲姞鍙傛暟锛歝acheProperties + */ + @Bean + public UserCacheProvider userCacheProviderForRedis(UserServiceImpl userService + , RedisHelper redisHelper, CacheProperties cacheProperties){ + RedisUserCacheProvider redisUserCacheProvider = new RedisUserCacheProvider(); + redisUserCacheProvider.setUserService(userService); + redisUserCacheProvider.setRedisHelper(redisHelper); + // 鐢ㄦ埛閲忓お澶э紝涓嶇敤鍒濆鍖栧姞杞界紦瀛樸��2023-07-17 + redisUserCacheProvider.setAllowInitCache(!cacheProperties.isOrgUserBig()); + return redisUserCacheProvider; + } + + /** + * Redis瀹炵幇鐨勯獙璇佺爜缂撳瓨瀵硅薄銆�<p></p> + * 1.鍥犱负<code>CacheProvider</code>鎸夌収绫诲瀷浠�<code>SimpleCacheManager</code>涓幏鍙栵紝绫诲瀷鏄笉鑳介噸澶嶇殑锛�<br> + * 鍥犳浼氬鑷村涓猄tring绫诲瀷鐨勭紦瀛樺畾涔夋棤娉曞尯鍒紝瀹為檯涓婄郴缁熷彧鑳借褰曠涓�涓�� + * 2.绯荤粺鍦ㄥ畾涔夋椂鏈変袱绉嶅姙娉�: + * <pre> + * 1) Bean鍔犱笂鍞竴鍚嶅瓧锛屼笟鍔″湪寮曠敤鏃朵娇鐢ㄥ悕绉� + * 2锛夋妸缂撳瓨瀹氫箟鍐嶅皝瑁呬竴灞傛帴鍙o紝灏卞儚鐢ㄦ埛銆佹満鏋勭紦瀛橀偅鏍峰畾涔夈�� + * </pre> + * @param redisHelper + * @return + * @date 2022-11-07 + */ + @Bean("captchaCacheProvider") + public CacheProvider<String> cacheProviderCaptchaRedis(RedisHelper redisHelper){ + RedisCaptchaCacheProvider redisCaptchaCacheProvider = new RedisCaptchaCacheProvider(); + redisCaptchaCacheProvider.setRedisHelper(redisHelper); + return redisCaptchaCacheProvider; + } + + @Bean + public RedisUserOnlineProvider redisUserOnlineProvider(RedisHelper redisHelper){ + RedisUserOnlineProvider userOnlineProvider = new RedisUserOnlineProvider(); + userOnlineProvider.setRedisHelper(redisHelper); + return userOnlineProvider; + } + + /** + * 鍩轰簬 Redis 鐨勮繍琛屽弬鏁扮鐞嗗櫒瀹炵幇銆� + * @param configArgumentService + * @param redisHelper + * @return + */ + @Bean + public RedisArgumentsManager redisArgumentsManager(ConfigArgumentServiceImpl configArgumentService, RedisHelper redisHelper){ + RedisArgumentsManager redisArgumentsManager = new RedisArgumentsManager(); + redisArgumentsManager.setConfigArgumentService(configArgumentService); + redisArgumentsManager.setRedisHelper(redisHelper); + return redisArgumentsManager; + } + + /** + * 鍩轰簬 Redis 鐨勬満鏋勭紦瀛樺疄鐜般�� + * @param deptService + * @param redisHelper + * @return + * @date 2022-12-03 + */ + @Bean + public RedisDeptCacheProvider redisDeptCacheProvider(DeptServiceImpl deptService + , RedisHelper redisHelper, CacheProperties cacheProperties){ + RedisDeptCacheProvider redisDeptCacheProvider = new RedisDeptCacheProvider(); + redisDeptCacheProvider.setDeptService(deptService); + redisDeptCacheProvider.setRedisHelper(redisHelper); + // 鐢ㄦ埛閲忓お澶э紝涓嶇敤缂撳瓨鏈烘瀯鏍戙��2023-07-17 + redisDeptCacheProvider.setAllowCacheChildren(!cacheProperties.isOrgAloneBig()); + return redisDeptCacheProvider; + } + + /** + * 鎺ㄩ�佹彁閱掍复鏃舵暟鎹紦瀛樺畾涔夈�� + * @return + * @date 2023-04-27 + */ + @Bean + public PushCacheProvider pushCacheProvider(RedisHelper redisHelper){ + RedisPushCacheProvider pushCacheProvider = new RedisPushCacheProvider(); + pushCacheProvider.setRedisHelper(redisHelper); + return pushCacheProvider; + } + + /** + * 骞冲彴鍒嗙被鏁版嵁锛孯edis缂撳瓨瀹炵幇銆� + * @param categoryService + * @param redisHelper + * @return + * @date 2023-05-17 + */ + @Bean + public CategoryCacheProvider categoryCacheProvider(RedisHelper redisHelper, CategoryServiceImpl categoryService){ + RedisCategoryCacheProvider categoryCacheProvider = new RedisCategoryCacheProvider(); + categoryCacheProvider.setRedisHelper(redisHelper); + categoryCacheProvider.setCategoryService(categoryService); + return categoryCacheProvider; + } + + @Bean + public SystemGroupCache systemGroupCache(RedisHelper redisHelper, GroupServiceImpl groupService){ + RedisSystemGroupCache cache = new RedisSystemGroupCache(); + cache.setRedisHelper(redisHelper); + cache.setGroupService(groupService); + return cache; + } + + /** + * 鐢ㄦ埛鐧诲綍璁板綍缂撳瓨锛岀敤浜庡垽鏂櫥褰曠瓥鐣ャ�� + * @return + * @date 2023-07-11 + */ + @Bean + public UserLoginCache userLoginCache(RedisHelper redisHelper){ + RedisUserLoginCache cache = new RedisUserLoginCache(); + cache.setRedisHelper(redisHelper); + return cache; + } + + /** + * 寰俊鐩稿叧缂撳瓨閰嶇疆銆� + * @param redisHelper + * @return + * @date 2023-07-16 + * @date 2023-08-23 杩佺Щ鍒� base 妯″潡 + */ + @Bean + public WechatCacheProvider wechatCacheProvider(RedisHelper redisHelper){ + RedisWechatCache cache = new RedisWechatCache(); + cache.setRedisHelper(redisHelper); + return cache; + } + + /** + * 閫氱煡鎻愰啋妯℃澘閰嶇疆缂撳瓨銆� + * @param notificationService + * @return + * @date 2023-08-25 + */ + @Bean + public NotificationTemplateCache notificationTemplateCache(RedisHelper redisHelper, NotificationServiceImpl notificationService){ + RedisNotificationTemplateCache cache = new RedisNotificationTemplateCache(); + cache.setRedisHelper(redisHelper); + cache.setNotificationService(notificationService); + return cache; + } + +// /** +// * 鑿滃崟缂撳瓨鐩存帴鏀规垚redis銆� +// * @param redisHelper +// * @param menuService +// * @return +// * @date 2024-01-17 +// */ +// @Bean +// public MenuCacheProvider menuCacheProvider(RedisHelper redisHelper, MenuServiceImpl menuService){ +// MenuCacheProvider menuCacheProvider = new MenuCacheProvider(); +// menuCacheProvider.setRedisHelper(redisHelper); +// menuCacheProvider.setMenuService(menuService); +// return menuCacheProvider; +// } + + /** + * 鑿滃崟鏇存柊鏃堕棿缂撳瓨 + * @param redisHelper + * @return + * @date 2024-04-09 + */ + @Bean + public RedisMenuUpdateCache redisMenuUpdateCache(RedisHelper redisHelper){ + RedisMenuUpdateCache cache = new RedisMenuUpdateCache(); + cache.setRedisHelper(redisHelper); + return cache; + } + + /** + * 鑿滃崟缂撳瓨锛岃縼绉诲埌redis涓紝閰嶅悎鏇存柊鏃堕棿缂撳瓨锛岄泦缇ょ幆澧冨彲琚姩鏇存柊鏁版嵁銆� + * @param menuService + * @return + * @date 2024-04-09 + */ + @Bean + public MenuCacheProvider menuCacheProvider(MenuServiceImpl menuService, RedisMenuUpdateCache menuUpdateCache){ + MenuCacheProvider menuCacheProvider = new MenuCacheProvider(); + menuCacheProvider.setMenuService(menuService); + menuCacheProvider.setMenuUpdateCache(menuUpdateCache); + return menuCacheProvider; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/config/RestTemplateProperties.java b/iplatform-base/src/main/java/com/iplatform/base/config/RestTemplateProperties.java new file mode 100644 index 0000000..2148a09 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/config/RestTemplateProperties.java @@ -0,0 +1,73 @@ +package com.iplatform.base.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +@ConfigurationProperties(prefix = "iplatform.rest") +public class RestTemplateProperties { + + /** + * 杩炴帴淇濇寔娲诲姩鐨勬椂闂达紝榛樿600绉� + * @return + */ + public long getKeepAliveDurationSeconds() { + return keepAliveDurationSeconds; + } + + public void setKeepAliveDurationSeconds(long keepAliveDurationSeconds) { + this.keepAliveDurationSeconds = keepAliveDurationSeconds; + } + + /** + * 鏈�澶х┖闂茶繛鎺ユ暟閲忥紝榛樿锛�200 + * @return + */ + public long getMaxIdleConnections() { + return maxIdleConnections; + } + + public void setMaxIdleConnections(long maxIdleConnections) { + this.maxIdleConnections = maxIdleConnections; + } + + /** + * 杩炴帴瓒呮椂锛岄粯璁わ細2绉� + * @return + */ + public long getConnectTimeoutSeconds() { + return connectTimeoutSeconds; + } + + public void setConnectTimeoutSeconds(long connectTimeoutSeconds) { + this.connectTimeoutSeconds = connectTimeoutSeconds; + } + + /** + * 璇昏秴鏃讹紝榛樿锛�3绉� + * @return + */ + public long getReadTimeoutSeconds() { + return readTimeoutSeconds; + } + + public void setReadTimeoutSeconds(long readTimeoutSeconds) { + this.readTimeoutSeconds = readTimeoutSeconds; + } + + /** + * 鍐欒秴鏃讹紝榛樿锛�3绉� + * @return + */ + public long getWriteTimeoutSeconds() { + return writeTimeoutSeconds; + } + + public void setWriteTimeoutSeconds(long writeTimeoutSeconds) { + this.writeTimeoutSeconds = writeTimeoutSeconds; + } + + private long keepAliveDurationSeconds = 300; + private long maxIdleConnections = 200; + private long connectTimeoutSeconds = 2; + private long readTimeoutSeconds = 3; + private long writeTimeoutSeconds = 3; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/config/SecurityUserProperties.java b/iplatform-base/src/main/java/com/iplatform/base/config/SecurityUserProperties.java new file mode 100644 index 0000000..e6b9972 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/config/SecurityUserProperties.java @@ -0,0 +1,36 @@ +package com.iplatform.base.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +@ConfigurationProperties(prefix = "iplatform.security.user") +public class SecurityUserProperties { + + /** + * 鐢ㄦ埛淇敼瀵嗙爜鐨勫畨鍏ㄧ瓑绾э紝鍙傝�冿細{@linkplain com.walker.infrastructure.utils.PasswordUtils#LEVEL_01_LOW} + * @return + * @date 2023-08-03 + */ + public int getPassLevel() { + return passLevel; + } + + public void setPassLevel(int passLevel) { + this.passLevel = passLevel; + } + + /** + * 鏄惁瑕侊紙寮哄埗鎻愮ず锛変慨鏀归粯璁ゅ瘑鐮� + * @return + * @date 2023-08-03 + */ + public boolean isPassDefaultModify() { + return passDefaultModify; + } + + public void setPassDefaultModify(boolean passDefaultModify) { + this.passDefaultModify = passDefaultModify; + } + + private int passLevel = 1; + private boolean passDefaultModify = true; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/config/SpiConfig.java b/iplatform-base/src/main/java/com/iplatform/base/config/SpiConfig.java new file mode 100644 index 0000000..99cedaf --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/config/SpiConfig.java @@ -0,0 +1,97 @@ +package com.iplatform.base.config; + +import com.iplatform.base.FileOperateSpi; +import com.iplatform.base.SecuritySpi; +import com.iplatform.core.PlatformConfiguration; +import com.walker.infrastructure.utils.ClassUtils; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import java.lang.reflect.Constructor; + +/** + * SecuritySPI瀹炵幇閰嶇疆瀵硅薄锛岃櫧鐒舵槸鍦ㄥ熀纭�妯″潡閰嶇疆锛屼絾瀹炵幇鍙互閫氳繃寮曞叆鍚勭绗笁鏂规潵瀹炵幇銆�<p></p> + * 濡傦細spring security 鎴栬�� shiro绛夛紝榛樿: sepring security銆� + * @date 2022-11-11 + * @author 鏃跺厠鑻� + */ +@Configuration +public class SpiConfig extends PlatformConfiguration { + + private final String DEFAULT_SECURITY_SPI_CLASS = "com.iplatform.security.DefaultSecuritySpi"; + private final String NOTHING_SECURITY_SPI_CLASS = "com.iplatform.base.support.NothingSecuritySpi"; + + private final String DEFAULT_FILE_OPERATE_SPI_CLASS = "com.iplatform.file.DefaultFileOperateSpi"; + + /** + * 鏂囦欢鍩烘湰淇℃伅閰嶇疆锛屾斁鍦� Base spi 妯″潡閰嶇疆锛屽彲璁� file 妯″潡澶嶇敤銆� + * @return + * @date 2023-02-15 + */ + @Bean + public FileProperties fileProperties(){ + return new FileProperties(); + } + + @Bean + public FileOperateSpi fileOperateSpi(){ + try { + FileOperateSpi fileOperateSpi = this.acquireFileOperateSpi(DEFAULT_FILE_OPERATE_SPI_CLASS); + logger.info("鍒涘缓 'FileOperateSpi' 瀹炵幇瀵硅薄鎴愬姛: " + DEFAULT_FILE_OPERATE_SPI_CLASS); + return fileOperateSpi; + + } catch (Exception e) { + if(e instanceof ClassNotFoundException){ + logger.error("鍒涘缓'FileOperateSpi'鎻愪緵鑰呭璞¢敊璇�, 瀹炵幇绫讳笉瀛樺湪: " + DEFAULT_FILE_OPERATE_SPI_CLASS); + } + throw new RuntimeException("鍒涘缓 'FileOperateSpi' 寮傚父: " + DEFAULT_FILE_OPERATE_SPI_CLASS, e); + } + } + + @Bean + public SecuritySpi securitySpi(){ + try { +// Class<?> schedulerClass = ClassUtils.forName(DEFAULT_SECURITY_SPI_CLASS, SpiConfig.class.getClassLoader()); +// Constructor<SecuritySpi> constructor = (Constructor<SecuritySpi>)schedulerClass.getConstructor(); +// SecuritySpi securitySpi = constructor.newInstance(); + SecuritySpi securitySpi = this.acquireSecuritySpi(DEFAULT_SECURITY_SPI_CLASS); + logger.info("鍒涘缓 SecuritySpi 瀹炵幇瀵硅薄鎴愬姛: " + DEFAULT_SECURITY_SPI_CLASS); + return securitySpi; + + } catch (Exception e) { + if(e instanceof ClassNotFoundException){ + logger.error("鍒涘缓'SecuritySpi'鎻愪緵鑰呭璞¢敊璇�, 瀹炵幇绫讳笉瀛樺湪: " + DEFAULT_SECURITY_SPI_CLASS); + logger.warn("鍒涘缓鍐呯疆榛樿SPI: " + NOTHING_SECURITY_SPI_CLASS); + try { + return this.acquireSecuritySpi(NOTHING_SECURITY_SPI_CLASS); + } catch (Exception ex) { + logger.error(".............", ex); + throw new RuntimeException("鍒涘缓鍐呯疆SPI寮傚父: " + NOTHING_SECURITY_SPI_CLASS, ex); + } + } else { + throw new RuntimeException("鍒涘缓SPI寮傚父:" + e.getMessage(), e); + } + } +// catch (NoSuchMethodException e) { +// logger.error("鍒涘缓'SecuritySpi'鎻愪緵鑰呭璞¢敊璇�, 榛樿鏋勯�犳柟娉曚笉瀛樺湪", e); +// throw new RuntimeException(e); +// } catch (Exception ex){ +// throw new RuntimeException(ex); +// } + } + + private FileOperateSpi acquireFileOperateSpi(String clazzName) throws Exception{ + Class<?> schedulerClass = ClassUtils.forName(clazzName, SpiConfig.class.getClassLoader()); + Constructor<FileOperateSpi> constructor = (Constructor<FileOperateSpi>)schedulerClass.getConstructor(); + FileOperateSpi securitySpi = constructor.newInstance(); + return securitySpi; + } + + private SecuritySpi acquireSecuritySpi(String clazzName) throws Exception{ + Class<?> schedulerClass = ClassUtils.forName(clazzName, SpiConfig.class.getClassLoader()); + Constructor<SecuritySpi> constructor = (Constructor<SecuritySpi>)schedulerClass.getConstructor(); + SecuritySpi securitySpi = constructor.newInstance(); + return securitySpi; + } + +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/config/TcpProperties.java b/iplatform-base/src/main/java/com/iplatform/base/config/TcpProperties.java new file mode 100644 index 0000000..b02f412 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/config/TcpProperties.java @@ -0,0 +1,163 @@ +package com.iplatform.base.config; + +import com.iplatform.base.Constants; +import org.springframework.boot.context.properties.ConfigurationProperties; + +@ConfigurationProperties(prefix = "iplatform.tcp") +public class TcpProperties { + + public boolean isEnabled() { + return enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + + public boolean isShowLog() { + return showLog; + } + + public void setShowLog(boolean showLog) { + this.showLog = showLog; + } + + /** + * 杩斿洖璇锋眰娑堟伅闃熷垪绠$悊鍣ㄧ殑瀹炵幇绫诲瀷锛岀洰鍓嶅彧鏈夊唴瀛樺疄鐜般�� + * @return + */ + public String getQueueType() { + return queueType; + } + + public void setQueueType(String queueType) { + this.queueType = queueType; + } + + public String getScanPackagesTcp() { + return scanPackagesTcp; + } + + public void setScanPackagesTcp(String scanPackagesTcp) { + this.scanPackagesTcp = scanPackagesTcp; + } + + public String getScanPackagesWs() { + return scanPackagesWs; + } + + public void setScanPackagesWs(String scanPackagesWs) { + this.scanPackagesWs = scanPackagesWs; + } + + public int getPortTcp() { + return portTcp; + } + + public void setPortTcp(int portTcp) { + this.portTcp = portTcp; + } + + public String getWebsocketUri() { + return websocketUri; + } + + public void setWebsocketUri(String websocketUri) { + this.websocketUri = websocketUri; + } + + public int getBossThreadNum() { + return bossThreadNum; + } + + public void setBossThreadNum(int bossThreadNum) { + this.bossThreadNum = bossThreadNum; + } + + public int getWorkerThreadNum() { + return workerThreadNum; + } + + public void setWorkerThreadNum(int workerThreadNum) { + this.workerThreadNum = workerThreadNum; + } + + public int getPortWs() { + return portWs; + } + + public void setPortWs(int portWs) { + this.portWs = portWs; + } + + public boolean isOpenHeartBeat() { + return openHeartBeat; + } + + public void setOpenHeartBeat(boolean openHeartBeat) { + this.openHeartBeat = openHeartBeat; + } + + /** + * 鏄惁寮�鍚嚜瀹氫箟锛氶暱杩炴帴绠$悊鍣紝濡傛灉寮�鍚垯闇�瑕佷笟鍔★紙鍒涘缓锛夐厤缃瀵硅薄銆� + * @return + * @date 2023-07-19 + */ + public boolean isCustomConnectionManager() { + return customConnectionManager; + } + + public void setCustomConnectionManager(boolean customConnectionManager) { + this.customConnectionManager = customConnectionManager; + } + + /** + * 杩斿洖蹇冭烦璁剧疆鐨勬椂闂达紝榛樿锛�60绉� + * @return + * @date 2023-08-28 + */ + public long getHeartBeatSeconds() { + return heartBeatSeconds; + } + + public void setHeartBeatSeconds(long heartBeatSeconds) { + this.heartBeatSeconds = heartBeatSeconds; + } + + /** + * 鏄惁鏀寔闆嗙兢妯″紡锛宼rue琛ㄧず鏀寔锛屼細浣跨敤璐熻浇杩炴帴绠$悊鍣紝骞跺惎鐢∕Q娑堟伅闃熷垪銆� + * @return + * @date 2023-09-26 + */ + public boolean isLoadBalanceEnabled() { + return loadBalanceEnabled; + } + + public void setLoadBalanceEnabled(boolean loadBalanceEnabled) { + this.loadBalanceEnabled = loadBalanceEnabled; + } + + public String getConnectionHost() { + return connectionHost; + } + + public void setConnectionHost(String connectionHost) { + this.connectionHost = connectionHost; + } + + private String connectionHost; + private boolean loadBalanceEnabled = false; + private long heartBeatSeconds = 60; + private boolean customConnectionManager = false; + private boolean openHeartBeat = false; + private int portWs = 60000; + private boolean enabled = false; + private boolean showLog = true; + private String queueType = Constants.QUEUE_TYPE_MEMORY; + private String scanPackagesTcp; + private String scanPackagesWs; + private int portTcp = 7878; + private String websocketUri = "ws://localhost:60000/websocket"; + private int bossThreadNum = 2; + private int workerThreadNum = 4; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/config/ThirdPartyConfig.java b/iplatform-base/src/main/java/com/iplatform/base/config/ThirdPartyConfig.java new file mode 100644 index 0000000..acbecc4 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/config/ThirdPartyConfig.java @@ -0,0 +1,26 @@ +package com.iplatform.base.config; + +import com.iplatform.base.ThirdPartyManager; +import com.iplatform.core.PlatformConfiguration; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +/** + * 绗笁鏂瑰鎺ョ浉鍏抽厤缃�� + * @author 鏃跺厠鑻� + * @date 2023-07-03 + */ +@Configuration +public class ThirdPartyConfig extends PlatformConfiguration { + + /** + * 绗笁鏂瑰鎺ョ鐞嗗櫒閰嶇疆銆� + * @return + * @date 2023-07-03 + */ + @Bean + public ThirdPartyManager thirdPartyManager(){ + ThirdPartyManager thirdPartyManager = new ThirdPartyManager(); + return thirdPartyManager; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/config/ThreadPoolConfig.java b/iplatform-base/src/main/java/com/iplatform/base/config/ThreadPoolConfig.java new file mode 100644 index 0000000..3c44d78 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/config/ThreadPoolConfig.java @@ -0,0 +1,58 @@ +package com.iplatform.base.config; + +import com.iplatform.core.PlatformConfiguration; +import com.iplatform.core.util.ThreadUtils; +import org.apache.commons.lang3.concurrent.BasicThreadFactory; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; + +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.ScheduledThreadPoolExecutor; +import java.util.concurrent.ThreadPoolExecutor; + +@Configuration +public class ThreadPoolConfig extends PlatformConfiguration { + + // 鏍稿績绾跨▼姹犲ぇ灏� + private int corePoolSize = 8; + + // 鏈�澶у彲鍒涘缓鐨勭嚎绋嬫暟 + private int maxPoolSize = 32; + + // 闃熷垪鏈�澶ч暱搴� + private int queueCapacity = 2048; + + // 绾跨▼姹犵淮鎶ょ嚎绋嬫墍鍏佽鐨勭┖闂叉椂闂� + private int keepAliveSeconds = 300; + + @Bean(name = "threadPoolTaskExecutor") + public ThreadPoolTaskExecutor threadPoolTaskExecutor() { + ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor(); + executor.setMaxPoolSize(maxPoolSize); + executor.setCorePoolSize(corePoolSize); + executor.setQueueCapacity(queueCapacity); + executor.setKeepAliveSeconds(keepAliveSeconds); + // 绾跨▼姹犲鎷掔粷浠诲姟(鏃犵嚎绋嬪彲鐢�)鐨勫鐞嗙瓥鐣� + executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy()); + // 濡傛灉瓒呰繃闃熷垪鏈�澶у�硷紝浠ヤ笅浣跨敤鎷掔粷绛栫暐銆�2023-04-24 +// executor.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy()); + return executor; + } + + /** + * 鎵ц鍛ㄦ湡鎬ф垨瀹氭椂浠诲姟 + */ + @Bean(name = "scheduledExecutorService") + protected ScheduledExecutorService scheduledExecutorService() { + return new ScheduledThreadPoolExecutor(corePoolSize, + new BasicThreadFactory.Builder().namingPattern("schedule-pool-%d").daemon(true).build(), + new ThreadPoolExecutor.CallerRunsPolicy()) { + @Override + protected void afterExecute(Runnable r, Throwable t) { + super.afterExecute(r, t); + ThreadUtils.printException(r, t); + } + }; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/config/WebCommonConfig.java b/iplatform-base/src/main/java/com/iplatform/base/config/WebCommonConfig.java new file mode 100644 index 0000000..f94ff10 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/config/WebCommonConfig.java @@ -0,0 +1,282 @@ +package com.iplatform.base.config; + +import com.iplatform.base.SecuritySpi; +import com.iplatform.base.UserLoginCache; +import com.iplatform.base.service.ApiTimeServiceImpl; +import com.iplatform.base.service.LogServiceImpl; +import com.iplatform.base.support.LogAspect; +import com.iplatform.base.support.PlatformOperationInterceptor; +import com.iplatform.base.support.TimeStatisticsInterceptor; +import com.iplatform.base.support.strategy.AbstractLoginStrategy; +import com.iplatform.base.support.strategy.LoginStrategyManager; +import com.iplatform.base.support.strategy.MobileOnceLoginStrategy; +import com.iplatform.base.support.strategy.WebOnceLoginStrategy; +import com.iplatform.core.PlatformConfiguration; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.web.RestTemplateConfig; +import com.walker.web.RestTemplateFactory; +import com.walker.web.TokenGenerator; +import com.walker.web.WebAgentService; +import com.walker.web.agent.BrowserCapWebAgentService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.client.RestTemplate; +import org.springframework.web.servlet.config.annotation.InterceptorRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +import java.util.List; + +/** + * Web鎿嶄綔閫氱敤閰嶇疆銆� + * @author 鏃跺厠鑻� + * @date 2022-11-21 + */ +@Configuration +public class WebCommonConfig extends PlatformConfiguration implements WebMvcConfigurer { + + private TokenGenerator tokenGenerator; + private ApiTimeServiceImpl apiTimeService; + + @Autowired + public WebCommonConfig(TokenGenerator tokenGenerator, ApiTimeServiceImpl apiTimeService){ + this.tokenGenerator = tokenGenerator; + this.apiTimeService = apiTimeService; + } + +// /** +// * 娴嬭瘯鐧诲綍鍥炶皟銆傛寮忚娉ㄩ噴鎺夛紝骞冲彴鍙厑璁镐笟鍔¢厤缃竴涓紒锛侊紒 +// * @return +// * @date 2023-08-18 +// */ +// @Bean +// public AfterLoginCallback afterLoginCallback(){ +// return new TestAfterLoginCallback(); +// } + + /** + * 骞冲彴瀵筧pi缁熶竴鎿嶄綔锛堝锛氱洃鎺э級鐩稿叧閰嶇疆 + * @return + * @date 2024-02-29 + */ + @Bean + public ApiProperties apiProperties(){ + return new ApiProperties(); + } + + @Bean + public LoginStrategyProperties loginStrategyProperties(){ + return new LoginStrategyProperties(); + } + + /** + * 娑夊強鐢ㄦ埛瀹夊叏鐨勪竴浜涘熀鏈厤缃紝濡傦細鐧诲綍閿欒娆℃暟銆佸瘑鐮佸畨鍏ㄧ骇鍒瓑銆� + * @return + * @date 2023-08-05 + */ + @Bean + public SecurityUserProperties securityUserProperties(){ + return new SecurityUserProperties(); + } + + @Bean + public LoginStrategyManager loginStrategyManager(UserLoginCache userLoginCache){ + LoginStrategyManager manager = new LoginStrategyManager(); + manager.setUserLoginCache(userLoginCache); + return manager; + } + + /** + * 閰嶇疆鐧诲綍绛栫暐瀹氫箟锛孭C绔紙鍚屼竴鐢ㄦ埛锛夊彧鑳界櫥褰曚竴娆★紝鏃犳硶閲嶅鐧诲綍銆� + * <pre> + * 1) 濡傛灉闇�瑕佷娇鐢紝 閰嶇疆鏂囦欢鍒楄〃涓紝鍔犱笂鍗冲彲銆� + * </pre> + * @param userLoginCache + * @param loginStrategyProperties + * @param loginStrategyManager + * @return + * @date 2023-09-08 + */ + @Bean + public WebOnceLoginStrategy webOnceLoginStrategy(UserLoginCache userLoginCache + , LoginStrategyProperties loginStrategyProperties, LoginStrategyManager loginStrategyManager){ + List<String> enabledNameList = loginStrategyProperties.getLoginStrategyList(); + WebOnceLoginStrategy strategy = new WebOnceLoginStrategy(); + strategy.setUserLoginCache(userLoginCache); + strategy.setTokenExpireWeb(loginStrategyProperties.getTokenExpireWeb()); + strategy.setName("PC绔悓涓�璐﹀彿鍙兘鐧诲綍涓�娆�"); + this.setupRegisterLoginStrategy(enabledNameList, strategy, loginStrategyManager, WebOnceLoginStrategy.class.getName()); + return strategy; + } + + /** + * 閰嶇疆鐧诲綍绛栫暐瀹氫箟锛屽苟娉ㄥ唽鍒扮鐞嗗櫒涓�� + * <p>绉诲姩绔悓涓�璐﹀彿鍙兘鐧诲綍涓�娆°��</p> + * @param userLoginCache + * @param loginStrategyProperties + * @return + * @date 2023-07-11 + */ + @Bean + public MobileOnceLoginStrategy mobileOnceLoginStrategy(UserLoginCache userLoginCache + , LoginStrategyProperties loginStrategyProperties, LoginStrategyManager loginStrategyManager){ + List<String> enabledNameList = loginStrategyProperties.getLoginStrategyList(); + MobileOnceLoginStrategy strategy = new MobileOnceLoginStrategy(); + strategy.setUserLoginCache(userLoginCache); + strategy.setTokenExpireMobile(loginStrategyProperties.getTokenExpireMobile()); + strategy.setName("绉诲姩绔悓涓�璐﹀彿鍙兘鐧诲綍涓�娆�"); +// if(!StringUtils.isEmptyList(enabledNameList)){ +// for(String name : enabledNameList){ +// if(name.equals(strategy.getClass().getName())){ +// strategy.setEnabled(true); +// loginStrategyManager.register(strategy); +// logger.info("鍚敤浜嗙櫥褰曠瓥鐣ワ細{}", strategy.getName()); +// break; +// } +// } +// } + this.setupRegisterLoginStrategy(enabledNameList, strategy, loginStrategyManager, MobileOnceLoginStrategy.class.getName()); + return strategy; + } + + private void setupRegisterLoginStrategy(List<String> enabledNameList + , AbstractLoginStrategy strategy, LoginStrategyManager loginStrategyManager, String strategyClazz){ + if(!StringUtils.isEmptyList(enabledNameList)){ + for(String name : enabledNameList){ + if(name.equals(strategyClazz)){ + strategy.setEnabled(true); + loginStrategyManager.register(strategyClazz, strategy); + logger.info("鍚敤浜嗙櫥褰曠瓥鐣ワ細{}", strategy.getName()); + break; + } + } + } + } + + /** + * TCP閫氫俊妯″潡閰嶇疆鍐呭锛岃縼绉诲埌base妯″潡涓紝鍥犱负鍓嶇瑕佽幏鍙杦ebsocket.uri锛岃鎺ュ彛蹇呴』鍦ㄥ熀纭�妯″潡锛屽惁鍒欎細涓ラ噸渚濊禆tcp銆� + * @return + * @date 2023-04-17 + */ + @Bean + public TcpProperties tcpProperties(){ + return new TcpProperties(); + } + + /** + * 缁熶竴鎷︽埅Web鎿嶄綔鐩稿叧锛屽寘鎷細娓呯┖鍒嗛〉绾跨▼鍙橀噺绛夈�� + * @return + * @date 2022-11-21 + * @date 2023-01-28 鍘绘帀pathPattern闄愬埗锛屽洜涓烘嫤鎴櫒閲岄潰宸茬粡鍒ゆ柇锛屽浜庣壒寰� '/list' 缁熶竴鎵ц鍒嗛〉鍑嗗銆� + * @date 2023-03-09 閲嶅啓骞冲彴鎷︽埅鍣紝娣诲姞瀵规姤琛ㄦ祻瑙堟潈闄愭帶鍒躲�� + * @date 2024-02-29 娣诲姞api缁熻鏃堕棿鎷︽埅鍣� + */ + @Override + public void addInterceptors(InterceptorRegistry registry){ +// registry.addInterceptor(new WebOperationInterceptor()) +// .addPathPatterns("/system/**", "/api/**") + ; + PlatformOperationInterceptor platformOperationInterceptor = new PlatformOperationInterceptor(); + platformOperationInterceptor.setTokenGenerator(this.tokenGenerator); + registry.addInterceptor(platformOperationInterceptor); + logger.info(".......... WebOperationInterceptor 娉ㄥ唽鎴愬姛"); + + // api鐩戞帶鎷︽埅鍣� + ApiProperties apiProperties = this.apiProperties(); + TimeStatisticsInterceptor timeStatisticsInterceptor = new TimeStatisticsInterceptor(); + timeStatisticsInterceptor.setApiTimeService(this.apiTimeService); + timeStatisticsInterceptor.setEnabled(apiProperties.isTimeEnabled()); + registry.addInterceptor(timeStatisticsInterceptor); + logger.info(".......... TimeStatisticsInterceptor锛坅pi缁熻鎷︽埅锛� 娉ㄥ唽鎴愬姛锛宔nable = {}", apiProperties.isTimeEnabled()); + } + +// /** +// * 閰嶇疆杩滅▼HTTP璋冪敤妯℃澘銆� +// * @return +// * @date 2023-03-01 +// */ +// @Bean +// public RestTemplate restTemplate(){ +// RestTemplate restTemplate = new RestTemplate(); +// List<HttpMessageConverter<?>> messageConverters = restTemplate.getMessageConverters(); +// Iterator<HttpMessageConverter<?>> iterator=messageConverters.iterator(); +// while(iterator.hasNext()){ +// HttpMessageConverter<?> converter=iterator.next(); +// //鍘熸湁鐨凷tring鏄疘SO-8859-1缂栫爜 鍘绘帀 +// if(converter instanceof StringHttpMessageConverter){ +// iterator.remove(); +// } +// } +// messageConverters.add(new StringHttpMessageConverter(StandardCharsets.UTF_8)); +// return restTemplate; +// } + + @Bean + public RestTemplateProperties restTemplateProperties(){ + return new RestTemplateProperties(); + } + + /** + * 閲嶆瀯 RestTemplate 鐢熸垚锛岀粺涓�浠庡伐鍘傚垱寤猴紝鏀寔澶氱http杩炴帴姹犳柟寮忥紝鐩墠浠呭疄鐜帮細okhttp + * @param restTemplateProperties + * @return + * @date 2023-08-18 + */ + @Bean + public RestTemplate restTemplateOkHttp(RestTemplateProperties restTemplateProperties){ + RestTemplateConfig config = new RestTemplateConfig(); + config.setKeepAliveDurationSeconds(restTemplateProperties.getKeepAliveDurationSeconds()); + config.setMaxIdleConnections((int)restTemplateProperties.getMaxIdleConnections()); + config.setConnectTimeoutSeconds(restTemplateProperties.getConnectTimeoutSeconds()); + config.setReadTimeoutSeconds(restTemplateProperties.getReadTimeoutSeconds()); + config.setWriteTimeoutSeconds(restTemplateProperties.getWriteTimeoutSeconds()); + RestTemplate restTemplate = RestTemplateFactory.createRestTemplate(RestTemplateFactory.HttpType.OkHttp, config); + return restTemplate; + } + + /** + * 閰嶇疆涓�涓祻瑙堝櫒浠g悊瑙f瀽瀵硅薄銆� + * <pre> + * 1)璇ュ璞¢粯璁や娇鐢ㄥ熀浜� BrowserCap 涓�涓紑婧愮粍浠跺疄鐜板簳灞傝В鏋� + * 2锛塈P鏌ユ壘浣嶇疆璋冪敤浜嗙涓夋柟鏈嶅姟: pconline + * </pre> + * @return + * @date 2023-01-05 + */ + @Bean + public WebAgentService webAgentService(){ + return new BrowserCapWebAgentService(); + } + + /** + * 鏃ュ織寮�鍏抽厤缃�� + * @return + * @date 2023-01-05 + */ + @Bean + public LogProperties logProperties(){ + return new LogProperties(); + } + +// @Bean +// public PlatformUserCallback testUserCallback(){ +// return new TestUserCallback(); +// } + + /** + * 閰嶇疆鎿嶄綔鏃ュ織鍒囬潰鍐欏叆瀵硅薄銆� + * @param securitySpi + * @param logService + * @return + * @date 2023-01-06 + */ + @Bean + public LogAspect logAspect(SecuritySpi securitySpi, LogServiceImpl logService, LogProperties logProperties){ + LogAspect logAspect = new LogAspect(); + logAspect.setSecuritySpi(securitySpi); + logAspect.setLogService(logService); + logAspect.setEnableLog(logProperties.isOperateEnabled()); + logger.info("鍒涘缓:LogAspect..."); + return logAspect; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/controller/CaptchaController.java b/iplatform-base/src/main/java/com/iplatform/base/controller/CaptchaController.java new file mode 100644 index 0000000..0ddd632 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/controller/CaptchaController.java @@ -0,0 +1,246 @@ +package com.iplatform.base.controller; + +import com.iplatform.base.ArgumentsConstants; +import com.iplatform.base.Constants; +import com.iplatform.base.SystemController; +import com.iplatform.base.captcha.BlockPuzzleCaptchaProvider; +import com.iplatform.base.captcha.JigsawCaptchaProvider; +import com.iplatform.base.captcha.JigsawResult; +import com.walker.infrastructure.utils.Base64; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.web.CaptchaProvider; +import com.walker.web.CaptchaResult; +import com.walker.web.ResponseValue; +import com.walker.web.util.IdUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.util.FastByteArrayOutputStream; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.imageio.ImageIO; +import java.io.IOException; +import java.util.HashMap; +import java.util.Map; + +/** + * 楠岃瘉鐮佺敓鎴愭帴鍙o紝鎵�鏈夊叾浠栫被鍨嬮獙璇佺爜鐢熸垚鍣ㄥ彲浠ュ疄鐜�:<code>CaptchaProvider</code>锛屽垎绂诲悇绉嶅尯鍒�� + * @author 鏃跺厠鑻� + * @date 2022-11-07 + */ +@RestController +public class CaptchaController extends SystemController { + + private CaptchaProvider<CaptchaResult> imageCaptchaProvider; +// private CaptchaProvider<CaptchaResult> smsCaptchaProvider; + // 2023-04-06 鎷煎浘楠岃瘉鐮佹彁渚涜�� + private JigsawCaptchaProvider jigsawCaptchaProvider; + private BlockPuzzleCaptchaProvider blockPuzzleCaptchaProvider; + + // 绠�鍗曢獙璇佺爜绫诲瀷: char, math + private String defaultCaptchaType = "math"; + + @Autowired + public CaptchaController(CaptchaProvider<CaptchaResult> imageCaptchaProvider +// , CaptchaProvider<CaptchaResult> smsCaptchaProvider +// , CacheProvider<String> captchaCacheProvider + , JigsawCaptchaProvider jigsawCaptchaProvider, BlockPuzzleCaptchaProvider blockPuzzleCaptchaProvider){ + this.imageCaptchaProvider = imageCaptchaProvider; +// this.smsCaptchaProvider = smsCaptchaProvider; +// this.captchaCacheProvider = captchaCacheProvider; + this.jigsawCaptchaProvider = jigsawCaptchaProvider; + this.blockPuzzleCaptchaProvider = blockPuzzleCaptchaProvider; + } + + @RequestMapping("/captcha/jigsaw/mobile") + public ResponseValue generateJigsawMobileCaptcha(){ + String uuid = IdUtils.simpleUUID(); + Map<String, Object> data = new HashMap<>(4); + data.put("uuid", uuid); + String verifyKey = Constants.CAPTCHA_CODE_PREFIX + uuid; + JigsawResult captchaResult = (JigsawResult)this.blockPuzzleCaptchaProvider.generateCaptcha(null); + if(captchaResult == null || captchaResult.getX() == 0){ + return ResponseValue.error("鎷煎浘楠岃瘉鐮佺敓鎴愰敊璇�, null"); + } + // 鍐欏叆楠岃瘉鐮� x浣嶇疆 鍒扮紦瀛樹腑 + this.getCaptchaCacheProvider().putCacheData(verifyKey, String.valueOf(captchaResult.getX()), 60); + logger.debug("鍐欏叆鎷煎浘楠岃瘉浣嶇疆锛寈 = {}", captchaResult.getX()); + + data.put("y", captchaResult.getY()); + data.put("slider", captchaResult.getImageBlockBase64()); + data.put("bg", captchaResult.getImageSourceBase64()); +// data.put("captchaEnabled", true); + return ResponseValue.success(data); + } + + /** + * 楠岃瘉鎷煎浘浣嶇疆 + * @param token 浼犲叆鐨剈uid + * @param x 妯潗鏍囦綅缃� + * @return + * @date 2023-04-07 + */ + @PostMapping("/captcha/jigsaw_validate") + public ResponseValue validateJigsaw(String token, String x){ + if(StringUtils.isEmpty(token) || StringUtils.isEmpty(x)){ + return ResponseValue.error("鏈帴鏀跺埌楠岃瘉杈撳叆淇℃伅!"); + } +// String verifyKey = Constants.CAPTCHA_CODE_PREFIX + token; +// String xString = this.captchaCacheProvider.getCacheData(verifyKey); +// if(StringUtils.isEmpty(xString)){ +// throw new IllegalStateException("鎷煎浘楠岃瘉淇℃伅宸插け鏁�!"); +// } + + CaptchaResult captchaResult = new CaptchaResult(); + captchaResult.setUuid(token); + captchaResult.setCode(x); + + Map<String, String> data = new HashMap<>(4); + + boolean success = this.jigsawCaptchaProvider.validateCaptcha(captchaResult); + if(!success){ + // 楠岃瘉澶辫触 + data.put("verify", "-1"); + return ResponseValue.success(data); + } + + data.put("verify", "1"); + data.put("x", x); + data.put("uuid", token); // uuid涔熻杩斿洖鐣岄潰 + return ResponseValue.success(data); + } + + /** + * 鑾峰彇鎷煎浘楠岃瘉鐮佷俊鎭�� + * @return + * @date 2023-04-06 + */ + @RequestMapping("/captcha/jigsaw") + public ResponseValue generateJigsawCaptcha(){ +// SimpleKaptchaProvider provider = null; + boolean captchaEnabled = this.getArgumentVariable(ArgumentsConstants.KEY_SECURITY_CAPTCHA_ENABLED).getBooleanValue(); + + String uuid = IdUtils.simpleUUID(); + Map<String, Object> data = new HashMap<>(4); + data.put("uuid", uuid); + + if(captchaEnabled){ + String verifyKey = Constants.CAPTCHA_CODE_PREFIX + uuid; + JigsawResult captchaResult = (JigsawResult)this.jigsawCaptchaProvider.generateCaptcha(null); + if(captchaResult == null || captchaResult.getX() == 0){ + return ResponseValue.error("鎷煎浘楠岃瘉鐮佺敓鎴愰敊璇�, null"); + } + // 鍐欏叆楠岃瘉鐮� x浣嶇疆 鍒扮紦瀛樹腑 + this.getCaptchaCacheProvider().putCacheData(verifyKey, String.valueOf(captchaResult.getX()), 60); + logger.debug("鍐欏叆鎷煎浘楠岃瘉浣嶇疆锛寈 = {}", captchaResult.getX()); + + data.put("y", captchaResult.getY()); + data.put("slider", captchaResult.getImageBlockBase64()); + data.put("bg", captchaResult.getImageSourceBase64()); + data.put("captchaEnabled", true); + return ResponseValue.success(data); + + } else { + // 娌℃湁楠岃瘉鐮佹柟寮� + data.put("captchaEnabled", false); + return ResponseValue.success(data); + } + } + + /** + * 鐢熸垚鐭俊楠岃瘉鐮侊紝鏀惧叆缂撳瓨銆� + * @param phoneNumber + * @return + * @date 2023-01-27 + */ +// @RequestMapping("/captchaSms") + @RequestMapping("/captcha/sms") + public ResponseValue generateSmsCaptcha(String phoneNumber){ + if(StringUtils.isEmpty(phoneNumber)){ + return ResponseValue.error("璇疯緭鍏ユ墜鏈哄彿"); + } + /*String uuid = IdUtils.simpleUUID(); + Map<String, Object> data = new HashMap<>(4); + data.put("uuid", uuid); + String verifyKey = Constants.CAPTCHA_CODE_PREFIX + uuid; + CaptchaResult captchaResult = this.getSmsCaptchaProvider().generateCaptcha(phoneNumber); + if(captchaResult == null){ + return ResponseValue.error("鐭俊楠岃瘉鐮佺敓鎴愰敊璇�, null"); + } + // 鍐欏叆楠岃瘉鐮� key 鍜� code 鍒扮紦瀛樹腑 + this.getCaptchaCacheProvider().putCacheData(verifyKey, captchaResult.getCode(), 120); + if(this.logger.isDebugEnabled()){ + this.logger.debug("鐢熸垚鐭俊楠岃瘉鐮�:{}, uuid:{}", captchaResult.getCode(), uuid); + }*/ + try{ + Map<String, Object> data = this.sendSmsCodeValidation(phoneNumber); + return ResponseValue.success(data); + + } catch (Exception ex){ + return ResponseValue.error(ex.getMessage()); + } + } + + /** + * PC绔櫥褰曪紝鐢熸垚绠�鍗曠殑鍥惧儚楠岃瘉鐮� + * @return + * @date 2022-10-11 + */ +// @GetMapping("/captchaImage") + @GetMapping("/captcha/image") + public ResponseValue generateImageCaptcha(){ + +// boolean captchaEnabled = VariableConstants.CAPTCHA_ENABLED; + boolean captchaEnabled = this.getArgumentVariable(ArgumentsConstants.KEY_SECURITY_CAPTCHA_ENABLED).getBooleanValue(); + + String uuid = IdUtils.simpleUUID(); + Map<String, Object> data = new HashMap<>(4); + data.put("uuid", uuid); + + if(captchaEnabled){ + String verifyKey = Constants.CAPTCHA_CODE_PREFIX + uuid; + CaptchaResult captchaResult = this.imageCaptchaProvider.generateCaptcha(this.defaultCaptchaType); + if(captchaResult == null){ + return ResponseValue.error("楠岃瘉鐮佺敓鎴愰敊璇�, null"); + } + + // 鍐欏叆楠岃瘉鐮� key 鍜� code 鍒扮紦瀛樹腑 + this.getCaptchaCacheProvider().putCacheData(verifyKey, captchaResult.getCode(), 120); + if(this.logger.isDebugEnabled()){ + this.logger.debug("鐢熸垚鍥惧儚楠岃瘉鐮�:{}, uuid:{}", captchaResult.getCode(), uuid); + } + + // 杞崲娴佷俊鎭啓鍑� + FastByteArrayOutputStream os = new FastByteArrayOutputStream(); + try { + ImageIO.write(captchaResult.getImage(), "jpg", os); + data.put("img", new String(Base64.encode(os.toByteArray()), StringUtils.DEFAULT_CHARSET_UTF8)); +// data.put("img", CaptchaUtils.encode(os.toByteArray())); + data.put("captchaEnabled", true); + return ResponseValue.success(data); + } + catch (IOException e) { + return ResponseValue.error(e.getMessage()); + } + + } else { + // 娌℃湁楠岃瘉鐮佹柟寮� + data.put("captchaEnabled", false); + return ResponseValue.success(data); + } + } + + /** + * 鍦╯lider婊戝潡楠岃瘉锛宻ms鐭俊楠岃瘉鏃讹紝涓嶉渶瑕佸疄闄呴獙璇佺爜锛屼粎杩斿洖uuid銆� + * @return + * @date 2023-03-22 + */ + @GetMapping("/captcha/none") + public ResponseValue generateCaptchaNone(){ + String uuid = IdUtils.simpleUUID(); + Map<String, Object> data = new HashMap<>(4); + data.put("uuid", uuid); + return ResponseValue.success(data); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/controller/IndexController.java b/iplatform-base/src/main/java/com/iplatform/base/controller/IndexController.java new file mode 100644 index 0000000..626c4e2 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/controller/IndexController.java @@ -0,0 +1,14 @@ +package com.iplatform.base.controller; + +import com.iplatform.base.SystemController; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +public class IndexController extends SystemController { + + @RequestMapping("/") + public String index() { + return "娆㈣繋浣跨敤'WalkerSoft'浜戞湇鍔″钩鍙�"; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/controller/TestMenuController.java b/iplatform-base/src/main/java/com/iplatform/base/controller/TestMenuController.java new file mode 100644 index 0000000..80cdd38 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/controller/TestMenuController.java @@ -0,0 +1,57 @@ +package com.iplatform.base.controller; + +import com.iplatform.base.SystemController; +import com.iplatform.base.callback.SecurityCallback; +import com.iplatform.base.service.RoleServiceImpl; +import com.iplatform.base.util.MenuUtils; +import com.iplatform.base.util.menu.SystemMenu; +import com.iplatform.model.po.S_role; +import com.iplatform.model.po.S_user_core; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.web.ResponseValue; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +@RestController +public class TestMenuController extends SystemController { + + @Autowired + private RoleServiceImpl roleService; + + @RequestMapping("/test/menu/show") + public ResponseValue showUserMenuList(long userId){ + SecurityCallback securityCallback = this.getPlatformCallback(SecurityCallback.class); + List<SystemMenu> menuList = null; + + S_user_core user = this.getUserCacheProvider().getUser(userId); + + List<S_role> roleList = roleService.queryUserRoleList(userId); + List<String> roleIdList = new ArrayList<>(); + if(!StringUtils.isEmptyList(roleList)){ + for(S_role role : roleList){ + roleIdList.add(role.getRole_id().toString()); + } + } + menuList = securityCallback.loadUserMenu(user, roleIdList); + if (menuList != null) { + // 杩囨护鎺夋寜閽潈闄愶紝鍓嶇鍙渶瑕佽彍鍗曪紝鎸夐挳鏉冮檺鍦╬ermisstion涓帶鍒� + SystemMenu menu = null; + for (Iterator<SystemMenu> it = menuList.iterator(); it.hasNext(); ) { + menu = it.next(); + // 1.鍘绘帀鎸夐挳鑿滃崟锛屽悓鏃讹紝鍋滅敤鐨勮彍鍗曚篃瑕佸幓鎺夈��2023-05-14 + // 2.涓嶈兘灞曠ず鐨勪篃瑕佸幓鎺夛紝is_show = 0 + if (menu.getMenu_type().equals(MenuUtils.MENU_TYPE_BUTTON) + || menu.getStatus().equals(MenuUtils.MENU_STATUS_DISABLED) + || menu.getVisible().equals(MenuUtils.MENU_INVISIBLE)) { + it.remove(); + } + } + } + return ResponseValue.success(menuList); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/controller/WechatCallbackApi.java b/iplatform-base/src/main/java/com/iplatform/base/controller/WechatCallbackApi.java new file mode 100644 index 0000000..22789bc --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/controller/WechatCallbackApi.java @@ -0,0 +1,47 @@ +package com.iplatform.base.controller; + +import com.iplatform.base.WechatBaseController; +import com.iplatform.core.SimpleVariable; +import com.walker.infrastructure.arguments.Variable; +import com.walker.web.ResponseValue; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.ArrayList; +import java.util.List; + +/** + * 寰俊鍏紬鍙风瓑鍏叡鍥炶皟锛岀粺涓�鍦ㄨ繖閲岄厤缃紝鏆傛椂杩樻病鐢ㄤ笂銆� + * @author 鏃跺厠鑻� + * @date 2023-08-27 + * @date 2023-08-28 璇ュ璞′笉鍐嶄娇鐢紝 鍏紬鍙烽�氱煡鏆傚仠浣跨敤锛堝井淇℃斂绛栬皟鏁达級锛岃繖閲屼粎鐢ㄤ簬娴嬭瘯銆� + */ +@Deprecated +@RestController +@RequestMapping("/pay/notify/wechat") +public class WechatCallbackApi extends WechatBaseController { + + @RequestMapping("/message_template") + public ResponseValue messageTemplateCallback(@RequestBody String raw){ + logger.debug("寰俊鍏紬鍙烽�氱煡鍥炶皟:{}", raw); + + return ResponseValue.success(); + } + + @RequestMapping("/send") + public ResponseValue testSendMessage(){ + List<Variable> variableList = new ArrayList(8); +// variableList.add(new SimpleVariable("first", "璁㈠崟鍙戣揣鎻愰啋")); +// variableList.add(new SimpleVariable("keyword1", order.getOrderNo())); +// variableList.add(new SimpleVariable("keyword2", orderInvoice.getExpressName())); +// variableList.add(new SimpleVariable("keyword3", orderInvoice.getExpressCode())); +// variableList.add(new SimpleVariable("remark", "娆㈣繋鍐嶆鍏変复")); + variableList.add(new SimpleVariable("character_string2", "12345678")); + variableList.add(new SimpleVariable("thing13", "涓�涓墿娴佸叕鍙�")); + variableList.add(new SimpleVariable("character_string14", "99087653")); + variableList.add(new SimpleVariable("thing22", "涓�涓晢鎴峰悕绉�")); + this.pushNotificationWithTemplate("deliverGoods", variableList, 1392024848028311L); + return ResponseValue.success(); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/di/AbstractDataImportEngine.java b/iplatform-base/src/main/java/com/iplatform/base/di/AbstractDataImportEngine.java new file mode 100644 index 0000000..567c200 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/di/AbstractDataImportEngine.java @@ -0,0 +1,78 @@ +package com.iplatform.base.di; + +import com.walker.di.DataImportException; +import com.walker.di.EncryptException; +import com.walker.di.TemplateException; +import com.walker.di.TemplateGenerator; +import com.walker.infrastructure.utils.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public abstract class AbstractDataImportEngine<T> implements DataImportEngine<T>{ + + protected final transient Logger logger = LoggerFactory.getLogger(getClass()); + + private TemplateGenerator<T> templateGenerator; + + private String saveFileRootInfo = null; + + @Override + public void setTemplateGenerator(TemplateGenerator<T> templateGenerator) { + if(templateGenerator == null){ + throw new IllegalArgumentException("templateGenerator 涓嶈兘涓虹┖!"); + } + this.templateGenerator = templateGenerator; + } + + @Override + public T generateTemplate(TemplateInfo templateInfo) { + try { + return this.templateGenerator.generate(templateInfo); + } catch (TemplateException e) { + logger.error("鐢熸垚瀵煎叆妯℃澘閿欒:" + e.getMessage(), e); + return null; + } + } + + @Override + public String executeImport(JdbcExcelDataImportor dataImportor, String loginId) throws DataImportException { + // 淇濆瓨瀵煎叆鍘嗗彶璁板綍锛堝埌鏁版嵁搴擄級渚涚敤鎴峰悗鍙版煡璇㈠鍏ラ敊璇粨鏋溿�� + if(dataImportor == null){ + throw new DataImportException("鏈紶鍏ュ鍏ュ櫒瀵硅薄: JdbcExcelDataImportor", null); + } + String id = dataImportor.getId(); + if(StringUtils.isNotEmpty(id)){ + logger.debug("淇濆瓨鎴栬�呮洿鏂板鍏ュ巻鍙茶褰�,id=" + id); + try { + this.saveImportHistory(id, loginId); + } catch (Exception ex){ + throw new DataImportException("淇濆瓨瀵煎叆鍘嗗彶閿欒:" + ex.getMessage() + ", id=" + id, ex); + } + } else { + logger.info("褰撳墠瀵煎叆鏈缃甶d锛屼笉璁板綍瀵煎叆鍘嗗彶, loginId = " + loginId); + } + + try { + // 杩欓噷鍚庣画闇�瑕佽�冭檻ftp闆嗕腑绠$悊鏂囦欢鐨勬儏鍐点�� + dataImportor.setSaveFileFolder(this.saveFileRootInfo); + dataImportor.load(); + } catch (EncryptException e) { + throw new DataImportException("瀵煎叆鏁版嵁瑙e瘑閿欒:" + e.getMessage(), e); + } + + logger.info("瀵煎叆鎴愬姛鍐欏叆{}鏉¤褰�", dataImportor.getSuccessSize()); + return dataImportor.getErrorFile(); + } + + @Override + public void setSaveFileRoot(String saveFileRootInfo){ + this.saveFileRootInfo = saveFileRootInfo; + } + + /** + * 淇濆瓨瀵煎叆鍘嗗彶璁板綍锛� + * @param id + * @param userName + */ + protected abstract void saveImportHistory(String id, String userName); +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/di/DataImportEngine.java b/iplatform-base/src/main/java/com/iplatform/base/di/DataImportEngine.java new file mode 100644 index 0000000..9d7e54e --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/di/DataImportEngine.java @@ -0,0 +1,44 @@ +package com.iplatform.base.di; + +import com.walker.di.DataImportException; +import com.walker.di.TemplateGenerator; + +/** + * 鏁版嵁瀵煎叆寮曟搸瀹炵幇锛岃礋璐e鐢ㄦ埛涓婁紶鐨凟xcel鎴栬�呭叾浠栨牸寮忔暟鎹兘鏂逛究瀵煎叆绯荤粺涓�� + * <pre> + * 1)涓嶉檺浜嶦xcel锛岃繖鍙槸鍏朵腑涓�绉� + * 2)杈撳嚭涔熶笉闄愪簬鏁版嵁搴擄紝鐩墠浠呭彧鏈夋暟鎹簱瀹炵幇銆� + * </pre> + * @author 鏃跺厠鑻� + * @date 2023-02-07 + */ +public interface DataImportEngine<T> { + + void setTemplateGenerator(TemplateGenerator<T> templateGenerator); + + /** + * 鐢熸垚瀵煎叆妯℃澘锛岃妯℃澘鐢卞綋鍓嶅鐞嗚妭鐐�(涓绘満)鎵ц锛屼笉闇�瑕佽�冭檻闆嗙兢鐜銆� + * @param templateInfo + * @return + */ + T generateTemplate(TemplateInfo templateInfo); + + /** + * 鎵ц瀵煎叆鍔ㄤ綔锛岃繑鍥為敊璇粨鏋滄枃浠惰矾寰勫湴鍧�銆� + * @param dataImportor + * @param loginId + * @return + * @throws DataImportException + */ + String executeImport(JdbcExcelDataImportor dataImportor, String loginId) throws DataImportException; + + /** + * 璁剧疆寮曟搸瀛樺偍鏂囦欢鐨勬牴璺緞淇℃伅銆� + * <pre> + * 1)鏈夊彲鑳芥槸鏈湴鏂囦欢澶硅矾寰勶紝濡�: d:/demo/file/ + * 2)涔熷彲鑳芥槸FTP鐨勫湴鍧�锛屽: ftp://localhost/file/ + * </pre> + * @param saveFileRootInfo + */ + void setSaveFileRoot(String saveFileRootInfo); +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/di/FileDataImportEngine.java b/iplatform-base/src/main/java/com/iplatform/base/di/FileDataImportEngine.java new file mode 100644 index 0000000..b6aa521 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/di/FileDataImportEngine.java @@ -0,0 +1,14 @@ +package com.iplatform.base.di; + +import java.io.File; + +/** + * 杩斿洖鏂囦欢褰㈠紡瀵煎叆妯℃澘鐨�'瀵煎叆寮曟搸'瀹炵幇銆�<br> + * 鏆傛病鏈夊叾浠栧彲閲嶅啓鍦版柟娉曘�� + * @author 鏃跺厠鑻� + * @date 2023-02-07 + */ +@Deprecated +public class FileDataImportEngine extends PlatformDataImportEngine { + +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/di/JdbcExcelDataImportor.java b/iplatform-base/src/main/java/com/iplatform/base/di/JdbcExcelDataImportor.java new file mode 100644 index 0000000..7e0a65d --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/di/JdbcExcelDataImportor.java @@ -0,0 +1,183 @@ +package com.iplatform.base.di; + +import com.iplatform.base.service.DataImportServiceImpl; +import com.iplatform.base.util.DataImportUtils; +import com.iplatform.core.BeanContextAware; +import com.walker.di.BusinessImportException; +import com.walker.di.UpdateResult; +import com.walker.di.UpdateType; +import com.walker.di.excel.ExcelDataImportor; +import com.walker.infrastructure.utils.StringUtils; + +import java.util.List; +import java.util.Map; + +/** + * 鍩轰簬JDBC鎿嶄綔鐨勫鍏ュ疄鐜般�� + * @author 鏃跺厠鑻� + * @date 2023-02-01 + */ +//public abstract class JdbcCsvDataImportor extends CsvDataImportor { +public abstract class JdbcExcelDataImportor extends ExcelDataImportor { + +// private DataImportServiceImpl dataImportService; + + // 鏇存柊璇彞缂撳瓨 + private String updateSql = null; + + @Override + protected void saveImportData(List<Object[]> dataList, List<String> fieldNames) throws BusinessImportException { + if(!this.isCheckDataExist()){ + this.logger.debug("涓嶆鏌ユ暟鎹槸鍚﹀瓨鍦紝鐩存帴瀵煎叆, size = " + dataList.size()); + try{ + this.doExecuteInsert(dataList, fieldNames); + } catch (Exception ex){ + throw new BusinessImportException("淇濆瓨涓�娆″鍏ラ敊璇�:" + ex.getMessage(), ex); + } + return; + } + + String tableName = this.acquireTableName(); + logger.debug("鍑嗗妫�鏌ユ暟鎹槸鍚﹀瓨鍦�"); + + // 鎶婃暟鎹浆鎴怣ap闆嗗悎 + List<Map<String, Object>> mapList = DataImportUtils.translateToMap(dataList, fieldNames); + if(mapList == null){ + logger.error("淇濆瓨杞崲鏁版嵁涓虹┖锛屾棤娉曚繚瀛�: mapList = DataImportUtils.translateTo() == null!"); + return; + } + + UpdateResult updateResult = this.checkDataExist(tableName, mapList); + if(updateResult == null){ + throw new BusinessImportException("涓氬姟妫�鏌ュ鍏ユ槸鍚﹀瓨鍦ㄦ暟鎹�, 浣嗘湭杩斿洖浠讳綍鍐呭, 绯荤粺鏃犳硶鏇存柊,table=" + tableName, null); + } + if(!StringUtils.isEmptyList(updateResult.getInsertList())){ + this.doExecuteInsertMap(updateResult.getInsertList(), fieldNames); + if(this.logger.isDebugEnabled()){ + this.logger.debug("........ doExecuteInsert():" + updateResult.getInsertList().size()); + } + } + if(!StringUtils.isEmptyList(updateResult.getUpdateList())){ + if(StringUtils.isEmptyList(updateResult.getUpdateColumnNames()) + || StringUtils.isEmptyList(updateResult.getWhereColumnNames())){ + throw new BusinessImportException("瀵煎叆鏇存柊鏁版嵁锛屼絾鏈彂鐜颁换浣曟洿鏂板瓧娈靛悕绉板拰鏉′欢,table=" + tableName, null); + } + this.doExecuteUpdateMap(updateResult.getUpdateList() + , updateResult.getUpdateColumnNames(), updateResult.getWhereColumnNames(), tableName); + if(this.logger.isDebugEnabled()){ + this.logger.debug("........ doExecuteUpdate():" + updateResult.getUpdateList().size()); + } + } + } + + @Override + protected void saveBrokenInfo(long index) { + throw new UnsupportedOperationException("鏆傛湭瀹炵幇鏂偣缁紶鍔熻兘"); + } + + /** + * 瀹為檯鍐欏叆鎿嶄綔锛屾敞鎰�: 杩欓噷 dataList 閲岄潰Map鏄棤搴忕殑锛岄渶瑕侀厤鍚堝瓧娈靛垪浣跨敤銆� + * @param mapList + * @param fieldNames + * @date 2023-02-06 + */ + private void doExecuteInsertMap(List<Map<String, Object>> mapList, List<String> fieldNames){ + String insertSql = this.getInsertSql(fieldNames); + List<Object[]> dataList = DataImportUtils.translateToArray(mapList, fieldNames); + if(StringUtils.isEmptyList(dataList)){ + logger.debug("鏃犳硶鎵цdoExecuteInsertMap: DataImportUtils.translateToArray = null."); + return; + } + this.getDataImportService().execBatchUpdate(insertSql, dataList); + } + + /** + * 瀹為檯鏇存柊鎿嶄綔锛屾敞鎰�: 杩欓噷 dataList 閲岄潰Map鏄棤搴忕殑锛岄渶瑕侀厤鍚堝瓧娈靛垪浣跨敤銆� + * @param dataList + * @param updateColumns 瑕佹洿鏂扮殑瀛楁闆嗗悎 + * @param whereColumns 鏇存柊鏉′欢闆嗗悎 + */ + private void doExecuteUpdateMap(List<Map<String, Object>> dataList + , List<String> updateColumns, List<String> whereColumns, String tableName){ + if(this.getUpdateType() == UpdateType.Override){ + logger.debug("璁剧疆鐨勬洿鏂扮瓥鐣�: Override"); + if(StringUtils.isEmptyList(updateColumns) || StringUtils.isEmptyList(whereColumns)){ + throw new IllegalArgumentException("瀵煎叆'鏃犳硶鏇存柊鏁版嵁': updateColumns or whereColumns 涓虹┖!"); + } + + List<Object[]> parameters = DataImportUtils.acquireUpdateValues(dataList, updateColumns, whereColumns); + if(StringUtils.isEmptyList(parameters)){ +// throw new IllegalArgumentException("鏈壘鍒版洿鏂板�奸泦鍚堬紝瀵煎叆鏁版嵁鏇存柊澶辫触! parameters=null"); + logger.debug("鏈壘鍒版洿鏂板�奸泦鍚�,涓嶆洿鏂拌褰�"); + return; + } + if(this.updateSql == null){ + this.updateSql = DataImportUtils.acquireUpdateSql(tableName, updateColumns, whereColumns); + if(this.logger.isDebugEnabled()){ + this.logger.debug("鏇存柊SQL = " + this.updateSql); + } + } + + this.getDataImportService().execBatchUpdate(this.updateSql, parameters); + } + } + + /** + * 鍐欏叆鏂版暟鎹�� + * @param dataList + * @param fieldNames + * @date 2023-02-01 + * @date 2023-05-07 鏂规硶鎻愬崌涓轰繚鎶わ紝璁╁瓙绫诲彲浠ラ噸鍐欒鏂规硶銆� + */ + protected void doExecuteInsert(List<Object[]> dataList, List<String> fieldNames){ +// String tableName = this.acquireTableName(); +// if(StringUtils.isEmpty(tableName)){ +// throw new UnsupportedOperationException("蹇呴』瀹炵幇鏂规硶: acquireTableName"); +// } +// String insertSQL = DataImportUtils.acquireInsertSql(tableName, fieldNames); +// this.dataImportService.execBatchUpdate(insertSQL, dataList); + this.getDataImportService().execBatchUpdate(this.getInsertSql(fieldNames), dataList); + } + + private String getInsertSql(List<String> fieldNames){ + String tableName = this.acquireTableName(); + if(StringUtils.isEmpty(tableName)){ + throw new UnsupportedOperationException("蹇呴』瀹炵幇鏂规硶: acquireTableName"); + } + return DataImportUtils.acquireInsertSql(tableName, fieldNames); + } + +// public void setDataImportService(DataImportServiceImpl dataImportService) { +// this.dataImportService = dataImportService; +// } + + public DataImportServiceImpl getDataImportService() { +// return dataImportService; + return BeanContextAware.getBeanByType(DataImportServiceImpl.class); + } + + /** + * 杩斿洖瑕佸啓鍏ョ殑琛ㄥ悕 + * @return + */ + protected abstract String acquireTableName(); + + /** + * 鍐欏叆涔嬪墠锛屾槸鍚︽鏌ユ暟鎹凡瀛樺湪 + * @return + */ + protected abstract boolean isCheckDataExist(); + + /** + * 妫�娴嬭鎵规暟鎹湪鏁版嵁搴撲腑鏄惁瀛樺湪銆� + * <pre> + * 1)璇ユ柟娉曢渶瑕佸瓙绫诲鐞嗗叿浣撴煡璇㈣繃绋嬶紝閫氬父鍙湁涓�涓潯浠剁殑璇濆彲浠ヤ娇鐢� where id in (columns)鐨勬柟寮忋�� + * 2)濡傛灉鏉′欢澶氫釜锛屽氨闇�瑕佷笟鍔¢�氳繃澶氫釜 where in 鏂瑰紡锛屽: where name in (:names) and card in (:cards)銆� + * 3) + * </pre> + * @param mapList +// * @param fieldNames + * @return 杩斿洖涓�涓洿鏂扮粨鏋滃璞°�� + */ + protected abstract UpdateResult checkDataExist(String tableName, List<Map<String, Object>> mapList); +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/di/PlatformDataImportEngine.java b/iplatform-base/src/main/java/com/iplatform/base/di/PlatformDataImportEngine.java new file mode 100644 index 0000000..b4cd59c --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/di/PlatformDataImportEngine.java @@ -0,0 +1,22 @@ +package com.iplatform.base.di; + +import java.io.File; + +/** + * 骞冲彴鏁版嵁瀵煎叆寮曟搸瀹炵幇銆�<p></p> + * 娉涘瀷鏄鍏ユā鏉跨敓鎴愮被鍨�(宸茬‘瀹氫负 File 瀵硅薄)锛屼笌瀵煎叆娌℃湁鍟ュ叧绯伙紝涔熶笉娑夊強闆嗙兢闂銆� + * @author 鏃跺厠鑻� + * @date 2023-02-07 + */ +public class PlatformDataImportEngine extends AbstractDataImportEngine<File>{ + + @Override + protected void saveImportHistory(String id, String userName) { + logger.info("鏍规嵁id鏄惁瀛樺湪纭畾鍐欏叆鎴栨洿鏂�'瀵煎叆鍘嗗彶'"); + } + + @Override + public File generateTemplate(TemplateInfo templateInfo) { + return super.generateTemplate(templateInfo); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/di/PlatformExcelTemplateGenerator.java b/iplatform-base/src/main/java/com/iplatform/base/di/PlatformExcelTemplateGenerator.java new file mode 100644 index 0000000..95bac5b --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/di/PlatformExcelTemplateGenerator.java @@ -0,0 +1,71 @@ +package com.iplatform.base.di; + +import com.iplatform.base.LocalDatabaseMetaEngine; +import com.walker.dbmeta.FieldInfo; +import com.walker.di.excel.ExcelTemplateGenerator; +import com.walker.infrastructure.utils.StringUtils; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 骞冲彴鏀寔鐨凟xcel瀵煎叆妯℃澘鐢熸垚鍣ㄥ疄鐜般��<p></p> + * 閫氳繃鑷姩璇诲彇鍏冩暟鎹紝鎵惧嚭琛ㄤ腑瀛楁淇℃伅锛屽苟鍐欏叆妯℃澘澶翠腑锛岀洰鍓嶆ā鏉垮ご鍖呮嫭2琛�:<br> + * 1)涓枃璇存槑锛�2)瀛楁ID + * @date 2023-02-07 + */ +public class PlatformExcelTemplateGenerator extends ExcelTemplateGenerator { + + @Override + protected String acquireWriteFilePath(Object option) { + return ((TemplateInfo)option).getTemplatePath(); + } + + @Override + protected List<Map<String, String>> acquireWriteContent(Object option) { + String tableName = ((TemplateInfo)option).getTableName(); + if(StringUtils.isEmpty(tableName)){ + throw new RuntimeException("琛ㄥ悕涓嶅瓨鍦紝鏃犳硶鍒涘缓瀵煎叆妯℃澘", null); + } + + if(this.localDatabaseMetaEngine == null){ + throw new RuntimeException("localDatabaseMetaEngine 鏈厤缃�!"); + } + + List<FieldInfo> fieldList = this.localDatabaseMetaEngine.getFieldsObject(tableName); + if(StringUtils.isEmptyList(fieldList)){ + throw new RuntimeException("璇ヨ〃涓湭鏌ュ埌浠讳綍瀛楁淇℃伅"); + } + + List<Map<String, String>> resultList = new ArrayList<>(); + Map<String, String> map = null; + String comment = null; + for(FieldInfo fieldInfo : fieldList){ + comment = fieldInfo.getComments(); + if(comment == null){ + comment = StringUtils.EMPTY_STRING; + } + map = new HashMap<>(); + map.put(fieldInfo.getFieldName(), comment); + resultList.add(map); + } + logger.debug(resultList.toString()); + return resultList; + } + + @Override + protected boolean checkOption(Object option){ + if(!(option instanceof TemplateInfo)){ + return false; + } + return true; + } + + public void setLocalDatabaseMetaEngine(LocalDatabaseMetaEngine localDatabaseMetaEngine) { + this.localDatabaseMetaEngine = localDatabaseMetaEngine; + } + + private LocalDatabaseMetaEngine localDatabaseMetaEngine = null; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/di/TemplateInfo.java b/iplatform-base/src/main/java/com/iplatform/base/di/TemplateInfo.java new file mode 100644 index 0000000..366ea80 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/di/TemplateInfo.java @@ -0,0 +1,43 @@ +package com.iplatform.base.di; + +/** + * 鏁版嵁瀵煎叆妯℃澘淇℃伅瀵硅薄瀹氫箟銆� + * @author 鏃跺厠鑻� + * @date 2023-02-07 + */ +public class TemplateInfo { + + @Override + public String toString(){ + return new StringBuilder("[tableName=").append(this.tableName) + .append(", templatePath=").append(this.templatePath) + .append("]").toString(); + } + + /** + * 杩斿洖鎸囧畾鐨勪笟鍔¤〃鍚嶇О锛岄拡瀵硅〃鎵�鏈夊瓧娈佃緭鍑哄埌妯℃澘涓�� + * @return + */ + public String getTableName() { + return tableName; + } + + public void setTableName(String tableName) { + this.tableName = tableName; + } + + /** + * 杩斿洖妯℃澘鐢熸垚鍏蜂綋瀹屾暣璺緞銆� + * @return + */ + public String getTemplatePath() { + return templatePath; + } + + public void setTemplatePath(String templatePath) { + this.templatePath = templatePath; + } + + private String tableName; + private String templatePath; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/event/RoleSecurityChangeEvent.java b/iplatform-base/src/main/java/com/iplatform/base/event/RoleSecurityChangeEvent.java new file mode 100644 index 0000000..d673130 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/event/RoleSecurityChangeEvent.java @@ -0,0 +1,21 @@ +package com.iplatform.base.event; + +import org.springframework.context.ApplicationEvent; + +/** + * 绯荤粺瑙掕壊瀵瑰簲鏉冮檺鏀瑰彉浜嬩欢瀹氫箟锛岄渶瑕侀�氱煡鏉冮檺鎷︽埅妯″潡锛屾洿鏂版潈闄愭暟鎹�� + * @author shikeying + * @date 2023-05-07 绉绘鑰佷唬鐮� + */ +public class RoleSecurityChangeEvent extends ApplicationEvent { + + public RoleSecurityChangeEvent(Object source) { + super(source); + } + + /** + * + */ + private static final long serialVersionUID = 2695104485536782361L; + +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/exception/CaptchaException.java b/iplatform-base/src/main/java/com/iplatform/base/exception/CaptchaException.java new file mode 100644 index 0000000..280d1ce --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/exception/CaptchaException.java @@ -0,0 +1,20 @@ +package com.iplatform.base.exception; + +import com.walker.web.WebRuntimeException; + +/** + * 楠岃瘉鐮佽繍琛屽紓甯稿畾涔夈�� + * @author 鏃跺厠鑻� + * @date 2022-11-08 + */ +@Deprecated +public class CaptchaException extends WebRuntimeException { + + public CaptchaException(){ + super("楠岃瘉鐮佸紓甯�"); + } + + public CaptchaException(String msg){ + super(msg); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/exception/LoginException.java b/iplatform-base/src/main/java/com/iplatform/base/exception/LoginException.java new file mode 100644 index 0000000..bebd2fb --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/exception/LoginException.java @@ -0,0 +1,37 @@ +package com.iplatform.base.exception; + +import com.walker.infrastructure.ApplicationException; + +/** + * 鐧诲綍寮傚父鎻愮ず瀹氫箟銆� + * <p>鐩墠绉诲姩绔渶瑕佷娇鐢紝PC绔篃鍙噸鐢ㄨ瀵硅薄銆�</p> + * @author 鏃跺厠鑻� + * @date 2023-06-28 + */ +public class LoginException extends ApplicationException { + + /** + * 鐢ㄦ埛鎵嬫満鍙锋湭鎵惧埌銆� + * @return + */ + public boolean isUserPhoneNotExist() { + return userPhoneNotExist; + } + + private boolean userPhoneNotExist = false; + + public LoginException(String msg){ + super(msg); + } + + public LoginException(String msg, Throwable caution){ + super(msg, caution); + } + + public LoginException(String msg, Throwable caution, boolean userPhoneNotExist){ + super(msg, caution); + if(userPhoneNotExist){ + this.userPhoneNotExist = true; + } + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/pojo/CaptchaParam.java b/iplatform-base/src/main/java/com/iplatform/base/pojo/CaptchaParam.java new file mode 100644 index 0000000..966fa8c --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/pojo/CaptchaParam.java @@ -0,0 +1,88 @@ +package com.iplatform.base.pojo; + +import com.walker.web.param.ParamRequest; + +/** + * 楠岃瘉鐮佽姹傛潯浠躲�� + * @author 鏃跺厠鑻� + * @date 2023-06-27 + */ +public class CaptchaParam extends ParamRequest { + + public String getCaptchaType() { + return captchaType; + } + + public void setCaptchaType(String captchaType) { + this.captchaType = captchaType; + } + + public String getToken() { + return token; + } + + public void setToken(String token) { + this.token = token; + } + + public String getClientUid() { + return clientUid; + } + + public void setClientUid(String clientUid) { + this.clientUid = clientUid; + } + + public Long getTs() { + return ts; + } + + public void setTs(Long ts) { + this.ts = ts; + } + + /** + * 杩斿洖鎷煎浘婊戝潡鐨剎浣嶇疆銆� + * @return + * @date 2023-06-27 + */ + public String getX() { + return x; + } + + public void setX(String x) { + this.x = x; + } + + private String x; + + /** + * 楠岃瘉鐮佺被鍨�:(clickWord,blockPuzzle) + */ + private String captchaType; + + /** + * UUID(姣忔璇锋眰鐨勯獙璇佺爜鍞竴鏍囪瘑) + */ + private String token; + + /*** + * 瀹㈡埛绔疷I缁勪欢id,缁勪欢鍒濆鍖栨椂璁剧疆涓�娆★紝UUID + */ + private String clientUid; + /*** + * 瀹㈡埛绔殑璇锋眰鏃堕棿锛岄鐣欏瓧娈� + */ + private Long ts; + + @Override + public String toString() { + return "CaptchaParam{" + + "x='" + x + '\'' + + ", captchaType='" + captchaType + '\'' + + ", token='" + token + '\'' + + ", clientUid='" + clientUid + '\'' + + ", ts=" + ts + + '}'; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/pojo/ConfigParam.java b/iplatform-base/src/main/java/com/iplatform/base/pojo/ConfigParam.java new file mode 100644 index 0000000..2851f0b --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/pojo/ConfigParam.java @@ -0,0 +1,39 @@ +package com.iplatform.base.pojo; + +import com.walker.web.param.ParamRequest; + +public class ConfigParam extends ParamRequest { + + public String getConfigName() { + return configName; + } + + public void setConfigName(String configName) { + this.configName = configName; + } + + public String getConfigKey() { + return configKey; + } + + public void setConfigKey(String configKey) { + this.configKey = configKey; + } + + public String getConfigType() { + return configType; + } + + public void setConfigType(String configType) { + this.configType = configType; + } + + private String configName; + + /** 鍙傛暟閿悕 */ +// @Excel(name = "鍙傛暟閿悕") + private String configKey; + +// @Excel(name = "绯荤粺鍐呯疆", readConverterExp = "Y=鏄�,N=鍚�") + private String configType; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/pojo/DeptParam.java b/iplatform-base/src/main/java/com/iplatform/base/pojo/DeptParam.java new file mode 100644 index 0000000..812bf76 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/pojo/DeptParam.java @@ -0,0 +1,59 @@ +package com.iplatform.base.pojo; + +import com.walker.web.DataStatus; +import com.walker.web.param.ParamRequest; + +/** + * 鏈烘瀯妫�绱㈡潯浠跺畾涔夈�� + * @date 2022-12-01 + */ +public class DeptParam extends ParamRequest { + + /** + * 椤甸潰鏄剧ず鐨�: 椤剁骇鏈烘瀯閫夋嫨鍒楄〃鍊笺�� + * @return + */ + public long getOrgId() { + return orgId; + } + + public void setOrgId(long orgId) { + this.orgId = orgId; + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public int getLoadSelect() { + return loadSelect; + } + + public void setLoadSelect(int loadSelect) { + this.loadSelect = loadSelect; + } + + // 鍔犺浇涓嬫媺鏈烘瀯閫夋嫨鍚楋紵 + private int loadSelect = 0; + + // 鎸囧畾鐨勬牴鏈烘瀯 + private long orgId = 0; + + // 鏈烘瀯鍚嶇О + private String deptName; + + // 鐘舵�� + private int status = DataStatus.CONST_NORMAL; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/pojo/GroupDataParam.java b/iplatform-base/src/main/java/com/iplatform/base/pojo/GroupDataParam.java new file mode 100644 index 0000000..1f26519 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/pojo/GroupDataParam.java @@ -0,0 +1,31 @@ +package com.iplatform.base.pojo; + +/** + * 鍒嗙粍鏁版嵁鍒楄〃锛屾煡璇㈡潯浠躲�� + * @author 鏃跺厠鑻� + * @date 2023-05-20 + */ +public class GroupDataParam extends KeywordsParam{ + + public Integer getGid() { + return gid; + } + + public void setGid(Integer gid) { + this.gid = gid; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + // // @ApiModelProperty(value = "鍒嗙粍id") + private Integer gid; + +// // @ApiModelProperty(value = "鐘舵�侊紙1锛氬紑鍚紱2锛氬叧闂紱锛�") + private Integer status; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/pojo/KeywordsParam.java b/iplatform-base/src/main/java/com/iplatform/base/pojo/KeywordsParam.java new file mode 100644 index 0000000..29ecdff --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/pojo/KeywordsParam.java @@ -0,0 +1,28 @@ +package com.iplatform.base.pojo; + +import com.walker.web.param.ParamRequest; + +/** + * 閫氱敤鍏抽敭瀛楁悳绱㈡潯浠躲�� + * @author 鏃跺厠鑻� + * @date 2023-05-17 + */ +public class KeywordsParam extends ParamRequest { + + public String getKeywords() { + return keywords; + } + + public void setKeywords(String keywords) { + this.keywords = keywords; + } + + private String keywords; + + @Override + public String toString() { + return "KeywordsParam{" + + "keywords='" + keywords + '\'' + + '}'; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/pojo/MenuParam.java b/iplatform-base/src/main/java/com/iplatform/base/pojo/MenuParam.java new file mode 100644 index 0000000..a213e76 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/pojo/MenuParam.java @@ -0,0 +1,29 @@ +package com.iplatform.base.pojo; + +import com.walker.web.param.ParamRequest; + +public class MenuParam extends ParamRequest { + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getMenuType() { + return menuType; + } + + public void setMenuType(String menuType) { + this.menuType = menuType; + } + + // // @ApiModelProperty(value = "鑿滃崟鍚嶇О") + private String name; + +// // @ApiModelProperty(value = "鑿滃崟绫诲瀷:M-鐩綍锛孋-鑿滃崟锛孉-鎸夐挳") +// @StringContains(limitValues = {"M","C","A"}, message = "鏈煡鐨勮彍鍗曠被鍨�") + private String menuType; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/pojo/RequestLogin.java b/iplatform-base/src/main/java/com/iplatform/base/pojo/RequestLogin.java new file mode 100644 index 0000000..ce523f3 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/pojo/RequestLogin.java @@ -0,0 +1,184 @@ +package com.iplatform.base.pojo; + +import com.walker.web.ClientType; +import com.walker.web.LoginType; + +import java.io.Serializable; + +public class RequestLogin implements Serializable { + + /** + * 鐢ㄦ埛鍚� + */ + private String username; + + /** + * 鐢ㄦ埛瀵嗙爜 + */ + private String password; + + /** + * 楠岃瘉鐮� + */ + private String code; + + /** + * 鍞竴鏍囪瘑锛堟湇鍔$token缂撳瓨鐨勬爣璇嗭級 + */ + private String uuid; + + private String loginType = LoginType.INDEX_USER_PASSWORD; + + private String clientType = ClientType.INDEX_PC; + + /** + * 楠岃瘉鐮佹柟寮忥紙绫诲瀷锛夛細code/sms/slide/jigsaw/none + */ + private String verifyType; + + /** + * 缁堢鐧诲綍锛岃澶囧敮涓�缂栧彿锛屽锛歛pp璁惧imei绛夈�� + * @date 2023-03-20 + */ + private String clientId; + + /** + * 缁堢鐧诲綍闄勫甫鐨勫叾浠栦俊鎭紝濡傦細鎿嶄綔绯荤粺绛� + * @date 2023-03-20 + */ + private String clientInfo; + + private Long userId; + +// public long getTemp() { +// return temp; +// } +// +// /** +// * 娣诲姞鐨勬椂闂存埑 +// * @param temp +// * @date 2024-03-02 +// */ +// public void setTemp(long temp) { +// this.temp = temp; +// } +// +// private long temp = 0; + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + public String getClientInfo() { + return clientInfo; + } + + public void setClientInfo(String clientInfo) { + this.clientInfo = clientInfo; + } + + public String getClientId() { + return clientId; + } + + public void setClientId(String clientId) { + this.clientId = clientId; + } + + /** + * 杩斿洖楠岃瘉鐮佺被鍨嬶紝鍊煎弬鑰冿細{@linkplain com.walker.web.CaptchaType} 鏋氫妇銆� + * @return + */ + public String getVerifyType() { + return verifyType; + } + + public void setVerifyType(String verifyType) { + this.verifyType = verifyType; + } + + /** + * 杩斿洖缁堢绫诲瀷锛屽:pc/tv/mobile/other + * @return + * @date 2023-01-27 + */ + public String getClientType() { + return clientType; + } + + public void setClientType(String clientType) { + this.clientType = clientType; + } + + + /** + * 鐧诲綍绫诲瀷锛屽弬鑰�: {@linkplain LoginType#INDEX_USER_PASSWORD} | {@linkplain LoginType#INDEX_SMS_CODE} 绛夈�� + * @return + * @date 2023-01-26 娣诲姞灞炴�э紝鏀寔绉诲姩绔疉PP鐧诲綍 + */ + public String getLoginType() { + return loginType; + } + + public void setLoginType(String loginType) { + this.loginType = loginType; + } + + public String getUsername() + { + return username; + } + + public void setUsername(String username) + { + this.username = username; + } + + public String getPassword() + { + return password; + } + + public void setPassword(String password) + { + this.password = password; + } + + public String getCode() + { + return code; + } + + public void setCode(String code) + { + this.code = code; + } + + public String getUuid() + { + return uuid; + } + + public void setUuid(String uuid) + { + this.uuid = uuid; + } + + @Override + public String toString(){ + return new StringBuilder("[username=").append(this.username) + .append(", password=").append(this.password) + .append(", code=").append(this.code) + .append(", uuid=").append(this.uuid) + .append(", verifyType=").append(this.verifyType) + .append(", loginType=").append(this.getLoginType()) + .append(", clientId=").append(this.clientId) + .append(", clientInfo=").append(this.clientInfo) +// .append(", temp=").append(this.temp) + .append("]").toString(); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/pojo/UserInfo.java b/iplatform-base/src/main/java/com/iplatform/base/pojo/UserInfo.java new file mode 100644 index 0000000..d6f1238 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/pojo/UserInfo.java @@ -0,0 +1,112 @@ +package com.iplatform.base.pojo; + +import java.io.Serializable; +import java.util.List; + +/** + * 鐢靛晢鍓嶇浣跨敤璇ュ璞°�傚啀娴嬭瘯涓嬬湅鏄惁娌$敤锛� + * @date 2023-05-12 + */ +@Deprecated +public class UserInfo implements Serializable { + + public String getAccount() { + return account; + } + + public void setAccount(String account) { + this.account = account; + } + + public String getRealName() { + return realName; + } + + public void setRealName(String realName) { + this.realName = realName; + } + + public String getToken() { + return Token; + } + + public void setToken(String token) { + Token = token; + } + + public Boolean getIsSms() { + return isSms; + } + + public void setIsSms(Boolean sms) { + isSms = sms; + } + + public Integer getMerStarLevel() { + return merStarLevel; + } + + public void setMerStarLevel(Integer merStarLevel) { + this.merStarLevel = merStarLevel; + } + + public List<String> getPermissionsList() { + return permissionsList; + } + + public void setPermissionsList(List<String> permissionsList) { + this.permissionsList = permissionsList; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public Integer getLoginCount() { + return loginCount; + } + + public void setLoginCount(Integer loginCount) { + this.loginCount = loginCount; + } + + public String getRoles() { + return roles; + } + + public void setRoles(String roles) { + this.roles = roles; + } + + public String getRoleNames() { + return roleNames; + } + + public void setRoleNames(String roleNames) { + this.roleNames = roleNames; + } + + public String getLastIp() { + return lastIp; + } + + public void setLastIp(String lastIp) { + this.lastIp = lastIp; + } + + private Integer merStarLevel = 0; // 鍟嗘埛鏄熺骇 + private List<String> permissionsList; + private String phone; + private Integer loginCount; + private String roles; + private String roleNames; + private String lastIp; + private String account; // 鐢ㄦ埛璐﹀彿 + private String realName; // 鐢ㄦ埛鏄电О锛堝鍚嶏級 + private String Token; // token + private Boolean isSms; // 寮�鍚煭淇� +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/pojo/UserInfoRequest.java b/iplatform-base/src/main/java/com/iplatform/base/pojo/UserInfoRequest.java new file mode 100644 index 0000000..f99c702 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/pojo/UserInfoRequest.java @@ -0,0 +1,43 @@ +package com.iplatform.base.pojo; + +import com.walker.web.param.ParamRequest; + +/** + * 鍚庡彴鐢ㄦ埛璇锋眰淇敼璧勬枡锛氬鍚嶅拰瀵嗙爜銆傚悗缁鎵╁睍 + * @author 鏃跺厠鑻� + * @date 2023-08-02 + */ +public class UserInfoRequest extends ParamRequest { + + public String getRealName() { + return realName; + } + + public void setRealName(String realName) { + this.realName = realName; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + // @Length(max = 32, message = "璐﹀彿闀垮害涓嶈兘瓒呰繃32涓瓧绗�") + private String realName; + +// // @ApiModelProperty(value = "鍚庡彴绠$悊鍛樺瘑鐮�", required = true) +// @NotEmpty(message = "瀵嗙爜涓嶈兘涓虹┖") +// @Length(min = 6, max = 30 ,message = "瀵嗙爜闀垮害鍦�6-30涓瓧绗�") + private String password; + + @Override + public String toString() { + return "UserInfoRequest{" + + "realName='" + realName + '\'' + + ", password='" + password + '\'' + + '}'; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/pojo/UserParam.java b/iplatform-base/src/main/java/com/iplatform/base/pojo/UserParam.java new file mode 100644 index 0000000..244be1f --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/pojo/UserParam.java @@ -0,0 +1,48 @@ +package com.iplatform.base.pojo; + +import com.walker.web.DataStatus; +import com.walker.web.param.ParamRequest; + +public class UserParam extends ParamRequest { + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPhonenumber() { + return phonenumber; + } + + public void setPhonenumber(String phonenumber) { + this.phonenumber = phonenumber; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public long getDeptId() { + return this.deptId; + } + + public void setDeptId(long deptId) { + this.deptId = deptId; + } + + private String userName; + + private String phonenumber; + +// private int status = DataStatus.CONST_NORMAL; + private int status = -1; + + private long deptId; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/pojo/dict/DictParam.java b/iplatform-base/src/main/java/com/iplatform/base/pojo/dict/DictParam.java new file mode 100644 index 0000000..7072dd4 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/pojo/dict/DictParam.java @@ -0,0 +1,83 @@ +package com.iplatform.base.pojo.dict; + +import com.walker.web.param.ParamRequest; + +/** + * 瀛楀吀鐣岄潰鏌ヨ鏉′欢銆� + * @author 鏃跺厠鑻� + * @date 2022-11-16 + */ +@SuppressWarnings("AlibabaLowerCamelCaseVariableNaming") +public class DictParam extends ParamRequest { + + private Long dict_id; + + private String dictName; + + private String dictType; + +// private int status = DataStatus.CONST_NORMAL; + + private Integer status; + + private String remark; + + private String dictLabel; + + public Long getDict_id() { + return dict_id; + } + + public void setDict_id(Long dict_id) { + this.dict_id = dict_id; + } + + public String getDictLabel() { + return dictLabel; + } + + public void setDictLabel(String dictLabel) { + this.dictLabel = dictLabel; + } + + public String getDictName() { + return dictName; + } + + public void setDictName(String dictName) { + this.dictName = dictName; + } + + public String getDictType() { + return dictType; + } + + public void setDictType(String dictType) { + this.dictType = dictType; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + @Override + public String toString(){ + return new StringBuilder("[dictName=").append(this.dictName) + .append(", dictType=").append(this.dictType) + .append(", status=").append(this.status) + .append(", dictLabel=").append(this.dictLabel) + .append("]").toString(); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/pojo/form/FormData.java b/iplatform-base/src/main/java/com/iplatform/base/pojo/form/FormData.java new file mode 100644 index 0000000..4b23891 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/pojo/form/FormData.java @@ -0,0 +1,56 @@ +package com.iplatform.base.pojo.form; + +import java.io.Serializable; +import java.util.List; + +public class FormData implements Serializable { + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getSort() { + return sort; + } + + public void setSort(Integer sort) { + this.sort = sort; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public List<FormDataItem> getFields() { + return fields; + } + + public void setFields(List<FormDataItem> fields) { + this.fields = fields; + } + + public FormData(){} + + // // @ApiModelProperty(value = "琛ㄥ崟鍚嶇О", required = true) +// @Min(value = 0, message = "璇烽�夋嫨琛ㄥ崟") + private Integer id; + +// // @ApiModelProperty(value = "鎺掑簭", required = true) + private Integer sort; + +// // @ApiModelProperty(value = "鐘舵�侊紙1锛氬紑鍚紱0锛氬叧闂紱锛�") + private Integer status; + +// // @ApiModelProperty(value = "瀛楁鍊煎垪琛�", required = true) +// @NotEmpty(message = "fields 鑷冲皯瑕佹湁涓�缁勬暟鎹�") +// @Size(min = 1, message = "fields 鑷冲皯瑕佹湁涓�缁勬暟鎹�") + private List<FormDataItem> fields; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/pojo/form/FormDataItem.java b/iplatform-base/src/main/java/com/iplatform/base/pojo/form/FormDataItem.java new file mode 100644 index 0000000..2dfd1d8 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/pojo/form/FormDataItem.java @@ -0,0 +1,59 @@ +package com.iplatform.base.pojo.form; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.deser.std.StringDeserializer; + +import java.io.Serializable; + +/** + * 缁勫悎涓殑涓�鏉℃槑缁嗚褰曪紝璇ュ璞″湪绯荤粺涓槸鍔ㄦ�佸鐞嗙殑銆� + * <pre> + * 1) group_data琛ㄤ腑锛歷alue瀛楁鏄竴涓ā鏉挎暟鎹紝鍖呭惈浜嗕竴涓暟鎹泦鍚堬紱 + * 2) 姣忎釜鏁版嵁椤瑰寘鍚笅闈笁涓瓧娈碉紝杩欐牱瀹炵幇浜嗗姩鎬佺淮鎶ゅ垎缁勪俊鎭紱 + * </pre> + * @author 鏃跺厠鑻� + * @date 2023-05-20 + */ +public class FormDataItem implements Serializable { + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public FormDataItem(){} + + // // @ApiModelProperty(value = "瀛楁鍚嶇О", required = true) +// @NotBlank(message = "璇疯缃� SystemFormItemCheckRequest 瀵硅薄鐨� name 灞炴��") + private String name; + +// // @ApiModelProperty(value = "瀛楁鍊�", required = true) + /** + * 閰嶇疆鑷畾涔夊瓧绗︿覆锛屽弽搴忓垪瀹炵幇锛屽惁鍒欐姤閿欍�� + * @date 2023-05-21 + */ +// @JsonDeserialize(using = StringDeserializer.class) + private String value; + +// // @ApiModelProperty(value = "瀛楁鏄剧ず鏂囧瓧", required = true) + private String title; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/pojo/form/RequestForm.java b/iplatform-base/src/main/java/com/iplatform/base/pojo/form/RequestForm.java new file mode 100644 index 0000000..2ded749 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/pojo/form/RequestForm.java @@ -0,0 +1,54 @@ +package com.iplatform.base.pojo.form; + +import java.io.Serializable; + +/** + * 鎻愪氦瑕佷繚瀛樼殑琛ㄥ崟妯℃澘瀵硅薄銆� + * @author 鏃跺厠鑻� + * @date 2023-05-22 + */ +public class RequestForm implements Serializable { + + @Override + public String toString(){ + return new StringBuilder("[name=").append(this.name) + .append(", info=").append(this.info) + .append(", content=").append(this.content) + .append("]").toString(); + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getInfo() { + return info; + } + + public void setInfo(String info) { + this.info = info; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + private String name; + +// // @ApiModelProperty(value = "琛ㄥ崟绠�浠�", required = true) +// @NotBlank(message = "璇峰~鍐欒〃鍗曠畝浠�") +// @Length(max = 500, message = "琛ㄥ崟绠�浠嬮暱搴︿笉鑳借秴杩�500涓瓧绗�") + private String info; + +// // @ApiModelProperty(value = "琛ㄥ崟鍐呭", required = true) +// @NotBlank(message = "璇峰~鍐欒〃鍗曞唴瀹�") + private String content; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/pojo/group/GroupData.java b/iplatform-base/src/main/java/com/iplatform/base/pojo/group/GroupData.java new file mode 100644 index 0000000..634e91a --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/pojo/group/GroupData.java @@ -0,0 +1,30 @@ +package com.iplatform.base.pojo.group; + +import com.iplatform.base.pojo.form.FormData; + +import java.io.Serializable; + +public class GroupData implements Serializable { + + public Integer getGid() { + return gid; + } + + public void setGid(Integer gid) { + this.gid = gid; + } + + public FormData getForm() { + return form; + } + + public void setForm(FormData form) { + this.form = form; + } + + // // @ApiModelProperty(value = "瀵瑰簲鐨勬暟鎹粍id") + private Integer gid; + +// // @ApiModelProperty(value = "琛ㄥ崟鏁版嵁") + private FormData form; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/pojo/log/LoginLogParam.java b/iplatform-base/src/main/java/com/iplatform/base/pojo/log/LoginLogParam.java new file mode 100644 index 0000000..e8fad28 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/pojo/log/LoginLogParam.java @@ -0,0 +1,147 @@ +package com.iplatform.base.pojo.log; + +import com.walker.web.param.ParamRequest; + +/** + * 鐧诲綍鏃ュ織鏌ヨ鏉′欢 + * @date 2023-01-05 + */ +public class LoginLogParam extends ParamRequest { + + public String getClientType() { + return clientType; + } + + public void setClientType(String clientType) { + this.clientType = clientType; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getIpaddr() { + return ipaddr; + } + + public void setIpaddr(String ipaddr) { + this.ipaddr = ipaddr; + } + + public String getBaseUserName() { + return baseUserName; + } + + public void setBaseUserName(String baseUserName) { + this.baseUserName = baseUserName; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public Long getGroupDeptId() { + return groupDeptId; + } + + public void setGroupDeptId(Long groupDeptId) { + this.groupDeptId = groupDeptId; + } + + public Long getProvinceDeptId() { + return provinceDeptId; + } + + public void setProvinceDeptId(Long provinceDeptId) { + this.provinceDeptId = provinceDeptId; + } + + public Long getCityDeptId() { + return cityDeptId; + } + + public void setCityDeptId(Long cityDeptId) { + this.cityDeptId = cityDeptId; + } + + public Long getCountyDeptId() { + return countyDeptId; + } + + public void setCountyDeptId(Long countyDeptId) { + this.countyDeptId = countyDeptId; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public Long getSearchDeptId() { + return searchDeptId; + } + + public void setSearchDeptId(Long searchDeptId) { + this.searchDeptId = searchDeptId; + } + + public String getPsnCode() { + return psnCode; + } + + public void setPsnCode(String psnCode) { + this.psnCode = psnCode; + } + + public Long getStartTime() { + return startTime; + } + + public void setStartTime(Long startTime) { + this.startTime = startTime; + } + + public Long getEndTime() { + return endTime; + } + + public void setEndTime(Long endTime) { + this.endTime = endTime; + } + + private String ipaddr; + private String userName; + private String baseUserName; + private String status = null; + + private String phone; + + private String psnCode; + + private Long groupDeptId; + + private Long provinceDeptId; + + private Long cityDeptId; + + private Long countyDeptId; + + private Long searchDeptId; + + private Long startTime; + private Long endTime; + private String clientType; + + +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/pojo/log/OperateLogParam.java b/iplatform-base/src/main/java/com/iplatform/base/pojo/log/OperateLogParam.java new file mode 100644 index 0000000..3dac16c --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/pojo/log/OperateLogParam.java @@ -0,0 +1,154 @@ +package com.iplatform.base.pojo.log; + +import com.walker.web.param.ParamRequest; + +public class OperateLogParam extends ParamRequest { + + public String getTitile() { + return titile; + } + + public void setTitile(String titile) { + this.titile = titile; + } + + public String getOperName() { + return operName; + } + + public void setOperName(String operName) { + this.operName = operName; + } + + public Integer getBusinessType() { + return businessType; + } + + public void setBusinessType(Integer businessType) { + this.businessType = businessType; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getBaseUserName() { + return baseUserName; + } + + public void setBaseUserName(String baseUserName) { + this.baseUserName = baseUserName; + } + + public String getBaseUserCode() { + return baseUserCode; + } + + public void setBaseUserCode(String baseUserCode) { + this.baseUserCode = baseUserCode; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public Long getGroupDeptId() { + return groupDeptId; + } + + public void setGroupDeptId(Long groupDeptId) { + this.groupDeptId = groupDeptId; + } + + public Long getProvinceDeptId() { + return provinceDeptId; + } + + public void setProvinceDeptId(Long provinceDeptId) { + this.provinceDeptId = provinceDeptId; + } + + public Long getCityDeptId() { + return cityDeptId; + } + + public void setCityDeptId(Long cityDeptId) { + this.cityDeptId = cityDeptId; + } + + public Long getCountyDeptId() { + return countyDeptId; + } + + public void setCountyDeptId(Long countyDeptId) { + this.countyDeptId = countyDeptId; + } + + public Long getSearchDeptId() { + return searchDeptId; + } + + public void setSearchDeptId(Long searchDeptId) { + this.searchDeptId = searchDeptId; + } + + public Long getStartTime() { + return startTime; + } + + public void setStartTime(Long startTime) { + this.startTime = startTime; + } + + public Long getEndTime() { + return endTime; + } + + public void setEndTime(Long endTime) { + this.endTime = endTime; + } + + public String getPsnCode() { + return psnCode; + } + + public void setPsnCode(String psnCode) { + this.psnCode = psnCode; + } + + private String titile; + private String operName; + private Integer businessType; + + private Integer status; + + private String title; + private String baseUserName; + private String baseUserCode; + private String psnCode; + private String phone; + private Long groupDeptId; + private Long provinceDeptId; + private Long cityDeptId; + private Long countyDeptId; + private Long searchDeptId; + private Long startTime; + private Long endTime; + +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/pojo/notify/InfoParam.java b/iplatform-base/src/main/java/com/iplatform/base/pojo/notify/InfoParam.java new file mode 100644 index 0000000..c25be31 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/pojo/notify/InfoParam.java @@ -0,0 +1,35 @@ +package com.iplatform.base.pojo.notify; + +import com.walker.web.param.ParamRequest; + +/** + * 鏌ョ湅鎻愰啋閫氱煡閰嶇疆妯℃澘璇︽儏锛岄渶瑕佸弬鏁般�� + * @date 2023-08-25 + */ +public class InfoParam extends ParamRequest { + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getDetailType() { + return detailType; + } + + public void setDetailType(String detailType) { + this.detailType = detailType; + } + + // // @ApiModelProperty(value = "閫氱煡id") +// @NotNull(message = "閫氱煡id涓嶈兘涓虹┖") + private Long id; + +// // @ApiModelProperty(value = "wechat-鍏紬鍙锋ā鏉挎秷鎭紝routine-灏忕▼搴忚闃呮秷鎭紝sms-鐭俊") +// @NotEmpty(message = "璇︽儏绫诲瀷涓嶈兘涓虹┖") +// @StringContains(limitValues = {"wechat","routine","sms"}, message = "鏈煡鐨勮鎯呯被鍨�") + private String detailType; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/pojo/notify/NotificationParam.java b/iplatform-base/src/main/java/com/iplatform/base/pojo/notify/NotificationParam.java new file mode 100644 index 0000000..9ea8f93 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/pojo/notify/NotificationParam.java @@ -0,0 +1,18 @@ +package com.iplatform.base.pojo.notify; + +import com.walker.web.param.ParamRequest; + +public class NotificationParam extends ParamRequest { + + public Integer getSendType() { + return sendType; + } + + public void setSendType(Integer sendType) { + this.sendType = sendType; + } + + // // @ApiModelProperty(value = "鍙戦�佺被鍨嬶紙1锛氶�氱煡浼氬憳锛�2锛氶�氱煡骞冲彴锛�") +// @Range(min = 1, max = 2, message = "鏈煡鐨勫彂閫佺被鍨�") + private Integer sendType; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/pojo/role/RoleAuthParam.java b/iplatform-base/src/main/java/com/iplatform/base/pojo/role/RoleAuthParam.java new file mode 100644 index 0000000..58d072f --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/pojo/role/RoleAuthParam.java @@ -0,0 +1,31 @@ +package com.iplatform.base.pojo.role; + +import com.walker.web.param.ParamRequest; + +/** + * 瑙掕壊鎺堟潈鐢ㄦ埛鐣岄潰鏌ヨ鏉′欢銆� + * @date 2022-12-21 + */ +public class RoleAuthParam extends ParamRequest { + + public Long getRoleId() { + return roleId; + } + + public void setRoleId(Long roleId) { + this.roleId = roleId; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + private String userName; // 妫�绱㈢殑鐢ㄦ埛鐧诲綍ID + + private Long roleId; + +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/pojo/role/RoleParam.java b/iplatform-base/src/main/java/com/iplatform/base/pojo/role/RoleParam.java new file mode 100644 index 0000000..e14f543 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/pojo/role/RoleParam.java @@ -0,0 +1,42 @@ +package com.iplatform.base.pojo.role; + +import com.walker.web.param.ParamRequest; + +/** + * 瑙掕壊鍒楄〃鏌ヨ鏉′欢銆� + * @date 2022-12-15 + */ +public class RoleParam extends ParamRequest { + + public long getOrgId() { + return orgId; + } + + public void setOrgId(long orgId) { + this.orgId = orgId; + } + + public int getStatus() { + return status; + } + + public void setStatus(int status) { + this.status = status; + } + + public String getRoleName() { + return roleName; + } + + public void setRoleName(String roleName) { + this.roleName = roleName; + } + + // 鎸囧畾鐨勬牴鏈烘瀯 + private long orgId = 0; + + private int status = -1; + + private String roleName; + +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/pojo/role/RoleUserParam.java b/iplatform-base/src/main/java/com/iplatform/base/pojo/role/RoleUserParam.java new file mode 100644 index 0000000..968e64f --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/pojo/role/RoleUserParam.java @@ -0,0 +1,25 @@ +package com.iplatform.base.pojo.role; + +import com.walker.web.param.ParamRequest; + +public class RoleUserParam extends ParamRequest { + + public Long getRoleId() { + return roleId; + } + + public void setRoleId(Long roleId) { + this.roleId = roleId; + } + + public Long getUserId() { + return userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + } + + private Long roleId; + private Long userId; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/push/DefaultPushListener.java b/iplatform-base/src/main/java/com/iplatform/base/push/DefaultPushListener.java new file mode 100644 index 0000000..4d01c10 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/push/DefaultPushListener.java @@ -0,0 +1,184 @@ +package com.iplatform.base.push; + +import com.iplatform.base.Constants; +import com.iplatform.base.PushCacheProvider; +import com.iplatform.base.service.PushServiceImpl; +import com.iplatform.model.po.S_message; +import com.walker.infrastructure.utils.NumberGenerator; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.push.Notification; +import com.walker.push.NotificationChannel; +import com.walker.push.PushStatusListener; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.List; + +/** + * 鎺ㄩ�佺洃鍚櫒瀹炵幇锛岃瀹炵幇浠呴拡瀵�'寮傛'绫诲瀷鐨勬帹閫佽�呫��<br> + * 寮傛鎺ㄩ�佽�呭涓嬶細 + * <pre> + * 1.鐭俊鎺ㄩ�� + * 2. + * </pre> + * @author 鏃跺厠鑻� + * @date 2023-04-24 + * @date 2023-04-27 鏇存柊閫昏緫锛屾暣涓帹閫佷繚瀛橀兘濮旀墭缁欒鐩戝惉鍣ㄥ疄鐜般�� + */ +public class DefaultPushListener implements PushStatusListener { + + protected final transient Logger logger = LoggerFactory.getLogger(getClass()); + + private static final String CACHE_VALUE = StringUtils.SYMBOL_SEMICOLON; + + @Override + public void onSuccess(Notification notification, Object option, NotificationChannel channel) { +// logger.info("鎴愬姛鎺ㄩ��'寮傛':{}, data = ", channel, notification); +// logger.info("option = " + option); + + if(notification.getPersistent()){ + logger.info("涓氬姟淇濆瓨'鎴愬姛閫氱煡'锛歝hannel = {}, data={}", channel, notification); + // 闇�瑕佽�冭檻澶氶�氶亾鎯呭喌锛屽搴旂殑鏄悓涓�涓�'notificationId' + // 濡傛灉缂撳瓨涓凡瀛樺湪锛屽垯涓嶅啀閲嶅淇濆瓨! + + // 鏄惁涓氬姟鎬ч�氱煡锛屽浜庯細閭欢銆佺煭淇$被锛屾垜浠笉璁や负鏄笟鍔¢�氱煡 + if(!this.isBusinessNotification(notification)){ + this.invokeDatabase(notification, true, channel); + return; + } + + // 濡傛灉鏄潪骞惰閫氱煡锛屽彧瑕佷竴涓畬鎴愬氨OK鐨勶紝鐩存帴淇濆瓨锛堝洜涓哄悗缁笉浼氬嚭鐜板悓涓�涓�氱煡锛� + if(!notification.getParallel()){ + this.invokeDatabase(notification, true, channel); + return; + } + + String cacheKey = this.getKey(notification.getReceiverList(), notification.getOptionType(), notification.getOptionId()); + + // 瀵逛簬骞惰閫氱煡锛屼笉鐭ラ亾鍚庨潰鏄惁杩樹細鏈夛細鍏朵粬閫氶亾锛堢浉鍚屾秷鎭級锛屾墍浠ヨ鍔犲叆缂撳瓨閬垮厤閲嶅淇濆瓨 + if(this.isInCache(cacheKey)){ + logger.debug("缂撳瓨涓凡瀛樺湪锛岃鏄庨�氱煡宸茬粡淇濆瓨杩囷紝bizId={}", notification.getOptionId()); + return; + } + + // 淇濆瓨鏁版嵁搴� + this.invokeDatabase(notification, true, channel); + // 鍔犲叆缂撳瓨 + this.putToCache(cacheKey); + } + } + + @Override + public void onException(Notification notification, String error, NotificationChannel channel) { +// logger.info("澶辫触鎺ㄩ��'寮傛':{}, data = ", channel, notification); +// logger.info("error = " + error); + + if(notification.getPersistent()){ + logger.info("涓氬姟淇濆瓨'澶辫触閫氱煡'锛歝hannel = {}, data = {}", channel, notification); + + // 鏄惁涓氬姟鎬ч�氱煡锛屽浜庯細閭欢銆佺煭淇$被锛屾垜浠笉璁や负鏄笟鍔¢�氱煡 + if(!this.isBusinessNotification(notification)){ + this.invokeDatabase(notification, false, channel); + return; + } + + // 濡傛灉鏄潪骞惰閫氱煡锛屽彧瑕佷竴涓畬鎴愬氨OK鐨勶紝鐩存帴淇濆瓨锛堝洜涓哄悗缁笉浼氬嚭鐜板悓涓�涓�氱煡锛� + if(!notification.getParallel()){ + this.invokeDatabase(notification, false, channel); + return; + } + + String cacheKey = this.getKey(notification.getReceiverList(), notification.getOptionType(), notification.getOptionId()); + + // 瀵逛簬骞惰閫氱煡锛屼笉鐭ラ亾鍚庨潰鏄惁杩樹細鏈夛細鍏朵粬閫氶亾锛堢浉鍚屾秷鎭級锛屾墍浠ヨ鍔犲叆缂撳瓨閬垮厤閲嶅淇濆瓨 + if(this.isInCache(cacheKey)){ + logger.debug("缂撳瓨涓凡瀛樺湪锛岃鏄庨�氱煡宸茬粡淇濆瓨杩囷紝bizId={}", notification.getOptionId()); + return; + } + + // 淇濆瓨鏁版嵁搴� + this.invokeDatabase(notification, false, channel); + // 鍔犲叆缂撳瓨 + this.putToCache(cacheKey); + } + } + + private void invokeDatabase(Notification notification, boolean success, NotificationChannel channel){ + List<S_message> data = new ArrayList<>(4); + for(String userId : notification.getReceiverList()){ + S_message message = new S_message(); + // 鍥犱负ID鍑虹幇閲嶅锛屾殏鏃跺湪淇濆瓨鏄敓鎴怚D锛屾帓鏌ヤ负浣曢噸澶嶃��2023-06-29 +// message.setId(notification.getId()); + message.setId(String.valueOf(NumberGenerator.getLongSequenceNumber())); + message.setCreate_time(notification.getCreateTime()); + message.setCreator(notification.getCreator()); + message.setBroad_cast(notification.getBroadcast()? 1 : 0); + message.setTitle(notification.getTitle()); + message.setContent(notification.getContent()); + message.setChannel_index(channel.getIndex()); + message.setDelayed_time(notification.getDelayedTime()); + message.setFailed(success? 0 : 1); + message.setMsg_from(notification.getFrom()); + message.setTime_type(notification.getTimeType().getIndex()); + message.setOption_id(notification.getOptionId()); + message.setRead_done(0); + message.setReceiver(userId); +// message.setSummary(notification.get); + if(StringUtils.isEmpty(notification.getOptionType())){ + message.setOption_type(Constants.PUSH_OPTION_TYPE_DEFAULT); + } else { + message.setOption_type(notification.getOptionType()); + } + data.add(message); + } + this.pushService.insertBatch(data); + } + + private void putToCache(String key){ + this.pushCacheProvider.put(key, CACHE_VALUE); + } + + private boolean isInCache(String key){ + String value = this.pushCacheProvider.get(key); + return value != null; + } + + /** + * 杩斿洖瀛樺偍涓存椂缂撳瓨鐨勶細Key + * @param userIds + * @param optionType + * @param optionId + * @return + */ + private String getKey(List<String> userIds, String optionType, String optionId){ + StringBuilder sb = new StringBuilder(optionType).append(optionId); + for(String userId : userIds){ + sb.append(userId); + } + return Constants.PUSH_CACHE_PREFIX + sb.toString().hashCode(); + } + + /** + * 鏄惁涓氬姟閫氱煡 + * @param notification + * @return + */ + private boolean isBusinessNotification(Notification notification){ + if(StringUtils.isNotEmpty(notification.getOptionId()) && StringUtils.isNotEmpty(notification.getOptionType())){ + return true; + } + return false; + } + + public void setPushCacheProvider(PushCacheProvider pushCacheProvider) { + this.pushCacheProvider = pushCacheProvider; + } + + public void setPushService(PushServiceImpl pushService) { + this.pushService = pushService; + } + + private PushCacheProvider pushCacheProvider = null; + private PushServiceImpl pushService = null; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/push/DefaultPushManager.java b/iplatform-base/src/main/java/com/iplatform/base/push/DefaultPushManager.java new file mode 100644 index 0000000..abd399d --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/push/DefaultPushManager.java @@ -0,0 +1,90 @@ +package com.iplatform.base.push; + +import com.iplatform.base.util.NotificationUtils; +import com.walker.push.Notification; +import com.walker.push.NotificationChannel; +import com.walker.push.PushResult; +import com.walker.push.support.AsyncPushManager; + +import java.util.List; + +/** + * 骞冲彴榛樿鐨勬帹閫佺鐞嗗櫒瀹炵幇銆� + * @author 鏃跺厠鑻� + * @date 2023-04-21 + */ +public class DefaultPushManager extends AsyncPushManager { + + @Override + protected void persistent(Notification notification, List<String> successReceiverList, NotificationChannel channel) { +// if(notification.getPersistent()){ +// logger.info("涓氬姟淇濆瓨'鎴愬姛閫氱煡'锛歝hannel = {}, data={}", channel, notification); +// // 闇�瑕佽�冭檻澶氶�氶亾鎯呭喌锛屽搴旂殑鏄悓涓�涓�'notificationId' +// // 濡傛灉缂撳瓨涓凡瀛樺湪锛屽垯涓嶅啀閲嶅淇濆瓨! +// } + // 濮旀墭缁欏紓姝ョ洃鍚櫒澶勭悊锛岃繖涓�浠g爜鍙鐢� + this.getAsyncListener().onSuccess(notification, successReceiverList, channel); + } + + @Override + protected void persistentFailed(Notification notification, List<String> failedList, NotificationChannel channel) { +// if(notification.getPersistent()){ +// logger.info("涓氬姟淇濆瓨'澶辫触閫氱煡'锛歝hannel = {}, data = {}", channel, notification); +// } + this.getAsyncListener().onException(notification, null, channel); + } + + @Override + public PushResult pushSms(Notification notification) { + if(this.smsId == null){ + throw new IllegalStateException("鐭俊鎺ㄩ�佽�匢D涓虹┖!"); + } + return this.push(notification, this.smsId); + } + + /** + * 鍙戦�佺煭淇¢獙璇佺爜鎺ㄩ�併�� + * @param code 楠岃瘉鐮� + * @param mobile 鎵嬫満鍙凤紙鎴栫敤鎴稩D锛夐兘鍙互 + * @param creator 鍒涘缓浜篒D + * @return + * @date 2023-04-25 + */ + public PushResult pushSmsValidateCode(String code, String mobile, String creator){ + Notification notification = NotificationUtils.acquireSmsValidateCode(this.smsTemplateCode, code, mobile, creator); + return this.push(notification, this.smsId); + } + + /** + * 璁剧疆鐭俊鎺ㄩ�佽�匢D锛屽洜涓哄彲鑳藉瓨鍦ㄥ涓� + * @param smsId + */ + public void setSmsId(String smsId) { + this.smsId = smsId; + } + + /** + * 璁剧疆鐭俊楠岃瘉鐮佹ā鏉縄D + * @param smsTemplateCode + */ + public void setSmsTemplateCode(String smsTemplateCode) { + this.smsTemplateCode = smsTemplateCode; + } + + /** + * 鑾峰緱閭欢鍙戦�佸湴鍧�閰嶇疆淇℃伅銆備复鏃惰繖鏍峰鐞嗐�� + * @return + * @date 2023-04-26 + */ + public String getMailFrom() { + return mailFrom; + } + + public void setMailFrom(String mailFrom) { + this.mailFrom = mailFrom; + } + + private String mailFrom; + private String smsTemplateCode; + private String smsId = null; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/push/MockSmsPush.java b/iplatform-base/src/main/java/com/iplatform/base/push/MockSmsPush.java new file mode 100644 index 0000000..b4e64d5 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/push/MockSmsPush.java @@ -0,0 +1,48 @@ +package com.iplatform.base.push; + +import com.iplatform.base.Constants; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.push.Notification; +import com.walker.push.PushException; +import com.walker.push.PushResult; +import com.walker.push.SmsMessage; +import com.walker.push.support.AbstractSmsPush; +import com.walker.push.util.PushUtils; + +import java.util.List; + +/** + * 妯℃嫙鐭俊鍙戦�佺殑鎺ㄩ�佸疄鐜般�� + * @author 鏃跺厠鑻� + * @date 2023-04-25 + */ +public class MockSmsPush extends AbstractSmsPush { + + public MockSmsPush(){ + this.setId(Constants.PUSH_SMS_ID_MOCK); + this.setName("妯℃嫙鐭俊鎺ㄩ��"); + } + + @Override + protected String getUserMobile(String userId) { + return "13900001111"; + } + + @Override + protected PushResult doPushContent(Notification notification, List<SmsMessage> data) throws PushException { + PushResult pushResult = PushUtils.acquireSuccessPushResult(); + + // 瀵逛簬鐭俊鏉ヨ锛岄�氬父涓�涓彁閱掑彧浼氶�氱煡涓�浜猴紝涓嶄細缇ゅ彂鍚屼竴涓俊鎭粰澶氫汉銆� + // 鍥犱负涓�涓細SmsMessage 涓氨鑳芥斁澶氫釜鎵嬫満鍙凤紝鎵�浠ュ叾瀹炲彧鏈変竴涓璞°�� + SmsMessage smsMessage = data.get(0); + + String phoneNumbers = StringUtils.collectionToDelimitedString(smsMessage.getMobileList(), StringUtils.DEFAULT_SPLIT_SEPARATOR); + logger.debug("妯℃嫙鍙戦�佺煭淇� --> {}锛屽唴瀹�={}", phoneNumbers, notification.getContent()); + return pushResult; + } + + @Override + public void startup() { + + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/push/SystemPush.java b/iplatform-base/src/main/java/com/iplatform/base/push/SystemPush.java new file mode 100644 index 0000000..2de13fb --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/push/SystemPush.java @@ -0,0 +1,45 @@ +package com.iplatform.base.push; + +import com.iplatform.base.PushData; +import com.walker.push.AbstractPushObject; +import com.walker.push.Notification; +import com.walker.push.NotificationChannel; +import com.walker.push.PushException; +import com.walker.push.PushResult; +import com.walker.push.util.PushUtils; + +import java.util.List; + +/** + * 骞冲彴榛樿鐨勭郴缁熸秷鎭帹閫侊紝榛樿骞朵笉鎺ㄩ�侊紝浠呬粎璁板綍鏁版嵁锛岀敱鍓嶇涓诲姩鎷夊彇娑堟伅璁板綍銆� + * @author 鏃跺厠鑻� + * @date 2023-04-25 + */ +public class SystemPush extends AbstractPushObject<PushData> { + + public SystemPush(){ + this.setId(NotificationChannel.System.getIndex()); + this.setName(NotificationChannel.System.getName()); + } + + @Override + protected PushResult doPushContent(Notification notification, List<PushData> data) throws PushException { + // 鐢变簬涓嶆帹閫侊紝鎵�浠ョ洿鎺ヨ繑鍥炴垚鍔燂紝璁╂帹閫佺鐞嗗櫒淇濆瓨鏁版嵁鍗冲彲銆� + return PushUtils.acquireSuccessPushResult(); + } + + @Override + public NotificationChannel getNotificationChannel() { + return NotificationChannel.System; + } + + @Override + public List<PushData> translateToTarget(Notification notification) { + return null; + } + + @Override + public void startup() { + + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/service/ApiTimeServiceImpl.java b/iplatform-base/src/main/java/com/iplatform/base/service/ApiTimeServiceImpl.java new file mode 100644 index 0000000..da62299 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/service/ApiTimeServiceImpl.java @@ -0,0 +1,96 @@ +package com.iplatform.base.service; + +import com.iplatform.model.vo.ApiTime; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.jdbc.service.BaseServiceImpl; +import org.springframework.jdbc.core.RowMapper; +import org.springframework.stereotype.Service; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.List; + +@Service +public class ApiTimeServiceImpl extends BaseServiceImpl { + + private final ApiTimeMapper apiTimeMapper = new ApiTimeMapper(); + + /** + * 妫�绱㈡帴鍙h皟鐢ㄦ椂闂村垪琛� + * @param currentDate 褰撳墠鏃ユ湡濡傦細20240229锛堝彲閫夛級 + * @param maxSize 闄愬埗杩斿洖璁板綍鏈�澶ф潯鏁� + * @param millis 鏉′欢锛氭渶灏忚姳璐规椂闂达紝姣锛岃秴杩囪鏃堕棿鐨勮褰� + * @return + */ + public List<ApiTime> queryCostList(Integer currentDate, Integer maxSize, Long millis){ + StringBuilder sql = new StringBuilder(SQL_QUERY); + List<Object> plist = new ArrayList<>(8); + if(currentDate != null){ + sql.append(" and request_date = ?"); + plist.add(currentDate); + } + if(millis != null){ + sql.append(" and cost_time >= ?"); + plist.add(millis); + } + if(maxSize != null){ + sql.append(" limit ?"); + plist.add(maxSize); + } + + Object[] parameters = plist.toArray(); + return this.select(sql.toString(), parameters, apiTimeMapper); + } + + public void execBatchInsertAptTime(List<ApiTime> data){ + if(StringUtils.isEmptyList(data)){ + return; + } + List<Object[]> parameters = new ArrayList<>(); + Object[] one = null; + for(ApiTime apiTime : data){ + one = this.transferToArray(apiTime); + parameters.add(one); + } + this.execBatchUpdate(SQL_INSERT, parameters); + } + + /** + * 鍐欏叆涓�鏉℃帴鍙h皟鐢ㄦ椂闂磋褰� + * @param apiTime + * @date 2024-02-29 + */ + public void execInsertApiTime(ApiTime apiTime){ + Object[] one = this.transferToArray(apiTime); + this.update(SQL_INSERT, one); + } + + private Object[] transferToArray(ApiTime apiTime){ + Object[] one = new Object[6]; + one[0] = apiTime.getId(); + one[1] = apiTime.getCreateTime(); + one[2] = apiTime.getRequestDate(); + one[3] = apiTime.getUri(); + one[4] = apiTime.getCostTime(); + one[5] = apiTime.getUser(); + return one; + } + + private class ApiTimeMapper implements RowMapper<ApiTime>{ + @Override + public ApiTime mapRow(ResultSet rs, int rowNum) throws SQLException { + ApiTime e = new ApiTime(); + e.setId(rs.getLong("id")); + e.setCreateTime(rs.getLong("create_time")); + e.setRequestDate(rs.getInt("request_date")); + e.setUri(rs.getString("uri")); + e.setCostTime(rs.getLong("cost_time")); + e.setUser(StringUtils.EMPTY_STRING); + return e; + } + } + + private static final String SQL_QUERY = "select * from s_api_time where 1=1 "; + private static final String SQL_INSERT = "insert into s_api_time(id,create_time,request_date,uri,cost_time,user_name) values(?,?,?,?,?,?)"; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/service/CategoryServiceImpl.java b/iplatform-base/src/main/java/com/iplatform/base/service/CategoryServiceImpl.java new file mode 100644 index 0000000..00aded7 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/service/CategoryServiceImpl.java @@ -0,0 +1,212 @@ +package com.iplatform.base.service; + +import com.iplatform.base.util.CategoryUtils; +import com.iplatform.base.util.TextUtils; +import com.iplatform.model.po.S_category; +import com.iplatform.model.vo.CategoryTreeVo; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.jdbc.service.BaseServiceImpl; +import org.springframework.stereotype.Service; + +import java.io.UnsupportedEncodingException; +import java.net.URLDecoder; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 绯荤粺璁剧疆鍒嗙被鐩綍锛岀數鍟嗙郴缁熼噸鏋勪娇鐢ㄣ�� + * <p>1.鍚庣画瑕佸姞涓婄紦瀛橈紒</p> + * @author 鏃跺厠鑻� + * @date 2023-05-15 + */ +@Service +public class CategoryServiceImpl extends BaseServiceImpl { + + private static final String SQL_MAX_ID = "select max(id) from s_category"; + + /** + * 鏇存柊鍒嗙被淇℃伅锛屽悓鏃朵細鏇存柊鐖剁骇銆佷笅绾х浉鍏冲惎鐢ㄧ姸鎬併�� + * <pre> + * 1)濡傜姸鎬佷负鍏抽棴锛岄偅涔堟墍浠ュ瓙闆嗙殑鐘舵�侀兘鍏抽棴 + * 2)濡傛槸寮�鍚紝鍒欑埗绫荤殑鐘舵�佷负寮�鍚� + * </pre> + * @param category + */ + public void execUpdateCategory(S_category category){ + this.save(category); + if(category.getStatus().intValue() == 0){ + //濡傜姸鎬佷负鍏抽棴锛岄偅涔堟墍浠ュ瓙闆嗙殑鐘舵�侀兘鍏抽棴 + this.execute("update s_category set status=0 where path like ?", new Object[]{"/" + category.getId() + "/"}); + } else { + //濡傛槸寮�鍚紝鍒欑埗绫荤殑鐘舵�佷负寮�鍚� + this.updatePidStatusById(category.getId()); + } + } + + /** + * 寮�鍚埗绾х姸鎬� + * + * @param id Integer + * @return Boolean + */ + private Boolean updatePidStatusById(Integer id) { + S_category category = this.get(new S_category(id)); + if(category == null){ + return true; + } + List<Integer> categoryIdList = TextUtils.stringToArrayByRegex(category.getPath(), StringUtils.FOLDER_SEPARATOR); + categoryIdList.removeIf(i -> i.equals(0)); + if (StringUtils.isEmptyList(categoryIdList)) { + return false; + } + Map<String, Object> param = new HashMap<>(2); + param.put("ids", categoryIdList); + this.execute("update s_category set status=1 where id in (:ids)", param); + return true; + } + + /** + * 鏌ヨ缁欏畾鐖禝D锛屽寘鍚瓙绫绘暟閲� + * @param pid + * @return + * @date 2023-05-17 + */ + public int queryChildCategorySize(int pid){ + return this.queryForInt("select count(id) from s_category where pid=?", new Object[]{pid}); + } + + /** + * 鑾峰緱涓嬩竴涓彲鐢ㄧ殑鏈�澶D銆� + * @return + * @date 2023-05-17 + */ + public int queryNextId(){ + int maxId = this.queryForInt(SQL_MAX_ID, new Object[]{}); + return maxId+1; + } + + /** + * 鏌ユ壘鏄惁鏈夌浉鍚岀殑绫诲瀷璁板綍 + * @param name 鍒嗙被鍚嶇О + * @param type 绫诲埆 + * @param owner 褰掑睘 + * @param id 宸叉湁ID + * @return + * @date 2023-05-17 + */ + public int queryNameUnique(String name, Integer type, Integer owner, int id){ + Map<String, Object> param = new HashMap<>(4); + StringBuilder sql = new StringBuilder("select count(id) from s_category where owner=:owner and name=:name"); + param.put("owner", owner); + param.put("name", name); + + if(type != null){ + sql.append(" and type=:type"); + param.put("type", type); + } + if(id > 0){ + sql.append(" and id<>:id"); + param.put("id", id); + } + return this.queryForInt(sql.toString(), param); + } + + /** + * 浣跨敤缂撳瓨瀵硅薄鏇挎崲鏁版嵁搴撴煡璇€�� + * @param type + * @param status + * @param name + * @param owner + * @return + * @date 2023-05-17 + */ + @Deprecated + public List<CategoryTreeVo> getListTree(Integer type, Integer status, String name, int owner) { +// name = URLUtil.decode(name); + if(StringUtils.isNotEmpty(name)){ + try { + name = URLDecoder.decode(name, StringUtils.DEFAULT_CHARSET_UTF8); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + } + return getTree(type, status, name, null, owner); + } + + /** + * 甯︾粨鏋勭殑鏃犻檺绾у垎绫�. + * @author 鏃跺厠鑻� + * @date 2023-05-15 + */ + @Deprecated + private List<CategoryTreeVo> getTree(Integer type, Integer status, String name, List<Integer> categoryIdList, int owner) { + //寰幆鏁版嵁锛屾妸鏁版嵁瀵硅薄鍙樻垚甯ist缁撴瀯鐨剉o + List<CategoryTreeVo> treeList = new ArrayList<>(); + + Map<String, Object> parameters = new HashMap<>(); + StringBuilder sql = new StringBuilder(SQL_GET_TREE); + + parameters.put("owner", owner); + + if(!StringUtils.isEmptyList(categoryIdList)){ + sql.append(" and id in (:ids)"); + parameters.put("ids", categoryIdList); + } + if(type != null){ + sql.append(" and type = :type"); + parameters.put("type", type); + } + if(status != null && status.intValue() >= 0){ + sql.append(" and status = :status"); + parameters.put("status", status); + } + sql.append(" order by sort desc, id asc"); + + List<S_category> allTree = this.select(sql.toString(), parameters, new S_category()); + if(StringUtils.isEmptyList(allTree)){ + return new ArrayList<>(2); + } + + // 鏍规嵁鍚嶇О鎼滅储鐗规畩澶勭悊 杩欓噷浠呬粎澶勭悊涓ゅ眰鎼滅储鍚庢湁瀛愮埗绾у叧绯荤殑鏁版嵁 +// if (StrUtil.isNotBlank(name) && CollUtil.isNotEmpty(allTree)) { +// List<Category> searchCategory = new ArrayList<>(); +// List<Integer> categoryIds = allTree.stream().map(Category::getId).collect(Collectors.toList()); +// +// List<Integer> pidList = allTree.stream().filter(c -> c.getPid() > 0 && !categoryIds.contains(c.getPid())) +// .map(Category::getPid).distinct().collect(Collectors.toList()); +// if (CollUtil.isNotEmpty(pidList)) { +// pidList.forEach(pid -> { +// searchCategory.add(dao.selectById(pid)); +// }); +// } +// allTree.addAll(searchCategory); +// } + for (S_category category : allTree) { + treeList.add(CategoryUtils.toCategoryTreeVo(category)); + } + + Map<Integer, CategoryTreeVo> map = new HashMap<>(treeList.size()); + //ID 涓� key 瀛樺偍鍒癿ap 涓� + for (CategoryTreeVo categoryTreeVo : treeList) { + map.put(categoryTreeVo.getId(), categoryTreeVo); + } + + List<CategoryTreeVo> list = new ArrayList<>(); + CategoryTreeVo parentTree = null; + for (CategoryTreeVo tree : treeList) { + //瀛愰泦ID杩斿洖瀵硅薄锛屾湁鍒欐坊鍔犮�� + parentTree = map.get(tree.getPid()); + if (parentTree != null) { + parentTree.getChild().add(tree); + } else { + list.add(tree); + } + } +// System.out.println("鏃犻檺鏋佸垎绫� : getTree:" + JSON.toJSONString(list)); + return list; + } + + private static final String SQL_GET_TREE = "select * from s_category where owner=:owner"; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/service/CodeServiceImpl.java b/iplatform-base/src/main/java/com/iplatform/base/service/CodeServiceImpl.java new file mode 100644 index 0000000..d3c03b6 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/service/CodeServiceImpl.java @@ -0,0 +1,187 @@ +package com.iplatform.base.service; + +import com.iplatform.model.po.S_dict_data; +import com.iplatform.model.po.S_dict_type; +import com.walker.db.page.GenericPager; +import com.walker.db.page.ListPageContext; +import com.walker.db.page.PageSearch; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.jdbc.service.BaseServiceImpl; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 鏁版嵁瀛楀吀琛ㄦ搷浣溿�� + * @date 2022-09-19 + */ +@Service +@RequiredArgsConstructor +public class CodeServiceImpl extends BaseServiceImpl { + + private static final String SQL_PAGE_TYPE_PREFIX = "select * from s_dict_type where 1=1"; + private static final String SQL_PAGE_DATA_PREFIX = "select * from s_dict_data where 1=1"; + + private static final String SQL_QUERY_EXIST_DATA = "select * from s_dict_data where dict_type=? and dict_value=?"; + + public void execDeleteDictData(Long[] dictCodes){ + if(dictCodes == null || dictCodes.length == 0){ + return; + } + List<Object[]> parameters = new ArrayList<>(8); + for(long dictCode : dictCodes){ + Object[] p = new Object[]{dictCode}; + parameters.add(p); + } + this.execBatchUpdate("delete from s_dict_data where dict_code=?", parameters); + } + + private static final String SQL_DICT_TREE_LIST = "select * from s_dict_data where dict_type=? order by parent_id, dict_sort"; + + /** + * 杩斿洖浠g爜鏍戠粨鏋勶紝闇�瑕佺殑鍒楄〃闆嗗悎銆�<p></p> + * 涓哄墠绔睍绀烘爲缁撴瀯鍑嗗鏁版嵁锛岄泦鍚堝凡缁忔寜鐓х埗鑺傜偣椤哄簭鎺掑ソ椤哄簭銆� + * @param dictType 浠g爜绫诲瀷锛屽锛歲uestion_root_catalog + * @return + * @date 2023-03-13 + */ + public List queryDictTreeList(String dictType){ + return this.select(SQL_DICT_TREE_LIST, new Object[]{dictType}, new S_dict_data()); + } + + /** + * 杩斿洖鎵�鏈変唬鐮侀」闆嗗悎銆�<p></p> + * 鏂规硶鐢ㄥ湪浠g爜缂撳瓨鍔熻兘銆� + * @return + * @date 2023-03-10 + */ + public List<S_dict_data> queryAllCodeItemList(){ + return this.select("select * from s_dict_data order by dict_sort", new Object[]{}, new S_dict_data()); + } + + /** + * 杩斿洖鏁版嵁瀛楀吀鎵�鏈夋牴闆嗗悎锛屽嵆锛氬瓧鍏歌〃闆嗗悎銆�<p></p> + * 璇ユ柟娉曠紦瀛樹娇鐢ㄣ�� + * @return + * @date 2023-03-10 + */ + public List<S_dict_type> queryRootCodeList(){ + return this.selectAll(new S_dict_type()); + } + + public S_dict_data queryOneDictData(long dictCode){ + return this.get(new S_dict_data(dictCode)); + } + + /** + * 瀛楀吀琛ㄤ腑鏄惁瀛樺湪缁欏畾鍊间竴鏍风殑瀛楀吀椤广�傚苟杩斿洖瀛楀吀椤广�� + * @param dictType + * @param value + * @return + * @date 2022-11-20 + */ + public S_dict_data queryOneDictData(String dictType, String value){ + return this.get(SQL_QUERY_EXIST_DATA, new Object[]{dictType, value}, new S_dict_data()); + } + + /** + * 鑾峰彇涓�涓瓧鍏哥被鍨嬭鎯呫�� + * @param dictId 瀛楀吀id + * @return + * @date 2022-11-19 + */ + public S_dict_type queryOneDictType(long dictId){ + return this.get("select * from s_dict_type where dict_id=?", new Object[]{dictId}, new S_dict_type()); + } + + /** + * 鍒嗛〉杩斿洖瀛楀吀绫诲瀷(浠g爜琛�)鍒楄〃 + * @param dictName + * @param dictType + * @param status + * @param startTime + * @param endTime + * @return + * @date 2022-11-16 + */ + public GenericPager<S_dict_type> queryPageDictType(String dictName, String dictType, Integer status, long startTime, long endTime){ + Map<String, Object> parameters = new HashMap<>(); + StringBuilder sql = new StringBuilder(SQL_PAGE_TYPE_PREFIX); + + if(StringUtils.isNotEmpty(dictName)){ + sql.append(" and dict_name like :dictName"); + parameters.put("dictName", "%" + dictName + "%"); + } + if(StringUtils.isNotEmpty(dictType)){ + sql.append(" and dict_type = :dictType"); + parameters.put("dictType", dictType); + } + if(status != null){ + sql.append(" and status = :status"); + parameters.put("status", status); + } + if(startTime > 0){ + sql.append(" and create_time >= :startTime"); + parameters.put("startTime", startTime); + } + if(endTime > 0){ + sql.append(" and create_time <= :endTime"); + parameters.put("endTime", endTime); + } + sql.append(" order by status, dict_id"); + PageSearch pageSearch = ListPageContext.getPageSearch(); + return this.selectSplit(sql.toString(), parameters, pageSearch.getPageIndex(), pageSearch.getPageSize(), new S_dict_type()); + } + + /** + * 鍒嗛〉鏌ヨ鏁版嵁瀛楀吀椤瑰垪琛ㄣ�� + * @param dictType 瀛楀吀绫诲瀷(鍚嶇О) + * @param dictLabel 妯$硦鏌ヨ瀛楀吀椤瑰悕绉� + * @return + * @date 2022-11-19 + */ + public GenericPager<S_dict_data> queryPageDictData(String dictType, String dictLabel){ + Map<String, Object> parameters = new HashMap<>(); + StringBuilder sql = new StringBuilder(SQL_PAGE_DATA_PREFIX); + if(StringUtils.isNotEmpty(dictType)){ + sql.append(" and dict_type = :dictType"); + parameters.put("dictType", dictType); + } + if(StringUtils.isNotEmpty(dictLabel)){ + sql.append(" and dict_label like :dictLabel"); + parameters.put("dictLabel", "%" + dictLabel + "%"); + } + sql.append(" order by dict_sort, create_time"); + PageSearch pageSearch = ListPageContext.getPageSearch(); + return this.selectSplit(sql.toString(), parameters, pageSearch.getPageIndex(), pageSearch.getPageSize(), new S_dict_data()); + } + + /** + * 鏍规嵁瀛楀吀绫诲瀷鍚嶇О(浠g爜琛�)锛岃繑鍥炲瓙浠g爜闆嗗悎銆� + * @param dictType 浠g爜绫诲瀷 + * @return + */ + public List<S_dict_data> queryDictDataByType(String dictType){ + return this.select(new S_dict_data(), "where status=0 and dict_type=? order by dict_sort asc", new Object[]{dictType}); + } + + public void execDelType(Long dictId) { + S_dict_type dictType = get(new S_dict_type(dictId)); + if (dictType == null) { + return; + } + String sqlDelData = "delete from s_dict_data where dict_type=?"; + String sqlDelType = "delete from s_dict_type where dict_id=?"; + this.execute(sqlDelData, new Object[] {dictType.getDict_type()}); + this.execute(sqlDelType, new Object[] {dictType.getDict_id()}); + } + + public S_dict_type getByDictType(String dictType) { + String sql = "select * from s_dict_type where dict_type = ? limit 1"; + return this.get(sql, new Object[]{dictType}, new S_dict_type()); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/service/CommonServiceImpl.java b/iplatform-base/src/main/java/com/iplatform/base/service/CommonServiceImpl.java new file mode 100644 index 0000000..a1c94d8 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/service/CommonServiceImpl.java @@ -0,0 +1,13 @@ +package com.iplatform.base.service; + +import com.walker.jdbc.service.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * 鍒涘缓涓�涓�氱敤service锛屽彲浠ュ湪浠绘剰涓氬姟浣跨敤銆� + * @author 鏃跺厠鑻� + * @date 2024-03-03 + */ +@Service +public class CommonServiceImpl extends BaseServiceImpl { +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/service/ConfigArgumentServiceImpl.java b/iplatform-base/src/main/java/com/iplatform/base/service/ConfigArgumentServiceImpl.java new file mode 100644 index 0000000..83bb67c --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/service/ConfigArgumentServiceImpl.java @@ -0,0 +1,70 @@ +package com.iplatform.base.service; + +import com.iplatform.model.po.S_config; +import com.iplatform.model.po.S_dict_type; +import com.walker.db.page.GenericPager; +import com.walker.db.page.ListPageContext; +import com.walker.db.page.PageSearch; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.jdbc.service.BaseServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +public class ConfigArgumentServiceImpl extends BaseServiceImpl { + + private static final String SQL_PAGE_LIST_PREFIX = "select * from s_config where 1=1"; + private static final String SQL_UPDATE_CONFIG = "update s_config set config_value=? where config_key=?"; + + /** + * 浠庤〃鍗曞垎缁勯厤缃腑锛屾洿鏂版暣涓垎缁勯厤缃� + * @param savedConfigList + * @date 2023-05-31 + */ + public void execUpdateFormConfig(List<Object[]> savedConfigList){ + this.execBatchUpdate(SQL_UPDATE_CONFIG, savedConfigList); + } + + /** + * 鏌ヨ鍒嗙粍涓嬬殑鍙傛暟闆嗗悎銆�<p></p> + * 閫氬父璇ユ柟娉曡皟鐢ㄦ柟鏄负浜嗗垵濮嬪寲鍔犺浇鍙傛暟锛岃�屼笉鏄绻佷笟鍔¤皟鐢ㄣ��<br> + * 鐩墠锛氭敮浠樻ā鍧楀垵濮嬪寲寮曟搸浣跨敤銆� + * @param group 鍒嗙粍鍚嶇О + * @return + * @date 2023-03-01 + */ + @Deprecated + public List<S_config> queryGroupConfigList(String group){ + return this.select(new S_config(), "where group_id=?", new Object[]{group}); + } + + public S_config queryConfigByKey(String key){ + List<S_config> list = this.select(new S_config(), "where config_key=?", new Object[]{key}); + if(StringUtils.isEmptyList(list)){ + return null; + } + return list.get(0); + } + + public GenericPager<S_config> queryPageConfigList(String configName, String configKey, String configType){ + Map<String, Object> parameters = new HashMap<>(); + StringBuilder sql = new StringBuilder(SQL_PAGE_LIST_PREFIX); + if(StringUtils.isNotEmpty(configName)){ + sql.append(" and config_name like :configName"); + parameters.put("configName", "%" + configName + "%"); + } + if(StringUtils.isNotEmpty(configKey)){ + sql.append(" and config_key like :configKey"); + parameters.put("configKey", "%" + configKey + "%"); + } + if(StringUtils.isNotEmpty(configType)){ + sql.append(" and config_type = :configType"); + parameters.put("configType", configType); + } + PageSearch pageSearch = ListPageContext.getPageSearch(); + return this.selectSplit(sql.toString(), parameters, pageSearch.getPageIndex(), pageSearch.getPageSize(), new S_config()); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/service/ConfigFormServiceImpl.java b/iplatform-base/src/main/java/com/iplatform/base/service/ConfigFormServiceImpl.java new file mode 100644 index 0000000..acd110d --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/service/ConfigFormServiceImpl.java @@ -0,0 +1,35 @@ +package com.iplatform.base.service; + +import com.iplatform.model.po.S_config_form; +import com.walker.db.page.GenericPager; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.jdbc.service.BaseServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.Map; + +@Service +public class ConfigFormServiceImpl extends BaseServiceImpl { + + public int queryNextId(){ + int maxId = this.queryForInt(SQL_MAX_ID, new Object[]{}); + return maxId+1; + } + + public GenericPager<S_config_form> queryPageFormList(String keywords){ + Map<String, Object> parameters = new HashMap<>(); + StringBuilder sql = new StringBuilder(SQL_PAGE_LIST); + + if(StringUtils.isNotEmpty(keywords)){ + sql.append(" and (name like :name or info like :info)"); + parameters.put("name", "%" + keywords + "%"); + parameters.put("info", "%" + keywords + "%"); + } + sql.append(" order by id desc"); + return this.selectSplit(sql.toString(), parameters, new S_config_form()); + } + + private static final String SQL_MAX_ID = "select max(id) from s_config_form"; + private static final String SQL_PAGE_LIST = "select * from s_config_form where 1=1"; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/service/DataImportServiceImpl.java b/iplatform-base/src/main/java/com/iplatform/base/service/DataImportServiceImpl.java new file mode 100644 index 0000000..6d3c774 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/service/DataImportServiceImpl.java @@ -0,0 +1,17 @@ +package com.iplatform.base.service; + +import com.walker.jdbc.service.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * 鏁版嵁瀵煎叆涓撶敤鏁版嵁搴撴搷浣滃璞°�� + * @author 鏃跺厠鑻� + * @date 2023-02-01 + */ +@Service +public class DataImportServiceImpl extends BaseServiceImpl { + + public void test(){ + + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/service/DeptServiceImpl.java b/iplatform-base/src/main/java/com/iplatform/base/service/DeptServiceImpl.java new file mode 100644 index 0000000..a723338 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/service/DeptServiceImpl.java @@ -0,0 +1,105 @@ +package com.iplatform.base.service; + +import com.iplatform.model.po.S_dept; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.jdbc.service.BaseServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +public class DeptServiceImpl extends BaseServiceImpl { + + private static final String WHERE_QUERY_ROOT_LIST = "where parent_id=0 order by order_num"; + private static final String WHERE_QUERY_ROOT_LIST_BY_ID = "where parent_id=0 and id=? order by order_num"; + private static final String WHERE_QUERY_ROOT_ONE_CHILDREN = "where org_id=:orgId"; + private static final String QUERY_SUB_SIZE_IN_CURRENT = "select count(id) total from s_dept where parent_id=?"; + private static final String QUERY_USER_SIZE_IN_CURRENT = "select count(id) total from s_user_core where dept_id=?"; + private static final String QUERY_DEPT_FOR_CACHE = "select * from s_dept order by parent_id, order_num"; + private static final String QUERY_TREE_ALL = "select * from s_dept where del_flag=0 and status=0 order by parent_id, order_num"; + private static final String QUERY_TREE_ONE = "select * from s_dept where org_id=? and del_flag=0 and status=0 order by parent_id, order_num"; + + /** + * 杩斿洖鎵�鏈夋牴鏈烘瀯鍒楄〃锛屼篃灏辨槸绗竴灞傜嫭绔嬪崟浣�(闆嗗洟) + * @param orgRootId 缁欏畾鐨勫崟浣岻D锛屽鏋滄彁渚涜鍙傛暟锛屽垯琛ㄦ槑鍙繑鍥炰竴鏉¤褰� + * @return + * @date 2022-12-01 + */ + public List<S_dept> queryRootOrgList(long orgRootId){ + if(orgRootId <= 0){ + return this.select(new S_dept(),WHERE_QUERY_ROOT_LIST, new Object[]{}); + } else { + return this.select(new S_dept(),WHERE_QUERY_ROOT_LIST_BY_ID, new Object[]{orgRootId}); + } + } + + /** + * 鏈烘瀯绠$悊鏄剧ず鏈烘瀯鍒楄〃锛岀敱鍓嶇缁勭粐鏍戠粨鏋溿��<p></p> + * 娉ㄦ剰: 杩欎釜鍒楄〃鍖呭惈鏍规満鏋勶紝涔熷氨鏄竴涓畬鏁寸殑鐙珛鏈烘瀯鍒楄〃锛屽鏋滄病鏈夋牴鑺傜偣锛屽墠绔棤娉曢�夋嫨娣诲姞銆�2022-12-02 + * @param orgRootId 鏍规満鏋処D锛屽繀濉� + * @param deptName 鏌ヨ鐨勬満鏋勫悕绉� + * @return + * @date 2022-12-01 + */ + public List<S_dept> queryRootOrgChildrenList(long orgRootId, String deptName){ + Map<String, Object> parameters = new HashMap<>(); + parameters.put("orgId", orgRootId); + StringBuilder sql = new StringBuilder(WHERE_QUERY_ROOT_ONE_CHILDREN); + if(StringUtils.isNotEmpty(deptName)){ + sql.append(" and dept_name like :deptName"); + parameters.put("deptName", "%" + deptName + "%"); + } + sql.append(" order by parent_id, order_num"); + return this.select(new S_dept(), sql.toString(), parameters); + } + + public S_dept queryOneDept(long id){ + return this.get(new S_dept(id)); + } + + /** + * 鏌ヨ缁欏畾鍗曚綅涓嬪瓨鍦ㄥ灏戜釜瀛愭満鏋勩�� + * @param id 褰撳墠鏈烘瀯ID + * @return 杩斿洖瀛愭満鏋勬暟閲� + */ + public int querySubDeptSizeInCurrent(long id){ + return this.sqlMathQuery(QUERY_SUB_SIZE_IN_CURRENT, new Object[]{id}, Integer.class); + } + + /** + * 鏌ヨ缁欏畾鏈烘瀯涓嬪瓨鍦ㄥ灏戠敤鎴� + * @param id 褰撳墠鏈烘瀯ID + * @return 杩斿洖鐢ㄦ埛鏁伴噺 + * @date 2022-12-03 + */ + public long queryUserSizeInCurrent(long id){ + return this.sqlMathQuery(QUERY_USER_SIZE_IN_CURRENT, new Object[]{id}, Long.class); + } + + /** + * 缂撳瓨浣跨敤璇ユ柟娉曪紝鍔犺浇鎵�鏈夋満鏋勫垪琛ㄣ�� + * @return + * @date 2022-12-03 + */ + public List<S_dept> queryAllDeptListForCache(){ + return this.select(QUERY_DEPT_FOR_CACHE, new Object[]{}, new S_dept()); + } + + /** + * 鑾峰彇鏈烘瀯鍒楄〃锛屼负鍓嶇鏍戠鐞嗗睍绀虹敤銆� + * @param orgId 鎸囧畾鐨勯《绾у崟浣岻D锛屽鏋滄病鎸囧畾鍒欏睍绀烘墍鏈夐《绾ф満鏋勩�� + * @return + * @date 2022-12-08 + */ + public List<S_dept> queryOrgListForTree(long orgId){ + if(orgId <= 0){ + // 涓嶅瓨鍦ㄦ寚瀹氱殑鍗曚綅锛屽氨灞曠ず鍏ㄩ儴椤剁骇鐐逛綅 + return this.select(QUERY_TREE_ALL, new Object[]{}, new S_dept()); + } else { + // 鍙樉绀虹粰瀹氶《绾ф満鏋勪笅鐨勫垪琛� + return this.select(QUERY_TREE_ONE, new Object[]{orgId}, new S_dept()); + } + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/service/GroupServiceImpl.java b/iplatform-base/src/main/java/com/iplatform/base/service/GroupServiceImpl.java new file mode 100644 index 0000000..873e691 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/service/GroupServiceImpl.java @@ -0,0 +1,78 @@ +package com.iplatform.base.service; + +import com.iplatform.model.po.S_group; +import com.iplatform.model.po.S_group_data; +import com.walker.db.page.GenericPager; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.jdbc.service.BaseServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +public class GroupServiceImpl extends BaseServiceImpl { + + /** + * 鏍规嵁鍒嗙粍椤笽D锛屾煡璇㈤」鐩褰曘�� + * @param dataId + * @return + * @date 2023-09-11 + */ + public S_group_data queryGroupData(int dataId){ + return this.get(new S_group_data(dataId)); + } + + public List<S_group_data> queryAllGroupDataList(){ + return this.select("select * from s_group_data where status=1 order by gid, sort", new Object[]{}, new S_group_data()); + } + + /** + * 鑾峰緱(s_group_data)琛ㄤ笅涓�涓彲鐢ㄧ殑鏈�澶D銆� + * @return + * @date 2023-05-20 + */ + public int queryGroupDataNextId(){ + int maxId = this.queryForInt(SQL_MAX_ID_GROUP_DATA, new Object[]{}); + return maxId+1; + } + + /** + * 鑾峰緱(s_group)琛ㄤ笅涓�涓彲鐢ㄧ殑鏈�澶D銆� + * @return + * @date 2023-05-20 + */ + public int queryGroupNextId(){ + int maxId = this.queryForInt(SQL_MAX_ID_GROUP, new Object[]{}); + return maxId+1; + } + + public GenericPager<S_group_data> queryPageGroupDataList(int groupId, Integer status){ + Map<String, Object> params = new HashMap<>(4); + params.put("gid", groupId); + + StringBuilder sql = new StringBuilder(SQL_PAGE_GROUP_DATA); + if(status != null){ + sql.append(" and status=:status"); + params.put("status", status.intValue()); + } + sql.append(" order by sort desc"); + + return this.selectSplit(sql.toString(), params, new S_group_data()); + } + + public GenericPager<S_group> queryPageGroupList(String keywords){ + S_group group = new S_group(); + if(StringUtils.isNotEmpty(keywords)){ + String search = StringUtils.CHAR_PERCENT + keywords + StringUtils.CHAR_PERCENT; + return this.selectSplit("select * from s_group where name like ? or info like ? order by id desc" + , new Object[]{search, search}, group); + } + return this.selectSplit(group); + } + + private static final String SQL_MAX_ID_GROUP_DATA = "select max(id) from s_group_data"; + private static final String SQL_MAX_ID_GROUP = "select max(id) from s_group"; + private static final String SQL_PAGE_GROUP_DATA = "select * from s_group_data where gid=:gid"; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/service/LogServiceImpl.java b/iplatform-base/src/main/java/com/iplatform/base/service/LogServiceImpl.java new file mode 100644 index 0000000..f8ddafe --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/service/LogServiceImpl.java @@ -0,0 +1,112 @@ +package com.iplatform.base.service; + +import com.iplatform.model.po.S_login_info; +import com.iplatform.model.po.S_oper_log; +import com.walker.db.page.GenericPager; +import com.walker.db.page.ListPageContext; +import com.walker.db.page.PageSearch; +import com.walker.infrastructure.utils.DateUtils; +import com.walker.infrastructure.utils.NumberGenerator; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.jdbc.service.BaseServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.Map; + +@Service +public class LogServiceImpl extends BaseServiceImpl { + + private static final String SQL_PAGE_LOGIN_LOG = "select * from s_login_info where 1=1"; + private static final String SQL_PAGE_OPERATE_LOG = "select * from s_oper_log where 1=1"; + + /** + * 鍒嗛〉鏌ヨ鎿嶄綔鏃ュ織銆� + * @param operateName + * @param businessType + * @param status + * @param title + * @return + * @date 2023-01-09 + */ + public GenericPager<S_oper_log> queryPageOperateLogList(String operateName + , Integer businessType, Integer status, String title){ + Map<String, Object> parameters = new HashMap<>(); + StringBuilder sql = new StringBuilder(SQL_PAGE_OPERATE_LOG); + if(StringUtils.isNotEmpty(operateName)){ + sql.append(" and oper_name = :operateName"); + parameters.put("operateName", operateName); + } + if(businessType != null){ + sql.append(" and business_type = :businessType"); + parameters.put("businessType", businessType.intValue()); + } + if(status != null && (status.intValue() == 1 || status.intValue() == 0)){ + sql.append(" and status = :status"); + parameters.put("status", status.intValue()); + } + if(StringUtils.isNotEmpty(title)){ + sql.append(" and title = :title"); + parameters.put("title", title); + } + PageSearch pageSearch = ListPageContext.getPageSearch(); + return this.selectSplit(sql.toString(), parameters, pageSearch.getPageIndex(), pageSearch.getPageSize(), new S_oper_log()); + } + + /** + * 鍒嗛〉鏌ヨ鐧诲綍鏃ュ織 + * @param ip + * @param userName + * @param status + * @return + * @date 2023-01-05 + */ + public GenericPager<S_login_info> queryPageLoginLogList(String ip, String userName, String status){ + Map<String, Object> parameters = new HashMap<>(); + StringBuilder sql = new StringBuilder(SQL_PAGE_LOGIN_LOG); + + if(StringUtils.isNotEmpty(ip)){ + sql.append(" and ipaddr = :ipaddr"); + parameters.put("ipaddr", ip); + } + if(StringUtils.isNotEmpty(userName)){ + sql.append(" and user_name = :userName"); + parameters.put("userName", userName); + } + if(StringUtils.isNotEmpty(status)){ + sql.append(" and status = :status"); + parameters.put("status", status); + } + PageSearch pageSearch = ListPageContext.getPageSearch(); + return this.selectSplit(sql.toString(), parameters, pageSearch.getPageIndex(), pageSearch.getPageSize(), new S_login_info()); + } + + public void execClearOperateLog(){ + this.execute("truncate table s_oper_log", new Object[]{}); + } + + public void execClearLoginLog(){ + this.execute("truncate table s_login_info", new Object[]{}); + } + + public void execInsertOperateLog(S_oper_log s_oper_log){ + s_oper_log.setOper_time(DateUtils.getDateTimeNumber(System.currentTimeMillis())); + s_oper_log.setOper_id(NumberGenerator.getLongSequenceNumber()); + this.insert(s_oper_log); + } + + /** + * 鍐欏叆涓�鏉$櫥褰曟棩蹇楋紝鐩墠淇敼涓猴細鍙湁鐧诲綍澶辫触鎵嶄細璋冪敤璇ユ柟娉曘��<p></p> + * 璇峰弬鑰冿細{@linkplain LoginServiceImpl#execUpdateUserLogin(long, String, String, String, S_login_info)} + * @param s_login_info + * @param userId + * @date 2023-03-23 + */ + public void execInsertLoginLog(S_login_info s_login_info, Long userId){ + if(s_login_info != null){ + this.insert(s_login_info); + } + } + + +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/service/LoginServiceImpl.java b/iplatform-base/src/main/java/com/iplatform/base/service/LoginServiceImpl.java new file mode 100644 index 0000000..0893bf7 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/service/LoginServiceImpl.java @@ -0,0 +1,99 @@ +package com.iplatform.base.service; + +import com.iplatform.model.po.S_login_info; +import com.iplatform.model.po.S_user_login; +import com.walker.infrastructure.utils.DateUtils; +import com.walker.jdbc.service.BaseServiceImpl; +import org.springframework.stereotype.Service; + +@Service +public class LoginServiceImpl extends BaseServiceImpl { + + /** + * 鏍规嵁鐢ㄦ埛id杩斿洖鏇剧粡鐧诲綍杩囩殑uuid + * @param userId + * @return + * @date 2023-03-22 + */ + public String queryLoginUUID(long userId){ + S_user_login exist = this.get(new S_user_login(userId)); + if(exist == null){ + return null; + } + return exist.getUuid(); + } + + /** + * 鍒涘缓鐢ㄦ埛鐧诲綍鍏宠仈锛堝璐︽埛锛変俊鎭紝涓哄悗缁�氳繃userId鏌ユ壘uuid锛堢紦瀛榢ey锛夊噯澶囨暟鎹�� + * @param userId + * @param loginId + * @param uuid 绯荤粺缂撳瓨鐧诲綍鐢ㄦ埛鐨刱ey + * @param clientType + * @date 2023-03-22 + */ + public S_user_login execUpdateUserLogin(long userId + , String loginId, String uuid, String clientType, S_login_info s_login_info, boolean update){ + S_user_login exist = null; + if(!update){ + // 涓嶅瓨鍦紝鍒涘缓璁板綍 + exist = this.get(new S_user_login(userId)); + if(exist == null){ + exist = new S_user_login(userId); + exist.setUser_name(loginId); + exist.setCreate_time(DateUtils.getDateTimeNumber()); + exist.setUpdate_time(exist.getCreate_time()); + exist.setUuid(uuid); + exist.setClient_type(clientType); + this.insert(exist); + } else { + exist.setUpdate_time(DateUtils.getDateTimeNumber()); + exist.setUuid(uuid); + exist.setClient_type(clientType); + this.save(exist); + } + + } else { + // 宸插瓨鍦紝鏇存柊uuid + exist = new S_user_login(userId); + exist.setUser_name(loginId); + exist.setUuid(uuid); + exist.setUpdate_time(DateUtils.getDateTimeNumber()); + exist.setClient_type(clientType); + this.save(exist); + } + + // 鎶婄櫥褰曟棩蹇椾繚瀛樻斁鍦ㄤ竴璧枫��2023-03-23 + if(s_login_info != null){ + this.insert(s_login_info); + } + return exist; + } + +// public void execUpdateUserLogin(long userId +// , String loginId, String uuid, String clientType, S_login_info s_login_info){ +// S_user_login exist = this.get(new S_user_login(userId)); +// if(exist == null){ +// // 涓嶅瓨鍦紝鍒涘缓璁板綍 +// exist = new S_user_login(userId); +// exist.setUser_name(loginId); +// exist.setCreate_time(DateUtils.getDateTimeNumber()); +// exist.setUpdate_time(exist.getCreate_time()); +// exist.setUuid(uuid); +// exist.setClient_type(clientType); +// this.insert(exist); +// +// } else { +// // 宸插瓨鍦紝鏇存柊uuid +// exist = new S_user_login(userId); +// exist.setUuid(uuid); +// exist.setUpdate_time(DateUtils.getDateTimeNumber()); +// exist.setClient_type(clientType); +// this.save(exist); +// } +// +// // 鎶婄櫥褰曟棩蹇椾繚瀛樻斁鍦ㄤ竴璧枫��2023-03-23 +// if(s_login_info != null){ +// this.insert(s_login_info); +// } +// } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/service/MenuServiceImpl.java b/iplatform-base/src/main/java/com/iplatform/base/service/MenuServiceImpl.java new file mode 100644 index 0000000..156b248 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/service/MenuServiceImpl.java @@ -0,0 +1,107 @@ +package com.iplatform.base.service; + +import com.iplatform.model.po.S_menu; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.jdbc.service.BaseServiceImpl; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * 鑿滃崟鏉冮檺鏁版嵁鎿嶄綔銆� + * @author 鏃跺厠鑻� + * @date 2022-11-02 + */ +@Service +public class MenuServiceImpl extends BaseServiceImpl { + + protected final transient Logger logger = LoggerFactory.getLogger(getClass()); + + private static final String SQL_QUERY_ROLE_MENUS = "select DISTINCT(menu_id) from s_role_menu where role_id in (:roleIdList)"; + + private static final String SQL_SAME_MENU_PARENT = "select * from s_menu where parent_id=? and menu_name = ?"; + + private static final String SQL_MENU_USER = "select count(menu_id) total from s_role_menu where menu_id=?"; + + /** + * 鏌ヨ缁欏畾鑿滃崟鏄惁琚垎閰嶅埌瑙掕壊鍔熻兘涓� + * @param menuId + * @return 瀛樺湪杩斿洖澶т簬0 + * @date 2022-12-29 + */ + public int queryRoleMenuSize(String menuId){ + return this.sqlMathQuery(SQL_MENU_USER, new Object[]{menuId}, Integer.class); + } + + /** + * 鏌ヨ缁欏畾鐖惰妭鐐逛笅鏄惁瀛樺湪宸查噸鍚嶇殑鑿滃崟銆� + * @param parentId + * @param menuName + * @return + * @date 2022-12-26 + */ + public S_menu queryExistMenuInParent(String parentId, String menuName){ + List<S_menu> list = this.select(SQL_SAME_MENU_PARENT, new Object[]{parentId, menuName}, new S_menu()); + if(StringUtils.isEmptyList(list)){ + return null; + } + return list.get(0); + } + + /** + * 缁欏畾瑙掕壊ID闆嗗悎锛岃繑鍥炲搴旇彍鍗旾D鍒楄〃 + * @param roleIdList + * @return + * @date 2022-11-12 + */ + public List<String> queryRoleMenuIdList(List<String> roleIdList){ + if(StringUtils.isEmptyList(roleIdList)){ + return null; + } + // 2023-07-12 瀹夊叏妯″潡浼犻�掔殑瑙掕壊id锛屽彲鑳藉瓨鍦ㄥ瓧绗︿覆锛屽锛歊OLE_USER绛夛紝搴斿綋杩囨护鎺夛紝鍙繚鐣欑郴缁熻鑹睮D锛堟暟鍊硷級 + //------------------------------------------------- + List<Long> roleIdValueList = new ArrayList<>(4); + for(String roleId: roleIdList){ + if(StringUtils.isNumeric(roleId)){ + roleIdValueList.add(Long.parseLong(roleId)); + } + } + if(StringUtils.isEmptyList(roleIdValueList)){ + return null; + } + //------------------------------------------------- +// Map<String, Object> param = new HashMap<>(2); +// param.put("roleIdList", roleIdValueList); +// List<Map<String, Object>> list = this.select(SQL_QUERY_ROLE_MENUS, param); + // 鍥犱负 oracle鎶ラ敊锛歸here role_id in ([2])锛屾墍浠ユ洿鎹㈠啓娉曪紒2023-07-19 + MapSqlParameterSource sqlParameterSource = new MapSqlParameterSource(); + sqlParameterSource.addValue("roleIdList", roleIdValueList); + List<Map<String, Object>> list = this.queryListObjectWhereIn(SQL_QUERY_ROLE_MENUS, sqlParameterSource); +// logger.debug("鏌ヨ瑙掕壊鏉冮檺闆嗗悎: {}", list); + if(list != null && list.size() > 0){ + List<String> menuIdList = new ArrayList<>(64); + for(Map<String, Object> map : list){ +// menuIdList.add(map.get("menu_id").toString()); + // 2023-07-19 鐢变簬oracle杩斿洖鐨勬槸鍚﹀ぇ鍐欙細MENU_ID锛屽洜姝よ繖閲屽彲浠ュ彇绗竴涓瓧娈碉紙鍥犱负鍙湁涓�涓級 + // 鑰屼笉鑳介�氳繃灏忓啓鍙杕enu_id锛屽惁鍒欏彇涓嶅埌鏁版嵁銆� + menuIdList.add(map.values().toArray()[0].toString()); + } + return menuIdList; + } + return null; + } + + /** + * 鏌ヨ绯荤粺鎵�鏈夎鑹蹭笌鑿滃崟瀵瑰簲鍏崇郴闆嗗悎銆傚湪security鏉冮檺鎷︽埅涓娇鐢ㄨ鏂规硶 + * @return 闆嗗悎涓寘鎷細role_id, menu_id + * @date 2022-11-02 + */ + public List<Map<String, Object>> queryRolesPermList(){ + return this.select("select * from s_role_menu", new Object[]{}); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/service/NotificationServiceImpl.java b/iplatform-base/src/main/java/com/iplatform/base/service/NotificationServiceImpl.java new file mode 100644 index 0000000..b48bbc1 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/service/NotificationServiceImpl.java @@ -0,0 +1,41 @@ +package com.iplatform.base.service; + +import com.iplatform.model.po.SfNotification; +import com.iplatform.model.po.SfTemplateMessage; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.jdbc.service.BaseServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 绯荤粺閫氱煡鎻愰啋閰嶇疆锛屽井淇″叕浼楀彿妯℃澘閰嶇疆绛夊叕鐢ㄣ�� + * @date 2023-08-24 + */ +@Service +public class NotificationServiceImpl extends BaseServiceImpl { + + public Map<Long, SfTemplateMessage> queryTemplateIdMap(){ + Map<Long, SfTemplateMessage> map = new HashMap<>(8); + List<SfTemplateMessage> list = this.select(new SfTemplateMessage()); + if(!StringUtils.isEmptyList(list)){ + for(SfTemplateMessage templateMessage : list){ + if(templateMessage.getStatus().intValue() == 0){ + continue; + } + map.put(templateMessage.getId(), templateMessage); + } + } + return map; + } + + public List<SfNotification> queryList(Integer sendType){ + SfNotification param = new SfNotification(); + if(sendType != null){ + param.setSendType(sendType); + } + return this.select(param); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/service/PushServiceImpl.java b/iplatform-base/src/main/java/com/iplatform/base/service/PushServiceImpl.java new file mode 100644 index 0000000..d9af2c9 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/service/PushServiceImpl.java @@ -0,0 +1,14 @@ +package com.iplatform.base.service; + +import com.walker.jdbc.service.BaseServiceImpl; +import org.springframework.stereotype.Service; + +/** + * 骞冲彴鎺ㄩ�佹暟鎹簱鎿嶄綔銆� + * @author 鏃跺厠鑻� + * @date 2023-04-25 + */ +@Service +public class PushServiceImpl extends BaseServiceImpl { + +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/service/RoleServiceImpl.java b/iplatform-base/src/main/java/com/iplatform/base/service/RoleServiceImpl.java new file mode 100644 index 0000000..99bea12 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/service/RoleServiceImpl.java @@ -0,0 +1,303 @@ +package com.iplatform.base.service; + +import com.iplatform.model.po.S_role; +import com.iplatform.model.po.S_user_core; +import com.walker.db.page.GenericPager; +import com.walker.db.page.ListPageContext; +import com.walker.db.page.PageSearch; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.jdbc.service.BaseServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +public class RoleServiceImpl extends BaseServiceImpl { + + private static final String SQL_ORG_ROLES = "select * from s_role where org_id=? and del_flag=0 and status=0"; + + private static final String SQL_USER_ROLES = "select r.* from s_role_user ru, s_role r where ru.user_id=? and ru.role_id=r.role_id and r.status=0 and r.del_flag=0"; +// private static final String SQL_USER_ROLES_ID = "select r.role_id from s_role_user ru, s_role r where ru.user_id=? and ru.role_id=r.role_id and r.status=0 and r.del_flag=0"; +// private static final String SQL_USER_ROLES_ID = "select r.role_id from s_role_user ru, s_role r where ru.user_id=? and ru.role_id=r.role_id and r.status=0 and r.del_flag=0 and (r.org_id=0 or r.org_id is null)"; +// private static final String SQL_USER_ROLES_ID_ORGID = "select r.role_id from s_role_user ru, s_role r where ru.user_id=? and ru.role_id=r.role_id and r.status=0 and r.del_flag=0 and (r.org_id=0 or r.org_id is null) and r.org_id=?"; + + private static final String SQL_USER_ROLES_ID = "select r.role_id from s_role_user ru, s_role r where ru.user_id=? and ru.role_id=r.role_id and r.status=0 and r.del_flag=0 "; + private static final String SQL_USER_ROLES_ID_ORGID = "select r.role_id from s_role_user ru, s_role r where ru.user_id=? and ru.role_id=r.role_id and r.status=0 and r.del_flag=0 and (ru.org_id=0 or ru.org_id is null or ru.org_id=?)"; + + +// private static final String SQL_USER_ROLES_ID = "select r.role_id from s_role_user ru, s_role r where ru.user_id=? and ru.role_id=r.role_id and r.status=0 and r.del_flag=0 and (ru.org_id=0 or ru.org_id is null)"; +// private static final String SQL_USER_ROLES_ID_ORGID = "select r.role_id from s_role_user ru, s_role r where ru.user_id=? and ru.role_id=r.role_id and r.status=0 and r.del_flag=0 and (ru.org_id=0 or ru.org_id is null or ru.org_id=?)"; + + + private static final String SQL_PAGE_ROLE_PREFIX = "select * from s_role where org_id=:orgId"; + + private static final String SQL_UPDATE_ROLE_STATUS = "update s_role set status=? where role_id=?"; + + private static final String SQL_DEL_ROLE_MENU = "delete from s_role_menu where role_id=?"; + private static final String SQL_DEL_ROLE_USER = "delete from s_role_user where role_id=?"; + private static final String SQL_DEL_ROLE_AND_USER = "delete from s_role_user where role_id=? and user_id=?"; + private static final String SQL_INSERT_ROLE_USER = "insert into s_role_user(user_id, role_id, org_id) values(?,?,0)"; + + /** + * 鎵归噺娣诲姞瑙掕壊瀵瑰簲鐨勭敤鎴枫�� + * @param roleId + * @param userIdList + * @date 2022-12-22 + */ + public void execInsertRoleUserList(long roleId, Long[] userIdList){ + List<Object[]> parameters = new ArrayList<>(); + Object[] one = null; + for(long userId : userIdList){ + one = new Object[2]; + one[0] = userId; + one[1] = roleId; + parameters.add(one); + } + this.execBatchUpdate(SQL_INSERT_ROLE_USER, parameters); + } + + /** + * 鍒犻櫎涓�涓鑹蹭腑鐨勪竴涓敤鎴枫�� + * @param roleId + * @param userId + * @date 2022-12-21 + */ + public void execDeleteRoleUser(long roleId, long userId){ + this.execute(SQL_DEL_ROLE_AND_USER, new Object[]{roleId, userId}); + } + + public void execDeleteRole(long roleId){ + this.execute(SQL_DEL_ROLE_MENU, new Object[]{roleId}); + this.execute(SQL_DEL_ROLE_USER, new Object[]{roleId}); + this.delete(new S_role(roleId)); + } + + public void execInsertRole(S_role s_role, String[] menuIds){ + this.insert(s_role); + this.batchInsertRoleMenu(s_role.getRole_id(), menuIds); + } + + public void execUpdateRole(S_role s_role, String[] menuIds){ + // 鍏堝垹闄よ鑹插叧鑱旂殑鑿滃崟鍔熻兘锛屽啀鍐欏叆鏂板姛鑳� + this.execute(SQL_DEL_ROLE_MENU, new Object[]{s_role.getRole_id()}); + this.batchInsertRoleMenu(s_role.getRole_id(), menuIds); + this.save(s_role); + } + + private void batchInsertRoleMenu(long roleId, String[] menuIdList){ + if(menuIdList == null || menuIdList.length == 0){ + return; + } + List<Object[]> parameters = new ArrayList<>(32); + Object[] p = null; + for(String menuId : menuIdList){ + p = new Object[2]; + p[0] = roleId; + p[1] = menuId; + parameters.add(p); + } + this.execBatchUpdate("insert into s_role_menu(role_id, menu_id, org_id) values(?,?,0)", parameters); + } + + public void execUpdateStatus(long roleId, int status){ + this.execute(SQL_UPDATE_ROLE_STATUS, new Object[]{status, roleId}); + } + + private static final String SQL_ROLE_UNALLOCATED_USER = "select u.* from s_user_core u LEFT JOIN s_role_user ru ON ru.role_id=:roleId and ru.user_id=u.id where u.org_id=:orgId and ru.user_id is null and u.del_flag=0 and u.status=0"; + + /** + * 鍒嗛〉杩斿洖缁欏畾瑙掕壊ID鏈垎閰嶇敤鎴风殑鍒楄〃銆傚嵆:璇ュ崟浣嶄笅鍏充簬璇ヨ鑹诧紝浠嶆病鏈夊垎閰嶇殑鐢ㄦ埛銆�(瑙掕壊宸茬粡鍐冲畾鍝釜鍗曚綅浜�) + * @param roleId + * @param orgId + * @param loginId + * @return + * @date 2022-12-21 + */ + public GenericPager<S_user_core> queryUnAllocatedUserList(long roleId, long orgId, String loginId){ + Map<String, Object> parameters = new HashMap<>(); + StringBuilder sql = new StringBuilder(SQL_ROLE_UNALLOCATED_USER); + parameters.put("roleId", roleId); + parameters.put("orgId", orgId); + + if(StringUtils.isNotEmpty(loginId)){ + sql.append(" and u.user_name like :userName"); + parameters.put("userName", "%" + loginId + "%"); + } + PageSearch pageSearch = ListPageContext.getPageSearch(); + return this.selectSplit(sql.toString(), parameters, pageSearch.getPageIndex(), pageSearch.getPageSize(), new S_user_core()); + } + + private static final String SQL_ROLE_ALLOCATED_USER = "select u.* from s_role_user ru, s_user_core u where ru.role_id=:roleId and ru.user_id=u.id"; + + /** + * 鍒嗛〉杩斿洖宸插垎閰�(缁欏畾瑙掕壊ID)鐢ㄦ埛鍒楄〃 + * @param roleId 瑙掕壊ID + * @param loginId 鏌ヨ鐨勭敤鎴风櫥褰旾D + * @return + * @date 2022-12-21 + */ + public GenericPager<S_user_core> queryAllocatedUserList(long roleId, String loginId){ + Map<String, Object> parameters = new HashMap<>(); + StringBuilder sql = new StringBuilder(SQL_ROLE_ALLOCATED_USER); + parameters.put("roleId", roleId); + if(StringUtils.isNotEmpty(loginId)){ + sql.append(" and u.user_name like :userName"); + parameters.put("userName", "%" + loginId + "%"); + } + PageSearch pageSearch = ListPageContext.getPageSearch(); + return this.selectSplit(sql.toString(), parameters, pageSearch.getPageIndex(), pageSearch.getPageSize(), new S_user_core()); + } + + private static final String SQL_ROLE_MENU_ID = "select distinct sr.menu_id from s_role_menu sr join s_menu s on sr.menu_id=s.menu_id and s.visible='0'" + + " where sr.role_id=?"; + + /** + * 杩斿洖缁欏畾瑙掕壊鎷ユ湁鐨勮彍鍗旾D闆嗗悎銆� + * @param roleId + * @return + * @date 2022-12-19 + */ + public List<String> queryRoleMenuIdList(long roleId){ + List<Map<String, Object>> listMap = this.sqlQueryListMap(SQL_ROLE_MENU_ID, new Object[]{roleId}); + if(StringUtils.isEmptyList(listMap)){ + return null; + } + List<String> menuIdList = new ArrayList<>(32); + for(Map<String, Object> m : listMap){ + menuIdList.add(m.get("menu_id").toString()); + } + return menuIdList; + } + + /** + * 杩斿洖缁欏畾瑙掕壊宸茬粡鍏宠仈鐨勭敤鎴锋暟閲忥紝褰撳墠鍦ㄥ垹闄よ鑹叉椂鍒ゆ柇鏄惁鍏宠仈鐢ㄦ埛銆� + * @param roleId + * @return + * @date 2022-12-19 + */ + public int queryRoleUserSize(long roleId){ + return this.queryForInt("select count(role_id) size from s_role_user where role_id=?", new Object[]{roleId}); + } + + /** + * 妫�绱㈢粰瀹氬崟浣嶄腑锛屾槸鍚﹀瓨鍦ㄥ寘鍚粰瀹氬悕绉扮殑瑙掕壊銆� + * @param orgId 椤剁骇鍗曚綅ID + * @param roleName 瑙掕壊鍚嶅瓧 + * @return + * @date 2022-12-19 + */ + public S_role queryRoleByName(long orgId, String roleName){ + List<S_role> list = this.select("select * from s_role where org_id = ? and role_name = ?", new Object[]{orgId, roleName}, new S_role()); + if(StringUtils.isEmptyList(list)){ + return null; + } + return list.get(0); + } + + /** + * 鍒嗛〉鏌ヨ瑙掕壊鍒楄〃 + * @param orgId 椤剁骇鍗曚綅ID + * @param status 鐘舵��: 0 姝e父锛�1 绂佺敤 + * @param roleName 鏌ヨ鐨勮鑹插悕绉� + * @return + * @date 2022-12-15 + */ + public GenericPager<S_role> queryPageRoleList(long orgId, int status, String roleName){ + Map<String, Object> parameters = new HashMap<>(); + StringBuilder sql = new StringBuilder(SQL_PAGE_ROLE_PREFIX); + parameters.put("orgId", orgId); + + if(status >= 0){ + sql.append(" and status = :status"); + parameters.put("status", status); + } + if(StringUtils.isNotEmpty(roleName)){ + sql.append(" and role_name like :roleName"); + parameters.put("roleName", "%" + roleName + "%"); + } + sql.append(" order by status asc,role_sort asc "); + PageSearch pageSearch = ListPageContext.getPageSearch(); + return this.selectSplit(sql.toString(), parameters, pageSearch.getPageIndex(), pageSearch.getPageSize(), new S_role()); + } + + /** + * 杩斿洖缁欏畾椤剁骇鏈烘瀯涓嬬殑瑙掕壊鍒楄〃銆� + * @param orgId + * @return + */ + public List<S_role> queryRoleList(long orgId){ + return this.select(SQL_ORG_ROLES, new Object[]{orgId}, new S_role()); + } + + /** + * 杩斿洖缁欏畾鐢ㄦ埛鍏锋湁鐨勮鑹� + * @param userId + * @return + */ + public List<S_role> queryUserRoleList(long userId){ + return this.select(SQL_USER_ROLES, new Object[]{userId}, new S_role()); + } + + /** + * 鏍规嵁鐢ㄦ埛id鏌ヨ鍖呭惈鐨勮鑹瞚d闆嗗悎锛屽凡缁忚繃婊ょ鐢ㄣ�佸垹闄ょ殑瑙掕壊銆� + * @param userId + * @return + * @author 鏃跺厠鑻� + * @date 2024-01-31 + * @date 2024-03-06 澧炲姞浜� 瀵� role.org_id榛樿涓�0鎴栫┖鐨勯檺瀹氥�� + */ + public List<String> queryUserRoleIdList(long userId){ + List<Map<String, Object>> data = this.select(SQL_USER_ROLES_ID, new Object[]{userId}); + if(StringUtils.isEmptyList(data)){ + return null; + } + List<String> result = new ArrayList<>(8); + for(Map<String, Object> map : data){ + result.add(map.get("role_id").toString()); + } + return result; + } + + /** + * 鏍规嵁鐢ㄦ埛id鏌ヨ鍖呭惈鐨勮鑹瞚d闆嗗悎锛屽凡缁忚繃婊ょ鐢ㄣ�佸垹闄ょ殑瑙掕壊銆� + * <p>鏍规嵁涓氬姟鏈烘瀯id锛屽啀娆¤繃婊ょ鍚堢殑瑙掕壊id</p> + * @param userId + * @param adminOrgenId + * @return + * @date 2024-03-06 + */ + public List<String> queryUserRoleIdList(long userId, long adminOrgenId){ + List<Map<String, Object>> data = this.select(SQL_USER_ROLES_ID_ORGID, new Object[]{userId, adminOrgenId}); + if(StringUtils.isEmptyList(data)){ + return null; + } + List<String> result = new ArrayList<>(8); + for(Map<String, Object> map : data){ + result.add(map.get("role_id").toString()); + } + return result; + } + + /** + * 鏍规嵁瑙掕壊ID锛屾煡璇㈠搴旂敤鎴稩D闆嗗悎銆� + * @param roleId + * @return + * @date 2023-07-31 + */ + public List<Long> queryRoleUserIdList(long roleId){ + List<Map<String, Object>> list = this.select(SQL_QUERY_ROLE_USER, new Object[]{roleId}); + if(StringUtils.isEmptyList(list)){ + return null; + } + List<Long> userIdList = new ArrayList<>(list.size()); + for(Map<String, Object> map : list){ + userIdList.add(Long.parseLong(map.get("user_id").toString())); + } + return userIdList; + } + + private static final String SQL_QUERY_ROLE_USER = "select user_id from s_role_user where role_id=?"; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/service/UserDeptApiServiceImpl.java b/iplatform-base/src/main/java/com/iplatform/base/service/UserDeptApiServiceImpl.java new file mode 100644 index 0000000..e418773 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/service/UserDeptApiServiceImpl.java @@ -0,0 +1,152 @@ +package com.iplatform.base.service; + +import com.iplatform.base.Constants; +import com.iplatform.base.DeptCacheProvider; +import com.iplatform.base.UserCacheProvider; +import com.iplatform.base.service_api.UserAndDeptServiceApi; +import com.iplatform.core.BeanContextAware; +import com.iplatform.model.po.S_dept; +import com.iplatform.model.po.S_user_core; +import com.iplatform.model.to.UserAndDeptTo; +import com.iplatform.model.to.UserAndDeptToResult; +import com.walker.infrastructure.utils.DateUtils; +import com.walker.infrastructure.utils.NumberGenerator; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.jdbc.service.BaseServiceImpl; +import com.walker.web.OrgType; +import com.walker.web.ResponseValue; +import com.walker.web.UserType; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Service; + +import java.util.List; + +@Service +public class UserDeptApiServiceImpl extends BaseServiceImpl implements UserAndDeptServiceApi { + + private final transient Logger logger = LoggerFactory.getLogger(this.getClass()); + + public Object execInsertMobileUserRegister(String phone){ + + return null; + } + + @Override + public ResponseValue execInsertTopOrgAndAdmin(UserAndDeptTo userAndDeptTo){ + if(userAndDeptTo == null + || StringUtils.isEmpty(userAndDeptTo.getDeptName()) + || StringUtils.isEmpty(userAndDeptTo.getUserName())){ + throw new IllegalArgumentException(Constants.ERROR_ARGUMENT); + } + + UserAndDeptToResult result = new UserAndDeptToResult(); + + S_dept existDept = this.existSameNameOrg(userAndDeptTo.getDeptName()); + if(existDept != null){ +// result.setMessage("椤剁骇鏈烘瀯鍚嶇О宸茬粡瀛樺湪锛屾棤娉曢噸澶嶆坊鍔�"); + // 濡傛灉涔嬪墠宸茬粡璋冪敤杩囧啓鍏ユ暟鎹紝杩欓噷浼氱洿鎺ヨ繑鍥烇紝鍥犱负鍙兘瀛樺湪缃戠粶璋冪敤鍚庣涓夋柟绯荤粺璋冪敤涓氬姟澶辫触鎯呭喌锛� + S_user_core existUser = this.existSameNameUser(userAndDeptTo.getUserName()); + if(existUser != null){ + logger.warn("宸茬粡瀛樺湪鐢ㄦ埛鍜屾満鏋勶紝鐩存帴杩斿洖锛歞eptId={}, userId={}", existDept.getId(), existUser.getId()); + result.setDeptId(existDept.getId()); + result.setUserId(existUser.getId()); + return ResponseValue.success(result); + } + return ResponseValue.error("椤剁骇鏈烘瀯鍚嶇О宸茬粡瀛樺湪锛屾棤娉曢噸澶嶆坊鍔�"); + } + + long nextOrgId = this.queryNextDeptId(); + + S_dept dept = new S_dept(); + dept.setId(nextOrgId); + dept.setOrg_id(nextOrgId); + dept.setOrg_type(OrgType.TYPE_ORG); + dept.setParent_id(0L); + dept.setAncestors("0"); + dept.setDept_name(userAndDeptTo.getDeptName()); + dept.setCreate_by(userAndDeptTo.getCreateId()); + dept.setOrder_num((int)nextOrgId); + dept.setCreate_time(DateUtils.getDateTimeNumber()); + dept.setMenu_type(userAndDeptTo.getMenuType()); + dept.setPhone(userAndDeptTo.getPhone()); + dept.setEmail(userAndDeptTo.getMail()); + this.insert(dept); + + S_user_core user = new S_user_core(); + user.setId(NumberGenerator.getLongSequenceNumber()); + user.setCreate_time(dept.getCreate_time()); + user.setCreate_by(userAndDeptTo.getCreateId()); + user.setUpdate_time(dept.getCreate_time()); + user.setDept_id(nextOrgId); + user.setOrg_id(nextOrgId); + user.setUser_name(userAndDeptTo.getUserName()); + user.setNick_name(userAndDeptTo.getNickName()); + user.setUser_type(UserType.TYPE_MERCHANT_ADMIN); + user.setPassword(userAndDeptTo.getPassword()); // 鍔犲瘑杩囩殑瀵嗙爜 + if(StringUtils.isNotEmpty(userAndDeptTo.getPhone())){ + user.setPhonenumber(userAndDeptTo.getPhone()); + } + if(StringUtils.isNotEmpty(userAndDeptTo.getMail())){ + user.setEmail(userAndDeptTo.getMail()); + } + user.setType(UserType.TYPE_MERCHANT_ADMIN); + user.setMer_id(nextOrgId); + this.insert(user); + + // 娣诲姞绯荤粺缂撳瓨 + BeanContextAware.getBeanByType(DeptCacheProvider.class).putDept(dept); + BeanContextAware.getBeanByType(UserCacheProvider.class).putUser(user); + + result.setDeptId(nextOrgId); + result.setUserId(user.getId()); + return ResponseValue.success(result); + } + + @Override + public ResponseValue execUpdateTopOrgAndAdmin(UserAndDeptTo userAndDeptTo) { + // 鏈烘瀯鍙兘淇敼杩欎簺涓嶉噸瑕佸睘鎬э紝鐢ㄦ埛涓嶄慨鏀广�� + S_dept dept = new S_dept(userAndDeptTo.getOrgId()); + dept.setDept_name(userAndDeptTo.getDeptName()); + dept.setEmail(userAndDeptTo.getMail()); + dept.setPhone(userAndDeptTo.getPhone()); + this.save(dept); + dept = this.get(new S_dept(userAndDeptTo.getOrgId())); + // 娣诲姞绯荤粺缂撳瓨 + BeanContextAware.getBeanByType(DeptCacheProvider.class).updateDept(dept); + return ResponseValue.success(); + } + + private S_user_core existSameNameUser(String loginId){ + S_user_core user = new S_user_core(); + user.setUser_name(loginId); + List<S_user_core> list = this.select(user); + if(StringUtils.isEmptyList(list)){ + return null; + } + return list.get(0); + } + + private S_dept existSameNameOrg(String name){ + S_dept dept = new S_dept(); + dept.setDept_name(name); + dept.setOrg_type(OrgType.TYPE_ORG); + List<S_dept> list = this.select(dept); + if(StringUtils.isEmptyList(list)){ + return null; + } + return list.get(0); + } + + /** + * 鑾峰緱涓嬩竴涓彲鐢ㄧ殑鏈�澶D銆� + * @return + * @date 2023-05-17 + */ + public int queryNextDeptId(){ + int maxId = this.queryForInt(SQL_MAX_DEPT_ID, new Object[]{}); + return maxId+1; + } + + private static final String SQL_MAX_DEPT_ID = "select count(id) from s_dept"; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/service/UserServiceImpl.java b/iplatform-base/src/main/java/com/iplatform/base/service/UserServiceImpl.java new file mode 100644 index 0000000..94b230f --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/service/UserServiceImpl.java @@ -0,0 +1,386 @@ +package com.iplatform.base.service; + +import com.iplatform.base.PlatformUserCallback; +import com.iplatform.base.callback.UserProfileCallback; +import com.iplatform.base.pojo.UserInfoRequest; +import com.iplatform.base.util.role.SystemRole; +import com.iplatform.model.po.S_role; +import com.iplatform.model.po.S_user_core; +import com.walker.db.page.GenericPager; +import com.walker.db.page.ListPageContext; +import com.walker.db.page.PageSearch; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.jdbc.service.BaseServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +public class UserServiceImpl extends BaseServiceImpl { + + public static final String SQL_QUERY_USER_ROLES = "select role_id from s_role_user where user_id = ?"; + public static final String SQL_QUERY_USER_LOGIN_WHERE = "where user_name = ?"; + public static final String SQL_QUERY_USER_PHONE_WHERE = "where phonenumber = ?"; + public static final String SQL_QUERY_USER_EMAIL_WHERE = "where email = ?"; + + // 2023-01-26 鍚庡彴绠$悊鐢ㄦ埛锛屼笉鍖呮嫭锛欰pp鍜岃澶囩瓑鍏朵粬鐢ㄦ埛銆� + public static final String SQL_PAGE_ORG_USER = "select * from s_user_core where user_type<99 and org_id=:orgId"; + + public static final String SQL_INSERT_ROLE_USER = "insert into s_role_user(user_id, role_id, org_id) values(?,?,0)"; + public static final String SQL_UPDATE_STATUS = "update s_user_core set status=? where id=?"; + public static final String SQL_DELETE_USER_ROLE = "delete from s_role_user where user_id=?"; + public static final String SQL_RESET_PASSWORD = "update s_user_core set password=? where id=?"; + + /** + * 鍚庡彴(褰撳墠鐢ㄦ埛)淇敼鐢ㄦ埛鍩烘湰淇℃伅锛氬鍚� + 瀵嗙爜 + * @param request + * @param userId + * @param callback 骞冲彴瀹氫箟鐨勬洿鏂板洖璋冿紝涓氬姟绯荤粺鍙互閰嶇疆涓�涓�� + * @date 2023-08-05 + */ + public void execUpdateUserInfo(UserInfoRequest request, long userId, UserProfileCallback callback){ + S_user_core userCore = new S_user_core(userId); + if(StringUtils.isNotEmpty(request.getRealName())){ + userCore.setNick_name(request.getRealName()); + } + if(StringUtils.isNotEmpty(request.getPassword())){ + userCore.setPassword(request.getPassword()); + userCore.setModify_pwd(1); + } + this.update(userCore); + if(callback != null){ + callback.onUpdateUser(userCore, request); + } + } + + /** + * 寮哄埗淇敼瀵嗙爜锛屽苟鏇存柊鐘舵�併�� + * @param userId + * @param encryptPassword + * @date 2023-08-05 + */ + public void execForceChangePassword(long userId, String encryptPassword){ + S_user_core userCore = new S_user_core(userId); + userCore.setPassword(encryptPassword); + userCore.setModify_pwd(1); // 璁剧疆涓哄凡淇敼瀵嗙爜 + this.update(userCore); + } + + public void execResetPassword(long userId, String encryptPassword){ + this.execute(SQL_RESET_PASSWORD, new Object[]{encryptPassword, userId}); + } + + /** + * 鍒犻櫎涓�涓敤鎴枫�� + * @param userId + * @date 2022-12-13 + */ + public void execDeleteUser(long userId, PlatformUserCallback platformUserCallback){ + this.execute(SQL_DELETE_USER_ROLE, new Object[]{userId}); + this.delete(new S_user_core(userId)); + if(platformUserCallback != null){ + platformUserCallback.onDeleteUser(userId); + } + } + + /** + * 鏇存柊鐢ㄦ埛鐘舵�併�� + * @param userId + * @param status + * @date 2022-12-13 + */ + public void execUpdateUserStatus(long userId, int status){ + this.execute(SQL_UPDATE_STATUS, new Object[]{status, userId}); + } + + /** + * 鍐欏叆鏂扮敤鎴疯褰曪紝濡傛灉閫夋嫨鐨勬湁瑙掕壊鍒楄〃涔熶竴璧蜂繚瀛樸�� + * @param user_core + * @param roleIds + * @date 2022-12-13 + */ + public void execSaveUser(S_user_core user_core, Long[] roleIds, PlatformUserCallback platformUserCallback){ + if(roleIds != null && roleIds.length > 0){ + for(long roleId : roleIds){ + this.execute(SQL_INSERT_ROLE_USER, new Object[]{user_core.getId(), roleId}); + } + } + this.insert(user_core); + if(platformUserCallback != null){ + platformUserCallback.onCreateNewUser(user_core); + } + } + + /** + * 缂栬緫鏇存柊鐢ㄦ埛浠ュ強鎵�灞炶鑹层�� + * @param user_core + * @param roleIds + * @date 2022-12-13 + */ + public void execUpdateUser(S_user_core user_core, Long[] roleIds, PlatformUserCallback platformUserCallback){ + /*// 鍏堝垹闄よ鑹插叧鑱斾俊鎭� + this.execute(SQL_DELETE_USER_ROLE, new Object[]{user_core.getId()}); + if(roleIds != null && roleIds.length > 0){ + for(long roleId : roleIds){ + this.execute(SQL_INSERT_ROLE_USER, new Object[]{user_core.getId(), roleId}); + } + }*/ + this.execUpdateAuthRole(user_core.getId(), roleIds); + this.save(user_core); + if(platformUserCallback != null){ + platformUserCallback.onUpdateUser(user_core); + } + } + + /** + * 鏇存柊鐢ㄦ埛褰掑睘瑙掕壊璁板綍锛屽鏋滅粰瀹氱殑瑙掕壊闆嗗悎涓虹┖锛屽垯琛ㄧず娓呴櫎瑙掕壊銆� + * @param userId 鐢ㄦ埛ID + * @param roleIds 缁欏畾瑙掕壊ID闆嗗悎锛岀┖琛ㄧず瑕佹竻闄ょ敤鎴疯鑹� + * @date 2022-12-15 + */ + public void execUpdateAuthRole(long userId, Long[] roleIds){ + // 鍏堝垹闄よ鑹插叧鑱斾俊鎭� + this.execute(SQL_DELETE_USER_ROLE, new Object[]{userId}); + if(roleIds != null && roleIds.length > 0){ + for(long roleId : roleIds){ + this.execute(SQL_INSERT_ROLE_USER, new Object[]{userId, roleId}); + } + } + } + + /** + * 鏍规嵁閭鏌ヨ鐢ㄦ埛鏄惁瀛樺湪锛屽鏋滃瓨鍦ㄩ偖绠卞瓨鍦ㄧ殑璇濄�� + * @param email + * @return + * @date 2022-12-13 + */ + public S_user_core queryUserByEmail(String email){ + List<S_user_core> list = this.select(new S_user_core(), SQL_QUERY_USER_EMAIL_WHERE, new Object[]{email}); + if(StringUtils.isEmptyList(list)){ + return null; + } + return list.get(0); + } + + /** + * 鏍规嵁鎵嬫満鍙锋煡璇㈢敤鎴锋槸鍚﹀瓨鍦紝濡傛灉瀛樺湪鎵嬫満鍙风殑璇濄�� + * @param phoneNumber + * @return + * @date 2022-12-13 + */ + public S_user_core queryUserByPhone(String phoneNumber){ + List<S_user_core> list = this.select(new S_user_core(), SQL_QUERY_USER_PHONE_WHERE, new Object[]{phoneNumber}); + if(StringUtils.isEmptyList(list)){ + return null; + } + return list.get(0); + } + + /** + * 鏍规嵁鐧诲綍ID鏌ヨ鐢ㄦ埛瀵硅薄銆� + * @param loginId + * @return + * @date 2022-12-13 + */ + public S_user_core queryUserByLoginId(String loginId){ + List<S_user_core> list = this.select(new S_user_core(), SQL_QUERY_USER_LOGIN_WHERE, new Object[]{loginId}); + if(StringUtils.isEmptyList(list)){ + return null; + } + return list.get(0); + } + + /** + * 鍒嗛〉鏌ヨ鐢ㄦ埛鍒楄〃銆� + * @param orgId 椤剁骇鏈烘瀯ID锛屽繀濉� + * @param deptId 閫夋嫨鐨勯儴闂↖D锛屽彲閫� + * @param loginId 鐧诲綍鐢ㄦ埛ID + * @param phoneNumber 鎵嬫満鍙� + * @param status 鐘舵�� + * @return + * @date 2022-12-12 + */ + public GenericPager<S_user_core> queryPageUserList(long orgId + , long deptId, String loginId, String phoneNumber, int status){ + Map<String, Object> parameters = new HashMap<>(); + StringBuilder sql = new StringBuilder(SQL_PAGE_ORG_USER); + parameters.put("orgId", orgId); + + if(deptId > 0){ + sql.append(" and dept_id = :deptId"); + parameters.put("deptId", deptId); + } + if(StringUtils.isNotEmpty(loginId)){ + sql.append(" and user_name = :userName"); + parameters.put("userName", loginId); + } + if(StringUtils.isNotEmpty(phoneNumber)){ + sql.append(" and phonenumber like :phoneNumber"); + parameters.put("phoneNumber", "%" + phoneNumber + "%"); + } + if(status >= 0){ + sql.append(" and status=:status"); + parameters.put("status", status); + } + PageSearch pageSearch = ListPageContext.getPageSearch(); + return this.selectSplit(sql.toString(), parameters, pageSearch.getPageIndex(), pageSearch.getPageSize(), new S_user_core()); + } + + /** + * 鏍规嵁鐢ㄦ埛鐧诲綍ID锛屾煡璇㈢敤鎴蜂俊鎭互鍙婂寘鍚殑瑙掕壊ID闆嗗悎銆� + * @param loginId + * @param isPhone 鏄惁鎵嬫満鍙� + * @return 杩斿洖鏁扮粍锛寀serInfo[0] = S_user_core, userInfo[1] = roleIdList + * @date 2022-11-06 + * @date 2023-06-28 澧炲姞瀵规墜鏈哄彿鐧诲綍鏀寔锛屾坊鍔犲弬鏁帮細isPhone + */ + public Object[] queryLoginUser(String loginId, boolean isPhone){ +// this.queryForObject(SQL_QUERY_USER_LOGIN, new Object[]{loginId}, S_user_core.class); + List<S_user_core> list = null; + if(isPhone){ + list = this.select(new S_user_core(), SQL_QUERY_USER_PHONE_WHERE, new Object[]{loginId}); + } else { + list = this.select(new S_user_core(), SQL_QUERY_USER_LOGIN_WHERE, new Object[]{loginId}); + } + if(StringUtils.isEmptyList(list)){ + return null; + } + Object[] userInfo = new Object[2]; + S_user_core userCore = list.get(0); + List<String> roleIdList = this.queryUserRoleIdList(userCore.getId()); + userInfo[0] = userCore; + userInfo[1] = roleIdList; + return userInfo; + } + + /** + * 杩斿洖鐧诲綍鐢ㄦ埛瀵硅薄 + * @param loginId 鐧诲綍ID + * @return + * @date 2023-01-26 App鐧诲綍鏃朵粎鏌ヨ鐢ㄦ埛锛屼笉瑕佽鑹蹭俊鎭�� + */ + public S_user_core queryLoginUserOnly(String loginId){ + List<S_user_core> list = this.select(new S_user_core(), SQL_QUERY_USER_LOGIN_WHERE, new Object[]{loginId}); + if(StringUtils.isEmptyList(list)){ + return null; + } + return list.get(0); + } + + private static final String SQL_USER_DATASCOPE_MENU_LIST = "select DISTINCT(menu_id) from s_role_menu where role_id in (:roleIds) and menu_id like 'data_scope,%'"; + + /** + * 杩斿洖鐢ㄦ埛鍖呭惈鐨勮彍鍗曟暟鎹潈闄愰泦鍚堛�� + * @param roleIds 鐢ㄦ埛鍏锋湁鐨勮鑹睮D闆嗗悎 + * @return 杩斿洖鏉冮檺闆嗗悎锛屽嵆:menu_id list + * @date 2022-12-21 + */ + public List<String> queryUserDataScopeMenuIdList(List<String> roleIds){ + Map<String, Object> parameters = new HashMap<>(2); + parameters.put("roleIds", roleIds); + List<Map<String, Object>> list = this.select(SQL_USER_DATASCOPE_MENU_LIST, parameters); + if(StringUtils.isEmptyList(list)){ + return null; + } + List<String> menuIdList = new ArrayList<>(8); + for(Map<String, Object> map : list){ + menuIdList.add(map.get("menu_id").toString()); + } + return menuIdList; + } + + /** + * 鏌ヨ缁欏畾鐢ㄦ埛鎵�灞炵殑瑙掕壊ID闆嗗悎锛岃鑹睮D涓嶄細閲嶅銆� + * @param userId + * @return + * @date 2022-11-06 + * @date 2024-01-19 搴熷純锛岃浣跨敤鏂规硶锛� + */ + @Deprecated + public List<String> queryUserRoleIdList(long userId){ + List<Map<String, Object>> list = this.select(SQL_QUERY_USER_ROLES, new Object[]{userId}); + if(StringUtils.isEmptyList(list)){ + return null; + } + List<String> roleIdList = new ArrayList<>(4); + for(Map<String, Object> m : list){ + roleIdList.add(m.get("role_id").toString()); + } + return roleIdList; + } + + /** + * 鏌ヨ缁欏畾鐢ㄦ埛鎵�灞炵殑瑙掕壊ID闆嗗悎锛岃鑹睮D涓嶄細閲嶅銆� + * @param userId + * @param type 0 鍏ㄧ綉绫诲瀷瑙掕壊锛�1 鍩哄湴绫诲瀷瑙掕壊锛�2 鍏ㄧ綉+鍩哄湴瑙掕壊锛�9 鍏朵粬鍊煎垯涓哄搴斿�艰鑹� + * @return + * @date 2024-01-19 + */ + public List<String> queryUserRoleIdList(long userId, int type){ + List<Map<String, Object>> data = this.sqlQueryListMap(SQL_LOAD_USER_ROLE, new Object[]{userId}); + if(StringUtils.isEmptyList(data)){ + return null; + } + List<String> roleIdList = new ArrayList<>(8); + int typeInRole = -1; + for(Map<String, Object> d : data){ + typeInRole = Integer.parseInt(d.get("type").toString()); + if(typeInRole == type){ + roleIdList.add(d.get("role_id").toString()); + } + } + return roleIdList; + } + + private static final String SQL_LOAD_USER_ROLE = "select r.role_id, r.role_name, r.type from s_role_user ru LEFT JOIN s_role r ON ru.role_id=r.role_id where ru.user_id=? and r.status=0 and r.del_flag=0"; + + /** + * 杩斿洖鐢ㄦ埛鎺堟潈瑙掕壊鍒楄〃锛岃鍒楄〃鍖呭惈鐙珛鍗曚綅涓嬫墍鏈夎鑹诧紝鍦ㄧ晫闈笂灞曠ず鍝簺鎺堟潈琚�変腑銆� + * @param orgId 椤剁骇鏈烘瀯ID + * @param userId 鐢ㄦ埛ID + * @return + * @date 2022-12-15 + */ + public List<SystemRole> queryAuthRoleList(long orgId, long userId){ + List<S_role> orgRoleList = this.select(SQL_ORG_ROLES, new Object[]{orgId}, new S_role()); + if(StringUtils.isEmptyList(orgRoleList)){ + return null; + } + List<SystemRole> systemRoleList = new ArrayList<>(8); + List<String> userRoleIdList = this.queryUserRoleIdList(userId); + if(!StringUtils.isEmptyList(userRoleIdList)){ + SystemRole systemRole = null; + for(S_role role : orgRoleList){ + systemRole = new SystemRole(role); + if(userRoleIdList.contains(String.valueOf(role.getRole_id()))){ + systemRole.setFlag(true); + } + systemRoleList.add(systemRole); + } + } else { + // 鐢ㄦ埛娌℃湁褰掑睘瑙掕壊锛岄渶瑕佹妸鏈烘瀯涓嬫墍鏈夎鑹插睍绀哄嚭鏉� + for(S_role role : orgRoleList){ + systemRoleList.add(new SystemRole(role)); + } + } + return systemRoleList; + } + + private static final String SQL_ORG_ROLES = "select * from s_role where org_id=? and status=0 and del_flag=0"; + + /** + * 鏍规嵁鐢ㄦ埛ID杩斿洖鎵�灞炶鑹插璞¢泦鍚堛�� + * @param userId + * @return + * @date 2022-12-13 + */ + @Deprecated + public List<S_role> queryUserRoleList(long userId){ + return this.select(SQL_USER_ROLE_lIST, new Object[]{userId}, new S_role()); + } + + private static final String SQL_USER_ROLE_lIST = "select r.* from s_role_user ru, s_role r where ru.user_id=? and ru.role_id=r.role_id"; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/service_api/UserAndDeptServiceApi.java b/iplatform-base/src/main/java/com/iplatform/base/service_api/UserAndDeptServiceApi.java new file mode 100644 index 0000000..d90dcec --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/service_api/UserAndDeptServiceApi.java @@ -0,0 +1,27 @@ +package com.iplatform.base.service_api; + +import com.iplatform.model.to.UserAndDeptTo; +import com.iplatform.model.to.UserAndDeptToResult; +import com.walker.web.ResponseValue; + +/** + * 绯荤粺鐢ㄦ埛鏈烘瀯鏈嶅姟鎺ュ彛瀹氫箟銆�<p></p> + * 1.璇ユ帴鍙e湪妯″潡鍐呴儴浣跨敤锛岀敤鏉ヨ鑼冨鏈烘瀯銆佺敤鎴风殑鍚勭鎿嶄綔鏈嶅姟鐨勭粺涓�鎬э紱 + * 2.涓哄悗缁叾浠栨ā鍧楄繙绋嬭皟鐢紙鎴栨ā鍧楄皟鐢級鎻愪緵鍩虹鏀寔銆� + * @author 鏃跺厠鑻� + * @date 2023-06-06 + */ +public interface UserAndDeptServiceApi { + + /** + * 娣诲姞鏂扮殑椤剁骇鏈烘瀯鍜屾満鏋勯粯璁ょ鐞嗗憳銆� + * <p>鐩墠鍦ㄧ數鍟嗙郴缁熶腑锛屽晢鎴锋ā鍧楄皟鐢ㄨ鎺ュ彛瀹炵幇銆�</p> + * @param userAndDeptTo 鎻愪氦鐨勬満鏋勪汉鍛樺璞� +// * @param createId 鍒涘缓浜篒D瀛楃涓� + * @return + * @date 2023-06-06 + */ + ResponseValue execInsertTopOrgAndAdmin(UserAndDeptTo userAndDeptTo); + + ResponseValue execUpdateTopOrgAndAdmin(UserAndDeptTo userAndDeptTo); +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/support/CtomsDataSource.java b/iplatform-base/src/main/java/com/iplatform/base/support/CtomsDataSource.java new file mode 100644 index 0000000..6c83968 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/support/CtomsDataSource.java @@ -0,0 +1,167 @@ +package com.iplatform.base.support; + +import com.alibaba.druid.pool.DruidDataSource; +import com.walker.db.DatabaseType; +import com.walker.infrastructure.ApplicationRuntimeException; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.jdbc.Constants; +import com.walker.jdbc.DataSourceMeta; +import com.walker.jdbc.util.TextUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 鍖呰闃块噷 <code>DruidDataSource</code> 鏁版嵁婧愶紝褰㈡垚鑷繁鐨勭被鍨嬶紝闅旂渚濊禆銆� + * @author 鏃跺厠鑻� + * @date 2023-03-15 + */ +@Deprecated +public class CtomsDataSource extends DruidDataSource implements DataSourceMeta { + + protected final transient Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Override + public DatabaseType getDatabaseType() { + return this.databaseType; + } + + @Override + public String getDatabaseName() { + return this.databaseName; + } + + @Override + public String getIp() { + return this.ip; + } + + @Override + public int getPort() { + return this.port; + } + + @Override + public String getUsername() { + return username; + } + @Override + public String getPassword() { + return password; + } + @Override + public String getUrl() { + return this.jdbcUrl; + } + + @Override + public void setPassword(String password) { + this.password = password; + } + @Override + public void setUsername(String username) { + this.username = username; + } + + /** + * 閲嶅啓druid璁剧疆url鏂规硶锛屽垵濮嬪寲鏁版嵁婧愩�� + * @param jdbcUrl + * @date 2023-03-15 + */ + @Override + public void setUrl(String jdbcUrl) { + super.setUrl(jdbcUrl); + logger.info("jdbcUrl = " + jdbcUrl); + + // 瑙f瀽ip銆佺鍙c�佹暟鎹簱鍚嶇О + String[] ipAndPortAndService = TextUtils.parseIpAndPortFromUrl(jdbcUrl); + if(ipAndPortAndService != null){ + this.ip = ipAndPortAndService[0]; + this.port = Integer.parseInt(ipAndPortAndService[1]); + this.databaseName = ipAndPortAndService[2]; + } + + String[] values = jdbcUrl.split(StringUtils.SEPARATOR_COLON); + if(values == null || values.length <=1){ + throw new ApplicationRuntimeException("DataSource set jdbcUrl error: " + jdbcUrl); + } + + for(String v : values){ + if(v.equalsIgnoreCase(DatabaseType.NAME_MYSQL)){ + this.databaseType = DatabaseType.MYSQL; + return; + } else if(v.equalsIgnoreCase(DatabaseType.NAME_ORACLE)){ + this.databaseType = DatabaseType.ORACLE; + return; + } else if(v.equalsIgnoreCase(DatabaseType.NAME_POSTGRES) || v.equalsIgnoreCase(DatabaseType.NAME_POSTGRESQL)){ + this.databaseType = DatabaseType.POSTGRES; + return; + } else if(v.equalsIgnoreCase(DatabaseType.NAME_SQLITE)){ + this.databaseType = DatabaseType.SQLITE; + return; + } else if(v.equalsIgnoreCase(DatabaseType.NAME_DAMENG)){ + this.databaseType = DatabaseType.DAMENG; + return; + } else { + // + } + } + + if(this.databaseType == null){ + throw new UnsupportedOperationException("涓嶆敮鎸佺殑鏁版嵁搴揢RL鍙傛暟锛�" + jdbcUrl); + } + logger.info("鏁版嵁搴撶被鍨嬶細" + this.databaseType.name()); + } + + /** + * 閲嶅啓druid璁剧疆url鏂规硶锛屽垵濮嬪寲鏁版嵁婧愩�� + * @param driverClassName + * @date 2023-03-15 + */ + @Override + public void setDriverClassName(String driverClassName){ + super.setDriverClassName(driverClassName); + logger.debug("driverClassName = " + driverClassName); + } + + private DatabaseType databaseType = null; + private String username; + private String password; + private String databaseName; + + //============================================================================================= + // 浠ヤ笅浠g爜鐢ㄤ簬鎵嬪姩鍒涘缓鐙珛鏁版嵁婧愪娇鐢紝姣斿锛氶噰闆嗘ā鍧楀姩鎬佸垱寤�: DatabaseConnector锛�2022-09-09锛屾椂鍏嬭嫳 + //============================================================================================= + + protected String ip; + protected int port = 0; + + public void setIp(String ip) { + assert (StringUtils.isNotEmpty(ip)); + this.ip = ip; + } + + public void setPort(int port) { + assert(port > 0 && port < Integer.MAX_VALUE); + this.port = port; + } + + public void setDatabaseType(int databaseTypeValue) { + this.databaseType = DatabaseType.getType(databaseTypeValue); + String driverName = Constants.getDriverClassName(this.databaseType); + this.setDriverClassName(driverName); + } + + public void setDatabaseName(String databaseName) { + if(StringUtils.isEmpty(databaseName)){ + throw new IllegalArgumentException("databaseName 蹇呴』濉啓!"); + } + if(databaseType == null){ + throw new IllegalArgumentException("databaseType must be set firstly!"); + } + if(databaseType != DatabaseType.DERBY && StringUtils.isEmpty(ip)){ + throw new IllegalArgumentException("ip or port must be set firstly!"); + } + String url = Constants.getJdbcUrl(this.databaseType, databaseName, this.ip, this.port); + this.setUrl(url); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/support/DatabaseArgumentsManager.java b/iplatform-base/src/main/java/com/iplatform/base/support/DatabaseArgumentsManager.java new file mode 100644 index 0000000..aab363a --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/support/DatabaseArgumentsManager.java @@ -0,0 +1,116 @@ +package com.iplatform.base.support; + +import com.iplatform.base.Constants; +import com.iplatform.base.service.ConfigArgumentServiceImpl; +import com.iplatform.base.util.ArgumentsManagerUtils; +import com.iplatform.core.SimpleVariable; +import com.iplatform.model.po.S_config; +import com.walker.cache.AbstractCacheProvider; +import com.walker.cache.Cache; +import com.walker.infrastructure.arguments.ArgumentsManager; +import com.walker.infrastructure.arguments.Group; +import com.walker.infrastructure.arguments.Variable; +import com.walker.infrastructure.arguments.VariableType; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.security.SystemLogMan; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 鍩轰簬鍐呭瓨瀹炵幇鐨勫彲鍙樺弬鏁扮鐞嗗櫒瀹炵幇銆� + * @author 鏃跺厠鑻� + * @date 2022-11-29 + */ +public class DatabaseArgumentsManager extends AbstractCacheProvider<Variable> implements ArgumentsManager { + + private ConfigArgumentServiceImpl configArgumentService = null; + + // 2023-05-16锛屾寜鐓ormId鍒嗙粍閰嶇疆闆嗗悎 + private Map<String, List<Variable>> formGroupReference = new HashMap<>(); + + public void setConfigArgumentService(ConfigArgumentServiceImpl configArgumentService) { + this.configArgumentService = configArgumentService; + SystemLogMan.getInstance().checkMan(); + } + + @Override + protected int loadDataToCache(Cache cache) { + List<S_config> hosts = this.configArgumentService.selectAll(new S_config()); + if(!StringUtils.isEmptyList(hosts)){ + Variable variable = null; + List<Variable> groupList = null; + for(S_config h : hosts){ +// cache.put(String.valueOf(h.getId()), h); + variable = ArgumentsManagerUtils.toVariable(h.getConfig_key(), h.getConfig_value(), h.getData_type()); + cache.put(String.valueOf(h.getConfig_key()), variable); + + // 2023-05-16 + groupList = this.formGroupReference.get(String.valueOf(h.getForm_id())); + if(groupList == null){ + groupList = new ArrayList<>(8); + this.formGroupReference.put(String.valueOf(h.getForm_id()), groupList); + } + groupList.add(variable); + } + return hosts.size(); + } + return 0; + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_ARGUMENTS; + } + + @Override + public Class<?> getProviderType() { + return Variable.class; + } + + @Override + public Variable getVariable(String id) { + return this.getCacheData(id); + } + + @Override + public void persist(String variableId, Object value) { + SimpleVariable variable = ArgumentsManagerUtils.toVariable(variableId, value.toString(), VariableType.DEF_STRING); + this.updateCacheData(variableId, variable); + } + + @Override + public void persist(String groupId, String variableId, Object value) { + this.persist(variableId, value); + } + + @Override + public void persist(List<Object[]> changedList) { + throw new UnsupportedOperationException("鏈疄鐜颁唬鐮�"); + } + + @Override + public void insert(List<Object[]> insertList) { + throw new UnsupportedOperationException("鏈疄鐜颁唬鐮�"); + } + + @Override + public List<Group> getGroupList() { + throw new UnsupportedOperationException("鏈疄鐜颁唬鐮�"); + } + + @Override + public List<Variable> getVariableList(String groupId) { +// List<S_config> configList = this.configArgumentService.queryGroupConfigList(groupId); +// return ArgumentsManagerUtils.acquireGroupVariableList(configList); + // 浣跨敤鏂版満鍒讹紝鏍规嵁formId杩斿洖鍒嗙粍鍙傛暟闆嗗悎銆� + return this.formGroupReference.get(groupId); + } + + @Override + public void setSource(Object source) { + + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/support/DeptTreeGenerator.java b/iplatform-base/src/main/java/com/iplatform/base/support/DeptTreeGenerator.java new file mode 100644 index 0000000..e0f8790 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/support/DeptTreeGenerator.java @@ -0,0 +1,24 @@ +package com.iplatform.base.support; + +import com.iplatform.model.po.S_dept; +import com.walker.infrastructure.tree.AbstractTreeGenerator; +import com.walker.infrastructure.tree.TreeNode; + +/** + * 缁勭粐鏈烘瀯鏍戠敓鎴愬櫒瀹炵幇銆�<p></p> + * 鍓嶇VUE缁勪欢闇�瑕佹爲鏈烘瀯瀵硅薄銆� + * @date 2022-12-08 + */ +public class DeptTreeGenerator extends AbstractTreeGenerator<S_dept> { + + public DeptTreeGenerator(String dummyRootName){ + super(dummyRootName); + this.setMultiRoot(true); + } + + @Override + protected TreeNode toTreeNode(S_dept entity) { + TreeNode treeNode = new TreeNode(entity.getId(), entity.getDept_name(), null, entity.getParent_id()); + return treeNode; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/support/DictTreeGenerator.java b/iplatform-base/src/main/java/com/iplatform/base/support/DictTreeGenerator.java new file mode 100644 index 0000000..7e3a18f --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/support/DictTreeGenerator.java @@ -0,0 +1,24 @@ +package com.iplatform.base.support; + +import com.iplatform.model.po.S_dict_data; +import com.walker.infrastructure.tree.AbstractTreeGenerator; +import com.walker.infrastructure.tree.TreeNode; + +/** + * 鍩轰簬'鏁版嵁瀛楀吀'鏍戠粨鏋勭敓鎴愬櫒瀵硅薄锛屽墠绔疺UE缁勪欢闇�瑕佹爲瀵硅薄銆� + * @author 鏃跺厠鑻� + * @date 2023-03-13 + */ +public class DictTreeGenerator extends AbstractTreeGenerator<S_dict_data> { + + public DictTreeGenerator(String dummyRootName) { + super(dummyRootName); + this.setMultiRoot(true); // 鏀寔澶氫釜鏍硅妭鐐� + } + + @Override + protected TreeNode toTreeNode(S_dict_data entity) { + TreeNode treeNode = new TreeNode(entity.getDict_code(), entity.getDict_label(), null, entity.getParent_id()); + return treeNode; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/support/LoadBalanceFileOperateSpi.java b/iplatform-base/src/main/java/com/iplatform/base/support/LoadBalanceFileOperateSpi.java new file mode 100644 index 0000000..bb14f8b --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/support/LoadBalanceFileOperateSpi.java @@ -0,0 +1,103 @@ +package com.iplatform.base.support; + +import com.iplatform.base.FileOperateSpi; +import com.walker.file.FileInfo; +import com.walker.file.FileStoreType; + +import java.io.InputStream; +import java.util.List; + +/** + * 鍩轰簬寰湇鍔�(璐熻浇闆嗙兢)瀹炵幇鐨勬枃浠舵搷浣滄彁渚涜�呭疄鐜般��<p></p> + * 1.杩欏彧鏄竴涓祴璇曪紝鍏蜂綋闇�姹傝鏍规嵁鎯呭喌瀹炵幇銆�<br> + * 2.褰撳墠绯荤粺鎻愪緵榛樿瀹炵幇鏀寔: FTP 鍜� 鏈湴纾佺洏鏂囦欢 + * @author 鏃跺厠鑻� + * @date 2023-02-15 + */ +public class LoadBalanceFileOperateSpi implements FileOperateSpi { + + @Override + public byte[] downloadOssFile(String id) { + return new byte[0]; + } + + @Override + public String clearCdnPrefix(String path) { + return null; + } + + @Override + public String getCdnUrl() { + return null; + } + + @Override + public FileInfo uploadFileToLocal(InputStream inputStream, String fileName, String groupId, long fileSize, Integer businessType, String owner) throws Exception { + return null; + } + + @Override + public FileInfo[] uploadFileToLocal(InputStream[] inputStream, String[] fileName, String groupId, long[] fileSize, Integer businessType, String owner) throws Exception { + return new FileInfo[0]; + } + + @Override + public FileInfo uploadFileToFtp(InputStream inputStream, String fileName, String groupId, long fileSize, Integer businessType, String owner) throws Exception { + return null; + } + + @Override + public FileInfo[] uploadFileToFtp(InputStream[] inputStream, String[] fileName, String groupId, long[] fileSize, Integer businessType, String owner) throws Exception { + return new FileInfo[0]; + } + + @Override + public FileInfo uploadFileToOss(InputStream inputStream, String fileName, String groupId, long fileSize, Integer businessType, String owner, FileStoreType ossType) throws Exception { + return null; + } + + @Override + public FileInfo[] uploadFileToOss(InputStream[] inputStream, String[] fileName, String groupId, long[] fileSize, Integer businessType, String owner, FileStoreType ossType) throws Exception { + return new FileInfo[0]; + } + + @Override + public FileInfo uploadFileToSystem(InputStream inputStream, String fileName, String groupId, long fileSize) throws Exception { + return null; + } + + @Override + public FileInfo uploadFileToFtp(InputStream inputStream, String fileName, String groupId, long fileSize) throws Exception { + return null; + } + + @Override + public FileInfo getFileInfo(long id) { + return null; + } + + @Override + public List<FileInfo> getFileInfoList(List<String> ids) { + return null; + } + + @Override + public String getFileRootConfig() { + return null; + } + + @Override + public boolean isRemoteAsLocal() { + return false; + } + + @Override + public FileStoreType getOssFileStoreType() { + return null; + } + + @Override + public String getOssPrefix() { + return null; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/support/LogAspect.java b/iplatform-base/src/main/java/com/iplatform/base/support/LogAspect.java new file mode 100644 index 0000000..eb9d483 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/support/LogAspect.java @@ -0,0 +1,233 @@ +package com.iplatform.base.support; + +import com.iplatform.base.AsyncManager; +import com.iplatform.base.SecuritySpi; +import com.iplatform.base.service.LogServiceImpl; +import com.iplatform.model.po.S_oper_log; +import com.iplatform.model.po.S_user_core; +import com.walker.infrastructure.utils.JsonUtils; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.web.Constants; +import com.walker.web.ResponseCode; +import com.walker.web.log.BusinessType; +import com.walker.web.log.Log; +import com.walker.web.util.IpUtils; +import com.walker.web.util.ServletUtils; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import org.aspectj.lang.JoinPoint; +import org.aspectj.lang.annotation.AfterReturning; +import org.aspectj.lang.annotation.AfterThrowing; +import org.aspectj.lang.annotation.Aspect; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.validation.BindingResult; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.servlet.HandlerMapping; + +import java.util.Collection; +import java.util.Map; +import java.util.TimerTask; + +/** + * 鎿嶄綔鏃ュ織鍒囬潰瀵硅薄瀹氫箟銆�<p></p> + * <pre> + * 1)涓氬姟鍦ㄨ嚜宸辩殑璋冪敤鏂规硶涓婃坊鍔犳敞瑙e嵆鍙嚜鍔ㄥ畬鎴愭搷浣滄棩蹇楄褰� + * 2)娉ㄨВ绀轰緥: + * @Log(title = "鐢ㄦ埛绠$悊", businessType = BusinessType.Insert, isSaveRequestData = true, isSaveResponseData = false) + * </pre> + * @date 2023-01-06 + */ +@Aspect +public class LogAspect { + + protected final transient Logger logger = LoggerFactory.getLogger(this.getClass()); + + private static final int MAX_DATA_SIZE = 2000; + private static final int MAX_ERROR_SIZE = com.iplatform.base.Constants.LOG_ERROR_MAX_SIZE; + + private SecuritySpi securitySpi; + private LogServiceImpl logService; + private boolean enableLog = true; + + /** + * 閰嶇疆鏄惁鎵撳紑鎴栧叧闂棩蹇楀啓鍏ャ�� + * @param enableLog + */ + public void setEnableLog(boolean enableLog) { + this.enableLog = enableLog; + } + + public void setLogService(LogServiceImpl logService) { + this.logService = logService; + } + + public void setSecuritySpi(SecuritySpi securitySpi) { + this.securitySpi = securitySpi; + } + + /** + * 澶勭悊瀹岃姹傚悗鎵ц + * @param joinPoint 鍒囩偣 + */ + @AfterReturning(pointcut = "@annotation(logAnnotation)", returning = "jsonResult") + public void doAfterReturning(JoinPoint joinPoint, Log logAnnotation, Object jsonResult) { + if(this.enableLog){ + handleLog(joinPoint, logAnnotation, null, jsonResult); + } + } + + /** + * 鎷︽埅寮傚父鎿嶄綔 + * @param joinPoint 鍒囩偣 + * @param e 寮傚父 + */ + @AfterThrowing(value = "@annotation(logAnnotation)", throwing = "e") + public void doAfterThrowing(JoinPoint joinPoint, Log logAnnotation, Exception e) { + if(this.enableLog){ + handleLog(joinPoint, logAnnotation, e, null); + } + } + + private void handleLog(final JoinPoint joinPoint, Log logAnnotation, final Exception e, Object jsonResult){ + try{ + S_oper_log s_oper_log = new S_oper_log(); + S_user_core user_core = this.securitySpi.getCurrentUser(); + if(user_core != null){ + s_oper_log.setOper_name(user_core.getUser_name()); + } + if(e == null){ + s_oper_log.setStatus(ResponseCode.SUCCESS.getCode()); + } else { + s_oper_log.setStatus(ResponseCode.ERROR.getCode()); + s_oper_log.setError_msg(StringUtils.substring(e.getMessage(), 0, MAX_ERROR_SIZE)); + } + + String requestMethod = ServletUtils.getRequest().getMethod(); + String ip = IpUtils.getIpAddr(ServletUtils.getRequest()); + s_oper_log.setOper_ip(ip); + s_oper_log.setOper_url(ServletUtils.getRequest().getRequestURI()); + // 璁剧疆鏂规硶鍚嶇О + String className = joinPoint.getTarget().getClass().getName(); + String methodName = joinPoint.getSignature().getName(); + s_oper_log.setMethod(className + "." + methodName); + s_oper_log.setRequest_method(requestMethod); + s_oper_log.setOper_location(StringUtils.EMPTY_STRING); + s_oper_log.setTitle(logAnnotation.title()); + s_oper_log.setOperate_user(logAnnotation.operatorType().getIndex()); + + // + BusinessType businessType = logAnnotation.businessType(); + s_oper_log.setBusiness_type(businessType.getIndex()); + + if(logAnnotation.isSaveRequestData() && businessType.isSaveRequest()){ + // 鍙湁寮�鍙戣缃敞瑙d互鍙婁笟鍔$被鍨嬮兘鍏佽淇濆瓨鏃舵墠鐪熸淇濆瓨鏁版嵁 + if(requestMethod.equals(Constants.HTTP_METHOD_POST) || requestMethod.equals(Constants.HTTP_METHOD_PUT)){ + String params = argsArrayToString(joinPoint.getArgs()); + if(StringUtils.isNotEmpty(params)){ + s_oper_log.setOper_param(params); + } + } else { + String queryString = ServletUtils.getRequest().getQueryString(); + if(StringUtils.isEmpty(queryString)){ + Map<?, ?> paramsMap = (Map<?, ?>) ServletUtils.getRequest().getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE); + if(paramsMap != null){ + queryString = paramsMap.toString(); + } + } +// Object param2 = ServletUtils.getRequest().getAttribute(HandlerMapping.MATRIX_VARIABLES_ATTRIBUTE); +// Object param3 = ServletUtils.getRequest().getAttribute(HandlerMapping.PRODUCIBLE_MEDIA_TYPES_ATTRIBUTE); +// logger.debug(queryString); +// logger.debug("param2 = {}", param2); +// logger.debug("param3 = {}", param3); + if(StringUtils.isNotEmpty(queryString)){ + if(queryString.length() > MAX_DATA_SIZE){ + s_oper_log.setOper_param(StringUtils.substring(queryString, 0, MAX_DATA_SIZE)); + } else { + s_oper_log.setOper_param(queryString); + } + } + } + } + if(logAnnotation.isSaveResponseData() && businessType.isSaveResponse()){ + // 鍙湁寮�鍙戣缃敞瑙d互鍙婁笟鍔$被鍨嬮兘鍏佽淇濆瓨鏃舵墠鐪熸淇濆瓨鏁版嵁 + if(jsonResult != null){ + String res = JsonUtils.objectToJsonString(jsonResult); + if(StringUtils.isNotEmpty(res)){ + s_oper_log.setJson_result(StringUtils.substring(res, 0, MAX_DATA_SIZE)); + } + } + } + + AsyncManager.me().execute(this.acquireOperateLogTask(s_oper_log)); + + }catch (Exception ex){ + if(logger.isDebugEnabled()){ + logger.error(ERROR_LOG, ex); + } else { + logger.error(ERROR_LOG + ex.getMessage()); + } + } + } + + private String argsArrayToString(Object[] paramsArray){ + try { + StringBuilder sb = new StringBuilder(); + if (paramsArray != null && paramsArray.length > 0){ + for (Object o : paramsArray){ + if(o == null){ + continue; + } + if(!this.isFilterObject(o)){ + sb.append(JsonUtils.objectToJsonString(o)).append(StringUtils.SEPARATOR_SEMI_COLON); + } + } + } + return sb.toString(); + } catch (Exception e){ + return StringUtils.EMPTY_STRING; + } + } + + /** + * 鍒ゆ柇鏄惁闇�瑕佽繃婊ょ殑瀵硅薄銆� + * + * @param o 瀵硅薄淇℃伅銆� + * @return 濡傛灉鏄渶瑕佽繃婊ょ殑瀵硅薄锛屽垯杩斿洖true锛涘惁鍒欒繑鍥瀎alse銆� + */ + private boolean isFilterObject(final Object o) + { + Class<?> clazz = o.getClass(); + if (clazz.isArray()) { + return clazz.getComponentType().isAssignableFrom(MultipartFile.class); + } + else if (Collection.class.isAssignableFrom(clazz)) { + Collection collection = (Collection) o; + for (Object value : collection) { + return value instanceof MultipartFile; + } + } + else if (Map.class.isAssignableFrom(clazz)) { + Map map = (Map) o; + for (Object value : map.entrySet()) { + Map.Entry entry = (Map.Entry) value; + return entry.getValue() instanceof MultipartFile; + } + } + return o instanceof MultipartFile || o instanceof HttpServletRequest || o instanceof HttpServletResponse + || o instanceof BindingResult; + } + + private TimerTask acquireOperateLogTask(S_oper_log s_oper_log){ + return new TimerTask() { + @Override + public void run() { +// s_oper_log.setOper_time(DateUtils.getDateTimeNumber(System.currentTimeMillis())); +// s_oper_log.setOper_id(NumberGenerator.getLongSequenceNumber()); + logService.execInsertOperateLog(s_oper_log); + } + }; + } + + private static final String ERROR_LOG = "鏃ュ織鍒囬潰璁板綍寮傚父:"; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/support/NothingSecuritySpi.java b/iplatform-base/src/main/java/com/iplatform/base/support/NothingSecuritySpi.java new file mode 100644 index 0000000..5643bab --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/support/NothingSecuritySpi.java @@ -0,0 +1,65 @@ +package com.iplatform.base.support; + +import com.iplatform.base.SecuritySpi; +import com.iplatform.base.exception.LoginException; +import com.iplatform.base.pojo.RequestLogin; +import com.iplatform.model.po.S_user_core; +import com.walker.web.UserPrincipal; + +import java.util.List; +import java.util.Map; + +/** + * 瀹夊叏鎺у埗SPI鐨勯粯璁ゅ疄鐜帮紝娌℃湁浠讳綍鎿嶄綔锛屼富瑕佹槸涓轰簡璁╂病鏈� iplatform-base-security 鐨勬ā鍧椾笉鎶ラ敊銆� + * @author 鏃跺厠鑻� + * @date 2022-11-28 + */ +public class NothingSecuritySpi implements SecuritySpi { + + public NothingSecuritySpi(){} + + @Override + public List<String> getCurrentUserRoleIdList() { + return null; + } + + @Override + public UserPrincipal<S_user_core> getCurrentUserPrincipal() { + return null; + } + + @Override + public S_user_core getCurrentUser() { + return null; + } + + @Override + public long getCurrentUserId() { + return 0; + } + + @Override + public String encryptPassword(String password) { + return null; + } + + @Override + public boolean matchesPassword(String rawPassword, String encodedPassword) { + return false; + } + + @Override + public boolean isAllowMobileLoginRegister() { + return false; + } + + @Override + public Map<String, Object> login(RequestLogin requestLogin) throws LoginException { + return null; + } + + @Override + public void loginAsWorkflowRole() { + + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/support/PlatformOperationInterceptor.java b/iplatform-base/src/main/java/com/iplatform/base/support/PlatformOperationInterceptor.java new file mode 100644 index 0000000..d43c4f4 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/support/PlatformOperationInterceptor.java @@ -0,0 +1,54 @@ +package com.iplatform.base.support; + +import com.iplatform.base.VariableConstants; +import com.iplatform.base.util.TokenUtils; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.web.TokenException; +import com.walker.web.TokenGenerator; +import com.walker.web.interceptor.WebOperationInterceptor; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + +/** + * 骞冲彴鍩烘湰鎿嶄綔鎷︽埅鍣紝涓昏閽堝鐣岄潰鎿嶄綔銆� + * @author 鏃跺厠鑻� + * @date 2023-03-09 + */ +public class PlatformOperationInterceptor extends WebOperationInterceptor { + + @Override + protected boolean doPreHandleOther(String servletPath, HttpServletRequest request, HttpServletResponse response){ + return this.checkReportView4Jim(servletPath, request); + } + + private boolean checkReportView4Jim(String servletPath, HttpServletRequest request){ + if(servletPath.indexOf(REPORT_VIEW_JIM) >= 0){ + // 鑾峰彇token楠岃瘉 + String token = TokenUtils.getAuthorizationToken(request, REPORT_TOKEN_NAME); + if(StringUtils.isEmpty(token)){ + logger.debug("-----> token 涓虹┖"); + return false; + } + String data = null; + try { + data = tokenGenerator.validateToken(token, VariableConstants.TOKEN_SECRET); + String[] userIdAndKey = TokenUtils.getUserIdAndKey(data); + String loginId = userIdAndKey[1]; + return true; + + } catch (TokenException e) { + logger.error("鏌ョ湅鎶ヨ〃token楠岃瘉閿欒:" + e.getMessage(), e); + return false; + } + } + return true; + } + + public void setTokenGenerator(TokenGenerator tokenGenerator) { + this.tokenGenerator = tokenGenerator; + } + + private TokenGenerator tokenGenerator; + private static final String REPORT_VIEW_JIM = "/jmreport/view/"; + private static final String REPORT_TOKEN_NAME = "token"; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/support/RedisArgumentsManager.java b/iplatform-base/src/main/java/com/iplatform/base/support/RedisArgumentsManager.java new file mode 100644 index 0000000..070ccbd --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/support/RedisArgumentsManager.java @@ -0,0 +1,158 @@ +package com.iplatform.base.support; + +import com.iplatform.base.Constants; +import com.iplatform.base.service.ConfigArgumentServiceImpl; +import com.iplatform.base.util.ArgumentsManagerUtils; +import com.iplatform.core.SimpleVariable; +import com.iplatform.model.po.S_config; +import com.walker.cache.Cache; +import com.walker.infrastructure.arguments.ArgumentsManager; +import com.walker.infrastructure.arguments.Group; +import com.walker.infrastructure.arguments.Variable; +import com.walker.infrastructure.arguments.VariableType; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.security.SystemLogMan; +import com.walker.support.redis.cache.RedisCacheProvider; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 鍩轰簬 Redis 瀹炵幇鐨勭郴缁熷彲鍙樺弬鏁扮鐞嗗櫒锛岃礋璐e垵濮嬪寲骞惰幏鍙栭厤缃弬鏁般�� + * @author 鏃跺厠鑻� + * @date 2022-11-29 + */ +public class RedisArgumentsManager extends RedisCacheProvider<SimpleVariable> implements ArgumentsManager { + + private ConfigArgumentServiceImpl configArgumentService = null; + + // 2023-05-16锛屾寜鐓ormId鍒嗙粍閰嶇疆闆嗗悎 + private Map<String, List<Variable>> formGroupReference = new HashMap<>(); + + public void setConfigArgumentService(ConfigArgumentServiceImpl configArgumentService) { + this.configArgumentService = configArgumentService; + SystemLogMan.getInstance().checkMan(); + } + + public RedisArgumentsManager(){ + SystemLogMan.getInstance().checkMan(); + this.setUseRedis(true); + this.setLoadPage(false); + } + + @Override + protected int loadDataToCache(Cache cache) { + List<S_config> data = this.configArgumentService.selectAll(new S_config()); +// logger.info("+++++++++++++ 寮�濮嬪姞杞� argument"); + if(!StringUtils.isEmptyList(data)){ + if(this.isUseRedis()){ + // 濡傛灉redis涓紦瀛樻暟閲忓拰鏁版嵁搴撲腑涓嶄竴鑷达紙灏戯級锛屽垯娓呯┖redis缂撳瓨锛岄噸鏂板姞杞芥暟鎹簱鏁版嵁鍒扮紦瀛樹腑銆� + long totalCache = cache.getPersistentSize(); + if(totalCache != data.size()){ + logger.info("redis缂撳瓨涓�怱_config銆戞暟閲忓皬浜庡疄闄呮暟鎹簱涓紝闇�瑕佹竻绌虹紦瀛橀噸鏂板姞杞�! cache = " + totalCache + ", db = " + data.size()); + cache.clear(); + for(S_config h : data){ + cache.put(String.valueOf(h.getConfig_key()), ArgumentsManagerUtils.toVariable(h.getConfig_key(), h.getConfig_value(), h.getData_type())); + } + } + } + + // 2023-05-16锛屽浜巖edis鏉ヨ锛屽彧瑕佺郴缁熷惎鍔紝灏遍渶瑕侀噸鏂板姞杞藉垎缁勪俊鎭紝鍥犱负鍒嗙粍娌℃湁鏀惧叆redis锛岃�屾槸鍦ㄦ湰鏈哄唴瀛� + // 杩欏湪闆嗙兢鐜涓嬶紝闇�瑕侀噸鏂板姞杞界紦瀛樺璞★紝濡傦細缂撳瓨绠$悊涓�� + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Variable variable = null; + List<Variable> groupList = null; + for(S_config h : data){ + variable = ArgumentsManagerUtils.toVariable(h.getConfig_key(), h.getConfig_value(), h.getData_type()); + groupList = this.formGroupReference.get(String.valueOf(h.getForm_id())); + if(groupList == null){ + groupList = new ArrayList<>(8); + this.formGroupReference.put(String.valueOf(h.getForm_id()), groupList); + } + groupList.add(variable); + } + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + return data.size(); + } + return 0; + } + +// private SimpleVariable toVariable(String key , String value, String dataType){ +// SimpleVariable variable = new SimpleVariable(); +// variable.setId(key); +// variable.setStringValue(value); +// variable.setDataType(dataType); +// return variable; +// } + + @Override + public SimpleVariable getVariable(String id) { + return this.getCacheData(id); + } + + @Override + public void persist(String variableId, Object value) { +// logger.warn("杩欎簺鏂规硶鏆傛椂涓嶉渶瑕佸疄鐜帮紝鍥犱负鍚庣画閰嶇疆鍙傛暟绠$悊鍚庡彴涓嶄細浣跨敤:ArgumentsManager,鐩存帴璇诲彇鏁版嵁搴擄紝涓氬姟涔熷彧闇�瑕佷娇鐢ㄨ幏鍙栨柟娉�!"); + SimpleVariable variable = ArgumentsManagerUtils.toVariable(variableId, value.toString(), VariableType.DEF_STRING); + this.updateCacheData(variableId, variable); + } + + @Override + public void persist(String groupId, String variableId, Object value) { + this.persist(variableId, value); + } + + @Override + public void persist(List<Object[]> changedList) { + throw new UnsupportedOperationException("鏈疄鐜颁唬鐮�"); + } + + @Override + public void insert(List<Object[]> insertList) { + throw new UnsupportedOperationException("鏈疄鐜颁唬鐮�"); + } + + @Override + public List<Group> getGroupList() { + throw new UnsupportedOperationException("鏈疄鐜颁唬鐮�"); + } + + @Override + public List<Variable> getVariableList(String groupId) { +// List<S_config> configList = this.configArgumentService.queryGroupConfigList(groupId); +// return ArgumentsManagerUtils.acquireGroupVariableList(configList); + // 浣跨敤鏂版満鍒讹紝鏍规嵁formId杩斿洖鍒嗙粍鍙傛暟闆嗗悎銆� + return this.formGroupReference.get(groupId); + } + + @Override + public void setSource(Object source) { + } + + @Override + public void destroy() throws Exception { + + } + + @Override + public void afterPropertiesSet() throws Exception { + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + // ~ 涓�瀹氳璋冪敤鐖跺璞℃柟娉曪紝2022-11-29 + // ~ 鍥犱负 RedisCacheProvider 鍜� ArgumentsManager 閮芥湁杩欎釜鏂规硶瀹炵幇锛屽惁鍒欏垵濮媗oad鏂规硶涓嶄細琚姞杞�! + // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + super.afterPropertiesSet(); + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_ARGUMENTS; + } + + @Override + public Class<?> getProviderType() { + return SimpleVariable.class; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/support/TimeStatisticsInterceptor.java b/iplatform-base/src/main/java/com/iplatform/base/support/TimeStatisticsInterceptor.java new file mode 100644 index 0000000..6248828 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/support/TimeStatisticsInterceptor.java @@ -0,0 +1,95 @@ +package com.iplatform.base.support; + +import com.iplatform.base.AsyncManager; +import com.iplatform.base.service.ApiTimeServiceImpl; +import com.iplatform.model.vo.ApiTime; +import com.walker.infrastructure.utils.DateUtils; +import com.walker.infrastructure.utils.NumberGenerator; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import org.springframework.web.servlet.HandlerInterceptor; + +import java.util.TimerTask; + +/** + * 缁熻鎺ュ彛璋冪敤鏃堕棿鎷︽埅鍣ㄥ疄鐜般�� + * <pre> + * 1) 鎷︽埅鎵�鏈夋帴鍙� + * 2) 濡傛灉鎺ュ彛璋冪敤鏃堕棿灏忎簬闃堝�硷紝鍒欏彧璁$畻绱姞璋冪敤閲忥紱 + * 3) 濡傛灉鎺ュ彛璋冪敤鏃堕棿澶т簬闃堝�硷紝鍒欎細璁板綍璇︾粏鍐呭锛氭帴鍙d綅缃�佹椂闂淬�佽�楁椂绛� + * 4) 鍐欏叆鏁版嵁搴撶粨鏋滃苟闈炲疄鏃讹紝鑰屾槸浼氬疄鏃跺啓鍏ョ紦瀛橈紝绛夊埌瑙﹀彂鏈哄埗鏃舵墠浼氬埛鐩樸�傝Е鍙戞満鍒跺涓嬶細 + * + * 4.1) 璁℃暟鍒拌揪 + * 4.2) 璁块棶缁撴灉鎺ュ彛锛屾煡璇㈢粺璁$粨鏋滄椂 + * + * 5) 缁熻缁撴灉鎺ュ彛鍦板潃锛�/test/time/statistics + * </pre> + * @author 鏃跺厠鑻� + * @date 2024-02-29 + */ +public class TimeStatisticsInterceptor implements HandlerInterceptor { + + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { + +// String uri = request.getRequestURI(); + if(this.enabled){ + long startTime = System.nanoTime(); + request.setAttribute("startTime", startTime); + } + return true; + +// if (url.indexOf("/list") >= 0) { +// this.logger.debug("鎷︽埅鍣ㄦ墽琛�:preparePageSearch()"); +// this.preparePageSearch(request); +// } +// return this.doPreHandleOther(url, request, response); + } + + public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object args, Exception exception) throws Exception { + if(this.enabled){ + Object startTimeObj = request.getAttribute("startTime"); + if(startTimeObj != null){ + long startTime = Long.parseLong(startTimeObj.toString()); + long costTime = (System.nanoTime() - startTime); + // 灏忎簬1姣鐨勬樉绀轰负0 + if(costTime < 1000000){ + costTime = 0; + } else { + costTime = costTime / 1000000; + } + ApiTime apiTime = new ApiTime(); + apiTime.setId(NumberGenerator.getLongSequenceNumber()); + apiTime.setCreateTime(DateUtils.getDateTimeNumber()); + long currentDate = DateUtils.getDateNumber(System.currentTimeMillis()); + apiTime.setRequestDate((int)currentDate); + apiTime.setUri(request.getRequestURI()); + apiTime.setCostTime(costTime); + AsyncManager.me().execute(this.acquireOperateLogTask(apiTime)); + } + } + } + + private TimerTask acquireOperateLogTask(ApiTime apiTime){ + return new TimerTask() { + @Override + public void run() { + apiTimeService.execInsertApiTime(apiTime); + } + }; + } + + public void setApiTimeService(ApiTimeServiceImpl apiTimeService) { + this.apiTimeService = apiTimeService; + } + + /** + * 鏄惁鍚敤鎺ュ彛鏃堕棿鎷︽埅銆� + * @param enabled + */ + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + + private boolean enabled = false; + private ApiTimeServiceImpl apiTimeService; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/support/strategy/AbstractLoginStrategy.java b/iplatform-base/src/main/java/com/iplatform/base/support/strategy/AbstractLoginStrategy.java new file mode 100644 index 0000000..d0a9684 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/support/strategy/AbstractLoginStrategy.java @@ -0,0 +1,41 @@ +package com.iplatform.base.support.strategy; + +import com.iplatform.base.UserLoginCache; +import com.iplatform.core.LoginStrategy; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public abstract class AbstractLoginStrategy implements LoginStrategy { + + protected final transient Logger logger = LoggerFactory.getLogger(this.getClass()); + + @Override + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + } + + @Override + public boolean isEnabled() { + return enabled; + } + + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + + public UserLoginCache getUserLoginCache() { + return userLoginCache; + } + + public void setUserLoginCache(UserLoginCache userLoginCache) { + this.userLoginCache = userLoginCache; + } + + private UserLoginCache userLoginCache; + private boolean enabled = false; + private String name; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/support/strategy/LoginStrategyManager.java b/iplatform-base/src/main/java/com/iplatform/base/support/strategy/LoginStrategyManager.java new file mode 100644 index 0000000..4529def --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/support/strategy/LoginStrategyManager.java @@ -0,0 +1,81 @@ +package com.iplatform.base.support.strategy; + +import com.iplatform.base.UserLoginCache; +import com.iplatform.base.pojo.RequestLogin; +import com.iplatform.core.LoginStrategy; +import com.iplatform.model.po.S_user_login; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.HashMap; +import java.util.Map; + +/** + * 鐧诲綍绛栫暐绠$悊鍣ㄣ�� + * @author 鏃跺厠鑻� + * @date 2023-07-11 + */ +public class LoginStrategyManager { + + protected final transient Logger logger = LoggerFactory.getLogger(getClass()); + + private final Map<String, LoginStrategy> loginStrategyMap = new HashMap<>(4); + private int count = 0; + + public void register(String key, LoginStrategy loginStrategy){ + if(loginStrategy == null){ + throw new IllegalArgumentException("loginStrategy涓嶈兘涓虹┖"); + } +// String key = loginStrategy.getClass().getName(); + if(this.loginStrategyMap.containsKey(key)){ + throw new IllegalArgumentException("loginStrategy娉ㄥ唽閲嶅锛�" + loginStrategy.getName()); + } + this.loginStrategyMap.put(key, loginStrategy); + logger.info("娉ㄥ唽銆愮櫥褰曠瓥鐣ャ�戝璞�:{}", key); + count ++; + } + + /** + * 鎵ц绛栫暐 + * @param requestLogin 鐧诲綍淇℃伅 + * @return + */ + public String execute(RequestLogin requestLogin){ + if(this.count == 0){ + return null; + } + for(LoginStrategy loginStrategy : this.loginStrategyMap.values()){ + if(loginStrategy.isEnabled() && !loginStrategy.allowLogin(requestLogin.getUsername(), requestLogin.getClientType())){ + return loginStrategy.acquireError(); + } + } + return null; + } + + public boolean hasUserLogin(String loginId){ + return this.userLoginCache.getUserLogin(loginId) != null; + } + + public void putUserLoginCache(S_user_login user_login){ + this.userLoginCache.putUserLogin(user_login); + } + public void updateUserLoginCache(S_user_login user_login){ + this.userLoginCache.updateUserLogin(user_login); + } + + /** + * 鏍规嵁鐧诲綍ID锛岃繑鍥炵櫥褰曚俊鎭�� + * @param loginId + * @return + * @date 2023-08-05 + */ + public S_user_login getUserLogin(String loginId){ + return this.userLoginCache.getUserLogin(loginId); + } + + public void setUserLoginCache(UserLoginCache userLoginCache) { + this.userLoginCache = userLoginCache; + } + + private UserLoginCache userLoginCache; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/support/strategy/MobileOnceLoginStrategy.java b/iplatform-base/src/main/java/com/iplatform/base/support/strategy/MobileOnceLoginStrategy.java new file mode 100644 index 0000000..29a78bc --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/support/strategy/MobileOnceLoginStrategy.java @@ -0,0 +1,51 @@ +package com.iplatform.base.support.strategy; + +import com.iplatform.model.po.S_user_login; +import com.walker.infrastructure.utils.DateUtils; +import com.walker.web.ClientType; + +/** + * 绉诲姩绔棤璁哄灏戠粓绔紝鍙兘鐧诲綍涓�涓紝鎷掔粷閲嶅鐧诲綍銆� + * <p>濡傛灉瑕佹兂閲嶆柊鐧诲綍锛屽繀椤诲厛鐧诲嚭銆傛垨鑰呯瓑寰卼oken瓒呮椂銆�</p> + * @author 鏃跺厠鑻� + * @date 2023-07-11 + */ +public class MobileOnceLoginStrategy extends AbstractLoginStrategy{ + + @Override + public boolean allowLogin(String loginId, String clientType) { + if(this.tokenExpireMobile == 0){ + throw new IllegalArgumentException("璇峰厛閰嶇疆bean灞炴�э細tokenExpireMobile"); + } + if(!clientType.equals(ClientType.INDEX_MOBILE)){ + // 闈炵Щ鍔ㄧ锛屼笉妫�娴� + return true; + } + S_user_login login = this.getUserLoginCache().getUserLogin(loginId); + if(login == null){ + logger.debug("缂撳瓨涓病鏈夌櫥褰曡褰曪紝鍏佽鐧诲綍锛宭oginId={}", loginId); + return true; + } + + // 妫�鏌ユ槸鍚︾櫥褰曡秴鏃讹紝鏍规嵁璁板綍涓洿鏂版椂闂达紝瀵规瘮绉诲姩绔痶oken鏄惁澶辨晥銆� + // 姣杞崲鎴愬垎閽� + long spanTime = (System.currentTimeMillis() - DateUtils.toMillSeconds(login.getUpdate_time())) / 60000; + if(spanTime <= this.tokenExpireMobile){ + logger.debug("鐧诲綍鍦╰oken鑼冨洿鍐咃紝涓嶅厑璁哥櫥褰曪紝loginId={}", login); + return false; + } + return true; + } + + @Override + public String acquireError() { + return ERROR; + } + + public void setTokenExpireMobile(long tokenExpireMobile) { + this.tokenExpireMobile = tokenExpireMobile; + } + + private long tokenExpireMobile = 0; + private static final String ERROR = "鍚屼竴璐﹀彿鏃犳硶閲嶅鐧诲綍"; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/support/strategy/WebOnceLoginStrategy.java b/iplatform-base/src/main/java/com/iplatform/base/support/strategy/WebOnceLoginStrategy.java new file mode 100644 index 0000000..1f1afaa --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/support/strategy/WebOnceLoginStrategy.java @@ -0,0 +1,48 @@ +package com.iplatform.base.support.strategy; + +import com.iplatform.model.po.S_user_login; +import com.walker.infrastructure.utils.DateUtils; +import com.walker.web.ClientType; + +/** + * Web锛圥C锛夌锛岀櫥褰曠瓥鐣ワ細鍙兘鐧诲綍涓�娆″疄鐜� + * @author 鏃跺厠鑻� + * @date 2023-09-08 + */ +public class WebOnceLoginStrategy extends MobileOnceLoginStrategy{ + + @Override + public boolean allowLogin(String loginId, String clientType) { + if(this.tokenExpireWeb == 0){ + throw new IllegalArgumentException("璇峰厛閰嶇疆bean灞炴�э細tokenExpireMobile"); + } + if(!clientType.equals(ClientType.INDEX_PC)){ + // 闈濸C绔紝涓嶆娴� + return true; + } + S_user_login login = this.getUserLoginCache().getUserLogin(loginId); + if(login == null){ + logger.debug("缂撳瓨涓病鏈夌櫥褰曡褰曪紝鍏佽鐧诲綍锛宭oginId={}", loginId); + return true; + } + + // 妫�鏌ユ槸鍚︾櫥褰曡秴鏃讹紝鏍规嵁璁板綍涓洿鏂版椂闂达紝瀵规瘮绉诲姩绔痶oken鏄惁澶辨晥銆� + // 姣杞崲鎴愬垎閽� + long spanTime = (System.currentTimeMillis() - DateUtils.toMillSeconds(login.getUpdate_time())) / 60000; + if(spanTime <= this.tokenExpireWeb){ + logger.debug("鐧诲綍鍦╰oken鑼冨洿鍐咃紝涓嶅厑璁哥櫥褰曪紝loginId={}", login); + return false; + } + return true; + } + + public long getTokenExpireWeb() { + return tokenExpireWeb; + } + + public void setTokenExpireWeb(long tokenExpireWeb) { + this.tokenExpireWeb = tokenExpireWeb; + } + + private long tokenExpireWeb = 600; // PC绔粯璁�2灏忔椂 +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/util/ArgumentsManagerUtils.java b/iplatform-base/src/main/java/com/iplatform/base/util/ArgumentsManagerUtils.java new file mode 100644 index 0000000..9425a18 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/util/ArgumentsManagerUtils.java @@ -0,0 +1,40 @@ +package com.iplatform.base.util; + +import com.iplatform.core.SimpleVariable; +import com.iplatform.model.po.S_config; +import com.walker.infrastructure.arguments.Variable; +import com.walker.infrastructure.arguments.VariableType; +import com.walker.infrastructure.utils.StringUtils; + +import java.util.ArrayList; +import java.util.List; + +public class ArgumentsManagerUtils { + + /** + * 鎶婃暟鎹簱涓粰瀹氱殑鍒嗙粍鍙傛暟锛岀粍瑁呮垚鍏叡鍙傛暟瀵硅薄闆嗗悎杩斿洖涓氬姟銆� + * @param configList 鏁版嵁搴撳姞杞界殑闆嗗悎 + * @return + * @date 2023-03-01 + */ + public static final List<Variable> acquireGroupVariableList(List<S_config> configList){ + if(StringUtils.isEmptyList(configList)){ + return null; + } + List<Variable> groupVariableList = new ArrayList<>(); + for(S_config s_config : configList){ + groupVariableList.add(ArgumentsManagerUtils + .toVariable(s_config.getConfig_key(), s_config.getConfig_value(), VariableType.DEF_STRING)); + } + return groupVariableList; + } + + public static final SimpleVariable toVariable(String key , String value, String dataType){ + SimpleVariable variable = new SimpleVariable(); + variable.setId(key); + variable.setStringValue(value); + variable.setDataType(dataType); + return variable; + } + +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/util/CaptchaUtils.java b/iplatform-base/src/main/java/com/iplatform/base/util/CaptchaUtils.java new file mode 100644 index 0000000..e40127b --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/util/CaptchaUtils.java @@ -0,0 +1,22 @@ +package com.iplatform.base.util; + +import com.iplatform.base.Constants; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.web.CaptchaResult; + +public class CaptchaUtils { + + /** + * 杩斿洖楠岃瘉鐮佺紦瀛樻爣璇嗭紝鍗筹細瀛樺偍鍦╮edis锛堟垨鍐呭瓨锛変腑鐨勫敮涓�鏍囪瘑銆�<p></p> + * 鐩墠浣跨敤琛ㄧず瑙勫垯 = captcha_codes:uuid + * @param data + * @return + * @date 2023-04-07 + */ + public static final String getVerifyKey(CaptchaResult data){ + if(data == null || StringUtils.isEmpty(data.getUuid())){ + throw new IllegalArgumentException("寰呴獙璇佷俊鎭湭绌猴紝鎴栬�卽uid涓嶅瓨鍦�!"); + } + return Constants.CAPTCHA_CODE_PREFIX + data.getUuid(); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/util/CategoryUtils.java b/iplatform-base/src/main/java/com/iplatform/base/util/CategoryUtils.java new file mode 100644 index 0000000..8e72ce0 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/util/CategoryUtils.java @@ -0,0 +1,87 @@ +package com.iplatform.base.util; + +import com.iplatform.base.util.cache.CategorySortComparator; +import com.iplatform.model.po.S_category; +import com.iplatform.model.vo.CategoryTreeVo; +import com.walker.infrastructure.utils.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class CategoryUtils { + + protected static Logger logger = LoggerFactory.getLogger(CategoryUtils.class); + + public static final List<CategoryTreeVo> acquireListTree(List<S_category> allTree, CategorySortComparator sortComparator){ + // 閲嶆柊鎺掑簭 + Collections.sort(allTree, sortComparator); + // + List<CategoryTreeVo> treeList = new ArrayList<>(); + if(allTree.size() == 0){ + return treeList; + } + + // + for (S_category category : allTree) { + treeList.add(CategoryUtils.toCategoryTreeVo(category)); + } + + Map<Integer, CategoryTreeVo> map = new HashMap<>(treeList.size()); + //ID 涓� key 瀛樺偍鍒癿ap 涓� + for (CategoryTreeVo categoryTreeVo : treeList) { + map.put(categoryTreeVo.getId(), categoryTreeVo); + } + + List<CategoryTreeVo> list = new ArrayList<>(); + CategoryTreeVo parentTree = null; + for (CategoryTreeVo tree : treeList) { + //瀛愰泦ID杩斿洖瀵硅薄锛屾湁鍒欐坊鍔犮�� + parentTree = map.get(tree.getPid()); + if (parentTree != null) { + parentTree.getChild().add(tree); + } else { + list.add(tree); + } + } + + return list; + } + + public static final boolean isCondition(S_category tempCategory + , Integer type, Integer status, String name, List<Integer> categoryIdList, int owner){ + if(owner != tempCategory.getOwner().intValue()){ + return false; + } + if(type != null && type.intValue() != tempCategory.getType().intValue()){ + return false; + } + if(status != null && status.intValue() >= 0 && status.intValue() != tempCategory.getStatus().intValue()){ + return false; + } + if(!StringUtils.isEmptyList(categoryIdList) && !categoryIdList.contains(tempCategory.getId())){ + logger.debug("涓嶅寘鍚湪缁欏畾鐨勯泦鍚堜腑'categoryIdList'"); + return false; + } + return true; + } + + public static final CategoryTreeVo toCategoryTreeVo(S_category category){ + CategoryTreeVo categoryTreeVo = new CategoryTreeVo(); + categoryTreeVo.setId(category.getId()); + categoryTreeVo.setName(category.getName()); + categoryTreeVo.setPid(category.getPid()); + categoryTreeVo.setExtra(category.getExtra()); + categoryTreeVo.setPath(category.getPath()); + categoryTreeVo.setSort(category.getSort()); + categoryTreeVo.setStatus(category.getStatus() == 1); + categoryTreeVo.setType(category.getType()); + categoryTreeVo.setUrl(category.getUrl()); + return categoryTreeVo; + } + +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/util/ConfigFormValidateUtils.java b/iplatform-base/src/main/java/com/iplatform/base/util/ConfigFormValidateUtils.java new file mode 100644 index 0000000..cda2d87 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/util/ConfigFormValidateUtils.java @@ -0,0 +1,83 @@ +package com.iplatform.base.util; + +import com.iplatform.base.PlatformRuntimeException; +import com.iplatform.core.RegularConstants; +import com.walker.infrastructure.utils.PhoneNumberUtils; +import com.walker.infrastructure.utils.StringUtils; + +import java.util.regex.Pattern; + +/** + * 閰嶇疆琛ㄥ崟楠岃瘉宸ュ叿銆傚悗缁鍚堝苟鍒板钩鍙般�� + * @author 鏃跺厠鑻� + * @date 2023-05-20 + */ +public class ConfigFormValidateUtils { + + /** + * 鎵嬫満 + * @param value String 鍊� + * @param info String 瀛楁鍚� + */ + public static void isPhone(String value, String info) { + regularException(value, info, RegularConstants.PHONE_TWO, "鎵嬫満"); + } + + /** + * 楠岃瘉蹇呭~ + * @param value String 鍊� + * @param info String 瀛楁鍚� + + * @since 2020-05-11 + */ + public static void isRequire(String value, String info){ + if(StringUtils.isEmpty(value) ){ + throw new PlatformRuntimeException("璇峰~鍐�/閫夋嫨" + info); + } + } + + /** + * 姝e垯琛ㄨ揪寮忛獙璇� + * @param value String 鍊� + * @param info String 瀛楁鍚� + * @param regular String 姝e垯琛ㄨ揪寮� + + * @since 2020-05-11 + */ + public static void regularException(String value, String info, String regular, String title){ + if(!regular(value, info, regular)){ + //姝e垯楠岃瘉 + throw new PlatformRuntimeException(info + " 鏍煎紡蹇呴』涓� " + title); + } + } + + /** + * 姝e垯琛ㄨ揪寮忛獙璇� + * @param value String 鍊� + * @param info String 瀛楁鍚� + * @param regular String 姝e垯琛ㄨ揪寮� + + * @since 2020-05-11 + */ + public static boolean regular(String value, String info, String regular){ + isRequire(value, info); + Pattern pattern = Pattern.compile(regular); + return pattern.matcher(value).matches(); + } + + /** + * 鏍¢獙鏄惁鏄墜鏈哄彿锛屼笉鏄垯鎶涘嚭寮傚父 + * @param phone 鎵嬫満鍙� + */ + public static void isPhoneException(String phone) { +// boolean match = false; +// if(StringUtils.isEmpty(phone)){ +// match = false; +// } +// boolean match = ReUtil.isMatch(RegularConstants.PHONE_TWO, phone); + boolean match = PhoneNumberUtils.isCellPhoneNumber(phone); + if (!match) { + throw new PlatformRuntimeException("璇疯緭鍏ユ纭殑鎵嬫満鍙�"); + } + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/util/DataImportUtils.java b/iplatform-base/src/main/java/com/iplatform/base/util/DataImportUtils.java new file mode 100644 index 0000000..105068c --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/util/DataImportUtils.java @@ -0,0 +1,220 @@ +package com.iplatform.base.util; + +import com.walker.infrastructure.utils.StringUtils; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.TreeMap; + +public class DataImportUtils { + + /** + * 璁$畻瑕佸啓鍏ョ殑鏁版嵁闆嗗悎锛岀粰瀹氫竴涓凡瀛樺湪鐨勬暟鎹泦鍚堬紝鍒ゆ柇褰撳墠 mapList 涓摢浜涙槸涓嶅瓨鍦ㄥ苟闇�瑕佹柊鍐欏叆鐨勬暟鎹��<p></p> + * 鐩墠浣跨敤绠�鍗曠殑 Map 缂撳瓨宸插瓨鍦ㄨ褰曪紝骞朵娇鐢ㄦ潯浠跺垪鍊兼嫾鎺ュ瓧绗︿覆浣滀负key锛岀劧鍚庨亶鍘� mapList绛涙煡鍑烘潵銆� + * @param mapList 缁欏畾鐨勫師濮嬫暟鎹泦鍚� + * @param existList 宸插瓨鍦ㄩ泦鍚� + * @param whereColumnNames 鏉′欢瀛楁鍚嶇О闆嗗悎 + * @return 杩斿洖缁撴灉锛屾暟缁勪腑鍖呭惈涓や釜闆嗗悎: object[0] = insertList, object[1] = updateList + * @date 2023-02-06 + */ + public static final Object[] calculateInsertAndUpdateList(List<Map<String, Object>> mapList + , List<Map<String, Object>> existList, List<String> whereColumnNames){ + Object[] resultObject = new Object[2]; + + // 鍙湁鍐欏叆闆嗗悎 + if(StringUtils.isEmptyList(existList)){ + resultObject[0] = mapList; + resultObject[1] = null; + return resultObject; + } + Map<String, Integer> recordExistMap = new HashMap<>(); + StringBuilder key = null; + for(Map<String, Object> existOne : existList){ + key = new StringBuilder(); + for(String whereColumn : whereColumnNames){ + key.append(existOne.get(whereColumn).toString()); + } + recordExistMap.put(key.toString(), 1); + } + + List<Map<String, Object>> insertList = new ArrayList<>(256); + List<Map<String, Object>> updateList = new ArrayList<>(64); + + for(Map<String, Object> one : mapList){ + key = new StringBuilder(); + for(String whereColumn : whereColumnNames){ + key.append(one.get(whereColumn).toString()); + } + // 涓嶅瓨鍦ㄨ鏇存柊璁板綍锛屽氨灞炰簬鐩存帴鍐欏叆鐨� + if(recordExistMap.get(key.toString()) == null){ + insertList.add(one); + } else { + updateList.add(one); + } + } + resultObject[0] = insertList; + resultObject[1] = updateList; + return resultObject; + } + + /** + * 杩斿洖缁勮濂界殑 where in (:param) 鍙傛暟鍊奸泦鍚堬紝瀛楃涓茬被鍨嬬殑銆� + * @param fieldName 鏌ユ壘鏉′欢鐨勫瓧娈靛悕绉� + * @param mapList 鍘熷鏁版嵁Map闆嗗悎銆� + * @return + * @date 2023-02-06 + */ + public static final List<String> acquireWhereInStringValues(String fieldName, List<Map<String, Object>> mapList){ + List<String> valueList = new ArrayList<>(256); + Object value = null; + for(Map<String, Object> map : mapList){ + value = map.get(fieldName); + if(value == null){ + valueList.add(StringUtils.EMPTY_STRING); + } else { + valueList.add(value.toString()); + } + } + return valueList; + } + + /** + * 杩斿洖鏇存柊鏁版嵁鏃讹紝鎵�鏈夋洿鏂拌褰曠殑SQL涓殑鍊煎嚑浣曘��<p></p> + * 濡�: [object[5], object[5], object[5]] + * @param dataList + * @param updateColumns + * @param whereColumns + * @return + * @date 2023-02-05 + */ + public static final List<Object[]> acquireUpdateValues(List<Map<String, Object>> dataList + , List<String> updateColumns, List<String> whereColumns){ + List<Object[]> list = new ArrayList<>(); + int allValueFieldSize = updateColumns.size() + whereColumns.size(); + + Object[] parameter = null; + for(Map<String, Object> map : dataList){ + parameter = new Object[allValueFieldSize]; + Object value = null; + int currentPosition = 0; + for(int i=0; i< updateColumns.size(); i++){ + // 閬嶅巻姣忎釜璁剧疆瀛楁锛屾牴鎹瓧娈靛悕瀛楋紝鍙栧嚭瀛楁鍊� + value = map.get(updateColumns.get(i)); + parameter[currentPosition] = value; + currentPosition ++; + } + + // where 鏉′欢鍊� + for(int j=0; j< whereColumns.size(); j++){ + value = map.get(whereColumns.get(j)); + parameter[currentPosition] = value; + currentPosition ++; + } + + list.add(parameter); + } + return list; + } + + /** + * 鐢熸垚鏇存柊SQL璇彞 + * @param tableName 琛ㄥ悕 + * @param updateColumns 鏇存柊瀛楁鍚嶉泦鍚� + * @param whereColumns 鏉′欢瀛楁鍚嶉泦鍚堬紝鐩墠鍙兘 and + * @return 杩斿洖鎷兼帴鐨凷QL璇彞锛屽崰浣嶇浣跨敤:? + * @date 2023-02-05 + */ + public static final String acquireUpdateSql(String tableName, List<String> updateColumns, List<String> whereColumns){ + StringBuilder sql = new StringBuilder("update ").append(tableName); + sql.append(" set "); + for(int i=0; i< updateColumns.size(); i++){ + if(i > 0){ + sql.append(StringUtils.DEFAULT_SPLIT_SEPARATOR); + } + sql.append(updateColumns.get(i)).append(StringUtils.CHAR_EQUALS).append("?"); + } + if(!StringUtils.isEmptyList(whereColumns)){ + sql.append(" where "); + for(int i=0; i< whereColumns.size(); i++){ + if(i > 0){ + sql.append(" and "); + } + sql.append(whereColumns.get(i)).append(StringUtils.CHAR_EQUALS).append("?"); + } + } + return sql.toString(); + } + + /** + * 鎶� Map 闆嗗悎涓暟鎹浆鎹㈡垚鏁扮粍闆嗗悎锛屾柟渚� SQL 鍐欏叆銆� + * @param mapList + * @param fieldNames + * @return + * @date 2023-02-06 + */ + public static final List<Object[]> translateToArray(List<Map<String, Object>> mapList, List<String> fieldNames){ + List<Object[]> list = new ArrayList<>(256); + Object[] parameter = null; + for(Map<String, Object> map : mapList){ + parameter = new Object[fieldNames.size()]; + for(int i=0; i< fieldNames.size(); i++){ + parameter[i] = map.get(fieldNames.get(i)); + } + list.add(parameter); + } + return list; + } + + /** + * 鎶婃暟缁勯泦鍚堝垪琛ㄦ暟鎹浆鎹㈡垚Map闆嗗悎銆� + * @param dataList + * @param fieldNames 瀛楁鍚嶇О闆嗗悎 + * @return 娉ㄦ剰:杩斿洖鐨凪ap涓瓧娈典粛鐒舵寜椤哄簭锛屼负: TreeMap + * @date 2023-02-03 + */ + public static final List<Map<String, Object>> translateToMap(List<Object[]> dataList, List<String> fieldNames){ + if(StringUtils.isEmptyList(dataList)){ + return null; + } + List<Map<String, Object>> list = new ArrayList<>(dataList.size() + 2); + Map<String, Object> map = null; + for(Object[] row : dataList){ + map = new TreeMap<>(); + for(int i=0; i< row.length; i++){ + map.put(fieldNames.get(i), row[i]); + } + list.add(map); + } + return list; + } + + /** + * 鏍规嵁琛ㄥ悕銆佸瓧娈典俊鎭紝鐢熸垚涓�涓� insert sql璇彞銆� + * @param tableName + * @param fieldNames + * @return + * @date 2023-02-01 + */ + public static final String acquireInsertSql(String tableName, List<String> fieldNames){ + StringBuilder sql = new StringBuilder("insert into "); + sql.append(tableName).append("("); + for(int i=0; i<fieldNames.size(); i++){ + if(i > 0){ + sql.append(StringUtils.DEFAULT_SPLIT_SEPARATOR); + } + sql.append(fieldNames.get(i)); + } + sql.append(") values("); + + for(int i=0; i< fieldNames.size(); i++){ + if(i > 0){ + sql.append(StringUtils.DEFAULT_SPLIT_SEPARATOR); + } + sql.append("?"); + } + sql.append(")"); + return sql.toString(); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/util/DeptUtils.java b/iplatform-base/src/main/java/com/iplatform/base/util/DeptUtils.java new file mode 100644 index 0000000..4eee67d --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/util/DeptUtils.java @@ -0,0 +1,56 @@ +package com.iplatform.base.util; + +import com.iplatform.base.Constants; +import com.iplatform.base.support.DeptTreeGenerator; +import com.iplatform.base.util.dept.SystemDept; +import com.iplatform.model.po.S_dept; +import com.walker.infrastructure.tree.TreeNode; +import com.walker.infrastructure.utils.StringUtils; + +import java.util.ArrayList; +import java.util.List; + +public class DeptUtils { + + public static final String KEY_CHILDREN_PREFIX = ".children"; + + public static S_dept SUPER_VISOR_DEPT = null; + + static { + S_dept dept = new S_dept(); + dept.setId(0L); + dept.setDept_name(Constants.SUPERVISOR_NAME_ZH); + dept.setOrg_id(Constants.SUPERVISOR_ID); + dept.setOrg_type(0); + SUPER_VISOR_DEPT = dept; + } + + /** + * 鐢熸垚涓�涓《绾ф満鏋勬爲缁撴瀯瀵硅薄锛岀敤浜庡墠绔覆鏌撱��<p></p> + * 鐩墠浣跨敤鍦ㄦ坊鍔犳満鏋勩�佺敤鎴凤紝閫夋嫨閮ㄩ棬鐣岄潰銆� + * @param orgList 鍘熷鏈烘瀯鍒楄〃 + * @return + * @date 2022-12-12 + */ + public static final List<TreeNode> getOrgDeptTree(List<S_dept> orgList){ + DeptTreeGenerator deptTreeGenerator = new DeptTreeGenerator(null); + deptTreeGenerator.setEntityList(orgList); + List<TreeNode> treeNodeList = deptTreeGenerator.getTreeRootList(); + return treeNodeList; + } + + public static final List<SystemDept> toSystemDeptList(List<S_dept> deptList){ + if(StringUtils.isEmptyList(deptList)){ + return null; + } + List<SystemDept> systemDeptList = new ArrayList<>(32); + for(S_dept dept : deptList){ + systemDeptList.add(toSystemDept(dept)); + } + return systemDeptList; + } + + public static final SystemDept toSystemDept(S_dept s_dept){ + return new SystemDept(s_dept); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/util/MenuUtils.java b/iplatform-base/src/main/java/com/iplatform/base/util/MenuUtils.java new file mode 100644 index 0000000..2728a35 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/util/MenuUtils.java @@ -0,0 +1,272 @@ +package com.iplatform.base.util; + +import com.iplatform.base.util.menu.SystemMenu; +import com.iplatform.model.po.S_menu; +import com.walker.infrastructure.utils.StringUtils; + +import java.util.List; + +public class MenuUtils { + + /** + * 鑿滃崟鑼冨洿涓庣粰瀹氱殑杈撳叆鍙傛暟涓嶅尮閰嶃�� + * <pre> + * 1) 鎶婁唬鐮佹娊鍑烘潵澶嶇敤锛屾牴鎹敤鎴风櫥褰曟墍灞炶韩浠斤紙骞冲彴銆佺嫭绔嬫満鏋勩�佸叾浠栫壒瀹氫釜浜虹瓑锛夊姞杞戒笉鍚岃彍鍗曘�� + * </pre> + * @param menuScope 鑿滃崟鑼冨洿锛屽弬瑙佸父閲� + * @param menu 鑿滃崟瀵硅薄 + * @return 濡傛灉杩斿洖 true 琛ㄧず涓嶅尮閰嶏紝false 琛ㄧず鍖归厤 + * @date 2023-10-24 + */ + public static final boolean menuScopeNotMatch(int menuScope, S_menu menu){ + // 2023-10-11 澧炲姞杩欎釜if鍒ゆ柇锛屽鏋滄槸涓嶅尯鍒嗚寖鍥达紝鍒欏姞杞芥墍鏈夎彍鍗� + if(menuScope != MenuUtils.MENU_SCOPE_ALL){ + + if(menuScope == MenuUtils.MENU_SCOPE_PLATFORM){ + // 濡傛灉瑕佸睍绀鸿彍鍗曡寖鍥存槸锛氬钩鍙帮紝鍒欒彍鍗曚腑 >= 4鐨勫垎绫婚兘涓嶈锛岃繖浜涙槸椤剁骇鏈烘瀯涓氬姟鐙珛鑿滃崟銆� + if(menu.getType().intValue() >= MenuUtils.MENU_SCOPE_ORG){ + return true; + } + } else if(menuScope == MenuUtils.MENU_SCOPE_ORG){ +// if(menu.getType().intValue() < MenuUtils.MENU_SCOPE_ORG){ + if(menu.getType().intValue() != MenuUtils.MENU_SCOPE_ORG && menu.getType().intValue() != MENU_SCOPE_ALL){ + // 濡傛灉瑕佸睍绀鸿彍鍗曡寖鍥存槸锛氶《绾ф満鏋勪笟鍔$殑鐙珛鑿滃崟锛屽垯骞冲彴鑿滃崟涓嶆樉绀恒��2023-06-01 + return true; + } + } else if(menuScope > MenuUtils.MENU_SCOPE_ORG){ + // 瀵逛簬澶т簬鏈烘瀯鑿滃崟鐨勶紝閮藉睘浜庢満鏋勭壒瀹氳彍鍗曪紝蹇呴』涓庝紶鍏ヨ寖鍥村畬鍏ㄤ竴鑷达紝濡傦細鐝富浠昏彍鍗曠瓑銆�2023-10-24 + if(menu.getType().intValue() != menuScope && menu.getType().intValue() != MENU_SCOPE_ALL){ + return true; + } + } + } + return false; + } + + public static final boolean containMenu(List<SystemMenu> menuList, String menuId){ + for(SystemMenu systemMenu : menuList){ + if(systemMenu.getMenu_id().equals(menuId)){ + return true; + } + } + return false; + } + + /** + * 鑾峰彇缁勪欢淇℃伅锛堣嫢渚濆墠绔娇鐢級锛屾柟娉曞凡搴熷純銆� + * + * @param menu 鑿滃崟淇℃伅 + * @return 缁勪欢淇℃伅 + */ + @Deprecated + public static String getComponent(SystemMenu menu) { + String component = LAYOUT; + if (StringUtils.isNotEmpty(menu.getComponent()) && !isMenuFrame(menu)) { + component = menu.getComponent(); + } + else if (StringUtils.isEmpty(menu.getComponent()) && menu.getParent_id().equals(MENU_ID_ROOT) && isInnerLink(menu)) { + component = INNER_LINK; + } + else if (StringUtils.isEmpty(menu.getComponent()) && isParentView(menu)) { + component = PARENT_VIEW; + } + return component; + } + + /** + * 鏄惁涓簆arent_view缁勪欢銆�<p></p> + * 涓汉鐞嗚В: 鑿滃崟鏈変笂绾х洰褰曪紝鑰屼笖鏄竴涓洰褰曡彍鍗曘��(涔熷氨鏄腑闂寸洰褰曡彍鍗�) + * + * @param menu 鑿滃崟淇℃伅 + * @return 缁撴灉 + */ + @Deprecated + public static boolean isParentView(SystemMenu menu) { + return !menu.getParent_id().equals(MENU_ID_ROOT) && MENU_TYPE_FOLDER.equals(menu.getMenu_type()); + } + + /** + * 鑾峰彇璺敱鍦板潃 + * + * @param menu 鑿滃崟淇℃伅 + * @return 璺敱鍦板潃 + */ + @Deprecated + public static String getRouterPath(SystemMenu menu) { + String routerPath = menu.getPath(); + // 鍐呴摼鎵撳紑澶栫綉鏂瑰紡 + if (menu.getParent_id().equals(MENU_ID_ROOT) && isInnerLink(menu)) { + routerPath = innerLinkReplaceEach(routerPath); + return routerPath; + } + // 闈炲閾惧苟涓旀槸涓�绾х洰褰曪紙绫诲瀷涓虹洰褰曪級 + if (menu.getParent_id().equals(MENU_ID_ROOT) + && MENU_TYPE_FOLDER.equals(menu.getMenu_type()) + && menu.getIs_frame().intValue() == MENU_FRAME_NO) { + routerPath = "/" + menu.getPath(); + } + // 闈炲閾惧苟涓旀槸涓�绾х洰褰曪紙绫诲瀷涓鸿彍鍗曪級 + else if (isMenuFrame(menu)) { + routerPath = "/"; + } + /**else if(menu.getMenu_type().equals(MENU_TYPE_ITEM) || menu.getMenu_type().equals(MENU_TYPE_BUTTON)){ + // 鏈夋晥鐨勮彍鍗曢」鎴栬�呮寜閽潈闄愶紝2022-11-18锛屾椂鍏嬭嫳 + String perms = menu.getPerms(); + if(StringUtils.isNotEmpty(perms)){ + routerPath = acquireUrlFromPerms(perms); + } + }*/ + return routerPath; + } + + /** + * 鏄惁涓哄唴閾剧粍浠� + * + * @param menu 鑿滃崟淇℃伅 + * @return 缁撴灉 + */ + public static boolean isInnerLink(SystemMenu menu) { + return menu.getIs_frame().intValue() == MENU_FRAME_NO && StringUtils.isHttpLink(menu.getPath()); + } + + /** + * 鍐呴摼鍩熷悕鐗规畩瀛楃鏇挎崲 + * + * @return + */ + public static String innerLinkReplaceEach(String path) { + return org.apache.commons.lang3.StringUtils.replaceEach(path + , new String[] { StringUtils.NAME_HTTP, StringUtils.NAME_HTTPS }, + new String[] { "", "" }); + } + + /** + * 鑾峰彇璺敱鍚嶇О + * + * @param menu 鑿滃崟淇℃伅 + * @return 璺敱鍚嶇О + */ + public static String getRouteName(SystemMenu menu) { + // 棣栧瓧姣嶅ぇ鍐� + String routerName = StringUtils.capitalize(menu.getPath()); + // 闈炲閾惧苟涓旀槸涓�绾х洰褰曪紙绫诲瀷涓虹洰褰曪級 + if (isMenuFrame(menu)) { + routerName = StringUtils.EMPTY_STRING; + } + return routerName; + } + + /** + * 鏄惁涓鸿彍鍗曞唴閮ㄨ烦杞��<p></p> + * 涓汉鐞嗚В: 褰撹鑿滃崟鏃犱笂绾х洰褰曪紝鍚屾椂鏄�'鑿滃崟椤�'鏃讹紝鑰屼笖 in_frame = 1(鍚�) + * + * @param menu 鑿滃崟淇℃伅 + * @return 缁撴灉 + */ + public static boolean isMenuFrame(SystemMenu menu) { + return menu.getParent_id().equals(MENU_ID_ROOT) + && MENU_TYPE_ITEM.equals(menu.getMenu_type()) + && menu.getIs_frame().intValue() == MENU_FRAME_NO; + } + + /** + * 鎶婅彍鍗曞瓧娈典腑鐨勬潈闄愭爣璇�(perms)杞崲鎴怳RL璇锋眰璺緞銆�<p></p> + * <pre> + * 1)杩欐槸鑻ヤ緷绯荤粺浣跨敤鐨勬柟寮忥紝浣嗛渶瑕佹墜鍔�(鍦ㄦ簮鐮佷腑)閰嶇疆姣忎釜璇锋眰鐨勬潈闄愭爣璇嗭紝鍥犳瑕佸噺灏戦厤缃氨瑕佹敼鎺夈�� + * 2)瀵逛簬鍏朵腑甯uery鐨勬潈闄愶紝闇�瑕佽浆鎹㈡垚(/*)浠ュ尮閰峳est鏂瑰紡鎸夌収id璁块棶銆� + * 3)鍏朵粬鐨勫熀鏈笂鎸夌収璺緞鍒嗛殧鍗冲彲锛屽: system:role:list --> /system/role/list + * </pre> + * @param perms + * @return + * @date 2022-11-02 + * @author 鏃跺厠鑻� + */ + public static final String acquireUrlFromPerms(String perms){ + if(StringUtils.isEmpty(perms)){ + throw new IllegalArgumentException("perms is required!"); + } + String[] segments = perms.split(StringUtils.SEPARATOR_COLON); + StringBuilder sb = new StringBuilder(StringUtils.FOLDER_SEPARATOR); + for(int i=0; i<segments.length; i++){ + if(i > 0){ + sb.append(StringUtils.FOLDER_SEPARATOR); + } + if(segments[i].equals(SECURITY_NAME_QUERY)){ + sb.append("*"); + } else { + sb.append(segments[i]); + } + } + return sb.toString(); + } + + public static final String SECURITY_NAME_QUERY = "query"; + + /** + * 鑿滃崟绫诲瀷: 鐩綍锛岃彍鍗曢」锛屽姛鑳芥寜閽� + */ + public static final String MENU_TYPE_FOLDER = "M"; + public static final String MENU_TYPE_ITEM = "C"; + public static final String MENU_TYPE_BUTTON = "F"; + /** + * 鏂扮晫闈紝鎸夐挳鑿滃崟绫诲瀷銆� + * @date 2023-05-12 + */ + public static final String MENU_TYPE_POINT = "A"; + + public static final String MENU_ID_ROOT = "0"; + + public static final String MENU_VISIBLE = "0"; + public static final String MENU_INVISIBLE = "1"; + + public static final int MENU_CACHE_ENABLE = 0; + public static final int MENU_CACHE_DISABLE = 1; + public static final int MENU_FRAME_YES = 0; + public static final int MENU_FRAME_NO = 1; + +// public static final String MENU_STATUS_ENABLED = "0"; +// public static final String MENU_STATUS_DISABLED = "1"; + /** + * 鑿滃崟鐘舵�侊細0 鍙敤 + * @date 2023-10-13 + */ + public static final int MENU_STATUS_ENABLED = 0; + /** + * 鑿滃崟鐘舵�侊細1 绂佺敤 + * @date 2023-10-13 + */ + public static final int MENU_STATUS_DISABLED = 1; + + /** Layout缁勪欢鏍囪瘑 */ + public final static String LAYOUT = "Layout"; + + /** ParentView缁勪欢鏍囪瘑 */ + public final static String PARENT_VIEW = "ParentView"; + + /** InnerLink缁勪欢鏍囪瘑 */ + public final static String INNER_LINK = "InnerLink"; + + /** + * 鑿滃崟鑼冨洿锛氶《绾ф満鏋勮彍鍗曪紙鎴栧晢鎴疯彍鍗曪級锛屽彧鏈変笟鍔℃満鏋勮嚜宸辨墠鑳界湅鍒般�� + * @date 2023-06-01 + */ + public static final int MENU_SCOPE_ORG = 4; + + /** + * 鑿滃崟鑼冨洿锛氬钩鍙拌彍鍗曪紝鍙鍗曚綅瀛楁锛坢enu_type == 0锛夌殑閮藉彧鏄剧ず骞冲彴鑿滃崟銆� + * @date 2023-06-01 + */ + public static final int MENU_SCOPE_PLATFORM = 0; + + /** + * 鑿滃崟鑼冨洿锛氭墍鏈夎彍鍗曪紝鍦ㄦ煇浜涘満鏅笅锛岄渶瑕佹樉绀轰换浣曡彍鍗曪紙濡傦細閭斂闆嗗洟椤圭洰绛夛紝鍏ㄧ綉銆佸熀鍦帮級 + * @date 2023-10-11 + */ + public static final int MENU_SCOPE_ALL = -1; + + /** + * 鑿滃崟鑼冨洿锛氶《绾ф満鏋勮彍鍗曪紙鎴栧晢鎴疯彍鍗曪級锛屽彧鏈変笟鍔℃満鏋勮嚜宸辨墠鑳界湅鍒般�� + * @date 2023-06-01 + */ + public static final int MENU_SCOPE_DEPT = 5; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/util/NotificationUtils.java b/iplatform-base/src/main/java/com/iplatform/base/util/NotificationUtils.java new file mode 100644 index 0000000..d7f18a5 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/util/NotificationUtils.java @@ -0,0 +1,167 @@ +package com.iplatform.base.util; + +import com.iplatform.base.config.PushProperties; +import com.iplatform.model.po.SfTemplateMessage; +import com.iplatform.model.vo.NotificationConfigVo; +import com.walker.infrastructure.arguments.Variable; +import com.walker.infrastructure.utils.DateUtils; +import com.walker.infrastructure.utils.JsonUtils; +import com.walker.infrastructure.utils.NumberGenerator; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.push.Notification; +import com.walker.push.NotificationChannel; +import com.walker.push.SmsMessage; +import com.walker.push.util.PushUtils; +import com.walker.push.wx.MessageTemplate; +import com.walker.push.wx.MessageValue; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class NotificationUtils { + + public static final Notification acquireSmsNotification(String templateId + , String userPhone, List<Variable> variableList, String title){ + Map<String, String> param = new HashMap<>(4); + for(Variable variable : variableList){ + param.put(variable.getId(), variable.getStringValue()); + } + SmsMessage smsMessage = new SmsMessage(); + smsMessage.setTemplateId(templateId); + smsMessage.setTemplateParam(param); + + try { + return PushUtils.acquireSmsNotification(title, JsonUtils.objectToJsonString(smsMessage), userPhone, "骞冲彴"); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + /** + * 鑾峰緱涓�涓井淇″叕浼楀彿鎻愰啋娑堟伅銆� + * @param accessToken 鍩虹 access_token + * @param templateId 鍏紬鍙锋秷鎭ā鏉縄D + * @param userOpenId 鐢ㄦ埛openId + * @return + * @date 2023-08-25 + */ + public static final Notification acquireWechatNotification(String accessToken + , String templateId, String userOpenId, List<Variable> variableList){ + Notification notification = new Notification(); + notification.setId(NumberGenerator.getLongSequenceId()); + notification.setTitle("寰俊鍏紬鍙锋帹閫�"); + notification.setPersistent(true); + notification.setFrom("骞冲彴"); + notification.setCreateTime(DateUtils.getDateTimeNumber()); + + List<NotificationChannel> channels = new ArrayList<>(2); + channels.add(NotificationChannel.OfficialAccount); + notification.setChannelList(channels); + + List<String> accessTokenList = new ArrayList<>(2); + accessTokenList.add(accessToken); + notification.setReceiverList(accessTokenList); + notification.setCreator("platform"); + notification.setParallel(false); + + // + MessageTemplate messageTemplate = new MessageTemplate(); + messageTemplate.setTemplate_id(templateId); + messageTemplate.setTouser(userOpenId); + + HashMap<String, MessageValue> param = new HashMap<>(4); + for(Variable variable : variableList){ + param.put(variable.getId(), new MessageValue(variable.getStringValue())); + } + messageTemplate.setData(param); + try { + notification.setContent(JsonUtils.objectToJsonString(messageTemplate)); + } catch (Exception e) { + throw new RuntimeException(e); + } + return notification; + } + + public static final NotificationConfigVo acquireNotificationConfigVo(SfTemplateMessage templateMessage){ + NotificationConfigVo vo = new NotificationConfigVo(); + vo.setId(templateMessage.getId()); + vo.setName(templateMessage.getName()); + vo.setTempId(templateMessage.getTempId()); + vo.setTempKey(templateMessage.getTempKey()); + vo.setContent(templateMessage.getContent()); +// vo.setStatus(); + return vo; + } + +// /** +// * 骞冲彴涓氬姟閫氱煡鍙敤鐨勯�氶亾闆嗗悎锛屾垜浠細灏濊瘯姣忎釜閫氶亾锛屽彧瑕佷竴涓垚鍔熷氨涓嶅啀鍙戦�併�� +// * @date 2023-04-25 +// */ +// public static final List<NotificationChannel> platformNotificationTypes = new ArrayList<>(4); +// static { +// platformNotificationTypes.add(NotificationChannel.WebSocket); +// platformNotificationTypes.add(NotificationChannel.Tcp); +// platformNotificationTypes.add(NotificationChannel.System); +// } + + /** + * 瑙f瀽鎺ㄩ�佹櫘閫氭秷鎭厤缃殑瑙勫垯銆傝缁嗗弬鑰冿細{@linkplain PushProperties#getMessageType()} + * @param messageType + * @return + * @date 2023-04-26 + */ + public static final Object[] acquireMessagePushRules(String messageType){ + if(StringUtils.isEmpty(messageType)){ + return null; + } + messageType = messageType.replace(StringUtils.CHAR_SPACE, StringUtils.EMPTY_STRING); + + Object[] data = new Object[2]; + String[] indexList = null; + if(messageType.indexOf("&&") > 0){ + data[0] = true; + indexList = messageType.split("&&"); + + } else if(messageType.indexOf("||") > 0){ + data[0] = false; + indexList = messageType.split("\\|\\|"); + } else { + data[0] = false; + indexList = new String[]{messageType}; + } + data[1] = indexList; + + return data; + } + + /** + * 鑾峰彇鍙戦�佺煭淇¢獙璇佺爜閫氱煡 + * @param templateId 妯℃澘ID + * @param code 楠岃瘉鐮� + * @param targetUserId 鐩爣鐢ㄦ埛ID + * @param creator 鍒涘缓浜篒D + * @return + * @date 2023-04-25 + */ + public static final Notification acquireSmsValidateCode(String templateId + , String code, String targetUserId, String creator){ + Map<String, String> param = new HashMap<>(2); + param.put("code", code); + return acquireSmsNotification(templateId, param, "鍙戦�侀獙璇佺爜", targetUserId, creator); + } + + public static final Notification acquireSmsNotification(String templateId + , Map<String, String> param, String title, String targetUserId, String creator){ + SmsMessage smsMessage = new SmsMessage(); + smsMessage.setTemplateId(templateId); + smsMessage.setTemplateParam(param); + + try { + return PushUtils.acquireSmsNotification(title, JsonUtils.objectToJsonString(smsMessage), targetUserId, creator); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/util/PlatformRSAUtils.java b/iplatform-base/src/main/java/com/iplatform/base/util/PlatformRSAUtils.java new file mode 100644 index 0000000..8d01b3a --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/util/PlatformRSAUtils.java @@ -0,0 +1,134 @@ +package com.iplatform.base.util; + +import com.iplatform.core.util.AESUtils; +import com.walker.infrastructure.utils.Base64; +import com.walker.infrastructure.utils.Base64Utils; +import com.walker.infrastructure.utils.RSAUtil; +import com.walker.infrastructure.utils.StringUtils; + +import java.security.KeyFactory; +import java.security.PrivateKey; +import java.security.PublicKey; +import java.security.spec.PKCS8EncodedKeySpec; +import java.security.spec.X509EncodedKeySpec; + +public class PlatformRSAUtils { + + /** + * 浣跨敤鍏叡瀵嗛挜锛岃В瀵嗗瘑鐮佹暟鎹��<p>鐩墠APP绔娇鐢紙鐢靛晢锛�</p> + * @param encryptString + * @return + * @date 2023-07-11 + */ + public static final String getAesDecryptValue(String encryptString){ + if(StringUtils.isEmpty(encryptString)){ + throw new IllegalArgumentException("鍔犲瘑鍚庡瘑鐮佷笉鑳戒负绌�"); + } + return AESUtils.decryptStrAES(encryptString, AES_KEY); + } + + /** + * 浣跨敤瀵圭О瀵嗛挜锛屽姞瀵嗘暟鎹�� + * @param text 鍘熷瀛楃涓� + * @return + * @date 2023-11-13 + */ + public static final String getAesEncryptValue(String text){ + if(StringUtils.isEmpty(text)){ + throw new IllegalArgumentException("涓嶈兘鍔犲瘑绌烘暟鎹�"); + } + return AESUtils.encryptStrAES(text, AES_KEY); + } + + /** + * 杩斿洖鍔犲瘑涔嬪墠鐨勫師濮嬪唴瀹癸紙瑙e瘑鍘熷瀛楃涓诧級 + * @param encryptString 鍔犲瘑鐨勫唴瀹癸紙RSA锛� + * @param privateKeyString 绉侀挜瀛楃涓� + * @return + * @date 2023-03-20 + */ + public static final String getRsaDecryptValue(String encryptString, String privateKeyString){ + PrivateKey privateKey = getRsaPrivateKey(privateKeyString); + if(privateKey == null){ + throw new IllegalStateException("閫氳繃绉侀挜瀛楃涓茬敓鎴�'PrivateKey'寮傚父!"); + } + return RSAUtil.decrypt(privateKey, Base64.decode(encryptString.getBytes())); + } + + /** + * 閫氳繃RSA鍏挜鍔犲瘑鏂囨湰鍐呭锛岃鏂规硶鐢ㄤ簬娴嬭瘯 + * @param text + * @return + * @date 2024-04-01 + */ + public static final String getRsaEncryptValue(String text){ + try { + PublicKey publicKey = getRsaPublicKey(PUBK); + byte[] data = RSAUtil.encrypt(publicKey, text); + return Base64Utils.encode(data); + } catch (Exception e) { + throw new RuntimeException(e); + } +// try { +// byte[] data = RSAUtil.encryptByPublicKey(text.getBytes("UTF-8"), PUBK); +// byte[] baseDecode = Base64Utils.decode(new String(data)); +// return new String(baseDecode, "UTF-8"); +// } catch (Exception e) { +// throw new RuntimeException(e); +// } + } + + /** + * 鏍规嵁绉侀挜瀛楃涓诧紝鐢熸垚瀵瑰簲鐨勭閽ュ璞°��<br>RSA鏍囧噯绠楁硶锛孭KCS8EncodedKeySpec + * @param privateKeyString + * @return + * @date 2023-03-20 + */ + public static final PrivateKey getRsaPrivateKey(String privateKeyString){ + try{ + byte[] keyBytes = Base64Utils.decode(privateKeyString); + PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance("RSA"); + PrivateKey privateK = keyFactory.generatePrivate(pkcs8KeySpec); + return privateK; + + } catch (Exception ex){ + ex.printStackTrace(); + return null; + } + } + public static final PublicKey getRsaPublicKey(String publicKeyString){ + try{ + byte[] keyBytes = Base64Utils.decode(publicKeyString); + X509EncodedKeySpec pkcs8KeySpec = new X509EncodedKeySpec(keyBytes); + KeyFactory keyFactory = KeyFactory.getInstance("RSA"); + PublicKey privateK = keyFactory.generatePublic(pkcs8KeySpec); + return privateK; + + } catch (Exception ex){ + ex.printStackTrace(); + return null; + } + } + + public static final String AES_KEY = "MIGfMA0GCSqGSIb3"; + + private static final String PUBK = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDffJ9KczIXi+nsa2Sib3rLnZ5R\n" + + "yhlY5enEhZTQc1GcTeZb6gqu4HoDJV6lskfexSNCUC/3mmNj2nruWGgRg6iVCAMB\n" + + "Uf5oMv5nVqIhZ5davy1UZ9yvwL0+yVhBSXmamUmezQlh0H3clUI1N3Hc9aCiulB6\n" + + "RMIsv1aukBkTBhgQZQIDAQAB"; + public static final String PRIK = "MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBAN98n0pzMheL6exr\n" + + "ZKJvesudnlHKGVjl6cSFlNBzUZxN5lvqCq7gegMlXqWyR97FI0JQL/eaY2Paeu5Y\n" + + "aBGDqJUIAwFR/mgy/mdWoiFnl1q/LVRn3K/AvT7JWEFJeZqZSZ7NCWHQfdyVQjU3\n" + + "cdz1oKK6UHpEwiy/Vq6QGRMGGBBlAgMBAAECgYBEyOuSE5CIVMTjwk4P/LXTs6iF\n" + + "zektRl5D4UVjPwsQS52qDofJOUf0be0KnKuoMg7fGyUYVUlf81/Aui8VrOsWmEbU\n" + + "8XL41Pi3m6EWWGeWE1/5q+j29jxYrrhfBcpBH/4fBKMhiNJ+jnJ2bH+TpngRwpNe\n" + + "nVIfxRU5FdHOL3WNIQJBAPKGUSOgynf82LEQfvpzzp8gqhGMVbnVIqtezUNPQyK2\n" + + "da7ryWYP88SE38JhB6GlM6bimCWRgIzodydccuJTd50CQQDr54J5upPlMsR3im0Q\n" + + "qCeVbrGfn+DO226cZMaUhbVwxY7xy4ewXyt4yY6vBxwYX7GYs24jZPKekyWDeqr2\n" + + "UrVpAkBmXJSwkfQC8sBO86R0dx6VgUbmwzGHjtLkO84tA65VX2eKXdCSeFct8dsz\n" + + "gpqi+kQzwt3utVvpnVB1V4rRxeLtAkEAm/2SQXwmn8BaOdHHHOSUiDOSMMM/nIlt\n" + + "Mu1QgpWHzPJV+31iVDYaQNzHBOXmphdhEGBVzAHMjR8wByjuM8OtQQJBAM8pK710\n" + + "JC6YzfchqlNMFRh6kieWEx+o+aoWtL0EmeHB56nF96QHPW09UAP2VRUdadgSD+1w\n" + + "Zmw/rOnAk8t/ryg="; +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/util/RandomUtils.java b/iplatform-base/src/main/java/com/iplatform/base/util/RandomUtils.java new file mode 100644 index 0000000..c74f14f --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/util/RandomUtils.java @@ -0,0 +1,16 @@ +package com.iplatform.base.util; + +import java.util.concurrent.ThreadLocalRandom; + +public class RandomUtils { + + /** + * 闅忔満鑼冨洿鍐呮暟瀛� + * @param startNum + * @param endNum + * @return + */ + public static Integer getRandomInt(int startNum, int endNum) { + return ThreadLocalRandom.current().nextInt(endNum-startNum) + startNum; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/util/ResponseValueUtils.java b/iplatform-base/src/main/java/com/iplatform/base/util/ResponseValueUtils.java new file mode 100644 index 0000000..c037508 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/util/ResponseValueUtils.java @@ -0,0 +1,15 @@ +package com.iplatform.base.util; + +import java.util.HashMap; +import java.util.Map; + +public class ResponseValueUtils { + + public static final Map<String, Object> acquireOneParam(String key, Object value){ + Map<String, Object> param = new HashMap<>(2); + param.put(key, value); + return param; + } + + +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/util/RestTemplateUtils.java b/iplatform-base/src/main/java/com/iplatform/base/util/RestTemplateUtils.java new file mode 100644 index 0000000..6d27685 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/util/RestTemplateUtils.java @@ -0,0 +1,61 @@ +package com.iplatform.base.util; + +import com.fasterxml.jackson.databind.node.ObjectNode; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.http.HttpEntity; +import org.springframework.http.HttpHeaders; +import org.springframework.http.HttpMethod; +import org.springframework.http.MediaType; +import org.springframework.http.ResponseEntity; +import org.springframework.web.client.RestTemplate; + +import java.util.Map; + +public class RestTemplateUtils { + + protected static final Logger logger = LoggerFactory.getLogger(RestTemplateUtils.class); + + /** + * 璇锋眰杩滅▼璋冪敤锛岃緭鍏ml鏍煎紡鏁版嵁 + * @param url + * @param xml + * @param restTemplate + * @return + * @date 2023-08-10 + */ + public static final String postXml(String url, String xml, RestTemplate restTemplate){ + HttpHeaders headers = new HttpHeaders(); + MediaType type = MediaType.parseMediaType("application/xml; charset=UTF-8"); + headers.setContentType(type); + HttpEntity<String> requestEntity = new HttpEntity<>(xml, headers); + ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, requestEntity, String.class); + try{ + logger.debug("responseEntity = "+responseEntity); + return responseEntity.getBody(); +// return new String(Objects.requireNonNull(responseEntity.getBody()).getBytes(StandardCharsets.UTF_8), StandardCharsets.UTF_8); + }catch (Exception e){ + logger.error("postXml寮傚父锛寀rl=" + url + ", " + e.getMessage(), e); + return null; + } + } + + /** + * 鍙戦�丟ET璇锋眰 + * @param url 璇锋眰鍦板潃 + * @param restTemplate + * @return + * @date 2023-07-16 + * @date 2023-08-10 鏂规硶鎶借薄鐨勪笉濂斤紝搴熷純銆� + */ + @Deprecated + public static final ObjectNode getData(String url, RestTemplate restTemplate) { + HttpHeaders headers = new HttpHeaders(); + headers.add("user-agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36"); +// headers.setContentType(MediaType.APPLICATION_JSON); + HttpEntity<Map<String, Object>> requestEntity = new HttpEntity<>( headers); + ResponseEntity<ObjectNode> response = restTemplate.exchange( url, HttpMethod.GET, requestEntity, ObjectNode.class); + logger.debug(response.toString()); + return response.getBody(); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/util/RoleUtils.java b/iplatform-base/src/main/java/com/iplatform/base/util/RoleUtils.java new file mode 100644 index 0000000..07aec25 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/util/RoleUtils.java @@ -0,0 +1,41 @@ +package com.iplatform.base.util; + +import com.iplatform.base.SecurityConstants; +import com.walker.infrastructure.utils.StringUtils; + +import java.util.ArrayList; +import java.util.List; + +public class RoleUtils { + + /** + * 鎶婄櫥褰曠紦瀛樹腑鐨勮鑹瞚d鍜屼粠鏁版嵁搴撳姞杞界殑鐢ㄦ埛鑿滃崟瑙掕壊鍚堝苟鍒颁竴璧枫�� + * <pre> + * 1) 鐧诲綍缂撳瓨涓繚瀛樼殑瑙掕壊鍒嗕袱閮ㄥ垎锛� + * 1.1 鐢ㄦ埛瑙掕壊id锛屽嵆锛歴_role 涓繚瀛樼殑id + * 1.2 Security瀹氫箟鐨勮鑹插悕绉帮紝濡傦細ROLE_USER / ROLE_ADMIN/ ROLE_SUPER 绛夈�� + * 2) 鐢ㄦ埛閲嶆柊鑾峰彇鑿滃崟鏉冮檺鍚庯紝瑙掕壊ID浠庢暟鎹簱鏌ヨ锛堝洜涓哄瓨鍦ㄨ鑹茬鐢ㄣ�佸垹闄ょ瓑锛� + * 3) 涓轰簡淇濇寔瀹炴椂鎬э紝鏈�缁堣鍚堝苟杩欎袱閮ㄥ垎瑙掕壊ID锛屽惁鍒欎細鍑虹幇娌℃湁鏉冮檺璁块棶閿欒銆� + * </pre> + * @param loginCacheRoles 鐧诲綍缂撳瓨涓殑瑙掕壊ID闆嗗悎 + * @param menuRoles 浠庢暟鎹簱鍔犺浇鐨勮彍鍗曡鑹睮D闆嗗悎 + * @return + * @date 2024-01-31 + */ + public static final List<String> combineMenuRoleAndSecurityRole(List<String> loginCacheRoles, List<String> menuRoles){ + if(StringUtils.isEmptyList(menuRoles)){ + return loginCacheRoles; + } + List<String> data = new ArrayList<>(8); + for(String securityRoleName : loginCacheRoles){ + if(securityRoleName.equals(SecurityConstants.ROLE_USER) + || securityRoleName.equals(SecurityConstants.ROLE_ADMIN) + || securityRoleName.equals(SecurityConstants.ROLE_SUPER_ADMIN) + || securityRoleName.equals(SecurityConstants.ROLE_MERCHANT)){ + data.add(securityRoleName); + } + } + data.addAll(menuRoles); + return data; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/util/TextUtils.java b/iplatform-base/src/main/java/com/iplatform/base/util/TextUtils.java new file mode 100644 index 0000000..4f8e21b --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/util/TextUtils.java @@ -0,0 +1,83 @@ +package com.iplatform.base.util; + +import com.walker.infrastructure.utils.StringUtils; + +import java.util.ArrayList; +import java.util.List; + +public class TextUtils { + + public static List<Long> stringToLongArrayByRegex(String str, String regex) { + List<Long> list = new ArrayList<>(8); + if (str.contains(regex)) { + String[] split = str.split(regex); + for (String value : split) { + if (StringUtils.isNotEmpty(value)) { + list.add(Long.parseLong(value.trim())); + } + } + } else { + list.add(Long.parseLong(str)); + } + return list; + } + + /** + * 瀛楃涓插垎鍓诧紝杞寲涓烘暟缁� + * + * @param str 瀛楃涓� + * @param regex 鍒嗛殧绗︽湁 + * @return List<Integer> + + * @date 2023-05-17 + */ + public static List<Integer> stringToArrayByRegex(String str, String regex) { + List<Integer> list = new ArrayList<>(); + if (str.contains(regex)) { + String[] split = str.split(regex); + for (String value : split) { + if (StringUtils.isNotEmpty(value)) { + list.add(Integer.parseInt(value.trim())); + } + } + } else { + list.add(Integer.parseInt(str)); + } + return list; + } + + /** + * 缁欏畾瀛楃涓查瀛楁瘝澶у啓銆傛殏鏃舵湭浣跨敤锛屼粛鐒剁敤 apache-common 鍖呫�� + * @param str + * @return + */ + @Deprecated + public static String capitalize(String str) { + final int strLen = length(str); + if (strLen == 0) { + return str; + } + + final int firstCodepoint = str.codePointAt(0); + final int newCodePoint = Character.toTitleCase(firstCodepoint); + if (firstCodepoint == newCodePoint) { + // already capitalized + return str; + } + + final int[] newCodePoints = new int[strLen]; // cannot be longer than the char array + int outOffset = 0; + newCodePoints[outOffset++] = newCodePoint; // copy the first codepoint + for (int inOffset = Character.charCount(firstCodepoint); inOffset < strLen; ) { + final int codepoint = str.codePointAt(inOffset); + newCodePoints[outOffset++] = codepoint; // copy the remaining ones + inOffset += Character.charCount(codepoint); + } + return new String(newCodePoints, 0, outOffset); + } + + public static int length(CharSequence cs) { + return cs == null ? 0 : cs.length(); + } + +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/util/TokenUtils.java b/iplatform-base/src/main/java/com/iplatform/base/util/TokenUtils.java new file mode 100644 index 0000000..fcc3992 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/util/TokenUtils.java @@ -0,0 +1,129 @@ +package com.iplatform.base.util; + +import com.iplatform.base.VariableConstants; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.web.Constants; +import com.walker.web.TokenGenerator; +import jakarta.servlet.http.HttpServletRequest; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class TokenUtils { + + private static final transient Logger logger = LoggerFactory.getLogger(TokenUtils.class); + + private static final long SECONDS_FOR_ONE_MINUTE = 60; + +// private static final long MINUTE_FOR_TOKEN_REFRESH_LEFT = 10; // token鍓╀綑10鍒嗛挓鏃舵彁绀哄墠绔埛鏂皌oken + + /** + * 缂撳瓨鐧诲綍鍒嗛挓鏁帮紝搴斿綋姣攖oken鏃堕棿灏戝嚑鍒嗛挓(榛樿5)锛岃繖鏍蜂繚璇乼oken澶辨晥鍓嶏紝redis娓呴櫎鐧诲綍淇℃伅锛�<br> + * 绯荤粺鑳介�氱煡缁堢鍒锋柊token銆� + * @date 2022-11-15 + */ + private static final long MINUTE_FOR_CACHE_LOGIN_LESS = 5; + + /** + * 鐢熸垚涓�涓猼oken锛岀粺涓�鏂规硶璋冪敤锛屼笟鍔¢兘璋冪敤璇ユ柟娉曘�� + * @param userId 鐢ㄦ埛ID + * @param loginId 鐢ㄦ埛鐧诲綍鍚� + * @param uuid 鐢熸垚鐨勯殢鏈烘暟 + * @param tokenGenerator + * @param expiredMinutes 澶辨晥鍒嗛挓鏁� + * @return + * @date 2022-11-15 + * @date 2023-03-28 娣诲姞澶辨晥鏃堕棿鍙傛暟: expiredMinutes + */ + public static final String generateToken(String userId + , String loginId, String uuid, TokenGenerator tokenGenerator, long expiredMinutes){ + StringBuilder tokenData = new StringBuilder(userId); + tokenData.append(StringUtils.DEFAULT_SPLIT_SEPARATOR); + tokenData.append(loginId); + return tokenGenerator.createToken(uuid, tokenData.toString() +// , VariableConstants.DEFAULT_TOKEN_EXPIRED_MINUTES + , expiredMinutes + , VariableConstants.TOKEN_SECRET); + } + +// /** +// * 鍒ゆ柇鏄惁閲嶆柊鑾峰彇(鍒锋柊)token +// * @param tokenExpiredMinutes 閰嶇疆鐨則oken杩囨湡鏃堕棿(鍒嗛挓) +// * @param tokenCreateMills token鍒涘缓姣鍊� +// * @return +// * @date 2022-11-14 +// */ +// public static final boolean isTokenRefresh(long tokenExpiredMinutes, long tokenCreateMills){ +// long currentTime = System.currentTimeMillis(); +// if(currentTime < tokenCreateMills){ +// logger.error("褰撳墠鏃堕棿涓嶈兘澶т簬 'tokenCreateMills'"); +// return false; +// } +// long durationSeconds = (currentTime - tokenCreateMills) / 1000; +// long tokenExpiredLeftMinute = tokenExpiredMinutes - durationSeconds/60; +// if(tokenExpiredLeftMinute <= 0){ +// logger.warn("token宸茬粡杩囨湡锛屾棤闇�'refreshToken'"); +// return false; +// } +// if(tokenExpiredLeftMinute < MINUTE_FOR_TOKEN_REFRESH_LEFT){ +// return true; +// } +// return false; +// } + + /** + * 鑾峰緱缂撳瓨鐢ㄦ埛鐨勮繃鏈熸椂闂达紝璇ユ椂闂磋姣攖oken鐢熸垚杩囨湡鏃堕棿鐣ラ暱(5鍒嗛挓)銆� + * @param tokenExpiredMinutes token杩囨湡鍒嗛挓鏁� + * @return 杩斿洖缂撳瓨鐢ㄦ埛鏃堕棿(绉�) + * @date 2022-11-14 + */ + public static final long acquireCacheUserExpiredSeconds(long tokenExpiredMinutes){ + if(tokenExpiredMinutes <= 0){ + throw new IllegalArgumentException("tokenExpiredMinutes 蹇呴』澶т簬0"); + } + if(tokenExpiredMinutes < MINUTE_FOR_CACHE_LOGIN_LESS){ + throw new IllegalArgumentException("璁剧疆鐨則oken澶辨晥鏃堕棿(鍒嗛挓)杩囩煭:" + tokenExpiredMinutes + ", 璇烽噸鏂拌缃��"); + } + return (tokenExpiredMinutes - MINUTE_FOR_CACHE_LOGIN_LESS) * SECONDS_FOR_ONE_MINUTE; + } + + /** + * 杩斿洖token涓笟鍔℃暟鎹紝鐢ㄦ埛缂撳瓨鐨刱ey锛屼互鍙婄敤鎴稩D + 鐧诲綍ID(2022-11-15杩藉姞) + * @param tokenData + * @return array[0] = user_id, array[1] = login_id, array[2] = user_key + */ + public static final String[] getUserIdAndKey(String tokenData){ + if(StringUtils.isEmpty(tokenData)){ + return null; + } + return tokenData.split(StringUtils.DEFAULT_SPLIT_SEPARATOR); + } + + public static final String getAuthorizationToken(HttpServletRequest request){ + // Constants.TOKEN_HEADER + return getAuthorizationToken(request, Constants.TOKEN_HEADER); + } + + /** + * 浠嶩TTP璇锋眰涓幏鍙栨巿鏉僼oken锛岄粯璁oken鍚嶅瓧锛欰uthorization + * @param request + * @param tokenName token鍚嶅瓧 + * @return + * @author 鏃跺厠鑻� + * @date 2022-11-02 + */ + public static final String getAuthorizationToken(HttpServletRequest request, String tokenName){ + String token = request.getHeader(tokenName); + if(StringUtils.isEmpty(token)){ + // 濡傛灉header涓笉瀛樺湪锛屽氨鍦ㄥ弬鏁颁腑鏌ユ壘 + token = request.getParameter(tokenName); + } + if(StringUtils.isEmpty(token)){ + return null; + } + if(token.startsWith(Constants.TOKEN_PREFIX)){ + token = token.replace(Constants.TOKEN_PREFIX, StringUtils.EMPTY_STRING); + } + return token; + } + +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/util/UserUtils.java b/iplatform-base/src/main/java/com/iplatform/base/util/UserUtils.java new file mode 100644 index 0000000..ddc7b98 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/util/UserUtils.java @@ -0,0 +1,244 @@ +package com.iplatform.base.util; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.iplatform.base.Constants; +import com.iplatform.base.DefaultUserPrincipal; +import com.iplatform.base.SecuritySpi; +import com.iplatform.base.pojo.UserInfo; +import com.iplatform.core.BeanContextAware; +import com.iplatform.model.po.S_user_core; +import com.walker.infrastructure.utils.DateUtils; +import com.walker.infrastructure.utils.JsonUtils; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.web.DataStatus; +import com.walker.web.UserPrincipal; +import com.walker.web.UserType; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +public class UserUtils { + + /** + * 杩斿洖鍓嶇锛圥C锛夌敤鎴峰熀鏈俊鎭紝鐢靛晢绯荤粺浣跨敤璇ュ璞°�� + * @param user_core + * @param token + * @return + * @date 2023-05-12 + */ + public static final UserInfo acquireClientUserInfo(S_user_core user_core, String token){ + UserInfo userInfo = new UserInfo(); + userInfo.setAccount(user_core.getUser_name()); + userInfo.setRealName(user_core.getNick_name()); + userInfo.setToken(token); + userInfo.setIsSms(false); + return userInfo; + } + + public static DefaultUserPrincipal SUPER_VISOR = null; + + /** + * 姝e紡浠g爜锛屽垱寤鸿秴绾х鐞嗗憳鐢ㄦ埛鐧诲綍瀵硅薄 + * @return + */ + public static final UserPrincipal<S_user_core> createSupervisor(String supervisorPassword){ + if(SUPER_VISOR != null){ + return SUPER_VISOR; + } + + S_user_core userCore = new S_user_core(); + userCore.setId(Constants.SUPERVISOR_ID); +// userCore.setCreateTime(DateUtils.getDateTimeNumber(System.currentTimeMillis())); + userCore.setCreate_time(DateUtils.getDateTimeNumber(System.currentTimeMillis())); + userCore.setStatus(DataStatus.CONST_NORMAL); + userCore.setUser_name(Constants.SUPERVISOR_NAME_DEFAULT); + userCore.setNick_name(Constants.SUPERVISOR_NAME_ZH); +// userCore.setPassword("123456"); // 杩欓噷瑕佷慨鏀癸紝搴旇瀛樺偍鍔犲瘑杩囧悗鐨勫瘑鐮佷俊鎭� + userCore.setPassword(supervisorPassword); + userCore.setUser_type(UserType.TYPE_SUPER); + userCore.setOrg_id(Constants.SUPERVISOR_ID); + userCore.setDept_id(Constants.SUPERVISOR_ID); + userCore.setMer_id(Constants.SUPERVISOR_ID); + userCore.setModify_pwd(1); + userCore.setIs_sms(0); + userCore.setType(0); + userCore.setProfile_id(Constants.SUPERVISOR_ID); + userCore.setIs_wechat_android(0); + userCore.setIs_wechat_ios(0); + userCore.setIs_wechat_routine(0); + userCore.setIs_wechat_public(0); + userCore.setBind_mail(0); + userCore.setBind_mobile(0); + userCore.setBind_wechat(0); + userCore.setBind_client_id("client_id"); + + DefaultUserPrincipal userPrincipal = new DefaultUserPrincipal(userCore); + SUPER_VISOR = userPrincipal; + return SUPER_VISOR; + } + + /** + * 宸ュ叿鏂规硶: 杩斿洖褰撳墠鐧诲綍鐢ㄦ埛瀵硅薄銆� + * @return + * @date 2023-02-14 + */ + public static final S_user_core getUserInfo(){ + return BeanContextAware.getBeanByType(SecuritySpi.class).getCurrentUser(); + } + + /** + * 杩斿洖褰撳墠鐧诲綍鐢ㄦ埛锛屽鏋滀笉瀛樺湪杩斿洖锛歯ull + * @return + * @date 2023-08-01 + */ + public static final UserPrincipal<S_user_core> getCurrentUserPrincipal(){ + return BeanContextAware.getBeanByType(SecuritySpi.class).getCurrentUserPrincipal(); + } + + /** + * 鎶婄敤鎴风紦瀛榡son瀛楃涓茶浆鎹㈡垚瀵硅薄銆� + * @param userJson + * @return + * @throws Exception + * @date 2022-12-30 + */ + public static final DefaultUserPrincipal toUserPrincipal(String userJson) throws Exception{ + ObjectNode objectNode = JsonUtils.jsonStringToObjectNode(userJson); + return createUserPrincipal(objectNode); + } + + private static final DefaultUserPrincipal createUserPrincipal(ObjectNode objectNode){ + JsonNode userInfoNode = objectNode.get("userInfo"); + S_user_core user_core = new S_user_core(); + user_core.setId(userInfoNode.get("id").asLong()); + user_core.setUser_name(userInfoNode.get("user_name").asText()); + user_core.setPassword(userInfoNode.get("password").asText()); + user_core.setDept_id(userInfoNode.get("dept_id").asLong()); + user_core.setNick_name(userInfoNode.get("nick_name").asText()); + user_core.setUser_type(userInfoNode.get("user_type").asInt()); + user_core.setCreate_time(userInfoNode.get("create_time").asLong()); + user_core.setOrg_id(userInfoNode.get("org_id").asLong()); + user_core.setStatus(userInfoNode.get("status").asInt()); + user_core.setDel_flag(userInfoNode.get("del_flag").asInt()); + if(!JsonUtils.isEmptyObject(userInfoNode.get("sex"))){ + user_core.setSex(userInfoNode.get("sex").asText()); + } else { + user_core.setSex("2"); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("phonenumber"))){ + user_core.setPhonenumber(userInfoNode.get("phonenumber").asText()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("avatar"))){ + user_core.setAvatar(userInfoNode.get("avatar").asText()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("email"))){ + user_core.setEmail(userInfoNode.get("email").asText()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("remark"))){ + user_core.setRemark(userInfoNode.get("remark").asText()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("create_by"))){ + user_core.setCreate_by(userInfoNode.get("create_by").asText()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("login_date"))){ + user_core.setLogin_date(userInfoNode.get("login_date").asLong()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("login_ip"))){ + user_core.setLogin_ip(userInfoNode.get("login_ip").asText()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("update_by"))){ + user_core.setUpdate_by(userInfoNode.get("update_by").asText()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("update_time"))){ + user_core.setUpdate_time(userInfoNode.get("update_time").asLong()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("wx_open_id"))){ + user_core.setWx_open_id(userInfoNode.get("wx_open_id").toString()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("wx_union_id"))){ + user_core.setWx_union_id(userInfoNode.get("wx_union_id").toString()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("ding_user_id"))){ + user_core.setDing_user_id(userInfoNode.get("ding_user_id").toString()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("bind_client_id"))){ + user_core.setBind_client_id(userInfoNode.get("bind_client_id").toString()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("bind_wechat"))){ + user_core.setBind_wechat(userInfoNode.get("bind_wechat").intValue()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("modify_pwd"))){ + user_core.setModify_pwd(userInfoNode.get("modify_pwd").intValue()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("bind_mobile"))){ + user_core.setBind_mobile(userInfoNode.get("bind_mobile").intValue()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("bind_mail"))){ + user_core.setBind_mail(userInfoNode.get("bind_mail").intValue()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("profile_id"))){ + user_core.setProfile_id(userInfoNode.get("profile_id").longValue()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("is_wechat_public"))){ + user_core.setIs_wechat_public(userInfoNode.get("is_wechat_public").intValue()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("is_wechat_routine"))){ + user_core.setIs_wechat_routine(userInfoNode.get("is_wechat_routine").intValue()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("is_wechat_ios"))){ + user_core.setIs_wechat_ios(userInfoNode.get("is_wechat_ios").intValue()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("is_wechat_android"))){ + user_core.setIs_wechat_android(userInfoNode.get("is_wechat_android").intValue()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("is_sms"))){ + user_core.setIs_sms(userInfoNode.get("is_sms").intValue()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("mer_id"))){ + user_core.setMer_id(userInfoNode.get("mer_id").longValue()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("type"))){ + user_core.setType(userInfoNode.get("type").intValue()); + } + JsonNode roleIdListJson = objectNode.get("roleIdList"); + List<String> roleList = new ArrayList<>(4); + if(roleIdListJson.isArray()){ + for(Iterator<JsonNode> it = roleIdListJson.iterator(); it.hasNext();){ + roleList.add(it.next().asText()); + } + } + + DefaultUserPrincipal defaultUserPrincipal = new DefaultUserPrincipal(user_core); + defaultUserPrincipal.setRoleIdList(roleList); + + // 2022-12-21 + JsonNode dataScopeMap = objectNode.get("dataScopeMap"); + if(dataScopeMap != null){ + String functionMenuId = null; + for(Iterator<String> it = dataScopeMap.fieldNames(); it.hasNext();){ + functionMenuId = it.next(); + defaultUserPrincipal.addDataScope(functionMenuId, dataScopeMap.get(functionMenuId).asText()); + } + } + + return defaultUserPrincipal; + } + + /** + * 鎶婅鑹睮D瀛楃涓查泦鍚堣浆鎴愭暟鍊奸泦鍚堛�� + * @param roleIds + * @return + */ + public static final List<Long> toRoleIdLongList(List<String> roleIds){ + if(StringUtils.isEmptyList(roleIds)){ + return null; + } + List<Long> roleList = new ArrayList<>(4); + for(String roleId : roleIds){ + roleList.add(Long.parseLong(roleId)); + } + return roleList; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/util/VerifyImgUtil.java b/iplatform-base/src/main/java/com/iplatform/base/util/VerifyImgUtil.java new file mode 100644 index 0000000..1151f36 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/util/VerifyImgUtil.java @@ -0,0 +1,209 @@ +package com.iplatform.base.util; + +import com.iplatform.base.PlatformRuntimeException; +import com.walker.infrastructure.utils.Base64Utils; +import com.walker.infrastructure.utils.FileCopyUtils; +import com.walker.infrastructure.utils.StringUtils; + +import javax.imageio.ImageIO; +import java.awt.AlphaComposite; +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import java.io.BufferedOutputStream; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.security.SecureRandom; +//import java.util.Base64; +import java.util.HashMap; +import java.util.Map; + +/** + * 绉绘瀵硅薄锛屾嫾鍥炬粦鍧楀璞″鐞嗗伐鍏凤紝鍚庣画闇�瑕侀噸鏋勪紭鍖栥�� + * @author 鏃跺厠鑻� + * @date 2023-04-06 + */ +public class VerifyImgUtil { + private static int T_WIDTH = 320; //婧愭枃浠跺搴� + private static int T_HEIGHT = 180; //婧愭枃浠堕珮搴� + + /* + * @Author : liu.q [916000612@qq.com] + * @Date : 2019-06-24 15:46 + * @Description : 闅忔満鐢熸垚鎶犲浘鍧愭爣 + */ + public static Map<String, Integer> generateCutoutCoordinates(int w, int h) { + Map<String, Integer> result = new HashMap(); + int x = new SecureRandom().nextInt(T_WIDTH - w); + int y = new SecureRandom().nextInt(T_HEIGHT - h); + while (x < w + 10) { + x = new SecureRandom().nextInt(275); + } + result.put("x", x); + result.put("y", y); + return result; + } + + /* + * @Author : liu.q [916000612@qq.com] + * @Date : 2019-06-24 16:22 + * @Description :鐢熸垚婊戝潡 + */ + public static Map<String, BufferedImage> initSlidingBlock(BufferedImage sourceImg, int[][] templateImgData, int x, int y, int w, int h) throws Exception { + // 鏀寔alpha閫氶亾鐨剅gb鍥惧儚 + BufferedImage newTemplateImg = new BufferedImage(w, h, BufferedImage.TYPE_4BYTE_ABGR); + + for (int i = 0; i < templateImgData.length; i++) { + for (int j = 0; j < templateImgData[0].length; j++) { + int rgb = templateImgData[i][j]; + if (rgb == 1) { + int rgb_ori = sourceImg.getRGB(x + i, y + j); + int r = (0xff & rgb_ori); + int g = (0xff & (rgb_ori >> 8)); + int b = (0xff & (rgb_ori >> 16)); + rgb_ori = r + (g << 8) + (b << 16) + (255 << 24); + newTemplateImg.setRGB(i, j, rgb_ori); + + //鍒涘缓閬僵灞� + BufferedImage cover = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB); + Graphics2D coverG2 = (Graphics2D) cover.getGraphics(); + coverG2.setColor(Color.BLACK); + coverG2.fillRect(0, 0, 10, 10); + coverG2.dispose(); + Graphics2D bgG2 = (Graphics2D) sourceImg.getGraphics(); + //寮�鍚�忔槑搴� + bgG2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 0.5f)); + //鎻忕粯 + bgG2.drawImage(cover, i + x, y + j, 1, 1, null); + //缁撴潫閫忔槑搴� + bgG2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); + bgG2.dispose(); + } + if (rgb == 0) { + //涓嶇敤鎼悊 + } + if (rgb == 2) { + //绉掕竟 + newTemplateImg.setRGB(i, j, 16777215); + sourceImg.setRGB(x + i, y + j, 16777215); + } + } + } + Map<String, BufferedImage> result = new HashMap<>(); + result.put("newTemplateImg", newTemplateImg); + result.put("newSourceImg", sourceImg); + return result; + } + + + /* + * @Author : liu.q [916000612@qq.com] + * @Date : 2019-06-21 15:37 + * @Description : 鑾峰彇base64 + */ + public static String getBase64(BufferedImage bi) { + ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); + String res = StringUtils.EMPTY_STRING; + try { + ImageIO.write(bi, "png", outputStream); +// res = Base64.getEncoder().encodeToString(outputStream.toByteArray()); + res = Base64Utils.encode(outputStream.toByteArray()); + res = "data:image/png;base64," + res; + } catch (Exception e) { + throw new PlatformRuntimeException("楠岃瘉鐮佸浘鐗囦紶base64閿欒:" + e.getMessage(), e); + } finally { + try { + outputStream.close(); + } catch (IOException e) { + throw new RuntimeException(e); + } + } + return res; + } + + /** + * hash 杞崲 + * + * @param base64 String 鍥剧墖娴� + * @return String + + * @since 2020-06-03 + */ + public static String getBase64Image(String base64) { + return "data:image/png;base64," + base64; + } + + /* + * @Author : liu.q [916000612@qq.com] + * @Date : 2019-06-24 17:22 + * @Description : 鐢熸垚鎶犲浘鍥惧舰鐭╅樀 + */ + public static int[][] getTemplateData(BufferedImage bi) { + int[][] data = new int[bi.getWidth()][bi.getHeight()]; + for (int i = 0; i < bi.getWidth(); i++) { + for (int j = 0; j < bi.getHeight(); j++) { + int rgb = bi.getRGB(i, j); + int leftRgb = -1, rightRgb = -1, upRgb = -1, downRgb = -1; + if (j > 0) + leftRgb = bi.getRGB(i, j - 1); + if (j < bi.getHeight() - 1) + rightRgb = bi.getRGB(i, j + 1); + if (i > 0) + upRgb = bi.getRGB(i - 1, j); + if (i < bi.getWidth() - 1) + downRgb = bi.getRGB(i + 1, j); + if (rgb == -1 && (i == 0 || i == bi.getWidth() - 1 || j == 0 || j == bi.getHeight() - 1)) { + data[i][j] = 2; //杈� + } else if (rgb == -1 && (leftRgb != -1 || rightRgb != -1 || upRgb != -1 || downRgb != -1)) { + data[i][j] = 2;//杈� + } else if (rgb == -1) { + data[i][j] = 1;//鍐呭鍖哄煙 + } else { + data[i][j] = 0;//閫忔槑鍖哄煙 + } + } + } + return data; + } + + /** + * base64 瀛楃涓茶浆鍥剧墖 + * + * @param base64String + * @return + */ + public static BufferedImage getBase64StrToImage(String base64String) { + ByteArrayInputStream inputStream = null; + try { +// Base64.Decoder decoder = Base64.getDecoder(); +// byte[] bytes = decoder.decode(base64String); + byte[] bytes = Base64Utils.decode(base64String); + inputStream = new ByteArrayInputStream(bytes); + return ImageIO.read(inputStream); + } catch (Exception e) { + throw new PlatformRuntimeException("楠岃瘉鐮乥ase64杞枃浠堕敊璇�:" + e.getMessage(), e); + } finally { + if(inputStream != null){ + try { + inputStream.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } + } + + public static void writeBase64ToFile(String base64String, File outFile){ + BufferedOutputStream outputStream = null; + try{ + byte[] bytes = Base64Utils.decode(base64String); + outputStream = new BufferedOutputStream(new FileOutputStream(outFile)); + FileCopyUtils.copy(bytes, outputStream); + }catch (Exception ex){ + throw new PlatformRuntimeException("鏂囦欢base64淇濆瓨鏂囦欢閿欒:" + ex.getMessage() + ", file=" + outFile.getAbsolutePath(), ex); + } + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/util/cache/CacheInfo.java b/iplatform-base/src/main/java/com/iplatform/base/util/cache/CacheInfo.java new file mode 100644 index 0000000..7456981 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/util/cache/CacheInfo.java @@ -0,0 +1,69 @@ +package com.iplatform.base.util.cache; + +import com.walker.infrastructure.utils.StringUtils; + +/** + * 鍓嶇鏄剧ず鐨勭紦瀛樹俊鎭�� + * @date 2023-01-04 + */ +public class CacheInfo { + + /** 缂撳瓨鍚嶇О */ + private String cacheName = StringUtils.EMPTY_STRING; + + /** 缂撳瓨閿悕 */ + private String cacheKey = StringUtils.EMPTY_STRING; + + /** 缂撳瓨鍐呭 */ + private String cacheValue = StringUtils.EMPTY_STRING; + + /** 澶囨敞 */ + private String remark = StringUtils.EMPTY_STRING; + + public CacheInfo() {} + + public CacheInfo(String cacheName, String remark) { + this.cacheName = cacheName; + this.remark = remark; + } + + public CacheInfo(String cacheName, String cacheKey, String cacheValue) { +// this.cacheName = StringUtils.replace(cacheName, ":", ""); +// this.cacheKey = StringUtils.replace(cacheKey, cacheName, ""); + this.cacheName = cacheName; + this.cacheKey = cacheKey; + this.cacheValue = cacheValue; + } + + public String getCacheName() { + return cacheName; + } + + public void setCacheName(String cacheName) { + this.cacheName = cacheName; + } + + public String getCacheKey() { + return cacheKey; + } + + public void setCacheKey(String cacheKey) { + this.cacheKey = cacheKey; + } + + public String getCacheValue() { + return cacheValue; + } + + public void setCacheValue(String cacheValue) { + this.cacheValue = cacheValue; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/util/cache/CategorySortComparator.java b/iplatform-base/src/main/java/com/iplatform/base/util/cache/CategorySortComparator.java new file mode 100644 index 0000000..a4d7f70 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/util/cache/CategorySortComparator.java @@ -0,0 +1,23 @@ +package com.iplatform.base.util.cache; + +import com.iplatform.model.po.S_category; + +import java.util.Comparator; + +/** + * 骞冲彴鍒嗙被瀵硅薄鎺掑簭瑙勫垯锛岀紦瀛樹娇鐢ㄣ�� + * <p>order by sort desc, id asc</p> + * @author 鏃跺厠鑻� + * @date 2023-05-17 + */ +public class CategorySortComparator implements Comparator<S_category> { + + @Override + public int compare(S_category o1, S_category o2) { + int sortNum = o2.getSort() - o1.getSort(); + if(sortNum != 0){ + return sortNum; + } + return o2.getId() - o1.getId(); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/util/dept/SystemDept.java b/iplatform-base/src/main/java/com/iplatform/base/util/dept/SystemDept.java new file mode 100644 index 0000000..d6fa195 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/util/dept/SystemDept.java @@ -0,0 +1,42 @@ +package com.iplatform.base.util.dept; + +import com.iplatform.model.po.S_dept; + +import java.util.ArrayList; +import java.util.List; + +/** + * 杩斿洖鍓嶇缁勭粐鏍戠粨鏋勪娇鐢紝treeselect缁勪欢锛岀洰鍓嶈繕娌℃湁鐮旂┒閫忓交锛屾槸鍚﹂渶瑕佹敼瀵硅薄銆� + * @date 2022-12-03 + * @author 鏃跺厠鑻� + */ +public class SystemDept extends S_dept { + + public List<SystemDept> getChildren() { + return children; + } + + public void setChildren(List<SystemDept> children) { + this.children = children; + } + + private List<SystemDept> children = new ArrayList<>(); + + public SystemDept(S_dept dept){ + this.setId(dept.getId()); + this.setParent_id(dept.getParent_id()); + this.setOrder_num(dept.getOrder_num()); + this.setStatus(dept.getStatus()); + this.setDept_name(dept.getDept_name()); + this.setOrg_id(dept.getOrg_id()); + this.setAncestors(dept.getAncestors()); + this.setOrg_type(dept.getOrg_type()); + this.setDel_flag(dept.getDel_flag()); + this.setAttribute(dept.getAttribute()); + this.setCharge_man(dept.getCharge_man()); + this.setCreate_time(dept.getCreate_time()); + this.setEmail(dept.getEmail()); + this.setPhone(dept.getPhone()); + this.setLeader(dept.getLeader()); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/util/dict/SystemDictData.java b/iplatform-base/src/main/java/com/iplatform/base/util/dict/SystemDictData.java new file mode 100644 index 0000000..02e76dc --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/util/dict/SystemDictData.java @@ -0,0 +1,18 @@ +package com.iplatform.base.util.dict; + +import com.iplatform.model.po.S_dict_data; + +@Deprecated +public class SystemDictData extends S_dict_data { + + public int getChildSum() { + return childSum; + } + + public void setChildSum(int childSum) { + this.childSum = childSum; + } + + private int childSum = 0; + +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/util/menu/MenuOrderNumComparator.java b/iplatform-base/src/main/java/com/iplatform/base/util/menu/MenuOrderNumComparator.java new file mode 100644 index 0000000..92b5f25 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/util/menu/MenuOrderNumComparator.java @@ -0,0 +1,18 @@ +package com.iplatform.base.util.menu; + +import com.iplatform.model.po.S_menu; + +import java.util.Comparator; + +/** + * 鍦� OpenJDK 涓紝闇�瑕佹帓搴忚鍒欑鍚堬細涓変釜瑙勫垯锛屽洜姝よ彍鍗曟帓搴忓垎寮�鍐欍�� + * @author 鏃跺厠鑻� + * @date 2023-11-14 + */ +public class MenuOrderNumComparator implements Comparator<S_menu> { + + @Override + public int compare(S_menu o1, S_menu o2) { + return o1.getOrder_num() - o2.getOrder_num(); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/util/menu/MenuTree.java b/iplatform-base/src/main/java/com/iplatform/base/util/menu/MenuTree.java new file mode 100644 index 0000000..447c97d --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/util/menu/MenuTree.java @@ -0,0 +1,67 @@ +package com.iplatform.base.util.menu; + +import com.iplatform.model.vo.MenuVo; +import com.walker.infrastructure.utils.StringUtils; + +import java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.stream.Collectors; + +/** + * 鏂扮晫闈㈣彍鍗曟爲鏋勫缓瀵硅薄銆� + * @author 鏃跺厠鑻� + * @date 2023-05-12 + */ +public class MenuTree { + + private List<MenuVo> menuList = new ArrayList<>(); + + public MenuTree(List<MenuVo> menuList) { + this.menuList = menuList; + } + + //寤虹珛鏍戝舰缁撴瀯 + public List<MenuVo> buildTree() { + List<MenuVo> treeMenus = new ArrayList<>(); + for (MenuVo menuNode : getRootNode()) { + menuNode = buildChildTree(menuNode); + treeMenus.add(menuNode); + } + return sortList(treeMenus); + } + + // 鎺掑簭 + private List<MenuVo> sortList(List<MenuVo> treeMenus) { + treeMenus = treeMenus.stream().sorted(Comparator.comparing(MenuVo::getSort).reversed()).collect(Collectors.toList()); + treeMenus.forEach(e -> { + if (!StringUtils.isEmptyList(e.getChildList())) { + e.setChildList(sortList(e.getChildList())); + } + }); + return treeMenus; + } + + //閫掑綊锛屽缓绔嬪瓙鏍戝舰缁撴瀯 + private MenuVo buildChildTree(MenuVo pNode) { + List<MenuVo> childMenus = new ArrayList<>(); + for (MenuVo menuNode : menuList) { + if (menuNode.getPid().equals(pNode.getId())) { + childMenus.add(buildChildTree(menuNode)); + } + } + pNode.setChildList(childMenus); + return pNode; + } + + //鑾峰彇鏍硅妭鐐� + private List<MenuVo> getRootNode() { + List<MenuVo> rootMenuLists = new ArrayList<MenuVo>(); + for (MenuVo menuNode : menuList) { + if (menuNode.getPid().longValue() == 0) { + rootMenuLists.add(menuNode); + } + } + return rootMenuLists; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/util/menu/ParentMenuComparator.java b/iplatform-base/src/main/java/com/iplatform/base/util/menu/ParentMenuComparator.java new file mode 100644 index 0000000..2934713 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/util/menu/ParentMenuComparator.java @@ -0,0 +1,24 @@ +package com.iplatform.base.util.menu; + +import com.iplatform.model.po.S_menu; + +import java.util.Comparator; + +/** + * 鑿滃崟鍏堟寜鐓х埗ID鎺掑簭(纭繚鎺掑垪鍦ㄤ竴涓垎缁�). + * @date 2022-11-12 + */ +public class ParentMenuComparator implements Comparator<S_menu> { + + @Override + public int compare(S_menu o1, S_menu o2) { + int p1 = o1.getParent_id().hashCode(); + int p2 = o2.getParent_id().hashCode(); + if(p1 != p2){ + return p1 - p2; + } else { + return 0; + } +// return o1.getOrder_num() - o2.getOrder_num(); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/util/menu/SystemMenu.java b/iplatform-base/src/main/java/com/iplatform/base/util/menu/SystemMenu.java new file mode 100644 index 0000000..06637b2 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/util/menu/SystemMenu.java @@ -0,0 +1,41 @@ +package com.iplatform.base.util.menu; + +import com.iplatform.model.po.S_menu; + +import java.util.ArrayList; +import java.util.List; + +public class SystemMenu extends S_menu { + + /** 瀛愯彍鍗� */ + private List<SystemMenu> children = new ArrayList<>(); + + public SystemMenu(S_menu menu){ + this.setMenu_id(menu.getMenu_id()); + this.setMenu_name(menu.getMenu_name()); + this.setMenu_type(menu.getMenu_type()); + this.setComponent(menu.getComponent()); + this.setIcon(menu.getIcon()); + this.setIs_cache(menu.getIs_cache()); + this.setIs_frame(menu.getIs_frame()); + this.setOrder_num(menu.getOrder_num()); + this.setParent_id(menu.getParent_id()); + this.setPath(menu.getPath()); + this.setPerms(menu.getPerms()); + this.setQuery(menu.getQuery()); + this.setRemark(menu.getRemark()); + this.setStatus(menu.getStatus()); + this.setVisible(menu.getVisible()); + this.setIs_show(menu.getIs_show()); + this.setType(menu.getType()); + this.setIcon_info(menu.getIcon_info()); + } + + public List<SystemMenu> getChildren() { + return children; + } + + public void setChildren(List<SystemMenu> children) { + this.children = children; + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/util/role/SystemRole.java b/iplatform-base/src/main/java/com/iplatform/base/util/role/SystemRole.java new file mode 100644 index 0000000..1fef3d4 --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/util/role/SystemRole.java @@ -0,0 +1,52 @@ +package com.iplatform.base.util.role; + +import com.iplatform.model.po.S_role; + +/** + * 鍓嶇闇�瑕佸湪鐢ㄦ埛绠$悊涓紝灞曠ず鐢ㄦ埛宸叉嫢鏈夌殑瑙掕壊锛屽洜姝よ鑹插簲娣诲姞閫変腑鏍囪銆� + * @author 鏃跺厠鑻� + * @date 2022-12-15 + */ +public class SystemRole extends S_role { + + public boolean isFlag() { + return flag; + } +// public boolean getFlag(){return flag;} + + public void setFlag(boolean flag) { + this.flag = flag; + } + + public String[] getMenuIds() { + return menuIds; + } + + public void setMenuIds(String[] menuIds) { + this.menuIds = menuIds; + } + + /** 娣诲姞瑙掕壊锛屽叧鑱旂殑鑿滃崟缁� */ + private String[] menuIds; + + /** 鐢ㄦ埛鏄惁瀛樺湪姝よ鑹叉爣璇� 榛樿涓嶅瓨鍦� */ + private boolean flag = false; + + public SystemRole(){} + + public SystemRole(S_role s_role){ + this.setRole_id(s_role.getRole_id()); + this.setData_scope(s_role.getData_scope()); + this.setOrg_id(s_role.getOrg_id()); + this.setRole_sort(s_role.getRole_sort()); + this.setRole_key(s_role.getRole_key()); + this.setDel_flag(s_role.getDel_flag()); + this.setDept_check_strictly(s_role.getDept_check_strictly()); + this.setMenu_check_strictly(s_role.getMenu_check_strictly()); + this.setStatus(s_role.getStatus()); + this.setRemark(s_role.getRemark()); + this.setRole_name(s_role.getRole_name()); + // 2023-10-18锛屽瓧娈靛凡鏈夛紝缂哄皯绫诲瀷灞炴�� + this.setType(s_role.getType()); + } +} diff --git a/iplatform-base/src/main/java/com/iplatform/base/util/user/SystemUser.java b/iplatform-base/src/main/java/com/iplatform/base/util/user/SystemUser.java new file mode 100644 index 0000000..0a129be --- /dev/null +++ b/iplatform-base/src/main/java/com/iplatform/base/util/user/SystemUser.java @@ -0,0 +1,26 @@ +package com.iplatform.base.util.user; + +import com.iplatform.model.po.S_user_core; + +/** + * 鍥犱负鍦ㄦ坊鍔犵敤鎴锋椂锛岄渶瑕佸悓鏃朵紶鍏ヨ鑹插垪琛紝鎵�浠ヨ繖閲屽畾涔夊鍔犱簡鍝嶅簲灞炴�с�� + * @author 鏃跺厠鑻� + * @date 2022-12-13 + */ +public class SystemUser extends S_user_core { + + public Long[] getRoleIds() { + return roleIds; + } + + public void setRoleIds(Long[] roleIds) { + this.roleIds = roleIds; + } + + /** 瑙掕壊缁� */ + private Long[] roleIds; + + public SystemUser(){} + + +} diff --git a/iplatform-base/src/main/resources/images/demo.txt b/iplatform-base/src/main/resources/images/demo.txt new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/iplatform-base/src/main/resources/images/demo.txt diff --git a/iplatform-base/src/main/resources/images/jigsaw/original/1.png b/iplatform-base/src/main/resources/images/jigsaw/original/1.png new file mode 100644 index 0000000..e079502 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw/original/1.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw/original/2.png b/iplatform-base/src/main/resources/images/jigsaw/original/2.png new file mode 100644 index 0000000..2039dee --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw/original/2.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw/original/3.png b/iplatform-base/src/main/resources/images/jigsaw/original/3.png new file mode 100644 index 0000000..65dbce9 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw/original/3.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw/original/4.png b/iplatform-base/src/main/resources/images/jigsaw/original/4.png new file mode 100644 index 0000000..9278575 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw/original/4.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw/original/5.png b/iplatform-base/src/main/resources/images/jigsaw/original/5.png new file mode 100644 index 0000000..9ecdc0b --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw/original/5.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw/original/6.png b/iplatform-base/src/main/resources/images/jigsaw/original/6.png new file mode 100644 index 0000000..78dd223 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw/original/6.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw/slidingBlock/1.png b/iplatform-base/src/main/resources/images/jigsaw/slidingBlock/1.png new file mode 100644 index 0000000..1905026 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw/slidingBlock/1.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw/slidingBlock/2.png b/iplatform-base/src/main/resources/images/jigsaw/slidingBlock/2.png new file mode 100644 index 0000000..b1482d4 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw/slidingBlock/2.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw/slidingBlock/3.png b/iplatform-base/src/main/resources/images/jigsaw/slidingBlock/3.png new file mode 100644 index 0000000..cdbb0b1 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw/slidingBlock/3.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw/slidingBlock/4.png b/iplatform-base/src/main/resources/images/jigsaw/slidingBlock/4.png new file mode 100644 index 0000000..bc69c96 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw/slidingBlock/4.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw/slidingBlock/5.png b/iplatform-base/src/main/resources/images/jigsaw/slidingBlock/5.png new file mode 100644 index 0000000..0080a54 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw/slidingBlock/5.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw/slidingBlock/6.png b/iplatform-base/src/main/resources/images/jigsaw/slidingBlock/6.png new file mode 100644 index 0000000..b07c3b4 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw/slidingBlock/6.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_bg/1.jpg b/iplatform-base/src/main/resources/images/jigsaw_bg/1.jpg new file mode 100644 index 0000000..ff2568f --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_bg/1.jpg Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_bg/10.jpg b/iplatform-base/src/main/resources/images/jigsaw_bg/10.jpg new file mode 100644 index 0000000..829a604 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_bg/10.jpg Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_bg/11.jpg b/iplatform-base/src/main/resources/images/jigsaw_bg/11.jpg new file mode 100644 index 0000000..6b007eb --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_bg/11.jpg Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_bg/11.png b/iplatform-base/src/main/resources/images/jigsaw_bg/11.png new file mode 100644 index 0000000..0992e14 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_bg/11.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_bg/12.jpg b/iplatform-base/src/main/resources/images/jigsaw_bg/12.jpg new file mode 100644 index 0000000..cb4ebbc --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_bg/12.jpg Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_bg/13.jpg b/iplatform-base/src/main/resources/images/jigsaw_bg/13.jpg new file mode 100644 index 0000000..24f9906 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_bg/13.jpg Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_bg/14.jpg b/iplatform-base/src/main/resources/images/jigsaw_bg/14.jpg new file mode 100644 index 0000000..fbc3073 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_bg/14.jpg Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_bg/15.jpg b/iplatform-base/src/main/resources/images/jigsaw_bg/15.jpg new file mode 100644 index 0000000..d9ab15d --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_bg/15.jpg Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_bg/16.jpg b/iplatform-base/src/main/resources/images/jigsaw_bg/16.jpg new file mode 100644 index 0000000..d30201c --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_bg/16.jpg Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_bg/2.jpg b/iplatform-base/src/main/resources/images/jigsaw_bg/2.jpg new file mode 100644 index 0000000..819cb2a --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_bg/2.jpg Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_bg/3.jpg b/iplatform-base/src/main/resources/images/jigsaw_bg/3.jpg new file mode 100644 index 0000000..71e1504 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_bg/3.jpg Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_bg/4.jpg b/iplatform-base/src/main/resources/images/jigsaw_bg/4.jpg new file mode 100644 index 0000000..243c3df --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_bg/4.jpg Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_bg/5.jpg b/iplatform-base/src/main/resources/images/jigsaw_bg/5.jpg new file mode 100644 index 0000000..4c832f8 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_bg/5.jpg Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_bg/6.jpg b/iplatform-base/src/main/resources/images/jigsaw_bg/6.jpg new file mode 100644 index 0000000..25e3431 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_bg/6.jpg Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_bg/7.jpg b/iplatform-base/src/main/resources/images/jigsaw_bg/7.jpg new file mode 100644 index 0000000..a177924 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_bg/7.jpg Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_bg/8.jpg b/iplatform-base/src/main/resources/images/jigsaw_bg/8.jpg new file mode 100644 index 0000000..a8e0a6c --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_bg/8.jpg Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_bg/9.jpg b/iplatform-base/src/main/resources/images/jigsaw_bg/9.jpg new file mode 100644 index 0000000..6289e77 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_bg/9.jpg Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_block/1.png b/iplatform-base/src/main/resources/images/jigsaw_block/1.png new file mode 100644 index 0000000..5d8a0be --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_block/1.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_block/10.png b/iplatform-base/src/main/resources/images/jigsaw_block/10.png new file mode 100644 index 0000000..5a51af6 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_block/10.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_block/11.png b/iplatform-base/src/main/resources/images/jigsaw_block/11.png new file mode 100644 index 0000000..8161dfb --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_block/11.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_block/12.png b/iplatform-base/src/main/resources/images/jigsaw_block/12.png new file mode 100644 index 0000000..c7ab2d0 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_block/12.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_block/13.png b/iplatform-base/src/main/resources/images/jigsaw_block/13.png new file mode 100644 index 0000000..efbfbad --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_block/13.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_block/14.png b/iplatform-base/src/main/resources/images/jigsaw_block/14.png new file mode 100644 index 0000000..7713bd2 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_block/14.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_block/15.png b/iplatform-base/src/main/resources/images/jigsaw_block/15.png new file mode 100644 index 0000000..a309307 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_block/15.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_block/16.png b/iplatform-base/src/main/resources/images/jigsaw_block/16.png new file mode 100644 index 0000000..54cad08 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_block/16.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_block/17.png b/iplatform-base/src/main/resources/images/jigsaw_block/17.png new file mode 100644 index 0000000..90e017e --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_block/17.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_block/18.png b/iplatform-base/src/main/resources/images/jigsaw_block/18.png new file mode 100644 index 0000000..488e854 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_block/18.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_block/19.png b/iplatform-base/src/main/resources/images/jigsaw_block/19.png new file mode 100644 index 0000000..0f4823f --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_block/19.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_block/2.png b/iplatform-base/src/main/resources/images/jigsaw_block/2.png new file mode 100644 index 0000000..8d085c0 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_block/2.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_block/20.png b/iplatform-base/src/main/resources/images/jigsaw_block/20.png new file mode 100644 index 0000000..4a87dea --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_block/20.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_block/21.png b/iplatform-base/src/main/resources/images/jigsaw_block/21.png new file mode 100644 index 0000000..654fdee --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_block/21.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_block/22.png b/iplatform-base/src/main/resources/images/jigsaw_block/22.png new file mode 100644 index 0000000..7d96266 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_block/22.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_block/3.png b/iplatform-base/src/main/resources/images/jigsaw_block/3.png new file mode 100644 index 0000000..e50d993 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_block/3.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_block/4.png b/iplatform-base/src/main/resources/images/jigsaw_block/4.png new file mode 100644 index 0000000..5647780 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_block/4.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_block/5.png b/iplatform-base/src/main/resources/images/jigsaw_block/5.png new file mode 100644 index 0000000..28881df --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_block/5.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_block/6.png b/iplatform-base/src/main/resources/images/jigsaw_block/6.png new file mode 100644 index 0000000..296d41d --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_block/6.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_block/7.png b/iplatform-base/src/main/resources/images/jigsaw_block/7.png new file mode 100644 index 0000000..bc70c51 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_block/7.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_block/8.png b/iplatform-base/src/main/resources/images/jigsaw_block/8.png new file mode 100644 index 0000000..ad8b803 --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_block/8.png Binary files differ diff --git a/iplatform-base/src/main/resources/images/jigsaw_block/9.png b/iplatform-base/src/main/resources/images/jigsaw_block/9.png new file mode 100644 index 0000000..4e0a23f --- /dev/null +++ b/iplatform-base/src/main/resources/images/jigsaw_block/9.png Binary files differ diff --git a/iplatform-base/src/test/java/com/iplatform/base/MenuCacheProvider.java b/iplatform-base/src/test/java/com/iplatform/base/MenuCacheProvider.java new file mode 100644 index 0000000..7e32be4 --- /dev/null +++ b/iplatform-base/src/test/java/com/iplatform/base/MenuCacheProvider.java @@ -0,0 +1,529 @@ +package com.iplatform.base; + +import com.iplatform.base.service.MenuServiceImpl; +import com.iplatform.base.util.MenuUtils; +import com.iplatform.base.util.menu.SystemMenu; +import com.iplatform.model.po.S_menu; +import com.iplatform.model.vo.MetaVo; +import com.iplatform.model.vo.RouterVo; +import com.walker.cache.AbstractCacheProvider; +import com.walker.cache.Cachable; +import com.walker.cache.Cache; +import com.walker.infrastructure.utils.StringUtils; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * 鑿滃崟鏈湴缂撳瓨锛屽洜涓轰笉闇�瑕侀泦缇ょ幆澧冿紝鍥犳鍙湁鍐呭瓨妯″紡(娌℃湁redis鏂瑰紡) + * @author 鏃跺厠鑻� + * @date 2022-11-01 + */ +public class MenuCacheProvider extends AbstractCacheProvider<S_menu> { + + private MenuServiceImpl menuService; + + public void setMenuService(MenuServiceImpl menuService) { + this.menuService = menuService; + } + + @Override + protected int loadDataToCache(Cache cache) { + List<S_menu> list = this.menuService.selectAll(new S_menu()); + if(!StringUtils.isEmptyList(list)){ + for(S_menu h : list){ + cache.put(h.getMenu_id(), h); + } + return list.size(); + } + return 0; + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_MENU; + } + + @Override + public Class<?> getProviderType() { + return S_menu.class; + } + + /** + * 缁欏畾鐨勮彍鍗曪紝鏄惁鍖呭惈瀛愯彍鍗曘�� + * @param menuId 缁欏畾鑿滃崟ID + * @return + * @date 2022-12-29 + */ + public boolean isHasChildren(String menuId){ + List<S_menu> menuAll = this.getCacheMenuList(true, MenuUtils.MENU_SCOPE_PLATFORM); + for(S_menu menu : menuAll){ + if(menu.getParent_id().equals(menuId)){ + return true; + } + } + return false; + } + + /** + * 杩斿洖鑿滃崟闆嗗悎鍒楄〃(涓嶆槸鏍戠粨鏋�)锛岀洰鍓嶈鏂规硶鍦ㄤ唬鐮佺敓鎴愬姛鑳戒腑浣跨敤锛屽睍绀洪�夋嫨鐢熸垚鍦ㄥ摢涓彍鍗曟ā鍧椼�� + * @param roleIdList + * @param menuScope 鑿滃崟鑼冨洿锛�0 骞冲彴锛堢洰鍓嶄篃鏈�3锛夛紝4 鐙珛鍗曚綅锛� -1 琛ㄧず鏄剧ず鎵�鏈夎彍鍗曪紝>4 琛ㄧず鏈烘瀯鐗瑰畾鑿滃崟锛屽鐝富浠昏彍鍗曘�� + * @return + * @date 2022-11-27 + * @date 2023-06-05 娣诲姞鍙傛暟 menuScope + * @date 2023-10-11 menuScope 鍙傛暟澧炲姞鍊硷紙-1锛夊彲浠ュ睍绀烘墍鏈夎彍鍗曪紝閭斂闆嗗洟妯″紡 + * @date 2023-10-24 menuScope 鍙傛暟澧炲姞鍊硷紙澶т簬4锛夛紝琛ㄧず鐗瑰畾浜哄憳鐨勭壒瀹氳彍鍗曪紙濡傦細鐝富浠荤殑鑿滃崟锛� + */ + public List<SystemMenu> getMenuList(List<String> roleIdList, int menuScope){ + if(StringUtils.isEmptyList(roleIdList)){ + // 娌℃湁缁欏畾瑙掕壊闆嗗悎锛岃鏄庢槸绠$悊鍛橈紝鏄剧ず鎵�鏈夎彍鍗曟暟鎹� + return this.toSystemMenuList(this.getCacheMenuList(true, menuScope)); + } + // 鏍规嵁瑙掕壊鏉冮檺鍔犺浇涓嶅悓鑿滃崟闆嗗悎 + List<SystemMenu> menuList = new ArrayList<>(32); + List<String> menuIdList = this.menuService.queryRoleMenuIdList(roleIdList); + if(StringUtils.isEmptyList(menuIdList)){ + logger.warn("鐢ㄦ埛娌℃湁浠讳綍鏉冮檺锛宮enuIdList = null, roleIdList = {}", roleIdList); + return menuList; + } + + S_menu menu = null; + for(String menuId : menuIdList){ + menu = this.getCacheData(menuId); + // 2023-10-11 澧炲姞杩欎釜if鍒ゆ柇锛屽鏋滄槸涓嶅尯鍒嗚寖鍥达紝鍒欏姞杞芥墍鏈夎彍鍗� +// if(menuScope != MenuUtils.MENU_SCOPE_ALL){ +// if(menuScope == MenuUtils.MENU_SCOPE_PLATFORM){ +// // 濡傛灉瑕佸睍绀鸿彍鍗曡寖鍥存槸锛氬钩鍙帮紝鍒欒彍鍗曚腑 >= 4鐨勫垎绫婚兘涓嶈锛岃繖浜涙槸椤剁骇鏈烘瀯涓氬姟鐙珛鑿滃崟銆� +// if(menu.getType().intValue() >= MenuUtils.MENU_SCOPE_ORG){ +// continue; +// } +// } else if(menuScope == MenuUtils.MENU_SCOPE_ORG){ +//// if(menu.getType().intValue() < MenuUtils.MENU_SCOPE_ORG){ +// if(menu.getType().intValue() != MenuUtils.MENU_SCOPE_ORG){ +// // 濡傛灉瑕佸睍绀鸿彍鍗曡寖鍥存槸锛氶《绾ф満鏋勪笟鍔$殑鐙珛鑿滃崟锛屽垯骞冲彴鑿滃崟涓嶆樉绀恒��2023-06-01 +// continue; +// } +// } else if(menuScope > MenuUtils.MENU_SCOPE_ORG){ +// // 瀵逛簬澶т簬鏈烘瀯鑿滃崟鐨勶紝閮藉睘浜庢満鏋勭壒瀹氳彍鍗曪紝蹇呴』涓庝紶鍏ヨ寖鍥村畬鍏ㄤ竴鑷达紝濡傦細鐝富浠昏彍鍗曠瓑銆�2023-10-24 +// if(menu.getType().intValue() != menuScope){ +// continue; +// } +// } +// } + if(MenuUtils.menuScopeNotMatch(menuScope, menu)){ + continue; + } + menuList.add(new SystemMenu(menu)); + } + + // 2023-10-13锛屾煡鎵炬瘡涓彍鍗曚笂绾э紝濡傛灉涓婄骇鑼冨洿绫诲瀷涓庝笅绾ц彍鍗曚笉涓�鑷达紝涔熼渶瑕佸姞鍏ュ垪琛ㄤ腑 + for(String menuId : menuIdList){ + if(MenuUtils.containMenu(menuList, menuId)){ + continue; + } + menu = this.getCacheData(menuId); + menuList.add(new SystemMenu(menu)); + } +// if(!StringUtils.isEmptyList(menuList)){ +// String pid = null; +// for(SystemMenu systemMenu : menuList){ +// pid = systemMenu.getParent_id(); +// if(pid.equals(MenuUtils.MENU_ID_ROOT)){ +// continue; +// } +// if(menuIdList.contains(pid)){ +// this.addParentMenu2Collection(menuList, pid); +// } +// } +// } + +// Collections.sort(menuList, new ParentMenuComparator()); +// Collections.sort(menuList, new MenuOrderNumComparator()); +// Collections.sort(menuList); + List<SystemMenu> collect = menuList.stream().sorted(Comparator.comparing(SystemMenu::getParent_id).thenComparing(SystemMenu::getOrder_num,Comparator.reverseOrder())).collect(Collectors.toList()); + logger.info("+++++++++++++++++++++"); + return collect; + } + +// private List<SystemMenu> addParentMenu2Collection(List<SystemMenu> menuList, String menuId){ +// List<SystemMenu> addList = null; +// boolean exist = false; +// for(SystemMenu menu : menuList){ +// if(menu.getMenu_id().equals(menuId)){ +// exist = true; +// break; +// } +// } +// if(!exist){ +// S_menu menu = this.getCacheData(menuId); +// if(addList == null){ +// addList = new ArrayList<>(8); +// } +// addList.add(new SystemMenu(menu)); +// } +// return addList; +// } + + public List<SystemMenu> toSystemMenuList(List<S_menu> srcMenuList){ + List<SystemMenu> list = new ArrayList<>(32); + if(StringUtils.isEmptyList(srcMenuList)){ + return list; + } + for(S_menu menu : srcMenuList){ + list.add(new SystemMenu(menu)); + } + return list; + } + + /** + * 鑾峰緱缂撳瓨鑿滃崟鍒楄〃 + * @param containButton 鏄惁鍖呭惈鎸夐挳鏉冮檺鑿滃崟 + * @param menuScope 鑿滃崟鑼冨洿锛屽鐙珛椤剁骇鏈烘瀯锛屽彲浠ユ樉绀烘満鏋勮缃殑鍒嗙被鑿滃崟鑼冨洿锛岀洰鍓嶆湁锛�0-骞冲彴锛堝寘鍚�3锛夛紝4-椤剁骇鍗曚綅鐙珛鑿滃崟 + * @return + * @date 2023-06-01 + */ + public List<S_menu> getCacheMenuList(boolean containButton, int menuScope){ + List<S_menu> data = new ArrayList<>(); + S_menu menu = null; + for(Iterator<Cachable> it = this.getCache().getIterator(); it.hasNext();){ + menu = (S_menu) it.next().getValue(); + + // 2023-10-11 澧炲姞杩欎釜if鍒ゆ柇锛屽鏋滄槸涓嶅尯鍒嗚寖鍥达紝鍒欏姞杞芥墍鏈夎彍鍗� +// if(menuScope != MenuUtils.MENU_SCOPE_ALL){ + +// if(menuScope == MenuUtils.MENU_SCOPE_PLATFORM){ +// // 濡傛灉瑕佸睍绀鸿彍鍗曡寖鍥存槸锛氬钩鍙帮紝鍒欒彍鍗曚腑 >= 4鐨勫垎绫婚兘涓嶈锛岃繖浜涙槸椤剁骇鏈烘瀯涓氬姟鐙珛鑿滃崟銆� +// if(menu.getType().intValue() >= MenuUtils.MENU_SCOPE_ORG){ +// continue; +// } +// } else if(menu.getType().intValue() < MenuUtils.MENU_SCOPE_ORG){ +// // 濡傛灉瑕佸睍绀鸿彍鍗曡寖鍥存槸锛氶《绾ф満鏋勪笟鍔$殑鐙珛鑿滃崟锛屽垯骞冲彴鑿滃崟涓嶆樉绀恒��2023-06-01 +// continue; +// } +// } + // 2023-10-24 + if(MenuUtils.menuScopeNotMatch(menuScope, menu)){ + continue; + } + + if(menu.getStatus().intValue() == MenuUtils.MENU_STATUS_DISABLED){ + // 鍘绘帀绂佺敤鑿滃崟 + continue; + } + if(menu.getMenu_type().equals(MenuUtils.MENU_TYPE_BUTTON)){ + if(containButton){ + data.add(menu); + } + } else { + data.add(menu); + } + } + // TODO 鍓嶇鎶ラ敊 鏆傛椂娉ㄩ噴 +// Collections.sort(data, new ParentMenuComparator()); +// Collections.sort(data, new MenuOrderNumComparator()); +// Collections.sort(data); + List<S_menu> dataOrder = data.stream().sorted(Comparator.comparing(S_menu::getParent_id).thenComparing(S_menu::getOrder_num,Comparator.reverseOrder())).collect(Collectors.toList()); + + return dataOrder; + } + + /** + * 鏍规嵁鐖惰妭鐐圭殑ID鑾峰彇鎵�鏈夊瓙鑺傜偣 + * + * @param list 鍒嗙被琛� + * @param parentId 浼犲叆鐨勭埗鑺傜偣ID + * @return String + */ + public List<SystemMenu> getChildPerms(List<SystemMenu> list, String parentId) { + List<SystemMenu> returnList = new ArrayList<>(); + for (Iterator<SystemMenu> iterator = list.iterator(); iterator.hasNext();) { + SystemMenu t = iterator.next(); + // 涓�銆佹牴鎹紶鍏ョ殑鏌愪釜鐖惰妭鐐笽D,閬嶅巻璇ョ埗鑺傜偣鐨勬墍鏈夊瓙鑺傜偣 + if (t.getParent_id().equals(parentId)) { + recursionFn(list, t); + returnList.add(t); + } + } + return returnList; + } + + /** + * 閫掑綊鍒楄〃 + * + * @param list + * @param t + */ + private void recursionFn(List<SystemMenu> list, SystemMenu t) { + // 寰楀埌瀛愯妭鐐瑰垪琛� + List<SystemMenu> childList = getChildList(list, t); + t.setChildren(childList); + for (SystemMenu tChild : childList) { + if (hasChild(list, tChild)) { + recursionFn(list, tChild); + } + } + } + + /** + * 寰楀埌瀛愯妭鐐瑰垪琛� + */ + private List<SystemMenu> getChildList(List<SystemMenu> list, SystemMenu t) { + List<SystemMenu> tlist = new ArrayList<>(); + Iterator<SystemMenu> it = list.iterator(); + while (it.hasNext()) { + SystemMenu n = it.next(); + if (n.getParent_id().equals(t.getMenu_id())) { + tlist.add(n); + } + } + return tlist; + } + + /** + * 鍒ゆ柇鏄惁鏈夊瓙鑺傜偣 + */ + private boolean hasChild(List<SystemMenu> list, SystemMenu t) { + return getChildList(list, t).size() > 0; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + //~ 浠ヤ笅涓虹敤鎴风櫥褰曡彍鍗曞睍绀轰娇鐢紝2022-11-12 + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + /** + * 杩斿洖鑿滃崟鏉冮檺鏍囪瘑瀛楃涓查泦鍚堬紝璇ユ柟娉曡嫢渚濆墠绔娇鐢ㄣ��<p></p> + * 鍚庣画浼氬幓鎺夊墠绔鏉冮檺鐐圭殑渚濊禆銆� + * @param menuIdList + * @param showAll 鏄惁鏄剧ず鎵�鏈夋潈闄愮偣 + * @param menuScope 鑿滃崟鑼冨洿锛屽鐙珛椤剁骇鏈烘瀯锛屽彲浠ユ樉绀烘満鏋勮缃殑鍒嗙被鑿滃崟鑼冨洿锛岀洰鍓嶆湁锛�0-骞冲彴锛堝寘鍚�3锛夛紝4-椤剁骇鍗曚綅鐙珛鑿滃崟 + * @return + * @date 2022-11-12 + * @date 2023-03-20 濡傛灉缁欏畾鑿滃崟id涓虹┖锛屽垯涓嶈繑鍥炰换浣曟潈闄愮偣淇℃伅銆傛椂鍏嬭嫳 + * @date 2023-06-07 瀵逛簬鐙珛鍗曚綅锛堝晢鎴凤級鍒欎細鏄剧ず鎵�鏈夎鍗曚綅鐨勮彍鍗曟潈闄愪俊鎭� + */ + public Set<String> getPermissionSet(List<String> menuIdList, boolean showAll, int menuScope){ + if(StringUtils.isEmptyList(menuIdList) && !showAll){ + return new HashSet<>(); + } + List<String> permsList = new ArrayList<>(64); +// List<S_menu> menuAll = this.getCacheMenuList(true, MenuUtils.MENU_SCOPE_PLATFORM); + List<S_menu> menuAll = this.getCacheMenuList(true, menuScope); + if(!StringUtils.isEmptyList(menuAll)){ + for(S_menu menu : menuAll){ + + // 2023-10-11 澧炲姞杩欎釜if鍒ゆ柇锛屽鏋滄槸涓嶅尯鍒嗚寖鍥达紝鍒欏姞杞芥墍鏈夎彍鍗� +// if(menuScope != MenuUtils.MENU_SCOPE_ALL){ +// +// // 2023-06-07 +// if(menuScope == MenuUtils.MENU_SCOPE_PLATFORM){ +// // 濡傛灉瑕佸睍绀鸿彍鍗曡寖鍥存槸锛氬钩鍙帮紝鍒欒彍鍗曚腑 >= 4鐨勫垎绫婚兘涓嶈锛岃繖浜涙槸椤剁骇鏈烘瀯涓氬姟鐙珛鑿滃崟銆� +// if(menu.getType().intValue() >= MenuUtils.MENU_SCOPE_ORG){ +// continue; +// } +// } else if(menu.getType().intValue() < MenuUtils.MENU_SCOPE_ORG){ +// // 濡傛灉瑕佸睍绀鸿彍鍗曡寖鍥存槸锛氶《绾ф満鏋勪笟鍔$殑鐙珛鑿滃崟锛屽垯骞冲彴鑿滃崟涓嶆樉绀恒��2023-06-01 +// continue; +// } +// } + // 2023-10-24 + if(MenuUtils.menuScopeNotMatch(menuScope, menu)){ + continue; + } + + if(StringUtils.isEmpty(menu.getPerms())){ + continue; + } + if(StringUtils.isEmptyList(menuIdList)){ + // 濡傛灉娌℃湁闄愬埗锛屽叏閮ㄥ姞涓� + permsList.add(menu.getPerms()); + } else if(menuIdList.contains(menu.getMenu_id())){ + // 濡傛灉闄愬埗鏈夛紝鍒欏彧娣诲姞缁欏畾鐨� + permsList.add(menu.getPerms()); + } + } + } + + Set<String> permsSet = new HashSet<>(); + for(String perms : permsList){ + if (StringUtils.isNotEmpty(perms)) { + permsSet.addAll(Arrays.asList(perms.trim().split(","))); + } + } + return permsSet; + } + + /** + * 杩斿洖鑿滃崟鏍戝舰缁撴灉锛屽垪琛ㄤ腑鍖呭惈澶氫釜鑿滃崟鏍硅妭鐐癸紝menuIdList 涓虹┖鏃讹紝鍏佽杩斿洖鎵�鏈夌殑銆� + * @param menuIdList + * @param containButton + * @return + * @date 2023-03-22 + */ + public List<SystemMenu> getMenuTreeAll(List<String> menuIdList, boolean containButton, int menuScope){ + return this.getMenuTree(menuIdList, containButton, true, menuScope); + } + + /** + * 杩斿洖鑿滃崟鏍戝舰缁撴灉锛屽垪琛ㄤ腑鍖呭惈澶氫釜鑿滃崟鏍硅妭鐐广�� + * @param menuIdList 鎸囧畾鏄剧ず鐨勮彍鍗曪紝濡傛灉涓虹┖琛ㄧず涓嶇壒鍒檺鍒� + * @param containButton 鏄惁鍖呭惈鎸夐挳鏉冮檺 + * @param showAll 褰撶粰瀹�'menuIdList'涓虹┖鏃讹紝鏄惁鏄剧ず鎵�鏈夎彍鍗� + * @return + * @date 2022-12-18 鏇存柊 + * @date 2023-03-22 娣诲姞鍙傛暟'showAll' + */ + public List<SystemMenu> getMenuTree(List<String> menuIdList, boolean containButton, boolean showAll, int menuScope){ + List<SystemMenu> menuGroupList = new ArrayList<>(32); + if(StringUtils.isEmptyList(menuIdList) && !showAll){ + // 2023-03-22 缁欏畾涓虹┖鑿滃崟id锛屽苟涓斾笉鍏佽鏄剧ず鎵�鏈夛紝杩斿洖绌鸿彍鍗曟爲銆� + return getChildPerms(menuGroupList, "0"); + } +// List<S_menu> menuAll = this.getCacheMenuList(false); + List<S_menu> menuAll = this.getCacheMenuList(containButton, menuScope); + if(!StringUtils.isEmptyList(menuAll)){ + for(S_menu menu : menuAll){ + if(menuIdList == null){ + // 濡傛灉娌℃湁闄愬埗锛屽叏閮ㄥ姞涓� + menuGroupList.add(new SystemMenu(menu)); + } else if(menuIdList.contains(menu.getMenu_id())){ + // 濡傛灉闄愬埗鏈夛紝鍒欏彧娣诲姞缁欏畾鐨� + menuGroupList.add(new SystemMenu(menu)); + } + } + } + List<SystemMenu> menuGroupListOrder = menuGroupList.stream().sorted(Comparator.comparing(SystemMenu::getParent_id).thenComparing(SystemMenu::getOrder_num,Comparator.reverseOrder())).collect(Collectors.toList()); + return getChildPerms(menuGroupListOrder, "0"); + } + + + /** + * 鏋勫缓鍓嶇璺敱鎵�闇�瑕佺殑鑿滃崟锛堣嫢渚濓級 + * + * @param menus 鑿滃崟鍒楄〃 + * @return 璺敱鍒楄〃 + */ + @Deprecated + public List<RouterVo> buildMenus(List<SystemMenu> menus) { + List<RouterVo> routers = new LinkedList<RouterVo>(); + for (SystemMenu menu : menus) { + RouterVo router = new RouterVo(); + router.setHidden(MenuUtils.MENU_INVISIBLE.equals(menu.getVisible())); + router.setName(MenuUtils.getRouteName(menu)); + router.setPath(MenuUtils.getRouterPath(menu)); + router.setComponent(MenuUtils.getComponent(menu)); + router.setQuery(menu.getQuery()); + router.setMeta(new MetaVo(menu.getMenu_name(), menu.getIcon(), menu.getIs_cache().intValue() == MenuUtils.MENU_CACHE_DISABLE, menu.getPath())); + List<SystemMenu> cMenus = menu.getChildren(); + if (!cMenus.isEmpty() && cMenus.size() > 0 && menu.getMenu_type().equals(MenuUtils.MENU_TYPE_FOLDER)) { + router.setAlwaysShow(true); + router.setRedirect("noRedirect"); + router.setChildren(buildMenus(cMenus)); + } + else if (MenuUtils.isMenuFrame(menu)) { + router.setMeta(null); + List<RouterVo> childrenList = new ArrayList<RouterVo>(); + RouterVo children = new RouterVo(); + children.setPath(menu.getPath()); + children.setComponent(menu.getComponent()); + children.setName(StringUtils.capitalize(menu.getPath())); + children.setMeta(new MetaVo(menu.getMenu_name(), menu.getIcon(), menu.getIs_cache().intValue() == MenuUtils.MENU_CACHE_DISABLE, menu.getPath())); + children.setQuery(menu.getQuery()); + childrenList.add(children); + router.setChildren(childrenList); + } + else if (menu.getParent_id().equals(MenuUtils.MENU_ID_ROOT) && MenuUtils.isInnerLink(menu)) { + router.setMeta(new MetaVo(menu.getMenu_name(), menu.getIcon())); + router.setPath("/"); + List<RouterVo> childrenList = new ArrayList<RouterVo>(); + RouterVo children = new RouterVo(); + String routerPath = MenuUtils.innerLinkReplaceEach(menu.getPath()); + children.setPath(routerPath); + children.setComponent(MenuUtils.INNER_LINK); + children.setName(StringUtils.capitalize(routerPath)); + children.setMeta(new MetaVo(menu.getMenu_name(), menu.getIcon(), menu.getPath())); + childrenList.add(children); + router.setChildren(childrenList); + } + routers.add(router); + } + return routers; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + //~ 浠ヤ笅涓虹郴缁熸潈闄愮鐞嗕娇鐢紝2022-11-02 + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + /** + * 杩斿洖绯荤粺鎵�鏈夎鑹蹭笌url鍏宠仈鏁版嵁锛宻ecurity鏉冮檺閰嶇疆瀹炵敤銆�<p></p> + * 璇ユ柟娉曚細鏈夐噸澶嶆暟鎹紝渚嬪:澶氫釜瑙掕壊鍏锋湁鐩稿悓鐨刄RL锛岀敱涓氬姟鍘婚櫎閲嶅銆�<p></p> + * list[0] = role_id, list[1] = url <p></p> + * 鍥犱负Map瀵硅薄鐩稿悓key浼氳鐩杤alue锛屾墍浠ユ崲鎴怢ist闆嗗悎杩斿洖銆� + * @return + * @date 2022-11-02 + */ + public List<String[]> getAllRoleMenuMap(){ + List<String[]> result = new ArrayList<>(); + List<Map<String, Object>> list = this.menuService.queryRolesPermList(); + if(StringUtils.isEmptyList(list)){ + return result; + } + + String perms = null; + String menuId = null; + S_menu menu = null; + + for(Map<String, Object> map : list){ + menuId = map.get("menu_id").toString(); + menu = this.getCacheData(menuId); + if(menu == null){ + throw new IllegalArgumentException("缂撳瓨涓湭鎵惧埌鑿滃崟:" + menuId); + } + perms = menu.getPerms(); + if(StringUtils.isEmpty(perms)){ + continue; + } +// result.put(map.get("role_id").toString(), MenuUtils.acquireUrlFromPerms(perms)); + result.add(new String[]{map.get("role_id").toString(), MenuUtils.acquireUrlFromPerms(perms)}); + } + + // 2023-06-07 + // 鍟嗘埛锛堥《绾ф満鏋勶級鐗规湁鐨勮彍鍗曪紝涔熼渶瑕佸姞鍏ュ埌瑙掕壊涓紝璁剧疆榛樿涓夋柟瑙掕壊锛歊OLE_MERCHANT + Set<String> merchantPermSet = this.getPermissionSet(null, true, MenuUtils.MENU_SCOPE_ORG); + if(merchantPermSet != null){ + for(String onePerms : merchantPermSet){ + result.add(new String[]{SecurityConstants.ROLE_MERCHANT, MenuUtils.acquireUrlFromPerms(onePerms)}); + } + logger.debug("娣诲姞鍟嗘埛锛堥《绾ф満鏋勶級瑙掕壊鏉冮檺锛歿}", merchantPermSet.size()); + } + return result; + } + + /** + * 杩斿洖绯荤粺鎵�鏈夎彍鍗曞寘鍚潈闄愮殑url闆嗗悎锛屽嵆:鎵�鏈塸erms瀛樺湪鐨勮彍鍗曘�� + * @return + * @date 2022-11-02 + */ + public List<String> getAllMenuUrlList(){ + List<String> urlList = new ArrayList<>(32); + S_menu menu = null; + String perms = null; + for(Iterator<Cachable> it = this.getCache().getIterator(); it.hasNext();){ + menu = (S_menu) it.next().getValue(); + perms = menu.getPerms(); + if(StringUtils.isEmpty(perms)){ + continue; + } + urlList.add(MenuUtils.acquireUrlFromPerms(perms)); + } + return urlList; + } +} diff --git a/iplatform-base/src/test/java/com/iplatform/base/TestCaptcha.java b/iplatform-base/src/test/java/com/iplatform/base/TestCaptcha.java new file mode 100644 index 0000000..9cd86cf --- /dev/null +++ b/iplatform-base/src/test/java/com/iplatform/base/TestCaptcha.java @@ -0,0 +1,29 @@ +package com.iplatform.base; + +import com.iplatform.base.captcha.BlockPuzzleCaptchaProvider; +import com.iplatform.base.captcha.JigsawResult; +import com.iplatform.base.util.VerifyImgUtil; +import org.junit.Test; + +import java.io.File; +import java.util.concurrent.TimeUnit; + +public class TestCaptcha { + +// @Test + public void testBlockPuzzle() throws Exception{ + BlockPuzzleCaptchaProvider puzzleCaptchaProvider = new BlockPuzzleCaptchaProvider(); + this.runBlockPuzzleOnce(puzzleCaptchaProvider, "001"); + TimeUnit.SECONDS.sleep(3); + long startTime = System.nanoTime(); + this.runBlockPuzzleOnce(puzzleCaptchaProvider, "002"); + System.out.println("total times = " + (System.nanoTime() - startTime)); + } + + private void runBlockPuzzleOnce(BlockPuzzleCaptchaProvider puzzleCaptchaProvider, String filePrefix){ + JigsawResult result = (JigsawResult) puzzleCaptchaProvider.generateCaptcha(null); + VerifyImgUtil.writeBase64ToFile(result.getImageSourceBase64(), new File("d:/tmp/" + filePrefix + "_src.png")); + VerifyImgUtil.writeBase64ToFile(result.getImageBlockBase64(), new File("d:/tmp/" + filePrefix + "_block.png")); + System.out.println(result.getX() + ", " + result.getY()); + } +} diff --git a/iplatform-base/src/test/java/com/iplatform/base/TestEntity.java b/iplatform-base/src/test/java/com/iplatform/base/TestEntity.java new file mode 100644 index 0000000..676ed21 --- /dev/null +++ b/iplatform-base/src/test/java/com/iplatform/base/TestEntity.java @@ -0,0 +1,28 @@ +package com.iplatform.base; + +import com.iplatform.model.po.S_user_core; +import com.iplatform.model.po.S_user_core_mapper; +import com.walker.jdbc.SqlAndParameters; +import org.junit.Test; + +import java.util.Map; + +public class TestEntity { + +// @Test + public void testFileUrl(){ + String input = "http://localhost:8082/admin/file/2023/06/test123.png"; + int index = input.indexOf(Constants.FILE_CONTEXT_PATH); + System.out.println(input.substring(index + 6, input.length())); + } + +// @Test + public void testSQLEntity(){ + S_user_core user = new S_user_core(); + user.setUser_name("shikeying"); + user.setBind_wechat(1); + S_user_core_mapper mapper = new S_user_core_mapper(user); + SqlAndParameters<Map<String, Object>> sqlAndParameters = mapper.getUpdateSql_(); + System.out.println(sqlAndParameters.getSql()); + } +} diff --git a/iplatform-base/src/test/java/com/iplatform/base/TestMenu.java b/iplatform-base/src/test/java/com/iplatform/base/TestMenu.java new file mode 100644 index 0000000..7a38be8 --- /dev/null +++ b/iplatform-base/src/test/java/com/iplatform/base/TestMenu.java @@ -0,0 +1,194 @@ +package com.iplatform.base; + +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.node.ObjectNode; +import com.iplatform.base.pojo.form.FormDataItem; +import com.iplatform.base.util.MenuUtils; +import com.iplatform.base.util.NotificationUtils; +import com.iplatform.model.po.S_user_core; +import com.walker.infrastructure.utils.GenericTypeUtils; +import com.walker.infrastructure.utils.JsonUtils; +import com.walker.infrastructure.utils.PhoneNumberUtils; +import org.junit.Test; +import org.springframework.core.ResolvableType; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +public class TestMenu { + + private List<String> typeList1 = new ArrayList<String>(); + +// @Test + public void testPhoneNumber(){ + String input = "1001"; + boolean value = PhoneNumberUtils.isCellPhoneNumber(input); + System.out.println(value + ", " + input); + } + +// @Test + public void testFasterxml() throws Exception{ +// String json = "[\\\"23:53\\\",\\\"23:59\\\"]"; + String json_2 = "[\"23:53\",\"23:59\"]"; + List<String> listJson = JsonUtils.jsonStringToObject(json_2, List.class); + System.out.println("listJson = " + listJson); +// System.out.println("json 01 = " + json.replaceAll("\"", "")); +// System.out.println("json 02 = " + json_2.replaceAll("\"", "")); + + List<String> list = new ArrayList<>(4); + list.add("10:20"); + list.add("11:32"); + + FormDataItem dataItem = new FormDataItem(); + dataItem.setName("娴嬭瘯01"); + dataItem.setTitle("鏃堕棿娈�"); + + String listJsonString = JsonUtils.objectToJsonString(list); + System.out.println("listJsonString = " + listJsonString); + dataItem.setValue(listJsonString); + + String formDataItemJson = JsonUtils.objectToJsonString(dataItem); + System.out.println("formDataItemJson = " + formDataItemJson); + + FormDataItem dataItem1From = JsonUtils.jsonStringToObject(formDataItemJson, FormDataItem.class); + System.out.println("formDataItem.value = " + dataItem1From.getValue()); + + List<String> listFrom = JsonUtils.jsonStringToObject(listJsonString, List.class); +// ObjectNode objectNode = new ObjectNode(); + System.out.println("listFrom = " + listFrom); + + // 鍒ゆ柇瀛楃涓叉槸鍚son +// String noneJsonStr = JsonUtils.objectToJsonString() + } + +// @Test + public void testPushMessageType(){ +// String input = "tcp && web_socket && wx && system"; +// String input = "tcp || web_socket || wx || system"; + String input = "tcp "; + Object[] data = NotificationUtils.acquireMessagePushRules(input); + System.out.println(data[0]); + String[] indexList = (String[])data[1]; + for(String s : indexList){ + System.out.println("index = " + s); + } + } + +// @Test + public void testGenericType() throws Exception{ +// List<String> typeList1 = new ArrayList<String>(); + Class type1 = GenericTypeUtils.getSuperClassGenericType(typeList1.getClass()); + System.out.println(type1); +// Type[] types = typeList1.getClass().getGenericInterfaces(); +// TypeVariable[] types = typeList1.getClass().getTypeParameters(); +// for(Type type : types){ +// System.out.println(type); +// } + System.out.println(typeList1.getClass().getTypeName()); + + // 鑾峰彇瀵硅薄鍖呭惈鐨勬硾鍨嬬被鍨嬶紝涓嶈兘鐩存帴閫氳繃class瀹氫箟鑾峰緱(姝ゆ椂骞朵笉鐭ラ亾)锛屽彧鑳藉湪杩愯鐜涓幏寰椼��2022-11-16 +// ResolvableType t = ResolvableType.forClass(typeList1.getClass()); + ResolvableType t = ResolvableType.forField(getClass().getDeclaredField("typeList1")); + System.out.println(t.getGeneric(0).resolve()); + } + +// @Test + public void testUserPrincipal2Json() throws Exception{ + S_user_core user = new S_user_core(); + user.setId(1L); + user.setUser_name("shikeying"); + user.setCreate_time(0L); + user.setNick_name("鏃跺伐"); + user.setPassword("$2a$10$9lSwwUFMULR6/KhPsUbTj.0PTZfTnq0fB3OtS6PWoKAibpa8hL1cy"); + user.setUser_type(2); + user.setDel_flag(0); + user.setStatus(0); + user.setSex("0"); + user.setOrg_id(0L); + user.setDept_id(0L); + user.setAvatar("avatar.jpg"); + DefaultUserPrincipal userPrincipal = new DefaultUserPrincipal(user); + + List<String> roleIdList = new ArrayList<>(4); + roleIdList.add("role1"); + roleIdList.add("role2"); +// userPrincipal.setRoleIdList(roleIdList); + + String jsonString = JsonUtils.objectToJsonString(userPrincipal); + System.out.println("json = " + jsonString); + +// DefaultUserPrincipal testUser = JsonUtils.jsonStringToObject(jsonString, DefaultUserPrincipal.class); +// System.out.println("user = " + testUser.getUserName()); + ObjectNode objectNode = JsonUtils.jsonStringToObjectNode(jsonString); + String id = objectNode.get("id").asText(); + System.out.println("id = " + id); + + JsonNode userInfoNode = objectNode.get("userInfo"); + String userName = userInfoNode.get("user_name").asText(); + System.out.println("user_name = " + userName); + + S_user_core user_core = new S_user_core(); + user_core.setId(userInfoNode.get("id").asLong()); + user_core.setUser_name(userInfoNode.get("user_name").asText()); + user_core.setPassword(userInfoNode.get("password").asText()); + user_core.setDept_id(userInfoNode.get("dept_id").asLong()); + user_core.setNick_name(userInfoNode.get("nick_name").asText()); + user_core.setUser_type(userInfoNode.get("user_type").asInt()); + user_core.setCreate_time(userInfoNode.get("create_time").asLong()); + user_core.setOrg_id(userInfoNode.get("org_id").asLong()); + user_core.setStatus(userInfoNode.get("status").asInt()); + user_core.setDel_flag(userInfoNode.get("del_flag").asInt()); + if(!JsonUtils.isEmptyObject(userInfoNode.get("sex"))){ + user_core.setSex(userInfoNode.get("sex").asText()); + } else { + user_core.setSex("2"); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("phonenumber"))){ + user_core.setPhonenumber(userInfoNode.get("phonenumber").asText()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("avatar"))){ + user_core.setAvatar(userInfoNode.get("avatar").asText()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("email"))){ + user_core.setEmail(userInfoNode.get("email").asText()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("remark"))){ + user_core.setRemark(userInfoNode.get("remark").asText()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("create_by"))){ + user_core.setCreate_by(userInfoNode.get("create_by").asText()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("login_date"))){ + user_core.setLogin_date(userInfoNode.get("login_date").asLong()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("login_ip"))){ + user_core.setLogin_ip(userInfoNode.get("login_ip").asText()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("update_by"))){ + user_core.setUpdate_by(userInfoNode.get("update_by").asText()); + } + if(!JsonUtils.isEmptyObject(userInfoNode.get("update_time"))){ + user_core.setUpdate_time(userInfoNode.get("update_time").asLong()); + } + + JsonNode roleIdListJson = objectNode.get("roleIdList"); + List<String> roleList = new ArrayList<>(4); + if(roleIdListJson.isArray()){ + for(Iterator<JsonNode> it = roleIdListJson.iterator(); it.hasNext();){ + roleList.add(it.next().asText()); + } + } + System.out.println(roleList); + DefaultUserPrincipal testPrincipal1 = new DefaultUserPrincipal(user_core); + System.out.println(testPrincipal1); + } + +// @Test + public void testAcquireUrlFromPerms(){ + String perms = "system:user:query"; +// String perms = "system:role:list"; + String url = MenuUtils.acquireUrlFromPerms(perms); + System.out.println("perms = " + perms + ", url = " + url); + } +} diff --git a/iplatform-base/src/test/java/com/iplatform/base/redis/MenuCacheProvider.java b/iplatform-base/src/test/java/com/iplatform/base/redis/MenuCacheProvider.java new file mode 100644 index 0000000..60babdb --- /dev/null +++ b/iplatform-base/src/test/java/com/iplatform/base/redis/MenuCacheProvider.java @@ -0,0 +1,541 @@ +package com.iplatform.base.redis; + +import com.iplatform.base.Constants; +import com.iplatform.base.SecurityConstants; +import com.iplatform.base.service.MenuServiceImpl; +import com.iplatform.base.util.MenuUtils; +import com.iplatform.base.util.menu.SystemMenu; +import com.iplatform.model.po.S_menu; +import com.iplatform.model.vo.MetaVo; +import com.iplatform.model.vo.RouterVo; +import com.walker.cache.Cache; +import com.walker.cache.CacheConfig; +import com.walker.infrastructure.ApplicationRuntimeException; +import com.walker.infrastructure.utils.JsonUtils; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.support.redis.cache.RedisCache; +import com.walker.support.redis.cache.RedisCacheProvider; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.Comparator; +import java.util.HashSet; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * 鑿滃崟鏈湴缂撳瓨锛屽洜涓轰笉闇�瑕侀泦缇ょ幆澧冿紝鍥犳鍙湁鍐呭瓨妯″紡(娌℃湁redis鏂瑰紡) + * @author 鏃跺厠鑻� + * @date 2022-11-01 + * @date 2024-01-17 鎹㈡垚鏀寔Redis缂撳瓨 + */ +public class MenuCacheProvider extends RedisCacheProvider<S_menu> { + + public MenuCacheProvider(){ + this.setUseRedis(true); + this.setLoadPage(false); + // 缂撳瓨鍙睍绀烘渶澶у�硷紝瓒呰繃璇ュ�艰皟鐢╣etIterator浼氭姤閿� + CacheConfig.setInitCachemapSize(20480); + } + + private MenuServiceImpl menuService; + + public void setMenuService(MenuServiceImpl menuService) { + this.menuService = menuService; + } + + @Override + protected int loadDataToCache(Cache cache) { + List<S_menu> list = this.menuService.selectAll(new S_menu()); + if(!StringUtils.isEmptyList(list)){ + if(this.isUseRedis()){ + // 濡傛灉redis涓紦瀛樻暟閲忓拰鏁版嵁搴撲腑涓嶄竴鑷达紙灏戯級锛屽垯娓呯┖redis缂撳瓨锛岄噸鏂板姞杞芥暟鎹簱鏁版嵁鍒扮紦瀛樹腑銆� + long totalCache = cache.getPersistentSize(); + if(totalCache != list.size()){ + logger.warn("menu缂撳瓨涓彍鍗曟暟閲忓皬浜庡疄闄呯敤鎴凤紝闇�瑕佹竻绌虹紦瀛橀噸鏂板姞杞�! cache = " + totalCache + ", db = " + list.size()); + cache.clear(); + + for(S_menu h : list){ + cache.put(h.getMenu_id(), h); + } + } + } + return list.size(); + } + return 0; + } + + @Override + public String getProviderName() { + return Constants.CACHE_NAME_MENU; + } + + @Override + public Class<?> getProviderType() { + return S_menu.class; + } + + /** + * 缁欏畾鐨勮彍鍗曪紝鏄惁鍖呭惈瀛愯彍鍗曘�� + * @param menuId 缁欏畾鑿滃崟ID + * @return + * @date 2022-12-29 + */ + public boolean isHasChildren(String menuId){ + List<S_menu> menuAll = this.getCacheMenuList(true, MenuUtils.MENU_SCOPE_PLATFORM); + for(S_menu menu : menuAll){ + if(menu.getParent_id().equals(menuId)){ + return true; + } + } + return false; + } + + /** + * 杩斿洖鑿滃崟闆嗗悎鍒楄〃(涓嶆槸鏍戠粨鏋�)锛岀洰鍓嶈鏂规硶鍦ㄤ唬鐮佺敓鎴愬姛鑳戒腑浣跨敤锛屽睍绀洪�夋嫨鐢熸垚鍦ㄥ摢涓彍鍗曟ā鍧椼�� + * @param roleIdList + * @param menuScope 鑿滃崟鑼冨洿锛�0 骞冲彴锛堢洰鍓嶄篃鏈�3锛夛紝4 鐙珛鍗曚綅锛� -1 琛ㄧず鏄剧ず鎵�鏈夎彍鍗曪紝>4 琛ㄧず鏈烘瀯鐗瑰畾鑿滃崟锛屽鐝富浠昏彍鍗曘�� + * @return + * @date 2022-11-27 + * @date 2023-06-05 娣诲姞鍙傛暟 menuScope + * @date 2023-10-11 menuScope 鍙傛暟澧炲姞鍊硷紙-1锛夊彲浠ュ睍绀烘墍鏈夎彍鍗曪紝閭斂闆嗗洟妯″紡 + * @date 2023-10-24 menuScope 鍙傛暟澧炲姞鍊硷紙澶т簬4锛夛紝琛ㄧず鐗瑰畾浜哄憳鐨勭壒瀹氳彍鍗曪紙濡傦細鐝富浠荤殑鑿滃崟锛� + */ + public List<SystemMenu> getMenuList(List<String> roleIdList, int menuScope){ + if(StringUtils.isEmptyList(roleIdList)){ + // 娌℃湁缁欏畾瑙掕壊闆嗗悎锛岃鏄庢槸绠$悊鍛橈紝鏄剧ず鎵�鏈夎彍鍗曟暟鎹� + return this.toSystemMenuList(this.getCacheMenuList(true, menuScope)); + } + // 鏍规嵁瑙掕壊鏉冮檺鍔犺浇涓嶅悓鑿滃崟闆嗗悎 + List<SystemMenu> menuList = new ArrayList<>(32); + List<String> menuIdList = this.menuService.queryRoleMenuIdList(roleIdList); + if(StringUtils.isEmptyList(menuIdList)){ + logger.warn("鐢ㄦ埛娌℃湁浠讳綍鏉冮檺锛宮enuIdList = null, roleIdList = {}", roleIdList); + return menuList; + } + + S_menu menu = null; + for(String menuId : menuIdList){ + menu = this.getCacheData(menuId); + if (menu == null) { + logger.warn("======menuScopeNotMatch鑿滃崟:=======menuId:{}==", menuId); + continue; + } + // 2023-10-11 澧炲姞杩欎釜if鍒ゆ柇锛屽鏋滄槸涓嶅尯鍒嗚寖鍥达紝鍒欏姞杞芥墍鏈夎彍鍗� +// if(menuScope != MenuUtils.MENU_SCOPE_ALL){ +// if(menuScope == MenuUtils.MENU_SCOPE_PLATFORM){ +// // 濡傛灉瑕佸睍绀鸿彍鍗曡寖鍥存槸锛氬钩鍙帮紝鍒欒彍鍗曚腑 >= 4鐨勫垎绫婚兘涓嶈锛岃繖浜涙槸椤剁骇鏈烘瀯涓氬姟鐙珛鑿滃崟銆� +// if(menu.getType().intValue() >= MenuUtils.MENU_SCOPE_ORG){ +// continue; +// } +// } else if(menuScope == MenuUtils.MENU_SCOPE_ORG){ +//// if(menu.getType().intValue() < MenuUtils.MENU_SCOPE_ORG){ +// if(menu.getType().intValue() != MenuUtils.MENU_SCOPE_ORG){ +// // 濡傛灉瑕佸睍绀鸿彍鍗曡寖鍥存槸锛氶《绾ф満鏋勪笟鍔$殑鐙珛鑿滃崟锛屽垯骞冲彴鑿滃崟涓嶆樉绀恒��2023-06-01 +// continue; +// } +// } else if(menuScope > MenuUtils.MENU_SCOPE_ORG){ +// // 瀵逛簬澶т簬鏈烘瀯鑿滃崟鐨勶紝閮藉睘浜庢満鏋勭壒瀹氳彍鍗曪紝蹇呴』涓庝紶鍏ヨ寖鍥村畬鍏ㄤ竴鑷达紝濡傦細鐝富浠昏彍鍗曠瓑銆�2023-10-24 +// if(menu.getType().intValue() != menuScope){ +// continue; +// } +// } +// } + if(MenuUtils.menuScopeNotMatch(menuScope, menu)){ + continue; + } + menuList.add(new SystemMenu(menu)); + } + + // 2023-10-13锛屾煡鎵炬瘡涓彍鍗曚笂绾э紝濡傛灉涓婄骇鑼冨洿绫诲瀷涓庝笅绾ц彍鍗曚笉涓�鑷达紝涔熼渶瑕佸姞鍏ュ垪琛ㄤ腑 + for(String menuId : menuIdList){ + if(MenuUtils.containMenu(menuList, menuId)){ + continue; + } + menu = this.getCacheData(menuId); + if (menu == null) { + logger.warn("======containMenu鑿滃崟涓婄骇:=======menuId:{}==", menuId); + continue; + } + menuList.add(new SystemMenu(menu)); + } +// if(!StringUtils.isEmptyList(menuList)){ +// String pid = null; +// for(SystemMenu systemMenu : menuList){ +// pid = systemMenu.getParent_id(); +// if(pid.equals(MenuUtils.MENU_ID_ROOT)){ +// continue; +// } +// if(menuIdList.contains(pid)){ +// this.addParentMenu2Collection(menuList, pid); +// } +// } +// } + +// Collections.sort(menuList, new ParentMenuComparator()); +// Collections.sort(menuList, new MenuOrderNumComparator()); +// Collections.sort(menuList); + List<SystemMenu> collect = menuList.stream().sorted(Comparator.comparing(SystemMenu::getMenu_id)).collect(Collectors.toList()); + logger.info("+++++++++++++++++++++"); + return collect; + } + + public List<SystemMenu> toSystemMenuList(List<S_menu> srcMenuList){ + List<SystemMenu> list = new ArrayList<>(32); + if(StringUtils.isEmptyList(srcMenuList)){ + return list; + } + for(S_menu menu : srcMenuList){ + list.add(new SystemMenu(menu)); + } + return list; + } + + /** + * 鑾峰緱缂撳瓨鑿滃崟鍒楄〃 + * @param containButton 鏄惁鍖呭惈鎸夐挳鏉冮檺鑿滃崟 + * @param menuScope 鑿滃崟鑼冨洿锛屽鐙珛椤剁骇鏈烘瀯锛屽彲浠ユ樉绀烘満鏋勮缃殑鍒嗙被鑿滃崟鑼冨洿锛岀洰鍓嶆湁锛�0-骞冲彴锛堝寘鍚�3锛夛紝4-椤剁骇鍗曚綅鐙珛鑿滃崟 + * @return + * @date 2023-06-01 + */ + public List<S_menu> getCacheMenuList(boolean containButton, int menuScope){ + List<S_menu> data = new ArrayList<>(); + S_menu menu = null; + String temp = null; + try{ +// for(Iterator<Cachable> it = this.getCache().getIterator(); it.hasNext();){ + for(String value : ((RedisCache)this.getCache()).getIterator(null)){ +// menu = (S_menu) it.next().getValue(); + temp = value; + menu = JsonUtils.jsonStringToObject(value, S_menu.class); + + // 2023-10-24 + if(MenuUtils.menuScopeNotMatch(menuScope, menu)){ + continue; + } + + if(menu.getStatus().intValue() == MenuUtils.MENU_STATUS_DISABLED){ + // 鍘绘帀绂佺敤鑿滃崟 + continue; + } + if(menu.getMenu_type().equals(MenuUtils.MENU_TYPE_BUTTON)){ + if(containButton){ + data.add(menu); + } + } else { + data.add(menu); + } + } + // TODO 鍓嶇鎶ラ敊 鏆傛椂娉ㄩ噴 +// Collections.sort(data, new ParentMenuComparator()); +// Collections.sort(data, new MenuOrderNumComparator()); + Collections.sort(data); + } catch (Exception ex){ + throw new ApplicationRuntimeException("redis瀛樺偍'S_menu'瑙f瀽閿欒锛�" + temp, ex); + } + + return data; + } + + /** + * 鏍规嵁鐖惰妭鐐圭殑ID鑾峰彇鎵�鏈夊瓙鑺傜偣 + * + * @param list 鍒嗙被琛� + * @param parentId 浼犲叆鐨勭埗鑺傜偣ID + * @return String + */ + public List<SystemMenu> getChildPerms(List<SystemMenu> list, String parentId) { + List<SystemMenu> returnList = new ArrayList<>(); + for (Iterator<SystemMenu> iterator = list.iterator(); iterator.hasNext();) { + SystemMenu t = iterator.next(); + // 涓�銆佹牴鎹紶鍏ョ殑鏌愪釜鐖惰妭鐐笽D,閬嶅巻璇ョ埗鑺傜偣鐨勬墍鏈夊瓙鑺傜偣 + if (t.getParent_id().equals(parentId)) { + recursionFn(list, t); + returnList.add(t); + } + } + return returnList; + } + + /** + * 閫掑綊鍒楄〃 + * + * @param list + * @param t + */ + private void recursionFn(List<SystemMenu> list, SystemMenu t) { + // 寰楀埌瀛愯妭鐐瑰垪琛� + List<SystemMenu> childList = getChildList(list, t); + t.setChildren(childList); + for (SystemMenu tChild : childList) { + if (hasChild(list, tChild)) { + recursionFn(list, tChild); + } + } + } + + /** + * 寰楀埌瀛愯妭鐐瑰垪琛� + */ + private List<SystemMenu> getChildList(List<SystemMenu> list, SystemMenu t) { + List<SystemMenu> tlist = new ArrayList<>(); + Iterator<SystemMenu> it = list.iterator(); + while (it.hasNext()) { + SystemMenu n = it.next(); + if (n.getParent_id().equals(t.getMenu_id())) { + tlist.add(n); + } + } + return tlist; + } + + /** + * 鍒ゆ柇鏄惁鏈夊瓙鑺傜偣 + */ + private boolean hasChild(List<SystemMenu> list, SystemMenu t) { + return getChildList(list, t).size() > 0; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + //~ 浠ヤ笅涓虹敤鎴风櫥褰曡彍鍗曞睍绀轰娇鐢紝2022-11-12 + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + /** + * 杩斿洖鑿滃崟鏉冮檺鏍囪瘑瀛楃涓查泦鍚堬紝璇ユ柟娉曡嫢渚濆墠绔娇鐢ㄣ��<p></p> + * 鍚庣画浼氬幓鎺夊墠绔鏉冮檺鐐圭殑渚濊禆銆� + * @param menuIdList + * @param showAll 鏄惁鏄剧ず鎵�鏈夋潈闄愮偣 + * @param menuScope 鑿滃崟鑼冨洿锛屽鐙珛椤剁骇鏈烘瀯锛屽彲浠ユ樉绀烘満鏋勮缃殑鍒嗙被鑿滃崟鑼冨洿锛岀洰鍓嶆湁锛�0-骞冲彴锛堝寘鍚�3锛夛紝4-椤剁骇鍗曚綅鐙珛鑿滃崟 + * @return + * @date 2022-11-12 + * @date 2023-03-20 濡傛灉缁欏畾鑿滃崟id涓虹┖锛屽垯涓嶈繑鍥炰换浣曟潈闄愮偣淇℃伅銆傛椂鍏嬭嫳 + * @date 2023-06-07 瀵逛簬鐙珛鍗曚綅锛堝晢鎴凤級鍒欎細鏄剧ず鎵�鏈夎鍗曚綅鐨勮彍鍗曟潈闄愪俊鎭� + */ + public Set<String> getPermissionSet(List<String> menuIdList, boolean showAll, int menuScope){ + if(StringUtils.isEmptyList(menuIdList) && !showAll){ + return new HashSet<>(); + } + List<String> permsList = new ArrayList<>(64); +// List<S_menu> menuAll = this.getCacheMenuList(true, MenuUtils.MENU_SCOPE_PLATFORM); + List<S_menu> menuAll = this.getCacheMenuList(true, menuScope); + if(!StringUtils.isEmptyList(menuAll)){ + for(S_menu menu : menuAll){ + + // 2023-10-11 澧炲姞杩欎釜if鍒ゆ柇锛屽鏋滄槸涓嶅尯鍒嗚寖鍥达紝鍒欏姞杞芥墍鏈夎彍鍗� +// if(menuScope != MenuUtils.MENU_SCOPE_ALL){ +// +// // 2023-06-07 +// if(menuScope == MenuUtils.MENU_SCOPE_PLATFORM){ +// // 濡傛灉瑕佸睍绀鸿彍鍗曡寖鍥存槸锛氬钩鍙帮紝鍒欒彍鍗曚腑 >= 4鐨勫垎绫婚兘涓嶈锛岃繖浜涙槸椤剁骇鏈烘瀯涓氬姟鐙珛鑿滃崟銆� +// if(menu.getType().intValue() >= MenuUtils.MENU_SCOPE_ORG){ +// continue; +// } +// } else if(menu.getType().intValue() < MenuUtils.MENU_SCOPE_ORG){ +// // 濡傛灉瑕佸睍绀鸿彍鍗曡寖鍥存槸锛氶《绾ф満鏋勪笟鍔$殑鐙珛鑿滃崟锛屽垯骞冲彴鑿滃崟涓嶆樉绀恒��2023-06-01 +// continue; +// } +// } + // 2023-10-24 + if(MenuUtils.menuScopeNotMatch(menuScope, menu)){ + continue; + } + + if(StringUtils.isEmpty(menu.getPerms())){ + continue; + } + if(StringUtils.isEmptyList(menuIdList)){ + // 濡傛灉娌℃湁闄愬埗锛屽叏閮ㄥ姞涓� + permsList.add(menu.getPerms()); + } else if(menuIdList.contains(menu.getMenu_id())){ + // 濡傛灉闄愬埗鏈夛紝鍒欏彧娣诲姞缁欏畾鐨� + permsList.add(menu.getPerms()); + } + } + } + + Set<String> permsSet = new HashSet<>(); + for(String perms : permsList){ + if (StringUtils.isNotEmpty(perms)) { + permsSet.addAll(Arrays.asList(perms.trim().split(","))); + } + } + return permsSet; + } + + /** + * 杩斿洖鑿滃崟鏍戝舰缁撴灉锛屽垪琛ㄤ腑鍖呭惈澶氫釜鑿滃崟鏍硅妭鐐癸紝menuIdList 涓虹┖鏃讹紝鍏佽杩斿洖鎵�鏈夌殑銆� + * @param menuIdList + * @param containButton + * @return + * @date 2023-03-22 + */ + public List<SystemMenu> getMenuTreeAll(List<String> menuIdList, boolean containButton, int menuScope){ + return this.getMenuTree(menuIdList, containButton, true, menuScope); + } + + /** + * 杩斿洖鑿滃崟鏍戝舰缁撴灉锛屽垪琛ㄤ腑鍖呭惈澶氫釜鑿滃崟鏍硅妭鐐广�� + * @param menuIdList 鎸囧畾鏄剧ず鐨勮彍鍗曪紝濡傛灉涓虹┖琛ㄧず涓嶇壒鍒檺鍒� + * @param containButton 鏄惁鍖呭惈鎸夐挳鏉冮檺 + * @param showAll 褰撶粰瀹�'menuIdList'涓虹┖鏃讹紝鏄惁鏄剧ず鎵�鏈夎彍鍗� + * @return + * @date 2022-12-18 鏇存柊 + * @date 2023-03-22 娣诲姞鍙傛暟'showAll' + */ + public List<SystemMenu> getMenuTree(List<String> menuIdList, boolean containButton, boolean showAll, int menuScope){ + List<SystemMenu> menuGroupList = new ArrayList<>(32); + if(StringUtils.isEmptyList(menuIdList) && !showAll){ + // 2023-03-22 缁欏畾涓虹┖鑿滃崟id锛屽苟涓斾笉鍏佽鏄剧ず鎵�鏈夛紝杩斿洖绌鸿彍鍗曟爲銆� + return getChildPerms(menuGroupList, "0"); + } +// List<S_menu> menuAll = this.getCacheMenuList(false); + List<S_menu> menuAll = this.getCacheMenuList(containButton, menuScope); + if(!StringUtils.isEmptyList(menuAll)){ + for(S_menu menu : menuAll){ + if(menuIdList == null){ + // 濡傛灉娌℃湁闄愬埗锛屽叏閮ㄥ姞涓� + menuGroupList.add(new SystemMenu(menu)); + } else if(menuIdList.contains(menu.getMenu_id())){ + // 濡傛灉闄愬埗鏈夛紝鍒欏彧娣诲姞缁欏畾鐨� + menuGroupList.add(new SystemMenu(menu)); + } + } + } + return getChildPerms(menuGroupList, "0"); + } + + /** + * 鏋勫缓鍓嶇璺敱鎵�闇�瑕佺殑鑿滃崟锛堣嫢渚濓級 + * + * @param menus 鑿滃崟鍒楄〃 + * @return 璺敱鍒楄〃 + */ + @Deprecated + public List<RouterVo> buildMenus(List<SystemMenu> menus) { + List<RouterVo> routers = new LinkedList<RouterVo>(); + for (SystemMenu menu : menus) { + RouterVo router = new RouterVo(); + router.setHidden(MenuUtils.MENU_INVISIBLE.equals(menu.getVisible())); + router.setName(MenuUtils.getRouteName(menu)); + router.setPath(MenuUtils.getRouterPath(menu)); + router.setComponent(MenuUtils.getComponent(menu)); + router.setQuery(menu.getQuery()); + router.setMeta(new MetaVo(menu.getMenu_name(), menu.getIcon(), menu.getIs_cache().intValue() == MenuUtils.MENU_CACHE_DISABLE, menu.getPath())); + List<SystemMenu> cMenus = menu.getChildren(); + if (!cMenus.isEmpty() && cMenus.size() > 0 && menu.getMenu_type().equals(MenuUtils.MENU_TYPE_FOLDER)) { + router.setAlwaysShow(true); + router.setRedirect("noRedirect"); + router.setChildren(buildMenus(cMenus)); + } + else if (MenuUtils.isMenuFrame(menu)) { + router.setMeta(null); + List<RouterVo> childrenList = new ArrayList<RouterVo>(); + RouterVo children = new RouterVo(); + children.setPath(menu.getPath()); + children.setComponent(menu.getComponent()); + children.setName(StringUtils.capitalize(menu.getPath())); + children.setMeta(new MetaVo(menu.getMenu_name(), menu.getIcon(), menu.getIs_cache().intValue() == MenuUtils.MENU_CACHE_DISABLE, menu.getPath())); + children.setQuery(menu.getQuery()); + childrenList.add(children); + router.setChildren(childrenList); + } + else if (menu.getParent_id().equals(MenuUtils.MENU_ID_ROOT) && MenuUtils.isInnerLink(menu)) { + router.setMeta(new MetaVo(menu.getMenu_name(), menu.getIcon())); + router.setPath("/"); + List<RouterVo> childrenList = new ArrayList<RouterVo>(); + RouterVo children = new RouterVo(); + String routerPath = MenuUtils.innerLinkReplaceEach(menu.getPath()); + children.setPath(routerPath); + children.setComponent(MenuUtils.INNER_LINK); + children.setName(StringUtils.capitalize(routerPath)); + children.setMeta(new MetaVo(menu.getMenu_name(), menu.getIcon(), menu.getPath())); + childrenList.add(children); + router.setChildren(childrenList); + } + routers.add(router); + } + return routers; + } + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + //~ 浠ヤ笅涓虹郴缁熸潈闄愮鐞嗕娇鐢紝2022-11-02 + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + /** + * 杩斿洖绯荤粺鎵�鏈夎鑹蹭笌url鍏宠仈鏁版嵁锛宻ecurity鏉冮檺閰嶇疆瀹炵敤銆�<p></p> + * 璇ユ柟娉曚細鏈夐噸澶嶆暟鎹紝渚嬪:澶氫釜瑙掕壊鍏锋湁鐩稿悓鐨刄RL锛岀敱涓氬姟鍘婚櫎閲嶅銆�<p></p> + * list[0] = role_id, list[1] = url <p></p> + * 鍥犱负Map瀵硅薄鐩稿悓key浼氳鐩杤alue锛屾墍浠ユ崲鎴怢ist闆嗗悎杩斿洖銆� + * @return + * @date 2022-11-02 + */ + public List<String[]> getAllRoleMenuMap(){ + List<String[]> result = new ArrayList<>(); + List<Map<String, Object>> list = this.menuService.queryRolesPermList(); + if(StringUtils.isEmptyList(list)){ + return result; + } + + String perms = null; + String menuId = null; + S_menu menu = null; + + for(Map<String, Object> map : list){ + menuId = map.get("menu_id").toString(); + menu = this.getCacheData(menuId); + if(menu == null){ + throw new IllegalArgumentException("缂撳瓨涓湭鎵惧埌鑿滃崟:" + menuId); + } + perms = menu.getPerms(); + if(StringUtils.isEmpty(perms)){ + continue; + } +// result.put(map.get("role_id").toString(), MenuUtils.acquireUrlFromPerms(perms)); + result.add(new String[]{map.get("role_id").toString(), MenuUtils.acquireUrlFromPerms(perms)}); + } + + // 2023-06-07 + // 鍟嗘埛锛堥《绾ф満鏋勶級鐗规湁鐨勮彍鍗曪紝涔熼渶瑕佸姞鍏ュ埌瑙掕壊涓紝璁剧疆榛樿涓夋柟瑙掕壊锛歊OLE_MERCHANT + Set<String> merchantPermSet = this.getPermissionSet(null, true, MenuUtils.MENU_SCOPE_ORG); + if(merchantPermSet != null){ + for(String onePerms : merchantPermSet){ + result.add(new String[]{SecurityConstants.ROLE_MERCHANT, MenuUtils.acquireUrlFromPerms(onePerms)}); + } + logger.debug("娣诲姞鍟嗘埛锛堥《绾ф満鏋勶級瑙掕壊鏉冮檺锛歿}", merchantPermSet.size()); + } + return result; + } + + /** + * 杩斿洖绯荤粺鎵�鏈夎彍鍗曞寘鍚潈闄愮殑url闆嗗悎锛屽嵆:鎵�鏈塸erms瀛樺湪鐨勮彍鍗曘�� + * @return + * @date 2022-11-02 + */ + public List<String> getAllMenuUrlList(){ + List<String> urlList = new ArrayList<>(32); + S_menu menu = null; + String perms = null; + String temp = null; + try{ +// for(Iterator<Cachable> it = this.getCache().getIterator(); it.hasNext();){ + for(String value : ((RedisCache)this.getCache()).getIterator(null)){ +// menu = (S_menu) it.next().getValue(); + temp = value; + menu = JsonUtils.jsonStringToObject(value, S_menu.class); + perms = menu.getPerms(); + if(StringUtils.isEmpty(perms)){ + continue; + } + urlList.add(MenuUtils.acquireUrlFromPerms(perms)); + } + } catch (Exception ex){ + throw new ApplicationRuntimeException("redis瀛樺偍'S_menu'瑙f瀽閿欒锛�" + temp, ex); + } + return urlList; + } +} diff --git a/iplatform-core/pom.xml b/iplatform-core/pom.xml new file mode 100644 index 0000000..eb743e7 --- /dev/null +++ b/iplatform-core/pom.xml @@ -0,0 +1,196 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>low-consum-manage</artifactId> + <groupId>com.consum</groupId> + <version>1.0.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <groupId>com.iplatform</groupId> + <artifactId>iplatform-core</artifactId> + <name>iplatform-core</name> + <packaging>jar</packaging> + <version>3.2.0</version> + + <properties> + </properties> + + <dependencies> + + <dependency> + <groupId>com.walkersoft</groupId> + <artifactId>walker-infrastructure</artifactId> + <version>${walker-infrastructure.version}</version> + <systemPath>${project.basedir}/src/main/resources/lib/walker-infrastructure-3.2.0.jar</systemPath> + <scope>system</scope> + </dependency> + + <!-- 鍩虹搴撲緷璧�: web, 鐢ㄦ埛鏍稿績瀹氫箟鍦ㄨ繖閲�, + 绂诲紑walker-web-security妯″潡涔熻兘杩愯, 2022/10/29 --> + <dependency> + <groupId>com.walkersoft</groupId> + <artifactId>walker-web</artifactId> + <version>${walker-web-security.version}</version> +<!-- <systemPath>${project.basedir}/src/main/resources/lib/walker-web-2.3.0-SNAPSHOT.jar</systemPath>--> + <systemPath>${project.basedir}/src/main/resources/lib/walker-web-3.2.0.jar</systemPath> + <scope>system</scope> + </dependency> + + <!-- 鍩虹渚濊禆: 缂撳瓨妯″潡, 2022/09/20 --> + <dependency> + <groupId>com.walkersoft</groupId> + <artifactId>walker-cache</artifactId> + <version>${walker-web-security.version}</version> + <systemPath>${project.basedir}/src/main/resources/lib/walker-cache-3.2.0.jar</systemPath> + <scope>system</scope> + </dependency> + + <!-- 渚濊禆鏂囦欢妯″潡鍩虹搴擄紝2023-02-14 --> + <dependency> + <groupId>com.walkersoft</groupId> + <artifactId>walker-file</artifactId> + <version>${walker-web-security.version}</version> + <systemPath>${project.basedir}/src/main/resources/lib/walker-file-3.2.0.jar</systemPath> + <scope>system</scope> + </dependency> + + <!-- 渚濊禆搴曞眰閫氫俊妯″潡锛�2024-01-23 --> + <dependency> + <groupId>com.walkersoft</groupId> + <artifactId>walker-tcp</artifactId> + <version>${walker-web-security.version}</version> + <systemPath>${project.basedir}/src/main/resources/lib/walker-tcp-3.2.0.jar</systemPath> + <scope>system</scope> + </dependency> + <dependency> + <groupId>com.walkersoft</groupId> + <artifactId>walker-push-rocketmq</artifactId> + <version>${walker-web-security.version}</version> + <systemPath>${project.basedir}/src/main/resources/lib/walker-push-rocketmq-3.2.0.jar</systemPath> + <scope>system</scope> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-web</artifactId> + </dependency> + <!-- spring security妯″潡寮曞叆锛�2022/10/26 --> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-security</artifactId> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-jdbc</artifactId> + <exclusions> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-logging</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework</groupId> + <artifactId>spring-aop</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework</groupId> + <artifactId>spring-beans</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-aop</artifactId> + <exclusions> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework</groupId> + <artifactId>spring-beans</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + </exclusion> + </exclusions> + </dependency> + + <!-- 娉ㄨВ鏀寔鍒涘缓Bean --> + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-autoconfigure</artifactId> + <exclusions> + <exclusion> + <groupId>org.springframework</groupId> + <artifactId>spring-core</artifactId> + </exclusion> + <exclusion> + <groupId>org.springframework</groupId> + <artifactId>spring-beans</artifactId> + </exclusion> + </exclusions> + </dependency> + <!-- 瑙f瀽 yml 閰嶇疆鏂囦欢锛屼笉閰嶇疆鎶ラ敊鎵句笉鍒版枃浠躲��2022-08-25 --> + <dependency> + <groupId>org.yaml</groupId> + <artifactId>snakeyaml</artifactId> + </dependency> + + <dependency> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-data-redis</artifactId> + <!-- <optional>true</optional>--> + <exclusions> + <exclusion> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-logging</artifactId> + </exclusion> + </exclusions> + </dependency> + + <!-- 鍩烘湰鏃ュ織閰嶇疆 --> + <dependency> + <groupId>ch.qos.logback</groupId> + <artifactId>logback-classic</artifactId> + </dependency> + + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </dependency> + + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-lang3</artifactId> + </dependency> + + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <version>3.2.11</version> + <configuration> + <!-- 2023-11-06 璇ュ弬鏁版寚瀹氫簡渚濊禆鐨勬湰鍦扮被搴擄紝涓嶅紩鍏ュ垯鎶ラ敊锛氫笉鑳芥寚鍚戞湰鍦癹ar鏂囦欢 --> + <arguments> + <argument>${project.basedir}/src/main/resources/lib</argument> + </arguments> + <!-- 2023-11-06 璇ュ弬鏁版寚瀹氾紝鎵撳寘蹇界暐 Main 鍑芥暟銆�--> + <skip>true</skip> + </configuration> + </plugin> + </plugins> + </build> + +</project> diff --git a/iplatform-core/src/main/java/com/iplatform/core/BeanContextAware.java b/iplatform-core/src/main/java/com/iplatform/core/BeanContextAware.java new file mode 100644 index 0000000..6848f0d --- /dev/null +++ b/iplatform-core/src/main/java/com/iplatform/core/BeanContextAware.java @@ -0,0 +1,51 @@ +package com.iplatform.core; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.context.ApplicationEvent; +import org.springframework.core.Ordered; + +/** + * 鑾峰彇绯荤粺瀹氫箟鐨� Bean 瀹炰緥銆� + * @author 鏃跺厠鑻� + * @date 2022-08-25 + */ +public class BeanContextAware implements ApplicationContextAware, Ordered { + + private static ApplicationContext applicationContext; + + @Override + public void setApplicationContext(ApplicationContext ctx) throws BeansException { + applicationContext = ctx; + } + + public static final String[] getBeanNamesForType(Class<?> clazz){ + return applicationContext.getBeanNamesForType(clazz); + } + + public static final Object getBeanByName(String name){ + return applicationContext.getBean(name); + } + + public static final <T> T getBeanByType(Class<T> clazz){ + return applicationContext.getBean(clazz); + } + + /** + * 鍙戦�丼pring浜嬩欢锛岀洰鍓嶅彧鏈夎鑹诧紙鍔熻兘锛夋潈闄愬彉鏇达紝閫氱煡Security閲嶆柊鍔犺浇璧勬簮銆� + * @param event + * @date 2023-05-07 + */ + public static final void publishEvent(ApplicationEvent event){ + if(event == null){ + throw new IllegalArgumentException("event涓嶈兘涓虹┖"); + } + applicationContext.publishEvent(event); + } + + @Override + public int getOrder() { + return Ordered.HIGHEST_PRECEDENCE; + } +} diff --git a/iplatform-core/src/main/java/com/iplatform/core/LoginStrategy.java b/iplatform-core/src/main/java/com/iplatform/core/LoginStrategy.java new file mode 100644 index 0000000..ed88837 --- /dev/null +++ b/iplatform-core/src/main/java/com/iplatform/core/LoginStrategy.java @@ -0,0 +1,39 @@ +package com.iplatform.core; + +/** + * 鐧诲綍绛栫暐瀹氫箟銆� + * <pre> + * 1)绯荤粺鏀寔閰嶇疆澶氫釜鐧诲綍绛栫暐瀹炵幇锛屼緥濡傦細鍚屼竴鎵嬫満鍙蜂笉鑳介噸澶嶇櫥褰曠瓑銆� + * 2)姣忕鐧诲綍绛栫暐鍙鍏抽棴 + * </pre> + * @author 鏃跺厠鑻� + * @date 2023-07-11 + */ +public interface LoginStrategy { + + /** + * 鏄惁鍏佽鐧诲綍 + * @param loginId + * @param clientType + * @return + */ + boolean allowLogin(String loginId, String clientType); + + /** + * 濡傛灉涓嶅厑璁革紝杩斿洖閿欒鎻愮ず + * @return + */ + String acquireError(); + + /** + * 绛栫暐瀹氫箟鍚嶅瓧锛屼究浜庣晫闈㈢鐞� + * @return + */ + String getName(); + + /** + * 鏄惁鍚敤 + * @return + */ + boolean isEnabled(); +} diff --git a/iplatform-core/src/main/java/com/iplatform/core/PlatformConfiguration.java b/iplatform-core/src/main/java/com/iplatform/core/PlatformConfiguration.java new file mode 100644 index 0000000..3cebda5 --- /dev/null +++ b/iplatform-core/src/main/java/com/iplatform/core/PlatformConfiguration.java @@ -0,0 +1,15 @@ +package com.iplatform.core; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 鎵�鏈夋ā鍧楃殑閰嶇疆鏂囦欢瀵硅薄閮借缁ф壙骞冲彴閰嶇疆銆� + * @author 鏃跺厠鑻� + * @date 2022-09-20 + */ +public abstract class PlatformConfiguration { + + protected final transient Logger logger = LoggerFactory.getLogger(this.getClass()); + +} diff --git a/iplatform-core/src/main/java/com/iplatform/core/PlatformException.java b/iplatform-core/src/main/java/com/iplatform/core/PlatformException.java new file mode 100644 index 0000000..cffb02a --- /dev/null +++ b/iplatform-core/src/main/java/com/iplatform/core/PlatformException.java @@ -0,0 +1,15 @@ +package com.iplatform.core; + +import com.walker.infrastructure.ApplicationException; + +/** + * 骞冲彴瀹氫箟妫�鏌ュ紓甯革紝鍚庣画涓氬姟绫诲紓甯搁兘瑕佺户鎵胯瀵硅薄銆� + * @author 鏃跺厠鑻� + * @date 2023-03-28 + */ +public class PlatformException extends ApplicationException { + + public PlatformException(String msg, Throwable caution){ + super(msg, caution); + } +} diff --git a/iplatform-core/src/main/java/com/iplatform/core/RegularConstants.java b/iplatform-core/src/main/java/com/iplatform/core/RegularConstants.java new file mode 100644 index 0000000..94feb81 --- /dev/null +++ b/iplatform-core/src/main/java/com/iplatform/core/RegularConstants.java @@ -0,0 +1,97 @@ +package com.iplatform.core; + +public class RegularConstants { + + //鏁板瓧 + public static final String NUMBER = "^-?[0-9]+"; + + //閭 + public static final String EMAIL = "^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$"; + + //鎵嬫満 + public static final String PHONE = "^1([358][0-9]|4[579]|66|7[0135678]|9[89])[0-9]{8}$"; + + //鍙牎楠屾墜鏈轰负11浣� + public static final String PHONE_TWO = "^1\\d{10}$"; + + //鏁存暟鎴栬�呭皬鏁帮細 + public static final String INTEGER_OR_FLOAT = "^[0-9]+=\\.{0,1}[0-9]{0,2}$"; + + //n浣嶇殑鏁板瓧 + public static final String NUMBER_LEN = "^\\d{n}$"; + + //n浣嶇殑鏁板瓧 + public static final String NUMBER_MIN_LEN = "^\\d{n,}$"; + + //m~n浣嶇殑鏁板瓧 + public static final String NUMBER_LEN_RANGE = "^\\d{m,n}$"; + + //闆跺拰闈為浂寮�澶寸殑鏁板瓧 + public static final String NUMBER_LEN_UNSIGNED_CONTAINS_ZERO = "^(0|[1-9][0-9]*)$"; + + //鏈変袱浣嶅皬鏁扮殑姝e疄鏁� + public static final String FLOAT_TWO_LEN = "^[0-9]+(.[0-9]{2})?$"; + + //鏈変袱浣嶅皬鏁扮殑姝e疄鏁� + public static final String FLOAT_LEN_RANGE = "^[0-9]+(.[0-9]{1,3})?$"; + + //闈為浂鐨勬鏁存暟 + public static final String NUMBER_UNSIGNED = "^\\+?[1-9][0-9]*$"; + + //闈�0鐨勮礋鏁� + public static final String NUMBER_NOT_UNSIGNED = "^\\-[1-9][]0-9\"*$"; + + //3浣嶅瓧绗︿覆 + public static final String STRING_THREE_LEN = "^.{3}$"; + + //鎵�鏈夎嫳鏂囧瓧姣� + public static final String STRING_ALL_EN_CHARS = "^[A-Za-z]+$"; + + //鐢�26涓ぇ鍐欒嫳鏂囧瓧姣嶇粍鎴愮殑瀛楃涓� + public static final String STRING_UPPER_EN_CHARS = "^[A-Z]+$"; + + //鐢�26涓皬鍐欒嫳鏂囧瓧姣嶇粍鎴愮殑瀛楃涓� + public static final String STRING_LOWER_EN_CHARS = "^[a-z]+$"; + + //鐢辨暟瀛楀拰26涓嫳鏂囧瓧姣嶇粍鎴愮殑瀛楃涓� + public static final String STRING_ALL_EN_CHARS_AND_NUMBER = "^[A-Za-z0-9]+$"; + + //鐢辨暟瀛楀拰26涓嫳鏂囧瓧姣嶇粍鎴愮殑瀛楃涓� + public static final String STRING_ALL_EN_CHARS_AND_UNDER_LINE = "^\\w+"; + + //楠岃瘉鐢ㄦ埛瀵嗙爜锛� 姝g‘鏍煎紡涓猴細浠ュ瓧姣嶅紑澶达紝闀垮害鍦�6~18涔嬮棿锛屽彧鑳藉寘鍚瓧绗︺�佹暟瀛楀拰涓嬪垝绾裤�� + public static final String PASSWORD = "^[a-zA-Z]\\w{5,17}$"; + + //楠岃瘉鐮侊紝 姝g‘鏍煎紡涓猴細4浣嶆暟瀛楅獙璇佺爜銆� + public static final String SMS_VALIDATE_CODE_NUM = "^\\d{6}$"; + + //楠岃瘉鐮侊紝 姝g‘鏍煎紡涓猴細6浣嶆暟瀛楅獙璇佺爜銆� + public static final String VALIDATE_CODE_NUM_SIX = "^\\d{6}$"; + + //姹夊瓧 + public static final String CHINESE = "^[\\u4e00-\\u9fa5]{0,}$"; + + //url http寮�澶� + public static final String URL = "[a-zA-z]+://[^\\s]*"; + + //鐢佃瘽 姝g‘鏍煎紡涓猴細"XXX-XXXXXXX"銆�"XXXX-XXXXXXXX"銆�"XXX-XXXXXXX"銆�"XXX-XXXXXXXX"銆�"XXXXXXX"鍜�"XXXXXXXX" + public static final String TEL = "^(\\(\\d{3,4}-)|\\d{3.4}-)?\\d{7,8}$"; + + //楠岃瘉韬唤璇佸彿 锛�15浣嶆垨18浣嶆暟瀛楋級 + public static final String ID_CARD = "^\\d{15}|\\d{18}$"; + + // 楠岃瘉涓�骞寸殑12涓湀 姝g‘鏍煎紡涓猴細"01"锝�"09"鍜�"1"锝�"12" + public static final String MONTH = "^(0?[1-9]|1[0-2])$"; + + // 楠岃瘉涓�涓湀鐨�31澶� 姝g‘鏍煎紡涓猴紱"01"锝�"09"鍜�"1"锝�"31" + public static final String DAY = "^((0?[1-9])|((1|2)[0-9])|30|31)$"; + + // 鍖归厤绌鸿鐨勬鍒欒〃杈惧紡 + public static final String EMPTY_LINE = "\\n[\\s| ]*\\r"; + + // 鍖归厤html鏍囩鐨勬鍒欒〃杈惧紡 + public static final String HTML_TAG = "<(.*)>(.*)<\\/(.*)>|<(.*)\\/>"; + + // 鍖归厤棣栧熬绌烘牸鐨勬鍒欒〃杈惧紡 + public static final String TRIM = "(^\\s*)|(\\s*$)"; +} diff --git a/iplatform-core/src/main/java/com/iplatform/core/SimpleVariable.java b/iplatform-core/src/main/java/com/iplatform/core/SimpleVariable.java new file mode 100644 index 0000000..98fa3ce --- /dev/null +++ b/iplatform-core/src/main/java/com/iplatform/core/SimpleVariable.java @@ -0,0 +1,124 @@ +package com.iplatform.core; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.infrastructure.arguments.Variable; +import com.walker.infrastructure.arguments.VariableType; +import com.walker.infrastructure.utils.StringUtils; + +/** + * 鍦� Redis 涓娇鐢ㄧ殑骞跺瓨鍌ㄧ殑鍙傛暟鍙橀噺瀵硅薄銆� + * @author 鏃跺厠鑻� + * @date 2022-11-29 + */ +public class SimpleVariable implements Variable { + +// @JsonIgnore +// private String description = StringUtils.EMPTY_STRING; +// @JsonIgnore +// private int integerValue = 0; +// @JsonIgnore +// private boolean booleanValue = false; +// @JsonIgnore +// private float floatValue = 0F; +// @JsonIgnore +// private long longValue = 0; +// @JsonIgnore +// private double doubleValue = 0.0; + + private String dataType = VariableType.DEF_STRING; + + private String stringValue; + + // 鏁版嵁key + private String id; + + public SimpleVariable(){} + + public SimpleVariable(String id, String value){ + this.id = id; + this.stringValue = value; + } + + public void setId(String id) { + this.id = id; + } + + public void setStringValue(String stringValue) { + this.stringValue = stringValue; + } + + @Override + public String getId() { + return this.id; + } + + @JsonIgnore + @Override + public String getDescription() { +// return this.description; + return null; + } + + @JsonIgnore + @Override + public VariableType getType() { + if(StringUtils.isNotEmpty(this.dataType)){ + return VariableType.getType(this.dataType); + } + return null; + } + + @Override + public String getStringValue() { + return this.stringValue; + } + + @JsonIgnore + @Override + public int getIntegerValue() { +// return this.integerValue; + return Integer.parseInt(this.stringValue); + } + + @JsonIgnore + @Override + public boolean getBooleanValue() { +// return this.booleanValue; + return Boolean.valueOf(this.stringValue); + } + + @JsonIgnore + @Override + public float getFloatValue() { +// return this.floatValue; + return Float.parseFloat(this.stringValue); + } + + @JsonIgnore + @Override + public long getLongValue() { +// return this.longValue; + return Long.parseLong(this.stringValue); + } + + @JsonIgnore + @Override + public double getDoubleValue() { +// return this.doubleValue; + return Double.parseDouble(this.stringValue); + } + + @JsonIgnore + @Override + public Object getDefaultValue() { + return null; + } + + public String getDataType() { + return dataType; + } + + public void setDataType(String dataType) { + this.dataType = dataType; + } +} diff --git a/iplatform-core/src/main/java/com/iplatform/core/TokenAwareContext.java b/iplatform-core/src/main/java/com/iplatform/core/TokenAwareContext.java new file mode 100644 index 0000000..1a3d149 --- /dev/null +++ b/iplatform-core/src/main/java/com/iplatform/core/TokenAwareContext.java @@ -0,0 +1,26 @@ +package com.iplatform.core; + +import com.walker.infrastructure.core.NamedThreadLocal; + +/** + * Token鎷︽埅璇锋眰鍚庯紝浼氭妸瑙f瀽鐨則oken涓叧閿俊鎭斁鍏ヤ笂涓嬫枃锛屼緵鍚庣画绋嬪簭浣跨敤锛岃姹傚畬鎴愬悗閿�姣佸璞°�� + * @author 鏃跺厠鑻� + * @date 2023-08-05 + */ +public abstract class TokenAwareContext { + + private static final NamedThreadLocal<TokenEntity> requestLocals = new NamedThreadLocal("walker_token_threadlocal"); + + public static final void setCurrentToken(TokenEntity token){ + requestLocals.set(token); + } + + public static final TokenEntity getCurrentToken(){ + return requestLocals.get(); + } + + public static final void clearCurrentToken(){ +// System.out.println("====== clearCurrentToken"); + requestLocals.remove(); + } +} diff --git a/iplatform-core/src/main/java/com/iplatform/core/TokenEntity.java b/iplatform-core/src/main/java/com/iplatform/core/TokenEntity.java new file mode 100644 index 0000000..0a081df --- /dev/null +++ b/iplatform-core/src/main/java/com/iplatform/core/TokenEntity.java @@ -0,0 +1,43 @@ +package com.iplatform.core; + +import java.io.Serializable; + +/** + * 绯荤粺鎷︽埅璇锋眰鍚庯紝鑾峰彇token涓湁鐢ㄤ俊鎭紝瀛樺叆绾跨▼涓婁笅鏂囷紝璁╃▼搴忓彲浠ヨ幏鍙栥�� + * @date 2023-08-05 + * @author 鏃跺厠鑻� + */ +public class TokenEntity implements Serializable { + + public TokenEntity(String uuid, String loginId){ + this.uuid = uuid; + this.loginId = loginId; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getLoginId() { + return loginId; + } + + public void setLoginId(String loginId) { + this.loginId = loginId; + } + + private String uuid; + private String loginId; + + @Override + public String toString() { + return "TokenEntity{" + + "uuid='" + uuid + '\'' + + ", loginId='" + loginId + '\'' + + '}'; + } +} diff --git a/iplatform-core/src/main/java/com/iplatform/core/UserMerchantType.java b/iplatform-core/src/main/java/com/iplatform/core/UserMerchantType.java new file mode 100644 index 0000000..db84110 --- /dev/null +++ b/iplatform-core/src/main/java/com/iplatform/core/UserMerchantType.java @@ -0,0 +1,78 @@ +package com.iplatform.core; + +/** + * 鍟嗘埛绠$悊鍛樼被鍨嬪畾涔夛紝瀵瑰簲锛歴_user_core type瀛楁 + * @author 鏃跺厠鑻� + * @date 2023-09-21 + */ +public enum UserMerchantType { + + /** + * 鏅�氱敤鎴� + */ + Normal{ + public int getIndex(){ + return INDEX_NORMAL; + } + }, + + /** + * 骞冲彴瓒呯 + */ + PlatformSuper{ + public int getIndex(){ + return INDEX_PLATFORM_SUPER; + } + }, + + /** + * 鍟嗘埛瓒呯 + */ + MerchantSuper{ + public int getIndex(){ + return INDEX_MERCHANT_SUPER; + } + }, + + /** + * 绯荤粺绠$悊鍛� + */ + Administrator{ + public int getIndex(){ + return INDEX_ADMINISTRATOR; + } + }, + + /** + * 鍟嗘埛绠$悊鍛� + */ + MerchantAdmin{ + public int getIndex(){ + return INDEX_MERCHANT_ADMIN; + } + }; + + public int getIndex(){ + throw new AbstractMethodError(); + } + + public UserMerchantType getType(int index){ + if(index == INDEX_NORMAL){ + return Normal; + } else if(index == INDEX_PLATFORM_SUPER){ + return PlatformSuper; + } else if(index == INDEX_ADMINISTRATOR){ + return Administrator; + } else if(index == INDEX_MERCHANT_ADMIN){ + return MerchantAdmin; + } else { + throw new UnsupportedOperationException("涓嶆敮鎸佺殑鍟嗘埛绠$悊鍛樼被鍨嬶細" + index); + } + } + + public static final int INDEX_NORMAL = 0; + public static final int INDEX_PLATFORM_SUPER = 1; + public static final int INDEX_MERCHANT_SUPER = 2; + public static final int INDEX_ADMINISTRATOR = 3; + public static final int INDEX_MERCHANT_ADMIN = 4; +} diff --git a/iplatform-core/src/main/java/com/iplatform/core/config/BasicConfig.java b/iplatform-core/src/main/java/com/iplatform/core/config/BasicConfig.java new file mode 100644 index 0000000..aeda892 --- /dev/null +++ b/iplatform-core/src/main/java/com/iplatform/core/config/BasicConfig.java @@ -0,0 +1,33 @@ +package com.iplatform.core.config; + +import com.iplatform.core.BeanContextAware; +import com.iplatform.core.PlatformConfiguration; +import com.walker.infrastructure.ServerId; +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class BasicConfig extends PlatformConfiguration { + + /** + * 骞冲彴闆嗙兢妯″紡锛岄厤缃牳蹇冨弬鏁般�傜洰鍓嶅彧鏈変富鏈烘湇鍔D銆� + * @return + * @date 2023-09-29 + */ + @Bean + public LoadBalanceProperties loadBalanceProperties(){ + return new LoadBalanceProperties(); + } + + @Bean + public BeanContextAware beanContextAware(ApplicationContext applicationContext, LoadBalanceProperties loadBalanceProperties){ + // 2023-09-29 鍚姩涔嬪墠鍏堣缃礋杞芥ā寮忥紝鐩稿叧鍙傛暟 + ServerId.setId(loadBalanceProperties.getServerId()); + + BeanContextAware beanContextAware = new BeanContextAware(); + beanContextAware.setApplicationContext(applicationContext); + logger.info("............ 浣跨敤鍖呴噷闈細iplatform-core.jar"); + return beanContextAware; + } +} diff --git a/iplatform-core/src/main/java/com/iplatform/core/config/LoadBalanceProperties.java b/iplatform-core/src/main/java/com/iplatform/core/config/LoadBalanceProperties.java new file mode 100644 index 0000000..680b806 --- /dev/null +++ b/iplatform-core/src/main/java/com/iplatform/core/config/LoadBalanceProperties.java @@ -0,0 +1,25 @@ +package com.iplatform.core.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +/** + * 鏀寔闆嗙兢閰嶇疆銆� + * @date 2023-09-29 + */ +@ConfigurationProperties(prefix = "iplatform.lb") +public class LoadBalanceProperties { + + /** + * 姣忎釜涓绘満鑺傜偣鍞竴鏁板瓧缂栧彿锛屼粠1寮�濮� + * @return + */ + public String getServerId() { + return serverId; + } + + public void setServerId(String serverId) { + this.serverId = serverId; + } + + private String serverId; +} diff --git a/iplatform-core/src/main/java/com/iplatform/core/config/PropertyPostProcessorConfig.java b/iplatform-core/src/main/java/com/iplatform/core/config/PropertyPostProcessorConfig.java new file mode 100644 index 0000000..b94cea6 --- /dev/null +++ b/iplatform-core/src/main/java/com/iplatform/core/config/PropertyPostProcessorConfig.java @@ -0,0 +1,16 @@ +package com.iplatform.core.config; + +import com.iplatform.core.config.enc.PropertySourcePostProcessor; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.env.ConfigurableEnvironment; + +@Configuration +public class PropertyPostProcessorConfig { + + @Bean + public PropertySourcePostProcessor propertySourcePostProcessor(ConfigurableEnvironment environment){ + PropertySourcePostProcessor postProcessor = new PropertySourcePostProcessor(environment); + return postProcessor; + } +} diff --git a/iplatform-core/src/main/java/com/iplatform/core/config/enc/EncryptionWrapperDetector.java b/iplatform-core/src/main/java/com/iplatform/core/config/enc/EncryptionWrapperDetector.java new file mode 100644 index 0000000..71c7b72 --- /dev/null +++ b/iplatform-core/src/main/java/com/iplatform/core/config/enc/EncryptionWrapperDetector.java @@ -0,0 +1,40 @@ +package com.iplatform.core.config.enc; + +public class EncryptionWrapperDetector { + + private final String prefix; + + private final String suffix; + + public EncryptionWrapperDetector(String prefix, String suffix) { + this.prefix = prefix; + this.suffix = suffix; + } + + /** + * 妫�娴嬮厤缃弬鏁板�硷紝鏄惁甯︽湁鍔犲瘑鍓嶇紑锛屽鏋滄槸杩斿洖锛歵rue + * @param property + * @return + */ + public boolean detected(String property) { + return property != null && property.startsWith(prefix) && property.endsWith(suffix); + } + + /** + * 鎶婂睘鎬у�煎寘瑁呬笂鍔犲瘑鍑芥暟 + * @param property + * @return + */ + public String wrapper(String property) { + return prefix + property + suffix; + } + + /** + * 鍘绘帀鍔犲瘑鍑芥暟锛岃繑鍥炲瘑鏂囧唴瀹广�� + * @param property + * @return + */ + public String unWrapper(String property) { + return property.substring(prefix.length(), property.length() - suffix.length()); + } +} diff --git a/iplatform-core/src/main/java/com/iplatform/core/config/enc/PropertySourcePostProcessor.java b/iplatform-core/src/main/java/com/iplatform/core/config/enc/PropertySourcePostProcessor.java new file mode 100644 index 0000000..cf7456d --- /dev/null +++ b/iplatform-core/src/main/java/com/iplatform/core/config/enc/PropertySourcePostProcessor.java @@ -0,0 +1,89 @@ +package com.iplatform.core.config.enc; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.config.BeanFactoryPostProcessor; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; +import org.springframework.boot.env.OriginTrackedMapPropertySource; +import org.springframework.core.Ordered; +import org.springframework.core.env.ConfigurableEnvironment; +import org.springframework.core.env.MutablePropertySources; +import org.springframework.core.env.PropertySource; + +/** + * 娴嬭瘯锛屽疄鐜伴厤缃枃浠惰嚜鍔ㄥ姞瑙e瘑銆� + * <pre> + * 1锛夋湰鏉ュ噯澶囦娇鐢細jasypt-spring-boot-starter锛屼絾鐢变簬鍏朵緷璧栫殑springboot鐗堟湰鏄�2.7锛屾墍浠ユ棤娉曚娇鐢紱 + * 2锛夎�冭檻鍒板悗缁璼pringBoot鐨勯绻佸崌绾ч棶棰樿杩炲甫淇敼锛屾墍浠ュ喅瀹氱郴缁熷唴閮ㄦā浠垮疄鐜颁竴涓畝鍗曢厤缃�� + * </pre> + * @author 鏃跺厠鑻� + * @date 2023-12-04 + */ +public class PropertySourcePostProcessor implements BeanFactoryPostProcessor, Ordered { + + protected final transient Logger logger = LoggerFactory.getLogger(getClass()); + + private ConfigurableEnvironment environment; + + public PropertySourcePostProcessor(ConfigurableEnvironment environment) { + this.environment = environment; + } + + @Override + public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException { + // 浠嶤onfigurableEnvironment涓彇鍑烘墍鏈夌殑閰嶇疆鏁版嵁 + MutablePropertySources propertySources = this.environment.getPropertySources(); +// propertySources.stream() +// // 杩囨护涓嶉渶瑕佸寘瑁呯殑瀵硅薄 +//// .filter(s -> !noWrapPropertySource(s)) +// .filter(s -> { +// if(s instanceof MapPropertySource){ +// return true; +// } else { +// return false; +// } +// }) +// // 鍖呰鎵�鏈夌殑PropertySource +// .map(s -> new EncryptPropertySource((MapPropertySource)s)) +// .collect(Collectors.toList()) +// // 鏇挎崲鎺塸ropertySources涓殑PropertySource +// .forEach(wrap -> propertySources.replace(wrap.getName(), wrap)); +// +// propertySources.stream().forEach(propertySource -> { +// logger.debug("......", propertySource); +// logger.debug("{} -> {}", propertySource.getName(), propertySource.getSource()); +// if(propertySource instanceof MapPropertySource){ +// logger.debug("鍙戠幇涓�涓細MapPropertySource {}", propertySource.getClass().getName()); +// } +// this.decryptPropertyValue(propertySource); +// }); + for (PropertySource<?> propertySource : propertySources) { + if (propertySource instanceof OriginTrackedMapPropertySource) { + propertySources.replace(propertySource.getName(), new PropertySourceWrapper(propertySource + , new EncryptionWrapperDetector("ENC(", ")")) + ); + } + } + } + +// private void decryptPropertyValue(PropertySource<?> propertySource){ +// Object source = propertySource.getSource(); +// logger.debug("propertySource.getSource = {}", source.getClass().getName()); +// if(source instanceof Map<?,?>){ +// Map<String, Object> properties = (Map<String, Object>)source; +// logger.debug("map: 鍏辨湁 {} 涓睘鎬�", properties.size()); +// for(Map.Entry<String, Object> entry : properties.entrySet()){ +// logger.debug("key = {}, class = {}", entry.getKey(), entry.getValue().getClass().getName()); +// } +// } +// } + + @Override + public int getOrder() { + return Ordered.LOWEST_PRECEDENCE - 100; + } +// private boolean noWrapPropertySource(PropertySource propertySource) { +// return propertySource instanceof EncryptPropertySource || StringUtils.equalsAny(propertySource.getClass().getName(), "org.springframework.core.env.PropertySource$StubPropertySource", "org.springframework.boot.context.properties.source.ConfigurationPropertySourcesPropertySource"); +// } +} \ No newline at end of file diff --git a/iplatform-core/src/main/java/com/iplatform/core/config/enc/PropertySourceWrapper.java b/iplatform-core/src/main/java/com/iplatform/core/config/enc/PropertySourceWrapper.java new file mode 100644 index 0000000..467d95c --- /dev/null +++ b/iplatform-core/src/main/java/com/iplatform/core/config/enc/PropertySourceWrapper.java @@ -0,0 +1,40 @@ +package com.iplatform.core.config.enc; + +import com.iplatform.core.util.AESUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.core.env.PropertySource; + +public class PropertySourceWrapper<T> extends PropertySource<T> { + + protected final transient Logger logger = LoggerFactory.getLogger(getClass()); + +// private final Encryptor encryptor; + + private final PropertySource<T> originalPropertySource; + private final EncryptionWrapperDetector detector; + + + public PropertySourceWrapper(PropertySource<T> originalPropertySource, EncryptionWrapperDetector detector) { + super(originalPropertySource.getName(), originalPropertySource.getSource()); + this.originalPropertySource = originalPropertySource; +// this.encryptor = encryptor; + this.detector = detector; + } + + @Override + public Object getProperty(String name) { + if (originalPropertySource.containsProperty(name)) { + Object value = originalPropertySource.getProperty(name); + if (value != null) { + String property = value.toString(); + if (detector.detected(property)) { +// return encryptor.decrypt(detector.unWrapper(property)); + logger.debug("鎵惧埌鍔犲瘑閰嶇疆锛歿}, value = {}", name, property); + return AESUtils.decryptStrAES(detector.unWrapper(property), AESUtils.KEY_16); + } + } + } + return originalPropertySource.getProperty(name); + } +} diff --git a/iplatform-core/src/main/java/com/iplatform/core/util/AESUtils.java b/iplatform-core/src/main/java/com/iplatform/core/util/AESUtils.java new file mode 100644 index 0000000..f04a4c7 --- /dev/null +++ b/iplatform-core/src/main/java/com/iplatform/core/util/AESUtils.java @@ -0,0 +1,197 @@ +package com.iplatform.core.util; + +import com.walker.infrastructure.utils.Base64; +import com.walker.infrastructure.utils.StringUtils; + +import javax.crypto.BadPaddingException; +import javax.crypto.Cipher; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.NoSuchPaddingException; +import javax.crypto.SecretKey; +import javax.crypto.spec.IvParameterSpec; +import javax.crypto.spec.SecretKeySpec; +import java.io.UnsupportedEncodingException; +import java.nio.charset.StandardCharsets; +import java.security.AlgorithmParameters; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.Key; +import java.security.NoSuchAlgorithmException; +import java.security.NoSuchProviderException; +import java.security.Security; + +/** + * AES瀵圭О鍔犲瘑銆佽В瀵嗗伐鍏枫�� + * @author 鏃跺厠鑻� + * @date 2023-06-15 + */ +public class AESUtils { + + private static final String AES_ALGORITHM = "AES"; + + private static final String UTF8 = StandardCharsets.UTF_8.name(); + + // 寰俊瑙e瘑鎵嬫満鍙蜂娇鐢紝2023-09-15 +// static { +// Security.addProvider(new BouncyCastleProvider()); +// } + + public static String encryptStrAES(String text){ + return encryptStrAES(text, KEY_16); + } + + + /* AES鍔犲瘑 String */ + public static String encryptStrAES(String text, String key){ + if(!StringUtils.hasLength(text)){ + throw new IllegalStateException("encode text should not be null or empty."); + } + byte[] encodeBytes = encryptByteAES(text.getBytes(StandardCharsets.UTF_8), key); +// return Base64.encodeBase64String(encodeBytes); + return new String(Base64.encodeBase64(encodeBytes)); + } + + /* AES瑙e瘑 String*/ + public static String decryptStrAES(String text, String key){ + if(!StringUtils.hasLength(text)){ + throw new IllegalStateException("decode text should not be null or empty."); + } + byte[] decoded = Base64.decode(text.getBytes(StandardCharsets.UTF_8)); +// byte[] decodeBytes = decryptByteAES(Base64.decodeBase64(text.getBytes(StandardCharsets.UTF_8)), key); + byte[] decodeBytes = decryptByteAES(decoded, key); + return new String(decodeBytes, StandardCharsets.UTF_8); + } + + /* AES鍔犲瘑 originalBytes */ + public static byte[] encryptByteAES(byte[] originalBytes, String key){ + if(originalBytes == null || originalBytes.length == 0){ + throw new IllegalStateException("encode originalBytes should not be empty."); + } + if(!StringUtils.hasLength(key)){ + throw new IllegalStateException("key :" + key + ", encode key should not be null or empty."); + } + Cipher cipher = getAESCipher(key, Cipher.ENCRYPT_MODE); + byte[] encodeBytes = null; + try { + encodeBytes = cipher.doFinal(originalBytes); + } catch (IllegalBlockSizeException | BadPaddingException e) { + throw new IllegalStateException(e.getClass().getName()+": encode byte fail. "+e.getMessage()); + } + return encodeBytes; + } + + /* AES瑙e瘑 encryptedBytes */ + public static byte[] decryptByteAES(byte[] encryptedBytes, String key){ + if(encryptedBytes == null || encryptedBytes.length == 0){ + throw new IllegalStateException("decode encryptedBytes should not be empty."); + } + if(!StringUtils.hasLength(key)){ + throw new IllegalStateException("key :" + key + ", decode key should not be null or empty."); + } + Cipher cipher = getAESCipher(key, Cipher.DECRYPT_MODE); + byte[] decodeBytes = null; + try { + decodeBytes = cipher.doFinal(encryptedBytes); + } catch (IllegalBlockSizeException | BadPaddingException e) { + throw new IllegalStateException(e.getClass().getName()+": decode byte fail. "+e.getMessage()); + } + return decodeBytes; + } + + public static Cipher getAESCipher(String key, int mode){ + if(!StringUtils.hasLength(key)){ + throw new IllegalStateException("key :" + key + ", should not be null or empty."); + } + Cipher cipher = null; + SecretKey secretKey; + try { + cipher = Cipher.getInstance(AES_ALGORITHM); + byte[] keyBytes = key.getBytes(UTF8); + secretKey = new SecretKeySpec(keyBytes, AES_ALGORITHM); + cipher.init(mode, secretKey); + } catch (NoSuchAlgorithmException | NoSuchPaddingException e) { + throw new IllegalStateException(e.getClass().getName()+": get cipher instance wrong. "+e.getMessage()); + } catch (UnsupportedEncodingException u){ + throw new IllegalStateException(u.getClass().getName()+": key transfer bytes fail. "+u.getMessage()); + } catch (InvalidKeyException i) { + throw new IllegalStateException(i.getClass().getName()+": key is invalid. "+i.getMessage()); + } + return cipher; + } + + /** + * AES瑙e瘑锛岀洰鍓嶅井淇¤В瀵嗘巿鏉冩墜鏈哄彿浣跨敤銆� + * + * @param content + * 瀵嗘枃 + * @return + * @throws InvalidAlgorithmParameterException + * @throws NoSuchProviderException + * @date 2023-09-15 + */ + public static final byte[] decrypt(byte[] content, byte[] keyByte, byte[] ivByte) throws InvalidAlgorithmParameterException { + // initialize(); + // 濡傛灉瀵嗛挜涓嶈冻16浣嶏紝閭d箞灏辫ˉ瓒�. 杩欎釜if 涓殑鍐呭寰堥噸瑕� +// int base = 16; +// if (ivByte.length % base != 0) { +// int groups = ivByte.length / base + (ivByte.length % base != 0 ? 1 : 0); +// byte[] temp = new byte[groups * base]; +// Arrays.fill(temp, (byte) 0); +// System.arraycopy(ivByte, 0, temp, 0, ivByte.length); +// ivByte = temp; +// } + try { + Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding"); + Key sKeySpec = new SecretKeySpec(keyByte, AES_ALGORITHM); + cipher.init(Cipher.DECRYPT_MODE, sKeySpec, generateIV(ivByte));// 鍒濆鍖� + byte[] result = cipher.doFinal(content); + return result; + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } catch (NoSuchPaddingException e) { + e.printStackTrace(); + } catch (InvalidKeyException e) { + e.printStackTrace(); + } catch (IllegalBlockSizeException e) { + e.printStackTrace(); + } catch (BadPaddingException e) { + e.printStackTrace(); + } catch (NoSuchProviderException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + return null; + } + + // 鐢熸垚iv + public static AlgorithmParameters generateIV(byte[] iv) throws Exception { + AlgorithmParameters params = AlgorithmParameters.getInstance(AES_ALGORITHM); + params.init(new IvParameterSpec(iv)); + return params; + } + + public static void initialize() { + if (initialized) { + return; + } + // Security.addProvider(new BouncyCastleProvider()); + initialized = true; + } + + public static boolean initialized = false; + + public static final String KEY_16 = "954327510putvwmz"; +// public static final String KEY_8 = "95432puz"; + + public static void main(String[] args) { +// String msg = "鍟嗘埛鍙�=adf0099ogglk11wweedcvfg"; +// System.out.println("AES绉橀挜闀垮害鍙兘涓�16銆�24銆�32:"+KEY_16.getBytes(StandardCharsets.UTF_8).length); + // String s = encryptStrAES("U7iG6Huvn0ZrR8b9f74", KEY_16); + // System.out.println("鍔犲瘑鍚�:"+s); +// String s1 = decryptStrAES(s, KEY_16); +// System.out.println("瑙e瘑鍚�:"+s1); + String encrypt = "Z/HgOaZnJvhO9EiwCu71jA=="; + System.out.println("瑙e瘑鏁版嵁锛�" + AESUtils.decryptStrAES(encrypt, KEY_16)); + } +} diff --git a/iplatform-core/src/main/java/com/iplatform/core/util/ThreadUtils.java b/iplatform-core/src/main/java/com/iplatform/core/util/ThreadUtils.java new file mode 100644 index 0000000..908b4b3 --- /dev/null +++ b/iplatform-core/src/main/java/com/iplatform/core/util/ThreadUtils.java @@ -0,0 +1,98 @@ +package com.iplatform.core.util; + +import java.util.concurrent.CancellationException; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Future; +import java.util.concurrent.TimeUnit; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 绾跨▼鐩稿叧宸ュ叿绫�. + * + * @author Mike + */ +public class ThreadUtils +{ + private static final Logger logger = LoggerFactory.getLogger(ThreadUtils.class); + + /** + * sleep绛夊緟,鍗曚綅涓烘绉� + */ + public static void sleep(long milliseconds) { + try + { + Thread.sleep(milliseconds); + } + catch (InterruptedException e) + { + return; + } + } + + /** + * 鍋滄绾跨▼姹� + * 鍏堜娇鐢╯hutdown, 鍋滄鎺ユ敹鏂颁换鍔″苟灏濊瘯瀹屾垚鎵�鏈夊凡瀛樺湪浠诲姟. + * 濡傛灉瓒呮椂, 鍒欒皟鐢╯hutdownNow, 鍙栨秷鍦╳orkQueue涓璓ending鐨勪换鍔�,骞朵腑鏂墍鏈夐樆濉炲嚱鏁�. + * 濡傛灉浠嶇劧瓒呮檪锛屽墖寮峰埗閫�鍑�. + * 鍙﹀鍦╯hutdown鏃剁嚎绋嬫湰韬璋冪敤涓柇鍋氫簡澶勭悊. + */ + public static void shutdownAndAwaitTermination(ExecutorService pool) + { + if (pool != null && !pool.isShutdown()) + { + pool.shutdown(); + try + { + if (!pool.awaitTermination(120, TimeUnit.SECONDS)) + { + pool.shutdownNow(); + if (!pool.awaitTermination(120, TimeUnit.SECONDS)) + { + logger.info("Pool did not terminate"); + } + } + } + catch (InterruptedException ie) + { + pool.shutdownNow(); + Thread.currentThread().interrupt(); + } + } + } + + /** + * 鎵撳嵃绾跨▼寮傚父淇℃伅 + */ + public static void printException(Runnable r, Throwable t) + { + if (t == null && r instanceof Future<?>) + { + try + { + Future<?> future = (Future<?>) r; + if (future.isDone()) + { + future.get(); + } + } + catch (CancellationException ce) + { + t = ce; + } + catch (ExecutionException ee) + { + t = ee.getCause(); + } + catch (InterruptedException ie) + { + Thread.currentThread().interrupt(); + } + } + if (t != null) + { + logger.error(t.getMessage(), t); + } + } +} diff --git a/iplatform-core/src/main/java/com/iplatform/core/workflow/AbstractContext.java b/iplatform-core/src/main/java/com/iplatform/core/workflow/AbstractContext.java new file mode 100644 index 0000000..3e932b1 --- /dev/null +++ b/iplatform-core/src/main/java/com/iplatform/core/workflow/AbstractContext.java @@ -0,0 +1,126 @@ +package com.iplatform.core.workflow; + +import com.iplatform.core.SimpleVariable; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * 鎶借薄鐨勬祦绋嬩笂涓嬫枃瀵硅薄銆�<p></p> + * 鐢变簬鐩墠鍙畝鍗曢泦鎴�<code>Activiti7</code>锛屽洜姝よ涓婁笅鏂囧璞′粎閽堝浠诲姟鐜妭鐨勭幆澧冩瀯閫犮�� + * @author 鏃跺厠鑻� + * @date 2023-03-28 + */ +public abstract class AbstractContext implements Context{ + + protected final transient Logger logger = LoggerFactory.getLogger(getClass()); + + @Override + public String getProcessDefinitionId() { + return this.processDefinitionId; + } + + @Override + public SimpleVariable getVariable(String key) { + return null; + } + + public void setProcessDefinitionId(String processDefinitionId) { + this.processDefinitionId = processDefinitionId; + } + + @Override + public String getProcessInstanceId() { + return processInstanceId; + } + + public void setProcessInstanceId(String processInstanceId) { + this.processInstanceId = processInstanceId; + } + + @Override + public String getTaskDefinitionId() { + return taskDefinitionId; + } + + public void setTaskDefinitionId(String taskDefinitionId) { + this.taskDefinitionId = taskDefinitionId; + } + + @Override + public String getTaskInstanceId() { + return taskInstanceId; + } + + @Override + public Actorable getActor() { + return this.actorable; + } + + @Override + public String getCreator() { + return this.creator; + } + + public void setTaskInstanceId(String taskInstanceId) { + this.taskInstanceId = taskInstanceId; + } + + public void setCreator(String creator) { + this.creator = creator; + } + +// public Actorable getActorable() { +// return actorable; +// } + + public void setActor(Actorable actorable) { + this.actorable = actorable; + } + + @Override + public String getBusinessKey() { + return businessKey; + } + + public void setBusinessKey(String businessKey) { + this.businessKey = businessKey; + } + + @Override + public String getActorValue() { + return actorValue; + } + + public void setActorValue(String actorValue) { + this.actorValue = actorValue; + } + + @Override + public String getProcessDefinitionKey() { + return processDefinitionKey; + } + + public void setProcessDefinitionKey(String processDefinitionKey) { + this.processDefinitionKey = processDefinitionKey; + } + + @Override + public WorkflowForm getWorkflowForm() { + return workflowForm; + } + + public void setWorkflowForm(WorkflowForm workflowForm) { + this.workflowForm = workflowForm; + } + + private WorkflowForm workflowForm; + private String processDefinitionKey; + private String actorValue; + private String businessKey; + private Actorable actorable; + private String creator; + private String processDefinitionId; + private String processInstanceId; + private String taskDefinitionId; + private String taskInstanceId; +} diff --git a/iplatform-core/src/main/java/com/iplatform/core/workflow/Actorable.java b/iplatform-core/src/main/java/com/iplatform/core/workflow/Actorable.java new file mode 100644 index 0000000..d92ef64 --- /dev/null +++ b/iplatform-core/src/main/java/com/iplatform/core/workflow/Actorable.java @@ -0,0 +1,66 @@ +package com.iplatform.core.workflow; + +import com.walker.infrastructure.utils.KeyValue; + +import java.util.List; + +/** + * 娴佺▼鍙備笌鑰呭畾涔夈�� + * @author 鏃跺厠鑻� + * @date 2023-03-27 + */ +public interface Actorable { + + /** + * 鍙備笌鑰呮爣璇嗭紝濡傦細actor.creator + * @return + */ + String getId(); + + /** + * 鍙備笌鑰呭睍绀哄悕瀛楋紝濡傦細鍒涘缓浜� + * @return + */ + String getName(); + + /** + * 鏄惁杩斿洖澶氫釜鍙備笌浜恒�� + * @return + */ + boolean isMultipleActor(); + + /** + * 鏄惁鍊欓�夌敤鎴凤紝濡傛灉鏄垯琛ㄦ槑璇ュ弬涓庤��'鍏佽鎸囧畾澶氫釜浜猴紝鍏朵腑1浜哄畬鎴愬氨OK' + * @return + * @date 2023-03-28 + */ + boolean isCandidate(); + + /** + * 杩斿洖褰撲釜鍙備笌鑰匢D銆傚綋锛歿@linkplain Actorable#isMultipleActor()} 杩斿洖'false'鏃惰皟鐢ㄣ�� + * <pre> + * 1.杩斿洖鐨勮鑹瞚d锛屾牴鎹笟鍔″叏灞�璁捐鏉ョ殑銆� + * 2.濡傛灉杩斿洖'鐧诲綍id'灏卞叏閮ㄨ繑鍥烇紝濡傛灉杩斿洖'userId'涔熺粺涓�閮戒娇鐢紝涓ょ涓嶈兘娣风敤銆� + * </pre> + * @param context 娴佺▼涓婁笅鏂囧璞� + * @return 杩斿洖鍗曚釜浜哄憳锛宬ey = id, value = name + */ + KeyValue<String, String> getActor(Context context); + + /** + * 杩斿洖澶氫釜鍙備笌鑰呴泦鍚堛�傚綋锛歿@linkplain Actorable#isMultipleActor()} 杩斿洖'true'鏃惰皟鐢ㄣ�� + * @param context + * @return + */ + List<KeyValue<String, String>> getActorList(Context context); + + /** + * 鏄惁鏀寔鍓嶇閫夋嫨涓嬩竴姝ユ寚瀹氫汉鍛樸��<p></p> + * <pre> + * 1.濡傛灉鏀寔閫夋嫨锛屽垯蹇呴』瀹炵幇鏂规硶锛歡etActorList() + * </pre> + * @return + * @date 2023-04-11 + */ + boolean supportSelectAssignee(); +} diff --git a/iplatform-core/src/main/java/com/iplatform/core/workflow/Constants.java b/iplatform-core/src/main/java/com/iplatform/core/workflow/Constants.java new file mode 100644 index 0000000..fc72812 --- /dev/null +++ b/iplatform-core/src/main/java/com/iplatform/core/workflow/Constants.java @@ -0,0 +1,92 @@ +package com.iplatform.core.workflow; + +/** + * 娴佺▼甯搁噺瀹氫箟銆� + * @author 鏃跺厠鑻� + * @date 2023-03-28 + */ +public class Constants { + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + //~ 涓�浜涘父瑙佸弬涓庤�呯被鍨嬶細甯搁噺瀹氫箟銆� + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + /** + * 鍒涘缓浜� + */ + public static final String ACTOR_TYPE_CREATOR = "actor.creator"; + /** + * 閮ㄩ棬棰嗗锛堝崟浜猴級 + */ + public static final String ACTOR_TYPE_DEPT_MANAGER = "actor.deptManager"; + /** + * 鍥哄畾鎸囨淳浜哄憳锛堝崟浜猴級 + */ + public static final String ACTOR_TYPE_FIX = "actor.fix"; + /** + * 鎸囧畾鐨勫伐浣滅粍 + */ + public static final String ACTOR_TYPE_GROUP = "actor.group"; + /** + * 鎸囧畾鐨勮鑹� + */ + public static final String ACTOR_TYPE_ROLE = "actor.role"; + /** + * 鎸囧畾鐨勫矖浣� + */ + public static final String ACTOR_TYPE_POST = "actor.post"; + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + //~ 娴佺▼瀹氫箟鐣岄潰涓�浜涚壒瀹氬彉閲忓悕绉板畾涔夛細甯搁噺瀹氫箟銆� + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + /** + * 搴熷純锛岀洰鍓嶇洿鎺ユ妸鍙傛暟缁戝畾鍒扮洃鍚櫒涓婁簡銆� + */ + @Deprecated + public static final String NAME_ACTOR_TYPE = "actorType"; + /** + * 搴熷純锛岀洰鍓嶇洿鎺ユ妸鍙傛暟缁戝畾鍒扮洃鍚櫒涓婁簡銆� + */ + @Deprecated + public static final String NAME_ACTOR_VALUE = "actorValue"; + @Deprecated + public static final String NAME_CURRENT_USER = "currentUser"; + + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + //~ 涓�浜涚壒瀹氱殑甯搁噺锛氬父閲忓畾涔夈�� + //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + + /** + * 娴佺▼浠诲姟瀹氫箟鐨勭涓�姝ユ爣璇嗭紝蹇呴』浣跨敤锛歴tart + * @date 2023-03-28 + */ + public static final String NAME_TASK_START = "start"; + + /** + * SQL鏌ヨ娴佺▼鍒涘缓浜猴紝鏁版嵁搴撹繑鍥炵殑瀛楁鍚嶅瓧銆� + * @date 2023-03-28 + */ + public static final String NAME_ASSIGNEE_CREATOR = "creator"; + + /** + * 鍊欓�変汉鐣岄潰缁戝畾鍙橀噺鍚嶅瓧銆� + * @date 2023-03-28 + */ + public static final String NAME_ASSIGNEE_CANDIDATE = "candidate"; + + /** + * 浼氱浜洪泦鍚堢晫闈㈢粦瀹氬彉閲忓悕銆� + * @date 2023-03-28 + */ + public static final String NAME_ASSIGNEE_COUNTER_SIGN_LIST = "counterSignList"; + + /** + * 娴佽浆鏉′欢缁撴灉鐨勫悕瀛楋紝鐢ㄤ簬娴佺▼鍒嗘敮鏉′欢鍙橀噺鐨勫悕瀛楀畾涔夈�� + * @date 2023-03-28 + */ + public static final String NAME_CONDITION_RESULT = "result"; + + public static final String NAME_YES = "yes"; + public static final String NAME_NO = "no"; +} diff --git a/iplatform-core/src/main/java/com/iplatform/core/workflow/Context.java b/iplatform-core/src/main/java/com/iplatform/core/workflow/Context.java new file mode 100644 index 0000000..c5cd7a5 --- /dev/null +++ b/iplatform-core/src/main/java/com/iplatform/core/workflow/Context.java @@ -0,0 +1,96 @@ +package com.iplatform.core.workflow; + +import com.iplatform.core.SimpleVariable; + +/** + * 娴佺▼涓婁笅鏂囧璞″畾涔夈�� + * <pre> + * 1.璇ュ璞″寘鍚祦绋嬪畾涔変俊鎭�� + * 2.褰撳墠浠诲姟鐜妭鎻忚堪 + * 3.鎻愪緵瀹氫箟鐨勫彉閲忚幏鍙栦笌璁剧疆鏂规硶绛夈�� + * </pre> + * @author 鏃跺厠鑻� + * @date 2023-03-27 + */ +public interface Context { + + /** + * 杩斿洖涓氬姟琛ㄥ崟瀵硅薄锛屽浜庝换鍔′笂涓嬫枃鏆傛椂杩樻棤娉曡幏寰椼�� + * @return + * @date 2023-03-30 + */ + WorkflowForm getWorkflowForm(); + + /** + * 杩斿洖娴佺▼瀹氫箟鏍囪瘑锛屽锛歞emo_gongwen + * @return + * @date 2023-03-30 + */ + String getProcessDefinitionKey(); + + String getProcessDefinitionId(); + + /** + * 杩斿洖褰撳墠浠诲姟鐜妭鍙橀噺鍊笺�� + * @param key + * @return + */ + SimpleVariable getVariable(String key); + + String getProcessInstanceId(); + + String getTaskDefinitionId(); + + String getTaskInstanceId(); + + /** + * 杩斿洖褰撳墠浠诲姟鍙備笌鑰呭璞″畾涔夈�� + * @return + * @date 2023-03-28 + */ + Actorable getActor(); + + /** + * 杩斿洖鍙備笌鑰呮ā鍨嬪搴旂殑鍊硷紝鐩戝惉鍣ㄤ笂鍙橀噺鍚嶄负锛歛ctorValue + * @return + * @date 2023-03-30 + */ + String getActorValue(); + + /** + * 杩斿洖娴佺▼鍒涘缓浜虹櫥褰旾D锛堟垨鑰卛d锛夛紝涔熷氨鏄祦绋嬬涓�姝ュ彂璧蜂汉銆� + * @return + * @date 2023-03-28 + */ + String getCreator(); + + /** + * 杩斿洖褰撳墠娴佺▼瀵瑰簲鐨勪笟鍔D銆� + * @return + * @date 2023-03-28 + */ + String getBusinessKey(); + + /** + * 杩斿洖褰撳墠浠诲姟鎵ц浜猴紙鐧诲綍ID锛夛紝濡傛灉涓嶅瓨鍦ㄨ繑鍥� null + * @return + * @date 2023-03-28 + */ + String getAssignee(); + + /** + * 璁剧疆褰撳墠浠诲姟'鎵ц浜�'锛堢櫥褰昳d鎴杣serId锛� + * @param loginId + * @date 2023-03-28 + */ + void setAssigner(String loginId); + + /** + * 璁剧疆浠诲姟鍙橀噺鍊笺�� + * @param key + * @param value + * @date 2023-03-28 + */ + void setVariable(String key, Object value); + +} diff --git a/iplatform-core/src/main/java/com/iplatform/core/workflow/WorkflowCallback.java b/iplatform-core/src/main/java/com/iplatform/core/workflow/WorkflowCallback.java new file mode 100644 index 0000000..baf0b4a --- /dev/null +++ b/iplatform-core/src/main/java/com/iplatform/core/workflow/WorkflowCallback.java @@ -0,0 +1,30 @@ +package com.iplatform.core.workflow; + +import java.util.Map; + +/** + * 娴佺▼涓氬姟鍥炶皟鎺ュ彛瀹氫箟銆�<br> + * 璁╀笟鍔℃湁鏈轰細淇濆瓨鎴栨洿鏂版暟鎹�� + * @author 鏃跺厠鑻� + * @date 2023-03-30 + */ +public interface WorkflowCallback { + + /** + * 杩斿洖娴佺▼瀹氫箟鏍囪瘑锛屾爣璁版槸鍝釜涓氬姟娴佺▼瀹氫箟锛屽锛歞emo_qingjia銆� + * <pre> + * 1.璇ュ睘鎬у繀椤诲敮涓�锛屾瘡涓祦绋嬩笉鍚屻�� + * </pre> + * @return + */ + String getProcessDefinitionKey(); + + /** + * 褰撲换鍔℃墽琛屾彁浜わ紙涓嬩竴姝ワ級鏃讹紝鍥炶皟涓氬姟鏂规硶锛屽疄鐜拌〃鍗曠瓑涓氬姟澶勭悊銆� + * @param taskKey 浠诲姟鏍囪瘑锛屽锛歞emo_qicao + * @param context 娴佺▼涓婁笅鏂囧璞� + * @return 杩斿洖涓嬩竴姝ヨ浣跨敤鐨勫弬鏁板彉閲忥紝濡傛灉娌℃湁鍒欎负<code>null</code> + */ + Map<String, Object> onTransitionNext(String taskKey, Context context); + +} diff --git a/iplatform-core/src/main/java/com/iplatform/core/workflow/WorkflowForm.java b/iplatform-core/src/main/java/com/iplatform/core/workflow/WorkflowForm.java new file mode 100644 index 0000000..b4d3369 --- /dev/null +++ b/iplatform-core/src/main/java/com/iplatform/core/workflow/WorkflowForm.java @@ -0,0 +1,157 @@ +package com.iplatform.core.workflow; + +import com.walker.infrastructure.utils.KeyValue; + +import java.util.List; + +/** + * 娴佺▼琛ㄥ崟鍩虹瀵硅薄锛屼笟鍔¤〃鍗曞璞¢渶瑕佺户鎵胯绫汇�� + * @author 鏃跺厠鑻� + * @date 2023-03-30 + */ +public class WorkflowForm { + + /** + * 杩斿洖褰撳墠浠诲姟鎵ц浜猴紝鐧诲綍id鎴栬�呯敤鎴穒d锛屽彧瑕佺粺涓�灏辫銆� + * @return + */ + public String getAssignee() { + return assignee; + } + + public void setAssignee(String assignee) { + this.assignee = assignee; + } + + /** + * 杩斿洖浠诲姟瀹炰緥ID + * @return + */ + public String getTaskInstanceId() { + return taskInstanceId; + } + + public void setTaskInstanceId(String taskInstanceId) { + this.taskInstanceId = taskInstanceId; + } + + /** + * 杩斿洖瀹℃壒鏍囧織锛屽悓鎰�/涓嶅悓鎰忋�� + * <pre> + * 1.瀛楃涓诧細yes | no + * 2.鍙傝�冨父閲忥細{@linkplain Constants#NAME_YES} | {@linkplain Constants#NAME_NO} + * </pre> + * @return + */ + public String getApproveResult() { + return approveResult; + } + + public void setApproveResult(String approveResult) { + this.approveResult = approveResult; + } + + /** + * 杩斿洖瀹℃壒鎰忚 + * @return + */ + public String getApproveSummary() { + return approveSummary; + } + + public void setApproveSummary(String approveSummary) { + this.approveSummary = approveSummary; + } + + /** + * 杩斿洖瀹℃壒鏃堕棿锛屽瓧绗︿覆绫诲瀷锛屾牸寮忥細yyyy-MM-dd hh:mm:ss + * @return + */ + public String getApproveTime() { + return approveTime; + } + + public void setApproveTime(String approveTime) { + this.approveTime = approveTime; + } + + /** + * 杩斿洖涓氬姟ID + * @return + */ + public String getBusinessKey() { + return businessKey; + } + + public void setBusinessKey(String businessKey) { + this.businessKey = businessKey; + } + + /** + * 杩斿洖娴佺▼瀹氫箟鏍囪瘑锛屽锛歞emo_gongwen + * @return + */ + public String getProcessDefinitionKey() { + return processDefinitionKey; + } + + public void setProcessDefinitionKey(String processDefinitionKey) { + this.processDefinitionKey = processDefinitionKey; + } + + /** + * 杩斿洖鎸囧畾鐨勪笅涓�姝ヤ换鍔$幆鑺傛爣璇嗐�� + * @return + * @date 2023-04-11 + */ + public String getAssignNextTask() { + return assignNextTask; + } + + public void setAssignNextTask(String assignNextTask) { + this.assignNextTask = assignNextTask; + } + + /** + * 杩斿洖鎸囧畾鐨勪笅涓�姝ュ弬涓庤�呬汉鍛橈紙鐧诲綍ID锛� + * @return + * @date 2023-04-11 + */ + public String getAssignNextActor() { + return assignNextActor; + } + + public void setAssignNextActor(String assignNextActor) { + this.assignNextActor = assignNextActor; + } + + /** + * 杩斿洖鍚庣画鎵�鏈変换鍔$幆鑺傚弬涓庝汉涓庝换鍔¤妭鐐归泦鍚堛��<p></p> + * key = 浠诲姟瀹氫箟鏍囪瘑锛寁alue = 鍙備笌浜虹紪鍙�<br>锛屽彧鏈夌涓�姝ユ墠鑳芥彁浜よ鍙傛暟銆� + * @return + * @date 2023-04-12 + */ + public List<KeyValue<String, String>> getNextAllTaskActorList() { + return nextAllTaskActorList; + } + + /** + * 璁剧疆鍚庣画鎵�鏈変换鍔$幆鑺傚弬涓庝汉涓庝换鍔¤妭鐐归泦鍚堬紝鍙湁绗竴姝ユ墠鑳芥彁浜よ鍙傛暟銆� + * @param nextAllTaskActorList + * @date 2023-04-12 + */ + public void setNextAllTaskActorList(List<KeyValue<String, String>> nextAllTaskActorList) { + this.nextAllTaskActorList = nextAllTaskActorList; + } + + private List<KeyValue<String, String>> nextAllTaskActorList = null; + private String assignNextTask; + private String assignNextActor; + private String processDefinitionKey; + private String assignee; + private String taskInstanceId; + private String approveResult; + private String approveSummary; + private String approveTime; + private String businessKey; +} diff --git a/iplatform-file-server/pom.xml b/iplatform-file-server/pom.xml new file mode 100644 index 0000000..3aee330 --- /dev/null +++ b/iplatform-file-server/pom.xml @@ -0,0 +1,40 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>low-consum-manage</artifactId> + <groupId>com.consum</groupId> + <version>1.0.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <!-- + 2023-02-11 + iplatform-file-server 鏄枃浠剁郴缁熺鐞嗘ā鍧楋紝瀹冩敮鎸佷袱绉嶉泦鎴愬舰寮忥細 + 1锛夊钩鍙扮殑缁勪欢锛岄�氳繃jar闆嗘垚涓哄钩鍙颁竴涓姛鑳芥ā鍧� + 2锛夌嫭绔嬮儴缃叉柟寮忥紝鎻愪緵鏂囦欢鎿嶄綔寰湇鍔★紝瀹炵幇闆嗙兢搴旂敤銆� + --> + <groupId>com.iplatform</groupId> + <artifactId>iplatform-file-server</artifactId> + <name>iplatform-file-server</name> + <packaging>jar</packaging> + <version>3.2.0</version> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <scope>test</scope> + </dependency> + <dependency> + <groupId>com.iplatform</groupId> + <artifactId>iplatform-base</artifactId> + <scope>provided</scope> + </dependency> + </dependencies> +</project> diff --git a/iplatform-file-server/src/main/java/com/iplatform/App.java b/iplatform-file-server/src/main/java/com/iplatform/App.java new file mode 100644 index 0000000..6b0d7ee --- /dev/null +++ b/iplatform-file-server/src/main/java/com/iplatform/App.java @@ -0,0 +1,13 @@ +package com.iplatform; + +/** + * Hello world! + * + */ +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + } +} diff --git a/iplatform-file-server/src/main/java/com/iplatform/file/DefaultFileOperateSpi.java b/iplatform-file-server/src/main/java/com/iplatform/file/DefaultFileOperateSpi.java new file mode 100644 index 0000000..de77d00 --- /dev/null +++ b/iplatform-file-server/src/main/java/com/iplatform/file/DefaultFileOperateSpi.java @@ -0,0 +1,231 @@ +package com.iplatform.file; + +import com.iplatform.base.ArgumentsConstants; +import com.iplatform.base.Constants; +import com.iplatform.base.FileOperateSpi; +import com.iplatform.base.config.FileProperties; +import com.iplatform.core.BeanContextAware; +import com.iplatform.file.util.FileStoreUtils; +import com.walker.file.FileInfo; +import com.walker.file.FileStoreType; +import com.walker.infrastructure.arguments.ArgumentsManager; +import com.walker.infrastructure.arguments.ElementNotFoundException; +import com.walker.infrastructure.arguments.Variable; +import com.walker.infrastructure.utils.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.InputStream; +import java.util.List; + +/** + * 榛樿鐨勬枃浠舵搷浣滄湇鍔℃彁渚涜�呭疄鐜般�� + * @author 鏃跺厠鑻� + * @date 2023-02-15 + */ +public class DefaultFileOperateSpi implements FileOperateSpi { + + protected final transient Logger logger = LoggerFactory.getLogger(getClass()); + + private static final int FILE_CONTEXT_LENGTH = Constants.FILE_CONTEXT_PATH.length(); + + @Override + public byte[] downloadOssFile(String id){ + return this.acquireFileEngineFactory().downloadOssFile(this.getOssFileStoreType(), id); + } + + /** + * 娓呴櫎缁欏畾鏂囦欢鍦板潃鐨凜DN鍓嶇紑銆傚锛歨ttps://qnyun.com/oss/12345678 + * <pre> + * 鍘绘帀鍓嶇紑鍚庯紝鍙墿涓�"12345678" + * </pre> + * @param path 缁欏畾鐨勬枃浠惰祫婧愬湴鍧� + * @return + * @date 2023-05-17 + */ + @Override + public String clearCdnPrefix(String path){ + if(StringUtils.isEmpty(path)){ + return path; + } + + // 濡傛灉URL璺緞涓寘鍚湰鍦拌瘑鍒儴鍒嗭紙/file/锛夊垯鐩存帴鏇挎崲锛�2023-06-10 + int fileIndex = path.indexOf(Constants.FILE_CONTEXT_PATH); + if(fileIndex > 0){ + return path.substring(fileIndex + FILE_CONTEXT_LENGTH, path.length()); + } + + // 濡傛灉鏄叾浠栬繙绋嬪瓨鍌ㄦ柟寮忥紝鍒欐牴鎹瓨鍌ㄧ被鍨嬪垎鍒幏鍙栭厤缃墠缂� + String prefix = this.getCdnUrl() + StringUtils.FOLDER_SEPARATOR; + if(!prefix.endsWith(StringUtils.FOLDER_SEPARATOR)){ + prefix += StringUtils.FOLDER_SEPARATOR; + } + if(path.contains(prefix)){ + if (path.contains("callback/alipay")) { + return path; + } + return path.replace(prefix, StringUtils.EMPTY_STRING); + } + return path; + } + + /** + * 鑾峰彇涓婁紶鏂囦欢鐨凜DN鍦板潃锛屾牴鎹娇鐢ㄧ殑涓嶅悓绗笁鏂规湇鍔′粠閰嶇疆涓煡鎵俱�� + * @return + * @date 2023-05-17 + */ + @Override + public String getCdnUrl(){ + Variable uploadTypeVar = this.acquireArgumentsManager().getVariable(ArgumentsConstants.CONFIG_UPLOAD_TYPE); + if(uploadTypeVar == null){ + throw new ElementNotFoundException("鍙傛暟鏈壘鍒帮細" + ArgumentsConstants.CONFIG_UPLOAD_TYPE); + } + + String uploadUrl = null; + String uploadType = uploadTypeVar.getStringValue(); +// if(uploadType.equals("1") || uploadType.equals(FileStoreType.INDEX_FS)){ +// uploadUrl = ArgumentsConstants.CONFIG_LOCAL_UPLOAD_URL; +// } else if(uploadType.equals("2") || uploadType.equals(FileStoreType.INDEX_OSS_QI_NIU)){ +// uploadUrl = ArgumentsConstants.CONFIG_QN_UPLOAD_URL; +// } else if(uploadType.equals("3") || uploadType.equals(FileStoreType.INDEX_OSS_ALI)){ +// uploadUrl = ArgumentsConstants.CONFIG_AL_UPLOAD_URL; +// } else if(uploadType.equals("4") || uploadType.equals(FileStoreType.INDEX_OSS_TX)){ +// uploadUrl = ArgumentsConstants.CONFIG_TX_UPLOAD_URL; +// } else { +// throw new UnsupportedOperationException("涓嶆敮鎸佺殑涓婁紶绫诲瀷锛�" + uploadType); +// } + uploadUrl = FileStoreUtils.getFileUrlPrefixKey(uploadType); + return this.acquireArgumentsManager().getVariable(uploadUrl).getStringValue(); + } + + /** + * 涓婁紶鏂囦欢浣犲埌鏈湴纾佺洏銆� + * @param inputStream + * @param fileName + * @param groupId + * @param fileSize + * @param businessType + * @param owner + * @return + * @throws Exception + * @date 2023-06-09 + */ + @Override + public FileInfo uploadFileToLocal(InputStream inputStream + , String fileName, String groupId, long fileSize, Integer businessType, String owner) throws Exception{ + return this.acquireFileEngineFactory().uploadFileToLocal(inputStream, fileName, groupId, fileSize, businessType, owner); + } + + @Override + public FileInfo[] uploadFileToLocal(InputStream[] inputStream, String[] fileName, String groupId, long[] fileSize, Integer businessType, String owner) throws Exception { + return this.acquireFileEngineFactory().uploadFileToLocal(inputStream, fileName, groupId, fileSize, businessType, owner); + } + + @Override + public FileInfo uploadFileToFtp(InputStream inputStream + , String fileName, String groupId, long fileSize, Integer businessType, String owner) throws Exception{ + return this.acquireFileEngineFactory().uploadFileToFtp(inputStream, fileName, groupId, fileSize, businessType, owner); + } + + @Override + public FileInfo[] uploadFileToFtp(InputStream[] inputStream, String[] fileName, String groupId, long[] fileSize, Integer businessType, String owner) throws Exception { + return this.acquireFileEngineFactory().uploadFileToFtp(inputStream, fileName, groupId, fileSize, businessType, owner); + } + + @Override + public FileInfo uploadFileToOss(InputStream inputStream + , String fileName, String groupId, long fileSize, Integer businessType, String owner, FileStoreType ossType) throws Exception{ + return this.acquireFileEngineFactory().uploadFileToOss(inputStream, fileName, groupId, fileSize, businessType, owner, ossType); + } + + @Override + public FileInfo[] uploadFileToOss(InputStream[] inputStream, String[] fileName, String groupId, long[] fileSize, Integer businessType, String owner, FileStoreType ossType) throws Exception { + return this.acquireFileEngineFactory().uploadFileToOss(inputStream, fileName, groupId, fileSize, businessType, owner, ossType); + } + + @Deprecated + @Override + public FileInfo uploadFileToSystem(InputStream inputStream, String fileName, String groupId, long fileSize) throws Exception { + return this.acquireFileEngineFactory().uploadFileToSystem(inputStream, fileName, groupId, fileSize); + } + + @Deprecated + @Override + public FileInfo uploadFileToFtp(InputStream inputStream, String fileName, String groupId, long fileSize) throws Exception { + return this.acquireFileEngineFactory().uploadFileToFtp(inputStream, fileName, groupId, fileSize); + } + + @Override + public FileInfo getFileInfo(long id) { + return this.acquireFileEngineFactory().getFileInfo(String.valueOf(id)); + } + + @Override + public List<FileInfo> getFileInfoList(List<String> ids) { + return this.acquireFileEngineFactory().getFileInfoList(ids); + } + + @Override + public String getFileRootConfig() { + if(this.localFileRoot == null){ + this.localFileRoot = this.getFileProperties().getFileRoot(); + } + return this.localFileRoot; + } + + @Override + public boolean isRemoteAsLocal() { + if(this.remoteAsLocal == null){ + this.remoteAsLocal = this.getFileProperties().isRemoteAsLocal(); + } + return this.remoteAsLocal; + } + + @Override + public FileStoreType getOssFileStoreType(){ + if(this.ossFileStoreType == null){ + this.ossFileStoreType = FileStoreType.getType(this.getFileProperties().getOssType()); + } + return this.ossFileStoreType; + } + + @Override + public String getOssPrefix(){ + if(this.ossPrefix == null){ + this.ossPrefix = this.getFileProperties().getOssPrefix(); + } + return this.ossPrefix; + } + + private FileProperties getFileProperties(){ + return BeanContextAware.getBeanByType(FileProperties.class); + } + + private FileEngineFactory acquireFileEngineFactory(){ + return BeanContextAware.getBeanByType(FileEngineFactory.class); + } + + /** + * 寮曞叆鍙傛暟閰嶇疆绠$悊鍣ㄣ�� + * @date 2023-05-17 + */ + private ArgumentsManager acquireArgumentsManager(){ + return BeanContextAware.getBeanByType(ArgumentsManager.class); + } + + private FileStoreType ossFileStoreType = null; + private String ossPrefix = null; + private Boolean remoteAsLocal = null; + private String localFileRoot = null; + +// /** +// * 寮曞叆鍙傛暟閰嶇疆绠$悊鍣ㄣ�� +// * @param argumentsManager +// * @date 2023-05-17 +// */ +// public void setArgumentsManager(ArgumentsManager argumentsManager) { +// this.argumentsManager = argumentsManager; +// } +// +// private ArgumentsManager argumentsManager; +} diff --git a/iplatform-file-server/src/main/java/com/iplatform/file/FileEngineFactory.java b/iplatform-file-server/src/main/java/com/iplatform/file/FileEngineFactory.java new file mode 100644 index 0000000..b3edf50 --- /dev/null +++ b/iplatform-file-server/src/main/java/com/iplatform/file/FileEngineFactory.java @@ -0,0 +1,301 @@ +package com.iplatform.file; + +import com.iplatform.base.PlatformRuntimeException; +import com.iplatform.file.util.FileStoreUtils; +import com.walker.file.FileInfo; +import com.walker.file.FileOperateEngine; +import com.walker.file.FileOperateException; +import com.walker.file.FileStoreType; +import com.walker.infrastructure.arguments.ArgumentsManager; +import com.walker.infrastructure.arguments.Variable; +import com.walker.infrastructure.core.ApplicationBeanInitialized; +import com.walker.infrastructure.utils.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.InputStream; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 鏂囦欢绠$悊寮曟搸宸ュ巶锛屾彁渚涗笉鍚屽疄鐜颁笂浼犺皟鐢ㄣ�� + * @author 鏃跺厠鑻� + * @date 2023-02-14 + */ +public class FileEngineFactory implements ApplicationBeanInitialized { + + protected final transient Logger logger = LoggerFactory.getLogger(this.getClass()); + + /** + * 涓嬭浇oss鏂囦欢 + * @param fileStoreType + * @param id 鏂囦欢鍞竴缂栧彿 + * @return + * @date 2023-12-13 + */ + public byte[] downloadOssFile(FileStoreType fileStoreType, String id){ + try { + return this.fileOperateEngineMap.get(fileStoreType).downloadFile(id); + } catch (FileOperateException e) { + throw new PlatformRuntimeException("涓嬭浇oss鏂囦欢閿欒锛�" + e.getMessage() + ", id=" + id, e); + } + } + + /** + * 鏍规嵁鏂囦欢ID锛岃繑鍥炴枃浠跺璞°�� + * @param id + * @return + * @date 2023-02-15 + */ + public FileInfo getFileInfo(String id) { + return this.fileOperateEngineMap.get(FileStoreType.FileSystem).getFileInfo(id); + } + + /** + * 鏍规嵁鏂囦欢ID闆嗗悎锛岃繑鍥炴枃浠跺璞¢泦鍚堛�� + * <p>娉ㄦ剰锛氬叾瀹炲摢涓紩鎿庨兘鍙互鏍规嵁 id 杩斿洖鏂囦欢淇℃伅锛岃繖閲岄殢渚块�変竴涓氨琛屻��</p> + * @param ids + * @return + * @date 2023-02-15 + * @date 2023-08-01 鏇存柊娉ㄩ噴 + */ + public List<FileInfo> getFileInfoList(List<String> ids) { + return this.fileOperateEngineMap.get(FileStoreType.FileSystem).getFileInfoList(ids); + } + + /** + * 涓婁紶涓�涓枃浠跺埌绯荤粺纾佺洏銆� + * @param inputStream 鏂囦欢杈撳叆娴� + * @param fileName 鏂囦欢鍚嶅瓧锛屼笉鍖呭惈璺緞锛屽: demo.txt + * @param groupId 鍒嗙粍ID锛屽嵆: 涓氬姟id锛屽彲閫� + * @return + * @throws FileOperateException + */ + @Deprecated + public FileInfo uploadFileToSystem(InputStream inputStream, String fileName, String groupId, long fileSize) throws FileOperateException{ + return this.uploadFile(FileStoreType.FileSystem, inputStream, fileName, groupId, fileSize); + } + + /** + * 涓婁紶鏂囦欢鍒扮郴缁熸湰鍦般�� + * @param inputStream + * @param fileName + * @param groupId + * @param fileSize + * @param businessType + * @param owner + * @return + * @throws FileOperateException + * @date 2023-06-09 + */ + public FileInfo uploadFileToLocal(InputStream inputStream, String fileName, String groupId + , long fileSize, Integer businessType, String owner) throws FileOperateException{ + return this.uploadFile(FileStoreType.FileSystem, inputStream, fileName, groupId, fileSize, businessType, owner); + } + public FileInfo[] uploadFileToLocal(InputStream[] inputStream, String[] fileName, String groupId + , long[] fileSize, Integer businessType, String owner) throws FileOperateException{ + return this.uploadFile(FileStoreType.FileSystem, inputStream, fileName, groupId, fileSize, businessType, owner); + } + + /** + * 涓婁紶涓�涓枃浠跺埌FTP銆� + * @param inputStream 鏂囦欢杈撳叆娴� + * @param fileName 鏂囦欢鍚嶅瓧锛屼笉鍖呭惈璺緞锛屽: demo.txt + * @param groupId 鍒嗙粍ID锛屽嵆: 涓氬姟id锛屽彲閫� + * @return + * @throws FileOperateException + */ + @Deprecated + public FileInfo uploadFileToFtp(InputStream inputStream, String fileName, String groupId, long fileSize) throws FileOperateException{ + return this.uploadFile(FileStoreType.Ftp, inputStream, fileName, groupId, fileSize); + } + + /** + * 涓婁紶涓�涓枃浠跺埌FTP锛岃繖鏄柊鏂规硶銆� + * @param inputStream + * @param fileName + * @param groupId + * @param fileSize + * @param businessType + * @param owner + * @return + * @throws FileOperateException + * @date 2023-06-09 + */ + public FileInfo uploadFileToFtp(InputStream inputStream, String fileName, String groupId + , long fileSize, Integer businessType, String owner) throws FileOperateException{ + if(this.remoteAsLocal){ + // 2023-07-03 + return this.uploadFile(FileStoreType.FileSystem, inputStream, fileName, groupId, fileSize, businessType, owner); + } else { + return this.uploadFile(FileStoreType.Ftp, inputStream, fileName, groupId, fileSize, businessType, owner); + } + } + public FileInfo[] uploadFileToFtp(InputStream[] inputStream, String[] fileName, String groupId + , long[] fileSize, Integer businessType, String owner) throws FileOperateException{ + if(this.remoteAsLocal){ + // 2023-07-03 + return this.uploadFile(FileStoreType.FileSystem, inputStream, fileName, groupId, fileSize, businessType, owner); + } else { + return this.uploadFile(FileStoreType.Ftp, inputStream, fileName, groupId, fileSize, businessType, owner); + } + } + + /** + * 涓婁紶鏂囦欢鍒扮涓夋柟 OSS 绯荤粺銆� + * @param inputStream + * @param fileName 鏂囦欢鍚嶅瓧锛屼笉鍖呭惈璺緞锛屽: demo.txt + * @param groupId + * @param fileSize + * @param businessType 涓氬姟绫诲瀷锛圥ID锛� + * @param owner 鏁版嵁褰掑睘锛堝晢鎴稩D锛夛紝濡傛灉骞冲彴鍒欎负锛�-1 + * @param fileStoreType + * @return + * @throws FileOperateException + * @date 2023-06-09 + */ + public FileInfo uploadFileToOss(InputStream inputStream, String fileName, String groupId + , long fileSize, Integer businessType, String owner, FileStoreType fileStoreType) throws FileOperateException{ + if(fileStoreType != FileStoreType.OssQiNiu + && fileStoreType != FileStoreType.OssTx && fileStoreType != FileStoreType.OssAli + && fileStoreType != FileStoreType.OssAws){ + throw new UnsupportedOperationException("涓嶆敮鎸佺殑OSS绫诲瀷锛�" + fileStoreType); + } + if(this.remoteAsLocal){ + // 2023-07-03 + return this.uploadFile(FileStoreType.FileSystem, inputStream, fileName, groupId, fileSize, businessType, owner); + } else { + return this.uploadFile(fileStoreType, inputStream, fileName, groupId, fileSize, businessType, owner); + } + } + public FileInfo[] uploadFileToOss(InputStream[] inputStream, String[] fileName, String groupId + , long[] fileSize, Integer businessType, String owner, FileStoreType fileStoreType) throws FileOperateException{ + if(fileStoreType != FileStoreType.OssQiNiu + && fileStoreType != FileStoreType.OssTx && fileStoreType != FileStoreType.OssAli && fileStoreType != FileStoreType.OssAws){ + throw new UnsupportedOperationException("涓嶆敮鎸佺殑OSS绫诲瀷锛�" + fileStoreType); + } + if(this.remoteAsLocal){ + // 2023-07-03 + return this.uploadFile(FileStoreType.FileSystem, inputStream, fileName, groupId, fileSize, businessType, owner); + } else { + return this.uploadFile(fileStoreType, inputStream, fileName, groupId, fileSize, businessType, owner); + } + } + + /** + * 涓婁紶涓�涓枃浠躲�� + * @param fileStoreType 鏂囦欢瀛樺偍绫诲瀷锛岃: FileStoreType + * @param inputStream 鏂囦欢杈撳叆娴� + * @param fileName 鏂囦欢鍚嶅瓧锛屼笉鍖呭惈璺緞锛屽: demo.txt + * @param groupId 鍒嗙粍ID锛屽嵆: 涓氬姟id锛屽彲閫� + * @return + * @throws FileOperateException + */ + @Deprecated + public FileInfo uploadFile(FileStoreType fileStoreType + , InputStream inputStream, String fileName, String groupId, long fileSize) throws FileOperateException{ + FileOperateEngine fileOperateEngine = this.fileOperateEngineMap.get(fileStoreType); + if(fileOperateEngine == null){ + throw new IllegalArgumentException("鏈壘鍒板搴旂殑鏂囦欢寮曟搸锛宖ileStoreType=" + fileStoreType); + } +// return fileOperateEngine.uploadFile(inputStream, fileName, groupId, fileSize); + return fileOperateEngine.uploadFile(inputStream, fileName, groupId, fileSize); + } + + public FileInfo uploadFile(FileStoreType fileStoreType + , InputStream inputStream, String fileName, String groupId, long fileSize + , Integer businessType, String owner) throws FileOperateException{ + FileOperateEngine fileOperateEngine = this.fileOperateEngineMap.get(fileStoreType); + if(fileOperateEngine == null){ + throw new IllegalArgumentException("鏈壘鍒板搴旂殑鏂囦欢寮曟搸锛宖ileStoreType=" + fileStoreType); + } +// return fileOperateEngine.uploadFile(inputStream, fileName, groupId, fileSize); + return fileOperateEngine.uploadFile(inputStream, fileName, groupId, fileSize, businessType, owner); + } + + public FileInfo[] uploadFile(FileStoreType fileStoreType + , InputStream[] inputStream, String[] fileName, String groupId, long[] fileSize + , Integer businessType, String owner) throws FileOperateException{ + FileOperateEngine fileOperateEngine = this.fileOperateEngineMap.get(fileStoreType); + if(fileOperateEngine == null){ + throw new IllegalArgumentException("鏈壘鍒板搴旂殑鏂囦欢寮曟搸锛宖ileStoreType=" + fileStoreType); + } + return fileOperateEngine.uploadFile(inputStream, fileName, groupId, fileSize, businessType, owner); + } + + public void register(FileStoreType fileStoreType, FileOperateEngine fileOperateEngine){ + if(fileStoreType == null || fileOperateEngine == null){ + throw new IllegalArgumentException("閿欒锛氭敞鍐� '鏂囦欢绠$悊寮曟搸' 涓虹┖銆�"); + } + this.fileOperateEngineMap.put(fileStoreType, fileOperateEngine); + } + + private Map<FileStoreType, FileOperateEngine> fileOperateEngineMap = new HashMap<>(4); + + @Override + public void startup() { + String fileUrlPrefixConfig = this.getFileUrlPrefix(FileStoreType.FileSystem.getIndex()); + if(StringUtils.isNotEmpty(fileUrlPrefixConfig)){ + FileStoreUtils.fileStoreTypeUrlPrefix.put(FileStoreType.FileSystem.getIndex(), fileUrlPrefixConfig); + } + fileUrlPrefixConfig = this.getFileUrlPrefix(FileStoreType.Ftp.getIndex()); + if(StringUtils.isNotEmpty(fileUrlPrefixConfig)){ + FileStoreUtils.fileStoreTypeUrlPrefix.put(FileStoreType.Ftp.getIndex(), fileUrlPrefixConfig); + } + fileUrlPrefixConfig = this.getFileUrlPrefix(FileStoreType.OssQiNiu.getIndex()); + if(StringUtils.isNotEmpty(fileUrlPrefixConfig)){ + FileStoreUtils.fileStoreTypeUrlPrefix.put(FileStoreType.OssQiNiu.getIndex(), fileUrlPrefixConfig); + } + fileUrlPrefixConfig = this.getFileUrlPrefix(FileStoreType.OssTx.getIndex()); + if(StringUtils.isNotEmpty(fileUrlPrefixConfig)){ + FileStoreUtils.fileStoreTypeUrlPrefix.put(FileStoreType.OssTx.getIndex(), fileUrlPrefixConfig); + } + fileUrlPrefixConfig = this.getFileUrlPrefix(FileStoreType.OssAli.getIndex()); + if(StringUtils.isNotEmpty(fileUrlPrefixConfig)){ + FileStoreUtils.fileStoreTypeUrlPrefix.put(FileStoreType.OssAli.getIndex(), fileUrlPrefixConfig); + } + // 2024-02-23 s3瀵硅薄涓婁紶 + fileUrlPrefixConfig = this.getFileUrlPrefix(FileStoreType.OssAws.getIndex()); + if(StringUtils.isNotEmpty(fileUrlPrefixConfig)){ + FileStoreUtils.fileStoreTypeUrlPrefix.put(FileStoreType.OssAws.getIndex(), fileUrlPrefixConfig); + } + } + + /** + * 杩斿洖鏂囦欢瀛樺偍涓嶅悓鏂瑰紡锛屽搴旂殑鏂囦欢URL鍓嶇紑銆� + * @param fileStoreType + * @return + */ + private String getFileUrlPrefix(String fileStoreType){ + logger.info("setup fileStoreType = {}", fileStoreType); + String fileUrlKey = FileStoreUtils.getFileUrlPrefixKey(fileStoreType); + if(StringUtils.isEmpty(fileUrlKey)){ + logger.error("fileUrlKey涓虹┖锛岃鏂囦欢瀛樺偍绫诲瀷鏃犳硶鑾峰彇閰嶇疆锛宖ileStoreType = " + fileStoreType); + return null; + } + Variable var = this.argumentsManager.getVariable(fileUrlKey); + if(var == null){ +// throw new IllegalStateException("variable鏈壘鍒帮紝key = " + fileUrlKey); + logger.error("argumentsManager鑾峰彇鍙傛暟涓虹┖! fileUrlKey=" + fileUrlKey); + return null; + } + return var.getStringValue(); + } + + public void setArgumentsManager(ArgumentsManager argumentsManager) { + this.argumentsManager = argumentsManager; + } + + /** + * 鏄惁鍦ㄨ皟鐢ㄨ繙绋嬪瓨鍌ㄦ柟娉曟椂锛屾寜鐓ф湰鍦版柟寮忓瓨鍌紝濡傛灉璁剧疆锛歵rue 鍒欏瓨鍌ㄥ埌鏈湴锛堜竴鑸祴璇曟病鏈塅TP銆丱SS鐜鏃惰繖鏍蜂娇鐢級 + * @param remoteAsLocal + * @date 2023-07-03 + */ + public void setRemoteAsLocal(boolean remoteAsLocal) { + this.remoteAsLocal = remoteAsLocal; + } + + private boolean remoteAsLocal = true; + private ArgumentsManager argumentsManager; +} diff --git a/iplatform-file-server/src/main/java/com/iplatform/file/FileStoreCallback.java b/iplatform-file-server/src/main/java/com/iplatform/file/FileStoreCallback.java new file mode 100644 index 0000000..3b4ef29 --- /dev/null +++ b/iplatform-file-server/src/main/java/com/iplatform/file/FileStoreCallback.java @@ -0,0 +1,25 @@ +package com.iplatform.file; + +import com.walker.file.FileInfo; +import com.walker.file.FileStoreType; + +import java.util.List; + +/** + * 鏂囦欢瀛樺偍鍥炶皟瀹氫箟锛岀洰鍓嶇敤浜庢妸鍏冩暟鎹褰曞啓鍏ユ暟鎹簱涓�� + * @author 鏃跺厠鑻� + * @date 2023-02-12 + */ +public interface FileStoreCallback { + + /** + * 鏂囦欢淇濆瓨鏃惰Е鍙戣鏂规硶銆� + * @param fileInfo + * @param fileStoreType + */ + void onCallback(FileInfo fileInfo, FileStoreType fileStoreType); + + FileInfo onAcquireFileInfo(String id); + + List<FileInfo> onAcquireFileInfoList(List<String> ids); +} diff --git a/iplatform-file-server/src/main/java/com/iplatform/file/config/FileConfig.java b/iplatform-file-server/src/main/java/com/iplatform/file/config/FileConfig.java new file mode 100644 index 0000000..aba6f01 --- /dev/null +++ b/iplatform-file-server/src/main/java/com/iplatform/file/config/FileConfig.java @@ -0,0 +1,208 @@ +package com.iplatform.file.config; + +import com.amazonaws.Protocol; +import com.iplatform.base.config.FileProperties; +import com.iplatform.core.PlatformConfiguration; +import com.iplatform.file.FileEngineFactory; +import com.iplatform.file.FileStoreCallback; +import com.iplatform.file.service.FileServiceImpl; +import com.iplatform.file.support.AliOssFileEngine; +import com.iplatform.file.support.AttachmentJdbcCallback; +import com.iplatform.file.support.AwsOssFileEngine; +import com.iplatform.file.support.DefaultFileSystemEngine; +import com.iplatform.file.support.DefaultFtpFileEngine; +import com.iplatform.file.support.QnOssFileEngine; +import com.iplatform.file.support.TxOssFileEngine; +import com.walker.file.FileStoreType; +import com.walker.file.ftp.FtpConfig; +import com.walker.infrastructure.arguments.ArgumentsManager; +import com.walker.infrastructure.utils.JsonUtils; +import com.walker.jdbc.util.StringUtils; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class FileConfig extends PlatformConfiguration { + + /** + * 閰嶇疆涓�涓枃浠跺紩鎿庡伐鍘傚璞°�� + * + * @param ftpFileEngine + * @param fileSystemEngine + * @return + * @date 2023-02-14 + * @date 2023-07-03 娣诲姞灞炴�э細remoteAsLocal 搴斿鏈湴娴嬭瘯娌℃湁FTP銆丱SS杩滅▼鐜鐨勬儏鍐点�� + */ + @Bean + public FileEngineFactory fileEngineFactory(DefaultFtpFileEngine ftpFileEngine, DefaultFileSystemEngine fileSystemEngine + , QnOssFileEngine qnOssFileEngine, TxOssFileEngine txOssFileEngine, AliOssFileEngine aliOssFileEngine + , AwsOssFileEngine awsOssFileEngine + , ArgumentsManager argumentsManager, FileProperties fileProperties) { + FileEngineFactory fileEngineFactory = new FileEngineFactory(); + fileEngineFactory.register(FileStoreType.Ftp, ftpFileEngine); + fileEngineFactory.register(FileStoreType.FileSystem, fileSystemEngine); + fileEngineFactory.register(FileStoreType.OssQiNiu, qnOssFileEngine); + fileEngineFactory.register(FileStoreType.OssTx, txOssFileEngine); + fileEngineFactory.register(FileStoreType.OssAli, aliOssFileEngine); + // 2023-12-13 + fileEngineFactory.register(FileStoreType.OssAws, awsOssFileEngine); + + fileEngineFactory.setArgumentsManager(argumentsManager); + fileEngineFactory.setRemoteAsLocal(fileProperties.isRemoteAsLocal()); + fileEngineFactory.startup(); + return fileEngineFactory; + } + + /** + * 鍒涘缓锛歄SS鏈嶅姟寮曟搸銆� + * + * @param fileProperties + * @param fileStoreCallback + * @return + * @date 2023-12-13 + */ + @Bean + public AwsOssFileEngine awsOssFileEngine(FileProperties fileProperties, FileStoreCallback fileStoreCallback) throws Exception { + AwsOssFileEngine engine = new AwsOssFileEngine(); + engine.setPrefix(fileProperties.getOssPrefix()); + engine.setFileStoreCallback(fileStoreCallback); + engine.setAccessKey(fileProperties.getOssAccessKey()); + engine.setSecretKey(fileProperties.getOssSecretKey()); + engine.setEndpoint(fileProperties.getOssEndpoint()); + engine.setBucketName(fileProperties.getOssBucketName()); + engine.initS3Client(); + logger.info(".............. OSS 鍒濆鍖栵細 浜氶┈閫奡3!"); + return engine; + } + + + /** + * 闃块噷浜� OSS 鏂囦欢寮曟搸瀹氫箟銆� + * + * @param fileProperties + * @param fileStoreCallback + * @return + * @date 2023-06-09 + */ + @Bean + public AliOssFileEngine aliOssFileEngine(FileProperties fileProperties, FileStoreCallback fileStoreCallback) { + AliOssFileEngine engine = new AliOssFileEngine(); + engine.setFileRoot(fileProperties.getFileRoot()); + engine.setFileStoreCallback(fileStoreCallback); + return engine; + } + + /** + * 鑵捐 OSS 鏂囦欢寮曟搸瀹氫箟銆� + * + * @param fileProperties + * @param fileStoreCallback + * @return + * @date 2023-06-09 + */ + @Bean + public TxOssFileEngine txOssFileEngine(FileProperties fileProperties, FileStoreCallback fileStoreCallback) { + TxOssFileEngine engine = new TxOssFileEngine(); + engine.setFileRoot(fileProperties.getFileRoot()); + engine.setFileStoreCallback(fileStoreCallback); + return engine; + } + + /** + * 涓冪墰浜� OSS 鏂囦欢寮曟搸瀹氫箟銆� + * + * @param fileProperties + * @param fileStoreCallback + * @return + * @date 2023-06-09 + */ + @Bean + public QnOssFileEngine qnOssFileEngine(FileProperties fileProperties, FileStoreCallback fileStoreCallback) { + QnOssFileEngine engine = new QnOssFileEngine(); + engine.setFileRoot(fileProperties.getFileRoot()); + engine.setFileStoreCallback(fileStoreCallback); + return engine; + } + + /** + * 鏈満鏂囦欢绯荤粺 瀹炵幇鐨勬枃浠剁鐞嗗紩鎿庛�� + * + * @param fileProperties + * @param fileService + * @return + * @date 2023-02-14 + */ + @Bean + public DefaultFileSystemEngine defaultFileSystemEngine(FileProperties fileProperties, FileServiceImpl fileService) { + DefaultFileSystemEngine fileSystemEngine = new DefaultFileSystemEngine(); + fileSystemEngine.setFileRoot(fileProperties.getFileRoot()); + fileSystemEngine.setFileStoreCallback(this.fileStoreCallback(fileService)); + return fileSystemEngine; + } + + /** + * Ftp 瀹炵幇鐨勬枃浠剁鐞嗗紩鎿� + * + * @param ftpProperties + * @param fileService + * @return + * @date 2023-02-14 + */ + @Bean + public DefaultFtpFileEngine defaultFtpFileEngine(FtpProperties ftpProperties, FileServiceImpl fileService) { + FtpConfig ftpConfig = new FtpConfig(); + ftpConfig.setIp(ftpProperties.getIp()); + ftpConfig.setPort(ftpProperties.getPort()); + ftpConfig.setUserName(ftpProperties.getUserName()); + ftpConfig.setPassword(ftpProperties.getPassword()); + ftpConfig.setPrivateKey(ftpProperties.getPrivateKey()); + + DefaultFtpFileEngine ftpFileEngine = new DefaultFtpFileEngine(); +// ftpFileEngine.setFileRoot(fileProperties.getFileRoot()); + ftpFileEngine.setFileRoot(ftpProperties.getFileRoot()); + ftpFileEngine.setFtpConfig(ftpConfig); + ftpFileEngine.setFileStoreCallback(this.fileStoreCallback(fileService)); + return ftpFileEngine; + } + + @Bean + public FtpProperties ftpProperties() { + return new FtpProperties(); + } + +// /** +// * 鏀惧湪 base spi 涓厤缃�� +// * @return +// */ +// @Bean +// public FileProperties fileProperties(){ +// return new FileProperties(); +// } + + /** + * 閰嶇疆鏂囦欢涓婁紶璁板綍鍐欏叆鐨勫洖璋冨疄鐜般�� + * @param fileService + * @return + * @date 2023-02-14 + */ +// @Bean +// public JdbcCallback fileStoreCallback(FileServiceImpl fileService){ +// JdbcCallback jdbcCallback = new JdbcCallback(); +// jdbcCallback.setFileService(fileService); +// return jdbcCallback; +// } + + /** + * 閰嶇疆鏂扮殑闄勪欢淇濆瓨鍥炶皟瀵硅薄锛屽簾寮冭�佸璞★細JdbcCallback + * + * @param fileService + * @return + * @date 2023-06-05 + */ + @Bean + public AttachmentJdbcCallback fileStoreCallback(FileServiceImpl fileService) { + AttachmentJdbcCallback jdbcCallback = new AttachmentJdbcCallback(); + jdbcCallback.setFileService(fileService); + return jdbcCallback; + } +} diff --git a/iplatform-file-server/src/main/java/com/iplatform/file/config/FileWebConfig.java b/iplatform-file-server/src/main/java/com/iplatform/file/config/FileWebConfig.java new file mode 100644 index 0000000..abe5063 --- /dev/null +++ b/iplatform-file-server/src/main/java/com/iplatform/file/config/FileWebConfig.java @@ -0,0 +1,40 @@ +package com.iplatform.file.config; + +import com.iplatform.base.Constants; +import com.iplatform.base.config.FileProperties; +import com.iplatform.core.PlatformConfiguration; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; + +/** + * 涓撻棬涓烘湰鍦版枃浠惰兘琚玾eb璁块棶鐨勬槧灏勯厤缃�� + * <p>娉ㄦ剰锛氳閰嶇疆浠呴拡瀵规湰鍦版枃浠讹紝鍏朵粬FTP鎴朞SS鏂瑰紡璇烽�氳繃绗笁鏂归摼鎺ヨ闂枃浠躲��</p> + * @author 鏃跺厠鑻� + * @date 2023-06-09 + */ +@Configuration +public class FileWebConfig extends PlatformConfiguration implements WebMvcConfigurer { + + private FileProperties fileProperties; + + @Autowired + public FileWebConfig(FileProperties fileProperties){ + this.fileProperties = fileProperties; + } + + /** + * 娣诲姞鏂囦欢娴忚鏄犲皠锛屽锛歠ile:D://images/ + * @param registry + * @date 2023-06-09 + */ + @Override + public void addResourceHandlers(ResourceHandlerRegistry registry) { + // 骞冲彴涓婁紶鐨勬枃浠讹紝鍙�氳繃鐩稿璺緞娴忚銆� + // 娉ㄦ剰锛氳繖閲屽繀椤绘坊鍔犲墠缂�'file:'锛屽惁鍒欎細鏃犳硶鏄犲皠鎴愬姛锛�2023-06-09 + String fileStorePath = "file:" + this.fileProperties.getFileRoot(); + registry.addResourceHandler(Constants.FILE_CONTEXT_PATH_MAPPING).addResourceLocations(fileStorePath); + logger.info("鏄犲皠:{}, 鏈湴璺緞:{}", Constants.FILE_CONTEXT_PATH_MAPPING, fileStorePath); + } +} diff --git a/iplatform-file-server/src/main/java/com/iplatform/file/config/FtpProperties.java b/iplatform-file-server/src/main/java/com/iplatform/file/config/FtpProperties.java new file mode 100644 index 0000000..297e3b4 --- /dev/null +++ b/iplatform-file-server/src/main/java/com/iplatform/file/config/FtpProperties.java @@ -0,0 +1,66 @@ +package com.iplatform.file.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; + +@ConfigurationProperties(prefix = "iplatform.file.ftp") +public class FtpProperties { + + public String getIp() { + return ip; + } + + public void setIp(String ip) { + this.ip = ip; + } + + public String getPort() { + return port; + } + + public void setPort(String port) { + this.port = port; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getPrivateKey() { + return privateKey; + } + + public void setPrivateKey(String privateKey) { + this.privateKey = privateKey; + } + + /** + * 杩斿洖ftp鐨勬牴璺緞锛屽鏋滄湭璁剧疆榛樿涓�: / + * @return + */ + public String getFileRoot() { + return fileRoot; + } + + public void setFileRoot(String fileRoot) { + this.fileRoot = fileRoot; + } + + private String fileRoot = null; + private String ip; + private String port; + private String userName; + private String password; + private String privateKey; +} diff --git a/iplatform-file-server/src/main/java/com/iplatform/file/controller/AttachmentController.java b/iplatform-file-server/src/main/java/com/iplatform/file/controller/AttachmentController.java new file mode 100644 index 0000000..b7a294d --- /dev/null +++ b/iplatform-file-server/src/main/java/com/iplatform/file/controller/AttachmentController.java @@ -0,0 +1,121 @@ +package com.iplatform.file.controller; + +import com.iplatform.base.ArgumentsConstants; +import com.iplatform.base.Constants; +import com.iplatform.base.SystemController; +import com.iplatform.file.service.FileServiceImpl; +import com.iplatform.file.util.FileResultUtils; +import com.iplatform.file.util.FileStoreUtils; +import com.iplatform.file.util.ImageUtils; +import com.iplatform.model.po.SfAttachment; +import com.walker.db.page.GenericPager; +import com.walker.file.FileInfo; +import com.walker.file.FileStoreType; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.web.ResponseValue; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import java.util.List; + +@RestController +@RequestMapping("/platform/attachment") +public class AttachmentController extends SystemController { + + private FileServiceImpl fileService = null; + + @Autowired + public AttachmentController(FileServiceImpl fileService){ + this.fileService = fileService; + } + + @RequestMapping(value = "/upload/file", method = RequestMethod.POST) + public ResponseValue uploadFile(MultipartFile multipart, String model, Integer pid){ + String owner = String.valueOf(this.getOwner()); + String fileStoreType = this.getArgumentVariable(ArgumentsConstants.CONFIG_UPLOAD_TYPE).getStringValue(); + try{ + FileInfo fileInfo = null; + if(fileStoreType.equals(FileStoreType.INDEX_FS)){ + // 鏈湴瀛樺偍 + fileInfo = this.uploadFileToLocal(multipart, null, pid, owner, Constants.UPLOAD_AFTER_FILE_KEYWORD); + + } else { + // 杩滅▼瀛樺偍 + fileInfo = this.uploadFileToRemote(multipart, null, pid, owner, Constants.UPLOAD_AFTER_FILE_KEYWORD); + } + return ResponseValue.success(FileResultUtils.acquireFileResultVo(fileInfo, multipart.getContentType())); + + } catch (Exception ex){ + logger.error("鏂囦欢涓婁紶閿欒锛�" + ex.getMessage(), ex); + return ResponseValue.error(ex.getMessage()); + } + } + +// @ApiImplicitParams({ +// @ApiImplicitParam(name = "model", value = "妯″潡 鐢ㄦ埛user,鍟嗗搧product,寰俊wechat,鏂囩珷article,绯荤粺system"), +// @ApiImplicitParam(name = "pid", value = "鍒嗙被ID 0缂栬緫鍣�,1鍟嗗搧鍥剧墖,2鎷煎洟鍥剧墖,3鐮嶄环鍥剧墖,4绉掓潃鍥剧墖,5鏂囩珷鍥剧墖,6缁勫悎鏁版嵁鍥�,7鍓嶅彴鐢ㄦ埛,8寰俊绯诲垪 ", allowableValues = "range[0,1,2,3,4,5,6,7,8]") +// }) + @RequestMapping(value = "/upload/image", method = RequestMethod.POST) + public ResponseValue uploadImage(MultipartFile multipart, String model, Integer pid){ + String owner = String.valueOf(this.getOwner()); + String fileStoreType = this.getArgumentVariable(ArgumentsConstants.CONFIG_UPLOAD_TYPE).getStringValue(); + try{ + FileInfo fileInfo = null; + if(fileStoreType.equals(FileStoreType.INDEX_FS)){ + // 鏈湴瀛樺偍 + fileInfo = this.uploadFileToLocal(multipart, null, pid, owner, Constants.UPLOAD_AFTER_IMAGE_KEYWORD); + + } else { + // 杩滅▼瀛樺偍 + fileInfo = this.uploadFileToRemote(multipart, null, pid, owner, Constants.UPLOAD_AFTER_IMAGE_KEYWORD); + } + return ResponseValue.success(FileResultUtils.acquireFileResultVo(fileInfo, multipart.getContentType())); + + } catch (Exception ex){ + logger.error("鍥剧墖涓婁紶閿欒锛�" + ex.getMessage(), ex); + return ResponseValue.error(ex.getMessage()); + } + } + + /** + * 鍒嗛〉鍒楀嚭鏂囦欢淇℃伅锛屽湪鏂囦欢锛堝浘鐗囷級閫夋嫨缁勪欢涓娇鐢ㄣ�� + * @param pid + * @param attType 鏂囦欢绫诲瀷锛岄粯璁ゅ�硷細png,jpeg,jpg,audio/mpeg,text/plain,video/mp4,gif + * @return + */ + @RequestMapping(value = "/list", method = RequestMethod.GET) + public ResponseValue list(Integer pid, String attType){ + List<String> attTypeList = null; + if(StringUtils.isNotEmpty(attType)){ + attTypeList = ImageUtils.acquireFileTypeList(attType); + } + long owner = this.getOwner(); + logger.debug("owner = " + owner); + + GenericPager<SfAttachment> pager = this.fileService.queryPageAttachmentList((int)owner, pid, attTypeList); + if(pager.getDatas() != null){ + String fileStoreType = null; + for(SfAttachment attachment : pager.getDatas()){ + fileStoreType = attachment.getFileStoreType(); + if(StringUtils.isEmpty(attachment.getSattDir())){ + continue; + } + attachment.setSattDir(FileStoreUtils.fileStoreTypeUrlPrefix.get(fileStoreType) + attachment.getSattDir()); + } + } + return ResponseValue.success(pager); + } + +// /** +// * 杩斿洖鏂囦欢瀛樺偍涓嶅悓鏂瑰紡锛屽搴旂殑鏂囦欢URL鍓嶇紑銆� +// * @param fileStoreType +// * @return +// */ +// private String getFileUrlPrefix(String fileStoreType){ +// String fileUrlKey = FileStoreUtils.getFileUrlPrefixKey(fileStoreType); +// return this.getArgumentVariable(fileUrlKey).getStringValue(); +// } +} diff --git a/iplatform-file-server/src/main/java/com/iplatform/file/controller/FileController.java b/iplatform-file-server/src/main/java/com/iplatform/file/controller/FileController.java new file mode 100644 index 0000000..0080684 --- /dev/null +++ b/iplatform-file-server/src/main/java/com/iplatform/file/controller/FileController.java @@ -0,0 +1,44 @@ +package com.iplatform.file.controller; + +import com.iplatform.base.SystemController; +import com.iplatform.file.service.FileServiceImpl; +import com.iplatform.model.po.S_file; +import com.walker.db.page.GenericPager; +import com.walker.file.DefaultFileInfo; +import com.walker.web.ResponseValue; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +//@RestController +//@RequestMapping("/system/file") +@Deprecated +public class FileController extends SystemController { + + private FileServiceImpl fileService = null; + + @Autowired + public FileController(FileServiceImpl fileService){ + this.fileService = fileService; + } + + @GetMapping("/list") + public ResponseValue list(DefaultFileInfo fileInfo){ + if(fileInfo == null){ + return ResponseValue.error("鏃犳硶鏌ヨ鏂囦欢:娌℃湁鏉′欢"); + } + GenericPager<S_file> pager = this.fileService.queryPageFileList(fileInfo.getFileName(), fileInfo.getFileExt(), fileInfo.getGroupId()); + return this.acquireTablePage(pager.getDatas(), pager.getTotalRows()); + } + + @RequestMapping("/remove/{fileId}") + public ResponseValue remove(@PathVariable Long fileId){ + if(fileId == null || fileId.longValue() <= 0){ + return ResponseValue.error("鏂囦欢id閿欒"); + } + this.fileService.delete(new S_file(fileId)); + return ResponseValue.success(); + } +} diff --git a/iplatform-file-server/src/main/java/com/iplatform/file/controller/OssFileApi.java b/iplatform-file-server/src/main/java/com/iplatform/file/controller/OssFileApi.java new file mode 100644 index 0000000..2179019 --- /dev/null +++ b/iplatform-file-server/src/main/java/com/iplatform/file/controller/OssFileApi.java @@ -0,0 +1,116 @@ +package com.iplatform.file.controller; + +import com.iplatform.base.SystemController; +import com.iplatform.base.config.ApiProperties; +import com.walker.file.FileInfo; +import com.walker.infrastructure.utils.FileCopyUtils; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.web.ResponseValue; +import com.walker.web.util.ServletUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; + +@RestController +@RequestMapping("/oss") +public class OssFileApi extends SystemController { + + private ApiProperties apiProperties; + + @Autowired + public OssFileApi(ApiProperties apiProperties){ + this.apiProperties = apiProperties; + } + + @RequestMapping(value = "/{id}", method = RequestMethod.GET) + @ResponseBody + public void downloadOssFile(@PathVariable(name = "id") String id){ + if(StringUtils.isEmpty(id)){ + throw new IllegalArgumentException("鏂囦欢鍙傛暟涓虹┖锛屾棤娉曚笅杞芥枃浠�"); + } + FileInfo fileInfo = this.acquireFileOperateSpi().getFileInfo(Long.parseLong(id)); + if(fileInfo == null){ + throw new IllegalArgumentException("鏂囦欢涓嶅瓨鍦紝id=" + id); + } + + // 2024-03-08 涓哄帇娴嬫彁渚涙敮鎸侊紝 + try { + byte[] fileContent = null; + if(this.apiProperties.isTimeEnabled()){ + // 鍘嬫祴妯″紡锛岃褰曟帴鍙h皟鐢ㄦ椂闂� + fileContent = this.acquirePressureTestFile(fileInfo); + } else { + // 姝e父妯″紡 + fileContent = this.getOssFileData(id); + } + this.downloadSimpleFile(fileContent, fileInfo.getFileName()); + + } catch (IOException e) { + logger.error("涓嬭浇oss閿欒:" + e.getMessage() + ", id=" + id, e); + ServletUtils.renderString(getResponse(), "涓嬭浇oss閿欒:" + e.getMessage() + ", id=" + id); + } + } + + /** + * 鍘嬫祴鏃跺皾璇曚粠缂撳瓨鏌ユ壘鏂囦欢锛屽鏋滄湭缂撳瓨浼氭妸榛樿64涓枃浠剁紦瀛樸�傚鏋滆秴杩�64涓紝鍏堟竻闄ょ紦瀛橈紝骞堕噸鏂板紑濮嬬紦瀛樺悗缁�64涓紝寰幆寰�澶嶃�� + * @param fileInfo + * @return + * @author 鏃跺厠鑻� + * @date 2024-03-08 + */ + private byte[] acquirePressureTestFile(FileInfo fileInfo){ + byte[] fileData = null; + long fileSize = fileInfo.getFileSize(); + if(fileSize <= maxCacheFileSize){ + // 褰撶紦瀛樻暟閲忚揪鍒颁笂闄愭椂锛屾竻绌洪噸鏂板紑濮嬬紦瀛樻柊鐨� + if(fileContentCache.size() >= maxCacheFileCount){ + fileContentCache.clear(); + } + // 褰撴枃浠跺皬浜庣瓑浜�1M锛屽苟涓旂紦瀛樻暟閲忔湭杈惧埌涓婇檺鏃讹紝缂撳瓨 + fileData = this.fileContentCache.get(fileInfo.getId()); + if(fileData == null){ + fileData = this.getOssFileData(fileInfo.getId()); + this.fileContentCache.put(fileInfo.getId(), fileData); + logger.debug("缂撳瓨涓�涓猳ss鏂囦欢锛歿}锛屽ぇ灏忥細{}", fileInfo.getFileName(), fileSize); + } else { + logger.debug("浠庣紦瀛樺姞杞戒簡oss鏂囦欢锛歿}", fileInfo.getId()); + } + } else { + fileData = this.getOssFileData(fileInfo.getId()); + } + return fileData; + } + + private Map<String, byte[]> fileContentCache = new ConcurrentHashMap<>(128); + + private int maxCacheFileCount = 64; + private long maxCacheFileSize = 1024 * 1024; + + /** + * 妯℃嫙娴嬭瘯銆� + */ + @RequestMapping(value = "/test/demo", method = RequestMethod.GET) + public void downloadOssDemo(){ + String file = "F:/app_ocr_demo/ocr_e_005.jpg"; + try { + this.downloadSimpleFile(FileCopyUtils.copyToByteArray(new File(file)), "娴嬭瘯鍥剧墖"); + } catch (IOException e) { + logger.error("涓嬭浇oss demo閿欒:" + e.getMessage() + ", id=" + file, e); + ServletUtils.renderString(getResponse(), "涓嬭浇oss demo閿欒:" + e.getMessage() + ", id=" + file); + } + } + + @RequestMapping(value = "/test/upload", method = RequestMethod.GET) + public ResponseValue demoUploadOss() throws Exception{ + File file = new File("F:/app_ocr_demo/ocr_e_005.jpg"); + FileInputStream inputStream = new FileInputStream(file); + FileInfo fileInfo = this.uploadFileToRemote(inputStream, "demo.jpg", null, file.length(), 0, "-1"); + logger.info("fileInfo = {}", fileInfo); + return ResponseValue.success("涓婁紶鏂囦欢鎴愬姛锛�" + fileInfo.getUrl()); + } +} diff --git a/iplatform-file-server/src/main/java/com/iplatform/file/service/FileServiceImpl.java b/iplatform-file-server/src/main/java/com/iplatform/file/service/FileServiceImpl.java new file mode 100644 index 0000000..2279bac --- /dev/null +++ b/iplatform-file-server/src/main/java/com/iplatform/file/service/FileServiceImpl.java @@ -0,0 +1,72 @@ +package com.iplatform.file.service; + +import com.iplatform.model.po.S_file; +import com.iplatform.model.po.SfAttachment; +import com.walker.db.page.GenericPager; +import com.walker.db.page.ListPageContext; +import com.walker.db.page.PageSearch; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.jdbc.service.BaseServiceImpl; +import org.springframework.stereotype.Service; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +@Service +public class FileServiceImpl extends BaseServiceImpl { + + public static final String SQL_PAGE_FILE = "select * from s_file where 1=1"; + public static final String SQL_PAGE_ATTACHMENT = "select * from sf_attachment where 1=1"; + + /** + * 鍒嗛〉鍒楄〃闄勪欢淇℃伅 + * @param owner 褰掑睘锛�-1 骞冲彴锛屽叾浠栧�艰〃绀轰笉鍚岀鎴稩D + * @param pid 鍒嗙被 + * @param attTypeList 鏂囦欢绫诲瀷闆嗗悎 + * @return + * @date 2023-06-05 + */ + public GenericPager<SfAttachment> queryPageAttachmentList(int owner, Integer pid, List<String> attTypeList){ + Map<String, Object> parameters = new HashMap<>(); + StringBuilder sql = new StringBuilder(SQL_PAGE_ATTACHMENT); + sql.append(" and owner = :owner"); + parameters.put("owner", owner); + + if(pid != null && pid.intValue() > 0){ + sql.append(" and pid = :pid"); + parameters.put("pid", pid); + } + if(!StringUtils.isEmptyList(attTypeList)){ + sql.append(" and att_type in (:attTypeList)"); + parameters.put("attTypeList", attTypeList); + } + sql.append(" order by create_time desc"); +// PageSearch pageSearch = ListPageContext.getPageSearch(); +// return this.selectSplit(sql.toString(), parameters, pageSearch.getPageIndex(), pageSearch.getPageSize(), new SfAttachment()); + return this.selectSplit(sql.toString(), parameters, new SfAttachment()); + } + + @Deprecated + public GenericPager<S_file> queryPageFileList(String fileName, String fileExt, String groupId){ + Map<String, Object> parameters = new HashMap<>(); + StringBuilder sql = new StringBuilder(SQL_PAGE_FILE); + + if(StringUtils.isNotEmpty(fileName)){ + sql.append(" and file_name like :fileName"); + parameters.put("fileName", "%" + fileName + "%"); + } + if(StringUtils.isNotEmpty(fileExt)){ + sql.append(" and file_ext = :fileExt"); + parameters.put("fileExt", fileExt); + } + if(StringUtils.isNotEmpty(groupId)){ + sql.append(" and group_id = :groupId"); + parameters.put("groupId", groupId); + } + sql.append(" order by create_time desc"); + PageSearch pageSearch = ListPageContext.getPageSearch(); + return this.selectSplit(sql.toString(), parameters, pageSearch.getPageIndex(), pageSearch.getPageSize(), new S_file()); + } + +} diff --git a/iplatform-file-server/src/main/java/com/iplatform/file/support/AbstractOssFileEngine.java b/iplatform-file-server/src/main/java/com/iplatform/file/support/AbstractOssFileEngine.java new file mode 100644 index 0000000..47b5942 --- /dev/null +++ b/iplatform-file-server/src/main/java/com/iplatform/file/support/AbstractOssFileEngine.java @@ -0,0 +1,58 @@ +package com.iplatform.file.support; + +import com.iplatform.file.FileStoreCallback; +import com.walker.file.AbstractFileOperateEngine; +import com.walker.file.DefaultFileInfo; +import com.walker.file.FileInfo; + +import java.util.List; + +/** + * OSS涓婁紶鏂囦欢寮曟搸鎶借薄瀹炵幇锛屽叕鍏变唬鐮侀儴鍒嗐�� + * @author 鏃跺厠鑻� + * @date 2023-06-09 + */ +public abstract class AbstractOssFileEngine extends AbstractFileOperateEngine { + + @Override + protected FileInfo acquireFileInfo(String fileName) { + return new DefaultFileInfo(); + } + + @Override + protected void writeFileInfo(FileInfo fileInfo) { + if(this.fileStoreCallback != null){ + this.fileStoreCallback.onCallback(fileInfo, this.getFileStoreType()); + } + } + + @Override + public FileInfo getFileInfo(String id) { + return this.fileStoreCallback.onAcquireFileInfo(id); + } + + @Override + public List<FileInfo> getFileInfoList(List<String> ids) { + return this.fileStoreCallback.onAcquireFileInfoList(ids); + } + + public void setFileStoreCallback(FileStoreCallback fileStoreCallback) { + this.fileStoreCallback = fileStoreCallback; + } + + /** + * 杩斿洖OSS璁块棶鍓嶇紑锛岄�氬父鍦ㄩ厤缃畒aml鏂囦欢涓厤缃�� + * @return + * @date 2023-12-13 + */ + public String getPrefix() { + return prefix; + } + + public void setPrefix(String prefix) { + this.prefix = prefix; + } + + private String prefix; // oss鍓嶇紑锛�2023-12-13 + private FileStoreCallback fileStoreCallback = null; +} diff --git a/iplatform-file-server/src/main/java/com/iplatform/file/support/AliOssFileEngine.java b/iplatform-file-server/src/main/java/com/iplatform/file/support/AliOssFileEngine.java new file mode 100644 index 0000000..bc2e23e --- /dev/null +++ b/iplatform-file-server/src/main/java/com/iplatform/file/support/AliOssFileEngine.java @@ -0,0 +1,32 @@ +package com.iplatform.file.support; + +import com.walker.file.FileInfo; +import com.walker.file.FileOperateException; +import com.walker.file.FileStoreType; + +import java.io.InputStream; + +/** + * 闃块噷浜� OSS 瀹炵幇锛屼唬鐮佹湭瀹屾垚銆� + * @author 鏃跺厠鑻� + * @date 2023-06-09 + */ +public class AliOssFileEngine extends AbstractOssFileEngine{ + + public AliOssFileEngine(){} + + @Override + protected void executeUpload(InputStream inputStream, FileInfo fileInfo) throws FileOperateException { + throw new UnsupportedOperationException("鏈疄鐜伴樋閲孫SS涓婁紶浠g爜"); + } + + @Override + protected byte[] executeDownload(FileInfo fileInfo) throws FileOperateException { + throw new IllegalAccessError("涓嶈兘璋冪敤OSS涓嬭浇鏂规硶锛岃璁块棶绗笁鏂归摼鎺�"); + } + + @Override + public FileStoreType getFileStoreType() { + return FileStoreType.OssAli; + } +} diff --git a/iplatform-file-server/src/main/java/com/iplatform/file/support/AttachmentJdbcCallback.java b/iplatform-file-server/src/main/java/com/iplatform/file/support/AttachmentJdbcCallback.java new file mode 100644 index 0000000..6849f41 --- /dev/null +++ b/iplatform-file-server/src/main/java/com/iplatform/file/support/AttachmentJdbcCallback.java @@ -0,0 +1,130 @@ +package com.iplatform.file.support; + +import com.iplatform.base.util.UserUtils; +import com.iplatform.file.FileStoreCallback; +import com.iplatform.file.service.FileServiceImpl; +import com.iplatform.file.util.ImageUtils; +import com.iplatform.model.po.S_user_core; +import com.iplatform.model.po.SfAttachment; +import com.iplatform.model.po.SfAttachment_mapper; +import com.walker.file.DefaultFileInfo; +import com.walker.file.FileInfo; +import com.walker.file.FileStoreType; +import com.walker.infrastructure.utils.DateUtils; +import com.walker.infrastructure.utils.StringUtils; +import com.walker.web.UserPrincipal; +import com.walker.web.WebRuntimeException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; + +import java.util.ArrayList; +import java.util.List; + +public class AttachmentJdbcCallback implements FileStoreCallback { + + protected final transient Logger logger = LoggerFactory.getLogger(getClass()); + + @Override + public void onCallback(FileInfo fileInfo, FileStoreType fileStoreType) { + if(logger.isDebugEnabled()){ + logger.debug("淇濆瓨鏂囦欢:{}", fileInfo); + } + String fileExt = fileInfo.getFileExt(); + + SfAttachment attachment = new SfAttachment(); + attachment.setAttId(Long.parseLong(fileInfo.getId())); + attachment.setCreateTime(DateUtils.getDateTimeNumber()); + attachment.setUpdateTime(attachment.getCreateTime()); + + // 2023-08-01 + try{ + UserPrincipal<S_user_core> userPrincipal = UserUtils.getCurrentUserPrincipal(); + if(userPrincipal != null){ + attachment.setUserName(userPrincipal.getUserName()); + } else { + attachment.setUserName("鍓嶇鐢ㄦ埛"); + } + } catch (WebRuntimeException ex){ + logger.debug("鏈壘鍒板綋鍓嶇敤鎴凤紝鏂囦欢璁板綍浜轰负绌�"); + attachment.setUserName("鏈煡鐢ㄦ埛"); + } + + attachment.setName(fileInfo.getFileName()); + attachment.setSattDir(fileInfo.getUrl()); + attachment.setAttType(fileExt); // 杩欓噷鐩墠鏄悗缂�鍚嶏紝鍚庣画鍙弬鑰冪數鍟嗙郴缁熷瓨鏀�:mimeType + attachment.setAttSize(fileInfo.getFileSize()); + attachment.setFileStoreType(fileStoreType.getIndex()); + if(StringUtils.isNotEmpty(fileInfo.getGroupId())){ + attachment.setGroupId(fileInfo.getGroupId()); + } + if(ImageUtils.isImage(fileExt) || ImageUtils.isVideo(fileExt)){ + // 鏆傛椂瀛樻斁涓�1锛岃〃绀哄獟浣撴牸寮� + attachment.setImageType(1); + } else { + // 闈炲獟浣撴牸寮� + attachment.setImageType(0); + } + // pid 鍜� owner 闇�瑕佷紶杩囨潵 + attachment.setPid(fileInfo.getBusinessType()); + String owner = fileInfo.getOwner(); + if(StringUtils.isEmpty(owner)){ + attachment.setOwner(-1); + } else { + attachment.setOwner(Integer.parseInt(owner)); + } + this.fileService.insert(attachment); + } + + @Override + public FileInfo onAcquireFileInfo(String id) { + SfAttachment attachment = this.fileService.get(new SfAttachment(Long.parseLong(id))); + if(attachment == null){ + return null; + } + return this.toFileInfo(attachment); + } + + @Override + public List<FileInfo> onAcquireFileInfoList(List<String> ids) { + if(StringUtils.isEmptyList(ids)){ + return null; + } + MapSqlParameterSource sqlParameterSource = new MapSqlParameterSource(); + sqlParameterSource.addValue("ids", ids); + List<SfAttachment> list = this.fileService.sqlListObjectWhereIn("select * from sf_attachment where att_id in(:ids)" + , SfAttachment_mapper.ROW_MAPPER, sqlParameterSource); + if(StringUtils.isEmptyList(list)){ + return null; + } + List<FileInfo> fileInfoList = new ArrayList<>(list.size()); + for(SfAttachment s_file : list){ + fileInfoList.add(this.toFileInfo(s_file)); + } + return fileInfoList; + } + + private FileInfo toFileInfo(SfAttachment attachment){ + if(attachment == null){ + return null; + } + DefaultFileInfo fileInfo = new DefaultFileInfo(); + fileInfo.setId(String.valueOf(attachment.getAttId())); + fileInfo.setFileSize(attachment.getAttSize()); + fileInfo.setUrl(attachment.getSattDir()); + fileInfo.setFileExt(attachment.getAttType()); + fileInfo.setFileName(attachment.getName()); + fileInfo.setFileStoreType(FileStoreType.getType(attachment.getFileStoreType())); + fileInfo.setGroupId(attachment.getGroupId()); + fileInfo.setBusinessType(attachment.getPid()); + fileInfo.setOwner(String.valueOf(attachment.getOwner())); + return fileInfo; + } + + public void setFileService(FileServiceImpl fileService) { + this.fileService = fileService; + } + + private FileServiceImpl fileService; + +} diff --git a/iplatform-file-server/src/main/java/com/iplatform/file/support/AwsOssFileEngine.java b/iplatform-file-server/src/main/java/com/iplatform/file/support/AwsOssFileEngine.java new file mode 100644 index 0000000..b40d349 --- /dev/null +++ b/iplatform-file-server/src/main/java/com/iplatform/file/support/AwsOssFileEngine.java @@ -0,0 +1,359 @@ +package com.iplatform.file.support; + +import com.amazonaws.ClientConfiguration; +import com.amazonaws.Protocol; +import com.amazonaws.auth.AWSCredentials; +import com.amazonaws.auth.AWSStaticCredentialsProvider; +import com.amazonaws.auth.BasicAWSCredentials; +import com.amazonaws.auth.policy.Policy; +import com.amazonaws.auth.policy.Principal; +import com.amazonaws.auth.policy.Resource; +import com.amazonaws.auth.policy.Statement; +import com.amazonaws.auth.policy.actions.S3Actions; +import com.amazonaws.client.builder.AwsClientBuilder; +import com.amazonaws.regions.Regions; +import com.amazonaws.services.s3.AmazonS3; +import com.amazonaws.services.s3.AmazonS3ClientBuilder; +import com.amazonaws.services.s3.model.BucketCrossOriginConfiguration; +import com.amazonaws.services.s3.model.CORSRule; +import com.amazonaws.services.s3.model.ObjectMetadata; +import com.amazonaws.services.s3.model.PutObjectRequest; +import com.amazonaws.services.s3.model.PutObjectResult; +import com.amazonaws.services.s3.model.S3Object; +import com.amazonaws.services.s3.model.S3ObjectInputStream; +import com.amazonaws.services.s3.model.SetBucketPolicyRequest; +import com.walker.file.DefaultFileInfo; +import com.walker.file.FileInfo; +import com.walker.file.FileOperateException; +import com.walker.file.FileStoreType; +import com.walker.infrastructure.utils.Base64; +import com.walker.infrastructure.utils.JsonUtils; +import com.walker.infrastructure.utils.StringUtils; + +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Arrays; +import java.util.Calendar; + +/** + * 浜氶┈閫奡3 OSS 瀹炵幇銆� + * + * @author 鏃跺厠鑻� + * @date 2023-12-12 + */ +public class AwsOssFileEngine extends AbstractOssFileEngine { + + public AwsOssFileEngine() { + } + + @Override + protected void executeUpload(InputStream inputStream, FileInfo fileInfo) throws FileOperateException { + //鍒濆鍖栧璞″厓鏁版嵁 + ObjectMetadata metadata = new ObjectMetadata(); + // metadata.setContentType("plain/text"); + AmazonS3 client = this.acquireOneClient(); + + try { + String fileNameBase64 = new String(Base64.encode(fileInfo.getFileName().getBytes(StringUtils.DEFAULT_CHARSET_UTF8))); + metadata.addUserMetadata("x-amz-meta-title", fileNameBase64); + metadata.setContentLength(fileInfo.getFileSize()); + //璁剧疆瀵硅薄鍏冩暟鎹� + String objectKey = fileInfo.getId(); + logger.debug("鍑嗗涓婁紶鏂囦欢 objectKey = {}", objectKey); +// String objectKey = createFileOssPath(fileInfo.getId(), fileInfo.getFileExt()); + PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, objectKey, inputStream, metadata); +// PutObjectResult result = amazonS3Client.putObject(putObjectRequest); + PutObjectResult result = client.putObject(putObjectRequest); + + System.out.println(JsonUtils.objectToJsonString(result)); + StringBuilder url = new StringBuilder(); + url.append(objectKey); + +// ((DefaultFileInfo) fileInfo).setFileSize(result.getMetadata().getContentLength()); + ((DefaultFileInfo) fileInfo).setUrl(url.toString()); + + } catch (Exception var11) { + throw new FileOperateException("淇濆瓨鏂囦欢鍒般�恛ss銆戦敊璇�:" + var11.getMessage() + ", id=" + fileInfo.getId(), var11); + } finally { + if(client != null){ + client.shutdown(); + } + } + } + + @Override + protected byte[] executeDownload(FileInfo fileInfo) throws FileOperateException { +// throw new IllegalAccessError("涓嶈兘璋冪敤OSS涓嬭浇鏂规硶锛岃璁块棶绗笁鏂归摼鎺�"); + + AmazonS3 client = this.acquireOneClient(); + S3ObjectInputStream objectContent = null; + ByteArrayOutputStream fileOutputStream = null; + try { + //涓嬭浇瀵硅薄 + S3Object object = client.getObject(bucketName, fileInfo.getId()); + //鑾峰彇瀵硅薄娴� + objectContent = object.getObjectContent(); + //鍒濆鍖栨枃浠惰緭鍑烘祦 +// FileOutputStream fileOutputStream = new FileOutputStream(new File(file_path)); + fileOutputStream = new ByteArrayOutputStream(); + + byte[] readbuf = new byte[1024 * 20]; + int read_len = 0; + while ((read_len = objectContent.read(readbuf)) > 0) { + //瀵硅薄涓嬭浇瀛楄妭鍐欏叆鏂囦欢杈撳嚭娴� + fileOutputStream.write(readbuf, 0, read_len); + } + return fileOutputStream.toByteArray(); + + } catch (Exception ex) { + throw new FileOperateException("涓嬭浇鏂囦欢閿欒锛�" + ex.getMessage() + ", fileId=" + fileInfo.getId(), ex); + } finally { + //鍏抽棴娴� + try { + if(objectContent != null){ + objectContent.close(); + } +// if(fileOutputStream != null){ +// fileOutputStream.close(); +// } + if(client != null){ + client.shutdown(); + } + } catch (IOException e) { +// throw new RuntimeException(e); + logger.error("杩欓噷涓嶉渶瑕佹姏鍑哄紓甯革紝浠呯敤浜庤皟璇曠煡閬撴祦娌℃湁琚叧闂嵆鍙��", e); + } + } + } + + @Override + public FileStoreType getFileStoreType() { + return FileStoreType.OssAws; + } + + @Override + public void close() { + super.close(); + this.closeAmazonS3Client(); + } + + private AmazonS3 acquireOneClient(){ + AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey); + ClientConfiguration clientConfiguration = new ClientConfiguration(); + + if (endpoint.contains("https")) { + clientConfiguration.setProtocol(Protocol.HTTPS); +// logger.error("===================> HTTPS "); + } else { + clientConfiguration.setProtocol(Protocol.HTTP); +// logger.error("===================> HTTP "); + } + return AmazonS3ClientBuilder.standard() + .withClientConfiguration(clientConfiguration) + .withEndpointConfiguration( + new AwsClientBuilder.EndpointConfiguration(this.endpoint, Regions.DEFAULT_REGION.getName())) + .withCredentials(new AWSStaticCredentialsProvider(credentials)) + .build(); + +// AmazonS3 amazonS3Client = new AmazonS3Client(credentials, clientConfiguration); +// amazonS3Client.setEndpoint(endpoint); +// amazonS3Client.setS3ClientOptions(S3ClientOptions.builder().setPathStyleAccess(true).disableChunkedEncoding().build()); +// return amazonS3Client; + } + + /** + * 鍒濆鍖朼mazonS3Client + * @author 鏃跺厠鑻� + * @date 2024-02-02 浣跨敤澶氫緥锛屾棤闇�鍒濆鍖栵紝搴熷純鏂规硶銆� + */ + @Deprecated + public void initS3Client() { + logger.warn("涓嶅啀浣跨敤鍗曚緥锛屾棤闇�鍒濆鍖栵紝姣忔涓婁紶涓嬭浇浼氬垱寤烘柊瀹㈡埛绔繛鎺�!"); +// AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey); //鍒涘缓AWS鍑瘉 +// ClientConfiguration connconfig = new ClientConfiguration(); //鍒濆鍖栧鎴风config +// connconfig.setProtocol(Protocol.HTTP); //璁剧疆mos 璇锋眰鍗忚涓篽ttp +// +// //浣跨敤AWS鍑瘉鍜宑lientConfiguration鍒濆鍖朅mazonS3Client瀹㈡埛绔� +// amazonS3Client = new AmazonS3Client(credentials, connconfig); +// amazonS3Client.setEndpoint(endpoint); ////璁剧疆mos瀵硅薄鏈嶅姟鎺ュ彛鍦板潃 +// amazonS3Client.setS3ClientOptions(S3ClientOptions.builder().setPathStyleAccess(true).disableChunkedEncoding().build()); + + +// AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey); +// ClientConfiguration clientConfiguration = new ClientConfiguration(); +// +// if (endpoint.contains("https")) { +// clientConfiguration.setProtocol(Protocol.HTTPS); +// logger.error("===================> HTTPS "); +// } else { +// clientConfiguration.setProtocol(Protocol.HTTP); +// logger.error("===================> HTTP "); +// } +// +// AwsClientBuilder.EndpointConfiguration endpointConfiguration = new AwsClientBuilder.EndpointConfiguration(endpoint, "beijing1"); +// AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(credentials); +// +// +// amazonS3Client = AmazonS3ClientBuilder.standard() +// .withEndpointConfiguration(endpointConfiguration) +// .withCredentials(credentialsProvider).build(); +//// amazonS3Client = new AmazonS3Client(credentials, clientConfiguration); +//// amazonS3Client.setEndpoint(endpoint); +//// amazonS3Client.setS3ClientOptions(S3ClientOptions.builder().setPathStyleAccess(true).disableChunkedEncoding().build()); + + +// AWSCredentials credentials = new BasicAWSCredentials(accessKey, secretKey); +// ClientConfiguration clientConfiguration = new ClientConfiguration(); +// +// if (endpoint.contains("https")) { +// clientConfiguration.setProtocol(Protocol.HTTPS); +//// logger.error("===================> HTTPS "); +// } else { +// clientConfiguration.setProtocol(Protocol.HTTP); +//// logger.error("===================> HTTP "); +// } + // 璁剧疆鍏佽鎵撳紑鐨勬渶澶� HTTP 杩炴帴鏁帮紝榛樿涓� 50 涓紝姝ょず渚嬩唬鐮佽缃负 100 涓�� +// clientConfiguration.setMaxConnections(100 * 2); +// // 璁剧疆 Socket 灞備紶杈撴暟鎹殑瓒呮椂鏃堕棿锛堝崟浣嶏細姣锛夛紝榛樿涓� 50000 姣锛屾绀轰緥浠g爜璁剧疆涓� 60000 姣銆� +// clientConfiguration.setSocketTimeout(60000 * 2); +// // 璁剧疆寤虹珛杩炴帴鐨勮秴鏃舵椂闂达紙鍗曚綅锛氭绉掞級锛岄粯璁や负 10000 姣锛屾绀轰緥浠g爜璁剧疆涓� 5000 姣銆� +// clientConfiguration.setConnectionTimeout(5000 * 2); +// // 璁剧疆绛夊緟璇锋眰瀹屾垚鐨勮秴鏃舵椂闂达紙鍗曚綅锛氭绉掞級銆傞粯璁や笉瓒呮椂锛�0锛夛紝姝ょず渚嬩唬鐮佽缃负 60000 姣銆� +// clientConfiguration.setRequestTimeout(60000 * 2); +// // 璁剧疆瀹㈡埛绔姹傛墽琛岃秴鏃舵椂闂达紙鍗曚綅锛氭绉掞級銆傞粯璁や笉瓒呮椂锛�0锛夛紝姝ょず渚嬩唬鐮佽缃负 60000 姣銆� +// clientConfiguration.setClientExecutionTimeout(60000 * 2); +// // 璁剧疆杩炴帴绌洪棽瓒呮椂鏃堕棿銆傝秴鏃跺垯鍏抽棴杩炴帴锛岄粯璁や负 60000 姣锛屾绀轰緥浠g爜璁剧疆涓� 90000 姣銆� +//// clientConfiguration.setConnectionMaxIdleMillis(90000 * 2); +// // 璁剧疆璇锋眰澶辫触鍚庢渶澶х殑閲嶈瘯娆℃暟锛岄粯璁� 3 娆★紝姝ょず渚嬩唬鐮佽缃负 5 娆°�� +// clientConfiguration.setMaxErrorRetry(5); + // 璁剧疆杩炴帴 EOS 鎵�浣跨敤鐨勫崗璁紙HTTP 鎴� HTTPS锛夛紝榛樿涓� HTTPS锛屾绀轰緥浠g爜璁剧疆涓� HTTP銆� +// clientConfiguration.setProtocol(Protocol.HTTP); + // 璁剧疆鐢ㄦ埛浠g悊鍓嶇紑锛屽嵆 HTTP 鐨� User-Agent 澶寸殑鍓嶇紑锛屾绀轰緥浠g爜璁剧疆涓� "EOS S3 Java SDK"銆� +// clientConfiguration.setUserAgentPrefix("EOS S3 Java SDK"); + // 璁剧疆鐢ㄦ埛浠g悊鍚庣紑锛屽嵆 HTTP 鐨� User-Agent 澶寸殑鍚庣紑锛屾绀轰緥浠g爜璁剧疆涓� "1.12.378"銆� +// clientConfiguration.setUserAgentSuffix("1.12.378"); + // 璁剧疆绛惧悕绠楁硶锛岄粯璁や负 v4 绛惧悕銆傛绀轰緥浠g爜璁剧疆涓� S3SignerType锛屽嵆閲囩敤 v2 绛惧悕銆� +// clientConfiguration.setSignerOverride("S3SignerType"); + + // 2024-02-02锛屼笉鐢ㄥ崟渚嬶紝浣跨敤澶氫緥鍗筹細姣忔璋冪敤鍒涘缓瀹㈡埛绔柟寮忥紒 +// amazonS3Client = new AmazonS3Client(credentials, clientConfiguration); +// amazonS3Client.setEndpoint(endpoint); +// amazonS3Client.setS3ClientOptions(S3ClientOptions.builder().setPathStyleAccess(true).disableChunkedEncoding().build()); + } + + /** + * 瀵瑰簲MOS JAVA SDK鏂囨。4.3.6绔犺妭 璁剧疆瀛樺偍妗剁瓥鐣� + */ + @Deprecated + public void setBucketPolicy() throws IOException { +// List<String> readLines = Files.readLines(new File("policy.txt"), Charset.forName("utf8")); +// StringBuilder sb = new StringBuilder(); +// for(String str : readLines) +// { +// sb.append(str); +// } +// System.out.println(sb.toString()); +// +// //policy 淇℃伅鏌ョ湅椤圭洰鏍圭洰褰� policy.txt鏂囦欢 +// String policy = sb.toString(); +// amazonS3Client.setBucketPolicy(bucket_name, policy); + + //閫氳繃Policy绫绘瀯寤烘《绛栫暐 + Policy bucket_policy = new Policy().withStatements(new Statement( + Statement.Effect.Allow) + .withPrincipals(Principal.AllUsers) + .withActions(S3Actions.GetObject) + .withResources( + new Resource("arn:aws:s3:::" + bucketName + "/*"))); + + SetBucketPolicyRequest setBucketPolicyRequest = new SetBucketPolicyRequest(bucketName, bucket_policy.toJson()); + + //璁剧疆妗剁瓥鐣� +// amazonS3Client.setBucketPolicy(setBucketPolicyRequest); + } + + @Deprecated + public void configBucketCors() { + // 閰嶇疆璺ㄥ煙璁块棶绛栫暐 + BucketCrossOriginConfiguration conf = new BucketCrossOriginConfiguration() + .withRules( + new CORSRule() + .withId("1")// 閰嶇疆瑙勫垯 ID + .withAllowedHeaders(Arrays.asList("*")) // 璺ㄥ煙璇锋眰鍙互浣跨敤鐨� HTTP 璇锋眰澶撮儴锛屾敮鎸侀�氶厤绗� * + .withAllowedMethods(Arrays.asList(CORSRule.AllowedMethods.GET, CORSRule.AllowedMethods.PUT))// 璺ㄥ煙璇锋眰鍏佽鐨� HTTP 鎿嶄綔锛屼緥濡傦細GET锛孭UT锛孒EAD锛孭OST锛孌ELETE +// .withAllowedOrigins(Arrays.asList("http://www.example1.com"))// 鍏佽鐨勮闂潵婧愶紝鏀寔閫氶厤绗� *锛屾牸寮忎负锛氬崗璁�://鍩熷悕[:绔彛] +// .withMaxAgeSeconds(30)// 璺ㄥ煙璇锋眰寰楀埌缁撴灉鐨勬湁鏁堟湡 + ); +// SetBucketCrossOriginConfigurationRequest req = new SetBucketCrossOriginConfigurationRequest("bkt", conf); +// amazonS3Client.setBucketCrossOriginConfiguration(req); + + // 鍒犻櫎璺ㄥ煙璁块棶绛栫暐 +// amazonS3Client.deleteBucketCrossOriginConfiguration("1"); + } + + /** + * 鍏抽棴amazonS3Client + */ + private void closeAmazonS3Client() { +// if (this.amazonS3Client != null) { +// amazonS3Client.shutdown(); //鍏抽棴瀹㈡埛绔� +// } + } + + public byte[] testDownload(String fileId){ + DefaultFileInfo fileInfo = new DefaultFileInfo(); + fileInfo.setId(fileId); + try { + return this.executeDownload(fileInfo); + } catch (FileOperateException e) { + throw new RuntimeException("涓嬭浇oss鏂囦欢鎶ラ敊锛�" + e.getMessage() + ", fileId=" + fileId, e); + } + } + + public void setAccessKey(String accessKey) { + this.accessKey = accessKey; + } + + public void setSecretKey(String secretKey) { + this.secretKey = secretKey; + } + + public void setEndpoint(String endpoint) { + this.endpoint = endpoint; + } + + public void setBucketName(String bucketName) { + this.bucketName = bucketName; + } + + public void setProtocol(Protocol protocol) { + this.protocol = protocol; + } + + private String bucketName = "ctoms-file"; + public String endpoint = "http://10.2.36.9:8080"; + private String accessKey = "4XJOR8RXEWWRVV8N4HOC"; + private String secretKey = "1Dp2ua3lcCocEQJMf1VtHBABPfpkUxF4gGE3xacW"; + private Protocol protocol = Protocol.HTTP; + +// private AmazonS3 amazonS3Client; + + public String createFileOssPath(String fileId, String ext) { + Calendar ca = Calendar.getInstance(); + String year = ca.get(Calendar.YEAR) + ""; + String mon = ca.get(Calendar.MONTH) + 1 + ""; + String day = ca.get(Calendar.DAY_OF_MONTH) + ""; + String directory = year + "/" + mon + "/" + day + "/"; +// mkdirFolder(directory); + return fileId + StringUtils.SYMBOL_DOT + ext; + } + + // 涓婁紶鍓嶄笂璁剧疆鏂囦欢澶� + public boolean mkdirFolder(String directory) { + AmazonS3 client = this.acquireOneClient(); + PutObjectResult putObjectResult = client.putObject(bucketName, directory, new ByteArrayInputStream(new byte[0]), null); + return putObjectResult != null; + } +} diff --git a/iplatform-file-server/src/main/java/com/iplatform/file/support/DefaultFileSystemEngine.java b/iplatform-file-server/src/main/java/com/iplatform/file/support/DefaultFileSystemEngine.java new file mode 100644 index 0000000..d7a166c --- /dev/null +++ b/iplatform-file-server/src/main/java/com/iplatform/file/support/DefaultFileSystemEngine.java @@ -0,0 +1,34 @@ +package com.iplatform.file.support; + +import com.iplatform.file.FileStoreCallback; +import com.walker.file.FileInfo; +import com.walker.file.fs.FileSystemOperateEngine; + +import java.util.List; + +public class DefaultFileSystemEngine extends FileSystemOperateEngine { + + @Override + protected void writeFileInfo(FileInfo fileInfo) { + if(this.fileStoreCallback == null){ + throw new IllegalArgumentException("FileStoreCallback 蹇呴』璁剧疆!"); + } + this.fileStoreCallback.onCallback(fileInfo, this.getFileStoreType()); + } + + public void setFileStoreCallback(FileStoreCallback fileStoreCallback) { + this.fileStoreCallback = fileStoreCallback; + } + + private FileStoreCallback fileStoreCallback = null; + + @Override + public FileInfo getFileInfo(String id) { + return this.fileStoreCallback.onAcquireFileInfo(id); + } + + @Override + public List<FileInfo> getFileInfoList(List<String> ids) { + return this.fileStoreCallback.onAcquireFileInfoList(ids); + } +} diff --git a/iplatform-file-server/src/main/java/com/iplatform/file/support/DefaultFtpFileEngine.java b/iplatform-file-server/src/main/java/com/iplatform/file/support/DefaultFtpFileEngine.java new file mode 100644 index 0000000..87fc032 --- /dev/null +++ b/iplatform-file-server/src/main/java/com/iplatform/file/support/DefaultFtpFileEngine.java @@ -0,0 +1,39 @@ +package com.iplatform.file.support; + +import com.iplatform.file.FileStoreCallback; +import com.walker.file.FileInfo; +import com.walker.file.ftp.FtpFileOperateEngine; + +import java.util.List; + +/** + * 榛樿閫氳繃JDBC鏂瑰紡淇濆瓨鏂囦欢鍏冩暟鎹殑(FTP)寮曟搸瀹炵幇銆� + * @author 鏃跺厠鑻� + * @date 2023-02-12 + */ +public class DefaultFtpFileEngine extends FtpFileOperateEngine { + + @Override + protected void writeFileInfo(FileInfo fileInfo) { + if(this.fileStoreCallback == null){ + throw new IllegalArgumentException("FileStoreCallback 蹇呴』璁剧疆!"); + } + this.fileStoreCallback.onCallback(fileInfo, this.getFileStoreType()); + } + + public void setFileStoreCallback(FileStoreCallback fileStoreCallback) { + this.fileStoreCallback = fileStoreCallback; + } + + private FileStoreCallback fileStoreCallback = null; + + @Override + public FileInfo getFileInfo(String id) { + return this.fileStoreCallback.onAcquireFileInfo(id); + } + + @Override + public List<FileInfo> getFileInfoList(List<String> ids) { + return this.fileStoreCallback.onAcquireFileInfoList(ids); + } +} diff --git a/iplatform-file-server/src/main/java/com/iplatform/file/support/JdbcCallback.java b/iplatform-file-server/src/main/java/com/iplatform/file/support/JdbcCallback.java new file mode 100644 index 0000000..29ac0d5 --- /dev/null +++ b/iplatform-file-server/src/main/java/com/iplatform/file/support/JdbcCallback.java @@ -0,0 +1,124 @@ +package com.iplatform.file.support; + +import com.iplatform.base.util.UserUtils; +import com.iplatform.file.FileStoreCallback; +import com.iplatform.file.service.FileServiceImpl; +import com.iplatform.model.po.S_file; +import com.iplatform.model.po.S_file_mapper; +import com.walker.file.DefaultFileInfo; +import com.walker.file.FileInfo; +import com.walker.file.FileStoreType; +import com.walker.infrastructure.utils.DateUtils; +import com.walker.infrastructure.utils.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.jdbc.core.namedparam.MapSqlParameterSource; + +import java.util.ArrayList; +import java.util.List; + +/** + * 閫氳繃鏁版嵁搴撳啓鍏ヤ笂浼犵殑鏂囦欢璁板綍銆� + * @author 鏃跺厠鑻� + * @date 2023-02-14 + * @date 2023-06-05 浣跨敤鏂伴檮浠惰〃锛坰f_attachment锛夛紝鍙傝�冿細{@linkplain AttachmentJdbcCallback} + */ +@Deprecated +public class JdbcCallback implements FileStoreCallback { + + protected final transient Logger logger = LoggerFactory.getLogger(getClass()); + + @Override + public void onCallback(FileInfo fileInfo, FileStoreType fileStoreType) { + if(logger.isDebugEnabled()){ + logger.debug("淇濆瓨鏂囦欢:{}", fileInfo); + } + S_file s_file = new S_file(); + s_file.setId(Long.parseLong(fileInfo.getId())); + s_file.setCreate_time(DateUtils.getDateTimeNumber(System.currentTimeMillis())); + s_file.setUser_name(UserUtils.getUserInfo().getUser_name()); + s_file.setFile_name(fileInfo.getFileName()); + s_file.setFile_ext(fileInfo.getFileExt()); + s_file.setContent_type(""); + s_file.setFile_path(fileInfo.getUrl()); + s_file.setFile_size(fileInfo.getFileSize()); + s_file.setFile_store_type(fileStoreType.getIndex()); + if(StringUtils.isNotEmpty(fileInfo.getGroupId())){ + s_file.setGroup_id(fileInfo.getGroupId()); + } + this.fileService.insert(s_file); + +// String fileExt = fileInfo.getFileExt(); +// +// SfAttachment attachment = new SfAttachment(); +// attachment.setAttId(Long.parseLong(fileInfo.getId())); +// attachment.setCreateTime(DateUtils.getDateTimeNumber()); +// attachment.setUpdateTime(attachment.getCreateTime()); +// attachment.setUserName(UserUtils.getUserInfo().getUser_name()); +// attachment.setName(fileInfo.getFileName()); +// attachment.setSattDir(fileInfo.getUrl()); +// attachment.setAttType(fileExt); // 杩欓噷鐩墠鏄悗缂�鍚嶏紝鍚庣画鍙弬鑰冪數鍟嗙郴缁熷瓨鏀�:mimeType +// attachment.setAttSize(fileInfo.getFileSize()); +// attachment.setFileStoreType(fileStoreType.getIndex()); +// if(StringUtils.isNotEmpty(fileInfo.getGroupId())){ +// attachment.setGroupId(fileInfo.getGroupId()); +// } +// if(ImageUtils.isImage(fileExt) || ImageUtils.isVideo(fileExt)){ +// // 鏆傛椂瀛樻斁涓�1锛岃〃绀哄獟浣撴牸寮� +// attachment.setImageType(1); +// } else { +// // 闈炲獟浣撴牸寮� +// attachment.setImageType(0); +// } +// // pid 鍜� owner 闇�瑕佷紶杩囨潵 +// attachment.setPid(0); +// attachment.setOwner(-1); +// this.fileService.insert(attachment); + } + + @Override + public FileInfo onAcquireFileInfo(String id) { + S_file s_file = this.fileService.get(new S_file(Long.parseLong(id))); + return toFileInfo(s_file); + } + + @Override + public List<FileInfo> onAcquireFileInfoList(List<String> ids) { + if(StringUtils.isEmptyList(ids)){ + return null; + } + MapSqlParameterSource sqlParameterSource = new MapSqlParameterSource(); + sqlParameterSource.addValue("ids", ids); + List<S_file> list = this.fileService.sqlListObjectWhereIn("select * from s_file where id in(:ids)" + , S_file_mapper.ROW_MAPPER, sqlParameterSource); + if(StringUtils.isEmptyList(list)){ + return null; + } + List<FileInfo> fileInfoList = new ArrayList<>(list.size()); + for(S_file s_file : list){ + fileInfoList.add(this.toFileInfo(s_file)); + } + return fileInfoList; + } + + private FileInfo toFileInfo(S_file s_file){ + if(s_file == null){ + return null; + } + DefaultFileInfo fileInfo = new DefaultFileInfo(); + fileInfo.setId(String.valueOf(s_file.getId())); + fileInfo.setFileSize(s_file.getFile_size()); + fileInfo.setUrl(s_file.getFile_path()); + fileInfo.setFileExt(s_file.getFile_ext()); + fileInfo.setFileName(s_file.getFile_name()); + fileInfo.setFileStoreType(FileStoreType.getType(s_file.getFile_store_type())); + fileInfo.setGroupId(s_file.getGroup_id()); + return fileInfo; + } + + public void setFileService(FileServiceImpl fileService) { + this.fileService = fileService; + } + + private FileServiceImpl fileService; +} diff --git a/iplatform-file-server/src/main/java/com/iplatform/file/support/QnOssFileEngine.java b/iplatform-file-server/src/main/java/com/iplatform/file/support/QnOssFileEngine.java new file mode 100644 index 0000000..19e6395 --- /dev/null +++ b/iplatform-file-server/src/main/java/com/iplatform/file/support/QnOssFileEngine.java @@ -0,0 +1,53 @@ +package com.iplatform.file.support; + +import com.walker.file.FileInfo; +import com.walker.file.FileOperateException; +import com.walker.file.FileStoreType; + +import java.io.InputStream; + +/** + * 涓冪墰浜� OSS 瀹炵幇锛屾殏鏃舵病鏈夊畬鎴愪唬鐮併�� + * @author 鏃跺厠鑻� + * @date 2023-06-09 + */ +public class QnOssFileEngine extends AbstractOssFileEngine { + + public QnOssFileEngine(){} + +// @Override +// protected FileInfo acquireFileInfo(String fileName) { +// return new DefaultFileInfo(); +// } + + @Override + protected void executeUpload(InputStream inputStream, FileInfo fileInfo) throws FileOperateException { + logger.info("鏆傛湭瀹炵幇涓冪墰OSS鏂囦欢涓婁紶閫昏緫"); + // 寮曞叆鐩稿叧SDK锛屾墽琛屼笂浼犳搷浣� + throw new UnsupportedOperationException("鏆傛湭瀹炵幇涓冪墰OSS"); + } + +// @Override +// protected void writeFileInfo(FileInfo fileInfo) { +// this.fileStoreCallback.onCallback(fileInfo, this.getFileStoreType()); +// } + + @Override + protected byte[] executeDownload(FileInfo fileInfo) throws FileOperateException { + throw new UnsupportedOperationException("鏃犻渶鎵цOSS鏂囦欢涓嬭浇瀹炵幇锛屼娇鐢ㄧ涓夋柟閾炬帴鍗冲彲"); + } + +// @Override +// public FileInfo getFileInfo(String id) { +// return null; +// } +// @Override +// public List<FileInfo> getFileInfoList(List<String> ids) { +// return null; +// } + + @Override + public FileStoreType getFileStoreType() { + return FileStoreType.OssQiNiu; + } +} diff --git a/iplatform-file-server/src/main/java/com/iplatform/file/support/TxOssFileEngine.java b/iplatform-file-server/src/main/java/com/iplatform/file/support/TxOssFileEngine.java new file mode 100644 index 0000000..e012aa7 --- /dev/null +++ b/iplatform-file-server/src/main/java/com/iplatform/file/support/TxOssFileEngine.java @@ -0,0 +1,32 @@ +package com.iplatform.file.support; + +import com.walker.file.FileInfo; +import com.walker.file.FileOperateException; +import com.walker.file.FileStoreType; + +import java.io.InputStream; + +/** + * 鑵捐 OSS 瀹炵幇锛屼唬鐮佹湭瀹屾垚銆� + * @author 鏃跺厠鑻� + * @date 2023-06-09 + */ +public class TxOssFileEngine extends AbstractOssFileEngine{ + + public TxOssFileEngine(){} + + @Override + protected void executeUpload(InputStream inputStream, FileInfo fileInfo) throws FileOperateException { + throw new UnsupportedOperationException("鏈疄鐜拌吘璁疧SS涓婁紶浠g爜"); + } + + @Override + protected byte[] executeDownload(FileInfo fileInfo) throws FileOperateException { + throw new IllegalAccessError("涓嶈兘璋冪敤OSS涓嬭浇鏂规硶锛岃璁块棶绗笁鏂归摼鎺�"); + } + + @Override + public FileStoreType getFileStoreType() { + return FileStoreType.OssTx; + } +} diff --git a/iplatform-file-server/src/main/java/com/iplatform/file/util/FileResultUtils.java b/iplatform-file-server/src/main/java/com/iplatform/file/util/FileResultUtils.java new file mode 100644 index 0000000..4cc2f17 --- /dev/null +++ b/iplatform-file-server/src/main/java/com/iplatform/file/util/FileResultUtils.java @@ -0,0 +1,32 @@ +package com.iplatform.file.util; + +import com.iplatform.model.vo.FileResultVo; +import com.walker.file.FileInfo; +import com.walker.infrastructure.utils.StringUtils; + +public class FileResultUtils { + + /** + * 鑾峰彇涓�涓笂浼犳垚鍔熺殑鏂囦欢淇℃伅瀵硅薄銆� + * @param fileInfo + * @param contentType 鏂囦欢濯掍綋绫诲瀷銆� + * @return + * @date 2023-06-09 + */ + public static final FileResultVo acquireFileResultVo(FileInfo fileInfo, String contentType){ + FileResultVo resultFile = new FileResultVo(); + resultFile.setFileSize(fileInfo.getFileSize()); + resultFile.setFileName(fileInfo.getFileName()); + resultFile.setExtName(fileInfo.getFileExt()); + resultFile.setUrl(fileInfo.getUrl()); + resultFile.setType(contentType); + if(ImageUtils.isImage(fileInfo.getFileExt())){ + resultFile.setType(contentType.replace("image/", StringUtils.EMPTY_STRING)); + } else if(ImageUtils.isVideo(fileInfo.getFileExt())){ + resultFile.setType(contentType.replace("video/", StringUtils.EMPTY_STRING)); + } else { + resultFile.setType(contentType.replace("file/", StringUtils.EMPTY_STRING)); + } + return resultFile; + } +} diff --git a/iplatform-file-server/src/main/java/com/iplatform/file/util/FileStoreUtils.java b/iplatform-file-server/src/main/java/com/iplatform/file/util/FileStoreUtils.java new file mode 100644 index 0000000..17ef26e --- /dev/null +++ b/iplatform-file-server/src/main/java/com/iplatform/file/util/FileStoreUtils.java @@ -0,0 +1,51 @@ +package com.iplatform.file.util; + +import com.iplatform.base.ArgumentsConstants; +import com.walker.file.FileStoreType; +import com.walker.infrastructure.utils.StringUtils; +import org.apache.poi.util.StringUtil; + +import java.util.HashMap; +import java.util.Map; + +public class FileStoreUtils { + + /** + * 姣忕瀛樺偍绫诲瀷锛屽搴斾竴涓枃浠惰闂墠缂�銆� + * <pre> + * 1.瀵逛簬鏈湴鏂囦欢鍙兘鏄� --> http://localhost:8082/admin/file/ + * 2.瀵圭涓夋柟OSS鍙兘鏄� --> http://oss.aliyun.com/xxxxx/ + * 3.鍓嶇疆鍦ㄧ郴缁熷弬鏁颁腑缁熶竴閰嶇疆銆� + * 4.绯荤粺鍚姩鏃讹紝鑷姩璁剧疆璇ュ璞°�� + * </pre> + * @date 2023-06-08 + */ + public static final Map<String, String> fileStoreTypeUrlPrefix = new HashMap<>(8); + + /** + * 鏍规嵁瀛樺偍绫诲瀷锛岃繑鍥炲瓨鍌ㄦ枃浠剁殑URL璺緞鍓嶇紑 + * @param fileStoreType 鍙傝�冿細{@linkplain FileStoreType} + * @return 濡傦細http://localhost:8082/admin/file/ + * @date 2023-06-08 + */ + public static final String getFileUrlPrefixKey(String fileStoreType){ + String uploadUrl = StringUtils.EMPTY_STRING; + if(fileStoreType.equals("1") || fileStoreType.equals(FileStoreType.INDEX_FS)){ + uploadUrl = ArgumentsConstants.CONFIG_LOCAL_UPLOAD_URL; + } else if(fileStoreType.equals("2") || fileStoreType.equals(FileStoreType.INDEX_OSS_QI_NIU)){ + uploadUrl = ArgumentsConstants.CONFIG_QN_UPLOAD_URL; + } else if(fileStoreType.equals("3") || fileStoreType.equals(FileStoreType.INDEX_OSS_ALI)){ + uploadUrl = ArgumentsConstants.CONFIG_AL_UPLOAD_URL; + } else if(fileStoreType.equals("4") || fileStoreType.equals(FileStoreType.INDEX_OSS_TX)){ + uploadUrl = ArgumentsConstants.CONFIG_TX_UPLOAD_URL; + } else if(fileStoreType.equals("5") || fileStoreType.equals(FileStoreType.INDEX_OSS_AWS)){ + uploadUrl = ArgumentsConstants.CONFIG_S3_UPLOAD_URL; + } else if(fileStoreType.equals(FileStoreType.INDEX_FTP)){ +// throw new UnsupportedOperationException("ftp瀛樺偍鏂瑰紡鏈缃弬鏁帮紒"); + uploadUrl = ArgumentsConstants.CONFIG_FTP_UPLOAD_URL; + } else { + throw new UnsupportedOperationException("涓嶆敮鎸佺殑涓婁紶绫诲瀷锛�" + fileStoreType); + } + return uploadUrl; + } +} diff --git a/iplatform-file-server/src/main/java/com/iplatform/file/util/ImageUtils.java b/iplatform-file-server/src/main/java/com/iplatform/file/util/ImageUtils.java new file mode 100644 index 0000000..0c9f4dc --- /dev/null +++ b/iplatform-file-server/src/main/java/com/iplatform/file/util/ImageUtils.java @@ -0,0 +1,84 @@ +package com.iplatform.file.util; + +import com.walker.infrastructure.utils.StringUtils; + +import java.util.ArrayList; +import java.util.List; + +/** + * 鍥惧儚濯掍綋宸ュ叿绫汇�� + * @author 鏃跺厠鑻� + * @date 2023-06-02 + */ +public class ImageUtils { + + /** + * 鏍规嵁浼犲叆鐨勬枃浠跺獟浣撶被鍨嬶紝杩斿洖鍙敤鐨勬枃浠跺悗缂�闆嗗悎銆� + * @param attTypes 榛樿鍊硷細png,jpeg,jpg,audio/mpeg,text/plain,video/mp4,gif + * @return + * @date 2023-06-05 + */ + public static final List<String> acquireFileTypeList(String attTypes){ + List<String> resultList = new ArrayList<>(8); + String[] attTypeArray = StringUtils.commaDelimitedListToStringArray(attTypes); + for(String attType : attTypeArray){ + if(attType.equals(CONTENT_TYPE_MEDIA)){ + resultList.add(VIDEO_MPEG); + resultList.add(AUDIO_MP3); + } else if(attType.equals(CONTENT_TYPE_VIDEO)){ + resultList.add(VIDEO_MP4); + } else if(attType.equals(CONTENT_TYPE_TEXT)){ + resultList.add(DOC_TXT); + resultList.add(DOC_WORD); + resultList.add(DOC_EXCEL); + resultList.add(DOC_PDF); + } else { + resultList.add(attType); + } + } + return resultList; + } + + public static final boolean isImage(String fileExt){ + if(StringUtils.isEmpty(fileExt)){ + return false; + } + if(fileExt.indexOf(IMAGE_JPEG) >= 0 + || fileExt.indexOf(IMAGE_JPG) >= 0 + || fileExt.indexOf(IMAGE_PNG) >= 0 + || fileExt.indexOf(IMAGE_GIF) >= 0 + || fileExt.indexOf(IMAGE_BMP) >= 0){ + return true; + } + return false; + } + + public static final boolean isVideo(String fileExt){ + if(StringUtils.isEmpty(fileExt)){ + return false; + } + if(fileExt.indexOf(VIDEO_MP4) >= 0){ + return true; + } + return false; + } + + public static final String IMAGE_JPG = "jpg"; + public static final String IMAGE_JPEG = "jpeg"; + public static final String IMAGE_PNG = "png"; + public static final String IMAGE_GIF = "gif"; + public static final String IMAGE_BMP = "bmp"; + public static final String VIDEO_MP4 = "mp4"; + public static final String VIDEO_MPEG = "mpeg"; + public static final String AUDIO_MP3 = "mp3"; + + public static final String DOC_TXT = "txt"; + public static final String DOC_WORD = "docx"; +// public static final String DOC_WORD2 = "docx"; + public static final String DOC_EXCEL = "xlsx"; + public static final String DOC_PDF = "pdf"; + + public static final String CONTENT_TYPE_MEDIA = "audio/mpeg"; + public static final String CONTENT_TYPE_VIDEO = "video/mp4"; + public static final String CONTENT_TYPE_TEXT = "text/plain"; +} diff --git a/iplatform-file-server/src/main/java/com/iplatform/model/po/S_file.java b/iplatform-file-server/src/main/java/com/iplatform/model/po/S_file.java new file mode 100644 index 0000000..790b0ce --- /dev/null +++ b/iplatform-file-server/src/main/java/com/iplatform/model/po/S_file.java @@ -0,0 +1,310 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BasePo; +import mos.com.fasterxml.jackson.annotation.JsonAutoDetect; +import mos.com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * 琛ㄥ悕:S_FILE * + * @author genrator + */ +@Deprecated +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class S_file extends BasePo<S_file> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + /** + * 鐢ㄤ簬鍏煎鑰佸啓娉� + */ + @JsonIgnore + public static final S_file ROW_MAPPER = new S_file(); + + // 涓婚敭 + private Long id = null; + @JsonIgnore + protected boolean isset_id = false; + + // 灞炴�у垪琛� + private Long create_time = null; + @JsonIgnore + protected boolean isset_create_time = false; + + private String user_name = null; + @JsonIgnore + protected boolean isset_user_name = false; + + private String content_type = null; + @JsonIgnore + protected boolean isset_content_type = false; + + private String file_name = null; + @JsonIgnore + protected boolean isset_file_name = false; + + private String file_ext = null; + @JsonIgnore + protected boolean isset_file_ext = false; + + private String file_path = null; + @JsonIgnore + protected boolean isset_file_path = false; + + private Long file_size = null; + @JsonIgnore + protected boolean isset_file_size = false; + + private String file_store_type = null; + @JsonIgnore + protected boolean isset_file_store_type = false; + + private String group_id = null; + @JsonIgnore + protected boolean isset_group_id = false; + + private String summary = null; + @JsonIgnore + protected boolean isset_summary = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_file() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public S_file(Long id) { + this.setId(id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setId((Long) value); + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + this.isset_id = true; + } + + @JsonIgnore + public boolean isEmptyId() { + return this.id == null; + } + + public Long getCreate_time() { + return this.create_time; + } + + public void setCreate_time(Long create_time) { + this.create_time = create_time; + this.isset_create_time = true; + } + + @JsonIgnore + public boolean isEmptyCreate_time() { + return this.create_time == null; + } + + public String getUser_name() { + return this.user_name; + } + + public void setUser_name(String user_name) { + this.user_name = user_name; + this.isset_user_name = true; + } + + @JsonIgnore + public boolean isEmptyUser_name() { + return this.user_name == null || this.user_name.length() == 0; + } + + public String getContent_type() { + return this.content_type; + } + + public void setContent_type(String content_type) { + this.content_type = content_type; + this.isset_content_type = true; + } + + @JsonIgnore + public boolean isEmptyContent_type() { + return this.content_type == null || this.content_type.length() == 0; + } + + public String getFile_name() { + return this.file_name; + } + + public void setFile_name(String file_name) { + this.file_name = file_name; + this.isset_file_name = true; + } + + @JsonIgnore + public boolean isEmptyFile_name() { + return this.file_name == null || this.file_name.length() == 0; + } + + public String getFile_ext() { + return this.file_ext; + } + + public void setFile_ext(String file_ext) { + this.file_ext = file_ext; + this.isset_file_ext = true; + } + + @JsonIgnore + public boolean isEmptyFile_ext() { + return this.file_ext == null || this.file_ext.length() == 0; + } + + public String getFile_path() { + return this.file_path; + } + + public void setFile_path(String file_path) { + this.file_path = file_path; + this.isset_file_path = true; + } + + @JsonIgnore + public boolean isEmptyFile_path() { + return this.file_path == null || this.file_path.length() == 0; + } + + public Long getFile_size() { + return this.file_size; + } + + public void setFile_size(Long file_size) { + this.file_size = file_size; + this.isset_file_size = true; + } + + @JsonIgnore + public boolean isEmptyFile_size() { + return this.file_size == null; + } + + public String getFile_store_type() { + return this.file_store_type; + } + + public void setFile_store_type(String file_store_type) { + this.file_store_type = file_store_type; + this.isset_file_store_type = true; + } + + @JsonIgnore + public boolean isEmptyFile_store_type() { + return this.file_store_type == null || this.file_store_type.length() == 0; + } + + public String getGroup_id() { + return this.group_id; + } + + public void setGroup_id(String group_id) { + this.group_id = group_id; + this.isset_group_id = true; + } + + @JsonIgnore + public boolean isEmptyGroup_id() { + return this.group_id == null || this.group_id.length() == 0; + } + + public String getSummary() { + return this.summary; + } + + public void setSummary(String summary) { + this.summary = summary; + this.isset_summary = true; + } + + @JsonIgnore + public boolean isEmptySummary() { + return this.summary == null || this.summary.length() == 0; + } + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("id=").append(this.id) + .append("create_time=").append(this.create_time) + .append("user_name=").append(this.user_name) + .append("content_type=").append(this.content_type) + .append("file_name=").append(this.file_name) + .append("file_ext=").append(this.file_ext) + .append("file_path=").append(this.file_path) + .append("file_size=").append(this.file_size) + .append("file_store_type=").append(this.file_store_type) + .append("group_id=").append(this.group_id) + .append("summary=").append(this.summary) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public S_file $clone() { + S_file s_file = new S_file(); + + // 鏁版嵁搴撳悕绉� + //s_file.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_id) { + s_file.setId(this.getId()); + } + // 鏅�氬睘鎬� + if (this.isset_create_time) { + s_file.setCreate_time(this.getCreate_time()); + } + if (this.isset_user_name) { + s_file.setUser_name(this.getUser_name()); + } + if (this.isset_content_type) { + s_file.setContent_type(this.getContent_type()); + } + if (this.isset_file_name) { + s_file.setFile_name(this.getFile_name()); + } + if (this.isset_file_ext) { + s_file.setFile_ext(this.getFile_ext()); + } + if (this.isset_file_path) { + s_file.setFile_path(this.getFile_path()); + } + if (this.isset_file_size) { + s_file.setFile_size(this.getFile_size()); + } + if (this.isset_file_store_type) { + s_file.setFile_store_type(this.getFile_store_type()); + } + if (this.isset_group_id) { + s_file.setGroup_id(this.getGroup_id()); + } + if (this.isset_summary) { + s_file.setSummary(this.getSummary()); + } + return s_file; + } +} diff --git a/iplatform-file-server/src/main/java/com/iplatform/model/po/S_file_mapper.java b/iplatform-file-server/src/main/java/com/iplatform/model/po/S_file_mapper.java new file mode 100644 index 0000000..6d5f8f2 --- /dev/null +++ b/iplatform-file-server/src/main/java/com/iplatform/model/po/S_file_mapper.java @@ -0,0 +1,341 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:S_FILE * + * @author genrator + */ +@Deprecated +public class S_file_mapper extends S_file implements BaseMapper<S_file> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<S_file> ROW_MAPPER = new S_fileRowMapper(); + + // 涓婚敭 + public static final String ID = "id"; + // 鏅�氬睘鎬� + public static final String CREATE_TIME = "create_time"; + public static final String USER_NAME = "user_name"; + public static final String CONTENT_TYPE = "content_type"; + public static final String FILE_NAME = "file_name"; + public static final String FILE_EXT = "file_ext"; + public static final String FILE_PATH = "file_path"; + public static final String FILE_SIZE = "file_size"; + public static final String FILE_STORE_TYPE = "file_store_type"; + public static final String GROUP_ID = "group_id"; + public static final String SUMMARY = "summary"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_file_mapper(S_file s_file) { + if (s_file == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (s_file.isset_id) { + this.setId(s_file.getId()); + } + //鏅�氬睘鎬� + if (s_file.isset_create_time) { + this.setCreate_time(s_file.getCreate_time()); + } + if (s_file.isset_user_name) { + this.setUser_name(s_file.getUser_name()); + } + if (s_file.isset_content_type) { + this.setContent_type(s_file.getContent_type()); + } + if (s_file.isset_file_name) { + this.setFile_name(s_file.getFile_name()); + } + if (s_file.isset_file_ext) { + this.setFile_ext(s_file.getFile_ext()); + } + if (s_file.isset_file_path) { + this.setFile_path(s_file.getFile_path()); + } + if (s_file.isset_file_size) { + this.setFile_size(s_file.getFile_size()); + } + if (s_file.isset_file_store_type) { + this.setFile_store_type(s_file.getFile_store_type()); + } + if (s_file.isset_group_id) { + this.setGroup_id(s_file.getGroup_id()); + } + if (s_file.isset_summary) { + this.setSummary(s_file.getSummary()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(s_file.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "s_file"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return ID; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getId(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(ID, this.getId()); + ib.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ib.set(USER_NAME, this.getUser_name(), this.isset_user_name); + ib.set(CONTENT_TYPE, this.getContent_type(), this.isset_content_type); + ib.set(FILE_NAME, this.getFile_name(), this.isset_file_name); + ib.set(FILE_EXT, this.getFile_ext(), this.isset_file_ext); + ib.set(FILE_PATH, this.getFile_path(), this.isset_file_path); + ib.set(FILE_SIZE, this.getFile_size(), this.isset_file_size); + ib.set(FILE_STORE_TYPE, this.getFile_store_type(), this.isset_file_store_type); + ib.set(GROUP_ID, this.getGroup_id(), this.isset_group_id); + ib.set(SUMMARY, this.getSummary(), this.isset_summary); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(USER_NAME, this.getUser_name(), this.isset_user_name); + ub.set(CONTENT_TYPE, this.getContent_type(), this.isset_content_type); + ub.set(FILE_NAME, this.getFile_name(), this.isset_file_name); + ub.set(FILE_EXT, this.getFile_ext(), this.isset_file_ext); + ub.set(FILE_PATH, this.getFile_path(), this.isset_file_path); + ub.set(FILE_SIZE, this.getFile_size(), this.isset_file_size); + ub.set(FILE_STORE_TYPE, this.getFile_store_type(), this.isset_file_store_type); + ub.set(GROUP_ID, this.getGroup_id(), this.isset_group_id); + ub.set(SUMMARY, this.getSummary(), this.isset_summary); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(USER_NAME, this.getUser_name(), this.isset_user_name); + ub.set(CONTENT_TYPE, this.getContent_type(), this.isset_content_type); + ub.set(FILE_NAME, this.getFile_name(), this.isset_file_name); + ub.set(FILE_EXT, this.getFile_ext(), this.isset_file_ext); + ub.set(FILE_PATH, this.getFile_path(), this.isset_file_path); + ub.set(FILE_SIZE, this.getFile_size(), this.isset_file_size); + ub.set(FILE_STORE_TYPE, this.getFile_store_type(), this.isset_file_store_type); + ub.set(GROUP_ID, this.getGroup_id(), this.isset_group_id); + ub.set(SUMMARY, this.getSummary(), this.isset_summary); + + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(USER_NAME, this.getUser_name(), this.isset_user_name); + ub.set(CONTENT_TYPE, this.getContent_type(), this.isset_content_type); + ub.set(FILE_NAME, this.getFile_name(), this.isset_file_name); + ub.set(FILE_EXT, this.getFile_ext(), this.isset_file_ext); + ub.set(FILE_PATH, this.getFile_path(), this.isset_file_path); + ub.set(FILE_SIZE, this.getFile_size(), this.isset_file_size); + ub.set(FILE_STORE_TYPE, this.getFile_store_type(), this.isset_file_store_type); + ub.set(GROUP_ID, this.getGroup_id(), this.isset_group_id); + ub.set(SUMMARY, this.getSummary(), this.isset_summary); + + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select id, create_time, user_name, content_type, file_name, file_ext, file_path, file_size, file_store_type, group_id, summary from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select id, create_time, user_name, content_type, file_name, file_ext, file_path, file_size, file_store_type, group_id, summary from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public S_file mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public S_file toS_file() { + return super.$clone(); + } +} + +/** + * s_file RowMapper + * + * @author genrator + */ +@Deprecated +class S_fileRowMapper implements RowMapper<S_file> { + + @Override + public S_file mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + S_file s_file = new S_file(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, S_file_mapper.ID); + if (columnIndex > 0) { + s_file.setId(rs.getLong(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, S_file_mapper.CREATE_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_file.setCreate_time(null); + } else { + s_file.setCreate_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_file_mapper.USER_NAME); + if (columnIndex > 0) { + s_file.setUser_name(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_file_mapper.CONTENT_TYPE); + if (columnIndex > 0) { + s_file.setContent_type(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_file_mapper.FILE_NAME); + if (columnIndex > 0) { + s_file.setFile_name(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_file_mapper.FILE_EXT); + if (columnIndex > 0) { + s_file.setFile_ext(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_file_mapper.FILE_PATH); + if (columnIndex > 0) { + s_file.setFile_path(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_file_mapper.FILE_SIZE); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_file.setFile_size(null); + } else { + s_file.setFile_size(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_file_mapper.FILE_STORE_TYPE); + if (columnIndex > 0) { + s_file.setFile_store_type(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_file_mapper.GROUP_ID); + if (columnIndex > 0) { + s_file.setGroup_id(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_file_mapper.SUMMARY); + if (columnIndex > 0) { + s_file.setSummary(rs.getString(columnIndex)); + } + return s_file; + } +} diff --git a/iplatform-file-server/src/main/java/com/iplatform/model/po/SfAttachment.java b/iplatform-file-server/src/main/java/com/iplatform/model/po/SfAttachment.java new file mode 100644 index 0000000..74203a2 --- /dev/null +++ b/iplatform-file-server/src/main/java/com/iplatform/model/po/SfAttachment.java @@ -0,0 +1,376 @@ + +package com.iplatform.model.po; + +import com.walker.jdbc.BasePo; +import mos.com.fasterxml.jackson.annotation.JsonAutoDetect; +import mos.com.fasterxml.jackson.annotation.JsonIgnore; + +/** + * 琛ㄥ悕:SF_ATTACHMENT * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class SfAttachment extends BasePo<SfAttachment> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + /** + * 鐢ㄤ簬鍏煎鑰佸啓娉� + */ + @JsonIgnore + public static final SfAttachment ROW_MAPPER = new SfAttachment(); + + // 涓婚敭 + private Long attId = null; + @JsonIgnore + protected boolean isset_attId = false; + + // 灞炴�у垪琛� + private String name = null; + @JsonIgnore + protected boolean isset_name = false; + + private String attDir = null; + @JsonIgnore + protected boolean isset_attDir = false; + + private String sattDir = null; + @JsonIgnore + protected boolean isset_sattDir = false; + + private Long attSize = null; + @JsonIgnore + protected boolean isset_attSize = false; + + private String attType = null; + @JsonIgnore + protected boolean isset_attType = false; + + private Integer pid = null; + @JsonIgnore + protected boolean isset_pid = false; + + private Integer imageType = null; + @JsonIgnore + protected boolean isset_imageType = false; + + private Integer owner = null; + @JsonIgnore + protected boolean isset_owner = false; + + private Long createTime = null; + @JsonIgnore + protected boolean isset_createTime = false; + + private Long updateTime = null; + @JsonIgnore + protected boolean isset_updateTime = false; + + private String fileStoreType = null; + @JsonIgnore + protected boolean isset_fileStoreType = false; + + private String groupId = null; + @JsonIgnore + protected boolean isset_groupId = false; + + private String userName = null; + @JsonIgnore + protected boolean isset_userName = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public SfAttachment() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public SfAttachment(Long attId) { + this.setAttId(attId); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setAttId((Long) value); + } + + public Long getAttId() { + return this.attId; + } + + public void setAttId(Long attId) { + this.attId = attId; + this.isset_attId = true; + } + + @JsonIgnore + public boolean isEmptyAttId() { + return this.attId == null; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + this.isset_name = true; + } + + @JsonIgnore + public boolean isEmptyName() { + return this.name == null || this.name.length() == 0; + } + + public String getAttDir() { + return this.attDir; + } + + public void setAttDir(String attDir) { + this.attDir = attDir; + this.isset_attDir = true; + } + + @JsonIgnore + public boolean isEmptyAttDir() { + return this.attDir == null || this.attDir.length() == 0; + } + + public String getSattDir() { + return this.sattDir; + } + + public void setSattDir(String sattDir) { + this.sattDir = sattDir; + this.isset_sattDir = true; + } + + @JsonIgnore + public boolean isEmptySattDir() { + return this.sattDir == null || this.sattDir.length() == 0; + } + + public Long getAttSize() { + return this.attSize; + } + + public void setAttSize(Long attSize) { + this.attSize = attSize; + this.isset_attSize = true; + } + + @JsonIgnore + public boolean isEmptyAttSize() { + return this.attSize == null; + } + + public String getAttType() { + return this.attType; + } + + public void setAttType(String attType) { + this.attType = attType; + this.isset_attType = true; + } + + @JsonIgnore + public boolean isEmptyAttType() { + return this.attType == null || this.attType.length() == 0; + } + + public Integer getPid() { + return this.pid; + } + + public void setPid(Integer pid) { + this.pid = pid; + this.isset_pid = true; + } + + @JsonIgnore + public boolean isEmptyPid() { + return this.pid == null; + } + + public Integer getImageType() { + return this.imageType; + } + + public void setImageType(Integer imageType) { + this.imageType = imageType; + this.isset_imageType = true; + } + + @JsonIgnore + public boolean isEmptyImageType() { + return this.imageType == null; + } + + public Integer getOwner() { + return this.owner; + } + + public void setOwner(Integer owner) { + this.owner = owner; + this.isset_owner = true; + } + + @JsonIgnore + public boolean isEmptyOwner() { + return this.owner == null; + } + + public Long getCreateTime() { + return this.createTime; + } + + public void setCreateTime(Long createTime) { + this.createTime = createTime; + this.isset_createTime = true; + } + + @JsonIgnore + public boolean isEmptyCreateTime() { + return this.createTime == null; + } + + public Long getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(Long updateTime) { + this.updateTime = updateTime; + this.isset_updateTime = true; + } + + @JsonIgnore + public boolean isEmptyUpdateTime() { + return this.updateTime == null; + } + + public String getFileStoreType() { + return this.fileStoreType; + } + + public void setFileStoreType(String fileStoreType) { + this.fileStoreType = fileStoreType; + this.isset_fileStoreType = true; + } + + @JsonIgnore + public boolean isEmptyFileStoreType() { + return this.fileStoreType == null || this.fileStoreType.length() == 0; + } + + public String getGroupId() { + return this.groupId; + } + + public void setGroupId(String groupId) { + this.groupId = groupId; + this.isset_groupId = true; + } + + @JsonIgnore + public boolean isEmptyGroupId() { + return this.groupId == null || this.groupId.length() == 0; + } + + public String getUserName() { + return this.userName; + } + + public void setUserName(String userName) { + this.userName = userName; + this.isset_userName = true; + } + + @JsonIgnore + public boolean isEmptyUserName() { + return this.userName == null || this.userName.length() == 0; + } + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("attId=").append(this.attId) + .append("name=").append(this.name) + .append("attDir=").append(this.attDir) + .append("sattDir=").append(this.sattDir) + .append("attSize=").append(this.attSize) + .append("attType=").append(this.attType) + .append("pid=").append(this.pid) + .append("imageType=").append(this.imageType) + .append("owner=").append(this.owner) + .append("createTime=").append(this.createTime) + .append("updateTime=").append(this.updateTime) + .append("fileStoreType=").append(this.fileStoreType) + .append("groupId=").append(this.groupId) + .append("userName=").append(this.userName) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public SfAttachment $clone() { + SfAttachment sf_attachment = new SfAttachment(); + + // 鏁版嵁搴撳悕绉� + //sf_attachment.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_attId) { + sf_attachment.setAttId(this.getAttId()); + } + // 鏅�氬睘鎬� + if (this.isset_name) { + sf_attachment.setName(this.getName()); + } + if (this.isset_attDir) { + sf_attachment.setAttDir(this.getAttDir()); + } + if (this.isset_sattDir) { + sf_attachment.setSattDir(this.getSattDir()); + } + if (this.isset_attSize) { + sf_attachment.setAttSize(this.getAttSize()); + } + if (this.isset_attType) { + sf_attachment.setAttType(this.getAttType()); + } + if (this.isset_pid) { + sf_attachment.setPid(this.getPid()); + } + if (this.isset_imageType) { + sf_attachment.setImageType(this.getImageType()); + } + if (this.isset_owner) { + sf_attachment.setOwner(this.getOwner()); + } + if (this.isset_createTime) { + sf_attachment.setCreateTime(this.getCreateTime()); + } + if (this.isset_updateTime) { + sf_attachment.setUpdateTime(this.getUpdateTime()); + } + if (this.isset_fileStoreType) { + sf_attachment.setFileStoreType(this.getFileStoreType()); + } + if (this.isset_groupId) { + sf_attachment.setGroupId(this.getGroupId()); + } + if (this.isset_userName) { + sf_attachment.setUserName(this.getUserName()); + } + return sf_attachment; + } +} diff --git a/iplatform-file-server/src/main/java/com/iplatform/model/po/SfAttachment_mapper.java b/iplatform-file-server/src/main/java/com/iplatform/model/po/SfAttachment_mapper.java new file mode 100644 index 0000000..a4f3f93 --- /dev/null +++ b/iplatform-file-server/src/main/java/com/iplatform/model/po/SfAttachment_mapper.java @@ -0,0 +1,387 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:SF_ATTACHMENT * + * @author genrator + */ +public class SfAttachment_mapper extends SfAttachment implements BaseMapper<SfAttachment> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<SfAttachment> ROW_MAPPER = new SfAttachmentRowMapper(); + + // 涓婚敭 + public static final String AttId = "att_id"; + // 鏅�氬睘鎬� + public static final String Name = "name"; + public static final String AttDir = "att_dir"; + public static final String SattDir = "satt_dir"; + public static final String AttSize = "att_size"; + public static final String AttType = "att_type"; + public static final String Pid = "pid"; + public static final String ImageType = "image_type"; + public static final String Owner = "owner"; + public static final String CreateTime = "create_time"; + public static final String UpdateTime = "update_time"; + public static final String FileStoreType = "file_store_type"; + public static final String GroupId = "group_id"; + public static final String UserName = "user_name"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public SfAttachment_mapper(SfAttachment sfAttachment) { + if (sfAttachment == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (sfAttachment.isset_attId) { + this.setAttId(sfAttachment.getAttId()); + } + //鏅�氬睘鎬� + if (sfAttachment.isset_name) { + this.setName(sfAttachment.getName()); + } + if (sfAttachment.isset_attDir) { + this.setAttDir(sfAttachment.getAttDir()); + } + if (sfAttachment.isset_sattDir) { + this.setSattDir(sfAttachment.getSattDir()); + } + if (sfAttachment.isset_attSize) { + this.setAttSize(sfAttachment.getAttSize()); + } + if (sfAttachment.isset_attType) { + this.setAttType(sfAttachment.getAttType()); + } + if (sfAttachment.isset_pid) { + this.setPid(sfAttachment.getPid()); + } + if (sfAttachment.isset_imageType) { + this.setImageType(sfAttachment.getImageType()); + } + if (sfAttachment.isset_owner) { + this.setOwner(sfAttachment.getOwner()); + } + if (sfAttachment.isset_createTime) { + this.setCreateTime(sfAttachment.getCreateTime()); + } + if (sfAttachment.isset_updateTime) { + this.setUpdateTime(sfAttachment.getUpdateTime()); + } + if (sfAttachment.isset_fileStoreType) { + this.setFileStoreType(sfAttachment.getFileStoreType()); + } + if (sfAttachment.isset_groupId) { + this.setGroupId(sfAttachment.getGroupId()); + } + if (sfAttachment.isset_userName) { + this.setUserName(sfAttachment.getUserName()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(sf_attachment.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "sf_attachment"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return AttId; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getAttId(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(AttId, this.getAttId()); + ib.set(Name, this.getName(), this.isset_name); + ib.set(AttDir, this.getAttDir(), this.isset_attDir); + ib.set(SattDir, this.getSattDir(), this.isset_sattDir); + ib.set(AttSize, this.getAttSize(), this.isset_attSize); + ib.set(AttType, this.getAttType(), this.isset_attType); + ib.set(Pid, this.getPid(), this.isset_pid); + ib.set(ImageType, this.getImageType(), this.isset_imageType); + ib.set(Owner, this.getOwner(), this.isset_owner); + ib.set(CreateTime, this.getCreateTime(), this.isset_createTime); + ib.set(UpdateTime, this.getUpdateTime(), this.isset_updateTime); + ib.set(FileStoreType, this.getFileStoreType(), this.isset_fileStoreType); + ib.set(GroupId, this.getGroupId(), this.isset_groupId); + ib.set(UserName, this.getUserName(), this.isset_userName); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(Name, this.getName(), this.isset_name); + ub.set(AttDir, this.getAttDir(), this.isset_attDir); + ub.set(SattDir, this.getSattDir(), this.isset_sattDir); + ub.set(AttSize, this.getAttSize(), this.isset_attSize); + ub.set(AttType, this.getAttType(), this.isset_attType); + ub.set(Pid, this.getPid(), this.isset_pid); + ub.set(ImageType, this.getImageType(), this.isset_imageType); + ub.set(Owner, this.getOwner(), this.isset_owner); + ub.set(CreateTime, this.getCreateTime(), this.isset_createTime); + ub.set(UpdateTime, this.getUpdateTime(), this.isset_updateTime); + ub.set(FileStoreType, this.getFileStoreType(), this.isset_fileStoreType); + ub.set(GroupId, this.getGroupId(), this.isset_groupId); + ub.set(UserName, this.getUserName(), this.isset_userName); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(Name, this.getName(), this.isset_name); + ub.set(AttDir, this.getAttDir(), this.isset_attDir); + ub.set(SattDir, this.getSattDir(), this.isset_sattDir); + ub.set(AttSize, this.getAttSize(), this.isset_attSize); + ub.set(AttType, this.getAttType(), this.isset_attType); + ub.set(Pid, this.getPid(), this.isset_pid); + ub.set(ImageType, this.getImageType(), this.isset_imageType); + ub.set(Owner, this.getOwner(), this.isset_owner); + ub.set(CreateTime, this.getCreateTime(), this.isset_createTime); + ub.set(UpdateTime, this.getUpdateTime(), this.isset_updateTime); + ub.set(FileStoreType, this.getFileStoreType(), this.isset_fileStoreType); + ub.set(GroupId, this.getGroupId(), this.isset_groupId); + ub.set(UserName, this.getUserName(), this.isset_userName); + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(Name, this.getName(), this.isset_name); + ub.set(AttDir, this.getAttDir(), this.isset_attDir); + ub.set(SattDir, this.getSattDir(), this.isset_sattDir); + ub.set(AttSize, this.getAttSize(), this.isset_attSize); + ub.set(AttType, this.getAttType(), this.isset_attType); + ub.set(Pid, this.getPid(), this.isset_pid); + ub.set(ImageType, this.getImageType(), this.isset_imageType); + ub.set(Owner, this.getOwner(), this.isset_owner); + ub.set(CreateTime, this.getCreateTime(), this.isset_createTime); + ub.set(UpdateTime, this.getUpdateTime(), this.isset_updateTime); + ub.set(FileStoreType, this.getFileStoreType(), this.isset_fileStoreType); + ub.set(GroupId, this.getGroupId(), this.isset_groupId); + ub.set(UserName, this.getUserName(), this.isset_userName); + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select att_id, name, att_dir, satt_dir, att_size, att_type, pid, image_type, owner, create_time, update_time, file_store_type, group_id, user_name from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select att_id, name, att_dir, satt_dir, att_size, att_type, pid, image_type, owner, create_time, update_time, file_store_type, group_id, user_name from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public SfAttachment mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public SfAttachment toSfAttachment() { + return super.$clone(); + } +} + +/** + * sf_attachment RowMapper + * + * @author genrator + */ +class SfAttachmentRowMapper implements RowMapper<SfAttachment> { + + @Override + public SfAttachment mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + SfAttachment sf_attachment = new SfAttachment(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, SfAttachment_mapper.AttId); + if (columnIndex > 0) { + sf_attachment.setAttId(rs.getLong(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, SfAttachment_mapper.Name); + if (columnIndex > 0) { + sf_attachment.setName(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, SfAttachment_mapper.AttDir); + if (columnIndex > 0) { + sf_attachment.setAttDir(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, SfAttachment_mapper.SattDir); + if (columnIndex > 0) { + sf_attachment.setSattDir(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, SfAttachment_mapper.AttSize); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + sf_attachment.setAttSize(null); + } else { + sf_attachment.setAttSize(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, SfAttachment_mapper.AttType); + if (columnIndex > 0) { + sf_attachment.setAttType(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, SfAttachment_mapper.Pid); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + sf_attachment.setPid(null); + } else { + sf_attachment.setPid(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, SfAttachment_mapper.ImageType); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + sf_attachment.setImageType(null); + } else { + sf_attachment.setImageType(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, SfAttachment_mapper.Owner); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + sf_attachment.setOwner(null); + } else { + sf_attachment.setOwner(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, SfAttachment_mapper.CreateTime); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + sf_attachment.setCreateTime(null); + } else { + sf_attachment.setCreateTime(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, SfAttachment_mapper.UpdateTime); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + sf_attachment.setUpdateTime(null); + } else { + sf_attachment.setUpdateTime(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, SfAttachment_mapper.FileStoreType); + if (columnIndex > 0) { + sf_attachment.setFileStoreType(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, SfAttachment_mapper.GroupId); + if (columnIndex > 0) { + sf_attachment.setGroupId(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, SfAttachment_mapper.UserName); + if (columnIndex > 0) { + sf_attachment.setUserName(rs.getString(columnIndex)); + } + return sf_attachment; + } +} diff --git a/iplatform-file-server/src/main/java/com/iplatform/model/vo/FileResultVo.java b/iplatform-file-server/src/main/java/com/iplatform/model/vo/FileResultVo.java new file mode 100644 index 0000000..72a0b5c --- /dev/null +++ b/iplatform-file-server/src/main/java/com/iplatform/model/vo/FileResultVo.java @@ -0,0 +1,75 @@ +package com.iplatform.model.vo; + +import java.io.Serializable; + +public class FileResultVo implements Serializable { + + public String getFileName() { + return fileName; + } + + public void setFileName(String fileName) { + this.fileName = fileName; + } + + public String getExtName() { + return extName; + } + + public void setExtName(String extName) { + this.extName = extName; + } + + public Long getFileSize() { + return fileSize; + } + + public void setFileSize(Long fileSize) { + this.fileSize = fileSize; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + // 鏂囦欢鍚� + private String fileName; + + // 鎵╁睍鍚� + private String extName; + + // 鏂囦欢澶у皬锛屽瓧鑺� + private Long fileSize; + + // 鏂囦欢瀛樺偍鍦ㄦ湇鍔″櫒鐨勭浉瀵瑰湴鍧� +// private String serverPath; + + //鍙緵璁块棶鐨剈rl 鍩熷悕鏍规嵁閰嶇疆瀛樺偍锛屼唬鏇夸簡涓婇潰serverPath 鐨勫姛鑳� + private String url; + + //绫诲瀷 + private String type; + + @Override + public String toString() { + return "FileResultVo{" + + "fileName='" + fileName + '\'' + + ", extName='" + extName + '\'' + + ", fileSize=" + fileSize + + ", url='" + url + '\'' + + ", type='" + type + '\'' + + '}'; + } +} diff --git a/iplatform-file-server/src/test/java/com/iplatform/file/TestOss.java b/iplatform-file-server/src/test/java/com/iplatform/file/TestOss.java new file mode 100644 index 0000000..3d0d0dc --- /dev/null +++ b/iplatform-file-server/src/test/java/com/iplatform/file/TestOss.java @@ -0,0 +1,65 @@ +package com.iplatform.file; + +import com.iplatform.file.support.AwsOssFileEngine; +import com.walker.infrastructure.utils.FileCopyUtils; +import org.junit.Test; + +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStream; +import java.util.concurrent.TimeUnit; + +public class TestOss { + + /** + * 2:鍚庝笅杞斤紝鏍规嵁1涓敓鎴愮殑key锛岃幏鍙栨枃浠跺唴瀹� + * @throws Exception + */ +// @Test + public void downloadFile() throws Exception{ + String id = "1064987848085008"; + AwsOssFileEngine engine = this.awsOssFileEngine(); +// byte[] content = engine.downloadFile(id); + byte[] content = engine.testDownload(id); +// FileUtils.writeFile(content, "f:/鍥剧墖/test_oss_down.jpg"); +// FileCopyUtils.copy(content, new File("f:/鍥剧墖/test_oss_down.jpg")); + FileCopyUtils.copy(content, new File("f:/鍥剧墖/corda_1.zip")); + + TimeUnit.SECONDS.sleep(10); + + content = engine.testDownload(id); + FileCopyUtils.copy(content, new File("f:/鍥剧墖/corda_2.zip")); + } + + /** + * 1锛氬厛涓婁紶锛屾帶鍒跺彴鑾峰彇key + * @throws Exception + */ + @Test + public void uploadFile() throws Exception{ + String fileName = "f:/鍥剧墖/3300.jpg_wh1200.jpg"; +// String fileName = "D:/360鏋侀�熸祻瑙堝櫒涓嬭浇/corda-release-os-4.12.zip"; + AwsOssFileEngine engine = this.awsOssFileEngine(); +// engine.uploadFile("f:/鍥剧墖/3300.jpg_wh1200.jpg", null); + InputStream inputStream = new FileInputStream(fileName); + engine.uploadFile(inputStream, "3300.jpg_wh1200.jpg", "", (long)inputStream.available(), 0, "-1"); + + TimeUnit.SECONDS.sleep(5); + + fileName = "D:/360鏋侀�熸祻瑙堝櫒涓嬭浇/corda-release-os-4.12.zip"; + inputStream = new FileInputStream(fileName); + engine.uploadFile(inputStream, "corda-release-os-4.12.zip", "", (long)inputStream.available(), 0, "-1"); + + engine.close(); + } + + private AwsOssFileEngine awsOssFileEngine(){ + AwsOssFileEngine engine = new AwsOssFileEngine(); + engine.setAccessKey("HDKSYC2Y4FELF5CL5FIB"); + engine.setSecretKey("ktf8Px9uTvLFFpQNGsO41ehRsgJ0hWnLtxZnDBCX"); + engine.setEndpoint("http://eos-beijing-1.cmecloud.cn"); + engine.setBucketName("ctoms-file"); + engine.initS3Client(); + return engine; + } +} diff --git a/iplatform-model-pojo/pom.xml b/iplatform-model-pojo/pom.xml new file mode 100644 index 0000000..72c6d44 --- /dev/null +++ b/iplatform-model-pojo/pom.xml @@ -0,0 +1,73 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + <parent> + <artifactId>low-consum-manage</artifactId> + <groupId>com.consum</groupId> + <version>1.0.0-SNAPSHOT</version> + </parent> + <modelVersion>4.0.0</modelVersion> + + <groupId>com.iplatform</groupId> + <artifactId>iplatform-model-pojo</artifactId> + <name>iplatform-model-pojo</name> + <packaging>jar</packaging> + <version>3.2.0</version> + + <properties> + </properties> + + <dependencies> + <dependency> + <groupId>com.iplatform</groupId> + <artifactId>iplatform-core</artifactId> + <version>3.2.0</version> + </dependency> + + <!-- jdbc pojo閫氱敤渚濊禆 --> + <dependency> + <groupId>com.walkersoft</groupId> + <artifactId>walker-jdbc-common</artifactId> + <version>${walker-jdbc-common.version}</version> + <systemPath>${project.basedir}/src/main/resources/lib/walker-jdbc-common-3.2.0.jar</systemPath> + <scope>system</scope> + </dependency> + + <!-- json娉ㄨВ锛氬睘鎬х粦瀹氫緷璧� --> + <dependency> + <groupId>com.fasterxml.jackson.core</groupId> + <artifactId>jackson-databind</artifactId> + </dependency> + + <!-- 渚濊禆浜唖pring RowMapper --> + <dependency> + <groupId>org.springframework</groupId> + <artifactId>spring-jdbc</artifactId> + </dependency> + + <dependency> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-maven-plugin</artifactId> + <version>3.2.11</version> + <configuration> + <!-- 2023-11-06 璇ュ弬鏁版寚瀹氫簡渚濊禆鐨勬湰鍦扮被搴擄紝涓嶅紩鍏ュ垯鎶ラ敊锛氫笉鑳芥寚鍚戞湰鍦癹ar鏂囦欢 --> + <arguments> + <argument>${project.basedir}/src/main/resources/lib</argument> + </arguments> + <!-- 2023-11-06 璇ュ弬鏁版寚瀹氾紝鎵撳寘蹇界暐 Main 鍑芥暟銆�--> + <skip>true</skip> + </configuration> + </plugin> + </plugins> + </build> + +</project> diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_category.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_category.java new file mode 100644 index 0000000..c751d1b --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_category.java @@ -0,0 +1,332 @@ + + +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:S_CATEGORY * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class S_category extends BasePo<S_category> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + /** + * 鐢ㄤ簬鍏煎鑰佸啓娉� + */ + @JsonIgnore + public static final S_category ROW_MAPPER = new S_category(); + + // 涓婚敭 + private Integer id = null; + @JsonIgnore + protected boolean isset_id = false; + + // 灞炴�у垪琛� + private Integer pid = null; + @JsonIgnore + protected boolean isset_pid = false; + + private String path = null; + @JsonIgnore + protected boolean isset_path = false; + + private String name = null; + @JsonIgnore + protected boolean isset_name = false; + + private Integer type = null; + @JsonIgnore + protected boolean isset_type = false; + + private String url = null; + @JsonIgnore + protected boolean isset_url = false; + + private String extra = null; + @JsonIgnore + protected boolean isset_extra = false; + + private Integer status = null; + @JsonIgnore + protected boolean isset_status = false; + + private Integer sort = null; + @JsonIgnore + protected boolean isset_sort = false; + + private Integer owner = null; + @JsonIgnore + protected boolean isset_owner = false; + + private Long create_time = null; + @JsonIgnore + protected boolean isset_create_time = false; + + private Long update_time = null; + @JsonIgnore + protected boolean isset_update_time = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_category() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public S_category(Integer id) { + this.setId(id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setId((Integer) value); + } + + public Integer getId() { + return this.id; + } + public void setId(Integer id) { + this.id = id; + this.isset_id = true; + } + @JsonIgnore + public boolean isEmptyId() { + return this.id == null; + } + + + public Integer getPid() { + return this.pid; + } + public void setPid(Integer pid) { + this.pid = pid; + this.isset_pid = true; + // pid, int + } + @JsonIgnore + public boolean isEmptyPid() { + return this.pid == null; + } + + + public String getPath() { + return this.path; + } + public void setPath(String path) { + this.path = path; + this.isset_path = true; + // path, varchar + } + @JsonIgnore + public boolean isEmptyPath() { + return this.path == null || this.path.length() == 0; + } + + + public String getName() { + return this.name; + } + public void setName(String name) { + this.name = name; + this.isset_name = true; + // name, varchar + } + @JsonIgnore + public boolean isEmptyName() { + return this.name == null || this.name.length() == 0; + } + + + public Integer getType() { + return this.type; + } + public void setType(Integer type) { + this.type = type; + this.isset_type = true; + // type, int + } + @JsonIgnore + public boolean isEmptyType() { + return this.type == null; + } + + + public String getUrl() { + return this.url; + } + public void setUrl(String url) { + this.url = url; + this.isset_url = true; + // url, varchar + } + @JsonIgnore + public boolean isEmptyUrl() { + return this.url == null || this.url.length() == 0; + } + + + public String getExtra() { + return this.extra; + } + public void setExtra(String extra) { + this.extra = extra; + this.isset_extra = true; + // extra, text + } + @JsonIgnore + public boolean isEmptyExtra() { + return this.extra == null || this.extra.length() == 0; + } + + + public Integer getStatus() { + return this.status; + } + public void setStatus(Integer status) { + this.status = status; + this.isset_status = true; + // status, int + } + @JsonIgnore + public boolean isEmptyStatus() { + return this.status == null; + } + + + public Integer getSort() { + return this.sort; + } + public void setSort(Integer sort) { + this.sort = sort; + this.isset_sort = true; + // sort, int + } + @JsonIgnore + public boolean isEmptySort() { + return this.sort == null; + } + + + public Integer getOwner() { + return this.owner; + } + public void setOwner(Integer owner) { + this.owner = owner; + this.isset_owner = true; + // owner, int + } + @JsonIgnore + public boolean isEmptyOwner() { + return this.owner == null; + } + + + public Long getCreate_time() { + return this.create_time; + } + public void setCreate_time(Long create_time) { + this.create_time = create_time; + this.isset_create_time = true; + // create_time, bigint + } + @JsonIgnore + public boolean isEmptyCreate_time() { + return this.create_time == null; + } + + + public Long getUpdate_time() { + return this.update_time; + } + public void setUpdate_time(Long update_time) { + this.update_time = update_time; + this.isset_update_time = true; + // update_time, bigint + } + @JsonIgnore + public boolean isEmptyUpdate_time() { + return this.update_time == null; + } + + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("id=").append(this.id) + .append("pid=").append(this.pid) + .append("path=").append(this.path) + .append("name=").append(this.name) + .append("type=").append(this.type) + .append("url=").append(this.url) + .append("extra=").append(this.extra) + .append("status=").append(this.status) + .append("sort=").append(this.sort) + .append("owner=").append(this.owner) + .append("create_time=").append(this.create_time) + .append("update_time=").append(this.update_time) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public S_category $clone() { + S_category s_category = new S_category(); + + // 鏁版嵁搴撳悕绉� + //s_category.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_id) { + s_category.setId(this.getId()); + } + // 鏅�氬睘鎬� + if (this.isset_pid) { + s_category.setPid(this.getPid()); + } + if (this.isset_path) { + s_category.setPath(this.getPath()); + } + if (this.isset_name) { + s_category.setName(this.getName()); + } + if (this.isset_type) { + s_category.setType(this.getType()); + } + if (this.isset_url) { + s_category.setUrl(this.getUrl()); + } + if (this.isset_extra) { + s_category.setExtra(this.getExtra()); + } + if (this.isset_status) { + s_category.setStatus(this.getStatus()); + } + if (this.isset_sort) { + s_category.setSort(this.getSort()); + } + if (this.isset_owner) { + s_category.setOwner(this.getOwner()); + } + if (this.isset_create_time) { + s_category.setCreate_time(this.getCreate_time()); + } + if (this.isset_update_time) { + s_category.setUpdate_time(this.getUpdate_time()); + } + return s_category; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_category_mapper.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_category_mapper.java new file mode 100644 index 0000000..528ef5f --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_category_mapper.java @@ -0,0 +1,371 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:S_CATEGORY * + * @author genrator + */ +public class S_category_mapper extends S_category implements BaseMapper<S_category> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<S_category> ROW_MAPPER = new S_categoryRowMapper(); + + // 涓婚敭 + public static final String ID = "id"; + // 鏅�氬睘鎬� + public static final String PID = "pid"; + public static final String PATH = "path"; + public static final String NAME = "name"; + public static final String TYPE = "type"; + public static final String URL = "url"; + public static final String EXTRA = "extra"; + public static final String STATUS = "status"; + public static final String SORT = "sort"; + public static final String OWNER = "owner"; + public static final String CREATE_TIME = "create_time"; + public static final String UPDATE_TIME = "update_time"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_category_mapper(S_category s_category) { + if (s_category == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (s_category.isset_id) { + this.setId(s_category.getId()); + } + //鏅�氬睘鎬� + if (s_category.isset_pid) { + this.setPid(s_category.getPid()); + } + if (s_category.isset_path) { + this.setPath(s_category.getPath()); + } + if (s_category.isset_name) { + this.setName(s_category.getName()); + } + if (s_category.isset_type) { + this.setType(s_category.getType()); + } + if (s_category.isset_url) { + this.setUrl(s_category.getUrl()); + } + if (s_category.isset_extra) { + this.setExtra(s_category.getExtra()); + } + if (s_category.isset_status) { + this.setStatus(s_category.getStatus()); + } + if (s_category.isset_sort) { + this.setSort(s_category.getSort()); + } + if (s_category.isset_owner) { + this.setOwner(s_category.getOwner()); + } + if (s_category.isset_create_time) { + this.setCreate_time(s_category.getCreate_time()); + } + if (s_category.isset_update_time) { + this.setUpdate_time(s_category.getUpdate_time()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(s_category.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "s_category"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return ID; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getId(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(ID, this.getId()); + ib.set(PID, this.getPid(), this.isset_pid); + ib.set(PATH, this.getPath(), this.isset_path); + ib.set(NAME, this.getName(), this.isset_name); + ib.set(TYPE, this.getType(), this.isset_type); + ib.set(URL, this.getUrl(), this.isset_url); + ib.set(EXTRA, this.getExtra(), this.isset_extra); + ib.set(STATUS, this.getStatus(), this.isset_status); + ib.set(SORT, this.getSort(), this.isset_sort); + ib.set(OWNER, this.getOwner(), this.isset_owner); + ib.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ib.set(UPDATE_TIME, this.getUpdate_time(), this.isset_update_time); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(PID, this.getPid(), this.isset_pid); + ub.set(PATH, this.getPath(), this.isset_path); + ub.set(NAME, this.getName(), this.isset_name); + ub.set(TYPE, this.getType(), this.isset_type); + ub.set(URL, this.getUrl(), this.isset_url); + ub.set(EXTRA, this.getExtra(), this.isset_extra); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(SORT, this.getSort(), this.isset_sort); + ub.set(OWNER, this.getOwner(), this.isset_owner); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(UPDATE_TIME, this.getUpdate_time(), this.isset_update_time); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(PID, this.getPid(), this.isset_pid); + ub.set(PATH, this.getPath(), this.isset_path); + ub.set(NAME, this.getName(), this.isset_name); + ub.set(TYPE, this.getType(), this.isset_type); + ub.set(URL, this.getUrl(), this.isset_url); + ub.set(EXTRA, this.getExtra(), this.isset_extra); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(SORT, this.getSort(), this.isset_sort); + ub.set(OWNER, this.getOwner(), this.isset_owner); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(UPDATE_TIME, this.getUpdate_time(), this.isset_update_time); + + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(PID, this.getPid(), this.isset_pid); + ub.set(PATH, this.getPath(), this.isset_path); + ub.set(NAME, this.getName(), this.isset_name); + ub.set(TYPE, this.getType(), this.isset_type); + ub.set(URL, this.getUrl(), this.isset_url); + ub.set(EXTRA, this.getExtra(), this.isset_extra); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(SORT, this.getSort(), this.isset_sort); + ub.set(OWNER, this.getOwner(), this.isset_owner); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(UPDATE_TIME, this.getUpdate_time(), this.isset_update_time); + + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select id, pid, path, name, type, url, extra, status, sort, owner, create_time, update_time from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select id, pid, path, name, type, url, extra, status, sort, owner, create_time, update_time from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public S_category mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public S_category toS_category() { + return super.$clone(); + } +} + +/** + * s_category RowMapper + * + * @author genrator + */ +class S_categoryRowMapper implements RowMapper<S_category> { + + @Override + public S_category mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + S_category s_category = new S_category(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, S_category_mapper.ID); + if (columnIndex > 0) { + s_category.setId(rs.getInt(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, S_category_mapper.PID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_category.setPid(null); + } else { + s_category.setPid(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_category_mapper.PATH); + if (columnIndex > 0) { + s_category.setPath(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_category_mapper.NAME); + if (columnIndex > 0) { + s_category.setName(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_category_mapper.TYPE); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_category.setType(null); + } else { + s_category.setType(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_category_mapper.URL); + if (columnIndex > 0) { + s_category.setUrl(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_category_mapper.EXTRA); + if (columnIndex > 0) { + s_category.setExtra(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_category_mapper.STATUS); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_category.setStatus(null); + } else { + s_category.setStatus(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_category_mapper.SORT); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_category.setSort(null); + } else { + s_category.setSort(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_category_mapper.OWNER); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_category.setOwner(null); + } else { + s_category.setOwner(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_category_mapper.CREATE_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_category.setCreate_time(null); + } else { + s_category.setCreate_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_category_mapper.UPDATE_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_category.setUpdate_time(null); + } else { + s_category.setUpdate_time(rs.getLong(columnIndex)); + } + } + return s_category; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_chat.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_chat.java new file mode 100644 index 0000000..494e16a --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_chat.java @@ -0,0 +1,231 @@ + + +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:S_CHAT * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class S_chat extends BasePo<S_chat> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + // 涓婚敭 + private Long id = null; + @JsonIgnore + protected boolean isset_id = false; + + // 灞炴�у垪琛� + private Long create_time = null; + @JsonIgnore + protected boolean isset_create_time = false; + + private Long me = null; + @JsonIgnore + protected boolean isset_me = false; + + private Long user_id = null; + @JsonIgnore + protected boolean isset_user_id = false; + + private Integer type = null; + @JsonIgnore + protected boolean isset_type = false; + + private String msg_type = null; + @JsonIgnore + protected boolean isset_msg_type = false; + + private String message = null; + @JsonIgnore + protected boolean isset_message = false; + + private String biz_id = null; + @JsonIgnore + protected boolean isset_biz_id = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_chat() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public S_chat(Long id) { + this.setId(id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setId((Long) value); + } + + public Long getId() { + return this.id; + } + public void setId(Long id) { + this.id = id; + this.isset_id = true; + } + @JsonIgnore + public boolean isEmptyId() { + return this.id == null; + } + + + public Long getCreate_time() { + return this.create_time; + } + public void setCreate_time(Long create_time) { + this.create_time = create_time; + this.isset_create_time = true; + } + @JsonIgnore + public boolean isEmptyCreate_time() { + return this.create_time == null; + } + + + public Long getMe() { + return this.me; + } + public void setMe(Long me) { + this.me = me; + this.isset_me = true; + } + @JsonIgnore + public boolean isEmptyMe() { + return this.me == null; + } + + + public Long getUser_id() { + return this.user_id; + } + public void setUser_id(Long user_id) { + this.user_id = user_id; + this.isset_user_id = true; + } + @JsonIgnore + public boolean isEmptyUser_id() { + return this.user_id == null; + } + + + public Integer getType() { + return this.type; + } + public void setType(Integer type) { + this.type = type; + this.isset_type = true; + } + @JsonIgnore + public boolean isEmptyType() { + return this.type == null; + } + + + public String getMsg_type() { + return this.msg_type; + } + public void setMsg_type(String msg_type) { + this.msg_type = msg_type; + this.isset_msg_type = true; + } + @JsonIgnore + public boolean isEmptyMsg_type() { + return this.msg_type == null || this.msg_type.length() == 0; + } + + + public String getMessage() { + return this.message; + } + public void setMessage(String message) { + this.message = message; + this.isset_message = true; + } + @JsonIgnore + public boolean isEmptyMessage() { + return this.message == null || this.message.length() == 0; + } + + + public String getBiz_id() { + return this.biz_id; + } + public void setBiz_id(String biz_id) { + this.biz_id = biz_id; + this.isset_biz_id = true; + } + @JsonIgnore + public boolean isEmptyBiz_id() { + return this.biz_id == null || this.biz_id.length() == 0; + } + + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("id=").append(this.id) + .append("create_time=").append(this.create_time) + .append("me=").append(this.me) + .append("user_id=").append(this.user_id) + .append("type=").append(this.type) + .append("msg_type=").append(this.msg_type) + .append("message=").append(this.message) + .append("biz_id=").append(this.biz_id) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public S_chat $clone() { + S_chat s_chat = new S_chat(); + + // 鏁版嵁搴撳悕绉� + //s_chat.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_id) { + s_chat.setId(this.getId()); + } + // 鏅�氬睘鎬� + if (this.isset_create_time) { + s_chat.setCreate_time(this.getCreate_time()); + } + if (this.isset_me) { + s_chat.setMe(this.getMe()); + } + if (this.isset_user_id) { + s_chat.setUser_id(this.getUser_id()); + } + if (this.isset_type) { + s_chat.setType(this.getType()); + } + if (this.isset_msg_type) { + s_chat.setMsg_type(this.getMsg_type()); + } + if (this.isset_message) { + s_chat.setMessage(this.getMessage()); + } + if (this.isset_biz_id) { + s_chat.setBiz_id(this.getBiz_id()); + } + return s_chat; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_chat_mapper.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_chat_mapper.java new file mode 100644 index 0000000..264acba --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_chat_mapper.java @@ -0,0 +1,311 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:S_CHAT * + * @author genrator + */ +public class S_chat_mapper extends S_chat implements BaseMapper<S_chat> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<S_chat> ROW_MAPPER = new S_chatRowMapper(); + + // 涓婚敭 + public static final String ID = "id"; + // 鏅�氬睘鎬� + public static final String CREATE_TIME = "create_time"; + public static final String ME = "me"; + public static final String USER_ID = "user_id"; + public static final String TYPE = "type"; + public static final String MSG_TYPE = "msg_type"; + public static final String MESSAGE = "message"; + public static final String BIZ_ID = "biz_id"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_chat_mapper(S_chat s_chat) { + if (s_chat == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (s_chat.isset_id) { + this.setId(s_chat.getId()); + } + //鏅�氬睘鎬� + if (s_chat.isset_create_time) { + this.setCreate_time(s_chat.getCreate_time()); + } + if (s_chat.isset_me) { + this.setMe(s_chat.getMe()); + } + if (s_chat.isset_user_id) { + this.setUser_id(s_chat.getUser_id()); + } + if (s_chat.isset_type) { + this.setType(s_chat.getType()); + } + if (s_chat.isset_msg_type) { + this.setMsg_type(s_chat.getMsg_type()); + } + if (s_chat.isset_message) { + this.setMessage(s_chat.getMessage()); + } + if (s_chat.isset_biz_id) { + this.setBiz_id(s_chat.getBiz_id()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(s_chat.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "s_chat"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return ID; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getId(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(ID, this.getId()); + ib.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ib.set(ME, this.getMe(), this.isset_me); + ib.set(USER_ID, this.getUser_id(), this.isset_user_id); + ib.set(TYPE, this.getType(), this.isset_type); + ib.set(MSG_TYPE, this.getMsg_type(), this.isset_msg_type); + ib.set(MESSAGE, this.getMessage(), this.isset_message); + ib.set(BIZ_ID, this.getBiz_id(), this.isset_biz_id); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(ME, this.getMe(), this.isset_me); + ub.set(USER_ID, this.getUser_id(), this.isset_user_id); + ub.set(TYPE, this.getType(), this.isset_type); + ub.set(MSG_TYPE, this.getMsg_type(), this.isset_msg_type); + ub.set(MESSAGE, this.getMessage(), this.isset_message); + ub.set(BIZ_ID, this.getBiz_id(), this.isset_biz_id); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(ME, this.getMe(), this.isset_me); + ub.set(USER_ID, this.getUser_id(), this.isset_user_id); + ub.set(TYPE, this.getType(), this.isset_type); + ub.set(MSG_TYPE, this.getMsg_type(), this.isset_msg_type); + ub.set(MESSAGE, this.getMessage(), this.isset_message); + ub.set(BIZ_ID, this.getBiz_id(), this.isset_biz_id); + + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(ME, this.getMe(), this.isset_me); + ub.set(USER_ID, this.getUser_id(), this.isset_user_id); + ub.set(TYPE, this.getType(), this.isset_type); + ub.set(MSG_TYPE, this.getMsg_type(), this.isset_msg_type); + ub.set(MESSAGE, this.getMessage(), this.isset_message); + ub.set(BIZ_ID, this.getBiz_id(), this.isset_biz_id); + + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select id, create_time, me, user_id, type, msg_type, message, biz_id from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select id, create_time, me, user_id, type, msg_type, message, biz_id from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public S_chat mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public S_chat toS_chat() { + return super.$clone(); + } +} + +/** + * s_chat RowMapper + * + * @author genrator + */ +class S_chatRowMapper implements RowMapper<S_chat> { + + @Override + public S_chat mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + S_chat s_chat = new S_chat(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, S_chat_mapper.ID); + if (columnIndex > 0) { + s_chat.setId(rs.getLong(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, S_chat_mapper.CREATE_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_chat.setCreate_time(null); + } else { + s_chat.setCreate_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_chat_mapper.ME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_chat.setMe(null); + } else { + s_chat.setMe(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_chat_mapper.USER_ID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_chat.setUser_id(null); + } else { + s_chat.setUser_id(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_chat_mapper.TYPE); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_chat.setType(null); + } else { + s_chat.setType(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_chat_mapper.MSG_TYPE); + if (columnIndex > 0) { + s_chat.setMsg_type(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_chat_mapper.MESSAGE); + if (columnIndex > 0) { + s_chat.setMessage(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_chat_mapper.BIZ_ID); + if (columnIndex > 0) { + s_chat.setBiz_id(rs.getString(columnIndex)); + } + return s_chat; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_class_ext.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_class_ext.java new file mode 100644 index 0000000..ecbc0ca --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_class_ext.java @@ -0,0 +1,155 @@ +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:S_CLASS_EXT * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class S_class_ext extends BasePo<S_class_ext> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + /** + * 鐢ㄤ簬鍏煎鑰佸啓娉� + */ + @JsonIgnore + public static final S_class_ext ROW_MAPPER = new S_class_ext(); + + // 涓婚敭 + private Long id = null; + @JsonIgnore + protected boolean isset_id = false; + + // 灞炴�у垪琛� + private String name = null; + @JsonIgnore + protected boolean isset_name = false; + + private String description = null; + @JsonIgnore + protected boolean isset_description = false; + + private String type = null; + @JsonIgnore + protected boolean isset_type = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_class_ext() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public S_class_ext(Long id) { + this.setId(id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setId((Long) value); + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + this.isset_id = true; + } + + @JsonIgnore + public boolean isEmptyId() { + return this.id == null; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + this.isset_name = true; + } + + @JsonIgnore + public boolean isEmptyName() { + return this.name == null || this.name.length() == 0; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + this.isset_description = true; + } + + @JsonIgnore + public boolean isEmptyDescription() { + return this.description == null || this.description.length() == 0; + } + + public String getType() { + return this.type; + } + + public void setType(String type) { + this.type = type; + this.isset_type = true; + } + + @JsonIgnore + public boolean isEmptyType() { + return this.type == null || this.type.length() == 0; + } + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("id=").append(this.id) + .append("name=").append(this.name) + .append("description=").append(this.description) + .append("type=").append(this.type) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public S_class_ext $clone() { + S_class_ext s_class_ext = new S_class_ext(); + + // 鏁版嵁搴撳悕绉� + //s_class_ext.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_id) { + s_class_ext.setId(this.getId()); + } + // 鏅�氬睘鎬� + if (this.isset_name) { + s_class_ext.setName(this.getName()); + } + if (this.isset_description) { + s_class_ext.setDescription(this.getDescription()); + } + if (this.isset_type) { + s_class_ext.setType(this.getType()); + } + return s_class_ext; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_class_ext_mapper.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_class_ext_mapper.java new file mode 100644 index 0000000..3150d9d --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_class_ext_mapper.java @@ -0,0 +1,247 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:S_CLASS_EXT * + * @author genrator + */ +public class S_class_ext_mapper extends S_class_ext implements BaseMapper<S_class_ext> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<S_class_ext> ROW_MAPPER = new S_class_extRowMapper(); + + // 涓婚敭 + public static final String ID = "id"; + // 鏅�氬睘鎬� + public static final String NAME = "name"; + public static final String DESCRIPTION = "description"; + public static final String TYPE = "type"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_class_ext_mapper(S_class_ext s_class_ext) { + if (s_class_ext == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (s_class_ext.isset_id) { + this.setId(s_class_ext.getId()); + } + //鏅�氬睘鎬� + if (s_class_ext.isset_name) { + this.setName(s_class_ext.getName()); + } + if (s_class_ext.isset_description) { + this.setDescription(s_class_ext.getDescription()); + } + if (s_class_ext.isset_type) { + this.setType(s_class_ext.getType()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(s_class_ext.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "s_class_ext"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return ID; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getId(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(ID, this.getId()); + ib.set(NAME, this.getName(), this.isset_name); + ib.set(DESCRIPTION, this.getDescription(), this.isset_description); + ib.set(TYPE, this.getType(), this.isset_type); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(NAME, this.getName(), this.isset_name); + ub.set(DESCRIPTION, this.getDescription(), this.isset_description); + ub.set(TYPE, this.getType(), this.isset_type); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(NAME, this.getName(), this.isset_name); + ub.set(DESCRIPTION, this.getDescription(), this.isset_description); + ub.set(TYPE, this.getType(), this.isset_type); + + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(NAME, this.getName(), this.isset_name); + ub.set(DESCRIPTION, this.getDescription(), this.isset_description); + ub.set(TYPE, this.getType(), this.isset_type); + + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select id, name, description, type from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select id, name, description, type from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public S_class_ext mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public S_class_ext toS_class_ext() { + return super.$clone(); + } +} + +/** + * s_class_ext RowMapper + * + * @author genrator + */ +class S_class_extRowMapper implements RowMapper<S_class_ext> { + + @Override + public S_class_ext mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + S_class_ext s_class_ext = new S_class_ext(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, S_class_ext_mapper.ID); + if (columnIndex > 0) { + s_class_ext.setId(rs.getLong(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, S_class_ext_mapper.NAME); + if (columnIndex > 0) { + s_class_ext.setName(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_class_ext_mapper.DESCRIPTION); + if (columnIndex > 0) { + s_class_ext.setDescription(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_class_ext_mapper.TYPE); + if (columnIndex > 0) { + s_class_ext.setType(rs.getString(columnIndex)); + } + return s_class_ext; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_code.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_code.java new file mode 100644 index 0000000..0f37793 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_code.java @@ -0,0 +1,243 @@ +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:S_CODE * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class S_code extends BasePo<S_code> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + /** + * 鐢ㄤ簬鍏煎鑰佸啓娉� + */ + @JsonIgnore + public static final S_code ROW_MAPPER = new S_code(); + + // 涓婚敭 + private String id = null; + @JsonIgnore + protected boolean isset_id = false; + + // 灞炴�у垪琛� + private Integer sxh = null; + @JsonIgnore + protected boolean isset_sxh = false; + + private String name = null; + @JsonIgnore + protected boolean isset_name = false; + + private String code_id = null; + @JsonIgnore + protected boolean isset_code_id = false; + + private Integer code_type = null; + @JsonIgnore + protected boolean isset_code_type = false; + + private String parent_id = null; + @JsonIgnore + protected boolean isset_parent_id = false; + + private Integer code_sec = null; + @JsonIgnore + protected boolean isset_code_sec = false; + + private Integer child_sum = null; + @JsonIgnore + protected boolean isset_child_sum = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_code() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public S_code(String id) { + this.setId(id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setId((String) value); + } + + public String getId() { + return this.id; + } + + public void setId(String id) { + this.id = id; + this.isset_id = true; + } + + @JsonIgnore + public boolean isEmptyId() { + return this.id == null || this.id.length() == 0; + } + + public Integer getSxh() { + return this.sxh; + } + + public void setSxh(Integer sxh) { + this.sxh = sxh; + this.isset_sxh = true; + } + + @JsonIgnore + public boolean isEmptySxh() { + return this.sxh == null; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + this.isset_name = true; + } + + @JsonIgnore + public boolean isEmptyName() { + return this.name == null || this.name.length() == 0; + } + + public String getCode_id() { + return this.code_id; + } + + public void setCode_id(String code_id) { + this.code_id = code_id; + this.isset_code_id = true; + } + + @JsonIgnore + public boolean isEmptyCode_id() { + return this.code_id == null || this.code_id.length() == 0; + } + + public Integer getCode_type() { + return this.code_type; + } + + public void setCode_type(Integer code_type) { + this.code_type = code_type; + this.isset_code_type = true; + } + + @JsonIgnore + public boolean isEmptyCode_type() { + return this.code_type == null; + } + + public String getParent_id() { + return this.parent_id; + } + + public void setParent_id(String parent_id) { + this.parent_id = parent_id; + this.isset_parent_id = true; + } + + @JsonIgnore + public boolean isEmptyParent_id() { + return this.parent_id == null || this.parent_id.length() == 0; + } + + public Integer getCode_sec() { + return this.code_sec; + } + + public void setCode_sec(Integer code_sec) { + this.code_sec = code_sec; + this.isset_code_sec = true; + } + + @JsonIgnore + public boolean isEmptyCode_sec() { + return this.code_sec == null; + } + + public Integer getChild_sum() { + return this.child_sum; + } + + public void setChild_sum(Integer child_sum) { + this.child_sum = child_sum; + this.isset_child_sum = true; + } + + @JsonIgnore + public boolean isEmptyChild_sum() { + return this.child_sum == null; + } + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("id=").append(this.id) + .append("sxh=").append(this.sxh) + .append("name=").append(this.name) + .append("code_id=").append(this.code_id) + .append("code_type=").append(this.code_type) + .append("parent_id=").append(this.parent_id) + .append("code_sec=").append(this.code_sec) + .append("child_sum=").append(this.child_sum) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public S_code $clone() { + S_code s_code = new S_code(); + + // 鏁版嵁搴撳悕绉� + //s_code.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_id) { + s_code.setId(this.getId()); + } + // 鏅�氬睘鎬� + if (this.isset_sxh) { + s_code.setSxh(this.getSxh()); + } + if (this.isset_name) { + s_code.setName(this.getName()); + } + if (this.isset_code_id) { + s_code.setCode_id(this.getCode_id()); + } + if (this.isset_code_type) { + s_code.setCode_type(this.getCode_type()); + } + if (this.isset_parent_id) { + s_code.setParent_id(this.getParent_id()); + } + if (this.isset_code_sec) { + s_code.setCode_sec(this.getCode_sec()); + } + if (this.isset_child_sum) { + s_code.setChild_sum(this.getChild_sum()); + } + return s_code; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_code_mapper.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_code_mapper.java new file mode 100644 index 0000000..4d97618 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_code_mapper.java @@ -0,0 +1,309 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:S_CODE * + * @author genrator + */ +public class S_code_mapper extends S_code implements BaseMapper<S_code> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<S_code> ROW_MAPPER = new S_codeRowMapper(); + + // 涓婚敭 + public static final String ID = "id"; + // 鏅�氬睘鎬� + public static final String SXH = "sxh"; + public static final String NAME = "name"; + public static final String CODE_ID = "code_id"; + public static final String CODE_TYPE = "code_type"; + public static final String PARENT_ID = "parent_id"; + public static final String CODE_SEC = "code_sec"; + public static final String CHILD_SUM = "child_sum"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_code_mapper(S_code s_code) { + if (s_code == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (s_code.isset_id) { + this.setId(s_code.getId()); + } + //鏅�氬睘鎬� + if (s_code.isset_sxh) { + this.setSxh(s_code.getSxh()); + } + if (s_code.isset_name) { + this.setName(s_code.getName()); + } + if (s_code.isset_code_id) { + this.setCode_id(s_code.getCode_id()); + } + if (s_code.isset_code_type) { + this.setCode_type(s_code.getCode_type()); + } + if (s_code.isset_parent_id) { + this.setParent_id(s_code.getParent_id()); + } + if (s_code.isset_code_sec) { + this.setCode_sec(s_code.getCode_sec()); + } + if (s_code.isset_child_sum) { + this.setChild_sum(s_code.getChild_sum()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(s_code.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "s_code"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return ID; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getId(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(ID, this.getId()); + ib.set(SXH, this.getSxh(), this.isset_sxh); + ib.set(NAME, this.getName(), this.isset_name); + ib.set(CODE_ID, this.getCode_id(), this.isset_code_id); + ib.set(CODE_TYPE, this.getCode_type(), this.isset_code_type); + ib.set(PARENT_ID, this.getParent_id(), this.isset_parent_id); + ib.set(CODE_SEC, this.getCode_sec(), this.isset_code_sec); + ib.set(CHILD_SUM, this.getChild_sum(), this.isset_child_sum); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(SXH, this.getSxh(), this.isset_sxh); + ub.set(NAME, this.getName(), this.isset_name); + ub.set(CODE_ID, this.getCode_id(), this.isset_code_id); + ub.set(CODE_TYPE, this.getCode_type(), this.isset_code_type); + ub.set(PARENT_ID, this.getParent_id(), this.isset_parent_id); + ub.set(CODE_SEC, this.getCode_sec(), this.isset_code_sec); + ub.set(CHILD_SUM, this.getChild_sum(), this.isset_child_sum); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(SXH, this.getSxh(), this.isset_sxh); + ub.set(NAME, this.getName(), this.isset_name); + ub.set(CODE_ID, this.getCode_id(), this.isset_code_id); + ub.set(CODE_TYPE, this.getCode_type(), this.isset_code_type); + ub.set(PARENT_ID, this.getParent_id(), this.isset_parent_id); + ub.set(CODE_SEC, this.getCode_sec(), this.isset_code_sec); + ub.set(CHILD_SUM, this.getChild_sum(), this.isset_child_sum); + + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(SXH, this.getSxh(), this.isset_sxh); + ub.set(NAME, this.getName(), this.isset_name); + ub.set(CODE_ID, this.getCode_id(), this.isset_code_id); + ub.set(CODE_TYPE, this.getCode_type(), this.isset_code_type); + ub.set(PARENT_ID, this.getParent_id(), this.isset_parent_id); + ub.set(CODE_SEC, this.getCode_sec(), this.isset_code_sec); + ub.set(CHILD_SUM, this.getChild_sum(), this.isset_child_sum); + + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select id, sxh, name, code_id, code_type, parent_id, code_sec, child_sum from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select id, sxh, name, code_id, code_type, parent_id, code_sec, child_sum from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public S_code mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public S_code toS_code() { + return super.$clone(); + } +} + +/** + * s_code RowMapper + * + * @author genrator + */ +class S_codeRowMapper implements RowMapper<S_code> { + + @Override + public S_code mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + S_code s_code = new S_code(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, S_code_mapper.ID); + if (columnIndex > 0) { + s_code.setId(rs.getString(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, S_code_mapper.SXH); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_code.setSxh(null); + } else { + s_code.setSxh(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_code_mapper.NAME); + if (columnIndex > 0) { + s_code.setName(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_code_mapper.CODE_ID); + if (columnIndex > 0) { + s_code.setCode_id(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_code_mapper.CODE_TYPE); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_code.setCode_type(null); + } else { + s_code.setCode_type(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_code_mapper.PARENT_ID); + if (columnIndex > 0) { + s_code.setParent_id(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_code_mapper.CODE_SEC); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_code.setCode_sec(null); + } else { + s_code.setCode_sec(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_code_mapper.CHILD_SUM); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_code.setChild_sum(null); + } else { + s_code.setChild_sum(rs.getInt(columnIndex)); + } + } + return s_code; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_config.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_config.java new file mode 100644 index 0000000..29f8370 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_config.java @@ -0,0 +1,288 @@ + + +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:S_CONFIG * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class S_config extends BasePo<S_config> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + /** + * 鐢ㄤ簬鍏煎鑰佸啓娉� + */ + @JsonIgnore + public static final S_config ROW_MAPPER = new S_config(); + + // 涓婚敭 + private Long config_id = null; + @JsonIgnore + protected boolean isset_config_id = false; + + // 灞炴�у垪琛� + private String config_name = null; + @JsonIgnore + protected boolean isset_config_name = false; + + private String config_key = null; + @JsonIgnore + protected boolean isset_config_key = false; + + private String config_value = null; + @JsonIgnore + protected boolean isset_config_value = false; + + private String config_type = null; + @JsonIgnore + protected boolean isset_config_type = false; + + private Long create_time = null; + @JsonIgnore + protected boolean isset_create_time = false; + + private String remark = null; + @JsonIgnore + protected boolean isset_remark = false; + + private String data_type = null; + @JsonIgnore + protected boolean isset_data_type = false; + + private String group_id = null; + @JsonIgnore + protected boolean isset_group_id = false; + + private Integer form_id = null; + @JsonIgnore + protected boolean isset_form_id = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_config() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public S_config(Long config_id) { + this.setConfig_id(config_id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setConfig_id((Long) value); + } + + public Long getConfig_id() { + return this.config_id; + } + public void setConfig_id(Long config_id) { + this.config_id = config_id; + this.isset_config_id = true; + } + @JsonIgnore + public boolean isEmptyConfig_id() { + return this.config_id == null; + } + + + public String getConfig_name() { + return this.config_name; + } + public void setConfig_name(String config_name) { + this.config_name = config_name; + this.isset_config_name = true; + // config_name, varchar + } + @JsonIgnore + public boolean isEmptyConfig_name() { + return this.config_name == null || this.config_name.length() == 0; + } + + + public String getConfig_key() { + return this.config_key; + } + public void setConfig_key(String config_key) { + this.config_key = config_key; + this.isset_config_key = true; + // config_key, varchar + } + @JsonIgnore + public boolean isEmptyConfig_key() { + return this.config_key == null || this.config_key.length() == 0; + } + + + public String getConfig_value() { + return this.config_value; + } + public void setConfig_value(String config_value) { + this.config_value = config_value; + this.isset_config_value = true; + // config_value, varchar + } + @JsonIgnore + public boolean isEmptyConfig_value() { + return this.config_value == null || this.config_value.length() == 0; + } + + + public String getConfig_type() { + return this.config_type; + } + public void setConfig_type(String config_type) { + this.config_type = config_type; + this.isset_config_type = true; + // config_type, varchar + } + @JsonIgnore + public boolean isEmptyConfig_type() { + return this.config_type == null || this.config_type.length() == 0; + } + + + public Long getCreate_time() { + return this.create_time; + } + public void setCreate_time(Long create_time) { + this.create_time = create_time; + this.isset_create_time = true; + // create_time, bigint + } + @JsonIgnore + public boolean isEmptyCreate_time() { + return this.create_time == null; + } + + + public String getRemark() { + return this.remark; + } + public void setRemark(String remark) { + this.remark = remark; + this.isset_remark = true; + // remark, varchar + } + @JsonIgnore + public boolean isEmptyRemark() { + return this.remark == null || this.remark.length() == 0; + } + + + public String getData_type() { + return this.data_type; + } + public void setData_type(String data_type) { + this.data_type = data_type; + this.isset_data_type = true; + // data_type, varchar + } + @JsonIgnore + public boolean isEmptyData_type() { + return this.data_type == null || this.data_type.length() == 0; + } + + + public String getGroup_id() { + return this.group_id; + } + public void setGroup_id(String group_id) { + this.group_id = group_id; + this.isset_group_id = true; + // group_id, varchar + } + @JsonIgnore + public boolean isEmptyGroup_id() { + return this.group_id == null || this.group_id.length() == 0; + } + + + public Integer getForm_id() { + return this.form_id; + } + public void setForm_id(Integer form_id) { + this.form_id = form_id; + this.isset_form_id = true; + // form_id, int + } + @JsonIgnore + public boolean isEmptyForm_id() { + return this.form_id == null; + } + + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("config_id=").append(this.config_id) + .append("config_name=").append(this.config_name) + .append("config_key=").append(this.config_key) + .append("config_value=").append(this.config_value) + .append("config_type=").append(this.config_type) + .append("create_time=").append(this.create_time) + .append("remark=").append(this.remark) + .append("data_type=").append(this.data_type) + .append("group_id=").append(this.group_id) + .append("form_id=").append(this.form_id) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public S_config $clone() { + S_config s_config = new S_config(); + + // 鏁版嵁搴撳悕绉� + //s_config.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_config_id) { + s_config.setConfig_id(this.getConfig_id()); + } + // 鏅�氬睘鎬� + if (this.isset_config_name) { + s_config.setConfig_name(this.getConfig_name()); + } + if (this.isset_config_key) { + s_config.setConfig_key(this.getConfig_key()); + } + if (this.isset_config_value) { + s_config.setConfig_value(this.getConfig_value()); + } + if (this.isset_config_type) { + s_config.setConfig_type(this.getConfig_type()); + } + if (this.isset_create_time) { + s_config.setCreate_time(this.getCreate_time()); + } + if (this.isset_remark) { + s_config.setRemark(this.getRemark()); + } + if (this.isset_data_type) { + s_config.setData_type(this.getData_type()); + } + if (this.isset_group_id) { + s_config.setGroup_id(this.getGroup_id()); + } + if (this.isset_form_id) { + s_config.setForm_id(this.getForm_id()); + } + return s_config; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_config_form.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_config_form.java new file mode 100644 index 0000000..6a474c3 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_config_form.java @@ -0,0 +1,200 @@ + + +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:S_CONFIG_FORM * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class S_config_form extends BasePo<S_config_form> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + /** + * 鐢ㄤ簬鍏煎鑰佸啓娉� + */ + @JsonIgnore + public static final S_config_form ROW_MAPPER = new S_config_form(); + + // 涓婚敭 + private Integer id = null; + @JsonIgnore + protected boolean isset_id = false; + + // 灞炴�у垪琛� + private String name = null; + @JsonIgnore + protected boolean isset_name = false; + + private String info = null; + @JsonIgnore + protected boolean isset_info = false; + + private String content = null; + @JsonIgnore + protected boolean isset_content = false; + + private Long create_time = null; + @JsonIgnore + protected boolean isset_create_time = false; + + private Long update_time = null; + @JsonIgnore + protected boolean isset_update_time = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_config_form() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public S_config_form(Integer id) { + this.setId(id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setId((Integer) value); + } + + public Integer getId() { + return this.id; + } + public void setId(Integer id) { + this.id = id; + this.isset_id = true; + } + @JsonIgnore + public boolean isEmptyId() { + return this.id == null; + } + + + public String getName() { + return this.name; + } + public void setName(String name) { + this.name = name; + this.isset_name = true; + // name, varchar + } + @JsonIgnore + public boolean isEmptyName() { + return this.name == null || this.name.length() == 0; + } + + + public String getInfo() { + return this.info; + } + public void setInfo(String info) { + this.info = info; + this.isset_info = true; + // info, varchar + } + @JsonIgnore + public boolean isEmptyInfo() { + return this.info == null || this.info.length() == 0; + } + + + public String getContent() { + return this.content; + } + public void setContent(String content) { + this.content = content; + this.isset_content = true; + // content, text + } + @JsonIgnore + public boolean isEmptyContent() { + return this.content == null || this.content.length() == 0; + } + + + public Long getCreate_time() { + return this.create_time; + } + public void setCreate_time(Long create_time) { + this.create_time = create_time; + this.isset_create_time = true; + // create_time, bigint + } + @JsonIgnore + public boolean isEmptyCreate_time() { + return this.create_time == null; + } + + + public Long getUpdate_time() { + return this.update_time; + } + public void setUpdate_time(Long update_time) { + this.update_time = update_time; + this.isset_update_time = true; + // update_time, bigint + } + @JsonIgnore + public boolean isEmptyUpdate_time() { + return this.update_time == null; + } + + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("id=").append(this.id) + .append("name=").append(this.name) + .append("info=").append(this.info) + .append("content=").append(this.content) + .append("create_time=").append(this.create_time) + .append("update_time=").append(this.update_time) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public S_config_form $clone() { + S_config_form s_config_form = new S_config_form(); + + // 鏁版嵁搴撳悕绉� + //s_config_form.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_id) { + s_config_form.setId(this.getId()); + } + // 鏅�氬睘鎬� + if (this.isset_name) { + s_config_form.setName(this.getName()); + } + if (this.isset_info) { + s_config_form.setInfo(this.getInfo()); + } + if (this.isset_content) { + s_config_form.setContent(this.getContent()); + } + if (this.isset_create_time) { + s_config_form.setCreate_time(this.getCreate_time()); + } + if (this.isset_update_time) { + s_config_form.setUpdate_time(this.getUpdate_time()); + } + return s_config_form; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_config_form_mapper.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_config_form_mapper.java new file mode 100644 index 0000000..915728f --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_config_form_mapper.java @@ -0,0 +1,279 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:S_CONFIG_FORM * + * @author genrator + */ +public class S_config_form_mapper extends S_config_form implements BaseMapper<S_config_form> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<S_config_form> ROW_MAPPER = new S_config_formRowMapper(); + + // 涓婚敭 + public static final String ID = "id"; + // 鏅�氬睘鎬� + public static final String NAME = "name"; + public static final String INFO = "info"; + public static final String CONTENT = "content"; + public static final String CREATE_TIME = "create_time"; + public static final String UPDATE_TIME = "update_time"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_config_form_mapper(S_config_form s_config_form) { + if (s_config_form == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (s_config_form.isset_id) { + this.setId(s_config_form.getId()); + } + //鏅�氬睘鎬� + if (s_config_form.isset_name) { + this.setName(s_config_form.getName()); + } + if (s_config_form.isset_info) { + this.setInfo(s_config_form.getInfo()); + } + if (s_config_form.isset_content) { + this.setContent(s_config_form.getContent()); + } + if (s_config_form.isset_create_time) { + this.setCreate_time(s_config_form.getCreate_time()); + } + if (s_config_form.isset_update_time) { + this.setUpdate_time(s_config_form.getUpdate_time()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(s_config_form.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "s_config_form"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return ID; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getId(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(ID, this.getId()); + ib.set(NAME, this.getName(), this.isset_name); + ib.set(INFO, this.getInfo(), this.isset_info); + ib.set(CONTENT, this.getContent(), this.isset_content); + ib.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ib.set(UPDATE_TIME, this.getUpdate_time(), this.isset_update_time); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(NAME, this.getName(), this.isset_name); + ub.set(INFO, this.getInfo(), this.isset_info); + ub.set(CONTENT, this.getContent(), this.isset_content); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(UPDATE_TIME, this.getUpdate_time(), this.isset_update_time); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(NAME, this.getName(), this.isset_name); + ub.set(INFO, this.getInfo(), this.isset_info); + ub.set(CONTENT, this.getContent(), this.isset_content); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(UPDATE_TIME, this.getUpdate_time(), this.isset_update_time); + + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(NAME, this.getName(), this.isset_name); + ub.set(INFO, this.getInfo(), this.isset_info); + ub.set(CONTENT, this.getContent(), this.isset_content); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(UPDATE_TIME, this.getUpdate_time(), this.isset_update_time); + + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select id, name, info, content, create_time, update_time from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select id, name, info, content, create_time, update_time from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public S_config_form mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public S_config_form toS_config_form() { + return super.$clone(); + } +} + +/** + * s_config_form RowMapper + * + * @author genrator + */ +class S_config_formRowMapper implements RowMapper<S_config_form> { + + @Override + public S_config_form mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + S_config_form s_config_form = new S_config_form(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, S_config_form_mapper.ID); + if (columnIndex > 0) { + s_config_form.setId(rs.getInt(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, S_config_form_mapper.NAME); + if (columnIndex > 0) { + s_config_form.setName(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_config_form_mapper.INFO); + if (columnIndex > 0) { + s_config_form.setInfo(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_config_form_mapper.CONTENT); + if (columnIndex > 0) { + s_config_form.setContent(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_config_form_mapper.CREATE_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_config_form.setCreate_time(null); + } else { + s_config_form.setCreate_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_config_form_mapper.UPDATE_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_config_form.setUpdate_time(null); + } else { + s_config_form.setUpdate_time(rs.getLong(columnIndex)); + } + } + return s_config_form; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_config_mapper.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_config_mapper.java new file mode 100644 index 0000000..c8e35e5 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_config_mapper.java @@ -0,0 +1,327 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:S_CONFIG * + * @author genrator + */ +public class S_config_mapper extends S_config implements BaseMapper<S_config> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<S_config> ROW_MAPPER = new S_configRowMapper(); + + // 涓婚敭 + public static final String CONFIG_ID = "config_id"; + // 鏅�氬睘鎬� + public static final String CONFIG_NAME = "config_name"; + public static final String CONFIG_KEY = "config_key"; + public static final String CONFIG_VALUE = "config_value"; + public static final String CONFIG_TYPE = "config_type"; + public static final String CREATE_TIME = "create_time"; + public static final String REMARK = "remark"; + public static final String DATA_TYPE = "data_type"; + public static final String GROUP_ID = "group_id"; + public static final String FORM_ID = "form_id"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_config_mapper(S_config s_config) { + if (s_config == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (s_config.isset_config_id) { + this.setConfig_id(s_config.getConfig_id()); + } + //鏅�氬睘鎬� + if (s_config.isset_config_name) { + this.setConfig_name(s_config.getConfig_name()); + } + if (s_config.isset_config_key) { + this.setConfig_key(s_config.getConfig_key()); + } + if (s_config.isset_config_value) { + this.setConfig_value(s_config.getConfig_value()); + } + if (s_config.isset_config_type) { + this.setConfig_type(s_config.getConfig_type()); + } + if (s_config.isset_create_time) { + this.setCreate_time(s_config.getCreate_time()); + } + if (s_config.isset_remark) { + this.setRemark(s_config.getRemark()); + } + if (s_config.isset_data_type) { + this.setData_type(s_config.getData_type()); + } + if (s_config.isset_group_id) { + this.setGroup_id(s_config.getGroup_id()); + } + if (s_config.isset_form_id) { + this.setForm_id(s_config.getForm_id()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(s_config.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "s_config"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return CONFIG_ID; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getConfig_id(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(CONFIG_ID, this.getConfig_id()); + ib.set(CONFIG_NAME, this.getConfig_name(), this.isset_config_name); + ib.set(CONFIG_KEY, this.getConfig_key(), this.isset_config_key); + ib.set(CONFIG_VALUE, this.getConfig_value(), this.isset_config_value); + ib.set(CONFIG_TYPE, this.getConfig_type(), this.isset_config_type); + ib.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ib.set(REMARK, this.getRemark(), this.isset_remark); + ib.set(DATA_TYPE, this.getData_type(), this.isset_data_type); + ib.set(GROUP_ID, this.getGroup_id(), this.isset_group_id); + ib.set(FORM_ID, this.getForm_id(), this.isset_form_id); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CONFIG_NAME, this.getConfig_name(), this.isset_config_name); + ub.set(CONFIG_KEY, this.getConfig_key(), this.isset_config_key); + ub.set(CONFIG_VALUE, this.getConfig_value(), this.isset_config_value); + ub.set(CONFIG_TYPE, this.getConfig_type(), this.isset_config_type); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(REMARK, this.getRemark(), this.isset_remark); + ub.set(DATA_TYPE, this.getData_type(), this.isset_data_type); + ub.set(GROUP_ID, this.getGroup_id(), this.isset_group_id); + ub.set(FORM_ID, this.getForm_id(), this.isset_form_id); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CONFIG_NAME, this.getConfig_name(), this.isset_config_name); + ub.set(CONFIG_KEY, this.getConfig_key(), this.isset_config_key); + ub.set(CONFIG_VALUE, this.getConfig_value(), this.isset_config_value); + ub.set(CONFIG_TYPE, this.getConfig_type(), this.isset_config_type); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(REMARK, this.getRemark(), this.isset_remark); + ub.set(DATA_TYPE, this.getData_type(), this.isset_data_type); + ub.set(GROUP_ID, this.getGroup_id(), this.isset_group_id); + ub.set(FORM_ID, this.getForm_id(), this.isset_form_id); + + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CONFIG_NAME, this.getConfig_name(), this.isset_config_name); + ub.set(CONFIG_KEY, this.getConfig_key(), this.isset_config_key); + ub.set(CONFIG_VALUE, this.getConfig_value(), this.isset_config_value); + ub.set(CONFIG_TYPE, this.getConfig_type(), this.isset_config_type); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(REMARK, this.getRemark(), this.isset_remark); + ub.set(DATA_TYPE, this.getData_type(), this.isset_data_type); + ub.set(GROUP_ID, this.getGroup_id(), this.isset_group_id); + ub.set(FORM_ID, this.getForm_id(), this.isset_form_id); + + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select config_id, config_name, config_key, config_value, config_type, create_time, remark, data_type, group_id, form_id from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select config_id, config_name, config_key, config_value, config_type, create_time, remark, data_type, group_id, form_id from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public S_config mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public S_config toS_config() { + return super.$clone(); + } +} + +/** + * s_config RowMapper + * + * @author genrator + */ +class S_configRowMapper implements RowMapper<S_config> { + + @Override + public S_config mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + S_config s_config = new S_config(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, S_config_mapper.CONFIG_ID); + if (columnIndex > 0) { + s_config.setConfig_id(rs.getLong(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, S_config_mapper.CONFIG_NAME); + if (columnIndex > 0) { + s_config.setConfig_name(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_config_mapper.CONFIG_KEY); + if (columnIndex > 0) { + s_config.setConfig_key(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_config_mapper.CONFIG_VALUE); + if (columnIndex > 0) { + s_config.setConfig_value(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_config_mapper.CONFIG_TYPE); + if (columnIndex > 0) { + s_config.setConfig_type(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_config_mapper.CREATE_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_config.setCreate_time(null); + } else { + s_config.setCreate_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_config_mapper.REMARK); + if (columnIndex > 0) { + s_config.setRemark(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_config_mapper.DATA_TYPE); + if (columnIndex > 0) { + s_config.setData_type(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_config_mapper.GROUP_ID); + if (columnIndex > 0) { + s_config.setGroup_id(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_config_mapper.FORM_ID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_config.setForm_id(null); + } else { + s_config.setForm_id(rs.getInt(columnIndex)); + } + } + return s_config; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dept.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dept.java new file mode 100644 index 0000000..bd9c4af --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dept.java @@ -0,0 +1,442 @@ + + +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:S_DEPT * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class S_dept extends BasePo<S_dept> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + /** + * 鐢ㄤ簬鍏煎鑰佸啓娉� + */ + @JsonIgnore + public static final S_dept ROW_MAPPER = new S_dept(); + + // 涓婚敭 + private Long id = null; + @JsonIgnore + protected boolean isset_id = false; + + // 灞炴�у垪琛� + private Long parent_id = null; + @JsonIgnore + protected boolean isset_parent_id = false; + + private Long org_id = null; + @JsonIgnore + protected boolean isset_org_id = false; + + private String ancestors = null; + @JsonIgnore + protected boolean isset_ancestors = false; + + private String dept_name = null; + @JsonIgnore + protected boolean isset_dept_name = false; + + private Integer order_num = null; + @JsonIgnore + protected boolean isset_order_num = false; + + private String leader = null; + @JsonIgnore + protected boolean isset_leader = false; + + private String phone = null; + @JsonIgnore + protected boolean isset_phone = false; + + private String email = null; + @JsonIgnore + protected boolean isset_email = false; + + private Integer status = null; + @JsonIgnore + protected boolean isset_status = false; + + private Integer del_flag = null; + @JsonIgnore + protected boolean isset_del_flag = false; + + private String create_by = null; + @JsonIgnore + protected boolean isset_create_by = false; + + private Long create_time = null; + @JsonIgnore + protected boolean isset_create_time = false; + + private String attribute = null; + @JsonIgnore + protected boolean isset_attribute = false; + + private Integer org_type = null; + @JsonIgnore + protected boolean isset_org_type = false; + + private String charge_man = null; + @JsonIgnore + protected boolean isset_charge_man = false; + + private Integer menu_type = null; + @JsonIgnore + protected boolean isset_menu_type = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_dept() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public S_dept(Long id) { + this.setId(id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setId((Long) value); + } + + public Long getId() { + return this.id; + } + public void setId(Long id) { + this.id = id; + this.isset_id = true; + } + @JsonIgnore + public boolean isEmptyId() { + return this.id == null; + } + + + public Long getParent_id() { + return this.parent_id; + } + public void setParent_id(Long parent_id) { + this.parent_id = parent_id; + this.isset_parent_id = true; + // parent_id, bigint + } + @JsonIgnore + public boolean isEmptyParent_id() { + return this.parent_id == null; + } + + + public Long getOrg_id() { + return this.org_id; + } + public void setOrg_id(Long org_id) { + this.org_id = org_id; + this.isset_org_id = true; + // org_id, bigint + } + @JsonIgnore + public boolean isEmptyOrg_id() { + return this.org_id == null; + } + + + public String getAncestors() { + return this.ancestors; + } + public void setAncestors(String ancestors) { + this.ancestors = ancestors; + this.isset_ancestors = true; + // ancestors, varchar + } + @JsonIgnore + public boolean isEmptyAncestors() { + return this.ancestors == null || this.ancestors.length() == 0; + } + + + public String getDept_name() { + return this.dept_name; + } + public void setDept_name(String dept_name) { + this.dept_name = dept_name; + this.isset_dept_name = true; + // dept_name, varchar + } + @JsonIgnore + public boolean isEmptyDept_name() { + return this.dept_name == null || this.dept_name.length() == 0; + } + + + public Integer getOrder_num() { + return this.order_num; + } + public void setOrder_num(Integer order_num) { + this.order_num = order_num; + this.isset_order_num = true; + // order_num, int + } + @JsonIgnore + public boolean isEmptyOrder_num() { + return this.order_num == null; + } + + + public String getLeader() { + return this.leader; + } + public void setLeader(String leader) { + this.leader = leader; + this.isset_leader = true; + // leader, varchar + } + @JsonIgnore + public boolean isEmptyLeader() { + return this.leader == null || this.leader.length() == 0; + } + + + public String getPhone() { + return this.phone; + } + public void setPhone(String phone) { + this.phone = phone; + this.isset_phone = true; + // phone, varchar + } + @JsonIgnore + public boolean isEmptyPhone() { + return this.phone == null || this.phone.length() == 0; + } + + + public String getEmail() { + return this.email; + } + public void setEmail(String email) { + this.email = email; + this.isset_email = true; + // email, varchar + } + @JsonIgnore + public boolean isEmptyEmail() { + return this.email == null || this.email.length() == 0; + } + + + public Integer getStatus() { + return this.status; + } + public void setStatus(Integer status) { + this.status = status; + this.isset_status = true; + // status, int + } + @JsonIgnore + public boolean isEmptyStatus() { + return this.status == null; + } + + + public Integer getDel_flag() { + return this.del_flag; + } + public void setDel_flag(Integer del_flag) { + this.del_flag = del_flag; + this.isset_del_flag = true; + // del_flag, int + } + @JsonIgnore + public boolean isEmptyDel_flag() { + return this.del_flag == null; + } + + + public String getCreate_by() { + return this.create_by; + } + public void setCreate_by(String create_by) { + this.create_by = create_by; + this.isset_create_by = true; + // create_by, varchar + } + @JsonIgnore + public boolean isEmptyCreate_by() { + return this.create_by == null || this.create_by.length() == 0; + } + + + public Long getCreate_time() { + return this.create_time; + } + public void setCreate_time(Long create_time) { + this.create_time = create_time; + this.isset_create_time = true; + // create_time, bigint + } + @JsonIgnore + public boolean isEmptyCreate_time() { + return this.create_time == null; + } + + + public String getAttribute() { + return this.attribute; + } + public void setAttribute(String attribute) { + this.attribute = attribute; + this.isset_attribute = true; + // attribute, varchar + } + @JsonIgnore + public boolean isEmptyAttribute() { + return this.attribute == null || this.attribute.length() == 0; + } + + + public Integer getOrg_type() { + return this.org_type; + } + public void setOrg_type(Integer org_type) { + this.org_type = org_type; + this.isset_org_type = true; + // org_type, int + } + @JsonIgnore + public boolean isEmptyOrg_type() { + return this.org_type == null; + } + + + public String getCharge_man() { + return this.charge_man; + } + public void setCharge_man(String charge_man) { + this.charge_man = charge_man; + this.isset_charge_man = true; + // charge_man, varchar + } + @JsonIgnore + public boolean isEmptyCharge_man() { + return this.charge_man == null || this.charge_man.length() == 0; + } + + + public Integer getMenu_type() { + return this.menu_type; + } + public void setMenu_type(Integer menu_type) { + this.menu_type = menu_type; + this.isset_menu_type = true; + // menu_type, int + } + @JsonIgnore + public boolean isEmptyMenu_type() { + return this.menu_type == null; + } + + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("id=").append(this.id) + .append("parent_id=").append(this.parent_id) + .append("org_id=").append(this.org_id) + .append("ancestors=").append(this.ancestors) + .append("dept_name=").append(this.dept_name) + .append("order_num=").append(this.order_num) + .append("leader=").append(this.leader) + .append("phone=").append(this.phone) + .append("email=").append(this.email) + .append("status=").append(this.status) + .append("del_flag=").append(this.del_flag) + .append("create_by=").append(this.create_by) + .append("create_time=").append(this.create_time) + .append("attribute=").append(this.attribute) + .append("org_type=").append(this.org_type) + .append("charge_man=").append(this.charge_man) + .append("menu_type=").append(this.menu_type) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public S_dept $clone() { + S_dept s_dept = new S_dept(); + + // 鏁版嵁搴撳悕绉� + //s_dept.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_id) { + s_dept.setId(this.getId()); + } + // 鏅�氬睘鎬� + if (this.isset_parent_id) { + s_dept.setParent_id(this.getParent_id()); + } + if (this.isset_org_id) { + s_dept.setOrg_id(this.getOrg_id()); + } + if (this.isset_ancestors) { + s_dept.setAncestors(this.getAncestors()); + } + if (this.isset_dept_name) { + s_dept.setDept_name(this.getDept_name()); + } + if (this.isset_order_num) { + s_dept.setOrder_num(this.getOrder_num()); + } + if (this.isset_leader) { + s_dept.setLeader(this.getLeader()); + } + if (this.isset_phone) { + s_dept.setPhone(this.getPhone()); + } + if (this.isset_email) { + s_dept.setEmail(this.getEmail()); + } + if (this.isset_status) { + s_dept.setStatus(this.getStatus()); + } + if (this.isset_del_flag) { + s_dept.setDel_flag(this.getDel_flag()); + } + if (this.isset_create_by) { + s_dept.setCreate_by(this.getCreate_by()); + } + if (this.isset_create_time) { + s_dept.setCreate_time(this.getCreate_time()); + } + if (this.isset_attribute) { + s_dept.setAttribute(this.getAttribute()); + } + if (this.isset_org_type) { + s_dept.setOrg_type(this.getOrg_type()); + } + if (this.isset_charge_man) { + s_dept.setCharge_man(this.getCharge_man()); + } + if (this.isset_menu_type) { + s_dept.setMenu_type(this.getMenu_type()); + } + return s_dept; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dept_mapper.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dept_mapper.java new file mode 100644 index 0000000..fc58edf --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dept_mapper.java @@ -0,0 +1,435 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:S_DEPT * + * @author genrator + */ +public class S_dept_mapper extends S_dept implements BaseMapper<S_dept> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<S_dept> ROW_MAPPER = new S_deptRowMapper(); + + // 涓婚敭 + public static final String ID = "id"; + // 鏅�氬睘鎬� + public static final String PARENT_ID = "parent_id"; + public static final String ORG_ID = "org_id"; + public static final String ANCESTORS = "ancestors"; + public static final String DEPT_NAME = "dept_name"; + public static final String ORDER_NUM = "order_num"; + public static final String LEADER = "leader"; + public static final String PHONE = "phone"; + public static final String EMAIL = "email"; + public static final String STATUS = "status"; + public static final String DEL_FLAG = "del_flag"; + public static final String CREATE_BY = "create_by"; + public static final String CREATE_TIME = "create_time"; + public static final String ATTRIBUTE = "attribute"; + public static final String ORG_TYPE = "org_type"; + public static final String CHARGE_MAN = "charge_man"; + public static final String MENU_TYPE = "menu_type"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_dept_mapper(S_dept s_dept) { + if (s_dept == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (s_dept.isset_id) { + this.setId(s_dept.getId()); + } + //鏅�氬睘鎬� + if (s_dept.isset_parent_id) { + this.setParent_id(s_dept.getParent_id()); + } + if (s_dept.isset_org_id) { + this.setOrg_id(s_dept.getOrg_id()); + } + if (s_dept.isset_ancestors) { + this.setAncestors(s_dept.getAncestors()); + } + if (s_dept.isset_dept_name) { + this.setDept_name(s_dept.getDept_name()); + } + if (s_dept.isset_order_num) { + this.setOrder_num(s_dept.getOrder_num()); + } + if (s_dept.isset_leader) { + this.setLeader(s_dept.getLeader()); + } + if (s_dept.isset_phone) { + this.setPhone(s_dept.getPhone()); + } + if (s_dept.isset_email) { + this.setEmail(s_dept.getEmail()); + } + if (s_dept.isset_status) { + this.setStatus(s_dept.getStatus()); + } + if (s_dept.isset_del_flag) { + this.setDel_flag(s_dept.getDel_flag()); + } + if (s_dept.isset_create_by) { + this.setCreate_by(s_dept.getCreate_by()); + } + if (s_dept.isset_create_time) { + this.setCreate_time(s_dept.getCreate_time()); + } + if (s_dept.isset_attribute) { + this.setAttribute(s_dept.getAttribute()); + } + if (s_dept.isset_org_type) { + this.setOrg_type(s_dept.getOrg_type()); + } + if (s_dept.isset_charge_man) { + this.setCharge_man(s_dept.getCharge_man()); + } + if (s_dept.isset_menu_type) { + this.setMenu_type(s_dept.getMenu_type()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(s_dept.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "s_dept"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return ID; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getId(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(ID, this.getId()); + ib.set(PARENT_ID, this.getParent_id(), this.isset_parent_id); + ib.set(ORG_ID, this.getOrg_id(), this.isset_org_id); + ib.set(ANCESTORS, this.getAncestors(), this.isset_ancestors); + ib.set(DEPT_NAME, this.getDept_name(), this.isset_dept_name); + ib.set(ORDER_NUM, this.getOrder_num(), this.isset_order_num); + ib.set(LEADER, this.getLeader(), this.isset_leader); + ib.set(PHONE, this.getPhone(), this.isset_phone); + ib.set(EMAIL, this.getEmail(), this.isset_email); + ib.set(STATUS, this.getStatus(), this.isset_status); + ib.set(DEL_FLAG, this.getDel_flag(), this.isset_del_flag); + ib.set(CREATE_BY, this.getCreate_by(), this.isset_create_by); + ib.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ib.set(ATTRIBUTE, this.getAttribute(), this.isset_attribute); + ib.set(ORG_TYPE, this.getOrg_type(), this.isset_org_type); + ib.set(CHARGE_MAN, this.getCharge_man(), this.isset_charge_man); + ib.set(MENU_TYPE, this.getMenu_type(), this.isset_menu_type); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(PARENT_ID, this.getParent_id(), this.isset_parent_id); + ub.set(ORG_ID, this.getOrg_id(), this.isset_org_id); + ub.set(ANCESTORS, this.getAncestors(), this.isset_ancestors); + ub.set(DEPT_NAME, this.getDept_name(), this.isset_dept_name); + ub.set(ORDER_NUM, this.getOrder_num(), this.isset_order_num); + ub.set(LEADER, this.getLeader(), this.isset_leader); + ub.set(PHONE, this.getPhone(), this.isset_phone); + ub.set(EMAIL, this.getEmail(), this.isset_email); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(DEL_FLAG, this.getDel_flag(), this.isset_del_flag); + ub.set(CREATE_BY, this.getCreate_by(), this.isset_create_by); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(ATTRIBUTE, this.getAttribute(), this.isset_attribute); + ub.set(ORG_TYPE, this.getOrg_type(), this.isset_org_type); + ub.set(CHARGE_MAN, this.getCharge_man(), this.isset_charge_man); + ub.set(MENU_TYPE, this.getMenu_type(), this.isset_menu_type); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(PARENT_ID, this.getParent_id(), this.isset_parent_id); + ub.set(ORG_ID, this.getOrg_id(), this.isset_org_id); + ub.set(ANCESTORS, this.getAncestors(), this.isset_ancestors); + ub.set(DEPT_NAME, this.getDept_name(), this.isset_dept_name); + ub.set(ORDER_NUM, this.getOrder_num(), this.isset_order_num); + ub.set(LEADER, this.getLeader(), this.isset_leader); + ub.set(PHONE, this.getPhone(), this.isset_phone); + ub.set(EMAIL, this.getEmail(), this.isset_email); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(DEL_FLAG, this.getDel_flag(), this.isset_del_flag); + ub.set(CREATE_BY, this.getCreate_by(), this.isset_create_by); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(ATTRIBUTE, this.getAttribute(), this.isset_attribute); + ub.set(ORG_TYPE, this.getOrg_type(), this.isset_org_type); + ub.set(CHARGE_MAN, this.getCharge_man(), this.isset_charge_man); + ub.set(MENU_TYPE, this.getMenu_type(), this.isset_menu_type); + + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(PARENT_ID, this.getParent_id(), this.isset_parent_id); + ub.set(ORG_ID, this.getOrg_id(), this.isset_org_id); + ub.set(ANCESTORS, this.getAncestors(), this.isset_ancestors); + ub.set(DEPT_NAME, this.getDept_name(), this.isset_dept_name); + ub.set(ORDER_NUM, this.getOrder_num(), this.isset_order_num); + ub.set(LEADER, this.getLeader(), this.isset_leader); + ub.set(PHONE, this.getPhone(), this.isset_phone); + ub.set(EMAIL, this.getEmail(), this.isset_email); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(DEL_FLAG, this.getDel_flag(), this.isset_del_flag); + ub.set(CREATE_BY, this.getCreate_by(), this.isset_create_by); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(ATTRIBUTE, this.getAttribute(), this.isset_attribute); + ub.set(ORG_TYPE, this.getOrg_type(), this.isset_org_type); + ub.set(CHARGE_MAN, this.getCharge_man(), this.isset_charge_man); + ub.set(MENU_TYPE, this.getMenu_type(), this.isset_menu_type); + + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select id, parent_id, org_id, ancestors, dept_name, order_num, leader, phone, email, status, del_flag, create_by, create_time, attribute, org_type, charge_man, menu_type from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select id, parent_id, org_id, ancestors, dept_name, order_num, leader, phone, email, status, del_flag, create_by, create_time, attribute, org_type, charge_man, menu_type from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public S_dept mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public S_dept toS_dept() { + return super.$clone(); + } +} + +/** + * s_dept RowMapper + * + * @author genrator + */ +class S_deptRowMapper implements RowMapper<S_dept> { + + @Override + public S_dept mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + S_dept s_dept = new S_dept(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, S_dept_mapper.ID); + if (columnIndex > 0) { + s_dept.setId(rs.getLong(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, S_dept_mapper.PARENT_ID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_dept.setParent_id(null); + } else { + s_dept.setParent_id(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_dept_mapper.ORG_ID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_dept.setOrg_id(null); + } else { + s_dept.setOrg_id(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_dept_mapper.ANCESTORS); + if (columnIndex > 0) { + s_dept.setAncestors(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_dept_mapper.DEPT_NAME); + if (columnIndex > 0) { + s_dept.setDept_name(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_dept_mapper.ORDER_NUM); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_dept.setOrder_num(null); + } else { + s_dept.setOrder_num(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_dept_mapper.LEADER); + if (columnIndex > 0) { + s_dept.setLeader(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_dept_mapper.PHONE); + if (columnIndex > 0) { + s_dept.setPhone(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_dept_mapper.EMAIL); + if (columnIndex > 0) { + s_dept.setEmail(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_dept_mapper.STATUS); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_dept.setStatus(null); + } else { + s_dept.setStatus(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_dept_mapper.DEL_FLAG); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_dept.setDel_flag(null); + } else { + s_dept.setDel_flag(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_dept_mapper.CREATE_BY); + if (columnIndex > 0) { + s_dept.setCreate_by(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_dept_mapper.CREATE_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_dept.setCreate_time(null); + } else { + s_dept.setCreate_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_dept_mapper.ATTRIBUTE); + if (columnIndex > 0) { + s_dept.setAttribute(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_dept_mapper.ORG_TYPE); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_dept.setOrg_type(null); + } else { + s_dept.setOrg_type(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_dept_mapper.CHARGE_MAN); + if (columnIndex > 0) { + s_dept.setCharge_man(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_dept_mapper.MENU_TYPE); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_dept.setMenu_type(null); + } else { + s_dept.setMenu_type(rs.getInt(columnIndex)); + } + } + return s_dept; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dialog_history.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dialog_history.java new file mode 100644 index 0000000..522dda2 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dialog_history.java @@ -0,0 +1,273 @@ + + +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:S_DIALOG_HISTORY * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class S_dialog_history extends BasePo<S_dialog_history> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + // 涓婚敭 + private String id = null; + @JsonIgnore + protected boolean isset_id = false; + + // 灞炴�у垪琛� + private Long create_time = null; + @JsonIgnore + protected boolean isset_create_time = false; + + private String user_id = null; + @JsonIgnore + protected boolean isset_user_id = false; + + private String customer_service = null; + @JsonIgnore + protected boolean isset_customer_service = false; + + private Long start_time = null; + @JsonIgnore + protected boolean isset_start_time = false; + + private String data = null; + @JsonIgnore + protected boolean isset_data = false; + + private Long end_time = null; + @JsonIgnore + protected boolean isset_end_time = false; + + private Integer uuid = null; + @JsonIgnore + protected boolean isset_uuid = false; + + private String terminate_type = null; + @JsonIgnore + protected boolean isset_terminate_type = false; + + private Integer evaluation = null; + @JsonIgnore + protected boolean isset_evaluation = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_dialog_history() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public S_dialog_history(String id) { + this.setId(id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setId((String) value); + } + + public String getId() { + return this.id; + } + public void setId(String id) { + this.id = id; + this.isset_id = true; + } + @JsonIgnore + public boolean isEmptyId() { + return this.id == null || this.id.length() == 0; + } + + + public Long getCreate_time() { + return this.create_time; + } + public void setCreate_time(Long create_time) { + this.create_time = create_time; + this.isset_create_time = true; + } + @JsonIgnore + public boolean isEmptyCreate_time() { + return this.create_time == null; + } + + + public String getUser_id() { + return this.user_id; + } + public void setUser_id(String user_id) { + this.user_id = user_id; + this.isset_user_id = true; + } + @JsonIgnore + public boolean isEmptyUser_id() { + return this.user_id == null || this.user_id.length() == 0; + } + + + public String getCustomer_service() { + return this.customer_service; + } + public void setCustomer_service(String customer_service) { + this.customer_service = customer_service; + this.isset_customer_service = true; + } + @JsonIgnore + public boolean isEmptyCustomer_service() { + return this.customer_service == null || this.customer_service.length() == 0; + } + + + public Long getStart_time() { + return this.start_time; + } + public void setStart_time(Long start_time) { + this.start_time = start_time; + this.isset_start_time = true; + } + @JsonIgnore + public boolean isEmptyStart_time() { + return this.start_time == null; + } + + + public String getData() { + return this.data; + } + public void setData(String data) { + this.data = data; + this.isset_data = true; + } + @JsonIgnore + public boolean isEmptyData() { + return this.data == null || this.data.length() == 0; + } + + + public Long getEnd_time() { + return this.end_time; + } + public void setEnd_time(Long end_time) { + this.end_time = end_time; + this.isset_end_time = true; + } + @JsonIgnore + public boolean isEmptyEnd_time() { + return this.end_time == null; + } + + + public Integer getUuid() { + return this.uuid; + } + public void setUuid(Integer uuid) { + this.uuid = uuid; + this.isset_uuid = true; + } + @JsonIgnore + public boolean isEmptyUuid() { + return this.uuid == null; + } + + + public String getTerminate_type() { + return this.terminate_type; + } + public void setTerminate_type(String terminate_type) { + this.terminate_type = terminate_type; + this.isset_terminate_type = true; + } + @JsonIgnore + public boolean isEmptyTerminate_type() { + return this.terminate_type == null || this.terminate_type.length() == 0; + } + + + public Integer getEvaluation() { + return this.evaluation; + } + public void setEvaluation(Integer evaluation) { + this.evaluation = evaluation; + this.isset_evaluation = true; + } + @JsonIgnore + public boolean isEmptyEvaluation() { + return this.evaluation == null; + } + + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("id=").append(this.id) + .append("create_time=").append(this.create_time) + .append("user_id=").append(this.user_id) + .append("customer_service=").append(this.customer_service) + .append("start_time=").append(this.start_time) + .append("data=").append(this.data) + .append("end_time=").append(this.end_time) + .append("uuid=").append(this.uuid) + .append("terminate_type=").append(this.terminate_type) + .append("evaluation=").append(this.evaluation) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public S_dialog_history $clone() { + S_dialog_history s_dialog_history = new S_dialog_history(); + + // 鏁版嵁搴撳悕绉� + //s_dialog_history.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_id) { + s_dialog_history.setId(this.getId()); + } + // 鏅�氬睘鎬� + if (this.isset_create_time) { + s_dialog_history.setCreate_time(this.getCreate_time()); + } + if (this.isset_user_id) { + s_dialog_history.setUser_id(this.getUser_id()); + } + if (this.isset_customer_service) { + s_dialog_history.setCustomer_service(this.getCustomer_service()); + } + if (this.isset_start_time) { + s_dialog_history.setStart_time(this.getStart_time()); + } + if (this.isset_data) { + s_dialog_history.setData(this.getData()); + } + if (this.isset_end_time) { + s_dialog_history.setEnd_time(this.getEnd_time()); + } + if (this.isset_uuid) { + s_dialog_history.setUuid(this.getUuid()); + } + if (this.isset_terminate_type) { + s_dialog_history.setTerminate_type(this.getTerminate_type()); + } + if (this.isset_evaluation) { + s_dialog_history.setEvaluation(this.getEvaluation()); + } + return s_dialog_history; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dialog_history_mapper.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dialog_history_mapper.java new file mode 100644 index 0000000..ac09a20 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dialog_history_mapper.java @@ -0,0 +1,339 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:S_DIALOG_HISTORY * + * @author genrator + */ +public class S_dialog_history_mapper extends S_dialog_history implements BaseMapper<S_dialog_history> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<S_dialog_history> ROW_MAPPER = new S_dialog_historyRowMapper(); + + // 涓婚敭 + public static final String ID = "id"; + // 鏅�氬睘鎬� + public static final String CREATE_TIME = "create_time"; + public static final String USER_ID = "user_id"; + public static final String CUSTOMER_SERVICE = "customer_service"; + public static final String START_TIME = "start_time"; + public static final String DATA = "data"; + public static final String END_TIME = "end_time"; + public static final String UUID = "uuid"; + public static final String TERMINATE_TYPE = "terminate_type"; + public static final String EVALUATION = "evaluation"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_dialog_history_mapper(S_dialog_history s_dialog_history) { + if (s_dialog_history == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (s_dialog_history.isset_id) { + this.setId(s_dialog_history.getId()); + } + //鏅�氬睘鎬� + if (s_dialog_history.isset_create_time) { + this.setCreate_time(s_dialog_history.getCreate_time()); + } + if (s_dialog_history.isset_user_id) { + this.setUser_id(s_dialog_history.getUser_id()); + } + if (s_dialog_history.isset_customer_service) { + this.setCustomer_service(s_dialog_history.getCustomer_service()); + } + if (s_dialog_history.isset_start_time) { + this.setStart_time(s_dialog_history.getStart_time()); + } + if (s_dialog_history.isset_data) { + this.setData(s_dialog_history.getData()); + } + if (s_dialog_history.isset_end_time) { + this.setEnd_time(s_dialog_history.getEnd_time()); + } + if (s_dialog_history.isset_uuid) { + this.setUuid(s_dialog_history.getUuid()); + } + if (s_dialog_history.isset_terminate_type) { + this.setTerminate_type(s_dialog_history.getTerminate_type()); + } + if (s_dialog_history.isset_evaluation) { + this.setEvaluation(s_dialog_history.getEvaluation()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(s_dialog_history.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "s_dialog_history"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return ID; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getId(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(ID, this.getId()); + ib.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ib.set(USER_ID, this.getUser_id(), this.isset_user_id); + ib.set(CUSTOMER_SERVICE, this.getCustomer_service(), this.isset_customer_service); + ib.set(START_TIME, this.getStart_time(), this.isset_start_time); + ib.set(DATA, this.getData(), this.isset_data); + ib.set(END_TIME, this.getEnd_time(), this.isset_end_time); + ib.set(UUID, this.getUuid(), this.isset_uuid); + ib.set(TERMINATE_TYPE, this.getTerminate_type(), this.isset_terminate_type); + ib.set(EVALUATION, this.getEvaluation(), this.isset_evaluation); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(USER_ID, this.getUser_id(), this.isset_user_id); + ub.set(CUSTOMER_SERVICE, this.getCustomer_service(), this.isset_customer_service); + ub.set(START_TIME, this.getStart_time(), this.isset_start_time); + ub.set(DATA, this.getData(), this.isset_data); + ub.set(END_TIME, this.getEnd_time(), this.isset_end_time); + ub.set(UUID, this.getUuid(), this.isset_uuid); + ub.set(TERMINATE_TYPE, this.getTerminate_type(), this.isset_terminate_type); + ub.set(EVALUATION, this.getEvaluation(), this.isset_evaluation); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(USER_ID, this.getUser_id(), this.isset_user_id); + ub.set(CUSTOMER_SERVICE, this.getCustomer_service(), this.isset_customer_service); + ub.set(START_TIME, this.getStart_time(), this.isset_start_time); + ub.set(DATA, this.getData(), this.isset_data); + ub.set(END_TIME, this.getEnd_time(), this.isset_end_time); + ub.set(UUID, this.getUuid(), this.isset_uuid); + ub.set(TERMINATE_TYPE, this.getTerminate_type(), this.isset_terminate_type); + ub.set(EVALUATION, this.getEvaluation(), this.isset_evaluation); + + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(USER_ID, this.getUser_id(), this.isset_user_id); + ub.set(CUSTOMER_SERVICE, this.getCustomer_service(), this.isset_customer_service); + ub.set(START_TIME, this.getStart_time(), this.isset_start_time); + ub.set(DATA, this.getData(), this.isset_data); + ub.set(END_TIME, this.getEnd_time(), this.isset_end_time); + ub.set(UUID, this.getUuid(), this.isset_uuid); + ub.set(TERMINATE_TYPE, this.getTerminate_type(), this.isset_terminate_type); + ub.set(EVALUATION, this.getEvaluation(), this.isset_evaluation); + + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select id, create_time, user_id, customer_service, start_time, data, end_time, uuid, terminate_type, evaluation from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select id, create_time, user_id, customer_service, start_time, data, end_time, uuid, terminate_type, evaluation from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public S_dialog_history mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public S_dialog_history toS_dialog_history() { + return super.$clone(); + } +} + +/** + * s_dialog_history RowMapper + * + * @author genrator + */ +class S_dialog_historyRowMapper implements RowMapper<S_dialog_history> { + + @Override + public S_dialog_history mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + S_dialog_history s_dialog_history = new S_dialog_history(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, S_dialog_history_mapper.ID); + if (columnIndex > 0) { + s_dialog_history.setId(rs.getString(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, S_dialog_history_mapper.CREATE_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_dialog_history.setCreate_time(null); + } else { + s_dialog_history.setCreate_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_dialog_history_mapper.USER_ID); + if (columnIndex > 0) { + s_dialog_history.setUser_id(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_dialog_history_mapper.CUSTOMER_SERVICE); + if (columnIndex > 0) { + s_dialog_history.setCustomer_service(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_dialog_history_mapper.START_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_dialog_history.setStart_time(null); + } else { + s_dialog_history.setStart_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_dialog_history_mapper.DATA); + if (columnIndex > 0) { + s_dialog_history.setData(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_dialog_history_mapper.END_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_dialog_history.setEnd_time(null); + } else { + s_dialog_history.setEnd_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_dialog_history_mapper.UUID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_dialog_history.setUuid(null); + } else { + s_dialog_history.setUuid(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_dialog_history_mapper.TERMINATE_TYPE); + if (columnIndex > 0) { + s_dialog_history.setTerminate_type(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_dialog_history_mapper.EVALUATION); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_dialog_history.setEvaluation(null); + } else { + s_dialog_history.setEvaluation(rs.getInt(columnIndex)); + } + } + return s_dialog_history; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dialog_run.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dialog_run.java new file mode 100644 index 0000000..8b1f7d0 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dialog_run.java @@ -0,0 +1,231 @@ + + +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:S_DIALOG_RUN * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class S_dialog_run extends BasePo<S_dialog_run> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + // 涓婚敭 + private String id = null; + @JsonIgnore + protected boolean isset_id = false; + + // 灞炴�у垪琛� + private Long create_time = null; + @JsonIgnore + protected boolean isset_create_time = false; + + private String user_id = null; + @JsonIgnore + protected boolean isset_user_id = false; + + private String customer_service = null; + @JsonIgnore + protected boolean isset_customer_service = false; + + private Long start_time = null; + @JsonIgnore + protected boolean isset_start_time = false; + + private String data = null; + @JsonIgnore + protected boolean isset_data = false; + + private Integer uuid = null; + @JsonIgnore + protected boolean isset_uuid = false; + + private String dialog_id = null; + @JsonIgnore + protected boolean isset_dialog_id = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_dialog_run() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public S_dialog_run(String id) { + this.setId(id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setId((String) value); + } + + public String getId() { + return this.id; + } + public void setId(String id) { + this.id = id; + this.isset_id = true; + } + @JsonIgnore + public boolean isEmptyId() { + return this.id == null || this.id.length() == 0; + } + + + public Long getCreate_time() { + return this.create_time; + } + public void setCreate_time(Long create_time) { + this.create_time = create_time; + this.isset_create_time = true; + } + @JsonIgnore + public boolean isEmptyCreate_time() { + return this.create_time == null; + } + + + public String getUser_id() { + return this.user_id; + } + public void setUser_id(String user_id) { + this.user_id = user_id; + this.isset_user_id = true; + } + @JsonIgnore + public boolean isEmptyUser_id() { + return this.user_id == null || this.user_id.length() == 0; + } + + + public String getCustomer_service() { + return this.customer_service; + } + public void setCustomer_service(String customer_service) { + this.customer_service = customer_service; + this.isset_customer_service = true; + } + @JsonIgnore + public boolean isEmptyCustomer_service() { + return this.customer_service == null || this.customer_service.length() == 0; + } + + + public Long getStart_time() { + return this.start_time; + } + public void setStart_time(Long start_time) { + this.start_time = start_time; + this.isset_start_time = true; + } + @JsonIgnore + public boolean isEmptyStart_time() { + return this.start_time == null; + } + + + public String getData() { + return this.data; + } + public void setData(String data) { + this.data = data; + this.isset_data = true; + } + @JsonIgnore + public boolean isEmptyData() { + return this.data == null || this.data.length() == 0; + } + + + public Integer getUuid() { + return this.uuid; + } + public void setUuid(Integer uuid) { + this.uuid = uuid; + this.isset_uuid = true; + } + @JsonIgnore + public boolean isEmptyUuid() { + return this.uuid == null; + } + + + public String getDialog_id() { + return this.dialog_id; + } + public void setDialog_id(String dialog_id) { + this.dialog_id = dialog_id; + this.isset_dialog_id = true; + } + @JsonIgnore + public boolean isEmptyDialog_id() { + return this.dialog_id == null || this.dialog_id.length() == 0; + } + + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("id=").append(this.id) + .append("create_time=").append(this.create_time) + .append("user_id=").append(this.user_id) + .append("customer_service=").append(this.customer_service) + .append("start_time=").append(this.start_time) + .append("data=").append(this.data) + .append("uuid=").append(this.uuid) + .append("dialog_id=").append(this.dialog_id) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public S_dialog_run $clone() { + S_dialog_run s_dialog_run = new S_dialog_run(); + + // 鏁版嵁搴撳悕绉� + //s_dialog_run.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_id) { + s_dialog_run.setId(this.getId()); + } + // 鏅�氬睘鎬� + if (this.isset_create_time) { + s_dialog_run.setCreate_time(this.getCreate_time()); + } + if (this.isset_user_id) { + s_dialog_run.setUser_id(this.getUser_id()); + } + if (this.isset_customer_service) { + s_dialog_run.setCustomer_service(this.getCustomer_service()); + } + if (this.isset_start_time) { + s_dialog_run.setStart_time(this.getStart_time()); + } + if (this.isset_data) { + s_dialog_run.setData(this.getData()); + } + if (this.isset_uuid) { + s_dialog_run.setUuid(this.getUuid()); + } + if (this.isset_dialog_id) { + s_dialog_run.setDialog_id(this.getDialog_id()); + } + return s_dialog_run; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dialog_run_mapper.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dialog_run_mapper.java new file mode 100644 index 0000000..917b33b --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dialog_run_mapper.java @@ -0,0 +1,307 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:S_DIALOG_RUN * + * @author genrator + */ +public class S_dialog_run_mapper extends S_dialog_run implements BaseMapper<S_dialog_run> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<S_dialog_run> ROW_MAPPER = new S_dialog_runRowMapper(); + + // 涓婚敭 + public static final String ID = "id"; + // 鏅�氬睘鎬� + public static final String CREATE_TIME = "create_time"; + public static final String USER_ID = "user_id"; + public static final String CUSTOMER_SERVICE = "customer_service"; + public static final String START_TIME = "start_time"; + public static final String DATA = "data"; + public static final String UUID = "uuid"; + public static final String DIALOG_ID = "dialog_id"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_dialog_run_mapper(S_dialog_run s_dialog_run) { + if (s_dialog_run == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (s_dialog_run.isset_id) { + this.setId(s_dialog_run.getId()); + } + //鏅�氬睘鎬� + if (s_dialog_run.isset_create_time) { + this.setCreate_time(s_dialog_run.getCreate_time()); + } + if (s_dialog_run.isset_user_id) { + this.setUser_id(s_dialog_run.getUser_id()); + } + if (s_dialog_run.isset_customer_service) { + this.setCustomer_service(s_dialog_run.getCustomer_service()); + } + if (s_dialog_run.isset_start_time) { + this.setStart_time(s_dialog_run.getStart_time()); + } + if (s_dialog_run.isset_data) { + this.setData(s_dialog_run.getData()); + } + if (s_dialog_run.isset_uuid) { + this.setUuid(s_dialog_run.getUuid()); + } + if (s_dialog_run.isset_dialog_id) { + this.setDialog_id(s_dialog_run.getDialog_id()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(s_dialog_run.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "s_dialog_run"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return ID; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getId(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(ID, this.getId()); + ib.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ib.set(USER_ID, this.getUser_id(), this.isset_user_id); + ib.set(CUSTOMER_SERVICE, this.getCustomer_service(), this.isset_customer_service); + ib.set(START_TIME, this.getStart_time(), this.isset_start_time); + ib.set(DATA, this.getData(), this.isset_data); + ib.set(UUID, this.getUuid(), this.isset_uuid); + ib.set(DIALOG_ID, this.getDialog_id(), this.isset_dialog_id); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(USER_ID, this.getUser_id(), this.isset_user_id); + ub.set(CUSTOMER_SERVICE, this.getCustomer_service(), this.isset_customer_service); + ub.set(START_TIME, this.getStart_time(), this.isset_start_time); + ub.set(DATA, this.getData(), this.isset_data); + ub.set(UUID, this.getUuid(), this.isset_uuid); + ub.set(DIALOG_ID, this.getDialog_id(), this.isset_dialog_id); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(USER_ID, this.getUser_id(), this.isset_user_id); + ub.set(CUSTOMER_SERVICE, this.getCustomer_service(), this.isset_customer_service); + ub.set(START_TIME, this.getStart_time(), this.isset_start_time); + ub.set(DATA, this.getData(), this.isset_data); + ub.set(UUID, this.getUuid(), this.isset_uuid); + ub.set(DIALOG_ID, this.getDialog_id(), this.isset_dialog_id); + + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(USER_ID, this.getUser_id(), this.isset_user_id); + ub.set(CUSTOMER_SERVICE, this.getCustomer_service(), this.isset_customer_service); + ub.set(START_TIME, this.getStart_time(), this.isset_start_time); + ub.set(DATA, this.getData(), this.isset_data); + ub.set(UUID, this.getUuid(), this.isset_uuid); + ub.set(DIALOG_ID, this.getDialog_id(), this.isset_dialog_id); + + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select id, create_time, user_id, customer_service, start_time, data, uuid, dialog_id from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select id, create_time, user_id, customer_service, start_time, data, uuid, dialog_id from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public S_dialog_run mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public S_dialog_run toS_dialog_run() { + return super.$clone(); + } +} + +/** + * s_dialog_run RowMapper + * + * @author genrator + */ +class S_dialog_runRowMapper implements RowMapper<S_dialog_run> { + + @Override + public S_dialog_run mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + S_dialog_run s_dialog_run = new S_dialog_run(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, S_dialog_run_mapper.ID); + if (columnIndex > 0) { + s_dialog_run.setId(rs.getString(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, S_dialog_run_mapper.CREATE_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_dialog_run.setCreate_time(null); + } else { + s_dialog_run.setCreate_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_dialog_run_mapper.USER_ID); + if (columnIndex > 0) { + s_dialog_run.setUser_id(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_dialog_run_mapper.CUSTOMER_SERVICE); + if (columnIndex > 0) { + s_dialog_run.setCustomer_service(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_dialog_run_mapper.START_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_dialog_run.setStart_time(null); + } else { + s_dialog_run.setStart_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_dialog_run_mapper.DATA); + if (columnIndex > 0) { + s_dialog_run.setData(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_dialog_run_mapper.UUID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_dialog_run.setUuid(null); + } else { + s_dialog_run.setUuid(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_dialog_run_mapper.DIALOG_ID); + if (columnIndex > 0) { + s_dialog_run.setDialog_id(rs.getString(columnIndex)); + } + return s_dialog_run; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dict_data.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dict_data.java new file mode 100644 index 0000000..35bdda9 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dict_data.java @@ -0,0 +1,353 @@ +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:S_DICT_DATA * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class S_dict_data extends BasePo<S_dict_data> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + /** + * 鐢ㄤ簬鍏煎鑰佸啓娉� + */ + @JsonIgnore + public static final S_dict_data ROW_MAPPER = new S_dict_data(); + + // 涓婚敭 + private Long dict_code = null; + @JsonIgnore + protected boolean isset_dict_code = false; + + // 灞炴�у垪琛� + private Long parent_id = null; + @JsonIgnore + protected boolean isset_parent_id = false; + + private Integer dict_sort = null; + @JsonIgnore + protected boolean isset_dict_sort = false; + + private String dict_label = null; + @JsonIgnore + protected boolean isset_dict_label = false; + + private String dict_value = null; + @JsonIgnore + protected boolean isset_dict_value = false; + + private String dict_type = null; + @JsonIgnore + protected boolean isset_dict_type = false; + + private String css_class = null; + @JsonIgnore + protected boolean isset_css_class = false; + + private String list_class = null; + @JsonIgnore + protected boolean isset_list_class = false; + + private String is_default = null; + @JsonIgnore + protected boolean isset_is_default = false; + + private Integer status = null; + @JsonIgnore + protected boolean isset_status = false; + + private String create_by = null; + @JsonIgnore + protected boolean isset_create_by = false; + + private Long create_time = null; + @JsonIgnore + protected boolean isset_create_time = false; + + private String remark = null; + @JsonIgnore + protected boolean isset_remark = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_dict_data() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public S_dict_data(Long dict_code) { + this.setDict_code(dict_code); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setDict_code((Long) value); + } + + public Long getDict_code() { + return this.dict_code; + } + + public void setDict_code(Long dict_code) { + this.dict_code = dict_code; + this.isset_dict_code = true; + } + + @JsonIgnore + public boolean isEmptyDict_code() { + return this.dict_code == null; + } + + public Long getParent_id() { + return this.parent_id; + } + + public void setParent_id(Long parent_id) { + this.parent_id = parent_id; + this.isset_parent_id = true; + } + + @JsonIgnore + public boolean isEmptyParent_id() { + return this.parent_id == null; + } + + public Integer getDict_sort() { + return this.dict_sort; + } + + public void setDict_sort(Integer dict_sort) { + this.dict_sort = dict_sort; + this.isset_dict_sort = true; + } + + @JsonIgnore + public boolean isEmptyDict_sort() { + return this.dict_sort == null; + } + + public String getDict_label() { + return this.dict_label; + } + + public void setDict_label(String dict_label) { + this.dict_label = dict_label; + this.isset_dict_label = true; + } + + @JsonIgnore + public boolean isEmptyDict_label() { + return this.dict_label == null || this.dict_label.length() == 0; + } + + public String getDict_value() { + return this.dict_value; + } + + public void setDict_value(String dict_value) { + this.dict_value = dict_value; + this.isset_dict_value = true; + } + + @JsonIgnore + public boolean isEmptyDict_value() { + return this.dict_value == null || this.dict_value.length() == 0; + } + + public String getDict_type() { + return this.dict_type; + } + + public void setDict_type(String dict_type) { + this.dict_type = dict_type; + this.isset_dict_type = true; + } + + @JsonIgnore + public boolean isEmptyDict_type() { + return this.dict_type == null || this.dict_type.length() == 0; + } + + public String getCss_class() { + return this.css_class; + } + + public void setCss_class(String css_class) { + this.css_class = css_class; + this.isset_css_class = true; + } + + @JsonIgnore + public boolean isEmptyCss_class() { + return this.css_class == null || this.css_class.length() == 0; + } + + public String getList_class() { + return this.list_class; + } + + public void setList_class(String list_class) { + this.list_class = list_class; + this.isset_list_class = true; + } + + @JsonIgnore + public boolean isEmptyList_class() { + return this.list_class == null || this.list_class.length() == 0; + } + + public String getIs_default() { + return this.is_default; + } + + public void setIs_default(String is_default) { + this.is_default = is_default; + this.isset_is_default = true; + } + + @JsonIgnore + public boolean isEmptyIs_default() { + return this.is_default == null || this.is_default.length() == 0; + } + + public Integer getStatus() { + return this.status; + } + + public void setStatus(Integer status) { + this.status = status; + this.isset_status = true; + } + + @JsonIgnore + public boolean isEmptyStatus() { + return this.status == null; + } + + public String getCreate_by() { + return this.create_by; + } + + public void setCreate_by(String create_by) { + this.create_by = create_by; + this.isset_create_by = true; + } + + @JsonIgnore + public boolean isEmptyCreate_by() { + return this.create_by == null || this.create_by.length() == 0; + } + + public Long getCreate_time() { + return this.create_time; + } + + public void setCreate_time(Long create_time) { + this.create_time = create_time; + this.isset_create_time = true; + } + + @JsonIgnore + public boolean isEmptyCreate_time() { + return this.create_time == null; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + this.isset_remark = true; + } + + @JsonIgnore + public boolean isEmptyRemark() { + return this.remark == null || this.remark.length() == 0; + } + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("dict_code=").append(this.dict_code) + .append("parent_id=").append(this.parent_id) + .append("dict_sort=").append(this.dict_sort) + .append("dict_label=").append(this.dict_label) + .append("dict_value=").append(this.dict_value) + .append("dict_type=").append(this.dict_type) + .append("css_class=").append(this.css_class) + .append("list_class=").append(this.list_class) + .append("is_default=").append(this.is_default) + .append("status=").append(this.status) + .append("create_by=").append(this.create_by) + .append("create_time=").append(this.create_time) + .append("remark=").append(this.remark) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public S_dict_data $clone() { + S_dict_data s_dict_data = new S_dict_data(); + + // 鏁版嵁搴撳悕绉� + //s_dict_data.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_dict_code) { + s_dict_data.setDict_code(this.getDict_code()); + } + // 鏅�氬睘鎬� + if (this.isset_parent_id) { + s_dict_data.setParent_id(this.getParent_id()); + } + if (this.isset_dict_sort) { + s_dict_data.setDict_sort(this.getDict_sort()); + } + if (this.isset_dict_label) { + s_dict_data.setDict_label(this.getDict_label()); + } + if (this.isset_dict_value) { + s_dict_data.setDict_value(this.getDict_value()); + } + if (this.isset_dict_type) { + s_dict_data.setDict_type(this.getDict_type()); + } + if (this.isset_css_class) { + s_dict_data.setCss_class(this.getCss_class()); + } + if (this.isset_list_class) { + s_dict_data.setList_class(this.getList_class()); + } + if (this.isset_is_default) { + s_dict_data.setIs_default(this.getIs_default()); + } + if (this.isset_status) { + s_dict_data.setStatus(this.getStatus()); + } + if (this.isset_create_by) { + s_dict_data.setCreate_by(this.getCreate_by()); + } + if (this.isset_create_time) { + s_dict_data.setCreate_time(this.getCreate_time()); + } + if (this.isset_remark) { + s_dict_data.setRemark(this.getRemark()); + } + return s_dict_data; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dict_data_mapper.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dict_data_mapper.java new file mode 100644 index 0000000..9a5b792 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dict_data_mapper.java @@ -0,0 +1,371 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:S_DICT_DATA * + * @author genrator + */ +public class S_dict_data_mapper extends S_dict_data implements BaseMapper<S_dict_data> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<S_dict_data> ROW_MAPPER = new S_dict_dataRowMapper(); + + // 涓婚敭 + public static final String DICT_CODE = "dict_code"; + // 鏅�氬睘鎬� + public static final String PARENT_ID = "parent_id"; + public static final String DICT_SORT = "dict_sort"; + public static final String DICT_LABEL = "dict_label"; + public static final String DICT_VALUE = "dict_value"; + public static final String DICT_TYPE = "dict_type"; + public static final String CSS_CLASS = "css_class"; + public static final String LIST_CLASS = "list_class"; + public static final String IS_DEFAULT = "is_default"; + public static final String STATUS = "status"; + public static final String CREATE_BY = "create_by"; + public static final String CREATE_TIME = "create_time"; + public static final String REMARK = "remark"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_dict_data_mapper(S_dict_data s_dict_data) { + if (s_dict_data == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (s_dict_data.isset_dict_code) { + this.setDict_code(s_dict_data.getDict_code()); + } + //鏅�氬睘鎬� + if (s_dict_data.isset_parent_id) { + this.setParent_id(s_dict_data.getParent_id()); + } + if (s_dict_data.isset_dict_sort) { + this.setDict_sort(s_dict_data.getDict_sort()); + } + if (s_dict_data.isset_dict_label) { + this.setDict_label(s_dict_data.getDict_label()); + } + if (s_dict_data.isset_dict_value) { + this.setDict_value(s_dict_data.getDict_value()); + } + if (s_dict_data.isset_dict_type) { + this.setDict_type(s_dict_data.getDict_type()); + } + if (s_dict_data.isset_css_class) { + this.setCss_class(s_dict_data.getCss_class()); + } + if (s_dict_data.isset_list_class) { + this.setList_class(s_dict_data.getList_class()); + } + if (s_dict_data.isset_is_default) { + this.setIs_default(s_dict_data.getIs_default()); + } + if (s_dict_data.isset_status) { + this.setStatus(s_dict_data.getStatus()); + } + if (s_dict_data.isset_create_by) { + this.setCreate_by(s_dict_data.getCreate_by()); + } + if (s_dict_data.isset_create_time) { + this.setCreate_time(s_dict_data.getCreate_time()); + } + if (s_dict_data.isset_remark) { + this.setRemark(s_dict_data.getRemark()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(s_dict_data.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "s_dict_data"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return DICT_CODE; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getDict_code(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(DICT_CODE, this.getDict_code()); + ib.set(PARENT_ID, this.getParent_id(), this.isset_parent_id); + ib.set(DICT_SORT, this.getDict_sort(), this.isset_dict_sort); + ib.set(DICT_LABEL, this.getDict_label(), this.isset_dict_label); + ib.set(DICT_VALUE, this.getDict_value(), this.isset_dict_value); + ib.set(DICT_TYPE, this.getDict_type(), this.isset_dict_type); + ib.set(CSS_CLASS, this.getCss_class(), this.isset_css_class); + ib.set(LIST_CLASS, this.getList_class(), this.isset_list_class); + ib.set(IS_DEFAULT, this.getIs_default(), this.isset_is_default); + ib.set(STATUS, this.getStatus(), this.isset_status); + ib.set(CREATE_BY, this.getCreate_by(), this.isset_create_by); + ib.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ib.set(REMARK, this.getRemark(), this.isset_remark); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(PARENT_ID, this.getParent_id(), this.isset_parent_id); + ub.set(DICT_SORT, this.getDict_sort(), this.isset_dict_sort); + ub.set(DICT_LABEL, this.getDict_label(), this.isset_dict_label); + ub.set(DICT_VALUE, this.getDict_value(), this.isset_dict_value); + ub.set(DICT_TYPE, this.getDict_type(), this.isset_dict_type); + ub.set(CSS_CLASS, this.getCss_class(), this.isset_css_class); + ub.set(LIST_CLASS, this.getList_class(), this.isset_list_class); + ub.set(IS_DEFAULT, this.getIs_default(), this.isset_is_default); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(CREATE_BY, this.getCreate_by(), this.isset_create_by); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(REMARK, this.getRemark(), this.isset_remark); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(PARENT_ID, this.getParent_id(), this.isset_parent_id); + ub.set(DICT_SORT, this.getDict_sort(), this.isset_dict_sort); + ub.set(DICT_LABEL, this.getDict_label(), this.isset_dict_label); + ub.set(DICT_VALUE, this.getDict_value(), this.isset_dict_value); + ub.set(DICT_TYPE, this.getDict_type(), this.isset_dict_type); + ub.set(CSS_CLASS, this.getCss_class(), this.isset_css_class); + ub.set(LIST_CLASS, this.getList_class(), this.isset_list_class); + ub.set(IS_DEFAULT, this.getIs_default(), this.isset_is_default); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(CREATE_BY, this.getCreate_by(), this.isset_create_by); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(REMARK, this.getRemark(), this.isset_remark); + + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(PARENT_ID, this.getParent_id(), this.isset_parent_id); + ub.set(DICT_SORT, this.getDict_sort(), this.isset_dict_sort); + ub.set(DICT_LABEL, this.getDict_label(), this.isset_dict_label); + ub.set(DICT_VALUE, this.getDict_value(), this.isset_dict_value); + ub.set(DICT_TYPE, this.getDict_type(), this.isset_dict_type); + ub.set(CSS_CLASS, this.getCss_class(), this.isset_css_class); + ub.set(LIST_CLASS, this.getList_class(), this.isset_list_class); + ub.set(IS_DEFAULT, this.getIs_default(), this.isset_is_default); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(CREATE_BY, this.getCreate_by(), this.isset_create_by); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(REMARK, this.getRemark(), this.isset_remark); + + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select dict_code, parent_id, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select dict_code, parent_id, dict_sort, dict_label, dict_value, dict_type, css_class, list_class, is_default, status, create_by, create_time, remark from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public S_dict_data mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public S_dict_data toS_dict_data() { + return super.$clone(); + } +} + +/** + * s_dict_data RowMapper + * + * @author genrator + */ +class S_dict_dataRowMapper implements RowMapper<S_dict_data> { + + @Override + public S_dict_data mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + S_dict_data s_dict_data = new S_dict_data(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, S_dict_data_mapper.DICT_CODE); + if (columnIndex > 0) { + s_dict_data.setDict_code(rs.getLong(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, S_dict_data_mapper.PARENT_ID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_dict_data.setParent_id(null); + } else { + s_dict_data.setParent_id(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_dict_data_mapper.DICT_SORT); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_dict_data.setDict_sort(null); + } else { + s_dict_data.setDict_sort(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_dict_data_mapper.DICT_LABEL); + if (columnIndex > 0) { + s_dict_data.setDict_label(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_dict_data_mapper.DICT_VALUE); + if (columnIndex > 0) { + s_dict_data.setDict_value(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_dict_data_mapper.DICT_TYPE); + if (columnIndex > 0) { + s_dict_data.setDict_type(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_dict_data_mapper.CSS_CLASS); + if (columnIndex > 0) { + s_dict_data.setCss_class(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_dict_data_mapper.LIST_CLASS); + if (columnIndex > 0) { + s_dict_data.setList_class(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_dict_data_mapper.IS_DEFAULT); + if (columnIndex > 0) { + s_dict_data.setIs_default(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_dict_data_mapper.STATUS); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_dict_data.setStatus(null); + } else { + s_dict_data.setStatus(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_dict_data_mapper.CREATE_BY); + if (columnIndex > 0) { + s_dict_data.setCreate_by(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_dict_data_mapper.CREATE_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_dict_data.setCreate_time(null); + } else { + s_dict_data.setCreate_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_dict_data_mapper.REMARK); + if (columnIndex > 0) { + s_dict_data.setRemark(rs.getString(columnIndex)); + } + return s_dict_data; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dict_type.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dict_type.java new file mode 100644 index 0000000..c0253ba --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dict_type.java @@ -0,0 +1,221 @@ +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:S_DICT_TYPE * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class S_dict_type extends BasePo<S_dict_type> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + /** + * 鐢ㄤ簬鍏煎鑰佸啓娉� + */ + @JsonIgnore + public static final S_dict_type ROW_MAPPER = new S_dict_type(); + + // 涓婚敭 + private Long dict_id = null; + @JsonIgnore + protected boolean isset_dict_id = false; + + // 灞炴�у垪琛� + private String dict_name = null; + @JsonIgnore + protected boolean isset_dict_name = false; + + private String dict_type = null; + @JsonIgnore + protected boolean isset_dict_type = false; + + private Integer status = null; + @JsonIgnore + protected boolean isset_status = false; + + private String create_by = null; + @JsonIgnore + protected boolean isset_create_by = false; + + private Long create_time = null; + @JsonIgnore + protected boolean isset_create_time = false; + + private String remark = null; + @JsonIgnore + protected boolean isset_remark = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_dict_type() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public S_dict_type(Long dict_id) { + this.setDict_id(dict_id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setDict_id((Long) value); + } + + public Long getDict_id() { + return this.dict_id; + } + + public void setDict_id(Long dict_id) { + this.dict_id = dict_id; + this.isset_dict_id = true; + } + + @JsonIgnore + public boolean isEmptyDict_id() { + return this.dict_id == null; + } + + public String getDict_name() { + return this.dict_name; + } + + public void setDict_name(String dict_name) { + this.dict_name = dict_name; + this.isset_dict_name = true; + } + + @JsonIgnore + public boolean isEmptyDict_name() { + return this.dict_name == null || this.dict_name.length() == 0; + } + + public String getDict_type() { + return this.dict_type; + } + + public void setDict_type(String dict_type) { + this.dict_type = dict_type; + this.isset_dict_type = true; + } + + @JsonIgnore + public boolean isEmptyDict_type() { + return this.dict_type == null || this.dict_type.length() == 0; + } + + public Integer getStatus() { + return this.status; + } + + public void setStatus(Integer status) { + this.status = status; + this.isset_status = true; + } + + @JsonIgnore + public boolean isEmptyStatus() { + return this.status == null; + } + + public String getCreate_by() { + return this.create_by; + } + + public void setCreate_by(String create_by) { + this.create_by = create_by; + this.isset_create_by = true; + } + + @JsonIgnore + public boolean isEmptyCreate_by() { + return this.create_by == null || this.create_by.length() == 0; + } + + public Long getCreate_time() { + return this.create_time; + } + + public void setCreate_time(Long create_time) { + this.create_time = create_time; + this.isset_create_time = true; + } + + @JsonIgnore + public boolean isEmptyCreate_time() { + return this.create_time == null; + } + + public String getRemark() { + return this.remark; + } + + public void setRemark(String remark) { + this.remark = remark; + this.isset_remark = true; + } + + @JsonIgnore + public boolean isEmptyRemark() { + return this.remark == null || this.remark.length() == 0; + } + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("dict_id=").append(this.dict_id) + .append("dict_name=").append(this.dict_name) + .append("dict_type=").append(this.dict_type) + .append("status=").append(this.status) + .append("create_by=").append(this.create_by) + .append("create_time=").append(this.create_time) + .append("remark=").append(this.remark) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public S_dict_type $clone() { + S_dict_type s_dict_type = new S_dict_type(); + + // 鏁版嵁搴撳悕绉� + //s_dict_type.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_dict_id) { + s_dict_type.setDict_id(this.getDict_id()); + } + // 鏅�氬睘鎬� + if (this.isset_dict_name) { + s_dict_type.setDict_name(this.getDict_name()); + } + if (this.isset_dict_type) { + s_dict_type.setDict_type(this.getDict_type()); + } + if (this.isset_status) { + s_dict_type.setStatus(this.getStatus()); + } + if (this.isset_create_by) { + s_dict_type.setCreate_by(this.getCreate_by()); + } + if (this.isset_create_time) { + s_dict_type.setCreate_time(this.getCreate_time()); + } + if (this.isset_remark) { + s_dict_type.setRemark(this.getRemark()); + } + return s_dict_type; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dict_type_mapper.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dict_type_mapper.java new file mode 100644 index 0000000..a90bb6d --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_dict_type_mapper.java @@ -0,0 +1,291 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:S_DICT_TYPE * + * @author genrator + */ +public class S_dict_type_mapper extends S_dict_type implements BaseMapper<S_dict_type> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<S_dict_type> ROW_MAPPER = new S_dict_typeRowMapper(); + + // 涓婚敭 + public static final String DICT_ID = "dict_id"; + // 鏅�氬睘鎬� + public static final String DICT_NAME = "dict_name"; + public static final String DICT_TYPE = "dict_type"; + public static final String STATUS = "status"; + public static final String CREATE_BY = "create_by"; + public static final String CREATE_TIME = "create_time"; + public static final String REMARK = "remark"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_dict_type_mapper(S_dict_type s_dict_type) { + if (s_dict_type == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (s_dict_type.isset_dict_id) { + this.setDict_id(s_dict_type.getDict_id()); + } + //鏅�氬睘鎬� + if (s_dict_type.isset_dict_name) { + this.setDict_name(s_dict_type.getDict_name()); + } + if (s_dict_type.isset_dict_type) { + this.setDict_type(s_dict_type.getDict_type()); + } + if (s_dict_type.isset_status) { + this.setStatus(s_dict_type.getStatus()); + } + if (s_dict_type.isset_create_by) { + this.setCreate_by(s_dict_type.getCreate_by()); + } + if (s_dict_type.isset_create_time) { + this.setCreate_time(s_dict_type.getCreate_time()); + } + if (s_dict_type.isset_remark) { + this.setRemark(s_dict_type.getRemark()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(s_dict_type.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "s_dict_type"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return DICT_ID; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getDict_id(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(DICT_ID, this.getDict_id()); + ib.set(DICT_NAME, this.getDict_name(), this.isset_dict_name); + ib.set(DICT_TYPE, this.getDict_type(), this.isset_dict_type); + ib.set(STATUS, this.getStatus(), this.isset_status); + ib.set(CREATE_BY, this.getCreate_by(), this.isset_create_by); + ib.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ib.set(REMARK, this.getRemark(), this.isset_remark); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(DICT_NAME, this.getDict_name(), this.isset_dict_name); + ub.set(DICT_TYPE, this.getDict_type(), this.isset_dict_type); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(CREATE_BY, this.getCreate_by(), this.isset_create_by); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(REMARK, this.getRemark(), this.isset_remark); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(DICT_NAME, this.getDict_name(), this.isset_dict_name); + ub.set(DICT_TYPE, this.getDict_type(), this.isset_dict_type); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(CREATE_BY, this.getCreate_by(), this.isset_create_by); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(REMARK, this.getRemark(), this.isset_remark); + + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(DICT_NAME, this.getDict_name(), this.isset_dict_name); + ub.set(DICT_TYPE, this.getDict_type(), this.isset_dict_type); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(CREATE_BY, this.getCreate_by(), this.isset_create_by); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(REMARK, this.getRemark(), this.isset_remark); + + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select dict_id, dict_name, dict_type, status, create_by, create_time, remark from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select dict_id, dict_name, dict_type, status, create_by, create_time, remark from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public S_dict_type mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public S_dict_type toS_dict_type() { + return super.$clone(); + } +} + +/** + * s_dict_type RowMapper + * + * @author genrator + */ +class S_dict_typeRowMapper implements RowMapper<S_dict_type> { + + @Override + public S_dict_type mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + S_dict_type s_dict_type = new S_dict_type(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, S_dict_type_mapper.DICT_ID); + if (columnIndex > 0) { + s_dict_type.setDict_id(rs.getLong(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, S_dict_type_mapper.DICT_NAME); + if (columnIndex > 0) { + s_dict_type.setDict_name(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_dict_type_mapper.DICT_TYPE); + if (columnIndex > 0) { + s_dict_type.setDict_type(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_dict_type_mapper.STATUS); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_dict_type.setStatus(null); + } else { + s_dict_type.setStatus(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_dict_type_mapper.CREATE_BY); + if (columnIndex > 0) { + s_dict_type.setCreate_by(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_dict_type_mapper.CREATE_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_dict_type.setCreate_time(null); + } else { + s_dict_type.setCreate_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_dict_type_mapper.REMARK); + if (columnIndex > 0) { + s_dict_type.setRemark(rs.getString(columnIndex)); + } + return s_dict_type; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_group.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_group.java new file mode 100644 index 0000000..0264f60 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_group.java @@ -0,0 +1,200 @@ + + +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:S_GROUP * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class S_group extends BasePo<S_group> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + /** + * 鐢ㄤ簬鍏煎鑰佸啓娉� + */ + @JsonIgnore + public static final S_group ROW_MAPPER = new S_group(); + + // 涓婚敭 + private Integer id = null; + @JsonIgnore + protected boolean isset_id = false; + + // 灞炴�у垪琛� + private String name = null; + @JsonIgnore + protected boolean isset_name = false; + + private String info = null; + @JsonIgnore + protected boolean isset_info = false; + + private Integer form_id = null; + @JsonIgnore + protected boolean isset_form_id = false; + + private Long create_time = null; + @JsonIgnore + protected boolean isset_create_time = false; + + private Long update_time = null; + @JsonIgnore + protected boolean isset_update_time = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_group() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public S_group(Integer id) { + this.setId(id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setId((Integer) value); + } + + public Integer getId() { + return this.id; + } + public void setId(Integer id) { + this.id = id; + this.isset_id = true; + } + @JsonIgnore + public boolean isEmptyId() { + return this.id == null; + } + + + public String getName() { + return this.name; + } + public void setName(String name) { + this.name = name; + this.isset_name = true; + // name, varchar + } + @JsonIgnore + public boolean isEmptyName() { + return this.name == null || this.name.length() == 0; + } + + + public String getInfo() { + return this.info; + } + public void setInfo(String info) { + this.info = info; + this.isset_info = true; + // info, varchar + } + @JsonIgnore + public boolean isEmptyInfo() { + return this.info == null || this.info.length() == 0; + } + + + public Integer getForm_id() { + return this.form_id; + } + public void setForm_id(Integer form_id) { + this.form_id = form_id; + this.isset_form_id = true; + // form_id, int + } + @JsonIgnore + public boolean isEmptyForm_id() { + return this.form_id == null; + } + + + public Long getCreate_time() { + return this.create_time; + } + public void setCreate_time(Long create_time) { + this.create_time = create_time; + this.isset_create_time = true; + // create_time, bigint + } + @JsonIgnore + public boolean isEmptyCreate_time() { + return this.create_time == null; + } + + + public Long getUpdate_time() { + return this.update_time; + } + public void setUpdate_time(Long update_time) { + this.update_time = update_time; + this.isset_update_time = true; + // update_time, bigint + } + @JsonIgnore + public boolean isEmptyUpdate_time() { + return this.update_time == null; + } + + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("id=").append(this.id) + .append("name=").append(this.name) + .append("info=").append(this.info) + .append("form_id=").append(this.form_id) + .append("create_time=").append(this.create_time) + .append("update_time=").append(this.update_time) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public S_group $clone() { + S_group s_group = new S_group(); + + // 鏁版嵁搴撳悕绉� + //s_group.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_id) { + s_group.setId(this.getId()); + } + // 鏅�氬睘鎬� + if (this.isset_name) { + s_group.setName(this.getName()); + } + if (this.isset_info) { + s_group.setInfo(this.getInfo()); + } + if (this.isset_form_id) { + s_group.setForm_id(this.getForm_id()); + } + if (this.isset_create_time) { + s_group.setCreate_time(this.getCreate_time()); + } + if (this.isset_update_time) { + s_group.setUpdate_time(this.getUpdate_time()); + } + return s_group; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_group_data.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_group_data.java new file mode 100644 index 0000000..cc421cf --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_group_data.java @@ -0,0 +1,222 @@ + + +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:S_GROUP_DATA * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class S_group_data extends BasePo<S_group_data> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + /** + * 鐢ㄤ簬鍏煎鑰佸啓娉� + */ + @JsonIgnore + public static final S_group_data ROW_MAPPER = new S_group_data(); + + // 涓婚敭 + private Integer id = null; + @JsonIgnore + protected boolean isset_id = false; + + // 灞炴�у垪琛� + private Integer gid = null; + @JsonIgnore + protected boolean isset_gid = false; + + private String value = null; + @JsonIgnore + protected boolean isset_value = false; + + private Integer sort = null; + @JsonIgnore + protected boolean isset_sort = false; + + private Integer status = null; + @JsonIgnore + protected boolean isset_status = false; + + private Long create_time = null; + @JsonIgnore + protected boolean isset_create_time = false; + + private Long update_time = null; + @JsonIgnore + protected boolean isset_update_time = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_group_data() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public S_group_data(Integer id) { + this.setId(id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setId((Integer) value); + } + + public Integer getId() { + return this.id; + } + public void setId(Integer id) { + this.id = id; + this.isset_id = true; + } + @JsonIgnore + public boolean isEmptyId() { + return this.id == null; + } + + + public Integer getGid() { + return this.gid; + } + public void setGid(Integer gid) { + this.gid = gid; + this.isset_gid = true; + // gid, int + } + @JsonIgnore + public boolean isEmptyGid() { + return this.gid == null; + } + + + public String getValue() { + return this.value; + } + public void setValue(String value) { + this.value = value; + this.isset_value = true; + // value, text + } + @JsonIgnore + public boolean isEmptyValue() { + return this.value == null || this.value.length() == 0; + } + + + public Integer getSort() { + return this.sort; + } + public void setSort(Integer sort) { + this.sort = sort; + this.isset_sort = true; + // sort, int + } + @JsonIgnore + public boolean isEmptySort() { + return this.sort == null; + } + + + public Integer getStatus() { + return this.status; + } + public void setStatus(Integer status) { + this.status = status; + this.isset_status = true; + // status, int + } + @JsonIgnore + public boolean isEmptyStatus() { + return this.status == null; + } + + + public Long getCreate_time() { + return this.create_time; + } + public void setCreate_time(Long create_time) { + this.create_time = create_time; + this.isset_create_time = true; + // create_time, bigint + } + @JsonIgnore + public boolean isEmptyCreate_time() { + return this.create_time == null; + } + + + public Long getUpdate_time() { + return this.update_time; + } + public void setUpdate_time(Long update_time) { + this.update_time = update_time; + this.isset_update_time = true; + // update_time, bigint + } + @JsonIgnore + public boolean isEmptyUpdate_time() { + return this.update_time == null; + } + + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("id=").append(this.id) + .append("gid=").append(this.gid) + .append("value=").append(this.value) + .append("sort=").append(this.sort) + .append("status=").append(this.status) + .append("create_time=").append(this.create_time) + .append("update_time=").append(this.update_time) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public S_group_data $clone() { + S_group_data s_group_data = new S_group_data(); + + // 鏁版嵁搴撳悕绉� + //s_group_data.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_id) { + s_group_data.setId(this.getId()); + } + // 鏅�氬睘鎬� + if (this.isset_gid) { + s_group_data.setGid(this.getGid()); + } + if (this.isset_value) { + s_group_data.setValue(this.getValue()); + } + if (this.isset_sort) { + s_group_data.setSort(this.getSort()); + } + if (this.isset_status) { + s_group_data.setStatus(this.getStatus()); + } + if (this.isset_create_time) { + s_group_data.setCreate_time(this.getCreate_time()); + } + if (this.isset_update_time) { + s_group_data.setUpdate_time(this.getUpdate_time()); + } + return s_group_data; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_group_data_mapper.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_group_data_mapper.java new file mode 100644 index 0000000..90f2904 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_group_data_mapper.java @@ -0,0 +1,303 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:S_GROUP_DATA * + * @author genrator + */ +public class S_group_data_mapper extends S_group_data implements BaseMapper<S_group_data> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<S_group_data> ROW_MAPPER = new S_group_dataRowMapper(); + + // 涓婚敭 + public static final String ID = "id"; + // 鏅�氬睘鎬� + public static final String GID = "gid"; + public static final String VALUE = "value"; + public static final String SORT = "sort"; + public static final String STATUS = "status"; + public static final String CREATE_TIME = "create_time"; + public static final String UPDATE_TIME = "update_time"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_group_data_mapper(S_group_data s_group_data) { + if (s_group_data == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (s_group_data.isset_id) { + this.setId(s_group_data.getId()); + } + //鏅�氬睘鎬� + if (s_group_data.isset_gid) { + this.setGid(s_group_data.getGid()); + } + if (s_group_data.isset_value) { + this.setValue(s_group_data.getValue()); + } + if (s_group_data.isset_sort) { + this.setSort(s_group_data.getSort()); + } + if (s_group_data.isset_status) { + this.setStatus(s_group_data.getStatus()); + } + if (s_group_data.isset_create_time) { + this.setCreate_time(s_group_data.getCreate_time()); + } + if (s_group_data.isset_update_time) { + this.setUpdate_time(s_group_data.getUpdate_time()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(s_group_data.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "s_group_data"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return ID; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getId(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(ID, this.getId()); + ib.set(GID, this.getGid(), this.isset_gid); + ib.set(VALUE, this.getValue(), this.isset_value); + ib.set(SORT, this.getSort(), this.isset_sort); + ib.set(STATUS, this.getStatus(), this.isset_status); + ib.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ib.set(UPDATE_TIME, this.getUpdate_time(), this.isset_update_time); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(GID, this.getGid(), this.isset_gid); + ub.set(VALUE, this.getValue(), this.isset_value); + ub.set(SORT, this.getSort(), this.isset_sort); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(UPDATE_TIME, this.getUpdate_time(), this.isset_update_time); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(GID, this.getGid(), this.isset_gid); + ub.set(VALUE, this.getValue(), this.isset_value); + ub.set(SORT, this.getSort(), this.isset_sort); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(UPDATE_TIME, this.getUpdate_time(), this.isset_update_time); + + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(GID, this.getGid(), this.isset_gid); + ub.set(VALUE, this.getValue(), this.isset_value); + ub.set(SORT, this.getSort(), this.isset_sort); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(UPDATE_TIME, this.getUpdate_time(), this.isset_update_time); + + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select id, gid, value, sort, status, create_time, update_time from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select id, gid, value, sort, status, create_time, update_time from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public S_group_data mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public S_group_data toS_group_data() { + return super.$clone(); + } +} + +/** + * s_group_data RowMapper + * + * @author genrator + */ +class S_group_dataRowMapper implements RowMapper<S_group_data> { + + @Override + public S_group_data mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + S_group_data s_group_data = new S_group_data(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, S_group_data_mapper.ID); + if (columnIndex > 0) { + s_group_data.setId(rs.getInt(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, S_group_data_mapper.GID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_group_data.setGid(null); + } else { + s_group_data.setGid(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_group_data_mapper.VALUE); + if (columnIndex > 0) { + s_group_data.setValue(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_group_data_mapper.SORT); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_group_data.setSort(null); + } else { + s_group_data.setSort(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_group_data_mapper.STATUS); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_group_data.setStatus(null); + } else { + s_group_data.setStatus(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_group_data_mapper.CREATE_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_group_data.setCreate_time(null); + } else { + s_group_data.setCreate_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_group_data_mapper.UPDATE_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_group_data.setUpdate_time(null); + } else { + s_group_data.setUpdate_time(rs.getLong(columnIndex)); + } + } + return s_group_data; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_group_mapper.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_group_mapper.java new file mode 100644 index 0000000..d23e64f --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_group_mapper.java @@ -0,0 +1,283 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:S_GROUP * + * @author genrator + */ +public class S_group_mapper extends S_group implements BaseMapper<S_group> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<S_group> ROW_MAPPER = new S_groupRowMapper(); + + // 涓婚敭 + public static final String ID = "id"; + // 鏅�氬睘鎬� + public static final String NAME = "name"; + public static final String INFO = "info"; + public static final String FORM_ID = "form_id"; + public static final String CREATE_TIME = "create_time"; + public static final String UPDATE_TIME = "update_time"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_group_mapper(S_group s_group) { + if (s_group == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (s_group.isset_id) { + this.setId(s_group.getId()); + } + //鏅�氬睘鎬� + if (s_group.isset_name) { + this.setName(s_group.getName()); + } + if (s_group.isset_info) { + this.setInfo(s_group.getInfo()); + } + if (s_group.isset_form_id) { + this.setForm_id(s_group.getForm_id()); + } + if (s_group.isset_create_time) { + this.setCreate_time(s_group.getCreate_time()); + } + if (s_group.isset_update_time) { + this.setUpdate_time(s_group.getUpdate_time()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(s_group.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "s_group"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return ID; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getId(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(ID, this.getId()); + ib.set(NAME, this.getName(), this.isset_name); + ib.set(INFO, this.getInfo(), this.isset_info); + ib.set(FORM_ID, this.getForm_id(), this.isset_form_id); + ib.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ib.set(UPDATE_TIME, this.getUpdate_time(), this.isset_update_time); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(NAME, this.getName(), this.isset_name); + ub.set(INFO, this.getInfo(), this.isset_info); + ub.set(FORM_ID, this.getForm_id(), this.isset_form_id); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(UPDATE_TIME, this.getUpdate_time(), this.isset_update_time); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(NAME, this.getName(), this.isset_name); + ub.set(INFO, this.getInfo(), this.isset_info); + ub.set(FORM_ID, this.getForm_id(), this.isset_form_id); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(UPDATE_TIME, this.getUpdate_time(), this.isset_update_time); + + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(NAME, this.getName(), this.isset_name); + ub.set(INFO, this.getInfo(), this.isset_info); + ub.set(FORM_ID, this.getForm_id(), this.isset_form_id); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(UPDATE_TIME, this.getUpdate_time(), this.isset_update_time); + + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select id, name, info, form_id, create_time, update_time from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select id, name, info, form_id, create_time, update_time from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public S_group mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public S_group toS_group() { + return super.$clone(); + } +} + +/** + * s_group RowMapper + * + * @author genrator + */ +class S_groupRowMapper implements RowMapper<S_group> { + + @Override + public S_group mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + S_group s_group = new S_group(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, S_group_mapper.ID); + if (columnIndex > 0) { + s_group.setId(rs.getInt(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, S_group_mapper.NAME); + if (columnIndex > 0) { + s_group.setName(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_group_mapper.INFO); + if (columnIndex > 0) { + s_group.setInfo(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_group_mapper.FORM_ID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_group.setForm_id(null); + } else { + s_group.setForm_id(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_group_mapper.CREATE_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_group.setCreate_time(null); + } else { + s_group.setCreate_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_group_mapper.UPDATE_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_group.setUpdate_time(null); + } else { + s_group.setUpdate_time(rs.getLong(columnIndex)); + } + } + return s_group; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_host.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_host.java new file mode 100644 index 0000000..eb2e850 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_host.java @@ -0,0 +1,265 @@ +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:S_HOST * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class S_host extends BasePo<S_host> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + /** + * 鐢ㄤ簬鍏煎鑰佸啓娉� + */ + @JsonIgnore + public static final S_host ROW_MAPPER = new S_host(); + + // 涓婚敭 + private Long id = null; + @JsonIgnore + protected boolean isset_id = false; + + // 灞炴�у垪琛� + private Long create_time = null; + @JsonIgnore + protected boolean isset_create_time = false; + + private String create_user = null; + @JsonIgnore + protected boolean isset_create_user = false; + + private String url = null; + @JsonIgnore + protected boolean isset_url = false; + + private Integer port = null; + @JsonIgnore + protected boolean isset_port = false; + + private String service_name = null; + @JsonIgnore + protected boolean isset_service_name = false; + + private String authentication = null; + @JsonIgnore + protected boolean isset_authentication = false; + + private String certification = null; + @JsonIgnore + protected boolean isset_certification = false; + + private Integer max_active = null; + @JsonIgnore + protected boolean isset_max_active = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_host() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public S_host(Long id) { + this.setId(id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setId((Long) value); + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + this.isset_id = true; + } + + @JsonIgnore + public boolean isEmptyId() { + return this.id == null; + } + + public Long getCreate_time() { + return this.create_time; + } + + public void setCreate_time(Long create_time) { + this.create_time = create_time; + this.isset_create_time = true; + } + + @JsonIgnore + public boolean isEmptyCreate_time() { + return this.create_time == null; + } + + public String getCreate_user() { + return this.create_user; + } + + public void setCreate_user(String create_user) { + this.create_user = create_user; + this.isset_create_user = true; + } + + @JsonIgnore + public boolean isEmptyCreate_user() { + return this.create_user == null || this.create_user.length() == 0; + } + + public String getUrl() { + return this.url; + } + + public void setUrl(String url) { + this.url = url; + this.isset_url = true; + } + + @JsonIgnore + public boolean isEmptyUrl() { + return this.url == null || this.url.length() == 0; + } + + public Integer getPort() { + return this.port; + } + + public void setPort(Integer port) { + this.port = port; + this.isset_port = true; + } + + @JsonIgnore + public boolean isEmptyPort() { + return this.port == null; + } + + public String getService_name() { + return this.service_name; + } + + public void setService_name(String service_name) { + this.service_name = service_name; + this.isset_service_name = true; + } + + @JsonIgnore + public boolean isEmptyService_name() { + return this.service_name == null || this.service_name.length() == 0; + } + + public String getAuthentication() { + return this.authentication; + } + + public void setAuthentication(String authentication) { + this.authentication = authentication; + this.isset_authentication = true; + } + + @JsonIgnore + public boolean isEmptyAuthentication() { + return this.authentication == null || this.authentication.length() == 0; + } + + public String getCertification() { + return this.certification; + } + + public void setCertification(String certification) { + this.certification = certification; + this.isset_certification = true; + } + + @JsonIgnore + public boolean isEmptyCertification() { + return this.certification == null || this.certification.length() == 0; + } + + public Integer getMax_active() { + return this.max_active; + } + + public void setMax_active(Integer max_active) { + this.max_active = max_active; + this.isset_max_active = true; + } + + @JsonIgnore + public boolean isEmptyMax_active() { + return this.max_active == null; + } + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("id=").append(this.id) + .append("create_time=").append(this.create_time) + .append("create_user=").append(this.create_user) + .append("url=").append(this.url) + .append("port=").append(this.port) + .append("service_name=").append(this.service_name) + .append("authentication=").append(this.authentication) + .append("certification=").append(this.certification) + .append("max_active=").append(this.max_active) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public S_host $clone() { + S_host s_host = new S_host(); + + // 鏁版嵁搴撳悕绉� + //s_host.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_id) { + s_host.setId(this.getId()); + } + // 鏅�氬睘鎬� + if (this.isset_create_time) { + s_host.setCreate_time(this.getCreate_time()); + } + if (this.isset_create_user) { + s_host.setCreate_user(this.getCreate_user()); + } + if (this.isset_url) { + s_host.setUrl(this.getUrl()); + } + if (this.isset_port) { + s_host.setPort(this.getPort()); + } + if (this.isset_service_name) { + s_host.setService_name(this.getService_name()); + } + if (this.isset_authentication) { + s_host.setAuthentication(this.getAuthentication()); + } + if (this.isset_certification) { + s_host.setCertification(this.getCertification()); + } + if (this.isset_max_active) { + s_host.setMax_active(this.getMax_active()); + } + return s_host; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_host_mapper.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_host_mapper.java new file mode 100644 index 0000000..90231d7 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_host_mapper.java @@ -0,0 +1,319 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:S_HOST * + * @author genrator + */ +public class S_host_mapper extends S_host implements BaseMapper<S_host> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<S_host> ROW_MAPPER = new S_hostRowMapper(); + + // 涓婚敭 + public static final String ID = "id"; + // 鏅�氬睘鎬� + public static final String CREATE_TIME = "create_time"; + public static final String CREATE_USER = "create_user"; + public static final String URL = "url"; + public static final String PORT = "port"; + public static final String SERVICE_NAME = "service_name"; + public static final String AUTHENTICATION = "authentication"; + public static final String CERTIFICATION = "certification"; + public static final String MAX_ACTIVE = "max_active"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_host_mapper(S_host s_host) { + if (s_host == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (s_host.isset_id) { + this.setId(s_host.getId()); + } + //鏅�氬睘鎬� + if (s_host.isset_create_time) { + this.setCreate_time(s_host.getCreate_time()); + } + if (s_host.isset_create_user) { + this.setCreate_user(s_host.getCreate_user()); + } + if (s_host.isset_url) { + this.setUrl(s_host.getUrl()); + } + if (s_host.isset_port) { + this.setPort(s_host.getPort()); + } + if (s_host.isset_service_name) { + this.setService_name(s_host.getService_name()); + } + if (s_host.isset_authentication) { + this.setAuthentication(s_host.getAuthentication()); + } + if (s_host.isset_certification) { + this.setCertification(s_host.getCertification()); + } + if (s_host.isset_max_active) { + this.setMax_active(s_host.getMax_active()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(s_host.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "s_host"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return ID; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getId(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(ID, this.getId()); + ib.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ib.set(CREATE_USER, this.getCreate_user(), this.isset_create_user); + ib.set(URL, this.getUrl(), this.isset_url); + ib.set(PORT, this.getPort(), this.isset_port); + ib.set(SERVICE_NAME, this.getService_name(), this.isset_service_name); + ib.set(AUTHENTICATION, this.getAuthentication(), this.isset_authentication); + ib.set(CERTIFICATION, this.getCertification(), this.isset_certification); + ib.set(MAX_ACTIVE, this.getMax_active(), this.isset_max_active); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(CREATE_USER, this.getCreate_user(), this.isset_create_user); + ub.set(URL, this.getUrl(), this.isset_url); + ub.set(PORT, this.getPort(), this.isset_port); + ub.set(SERVICE_NAME, this.getService_name(), this.isset_service_name); + ub.set(AUTHENTICATION, this.getAuthentication(), this.isset_authentication); + ub.set(CERTIFICATION, this.getCertification(), this.isset_certification); + ub.set(MAX_ACTIVE, this.getMax_active(), this.isset_max_active); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(CREATE_USER, this.getCreate_user(), this.isset_create_user); + ub.set(URL, this.getUrl(), this.isset_url); + ub.set(PORT, this.getPort(), this.isset_port); + ub.set(SERVICE_NAME, this.getService_name(), this.isset_service_name); + ub.set(AUTHENTICATION, this.getAuthentication(), this.isset_authentication); + ub.set(CERTIFICATION, this.getCertification(), this.isset_certification); + ub.set(MAX_ACTIVE, this.getMax_active(), this.isset_max_active); + + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(CREATE_USER, this.getCreate_user(), this.isset_create_user); + ub.set(URL, this.getUrl(), this.isset_url); + ub.set(PORT, this.getPort(), this.isset_port); + ub.set(SERVICE_NAME, this.getService_name(), this.isset_service_name); + ub.set(AUTHENTICATION, this.getAuthentication(), this.isset_authentication); + ub.set(CERTIFICATION, this.getCertification(), this.isset_certification); + ub.set(MAX_ACTIVE, this.getMax_active(), this.isset_max_active); + + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select id, create_time, create_user, url, port, service_name, authentication, certification, max_active from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select id, create_time, create_user, url, port, service_name, authentication, certification, max_active from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public S_host mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public S_host toS_host() { + return super.$clone(); + } +} + +/** + * s_host RowMapper + * + * @author genrator + */ +class S_hostRowMapper implements RowMapper<S_host> { + + @Override + public S_host mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + S_host s_host = new S_host(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, S_host_mapper.ID); + if (columnIndex > 0) { + s_host.setId(rs.getLong(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, S_host_mapper.CREATE_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_host.setCreate_time(null); + } else { + s_host.setCreate_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_host_mapper.CREATE_USER); + if (columnIndex > 0) { + s_host.setCreate_user(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_host_mapper.URL); + if (columnIndex > 0) { + s_host.setUrl(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_host_mapper.PORT); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_host.setPort(null); + } else { + s_host.setPort(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_host_mapper.SERVICE_NAME); + if (columnIndex > 0) { + s_host.setService_name(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_host_mapper.AUTHENTICATION); + if (columnIndex > 0) { + s_host.setAuthentication(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_host_mapper.CERTIFICATION); + if (columnIndex > 0) { + s_host.setCertification(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_host_mapper.MAX_ACTIVE); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_host.setMax_active(null); + } else { + s_host.setMax_active(rs.getInt(columnIndex)); + } + } + return s_host; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_login_info.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_login_info.java new file mode 100644 index 0000000..59a57de --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_login_info.java @@ -0,0 +1,604 @@ + + +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:S_LOGIN_INFO * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class S_login_info extends BasePo<S_login_info> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + /** + * 鐢ㄤ簬鍏煎鑰佸啓娉� + */ + @JsonIgnore + public static final S_login_info ROW_MAPPER = new S_login_info(); + + // 涓婚敭 + private Long info_id = null; + @JsonIgnore + protected boolean isset_info_id = false; + + // 灞炴�у垪琛� + private String user_name = null; + @JsonIgnore + protected boolean isset_user_name = false; + + private String ipaddr = null; + @JsonIgnore + protected boolean isset_ipaddr = false; + + private String login_location = null; + @JsonIgnore + protected boolean isset_login_location = false; + + private String browser = null; + @JsonIgnore + protected boolean isset_browser = false; + + private String os = null; + @JsonIgnore + protected boolean isset_os = false; + + private String status = null; + @JsonIgnore + protected boolean isset_status = false; + + private String msg = null; + @JsonIgnore + protected boolean isset_msg = false; + + private Long login_time = null; + @JsonIgnore + protected boolean isset_login_time = false; + + private Long base_user_id = null; + @JsonIgnore + protected boolean isset_base_user_id = false; + + private String base_user_name = null; + @JsonIgnore + protected boolean isset_base_user_name = false; + + private String psn_code = null; + @JsonIgnore + protected boolean isset_psn_code = false; + + private String phone = null; + @JsonIgnore + protected boolean isset_phone = false; + + private String phone_desen = null; + @JsonIgnore + protected boolean isset_phone_desen = false; + + private String client_type = null; + @JsonIgnore + protected boolean isset_client_type = false; + + private Long group_dept_id = null; + @JsonIgnore + protected boolean isset_group_dept_id = false; + + private Long province_dept_id = null; + @JsonIgnore + protected boolean isset_province_dept_id = false; + + private Long city_dept_id = null; + @JsonIgnore + protected boolean isset_city_dept_id = false; + + private Long county_dept_id = null; + @JsonIgnore + protected boolean isset_county_dept_id = false; + + private String group_dept_name = null; + @JsonIgnore + protected boolean isset_group_dept_name = false; + + private String province_dept_name = null; + @JsonIgnore + protected boolean isset_province_dept_name = false; + + private String city_dept_name = null; + @JsonIgnore + protected boolean isset_city_dept_name = false; + + private String county_dept_name = null; + @JsonIgnore + protected boolean isset_county_dept_name = false; + + private Long base_dept_id = null; + @JsonIgnore + protected boolean isset_base_dept_id = false; + + private String base_dept_name = null; + @JsonIgnore + protected boolean isset_base_dept_name = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_login_info() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public S_login_info(Long info_id) { + this.setInfo_id(info_id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setInfo_id((Long) value); + } + + public Long getInfo_id() { + return this.info_id; + } + + public void setInfo_id(Long info_id) { + this.info_id = info_id; + this.isset_info_id = true; + } + + @JsonIgnore + public boolean isEmptyInfo_id() { + return this.info_id == null; + } + + public String getUser_name() { + return this.user_name; + } + + public void setUser_name(String user_name) { + this.user_name = user_name; + this.isset_user_name = true; + } + + @JsonIgnore + public boolean isEmptyUser_name() { + return this.user_name == null || this.user_name.length() == 0; + } + + public String getIpaddr() { + return this.ipaddr; + } + + public void setIpaddr(String ipaddr) { + this.ipaddr = ipaddr; + this.isset_ipaddr = true; + } + + @JsonIgnore + public boolean isEmptyIpaddr() { + return this.ipaddr == null || this.ipaddr.length() == 0; + } + + public String getLogin_location() { + return this.login_location; + } + + public void setLogin_location(String login_location) { + this.login_location = login_location; + this.isset_login_location = true; + } + + @JsonIgnore + public boolean isEmptyLogin_location() { + return this.login_location == null || this.login_location.length() == 0; + } + + public String getBrowser() { + return this.browser; + } + + public void setBrowser(String browser) { + this.browser = browser; + this.isset_browser = true; + } + + @JsonIgnore + public boolean isEmptyBrowser() { + return this.browser == null || this.browser.length() == 0; + } + + public String getOs() { + return this.os; + } + + public void setOs(String os) { + this.os = os; + this.isset_os = true; + } + + @JsonIgnore + public boolean isEmptyOs() { + return this.os == null || this.os.length() == 0; + } + + public String getStatus() { + return this.status; + } + + public void setStatus(String status) { + this.status = status; + this.isset_status = true; + } + + @JsonIgnore + public boolean isEmptyStatus() { + return this.status == null || this.status.length() == 0; + } + + public String getMsg() { + return this.msg; + } + + public void setMsg(String msg) { + this.msg = msg; + this.isset_msg = true; + } + + @JsonIgnore + public boolean isEmptyMsg() { + return this.msg == null || this.msg.length() == 0; + } + + public Long getLogin_time() { + return this.login_time; + } + + public void setLogin_time(Long login_time) { + this.login_time = login_time; + this.isset_login_time = true; + } + + @JsonIgnore + public boolean isEmptyLogin_time() { + return this.login_time == null; + } + + + public Long getBase_user_id() { + return this.base_user_id; + } + public void setBase_user_id(Long base_user_id) { + this.base_user_id = base_user_id; + this.isset_base_user_id = true; + } + @JsonIgnore + public boolean isEmptyBase_user_id() { + return this.base_user_id == null; + } + + + public String getBase_user_name() { + return this.base_user_name; + } + public void setBase_user_name(String base_user_name) { + this.base_user_name = base_user_name; + this.isset_base_user_name = true; + } + @JsonIgnore + public boolean isEmptyBase_user_name() { + return this.base_user_name == null || this.base_user_name.length() == 0; + } + + + public String getPsn_code() { + return this.psn_code; + } + public void setPsn_code(String psn_code) { + this.psn_code = psn_code; + this.isset_psn_code = true; + } + @JsonIgnore + public boolean isEmptyPsn_code() { + return this.psn_code == null || this.psn_code.length() == 0; + } + + + public String getPhone() { + return this.phone; + } + public void setPhone(String phone) { + this.phone = phone; + this.isset_phone = true; + } + @JsonIgnore + public boolean isEmptyPhone() { + return this.phone == null || this.phone.length() == 0; + } + + + public String getPhone_desen() { + return this.phone_desen; + } + public void setPhone_desen(String phone_desen) { + this.phone_desen = phone_desen; + this.isset_phone_desen = true; + } + @JsonIgnore + public boolean isEmptyPhone_desen() { + return this.phone_desen == null || this.phone_desen.length() == 0; + } + + + public String getClient_type() { + return this.client_type; + } + public void setClient_type(String client_type) { + this.client_type = client_type; + this.isset_client_type = true; + } + @JsonIgnore + public boolean isEmptyClient_type() { + return this.client_type == null || this.client_type.length() == 0; + } + + + public Long getGroup_dept_id() { + return this.group_dept_id; + } + public void setGroup_dept_id(Long group_dept_id) { + this.group_dept_id = group_dept_id; + this.isset_group_dept_id = true; + } + @JsonIgnore + public boolean isEmptyGroup_dept_id() { + return this.group_dept_id == null; + } + + + public Long getProvince_dept_id() { + return this.province_dept_id; + } + public void setProvince_dept_id(Long province_dept_id) { + this.province_dept_id = province_dept_id; + this.isset_province_dept_id = true; + } + @JsonIgnore + public boolean isEmptyProvince_dept_id() { + return this.province_dept_id == null; + } + + + public Long getCity_dept_id() { + return this.city_dept_id; + } + public void setCity_dept_id(Long city_dept_id) { + this.city_dept_id = city_dept_id; + this.isset_city_dept_id = true; + } + @JsonIgnore + public boolean isEmptyCity_dept_id() { + return this.city_dept_id == null; + } + + + public Long getCounty_dept_id() { + return this.county_dept_id; + } + public void setCounty_dept_id(Long county_dept_id) { + this.county_dept_id = county_dept_id; + this.isset_county_dept_id = true; + } + @JsonIgnore + public boolean isEmptyCounty_dept_id() { + return this.county_dept_id == null; + } + + + public String getGroup_dept_name() { + return this.group_dept_name; + } + public void setGroup_dept_name(String group_dept_name) { + this.group_dept_name = group_dept_name; + this.isset_group_dept_name = true; + } + @JsonIgnore + public boolean isEmptyGroup_dept_name() { + return this.group_dept_name == null || this.group_dept_name.length() == 0; + } + + + public String getProvince_dept_name() { + return this.province_dept_name; + } + public void setProvince_dept_name(String province_dept_name) { + this.province_dept_name = province_dept_name; + this.isset_province_dept_name = true; + } + @JsonIgnore + public boolean isEmptyProvince_dept_name() { + return this.province_dept_name == null || this.province_dept_name.length() == 0; + } + + + public String getCity_dept_name() { + return this.city_dept_name; + } + public void setCity_dept_name(String city_dept_name) { + this.city_dept_name = city_dept_name; + this.isset_city_dept_name = true; + } + @JsonIgnore + public boolean isEmptyCity_dept_name() { + return this.city_dept_name == null || this.city_dept_name.length() == 0; + } + + + public String getCounty_dept_name() { + return this.county_dept_name; + } + public void setCounty_dept_name(String county_dept_name) { + this.county_dept_name = county_dept_name; + this.isset_county_dept_name = true; + } + @JsonIgnore + public boolean isEmptyCounty_dept_name() { + return this.county_dept_name == null || this.county_dept_name.length() == 0; + } + + + public Long getBase_dept_id() { + return this.base_dept_id; + } + public void setBase_dept_id(Long base_dept_id) { + this.base_dept_id = base_dept_id; + this.isset_base_dept_id = true; + } + @JsonIgnore + public boolean isEmptyBase_dept_id() { + return this.base_dept_id == null; + } + + + public String getBase_dept_name() { + return this.base_dept_name; + } + public void setBase_dept_name(String base_dept_name) { + this.base_dept_name = base_dept_name; + this.isset_base_dept_name = true; + } + @JsonIgnore + public boolean isEmptyBase_dept_name() { + return this.base_dept_name == null || this.base_dept_name.length() == 0; + } + + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("info_id=").append(this.info_id) + .append("user_name=").append(this.user_name) + .append("ipaddr=").append(this.ipaddr) + .append("login_location=").append(this.login_location) + .append("browser=").append(this.browser) + .append("os=").append(this.os) + .append("status=").append(this.status) + .append("msg=").append(this.msg) + .append("login_time=").append(this.login_time) + .append("base_user_id=").append(this.base_user_id) + .append("base_user_name=").append(this.base_user_name) + .append("psn_code=").append(this.psn_code) + .append("phone=").append(this.phone) + .append("phone_desen=").append(this.phone_desen) + .append("client_type=").append(this.client_type) + .append("group_dept_id=").append(this.group_dept_id) + .append("province_dept_id=").append(this.province_dept_id) + .append("city_dept_id=").append(this.city_dept_id) + .append("county_dept_id=").append(this.county_dept_id) + .append("group_dept_name=").append(this.group_dept_name) + .append("province_dept_name=").append(this.province_dept_name) + .append("city_dept_name=").append(this.city_dept_name) + .append("county_dept_name=").append(this.county_dept_name) + .append("base_dept_id=").append(this.base_dept_id) + .append("base_dept_name=").append(this.base_dept_name) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public S_login_info $clone() { + S_login_info s_login_info = new S_login_info(); + + // 鏁版嵁搴撳悕绉� + //s_login_info.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_info_id) { + s_login_info.setInfo_id(this.getInfo_id()); + } + // 鏅�氬睘鎬� + if (this.isset_user_name) { + s_login_info.setUser_name(this.getUser_name()); + } + if (this.isset_ipaddr) { + s_login_info.setIpaddr(this.getIpaddr()); + } + if (this.isset_login_location) { + s_login_info.setLogin_location(this.getLogin_location()); + } + if (this.isset_browser) { + s_login_info.setBrowser(this.getBrowser()); + } + if (this.isset_os) { + s_login_info.setOs(this.getOs()); + } + if (this.isset_status) { + s_login_info.setStatus(this.getStatus()); + } + if (this.isset_msg) { + s_login_info.setMsg(this.getMsg()); + } + if (this.isset_login_time) { + s_login_info.setLogin_time(this.getLogin_time()); + } + if (this.isset_base_user_id) { + s_login_info.setBase_user_id(this.getBase_user_id()); + } + if (this.isset_base_user_name) { + s_login_info.setBase_user_name(this.getBase_user_name()); + } + if (this.isset_psn_code) { + s_login_info.setPsn_code(this.getPsn_code()); + } + if (this.isset_phone) { + s_login_info.setPhone(this.getPhone()); + } + if (this.isset_phone_desen) { + s_login_info.setPhone_desen(this.getPhone_desen()); + } + if (this.isset_client_type) { + s_login_info.setClient_type(this.getClient_type()); + } + if (this.isset_group_dept_id) { + s_login_info.setGroup_dept_id(this.getGroup_dept_id()); + } + if (this.isset_province_dept_id) { + s_login_info.setProvince_dept_id(this.getProvince_dept_id()); + } + if (this.isset_city_dept_id) { + s_login_info.setCity_dept_id(this.getCity_dept_id()); + } + if (this.isset_county_dept_id) { + s_login_info.setCounty_dept_id(this.getCounty_dept_id()); + } + if (this.isset_group_dept_name) { + s_login_info.setGroup_dept_name(this.getGroup_dept_name()); + } + if (this.isset_province_dept_name) { + s_login_info.setProvince_dept_name(this.getProvince_dept_name()); + } + if (this.isset_city_dept_name) { + s_login_info.setCity_dept_name(this.getCity_dept_name()); + } + if (this.isset_county_dept_name) { + s_login_info.setCounty_dept_name(this.getCounty_dept_name()); + } + if (this.isset_base_dept_id) { + s_login_info.setBase_dept_id(this.getBase_dept_id()); + } + if (this.isset_base_dept_name) { + s_login_info.setBase_dept_name(this.getBase_dept_name()); + } + return s_login_info; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_login_info_mapper.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_login_info_mapper.java new file mode 100644 index 0000000..0286455 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_login_info_mapper.java @@ -0,0 +1,527 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:S_LOGIN_INFO * + * @author genrator + */ +public class S_login_info_mapper extends S_login_info implements BaseMapper<S_login_info> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<S_login_info> ROW_MAPPER = new S_login_infoRowMapper(); + + // 涓婚敭 + public static final String INFO_ID = "info_id"; + // 鏅�氬睘鎬� + public static final String USER_NAME = "user_name"; + public static final String IPADDR = "ipaddr"; + public static final String LOGIN_LOCATION = "login_location"; + public static final String BROWSER = "browser"; + public static final String OS = "os"; + public static final String STATUS = "status"; + public static final String MSG = "msg"; + public static final String LOGIN_TIME = "login_time"; + public static final String BASE_USER_ID = "base_user_id"; + public static final String BASE_USER_NAME = "base_user_name"; + public static final String PSN_CODE = "psn_code"; + public static final String PHONE = "phone"; + public static final String PHONE_DESEN = "phone_desen"; + public static final String CLIENT_TYPE = "client_type"; + public static final String GROUP_DEPT_ID = "group_dept_id"; + public static final String PROVINCE_DEPT_ID = "province_dept_id"; + public static final String CITY_DEPT_ID = "city_dept_id"; + public static final String COUNTY_DEPT_ID = "county_dept_id"; + public static final String GROUP_DEPT_NAME = "group_dept_name"; + public static final String PROVINCE_DEPT_NAME = "province_dept_name"; + public static final String CITY_DEPT_NAME = "city_dept_name"; + public static final String COUNTY_DEPT_NAME = "county_dept_name"; + public static final String BASE_DEPT_ID = "base_dept_id"; + public static final String BASE_DEPT_NAME = "base_dept_name"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_login_info_mapper(S_login_info s_login_info) { + if (s_login_info == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (s_login_info.isset_info_id) { + this.setInfo_id(s_login_info.getInfo_id()); + } + //鏅�氬睘鎬� + if (s_login_info.isset_user_name) { + this.setUser_name(s_login_info.getUser_name()); + } + if (s_login_info.isset_ipaddr) { + this.setIpaddr(s_login_info.getIpaddr()); + } + if (s_login_info.isset_login_location) { + this.setLogin_location(s_login_info.getLogin_location()); + } + if (s_login_info.isset_browser) { + this.setBrowser(s_login_info.getBrowser()); + } + if (s_login_info.isset_os) { + this.setOs(s_login_info.getOs()); + } + if (s_login_info.isset_status) { + this.setStatus(s_login_info.getStatus()); + } + if (s_login_info.isset_msg) { + this.setMsg(s_login_info.getMsg()); + } + if (s_login_info.isset_login_time) { + this.setLogin_time(s_login_info.getLogin_time()); + } + if (s_login_info.isset_base_user_id) { + this.setBase_user_id(s_login_info.getBase_user_id()); + } + if (s_login_info.isset_base_user_name) { + this.setBase_user_name(s_login_info.getBase_user_name()); + } + if (s_login_info.isset_psn_code) { + this.setPsn_code(s_login_info.getPsn_code()); + } + if (s_login_info.isset_phone) { + this.setPhone(s_login_info.getPhone()); + } + if (s_login_info.isset_phone_desen) { + this.setPhone_desen(s_login_info.getPhone_desen()); + } + if (s_login_info.isset_client_type) { + this.setClient_type(s_login_info.getClient_type()); + } + if (s_login_info.isset_group_dept_id) { + this.setGroup_dept_id(s_login_info.getGroup_dept_id()); + } + if (s_login_info.isset_province_dept_id) { + this.setProvince_dept_id(s_login_info.getProvince_dept_id()); + } + if (s_login_info.isset_city_dept_id) { + this.setCity_dept_id(s_login_info.getCity_dept_id()); + } + if (s_login_info.isset_county_dept_id) { + this.setCounty_dept_id(s_login_info.getCounty_dept_id()); + } + if (s_login_info.isset_group_dept_name) { + this.setGroup_dept_name(s_login_info.getGroup_dept_name()); + } + if (s_login_info.isset_province_dept_name) { + this.setProvince_dept_name(s_login_info.getProvince_dept_name()); + } + if (s_login_info.isset_city_dept_name) { + this.setCity_dept_name(s_login_info.getCity_dept_name()); + } + if (s_login_info.isset_county_dept_name) { + this.setCounty_dept_name(s_login_info.getCounty_dept_name()); + } + if (s_login_info.isset_base_dept_id) { + this.setBase_dept_id(s_login_info.getBase_dept_id()); + } + if (s_login_info.isset_base_dept_name) { + this.setBase_dept_name(s_login_info.getBase_dept_name()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(s_login_info.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "s_login_info"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return INFO_ID; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getInfo_id(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(INFO_ID, this.getInfo_id()); + ib.set(USER_NAME, this.getUser_name(), this.isset_user_name); + ib.set(IPADDR, this.getIpaddr(), this.isset_ipaddr); + ib.set(LOGIN_LOCATION, this.getLogin_location(), this.isset_login_location); + ib.set(BROWSER, this.getBrowser(), this.isset_browser); + ib.set(OS, this.getOs(), this.isset_os); + ib.set(STATUS, this.getStatus(), this.isset_status); + ib.set(MSG, this.getMsg(), this.isset_msg); + ib.set(LOGIN_TIME, this.getLogin_time(), this.isset_login_time); + ib.set(BASE_USER_ID, this.getBase_user_id(), this.isset_base_user_id); + ib.set(BASE_USER_NAME, this.getBase_user_name(), this.isset_base_user_name); + ib.set(PSN_CODE, this.getPsn_code(), this.isset_psn_code); + ib.set(PHONE, this.getPhone(), this.isset_phone); + ib.set(PHONE_DESEN, this.getPhone_desen(), this.isset_phone_desen); + ib.set(CLIENT_TYPE, this.getClient_type(), this.isset_client_type); + ib.set(GROUP_DEPT_ID, this.getGroup_dept_id(), this.isset_group_dept_id); + ib.set(PROVINCE_DEPT_ID, this.getProvince_dept_id(), this.isset_province_dept_id); + ib.set(CITY_DEPT_ID, this.getCity_dept_id(), this.isset_city_dept_id); + ib.set(COUNTY_DEPT_ID, this.getCounty_dept_id(), this.isset_county_dept_id); + ib.set(GROUP_DEPT_NAME, this.getGroup_dept_name(), this.isset_group_dept_name); + ib.set(PROVINCE_DEPT_NAME, this.getProvince_dept_name(), this.isset_province_dept_name); + ib.set(CITY_DEPT_NAME, this.getCity_dept_name(), this.isset_city_dept_name); + ib.set(COUNTY_DEPT_NAME, this.getCounty_dept_name(), this.isset_county_dept_name); + ib.set(BASE_DEPT_ID, this.getBase_dept_id(), this.isset_base_dept_id); + ib.set(BASE_DEPT_NAME, this.getBase_dept_name(), this.isset_base_dept_name); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(USER_NAME, this.getUser_name(), this.isset_user_name); + ub.set(IPADDR, this.getIpaddr(), this.isset_ipaddr); + ub.set(LOGIN_LOCATION, this.getLogin_location(), this.isset_login_location); + ub.set(BROWSER, this.getBrowser(), this.isset_browser); + ub.set(OS, this.getOs(), this.isset_os); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(MSG, this.getMsg(), this.isset_msg); + ub.set(LOGIN_TIME, this.getLogin_time(), this.isset_login_time); + ub.set(BASE_USER_ID, this.getBase_user_id(), this.isset_base_user_id); + ub.set(BASE_USER_NAME, this.getBase_user_name(), this.isset_base_user_name); + ub.set(PSN_CODE, this.getPsn_code(), this.isset_psn_code); + ub.set(PHONE, this.getPhone(), this.isset_phone); + ub.set(PHONE_DESEN, this.getPhone_desen(), this.isset_phone_desen); + ub.set(CLIENT_TYPE, this.getClient_type(), this.isset_client_type); + ub.set(GROUP_DEPT_ID, this.getGroup_dept_id(), this.isset_group_dept_id); + ub.set(PROVINCE_DEPT_ID, this.getProvince_dept_id(), this.isset_province_dept_id); + ub.set(CITY_DEPT_ID, this.getCity_dept_id(), this.isset_city_dept_id); + ub.set(COUNTY_DEPT_ID, this.getCounty_dept_id(), this.isset_county_dept_id); + ub.set(GROUP_DEPT_NAME, this.getGroup_dept_name(), this.isset_group_dept_name); + ub.set(PROVINCE_DEPT_NAME, this.getProvince_dept_name(), this.isset_province_dept_name); + ub.set(CITY_DEPT_NAME, this.getCity_dept_name(), this.isset_city_dept_name); + ub.set(COUNTY_DEPT_NAME, this.getCounty_dept_name(), this.isset_county_dept_name); + ub.set(BASE_DEPT_ID, this.getBase_dept_id(), this.isset_base_dept_id); + ub.set(BASE_DEPT_NAME, this.getBase_dept_name(), this.isset_base_dept_name); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(USER_NAME, this.getUser_name(), this.isset_user_name); + ub.set(IPADDR, this.getIpaddr(), this.isset_ipaddr); + ub.set(LOGIN_LOCATION, this.getLogin_location(), this.isset_login_location); + ub.set(BROWSER, this.getBrowser(), this.isset_browser); + ub.set(OS, this.getOs(), this.isset_os); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(MSG, this.getMsg(), this.isset_msg); + ub.set(LOGIN_TIME, this.getLogin_time(), this.isset_login_time); + ub.set(BASE_USER_ID, this.getBase_user_id(), this.isset_base_user_id); + ub.set(BASE_USER_NAME, this.getBase_user_name(), this.isset_base_user_name); + ub.set(PSN_CODE, this.getPsn_code(), this.isset_psn_code); + ub.set(PHONE, this.getPhone(), this.isset_phone); + ub.set(PHONE_DESEN, this.getPhone_desen(), this.isset_phone_desen); + ub.set(CLIENT_TYPE, this.getClient_type(), this.isset_client_type); + ub.set(GROUP_DEPT_ID, this.getGroup_dept_id(), this.isset_group_dept_id); + ub.set(PROVINCE_DEPT_ID, this.getProvince_dept_id(), this.isset_province_dept_id); + ub.set(CITY_DEPT_ID, this.getCity_dept_id(), this.isset_city_dept_id); + ub.set(COUNTY_DEPT_ID, this.getCounty_dept_id(), this.isset_county_dept_id); + ub.set(GROUP_DEPT_NAME, this.getGroup_dept_name(), this.isset_group_dept_name); + ub.set(PROVINCE_DEPT_NAME, this.getProvince_dept_name(), this.isset_province_dept_name); + ub.set(CITY_DEPT_NAME, this.getCity_dept_name(), this.isset_city_dept_name); + ub.set(COUNTY_DEPT_NAME, this.getCounty_dept_name(), this.isset_county_dept_name); + ub.set(BASE_DEPT_ID, this.getBase_dept_id(), this.isset_base_dept_id); + ub.set(BASE_DEPT_NAME, this.getBase_dept_name(), this.isset_base_dept_name); + + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(USER_NAME, this.getUser_name(), this.isset_user_name); + ub.set(IPADDR, this.getIpaddr(), this.isset_ipaddr); + ub.set(LOGIN_LOCATION, this.getLogin_location(), this.isset_login_location); + ub.set(BROWSER, this.getBrowser(), this.isset_browser); + ub.set(OS, this.getOs(), this.isset_os); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(MSG, this.getMsg(), this.isset_msg); + ub.set(LOGIN_TIME, this.getLogin_time(), this.isset_login_time); + ub.set(BASE_USER_ID, this.getBase_user_id(), this.isset_base_user_id); + ub.set(BASE_USER_NAME, this.getBase_user_name(), this.isset_base_user_name); + ub.set(PSN_CODE, this.getPsn_code(), this.isset_psn_code); + ub.set(PHONE, this.getPhone(), this.isset_phone); + ub.set(PHONE_DESEN, this.getPhone_desen(), this.isset_phone_desen); + ub.set(CLIENT_TYPE, this.getClient_type(), this.isset_client_type); + ub.set(GROUP_DEPT_ID, this.getGroup_dept_id(), this.isset_group_dept_id); + ub.set(PROVINCE_DEPT_ID, this.getProvince_dept_id(), this.isset_province_dept_id); + ub.set(CITY_DEPT_ID, this.getCity_dept_id(), this.isset_city_dept_id); + ub.set(COUNTY_DEPT_ID, this.getCounty_dept_id(), this.isset_county_dept_id); + ub.set(GROUP_DEPT_NAME, this.getGroup_dept_name(), this.isset_group_dept_name); + ub.set(PROVINCE_DEPT_NAME, this.getProvince_dept_name(), this.isset_province_dept_name); + ub.set(CITY_DEPT_NAME, this.getCity_dept_name(), this.isset_city_dept_name); + ub.set(COUNTY_DEPT_NAME, this.getCounty_dept_name(), this.isset_county_dept_name); + ub.set(BASE_DEPT_ID, this.getBase_dept_id(), this.isset_base_dept_id); + ub.set(BASE_DEPT_NAME, this.getBase_dept_name(), this.isset_base_dept_name); + + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select info_id, user_name, ipaddr, login_location, browser, os, status, msg, login_time, base_user_id, base_user_name, psn_code, phone, phone_desen, client_type, group_dept_id, province_dept_id, city_dept_id, county_dept_id, group_dept_name, province_dept_name, city_dept_name, county_dept_name, base_dept_id, base_dept_name from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select info_id, user_name, ipaddr, login_location, browser, os, status, msg, login_time, base_user_id, base_user_name, psn_code, phone, phone_desen, client_type, group_dept_id, province_dept_id, city_dept_id, county_dept_id, group_dept_name, province_dept_name, city_dept_name, county_dept_name, base_dept_id, base_dept_name from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public S_login_info mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public S_login_info toS_login_info() { + return super.$clone(); + } +} + +/** + * s_login_info RowMapper + * + * @author genrator + */ +class S_login_infoRowMapper implements RowMapper<S_login_info> { + + @Override + public S_login_info mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + S_login_info s_login_info = new S_login_info(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, S_login_info_mapper.INFO_ID); + if (columnIndex > 0) { + s_login_info.setInfo_id(rs.getLong(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, S_login_info_mapper.USER_NAME); + if (columnIndex > 0) { + s_login_info.setUser_name(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_login_info_mapper.IPADDR); + if (columnIndex > 0) { + s_login_info.setIpaddr(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_login_info_mapper.LOGIN_LOCATION); + if (columnIndex > 0) { + s_login_info.setLogin_location(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_login_info_mapper.BROWSER); + if (columnIndex > 0) { + s_login_info.setBrowser(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_login_info_mapper.OS); + if (columnIndex > 0) { + s_login_info.setOs(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_login_info_mapper.STATUS); + if (columnIndex > 0) { + s_login_info.setStatus(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_login_info_mapper.MSG); + if (columnIndex > 0) { + s_login_info.setMsg(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_login_info_mapper.LOGIN_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_login_info.setLogin_time(null); + } else { + s_login_info.setLogin_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_login_info_mapper.BASE_USER_ID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_login_info.setBase_user_id(null); + } else { + s_login_info.setBase_user_id(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_login_info_mapper.BASE_USER_NAME); + if (columnIndex > 0) { + s_login_info.setBase_user_name(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_login_info_mapper.PSN_CODE); + if (columnIndex > 0) { + s_login_info.setPsn_code(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_login_info_mapper.PHONE); + if (columnIndex > 0) { + s_login_info.setPhone(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_login_info_mapper.PHONE_DESEN); + if (columnIndex > 0) { + s_login_info.setPhone_desen(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_login_info_mapper.CLIENT_TYPE); + if (columnIndex > 0) { + s_login_info.setClient_type(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_login_info_mapper.GROUP_DEPT_ID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_login_info.setGroup_dept_id(null); + } else { + s_login_info.setGroup_dept_id(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_login_info_mapper.PROVINCE_DEPT_ID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_login_info.setProvince_dept_id(null); + } else { + s_login_info.setProvince_dept_id(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_login_info_mapper.CITY_DEPT_ID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_login_info.setCity_dept_id(null); + } else { + s_login_info.setCity_dept_id(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_login_info_mapper.COUNTY_DEPT_ID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_login_info.setCounty_dept_id(null); + } else { + s_login_info.setCounty_dept_id(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_login_info_mapper.GROUP_DEPT_NAME); + if (columnIndex > 0) { + s_login_info.setGroup_dept_name(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_login_info_mapper.PROVINCE_DEPT_NAME); + if (columnIndex > 0) { + s_login_info.setProvince_dept_name(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_login_info_mapper.CITY_DEPT_NAME); + if (columnIndex > 0) { + s_login_info.setCity_dept_name(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_login_info_mapper.COUNTY_DEPT_NAME); + if (columnIndex > 0) { + s_login_info.setCounty_dept_name(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_login_info_mapper.BASE_DEPT_ID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_login_info.setBase_dept_id(null); + } else { + s_login_info.setBase_dept_id(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_login_info_mapper.BASE_DEPT_NAME); + if (columnIndex > 0) { + s_login_info.setBase_dept_name(rs.getString(columnIndex)); + } + return s_login_info; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_menu.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_menu.java new file mode 100644 index 0000000..847a6d2 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_menu.java @@ -0,0 +1,453 @@ + + +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:S_MENU * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class S_menu extends BasePo<S_menu> implements Comparable<S_menu> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + // 涓婚敭 + private String menu_id = null; + @JsonIgnore + protected boolean isset_menu_id = false; + + // 灞炴�у垪琛� + private String menu_name = null; + @JsonIgnore + protected boolean isset_menu_name = false; + + private String parent_id = null; + @JsonIgnore + protected boolean isset_parent_id = false; + + private Integer order_num = null; + @JsonIgnore + protected boolean isset_order_num = false; + + private String path = null; + @JsonIgnore + protected boolean isset_path = false; + + private String component = null; + @JsonIgnore + protected boolean isset_component = false; + + private String query = null; + @JsonIgnore + protected boolean isset_query = false; + + private Integer is_frame = null; + @JsonIgnore + protected boolean isset_is_frame = false; + + private Integer is_cache = null; + @JsonIgnore + protected boolean isset_is_cache = false; + + private String menu_type = null; + @JsonIgnore + protected boolean isset_menu_type = false; + + private String visible = null; + @JsonIgnore + protected boolean isset_visible = false; + + private Integer status = null; + @JsonIgnore + protected boolean isset_status = false; + + private String perms = null; + @JsonIgnore + protected boolean isset_perms = false; + + private String icon = null; + @JsonIgnore + protected boolean isset_icon = false; + + private String remark = null; + @JsonIgnore + protected boolean isset_remark = false; + + private Integer is_show = null; + @JsonIgnore + protected boolean isset_is_show = false; + + private Integer type = null; + @JsonIgnore + protected boolean isset_type = false; + + private String icon_info = null; + @JsonIgnore + protected boolean isset_icon_info = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_menu() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public S_menu(String menu_id) { + this.setMenu_id(menu_id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setMenu_id((String) value); + } + + public String getMenu_id() { + return this.menu_id; + } + public void setMenu_id(String menu_id) { + this.menu_id = menu_id; + this.isset_menu_id = true; + } + @JsonIgnore + public boolean isEmptyMenu_id() { + return this.menu_id == null || this.menu_id.length() == 0; + } + + + public String getMenu_name() { + return this.menu_name; + } + public void setMenu_name(String menu_name) { + this.menu_name = menu_name; + this.isset_menu_name = true; + } + @JsonIgnore + public boolean isEmptyMenu_name() { + return this.menu_name == null || this.menu_name.length() == 0; + } + + + public String getParent_id() { + return this.parent_id; + } + public void setParent_id(String parent_id) { + this.parent_id = parent_id; + this.isset_parent_id = true; + } + @JsonIgnore + public boolean isEmptyParent_id() { + return this.parent_id == null || this.parent_id.length() == 0; + } + + + public Integer getOrder_num() { + return this.order_num; + } + public void setOrder_num(Integer order_num) { + this.order_num = order_num; + this.isset_order_num = true; + } + @JsonIgnore + public boolean isEmptyOrder_num() { + return this.order_num == null; + } + + + public String getPath() { + return this.path; + } + public void setPath(String path) { + this.path = path; + this.isset_path = true; + } + @JsonIgnore + public boolean isEmptyPath() { + return this.path == null || this.path.length() == 0; + } + + + public String getComponent() { + return this.component; + } + public void setComponent(String component) { + this.component = component; + this.isset_component = true; + } + @JsonIgnore + public boolean isEmptyComponent() { + return this.component == null || this.component.length() == 0; + } + + + public String getQuery() { + return this.query; + } + public void setQuery(String query) { + this.query = query; + this.isset_query = true; + } + @JsonIgnore + public boolean isEmptyQuery() { + return this.query == null || this.query.length() == 0; + } + + + public Integer getIs_frame() { + return this.is_frame; + } + public void setIs_frame(Integer is_frame) { + this.is_frame = is_frame; + this.isset_is_frame = true; + } + @JsonIgnore + public boolean isEmptyIs_frame() { + return this.is_frame == null; + } + + + public Integer getIs_cache() { + return this.is_cache; + } + public void setIs_cache(Integer is_cache) { + this.is_cache = is_cache; + this.isset_is_cache = true; + } + @JsonIgnore + public boolean isEmptyIs_cache() { + return this.is_cache == null; + } + + + public String getMenu_type() { + return this.menu_type; + } + public void setMenu_type(String menu_type) { + this.menu_type = menu_type; + this.isset_menu_type = true; + } + @JsonIgnore + public boolean isEmptyMenu_type() { + return this.menu_type == null || this.menu_type.length() == 0; + } + + + public String getVisible() { + return this.visible; + } + public void setVisible(String visible) { + this.visible = visible; + this.isset_visible = true; + } + @JsonIgnore + public boolean isEmptyVisible() { + return this.visible == null || this.visible.length() == 0; + } + + + public Integer getStatus() { + return this.status; + } + public void setStatus(Integer status) { + this.status = status; + this.isset_status = true; + } + @JsonIgnore + public boolean isEmptyStatus() { + return this.status == null; + } + + + public String getPerms() { + return this.perms; + } + public void setPerms(String perms) { + this.perms = perms; + this.isset_perms = true; + } + @JsonIgnore + public boolean isEmptyPerms() { + return this.perms == null || this.perms.length() == 0; + } + + + public String getIcon() { + return this.icon; + } + public void setIcon(String icon) { + this.icon = icon; + this.isset_icon = true; + } + @JsonIgnore + public boolean isEmptyIcon() { + return this.icon == null || this.icon.length() == 0; + } + + + public String getRemark() { + return this.remark; + } + public void setRemark(String remark) { + this.remark = remark; + this.isset_remark = true; + } + @JsonIgnore + public boolean isEmptyRemark() { + return this.remark == null || this.remark.length() == 0; + } + + + public Integer getIs_show() { + return this.is_show; + } + public void setIs_show(Integer is_show) { + this.is_show = is_show; + this.isset_is_show = true; + } + @JsonIgnore + public boolean isEmptyIs_show() { + return this.is_show == null; + } + + + public Integer getType() { + return this.type; + } + public void setType(Integer type) { + this.type = type; + this.isset_type = true; + } + @JsonIgnore + public boolean isEmptyType() { + return this.type == null; + } + + + public String getIcon_info() { + return this.icon_info; + } + public void setIcon_info(String icon_info) { + this.icon_info = icon_info; + this.isset_icon_info = true; + } + @JsonIgnore + public boolean isEmptyIcon_info() { + return this.icon_info == null || this.icon_info.length() == 0; + } + + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("menu_id=").append(this.menu_id) + .append("menu_name=").append(this.menu_name) + .append("parent_id=").append(this.parent_id) + .append("order_num=").append(this.order_num) + .append("path=").append(this.path) + .append("component=").append(this.component) + .append("query=").append(this.query) + .append("is_frame=").append(this.is_frame) + .append("is_cache=").append(this.is_cache) + .append("menu_type=").append(this.menu_type) + .append("visible=").append(this.visible) + .append("status=").append(this.status) + .append("perms=").append(this.perms) + .append("icon=").append(this.icon) + .append("remark=").append(this.remark) + .append("is_show=").append(this.is_show) + .append("type=").append(this.type) + .append("icon_info=").append(this.icon_info) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public S_menu $clone() { + S_menu s_menu = new S_menu(); + + // 鏁版嵁搴撳悕绉� + //s_menu.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_menu_id) { + s_menu.setMenu_id(this.getMenu_id()); + } + // 鏅�氬睘鎬� + if (this.isset_menu_name) { + s_menu.setMenu_name(this.getMenu_name()); + } + if (this.isset_parent_id) { + s_menu.setParent_id(this.getParent_id()); + } + if (this.isset_order_num) { + s_menu.setOrder_num(this.getOrder_num()); + } + if (this.isset_path) { + s_menu.setPath(this.getPath()); + } + if (this.isset_component) { + s_menu.setComponent(this.getComponent()); + } + if (this.isset_query) { + s_menu.setQuery(this.getQuery()); + } + if (this.isset_is_frame) { + s_menu.setIs_frame(this.getIs_frame()); + } + if (this.isset_is_cache) { + s_menu.setIs_cache(this.getIs_cache()); + } + if (this.isset_menu_type) { + s_menu.setMenu_type(this.getMenu_type()); + } + if (this.isset_visible) { + s_menu.setVisible(this.getVisible()); + } + if (this.isset_status) { + s_menu.setStatus(this.getStatus()); + } + if (this.isset_perms) { + s_menu.setPerms(this.getPerms()); + } + if (this.isset_icon) { + s_menu.setIcon(this.getIcon()); + } + if (this.isset_remark) { + s_menu.setRemark(this.getRemark()); + } + if (this.isset_is_show) { + s_menu.setIs_show(this.getIs_show()); + } + if (this.isset_type) { + s_menu.setType(this.getType()); + } + if (this.isset_icon_info) { + s_menu.setIcon_info(this.getIcon_info()); + } + return s_menu; + } + + @Override + public int compareTo(S_menu o) { +// int p1 = systemMenu.getParent_id().hashCode(); +// int p2 = this.getParent_id().hashCode(); +// if(p1 != p2){ +// return p1 - p2; +// } else { +// return 0; +// } + return (int)(Long.parseLong(o.getMenu_id()) - Long.parseLong(this.getMenu_id())); + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_menu_mapper.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_menu_mapper.java new file mode 100644 index 0000000..e3fe58b --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_menu_mapper.java @@ -0,0 +1,439 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:S_MENU * + * @author genrator + */ +public class S_menu_mapper extends S_menu implements BaseMapper<S_menu> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<S_menu> ROW_MAPPER = new S_menuRowMapper(); + + // 涓婚敭 + public static final String MENU_ID = "menu_id"; + // 鏅�氬睘鎬� + public static final String MENU_NAME = "menu_name"; + public static final String PARENT_ID = "parent_id"; + public static final String ORDER_NUM = "order_num"; + public static final String PATH = "path"; + public static final String COMPONENT = "component"; + public static final String QUERY = "query"; + public static final String IS_FRAME = "is_frame"; + public static final String IS_CACHE = "is_cache"; + public static final String MENU_TYPE = "menu_type"; + public static final String VISIBLE = "visible"; + public static final String STATUS = "status"; + public static final String PERMS = "perms"; + public static final String ICON = "icon"; + public static final String REMARK = "remark"; + public static final String IS_SHOW = "is_show"; + public static final String TYPE = "type"; + public static final String ICON_INFO = "icon_info"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_menu_mapper(S_menu s_menu) { + if (s_menu == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (s_menu.isset_menu_id) { + this.setMenu_id(s_menu.getMenu_id()); + } + //鏅�氬睘鎬� + if (s_menu.isset_menu_name) { + this.setMenu_name(s_menu.getMenu_name()); + } + if (s_menu.isset_parent_id) { + this.setParent_id(s_menu.getParent_id()); + } + if (s_menu.isset_order_num) { + this.setOrder_num(s_menu.getOrder_num()); + } + if (s_menu.isset_path) { + this.setPath(s_menu.getPath()); + } + if (s_menu.isset_component) { + this.setComponent(s_menu.getComponent()); + } + if (s_menu.isset_query) { + this.setQuery(s_menu.getQuery()); + } + if (s_menu.isset_is_frame) { + this.setIs_frame(s_menu.getIs_frame()); + } + if (s_menu.isset_is_cache) { + this.setIs_cache(s_menu.getIs_cache()); + } + if (s_menu.isset_menu_type) { + this.setMenu_type(s_menu.getMenu_type()); + } + if (s_menu.isset_visible) { + this.setVisible(s_menu.getVisible()); + } + if (s_menu.isset_status) { + this.setStatus(s_menu.getStatus()); + } + if (s_menu.isset_perms) { + this.setPerms(s_menu.getPerms()); + } + if (s_menu.isset_icon) { + this.setIcon(s_menu.getIcon()); + } + if (s_menu.isset_remark) { + this.setRemark(s_menu.getRemark()); + } + if (s_menu.isset_is_show) { + this.setIs_show(s_menu.getIs_show()); + } + if (s_menu.isset_type) { + this.setType(s_menu.getType()); + } + if (s_menu.isset_icon_info) { + this.setIcon_info(s_menu.getIcon_info()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(s_menu.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "s_menu"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return MENU_ID; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getMenu_id(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(MENU_ID, this.getMenu_id()); + ib.set(MENU_NAME, this.getMenu_name(), this.isset_menu_name); + ib.set(PARENT_ID, this.getParent_id(), this.isset_parent_id); + ib.set(ORDER_NUM, this.getOrder_num(), this.isset_order_num); + ib.set(PATH, this.getPath(), this.isset_path); + ib.set(COMPONENT, this.getComponent(), this.isset_component); + ib.set(QUERY, this.getQuery(), this.isset_query); + ib.set(IS_FRAME, this.getIs_frame(), this.isset_is_frame); + ib.set(IS_CACHE, this.getIs_cache(), this.isset_is_cache); + ib.set(MENU_TYPE, this.getMenu_type(), this.isset_menu_type); + ib.set(VISIBLE, this.getVisible(), this.isset_visible); + ib.set(STATUS, this.getStatus(), this.isset_status); + ib.set(PERMS, this.getPerms(), this.isset_perms); + ib.set(ICON, this.getIcon(), this.isset_icon); + ib.set(REMARK, this.getRemark(), this.isset_remark); + ib.set(IS_SHOW, this.getIs_show(), this.isset_is_show); + ib.set(TYPE, this.getType(), this.isset_type); + ib.set(ICON_INFO, this.getIcon_info(), this.isset_icon_info); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(MENU_NAME, this.getMenu_name(), this.isset_menu_name); + ub.set(PARENT_ID, this.getParent_id(), this.isset_parent_id); + ub.set(ORDER_NUM, this.getOrder_num(), this.isset_order_num); + ub.set(PATH, this.getPath(), this.isset_path); + ub.set(COMPONENT, this.getComponent(), this.isset_component); + ub.set(QUERY, this.getQuery(), this.isset_query); + ub.set(IS_FRAME, this.getIs_frame(), this.isset_is_frame); + ub.set(IS_CACHE, this.getIs_cache(), this.isset_is_cache); + ub.set(MENU_TYPE, this.getMenu_type(), this.isset_menu_type); + ub.set(VISIBLE, this.getVisible(), this.isset_visible); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(PERMS, this.getPerms(), this.isset_perms); + ub.set(ICON, this.getIcon(), this.isset_icon); + ub.set(REMARK, this.getRemark(), this.isset_remark); + ub.set(IS_SHOW, this.getIs_show(), this.isset_is_show); + ub.set(TYPE, this.getType(), this.isset_type); + ub.set(ICON_INFO, this.getIcon_info(), this.isset_icon_info); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(MENU_NAME, this.getMenu_name(), this.isset_menu_name); + ub.set(PARENT_ID, this.getParent_id(), this.isset_parent_id); + ub.set(ORDER_NUM, this.getOrder_num(), this.isset_order_num); + ub.set(PATH, this.getPath(), this.isset_path); + ub.set(COMPONENT, this.getComponent(), this.isset_component); + ub.set(QUERY, this.getQuery(), this.isset_query); + ub.set(IS_FRAME, this.getIs_frame(), this.isset_is_frame); + ub.set(IS_CACHE, this.getIs_cache(), this.isset_is_cache); + ub.set(MENU_TYPE, this.getMenu_type(), this.isset_menu_type); + ub.set(VISIBLE, this.getVisible(), this.isset_visible); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(PERMS, this.getPerms(), this.isset_perms); + ub.set(ICON, this.getIcon(), this.isset_icon); + ub.set(REMARK, this.getRemark(), this.isset_remark); + ub.set(IS_SHOW, this.getIs_show(), this.isset_is_show); + ub.set(TYPE, this.getType(), this.isset_type); + ub.set(ICON_INFO, this.getIcon_info(), this.isset_icon_info); + + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(MENU_NAME, this.getMenu_name(), this.isset_menu_name); + ub.set(PARENT_ID, this.getParent_id(), this.isset_parent_id); + ub.set(ORDER_NUM, this.getOrder_num(), this.isset_order_num); + ub.set(PATH, this.getPath(), this.isset_path); + ub.set(COMPONENT, this.getComponent(), this.isset_component); + ub.set(QUERY, this.getQuery(), this.isset_query); + ub.set(IS_FRAME, this.getIs_frame(), this.isset_is_frame); + ub.set(IS_CACHE, this.getIs_cache(), this.isset_is_cache); + ub.set(MENU_TYPE, this.getMenu_type(), this.isset_menu_type); + ub.set(VISIBLE, this.getVisible(), this.isset_visible); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(PERMS, this.getPerms(), this.isset_perms); + ub.set(ICON, this.getIcon(), this.isset_icon); + ub.set(REMARK, this.getRemark(), this.isset_remark); + ub.set(IS_SHOW, this.getIs_show(), this.isset_is_show); + ub.set(TYPE, this.getType(), this.isset_type); + ub.set(ICON_INFO, this.getIcon_info(), this.isset_icon_info); + + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select menu_id, menu_name, parent_id, order_num, path, component, query, is_frame, is_cache, menu_type, visible, status, perms, icon, remark, is_show, type, icon_info from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select menu_id, menu_name, parent_id, order_num, path, component, query, is_frame, is_cache, menu_type, visible, status, perms, icon, remark, is_show, type, icon_info from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public S_menu mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public S_menu toS_menu() { + return super.$clone(); + } +} + +/** + * s_menu RowMapper + * + * @author genrator + */ +class S_menuRowMapper implements RowMapper<S_menu> { + + @Override + public S_menu mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + S_menu s_menu = new S_menu(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, S_menu_mapper.MENU_ID); + if (columnIndex > 0) { + s_menu.setMenu_id(rs.getString(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, S_menu_mapper.MENU_NAME); + if (columnIndex > 0) { + s_menu.setMenu_name(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_menu_mapper.PARENT_ID); + if (columnIndex > 0) { + s_menu.setParent_id(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_menu_mapper.ORDER_NUM); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_menu.setOrder_num(null); + } else { + s_menu.setOrder_num(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_menu_mapper.PATH); + if (columnIndex > 0) { + s_menu.setPath(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_menu_mapper.COMPONENT); + if (columnIndex > 0) { + s_menu.setComponent(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_menu_mapper.QUERY); + if (columnIndex > 0) { + s_menu.setQuery(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_menu_mapper.IS_FRAME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_menu.setIs_frame(null); + } else { + s_menu.setIs_frame(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_menu_mapper.IS_CACHE); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_menu.setIs_cache(null); + } else { + s_menu.setIs_cache(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_menu_mapper.MENU_TYPE); + if (columnIndex > 0) { + s_menu.setMenu_type(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_menu_mapper.VISIBLE); + if (columnIndex > 0) { + s_menu.setVisible(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_menu_mapper.STATUS); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_menu.setStatus(null); + } else { + s_menu.setStatus(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_menu_mapper.PERMS); + if (columnIndex > 0) { + s_menu.setPerms(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_menu_mapper.ICON); + if (columnIndex > 0) { + s_menu.setIcon(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_menu_mapper.REMARK); + if (columnIndex > 0) { + s_menu.setRemark(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_menu_mapper.IS_SHOW); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_menu.setIs_show(null); + } else { + s_menu.setIs_show(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_menu_mapper.TYPE); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_menu.setType(null); + } else { + s_menu.setType(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_menu_mapper.ICON_INFO); + if (columnIndex > 0) { + s_menu.setIcon_info(rs.getString(columnIndex)); + } + return s_menu; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_message.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_message.java new file mode 100644 index 0000000..47f5e8d --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_message.java @@ -0,0 +1,441 @@ +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:S_MESSAGE * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class S_message extends BasePo<S_message> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + /** + * 鐢ㄤ簬鍏煎鑰佸啓娉� + */ + @JsonIgnore + public static final S_message ROW_MAPPER = new S_message(); + + // 涓婚敭 + private String id = null; + @JsonIgnore + protected boolean isset_id = false; + + // 灞炴�у垪琛� + private Long create_time = null; + @JsonIgnore + protected boolean isset_create_time = false; + + private String creator = null; + @JsonIgnore + protected boolean isset_creator = false; + + private String msg_from = null; + @JsonIgnore + protected boolean isset_msg_from = false; + + private String receiver = null; + @JsonIgnore + protected boolean isset_receiver = false; + + private String channel_index = null; + @JsonIgnore + protected boolean isset_channel_index = false; + + private Integer time_type = null; + @JsonIgnore + protected boolean isset_time_type = false; + + private Long delayed_time = null; + @JsonIgnore + protected boolean isset_delayed_time = false; + + private String title = null; + @JsonIgnore + protected boolean isset_title = false; + + private String content = null; + @JsonIgnore + protected boolean isset_content = false; + + private Integer broad_cast = null; + @JsonIgnore + protected boolean isset_broad_cast = false; + + private String option_type = null; + @JsonIgnore + protected boolean isset_option_type = false; + + private String option_id = null; + @JsonIgnore + protected boolean isset_option_id = false; + + private Integer read_done = null; + @JsonIgnore + protected boolean isset_read_done = false; + + private Long read_time = null; + @JsonIgnore + protected boolean isset_read_time = false; + + private Integer failed = null; + @JsonIgnore + protected boolean isset_failed = false; + + private String summary = null; + @JsonIgnore + protected boolean isset_summary = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_message() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public S_message(String id) { + this.setId(id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setId((String) value); + } + + public String getId() { + return this.id; + } + + public void setId(String id) { + this.id = id; + this.isset_id = true; + } + + @JsonIgnore + public boolean isEmptyId() { + return this.id == null || this.id.length() == 0; + } + + public Long getCreate_time() { + return this.create_time; + } + + public void setCreate_time(Long create_time) { + this.create_time = create_time; + this.isset_create_time = true; + } + + @JsonIgnore + public boolean isEmptyCreate_time() { + return this.create_time == null; + } + + public String getCreator() { + return this.creator; + } + + public void setCreator(String creator) { + this.creator = creator; + this.isset_creator = true; + } + + @JsonIgnore + public boolean isEmptyCreator() { + return this.creator == null || this.creator.length() == 0; + } + + public String getMsg_from() { + return this.msg_from; + } + + public void setMsg_from(String msg_from) { + this.msg_from = msg_from; + this.isset_msg_from = true; + } + + @JsonIgnore + public boolean isEmptyMsg_from() { + return this.msg_from == null || this.msg_from.length() == 0; + } + + public String getReceiver() { + return this.receiver; + } + + public void setReceiver(String receiver) { + this.receiver = receiver; + this.isset_receiver = true; + } + + @JsonIgnore + public boolean isEmptyReceiver() { + return this.receiver == null || this.receiver.length() == 0; + } + + public String getChannel_index() { + return this.channel_index; + } + + public void setChannel_index(String channel_index) { + this.channel_index = channel_index; + this.isset_channel_index = true; + } + + @JsonIgnore + public boolean isEmptyChannel_index() { + return this.channel_index == null || this.channel_index.length() == 0; + } + + public Integer getTime_type() { + return this.time_type; + } + + public void setTime_type(Integer time_type) { + this.time_type = time_type; + this.isset_time_type = true; + } + + @JsonIgnore + public boolean isEmptyTime_type() { + return this.time_type == null; + } + + public Long getDelayed_time() { + return this.delayed_time; + } + + public void setDelayed_time(Long delayed_time) { + this.delayed_time = delayed_time; + this.isset_delayed_time = true; + } + + @JsonIgnore + public boolean isEmptyDelayed_time() { + return this.delayed_time == null; + } + + public String getTitle() { + return this.title; + } + + public void setTitle(String title) { + this.title = title; + this.isset_title = true; + } + + @JsonIgnore + public boolean isEmptyTitle() { + return this.title == null || this.title.length() == 0; + } + + public String getContent() { + return this.content; + } + + public void setContent(String content) { + this.content = content; + this.isset_content = true; + } + + @JsonIgnore + public boolean isEmptyContent() { + return this.content == null || this.content.length() == 0; + } + + public Integer getBroad_cast() { + return this.broad_cast; + } + + public void setBroad_cast(Integer broad_cast) { + this.broad_cast = broad_cast; + this.isset_broad_cast = true; + } + + @JsonIgnore + public boolean isEmptyBroad_cast() { + return this.broad_cast == null; + } + + public String getOption_type() { + return this.option_type; + } + + public void setOption_type(String option_type) { + this.option_type = option_type; + this.isset_option_type = true; + } + + @JsonIgnore + public boolean isEmptyOption_type() { + return this.option_type == null || this.option_type.length() == 0; + } + + public String getOption_id() { + return this.option_id; + } + + public void setOption_id(String option_id) { + this.option_id = option_id; + this.isset_option_id = true; + } + + @JsonIgnore + public boolean isEmptyOption_id() { + return this.option_id == null || this.option_id.length() == 0; + } + + public Integer getRead_done() { + return this.read_done; + } + + public void setRead_done(Integer read_done) { + this.read_done = read_done; + this.isset_read_done = true; + } + + @JsonIgnore + public boolean isEmptyRead_done() { + return this.read_done == null; + } + + public Long getRead_time() { + return this.read_time; + } + + public void setRead_time(Long read_time) { + this.read_time = read_time; + this.isset_read_time = true; + } + + @JsonIgnore + public boolean isEmptyRead_time() { + return this.read_time == null; + } + + public Integer getFailed() { + return this.failed; + } + + public void setFailed(Integer failed) { + this.failed = failed; + this.isset_failed = true; + } + + @JsonIgnore + public boolean isEmptyFailed() { + return this.failed == null; + } + + public String getSummary() { + return this.summary; + } + + public void setSummary(String summary) { + this.summary = summary; + this.isset_summary = true; + } + + @JsonIgnore + public boolean isEmptySummary() { + return this.summary == null || this.summary.length() == 0; + } + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("id=").append(this.id) + .append("create_time=").append(this.create_time) + .append("creator=").append(this.creator) + .append("msg_from=").append(this.msg_from) + .append("receiver=").append(this.receiver) + .append("channel_index=").append(this.channel_index) + .append("time_type=").append(this.time_type) + .append("delayed_time=").append(this.delayed_time) + .append("title=").append(this.title) + .append("content=").append(this.content) + .append("broad_cast=").append(this.broad_cast) + .append("option_type=").append(this.option_type) + .append("option_id=").append(this.option_id) + .append("read_done=").append(this.read_done) + .append("read_time=").append(this.read_time) + .append("failed=").append(this.failed) + .append("summary=").append(this.summary) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public S_message $clone() { + S_message s_message = new S_message(); + + // 鏁版嵁搴撳悕绉� + //s_message.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_id) { + s_message.setId(this.getId()); + } + // 鏅�氬睘鎬� + if (this.isset_create_time) { + s_message.setCreate_time(this.getCreate_time()); + } + if (this.isset_creator) { + s_message.setCreator(this.getCreator()); + } + if (this.isset_msg_from) { + s_message.setMsg_from(this.getMsg_from()); + } + if (this.isset_receiver) { + s_message.setReceiver(this.getReceiver()); + } + if (this.isset_channel_index) { + s_message.setChannel_index(this.getChannel_index()); + } + if (this.isset_time_type) { + s_message.setTime_type(this.getTime_type()); + } + if (this.isset_delayed_time) { + s_message.setDelayed_time(this.getDelayed_time()); + } + if (this.isset_title) { + s_message.setTitle(this.getTitle()); + } + if (this.isset_content) { + s_message.setContent(this.getContent()); + } + if (this.isset_broad_cast) { + s_message.setBroad_cast(this.getBroad_cast()); + } + if (this.isset_option_type) { + s_message.setOption_type(this.getOption_type()); + } + if (this.isset_option_id) { + s_message.setOption_id(this.getOption_id()); + } + if (this.isset_read_done) { + s_message.setRead_done(this.getRead_done()); + } + if (this.isset_read_time) { + s_message.setRead_time(this.getRead_time()); + } + if (this.isset_failed) { + s_message.setFailed(this.getFailed()); + } + if (this.isset_summary) { + s_message.setSummary(this.getSummary()); + } + return s_message; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_message_mapper.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_message_mapper.java new file mode 100644 index 0000000..d398c9a --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_message_mapper.java @@ -0,0 +1,431 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:S_MESSAGE * + * @author genrator + */ +public class S_message_mapper extends S_message implements BaseMapper<S_message> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<S_message> ROW_MAPPER = new S_messageRowMapper(); + + // 涓婚敭 + public static final String ID = "id"; + // 鏅�氬睘鎬� + public static final String CREATE_TIME = "create_time"; + public static final String CREATOR = "creator"; + public static final String MSG_FROM = "msg_from"; + public static final String RECEIVER = "receiver"; + public static final String CHANNEL_INDEX = "channel_index"; + public static final String TIME_TYPE = "time_type"; + public static final String DELAYED_TIME = "delayed_time"; + public static final String TITLE = "title"; + public static final String CONTENT = "content"; + public static final String BROAD_CAST = "broad_cast"; + public static final String OPTION_TYPE = "option_type"; + public static final String OPTION_ID = "option_id"; + public static final String READ_DONE = "read_done"; + public static final String READ_TIME = "read_time"; + public static final String FAILED = "failed"; + public static final String SUMMARY = "summary"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_message_mapper(S_message s_message) { + if (s_message == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (s_message.isset_id) { + this.setId(s_message.getId()); + } + //鏅�氬睘鎬� + if (s_message.isset_create_time) { + this.setCreate_time(s_message.getCreate_time()); + } + if (s_message.isset_creator) { + this.setCreator(s_message.getCreator()); + } + if (s_message.isset_msg_from) { + this.setMsg_from(s_message.getMsg_from()); + } + if (s_message.isset_receiver) { + this.setReceiver(s_message.getReceiver()); + } + if (s_message.isset_channel_index) { + this.setChannel_index(s_message.getChannel_index()); + } + if (s_message.isset_time_type) { + this.setTime_type(s_message.getTime_type()); + } + if (s_message.isset_delayed_time) { + this.setDelayed_time(s_message.getDelayed_time()); + } + if (s_message.isset_title) { + this.setTitle(s_message.getTitle()); + } + if (s_message.isset_content) { + this.setContent(s_message.getContent()); + } + if (s_message.isset_broad_cast) { + this.setBroad_cast(s_message.getBroad_cast()); + } + if (s_message.isset_option_type) { + this.setOption_type(s_message.getOption_type()); + } + if (s_message.isset_option_id) { + this.setOption_id(s_message.getOption_id()); + } + if (s_message.isset_read_done) { + this.setRead_done(s_message.getRead_done()); + } + if (s_message.isset_read_time) { + this.setRead_time(s_message.getRead_time()); + } + if (s_message.isset_failed) { + this.setFailed(s_message.getFailed()); + } + if (s_message.isset_summary) { + this.setSummary(s_message.getSummary()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(s_message.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "s_message"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return ID; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getId(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(ID, this.getId()); + ib.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ib.set(CREATOR, this.getCreator(), this.isset_creator); + ib.set(MSG_FROM, this.getMsg_from(), this.isset_msg_from); + ib.set(RECEIVER, this.getReceiver(), this.isset_receiver); + ib.set(CHANNEL_INDEX, this.getChannel_index(), this.isset_channel_index); + ib.set(TIME_TYPE, this.getTime_type(), this.isset_time_type); + ib.set(DELAYED_TIME, this.getDelayed_time(), this.isset_delayed_time); + ib.set(TITLE, this.getTitle(), this.isset_title); + ib.set(CONTENT, this.getContent(), this.isset_content); + ib.set(BROAD_CAST, this.getBroad_cast(), this.isset_broad_cast); + ib.set(OPTION_TYPE, this.getOption_type(), this.isset_option_type); + ib.set(OPTION_ID, this.getOption_id(), this.isset_option_id); + ib.set(READ_DONE, this.getRead_done(), this.isset_read_done); + ib.set(READ_TIME, this.getRead_time(), this.isset_read_time); + ib.set(FAILED, this.getFailed(), this.isset_failed); + ib.set(SUMMARY, this.getSummary(), this.isset_summary); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(CREATOR, this.getCreator(), this.isset_creator); + ub.set(MSG_FROM, this.getMsg_from(), this.isset_msg_from); + ub.set(RECEIVER, this.getReceiver(), this.isset_receiver); + ub.set(CHANNEL_INDEX, this.getChannel_index(), this.isset_channel_index); + ub.set(TIME_TYPE, this.getTime_type(), this.isset_time_type); + ub.set(DELAYED_TIME, this.getDelayed_time(), this.isset_delayed_time); + ub.set(TITLE, this.getTitle(), this.isset_title); + ub.set(CONTENT, this.getContent(), this.isset_content); + ub.set(BROAD_CAST, this.getBroad_cast(), this.isset_broad_cast); + ub.set(OPTION_TYPE, this.getOption_type(), this.isset_option_type); + ub.set(OPTION_ID, this.getOption_id(), this.isset_option_id); + ub.set(READ_DONE, this.getRead_done(), this.isset_read_done); + ub.set(READ_TIME, this.getRead_time(), this.isset_read_time); + ub.set(FAILED, this.getFailed(), this.isset_failed); + ub.set(SUMMARY, this.getSummary(), this.isset_summary); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(CREATOR, this.getCreator(), this.isset_creator); + ub.set(MSG_FROM, this.getMsg_from(), this.isset_msg_from); + ub.set(RECEIVER, this.getReceiver(), this.isset_receiver); + ub.set(CHANNEL_INDEX, this.getChannel_index(), this.isset_channel_index); + ub.set(TIME_TYPE, this.getTime_type(), this.isset_time_type); + ub.set(DELAYED_TIME, this.getDelayed_time(), this.isset_delayed_time); + ub.set(TITLE, this.getTitle(), this.isset_title); + ub.set(CONTENT, this.getContent(), this.isset_content); + ub.set(BROAD_CAST, this.getBroad_cast(), this.isset_broad_cast); + ub.set(OPTION_TYPE, this.getOption_type(), this.isset_option_type); + ub.set(OPTION_ID, this.getOption_id(), this.isset_option_id); + ub.set(READ_DONE, this.getRead_done(), this.isset_read_done); + ub.set(READ_TIME, this.getRead_time(), this.isset_read_time); + ub.set(FAILED, this.getFailed(), this.isset_failed); + ub.set(SUMMARY, this.getSummary(), this.isset_summary); + + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(CREATOR, this.getCreator(), this.isset_creator); + ub.set(MSG_FROM, this.getMsg_from(), this.isset_msg_from); + ub.set(RECEIVER, this.getReceiver(), this.isset_receiver); + ub.set(CHANNEL_INDEX, this.getChannel_index(), this.isset_channel_index); + ub.set(TIME_TYPE, this.getTime_type(), this.isset_time_type); + ub.set(DELAYED_TIME, this.getDelayed_time(), this.isset_delayed_time); + ub.set(TITLE, this.getTitle(), this.isset_title); + ub.set(CONTENT, this.getContent(), this.isset_content); + ub.set(BROAD_CAST, this.getBroad_cast(), this.isset_broad_cast); + ub.set(OPTION_TYPE, this.getOption_type(), this.isset_option_type); + ub.set(OPTION_ID, this.getOption_id(), this.isset_option_id); + ub.set(READ_DONE, this.getRead_done(), this.isset_read_done); + ub.set(READ_TIME, this.getRead_time(), this.isset_read_time); + ub.set(FAILED, this.getFailed(), this.isset_failed); + ub.set(SUMMARY, this.getSummary(), this.isset_summary); + + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select id, create_time, creator, msg_from, receiver, channel_index, time_type, delayed_time, title, content, broad_cast, option_type, option_id, read_done, read_time, failed, summary from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select id, create_time, creator, msg_from, receiver, channel_index, time_type, delayed_time, title, content, broad_cast, option_type, option_id, read_done, read_time, failed, summary from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public S_message mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public S_message toS_message() { + return super.$clone(); + } +} + +/** + * s_message RowMapper + * + * @author genrator + */ +class S_messageRowMapper implements RowMapper<S_message> { + + @Override + public S_message mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + S_message s_message = new S_message(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, S_message_mapper.ID); + if (columnIndex > 0) { + s_message.setId(rs.getString(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, S_message_mapper.CREATE_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_message.setCreate_time(null); + } else { + s_message.setCreate_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_message_mapper.CREATOR); + if (columnIndex > 0) { + s_message.setCreator(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_message_mapper.MSG_FROM); + if (columnIndex > 0) { + s_message.setMsg_from(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_message_mapper.RECEIVER); + if (columnIndex > 0) { + s_message.setReceiver(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_message_mapper.CHANNEL_INDEX); + if (columnIndex > 0) { + s_message.setChannel_index(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_message_mapper.TIME_TYPE); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_message.setTime_type(null); + } else { + s_message.setTime_type(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_message_mapper.DELAYED_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_message.setDelayed_time(null); + } else { + s_message.setDelayed_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_message_mapper.TITLE); + if (columnIndex > 0) { + s_message.setTitle(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_message_mapper.CONTENT); + if (columnIndex > 0) { + s_message.setContent(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_message_mapper.BROAD_CAST); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_message.setBroad_cast(null); + } else { + s_message.setBroad_cast(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_message_mapper.OPTION_TYPE); + if (columnIndex > 0) { + s_message.setOption_type(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_message_mapper.OPTION_ID); + if (columnIndex > 0) { + s_message.setOption_id(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_message_mapper.READ_DONE); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_message.setRead_done(null); + } else { + s_message.setRead_done(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_message_mapper.READ_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_message.setRead_time(null); + } else { + s_message.setRead_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_message_mapper.FAILED); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_message.setFailed(null); + } else { + s_message.setFailed(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_message_mapper.SUMMARY); + if (columnIndex > 0) { + s_message.setSummary(rs.getString(columnIndex)); + } + return s_message; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_oper_log.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_oper_log.java new file mode 100644 index 0000000..1ce8b0c --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_oper_log.java @@ -0,0 +1,744 @@ + + +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:S_OPER_LOG * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class S_oper_log extends BasePo<S_oper_log> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + /** + * 鐢ㄤ簬鍏煎鑰佸啓娉� + */ + @JsonIgnore + public static final S_oper_log ROW_MAPPER = new S_oper_log(); + + // 涓婚敭 + private Long oper_id = null; + @JsonIgnore + protected boolean isset_oper_id = false; + + // 灞炴�у垪琛� + private String title = null; + @JsonIgnore + protected boolean isset_title = false; + + private Integer business_type = null; + @JsonIgnore + protected boolean isset_business_type = false; + + private String method = null; + @JsonIgnore + protected boolean isset_method = false; + + private String request_method = null; + @JsonIgnore + protected boolean isset_request_method = false; + + private Integer operate_user = null; + @JsonIgnore + protected boolean isset_operate_user = false; + + private String oper_name = null; + @JsonIgnore + protected boolean isset_oper_name = false; + + private String dept_name = null; + @JsonIgnore + protected boolean isset_dept_name = false; + + private String oper_url = null; + @JsonIgnore + protected boolean isset_oper_url = false; + + private String oper_ip = null; + @JsonIgnore + protected boolean isset_oper_ip = false; + + private String oper_location = null; + @JsonIgnore + protected boolean isset_oper_location = false; + + private String oper_param = null; + @JsonIgnore + protected boolean isset_oper_param = false; + + private String json_result = null; + @JsonIgnore + protected boolean isset_json_result = false; + + private Integer status = null; + @JsonIgnore + protected boolean isset_status = false; + + private String error_msg = null; + @JsonIgnore + protected boolean isset_error_msg = false; + + private Long oper_time = null; + @JsonIgnore + protected boolean isset_oper_time = false; + + private Long group_dept_id = null; + @JsonIgnore + protected boolean isset_group_dept_id = false; + + private Long province_dept_id = null; + @JsonIgnore + protected boolean isset_province_dept_id = false; + + private Long city_dept_id = null; + @JsonIgnore + protected boolean isset_city_dept_id = false; + + private Long county_dept_id = null; + @JsonIgnore + protected boolean isset_county_dept_id = false; + + private String group_dept_name = null; + @JsonIgnore + protected boolean isset_group_dept_name = false; + + private String province_dept_name = null; + @JsonIgnore + protected boolean isset_province_dept_name = false; + + private String city_dept_name = null; + @JsonIgnore + protected boolean isset_city_dept_name = false; + + private String county_dept_name = null; + @JsonIgnore + protected boolean isset_county_dept_name = false; + + private Long base_dept_id = null; + @JsonIgnore + protected boolean isset_base_dept_id = false; + + private String base_dept_name = null; + @JsonIgnore + protected boolean isset_base_dept_name = false; + + private Long base_user_id = null; + @JsonIgnore + protected boolean isset_base_user_id = false; + + private String base_user_name = null; + @JsonIgnore + protected boolean isset_base_user_name = false; + + private String base_user_code = null; + @JsonIgnore + protected boolean isset_base_user_code = false; + + private String psn_code = null; + @JsonIgnore + protected boolean isset_psn_code = false; + + private String phone = null; + @JsonIgnore + protected boolean isset_phone = false; + + private String phone_desen = null; + @JsonIgnore + protected boolean isset_phone_desen = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_oper_log() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public S_oper_log(Long oper_id) { + this.setOper_id(oper_id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setOper_id((Long) value); + } + + public Long getOper_id() { + return this.oper_id; + } + + public void setOper_id(Long oper_id) { + this.oper_id = oper_id; + this.isset_oper_id = true; + } + + @JsonIgnore + public boolean isEmptyOper_id() { + return this.oper_id == null; + } + + public String getTitle() { + return this.title; + } + + public void setTitle(String title) { + this.title = title; + this.isset_title = true; + } + + @JsonIgnore + public boolean isEmptyTitle() { + return this.title == null || this.title.length() == 0; + } + + + public Integer getBusiness_type() { + return this.business_type; + } + public void setBusiness_type(Integer business_type) { + this.business_type = business_type; + this.isset_business_type = true; + } + @JsonIgnore + public boolean isEmptyBusiness_type() { + return this.business_type == null; + } + + + public String getMethod() { + return this.method; + } + public void setMethod(String method) { + this.method = method; + this.isset_method = true; + } + @JsonIgnore + public boolean isEmptyMethod() { + return this.method == null || this.method.length() == 0; + } + + + public String getRequest_method() { + return this.request_method; + } + public void setRequest_method(String request_method) { + this.request_method = request_method; + this.isset_request_method = true; + } + @JsonIgnore + public boolean isEmptyRequest_method() { + return this.request_method == null || this.request_method.length() == 0; + } + + + public Integer getOperate_user() { + return this.operate_user; + } + public void setOperate_user(Integer operate_user) { + this.operate_user = operate_user; + this.isset_operate_user = true; + } + @JsonIgnore + public boolean isEmptyOperate_user() { + return this.operate_user == null; + } + + + public String getOper_name() { + return this.oper_name; + } + public void setOper_name(String oper_name) { + this.oper_name = oper_name; + this.isset_oper_name = true; + } + @JsonIgnore + public boolean isEmptyOper_name() { + return this.oper_name == null || this.oper_name.length() == 0; + } + + + public String getDept_name() { + return this.dept_name; + } + public void setDept_name(String dept_name) { + this.dept_name = dept_name; + this.isset_dept_name = true; + } + @JsonIgnore + public boolean isEmptyDept_name() { + return this.dept_name == null || this.dept_name.length() == 0; + } + + + public String getOper_url() { + return this.oper_url; + } + public void setOper_url(String oper_url) { + this.oper_url = oper_url; + this.isset_oper_url = true; + } + @JsonIgnore + public boolean isEmptyOper_url() { + return this.oper_url == null || this.oper_url.length() == 0; + } + + + public String getOper_ip() { + return this.oper_ip; + } + public void setOper_ip(String oper_ip) { + this.oper_ip = oper_ip; + this.isset_oper_ip = true; + } + @JsonIgnore + public boolean isEmptyOper_ip() { + return this.oper_ip == null || this.oper_ip.length() == 0; + } + + + public String getOper_location() { + return this.oper_location; + } + public void setOper_location(String oper_location) { + this.oper_location = oper_location; + this.isset_oper_location = true; + } + @JsonIgnore + public boolean isEmptyOper_location() { + return this.oper_location == null || this.oper_location.length() == 0; + } + + + public String getOper_param() { + return this.oper_param; + } + public void setOper_param(String oper_param) { + this.oper_param = oper_param; + this.isset_oper_param = true; + } + @JsonIgnore + public boolean isEmptyOper_param() { + return this.oper_param == null || this.oper_param.length() == 0; + } + + + public String getJson_result() { + return this.json_result; + } + public void setJson_result(String json_result) { + this.json_result = json_result; + this.isset_json_result = true; + } + @JsonIgnore + public boolean isEmptyJson_result() { + return this.json_result == null || this.json_result.length() == 0; + } + + + public Integer getStatus() { + return this.status; + } + public void setStatus(Integer status) { + this.status = status; + this.isset_status = true; + } + @JsonIgnore + public boolean isEmptyStatus() { + return this.status == null; + } + + + public String getError_msg() { + return this.error_msg; + } + public void setError_msg(String error_msg) { + this.error_msg = error_msg; + this.isset_error_msg = true; + } + @JsonIgnore + public boolean isEmptyError_msg() { + return this.error_msg == null || this.error_msg.length() == 0; + } + + + public Long getOper_time() { + return this.oper_time; + } + public void setOper_time(Long oper_time) { + this.oper_time = oper_time; + this.isset_oper_time = true; + } + @JsonIgnore + public boolean isEmptyOper_time() { + return this.oper_time == null; + } + + + public Long getGroup_dept_id() { + return this.group_dept_id; + } + public void setGroup_dept_id(Long group_dept_id) { + this.group_dept_id = group_dept_id; + this.isset_group_dept_id = true; + } + @JsonIgnore + public boolean isEmptyGroup_dept_id() { + return this.group_dept_id == null; + } + + + public Long getProvince_dept_id() { + return this.province_dept_id; + } + public void setProvince_dept_id(Long province_dept_id) { + this.province_dept_id = province_dept_id; + this.isset_province_dept_id = true; + } + @JsonIgnore + public boolean isEmptyProvince_dept_id() { + return this.province_dept_id == null; + } + + + public Long getCity_dept_id() { + return this.city_dept_id; + } + public void setCity_dept_id(Long city_dept_id) { + this.city_dept_id = city_dept_id; + this.isset_city_dept_id = true; + } + @JsonIgnore + public boolean isEmptyCity_dept_id() { + return this.city_dept_id == null; + } + + + public Long getCounty_dept_id() { + return this.county_dept_id; + } + public void setCounty_dept_id(Long county_dept_id) { + this.county_dept_id = county_dept_id; + this.isset_county_dept_id = true; + } + @JsonIgnore + public boolean isEmptyCounty_dept_id() { + return this.county_dept_id == null; + } + + + public String getGroup_dept_name() { + return this.group_dept_name; + } + public void setGroup_dept_name(String group_dept_name) { + this.group_dept_name = group_dept_name; + this.isset_group_dept_name = true; + } + @JsonIgnore + public boolean isEmptyGroup_dept_name() { + return this.group_dept_name == null || this.group_dept_name.length() == 0; + } + + + public String getProvince_dept_name() { + return this.province_dept_name; + } + public void setProvince_dept_name(String province_dept_name) { + this.province_dept_name = province_dept_name; + this.isset_province_dept_name = true; + } + @JsonIgnore + public boolean isEmptyProvince_dept_name() { + return this.province_dept_name == null || this.province_dept_name.length() == 0; + } + + + public String getCity_dept_name() { + return this.city_dept_name; + } + public void setCity_dept_name(String city_dept_name) { + this.city_dept_name = city_dept_name; + this.isset_city_dept_name = true; + } + @JsonIgnore + public boolean isEmptyCity_dept_name() { + return this.city_dept_name == null || this.city_dept_name.length() == 0; + } + + + public String getCounty_dept_name() { + return this.county_dept_name; + } + public void setCounty_dept_name(String county_dept_name) { + this.county_dept_name = county_dept_name; + this.isset_county_dept_name = true; + } + @JsonIgnore + public boolean isEmptyCounty_dept_name() { + return this.county_dept_name == null || this.county_dept_name.length() == 0; + } + + + public Long getBase_dept_id() { + return this.base_dept_id; + } + public void setBase_dept_id(Long base_dept_id) { + this.base_dept_id = base_dept_id; + this.isset_base_dept_id = true; + } + @JsonIgnore + public boolean isEmptyBase_dept_id() { + return this.base_dept_id == null; + } + + + public String getBase_dept_name() { + return this.base_dept_name; + } + public void setBase_dept_name(String base_dept_name) { + this.base_dept_name = base_dept_name; + this.isset_base_dept_name = true; + } + @JsonIgnore + public boolean isEmptyBase_dept_name() { + return this.base_dept_name == null || this.base_dept_name.length() == 0; + } + + + public Long getBase_user_id() { + return this.base_user_id; + } + public void setBase_user_id(Long base_user_id) { + this.base_user_id = base_user_id; + this.isset_base_user_id = true; + } + @JsonIgnore + public boolean isEmptyBase_user_id() { + return this.base_user_id == null; + } + + + public String getBase_user_name() { + return this.base_user_name; + } + public void setBase_user_name(String base_user_name) { + this.base_user_name = base_user_name; + this.isset_base_user_name = true; + } + @JsonIgnore + public boolean isEmptyBase_user_name() { + return this.base_user_name == null || this.base_user_name.length() == 0; + } + + + public String getBase_user_code() { + return this.base_user_code; + } + public void setBase_user_code(String base_user_code) { + this.base_user_code = base_user_code; + this.isset_base_user_code = true; + } + @JsonIgnore + public boolean isEmptyBase_user_code() { + return this.base_user_code == null || this.base_user_code.length() == 0; + } + + + public String getPsn_code() { + return this.psn_code; + } + public void setPsn_code(String psn_code) { + this.psn_code = psn_code; + this.isset_psn_code = true; + } + @JsonIgnore + public boolean isEmptyPsn_code() { + return this.psn_code == null || this.psn_code.length() == 0; + } + + + public String getPhone() { + return this.phone; + } + public void setPhone(String phone) { + this.phone = phone; + this.isset_phone = true; + } + @JsonIgnore + public boolean isEmptyPhone() { + return this.phone == null || this.phone.length() == 0; + } + + + public String getPhone_desen() { + return this.phone_desen; + } + public void setPhone_desen(String phone_desen) { + this.phone_desen = phone_desen; + this.isset_phone_desen = true; + } + @JsonIgnore + public boolean isEmptyPhone_desen() { + return this.phone_desen == null || this.phone_desen.length() == 0; + } + + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("oper_id=").append(this.oper_id) + .append("title=").append(this.title) + .append("business_type=").append(this.business_type) + .append("method=").append(this.method) + .append("request_method=").append(this.request_method) + .append("operate_user=").append(this.operate_user) + .append("oper_name=").append(this.oper_name) + .append("dept_name=").append(this.dept_name) + .append("oper_url=").append(this.oper_url) + .append("oper_ip=").append(this.oper_ip) + .append("oper_location=").append(this.oper_location) + .append("oper_param=").append(this.oper_param) + .append("json_result=").append(this.json_result) + .append("status=").append(this.status) + .append("error_msg=").append(this.error_msg) + .append("oper_time=").append(this.oper_time) + .append("group_dept_id=").append(this.group_dept_id) + .append("province_dept_id=").append(this.province_dept_id) + .append("city_dept_id=").append(this.city_dept_id) + .append("county_dept_id=").append(this.county_dept_id) + .append("group_dept_name=").append(this.group_dept_name) + .append("province_dept_name=").append(this.province_dept_name) + .append("city_dept_name=").append(this.city_dept_name) + .append("county_dept_name=").append(this.county_dept_name) + .append("base_dept_id=").append(this.base_dept_id) + .append("base_dept_name=").append(this.base_dept_name) + .append("base_user_id=").append(this.base_user_id) + .append("base_user_name=").append(this.base_user_name) + .append("base_user_code=").append(this.base_user_code) + .append("psn_code=").append(this.psn_code) + .append("phone=").append(this.phone) + .append("phone_desen=").append(this.phone_desen) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public S_oper_log $clone() { + S_oper_log s_oper_log = new S_oper_log(); + + // 鏁版嵁搴撳悕绉� + //s_oper_log.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_oper_id) { + s_oper_log.setOper_id(this.getOper_id()); + } + // 鏅�氬睘鎬� + if (this.isset_title) { + s_oper_log.setTitle(this.getTitle()); + } + if (this.isset_business_type) { + s_oper_log.setBusiness_type(this.getBusiness_type()); + } + if (this.isset_method) { + s_oper_log.setMethod(this.getMethod()); + } + if (this.isset_request_method) { + s_oper_log.setRequest_method(this.getRequest_method()); + } + if (this.isset_operate_user) { + s_oper_log.setOperate_user(this.getOperate_user()); + } + if (this.isset_oper_name) { + s_oper_log.setOper_name(this.getOper_name()); + } + if (this.isset_dept_name) { + s_oper_log.setDept_name(this.getDept_name()); + } + if (this.isset_oper_url) { + s_oper_log.setOper_url(this.getOper_url()); + } + if (this.isset_oper_ip) { + s_oper_log.setOper_ip(this.getOper_ip()); + } + if (this.isset_oper_location) { + s_oper_log.setOper_location(this.getOper_location()); + } + if (this.isset_oper_param) { + s_oper_log.setOper_param(this.getOper_param()); + } + if (this.isset_json_result) { + s_oper_log.setJson_result(this.getJson_result()); + } + if (this.isset_status) { + s_oper_log.setStatus(this.getStatus()); + } + if (this.isset_error_msg) { + s_oper_log.setError_msg(this.getError_msg()); + } + if (this.isset_oper_time) { + s_oper_log.setOper_time(this.getOper_time()); + } + if (this.isset_group_dept_id) { + s_oper_log.setGroup_dept_id(this.getGroup_dept_id()); + } + if (this.isset_province_dept_id) { + s_oper_log.setProvince_dept_id(this.getProvince_dept_id()); + } + if (this.isset_city_dept_id) { + s_oper_log.setCity_dept_id(this.getCity_dept_id()); + } + if (this.isset_county_dept_id) { + s_oper_log.setCounty_dept_id(this.getCounty_dept_id()); + } + if (this.isset_group_dept_name) { + s_oper_log.setGroup_dept_name(this.getGroup_dept_name()); + } + if (this.isset_province_dept_name) { + s_oper_log.setProvince_dept_name(this.getProvince_dept_name()); + } + if (this.isset_city_dept_name) { + s_oper_log.setCity_dept_name(this.getCity_dept_name()); + } + if (this.isset_county_dept_name) { + s_oper_log.setCounty_dept_name(this.getCounty_dept_name()); + } + if (this.isset_base_dept_id) { + s_oper_log.setBase_dept_id(this.getBase_dept_id()); + } + if (this.isset_base_dept_name) { + s_oper_log.setBase_dept_name(this.getBase_dept_name()); + } + if (this.isset_base_user_id) { + s_oper_log.setBase_user_id(this.getBase_user_id()); + } + if (this.isset_base_user_name) { + s_oper_log.setBase_user_name(this.getBase_user_name()); + } + if (this.isset_base_user_code) { + s_oper_log.setBase_user_code(this.getBase_user_code()); + } + if (this.isset_psn_code) { + s_oper_log.setPsn_code(this.getPsn_code()); + } + if (this.isset_phone) { + s_oper_log.setPhone(this.getPhone()); + } + if (this.isset_phone_desen) { + s_oper_log.setPhone_desen(this.getPhone_desen()); + } + return s_oper_log; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_oper_log_mapper.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_oper_log_mapper.java new file mode 100644 index 0000000..b0f6be8 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_oper_log_mapper.java @@ -0,0 +1,623 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:S_OPER_LOG * + * @author genrator + */ +public class S_oper_log_mapper extends S_oper_log implements BaseMapper<S_oper_log> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<S_oper_log> ROW_MAPPER = new S_oper_logRowMapper(); + + // 涓婚敭 + public static final String OPER_ID = "oper_id"; + // 鏅�氬睘鎬� + public static final String TITLE = "title"; + public static final String BUSINESS_TYPE = "business_type"; + public static final String METHOD = "method"; + public static final String REQUEST_METHOD = "request_method"; + public static final String OPERATE_USER = "operate_user"; + public static final String OPER_NAME = "oper_name"; + public static final String DEPT_NAME = "dept_name"; + public static final String OPER_URL = "oper_url"; + public static final String OPER_IP = "oper_ip"; + public static final String OPER_LOCATION = "oper_location"; + public static final String OPER_PARAM = "oper_param"; + public static final String JSON_RESULT = "json_result"; + public static final String STATUS = "status"; + public static final String ERROR_MSG = "error_msg"; + public static final String OPER_TIME = "oper_time"; + public static final String GROUP_DEPT_ID = "group_dept_id"; + public static final String PROVINCE_DEPT_ID = "province_dept_id"; + public static final String CITY_DEPT_ID = "city_dept_id"; + public static final String COUNTY_DEPT_ID = "county_dept_id"; + public static final String GROUP_DEPT_NAME = "group_dept_name"; + public static final String PROVINCE_DEPT_NAME = "province_dept_name"; + public static final String CITY_DEPT_NAME = "city_dept_name"; + public static final String COUNTY_DEPT_NAME = "county_dept_name"; + public static final String BASE_DEPT_ID = "base_dept_id"; + public static final String BASE_DEPT_NAME = "base_dept_name"; + public static final String BASE_USER_ID = "base_user_id"; + public static final String BASE_USER_NAME = "base_user_name"; + public static final String BASE_USER_CODE = "base_user_code"; + public static final String PSN_CODE = "psn_code"; + public static final String PHONE = "phone"; + public static final String PHONE_DESEN = "phone_desen"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_oper_log_mapper(S_oper_log s_oper_log) { + if (s_oper_log == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (s_oper_log.isset_oper_id) { + this.setOper_id(s_oper_log.getOper_id()); + } + //鏅�氬睘鎬� + if (s_oper_log.isset_title) { + this.setTitle(s_oper_log.getTitle()); + } + if (s_oper_log.isset_business_type) { + this.setBusiness_type(s_oper_log.getBusiness_type()); + } + if (s_oper_log.isset_method) { + this.setMethod(s_oper_log.getMethod()); + } + if (s_oper_log.isset_request_method) { + this.setRequest_method(s_oper_log.getRequest_method()); + } + if (s_oper_log.isset_operate_user) { + this.setOperate_user(s_oper_log.getOperate_user()); + } + if (s_oper_log.isset_oper_name) { + this.setOper_name(s_oper_log.getOper_name()); + } + if (s_oper_log.isset_dept_name) { + this.setDept_name(s_oper_log.getDept_name()); + } + if (s_oper_log.isset_oper_url) { + this.setOper_url(s_oper_log.getOper_url()); + } + if (s_oper_log.isset_oper_ip) { + this.setOper_ip(s_oper_log.getOper_ip()); + } + if (s_oper_log.isset_oper_location) { + this.setOper_location(s_oper_log.getOper_location()); + } + if (s_oper_log.isset_oper_param) { + this.setOper_param(s_oper_log.getOper_param()); + } + if (s_oper_log.isset_json_result) { + this.setJson_result(s_oper_log.getJson_result()); + } + if (s_oper_log.isset_status) { + this.setStatus(s_oper_log.getStatus()); + } + if (s_oper_log.isset_error_msg) { + this.setError_msg(s_oper_log.getError_msg()); + } + if (s_oper_log.isset_oper_time) { + this.setOper_time(s_oper_log.getOper_time()); + } + if (s_oper_log.isset_group_dept_id) { + this.setGroup_dept_id(s_oper_log.getGroup_dept_id()); + } + if (s_oper_log.isset_province_dept_id) { + this.setProvince_dept_id(s_oper_log.getProvince_dept_id()); + } + if (s_oper_log.isset_city_dept_id) { + this.setCity_dept_id(s_oper_log.getCity_dept_id()); + } + if (s_oper_log.isset_county_dept_id) { + this.setCounty_dept_id(s_oper_log.getCounty_dept_id()); + } + if (s_oper_log.isset_group_dept_name) { + this.setGroup_dept_name(s_oper_log.getGroup_dept_name()); + } + if (s_oper_log.isset_province_dept_name) { + this.setProvince_dept_name(s_oper_log.getProvince_dept_name()); + } + if (s_oper_log.isset_city_dept_name) { + this.setCity_dept_name(s_oper_log.getCity_dept_name()); + } + if (s_oper_log.isset_county_dept_name) { + this.setCounty_dept_name(s_oper_log.getCounty_dept_name()); + } + if (s_oper_log.isset_base_dept_id) { + this.setBase_dept_id(s_oper_log.getBase_dept_id()); + } + if (s_oper_log.isset_base_dept_name) { + this.setBase_dept_name(s_oper_log.getBase_dept_name()); + } + if (s_oper_log.isset_base_user_id) { + this.setBase_user_id(s_oper_log.getBase_user_id()); + } + if (s_oper_log.isset_base_user_name) { + this.setBase_user_name(s_oper_log.getBase_user_name()); + } + if (s_oper_log.isset_base_user_code) { + this.setBase_user_code(s_oper_log.getBase_user_code()); + } + if (s_oper_log.isset_psn_code) { + this.setPsn_code(s_oper_log.getPsn_code()); + } + if (s_oper_log.isset_phone) { + this.setPhone(s_oper_log.getPhone()); + } + if (s_oper_log.isset_phone_desen) { + this.setPhone_desen(s_oper_log.getPhone_desen()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(s_oper_log.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "s_oper_log"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return OPER_ID; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getOper_id(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(OPER_ID, this.getOper_id()); + ib.set(TITLE, this.getTitle(), this.isset_title); + ib.set(BUSINESS_TYPE, this.getBusiness_type(), this.isset_business_type); + ib.set(METHOD, this.getMethod(), this.isset_method); + ib.set(REQUEST_METHOD, this.getRequest_method(), this.isset_request_method); + ib.set(OPERATE_USER, this.getOperate_user(), this.isset_operate_user); + ib.set(OPER_NAME, this.getOper_name(), this.isset_oper_name); + ib.set(DEPT_NAME, this.getDept_name(), this.isset_dept_name); + ib.set(OPER_URL, this.getOper_url(), this.isset_oper_url); + ib.set(OPER_IP, this.getOper_ip(), this.isset_oper_ip); + ib.set(OPER_LOCATION, this.getOper_location(), this.isset_oper_location); + ib.set(OPER_PARAM, this.getOper_param(), this.isset_oper_param); + ib.set(JSON_RESULT, this.getJson_result(), this.isset_json_result); + ib.set(STATUS, this.getStatus(), this.isset_status); + ib.set(ERROR_MSG, this.getError_msg(), this.isset_error_msg); + ib.set(OPER_TIME, this.getOper_time(), this.isset_oper_time); + ib.set(GROUP_DEPT_ID, this.getGroup_dept_id(), this.isset_group_dept_id); + ib.set(PROVINCE_DEPT_ID, this.getProvince_dept_id(), this.isset_province_dept_id); + ib.set(CITY_DEPT_ID, this.getCity_dept_id(), this.isset_city_dept_id); + ib.set(COUNTY_DEPT_ID, this.getCounty_dept_id(), this.isset_county_dept_id); + ib.set(GROUP_DEPT_NAME, this.getGroup_dept_name(), this.isset_group_dept_name); + ib.set(PROVINCE_DEPT_NAME, this.getProvince_dept_name(), this.isset_province_dept_name); + ib.set(CITY_DEPT_NAME, this.getCity_dept_name(), this.isset_city_dept_name); + ib.set(COUNTY_DEPT_NAME, this.getCounty_dept_name(), this.isset_county_dept_name); + ib.set(BASE_DEPT_ID, this.getBase_dept_id(), this.isset_base_dept_id); + ib.set(BASE_DEPT_NAME, this.getBase_dept_name(), this.isset_base_dept_name); + ib.set(BASE_USER_ID, this.getBase_user_id(), this.isset_base_user_id); + ib.set(BASE_USER_NAME, this.getBase_user_name(), this.isset_base_user_name); + ib.set(BASE_USER_CODE, this.getBase_user_code(), this.isset_base_user_code); + ib.set(PSN_CODE, this.getPsn_code(), this.isset_psn_code); + ib.set(PHONE, this.getPhone(), this.isset_phone); + ib.set(PHONE_DESEN, this.getPhone_desen(), this.isset_phone_desen); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(TITLE, this.getTitle(), this.isset_title); + ub.set(BUSINESS_TYPE, this.getBusiness_type(), this.isset_business_type); + ub.set(METHOD, this.getMethod(), this.isset_method); + ub.set(REQUEST_METHOD, this.getRequest_method(), this.isset_request_method); + ub.set(OPERATE_USER, this.getOperate_user(), this.isset_operate_user); + ub.set(OPER_NAME, this.getOper_name(), this.isset_oper_name); + ub.set(DEPT_NAME, this.getDept_name(), this.isset_dept_name); + ub.set(OPER_URL, this.getOper_url(), this.isset_oper_url); + ub.set(OPER_IP, this.getOper_ip(), this.isset_oper_ip); + ub.set(OPER_LOCATION, this.getOper_location(), this.isset_oper_location); + ub.set(OPER_PARAM, this.getOper_param(), this.isset_oper_param); + ub.set(JSON_RESULT, this.getJson_result(), this.isset_json_result); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(ERROR_MSG, this.getError_msg(), this.isset_error_msg); + ub.set(OPER_TIME, this.getOper_time(), this.isset_oper_time); + ub.set(GROUP_DEPT_ID, this.getGroup_dept_id(), this.isset_group_dept_id); + ub.set(PROVINCE_DEPT_ID, this.getProvince_dept_id(), this.isset_province_dept_id); + ub.set(CITY_DEPT_ID, this.getCity_dept_id(), this.isset_city_dept_id); + ub.set(COUNTY_DEPT_ID, this.getCounty_dept_id(), this.isset_county_dept_id); + ub.set(GROUP_DEPT_NAME, this.getGroup_dept_name(), this.isset_group_dept_name); + ub.set(PROVINCE_DEPT_NAME, this.getProvince_dept_name(), this.isset_province_dept_name); + ub.set(CITY_DEPT_NAME, this.getCity_dept_name(), this.isset_city_dept_name); + ub.set(COUNTY_DEPT_NAME, this.getCounty_dept_name(), this.isset_county_dept_name); + ub.set(BASE_DEPT_ID, this.getBase_dept_id(), this.isset_base_dept_id); + ub.set(BASE_DEPT_NAME, this.getBase_dept_name(), this.isset_base_dept_name); + ub.set(BASE_USER_ID, this.getBase_user_id(), this.isset_base_user_id); + ub.set(BASE_USER_NAME, this.getBase_user_name(), this.isset_base_user_name); + ub.set(BASE_USER_CODE, this.getBase_user_code(), this.isset_base_user_code); + ub.set(PSN_CODE, this.getPsn_code(), this.isset_psn_code); + ub.set(PHONE, this.getPhone(), this.isset_phone); + ub.set(PHONE_DESEN, this.getPhone_desen(), this.isset_phone_desen); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(TITLE, this.getTitle(), this.isset_title); + ub.set(BUSINESS_TYPE, this.getBusiness_type(), this.isset_business_type); + ub.set(METHOD, this.getMethod(), this.isset_method); + ub.set(REQUEST_METHOD, this.getRequest_method(), this.isset_request_method); + ub.set(OPERATE_USER, this.getOperate_user(), this.isset_operate_user); + ub.set(OPER_NAME, this.getOper_name(), this.isset_oper_name); + ub.set(DEPT_NAME, this.getDept_name(), this.isset_dept_name); + ub.set(OPER_URL, this.getOper_url(), this.isset_oper_url); + ub.set(OPER_IP, this.getOper_ip(), this.isset_oper_ip); + ub.set(OPER_LOCATION, this.getOper_location(), this.isset_oper_location); + ub.set(OPER_PARAM, this.getOper_param(), this.isset_oper_param); + ub.set(JSON_RESULT, this.getJson_result(), this.isset_json_result); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(ERROR_MSG, this.getError_msg(), this.isset_error_msg); + ub.set(OPER_TIME, this.getOper_time(), this.isset_oper_time); + ub.set(GROUP_DEPT_ID, this.getGroup_dept_id(), this.isset_group_dept_id); + ub.set(PROVINCE_DEPT_ID, this.getProvince_dept_id(), this.isset_province_dept_id); + ub.set(CITY_DEPT_ID, this.getCity_dept_id(), this.isset_city_dept_id); + ub.set(COUNTY_DEPT_ID, this.getCounty_dept_id(), this.isset_county_dept_id); + ub.set(GROUP_DEPT_NAME, this.getGroup_dept_name(), this.isset_group_dept_name); + ub.set(PROVINCE_DEPT_NAME, this.getProvince_dept_name(), this.isset_province_dept_name); + ub.set(CITY_DEPT_NAME, this.getCity_dept_name(), this.isset_city_dept_name); + ub.set(COUNTY_DEPT_NAME, this.getCounty_dept_name(), this.isset_county_dept_name); + ub.set(BASE_DEPT_ID, this.getBase_dept_id(), this.isset_base_dept_id); + ub.set(BASE_DEPT_NAME, this.getBase_dept_name(), this.isset_base_dept_name); + ub.set(BASE_USER_ID, this.getBase_user_id(), this.isset_base_user_id); + ub.set(BASE_USER_NAME, this.getBase_user_name(), this.isset_base_user_name); + ub.set(BASE_USER_CODE, this.getBase_user_code(), this.isset_base_user_code); + ub.set(PSN_CODE, this.getPsn_code(), this.isset_psn_code); + ub.set(PHONE, this.getPhone(), this.isset_phone); + ub.set(PHONE_DESEN, this.getPhone_desen(), this.isset_phone_desen); + + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(TITLE, this.getTitle(), this.isset_title); + ub.set(BUSINESS_TYPE, this.getBusiness_type(), this.isset_business_type); + ub.set(METHOD, this.getMethod(), this.isset_method); + ub.set(REQUEST_METHOD, this.getRequest_method(), this.isset_request_method); + ub.set(OPERATE_USER, this.getOperate_user(), this.isset_operate_user); + ub.set(OPER_NAME, this.getOper_name(), this.isset_oper_name); + ub.set(DEPT_NAME, this.getDept_name(), this.isset_dept_name); + ub.set(OPER_URL, this.getOper_url(), this.isset_oper_url); + ub.set(OPER_IP, this.getOper_ip(), this.isset_oper_ip); + ub.set(OPER_LOCATION, this.getOper_location(), this.isset_oper_location); + ub.set(OPER_PARAM, this.getOper_param(), this.isset_oper_param); + ub.set(JSON_RESULT, this.getJson_result(), this.isset_json_result); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(ERROR_MSG, this.getError_msg(), this.isset_error_msg); + ub.set(OPER_TIME, this.getOper_time(), this.isset_oper_time); + ub.set(GROUP_DEPT_ID, this.getGroup_dept_id(), this.isset_group_dept_id); + ub.set(PROVINCE_DEPT_ID, this.getProvince_dept_id(), this.isset_province_dept_id); + ub.set(CITY_DEPT_ID, this.getCity_dept_id(), this.isset_city_dept_id); + ub.set(COUNTY_DEPT_ID, this.getCounty_dept_id(), this.isset_county_dept_id); + ub.set(GROUP_DEPT_NAME, this.getGroup_dept_name(), this.isset_group_dept_name); + ub.set(PROVINCE_DEPT_NAME, this.getProvince_dept_name(), this.isset_province_dept_name); + ub.set(CITY_DEPT_NAME, this.getCity_dept_name(), this.isset_city_dept_name); + ub.set(COUNTY_DEPT_NAME, this.getCounty_dept_name(), this.isset_county_dept_name); + ub.set(BASE_DEPT_ID, this.getBase_dept_id(), this.isset_base_dept_id); + ub.set(BASE_DEPT_NAME, this.getBase_dept_name(), this.isset_base_dept_name); + ub.set(BASE_USER_ID, this.getBase_user_id(), this.isset_base_user_id); + ub.set(BASE_USER_NAME, this.getBase_user_name(), this.isset_base_user_name); + ub.set(BASE_USER_CODE, this.getBase_user_code(), this.isset_base_user_code); + ub.set(PSN_CODE, this.getPsn_code(), this.isset_psn_code); + ub.set(PHONE, this.getPhone(), this.isset_phone); + ub.set(PHONE_DESEN, this.getPhone_desen(), this.isset_phone_desen); + + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select oper_id, title, business_type, method, request_method, operate_user, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time, group_dept_id, province_dept_id, city_dept_id, county_dept_id, group_dept_name, province_dept_name, city_dept_name, county_dept_name, base_dept_id, base_dept_name, base_user_id, base_user_name, base_user_code, psn_code, phone, phone_desen from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select oper_id, title, business_type, method, request_method, operate_user, oper_name, dept_name, oper_url, oper_ip, oper_location, oper_param, json_result, status, error_msg, oper_time, group_dept_id, province_dept_id, city_dept_id, county_dept_id, group_dept_name, province_dept_name, city_dept_name, county_dept_name, base_dept_id, base_dept_name, base_user_id, base_user_name, base_user_code, psn_code, phone, phone_desen from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public S_oper_log mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public S_oper_log toS_oper_log() { + return super.$clone(); + } +} + +/** + * s_oper_log RowMapper + * + * @author genrator + */ +class S_oper_logRowMapper implements RowMapper<S_oper_log> { + + @Override + public S_oper_log mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + S_oper_log s_oper_log = new S_oper_log(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.OPER_ID); + if (columnIndex > 0) { + s_oper_log.setOper_id(rs.getLong(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.TITLE); + if (columnIndex > 0) { + s_oper_log.setTitle(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.BUSINESS_TYPE); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_oper_log.setBusiness_type(null); + } else { + s_oper_log.setBusiness_type(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.METHOD); + if (columnIndex > 0) { + s_oper_log.setMethod(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.REQUEST_METHOD); + if (columnIndex > 0) { + s_oper_log.setRequest_method(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.OPERATE_USER); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_oper_log.setOperate_user(null); + } else { + s_oper_log.setOperate_user(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.OPER_NAME); + if (columnIndex > 0) { + s_oper_log.setOper_name(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.DEPT_NAME); + if (columnIndex > 0) { + s_oper_log.setDept_name(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.OPER_URL); + if (columnIndex > 0) { + s_oper_log.setOper_url(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.OPER_IP); + if (columnIndex > 0) { + s_oper_log.setOper_ip(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.OPER_LOCATION); + if (columnIndex > 0) { + s_oper_log.setOper_location(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.OPER_PARAM); + if (columnIndex > 0) { + s_oper_log.setOper_param(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.JSON_RESULT); + if (columnIndex > 0) { + s_oper_log.setJson_result(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.STATUS); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_oper_log.setStatus(null); + } else { + s_oper_log.setStatus(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.ERROR_MSG); + if (columnIndex > 0) { + s_oper_log.setError_msg(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.OPER_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_oper_log.setOper_time(null); + } else { + s_oper_log.setOper_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.GROUP_DEPT_ID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_oper_log.setGroup_dept_id(null); + } else { + s_oper_log.setGroup_dept_id(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.PROVINCE_DEPT_ID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_oper_log.setProvince_dept_id(null); + } else { + s_oper_log.setProvince_dept_id(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.CITY_DEPT_ID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_oper_log.setCity_dept_id(null); + } else { + s_oper_log.setCity_dept_id(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.COUNTY_DEPT_ID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_oper_log.setCounty_dept_id(null); + } else { + s_oper_log.setCounty_dept_id(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.GROUP_DEPT_NAME); + if (columnIndex > 0) { + s_oper_log.setGroup_dept_name(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.PROVINCE_DEPT_NAME); + if (columnIndex > 0) { + s_oper_log.setProvince_dept_name(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.CITY_DEPT_NAME); + if (columnIndex > 0) { + s_oper_log.setCity_dept_name(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.COUNTY_DEPT_NAME); + if (columnIndex > 0) { + s_oper_log.setCounty_dept_name(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.BASE_DEPT_ID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_oper_log.setBase_dept_id(null); + } else { + s_oper_log.setBase_dept_id(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.BASE_DEPT_NAME); + if (columnIndex > 0) { + s_oper_log.setBase_dept_name(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.BASE_USER_ID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_oper_log.setBase_user_id(null); + } else { + s_oper_log.setBase_user_id(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.BASE_USER_NAME); + if (columnIndex > 0) { + s_oper_log.setBase_user_name(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.BASE_USER_CODE); + if (columnIndex > 0) { + s_oper_log.setBase_user_code(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.PSN_CODE); + if (columnIndex > 0) { + s_oper_log.setPsn_code(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.PHONE); + if (columnIndex > 0) { + s_oper_log.setPhone(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_oper_log_mapper.PHONE_DESEN); + if (columnIndex > 0) { + s_oper_log.setPhone_desen(rs.getString(columnIndex)); + } + return s_oper_log; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_role.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_role.java new file mode 100644 index 0000000..bc27697 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_role.java @@ -0,0 +1,336 @@ + + +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:S_ROLE * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class S_role extends BasePo<S_role> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + // 涓婚敭 + private Long role_id = null; + @JsonIgnore + protected boolean isset_role_id = false; + + // 灞炴�у垪琛� + private String role_name = null; + @JsonIgnore + protected boolean isset_role_name = false; + + private String role_key = null; + @JsonIgnore + protected boolean isset_role_key = false; + + private Integer role_sort = null; + @JsonIgnore + protected boolean isset_role_sort = false; + + private Integer data_scope = null; + @JsonIgnore + protected boolean isset_data_scope = false; + + private Integer menu_check_strictly = null; + @JsonIgnore + protected boolean isset_menu_check_strictly = false; + + private Integer dept_check_strictly = null; + @JsonIgnore + protected boolean isset_dept_check_strictly = false; + + private Integer status = null; + @JsonIgnore + protected boolean isset_status = false; + + private Integer del_flag = null; + @JsonIgnore + protected boolean isset_del_flag = false; + + private String remark = null; + @JsonIgnore + protected boolean isset_remark = false; + + private Long org_id = null; + @JsonIgnore + protected boolean isset_org_id = false; + + private Integer type = null; + @JsonIgnore + protected boolean isset_type = false; + + private String base_id = null; + @JsonIgnore + protected boolean isset_base_id = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_role() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public S_role(Long role_id) { + this.setRole_id(role_id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setRole_id((Long) value); + } + + public Long getRole_id() { + return this.role_id; + } + public void setRole_id(Long role_id) { + this.role_id = role_id; + this.isset_role_id = true; + } + @JsonIgnore + public boolean isEmptyRole_id() { + return this.role_id == null; + } + + + public String getRole_name() { + return this.role_name; + } + public void setRole_name(String role_name) { + this.role_name = role_name; + this.isset_role_name = true; + } + @JsonIgnore + public boolean isEmptyRole_name() { + return this.role_name == null || this.role_name.length() == 0; + } + + + public String getRole_key() { + return this.role_key; + } + public void setRole_key(String role_key) { + this.role_key = role_key; + this.isset_role_key = true; + } + @JsonIgnore + public boolean isEmptyRole_key() { + return this.role_key == null || this.role_key.length() == 0; + } + + + public Integer getRole_sort() { + return this.role_sort; + } + public void setRole_sort(Integer role_sort) { + this.role_sort = role_sort; + this.isset_role_sort = true; + } + @JsonIgnore + public boolean isEmptyRole_sort() { + return this.role_sort == null; + } + + + public Integer getData_scope() { + return this.data_scope; + } + public void setData_scope(Integer data_scope) { + this.data_scope = data_scope; + this.isset_data_scope = true; + } + @JsonIgnore + public boolean isEmptyData_scope() { + return this.data_scope == null; + } + + + public Integer getMenu_check_strictly() { + return this.menu_check_strictly; + } + public void setMenu_check_strictly(Integer menu_check_strictly) { + this.menu_check_strictly = menu_check_strictly; + this.isset_menu_check_strictly = true; + } + @JsonIgnore + public boolean isEmptyMenu_check_strictly() { + return this.menu_check_strictly == null; + } + + + public Integer getDept_check_strictly() { + return this.dept_check_strictly; + } + public void setDept_check_strictly(Integer dept_check_strictly) { + this.dept_check_strictly = dept_check_strictly; + this.isset_dept_check_strictly = true; + } + @JsonIgnore + public boolean isEmptyDept_check_strictly() { + return this.dept_check_strictly == null; + } + + + public Integer getStatus() { + return this.status; + } + public void setStatus(Integer status) { + this.status = status; + this.isset_status = true; + } + @JsonIgnore + public boolean isEmptyStatus() { + return this.status == null; + } + + + public Integer getDel_flag() { + return this.del_flag; + } + public void setDel_flag(Integer del_flag) { + this.del_flag = del_flag; + this.isset_del_flag = true; + } + @JsonIgnore + public boolean isEmptyDel_flag() { + return this.del_flag == null; + } + + + public String getRemark() { + return this.remark; + } + public void setRemark(String remark) { + this.remark = remark; + this.isset_remark = true; + } + @JsonIgnore + public boolean isEmptyRemark() { + return this.remark == null || this.remark.length() == 0; + } + + + public Long getOrg_id() { + return this.org_id; + } + public void setOrg_id(Long org_id) { + this.org_id = org_id; + this.isset_org_id = true; + } + @JsonIgnore + public boolean isEmptyOrg_id() { + return this.org_id == null; + } + + + public Integer getType() { + return this.type; + } + public void setType(Integer type) { + this.type = type; + this.isset_type = true; + } + @JsonIgnore + public boolean isEmptyType() { + return this.type == null; + } + + + public String getBase_id() { + return this.base_id; + } + public void setBase_id(String base_id) { + this.base_id = base_id; + this.isset_base_id = true; + } + @JsonIgnore + public boolean isEmptyBase_id() { + return this.base_id == null || this.base_id.length() == 0; + } + + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("role_id=").append(this.role_id) + .append("role_name=").append(this.role_name) + .append("role_key=").append(this.role_key) + .append("role_sort=").append(this.role_sort) + .append("data_scope=").append(this.data_scope) + .append("menu_check_strictly=").append(this.menu_check_strictly) + .append("dept_check_strictly=").append(this.dept_check_strictly) + .append("status=").append(this.status) + .append("del_flag=").append(this.del_flag) + .append("remark=").append(this.remark) + .append("org_id=").append(this.org_id) + .append("type=").append(this.type) + .append("base_id=").append(this.base_id) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public S_role $clone() { + S_role s_role = new S_role(); + + // 鏁版嵁搴撳悕绉� + //s_role.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_role_id) { + s_role.setRole_id(this.getRole_id()); + } + // 鏅�氬睘鎬� + if (this.isset_role_name) { + s_role.setRole_name(this.getRole_name()); + } + if (this.isset_role_key) { + s_role.setRole_key(this.getRole_key()); + } + if (this.isset_role_sort) { + s_role.setRole_sort(this.getRole_sort()); + } + if (this.isset_data_scope) { + s_role.setData_scope(this.getData_scope()); + } + if (this.isset_menu_check_strictly) { + s_role.setMenu_check_strictly(this.getMenu_check_strictly()); + } + if (this.isset_dept_check_strictly) { + s_role.setDept_check_strictly(this.getDept_check_strictly()); + } + if (this.isset_status) { + s_role.setStatus(this.getStatus()); + } + if (this.isset_del_flag) { + s_role.setDel_flag(this.getDel_flag()); + } + if (this.isset_remark) { + s_role.setRemark(this.getRemark()); + } + if (this.isset_org_id) { + s_role.setOrg_id(this.getOrg_id()); + } + if (this.isset_type) { + s_role.setType(this.getType()); + } + if (this.isset_base_id) { + s_role.setBase_id(this.getBase_id()); + } + return s_role; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_role_mapper.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_role_mapper.java new file mode 100644 index 0000000..7768446 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_role_mapper.java @@ -0,0 +1,387 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:S_ROLE * + * @author genrator + */ +public class S_role_mapper extends S_role implements BaseMapper<S_role> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<S_role> ROW_MAPPER = new S_roleRowMapper(); + + // 涓婚敭 + public static final String ROLE_ID = "role_id"; + // 鏅�氬睘鎬� + public static final String ROLE_NAME = "role_name"; + public static final String ROLE_KEY = "role_key"; + public static final String ROLE_SORT = "role_sort"; + public static final String DATA_SCOPE = "data_scope"; + public static final String MENU_CHECK_STRICTLY = "menu_check_strictly"; + public static final String DEPT_CHECK_STRICTLY = "dept_check_strictly"; + public static final String STATUS = "status"; + public static final String DEL_FLAG = "del_flag"; + public static final String REMARK = "remark"; + public static final String ORG_ID = "org_id"; + public static final String TYPE = "type"; + public static final String BASE_ID = "base_id"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_role_mapper(S_role s_role) { + if (s_role == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (s_role.isset_role_id) { + this.setRole_id(s_role.getRole_id()); + } + //鏅�氬睘鎬� + if (s_role.isset_role_name) { + this.setRole_name(s_role.getRole_name()); + } + if (s_role.isset_role_key) { + this.setRole_key(s_role.getRole_key()); + } + if (s_role.isset_role_sort) { + this.setRole_sort(s_role.getRole_sort()); + } + if (s_role.isset_data_scope) { + this.setData_scope(s_role.getData_scope()); + } + if (s_role.isset_menu_check_strictly) { + this.setMenu_check_strictly(s_role.getMenu_check_strictly()); + } + if (s_role.isset_dept_check_strictly) { + this.setDept_check_strictly(s_role.getDept_check_strictly()); + } + if (s_role.isset_status) { + this.setStatus(s_role.getStatus()); + } + if (s_role.isset_del_flag) { + this.setDel_flag(s_role.getDel_flag()); + } + if (s_role.isset_remark) { + this.setRemark(s_role.getRemark()); + } + if (s_role.isset_org_id) { + this.setOrg_id(s_role.getOrg_id()); + } + if (s_role.isset_type) { + this.setType(s_role.getType()); + } + if (s_role.isset_base_id) { + this.setBase_id(s_role.getBase_id()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(s_role.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "s_role"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return ROLE_ID; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getRole_id(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(ROLE_ID, this.getRole_id()); + ib.set(ROLE_NAME, this.getRole_name(), this.isset_role_name); + ib.set(ROLE_KEY, this.getRole_key(), this.isset_role_key); + ib.set(ROLE_SORT, this.getRole_sort(), this.isset_role_sort); + ib.set(DATA_SCOPE, this.getData_scope(), this.isset_data_scope); + ib.set(MENU_CHECK_STRICTLY, this.getMenu_check_strictly(), this.isset_menu_check_strictly); + ib.set(DEPT_CHECK_STRICTLY, this.getDept_check_strictly(), this.isset_dept_check_strictly); + ib.set(STATUS, this.getStatus(), this.isset_status); + ib.set(DEL_FLAG, this.getDel_flag(), this.isset_del_flag); + ib.set(REMARK, this.getRemark(), this.isset_remark); + ib.set(ORG_ID, this.getOrg_id(), this.isset_org_id); + ib.set(TYPE, this.getType(), this.isset_type); + ib.set(BASE_ID, this.getBase_id(), this.isset_base_id); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(ROLE_NAME, this.getRole_name(), this.isset_role_name); + ub.set(ROLE_KEY, this.getRole_key(), this.isset_role_key); + ub.set(ROLE_SORT, this.getRole_sort(), this.isset_role_sort); + ub.set(DATA_SCOPE, this.getData_scope(), this.isset_data_scope); + ub.set(MENU_CHECK_STRICTLY, this.getMenu_check_strictly(), this.isset_menu_check_strictly); + ub.set(DEPT_CHECK_STRICTLY, this.getDept_check_strictly(), this.isset_dept_check_strictly); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(DEL_FLAG, this.getDel_flag(), this.isset_del_flag); + ub.set(REMARK, this.getRemark(), this.isset_remark); + ub.set(ORG_ID, this.getOrg_id(), this.isset_org_id); + ub.set(TYPE, this.getType(), this.isset_type); + ub.set(BASE_ID, this.getBase_id(), this.isset_base_id); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(ROLE_NAME, this.getRole_name(), this.isset_role_name); + ub.set(ROLE_KEY, this.getRole_key(), this.isset_role_key); + ub.set(ROLE_SORT, this.getRole_sort(), this.isset_role_sort); + ub.set(DATA_SCOPE, this.getData_scope(), this.isset_data_scope); + ub.set(MENU_CHECK_STRICTLY, this.getMenu_check_strictly(), this.isset_menu_check_strictly); + ub.set(DEPT_CHECK_STRICTLY, this.getDept_check_strictly(), this.isset_dept_check_strictly); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(DEL_FLAG, this.getDel_flag(), this.isset_del_flag); + ub.set(REMARK, this.getRemark(), this.isset_remark); + ub.set(ORG_ID, this.getOrg_id(), this.isset_org_id); + ub.set(TYPE, this.getType(), this.isset_type); + ub.set(BASE_ID, this.getBase_id(), this.isset_base_id); + + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(ROLE_NAME, this.getRole_name(), this.isset_role_name); + ub.set(ROLE_KEY, this.getRole_key(), this.isset_role_key); + ub.set(ROLE_SORT, this.getRole_sort(), this.isset_role_sort); + ub.set(DATA_SCOPE, this.getData_scope(), this.isset_data_scope); + ub.set(MENU_CHECK_STRICTLY, this.getMenu_check_strictly(), this.isset_menu_check_strictly); + ub.set(DEPT_CHECK_STRICTLY, this.getDept_check_strictly(), this.isset_dept_check_strictly); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(DEL_FLAG, this.getDel_flag(), this.isset_del_flag); + ub.set(REMARK, this.getRemark(), this.isset_remark); + ub.set(ORG_ID, this.getOrg_id(), this.isset_org_id); + ub.set(TYPE, this.getType(), this.isset_type); + ub.set(BASE_ID, this.getBase_id(), this.isset_base_id); + + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select role_id, role_name, role_key, role_sort, data_scope, menu_check_strictly, dept_check_strictly, status, del_flag, remark, org_id, type, base_id from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select role_id, role_name, role_key, role_sort, data_scope, menu_check_strictly, dept_check_strictly, status, del_flag, remark, org_id, type, base_id from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public S_role mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public S_role toS_role() { + return super.$clone(); + } +} + +/** + * s_role RowMapper + * + * @author genrator + */ +class S_roleRowMapper implements RowMapper<S_role> { + + @Override + public S_role mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + S_role s_role = new S_role(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, S_role_mapper.ROLE_ID); + if (columnIndex > 0) { + s_role.setRole_id(rs.getLong(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, S_role_mapper.ROLE_NAME); + if (columnIndex > 0) { + s_role.setRole_name(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_role_mapper.ROLE_KEY); + if (columnIndex > 0) { + s_role.setRole_key(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_role_mapper.ROLE_SORT); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_role.setRole_sort(null); + } else { + s_role.setRole_sort(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_role_mapper.DATA_SCOPE); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_role.setData_scope(null); + } else { + s_role.setData_scope(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_role_mapper.MENU_CHECK_STRICTLY); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_role.setMenu_check_strictly(null); + } else { + s_role.setMenu_check_strictly(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_role_mapper.DEPT_CHECK_STRICTLY); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_role.setDept_check_strictly(null); + } else { + s_role.setDept_check_strictly(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_role_mapper.STATUS); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_role.setStatus(null); + } else { + s_role.setStatus(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_role_mapper.DEL_FLAG); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_role.setDel_flag(null); + } else { + s_role.setDel_flag(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_role_mapper.REMARK); + if (columnIndex > 0) { + s_role.setRemark(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_role_mapper.ORG_ID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_role.setOrg_id(null); + } else { + s_role.setOrg_id(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_role_mapper.TYPE); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_role.setType(null); + } else { + s_role.setType(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_role_mapper.BASE_ID); + if (columnIndex > 0) { + s_role.setBase_id(rs.getString(columnIndex)); + } + return s_role; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_user_core.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_user_core.java new file mode 100644 index 0000000..b2b59f9 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_user_core.java @@ -0,0 +1,948 @@ + + +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:S_USER_CORE * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class S_user_core extends BasePo<S_user_core> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + /** + * 鐢ㄤ簬鍏煎鑰佸啓娉� + */ + @JsonIgnore + public static final S_user_core ROW_MAPPER = new S_user_core(); + + // 涓婚敭 + private Long id = null; + @JsonIgnore + protected boolean isset_id = false; + + // 灞炴�у垪琛� + private Long dept_id = null; + @JsonIgnore + protected boolean isset_dept_id = false; + + private Long org_id = null; + @JsonIgnore + protected boolean isset_org_id = false; + + private String user_name = null; + @JsonIgnore + protected boolean isset_user_name = false; + + private String nick_name = null; + @JsonIgnore + protected boolean isset_nick_name = false; + + private Integer user_type = null; + @JsonIgnore + protected boolean isset_user_type = false; + + private String email = null; + @JsonIgnore + protected boolean isset_email = false; + + private String phonenumber = null; + @JsonIgnore + protected boolean isset_phonenumber = false; + + private String sex = null; + @JsonIgnore + protected boolean isset_sex = false; + + private String avatar = null; + @JsonIgnore + protected boolean isset_avatar = false; + + private String password = null; + @JsonIgnore + protected boolean isset_password = false; + + private Integer status = null; + @JsonIgnore + protected boolean isset_status = false; + + private Integer del_flag = null; + @JsonIgnore + protected boolean isset_del_flag = false; + + private String login_ip = null; + @JsonIgnore + protected boolean isset_login_ip = false; + + private Long login_date = null; + @JsonIgnore + protected boolean isset_login_date = false; + + private String create_by = null; + @JsonIgnore + protected boolean isset_create_by = false; + + private Long create_time = null; + @JsonIgnore + protected boolean isset_create_time = false; + + private String update_by = null; + @JsonIgnore + protected boolean isset_update_by = false; + + private Long update_time = null; + @JsonIgnore + protected boolean isset_update_time = false; + + private String remark = null; + @JsonIgnore + protected boolean isset_remark = false; + + private String wx_open_id = null; + @JsonIgnore + protected boolean isset_wx_open_id = false; + + private String wx_union_id = null; + @JsonIgnore + protected boolean isset_wx_union_id = false; + + private String ding_user_id = null; + @JsonIgnore + protected boolean isset_ding_user_id = false; + + private String bind_client_id = null; + @JsonIgnore + protected boolean isset_bind_client_id = false; + + private Integer bind_wechat = null; + @JsonIgnore + protected boolean isset_bind_wechat = false; + + private Integer modify_pwd = null; + @JsonIgnore + protected boolean isset_modify_pwd = false; + + private Integer bind_mobile = null; + @JsonIgnore + protected boolean isset_bind_mobile = false; + + private Integer bind_mail = null; + @JsonIgnore + protected boolean isset_bind_mail = false; + + private Long profile_id = null; + @JsonIgnore + protected boolean isset_profile_id = false; + + private Integer is_wechat_public = null; + @JsonIgnore + protected boolean isset_is_wechat_public = false; + + private Integer is_wechat_routine = null; + @JsonIgnore + protected boolean isset_is_wechat_routine = false; + + private Integer is_wechat_ios = null; + @JsonIgnore + protected boolean isset_is_wechat_ios = false; + + private Integer is_wechat_android = null; + @JsonIgnore + protected boolean isset_is_wechat_android = false; + + private Integer is_binding_ios = null; + @JsonIgnore + protected boolean isset_is_binding_ios = false; + + private String register_type = null; + @JsonIgnore + protected boolean isset_register_type = false; + + private Integer is_logoff = null; + @JsonIgnore + protected boolean isset_is_logoff = false; + + private Long logoff_time = null; + @JsonIgnore + protected boolean isset_logoff_time = false; + + private Integer is_sms = null; + @JsonIgnore + protected boolean isset_is_sms = false; + + private Integer type = null; + @JsonIgnore + protected boolean isset_type = false; + + private Long mer_id = null; + @JsonIgnore + protected boolean isset_mer_id = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_user_core() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public S_user_core(Long id) { + this.setId(id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setId((Long) value); + } + + public Long getId() { + return this.id; + } + public void setId(Long id) { + this.id = id; + this.isset_id = true; + } + @JsonIgnore + public boolean isEmptyId() { + return this.id == null; + } + + + public Long getDept_id() { + return this.dept_id; + } + public void setDept_id(Long dept_id) { + this.dept_id = dept_id; + this.isset_dept_id = true; + // dept_id, bigint + } + @JsonIgnore + public boolean isEmptyDept_id() { + return this.dept_id == null; + } + + + public Long getOrg_id() { + return this.org_id; + } + public void setOrg_id(Long org_id) { + this.org_id = org_id; + this.isset_org_id = true; + // org_id, bigint + } + @JsonIgnore + public boolean isEmptyOrg_id() { + return this.org_id == null; + } + + + public String getUser_name() { + return this.user_name; + } + public void setUser_name(String user_name) { + this.user_name = user_name; + this.isset_user_name = true; + // user_name, varchar + } + @JsonIgnore + public boolean isEmptyUser_name() { + return this.user_name == null || this.user_name.length() == 0; + } + + + public String getNick_name() { + return this.nick_name; + } + public void setNick_name(String nick_name) { + this.nick_name = nick_name; + this.isset_nick_name = true; + // nick_name, varchar + } + @JsonIgnore + public boolean isEmptyNick_name() { + return this.nick_name == null || this.nick_name.length() == 0; + } + + + public Integer getUser_type() { + return this.user_type; + } + public void setUser_type(Integer user_type) { + this.user_type = user_type; + this.isset_user_type = true; + // user_type, int + } + @JsonIgnore + public boolean isEmptyUser_type() { + return this.user_type == null; + } + + + public String getEmail() { + return this.email; + } + public void setEmail(String email) { + this.email = email; + this.isset_email = true; + // email, varchar + } + @JsonIgnore + public boolean isEmptyEmail() { + return this.email == null || this.email.length() == 0; + } + + + public String getPhonenumber() { + return this.phonenumber; + } + public void setPhonenumber(String phonenumber) { + this.phonenumber = phonenumber; + this.isset_phonenumber = true; + // phonenumber, varchar + } + @JsonIgnore + public boolean isEmptyPhonenumber() { + return this.phonenumber == null || this.phonenumber.length() == 0; + } + + + public String getSex() { + return this.sex; + } + public void setSex(String sex) { + this.sex = sex; + this.isset_sex = true; + // sex, varchar + } + @JsonIgnore + public boolean isEmptySex() { + return this.sex == null || this.sex.length() == 0; + } + + + public String getAvatar() { + return this.avatar; + } + public void setAvatar(String avatar) { + this.avatar = avatar; + this.isset_avatar = true; + // avatar, varchar + } + @JsonIgnore + public boolean isEmptyAvatar() { + return this.avatar == null || this.avatar.length() == 0; + } + + + public String getPassword() { + return this.password; + } + public void setPassword(String password) { + this.password = password; + this.isset_password = true; + // password, varchar + } + @JsonIgnore + public boolean isEmptyPassword() { + return this.password == null || this.password.length() == 0; + } + + + public Integer getStatus() { + return this.status; + } + public void setStatus(Integer status) { + this.status = status; + this.isset_status = true; + // status, int + } + @JsonIgnore + public boolean isEmptyStatus() { + return this.status == null; + } + + + public Integer getDel_flag() { + return this.del_flag; + } + public void setDel_flag(Integer del_flag) { + this.del_flag = del_flag; + this.isset_del_flag = true; + // del_flag, int + } + @JsonIgnore + public boolean isEmptyDel_flag() { + return this.del_flag == null; + } + + + public String getLogin_ip() { + return this.login_ip; + } + public void setLogin_ip(String login_ip) { + this.login_ip = login_ip; + this.isset_login_ip = true; + // login_ip, varchar + } + @JsonIgnore + public boolean isEmptyLogin_ip() { + return this.login_ip == null || this.login_ip.length() == 0; + } + + + public Long getLogin_date() { + return this.login_date; + } + public void setLogin_date(Long login_date) { + this.login_date = login_date; + this.isset_login_date = true; + // login_date, bigint + } + @JsonIgnore + public boolean isEmptyLogin_date() { + return this.login_date == null; + } + + + public String getCreate_by() { + return this.create_by; + } + public void setCreate_by(String create_by) { + this.create_by = create_by; + this.isset_create_by = true; + // create_by, varchar + } + @JsonIgnore + public boolean isEmptyCreate_by() { + return this.create_by == null || this.create_by.length() == 0; + } + + + public Long getCreate_time() { + return this.create_time; + } + public void setCreate_time(Long create_time) { + this.create_time = create_time; + this.isset_create_time = true; + // create_time, bigint + } + @JsonIgnore + public boolean isEmptyCreate_time() { + return this.create_time == null; + } + + + public String getUpdate_by() { + return this.update_by; + } + public void setUpdate_by(String update_by) { + this.update_by = update_by; + this.isset_update_by = true; + // update_by, varchar + } + @JsonIgnore + public boolean isEmptyUpdate_by() { + return this.update_by == null || this.update_by.length() == 0; + } + + + public Long getUpdate_time() { + return this.update_time; + } + public void setUpdate_time(Long update_time) { + this.update_time = update_time; + this.isset_update_time = true; + // update_time, bigint + } + @JsonIgnore + public boolean isEmptyUpdate_time() { + return this.update_time == null; + } + + + public String getRemark() { + return this.remark; + } + public void setRemark(String remark) { + this.remark = remark; + this.isset_remark = true; + // remark, varchar + } + @JsonIgnore + public boolean isEmptyRemark() { + return this.remark == null || this.remark.length() == 0; + } + + + public String getWx_open_id() { + return this.wx_open_id; + } + public void setWx_open_id(String wx_open_id) { + this.wx_open_id = wx_open_id; + this.isset_wx_open_id = true; + // wx_open_id, varchar + } + @JsonIgnore + public boolean isEmptyWx_open_id() { + return this.wx_open_id == null || this.wx_open_id.length() == 0; + } + + + public String getWx_union_id() { + return this.wx_union_id; + } + public void setWx_union_id(String wx_union_id) { + this.wx_union_id = wx_union_id; + this.isset_wx_union_id = true; + // wx_union_id, varchar + } + @JsonIgnore + public boolean isEmptyWx_union_id() { + return this.wx_union_id == null || this.wx_union_id.length() == 0; + } + + + public String getDing_user_id() { + return this.ding_user_id; + } + public void setDing_user_id(String ding_user_id) { + this.ding_user_id = ding_user_id; + this.isset_ding_user_id = true; + // ding_user_id, varchar + } + @JsonIgnore + public boolean isEmptyDing_user_id() { + return this.ding_user_id == null || this.ding_user_id.length() == 0; + } + + + public String getBind_client_id() { + return this.bind_client_id; + } + public void setBind_client_id(String bind_client_id) { + this.bind_client_id = bind_client_id; + this.isset_bind_client_id = true; + // bind_client_id, varchar + } + @JsonIgnore + public boolean isEmptyBind_client_id() { + return this.bind_client_id == null || this.bind_client_id.length() == 0; + } + + + public Integer getBind_wechat() { + return this.bind_wechat; + } + public void setBind_wechat(Integer bind_wechat) { + this.bind_wechat = bind_wechat; + this.isset_bind_wechat = true; + // bind_wechat, int + } + @JsonIgnore + public boolean isEmptyBind_wechat() { + return this.bind_wechat == null; + } + + + public Integer getModify_pwd() { + return this.modify_pwd; + } + public void setModify_pwd(Integer modify_pwd) { + this.modify_pwd = modify_pwd; + this.isset_modify_pwd = true; + // modify_pwd, int + } + @JsonIgnore + public boolean isEmptyModify_pwd() { + return this.modify_pwd == null; + } + + + public Integer getBind_mobile() { + return this.bind_mobile; + } + public void setBind_mobile(Integer bind_mobile) { + this.bind_mobile = bind_mobile; + this.isset_bind_mobile = true; + // bind_mobile, int + } + @JsonIgnore + public boolean isEmptyBind_mobile() { + return this.bind_mobile == null; + } + + + public Integer getBind_mail() { + return this.bind_mail; + } + public void setBind_mail(Integer bind_mail) { + this.bind_mail = bind_mail; + this.isset_bind_mail = true; + // bind_mail, int + } + @JsonIgnore + public boolean isEmptyBind_mail() { + return this.bind_mail == null; + } + + + public Long getProfile_id() { + return this.profile_id; + } + public void setProfile_id(Long profile_id) { + this.profile_id = profile_id; + this.isset_profile_id = true; + // profile_id, bigint + } + @JsonIgnore + public boolean isEmptyProfile_id() { + return this.profile_id == null; + } + + + public Integer getIs_wechat_public() { + return this.is_wechat_public; + } + public void setIs_wechat_public(Integer is_wechat_public) { + this.is_wechat_public = is_wechat_public; + this.isset_is_wechat_public = true; + // is_wechat_public, int + } + @JsonIgnore + public boolean isEmptyIs_wechat_public() { + return this.is_wechat_public == null; + } + + + public Integer getIs_wechat_routine() { + return this.is_wechat_routine; + } + public void setIs_wechat_routine(Integer is_wechat_routine) { + this.is_wechat_routine = is_wechat_routine; + this.isset_is_wechat_routine = true; + // is_wechat_routine, int + } + @JsonIgnore + public boolean isEmptyIs_wechat_routine() { + return this.is_wechat_routine == null; + } + + + public Integer getIs_wechat_ios() { + return this.is_wechat_ios; + } + public void setIs_wechat_ios(Integer is_wechat_ios) { + this.is_wechat_ios = is_wechat_ios; + this.isset_is_wechat_ios = true; + // is_wechat_ios, int + } + @JsonIgnore + public boolean isEmptyIs_wechat_ios() { + return this.is_wechat_ios == null; + } + + + public Integer getIs_wechat_android() { + return this.is_wechat_android; + } + public void setIs_wechat_android(Integer is_wechat_android) { + this.is_wechat_android = is_wechat_android; + this.isset_is_wechat_android = true; + // is_wechat_android, int + } + @JsonIgnore + public boolean isEmptyIs_wechat_android() { + return this.is_wechat_android == null; + } + + + public Integer getIs_binding_ios() { + return this.is_binding_ios; + } + public void setIs_binding_ios(Integer is_binding_ios) { + this.is_binding_ios = is_binding_ios; + this.isset_is_binding_ios = true; + // is_binding_ios, int + } + @JsonIgnore + public boolean isEmptyIs_binding_ios() { + return this.is_binding_ios == null; + } + + + public String getRegister_type() { + return this.register_type; + } + public void setRegister_type(String register_type) { + this.register_type = register_type; + this.isset_register_type = true; + // register_type, varchar + } + @JsonIgnore + public boolean isEmptyRegister_type() { + return this.register_type == null || this.register_type.length() == 0; + } + + + public Integer getIs_logoff() { + return this.is_logoff; + } + public void setIs_logoff(Integer is_logoff) { + this.is_logoff = is_logoff; + this.isset_is_logoff = true; + // is_logoff, int + } + @JsonIgnore + public boolean isEmptyIs_logoff() { + return this.is_logoff == null; + } + + + public Long getLogoff_time() { + return this.logoff_time; + } + public void setLogoff_time(Long logoff_time) { + this.logoff_time = logoff_time; + this.isset_logoff_time = true; + // logoff_time, bigint + } + @JsonIgnore + public boolean isEmptyLogoff_time() { + return this.logoff_time == null; + } + + + public Integer getIs_sms() { + return this.is_sms; + } + public void setIs_sms(Integer is_sms) { + this.is_sms = is_sms; + this.isset_is_sms = true; + // is_sms, int + } + @JsonIgnore + public boolean isEmptyIs_sms() { + return this.is_sms == null; + } + + + public Integer getType() { + return this.type; + } + public void setType(Integer type) { + this.type = type; + this.isset_type = true; + // type, int + } + @JsonIgnore + public boolean isEmptyType() { + return this.type == null; + } + + + public Long getMer_id() { + return this.mer_id; + } + public void setMer_id(Long mer_id) { + this.mer_id = mer_id; + this.isset_mer_id = true; + // mer_id, bigint + } + @JsonIgnore + public boolean isEmptyMer_id() { + return this.mer_id == null; + } + + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("id=").append(this.id) + .append("dept_id=").append(this.dept_id) + .append("org_id=").append(this.org_id) + .append("user_name=").append(this.user_name) + .append("nick_name=").append(this.nick_name) + .append("user_type=").append(this.user_type) + .append("email=").append(this.email) + .append("phonenumber=").append(this.phonenumber) + .append("sex=").append(this.sex) + .append("avatar=").append(this.avatar) + .append("password=").append(this.password) + .append("status=").append(this.status) + .append("del_flag=").append(this.del_flag) + .append("login_ip=").append(this.login_ip) + .append("login_date=").append(this.login_date) + .append("create_by=").append(this.create_by) + .append("create_time=").append(this.create_time) + .append("update_by=").append(this.update_by) + .append("update_time=").append(this.update_time) + .append("remark=").append(this.remark) + .append("wx_open_id=").append(this.wx_open_id) + .append("wx_union_id=").append(this.wx_union_id) + .append("ding_user_id=").append(this.ding_user_id) + .append("bind_client_id=").append(this.bind_client_id) + .append("bind_wechat=").append(this.bind_wechat) + .append("modify_pwd=").append(this.modify_pwd) + .append("bind_mobile=").append(this.bind_mobile) + .append("bind_mail=").append(this.bind_mail) + .append("profile_id=").append(this.profile_id) + .append("is_wechat_public=").append(this.is_wechat_public) + .append("is_wechat_routine=").append(this.is_wechat_routine) + .append("is_wechat_ios=").append(this.is_wechat_ios) + .append("is_wechat_android=").append(this.is_wechat_android) + .append("is_binding_ios=").append(this.is_binding_ios) + .append("register_type=").append(this.register_type) + .append("is_logoff=").append(this.is_logoff) + .append("logoff_time=").append(this.logoff_time) + .append("is_sms=").append(this.is_sms) + .append("type=").append(this.type) + .append("mer_id=").append(this.mer_id) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public S_user_core $clone() { + S_user_core s_user_core = new S_user_core(); + + // 鏁版嵁搴撳悕绉� + //s_user_core.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_id) { + s_user_core.setId(this.getId()); + } + // 鏅�氬睘鎬� + if (this.isset_dept_id) { + s_user_core.setDept_id(this.getDept_id()); + } + if (this.isset_org_id) { + s_user_core.setOrg_id(this.getOrg_id()); + } + if (this.isset_user_name) { + s_user_core.setUser_name(this.getUser_name()); + } + if (this.isset_nick_name) { + s_user_core.setNick_name(this.getNick_name()); + } + if (this.isset_user_type) { + s_user_core.setUser_type(this.getUser_type()); + } + if (this.isset_email) { + s_user_core.setEmail(this.getEmail()); + } + if (this.isset_phonenumber) { + s_user_core.setPhonenumber(this.getPhonenumber()); + } + if (this.isset_sex) { + s_user_core.setSex(this.getSex()); + } + if (this.isset_avatar) { + s_user_core.setAvatar(this.getAvatar()); + } + if (this.isset_password) { + s_user_core.setPassword(this.getPassword()); + } + if (this.isset_status) { + s_user_core.setStatus(this.getStatus()); + } + if (this.isset_del_flag) { + s_user_core.setDel_flag(this.getDel_flag()); + } + if (this.isset_login_ip) { + s_user_core.setLogin_ip(this.getLogin_ip()); + } + if (this.isset_login_date) { + s_user_core.setLogin_date(this.getLogin_date()); + } + if (this.isset_create_by) { + s_user_core.setCreate_by(this.getCreate_by()); + } + if (this.isset_create_time) { + s_user_core.setCreate_time(this.getCreate_time()); + } + if (this.isset_update_by) { + s_user_core.setUpdate_by(this.getUpdate_by()); + } + if (this.isset_update_time) { + s_user_core.setUpdate_time(this.getUpdate_time()); + } + if (this.isset_remark) { + s_user_core.setRemark(this.getRemark()); + } + if (this.isset_wx_open_id) { + s_user_core.setWx_open_id(this.getWx_open_id()); + } + if (this.isset_wx_union_id) { + s_user_core.setWx_union_id(this.getWx_union_id()); + } + if (this.isset_ding_user_id) { + s_user_core.setDing_user_id(this.getDing_user_id()); + } + if (this.isset_bind_client_id) { + s_user_core.setBind_client_id(this.getBind_client_id()); + } + if (this.isset_bind_wechat) { + s_user_core.setBind_wechat(this.getBind_wechat()); + } + if (this.isset_modify_pwd) { + s_user_core.setModify_pwd(this.getModify_pwd()); + } + if (this.isset_bind_mobile) { + s_user_core.setBind_mobile(this.getBind_mobile()); + } + if (this.isset_bind_mail) { + s_user_core.setBind_mail(this.getBind_mail()); + } + if (this.isset_profile_id) { + s_user_core.setProfile_id(this.getProfile_id()); + } + if (this.isset_is_wechat_public) { + s_user_core.setIs_wechat_public(this.getIs_wechat_public()); + } + if (this.isset_is_wechat_routine) { + s_user_core.setIs_wechat_routine(this.getIs_wechat_routine()); + } + if (this.isset_is_wechat_ios) { + s_user_core.setIs_wechat_ios(this.getIs_wechat_ios()); + } + if (this.isset_is_wechat_android) { + s_user_core.setIs_wechat_android(this.getIs_wechat_android()); + } + if (this.isset_is_binding_ios) { + s_user_core.setIs_binding_ios(this.getIs_binding_ios()); + } + if (this.isset_register_type) { + s_user_core.setRegister_type(this.getRegister_type()); + } + if (this.isset_is_logoff) { + s_user_core.setIs_logoff(this.getIs_logoff()); + } + if (this.isset_logoff_time) { + s_user_core.setLogoff_time(this.getLogoff_time()); + } + if (this.isset_is_sms) { + s_user_core.setIs_sms(this.getIs_sms()); + } + if (this.isset_type) { + s_user_core.setType(this.getType()); + } + if (this.isset_mer_id) { + s_user_core.setMer_id(this.getMer_id()); + } + return s_user_core; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_user_core_mapper.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_user_core_mapper.java new file mode 100644 index 0000000..5cabcdc --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_user_core_mapper.java @@ -0,0 +1,771 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:S_USER_CORE * + * @author genrator + */ +public class S_user_core_mapper extends S_user_core implements BaseMapper<S_user_core> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<S_user_core> ROW_MAPPER = new S_user_coreRowMapper(); + + // 涓婚敭 + public static final String ID = "id"; + // 鏅�氬睘鎬� + public static final String DEPT_ID = "dept_id"; + public static final String ORG_ID = "org_id"; + public static final String USER_NAME = "user_name"; + public static final String NICK_NAME = "nick_name"; + public static final String USER_TYPE = "user_type"; + public static final String EMAIL = "email"; + public static final String PHONENUMBER = "phonenumber"; + public static final String SEX = "sex"; + public static final String AVATAR = "avatar"; + public static final String PASSWORD = "password"; + public static final String STATUS = "status"; + public static final String DEL_FLAG = "del_flag"; + public static final String LOGIN_IP = "login_ip"; + public static final String LOGIN_DATE = "login_date"; + public static final String CREATE_BY = "create_by"; + public static final String CREATE_TIME = "create_time"; + public static final String UPDATE_BY = "update_by"; + public static final String UPDATE_TIME = "update_time"; + public static final String REMARK = "remark"; + public static final String WX_OPEN_ID = "wx_open_id"; + public static final String WX_UNION_ID = "wx_union_id"; + public static final String DING_USER_ID = "ding_user_id"; + public static final String BIND_CLIENT_ID = "bind_client_id"; + public static final String BIND_WECHAT = "bind_wechat"; + public static final String MODIFY_PWD = "modify_pwd"; + public static final String BIND_MOBILE = "bind_mobile"; + public static final String BIND_MAIL = "bind_mail"; + public static final String PROFILE_ID = "profile_id"; + public static final String IS_WECHAT_PUBLIC = "is_wechat_public"; + public static final String IS_WECHAT_ROUTINE = "is_wechat_routine"; + public static final String IS_WECHAT_IOS = "is_wechat_ios"; + public static final String IS_WECHAT_ANDROID = "is_wechat_android"; + public static final String IS_BINDING_IOS = "is_binding_ios"; + public static final String REGISTER_TYPE = "register_type"; + public static final String IS_LOGOFF = "is_logoff"; + public static final String LOGOFF_TIME = "logoff_time"; + public static final String IS_SMS = "is_sms"; + public static final String TYPE = "type"; + public static final String MER_ID = "mer_id"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_user_core_mapper(S_user_core s_user_core) { + if (s_user_core == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (s_user_core.isset_id) { + this.setId(s_user_core.getId()); + } + //鏅�氬睘鎬� + if (s_user_core.isset_dept_id) { + this.setDept_id(s_user_core.getDept_id()); + } + if (s_user_core.isset_org_id) { + this.setOrg_id(s_user_core.getOrg_id()); + } + if (s_user_core.isset_user_name) { + this.setUser_name(s_user_core.getUser_name()); + } + if (s_user_core.isset_nick_name) { + this.setNick_name(s_user_core.getNick_name()); + } + if (s_user_core.isset_user_type) { + this.setUser_type(s_user_core.getUser_type()); + } + if (s_user_core.isset_email) { + this.setEmail(s_user_core.getEmail()); + } + if (s_user_core.isset_phonenumber) { + this.setPhonenumber(s_user_core.getPhonenumber()); + } + if (s_user_core.isset_sex) { + this.setSex(s_user_core.getSex()); + } + if (s_user_core.isset_avatar) { + this.setAvatar(s_user_core.getAvatar()); + } + if (s_user_core.isset_password) { + this.setPassword(s_user_core.getPassword()); + } + if (s_user_core.isset_status) { + this.setStatus(s_user_core.getStatus()); + } + if (s_user_core.isset_del_flag) { + this.setDel_flag(s_user_core.getDel_flag()); + } + if (s_user_core.isset_login_ip) { + this.setLogin_ip(s_user_core.getLogin_ip()); + } + if (s_user_core.isset_login_date) { + this.setLogin_date(s_user_core.getLogin_date()); + } + if (s_user_core.isset_create_by) { + this.setCreate_by(s_user_core.getCreate_by()); + } + if (s_user_core.isset_create_time) { + this.setCreate_time(s_user_core.getCreate_time()); + } + if (s_user_core.isset_update_by) { + this.setUpdate_by(s_user_core.getUpdate_by()); + } + if (s_user_core.isset_update_time) { + this.setUpdate_time(s_user_core.getUpdate_time()); + } + if (s_user_core.isset_remark) { + this.setRemark(s_user_core.getRemark()); + } + if (s_user_core.isset_wx_open_id) { + this.setWx_open_id(s_user_core.getWx_open_id()); + } + if (s_user_core.isset_wx_union_id) { + this.setWx_union_id(s_user_core.getWx_union_id()); + } + if (s_user_core.isset_ding_user_id) { + this.setDing_user_id(s_user_core.getDing_user_id()); + } + if (s_user_core.isset_bind_client_id) { + this.setBind_client_id(s_user_core.getBind_client_id()); + } + if (s_user_core.isset_bind_wechat) { + this.setBind_wechat(s_user_core.getBind_wechat()); + } + if (s_user_core.isset_modify_pwd) { + this.setModify_pwd(s_user_core.getModify_pwd()); + } + if (s_user_core.isset_bind_mobile) { + this.setBind_mobile(s_user_core.getBind_mobile()); + } + if (s_user_core.isset_bind_mail) { + this.setBind_mail(s_user_core.getBind_mail()); + } + if (s_user_core.isset_profile_id) { + this.setProfile_id(s_user_core.getProfile_id()); + } + if (s_user_core.isset_is_wechat_public) { + this.setIs_wechat_public(s_user_core.getIs_wechat_public()); + } + if (s_user_core.isset_is_wechat_routine) { + this.setIs_wechat_routine(s_user_core.getIs_wechat_routine()); + } + if (s_user_core.isset_is_wechat_ios) { + this.setIs_wechat_ios(s_user_core.getIs_wechat_ios()); + } + if (s_user_core.isset_is_wechat_android) { + this.setIs_wechat_android(s_user_core.getIs_wechat_android()); + } + if (s_user_core.isset_is_binding_ios) { + this.setIs_binding_ios(s_user_core.getIs_binding_ios()); + } + if (s_user_core.isset_register_type) { + this.setRegister_type(s_user_core.getRegister_type()); + } + if (s_user_core.isset_is_logoff) { + this.setIs_logoff(s_user_core.getIs_logoff()); + } + if (s_user_core.isset_logoff_time) { + this.setLogoff_time(s_user_core.getLogoff_time()); + } + if (s_user_core.isset_is_sms) { + this.setIs_sms(s_user_core.getIs_sms()); + } + if (s_user_core.isset_type) { + this.setType(s_user_core.getType()); + } + if (s_user_core.isset_mer_id) { + this.setMer_id(s_user_core.getMer_id()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(s_user_core.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "s_user_core"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return ID; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getId(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(ID, this.getId()); + ib.set(DEPT_ID, this.getDept_id(), this.isset_dept_id); + ib.set(ORG_ID, this.getOrg_id(), this.isset_org_id); + ib.set(USER_NAME, this.getUser_name(), this.isset_user_name); + ib.set(NICK_NAME, this.getNick_name(), this.isset_nick_name); + ib.set(USER_TYPE, this.getUser_type(), this.isset_user_type); + ib.set(EMAIL, this.getEmail(), this.isset_email); + ib.set(PHONENUMBER, this.getPhonenumber(), this.isset_phonenumber); + ib.set(SEX, this.getSex(), this.isset_sex); + ib.set(AVATAR, this.getAvatar(), this.isset_avatar); + ib.set(PASSWORD, this.getPassword(), this.isset_password); + ib.set(STATUS, this.getStatus(), this.isset_status); + ib.set(DEL_FLAG, this.getDel_flag(), this.isset_del_flag); + ib.set(LOGIN_IP, this.getLogin_ip(), this.isset_login_ip); + ib.set(LOGIN_DATE, this.getLogin_date(), this.isset_login_date); + ib.set(CREATE_BY, this.getCreate_by(), this.isset_create_by); + ib.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ib.set(UPDATE_BY, this.getUpdate_by(), this.isset_update_by); + ib.set(UPDATE_TIME, this.getUpdate_time(), this.isset_update_time); + ib.set(REMARK, this.getRemark(), this.isset_remark); + ib.set(WX_OPEN_ID, this.getWx_open_id(), this.isset_wx_open_id); + ib.set(WX_UNION_ID, this.getWx_union_id(), this.isset_wx_union_id); + ib.set(DING_USER_ID, this.getDing_user_id(), this.isset_ding_user_id); + ib.set(BIND_CLIENT_ID, this.getBind_client_id(), this.isset_bind_client_id); + ib.set(BIND_WECHAT, this.getBind_wechat(), this.isset_bind_wechat); + ib.set(MODIFY_PWD, this.getModify_pwd(), this.isset_modify_pwd); + ib.set(BIND_MOBILE, this.getBind_mobile(), this.isset_bind_mobile); + ib.set(BIND_MAIL, this.getBind_mail(), this.isset_bind_mail); + ib.set(PROFILE_ID, this.getProfile_id(), this.isset_profile_id); + ib.set(IS_WECHAT_PUBLIC, this.getIs_wechat_public(), this.isset_is_wechat_public); + ib.set(IS_WECHAT_ROUTINE, this.getIs_wechat_routine(), this.isset_is_wechat_routine); + ib.set(IS_WECHAT_IOS, this.getIs_wechat_ios(), this.isset_is_wechat_ios); + ib.set(IS_WECHAT_ANDROID, this.getIs_wechat_android(), this.isset_is_wechat_android); + ib.set(IS_BINDING_IOS, this.getIs_binding_ios(), this.isset_is_binding_ios); + ib.set(REGISTER_TYPE, this.getRegister_type(), this.isset_register_type); + ib.set(IS_LOGOFF, this.getIs_logoff(), this.isset_is_logoff); + ib.set(LOGOFF_TIME, this.getLogoff_time(), this.isset_logoff_time); + ib.set(IS_SMS, this.getIs_sms(), this.isset_is_sms); + ib.set(TYPE, this.getType(), this.isset_type); + ib.set(MER_ID, this.getMer_id(), this.isset_mer_id); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(DEPT_ID, this.getDept_id(), this.isset_dept_id); + ub.set(ORG_ID, this.getOrg_id(), this.isset_org_id); + ub.set(USER_NAME, this.getUser_name(), this.isset_user_name); + ub.set(NICK_NAME, this.getNick_name(), this.isset_nick_name); + ub.set(USER_TYPE, this.getUser_type(), this.isset_user_type); + ub.set(EMAIL, this.getEmail(), this.isset_email); + ub.set(PHONENUMBER, this.getPhonenumber(), this.isset_phonenumber); + ub.set(SEX, this.getSex(), this.isset_sex); + ub.set(AVATAR, this.getAvatar(), this.isset_avatar); + ub.set(PASSWORD, this.getPassword(), this.isset_password); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(DEL_FLAG, this.getDel_flag(), this.isset_del_flag); + ub.set(LOGIN_IP, this.getLogin_ip(), this.isset_login_ip); + ub.set(LOGIN_DATE, this.getLogin_date(), this.isset_login_date); + ub.set(CREATE_BY, this.getCreate_by(), this.isset_create_by); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(UPDATE_BY, this.getUpdate_by(), this.isset_update_by); + ub.set(UPDATE_TIME, this.getUpdate_time(), this.isset_update_time); + ub.set(REMARK, this.getRemark(), this.isset_remark); + ub.set(WX_OPEN_ID, this.getWx_open_id(), this.isset_wx_open_id); + ub.set(WX_UNION_ID, this.getWx_union_id(), this.isset_wx_union_id); + ub.set(DING_USER_ID, this.getDing_user_id(), this.isset_ding_user_id); + ub.set(BIND_CLIENT_ID, this.getBind_client_id(), this.isset_bind_client_id); + ub.set(BIND_WECHAT, this.getBind_wechat(), this.isset_bind_wechat); + ub.set(MODIFY_PWD, this.getModify_pwd(), this.isset_modify_pwd); + ub.set(BIND_MOBILE, this.getBind_mobile(), this.isset_bind_mobile); + ub.set(BIND_MAIL, this.getBind_mail(), this.isset_bind_mail); + ub.set(PROFILE_ID, this.getProfile_id(), this.isset_profile_id); + ub.set(IS_WECHAT_PUBLIC, this.getIs_wechat_public(), this.isset_is_wechat_public); + ub.set(IS_WECHAT_ROUTINE, this.getIs_wechat_routine(), this.isset_is_wechat_routine); + ub.set(IS_WECHAT_IOS, this.getIs_wechat_ios(), this.isset_is_wechat_ios); + ub.set(IS_WECHAT_ANDROID, this.getIs_wechat_android(), this.isset_is_wechat_android); + ub.set(IS_BINDING_IOS, this.getIs_binding_ios(), this.isset_is_binding_ios); + ub.set(REGISTER_TYPE, this.getRegister_type(), this.isset_register_type); + ub.set(IS_LOGOFF, this.getIs_logoff(), this.isset_is_logoff); + ub.set(LOGOFF_TIME, this.getLogoff_time(), this.isset_logoff_time); + ub.set(IS_SMS, this.getIs_sms(), this.isset_is_sms); + ub.set(TYPE, this.getType(), this.isset_type); + ub.set(MER_ID, this.getMer_id(), this.isset_mer_id); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(DEPT_ID, this.getDept_id(), this.isset_dept_id); + ub.set(ORG_ID, this.getOrg_id(), this.isset_org_id); + ub.set(USER_NAME, this.getUser_name(), this.isset_user_name); + ub.set(NICK_NAME, this.getNick_name(), this.isset_nick_name); + ub.set(USER_TYPE, this.getUser_type(), this.isset_user_type); + ub.set(EMAIL, this.getEmail(), this.isset_email); + ub.set(PHONENUMBER, this.getPhonenumber(), this.isset_phonenumber); + ub.set(SEX, this.getSex(), this.isset_sex); + ub.set(AVATAR, this.getAvatar(), this.isset_avatar); + ub.set(PASSWORD, this.getPassword(), this.isset_password); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(DEL_FLAG, this.getDel_flag(), this.isset_del_flag); + ub.set(LOGIN_IP, this.getLogin_ip(), this.isset_login_ip); + ub.set(LOGIN_DATE, this.getLogin_date(), this.isset_login_date); + ub.set(CREATE_BY, this.getCreate_by(), this.isset_create_by); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(UPDATE_BY, this.getUpdate_by(), this.isset_update_by); + ub.set(UPDATE_TIME, this.getUpdate_time(), this.isset_update_time); + ub.set(REMARK, this.getRemark(), this.isset_remark); + ub.set(WX_OPEN_ID, this.getWx_open_id(), this.isset_wx_open_id); + ub.set(WX_UNION_ID, this.getWx_union_id(), this.isset_wx_union_id); + ub.set(DING_USER_ID, this.getDing_user_id(), this.isset_ding_user_id); + ub.set(BIND_CLIENT_ID, this.getBind_client_id(), this.isset_bind_client_id); + ub.set(BIND_WECHAT, this.getBind_wechat(), this.isset_bind_wechat); + ub.set(MODIFY_PWD, this.getModify_pwd(), this.isset_modify_pwd); + ub.set(BIND_MOBILE, this.getBind_mobile(), this.isset_bind_mobile); + ub.set(BIND_MAIL, this.getBind_mail(), this.isset_bind_mail); + ub.set(PROFILE_ID, this.getProfile_id(), this.isset_profile_id); + ub.set(IS_WECHAT_PUBLIC, this.getIs_wechat_public(), this.isset_is_wechat_public); + ub.set(IS_WECHAT_ROUTINE, this.getIs_wechat_routine(), this.isset_is_wechat_routine); + ub.set(IS_WECHAT_IOS, this.getIs_wechat_ios(), this.isset_is_wechat_ios); + ub.set(IS_WECHAT_ANDROID, this.getIs_wechat_android(), this.isset_is_wechat_android); + ub.set(IS_BINDING_IOS, this.getIs_binding_ios(), this.isset_is_binding_ios); + ub.set(REGISTER_TYPE, this.getRegister_type(), this.isset_register_type); + ub.set(IS_LOGOFF, this.getIs_logoff(), this.isset_is_logoff); + ub.set(LOGOFF_TIME, this.getLogoff_time(), this.isset_logoff_time); + ub.set(IS_SMS, this.getIs_sms(), this.isset_is_sms); + ub.set(TYPE, this.getType(), this.isset_type); + ub.set(MER_ID, this.getMer_id(), this.isset_mer_id); + + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(DEPT_ID, this.getDept_id(), this.isset_dept_id); + ub.set(ORG_ID, this.getOrg_id(), this.isset_org_id); + ub.set(USER_NAME, this.getUser_name(), this.isset_user_name); + ub.set(NICK_NAME, this.getNick_name(), this.isset_nick_name); + ub.set(USER_TYPE, this.getUser_type(), this.isset_user_type); + ub.set(EMAIL, this.getEmail(), this.isset_email); + ub.set(PHONENUMBER, this.getPhonenumber(), this.isset_phonenumber); + ub.set(SEX, this.getSex(), this.isset_sex); + ub.set(AVATAR, this.getAvatar(), this.isset_avatar); + ub.set(PASSWORD, this.getPassword(), this.isset_password); + ub.set(STATUS, this.getStatus(), this.isset_status); + ub.set(DEL_FLAG, this.getDel_flag(), this.isset_del_flag); + ub.set(LOGIN_IP, this.getLogin_ip(), this.isset_login_ip); + ub.set(LOGIN_DATE, this.getLogin_date(), this.isset_login_date); + ub.set(CREATE_BY, this.getCreate_by(), this.isset_create_by); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(UPDATE_BY, this.getUpdate_by(), this.isset_update_by); + ub.set(UPDATE_TIME, this.getUpdate_time(), this.isset_update_time); + ub.set(REMARK, this.getRemark(), this.isset_remark); + ub.set(WX_OPEN_ID, this.getWx_open_id(), this.isset_wx_open_id); + ub.set(WX_UNION_ID, this.getWx_union_id(), this.isset_wx_union_id); + ub.set(DING_USER_ID, this.getDing_user_id(), this.isset_ding_user_id); + ub.set(BIND_CLIENT_ID, this.getBind_client_id(), this.isset_bind_client_id); + ub.set(BIND_WECHAT, this.getBind_wechat(), this.isset_bind_wechat); + ub.set(MODIFY_PWD, this.getModify_pwd(), this.isset_modify_pwd); + ub.set(BIND_MOBILE, this.getBind_mobile(), this.isset_bind_mobile); + ub.set(BIND_MAIL, this.getBind_mail(), this.isset_bind_mail); + ub.set(PROFILE_ID, this.getProfile_id(), this.isset_profile_id); + ub.set(IS_WECHAT_PUBLIC, this.getIs_wechat_public(), this.isset_is_wechat_public); + ub.set(IS_WECHAT_ROUTINE, this.getIs_wechat_routine(), this.isset_is_wechat_routine); + ub.set(IS_WECHAT_IOS, this.getIs_wechat_ios(), this.isset_is_wechat_ios); + ub.set(IS_WECHAT_ANDROID, this.getIs_wechat_android(), this.isset_is_wechat_android); + ub.set(IS_BINDING_IOS, this.getIs_binding_ios(), this.isset_is_binding_ios); + ub.set(REGISTER_TYPE, this.getRegister_type(), this.isset_register_type); + ub.set(IS_LOGOFF, this.getIs_logoff(), this.isset_is_logoff); + ub.set(LOGOFF_TIME, this.getLogoff_time(), this.isset_logoff_time); + ub.set(IS_SMS, this.getIs_sms(), this.isset_is_sms); + ub.set(TYPE, this.getType(), this.isset_type); + ub.set(MER_ID, this.getMer_id(), this.isset_mer_id); + + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select id, dept_id, org_id, user_name, nick_name, user_type, email, phonenumber, sex, avatar, password, status, del_flag, login_ip, login_date, create_by, create_time, update_by, update_time, remark, wx_open_id, wx_union_id, ding_user_id, bind_client_id, bind_wechat, modify_pwd, bind_mobile, bind_mail, profile_id, is_wechat_public, is_wechat_routine, is_wechat_ios, is_wechat_android, is_binding_ios, register_type, is_logoff, logoff_time, is_sms, type, mer_id from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select id, dept_id, org_id, user_name, nick_name, user_type, email, phonenumber, sex, avatar, password, status, del_flag, login_ip, login_date, create_by, create_time, update_by, update_time, remark, wx_open_id, wx_union_id, ding_user_id, bind_client_id, bind_wechat, modify_pwd, bind_mobile, bind_mail, profile_id, is_wechat_public, is_wechat_routine, is_wechat_ios, is_wechat_android, is_binding_ios, register_type, is_logoff, logoff_time, is_sms, type, mer_id from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public S_user_core mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public S_user_core toS_user_core() { + return super.$clone(); + } +} + +/** + * s_user_core RowMapper + * + * @author genrator + */ +class S_user_coreRowMapper implements RowMapper<S_user_core> { + + @Override + public S_user_core mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + S_user_core s_user_core = new S_user_core(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.ID); + if (columnIndex > 0) { + s_user_core.setId(rs.getLong(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.DEPT_ID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_core.setDept_id(null); + } else { + s_user_core.setDept_id(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.ORG_ID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_core.setOrg_id(null); + } else { + s_user_core.setOrg_id(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.USER_NAME); + if (columnIndex > 0) { + s_user_core.setUser_name(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.NICK_NAME); + if (columnIndex > 0) { + s_user_core.setNick_name(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.USER_TYPE); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_core.setUser_type(null); + } else { + s_user_core.setUser_type(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.EMAIL); + if (columnIndex > 0) { + s_user_core.setEmail(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.PHONENUMBER); + if (columnIndex > 0) { + s_user_core.setPhonenumber(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.SEX); + if (columnIndex > 0) { + s_user_core.setSex(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.AVATAR); + if (columnIndex > 0) { + s_user_core.setAvatar(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.PASSWORD); + if (columnIndex > 0) { + s_user_core.setPassword(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.STATUS); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_core.setStatus(null); + } else { + s_user_core.setStatus(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.DEL_FLAG); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_core.setDel_flag(null); + } else { + s_user_core.setDel_flag(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.LOGIN_IP); + if (columnIndex > 0) { + s_user_core.setLogin_ip(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.LOGIN_DATE); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_core.setLogin_date(null); + } else { + s_user_core.setLogin_date(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.CREATE_BY); + if (columnIndex > 0) { + s_user_core.setCreate_by(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.CREATE_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_core.setCreate_time(null); + } else { + s_user_core.setCreate_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.UPDATE_BY); + if (columnIndex > 0) { + s_user_core.setUpdate_by(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.UPDATE_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_core.setUpdate_time(null); + } else { + s_user_core.setUpdate_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.REMARK); + if (columnIndex > 0) { + s_user_core.setRemark(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.WX_OPEN_ID); + if (columnIndex > 0) { + s_user_core.setWx_open_id(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.WX_UNION_ID); + if (columnIndex > 0) { + s_user_core.setWx_union_id(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.DING_USER_ID); + if (columnIndex > 0) { + s_user_core.setDing_user_id(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.BIND_CLIENT_ID); + if (columnIndex > 0) { + s_user_core.setBind_client_id(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.BIND_WECHAT); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_core.setBind_wechat(null); + } else { + s_user_core.setBind_wechat(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.MODIFY_PWD); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_core.setModify_pwd(null); + } else { + s_user_core.setModify_pwd(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.BIND_MOBILE); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_core.setBind_mobile(null); + } else { + s_user_core.setBind_mobile(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.BIND_MAIL); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_core.setBind_mail(null); + } else { + s_user_core.setBind_mail(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.PROFILE_ID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_core.setProfile_id(null); + } else { + s_user_core.setProfile_id(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.IS_WECHAT_PUBLIC); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_core.setIs_wechat_public(null); + } else { + s_user_core.setIs_wechat_public(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.IS_WECHAT_ROUTINE); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_core.setIs_wechat_routine(null); + } else { + s_user_core.setIs_wechat_routine(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.IS_WECHAT_IOS); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_core.setIs_wechat_ios(null); + } else { + s_user_core.setIs_wechat_ios(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.IS_WECHAT_ANDROID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_core.setIs_wechat_android(null); + } else { + s_user_core.setIs_wechat_android(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.IS_BINDING_IOS); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_core.setIs_binding_ios(null); + } else { + s_user_core.setIs_binding_ios(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.REGISTER_TYPE); + if (columnIndex > 0) { + s_user_core.setRegister_type(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.IS_LOGOFF); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_core.setIs_logoff(null); + } else { + s_user_core.setIs_logoff(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.LOGOFF_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_core.setLogoff_time(null); + } else { + s_user_core.setLogoff_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.IS_SMS); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_core.setIs_sms(null); + } else { + s_user_core.setIs_sms(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.TYPE); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_core.setType(null); + } else { + s_user_core.setType(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_core_mapper.MER_ID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_core.setMer_id(null); + } else { + s_user_core.setMer_id(rs.getLong(columnIndex)); + } + } + return s_user_core; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_user_login.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_user_login.java new file mode 100644 index 0000000..e8e3453 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_user_login.java @@ -0,0 +1,199 @@ +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:S_USER_LOGIN * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class S_user_login extends BasePo<S_user_login> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + /** + * 鐢ㄤ簬鍏煎鑰佸啓娉� + */ + @JsonIgnore + public static final S_user_login ROW_MAPPER = new S_user_login(); + + // 涓婚敭 + private Long id = null; + @JsonIgnore + protected boolean isset_id = false; + + // 灞炴�у垪琛� + private String user_name = null; + @JsonIgnore + protected boolean isset_user_name = false; + + private String uuid = null; + @JsonIgnore + protected boolean isset_uuid = false; + + private Long update_time = null; + @JsonIgnore + protected boolean isset_update_time = false; + + private Long create_time = null; + @JsonIgnore + protected boolean isset_create_time = false; + + private String client_type = null; + @JsonIgnore + protected boolean isset_client_type = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_user_login() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public S_user_login(Long id) { + this.setId(id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setId((Long) value); + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + this.isset_id = true; + } + + @JsonIgnore + public boolean isEmptyId() { + return this.id == null; + } + + public String getUser_name() { + return this.user_name; + } + + public void setUser_name(String user_name) { + this.user_name = user_name; + this.isset_user_name = true; + } + + @JsonIgnore + public boolean isEmptyUser_name() { + return this.user_name == null || this.user_name.length() == 0; + } + + public String getUuid() { + return this.uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + this.isset_uuid = true; + } + + @JsonIgnore + public boolean isEmptyUuid() { + return this.uuid == null || this.uuid.length() == 0; + } + + public Long getUpdate_time() { + return this.update_time; + } + + public void setUpdate_time(Long update_time) { + this.update_time = update_time; + this.isset_update_time = true; + } + + @JsonIgnore + public boolean isEmptyUpdate_time() { + return this.update_time == null; + } + + public Long getCreate_time() { + return this.create_time; + } + + public void setCreate_time(Long create_time) { + this.create_time = create_time; + this.isset_create_time = true; + } + + @JsonIgnore + public boolean isEmptyCreate_time() { + return this.create_time == null; + } + + public String getClient_type() { + return this.client_type; + } + + public void setClient_type(String client_type) { + this.client_type = client_type; + this.isset_client_type = true; + } + + @JsonIgnore + public boolean isEmptyClient_type() { + return this.client_type == null || this.client_type.length() == 0; + } + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("id=").append(this.id) + .append("user_name=").append(this.user_name) + .append("uuid=").append(this.uuid) + .append("update_time=").append(this.update_time) + .append("create_time=").append(this.create_time) + .append("client_type=").append(this.client_type) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public S_user_login $clone() { + S_user_login s_user_login = new S_user_login(); + + // 鏁版嵁搴撳悕绉� + //s_user_login.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_id) { + s_user_login.setId(this.getId()); + } + // 鏅�氬睘鎬� + if (this.isset_user_name) { + s_user_login.setUser_name(this.getUser_name()); + } + if (this.isset_uuid) { + s_user_login.setUuid(this.getUuid()); + } + if (this.isset_update_time) { + s_user_login.setUpdate_time(this.getUpdate_time()); + } + if (this.isset_create_time) { + s_user_login.setCreate_time(this.getCreate_time()); + } + if (this.isset_client_type) { + s_user_login.setClient_type(this.getClient_type()); + } + return s_user_login; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_user_login_mapper.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_user_login_mapper.java new file mode 100644 index 0000000..28c108b --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_user_login_mapper.java @@ -0,0 +1,279 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:S_USER_LOGIN * + * @author genrator + */ +public class S_user_login_mapper extends S_user_login implements BaseMapper<S_user_login> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<S_user_login> ROW_MAPPER = new S_user_loginRowMapper(); + + // 涓婚敭 + public static final String ID = "id"; + // 鏅�氬睘鎬� + public static final String USER_NAME = "user_name"; + public static final String UUID = "uuid"; + public static final String UPDATE_TIME = "update_time"; + public static final String CREATE_TIME = "create_time"; + public static final String CLIENT_TYPE = "client_type"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_user_login_mapper(S_user_login s_user_login) { + if (s_user_login == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (s_user_login.isset_id) { + this.setId(s_user_login.getId()); + } + //鏅�氬睘鎬� + if (s_user_login.isset_user_name) { + this.setUser_name(s_user_login.getUser_name()); + } + if (s_user_login.isset_uuid) { + this.setUuid(s_user_login.getUuid()); + } + if (s_user_login.isset_update_time) { + this.setUpdate_time(s_user_login.getUpdate_time()); + } + if (s_user_login.isset_create_time) { + this.setCreate_time(s_user_login.getCreate_time()); + } + if (s_user_login.isset_client_type) { + this.setClient_type(s_user_login.getClient_type()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(s_user_login.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "s_user_login"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return ID; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getId(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(ID, this.getId()); + ib.set(USER_NAME, this.getUser_name(), this.isset_user_name); + ib.set(UUID, this.getUuid(), this.isset_uuid); + ib.set(UPDATE_TIME, this.getUpdate_time(), this.isset_update_time); + ib.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ib.set(CLIENT_TYPE, this.getClient_type(), this.isset_client_type); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(USER_NAME, this.getUser_name(), this.isset_user_name); + ub.set(UUID, this.getUuid(), this.isset_uuid); + ub.set(UPDATE_TIME, this.getUpdate_time(), this.isset_update_time); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(CLIENT_TYPE, this.getClient_type(), this.isset_client_type); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(USER_NAME, this.getUser_name(), this.isset_user_name); + ub.set(UUID, this.getUuid(), this.isset_uuid); + ub.set(UPDATE_TIME, this.getUpdate_time(), this.isset_update_time); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(CLIENT_TYPE, this.getClient_type(), this.isset_client_type); + + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(USER_NAME, this.getUser_name(), this.isset_user_name); + ub.set(UUID, this.getUuid(), this.isset_uuid); + ub.set(UPDATE_TIME, this.getUpdate_time(), this.isset_update_time); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(CLIENT_TYPE, this.getClient_type(), this.isset_client_type); + + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select id, user_name, uuid, update_time, create_time, client_type from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select id, user_name, uuid, update_time, create_time, client_type from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public S_user_login mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public S_user_login toS_user_login() { + return super.$clone(); + } +} + +/** + * s_user_login RowMapper + * + * @author genrator + */ +class S_user_loginRowMapper implements RowMapper<S_user_login> { + + @Override + public S_user_login mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + S_user_login s_user_login = new S_user_login(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, S_user_login_mapper.ID); + if (columnIndex > 0) { + s_user_login.setId(rs.getLong(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, S_user_login_mapper.USER_NAME); + if (columnIndex > 0) { + s_user_login.setUser_name(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_user_login_mapper.UUID); + if (columnIndex > 0) { + s_user_login.setUuid(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_user_login_mapper.UPDATE_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_login.setUpdate_time(null); + } else { + s_user_login.setUpdate_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_login_mapper.CREATE_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_login.setCreate_time(null); + } else { + s_user_login.setCreate_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_login_mapper.CLIENT_TYPE); + if (columnIndex > 0) { + s_user_login.setClient_type(rs.getString(columnIndex)); + } + return s_user_login; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_user_profile.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_user_profile.java new file mode 100644 index 0000000..1e01428 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_user_profile.java @@ -0,0 +1,463 @@ +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:S_USER_PROFILE * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class S_user_profile extends BasePo<S_user_profile> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + /** + * 鐢ㄤ簬鍏煎鑰佸啓娉� + */ + @JsonIgnore + public static final S_user_profile ROW_MAPPER = new S_user_profile(); + + // 涓婚敭 + private Long id = null; + @JsonIgnore + protected boolean isset_id = false; + + // 灞炴�у垪琛� + private Long create_time = null; + @JsonIgnore + protected boolean isset_create_time = false; + + private String mobile = null; + @JsonIgnore + protected boolean isset_mobile = false; + + private String mobile_history = null; + @JsonIgnore + protected boolean isset_mobile_history = false; + + private String card_no = null; + @JsonIgnore + protected boolean isset_card_no = false; + + private String mail = null; + @JsonIgnore + protected boolean isset_mail = false; + + private String birthday = null; + @JsonIgnore + protected boolean isset_birthday = false; + + private String sex = null; + @JsonIgnore + protected boolean isset_sex = false; + + private Long card_front_img = null; + @JsonIgnore + protected boolean isset_card_front_img = false; + + private Long card_back_img = null; + @JsonIgnore + protected boolean isset_card_back_img = false; + + private Long face_img = null; + @JsonIgnore + protected boolean isset_face_img = false; + + private String name = null; + @JsonIgnore + protected boolean isset_name = false; + + private String third_acct = null; + @JsonIgnore + protected boolean isset_third_acct = false; + + private String summary = null; + @JsonIgnore + protected boolean isset_summary = false; + + private Long org_id = null; + @JsonIgnore + protected boolean isset_org_id = false; + + private Long dept_id = null; + @JsonIgnore + protected boolean isset_dept_id = false; + + private String org_name = null; + @JsonIgnore + protected boolean isset_org_name = false; + + private String dept_name = null; + @JsonIgnore + protected boolean isset_dept_name = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_user_profile() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public S_user_profile(Long id) { + this.setId(id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setId((Long) value); + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + this.isset_id = true; + } + + @JsonIgnore + public boolean isEmptyId() { + return this.id == null; + } + + public Long getCreate_time() { + return this.create_time; + } + + public void setCreate_time(Long create_time) { + this.create_time = create_time; + this.isset_create_time = true; + } + + @JsonIgnore + public boolean isEmptyCreate_time() { + return this.create_time == null; + } + + public String getMobile() { + return this.mobile; + } + + public void setMobile(String mobile) { + this.mobile = mobile; + this.isset_mobile = true; + } + + @JsonIgnore + public boolean isEmptyMobile() { + return this.mobile == null || this.mobile.length() == 0; + } + + public String getMobile_history() { + return this.mobile_history; + } + + public void setMobile_history(String mobile_history) { + this.mobile_history = mobile_history; + this.isset_mobile_history = true; + } + + @JsonIgnore + public boolean isEmptyMobile_history() { + return this.mobile_history == null || this.mobile_history.length() == 0; + } + + public String getCard_no() { + return this.card_no; + } + + public void setCard_no(String card_no) { + this.card_no = card_no; + this.isset_card_no = true; + } + + @JsonIgnore + public boolean isEmptyCard_no() { + return this.card_no == null || this.card_no.length() == 0; + } + + public String getMail() { + return this.mail; + } + + public void setMail(String mail) { + this.mail = mail; + this.isset_mail = true; + } + + @JsonIgnore + public boolean isEmptyMail() { + return this.mail == null || this.mail.length() == 0; + } + + public String getBirthday() { + return this.birthday; + } + + public void setBirthday(String birthday) { + this.birthday = birthday; + this.isset_birthday = true; + } + + @JsonIgnore + public boolean isEmptyBirthday() { + return this.birthday == null || this.birthday.length() == 0; + } + + public String getSex() { + return this.sex; + } + + public void setSex(String sex) { + this.sex = sex; + this.isset_sex = true; + } + + @JsonIgnore + public boolean isEmptySex() { + return this.sex == null || this.sex.length() == 0; + } + + public Long getCard_front_img() { + return this.card_front_img; + } + + public void setCard_front_img(Long card_front_img) { + this.card_front_img = card_front_img; + this.isset_card_front_img = true; + } + + @JsonIgnore + public boolean isEmptyCard_front_img() { + return this.card_front_img == null; + } + + public Long getCard_back_img() { + return this.card_back_img; + } + + public void setCard_back_img(Long card_back_img) { + this.card_back_img = card_back_img; + this.isset_card_back_img = true; + } + + @JsonIgnore + public boolean isEmptyCard_back_img() { + return this.card_back_img == null; + } + + public Long getFace_img() { + return this.face_img; + } + + public void setFace_img(Long face_img) { + this.face_img = face_img; + this.isset_face_img = true; + } + + @JsonIgnore + public boolean isEmptyFace_img() { + return this.face_img == null; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + this.isset_name = true; + } + + @JsonIgnore + public boolean isEmptyName() { + return this.name == null || this.name.length() == 0; + } + + public String getThird_acct() { + return this.third_acct; + } + + public void setThird_acct(String third_acct) { + this.third_acct = third_acct; + this.isset_third_acct = true; + } + + @JsonIgnore + public boolean isEmptyThird_acct() { + return this.third_acct == null || this.third_acct.length() == 0; + } + + public String getSummary() { + return this.summary; + } + + public void setSummary(String summary) { + this.summary = summary; + this.isset_summary = true; + } + + @JsonIgnore + public boolean isEmptySummary() { + return this.summary == null || this.summary.length() == 0; + } + + public Long getOrg_id() { + return this.org_id; + } + + public void setOrg_id(Long org_id) { + this.org_id = org_id; + this.isset_org_id = true; + } + + @JsonIgnore + public boolean isEmptyOrg_id() { + return this.org_id == null; + } + + public Long getDept_id() { + return this.dept_id; + } + + public void setDept_id(Long dept_id) { + this.dept_id = dept_id; + this.isset_dept_id = true; + } + + @JsonIgnore + public boolean isEmptyDept_id() { + return this.dept_id == null; + } + + public String getOrg_name() { + return this.org_name; + } + + public void setOrg_name(String org_name) { + this.org_name = org_name; + this.isset_org_name = true; + } + + @JsonIgnore + public boolean isEmptyOrg_name() { + return this.org_name == null || this.org_name.length() == 0; + } + + public String getDept_name() { + return this.dept_name; + } + + public void setDept_name(String dept_name) { + this.dept_name = dept_name; + this.isset_dept_name = true; + } + + @JsonIgnore + public boolean isEmptyDept_name() { + return this.dept_name == null || this.dept_name.length() == 0; + } + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("id=").append(this.id) + .append("create_time=").append(this.create_time) + .append("mobile=").append(this.mobile) + .append("mobile_history=").append(this.mobile_history) + .append("card_no=").append(this.card_no) + .append("mail=").append(this.mail) + .append("birthday=").append(this.birthday) + .append("sex=").append(this.sex) + .append("card_front_img=").append(this.card_front_img) + .append("card_back_img=").append(this.card_back_img) + .append("face_img=").append(this.face_img) + .append("name=").append(this.name) + .append("third_acct=").append(this.third_acct) + .append("summary=").append(this.summary) + .append("org_id=").append(this.org_id) + .append("dept_id=").append(this.dept_id) + .append("org_name=").append(this.org_name) + .append("dept_name=").append(this.dept_name) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public S_user_profile $clone() { + S_user_profile s_user_profile = new S_user_profile(); + + // 鏁版嵁搴撳悕绉� + //s_user_profile.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_id) { + s_user_profile.setId(this.getId()); + } + // 鏅�氬睘鎬� + if (this.isset_create_time) { + s_user_profile.setCreate_time(this.getCreate_time()); + } + if (this.isset_mobile) { + s_user_profile.setMobile(this.getMobile()); + } + if (this.isset_mobile_history) { + s_user_profile.setMobile_history(this.getMobile_history()); + } + if (this.isset_card_no) { + s_user_profile.setCard_no(this.getCard_no()); + } + if (this.isset_mail) { + s_user_profile.setMail(this.getMail()); + } + if (this.isset_birthday) { + s_user_profile.setBirthday(this.getBirthday()); + } + if (this.isset_sex) { + s_user_profile.setSex(this.getSex()); + } + if (this.isset_card_front_img) { + s_user_profile.setCard_front_img(this.getCard_front_img()); + } + if (this.isset_card_back_img) { + s_user_profile.setCard_back_img(this.getCard_back_img()); + } + if (this.isset_face_img) { + s_user_profile.setFace_img(this.getFace_img()); + } + if (this.isset_name) { + s_user_profile.setName(this.getName()); + } + if (this.isset_third_acct) { + s_user_profile.setThird_acct(this.getThird_acct()); + } + if (this.isset_summary) { + s_user_profile.setSummary(this.getSummary()); + } + if (this.isset_org_id) { + s_user_profile.setOrg_id(this.getOrg_id()); + } + if (this.isset_dept_id) { + s_user_profile.setDept_id(this.getDept_id()); + } + if (this.isset_org_name) { + s_user_profile.setOrg_name(this.getOrg_name()); + } + if (this.isset_dept_name) { + s_user_profile.setDept_name(this.getDept_name()); + } + return s_user_profile; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_user_profile_mapper.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_user_profile_mapper.java new file mode 100644 index 0000000..5d667cd --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/S_user_profile_mapper.java @@ -0,0 +1,439 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:S_USER_PROFILE * + * @author genrator + */ +public class S_user_profile_mapper extends S_user_profile implements BaseMapper<S_user_profile> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<S_user_profile> ROW_MAPPER = new S_user_profileRowMapper(); + + // 涓婚敭 + public static final String ID = "id"; + // 鏅�氬睘鎬� + public static final String CREATE_TIME = "create_time"; + public static final String MOBILE = "mobile"; + public static final String MOBILE_HISTORY = "mobile_history"; + public static final String CARD_NO = "card_no"; + public static final String MAIL = "mail"; + public static final String BIRTHDAY = "birthday"; + public static final String SEX = "sex"; + public static final String CARD_FRONT_IMG = "card_front_img"; + public static final String CARD_BACK_IMG = "card_back_img"; + public static final String FACE_IMG = "face_img"; + public static final String NAME = "name"; + public static final String THIRD_ACCT = "third_acct"; + public static final String SUMMARY = "summary"; + public static final String ORG_ID = "org_id"; + public static final String DEPT_ID = "dept_id"; + public static final String ORG_NAME = "org_name"; + public static final String DEPT_NAME = "dept_name"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public S_user_profile_mapper(S_user_profile s_user_profile) { + if (s_user_profile == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (s_user_profile.isset_id) { + this.setId(s_user_profile.getId()); + } + //鏅�氬睘鎬� + if (s_user_profile.isset_create_time) { + this.setCreate_time(s_user_profile.getCreate_time()); + } + if (s_user_profile.isset_mobile) { + this.setMobile(s_user_profile.getMobile()); + } + if (s_user_profile.isset_mobile_history) { + this.setMobile_history(s_user_profile.getMobile_history()); + } + if (s_user_profile.isset_card_no) { + this.setCard_no(s_user_profile.getCard_no()); + } + if (s_user_profile.isset_mail) { + this.setMail(s_user_profile.getMail()); + } + if (s_user_profile.isset_birthday) { + this.setBirthday(s_user_profile.getBirthday()); + } + if (s_user_profile.isset_sex) { + this.setSex(s_user_profile.getSex()); + } + if (s_user_profile.isset_card_front_img) { + this.setCard_front_img(s_user_profile.getCard_front_img()); + } + if (s_user_profile.isset_card_back_img) { + this.setCard_back_img(s_user_profile.getCard_back_img()); + } + if (s_user_profile.isset_face_img) { + this.setFace_img(s_user_profile.getFace_img()); + } + if (s_user_profile.isset_name) { + this.setName(s_user_profile.getName()); + } + if (s_user_profile.isset_third_acct) { + this.setThird_acct(s_user_profile.getThird_acct()); + } + if (s_user_profile.isset_summary) { + this.setSummary(s_user_profile.getSummary()); + } + if (s_user_profile.isset_org_id) { + this.setOrg_id(s_user_profile.getOrg_id()); + } + if (s_user_profile.isset_dept_id) { + this.setDept_id(s_user_profile.getDept_id()); + } + if (s_user_profile.isset_org_name) { + this.setOrg_name(s_user_profile.getOrg_name()); + } + if (s_user_profile.isset_dept_name) { + this.setDept_name(s_user_profile.getDept_name()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(s_user_profile.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "s_user_profile"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return ID; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getId(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(ID, this.getId()); + ib.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ib.set(MOBILE, this.getMobile(), this.isset_mobile); + ib.set(MOBILE_HISTORY, this.getMobile_history(), this.isset_mobile_history); + ib.set(CARD_NO, this.getCard_no(), this.isset_card_no); + ib.set(MAIL, this.getMail(), this.isset_mail); + ib.set(BIRTHDAY, this.getBirthday(), this.isset_birthday); + ib.set(SEX, this.getSex(), this.isset_sex); + ib.set(CARD_FRONT_IMG, this.getCard_front_img(), this.isset_card_front_img); + ib.set(CARD_BACK_IMG, this.getCard_back_img(), this.isset_card_back_img); + ib.set(FACE_IMG, this.getFace_img(), this.isset_face_img); + ib.set(NAME, this.getName(), this.isset_name); + ib.set(THIRD_ACCT, this.getThird_acct(), this.isset_third_acct); + ib.set(SUMMARY, this.getSummary(), this.isset_summary); + ib.set(ORG_ID, this.getOrg_id(), this.isset_org_id); + ib.set(DEPT_ID, this.getDept_id(), this.isset_dept_id); + ib.set(ORG_NAME, this.getOrg_name(), this.isset_org_name); + ib.set(DEPT_NAME, this.getDept_name(), this.isset_dept_name); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(MOBILE, this.getMobile(), this.isset_mobile); + ub.set(MOBILE_HISTORY, this.getMobile_history(), this.isset_mobile_history); + ub.set(CARD_NO, this.getCard_no(), this.isset_card_no); + ub.set(MAIL, this.getMail(), this.isset_mail); + ub.set(BIRTHDAY, this.getBirthday(), this.isset_birthday); + ub.set(SEX, this.getSex(), this.isset_sex); + ub.set(CARD_FRONT_IMG, this.getCard_front_img(), this.isset_card_front_img); + ub.set(CARD_BACK_IMG, this.getCard_back_img(), this.isset_card_back_img); + ub.set(FACE_IMG, this.getFace_img(), this.isset_face_img); + ub.set(NAME, this.getName(), this.isset_name); + ub.set(THIRD_ACCT, this.getThird_acct(), this.isset_third_acct); + ub.set(SUMMARY, this.getSummary(), this.isset_summary); + ub.set(ORG_ID, this.getOrg_id(), this.isset_org_id); + ub.set(DEPT_ID, this.getDept_id(), this.isset_dept_id); + ub.set(ORG_NAME, this.getOrg_name(), this.isset_org_name); + ub.set(DEPT_NAME, this.getDept_name(), this.isset_dept_name); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(MOBILE, this.getMobile(), this.isset_mobile); + ub.set(MOBILE_HISTORY, this.getMobile_history(), this.isset_mobile_history); + ub.set(CARD_NO, this.getCard_no(), this.isset_card_no); + ub.set(MAIL, this.getMail(), this.isset_mail); + ub.set(BIRTHDAY, this.getBirthday(), this.isset_birthday); + ub.set(SEX, this.getSex(), this.isset_sex); + ub.set(CARD_FRONT_IMG, this.getCard_front_img(), this.isset_card_front_img); + ub.set(CARD_BACK_IMG, this.getCard_back_img(), this.isset_card_back_img); + ub.set(FACE_IMG, this.getFace_img(), this.isset_face_img); + ub.set(NAME, this.getName(), this.isset_name); + ub.set(THIRD_ACCT, this.getThird_acct(), this.isset_third_acct); + ub.set(SUMMARY, this.getSummary(), this.isset_summary); + ub.set(ORG_ID, this.getOrg_id(), this.isset_org_id); + ub.set(DEPT_ID, this.getDept_id(), this.isset_dept_id); + ub.set(ORG_NAME, this.getOrg_name(), this.isset_org_name); + ub.set(DEPT_NAME, this.getDept_name(), this.isset_dept_name); + + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CREATE_TIME, this.getCreate_time(), this.isset_create_time); + ub.set(MOBILE, this.getMobile(), this.isset_mobile); + ub.set(MOBILE_HISTORY, this.getMobile_history(), this.isset_mobile_history); + ub.set(CARD_NO, this.getCard_no(), this.isset_card_no); + ub.set(MAIL, this.getMail(), this.isset_mail); + ub.set(BIRTHDAY, this.getBirthday(), this.isset_birthday); + ub.set(SEX, this.getSex(), this.isset_sex); + ub.set(CARD_FRONT_IMG, this.getCard_front_img(), this.isset_card_front_img); + ub.set(CARD_BACK_IMG, this.getCard_back_img(), this.isset_card_back_img); + ub.set(FACE_IMG, this.getFace_img(), this.isset_face_img); + ub.set(NAME, this.getName(), this.isset_name); + ub.set(THIRD_ACCT, this.getThird_acct(), this.isset_third_acct); + ub.set(SUMMARY, this.getSummary(), this.isset_summary); + ub.set(ORG_ID, this.getOrg_id(), this.isset_org_id); + ub.set(DEPT_ID, this.getDept_id(), this.isset_dept_id); + ub.set(ORG_NAME, this.getOrg_name(), this.isset_org_name); + ub.set(DEPT_NAME, this.getDept_name(), this.isset_dept_name); + + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select id, create_time, mobile, mobile_history, card_no, mail, birthday, sex, card_front_img, card_back_img, face_img, name, third_acct, summary, org_id, dept_id, org_name, dept_name from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select id, create_time, mobile, mobile_history, card_no, mail, birthday, sex, card_front_img, card_back_img, face_img, name, third_acct, summary, org_id, dept_id, org_name, dept_name from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public S_user_profile mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public S_user_profile toS_user_profile() { + return super.$clone(); + } +} + +/** + * s_user_profile RowMapper + * + * @author genrator + */ +class S_user_profileRowMapper implements RowMapper<S_user_profile> { + + @Override + public S_user_profile mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + S_user_profile s_user_profile = new S_user_profile(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, S_user_profile_mapper.ID); + if (columnIndex > 0) { + s_user_profile.setId(rs.getLong(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, S_user_profile_mapper.CREATE_TIME); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_profile.setCreate_time(null); + } else { + s_user_profile.setCreate_time(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_profile_mapper.MOBILE); + if (columnIndex > 0) { + s_user_profile.setMobile(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_user_profile_mapper.MOBILE_HISTORY); + if (columnIndex > 0) { + s_user_profile.setMobile_history(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_user_profile_mapper.CARD_NO); + if (columnIndex > 0) { + s_user_profile.setCard_no(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_user_profile_mapper.MAIL); + if (columnIndex > 0) { + s_user_profile.setMail(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_user_profile_mapper.BIRTHDAY); + if (columnIndex > 0) { + s_user_profile.setBirthday(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_user_profile_mapper.SEX); + if (columnIndex > 0) { + s_user_profile.setSex(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_user_profile_mapper.CARD_FRONT_IMG); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_profile.setCard_front_img(null); + } else { + s_user_profile.setCard_front_img(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_profile_mapper.CARD_BACK_IMG); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_profile.setCard_back_img(null); + } else { + s_user_profile.setCard_back_img(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_profile_mapper.FACE_IMG); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_profile.setFace_img(null); + } else { + s_user_profile.setFace_img(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_profile_mapper.NAME); + if (columnIndex > 0) { + s_user_profile.setName(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_user_profile_mapper.THIRD_ACCT); + if (columnIndex > 0) { + s_user_profile.setThird_acct(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_user_profile_mapper.SUMMARY); + if (columnIndex > 0) { + s_user_profile.setSummary(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_user_profile_mapper.ORG_ID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_profile.setOrg_id(null); + } else { + s_user_profile.setOrg_id(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_profile_mapper.DEPT_ID); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + s_user_profile.setDept_id(null); + } else { + s_user_profile.setDept_id(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, S_user_profile_mapper.ORG_NAME); + if (columnIndex > 0) { + s_user_profile.setOrg_name(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, S_user_profile_mapper.DEPT_NAME); + if (columnIndex > 0) { + s_user_profile.setDept_name(rs.getString(columnIndex)); + } + return s_user_profile; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/SfNotification.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/SfNotification.java new file mode 100644 index 0000000..5797f67 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/SfNotification.java @@ -0,0 +1,326 @@ + +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:SF_NOTIFICATION * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class SfNotification extends BasePo<SfNotification> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + // 涓婚敭 + private Long id = null; + @JsonIgnore + protected boolean isset_id = false; + + // 灞炴�у垪琛� + private String mark = null; + @JsonIgnore + protected boolean isset_mark = false; + + private String type = null; + @JsonIgnore + protected boolean isset_type = false; + + private String description = null; + @JsonIgnore + protected boolean isset_description = false; + + private Integer isWechat = null; + @JsonIgnore + protected boolean isset_isWechat = false; + + private Integer wechatId = null; + @JsonIgnore + protected boolean isset_wechatId = false; + + private Integer isRoutine = null; + @JsonIgnore + protected boolean isset_isRoutine = false; + + private Integer routineId = null; + @JsonIgnore + protected boolean isset_routineId = false; + + private Integer isSms = null; + @JsonIgnore + protected boolean isset_isSms = false; + + private Integer smsId = null; + @JsonIgnore + protected boolean isset_smsId = false; + + private Integer sendType = null; + @JsonIgnore + protected boolean isset_sendType = false; + + private Long createTime = null; + @JsonIgnore + protected boolean isset_createTime = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public SfNotification() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public SfNotification(Long id) { + this.setId(id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setId((Long) value); + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + this.isset_id = true; + } + + @JsonIgnore + public boolean isEmptyId() { + return this.id == null; + } + + public String getMark() { + return this.mark; + } + + public void setMark(String mark) { + this.mark = mark; + this.isset_mark = true; + } + + @JsonIgnore + public boolean isEmptyMark() { + return this.mark == null || this.mark.length() == 0; + } + + public String getType() { + return this.type; + } + + public void setType(String type) { + this.type = type; + this.isset_type = true; + } + + @JsonIgnore + public boolean isEmptyType() { + return this.type == null || this.type.length() == 0; + } + + public String getDescription() { + return this.description; + } + + public void setDescription(String description) { + this.description = description; + this.isset_description = true; + } + + @JsonIgnore + public boolean isEmptyDescription() { + return this.description == null || this.description.length() == 0; + } + + public Integer getIsWechat() { + return this.isWechat; + } + + public void setIsWechat(Integer isWechat) { + this.isWechat = isWechat; + this.isset_isWechat = true; + } + + @JsonIgnore + public boolean isEmptyIsWechat() { + return this.isWechat == null; + } + + public Integer getWechatId() { + return this.wechatId; + } + + public void setWechatId(Integer wechatId) { + this.wechatId = wechatId; + this.isset_wechatId = true; + } + + @JsonIgnore + public boolean isEmptyWechatId() { + return this.wechatId == null; + } + + public Integer getIsRoutine() { + return this.isRoutine; + } + + public void setIsRoutine(Integer isRoutine) { + this.isRoutine = isRoutine; + this.isset_isRoutine = true; + } + + @JsonIgnore + public boolean isEmptyIsRoutine() { + return this.isRoutine == null; + } + + public Integer getRoutineId() { + return this.routineId; + } + + public void setRoutineId(Integer routineId) { + this.routineId = routineId; + this.isset_routineId = true; + } + + @JsonIgnore + public boolean isEmptyRoutineId() { + return this.routineId == null; + } + + public Integer getIsSms() { + return this.isSms; + } + + public void setIsSms(Integer isSms) { + this.isSms = isSms; + this.isset_isSms = true; + } + + @JsonIgnore + public boolean isEmptyIsSms() { + return this.isSms == null; + } + + public Integer getSmsId() { + return this.smsId; + } + + public void setSmsId(Integer smsId) { + this.smsId = smsId; + this.isset_smsId = true; + } + + @JsonIgnore + public boolean isEmptySmsId() { + return this.smsId == null; + } + + public Integer getSendType() { + return this.sendType; + } + + public void setSendType(Integer sendType) { + this.sendType = sendType; + this.isset_sendType = true; + } + + @JsonIgnore + public boolean isEmptySendType() { + return this.sendType == null; + } + + public Long getCreateTime() { + return this.createTime; + } + + public void setCreateTime(Long createTime) { + this.createTime = createTime; + this.isset_createTime = true; + } + + @JsonIgnore + public boolean isEmptyCreateTime() { + return this.createTime == null; + } + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("id=").append(this.id) + .append("mark=").append(this.mark) + .append("type=").append(this.type) + .append("description=").append(this.description) + .append("isWechat=").append(this.isWechat) + .append("wechatId=").append(this.wechatId) + .append("isRoutine=").append(this.isRoutine) + .append("routineId=").append(this.routineId) + .append("isSms=").append(this.isSms) + .append("smsId=").append(this.smsId) + .append("sendType=").append(this.sendType) + .append("createTime=").append(this.createTime) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public SfNotification $clone() { + SfNotification sf_notification = new SfNotification(); + + // 鏁版嵁搴撳悕绉� + //sf_notification.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_id) { + sf_notification.setId(this.getId()); + } + // 鏅�氬睘鎬� + if (this.isset_mark) { + sf_notification.setMark(this.getMark()); + } + if (this.isset_type) { + sf_notification.setType(this.getType()); + } + if (this.isset_description) { + sf_notification.setDescription(this.getDescription()); + } + if (this.isset_isWechat) { + sf_notification.setIsWechat(this.getIsWechat()); + } + if (this.isset_wechatId) { + sf_notification.setWechatId(this.getWechatId()); + } + if (this.isset_isRoutine) { + sf_notification.setIsRoutine(this.getIsRoutine()); + } + if (this.isset_routineId) { + sf_notification.setRoutineId(this.getRoutineId()); + } + if (this.isset_isSms) { + sf_notification.setIsSms(this.getIsSms()); + } + if (this.isset_smsId) { + sf_notification.setSmsId(this.getSmsId()); + } + if (this.isset_sendType) { + sf_notification.setSendType(this.getSendType()); + } + if (this.isset_createTime) { + sf_notification.setCreateTime(this.getCreateTime()); + } + return sf_notification; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/SfNotification_mapper.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/SfNotification_mapper.java new file mode 100644 index 0000000..712bdd3 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/SfNotification_mapper.java @@ -0,0 +1,373 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:SF_NOTIFICATION * + * @author genrator + */ +public class SfNotification_mapper extends SfNotification implements BaseMapper<SfNotification> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<SfNotification> ROW_MAPPER = new SfNotificationRowMapper(); + + // 涓婚敭 + public static final String Id = "id"; + // 鏅�氬睘鎬� + public static final String Mark = "mark"; + public static final String Type = "type"; + public static final String Description = "description"; + public static final String IsWechat = "is_wechat"; + public static final String WechatId = "wechat_id"; + public static final String IsRoutine = "is_routine"; + public static final String RoutineId = "routine_id"; + public static final String IsSms = "is_sms"; + public static final String SmsId = "sms_id"; + public static final String SendType = "send_type"; + public static final String CreateTime = "create_time"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public SfNotification_mapper(SfNotification sfNotification) { + if (sfNotification == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (sfNotification.isset_id) { + this.setId(sfNotification.getId()); + } + //鏅�氬睘鎬� + if (sfNotification.isset_mark) { + this.setMark(sfNotification.getMark()); + } + if (sfNotification.isset_type) { + this.setType(sfNotification.getType()); + } + if (sfNotification.isset_description) { + this.setDescription(sfNotification.getDescription()); + } + if (sfNotification.isset_isWechat) { + this.setIsWechat(sfNotification.getIsWechat()); + } + if (sfNotification.isset_wechatId) { + this.setWechatId(sfNotification.getWechatId()); + } + if (sfNotification.isset_isRoutine) { + this.setIsRoutine(sfNotification.getIsRoutine()); + } + if (sfNotification.isset_routineId) { + this.setRoutineId(sfNotification.getRoutineId()); + } + if (sfNotification.isset_isSms) { + this.setIsSms(sfNotification.getIsSms()); + } + if (sfNotification.isset_smsId) { + this.setSmsId(sfNotification.getSmsId()); + } + if (sfNotification.isset_sendType) { + this.setSendType(sfNotification.getSendType()); + } + if (sfNotification.isset_createTime) { + this.setCreateTime(sfNotification.getCreateTime()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(sf_notification.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "sf_notification"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return Id; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getId(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(Id, this.getId()); + ib.set(Mark, this.getMark(), this.isset_mark); + ib.set(Type, this.getType(), this.isset_type); + ib.set(Description, this.getDescription(), this.isset_description); + ib.set(IsWechat, this.getIsWechat(), this.isset_isWechat); + ib.set(WechatId, this.getWechatId(), this.isset_wechatId); + ib.set(IsRoutine, this.getIsRoutine(), this.isset_isRoutine); + ib.set(RoutineId, this.getRoutineId(), this.isset_routineId); + ib.set(IsSms, this.getIsSms(), this.isset_isSms); + ib.set(SmsId, this.getSmsId(), this.isset_smsId); + ib.set(SendType, this.getSendType(), this.isset_sendType); + ib.set(CreateTime, this.getCreateTime(), this.isset_createTime); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(Mark, this.getMark(), this.isset_mark); + ub.set(Type, this.getType(), this.isset_type); + ub.set(Description, this.getDescription(), this.isset_description); + ub.set(IsWechat, this.getIsWechat(), this.isset_isWechat); + ub.set(WechatId, this.getWechatId(), this.isset_wechatId); + ub.set(IsRoutine, this.getIsRoutine(), this.isset_isRoutine); + ub.set(RoutineId, this.getRoutineId(), this.isset_routineId); + ub.set(IsSms, this.getIsSms(), this.isset_isSms); + ub.set(SmsId, this.getSmsId(), this.isset_smsId); + ub.set(SendType, this.getSendType(), this.isset_sendType); + ub.set(CreateTime, this.getCreateTime(), this.isset_createTime); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(Mark, this.getMark(), this.isset_mark); + ub.set(Type, this.getType(), this.isset_type); + ub.set(Description, this.getDescription(), this.isset_description); + ub.set(IsWechat, this.getIsWechat(), this.isset_isWechat); + ub.set(WechatId, this.getWechatId(), this.isset_wechatId); + ub.set(IsRoutine, this.getIsRoutine(), this.isset_isRoutine); + ub.set(RoutineId, this.getRoutineId(), this.isset_routineId); + ub.set(IsSms, this.getIsSms(), this.isset_isSms); + ub.set(SmsId, this.getSmsId(), this.isset_smsId); + ub.set(SendType, this.getSendType(), this.isset_sendType); + ub.set(CreateTime, this.getCreateTime(), this.isset_createTime); + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(Mark, this.getMark(), this.isset_mark); + ub.set(Type, this.getType(), this.isset_type); + ub.set(Description, this.getDescription(), this.isset_description); + ub.set(IsWechat, this.getIsWechat(), this.isset_isWechat); + ub.set(WechatId, this.getWechatId(), this.isset_wechatId); + ub.set(IsRoutine, this.getIsRoutine(), this.isset_isRoutine); + ub.set(RoutineId, this.getRoutineId(), this.isset_routineId); + ub.set(IsSms, this.getIsSms(), this.isset_isSms); + ub.set(SmsId, this.getSmsId(), this.isset_smsId); + ub.set(SendType, this.getSendType(), this.isset_sendType); + ub.set(CreateTime, this.getCreateTime(), this.isset_createTime); + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select id, mark, type, description, is_wechat, wechat_id, is_routine, routine_id, is_sms, sms_id, send_type, create_time from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select id, mark, type, description, is_wechat, wechat_id, is_routine, routine_id, is_sms, sms_id, send_type, create_time from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public SfNotification mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public SfNotification toSfNotification() { + return super.$clone(); + } +} + +/** + * sf_notification RowMapper + * + * @author genrator + */ +class SfNotificationRowMapper implements RowMapper<SfNotification> { + + @Override + public SfNotification mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + SfNotification sf_notification = new SfNotification(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, SfNotification_mapper.Id); + if (columnIndex > 0) { + sf_notification.setId(rs.getLong(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, SfNotification_mapper.Mark); + if (columnIndex > 0) { + sf_notification.setMark(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, SfNotification_mapper.Type); + if (columnIndex > 0) { + sf_notification.setType(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, SfNotification_mapper.Description); + if (columnIndex > 0) { + sf_notification.setDescription(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, SfNotification_mapper.IsWechat); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + sf_notification.setIsWechat(null); + } else { + sf_notification.setIsWechat(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, SfNotification_mapper.WechatId); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + sf_notification.setWechatId(null); + } else { + sf_notification.setWechatId(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, SfNotification_mapper.IsRoutine); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + sf_notification.setIsRoutine(null); + } else { + sf_notification.setIsRoutine(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, SfNotification_mapper.RoutineId); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + sf_notification.setRoutineId(null); + } else { + sf_notification.setRoutineId(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, SfNotification_mapper.IsSms); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + sf_notification.setIsSms(null); + } else { + sf_notification.setIsSms(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, SfNotification_mapper.SmsId); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + sf_notification.setSmsId(null); + } else { + sf_notification.setSmsId(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, SfNotification_mapper.SendType); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + sf_notification.setSendType(null); + } else { + sf_notification.setSendType(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, SfNotification_mapper.CreateTime); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + sf_notification.setCreateTime(null); + } else { + sf_notification.setCreateTime(rs.getLong(columnIndex)); + } + } + return sf_notification; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/SfTemplateMessage.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/SfTemplateMessage.java new file mode 100644 index 0000000..f355f2b --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/SfTemplateMessage.java @@ -0,0 +1,260 @@ + +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:SF_TEMPLATE_MESSAGE * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class SfTemplateMessage extends BasePo<SfTemplateMessage> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + // 涓婚敭 + private Long id = null; + @JsonIgnore + protected boolean isset_id = false; + + // 灞炴�у垪琛� + private Integer type = null; + @JsonIgnore + protected boolean isset_type = false; + + private String tempKey = null; + @JsonIgnore + protected boolean isset_tempKey = false; + + private String name = null; + @JsonIgnore + protected boolean isset_name = false; + + private String content = null; + @JsonIgnore + protected boolean isset_content = false; + + private String tempId = null; + @JsonIgnore + protected boolean isset_tempId = false; + + private Integer status = null; + @JsonIgnore + protected boolean isset_status = false; + + private Long createTime = null; + @JsonIgnore + protected boolean isset_createTime = false; + + private Long updateTime = null; + @JsonIgnore + protected boolean isset_updateTime = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public SfTemplateMessage() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public SfTemplateMessage(Long id) { + this.setId(id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setId((Long) value); + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + this.isset_id = true; + } + + @JsonIgnore + public boolean isEmptyId() { + return this.id == null; + } + + public Integer getType() { + return this.type; + } + + public void setType(Integer type) { + this.type = type; + this.isset_type = true; + } + + @JsonIgnore + public boolean isEmptyType() { + return this.type == null; + } + + public String getTempKey() { + return this.tempKey; + } + + public void setTempKey(String tempKey) { + this.tempKey = tempKey; + this.isset_tempKey = true; + } + + @JsonIgnore + public boolean isEmptyTempKey() { + return this.tempKey == null || this.tempKey.length() == 0; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + this.isset_name = true; + } + + @JsonIgnore + public boolean isEmptyName() { + return this.name == null || this.name.length() == 0; + } + + public String getContent() { + return this.content; + } + + public void setContent(String content) { + this.content = content; + this.isset_content = true; + } + + @JsonIgnore + public boolean isEmptyContent() { + return this.content == null || this.content.length() == 0; + } + + public String getTempId() { + return this.tempId; + } + + public void setTempId(String tempId) { + this.tempId = tempId; + this.isset_tempId = true; + } + + @JsonIgnore + public boolean isEmptyTempId() { + return this.tempId == null || this.tempId.length() == 0; + } + + public Integer getStatus() { + return this.status; + } + + public void setStatus(Integer status) { + this.status = status; + this.isset_status = true; + } + + @JsonIgnore + public boolean isEmptyStatus() { + return this.status == null; + } + + public Long getCreateTime() { + return this.createTime; + } + + public void setCreateTime(Long createTime) { + this.createTime = createTime; + this.isset_createTime = true; + } + + @JsonIgnore + public boolean isEmptyCreateTime() { + return this.createTime == null; + } + + public Long getUpdateTime() { + return this.updateTime; + } + + public void setUpdateTime(Long updateTime) { + this.updateTime = updateTime; + this.isset_updateTime = true; + } + + @JsonIgnore + public boolean isEmptyUpdateTime() { + return this.updateTime == null; + } + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("id=").append(this.id) + .append("type=").append(this.type) + .append("tempKey=").append(this.tempKey) + .append("name=").append(this.name) + .append("content=").append(this.content) + .append("tempId=").append(this.tempId) + .append("status=").append(this.status) + .append("createTime=").append(this.createTime) + .append("updateTime=").append(this.updateTime) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public SfTemplateMessage $clone() { + SfTemplateMessage sf_template_message = new SfTemplateMessage(); + + // 鏁版嵁搴撳悕绉� + //sf_template_message.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_id) { + sf_template_message.setId(this.getId()); + } + // 鏅�氬睘鎬� + if (this.isset_type) { + sf_template_message.setType(this.getType()); + } + if (this.isset_tempKey) { + sf_template_message.setTempKey(this.getTempKey()); + } + if (this.isset_name) { + sf_template_message.setName(this.getName()); + } + if (this.isset_content) { + sf_template_message.setContent(this.getContent()); + } + if (this.isset_tempId) { + sf_template_message.setTempId(this.getTempId()); + } + if (this.isset_status) { + sf_template_message.setStatus(this.getStatus()); + } + if (this.isset_createTime) { + sf_template_message.setCreateTime(this.getCreateTime()); + } + if (this.isset_updateTime) { + sf_template_message.setUpdateTime(this.getUpdateTime()); + } + return sf_template_message; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/SfTemplateMessage_mapper.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/SfTemplateMessage_mapper.java new file mode 100644 index 0000000..5251e50 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/SfTemplateMessage_mapper.java @@ -0,0 +1,321 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:SF_TEMPLATE_MESSAGE * + * @author genrator + */ +public class SfTemplateMessage_mapper extends SfTemplateMessage implements BaseMapper<SfTemplateMessage> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<SfTemplateMessage> ROW_MAPPER = new SfTemplateMessageRowMapper(); + + // 涓婚敭 + public static final String Id = "id"; + // 鏅�氬睘鎬� + public static final String Type = "type"; + public static final String TempKey = "temp_key"; + public static final String Name = "name"; + public static final String Content = "content"; + public static final String TempId = "temp_id"; + public static final String Status = "status"; + public static final String CreateTime = "create_time"; + public static final String UpdateTime = "update_time"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public SfTemplateMessage_mapper(SfTemplateMessage sfTemplateMessage) { + if (sfTemplateMessage == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (sfTemplateMessage.isset_id) { + this.setId(sfTemplateMessage.getId()); + } + //鏅�氬睘鎬� + if (sfTemplateMessage.isset_type) { + this.setType(sfTemplateMessage.getType()); + } + if (sfTemplateMessage.isset_tempKey) { + this.setTempKey(sfTemplateMessage.getTempKey()); + } + if (sfTemplateMessage.isset_name) { + this.setName(sfTemplateMessage.getName()); + } + if (sfTemplateMessage.isset_content) { + this.setContent(sfTemplateMessage.getContent()); + } + if (sfTemplateMessage.isset_tempId) { + this.setTempId(sfTemplateMessage.getTempId()); + } + if (sfTemplateMessage.isset_status) { + this.setStatus(sfTemplateMessage.getStatus()); + } + if (sfTemplateMessage.isset_createTime) { + this.setCreateTime(sfTemplateMessage.getCreateTime()); + } + if (sfTemplateMessage.isset_updateTime) { + this.setUpdateTime(sfTemplateMessage.getUpdateTime()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(sf_template_message.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "sf_template_message"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return Id; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getId(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(Id, this.getId()); + ib.set(Type, this.getType(), this.isset_type); + ib.set(TempKey, this.getTempKey(), this.isset_tempKey); + ib.set(Name, this.getName(), this.isset_name); + ib.set(Content, this.getContent(), this.isset_content); + ib.set(TempId, this.getTempId(), this.isset_tempId); + ib.set(Status, this.getStatus(), this.isset_status); + ib.set(CreateTime, this.getCreateTime(), this.isset_createTime); + ib.set(UpdateTime, this.getUpdateTime(), this.isset_updateTime); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(Type, this.getType(), this.isset_type); + ub.set(TempKey, this.getTempKey(), this.isset_tempKey); + ub.set(Name, this.getName(), this.isset_name); + ub.set(Content, this.getContent(), this.isset_content); + ub.set(TempId, this.getTempId(), this.isset_tempId); + ub.set(Status, this.getStatus(), this.isset_status); + ub.set(CreateTime, this.getCreateTime(), this.isset_createTime); + ub.set(UpdateTime, this.getUpdateTime(), this.isset_updateTime); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(Type, this.getType(), this.isset_type); + ub.set(TempKey, this.getTempKey(), this.isset_tempKey); + ub.set(Name, this.getName(), this.isset_name); + ub.set(Content, this.getContent(), this.isset_content); + ub.set(TempId, this.getTempId(), this.isset_tempId); + ub.set(Status, this.getStatus(), this.isset_status); + ub.set(CreateTime, this.getCreateTime(), this.isset_createTime); + ub.set(UpdateTime, this.getUpdateTime(), this.isset_updateTime); + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(Type, this.getType(), this.isset_type); + ub.set(TempKey, this.getTempKey(), this.isset_tempKey); + ub.set(Name, this.getName(), this.isset_name); + ub.set(Content, this.getContent(), this.isset_content); + ub.set(TempId, this.getTempId(), this.isset_tempId); + ub.set(Status, this.getStatus(), this.isset_status); + ub.set(CreateTime, this.getCreateTime(), this.isset_createTime); + ub.set(UpdateTime, this.getUpdateTime(), this.isset_updateTime); + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select id, type, temp_key, name, content, temp_id, status, create_time, update_time from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select id, type, temp_key, name, content, temp_id, status, create_time, update_time from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public SfTemplateMessage mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public SfTemplateMessage toSfTemplateMessage() { + return super.$clone(); + } +} + +/** + * sf_template_message RowMapper + * + * @author genrator + */ +class SfTemplateMessageRowMapper implements RowMapper<SfTemplateMessage> { + + @Override + public SfTemplateMessage mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + SfTemplateMessage sf_template_message = new SfTemplateMessage(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, SfTemplateMessage_mapper.Id); + if (columnIndex > 0) { + sf_template_message.setId(rs.getLong(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, SfTemplateMessage_mapper.Type); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + sf_template_message.setType(null); + } else { + sf_template_message.setType(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, SfTemplateMessage_mapper.TempKey); + if (columnIndex > 0) { + sf_template_message.setTempKey(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, SfTemplateMessage_mapper.Name); + if (columnIndex > 0) { + sf_template_message.setName(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, SfTemplateMessage_mapper.Content); + if (columnIndex > 0) { + sf_template_message.setContent(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, SfTemplateMessage_mapper.TempId); + if (columnIndex > 0) { + sf_template_message.setTempId(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, SfTemplateMessage_mapper.Status); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + sf_template_message.setStatus(null); + } else { + sf_template_message.setStatus(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, SfTemplateMessage_mapper.CreateTime); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + sf_template_message.setCreateTime(null); + } else { + sf_template_message.setCreateTime(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, SfTemplateMessage_mapper.UpdateTime); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + sf_template_message.setUpdateTime(null); + } else { + sf_template_message.setUpdateTime(rs.getLong(columnIndex)); + } + } + return sf_template_message; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/TcpEquip.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/TcpEquip.java new file mode 100644 index 0000000..3c292bb --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/TcpEquip.java @@ -0,0 +1,332 @@ + +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:TCP_EQUIP * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class TcpEquip extends BasePo<TcpEquip> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + /** + * 鐢ㄤ簬鍏煎鑰佸啓娉� + */ + @JsonIgnore + public static final TcpEquip ROW_MAPPER = new TcpEquip(); + + // 涓婚敭 + private Long id = null; + @JsonIgnore + protected boolean isset_id = false; + + // 灞炴�у垪琛� + private Long createTime = null; + @JsonIgnore + protected boolean isset_createTime = false; + + private Long dept = null; + @JsonIgnore + protected boolean isset_dept = false; + + private String num = null; + @JsonIgnore + protected boolean isset_num = false; + + private String name = null; + @JsonIgnore + protected boolean isset_name = false; + + private String typeCode = null; + @JsonIgnore + protected boolean isset_typeCode = false; + + private String summary = null; + @JsonIgnore + protected boolean isset_summary = false; + + private String vendor = null; + @JsonIgnore + protected boolean isset_vendor = false; + + private Integer status = null; + @JsonIgnore + protected boolean isset_status = false; + + private Long userId = null; + @JsonIgnore + protected boolean isset_userId = false; + + private Integer protocolResolver = null; + @JsonIgnore + protected boolean isset_protocolResolver = false; + + private Long bindUser = null; + @JsonIgnore + protected boolean isset_bindUser = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public TcpEquip() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public TcpEquip(Long id) { + this.setId(id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setId((Long) value); + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + this.isset_id = true; + } + + @JsonIgnore + public boolean isEmptyId() { + return this.id == null; + } + + public Long getCreateTime() { + return this.createTime; + } + + public void setCreateTime(Long createTime) { + this.createTime = createTime; + this.isset_createTime = true; + } + + @JsonIgnore + public boolean isEmptyCreateTime() { + return this.createTime == null; + } + + public Long getDept() { + return this.dept; + } + + public void setDept(Long dept) { + this.dept = dept; + this.isset_dept = true; + } + + @JsonIgnore + public boolean isEmptyDept() { + return this.dept == null; + } + + public String getNum() { + return this.num; + } + + public void setNum(String num) { + this.num = num; + this.isset_num = true; + } + + @JsonIgnore + public boolean isEmptyNum() { + return this.num == null || this.num.length() == 0; + } + + public String getName() { + return this.name; + } + + public void setName(String name) { + this.name = name; + this.isset_name = true; + } + + @JsonIgnore + public boolean isEmptyName() { + return this.name == null || this.name.length() == 0; + } + + public String getTypeCode() { + return this.typeCode; + } + + public void setTypeCode(String typeCode) { + this.typeCode = typeCode; + this.isset_typeCode = true; + } + + @JsonIgnore + public boolean isEmptyTypeCode() { + return this.typeCode == null || this.typeCode.length() == 0; + } + + public String getSummary() { + return this.summary; + } + + public void setSummary(String summary) { + this.summary = summary; + this.isset_summary = true; + } + + @JsonIgnore + public boolean isEmptySummary() { + return this.summary == null || this.summary.length() == 0; + } + + public String getVendor() { + return this.vendor; + } + + public void setVendor(String vendor) { + this.vendor = vendor; + this.isset_vendor = true; + } + + @JsonIgnore + public boolean isEmptyVendor() { + return this.vendor == null || this.vendor.length() == 0; + } + + public Integer getStatus() { + return this.status; + } + + public void setStatus(Integer status) { + this.status = status; + this.isset_status = true; + } + + @JsonIgnore + public boolean isEmptyStatus() { + return this.status == null; + } + + public Long getUserId() { + return this.userId; + } + + public void setUserId(Long userId) { + this.userId = userId; + this.isset_userId = true; + } + + @JsonIgnore + public boolean isEmptyUserId() { + return this.userId == null; + } + + public Integer getProtocolResolver() { + return this.protocolResolver; + } + + public void setProtocolResolver(Integer protocolResolver) { + this.protocolResolver = protocolResolver; + this.isset_protocolResolver = true; + } + + @JsonIgnore + public boolean isEmptyProtocolResolver() { + return this.protocolResolver == null; + } + + public Long getBindUser() { + return this.bindUser; + } + + public void setBindUser(Long bindUser) { + this.bindUser = bindUser; + this.isset_bindUser = true; + } + + @JsonIgnore + public boolean isEmptyBindUser() { + return this.bindUser == null; + } + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("id=").append(this.id) + .append("createTime=").append(this.createTime) + .append("dept=").append(this.dept) + .append("num=").append(this.num) + .append("name=").append(this.name) + .append("typeCode=").append(this.typeCode) + .append("summary=").append(this.summary) + .append("vendor=").append(this.vendor) + .append("status=").append(this.status) + .append("userId=").append(this.userId) + .append("protocolResolver=").append(this.protocolResolver) + .append("bindUser=").append(this.bindUser) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public TcpEquip $clone() { + TcpEquip tcp_equip = new TcpEquip(); + + // 鏁版嵁搴撳悕绉� + //tcp_equip.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_id) { + tcp_equip.setId(this.getId()); + } + // 鏅�氬睘鎬� + if (this.isset_createTime) { + tcp_equip.setCreateTime(this.getCreateTime()); + } + if (this.isset_dept) { + tcp_equip.setDept(this.getDept()); + } + if (this.isset_num) { + tcp_equip.setNum(this.getNum()); + } + if (this.isset_name) { + tcp_equip.setName(this.getName()); + } + if (this.isset_typeCode) { + tcp_equip.setTypeCode(this.getTypeCode()); + } + if (this.isset_summary) { + tcp_equip.setSummary(this.getSummary()); + } + if (this.isset_vendor) { + tcp_equip.setVendor(this.getVendor()); + } + if (this.isset_status) { + tcp_equip.setStatus(this.getStatus()); + } + if (this.isset_userId) { + tcp_equip.setUserId(this.getUserId()); + } + if (this.isset_protocolResolver) { + tcp_equip.setProtocolResolver(this.getProtocolResolver()); + } + if (this.isset_bindUser) { + tcp_equip.setBindUser(this.getBindUser()); + } + return tcp_equip; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/TcpEquipHistory.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/TcpEquipHistory.java new file mode 100644 index 0000000..ea42b27 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/TcpEquipHistory.java @@ -0,0 +1,332 @@ + +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:TCP_EQUIP_HISTORY * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class TcpEquipHistory extends BasePo<TcpEquipHistory> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + /** + * 鐢ㄤ簬鍏煎鑰佸啓娉� + */ + @JsonIgnore + public static final TcpEquipHistory ROW_MAPPER = new TcpEquipHistory(); + + // 涓婚敭 + private Long id = null; + @JsonIgnore + protected boolean isset_id = false; + + // 灞炴�у垪琛� + private Long createTime = null; + @JsonIgnore + protected boolean isset_createTime = false; + + private Long equipId = null; + @JsonIgnore + protected boolean isset_equipId = false; + + private Long startTime = null; + @JsonIgnore + protected boolean isset_startTime = false; + + private Long endTime = null; + @JsonIgnore + protected boolean isset_endTime = false; + + private Long dataRec = null; + @JsonIgnore + protected boolean isset_dataRec = false; + + private Long dataRecTotal = null; + @JsonIgnore + protected boolean isset_dataRecTotal = false; + + private Long dataSend = null; + @JsonIgnore + protected boolean isset_dataSend = false; + + private Long dataSendTotal = null; + @JsonIgnore + protected boolean isset_dataSendTotal = false; + + private Integer year = null; + @JsonIgnore + protected boolean isset_year = false; + + private Integer dept = null; + @JsonIgnore + protected boolean isset_dept = false; + + private String equipNum = null; + @JsonIgnore + protected boolean isset_equipNum = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public TcpEquipHistory() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public TcpEquipHistory(Long id) { + this.setId(id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setId((Long) value); + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + this.isset_id = true; + } + + @JsonIgnore + public boolean isEmptyId() { + return this.id == null; + } + + public Long getCreateTime() { + return this.createTime; + } + + public void setCreateTime(Long createTime) { + this.createTime = createTime; + this.isset_createTime = true; + } + + @JsonIgnore + public boolean isEmptyCreateTime() { + return this.createTime == null; + } + + public Long getEquipId() { + return this.equipId; + } + + public void setEquipId(Long equipId) { + this.equipId = equipId; + this.isset_equipId = true; + } + + @JsonIgnore + public boolean isEmptyEquipId() { + return this.equipId == null; + } + + public Long getStartTime() { + return this.startTime; + } + + public void setStartTime(Long startTime) { + this.startTime = startTime; + this.isset_startTime = true; + } + + @JsonIgnore + public boolean isEmptyStartTime() { + return this.startTime == null; + } + + public Long getEndTime() { + return this.endTime; + } + + public void setEndTime(Long endTime) { + this.endTime = endTime; + this.isset_endTime = true; + } + + @JsonIgnore + public boolean isEmptyEndTime() { + return this.endTime == null; + } + + public Long getDataRec() { + return this.dataRec; + } + + public void setDataRec(Long dataRec) { + this.dataRec = dataRec; + this.isset_dataRec = true; + } + + @JsonIgnore + public boolean isEmptyDataRec() { + return this.dataRec == null; + } + + public Long getDataRecTotal() { + return this.dataRecTotal; + } + + public void setDataRecTotal(Long dataRecTotal) { + this.dataRecTotal = dataRecTotal; + this.isset_dataRecTotal = true; + } + + @JsonIgnore + public boolean isEmptyDataRecTotal() { + return this.dataRecTotal == null; + } + + public Long getDataSend() { + return this.dataSend; + } + + public void setDataSend(Long dataSend) { + this.dataSend = dataSend; + this.isset_dataSend = true; + } + + @JsonIgnore + public boolean isEmptyDataSend() { + return this.dataSend == null; + } + + public Long getDataSendTotal() { + return this.dataSendTotal; + } + + public void setDataSendTotal(Long dataSendTotal) { + this.dataSendTotal = dataSendTotal; + this.isset_dataSendTotal = true; + } + + @JsonIgnore + public boolean isEmptyDataSendTotal() { + return this.dataSendTotal == null; + } + + public Integer getYear() { + return this.year; + } + + public void setYear(Integer year) { + this.year = year; + this.isset_year = true; + } + + @JsonIgnore + public boolean isEmptyYear() { + return this.year == null; + } + + public Integer getDept() { + return this.dept; + } + + public void setDept(Integer dept) { + this.dept = dept; + this.isset_dept = true; + } + + @JsonIgnore + public boolean isEmptyDept() { + return this.dept == null; + } + + public String getEquipNum() { + return this.equipNum; + } + + public void setEquipNum(String equipNum) { + this.equipNum = equipNum; + this.isset_equipNum = true; + } + + @JsonIgnore + public boolean isEmptyEquipNum() { + return this.equipNum == null || this.equipNum.length() == 0; + } + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("id=").append(this.id) + .append("createTime=").append(this.createTime) + .append("equipId=").append(this.equipId) + .append("startTime=").append(this.startTime) + .append("endTime=").append(this.endTime) + .append("dataRec=").append(this.dataRec) + .append("dataRecTotal=").append(this.dataRecTotal) + .append("dataSend=").append(this.dataSend) + .append("dataSendTotal=").append(this.dataSendTotal) + .append("year=").append(this.year) + .append("dept=").append(this.dept) + .append("equipNum=").append(this.equipNum) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public TcpEquipHistory $clone() { + TcpEquipHistory tcp_equip_history = new TcpEquipHistory(); + + // 鏁版嵁搴撳悕绉� + //tcp_equip_history.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_id) { + tcp_equip_history.setId(this.getId()); + } + // 鏅�氬睘鎬� + if (this.isset_createTime) { + tcp_equip_history.setCreateTime(this.getCreateTime()); + } + if (this.isset_equipId) { + tcp_equip_history.setEquipId(this.getEquipId()); + } + if (this.isset_startTime) { + tcp_equip_history.setStartTime(this.getStartTime()); + } + if (this.isset_endTime) { + tcp_equip_history.setEndTime(this.getEndTime()); + } + if (this.isset_dataRec) { + tcp_equip_history.setDataRec(this.getDataRec()); + } + if (this.isset_dataRecTotal) { + tcp_equip_history.setDataRecTotal(this.getDataRecTotal()); + } + if (this.isset_dataSend) { + tcp_equip_history.setDataSend(this.getDataSend()); + } + if (this.isset_dataSendTotal) { + tcp_equip_history.setDataSendTotal(this.getDataSendTotal()); + } + if (this.isset_year) { + tcp_equip_history.setYear(this.getYear()); + } + if (this.isset_dept) { + tcp_equip_history.setDept(this.getDept()); + } + if (this.isset_equipNum) { + tcp_equip_history.setEquipNum(this.getEquipNum()); + } + return tcp_equip_history; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/TcpEquipHistory_mapper.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/TcpEquipHistory_mapper.java new file mode 100644 index 0000000..5ded9a7 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/TcpEquipHistory_mapper.java @@ -0,0 +1,381 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:TCP_EQUIP_HISTORY * + * @author genrator + */ +public class TcpEquipHistory_mapper extends TcpEquipHistory implements BaseMapper<TcpEquipHistory> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<TcpEquipHistory> ROW_MAPPER = new TcpEquipHistoryRowMapper(); + + // 涓婚敭 + public static final String Id = "id"; + // 鏅�氬睘鎬� + public static final String CreateTime = "create_time"; + public static final String EquipId = "equip_id"; + public static final String StartTime = "start_time"; + public static final String EndTime = "end_time"; + public static final String DataRec = "data_rec"; + public static final String DataRecTotal = "data_rec_total"; + public static final String DataSend = "data_send"; + public static final String DataSendTotal = "data_send_total"; + public static final String Year = "year"; + public static final String Dept = "dept"; + public static final String EquipNum = "equip_num"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public TcpEquipHistory_mapper(TcpEquipHistory tcpEquipHistory) { + if (tcpEquipHistory == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (tcpEquipHistory.isset_id) { + this.setId(tcpEquipHistory.getId()); + } + //鏅�氬睘鎬� + if (tcpEquipHistory.isset_createTime) { + this.setCreateTime(tcpEquipHistory.getCreateTime()); + } + if (tcpEquipHistory.isset_equipId) { + this.setEquipId(tcpEquipHistory.getEquipId()); + } + if (tcpEquipHistory.isset_startTime) { + this.setStartTime(tcpEquipHistory.getStartTime()); + } + if (tcpEquipHistory.isset_endTime) { + this.setEndTime(tcpEquipHistory.getEndTime()); + } + if (tcpEquipHistory.isset_dataRec) { + this.setDataRec(tcpEquipHistory.getDataRec()); + } + if (tcpEquipHistory.isset_dataRecTotal) { + this.setDataRecTotal(tcpEquipHistory.getDataRecTotal()); + } + if (tcpEquipHistory.isset_dataSend) { + this.setDataSend(tcpEquipHistory.getDataSend()); + } + if (tcpEquipHistory.isset_dataSendTotal) { + this.setDataSendTotal(tcpEquipHistory.getDataSendTotal()); + } + if (tcpEquipHistory.isset_year) { + this.setYear(tcpEquipHistory.getYear()); + } + if (tcpEquipHistory.isset_dept) { + this.setDept(tcpEquipHistory.getDept()); + } + if (tcpEquipHistory.isset_equipNum) { + this.setEquipNum(tcpEquipHistory.getEquipNum()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(tcp_equip_history.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "tcp_equip_history"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return Id; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getId(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(Id, this.getId()); + ib.set(CreateTime, this.getCreateTime(), this.isset_createTime); + ib.set(EquipId, this.getEquipId(), this.isset_equipId); + ib.set(StartTime, this.getStartTime(), this.isset_startTime); + ib.set(EndTime, this.getEndTime(), this.isset_endTime); + ib.set(DataRec, this.getDataRec(), this.isset_dataRec); + ib.set(DataRecTotal, this.getDataRecTotal(), this.isset_dataRecTotal); + ib.set(DataSend, this.getDataSend(), this.isset_dataSend); + ib.set(DataSendTotal, this.getDataSendTotal(), this.isset_dataSendTotal); + ib.set(Year, this.getYear(), this.isset_year); + ib.set(Dept, this.getDept(), this.isset_dept); + ib.set(EquipNum, this.getEquipNum(), this.isset_equipNum); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CreateTime, this.getCreateTime(), this.isset_createTime); + ub.set(EquipId, this.getEquipId(), this.isset_equipId); + ub.set(StartTime, this.getStartTime(), this.isset_startTime); + ub.set(EndTime, this.getEndTime(), this.isset_endTime); + ub.set(DataRec, this.getDataRec(), this.isset_dataRec); + ub.set(DataRecTotal, this.getDataRecTotal(), this.isset_dataRecTotal); + ub.set(DataSend, this.getDataSend(), this.isset_dataSend); + ub.set(DataSendTotal, this.getDataSendTotal(), this.isset_dataSendTotal); + ub.set(Year, this.getYear(), this.isset_year); + ub.set(Dept, this.getDept(), this.isset_dept); + ub.set(EquipNum, this.getEquipNum(), this.isset_equipNum); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CreateTime, this.getCreateTime(), this.isset_createTime); + ub.set(EquipId, this.getEquipId(), this.isset_equipId); + ub.set(StartTime, this.getStartTime(), this.isset_startTime); + ub.set(EndTime, this.getEndTime(), this.isset_endTime); + ub.set(DataRec, this.getDataRec(), this.isset_dataRec); + ub.set(DataRecTotal, this.getDataRecTotal(), this.isset_dataRecTotal); + ub.set(DataSend, this.getDataSend(), this.isset_dataSend); + ub.set(DataSendTotal, this.getDataSendTotal(), this.isset_dataSendTotal); + ub.set(Year, this.getYear(), this.isset_year); + ub.set(Dept, this.getDept(), this.isset_dept); + ub.set(EquipNum, this.getEquipNum(), this.isset_equipNum); + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CreateTime, this.getCreateTime(), this.isset_createTime); + ub.set(EquipId, this.getEquipId(), this.isset_equipId); + ub.set(StartTime, this.getStartTime(), this.isset_startTime); + ub.set(EndTime, this.getEndTime(), this.isset_endTime); + ub.set(DataRec, this.getDataRec(), this.isset_dataRec); + ub.set(DataRecTotal, this.getDataRecTotal(), this.isset_dataRecTotal); + ub.set(DataSend, this.getDataSend(), this.isset_dataSend); + ub.set(DataSendTotal, this.getDataSendTotal(), this.isset_dataSendTotal); + ub.set(Year, this.getYear(), this.isset_year); + ub.set(Dept, this.getDept(), this.isset_dept); + ub.set(EquipNum, this.getEquipNum(), this.isset_equipNum); + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select id, create_time, equip_id, start_time, end_time, data_rec, data_rec_total, data_send, data_send_total, year, dept, equip_num from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select id, create_time, equip_id, start_time, end_time, data_rec, data_rec_total, data_send, data_send_total, year, dept, equip_num from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public TcpEquipHistory mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public TcpEquipHistory toTcpEquipHistory() { + return super.$clone(); + } +} + +/** + * tcp_equip_history RowMapper + * + * @author genrator + */ +class TcpEquipHistoryRowMapper implements RowMapper<TcpEquipHistory> { + + @Override + public TcpEquipHistory mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + TcpEquipHistory tcp_equip_history = new TcpEquipHistory(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, TcpEquipHistory_mapper.Id); + if (columnIndex > 0) { + tcp_equip_history.setId(rs.getLong(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, TcpEquipHistory_mapper.CreateTime); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + tcp_equip_history.setCreateTime(null); + } else { + tcp_equip_history.setCreateTime(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquipHistory_mapper.EquipId); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + tcp_equip_history.setEquipId(null); + } else { + tcp_equip_history.setEquipId(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquipHistory_mapper.StartTime); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + tcp_equip_history.setStartTime(null); + } else { + tcp_equip_history.setStartTime(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquipHistory_mapper.EndTime); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + tcp_equip_history.setEndTime(null); + } else { + tcp_equip_history.setEndTime(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquipHistory_mapper.DataRec); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + tcp_equip_history.setDataRec(null); + } else { + tcp_equip_history.setDataRec(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquipHistory_mapper.DataRecTotal); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + tcp_equip_history.setDataRecTotal(null); + } else { + tcp_equip_history.setDataRecTotal(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquipHistory_mapper.DataSend); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + tcp_equip_history.setDataSend(null); + } else { + tcp_equip_history.setDataSend(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquipHistory_mapper.DataSendTotal); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + tcp_equip_history.setDataSendTotal(null); + } else { + tcp_equip_history.setDataSendTotal(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquipHistory_mapper.Year); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + tcp_equip_history.setYear(null); + } else { + tcp_equip_history.setYear(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquipHistory_mapper.Dept); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + tcp_equip_history.setDept(null); + } else { + tcp_equip_history.setDept(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquipHistory_mapper.EquipNum); + if (columnIndex > 0) { + tcp_equip_history.setEquipNum(rs.getString(columnIndex)); + } + return tcp_equip_history; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/TcpEquipStatus.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/TcpEquipStatus.java new file mode 100644 index 0000000..46edf19 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/TcpEquipStatus.java @@ -0,0 +1,332 @@ + +package com.iplatform.model.po; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.walker.jdbc.BasePo; + +/** + * 琛ㄥ悕:TCP_EQUIP_STATUS * + * @author genrator + */ +@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY) +public class TcpEquipStatus extends BasePo<TcpEquipStatus> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + /** + * 鐢ㄤ簬鍏煎鑰佸啓娉� + */ + @JsonIgnore + public static final TcpEquipStatus ROW_MAPPER = new TcpEquipStatus(); + + // 涓婚敭 + private Long id = null; + @JsonIgnore + protected boolean isset_id = false; + + // 灞炴�у垪琛� + private Long createTime = null; + @JsonIgnore + protected boolean isset_createTime = false; + + private Long equipId = null; + @JsonIgnore + protected boolean isset_equipId = false; + + private Integer liveStatus = null; + @JsonIgnore + protected boolean isset_liveStatus = false; + + private Long startTime = null; + @JsonIgnore + protected boolean isset_startTime = false; + + private Long endTime = null; + @JsonIgnore + protected boolean isset_endTime = false; + + private Long dataRec = null; + @JsonIgnore + protected boolean isset_dataRec = false; + + private Long dataRecTotal = null; + @JsonIgnore + protected boolean isset_dataRecTotal = false; + + private Long dataSend = null; + @JsonIgnore + protected boolean isset_dataSend = false; + + private Long dataSendTotal = null; + @JsonIgnore + protected boolean isset_dataSendTotal = false; + + private Long dept = null; + @JsonIgnore + protected boolean isset_dept = false; + + private String equipNum = null; + @JsonIgnore + protected boolean isset_equipNum = false; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public TcpEquipStatus() { + } + + /** + * 鏍规嵁涓婚敭鏋勯�犲璞� + */ + public TcpEquipStatus(Long id) { + this.setId(id); + } + + /** + * 璁剧疆涓婚敭鍊� + */ + @Override + public void setPkValue(Object value) { + this.setId((Long) value); + } + + public Long getId() { + return this.id; + } + + public void setId(Long id) { + this.id = id; + this.isset_id = true; + } + + @JsonIgnore + public boolean isEmptyId() { + return this.id == null; + } + + public Long getCreateTime() { + return this.createTime; + } + + public void setCreateTime(Long createTime) { + this.createTime = createTime; + this.isset_createTime = true; + } + + @JsonIgnore + public boolean isEmptyCreateTime() { + return this.createTime == null; + } + + public Long getEquipId() { + return this.equipId; + } + + public void setEquipId(Long equipId) { + this.equipId = equipId; + this.isset_equipId = true; + } + + @JsonIgnore + public boolean isEmptyEquipId() { + return this.equipId == null; + } + + public Integer getLiveStatus() { + return this.liveStatus; + } + + public void setLiveStatus(Integer liveStatus) { + this.liveStatus = liveStatus; + this.isset_liveStatus = true; + } + + @JsonIgnore + public boolean isEmptyLiveStatus() { + return this.liveStatus == null; + } + + public Long getStartTime() { + return this.startTime; + } + + public void setStartTime(Long startTime) { + this.startTime = startTime; + this.isset_startTime = true; + } + + @JsonIgnore + public boolean isEmptyStartTime() { + return this.startTime == null; + } + + public Long getEndTime() { + return this.endTime; + } + + public void setEndTime(Long endTime) { + this.endTime = endTime; + this.isset_endTime = true; + } + + @JsonIgnore + public boolean isEmptyEndTime() { + return this.endTime == null; + } + + public Long getDataRec() { + return this.dataRec; + } + + public void setDataRec(Long dataRec) { + this.dataRec = dataRec; + this.isset_dataRec = true; + } + + @JsonIgnore + public boolean isEmptyDataRec() { + return this.dataRec == null; + } + + public Long getDataRecTotal() { + return this.dataRecTotal; + } + + public void setDataRecTotal(Long dataRecTotal) { + this.dataRecTotal = dataRecTotal; + this.isset_dataRecTotal = true; + } + + @JsonIgnore + public boolean isEmptyDataRecTotal() { + return this.dataRecTotal == null; + } + + public Long getDataSend() { + return this.dataSend; + } + + public void setDataSend(Long dataSend) { + this.dataSend = dataSend; + this.isset_dataSend = true; + } + + @JsonIgnore + public boolean isEmptyDataSend() { + return this.dataSend == null; + } + + public Long getDataSendTotal() { + return this.dataSendTotal; + } + + public void setDataSendTotal(Long dataSendTotal) { + this.dataSendTotal = dataSendTotal; + this.isset_dataSendTotal = true; + } + + @JsonIgnore + public boolean isEmptyDataSendTotal() { + return this.dataSendTotal == null; + } + + public Long getDept() { + return this.dept; + } + + public void setDept(Long dept) { + this.dept = dept; + this.isset_dept = true; + } + + @JsonIgnore + public boolean isEmptyDept() { + return this.dept == null; + } + + public String getEquipNum() { + return this.equipNum; + } + + public void setEquipNum(String equipNum) { + this.equipNum = equipNum; + this.isset_equipNum = true; + } + + @JsonIgnore + public boolean isEmptyEquipNum() { + return this.equipNum == null || this.equipNum.length() == 0; + } + + /** + * 閲嶅啓 toString() 鏂规硶 + */ + @Override + public String toString() { + return new StringBuilder() + .append("id=").append(this.id) + .append("createTime=").append(this.createTime) + .append("equipId=").append(this.equipId) + .append("liveStatus=").append(this.liveStatus) + .append("startTime=").append(this.startTime) + .append("endTime=").append(this.endTime) + .append("dataRec=").append(this.dataRec) + .append("dataRecTotal=").append(this.dataRecTotal) + .append("dataSend=").append(this.dataSend) + .append("dataSendTotal=").append(this.dataSendTotal) + .append("dept=").append(this.dept) + .append("equipNum=").append(this.equipNum) + .toString(); + } + + /** + * 鍏嬮殕 + */ + public TcpEquipStatus $clone() { + TcpEquipStatus tcp_equip_status = new TcpEquipStatus(); + + // 鏁版嵁搴撳悕绉� + //tcp_equip_status.setDatabaseName_(this.getDatabaseName_()); + + // 涓婚敭 + if (this.isset_id) { + tcp_equip_status.setId(this.getId()); + } + // 鏅�氬睘鎬� + if (this.isset_createTime) { + tcp_equip_status.setCreateTime(this.getCreateTime()); + } + if (this.isset_equipId) { + tcp_equip_status.setEquipId(this.getEquipId()); + } + if (this.isset_liveStatus) { + tcp_equip_status.setLiveStatus(this.getLiveStatus()); + } + if (this.isset_startTime) { + tcp_equip_status.setStartTime(this.getStartTime()); + } + if (this.isset_endTime) { + tcp_equip_status.setEndTime(this.getEndTime()); + } + if (this.isset_dataRec) { + tcp_equip_status.setDataRec(this.getDataRec()); + } + if (this.isset_dataRecTotal) { + tcp_equip_status.setDataRecTotal(this.getDataRecTotal()); + } + if (this.isset_dataSend) { + tcp_equip_status.setDataSend(this.getDataSend()); + } + if (this.isset_dataSendTotal) { + tcp_equip_status.setDataSendTotal(this.getDataSendTotal()); + } + if (this.isset_dept) { + tcp_equip_status.setDept(this.getDept()); + } + if (this.isset_equipNum) { + tcp_equip_status.setEquipNum(this.getEquipNum()); + } + return tcp_equip_status; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/TcpEquipStatus_mapper.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/TcpEquipStatus_mapper.java new file mode 100644 index 0000000..4980c46 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/TcpEquipStatus_mapper.java @@ -0,0 +1,381 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:TCP_EQUIP_STATUS * + * @author genrator + */ +public class TcpEquipStatus_mapper extends TcpEquipStatus implements BaseMapper<TcpEquipStatus> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<TcpEquipStatus> ROW_MAPPER = new TcpEquipStatusRowMapper(); + + // 涓婚敭 + public static final String Id = "id"; + // 鏅�氬睘鎬� + public static final String CreateTime = "create_time"; + public static final String EquipId = "equip_id"; + public static final String LiveStatus = "live_status"; + public static final String StartTime = "start_time"; + public static final String EndTime = "end_time"; + public static final String DataRec = "data_rec"; + public static final String DataRecTotal = "data_rec_total"; + public static final String DataSend = "data_send"; + public static final String DataSendTotal = "data_send_total"; + public static final String Dept = "dept"; + public static final String EquipNum = "equip_num"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public TcpEquipStatus_mapper(TcpEquipStatus tcpEquipStatus) { + if (tcpEquipStatus == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (tcpEquipStatus.isset_id) { + this.setId(tcpEquipStatus.getId()); + } + //鏅�氬睘鎬� + if (tcpEquipStatus.isset_createTime) { + this.setCreateTime(tcpEquipStatus.getCreateTime()); + } + if (tcpEquipStatus.isset_equipId) { + this.setEquipId(tcpEquipStatus.getEquipId()); + } + if (tcpEquipStatus.isset_liveStatus) { + this.setLiveStatus(tcpEquipStatus.getLiveStatus()); + } + if (tcpEquipStatus.isset_startTime) { + this.setStartTime(tcpEquipStatus.getStartTime()); + } + if (tcpEquipStatus.isset_endTime) { + this.setEndTime(tcpEquipStatus.getEndTime()); + } + if (tcpEquipStatus.isset_dataRec) { + this.setDataRec(tcpEquipStatus.getDataRec()); + } + if (tcpEquipStatus.isset_dataRecTotal) { + this.setDataRecTotal(tcpEquipStatus.getDataRecTotal()); + } + if (tcpEquipStatus.isset_dataSend) { + this.setDataSend(tcpEquipStatus.getDataSend()); + } + if (tcpEquipStatus.isset_dataSendTotal) { + this.setDataSendTotal(tcpEquipStatus.getDataSendTotal()); + } + if (tcpEquipStatus.isset_dept) { + this.setDept(tcpEquipStatus.getDept()); + } + if (tcpEquipStatus.isset_equipNum) { + this.setEquipNum(tcpEquipStatus.getEquipNum()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(tcp_equip_status.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "tcp_equip_status"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return Id; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getId(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(Id, this.getId()); + ib.set(CreateTime, this.getCreateTime(), this.isset_createTime); + ib.set(EquipId, this.getEquipId(), this.isset_equipId); + ib.set(LiveStatus, this.getLiveStatus(), this.isset_liveStatus); + ib.set(StartTime, this.getStartTime(), this.isset_startTime); + ib.set(EndTime, this.getEndTime(), this.isset_endTime); + ib.set(DataRec, this.getDataRec(), this.isset_dataRec); + ib.set(DataRecTotal, this.getDataRecTotal(), this.isset_dataRecTotal); + ib.set(DataSend, this.getDataSend(), this.isset_dataSend); + ib.set(DataSendTotal, this.getDataSendTotal(), this.isset_dataSendTotal); + ib.set(Dept, this.getDept(), this.isset_dept); + ib.set(EquipNum, this.getEquipNum(), this.isset_equipNum); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CreateTime, this.getCreateTime(), this.isset_createTime); + ub.set(EquipId, this.getEquipId(), this.isset_equipId); + ub.set(LiveStatus, this.getLiveStatus(), this.isset_liveStatus); + ub.set(StartTime, this.getStartTime(), this.isset_startTime); + ub.set(EndTime, this.getEndTime(), this.isset_endTime); + ub.set(DataRec, this.getDataRec(), this.isset_dataRec); + ub.set(DataRecTotal, this.getDataRecTotal(), this.isset_dataRecTotal); + ub.set(DataSend, this.getDataSend(), this.isset_dataSend); + ub.set(DataSendTotal, this.getDataSendTotal(), this.isset_dataSendTotal); + ub.set(Dept, this.getDept(), this.isset_dept); + ub.set(EquipNum, this.getEquipNum(), this.isset_equipNum); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CreateTime, this.getCreateTime(), this.isset_createTime); + ub.set(EquipId, this.getEquipId(), this.isset_equipId); + ub.set(LiveStatus, this.getLiveStatus(), this.isset_liveStatus); + ub.set(StartTime, this.getStartTime(), this.isset_startTime); + ub.set(EndTime, this.getEndTime(), this.isset_endTime); + ub.set(DataRec, this.getDataRec(), this.isset_dataRec); + ub.set(DataRecTotal, this.getDataRecTotal(), this.isset_dataRecTotal); + ub.set(DataSend, this.getDataSend(), this.isset_dataSend); + ub.set(DataSendTotal, this.getDataSendTotal(), this.isset_dataSendTotal); + ub.set(Dept, this.getDept(), this.isset_dept); + ub.set(EquipNum, this.getEquipNum(), this.isset_equipNum); + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CreateTime, this.getCreateTime(), this.isset_createTime); + ub.set(EquipId, this.getEquipId(), this.isset_equipId); + ub.set(LiveStatus, this.getLiveStatus(), this.isset_liveStatus); + ub.set(StartTime, this.getStartTime(), this.isset_startTime); + ub.set(EndTime, this.getEndTime(), this.isset_endTime); + ub.set(DataRec, this.getDataRec(), this.isset_dataRec); + ub.set(DataRecTotal, this.getDataRecTotal(), this.isset_dataRecTotal); + ub.set(DataSend, this.getDataSend(), this.isset_dataSend); + ub.set(DataSendTotal, this.getDataSendTotal(), this.isset_dataSendTotal); + ub.set(Dept, this.getDept(), this.isset_dept); + ub.set(EquipNum, this.getEquipNum(), this.isset_equipNum); + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select id, create_time, equip_id, live_status, start_time, end_time, data_rec, data_rec_total, data_send, data_send_total, dept, equip_num from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select id, create_time, equip_id, live_status, start_time, end_time, data_rec, data_rec_total, data_send, data_send_total, dept, equip_num from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public TcpEquipStatus mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public TcpEquipStatus toTcpEquipStatus() { + return super.$clone(); + } +} + +/** + * tcp_equip_status RowMapper + * + * @author genrator + */ +class TcpEquipStatusRowMapper implements RowMapper<TcpEquipStatus> { + + @Override + public TcpEquipStatus mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + TcpEquipStatus tcp_equip_status = new TcpEquipStatus(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, TcpEquipStatus_mapper.Id); + if (columnIndex > 0) { + tcp_equip_status.setId(rs.getLong(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, TcpEquipStatus_mapper.CreateTime); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + tcp_equip_status.setCreateTime(null); + } else { + tcp_equip_status.setCreateTime(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquipStatus_mapper.EquipId); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + tcp_equip_status.setEquipId(null); + } else { + tcp_equip_status.setEquipId(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquipStatus_mapper.LiveStatus); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + tcp_equip_status.setLiveStatus(null); + } else { + tcp_equip_status.setLiveStatus(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquipStatus_mapper.StartTime); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + tcp_equip_status.setStartTime(null); + } else { + tcp_equip_status.setStartTime(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquipStatus_mapper.EndTime); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + tcp_equip_status.setEndTime(null); + } else { + tcp_equip_status.setEndTime(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquipStatus_mapper.DataRec); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + tcp_equip_status.setDataRec(null); + } else { + tcp_equip_status.setDataRec(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquipStatus_mapper.DataRecTotal); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + tcp_equip_status.setDataRecTotal(null); + } else { + tcp_equip_status.setDataRecTotal(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquipStatus_mapper.DataSend); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + tcp_equip_status.setDataSend(null); + } else { + tcp_equip_status.setDataSend(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquipStatus_mapper.DataSendTotal); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + tcp_equip_status.setDataSendTotal(null); + } else { + tcp_equip_status.setDataSendTotal(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquipStatus_mapper.Dept); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + tcp_equip_status.setDept(null); + } else { + tcp_equip_status.setDept(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquipStatus_mapper.EquipNum); + if (columnIndex > 0) { + tcp_equip_status.setEquipNum(rs.getString(columnIndex)); + } + return tcp_equip_status; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/po/TcpEquip_mapper.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/TcpEquip_mapper.java new file mode 100644 index 0000000..1fcead2 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/po/TcpEquip_mapper.java @@ -0,0 +1,365 @@ +package com.iplatform.model.po; + +import com.walker.jdbc.BaseMapper; +import com.walker.jdbc.ResultSetUtils; +import com.walker.jdbc.SqlAndParameters; +import com.walker.jdbc.sqlgen.DeleteBuilder; +import com.walker.jdbc.sqlgen.InsertBuilder; +import com.walker.jdbc.sqlgen.SelectBuilder; +import com.walker.jdbc.sqlgen.UpdateBuilder; +import com.walker.jdbc.util.StringUtils; + +import org.springframework.jdbc.core.RowMapper; + +import java.sql.ResultSet; +import java.sql.SQLException; +import java.util.Map; + +/** + * 琛ㄥ悕:TCP_EQUIP * + * @author genrator + */ +public class TcpEquip_mapper extends TcpEquip implements BaseMapper<TcpEquip> { + // 搴忓垪鍖栫増鏈彿 + private static final long serialVersionUID = 1L; + + public static final RowMapper<TcpEquip> ROW_MAPPER = new TcpEquipRowMapper(); + + // 涓婚敭 + public static final String Id = "id"; + // 鏅�氬睘鎬� + public static final String CreateTime = "create_time"; + public static final String Dept = "dept"; + public static final String Num = "num"; + public static final String Name = "name"; + public static final String TypeCode = "type_code"; + public static final String Summary = "summary"; + public static final String Vendor = "vendor"; + public static final String Status = "status"; + public static final String UserId = "user_id"; + public static final String ProtocolResolver = "protocol_resolver"; + public static final String BindUser = "bind_user"; + + /** + * 榛樿鏋勯�犲嚱鏁� + */ + public TcpEquip_mapper(TcpEquip tcpEquip) { + if (tcpEquip == null) { + throw new IllegalArgumentException("po鍙傛暟涓嶅厑璁镐负绌猴紒"); + } + //涓婚敭 + if (tcpEquip.isset_id) { + this.setId(tcpEquip.getId()); + } + //鏅�氬睘鎬� + if (tcpEquip.isset_createTime) { + this.setCreateTime(tcpEquip.getCreateTime()); + } + if (tcpEquip.isset_dept) { + this.setDept(tcpEquip.getDept()); + } + if (tcpEquip.isset_num) { + this.setNum(tcpEquip.getNum()); + } + if (tcpEquip.isset_name) { + this.setName(tcpEquip.getName()); + } + if (tcpEquip.isset_typeCode) { + this.setTypeCode(tcpEquip.getTypeCode()); + } + if (tcpEquip.isset_summary) { + this.setSummary(tcpEquip.getSummary()); + } + if (tcpEquip.isset_vendor) { + this.setVendor(tcpEquip.getVendor()); + } + if (tcpEquip.isset_status) { + this.setStatus(tcpEquip.getStatus()); + } + if (tcpEquip.isset_userId) { + this.setUserId(tcpEquip.getUserId()); + } + if (tcpEquip.isset_protocolResolver) { + this.setProtocolResolver(tcpEquip.getProtocolResolver()); + } + if (tcpEquip.isset_bindUser) { + this.setBindUser(tcpEquip.getBindUser()); + } + // 鍘绘帀锛�2022-09-07 + // this.setDatabaseName_(tcp_equip.getDatabaseName_()); + } + + /** + * 鑾峰彇琛ㄥ悕 + */ + @Override + public String getTableName_() { + String tableName = "tcp_equip"; + /** + if (StringUtils.isNotEmpty(this.getDatabaseName_())) { + return this.getDatabaseName_() + "." + tableName; + } else { + return tableName; + } + */ + return tableName; + } + + /** + * 鑾峰彇涓婚敭鍚嶇О + */ + @Override + public String getPkName_() { + return Id; + } + + /** + * 鑾峰彇涓婚敭鍊� + */ + @Override + public Object getPkValue_() { + return this.getId(); + } + + /** + * 鑾峰彇鎻掑叆璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getInsertSql_() { + InsertBuilder ib = new InsertBuilder(this.getTableName_()); + ib.set(Id, this.getId()); + ib.set(CreateTime, this.getCreateTime(), this.isset_createTime); + ib.set(Dept, this.getDept(), this.isset_dept); + ib.set(Num, this.getNum(), this.isset_num); + ib.set(Name, this.getName(), this.isset_name); + ib.set(TypeCode, this.getTypeCode(), this.isset_typeCode); + ib.set(Summary, this.getSummary(), this.isset_summary); + ib.set(Vendor, this.getVendor(), this.isset_vendor); + ib.set(Status, this.getStatus(), this.isset_status); + ib.set(UserId, this.getUserId(), this.isset_userId); + ib.set(ProtocolResolver, this.getProtocolResolver(), this.isset_protocolResolver); + ib.set(BindUser, this.getBindUser(), this.isset_bindUser); + return ib.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_() { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CreateTime, this.getCreateTime(), this.isset_createTime); + ub.set(Dept, this.getDept(), this.isset_dept); + ub.set(Num, this.getNum(), this.isset_num); + ub.set(Name, this.getName(), this.isset_name); + ub.set(TypeCode, this.getTypeCode(), this.isset_typeCode); + ub.set(Summary, this.getSummary(), this.isset_summary); + ub.set(Vendor, this.getVendor(), this.isset_vendor); + ub.set(Status, this.getStatus(), this.isset_status); + ub.set(UserId, this.getUserId(), this.isset_userId); + ub.set(ProtocolResolver, this.getProtocolResolver(), this.isset_protocolResolver); + ub.set(BindUser, this.getBindUser(), this.isset_bindUser); + ub.where(this.getPkName_(), this.getPkValue_()); + return ub.genMapSql(); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getUpdateSql_(String where, Map<String, Object> parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CreateTime, this.getCreateTime(), this.isset_createTime); + ub.set(Dept, this.getDept(), this.isset_dept); + ub.set(Num, this.getNum(), this.isset_num); + ub.set(Name, this.getName(), this.isset_name); + ub.set(TypeCode, this.getTypeCode(), this.isset_typeCode); + ub.set(Summary, this.getSummary(), this.isset_summary); + ub.set(Vendor, this.getVendor(), this.isset_vendor); + ub.set(Status, this.getStatus(), this.isset_status); + ub.set(UserId, this.getUserId(), this.isset_userId); + ub.set(ProtocolResolver, this.getProtocolResolver(), this.isset_protocolResolver); + ub.set(BindUser, this.getBindUser(), this.isset_bindUser); + return ub.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鏇存柊璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getUpdateSql_(String where, Object[] parameters) { + UpdateBuilder ub = new UpdateBuilder(this.getTableName_()); + ub.set(CreateTime, this.getCreateTime(), this.isset_createTime); + ub.set(Dept, this.getDept(), this.isset_dept); + ub.set(Num, this.getNum(), this.isset_num); + ub.set(Name, this.getName(), this.isset_name); + ub.set(TypeCode, this.getTypeCode(), this.isset_typeCode); + ub.set(Summary, this.getSummary(), this.isset_summary); + ub.set(Vendor, this.getVendor(), this.isset_vendor); + ub.set(Status, this.getStatus(), this.isset_status); + ub.set(UserId, this.getUserId(), this.isset_userId); + ub.set(ProtocolResolver, this.getProtocolResolver(), this.isset_protocolResolver); + ub.set(BindUser, this.getBindUser(), this.isset_bindUser); + return ub.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_() { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + db.where(this.getPkName_(), this.getPkValue_()); + return db.genMapSql(); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getDeleteSql_(String where, Map<String, Object> parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genMapSql(where, parameters); + } + + /** + * 鑾峰彇鍒犻櫎璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getDeleteSql_(String where, Object[] parameters) { + DeleteBuilder db = new DeleteBuilder(this.getTableName_()); + return db.genArraySql(where, parameters); + } + + /** + * 鑾峰彇鍗曡鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSingleSql_() { + SelectBuilder sb = new SelectBuilder(this.getTableName_()); + sb.where(this.getPkName_(), this.getPkValue_()); + return sb.genMapSql(); + } + + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Map<String, Object>> getSelectSql_(String where, Map<String, Object> parameters) { + return new SqlAndParameters<>("select id, create_time, dept, num, name, type_code, summary, vendor, status, user_id, protocol_resolver, bind_user from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 鑾峰彇鏌ヨ璇彞鍜屽弬鏁� + */ + @Override + public SqlAndParameters<Object[]> getSelectSql_(String where, Object[] parameters) { + return new SqlAndParameters<>("select id, create_time, dept, num, name, type_code, summary, vendor, status, user_id, protocol_resolver, bind_user from " + this.getTableName_() + " " + where, parameters); + } + + /** + * 灏唕esultset鐨勪竴琛岃浆鍖栦负po + */ + @Override + public TcpEquip mapRow(ResultSet rs, int i) throws SQLException { + return ROW_MAPPER.mapRow(rs, i); + } + + /** + * 鍏嬮殕 + */ + public TcpEquip toTcpEquip() { + return super.$clone(); + } +} + +/** + * tcp_equip RowMapper + * + * @author genrator + */ +class TcpEquipRowMapper implements RowMapper<TcpEquip> { + + @Override + public TcpEquip mapRow(ResultSet rs, int i) throws SQLException { + ResultSetUtils resultSetUtils = new ResultSetUtils(); + TcpEquip tcp_equip = new TcpEquip(); + Integer columnIndex; + //涓婚敭 + columnIndex = resultSetUtils.findColumn(rs, TcpEquip_mapper.Id); + if (columnIndex > 0) { + tcp_equip.setId(rs.getLong(columnIndex)); + } + //鏅�氬睘鎬� + columnIndex = resultSetUtils.findColumn(rs, TcpEquip_mapper.CreateTime); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + tcp_equip.setCreateTime(null); + } else { + tcp_equip.setCreateTime(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquip_mapper.Dept); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + tcp_equip.setDept(null); + } else { + tcp_equip.setDept(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquip_mapper.Num); + if (columnIndex > 0) { + tcp_equip.setNum(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquip_mapper.Name); + if (columnIndex > 0) { + tcp_equip.setName(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquip_mapper.TypeCode); + if (columnIndex > 0) { + tcp_equip.setTypeCode(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquip_mapper.Summary); + if (columnIndex > 0) { + tcp_equip.setSummary(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquip_mapper.Vendor); + if (columnIndex > 0) { + tcp_equip.setVendor(rs.getString(columnIndex)); + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquip_mapper.Status); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + tcp_equip.setStatus(null); + } else { + tcp_equip.setStatus(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquip_mapper.UserId); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + tcp_equip.setUserId(null); + } else { + tcp_equip.setUserId(rs.getLong(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquip_mapper.ProtocolResolver); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + tcp_equip.setProtocolResolver(null); + } else { + tcp_equip.setProtocolResolver(rs.getInt(columnIndex)); + } + } + columnIndex = resultSetUtils.findColumn(rs, TcpEquip_mapper.BindUser); + if (columnIndex > 0) { + if (rs.getBigDecimal(columnIndex) == null) { + tcp_equip.setBindUser(null); + } else { + tcp_equip.setBindUser(rs.getLong(columnIndex)); + } + } + return tcp_equip; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/to/UserAndDeptTo.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/to/UserAndDeptTo.java new file mode 100644 index 0000000..ad60553 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/to/UserAndDeptTo.java @@ -0,0 +1,165 @@ +package com.iplatform.model.to; + +import com.walker.web.OrgType; +import com.walker.web.UserType; + +import java.io.Serializable; + +/** + * 鐢ㄦ埛鏈烘瀯杩滅▼璋冪敤瀹氫箟浼犺緭瀵硅薄锛宻erviceApi鎺ュ彛浣跨敤銆� + * @author 鏃跺厠鑻� + * @date 2023-06-06 + */ +public class UserAndDeptTo implements Serializable { + + @Override + public String toString(){ + return new StringBuilder("[deptName=").append(this.deptName) + .append(", parentId=").append(this.parentId) + .append(", orgId=").append(this.orgId) + .append(", menuType=").append(this.menuType) + .append(", userName=").append(this.userName) + .append(", nickName=").append(this.nickName) + .append(", userType=").append(this.userType) + .append(", type=").append(this.type) + .append("]").toString(); + } + + public String getDeptName() { + return deptName; + } + + public void setDeptName(String deptName) { + this.deptName = deptName; + } + + public long getParentId() { + return parentId; + } + + public void setParentId(long parentId) { + this.parentId = parentId; + } + + public long getOrgId() { + return orgId; + } + + public void setOrgId(long orgId) { + this.orgId = orgId; + } + + public int getOrgType() { + return orgType; + } + + public void setOrgType(int orgType) { + this.orgType = orgType; + } + + public int getMenuType() { + return menuType; + } + + public void setMenuType(int menuType) { + this.menuType = menuType; + } + + public String getUserName() { + return userName; + } + + public void setUserName(String userName) { + this.userName = userName; + } + + public String getNickName() { + return nickName; + } + + public void setNickName(String nickName) { + this.nickName = nickName; + } + + public int getUserType() { + return userType; + } + + public void setUserType(int userType) { + this.userType = userType; + } + + public String getSex() { + return sex; + } + + public void setSex(String sex) { + this.sex = sex; + } + + public String getAvatar() { + return avatar; + } + + public void setAvatar(String avatar) { + this.avatar = avatar; + } + + public int getType() { + return type; + } + + public void setType(int type) { + this.type = type; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getMail() { + return mail; + } + + public void setMail(String mail) { + this.mail = mail; + } + + public String getCreateId() { + return createId; + } + + public void setCreateId(String createId) { + this.createId = createId; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + private String password; + private String createId; + private String deptName; + private long parentId; + private long orgId = 0; + private int orgType = OrgType.TYPE_ORG; + private int menuType = 0; + + private String userName; // 鐧诲綍鍚� + private String nickName; // 鏄电О锛堝鍚嶏級 + private int userType = UserType.TYPE_ADMIN; + private String sex = "0"; + private String avatar; + private int type = UserType.TYPE_MERCHANT_ADMIN; + + private String phone; + private String mail; +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/to/UserAndDeptToResult.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/to/UserAndDeptToResult.java new file mode 100644 index 0000000..030fc9d --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/to/UserAndDeptToResult.java @@ -0,0 +1,47 @@ +package com.iplatform.model.to; + +import java.io.Serializable; + +/** + * 鐢ㄦ埛鏈烘瀯鎿嶄綔杩斿洖缁撴灉瀵硅薄 + * @date 2023-06-06 + */ +public class UserAndDeptToResult implements Serializable { + + public long getDeptId() { + return deptId; + } + + public void setDeptId(long deptId) { + this.deptId = deptId; + } + + public long getUserId() { + return userId; + } + + public void setUserId(long userId) { + this.userId = userId; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + private String message; + private long deptId; + private long userId; + + @Override + public String toString() { + return "UserAndDeptToResult{" + + "message='" + message + '\'' + + ", deptId=" + deptId + + ", userId=" + userId + + '}'; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/ApiTime.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/ApiTime.java new file mode 100644 index 0000000..9af37e8 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/ApiTime.java @@ -0,0 +1,75 @@ +package com.iplatform.model.vo; + +/** + * 璁板綍鎺ュ彛璋冪敤鏃堕棿瀵硅薄銆� + * @date 2024-02-29 + */ +public class ApiTime { + + public long getId() { + return id; + } + + public void setId(long id) { + this.id = id; + } + + public long getCreateTime() { + return createTime; + } + + public void setCreateTime(long createTime) { + this.createTime = createTime; + } + + public int getRequestDate() { + return requestDate; + } + + public void setRequestDate(int requestDate) { + this.requestDate = requestDate; + } + + public String getUri() { + return uri; + } + + public void setUri(String uri) { + this.uri = uri; + } + + public long getCostTime() { + return costTime; + } + + public void setCostTime(long costTime) { + this.costTime = costTime; + } + + public String getUser() { + return user; + } + + public void setUser(String user) { + this.user = user; + } + + private long id; + private long createTime; + private int requestDate = 0; + private String uri; + private long costTime = 0; + private String user; + + @Override + public String toString() { + return "ApiTime{" + + "id=" + id + + ", createTime=" + createTime + + ", requestDate=" + requestDate + + ", uri='" + uri + '\'' + + ", costTime=" + costTime + + ", user='" + user + '\'' + + '}'; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/CategoryTreeVo.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/CategoryTreeVo.java new file mode 100644 index 0000000..8a815d8 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/CategoryTreeVo.java @@ -0,0 +1,137 @@ +package com.iplatform.model.vo; + +import com.fasterxml.jackson.annotation.JsonInclude; + +import java.util.ArrayList; +import java.util.List; + +/** + * 閰嶇疆鍒嗙被瀵硅薄瀹氫箟銆� + * @author 鏃跺厠鑻� + * @date 2023-05-15 + */ +public class CategoryTreeVo { + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getPid() { + return pid; + } + + public void setPid(Integer pid) { + this.pid = pid; + } + + public String getPath() { + return path; + } + + public void setPath(String path) { + this.path = path; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getType() { + return type; + } + + public void setType(Integer type) { + this.type = type; + } + + public String getUrl() { + return url; + } + + public void setUrl(String url) { + this.url = url; + } + + public String getExtra() { + return extra; + } + + public void setExtra(String extra) { + this.extra = extra; + } + + public Boolean getStatus() { + return status; + } + + public void setStatus(Boolean status) { + this.status = status; + } + + public Integer getSort() { + return sort; + } + + public void setSort(Integer sort) { + this.sort = sort; + } + + public List<CategoryTreeVo> getChild() { + return child; + } + + public void setChild(List<CategoryTreeVo> child) { + this.child = child; + } + + /** + * 鏂版坊鍔犲瓧娈碉紝鍏宠仈鐨勮〃鍗曞悕绉帮紝extra瀛楁閲屾槸formId銆� + * @return + * @date 2023-05-18 + */ + public String getFormName() { + return formName; + } + + public void setFormName(String formName) { + this.formName = formName; + } + + private String formName; + private Integer id; + +// // @ApiModelProperty(value = "鐖剁骇ID") + private Integer pid; + +// // @ApiModelProperty(value = "璺緞") + private String path; + +// // @ApiModelProperty(value = "鍒嗙被鍚嶇О") + private String name; + +// // @ApiModelProperty(value = "绫诲瀷锛岀被鍨嬶紝1 浜у搧鍒嗙被锛�2 闄勪欢鍒嗙被锛�3 鏂囩珷鍒嗙被锛� 4 璁剧疆鍒嗙被锛� 5 鑿滃崟鍒嗙被锛� 6 閰嶇疆鍒嗙被锛� 7 绉掓潃閰嶇疆") + private Integer type; + +// // @ApiModelProperty(value = "鍦板潃") + private String url; + +// // @ApiModelProperty(value = "鎵╁睍瀛楁") + private String extra; + +// // @ApiModelProperty(value = "鐘舵��, 0姝e父锛�1澶辨晥") + private Boolean status; + +// // @ApiModelProperty(value = "鎺掑簭") + private Integer sort; + + @JsonInclude(JsonInclude.Include.NON_EMPTY) //灞炴�т负 绌猴紙""锛塠] 鎴栬�呬负 NULL 閮戒笉搴忓垪鍖� + private List<CategoryTreeVo> child = new ArrayList<>(8); +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/ConfigFormItemConfigRegListVo.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/ConfigFormItemConfigRegListVo.java new file mode 100644 index 0000000..4d07eca --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/ConfigFormItemConfigRegListVo.java @@ -0,0 +1,31 @@ +package com.iplatform.model.vo; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import java.io.Serializable; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class ConfigFormItemConfigRegListVo implements Serializable { + + public String getPattern() { + return pattern; + } + + public void setPattern(String pattern) { + this.pattern = pattern; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } + + // // @ApiModelProperty(value = "姝e垯琛ㄨ揪寮�") + private String pattern; + +// // @ApiModelProperty(value = "閿欒鎻愮ず璇�") + private String message; +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/ConfigFormItemConfigVo.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/ConfigFormItemConfigVo.java new file mode 100644 index 0000000..63a3eac --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/ConfigFormItemConfigVo.java @@ -0,0 +1,152 @@ +package com.iplatform.model.vo; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import java.io.Serializable; +import java.util.List; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class ConfigFormItemConfigVo implements Serializable { + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public String getShowLabel() { + return showLabel; + } + + public void setShowLabel(String showLabel) { + this.showLabel = showLabel; + } + + public String getChangeTag() { + return changeTag; + } + + public void setChangeTag(String changeTag) { + this.changeTag = changeTag; + } + + public String getLabelWidth() { + return labelWidth; + } + + public void setLabelWidth(String labelWidth) { + this.labelWidth = labelWidth; + } + + public String getTag() { + return tag; + } + + public void setTag(String tag) { + this.tag = tag; + } + + public String getTagIcon() { + return tagIcon; + } + + public void setTagIcon(String tagIcon) { + this.tagIcon = tagIcon; + } + + public String getSpan() { + return span; + } + + public void setSpan(String span) { + this.span = span; + } + + public String getLayout() { + return layout; + } + + public void setLayout(String layout) { + this.layout = layout; + } + + public Boolean getRequired() { + return required; + } + + public void setRequired(Boolean required) { + this.required = required; + } + + public List<ConfigFormItemConfigRegListVo> getRegList() { + return regList; + } + + public void setRegList(List<ConfigFormItemConfigRegListVo> regList) { + this.regList = regList; + } + + public String getDocument() { + return document; + } + + public void setDocument(String document) { + this.document = document; + } + + public String getFormId() { + return formId; + } + + public void setFormId(String formId) { + this.formId = formId; + } + + public String getRenderKey() { + return renderKey; + } + + public void setRenderKey(String renderKey) { + this.renderKey = renderKey; + } + + public String getDefaultValue() { + return defaultValue; + } + + public void setDefaultValue(String defaultValue) { + this.defaultValue = defaultValue; + } + + private String label; + +// // @ApiModelProperty(value = "") + private String showLabel; + + private String changeTag; + + private String labelWidth; + + private String tag; + + private String tagIcon; + + private String span; + + private String layout; + + private Boolean required; + +// // @ApiModelProperty(value = "楠岃瘉瑙勫垯") + private List<ConfigFormItemConfigRegListVo> regList; + + private String document; + + private String formId; + + private String renderKey; + + private String defaultValue; +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/ConfigFormItemVo.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/ConfigFormItemVo.java new file mode 100644 index 0000000..252729b --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/ConfigFormItemVo.java @@ -0,0 +1,80 @@ +package com.iplatform.model.vo; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; + +import java.io.Serializable; + +@JsonIgnoreProperties(ignoreUnknown = true) +public class ConfigFormItemVo implements Serializable { + + public ConfigFormItemConfigVo get__config__() { + return __config__; + } + + public void set__config__(ConfigFormItemConfigVo __config__) { + this.__config__ = __config__; + } + + public String getPlaceholder() { + return placeholder; + } + + public void setPlaceholder(String placeholder) { + this.placeholder = placeholder; + } + + public String getStep() { + return step; + } + + public void setStep(String step) { + this.step = step; + } + + public String getStepStrictly() { + return stepStrictly; + } + + public void setStepStrictly(String stepStrictly) { + this.stepStrictly = stepStrictly; + } + + public String getControlsPosition() { + return controlsPosition; + } + + public void setControlsPosition(String controlsPosition) { + this.controlsPosition = controlsPosition; + } + + public String getDisabled() { + return disabled; + } + + public void setDisabled(String disabled) { + this.disabled = disabled; + } + + public String get__vModel__() { + return __vModel__; + } + + public void set__vModel__(String __vModel__) { + this.__vModel__ = __vModel__; + } + + // // @ApiModelProperty(value = "閰嶇疆") + private ConfigFormItemConfigVo __config__; + + private String placeholder; + + private String step; + + private String stepStrictly; + + private String controlsPosition; + + private String disabled; + + private String __vModel__; +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/ConfigFormVo.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/ConfigFormVo.java new file mode 100644 index 0000000..61ec7b8 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/ConfigFormVo.java @@ -0,0 +1,140 @@ +package com.iplatform.model.vo; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +/** + * 閰嶇疆琛ㄥ崟鏍煎紡瀹氫箟銆� + * @author 鏃跺厠鑻� + * @date 2023-05-20 + */ +public class ConfigFormVo implements Serializable { + + public String getFormRef() { + return formRef; + } + + public void setFormRef(String formRef) { + this.formRef = formRef; + } + + public String getFormModel() { + return formModel; + } + + public void setFormModel(String formModel) { + this.formModel = formModel; + } + + public String getSize() { + return size; + } + + public void setSize(String size) { + this.size = size; + } + + public String getLabelPosition() { + return labelPosition; + } + + public void setLabelPosition(String labelPosition) { + this.labelPosition = labelPosition; + } + + public String getLabelWidth() { + return labelWidth; + } + + public void setLabelWidth(String labelWidth) { + this.labelWidth = labelWidth; + } + + public String getFormRules() { + return formRules; + } + + public void setFormRules(String formRules) { + this.formRules = formRules; + } + + public String getGutter() { + return gutter; + } + + public void setGutter(String gutter) { + this.gutter = gutter; + } + + public String getDisabled() { + return disabled; + } + + public void setDisabled(String disabled) { + this.disabled = disabled; + } + + public String getSpan() { + return span; + } + + public void setSpan(String span) { + this.span = span; + } + + public String getFormBtns() { + return formBtns; + } + + public void setFormBtns(String formBtns) { + this.formBtns = formBtns; + } + + public List<ConfigFormItemVo> getFields() { + return fields; + } + public void setFields(List<ConfigFormItemVo> fields) { + this.fields = fields; + } +// public List<String> getFields() { +// return fields; +// } +// public void setFields(List<String> fields) { +// this.fields = fields; +// } + + // // @ApiModelProperty(value = "琛ㄥ崟鍚嶇О") + private String formRef; + +// // @ApiModelProperty(value = "form瀵硅薄") + private String formModel; + +// // @ApiModelProperty(value = "澶у皬") + private String size; + +// // @ApiModelProperty(value = "label浣嶇疆") + private String labelPosition; + +// // @ApiModelProperty(value = "label瀹藉害") + private String labelWidth; + +// // @ApiModelProperty(value = "form瑙勫垯") + private String formRules; + +// // @ApiModelProperty(value = "") + private String gutter; + +// // @ApiModelProperty(value = "鏄惁绂佺敤") + private String disabled; + +// // @ApiModelProperty(value = "span") + private String span; + +// // @ApiModelProperty(value = "button") + private String formBtns; + +// // @ApiModelProperty(value = "瀛楁鍊煎垪琛�") +// private List<String> fields = new ArrayList<>(8); + private List<ConfigFormItemVo> fields = new ArrayList<>(8); +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/CopyRightVo.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/CopyRightVo.java new file mode 100644 index 0000000..7db2c12 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/CopyRightVo.java @@ -0,0 +1,31 @@ +package com.iplatform.model.vo; + +import java.io.Serializable; + +/** + * 鏄剧ず鐗堟潈鍐呭銆� + */ +public class CopyRightVo implements Serializable { + + public String getCompanyName() { + return companyName; + } + + public void setCompanyName(String companyName) { + this.companyName = companyName; + } + + public String getCompanyImage() { + return companyImage; + } + + public void setCompanyImage(String companyImage) { + this.companyImage = companyImage; + } + + // // @ApiModelProperty(value = "鍏徃淇℃伅") + private String companyName; + +// // @ApiModelProperty(value = "鍏徃鍥剧墖") + private String companyImage; +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/MenuVo.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/MenuVo.java new file mode 100644 index 0000000..b242640 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/MenuVo.java @@ -0,0 +1,129 @@ +package com.iplatform.model.vo; + +import java.util.List; + +/** + * 鏂扮晫闈㈣彍鍗曞璞★紙鐢靛晢锛� + * @date 2023-05-12 + */ +public class MenuVo { + + public Integer getIsShow() { + return isShow; + } + + public void setIsShow(Integer isShow) { + this.isShow = isShow; + } + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public Long getPid() { + return pid; + } + + public void setPid(Long pid) { + this.pid = pid; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getIcon() { + return icon; + } + + public void setIcon(String icon) { + this.icon = icon; + } + + public String getPerms() { + return perms; + } + + public void setPerms(String perms) { + this.perms = perms; + } + + public String getComponent() { + return component; + } + + public void setComponent(String component) { + this.component = component; + } + + public String getMenuType() { + return menuType; + } + + public void setMenuType(String menuType) { + this.menuType = menuType; + } + + public Integer getSort() { + return sort; + } + + public void setSort(Integer sort) { + this.sort = sort; + } + + public List<MenuVo> getChildList() { + return childList; + } + + public void setChildList(List<MenuVo> childList) { + this.childList = childList; + } + + /** + * 鑷畾涔夊浘鏍囷細姝e父鍥炬爣锛堢浉瀵硅矾寰勶級 + * @return + * @date 2023-08-30 + */ + public String getIconNormal() { + return iconNormal; + } + + public void setIconNormal(String iconNormal) { + this.iconNormal = iconNormal; + } + + /** + * 鑷畾涔夊浘鏍囷細婵�娲诲浘鏍囷紙鐩稿璺緞锛� + * @return + * @date 2023-08-30 + */ + public String getIconActive() { + return iconActive; + } + + public void setIconActive(String iconActive) { + this.iconActive = iconActive; + } + + private String iconNormal; + private String iconActive; + private Long id; + private Long pid; + private String name; + private String icon; + private String perms; + private String component; + private String menuType; + private Integer sort; + private Integer isShow; + private List<MenuVo> childList; +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/MetaVo.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/MetaVo.java new file mode 100644 index 0000000..6e116e7 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/MetaVo.java @@ -0,0 +1,102 @@ +package com.iplatform.model.vo; + +import com.walker.infrastructure.utils.StringUtils; + +/** + * 璺敱鏄剧ず淇℃伅 + * + * @author ruoyi + */ +public class MetaVo +{ + /** + * 璁剧疆璇ヨ矾鐢卞湪渚ц竟鏍忓拰闈㈠寘灞戜腑灞曠ず鐨勫悕瀛� + */ + private String title; + + /** + * 璁剧疆璇ヨ矾鐢辩殑鍥炬爣锛屽搴旇矾寰剆rc/assets/icons/svg + */ + private String icon; + + /** + * 璁剧疆涓簍rue锛屽垯涓嶄細琚� <keep-alive>缂撳瓨 + */ + private boolean noCache; + + /** + * 鍐呴摼鍦板潃锛坔ttp(s)://寮�澶达級 + */ + private String link; + + public MetaVo() + { + } + + public MetaVo(String title, String icon) + { + this.title = title; + this.icon = icon; + } + + public MetaVo(String title, String icon, boolean noCache) { + this.title = title; + this.icon = icon; + this.noCache = noCache; + } + + public MetaVo(String title, String icon, String link) { + this.title = title; + this.icon = icon; + this.link = link; + } + + public MetaVo(String title, String icon, boolean noCache, String link) { + this.title = title; + this.icon = icon; + this.noCache = noCache; + if (StringUtils.isHttpLink(link)) { + this.link = link; + } + } + + public boolean isNoCache() + { + return noCache; + } + + public void setNoCache(boolean noCache) + { + this.noCache = noCache; + } + + public String getTitle() + { + return title; + } + + public void setTitle(String title) + { + this.title = title; + } + + public String getIcon() + { + return icon; + } + + public void setIcon(String icon) + { + this.icon = icon; + } + + public String getLink() + { + return link; + } + + public void setLink(String link) + { + this.link = link; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/NotificationConfigVo.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/NotificationConfigVo.java new file mode 100644 index 0000000..32db2e1 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/NotificationConfigVo.java @@ -0,0 +1,88 @@ +package com.iplatform.model.vo; + +import java.io.Serializable; + +/** + * 鎻愰啋閫氱煡锛屾秷鎭ā鏉块厤缃璞°�� + * @author 鏃跺厠鑻� + * @date 2023-08-25 + */ +public class NotificationConfigVo implements Serializable { + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getTempId() { + return tempId; + } + + public void setTempId(String tempId) { + this.tempId = tempId; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getTempKey() { + return tempKey; + } + + public void setTempKey(String tempKey) { + this.tempKey = tempKey; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getStatus() { + return status; + } + + public void setStatus(Integer status) { + this.status = status; + } + + // // @ApiModelProperty(value = "id") + private Long id; + +// // @ApiModelProperty(value = "妯℃澘id(鍏敤)") + private String tempId; + +// // @ApiModelProperty(value = "妯℃澘璇存槑(鐭俊)") + private String title; + +// // @ApiModelProperty(value = "妯℃澘缂栧彿(鍏敤)") + private String tempKey; + +// // @ApiModelProperty(value = "鍐呭(鍏敤)") + private String content; + +// // @ApiModelProperty(value = "妯℃澘鍚�") + private String name; + +// // @ApiModelProperty(value = "鐘舵��,1-寮�鍚紝2-鍏抽棴") + private Integer status; +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/NotificationTemplateVo.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/NotificationTemplateVo.java new file mode 100644 index 0000000..2e96c34 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/NotificationTemplateVo.java @@ -0,0 +1,105 @@ +package com.iplatform.model.vo; + +import java.io.Serializable; + +public class NotificationTemplateVo implements Serializable { + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public boolean getWechat() { + return wechat; + } + + public void setWechat(boolean wechat) { + this.wechat = wechat; + } + + public boolean getRoutine() { + return routine; + } + + public void setRoutine(boolean routine) { + this.routine = routine; + } + + public boolean getSms() { + return sms; + } + + public void setSms(boolean sms) { + this.sms = sms; + } + + public long getWechatId() { + return wechatId; + } + + public void setWechatId(long wechatId) { + this.wechatId = wechatId; + } + + public long getRoutineId() { + return routineId; + } + + public void setRoutineId(long routineId) { + this.routineId = routineId; + } + + public long getSmsId() { + return smsId; + } + + public void setSmsId(long smsId) { + this.smsId = smsId; + } + + public String getWechatTempId() { + return wechatTempId; + } + + public void setWechatTempId(String wechatTempId) { + this.wechatTempId = wechatTempId; + } + + public String getRoutineTempId() { + return routineTempId; + } + + public void setRoutineTempId(String routineTempId) { + this.routineTempId = routineTempId; + } + + public String getSmsTempId() { + return smsTempId; + } + + public void setSmsTempId(String smsTempId) { + this.smsTempId = smsTempId; + } + + private String name; + + private boolean wechat = false; // 寰俊鍏紬鍙� + private boolean routine = false; // 寰俊灏忕▼搴� + private boolean sms = false; + + private long wechatId = 0; + private long routineId = 0; + private long smsId = 0; // 瀵瑰簲鍚勮嚜妯℃澘id锛孴emplateMessage + + private String wechatTempId; + private String routineTempId; + private String smsTempId; + + // 鐩墠缂撳瓨涓笉闇�瑕佸瓨鍌ㄦā鏉垮叿浣撳唴瀹癸紝浠呬负浜嗙湅鍒板唴瀹硅�屽凡 +// private String wechatContent; +// private String routineContent; +// private String smsContent; +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/OrderCenterNumVo.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/OrderCenterNumVo.java new file mode 100644 index 0000000..07e12e5 --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/OrderCenterNumVo.java @@ -0,0 +1,77 @@ +package com.iplatform.model.vo; + +import java.io.Serializable; + +/** + * 杩斿洖绉诲姩绔殑璁㈠崟缁熻淇℃伅锛屾垜鐨勭晫闈腑鍛堢幇銆� + * @author 鏃跺厠鑻� + * @date 2023-06-30 + */ +public class OrderCenterNumVo implements Serializable { + + public Integer getAwaitPayCount() { + return awaitPayCount; + } + + public void setAwaitPayCount(Integer awaitPayCount) { + this.awaitPayCount = awaitPayCount; + } + + public Integer getAwaitShippedCount() { + return awaitShippedCount; + } + + public void setAwaitShippedCount(Integer awaitShippedCount) { + this.awaitShippedCount = awaitShippedCount; + } + + public Integer getVerificationCount() { + return verificationCount; + } + + public void setVerificationCount(Integer verificationCount) { + this.verificationCount = verificationCount; + } + + public Integer getReceiptCount() { + return receiptCount; + } + + public void setReceiptCount(Integer receiptCount) { + this.receiptCount = receiptCount; + } + + public Integer getAwaitReplyCount() { + return awaitReplyCount; + } + + public void setAwaitReplyCount(Integer awaitReplyCount) { + this.awaitReplyCount = awaitReplyCount; + } + + public Integer getRefundCount() { + return refundCount; + } + + public void setRefundCount(Integer refundCount) { + this.refundCount = refundCount; + } + + // // @ApiModelProperty(value = "鏈敮浠樿鍗曟暟閲�") + private Integer awaitPayCount = 0; + +// // @ApiModelProperty(value = "寰呭彂璐ц鍗曟暟閲�") + private Integer awaitShippedCount = 0; + +// // @ApiModelProperty(value = "寰呮牳閿�璁㈠崟鏁伴噺") + private Integer verificationCount = 0; + +// // @ApiModelProperty(value = "寰呮敹璐ц鍗曟暟閲�") + private Integer receiptCount = 0; + +// // @ApiModelProperty(value = "寰呰瘎浠锋暟閲�") + private Integer awaitReplyCount = 0; + +// // @ApiModelProperty(value = "閫�娆句腑鏁伴噺") + private Integer refundCount = 0; +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/RouterVo.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/RouterVo.java new file mode 100644 index 0000000..208aa5e --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/RouterVo.java @@ -0,0 +1,148 @@ +package com.iplatform.model.vo; + +import com.fasterxml.jackson.annotation.JsonInclude; +import java.util.List; + +/** + * 璺敱閰嶇疆淇℃伅锛屽墠绔晫闈娇鐢�(鑻ヤ緷妗嗘灦) + * + * @author Mike + */ +@JsonInclude(JsonInclude.Include.NON_EMPTY) +public class RouterVo +{ + /** + * 璺敱鍚嶅瓧 + */ + private String name; + + /** + * 璺敱鍦板潃 + */ + private String path; + + /** + * 鏄惁闅愯棌璺敱锛屽綋璁剧疆 true 鐨勬椂鍊欒璺敱涓嶄細鍐嶄晶杈规爮鍑虹幇 + */ + private boolean hidden; + + /** + * 閲嶅畾鍚戝湴鍧�锛屽綋璁剧疆 noRedirect 鐨勬椂鍊欒璺敱鍦ㄩ潰鍖呭睉瀵艰埅涓笉鍙鐐瑰嚮 + */ + private String redirect; + + /** + * 缁勪欢鍦板潃 + */ + private String component; + + /** + * 璺敱鍙傛暟锛氬 {"id": 1, "name": "ry"} + */ + private String query; + + /** + * 褰撲綘涓�涓矾鐢变笅闈㈢殑 children 澹版槑鐨勮矾鐢卞ぇ浜�1涓椂锛岃嚜鍔ㄤ細鍙樻垚宓屽鐨勬ā寮�--濡傜粍浠堕〉闈� + */ + private Boolean alwaysShow; + + /** + * 鍏朵粬鍏冪礌 + */ + private MetaVo meta; + + /** + * 瀛愯矾鐢� + */ + private List<RouterVo> children; + + 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 boolean getHidden() + { + return hidden; + } + + public void setHidden(boolean hidden) + { + this.hidden = hidden; + } + + public String getRedirect() + { + return redirect; + } + + public void setRedirect(String redirect) + { + this.redirect = redirect; + } + + public String getComponent() + { + return component; + } + + public void setComponent(String component) + { + this.component = component; + } + + public String getQuery() + { + return query; + } + + public void setQuery(String query) + { + this.query = query; + } + + public Boolean getAlwaysShow() + { + return alwaysShow; + } + + public void setAlwaysShow(Boolean alwaysShow) + { + this.alwaysShow = alwaysShow; + } + + public MetaVo getMeta() + { + return meta; + } + + public void setMeta(MetaVo meta) + { + this.meta = meta; + } + + public List<RouterVo> getChildren() + { + return children; + } + + public void setChildren(List<RouterVo> children) + { + this.children = children; + } +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/SystemGroupVo.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/SystemGroupVo.java new file mode 100644 index 0000000..ae73ccd --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/SystemGroupVo.java @@ -0,0 +1,42 @@ +package com.iplatform.model.vo; + +import com.iplatform.model.po.S_group; +import com.iplatform.model.po.S_group_data; + +import java.util.ArrayList; +import java.util.List; + +/** + * 杩斿洖鍓嶇浣跨敤鐨勫垎缁勶紝绯荤粺浣跨敤浜嗙紦瀛橈紝鍖呭惈锛氬垎缁勫拰鍒嗙粍瀛愰」鏁版嵁銆� + * @author 鏃跺厠鑻� + * @date 2023-06-23 + */ +public class SystemGroupVo extends S_group { + + public SystemGroupVo(){} + + public SystemGroupVo(S_group group){ + this.setId(group.getId()); + this.setName(group.getName()); + this.setCreate_time(group.getCreate_time()); + this.setForm_id(group.getForm_id()); + this.setInfo(group.getInfo()); + } + + public void addGroupData(S_group_data data){ + if(this.groupDataList == null){ + this.groupDataList = new ArrayList<>(8); + } + this.groupDataList.add(data); + } + + public List<S_group_data> getGroupDataList() { + return groupDataList; + } + + public void setGroupDataList(List<S_group_data> groupDataList) { + this.groupDataList = groupDataList; + } + + private List<S_group_data> groupDataList; +} diff --git a/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/WeChatAccessTokenVo.java b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/WeChatAccessTokenVo.java new file mode 100644 index 0000000..65e6fff --- /dev/null +++ b/iplatform-model-pojo/src/main/java/com/iplatform/model/vo/WeChatAccessTokenVo.java @@ -0,0 +1,63 @@ +package com.iplatform.model.vo; + +import java.io.Serializable; + +public class WeChatAccessTokenVo implements Serializable { + + public String getAccessToken() { + return accessToken; + } + + public void setAccessToken(String accessToken) { + this.accessToken = accessToken; + } + + public Integer getExpiresIn() { + return expiresIn; + } + + public void setExpiresIn(Integer expiresIn) { + this.expiresIn = expiresIn; + } + + public Integer getErrCode() { + return errCode; + } + + public void setErrCode(Integer errCode) { + this.errCode = errCode; + } + + public String getErrMsg() { + return errMsg; + } + + public void setErrMsg(String errMsg) { + this.errMsg = errMsg; + } + + // // @ApiModelProperty(value = "鑾峰彇鍒扮殑鍑瘉") +// @TableField(value = "access_token") + private String accessToken; + +// // @ApiModelProperty(value = "鍑瘉鏈夋晥鏃堕棿锛屽崟浣嶏細绉掋�傜洰鍓嶆槸7200绉掍箣鍐呯殑鍊笺��") +// @TableField(value = "expires_in") + private Integer expiresIn; + +// // @ApiModelProperty(value = "閿欒鐮�") +// @TableField(value = "errcode") + private Integer errCode; + +// // @ApiModelProperty(value = "閿欒淇℃伅") +// @TableField(value = "errmsg") + private String errMsg; + + /** + * errcode 鐨勫悎娉曞�� + * -1 绯荤粺绻佸繖锛屾鏃惰寮�鍙戣�呯◢鍊欏啀璇� + * 0 璇锋眰鎴愬姛 + * 40001 AppSecret 閿欒鎴栬�� AppSecret 涓嶅睘浜庤繖涓皬绋嬪簭锛岃寮�鍙戣�呯‘璁� AppSecret 鐨勬纭�� + * 40002 璇风‘淇� grant_type 瀛楁鍊间负 client_credential + * 40013 涓嶅悎娉曠殑 AppID锛岃寮�鍙戣�呮鏌� AppID 鐨勬纭�э紝閬垮厤寮傚父瀛楃锛屾敞鎰忓ぇ灏忓啓 + */ +} diff --git a/pom.xml b/pom.xml index 7e7008d..df660bc 100644 --- a/pom.xml +++ b/pom.xml @@ -8,13 +8,13 @@ <module>consum-base</module> <module>consum-model-pojo</module> <module>iplatform-base-security-consum</module> + <module>iplatform-core</module> + <module>iplatform-model-pojo</module> + <module>iplatform-base</module> + <module>iplatform-base-admin</module> + <module>iplatform-file-server</module> + <module>iplatform-base-tcp</module> </modules> - - <parent> - <groupId>com.iplatform</groupId> - <artifactId>iplatform</artifactId> - <version>2.3.0-SNAPSHOT</version> - </parent> <groupId>com.consum</groupId> <artifactId>low-consum-manage</artifactId> @@ -22,14 +22,159 @@ <name>low-consum-manage</name> <packaging>pom</packaging> + <parent> + <groupId>org.springframework.boot</groupId> + <artifactId>spring-boot-starter-parent</artifactId> + <version>3.2.11</version> + </parent> + <properties> + <spring-cloud-dependencies.version>2021.0.4</spring-cloud-dependencies.version> + <spring.cloud.alibaba.version>2021.0.4.0</spring.cloud.alibaba.version> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <consum-base.version>1.0.0-SNAPSHOT</consum-base.version> <consum-model-pojo.version>1.0.0-SNAPSHOT</consum-model-pojo.version> + <spring-boot.version>3.2.11</spring-boot.version> + <walker-dependencies.version>3.2.0</walker-dependencies.version> + <walker-infrastructure.version>3.2.0</walker-infrastructure.version> + <walker-cache.version>3.2.0</walker-cache.version> + <walker-support-elasticsearch.version>3.2.0</walker-support-elasticsearch.version> + <walker-support-redis.version>3.2.0</walker-support-redis.version> + <walker-support-milvus.version>3.2.0</walker-support-milvus.version> + <walker-support-remote.version>3.2.0</walker-support-remote.version> + <walker-support-kaptcha.version>3.2.0</walker-support-kaptcha.version> + <walker-scheduler.version>3.2.0</walker-scheduler.version> + <walker-jdbc-common.version>3.2.0</walker-jdbc-common.version> + <walker-jdbc.version>3.2.0</walker-jdbc.version> + <walker-jdbc-generator.version>3.2.0</walker-jdbc-generator.version> + <walker-ml-openocr.version>3.2.0</walker-ml-openocr.version> + <walker-text-semantics.version>3.2.0</walker-text-semantics.version> + <walker-file.version>3.2.0</walker-file.version> + <walker-connector.version>3.2.0</walker-connector.version> + <walker-db-meta.version>3.2.0</walker-db-meta.version> + <walker-gather-store>3.2.0</walker-gather-store> + <walker-web.version>3.2.0</walker-web.version> + <walker-web-security.version>3.2.0</walker-web-security.version> + <walker-web-driver.version>3.2.0</walker-web-driver.version> + <walker-di-support-univocity.version>3.2.0</walker-di-support-univocity.version> + <walker-jdbc-support.version>3.2.0</walker-jdbc-support.version> + <walker-etaa-group.version>3.2.0</walker-etaa-group.version> + <walker-tcp.version>3.2.0</walker-tcp.version> + <walker-push-group.version>3.2.0</walker-push-group.version> + + <dom4j.version>2.1.3</dom4j.version> + <commons-configuration.version>1.8</commons-configuration.version> + <commons-io.version>2.11.0</commons-io.version> + <commons-collection.version>4.4</commons-collection.version> + <commons-cli.version>1.4</commons-cli.version> + <ansj-seg.version>5.1.6</ansj-seg.version> + <zxing-core.version>3.4.0</zxing-core.version> + <kaptcha.version>2.3.2</kaptcha.version> + <univocity-parsers.version>2.9.1</univocity-parsers.version> + <bouncycastle.version>1.59</bouncycastle.version> + <easyexcel.version>3.2.0</easyexcel.version> + <poi.version>4.1.2</poi.version> + <jsch.version>0.1.55</jsch.version> + <top-sdk.version>1.0.5-SNAPSHOT</top-sdk.version> + <druid.version>1.2.8</druid.version> + <org-reflections.version>0.9.9</org-reflections.version> + <okhttp.version>4.9.0</okhttp.version> + <univocity-parsers.version>2.9.1</univocity-parsers.version> + <fastjson.version>1.2.83</fastjson.version> </properties> <dependencyManagement> <dependencies> + <dependency> + <groupId>com.github.ulisesbocchio</groupId> + <artifactId>jasypt-spring-boot-starter</artifactId> + <version>3.0.5</version> + </dependency> + <dependency> + <groupId>commons-io</groupId> + <artifactId>commons-io</artifactId> + <version>${commons-io.version}</version> + </dependency> + <dependency> + <groupId>org.apache.commons</groupId> + <artifactId>commons-collections4</artifactId> + <version>${commons-collection.version}</version> + </dependency> + + <!--鑾峰彇娴忚鍣ㄤ俊鎭� WebAgent瀵硅薄浣跨敤,璇ョ被搴撹兘楂樻晥鎿嶄綔CSV瀵煎叆瀵煎嚭, 2023/01/04 --> + <dependency> + <groupId>com.univocity</groupId> + <artifactId>univocity-parsers</artifactId> + <version>${univocity-parsers.version}</version> + </dependency> + + <dependency> + <groupId>com.alibaba</groupId> + <artifactId>druid</artifactId> + <version>${druid.version}</version> + </dependency> + <dependency> + <groupId>com.iplatform</groupId> + <artifactId>iplatform-core</artifactId> + <version>${walker-dependencies.version}</version> + </dependency> + <dependency> + <groupId>com.iplatform</groupId> + <artifactId>iplatform-model-pojo</artifactId> + <version>${walker-dependencies.version}</version> + </dependency> + <dependency> + <groupId>com.iplatform</groupId> + <artifactId>iplatform-base</artifactId> + <version>${walker-dependencies.version}</version> + </dependency> + <dependency> + <groupId>com.iplatform</groupId> + <artifactId>iplatform-base-admin</artifactId> + <version>${walker-dependencies.version}</version> + </dependency> + <dependency> + <groupId>com.iplatform</groupId> + <artifactId>iplatform-file-server</artifactId> + <version>${walker-dependencies.version}</version> + </dependency> + <dependency> + <groupId>com.iplatform</groupId> + <artifactId>iplatform-base-tcp</artifactId> + <version>${walker-dependencies.version}</version> + </dependency> + + <!-- easyExcel搴曞眰渚濊禆poi --> + <dependency> + <groupId>org.apache.poi</groupId> + <artifactId>poi</artifactId> + <version>${poi.version}</version> + <exclusions> + <exclusion> + <groupId>org.slf4j</groupId> + <artifactId>slf4j-api</artifactId> + </exclusion> + <exclusion> + <groupId>org.projectlombok</groupId> + <artifactId>lombok</artifactId> + </exclusion> + <exclusion> + <groupId>commons-codec</groupId> + <artifactId>commons-codec</artifactId> + </exclusion> + </exclusions> + </dependency> + <dependency> + <groupId>org.apache.poi</groupId> + <artifactId>poi-ooxml</artifactId> + <version>${poi.version}</version> + </dependency> + <!-- 閮ㄥ垎妯″潡寮曠敤锛屽湪姝ょ粺涓�瀹氫箟銆�2023-10-29 --> + <dependency> + <groupId>com.alibaba</groupId> + <artifactId>fastjson</artifactId> + <version>${fastjson.version}</version> + </dependency> <!-- 2023-06-07 杩愮淮绯荤粺鍩虹妯″潡 --> <dependency> @@ -37,6 +182,7 @@ <artifactId>low-consum-manage</artifactId> <version>${consum-base.version}</version> </dependency> + <!-- 2023-06-15 鏁版嵁搴撳璞″畾涔夋ā鍧� --> <dependency> @@ -46,9 +192,9 @@ </dependency> <dependency> - <groupId>com.iplatform</groupId> + <groupId>com.consum</groupId> <artifactId>iplatform-base-security-consum</artifactId> - <version>1.0.0-SNAPSHOT</version> + <version>3.2.0</version> </dependency> </dependencies> -- Gitblit v1.9.1