├── .gitignore ├── INFO.md ├── LICENSE ├── README.md ├── change_version.sh ├── conch-boot-project ├── conch-boot-autoconfigure │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── nabob │ │ │ └── conch │ │ │ └── boot │ │ │ └── autoconfigure │ │ │ ├── antiscrapy │ │ │ ├── AntiSecurityAutoConfiguration.java │ │ │ ├── AntiSecurityProperties.java │ │ │ └── strategy │ │ │ │ ├── AbstractSecurityStrategy.java │ │ │ │ ├── IpAndUaSecurityStrategy.java │ │ │ │ ├── IpSecurityStrategy.java │ │ │ │ └── PhoneSecurityStrategy.java │ │ │ ├── datasource │ │ │ ├── ApiBootDataSourceSwitchAutoConfiguration.java │ │ │ └── ApiBootDataSourceSwitchProperties.java │ │ │ ├── dingtalk │ │ │ ├── DingtalkChatbotAutoConfiguration.java │ │ │ └── DingtalkChatbotProperties.java │ │ │ ├── enhance │ │ │ ├── ApiBootMyBatisEnhanceAutoConfiguration.java │ │ │ ├── ApiBootMyBatisEnhanceProperties.java │ │ │ ├── ConfigurationCustomizer.java │ │ │ └── SpringBootVFS.java │ │ │ ├── mail │ │ │ ├── MailAutoConfiguration.java │ │ │ └── MailSenderProperties.java │ │ │ ├── minio │ │ │ ├── MinioAutoConfiguration.java │ │ │ └── MinioProperties.java │ │ │ ├── mongo │ │ │ ├── ConchMongoDataAutoConfiguration.java │ │ │ └── package-info.java │ │ │ ├── mutiles │ │ │ ├── ConchMutilElasticsearchAutoConfiguration.java │ │ │ ├── ConchMutilElasticsearchJestAutoConfiguration.java │ │ │ ├── ConchMutilElasticsearchJestProperties.java │ │ │ └── ConchMutilElasticsearchProperties.java │ │ │ ├── oauth │ │ │ ├── ApiBootAuthorizationMemoryServerAutoConfiguration.java │ │ │ ├── ApiBootAuthorizationServerAutoConfiguration.java │ │ │ ├── ApiBootAuthorizationServerJdbcAutoConfiguration.java │ │ │ ├── ApiBootAuthorizationServerRedisAutoConfiguration.java │ │ │ ├── ApiBootOauthProperties.java │ │ │ ├── ApiBootResourceServerAutoConfiguration.java │ │ │ └── OAuthAway.java │ │ │ ├── pageable │ │ │ ├── ApiBootMyBatisPageableProperties.java │ │ │ └── ApiBootMybatisPageableAutoConfiguration.java │ │ │ ├── quartz │ │ │ ├── ApiBootQuartzAutoConfiguration.java │ │ │ ├── ApiBootQuartzDataSourceInitializer.java │ │ │ ├── ApiBootQuartzProperties.java │ │ │ └── PropKey.java │ │ │ ├── redis │ │ │ ├── ConchRedisAutoConfiguration.java │ │ │ ├── ConchRedisProperties.java │ │ │ └── ConchRedissonConfiguration.java │ │ │ ├── retrofit │ │ │ ├── RetrofitClientAutoConfiguration.java │ │ │ └── RetrofitClientProperties.java │ │ │ ├── security │ │ │ ├── ApiBootSecurityProperties.java │ │ │ ├── ApiBootWebSecurityAutoConfiguration.java │ │ │ ├── ApiBootWebSecurityJdbcAutoConfiguration.java │ │ │ ├── ApiBootWebSecurityMemoryAutoConfiguration.java │ │ │ └── SecurityAway.java │ │ │ ├── sqlinit │ │ │ ├── ConchSqlInitAutoConfiguration.java │ │ │ ├── DoNothingCallbackHandler.java │ │ │ ├── SqlExecutor.java │ │ │ └── SqlFileInitializer.java │ │ │ └── zookeeper │ │ │ ├── ConchZookeeperAutoConfiguration.java │ │ │ └── ConchZookeeperProperties.java │ │ └── resources │ │ ├── META-INF │ │ ├── additional-spring-configuration-metadata.json │ │ └── spring.factories │ │ └── banner.txt ├── conch-boot-core │ ├── anti-scrapy-conch-boot │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── nabob │ │ │ └── conch │ │ │ └── antiscrapy │ │ │ ├── AntiSecurityService.java │ │ │ ├── common │ │ │ └── SecurityConstants.java │ │ │ ├── handler │ │ │ ├── RedisStrategyHandler.java │ │ │ └── StrategyHandler.java │ │ │ ├── strategy │ │ │ ├── SecurityStrategy.java │ │ │ └── SecurityStrategyFactory.java │ │ │ └── utils │ │ │ └── RedisKeyUtils.java │ ├── datasource-conch-boot │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── nabob │ │ │ └── conch │ │ │ └── datasource │ │ │ ├── ApiBootDataSource.java │ │ │ ├── ApiBootDataSourceFactoryBean.java │ │ │ ├── DataSourceTypeNames.java │ │ │ ├── annotation │ │ │ └── DataSourceSwitch.java │ │ │ ├── aop │ │ │ ├── advistor │ │ │ │ └── ApiBootDataSourceSwitchAdvisor.java │ │ │ └── interceptor │ │ │ │ └── ApiBootDataSourceSwitchAnnotationInterceptor.java │ │ │ ├── config │ │ │ ├── DataSourceConfig.java │ │ │ ├── DataSourceDruidConfig.java │ │ │ └── DataSourceHikariConfig.java │ │ │ ├── routing │ │ │ ├── ApiBootRoutingDataSource.java │ │ │ └── DataSourceContextHolder.java │ │ │ └── support │ │ │ ├── ApiBootBasicDataSource.java │ │ │ ├── ApiBootDruidDataSource.java │ │ │ └── ApiBootHikariDataSource.java │ ├── dingtalk-conch-boot │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── nabob │ │ │ └── conch │ │ │ └── dingtalk │ │ │ ├── DingtalkChatbotClient.java │ │ │ ├── Message.java │ │ │ ├── SendResult.java │ │ │ └── TextMessage.java │ ├── minio-conch-boot │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── nabob │ │ │ └── conch │ │ │ └── minio │ │ │ └── MinioTemplate.java │ ├── mongo-conch-boot │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── nabob │ │ │ └── conch │ │ │ └── mongo │ │ │ ├── dao │ │ │ ├── GridDao.java │ │ │ └── impl │ │ │ │ └── GridDaoImpl.java │ │ │ └── model │ │ │ └── MongoFile.java │ ├── oauth-conch-boot │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── nabob │ │ │ └── conch │ │ │ └── oauth │ │ │ ├── ApiBootAuthorizationServerConfiguration.java │ │ │ ├── exception │ │ │ └── ApiBootTokenException.java │ │ │ └── grant │ │ │ ├── ApiBootOauthTokenGranter.java │ │ │ └── DefaultApiBootOauthTokenGranter.java │ ├── pom.xml │ ├── quartz-conch-boot │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── nabob │ │ │ └── conch │ │ │ └── quartz │ │ │ ├── ApiBootQuartzService.java │ │ │ ├── support │ │ │ └── ApiBootQuartzServiceDefaultSupport.java │ │ │ └── wrapper │ │ │ ├── ApiBootJobParamWrapper.java │ │ │ ├── ApiBootJobWrapper.java │ │ │ └── support │ │ │ ├── ApiBootCronJobWrapper.java │ │ │ ├── ApiBootLoopJobWrapper.java │ │ │ └── ApiBootOnceJobWrapper.java │ ├── redis-conch-boot │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── nabob │ │ │ └── conch │ │ │ └── redis │ │ │ ├── AbstractRedisUtil.java │ │ │ ├── MessageListener.java │ │ │ ├── RedisGenericUtil.java │ │ │ ├── RedisSerializers.java │ │ │ └── redisson │ │ │ └── RedissonUtils.java │ ├── retrofit-conch-boot │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── nabob │ │ │ └── conch │ │ │ └── retrofit │ │ │ ├── annotation │ │ │ ├── RetrofitClient.java │ │ │ └── RetrofitClientScan.java │ │ │ ├── config │ │ │ └── RetrofitClientScannerRegistrar.java │ │ │ ├── interceptor │ │ │ └── HttpLogInterceptor.java │ │ │ └── retrofit │ │ │ ├── DefaultOkHttpClientConnectionPoolFactory.java │ │ │ ├── DefaultOkHttpClientFactory.java │ │ │ ├── OkHttpClientConnectionPoolFactory.java │ │ │ ├── OkHttpClientFactory.java │ │ │ ├── RetrofitClientBuildDelegate.java │ │ │ └── RetrofitClientFactoryBean.java │ ├── security-conch-boot │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── nabob │ │ │ └── conch │ │ │ └── security │ │ │ ├── ApiBootWebSecurityConfiguration.java │ │ │ ├── SecurityUser.java │ │ │ ├── delegate │ │ │ ├── ApiBootDefaultStoreDelegate.java │ │ │ └── ApiBootStoreDelegate.java │ │ │ ├── handler │ │ │ └── ApiBootDefaultAccessDeniedHandler.java │ │ │ ├── jdbc │ │ │ └── ApiBootDefaultUserEntity.java │ │ │ ├── point │ │ │ └── ApiBootDefaultAuthenticationEntryPoint.java │ │ │ └── userdetails │ │ │ ├── ApiBootDefaultUserDetails.java │ │ │ └── ApiBootUserDetailsService.java │ ├── security-enhance-conch-boot │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── nabob │ │ │ └── conch │ │ │ └── security │ │ │ └── enhance │ │ │ ├── config │ │ │ └── ApiBootWebSecurityConfiguration.java │ │ │ ├── delegate │ │ │ └── ConchBootStoreDelegate.java │ │ │ ├── domain │ │ │ ├── LoginType.java │ │ │ ├── SecurityUser.java │ │ │ └── SecurityUserDetails.java │ │ │ ├── handler │ │ │ ├── ConchDefaultAccessDeniedHandler.java │ │ │ ├── ConchDefaultAuthenticationEntryPoint.java │ │ │ ├── FebsAuthenticationFailureHandler.java │ │ │ └── FebsAuthenticationSucessHandler.java │ │ │ └── service │ │ │ └── ConchUserDetailsService.java │ ├── tools-conch-boot │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── nabob │ │ │ └── conch │ │ │ └── tools │ │ │ ├── IdCard │ │ │ ├── AbstractIDCardInfo.java │ │ │ ├── IDCardInfo.java │ │ │ ├── IDCardInfo15.java │ │ │ ├── IDCardInfo18.java │ │ │ ├── IDCardUtil.java │ │ │ └── InvalidException.java │ │ │ ├── annotation │ │ │ ├── AnnotationAttributes.java │ │ │ └── BridgeMethodResolver.java │ │ │ ├── cast │ │ │ ├── Caster.java │ │ │ ├── CasterUtils.java │ │ │ ├── DoubleCaster.java │ │ │ ├── IntegerCaster.java │ │ │ ├── LongCaster.java │ │ │ └── StringCaster.java │ │ │ ├── code │ │ │ ├── AbstractServiceCode.java │ │ │ ├── BasicServiceCode.java │ │ │ ├── DefaultServiceCode.java │ │ │ └── ServiceCode.java │ │ │ ├── collections │ │ │ ├── BaseSmartStream.java │ │ │ ├── CrossJoinOnOp.java │ │ │ ├── LeftJoinCollectOp.java │ │ │ ├── LeftJoinMultiCollectOp.java │ │ │ ├── LeftJoinOnOp.java │ │ │ ├── MultimapExts.java │ │ │ └── SmartStream.java │ │ │ ├── constant │ │ │ └── SysConfig.java │ │ │ ├── cube │ │ │ ├── Absent.java │ │ │ ├── AbstractCube.java │ │ │ ├── AbstractIterator.java │ │ │ ├── Cube.java │ │ │ ├── LightAbsent.java │ │ │ ├── LightPresent.java │ │ │ └── Present.java │ │ │ ├── enums │ │ │ └── YesOrNo.java │ │ │ ├── function │ │ │ ├── BiConsumer.java │ │ │ ├── Generator.java │ │ │ ├── Holder.java │ │ │ ├── Pair.java │ │ │ ├── RunnableWithError.java │ │ │ └── TwoArgFunc.java │ │ │ ├── functions │ │ │ ├── Consumers.java │ │ │ ├── Functions.java │ │ │ ├── Predicates.java │ │ │ ├── Suppliers.java │ │ │ ├── ThrowableBiConsumer.java │ │ │ ├── ThrowableBiFunction.java │ │ │ ├── ThrowableBiPredicate.java │ │ │ ├── ThrowableConsumer.java │ │ │ ├── ThrowableDoubleConsumer.java │ │ │ ├── ThrowableDoubleFunction.java │ │ │ ├── ThrowableDoublePredicate.java │ │ │ ├── ThrowableDoubleSupplier.java │ │ │ ├── ThrowableFunction.java │ │ │ ├── ThrowableIntConsumer.java │ │ │ ├── ThrowableIntFunction.java │ │ │ ├── ThrowableIntPredicate.java │ │ │ ├── ThrowableIntSupplier.java │ │ │ ├── ThrowableLongConsumer.java │ │ │ ├── ThrowableLongFunction.java │ │ │ ├── ThrowableLongPredicate.java │ │ │ ├── ThrowableLongSupplier.java │ │ │ ├── ThrowablePredicate.java │ │ │ ├── ThrowableSupplier.java │ │ │ └── ThrowaleCallable.java │ │ │ ├── guard │ │ │ ├── AbstractGuard.java │ │ │ ├── DefaultGuard.java │ │ │ └── Guard.java │ │ │ ├── host │ │ │ ├── HostInfo.java │ │ │ ├── IpUtil.java │ │ │ └── NetworkUtil.java │ │ │ ├── image │ │ │ ├── Code.java │ │ │ ├── ImageGenerator.java │ │ │ └── impl │ │ │ │ ├── SimpleImageGenerator.java │ │ │ │ ├── VerifyCodeGenerator.java │ │ │ │ └── VerifyCodeUtils.java │ │ │ ├── json │ │ │ ├── BeanExtendUtils.java │ │ │ ├── GsonUtils.java │ │ │ └── GsonWrapUtils.java │ │ │ ├── locks │ │ │ └── LockWithCondition.java │ │ │ ├── mapext │ │ │ ├── LRULinkedHashMap.java │ │ │ └── MapWithList.java │ │ │ ├── parallel │ │ │ ├── AbstractParallelExecutor.java │ │ │ ├── CallableParallelTask.java │ │ │ ├── NamedParallelExecutorService.java │ │ │ ├── ParallelExecutor.java │ │ │ ├── ParallelExecutorService.java │ │ │ ├── ParallelFuture.java │ │ │ ├── ParallelTask.java │ │ │ └── ParallelTaskManager.java │ │ │ ├── pool │ │ │ ├── Pool.java │ │ │ └── SimplePool.java │ │ │ ├── properties │ │ │ ├── NativePath.java │ │ │ ├── PropertiesReader.java │ │ │ └── PropertiesUtil.java │ │ │ ├── security │ │ │ ├── AbstractEsSecret.java │ │ │ ├── AesSecret.java │ │ │ ├── DecryptSupport.java │ │ │ ├── Decryptor.java │ │ │ ├── DesSecret.java │ │ │ ├── EncryptSupport.java │ │ │ ├── Encryptor.java │ │ │ ├── EsAlgorithm.java │ │ │ ├── HashAlgorithm.java │ │ │ ├── HashEncryptor.java │ │ │ ├── HexUtils.java │ │ │ ├── HmacAlgorithm.java │ │ │ ├── HmacEncryptor.java │ │ │ ├── MixSecret.java │ │ │ ├── SecurityManager.java │ │ │ ├── SecurityUtils.java │ │ │ └── rsa │ │ │ │ ├── RSAByteKey.java │ │ │ │ ├── RSAKey.java │ │ │ │ └── RSAUtils.java │ │ │ ├── spi │ │ │ ├── ClassLoaderUtil.java │ │ │ ├── CrossClassLoader.java │ │ │ ├── SPI.java │ │ │ └── ServiceLoader.java │ │ │ ├── stream │ │ │ └── Streams.java │ │ │ ├── template │ │ │ ├── TemplateFactory.java │ │ │ ├── format │ │ │ │ ├── MultTemplateFormat.java │ │ │ │ ├── SimpleTemplateFormat.java │ │ │ │ └── TemplateFormat.java │ │ │ └── store │ │ │ │ ├── SimpleTemplateStore.java │ │ │ │ ├── TemplateStore.java │ │ │ │ └── cacheable │ │ │ │ ├── AbstractCacheTemplateStore.java │ │ │ │ ├── CompressTemplateStore.java │ │ │ │ ├── FileTemplateStore.java │ │ │ │ └── LRUTemplateStore.java │ │ │ ├── threadExtension │ │ │ ├── SingleExecutorService.java │ │ │ └── single │ │ │ │ ├── AbstractCycleThread.java │ │ │ │ ├── AbstractSingleThread.java │ │ │ │ ├── Recyclable.java │ │ │ │ ├── SingleCycle.java │ │ │ │ ├── SingleEndless.java │ │ │ │ ├── SingleRun.java │ │ │ │ └── SingleThread.java │ │ │ ├── time │ │ │ ├── FastDateFormat.java │ │ │ ├── FastDateParser.java │ │ │ ├── FastDatePrinter.java │ │ │ ├── FormatCache.java │ │ │ └── TimeConstant.java │ │ │ ├── transmission │ │ │ ├── AbstractTransmission.java │ │ │ ├── PeakTransmission.java │ │ │ ├── RateTransmission.java │ │ │ └── Transmission.java │ │ │ └── utils │ │ │ ├── AggregateUtils.java │ │ │ ├── AnnotationUtils.java │ │ │ ├── Assert.java │ │ │ ├── Base64Utils.java │ │ │ ├── BitUtils.java │ │ │ ├── ByteUnit.java │ │ │ ├── BytesUtils.java │ │ │ ├── CallAble.java │ │ │ ├── ClassHelper.java │ │ │ ├── CollectionExtendUtil.java │ │ │ ├── CollectionUtils.java │ │ │ ├── ComparatorUtils.java │ │ │ ├── ConditionUtils.java │ │ │ ├── ConstantDicUtils.java │ │ │ ├── DateUtils.java │ │ │ ├── DigitUtils.java │ │ │ ├── ExecuteUtils.java │ │ │ ├── FileUtils.java │ │ │ ├── GZIPUtils.java │ │ │ ├── HashHelper.java │ │ │ ├── IDUtils.java │ │ │ ├── Identifiable.java │ │ │ ├── ListUtils.java │ │ │ ├── LockUtils.java │ │ │ ├── MapUtils.java │ │ │ ├── MathUtils.java │ │ │ ├── Md5Utils.java │ │ │ ├── MosaicUtils.java │ │ │ ├── NetAddressUtil.java │ │ │ ├── NetUtils.java │ │ │ ├── ObjectUtils.java │ │ │ ├── RFileUtils.java │ │ │ ├── ReflectionHelper.java │ │ │ ├── ReflectionUtils.java │ │ │ ├── RegexUtils.java │ │ │ ├── Runs.java │ │ │ ├── RunsUtils.java │ │ │ ├── S.java │ │ │ ├── StaticFieldUtils.java │ │ │ ├── StreamUtils.java │ │ │ ├── StringUtil.java │ │ │ ├── ThreadPoolUtils.java │ │ │ ├── ThreadUtils.java │ │ │ ├── Time.java │ │ │ ├── TimeSpanUtils.java │ │ │ ├── TimeUtil.java │ │ │ ├── V.java │ │ │ └── ZipUtils.java │ └── web-conch-boot │ │ ├── pom.xml │ │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── nabob │ │ └── conch │ │ └── web │ │ ├── event │ │ └── LoadUserEvent.java │ │ ├── exception │ │ ├── DefaultErrorController.java │ │ ├── ServiceException.java │ │ └── ServiceExceptionHandler.java │ │ ├── mail │ │ ├── AbstarctMailSender.java │ │ ├── ConchMailSender.java │ │ └── DefaultMailSender.java │ │ ├── response │ │ ├── AbstractJsonResponse.java │ │ ├── BasicResponse.java │ │ ├── JsonResponse.java │ │ └── page │ │ │ ├── Page.java │ │ │ ├── PageResponse.java │ │ │ ├── PageResult.java │ │ │ └── Pageable.java │ │ └── utils │ │ ├── Asserts.java │ │ ├── PageUtil.java │ │ ├── RandomMacAddress.java │ │ ├── RandomUserAgent.java │ │ └── RandomValueUtil.java ├── conch-boot-dependencies │ └── pom.xml ├── conch-boot-maven-plugins │ ├── conch-boot-mybatis-enhance-maven-codegen │ │ ├── pom.xml │ │ └── src │ │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── nabob │ │ │ └── conch │ │ │ └── boot │ │ │ └── maven │ │ │ └── plugin │ │ │ └── mybatis │ │ │ └── enhance │ │ │ └── codegen │ │ │ ├── ApiBootMybatisEnhanceCodegen.java │ │ │ ├── EnhanceCodegenConstant.java │ │ │ ├── builder │ │ │ ├── ClassBuilder.java │ │ │ ├── ClassBuilderFactory.java │ │ │ ├── impl │ │ │ │ ├── AbstractClassBuilder.java │ │ │ │ ├── DynamicEntityClassBuilder.java │ │ │ │ └── EntityClassBuilder.java │ │ │ └── wrapper │ │ │ │ └── ClassBuilderWrapper.java │ │ │ ├── expression │ │ │ └── VariableExpression.java │ │ │ ├── setting │ │ │ └── CodegenSetting.java │ │ │ ├── template │ │ │ ├── CodegenFile.java │ │ │ ├── CodegenTemplate.java │ │ │ ├── model │ │ │ │ ├── Annotation.java │ │ │ │ ├── Extend.java │ │ │ │ ├── Field.java │ │ │ │ ├── Implement.java │ │ │ │ ├── NameImport.java │ │ │ │ └── Template.java │ │ │ └── variable │ │ │ │ └── CodegenTemplateVariable.java │ │ │ ├── tools │ │ │ ├── CamelTools.java │ │ │ └── DateFormatTools.java │ │ │ └── writer │ │ │ └── JavaClassWriter.java │ └── pom.xml ├── conch-boot-parent │ └── pom.xml ├── conch-boot-starters │ ├── anti-scrapy-conch-boot-starter │ │ └── pom.xml │ ├── datasource-conch-boot-starter │ │ └── pom.xml │ ├── dingtalk-conch-boot-starter │ │ └── pom.xml │ ├── minio-conch-boot-starter │ │ └── pom.xml │ ├── mongo-conch-boot-starter │ │ └── pom.xml │ ├── mutil-elasticsearch-conch-boot-starter │ │ └── pom.xml │ ├── mybatis-enhance-conch-boot-starter │ │ └── pom.xml │ ├── mybatis-pageable-conch-boot-starter │ │ └── pom.xml │ ├── pom.xml │ ├── quartz-conch-boot-starter │ │ └── pom.xml │ ├── redis-conch-boot-starter │ │ └── pom.xml │ ├── retrofit-conch-boot-starter │ │ └── pom.xml │ ├── security-oauth-jwt-conch-boot-starter │ │ ├── README.md │ │ ├── oauth-mysql.sql │ │ └── pom.xml │ ├── web-conch-boot-starter │ │ └── pom.xml │ └── zookeeper-conch-boot-starter │ │ └── pom.xml └── pom.xml ├── conch-boot-samples ├── conch-boot-anti-scrapy-sample │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── nabob │ │ │ └── conch │ │ │ └── boot │ │ │ └── antiscrapysample │ │ │ ├── ConchBootAntiScrapySampleApplication.java │ │ │ └── TestCtrl.java │ │ └── resources │ │ └── application.properties ├── conch-boot-dingtalk-sample │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── nabob │ │ │ └── conch │ │ │ └── boot │ │ │ └── dingtalksample │ │ │ ├── ConchBootDingtalkSampleApplication.java │ │ │ ├── SendTextMessageWarning.java │ │ │ └── TestDingTalkMessage.java │ │ └── resources │ │ └── application.properties ├── conch-boot-mongo-sample │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── nabob │ │ │ └── conch │ │ │ └── boot │ │ │ └── mongosample │ │ │ ├── AppliedTreasure.java │ │ │ ├── AppliedTreasureDao.java │ │ │ ├── ConchBootMongoSampleApplication.java │ │ │ └── TestService.java │ │ └── resources │ │ └── application.properties ├── conch-boot-mybatis-sample │ ├── pom.xml │ ├── src │ │ ├── main │ │ │ ├── java │ │ │ │ └── com │ │ │ │ │ └── nabob │ │ │ │ │ └── conch │ │ │ │ │ └── boot │ │ │ │ │ └── mybatissample │ │ │ │ │ ├── ConchBootMybatisSampleApplication.java │ │ │ │ │ ├── dsl │ │ │ │ │ ├── DSystemUser.java │ │ │ │ │ └── DSystemUserRole.java │ │ │ │ │ ├── dto │ │ │ │ │ └── SystemUserDTO.java │ │ │ │ │ ├── entity │ │ │ │ │ ├── SystemUser.java │ │ │ │ │ └── SystemUserRole.java │ │ │ │ │ ├── init │ │ │ │ │ └── TestSqlInitializer.java │ │ │ │ │ ├── mapper │ │ │ │ │ ├── SystemUserMapper.java │ │ │ │ │ └── SystemUserRoleMapper.java │ │ │ │ │ └── service │ │ │ │ │ └── SystemUserService.java │ │ │ └── resources │ │ │ │ ├── META-INF │ │ │ │ └── sql │ │ │ │ │ └── init.sql │ │ │ │ └── application.properties │ │ └── test │ │ │ └── java │ │ │ └── com │ │ │ └── nabob │ │ │ └── conch │ │ │ └── boot │ │ │ └── mybatissample │ │ │ └── ApiBootEnhanceSampleTest.java │ └── test.sql ├── conch-boot-quartz-sample │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── nabob │ │ │ │ └── conch │ │ │ │ └── boot │ │ │ │ └── quartzsample │ │ │ │ ├── ApiBootQuartzController.java │ │ │ │ ├── ConchBootQuartzSampleApplication.java │ │ │ │ └── jobs │ │ │ │ └── DemoJob.java │ │ └── resources │ │ │ ├── application.properties │ │ │ └── schemas │ │ │ ├── tables_cloudscape.sql │ │ │ ├── tables_cubrid.sql │ │ │ ├── tables_db2.sql │ │ │ ├── tables_db2_v72.sql │ │ │ ├── tables_db2_v8.sql │ │ │ ├── tables_db2_v95.sql │ │ │ ├── tables_derby.sql │ │ │ ├── tables_derby_previous.sql │ │ │ ├── tables_firebird.sql │ │ │ ├── tables_h2.sql │ │ │ ├── tables_hsqldb.sql │ │ │ ├── tables_hsqldb_old.sql │ │ │ ├── tables_informix.sql │ │ │ ├── tables_mysql.sql │ │ │ ├── tables_mysql_innodb.sql │ │ │ ├── tables_oracle.sql │ │ │ ├── tables_pointbase.sql │ │ │ ├── tables_postgres.sql │ │ │ ├── tables_sapdb.sql │ │ │ ├── tables_solid.sql │ │ │ ├── tables_sqlServer.sql │ │ │ └── tables_sybase.sql │ │ └── test │ │ └── java │ │ └── com │ │ └── nabob │ │ └── conch │ │ └── boot │ │ └── quartzsample │ │ └── ConchBootQuartzSampleApplicationTests.java ├── conch-boot-redis-sample │ ├── pom.xml │ └── src │ │ └── main │ │ ├── java │ │ └── com │ │ │ └── nabob │ │ │ └── conch │ │ │ └── boot │ │ │ └── redissample │ │ │ ├── ConchBootRedisSampleApplication.java │ │ │ └── TestRedis.java │ │ └── resources │ │ └── application.properties ├── conch-boot-retrofit-sample │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── nabob │ │ │ │ └── conch │ │ │ │ └── boot │ │ │ │ └── retrofitsample │ │ │ │ ├── ConchBootRetrofitSampleApplication.java │ │ │ │ ├── client │ │ │ │ ├── TestLocalRetrofitClient.java │ │ │ │ └── TestRetrofitClient.java │ │ │ │ ├── config │ │ │ │ └── Config.java │ │ │ │ └── sample │ │ │ │ ├── RetrofitTestService.java │ │ │ │ └── TestLocalCtrl.java │ │ └── resources │ │ │ ├── application-dev.yaml │ │ │ └── application.yaml │ │ └── test │ │ └── java │ │ └── com │ │ └── nabob │ │ └── conch │ │ └── boot │ │ └── retrofitsample │ │ └── ConchBootRetrofitSampleApplicationTests.java ├── conch-boot-web-sample │ ├── README.md │ ├── pom.xml │ └── src │ │ ├── main │ │ ├── java │ │ │ └── com │ │ │ │ └── nabob │ │ │ │ └── conch │ │ │ │ └── boot │ │ │ │ └── websample │ │ │ │ ├── ConchBootWebSampleApplication.java │ │ │ │ ├── TestCtrl.java │ │ │ │ └── minio │ │ │ │ └── FileApi.java │ │ └── resources │ │ │ └── application.properties │ │ └── test │ │ └── java │ │ └── com │ │ └── nabob │ │ └── conch │ │ └── boot │ │ └── websample │ │ └── ConchBootWebSampleApplicationTests.java └── pom.xml └── pom.xml /.gitignore: -------------------------------------------------------------------------------- 1 | bin 2 | bak 3 | .pmd 4 | .project 5 | .settings 6 | .classpath 7 | .idea.xml 8 | .idea 9 | *.class 10 | *.bak 11 | bak 12 | null/ 13 | tree.log 14 | tmp/ 15 | velocity.log 16 | .DS_Store 17 | .m2 18 | 19 | # gradle related ignore in sub directories 20 | .gradle 21 | build 22 | out 23 | 24 | /target/ 25 | !.mvn/wrapper/maven-wrapper.jar 26 | 27 | ### STS ### 28 | .apt_generated 29 | .classpath 30 | .factorypath 31 | .project 32 | .settings 33 | .springBeans 34 | .sts4-cache 35 | 36 | ### IntelliJ IDEA ### 37 | .idea 38 | *.iws 39 | *.iml 40 | *.ipr 41 | .mvn 42 | mvnw.cmd 43 | mvnw 44 | logs/ 45 | log/ 46 | .flattened-pom.xml 47 | */.flattened-pom.xml 48 | */target/ 49 | \target/ 50 | */*/target 51 | */*/*/target 52 | */logs/ 53 | */log/ 54 | */bllog/ 55 | /bllog/ 56 | 57 | ### NetBeans ### 58 | /nbproject/private/ 59 | /build/ 60 | /nbbuild/ 61 | /dist/ 62 | /nbdist/ 63 | /.nb-gradle/ 64 | \.DS_Store 65 | conch-boot-samples/conch-boot-quartz-sample/src/main/resources/my\.info 66 | -------------------------------------------------------------------------------- /INFO.md: -------------------------------------------------------------------------------- 1 | 在之前的版本我们都是使用 @Configuration、 @ConfigurationProperties这两个注解来进行配置映射, 2 | 从 SpringBoot2.2.1.RELEASE版本开始我们不再需要添加 @Configuration, 3 | 只要通过 @ConfigurationPropertiesScan结合 @ConfigurationProperties搭配使用即可, 4 | 会自动扫描指定 package下的属性配置类进行绑定。 5 | 6 | 在属性配置类上添加 @ConstructorBinding注解, 7 | 即可实现构造函数的方式进行对应字段设置值,我们只需要把绑定赋值的参数通过构造函数的方式定义。 8 | 9 | - 分离邮件服务 10 | - Kafka 简单日志 开箱使用 11 | - SOFAStack 深度探索 12 | - 支付宝包装(支付、小程序等) 13 | - 微信开发者 开箱即用 14 | - 验证码 15 | - https://github.com/whvcse/EasyCaptcha 16 | - JVM监控支持 17 | - JVM研究 18 | - https://github.com/alibaba/metrics 19 | - https://github.com/alibaba/jvm-sandbox 20 | - https://github.com/alibaba/jvm-sandbox-repeater 21 | - 事件驱动 22 | - https://gitee.com/zkpursuit/kaka-notice-lib 23 | - 任务调度 24 | - https://github.com/apache/incubator-dolphinscheduler 25 | - https://github.com/xuxueli/xxl-job/ 26 | - 插件开发模式 27 | - DataX or https://github.com/alibaba/jvm-sandbox-repeater 28 | - SQL解析&优化 29 | - https://tech.meituan.com/2018/05/20/sql-parser-used-in-mtdp.html 30 | - 借鉴自研MyBatis-plus -------------------------------------------------------------------------------- /change_version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | shopt -s expand_aliases 3 | if [ ! -n "$1" ] ;then 4 | echo "Please enter a version" 5 | exit 1 6 | else 7 | echo "The updated version is $1 !" 8 | fi 9 | 10 | currentVersion=`sed -n '/' -f2 | cut -d '<' -f1` 11 | echo "The current version is $currentVersion" 12 | 13 | if [ `uname` == "Darwin" ] ;then 14 | echo "This is OS X" 15 | alias sed='sed -i ""' 16 | else 17 | echo "This is Linux" 18 | alias sed='sed -i' 19 | fi 20 | 21 | echo "Change version in root pom.xml ===>" 22 | sed "/.*<\/version>/$1<\/version>/" pom.xml 23 | 24 | echo "Change version in subproject pom ===>" 25 | for filename in `find . -name "pom.xml" -mindepth 2`;do 26 | echo "Deal with $filename" 27 | sed "//,/<\/parent>/ s/.*<\/version>/$1<\/version>/" $filename 28 | done 29 | 30 | echo "Change version in gradle.properties" 31 | for filename in `find . -name "gradle.properties" -mindepth 3`;do 32 | echo "Deal with $filename" 33 | sed "s/sofaVersion=.*/sofaVersion=$1/g" $filename 34 | done -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-autoconfigure/src/main/java/com/nabob/conch/boot/autoconfigure/antiscrapy/strategy/IpAndUaSecurityStrategy.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.boot.autoconfigure.antiscrapy.strategy; 2 | 3 | import com.nabob.conch.antiscrapy.handler.StrategyHandler; 4 | import com.nabob.conch.antiscrapy.utils.RedisKeyUtils; 5 | import com.nabob.conch.boot.autoconfigure.antiscrapy.AntiSecurityProperties; 6 | import com.nabob.conch.tools.utils.HashHelper; 7 | 8 | /** 9 | * @Author: zjz 10 | * @Desc: 11 | * @Date: 2019/4/26 12 | * @Versin: V1.0.0 13 | */ 14 | public class IpAndUaSecurityStrategy extends AbstractSecurityStrategy { 15 | 16 | private static final String type = "iu"; 17 | 18 | public IpAndUaSecurityStrategy(StrategyHandler strategyHandler, AntiSecurityProperties antiSecurityProperties) { 19 | super(strategyHandler, antiSecurityProperties); 20 | } 21 | 22 | @Override 23 | protected boolean checkHourSecurity(StrategyHandler handler, AntiSecurityProperties properties, String target) { 24 | return handler.handleHour(RedisKeyUtils.generateHourRedisKey(properties.getNamespace(), type, HashHelper.hashOf(target))) <= properties.getHour().getIpAndUa(); 25 | } 26 | 27 | @Override 28 | protected boolean checkDaySecurity(StrategyHandler handler, AntiSecurityProperties properties, String target) { 29 | return handler.handleDay(RedisKeyUtils.generateDayRedisKey(properties.getNamespace(), type, HashHelper.hashOf(target))) <= properties.getDay().getIpAndUa(); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-autoconfigure/src/main/java/com/nabob/conch/boot/autoconfigure/antiscrapy/strategy/IpSecurityStrategy.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.boot.autoconfigure.antiscrapy.strategy; 2 | 3 | import com.nabob.conch.antiscrapy.handler.StrategyHandler; 4 | import com.nabob.conch.antiscrapy.utils.RedisKeyUtils; 5 | import com.nabob.conch.boot.autoconfigure.antiscrapy.AntiSecurityProperties; 6 | 7 | /** 8 | * @Author: zjz 9 | * @Desc: 10 | * @Date: 2019/4/26 11 | * @Version: V1.0.0 12 | */ 13 | public class IpSecurityStrategy extends AbstractSecurityStrategy { 14 | 15 | private static final String type = "ip"; 16 | 17 | public IpSecurityStrategy(StrategyHandler strategyHandler, AntiSecurityProperties antiSecurityProperties) { 18 | super(strategyHandler, antiSecurityProperties); 19 | } 20 | 21 | @Override 22 | public boolean checkHourSecurity(StrategyHandler handler, AntiSecurityProperties properties, String target) { 23 | return handler.handleHour(RedisKeyUtils.generateHourRedisKey(properties.getNamespace(), type, target)) <= properties.getHour().getIp(); 24 | } 25 | 26 | @Override 27 | protected boolean checkDaySecurity(StrategyHandler handler, AntiSecurityProperties properties, String target) { 28 | return handler.handleDay(RedisKeyUtils.generateDayRedisKey(properties.getNamespace(), type, target)) <= properties.getDay().getIp(); 29 | } 30 | 31 | } 32 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-autoconfigure/src/main/java/com/nabob/conch/boot/autoconfigure/antiscrapy/strategy/PhoneSecurityStrategy.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.boot.autoconfigure.antiscrapy.strategy; 2 | 3 | import com.nabob.conch.antiscrapy.handler.StrategyHandler; 4 | import com.nabob.conch.antiscrapy.utils.RedisKeyUtils; 5 | import com.nabob.conch.boot.autoconfigure.antiscrapy.AntiSecurityProperties; 6 | 7 | /** 8 | * @Author: zjz 9 | * @Desc: 10 | * @Date: 2019/4/26 11 | * @Version: V1.0.0 12 | */ 13 | public class PhoneSecurityStrategy extends AbstractSecurityStrategy { 14 | 15 | private static final String type = "ph"; 16 | 17 | public PhoneSecurityStrategy(StrategyHandler strategyHandler, AntiSecurityProperties antiSecurityProperties) { 18 | super(strategyHandler, antiSecurityProperties); 19 | } 20 | 21 | @Override 22 | public boolean checkHourSecurity(StrategyHandler handler, AntiSecurityProperties properties, String target) { 23 | return handler.handleHour(RedisKeyUtils.generateHourRedisKey(properties.getNamespace(), type, target)) <= properties.getHour().getPhone(); 24 | } 25 | 26 | @Override 27 | protected boolean checkDaySecurity(StrategyHandler handler, AntiSecurityProperties properties, String target) { 28 | return handler.handleDay(RedisKeyUtils.generateDayRedisKey(properties.getNamespace(), type, target)) <= properties.getDay().getPhone(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-autoconfigure/src/main/java/com/nabob/conch/boot/autoconfigure/dingtalk/DingtalkChatbotAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.boot.autoconfigure.dingtalk; 2 | 3 | import com.nabob.conch.dingtalk.DingtalkChatbotClient; 4 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; 5 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; 6 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.context.annotation.Configuration; 9 | 10 | /** 11 | * @Author: zjz 12 | * @Desc: Dingtalk 自动装配 13 | * @Date: 2019/10/17 14 | * @Version: V1.0.0 15 | */ 16 | @Configuration 17 | @ConditionalOnClass(DingtalkChatbotClient.class) 18 | @EnableConfigurationProperties(DingtalkChatbotProperties.class) 19 | public class DingtalkChatbotAutoConfiguration { 20 | 21 | @Bean 22 | @ConditionalOnMissingBean 23 | public DingtalkChatbotClient dingtalkChatbotClient(DingtalkChatbotProperties dingtalkChatbotProperties) { 24 | return new DingtalkChatbotClient(dingtalkChatbotProperties.getWebhook()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-autoconfigure/src/main/java/com/nabob/conch/boot/autoconfigure/dingtalk/DingtalkChatbotProperties.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.boot.autoconfigure.dingtalk; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | import org.springframework.validation.annotation.Validated; 5 | 6 | import javax.validation.constraints.NotBlank; 7 | 8 | /** 9 | * @Author: zjz 10 | * @Desc: Dingtalk配置 - WebHook 11 | * @Date: 2019/10/17 12 | * @Version: V1.0.0 13 | */ 14 | @ConfigurationProperties(prefix = "conch.dingtalk") 15 | @Validated 16 | public class DingtalkChatbotProperties { 17 | 18 | @NotBlank 19 | private String webhook; 20 | 21 | public String getWebhook() { 22 | return webhook; 23 | } 24 | 25 | public void setWebhook(String webhook) { 26 | this.webhook = webhook; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-autoconfigure/src/main/java/com/nabob/conch/boot/autoconfigure/enhance/ConfigurationCustomizer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright [2019] [恒宇少年 - 于起宇] 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | package com.nabob.conch.boot.autoconfigure.enhance; 18 | 19 | import org.apache.ibatis.session.Configuration; 20 | 21 | /** 22 | * Callback interface that can be customized a {@link Configuration} object generated on auto-configuration. 23 | * @author:恒宇少年 - 于起宇 24 | *

25 | * DateTime:2019-04-25 15:16 26 | * Blog:http://blog.yuqiyu.com 27 | * WebSite:http://www.jianshu.com/u/092df3f77bca 28 | * Gitee:https://gitee.com/hengboy 29 | * GitHub:https://github.com/hengboy 30 | */ 31 | public interface ConfigurationCustomizer { 32 | 33 | /** 34 | * Customize the given a {@link Configuration} object. 35 | * @param configuration the configuration object to customize 36 | */ 37 | void customize(Configuration configuration); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-autoconfigure/src/main/java/com/nabob/conch/boot/autoconfigure/mail/MailSenderProperties.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.boot.autoconfigure.mail; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | 5 | /** 6 | * @Author: zjz 7 | * @Desc: 8 | * @Date: 2019/1/8 9 | * @Version: V1.0.0 10 | */ 11 | @ConfigurationProperties(prefix = "conch.mail") 12 | public class MailSenderProperties { 13 | 14 | private String prefix; 15 | private String sendFrom; 16 | private String sendTo; 17 | 18 | public String getPrefix() { 19 | return prefix; 20 | } 21 | 22 | public void setPrefix(String prefix) { 23 | this.prefix = prefix; 24 | } 25 | 26 | public String getSendFrom() { 27 | return sendFrom; 28 | } 29 | 30 | public void setSendFrom(String sendFrom) { 31 | this.sendFrom = sendFrom; 32 | } 33 | 34 | public String getSendTo() { 35 | return sendTo; 36 | } 37 | 38 | public void setSendTo(String sendTo) { 39 | this.sendTo = sendTo; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-autoconfigure/src/main/java/com/nabob/conch/boot/autoconfigure/minio/MinioAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.boot.autoconfigure.minio; 2 | 3 | import io.minio.MinioClient; 4 | import io.minio.errors.InvalidEndpointException; 5 | import io.minio.errors.InvalidPortException; 6 | import com.nabob.conch.minio.MinioTemplate; 7 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; 8 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; 9 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 10 | import org.springframework.context.annotation.Bean; 11 | import org.springframework.context.annotation.Configuration; 12 | 13 | @Configuration 14 | @ConditionalOnClass({MinioClient.class, MinioTemplate.class}) 15 | @EnableConfigurationProperties({ MinioProperties.class }) 16 | public class MinioAutoConfiguration { 17 | 18 | @Bean 19 | @ConditionalOnMissingBean(MinioClient.class) 20 | public MinioClient minioClient(MinioProperties minioProperties) throws InvalidPortException, InvalidEndpointException { 21 | return new MinioClient(minioProperties.getUrl(), minioProperties.getAccessKey(), minioProperties.getSecretKey()); 22 | } 23 | 24 | @Bean 25 | @ConditionalOnMissingBean(MinioTemplate.class) 26 | MinioTemplate minioTemplate(MinioClient minioClient){ 27 | return new MinioTemplate(minioClient); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-autoconfigure/src/main/java/com/nabob/conch/boot/autoconfigure/minio/MinioProperties.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.boot.autoconfigure.minio; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | 5 | @ConfigurationProperties(prefix = "conch.data.minio") 6 | public class MinioProperties { 7 | 8 | /** 9 | * url 10 | */ 11 | private String url; 12 | /** 13 | * username 14 | */ 15 | private String accessKey; 16 | /** 17 | * password 18 | */ 19 | private String secretKey; 20 | 21 | public String getUrl() { 22 | return url; 23 | } 24 | 25 | public void setUrl(String url) { 26 | this.url = url; 27 | } 28 | 29 | public String getAccessKey() { 30 | return accessKey; 31 | } 32 | 33 | public void setAccessKey(String accessKey) { 34 | this.accessKey = accessKey; 35 | } 36 | 37 | public String getSecretKey() { 38 | return secretKey; 39 | } 40 | 41 | public void setSecretKey(String secretKey) { 42 | this.secretKey = secretKey; 43 | } 44 | 45 | @Override 46 | public String toString() { 47 | return "MinioProperties{" + 48 | "url='" + url + '\'' + 49 | ", accessKey='" + accessKey + '\'' + 50 | ", secretKey='" + secretKey + '\'' + 51 | '}'; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-autoconfigure/src/main/java/com/nabob/conch/boot/autoconfigure/mongo/package-info.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Note: 3 | * springboot need to "exclude = MongoAutoConfiguration.class" 4 | * if you want to use spring-boot-data-mongodb, you can just do not add this pom 5 | */ 6 | package com.nabob.conch.boot.autoconfigure.mongo; -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-autoconfigure/src/main/java/com/nabob/conch/boot/autoconfigure/oauth/OAuthAway.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright [2019] [恒宇少年 - 于起宇] 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.nabob.conch.boot.autoconfigure.oauth; 19 | 20 | import lombok.Getter; 21 | 22 | /** 23 | * ApiBoot OAuth Away 24 | * 25 | * @author:恒宇少年 - 于起宇 26 | *

27 | * DateTime:2019-07-15 11:19 28 | * Blog:http://blog.yuqiyu.com 29 | * WebSite:http://www.jianshu.com/u/092df3f77bca 30 | * Gitee:https://gitee.com/hengboy 31 | * GitHub:https://github.com/hengboy 32 | */ 33 | @Getter 34 | public enum OAuthAway { 35 | /** 36 | * 内存方式 37 | */ 38 | memory, 39 | /** 40 | * jdbc方式 41 | */ 42 | jdbc, 43 | /** 44 | * redis方式 45 | */ 46 | redis 47 | } 48 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-autoconfigure/src/main/java/com/nabob/conch/boot/autoconfigure/quartz/PropKey.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.boot.autoconfigure.quartz; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * Prop Key 7 | * 8 | * @author:恒宇少年 - 于起宇 9 | *

10 | * DateTime:2019-03-30 17:17 11 | * Blog:http://blog.yuqiyu.com 12 | * WebSite:http://www.jianshu.com/u/092df3f77bca 13 | * Gitee:https://gitee.com/hengboy 14 | * GitHub:https://github.com/hengboy 15 | */ 16 | @Target({ElementType.FIELD}) 17 | @Retention(RetentionPolicy.RUNTIME) 18 | @Documented 19 | public @interface PropKey { 20 | String value(); 21 | } 22 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-autoconfigure/src/main/java/com/nabob/conch/boot/autoconfigure/redis/ConchRedisProperties.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.boot.autoconfigure.redis; 2 | 3 | import org.springframework.boot.context.properties.ConfigurationProperties; 4 | 5 | @ConfigurationProperties(prefix = "spring.redis.conch") 6 | public class ConchRedisProperties { 7 | 8 | private String prefix = "p_"; 9 | 10 | private String lock = "l_"; 11 | 12 | public String getPrefix() { 13 | return prefix; 14 | } 15 | 16 | public void setPrefix(String prefix) { 17 | this.prefix = prefix; 18 | } 19 | 20 | public String getLock() { 21 | return lock; 22 | } 23 | 24 | public void setLock(String lock) { 25 | this.lock = lock; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-autoconfigure/src/main/java/com/nabob/conch/boot/autoconfigure/security/SecurityAway.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright [2019] [恒宇少年 - 于起宇] 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.nabob.conch.boot.autoconfigure.security; 18 | 19 | import lombok.Getter; 20 | 21 | /** 22 | * SpringSecurity 用户存储方式 23 | * 24 | * @author:恒宇少年 - 于起宇 25 | *

26 | * DateTime:2019-03-14 15:43 27 | * Blog:http://blog.yuqiyu.com 28 | * WebSite:http://www.jianshu.com/u/092df3f77bca 29 | * Gitee:https://gitee.com/hengboy 30 | * GitHub:https://github.com/hengboy 31 | */ 32 | @Getter 33 | public enum SecurityAway { 34 | /** 35 | * 内存方式 36 | */ 37 | memory, 38 | /** 39 | * jdbc方式 40 | */ 41 | jdbc 42 | } 43 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-autoconfigure/src/main/java/com/nabob/conch/boot/autoconfigure/sqlinit/DoNothingCallbackHandler.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.boot.autoconfigure.sqlinit; 2 | 3 | import org.springframework.jdbc.core.RowCallbackHandler; 4 | 5 | import java.sql.ResultSet; 6 | import java.sql.SQLException; 7 | 8 | /** 9 | * 不需要回调的处理器 10 | */ 11 | public class DoNothingCallbackHandler implements RowCallbackHandler { 12 | @Override 13 | public void processRow(ResultSet rs) throws SQLException { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-autoconfigure/src/main/resources/META-INF/additional-spring-configuration-metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "hints": [ 3 | { 4 | "name": "retrofit.client.converter-name", 5 | "values": [ 6 | { 7 | "value": "jackson" 8 | }, 9 | { 10 | "value": "gson" 11 | } 12 | ], 13 | "providers": [ 14 | { 15 | "name": "any" 16 | } 17 | ] 18 | } 19 | ] 20 | } 21 | 22 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-autoconfigure/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.nabob.conch.boot.autoconfigure.mongo.ConchMongoDataAutoConfiguration, \ 3 | com.nabob.conch.boot.autoconfigure.redis.ConchRedisAutoConfiguration, \ 4 | com.nabob.conch.boot.autoconfigure.redis.ConchRedissonConfiguration, \ 5 | com.nabob.conch.boot.autoconfigure.mail.MailAutoConfiguration, \ 6 | com.nabob.conch.boot.autoconfigure.enhance.ApiBootMyBatisEnhanceAutoConfiguration, \ 7 | com.nabob.conch.boot.autoconfigure.pageable.ApiBootMybatisPageableAutoConfiguration, \ 8 | com.nabob.conch.boot.autoconfigure.datasource.ApiBootDataSourceSwitchAutoConfiguration, \ 9 | com.nabob.conch.boot.autoconfigure.minio.MinioAutoConfiguration, \ 10 | com.nabob.conch.boot.autoconfigure.quartz.ApiBootQuartzAutoConfiguration, \ 11 | com.nabob.conch.boot.autoconfigure.antiscrapy.AntiSecurityAutoConfiguration, \ 12 | com.nabob.conch.boot.autoconfigure.zookeeper.ConchZookeeperAutoConfiguration, \ 13 | com.nabob.conch.boot.autoconfigure.dingtalk.DingtalkChatbotAutoConfiguration, \ 14 | com.nabob.conch.boot.autoconfigure.mutiles.ConchMutilElasticsearchJestAutoConfiguration, \ 15 | com.nabob.conch.boot.autoconfigure.mutiles.ConchMutilElasticsearchAutoConfiguration, \ 16 | com.nabob.conch.boot.autoconfigure.retrofit.RetrofitClientAutoConfiguration, \ 17 | com.nabob.conch.boot.autoconfigure.sqlinit.ConchSqlInitAutoConfiguration 18 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-autoconfigure/src/main/resources/banner.txt: -------------------------------------------------------------------------------- 1 | ${AnsiColor.BRIGHT_GREEN} 2 | ,-----. ,------.,--.,--. ,--.,--. ,--. ,-----. ,--. 3 | | |) /_ | .---'| || '--' || | | | | |) /_ ,---. ,---. ,-' '-. 4 | | .-. \| `--, | || .--. || | | | | .-. \| .-. || .-. |'-. .-' 5 | | '--' /| `---.| || | | |' '-' ' | '--' /' '-' '' '-' ' | | 6 | `------' `------'`--'`--' `--' `-----' `------' `---' `---' `--' 7 | 8 | ${AnsiColor.BRIGHT_RED} 9 | Spring Boot Version: ${spring-boot.version}${spring-boot.formatted-version} 10 | SOFABoot Version: ${sofa-boot.version}${sofa-boot.formatted-version} 11 | Powered By Ant Financial Services Group 12 | ${AnsiColor.DEFAULT} 13 | 14 | 15 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/anti-scrapy-conch-boot/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.nabob.conch 7 | conch-boot-core 8 | ${revision} 9 | 10 | anti-scrapy-conch-boot 11 | 12 | anti-scrapy-conch-boot 13 | 简单过滤爬虫请求Security模块 14 | 15 | 16 | ${basedir}/../../.. 17 | 18 | 19 | 20 | 21 | com.nabob.conch 22 | redis-conch-boot 23 | 24 | 25 | com.nabob.conch 26 | tools-conch-boot 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/anti-scrapy-conch-boot/src/main/java/com/nabob/conch/antiscrapy/common/SecurityConstants.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.antiscrapy.common; 2 | 3 | /** 4 | * @Author: zjz 5 | * @Desc: 6 | * @Date: 2019/4/26 7 | * @Version: V1.0.0 8 | */ 9 | public class SecurityConstants { 10 | 11 | public static final String strategyHandler = "strategyHandler"; 12 | public static final String redisGenericUtil = "redisGenericUtil"; 13 | public static final String springContextUtils = "springContextUtils"; 14 | public static final String securityStrategyFactory = "securityStrategyFactory"; 15 | public static final String antiSecurityService = "antiSecurityService"; 16 | 17 | public static final String ipSecurityStrategy = "ipSecurityStrategy"; 18 | public static final String phoneSecurityStrategy = "phoneSecurityStrategy"; 19 | public static final String ipAndUaSecurityStrategy = "ipAndUaSecurityStrategy"; 20 | } 21 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/anti-scrapy-conch-boot/src/main/java/com/nabob/conch/antiscrapy/handler/RedisStrategyHandler.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.antiscrapy.handler; 2 | 3 | import com.nabob.conch.redis.RedisGenericUtil; 4 | 5 | import java.util.concurrent.TimeUnit; 6 | 7 | /** 8 | * @Author: zjz 9 | * @Desc: 10 | * @Date: 2019/4/26 11 | * @Version: V1.0.0 12 | */ 13 | public class RedisStrategyHandler implements StrategyHandler{ 14 | 15 | private RedisGenericUtil redisGenericUtil; 16 | 17 | public RedisStrategyHandler(RedisGenericUtil redisGenericUtil) { 18 | this.redisGenericUtil = redisGenericUtil; 19 | } 20 | 21 | @Override 22 | public long handleHour(String target) { 23 | boolean init = redisGenericUtil.setIfAbsent(target, 1, TimeUnit.HOURS.toMillis(1)); 24 | if (!init) { 25 | return redisGenericUtil.incr(target, 1); 26 | } 27 | return 1; 28 | } 29 | 30 | @Override 31 | public long handleDay(String target) { 32 | boolean init = redisGenericUtil.setIfAbsent(target, 1, TimeUnit.DAYS.toMillis(1)); 33 | if (!init) { 34 | return redisGenericUtil.incr(target, 1); 35 | } 36 | return 1; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/anti-scrapy-conch-boot/src/main/java/com/nabob/conch/antiscrapy/handler/StrategyHandler.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.antiscrapy.handler; 2 | 3 | /** 4 | * @Author: zjz 5 | * @Desc: 6 | * @Date: 2019/4/26 7 | * @Version: V1.0.0 8 | */ 9 | public interface StrategyHandler { 10 | 11 | long handleHour(String target); 12 | 13 | long handleDay(String target); 14 | } 15 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/anti-scrapy-conch-boot/src/main/java/com/nabob/conch/antiscrapy/strategy/SecurityStrategy.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.antiscrapy.strategy; 2 | 3 | public interface SecurityStrategy { 4 | 5 | boolean checkSecurity(String target); 6 | 7 | boolean checkSecurity(String target1, String target2); 8 | } 9 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/anti-scrapy-conch-boot/src/main/java/com/nabob/conch/antiscrapy/strategy/SecurityStrategyFactory.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.antiscrapy.strategy; 2 | 3 | import com.nabob.conch.antiscrapy.common.SecurityConstants; 4 | 5 | public class SecurityStrategyFactory { 6 | 7 | private SecurityStrategy ipSecurityStrategy; 8 | private SecurityStrategy phoneSecurityStrategy; 9 | private SecurityStrategy ipAndUaSecurityStrategy; 10 | 11 | public SecurityStrategyFactory(SecurityStrategy ipSecurityStrategy, SecurityStrategy phoneSecurityStrategy, SecurityStrategy ipAndUaSecurityStrategy) { 12 | this.ipSecurityStrategy = ipSecurityStrategy; 13 | this.phoneSecurityStrategy = phoneSecurityStrategy; 14 | this.ipAndUaSecurityStrategy = ipAndUaSecurityStrategy; 15 | } 16 | 17 | public SecurityStrategy create(String securityStrategyBeanName) { 18 | if (SecurityConstants.ipSecurityStrategy.equals(securityStrategyBeanName)) { 19 | return ipSecurityStrategy; 20 | } 21 | if (SecurityConstants.phoneSecurityStrategy.equals(securityStrategyBeanName)) { 22 | return phoneSecurityStrategy; 23 | } 24 | if (SecurityConstants.ipAndUaSecurityStrategy.equals(securityStrategyBeanName)) { 25 | return ipAndUaSecurityStrategy; 26 | } 27 | throw new RuntimeException("Not support this Security Strategy!"); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/anti-scrapy-conch-boot/src/main/java/com/nabob/conch/antiscrapy/utils/RedisKeyUtils.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.antiscrapy.utils; 2 | 3 | /** 4 | * @Author: zjz 5 | * @Desc: 6 | * @Date: 2019/4/26 7 | * @Version: V1.0.0 8 | */ 9 | public class RedisKeyUtils { 10 | 11 | /* 12 | anti:h:ip:12333333333 13 | anti:h:ph:12333333333 14 | anti:h:iu:12333333333 15 | */ 16 | public static String generateHourRedisKey(String namespace, String type, String value) { 17 | return String.format("%s:%s:%s:%s", namespace, "h", type, value); 18 | } 19 | 20 | /* 21 | anti:d:ip:12333333333 22 | anti:d:ph:12333333333 23 | anti:d:iu:12333333333 24 | */ 25 | public static String generateDayRedisKey(String namespace, String type, String value) { 26 | return String.format("%s:%s:%s:%s", namespace, "d", type, value); 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/datasource-conch-boot/src/main/java/com/nabob/conch/datasource/ApiBootDataSource.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.datasource; 2 | 3 | import javax.sql.DataSource; 4 | 5 | /** 6 | * Api Boot DataSource 接口定义 7 | * 8 | * @author:恒宇少年 - 于起宇 9 | *

10 | * DateTime:2019-04-01 14:55 11 | * Blog:http://blog.yuqiyu.com 12 | * WebSite:http://www.jianshu.com/u/092df3f77bca 13 | * Gitee:https://gitee.com/hengboy 14 | * GitHub:https://github.com/hengboy 15 | */ 16 | public interface ApiBootDataSource extends DataSource { 17 | /** 18 | * Create new data source Instance 19 | * 20 | * @return DataSource 21 | * @throws RuntimeException 异常信息 22 | */ 23 | DataSource build() throws RuntimeException; 24 | } 25 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/datasource-conch-boot/src/main/java/com/nabob/conch/datasource/DataSourceTypeNames.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.datasource; 2 | 3 | /** 4 | * ApiBoot DataSource Switch 所支持的数据源类型限定名 5 | * 6 | * @author:恒宇少年 - 于起宇 7 | *

8 | * DateTime:2019-04-01 11:33 9 | * Blog:http://blog.yuqiyu.com 10 | * WebSite:http://www.jianshu.com/u/092df3f77bca 11 | * Gitee:https://gitee.com/hengboy 12 | * GitHub:https://github.com/hengboy 13 | */ 14 | public interface DataSourceTypeNames { 15 | /** 16 | * Druid 数据源类全限定路径 17 | */ 18 | String DRUID = "com.alibaba.druid.pool.DruidDataSource"; 19 | /** 20 | * Hikari 数据源全限定路径 21 | */ 22 | String HIKARI = "com.zaxxer.hikari.HikariDataSource"; 23 | } 24 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/datasource-conch-boot/src/main/java/com/nabob/conch/datasource/annotation/DataSourceSwitch.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.datasource.annotation; 2 | 3 | import java.lang.annotation.*; 4 | 5 | /** 6 | * data source switch annotation 7 | * 8 | * @author:恒宇少年 - 于起宇 9 | *

10 | * DateTime:2019-04-01 16:23 11 | * Blog:http://blog.yuqiyu.com 12 | * WebSite:http://www.jianshu.com/u/092df3f77bca 13 | * Gitee:https://gitee.com/hengboy 14 | * GitHub:https://github.com/hengboy 15 | */ 16 | @Retention(RetentionPolicy.RUNTIME) 17 | @Target({ElementType.TYPE, ElementType.METHOD}) 18 | @Documented 19 | public @interface DataSourceSwitch { 20 | /** 21 | * data source pool name 22 | * 23 | * @return pool name 24 | */ 25 | String value(); 26 | } 27 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/datasource-conch-boot/src/main/java/com/nabob/conch/datasource/config/DataSourceConfig.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.datasource.config; 2 | 3 | import lombok.Data; 4 | 5 | import javax.sql.DataSource; 6 | 7 | /** 8 | * data source basic config parameter 9 | * for example: 10 | * username、url、password 11 | * 12 | * @author:恒宇少年 - 于起宇 13 | *

14 | * DateTime:2019-04-01 11:41 15 | * Blog:http://blog.yuqiyu.com 16 | * WebSite:http://www.jianshu.com/u/092df3f77bca 17 | * Gitee:https://gitee.com/hengboy 18 | * GitHub:https://github.com/hengboy 19 | */ 20 | @Data 21 | public class DataSourceConfig { 22 | /** 23 | * data source pool name 24 | */ 25 | private String poolName = "master"; 26 | /** 27 | * data source type 28 | * 29 | * @see com.nabob.conch.datasource.DataSourceTypeNames 30 | */ 31 | private Class dataSourceType; 32 | /** 33 | * driver class name 34 | * if don't config will use default values 35 | * MySQL8.0+ -> com.mysql.cj.jdbc.Driver(SpringBoot2.x recommended use) 36 | * MySQL8.0- -> com.mysql.jdbc.Driver 37 | */ 38 | private String driverClassName = "com.mysql.cj.jdbc.Driver"; 39 | /** 40 | * database connection url 41 | */ 42 | private String url; 43 | /** 44 | * database connection username 45 | */ 46 | private String username; 47 | /** 48 | * database connection password 49 | */ 50 | private String password; 51 | } 52 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/datasource-conch-boot/src/main/java/com/nabob/conch/datasource/config/DataSourceDruidConfig.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.datasource.config; 2 | 3 | import lombok.Data; 4 | 5 | /** 6 | * druid data source config parameter 7 | * 8 | * @author:恒宇少年 - 于起宇 9 | *

10 | * DateTime:2019-04-01 11:41 11 | * Blog:http://blog.yuqiyu.com 12 | * WebSite:http://www.jianshu.com/u/092df3f77bca 13 | * Gitee:https://gitee.com/hengboy 14 | * GitHub:https://github.com/hengboy 15 | */ 16 | @Data 17 | public class DataSourceDruidConfig extends DataSourceConfig { 18 | private String filters = "stat,wall,slf4j"; 19 | private int maxActive = 20; 20 | private int initialSize = 1; 21 | private long maxWait = 60000; 22 | private String validationQuery = "select 1 from dual"; 23 | private boolean testWhileIdle = true; 24 | private boolean testOnBorrow = false; 25 | private boolean testOnReturn = false; 26 | 27 | } 28 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/datasource-conch-boot/src/main/java/com/nabob/conch/datasource/config/DataSourceHikariConfig.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.datasource.config; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | 8 | /** 9 | * Hikari data source config parameter 10 | * 11 | * @author:恒宇少年 - 于起宇 12 | *

13 | * DateTime:2019-04-01 11:42 14 | * Blog:http://blog.yuqiyu.com 15 | * WebSite:http://www.jianshu.com/u/092df3f77bca 16 | * Gitee:https://gitee.com/hengboy 17 | * GitHub:https://github.com/hengboy 18 | */ 19 | @Data 20 | public class DataSourceHikariConfig extends DataSourceConfig { 21 | /** 22 | * Hikari dataSource Property Map 23 | * like:cachePrepStmts、prepStmtCacheSize、prepStmtCacheSqlLimit.. 24 | */ 25 | private Map property = new HashMap<>(); 26 | } 27 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/datasource-conch-boot/src/main/java/com/nabob/conch/datasource/routing/DataSourceContextHolder.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.datasource.routing; 2 | 3 | import org.springframework.util.Assert; 4 | 5 | /** 6 | * data source context holder 7 | * 8 | * @author:恒宇少年 - 于起宇 9 | *

10 | * DateTime:2019-04-01 16:12 11 | * Blog:http://blog.yuqiyu.com 12 | * WebSite:http://www.jianshu.com/u/092df3f77bca 13 | * Gitee:https://gitee.com/hengboy 14 | * GitHub:https://github.com/hengboy 15 | */ 16 | public class DataSourceContextHolder { 17 | /** 18 | * current thread data source pool name 19 | */ 20 | private static ThreadLocal DATA_SOURCE_POOL_NAME = new ThreadLocal(); 21 | 22 | /** 23 | * setting current thread pool name 24 | * 25 | * @param dataSourcePoolName datasource pool name 26 | */ 27 | public static void set(String dataSourcePoolName) { 28 | Assert.notNull(dataSourcePoolName, "DataSource pool name is required."); 29 | DATA_SOURCE_POOL_NAME.set(dataSourcePoolName); 30 | } 31 | 32 | /** 33 | * get current thread pool name 34 | * 35 | * @return data source pool name 36 | */ 37 | public static String get() { 38 | return DATA_SOURCE_POOL_NAME.get(); 39 | } 40 | 41 | /** 42 | * remove current thread pool name 43 | */ 44 | public static void remove() { 45 | DATA_SOURCE_POOL_NAME.remove(); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/datasource-conch-boot/src/main/java/com/nabob/conch/datasource/support/ApiBootHikariDataSource.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.datasource.support; 2 | 3 | import com.nabob.conch.datasource.ApiBootDataSource; 4 | import com.zaxxer.hikari.HikariDataSource; 5 | import com.nabob.conch.datasource.config.DataSourceHikariConfig; 6 | 7 | import javax.sql.DataSource; 8 | 9 | /** 10 | * Api Boot Hikari Data Source 11 | * 12 | * @author:恒宇少年 - 于起宇 13 | *

14 | * DateTime:2019-04-01 15:01 15 | * Blog:http://blog.yuqiyu.com 16 | * WebSite:http://www.jianshu.com/u/092df3f77bca 17 | * Gitee:https://gitee.com/hengboy 18 | * GitHub:https://github.com/hengboy 19 | */ 20 | public class ApiBootHikariDataSource extends HikariDataSource implements ApiBootDataSource { 21 | 22 | public ApiBootHikariDataSource(DataSourceHikariConfig config) { 23 | try { 24 | this.setJdbcUrl(config.getUrl()); 25 | this.setUsername(config.getUsername()); 26 | this.setPassword(config.getPassword()); 27 | config.getProperty().keySet().stream().forEach(param -> this.addDataSourceProperty(param, config.getProperty().get(param))); 28 | } catch (Exception e) { 29 | throw new RuntimeException("Create new Hikari dataSource fail.", e); 30 | } 31 | } 32 | 33 | /** 34 | * create new Hikari dataSource instance 35 | * 36 | * @return 37 | * @throws RuntimeException 38 | */ 39 | @Override 40 | public DataSource build() throws RuntimeException { 41 | return this; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/dingtalk-conch-boot/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.nabob.conch 7 | conch-boot-core 8 | ${revision} 9 | 10 | dingtalk-conch-boot 11 | 12 | 13 | ${basedir}/../../.. 14 | 15 | 16 | 17 | 18 | org.apache.commons 19 | commons-lang3 20 | 21 | 22 | org.slf4j 23 | slf4j-api 24 | 25 | 26 | org.apache.httpcomponents 27 | httpclient 28 | 29 | 30 | com.alibaba 31 | fastjson 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/dingtalk-conch-boot/src/main/java/com/nabob/conch/dingtalk/Message.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.dingtalk; 2 | 3 | /** 4 | * @Author: zjz 5 | * @Desc: 6 | * @Date: 2019/2/26 7 | * @Version: V1.0.0 8 | */ 9 | public interface Message { 10 | 11 | String toJsonString(); 12 | } 13 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/dingtalk-conch-boot/src/main/java/com/nabob/conch/dingtalk/SendResult.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.dingtalk; 2 | 3 | import com.alibaba.fastjson.JSON; 4 | 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | 8 | /** 9 | * Created by dustin on 2017/3/17. 10 | */ 11 | public class SendResult { 12 | private boolean isSuccess; 13 | private Integer errorCode; 14 | private String errorMsg; 15 | 16 | public boolean isSuccess() { 17 | return isSuccess; 18 | } 19 | 20 | public void setIsSuccess(boolean isSuccess) { 21 | this.isSuccess = isSuccess; 22 | } 23 | 24 | public Integer getErrorCode() { 25 | return errorCode; 26 | } 27 | 28 | public void setErrorCode(Integer errorCode) { 29 | this.errorCode = errorCode; 30 | } 31 | 32 | public String getErrorMsg() { 33 | return errorMsg; 34 | } 35 | 36 | public void setErrorMsg(String errorMsg) { 37 | this.errorMsg = errorMsg; 38 | } 39 | 40 | public String toString(){ 41 | Map items = new HashMap(); 42 | items.put("errorCode", errorCode); 43 | items.put("errorMsg", errorMsg); 44 | items.put("isSuccess", isSuccess); 45 | return JSON.toJSONString(items); 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/minio-conch-boot/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.nabob.conch 7 | conch-boot-core 8 | ${revision} 9 | 10 | minio-conch-boot 11 | 12 | minio-conch-boot 13 | 14 | 15 | ${basedir}/../../.. 16 | 17 | 18 | 19 | 20 | io.minio 21 | minio 22 | 23 | 24 | 25 | org.projectlombok 26 | lombok 27 | true 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/mongo-conch-boot/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.nabob.conch 7 | conch-boot-core 8 | ${revision} 9 | 10 | 11 | mongo-conch-boot 12 | 13 | 14 | ${basedir}/../../.. 15 | 16 | 17 | 18 | 19 | org.springframework.data 20 | spring-data-mongodb 21 | 22 | 23 | org.mongodb 24 | mongodb-driver-sync 25 | 26 | 27 | com.nabob.conch 28 | tools-conch-boot 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/mongo-conch-boot/src/main/java/com/nabob/conch/mongo/dao/GridDao.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.mongo.dao; 2 | 3 | import com.nabob.conch.mongo.model.MongoFile; 4 | import org.springframework.data.mongodb.core.query.Query; 5 | 6 | import java.util.List; 7 | 8 | /** 9 | * @Project: [crawler-api] 10 | * @Description: [Grid文件读写Dao] 11 | * @Author: [toming] 12 | * @CreateDate: [2/15/17 5:29 PM] 13 | * @Version: [v1.0] 14 | */ 15 | public interface GridDao { 16 | 17 | boolean exist(String gridId); 18 | 19 | String save(MongoFile mongoFile); 20 | 21 | boolean delete(String gridId); 22 | 23 | MongoFile read(String gridId); 24 | 25 | List query(Query query); 26 | } 27 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/oauth-conch-boot/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.nabob.conch 7 | conch-boot-core 8 | ${revision} 9 | 10 | oauth-conch-boot 11 | 12 | 13 | ${basedir}/../../.. 14 | 15 | 16 | 17 | 18 | org.springframework.boot 19 | spring-boot-starter 20 | 21 | 22 | 23 | org.springframework.security.oauth 24 | spring-security-oauth2 25 | 26 | 27 | 28 | org.projectlombok 29 | lombok 30 | true 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/oauth-conch-boot/src/main/java/com/nabob/conch/oauth/exception/ApiBootTokenException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright [2019] [恒宇少年 - 于起宇] 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.nabob.conch.oauth.exception; 19 | 20 | import lombok.Getter; 21 | import org.springframework.security.core.AuthenticationException; 22 | 23 | /** 24 | * ApiBoot Token Exception 25 | * 26 | * @author:恒宇少年 - 于起宇 27 | *

28 | * DateTime:2019-05-28 11:00 29 | * Blog:http://blog.yuqiyu.com 30 | * WebSite:http://www.jianshu.com/u/092df3f77bca 31 | * Gitee:https://gitee.com/hengboy 32 | * GitHub:https://github.com/hengboy 33 | */ 34 | @Getter 35 | public class ApiBootTokenException extends AuthenticationException { 36 | public ApiBootTokenException(String msg) { 37 | super(msg); 38 | } 39 | 40 | public ApiBootTokenException(String msg, Throwable t) { 41 | super(msg, t); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.nabob.conch 7 | conch-boot-parent 8 | ${revision} 9 | ../conch-boot-parent 10 | 11 | 12 | conch-boot-core 13 | pom 14 | 15 | 16 | mongo-conch-boot 17 | tools-conch-boot 18 | redis-conch-boot 19 | web-conch-boot 20 | datasource-conch-boot 21 | oauth-conch-boot 22 | security-conch-boot 23 | security-enhance-conch-boot 24 | minio-conch-boot 25 | quartz-conch-boot 26 | anti-scrapy-conch-boot 27 | dingtalk-conch-boot 28 | retrofit-conch-boot 29 | 30 | 31 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/quartz-conch-boot/src/main/java/com/nabob/conch/quartz/wrapper/ApiBootJobParamWrapper.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.quartz.wrapper; 2 | 3 | import lombok.Data; 4 | 5 | import java.util.HashMap; 6 | import java.util.Map; 7 | 8 | /** 9 | * 任务参数封装对象 10 | * 11 | * @author:恒宇少年 - 于起宇 12 | *

13 | * DateTime:2019-03-28 15:25 14 | * Blog:http://blog.yuqiyu.com 15 | * WebSite:http://www.jianshu.com/u/092df3f77bca 16 | * Gitee:https://gitee.com/hengboy 17 | * GitHub:https://github.com/hengboy 18 | */ 19 | @Data 20 | public class ApiBootJobParamWrapper { 21 | /** 22 | * 定时任务执行时的参数 23 | */ 24 | private static Map param = new HashMap(); 25 | 26 | /** 27 | * 实例化参数对象 28 | * 29 | * @return ApiBootJobParamWrapper Instance 30 | */ 31 | public static ApiBootJobParamWrapper wrapper() { 32 | return new ApiBootJobParamWrapper(); 33 | } 34 | 35 | /** 36 | * Put new param to map 37 | * 38 | * @param name param name 39 | * @param value param value 40 | * @return this object 41 | */ 42 | public ApiBootJobParamWrapper put(String name, Object value) { 43 | param.put(name, value); 44 | return this; 45 | } 46 | 47 | /** 48 | * Get all params 49 | * 50 | * @return map instance 51 | */ 52 | public Map getAllParam() { 53 | return param; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/quartz-conch-boot/src/main/java/com/nabob/conch/quartz/wrapper/ApiBootJobWrapper.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.quartz.wrapper; 2 | 3 | import lombok.AllArgsConstructor; 4 | import lombok.Getter; 5 | import lombok.Setter; 6 | import org.springframework.scheduling.quartz.QuartzJobBean; 7 | 8 | import java.io.Serializable; 9 | import java.util.Date; 10 | 11 | /** 12 | * Job封装接口定义 13 | * 14 | * @author:于起宇

15 | * ================================ 16 | * Created with IDEA. 17 | * Date:2019-01-23 18 | * Time:13:04 19 | * 个人博客:http://blog.yuqiyu.com 20 | * 简书:http://www.jianshu.com/u/092df3f77bca 21 | * 码云:https://gitee.com/hengboy 22 | * GitHub:https://github.com/hengyuboy 23 | * ================================ 24 | *

25 | */ 26 | @Getter 27 | @AllArgsConstructor 28 | public class ApiBootJobWrapper implements Serializable { 29 | /** 30 | * 任务key 31 | */ 32 | @Setter 33 | private String jobKey; 34 | /** 35 | * 任务Class 36 | */ 37 | private Class jobClass; 38 | /** 39 | * 开始执行的时间 40 | */ 41 | private Date startAtTime; 42 | /** 43 | * 参数 44 | */ 45 | private ApiBootJobParamWrapper param; 46 | 47 | /** 48 | * 不传递开启时间时,使用当前时间 49 | * 50 | * @return 获取开始时间 51 | */ 52 | public Date getStartAtTime() { 53 | return startAtTime == null ? new Date() : startAtTime; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/quartz-conch-boot/src/main/java/com/nabob/conch/quartz/wrapper/support/ApiBootCronJobWrapper.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.quartz.wrapper.support; 2 | 3 | import com.nabob.conch.quartz.wrapper.ApiBootJobParamWrapper; 4 | import com.nabob.conch.quartz.wrapper.ApiBootJobWrapper; 5 | import lombok.Builder; 6 | import lombok.Getter; 7 | import org.springframework.scheduling.quartz.QuartzJobBean; 8 | 9 | /** 10 | * CRON任务类型封装 11 | * 12 | * @author:于起宇

13 | * ================================ 14 | * Created with IDEA. 15 | * Date:2019-01-23 16 | * Time:13:42 17 | * 个人博客:http://blog.yuqiyu.com 18 | * 简书:http://www.jianshu.com/u/092df3f77bca 19 | * 码云:https://gitee.com/hengboy 20 | * GitHub:https://github.com/hengyuboy 21 | * ================================ 22 | *

23 | */ 24 | @Getter 25 | public class ApiBootCronJobWrapper extends ApiBootJobWrapper { 26 | /** 27 | * cron表达式 28 | * 任务执行方式如果为CRON_EXPRESSION时,该方法必须调用并设置值 29 | */ 30 | private String cron; 31 | 32 | /** 33 | * 构造函数初始化父类的相关字段 34 | * 35 | * @param jobKey 任务key 36 | * @param cron cron表达式 37 | * @param jobClass 执行任务类 38 | * @param param 参数封装对象 39 | */ 40 | @Builder(builderMethodName = "Context", buildMethodName = "wrapper") 41 | public ApiBootCronJobWrapper(String jobKey, Class jobClass, String cron, ApiBootJobParamWrapper param) { 42 | super(jobKey, jobClass, null, param); 43 | this.cron = cron; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/quartz-conch-boot/src/main/java/com/nabob/conch/quartz/wrapper/support/ApiBootOnceJobWrapper.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.quartz.wrapper.support; 2 | 3 | 4 | import com.nabob.conch.quartz.wrapper.ApiBootJobParamWrapper; 5 | import com.nabob.conch.quartz.wrapper.ApiBootJobWrapper; 6 | import lombok.Builder; 7 | import lombok.Getter; 8 | import org.springframework.scheduling.quartz.QuartzJobBean; 9 | 10 | import java.util.Date; 11 | 12 | /** 13 | * ONCE任务类型封装 14 | * 15 | * @author:于起宇

16 | * ================================ 17 | * Created with IDEA. 18 | * Date:2019-01-23 19 | * Time:13:43 20 | * 个人博客:http://blog.yuqiyu.com 21 | * 简书:http://www.jianshu.com/u/092df3f77bca 22 | * 码云:https://gitee.com/hengboy 23 | * GitHub:https://github.com/hengyuboy 24 | * ================================ 25 | *

26 | */ 27 | @Getter 28 | public class ApiBootOnceJobWrapper extends ApiBootJobWrapper { 29 | /** 30 | * 构造函数初始化父类的相关字段 31 | * 32 | * @param jobKey 任务key 33 | * @param jobClass 任务执行类 34 | * @param param 参数集合 35 | * @param startAtTime 开始时间 36 | */ 37 | @Builder(builderMethodName = "Context", buildMethodName = "wrapper") 38 | public ApiBootOnceJobWrapper(String jobKey, Class jobClass, Date startAtTime, ApiBootJobParamWrapper param) { 39 | super(jobKey, jobClass, startAtTime, param); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/redis-conch-boot/src/main/java/com/nabob/conch/redis/MessageListener.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.redis; 2 | 3 | import org.springframework.lang.Nullable; 4 | 5 | public interface MessageListener { 6 | 7 | /** 8 | * Callback for processing received objects through Redis. 9 | * 10 | * @param message message must not be {@literal null}. 11 | * @param channel the channel associated with the message.. 12 | * @param pattern pattern matching the channel (if specified) - can be {@literal null}. 13 | */ 14 | void onMessage(T message, String channel, @Nullable String pattern); 15 | } 16 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/redis-conch-boot/src/main/java/com/nabob/conch/redis/RedisSerializers.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.redis; 2 | 3 | import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; 4 | import org.springframework.data.redis.serializer.RedisSerializer; 5 | import org.springframework.data.redis.serializer.StringRedisSerializer; 6 | 7 | public class RedisSerializers { 8 | 9 | private Jackson2JsonRedisSerializer jacksonSerializer; 10 | 11 | public RedisSerializers(Jackson2JsonRedisSerializer jacksonSerializer) { 12 | this.jacksonSerializer = jacksonSerializer; 13 | } 14 | 15 | private static RedisSerializer stringSerializer = new StringRedisSerializer(); 16 | 17 | public Jackson2JsonRedisSerializer getJacksonSerializer() { 18 | return jacksonSerializer; 19 | } 20 | 21 | public RedisSerializer getStringSerializer() { 22 | return stringSerializer; 23 | } 24 | 25 | public byte[] serializeString(String key) { 26 | return stringSerializer.serialize(key); 27 | } 28 | 29 | public byte[] serialize(Object bean) { 30 | return jacksonSerializer.serialize(bean); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/retrofit-conch-boot/src/main/java/com/nabob/conch/retrofit/annotation/RetrofitClient.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.retrofit.annotation; 2 | 3 | import org.springframework.core.annotation.AliasFor; 4 | 5 | import java.lang.annotation.Documented; 6 | import java.lang.annotation.ElementType; 7 | import java.lang.annotation.Retention; 8 | import java.lang.annotation.RetentionPolicy; 9 | import java.lang.annotation.Target; 10 | 11 | /** 12 | * Retrofit Client Annotation 13 | * 14 | * @author Adam 15 | * @date 2020/8/3 16 | */ 17 | @Target(ElementType.TYPE) 18 | @Retention(RetentionPolicy.RUNTIME) 19 | @Documented 20 | public @interface RetrofitClient { 21 | 22 | /** 23 | * Client Name 24 | */ 25 | @AliasFor("name") 26 | String value() default ""; 27 | 28 | /** 29 | * Client Name 30 | */ 31 | @AliasFor("value") 32 | String name() default ""; 33 | 34 | /** 35 | * Application Name : to support to modify remote call to local 36 | */ 37 | String applicationName() default ""; 38 | 39 | /** 40 | * @return an absolute URL or resolvable hostname (the protocol is optional). 41 | */ 42 | String url() default ""; 43 | 44 | } 45 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/retrofit-conch-boot/src/main/java/com/nabob/conch/retrofit/retrofit/DefaultOkHttpClientConnectionPoolFactory.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.retrofit.retrofit; 2 | 3 | import okhttp3.ConnectionPool; 4 | 5 | import java.util.concurrent.TimeUnit; 6 | 7 | public class DefaultOkHttpClientConnectionPoolFactory implements OkHttpClientConnectionPoolFactory { 8 | 9 | @Override 10 | public ConnectionPool create(int maxIdleConnections, long keepAliveDuration, 11 | TimeUnit timeUnit) { 12 | return new ConnectionPool(maxIdleConnections, keepAliveDuration, timeUnit); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/retrofit-conch-boot/src/main/java/com/nabob/conch/retrofit/retrofit/OkHttpClientConnectionPoolFactory.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.retrofit.retrofit; 2 | 3 | import okhttp3.ConnectionPool; 4 | 5 | import java.util.concurrent.TimeUnit; 6 | 7 | public interface OkHttpClientConnectionPoolFactory { 8 | 9 | /** 10 | * Creates a new {@link ConnectionPool}. 11 | * 12 | * @param maxIdleConnections Number of max idle connections to allow. 13 | * @param keepAliveDuration Amount of time to keep connections alive. 14 | * @param timeUnit The time unit for the keep-alive duration. 15 | * @return A new {@link ConnectionPool}. 16 | */ 17 | ConnectionPool create(int maxIdleConnections, long keepAliveDuration, TimeUnit timeUnit); 18 | 19 | } 20 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/retrofit-conch-boot/src/main/java/com/nabob/conch/retrofit/retrofit/OkHttpClientFactory.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.retrofit.retrofit; 2 | 3 | import okhttp3.OkHttpClient.Builder; 4 | 5 | import javax.net.ssl.HostnameVerifier; 6 | import javax.net.ssl.SSLSession; 7 | import javax.net.ssl.X509TrustManager; 8 | import java.security.cert.CertificateException; 9 | import java.security.cert.X509Certificate; 10 | 11 | public interface OkHttpClientFactory { 12 | 13 | Builder createBuilder(boolean disableSslValidation); 14 | 15 | public static class TrustAllHostnames implements HostnameVerifier { 16 | public TrustAllHostnames() { 17 | } 18 | 19 | @Override 20 | public boolean verify(String s, SSLSession sslSession) { 21 | return true; 22 | } 23 | } 24 | 25 | public static class DisableValidationTrustManager implements X509TrustManager { 26 | public DisableValidationTrustManager() { 27 | } 28 | 29 | @Override 30 | public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { 31 | } 32 | 33 | @Override 34 | public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException { 35 | } 36 | 37 | @Override 38 | public X509Certificate[] getAcceptedIssuers() { 39 | return new X509Certificate[0]; 40 | } 41 | } 42 | } -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/security-conch-boot/src/main/java/com/nabob/conch/security/SecurityUser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright [2019] [恒宇少年 - 于起宇] 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.nabob.conch.security; 18 | 19 | import lombok.Data; 20 | 21 | /** 22 | * SpringSecurity 内存方式用户配置 23 | * 24 | * @author:恒宇少年 - 于起宇 25 | *

26 | * DateTime:2019-03-14 15:42 27 | * Blog:http://blog.yuqiyu.com 28 | * WebSite:http://www.jianshu.com/u/092df3f77bca 29 | * Gitee:https://gitee.com/hengboy 30 | * GitHub:https://github.com/hengboy 31 | */ 32 | @Data 33 | public class SecurityUser { 34 | /** 35 | * 用户名 36 | */ 37 | private String username; 38 | /** 39 | * 用户密码 40 | */ 41 | private String password; 42 | /** 43 | * 用户角色集合 44 | */ 45 | private String[] roles = new String[]{"api"}; 46 | } 47 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/security-enhance-conch-boot/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.nabob.conch 7 | conch-boot-core 8 | ${revision} 9 | 10 | security-enhance-conch-boot 11 | 12 | security-enhance-conch-boot 13 | 添加登录相关支持 14 | 15 | 16 | ${basedir}/../../.. 17 | 18 | 19 | 20 | 21 | com.nabob.conch 22 | web-conch-boot 23 | 24 | 25 | 26 | org.springframework.boot 27 | spring-boot-starter-security 28 | true 29 | 30 | 31 | 32 | com.google.guava 33 | guava 34 | true 35 | 36 | 37 | 38 | org.projectlombok 39 | lombok 40 | true 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/security-enhance-conch-boot/src/main/java/com/nabob/conch/security/enhance/domain/LoginType.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.security.enhance.domain; 2 | 3 | public enum LoginType { 4 | pwd, 5 | sms, 6 | social; // 第三方登录 7 | } 8 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/security-enhance-conch-boot/src/main/java/com/nabob/conch/security/enhance/domain/SecurityUser.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.security.enhance.domain; 2 | 3 | /** 4 | * @Author: zjz 5 | * @Desc: 定义鉴权用户的方法,需业务实现 6 | * @Date: 2019/8/4 7 | * @Version: V1.0.0 8 | */ 9 | public interface SecurityUser { 10 | 11 | String getUserName(); 12 | 13 | String getPassword(); 14 | 15 | String getSmsCode(); 16 | 17 | } 18 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/security-enhance-conch-boot/src/main/java/com/nabob/conch/security/enhance/domain/SecurityUserDetails.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.security.enhance.domain; 2 | 3 | import org.springframework.security.core.userdetails.UserDetails; 4 | 5 | /** 6 | * @Author: zjz 7 | * @Desc: 提供给security使用,需业务实现 8 | * @Date: 2019/8/4 9 | * @Version: V1.0.0 10 | */ 11 | public interface SecurityUserDetails extends UserDetails { 12 | } 13 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/IdCard/IDCardInfo.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.IdCard; 2 | 3 | import java.util.Date; 4 | 5 | /** 6 | * @Project: [CommonUtil] 7 | * @Description: [description] 8 | * @Author: [toming] 9 | * @CreateDate: [7/23/16 1:36 PM] 10 | * @Version: [v1.0] 11 | */ 12 | public interface IDCardInfo { 13 | String getZone(); 14 | 15 | String getIdCard(); 16 | 17 | void checkSex(Integer sex) throws InvalidException; 18 | 19 | Integer getSex(); 20 | 21 | void checkInfo() throws InvalidException; 22 | 23 | Integer getBirthYear(); 24 | 25 | Integer getBirthMonth(); 26 | 27 | Integer getBirthDay(); 28 | 29 | Date getBirthDate(); 30 | } 31 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/IdCard/InvalidException.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.IdCard; 2 | 3 | public class InvalidException extends Exception { 4 | public InvalidException() { 5 | } 6 | 7 | public InvalidException(String message) { 8 | super(message); 9 | } 10 | 11 | public InvalidException(String message, Throwable cause) { 12 | super(message, cause); 13 | } 14 | 15 | public InvalidException(Throwable cause) { 16 | super(cause); 17 | } 18 | 19 | public InvalidException(String message, Throwable cause, boolean enableSuppression, boolean writableStackTrace) { 20 | super(message, cause, enableSuppression, writableStackTrace); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/cast/Caster.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.cast; 2 | 3 | 4 | public interface Caster { 5 | Object cast(Object object); 6 | } 7 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/cast/CasterUtils.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.cast; 2 | 3 | 4 | import java.util.HashMap; 5 | import java.util.Map; 6 | 7 | public class CasterUtils { 8 | 9 | private final static Map casterMap = new HashMap<>(); 10 | 11 | static { 12 | casterMap.put(Integer.class, new IntegerCaster()); 13 | casterMap.put(Double.class, new DoubleCaster()); 14 | casterMap.put(String.class, new StringCaster()); 15 | casterMap.put(Long.class, new LongCaster()); 16 | } 17 | 18 | public static Caster get(Class clazz) { 19 | return casterMap.get(clazz); 20 | } 21 | 22 | public static T cast(Object o, Class clazz) { 23 | if (o == null) 24 | return null; 25 | Caster caster = get(clazz); 26 | if (caster == null) { 27 | throw new IllegalArgumentException(String.format("can not case%s to %s", o.toString(), clazz.getSimpleName())); 28 | } else { 29 | return (T) caster.cast(o); 30 | } 31 | } 32 | 33 | public static T cast(Object o, Class clazz, T defaultVal) { 34 | if (o == null) 35 | return null; 36 | Caster caster = get(clazz); 37 | if (caster == null) { 38 | return defaultVal; 39 | } else { 40 | return (T) caster.cast(o); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/cast/DoubleCaster.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.cast; 2 | 3 | import org.apache.commons.lang3.StringUtils; 4 | 5 | /** 6 | * [转换为double] 7 | */ 8 | public class DoubleCaster implements Caster { 9 | @Override 10 | public Object cast(Object object) { 11 | if (object == null) 12 | return null; 13 | if (object instanceof Number) { 14 | return ((Number) object).doubleValue(); 15 | } else { 16 | String str = String.valueOf(object); 17 | if (StringUtils.isBlank(str)) { 18 | return null; 19 | } else { 20 | return Double.valueOf(str.trim()); 21 | } 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/cast/IntegerCaster.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.cast; 2 | 3 | 4 | import org.apache.commons.lang3.StringUtils; 5 | 6 | /** 7 | * [转换为int] 8 | */ 9 | public class IntegerCaster implements Caster { 10 | @Override 11 | public Object cast(Object object) { 12 | if (object == null) 13 | return null; 14 | if (object instanceof Number) { 15 | return ((Number) object).intValue(); 16 | } else { 17 | String str = String.valueOf(object); 18 | if (StringUtils.isBlank(str)) { 19 | return null; 20 | } else { 21 | return Integer.valueOf(str.trim()); 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/cast/LongCaster.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.cast; 2 | 3 | 4 | import org.apache.commons.lang3.StringUtils; 5 | 6 | /** 7 | *[转换为int] 8 | */ 9 | public class LongCaster implements Caster { 10 | @Override 11 | public Object cast(Object object) { 12 | if (object == null) 13 | return null; 14 | if (object instanceof Number) { 15 | return ((Number) object).longValue(); 16 | } else { 17 | String str = String.valueOf(object); 18 | if (StringUtils.isBlank(str)) { 19 | return null; 20 | } else { 21 | return Long.valueOf(str.trim()); 22 | } 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/cast/StringCaster.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.cast; 2 | 3 | import java.math.BigDecimal; 4 | 5 | /** 6 | * [转换为字符串] 7 | */ 8 | public class StringCaster implements Caster { 9 | @Override 10 | public Object cast(Object object) { 11 | if (object == null) 12 | return null; 13 | if (object instanceof Number) { 14 | //防止java用科学计数法 15 | return new BigDecimal(String.valueOf(object)).toPlainString(); 16 | } else { 17 | return String.valueOf(object).trim(); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/code/AbstractServiceCode.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.code; 2 | 3 | /** 4 | * @Author: zjz 5 | * @Desc: 6 | * @Date: 2019/1/7 7 | * @Version: V1.0.0 8 | */ 9 | public abstract class AbstractServiceCode implements ServiceCode{ 10 | 11 | @Override 12 | public boolean equals(Object obj) { 13 | if (obj == null) { 14 | return false; 15 | } else if (ServiceCode.class.isAssignableFrom(obj.getClass())) { 16 | return this.getCode() == ((ServiceCode) obj).getCode(); 17 | } else { 18 | return false; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/code/DefaultServiceCode.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.code; 2 | 3 | /** 4 | * @Author: zjz 5 | * @Desc: 6 | * @Date: 2019/1/7 7 | * @Version: V1.0.0 8 | */ 9 | public class DefaultServiceCode extends AbstractServiceCode{ 10 | 11 | public DefaultServiceCode(int code, String desc) { 12 | this(code, desc, "请求成功"); 13 | } 14 | 15 | public DefaultServiceCode(int code, String desc, String message) { 16 | this.code = code; 17 | this.desc = desc; 18 | this.message = message; 19 | } 20 | 21 | private int code; 22 | private String desc; 23 | private String message; 24 | 25 | @Override 26 | public int getCode() { 27 | return code; 28 | } 29 | 30 | @Override 31 | public String getDesc() { 32 | return desc; 33 | } 34 | 35 | @Override 36 | public void setCode(int code) { 37 | this.code = code; 38 | } 39 | 40 | @Override 41 | public void setDesc(String desc) { 42 | this.desc = desc; 43 | } 44 | 45 | @Override 46 | public String getMesg() { 47 | return message; 48 | } 49 | 50 | @Override 51 | public void setMesg(String mesg) { 52 | this.message = message; 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/code/ServiceCode.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.code; 2 | 3 | /** 4 | * @Author: zjz 5 | * @Desc: 6 | * @Date: 2019/1/7 7 | * @Version: V1.0.0 8 | */ 9 | public interface ServiceCode { 10 | 11 | public int getCode(); 12 | 13 | public String getDesc(); 14 | 15 | default Object getData() { 16 | return null; 17 | } 18 | 19 | void setCode(int code); 20 | 21 | void setDesc(String desc); 22 | 23 | String getMesg(); 24 | 25 | void setMesg(String mesg); 26 | 27 | default String name() { 28 | return "UnKnownError"; 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/collections/CrossJoinOnOp.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.collections; 2 | 3 | import java.util.function.Function; 4 | import java.util.function.Predicate; 5 | 6 | public interface CrossJoinOnOp { 7 | CrossJoinOnOp filter(Predicate predicate); 8 | 9 | CrossJoinOnOp map(Function mapper); 10 | 11 | BaseSmartStream.CrossJoinCollectOp on(Function leftKeyFunction, Function rightKeyFunction); 12 | } 13 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/collections/LeftJoinCollectOp.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.collections; 2 | 3 | import org.apache.commons.lang3.tuple.Pair; 4 | 5 | import java.util.function.BiConsumer; 6 | import java.util.function.BiFunction; 7 | import java.util.function.Function; 8 | 9 | public interface LeftJoinCollectOp { 10 | LeftJoinCollectOp with(BiConsumer resultConsumer); 11 | 12 | void foreach(BiConsumer resultConsumer); 13 | 14 | LeftJoinCollectOp mapR(Function mapper); 15 | 16 | SmartStream toL(); 17 | 18 | SmartStream toR(); 19 | 20 | SmartStream> toPair(); 21 | 22 | SmartStream to(BiFunction resultFunction); 23 | } 24 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/collections/LeftJoinMultiCollectOp.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.collections; 2 | 3 | import org.apache.commons.lang3.tuple.Pair; 4 | 5 | import java.util.List; 6 | import java.util.function.BiConsumer; 7 | import java.util.function.BiFunction; 8 | import java.util.function.Function; 9 | 10 | public interface LeftJoinMultiCollectOp { 11 | LeftJoinMultiCollectOp mapR(Function mapper); 12 | 13 | LeftJoinMultiCollectOp with(BiConsumer resultConsumer); 14 | 15 | LeftJoinMultiCollectOp withMulti(BiConsumer> resultConsumer); 16 | 17 | void foreach(BiConsumer resultConsumer); 18 | 19 | void foreachMulti(BiConsumer> resultConsumer); 20 | 21 | SmartStream toL(); 22 | 23 | SmartStream toR(); 24 | 25 | SmartStream> toPair(); 26 | 27 | SmartStream>> toMultiPair(); 28 | 29 | SmartStream to(BiFunction resultFunction); 30 | 31 | SmartStream toMulti(BiFunction, F> resultFunction); 32 | } 33 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/collections/LeftJoinOnOp.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.collections; 2 | 3 | import java.util.function.Function; 4 | import java.util.function.Predicate; 5 | 6 | public interface LeftJoinOnOp { 7 | LeftJoinOnOp filter(Predicate predicate); 8 | 9 | LeftJoinOnOp map(Function mapper); 10 | 11 | LeftJoinCollectOp on(Function leftKeyFunction, Function rightKeyFunction); 12 | 13 | LeftJoinMultiCollectOp onMulti(Function leftKeyFunction, Function rightKeyFunction); 14 | } 15 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/collections/SmartStream.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.collections; 2 | 3 | import java.util.Collection; 4 | import java.util.stream.Stream; 5 | 6 | public interface SmartStream extends Stream { 7 | LeftJoinOnOp leftJoin(Collection right); 8 | 9 | CrossJoinOnOp crossJoin(Collection right); 10 | } 11 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/enums/YesOrNo.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright [2019] [恒宇少年 - 于起宇] 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.nabob.conch.tools.enums; 18 | 19 | /** 20 | * Yes Or No 枚举定义 21 | * 22 | * @author:恒宇少年 - 于起宇 23 | *

24 | * DateTime:2019-03-14 16:26 25 | * Blog:http://blog.yuqiyu.com 26 | * WebSite:http://www.jianshu.com/u/092df3f77bca 27 | * Gitee:https://gitee.com/hengboy 28 | * GitHub:https://github.com/hengboy 29 | */ 30 | public enum YesOrNo { 31 | YES("Y"), 32 | NO("N"); 33 | private String value; 34 | 35 | YesOrNo() { 36 | } 37 | 38 | YesOrNo(String value) { 39 | this.value = value; 40 | } 41 | 42 | public String getValue() { 43 | return value; 44 | } 45 | 46 | public void setValue(String value) { 47 | this.value = value; 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/function/BiConsumer.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.function; 2 | 3 | import java.util.Objects; 4 | 5 | 6 | @FunctionalInterface 7 | public interface BiConsumer { 8 | /** 9 | * Performs this operation on the given argument. 10 | * 11 | * @param a the first input argument 12 | * @param b the second input argument 13 | */ 14 | void accept(A a, B b); 15 | 16 | /** 17 | * Returns a composed {@code Consumer} that performs, in sequence, this 18 | * operation followed by the {@code after} operation. If performing either 19 | * operation throws an exception, it is relayed to the caller of the 20 | * composed operation. If performing this operation throws an exception, 21 | * the {@code after} operation will not be performed. 22 | * 23 | * @param after the operation to perform after this operation 24 | * @return a composed {@code Consumer} that performs in sequence this 25 | * operation followed by the {@code after} operation 26 | * @throws NullPointerException if {@code after} is null 27 | */ 28 | default BiConsumer andThen(BiConsumer after) { 29 | Objects.requireNonNull(after); 30 | return (A a, B b) -> { 31 | accept(a, b); 32 | after.accept(a, b); 33 | }; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/function/Generator.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.function; 2 | 3 | 4 | @FunctionalInterface 5 | public interface Generator { 6 | T generate(); 7 | } 8 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/function/Holder.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.function; 2 | 3 | import java.util.function.Function; 4 | 5 | /** 6 | * Created by tangming on 4/1/17. 7 | */ 8 | public class Holder { 9 | private T data; 10 | 11 | public Holder() { 12 | this(null); 13 | } 14 | 15 | public Holder(T data) { 16 | this.data = data; 17 | } 18 | 19 | public T getData() { 20 | return data; 21 | } 22 | 23 | public void updateData(T data) { 24 | this.data = data; 25 | } 26 | 27 | public void updateData(Function updater) { 28 | this.data = updater.apply(data); 29 | } 30 | 31 | public void clear() { 32 | this.data = null; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/function/Pair.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.function; 2 | 3 | public class Pair { 4 | private T _first; 5 | private V _second; 6 | 7 | public Pair() { 8 | } 9 | 10 | public Pair(T first, V _second) { 11 | this._first = first; 12 | this._second = _second; 13 | } 14 | 15 | public T get_first() { 16 | return _first; 17 | } 18 | 19 | public void set_first(T _first) { 20 | this._first = _first; 21 | } 22 | 23 | public V get_second() { 24 | return _second; 25 | } 26 | 27 | public void set_second(V _second) { 28 | this._second = _second; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/function/RunnableWithError.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.function; 2 | 3 | 4 | public interface RunnableWithError { 5 | void run() throws Throwable; 6 | } 7 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/functions/ThrowableBiConsumer.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.functions; 2 | 3 | public interface ThrowableBiConsumer { 4 | 5 | /** 6 | * Performs this operation on the given arguments. 7 | * 8 | * @param t the first input argument 9 | * @param u the second input argument 10 | */ 11 | void accept(T t, U u) throws E; 12 | } 13 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/functions/ThrowableBiFunction.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.functions; 2 | 3 | import java.util.function.BiFunction; 4 | 5 | /** 6 | * Represents a function which produces result from input arguments and can throw an exception. 7 | * 8 | * @param the type of the first argument to the function 9 | * @param the type of the second argument to the function 10 | * @param the type of the result of the function 11 | * @param the type of the exception 12 | * @see BiFunction 13 | */ 14 | public interface ThrowableBiFunction { 15 | 16 | /** 17 | * Applies this function to the given arguments. 18 | * 19 | * @param t the first function argument 20 | * @param u the second function argument 21 | * @return the function result 22 | */ 23 | R apply(T t, U u) throws E; 24 | } 25 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/functions/ThrowableBiPredicate.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.functions; 2 | 3 | import java.util.function.BiPredicate; 4 | import java.util.function.Predicate; 5 | 6 | /** 7 | * Represents a predicate (boolean-valued function) of two arguments. This is 8 | * the two-arity specialization of {@link Predicate}. 9 | *

10 | *

This is a functional interface 11 | * whose functional method is {@link #test(Object, Object)}. 12 | * 13 | * @param the type of the first argument to the predicate 14 | * @param the type of the second argument the predicate 15 | * @param the type of the exception 16 | * @see BiPredicate 17 | */ 18 | public interface ThrowableBiPredicate { 19 | 20 | /** 21 | * Evaluates this predicate on the given arguments. 22 | * 23 | * @param t the first input argument 24 | * @param u the second input argument 25 | * @return {@code true} if the input arguments match the predicate, 26 | * otherwise {@code false} 27 | */ 28 | boolean test(T t, U u) throws E; 29 | } 30 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/functions/ThrowableConsumer.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.functions; 2 | 3 | import java.util.function.Consumer; 4 | 5 | /** 6 | * Represents an operation on input argument and can throw an exception. 7 | * 8 | * @param the type of the input to the operation 9 | * @param the type of the exception 10 | * @see Consumer 11 | */ 12 | public interface ThrowableConsumer { 13 | 14 | /** 15 | * Performs operation on argument. 16 | * 17 | * @param value the input argument 18 | * @throws E an exception 19 | */ 20 | void accept(T value) throws E; 21 | } 22 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/functions/ThrowableDoubleConsumer.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.functions; 2 | 3 | import java.util.function.DoubleConsumer; 4 | 5 | /** 6 | * Represents an operation on a {@code double}-valued input argument. 7 | * 8 | * @param the type of the exception 9 | * @see DoubleConsumer 10 | * @since 1.1.7 11 | */ 12 | public interface ThrowableDoubleConsumer { 13 | 14 | /** 15 | * Performs operation on the given argument. 16 | * 17 | * @param value the input argument 18 | * @throws E an exception 19 | */ 20 | void accept(double value) throws E; 21 | } 22 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/functions/ThrowableDoubleFunction.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.functions; 2 | 3 | import java.util.function.DoubleFunction; 4 | 5 | /** 6 | * Represents a function which produces result from {@code double}-valued input argument. 7 | * 8 | * @param the type of the result of the function 9 | * @param the type of the exception 10 | * 11 | * @since 1.1.7 12 | * @see DoubleFunction 13 | */ 14 | public interface ThrowableDoubleFunction { 15 | 16 | /** 17 | * Applies this function to the given argument. 18 | * 19 | * @param value the function argument 20 | * @return the function result 21 | * @throws E an exception 22 | */ 23 | R apply(double value) throws E; 24 | } -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/functions/ThrowableDoublePredicate.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.functions; 2 | 3 | /** 4 | * Represents a {@code double}-valued predicate (function with boolean type result). 5 | * 6 | * @param the type of the exception 7 | * @since 1.1.7 8 | * @see java.util.function.DoublePredicate 9 | */ 10 | public interface ThrowableDoublePredicate { 11 | 12 | /** 13 | * Tests the value for satisfying predicate. 14 | * 15 | * @param value the value to be tested 16 | * @return {@code true} if the value matches the predicate, otherwise {@code false} 17 | * @throws E an exception 18 | */ 19 | boolean test(double value) throws E; 20 | } 21 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/functions/ThrowableDoubleSupplier.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.functions; 2 | 3 | /** 4 | * Represents a supplier of {@code double}-valued results. 5 | * 6 | * @param the type of the exception 7 | * @since 1.1.7 8 | * @see java.util.function.DoubleSupplier 9 | */ 10 | public interface ThrowableDoubleSupplier { 11 | 12 | /** 13 | * Gets a result. 14 | * 15 | * @return a result 16 | * @throws E an exception 17 | */ 18 | double getAsDouble() throws E; 19 | } 20 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/functions/ThrowableFunction.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.functions; 2 | 3 | import java.util.function.Function; 4 | 5 | /** 6 | * Represents a function which produces result from input arguments and can throw an exception. 7 | * 8 | * @param the type of the input of the function 9 | * @param the type of the result of the function 10 | * @param the type of the exception 11 | * @see Function 12 | */ 13 | public interface ThrowableFunction { 14 | 15 | /** 16 | * Applies this function to the given argument. 17 | * 18 | * @param i an argument 19 | * @return the function result 20 | * @throws E an exception 21 | */ 22 | R apply(I i) throws E; 23 | } 24 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/functions/ThrowableIntConsumer.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.functions; 2 | 3 | /** 4 | * Represents an operation on {@code int}-valued input argument. 5 | * 6 | * @param the type of the exception 7 | * @since 1.1.7 8 | * @see java.util.function.IntConsumer 9 | */ 10 | public interface ThrowableIntConsumer { 11 | 12 | /** 13 | * Performs operation on the given argument. 14 | * 15 | * @param value the input argument 16 | * @throws E an exception 17 | */ 18 | void accept(int value) throws E; 19 | } 20 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/functions/ThrowableIntFunction.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.functions; 2 | 3 | import java.util.function.IntFunction; 4 | 5 | /** 6 | * Represents a function which produces result from {@code int}-valued input argument. 7 | * 8 | * @param the type of the result of the function 9 | * @param the type of the exception 10 | * 11 | * @since 1.1.7 12 | * @see IntFunction 13 | */ 14 | public interface ThrowableIntFunction { 15 | 16 | /** 17 | * Applies this function to the given argument. 18 | * 19 | * @param value the function argument 20 | * @return the function result 21 | * @throws E an exception 22 | */ 23 | R apply(int value) throws E; 24 | } -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/functions/ThrowableIntPredicate.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.functions; 2 | 3 | /** 4 | * Represents an {@code int}-valued predicate (function with boolean type result). 5 | * 6 | * @param the type of the exception 7 | * @since 1.1.7 8 | * @see java.util.function.IntPredicate 9 | */ 10 | public interface ThrowableIntPredicate { 11 | 12 | /** 13 | * Tests the value for satisfying predicate. 14 | * 15 | * @param value the value to be tested 16 | * @return {@code true} if the value matches the predicate, otherwise {@code false} 17 | * @throws E an exception 18 | */ 19 | boolean test(int value) throws E; 20 | } 21 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/functions/ThrowableIntSupplier.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.functions; 2 | 3 | /** 4 | * Represents a supplier of {@code int}-valued results. 5 | * 6 | * @param the type of the exception 7 | * @since 1.1.7 8 | * @see java.util.function.IntSupplier 9 | */ 10 | public interface ThrowableIntSupplier { 11 | 12 | /** 13 | * Gets a result. 14 | * 15 | * @return a result 16 | * @throws E an exception 17 | */ 18 | int getAsInt() throws E; 19 | } 20 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/functions/ThrowableLongConsumer.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.functions; 2 | 3 | /** 4 | * Represents an operation on a {@code long}-valued input argument. 5 | * 6 | * @param the type of the exception 7 | * @since 1.1.7 8 | * @see java.util.function.LongConsumer 9 | */ 10 | public interface ThrowableLongConsumer { 11 | 12 | /** 13 | * Performs operation on the given argument. 14 | * 15 | * @param value the input argument 16 | * @throws E an exception 17 | */ 18 | void accept(long value) throws E; 19 | } 20 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/functions/ThrowableLongFunction.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.functions; 2 | 3 | /** 4 | * Represents a function which produces result from {@code long}-valued input argument. 5 | * 6 | * @param the type of the result of the function 7 | * @param the type of the exception 8 | * 9 | * @since 1.1.7 10 | * @see java.util.function.LongFunction 11 | */ 12 | public interface ThrowableLongFunction { 13 | 14 | /** 15 | * Applies this function to the given argument. 16 | * 17 | * @param value the function argument 18 | * @return the function result 19 | * @throws E an exception 20 | */ 21 | R apply(long value) throws E; 22 | } -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/functions/ThrowableLongPredicate.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.functions; 2 | 3 | /** 4 | * Represents a {@code long}-valued predicate (function with boolean type result). 5 | * 6 | * @param the type of the exception 7 | * @since 1.1.7 8 | * @see java.util.function.LongPredicate 9 | */ 10 | public interface ThrowableLongPredicate { 11 | 12 | /** 13 | * Tests the value for satisfying predicate. 14 | * 15 | * @param value the value to be tested 16 | * @return {@code true} if the value matches the predicate, otherwise {@code false} 17 | * @throws E an exception 18 | */ 19 | boolean test(long value) throws E; 20 | } 21 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/functions/ThrowableLongSupplier.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.functions; 2 | 3 | /** 4 | * Represents a supplier of {@code long}-valued results. 5 | * 6 | * @param the type of the exception 7 | * @since 1.1.7 8 | * @see java.util.function.LongSupplier 9 | */ 10 | public interface ThrowableLongSupplier { 11 | 12 | /** 13 | * Gets a result. 14 | * 15 | * @return a result 16 | * @throws E an exception 17 | */ 18 | long getAsLong() throws E; 19 | } 20 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/functions/ThrowablePredicate.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.functions; 2 | 3 | import java.util.function.Predicate; 4 | 5 | /** 6 | * Represents a predicate (function with boolean type result) which can throw an exception. 7 | * 8 | * @param the type of the input to the function 9 | * @param the type of the exception 10 | * @see Predicate 11 | */ 12 | public interface ThrowablePredicate { 13 | 14 | /** 15 | * Tests the value for satisfying predicate. 16 | * 17 | * @param value the value to be tested 18 | * @return {@code true} if the value matches the predicate, otherwise {@code false} 19 | * @throws E an exception 20 | */ 21 | boolean test(T value) throws E; 22 | } 23 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/functions/ThrowableSupplier.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.functions; 2 | 3 | import java.util.function.Supplier; 4 | 5 | /** 6 | * Represents a function for supplying result which can throw an exception. 7 | * 8 | * @param the type of the result 9 | * @param the type of the exception 10 | * @see Supplier 11 | */ 12 | public interface ThrowableSupplier { 13 | 14 | /** 15 | * Gets a result. 16 | * 17 | * @return a result 18 | * @throws E an exception 19 | */ 20 | T get() throws E; 21 | } 22 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/functions/ThrowaleCallable.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.functions; 2 | 3 | public interface ThrowaleCallable extends ThrowableSupplier { 4 | 5 | /** 6 | * Gets a result. 7 | * 8 | * @return a result 9 | * @throws E an exception 10 | */ 11 | T call() throws E; 12 | 13 | @Override 14 | default Object get() throws Throwable { 15 | return call(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/guard/DefaultGuard.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.guard; 2 | 3 | import com.nabob.conch.tools.function.Generator; 4 | 5 | public class DefaultGuard extends AbstractGuard { 6 | 7 | public DefaultGuard() { 8 | super(1); 9 | } 10 | 11 | public DefaultGuard(String name) { 12 | super(name, 1); 13 | } 14 | 15 | public void linger(long linger) { 16 | this.linger = linger; 17 | } 18 | 19 | private Generator checkHandle; 20 | 21 | public void checkMaster(Generator checkHandle) { 22 | this.checkHandle = checkHandle; 23 | } 24 | 25 | @Override 26 | protected boolean checkMaster() { 27 | return checkHandle == null ? true : checkHandle.generate(); 28 | } 29 | 30 | private Runnable guardHandle; 31 | 32 | public void onGuard(Runnable guardHandle) { 33 | this.guardHandle = guardHandle; 34 | } 35 | 36 | @Override 37 | protected void onGuard() { 38 | if (guardHandle != null) { 39 | guardHandle.run(); 40 | } 41 | } 42 | 43 | private Runnable normalHandle; 44 | 45 | public void onNormal(Runnable normalHandle) { 46 | this.normalHandle = normalHandle; 47 | } 48 | 49 | @Override 50 | protected void onNormal() { 51 | if (this.normalHandle != null) { 52 | this.normalHandle.run(); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/guard/Guard.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.guard; 2 | 3 | public interface Guard { 4 | 5 | /** 6 | * 当前是否为守护状态 7 | */ 8 | boolean isGuard(); 9 | 10 | /** 11 | * 尝试唤醒守护者 12 | */ 13 | void awake(); 14 | 15 | void pause(); 16 | } 17 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/image/Code.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.image; 2 | 3 | import java.util.Objects; 4 | 5 | /** 6 | * code定义 7 | * 8 | * @author layker 9 | * @date 2018/4/25 上午10:41 10 | */ 11 | public class Code { 12 | private String code; 13 | private String imgBase64Str; 14 | 15 | 16 | @Override 17 | public String toString() { 18 | return "Code{" + 19 | "code='" + code + '\'' + 20 | ", imgBase64Str='" + imgBase64Str + '\'' + 21 | '}'; 22 | } 23 | 24 | public Code() { 25 | } 26 | 27 | public Code(String code, String imgBase64Str) { 28 | this.code = code; 29 | this.imgBase64Str = imgBase64Str; 30 | } 31 | 32 | @Override 33 | public boolean equals(Object o) { 34 | if (this == o) return true; 35 | if (o == null || getClass() != o.getClass()) return false; 36 | Code code1 = (Code) o; 37 | return Objects.equals(code, code1.code); 38 | } 39 | 40 | @Override 41 | public int hashCode() { 42 | 43 | return Objects.hash(code); 44 | } 45 | 46 | public String getCode() { 47 | return code; 48 | } 49 | 50 | public void setCode(String code) { 51 | this.code = code; 52 | } 53 | 54 | public String getImgBase64Str() { 55 | return imgBase64Str; 56 | } 57 | 58 | public void setImgBase64Str(String imgBase64Str) { 59 | this.imgBase64Str = imgBase64Str; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/image/ImageGenerator.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.image; 2 | 3 | /** 4 | * 验证码图片生产器接口 5 | * 6 | * @author layker 7 | * @date 2018/4/24 下午6:52 8 | */ 9 | public interface ImageGenerator { 10 | 11 | /** 12 | * 生成图片验证码,默认参数 w=45,h=20,len=4, 13 | * 14 | * @return 图片验证码base64字符串 15 | */ 16 | Code generate(); 17 | 18 | Code generate(int w, int h, int len); 19 | } 20 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/json/BeanExtendUtils.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.json; 2 | 3 | import java.beans.BeanInfo; 4 | import java.beans.Introspector; 5 | import java.beans.PropertyDescriptor; 6 | import java.lang.reflect.Method; 7 | import java.util.HashMap; 8 | import java.util.Map; 9 | 10 | /** 11 | * @Project: [CommonUtil] 12 | * @Description: [Bean工具] 13 | * @Author: [toming] 14 | * @CreateDate: [6/17/16 5:47 PM] 15 | * @Version: [v1.0] 16 | */ 17 | public class BeanExtendUtils { 18 | 19 | public static Map bean2map(Object bean) { 20 | if (bean == null) { 21 | return null; 22 | } 23 | Map map = new HashMap(); 24 | try { 25 | BeanInfo beanInfo = Introspector.getBeanInfo(bean.getClass()); 26 | PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors(); 27 | for (PropertyDescriptor property : propertyDescriptors) { 28 | String key = property.getName(); 29 | 30 | // 过滤class属性 31 | if (!key.equals("class")) { 32 | // 得到property对应的getter方法 33 | Method getter = property.getReadMethod(); 34 | Object value = getter.invoke(bean); 35 | 36 | map.put(key, value); 37 | } 38 | 39 | } 40 | } catch (Exception e) { 41 | System.out.println("transBean2Map Error " + e); 42 | } 43 | 44 | return map; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/json/GsonWrapUtils.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.json; 2 | 3 | import com.nabob.conch.tools.utils.Assert; 4 | 5 | /** 6 | * 和class一起转json,效率低! 7 | */ 8 | public class GsonWrapUtils { 9 | public static String toJson(Object bean) { 10 | Wrapper wrapper = new Wrapper(); 11 | wrapper.setClazz(bean.getClass().getName()); 12 | wrapper.setData(GsonUtils.toJson(bean)); 13 | return GsonUtils.toJson(wrapper); 14 | } 15 | 16 | public static Object fromJson(String json) throws ClassNotFoundException { 17 | if (json == null) 18 | return null; 19 | Wrapper wrapper = GsonUtils.fromJson(json, Wrapper.class); 20 | Assert.notNull(wrapper, "error to parse:[" + json + "] to Wrapper"); 21 | Class clazz = Class.forName(wrapper.getClazz()); 22 | Assert.notNull(clazz, "error to parse:[" + json + "],cause by the unknown clazz:[" + wrapper.getClazz() + "]"); 23 | return GsonUtils.fromJson(wrapper.getData(), clazz); 24 | } 25 | 26 | public static class Wrapper { 27 | private String clazz; 28 | private String data; 29 | 30 | public String getClazz() { 31 | return clazz; 32 | } 33 | 34 | public void setClazz(String clazz) { 35 | this.clazz = clazz; 36 | } 37 | 38 | public String getData() { 39 | return data; 40 | } 41 | 42 | public void setData(String data) { 43 | this.data = data; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/locks/LockWithCondition.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.locks; 2 | 3 | import com.nabob.conch.tools.utils.LockUtils; 4 | 5 | import java.util.concurrent.TimeUnit; 6 | import java.util.concurrent.locks.Condition; 7 | import java.util.concurrent.locks.ReentrantLock; 8 | 9 | public class LockWithCondition { 10 | private final ReentrantLock lock; 11 | 12 | private final Condition condition; 13 | 14 | public LockWithCondition() { 15 | this(new ReentrantLock()); 16 | } 17 | 18 | public LockWithCondition(ReentrantLock lock) { 19 | this.lock = lock; 20 | this.condition = lock.newCondition(); 21 | } 22 | 23 | public void await(long time, TimeUnit unit) throws InterruptedException { 24 | lock.lock(); 25 | try { 26 | this.condition.await(time, unit); 27 | } finally { 28 | lock.unlock(); 29 | } 30 | } 31 | 32 | public void signal() { 33 | LockUtils.runWithLock(this.lock, condition::signal); 34 | } 35 | 36 | public boolean trySignal() { 37 | return LockUtils.tryRunWithLock(this.lock, condition::signal); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/parallel/CallableParallelTask.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.parallel; 2 | 3 | /** 4 | * @Project: [ops] 5 | * @Description: [带返回值的并发任务] 6 | * @Author: [toming] 7 | * @CreateDate: [10/13/16 4:27 PM] 8 | * @Version: [v1.0] 9 | */ 10 | @FunctionalInterface 11 | public interface CallableParallelTask { 12 | T run(); 13 | } 14 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/parallel/ParallelExecutor.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.parallel; 2 | 3 | import java.io.Closeable; 4 | 5 | /** 6 | * @Project: [ops] 7 | * @Description: [并发执行器] 8 | * @Author: [toming] 9 | * @CreateDate: [10/12/16 10:27 AM] 10 | * @Version: [v1.0] 11 | */ 12 | public interface ParallelExecutor extends Closeable { 13 | /** 14 | * 等待子任务全部结束 15 | * 16 | * @throws Exception -任务执行过程中出现的异常 17 | */ 18 | void await() throws Exception; 19 | 20 | /** 21 | * 等待子任务全部完成 22 | * 23 | * @param time -最大等待时长 24 | * @throws Exception -子任务出现异常 25 | */ 26 | void await(long time) throws Exception; 27 | 28 | /** 29 | * 提交子任务 30 | * 31 | * @param parallelTask -子任务 32 | */ 33 | void submit(ParallelTask parallelTask) throws Exception; 34 | 35 | ParallelFuture call(CallableParallelTask parallelTask); 36 | } 37 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/parallel/ParallelExecutorService.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.parallel; 2 | 3 | /** 4 | * @Project: [ops] 5 | * @Description: [并发执行器服务] 6 | * @Author: [toming] 7 | * @CreateDate: [10/14/16 2:56 PM] 8 | * @Version: [v1.0] 9 | */ 10 | public interface ParallelExecutorService { 11 | /** 12 | * 设置并发量 13 | * 14 | * @param concurrency -并发量 15 | */ 16 | void concurrency(int concurrency); 17 | 18 | ParallelExecutor createParallelExecutor(); 19 | } 20 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/parallel/ParallelTask.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.parallel; 2 | 3 | /** 4 | * @Project: [ops] 5 | * @Description: [并发任务] 6 | * @Author: [toming] 7 | * @CreateDate: [10/13/16 4:27 PM] 8 | * @Version: [v1.0] 9 | */ 10 | @FunctionalInterface 11 | public interface ParallelTask { 12 | void run() throws Exception; 13 | } 14 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/pool/Pool.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.pool; 2 | 3 | 4 | import java.util.function.Consumer; 5 | import java.util.function.Function; 6 | 7 | public interface Pool { 8 | R call(Function function); 9 | 10 | void run(Consumer action); 11 | } 12 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/pool/SimplePool.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.pool; 2 | 3 | import com.nabob.conch.tools.function.Generator; 4 | 5 | import java.util.Queue; 6 | import java.util.concurrent.ArrayBlockingQueue; 7 | import java.util.function.Consumer; 8 | import java.util.function.Function; 9 | 10 | 11 | public class SimplePool implements Pool { 12 | private Queue cache; 13 | private Generator generator; 14 | 15 | public SimplePool(Generator generator, int capacity) { 16 | this.generator = generator; 17 | cache = new ArrayBlockingQueue(capacity); 18 | } 19 | 20 | protected T getOrCreate() { 21 | T t = cache.poll(); 22 | if (t == null) { 23 | t = generator.generate(); 24 | } 25 | return t; 26 | } 27 | 28 | protected void returnT(T t) { 29 | cache.offer(t); 30 | } 31 | 32 | @Override 33 | public R call(Function function) { 34 | T t = getOrCreate(); 35 | R result = function.apply(t); 36 | returnT(t); 37 | return result; 38 | } 39 | 40 | @Override 41 | public void run(Consumer action) { 42 | T t = getOrCreate(); 43 | action.accept(t); 44 | returnT(t); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/security/AesSecret.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.security; 2 | 3 | @EncryptSupport({"aes", "aes128", "aes256"}) 4 | @DecryptSupport({"aes", "aes128", "aes256"}) 5 | public class AesSecret extends AbstractEsSecret { 6 | 7 | //aes 16 8 | protected int getKeyLength(String algorithm) { 9 | 10 | if (EsAlgorithm.AES.getVal().equalsIgnoreCase(algorithm)) { 11 | return 16; 12 | } 13 | if (EsAlgorithm.AES128.getVal().equalsIgnoreCase(algorithm)) { 14 | return 16; 15 | } 16 | if (EsAlgorithm.AES256.getVal().equalsIgnoreCase(algorithm)) { 17 | return 32; 18 | } 19 | return -1; 20 | } 21 | 22 | @Override 23 | protected String getAlgorithm(String algorithm) { 24 | return "aes"; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/security/DecryptSupport.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.security; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * which annotation by {@code DecryptSupport} should implement a method which named "decrypt" 10 | */ 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Target({ElementType.TYPE}) 13 | public @interface DecryptSupport { 14 | String[] value(); 15 | } 16 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/security/Decryptor.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.security; 2 | 3 | public interface Decryptor { 4 | 5 | R decrypt(T input, Object... params) throws Throwable; 6 | } 7 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/security/DesSecret.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.security; 2 | 3 | @EncryptSupport({"des", "desede"}) 4 | @DecryptSupport({"des", "desede"}) 5 | public class DesSecret extends AbstractEsSecret { 6 | 7 | //des 8 8 | //3des 24 9 | protected int getKeyLength(String algorithm) { 10 | if (EsAlgorithm.DES.getVal().equalsIgnoreCase(algorithm)) { 11 | return 8; 12 | } 13 | if (EsAlgorithm.TRIPLE_DES.getVal().equalsIgnoreCase(algorithm)) { 14 | return 24; 15 | } 16 | return -1; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/security/EncryptSupport.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.security; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * which annotation by {@code EncryptSupport} should implement a method which named "encrypt" 10 | */ 11 | @Retention(RetentionPolicy.RUNTIME) 12 | @Target({ElementType.TYPE}) 13 | public @interface EncryptSupport { 14 | String[] value(); 15 | } 16 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/security/Encryptor.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.security; 2 | 3 | public interface Encryptor { 4 | 5 | R encrypt(T input, Object... params) throws Throwable; 6 | } 7 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/security/HashAlgorithm.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.security; 2 | 3 | public enum HashAlgorithm { 4 | 5 | MD5("MD5"), SHA("SHA"), SHA1("SHA1"), SHA256("SHA-256"), SHA512("SHA-512"); 6 | 7 | HashAlgorithm(String val) { 8 | this.val = val; 9 | } 10 | 11 | String val; 12 | 13 | public String getVal() { 14 | return val; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/security/HashEncryptor.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.security; 2 | 3 | import java.security.MessageDigest; 4 | import java.security.NoSuchAlgorithmException; 5 | 6 | @EncryptSupport({"MD5", "SHA", "SHA1", "SHA-256", "SHA-512"}) 7 | public class HashEncryptor { 8 | 9 | public static byte[] encrypt(byte[] data, String algorithm) throws NoSuchAlgorithmException { 10 | if (data == null) return null; 11 | MessageDigest md = MessageDigest.getInstance(algorithm); 12 | md.update(data); 13 | return md.digest(); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/security/HmacAlgorithm.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.security; 2 | 3 | public enum HmacAlgorithm { 4 | 5 | HMACMD5("HMACMD5"), HMACSHA1("HMACSHA1"), HMACSHA256("HMACSHA256"), HMACSHA512("HMACSHA512"); 6 | 7 | HmacAlgorithm(String val) { 8 | this.val = val; 9 | } 10 | 11 | String val; 12 | 13 | public String getVal() { 14 | return val; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/security/HmacEncryptor.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.security; 2 | 3 | import javax.crypto.Mac; 4 | import javax.crypto.spec.SecretKeySpec; 5 | import java.security.InvalidKeyException; 6 | import java.security.NoSuchAlgorithmException; 7 | 8 | @EncryptSupport({"HMACMD5", "HMACSHA1", "HMACSHA256", "HMACSHA512"}) 9 | public class HmacEncryptor { 10 | 11 | /** 12 | * hash加密模板 13 | * 14 | * @param data 数据 15 | * @param algorithm 加密算法 16 | * @return 密文字节数组 17 | */ 18 | public static byte[] encrypt(byte[] data, byte[] key, String algorithm) throws NoSuchAlgorithmException, InvalidKeyException { 19 | if (data == null || data.length == 0 || key == null || key.length == 0) return null; 20 | SecretKeySpec secretKey = new SecretKeySpec(key, algorithm); 21 | Mac mac = Mac.getInstance(algorithm); 22 | mac.init(secretKey); 23 | return mac.doFinal(data); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/security/rsa/RSAByteKey.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.security.rsa; 2 | 3 | /** 4 | * Created by tangming on 6/30/17. 5 | */ 6 | public class RSAByteKey { 7 | 8 | /** 9 | * 公钥指数 10 | */ 11 | private byte[] publicKey; 12 | /** 13 | * 私钥指数 14 | */ 15 | private byte[] privateKey; 16 | 17 | public byte[] getPublicKey() { 18 | return publicKey; 19 | } 20 | 21 | public void setPublicKey(byte[] publicKey) { 22 | this.publicKey = publicKey; 23 | } 24 | 25 | public byte[] getPrivateKey() { 26 | return privateKey; 27 | } 28 | 29 | public void setPrivateKey(byte[] privateKey) { 30 | this.privateKey = privateKey; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/security/rsa/RSAKey.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.security.rsa; 2 | 3 | /** 4 | * Created by tangming on 6/30/17. 5 | */ 6 | public class RSAKey { 7 | 8 | /** 9 | * 模 10 | */ 11 | private String modulus; 12 | /** 13 | * 公钥指数 14 | */ 15 | private String publicKey; 16 | /** 17 | * 私钥指数 18 | */ 19 | private String privateKey; 20 | 21 | public String getModulus() { 22 | return modulus; 23 | } 24 | 25 | public void setModulus(String modulus) { 26 | this.modulus = modulus; 27 | } 28 | 29 | public String getPublicKey() { 30 | return publicKey; 31 | } 32 | 33 | public void setPublicKey(String publicKey) { 34 | this.publicKey = publicKey; 35 | } 36 | 37 | public String getPrivateKey() { 38 | return privateKey; 39 | } 40 | 41 | public void setPrivateKey(String privateKey) { 42 | this.privateKey = privateKey; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/spi/SPI.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.spi; 2 | 3 | import java.lang.annotation.*; 4 | 5 | @Documented 6 | @Retention(RetentionPolicy.RUNTIME) 7 | @Target({ElementType.TYPE}) 8 | public @interface SPI { 9 | 10 | /** 11 | * config中的键值 12 | */ 13 | String key() default ""; 14 | 15 | /** 16 | * 默认扩展实现 17 | */ 18 | String dftValue() default ""; 19 | 20 | } 21 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/template/format/TemplateFormat.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.template.format; 2 | 3 | import java.util.Map; 4 | 5 | /** 6 | * @Project: [ops] 7 | * @Description: [模板格式化工具] 8 | * @Author: [toming] 9 | * @CreateDate: [9/22/16 4:11 PM] 10 | * @Version: [v1.0] 11 | */ 12 | public interface TemplateFormat { 13 | 14 | String replace(String content, Map params); 15 | } 16 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/template/store/SimpleTemplateStore.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.template.store; 2 | 3 | import java.util.HashMap; 4 | import java.util.Map; 5 | 6 | /** 7 | * @Project: [ops] 8 | * @Description: [最简单的使用使用map存储,非线程安全] 9 | * @Author: [toming] 10 | * @CreateDate: [9/20/16 7:06 PM] 11 | * @Version: [v1.0] 12 | */ 13 | public class SimpleTemplateStore implements TemplateStore { 14 | private Map store = new HashMap<>(); 15 | 16 | @Override 17 | public String get(String name) { 18 | return store.get(name); 19 | } 20 | 21 | @Override 22 | public boolean contain(String name) { 23 | return store.containsKey(name); 24 | } 25 | 26 | /** 27 | * 注意,这个应该在初始化的时候调用,否则的话,在外围需要保证线程是安全的 28 | */ 29 | public void add(String name, String content) { 30 | this.store.put(name, content); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/template/store/TemplateStore.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.template.store; 2 | 3 | /** 4 | * @Project: [ops] 5 | * @Description: [description] 6 | * @Author: [toming] 7 | * @CreateDate: [9/20/16 7:04 PM] 8 | * @Version: [v1.0] 9 | */ 10 | public interface TemplateStore { 11 | String get(String name); 12 | 13 | boolean contain(String name); 14 | } 15 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/template/store/cacheable/CompressTemplateStore.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.template.store.cacheable; 2 | 3 | /** 4 | * [可压缩模板库] 5 | */ 6 | public abstract class CompressTemplateStore extends AbstractCacheTemplateStore { 7 | 8 | protected boolean compress = false; 9 | 10 | public void setCompress(boolean compress) { 11 | this.compress = compress; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/template/store/cacheable/LRUTemplateStore.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.template.store.cacheable; 2 | 3 | import com.nabob.conch.tools.mapext.LRULinkedHashMap; 4 | import com.nabob.conch.tools.utils.ZipUtils; 5 | 6 | import java.util.Map; 7 | 8 | /** 9 | * @Project: [ops] 10 | * @Description: [本地LRU模板库] 11 | * @Author: [toming] 12 | * @CreateDate: [9/20/16 7:14 PM] 13 | * @Version: [v1.0] 14 | */ 15 | public class LRUTemplateStore extends CompressTemplateStore { 16 | 17 | public LRUTemplateStore() { 18 | cacheStore = new LRULinkedHashMap<>(10); 19 | } 20 | 21 | public LRUTemplateStore(int cacheCapacity) { 22 | cacheStore = new LRULinkedHashMap<>(cacheCapacity); 23 | } 24 | 25 | /** 26 | * 核心采用一个LRULinkedHashMap存储 27 | */ 28 | private Map cacheStore; 29 | 30 | @Override 31 | protected String getInSelf(String name) { 32 | return compress ? ZipUtils.gunzip(cacheStore.get(name)) : cacheStore.get(name); 33 | } 34 | 35 | @Override 36 | protected boolean containInSelf(String name) { 37 | return cacheStore.containsKey(name); 38 | } 39 | 40 | @Override 41 | public void cache(String name, String content) { 42 | cacheStore.put(name, compress ? ZipUtils.gunzip(content) : content); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/threadExtension/single/AbstractCycleThread.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.threadExtension.single; 2 | 3 | /** 4 | * @Project: [ops] 5 | * @Description: [抽象单线程循环执行类] 6 | * @Author: [toming] 7 | * @CreateDate: [9/13/16 2:10 PM] 8 | * @Version: [v1.0] 9 | */ 10 | public abstract class AbstractCycleThread extends AbstractSingleThread { 11 | private boolean keep = true; 12 | 13 | protected boolean keepRunning() { 14 | return keep && !Thread.currentThread().isInterrupted(); 15 | } 16 | 17 | @Override 18 | protected void beforeRun() { 19 | keep = true; 20 | } 21 | 22 | @Override 23 | public void interrupt() { 24 | keep = false; 25 | super.interrupt(); 26 | } 27 | 28 | @Override 29 | public void stop() { 30 | keep = false; 31 | super.stop(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/threadExtension/single/Recyclable.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.threadExtension.single; 2 | 3 | import java.util.Objects; 4 | 5 | /** 6 | * @Project: [ops] 7 | * @Description: [循环操作,可以被中断] 8 | * @Author: [toming] 9 | * @CreateDate: [9/8/16 3:01 PM] 10 | * @Version: [v1.0] 11 | */ 12 | @FunctionalInterface 13 | public interface Recyclable { 14 | boolean run() throws InterruptedException; 15 | 16 | static Recyclable alwaysTrue(Runnable runnable) { 17 | Objects.requireNonNull(runnable); 18 | return () -> { 19 | runnable.run(); 20 | return true; 21 | }; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/threadExtension/single/SingleCycle.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.threadExtension.single; 2 | 3 | /** 4 | * @Project: [ops] 5 | * @Description: [单线程循环执行] 6 | * @Author: [toming] 7 | * @CreateDate: [9/8/16 11:40 AM] 8 | * @Version: [v1.0] 9 | */ 10 | public class SingleCycle extends AbstractCycleThread { 11 | private Recyclable runnable; 12 | 13 | public SingleCycle() { 14 | } 15 | 16 | public SingleCycle(String name) { 17 | this.name = name; 18 | } 19 | 20 | public SingleCycle setRunnable(Recyclable runnable) { 21 | this.runnable = runnable; 22 | return this; 23 | } 24 | 25 | protected void run() throws InterruptedException { 26 | while (keepRunning() && runnable.run()) { 27 | Thread.yield(); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/threadExtension/single/SingleRun.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.threadExtension.single; 2 | 3 | /** 4 | * @Project: [ops] 5 | * @Description: [单线程执行] 6 | * @Author: [toming] 7 | * @CreateDate: [9/8/16 11:40 AM] 8 | * @Version: [v1.0] 9 | */ 10 | public class SingleRun extends AbstractSingleThread { 11 | private Runnable runnable; 12 | 13 | public SingleRun(String name) { 14 | this.name = name; 15 | } 16 | 17 | public SingleRun setRunnable(Runnable runnable) { 18 | this.runnable = runnable; 19 | return this; 20 | } 21 | 22 | protected void run() { 23 | runnable.run(); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/threadExtension/single/SingleThread.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.threadExtension.single; 2 | 3 | /** 4 | * @Project: [ops] 5 | * @Description: [单线程执行类] 6 | * @Author: [toming] 7 | * @CreateDate: [9/8/16 3:31 PM] 8 | * @Version: [v1.0] 9 | */ 10 | public interface SingleThread { 11 | boolean tryRun(); 12 | 13 | boolean isRunning(); 14 | 15 | void interrupt(); 16 | 17 | /** 18 | * Stop the thread and releases any system resources associated 19 | * with it. If the thread is already stopped then invoking this 20 | * method has no effect. 21 | * Sure,I hope every thread should call this before garbage collection. 22 | */ 23 | void stop(); 24 | } 25 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/time/TimeConstant.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.time; 2 | 3 | public class TimeConstant { 4 | 5 | public static final long ONE_SECOND = 1000L; 6 | 7 | public static final long ONE_MINUTE = 60 * 1000L; 8 | 9 | public static final long ONE_HOUR = 60 * 60 * 1000L; 10 | 11 | public static final long ONE_DAY = 24 * ONE_HOUR; 12 | 13 | public static final long ONE_WEEK = 7 * ONE_DAY; 14 | } 15 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/transmission/Transmission.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.transmission; 2 | 3 | 4 | import java.util.concurrent.TimeUnit; 5 | 6 | public interface Transmission { 7 | void acquire(); 8 | 9 | boolean tryAcquire(); 10 | 11 | boolean tryAcquire(Long timeout, TimeUnit timeUnit); 12 | 13 | int acquireCnt(); 14 | 15 | } 16 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/utils/AggregateUtils.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.utils; 2 | 3 | /** 4 | * Created by tangming on 5/26/17. 5 | */ 6 | public class AggregateUtils { 7 | } 8 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/utils/BitUtils.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.utils; 2 | 3 | /** 4 | * Created by tangming on 6/7/17. 5 | */ 6 | public class BitUtils { 7 | public static boolean and(int a, int b) { 8 | return (a & b) != 0; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/utils/CallAble.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.utils; 2 | 3 | /** 4 | * Created by toming on 3/10/17. 5 | */ 6 | 7 | public interface CallAble { 8 | T call() throws Exception; 9 | } 10 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/utils/ComparatorUtils.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.utils; 2 | 3 | 4 | public final class ComparatorUtils { 5 | /** 6 | * 获取较小值 7 | * 8 | * @param t1 -第一个元素 9 | * @param t2 - 第二个元素 10 | * @param -元素类型 11 | * @return -最小的元素 12 | */ 13 | public static > T getMin(T t1, T t2) { 14 | if (t1 == null || t2 == null) { 15 | return null; 16 | } else { 17 | return t1.compareTo(t2) == 1 ? t2 : t1; 18 | } 19 | } 20 | 21 | /** 22 | * 获取较大值 23 | * 24 | * @param t1 -第一个元素 25 | * @param t2 - 第二个元素 26 | * @param -元素类型 27 | * @return -最大的元素 28 | */ 29 | public static > T getMax(T t1, T t2) { 30 | if (t1 == null) { 31 | return t2; 32 | } else if (t2 == null) { 33 | return t1; 34 | } else { 35 | return t1.compareTo(t2) == 1 ? t1 : t2; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/utils/ConditionUtils.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.utils; 2 | 3 | 4 | public class ConditionUtils { 5 | public static boolean tryDo(Runnable runnable) { 6 | try { 7 | runnable.run(); 8 | return true; 9 | } catch (Throwable e) { 10 | return false; 11 | } 12 | } 13 | 14 | public static boolean tryDo(Runnable primary, Runnable... others) { 15 | if (tryDo(primary)) { 16 | return true; 17 | } 18 | for (Runnable runnable : others) { 19 | if (tryDo(runnable)) 20 | return true; 21 | } 22 | return false; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/utils/ExecuteUtils.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.utils; 2 | 3 | import com.nabob.conch.tools.function.RunnableWithError; 4 | 5 | import java.io.Closeable; 6 | 7 | public class ExecuteUtils { 8 | 9 | public static void closeIfPossible(Closeable... closeables) { 10 | for (Closeable closeable : closeables) { 11 | runIgnoreError(closeable::close); 12 | } 13 | } 14 | 15 | /** 16 | * @see Runs#safeDo(com.nabob.conch.tools.function.RunnableWithError) 17 | */ 18 | @Deprecated 19 | public static void runIgnoreError(RunnableWithError runnable) { 20 | try { 21 | runnable.run(); 22 | } catch (Throwable ignored) { 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/utils/FileUtils.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.utils; 2 | 3 | import com.nabob.conch.tools.properties.NativePath; 4 | 5 | import java.io.BufferedReader; 6 | import java.io.InputStream; 7 | import java.io.InputStreamReader; 8 | import java.nio.file.Files; 9 | import java.nio.file.StandardOpenOption; 10 | 11 | public class FileUtils { 12 | public static String getName(String filePath) { 13 | if (filePath.contains(".")) { 14 | filePath = filePath.substring(0, filePath.lastIndexOf(".")); 15 | } 16 | if (filePath.contains("\\")) { 17 | filePath = filePath.substring(filePath.lastIndexOf("\\")); 18 | } 19 | if (filePath.contains("/")) { 20 | filePath = filePath.substring(filePath.lastIndexOf("/")); 21 | } 22 | return filePath; 23 | } 24 | 25 | public static String readFile(String filePath) { 26 | StringBuilder sb = new StringBuilder(); 27 | try (InputStream in = Files.newInputStream(NativePath.get(filePath), StandardOpenOption.READ); 28 | BufferedReader reader = new BufferedReader(new InputStreamReader(in, "utf-8"))) { 29 | String line; 30 | while ((line = reader.readLine()) != null) { 31 | sb.append(line); 32 | // sb.append("\r\n"); 33 | } 34 | } catch (Exception ignored) { 35 | } 36 | return sb.toString(); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/utils/Identifiable.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.utils; 2 | 3 | /** 4 | * This interface represents an entity that has an identity that is represented by an id. 5 | */ 6 | public interface Identifiable { 7 | /** 8 | * Return the (T) identity of this entity. 9 | */ 10 | T getId(); 11 | } 12 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/utils/ListUtils.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.utils; 2 | 3 | import java.util.List; 4 | 5 | /** 6 | * Created by tangming on 6/6/17. 7 | */ 8 | public class ListUtils { 9 | 10 | public static int size(List list) { 11 | return list == null ? 0 : list.size(); 12 | } 13 | 14 | public static T getFirst(List list) { 15 | return org.apache.commons.collections.CollectionUtils.isEmpty(list) ? null : list.get(0); 16 | } 17 | 18 | public static Object unboxIfSingle(List list) { 19 | if (org.apache.commons.collections.CollectionUtils.isEmpty(list)) 20 | return null; 21 | if (list.size() == 1) { 22 | return list.get(0); 23 | } else { 24 | return list; 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/utils/MapUtils.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.utils; 2 | 3 | import com.nabob.conch.tools.cast.CasterUtils; 4 | 5 | import java.util.Map; 6 | 7 | public class MapUtils { 8 | public static T get(Map map, String key, Class clz) { 9 | return get(map, key, clz, null); 10 | } 11 | 12 | public static T get(Map map, String key, Class clz, T defaultVal) { 13 | return CasterUtils.cast(map.get(key), clz, defaultVal); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/utils/MathUtils.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.utils; 2 | 3 | public class MathUtils { 4 | 5 | 6 | /** 7 | * return 3/4 * origin + 1/4 * fix 8 | */ 9 | public static int fix(int origin, int fix) { 10 | return (origin >> 1) + (origin >> 2) + (fix >> 2); 11 | } 12 | 13 | /** 14 | * return 3/4 * origin + 1/4 * fix 15 | */ 16 | public static long fix(long origin, long fix) { 17 | return (origin >> 1) + (origin >> 2) + (fix >> 2); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/utils/Md5Utils.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.utils; 2 | 3 | import com.nabob.conch.tools.security.HexUtils; 4 | import org.apache.commons.lang3.StringUtils; 5 | 6 | import java.nio.charset.StandardCharsets; 7 | import java.security.MessageDigest; 8 | import java.security.NoSuchAlgorithmException; 9 | 10 | public class Md5Utils { 11 | 12 | /** 13 | * 计算字符串的MD5值 14 | * 15 | * @param string 明文 16 | * @return 字符串的MD5值 17 | */ 18 | public static String md5(String string) { 19 | if (StringUtils.isEmpty(string)) { 20 | return ""; 21 | } 22 | MessageDigest md5; 23 | try { 24 | md5 = MessageDigest.getInstance("MD5"); 25 | byte[] bytes = md5.digest(string.getBytes(StandardCharsets.UTF_8)); 26 | return HexUtils.bytes2Hex(bytes); 27 | } catch (NoSuchAlgorithmException e) { 28 | return String.valueOf(string.hashCode()); 29 | } 30 | } 31 | 32 | /** 33 | * 计算字符串的MD5值 34 | * 35 | * @return 字符串的MD5值 36 | */ 37 | public static String md5(byte[] sBytes) { 38 | MessageDigest md5; 39 | try { 40 | md5 = MessageDigest.getInstance("MD5"); 41 | byte[] bytes = md5.digest(sBytes); 42 | return HexUtils.bytes2Hex(bytes); 43 | } catch (NoSuchAlgorithmException e) { 44 | return String.valueOf(sBytes.hashCode()); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/utils/ObjectUtils.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.utils; 2 | 3 | import java.util.function.Predicate; 4 | 5 | /** 6 | * Created by tangming on 5/25/17. 7 | */ 8 | public class ObjectUtils { 9 | 10 | public static T predictAs(T bean, T as, Predicate predicate) { 11 | return predicate.test(bean) ? as : bean; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/utils/RFileUtils.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.utils; 2 | 3 | import java.io.File; 4 | 5 | /** 6 | * @author Adam 7 | * @since 2023/6/15 8 | */ 9 | public class RFileUtils { 10 | 11 | public static String getFileData(String fileName) { 12 | try { 13 | if (fileName.startsWith("/")) { 14 | fileName = fileName.substring(1); 15 | } 16 | String fullPath = FileUtils.class.getResource("/").getPath() + fileName; 17 | return doGetFileData(fullPath); 18 | } catch (Exception e) { 19 | e.printStackTrace(); 20 | } 21 | return null; 22 | } 23 | 24 | private static String doGetFileData(String fullPath) { 25 | try { 26 | return org.apache.commons.io.FileUtils.readFileToString(new File(fullPath), "UTF-8"); 27 | } catch (Exception e) { 28 | e.printStackTrace(); 29 | } 30 | return null; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/utils/RegexUtils.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.utils; 2 | 3 | import org.apache.commons.lang3.StringUtils; 4 | 5 | import java.util.regex.Pattern; 6 | 7 | public class RegexUtils { 8 | public static final String REGEX_MOBILE = "^1[0-9]\\d{9}$"; 9 | 10 | public static final String DIGIT = "^\\d+$"; 11 | 12 | public static final String DECIMAL = "^\\d+(\\.\\d+)?$"; 13 | 14 | public static boolean isMobile(String mobile) { 15 | return check(REGEX_MOBILE, mobile); 16 | } 17 | 18 | public static boolean isDigit(String digit) { 19 | return check(DIGIT, digit); 20 | } 21 | 22 | public static boolean isDecimal(String decimal) { 23 | return check(DECIMAL, decimal); 24 | } 25 | 26 | private static boolean check(String pattern, String str) { 27 | return !StringUtils.isEmpty(str) && Pattern.matches(pattern, str); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/utils/Runs.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.utils; 2 | 3 | import com.nabob.conch.tools.function.RunnableWithError; 4 | import com.nabob.conch.tools.functions.ThrowaleCallable; 5 | import org.apache.commons.lang3.exception.ExceptionUtils; 6 | 7 | public class Runs { 8 | 9 | public static void safeDo(RunnableWithError runnable) { 10 | try { 11 | runnable.run(); 12 | } catch (Throwable ignored) { 13 | } 14 | } 15 | 16 | public static void uncheckDo(RunnableWithError runnable) { 17 | try { 18 | runnable.run(); 19 | } catch (Throwable e) { 20 | ExceptionUtils.wrapAndThrow(e); 21 | } 22 | } 23 | 24 | public static T safeCall(ThrowaleCallable callable) { 25 | return safeCall(callable, null); 26 | } 27 | 28 | public static T safeCall(ThrowaleCallable callable, T defaultVal) { 29 | try { 30 | return callable.call(); 31 | } catch (Throwable e) { 32 | return defaultVal; 33 | } 34 | } 35 | 36 | public static T uncheckCall(ThrowaleCallable callable) { 37 | try { 38 | return callable.call(); 39 | } catch (Throwable e) { 40 | ExceptionUtils.wrapAndThrow(e); 41 | return null;//不会触发 42 | } 43 | } 44 | 45 | } 46 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/utils/StreamUtils.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.utils; 2 | 3 | import java.io.BufferedReader; 4 | import java.io.IOException; 5 | import java.io.InputStream; 6 | import java.io.InputStreamReader; 7 | 8 | /** 9 | * [流工具类] 10 | */ 11 | public class StreamUtils { 12 | public static String readFromInputStream(InputStream is) throws IOException { 13 | String line; // 用来保存每行读取的内容 14 | StringBuilder sb = new StringBuilder(); 15 | try (BufferedReader reader = new BufferedReader(new InputStreamReader(is))) { 16 | line = reader.readLine(); // 读取第一行 17 | while (line != null) { // 如果 line 为空说明读完了 18 | sb.append(line); // 将读到的内容添加到 buffer 中 19 | sb.append("\r\n"); // 添加换行符 20 | line = reader.readLine(); // 读取下一行 21 | } 22 | } 23 | return sb.toString(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/tools-conch-boot/src/main/java/com/nabob/conch/tools/utils/ThreadUtils.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.tools.utils; 2 | 3 | /** 4 | * 线程工具类 5 | */ 6 | public class ThreadUtils { 7 | public static void closeIfPossible(Thread thread) { 8 | if (thread.isAlive() && !thread.isInterrupted()) { 9 | thread.interrupt(); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/web-conch-boot/src/main/java/com/nabob/conch/web/event/LoadUserEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright [2019] [恒宇少年 - 于起宇] 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.nabob.conch.web.event; 18 | 19 | import org.springframework.context.ApplicationEvent; 20 | 21 | /** 22 | * 加载用户信息事件 23 | * 24 | * @author:恒宇少年 - 于起宇 25 | *

26 | * DateTime:2019-03-14 16:13 27 | * Blog:http://blog.yuqiyu.com 28 | * WebSite:http://www.jianshu.com/u/092df3f77bca 29 | * Gitee:https://gitee.com/hengboy 30 | * GitHub:https://github.com/hengboy 31 | */ 32 | public class LoadUserEvent extends ApplicationEvent { 33 | /** 34 | * 获取用户信息的用户名 35 | */ 36 | private String username; 37 | 38 | public LoadUserEvent(Object source, String username) { 39 | super(source); 40 | this.username = username; 41 | } 42 | 43 | public String getUsername() { 44 | return username; 45 | } 46 | 47 | public void setUsername(String username) { 48 | this.username = username; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/web-conch-boot/src/main/java/com/nabob/conch/web/mail/ConchMailSender.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.web.mail; 2 | 3 | /** 4 | * @Author: zjz 5 | * @Desc: 邮件服务 6 | * @Date: 2019/1/7 7 | * @Version: V1.0.0 8 | */ 9 | public interface ConchMailSender { 10 | 11 | void sendMail(String email, String message, String detail); 12 | 13 | } 14 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/web-conch-boot/src/main/java/com/nabob/conch/web/response/AbstractJsonResponse.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.web.response; 2 | 3 | import com.fasterxml.jackson.annotation.JsonProperty; 4 | 5 | /** 6 | * @Author: zjz 7 | * @Desc: 8 | * @Date: 2019/1/7 9 | * @Version: V1.0.0 10 | */ 11 | public class AbstractJsonResponse implements JsonResponse{ 12 | 13 | protected int code; 14 | protected String message; 15 | @JsonProperty(value = "code_description") 16 | protected String codeDescription; 17 | 18 | @Override 19 | public int getCode() { 20 | return code; 21 | } 22 | 23 | @Override 24 | public String getMessage() { 25 | return message; 26 | } 27 | 28 | @Override 29 | public String getCodeDescription() { 30 | return codeDescription; 31 | } 32 | 33 | public void setCode(int code) { 34 | this.code = code; 35 | } 36 | 37 | public void setMessage(String message) { 38 | this.message = message; 39 | } 40 | 41 | public void setCodeDescription(String codeDescription) { 42 | this.codeDescription = codeDescription; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/web-conch-boot/src/main/java/com/nabob/conch/web/response/JsonResponse.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.web.response; 2 | 3 | /** 4 | * @Author: zjz 5 | * @Desc: 6 | * @Date: 2019/1/7 7 | * @Version: V1.0.0 8 | */ 9 | public interface JsonResponse { 10 | 11 | int getCode(); 12 | 13 | String getMessage(); 14 | 15 | String getCodeDescription(); 16 | } 17 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/web-conch-boot/src/main/java/com/nabob/conch/web/response/page/Page.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.web.response.page; 2 | 3 | 4 | import com.fasterxml.jackson.annotation.JsonProperty; 5 | 6 | import javax.validation.constraints.Min; 7 | 8 | public abstract class Page implements Pageable { 9 | 10 | @Min(value = 1, message = "index should be positive!") 11 | @JsonProperty(value = "pageIndex") 12 | private int index = 1; 13 | 14 | @Min(value = 1, message = "size should be positive!") 15 | @JsonProperty(value = "pageSize") 16 | private int size = 10; 17 | 18 | @Override 19 | public int getIndex() { 20 | return index; 21 | } 22 | 23 | public void setIndex(int index) { 24 | this.index = index; 25 | } 26 | 27 | @Override 28 | public int getSize() { 29 | return size; 30 | } 31 | 32 | public void setSize(int size) { 33 | this.size = size; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-core/web-conch-boot/src/main/java/com/nabob/conch/web/response/page/Pageable.java: -------------------------------------------------------------------------------- 1 | package com.nabob.conch.web.response.page; 2 | 3 | public interface Pageable { 4 | int getIndex(); 5 | 6 | int getSize(); 7 | } 8 | -------------------------------------------------------------------------------- /conch-boot-project/conch-boot-maven-plugins/conch-boot-mybatis-enhance-maven-codegen/src/main/java/com/nabob/conch/boot/maven/plugin/mybatis/enhance/codegen/setting/CodegenSetting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright [2019] [恒宇少年 - 于起宇] 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | 18 | package com.nabob.conch.boot.maven.plugin.mybatis.enhance.codegen.setting; 19 | 20 | import com.nabob.conch.boot.maven.plugin.mybatis.enhance.codegen.template.model.Template; 21 | import lombok.Data; 22 | 23 | import java.util.List; 24 | 25 | /** 26 | * codegen setting json entity 27 | * 28 | * @author 恒宇少年 - 于起宇 29 | *

30 | * DateTime:2019-06-03 15:07 31 | * Blog:http://blog.yuqiyu.com 32 | * WebSite:http://www.jianshu.com/u/092df3f77bca 33 | * Gitee:https://gitee.com/hengboy 34 | * GitHub:https://github.com/hengboy 35 | */ 36 | @Data 37 | public class CodegenSetting { 38 | /** 39 | * note list 40 | */ 41 | private List notes; 42 | /** 43 | * template list 44 | */ 45 | private List