From 45385c0cdd1149f08eb5513594e316ba7b6f2aca Mon Sep 17 00:00:00 2001 From: DB <2502523450@qq.com> Date: Wed, 17 Apr 2024 11:21:41 +0800 Subject: [PATCH] =?UTF-8?q?=20=E7=A7=BB=E9=99=A4common=E6=A8=A1=E5=9D=97;?= =?UTF-8?q?=E8=B0=83=E6=95=B4Api,ClockIn,Core,Generator=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/cloudDb/core/dto/CloudCourseDto.java | 1 - .../cloudDb/handler/CloudBrandHandler.java | 1 - .../handler/CloudClassCardHandler.java | 2 +- .../cloudDb/handler/CloudClassHandler.java | 2 +- .../cloudDb/handler/CloudCourseHandler.java | 4 +- .../handler/CloudCustomerStudentHandler.java | 2 +- .../cloudDb/handler/CloudOrderHandler.java | 2 +- .../cloudDb/handler/CloudStaffHandler.java | 3 +- .../cloudDb/handler/CloudStoreHandler.java | 2 +- .../handler/TencentLocationHandler.java | 5 - .../wxWork/handler/WebHookSendHandler.java | 2 +- .../clockin/business/bo/ClockInRecordBo.java | 4 +- .../controller/ClassesController.java | 32 +- .../controller/ClockInRecordController.java | 14 +- .../controller/StaffClassesController.java | 34 +- .../clockin/business/dto/StaffClassesDto.java | 9 +- .../cpop/clockin/business/entity/Classes.java | 10 - .../clockin/business/entity/ClockInDept.java | 19 - .../clockin/business/entity/ClockInStaff.java | 15 - .../business/entity/ClockInStaffMidDept.java | 5 - .../clockin/business/entity/StaffClasses.java | 11 - .../service/impl/StaffClassesServiceImpl.java | 8 +- .../cpop/clockin/business/vo/ClassesVo.java | 9 +- .../clockin/business/vo/StaffClassesVo.java | 16 +- Cpop-Core/pom.xml | 120 +-- .../{annontation => anno}/OperationLog.java | 2 +- .../{annontation => anno}/SignatureCheck.java | 2 +- .../SimpleSignatureCheck.java | 2 +- .../StringArrayConvert.java | 2 +- .../cpop/core/aspect/OperationLogAspect.java | 33 +- .../core/aspect/SignatureCheckAspect.java | 17 +- .../aspect/SimpleSignatureCheckAspect.java | 16 +- .../core/base/entity/BaseInsertListener.java | 15 +- .../core/base/entity/BaseUpdateListener.java | 13 +- .../entity/FastJson2JsonRedisSerializer.java | 39 +- .../com/cpop/core/base/entity/LoginForm.java | 35 - .../cpop/core/base/entity/LoginSuccess.java | 2 + .../com/cpop/core/base/entity/LoginUser.java | 156 ---- .../core/base/entity/MultipartFileDto.java | 115 --- .../com/cpop/core/base/entity/PageDomain.java | 3 +- .../com/cpop/core/base/entity/Permission.java | 7 +- .../com/cpop/core/base/{ => entity}/R.java | 7 +- .../entity/loginInfo/MallStaffLoginInfo.java | 48 - .../entity/loginInfo/MiniUserLoginInfo.java | 58 -- .../entity/loginInfo/OamStaffLoginInfo.java | 47 - .../com/cpop/core/base/enums/CycleEnum.java | 56 ++ .../cpop/core/base/enums/ErrorCodeEnum.java | 82 ++ .../com/cpop/core/base/enums/SourceType.java | 27 - .../com/cpop/core/base/enums/UserType.java | 16 +- .../core/base/exception/BaseException.java | 22 +- .../CpopAuthenticationException.java | 26 - .../table/{SysConfig.java => Config.java} | 2 +- ...SysOperationLog.java => OperationLog.java} | 2 +- .../base/table/{SysUser.java => User.java} | 2 +- .../core/config/AsyncScheduledTaskConfig.java | 22 +- .../com/cpop/core/config/CoreInitConfig.java | 29 + .../java/com/cpop/core/config/CpopConfig.java | 15 +- .../com/cpop/core/config/FilterConfig.java | 4 +- .../com/cpop/core/config/RedisConfig.java | 54 +- .../cpop/core/config/RestTemplateConfig.java | 13 +- .../com/cpop/core/config/SecurityConfig.java | 215 ----- .../com/cpop/core/config/ServerConfig.java | 4 +- .../core/config/TencentCosProperties.java | 40 - .../com/cpop/core/constant/Constants.java | 217 +++++ .../com/cpop/core/constant/HttpStatus.java | 93 ++ .../java/com/cpop/core/constant/RedisKey.java | 19 + .../core/filter/JwtAuthenticationFilter.java | 163 ---- .../cpop/core/filter/RepeatableFilter.java | 11 +- .../core/filter/RepeatedlyRequestWrapper.java | 13 +- .../java/com/cpop/core/filter/XssFilter.java | 8 +- .../filter/XssHttpServletRequestWrapper.java | 13 +- .../MiniProgramAuthenticationFilter.java | 86 -- .../MiniProgramAuthenticationProvider.java | 40 - .../MiniProgramAuthenticationToken.java | 72 -- .../gateway/sys/SysAuthenticationFilter.java | 63 -- .../sys/SysAuthenticationProvider.java | 49 - .../gateway/sys/SysAuthenticationToken.java | 72 -- .../core/handler/GlobalExceptionHandler.java | 74 +- .../core/handler/JwtAccessDeniedHandler.java | 33 - .../handler/JwtAuthenticationEntryPoint.java | 33 - .../core/handler/JwtLogoutSuccessHandler.java | 77 -- .../core/handler/LoginFailureHandler.java | 67 -- .../core/handler/LoginSuccessHandler.java | 90 -- .../cpop/core/handler/TencentCosHandler.java | 159 ---- .../core/listen/JamboxSaTokenListener.java | 111 +++ ...LogListen.java => OperationLogListen.java} | 17 +- .../com/cpop/core/mapper/ConfigMapper.java | 14 + .../java/com/cpop/core/mapper/CoreMapper.java | 133 --- .../cpop/core/mapper/OperationLogMapper.java | 14 + .../java/com/cpop/core/mapper/UserMapper.java | 14 + .../com/cpop/core/service/ConfigService.java | 18 + .../com/cpop/core/service/CoreService.java | 164 ---- .../core/service/OperationLogService.java | 27 + .../com/cpop/core/service/UserService.java | 14 + .../impl/AuthorityPermissionService.java | 39 - .../core/service/impl/ConfigServiceImpl.java | 49 + .../core/service/impl/CoreServiceImpl.java | 302 ------- .../impl/OamStaffDetailsServiceImpl.java | 96 -- .../service/impl/OperationLogServiceImpl.java | 57 ++ .../core/service/impl/RedisServiceImpl.java | 2 +- .../core/service/impl/UserServiceImpl.java | 18 + .../CpopDataSourceShardingStrategy.java | 30 + .../json/ArrayToStringDeserializer.java | 2 +- .../json/StringToArraySerializer.java | 1 - .../core/strategy/login/LoginStrategy.java | 23 - .../strategy/login/MallLoginStrategy.java | 106 --- .../strategy/login/MiniLoginStrategy.java | 171 ---- .../core/strategy/login/OamLoginStrategy.java | 98 -- .../cpop/core/utils/CpopSignatureUtils.java | 133 --- .../java/com/cpop/core/utils/JsonUtils.java | 30 + .../java/com/cpop/core/utils/JwtUtils.java | 91 -- .../com/cpop/core/utils/PasswordEncoder.java | 38 - .../com/cpop/core/utils/SecurityUtils.java | 74 -- .../com/cpop/core/utils/ServletUtils.java | 156 ++++ .../java/com/cpop/core/utils/SpringUtils.java | 2 +- .../cpop/core/utils/{sql => }/SqlUtils.java | 4 +- .../java/com/cpop/core/utils/StringUtils.java | 582 ++++++++++++ .../com/cpop/core/utils/bean/BeanUtils.java | 193 ++++ .../cpop/core/utils/file/FileUploadUtils.java | 9 +- .../com/cpop/core/utils/file/FileUtils.java | 20 +- .../com/cpop/core/utils/html/EscapeUtil.java | 133 +++ .../com/cpop/core/utils/html/HTMLFilter.java | 499 ++++++++++ .../com/cpop/core/utils/http/HttpHelper.java | 51 ++ .../com/cpop/core/utils/http/HttpUtils.java | 376 ++++++++ .../com/cpop/core/utils/ip/AddressUtils.java | 50 + .../java/com/cpop/core/utils/ip/IpUtils.java | 196 ++++ .../com/cpop/core/utils/text/CharsetKit.java | 91 ++ .../com/cpop/core/utils/text/Convert.java | 854 ++++++++++++++++++ .../cpop/core/utils/text/StrFormatter.java | 77 ++ .../java/com/cpop/core/utils/uuid/Seq.java | 8 +- .../src/main/resources/application-core.yml | 12 - .../main/resources/mapper/ConfigMapper.xml | 7 + .../src/main/resources/mapper/CoreMapper.xml | 343 ------- .../resources/mapper/OperationLogMapper.xml | 7 + .../src/main/resources/mapper/UserMapper.xml | 7 + Cpop-Generator/pom.xml | 6 - .../com/cpop/generator/CpopGenerator.java | 9 +- .../static/i18n/messages_en_US.properties | 3 - .../static/i18n/messages_zh_CN.properties | 3 - .../BackstageBusinessDataController.java | 2 +- .../BackstageBusinessIntroController.java | 2 +- .../BackstageCompanyIntroController.java | 2 +- .../BackstageCooperationController.java | 4 +- .../BackstageCooperationTypeController.java | 2 +- .../BackstageDevelopmentController.java | 4 +- .../BackstageEasyLearnController.java | 4 +- .../BackstageNavigationController.java | 2 +- .../BackstageWebProductController.java | 2 +- .../backstage/EasyLearnController.java | 4 +- .../mini/MiniCardTemplateController.java | 2 +- .../mini/MiniEasyLearnController.java | 2 +- .../controller/website/WebsiteController.java | 16 +- .../business/service/WebsiteService.java | 2 +- .../service/impl/CardTemplateServiceImpl.java | 1 - .../service/impl/CooperationServiceImpl.java | 2 +- .../service/impl/DevelopmentServiceImpl.java | 2 +- .../impl/EasyLearnOrderServiceImpl.java | 5 +- .../service/impl/PlugServiceImpl.java | 2 +- .../service/impl/WebsiteServiceImpl.java | 4 +- .../static/i18n/messages_en_US.properties | 4 - .../static/i18n/messages_zh_CN.properties | 4 - .../mall/web/CpopMallWebApplicationTests.java | 1 - .../cpop/mall/business/bo/AdvanceOrderBo.java | 2 +- .../com/cpop/mall/business/bo/ProductBo.java | 2 +- .../mall/business/bo/ProductRecordBo.java | 2 +- .../business/bo/ProductSpecificationBo.java | 2 +- .../com/cpop/mall/business/bo/StaffBo.java | 1 - .../BackstageCarouselController.java | 7 +- .../BackstageMallRoleController.java | 4 +- .../backstage/BackstageOrderController.java | 8 +- .../BackstageOrderRefundController.java | 8 +- .../backstage/BackstageProductController.java | 22 +- .../backstage/BackstageStaffController.java | 3 +- .../controller/mini/MiniBrandController.java | 4 +- .../controller/mini/MiniOrderController.java | 20 +- .../mini/MiniProductController.java | 16 +- .../mini/MiniShoppingCartController.java | 15 +- .../business/service/RoleBrandService.java | 2 +- .../service/impl/CarouselServiceImpl.java | 3 +- .../service/impl/OrderRefundServiceImpl.java | 5 +- .../service/impl/OrderServiceImpl.java | 5 +- .../service/impl/ProductServiceImpl.java | 5 +- .../service/impl/RoleBrandServiceImpl.java | 5 +- .../service/impl/ShoppingCartServiceImpl.java | 3 +- .../service/impl/StaffServiceImpl.java | 8 +- .../cpop/mall/business/vo/MallRolePageVo.java | 2 +- .../business/vo/MiniShoppingCartPageVo.java | 1 - .../cpop/mall/business/vo/ProductInfoVo.java | 2 +- .../cpop/mall/business/vo/ProductPageVo.java | 3 +- .../mall/business/vo/ProductRecordVo.java | 2 +- .../vo/ProductSpecificationCreateVo.java | 3 +- .../business/vo/ProductSpecificationVo.java | 2 +- .../cpop/mall/business/vo/StaffPageVo.java | 1 - .../buyRestrict/MemberRestrictStrategy.java | 1 - .../NewCustomerRestrictStrategy.java | 1 - .../buyRestrict/UserRestrictStrategy.java | 1 - .../framework/task/OrderDetailAsyncTask.java | 4 +- .../cpop/mini/business/entity/MiniUser.java | 5 +- .../static/i18n/messages_en_US.properties | 4 - .../static/i18n/messages_zh_CN.properties | 4 - .../java/com/cpop/oam/web/CpopApiTests.java | 6 - .../java/com/cpop/oam/web/CpopClueTests.java | 13 - .../java/com/cpop/oam/web/CpopCoreTests.java | 4 - .../com/cpop/oam/web/CpopEasyLearnTest.java | 9 +- .../com/cpop/oam/web/CpopImportTests.java | 5 +- .../cpop/oam/web/CpopOldDataSyncTests.java | 2 +- .../java/com/cpop/oam/web/CpopWxCpTests.java | 6 - .../cpop/oam/business/bo/DataImportBo.java | 3 - .../com/cpop/oam/business/bo/StaffBo.java | 2 +- .../cpop/oam/business/bo/TaskDemandBo.java | 1 - .../com/cpop/oam/business/bo/TaskItemBo.java | 2 - .../cpop/oam/business/bo/TaskIterationBo.java | 1 - .../cpop/oam/business/bo/TaskProgressBo.java | 2 +- .../cpop/oam/business/bo/TaskWorkOrderBo.java | 1 - .../business/bo/TaskWorkOrderRecordBo.java | 1 - .../BackstageBrandManagerController.java | 2 +- .../BackstageBusinessController.java | 2 +- .../BackstageCloudDataController.java | 2 +- .../backstage/BackstageClueController.java | 11 +- .../BackstageDataImportController.java | 2 +- .../backstage/BackstageDeptController.java | 4 +- .../backstage/BackstageDutyController.java | 2 +- .../BackstageFinanceReimburseController.java | 2 +- .../backstage/BackstageOamMallController.java | 11 +- .../backstage/BackstagePutOffController.java | 5 +- .../BackstageSignGoalController.java | 12 +- .../backstage/BackstageStaffController.java | 9 +- .../BackstageStorePlugController.java | 2 +- .../BackstageSysConfigController.java | 4 +- .../BackstageTaskDemandController.java | 2 +- .../BackstageTaskTechnologyController.java | 2 +- .../BackstageTaskWorkOrderController.java | 4 +- .../BackstageTechnologyToolController.java | 8 +- .../backstage/BackstageWxCpController.java | 2 +- .../backstage/BackstageWxOpenController.java | 10 +- .../backstage/BackstageWxPayController.java | 5 +- .../CallBackCloudCallbackController.java | 3 +- .../callback/CallbackCloudController.java | 2 +- .../controller/mini/MiniSummitController.java | 3 +- .../service/FinanceReimburseService.java | 2 +- .../service/TaskWorkOrderService.java | 2 +- .../service/impl/BrandManagerServiceImpl.java | 5 +- .../service/impl/BusinessServiceImpl.java | 9 +- .../service/impl/CluePutOffServiceImpl.java | 5 +- .../service/impl/ClueRecordServiceImpl.java | 11 - .../service/impl/ClueServiceImpl.java | 3 +- .../service/impl/CommonServiceImpl.java | 3 - .../service/impl/DataImportServiceImpl.java | 11 +- .../impl/FinanceReimburseServiceImpl.java | 5 +- .../service/impl/OamMallServiceImpl.java | 14 +- .../service/impl/OamWxCpServiceImpl.java | 3 +- .../service/impl/SignGoalServiceImpl.java | 5 +- .../service/impl/StaffServiceImpl.java | 4 +- .../service/impl/TaskDemandServiceImpl.java | 4 +- .../service/impl/TaskServiceImpl.java | 9 +- .../impl/TaskStaffGroupServiceImpl.java | 5 - .../impl/TaskWorkOrderServiceImpl.java | 5 +- .../vo/FinanceReimburseAuditPageVo.java | 1 - .../oam/business/vo/PersonTaskPageVo.java | 3 +- .../com/cpop/oam/business/vo/StaffPageVo.java | 2 +- .../cpop/oam/framework/config/InitConfig.java | 16 +- ...CloudSyncBrandOrStoreCallbackStrategy.java | 3 - .../framework/tasks/OamScheduledTasks.java | 2 - .../framewok/handler/wxPay/WxPayHandler.java | 3 - .../pay/framewok/task/WxPayAsyncTask.java | 1 - Cpop-System/pom.xml | 5 - .../backstage/BackstageBrandController.java | 11 +- .../BackstageDictDataController.java | 6 +- .../BackstageDictTypeController.java | 6 +- .../backstage/BackstageLoginController.java | 2 +- .../backstage/BackstageMenuController.java | 4 +- .../backstage/BackstageRoleController.java | 4 +- .../backstage/BackstageStoreController.java | 2 +- .../BackstageStoreSignController.java | 2 +- .../BackstageSysCommonController.java | 7 +- .../mini/MiniSysCommonController.java | 9 +- .../cpop/system/business/entity/Brand.java | 3 +- .../business/service/DictTypeService.java | 1 - .../service/impl/BrandServiceImpl.java | 5 +- .../service/impl/DictDataServiceImpl.java | 7 +- .../service/impl/DictTypeServiceImpl.java | 4 +- .../service/impl/LoginServiceImpl.java | 5 - .../service/impl/MenuServiceImpl.java | 4 +- .../service/impl/RoleServiceImpl.java | 6 +- .../service/impl/StoreRenewServiceImpl.java | 4 - .../service/impl/StoreServiceImpl.java | 5 +- .../service/impl/StoreSignServiceImpl.java | 2 +- .../cpop/system/business/vo/StorePageVo.java | 2 - .../system/framework}/enums/InitRoleEnum.java | 3 +- .../system/framework}/enums/OrderSource.java | 2 +- .../system/framework/utils/DictUtils.java | 2 - pom.xml | 21 +- 292 files changed, 4776 insertions(+), 4544 deletions(-) rename Cpop-Core/src/main/java/com/cpop/core/{annontation => anno}/OperationLog.java (91%) rename Cpop-Core/src/main/java/com/cpop/core/{annontation => anno}/SignatureCheck.java (87%) rename Cpop-Core/src/main/java/com/cpop/core/{annontation => anno}/SimpleSignatureCheck.java (87%) rename Cpop-Core/src/main/java/com/cpop/core/{annontation => anno}/StringArrayConvert.java (95%) delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/base/entity/LoginForm.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/base/entity/LoginUser.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/base/entity/MultipartFileDto.java rename Cpop-Core/src/main/java/com/cpop/core/base/{ => entity}/R.java (94%) delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/base/entity/loginInfo/MallStaffLoginInfo.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/base/entity/loginInfo/MiniUserLoginInfo.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/base/entity/loginInfo/OamStaffLoginInfo.java create mode 100644 Cpop-Core/src/main/java/com/cpop/core/base/enums/CycleEnum.java create mode 100644 Cpop-Core/src/main/java/com/cpop/core/base/enums/ErrorCodeEnum.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/base/enums/SourceType.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/base/exception/CpopAuthenticationException.java rename Cpop-Core/src/main/java/com/cpop/core/base/table/{SysConfig.java => Config.java} (93%) rename Cpop-Core/src/main/java/com/cpop/core/base/table/{SysOperationLog.java => OperationLog.java} (95%) rename Cpop-Core/src/main/java/com/cpop/core/base/table/{SysUser.java => User.java} (96%) create mode 100644 Cpop-Core/src/main/java/com/cpop/core/config/CoreInitConfig.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/config/SecurityConfig.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/config/TencentCosProperties.java create mode 100644 Cpop-Core/src/main/java/com/cpop/core/constant/Constants.java create mode 100644 Cpop-Core/src/main/java/com/cpop/core/constant/HttpStatus.java create mode 100644 Cpop-Core/src/main/java/com/cpop/core/constant/RedisKey.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/filter/JwtAuthenticationFilter.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/gateway/miniProgram/MiniProgramAuthenticationFilter.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/gateway/miniProgram/MiniProgramAuthenticationProvider.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/gateway/miniProgram/MiniProgramAuthenticationToken.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/gateway/sys/SysAuthenticationFilter.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/gateway/sys/SysAuthenticationProvider.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/gateway/sys/SysAuthenticationToken.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/handler/JwtAccessDeniedHandler.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/handler/JwtAuthenticationEntryPoint.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/handler/JwtLogoutSuccessHandler.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/handler/LoginFailureHandler.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/handler/LoginSuccessHandler.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/handler/TencentCosHandler.java create mode 100644 Cpop-Core/src/main/java/com/cpop/core/listen/JamboxSaTokenListener.java rename Cpop-Core/src/main/java/com/cpop/core/listen/{SysOperationLogListen.java => OperationLogListen.java} (55%) create mode 100644 Cpop-Core/src/main/java/com/cpop/core/mapper/ConfigMapper.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/mapper/CoreMapper.java create mode 100644 Cpop-Core/src/main/java/com/cpop/core/mapper/OperationLogMapper.java create mode 100644 Cpop-Core/src/main/java/com/cpop/core/mapper/UserMapper.java create mode 100644 Cpop-Core/src/main/java/com/cpop/core/service/ConfigService.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/service/CoreService.java create mode 100644 Cpop-Core/src/main/java/com/cpop/core/service/OperationLogService.java create mode 100644 Cpop-Core/src/main/java/com/cpop/core/service/UserService.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/service/impl/AuthorityPermissionService.java create mode 100644 Cpop-Core/src/main/java/com/cpop/core/service/impl/ConfigServiceImpl.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/service/impl/CoreServiceImpl.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/service/impl/OamStaffDetailsServiceImpl.java create mode 100644 Cpop-Core/src/main/java/com/cpop/core/service/impl/OperationLogServiceImpl.java create mode 100644 Cpop-Core/src/main/java/com/cpop/core/service/impl/UserServiceImpl.java create mode 100644 Cpop-Core/src/main/java/com/cpop/core/strategy/dataSourceSharding/CpopDataSourceShardingStrategy.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/strategy/login/LoginStrategy.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/strategy/login/MallLoginStrategy.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/strategy/login/MiniLoginStrategy.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/strategy/login/OamLoginStrategy.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/utils/CpopSignatureUtils.java create mode 100644 Cpop-Core/src/main/java/com/cpop/core/utils/JsonUtils.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/utils/JwtUtils.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/utils/PasswordEncoder.java delete mode 100644 Cpop-Core/src/main/java/com/cpop/core/utils/SecurityUtils.java create mode 100644 Cpop-Core/src/main/java/com/cpop/core/utils/ServletUtils.java rename Cpop-Core/src/main/java/com/cpop/core/utils/{sql => }/SqlUtils.java (95%) create mode 100644 Cpop-Core/src/main/java/com/cpop/core/utils/StringUtils.java create mode 100644 Cpop-Core/src/main/java/com/cpop/core/utils/bean/BeanUtils.java create mode 100644 Cpop-Core/src/main/java/com/cpop/core/utils/html/EscapeUtil.java create mode 100644 Cpop-Core/src/main/java/com/cpop/core/utils/html/HTMLFilter.java create mode 100644 Cpop-Core/src/main/java/com/cpop/core/utils/http/HttpHelper.java create mode 100644 Cpop-Core/src/main/java/com/cpop/core/utils/http/HttpUtils.java create mode 100644 Cpop-Core/src/main/java/com/cpop/core/utils/ip/AddressUtils.java create mode 100644 Cpop-Core/src/main/java/com/cpop/core/utils/ip/IpUtils.java create mode 100644 Cpop-Core/src/main/java/com/cpop/core/utils/text/CharsetKit.java create mode 100644 Cpop-Core/src/main/java/com/cpop/core/utils/text/Convert.java create mode 100644 Cpop-Core/src/main/java/com/cpop/core/utils/text/StrFormatter.java delete mode 100644 Cpop-Core/src/main/resources/application-core.yml create mode 100644 Cpop-Core/src/main/resources/mapper/ConfigMapper.xml delete mode 100644 Cpop-Core/src/main/resources/mapper/CoreMapper.xml create mode 100644 Cpop-Core/src/main/resources/mapper/OperationLogMapper.xml create mode 100644 Cpop-Core/src/main/resources/mapper/UserMapper.xml rename {Cpop-Core/src/main/java/com/cpop/core/base => Cpop-System/src/main/java/com/cpop/system/framework}/enums/InitRoleEnum.java (94%) rename {Cpop-Core/src/main/java/com/cpop/core/base => Cpop-System/src/main/java/com/cpop/system/framework}/enums/OrderSource.java (93%) diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudCourseDto.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudCourseDto.java index 9440626..ee73a80 100644 --- a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudCourseDto.java +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudCourseDto.java @@ -1,7 +1,6 @@ package com.cpop.api.cloudDb.core.dto; import com.google.gson.annotations.SerializedName; -import io.swagger.models.auth.In; import lombok.Data; import java.util.List; diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudBrandHandler.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudBrandHandler.java index 9d268d2..f5046c8 100644 --- a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudBrandHandler.java +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudBrandHandler.java @@ -3,7 +3,6 @@ package com.cpop.api.cloudDb.handler; import com.alibaba.fastjson.JSONObject; import com.cpop.api.cloudDb.core.constant.CloudDbUrl; import com.cpop.api.cloudDb.core.dto.CloudBrandDto; -import com.cpop.common.utils.StringUtils; import com.cpop.core.base.exception.UtilException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudClassCardHandler.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudClassCardHandler.java index f5c3842..9438d2a 100644 --- a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudClassCardHandler.java +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudClassCardHandler.java @@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSONObject; import com.cpop.api.cloudDb.core.constant.CloudDbUrl; import com.cpop.api.cloudDb.core.dto.CloudClassCardDto; import com.cpop.api.cloudDb.core.dto.CloudClassCardRecordDto; -import com.cpop.common.utils.StringUtils; +import com.cpop.core.utils.StringUtils; import com.cpop.core.base.entity.ExtendPage; import com.cpop.core.base.exception.ServiceException; import com.cpop.core.base.exception.UtilException; diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudClassHandler.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudClassHandler.java index ad21ce0..371bb00 100644 --- a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudClassHandler.java +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudClassHandler.java @@ -5,7 +5,7 @@ import com.cpop.api.cloudDb.core.constant.CloudDbUrl; import com.cpop.api.cloudDb.core.dto.CloudClassDto; import com.cpop.api.cloudDb.core.dto.CloudClassStudentDto; import com.cpop.api.cloudDb.core.dto.CloudCourseDto; -import com.cpop.common.utils.StringUtils; +import com.cpop.core.utils.StringUtils; import com.cpop.core.base.exception.UtilException; import com.mybatisflex.core.paginate.Page; import org.springframework.beans.factory.annotation.Autowired; diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudCourseHandler.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudCourseHandler.java index 431ec19..84b67b0 100644 --- a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudCourseHandler.java +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudCourseHandler.java @@ -3,10 +3,8 @@ package com.cpop.api.cloudDb.handler; import com.alibaba.fastjson.JSONObject; import com.cpop.api.cloudDb.core.constant.CloudDbUrl; import com.cpop.api.cloudDb.core.dto.CloudCourseDto; -import com.cpop.api.cloudDb.core.dto.CloudCourseStudentDto; import com.cpop.api.cloudDb.core.dto.CloudCourseStudentListDto; -import com.cpop.api.cloudDb.core.dto.CloudCustomerDto; -import com.cpop.common.utils.StringUtils; +import com.cpop.core.utils.StringUtils; import com.cpop.core.base.exception.UtilException; import com.mybatisflex.core.paginate.Page; import lombok.extern.slf4j.Slf4j; diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudCustomerStudentHandler.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudCustomerStudentHandler.java index ef52e19..8ffd03e 100644 --- a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudCustomerStudentHandler.java +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudCustomerStudentHandler.java @@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSONObject; import com.cpop.api.cloudDb.core.constant.CloudDbUrl; import com.cpop.api.cloudDb.core.dto.CloudCustomerDto; import com.cpop.api.cloudDb.core.dto.CloudStudentDto; -import com.cpop.common.utils.StringUtils; +import com.cpop.core.utils.StringUtils; import com.cpop.core.base.exception.UtilException; import com.mybatisflex.core.paginate.Page; import lombok.extern.slf4j.Slf4j; diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudOrderHandler.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudOrderHandler.java index 1761e28..7537a26 100644 --- a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudOrderHandler.java +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudOrderHandler.java @@ -3,7 +3,7 @@ package com.cpop.api.cloudDb.handler; import com.alibaba.fastjson.JSONObject; import com.cpop.api.cloudDb.core.constant.CloudDbUrl; import com.cpop.api.cloudDb.core.dto.CloudOrderDto; -import com.cpop.common.utils.StringUtils; +import com.cpop.core.utils.StringUtils; import com.cpop.core.base.entity.ExtendPage; import com.cpop.core.base.exception.UtilException; import com.mybatisflex.core.paginate.Page; diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudStaffHandler.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudStaffHandler.java index 7e47771..1a2976c 100644 --- a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudStaffHandler.java +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudStaffHandler.java @@ -2,9 +2,8 @@ package com.cpop.api.cloudDb.handler; import com.alibaba.fastjson.JSONObject; import com.cpop.api.cloudDb.core.constant.CloudDbUrl; -import com.cpop.api.cloudDb.core.dto.CloudClassDto; import com.cpop.api.cloudDb.core.dto.CloudStaffDto; -import com.cpop.common.utils.StringUtils; +import com.cpop.core.utils.StringUtils; import com.cpop.core.base.exception.UtilException; import com.mybatisflex.core.paginate.Page; import org.springframework.beans.factory.annotation.Autowired; diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudStoreHandler.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudStoreHandler.java index 5cf5c8a..a538dcb 100644 --- a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudStoreHandler.java +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudStoreHandler.java @@ -4,7 +4,7 @@ import com.alibaba.fastjson.JSONObject; import com.cpop.api.cloudDb.core.constant.CloudDbUrl; import com.cpop.api.cloudDb.core.dto.CloudStoreActiveDto; import com.cpop.api.cloudDb.core.dto.CloudStoreDto; -import com.cpop.common.utils.StringUtils; +import com.cpop.core.utils.StringUtils; import com.cpop.core.base.exception.UtilException; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/Cpop-Api/src/main/java/com/cpop/api/tencent/location/handler/TencentLocationHandler.java b/Cpop-Api/src/main/java/com/cpop/api/tencent/location/handler/TencentLocationHandler.java index 1a0009c..18ba3a8 100644 --- a/Cpop-Api/src/main/java/com/cpop/api/tencent/location/handler/TencentLocationHandler.java +++ b/Cpop-Api/src/main/java/com/cpop/api/tencent/location/handler/TencentLocationHandler.java @@ -1,14 +1,9 @@ package com.cpop.api.tencent.location.handler; -import cn.hutool.crypto.digest.MD5; import com.alibaba.fastjson.JSONObject; import com.cpop.api.tencent.location.core.constant.TencentApiUrl; -import com.cpop.common.utils.http.HttpUtils; -import com.cpop.core.base.exception.UtilException; import com.cpop.core.utils.SpringUtils; -import okhttp3.Response; import org.springframework.stereotype.Component; -import org.springframework.util.DigestUtils; import org.springframework.web.client.RestTemplate; import java.io.IOException; diff --git a/Cpop-Api/src/main/java/com/cpop/api/tencent/wxWork/handler/WebHookSendHandler.java b/Cpop-Api/src/main/java/com/cpop/api/tencent/wxWork/handler/WebHookSendHandler.java index ddfcc95..bab80f0 100644 --- a/Cpop-Api/src/main/java/com/cpop/api/tencent/wxWork/handler/WebHookSendHandler.java +++ b/Cpop-Api/src/main/java/com/cpop/api/tencent/wxWork/handler/WebHookSendHandler.java @@ -3,7 +3,7 @@ package com.cpop.api.tencent.wxWork.handler; import com.alibaba.fastjson.JSONObject; import com.cpop.api.tencent.wxWork.core.config.WxWorkApiConfig; import com.cpop.api.tencent.wxWork.webHook.WebHookSendTextRequest; -import com.cpop.common.utils.http.HttpUtils; +import com.cpop.core.utils.http.HttpUtils; import okhttp3.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/bo/ClockInRecordBo.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/bo/ClockInRecordBo.java index 50d1749..8015e65 100644 --- a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/bo/ClockInRecordBo.java +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/bo/ClockInRecordBo.java @@ -1,7 +1,7 @@ package com.cpop.clockin.business.bo; import com.alibaba.excel.annotation.ExcelProperty; -import io.swagger.annotations.ApiModel; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; /** @@ -10,7 +10,7 @@ import lombok.Data; * @Version: 1.0 */ @Data -@ApiModel(value = "打卡记录VO") +@Schema(description = "打卡记录VO") public class ClockInRecordBo { @ExcelProperty(value = "姓名") private String staffName; diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/controller/ClassesController.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/controller/ClassesController.java index 1358e02..3cd0294 100644 --- a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/controller/ClassesController.java +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/controller/ClassesController.java @@ -1,7 +1,10 @@ package com.cpop.clockin.business.controller; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.mybatisflex.core.paginate.Page; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; @@ -13,9 +16,6 @@ import org.springframework.beans.factory.annotation.Autowired; import com.cpop.clockin.business.entity.Classes; import com.cpop.clockin.business.service.ClassesService; import org.springframework.web.bind.annotation.RestController; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; import java.io.Serializable; import java.util.List; @@ -26,7 +26,7 @@ import java.util.List; * @since 2024-01-23 */ @RestController -@Api(tags = "打卡班次表接口") +@Tag(name = "打卡班次表接口") @RequestMapping("/backstage/classes") public class ClassesController { @@ -40,8 +40,8 @@ public class ClassesController { * @return {@code true} 添加成功,{@code false} 添加失败 */ @PostMapping("/save") - @ApiOperation("保存打卡班次表") - public R save(@RequestBody @ApiParam("打卡班次表") Classes classes) { + @Operation(summary = "保存打卡班次表") + public R save(@RequestBody @Parameter(description = "打卡班次表") Classes classes) { classesService.save(classes); return R.ok(); } @@ -53,8 +53,8 @@ public class ClassesController { * @return {@code true} 删除成功,{@code false} 删除失败 */ @DeleteMapping("/remove/{id}") - @ApiOperation("根据主键删除打卡班次表") - public R remove(@PathVariable @ApiParam("打卡班次表主键") Serializable id) { + @Operation(summary = "根据主键删除打卡班次表") + public R remove(@PathVariable @Parameter(description = "打卡班次表主键") Serializable id) { classesService.removeById(id); return R.ok(); } @@ -66,8 +66,8 @@ public class ClassesController { * @return {@code true} 更新成功,{@code false} 更新失败 */ @PutMapping("/update") - @ApiOperation("根据主键更新打卡班次表") - public R update(@RequestBody @ApiParam("打卡班次表主键") Classes classes) { + @Operation(summary = "根据主键更新打卡班次表") + public R update(@RequestBody @Parameter(description = "打卡班次表主键") Classes classes) { classesService.updateById(classes); return R.ok(); } @@ -78,7 +78,7 @@ public class ClassesController { * @return 所有数据 */ @GetMapping("/list") - @ApiOperation("查询所有打卡班次表") + @Operation(summary = "查询所有打卡班次表") public R> list() { return R.ok(classesService.list()); } @@ -90,8 +90,8 @@ public class ClassesController { * @return 打卡班次表详情 */ @GetMapping("/getInfo/{id}") - @ApiOperation("根据主键获取打卡班次表") - public R getInfo(@PathVariable @ApiParam("打卡班次表主键") Serializable id) { + @Operation(summary = "根据主键获取打卡班次表") + public R getInfo(@PathVariable @Parameter(description = "打卡班次表主键") Serializable id) { return R.ok(classesService.getById(id)); } @@ -102,8 +102,8 @@ public class ClassesController { * @return 分页对象 */ @GetMapping("/page") - @ApiOperation("分页查询打卡班次表") - public R> page(@ApiParam("分页信息") Page page) { + @Operation(summary = "分页查询打卡班次表") + public R> page(@Parameter(description = "分页信息") Page page) { return R.ok(classesService.page(page)); } diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/controller/ClockInRecordController.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/controller/ClockInRecordController.java index 4ed08ae..5d00537 100644 --- a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/controller/ClockInRecordController.java +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/controller/ClockInRecordController.java @@ -4,16 +4,16 @@ import com.alibaba.excel.EasyExcel; import com.cpop.clockin.business.bo.EmployeeAttendanceBo; import com.cpop.clockin.business.service.ClockInRecordService; import com.cpop.clockin.framework.constant.ClockInConstant; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.core.service.RedisService; import com.fasterxml.jackson.databind.ObjectMapper; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.tags.Tag; +import jakarta.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; -import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.net.URLEncoder; import java.text.ParseException; @@ -27,7 +27,7 @@ import java.util.List; * @Version: 1.0 */ @RestController -@Api(tags = "打卡记录接口") +@Tag(name = "打卡记录接口") @RequestMapping("/backstage/clockInRecord") public class ClockInRecordController { @Autowired @@ -35,7 +35,7 @@ public class ClockInRecordController { @Autowired private RedisService redisService; @PostMapping("/upload") - @ApiOperation("上传钉钉Excel表") + @Operation(summary = "上传钉钉Excel表") public R uploadRecord(@RequestParam("file") MultipartFile file) throws IOException, ParseException { /* List clockInRecordBoList = ; // 将对象数据返回给前端*/ @@ -43,7 +43,7 @@ public class ClockInRecordController { } @GetMapping("/output") - @ApiOperation("导出表格") + @Operation(summary = "导出表格") public void outPut(HttpServletResponse response) throws IOException { String manTimeJson = redisService.getCacheObject(ClockInConstant.MAN_TIME_JSON); /*byte[] bytes = manTimeJson.getBytes(); diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/controller/StaffClassesController.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/controller/StaffClassesController.java index 8023468..5fae2e6 100644 --- a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/controller/StaffClassesController.java +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/controller/StaffClassesController.java @@ -3,14 +3,14 @@ package com.cpop.clockin.business.controller; import com.cpop.clockin.business.dto.StaffClassesDto; import com.cpop.clockin.business.service.StaffClassesService; import com.cpop.clockin.business.vo.StaffClassesVo; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.mybatisflex.core.paginate.Page; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.web.bind.annotation.*; import org.springframework.beans.factory.annotation.Autowired; import com.cpop.clockin.business.entity.StaffClasses; -import io.swagger.annotations.Api; -import io.swagger.annotations.ApiOperation; -import io.swagger.annotations.ApiParam; import java.io.Serializable; import java.util.List; @@ -21,7 +21,7 @@ import java.util.List; * @since 2024-01-23 */ @RestController -@Api(tags = "员工-班次关联表接口") +@Tag(name = "员工-班次关联表接口") @RequestMapping("/backstage/staffClasses") public class StaffClassesController { @@ -34,11 +34,11 @@ public class StaffClassesController { * @author: Yxz * @date: 2024/1/24 20:54 * @param: [staffClassesDto] - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R **/ @PostMapping("/save") - @ApiOperation("保存员工-班次关联表") - public R save(@RequestBody @ApiParam("员工-班次保存Dto") StaffClassesDto staffClassesDto) { + @Operation(summary = "保存员工-班次关联表") + public R save(@RequestBody @Parameter(description = "员工-班次保存Dto") StaffClassesDto staffClassesDto) { staffClassesService.saveAll(staffClassesDto); return R.ok(); } @@ -50,11 +50,11 @@ public class StaffClassesController { * @author: Yxz * @date: 2024/1/24 20:54 * @param: [staffClassesDto] - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R **/ @PutMapping("/update") - @ApiOperation("更新员工-班次关联表") - public R update(@RequestBody @ApiParam("员工-班次修改Dto") StaffClassesDto staffClassesDto) { + @Operation(summary = "更新员工-班次关联表") + public R update(@RequestBody @Parameter(description = "员工-班次修改Dto") StaffClassesDto staffClassesDto) { staffClassesService.updateAll(staffClassesDto); return R.ok(); } @@ -65,7 +65,7 @@ public class StaffClassesController { * @return 所有数据 */ @GetMapping("/list") - @ApiOperation("查询员工班次信息") + @Operation(summary = "查询员工班次信息") public R> list() { return R.ok(staffClassesService.getStaffClassesVolist()); } @@ -78,8 +78,8 @@ public class StaffClassesController { * @return 员工-班次关联表详情 */ @GetMapping("/getInfo/{id}") - @ApiOperation("根据主键获取员工-班次关联表") - public R getInfo(@PathVariable @ApiParam("员工-班次关联表主键") Serializable id) { + @Operation(summary = "根据主键获取员工-班次关联表") + public R getInfo(@PathVariable @Parameter(description = "员工-班次关联表主键") Serializable id) { return R.ok(staffClassesService.getById(id)); } @@ -89,11 +89,11 @@ public class StaffClassesController { * @author: Yxz * @date: 2024/1/24 20:55 * @param: [staffName] - * @return: com.cpop.core.base.R> + * @return: com.cpop.core.base.entity.R> **/ @GetMapping("/page") - @ApiOperation("分页查询员工-班次信息") - public R> page( @ApiParam("员工名称") @RequestParam(value = "staffName", required = false)String staffName) { + @Operation(summary = "分页查询员工-班次信息") + public R> page( @Parameter(description = "员工名称") @RequestParam(value = "staffName", required = false)String staffName) { return R.ok(staffClassesService.selectPage(staffName)); } diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/dto/StaffClassesDto.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/dto/StaffClassesDto.java index 63ce41a..fde0302 100644 --- a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/dto/StaffClassesDto.java +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/dto/StaffClassesDto.java @@ -1,7 +1,6 @@ package com.cpop.clockin.business.dto; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; /** @@ -10,10 +9,10 @@ import lombok.Data; * @Version: 1.0 */ @Data -@ApiModel(value = "员工班次DTO") +@Schema(description = "员工班次DTO") public class StaffClassesDto { - @ApiModelProperty(value = "员工id") + @Schema(description = "员工id") private String staffId; - @ApiModelProperty(value = "班次id数组") + @Schema(description = "班次id数组") private String[] classId; } diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/Classes.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/Classes.java index 9e5a97b..7757439 100644 --- a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/Classes.java +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/Classes.java @@ -8,11 +8,8 @@ import com.mybatisflex.annotation.Column; import com.mybatisflex.annotation.Id; import com.mybatisflex.annotation.Table; import java.io.Serializable; -import java.time.LocalDateTime; import java.util.Date; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.*; import lombok.experimental.Accessors; @@ -28,7 +25,6 @@ import lombok.experimental.Accessors; @NoArgsConstructor @AllArgsConstructor @Accessors(chain = true) -@ApiModel(value = "打卡班次表对象") @Table(value = "cp_oam_classes", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) public class Classes extends BaseEntity implements Serializable { @@ -38,29 +34,23 @@ public class Classes extends BaseEntity implements Serializable { /** * 班次名称 */ - @ApiModelProperty(value = "班次名称") private String className; /** * 开始时间 */ - @ApiModelProperty(value = "开始时间") @JsonFormat(pattern = "HH:mm:ss",timezone = "GMT+8") private Date startTime; /** * 结束时间 */ - @ApiModelProperty(value = "结束时间") @JsonFormat(pattern = "HH:mm:ss",timezone = "GMT+8") private Date endTime; - - /** * 逻辑删除(0否1是) */ - @ApiModelProperty(value = "逻辑删除(0否1是)") @Column(isLogicDelete = true) private Integer isDelete; diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/ClockInDept.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/ClockInDept.java index aaa9fb5..ad4923c 100644 --- a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/ClockInDept.java +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/ClockInDept.java @@ -8,8 +8,6 @@ import com.mybatisflex.annotation.Id; import com.mybatisflex.annotation.Table; import java.io.Serializable; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.*; import lombok.experimental.Accessors; @@ -25,85 +23,68 @@ import lombok.experimental.Accessors; @NoArgsConstructor @AllArgsConstructor @Accessors(chain = true) -@ApiModel(value = "部门表对象") @Table(value = "cp_oam_dept", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) public class ClockInDept extends BaseEntity implements Serializable { /** * 部门id */ - @ApiModelProperty(value = "部门id") @Id private String id; /** * 父部门id */ - @ApiModelProperty(value = "父部门id") private String parentId; /** * 企微id */ - @ApiModelProperty(value = "企微id") private Long wxCpId; /** * 企微父id */ - @ApiModelProperty(value = "企微父id") private Long wxCpParentId; /** * 部门名称 */ - @ApiModelProperty(value = "部门名称") private String name; /** * 排序 */ - @ApiModelProperty(value = "排序") private Integer orderNo; /** * 负责人 */ - @ApiModelProperty(value = "负责人") private String leader; /** * 电话 */ - @ApiModelProperty(value = "电话") private String phone; /** * 邮箱 */ - @ApiModelProperty(value = "邮箱") private String email; /** * 部门状态:1正常,0停用 */ - @ApiModelProperty(value = "部门状态:1正常,0停用") private Boolean status; /** * 备注 */ - @ApiModelProperty(value = "备注") private String remark; - - - - /** * 逻辑删除(0否1是) */ - @ApiModelProperty(value = "逻辑删除(0否1是)") @Column(isLogicDelete = true) private Boolean isDelete; diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/ClockInStaff.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/ClockInStaff.java index c1129b5..33e42fd 100644 --- a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/ClockInStaff.java +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/ClockInStaff.java @@ -8,8 +8,6 @@ import com.mybatisflex.annotation.Id; import com.mybatisflex.annotation.Table; import java.io.Serializable; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.*; import lombok.experimental.Accessors; @@ -25,61 +23,48 @@ import lombok.experimental.Accessors; @NoArgsConstructor @AllArgsConstructor @Accessors(chain = true) -@ApiModel(value = "员工表对象") @Table(value = "cp_oam_staff", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) public class ClockInStaff extends BaseEntity implements Serializable { /** * 主键 */ - @ApiModelProperty(value = "主键") @Id private String id; /** * 姓名 */ - @ApiModelProperty(value = "姓名") private String name; /** * 用户id */ - @ApiModelProperty(value = "用户id") private String userId; /** * 员工类型(0:技术人员;1:售后人员;2:管理人员) */ - @ApiModelProperty(value = "员工类型(0:技术人员;1:售后人员;2:管理人员)") private Integer staffType; /** * 角色id */ - @ApiModelProperty(value = "角色id") private String roleId; /** * 微信用userId */ - @ApiModelProperty(value = "微信用userId") private String wxCpUserId; /** * 是否是运维账号 */ - @ApiModelProperty(value = "是否是运维账号") private Boolean isOperation; - - - - /** * 逻辑删除(0否1是) */ - @ApiModelProperty(value = "逻辑删除(0否1是)") @Column(isLogicDelete = true) private Boolean isDelete; diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/ClockInStaffMidDept.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/ClockInStaffMidDept.java index 97395fe..081292c 100644 --- a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/ClockInStaffMidDept.java +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/ClockInStaffMidDept.java @@ -6,8 +6,6 @@ import com.cpop.core.base.entity.BaseUpdateListener; import com.mybatisflex.annotation.Table; import java.io.Serializable; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.*; import lombok.experimental.Accessors; @@ -23,20 +21,17 @@ import lombok.experimental.Accessors; @NoArgsConstructor @AllArgsConstructor @Accessors(chain = true) -@ApiModel(value = "Oam-员工-用户中间表对象") @Table(value = "cp_oam_staff_mid_dept", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) public class ClockInStaffMidDept extends BaseEntity implements Serializable { /** * 员工id */ - @ApiModelProperty(value = "员工id") private String staffId; /** * 部门id */ - @ApiModelProperty(value = "部门id") private String deptId; diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/StaffClasses.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/StaffClasses.java index a91a66a..52ced81 100644 --- a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/StaffClasses.java +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/entity/StaffClasses.java @@ -7,9 +7,6 @@ import com.mybatisflex.annotation.Column; import com.mybatisflex.annotation.Id; import com.mybatisflex.annotation.Table; import java.io.Serializable; -import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; import lombok.*; import lombok.experimental.Accessors; @@ -25,7 +22,6 @@ import lombok.experimental.Accessors; @NoArgsConstructor @AllArgsConstructor @Accessors(chain = true) -@ApiModel(value = "员工-班次关联表对象") @Table(value = "cp_oam_staff_classes", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) public class StaffClasses extends BaseEntity implements Serializable { @@ -35,23 +31,16 @@ public class StaffClasses extends BaseEntity implements Serializable { /** * 员工id */ - @ApiModelProperty(value = "员工id") private String staffId; /** * 班次id */ - @ApiModelProperty(value = "班次id") private String classId; - - - - /** * 逻辑删除(0否1是) */ - @ApiModelProperty(value = "逻辑删除(0否1是)") @Column(isLogicDelete = true) private Integer isDelete; diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/impl/StaffClassesServiceImpl.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/impl/StaffClassesServiceImpl.java index fee6944..17de52f 100644 --- a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/impl/StaffClassesServiceImpl.java +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/service/impl/StaffClassesServiceImpl.java @@ -8,13 +8,9 @@ import com.cpop.clockin.business.service.*; import com.cpop.clockin.business.vo.ClassesVo; import com.cpop.clockin.business.vo.StaffClassesVo; import com.cpop.core.base.entity.PageDomain; -import com.cpop.core.utils.SpringUtils; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.query.QueryWrapper; -import com.mybatisflex.core.row.Db; -import com.mybatisflex.core.row.DbChain; -import com.mybatisflex.core.row.Row; import com.mybatisflex.spring.service.impl.ServiceImpl; import com.cpop.clockin.business.mapper.StaffClassesMapper; import org.springframework.beans.BeanUtils; @@ -25,8 +21,6 @@ import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; -import static com.mybatisflex.core.query.QueryMethods.groupConcat; - /** * 员工-班次关联表 服务层实现。 * diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/vo/ClassesVo.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/vo/ClassesVo.java index 099000c..9748e83 100644 --- a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/vo/ClassesVo.java +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/vo/ClassesVo.java @@ -1,7 +1,6 @@ package com.cpop.clockin.business.vo; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; /** @@ -9,15 +8,15 @@ import lombok.Data; * @Date: 2024/1/23 18:56 * @Version: 1.0 */ -@ApiModel(value = "班次VO") +@Schema(description = "班次VO") @Data public class ClassesVo { - @ApiModelProperty(value = "班次Id") + @Schema(description = "班次Id") private String id; /** * 班次名称 */ - @ApiModelProperty(value = "班次名称") + @Schema(description = "班次名称") private String className; } diff --git a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/vo/StaffClassesVo.java b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/vo/StaffClassesVo.java index 328baa0..3da41e0 100644 --- a/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/vo/StaffClassesVo.java +++ b/Cpop-ClockIn-Demo/src/main/java/com/cpop/clockin/business/vo/StaffClassesVo.java @@ -1,8 +1,6 @@ package com.cpop.clockin.business.vo; -import com.mybatisflex.annotation.RelationOneToMany; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; +import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; import java.util.List; @@ -12,18 +10,18 @@ import java.util.List; * @Date: 2024/1/23 17:45 * @Version: 1.0 */ -@ApiModel(value = "员工班次关联VO") +@Schema(description = "员工班次关联VO") @Data public class StaffClassesVo { - @ApiModelProperty("员工Id") + @Schema(description = "员工Id") private String staffId; - @ApiModelProperty("员工名称") + @Schema(description = "员工名称") private String staffName; - @ApiModelProperty("部门名称") + @Schema(description = "部门名称") private String deptName; - @ApiModelProperty("考勤班次名称") + @Schema(description = "考勤班次名称") private String className; - @ApiModelProperty("考勤班次集合") + @Schema(description = "考勤班次集合") private List classesVoList; } diff --git a/Cpop-Core/pom.xml b/Cpop-Core/pom.xml index 41bc4d0..3c95c6b 100644 --- a/Cpop-Core/pom.xml +++ b/Cpop-Core/pom.xml @@ -14,45 +14,20 @@ jar - + - com.cpop - Cpop-Common + cn.dev33 + sa-token-spring-boot3-starter - + - org.springframework.boot - spring-boot-starter-aop + cn.dev33 + sa-token-redis-jackson - + - com.mybatis-flex - mybatis-flex-spring-boot-starter - - - com.mybatis-flex - mybatis-flex-processor - - - - org.springframework.boot - spring-boot-starter-security - - - - io.jsonwebtoken - jjwt - - - - org.springframework.boot - spring-boot-starter-data-redis - - - io.lettuce - lettuce-core - - + org.apache.commons + commons-pool2 redis.clients @@ -67,54 +42,85 @@ org.springframework.integration spring-integration-redis - + - com.alibaba - easyexcel + cn.dev33 + sa-token-jwt - + - org.apache.commons - commons-compress + com.mysql + mysql-connector-j + runtime com.zaxxer HikariCP - + - com.github.xiaoymin - knife4j-openapi2-spring-boot-starter + com.mybatis-flex + mybatis-flex-spring-boot3-starter - - org.springframework.boot - spring-boot-starter-validation + com.mybatis-flex + mybatis-flex-processor + + + + org.apache.commons + commons-text + + + + com.alibaba.fastjson2 + fastjson2 + + + + commons-io + commons-io + + + + com.alibaba + easyexcel + + + + org.springframework + spring-test + + + + com.squareup.okhttp3 + okhttp org.springframework.boot spring-boot-starter-quartz - + - com.qcloud - cos_api + cn.dev33 + sa-token-spring-aop - + - org.bouncycastle - bcprov-jdk15on + org.springframework.boot + spring-boot-starter-validation + - org.springframework - spring-test + com.github.xiaoymin + knife4j-openapi3-jakarta-spring-boot-starter - + - cn.hutool - hutool-all + com.gitee.anwena + mongo-plus-boot-starter diff --git a/Cpop-Core/src/main/java/com/cpop/core/annontation/OperationLog.java b/Cpop-Core/src/main/java/com/cpop/core/anno/OperationLog.java similarity index 91% rename from Cpop-Core/src/main/java/com/cpop/core/annontation/OperationLog.java rename to Cpop-Core/src/main/java/com/cpop/core/anno/OperationLog.java index 1d0daf3..a3912a9 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/annontation/OperationLog.java +++ b/Cpop-Core/src/main/java/com/cpop/core/anno/OperationLog.java @@ -1,4 +1,4 @@ -package com.cpop.core.annontation; +package com.cpop.core.anno; import com.cpop.core.base.enums.OperationLogEnum; diff --git a/Cpop-Core/src/main/java/com/cpop/core/annontation/SignatureCheck.java b/Cpop-Core/src/main/java/com/cpop/core/anno/SignatureCheck.java similarity index 87% rename from Cpop-Core/src/main/java/com/cpop/core/annontation/SignatureCheck.java rename to Cpop-Core/src/main/java/com/cpop/core/anno/SignatureCheck.java index 84a1249..5d41ee8 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/annontation/SignatureCheck.java +++ b/Cpop-Core/src/main/java/com/cpop/core/anno/SignatureCheck.java @@ -1,4 +1,4 @@ -package com.cpop.core.annontation; +package com.cpop.core.anno; import java.lang.annotation.*; diff --git a/Cpop-Core/src/main/java/com/cpop/core/annontation/SimpleSignatureCheck.java b/Cpop-Core/src/main/java/com/cpop/core/anno/SimpleSignatureCheck.java similarity index 87% rename from Cpop-Core/src/main/java/com/cpop/core/annontation/SimpleSignatureCheck.java rename to Cpop-Core/src/main/java/com/cpop/core/anno/SimpleSignatureCheck.java index e95d734..7d5411f 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/annontation/SimpleSignatureCheck.java +++ b/Cpop-Core/src/main/java/com/cpop/core/anno/SimpleSignatureCheck.java @@ -1,4 +1,4 @@ -package com.cpop.core.annontation; +package com.cpop.core.anno; import java.lang.annotation.*; diff --git a/Cpop-Core/src/main/java/com/cpop/core/annontation/StringArrayConvert.java b/Cpop-Core/src/main/java/com/cpop/core/anno/StringArrayConvert.java similarity index 95% rename from Cpop-Core/src/main/java/com/cpop/core/annontation/StringArrayConvert.java rename to Cpop-Core/src/main/java/com/cpop/core/anno/StringArrayConvert.java index 9ca0900..b9b7f02 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/annontation/StringArrayConvert.java +++ b/Cpop-Core/src/main/java/com/cpop/core/anno/StringArrayConvert.java @@ -1,4 +1,4 @@ -package com.cpop.core.annontation; +package com.cpop.core.anno; import com.fasterxml.jackson.annotation.JacksonAnnotationsInside; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; diff --git a/Cpop-Core/src/main/java/com/cpop/core/aspect/OperationLogAspect.java b/Cpop-Core/src/main/java/com/cpop/core/aspect/OperationLogAspect.java index aeefd54..1640e4f 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/aspect/OperationLogAspect.java +++ b/Cpop-Core/src/main/java/com/cpop/core/aspect/OperationLogAspect.java @@ -1,15 +1,16 @@ package com.cpop.core.aspect; -import com.cpop.common.constant.HttpStatus; -import com.cpop.common.enums.ErrorCodeEnum; -import com.cpop.core.base.R; -import com.cpop.core.base.entity.LoginUser; +import cn.dev33.satoken.session.SaSession; +import cn.dev33.satoken.stp.StpUtil; +import com.cpop.core.base.entity.R; +import com.cpop.core.base.enums.ErrorCodeEnum; import com.cpop.core.base.enums.OperationLogEnum; +import com.cpop.core.base.enums.UserType; import com.cpop.core.base.exception.ServiceException; -import com.cpop.core.base.table.SysOperationLog; +import com.cpop.core.base.table.OperationLog; +import com.cpop.core.constant.HttpStatus; import com.cpop.core.event.OperationLogEvent; import com.cpop.core.utils.MessageUtils; -import com.cpop.core.utils.SecurityUtils; import com.fasterxml.jackson.databind.ObjectMapper; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.JoinPoint; @@ -29,7 +30,7 @@ import org.springframework.stereotype.Component; @Component public class OperationLogAspect { - private final SysOperationLog operationLog = new SysOperationLog(); + private final OperationLog operationLog = new OperationLog(); private OperationLogEnum operationLogEnum; @@ -42,7 +43,7 @@ public class OperationLogAspect { /** * 定义controller切入点拦截规则,拦截SysLog注解的方法 */ - @Pointcut("@annotation(com.cpop.core.annontation.OperationLog)") + @Pointcut("@annotation(com.cpop.core.anno.OperationLog)") public void operationLogAspect() { } @@ -57,18 +58,16 @@ public class OperationLogAspect { public void recordLog(JoinPoint joinPoint) { //设置枚举信息 MethodSignature signature = (MethodSignature) joinPoint.getSignature(); - com.cpop.core.annontation.OperationLog annotation = signature.getMethod().getAnnotation(com.cpop.core.annontation.OperationLog.class); + com.cpop.core.anno.OperationLog annotation = signature.getMethod().getAnnotation(com.cpop.core.anno.OperationLog.class); operationLogEnum = annotation.operationLogEnumType(); try { - LoginUser loginUser = SecurityUtils.getInstance().getLoginUser(); - operationLog.setOperationUserName(loginUser.getUsername()) - .setOperationUserId(loginUser.getUserId()) - .setOperationUserType(loginUser.getUserType()) - .setDevIp(loginUser.getIpAddr()) + SaSession session = StpUtil.getSession(); + operationLog.setOperationUserName(session.getString("username")) + .setOperationUserId(session.getString("userId")) + .setOperationUserType((UserType) session.get("userType")) + .setDevIp(session.getString("loginIp")) .setCode(operationLogEnum.getCode()) - .setInfo(MessageUtils.message(operationLogEnum.getInfo())) - .setCreateUserId(loginUser.getUserId()); - operationLog.setUpdateUserId(loginUser.getUserId()); + .setInfo(MessageUtils.message(operationLogEnum.getInfo())); } catch (Exception e) { throw new ServiceException(ErrorCodeEnum.OPERATION_LOG_EXCEPTION.getInfo(), ErrorCodeEnum.OPERATION_LOG_EXCEPTION.getCode()); } diff --git a/Cpop-Core/src/main/java/com/cpop/core/aspect/SignatureCheckAspect.java b/Cpop-Core/src/main/java/com/cpop/core/aspect/SignatureCheckAspect.java index 20b7b73..ede4fd1 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/aspect/SignatureCheckAspect.java +++ b/Cpop-Core/src/main/java/com/cpop/core/aspect/SignatureCheckAspect.java @@ -1,10 +1,10 @@ package com.cpop.core.aspect; -import com.cpop.common.utils.StringUtils; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.core.base.exception.ServiceException; -import com.cpop.core.base.exception.UtilException; import com.cpop.core.utils.RsaUtils; +import com.cpop.core.utils.StringUtils; +import jakarta.servlet.http.HttpServletRequest; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.ProceedingJoinPoint; @@ -15,16 +15,7 @@ import org.springframework.util.DigestUtils; import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestContextHolder; -import javax.servlet.http.HttpServletRequest; -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectInputStream; import java.lang.reflect.Field; -import java.nio.charset.StandardCharsets; -import java.nio.file.Files; -import java.nio.file.Paths; -import java.security.Key; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -50,7 +41,7 @@ public class SignatureCheckAspect { put("1688842965582499840", new String[]{"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmsFHkB4iIdVSgaz8u8QG66wiZupgSbu2T/ml/kdPm2vemsKgvEqUqp1gR6ulfHcPF8otjVbjiE8q8oR70XfxFIREbomTUmpsOzurLFrAmVhyvu6/tY23/txjQoeeH/tlCy7Lq/TL1AqPKyBcGzsQ4yInpIgRWpXz7fmJCTRw07tyE+4lpXBqiaLdWrkkGG00LnHQAOfcUoXf0TdxFPSfRHiBikfbkmgeVoU66RGlUEXU2esTY2nYGvFn+FqWsNkGEnn2YxIqgbQQ1zNX33+FWBlba1WdQtc8mTJAleaPGXmFnQiEMb55b7xVPjyyCWt6aRwl97KQgtCmfsoPZUWwQQIDAQAB", "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCawUeQHiIh1VKBrPy7xAbrrCJm6mBJu7ZP+aX+R0+ba96awqC8SpSqnWBHq6V8dw8Xyi2NVuOITyryhHvRd/EUhERuiZNSamw7O6ssWsCZWHK+7r+1jbf+3GNCh54f+2ULLsur9MvUCo8rIFwbOxDjIiekiBFalfPt+YkJNHDTu3IT7iWlcGqJot1auSQYbTQucdAA59xShd/RN3EU9J9EeIGKR9uSaB5WhTrpEaVQRdTZ6xNjadga8Wf4Wpaw2QYSefZjEiqBtBDXM1fff4VYGVtrVZ1C1zyZMkCV5o8ZeYWdCIQxvnlvvFU+PLIJa3ppHCX3spCC0KZ+yg9lRbBBAgMBAAECggEAdstPp+25vccHYsvr5icAOQEWF3JrH66csJ+vMJaFIYWYh6xHvsJxhNbyBZJZokWyrExi01CTsRs0mJ3iflVYFqvB7ChnkqhnFMElERNJLW2cB702JKP5TgbXm0aHt30/f2oYppNvtAG3DR/2FGEvAWxCiiZ5S9Q4P8GB1DMROTZBpYQgVlN9vOxqgcy8SsJyruy0xsEP3RIKko9UQ7Y9y/b6TbNOJDx/ZpC9KcOUmI8Or73IMdG1ZucumzHNO3dS2XKL7qeTQ8AWMwwAk2ZsCRx9g05QLiW3+7ZrpmOMwI3wCeJOoxhUQKijCXI3B8Rh1cU++CMk4LdyPOe78PYEEQKBgQDnyOL69Ck6+xe1EJ2HAEDPla5ujCexv6ctYvSernhI6OsMVCWa1D5rCqzC4L0IvRW7/m5lUSWlSzpfIGhSGc+PNyIaYsyYMbaIV5e8LKRp8SxUDrTA4IfYmxoXdYyq2l0PSkBPKMJ2ZyWlRoGGEC432IsiY+GBaznvHwIYFvkYHwKBgQCq7DkJYT6du/bQ2uoZv6hYYIGTY4A9TzjJ0Kp5O00BUz5zNpgBUfb1SmuISHwGyN1hOWFntR0uwfj/BUDvtG0b07k1Xz+4UWXsDqtS6eEnvUR6q/i2yWWGjCMS74t61FZopV6AxHneJV2S6Tt26MFK0VbrCwXaiYg/3tMYgC2rnwKBgF0kfRIby/XHsV8xrhvyHhlNLSt/ZvQm8Cds/KBHvE6QSuRJbFMrt2mMgKBPb6dzVKiXNgXA9j/WWz6e500W0jHbFflEerMuRwvDJ1aXGfr4z7d3sWtQz0ZcDcAfnMeLuJnMXMtytbKfAKHKE4KsPeZzPnYzbQt063MMIutLUA5BAoGBAIduFONxwgOJY8+pJcSxL9qW3RTDymDJ3N1MEUdtzV43b0wq/dZN87f396xMgrl9fqwCo0NhJnZeC8VFjGZiN/HMmPvJNNv+4xtfpDBWUKkENrZcfP2YJnGtqDzgwUvZ432XSoINK+LxCGvXkd5uHnoB1TT3zvOR9ftluy22onlRAoGBAKkIZmwW/2H/86ILrCDyARK4obULB4op8IyrunZ+lH14DksxbL7fmTsSbLyRX7oD/QvGJIuc0EDkgONztsAn5vrETv8Z6RqyKdoZZI3sAQWIBc0om6nH2zqJDIs+mep96DOg/jJAcgiVhyIoFP91IvHY7pvKwy5MTttdZLvvS2XB"}); }}; - @Pointcut("@annotation(com.cpop.core.annontation.SignatureCheck)") + @Pointcut("@annotation(com.cpop.core.anno.SignatureCheck)") public void signatureCheck() {} /** diff --git a/Cpop-Core/src/main/java/com/cpop/core/aspect/SimpleSignatureCheckAspect.java b/Cpop-Core/src/main/java/com/cpop/core/aspect/SimpleSignatureCheckAspect.java index 09a1107..61f88ab 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/aspect/SimpleSignatureCheckAspect.java +++ b/Cpop-Core/src/main/java/com/cpop/core/aspect/SimpleSignatureCheckAspect.java @@ -1,10 +1,10 @@ package com.cpop.core.aspect; -import com.cpop.common.utils.StringUtils; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.core.base.exception.ServiceException; -import com.cpop.core.base.exception.UtilException; import com.cpop.core.utils.RsaUtils; +import com.cpop.core.utils.StringUtils; +import jakarta.servlet.http.HttpServletRequest; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.JoinPoint; import org.aspectj.lang.ProceedingJoinPoint; @@ -15,19 +15,11 @@ import org.springframework.util.DigestUtils; import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestContextHolder; -import javax.crypto.Cipher; -import javax.servlet.http.HttpServletRequest; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.ObjectInputStream; -import java.nio.charset.StandardCharsets; -import java.security.Key; import java.security.KeyFactory; import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; import java.security.spec.InvalidKeySpecException; import java.security.spec.PKCS8EncodedKeySpec; -import java.security.spec.X509EncodedKeySpec; import java.util.Base64; import java.util.HashMap; import java.util.Map; @@ -53,7 +45,7 @@ public class SimpleSignatureCheckAspect { put("1688842965582499840", new String[]{"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmsFHkB4iIdVSgaz8u8QG66wiZupgSbu2T/ml/kdPm2vemsKgvEqUqp1gR6ulfHcPF8otjVbjiE8q8oR70XfxFIREbomTUmpsOzurLFrAmVhyvu6/tY23/txjQoeeH/tlCy7Lq/TL1AqPKyBcGzsQ4yInpIgRWpXz7fmJCTRw07tyE+4lpXBqiaLdWrkkGG00LnHQAOfcUoXf0TdxFPSfRHiBikfbkmgeVoU66RGlUEXU2esTY2nYGvFn+FqWsNkGEnn2YxIqgbQQ1zNX33+FWBlba1WdQtc8mTJAleaPGXmFnQiEMb55b7xVPjyyCWt6aRwl97KQgtCmfsoPZUWwQQIDAQAB", "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCawUeQHiIh1VKBrPy7xAbrrCJm6mBJu7ZP+aX+R0+ba96awqC8SpSqnWBHq6V8dw8Xyi2NVuOITyryhHvRd/EUhERuiZNSamw7O6ssWsCZWHK+7r+1jbf+3GNCh54f+2ULLsur9MvUCo8rIFwbOxDjIiekiBFalfPt+YkJNHDTu3IT7iWlcGqJot1auSQYbTQucdAA59xShd/RN3EU9J9EeIGKR9uSaB5WhTrpEaVQRdTZ6xNjadga8Wf4Wpaw2QYSefZjEiqBtBDXM1fff4VYGVtrVZ1C1zyZMkCV5o8ZeYWdCIQxvnlvvFU+PLIJa3ppHCX3spCC0KZ+yg9lRbBBAgMBAAECggEAdstPp+25vccHYsvr5icAOQEWF3JrH66csJ+vMJaFIYWYh6xHvsJxhNbyBZJZokWyrExi01CTsRs0mJ3iflVYFqvB7ChnkqhnFMElERNJLW2cB702JKP5TgbXm0aHt30/f2oYppNvtAG3DR/2FGEvAWxCiiZ5S9Q4P8GB1DMROTZBpYQgVlN9vOxqgcy8SsJyruy0xsEP3RIKko9UQ7Y9y/b6TbNOJDx/ZpC9KcOUmI8Or73IMdG1ZucumzHNO3dS2XKL7qeTQ8AWMwwAk2ZsCRx9g05QLiW3+7ZrpmOMwI3wCeJOoxhUQKijCXI3B8Rh1cU++CMk4LdyPOe78PYEEQKBgQDnyOL69Ck6+xe1EJ2HAEDPla5ujCexv6ctYvSernhI6OsMVCWa1D5rCqzC4L0IvRW7/m5lUSWlSzpfIGhSGc+PNyIaYsyYMbaIV5e8LKRp8SxUDrTA4IfYmxoXdYyq2l0PSkBPKMJ2ZyWlRoGGEC432IsiY+GBaznvHwIYFvkYHwKBgQCq7DkJYT6du/bQ2uoZv6hYYIGTY4A9TzjJ0Kp5O00BUz5zNpgBUfb1SmuISHwGyN1hOWFntR0uwfj/BUDvtG0b07k1Xz+4UWXsDqtS6eEnvUR6q/i2yWWGjCMS74t61FZopV6AxHneJV2S6Tt26MFK0VbrCwXaiYg/3tMYgC2rnwKBgF0kfRIby/XHsV8xrhvyHhlNLSt/ZvQm8Cds/KBHvE6QSuRJbFMrt2mMgKBPb6dzVKiXNgXA9j/WWz6e500W0jHbFflEerMuRwvDJ1aXGfr4z7d3sWtQz0ZcDcAfnMeLuJnMXMtytbKfAKHKE4KsPeZzPnYzbQt063MMIutLUA5BAoGBAIduFONxwgOJY8+pJcSxL9qW3RTDymDJ3N1MEUdtzV43b0wq/dZN87f396xMgrl9fqwCo0NhJnZeC8VFjGZiN/HMmPvJNNv+4xtfpDBWUKkENrZcfP2YJnGtqDzgwUvZ432XSoINK+LxCGvXkd5uHnoB1TT3zvOR9ftluy22onlRAoGBAKkIZmwW/2H/86ILrCDyARK4obULB4op8IyrunZ+lH14DksxbL7fmTsSbLyRX7oD/QvGJIuc0EDkgONztsAn5vrETv8Z6RqyKdoZZI3sAQWIBc0om6nH2zqJDIs+mep96DOg/jJAcgiVhyIoFP91IvHY7pvKwy5MTttdZLvvS2XB"}); }}; - @Pointcut("@annotation(com.cpop.core.annontation.SimpleSignatureCheck)") + @Pointcut("@annotation(com.cpop.core.anno.SimpleSignatureCheck)") public void simpleSignatureCheck() {} /** diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/entity/BaseInsertListener.java b/Cpop-Core/src/main/java/com/cpop/core/base/entity/BaseInsertListener.java index fff0e7b..7d70d1f 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/base/entity/BaseInsertListener.java +++ b/Cpop-Core/src/main/java/com/cpop/core/base/entity/BaseInsertListener.java @@ -1,6 +1,8 @@ package com.cpop.core.base.entity; -import com.cpop.core.utils.SecurityUtils; +import cn.dev33.satoken.exception.SaTokenException; +import cn.dev33.satoken.stp.StpUtil; +import com.cpop.core.constant.Constants; import com.mybatisflex.annotation.InsertListener; import java.time.LocalDateTime; @@ -15,11 +17,16 @@ public class BaseInsertListener implements InsertListener { @Override public void onInsert(Object entity) { BaseEntity baseEntity = (BaseEntity) entity; - LoginUser loginUser = SecurityUtils.getInstance().getLoginUser(); //设置 account 被新增时的一些默认数据 + String userId; + try { + userId = StpUtil.getLoginIdDefaultNull() == null ? Constants.SUPER_ADMIN_ID : StpUtil.getLoginIdDefaultNull().toString(); + } catch (SaTokenException e) { + userId = Constants.SUPER_ADMIN_ID; + } baseEntity.setCreateTime(LocalDateTime.now()); - baseEntity.setCreateUserId(null == loginUser ? "1" : loginUser.getUserId()); + baseEntity.setCreateUserId(userId); baseEntity.setUpdateTime(LocalDateTime.now()); - baseEntity.setUpdateUserId(null == loginUser ? "1" : loginUser.getUserId()); + baseEntity.setUpdateUserId(userId); } } diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/entity/BaseUpdateListener.java b/Cpop-Core/src/main/java/com/cpop/core/base/entity/BaseUpdateListener.java index 5a99804..e25fedb 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/base/entity/BaseUpdateListener.java +++ b/Cpop-Core/src/main/java/com/cpop/core/base/entity/BaseUpdateListener.java @@ -1,6 +1,8 @@ package com.cpop.core.base.entity; -import com.cpop.core.utils.SecurityUtils; +import cn.dev33.satoken.exception.SaTokenException; +import cn.dev33.satoken.stp.StpUtil; +import com.cpop.core.constant.Constants; import com.mybatisflex.annotation.UpdateListener; import java.time.LocalDateTime; @@ -15,9 +17,14 @@ public class BaseUpdateListener implements UpdateListener { @Override public void onUpdate(Object entity) { BaseEntity baseEntity = (BaseEntity) entity; - LoginUser loginUser = SecurityUtils.getInstance().getLoginUser(); + String userId; + try { + userId = StpUtil.getLoginIdDefaultNull() == null ? Constants.SUPER_ADMIN_ID : StpUtil.getLoginIdDefaultNull().toString(); + } catch (SaTokenException e) { + userId = Constants.SUPER_ADMIN_ID; + } //设置 account 被更新时的一些默认数据 baseEntity.setUpdateTime(LocalDateTime.now()); - baseEntity.setUpdateUserId(null == loginUser ? "1" : loginUser.getUserId()); + baseEntity.setUpdateUserId(userId); } } diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/entity/FastJson2JsonRedisSerializer.java b/Cpop-Core/src/main/java/com/cpop/core/base/entity/FastJson2JsonRedisSerializer.java index a810762..aa10f6b 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/base/entity/FastJson2JsonRedisSerializer.java +++ b/Cpop-Core/src/main/java/com/cpop/core/base/entity/FastJson2JsonRedisSerializer.java @@ -1,8 +1,9 @@ package com.cpop.core.base.entity; -import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.parser.ParserConfig; import com.alibaba.fastjson.serializer.SerializerFeature; +import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONWriter; import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.type.TypeFactory; @@ -19,42 +20,52 @@ import java.nio.charset.StandardCharsets; * @Author: DB */ public class FastJson2JsonRedisSerializer implements RedisSerializer { - private ObjectMapper objectMapper = new ObjectMapper(); - - public static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8; - private final Class clazz; - static { - ParserConfig.getGlobalInstance().setAutoTypeSupport(true); - //如果遇到反序列化autoType is not support错误,请添加并修改一下包名到bean文件路径 - // ParserConfig.getGlobalInstance().addAccept("com.xxxxx.xxx"); - } + /** + * 构造器. + * + * @param clazz cls + */ public FastJson2JsonRedisSerializer(Class clazz) { super(); this.clazz = clazz; } + /** + * 序列化. + * + * @param t object to serialize. Can be {@literal null}. + * @return es + * @throws SerializationException e + */ @Override public byte[] serialize(T t) throws SerializationException { if (t == null) { return new byte[0]; } - return JSON.toJSONString(t, SerializerFeature.WriteClassName).getBytes(DEFAULT_CHARSET); + return com.alibaba.fastjson2.JSON.toJSONString(t, JSONWriter.Feature.WriteClassName).getBytes(StandardCharsets.UTF_8); } + /** + * 反序列化. + * + * @param bytes object binary representation. Can be {@literal null}. + * @return es + * @throws SerializationException e + */ @Override public T deserialize(byte[] bytes) throws SerializationException { if (bytes == null || bytes.length <= 0) { return null; } - String str = new String(bytes, DEFAULT_CHARSET); - + String str = new String(bytes, StandardCharsets.UTF_8); return JSON.parseObject(str, clazz); } + + public void setObjectMapper(ObjectMapper objectMapper) { Assert.notNull(objectMapper, "'objectMapper' must not be null"); - this.objectMapper = objectMapper; } protected JavaType getJavaType(Class clazz) { diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/entity/LoginForm.java b/Cpop-Core/src/main/java/com/cpop/core/base/entity/LoginForm.java deleted file mode 100644 index c3f5bd3..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/base/entity/LoginForm.java +++ /dev/null @@ -1,35 +0,0 @@ -package com.cpop.core.base.entity; - -import lombok.Data; - -import java.io.Serializable; - -/** - * @author DB - * @create 2023-04-05 17:53 - */ -@Data -public class LoginForm implements Serializable { - - private static final long serialVersionUID = 1L; - - /** - * 用户名 - */ - private String username; - - /** - * 密码 - */ - private String password; - - /** - * 验证码 - */ - private String code; - - /** - * 单次标识 - */ - private String userKey; -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/entity/LoginSuccess.java b/Cpop-Core/src/main/java/com/cpop/core/base/entity/LoginSuccess.java index d90fc41..a286bc8 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/base/entity/LoginSuccess.java +++ b/Cpop-Core/src/main/java/com/cpop/core/base/entity/LoginSuccess.java @@ -3,6 +3,7 @@ package com.cpop.core.base.entity; import lombok.Data; import lombok.experimental.Accessors; +import java.io.Serial; import java.io.Serializable; import java.util.Set; @@ -15,6 +16,7 @@ import java.util.Set; @Accessors(chain = true) public class LoginSuccess implements Serializable { + @Serial private static final long serialVersionUID = 1L; /** diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/entity/LoginUser.java b/Cpop-Core/src/main/java/com/cpop/core/base/entity/LoginUser.java deleted file mode 100644 index 9faf88f..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/base/entity/LoginUser.java +++ /dev/null @@ -1,156 +0,0 @@ -package com.cpop.core.base.entity; - -import com.alibaba.fastjson.annotation.JSONField; -import com.cpop.common.utils.StringUtils; -import com.cpop.core.base.enums.UserType; -import com.cpop.core.base.table.SysUser; -import lombok.Data; -import lombok.experimental.Accessors; -import org.springframework.security.core.GrantedAuthority; -import org.springframework.security.core.userdetails.UserDetails; - -import java.util.Collection; -import java.util.Set; - -/** - * 登录用户身份权限 - * - * @author DB - */ -@Data -@Accessors(chain = true) -public class LoginUser implements UserDetails { - - /** - * 用户ID - */ - private String userId; - - /** - * 用户名 - */ - private String userName; - - /** - * 用户唯一标识 - */ - private String identification; - - /** - * 登录时间 - */ - private Long loginTime = System.currentTimeMillis(); - - /** - * 过期时间 - */ - private Long expireTime; - - /** - * 登录IP地址 - */ - private String ipAddr; - - /** - * 登录地点 - */ - private String loginLocation; - - /** - * 权限列表 - */ - private Set permissions; - - /** - * 用户信息 - */ - private SysUser user; - - /** - * 消息 - */ - private String msg; - - /** - * 登录状态 - */ - private Boolean status; - - /** - * 用户类型 - */ - private UserType userType = UserType.OAM_USER; - - public LoginUser() { - } - - public LoginUser(SysUser user,String identification, Set permissions) { - this.user = user; - this.identification = identification; - this.permissions = permissions; - } - - public LoginUser(String userId, SysUser user, Set permissions) { - this.userId = userId; - this.user = user; - this.permissions = permissions; - } - - @JSONField(serialize = false) - @Override - public String getPassword() { - return user.getPassword(); - } - - - @Override - public String getUsername() { - if (StringUtils.isBlank(this.userName)){ - return user.getUserName(); - }else { - return this.userName; - } - } - - /** - * 账户是否未过期,过期无法验证 - */ - @JSONField(serialize = false) - @Override - public boolean isAccountNonExpired() { - return true; - } - - /** - * 指定用户是否解锁,锁定的用户无法进行身份验证 - */ - @JSONField(serialize = false) - @Override - public boolean isAccountNonLocked() { - return true; - } - - /** - * 指示是否已过期的用户的凭据(密码),过期的凭据防止认证 - */ - @JSONField(serialize = false) - @Override - public boolean isCredentialsNonExpired() { - return true; - } - - /** - * 是否可用 ,禁用的用户不能身份验证 - */ - @JSONField(serialize = false) - @Override - public boolean isEnabled() { - return true; - } - - @Override - public Collection getAuthorities() { - //根据自定义逻辑来返回用户权限,如果用户权限返回空或者和拦截路径对应权限不同,验证不通过;自定义权限注解,此处设定为null - return null; - } -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/entity/MultipartFileDto.java b/Cpop-Core/src/main/java/com/cpop/core/base/entity/MultipartFileDto.java deleted file mode 100644 index 63747e9..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/base/entity/MultipartFileDto.java +++ /dev/null @@ -1,115 +0,0 @@ -package com.cpop.core.base.entity; - -import org.springframework.util.FileCopyUtils; -import org.springframework.web.multipart.MultipartFile; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; - - -/** - * @author DB - * @since 2023-12-10 9:35 - * @version 1.0.0 - * - * 负责将InputStream转换MultipartFile,可以少引一个jar包,本来用的是spring-test-4.3.9中的MockMultipartFile,直接提取出来使用 - */ -public class MultipartFileDto implements MultipartFile { - private final String name; - - private String originalFilename; - - private String contentType; - - private final byte[] content; - - /** - * Create a new MultipartFileDto with the given content. - * @param name the name of the file - * @param content the content of the file - */ - public MultipartFileDto(String name, byte[] content) { - this(name, "", null, content); - } - - /** - * Create a new MultipartFileDto with the given content. - * @param name the name of the file - * @param contentStream the content of the file as stream - * @throws IOException if reading from the stream failed - */ - public MultipartFileDto(String name, InputStream contentStream) throws IOException { - this(name, "", null, FileCopyUtils.copyToByteArray(contentStream)); - } - - /** - * Create a new MultipartFileDto with the given content. - * @param name the name of the file - * @param originalFilename the original filename (as on the client's machine) - * @param contentType the content type (if known) - * @param content the content of the file - */ - public MultipartFileDto(String name, String originalFilename, String contentType, byte[] content) { - this.name = name; - this.originalFilename = (originalFilename != null ? originalFilename : ""); - this.contentType = contentType; - this.content = (content != null ? content : new byte[0]); - } - - /** - * Create a new MultipartFileDto with the given content. - * @param name the name of the file - * @param originalFilename the original filename (as on the client's machine) - * @param contentType the content type (if known) - * @param contentStream the content of the file as stream - * @throws IOException if reading from the stream failed - */ - public MultipartFileDto(String name, String originalFilename, String contentType, InputStream contentStream) - throws IOException { - - this(name, originalFilename, contentType, FileCopyUtils.copyToByteArray(contentStream)); - } - - @Override - public String getName() { - return this.name; - } - - @Override - public String getOriginalFilename() { - return this.originalFilename; - } - - @Override - public String getContentType() { - return this.contentType; - } - - @Override - public boolean isEmpty() { - return (this.content.length == 0); - } - - @Override - public long getSize() { - return this.content.length; - } - - @Override - public byte[] getBytes() throws IOException { - return this.content; - } - - @Override - public InputStream getInputStream() throws IOException { - return new ByteArrayInputStream(this.content); - } - - @Override - public void transferTo(File dest) throws IOException, IllegalStateException { - FileCopyUtils.copy(this.content, dest); - } - -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/entity/PageDomain.java b/Cpop-Core/src/main/java/com/cpop/core/base/entity/PageDomain.java index 9bac547..a8618e3 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/base/entity/PageDomain.java +++ b/Cpop-Core/src/main/java/com/cpop/core/base/entity/PageDomain.java @@ -1,6 +1,7 @@ package com.cpop.core.base.entity; -import com.cpop.common.utils.StringUtils; + +import com.cpop.core.utils.StringUtils; /** * 分页数据 diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/entity/Permission.java b/Cpop-Core/src/main/java/com/cpop/core/base/entity/Permission.java index 5378d53..fa3f9f7 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/base/entity/Permission.java +++ b/Cpop-Core/src/main/java/com/cpop/core/base/entity/Permission.java @@ -1,8 +1,11 @@ package com.cpop.core.base.entity; +import lombok.Getter; + /** * 权限组 */ +@Getter public class Permission { /** @@ -10,10 +13,6 @@ public class Permission { */ private String permission; - public String getPermission() { - return permission; - } - public void setPermission(String permission) { this.permission = permission; } diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/R.java b/Cpop-Core/src/main/java/com/cpop/core/base/entity/R.java similarity index 94% rename from Cpop-Core/src/main/java/com/cpop/core/base/R.java rename to Cpop-Core/src/main/java/com/cpop/core/base/entity/R.java index 0bded81..89f6406 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/base/R.java +++ b/Cpop-Core/src/main/java/com/cpop/core/base/entity/R.java @@ -1,7 +1,9 @@ -package com.cpop.core.base; +package com.cpop.core.base.entity; -import com.cpop.common.constant.Constants; +import com.cpop.core.constant.Constants; + +import java.io.Serial; import java.io.Serializable; /** @@ -11,6 +13,7 @@ import java.io.Serializable; */ public class R implements Serializable { + @Serial private static final long serialVersionUID = 1L; /** diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/entity/loginInfo/MallStaffLoginInfo.java b/Cpop-Core/src/main/java/com/cpop/core/base/entity/loginInfo/MallStaffLoginInfo.java deleted file mode 100644 index fde24bc..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/base/entity/loginInfo/MallStaffLoginInfo.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.cpop.core.base.entity.loginInfo; - -import com.cpop.core.base.enums.SourceType; -import com.cpop.core.base.table.SysUser; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** - * @author DB - * @createTime 2023/10/19 13:10 - * @description 商城管理员工登陆信息 - */ -@Data -@Accessors(chain = true) -@EqualsAndHashCode(callSuper = true) -public class MallStaffLoginInfo extends SysUser { - - /** - * 员工id(mallStaffId) - */ - private String id; - - /** - * 姓名 - */ - private String name; - - /** - * 用户id - */ - private String userId; - - /** - * 角色id - */ - private String roleId; - - /** - * 品牌id - */ - private String brandId; - - /** - * 用户来源 - */ - private SourceType sourceType; -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/entity/loginInfo/MiniUserLoginInfo.java b/Cpop-Core/src/main/java/com/cpop/core/base/entity/loginInfo/MiniUserLoginInfo.java deleted file mode 100644 index c58acc4..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/base/entity/loginInfo/MiniUserLoginInfo.java +++ /dev/null @@ -1,58 +0,0 @@ -package com.cpop.core.base.entity.loginInfo; - -import com.cpop.core.base.enums.SourceType; -import com.cpop.core.base.table.SysUser; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** - * @author DB - * @createTime 2023/10/24 9:16 - * @description 小程序登陆用户信息 - */ -@Data -@Accessors(chain = true) -@EqualsAndHashCode(callSuper = true) -public class MiniUserLoginInfo extends SysUser { - - /** - * 小程序用户id - */ - private String id; - - /** - * 小程序openId - */ - private String openId; - - /** - * 小程序appid - */ - private String appId; - - /** - * 用户id - */ - private String userId; - - /** - * 品牌id - */ - private String brandId; - - /** - * 昵称 - */ - private String nickName; - - /** - * 头像 - */ - private String avatar; - - /** - * 小程序用户来源 - */ - private SourceType sourceType; -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/entity/loginInfo/OamStaffLoginInfo.java b/Cpop-Core/src/main/java/com/cpop/core/base/entity/loginInfo/OamStaffLoginInfo.java deleted file mode 100644 index 14c0a96..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/base/entity/loginInfo/OamStaffLoginInfo.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.cpop.core.base.entity.loginInfo; - -import com.cpop.core.base.table.SysUser; -import lombok.Data; -import lombok.EqualsAndHashCode; -import lombok.experimental.Accessors; - -/** - * @author DB - * @createTime 2023/09/10 13:02 - * @description 系统员工登陆信息 - */ -@Data -@Accessors(chain = true) -@EqualsAndHashCode(callSuper = true) -public class OamStaffLoginInfo extends SysUser { - - /** - * 员工id(staffId) - */ - private String id; - - /** - * 姓名 - */ - private String name; - - /** - * 部门id - */ - private String deptId; - - /** - * 用户id - */ - private String userId; - - /** - * 员工类型(0:技术人员;1:售后人员;2:管理人员) - */ - private Integer staffType; - - /** - * 角色id - */ - private String roleId; -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/enums/CycleEnum.java b/Cpop-Core/src/main/java/com/cpop/core/base/enums/CycleEnum.java new file mode 100644 index 0000000..86e8d94 --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/base/enums/CycleEnum.java @@ -0,0 +1,56 @@ +package com.cpop.core.base.enums; + +/** + * @author DB + */ +public enum CycleEnum { + /** + * 日 + */ + DAY(1, "每天"), + /** + * 月 + */ + MONTH(2, "月"), + /** + * 季 + */ + WEEK(3, "季"), + /** + * 年 + */ + YEAR(4, "年"); + + private int codeId; + private String message; + + CycleEnum(int codeId, String message) { + this.codeId = codeId; + this.message = message; + } + + public static CycleEnum getCycle(int code) { + for (CycleEnum c : CycleEnum.values()) { + if (c.codeId == code) { + return c; + } + } + return null; + } + + public int getCodeId() { + return codeId; + } + + public void setCodeId(int codeId) { + this.codeId = codeId; + } + + public String getMessage() { + return message; + } + + public void setMessage(String message) { + this.message = message; + } +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/enums/ErrorCodeEnum.java b/Cpop-Core/src/main/java/com/cpop/core/base/enums/ErrorCodeEnum.java new file mode 100644 index 0000000..2388d76 --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/base/enums/ErrorCodeEnum.java @@ -0,0 +1,82 @@ +package com.cpop.core.base.enums; + +import lombok.Getter; + +/** + * @author LOST.yuan + */ +@Getter +public enum ErrorCodeEnum { + + /** jwt凭据已过期 */ + HTTP_401(401, "权限不足"), + + NULL_TOKEN(402, "未登录!"), + + TOKEN_EXPIRED(403, "登录已失效!"), + + /** + * 登录异常 + */ + LOGIN_EXCEPTION(2000, "登录异常!"), + + TOKEN_CREATE_ERROR(2001, "TOKEN生成失败!"), + + WRONG_LOGIN_PASSWORD(2002, "登录密码错误!"), + + WRONG_LOGIN_USERNAME(2003, "登录用户名错误!"), + /** + * 获取请求信息失败 + */ + GET_REQUEST_INFO_FAILED(2004, "获取请求信息失败!"), + /** + * 验证码错误 + */ + CAPTCHA_ERROR(2005,"验证码错误"), + /** + * 验证码失效FileSizeLimitExceeded + */ + CAPTCHA_EXPIRE(2006,"验证码失效"), + /** + * 文件名称超长限制 + */ + FILE_NAME_TOO_LONG(2007,"文件名称超出限制,文件名长度为:"), + /** + * 文件名大小限制 + */ + FILE_SIZE_LIMIT_EXCEEDED(2008,"文件名大小超出限制,文件名大小为:"), + + //2500--内部服务异常 + /** + * 操作日志异常 + */ + FILE_UPLOAD_EXCEPTION(2500,"文件上传异常"), + /** + * 操作日志异常 + */ + OPERATION_LOG_EXCEPTION(2501,"操作日志异常"), + /** + * 系统邮箱异常 + */ + SYS_EMAIL_EXCEPTION(2502,"系统邮箱异常"), + ; + + private final Integer code; + + private final String info; + + ErrorCodeEnum(Integer code, String info) { + this.code = code; + this.info = info; + } + + public static ErrorCodeEnum codeOf(Integer code) { + for (ErrorCodeEnum value : values()) { + if (value.getCode().equals(code)) { + return value; + } + } + return null; + } + +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/enums/SourceType.java b/Cpop-Core/src/main/java/com/cpop/core/base/enums/SourceType.java deleted file mode 100644 index c4405c9..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/base/enums/SourceType.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.cpop.core.base.enums; - - -import lombok.Getter; - -@Getter -public enum SourceType { - - /** - * 通用 - */ - COMMON("Common"), - /** - * 果酱 - */ - JAMBOX("Jambox"); - - private String name; - - SourceType(String name) { - this.name = name; - } - - public void setName(String name) { - this.name = name; - } -} \ No newline at end of file diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/enums/UserType.java b/Cpop-Core/src/main/java/com/cpop/core/base/enums/UserType.java index 67842e8..75bd961 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/base/enums/UserType.java +++ b/Cpop-Core/src/main/java/com/cpop/core/base/enums/UserType.java @@ -1,10 +1,5 @@ package com.cpop.core.base.enums; -import com.cpop.core.strategy.login.LoginStrategy; -import com.cpop.core.strategy.login.MallLoginStrategy; -import com.cpop.core.strategy.login.MiniLoginStrategy; -import com.cpop.core.strategy.login.OamLoginStrategy; -import com.cpop.core.utils.SpringUtils; import lombok.Getter; /** @@ -17,15 +12,15 @@ public enum UserType { /** * oam系统员工 */ - OAM_USER(0, "oam:loginUser:", SpringUtils.getBean(OamLoginStrategy.class)), + OAM_USER(0, "oam:loginUser:"), /** * 小程序用户 */ - MINI_USER(1, "mini:loginUser:", SpringUtils.getBean(MiniLoginStrategy.class)), + MINI_USER(1, "mini:loginUser:"), /** * 商城系统员工 */ - MALL_USER(2, "mall:loginUser:",SpringUtils.getBean(MallLoginStrategy.class)); + MALL_USER(2, "mall:loginUser:"); /** * code @@ -37,12 +32,9 @@ public enum UserType { */ private final String key; - private final LoginStrategy strategy; - - UserType(Integer code, String key, LoginStrategy strategy) { + UserType(Integer code, String key) { this.code = code; this.key = key; - this.strategy = strategy; } } diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/exception/BaseException.java b/Cpop-Core/src/main/java/com/cpop/core/base/exception/BaseException.java index edfd240..883967c 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/base/exception/BaseException.java +++ b/Cpop-Core/src/main/java/com/cpop/core/base/exception/BaseException.java @@ -1,15 +1,20 @@ package com.cpop.core.base.exception; -import com.cpop.common.utils.StringUtils; +import com.cpop.core.utils.StringUtils; import com.cpop.core.utils.MessageUtils; +import lombok.Getter; + +import java.io.Serial; /** * 基础异常 * * @author DB */ +@Getter public class BaseException extends RuntimeException { + @Serial private static final long serialVersionUID = 1L; /** @@ -67,19 +72,4 @@ public class BaseException extends RuntimeException { return message; } - public String getModule() { - return module; - } - - public String getCode() { - return code; - } - - public Object[] getArgs() { - return args; - } - - public String getDefaultMessage() { - return defaultMessage; - } } diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/exception/CpopAuthenticationException.java b/Cpop-Core/src/main/java/com/cpop/core/base/exception/CpopAuthenticationException.java deleted file mode 100644 index 46e213e..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/base/exception/CpopAuthenticationException.java +++ /dev/null @@ -1,26 +0,0 @@ -package com.cpop.core.base.exception; - -import org.springframework.security.core.AuthenticationException; - -/** - * @author: DB - * @Date: 2023/08/24/18:10 - * @Description: 自定义认证失败异常 - */ -public class CpopAuthenticationException extends AuthenticationException { - - private Object params; - - public CpopAuthenticationException(String msg) { - super(msg); - } - - public CpopAuthenticationException(String msg, Object params) { - super(msg); - this.params = params; - } - - public Object getParams() { - return params; - } -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/table/SysConfig.java b/Cpop-Core/src/main/java/com/cpop/core/base/table/Config.java similarity index 93% rename from Cpop-Core/src/main/java/com/cpop/core/base/table/SysConfig.java rename to Cpop-Core/src/main/java/com/cpop/core/base/table/Config.java index 87942bb..ca577ab 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/base/table/SysConfig.java +++ b/Cpop-Core/src/main/java/com/cpop/core/base/table/Config.java @@ -23,7 +23,7 @@ import java.io.Serializable; @AllArgsConstructor @Accessors(chain = true) @Table(value = "cp_sys_config", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) -public class SysConfig extends BaseEntity implements Serializable { +public class Config extends BaseEntity implements Serializable { /** * 参数键 diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/table/SysOperationLog.java b/Cpop-Core/src/main/java/com/cpop/core/base/table/OperationLog.java similarity index 95% rename from Cpop-Core/src/main/java/com/cpop/core/base/table/SysOperationLog.java rename to Cpop-Core/src/main/java/com/cpop/core/base/table/OperationLog.java index 25fb832..a584688 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/base/table/SysOperationLog.java +++ b/Cpop-Core/src/main/java/com/cpop/core/base/table/OperationLog.java @@ -24,7 +24,7 @@ import java.io.Serializable; @AllArgsConstructor @Accessors(chain = true) @Table(value = "cp_sys_operation_log", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) -public class SysOperationLog extends BaseEntity implements Serializable { +public class OperationLog extends BaseEntity implements Serializable { /** * ID diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/table/SysUser.java b/Cpop-Core/src/main/java/com/cpop/core/base/table/User.java similarity index 96% rename from Cpop-Core/src/main/java/com/cpop/core/base/table/SysUser.java rename to Cpop-Core/src/main/java/com/cpop/core/base/table/User.java index 8410d23..0c1038e 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/base/table/SysUser.java +++ b/Cpop-Core/src/main/java/com/cpop/core/base/table/User.java @@ -25,7 +25,7 @@ import java.io.Serializable; @AllArgsConstructor @Accessors(chain = true) @Table(value = "cp_sys_user", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) -public class SysUser extends BaseEntity implements Serializable { +public class User extends BaseEntity implements Serializable { /** * 主键 diff --git a/Cpop-Core/src/main/java/com/cpop/core/config/AsyncScheduledTaskConfig.java b/Cpop-Core/src/main/java/com/cpop/core/config/AsyncScheduledTaskConfig.java index 095fb9a..9aa8470 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/config/AsyncScheduledTaskConfig.java +++ b/Cpop-Core/src/main/java/com/cpop/core/config/AsyncScheduledTaskConfig.java @@ -45,18 +45,16 @@ public class AsyncScheduledTaskConfig { executor.setWaitForTasksToCompleteOnShutdown(false); //设置线程池中任务的等待时间,如果超过这个时候还没有销毁就强制销毁,以确保应用最后能够被关闭,而不是阻塞住 executor.setAwaitTerminationSeconds(config.getAwaitTerminationSeconds()); - /** - * 拒绝处理策略 - * CallerRunsPolicy():交由调用方线程运行,比如 main 线程。 - * AbortPolicy():直接抛出异常。 - * DiscardPolicy():直接丢弃。 - * DiscardOldestPolicy():丢弃队列中最老的任务。 - * 特殊说明: - * 1. 这里演示环境,拒绝策略咱们采用抛出异常 - * 2.真实业务场景会把缓存队列的大小会设置大一些, - * 如果,提交的任务数量超过最大线程数量或将任务环缓存到本地、redis、mysql中,保证消息不丢失 - * 3.如果项目比较大的话,异步通知种类很多的话,建议采用MQ做异步通知方案 - */ + //拒绝处理策略 + //CallerRunsPolicy():交由调用方线程运行,比如 main 线程。 + //AbortPolicy():直接抛出异常。 + //DiscardPolicy():直接丢弃。 + //DiscardOldestPolicy():丢弃队列中最老的任务。 + //特殊说明: + //1. 这里演示环境,拒绝策略咱们采用抛出异常 + //2.真实业务场景会把缓存队列的大小会设置大一些, + //如果,提交的任务数量超过最大线程数量或将任务环缓存到本地、redis、mysql中,保证消息不丢失 + //3.如果项目比较大的话,异步通知种类很多的话,建议采用MQ做异步通知方案 executor.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy()); //线程初始化 executor.initialize(); diff --git a/Cpop-Core/src/main/java/com/cpop/core/config/CoreInitConfig.java b/Cpop-Core/src/main/java/com/cpop/core/config/CoreInitConfig.java new file mode 100644 index 0000000..be77be1 --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/config/CoreInitConfig.java @@ -0,0 +1,29 @@ +package com.cpop.core.config; + +import com.cpop.core.service.ConfigService; +import com.cpop.core.strategy.dataSourceSharding.CpopDataSourceShardingStrategy; +import com.cpop.core.utils.SpringUtils; +import com.mybatisflex.core.datasource.DataSourceManager; +import jakarta.annotation.PostConstruct; +import org.springframework.context.annotation.Configuration; + +/** + * 核心初始化文件 + * @author DB + * @version 1.0.0 + * @since 2024-02-05 9:39 + */ +@Configuration +public class CoreInitConfig { + + /** + * 初始化 + */ + @PostConstruct + public void init() { + //设置数据源分片策略 + DataSourceManager.setDataSourceShardingStrategy(new CpopDataSourceShardingStrategy()); + //初始化系统配置信息 + SpringUtils.getBean(ConfigService.class).loadingConfigCache(); + } +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/config/CpopConfig.java b/Cpop-Core/src/main/java/com/cpop/core/config/CpopConfig.java index 7110a96..b07955c 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/config/CpopConfig.java +++ b/Cpop-Core/src/main/java/com/cpop/core/config/CpopConfig.java @@ -1,5 +1,6 @@ package com.cpop.core.config; +import lombok.Getter; import org.springframework.boot.context.properties.ConfigurationProperties; import org.springframework.stereotype.Component; @@ -8,6 +9,7 @@ import org.springframework.stereotype.Component; * * @author DB */ +@Getter @Component @ConfigurationProperties(prefix = "cpop") public class CpopConfig { @@ -29,20 +31,13 @@ public class CpopConfig { /** * 验证码类型 */ + @Getter private static String captchaType; - public String getName() { - return name; - } - public void setName(String name) { this.name = name; } - public String getVersion() { - return version; - } - public void setVersion(String version) { this.version = version; } @@ -55,10 +50,6 @@ public class CpopConfig { CpopConfig.profile = profile; } - public static String getCaptchaType() { - return captchaType; - } - public void setCaptchaType(String captchaType) { CpopConfig.captchaType = captchaType; } diff --git a/Cpop-Core/src/main/java/com/cpop/core/config/FilterConfig.java b/Cpop-Core/src/main/java/com/cpop/core/config/FilterConfig.java index a43370f..31cac31 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/config/FilterConfig.java +++ b/Cpop-Core/src/main/java/com/cpop/core/config/FilterConfig.java @@ -1,7 +1,8 @@ package com.cpop.core.config; -import com.cpop.common.utils.StringUtils; import com.cpop.core.filter.XssFilter; +import com.cpop.core.utils.StringUtils; +import jakarta.servlet.DispatcherType; import lombok.Data; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.ConfigurationProperties; @@ -9,7 +10,6 @@ import org.springframework.boot.web.servlet.FilterRegistrationBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import javax.servlet.DispatcherType; import java.util.HashMap; import java.util.Map; diff --git a/Cpop-Core/src/main/java/com/cpop/core/config/RedisConfig.java b/Cpop-Core/src/main/java/com/cpop/core/config/RedisConfig.java index fc95791..aa100bb 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/config/RedisConfig.java +++ b/Cpop-Core/src/main/java/com/cpop/core/config/RedisConfig.java @@ -1,15 +1,28 @@ package com.cpop.core.config; import com.cpop.core.base.entity.FastJson2JsonRedisSerializer; +import com.cpop.core.utils.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.data.redis.RedisProperties; +import org.springframework.cache.CacheManager; import org.springframework.cache.annotation.CachingConfigurerSupport; import org.springframework.cache.annotation.EnableCaching; +import org.springframework.cache.interceptor.KeyGenerator; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Primary; +import org.springframework.data.redis.cache.RedisCacheManager; import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.connection.RedisStandaloneConfiguration; +import org.springframework.data.redis.connection.jedis.JedisConnectionFactory; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.script.DefaultRedisScript; import org.springframework.data.redis.serializer.StringRedisSerializer; +import java.util.Arrays; + /** * redis配置 * @@ -19,9 +32,24 @@ import org.springframework.data.redis.serializer.StringRedisSerializer; @EnableCaching public class RedisConfig extends CachingConfigurerSupport { - @Bean + @Autowired + private RedisProperties redisProperties; + + @Primary + @Bean(name = "redisConnectionFactory") + public RedisConnectionFactory wxOpenRedisConnectionFactory() { + RedisStandaloneConfiguration configuration = new RedisStandaloneConfiguration(redisProperties.getHost(), redisProperties.getPort()); + configuration.setDatabase(redisProperties.getDatabase()); + if (StringUtils.isNotBlank(redisProperties.getPassword())) { + configuration.setPassword(redisProperties.getPassword()); + } + return new JedisConnectionFactory(configuration); + } + + @Bean(name = "redisTemplate") @SuppressWarnings(value = {"unchecked", "rawtypes"}) - public RedisTemplate redisTemplate(RedisConnectionFactory connectionFactory) { + @ConditionalOnMissingBean(name = "redisTemplate") + public RedisTemplate redisTemplate(@Qualifier("redisConnectionFactory") RedisConnectionFactory connectionFactory) { RedisTemplate template = new RedisTemplate<>(); template.setConnectionFactory(connectionFactory); FastJson2JsonRedisSerializer serializer = new FastJson2JsonRedisSerializer(Object.class); @@ -35,6 +63,28 @@ public class RedisConfig extends CachingConfigurerSupport { return template; } + /** + * 缓存管理器 + */ + @Bean + public CacheManager cacheManager(RedisConnectionFactory redisConnectionFactory) { + RedisCacheManager.RedisCacheManagerBuilder builder = RedisCacheManager + .RedisCacheManagerBuilder + .fromConnectionFactory(redisConnectionFactory); + return builder.build(); + } + + @Bean + public KeyGenerator wiselyKeyGenerator() { + return (target, method, params) -> { + StringBuilder sb = new StringBuilder(); + sb.append(target.getClass().getName()); + sb.append(method.getName()); + Arrays.stream(params).map(Object::toString).forEach(sb::append); + return sb.toString(); + }; + } + @Bean public DefaultRedisScript limitScript() { DefaultRedisScript redisScript = new DefaultRedisScript<>(); diff --git a/Cpop-Core/src/main/java/com/cpop/core/config/RestTemplateConfig.java b/Cpop-Core/src/main/java/com/cpop/core/config/RestTemplateConfig.java index 7b9f144..0215961 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/config/RestTemplateConfig.java +++ b/Cpop-Core/src/main/java/com/cpop/core/config/RestTemplateConfig.java @@ -1,10 +1,13 @@ package com.cpop.core.config; +import org.springframework.boot.web.client.RestTemplateBuilder; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.web.client.RestTemplate; +import java.time.Duration; + /** * @author DB * @version 1.0.0 @@ -14,15 +17,13 @@ import org.springframework.web.client.RestTemplate; public class RestTemplateConfig { @Bean - public RestTemplate restTemplate() { - // 创建一个 HttpComponentsClientHttpRequestFactory 客户端请求工厂实例 - HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(); + public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) { // 设置连接超时时间为 5 秒 - requestFactory.setConnectTimeout(5000); + restTemplateBuilder.setConnectTimeout(Duration.ofMillis(5000)); // 设置读取超时时间为 10 秒 - requestFactory.setReadTimeout(10000); + restTemplateBuilder.setReadTimeout(Duration.ofMillis(10000)); // 使用 HttpComponentsClientHttpRequestFactory 客户端请求工厂实例创建 RestTemplate 实例 - return new RestTemplate(requestFactory); + return restTemplateBuilder.build(); } } diff --git a/Cpop-Core/src/main/java/com/cpop/core/config/SecurityConfig.java b/Cpop-Core/src/main/java/com/cpop/core/config/SecurityConfig.java deleted file mode 100644 index 302f478..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/config/SecurityConfig.java +++ /dev/null @@ -1,215 +0,0 @@ -package com.cpop.core.config; - -import com.cpop.common.constant.Constants; -import com.cpop.common.utils.StringUtils; -import com.cpop.core.filter.JwtAuthenticationFilter; -import com.cpop.core.filter.RepeatableFilter; -import com.cpop.core.gateway.miniProgram.MiniProgramAuthenticationFilter; -import com.cpop.core.gateway.miniProgram.MiniProgramAuthenticationProvider; -import com.cpop.core.gateway.sys.SysAuthenticationFilter; -import com.cpop.core.gateway.sys.SysAuthenticationProvider; -import com.cpop.core.handler.*; -import com.cpop.core.utils.JwtUtils; -import com.cpop.core.utils.PasswordEncoder; -import lombok.RequiredArgsConstructor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.authentication.AuthenticationManager; -import org.springframework.security.authentication.ProviderManager; -import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity; -import org.springframework.security.config.annotation.web.builders.HttpSecurity; -import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; -import org.springframework.security.config.http.SessionCreationPolicy; -import org.springframework.security.web.SecurityFilterChain; -import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; -import org.springframework.security.web.authentication.logout.LogoutFilter; -import org.springframework.web.cors.CorsConfiguration; -import org.springframework.web.cors.CorsConfigurationSource; -import org.springframework.web.cors.UrlBasedCorsConfigurationSource; -import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -import java.util.Arrays; -import java.util.Collections; - -/** - * @author DB - * @Description: Security配置中心 - * @since 2023-08-05 8:01 - */ -@Configuration -@EnableWebSecurity -@RequiredArgsConstructor -@EnableMethodSecurity -public class SecurityConfig implements WebMvcConfigurer { - - @Autowired - private JwtLogoutSuccessHandler jwtLogoutSuccessHandler; - - @Autowired - private JwtAuthenticationEntryPoint jwtAuthenticationEntryPoint; - - @Autowired - private JwtAccessDeniedHandler jwtAccessDeniedHandler; - - @Autowired - private RepeatableFilter repeatableFilter; - - @Autowired - private LoginSuccessHandler loginSuccessHandler; - - @Autowired - private LoginFailureHandler loginFailureHandler; - - @Autowired - private CpopConfig cpopConfig; - - @Autowired - private JwtUtils jwtUtils; - - /** - * Security过滤拦截配置 - * - * @param http 请求 - * @return SecurityFilterChain 认证过滤链 - * @throws Exception 异常 - */ - @Bean - public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { - http - .cors(AbstractHttpConfigurer::disable) - .csrf(AbstractHttpConfigurer::disable) - //登录配置(多登陆模式自定义成功与失败->现已注释) - /*.formLogin(formLogin -> { - formLogin.successHandler(loginSuccessHandler) - .failureHandler(loginFailureHandler); - })*/ - //登出配置 - .logout(logout -> logout.logoutSuccessHandler(jwtLogoutSuccessHandler)) - //禁用session - .sessionManagement(sessionManagement -> { - sessionManagement.sessionCreationPolicy(SessionCreationPolicy.STATELESS); - }) - //配置拦截规则 - .authorizeHttpRequests(authorizeHttpRequests -> { - authorizeHttpRequests.antMatchers(StringUtils.split(jwtUtils.getWhiteList(), ",")).permitAll() - .anyRequest().authenticated(); - }) - //异常处理器 - .exceptionHandling(exceptionHandling -> { - exceptionHandling.authenticationEntryPoint(jwtAuthenticationEntryPoint).accessDeniedHandler(jwtAccessDeniedHandler); - }) - //自定义认证管理器 - .authenticationManager(authenticationManager()) - //流重复使用 - .addFilterBefore(repeatableFilter, UsernamePasswordAuthenticationFilter.class) - // 添加 JWT 过滤器,JWT 过滤器在退出认证过滤器之前 - .addFilterBefore(authFilter(), LogoutFilter.class) - //.addFilterAt(oamLoginFilter(http.getSharedObject(AuthenticationManager.class)), UsernamePasswordAuthenticationFilter.class) - //系统登陆 - .addFilterAt(sysAuthenticationFilter(http.getSharedObject(AuthenticationManager.class)), UsernamePasswordAuthenticationFilter.class) - //小程序认证 - .addFilterAt(miniProgramAuthenticationFilter(http.getSharedObject(AuthenticationManager.class)), UsernamePasswordAuthenticationFilter.class); - return http.build(); - } - - /** - * @Description: 小程序登陆认证方式(可自定义其他模式) - * @param authenticationManager 认证管理器 - * @return MiniProgramAuthenticationFilter - * @author DB - * @Date: 2023/8/24 0024 10:43 - */ - @Bean - public SysAuthenticationFilter sysAuthenticationFilter(AuthenticationManager authenticationManager) { - SysAuthenticationFilter filter = new SysAuthenticationFilter(); - filter.setAuthenticationManager(authenticationManager); - filter.setAuthenticationSuccessHandler(loginSuccessHandler); - filter.setAuthenticationFailureHandler(loginFailureHandler); - return filter; - } - - @Bean - public SysAuthenticationProvider sysAuthenticationProvider() { - return new SysAuthenticationProvider(); - } - - /** - * @Description: 小程序登陆认证方式(可自定义其他模式) - * @param authenticationManager 认证管理器 - * @return MiniProgramAuthenticationFilter - * @author DB - * @Date: 2023/8/24 0024 10:43 - */ - @Bean - public MiniProgramAuthenticationFilter miniProgramAuthenticationFilter(AuthenticationManager authenticationManager) { - MiniProgramAuthenticationFilter filter = new MiniProgramAuthenticationFilter(); - filter.setAuthenticationManager(authenticationManager); - filter.setAuthenticationSuccessHandler(loginSuccessHandler); - filter.setAuthenticationFailureHandler(loginFailureHandler); - return filter; - } - - @Bean - public MiniProgramAuthenticationProvider miniProgramAuthenticationProvider() { - return new MiniProgramAuthenticationProvider(); - } - - /** - * 获取AuthenticationManager(认证管理器),登录时认证使用 - * @return AuthenticationManager - */ - @Bean - public AuthenticationManager authenticationManager() { - return new ProviderManager(Arrays.asList(sysAuthenticationProvider(), miniProgramAuthenticationProvider())); - } - - /** - * 密码明文加密方式配置 - * @return PasswordEncoder - */ - @Bean - public PasswordEncoder passwordEncoder() { - return new PasswordEncoder(); - } - - /** - * jwt 校验过滤器,从 http 头部 Authorization 字段读取 token 并校验 - * @return JwtAuthenticationFilter - */ - @Bean - public JwtAuthenticationFilter authFilter() { - return new JwtAuthenticationFilter(); - } - - /** - * 配置跨源访问(CORS) - * @return CorsConfigurationSource - */ - @Bean - public CorsConfigurationSource corsConfigurationSource() { - CorsConfiguration configuration = new CorsConfiguration(); - configuration.setAllowedOrigins(Collections.singletonList("*")); - configuration.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE")); - configuration.setAllowedHeaders(Arrays.asList("Authorization", "Content-Type")); - configuration.applyPermitDefaultValues(); - UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource(); - source.registerCorsConfiguration("/**", configuration); - return source; - } - - /** - * @param registry 资源注册 - * @Description: 资源映射 - * @Author DB - * @Date: 2023/5/27 13:57 - */ - @Override - public void addResourceHandlers(ResourceHandlerRegistry registry) { - //本地文件上传路径 - registry.addResourceHandler(Constants.RESOURCE_PREFIX + "/**") - .addResourceLocations("file:" + cpopConfig.getProfile() + "/"); - } -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/config/ServerConfig.java b/Cpop-Core/src/main/java/com/cpop/core/config/ServerConfig.java index 5fe6ffd..e9ccb30 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/config/ServerConfig.java +++ b/Cpop-Core/src/main/java/com/cpop/core/config/ServerConfig.java @@ -1,9 +1,9 @@ package com.cpop.core.config; -import com.cpop.common.utils.ServletUtils; +import com.cpop.core.utils.ServletUtils; +import jakarta.servlet.http.HttpServletRequest; import org.springframework.stereotype.Component; -import javax.servlet.http.HttpServletRequest; /** * 服务相关配置 diff --git a/Cpop-Core/src/main/java/com/cpop/core/config/TencentCosProperties.java b/Cpop-Core/src/main/java/com/cpop/core/config/TencentCosProperties.java deleted file mode 100644 index 52ddb83..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/config/TencentCosProperties.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.cpop.core.config; - -import lombok.Data; -import org.springframework.boot.context.properties.ConfigurationProperties; - -/** - * @author DB - * @createTime 2023/10/31 15:46 - * @description 腾讯yun配置 - */ -@Data -@ConfigurationProperties(prefix = "tencent.cos") -public class TencentCosProperties { - - /** - * id - */ - private String secretId; - - /** - * 密钥 - */ - private String secretKey; - - /** - * 桶名 - */ - private String bucketName; - - /** - * 加速路径 - */ - private String cdnUrl; - - /** - * 地区 - */ - private String region; - -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/constant/Constants.java b/Cpop-Core/src/main/java/com/cpop/core/constant/Constants.java new file mode 100644 index 0000000..dcb9d7a --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/constant/Constants.java @@ -0,0 +1,217 @@ +package com.cpop.core.constant; + +/** + * 通用常量信息 + * + * @author DB + */ +public interface Constants { + /** + * UTF-8 字符集 + */ + String PC = "/pc"; + /** + * UTF-8 字符集 + */ + String APP = "/app"; + /** + * UTF-8 字符集 + */ + String APPLETS = "/applets"; + /** + * UTF-8 字符集 + */ + String UTF8 = "UTF-8"; + + /** + * contentType json/utf-8 + */ + String CONTENT_TYPE_JSON_UTF8 = "application/json;charset=utf-8"; + + /** + * GBK 字符集 + */ + String GBK = "GBK"; + + /** + * http请求 + */ + String HTTP = "http://"; + + /** + * https请求 + */ + String HTTPS = "https://"; + + /** + * 通用成功标识 + */ + Integer SUCCESS = 200; + + /** + * 通用失败标识 + */ + Integer FAIL = 500; + + /** + * 登录成功 + */ + String LOGIN_SUCCESS = "Success"; + + /** + * 注销 + */ + String LOGOUT = "Logout"; + + /** + * 注册 + */ + String REGISTER = "Register"; + + /** + * 登录失败 + */ + String LOGIN_FAIL = "Error"; + + /** + * 验证码 redis key + */ + String CAPTCHA_CODE_KEY = "captcha_codes:"; + + /** + * 登录用户 redis key + */ + String LOGIN_TOKEN_KEY = "login_tokens:"; + + /** + * 防重提交 redis key + */ + String REPEAT_SUBMIT_KEY = "repeat_submit:"; + + /** + * 限流 redis key + */ + String RATE_LIMIT_KEY = "rate_limit:"; + + /** + * 验证码有效期(分钟) + */ + Integer CAPTCHA_EXPIRATION = 2; + + /** + * 令牌 + */ + String TOKEN = "token"; + + /** + * 令牌前缀 + */ + String TOKEN_PREFIX = "Bearer "; + + /** + * 令牌前缀 + */ + String LOGIN_USER_KEY = "login_user_key"; + + /** + * 用户ID + */ + String JWT_USERID = "userid"; + + /** + * 用户名称 + */ + //String JWT_USERNAME = Claims.SUBJECT; + + /** + * 用户头像 + */ + String JWT_AVATAR = "avatar"; + + /** + * 创建时间 + */ + String JWT_CREATED = "created"; + + /** + * 用户权限 + */ + String JWT_AUTHORITIES = "authorities"; + + /** + * 参数管理 cache key + */ + String CONFIG_KEY = "config:"; + + /** + * 字典管理 cache key + */ + String SYS_DICT_KEY = "sys_dict:"; + + /** + * 资源映射路径 前缀 + */ + String RESOURCE_PREFIX = "/profile"; + + /** + * RMI 远程方法调用 + */ + String LOOKUP_RMI = "rmi://"; + + /** + * LDAP 远程方法调用 + */ + String LOOKUP_LDAP = "ldap://"; + + /** + * 定时任务违规的字符 + */ + String[] JOB_ERROR_STR = {"java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml", + "org.springframework.jndi"}; + + /** + * 超级管理员 + */ + String SUPER_ADMIN = "Jambox"; + + /** + * 超级管理员ID + */ + String SUPER_ADMIN_ID = "100"; + + /** + * 超级身份id + */ + String SUPER_IDENTITY_AUTH_ID = "100"; + + /** + * 超级管理员 + */ + String SUPER_ADMIN_VALUE = "SuperAdmin"; + + /** + * 所有权限 + */ + String ALL_PERMISSION = "*"; + + /** + * 隐藏菜单 + */ + String HIDE_MENU = "System,Menu,Dict"; + + /** + * 用户类型 + */ + String USER_TYPE = "UserType"; + + /** + * 登陆查询用户字段 + */ + String USERNAME = "UserName"; + + /** + * 二维码Base64头 + */ + String QRCODE_HEADER = "data:image/png;base64,"; + +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/constant/HttpStatus.java b/Cpop-Core/src/main/java/com/cpop/core/constant/HttpStatus.java new file mode 100644 index 0000000..2be01b5 --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/constant/HttpStatus.java @@ -0,0 +1,93 @@ +package com.cpop.core.constant; + +/** + * 返回状态码 + * + * @author DB + */ +public interface HttpStatus { + /** + * 操作成功 + */ + int SUCCESS = 200; + + /** + * 对象创建成功 + */ + int CREATED = 201; + + /** + * 请求已经被接受 + */ + int ACCEPTED = 202; + + /** + * 操作已经执行成功,但是没有返回数据 + */ + int NO_CONTENT = 204; + + /** + * 资源已被移除 + */ + int MOVED_PERM = 301; + + /** + * 重定向 + */ + int SEE_OTHER = 303; + + /** + * 资源没有被修改 + */ + int NOT_MODIFIED = 304; + + /** + * 参数列表错误(缺少,格式不匹配) + */ + int BAD_REQUEST = 400; + + /** + * 未授权 + */ + int UNAUTHORIZED = 401; + + /** + * 访问受限,授权过期 + */ + int FORBIDDEN = 403; + + /** + * 资源,服务未找到 + */ + int NOT_FOUND = 404; + + /** + * 不允许的http方法 + */ + int BAD_METHOD = 405; + + /** + * 资源冲突,或者资源被锁 + */ + int CONFLICT = 409; + + /** + * 不支持的数据,媒体类型 + */ + int UNSUPPORTED_TYPE = 415; + + /** + * 系统内部错误 + */ + int ERROR = 500; + + /** + * 接口未实现 + */ + int NOT_IMPLEMENTED = 501; + + /** + * 校区过期 + */ + int STORE_EXPIRE = 10000; +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/constant/RedisKey.java b/Cpop-Core/src/main/java/com/cpop/core/constant/RedisKey.java new file mode 100644 index 0000000..9a8e89c --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/constant/RedisKey.java @@ -0,0 +1,19 @@ +package com.cpop.core.constant; + +/** + * @author DB + * @date 2022-09-23 23:28 + */ +public interface RedisKey { + + /** + * 验证码 + */ + String CAPTCHA_KEY = "sys:sysLogin:captcha:"; + + /** + * redis分布式锁key + */ + String DISTRIBUTED_LOCK = "sys:redis:distributedLock"; + +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/filter/JwtAuthenticationFilter.java b/Cpop-Core/src/main/java/com/cpop/core/filter/JwtAuthenticationFilter.java deleted file mode 100644 index db767cf..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/filter/JwtAuthenticationFilter.java +++ /dev/null @@ -1,163 +0,0 @@ -package com.cpop.core.filter; - -import com.alibaba.fastjson.JSONObject; -import com.cpop.common.constant.Constants; -import com.cpop.common.utils.StringUtils; -import com.cpop.common.utils.ip.IpUtils; -import com.cpop.core.base.R; -import com.cpop.core.base.entity.LoginUser; -import com.cpop.core.base.entity.loginInfo.MiniUserLoginInfo; -import com.cpop.core.base.enums.UserType; -import com.cpop.core.gateway.miniProgram.MiniProgramAuthenticationToken; -import com.cpop.core.gateway.sys.SysAuthenticationToken; -import com.cpop.core.service.CoreService; -import com.cpop.core.service.RedisService; -import com.cpop.core.service.impl.OamStaffDetailsServiceImpl; -import com.cpop.core.utils.JwtUtils; -import io.jsonwebtoken.Claims; -import io.jsonwebtoken.Jws; -import io.jsonwebtoken.JwtException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.lang.NonNull; -import org.springframework.lang.NonNullApi; -import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; -import org.springframework.security.core.context.SecurityContextHolder; -import org.springframework.stereotype.Component; -import org.springframework.web.filter.OncePerRequestFilter; - -import javax.servlet.FilterChain; -import javax.servlet.ServletException; -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.nio.charset.StandardCharsets; - -/** - * @author: DB - * @date: 2022-09-25 16:34 - * @Description: jwt认证过滤器 - */ -@Component -public class JwtAuthenticationFilter extends OncePerRequestFilter { - - @Autowired - private JwtUtils jwtUtils; - - @Autowired - private OamStaffDetailsServiceImpl oamStaffDetailsService; - - @Autowired - private CoreService coreService; - - @Autowired - private RedisService redisService; - - @Override - protected void doFilterInternal(HttpServletRequest request, @NonNull HttpServletResponse response,@NonNull FilterChain chain) throws IOException, ServletException { - String jwt = request.getHeader(jwtUtils.getHeader()); - // 这里如果没有jwt,继续往后走,因为后面还有鉴权管理器等去判断是否拥有身份凭证,所以是可以放行的 - // 没有jwt相当于匿名访问,若有一些接口是需要权限的,则不能访问这些接口 - if (StringUtils.isEmpty(jwt)) { - chain.doFilter(request, response); - return; - } - Jws jws = jwtUtils.getClaimsByToken(jwt); - if (jws == null) { - returnJwtException(response,"token 失效"); - return; - } - Claims claim = jws.getBody(); - if (claim == null) { - returnJwtException(response,"token 异常"); - return; - } - if (jwtUtils.isTokenExpired(claim)) { - returnJwtException(response,"token 已过期"); - return; - } - //当前用户类型下唯一 - String identification = claim.getSubject(); - String username = jws.getHeader().get(Constants.USERNAME).toString(); - UserType userType = UserType.valueOf(jws.getHeader().get(Constants.USER_TYPE).toString()); - //从缓存中获取 - JSONObject jsonObject = redisService.getCacheObject(userType.getKey() + identification); - LoginUser loginUser; - if (null == jsonObject){ - loginUser = multipleLoadUser(userType, username); - //存入缓存 - redisService.setCacheObject(userType.getKey() + loginUser.getIdentification(), loginUser); - } else { - loginUser = jsonObject.toJavaObject(LoginUser.class); - } - //获取当前请求ip - loginUser.setIpAddr(IpUtils.getIpAddr(request)); - multipleAuth(loginUser); - chain.doFilter(request, response); - } - - /** - * jwt异常直接返回 - * @param response 响应 - * @param msg 错误信息 - */ - private void returnJwtException(HttpServletResponse response,String msg) throws IOException { - response.setContentType("application/json;charset=UTF-8"); - response.setStatus(HttpServletResponse.SC_OK); - ServletOutputStream outputStream = response.getOutputStream(); - R result = R.fail(401, msg); - outputStream.write(JSONObject.toJSONString(result).getBytes(StandardCharsets.UTF_8)); - outputStream.flush(); - outputStream.close(); - } - - /** - * @descriptions 多种获取用户信息 - * @author DB - * @date 2023/09/11 13:49 - * @param userType 用户类型 - * @param username 用户名 - * @return com.pupu.core.base.entity.LoginUser - */ - private LoginUser multipleLoadUser(UserType userType, String username) { - LoginUser loginUser = null; - switch (userType) { - //系统登陆 - case OAM_USER: - case MALL_USER: - loginUser = coreService.loadUserByUsername(username, userType); - break; - case MINI_USER: - // 获取用户的权限等信息 - loginUser = coreService.loadUserByPhone(username, userType, null); - break; - default: - } - return loginUser; - } - - /** - * @Description: 多种认证方式 - * @param loginUser 登陆用户信息 - * @author DB - * @Date: 2023/8/24 0024 17:12 - */ - private void multipleAuth(LoginUser loginUser) { - switch (loginUser.getUserType()) { - case OAM_USER: - case MALL_USER: - //构建通用系统用户登陆 - // 构建UsernamePasswordAuthenticationToken,这里密码为null,是因为提供了正确的JWT,实现自动登录 - SysAuthenticationToken sysAuthenticationToken = new SysAuthenticationToken(loginUser.getIdentification(), loginUser, null); - SecurityContextHolder.getContext().setAuthentication(sysAuthenticationToken); - break; - case MINI_USER: - // MiniProgramAuthenticationToken,实现自动登录 - MiniProgramAuthenticationToken miniProgramAuthenticationToken = new MiniProgramAuthenticationToken(loginUser.getIdentification(), loginUser, null); - SecurityContextHolder.getContext().setAuthentication(miniProgramAuthenticationToken); - break; - default: - } - - } -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/filter/RepeatableFilter.java b/Cpop-Core/src/main/java/com/cpop/core/filter/RepeatableFilter.java index d556f2e..4554937 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/filter/RepeatableFilter.java +++ b/Cpop-Core/src/main/java/com/cpop/core/filter/RepeatableFilter.java @@ -1,14 +1,13 @@ package com.cpop.core.filter; -import com.cpop.common.utils.StringUtils; +import com.cpop.core.utils.StringUtils; +import jakarta.servlet.*; +import jakarta.servlet.http.HttpServletRequest; import org.springframework.http.MediaType; import org.springframework.stereotype.Component; -import javax.servlet.*; -import javax.servlet.http.HttpServletRequest; import java.io.IOException; -; /** * Repeatable 过滤器 @@ -17,14 +16,14 @@ import java.io.IOException; */ @Component public class RepeatableFilter implements Filter { + @Override public void init(FilterConfig filterConfig) throws ServletException { } @Override - public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) - throws IOException, ServletException { + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { ServletRequest requestWrapper = null; if (request instanceof HttpServletRequest && StringUtils.startsWithIgnoreCase(request.getContentType(), MediaType.APPLICATION_JSON_VALUE)) { requestWrapper = new RepeatedlyRequestWrapper((HttpServletRequest) request, response); diff --git a/Cpop-Core/src/main/java/com/cpop/core/filter/RepeatedlyRequestWrapper.java b/Cpop-Core/src/main/java/com/cpop/core/filter/RepeatedlyRequestWrapper.java index 2385e54..31d0f26 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/filter/RepeatedlyRequestWrapper.java +++ b/Cpop-Core/src/main/java/com/cpop/core/filter/RepeatedlyRequestWrapper.java @@ -1,12 +1,13 @@ package com.cpop.core.filter; -import com.cpop.common.utils.http.HttpHelper; -import javax.servlet.ReadListener; -import javax.servlet.ServletInputStream; -import javax.servlet.ServletResponse; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletRequestWrapper; +import com.cpop.core.utils.http.HttpHelper; +import jakarta.servlet.ReadListener; +import jakarta.servlet.ServletInputStream; +import jakarta.servlet.ServletResponse; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequestWrapper; + import java.io.BufferedReader; import java.io.ByteArrayInputStream; import java.io.IOException; diff --git a/Cpop-Core/src/main/java/com/cpop/core/filter/XssFilter.java b/Cpop-Core/src/main/java/com/cpop/core/filter/XssFilter.java index 515f9e8..0bc0733 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/filter/XssFilter.java +++ b/Cpop-Core/src/main/java/com/cpop/core/filter/XssFilter.java @@ -1,10 +1,10 @@ package com.cpop.core.filter; -import com.cpop.common.utils.StringUtils; +import com.cpop.core.utils.StringUtils; +import jakarta.servlet.*; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; -import javax.servlet.*; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import java.io.IOException; import java.util.ArrayList; import java.util.List; diff --git a/Cpop-Core/src/main/java/com/cpop/core/filter/XssHttpServletRequestWrapper.java b/Cpop-Core/src/main/java/com/cpop/core/filter/XssHttpServletRequestWrapper.java index 9725fac..e88fa75 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/filter/XssHttpServletRequestWrapper.java +++ b/Cpop-Core/src/main/java/com/cpop/core/filter/XssHttpServletRequestWrapper.java @@ -1,15 +1,16 @@ package com.cpop.core.filter; -import com.cpop.common.utils.StringUtils; -import com.cpop.common.utils.html.EscapeUtil; + +import com.cpop.core.utils.StringUtils; +import com.cpop.core.utils.html.EscapeUtil; +import jakarta.servlet.ReadListener; +import jakarta.servlet.ServletInputStream; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletRequestWrapper; import org.apache.commons.io.IOUtils; import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; -import javax.servlet.ReadListener; -import javax.servlet.ServletInputStream; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletRequestWrapper; import java.io.ByteArrayInputStream; import java.io.IOException; import java.nio.charset.StandardCharsets; diff --git a/Cpop-Core/src/main/java/com/cpop/core/gateway/miniProgram/MiniProgramAuthenticationFilter.java b/Cpop-Core/src/main/java/com/cpop/core/gateway/miniProgram/MiniProgramAuthenticationFilter.java deleted file mode 100644 index 8e17739..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/gateway/miniProgram/MiniProgramAuthenticationFilter.java +++ /dev/null @@ -1,86 +0,0 @@ -package com.cpop.core.gateway.miniProgram; - -import com.cpop.common.utils.StringUtils; -import com.cpop.core.base.enums.UserType; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.springframework.security.authentication.AbstractAuthenticationToken; -import org.springframework.security.authentication.AuthenticationServiceException; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.AuthenticationException; -import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter; -import org.springframework.security.web.util.matcher.AntPathRequestMatcher; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; - -/** - * @author DB - * @Description: 小程序认证过滤器 - * @create 2023-08-23 21:03 - */ -public class MiniProgramAuthenticationFilter extends AbstractAuthenticationProcessingFilter { - - public MiniProgramAuthenticationFilter() { - super(new AntPathRequestMatcher("/miniLogin", "POST")); - } - - @Override - public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException { - if (!"POST".equals(request.getMethod())) { - throw new AuthenticationServiceException("Authentication method not supported: " + request.getMethod()); - } - ObjectMapper mapper = new ObjectMapper(); - InputStream inputStream; - Map authenticationBean; - try { - inputStream = request.getInputStream(); - authenticationBean = mapper.readValue(inputStream, Map.class); - } catch (IOException e) { - throw new RuntimeException(e); - } - String principal = (String) authenticationBean.get("phone"); - if (StringUtils.isBlank(principal)){ - throw new AuthenticationServiceException("登录手机号为空"); - } - String openId = (String) authenticationBean.get("openId"); - if (StringUtils.isBlank(openId)){ - throw new AuthenticationServiceException("登录openId为空"); - } - String appId = (String) authenticationBean.get("appId"); - if (StringUtils.isBlank(appId)){ - throw new AuthenticationServiceException("登录appId为空"); - } - String brandId = (String) authenticationBean.get("brandId"); - if (StringUtils.isBlank(brandId)){ - throw new AuthenticationServiceException("登录brandId为空"); - } - String nickName = (String) authenticationBean.get("nickName"); - String avatar = (String) authenticationBean.get("avatar"); - String sourceType = (String) authenticationBean.get("sourceType"); - if (StringUtils.isBlank(sourceType)){ - throw new AuthenticationServiceException("登录sourceType为空"); - } - UserType userType = UserType.valueOf(authenticationBean.get("userType").toString());//传递信息 - HashMap credentials = new HashMap<>(2); - credentials.put("appId", appId); - credentials.put("openId", openId); - credentials.put("userType", userType); - credentials.put("brandId", brandId); - credentials.put("nickName", nickName); - credentials.put("avatar", avatar); - credentials.put("sourceType", sourceType); - principal = principal.trim(); - MiniProgramAuthenticationToken authRequest = new MiniProgramAuthenticationToken(principal, credentials); - this.setDetails(request, authRequest); - return this.getAuthenticationManager().authenticate(authRequest); - } - - protected void setDetails(HttpServletRequest request, AbstractAuthenticationToken authRequest) { - authRequest.setDetails(this.authenticationDetailsSource.buildDetails(request)); - } - -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/gateway/miniProgram/MiniProgramAuthenticationProvider.java b/Cpop-Core/src/main/java/com/cpop/core/gateway/miniProgram/MiniProgramAuthenticationProvider.java deleted file mode 100644 index 1948b95..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/gateway/miniProgram/MiniProgramAuthenticationProvider.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.cpop.core.gateway.miniProgram; - -import com.cpop.core.base.entity.LoginUser; -import com.cpop.core.base.enums.UserType; -import com.cpop.core.service.CoreService; -import com.cpop.core.utils.SpringUtils; -import org.springframework.security.authentication.AuthenticationProvider; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.AuthenticationException; - -import java.util.Map; - -/** - * @author DB - * @Description: 自定义校验过程 - * @create 2023-08-23 21:13 - */ -public class MiniProgramAuthenticationProvider implements AuthenticationProvider { - - @Override - public Authentication authenticate(Authentication authentication) throws AuthenticationException { - // 这个获取表单输入中返回的用户名; - String phone =(String) authentication.getPrincipal(); - // 这个是表单中输入的密码; - Map credentials = (Map) authentication.getCredentials(); - UserType userType = (UserType) credentials.get("userType"); - LoginUser loginUser = SpringUtils.getBean(CoreService.class).loadUserByPhone(phone, userType, credentials); - loginUser.setUserType(UserType.MINI_USER); - MiniProgramAuthenticationToken result = new MiniProgramAuthenticationToken(phone, loginUser); - result.setDetails(loginUser); - return result; - } - - @Override - public boolean supports(Class authentication) { - //providerManager会遍历所有;securityConfig中注册的provider集合;根据此方法返回true或false来决定由哪个provider;去校验请求过来的authentication - return (MiniProgramAuthenticationToken.class.isAssignableFrom(authentication)); - } - -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/gateway/miniProgram/MiniProgramAuthenticationToken.java b/Cpop-Core/src/main/java/com/cpop/core/gateway/miniProgram/MiniProgramAuthenticationToken.java deleted file mode 100644 index fa2fa9a..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/gateway/miniProgram/MiniProgramAuthenticationToken.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.cpop.core.gateway.miniProgram; - -import org.springframework.security.authentication.AbstractAuthenticationToken; -import org.springframework.security.core.GrantedAuthority; - -import java.util.Collection; - -/** - * @author DB - * @Description: - * @create 2023-08-23 21:11 - */ -public class MiniProgramAuthenticationToken extends AbstractAuthenticationToken { - - private final Object principal; - private Object credentials; - - /** - * This constructor can be safely used by any code that wishes to create a - * UsernamePasswordAuthenticationToken, as the {@link #isAuthenticated()} - * will return false. - * - */ - public MiniProgramAuthenticationToken(Object principal, Object credentials) { - super(null); - this.principal = principal; - this.credentials = credentials; - setAuthenticated(false); - } - - /** - * This constructor should only be used by AuthenticationManager or - * AuthenticationProvider implementations that are satisfied with - * producing a trusted (i.e. {@link #isAuthenticated()} = true) - * authentication token. - * - * @param principal - * @param credentials - * @param authorities - */ - public MiniProgramAuthenticationToken(Object principal, Object credentials, Collection authorities) { - super(authorities); - this.principal = principal; - this.credentials = credentials; - // must use super, as we override - super.setAuthenticated(true); - } - - @Override - public Object getCredentials() { - return this.credentials; - } - - @Override - public Object getPrincipal() { - return this.principal; - } - - @Override - public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException { - if (isAuthenticated) { - throw new IllegalArgumentException("Cannot set this token to trusted - use constructor which takes a GrantedAuthority list instead"); - } - super.setAuthenticated(false); - } - - @Override - public void eraseCredentials() { - super.eraseCredentials(); - credentials = null; - } -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/gateway/sys/SysAuthenticationFilter.java b/Cpop-Core/src/main/java/com/cpop/core/gateway/sys/SysAuthenticationFilter.java deleted file mode 100644 index 2cb660f..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/gateway/sys/SysAuthenticationFilter.java +++ /dev/null @@ -1,63 +0,0 @@ -package com.cpop.core.gateway.sys; - -import com.cpop.core.base.enums.UserType; -import com.cpop.core.gateway.miniProgram.MiniProgramAuthenticationToken; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.springframework.security.authentication.AbstractAuthenticationToken; -import org.springframework.security.authentication.AuthenticationServiceException; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.AuthenticationException; -import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter; -import org.springframework.security.web.util.matcher.AntPathRequestMatcher; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; - -/** - * @author DB - * @createTime 2023/10/19 9:27 - * @description - */ -public class SysAuthenticationFilter extends AbstractAuthenticationProcessingFilter { - - public SysAuthenticationFilter() { - super(new AntPathRequestMatcher("/login", "POST")); - } - - @Override - public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException, IOException, ServletException { - if (!"POST".equals(request.getMethod())) { - throw new AuthenticationServiceException("Authentication method not supported: " + request.getMethod()); - } - //读取表单 - ObjectMapper mapper = new ObjectMapper(); - InputStream inputStream; - Map authenticationBean; - try { - inputStream = request.getInputStream(); - authenticationBean = mapper.readValue(inputStream, Map.class); - } catch (IOException e) { - throw new RuntimeException(e); - } - String principal = (String) authenticationBean.get("username"); - String password = (String) authenticationBean.get("password"); - UserType userType = UserType.valueOf(authenticationBean.get("userType").toString()); - principal = principal.trim(); - //传递信息 - HashMap credentials = new HashMap<>(2); - credentials.put("password", password); - credentials.put("userType", userType); - SysAuthenticationToken authRequest = new SysAuthenticationToken(principal, credentials); - this.setDetails(request, authRequest); - return this.getAuthenticationManager().authenticate(authRequest); - } - - protected void setDetails(HttpServletRequest request, AbstractAuthenticationToken authRequest) { - authRequest.setDetails(this.authenticationDetailsSource.buildDetails(request)); - } -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/gateway/sys/SysAuthenticationProvider.java b/Cpop-Core/src/main/java/com/cpop/core/gateway/sys/SysAuthenticationProvider.java deleted file mode 100644 index 63d530e..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/gateway/sys/SysAuthenticationProvider.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.cpop.core.gateway.sys; - -import com.cpop.core.base.entity.LoginUser; -import com.cpop.core.base.enums.UserType; -import com.cpop.core.base.exception.CpopAuthenticationException; -import com.cpop.core.gateway.miniProgram.MiniProgramAuthenticationToken; -import com.cpop.core.service.CoreService; -import com.cpop.core.utils.PasswordEncoder; -import com.cpop.core.utils.SpringUtils; -import org.springframework.security.authentication.AuthenticationProvider; -import org.springframework.security.authentication.BadCredentialsException; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.AuthenticationException; -import org.springframework.security.core.userdetails.UserDetails; - -import java.util.Map; - -/** - * @author DB - * @createTime 2023/10/19 9:36 - * @description - */ -public class SysAuthenticationProvider implements AuthenticationProvider { - - @Override - public Authentication authenticate(Authentication authentication) throws AuthenticationException { - // 这个获取表单输入中返回的用户名; - String principal = (String) authentication.getPrincipal(); - // 这个是表单中输入的密码与用户类型 - Map credentials = (Map) authentication.getCredentials(); - UserType userType = (UserType) credentials.get("userType"); - //认证用户名密码 - LoginUser loginUser = SpringUtils.getBean(CoreService.class).loadUserByUsername(principal, userType); - //账号密码校验 - boolean password = SpringUtils.getBean(PasswordEncoder.class).matches((String) credentials.get("password"), loginUser.getUser().getPassword()); - if (!password){ - throw new BadCredentialsException("用户名密码错误!"); - } - SysAuthenticationToken result = new SysAuthenticationToken(principal, loginUser); - result.setDetails(loginUser); - return result; - } - - @Override - public boolean supports(Class authentication) { - //providerManager会遍历所有;securityConfig中注册的provider集合;根据此方法返回true或false来决定由哪个provider;去校验请求过来的authentication - return (SysAuthenticationToken.class.isAssignableFrom(authentication)); - } -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/gateway/sys/SysAuthenticationToken.java b/Cpop-Core/src/main/java/com/cpop/core/gateway/sys/SysAuthenticationToken.java deleted file mode 100644 index 8e15480..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/gateway/sys/SysAuthenticationToken.java +++ /dev/null @@ -1,72 +0,0 @@ -package com.cpop.core.gateway.sys; - -import org.springframework.security.authentication.AbstractAuthenticationToken; -import org.springframework.security.core.GrantedAuthority; - -import java.util.Collection; - -/** - * @author DB - * @createTime 2023/10/19 9:35 - * @description - */ -public class SysAuthenticationToken extends AbstractAuthenticationToken { - - private final Object principal; - private Object credentials; - - /** - * This constructor can be safely used by any code that wishes to create a - * UsernamePasswordAuthenticationToken, as the {@link #isAuthenticated()} - * will return false. - * - */ - public SysAuthenticationToken(Object principal, Object credentials) { - super(null); - this.principal = principal; - this.credentials = credentials; - setAuthenticated(false); - } - - /** - * This constructor should only be used by AuthenticationManager or - * AuthenticationProvider implementations that are satisfied with - * producing a trusted (i.e. {@link #isAuthenticated()} = true) - * authentication token. - * - * @param principal 第一个参数 - * @param credentials 第二个参数 - * @param authorities 认证 - */ - public SysAuthenticationToken(Object principal, Object credentials, Collection authorities) { - super(authorities); - this.principal = principal; - this.credentials = credentials; - // must use super, as we override - super.setAuthenticated(true); - } - - @Override - public Object getCredentials() { - return this.credentials; - } - - @Override - public Object getPrincipal() { - return this.principal; - } - - @Override - public void setAuthenticated(boolean isAuthenticated) throws IllegalArgumentException { - if (isAuthenticated) { - throw new IllegalArgumentException("Cannot set this token to trusted - use constructor which takes a GrantedAuthority list instead"); - } - super.setAuthenticated(false); - } - - @Override - public void eraseCredentials() { - super.eraseCredentials(); - credentials = null; - } -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/handler/GlobalExceptionHandler.java b/Cpop-Core/src/main/java/com/cpop/core/handler/GlobalExceptionHandler.java index 68ab15a..fa66446 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/handler/GlobalExceptionHandler.java +++ b/Cpop-Core/src/main/java/com/cpop/core/handler/GlobalExceptionHandler.java @@ -1,23 +1,17 @@ package com.cpop.core.handler; -import com.cpop.core.base.R; +import cn.dev33.satoken.exception.SaTokenException; +import com.cpop.core.base.entity.R; +import com.cpop.core.base.enums.ErrorCodeEnum; import com.cpop.core.base.exception.ServiceException; -import com.cpop.common.enums.ErrorCodeEnum; -import io.jsonwebtoken.JwtException; +import jakarta.servlet.http.HttpServletRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.core.MethodParameter; -import org.springframework.http.MediaType; -import org.springframework.http.server.ServerHttpRequest; -import org.springframework.http.server.ServerHttpResponse; -import org.springframework.security.access.AccessDeniedException; import org.springframework.validation.BindException; import org.springframework.web.bind.MethodArgumentNotValidException; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; -import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice; -import javax.servlet.http.HttpServletRequest; import java.util.Objects; /** @@ -29,23 +23,23 @@ import java.util.Objects; public class GlobalExceptionHandler { private static final Logger log = LoggerFactory.getLogger(GlobalExceptionHandler.class); + + /** + * 无登录异常 + */ + @ExceptionHandler(SaTokenException.class) + public R handleNotLoginException(SaTokenException e) { + log.error(e.getMessage(), e); + return R.fail(e.getCode(), e.getMessage()); + } + /** * 业务异常 */ @ExceptionHandler(ServiceException.class) - public R handleServiceException(ServiceException e) { + public R handleServiceException(ServiceException e) { log.error(e.getMessage(), e); - Integer code = e.getCode(); - return null != code ? R.fail(code, e.getMessage()) : R.fail(e.getMessage()); - } - - /** - * 权限不足 - * @param e 权限不足异常 - */ - @ExceptionHandler(AccessDeniedException.class) - public R handleException(AccessDeniedException e) { - return R.fail(ErrorCodeEnum.HTTP_401.getInfo()); + return R.fail(e.getMessage()); } /** @@ -55,45 +49,43 @@ public class GlobalExceptionHandler { * @return */ @ExceptionHandler(RuntimeException.class) - public R handleRuntimeException(RuntimeException e, HttpServletRequest request) { + public R handleRuntimeException(RuntimeException e, HttpServletRequest request) { String requestUrl = request.getRequestURI(); log.error("请求地址'{}',发生未知异常.", requestUrl, e); return R.fail(e.getMessage()); } /** - * 自定义验证异常 + * 系统异常 + * @param e + * @param request + * @return */ - @ExceptionHandler(MethodArgumentNotValidException.class) - public R handleMethodArgumentNotValidException(MethodArgumentNotValidException e) { - log.error(e.getMessage(), e); - String message = Objects.requireNonNull(e.getBindingResult().getFieldError()).getDefaultMessage(); - return R.fail(message); + @ExceptionHandler(Exception.class) + public R handleException(Exception e, HttpServletRequest request) { + String requestUrl = request.getRequestURI(); + log.error("请求地址'{}',发生系统异常.", requestUrl, e); + return R.fail(e.getMessage()); } /** * 自定义验证异常 */ @ExceptionHandler(BindException.class) - public R handleBindException(BindException e) { + public R handleBindException(BindException e) { log.error(e.getMessage(), e); String message = e.getAllErrors().get(0).getDefaultMessage(); return R.fail(message); } /** - * 系统异常 - * @author DB - * @since 2023/12/04 - * @param e 异常 - * @param request 请求 - * @return R + * 自定义验证异常 */ - @ExceptionHandler(Exception.class) - public R handleException(Exception e, HttpServletRequest request) { - String requestUrl = request.getRequestURI(); - log.error("请求地址'{}',发生系统异常.", requestUrl, e); - return R.fail(e.getMessage()); + @ExceptionHandler(MethodArgumentNotValidException.class) + public R handleMethodArgumentNotValidException(MethodArgumentNotValidException e) { + log.error(e.getMessage(), e); + String message = Objects.requireNonNull(e.getBindingResult().getFieldError()).getDefaultMessage(); + return R.fail(message); } } diff --git a/Cpop-Core/src/main/java/com/cpop/core/handler/JwtAccessDeniedHandler.java b/Cpop-Core/src/main/java/com/cpop/core/handler/JwtAccessDeniedHandler.java deleted file mode 100644 index a4e03d4..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/handler/JwtAccessDeniedHandler.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.cpop.core.handler; - -import com.alibaba.fastjson.JSONObject; -import com.cpop.core.base.R; -import org.springframework.security.access.AccessDeniedException; -import org.springframework.security.web.access.AccessDeniedHandler; -import org.springframework.stereotype.Component; - -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.nio.charset.StandardCharsets; - -/** - * @author: DB - * @date: 2022-09-25 16:55 - * @Description: 无权限访问处理器 - */ -@Component -public class JwtAccessDeniedHandler implements AccessDeniedHandler { - - @Override - public void handle(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, AccessDeniedException e) throws IOException { - httpServletResponse.setContentType("application/json;charset=UTF-8"); - httpServletResponse.setStatus(HttpServletResponse.SC_FORBIDDEN); - ServletOutputStream outputStream = httpServletResponse.getOutputStream(); - R result = R.fail(e.getMessage()); - outputStream.write(JSONObject.toJSONString(result).getBytes(StandardCharsets.UTF_8)); - outputStream.flush(); - outputStream.close(); - } -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/handler/JwtAuthenticationEntryPoint.java b/Cpop-Core/src/main/java/com/cpop/core/handler/JwtAuthenticationEntryPoint.java deleted file mode 100644 index 25fc1a7..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/handler/JwtAuthenticationEntryPoint.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.cpop.core.handler; - -import com.alibaba.fastjson.JSONObject; -import com.cpop.core.base.R; -import org.springframework.security.core.AuthenticationException; -import org.springframework.security.web.AuthenticationEntryPoint; -import org.springframework.stereotype.Component; - -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.nio.charset.StandardCharsets; - -/** - * @author: DB - * @date: 2022-09-25 16:40 - * @Description: jwt认证失败处理器 - */ -@Component -public class JwtAuthenticationEntryPoint implements AuthenticationEntryPoint { - - @Override - public void commence(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, AuthenticationException e) throws IOException { - httpServletResponse.setContentType("application/json;charset=UTF-8"); - httpServletResponse.setStatus(HttpServletResponse.SC_UNAUTHORIZED); - ServletOutputStream outputStream = httpServletResponse.getOutputStream(); - R result = R.fail("请先登录"); - outputStream.write(JSONObject.toJSONString(result).getBytes(StandardCharsets.UTF_8)); - outputStream.flush(); - outputStream.close(); - } -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/handler/JwtLogoutSuccessHandler.java b/Cpop-Core/src/main/java/com/cpop/core/handler/JwtLogoutSuccessHandler.java deleted file mode 100644 index 6313fc5..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/handler/JwtLogoutSuccessHandler.java +++ /dev/null @@ -1,77 +0,0 @@ -package com.cpop.core.handler; - -import com.alibaba.fastjson.JSONObject; -import com.cpop.common.constant.Constants; -import com.cpop.core.base.R; -import com.cpop.core.base.entity.LoginUser; -import com.cpop.core.base.enums.OperationLogEnum; -import com.cpop.core.base.enums.UserType; -import com.cpop.core.service.CoreService; -import com.cpop.core.service.RedisService; -import com.cpop.core.utils.JwtUtils; -import com.cpop.core.utils.MessageUtils; -import com.cpop.core.utils.SpringUtils; -import io.jsonwebtoken.Claims; -import io.jsonwebtoken.Jws; -import io.jsonwebtoken.JwtException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.core.Authentication; -import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; -import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler; -import org.springframework.stereotype.Component; - -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.nio.charset.StandardCharsets; - -/** - * @author: DB - * @date: 2022-09-25 16:56 - * @Description: 登出成功处理器 - */ -@Component -public class JwtLogoutSuccessHandler implements LogoutSuccessHandler { - @Autowired - private JwtUtils jwtUtils; - - @Autowired - private RedisService redisService; - - @Override - public void onLogoutSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) throws IOException { - if (authentication != null) { - new SecurityContextLogoutHandler().logout(httpServletRequest, httpServletResponse, authentication); - } - String jwt = httpServletRequest.getHeader(jwtUtils.getHeader()); - //添加退出登录成功日志 - Jws jws = jwtUtils.getClaimsByToken(jwt); - Claims claim = jws.getBody(); - if (claim == null) { - throw new JwtException("token 异常"); - } - if (jwtUtils.isTokenExpired(claim)) { - throw new JwtException("token 已过期"); - } - String identification = claim.getSubject(); - UserType userType = UserType.valueOf(jws.getHeader().get(Constants.USER_TYPE).toString()); - //从缓存中获取 - JSONObject jsonObject = redisService.getCacheObject(userType.getKey() + identification); - if (null != jsonObject) { - LoginUser loginUser = jsonObject.toJavaObject(LoginUser.class); - SpringUtils.getBean(CoreService.class).insertOperationLog(Constants.SUCCESS, OperationLogEnum.SYSTEM_LOGOUT, loginUser, MessageUtils.message("i18n_operationLog_systemLogout")); - } - //清除缓存 - redisService.deleteObject(userType.getKey() + identification); - httpServletResponse.setContentType("application/json;charset=UTF-8"); - ServletOutputStream outputStream = httpServletResponse.getOutputStream(); - String header = jwtUtils.getHeader(); - httpServletResponse.setHeader(header, ""); - R result = R.ok(MessageUtils.message("i18n_loginOut_success")); - outputStream.write(JSONObject.toJSONString(result).getBytes(StandardCharsets.UTF_8)); - outputStream.flush(); - outputStream.close(); - } - -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/handler/LoginFailureHandler.java b/Cpop-Core/src/main/java/com/cpop/core/handler/LoginFailureHandler.java deleted file mode 100644 index 078741f..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/handler/LoginFailureHandler.java +++ /dev/null @@ -1,67 +0,0 @@ -package com.cpop.core.handler; - -import com.alibaba.fastjson.JSONObject; -import com.cpop.common.constant.Constants; -import com.cpop.common.utils.StringUtils; -import com.cpop.common.utils.ip.IpUtils; -import com.cpop.core.base.R; -import com.cpop.core.base.entity.LoginForm; -import com.cpop.core.base.entity.LoginUser; -import com.cpop.core.base.enums.OperationLogEnum; -import com.cpop.core.base.enums.UserType; -import com.cpop.core.base.exception.CpopAuthenticationException; -import com.cpop.core.service.CoreService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.core.AuthenticationException; -import org.springframework.security.web.authentication.AuthenticationFailureHandler; -import org.springframework.stereotype.Component; - -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.nio.charset.StandardCharsets; -import java.util.stream.Collectors; - -/** - * @author: DB - * @date: 2022-09-25 16:24 - * @Description: 登录失败handler - */ -@Component -public class LoginFailureHandler implements AuthenticationFailureHandler { - - @Autowired - private CoreService coreService; - - @Override - public void onAuthenticationFailure(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, AuthenticationException e) throws IOException { - httpServletResponse.setContentType("application/json;charset=UTF-8"); - ServletOutputStream outputStream = httpServletResponse.getOutputStream(); - String jsonString = httpServletRequest.getReader().lines().collect(Collectors.joining(System.lineSeparator())); - //映射登录表单 - LoginForm loginFormBo = JSONObject.parseObject(jsonString, LoginForm.class); - //构建用户信息 - LoginUser loginUser = new LoginUser(); - loginUser.setUserName(loginFormBo.getUsername()).setIpAddr(IpUtils.getIpAddr(httpServletRequest)); - String errorMessage = "用户名或密码错误"; - R result; - //自定义认证异常,可以从这里获取到想要的参数 - if(e instanceof CpopAuthenticationException) { - loginUser.setUserType((UserType) ((CpopAuthenticationException) e).getParams()); - errorMessage = e.getMessage(); - result = R.ok(errorMessage); - }else { - result = R.fail(errorMessage); - } - if (loginUser.getUserType() == UserType.OAM_USER || loginUser.getUserType() == UserType.MINI_USER) { - if (StringUtils.isNotBlank(loginFormBo.getUsername())){ - //添加登录失败日志 - coreService.insertOperationLog(Constants.FAIL, OperationLogEnum.SYSTEM_LOGIN, loginUser, errorMessage); - } - } - outputStream.write(JSONObject.toJSONString(result).getBytes(StandardCharsets.UTF_8)); - outputStream.flush(); - outputStream.close(); - } -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/handler/LoginSuccessHandler.java b/Cpop-Core/src/main/java/com/cpop/core/handler/LoginSuccessHandler.java deleted file mode 100644 index c31860b..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/handler/LoginSuccessHandler.java +++ /dev/null @@ -1,90 +0,0 @@ -package com.cpop.core.handler; - -import com.alibaba.fastjson.JSONObject; -import com.cpop.common.constant.Constants; -import com.cpop.common.utils.ip.IpUtils; -import com.cpop.core.base.R; -import com.cpop.core.base.entity.LoginSuccess; -import com.cpop.core.base.entity.LoginUser; -import com.cpop.core.base.entity.loginInfo.MiniUserLoginInfo; -import com.cpop.core.base.enums.OperationLogEnum; -import com.cpop.core.base.enums.UserType; -import com.cpop.core.service.CoreService; -import com.cpop.core.service.RedisService; -import com.cpop.core.utils.JwtUtils; -import com.cpop.core.utils.MessageUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.core.Authentication; -import org.springframework.security.web.authentication.AuthenticationSuccessHandler; -import org.springframework.stereotype.Component; - -import javax.servlet.ServletOutputStream; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.nio.charset.StandardCharsets; - -/** - * @author: DB - * @date: 2022-09-25 16:19 - * @Description: 登录成功handler - */ -@Component -public class LoginSuccessHandler implements AuthenticationSuccessHandler { - - @Autowired - private JwtUtils jwtUtils; - - @Autowired - private CoreService coreService; - - @Autowired - private RedisService redisService; - - @Override - public void onAuthenticationSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) throws IOException{ - httpServletResponse.setContentType("application/json;charset=UTF-8"); - ServletOutputStream outputStream = httpServletResponse.getOutputStream(); - LoginSuccess loginSuccessVo = new LoginSuccess(); - LoginUser loginUser; - if (null != authentication.getCredentials()) { - loginUser = (LoginUser) authentication.getCredentials(); - } else { - loginUser = (LoginUser) authentication.getDetails(); - } - // 生成JWT,并放置到请求头中 - String jwt = jwtUtils.generateToken(loginUser.getIdentification(), loginUser.getUsername(), loginUser.getUserType()); - loginSuccessVo.setToken(jwt).setUserId(loginUser.getUserId()).setRole(loginUser.getPermissions()); - String ipAddr = IpUtils.getIpAddr(httpServletRequest); - loginUser.setIpAddr(ipAddr); - //多种登陆方式 - multipleLogin(loginUser); - R result = R.ok(loginSuccessVo, MessageUtils.message("i18n_login_success")); - outputStream.write(JSONObject.toJSONString(result).getBytes(StandardCharsets.UTF_8)); - outputStream.flush(); - outputStream.close(); - } - - /** - * @Description: 多种登陆方式 - * @param loginUser 登陆用户 - * @author DB - * @Date: 2023/8/24 0024 17:12 - */ - private void multipleLogin(LoginUser loginUser){ - switch (loginUser.getUserType()) { - case OAM_USER: - case MALL_USER: - //更新登录地址 - coreService.updateSysUserLoginIp(loginUser.getIpAddr(), loginUser.getUsername(), loginUser.getUserType()); - //添加登录成功日志 - coreService.insertOperationLog(Constants.SUCCESS, OperationLogEnum.SYSTEM_LOGIN, loginUser, MessageUtils.message("i18n_login_success")); - break; - case MINI_USER: - break; - default: - } - //将登录成功用户存入缓存 - redisService.setCacheObject(loginUser.getUserType().getKey() + loginUser.getIdentification(), loginUser); - } -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/handler/TencentCosHandler.java b/Cpop-Core/src/main/java/com/cpop/core/handler/TencentCosHandler.java deleted file mode 100644 index 84add4d..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/handler/TencentCosHandler.java +++ /dev/null @@ -1,159 +0,0 @@ -package com.cpop.core.handler; - -import com.cpop.core.base.exception.UtilException; -import com.cpop.core.config.TencentCosProperties; -import com.cpop.core.utils.file.FileTypeUtils; -import com.cpop.core.utils.uuid.IdUtils; -import com.qcloud.cos.COSClient; -import com.qcloud.cos.ClientConfig; -import com.qcloud.cos.auth.BasicCOSCredentials; -import com.qcloud.cos.auth.COSCredentials; -import com.qcloud.cos.exception.CosClientException; -import com.qcloud.cos.exception.CosServiceException; -import com.qcloud.cos.http.HttpProtocol; -import com.qcloud.cos.model.*; -import com.qcloud.cos.region.Region; -import com.qcloud.cos.transfer.Download; -import com.qcloud.cos.transfer.TransferManager; -import com.qcloud.cos.transfer.TransferManagerConfiguration; -import com.qcloud.cos.transfer.Upload; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.stereotype.Component; -import org.springframework.web.multipart.MultipartFile; - -import javax.annotation.PostConstruct; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -/** - * @author DB - * @createTime 2023/10/31 15:03 - * @description 腾讯云SDK相关工具类 - */ -@Component -@EnableConfigurationProperties(TencentCosProperties.class) -public class TencentCosHandler { - - /** - * 腾讯云配置 - */ - @Autowired - private TencentCosProperties properties; - - private TransferManager transferManager; - - /** - * @descriptions 初始化创建TransferManager 实例,这个实例用来后续调用高级接口 - * @author DB - * @date 2023/11/01 10:34 - * @return: void - */ - @PostConstruct - public void createTransferManager(){ - // 创建一个 COSClient 实例,这是访问 COS 服务的基础实例。 - // 详细代码参见本页: 简单操作 -> 创建 COSClient - COSClient cosClient = createCosClient(); - // 自定义线程池大小,建议在客户端与 COS 网络充足(例如使用腾讯云的 CVM,同地域上传 COS)的情况下,设置成16或32即可,可较充分的利用网络资源 - // 对于使用公网传输且网络带宽质量不高的情况,建议减小该值,避免因网速过慢,造成请求超时。 - ExecutorService threadPool = Executors.newFixedThreadPool(32); - // 传入一个 threadPool, 若不传入线程池,默认 TransferManager 中会生成一个单线程的线程池。 - transferManager = new TransferManager(cosClient, threadPool); - // 设置高级接口的配置项 - // 分块上传阈值和分块大小分别为 5MB 和 1MB - TransferManagerConfiguration transferManagerConfiguration = new TransferManagerConfiguration(); - transferManagerConfiguration.setMultipartUploadThreshold(5 * 1024 * 1024); - transferManagerConfiguration.setMinimumUploadPartSize(1 * 1024 * 1024); - transferManager.setConfiguration(transferManagerConfiguration); - } - - /** - * @descriptions 创建 COSClient 实例,这个实例用来后续调用请求 - * @author DB - * @date 2023/10/31 16:47 - * @return: com.qcloud.cos.COSClient - */ - private COSClient createCosClient() { - // 设置用户身份信息。 - // SECRETID 和 SECRETKEY 请登录访问管理控制台 https://console.cloud.tencent.com/cam/capi 进行查看和管理 - // 用户的 SecretId,建议使用子账号密钥,授权遵循最小权限指引,降低使用风险。子账号密钥获取可参见 https://cloud.tencent.com/document/product/598/37140 - String secretId = properties.getSecretId(); - // 用户的 SecretKey,建议使用子账号密钥,授权遵循最小权限指引,降低使用风险。子账号密钥获取可参见 https://cloud.tencent.com/document/product/598/37140 - String secretKey = properties.getSecretKey(); - COSCredentials cred = new BasicCOSCredentials(secretId, secretKey); - // ClientConfig 中包含了后续请求 COS 的客户端设置: - ClientConfig clientConfig = new ClientConfig(); - // 设置 bucket 的地域 - // COS_REGION 请参见 https://cloud.tencent.com/document/product/436/6224 - clientConfig.setRegion(new Region(properties.getRegion())); - // 设置请求协议, http 或者 https - // 5.6.53 及更低的版本,建议设置使用 https 协议 - // 5.6.54 及更高版本,默认使用了 https - clientConfig.setHttpProtocol(HttpProtocol.https); - // 以下的设置,是可选的: - // 设置 socket 读取超时,默认 30s - clientConfig.setSocketTimeout(30 * 1000); - // 设置建立连接超时,默认 30s - clientConfig.setConnectionTimeout(30 * 1000); - // 如果需要的话,设置 http 代理,ip 以及 port - //clientConfig.setHttpProxyIp("httpProxyIp"); - //clientConfig.setHttpProxyPort(80); - // 生成 cos 客户端。 - return new COSClient(cred, clientConfig); - } - - /** - * @descriptions 关闭 TransferManager - * @author DB - * @date 2023/10/31 17:09 - * @param transferManager 管理器 - * @return: void - */ - public void shutdownTransferManager(TransferManager transferManager) { - // 指定参数为 true, 则同时会关闭 transferManager 内部的 COSClient 实例。 - // 指定参数为 false, 则不会关闭 transferManager 内部的 COSClient 实例。 - transferManager.shutdownNow(true); - } - - /** - * @descriptions cdn上传 - * @author DB - * @date 2023/10/31 17:21 - * @param file 文件 - * @return: com.qcloud.cos.model.UploadResult - */ - public UploadResult cdnUpload(MultipartFile file) { - String fileType = FileTypeUtils.getInstance().getFileType(file.getOriginalFilename()); - try { - ObjectMetadata objectMetadata = new ObjectMetadata(); - // 上传的流如果能够获取准确的流长度,则推荐一定填写 content-length - // 如果确实没办法获取到,则下面这行可以省略,但同时高级接口也没办法使用分块上传了 - objectMetadata.setContentLength(file.getSize()); - objectMetadata.setContentType(file.getContentType()); - InputStream inputStream = file.getInputStream(); - PutObjectRequest putObjectRequest = new PutObjectRequest(properties.getBucketName(), IdUtils.fastSimpleUUID() + "." + fileType, inputStream, objectMetadata); - // 设置存储类型(如有需要,不需要请忽略此行代码), 默认是标准(Standard), 低频(standard_ia) - // 更多存储类型请参见 https://cloud.tencent.com/document/product/436/33417 - putObjectRequest.setStorageClass(StorageClass.Standard); - Upload upload = transferManager.upload(putObjectRequest); - UploadResult uploadResult = upload.waitForUploadResult(); - inputStream.close(); - return uploadResult; - } catch (IOException | InterruptedException e) { - throw new UtilException(e); - } - } - - /** - * @descriptions 获取cdn路径 - * @author DB - * @date 2023/10/31 17:56 - * @return: java.lang.String - */ - public String getCdnUrl(){ - return properties.getCdnUrl(); - } -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/listen/JamboxSaTokenListener.java b/Cpop-Core/src/main/java/com/cpop/core/listen/JamboxSaTokenListener.java new file mode 100644 index 0000000..46c9288 --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/listen/JamboxSaTokenListener.java @@ -0,0 +1,111 @@ +package com.cpop.core.listen; + +import cn.dev33.satoken.listener.SaTokenListener; +import cn.dev33.satoken.session.SaSession; +import cn.dev33.satoken.stp.SaLoginModel; +import cn.dev33.satoken.stp.StpUtil; +import com.cpop.core.base.enums.OperationLogEnum; +import com.cpop.core.constant.Constants; +import com.cpop.core.service.OperationLogService; +import com.cpop.core.service.UserService; +import com.cpop.core.utils.MessageUtils; +import com.cpop.core.utils.SpringUtils; +import org.springframework.stereotype.Component; + +import static com.cpop.core.base.table.table.UserTableDef.USER; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-03-20 14:27 + */ +@Component +public class JamboxSaTokenListener implements SaTokenListener { + + /** + * 每次登录时触发 + * @author DB + * @since 2024/3/20 + * @param loginType 登录类型 + * @param loginId 登录id + * @param tokenValue token + * @param loginModel 登录模块 + */ + @Override + public void doLogin(String loginType, Object loginId, String tokenValue, SaLoginModel loginModel) { + //添加登录成功日志 + SaSession session = StpUtil.getSessionByLoginId(loginId); + SpringUtils.getBean(OperationLogService.class).insertOperationLog(Constants.SUCCESS, OperationLogEnum.SYSTEM_LOGIN, session, MessageUtils.message("i18n_login_success")); + //更新登录记录 + SpringUtils.getBean(UserService.class).updateChain() + .set(USER.LOGIN_IP, session.getString("loginIp")) + .where(USER.USER_NAME.eq(session.getString("username"))) + .update(); + } + + /** + * 每次注销时触发 + * @author DB + * @since 2024/3/20 + * @param loginType 登录类型 + * @param loginId 登录id + * @param tokenValue token + */ + @Override + public void doLogout(String loginType, Object loginId, String tokenValue) { + } + + /** 每次被踢下线时触发 */ + @Override + public void doKickout(String loginType, Object loginId, String tokenValue) { + System.out.println("---------- 自定义侦听器实现 doKickout"); + } + + /** 每次被顶下线时触发 */ + @Override + public void doReplaced(String loginType, Object loginId, String tokenValue) { + System.out.println("---------- 自定义侦听器实现 doReplaced"); + } + + /** 每次被封禁时触发 */ + @Override + public void doDisable(String loginType, Object loginId, String service, int level, long disableTime) { + System.out.println("---------- 自定义侦听器实现 doDisable"); + } + + /** 每次被解封时触发 */ + @Override + public void doUntieDisable(String loginType, Object loginId, String service) { + System.out.println("---------- 自定义侦听器实现 doUntieDisable"); + } + + /** 每次二级认证时触发 */ + @Override + public void doOpenSafe(String loginType, String tokenValue, String service, long safeTime) { + System.out.println("---------- 自定义侦听器实现 doOpenSafe"); + } + + /** 每次退出二级认证时触发 */ + @Override + public void doCloseSafe(String loginType, String tokenValue, String service) { + System.out.println("---------- 自定义侦听器实现 doCloseSafe"); + } + + /** 每次创建Session时触发 */ + @Override + public void doCreateSession(String id) { + System.out.println("---------- 自定义侦听器实现 doCreateSession"); + } + + /** 每次注销Session时触发 */ + @Override + public void doLogoutSession(String id) { + System.out.println("---------- 自定义侦听器实现 doLogoutSession"); + } + + /** 每次Token续期时触发 */ + @Override + public void doRenewTimeout(String tokenValue, Object loginId, long timeout) { + System.out.println("---------- 自定义侦听器实现 doRenewTimeout"); + } +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/listen/SysOperationLogListen.java b/Cpop-Core/src/main/java/com/cpop/core/listen/OperationLogListen.java similarity index 55% rename from Cpop-Core/src/main/java/com/cpop/core/listen/SysOperationLogListen.java rename to Cpop-Core/src/main/java/com/cpop/core/listen/OperationLogListen.java index e73db55..41f96b8 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/listen/SysOperationLogListen.java +++ b/Cpop-Core/src/main/java/com/cpop/core/listen/OperationLogListen.java @@ -1,11 +1,10 @@ package com.cpop.core.listen; -import com.cpop.core.base.table.SysOperationLog; +import com.cpop.core.base.table.OperationLog; import com.cpop.core.event.OperationLogEvent; -import com.cpop.core.utils.uuid.IdUtils; -import com.cpop.core.service.CoreService; +import com.cpop.core.service.OperationLogService; +import com.cpop.core.utils.SpringUtils; import lombok.extern.slf4j.Slf4j; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.event.EventListener; import org.springframework.core.annotation.Order; import org.springframework.scheduling.annotation.Async; @@ -18,19 +17,15 @@ import org.springframework.stereotype.Component; */ @Slf4j @Component -public class SysOperationLogListen { - - @Autowired - private CoreService coreService; +public class OperationLogListen { @Async @Order @EventListener(OperationLogEvent.class) public void saveSysOperationLog(OperationLogEvent event) { - SysOperationLog operationLog = (SysOperationLog) event.getSource(); + OperationLog operationLog = (OperationLog) event.getSource(); // 保存日志 - operationLog.setId(IdUtils.fastSimpleUUID()); - if (coreService.saveOperationLog(operationLog)) { + if (SpringUtils.getBean(OperationLogService.class).save(operationLog)) { } } } diff --git a/Cpop-Core/src/main/java/com/cpop/core/mapper/ConfigMapper.java b/Cpop-Core/src/main/java/com/cpop/core/mapper/ConfigMapper.java new file mode 100644 index 0000000..d6a5d1a --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/mapper/ConfigMapper.java @@ -0,0 +1,14 @@ +package com.cpop.core.mapper; + +import com.cpop.core.base.table.Config; +import com.mybatisflex.core.BaseMapper; + +/** + * 系统配置表 映射层。 + * + * @author DB + * @since 2024-02-01 + */ +public interface ConfigMapper extends BaseMapper { + +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/mapper/CoreMapper.java b/Cpop-Core/src/main/java/com/cpop/core/mapper/CoreMapper.java deleted file mode 100644 index 47f693b..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/mapper/CoreMapper.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.cpop.core.mapper; - -import com.cpop.core.base.enums.UserType; -import com.cpop.core.base.table.SysConfig; -import com.cpop.core.base.table.SysOperationLog; -import com.cpop.core.base.table.SysUser; -import org.apache.ibatis.annotations.Param; - -import java.util.List; - -/** - * @author DB - * @Description: - * @create 2023-08-27 10:54 - */ -public interface CoreMapper { - - /** - * @Description: 插入操作日志 - * @param log - * @return Integer - * @Author DB - * @Date: 2023/8/27 10:56 - */ - Boolean insertOperationLog(SysOperationLog log); - - /** - * @Description: 根据用户名获取用户信息 - * @param username 用户名 - * @param userType 用户类型 - * @return SysUser - * @Author DB - * @Date: 2023/8/27 23:39 - */ - SysUser getSysUserByUsername(@Param("username") String username, @Param("userType") String userType); - - /** - * @Description: 更新登录地址 - * @param ipAddr - * @param username - * @return - * @author DB - * @Date: 2023/8/28 0028 13:49 - */ - void updateSysUserLoginIp(String ipAddr, String username, String userType); - - /** - * @Description: 加载参数缓存数据 - * @param - * @return List - * @Author DB - * @Date: 2023/8/28 22:33 - */ - List loadingConfigCache(); - - /** - * @Description: 根据键名查询参数配置信息 - * @param configKey - * @return SysConfig - * @Author DB - * @Date: 2023/8/28 22:49 - */ - SysConfig selectConfigByKey(String configKey); - - /** - * @Description: 新增参数配置 - * @param config - * @return boolean - * @Author DB - * @Date: 2023/8/28 23:03 - */ - boolean insertConfig(SysConfig config); - - /** - * @Description: 修改参数配置 - * @param config - * @return boolean - * @Author DB - * @Date: 2023/8/28 23:17 - */ - boolean updateConfig(SysConfig config); - - /** - * @Description: 根据键查询配置 - * @param list - * @return List - * @Author DB - * @Date: 2023/8/28 23:25 - */ - List selectConfigByKeys(List list); - - /** - * @Description: 需要删除的参数ID - * @param list - * @return - * @Author DB - * @Date: 2023/8/28 23:29 - */ - void deleteConfigByKeys(List list); - - /** - * @descriptions 新增系统用户 - * @author DB - * @date 2023/09/08 15:04 - * @param sysUser 系统用户参数 - */ - void insertSysUser(SysUser sysUser); - - /** - * @descriptions 修改系统用户 - * @author DB - * @date 2023/09/08 17:21 - * @param sysUser 系统用户参数d - */ - void updateSysUser(SysUser sysUser); - - /** - * @descriptions 根据主键删除用户(逻辑删除) - * @author DB - * @date 2023/09/08 17:50 - * @param id 主键 - */ - void removeSysUserById(String id); - - /** - * @Description: 根据用户名获取用户信息 - * @param phoneNumber 手机号 - * @return SysUser - * @Author: DB - * @Date: 2023/8/27 23:37 - */ - SysUser getSysUserByPhone(@Param("phoneNumber") String phoneNumber, @Param("userType") String userType); -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/mapper/OperationLogMapper.java b/Cpop-Core/src/main/java/com/cpop/core/mapper/OperationLogMapper.java new file mode 100644 index 0000000..ea43ee3 --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/mapper/OperationLogMapper.java @@ -0,0 +1,14 @@ +package com.cpop.core.mapper; + +import com.cpop.core.base.table.OperationLog; +import com.mybatisflex.core.BaseMapper; + +/** + * 操作日志表 映射层。 + * + * @author DB + * @since 2024-02-01 + */ +public interface OperationLogMapper extends BaseMapper { + +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/mapper/UserMapper.java b/Cpop-Core/src/main/java/com/cpop/core/mapper/UserMapper.java new file mode 100644 index 0000000..6183ffc --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/mapper/UserMapper.java @@ -0,0 +1,14 @@ +package com.cpop.core.mapper; + +import com.cpop.core.base.table.User; +import com.mybatisflex.core.BaseMapper; + +/** + * 系统用户 映射层。 + * + * @author DB + * @since 2024-02-01 + */ +public interface UserMapper extends BaseMapper { + +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/service/ConfigService.java b/Cpop-Core/src/main/java/com/cpop/core/service/ConfigService.java new file mode 100644 index 0000000..f4bcc9d --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/service/ConfigService.java @@ -0,0 +1,18 @@ +package com.cpop.core.service; + +import com.cpop.core.base.table.Config; +import com.mybatisflex.core.service.IService; + +/** + * 系统配置表 服务层。 + * + * @author DB + * @since 2024-02-01 + */ +public interface ConfigService extends IService { + + /** + * 加载参数缓存数据 + */ + void loadingConfigCache(); +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/service/CoreService.java b/Cpop-Core/src/main/java/com/cpop/core/service/CoreService.java deleted file mode 100644 index 78e421c..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/service/CoreService.java +++ /dev/null @@ -1,164 +0,0 @@ -package com.cpop.core.service; - -import com.cpop.core.base.entity.LoginUser; -import com.cpop.core.base.enums.OperationLogEnum; -import com.cpop.core.base.enums.UserType; -import com.cpop.core.base.table.SysConfig; -import com.cpop.core.base.table.SysOperationLog; -import com.cpop.core.base.table.SysUser; -import org.springframework.security.core.userdetails.UserDetails; - -import java.util.Map; - -/** - * @author DB - * @Description: - * @create: 2023-08-27 11:04 - */ -public interface CoreService { - - /** - * @Description: 添加操作日志 - * @param status 状态 - * @param loginUser 登陆用户 - * @param failReason 失败原因 - * @return String - * @Author: DB - * @Date: 2023/8/27 11:08 - */ - String insertOperationLog(Integer status, OperationLogEnum operationLogEnum, LoginUser loginUser, String failReason); - - /** - * @Description: 添加操作日志 - * @param operationLog 日志 - * @return boolean - * @Author: DB - * @Date: 2023/8/29 23:46 - */ - boolean saveOperationLog(SysOperationLog operationLog); - - /** - * @Description: 根据用户名获取用户信息 - * @param username 用户名 - * @return SysUser - * @Author: DB - * @Date: 2023/8/27 23:37 - */ - SysUser getSysUserByUsername(String username, UserType userType); - - /** - * @Description: 更新登录地址 - * @param ipAddr ip地址 - * @param username 用户名 - * @author DB - * @Date: 2023/8/28 0028 13:48 - */ - void updateSysUserLoginIp(String ipAddr, String username, UserType userType); - - /** - * 根据键名查询参数配置信息 - * - * @param configKey 参数键名 - * @return 参数键值 - */ - SysConfig selectConfigByKey(String configKey); - - /** - * @Description: 新增参数配置 - * @param config - * @author DB - * @Date: 2023/6/7 0007 16:17 - */ - void insertConfig(SysConfig config); - - /** - * @Description: 修改参数配置 - * @param config - * @author DB - * @Date: 2023/6/7 0007 16:19 - */ - void updateConfig(SysConfig config); - - /** - * @Description: 批量删除参数信息 - * @param keys - * @author DB - * @Date: 2023/6/8 0008 9:58 - */ - void deleteConfigByKeys(String[] keys); - - /** - * @descriptions 新增系统用户 - * @author DB - * @date 2023/09/08 15:04 - * @param sysUser 系统用户参数 - */ - void insertSysUser(SysUser sysUser); - - /** - * @descriptions 修改系统用户 - * @author DB - * @date 2023/09/08 17:20 - * @param sysUser 系统用户参数 - */ - void updateSysUser(SysUser sysUser); - - /** - * @descriptions 根据主键删除用户 - * @author DB - * @date 2023/09/08 17:49 - * @param id 主键 - * @return void - */ - void removeSysUserById(String id); - - /** - * @descriptions 根据用户名与用户类型获取用户信息 - * @author DB - * @date 2023/10/19 9:57 - * @param userName 用户名 - * @param userType 用户类型 - * @return 登陆用户 - */ - LoginUser loadUserByUsername(String userName, UserType userType); - - /** - * @descriptions 根据手机号与用户类型获取用户信息 - * @author DB - * @date 2023/10/19 9:57 - * @param phoneNumber 手机号 - * @param userType 用户类型 - * @return 登陆用户 - */ - LoginUser loadUserByPhone(String phoneNumber, UserType userType); - - /** - * @descriptions 根据手机号与用户类型获取用户信息 - * @author DB - * @date 2023/10/19 9:57 - * @param phoneNumber 手机号 - * @param userType 用户类型 - * @return 登陆用户 - */ - LoginUser loadUserByPhone(String phoneNumber, UserType userType, Map credentials); - - /** - * @Description: 根据用户名获取用户信息 - * @param phoneNumber 手机号 - * @return SysUser - * @Author: DB - * @Date: 2023/8/27 23:37 - */ - SysUser getSysUserByPhone(String phoneNumber, UserType userType); - - /** - * @descriptions 检查用户是否存在 - * @author DB - * @date 2023/11/10 11:57 - * @param username 用户名 - * @param id 主键 - * @param userType 用户类型 - * @return: void - */ - void isAccountExist(String username, String id, String userType); -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/service/OperationLogService.java b/Cpop-Core/src/main/java/com/cpop/core/service/OperationLogService.java new file mode 100644 index 0000000..f708558 --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/service/OperationLogService.java @@ -0,0 +1,27 @@ +package com.cpop.core.service; + +import cn.dev33.satoken.session.SaSession; +import com.cpop.core.base.enums.OperationLogEnum; +import com.cpop.core.base.table.OperationLog; +import com.mybatisflex.core.service.IService; + +/** + * 操作日志表 服务层。 + * + * @author DB + * @since 2024-02-01 + */ +public interface OperationLogService extends IService { + + /** + * 插入操作日志。 + * @author DB + * @since 2024/2/2 + * @param status 状态 + * @param operationLogEnum 日志枚举 + * @param session 登陆用户session + * @param failReason 失败原因 + * @return String 主键 + */ + String insertOperationLog(Integer status, OperationLogEnum operationLogEnum, SaSession session, String failReason); +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/service/UserService.java b/Cpop-Core/src/main/java/com/cpop/core/service/UserService.java new file mode 100644 index 0000000..d310811 --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/service/UserService.java @@ -0,0 +1,14 @@ +package com.cpop.core.service; + +import com.cpop.core.base.table.User; +import com.mybatisflex.core.service.IService; + +/** + * 系统用户 服务层。 + * + * @author DB + * @since 2024-02-01 + */ +public interface UserService extends IService { + +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/service/impl/AuthorityPermissionService.java b/Cpop-Core/src/main/java/com/cpop/core/service/impl/AuthorityPermissionService.java deleted file mode 100644 index 6e69716..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/service/impl/AuthorityPermissionService.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.cpop.core.service.impl; - -import com.cpop.common.constant.Constants; -import com.cpop.common.utils.StringUtils; -import com.cpop.core.base.entity.LoginUser; -import com.cpop.core.utils.SecurityUtils; -import org.springframework.stereotype.Service; -import org.springframework.util.CollectionUtils; - -import java.util.Set; - -/** - * @author: DB - * @date: 2022-10-20 15:15 - * @Description: - * AuthorityPermissionService:自定义access表达式,鉴权验证。 - * 可以将自定义的access添加到配置类中:http.anyRequest.access(aps.hasPermission(xxx,xxx)); - * 也可以直接使用注解@PreAuthorize:@PreAuthorize(aps.hasPermission(xxx)); - */ -@Service("aps") -public class AuthorityPermissionService { - - public boolean hasPermission(String permissions) { - if (StringUtils.isEmpty(permissions)) { - return false; - } - // 用户信息对象 - LoginUser loginUser = SecurityUtils.getInstance().getLoginUser(); - if (loginUser == null || CollectionUtils.isEmpty(loginUser.getPermissions())) { - return false; - } - Set authorities = loginUser.getPermissions(); - return StringUtils.isNotEmpty(permissions) && hasPermissions(authorities, permissions); - } - - private boolean hasPermissions(Set authorities, String permission) { - return authorities.contains(Constants.ALL_PERMISSION) || authorities.contains(permission.trim()); - } -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/service/impl/ConfigServiceImpl.java b/Cpop-Core/src/main/java/com/cpop/core/service/impl/ConfigServiceImpl.java new file mode 100644 index 0000000..09af270 --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/service/impl/ConfigServiceImpl.java @@ -0,0 +1,49 @@ +package com.cpop.core.service.impl; + +import com.cpop.core.base.table.Config; +import com.cpop.core.constant.Constants; +import com.cpop.core.mapper.ConfigMapper; +import com.cpop.core.service.ConfigService; +import com.cpop.core.service.RedisService; +import com.mybatisflex.spring.service.impl.ServiceImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; + +/** + * 系统配置表 服务层实现。 + * + * @author DB + * @since 2024-02-01 + */ +@Service("configService") +public class ConfigServiceImpl extends ServiceImpl implements ConfigService { + + @Autowired + private RedisService redisService; + + /** + * 加载参数缓存数据 + */ + @Override + public void loadingConfigCache() { + //获取所有配置(可自定义) + List configsList = this.list(); + if (!configsList.isEmpty()) { + for (Config config : configsList) { + redisService.setCacheObject(getCacheKey(config.getConfigKey()), config.getConfigValue()); + } + } + } + + /** + * 设置cache key + * + * @param configKey 参数键 + * @return 缓存键key + */ + private String getCacheKey(String configKey) { + return Constants.CONFIG_KEY + configKey; + } +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/service/impl/CoreServiceImpl.java b/Cpop-Core/src/main/java/com/cpop/core/service/impl/CoreServiceImpl.java deleted file mode 100644 index 06a4ebc..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/service/impl/CoreServiceImpl.java +++ /dev/null @@ -1,302 +0,0 @@ -package com.cpop.core.service.impl; - -import com.cpop.common.utils.StringUtils; -import com.cpop.core.base.entity.LoginUser; -import com.cpop.core.base.enums.OperationLogEnum; -import com.cpop.core.base.enums.UserType; -import com.cpop.core.base.exception.ServiceException; -import com.cpop.core.base.table.SysConfig; -import com.cpop.core.base.table.SysOperationLog; -import com.cpop.core.base.table.SysUser; -import com.cpop.core.mapper.CoreMapper; -import com.cpop.core.service.CoreService; -import com.cpop.core.utils.MessageUtils; -import com.cpop.core.utils.SecurityUtils; -import com.cpop.core.utils.uuid.IdUtils; -import com.mybatisflex.core.query.QueryWrapper; -import com.mybatisflex.core.row.Db; -import com.mybatisflex.core.row.DbChain; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.core.userdetails.UsernameNotFoundException; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; - -import static com.cpop.core.base.table.table.SysUserTableDef.SYS_USER; - -/** - * @author DB - * @Description: - * @create: 2023-08-27 11:04 - */ -@Service("coreService") -public class CoreServiceImpl implements CoreService { - - @Autowired - private CoreMapper coreMapper; - - /** - * @Description: 添加操作日志 - * @param status 状态 - * @param operationLogEnum 日志枚举 - * @param loginUser 登陆用户 - * @param failReason 失败原因 - * @return String - * @Author: DB - * @Date: 2023/8/27 11:08 - */ - @Override - public String insertOperationLog(Integer status, OperationLogEnum operationLogEnum, LoginUser loginUser, String failReason) { - SysOperationLog operationLog = new SysOperationLog(); - operationLog.setId(IdUtils.fastSimpleUUID()) - .setCode(operationLogEnum.getCode()) - .setInfo(MessageUtils.message(operationLogEnum.getInfo())) - .setDevIp(loginUser.getIpAddr()) - .setOperationUserType(loginUser.getUserType()) - .setOperationUserName(loginUser.getUsername()); - if (200 == status) { - operationLog.setOperationUserId(loginUser.getUserId()) - .setLevel(operationLogEnum.getSuccessLevel()) - .setDescription(MessageUtils.message(operationLogEnum.getInfo()) + MessageUtils.message("i18n_baseInfo_success")) - .setResult(true) - .setActionType(1); - } else { - operationLog.setLevel(operationLogEnum.getExceptionLevel()) - .setDescription(MessageUtils.message(operationLogEnum.getInfo()) + MessageUtils.message("i18n_baseInfo_failed")) - .setFailReason(failReason) - .setResult(false) - .setActionType(2); - } - operationLog.setCreateUserId(loginUser.getUserId()); - operationLog.setUpdateUserId(loginUser.getUserId()); - if (coreMapper.insertOperationLog(operationLog)) { - } - return operationLog.getId(); - } - - /** - * @Description: 添加操作日志 - * @param operationLog 操作日志 - * @return boolean - * @Author DB - * @Date: 2023/8/29 23:46 - */ - @Override - public boolean saveOperationLog(SysOperationLog operationLog) { - return coreMapper.insertOperationLog(operationLog); - } - - /** - * @Description: 根据用户名获取用户信息 - * @param username 用户名 - * @return SysUser - * @Author DB - * @Date: 2023/8/27 23:37 - */ - @Override - public SysUser getSysUserByUsername(String username, UserType userType) { - return coreMapper.getSysUserByUsername(username, userType.toString()); - } - - /** - * @Description: 更新登录地址 - * @param ipAddr 地址 - * @param username 用户名 - * @author DB - * @Date: 2023/8/28 0028 13:48 - */ - @Override - public void updateSysUserLoginIp(String ipAddr, String username, UserType userType) { - coreMapper.updateSysUserLoginIp(ipAddr, username, userType.toString()); - } - - /** - * @Description: 根据键名查询参数配置信息 - * @param configKey 键 - * @return String - * @author DB - * @Date: 2023/6/7 0007 15:59 - */ - @Override - public SysConfig selectConfigByKey(String configKey) { - return coreMapper.selectConfigByKey(configKey); - } - - /** - * 新增参数配置 - * - * @param config 参数配置信息 - */ - @Override - public void insertConfig(SysConfig config) { - LoginUser loginUser = SecurityUtils.getInstance().getLoginUser(); - config.setCreateUserId(null == loginUser ? "1" : loginUser.getUserId()); - config.setUpdateUserId(null == loginUser ? "1" : loginUser.getUserId()); - coreMapper.insertConfig(config); - } - - /** - * 修改参数配置 - * - * @param config 参数配置信息 - */ - @Override - public void updateConfig(SysConfig config) { - LoginUser loginUser = SecurityUtils.getInstance().getLoginUser(); - config.setUpdateUserId(null == loginUser ? "1" : loginUser.getUserId()); - coreMapper.updateConfig(config); - } - - /** - * 批量删除参数信息 - * - * @param keys 需要删除的参数ID - */ - @Override - @Transactional(rollbackFor = Exception.class) - public void deleteConfigByKeys(String[] keys) { - List keyList = Arrays.asList(keys); - List sysConfigList = coreMapper.selectConfigByKeys(keyList); - sysConfigList.forEach(item -> { - if (item.getConfigType()) { - throw new ServiceException(String.format("内置参数【%1$s】不能删除 ", item.getConfigKey())); - } - }); - coreMapper.deleteConfigByKeys(keyList); - } - - /** - * @descriptions 新增系统用户 - * @author DB - * @date 2023/09/08 15:04 - * @param sysUser 系统用户参数 - */ - @Override - public void insertSysUser(SysUser sysUser) { - coreMapper.insertSysUser(sysUser); - } - - /** - * @descriptions 修改系统用户 - * @author DB - * @date 2023/09/08 17:20 - * @param sysUser 系统用户参数 - */ - @Override - public void updateSysUser(SysUser sysUser) { - coreMapper.updateSysUser(sysUser); - } - - /** - * @descriptions 根据主键删除用户 - * @author DB - * @date 2023/09/08 17:50 - * @param id 主键 - */ - @Override - public void removeSysUserById(String id) { - coreMapper.removeSysUserById(id); - } - - /** - * @descriptions 根据用户名与用户类型获取用户信息 - * @author DB - * @date 2023/10/19 9:57 - * @param username 用户名 - * @param userType 用户类型 - * @return 登陆用户 - */ - @Override - public LoginUser loadUserByUsername(String username, UserType userType) { - //统一获取系统用户信息 - SysUser sysUser = this.getSysUserByUsername(username, userType); - if (sysUser == null) { - throw new UsernameNotFoundException(MessageUtils.message("i18n_alert_accountOrPwdError")); - } - return userType.getStrategy().getLoginUserInfo(sysUser, null); - } - - /** - * @descriptions 可能存在用户手机号登陆的情况 - * @author DB - * @date 2023/11/21 10:05 - * @param phoneNumber 手机号 - * @param userType 用户类型 - * @return: com.cpop.core.base.entity.LoginUser - */ - @Override - public LoginUser loadUserByPhone(String phoneNumber, UserType userType) { - //统一获取系统用户信息 - SysUser sysUser = this.getSysUserByPhone(phoneNumber, userType); - return userType.getStrategy().getLoginUserInfo(sysUser, null); - } - - /** - * @descriptions 根据手机号与用户类型获取用户信息 - * @author DB - * @date 2023/10/19 9:57 - * @param phoneNumber 手机号 - * @param userType 用户类型 - * @return 登陆用户 - */ - @Override - @Transactional(rollbackFor = Exception.class) - public LoginUser loadUserByPhone(String phoneNumber, UserType userType, Map credentials) { - //统一获取系统用户信息 - SysUser sysUser = this.getSysUserByPhone(phoneNumber, userType); - if (sysUser == null) { - //如果是小程序自动注册用户信息 - if (userType == UserType.MINI_USER) { - sysUser = new SysUser(); - sysUser.setId(IdUtils.fastSimpleUUID()) - .setUserName(phoneNumber) - .setPhoneNumber(phoneNumber) - .setStatus(true) - .setUserType(userType.toString()) - .setCreateUserId("1"); - sysUser.setUpdateUserId("1"); - this.coreMapper.insertSysUser(sysUser); - } else { - throw new UsernameNotFoundException("获取用户信息失败"); - } - } - //构建登陆用户信息 - return userType.getStrategy().getLoginUserInfo(sysUser, credentials); - } - - /** - * @Description: 根据用户名获取用户信息 - * @param phoneNumber 手机号 - * @return SysUser - * @Author: DB - * @Date: 2023/8/27 23:37 - */ - @Override - public SysUser getSysUserByPhone(String phoneNumber, UserType userType) { - return coreMapper.getSysUserByPhone(phoneNumber, userType.toString()); - } - - /** - * @descriptions 检查用户是否存在 - * @author DB - * @date 2023/11/10 11:57 - * @param username 用户名 - * @param id 主键 - * @param userType 用户类型 - * @return: void - */ - @Override - public void isAccountExist(String username, String id, String userType) { - if (StringUtils.isBlank(username)) { - return; - } - if (DbChain.table(SYS_USER).where(SYS_USER.USER_NAME.eq(username)) - .and(SYS_USER.USER_TYPE.eq(userType)) - .and(SYS_USER.ID.ne(id)).count() > 0) { - throw new ServiceException(MessageUtils.message("i18n_alert_userIsExist")); - } - } -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/service/impl/OamStaffDetailsServiceImpl.java b/Cpop-Core/src/main/java/com/cpop/core/service/impl/OamStaffDetailsServiceImpl.java deleted file mode 100644 index 336a71b..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/service/impl/OamStaffDetailsServiceImpl.java +++ /dev/null @@ -1,96 +0,0 @@ -package com.cpop.core.service.impl; - -import com.cpop.common.constant.Constants; -import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.base.entity.LoginUser; -import com.cpop.core.base.entity.Permission; -import com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo; -import com.cpop.core.base.enums.UserType; -import com.cpop.core.base.table.SysUser; -import com.cpop.core.service.CoreService; -import com.cpop.core.utils.MessageUtils; -import com.mybatisflex.core.row.DbChain; -import com.mybatisflex.core.row.Row; -import com.mybatisflex.core.row.RowUtil; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.core.userdetails.UserDetails; -import org.springframework.security.core.userdetails.UserDetailsService; -import org.springframework.security.core.userdetails.UsernameNotFoundException; -import org.springframework.stereotype.Service; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.stream.Collectors; - -/** - * @author DB - * @createTime 2023/09/11 10:56 - * @description oam员工登陆信息 - */ -@Service("oamStaffDetailsService") -public class OamStaffDetailsServiceImpl implements UserDetailsService { - - @Autowired - private CoreService coreService; - - /** - * @descriptions 加载员工信息 - * @author DB - * @date 2023/09/11 10:57 - * @param username 用户名 - * @return org.springframework.security.core.user.details.UserDetails - */ - @Override - public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { - //统一获取系统用户信息 - SysUser sysUser = coreService.getSysUserByUsername(username, UserType.OAM_USER); - if (sysUser == null) { - throw new UsernameNotFoundException(MessageUtils.message("i18n_alert_accountOrPwdError")); - } - //构建登陆员工信息 - OamStaffLoginInfo staffLoginInfo = BeanUtils.mapToClass(sysUser, OamStaffLoginInfo.class); - staffLoginInfo.setUserId(sysUser.getId()); - //员工 - if (!staffLoginInfo.getUserName().equals(Constants.SUPER_ADMIN)) { - Row row = DbChain.table("cp_oam_staff") - .select() - .where("user_id = ?", staffLoginInfo.getUserId()) - .one(); - staffLoginInfo.setDeptId(row.getString("deptId")); - staffLoginInfo.setRoleId(row.getString("roleId")); - staffLoginInfo.setName(row.getString("name")); - staffLoginInfo.setStaffType(row.getInt("staffType")); - staffLoginInfo.setId(row.getString("id")); - } - //获取权限 - Set permissionSet = new HashSet<>(); - if (Constants.SUPER_ADMIN.equals(username)) { - permissionSet.add(Constants.ALL_PERMISSION); - staffLoginInfo.setName(Constants.SUPER_ADMIN); - } - else { - //查询员工信息 - List list = DbChain.table("oam_menu") - .select("pom.permission") - .from("cp_oam_menu").as("pom") - .leftJoin("cp_oam_role_menu").as("porm").on("porm.menu_id = pom.id") - .where("pom.type in (1,2)") - .and("porm.role_id = ?", staffLoginInfo.getRoleId()) - .and("pom.permission is not null") - .list(); - if (list.isEmpty()) { - permissionSet = new HashSet<>(); - } else { - List permissions = RowUtil.toEntityList(list, Permission.class); - permissionSet = permissions.stream().map(Permission::getPermission).collect(Collectors.toSet()); - } - } - LoginUser loginUser = new LoginUser(sysUser.getId(), staffLoginInfo, permissionSet); - loginUser.setUserName(username) - .setLoginTime(System.currentTimeMillis()) - .setStatus(sysUser.getStatus()); - return loginUser; - } - -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/service/impl/OperationLogServiceImpl.java b/Cpop-Core/src/main/java/com/cpop/core/service/impl/OperationLogServiceImpl.java new file mode 100644 index 0000000..4b126fb --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/service/impl/OperationLogServiceImpl.java @@ -0,0 +1,57 @@ +package com.cpop.core.service.impl; + +import cn.dev33.satoken.session.SaSession; +import com.cpop.core.base.enums.OperationLogEnum; +import com.cpop.core.base.enums.UserType; +import com.cpop.core.base.table.OperationLog; +import com.cpop.core.mapper.OperationLogMapper; +import com.cpop.core.service.OperationLogService; +import com.cpop.core.utils.MessageUtils; +import com.mybatisflex.spring.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + * 操作日志表 服务层实现。 + * + * @author DB + * @since 2024-02-01 + */ +@Service("operationLogService") +public class OperationLogServiceImpl extends ServiceImpl implements OperationLogService { + + /** + * 插入操作日志。 + * @author DB + * @since 2024/2/2 + * @param status 状态 + * @param operationLogEnum 日志枚举 + * @param loginUser 登陆用户 + * @param failReason 失败原因 + * @return String 主键 + */ + @Override + public String insertOperationLog(Integer status, OperationLogEnum operationLogEnum, SaSession session, String failReason) { + OperationLog operationLog = new OperationLog(); + operationLog.setCode(operationLogEnum.getCode()) + .setInfo(MessageUtils.message(operationLogEnum.getInfo())) + .setDevIp(session.getString("loginIp")) + .setOperationUserType((UserType) session.get("userType")) + .setOperationUserName(session.getString("username")); + if (200 == status) { + operationLog.setOperationUserId(session.getString("userId")) + .setLevel(operationLogEnum.getSuccessLevel()) + .setDescription(MessageUtils.message(operationLogEnum.getInfo()) + MessageUtils.message("i18n_baseInfo_success")) + .setResult(true) + .setActionType(1); + } else { + operationLog.setLevel(operationLogEnum.getExceptionLevel()) + .setDescription(MessageUtils.message(operationLogEnum.getInfo()) + MessageUtils.message("i18n_baseInfo_failed")) + .setFailReason(failReason) + .setResult(false) + .setActionType(2); + } + if (this.save(operationLog)) { + } + return operationLog.getId(); + } +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/service/impl/RedisServiceImpl.java b/Cpop-Core/src/main/java/com/cpop/core/service/impl/RedisServiceImpl.java index 10f8cbe..1154179 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/service/impl/RedisServiceImpl.java +++ b/Cpop-Core/src/main/java/com/cpop/core/service/impl/RedisServiceImpl.java @@ -1,6 +1,7 @@ package com.cpop.core.service.impl; import com.cpop.core.service.RedisService; +import jakarta.annotation.Resource; import org.springframework.data.redis.core.BoundSetOperations; import org.springframework.data.redis.core.HashOperations; import org.springframework.data.redis.core.RedisTemplate; @@ -8,7 +9,6 @@ import org.springframework.data.redis.core.ValueOperations; import org.springframework.integration.redis.util.RedisLockRegistry; import org.springframework.stereotype.Service; -import javax.annotation.Resource; import java.util.Collection; import java.util.List; import java.util.Map; diff --git a/Cpop-Core/src/main/java/com/cpop/core/service/impl/UserServiceImpl.java b/Cpop-Core/src/main/java/com/cpop/core/service/impl/UserServiceImpl.java new file mode 100644 index 0000000..bb4ebaf --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/service/impl/UserServiceImpl.java @@ -0,0 +1,18 @@ +package com.cpop.core.service.impl; + +import com.cpop.core.base.table.User; +import com.cpop.core.mapper.UserMapper; +import com.cpop.core.service.UserService; +import com.mybatisflex.spring.service.impl.ServiceImpl; +import org.springframework.stereotype.Service; + +/** + * 系统用户 服务层实现。 + * + * @author DB + * @since 2024-02-01 + */ +@Service("userService") +public class UserServiceImpl extends ServiceImpl implements UserService { + +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/strategy/dataSourceSharding/CpopDataSourceShardingStrategy.java b/Cpop-Core/src/main/java/com/cpop/core/strategy/dataSourceSharding/CpopDataSourceShardingStrategy.java new file mode 100644 index 0000000..4961266 --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/strategy/dataSourceSharding/CpopDataSourceShardingStrategy.java @@ -0,0 +1,30 @@ +package com.cpop.core.strategy.dataSourceSharding; + +import com.mybatisflex.core.datasource.DataSourceShardingStrategy; + +import java.lang.reflect.Method; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-02-05 9:27 + */ +public class CpopDataSourceShardingStrategy implements DataSourceShardingStrategy { + + @Override + public String doSharding(String currentDataSourceKey, Object mapper, Method mapperMethod, Object[] methodArgs){ + // 不管 other 数据源的情况 + if ("oam".equals(currentDataSourceKey)){ + return currentDataSourceKey; + } + + // 如果 mapper 的方法属于 增删改,使用 master 数据源 + /*if (StringUtils.startWithAny(mapperMethod.getName(), "insert", "delete", "update")){ + return "master"; + }*/ + return "jambox"; + //其他场景,使用 slave1 或者 slave2 进行负载均衡 + //return "slave"; + } + +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/strategy/json/ArrayToStringDeserializer.java b/Cpop-Core/src/main/java/com/cpop/core/strategy/json/ArrayToStringDeserializer.java index 5bb7ea7..5f33bdf 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/strategy/json/ArrayToStringDeserializer.java +++ b/Cpop-Core/src/main/java/com/cpop/core/strategy/json/ArrayToStringDeserializer.java @@ -1,6 +1,6 @@ package com.cpop.core.strategy.json; -import com.cpop.common.utils.StringUtils; +import com.cpop.core.utils.StringUtils; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.TreeNode; diff --git a/Cpop-Core/src/main/java/com/cpop/core/strategy/json/StringToArraySerializer.java b/Cpop-Core/src/main/java/com/cpop/core/strategy/json/StringToArraySerializer.java index 5656a1c..6d42e71 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/strategy/json/StringToArraySerializer.java +++ b/Cpop-Core/src/main/java/com/cpop/core/strategy/json/StringToArraySerializer.java @@ -1,6 +1,5 @@ package com.cpop.core.strategy.json; -import com.cpop.common.utils.StringUtils; import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; diff --git a/Cpop-Core/src/main/java/com/cpop/core/strategy/login/LoginStrategy.java b/Cpop-Core/src/main/java/com/cpop/core/strategy/login/LoginStrategy.java deleted file mode 100644 index 1b5b089..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/strategy/login/LoginStrategy.java +++ /dev/null @@ -1,23 +0,0 @@ -package com.cpop.core.strategy.login; - -import com.cpop.core.base.entity.LoginUser; -import com.cpop.core.base.table.SysUser; - -import java.util.Map; - -/** - * 登陆策略 - * @author DB - */ -public interface LoginStrategy { - - /** - * @descriptions 获取登陆用户信息 - * @author DB - * @date 2023/11/08 9:34 - * @param sysUser 系统用户 - * @param credentials 登陆相关凭着 - * @return: com.cpop.core.base.entity.LoginUser - */ - LoginUser getLoginUserInfo(SysUser sysUser, Map credentials); -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/strategy/login/MallLoginStrategy.java b/Cpop-Core/src/main/java/com/cpop/core/strategy/login/MallLoginStrategy.java deleted file mode 100644 index 443f1da..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/strategy/login/MallLoginStrategy.java +++ /dev/null @@ -1,106 +0,0 @@ -package com.cpop.core.strategy.login; - -import com.cpop.common.constant.Constants; -import com.cpop.common.utils.StringUtils; -import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.base.entity.LoginUser; -import com.cpop.core.base.entity.Permission; -import com.cpop.core.base.entity.loginInfo.MallStaffLoginInfo; -import com.cpop.core.base.enums.InitRoleEnum; -import com.cpop.core.base.enums.SourceType; -import com.cpop.core.base.enums.UserType; -import com.cpop.core.base.exception.CpopAuthenticationException; -import com.cpop.core.base.table.SysUser; -import com.mybatisflex.core.row.DbChain; -import com.mybatisflex.core.row.Row; -import com.mybatisflex.core.row.RowUtil; -import org.springframework.stereotype.Component; - -import java.util.*; -import java.util.stream.Collectors; - -/** - * @author DB - * @createTime 2023/11/08 10:12 - * @description 商城员工登陆策略 - */ -@Component -public class MallLoginStrategy implements LoginStrategy{ - - /** - * @descriptions 获取登陆用户信息 - * @author DB - * @date 2023/11/08 9:34 - * @param sysUser 系统用户 - * @param credentials 登陆相关凭着 - * @return: com.cpop.core.base.entity.LoginUser - */ - @Override - public LoginUser getLoginUserInfo(SysUser sysUser, Map credentials) { - //构建登陆员工信息 - MallStaffLoginInfo staffLoginInfo = BeanUtils.mapToClass(sysUser, MallStaffLoginInfo.class); - staffLoginInfo.setUserId(sysUser.getId()); - //构建员工 - if (!staffLoginInfo.getUserName().equals(Constants.SUPER_ADMIN)) { - Row row = DbChain.table("cp_mall_staff") - .select("cms.id", "cms.name", "cms.user_id","cms.source_type") - .select("cmrb.role_id", "cmrb.brand_id") - .from("cp_mall_staff").as("cms") - .leftJoin("cp_mall_role_brand").as("cmrb").on("cmrb.id = cms.role_brand_id") - .where("cms.user_id = ?", staffLoginInfo.getUserId()) - .and("cms.is_delete = 0") - .one(); - if (row == null) { - throw new CpopAuthenticationException("获取登陆用户信息失败,请核实!"); - } - staffLoginInfo.setRoleId(row.getString("roleId")); - staffLoginInfo.setName(row.getString("name")); - staffLoginInfo.setId(row.getString("id")); - staffLoginInfo.setBrandId(row.getString("brandId")); - staffLoginInfo.setSourceType(SourceType.valueOf(row.getString("sourceType"))); - } else { - //超级管理员 - staffLoginInfo.setId(Constants.SUPER_ADMIN_ID).setName(Constants.SUPER_ADMIN).setSourceType(SourceType.COMMON); - } - LoginUser loginUser = new LoginUser(staffLoginInfo, staffLoginInfo.getId(), getPermissionSet(sysUser.getUserName(), staffLoginInfo.getRoleId())); - loginUser.setUserId(sysUser.getId()) - .setUserType(UserType.MALL_USER) - .setUserName(sysUser.getUserName()) - .setLoginTime(System.currentTimeMillis()) - .setStatus(sysUser.getStatus()); - return loginUser; - } - - /** - * @descriptions 获取权限列表 - * @author DB - * @date 2023/11/08 9:37 - * @param username 用户名 - * @param roleId 角色id - * @return: java.util.Set - */ - private Set getPermissionSet(String username, String roleId) { - //获取权限 - Set permissionSet = new HashSet<>(); - if (Constants.SUPER_ADMIN.equals(username) || StringUtils.equals(InitRoleEnum.SUPER_MALL_ROLE.getId(), roleId)) { - permissionSet.add(Constants.ALL_PERMISSION); - } else { - //查询员工信息 - List list = DbChain.table("cp_sys_menu") - .select("pom.permission") - .from("cp_sys_menu").as("pom") - .leftJoin("cp_sys_role_menu").as("porm").on("porm.menu_id = pom.id") - .where("pom.type in (1,2)") - .and("porm.role_id = ?", roleId) - .and("pom.permission is not null") - .list(); - if (list.isEmpty()) { - permissionSet = new HashSet<>(); - } else { - List permissions = RowUtil.toEntityList(list, Permission.class); - permissionSet = permissions.stream().map(Permission::getPermission).collect(Collectors.toSet()); - } - } - return permissionSet; - } -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/strategy/login/MiniLoginStrategy.java b/Cpop-Core/src/main/java/com/cpop/core/strategy/login/MiniLoginStrategy.java deleted file mode 100644 index d8fb679..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/strategy/login/MiniLoginStrategy.java +++ /dev/null @@ -1,171 +0,0 @@ -package com.cpop.core.strategy.login; - -import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.base.entity.LoginUser; -import com.cpop.core.base.entity.loginInfo.MiniUserLoginInfo; -import com.cpop.core.base.enums.SourceType; -import com.cpop.core.base.enums.UserType; -import com.cpop.core.base.exception.CpopAuthenticationException; -import com.cpop.core.base.table.SysUser; -import com.mybatisflex.core.row.Db; -import com.mybatisflex.core.row.DbChain; -import com.mybatisflex.core.row.Row; -import com.mybatisflex.core.row.RowKey; -import org.springframework.stereotype.Component; - -import java.time.LocalDateTime; -import java.util.Map; - -/** - * @author DB - * @createTime 2023/11/08 10:34 - * @description 小程序登陆 - */ -@Component -public class MiniLoginStrategy implements LoginStrategy { - - /** - * @descriptions 获取登陆用户信息 - * @author DB - * @date 2023/11/08 9:34 - * @param sysUser 系统用户 - * @param credentials 登陆相关凭着 - * @return: com.cpop.core.base.entity.LoginUser - */ - @Override - public LoginUser getLoginUserInfo(SysUser sysUser, Map credentials) { - MiniUserLoginInfo loginInfo = BeanUtils.mapToClass(sysUser, MiniUserLoginInfo.class); - loginInfo.setUserId(sysUser.getId()); - //已经注册过有用户信息 - if (credentials == null){ - //构建用户信息 - Row row = DbChain.table("cp_mini_user") - .select("cmu.id","cmu.open_id","cmu.app_id","cmu.user_id","cmu.brand_id","cmu.nick_name","cmu.avatar","cmu.source_type") - .from("cp_mini_user").as("cmu") - .where("cmu.user_id = ?", loginInfo.getUserId()) - .and("cmu.is_delete = 0") - .one(); - loginInfo.setOpenId(row.getString("openId")) - .setAppId(row.getString("appId")) - .setUserId(row.getString("userId")) - .setBrandId(row.getString("brandId")) - .setNickName(row.getString("nickName")) - .setAvatar(row.getString("avatar")) - .setId(row.getString("id")) - .setSourceType(SourceType.valueOf(row.getString("sourceType"))); - } else { - SourceType sourceType; - //校验用户来源 - if (credentials.get("sourceType") == null) { - loginInfo.setSourceType(SourceType.COMMON); - } else if (SourceType.JAMBOX == SourceType.valueOf(credentials.get("sourceType").toString())){ - //来源自果酱 - sourceType = SourceType.JAMBOX; - //查询果酱用户 - changeJamboxUser(loginInfo, credentials ,sourceType); - } else { - //先用通用 - loginInfo.setSourceType(SourceType.COMMON); - } - } - LoginUser loginUser = new LoginUser(loginInfo, loginInfo.getId(), null); - loginUser.setUserId(sysUser.getId()) - .setUserType(UserType.MINI_USER) - .setUserName(sysUser.getUserName()) - .setLoginTime(System.currentTimeMillis()) - .setStatus(sysUser.getStatus()); - return loginUser; - } - - /** - * @descriptions 获取果酱小程序用户信息 - * @author DB - * @date 2023/10/25 14:53 - * @param loginInfo 用户信息 - * @param credentials 请求参数 - * @param sourceType 来源类型 - * @return: void - */ - private void changeJamboxUser(MiniUserLoginInfo loginInfo, Map credentials, SourceType sourceType) { - //获取品牌表 - Row brand = DbChain.table("cp_sys_brand") - .select("csb.id", "csb.is_open_sharing") - .from("cp_sys_brand").as("csb") - .leftJoin("cp_j_brand_extend").as("cjbe").on("cjbe.brand_id = csb.id") - .and("cjbe.brand_cloud_id = ?", credentials.get("brandId")) - .one(); - if (brand == null) { - throw new CpopAuthenticationException("用户登陆失败,果酱品牌暂未录入系统"); - } - //构建用户信息 - Row row = DbChain.table("cp_mini_user") - .select("cmu.id","cmu.open_id","cmu.app_id","cmu.brand_id","cmu.nick_name","cmu.avatar","cmu.source_type") - .from("cp_mini_user").as("cmu") - .leftJoin("cp_j_brand_extend").as("cjbe").on("cjbe.brand_id = cmu.brand_id") - .where("cmu.app_id = ?",credentials.get("appId")) - .and("cjbe.brand_cloud_id = ?",credentials.get("brandId")) - .and("cmu.open_id = ?",credentials.get("openId")) - //用户来源 - .and("cmu.source_type = ?",sourceType.toString()) - .and("cmu.is_delete = 0") - .one(); - //保存小程序用户信息 - LocalDateTime now = LocalDateTime.now(); - if (row == null) { - Row miniUser = Row.ofKey(RowKey.SNOW_FLAKE_ID); - miniUser.set("open_id", credentials.get("openId")) - .set("app_id", credentials.get("appId")) - .set("brand_id", brand.getString("id")) - .set("nick_name", credentials.get("nickName")) - .set("avatar", credentials.get("avatar")) - .set("source_type", sourceType.toString()) - .set("create_time", now) - .set("update_time", now) - .set("create_user_id", 1) - .set("update_user_id", 1); - int save = Db.insert("cp_mini_user", miniUser); - //插入中间表 - Row miniMidUser = new Row(); - miniMidUser.set("user_id", loginInfo.getUserId()) - .set("mini_id",miniUser.getString("id")) - .set("create_time", now) - .set("update_time", now) - .set("create_user_id", 1) - .set("update_user_id", 1); - Db.insert("cp_mini_user_mid_sys", miniMidUser); - if (save > 0) { - loginInfo.setOpenId((String) credentials.get("openId")) - .setAppId((String) credentials.get("appId")) - .setBrandId(brand.getString("id")) - .setNickName((String) credentials.get("nickName")) - .setAvatar((String) credentials.get("avatar")) - .setId(miniUser.getString("id")) - .setSourceType(sourceType); - } - } else { - //查询中间表 - long count = DbChain.table("cp_mini_user_mid_sys") - .where("mini_id = ?", row.getString("id")) - .and("user_id = ?", loginInfo.getUserId()) - .count(); - if (count == 0) { - //插入中间表 - Row miniMidUser = new Row(); - miniMidUser.set("user_id", loginInfo.getUserId()) - .set("mini_id", row.getString("id")) - .set("create_time", now) - .set("update_time", now) - .set("create_user_id", 1) - .set("update_user_id", 1); - Db.insert("cp_mini_user_mid_sys", miniMidUser); - } - loginInfo.setOpenId(row.getString("openId")) - .setAppId(row.getString("appId")) - .setBrandId(row.getString("brandId")) - .setNickName(row.getString("nickName")) - .setAvatar(row.getString("avatar")) - .setId(row.getString("id")) - .setSourceType(sourceType); - } - } -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/strategy/login/OamLoginStrategy.java b/Cpop-Core/src/main/java/com/cpop/core/strategy/login/OamLoginStrategy.java deleted file mode 100644 index 53bf25a..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/strategy/login/OamLoginStrategy.java +++ /dev/null @@ -1,98 +0,0 @@ -package com.cpop.core.strategy.login; - -import com.cpop.common.constant.Constants; -import com.cpop.common.utils.StringUtils; -import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.base.entity.LoginUser; -import com.cpop.core.base.entity.Permission; -import com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo; -import com.cpop.core.base.enums.InitRoleEnum; -import com.cpop.core.base.enums.UserType; -import com.cpop.core.base.table.SysUser; -import com.mybatisflex.core.row.DbChain; -import com.mybatisflex.core.row.Row; -import com.mybatisflex.core.row.RowUtil; -import org.springframework.stereotype.Component; - -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.stream.Collectors; - -/** - * @author DB - * @createTime 2023/11/08 9:35 - * @description Oam登陆策略 - */ -@Component -public class OamLoginStrategy implements LoginStrategy{ - - /** - * @descriptions 获取登陆用户信息 - * @author DB - * @date 2023/11/08 9:34 - * @param sysUser 系统用户 - * @param credentials 登陆相关凭着 - * @return: com.cpop.core.base.entity.LoginUser - */ - @Override - public LoginUser getLoginUserInfo(SysUser sysUser, Map credentials) { - //构建登陆员工信息 - OamStaffLoginInfo staffLoginInfo = BeanUtils.mapToClass(sysUser, OamStaffLoginInfo.class); - staffLoginInfo.setUserId(sysUser.getId()); - //员工不是超级管理员 - if (!staffLoginInfo.getUserName().equals(Constants.SUPER_ADMIN)) { - Row row = DbChain.table("cp_oam_staff") - .select() - .where("user_id = ?", staffLoginInfo.getUserId()) - .one(); - staffLoginInfo.setDeptId(row.getString("deptId")); - staffLoginInfo.setRoleId(row.getString("roleId")); - staffLoginInfo.setName(row.getString("name")); - staffLoginInfo.setStaffType(row.getInt("staffType")); - staffLoginInfo.setId(row.getString("id")); - }else { - staffLoginInfo.setName(Constants.SUPER_ADMIN); - staffLoginInfo.setId(Constants.SUPER_ADMIN_ID); - } - LoginUser loginUser = new LoginUser(staffLoginInfo, staffLoginInfo.getId(), getPermissionSet(sysUser.getUserName(), staffLoginInfo.getRoleId())); - loginUser.setUserId(sysUser.getId()) - .setUserType(UserType.OAM_USER) - .setUserName(sysUser.getUserName()) - .setLoginTime(System.currentTimeMillis()) - .setStatus(sysUser.getStatus()); - return loginUser; - } - - /** - * @descriptions 获取权限列表 - * @author DB - * @date 2023/11/08 9:37 - * @param username 用户名 - * @param roleId 角色id - * @return: java.util.Set - */ - private Set getPermissionSet(String username, String roleId) { - //获取权限 - Set permissionSet = new HashSet<>(); - if (Constants.SUPER_ADMIN.equals(username) || StringUtils.equals(InitRoleEnum.SUPER_OAM_ROLE.getId(), roleId)) { - permissionSet.add(Constants.ALL_PERMISSION); - } else { - //查询员工信息 - List list = DbChain.table("cp_sys_menu") - .select("pom.permission") - .from("cp_sys_menu").as("pom") - .leftJoin("cp_sys_role_menu").as("porm").on("porm.menu_id = pom.id") - .where("pom.type in (1,2)") - .and("porm.role_id = ?", roleId) - .and("pom.permission is not null") - .list(); - if (!list.isEmpty()) { - List permissions = RowUtil.toEntityList(list, Permission.class); - permissionSet = permissions.stream().map(Permission::getPermission).collect(Collectors.toSet()); - } - } - return permissionSet; - } -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/utils/CpopSignatureUtils.java b/Cpop-Core/src/main/java/com/cpop/core/utils/CpopSignatureUtils.java deleted file mode 100644 index 2f1cb58..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/utils/CpopSignatureUtils.java +++ /dev/null @@ -1,133 +0,0 @@ -package com.cpop.core.utils; - -import com.alibaba.fastjson2.JSONObject; -import com.cpop.core.base.entity.CpopSignBase; -import okhttp3.*; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; -import org.springframework.util.DigestUtils; - -import java.io.IOException; -import java.lang.reflect.Field; -import java.security.KeyFactory; -import java.security.NoSuchAlgorithmException; -import java.security.PrivateKey; -import java.security.PublicKey; -import java.security.spec.InvalidKeySpecException; -import java.security.spec.PKCS8EncodedKeySpec; -import java.security.spec.X509EncodedKeySpec; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.*; -import java.util.stream.Collectors; - -/** - * @author DB - * @version 1.0.0 - * @since 2024-02-28 14:50 - */ -@Component -public class CpopSignatureUtils { - - @Autowired - private RsaUtils rsaUtils; - - private static final Map APP_IDS = new HashMap() {{ - //数币 - put("1688842965582499840", new String[]{"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmsFHkB4iIdVSgaz8u8QG66wiZupgSbu2T/ml/kdPm2vemsKgvEqUqp1gR6ulfHcPF8otjVbjiE8q8oR70XfxFIREbomTUmpsOzurLFrAmVhyvu6/tY23/txjQoeeH/tlCy7Lq/TL1AqPKyBcGzsQ4yInpIgRWpXz7fmJCTRw07tyE+4lpXBqiaLdWrkkGG00LnHQAOfcUoXf0TdxFPSfRHiBikfbkmgeVoU66RGlUEXU2esTY2nYGvFn+FqWsNkGEnn2YxIqgbQQ1zNX33+FWBlba1WdQtc8mTJAleaPGXmFnQiEMb55b7xVPjyyCWt6aRwl97KQgtCmfsoPZUWwQQIDAQAB"}); - //系统 - put("100", new String[]{"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvDdtx3eLzoUbm0qr8xv4XXew0raUsv98eOmdxS4jDgFkajzK3H02fnWg99y2CRcZNnEFA6MlE/0RrAuWnuIehazQBR5dpnzoOht4WweRO0DEciRTdQ5Uf5T4YOlwmNKhE2S9jsmBP8X5Gi2r65G4miBG8r4AJJ9Pxtq8fjZUkCpKrk3y167mSunDUtZZOAimQ7W235Oh7fIqOSNQN+KxvhFSkiSqFIaXjDY50eONdSBaPYV1NsbW5A6VHrsvcG/2uzcEAfINFoRsmF9SxsckvnVsVfKgN+ONvnQdFmAJaiwtXJ9eJ4TfMt+HPTZk8pMfAUEj8vfz/98g39kKY42b2QIDAQAB"}); - }}; - - /** - * 发送签名http请求 - * @author DB - * @since 2024/2/28 - * @param url 路径 - * @param data 数据 - * @param appid appid - * @return Response - */ - public JSONObject sendSignaturePost(String url, Object data, String appid) throws IOException, IllegalAccessException { - OkHttpClient client = new OkHttpClient().newBuilder().build(); - MediaType mediaType = MediaType.Companion.parse("application/json;charset=utf-8"); - RequestBody body = RequestBody.Companion.create(JSONObject.toJSONString(data), mediaType); - String now = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")); - String signType = "RSA"; - CpopSignBase cpopSignBase = new CpopSignBase(); - cpopSignBase.setSignType(signType); - cpopSignBase.setDateTime(now); - cpopSignBase.setAppId(appid); - cpopSignBase.setSignature(md5(data, appid)); - Request request = new Request - .Builder() - .url(url) - .post(body) - .addHeader("Content-Type", "application/json") - .addHeader("appId", appid) - .addHeader("signature", signature(cpopSignBase,APP_IDS.get(appid)[0])) - .addHeader("dateTime", now) - .addHeader("signType", signType) - .build(); - Response response = null; - try { - response = client.newCall(request).execute(); - return JSONObject.parseObject(response.body().string()); - } finally { - assert response != null; - response.close(); - } - } - - private String md5(Object object, String appId) throws IllegalAccessException { - //验签拼接字段 - List signString = new ArrayList(); - //获取父类(公共类必传属性) - Field[] fatherFields = object.getClass().getSuperclass().getDeclaredFields(); - for (Field field : fatherFields) { - field.setAccessible(true); - signString.add(field.getName() + "=" + field.get(object)); - } - //可能为空参 - Field[] fields = object.getClass().getDeclaredFields(); - if (fields.length > 0) { - for (Field field : fields) { - field.setAccessible(true); - if (null == field.get(object)) { - signString.add(field.getName() + "="); - } else { - signString.add(field.getName() + "=" + field.get(object)); - } - } - } - //按照字母排序 - String sign = signString.stream().sorted().collect(Collectors.joining("&")) + appId; - return DigestUtils.md5DigestAsHex(sign.getBytes()); - } - - /** - * 签名 - * - * @param data 数据 - * @return String - * @author DB - * @since 2024/2/28 - */ - private String signature(CpopSignBase data, String publicKey) { - return rsaUtils.encrypt(JSONObject.toJSONString(data), stringToPublicKey(publicKey)); - } - - private PublicKey stringToPublicKey(String publicKey) { - byte[] decode = Base64.getDecoder().decode(publicKey); - X509EncodedKeySpec x509EncodedKeySpec = new X509EncodedKeySpec(decode); - //返回转换指定算法的KeyFactory对象 - KeyFactory keyFactory = null; - try { - keyFactory = KeyFactory.getInstance("RSA"); - //根据PKCS8编码密钥规范产生私钥对象 - return keyFactory.generatePublic(x509EncodedKeySpec); - } catch (NoSuchAlgorithmException | InvalidKeySpecException e) { - throw new RuntimeException(e); - } - } -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/utils/JsonUtils.java b/Cpop-Core/src/main/java/com/cpop/core/utils/JsonUtils.java new file mode 100644 index 0000000..539ebda --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/utils/JsonUtils.java @@ -0,0 +1,30 @@ +package com.cpop.core.utils; + +import com.fasterxml.jackson.annotation.JsonInclude.Include; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; +import lombok.extern.slf4j.Slf4j; + +/** + * @author Binary Wang + */ +@Slf4j +public class JsonUtils { + private static final ObjectMapper JSON = new ObjectMapper(); + + static { + JSON.setSerializationInclusion(Include.NON_NULL); + JSON.configure(SerializationFeature.INDENT_OUTPUT, Boolean.TRUE); + } + + public static String toJson(Object obj) { + try { + return JSON.writeValueAsString(obj); + } catch (JsonProcessingException e) { + log.error(e.getMessage()); + } + return null; + } +} + diff --git a/Cpop-Core/src/main/java/com/cpop/core/utils/JwtUtils.java b/Cpop-Core/src/main/java/com/cpop/core/utils/JwtUtils.java deleted file mode 100644 index 25ae11a..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/utils/JwtUtils.java +++ /dev/null @@ -1,91 +0,0 @@ -package com.cpop.core.utils; - -import com.cpop.common.constant.Constants; -import com.cpop.core.base.enums.UserType; -import io.jsonwebtoken.Claims; -import io.jsonwebtoken.Jws; -import io.jsonwebtoken.Jwts; -import io.jsonwebtoken.SignatureAlgorithm; -import lombok.Data; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.stereotype.Component; - -import java.util.Date; - -/** - * @author: DB - * @date: 2022-09-25 16:14 - * @Description: jwt核心工具类 - */ -@Data -@Component -@ConfigurationProperties(prefix = "cpop.jwt") -public class JwtUtils { - - /** - * 过期时间 - */ - private Long expire; - /** - * 密钥 - */ - private String secret; - /** - * 请求头 - */ - private String header; - - /** - * 白名单 - */ - private String whiteList; - - /** - * @author LOST.yuan - * @description 生成JWT - * @date 16:15 2022/9/25 - * @param username 用户名 - * @return {@link String} - **/ - public String generateToken(String identification, String username, UserType userType) { - Date nowDate = new Date(); - Date expireDate = new Date(nowDate.getTime() + 1000 * expire); - return Jwts.builder() - .setHeaderParam(Constants.USERNAME, username) - .setHeaderParam(Constants.USER_TYPE, userType) - .setSubject(identification) - .setIssuedAt(nowDate) - // 7天过期 - .setExpiration(expireDate) - .signWith(SignatureAlgorithm.HS512, secret) - .compact(); - } - - /** - * @author LOST.yuan - * @description 解析JWT - * @date 16:15 2022/9/25 - * @param jwt - * @return {@link Claims} - **/ - public Jws getClaimsByToken(String jwt) { - try { - return Jwts.parser() - .setSigningKey(secret) - .parseClaimsJws(jwt); - } catch (Exception e) { - return null; - } - } - - /** - * @author LOST.yuan - * @description 判断JWT是否过期 - * @date 16:15 2022/9/25 - * @param claims jwt令牌 - * @return {@link boolean} - **/ - public boolean isTokenExpired(Claims claims) { - return claims.getExpiration().before(new Date()); - } -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/utils/PasswordEncoder.java b/Cpop-Core/src/main/java/com/cpop/core/utils/PasswordEncoder.java deleted file mode 100644 index f20c515..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/utils/PasswordEncoder.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.cpop.core.utils; - -import lombok.NoArgsConstructor; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.authentication.BadCredentialsException; -import org.springframework.security.crypto.bcrypt.BCrypt; -import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; - -/** - * @author: DB - * @date: 2022-09-25 17:01 - * @Description: - */ -@NoArgsConstructor -public class PasswordEncoder extends BCryptPasswordEncoder { - - @Autowired - private RsaUtils rsaUtils; - - @Override - public boolean matches(CharSequence rawPassword, String encodedPassword) { - // 接收到的前端的密码 - String pwd = rawPassword.toString(); - //针对+变空格进行处理 - pwd = pwd.replace(" ", "+"); - // 进行rsa解密 - try { - pwd = rsaUtils.decrypt(pwd); - } catch (Exception e) { - throw new BadCredentialsException(e.getMessage()); - } - if (encodedPassword != null && !encodedPassword.isEmpty()) { - return BCrypt.checkpw(pwd, encodedPassword); - } else { - return false; - } - } -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/utils/SecurityUtils.java b/Cpop-Core/src/main/java/com/cpop/core/utils/SecurityUtils.java deleted file mode 100644 index 3b3ebf4..0000000 --- a/Cpop-Core/src/main/java/com/cpop/core/utils/SecurityUtils.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.cpop.core.utils; - -import com.alibaba.fastjson.JSONObject; -import com.cpop.core.base.entity.LoginUser; -import com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo; -import com.cpop.core.base.enums.UserType; -import com.cpop.core.service.RedisService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.core.Authentication; -import org.springframework.security.core.context.SecurityContextHolder; - -/** - * @author: DB - * @date: 2022-09-26 23:06 - * @Description: - */ -public class SecurityUtils { - - private final static Logger logger = LoggerFactory.getLogger(SecurityUtils.class); - - private SecurityUtils() { - } - - private static class securityUtilsInstance { - private static final SecurityUtils INSTANCE = new SecurityUtils(); - } - - public static SecurityUtils getInstance() { - return securityUtilsInstance.INSTANCE; - } - - /** - * @author LOST.yuan - * @Description: 获取登录用户信息 - * @date 23:07 2022/9/26 - * @return {@link LoginUser} - **/ - public LoginUser getLoginUser() { - Authentication authentication = SecurityContextHolder.getContext().getAuthentication(); - if (authentication == null){ - return null; - } - //匿名用户 - if (authentication.getPrincipal() == "anonymousUser") { - return null; - } - if (null != authentication.getCredentials()) { - return (LoginUser) authentication.getCredentials(); - } else { - return (LoginUser) authentication.getDetails(); - } - } - - /** - * @descriptions 获取缓存用户信息 - * @author DB - * @date 2023/09/21 16:00 - * @return com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo - */ - public JSONObject getLoginUserInfo() { - //获取当前登录用户信息 - LoginUser loginUser = SecurityUtils.getInstance().getLoginUser(); - //系统内部进行程序没有用户 - if (loginUser == null) { - return null; - } - //获取缓存信息 - JSONObject jsonObject = SpringUtils.getBean(RedisService.class).getCacheObject(loginUser.getUserType().getKey() + loginUser.getIdentification()); - return jsonObject.getJSONObject("user"); - } - -} diff --git a/Cpop-Core/src/main/java/com/cpop/core/utils/ServletUtils.java b/Cpop-Core/src/main/java/com/cpop/core/utils/ServletUtils.java new file mode 100644 index 0000000..7be6bd9 --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/utils/ServletUtils.java @@ -0,0 +1,156 @@ +package com.cpop.core.utils; + +import com.alibaba.fastjson2.JSONObject; +import com.cpop.core.utils.text.Convert; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; +import jakarta.servlet.http.HttpSession; +import org.springframework.web.context.request.RequestAttributes; +import org.springframework.web.context.request.RequestContextHolder; +import org.springframework.web.context.request.ServletRequestAttributes; + +import java.io.BufferedReader; +import java.io.IOException; + +/** + * 客户端工具类 + * + * @author DB + */ +public class ServletUtils { + + /** + * 获取String参数 + */ + public static String getParameter(String name) { + return getRequest().getParameter(name); + } + + /** + * 获取String参数 + */ + public static String getParameter(String name, String defaultValue) { + return Convert.toStr(getRequest().getParameter(name), defaultValue); + } + + /** + * 获取Integer参数 + */ + public static Integer getParameterToInt(String name) { + String parameter = getRequest().getParameter(name); + if (StringUtils.isBlank(parameter)){ + //尝试从请求体中获取 + BufferedReader reader; + try { + reader = getRequest().getReader(); + StringBuilder body = new StringBuilder(); + String line; + while ((line = reader.readLine()) != null) { + body.append(line); + } + String requestBody = body.toString(); + //转json + JSONObject json = JSONObject.parseObject(requestBody); + if (null == json) { + return null; + } + parameter = json.getString(name); + } catch (IOException e) { + throw new RuntimeException("获取分页参数失败!"); + } + } + return Convert.toInt(parameter); + } + + /** + * 获取Integer参数 + */ + public static Integer getParameterToInt(String name, Integer defaultValue) { + return Convert.toInt(getRequest().getParameter(name), defaultValue); + } + + /** + * 获取Boolean参数 + */ + public static Boolean getParameterToBool(String name) { + return Convert.toBool(getRequest().getParameter(name)); + } + + /** + * 获取Boolean参数 + */ + public static Boolean getParameterToBool(String name, Boolean defaultValue) { + return Convert.toBool(getRequest().getParameter(name), defaultValue); + } + + /** + * 获取request + */ + public static HttpServletRequest getRequest() { + return getRequestAttributes().getRequest(); + } + + /** + * 获取response + */ + public static HttpServletResponse getResponse() { + return getRequestAttributes().getResponse(); + } + + /** + * 获取session + */ + public static HttpSession getSession() { + return getRequest().getSession(); + } + + public static ServletRequestAttributes getRequestAttributes() { + RequestAttributes attributes = RequestContextHolder.getRequestAttributes(); + return (ServletRequestAttributes) attributes; + } + + /** + * 将字符串渲染到客户端 + * + * @param response 渲染对象 + * @param string 待渲染的字符串 + * @return null + */ + public static String renderString(HttpServletResponse response, String string) { + try { + response.setStatus(200); + response.setContentType("application/json"); + response.setCharacterEncoding("utf-8"); + response.getWriter().print(string); + } catch (IOException e) { + e.printStackTrace(); + } + return null; + } + + /** + * 是否是Ajax异步请求 + * + * @param request + */ + public static boolean isAjaxRequest(HttpServletRequest request) { + String accept = request.getHeader("accept"); + if (accept != null && accept.contains("application/json")) { + return true; + } + + String xRequestedWith = request.getHeader("X-Requested-With"); + if (xRequestedWith != null && xRequestedWith.contains("XMLHttpRequest")) { + return true; + } + + String uri = request.getRequestURI(); + if (StringUtils.inStringIgnoreCase(uri, ".json", ".xml")) { + return true; + } + + String ajax = request.getParameter("__ajax"); + return StringUtils.inStringIgnoreCase(ajax, "json", "xml"); + } + +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/utils/SpringUtils.java b/Cpop-Core/src/main/java/com/cpop/core/utils/SpringUtils.java index cb4426e..268525b 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/utils/SpringUtils.java +++ b/Cpop-Core/src/main/java/com/cpop/core/utils/SpringUtils.java @@ -1,6 +1,6 @@ package com.cpop.core.utils; -import com.cpop.common.utils.StringUtils; +import com.cpop.core.utils.StringUtils; import com.cpop.core.base.entity.BaseEntity; import com.cpop.core.base.exception.BaseException; import com.mybatisflex.core.service.IService; diff --git a/Cpop-Core/src/main/java/com/cpop/core/utils/sql/SqlUtils.java b/Cpop-Core/src/main/java/com/cpop/core/utils/SqlUtils.java similarity index 95% rename from Cpop-Core/src/main/java/com/cpop/core/utils/sql/SqlUtils.java rename to Cpop-Core/src/main/java/com/cpop/core/utils/SqlUtils.java index d2925f1..2f2e7e3 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/utils/sql/SqlUtils.java +++ b/Cpop-Core/src/main/java/com/cpop/core/utils/SqlUtils.java @@ -1,7 +1,5 @@ -package com.cpop.core.utils.sql; +package com.cpop.core.utils; -import com.cpop.common.utils.ServletUtils; -import com.cpop.common.utils.StringUtils; import com.cpop.core.base.entity.PageDomain; import com.cpop.core.base.exception.UtilException; diff --git a/Cpop-Core/src/main/java/com/cpop/core/utils/StringUtils.java b/Cpop-Core/src/main/java/com/cpop/core/utils/StringUtils.java new file mode 100644 index 0000000..ada7dfb --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/utils/StringUtils.java @@ -0,0 +1,582 @@ +package com.cpop.core.utils; + +import com.cpop.core.constant.Constants; +import com.cpop.core.utils.text.StrFormatter; +import org.apache.commons.lang3.ArrayUtils; +import org.springframework.util.AntPathMatcher; + +import java.nio.charset.StandardCharsets; +import java.util.*; + +/** + * 字符串工具类 + * + * @author DB + */ +public class StringUtils extends org.apache.commons.lang3.StringUtils { + /** + * 空字符串 + */ + private static final String NULL_STR = ""; + + /** + * 下划线 + */ + private static final char SEPARATOR = '_'; + + /** + * 获取参数不为空值 + * + * @param value defaultValue 要判断的value + * @return value 返回值 + */ + public static T nvl(T value, T defaultValue) { + return value != null ? value : defaultValue; + } + + /** + * * 判断一个Collection是否为空, 包含List,Set,Queue + * + * @param coll 要判断的Collection + * @return true:为空 false:非空 + */ + public static boolean isEmpty(Collection coll) { + return isNull(coll) || coll.isEmpty(); + } + + /** + * * 判断一个Collection是否非空,包含List,Set,Queue + * + * @param coll 要判断的Collection + * @return true:非空 false:空 + */ + public static boolean isNotEmpty(Collection coll) { + return !isEmpty(coll); + } + + /** + * * 判断一个对象数组是否为空 + * + * @param objects 要判断的对象数组 + * * @return true:为空 false:非空 + */ + public static boolean isEmpty(Object[] objects) { + return isNull(objects) || (objects.length == 0); + } + + /** + * * 判断一个对象数组是否非空 + * + * @param objects 要判断的对象数组 + * @return true:非空 false:空 + */ + public static boolean isNotEmpty(Object[] objects) { + return !isEmpty(objects); + } + + /** + * * 判断一个Map是否为空 + * + * @param map 要判断的Map + * @return true:为空 false:非空 + */ + public static boolean isEmpty(Map map) { + return isNull(map) || map.isEmpty(); + } + + /** + * * 判断一个Map是否为空 + * + * @param map 要判断的Map + * @return true:非空 false:空 + */ + public static boolean isNotEmpty(Map map) { + return !isEmpty(map); + } + + /** + * * 判断一个字符串是否为空串 + * + * @param str String + * @return true:为空 false:非空 + */ + public static boolean isEmpty(String str) { + return isNull(str) || NULL_STR.equals(str.trim()); + } + + /** + * * 判断一个字符串是否为非空串 + * + * @param str String + * @return true:非空串 false:空串 + */ + public static boolean isNotEmpty(String str) { + return !isEmpty(str); + } + + /** + * * 判断一个对象是否为空 + * + * @param object Object + * @return true:为空 false:非空 + */ + public static boolean isNull(Object object) { + return object == null; + } + + /** + * * 判断一个对象是否非空 + * + * @param object Object + * @return true:非空 false:空 + */ + public static boolean isNotNull(Object object) { + return !isNull(object); + } + + /** + * * 判断一个对象是否是数组类型(Java基本型别的数组) + * + * @param object 对象 + * @return true:是数组 false:不是数组 + */ + public static boolean isArray(Object object) { + return isNotNull(object) && object.getClass().isArray(); + } + + /** + * 去空格 + */ + public static String trim(String str) { + return (str == null ? "" : str.trim()); + } + + /** + * 截取字符串 + * + * @param str 字符串 + * @param start 开始 + * @return 结果 + */ + public static String substring(final String str, int start) { + if (str == null) { + return NULL_STR; + } + + if (start < 0) { + start = str.length() + start; + } + + if (start < 0) { + start = 0; + } + if (start > str.length()) { + return NULL_STR; + } + + return str.substring(start); + } + + /** + * 截取字符串 + * + * @param str 字符串 + * @param start 开始 + * @param end 结束 + * @return 结果 + */ + public static String substring(final String str, int start, int end) { + if (str == null) { + return NULL_STR; + } + + if (end < 0) { + end = str.length() + end; + } + if (start < 0) { + start = str.length() + start; + } + + if (end > str.length()) { + end = str.length(); + } + + if (start > end) { + return NULL_STR; + } + + if (start < 0) { + start = 0; + } + if (end < 0) { + end = 0; + } + + return str.substring(start, end); + } + + /** + * 格式化文本, {} 表示占位符
+ * 此方法只是简单将占位符 {} 按照顺序替换为参数
+ * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可
+ * 例:
+ * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b
+ * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a
+ * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b
+ * + * @param template 文本模板,被替换的部分用 {} 表示 + * @param params 参数值 + * @return 格式化后的文本 + */ + public static String format(String template, Object... params) { + if (isEmpty(params) || isEmpty(template)) { + return template; + } + return StrFormatter.format(template, params); + } + + /** + * 是否为http(s)://开头 + * + * @param link 链接 + * @return 结果 + */ + public static boolean isHttp(String link) { + return StringUtils.startsWithAny(link, Constants.HTTP, Constants.HTTPS); + } + + /** + * 字符串转set + * + * @param str 字符串 + * @param sep 分隔符 + * @return set集合 + */ + public static Set str2Set(String str, String sep) { + return new HashSet(str2List(str, sep, true, false)); + } + + /** + * 字符串转list + * + * @param str 字符串 + * @param sep 分隔符 + * @param filterBlank 过滤纯空白 + * @param trim 去掉首尾空白 + * @return list集合 + */ + public static List str2List(String str, String sep, boolean filterBlank, boolean trim) { + List list = new ArrayList(); + if (StringUtils.isEmpty(str)) { + return list; + } + + // 过滤空白字符串 + if (filterBlank && StringUtils.isBlank(str)) { + return list; + } + String[] split = str.split(sep); + for (String string : split) { + if (filterBlank && StringUtils.isBlank(string)) { + continue; + } + if (trim) { + string = string.trim(); + } + list.add(string); + } + + return list; + } + + /** + * 查找指定字符串是否包含指定字符串列表中的任意一个字符串同时串忽略大小写 + * + * @param cs 指定字符串 + * @param searchCharSequences 需要检查的字符串数组 + * @return 是否包含任意一个字符串 + */ + public static boolean containsAnyIgnoreCase(CharSequence cs, CharSequence... searchCharSequences) { + if (isEmpty(cs) || isEmpty(searchCharSequences)) { + return false; + } + for (CharSequence testStr : searchCharSequences) { + if (containsIgnoreCase(cs, testStr)) { + return true; + } + } + return false; + } + + /** + * 驼峰转下划线命名 + */ + public static String toUnderScoreCase(String str) { + if (str == null) { + return null; + } + StringBuilder sb = new StringBuilder(); + // 前置字符是否大写 + boolean preCharIsUpperCase = true; + // 当前字符是否大写 + boolean curreCharIsUpperCase = true; + // 下一字符是否大写 + boolean nexteCharIsUpperCase = true; + for (int i = 0; i < str.length(); i++) { + char c = str.charAt(i); + if (i > 0) { + preCharIsUpperCase = Character.isUpperCase(str.charAt(i - 1)); + } else { + preCharIsUpperCase = false; + } + + curreCharIsUpperCase = Character.isUpperCase(c); + + if (i < (str.length() - 1)) { + nexteCharIsUpperCase = Character.isUpperCase(str.charAt(i + 1)); + } + + if (preCharIsUpperCase && curreCharIsUpperCase && !nexteCharIsUpperCase) { + sb.append(SEPARATOR); + } else if ((i != 0 && !preCharIsUpperCase) && curreCharIsUpperCase) { + sb.append(SEPARATOR); + } + sb.append(Character.toLowerCase(c)); + } + + return sb.toString(); + } + + /** + * 是否包含字符串 + * + * @param str 验证字符串 + * @param strs 字符串组 + * @return 包含返回true + */ + public static boolean inStringIgnoreCase(String str, String... strs) { + if (str != null && strs != null) { + for (String s : strs) { + if (str.equalsIgnoreCase(trim(s))) { + return true; + } + } + } + return false; + } + + /** + * 将下划线大写方式命名的字符串转换为驼峰式。如果转换前的下划线大写方式命名的字符串为空,则返回空字符串。 例如:HELLO_WORLD->HelloWorld + * + * @param name 转换前的下划线大写方式命名的字符串 + * @return 转换后的驼峰式命名的字符串 + */ + public static String convertToCamelCase(String name) { + StringBuilder result = new StringBuilder(); + // 快速检查 + if (name == null || name.isEmpty()) { + // 没必要转换 + return ""; + } else if (!name.contains("_")) { + // 不含下划线,仅将首字母大写 + return name.substring(0, 1).toUpperCase() + name.substring(1); + } + // 用下划线将原始字符串分割 + String[] camels = name.split("_"); + for (String camel : camels) { + // 跳过原始字符串中开头、结尾的下换线或双重下划线 + if (camel.isEmpty()) { + continue; + } + // 首字母大写 + result.append(camel.substring(0, 1).toUpperCase()); + result.append(camel.substring(1).toLowerCase()); + } + return result.toString(); + } + + /** + * 驼峰式命名法 例如:user_name->userName + */ + public static String toCamelCase(String s) { + if (s == null) { + return null; + } + s = s.toLowerCase(); + StringBuilder sb = new StringBuilder(s.length()); + boolean upperCase = false; + for (int i = 0; i < s.length(); i++) { + char c = s.charAt(i); + + if (c == SEPARATOR) { + upperCase = true; + } else if (upperCase) { + sb.append(Character.toUpperCase(c)); + upperCase = false; + } else { + sb.append(c); + } + } + return sb.toString(); + } + + /** + * 查找指定字符串是否匹配指定字符串列表中的任意一个字符串 + * + * @param str 指定字符串 + * @param strs 需要检查的字符串数组 + * @return 是否匹配 + */ + public static boolean matches(String str, List strs) { + if (isEmpty(str) || isEmpty(strs)) { + return false; + } + for (String pattern : strs) { + if (isMatch(pattern, str)) { + return true; + } + } + return false; + } + + /** + * 判断url是否与规则配置: + * ? 表示单个字符; + * * 表示一层路径内的任意字符串,不可跨层级; + * ** 表示任意层路径; + * + * @param pattern 匹配规则 + * @param url 需要匹配的url + * @return + */ + public static boolean isMatch(String pattern, String url) { + AntPathMatcher matcher = new AntPathMatcher(); + return matcher.match(pattern, url); + } + + @SuppressWarnings("unchecked") + public static T cast(Object obj) { + return (T) obj; + } + + + /** + * 首字母大写(进行字母的ascii编码前移,效率是最高的) + * + * @param fieldName 需要转化的字符串 + */ + public static String getMethodName(String fieldName) { + char[] chars = fieldName.toCharArray(); + chars[0] = toUpperCase(chars[0]); + return String.valueOf(chars); + } + + + /** + * 字符转成大写 + * + * @param c 需要转化的字符 + */ + public static char toUpperCase(char c) { + if (97 <= c && c <= 122) { + c ^= 32; + } + return c; + } + + /** + * 数字左边补齐0,使之达到指定长度。注意,如果数字转换为字符串后,长度大于size,则只保留 最后size个字符。 + * + * @param num 数字对象 + * @param size 字符串指定长度 + * @return 返回数字的字符串格式,该字符串为指定长度。 + */ + public static String padL(final Number num, final int size) + { + return padL(num.toString(), size, '0'); + } + + /** + * 字符串左补齐。如果原始字符串s长度大于size,则只保留最后size个字符。 + * + * @param s 原始字符串 + * @param size 字符串指定长度 + * @param c 用于补齐的字符 + * @return 返回指定长度的字符串,由原字符串左补齐或截取得到。 + */ + public static String padL(final String s, final int size, final char c) + { + final StringBuilder sb = new StringBuilder(size); + if (s != null) + { + final int len = s.length(); + if (s.length() <= size) + { + for (int i = size - len; i > 0; i--) + { + sb.append(c); + } + sb.append(s); + } + else + { + return s.substring(len - size, len); + } + } + else + { + for (int i = size; i > 0; i--) + { + sb.append(c); + } + } + return sb.toString(); + } + + /** + * + * @param aString 要截取的字符串 + * @param startIndex 开始下标 + * @param endIndex 截取长度 + */ + public static String substringByte(String aString,int startIndex,int endIndex) { + byte[] bytes = aString.getBytes(StandardCharsets.UTF_8); + int subLen = endIndex - startIndex; + if (startIndex < 0) { + return "startIndex异常"; + } + if (endIndex > bytes.length) { + return "endIndex异常"; + } + if (subLen <= 0) { + return "startIndex或endIndex异常"; + } + byte[] subBytes = new byte[subLen]; + int i = 0; + while (startIndex < endIndex) { + subBytes[i++] = bytes[startIndex++]; + } + return new String(subBytes, StandardCharsets.UTF_8); + } + + /** + * 字符串是否再匹配项内 + * @author DB + * @since 2024/2/5 + * @param string 字符串 + * @param searchStrings 匹配项 + * @return boolean + */ + public static boolean startWithAny(final CharSequence string, final CharSequence... searchStrings) { + if (isEmpty(string) || ArrayUtils.isEmpty(searchStrings)) { + return false; + } + for (final CharSequence searchString : searchStrings) { + if (StringUtils.startsWith(string, searchString)) { + return true; + } + } + return false; + } + +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/utils/bean/BeanUtils.java b/Cpop-Core/src/main/java/com/cpop/core/utils/bean/BeanUtils.java new file mode 100644 index 0000000..579734b --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/utils/bean/BeanUtils.java @@ -0,0 +1,193 @@ +package com.cpop.core.utils.bean; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.lang.reflect.Field; +import java.lang.reflect.Method; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * Bean 工具类 + * + * @author DB + */ +public class BeanUtils extends org.springframework.beans.BeanUtils { + + private static final Logger LOGGER = LoggerFactory.getLogger(BeanUtils.class); + /** + * Bean方法名中属性名开始的下标 + */ + private static final int BEAN_METHOD_PROP_INDEX = 3; + + /** + * 匹配getter方法的正则表达式 + */ + private static final Pattern GET_PATTERN = Pattern.compile("get(\\p{javaUpperCase}\\w*)"); + + /** + * 匹配setter方法的正则表达式 + */ + private static final Pattern SET_PATTERN = Pattern.compile("set(\\p{javaUpperCase}\\w*)"); + + /** + * Bean属性复制工具方法。 + * + * @param dest 目标对象 + * @param src 源对象 + */ + public static void copyBeanProp(Object dest, Object src) { + try { + copyProperties(src, dest); + } catch (Exception e) { + LOGGER.error(e.getMessage()); + } + } + + /** + * 实体类转换 + * @param source 资源 + * @param target 目标 + * @param 目标类型 + * @return 转换结果 + */ + public static T sourceToTarget(Object source, Class target){ + if(source == null){ + return null; + } + T targetObject = null; + try { + targetObject = target.newInstance(); + BeanUtils.copyProperties(source, targetObject); + } catch (Exception e) { + LOGGER.error("实体类转换失败: ", e); + } + + return targetObject; + } + + /** + * 获取对象的setter方法。 + * + * @param obj 对象 + * @return 对象的setter方法列表 + */ + public static List getSetterMethods(Object obj) { + // setter方法列表 + List setterMethods = new ArrayList(); + + // 获取所有方法 + Method[] methods = obj.getClass().getMethods(); + + // 查找setter方法 + + for (Method method : methods) { + Matcher m = SET_PATTERN.matcher(method.getName()); + if (m.matches() && (method.getParameterTypes().length == 1)) { + setterMethods.add(method); + } + } + // 返回setter方法列表 + return setterMethods; + } + + /** + * 获取对象的getter方法。 + * + * @param obj 对象 + * @return 对象的getter方法列表 + */ + + public static List getGetterMethods(Object obj) { + // getter方法列表 + List getterMethods = new ArrayList(); + // 获取所有方法 + Method[] methods = obj.getClass().getMethods(); + // 查找getter方法 + for (Method method : methods) { + Matcher m = GET_PATTERN.matcher(method.getName()); + if (m.matches() && (method.getParameterTypes().length == 0)) { + getterMethods.add(method); + } + } + // 返回getter方法列表 + return getterMethods; + } + + /** + * 检查Bean方法名中的属性名是否相等。
+ * 如getName()和setName()属性名一样,getName()和setAge()属性名不一样。 + * + * @param m1 方法名1 + * @param m2 方法名2 + * @return 属性名一样返回true,否则返回false + */ + + public static boolean isMethodPropEquals(String m1, String m2) { + return m1.substring(BEAN_METHOD_PROP_INDEX).equals(m2.substring(BEAN_METHOD_PROP_INDEX)); + } + + /** + * 对象转换 + * + * @param sourceObject 原Object + * @param destinationClass 转换class + * @param 转换实体类 + * @param 原实体类 + * @return T + */ + public static T mapToClass(E sourceObject, Class destinationClass) { + T targetObject = instantiateClass(destinationClass); + copyProperties(sourceObject, targetObject); + return targetObject; + } + + /** + * List转换 + * + * @param sourceList 原List + * @param destinationClass 转换class + * @param 转换实体类 + * @param 原实体类 + * @return List + */ + public static List mapToList(List sourceList, Class destinationClass) { + List destinationList = new ArrayList<>(sourceList.size()); + for (E sourceObject : sourceList) { + T targetObject = instantiateClass(destinationClass); + copyProperties(sourceObject, targetObject); + destinationList.add(targetObject); + } + return destinationList; + } + + /** + * @param origin + * @param t + * @author LOST.yuan + * @Description map转对象 + * @date 11:52 2022/8/23 + **/ + public static void mapToObj(Map origin, T t) { + Class clazz = t.getClass(); + Field[] fields = clazz.getDeclaredFields(); + for (Field field : fields) { + field.setAccessible(true); + String fieldName = field.getName(); + Object o = origin.get(fieldName); + if (o == null) { + continue; + } + String value = o.toString(); + try { + field.set(t, value); + } catch (IllegalAccessException e) { + LOGGER.error(e.getMessage()); + } + } + } +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/utils/file/FileUploadUtils.java b/Cpop-Core/src/main/java/com/cpop/core/utils/file/FileUploadUtils.java index aeaeb77..c0d8d08 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/utils/file/FileUploadUtils.java +++ b/Cpop-Core/src/main/java/com/cpop/core/utils/file/FileUploadUtils.java @@ -1,9 +1,8 @@ package com.cpop.core.utils.file; import com.cpop.core.config.CpopConfig; -import com.cpop.common.constant.Constants; -import com.cpop.common.utils.DateUtils; -import com.cpop.common.utils.StringUtils; +import com.cpop.core.constant.Constants; +import com.cpop.core.utils.StringUtils; import com.cpop.core.base.exception.file.FileNameLengthLimitExceededException; import com.cpop.core.base.exception.file.FileSizeLimitExceededException; import com.cpop.core.base.exception.file.InvalidExtensionException; @@ -15,6 +14,8 @@ import org.springframework.web.multipart.MultipartFile; import java.io.File; import java.io.IOException; import java.nio.file.Paths; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; import java.util.Objects; /** @@ -119,7 +120,7 @@ public class FileUploadUtils { * 编码文件名 */ public final String extractFilename(MultipartFile file) { - return StringUtils.format("{}/{}_{}.{}", DateUtils.datePath(), + return StringUtils.format("{}/{}_{}.{}", LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy/MM/dd")), FilenameUtils.getBaseName(file.getOriginalFilename()), Seq.getId(Seq.uploadSeqType), getExtension(file)); } diff --git a/Cpop-Core/src/main/java/com/cpop/core/utils/file/FileUtils.java b/Cpop-Core/src/main/java/com/cpop/core/utils/file/FileUtils.java index a924efb..8210687 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/utils/file/FileUtils.java +++ b/Cpop-Core/src/main/java/com/cpop/core/utils/file/FileUtils.java @@ -3,26 +3,26 @@ package com.cpop.core.utils.file; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.read.listener.ReadListener; -import com.cpop.common.utils.DateUtils; -import com.cpop.common.utils.StringUtils; +import com.cpop.core.utils.StringUtils; import com.cpop.core.config.CpopConfig; import com.cpop.core.utils.SpringUtils; import com.cpop.core.utils.uuid.IdUtils; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; import org.apache.commons.io.FilenameUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.ArrayUtils; -import org.apache.http.entity.ContentType; import org.apache.poi.ss.formula.functions.T; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.mock.web.MockMultipartFile; import org.springframework.web.multipart.MultipartFile; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; import java.io.*; import java.net.URLEncoder; import java.nio.charset.StandardCharsets; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; import java.util.List; /** @@ -99,7 +99,7 @@ public class FileUtils { String pathName = ""; try { String extension = getFileExtendName(data); - pathName = DateUtils.datePath() + "/" + IdUtils.fastUUID() + "." + extension; + pathName = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy/MM/dd")) + "/" + IdUtils.fastUUID() + "." + extension; File file = FileUploadUtils.getInstance().getAbsoluteFile(uploadDir, pathName); fos = new FileOutputStream(file); fos.write(data); @@ -298,8 +298,12 @@ public class FileUtils { * @return MultipartFile 上传文件 */ public MultipartFile getMultipartFile(File file) throws IOException { - FileInputStream inputStream = new FileInputStream(file); - return new MockMultipartFile(file.getName(), file.getName(), ContentType.APPLICATION_OCTET_STREAM.toString(), inputStream); + FileInputStream fileInputStream = new FileInputStream(file); + return new MockMultipartFile( + "file", + file.getName(), + "text/plain", + fileInputStream); } } diff --git a/Cpop-Core/src/main/java/com/cpop/core/utils/html/EscapeUtil.java b/Cpop-Core/src/main/java/com/cpop/core/utils/html/EscapeUtil.java new file mode 100644 index 0000000..a2f1caa --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/utils/html/EscapeUtil.java @@ -0,0 +1,133 @@ +package com.cpop.core.utils.html; + +import com.cpop.core.utils.StringUtils; + +/** + * 转义和反转义工具类 + * + * @author DB + */ +public class EscapeUtil { + public static final String RE_HTML_MARK = "(<[^<]*?>)|(<[\\s]*?/[^<]*?>)|(<[^<]*?/[\\s]*?>)"; + + private static final char[][] TEXT = new char[64][]; + + static { + for (int i = 0; i < 64; i++) { + TEXT[i] = new char[]{(char) i}; + } + // special HTML characters + // 单引号 + TEXT['\''] = "'".toCharArray(); + // 双引号 + TEXT['"'] = """.toCharArray(); + // &符 + TEXT['&'] = "&".toCharArray(); + // 小于号 + TEXT['<'] = "<".toCharArray(); + // 大于号 + TEXT['>'] = ">".toCharArray(); + } + + /** + * 转义文本中的HTML字符为安全的字符 + * + * @param text 被转义的文本 + * @return 转义后的文本 + */ + public static String escape(String text) { + return encode(text); + } + + /** + * 还原被转义的HTML特殊字符 + * + * @param content 包含转义符的HTML内容 + * @return 转换后的字符串 + */ + public static String unescape(String content) { + return decode(content); + } + + /** + * 清除所有HTML标签,但是不删除标签内的内容 + * + * @param content 文本 + * @return 清除标签后的文本 + */ + public static String clean(String content) { + return new HTMLFilter().filter(content); + } + + /** + * Escape编码 + * + * @param text 被编码的文本 + * @return 编码后的字符 + */ + private static String encode(String text) { + if (StringUtils.isEmpty(text)) { + return StringUtils.EMPTY; + } + + final StringBuilder tmp = new StringBuilder(text.length() * 6); + char c; + for (int i = 0; i < text.length(); i++) { + c = text.charAt(i); + if (c < 256) { + tmp.append("%"); + if (c < 16) { + tmp.append("0"); + } + tmp.append(Integer.toString(c, 16)); + } else { + tmp.append("%u"); + if (c <= 0xfff) { + // issue#I49JU8@Gitee + tmp.append("0"); + } + tmp.append(Integer.toString(c, 16)); + } + } + return tmp.toString(); + } + + /** + * Escape解码 + * + * @param content 被转义的内容 + * @return 解码后的字符串 + */ + public static String decode(String content) { + if (StringUtils.isEmpty(content)) { + return content; + } + + StringBuilder tmp = new StringBuilder(content.length()); + int lastPos = 0, pos = 0; + char ch; + while (lastPos < content.length()) { + pos = content.indexOf("%", lastPos); + if (pos == lastPos) { + if (content.charAt(pos + 1) == 'u') { + ch = (char) Integer.parseInt(content.substring(pos + 2, pos + 6), 16); + tmp.append(ch); + lastPos = pos + 6; + } else { + ch = (char) Integer.parseInt(content.substring(pos + 1, pos + 3), 16); + tmp.append(ch); + lastPos = pos + 3; + } + } else { + if (pos == -1) { + tmp.append(content.substring(lastPos)); + lastPos = content.length(); + } else { + tmp.append(content.substring(lastPos, pos)); + lastPos = pos; + } + } + } + return tmp.toString(); + } +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/utils/html/HTMLFilter.java b/Cpop-Core/src/main/java/com/cpop/core/utils/html/HTMLFilter.java new file mode 100644 index 0000000..42e8781 --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/utils/html/HTMLFilter.java @@ -0,0 +1,499 @@ +package com.cpop.core.utils.html; + +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ConcurrentMap; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +/** + * HTML过滤器,用于去除XSS漏洞隐患。 + * + * @author DB + */ +public final class HTMLFilter { + /** + * regex flag union representing /si modifiers in php + **/ + private static final int REGEX_FLAGS_SI = Pattern.CASE_INSENSITIVE | Pattern.DOTALL; + private static final Pattern P_COMMENTS = Pattern.compile("", Pattern.DOTALL); + private static final Pattern P_COMMENT = Pattern.compile("^!--(.*)--$", REGEX_FLAGS_SI); + private static final Pattern P_TAGS = Pattern.compile("<(.*?)>", Pattern.DOTALL); + private static final Pattern P_END_TAG = Pattern.compile("^/([a-z0-9]+)", REGEX_FLAGS_SI); + private static final Pattern P_START_TAG = Pattern.compile("^([a-z0-9]+)(.*?)(/?)$", REGEX_FLAGS_SI); + private static final Pattern P_QUOTED_ATTRIBUTES = Pattern.compile("([a-z0-9]+)=([\"'])(.*?)\\2", REGEX_FLAGS_SI); + private static final Pattern P_UNQUOTED_ATTRIBUTES = Pattern.compile("([a-z0-9]+)(=)([^\"\\s']+)", REGEX_FLAGS_SI); + private static final Pattern P_PROTOCOL = Pattern.compile("^([^:]+):", REGEX_FLAGS_SI); + private static final Pattern P_ENTITY = Pattern.compile("&#(\\d+);?"); + private static final Pattern P_ENTITY_UNICODE = Pattern.compile("&#x([0-9a-f]+);?"); + private static final Pattern P_ENCODE = Pattern.compile("%([0-9a-f]{2});?"); + private static final Pattern P_VALID_ENTITIES = Pattern.compile("&([^&;]*)(?=(;|&|$))"); + private static final Pattern P_VALID_QUOTES = Pattern.compile("(>|^)([^<]+?)(<|$)", Pattern.DOTALL); + private static final Pattern P_END_ARROW = Pattern.compile("^>"); + private static final Pattern P_BODY_TO_END = Pattern.compile("<([^>]*?)(?=<|$)"); + private static final Pattern P_XML_CONTENT = Pattern.compile("(^|>)([^<]*?)(?=>)"); + private static final Pattern P_STRAY_LEFT_ARROW = Pattern.compile("<([^>]*?)(?=<|$)"); + private static final Pattern P_STRAY_RIGHT_ARROW = Pattern.compile("(^|>)([^<]*?)(?=>)"); + private static final Pattern P_AMP = Pattern.compile("&"); + private static final Pattern P_QUOTE = Pattern.compile("\""); + private static final Pattern P_LEFT_ARROW = Pattern.compile("<"); + private static final Pattern P_RIGHT_ARROW = Pattern.compile(">"); + private static final Pattern P_BOTH_ARROWS = Pattern.compile("<>"); + + // @xxx could grow large... maybe use sesat's ReferenceMap + private static final ConcurrentMap P_REMOVE_PAIR_BLANKS = new ConcurrentHashMap<>(); + private static final ConcurrentMap P_REMOVE_SELF_BLANKS = new ConcurrentHashMap<>(); + + /** + * set of allowed html elements, along with allowed attributes for each element + **/ + private final Map> vAllowed; + /** + * counts of open tags for each (allowable) html element + **/ + private final Map vTagCounts = new HashMap<>(); + + /** + * html elements which must always be self-closing (e.g. "") + **/ + private final String[] vSelfClosingTags; + /** + * html elements which must always have separate opening and closing tags (e.g. "") + **/ + private final String[] vNeedClosingTags; + /** + * set of disallowed html elements + **/ + private final String[] vDisallowed; + /** + * attributes which should be checked for valid protocols + **/ + private final String[] vProtocolAtts; + /** + * allowed protocols + **/ + private final String[] vAllowedProtocols; + /** + * tags which should be removed if they contain no content (e.g. "" or "") + **/ + private final String[] vRemoveBlanks; + /** + * entities allowed within html markup + **/ + private final String[] vAllowedEntities; + /** + * flag determining whether comments are allowed in input String. + */ + private final boolean stripComment; + private final boolean encodeQuotes; + /** + * flag determining whether to try to make tags when presented with "unbalanced" angle brackets (e.g. "" + * becomes " text "). If set to false, unbalanced angle brackets will be html escaped. + */ + private final boolean alwaysMakeTags; + + /** + * Default constructor. + */ + public HTMLFilter() { + vAllowed = new HashMap<>(); + + final ArrayList a_atts = new ArrayList<>(); + a_atts.add("href"); + a_atts.add("target"); + vAllowed.put("a", a_atts); + + final ArrayList img_atts = new ArrayList<>(); + img_atts.add("src"); + img_atts.add("width"); + img_atts.add("height"); + img_atts.add("alt"); + vAllowed.put("img", img_atts); + + final ArrayList no_atts = new ArrayList<>(); + vAllowed.put("b", no_atts); + vAllowed.put("strong", no_atts); + vAllowed.put("i", no_atts); + vAllowed.put("em", no_atts); + + vSelfClosingTags = new String[]{"img"}; + vNeedClosingTags = new String[]{"a", "b", "strong", "i", "em"}; + vDisallowed = new String[]{}; + // no ftp. + vAllowedProtocols = new String[]{"http", "mailto", "https"}; + vProtocolAtts = new String[]{"src", "href"}; + vRemoveBlanks = new String[]{"a", "b", "strong", "i", "em"}; + vAllowedEntities = new String[]{"amp", "gt", "lt", "quot"}; + stripComment = true; + encodeQuotes = true; + alwaysMakeTags = false; + } + + /** + * Map-parameter configurable constructor. + * + * @param conf map containing configuration. keys match field names. + */ + @SuppressWarnings("unchecked") + public HTMLFilter(final Map conf) { + + assert conf.containsKey("vAllowed") : "configuration requires vAllowed"; + assert conf.containsKey("vSelfClosingTags") : "configuration requires vSelfClosingTags"; + assert conf.containsKey("vNeedClosingTags") : "configuration requires vNeedClosingTags"; + assert conf.containsKey("vDisallowed") : "configuration requires vDisallowed"; + assert conf.containsKey("vAllowedProtocols") : "configuration requires vAllowedProtocols"; + assert conf.containsKey("vProtocolAtts") : "configuration requires vProtocolAtts"; + assert conf.containsKey("vRemoveBlanks") : "configuration requires vRemoveBlanks"; + assert conf.containsKey("vAllowedEntities") : "configuration requires vAllowedEntities"; + + vAllowed = Collections.unmodifiableMap((HashMap>) conf.get("vAllowed")); + vSelfClosingTags = (String[]) conf.get("vSelfClosingTags"); + vNeedClosingTags = (String[]) conf.get("vNeedClosingTags"); + vDisallowed = (String[]) conf.get("vDisallowed"); + vAllowedProtocols = (String[]) conf.get("vAllowedProtocols"); + vProtocolAtts = (String[]) conf.get("vProtocolAtts"); + vRemoveBlanks = (String[]) conf.get("vRemoveBlanks"); + vAllowedEntities = (String[]) conf.get("vAllowedEntities"); + stripComment = conf.containsKey("stripComment") ? (Boolean) conf.get("stripComment") : true; + encodeQuotes = conf.containsKey("encodeQuotes") ? (Boolean) conf.get("encodeQuotes") : true; + alwaysMakeTags = conf.containsKey("alwaysMakeTags") ? (Boolean) conf.get("alwaysMakeTags") : true; + } + + private void reset() { + vTagCounts.clear(); + } + + // --------------------------------------------------------------- + // my versions of some PHP library functions + public static String chr(final int decimal) { + return String.valueOf((char) decimal); + } + + public static String htmlSpecialChars(final String s) { + String result = s; + result = regexReplace(P_AMP, "&", result); + result = regexReplace(P_QUOTE, """, result); + result = regexReplace(P_LEFT_ARROW, "<", result); + result = regexReplace(P_RIGHT_ARROW, ">", result); + return result; + } + + // --------------------------------------------------------------- + + /** + * given a user submitted input String, filter out any invalid or restricted html. + * + * @param input text (i.e. submitted by a user) than may contain html + * @return "clean" version of input, with only valid, whitelisted html elements allowed + */ + public String filter(final String input) { + reset(); + String s = input; + + s = escapeComments(s); + + s = balanceHTML(s); + + s = checkTags(s); + + s = processRemoveBlanks(s); + + // s = validateEntities(s); + + return s; + } + + public boolean isAlwaysMakeTags() { + return alwaysMakeTags; + } + + public boolean isStripComments() { + return stripComment; + } + + private String escapeComments(final String s) { + final Matcher m = P_COMMENTS.matcher(s); + final StringBuffer buf = new StringBuffer(); + if (m.find()) { + // (.*?) + final String match = m.group(1); + m.appendReplacement(buf, Matcher.quoteReplacement("")); + } + m.appendTail(buf); + + return buf.toString(); + } + + private String balanceHTML(String s) { + if (alwaysMakeTags) { + // + // try and form html + // + s = regexReplace(P_END_ARROW, "", s); + // 不追加结束标签 + s = regexReplace(P_BODY_TO_END, "<$1>", s); + s = regexReplace(P_XML_CONTENT, "$1<$2", s); + + } else { + // + // escape stray brackets + // + s = regexReplace(P_STRAY_LEFT_ARROW, "<$1", s); + s = regexReplace(P_STRAY_RIGHT_ARROW, "$1$2><", s); + + // + // the last regexp causes '<>' entities to appear + // (we need to do a lookahead assertion so that the last bracket can + // be used in the next pass of the regexp) + // + s = regexReplace(P_BOTH_ARROWS, "", s); + } + + return s; + } + + private String checkTags(String s) { + Matcher m = P_TAGS.matcher(s); + + final StringBuffer buf = new StringBuffer(); + while (m.find()) { + String replaceStr = m.group(1); + replaceStr = processTag(replaceStr); + m.appendReplacement(buf, Matcher.quoteReplacement(replaceStr)); + } + m.appendTail(buf); + + // these get tallied in processTag + // (remember to reset before subsequent calls to filter method) + final StringBuilder sBuilder = new StringBuilder(buf.toString()); + for (String key : vTagCounts.keySet()) { + for (int ii = 0; ii < vTagCounts.get(key); ii++) { + sBuilder.append(""); + } + } + s = sBuilder.toString(); + + return s; + } + + private String processRemoveBlanks(final String s) { + String result = s; + for (String tag : vRemoveBlanks) { + if (!P_REMOVE_PAIR_BLANKS.containsKey(tag)) { + P_REMOVE_PAIR_BLANKS.putIfAbsent(tag, Pattern.compile("<" + tag + "(\\s[^>]*)?>")); + } + result = regexReplace(P_REMOVE_PAIR_BLANKS.get(tag), "", result); + if (!P_REMOVE_SELF_BLANKS.containsKey(tag)) { + P_REMOVE_SELF_BLANKS.putIfAbsent(tag, Pattern.compile("<" + tag + "(\\s[^>]*)?/>")); + } + result = regexReplace(P_REMOVE_SELF_BLANKS.get(tag), "", result); + } + + return result; + } + + private static String regexReplace(final Pattern regex_pattern, final String replacement, final String s) { + Matcher m = regex_pattern.matcher(s); + return m.replaceAll(replacement); + } + + private String processTag(final String s) { + // ending tags + Matcher m = P_END_TAG.matcher(s); + if (m.find()) { + final String name = m.group(1).toLowerCase(); + if (allowed(name)) { + if (!inArray(name, vSelfClosingTags)) { + if (vTagCounts.containsKey(name)) { + vTagCounts.put(name, vTagCounts.get(name) - 1); + return ""; + } + } + } + } + + // starting tags + m = P_START_TAG.matcher(s); + if (m.find()) { + final String name = m.group(1).toLowerCase(); + final String body = m.group(2); + String ending = m.group(3); + + // debug( "in a starting tag, name='" + name + "'; body='" + body + "'; ending='" + ending + "'" ); + if (allowed(name)) { + final StringBuilder params = new StringBuilder(); + + final Matcher m2 = P_QUOTED_ATTRIBUTES.matcher(body); + final Matcher m3 = P_UNQUOTED_ATTRIBUTES.matcher(body); + final List paramNames = new ArrayList<>(); + final List paramValues = new ArrayList<>(); + while (m2.find()) { + paramNames.add(m2.group(1)); // ([a-z0-9]+) + paramValues.add(m2.group(3)); // (.*?) + } + while (m3.find()) { + paramNames.add(m3.group(1)); // ([a-z0-9]+) + paramValues.add(m3.group(3)); // ([^\"\\s']+) + } + + String paramName, paramValue; + for (int ii = 0; ii < paramNames.size(); ii++) { + paramName = paramNames.get(ii).toLowerCase(); + paramValue = paramValues.get(ii); + + // debug( "paramName='" + paramName + "'" ); + // debug( "paramValue='" + paramValue + "'" ); + // debug( "allowed? " + vAllowed.get( name ).contains( paramName ) ); + + if (allowedAttribute(name, paramName)) { + if (inArray(paramName, vProtocolAtts)) { + paramValue = processParamProtocol(paramValue); + } + params.append(' ').append(paramName).append("=\\\"").append(paramValue).append("\""); + } + } + + if (inArray(name, vSelfClosingTags)) { + ending = " /"; + } + + if (inArray(name, vNeedClosingTags)) { + ending = ""; + } + + if (ending == null || ending.length() < 1) { + if (vTagCounts.containsKey(name)) { + vTagCounts.put(name, vTagCounts.get(name) + 1); + } else { + vTagCounts.put(name, 1); + } + } else { + ending = " /"; + } + return "<" + name + params + ending + ">"; + } else { + return ""; + } + } + + // comments + m = P_COMMENT.matcher(s); + if (!stripComment && m.find()) { + return "<" + m.group() + ">"; + } + + return ""; + } + + private String processParamProtocol(String s) { + s = decodeEntities(s); + final Matcher m = P_PROTOCOL.matcher(s); + if (m.find()) { + final String protocol = m.group(1); + if (!inArray(protocol, vAllowedProtocols)) { + // bad protocol, turn into local anchor link instead + s = "#" + s.substring(protocol.length() + 1); + if (s.startsWith("#//")) { + s = "#" + s.substring(3); + } + } + } + + return s; + } + + private String decodeEntities(String s) { + StringBuffer buf = new StringBuffer(); + + Matcher m = P_ENTITY.matcher(s); + while (m.find()) { + final String match = m.group(1); + final int decimal = Integer.decode(match); + m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal))); + } + m.appendTail(buf); + s = buf.toString(); + + buf = new StringBuffer(); + m = P_ENTITY_UNICODE.matcher(s); + while (m.find()) { + final String match = m.group(1); + final int decimal = Integer.valueOf(match, 16); + m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal))); + } + m.appendTail(buf); + s = buf.toString(); + + buf = new StringBuffer(); + m = P_ENCODE.matcher(s); + while (m.find()) { + final String match = m.group(1); + final int decimal = Integer.valueOf(match, 16); + m.appendReplacement(buf, Matcher.quoteReplacement(chr(decimal))); + } + m.appendTail(buf); + s = buf.toString(); + + s = validateEntities(s); + return s; + } + + private String validateEntities(final String s) { + StringBuffer buf = new StringBuffer(); + + // validate entities throughout the string + Matcher m = P_VALID_ENTITIES.matcher(s); + while (m.find()) { + final String one = m.group(1); // ([^&;]*) + final String two = m.group(2); // (?=(;|&|$)) + m.appendReplacement(buf, Matcher.quoteReplacement(checkEntity(one, two))); + } + m.appendTail(buf); + + return encodeQuotes(buf.toString()); + } + + private String encodeQuotes(final String s) { + if (encodeQuotes) { + StringBuffer buf = new StringBuffer(); + Matcher m = P_VALID_QUOTES.matcher(s); + while (m.find()) { + final String one = m.group(1); // (>|^) + final String two = m.group(2); // ([^<]+?) + final String three = m.group(3); // (<|$) + // 不替换双引号为",防止json格式无效 regexReplace(P_QUOTE, """, two) + m.appendReplacement(buf, Matcher.quoteReplacement(one + two + three)); + } + m.appendTail(buf); + return buf.toString(); + } else { + return s; + } + } + + private String checkEntity(final String preamble, final String term) { + + return ";".equals(term) && isValidEntity(preamble) ? '&' + preamble : "&" + preamble; + } + + private boolean isValidEntity(final String entity) { + return inArray(entity, vAllowedEntities); + } + + private static boolean inArray(final String s, final String[] array) { + for (String item : array) { + if (item != null && item.equals(s)) { + return true; + } + } + return false; + } + + private boolean allowed(final String name) { + return (vAllowed.isEmpty() || vAllowed.containsKey(name)) && !inArray(name, vDisallowed); + } + + private boolean allowedAttribute(final String name, final String paramName) { + return allowed(name) && (vAllowed.isEmpty() || vAllowed.get(name).contains(paramName)); + } +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/utils/http/HttpHelper.java b/Cpop-Core/src/main/java/com/cpop/core/utils/http/HttpHelper.java new file mode 100644 index 0000000..c9120ae --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/utils/http/HttpHelper.java @@ -0,0 +1,51 @@ +package com.cpop.core.utils.http; + +import jakarta.servlet.ServletRequest; +import org.apache.commons.lang3.exception.ExceptionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.nio.charset.StandardCharsets; + +/** + * 通用http工具封装 + * + * @author DB + */ +public class HttpHelper { + private static final Logger LOGGER = LoggerFactory.getLogger(HttpHelper.class); + + /** + * 获取请求体信息失败 + * @author DB + * @since 2024/2/1 + * @param request 请求 + * @return String + */ + public static String getBodyString(ServletRequest request) { + StringBuilder sb = new StringBuilder(); + BufferedReader reader = null; + try (InputStream inputStream = request.getInputStream()) { + reader = new BufferedReader(new InputStreamReader(inputStream, StandardCharsets.UTF_8)); + String line = ""; + while ((line = reader.readLine()) != null) { + sb.append(line); + } + } catch (IOException e) { + LOGGER.warn("getBodyString出现问题!"); + } finally { + if (reader != null) { + try { + reader.close(); + } catch (IOException e) { + LOGGER.error(ExceptionUtils.getMessage(e)); + } + } + } + return sb.toString(); + } +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/utils/http/HttpUtils.java b/Cpop-Core/src/main/java/com/cpop/core/utils/http/HttpUtils.java new file mode 100644 index 0000000..e2ff52d --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/utils/http/HttpUtils.java @@ -0,0 +1,376 @@ +package com.cpop.core.utils.http; + +import com.cpop.core.constant.Constants; +import com.cpop.core.utils.StringUtils; +import okhttp3.*; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import javax.net.ssl.*; +import java.io.*; +import java.net.*; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.security.cert.X509Certificate; +import java.util.HashMap; +import java.util.Map; + +/** + * 通用http发送方法 + * + * @author DB + */ +public class HttpUtils { + private static final Logger log = LoggerFactory.getLogger(HttpUtils.class); + + /** + * 向指定 URL 发送GET方法的请求 + * + * @param url 发送请求的 URL + * @return 所代表远程资源的响应结果 + */ + public static String sendGet(String url) { + return sendGet(url, StringUtils.EMPTY); + } + + /** + * 向指定 URL 发送GET方法的请求 + * + * @param url 发送请求的 URL + * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 + * @return 所代表远程资源的响应结果 + */ + public static String sendGet(String url, String param) { + return sendGet(url, param, Constants.UTF8); + } + + /** + * 向指定 URL 发送GET方法的请求 + * + * @param url 发送请求的 URL + * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 + * @param contentType 编码类型 + * @return 所代表远程资源的响应结果 + */ + public static String sendGet(String url, String param, String contentType) { + StringBuilder result = new StringBuilder(); + BufferedReader in = null; + try { + String urlNameString = StringUtils.isNotBlank(param) ? url + "?" + param : url; + log.info("sendGet - {}", urlNameString); + URL realUrl = new URL(urlNameString); + URLConnection connection = realUrl.openConnection(); + connection.setRequestProperty("accept", "*/*"); + connection.setRequestProperty("connection", "Keep-Alive"); + connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + connection.connect(); + in = new BufferedReader(new InputStreamReader(connection.getInputStream(), contentType)); + String line; + while ((line = in.readLine()) != null) { + result.append(line); + } + log.info("recv - {}", result); + } catch (ConnectException e) { + log.error("调用HttpUtils.sendGet ConnectException, url=" + url + ",param=" + param, e); + } catch (SocketTimeoutException e) { + log.error("调用HttpUtils.sendGet SocketTimeoutException, url=" + url + ",param=" + param, e); + } catch (IOException e) { + log.error("调用HttpUtils.sendGet IOException, url=" + url + ",param=" + param, e); + } catch (Exception e) { + log.error("调用HttpsUtil.sendGet Exception, url=" + url + ",param=" + param, e); + } finally { + try { + if (in != null) { + in.close(); + } + } catch (Exception ex) { + log.error("调用in.close Exception, url=" + url + ",param=" + param, ex); + } + } + return result.toString(); + } + + /** + * 向指定 URL 发送POST方法的请求 + * + * @param url 发送请求的 URL + * @return 所代表远程资源的响应结果 + */ + public static String sendPost(String url) { + BufferedReader in = null; + StringBuilder result = new StringBuilder(); + try { + log.info("sendPost - {}", url); + URL realUrl = new URL(url); + URLConnection conn = realUrl.openConnection(); + conn.setRequestProperty("accept", "*/*"); + conn.setRequestProperty("connection", "Keep-Alive"); + conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + conn.setRequestProperty("Accept-Charset", "utf-8"); + conn.setRequestProperty("contentType", "utf-8"); + conn.setDoOutput(true); + conn.setDoInput(true); + in = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8)); + String line; + while ((line = in.readLine()) != null) { + result.append(line); + } + log.info("rev - {}", result); + } catch (ConnectException e) { + log.error("调用HttpUtils.sendPost ConnectException, url=" + url, e); + } catch (SocketTimeoutException e) { + log.error("调用HttpUtils.sendPost SocketTimeoutException, url=" + url, e); + } catch (IOException e) { + log.error("调用HttpUtils.sendPost IOException, url=" + url, e); + } catch (Exception e) { + log.error("调用HttpsUtil.sendPost Exception, url=" + url, e); + } finally { + try { + if (in != null) { + in.close(); + } + } catch (IOException ex) { + log.error("调用in.close Exception, url=" + url, ex); + } + } + return result.toString(); + } + + /** + * 向指定 URL 发送POST方法的请求 + * + * @param url 发送请求的 URL + * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 + * @return 所代表远程资源的响应结果 + */ + public static String sendPost(String url, String param) { + PrintWriter out = null; + BufferedReader in = null; + StringBuilder result = new StringBuilder(); + try { + log.info("sendPost - {}", url); + URL realUrl = new URL(url); + URLConnection conn = realUrl.openConnection(); + conn.setRequestProperty("accept", "*/*"); + conn.setRequestProperty("connection", "Keep-Alive"); + conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + conn.setRequestProperty("Accept-Charset", "utf-8"); + conn.setRequestProperty("contentType", "utf-8"); + conn.setDoOutput(true); + conn.setDoInput(true); + out = new PrintWriter(conn.getOutputStream()); + out.print(param); + out.flush(); + in = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8)); + String line; + while ((line = in.readLine()) != null) { + result.append(line); + } + log.info("recv - {}", result); + } catch (ConnectException e) { + log.error("调用HttpUtils.sendPost ConnectException, url=" + url + ",param=" + param, e); + } catch (SocketTimeoutException e) { + log.error("调用HttpUtils.sendPost SocketTimeoutException, url=" + url + ",param=" + param, e); + } catch (IOException e) { + log.error("调用HttpUtils.sendPost IOException, url=" + url + ",param=" + param, e); + } catch (Exception e) { + log.error("调用HttpsUtil.sendPost Exception, url=" + url + ",param=" + param, e); + } finally { + try { + if (out != null) { + out.close(); + } + if (in != null) { + in.close(); + } + } catch (IOException ex) { + log.error("调用in.close Exception, url=" + url + ",param=" + param, ex); + } + } + return result.toString(); + } + + /** + * 向指定 URL 发送POST方法的请求 + * + * @param url 发送请求的 URL + * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 + * @return 所代表远程资源的响应结果 + */ + public static String sendPost(String url, String param, File file) throws IOException { + URL urlObj = new URL(url); + //连接 + HttpURLConnection con = (HttpURLConnection) urlObj.openConnection(); + String result = null; + con.setDoInput(true); + con.setDoOutput(true); + // post方式不能使用缓存 + con.setUseCaches(false); + // 设置请求头信息 + con.setRequestProperty("Connection", "Keep-Alive"); + con.setRequestProperty("Charset", "UTF-8"); + // 设置边界 + String BOUNDARY = "----------" + System.currentTimeMillis(); + con.setRequestProperty("Content-Type", + "multipart/form-data; boundary=" + + BOUNDARY); + // 请求正文信息 + // 第一部分: + StringBuilder sb = new StringBuilder(); + // 必须多两道线 + sb.append("--"); + sb.append(BOUNDARY); + sb.append("\r\n"); + sb.append("Content-Disposition: form-data;name=\"media\";filelength=\"").append(file.length()).append("\";filename=\"").append(file.getName()).append("\"\r\n"); + sb.append("Content-Type:application/octet-stream\r\n\r\n"); + byte[] head = sb.toString().getBytes(StandardCharsets.UTF_8); + // 获得输出流 + OutputStream out = new DataOutputStream(con.getOutputStream()); + // 输出表头 + out.write(head); + // 文件正文部分 + // 把文件已流文件的方式 推入到url中 + DataInputStream in = new DataInputStream(Files.newInputStream(file.toPath())); + int bytes = 0; + byte[] bufferOut = new byte[1024]; + while ((bytes = in.read(bufferOut)) != -1) { + out.write(bufferOut, 0, bytes); + } + in.close(); + // 结尾部分 + // 定义最后数据分隔线 + byte[] foot = ("\r\n--" + BOUNDARY + "--\r\n").getBytes(StandardCharsets.UTF_8); + out.write(foot); + out.flush(); + out.close(); + StringBuilder buffer = new StringBuilder(); + try (BufferedReader reader = new BufferedReader(new InputStreamReader(con.getInputStream()))) { + // 定义BufferedReader输入流来读取URL的响应 + String line = null; + while ((line = reader.readLine()) != null) { + buffer.append(line); + } + result = buffer.toString(); + } catch (IOException e) { + System.out.println("发送POST请求出现异常!" + e); + e.printStackTrace(); + } + return result; + } + + public static String sendSSLPost(String url, String param) { + StringBuilder result = new StringBuilder(); + String urlNameString = url + "?" + param; + try { + log.info("sendSSLPost - {}", urlNameString); + SSLContext sc = SSLContext.getInstance("SSL"); + sc.init(null, new TrustManager[]{new TrustAnyTrustManager()}, new java.security.SecureRandom()); + URL console = new URL(urlNameString); + HttpsURLConnection conn = (HttpsURLConnection) console.openConnection(); + conn.setRequestProperty("accept", "*/*"); + conn.setRequestProperty("connection", "Keep-Alive"); + conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)"); + conn.setRequestProperty("Accept-Charset", "utf-8"); + conn.setRequestProperty("contentType", "utf-8"); + conn.setDoOutput(true); + conn.setDoInput(true); + + conn.setSSLSocketFactory(sc.getSocketFactory()); + conn.setHostnameVerifier(new TrustAnyHostnameVerifier()); + conn.connect(); + InputStream is = conn.getInputStream(); + BufferedReader br = new BufferedReader(new InputStreamReader(is)); + String ret = ""; + while ((ret = br.readLine()) != null) { + if (!"".equals(ret.trim())) { + result.append(new String(ret.getBytes(StandardCharsets.ISO_8859_1), StandardCharsets.UTF_8)); + } + } + log.info("recv - {}", result); + conn.disconnect(); + br.close(); + } catch (ConnectException e) { + log.error("调用HttpUtils.sendSSLPost ConnectException, url=" + url + ",param=" + param, e); + } catch (SocketTimeoutException e) { + log.error("调用HttpUtils.sendSSLPost SocketTimeoutException, url=" + url + ",param=" + param, e); + } catch (IOException e) { + log.error("调用HttpUtils.sendSSLPost IOException, url=" + url + ",param=" + param, e); + } catch (Exception e) { + log.error("调用HttpsUtil.sendSSLPost Exception, url=" + url + ",param=" + param, e); + } + return result.toString(); + } + + private static class TrustAnyTrustManager implements X509TrustManager { + @Override + public void checkClientTrusted(X509Certificate[] chain, String authType) { + } + + @Override + public void checkServerTrusted(X509Certificate[] chain, String authType) { + } + + @Override + public X509Certificate[] getAcceptedIssuers() { + return new X509Certificate[]{}; + } + } + + private static class TrustAnyHostnameVerifier implements HostnameVerifier { + @Override + public boolean verify(String hostname, SSLSession session) { + return true; + } + } + + /** + * 获取请求路径参数 + * @param url 请求路径 + */ + public static Map getQueryParams(String url) { + try { + Map params = new HashMap(); + for (String param : url.split("&")) { + String[] pair = param.split("="); + String key = URLDecoder.decode(pair[0], "UTF-8"); + String value = ""; + if (pair.length > 1) { + value = URLDecoder.decode(pair[1], "UTF-8"); + } + params.put(key, value); + } + return params; + } catch (UnsupportedEncodingException ex) { + throw new AssertionError(ex); + } + } + + /** + * okhttpPost请求 + * @param url 地址 + * @param jsonBody 请求体 + */ + public static Response sendOkHttpPost(String url,String jsonBody) throws IOException { + OkHttpClient client = new OkHttpClient().newBuilder().build(); + MediaType mediaType = MediaType.Companion.parse("application/json;charset=utf-8"); + RequestBody body = RequestBody.Companion.create(jsonBody, mediaType); + Request request = new Request + .Builder() + .url(url) + .post(body) + .addHeader("Content-Type", "application/json") + .build(); + return client.newCall(request).execute(); + } + + /** + * okhttpGet请求 + * @param url 地址 + */ + public static Response sendOkHttpGet(String url) throws IOException { + OkHttpClient client = new OkHttpClient().newBuilder().build(); + Request request = new Request.Builder().url(url).get().build(); + return client.newCall(request).execute(); + } + +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/utils/ip/AddressUtils.java b/Cpop-Core/src/main/java/com/cpop/core/utils/ip/AddressUtils.java new file mode 100644 index 0000000..581490c --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/utils/ip/AddressUtils.java @@ -0,0 +1,50 @@ +package com.cpop.core.utils.ip; + +import com.alibaba.fastjson2.JSONObject; +import com.cpop.core.constant.Constants; +import com.cpop.core.utils.StringUtils; +import com.cpop.core.utils.http.HttpUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; + +/** + * 获取地址类 + * + * @author DB + */ +public class AddressUtils { + private static final Logger log = LoggerFactory.getLogger(AddressUtils.class); + + // IP地址查询 + public static final String IP_URL = "http://whois.pconline.com.cn/ipJson.jsp"; + + @Value("${jambox.address-enabled}") + private static Boolean isAddressEnabled; + + // 未知地址 + public static final String UN_KNOW = "XX XX"; + + public static String getRealAddressByIp(String ip) { + // 内网不查询 + if (IpUtils.internalIp(ip)) { + return "内网IP"; + } + if (isAddressEnabled) { + try { + String rspStr = HttpUtils.sendGet(IP_URL, "ip=" + ip + "&json=true", Constants.GBK); + if (StringUtils.isEmpty(rspStr)) { + log.error("获取地理位置异常 {}", ip); + return UN_KNOW; + } + JSONObject obj = JSONObject.parseObject(rspStr); + String region = obj.getString("pro"); + String city = obj.getString("city"); + return String.format("%s %s", region, city); + } catch (Exception e) { + log.error("获取地理位置异常 {}", ip); + } + } + return UN_KNOW; + } +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/utils/ip/IpUtils.java b/Cpop-Core/src/main/java/com/cpop/core/utils/ip/IpUtils.java new file mode 100644 index 0000000..bbb261e --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/utils/ip/IpUtils.java @@ -0,0 +1,196 @@ +package com.cpop.core.utils.ip; + +import com.cpop.core.utils.StringUtils; +import com.cpop.core.utils.html.EscapeUtil; +import jakarta.servlet.http.HttpServletRequest; + +import java.net.InetAddress; +import java.net.UnknownHostException; + +/** + * 获取IP方法 + * + * @author DB + */ +public class IpUtils +{ + public static String getIpAddr(HttpServletRequest request) + { + if (request == null) + { + return "unknown"; + } + String ip = request.getHeader("x-forwarded-for"); + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) + { + ip = request.getHeader("Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) + { + ip = request.getHeader("X-Forwarded-For"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) + { + ip = request.getHeader("WL-Proxy-Client-IP"); + } + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) + { + ip = request.getHeader("X-Real-IP"); + } + + if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) + { + ip = request.getRemoteAddr(); + } + return "0:0:0:0:0:0:0:1".equals(ip) ? "127.0.0.1" : EscapeUtil.clean(ip); + } + + public static boolean internalIp(String ip) + { + byte[] addr = textToNumericFormatV4(ip); + return internalIp(addr) || "127.0.0.1".equals(ip); + } + + private static boolean internalIp(byte[] addr) + { + if (StringUtils.isNull(addr) || addr.length < 2) + { + return true; + } + final byte b0 = addr[0]; + final byte b1 = addr[1]; + // 10.x.x.x/8 + final byte SECTION_1 = 0x0A; + // 172.16.x.x/12 + final byte SECTION_2 = (byte) 0xAC; + final byte SECTION_3 = (byte) 0x10; + final byte SECTION_4 = (byte) 0x1F; + // 192.168.x.x/16 + final byte SECTION_5 = (byte) 0xC0; + final byte SECTION_6 = (byte) 0xA8; + switch (b0) + { + case SECTION_1: + return true; + case SECTION_2: + if (b1 >= SECTION_3 && b1 <= SECTION_4) + { + return true; + } + case SECTION_5: + switch (b1) + { + case SECTION_6: + return true; + } + default: + return false; + } + } + + /** + * 将IPv4地址转换成字节 + * + * @param text IPv4地址 + * @return byte 字节 + */ + public static byte[] textToNumericFormatV4(String text) + { + if (text.length() == 0) + { + return null; + } + + byte[] bytes = new byte[4]; + String[] elements = text.split("\\.", -1); + try + { + long l; + int i; + switch (elements.length) + { + case 1: + l = Long.parseLong(elements[0]); + if ((l < 0L) || (l > 4294967295L)) { + return null; + } + bytes[0] = (byte) (int) (l >> 24 & 0xFF); + bytes[1] = (byte) (int) ((l & 0xFFFFFF) >> 16 & 0xFF); + bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF); + bytes[3] = (byte) (int) (l & 0xFF); + break; + case 2: + l = Integer.parseInt(elements[0]); + if ((l < 0L) || (l > 255L)) { + return null; + } + bytes[0] = (byte) (int) (l & 0xFF); + l = Integer.parseInt(elements[1]); + if ((l < 0L) || (l > 16777215L)) { + return null; + } + bytes[1] = (byte) (int) (l >> 16 & 0xFF); + bytes[2] = (byte) (int) ((l & 0xFFFF) >> 8 & 0xFF); + bytes[3] = (byte) (int) (l & 0xFF); + break; + case 3: + for (i = 0; i < 2; ++i) + { + l = Integer.parseInt(elements[i]); + if ((l < 0L) || (l > 255L)) { + return null; + } + bytes[i] = (byte) (int) (l & 0xFF); + } + l = Integer.parseInt(elements[2]); + if ((l < 0L) || (l > 65535L)) { + return null; + } + bytes[2] = (byte) (int) (l >> 8 & 0xFF); + bytes[3] = (byte) (int) (l & 0xFF); + break; + case 4: + for (i = 0; i < 4; ++i) + { + l = Integer.parseInt(elements[i]); + if ((l < 0L) || (l > 255L)) { + return null; + } + bytes[i] = (byte) (int) (l & 0xFF); + } + break; + default: + return null; + } + } + catch (NumberFormatException e) + { + return null; + } + return bytes; + } + + public static String getHostIp() + { + try + { + return InetAddress.getLocalHost().getHostAddress(); + } + catch (UnknownHostException e) + { + } + return "127.0.0.1"; + } + + public static String getHostName() + { + try + { + return InetAddress.getLocalHost().getHostName(); + } + catch (UnknownHostException e) + { + } + return "未知"; + } +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/utils/text/CharsetKit.java b/Cpop-Core/src/main/java/com/cpop/core/utils/text/CharsetKit.java new file mode 100644 index 0000000..588ad61 --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/utils/text/CharsetKit.java @@ -0,0 +1,91 @@ +package com.cpop.core.utils.text; + +import com.cpop.core.utils.StringUtils; + +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; + +/** + * 字符集工具类 + * + * @author DB + */ +public class CharsetKit { + /** + * ISO-8859-1 + */ + public static final String ISO_8859_1 = "ISO-8859-1"; + /** + * UTF-8 + */ + public static final String UTF_8 = "UTF-8"; + /** + * GBK + */ + public static final String GBK = "GBK"; + + /** + * ISO-8859-1 + */ + public static final Charset CHARSET_ISO_8859_1 = StandardCharsets.ISO_8859_1; + /** + * UTF-8 + */ + public static final Charset CHARSET_UTF_8 = StandardCharsets.UTF_8; + /** + * GBK + */ + public static final Charset CHARSET_GBK = Charset.forName(GBK); + + /** + * 转换为Charset对象 + * + * @param charset 字符集,为空则返回默认字符集 + * @return Charset + */ + public static Charset charset(String charset) { + return StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset); + } + + /** + * 转换字符串的字符集编码 + * + * @param source 字符串 + * @param srcCharset 源字符集,默认ISO-8859-1 + * @param destCharset 目标字符集,默认UTF-8 + * @return 转换后的字符集 + */ + public static String convert(String source, String srcCharset, String destCharset) { + return convert(source, Charset.forName(srcCharset), Charset.forName(destCharset)); + } + + /** + * 转换字符串的字符集编码 + * + * @param source 字符串 + * @param srcCharset 源字符集,默认ISO-8859-1 + * @param destCharset 目标字符集,默认UTF-8 + * @return 转换后的字符集 + */ + public static String convert(String source, Charset srcCharset, Charset destCharset) { + if (null == srcCharset) { + srcCharset = StandardCharsets.ISO_8859_1; + } + + if (null == destCharset) { + destCharset = StandardCharsets.UTF_8; + } + + if (StringUtils.isEmpty(source) || srcCharset.equals(destCharset)) { + return source; + } + return new String(source.getBytes(srcCharset), destCharset); + } + + /** + * @return 系统字符集编码 + */ + public static String systemCharset() { + return Charset.defaultCharset().name(); + } +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/utils/text/Convert.java b/Cpop-Core/src/main/java/com/cpop/core/utils/text/Convert.java new file mode 100644 index 0000000..fe41375 --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/utils/text/Convert.java @@ -0,0 +1,854 @@ +package com.cpop.core.utils.text; + +import com.cpop.core.utils.StringUtils; +import org.apache.commons.lang3.ArrayUtils; + +import java.math.BigDecimal; +import java.math.BigInteger; +import java.nio.ByteBuffer; +import java.nio.charset.Charset; +import java.text.NumberFormat; +import java.util.Set; + +/** + * 类型转换器 + * + * @author DB + */ +public class Convert { + /** + * 转换为字符串
+ * 如果给定的值为null,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static String toStr(Object value, String defaultValue) { + if (null == value) { + return defaultValue; + } + if (value instanceof String) { + return (String) value; + } + return value.toString(); + } + + /** + * 转换为字符串
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static String toStr(Object value) { + return toStr(value, null); + } + + /** + * 转换为字符
+ * 如果给定的值为null,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Character toChar(Object value, Character defaultValue) { + if (null == value) { + return defaultValue; + } + if (value instanceof Character) { + return (Character) value; + } + + final String valueStr = toStr(value, null); + return StringUtils.isEmpty(valueStr) ? defaultValue : valueStr.charAt(0); + } + + /** + * 转换为字符
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Character toChar(Object value) { + return toChar(value, null); + } + + /** + * 转换为byte
+ * 如果给定的值为null,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Byte toByte(Object value, Byte defaultValue) { + if (value == null) { + return defaultValue; + } + if (value instanceof Byte) { + return (Byte) value; + } + if (value instanceof Number) { + return ((Number) value).byteValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) { + return defaultValue; + } + try { + return Byte.parseByte(valueStr); + } catch (Exception e) { + return defaultValue; + } + } + + /** + * 转换为byte
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Byte toByte(Object value) { + return toByte(value, null); + } + + /** + * 转换为Short
+ * 如果给定的值为null,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Short toShort(Object value, Short defaultValue) { + if (value == null) { + return defaultValue; + } + if (value instanceof Short) { + return (Short) value; + } + if (value instanceof Number) { + return ((Number) value).shortValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) { + return defaultValue; + } + try { + return Short.parseShort(valueStr.trim()); + } catch (Exception e) { + return defaultValue; + } + } + + /** + * 转换为Short
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Short toShort(Object value) { + return toShort(value, null); + } + + /** + * 转换为Number
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Number toNumber(Object value, Number defaultValue) { + if (value == null) { + return defaultValue; + } + if (value instanceof Number) { + return (Number) value; + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) { + return defaultValue; + } + try { + return NumberFormat.getInstance().parse(valueStr); + } catch (Exception e) { + return defaultValue; + } + } + + /** + * 转换为Number
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Number toNumber(Object value) { + return toNumber(value, null); + } + + /** + * 转换为int
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Integer toInt(Object value, Integer defaultValue) { + if (value == null) { + return defaultValue; + } + if (value instanceof Integer) { + return (Integer) value; + } + if (value instanceof Number) { + return ((Number) value).intValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) { + return defaultValue; + } + try { + return Integer.parseInt(valueStr.trim()); + } catch (Exception e) { + return defaultValue; + } + } + + /** + * 转换为int
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Integer toInt(Object value) { + return toInt(value, null); + } + + /** + * 转换为Integer数组
+ * + * @param str 被转换的值 + * @return 结果 + */ + public static Integer[] toIntArray(String str) { + return toIntArray(",", str); + } + + /** + * 转换为Long数组
+ * + * @param str 被转换的值 + * @return 结果 + */ + public static Long[] toLongArray(String str) { + return toLongArray(",", str); + } + + /** + * 转换为Integer数组
+ * + * @param split 分隔符 + * @param split 被转换的值 + * @return 结果 + */ + public static Integer[] toIntArray(String split, String str) { + if (StringUtils.isEmpty(str)) { + return new Integer[]{}; + } + String[] arr = str.split(split); + final Integer[] ints = new Integer[arr.length]; + for (int i = 0; i < arr.length; i++) { + final Integer v = toInt(arr[i], 0); + ints[i] = v; + } + return ints; + } + + /** + * 转换为Long数组
+ * + * @param split 分隔符 + * @param str 被转换的值 + * @return 结果 + */ + public static Long[] toLongArray(String split, String str) { + if (StringUtils.isEmpty(str)) { + return new Long[]{}; + } + String[] arr = str.split(split); + final Long[] longs = new Long[arr.length]; + for (int i = 0; i < arr.length; i++) { + final Long v = toLong(arr[i], null); + longs[i] = v; + } + return longs; + } + + /** + * 转换为String数组
+ * + * @param str 被转换的值 + * @return 结果 + */ + public static String[] toStrArray(String str) { + return toStrArray(",", str); + } + + /** + * 转换为String数组
+ * + * @param split 分隔符 + * @param split 被转换的值 + * @return 结果 + */ + public static String[] toStrArray(String split, String str) { + return str.split(split); + } + + /** + * 转换为long
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Long toLong(Object value, Long defaultValue) { + if (value == null) { + return defaultValue; + } + if (value instanceof Long) { + return (Long) value; + } + if (value instanceof Number) { + return ((Number) value).longValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) { + return defaultValue; + } + try { + // 支持科学计数法 + return new BigDecimal(valueStr.trim()).longValue(); + } catch (Exception e) { + return defaultValue; + } + } + + /** + * 转换为long
+ * 如果给定的值为null,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Long toLong(Object value) { + return toLong(value, null); + } + + /** + * 转换为double
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Double toDouble(Object value, Double defaultValue) { + if (value == null) { + return defaultValue; + } + if (value instanceof Double) { + return (Double) value; + } + if (value instanceof Number) { + return ((Number) value).doubleValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) { + return defaultValue; + } + try { + // 支持科学计数法 + return new BigDecimal(valueStr.trim()).doubleValue(); + } catch (Exception e) { + return defaultValue; + } + } + + /** + * 转换为double
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Double toDouble(Object value) { + return toDouble(value, null); + } + + /** + * 转换为Float
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Float toFloat(Object value, Float defaultValue) { + if (value == null) { + return defaultValue; + } + if (value instanceof Float) { + return (Float) value; + } + if (value instanceof Number) { + return ((Number) value).floatValue(); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) { + return defaultValue; + } + try { + return Float.parseFloat(valueStr.trim()); + } catch (Exception e) { + return defaultValue; + } + } + + /** + * 转换为Float
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Float toFloat(Object value) { + return toFloat(value, null); + } + + /** + * 转换为boolean
+ * String支持的值为:true、false、yes、ok、no,1,0 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static Boolean toBool(Object value, Boolean defaultValue) { + if (value == null) { + return defaultValue; + } + if (value instanceof Boolean) { + return (Boolean) value; + } + String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) { + return defaultValue; + } + valueStr = valueStr.trim().toLowerCase(); + switch (valueStr) { + case "true": + return true; + case "false": + return false; + case "yes": + return true; + case "ok": + return true; + case "no": + return false; + case "1": + return true; + case "0": + return false; + default: + return defaultValue; + } + } + + /** + * 转换为boolean
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static Boolean toBool(Object value) { + return toBool(value, null); + } + + /** + * 转换为Enum对象
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * + * @param clazz Enum的Class + * @param value 值 + * @param defaultValue 默认值 + * @return Enum + */ + public static > E toEnum(Class clazz, Object value, E defaultValue) { + if (value == null) { + return defaultValue; + } + if (clazz.isAssignableFrom(value.getClass())) { + @SuppressWarnings("unchecked") + E myE = (E) value; + return myE; + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) { + return defaultValue; + } + try { + return Enum.valueOf(clazz, valueStr); + } catch (Exception e) { + return defaultValue; + } + } + + /** + * 转换为Enum对象
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * + * @param clazz Enum的Class + * @param value 值 + * @return Enum + */ + public static > E toEnum(Class clazz, Object value) { + return toEnum(clazz, value, null); + } + + /** + * 转换为BigInteger
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static BigInteger toBigInteger(Object value, BigInteger defaultValue) { + if (value == null) { + return defaultValue; + } + if (value instanceof BigInteger) { + return (BigInteger) value; + } + if (value instanceof Long) { + return BigInteger.valueOf((Long) value); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) { + return defaultValue; + } + try { + return new BigInteger(valueStr); + } catch (Exception e) { + return defaultValue; + } + } + + /** + * 转换为BigInteger
+ * 如果给定的值为空,或者转换失败,返回默认值null
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static BigInteger toBigInteger(Object value) { + return toBigInteger(value, null); + } + + /** + * 转换为BigDecimal
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @param defaultValue 转换错误时的默认值 + * @return 结果 + */ + public static BigDecimal toBigDecimal(Object value, BigDecimal defaultValue) { + if (value == null) { + return defaultValue; + } + if (value instanceof BigDecimal) { + return (BigDecimal) value; + } + if (value instanceof Long) { + return new BigDecimal((Long) value); + } + if (value instanceof Double) { + return new BigDecimal((Double) value); + } + if (value instanceof Integer) { + return new BigDecimal((Integer) value); + } + final String valueStr = toStr(value, null); + if (StringUtils.isEmpty(valueStr)) { + return defaultValue; + } + try { + return new BigDecimal(valueStr); + } catch (Exception e) { + return defaultValue; + } + } + + /** + * 转换为BigDecimal
+ * 如果给定的值为空,或者转换失败,返回默认值
+ * 转换失败不会报错 + * + * @param value 被转换的值 + * @return 结果 + */ + public static BigDecimal toBigDecimal(Object value) { + return toBigDecimal(value, null); + } + + /** + * 将对象转为字符串
+ * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 + * + * @param obj 对象 + * @return 字符串 + */ + public static String utf8Str(Object obj) { + return str(obj, CharsetKit.CHARSET_UTF_8); + } + + /** + * 将对象转为字符串
+ * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 + * + * @param obj 对象 + * @param charsetName 字符集 + * @return 字符串 + */ + public static String str(Object obj, String charsetName) { + return str(obj, Charset.forName(charsetName)); + } + + /** + * 将对象转为字符串
+ * 1、Byte数组和ByteBuffer会被转换为对应字符串的数组 2、对象数组会调用Arrays.toString方法 + * + * @param obj 对象 + * @param charset 字符集 + * @return 字符串 + */ + public static String str(Object obj, Charset charset) { + if (null == obj) { + return null; + } + + if (obj instanceof String) { + return (String) obj; + } else if (obj instanceof byte[]) { + return str((byte[]) obj, charset); + } else if (obj instanceof Byte[]) { + byte[] bytes = ArrayUtils.toPrimitive((Byte[]) obj); + return str(bytes, charset); + } else if (obj instanceof ByteBuffer) { + return str((ByteBuffer) obj, charset); + } + return obj.toString(); + } + + /** + * 将byte数组转为字符串 + * + * @param bytes byte数组 + * @param charset 字符集 + * @return 字符串 + */ + public static String str(byte[] bytes, String charset) { + return str(bytes, StringUtils.isEmpty(charset) ? Charset.defaultCharset() : Charset.forName(charset)); + } + + /** + * 解码字节码 + * + * @param data 字符串 + * @param charset 字符集,如果此字段为空,则解码的结果取决于平台 + * @return 解码后的字符串 + */ + public static String str(byte[] data, Charset charset) { + if (data == null) { + return null; + } + + if (null == charset) { + return new String(data); + } + return new String(data, charset); + } + + /** + * 将编码的byteBuffer数据转换为字符串 + * + * @param data 数据 + * @param charset 字符集,如果为空使用当前系统字符集 + * @return 字符串 + */ + public static String str(ByteBuffer data, String charset) { + if (data == null) { + return null; + } + + return str(data, Charset.forName(charset)); + } + + /** + * 将编码的byteBuffer数据转换为字符串 + * + * @param data 数据 + * @param charset 字符集,如果为空使用当前系统字符集 + * @return 字符串 + */ + public static String str(ByteBuffer data, Charset charset) { + if (null == charset) { + charset = Charset.defaultCharset(); + } + return charset.decode(data).toString(); + } + + // ----------------------------------------------------------------------- 全角半角转换 + + /** + * 半角转全角 + * + * @param input String. + * @return 全角字符串. + */ + public static String toSBC(String input) { + return toSBC(input, null); + } + + /** + * 半角转全角 + * + * @param input String + * @param notConvertSet 不替换的字符集合 + * @return 全角字符串. + */ + public static String toSBC(String input, Set notConvertSet) { + char c[] = input.toCharArray(); + for (int i = 0; i < c.length; i++) { + if (null != notConvertSet && notConvertSet.contains(c[i])) { + // 跳过不替换的字符 + continue; + } + + if (c[i] == ' ') { + c[i] = '\u3000'; + } else if (c[i] < '\177') { + c[i] = (char) (c[i] + 65248); + + } + } + return new String(c); + } + + /** + * 全角转半角 + * + * @param input String. + * @return 半角字符串 + */ + public static String toDBC(String input) { + return toDBC(input, null); + } + + /** + * 替换全角为半角 + * + * @param text 文本 + * @param notConvertSet 不替换的字符集合 + * @return 替换后的字符 + */ + public static String toDBC(String text, Set notConvertSet) { + char c[] = text.toCharArray(); + for (int i = 0; i < c.length; i++) { + if (null != notConvertSet && notConvertSet.contains(c[i])) { + // 跳过不替换的字符 + continue; + } + + if (c[i] == '\u3000') { + c[i] = ' '; + } else if (c[i] > '\uFF00' && c[i] < '\uFF5F') { + c[i] = (char) (c[i] - 65248); + } + } + String returnString = new String(c); + + return returnString; + } + + /** + * 数字金额大写转换 先写个完整的然后将如零拾替换成零 + * + * @param n 数字 + * @return 中文大写数字 + */ + public static String digitUppercase(double n) { + String[] fraction = {"角", "分"}; + String[] digit = {"零", "壹", "贰", "叁", "肆", "伍", "陆", "柒", "捌", "玖"}; + String[][] unit = {{"元", "万", "亿"}, {"", "拾", "佰", "仟"}}; + + String head = n < 0 ? "负" : ""; + n = Math.abs(n); + + String s = ""; + for (int i = 0; i < fraction.length; i++) { + s += (digit[(int) (Math.floor(n * 10 * Math.pow(10, i)) % 10)] + fraction[i]).replaceAll("(零.)+", ""); + } + if (s.length() < 1) { + s = "整"; + } + int integerPart = (int) Math.floor(n); + + for (int i = 0; i < unit[0].length && integerPart > 0; i++) { + String p = ""; + for (int j = 0; j < unit[1].length && n > 0; j++) { + p = digit[integerPart % 10] + unit[1][j] + p; + integerPart = integerPart / 10; + } + s = p.replaceAll("(零.)*零$", "").replaceAll("^$", "零") + unit[0][i] + s; + } + return head + s.replaceAll("(零.)*零元", "元").replaceFirst("(零.)+", "").replaceAll("(零.)+", "零").replaceAll("^整$", "零元整"); + } +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/utils/text/StrFormatter.java b/Cpop-Core/src/main/java/com/cpop/core/utils/text/StrFormatter.java new file mode 100644 index 0000000..a968e5f --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/utils/text/StrFormatter.java @@ -0,0 +1,77 @@ +package com.cpop.core.utils.text; + +import com.cpop.core.utils.StringUtils; + +/** + * 字符串格式化 + * + * @author DB + */ +public class StrFormatter { + public static final String EMPTY_JSON = "{}"; + public static final char C_BACKSLASH = '\\'; + public static final char C_DELIM_START = '{'; + + public static final char C_DELIM_END = '}'; + + /** + * 格式化字符串
+ * 此方法只是简单将占位符 {} 按照顺序替换为参数
+ * 如果想输出 {} 使用 \\转义 { 即可,如果想输出 {} 之前的 \ 使用双转义符 \\\\ 即可
+ * 例:
+ * 通常使用:format("this is {} for {}", "a", "b") -> this is a for b
+ * 转义{}: format("this is \\{} for {}", "a", "b") -> this is \{} for a
+ * 转义\: format("this is \\\\{} for {}", "a", "b") -> this is \a for b
+ * + * @param strPattern 字符串模板 + * @param argArray 参数列表 + * @return 结果 + */ + public static String format(final String strPattern, final Object... argArray) { + if (StringUtils.isEmpty(strPattern) || StringUtils.isEmpty(argArray)) { + return strPattern; + } + final int strPatternLength = strPattern.length(); + + // 初始化定义好的长度以获得更好的性能 + StringBuilder sbuf = new StringBuilder(strPatternLength + 50); + + int handledPosition = 0; + int delimIndex;// 占位符所在位置 + for (int argIndex = 0; argIndex < argArray.length; argIndex++) { + delimIndex = strPattern.indexOf(EMPTY_JSON, handledPosition); + if (delimIndex == -1) { + if (handledPosition == 0) { + return strPattern; + } else { // 字符串模板剩余部分不再包含占位符,加入剩余部分后返回结果 + sbuf.append(strPattern, handledPosition, strPatternLength); + return sbuf.toString(); + } + } else { + if (delimIndex > 0 && strPattern.charAt(delimIndex - 1) == C_BACKSLASH) { + if (delimIndex > 1 && strPattern.charAt(delimIndex - 2) == C_BACKSLASH) { + // 转义符之前还有一个转义符,占位符依旧有效 + sbuf.append(strPattern, handledPosition, delimIndex - 1); + sbuf.append(Convert.utf8Str(argArray[argIndex])); + handledPosition = delimIndex + 2; + } else { + // 占位符被转义 + argIndex--; + sbuf.append(strPattern, handledPosition, delimIndex - 1); + sbuf.append(C_DELIM_START); + handledPosition = delimIndex + 1; + } + } else { + // 正常占位符 + sbuf.append(strPattern, handledPosition, delimIndex); + sbuf.append(Convert.utf8Str(argArray[argIndex])); + handledPosition = delimIndex + 2; + } + } + } + // 加入最后一个占位符后所有的字符 + sbuf.append(strPattern, handledPosition, strPattern.length()); + + return sbuf.toString(); + } +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/utils/uuid/Seq.java b/Cpop-Core/src/main/java/com/cpop/core/utils/uuid/Seq.java index 94b45da..f3c7e9d 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/utils/uuid/Seq.java +++ b/Cpop-Core/src/main/java/com/cpop/core/utils/uuid/Seq.java @@ -1,9 +1,9 @@ package com.cpop.core.utils.uuid; +import com.cpop.core.utils.StringUtils; -import com.cpop.common.utils.DateUtils; -import com.cpop.common.utils.StringUtils; - +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.concurrent.atomic.AtomicInteger; /** @@ -65,7 +65,7 @@ public class Seq { * @return 序列值 */ public static String getId(AtomicInteger atomicInt, int length) { - String result = DateUtils.dateTimeNow(); + String result = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyMMddHHmmss")); result += machineCode; result += getSeq(atomicInt, length); return result; diff --git a/Cpop-Core/src/main/resources/application-core.yml b/Cpop-Core/src/main/resources/application-core.yml deleted file mode 100644 index 921bc44..0000000 --- a/Cpop-Core/src/main/resources/application-core.yml +++ /dev/null @@ -1,12 +0,0 @@ -tencent: - cos: - #id - secretId: AKIDFK8hz0kDRP6XjdGciX5LK3VfYBWaMs7V - #密钥 - secretKey: 92g38wUlkSt50e17wUllUw71pMcaIjtl - # - bucketName: dataresource-1302318474 - #cdn地址 - cdnUrl: .cos.accelerate.myqcloud.com/ - #地区 - region: ap-guangzhou diff --git a/Cpop-Core/src/main/resources/mapper/ConfigMapper.xml b/Cpop-Core/src/main/resources/mapper/ConfigMapper.xml new file mode 100644 index 0000000..097a358 --- /dev/null +++ b/Cpop-Core/src/main/resources/mapper/ConfigMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/Cpop-Core/src/main/resources/mapper/CoreMapper.xml b/Cpop-Core/src/main/resources/mapper/CoreMapper.xml deleted file mode 100644 index 18a4fa5..0000000 --- a/Cpop-Core/src/main/resources/mapper/CoreMapper.xml +++ /dev/null @@ -1,343 +0,0 @@ - - - - - - - INSERT INTO cp_sys_operation_log - (id, operation_user_id, operation_user_name, operation_user_type, code, info, dev_ip, result, level, action_type, fail_reason, description, - create_time, update_time, create_user_id, update_user_id) - VALUES - (#{id}, #{operationUserId}, #{operationUserName}, #{operationUserType}, #{code}, #{info}, #{devIp}, #{result}, #{level}, #{actionType}, #{failReason}, #{description}, - now(), now(), #{createUserId}, #{updateUserId}) - - - - - UPDATE - cp_sys_user - SET - login_ip = #{ipAddr} - WHERE - user_name = #{username} - - AND user_type = #{userType} - - - - - - - - - - - - - - - - - - INSERT INTO - cp_sys_config - (config_key, config_name, config_value, config_type, remarks, create_time, create_user_id, update_time, update_user_id) - VALUES - (#{configKey}, #{configName}, #{configValue}, #{configType}, #{remarks}, now(), #{createUserId}, now(), #{updateUserId}) - - - - - UPDATE cp_sys_config - SET - - config_name = #{configName}, - - - config_value = #{configValue}, - - - config_type = #{configType}, - - - remarks = #{remarks}, - - - update_user_id = #{updateUserId}, - - update_time = now() - WHERE - config_key = #{configKey} - - - - - - - - DELETE FROM cp_sys_config - WHERE - config_key IN - - #{id} - - - - - - INSERT INTO cp_sys_user - - - id, - - - user_name, - - - password, - - - rsa_password, - - - nick_name, - - - email, - - - phone_number, - - - sex, - - - avatar, - - - salt, - - - status, - - - dev_ip, - - - user_type, - - - create_user_id, - - - update_user_id, - - create_time, - update_time, - - - - #{id}, - - - #{userName}, - - - #{password}, - - - #{rsaPassword}, - - - #{nickName}, - - - #{email}, - - - #{phoneNumber}, - - - #{sex}, - - - #{avatar}, - - - #{salt}, - - - #{status}, - - - #{loginIp}, - - - #{userType}, - - - #{createUserId}, - - - #{updateUserId}, - - now(), - now(), - - - - - - UPDATE cp_sys_user - - - user_name = #{userName}, - - - password = #{password}, - - - rsa_password = #{rsaPassword}, - - - nick_name = #{nickName}, - - - email = #{email}, - - - phone_number = #{phoneNumber}, - - - sex = #{sex}, - - - avatar = #{avatar}, - - - salt = #{salt}, - - - status = #{status}, - - - dev_ip = #{loginIp}, - - - update_user_id = #{updateUserId}, - - update_time = now(), - - WHERE - is_delete = 0 - AND id = #{id} - - - - - UPDATE cp_sys_user - SET - is_delete = 1 - WHERE - id = #{id} - - diff --git a/Cpop-Core/src/main/resources/mapper/OperationLogMapper.xml b/Cpop-Core/src/main/resources/mapper/OperationLogMapper.xml new file mode 100644 index 0000000..838787e --- /dev/null +++ b/Cpop-Core/src/main/resources/mapper/OperationLogMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/Cpop-Core/src/main/resources/mapper/UserMapper.xml b/Cpop-Core/src/main/resources/mapper/UserMapper.xml new file mode 100644 index 0000000..b3eb8d6 --- /dev/null +++ b/Cpop-Core/src/main/resources/mapper/UserMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/Cpop-Generator/pom.xml b/Cpop-Generator/pom.xml index 0968b03..5b25ab5 100644 --- a/Cpop-Generator/pom.xml +++ b/Cpop-Generator/pom.xml @@ -24,12 +24,6 @@ com.cpop Cpop-Core - - - com.mysql - mysql-connector-j - runtime - diff --git a/Cpop-Generator/src/main/java/com/cpop/generator/CpopGenerator.java b/Cpop-Generator/src/main/java/com/cpop/generator/CpopGenerator.java index cfc90dd..f862248 100644 --- a/Cpop-Generator/src/main/java/com/cpop/generator/CpopGenerator.java +++ b/Cpop-Generator/src/main/java/com/cpop/generator/CpopGenerator.java @@ -1,7 +1,6 @@ package com.cpop.generator; -import com.cpop.common.utils.DateUtils; -import com.cpop.common.utils.StringUtils; +import com.cpop.core.utils.StringUtils; import com.cpop.core.base.entity.BaseEntity; import com.cpop.core.base.entity.BaseInsertListener; import com.cpop.core.base.entity.BaseUpdateListener; @@ -12,6 +11,8 @@ import com.mybatisflex.codegen.config.TableConfig; import com.mybatisflex.core.exception.MybatisFlexException; import com.zaxxer.hikari.HikariDataSource; +import java.time.LocalDate; +import java.time.format.DateTimeFormatter; import java.util.Arrays; import java.util.Scanner; @@ -108,7 +109,7 @@ public class CpopGenerator { //设置注释配置 globalConfig.getJavadocConfig() .setAuthor("DB") - .setSince(DateUtils.getDate()); + .setSince(LocalDate.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"))); //设置包配置 globalConfig.getPackageConfig() .setSourceDir(System.getProperty("user.dir") + EXPORT_URL + "/src/main/java") @@ -132,7 +133,7 @@ public class CpopGenerator { .setSuperClass(BaseEntity.class) .setWithLombok(true) .setWithSwagger(true) - .setSwaggerVersion(EntityConfig.SwaggerVersion.FOX); + .setSwaggerVersion(EntityConfig.SwaggerVersion.DOC); // 开启 Entity 的生成 globalConfig.enableEntity(); // 开启 Mapper 的生成 diff --git a/Cpop-Jambox/Cpop-Jambox-Web/src/main/resources/static/i18n/messages_en_US.properties b/Cpop-Jambox/Cpop-Jambox-Web/src/main/resources/static/i18n/messages_en_US.properties index 7cf16ed..306c74f 100644 --- a/Cpop-Jambox/Cpop-Jambox-Web/src/main/resources/static/i18n/messages_en_US.properties +++ b/Cpop-Jambox/Cpop-Jambox-Web/src/main/resources/static/i18n/messages_en_US.properties @@ -1,7 +1,4 @@ #\u767B\u5F55\u4FE1\u606F -i18n_login_success=Login Success -i18n_loginOut_success=Login Out Success - #\u7CFB\u7EDF\u57FA\u7840\u4FE1\u606F i18n_baseInfo_success=Success i18n_baseInfo_failed=Failed diff --git a/Cpop-Jambox/Cpop-Jambox-Web/src/main/resources/static/i18n/messages_zh_CN.properties b/Cpop-Jambox/Cpop-Jambox-Web/src/main/resources/static/i18n/messages_zh_CN.properties index d1fcca7..bdbe86b 100644 --- a/Cpop-Jambox/Cpop-Jambox-Web/src/main/resources/static/i18n/messages_zh_CN.properties +++ b/Cpop-Jambox/Cpop-Jambox-Web/src/main/resources/static/i18n/messages_zh_CN.properties @@ -1,7 +1,4 @@ #\u767B\u5F55\u4FE1\u606F -i18n_login_success=\u767B\u5F55\u6210\u529F -i18n_loginOut_success=\u767B\u51FA\u6210\u529F - #\u7CFB\u7EDF\u57FA\u7840\u4FE1\u606F i18n_baseInfo_success=\u6210\u529F i18n_baseInfo_failed=\u5931\u8D25 diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageBusinessDataController.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageBusinessDataController.java index 9ebb8a2..6e18389 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageBusinessDataController.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageBusinessDataController.java @@ -1,6 +1,6 @@ package com.cpop.jambox.business.controller.backstage; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.mybatisflex.core.paginate.Page; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageBusinessIntroController.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageBusinessIntroController.java index 61317b0..f051132 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageBusinessIntroController.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageBusinessIntroController.java @@ -1,6 +1,6 @@ package com.cpop.jambox.business.controller.backstage; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.mybatisflex.core.paginate.Page; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageCompanyIntroController.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageCompanyIntroController.java index a5796e9..a63fd5d 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageCompanyIntroController.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageCompanyIntroController.java @@ -1,6 +1,6 @@ package com.cpop.jambox.business.controller.backstage; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.mybatisflex.core.paginate.Page; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageCooperationController.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageCooperationController.java index 234e64a..6759a53 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageCooperationController.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageCooperationController.java @@ -1,6 +1,6 @@ package com.cpop.jambox.business.controller.backstage; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.mybatisflex.core.paginate.Page; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; @@ -101,7 +101,7 @@ public class BackstageCooperationController { * @author: Yxz * @date: 2024/1/21 15:42 * @param: [typeId] - * @return: com.cpop.core.base.R> + * @return: com.cpop.core.base.entity.R> **/ @GetMapping("/page") @ApiOperation("分页查询果酱模块化官网 合作平台表") diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageCooperationTypeController.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageCooperationTypeController.java index ac21054..fb1e00c 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageCooperationTypeController.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageCooperationTypeController.java @@ -1,6 +1,6 @@ package com.cpop.jambox.business.controller.backstage; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.jambox.business.vo.CooperationTypeVo; import com.mybatisflex.core.paginate.Page; import org.springframework.web.bind.annotation.DeleteMapping; diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageDevelopmentController.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageDevelopmentController.java index ad45af2..2464b18 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageDevelopmentController.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageDevelopmentController.java @@ -1,6 +1,6 @@ package com.cpop.jambox.business.controller.backstage; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.mybatisflex.core.paginate.Page; import org.springframework.format.annotation.DateTimeFormat; import org.springframework.web.bind.annotation.*; @@ -96,7 +96,7 @@ public class BackstageDevelopmentController { * @author: Yxz * @date: 2024/1/24 14:41 * @param: [title, startDate, endDate] - * @return: com.cpop.core.base.R> + * @return: com.cpop.core.base.entity.R> **/ @GetMapping("/page") @ApiOperation("分页查询果酱模块化官网 发展历程表") diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageEasyLearnController.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageEasyLearnController.java index e064c00..eb88985 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageEasyLearnController.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageEasyLearnController.java @@ -1,7 +1,7 @@ package com.cpop.jambox.business.controller.backstage; import com.alibaba.excel.EasyExcel; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.jambox.business.bo.*; import com.cpop.jambox.business.dto.EasyLearnPageDto; import com.cpop.jambox.business.service.EasyLearnOrderService; @@ -90,7 +90,7 @@ public class BackstageEasyLearnController { * @author DB * @since 2023/10/23 12:15 * @param bo 下单请求对象 - * @return com.cpop.core.base.R + * @return com.cpop.core.base.entity.R */ @PostMapping("/oncePlaceOrder") @ApiOperation("一次性支付下单") diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageNavigationController.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageNavigationController.java index c97c829..19870d2 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageNavigationController.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageNavigationController.java @@ -1,7 +1,7 @@ package com.cpop.jambox.business.controller.backstage; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.jambox.business.vo.NavigationVo; import com.mybatisflex.core.paginate.Page; import org.springframework.web.bind.annotation.DeleteMapping; diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageWebProductController.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageWebProductController.java index a2f232a..faeb109 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageWebProductController.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/BackstageWebProductController.java @@ -1,6 +1,6 @@ package com.cpop.jambox.business.controller.backstage; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.jambox.business.entity.website.WebProduct; import com.cpop.jambox.business.service.WebProductService; import com.mybatisflex.core.paginate.Page; diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/EasyLearnController.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/EasyLearnController.java index cb007e2..74a9ac9 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/EasyLearnController.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/EasyLearnController.java @@ -1,6 +1,6 @@ package com.cpop.jambox.business.controller.backstage; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.jambox.business.bo.EasyLearnUnionPayBo; import com.cpop.jambox.business.bo.OncePlaceOrderBo; import com.cpop.jambox.business.service.EasyLearnOrderService; @@ -31,7 +31,7 @@ public class EasyLearnController { * @author DB * @since 2023/10/23 12:15 * @param bo 下单请求对象 - * @return com.cpop.core.base.R + * @return com.cpop.core.base.entity.R */ @PostMapping("/oncePlaceOrder") @ApiOperation("一次性支付下单") diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/mini/MiniCardTemplateController.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/mini/MiniCardTemplateController.java index eff1d0a..140e397 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/mini/MiniCardTemplateController.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/mini/MiniCardTemplateController.java @@ -1,6 +1,6 @@ package com.cpop.jambox.business.controller.mini; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.core.utils.SpringUtils; import com.cpop.jambox.business.bo.CardTemplateUnionBo; import com.cpop.jambox.business.entity.CardTemplate; diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/mini/MiniEasyLearnController.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/mini/MiniEasyLearnController.java index 5784f45..7b0e475 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/mini/MiniEasyLearnController.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/mini/MiniEasyLearnController.java @@ -1,6 +1,6 @@ package com.cpop.jambox.business.controller.mini; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.jambox.business.bo.LearnNowPayLaterServiceOrderBo; import com.cpop.jambox.business.bo.LearnNowPayLaterStopUserSignPlansBo; import com.cpop.jambox.business.bo.LearnNowPayLaterUserSignPlansBo; diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/website/WebsiteController.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/website/WebsiteController.java index 4b79aa2..baabac3 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/website/WebsiteController.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/website/WebsiteController.java @@ -1,6 +1,6 @@ package com.cpop.jambox.business.controller.website; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.jambox.business.service.*; import com.mybatisflex.core.query.QueryWrapper; import io.swagger.annotations.Api; @@ -27,7 +27,7 @@ public class WebsiteController { * @author: Yxz * @date: 2024/1/19 17:37 * @param: [] - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R **/ @ApiOperation("获取导航栏") @GetMapping("/getNavigationList") @@ -41,7 +41,7 @@ public class WebsiteController { * @author: Yxz * @date: 2024/1/19 17:37 * @param: [] - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R **/ @ApiOperation("获取公司简介") @GetMapping("/getCompanyIntro") @@ -54,7 +54,7 @@ public class WebsiteController { * @author: Yxz * @date: 2024/1/19 17:38 * @param: [] - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R **/ @ApiOperation("获取公司业务数据") @GetMapping("/getBusinessData") @@ -67,7 +67,7 @@ public class WebsiteController { * @author: Yxz * @date: 2024/1/19 17:38 * @param: [] - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R **/ @ApiOperation("获取公司业务介绍") @GetMapping("/getBusinessIntro") @@ -81,7 +81,7 @@ public class WebsiteController { * @author: Yxz * @date: 2024/1/21 18:01 * @param: [] - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R **/ @ApiOperation("获取核心产品列表") @GetMapping("/getProductList") @@ -94,7 +94,7 @@ public class WebsiteController { * @author: Yxz * @date: 2024/1/19 17:38 * @param: [] - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R **/ @ApiOperation("获取合作平台") @GetMapping("/getCooperationPlatform") @@ -108,7 +108,7 @@ public class WebsiteController { * @author: Yxz * @date: 2024/1/21 11:55 * @param: [] - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R **/ @ApiOperation("获取发展历程") @GetMapping("/getDevelopmentCourse") diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/WebsiteService.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/WebsiteService.java index 006537a..6058019 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/WebsiteService.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/WebsiteService.java @@ -1,6 +1,6 @@ package com.cpop.jambox.business.service; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.jambox.business.entity.website.BusinessIntro; import com.cpop.jambox.business.vo.CompanyIntroVo; import com.cpop.jambox.business.vo.CooperationPlatformVo; diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/CardTemplateServiceImpl.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/CardTemplateServiceImpl.java index 7097416..c34f22d 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/CardTemplateServiceImpl.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/CardTemplateServiceImpl.java @@ -5,7 +5,6 @@ import cn.binarywang.wx.miniapp.api.WxMaService; import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; import com.cpop.core.base.exception.ServiceException; -import com.cpop.core.handler.TencentCosHandler; import com.cpop.core.utils.SpringUtils; import com.cpop.core.utils.file.FileUtils; import com.cpop.jambox.business.bo.CardTemplateUnionBo; diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/CooperationServiceImpl.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/CooperationServiceImpl.java index 9e0c1c7..1bf0e42 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/CooperationServiceImpl.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/CooperationServiceImpl.java @@ -1,7 +1,7 @@ package com.cpop.jambox.business.service.impl; import com.cpop.core.base.entity.PageDomain; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.cpop.jambox.business.entity.website.CooperationType; import com.cpop.jambox.business.service.CooperationTypeService; import com.mybatisflex.core.paginate.Page; diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/DevelopmentServiceImpl.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/DevelopmentServiceImpl.java index 3c18835..656f32f 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/DevelopmentServiceImpl.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/DevelopmentServiceImpl.java @@ -1,7 +1,7 @@ package com.cpop.jambox.business.service.impl; import com.cpop.core.base.entity.PageDomain; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.spring.service.impl.ServiceImpl; diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/EasyLearnOrderServiceImpl.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/EasyLearnOrderServiceImpl.java index f076506..d89ecef 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/EasyLearnOrderServiceImpl.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/EasyLearnOrderServiceImpl.java @@ -10,12 +10,11 @@ import com.cpop.common.utils.bean.BeanUtils; import com.cpop.common.utils.http.HttpUtils; import com.cpop.common.utils.ip.IpUtils; import com.cpop.core.base.entity.PageDomain; -import com.cpop.core.base.enums.OrderSource; +import com.cpop.system.framework.enums.OrderSource; import com.cpop.core.base.exception.ServiceException; import com.cpop.core.service.RedisService; -import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.cpop.jambox.business.bo.*; import com.cpop.jambox.business.dto.EasyLearnPageDto; import com.cpop.jambox.business.entity.*; diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/PlugServiceImpl.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/PlugServiceImpl.java index 3e30447..4ef5785 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/PlugServiceImpl.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/PlugServiceImpl.java @@ -2,7 +2,7 @@ package com.cpop.jambox.business.service.impl; import com.cpop.common.utils.bean.BeanUtils; import com.cpop.core.base.entity.PageDomain; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.cpop.jambox.business.bo.PlugBo; import com.cpop.jambox.business.vo.PlugPageVo; import com.mybatisflex.core.paginate.Page; diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/WebsiteServiceImpl.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/WebsiteServiceImpl.java index 9a7d132..d286c9d 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/WebsiteServiceImpl.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/WebsiteServiceImpl.java @@ -1,6 +1,6 @@ package com.cpop.jambox.business.service.impl; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.jambox.business.entity.website.*; import com.cpop.jambox.business.mapper.DevelopmentMapper; import com.cpop.jambox.business.service.*; @@ -114,7 +114,7 @@ public class WebsiteServiceImpl implements WebsiteService { * @author: Yxz * @date: 2024/1/21 11:58 * @param: [] - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R **/ @Override public R getDevelopmentCourse() { diff --git a/Cpop-Mall/Cpop-Mall-Web/src/main/resources/static/i18n/messages_en_US.properties b/Cpop-Mall/Cpop-Mall-Web/src/main/resources/static/i18n/messages_en_US.properties index f09ef9c..cd07a24 100644 --- a/Cpop-Mall/Cpop-Mall-Web/src/main/resources/static/i18n/messages_en_US.properties +++ b/Cpop-Mall/Cpop-Mall-Web/src/main/resources/static/i18n/messages_en_US.properties @@ -1,7 +1,4 @@ #\u767B\u5F55\u4FE1\u606F -i18n_login_success=Login Success -i18n_loginOut_success=Login Out Success - #\u64CD\u4F5C\u65E5\u5FD7\u4FE1\u606F i18n_operationLog_systemLogin=System User Login i18n_operationLog_systemLogout=System User Logout @@ -21,7 +18,6 @@ i18n_operationLog_removeOamStaff=Remove Oam User i18n_operationLog_updateOamStaffPassword=Update Oam Staff Password #\u7CFB\u7EDF\u63D0\u793A\u4FE1\u606F -i18n_alert_accountOrPwdError=Username or password is wrong! i18n_alert_peopleUnderTheDepartmentError=There are people under the department, it is not allowed to delete the department! i18n_alert_departmentNotDeactivatedError=The current department is not deactivated, deletion is not allowed\uFF01 i18n_alert_userOrPhoneOrEmailIsExist=Username or mobile phone number or email address already exists diff --git a/Cpop-Mall/Cpop-Mall-Web/src/main/resources/static/i18n/messages_zh_CN.properties b/Cpop-Mall/Cpop-Mall-Web/src/main/resources/static/i18n/messages_zh_CN.properties index 9353e1e..8411710 100644 --- a/Cpop-Mall/Cpop-Mall-Web/src/main/resources/static/i18n/messages_zh_CN.properties +++ b/Cpop-Mall/Cpop-Mall-Web/src/main/resources/static/i18n/messages_zh_CN.properties @@ -1,7 +1,4 @@ #\u767B\u5F55\u4FE1\u606F -i18n_login_success=\u767B\u5F55\u6210\u529F -i18n_loginOut_success=\u767B\u51FA\u6210\u529F - #\u64CD\u4F5C\u65E5\u5FD7\u4FE1\u606F i18n_operationLog_systemLogin=\u7CFB\u7EDF\u7528\u6237\u767B\u5F55 i18n_operationLog_systemLogout=\u7CFB\u7EDF\u7528\u6237\u9000\u51FA @@ -21,7 +18,6 @@ i18n_operationLog_removeOamStaff=\u5220\u9664OAM\u7528\u6237 i18n_operationLog_updateOamStaffPassword=\u4FEE\u6539OAM\u7528\u6237\u5BC6\u7801 #\u7CFB\u7EDF\u63D0\u793A\u4FE1\u606F -i18n_alert_accountOrPwdError=\u8D26\u53F7\u6216\u5BC6\u7801\u9519\u8BEF\uFF01 i18n_alert_peopleUnderTheDepartmentError=\u5F53\u524D\u90E8\u95E8\u4E0B\u6709\u4EBA\u5458\uFF0C\u4E0D\u5141\u8BB8\u5220\u9664\u90E8\u95E8\uFF01 i18n_alert_departmentNotDeactivatedError=\u5F53\u524D\u90E8\u95E8\u672A\u505C\u7528\uFF0C\u4E0D\u5141\u8BB8\u5220\u9664\u90E8\u95E8\uFF01 i18n_alert_userOrPhoneOrEmailIsExist=\u7528\u6237\u540D\u6216\u624B\u673A\u53F7\u6216\u90AE\u7BB1\u5DF2\u5B58\u5728 diff --git a/Cpop-Mall/Cpop-Mall-Web/src/test/java/com/cpop/mall/web/CpopMallWebApplicationTests.java b/Cpop-Mall/Cpop-Mall-Web/src/test/java/com/cpop/mall/web/CpopMallWebApplicationTests.java index 15d9dc6..7e0c2a6 100644 --- a/Cpop-Mall/Cpop-Mall-Web/src/test/java/com/cpop/mall/web/CpopMallWebApplicationTests.java +++ b/Cpop-Mall/Cpop-Mall-Web/src/test/java/com/cpop/mall/web/CpopMallWebApplicationTests.java @@ -1,6 +1,5 @@ package com.cpop.mall.web; -import com.cpop.core.service.CoreService; import com.cpop.core.utils.RsaUtils; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/AdvanceOrderBo.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/AdvanceOrderBo.java index 0c5b7bc..14866e6 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/AdvanceOrderBo.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/AdvanceOrderBo.java @@ -1,6 +1,6 @@ package com.cpop.mall.business.bo; -import com.cpop.core.annontation.StringArrayConvert; +import com.cpop.core.anno.StringArrayConvert; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/ProductBo.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/ProductBo.java index 802b21c..93bcaef 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/ProductBo.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/ProductBo.java @@ -1,6 +1,6 @@ package com.cpop.mall.business.bo; -import com.cpop.core.annontation.StringArrayConvert; +import com.cpop.core.anno.StringArrayConvert; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/ProductRecordBo.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/ProductRecordBo.java index 5127116..0d192c5 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/ProductRecordBo.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/ProductRecordBo.java @@ -1,6 +1,6 @@ package com.cpop.mall.business.bo; -import com.cpop.core.annontation.StringArrayConvert; +import com.cpop.core.anno.StringArrayConvert; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/ProductSpecificationBo.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/ProductSpecificationBo.java index ab67ddb..9fb93b0 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/ProductSpecificationBo.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/ProductSpecificationBo.java @@ -1,6 +1,6 @@ package com.cpop.mall.business.bo; -import com.cpop.core.annontation.StringArrayConvert; +import com.cpop.core.anno.StringArrayConvert; import com.mybatisflex.annotation.Id; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/StaffBo.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/StaffBo.java index 0d2e708..7b017bf 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/StaffBo.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/bo/StaffBo.java @@ -1,6 +1,5 @@ package com.cpop.mall.business.bo; -import com.cpop.core.annontation.StringArrayConvert; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageCarouselController.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageCarouselController.java index 4fdfc08..39d9b2b 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageCarouselController.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageCarouselController.java @@ -1,24 +1,21 @@ package com.cpop.mall.business.controller.backstage; import com.alibaba.fastjson.JSONObject; -import com.cpop.core.base.R; -import com.cpop.core.utils.SecurityUtils; +import com.cpop.core.base.entity.R; import com.cpop.core.utils.SpringUtils; import com.cpop.mall.business.bo.CarouselBo; import com.cpop.mall.business.service.ProductService; import com.cpop.mall.business.vo.CarouselPageVo; -import com.cpop.mall.business.vo.ProductInfoVo; import com.cpop.mall.business.vo.ProductSimpleVo; import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.query.QueryWrapper; import org.springframework.web.bind.annotation.*; import org.springframework.beans.factory.annotation.Autowired; -import com.cpop.mall.business.entity.Carousel; import com.cpop.mall.business.service.CarouselService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; -import java.io.Serializable; + import java.util.List; import static com.cpop.mall.business.entity.table.CarouselTableDef.CAROUSEL; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageMallRoleController.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageMallRoleController.java index d2e9b8f..7a1f591 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageMallRoleController.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageMallRoleController.java @@ -1,6 +1,6 @@ package com.cpop.mall.business.controller.backstage; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.mall.business.bo.MallRoleBo; import com.cpop.mall.business.bo.MallRolePageBo; import com.cpop.mall.business.service.RoleBrandService; @@ -55,7 +55,7 @@ public class BackstageMallRoleController { * @author DB * @date 2023/10/12 10:48 * @param bo 请求参数 - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @PreAuthorize("@aps.hasPermission('system:role:insert')") @ApiOperation("新增商城角色") diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageOrderController.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageOrderController.java index e7a9f86..c01c6d5 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageOrderController.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageOrderController.java @@ -1,6 +1,6 @@ package com.cpop.mall.business.controller.backstage; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.mall.business.bo.LogisticsOrderBo; import com.cpop.mall.business.bo.OrderPageBo; import com.cpop.mall.business.service.OrderService; @@ -34,7 +34,7 @@ public class BackstageOrderController { * @author DB * @date 2023/10/23 11:56 * @param bo 分页参数 - * @return: com.cpop.core.base.R> + * @return: com.cpop.core.base.entity.R> */ @GetMapping("/getOrderPage") @ApiOperation("分页查询商城-订单") @@ -48,7 +48,7 @@ public class BackstageOrderController { * @author DB * @date 2023/10/12 10:48 * @param bo 请求参数 - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @ApiOperation("输入物流订单") @PostMapping("/inputLogisticsOrder") @@ -81,7 +81,7 @@ public class BackstageOrderController { * @author DB * @date 2023/11/07 9:37 * @param id 订单id - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @PutMapping("/orderFinish") @ApiOperation("后台确定订单完成") diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageOrderRefundController.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageOrderRefundController.java index 55e9833..1b0225d 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageOrderRefundController.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageOrderRefundController.java @@ -1,6 +1,6 @@ package com.cpop.mall.business.controller.backstage; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.mall.business.bo.OrderRefundPageBo; import com.cpop.mall.business.bo.OrderRejectRefundBo; import com.cpop.mall.business.service.OrderRefundService; @@ -32,7 +32,7 @@ public class BackstageOrderRefundController { * @author DB * @date 2023/10/27 17:33 * @param bo 请求参数 - * @return: com.cpop.core.base.R> + * @return: com.cpop.core.base.entity.R> */ @GetMapping("/getOrderRefundPage") @ApiOperation("分页查询商城-退款列表") @@ -46,7 +46,7 @@ public class BackstageOrderRefundController { * @author DB * @date 2023/10/23 12:15 * @param id 订单id - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @PutMapping("/agreeRefund/{id}") @ApiOperation("同意退款") @@ -60,7 +60,7 @@ public class BackstageOrderRefundController { * @author DB * @date 2023/10/23 12:15 * @param bo 请求参数 - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @PostMapping("/rejectRefund") @ApiOperation("拒绝退款") diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageProductController.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageProductController.java index 928f894..ea41507 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageProductController.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageProductController.java @@ -1,6 +1,6 @@ package com.cpop.mall.business.controller.backstage; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.core.utils.SpringUtils; import com.cpop.mall.business.bo.ProductBo; import com.cpop.mall.business.bo.ProductPageBo; @@ -46,7 +46,7 @@ public class BackstageProductController { * @author DB * @date 2023/10/23 11:56 * @param bo 分页参数 - * @return: com.cpop.core.base.R> + * @return: com.cpop.core.base.entity.R> */ @GetMapping("/getProductPage") @ApiOperation("分页查询商城-商品") @@ -60,7 +60,7 @@ public class BackstageProductController { * @author DB * @date 2023/11/09 11:00 * @param id 主键 - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @GetMapping("/getProductInfo/{id}") @ApiOperation("查询商城-商品详情") @@ -73,7 +73,7 @@ public class BackstageProductController { * @descriptions 选择品牌下的店铺/校区 * @author DB * @date 2023/10/23 11:56 - * @return: com.cpop.core.base.R> + * @return: com.cpop.core.base.entity.R> */ @GetMapping("/getStoreList") @ApiOperation("选择品牌下的店铺/校区") @@ -86,7 +86,7 @@ public class BackstageProductController { * @descriptions 获取果酱课卡模板 * @author DB * @date 2023/10/23 11:56 - * @return: com.cpop.core.base.R> + * @return: com.cpop.core.base.entity.R> */ @GetMapping("/getJamboxCardTemplate") @ApiOperation("获取果酱课卡模板") @@ -100,7 +100,7 @@ public class BackstageProductController { * @author DB * @date 2023/10/23 12:15 * @param specificationGroups 规格集合 - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @PostMapping("/createSpecification") @ApiOperation("创建规格") @@ -114,7 +114,7 @@ public class BackstageProductController { * @author DB * @date 2023/10/23 12:15 * @param bo 商城-商品 - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @PostMapping("/insertProduct") @ApiOperation("保存商城-商品") @@ -128,7 +128,7 @@ public class BackstageProductController { * @author DB * @date 2023/10/23 12:15 * @param id 商城-商品id - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @PutMapping("/resetProduct/{id}") @ApiOperation("根据主键重置商城商品") @@ -142,7 +142,7 @@ public class BackstageProductController { * @author DB * @date 2023/10/23 12:15 * @param bo 商城-商品 - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @PutMapping("/updateProduct") @ApiOperation("根据主键更新商城-商品") @@ -178,7 +178,7 @@ public class BackstageProductController { * @author DB * @date 2023/10/23 12:15 * @param productId 商城-商品id - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @PutMapping("/productUpOrDown") @ApiOperation("商城商品上下架") @@ -192,7 +192,7 @@ public class BackstageProductController { * @author DB * @date 2023/10/23 12:15 * @param productId 商城-商品id - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @PutMapping("/productIsTop") @ApiOperation("商城商品置顶") diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageStaffController.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageStaffController.java index ea8efcf..fff137b 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageStaffController.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/backstage/BackstageStaffController.java @@ -2,8 +2,7 @@ package com.cpop.mall.business.controller.backstage; import com.alibaba.fastjson.JSONObject; import com.cpop.common.constant.Constants; -import com.cpop.core.base.R; -import com.cpop.core.utils.SecurityUtils; +import com.cpop.core.base.entity.R; import com.cpop.core.utils.SpringUtils; import com.cpop.mall.business.bo.ModifyUserPasswordBo; import com.cpop.mall.business.bo.StaffBo; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/mini/MiniBrandController.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/mini/MiniBrandController.java index bdfc71f..8230ab2 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/mini/MiniBrandController.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/mini/MiniBrandController.java @@ -1,6 +1,6 @@ package com.cpop.mall.business.controller.mini; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.core.utils.SpringUtils; import com.cpop.jambox.business.entity.BrandExtend; import com.cpop.jambox.business.service.BrandExtendService; @@ -35,7 +35,7 @@ public class MiniBrandController { * @author DB * @date 2023/10/23 11:56 * @param cloudBrandId 云品牌id - * @return: com.cpop.core.base.R> + * @return: com.cpop.core.base.entity.R> */ @GetMapping("/jamboxBrandIsInMall/{cloudBrandId}") @ApiOperation("小程序-果酱品牌是否在商城内") diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/mini/MiniOrderController.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/mini/MiniOrderController.java index dc7f6c5..95872d6 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/mini/MiniOrderController.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/mini/MiniOrderController.java @@ -1,16 +1,14 @@ package com.cpop.mall.business.controller.mini; import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.core.utils.SpringUtils; import com.cpop.mall.business.bo.*; import com.cpop.mall.business.entity.OrderEvaluate; import com.cpop.mall.business.service.OrderEvaluateService; -import com.cpop.mall.business.service.OrderRefundService; import com.cpop.mall.business.service.OrderService; import com.cpop.mall.business.vo.OrderInfoVo; import com.cpop.mall.business.vo.OrderPageVo; -import com.cpop.mall.business.vo.OrderRefundPageVo; import com.mybatisflex.core.paginate.Page; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -40,7 +38,7 @@ public class MiniOrderController { * @author DB * @date 2023/10/23 11:56 * @param bo 分页参数 - * @return: com.cpop.core.base.R> + * @return: com.cpop.core.base.entity.R> */ @GetMapping("/getOrderPage") @ApiOperation("小程序-我的订单列表") @@ -54,7 +52,7 @@ public class MiniOrderController { * @author DB * @date 2023/11/06 11:12 * @param bo 请求参数 - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @PostMapping("/createAdvanceOrder") @ApiOperation("商城-订单-生成预订单") @@ -67,7 +65,7 @@ public class MiniOrderController { * @author DB * @date 2023/10/23 12:15 * @param bo 下单请求对象 - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @PostMapping("/placeOrder") @ApiOperation("商城-订单-下单") @@ -80,7 +78,7 @@ public class MiniOrderController { * @descriptions 评价订单 * @author DB * @date 2023/10/23 12:15 - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @PostMapping("/orderEvaluate") @ApiOperation("评价订单") @@ -97,7 +95,7 @@ public class MiniOrderController { * @author DB * @date 2023/10/26 17:22 * @param bo 申请退款对象 - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @PostMapping("/applyRefund") @ApiOperation("申请退款") @@ -112,7 +110,7 @@ public class MiniOrderController { * @author DB * @date 2023/10/27 17:16 * @param orderId 商城-订单Id - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @PutMapping("/cancelOrder") @ApiOperation("取消订单") @@ -126,7 +124,7 @@ public class MiniOrderController { * @author DB * @date 2023/11/03 15:53 * @param orderId 订单id - * @return: com.cpop.core.base.R> + * @return: com.cpop.core.base.entity.R> */ @Deprecated @PutMapping("/rePayOrder/{orderId}") @@ -140,7 +138,7 @@ public class MiniOrderController { * @author DB * @date 2023/11/06 14:25 * @param orderId 订单id - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @GetMapping("/getOrderInfo/{orderId}") @ApiOperation("小程序-获取订单详情") diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/mini/MiniProductController.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/mini/MiniProductController.java index 1728e4c..86a81d6 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/mini/MiniProductController.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/mini/MiniProductController.java @@ -2,8 +2,7 @@ package com.cpop.mall.business.controller.mini; import com.alibaba.fastjson.JSONObject; import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.base.R; -import com.cpop.core.utils.SecurityUtils; +import com.cpop.core.base.entity.R; import com.cpop.core.utils.SpringUtils; import com.cpop.mall.business.bo.ProductPageBo; import com.cpop.mall.business.service.CarouselService; @@ -15,7 +14,6 @@ import com.mybatisflex.core.paginate.Page; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; -import org.checkerframework.checker.units.qual.A; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -46,7 +44,7 @@ public class MiniProductController { * @author DB * @date 2023/10/23 11:56 * @param bo 分页参数 - * @return: com.cpop.core.base.R> + * @return: com.cpop.core.base.entity.R> */ @GetMapping("/getMiniProductPage") @ApiOperation("分页查询商城-商品") @@ -61,7 +59,7 @@ public class MiniProductController { * @date 2023/11/13 16:24 * @param productType 商品类型 * @param id id - * @return: com.cpop.core.base.R> + * @return: com.cpop.core.base.entity.R> */ @GetMapping("/getSameTypeRandomProduct") @ApiOperation("查询商城同类型随机商品") @@ -74,7 +72,7 @@ public class MiniProductController { * @descriptions 下单需要选择店铺/校区 * @author DB * @date 2023/10/23 11:56 - * @return: com.cpop.core.base.R> + * @return: com.cpop.core.base.entity.R> */ @GetMapping("/getStoreList") @ApiOperation("下单需要选择店铺/校区") @@ -88,7 +86,7 @@ public class MiniProductController { * @author DB * @date 2023/10/23 11:56 * @param productId 商品id - * @return: com.cpop.core.base.R> + * @return: com.cpop.core.base.entity.R> */ @GetMapping("/getOrderEvaluatePage/{productId}") @ApiOperation("查询商品评价分页列表") @@ -102,7 +100,7 @@ public class MiniProductController { * @author DB * @date 2023/11/02 17:11 * @param storeIds 校区id列表 - * @return: com.cpop.core.base.R> + * @return: com.cpop.core.base.entity.R> */ @GetMapping("/getStoreByIds") @ApiOperation("根据校区ids获取校区信息") @@ -117,7 +115,7 @@ public class MiniProductController { * @author DB * @date 2023/11/06 11:55 * @param id 商品id - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @GetMapping("/getProductInfo/{id}") @ApiOperation("获取商品详情") diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/mini/MiniShoppingCartController.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/mini/MiniShoppingCartController.java index 15d4c4d..0f755f8 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/mini/MiniShoppingCartController.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/controller/mini/MiniShoppingCartController.java @@ -1,24 +1,19 @@ package com.cpop.mall.business.controller.mini; -import com.cpop.core.base.R; -import com.cpop.mall.business.bo.AdvanceOrderBo; -import com.cpop.mall.business.bo.ProductPageBo; +import com.cpop.core.base.entity.R; import com.cpop.mall.business.bo.ShoppingCartBo; import com.cpop.mall.business.bo.ShoppingCartPageBo; -import com.cpop.mall.business.vo.MiniProductPageVo; import com.cpop.mall.business.vo.MiniShoppingCartPageVo; import com.mybatisflex.core.paginate.Page; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.beans.factory.annotation.Autowired; -import com.cpop.mall.business.entity.ShoppingCart; import com.cpop.mall.business.service.ShoppingCartService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; -import java.io.Serializable; + import java.util.Arrays; -import java.util.List; /** * 商城购物车表 控制层。 @@ -39,7 +34,7 @@ public class MiniShoppingCartController { * @author DB * @date 2023/11/06 14:10 * @param bo 请求参数 - * @return: com.cpop.core.base.R> + * @return: com.cpop.core.base.entity.R> */ @GetMapping("/getMiniShoppingCartPage") @ApiOperation("分页查询小程序-商城-购物车分页") @@ -53,7 +48,7 @@ public class MiniShoppingCartController { * @author DB * @date 2023/11/06 14:14 * @param bo 请求参数 - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @PostMapping("/insertShoppingCart") @ApiOperation("小程序-商城-购物车添加商品") @@ -67,7 +62,7 @@ public class MiniShoppingCartController { * @author DB * @date 2023/11/06 14:14 * @param ids 主键 - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @DeleteMapping("/removeShoppingCart") @ApiOperation("小程序-商城-购物车删除商品") diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/RoleBrandService.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/RoleBrandService.java index 0b607c2..7565e7d 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/RoleBrandService.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/RoleBrandService.java @@ -30,7 +30,7 @@ public interface RoleBrandService extends IService { * @author DB * @date 2023/10/12 10:48 * @param bo 请求参数 - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ void insertMallRole(MallRoleBo bo); diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/CarouselServiceImpl.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/CarouselServiceImpl.java index 2f1bdc6..b5debac 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/CarouselServiceImpl.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/CarouselServiceImpl.java @@ -3,8 +3,7 @@ package com.cpop.mall.business.service.impl; import com.alibaba.fastjson.JSONObject; import com.cpop.common.utils.bean.BeanUtils; import com.cpop.core.base.entity.PageDomain; -import com.cpop.core.utils.SecurityUtils; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.cpop.mall.business.bo.CarouselBo; import com.cpop.mall.business.vo.CarouselPageVo; import com.mybatisflex.core.paginate.Page; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/OrderRefundServiceImpl.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/OrderRefundServiceImpl.java index 44ed93b..91923cf 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/OrderRefundServiceImpl.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/OrderRefundServiceImpl.java @@ -2,11 +2,10 @@ package com.cpop.mall.business.service.impl; import com.alibaba.fastjson.JSONObject; import com.cpop.core.base.entity.PageDomain; -import com.cpop.core.base.enums.OrderSource; +import com.cpop.system.framework.enums.OrderSource; import com.cpop.core.base.exception.ServiceException; -import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.cpop.mall.business.bo.OrderRefundPageBo; import com.cpop.mall.business.bo.OrderRejectRefundBo; import com.cpop.mall.business.dto.UserPointDto; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/OrderServiceImpl.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/OrderServiceImpl.java index 79a3a2a..245b1c3 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/OrderServiceImpl.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/OrderServiceImpl.java @@ -6,15 +6,14 @@ import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; import com.cpop.common.utils.ip.IpUtils; import com.cpop.core.base.entity.PageDomain; -import com.cpop.core.base.enums.OrderSource; +import com.cpop.system.framework.enums.OrderSource; import com.cpop.core.base.enums.UserType; import com.cpop.core.base.exception.ServiceException; import com.cpop.core.base.table.SysUser; import com.cpop.core.service.RedisService; import com.cpop.core.utils.QuartzUtils; -import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.cpop.jambox.business.entity.BrandExtend; import com.cpop.jambox.business.service.BrandExtendService; import com.cpop.mall.business.bo.*; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/ProductServiceImpl.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/ProductServiceImpl.java index 1f6857b..3ea09d3 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/ProductServiceImpl.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/ProductServiceImpl.java @@ -4,13 +4,10 @@ import com.alibaba.fastjson.JSONObject; import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; import com.cpop.core.base.entity.PageDomain; -import com.cpop.core.base.enums.SourceType; import com.cpop.core.service.RedisService; -import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.cpop.jambox.business.entity.BrandExtend; -import com.cpop.jambox.business.entity.CardTemplate; import com.cpop.jambox.business.service.BrandExtendService; import com.cpop.jambox.business.service.CardTemplateService; import com.cpop.mall.business.bo.ProductBo; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/RoleBrandServiceImpl.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/RoleBrandServiceImpl.java index 8752653..37d83b6 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/RoleBrandServiceImpl.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/RoleBrandServiceImpl.java @@ -4,9 +4,8 @@ import com.alibaba.fastjson.JSONObject; import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; import com.cpop.core.base.entity.PageDomain; -import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.cpop.mall.business.bo.MallRoleBo; import com.cpop.mall.business.bo.MallRolePageBo; import com.cpop.mall.business.entity.RoleBrand; @@ -84,7 +83,7 @@ public class RoleBrandServiceImpl extends ServiceImpl + * @return: com.cpop.core.base.entity.R */ @Override @Transactional(rollbackFor = Exception.class) diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/ShoppingCartServiceImpl.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/ShoppingCartServiceImpl.java index acf4c25..0f2955e 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/ShoppingCartServiceImpl.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/ShoppingCartServiceImpl.java @@ -5,8 +5,7 @@ import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; import com.cpop.core.base.entity.PageDomain; import com.cpop.core.base.exception.ServiceException; -import com.cpop.core.utils.SecurityUtils; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.cpop.mall.business.bo.ShoppingCartBo; import com.cpop.mall.business.bo.ShoppingCartPageBo; import com.cpop.mall.business.vo.MiniShoppingCartPageVo; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/StaffServiceImpl.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/StaffServiceImpl.java index 0ad7c00..4f61c52 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/StaffServiceImpl.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/service/impl/StaffServiceImpl.java @@ -4,19 +4,15 @@ import com.alibaba.fastjson.JSONObject; import com.cpop.common.constant.Constants; import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.base.entity.LoginUser; import com.cpop.core.base.entity.PageDomain; import com.cpop.core.base.entity.loginInfo.MallStaffLoginInfo; -import com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo; -import com.cpop.core.base.enums.InitRoleEnum; -import com.cpop.core.base.enums.SourceType; +import com.cpop.system.framework.enums.InitRoleEnum; import com.cpop.core.base.enums.UserType; import com.cpop.core.base.exception.ServiceException; import com.cpop.core.base.table.SysUser; -import com.cpop.core.service.CoreService; import com.cpop.core.service.RedisService; import com.cpop.core.utils.*; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.cpop.core.utils.uuid.IdUtils; import com.cpop.mall.business.bo.ModifyUserPasswordBo; import com.cpop.mall.business.bo.StaffBo; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/MallRolePageVo.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/MallRolePageVo.java index e72fd2d..281d051 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/MallRolePageVo.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/MallRolePageVo.java @@ -1,6 +1,6 @@ package com.cpop.mall.business.vo; -import com.cpop.core.annontation.StringArrayConvert; +import com.cpop.core.anno.StringArrayConvert; import com.fasterxml.jackson.annotation.JsonFormat; import com.mybatisflex.annotation.Column; import io.swagger.annotations.ApiModel; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/MiniShoppingCartPageVo.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/MiniShoppingCartPageVo.java index 5dcd9b2..b3e9809 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/MiniShoppingCartPageVo.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/MiniShoppingCartPageVo.java @@ -1,6 +1,5 @@ package com.cpop.mall.business.vo; -import com.cpop.core.annontation.StringArrayConvert; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/ProductInfoVo.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/ProductInfoVo.java index 133b293..4ced790 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/ProductInfoVo.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/ProductInfoVo.java @@ -1,6 +1,6 @@ package com.cpop.mall.business.vo; -import com.cpop.core.annontation.StringArrayConvert; +import com.cpop.core.anno.StringArrayConvert; import com.fasterxml.jackson.annotation.JsonFormat; import com.mybatisflex.annotation.RelationOneToMany; import io.swagger.annotations.ApiModel; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/ProductPageVo.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/ProductPageVo.java index 959ad9d..e9eab1b 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/ProductPageVo.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/ProductPageVo.java @@ -1,6 +1,6 @@ package com.cpop.mall.business.vo; -import com.cpop.core.annontation.StringArrayConvert; +import com.cpop.core.anno.StringArrayConvert; import com.fasterxml.jackson.annotation.JsonFormat; import com.mybatisflex.annotation.RelationOneToMany; import io.swagger.annotations.ApiModel; @@ -11,7 +11,6 @@ import lombok.experimental.Accessors; import java.io.Serializable; import java.math.BigDecimal; import java.time.LocalDateTime; -import java.util.List; /** * @author DB diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/ProductRecordVo.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/ProductRecordVo.java index 3a393a5..ace7b87 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/ProductRecordVo.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/ProductRecordVo.java @@ -1,6 +1,6 @@ package com.cpop.mall.business.vo; -import com.cpop.core.annontation.StringArrayConvert; +import com.cpop.core.anno.StringArrayConvert; import com.mybatisflex.annotation.Id; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/ProductSpecificationCreateVo.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/ProductSpecificationCreateVo.java index 2e7e13e..154d1f1 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/ProductSpecificationCreateVo.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/ProductSpecificationCreateVo.java @@ -1,6 +1,6 @@ package com.cpop.mall.business.vo; -import com.cpop.core.annontation.StringArrayConvert; +import com.cpop.core.anno.StringArrayConvert; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -8,7 +8,6 @@ import lombok.experimental.Accessors; import java.io.Serializable; import java.math.BigDecimal; -import java.util.List; /** * @author DB diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/ProductSpecificationVo.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/ProductSpecificationVo.java index 5966230..6aa46b1 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/ProductSpecificationVo.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/ProductSpecificationVo.java @@ -1,6 +1,6 @@ package com.cpop.mall.business.vo; -import com.cpop.core.annontation.StringArrayConvert; +import com.cpop.core.anno.StringArrayConvert; import com.mybatisflex.annotation.Id; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/StaffPageVo.java b/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/StaffPageVo.java index ac25200..f1ff053 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/StaffPageVo.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/business/vo/StaffPageVo.java @@ -1,6 +1,5 @@ package com.cpop.mall.business.vo; -import com.cpop.core.annontation.StringArrayConvert; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/framework/strategy/buyRestrict/MemberRestrictStrategy.java b/Cpop-Mall/src/main/java/com/cpop/mall/framework/strategy/buyRestrict/MemberRestrictStrategy.java index 9af49b0..b35a179 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/framework/strategy/buyRestrict/MemberRestrictStrategy.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/framework/strategy/buyRestrict/MemberRestrictStrategy.java @@ -2,7 +2,6 @@ package com.cpop.mall.framework.strategy.buyRestrict; import com.alibaba.fastjson.JSONObject; import com.cpop.core.base.exception.ServiceException; -import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; import com.cpop.jambox.business.entity.BrandExtend; import com.cpop.jambox.business.service.BrandExtendService; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/framework/strategy/buyRestrict/NewCustomerRestrictStrategy.java b/Cpop-Mall/src/main/java/com/cpop/mall/framework/strategy/buyRestrict/NewCustomerRestrictStrategy.java index 6b38831..c1ec8a8 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/framework/strategy/buyRestrict/NewCustomerRestrictStrategy.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/framework/strategy/buyRestrict/NewCustomerRestrictStrategy.java @@ -2,7 +2,6 @@ package com.cpop.mall.framework.strategy.buyRestrict; import com.alibaba.fastjson.JSONObject; import com.cpop.core.base.exception.ServiceException; -import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; import com.cpop.mall.business.entity.Product; import com.cpop.mall.business.service.OrderService; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/framework/strategy/buyRestrict/UserRestrictStrategy.java b/Cpop-Mall/src/main/java/com/cpop/mall/framework/strategy/buyRestrict/UserRestrictStrategy.java index 54d1cdf..3c2707d 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/framework/strategy/buyRestrict/UserRestrictStrategy.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/framework/strategy/buyRestrict/UserRestrictStrategy.java @@ -2,7 +2,6 @@ package com.cpop.mall.framework.strategy.buyRestrict; import com.alibaba.fastjson.JSONObject; import com.cpop.core.base.exception.ServiceException; -import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; import com.cpop.mall.business.entity.Product; import com.cpop.mall.business.entity.ProductRecord; diff --git a/Cpop-Mall/src/main/java/com/cpop/mall/framework/task/OrderDetailAsyncTask.java b/Cpop-Mall/src/main/java/com/cpop/mall/framework/task/OrderDetailAsyncTask.java index 9a0c9fa..9a063b1 100644 --- a/Cpop-Mall/src/main/java/com/cpop/mall/framework/task/OrderDetailAsyncTask.java +++ b/Cpop-Mall/src/main/java/com/cpop/mall/framework/task/OrderDetailAsyncTask.java @@ -1,8 +1,7 @@ package com.cpop.mall.framework.task; import com.alibaba.fastjson.JSONObject; -import com.cpop.core.base.enums.OrderSource; -import com.cpop.core.base.exception.ServiceException; +import com.cpop.system.framework.enums.OrderSource; import com.cpop.core.utils.SpringUtils; import com.cpop.jambox.business.entity.StoreExtend; import com.cpop.jambox.business.service.StoreExtendService; @@ -18,7 +17,6 @@ import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; -import java.io.IOException; import java.util.List; import java.util.Map; import java.util.stream.Collectors; diff --git a/Cpop-Mini/src/main/java/com/cpop/mini/business/entity/MiniUser.java b/Cpop-Mini/src/main/java/com/cpop/mini/business/entity/MiniUser.java index 7782265..ee9e587 100644 --- a/Cpop-Mini/src/main/java/com/cpop/mini/business/entity/MiniUser.java +++ b/Cpop-Mini/src/main/java/com/cpop/mini/business/entity/MiniUser.java @@ -3,14 +3,11 @@ package com.cpop.mini.business.entity; import com.cpop.core.base.entity.BaseEntity; import com.cpop.core.base.entity.BaseInsertListener; import com.cpop.core.base.entity.BaseUpdateListener; -import com.cpop.core.base.enums.SourceType; import com.mybatisflex.annotation.Column; import com.mybatisflex.annotation.Id; import com.mybatisflex.annotation.Table; import java.io.Serializable; -import java.time.LocalDateTime; -import io.swagger.annotations.ApiModel; -import io.swagger.annotations.ApiModelProperty; + import lombok.*; import lombok.experimental.Accessors; diff --git a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/static/i18n/messages_en_US.properties b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/static/i18n/messages_en_US.properties index f09ef9c..cd07a24 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/static/i18n/messages_en_US.properties +++ b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/static/i18n/messages_en_US.properties @@ -1,7 +1,4 @@ #\u767B\u5F55\u4FE1\u606F -i18n_login_success=Login Success -i18n_loginOut_success=Login Out Success - #\u64CD\u4F5C\u65E5\u5FD7\u4FE1\u606F i18n_operationLog_systemLogin=System User Login i18n_operationLog_systemLogout=System User Logout @@ -21,7 +18,6 @@ i18n_operationLog_removeOamStaff=Remove Oam User i18n_operationLog_updateOamStaffPassword=Update Oam Staff Password #\u7CFB\u7EDF\u63D0\u793A\u4FE1\u606F -i18n_alert_accountOrPwdError=Username or password is wrong! i18n_alert_peopleUnderTheDepartmentError=There are people under the department, it is not allowed to delete the department! i18n_alert_departmentNotDeactivatedError=The current department is not deactivated, deletion is not allowed\uFF01 i18n_alert_userOrPhoneOrEmailIsExist=Username or mobile phone number or email address already exists diff --git a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/static/i18n/messages_zh_CN.properties b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/static/i18n/messages_zh_CN.properties index 9353e1e..8411710 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/main/resources/static/i18n/messages_zh_CN.properties +++ b/Cpop-Oam/Cpop-Oam-Web/src/main/resources/static/i18n/messages_zh_CN.properties @@ -1,7 +1,4 @@ #\u767B\u5F55\u4FE1\u606F -i18n_login_success=\u767B\u5F55\u6210\u529F -i18n_loginOut_success=\u767B\u51FA\u6210\u529F - #\u64CD\u4F5C\u65E5\u5FD7\u4FE1\u606F i18n_operationLog_systemLogin=\u7CFB\u7EDF\u7528\u6237\u767B\u5F55 i18n_operationLog_systemLogout=\u7CFB\u7EDF\u7528\u6237\u9000\u51FA @@ -21,7 +18,6 @@ i18n_operationLog_removeOamStaff=\u5220\u9664OAM\u7528\u6237 i18n_operationLog_updateOamStaffPassword=\u4FEE\u6539OAM\u7528\u6237\u5BC6\u7801 #\u7CFB\u7EDF\u63D0\u793A\u4FE1\u606F -i18n_alert_accountOrPwdError=\u8D26\u53F7\u6216\u5BC6\u7801\u9519\u8BEF\uFF01 i18n_alert_peopleUnderTheDepartmentError=\u5F53\u524D\u90E8\u95E8\u4E0B\u6709\u4EBA\u5458\uFF0C\u4E0D\u5141\u8BB8\u5220\u9664\u90E8\u95E8\uFF01 i18n_alert_departmentNotDeactivatedError=\u5F53\u524D\u90E8\u95E8\u672A\u505C\u7528\uFF0C\u4E0D\u5141\u8BB8\u5220\u9664\u90E8\u95E8\uFF01 i18n_alert_userOrPhoneOrEmailIsExist=\u7528\u6237\u540D\u6216\u624B\u673A\u53F7\u6216\u90AE\u7BB1\u5DF2\u5B58\u5728 diff --git a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopApiTests.java b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopApiTests.java index 1edd043..1691c32 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopApiTests.java +++ b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopApiTests.java @@ -3,22 +3,16 @@ package com.cpop.oam.web; import com.alibaba.fastjson.JSONObject; import com.cpop.api.tencent.location.handler.TencentLocationHandler; import com.cpop.api.tencent.wxWork.handler.WebHookSendHandler; -import com.cpop.core.annontation.StringArrayConvert; -import com.cpop.core.utils.CpopSignatureUtils; import com.cpop.core.utils.RsaUtils; import com.cpop.core.utils.SpringUtils; import com.cpop.oam.business.bo.ApiTenantRequest; import com.cpop.pay.framewok.handler.ecpp.EcppHandler; -import com.fasterxml.jackson.annotation.JsonFormat; -import lombok.Data; -import lombok.experimental.Accessors; import okhttp3.Response; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; import java.io.IOException; -import java.time.LocalDate; import java.util.ArrayList; import java.util.List; diff --git a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopClueTests.java b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopClueTests.java index f3d486b..546207f 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopClueTests.java +++ b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopClueTests.java @@ -2,15 +2,7 @@ package com.cpop.oam.web; import com.alibaba.fastjson.JSONObject; import com.cpop.api.tencent.location.handler.TencentLocationHandler; -import com.cpop.core.base.entity.LoginUser; -import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; -import com.cpop.jambox.business.entity.StoreExtend; -import com.cpop.jambox.business.service.StoreExtendService; -import com.cpop.oam.business.entity.Clue; -import com.cpop.oam.business.service.ClueService; -import com.cpop.system.business.entity.Store; -import com.cpop.system.business.service.StoreService; import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.core.row.Db; import com.mybatisflex.core.row.Row; @@ -19,11 +11,6 @@ import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; import java.time.LocalDateTime; -import java.util.List; -import java.util.stream.Collectors; - -import static com.cpop.jambox.business.entity.table.StoreExtendTableDef.STORE_EXTEND; -import static com.cpop.system.business.entity.table.StoreTableDef.STORE; /** * @author DB diff --git a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopCoreTests.java b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopCoreTests.java index 54fe9ce..3083b49 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopCoreTests.java +++ b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopCoreTests.java @@ -1,14 +1,10 @@ package com.cpop.oam.web; import cn.hutool.core.util.IdUtil; -import com.cpop.core.base.entity.LoginUser; import com.cpop.core.base.enums.OperationLogEnum; import com.cpop.core.base.enums.UserType; -import com.cpop.core.service.CoreService; -import com.cpop.core.utils.PasswordEncoder; import com.cpop.core.utils.RsaUtils; import com.cpop.core.utils.SpringUtils; -import com.cpop.core.utils.uuid.IdUtils; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; diff --git a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopEasyLearnTest.java b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopEasyLearnTest.java index be32ecb..6b6b9d9 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopEasyLearnTest.java +++ b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopEasyLearnTest.java @@ -4,9 +4,8 @@ import cn.binarywang.wx.miniapp.api.WxMaQrcodeService; import cn.binarywang.wx.miniapp.api.WxMaService; import com.alibaba.fastjson.JSONObject; import com.cpop.common.utils.StringUtils; -import com.cpop.core.base.enums.OrderSource; +import com.cpop.system.framework.enums.OrderSource; import com.cpop.core.base.exception.ServiceException; -import com.cpop.core.handler.TencentCosHandler; import com.cpop.core.utils.SpringUtils; import com.cpop.core.utils.file.FileUtils; import com.cpop.jambox.business.entity.EasyLearnOrder; @@ -18,21 +17,15 @@ import com.cpop.pay.framewok.config.wxPay.WxPayProperties; import com.cpop.pay.framewok.handler.wxPay.WxPayHandler; import com.github.binarywang.wxpay.bean.payscore.*; import com.github.binarywang.wxpay.bean.profitsharing.request.ProfitSharingBillV3Request; -import com.github.binarywang.wxpay.bean.profitsharing.request.ProfitSharingReceiverRequest; import com.github.binarywang.wxpay.bean.profitsharing.request.ProfitSharingRequest; -import com.github.binarywang.wxpay.bean.profitsharing.result.ProfitSharingBillV3Result; -import com.github.binarywang.wxpay.bean.profitsharing.result.ProfitSharingOrderAmountQueryV3Result; import com.github.binarywang.wxpay.bean.profitsharing.result.ProfitSharingResult; -import com.github.binarywang.wxpay.bean.profitsharing.result.ProfitSharingV3Result; import com.github.binarywang.wxpay.bean.request.WxPayApplyTradeBillV3Request; import com.github.binarywang.wxpay.bean.request.WxPayOrderQueryRequest; -import com.github.binarywang.wxpay.bean.request.WxPayOrderQueryV3Request; import com.github.binarywang.wxpay.bean.request.WxPayPartnerOrderCloseV3Request; import com.github.binarywang.wxpay.bean.result.WxPayApplyBillV3Result; import com.github.binarywang.wxpay.bean.result.WxPayOrderQueryResult; import com.github.binarywang.wxpay.config.WxPayConfig; import com.github.binarywang.wxpay.exception.WxPayException; -import com.github.binarywang.wxpay.service.PartnerPayScoreSignPlanService; import com.github.binarywang.wxpay.service.ProfitSharingService; import com.github.binarywang.wxpay.service.WxPayService; import com.mybatisflex.core.query.QueryWrapper; diff --git a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopImportTests.java b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopImportTests.java index fa644ed..b0c9800 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopImportTests.java +++ b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopImportTests.java @@ -7,11 +7,8 @@ import com.alibaba.fastjson.annotation.JSONField; import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; import com.cpop.core.base.entity.BaseEntity; -import com.cpop.core.base.enums.InitRoleEnum; -import com.cpop.core.base.enums.SourceType; +import com.cpop.system.framework.enums.InitRoleEnum; import com.cpop.core.base.table.SysUser; -import com.cpop.core.mapper.CoreMapper; -import com.cpop.core.utils.PasswordEncoder; import com.cpop.core.utils.RsaUtils; import com.cpop.core.utils.SpringUtils; import com.cpop.jambox.business.entity.*; diff --git a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopOldDataSyncTests.java b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopOldDataSyncTests.java index 510da12..c7f416f 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopOldDataSyncTests.java +++ b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopOldDataSyncTests.java @@ -3,7 +3,7 @@ package com.cpop.oam.web; import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.cpop.common.utils.StringUtils; -import com.cpop.core.base.enums.OrderSource; +import com.cpop.system.framework.enums.OrderSource; import com.cpop.core.utils.SpringUtils; import com.cpop.jambox.business.entity.*; import com.cpop.jambox.business.service.*; diff --git a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopWxCpTests.java b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopWxCpTests.java index 0b4886d..19dc1b6 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopWxCpTests.java +++ b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopWxCpTests.java @@ -9,16 +9,11 @@ import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.annotation.JSONField; import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.base.entity.LoginUser; import com.cpop.core.base.enums.UserType; import com.cpop.core.base.exception.ServiceException; import com.cpop.core.base.table.SysUser; -import com.cpop.core.mapper.CoreMapper; -import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; -import com.cpop.core.utils.file.FileUtils; import com.cpop.core.utils.uuid.IdUtils; -import com.cpop.oam.business.dto.DataImportDto; import com.cpop.oam.business.entity.Dept; import com.cpop.oam.business.entity.Staff; import com.cpop.oam.business.entity.StaffMidDept; @@ -50,7 +45,6 @@ import javax.crypto.Cipher; import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; import java.io.File; -import java.net.URLEncoder; import java.util.*; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/DataImportBo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/DataImportBo.java index 6a88241..9a771bf 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/DataImportBo.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/DataImportBo.java @@ -1,14 +1,11 @@ package com.cpop.oam.business.bo; -import com.cpop.core.annontation.StringArrayConvert; -import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import lombok.experimental.Accessors; import javax.validation.constraints.NotBlank; -import java.time.LocalDateTime; /** * @author DB diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/StaffBo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/StaffBo.java index 6b9b29e..28f86f3 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/StaffBo.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/StaffBo.java @@ -1,6 +1,6 @@ package com.cpop.oam.business.bo; -import com.cpop.core.annontation.StringArrayConvert; +import com.cpop.core.anno.StringArrayConvert; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskDemandBo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskDemandBo.java index fafb1da..5795410 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskDemandBo.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskDemandBo.java @@ -7,7 +7,6 @@ import lombok.experimental.Accessors; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; -import com.cpop.core.annontation.StringArrayConvert; /** * OAM-任务-需求表Bo diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskItemBo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskItemBo.java index 8d83b36..dc023e9 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskItemBo.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskItemBo.java @@ -1,6 +1,5 @@ package com.cpop.oam.business.bo; -import com.cpop.core.annontation.StringArrayConvert; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; @@ -8,7 +7,6 @@ import lombok.experimental.Accessors; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; -import java.io.Serializable; /** * Description: diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskIterationBo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskIterationBo.java index 311cbc3..0868d4d 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskIterationBo.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskIterationBo.java @@ -1,6 +1,5 @@ package com.cpop.oam.business.bo; -import com.cpop.core.annontation.StringArrayConvert; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskProgressBo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskProgressBo.java index 7efd25f..6074f0f 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskProgressBo.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskProgressBo.java @@ -1,6 +1,6 @@ package com.cpop.oam.business.bo; -import com.cpop.core.annontation.StringArrayConvert; +import com.cpop.core.anno.StringArrayConvert; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.Data; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskWorkOrderBo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskWorkOrderBo.java index 6a9958f..0341fe7 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskWorkOrderBo.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskWorkOrderBo.java @@ -7,7 +7,6 @@ import lombok.experimental.Accessors; import javax.validation.constraints.NotBlank; import javax.validation.constraints.NotNull; -import com.cpop.core.annontation.StringArrayConvert; /** * 任务-工单表Bo diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskWorkOrderRecordBo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskWorkOrderRecordBo.java index 1967d22..ffd4221 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskWorkOrderRecordBo.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/bo/TaskWorkOrderRecordBo.java @@ -6,7 +6,6 @@ import lombok.Data; import lombok.experimental.Accessors; import javax.validation.constraints.NotBlank; -import com.cpop.core.annontation.StringArrayConvert; /** * TaskWorkOrderRecord对象 diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageBrandManagerController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageBrandManagerController.java index bcf3366..7b06636 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageBrandManagerController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageBrandManagerController.java @@ -1,6 +1,6 @@ package com.cpop.oam.business.controller.backstage; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.oam.business.bo.BrandManagerBo; import com.cpop.oam.business.bo.BrandManagerPageBo; import com.cpop.oam.business.service.BrandManagerService; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageBusinessController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageBusinessController.java index 3bb5b62..553bee4 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageBusinessController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageBusinessController.java @@ -1,7 +1,7 @@ package com.cpop.oam.business.controller.backstage; import com.alibaba.excel.EasyExcel; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.core.utils.SpringUtils; import com.cpop.oam.business.bo.BusinessDisposeBo; import com.cpop.oam.business.bo.BusinessDistributeBo; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageCloudDataController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageCloudDataController.java index 3bd198c..b1c592b 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageCloudDataController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageCloudDataController.java @@ -2,7 +2,7 @@ package com.cpop.oam.business.controller.backstage; import com.cpop.api.cloudDb.core.dto.*; import com.cpop.api.cloudDb.handler.*; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.mybatisflex.core.paginate.Page; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageClueController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageClueController.java index 62b1cb7..1fdec20 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageClueController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageClueController.java @@ -1,37 +1,30 @@ package com.cpop.oam.business.controller.backstage; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.core.utils.SpringUtils; import com.cpop.oam.business.bo.ClueFollowUpBo; import com.cpop.oam.business.bo.CluePutOffBo; import com.cpop.oam.business.bo.ClueUpdateBo; -import com.cpop.oam.business.bo.DeptBo; import com.cpop.oam.business.service.ClueRecordService; -import com.cpop.oam.business.service.SignAreaService; import com.cpop.oam.business.service.StaffService; import com.cpop.oam.business.vo.*; import com.cpop.system.business.entity.DictData; -import com.cpop.system.business.entity.DictType; import com.cpop.system.business.service.DictDataService; import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.query.QueryWrapper; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; import org.springframework.beans.factory.annotation.Autowired; -import com.cpop.oam.business.entity.Clue; import com.cpop.oam.business.service.ClueService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; -import java.io.Serializable; -import java.time.LocalDate; + import java.util.*; import java.util.stream.Collectors; import static com.cpop.core.base.table.table.SysUserTableDef.SYS_USER; import static com.cpop.oam.business.entity.table.ClueRecordTableDef.CLUE_RECORD; -import static com.cpop.oam.business.entity.table.SignAreaTableDef.SIGN_AREA; -import static com.cpop.oam.business.entity.table.SignGoalTableDef.SIGN_GOAL; import static com.cpop.oam.business.entity.table.StaffTableDef.STAFF; import static com.mybatisflex.core.query.QueryMethods.distinct; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageDataImportController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageDataImportController.java index 10da440..2674bcc 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageDataImportController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageDataImportController.java @@ -1,7 +1,7 @@ package com.cpop.oam.business.controller.backstage; import com.alibaba.excel.EasyExcel; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.oam.business.bo.DataImportBo; import com.cpop.oam.business.bo.DataImportPageBo; import com.cpop.oam.business.dto.DataImportDto; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageDeptController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageDeptController.java index 2e5cdac..5f1f588 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageDeptController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageDeptController.java @@ -2,9 +2,7 @@ package com.cpop.oam.business.controller.backstage; import com.cpop.oam.business.service.DeptService; import com.cpop.oam.business.vo.DeptVo; -import com.cpop.core.annontation.OperationLog; -import com.cpop.core.base.R; -import com.cpop.core.base.enums.OperationLogEnum; +import com.cpop.core.base.entity.R; import com.cpop.oam.business.bo.DeptBo; import com.cpop.oam.business.bo.DeptListBo; import io.swagger.annotations.Api; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageDutyController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageDutyController.java index 54d4ef7..5870f99 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageDutyController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageDutyController.java @@ -1,6 +1,6 @@ package com.cpop.oam.business.controller.backstage; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.oam.business.bo.DutyBo; import com.cpop.oam.business.bo.DutyListBo; import com.cpop.oam.business.service.DutyService; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageFinanceReimburseController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageFinanceReimburseController.java index 808a169..63e5530 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageFinanceReimburseController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageFinanceReimburseController.java @@ -1,7 +1,7 @@ package com.cpop.oam.business.controller.backstage; import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.oam.business.bo.*; import com.cpop.oam.business.entity.FinanceReimburseType; import com.cpop.oam.business.service.FinanceReimburseService; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageOamMallController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageOamMallController.java index f90f0c8..e19d4a0 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageOamMallController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageOamMallController.java @@ -1,7 +1,6 @@ package com.cpop.oam.business.controller.backstage; -import com.cpop.core.base.R; -import com.cpop.core.service.CoreService; +import com.cpop.core.base.entity.R; import com.cpop.core.utils.SpringUtils; import com.cpop.oam.business.bo.MallStaffBo; import com.cpop.oam.business.service.OamMallService; @@ -37,7 +36,7 @@ public class BackstageOamMallController { * @date 2023/11/09 15:33 * @param brandIds 品牌id集合 * @param name 姓名 - * @return: com.cpop.core.base.R> + * @return: com.cpop.core.base.entity.R> */ @PreAuthorize("@aps.hasPermission('mall:admin:list')") @ApiOperation("查询商城管理员分页列表") @@ -51,7 +50,7 @@ public class BackstageOamMallController { * @descriptions 查询品牌列表 * @author DB * @date 2023/11/10 11:45 - * @return: com.cpop.core.base.R> + * @return: com.cpop.core.base.entity.R> */ @ApiOperation("查询品牌列表") @GetMapping("/getBrandList") @@ -67,7 +66,7 @@ public class BackstageOamMallController { * @param username 用户名 * @param id id * @param userType 用户类型 - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @ApiOperation("用户名是否存在") @GetMapping("/isAccountExist") @@ -95,7 +94,7 @@ public class BackstageOamMallController { * @author DB * @date 2023/11/10 14:33 * @param id 主键 - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @ApiOperation("删除管理员") @DeleteMapping("/removeAdmin/{id}") diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstagePutOffController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstagePutOffController.java index e0e798b..32aa97e 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstagePutOffController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstagePutOffController.java @@ -1,12 +1,9 @@ package com.cpop.oam.business.controller.backstage; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.oam.business.bo.PutOffAuditBo; import com.cpop.oam.business.service.CluePutOffService; -import com.cpop.oam.business.service.ClueRecordService; -import com.cpop.oam.business.vo.CluePageVo; import com.cpop.oam.business.vo.PutOffAuditPageVo; -import com.cpop.system.business.service.StoreRenewService; import com.mybatisflex.core.paginate.Page; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageSignGoalController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageSignGoalController.java index 4f11020..48a6bcd 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageSignGoalController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageSignGoalController.java @@ -2,27 +2,21 @@ package com.cpop.oam.business.controller.backstage; import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.annontation.OperationLog; -import com.cpop.core.base.R; -import com.cpop.core.base.enums.OperationLogEnum; +import com.cpop.core.base.entity.R; import com.cpop.core.base.exception.ServiceException; import com.cpop.core.base.table.SysConfig; -import com.cpop.core.service.CoreService; import com.cpop.core.service.RedisService; import com.cpop.core.utils.SpringUtils; import com.cpop.oam.business.bo.*; import com.cpop.oam.business.service.CommonService; import com.cpop.oam.business.service.SignAreaService; -import com.cpop.oam.business.vo.ConfigInfoVo; import com.cpop.oam.business.vo.SignGoalConfigInfoVo; import com.cpop.oam.business.vo.SignGoalPageVo; -import com.cpop.oam.business.vo.StaffPageVo; import com.cpop.oam.framework.constant.OamConfigKey; import com.cpop.oam.framework.enums.OamConfigEnum; import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.core.row.DbChain; -import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; @@ -32,17 +26,15 @@ import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.beans.factory.annotation.Autowired; -import com.cpop.oam.business.entity.SignGoal; import com.cpop.oam.business.service.SignGoalService; import org.springframework.web.bind.annotation.RestController; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; -import java.io.Serializable; + import java.lang.reflect.Field; import java.util.Arrays; import java.util.HashMap; -import java.util.List; import java.util.Map; import static com.cpop.core.base.table.table.SysConfigTableDef.SYS_CONFIG; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageStaffController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageStaffController.java index 96163e2..540d358 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageStaffController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageStaffController.java @@ -1,14 +1,12 @@ package com.cpop.oam.business.controller.backstage; -import com.cpop.core.base.entity.LoginUser; -import com.cpop.core.base.enums.InitRoleEnum; -import com.cpop.core.utils.SecurityUtils; +import com.cpop.system.framework.enums.InitRoleEnum; import com.cpop.system.business.service.RoleService; import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.query.QueryWrapper; import com.cpop.common.constant.Constants; -import com.cpop.core.annontation.OperationLog; -import com.cpop.core.base.R; +import com.cpop.core.anno.OperationLog; +import com.cpop.core.base.entity.R; import com.cpop.core.base.enums.OperationLogEnum; import com.cpop.core.utils.SpringUtils; import com.cpop.oam.business.bo.*; @@ -17,7 +15,6 @@ import com.cpop.oam.business.service.StaffService; import com.cpop.oam.business.vo.*; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import org.apache.catalina.security.SecurityUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageStorePlugController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageStorePlugController.java index 3a5255d..5f3854c 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageStorePlugController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageStorePlugController.java @@ -1,7 +1,7 @@ package com.cpop.oam.business.controller.backstage; import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.jambox.business.bo.PlugBo; import com.cpop.jambox.business.entity.StorePlug; import com.cpop.jambox.business.service.PlugService; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageSysConfigController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageSysConfigController.java index 2d007fb..577a101 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageSysConfigController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageSysConfigController.java @@ -1,7 +1,7 @@ package com.cpop.oam.business.controller.backstage; -import com.cpop.core.annontation.OperationLog; -import com.cpop.core.base.R; +import com.cpop.core.anno.OperationLog; +import com.cpop.core.base.entity.R; import com.cpop.core.base.enums.OperationLogEnum; import com.cpop.oam.business.bo.SysConfigInfoBo; import com.cpop.oam.business.service.CommonService; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageTaskDemandController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageTaskDemandController.java index ff12b3e..b3d214d 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageTaskDemandController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageTaskDemandController.java @@ -1,6 +1,6 @@ package com.cpop.oam.business.controller.backstage; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.oam.business.bo.TaskDemandBo; import com.cpop.oam.business.bo.TaskDemandPageBo; import com.cpop.oam.business.bo.TaskDemandUrgentBo; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageTaskTechnologyController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageTaskTechnologyController.java index 636e978..8863a68 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageTaskTechnologyController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageTaskTechnologyController.java @@ -1,6 +1,6 @@ package com.cpop.oam.business.controller.backstage; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.oam.business.bo.*; import com.cpop.oam.business.service.StaffService; import com.cpop.oam.business.service.TaskService; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageTaskWorkOrderController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageTaskWorkOrderController.java index 2f063ac..a4e0775 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageTaskWorkOrderController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageTaskWorkOrderController.java @@ -1,6 +1,6 @@ package com.cpop.oam.business.controller.backstage; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.jambox.business.vo.BrandListVo; import com.cpop.oam.business.bo.AgreeOrRejectEnforceFinishBo; import com.cpop.oam.business.bo.PauseWorkOrderBo; @@ -49,7 +49,7 @@ public class BackstageTaskWorkOrderController { * 工单模块-工单提交-接收/处理/暂停中 * @author DB * @since 2023/09/18 17:18 - * @return com.cpop.core.base.R> + * @return com.cpop.core.base.entity.R> */ @PreAuthorize("@aps.hasPermission('oamTask:workOrder:list')") @ApiOperation("工单模块-工单提交-接收/处理/暂停中") diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageTechnologyToolController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageTechnologyToolController.java index 5f9311e..3d6d0ad 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageTechnologyToolController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageTechnologyToolController.java @@ -1,11 +1,9 @@ package com.cpop.oam.business.controller.backstage; import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.core.base.entity.PageDomain; -import com.cpop.core.utils.SpringUtils; -import com.cpop.core.utils.sql.SqlUtils; -import com.cpop.oam.business.bo.EnforceFinishWorkOrderBo; +import com.cpop.core.utils.SqlUtils; import com.cpop.oam.business.bo.TechnologyToolBo; import com.cpop.oam.business.vo.TechnologyToolPageVo; import com.mybatisflex.core.paginate.Page; @@ -18,8 +16,6 @@ import com.cpop.oam.business.service.TechnologyToolService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; -import java.io.Serializable; -import java.util.List; import static com.cpop.core.base.table.table.SysUserTableDef.SYS_USER; import static com.cpop.oam.business.entity.table.StaffTableDef.STAFF; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageWxCpController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageWxCpController.java index b05173d..d65abb6 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageWxCpController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageWxCpController.java @@ -1,6 +1,6 @@ package com.cpop.oam.business.controller.backstage; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.oam.business.service.OamWxCpService; import com.cpop.oam.business.vo.WxCpLoginVo; import com.cpop.oam.framework.config.wxCp.WxCpConfiguration; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageWxOpenController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageWxOpenController.java index 12d8a9a..10d5b9d 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageWxOpenController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageWxOpenController.java @@ -2,10 +2,10 @@ package com.cpop.oam.business.controller.backstage; import cn.binarywang.wx.miniapp.bean.WxMaAuditMediaUploadResult; import com.cpop.common.utils.StringUtils; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.core.base.entity.PageDomain; import com.cpop.core.base.exception.ServiceException; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.cpop.oam.business.bo.WxOpenMaCodeCommitBo; import com.cpop.oam.business.bo.WxOpenMaTrialQrCodeBo; import com.cpop.oam.business.service.WxOpenMiniService; @@ -358,7 +358,7 @@ public class BackstageWxOpenController { * @date 2023/10/10 17:41 * @param authorizerAppid 授权appid * @param auditId 审核id - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @PreAuthorize("@aps.hasPermission('wxOpen:applet:info')") @ApiOperation("查询审核单状态") @@ -503,7 +503,7 @@ public class BackstageWxOpenController { * @author DB * @date 2023/10/10 18:17 * @param templateType 模板类型 - * @return: com.cpop.core.base.R> + * @return: com.cpop.core.base.entity.R> */ @PreAuthorize("@aps.hasPermission('wxOpen:applet:info')") @ApiOperation("获取模板列表") @@ -541,7 +541,7 @@ public class BackstageWxOpenController { * @date 2023/10/10 18:16 * @param draftId 草稿id * @param templateType 模板类型 - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @PreAuthorize("@aps.hasPermission('wxOpen:applet:update')") @ApiOperation("将草稿添加到模板库") diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageWxPayController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageWxPayController.java index e6949b5..561d4a8 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageWxPayController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/BackstageWxPayController.java @@ -2,7 +2,7 @@ package com.cpop.oam.business.controller.backstage; import com.alibaba.fastjson.JSONObject; import com.cpop.common.utils.StringUtils; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.core.base.exception.ServiceException; import com.cpop.pay.framewok.config.wxPay.WxPayConfiguration; import com.cpop.system.business.bo.ChangeWechatSharingBo; @@ -15,7 +15,6 @@ import com.github.binarywang.wxpay.service.WxPayService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.PutMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -50,7 +49,7 @@ public class BackstageWxPayController { * @descriptions 开通微信分账 * @author DB * @date 2023/11/15 11:06 - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @ApiOperation("开通微信分账") @PutMapping("/changeBrandSharing") diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/callback/CallBackCloudCallbackController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/callback/CallBackCloudCallbackController.java index abd7a6f..c8563ea 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/callback/CallBackCloudCallbackController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/callback/CallBackCloudCallbackController.java @@ -1,7 +1,6 @@ package com.cpop.oam.business.controller.callback; -import com.cpop.core.annontation.SimpleSignatureCheck; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.oam.business.bo.CloudUnionCallbackBo; import com.cpop.oam.framework.enums.CloudCallbackEnums; import com.cpop.oam.framework.strategy.cloud.CloudCallbackStrategy; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/callback/CallbackCloudController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/callback/CallbackCloudController.java index 6ad06eb..7ffdb52 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/callback/CallbackCloudController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/callback/CallbackCloudController.java @@ -1,6 +1,6 @@ package com.cpop.oam.business.controller.callback; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.oam.business.bo.CloudUnionCallbackBo; import com.cpop.oam.framework.enums.CloudCallbackEnums; import com.cpop.oam.framework.strategy.cloud.CloudCallbackStrategy; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/mini/MiniSummitController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/mini/MiniSummitController.java index f83f650..2bb5e62 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/mini/MiniSummitController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/mini/MiniSummitController.java @@ -5,9 +5,8 @@ import cn.binarywang.wx.miniapp.api.WxMaService; import com.alibaba.excel.EasyExcel; import com.cpop.api.tencent.wxWork.handler.WebHookSendHandler; import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.core.base.exception.ServiceException; -import com.cpop.core.handler.TencentCosHandler; import com.cpop.core.utils.SpringUtils; import com.cpop.core.utils.file.FileUtils; import com.cpop.oam.business.bo.SummitApplyBo; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/FinanceReimburseService.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/FinanceReimburseService.java index 744423d..cb31f33 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/FinanceReimburseService.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/FinanceReimburseService.java @@ -47,7 +47,7 @@ public interface FinanceReimburseService extends IService { * @author DB * @date 2023/09/21 15:55 * @param bo 请求参数 - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ void insertReimburseApplication(ReimburseApplicationBo bo); diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/TaskWorkOrderService.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/TaskWorkOrderService.java index 12a4b53..35b6f22 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/TaskWorkOrderService.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/TaskWorkOrderService.java @@ -21,7 +21,7 @@ public interface TaskWorkOrderService extends IService { * 工单模块-工单提交-接收/处理/暂停中 * @author DB * @since 2023/09/18 17:18 - * @return com.cpop.core.base.R> + * @return com.cpop.core.base.entity.R> */ TaskWorkOrderReceiveDealPauseVo receiveDealPause(); diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BrandManagerServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BrandManagerServiceImpl.java index 4b26bbf..0f270f8 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BrandManagerServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BrandManagerServiceImpl.java @@ -7,7 +7,7 @@ import com.cpop.common.utils.http.HttpUtils; import com.cpop.core.base.entity.PageDomain; import com.cpop.core.base.exception.ServiceException; import com.cpop.core.utils.SpringUtils; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.cpop.jambox.business.entity.BrandExtend; import com.cpop.jambox.business.entity.StoreExtend; import com.cpop.jambox.business.entity.table.BrandExtendTableDef; @@ -23,8 +23,6 @@ import com.cpop.oam.business.mapper.BrandManagerMapper; import com.cpop.oam.business.service.BrandManagerStoreService; import com.cpop.oam.business.service.BrandManagerService; import com.cpop.oam.business.vo.BrandManagePageVo; -import com.cpop.system.business.entity.table.BrandTableDef; -import com.cpop.system.business.entity.table.StoreTableDef; import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.spring.service.impl.ServiceImpl; @@ -34,7 +32,6 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.client.RestTemplate; -import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.stream.Collectors; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BusinessServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BusinessServiceImpl.java index ac30a83..2f83a7f 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BusinessServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BusinessServiceImpl.java @@ -10,9 +10,8 @@ import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; import com.cpop.core.base.entity.PageDomain; import com.cpop.core.base.exception.ServiceException; -import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.cpop.oam.business.bo.BusinessDisposeBo; import com.cpop.oam.business.bo.BusinessDistributeBo; import com.cpop.oam.business.bo.BusinessInfoPageBo; @@ -25,10 +24,8 @@ import com.cpop.oam.business.vo.BusinessInfoPageVo; import com.cpop.oam.business.vo.BusinessPageVo; import com.cpop.oam.business.vo.BusinessUnSignPageVo; import com.cpop.oam.business.vo.PersonBusinessInfoVo; -import com.cpop.system.business.bo.StoreRenewBo; import com.cpop.system.business.entity.Store; import com.cpop.system.business.entity.StoreSign; -import com.cpop.system.business.service.StoreRenewService; import com.cpop.system.business.service.StoreService; import com.cpop.system.business.service.StoreSignService; import com.mybatisflex.core.paginate.Page; @@ -49,12 +46,9 @@ import java.util.List; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; -import static com.cpop.jambox.business.entity.table.BrandExtendTableDef.BRAND_EXTEND; -import static com.cpop.jambox.business.entity.table.StoreExtendTableDef.STORE_EXTEND; import static com.cpop.oam.business.entity.table.BusinessDetailTableDef.BUSINESS_DETAIL; import static com.cpop.oam.business.entity.table.BusinessStaffTableDef.BUSINESS_STAFF; import static com.cpop.oam.business.entity.table.BusinessTableDef.BUSINESS; -import static com.cpop.oam.business.entity.table.ClueRecordTableDef.CLUE_RECORD; import static com.cpop.oam.business.entity.table.ClueTableDef.CLUE; import static com.cpop.oam.business.entity.table.SignGoalTableDef.SIGN_GOAL; import static com.cpop.oam.business.entity.table.StaffTableDef.STAFF; @@ -63,7 +57,6 @@ import static com.cpop.system.business.entity.table.StoreLicenseTableDef.STORE_L import static com.cpop.system.business.entity.table.StoreSignTableDef.STORE_SIGN; import static com.cpop.system.business.entity.table.StoreTableDef.STORE; import static com.mybatisflex.core.query.QueryMethods.distinct; -import static com.mybatisflex.core.query.QueryMethods.select; /** * Oam-事务表 服务层实现。 diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/CluePutOffServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/CluePutOffServiceImpl.java index 5f810f7..f789f07 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/CluePutOffServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/CluePutOffServiceImpl.java @@ -2,9 +2,8 @@ package com.cpop.oam.business.service.impl; import com.alibaba.fastjson.JSONObject; import com.cpop.core.base.entity.PageDomain; -import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.cpop.oam.business.bo.PutOffAuditBo; import com.cpop.oam.business.entity.Clue; import com.cpop.oam.business.entity.ClueRecord; @@ -12,7 +11,6 @@ import com.cpop.oam.business.service.ClueRecordService; import com.cpop.oam.business.service.ClueService; import com.cpop.oam.business.vo.CluePageVo; import com.cpop.oam.business.vo.PutOffAuditPageVo; -import com.cpop.oam.business.vo.TaskArchivingPagVo; import com.cpop.system.business.bo.StoreRenewBo; import com.cpop.system.business.service.StoreRenewService; import com.mybatisflex.core.paginate.Page; @@ -25,7 +23,6 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import static com.cpop.oam.business.entity.table.CluePutOffTableDef.CLUE_PUT_OFF; -import static com.cpop.oam.business.entity.table.ClueRecordTableDef.CLUE_RECORD; import static com.cpop.oam.business.entity.table.ClueTableDef.CLUE; import static com.cpop.oam.business.entity.table.StaffTableDef.STAFF; import static com.cpop.system.business.entity.table.BrandTableDef.BRAND; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/ClueRecordServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/ClueRecordServiceImpl.java index 37aa988..747f8fd 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/ClueRecordServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/ClueRecordServiceImpl.java @@ -1,23 +1,12 @@ package com.cpop.oam.business.service.impl; -import com.cpop.core.base.entity.PageDomain; -import com.cpop.core.utils.sql.SqlUtils; -import com.cpop.oam.business.vo.CluePageVo; -import com.cpop.oam.business.vo.PutOffAuditPageVo; -import com.mybatisflex.core.paginate.Page; -import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.spring.service.impl.ServiceImpl; import com.cpop.oam.business.entity.ClueRecord; import com.cpop.oam.business.mapper.ClueRecordMapper; import com.cpop.oam.business.service.ClueRecordService; import org.springframework.stereotype.Service; -import static com.cpop.oam.business.entity.table.ClueRecordTableDef.CLUE_RECORD; -import static com.cpop.oam.business.entity.table.ClueTableDef.CLUE; -import static com.cpop.system.business.entity.table.BrandTableDef.BRAND; -import static com.cpop.system.business.entity.table.StoreTableDef.STORE; import static com.mybatisflex.core.query.QueryMethods.dateDiff; -import static com.mybatisflex.core.query.QueryMethods.now; /** * 线索记录表 服务层实现。 diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/ClueServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/ClueServiceImpl.java index 370e850..b9a9199 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/ClueServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/ClueServiceImpl.java @@ -6,9 +6,8 @@ import com.cpop.common.utils.bean.BeanUtils; import com.cpop.core.base.entity.PageDomain; import com.cpop.core.base.exception.ServiceException; import com.cpop.core.service.RedisService; -import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.cpop.oam.business.bo.ClueFollowUpBo; import com.cpop.oam.business.bo.CluePutOffBo; import com.cpop.oam.business.bo.ClueUpdateBo; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/CommonServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/CommonServiceImpl.java index e000462..33cf2b5 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/CommonServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/CommonServiceImpl.java @@ -5,7 +5,6 @@ import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; import com.cpop.core.base.exception.ServiceException; import com.cpop.core.base.table.SysConfig; -import com.cpop.core.service.CoreService; import com.cpop.core.service.RedisService; import com.cpop.core.utils.SpringUtils; import com.cpop.oam.business.bo.SysConfigInfoBo; @@ -13,8 +12,6 @@ import com.cpop.oam.business.service.CommonService; import com.cpop.oam.business.vo.ConfigInfoVo; import com.cpop.oam.framework.constant.OamConfigKey; import com.cpop.oam.framework.enums.OamConfigEnum; -import org.apache.commons.lang3.ArrayUtils; -import org.checkerframework.checker.units.qual.A; import org.springframework.stereotype.Service; import javax.annotation.PostConstruct; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/DataImportServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/DataImportServiceImpl.java index 688fb09..563c174 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/DataImportServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/DataImportServiceImpl.java @@ -6,22 +6,17 @@ import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.exception.ExcelDataConvertException; import com.alibaba.excel.metadata.data.ReadCellData; import com.alibaba.excel.read.listener.ReadListener; -import com.alibaba.excel.util.ConverterUtils; import com.alibaba.excel.util.ListUtils; import com.alibaba.fastjson.JSON; -import com.cpop.api.tencent.wxWork.handler.WebHookSendHandler; import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; import com.cpop.core.base.entity.PageDomain; -import com.cpop.core.base.enums.SourceType; import com.cpop.core.base.exception.ServiceException; -import com.cpop.core.handler.TencentCosHandler; import com.cpop.core.service.RedisService; import com.cpop.core.utils.SpringUtils; import com.cpop.core.utils.file.FileUploadUtils; import com.cpop.core.utils.file.FileUtils; -import com.cpop.core.utils.sql.SqlUtils; -import com.cpop.core.utils.uuid.IdUtils; +import com.cpop.core.utils.SqlUtils; import com.cpop.jambox.business.entity.StoreExtend; import com.cpop.jambox.business.service.StoreExtendService; import com.cpop.jambox.framework.constant.JamboxCloudUrl; @@ -31,7 +26,6 @@ import com.cpop.oam.business.dto.DataImportDto; import com.cpop.oam.business.dto.DataImportParamsDto; import com.cpop.oam.business.vo.DataImportPageVo; import com.cpop.oam.framework.constant.OamRedisConstant; -import com.cpop.oam.framework.constant.WebHookKeyConstant; import com.cpop.system.business.vo.SysFileVo; import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.query.QueryWrapper; @@ -41,17 +35,14 @@ import com.cpop.oam.business.mapper.DataImportMapper; import com.cpop.oam.business.service.DataImportService; import com.qcloud.cos.model.UploadResult; import lombok.extern.slf4j.Slf4j; -import org.apache.http.conn.ConnectTimeoutException; import org.springframework.stereotype.Service; import org.springframework.web.client.RestTemplate; import org.springframework.web.multipart.MultipartFile; import java.io.File; import java.io.IOException; -import java.net.SocketTimeoutException; import java.time.LocalDate; import java.time.format.DateTimeFormatter; -import java.util.ArrayList; import java.util.List; import java.util.Map; import java.util.concurrent.locks.Lock; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/FinanceReimburseServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/FinanceReimburseServiceImpl.java index 2d4c3a2..3edd2f6 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/FinanceReimburseServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/FinanceReimburseServiceImpl.java @@ -4,15 +4,12 @@ import com.alibaba.fastjson.JSONObject; import com.cpop.api.tencent.wxWork.handler.WebHookSendHandler; import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.base.entity.LoginUser; import com.cpop.core.base.entity.PageDomain; import com.cpop.core.base.exception.ServiceException; import com.cpop.core.base.table.SysConfig; -import com.cpop.core.service.CoreService; import com.cpop.core.service.RedisService; -import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.cpop.oam.business.bo.*; import com.cpop.oam.business.entity.FinanceReimburse; import com.cpop.oam.business.entity.FinanceReimburseStage; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/OamMallServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/OamMallServiceImpl.java index a7acc3b..43bef00 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/OamMallServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/OamMallServiceImpl.java @@ -3,23 +3,15 @@ package com.cpop.oam.business.service.impl; import com.alibaba.fastjson.JSONObject; import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.base.entity.LoginUser; import com.cpop.core.base.entity.PageDomain; -import com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo; -import com.cpop.core.base.enums.InitRoleEnum; -import com.cpop.core.base.enums.SourceType; +import com.cpop.system.framework.enums.InitRoleEnum; import com.cpop.core.base.enums.UserType; import com.cpop.core.base.exception.ServiceException; import com.cpop.core.base.table.SysUser; -import com.cpop.core.service.CoreService; -import com.cpop.core.service.RedisService; import com.cpop.core.utils.*; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.cpop.core.utils.uuid.IdUtils; import com.cpop.oam.business.bo.MallStaffBo; -import com.cpop.oam.business.bo.MallStaffPageBo; -import com.cpop.oam.business.bo.StaffBo; -import com.cpop.oam.business.entity.Staff; import com.cpop.oam.business.service.OamMallService; import com.cpop.oam.business.vo.MallStaffPageVo; import com.mybatisflex.core.paginate.Page; @@ -30,10 +22,8 @@ import org.springframework.transaction.annotation.Transactional; import java.time.LocalDateTime; import java.util.Arrays; -import java.util.List; import static com.cpop.core.base.table.table.SysUserTableDef.SYS_USER; -import static com.cpop.system.business.entity.table.RoleTableDef.ROLE; /** * @author DB diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/OamWxCpServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/OamWxCpServiceImpl.java index cfd1798..9a63d5e 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/OamWxCpServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/OamWxCpServiceImpl.java @@ -1,11 +1,10 @@ package com.cpop.oam.business.service.impl; import com.cpop.common.utils.StringUtils; -import com.cpop.core.base.enums.InitRoleEnum; +import com.cpop.system.framework.enums.InitRoleEnum; import com.cpop.core.base.enums.UserType; import com.cpop.core.base.exception.ServiceException; import com.cpop.core.base.table.SysUser; -import com.cpop.core.mapper.CoreMapper; import com.cpop.core.utils.*; import com.cpop.core.utils.uuid.IdUtils; import com.cpop.oam.business.bo.StaffBo; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/SignGoalServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/SignGoalServiceImpl.java index b585504..4b7137f 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/SignGoalServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/SignGoalServiceImpl.java @@ -4,14 +4,12 @@ import com.cpop.common.utils.bean.BeanUtils; import com.cpop.core.base.entity.PageDomain; import com.cpop.core.base.exception.ServiceException; import com.cpop.core.utils.SpringUtils; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.cpop.oam.business.bo.SignGoalBo; import com.cpop.oam.business.entity.SignArea; import com.cpop.oam.business.service.SignAreaService; import com.cpop.oam.business.vo.SignGoalPageVo; -import com.cpop.system.business.vo.StoreRenewPageVo; import com.mybatisflex.core.paginate.Page; -import com.mybatisflex.core.query.QueryColumn; import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.spring.service.impl.ServiceImpl; import com.cpop.oam.business.entity.SignGoal; @@ -26,7 +24,6 @@ import java.util.List; import static com.cpop.oam.business.entity.table.SignAreaTableDef.SIGN_AREA; import static com.cpop.oam.business.entity.table.SignGoalTableDef.SIGN_GOAL; import static com.cpop.oam.business.entity.table.StaffTableDef.STAFF; -import static com.mybatisflex.core.query.QueryMethods.*; /** * 签约目标表 服务层实现。 diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/StaffServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/StaffServiceImpl.java index 7849389..56e53d1 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/StaffServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/StaffServiceImpl.java @@ -4,16 +4,14 @@ import com.alibaba.fastjson.JSONObject; import com.cpop.common.constant.Constants; import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.base.entity.LoginUser; import com.cpop.core.base.entity.PageDomain; import com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo; import com.cpop.core.base.enums.UserType; import com.cpop.core.base.exception.ServiceException; import com.cpop.core.base.table.SysUser; -import com.cpop.core.service.CoreService; import com.cpop.core.service.RedisService; import com.cpop.core.utils.*; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.cpop.core.utils.uuid.IdUtils; import com.cpop.jambox.framework.constant.JamboxCloudUrl; import com.cpop.oam.business.bo.*; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskDemandServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskDemandServiceImpl.java index 7ae5b02..31f61c6 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskDemandServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskDemandServiceImpl.java @@ -11,11 +11,9 @@ import com.cpop.core.base.entity.PageDomain; import com.cpop.core.base.enums.UserType; import com.cpop.core.base.exception.ServiceException; import com.cpop.core.base.table.SysConfig; -import com.cpop.core.service.CoreService; import com.cpop.core.service.RedisService; -import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.cpop.oam.business.bo.TaskDemandBo; import com.cpop.oam.business.bo.TaskDemandPageBo; import com.cpop.oam.business.bo.TaskDemandUrgentBo; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskServiceImpl.java index 68bd6db..744483b 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskServiceImpl.java @@ -9,13 +9,10 @@ import com.cpop.common.utils.bean.BeanUtils; import com.cpop.core.base.entity.PageDomain; import com.cpop.core.base.exception.ServiceException; import com.cpop.core.base.table.SysConfig; -import com.cpop.core.service.CoreService; import com.cpop.core.service.RedisService; -import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.cpop.oam.business.bo.*; -import com.cpop.oam.business.entity.DataImport; import com.cpop.oam.business.entity.Staff; import com.cpop.oam.business.entity.Task; import com.cpop.oam.business.entity.TaskStaffGroup; @@ -29,9 +26,6 @@ import com.cpop.oam.framework.constant.OamConfigKey; import com.cpop.oam.framework.constant.OamRedisConstant; import com.cpop.oam.framework.constant.WebHookKeyConstant; import com.cpop.oam.framework.enums.OamConfigEnum; -import com.cpop.system.business.entity.DictData; -import com.cpop.system.business.service.DictDataService; -import com.cpop.system.business.service.DictTypeService; import com.cpop.system.framework.utils.DictUtils; import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.query.QueryWrapper; @@ -46,7 +40,6 @@ import java.time.LocalDate; import java.time.LocalDateTime; import java.time.ZoneId; import java.time.format.DateTimeFormatter; -import java.time.temporal.ChronoUnit; import java.time.temporal.TemporalAdjusters; import java.util.*; import java.util.concurrent.atomic.AtomicReference; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskStaffGroupServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskStaffGroupServiceImpl.java index 1e94214..fe4e79a 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskStaffGroupServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskStaffGroupServiceImpl.java @@ -6,12 +6,7 @@ import com.mybatisflex.spring.service.impl.ServiceImpl; import com.cpop.api.tencent.wxWork.handler.WebHookSendHandler; import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.base.entity.LoginUser; -import com.cpop.core.base.entity.loginInfo.OamStaffLoginInfo; -import com.cpop.core.base.enums.UserType; import com.cpop.core.base.exception.ServiceException; -import com.cpop.core.service.RedisService; -import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; import com.cpop.oam.business.bo.TaskStaffGroupBo; import com.cpop.oam.business.entity.Task; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskWorkOrderServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskWorkOrderServiceImpl.java index 165b473..3c32bda 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskWorkOrderServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskWorkOrderServiceImpl.java @@ -10,9 +10,8 @@ import com.cpop.core.base.exception.ServiceException; import com.cpop.core.base.exception.UtilException; import com.cpop.core.service.RedisService; import com.cpop.core.utils.QuartzUtils; -import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.cpop.oam.business.bo.*; import com.cpop.oam.business.dto.TaskWorkOrderReceiveDealPauseDto; import com.cpop.oam.business.entity.*; @@ -71,7 +70,7 @@ public class TaskWorkOrderServiceImpl extends ServiceImpl> + * @return com.cpop.core.base.entity.R> * @author DB * @since 2023/09/18 17:18 */ diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/FinanceReimburseAuditPageVo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/FinanceReimburseAuditPageVo.java index 24691a4..d7529b9 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/FinanceReimburseAuditPageVo.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/FinanceReimburseAuditPageVo.java @@ -1,6 +1,5 @@ package com.cpop.oam.business.vo; -import com.cpop.core.annontation.StringArrayConvert; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/PersonTaskPageVo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/PersonTaskPageVo.java index f90b3d8..e7a43a3 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/PersonTaskPageVo.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/PersonTaskPageVo.java @@ -1,6 +1,6 @@ package com.cpop.oam.business.vo; -import com.cpop.core.annontation.StringArrayConvert; +import com.cpop.core.anno.StringArrayConvert; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; @@ -8,7 +8,6 @@ import lombok.Data; import lombok.experimental.Accessors; import java.io.Serializable; -import java.sql.Timestamp; import java.time.LocalDate; import java.time.LocalDateTime; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/StaffPageVo.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/StaffPageVo.java index 270bb28..c1851d2 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/StaffPageVo.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/vo/StaffPageVo.java @@ -1,6 +1,6 @@ package com.cpop.oam.business.vo; -import com.cpop.core.annontation.StringArrayConvert; +import com.cpop.core.anno.StringArrayConvert; import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/framework/config/InitConfig.java b/Cpop-Oam/src/main/java/com/cpop/oam/framework/config/InitConfig.java index 780dabb..03ad51f 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/framework/config/InitConfig.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/framework/config/InitConfig.java @@ -1,28 +1,14 @@ package com.cpop.oam.framework.config; -import com.cpop.core.base.enums.InitRoleEnum; +import com.cpop.system.framework.enums.InitRoleEnum; import com.cpop.core.utils.SpringUtils; -import com.cpop.oam.business.entity.Task; -import com.cpop.oam.business.service.TaskService; import com.cpop.system.business.entity.Role; import com.cpop.system.business.service.RoleService; import lombok.extern.slf4j.Slf4j; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Profile; -import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; -import java.time.Duration; -import java.time.LocalDate; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - -import static com.cpop.oam.business.entity.table.TaskTableDef.TASK; -import static org.springframework.integration.config.xml.IntegrationNamespaceUtils.ROLE; - /** * 初始化配置 * @author DB diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/framework/strategy/cloud/CloudSyncBrandOrStoreCallbackStrategy.java b/Cpop-Oam/src/main/java/com/cpop/oam/framework/strategy/cloud/CloudSyncBrandOrStoreCallbackStrategy.java index 2ae39fd..e14026d 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/framework/strategy/cloud/CloudSyncBrandOrStoreCallbackStrategy.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/framework/strategy/cloud/CloudSyncBrandOrStoreCallbackStrategy.java @@ -1,9 +1,6 @@ package com.cpop.oam.framework.strategy.cloud; import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.base.entity.LoginUser; -import com.cpop.core.base.enums.SourceType; -import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; import com.cpop.oam.business.bo.CloudUnionCallbackBo; import com.cpop.system.business.bo.SyncBrandAndStoreBo; diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/framework/tasks/OamScheduledTasks.java b/Cpop-Oam/src/main/java/com/cpop/oam/framework/tasks/OamScheduledTasks.java index 2e1110c..056f275 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/framework/tasks/OamScheduledTasks.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/framework/tasks/OamScheduledTasks.java @@ -7,7 +7,6 @@ import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; import com.cpop.core.base.exception.ServiceException; import com.cpop.core.base.table.SysConfig; -import com.cpop.core.service.CoreService; import com.cpop.core.service.RedisService; import com.cpop.core.utils.SpringUtils; import com.cpop.jambox.business.entity.StoreActive; @@ -43,7 +42,6 @@ import java.util.stream.Collectors; import static com.cpop.oam.business.entity.table.ClueTableDef.CLUE; import static com.cpop.oam.business.entity.table.TaskTableDef.TASK; -import static com.cpop.system.business.entity.table.StoreTableDef.STORE; /** diff --git a/Cpop-Pay/src/main/java/com/cpop/pay/framewok/handler/wxPay/WxPayHandler.java b/Cpop-Pay/src/main/java/com/cpop/pay/framewok/handler/wxPay/WxPayHandler.java index 68a6eba..db9935a 100644 --- a/Cpop-Pay/src/main/java/com/cpop/pay/framewok/handler/wxPay/WxPayHandler.java +++ b/Cpop-Pay/src/main/java/com/cpop/pay/framewok/handler/wxPay/WxPayHandler.java @@ -4,9 +4,6 @@ import com.alibaba.fastjson.JSONObject; import com.cpop.common.utils.ServletUtils; import com.cpop.common.utils.StringUtils; import com.cpop.core.base.exception.ServiceException; -import com.cpop.core.utils.SecurityUtils; -import com.cpop.core.utils.SpringUtils; -import com.cpop.pay.framewok.config.wxPay.WxPayConfiguration; import com.github.binarywang.wxpay.bean.ecommerce.SignatureHeader; import com.github.binarywang.wxpay.config.WxPayConfig; import com.github.binarywang.wxpay.service.WxPayService; diff --git a/Cpop-Pay/src/main/java/com/cpop/pay/framewok/task/WxPayAsyncTask.java b/Cpop-Pay/src/main/java/com/cpop/pay/framewok/task/WxPayAsyncTask.java index 65a865c..b07b30d 100644 --- a/Cpop-Pay/src/main/java/com/cpop/pay/framewok/task/WxPayAsyncTask.java +++ b/Cpop-Pay/src/main/java/com/cpop/pay/framewok/task/WxPayAsyncTask.java @@ -1,6 +1,5 @@ package com.cpop.pay.framewok.task; -import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.cpop.api.tencent.wxWork.handler.WebHookSendHandler; import com.cpop.common.utils.StringUtils; diff --git a/Cpop-System/pom.xml b/Cpop-System/pom.xml index 4610cb9..17ca185 100644 --- a/Cpop-System/pom.xml +++ b/Cpop-System/pom.xml @@ -19,11 +19,6 @@ com.cpop Cpop-Core - - - org.springframework.boot - spring-boot-starter-websocket - com.cpop Cpop-Api diff --git a/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageBrandController.java b/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageBrandController.java index 08173cc..b1e94b3 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageBrandController.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageBrandController.java @@ -3,8 +3,7 @@ package com.cpop.system.business.controller.backstage; import com.cpop.api.cloudDb.core.dto.CloudBrandDto; import com.cpop.api.cloudDb.handler.CloudBrandHandler; import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.base.R; -import com.cpop.core.base.enums.SourceType; +import com.cpop.core.base.entity.R; import com.cpop.core.utils.SpringUtils; import com.cpop.system.business.bo.BrandBo; import com.cpop.system.business.vo.BrandPageVo; @@ -48,7 +47,7 @@ public class BackstageBrandController { * @author DB * @date 2023/10/25 16:53 * @param bo 品牌参数 - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @PostMapping("/insertSysBrand") @ApiOperation("新增系统品牌") @@ -64,7 +63,7 @@ public class BackstageBrandController { * @author DB * @date 2023/11/10 9:21 * @param bo 品牌参数 - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @ApiOperation("修改系统品牌") @PutMapping("/updateSysBrand") @@ -101,7 +100,7 @@ public class BackstageBrandController { * @author DB * @date 2023/09/13 17:55 * @param brandName 请求参数 - * @return com.cpop.core.base.R> + * @return com.cpop.core.base.entity.R> */ @ApiOperation("查询品牌分页列表") @GetMapping("/getBrandPage") @@ -116,7 +115,7 @@ public class BackstageBrandController { * @author DB * @date 2023/11/09 10:31 * @param id 主键 - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @ApiOperation("根据品牌id删除品牌") @DeleteMapping("/removeBrandById/{id}") diff --git a/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageDictDataController.java b/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageDictDataController.java index ff8481b..bdfd10c 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageDictDataController.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageDictDataController.java @@ -1,12 +1,9 @@ package com.cpop.system.business.controller.backstage; import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.base.R; -import com.cpop.core.utils.SpringUtils; +import com.cpop.core.base.entity.R; import com.cpop.system.business.bo.DictDataBo; import com.cpop.system.business.bo.DictDataPageBo; -import com.cpop.system.business.entity.DictType; -import com.cpop.system.business.service.DictTypeService; import com.cpop.system.business.vo.DictDataListVo; import com.cpop.system.business.vo.DictDataPageVo; import com.cpop.system.business.vo.DictDataVo; @@ -27,7 +24,6 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; -import java.io.Serializable; import java.util.List; /** diff --git a/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageDictTypeController.java b/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageDictTypeController.java index c6b69fa..4c09dc4 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageDictTypeController.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageDictTypeController.java @@ -1,16 +1,13 @@ package com.cpop.system.business.controller.backstage; import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.base.R; -import com.cpop.core.base.entity.LoginUser; +import com.cpop.core.base.entity.R; import com.cpop.core.base.exception.ServiceException; -import com.cpop.core.utils.SecurityUtils; import com.cpop.system.business.bo.DictTypeBo; import com.cpop.system.business.vo.DictTypePageVo; import com.cpop.system.business.vo.DictTypeVo; import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.query.QueryWrapper; -import lombok.extern.java.Log; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.DeleteMapping; @@ -28,7 +25,6 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; -import java.io.Serializable; import java.util.List; import static com.cpop.system.business.entity.table.DictTypeTableDef.DICT_TYPE; diff --git a/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageLoginController.java b/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageLoginController.java index 15334da..4094c58 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageLoginController.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageLoginController.java @@ -1,6 +1,6 @@ package com.cpop.system.business.controller.backstage; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.system.business.service.LoginService; import com.cpop.system.business.vo.LoginUserInfoVo; import com.cpop.system.business.vo.MenuRouteVo; diff --git a/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageMenuController.java b/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageMenuController.java index a69df44..4a6f6bc 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageMenuController.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageMenuController.java @@ -1,8 +1,6 @@ package com.cpop.system.business.controller.backstage; -import com.cpop.core.annontation.OperationLog; -import com.cpop.core.base.R; -import com.cpop.core.base.enums.OperationLogEnum; +import com.cpop.core.base.entity.R; import com.cpop.system.business.bo.MenuBo; import com.cpop.system.business.bo.MenuListBo; import com.cpop.system.business.service.MenuService; diff --git a/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageRoleController.java b/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageRoleController.java index 1314bf4..3283352 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageRoleController.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageRoleController.java @@ -1,6 +1,6 @@ package com.cpop.system.business.controller.backstage; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.system.business.bo.MenuListBo; import com.cpop.system.business.bo.RoleBo; import com.cpop.system.business.bo.RolePageBo; @@ -56,7 +56,7 @@ public class BackstageRoleController { * @author DB * @date 2023/10/12 10:48 * @param bo 请求参数 - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @PreAuthorize("@aps.hasPermission('system:role:insert')") @ApiOperation("新增角色") diff --git a/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageStoreController.java b/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageStoreController.java index 7569e84..8aa8050 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageStoreController.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageStoreController.java @@ -1,6 +1,6 @@ package com.cpop.system.business.controller.backstage; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.system.business.bo.StoreBo; import com.cpop.system.business.bo.StorePageBo; import com.cpop.system.business.bo.StoreRenewBo; diff --git a/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageStoreSignController.java b/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageStoreSignController.java index 54ad667..fc37dba 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageStoreSignController.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageStoreSignController.java @@ -1,7 +1,7 @@ package com.cpop.system.business.controller.backstage; import com.alibaba.excel.EasyExcel; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.system.business.bo.StoreRenewPageBo; import com.cpop.system.business.bo.StoreRenewXmlBo; import com.cpop.system.business.bo.StoreRunOffBo; diff --git a/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageSysCommonController.java b/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageSysCommonController.java index 917566d..3569ea8 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageSysCommonController.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/controller/backstage/BackstageSysCommonController.java @@ -1,12 +1,10 @@ package com.cpop.system.business.controller.backstage; -import com.cpop.core.base.R; +import com.cpop.core.base.entity.R; import com.cpop.core.config.CpopConfig; import com.cpop.core.config.ServerConfig; -import com.cpop.core.handler.TencentCosHandler; import com.cpop.core.utils.file.FileUploadUtils; import com.cpop.core.utils.file.FileUtils; -import com.cpop.system.business.bo.SyncBrandAndStoreBo; import com.cpop.system.business.service.StoreService; import com.cpop.system.business.vo.SysFileVo; import com.qcloud.cos.model.UploadResult; @@ -15,7 +13,6 @@ import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; 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; @@ -74,7 +71,7 @@ public class BackstageSysCommonController { * @author DB * @date 2023/10/31 17:24 * @param file 文件 - * @return: com.cpop.core.base.R + * @return: com.cpop.core.base.entity.R */ @ApiOperation("cdn加速上传") @PostMapping("/cdnUpload") diff --git a/Cpop-System/src/main/java/com/cpop/system/business/controller/mini/MiniSysCommonController.java b/Cpop-System/src/main/java/com/cpop/system/business/controller/mini/MiniSysCommonController.java index ce3ce70..64fff7f 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/controller/mini/MiniSysCommonController.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/controller/mini/MiniSysCommonController.java @@ -1,14 +1,8 @@ package com.cpop.system.business.controller.mini; -import com.cpop.core.base.R; -import com.cpop.core.config.CpopConfig; -import com.cpop.core.config.ServerConfig; -import com.cpop.core.handler.TencentCosHandler; -import com.cpop.core.utils.file.FileUploadUtils; -import com.cpop.core.utils.file.FileUtils; +import com.cpop.core.base.entity.R; import com.cpop.system.business.bo.SyncBrandAndStoreBo; import com.cpop.system.business.service.StoreService; -import com.cpop.system.business.vo.SysFileVo; import com.qcloud.cos.model.UploadResult; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; @@ -18,7 +12,6 @@ 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; /** * @author DB diff --git a/Cpop-System/src/main/java/com/cpop/system/business/entity/Brand.java b/Cpop-System/src/main/java/com/cpop/system/business/entity/Brand.java index b20c319..7c56640 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/entity/Brand.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/entity/Brand.java @@ -3,12 +3,11 @@ package com.cpop.system.business.entity; import com.cpop.core.base.entity.BaseEntity; import com.cpop.core.base.entity.BaseInsertListener; import com.cpop.core.base.entity.BaseUpdateListener; -import com.cpop.core.base.enums.SourceType; import com.mybatisflex.annotation.Column; import com.mybatisflex.annotation.Id; import com.mybatisflex.annotation.Table; import java.io.Serializable; -import java.time.LocalDateTime; + import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.*; diff --git a/Cpop-System/src/main/java/com/cpop/system/business/service/DictTypeService.java b/Cpop-System/src/main/java/com/cpop/system/business/service/DictTypeService.java index 0f53705..db0e829 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/service/DictTypeService.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/service/DictTypeService.java @@ -1,6 +1,5 @@ package com.cpop.system.business.service; -import com.cpop.core.base.R; import com.cpop.system.business.bo.DictTypeBo; import com.cpop.system.business.vo.DictTypePageVo; import com.mybatisflex.core.paginate.Page; diff --git a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/BrandServiceImpl.java b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/BrandServiceImpl.java index 019ae90..b56955e 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/BrandServiceImpl.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/BrandServiceImpl.java @@ -1,13 +1,10 @@ package com.cpop.system.business.service.impl; import com.cpop.common.utils.StringUtils; -import com.cpop.core.base.entity.LoginUser; import com.cpop.core.base.entity.PageDomain; -import com.cpop.core.base.enums.SourceType; import com.cpop.core.base.exception.ServiceException; -import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.cpop.system.business.entity.Store; import com.cpop.system.business.entity.StoreLicense; import com.cpop.system.business.service.StoreLicenseService; diff --git a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/DictDataServiceImpl.java b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/DictDataServiceImpl.java index 1641643..f75b143 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/DictDataServiceImpl.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/DictDataServiceImpl.java @@ -2,14 +2,10 @@ package com.cpop.system.business.service.impl; import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.base.entity.LoginUser; import com.cpop.core.base.entity.PageDomain; -import com.cpop.core.utils.SecurityUtils; -import com.cpop.core.utils.SpringUtils; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.cpop.system.business.bo.DictDataBo; import com.cpop.system.business.bo.DictDataPageBo; -import com.cpop.system.business.vo.DictDataListVo; import com.cpop.system.business.vo.DictDataPageVo; import com.cpop.system.business.vo.DictDataVo; import com.cpop.system.framework.utils.DictUtils; @@ -23,7 +19,6 @@ import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import java.util.ArrayList; -import java.util.Comparator; import java.util.List; import java.util.stream.Collectors; diff --git a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/DictTypeServiceImpl.java b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/DictTypeServiceImpl.java index 5abe110..8de2d6e 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/DictTypeServiceImpl.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/DictTypeServiceImpl.java @@ -1,12 +1,10 @@ package com.cpop.system.business.service.impl; import com.cpop.common.utils.StringUtils; -import com.cpop.core.base.entity.LoginUser; import com.cpop.core.base.entity.PageDomain; import com.cpop.core.base.exception.ServiceException; -import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.cpop.system.business.bo.DictTypeBo; import com.cpop.system.business.entity.DictData; import com.cpop.system.business.service.DictDataService; diff --git a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/LoginServiceImpl.java b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/LoginServiceImpl.java index 07a9b87..fc91045 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/LoginServiceImpl.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/LoginServiceImpl.java @@ -2,10 +2,7 @@ package com.cpop.system.business.service.impl; import com.alibaba.fastjson.JSONObject; import com.cpop.common.constant.Constants; -import com.cpop.core.base.entity.LoginUser; -import com.cpop.core.utils.SecurityUtils; import com.cpop.system.business.entity.Menu; -import com.cpop.system.business.entity.Role; import com.cpop.system.business.service.LoginService; import com.cpop.system.business.service.MenuService; import com.cpop.system.business.vo.LoginUserInfoVo; @@ -17,8 +14,6 @@ import java.util.Collections; import java.util.List; import java.util.Set; import com.cpop.core.utils.SpringUtils; -import com.cpop.system.framework.ws.server.WebSocketServer; -import com.cpop.system.business.service.RoleService; import static com.cpop.system.business.entity.table.MenuTableDef.MENU; import static com.cpop.system.business.entity.table.RoleMenuTableDef.ROLE_MENU; diff --git a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/MenuServiceImpl.java b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/MenuServiceImpl.java index 091cf00..d3fa85f 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/MenuServiceImpl.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/MenuServiceImpl.java @@ -4,10 +4,8 @@ import com.alibaba.fastjson.JSONObject; import com.cpop.common.constant.Constants; import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.base.entity.LoginUser; -import com.cpop.core.base.enums.InitRoleEnum; +import com.cpop.system.framework.enums.InitRoleEnum; import com.cpop.core.base.exception.ServiceException; -import com.cpop.core.utils.SecurityUtils; import com.cpop.system.business.bo.MenuBo; import com.cpop.system.business.bo.MenuListBo; import com.cpop.system.business.entity.Menu; diff --git a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/RoleServiceImpl.java b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/RoleServiceImpl.java index 981658c..fbc26d1 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/RoleServiceImpl.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/RoleServiceImpl.java @@ -3,12 +3,10 @@ package com.cpop.system.business.service.impl; import com.cpop.common.constant.Constants; import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.base.entity.LoginUser; import com.cpop.core.base.entity.PageDomain; -import com.cpop.core.base.enums.InitRoleEnum; -import com.cpop.core.utils.SecurityUtils; +import com.cpop.system.framework.enums.InitRoleEnum; import com.cpop.core.utils.SpringUtils; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.cpop.system.business.bo.RoleBo; import com.cpop.system.business.bo.RolePageBo; import com.cpop.system.business.bo.RoleStatusBo; diff --git a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/StoreRenewServiceImpl.java b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/StoreRenewServiceImpl.java index 2a9df4e..9dedf4f 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/StoreRenewServiceImpl.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/StoreRenewServiceImpl.java @@ -6,8 +6,6 @@ import com.cpop.common.constant.Constants; import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; import com.cpop.core.service.RedisService; -import com.cpop.core.service.impl.RedisServiceImpl; -import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; import com.cpop.system.business.bo.StoreRenewBo; import com.cpop.system.business.service.StoreService; @@ -22,8 +20,6 @@ import com.cpop.system.business.entity.StoreRenew; import com.cpop.system.business.mapper.StoreRenewMapper; import com.cpop.system.business.service.StoreRenewService; import org.bouncycastle.util.StoreException; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Profile; import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.TimeoutUtils; import org.springframework.stereotype.Service; diff --git a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/StoreServiceImpl.java b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/StoreServiceImpl.java index c281313..9af6cb4 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/StoreServiceImpl.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/StoreServiceImpl.java @@ -12,12 +12,9 @@ import com.cpop.api.cloudDb.core.dto.CloudStoreDto; import com.cpop.api.cloudDb.handler.CloudStoreHandler; import com.cpop.api.tencent.location.handler.TencentLocationHandler; import com.cpop.common.utils.bean.BeanUtils; -import com.cpop.core.base.entity.LoginUser; import com.cpop.core.base.entity.PageDomain; -import com.cpop.core.base.enums.SourceType; -import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.cpop.system.business.bo.StoreBo; import com.cpop.system.business.bo.StorePageBo; import com.cpop.system.business.bo.SyncBrandAndStoreBo; diff --git a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/StoreSignServiceImpl.java b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/StoreSignServiceImpl.java index d4abb34..1eddb36 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/StoreSignServiceImpl.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/StoreSignServiceImpl.java @@ -3,7 +3,7 @@ package com.cpop.system.business.service.impl; import com.cpop.common.utils.StringUtils; import com.cpop.core.base.entity.PageDomain; import com.cpop.core.utils.SpringUtils; -import com.cpop.core.utils.sql.SqlUtils; +import com.cpop.core.utils.SqlUtils; import com.cpop.system.business.bo.StoreRenewPageBo; import com.cpop.system.business.bo.StoreRenewXmlBo; import com.cpop.system.business.bo.StoreRunOffBo; diff --git a/Cpop-System/src/main/java/com/cpop/system/business/vo/StorePageVo.java b/Cpop-System/src/main/java/com/cpop/system/business/vo/StorePageVo.java index f399feb..b536011 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/vo/StorePageVo.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/vo/StorePageVo.java @@ -9,8 +9,6 @@ import java.io.Serializable; import java.time.LocalDate; import java.time.LocalDateTime; -import com.cpop.core.base.enums.SourceType; - /** * 校区/店铺分页返回对象 * @author DB diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/enums/InitRoleEnum.java b/Cpop-System/src/main/java/com/cpop/system/framework/enums/InitRoleEnum.java similarity index 94% rename from Cpop-Core/src/main/java/com/cpop/core/base/enums/InitRoleEnum.java rename to Cpop-System/src/main/java/com/cpop/system/framework/enums/InitRoleEnum.java index 1e80a28..3e41023 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/base/enums/InitRoleEnum.java +++ b/Cpop-System/src/main/java/com/cpop/system/framework/enums/InitRoleEnum.java @@ -1,5 +1,6 @@ -package com.cpop.core.base.enums; +package com.cpop.system.framework.enums; +import com.cpop.core.base.enums.UserType; import lombok.Getter; /** diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/enums/OrderSource.java b/Cpop-System/src/main/java/com/cpop/system/framework/enums/OrderSource.java similarity index 93% rename from Cpop-Core/src/main/java/com/cpop/core/base/enums/OrderSource.java rename to Cpop-System/src/main/java/com/cpop/system/framework/enums/OrderSource.java index fb981da..748e851 100644 --- a/Cpop-Core/src/main/java/com/cpop/core/base/enums/OrderSource.java +++ b/Cpop-System/src/main/java/com/cpop/system/framework/enums/OrderSource.java @@ -1,4 +1,4 @@ -package com.cpop.core.base.enums; +package com.cpop.system.framework.enums; import lombok.Getter; diff --git a/Cpop-System/src/main/java/com/cpop/system/framework/utils/DictUtils.java b/Cpop-System/src/main/java/com/cpop/system/framework/utils/DictUtils.java index c6f6378..4a850cc 100644 --- a/Cpop-System/src/main/java/com/cpop/system/framework/utils/DictUtils.java +++ b/Cpop-System/src/main/java/com/cpop/system/framework/utils/DictUtils.java @@ -4,10 +4,8 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson2.JSONObject; import com.cpop.common.constant.Constants; import com.cpop.common.utils.StringUtils; -import com.cpop.core.base.entity.LoginUser; import com.cpop.core.base.enums.UserType; import com.cpop.core.service.RedisService; -import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; import com.cpop.system.business.entity.DictData; import org.springframework.data.redis.cache.RedisCache; diff --git a/pom.xml b/pom.xml index fa28ac7..9edf924 100644 --- a/pom.xml +++ b/pom.xml @@ -16,7 +16,6 @@ pom - Cpop-Common Cpop-Core Cpop-Generator Cpop-Api @@ -51,12 +50,6 @@ - - - com.cpop - Cpop-Common - ${cpop.version} - com.cpop @@ -181,12 +174,12 @@ knife4j-openapi3-jakarta-spring-boot-starter ${knife4j.version} + com.tencentcloudapi tencentcloud-sdk-java ${tencentcloud.version} - com.qcloud cos_api @@ -204,6 +197,18 @@ weixin-java-open ${wxJava.version} + + + com.github.binarywang + weixin-java-cp + ${wxJava.version} + + + + com.github.binarywang + weixin-java-miniapp + ${wxJava.version} +