├── .gitignore
├── README.md
├── knd-commons
├── knd-authclient-springboot-starter
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── kernel
│ │ │ └── oauth2
│ │ │ └── common
│ │ │ ├── config
│ │ │ ├── DefaultResourceServerConf.java
│ │ │ ├── DefaultSecurityHandlerConfig.java
│ │ │ ├── SecurityPropertiesConfig.java
│ │ │ └── TokenStoreConfig.java
│ │ │ ├── constants
│ │ │ └── AuthoritiesEnum.java
│ │ │ ├── converter
│ │ │ └── CustomUserAuthenticationConverter.java
│ │ │ ├── properties
│ │ │ ├── AuthProperties.java
│ │ │ ├── PermitProperties.java
│ │ │ ├── RenewProperties.java
│ │ │ ├── SecurityProperties.java
│ │ │ ├── UrlPermissionProperties.java
│ │ │ └── ValidateCodeProperties.java
│ │ │ ├── service
│ │ │ └── impl
│ │ │ │ └── DefaultPermissionServiceImpl.java
│ │ │ ├── store
│ │ │ ├── AuthDbTokenStore.java
│ │ │ ├── AuthJwtTokenStore.java
│ │ │ ├── AuthRedisTokenStore.java
│ │ │ ├── CustomRedisTokenStore.java
│ │ │ └── ResJwtTokenStore.java
│ │ │ ├── token
│ │ │ ├── MobileAuthenticationToken.java
│ │ │ └── OpenIdAuthenticationToken.java
│ │ │ └── util
│ │ │ ├── AuthUtils.java
│ │ │ └── JwtUtils.java
│ │ └── resources
│ │ └── META-INF
│ │ └── spring.factories
├── knd-common-core
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── kernel
│ │ │ └── common
│ │ │ ├── annotation
│ │ │ ├── LoginClient.java
│ │ │ └── LoginUser.java
│ │ │ ├── config
│ │ │ ├── BannerInitializer.java
│ │ │ ├── DefaultAsycTaskConfig.java
│ │ │ ├── DefaultPasswordConfig.java
│ │ │ ├── DefaultWebMvcConfig.java
│ │ │ └── LoginArgResolverConfig.java
│ │ │ ├── constant
│ │ │ ├── CommonConstant.java
│ │ │ ├── ConfigConstants.java
│ │ │ ├── SecurityConstants.java
│ │ │ └── ServiceNameConstants.java
│ │ │ ├── context
│ │ │ ├── LbIsolationContextHolder.java
│ │ │ └── TenantContextHolder.java
│ │ │ ├── enums
│ │ │ ├── AbstractBaseExceptionEnum.java
│ │ │ ├── CoreExceptionEnum.java
│ │ │ ├── DeleteFlagEnum.java
│ │ │ ├── StatusEnum.java
│ │ │ └── YesOrNotEnum.java
│ │ │ ├── exception
│ │ │ ├── ApiServiceException.java
│ │ │ ├── BusinessException.java
│ │ │ ├── DefaultExceptionAdvice.java
│ │ │ ├── IdempotencyException.java
│ │ │ ├── LockException.java
│ │ │ ├── RequestEmptyException.java
│ │ │ └── ServiceException.java
│ │ │ ├── feign
│ │ │ ├── UserService.java
│ │ │ └── fallback
│ │ │ │ └── UserServiceFallbackFactory.java
│ │ │ ├── lock
│ │ │ ├── AbstractDistributedLock.java
│ │ │ └── DistributedLock.java
│ │ │ ├── model
│ │ │ ├── CodeEnum.java
│ │ │ ├── LoginAppUser.java
│ │ │ ├── PageResult.java
│ │ │ ├── Result.java
│ │ │ ├── SuperEntity.java
│ │ │ ├── SysMenu.java
│ │ │ ├── SysRole.java
│ │ │ ├── SysUser.java
│ │ │ └── UserType.java
│ │ │ ├── properties
│ │ │ └── TenantProperties.java
│ │ │ ├── resolver
│ │ │ ├── ClientArgumentResolver.java
│ │ │ └── TokenArgumentResolver.java
│ │ │ ├── service
│ │ │ ├── ISuperService.java
│ │ │ └── impl
│ │ │ │ └── SuperServiceImpl.java
│ │ │ └── utils
│ │ │ ├── AddrUtil.java
│ │ │ ├── CustomBanner.java
│ │ │ ├── CustomThreadPoolTaskExecutor.java
│ │ │ ├── ExcelUtil.java
│ │ │ ├── IdGenerator.java
│ │ │ ├── ResponseUtil.java
│ │ │ ├── RsaUtils.java
│ │ │ ├── Sequence.java
│ │ │ └── SpringUtil.java
│ │ └── resources
│ │ ├── META-INF
│ │ └── spring.factories
│ │ └── kndmp
│ │ └── logo.txt
├── knd-common-springboot-starter
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── kernel
│ │ │ └── common
│ │ │ └── filter
│ │ │ ├── TenantFilter.java
│ │ │ └── TraceFilter.java
│ │ └── resources
│ │ └── META-INF
│ │ └── spring.factories
├── knd-db-springboot-starter
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── kernel
│ │ │ └── db
│ │ │ ├── config
│ │ │ ├── DateMetaObjectHandler.java
│ │ │ ├── DefaultMybatisPlusConfig.java
│ │ │ └── TenantAutoConfigure.java
│ │ │ └── mapper
│ │ │ └── SuperMapper.java
│ │ └── resources
│ │ └── META-INF
│ │ └── spring.factories
├── knd-log-springboot-starter
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ ├── java
│ │ ├── com
│ │ │ └── kernel
│ │ │ │ └── log
│ │ │ │ ├── annotation
│ │ │ │ └── AuditLog.java
│ │ │ │ ├── aspect
│ │ │ │ └── AuditLogAspect.java
│ │ │ │ ├── config
│ │ │ │ ├── LogAutoConfigure.java
│ │ │ │ └── TtlMDCAdapterInitializer.java
│ │ │ │ ├── model
│ │ │ │ └── Audit.java
│ │ │ │ ├── monitor
│ │ │ │ └── PointUtil.java
│ │ │ │ ├── properties
│ │ │ │ ├── AuditLogProperties.java
│ │ │ │ ├── LogDbProperties.java
│ │ │ │ └── TraceProperties.java
│ │ │ │ └── service
│ │ │ │ ├── IAuditService.java
│ │ │ │ └── impl
│ │ │ │ ├── DbAuditServiceImpl.java
│ │ │ │ └── LoggerAuditServiceImpl.java
│ │ └── org
│ │ │ └── slf4j
│ │ │ └── TtlMDCAdapter.java
│ │ └── resources
│ │ ├── META-INF
│ │ └── spring.factories
│ │ └── logback-spring.xml
├── knd-redis-springboot-starter
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── kernel
│ │ │ └── common
│ │ │ └── redis
│ │ │ ├── RedisAutoConfigure.java
│ │ │ ├── constant
│ │ │ └── RedisToolsConstant.java
│ │ │ ├── lock
│ │ │ └── RedisDistributedLock.java
│ │ │ ├── properties
│ │ │ └── CacheManagerProperties.java
│ │ │ ├── template
│ │ │ └── RedisRepository.java
│ │ │ └── util
│ │ │ └── RedisObjectSerializer.java
│ │ └── resources
│ │ ├── META-INF
│ │ └── spring.factories
│ │ └── limit.lua
├── knd-ribbon-springboot-starter
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ ├── java
│ │ ├── com
│ │ │ └── kernel
│ │ │ │ └── common
│ │ │ │ └── ribbon
│ │ │ │ ├── FeignAutoConfigure.java
│ │ │ │ ├── LbIsolationAutoConfigure.java
│ │ │ │ ├── RestTemplateAutoConfigure.java
│ │ │ │ ├── RibbonAutoConfigure.java
│ │ │ │ ├── annotation
│ │ │ │ ├── EnableBaseFeignInterceptor.java
│ │ │ │ └── EnableFeignInterceptor.java
│ │ │ │ ├── config
│ │ │ │ ├── FeignHttpInterceptorConfig.java
│ │ │ │ ├── FeignInterceptorConfig.java
│ │ │ │ ├── RestTemplateProperties.java
│ │ │ │ └── RuleConfigure.java
│ │ │ │ ├── filter
│ │ │ │ └── LbIsolationFilter.java
│ │ │ │ └── rule
│ │ │ │ └── CustomIsolationRule.java
│ │ └── org
│ │ │ └── springframework
│ │ │ └── cloud
│ │ │ └── netflix
│ │ │ └── ribbon
│ │ │ └── DefaultPropertiesFactory.java
│ │ └── resources
│ │ └── META-INF
│ │ └── spring.factories
├── knd-sentinel-springboot-starter
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── kernel
│ │ │ └── sentinel
│ │ │ └── config
│ │ │ └── SentinelAutoConfigure.java
│ │ └── resources
│ │ └── META-INF
│ │ └── spring.factories
├── knd-swagger2-springboot-starter
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── kernel
│ │ │ └── common
│ │ │ └── swagger2
│ │ │ ├── Swagger2Configuration.java
│ │ │ ├── SwaggerAutoConfiguration.java
│ │ │ └── SwaggerProperties.java
│ │ └── resources
│ │ └── META-INF
│ │ └── spring.factories
└── pom.xml
├── knd-demo
└── pom.xml
├── knd-micro
├── micro-auth2
│ ├── pom.xml
│ └── src
│ │ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ │ └── kernel
│ │ │ │ ├── UaaServerApp.java
│ │ │ │ └── oauth
│ │ │ │ ├── config
│ │ │ │ ├── AuthorizationServerConfig.java
│ │ │ │ ├── ClientDetailsConfig.java
│ │ │ │ ├── MybatisPlusConfig.java
│ │ │ │ ├── SecurityConfig.java
│ │ │ │ ├── SecurityHandlerConfig.java
│ │ │ │ ├── ValidateCodeSecurityConfig.java
│ │ │ │ └── WebMvcConfig.java
│ │ │ │ ├── controller
│ │ │ │ ├── ClientController.java
│ │ │ │ ├── OAuth2Controller.java
│ │ │ │ ├── TokensController.java
│ │ │ │ └── ValidateCodeController.java
│ │ │ │ ├── dto
│ │ │ │ └── ClientDto.java
│ │ │ │ ├── exception
│ │ │ │ └── ValidateCodeException.java
│ │ │ │ ├── filter
│ │ │ │ └── ValidateCodeFilter.java
│ │ │ │ ├── handler
│ │ │ │ └── OauthLogoutHandler.java
│ │ │ │ ├── mapper
│ │ │ │ └── ClientMapper.java
│ │ │ │ ├── mobile
│ │ │ │ ├── MobileAuthenticationProvider.java
│ │ │ │ └── MobileAuthenticationSecurityConfig.java
│ │ │ │ ├── model
│ │ │ │ ├── Client.java
│ │ │ │ └── TokenVo.java
│ │ │ │ ├── openid
│ │ │ │ ├── OpenIdAuthenticationProvider.java
│ │ │ │ └── OpenIdAuthenticationSecurityConfig.java
│ │ │ │ └── service
│ │ │ │ ├── IClientService.java
│ │ │ │ ├── ITokensService.java
│ │ │ │ ├── IValidateCodeService.java
│ │ │ │ ├── KndUserDetailsService.java
│ │ │ │ └── impl
│ │ │ │ ├── ClientServiceImpl.java
│ │ │ │ ├── RedisAuthorizationCodeServices.java
│ │ │ │ ├── RedisClientDetailsService.java
│ │ │ │ ├── RedisTokensServiceImpl.java
│ │ │ │ ├── UserDetailServiceImpl.java
│ │ │ │ └── ValidateCodeServiceImpl.java
│ │ └── resources
│ │ │ ├── application.yml
│ │ │ ├── bootstrap.yml
│ │ │ ├── knd.jks
│ │ │ ├── mapper
│ │ │ └── ClientMapper.xml
│ │ │ ├── pubkey.txt
│ │ │ └── static
│ │ │ ├── css
│ │ │ ├── common.css
│ │ │ └── reset.css
│ │ │ ├── images
│ │ │ ├── cut.jpg
│ │ │ ├── logo_bg.jpg
│ │ │ └── logowz.png
│ │ │ ├── js
│ │ │ ├── common.js
│ │ │ └── jquery.min.js
│ │ │ └── login.html
│ │ └── test
│ │ └── java
│ │ └── com
│ │ └── central
│ │ └── oauth2
│ │ └── common
│ │ └── util
│ │ └── JwtUtilsTest.java
├── micro-gateway
│ ├── pom.xml
│ ├── scloud-gateway
│ │ ├── pom.xml
│ │ └── src
│ │ │ └── main
│ │ │ ├── java
│ │ │ └── com
│ │ │ │ └── kernel
│ │ │ │ ├── SCGatewayApp.java
│ │ │ │ └── gateway
│ │ │ │ ├── auth
│ │ │ │ ├── CustomAuthenticationManager.java
│ │ │ │ ├── JsonAccessDeniedHandler.java
│ │ │ │ ├── JsonAuthenticationEntryPoint.java
│ │ │ │ ├── Oauth2AuthSuccessHandler.java
│ │ │ │ └── PermissionAuthManager.java
│ │ │ │ ├── config
│ │ │ │ ├── CorsConfig.java
│ │ │ │ ├── DynamicRouteConfig.java
│ │ │ │ └── ResourceServerConfiguration.java
│ │ │ │ ├── feign
│ │ │ │ ├── MenuService.java
│ │ │ │ └── fallback
│ │ │ │ │ └── MenuServiceFallbackFactory.java
│ │ │ │ ├── filter
│ │ │ │ ├── LbIsolationFilter.java
│ │ │ │ ├── RequestStatisticsFilter.java
│ │ │ │ └── TraceFilter.java
│ │ │ │ ├── route
│ │ │ │ └── NacosRouteDefinitionRepository.java
│ │ │ │ ├── swagger
│ │ │ │ ├── SwaggerAggProperties.java
│ │ │ │ ├── SwaggerHandler.java
│ │ │ │ └── SwaggerProvider.java
│ │ │ │ └── utils
│ │ │ │ └── ReactiveAddrUtil.java
│ │ │ └── resources
│ │ │ ├── application.yml
│ │ │ ├── bootstrap.yml
│ │ │ └── pubkey.txt
│ └── zuul-gateway
│ │ ├── pom.xml
│ │ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── kernel
│ │ │ ├── GatewayApp.java
│ │ │ └── gateway
│ │ │ ├── config
│ │ │ ├── AsycTaskExecutorConfig.java
│ │ │ ├── CorsConfigration.java
│ │ │ ├── DynamicZuulRouteConfig.java
│ │ │ ├── ResourceServerConfiguration.java
│ │ │ ├── SwaggerConfig.java
│ │ │ └── ZuulRouteEntity.java
│ │ │ ├── feign
│ │ │ ├── MenuService.java
│ │ │ └── fallback
│ │ │ │ └── MenuServiceFallbackFactory.java
│ │ │ ├── filter
│ │ │ └── pre
│ │ │ │ ├── RequestStatisticsFilter.java
│ │ │ │ ├── TraceFilter.java
│ │ │ │ └── UserInfoHeaderFilter.java
│ │ │ ├── route
│ │ │ ├── AbstractDynRouteLocator.java
│ │ │ └── nacos
│ │ │ │ └── NacosDynRouteLocator.java
│ │ │ └── service
│ │ │ └── impl
│ │ │ └── PermissionServiceImpl.java
│ │ └── resources
│ │ ├── META-INF
│ │ └── additional-spring-configuration-metadata.json
│ │ ├── application.yml
│ │ ├── bootstrap.yml
│ │ └── pubkey.txt
├── micro-job
│ ├── job-admin
│ │ ├── pom.xml
│ │ └── src
│ │ │ ├── main
│ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── xxl
│ │ │ │ │ └── job
│ │ │ │ │ └── admin
│ │ │ │ │ ├── JobAdminApplication.java
│ │ │ │ │ ├── controller
│ │ │ │ │ ├── IndexController.java
│ │ │ │ │ ├── JobApiController.java
│ │ │ │ │ ├── JobCodeController.java
│ │ │ │ │ ├── JobGroupController.java
│ │ │ │ │ ├── JobInfoController.java
│ │ │ │ │ ├── JobLogController.java
│ │ │ │ │ ├── annotation
│ │ │ │ │ │ └── PermessionLimit.java
│ │ │ │ │ ├── interceptor
│ │ │ │ │ │ ├── CookieInterceptor.java
│ │ │ │ │ │ ├── PermissionInterceptor.java
│ │ │ │ │ │ └── WebMvcConfig.java
│ │ │ │ │ └── resolver
│ │ │ │ │ │ └── WebExceptionResolver.java
│ │ │ │ │ ├── core
│ │ │ │ │ ├── conf
│ │ │ │ │ │ ├── XxlJobAdminConfig.java
│ │ │ │ │ │ └── XxlJobDynamicSchedulerConfig.java
│ │ │ │ │ ├── jobbean
│ │ │ │ │ │ └── RemoteHttpJobBean.java
│ │ │ │ │ ├── model
│ │ │ │ │ │ ├── XxlJobGroup.java
│ │ │ │ │ │ ├── XxlJobInfo.java
│ │ │ │ │ │ ├── XxlJobLog.java
│ │ │ │ │ │ ├── XxlJobLogGlue.java
│ │ │ │ │ │ └── XxlJobRegistry.java
│ │ │ │ │ ├── route
│ │ │ │ │ │ ├── ExecutorRouteStrategyEnum.java
│ │ │ │ │ │ ├── ExecutorRouter.java
│ │ │ │ │ │ └── strategy
│ │ │ │ │ │ │ ├── ExecutorRouteBusyover.java
│ │ │ │ │ │ │ ├── ExecutorRouteConsistentHash.java
│ │ │ │ │ │ │ ├── ExecutorRouteFailover.java
│ │ │ │ │ │ │ ├── ExecutorRouteFirst.java
│ │ │ │ │ │ │ ├── ExecutorRouteLFU.java
│ │ │ │ │ │ │ ├── ExecutorRouteLRU.java
│ │ │ │ │ │ │ ├── ExecutorRouteLast.java
│ │ │ │ │ │ │ ├── ExecutorRouteRandom.java
│ │ │ │ │ │ │ └── ExecutorRouteRound.java
│ │ │ │ │ ├── schedule
│ │ │ │ │ │ └── XxlJobDynamicScheduler.java
│ │ │ │ │ ├── thread
│ │ │ │ │ │ ├── JobFailMonitorHelper.java
│ │ │ │ │ │ ├── JobRegistryMonitorHelper.java
│ │ │ │ │ │ └── JobTriggerPoolHelper.java
│ │ │ │ │ ├── trigger
│ │ │ │ │ │ ├── TriggerTypeEnum.java
│ │ │ │ │ │ └── XxlJobTrigger.java
│ │ │ │ │ └── util
│ │ │ │ │ │ ├── CookieUtil.java
│ │ │ │ │ │ ├── FtlUtil.java
│ │ │ │ │ │ ├── I18nUtil.java
│ │ │ │ │ │ └── LocalCacheUtil.java
│ │ │ │ │ ├── dao
│ │ │ │ │ ├── XxlJobGroupDao.java
│ │ │ │ │ ├── XxlJobInfoDao.java
│ │ │ │ │ ├── XxlJobLogDao.java
│ │ │ │ │ ├── XxlJobLogGlueDao.java
│ │ │ │ │ └── XxlJobRegistryDao.java
│ │ │ │ │ └── service
│ │ │ │ │ ├── XxlJobService.java
│ │ │ │ │ └── impl
│ │ │ │ │ ├── AdminBizImpl.java
│ │ │ │ │ └── XxlJobServiceImpl.java
│ │ │ └── resources
│ │ │ │ ├── application-dev.properties
│ │ │ │ ├── application-test.properties
│ │ │ │ ├── application.properties
│ │ │ │ ├── i18n
│ │ │ │ ├── message.properties
│ │ │ │ └── message_en.properties
│ │ │ │ ├── logback.xml
│ │ │ │ ├── mybatis-mapper
│ │ │ │ ├── XxlJobGroupMapper.xml
│ │ │ │ ├── XxlJobInfoMapper.xml
│ │ │ │ ├── XxlJobLogGlueMapper.xml
│ │ │ │ ├── XxlJobLogMapper.xml
│ │ │ │ └── XxlJobRegistryMapper.xml
│ │ │ │ ├── quartz.properties
│ │ │ │ ├── static
│ │ │ │ ├── adminlte
│ │ │ │ │ ├── bower_components
│ │ │ │ │ │ ├── Ionicons
│ │ │ │ │ │ │ ├── css
│ │ │ │ │ │ │ │ └── ionicons.min.css
│ │ │ │ │ │ │ └── fonts
│ │ │ │ │ │ │ │ ├── ionicons.eot
│ │ │ │ │ │ │ │ ├── ionicons.svg
│ │ │ │ │ │ │ │ ├── ionicons.ttf
│ │ │ │ │ │ │ │ └── ionicons.woff
│ │ │ │ │ │ ├── PACE
│ │ │ │ │ │ │ ├── pace.min.js
│ │ │ │ │ │ │ └── themes
│ │ │ │ │ │ │ │ └── blue
│ │ │ │ │ │ │ │ └── pace-theme-flash.css
│ │ │ │ │ │ ├── bootstrap-daterangepicker
│ │ │ │ │ │ │ ├── daterangepicker.css
│ │ │ │ │ │ │ └── daterangepicker.js
│ │ │ │ │ │ ├── bootstrap
│ │ │ │ │ │ │ ├── css
│ │ │ │ │ │ │ │ ├── bootstrap.css.map
│ │ │ │ │ │ │ │ └── bootstrap.min.css
│ │ │ │ │ │ │ ├── fonts
│ │ │ │ │ │ │ │ ├── glyphicons-halflings-regular.eot
│ │ │ │ │ │ │ │ ├── glyphicons-halflings-regular.svg
│ │ │ │ │ │ │ │ ├── glyphicons-halflings-regular.ttf
│ │ │ │ │ │ │ │ ├── glyphicons-halflings-regular.woff
│ │ │ │ │ │ │ │ └── glyphicons-halflings-regular.woff2
│ │ │ │ │ │ │ └── js
│ │ │ │ │ │ │ │ └── bootstrap.min.js
│ │ │ │ │ │ ├── datatables.net-bs
│ │ │ │ │ │ │ ├── css
│ │ │ │ │ │ │ │ └── dataTables.bootstrap.min.css
│ │ │ │ │ │ │ └── js
│ │ │ │ │ │ │ │ └── dataTables.bootstrap.min.js
│ │ │ │ │ │ ├── datatables.net
│ │ │ │ │ │ │ └── js
│ │ │ │ │ │ │ │ └── jquery.dataTables.min.js
│ │ │ │ │ │ ├── fastclick
│ │ │ │ │ │ │ └── fastclick.js
│ │ │ │ │ │ ├── font-awesome
│ │ │ │ │ │ │ ├── css
│ │ │ │ │ │ │ │ ├── font-awesome.css.map
│ │ │ │ │ │ │ │ └── font-awesome.min.css
│ │ │ │ │ │ │ └── fonts
│ │ │ │ │ │ │ │ ├── FontAwesome.otf
│ │ │ │ │ │ │ │ ├── fontawesome-webfont.eot
│ │ │ │ │ │ │ │ ├── fontawesome-webfont.svg
│ │ │ │ │ │ │ │ ├── fontawesome-webfont.ttf
│ │ │ │ │ │ │ │ ├── fontawesome-webfont.woff
│ │ │ │ │ │ │ │ └── fontawesome-webfont.woff2
│ │ │ │ │ │ ├── jquery-slimscroll
│ │ │ │ │ │ │ └── jquery.slimscroll.min.js
│ │ │ │ │ │ ├── jquery
│ │ │ │ │ │ │ └── jquery.min.js
│ │ │ │ │ │ └── moment
│ │ │ │ │ │ │ └── moment.min.js
│ │ │ │ │ ├── dist
│ │ │ │ │ │ ├── css
│ │ │ │ │ │ │ ├── AdminLTE.min.css
│ │ │ │ │ │ │ └── skins
│ │ │ │ │ │ │ │ └── _all-skins.min.css
│ │ │ │ │ │ └── js
│ │ │ │ │ │ │ └── adminlte.min.js
│ │ │ │ │ └── plugins
│ │ │ │ │ │ └── iCheck
│ │ │ │ │ │ ├── icheck.min.js
│ │ │ │ │ │ └── square
│ │ │ │ │ │ ├── blue.css
│ │ │ │ │ │ ├── blue.png
│ │ │ │ │ │ └── blue@2x.png
│ │ │ │ ├── favicon.ico
│ │ │ │ ├── js
│ │ │ │ │ ├── common.1.js
│ │ │ │ │ ├── index.js
│ │ │ │ │ ├── jobcode.index.1.js
│ │ │ │ │ ├── jobgroup.index.1.js
│ │ │ │ │ ├── jobinfo.index.1.js
│ │ │ │ │ ├── joblog.detail.1.js
│ │ │ │ │ ├── joblog.index.1.js
│ │ │ │ │ └── login.1.js
│ │ │ │ └── plugins
│ │ │ │ │ ├── codemirror
│ │ │ │ │ ├── addon
│ │ │ │ │ │ └── hint
│ │ │ │ │ │ │ ├── anyword-hint.js
│ │ │ │ │ │ │ ├── show-hint.css
│ │ │ │ │ │ │ └── show-hint.js
│ │ │ │ │ ├── lib
│ │ │ │ │ │ ├── codemirror.css
│ │ │ │ │ │ └── codemirror.js
│ │ │ │ │ └── mode
│ │ │ │ │ │ ├── clike
│ │ │ │ │ │ └── clike.js
│ │ │ │ │ │ ├── javascript
│ │ │ │ │ │ └── javascript.js
│ │ │ │ │ │ ├── php
│ │ │ │ │ │ └── php.js
│ │ │ │ │ │ ├── powershell
│ │ │ │ │ │ └── powershell.js
│ │ │ │ │ │ ├── python
│ │ │ │ │ │ └── python.js
│ │ │ │ │ │ └── shell
│ │ │ │ │ │ └── shell.js
│ │ │ │ │ ├── echarts
│ │ │ │ │ └── echarts.common.min.js
│ │ │ │ │ ├── jquery
│ │ │ │ │ ├── jquery.cookie.js
│ │ │ │ │ └── jquery.validate.min.js
│ │ │ │ │ └── layer
│ │ │ │ │ ├── layer.js
│ │ │ │ │ └── theme
│ │ │ │ │ └── default
│ │ │ │ │ ├── icon-ext.png
│ │ │ │ │ ├── icon.png
│ │ │ │ │ ├── layer.css
│ │ │ │ │ ├── loading-0.gif
│ │ │ │ │ ├── loading-1.gif
│ │ │ │ │ └── loading-2.gif
│ │ │ │ └── templates
│ │ │ │ ├── common
│ │ │ │ ├── common.exception.ftl
│ │ │ │ └── common.macro.ftl
│ │ │ │ ├── help.ftl
│ │ │ │ ├── index.ftl
│ │ │ │ ├── jobcode
│ │ │ │ └── jobcode.index.ftl
│ │ │ │ ├── jobgroup
│ │ │ │ └── jobgroup.index.ftl
│ │ │ │ ├── jobinfo
│ │ │ │ └── jobinfo.index.ftl
│ │ │ │ ├── joblog
│ │ │ │ ├── joblog.detail.ftl
│ │ │ │ └── joblog.index.ftl
│ │ │ │ └── login.ftl
│ │ │ └── test
│ │ │ └── java
│ │ │ └── com
│ │ │ └── xxl
│ │ │ └── job
│ │ │ ├── admin
│ │ │ ├── controller
│ │ │ │ ├── AbstractSpringMvcTest.java
│ │ │ │ └── JobInfoControllerTest.java
│ │ │ ├── dao
│ │ │ │ ├── XxlJobGroupDaoTest.java
│ │ │ │ ├── XxlJobInfoDaoTest.java
│ │ │ │ ├── XxlJobLogDaoTest.java
│ │ │ │ ├── XxlJobLogGlueDaoTest.java
│ │ │ │ └── XxlJobRegistryDaoTest.java
│ │ │ └── util
│ │ │ │ └── I18nUtilTest.java
│ │ │ ├── adminbiz
│ │ │ └── AdminBizTest.java
│ │ │ └── executor
│ │ │ └── ExecutorBizTest.java
│ ├── job-core
│ │ ├── pom.xml
│ │ └── src
│ │ │ └── main
│ │ │ └── java
│ │ │ └── com
│ │ │ └── xxl
│ │ │ └── job
│ │ │ └── core
│ │ │ ├── biz
│ │ │ ├── AdminBiz.java
│ │ │ ├── ExecutorBiz.java
│ │ │ ├── impl
│ │ │ │ └── ExecutorBizImpl.java
│ │ │ └── model
│ │ │ │ ├── HandleCallbackParam.java
│ │ │ │ ├── LogResult.java
│ │ │ │ ├── RegistryParam.java
│ │ │ │ ├── ReturnT.java
│ │ │ │ └── TriggerParam.java
│ │ │ ├── enums
│ │ │ ├── ExecutorBlockStrategyEnum.java
│ │ │ └── RegistryConfig.java
│ │ │ ├── executor
│ │ │ ├── XxlJobExecutor.java
│ │ │ └── impl
│ │ │ │ └── XxlJobSpringExecutor.java
│ │ │ ├── glue
│ │ │ ├── GlueFactory.java
│ │ │ ├── GlueTypeEnum.java
│ │ │ └── impl
│ │ │ │ └── SpringGlueFactory.java
│ │ │ ├── handler
│ │ │ ├── IJobHandler.java
│ │ │ ├── annotation
│ │ │ │ └── JobHandler.java
│ │ │ └── impl
│ │ │ │ ├── GlueJobHandler.java
│ │ │ │ └── ScriptJobHandler.java
│ │ │ ├── log
│ │ │ ├── XxlJobFileAppender.java
│ │ │ └── XxlJobLogger.java
│ │ │ ├── thread
│ │ │ ├── ExecutorRegistryThread.java
│ │ │ ├── JobLogFileCleanThread.java
│ │ │ ├── JobThread.java
│ │ │ └── TriggerCallbackThread.java
│ │ │ └── util
│ │ │ ├── DateUtil.java
│ │ │ ├── FileUtil.java
│ │ │ ├── JacksonUtil.java
│ │ │ ├── ScriptUtil.java
│ │ │ └── ShardingUtil.java
│ ├── job-executor-samples
│ │ ├── pom.xml
│ │ └── src
│ │ │ ├── main
│ │ │ ├── java
│ │ │ │ └── com
│ │ │ │ │ └── xxl
│ │ │ │ │ └── job
│ │ │ │ │ └── executor
│ │ │ │ │ ├── JobExecutorApplication.java
│ │ │ │ │ ├── core
│ │ │ │ │ └── config
│ │ │ │ │ │ └── XxlJobConfig.java
│ │ │ │ │ ├── mvc
│ │ │ │ │ └── controller
│ │ │ │ │ │ └── IndexController.java
│ │ │ │ │ └── service
│ │ │ │ │ └── jobhandler
│ │ │ │ │ ├── CommandJobHandler.java
│ │ │ │ │ ├── DemoJobHandler.java
│ │ │ │ │ ├── HttpJobHandler.java
│ │ │ │ │ └── ShardingJobHandler.java
│ │ │ └── resources
│ │ │ │ ├── application-dev.properties
│ │ │ │ ├── application-test.properties
│ │ │ │ ├── application.properties
│ │ │ │ └── logback.xml
│ │ │ └── test
│ │ │ └── java
│ │ │ └── com
│ │ │ └── xxl
│ │ │ └── job
│ │ │ └── executor
│ │ │ └── test
│ │ │ └── XxlJobExecutorExampleBootApplicationTests.java
│ └── pom.xml
├── micro-monitor
│ ├── monitor-admin
│ │ ├── pom.xml
│ │ └── src
│ │ │ └── main
│ │ │ ├── java
│ │ │ └── com
│ │ │ │ └── kernel
│ │ │ │ └── gateway
│ │ │ │ ├── MonitorApp.java
│ │ │ │ └── monitor
│ │ │ │ └── config
│ │ │ │ └── SecuritySecureConfig.java
│ │ │ └── resources
│ │ │ └── bootstrap.yml
│ ├── monitor-logcenter
│ │ ├── pom.xml
│ │ └── src
│ │ │ └── main
│ │ │ ├── java
│ │ │ └── com
│ │ │ │ └── kernel
│ │ │ │ ├── LogApp.java
│ │ │ │ └── log
│ │ │ │ ├── config
│ │ │ │ └── ExceptionAdvice.java
│ │ │ │ └── controller
│ │ │ │ ├── AggregationController.java
│ │ │ │ ├── AuditLogController.java
│ │ │ │ ├── SlowQueryLogController.java
│ │ │ │ └── SysLogController.java
│ │ │ └── resources
│ │ │ ├── application.yml
│ │ │ └── bootstrap.yml
│ └── pom.xml
├── micro-nacos-config
│ ├── pom.xml
│ └── src
│ │ └── main
│ │ └── resources
│ │ ├── application-dev.properties
│ │ ├── application-prod.properties
│ │ ├── application-test.properties
│ │ ├── application.properties
│ │ └── bootstrap.properties
├── micro-register
│ └── nacos
│ │ ├── LICENSE
│ │ ├── NOTICE
│ │ ├── bin
│ │ ├── derby.log
│ │ ├── shutdown.cmd
│ │ ├── shutdown.sh
│ │ ├── startup.cmd
│ │ └── startup.sh
│ │ ├── conf
│ │ ├── application.properties
│ │ ├── application.properties.example
│ │ ├── cluster.conf.example
│ │ ├── nacos-logback.xml
│ │ ├── nacos-mysql.sql
│ │ └── schema.sql
│ │ └── data
│ │ ├── derby-data
│ │ ├── README_DO_NOT_TOUCH_FILES.txt
│ │ ├── db.lck
│ │ ├── log
│ │ │ ├── README_DO_NOT_TOUCH_FILES.txt
│ │ │ ├── log.ctrl
│ │ │ ├── log1.dat
│ │ │ └── logmirror.ctrl
│ │ ├── seg0
│ │ │ ├── README_DO_NOT_TOUCH_FILES.txt
│ │ │ ├── c10.dat
│ │ │ ├── c101.dat
│ │ │ ├── c111.dat
│ │ │ ├── c121.dat
│ │ │ ├── c130.dat
│ │ │ ├── c141.dat
│ │ │ ├── c150.dat
│ │ │ ├── c161.dat
│ │ │ ├── c171.dat
│ │ │ ├── c180.dat
│ │ │ ├── c191.dat
│ │ │ ├── c1a1.dat
│ │ │ ├── c1b1.dat
│ │ │ ├── c1c0.dat
│ │ │ ├── c1d1.dat
│ │ │ ├── c1e0.dat
│ │ │ ├── c1f1.dat
│ │ │ ├── c20.dat
│ │ │ ├── c200.dat
│ │ │ ├── c211.dat
│ │ │ ├── c221.dat
│ │ │ ├── c230.dat
│ │ │ ├── c241.dat
│ │ │ ├── c251.dat
│ │ │ ├── c260.dat
│ │ │ ├── c271.dat
│ │ │ ├── c281.dat
│ │ │ ├── c290.dat
│ │ │ ├── c2a1.dat
│ │ │ ├── c2b1.dat
│ │ │ ├── c2c1.dat
│ │ │ ├── c2d0.dat
│ │ │ ├── c2e1.dat
│ │ │ ├── c2f0.dat
│ │ │ ├── c300.dat
│ │ │ ├── c31.dat
│ │ │ ├── c311.dat
│ │ │ ├── c321.dat
│ │ │ ├── c331.dat
│ │ │ ├── c340.dat
│ │ │ ├── c351.dat
│ │ │ ├── c361.dat
│ │ │ ├── c371.dat
│ │ │ ├── c380.dat
│ │ │ ├── c391.dat
│ │ │ ├── c3a1.dat
│ │ │ ├── c3b1.dat
│ │ │ ├── c3c0.dat
│ │ │ ├── c3d1.dat
│ │ │ ├── c3e1.dat
│ │ │ ├── c3f1.dat
│ │ │ ├── c400.dat
│ │ │ ├── c41.dat
│ │ │ ├── c411.dat
│ │ │ ├── c421.dat
│ │ │ ├── c430.dat
│ │ │ ├── c441.dat
│ │ │ ├── c451.dat
│ │ │ ├── c461.dat
│ │ │ ├── c470.dat
│ │ │ ├── c481.dat
│ │ │ ├── c490.dat
│ │ │ ├── c4a1.dat
│ │ │ ├── c4b1.dat
│ │ │ ├── c4c1.dat
│ │ │ ├── c4d1.dat
│ │ │ ├── c4e1.dat
│ │ │ ├── c4f0.dat
│ │ │ ├── c501.dat
│ │ │ ├── c51.dat
│ │ │ ├── c511.dat
│ │ │ ├── c521.dat
│ │ │ ├── c531.dat
│ │ │ ├── c540.dat
│ │ │ ├── c551.dat
│ │ │ ├── c561.dat
│ │ │ ├── c570.dat
│ │ │ ├── c581.dat
│ │ │ ├── c591.dat
│ │ │ ├── c5a0.dat
│ │ │ ├── c5b1.dat
│ │ │ ├── c5c1.dat
│ │ │ ├── c5d0.dat
│ │ │ ├── c5e1.dat
│ │ │ ├── c5f1.dat
│ │ │ ├── c60.dat
│ │ │ ├── c600.dat
│ │ │ ├── c611.dat
│ │ │ ├── c621.dat
│ │ │ ├── c630.dat
│ │ │ ├── c641.dat
│ │ │ ├── c651.dat
│ │ │ ├── c660.dat
│ │ │ ├── c671.dat
│ │ │ ├── c681.dat
│ │ │ ├── c691.dat
│ │ │ ├── c6a0.dat
│ │ │ ├── c6b1.dat
│ │ │ ├── c6c1.dat
│ │ │ ├── c6d0.dat
│ │ │ ├── c6e1.dat
│ │ │ ├── c6f1.dat
│ │ │ ├── c700.dat
│ │ │ ├── c71.dat
│ │ │ ├── c711.dat
│ │ │ ├── c721.dat
│ │ │ ├── c731.dat
│ │ │ ├── c740.dat
│ │ │ ├── c751.dat
│ │ │ ├── c760.dat
│ │ │ ├── c771.dat
│ │ │ ├── c780.dat
│ │ │ ├── c791.dat
│ │ │ ├── c81.dat
│ │ │ ├── c90.dat
│ │ │ ├── ca1.dat
│ │ │ ├── cb1.dat
│ │ │ ├── cc0.dat
│ │ │ ├── cd1.dat
│ │ │ ├── ce1.dat
│ │ │ ├── cf0.dat
│ │ │ ├── d7a0.dat
│ │ │ ├── d7b0.dat
│ │ │ ├── d7c0.dat
│ │ │ ├── d7d0.dat
│ │ │ ├── d7e0.dat
│ │ │ ├── d7f0.dat
│ │ │ ├── d800.dat
│ │ │ ├── d810.dat
│ │ │ ├── d820.dat
│ │ │ ├── d830.dat
│ │ │ ├── d840.dat
│ │ │ ├── d850.dat
│ │ │ ├── d860.dat
│ │ │ ├── d870.dat
│ │ │ └── d880.dat
│ │ └── service.properties
│ │ └── naming
│ │ └── meta.properties
├── micro-search
│ ├── pom.xml
│ ├── search-client
│ │ ├── pom.xml
│ │ └── src
│ │ │ └── main
│ │ │ └── java
│ │ │ └── com
│ │ │ └── kernel
│ │ │ └── search
│ │ │ ├── annotation
│ │ │ └── EnableSearchClient.java
│ │ │ ├── client
│ │ │ ├── feign
│ │ │ │ ├── AggregationService.java
│ │ │ │ ├── SearchService.java
│ │ │ │ └── fallback
│ │ │ │ │ ├── AggregationServiceFallbackFactory.java
│ │ │ │ │ └── SearchServiceFallbackFactory.java
│ │ │ └── service
│ │ │ │ ├── IQueryService.java
│ │ │ │ └── impl
│ │ │ │ └── QueryServiceImpl.java
│ │ │ └── model
│ │ │ ├── AggItemVo.java
│ │ │ ├── LogicDelDto.java
│ │ │ └── SearchDto.java
│ └── search-server
│ │ ├── pom.xml
│ │ └── src
│ │ └── main
│ │ ├── java
│ │ └── com
│ │ │ └── kernel
│ │ │ ├── SearchCenterApp.java
│ │ │ ├── admin
│ │ │ ├── controller
│ │ │ │ └── IndexController.java
│ │ │ ├── model
│ │ │ │ ├── IndexDto.java
│ │ │ │ └── IndexVo.java
│ │ │ ├── properties
│ │ │ │ └── IndexProperties.java
│ │ │ └── service
│ │ │ │ ├── IIndexService.java
│ │ │ │ └── impl
│ │ │ │ └── IndexServiceImpl.java
│ │ │ ├── common
│ │ │ └── config
│ │ │ │ ├── AsycTaskExecutorConfig.java
│ │ │ │ ├── ExceptionAdvice.java
│ │ │ │ └── WebMvcConfig.java
│ │ │ └── search
│ │ │ ├── controller
│ │ │ ├── AggregationController.java
│ │ │ └── SearchController.java
│ │ │ ├── service
│ │ │ ├── IAggregationService.java
│ │ │ ├── ISearchService.java
│ │ │ └── impl
│ │ │ │ ├── AggregationServiceImpl.java
│ │ │ │ └── SearchServiceImpl.java
│ │ │ └── util
│ │ │ └── SearchBuilder.java
│ │ └── resources
│ │ ├── application.yml
│ │ └── bootstrap.yml
├── micro-transaction
│ ├── pom.xml
│ └── txlcn-tm-transaction
│ │ ├── pom.xml
│ │ └── src
│ │ └── main
│ │ ├── java
│ │ └── org
│ │ │ └── txlcn
│ │ │ └── tm
│ │ │ └── TransactionManagerApplication.java
│ │ └── resources
│ │ ├── application.properties
│ │ └── bootstrap.properties
└── pom.xml
└── pom.xml
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/
2 | logs/
3 | target/
4 | .txlcn/
5 |
6 | *.iml
7 | *.versionsBackup
--------------------------------------------------------------------------------
/knd-commons/knd-authclient-springboot-starter/src/main/java/com/kernel/oauth2/common/config/SecurityPropertiesConfig.java:
--------------------------------------------------------------------------------
1 | package com.kernel.oauth2.common.config;
2 |
3 | import com.kernel.oauth2.common.properties.SecurityProperties;
4 | import org.springframework.boot.context.properties.EnableConfigurationProperties;
5 |
6 | /**
7 | * @author knd
8 | * @date 2020/3/21
9 | *
10 | */
11 | @EnableConfigurationProperties(SecurityProperties.class)
12 | public class SecurityPropertiesConfig {
13 | }
14 |
--------------------------------------------------------------------------------
/knd-commons/knd-authclient-springboot-starter/src/main/java/com/kernel/oauth2/common/constants/AuthoritiesEnum.java:
--------------------------------------------------------------------------------
1 | package com.kernel.oauth2.common.constants;
2 |
3 | /**
4 | * 权限常量
5 | *
6 | * @author knd
7 | * @date 2020/3/21
8 | */
9 | public enum AuthoritiesEnum {
10 | /**
11 | * 管理员
12 | */
13 | ADMIN("ROLE_ADMIN"),
14 | /**
15 | * 普通用户
16 | */
17 | USER("ROLE_USER"),
18 | /**
19 | * 匿名用户
20 | */
21 | ANONYMOUS("ROLE_ANONYMOUS");
22 |
23 | private String role;
24 |
25 | AuthoritiesEnum(String role) {
26 | this.role = role;
27 | }
28 |
29 | public String getRole() {
30 | return role;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/knd-commons/knd-authclient-springboot-starter/src/main/java/com/kernel/oauth2/common/properties/AuthProperties.java:
--------------------------------------------------------------------------------
1 | package com.kernel.oauth2.common.properties;
2 |
3 | import lombok.Getter;
4 | import lombok.Setter;
5 |
6 | /**
7 | * 认证配置
8 | *
9 | * @author knd
10 | */
11 | @Setter
12 | @Getter
13 | public class AuthProperties {
14 | /**
15 | * 配置要认证的url(默认不需要配置)
16 | *
17 | * 优先级大于忽略认证配置`knd.security.ignore.httpUrls`
18 | * 意思是如果同一个url同时配置了`忽略认证`和`需要认证`,则该url还是会被认证
19 | */
20 | private String[] httpUrls = {};
21 |
22 | /**
23 | * token自动续签配置(目前只有redis实现)
24 | */
25 | private RenewProperties renew = new RenewProperties();
26 |
27 | /**
28 | * url权限配置
29 | */
30 | private UrlPermissionProperties urlPermission = new UrlPermissionProperties();
31 | }
32 |
--------------------------------------------------------------------------------
/knd-commons/knd-authclient-springboot-starter/src/main/java/com/kernel/oauth2/common/properties/RenewProperties.java:
--------------------------------------------------------------------------------
1 | package com.kernel.oauth2.common.properties;
2 |
3 | import lombok.Getter;
4 | import lombok.Setter;
5 |
6 | import java.util.ArrayList;
7 | import java.util.List;
8 |
9 | /**
10 | * 续签配置
11 | *
12 | * @author knd
13 | * @date 2020/3/21
14 | */
15 | @Setter
16 | @Getter
17 | public class RenewProperties {
18 | /**
19 | * 是否开启token自动续签(目前只有redis实现)
20 | */
21 | private Boolean enable = false;
22 |
23 | /**
24 | * 白名单,配置需要自动续签的应用id(与黑名单互斥,只能配置其中一个),不配置默认所有应用都生效
25 | * 配置enable为true时才生效
26 | */
27 | private List includeClientIds = new ArrayList<>();
28 |
29 | /**
30 | * 黑名单,配置不需要自动续签的应用id(与白名单互斥,只能配置其中一个)
31 | * 配置enable为true时才生效
32 | */
33 | private List exclusiveClientIds = new ArrayList<>();
34 |
35 | /**
36 | * 续签时间比例,当前剩余时间小于小于过期总时长的50%则续签
37 | */
38 | private Double timeRatio = 0.5;
39 | }
40 |
--------------------------------------------------------------------------------
/knd-commons/knd-authclient-springboot-starter/src/main/java/com/kernel/oauth2/common/properties/SecurityProperties.java:
--------------------------------------------------------------------------------
1 | package com.kernel.oauth2.common.properties;
2 |
3 | import lombok.Getter;
4 | import lombok.Setter;
5 | import org.springframework.boot.context.properties.ConfigurationProperties;
6 | import org.springframework.cloud.context.config.annotation.RefreshScope;
7 |
8 | /**
9 | * @author knd
10 | * @date 2020/3/21
11 | */
12 | @Setter
13 | @Getter
14 | @ConfigurationProperties(prefix = "knd.security")
15 | @RefreshScope
16 | public class SecurityProperties {
17 | private AuthProperties auth = new AuthProperties();
18 |
19 | private PermitProperties ignore = new PermitProperties();
20 |
21 | private ValidateCodeProperties code = new ValidateCodeProperties();
22 | }
23 |
--------------------------------------------------------------------------------
/knd-commons/knd-authclient-springboot-starter/src/main/java/com/kernel/oauth2/common/properties/UrlPermissionProperties.java:
--------------------------------------------------------------------------------
1 | package com.kernel.oauth2.common.properties;
2 |
3 | import lombok.Getter;
4 | import lombok.Setter;
5 |
6 | import java.util.ArrayList;
7 | import java.util.List;
8 |
9 | /**
10 | * url权限配置
11 | *
12 | * @author knd
13 | * @date 2020/3/21
14 | */
15 | @Setter
16 | @Getter
17 | public class UrlPermissionProperties {
18 | /**
19 | * 是否开启url级别权限
20 | */
21 | private Boolean enable = false;
22 |
23 | /**
24 | * 白名单,配置需要url权限认证的应用id(与黑名单互斥,只能配置其中一个),不配置默认所有应用都生效
25 | * 配置enable为true时才生效
26 | */
27 | private List includeClientIds = new ArrayList<>();
28 |
29 | /**
30 | * 黑名单,配置不需要url权限认证的应用id(与白名单互斥,只能配置其中一个)
31 | * 配置enable为true时才生效
32 | */
33 | private List exclusiveClientIds = new ArrayList<>();
34 |
35 | /**
36 | * 配置只进行登录认证,不进行url权限认证的api
37 | * 所有已登录的人都能访问的api
38 | */
39 | private String[] ignoreUrls = {};
40 | }
41 |
--------------------------------------------------------------------------------
/knd-commons/knd-authclient-springboot-starter/src/main/java/com/kernel/oauth2/common/properties/ValidateCodeProperties.java:
--------------------------------------------------------------------------------
1 | package com.kernel.oauth2.common.properties;
2 |
3 | import lombok.Getter;
4 | import lombok.Setter;
5 |
6 | /**
7 | * 验证码配置
8 | *
9 | * @author knd
10 | * @date 2020/3/21
11 | */
12 | @Setter
13 | @Getter
14 | public class ValidateCodeProperties {
15 | /**
16 | * 设置认证通时不需要验证码的clientId
17 | */
18 | private String[] ignoreClientCode = {};
19 | }
20 |
--------------------------------------------------------------------------------
/knd-commons/knd-authclient-springboot-starter/src/main/java/com/kernel/oauth2/common/store/AuthDbTokenStore.java:
--------------------------------------------------------------------------------
1 | package com.kernel.oauth2.common.store;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 | import org.springframework.context.annotation.Bean;
5 | import org.springframework.security.oauth2.provider.token.TokenStore;
6 | import org.springframework.security.oauth2.provider.token.store.JdbcTokenStore;
7 |
8 | import javax.sql.DataSource;
9 |
10 | /**
11 | * 认证服务器使用数据库存取令牌
12 | *
13 | * @author knd
14 | * @date 2020/3/21
15 | */
16 | public class AuthDbTokenStore {
17 |
18 | @Autowired
19 | private DataSource dataSource;
20 |
21 | @Bean
22 | public TokenStore tokenStore(){
23 | return new JdbcTokenStore(dataSource);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/knd-commons/knd-authclient-springboot-starter/src/main/java/com/kernel/oauth2/common/store/AuthRedisTokenStore.java:
--------------------------------------------------------------------------------
1 | package com.kernel.oauth2.common.store;
2 |
3 | import com.kernel.oauth2.common.properties.SecurityProperties;
4 | import org.springframework.beans.factory.annotation.Autowired;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.data.redis.connection.RedisConnectionFactory;
7 | import org.springframework.security.oauth2.provider.token.TokenStore;
8 |
9 | /**
10 | * 认证服务器使用Redis存取令牌
11 | * 注意: 需要配置redis参数
12 | *
13 | * @author knd
14 | * @date 2020/3/21
15 | */
16 | public class AuthRedisTokenStore {
17 | @Autowired
18 | private RedisConnectionFactory connectionFactory;
19 |
20 | @Autowired
21 | private SecurityProperties securityProperties;
22 |
23 | @Bean
24 | public TokenStore tokenStore() {
25 | return new CustomRedisTokenStore(connectionFactory, securityProperties);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/knd-commons/knd-authclient-springboot-starter/src/main/resources/META-INF/spring.factories:
--------------------------------------------------------------------------------
1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
2 | com.kernel.oauth2.common.config.SecurityPropertiesConfig
--------------------------------------------------------------------------------
/knd-commons/knd-common-core/src/main/java/com/kernel/common/annotation/LoginClient.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.annotation;
2 |
3 | import java.lang.annotation.*;
4 |
5 | /**
6 | * 请求的方法参数上添加该注解,则注入当前登录账号的应用id
7 | * 例:public void test(@LoginClient String clientId) //注入webApp
8 | *
9 | * @author kndopensource
10 | * @date 2018/7/24 16:44
11 | */
12 | @Target(ElementType.PARAMETER)
13 | @Retention(RetentionPolicy.RUNTIME)
14 | @Documented
15 | public @interface LoginClient {
16 | }
17 |
--------------------------------------------------------------------------------
/knd-commons/knd-common-core/src/main/java/com/kernel/common/annotation/LoginUser.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.annotation;
2 |
3 | import java.lang.annotation.*;
4 |
5 | /**
6 | * 请求的方法参数SysUser上添加该注解,则注入当前登录人信息
7 | * 例1:public void test(@LoginUser SysUser user) //只有username 和 roles
8 | * 例2:public void test(@LoginUser(isFull = true) SysUser user) //能获取SysUser对象的所有信息
9 | *
10 | * @author kndopensource
11 | * @date 2018/7/24 16:44
12 | */
13 | @Target(ElementType.PARAMETER)
14 | @Retention(RetentionPolicy.RUNTIME)
15 | @Documented
16 | public @interface LoginUser {
17 | /**
18 | * 是否查询SysUser对象所有信息,true则通过rpc接口查询
19 | */
20 | boolean isFull() default false;
21 | }
22 |
--------------------------------------------------------------------------------
/knd-commons/knd-common-core/src/main/java/com/kernel/common/config/DefaultPasswordConfig.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.config;
2 |
3 | import org.springframework.context.annotation.Bean;
4 | import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
5 | import org.springframework.security.crypto.password.PasswordEncoder;
6 |
7 | /**
8 | * @author kndopensource
9 | * 密码工具类
10 | */
11 | public class DefaultPasswordConfig {
12 | /**
13 | * 装配BCryptPasswordEncoder用户密码的匹配
14 | * @return
15 | */
16 | @Bean
17 | public PasswordEncoder passwordEncoder() {
18 | return new BCryptPasswordEncoder();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/knd-commons/knd-common-core/src/main/java/com/kernel/common/config/LoginArgResolverConfig.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.config;
2 |
3 | import com.kernel.common.feign.UserService;
4 | import com.kernel.common.resolver.ClientArgumentResolver;
5 | import com.kernel.common.resolver.TokenArgumentResolver;
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.context.annotation.Lazy;
8 | import org.springframework.web.method.support.HandlerMethodArgumentResolver;
9 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
10 |
11 | import java.util.List;
12 |
13 | /**
14 | * 公共配置类, 一些公共工具配置
15 | *
16 | * @author kndopensource
17 | * @date 2018/8/25
18 | */
19 | public class LoginArgResolverConfig implements WebMvcConfigurer {
20 | @Lazy
21 | @Autowired
22 | private UserService userService;
23 | /**
24 | * Token参数解析
25 | *
26 | * @param argumentResolvers 解析类
27 | */
28 | @Override
29 | public void addArgumentResolvers(List argumentResolvers) {
30 | //注入用户信息
31 | argumentResolvers.add(new TokenArgumentResolver(userService));
32 | //注入应用信息
33 | argumentResolvers.add(new ClientArgumentResolver());
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/knd-commons/knd-common-core/src/main/java/com/kernel/common/constant/ConfigConstants.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.constant;
2 |
3 | /**
4 | * 配置项常量
5 | *
6 | * @author kndopensource
7 | * @date 2019/9/3
8 | */
9 | public interface ConfigConstants {
10 | /**
11 | * 是否开启自定义隔离规则
12 | */
13 | String CONFIG_RIBBON_ISOLATION_ENABLED = "kndopensource.ribbon.isolation.enabled";
14 | }
15 |
--------------------------------------------------------------------------------
/knd-commons/knd-common-core/src/main/java/com/kernel/common/constant/ServiceNameConstants.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.constant;
2 |
3 | /**
4 | * 服务名称常量
5 | *
6 | * @author kndopensource
7 | * @date 2018/7/27 13:50
8 | */
9 | public interface ServiceNameConstants {
10 |
11 | /**
12 | * 用户权限服务
13 | */
14 | String USER_SERVICE = "user-center";
15 | /**
16 | * 搜索中心服务
17 | */
18 | String SEARCH_SERVICE = "search-center";
19 | }
20 |
--------------------------------------------------------------------------------
/knd-commons/knd-common-core/src/main/java/com/kernel/common/context/LbIsolationContextHolder.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.context;
2 |
3 | import com.alibaba.ttl.TransmittableThreadLocal;
4 |
5 | /**
6 | * 负载均衡策略Holder
7 | *
8 | * @author kndopensource
9 | * @date 2019/9/2
10 | */
11 | public class LbIsolationContextHolder {
12 | private static final ThreadLocal VERSION_CONTEXT = new TransmittableThreadLocal<>();
13 |
14 | public static void setVersion(String version) {
15 | VERSION_CONTEXT.set(version);
16 | }
17 |
18 | public static String getVersion() {
19 | return VERSION_CONTEXT.get();
20 | }
21 |
22 | public static void clear() {
23 | VERSION_CONTEXT.remove();
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/knd-commons/knd-common-core/src/main/java/com/kernel/common/context/TenantContextHolder.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.context;
2 |
3 | import com.alibaba.ttl.TransmittableThreadLocal;
4 |
5 | /**
6 | * 租户holder
7 | *
8 | * @author kndopensource
9 | * @date 2019/8/5
10 | */
11 | public class TenantContextHolder {
12 | /**
13 | * 支持父子线程之间的数据传递
14 | */
15 | private static final ThreadLocal CONTEXT = new TransmittableThreadLocal<>();
16 |
17 | public static void setTenant(String tenant) {
18 | CONTEXT.set(tenant);
19 | }
20 |
21 | public static String getTenant() {
22 | return CONTEXT.get();
23 | }
24 |
25 | public static void clear() {
26 | CONTEXT.remove();
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/knd-commons/knd-common-core/src/main/java/com/kernel/common/enums/AbstractBaseExceptionEnum.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.enums;
2 |
3 | /**
4 | * roses异常规范
5 | *
6 | * @author fengshuonan
7 | * @date 2017-12-17-下午10:22
8 | */
9 | public interface AbstractBaseExceptionEnum {
10 |
11 | /**
12 | * 获取异常的状态码
13 | */
14 | Integer getCode();
15 |
16 | /**
17 | * 获取异常的提示信息
18 | */
19 | String getMessage();
20 | }
21 |
--------------------------------------------------------------------------------
/knd-commons/knd-common-core/src/main/java/com/kernel/common/enums/DeleteFlagEnum.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.enums;
2 |
3 | /**
4 | * 是否删除的标识
5 | *
6 | * @author fengshuonan
7 | * @Date 2018/7/24 下午5:31
8 | */
9 | public enum DeleteFlagEnum {
10 |
11 | /**
12 | * 已删除
13 | */
14 | Y,
15 |
16 | /**
17 | * 未删除
18 | */
19 | N
20 | }
21 |
--------------------------------------------------------------------------------
/knd-commons/knd-common-core/src/main/java/com/kernel/common/enums/YesOrNotEnum.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.enums;
2 |
3 | import lombok.Getter;
4 |
5 | /**
6 | * 是或者否的枚举
7 | *
8 | * @author stylefeng
9 | * @Date 2018/4/18 23:05
10 | */
11 | @Getter
12 | public enum YesOrNotEnum {
13 |
14 | Y(true, "是", 1),
15 |
16 | N(false, "否", 0);
17 |
18 | private Boolean flag;
19 | private String desc;
20 | private Integer code;
21 |
22 | YesOrNotEnum(Boolean flag, String desc, Integer code) {
23 | this.flag = flag;
24 | this.desc = desc;
25 | this.code = code;
26 | }
27 |
28 | public static String valueOf(Integer status) {
29 | if (status == null) {
30 | return "";
31 | } else {
32 | for (YesOrNotEnum s : YesOrNotEnum.values()) {
33 | if (s.getCode().equals(status)) {
34 | return s.getDesc();
35 | }
36 | }
37 | return "";
38 | }
39 | }
40 |
41 | }
42 |
--------------------------------------------------------------------------------
/knd-commons/knd-common-core/src/main/java/com/kernel/common/exception/BusinessException.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.exception;
2 |
3 | /**
4 | * 业务异常
5 | *
6 | * @author kndopensource
7 | */
8 | public class BusinessException extends RuntimeException {
9 | private static final long serialVersionUID = 6610083281801529147L;
10 |
11 | public BusinessException(String message) {
12 | super(message);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/knd-commons/knd-common-core/src/main/java/com/kernel/common/exception/IdempotencyException.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.exception;
2 |
3 | /**
4 | * 幂等性异常
5 | *
6 | * @author kndopensource
7 | */
8 | public class IdempotencyException extends RuntimeException {
9 | private static final long serialVersionUID = 6610083281801529147L;
10 |
11 | public IdempotencyException(String message) {
12 | super(message);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/knd-commons/knd-common-core/src/main/java/com/kernel/common/exception/LockException.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.exception;
2 |
3 | /**
4 | * 分布式锁异常
5 | *
6 | * @author kndopensource
7 | */
8 | public class LockException extends RuntimeException {
9 | private static final long serialVersionUID = 6610083281801529147L;
10 |
11 | public LockException(String message) {
12 | super(message);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/knd-commons/knd-common-core/src/main/java/com/kernel/common/lock/AbstractDistributedLock.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.lock;
2 |
3 | /**
4 | * 分布式锁抽象类
5 | *
6 | * @author kndopensource
7 | * @date 2018/5/29 14:14
8 | */
9 | public abstract class AbstractDistributedLock implements DistributedLock{
10 |
11 | @Override
12 | public boolean lock(String key) {
13 | return lock(key, TIMEOUT_MILLIS, RETRY_TIMES, SLEEP_MILLIS);
14 | }
15 |
16 | @Override
17 | public boolean lock(String key, int retryTimes) {
18 | return lock(key, TIMEOUT_MILLIS, retryTimes, SLEEP_MILLIS);
19 | }
20 |
21 | @Override
22 | public boolean lock(String key, int retryTimes, long sleepMillis) {
23 | return lock(key, TIMEOUT_MILLIS, retryTimes, sleepMillis);
24 | }
25 |
26 | @Override
27 | public boolean lock(String key, long expire) {
28 | return lock(key, expire, RETRY_TIMES, SLEEP_MILLIS);
29 | }
30 |
31 | @Override
32 | public boolean lock(String key, long expire, int retryTimes) {
33 | return lock(key, expire, retryTimes, SLEEP_MILLIS);
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/knd-commons/knd-common-core/src/main/java/com/kernel/common/model/CodeEnum.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.model;
2 |
3 | /**
4 | * @Author: kndopensource
5 | */
6 | public enum CodeEnum {
7 | SUCCESS(0),
8 | ERROR(1);
9 |
10 | private Integer code;
11 | CodeEnum(Integer code){
12 | this.code = code;
13 | }
14 |
15 | public Integer getCode() {
16 | return code;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/knd-commons/knd-common-core/src/main/java/com/kernel/common/model/PageResult.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.model;
2 |
3 | import java.io.Serializable;
4 | import java.util.List;
5 |
6 | import lombok.AllArgsConstructor;
7 | import lombok.Builder;
8 | import lombok.Data;
9 | import lombok.NoArgsConstructor;
10 |
11 | /**
12 | * 分页实体类
13 | *
14 | * @author kndopensource
15 | */
16 | @Data
17 | @Builder
18 | @NoArgsConstructor
19 | @AllArgsConstructor
20 | public class PageResult implements Serializable {
21 | private static final long serialVersionUID = -275582248840137389L;
22 | /**
23 | * 总数
24 | */
25 | private Long count;
26 | /**
27 | * 是否成功:0 成功、1 失败
28 | */
29 | private int code;
30 | /**
31 | * 当前页结果集
32 | */
33 | private List data;
34 | }
35 |
--------------------------------------------------------------------------------
/knd-commons/knd-common-core/src/main/java/com/kernel/common/model/SuperEntity.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.model;
2 |
3 | import com.baomidou.mybatisplus.annotation.FieldFill;
4 | import com.baomidou.mybatisplus.annotation.TableField;
5 | import com.baomidou.mybatisplus.annotation.TableId;
6 | import com.baomidou.mybatisplus.extension.activerecord.Model;
7 | import lombok.Getter;
8 | import lombok.Setter;
9 |
10 | import java.io.Serializable;
11 | import java.util.Date;
12 |
13 | /**
14 | * 实体父类
15 | *
16 | * @author kndopensource
17 | */
18 | @Setter
19 | @Getter
20 | public class SuperEntity> extends Model {
21 | /**
22 | * 主键ID
23 | */
24 | @TableId
25 | private Long id;
26 | @TableField(fill = FieldFill.INSERT)
27 | private Date createTime;
28 | @TableField(fill = FieldFill.INSERT_UPDATE)
29 | private Date updateTime;
30 |
31 | @Override
32 | protected Serializable pkVal() {
33 | return this.id;
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/knd-commons/knd-common-core/src/main/java/com/kernel/common/model/SysMenu.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.model;
2 |
3 | import java.util.List;
4 | import java.util.Set;
5 |
6 | import com.baomidou.mybatisplus.annotation.TableField;
7 | import com.baomidou.mybatisplus.annotation.TableName;
8 | import lombok.Data;
9 | import lombok.EqualsAndHashCode;
10 |
11 | /**
12 | * @author kndopensource
13 | */
14 | @Data
15 | @EqualsAndHashCode(callSuper = false)
16 | @TableName("sys_menu")
17 | public class SysMenu extends SuperEntity {
18 | private static final long serialVersionUID = 749360940290141180L;
19 |
20 | private Long parentId;
21 | private String name;
22 | private String css;
23 | private String url;
24 | private String path;
25 | private Integer sort;
26 | private Integer type;
27 | private Boolean hidden;
28 | /**
29 | * 请求的类型
30 | */
31 | private String pathMethod;
32 |
33 | @TableField(exist = false)
34 | private List subMenus;
35 | @TableField(exist = false)
36 | private Long roleId;
37 | @TableField(exist = false)
38 | private Set menuIds;
39 | }
40 |
--------------------------------------------------------------------------------
/knd-commons/knd-common-core/src/main/java/com/kernel/common/model/SysRole.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.model;
2 |
3 | import com.baomidou.mybatisplus.annotation.TableName;
4 | import lombok.Data;
5 | import lombok.EqualsAndHashCode;
6 |
7 | /**
8 | * @author kndopensource
9 | * 角色
10 | */
11 | @Data
12 | @EqualsAndHashCode(callSuper = false)
13 | @TableName("sys_role")
14 | public class SysRole extends SuperEntity {
15 | private static final long serialVersionUID = 4497149010220586111L;
16 | private String code;
17 | private String name;
18 | private Long userId;
19 | }
20 |
--------------------------------------------------------------------------------
/knd-commons/knd-common-core/src/main/java/com/kernel/common/model/SysUser.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.model;
2 |
3 | import java.util.List;
4 |
5 | import com.baomidou.mybatisplus.annotation.TableField;
6 | import com.baomidou.mybatisplus.annotation.TableLogic;
7 | import com.baomidou.mybatisplus.annotation.TableName;
8 | import lombok.Data;
9 | import lombok.EqualsAndHashCode;
10 |
11 | /**
12 | * @author kndopensource
13 | * 用户实体
14 | */
15 | @Data
16 | @EqualsAndHashCode(callSuper = false)
17 | @TableName("sys_user")
18 | public class SysUser extends SuperEntity {
19 | private static final long serialVersionUID = -5886012896705137070L;
20 |
21 | private String username;
22 | private String password;
23 | private String nickname;
24 | private String headImgUrl;
25 | private String mobile;
26 | private Integer sex;
27 | private Boolean enabled;
28 | private String type;
29 | private String openId;
30 | @TableLogic
31 | private boolean isDel;
32 |
33 | @TableField(exist = false)
34 | private List roles;
35 | @TableField(exist = false)
36 | private String roleId;
37 | @TableField(exist = false)
38 | private String oldPassword;
39 | @TableField(exist = false)
40 | private String newPassword;
41 | }
42 |
--------------------------------------------------------------------------------
/knd-commons/knd-common-core/src/main/java/com/kernel/common/model/UserType.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.model;
2 |
3 |
4 | /**
5 | * @author kndopensource
6 | * 用户类型
7 | */
8 | public enum UserType {
9 |
10 | /**
11 | * 前端app用户
12 | */
13 | APP,
14 | /**
15 | * 后端管理用户
16 | */
17 | BACKEND
18 | }
19 |
--------------------------------------------------------------------------------
/knd-commons/knd-common-core/src/main/java/com/kernel/common/properties/TenantProperties.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.properties;
2 |
3 | import lombok.Getter;
4 | import lombok.Setter;
5 | import org.springframework.boot.context.properties.ConfigurationProperties;
6 | import org.springframework.cloud.context.config.annotation.RefreshScope;
7 |
8 | import java.util.ArrayList;
9 | import java.util.List;
10 |
11 | /**
12 | * 多租户配置
13 | * @author kndopensource
14 | * @date 2019/8/5
15 | */
16 | @Setter
17 | @Getter
18 | @ConfigurationProperties(prefix = "kndopensource.tenant")
19 | @RefreshScope
20 | public class TenantProperties {
21 | /**
22 | * 是否开启多租户
23 | */
24 | private Boolean enable = false;
25 |
26 | /**
27 | * 配置不进行多租户隔离的表名
28 | */
29 | private List ignoreTables = new ArrayList<>();
30 |
31 | /**
32 | * 配置不进行多租户隔离的sql
33 | * 需要配置mapper的全路径如:com.kernel.user.mapper.SysUserMapper.findList
34 | */
35 | private List ignoreSqls = new ArrayList<>();
36 | }
37 |
--------------------------------------------------------------------------------
/knd-commons/knd-common-core/src/main/java/com/kernel/common/utils/IdGenerator.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.utils;
2 |
3 | /**
4 | * 高效分布式ID生成算法(sequence),基于Snowflake算法优化实现64位自增ID算法。
5 | * 其中解决时间回拨问题的优化方案如下:
6 | * 1. 如果发现当前时间少于上次生成id的时间(时间回拨),着计算回拨的时间差
7 | * 2. 如果时间差(offset)小于等于5ms,着等待 offset * 2 的时间再生成
8 | * 3. 如果offset大于5,则直接抛出异常
9 | *
10 | * @author kndopensource
11 | * @date 2019/3/5
12 | */
13 | public class IdGenerator {
14 | private static Sequence WORKER = new Sequence();
15 |
16 | public static long getId() {
17 | return WORKER.nextId();
18 | }
19 |
20 | public static String getIdStr() {
21 | return String.valueOf(WORKER.nextId());
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/knd-commons/knd-common-core/src/main/java/com/kernel/common/utils/SpringUtil.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.utils;
2 |
3 | import org.springframework.context.ApplicationContext;
4 | import org.springframework.context.ApplicationContextAware;
5 | import org.springframework.core.env.Environment;
6 | import org.springframework.stereotype.Component;
7 |
8 | /**
9 | * spring获取bean工具类
10 | *
11 | * @author 作者 owen E-mail: 624191343@qq.com
12 | */
13 | @Component
14 | public class SpringUtil implements ApplicationContextAware {
15 |
16 | private static ApplicationContext applicationContext = null;
17 |
18 | public static T getBean(Class cla) {
19 | return applicationContext.getBean(cla);
20 | }
21 |
22 | public static T getBean(String name, Class cal) {
23 | return applicationContext.getBean(name, cal);
24 | }
25 |
26 | public static String getProperty(String key) {
27 | return applicationContext.getBean(Environment.class).getProperty(key);
28 | }
29 |
30 | @Override
31 | public void setApplicationContext(ApplicationContext applicationContext) {
32 | SpringUtil.applicationContext = applicationContext;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/knd-commons/knd-common-core/src/main/resources/META-INF/spring.factories:
--------------------------------------------------------------------------------
1 | org.springframework.context.ApplicationContextInitializer=\
2 | com.kernel.common.config.BannerInitializer
--------------------------------------------------------------------------------
/knd-commons/knd-common-core/src/main/resources/kndmp/logo.txt:
--------------------------------------------------------------------------------
1 | ________
2 | | /
3 | `---/ /
4 | / /
5 | / /----.
6 | /________|
7 | __
8 | | |
9 | | |
10 | | |
11 | | `----.
12 | |_______|
13 | .___________.
14 | | |
15 | `---| |----`
16 | | |
17 | | |
18 | |__|
19 | .___ ___.
20 | | \/ |
21 | | \ / |
22 | | |\/| |
23 | | | | |
24 | |__| |__|
25 | .______
26 | | _ \
27 | | |_) |
28 | | ___/
29 | | |
30 | | _|
--------------------------------------------------------------------------------
/knd-commons/knd-common-springboot-starter/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | knd-commons
7 | com.knd
8 | 1.0.0-SNAPSHOT
9 |
10 | 4.0.0
11 | knd-common-springboot-starter
12 | springboot公共通用组件过滤器、拦截器。。。
13 | jar
14 | ${project.artifactId}
15 |
16 |
17 |
18 | com.knd
19 | knd-common-core
20 |
21 |
22 | javax.servlet
23 | javax.servlet-api
24 | true
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/knd-commons/knd-common-springboot-starter/src/main/resources/META-INF/spring.factories:
--------------------------------------------------------------------------------
1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
2 | com.kernel.common.filter.TenantFilter,\
3 | com.kernel.common.filter.TraceFilter
--------------------------------------------------------------------------------
/knd-commons/knd-db-springboot-starter/src/main/java/com/kernel/db/mapper/SuperMapper.java:
--------------------------------------------------------------------------------
1 | package com.kernel.db.mapper;
2 |
3 |
4 | import com.baomidou.mybatisplus.core.mapper.BaseMapper;
5 |
6 | /**
7 | * mapper 父类,注意这个类不要让 mp 扫描到!!
8 | * @author kndopensource
9 | */
10 | public interface SuperMapper extends BaseMapper {
11 | // 这里可以放一些公共的方法
12 | }
13 |
--------------------------------------------------------------------------------
/knd-commons/knd-db-springboot-starter/src/main/resources/META-INF/spring.factories:
--------------------------------------------------------------------------------
1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
2 | com.kernel.db.config.TenantAutoConfigure
3 |
--------------------------------------------------------------------------------
/knd-commons/knd-log-springboot-starter/src/main/java/com/kernel/log/annotation/AuditLog.java:
--------------------------------------------------------------------------------
1 | package com.kernel.log.annotation;
2 |
3 | import java.lang.annotation.*;
4 |
5 | /**
6 | * @author kndopensource
7 | * @date 2020/20/3
8 | *
9 | */
10 | @Target({ElementType.METHOD, ElementType.TYPE})
11 | @Retention(RetentionPolicy.RUNTIME)
12 | @Documented
13 | public @interface AuditLog {
14 | /**
15 | * 操作信息
16 | */
17 | String operation();
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/knd-commons/knd-log-springboot-starter/src/main/java/com/kernel/log/config/LogAutoConfigure.java:
--------------------------------------------------------------------------------
1 | package com.kernel.log.config;
2 |
3 | import com.kernel.log.properties.AuditLogProperties;
4 | import com.kernel.log.properties.LogDbProperties;
5 | import com.kernel.log.properties.TraceProperties;
6 | import com.zaxxer.hikari.HikariConfig;
7 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
8 | import org.springframework.boot.context.properties.EnableConfigurationProperties;
9 | import org.springframework.context.annotation.Configuration;
10 |
11 |
12 | /**
13 | * 日志自动配置
14 | * @author kndopensource
15 | * @date 2020/20/3
16 | *
17 | */
18 | @EnableConfigurationProperties({TraceProperties.class, AuditLogProperties.class})
19 | public class LogAutoConfigure {
20 | /**
21 | * 日志数据库配置
22 | */
23 | @Configuration
24 | @ConditionalOnClass(HikariConfig.class)
25 | @EnableConfigurationProperties(LogDbProperties.class)
26 | public static class LogDbAutoConfigure {}
27 | }
28 |
--------------------------------------------------------------------------------
/knd-commons/knd-log-springboot-starter/src/main/java/com/kernel/log/config/TtlMDCAdapterInitializer.java:
--------------------------------------------------------------------------------
1 | package com.kernel.log.config;
2 |
3 | import org.slf4j.TtlMDCAdapter;
4 | import org.springframework.context.ApplicationContextInitializer;
5 | import org.springframework.context.ConfigurableApplicationContext;
6 |
7 |
8 | /**
9 | * 初始化TtlMDCAdapter实例,并替换MDC中的adapter对象
10 | * @author kndopensource
11 | * @date 2020/20/3
12 | *
13 | */
14 | public class TtlMDCAdapterInitializer implements ApplicationContextInitializer {
15 | @Override
16 | public void initialize(ConfigurableApplicationContext applicationContext) {
17 | //加载TtlMDCAdapter实例
18 | TtlMDCAdapter.getInstance();
19 | }
20 | }
--------------------------------------------------------------------------------
/knd-commons/knd-log-springboot-starter/src/main/java/com/kernel/log/model/Audit.java:
--------------------------------------------------------------------------------
1 | package com.kernel.log.model;
2 |
3 | import lombok.Getter;
4 | import lombok.Setter;
5 |
6 | import java.time.LocalDateTime;
7 |
8 | /**
9 | * 审计日志
10 | * @author kndopensource
11 | * @date 2020/20/3
12 | *
13 | */
14 | @Setter
15 | @Getter
16 | public class Audit {
17 | /**
18 | * 操作时间
19 | */
20 | private LocalDateTime timestamp;
21 | /**
22 | * 应用名
23 | */
24 | private String applicationName;
25 | /**
26 | * 类名
27 | */
28 | private String className;
29 | /**
30 | * 方法名
31 | */
32 | private String methodName;
33 | /**
34 | * 用户id
35 | */
36 | private String userId;
37 | /**
38 | * 用户名
39 | */
40 | private String userName;
41 | /**
42 | * 租户id
43 | */
44 | private String clientId;
45 | /**
46 | * 操作信息
47 | */
48 | private String operation;
49 | }
50 |
--------------------------------------------------------------------------------
/knd-commons/knd-log-springboot-starter/src/main/java/com/kernel/log/monitor/PointUtil.java:
--------------------------------------------------------------------------------
1 | package com.kernel.log.monitor;
2 |
3 | import lombok.extern.slf4j.Slf4j;
4 |
5 | /**
6 | * 日志埋点工具类
7 | *
8 | * @author kndopensource
9 | */
10 | @Slf4j
11 | public class PointUtil {
12 | private static final String MSG_PATTERN = "{}|{}|{}";
13 |
14 | private PointUtil() {
15 | throw new IllegalStateException("Utility class");
16 | }
17 |
18 | /**
19 | * 格式为:{时间}|{来源}|{对象id}|{类型}|{对象属性(以&分割)}
20 | * 例子1:2016-07-27 23:37:23|business-center|1|user-login|ip=xxx.xxx.xx&userName=张三&userType=后台管理员
21 | * 例子2:2016-07-27 23:37:23|file-center|c0a895e114526786450161001d1ed9|file-upload|fileName=xxx&filePath=xxx
22 | *
23 | * @param id 对象id
24 | * @param type 类型
25 | * @param message 对象属性
26 | */
27 | public static void info(String id, String type, String message) {
28 | log.info(MSG_PATTERN, id, type, message);
29 | }
30 |
31 | public static void debug(String id, String type, String message) {
32 | log.debug(MSG_PATTERN, id, type, message);
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/knd-commons/knd-log-springboot-starter/src/main/java/com/kernel/log/properties/AuditLogProperties.java:
--------------------------------------------------------------------------------
1 | package com.kernel.log.properties;
2 |
3 | import lombok.Getter;
4 | import lombok.Setter;
5 | import org.springframework.boot.context.properties.ConfigurationProperties;
6 | import org.springframework.cloud.context.config.annotation.RefreshScope;
7 |
8 | /**
9 | * 审计日志配置
10 | *
11 | * @author kndopensource
12 | * @date 2020/20/3
13 | *
14 | *
15 | */
16 | @Setter
17 | @Getter
18 | @ConfigurationProperties(prefix = "kernel.audit-log")
19 | @RefreshScope
20 | public class AuditLogProperties {
21 | /**
22 | * 是否开启审计日志
23 | */
24 | private Boolean enabled = false;
25 | /**
26 | * 日志记录类型(logger/redis/db/es)
27 | */
28 | private String logType;
29 | }
30 |
--------------------------------------------------------------------------------
/knd-commons/knd-log-springboot-starter/src/main/java/com/kernel/log/properties/LogDbProperties.java:
--------------------------------------------------------------------------------
1 | package com.kernel.log.properties;
2 |
3 | import com.zaxxer.hikari.HikariConfig;
4 | import lombok.Getter;
5 | import lombok.Setter;
6 | import org.springframework.boot.context.properties.ConfigurationProperties;
7 |
8 | /**
9 | * 日志数据源配置
10 | * logType=db时生效(非必须),如果不配置则使用当前数据源
11 | *
12 | * @author kndopensource
13 | * @date 2020/20/8
14 | *
15 | */
16 | @Setter
17 | @Getter
18 | @ConfigurationProperties(prefix = "kernel.audit-log.datasource")
19 | public class LogDbProperties extends HikariConfig {
20 | }
21 |
--------------------------------------------------------------------------------
/knd-commons/knd-log-springboot-starter/src/main/java/com/kernel/log/properties/TraceProperties.java:
--------------------------------------------------------------------------------
1 | package com.kernel.log.properties;
2 |
3 | import lombok.Getter;
4 | import lombok.Setter;
5 | import org.springframework.boot.context.properties.ConfigurationProperties;
6 | import org.springframework.cloud.context.config.annotation.RefreshScope;
7 |
8 | /**
9 | * 日志链路追踪配置
10 | *
11 | * @author kndopensource
12 | * @date 2020/20/3
13 | */
14 | @Setter
15 | @Getter
16 | @ConfigurationProperties(prefix = "kernel.trace")
17 | @RefreshScope
18 | public class TraceProperties {
19 | /**
20 | * 是否开启日志链路追踪
21 | */
22 | private Boolean enable = false;
23 | }
24 |
--------------------------------------------------------------------------------
/knd-commons/knd-log-springboot-starter/src/main/java/com/kernel/log/service/IAuditService.java:
--------------------------------------------------------------------------------
1 | package com.kernel.log.service;
2 |
3 | import com.kernel.log.model.Audit;
4 |
5 | /**
6 | * 审计日志接口
7 | *
8 | * @author kndopensource
9 | * @date 2020/20/3
10 | *
11 | */
12 | public interface IAuditService {
13 | void save(Audit audit);
14 | }
15 |
--------------------------------------------------------------------------------
/knd-commons/knd-log-springboot-starter/src/main/resources/META-INF/spring.factories:
--------------------------------------------------------------------------------
1 | org.springframework.context.ApplicationContextInitializer=\
2 | com.kernel.log.config.TtlMDCAdapterInitializer
3 |
4 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
5 | com.kernel.log.config.LogAutoConfigure,\
6 | com.kernel.log.service.impl.LoggerAuditServiceImpl,\
7 | com.kernel.log.service.impl.DbAuditServiceImpl,\
8 | com.kernel.log.aspect.AuditLogAspect
9 |
--------------------------------------------------------------------------------
/knd-commons/knd-redis-springboot-starter/src/main/java/com/kernel/common/redis/constant/RedisToolsConstant.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.redis.constant;
2 |
3 | /**
4 | * redis 工具常量
5 | *
6 | * @author kndopensource
7 | * @date 2020/3/21 11:59
8 | */
9 | public class RedisToolsConstant {
10 | private RedisToolsConstant() {
11 | throw new IllegalStateException("Utility class");
12 | }
13 | /**
14 | * single Redis
15 | */
16 | public final static int SINGLE = 1 ;
17 |
18 | /**
19 | * Redis cluster
20 | */
21 | public final static int CLUSTER = 2 ;
22 | }
23 |
--------------------------------------------------------------------------------
/knd-commons/knd-redis-springboot-starter/src/main/java/com/kernel/common/redis/properties/CacheManagerProperties.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.redis.properties;
2 |
3 | import lombok.Getter;
4 | import lombok.Setter;
5 | import org.springframework.boot.context.properties.ConfigurationProperties;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * @author kndopensource
11 | * @date 2020/3/21
12 | */
13 | @Setter
14 | @Getter
15 | @ConfigurationProperties(prefix = "kernel.cache-manager")
16 | public class CacheManagerProperties {
17 | private List configs;
18 |
19 | @Setter
20 | @Getter
21 | public static class CacheConfig {
22 | /**
23 | * cache key
24 | */
25 | private String key;
26 | /**
27 | * 过期时间,sec
28 | */
29 | private long second = 60;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/knd-commons/knd-redis-springboot-starter/src/main/resources/META-INF/spring.factories:
--------------------------------------------------------------------------------
1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
2 | com.kernel.common.redis.RedisAutoConfigure
3 |
--------------------------------------------------------------------------------
/knd-commons/knd-redis-springboot-starter/src/main/resources/limit.lua:
--------------------------------------------------------------------------------
1 | --lua 下标从 1 开始
2 | -- 限流 key
3 | local key = KEYS[1]
4 | -- 限流大小
5 | local limit = tonumber(ARGV[1])
6 |
7 | -- 获取当前流量大小
8 | local curentLimit = tonumber(redis.call('get', key) or "0")
9 |
10 | if curentLimit + 1 > limit then
11 | -- 达到限流大小 返回
12 | return 0;
13 | else
14 | -- 没有达到阈值 value + 1
15 | redis.call("INCRBY", key, 1)
16 | redis.call("EXPIRE", key, 2)
17 | return curentLimit + 1
18 | end
19 |
20 |
--------------------------------------------------------------------------------
/knd-commons/knd-ribbon-springboot-starter/src/main/java/com/kernel/common/ribbon/FeignAutoConfigure.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.ribbon;
2 |
3 | import feign.Logger;
4 | import org.springframework.context.annotation.Bean;
5 |
6 | /**
7 | * Feign统一配置
8 | *
9 | * @author kndopensource
10 | * @date 2020/3/21
11 | */
12 | public class FeignAutoConfigure {
13 |
14 | /**
15 | * Feign 日志级别
16 | */
17 | @Bean
18 | Logger.Level feignLoggerLevel() {
19 | return Logger.Level.FULL;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/knd-commons/knd-ribbon-springboot-starter/src/main/java/com/kernel/common/ribbon/LbIsolationAutoConfigure.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.ribbon;
2 |
3 | import com.kernel.common.constant.ConfigConstants;
4 | import com.kernel.common.ribbon.config.RuleConfigure;
5 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
6 | import org.springframework.cloud.netflix.ribbon.RibbonClients;
7 |
8 | /**
9 | * Ribbon扩展配置类
10 | *
11 | * @author kndopensource
12 | * @date 2020/3/21
13 | */
14 | @ConditionalOnProperty(value = ConfigConstants.CONFIG_RIBBON_ISOLATION_ENABLED, havingValue = "true")
15 | @RibbonClients(defaultConfiguration = {RuleConfigure.class})
16 | public class LbIsolationAutoConfigure {
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/knd-commons/knd-ribbon-springboot-starter/src/main/java/com/kernel/common/ribbon/RibbonAutoConfigure.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.ribbon;
2 |
3 | import com.kernel.common.ribbon.config.RestTemplateProperties;
4 | import org.springframework.boot.context.properties.EnableConfigurationProperties;
5 | import org.springframework.cloud.netflix.ribbon.DefaultPropertiesFactory;
6 | import org.springframework.context.annotation.Bean;
7 |
8 | /**
9 | * Ribbon扩展配置类
10 | *
11 | * @author kndopensource
12 | * @date 2020/3/21
13 | */
14 | @EnableConfigurationProperties(RestTemplateProperties.class)
15 | public class RibbonAutoConfigure {
16 | @Bean
17 | public DefaultPropertiesFactory defaultPropertiesFactory() {
18 | return new DefaultPropertiesFactory();
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/knd-commons/knd-ribbon-springboot-starter/src/main/java/com/kernel/common/ribbon/annotation/EnableBaseFeignInterceptor.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.ribbon.annotation;
2 |
3 | import com.kernel.common.ribbon.config.FeignInterceptorConfig;
4 | import org.springframework.context.annotation.Import;
5 |
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 | * 开启feign拦截器传递数据给下游服务,只包含基础数据
13 | *
14 | * @author kndopensource
15 | * @date 2020/3/21
16 | *
17 | */
18 | @Target(ElementType.TYPE)
19 | @Retention(RetentionPolicy.RUNTIME)
20 | @Import(FeignInterceptorConfig.class)
21 | public @interface EnableBaseFeignInterceptor {
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/knd-commons/knd-ribbon-springboot-starter/src/main/java/com/kernel/common/ribbon/annotation/EnableFeignInterceptor.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.ribbon.annotation;
2 |
3 | import com.kernel.common.ribbon.config.FeignHttpInterceptorConfig;
4 | import com.kernel.common.ribbon.config.FeignInterceptorConfig;
5 | import org.springframework.context.annotation.Import;
6 |
7 | import java.lang.annotation.ElementType;
8 | import java.lang.annotation.Retention;
9 | import java.lang.annotation.RetentionPolicy;
10 | import java.lang.annotation.Target;
11 |
12 | /**
13 | * 开启feign拦截器传递数据给下游服务,包含基础数据和http的相关数据
14 | *
15 | * @author kndopensource
16 | * @date 2020/3/21
17 | */
18 | @Target(ElementType.TYPE)
19 | @Retention(RetentionPolicy.RUNTIME)
20 | @Import({FeignInterceptorConfig.class, FeignHttpInterceptorConfig.class})
21 | public @interface EnableFeignInterceptor {
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/knd-commons/knd-ribbon-springboot-starter/src/main/java/com/kernel/common/ribbon/config/RestTemplateProperties.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.ribbon.config;
2 |
3 | import lombok.Getter;
4 | import lombok.Setter;
5 | import org.springframework.boot.context.properties.ConfigurationProperties;
6 |
7 | /**
8 | * RestTemplate 配置
9 | *
10 | * @author kndopensource
11 | * @date 2020/3/21
12 | */
13 | @Setter
14 | @Getter
15 | @ConfigurationProperties(prefix = "kernel.rest-template")
16 | public class RestTemplateProperties {
17 | /**
18 | * 最大链接数
19 | */
20 | private int maxTotal = 200;
21 | /**
22 | * 同路由最大并发数
23 | */
24 | private int maxPerRoute = 50;
25 | /**
26 | * 读取超时时间 ms
27 | */
28 | private int readTimeout = 35000;
29 | /**
30 | * 链接超时时间 ms
31 | */
32 | private int connectTimeout = 10000;
33 | }
34 |
--------------------------------------------------------------------------------
/knd-commons/knd-ribbon-springboot-starter/src/main/java/com/kernel/common/ribbon/config/RuleConfigure.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.ribbon.config;
2 |
3 | import com.kernel.common.ribbon.rule.CustomIsolationRule;
4 | import com.netflix.loadbalancer.IRule;
5 | import org.springframework.context.annotation.Bean;
6 |
7 | /**
8 | * @author kndopensource
9 | * @date 2020/3/21
10 | */
11 | public class RuleConfigure {
12 | @Bean
13 | public IRule isolationRule() {
14 | return new CustomIsolationRule();
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/knd-commons/knd-ribbon-springboot-starter/src/main/resources/META-INF/spring.factories:
--------------------------------------------------------------------------------
1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
2 | com.kernel.common.ribbon.RibbonAutoConfigure,\
3 | com.kernel.common.ribbon.FeignAutoConfigure,\
4 | com.kernel.common.ribbon.RestTemplateAutoConfigure,\
5 | com.kernel.common.ribbon.filter.LbIsolationFilter,\
6 | com.kernel.common.ribbon.LbIsolationAutoConfigure
7 |
--------------------------------------------------------------------------------
/knd-commons/knd-sentinel-springboot-starter/src/main/resources/META-INF/spring.factories:
--------------------------------------------------------------------------------
1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
2 | com.kernel.sentinel.config.SentinelAutoConfigure
3 |
--------------------------------------------------------------------------------
/knd-commons/knd-swagger2-springboot-starter/src/main/java/com/kernel/common/swagger2/Swagger2Configuration.java:
--------------------------------------------------------------------------------
1 | package com.kernel.common.swagger2;
2 |
3 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
4 | import org.springframework.context.annotation.Configuration;
5 | import org.springframework.context.annotation.Import;
6 | import springfox.documentation.swagger2.configuration.Swagger2DocumentationConfiguration;
7 |
8 | /**
9 | *
10 | * @author knd
11 | * @date 2020/3/21
12 | */
13 | @Configuration
14 | @ConditionalOnProperty(name = "knd.swagger.enabled", matchIfMissing = true)
15 | @Import({
16 | Swagger2DocumentationConfiguration.class
17 | })
18 | public class Swagger2Configuration {
19 | }
20 |
--------------------------------------------------------------------------------
/knd-commons/knd-swagger2-springboot-starter/src/main/resources/META-INF/spring.factories:
--------------------------------------------------------------------------------
1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
2 | com.kernel.common.swagger2.SwaggerAutoConfiguration
--------------------------------------------------------------------------------
/knd-commons/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | knd-platform
7 | com.knd
8 | 1.0.0-SNAPSHOT
9 |
10 | 4.0.0
11 | knd-commons
12 | 通用基础组件集
13 | pom
14 | ${project.artifactId}
15 |
16 | knd-common-core
17 | knd-log-springboot-starter
18 | knd-common-springboot-starter
19 | knd-db-springboot-starter
20 | knd-redis-springboot-starter
21 | knd-ribbon-springboot-starter
22 | knd-sentinel-springboot-starter
23 | knd-swagger2-springboot-starter
24 | knd-authclient-springboot-starter
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/knd-demo/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | knd-platform
7 | com.knd
8 | 1.0.0-SNAPSHOT
9 |
10 | 4.0.0
11 | demo案例集
12 | knd-demo
13 | pom
14 | ${project.artifactId}
15 |
16 |
--------------------------------------------------------------------------------
/knd-micro/micro-auth2/src/main/java/com/kernel/UaaServerApp.java:
--------------------------------------------------------------------------------
1 | package com.kernel;
2 |
3 | import com.kernel.common.ribbon.annotation.EnableFeignInterceptor;
4 | import org.springframework.boot.SpringApplication;
5 | import org.springframework.boot.autoconfigure.SpringBootApplication;
6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
7 | import org.springframework.cloud.openfeign.EnableFeignClients;
8 | import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
9 |
10 | /**
11 | * @author knd
12 | */
13 | @EnableFeignClients
14 | @EnableFeignInterceptor
15 | @EnableDiscoveryClient
16 | @EnableRedisHttpSession
17 | @SpringBootApplication
18 | public class UaaServerApp {
19 | public static void main(String[] args) {
20 | SpringApplication.run(UaaServerApp.class, args);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/knd-micro/micro-auth2/src/main/java/com/kernel/oauth/config/MybatisPlusConfig.java:
--------------------------------------------------------------------------------
1 | package com.kernel.oauth.config;
2 |
3 | import com.kernel.db.config.DefaultMybatisPlusConfig;
4 | import org.mybatis.spring.annotation.MapperScan;
5 | import org.springframework.context.annotation.Configuration;
6 |
7 | /**
8 | * @author knd
9 | * @date 2018/12/10
10 | */
11 | @Configuration
12 | @MapperScan({"com.kernel.oauth.mapper*"})
13 | public class MybatisPlusConfig extends DefaultMybatisPlusConfig {
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/knd-micro/micro-auth2/src/main/java/com/kernel/oauth/config/ValidateCodeSecurityConfig.java:
--------------------------------------------------------------------------------
1 | /**
2 | *
3 | */
4 | package com.kernel.oauth.config;
5 |
6 | import org.springframework.security.config.annotation.SecurityConfigurerAdapter;
7 | import org.springframework.security.config.annotation.web.builders.HttpSecurity;
8 | import org.springframework.security.web.DefaultSecurityFilterChain;
9 | import org.springframework.security.web.authentication.preauth.AbstractPreAuthenticatedProcessingFilter;
10 | import org.springframework.stereotype.Component;
11 |
12 | import javax.annotation.Resource;
13 | import javax.servlet.Filter;
14 |
15 | /**
16 | * 校验码相关安全配置
17 | *
18 | * @author knd
19 | */
20 | @Component("validateCodeSecurityConfig")
21 | public class ValidateCodeSecurityConfig extends SecurityConfigurerAdapter {
22 | @Resource
23 | private Filter validateCodeFilter;
24 |
25 | @Override
26 | public void configure(HttpSecurity http) {
27 | http.addFilterBefore(validateCodeFilter, AbstractPreAuthenticatedProcessingFilter.class);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/knd-micro/micro-auth2/src/main/java/com/kernel/oauth/config/WebMvcConfig.java:
--------------------------------------------------------------------------------
1 | package com.kernel.oauth.config;
2 |
3 | import com.kernel.common.config.DefaultWebMvcConfig;
4 | import org.springframework.context.annotation.Configuration;
5 |
6 | /**
7 | * @author knd
8 | * @date 2019/8/5
9 | */
10 | @Configuration
11 | public class WebMvcConfig extends DefaultWebMvcConfig {
12 | }
13 |
--------------------------------------------------------------------------------
/knd-micro/micro-auth2/src/main/java/com/kernel/oauth/controller/TokensController.java:
--------------------------------------------------------------------------------
1 | package com.kernel.oauth.controller;
2 |
3 | import com.kernel.common.annotation.LoginClient;
4 | import com.kernel.common.model.PageResult;
5 | import com.kernel.oauth.model.TokenVo;
6 | import com.kernel.oauth.service.ITokensService;
7 | import io.swagger.annotations.Api;
8 | import io.swagger.annotations.ApiOperation;
9 | import org.springframework.beans.factory.annotation.Autowired;
10 | import org.springframework.web.bind.annotation.*;
11 |
12 | import java.util.Map;
13 |
14 | /**
15 | * token管理接口
16 | *
17 | * @author knd
18 | */
19 | @Api(tags = "Token管理")
20 | @RestController
21 | @RequestMapping("/tokens")
22 | public class TokensController {
23 | @Autowired
24 | private ITokensService tokensService;
25 |
26 | @GetMapping("")
27 | @ApiOperation(value = "token列表")
28 | public PageResult list(@RequestParam Map params, String tenantId) {
29 | return tokensService.listTokens(params, tenantId);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/knd-micro/micro-auth2/src/main/java/com/kernel/oauth/dto/ClientDto.java:
--------------------------------------------------------------------------------
1 | package com.kernel.oauth.dto;
2 |
3 | import com.kernel.oauth.model.Client;
4 | import lombok.Getter;
5 | import lombok.Setter;
6 |
7 | import java.util.List;
8 | import java.util.Set;
9 |
10 | @Setter
11 | @Getter
12 | public class ClientDto extends Client {
13 | private static final long serialVersionUID = 1475637288060027265L;
14 |
15 | private List permissionIds;
16 |
17 | private Set serviceIds;
18 | }
19 |
--------------------------------------------------------------------------------
/knd-micro/micro-auth2/src/main/java/com/kernel/oauth/exception/ValidateCodeException.java:
--------------------------------------------------------------------------------
1 | package com.kernel.oauth.exception;
2 |
3 | import org.springframework.security.core.AuthenticationException;
4 |
5 | /**
6 | * 验证码异常
7 | * @author knd
8 | */
9 | public class ValidateCodeException extends AuthenticationException {
10 | private static final long serialVersionUID = -7285211528095468156L;
11 |
12 | public ValidateCodeException(String msg) {
13 | super(msg);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/knd-micro/micro-auth2/src/main/java/com/kernel/oauth/mapper/ClientMapper.java:
--------------------------------------------------------------------------------
1 | package com.kernel.oauth.mapper;
2 |
3 | import java.util.List;
4 | import java.util.Map;
5 |
6 | import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
7 | import com.kernel.db.mapper.SuperMapper;
8 | import org.apache.ibatis.annotations.Param;
9 |
10 | import com.kernel.oauth.model.Client;
11 |
12 | /**
13 | * @author knd
14 | */
15 | public interface ClientMapper extends SuperMapper {
16 | List findList(Page page, @Param("params") Map params );
17 | }
18 |
--------------------------------------------------------------------------------
/knd-micro/micro-auth2/src/main/java/com/kernel/oauth/model/TokenVo.java:
--------------------------------------------------------------------------------
1 | package com.kernel.oauth.model;
2 |
3 | import lombok.Getter;
4 | import lombok.Setter;
5 |
6 | import java.io.Serializable;
7 | import java.util.Date;
8 |
9 | /**
10 | * @author knd
11 | */
12 | @Setter
13 | @Getter
14 | public class TokenVo implements Serializable {
15 | private static final long serialVersionUID = -6656955957477645319L;
16 | /**
17 | * token的值
18 | */
19 | private String tokenValue;
20 | /**
21 | * 到期时间
22 | */
23 | private Date expiration;
24 | /**
25 | * 用户名
26 | */
27 | private String username;
28 | /**
29 | * 所属应用
30 | */
31 | private String clientId;
32 | /**
33 | * 授权类型
34 | */
35 | private String grantType;
36 | }
37 |
--------------------------------------------------------------------------------
/knd-micro/micro-auth2/src/main/java/com/kernel/oauth/openid/OpenIdAuthenticationSecurityConfig.java:
--------------------------------------------------------------------------------
1 | package com.kernel.oauth.openid;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 | import org.springframework.security.config.annotation.SecurityConfigurerAdapter;
5 | import org.springframework.security.config.annotation.web.builders.HttpSecurity;
6 | import org.springframework.security.web.DefaultSecurityFilterChain;
7 | import org.springframework.social.security.SocialUserDetailsService;
8 | import org.springframework.stereotype.Component;
9 |
10 | /**
11 | * openId的相关处理配置
12 | *
13 | * @author knd
14 | */
15 | @Component
16 | public class OpenIdAuthenticationSecurityConfig extends SecurityConfigurerAdapter {
17 | @Autowired
18 | private SocialUserDetailsService userDetailsService;
19 |
20 | @Override
21 | public void configure(HttpSecurity http) {
22 | //openId provider
23 | OpenIdAuthenticationProvider provider = new OpenIdAuthenticationProvider();
24 | provider.setUserDetailsService(userDetailsService);
25 | http.authenticationProvider(provider);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/knd-micro/micro-auth2/src/main/java/com/kernel/oauth/service/IClientService.java:
--------------------------------------------------------------------------------
1 | package com.kernel.oauth.service;
2 |
3 | import com.kernel.common.model.PageResult;
4 | import com.kernel.common.model.Result;
5 | import com.kernel.common.service.ISuperService;
6 | import com.kernel.oauth.model.Client;
7 |
8 | import java.util.Map;
9 |
10 | /**
11 | * @author knd
12 | */
13 | public interface IClientService extends ISuperService {
14 | Result saveClient(Client clientDto);
15 |
16 | /**
17 | * 查询应用列表
18 | * @param params
19 | * @param isPage 是否分页
20 | */
21 | PageResult listClent(Map params, boolean isPage);
22 |
23 | void delClient(long id);
24 | }
25 |
--------------------------------------------------------------------------------
/knd-micro/micro-auth2/src/main/java/com/kernel/oauth/service/ITokensService.java:
--------------------------------------------------------------------------------
1 | package com.kernel.oauth.service;
2 |
3 | import com.kernel.common.model.PageResult;
4 | import com.kernel.oauth.model.TokenVo;
5 |
6 | import java.util.Map;
7 |
8 | /**
9 | * @author knd
10 | */
11 | public interface ITokensService {
12 | /**
13 | * 查询token列表
14 | * @param params 请求参数
15 | * @param clientId 应用id
16 | */
17 | PageResult listTokens(Map params, String clientId);
18 | }
19 |
--------------------------------------------------------------------------------
/knd-micro/micro-auth2/src/main/java/com/kernel/oauth/service/IValidateCodeService.java:
--------------------------------------------------------------------------------
1 | package com.kernel.oauth.service;
2 |
3 | import com.kernel.common.model.Result;
4 |
5 | import javax.servlet.http.HttpServletRequest;
6 |
7 | /**
8 | * @author knd
9 | * @date 2018/12/10
10 | */
11 | public interface IValidateCodeService {
12 | /**
13 | * 保存图形验证码
14 | * @param deviceId 前端唯一标识
15 | * @param imageCode 验证码
16 | */
17 | void saveImageCode(String deviceId, String imageCode);
18 |
19 | Result sendSmsCode(String mobile);
20 |
21 | /**
22 | * 获取验证码
23 | * @param deviceId 前端唯一标识/手机号
24 | */
25 | String getCode(String deviceId);
26 |
27 | /**
28 | * 删除验证码
29 | * @param deviceId 前端唯一标识/手机号
30 | */
31 | void remove(String deviceId);
32 |
33 | /**
34 | * 验证验证码
35 | */
36 | void validate(HttpServletRequest request);
37 | }
38 |
--------------------------------------------------------------------------------
/knd-micro/micro-auth2/src/main/java/com/kernel/oauth/service/KndUserDetailsService.java:
--------------------------------------------------------------------------------
1 | package com.kernel.oauth.service;
2 |
3 | import org.springframework.security.core.userdetails.UserDetails;
4 | import org.springframework.security.core.userdetails.UserDetailsService;
5 | import org.springframework.security.core.userdetails.UsernameNotFoundException;
6 |
7 | /**
8 | * @author knd
9 | * @date 2018/12/28
10 | */
11 | public interface KndUserDetailsService extends UserDetailsService {
12 | /**
13 | * 根据电话号码查询用户
14 | *
15 | * @param mobile
16 | * @return
17 | */
18 | UserDetails loadUserByMobile(String mobile);
19 | }
20 |
--------------------------------------------------------------------------------
/knd-micro/micro-auth2/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | datasource:
3 | url: jdbc:mysql://${knd.datasource.ip}:3306/oauth-center?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true&useSSL=false&zeroDateTimeBehavior=convertToNull&serverTimezone=Asia/Shanghai
4 | username: ${knd.datasource.username}
5 | password: ${knd.datasource.password}
6 | driver-class-name: com.mysql.cj.jdbc.Driver
7 |
8 | mybatis-plus:
9 | mapper-locations: classpath:/mapper/*Mapper.xml
10 | #实体扫描,多个package用逗号或者分号分隔
11 | typeAliasesPackage: com.kernel.oauth.model
12 | global-config:
13 | db-config:
14 | id-type: auto
15 |
16 | knd:
17 | oauth2:
18 | token:
19 | store:
20 | type: redis
21 | swagger:
22 | enabled: true
23 | title: 认证中心
24 | description: 认证中心接口文档
25 | version: 1.0
26 | base-package: com.kernel.oauth.controller
27 | security:
28 | code:
29 | # 忽略验证码的应用编号
30 | ignoreClientCode: app
--------------------------------------------------------------------------------
/knd-micro/micro-auth2/src/main/resources/bootstrap.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 8000
3 | servlet:
4 | session:
5 | cookie:
6 | name: OAUTH2SESSION
7 |
8 | spring:
9 | application:
10 | name: uaa-server
11 |
12 | encrypt:
13 | key-store:
14 | location: classpath:knd.jks
15 | secret: knd!@#$
16 | alias: knd
--------------------------------------------------------------------------------
/knd-micro/micro-auth2/src/main/resources/knd.jks:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kndopensource/knd-platform/f8121bb82b813943f4509809d28d2e4c7fbe22ac/knd-micro/micro-auth2/src/main/resources/knd.jks
--------------------------------------------------------------------------------
/knd-micro/micro-auth2/src/main/resources/pubkey.txt:
--------------------------------------------------------------------------------
1 | -----BEGIN PUBLIC KEY-----
2 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjmgfejBXsPYynAIPczHA
3 | eEvTDfAVaNKQudyI7VszdezbHDM1CStCIgwiMmLd7QYf1SrrmQoqxhcSRbhjE3ej
4 | RF5qzhtx3kmepdpMrQptcsLjRkixaxCc4E2k6Us5707gGwbhoaTrRit5F2MnAdLY
5 | C1TS3WwnO/hQfqUcAglbK8yrJ4AwAv0DAoIUSWnWqzuniV1SYbdV57uswxUssoWy
6 | sEfPz+nv1ZLRs6Wz4eQ5Myqx2+CjWc9F8iXa2PV8Rmjms3dVbWcLUpCP18Dfzp8l
7 | n8vF9LfYB7UaLSpfJe6FFF6+vCg4JHfo12djTUgwGjauMF3e9mmjU83KIoQS66lp
8 | AQIDAQAB
9 | -----END PUBLIC KEY-----
--------------------------------------------------------------------------------
/knd-micro/micro-auth2/src/main/resources/static/images/cut.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kndopensource/knd-platform/f8121bb82b813943f4509809d28d2e4c7fbe22ac/knd-micro/micro-auth2/src/main/resources/static/images/cut.jpg
--------------------------------------------------------------------------------
/knd-micro/micro-auth2/src/main/resources/static/images/logo_bg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kndopensource/knd-platform/f8121bb82b813943f4509809d28d2e4c7fbe22ac/knd-micro/micro-auth2/src/main/resources/static/images/logo_bg.jpg
--------------------------------------------------------------------------------
/knd-micro/micro-auth2/src/main/resources/static/images/logowz.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kndopensource/knd-platform/f8121bb82b813943f4509809d28d2e4c7fbe22ac/knd-micro/micro-auth2/src/main/resources/static/images/logowz.png
--------------------------------------------------------------------------------
/knd-micro/micro-auth2/src/main/resources/static/js/common.js:
--------------------------------------------------------------------------------
1 | $(function(){
2 |
3 | //
4 | $('.form_text_ipt input').focus(function(){
5 | $(this).parent().css({
6 | 'box-shadow':'0 0 3px #bbb',
7 | });
8 | });
9 | $('.form_text_ipt input').blur(function(){
10 | $(this).parent().css({
11 | 'box-shadow':'none',
12 | });
13 | //$(this).parent().next().hide();
14 | });
15 |
16 | //
17 | $('.form_text_ipt input').bind('input propertychange',function(){
18 | if($(this).val()==""){
19 | $(this).css({
20 | 'color':'red',
21 | });
22 | $(this).parent().css({
23 | 'border':'solid 1px red',
24 | });
25 | //$(this).parent().next().find('span').html('helow');
26 | $(this).parent().next().show();
27 | }else{
28 | $(this).css({
29 | 'color':'#ccc',
30 | });
31 | $(this).parent().css({
32 | 'border':'solid 1px #ccc',
33 | });
34 | $(this).parent().next().hide();
35 | }
36 | });
37 | });
--------------------------------------------------------------------------------
/knd-micro/micro-gateway/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 | knd-micro
7 | com.knd
8 | 1.0.0-SNAPSHOT
9 |
10 | 4.0.0
11 | 网关服务组件集
12 | micro-gateway
13 | pom
14 | ${project.artifactId}
15 |
16 |
17 | scloud-gateway
18 | zuul-gateway
19 |
20 |
--------------------------------------------------------------------------------
/knd-micro/micro-gateway/scloud-gateway/src/main/java/com/kernel/SCGatewayApp.java:
--------------------------------------------------------------------------------
1 | package com.kernel;
2 |
3 | import com.kernel.common.ribbon.annotation.EnableBaseFeignInterceptor;
4 | import org.springframework.boot.SpringApplication;
5 | import org.springframework.boot.autoconfigure.SpringBootApplication;
6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
7 | import org.springframework.cloud.openfeign.EnableFeignClients;
8 |
9 | /**
10 | * 网关服务启动类
11 | * @author kndopnesource
12 | * @date 2020/3/22
13 | */
14 | @EnableFeignClients
15 | @EnableBaseFeignInterceptor
16 | @EnableDiscoveryClient
17 | @SpringBootApplication
18 | public class SCGatewayApp {
19 | public static void main(String[] args) {
20 | SpringApplication.run(SCGatewayApp.class, args);
21 | }
22 | }
--------------------------------------------------------------------------------
/knd-micro/micro-gateway/scloud-gateway/src/main/java/com/kernel/gateway/auth/JsonAccessDeniedHandler.java:
--------------------------------------------------------------------------------
1 | package com.kernel.gateway.auth;
2 |
3 | import com.kernel.common.utils.ResponseUtil;
4 | import lombok.extern.slf4j.Slf4j;
5 | import org.springframework.http.HttpStatus;
6 | import org.springframework.security.access.AccessDeniedException;
7 | import org.springframework.security.web.server.authorization.ServerAccessDeniedHandler;
8 | import org.springframework.web.server.ServerWebExchange;
9 | import reactor.core.publisher.Mono;
10 |
11 | /**
12 | * 403拒绝访问异常处理,转换为JSON
13 | *
14 | * @author knd
15 | * @date 2020/3/22
16 | */
17 | @Slf4j
18 | public class JsonAccessDeniedHandler implements ServerAccessDeniedHandler {
19 | @Override
20 | public Mono handle(ServerWebExchange exchange, AccessDeniedException e) {
21 | return ResponseUtil.responseWriter(exchange, HttpStatus.FORBIDDEN.value(), e.getMessage());
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/knd-micro/micro-gateway/scloud-gateway/src/main/java/com/kernel/gateway/auth/JsonAuthenticationEntryPoint.java:
--------------------------------------------------------------------------------
1 | package com.kernel.gateway.auth;
2 |
3 | import com.kernel.common.utils.ResponseUtil;
4 | import lombok.extern.slf4j.Slf4j;
5 | import org.springframework.http.HttpStatus;
6 | import org.springframework.security.core.AuthenticationException;
7 | import org.springframework.security.web.server.ServerAuthenticationEntryPoint;
8 | import org.springframework.web.server.ServerWebExchange;
9 | import reactor.core.publisher.Mono;
10 |
11 | /**
12 | * 401未授权异常处理,转换为JSON
13 | *
14 | * @author knd
15 | * @date 2020/3/22
16 | */
17 | @Slf4j
18 | public class JsonAuthenticationEntryPoint implements ServerAuthenticationEntryPoint {
19 | @Override
20 | public Mono commence(ServerWebExchange exchange, AuthenticationException e) {
21 | return ResponseUtil.responseWriter(exchange, HttpStatus.UNAUTHORIZED.value(), e.getMessage());
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/knd-micro/micro-gateway/scloud-gateway/src/main/java/com/kernel/gateway/feign/MenuService.java:
--------------------------------------------------------------------------------
1 | package com.kernel.gateway.feign;
2 |
3 | import com.kernel.common.constant.ServiceNameConstants;
4 | import com.kernel.common.model.SysMenu;
5 | import com.kernel.gateway.feign.fallback.MenuServiceFallbackFactory;
6 | import org.springframework.cloud.openfeign.FeignClient;
7 | import org.springframework.web.bind.annotation.GetMapping;
8 | import org.springframework.web.bind.annotation.PathVariable;
9 |
10 | import java.util.List;
11 |
12 | /**
13 | * @author kndopensource
14 | */
15 | @FeignClient(name = ServiceNameConstants.USER_SERVICE, fallbackFactory = MenuServiceFallbackFactory.class, decode404 = true)
16 | public interface MenuService {
17 | /**
18 | * 角色菜单列表
19 | * @param roleCodes
20 | */
21 | @GetMapping(value = "/menus/{roleCodes}")
22 | List findByRoleCodes(@PathVariable("roleCodes") String roleCodes);
23 | }
24 |
--------------------------------------------------------------------------------
/knd-micro/micro-gateway/scloud-gateway/src/main/java/com/kernel/gateway/feign/fallback/MenuServiceFallbackFactory.java:
--------------------------------------------------------------------------------
1 | package com.kernel.gateway.feign.fallback;
2 |
3 | import cn.hutool.core.collection.CollectionUtil;
4 | import com.kernel.gateway.feign.MenuService;
5 | import feign.hystrix.FallbackFactory;
6 | import lombok.extern.slf4j.Slf4j;
7 | import org.springframework.stereotype.Component;
8 |
9 | /**
10 | * menuService降级工场
11 | *
12 | * @author knd
13 | * @date 2020/3/22
14 | */
15 | @Slf4j
16 | @Component
17 | public class MenuServiceFallbackFactory implements FallbackFactory {
18 | @Override
19 | public MenuService create(Throwable throwable) {
20 | return roleIds -> {
21 | log.error("调用findByRoleCodes异常:{}", roleIds, throwable);
22 | return CollectionUtil.newArrayList();
23 | };
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/knd-micro/micro-gateway/scloud-gateway/src/main/resources/bootstrap.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 9900
3 |
4 | spring:
5 | application:
6 | name: scloud-gateway
--------------------------------------------------------------------------------
/knd-micro/micro-gateway/scloud-gateway/src/main/resources/pubkey.txt:
--------------------------------------------------------------------------------
1 | -----BEGIN PUBLIC KEY-----
2 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjmgfejBXsPYynAIPczHA
3 | eEvTDfAVaNKQudyI7VszdezbHDM1CStCIgwiMmLd7QYf1SrrmQoqxhcSRbhjE3ej
4 | RF5qzhtx3kmepdpMrQptcsLjRkixaxCc4E2k6Us5707gGwbhoaTrRit5F2MnAdLY
5 | C1TS3WwnO/hQfqUcAglbK8yrJ4AwAv0DAoIUSWnWqzuniV1SYbdV57uswxUssoWy
6 | sEfPz+nv1ZLRs6Wz4eQ5Myqx2+CjWc9F8iXa2PV8Rmjms3dVbWcLUpCP18Dfzp8l
7 | n8vF9LfYB7UaLSpfJe6FFF6+vCg4JHfo12djTUgwGjauMF3e9mmjU83KIoQS66lp
8 | AQIDAQAB
9 | -----END PUBLIC KEY-----
--------------------------------------------------------------------------------
/knd-micro/micro-gateway/zuul-gateway/src/main/java/com/kernel/GatewayApp.java:
--------------------------------------------------------------------------------
1 | package com.kernel;
2 |
3 | import com.kernel.common.ribbon.annotation.EnableBaseFeignInterceptor;
4 | import org.springframework.boot.SpringApplication;
5 | import org.springframework.boot.autoconfigure.SpringBootApplication;
6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
7 | import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
8 | import org.springframework.cloud.openfeign.EnableFeignClients;
9 |
10 | /**
11 | * @author kndopensource
12 | */
13 | @EnableZuulProxy
14 | @EnableFeignClients
15 | @EnableBaseFeignInterceptor
16 | @EnableDiscoveryClient
17 | @SpringBootApplication
18 | public class GatewayApp {
19 | public static void main(String[] args) {
20 | SpringApplication.run(GatewayApp.class, args);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/knd-micro/micro-gateway/zuul-gateway/src/main/java/com/kernel/gateway/config/AsycTaskExecutorConfig.java:
--------------------------------------------------------------------------------
1 | package com.kernel.gateway.config;
2 |
3 | import com.kernel.common.config.DefaultAsycTaskConfig;
4 | import org.springframework.context.annotation.Configuration;
5 |
6 | /**
7 | * @author kndopensource
8 | * 线程池配置、启用异步
9 | * @Async quartz 需要使用
10 | */
11 | @Configuration
12 | public class AsycTaskExecutorConfig extends DefaultAsycTaskConfig {
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/knd-micro/micro-gateway/zuul-gateway/src/main/java/com/kernel/gateway/config/ResourceServerConfiguration.java:
--------------------------------------------------------------------------------
1 | package com.kernel.gateway.config;
2 |
3 | import com.kernel.common.config.DefaultPasswordConfig;
4 | import com.kernel.oauth2.common.config.DefaultResourceServerConf;
5 | import org.springframework.context.annotation.Configuration;
6 | import org.springframework.context.annotation.Import;
7 | import org.springframework.security.config.annotation.web.builders.HttpSecurity;
8 | import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer;
9 | import org.springframework.security.oauth2.config.annotation.web.configuration.EnableResourceServer;
10 |
11 | /**
12 | * @author kndopensource
13 | */
14 | @Configuration
15 | @EnableResourceServer
16 | @Import({DefaultPasswordConfig.class})
17 | public class ResourceServerConfiguration extends DefaultResourceServerConf {
18 | @Override
19 | public HttpSecurity setAuthenticate(ExpressionUrlAuthorizationConfigurer.AuthorizedUrl authorizedUrl) {
20 | return authorizedUrl.access("@permissionService.hasPermission(request, authentication)").and();
21 | }
22 | }
--------------------------------------------------------------------------------
/knd-micro/micro-gateway/zuul-gateway/src/main/java/com/kernel/gateway/config/SwaggerConfig.java:
--------------------------------------------------------------------------------
1 | package com.kernel.gateway.config;
2 |
3 | import com.didispace.swagger.butler.EnableSwaggerButler;
4 | import org.springframework.context.annotation.Configuration;
5 |
6 | /**
7 | * swagger 聚合文档配置
8 | * zuul routers 映射具体服务的/v2/api-docs swagger
9 | *
10 | * @author 作者 owen E-mail: 624191343@qq.com
11 | */
12 | @Configuration
13 | @EnableSwaggerButler
14 | public class SwaggerConfig {
15 |
16 | }
--------------------------------------------------------------------------------
/knd-micro/micro-gateway/zuul-gateway/src/main/java/com/kernel/gateway/feign/MenuService.java:
--------------------------------------------------------------------------------
1 | package com.kernel.gateway.feign;
2 |
3 | import com.kernel.common.constant.ServiceNameConstants;
4 | import com.kernel.common.model.SysMenu;
5 | import com.kernel.gateway.feign.fallback.MenuServiceFallbackFactory;
6 | import org.springframework.cloud.openfeign.FeignClient;
7 | import org.springframework.web.bind.annotation.GetMapping;
8 | import org.springframework.web.bind.annotation.PathVariable;
9 |
10 | import java.util.List;
11 |
12 | /**
13 | * @author kndopensource
14 | */
15 | @FeignClient(name = ServiceNameConstants.USER_SERVICE, fallbackFactory = MenuServiceFallbackFactory.class, decode404 = true)
16 | public interface MenuService {
17 | /**
18 | * 角色菜单列表
19 | * @param roleCodes
20 | */
21 | @GetMapping(value = "/menus/{roleCodes}")
22 | List findByRoleCodes(@PathVariable("roleCodes") String roleCodes);
23 | }
24 |
--------------------------------------------------------------------------------
/knd-micro/micro-gateway/zuul-gateway/src/main/java/com/kernel/gateway/feign/fallback/MenuServiceFallbackFactory.java:
--------------------------------------------------------------------------------
1 | package com.kernel.gateway.feign.fallback;
2 |
3 | import cn.hutool.core.collection.CollectionUtil;
4 | import com.kernel.gateway.feign.MenuService;
5 | import feign.hystrix.FallbackFactory;
6 | import lombok.extern.slf4j.Slf4j;
7 | import org.springframework.stereotype.Component;
8 |
9 | /**
10 | * menuService降级工场
11 | *
12 | * @author kndopensource
13 | * @date 2019/1/18
14 | */
15 | @Slf4j
16 | @Component
17 | public class MenuServiceFallbackFactory implements FallbackFactory {
18 | @Override
19 | public MenuService create(Throwable throwable) {
20 | return roleIds -> {
21 | log.error("调用findByRoleCodes异常:{}", roleIds, throwable);
22 | return CollectionUtil.newArrayList();
23 | };
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/knd-micro/micro-gateway/zuul-gateway/src/main/java/com/kernel/gateway/service/impl/PermissionServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.kernel.gateway.service.impl;
2 |
3 | import com.kernel.common.model.SysMenu;
4 | import com.kernel.gateway.feign.MenuService;
5 | import com.kernel.oauth2.common.service.impl.DefaultPermissionServiceImpl;
6 | import lombok.extern.slf4j.Slf4j;
7 | import org.springframework.security.core.Authentication;
8 | import org.springframework.stereotype.Service;
9 | import javax.annotation.Resource;
10 | import javax.servlet.http.HttpServletRequest;
11 | import java.util.List;
12 |
13 | /**
14 | * 请求权限判断service
15 | *
16 | * @author kndopensource
17 | * @date 2018/10/28
18 | */
19 | @Slf4j
20 | @Service("permissionService")
21 | public class PermissionServiceImpl extends DefaultPermissionServiceImpl {
22 | @Resource
23 | private MenuService menuService;
24 |
25 | @Override
26 | public List findMenuByRoleCodes(String roleCodes) {
27 | return menuService.findByRoleCodes(roleCodes);
28 | }
29 |
30 | public boolean hasPermission(HttpServletRequest request, Authentication authentication) {
31 | return hasPermission(authentication, request.getMethod(), request.getRequestURI());
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/knd-micro/micro-gateway/zuul-gateway/src/main/resources/META-INF/additional-spring-configuration-metadata.json:
--------------------------------------------------------------------------------
1 | {
2 | "properties": [
3 | {
4 | "name": "knd.gateway.dynamicRoute.enabled",
5 | "description": "是否开启动态路由.",
6 | "type": "java.lang.Boolean",
7 | "defaultValue": false
8 | },
9 | {
10 | "name": "knd.gateway.dynamicRoute.dataType",
11 | "description": "动态路由的数据类型.",
12 | "type": "java.lang.String",
13 | "defaultValue": "nacos"
14 | }
15 | ]
16 | }
--------------------------------------------------------------------------------
/knd-micro/micro-gateway/zuul-gateway/src/main/resources/bootstrap.yml:
--------------------------------------------------------------------------------
1 | server:
2 | port: 9900
3 | undertow:
4 | buffer-size: 1024
5 | direct-buffers: true
6 |
7 | spring:
8 | application:
9 | name: api-gateway
--------------------------------------------------------------------------------
/knd-micro/micro-gateway/zuul-gateway/src/main/resources/pubkey.txt:
--------------------------------------------------------------------------------
1 | -----BEGIN PUBLIC KEY-----
2 | MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjmgfejBXsPYynAIPczHA
3 | eEvTDfAVaNKQudyI7VszdezbHDM1CStCIgwiMmLd7QYf1SrrmQoqxhcSRbhjE3ej
4 | RF5qzhtx3kmepdpMrQptcsLjRkixaxCc4E2k6Us5707gGwbhoaTrRit5F2MnAdLY
5 | C1TS3WwnO/hQfqUcAglbK8yrJ4AwAv0DAoIUSWnWqzuniV1SYbdV57uswxUssoWy
6 | sEfPz+nv1ZLRs6Wz4eQ5Myqx2+CjWc9F8iXa2PV8Rmjms3dVbWcLUpCP18Dfzp8l
7 | n8vF9LfYB7UaLSpfJe6FFF6+vCg4JHfo12djTUgwGjauMF3e9mmjU83KIoQS66lp
8 | AQIDAQAB
9 | -----END PUBLIC KEY-----
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/java/com/xxl/job/admin/JobAdminApplication.java:
--------------------------------------------------------------------------------
1 | package com.xxl.job.admin;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | /**
7 | * @author xuxueli 2018-10-28 00:38:13
8 | */
9 | @SpringBootApplication
10 | public class JobAdminApplication {
11 |
12 | public static void main(String[] args) {
13 | SpringApplication.run(JobAdminApplication.class, args);
14 | }
15 |
16 | }
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/java/com/xxl/job/admin/controller/JobApiController.java:
--------------------------------------------------------------------------------
1 | package com.xxl.job.admin.controller;
2 |
3 | import com.xxl.job.admin.controller.annotation.PermessionLimit;
4 | import com.xxl.job.admin.core.schedule.XxlJobDynamicScheduler;
5 | import com.xxl.job.core.biz.AdminBiz;
6 | import org.springframework.beans.factory.InitializingBean;
7 | import org.springframework.stereotype.Controller;
8 | import org.springframework.web.bind.annotation.RequestMapping;
9 |
10 | import javax.servlet.ServletException;
11 | import javax.servlet.http.HttpServletRequest;
12 | import javax.servlet.http.HttpServletResponse;
13 | import java.io.IOException;
14 |
15 | /**
16 | * Created by xuxueli on 17/5/10.
17 | */
18 | @Controller
19 | public class JobApiController implements InitializingBean {
20 |
21 |
22 | @Override
23 | public void afterPropertiesSet() throws Exception {
24 |
25 | }
26 |
27 | @RequestMapping(AdminBiz.MAPPING)
28 | @PermessionLimit(limit=false)
29 | public void api(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
30 | XxlJobDynamicScheduler.invokeAdminService(request, response);
31 | }
32 |
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/java/com/xxl/job/admin/controller/annotation/PermessionLimit.java:
--------------------------------------------------------------------------------
1 | package com.xxl.job.admin.controller.annotation;
2 |
3 |
4 | import java.lang.annotation.ElementType;
5 | import java.lang.annotation.Retention;
6 | import java.lang.annotation.RetentionPolicy;
7 | import java.lang.annotation.Target;
8 |
9 | /**
10 | * 权限限制
11 | * @author xuxueli 2015-12-12 18:29:02
12 | */
13 | @Target(ElementType.METHOD)
14 | @Retention(RetentionPolicy.RUNTIME)
15 | public @interface PermessionLimit {
16 |
17 | /**
18 | * 登录拦截 (默认拦截)
19 | */
20 | boolean limit() default true;
21 |
22 | }
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/java/com/xxl/job/admin/controller/interceptor/WebMvcConfig.java:
--------------------------------------------------------------------------------
1 | package com.xxl.job.admin.controller.interceptor;
2 |
3 | import org.springframework.context.annotation.Configuration;
4 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
5 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
6 |
7 | import javax.annotation.Resource;
8 |
9 | /**
10 | * web mvc config
11 | *
12 | * @author xuxueli 2018-04-02 20:48:20
13 | */
14 | @Configuration
15 | public class WebMvcConfig extends WebMvcConfigurerAdapter {
16 |
17 | @Resource
18 | private PermissionInterceptor permissionInterceptor;
19 | @Resource
20 | private CookieInterceptor cookieInterceptor;
21 |
22 | @Override
23 | public void addInterceptors(InterceptorRegistry registry) {
24 | registry.addInterceptor(permissionInterceptor).addPathPatterns("/**");
25 | registry.addInterceptor(cookieInterceptor).addPathPatterns("/**");
26 | super.addInterceptors(registry);
27 | }
28 |
29 | }
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/java/com/xxl/job/admin/core/jobbean/RemoteHttpJobBean.java:
--------------------------------------------------------------------------------
1 | package com.xxl.job.admin.core.jobbean;
2 |
3 | import com.xxl.job.admin.core.thread.JobTriggerPoolHelper;
4 | import com.xxl.job.admin.core.trigger.TriggerTypeEnum;
5 | import org.quartz.JobExecutionContext;
6 | import org.quartz.JobExecutionException;
7 | import org.quartz.JobKey;
8 | import org.slf4j.Logger;
9 | import org.slf4j.LoggerFactory;
10 | import org.springframework.scheduling.quartz.QuartzJobBean;
11 |
12 | /**
13 | * http job bean
14 | * “@DisallowConcurrentExecution” diable concurrent, thread size can not be only one, better given more
15 | * @author xuxueli 2015-12-17 18:20:34
16 | */
17 | //@DisallowConcurrentExecution
18 | public class RemoteHttpJobBean extends QuartzJobBean {
19 | private static Logger logger = LoggerFactory.getLogger(RemoteHttpJobBean.class);
20 |
21 | @Override
22 | protected void executeInternal(JobExecutionContext context)
23 | throws JobExecutionException {
24 |
25 | // load jobId
26 | JobKey jobKey = context.getTrigger().getJobKey();
27 | Integer jobId = Integer.valueOf(jobKey.getName());
28 |
29 | // trigger
30 | JobTriggerPoolHelper.trigger(jobId, TriggerTypeEnum.CRON, -1, null, null);
31 | }
32 |
33 | }
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/java/com/xxl/job/admin/core/route/ExecutorRouter.java:
--------------------------------------------------------------------------------
1 | package com.xxl.job.admin.core.route;
2 |
3 | import com.xxl.job.core.biz.model.ReturnT;
4 | import com.xxl.job.core.biz.model.TriggerParam;
5 | import org.slf4j.Logger;
6 | import org.slf4j.LoggerFactory;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * Created by xuxueli on 17/3/10.
12 | */
13 | public abstract class ExecutorRouter {
14 | protected static Logger logger = LoggerFactory.getLogger(ExecutorRouter.class);
15 |
16 | /**
17 | * route address
18 | *
19 | * @param addressList
20 | * @return ReturnT.content=address
21 | */
22 | public abstract ReturnT route(TriggerParam triggerParam, List addressList);
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteFirst.java:
--------------------------------------------------------------------------------
1 | package com.xxl.job.admin.core.route.strategy;
2 |
3 | import com.xxl.job.admin.core.route.ExecutorRouter;
4 | import com.xxl.job.core.biz.model.ReturnT;
5 | import com.xxl.job.core.biz.model.TriggerParam;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * Created by xuxueli on 17/3/10.
11 | */
12 | public class ExecutorRouteFirst extends ExecutorRouter {
13 |
14 | @Override
15 | public ReturnT route(TriggerParam triggerParam, List addressList){
16 | return new ReturnT(addressList.get(0));
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteLast.java:
--------------------------------------------------------------------------------
1 | package com.xxl.job.admin.core.route.strategy;
2 |
3 | import com.xxl.job.admin.core.route.ExecutorRouter;
4 | import com.xxl.job.core.biz.model.ReturnT;
5 | import com.xxl.job.core.biz.model.TriggerParam;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * Created by xuxueli on 17/3/10.
11 | */
12 | public class ExecutorRouteLast extends ExecutorRouter {
13 |
14 | @Override
15 | public ReturnT route(TriggerParam triggerParam, List addressList) {
16 | return new ReturnT(addressList.get(addressList.size()-1));
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/java/com/xxl/job/admin/core/route/strategy/ExecutorRouteRandom.java:
--------------------------------------------------------------------------------
1 | package com.xxl.job.admin.core.route.strategy;
2 |
3 | import com.xxl.job.admin.core.route.ExecutorRouter;
4 | import com.xxl.job.core.biz.model.ReturnT;
5 | import com.xxl.job.core.biz.model.TriggerParam;
6 |
7 | import java.util.List;
8 | import java.util.Random;
9 |
10 | /**
11 | * Created by xuxueli on 17/3/10.
12 | */
13 | public class ExecutorRouteRandom extends ExecutorRouter {
14 |
15 | private static Random localRandom = new Random();
16 |
17 | @Override
18 | public ReturnT route(TriggerParam triggerParam, List addressList) {
19 | String address = addressList.get(localRandom.nextInt(addressList.size()));
20 | return new ReturnT(address);
21 | }
22 |
23 | }
24 |
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/java/com/xxl/job/admin/core/trigger/TriggerTypeEnum.java:
--------------------------------------------------------------------------------
1 | package com.xxl.job.admin.core.trigger;
2 |
3 | import com.xxl.job.admin.core.util.I18nUtil;
4 |
5 | /**
6 | * trigger type enum
7 | *
8 | * @author xuxueli 2018-09-16 04:56:41
9 | */
10 | public enum TriggerTypeEnum {
11 |
12 | MANUAL(I18nUtil.getString("jobconf_trigger_type_manual")),
13 | CRON(I18nUtil.getString("jobconf_trigger_type_cron")),
14 | RETRY(I18nUtil.getString("jobconf_trigger_type_retry")),
15 | PARENT(I18nUtil.getString("jobconf_trigger_type_parent")),
16 | API(I18nUtil.getString("jobconf_trigger_type_api"));
17 |
18 | private TriggerTypeEnum(String title){
19 | this.title = title;
20 | }
21 | private String title;
22 | public String getTitle() {
23 | return title;
24 | }
25 |
26 | }
27 |
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/java/com/xxl/job/admin/core/util/FtlUtil.java:
--------------------------------------------------------------------------------
1 | package com.xxl.job.admin.core.util;
2 |
3 | import freemarker.ext.beans.BeansWrapper;
4 | import freemarker.ext.beans.BeansWrapperBuilder;
5 | import freemarker.template.Configuration;
6 | import freemarker.template.TemplateHashModel;
7 |
8 | /**
9 | * ftl util
10 | *
11 | * @author xuxueli 2018-01-17 20:37:48
12 | */
13 | public class FtlUtil {
14 |
15 | private static BeansWrapper wrapper = new BeansWrapperBuilder(Configuration.DEFAULT_INCOMPATIBLE_IMPROVEMENTS).build(); //BeansWrapper.getDefaultInstance();
16 |
17 | public static TemplateHashModel generateStaticModel(String packageName) {
18 | try {
19 | TemplateHashModel staticModels = wrapper.getStaticModels();
20 | TemplateHashModel fileStatics = (TemplateHashModel) staticModels.get(packageName);
21 | return fileStatics;
22 | } catch (Exception e) {
23 | e.printStackTrace();
24 | }
25 | return null;
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobGroupDao.java:
--------------------------------------------------------------------------------
1 | package com.xxl.job.admin.dao;
2 |
3 | import com.xxl.job.admin.core.model.XxlJobGroup;
4 | import org.apache.ibatis.annotations.Mapper;
5 | import org.apache.ibatis.annotations.Param;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * Created by xuxueli on 16/9/30.
11 | */
12 | @Mapper
13 | public interface XxlJobGroupDao {
14 |
15 | public List findAll();
16 |
17 | public List findByAddressType(@Param("addressType") int addressType);
18 |
19 | public int save(XxlJobGroup xxlJobGroup);
20 |
21 | public int update(XxlJobGroup xxlJobGroup);
22 |
23 | public int remove(@Param("id") int id);
24 |
25 | public XxlJobGroup load(@Param("id") int id);
26 | }
27 |
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/java/com/xxl/job/admin/dao/XxlJobLogGlueDao.java:
--------------------------------------------------------------------------------
1 | package com.xxl.job.admin.dao;
2 |
3 | import com.xxl.job.admin.core.model.XxlJobLogGlue;
4 | import org.apache.ibatis.annotations.Mapper;
5 | import org.apache.ibatis.annotations.Param;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * job log for glue
11 | * @author xuxueli 2016-5-19 18:04:56
12 | */
13 | @Mapper
14 | public interface XxlJobLogGlueDao {
15 |
16 | public int save(XxlJobLogGlue xxlJobLogGlue);
17 |
18 | public List findByJobId(@Param("jobId") int jobId);
19 |
20 | public int removeOld(@Param("jobId") int jobId, @Param("limit") int limit);
21 |
22 | public int deleteByJobId(@Param("jobId") int jobId);
23 |
24 | }
25 |
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/resources/application-dev.properties:
--------------------------------------------------------------------------------
1 | ### xxl-job, datasource
2 | knd.datasource.ip=192.168.28.131
3 | knd.datasource.username=root
4 | knd.datasource.password=1q2w3e4r
5 |
6 | spring.datasource.url=jdbc:mysql://${knd.datasource.ip}:3306/xxl-job?Unicode=true&characterEncoding=UTF-8
7 | spring.datasource.username=${knd.datasource.username}
8 | spring.datasource.password=${knd.datasource.password}
9 |
10 | ### xxl-job email
11 | spring.mail.host=smtp.qq.com
12 | spring.mail.port=25
13 | spring.mail.username=xxx@qq.com
14 | spring.mail.password=xxx
15 |
16 | ### xxl-job login
17 | xxl.job.login.username=admin
18 | xxl.job.login.password=123456
19 |
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/resources/application-test.properties:
--------------------------------------------------------------------------------
1 | ### xxl-job, datasource
2 | knd.datasource.ip=192.168.28.131
3 | knd.datasource.username=root
4 | knd.datasource.password=1q2w3e4r
5 |
6 | spring.datasource.url=jdbc:mysql://${knd.datasource.ip}:3306/xxl-job?Unicode=true&characterEncoding=UTF-8
7 | spring.datasource.username=${knd.datasource.username}
8 | spring.datasource.password=${knd.datasource.password}
9 |
10 | ### xxl-job email
11 | spring.mail.host=smtp.qq.com
12 | spring.mail.port=25
13 | spring.mail.username=xxx@qq.com
14 | spring.mail.password=xxx
15 |
16 | ### xxl-job login
17 | xxl.job.login.username=admin
18 | xxl.job.login.password=123456
19 |
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | # 默认开发环境
2 | spring.profiles.active=dev
3 |
4 | ### web
5 | server.port=8081
6 |
7 | ### resources
8 | spring.mvc.static-path-pattern=/static/**
9 | spring.resources.static-locations=classpath:/static/
10 |
11 | ### freemarker
12 | spring.freemarker.templateLoaderPath=classpath:/templates/
13 | spring.freemarker.suffix=.ftl
14 | spring.freemarker.charset=UTF-8
15 | spring.freemarker.request-context-attribute=request
16 | spring.freemarker.settings.number_format=0.##########
17 |
18 | ### mybatis
19 | mybatis.mapper-locations=classpath:/mybatis-mapper/*Mapper.xml
20 |
21 | ### xxl-job, datasource
22 | spring.datasource.driver-class-name=com.mysql.jdbc.Driver
23 |
24 | spring.datasource.type=org.apache.tomcat.jdbc.pool.DataSource
25 | spring.datasource.tomcat.max-wait=10000
26 | spring.datasource.tomcat.max-active=30
27 | spring.datasource.tomcat.test-on-borrow=true
28 |
29 | ### xxl-job email
30 | spring.mail.properties.mail.smtp.auth=true
31 | spring.mail.properties.mail.smtp.starttls.enable=true
32 | spring.mail.properties.mail.smtp.starttls.required=true
33 |
34 | ### xxl-job, access token
35 | xxl.job.accessToken=
36 |
37 | ### xxl-job, i18n (default empty as chinese, "en" as english)
38 | xxl.job.i18n=
39 |
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/resources/logback.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | logback
5 |
6 |
7 |
8 |
9 | %d{HH:mm:ss.SSS} %contextName [%thread] %-5level %logger{36} - %msg%n
10 |
11 |
12 |
13 |
14 | ${log.path}
15 |
16 | ${log.path}.%d{yyyy-MM-dd}.zip
17 |
18 |
19 | %date %level [%thread] %logger{36} [%file : %line] %msg%n
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/resources/quartz.properties:
--------------------------------------------------------------------------------
1 | # Default Properties file for use by StdSchedulerFactory
2 | # to create a Quartz Scheduler Instance, if a different
3 | # properties file is not explicitly specified.
4 | #
5 |
6 | org.quartz.scheduler.instanceName: DefaultQuartzScheduler
7 | org.quartz.scheduler.instanceId: AUTO
8 | org.quartz.scheduler.rmi.export: false
9 | org.quartz.scheduler.rmi.proxy: false
10 | org.quartz.scheduler.wrapJobExecutionInUserTransaction: false
11 |
12 | org.quartz.threadPool.class: org.quartz.simpl.SimpleThreadPool
13 | org.quartz.threadPool.threadCount: 50
14 | org.quartz.threadPool.threadPriority: 5
15 | org.quartz.threadPool.threadsInheritContextClassLoaderOfInitializingThread: true
16 |
17 | org.quartz.jobStore.misfireThreshold: 60000
18 | org.quartz.jobStore.maxMisfiresToHandleAtATime: 1
19 |
20 | #org.quartz.jobStore.class: org.quartz.simpl.RAMJobStore
21 |
22 | # for cluster
23 | org.quartz.jobStore.tablePrefix: XXL_JOB_QRTZ_
24 | org.quartz.jobStore.class: org.quartz.impl.jdbcjobstore.JobStoreTX
25 | org.quartz.jobStore.isClustered: true
26 | org.quartz.jobStore.clusterCheckinInterval: 5000
27 |
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/resources/static/adminlte/bower_components/Ionicons/fonts/ionicons.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kndopensource/knd-platform/f8121bb82b813943f4509809d28d2e4c7fbe22ac/knd-micro/micro-job/job-admin/src/main/resources/static/adminlte/bower_components/Ionicons/fonts/ionicons.eot
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/resources/static/adminlte/bower_components/Ionicons/fonts/ionicons.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kndopensource/knd-platform/f8121bb82b813943f4509809d28d2e4c7fbe22ac/knd-micro/micro-job/job-admin/src/main/resources/static/adminlte/bower_components/Ionicons/fonts/ionicons.ttf
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/resources/static/adminlte/bower_components/Ionicons/fonts/ionicons.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kndopensource/knd-platform/f8121bb82b813943f4509809d28d2e4c7fbe22ac/knd-micro/micro-job/job-admin/src/main/resources/static/adminlte/bower_components/Ionicons/fonts/ionicons.woff
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kndopensource/knd-platform/f8121bb82b813943f4509809d28d2e4c7fbe22ac/knd-micro/micro-job/job-admin/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.eot
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kndopensource/knd-platform/f8121bb82b813943f4509809d28d2e4c7fbe22ac/knd-micro/micro-job/job-admin/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.ttf
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kndopensource/knd-platform/f8121bb82b813943f4509809d28d2e4c7fbe22ac/knd-micro/micro-job/job-admin/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kndopensource/knd-platform/f8121bb82b813943f4509809d28d2e4c7fbe22ac/knd-micro/micro-job/job-admin/src/main/resources/static/adminlte/bower_components/bootstrap/fonts/glyphicons-halflings-regular.woff2
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/FontAwesome.otf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kndopensource/knd-platform/f8121bb82b813943f4509809d28d2e4c7fbe22ac/knd-micro/micro-job/job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/FontAwesome.otf
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.eot:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kndopensource/knd-platform/f8121bb82b813943f4509809d28d2e4c7fbe22ac/knd-micro/micro-job/job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.eot
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kndopensource/knd-platform/f8121bb82b813943f4509809d28d2e4c7fbe22ac/knd-micro/micro-job/job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.ttf
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kndopensource/knd-platform/f8121bb82b813943f4509809d28d2e4c7fbe22ac/knd-micro/micro-job/job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.woff
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.woff2:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kndopensource/knd-platform/f8121bb82b813943f4509809d28d2e4c7fbe22ac/knd-micro/micro-job/job-admin/src/main/resources/static/adminlte/bower_components/font-awesome/fonts/fontawesome-webfont.woff2
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/resources/static/adminlte/plugins/iCheck/square/blue.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kndopensource/knd-platform/f8121bb82b813943f4509809d28d2e4c7fbe22ac/knd-micro/micro-job/job-admin/src/main/resources/static/adminlte/plugins/iCheck/square/blue.png
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/resources/static/adminlte/plugins/iCheck/square/blue@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kndopensource/knd-platform/f8121bb82b813943f4509809d28d2e4c7fbe22ac/knd-micro/micro-job/job-admin/src/main/resources/static/adminlte/plugins/iCheck/square/blue@2x.png
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/resources/static/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kndopensource/knd-platform/f8121bb82b813943f4509809d28d2e4c7fbe22ac/knd-micro/micro-job/job-admin/src/main/resources/static/favicon.ico
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/resources/static/plugins/codemirror/addon/hint/show-hint.css:
--------------------------------------------------------------------------------
1 | .CodeMirror-hints {
2 | position: absolute;
3 | z-index: 10;
4 | overflow: hidden;
5 | list-style: none;
6 |
7 | margin: 0;
8 | padding: 2px;
9 |
10 | -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
11 | -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
12 | box-shadow: 2px 3px 5px rgba(0,0,0,.2);
13 | border-radius: 3px;
14 | border: 1px solid silver;
15 |
16 | background: white;
17 | font-size: 90%;
18 | font-family: monospace;
19 |
20 | max-height: 20em;
21 | overflow-y: auto;
22 | }
23 |
24 | .CodeMirror-hint {
25 | margin: 0;
26 | padding: 0 4px;
27 | border-radius: 2px;
28 | white-space: pre;
29 | color: black;
30 | cursor: pointer;
31 | }
32 |
33 | li.CodeMirror-hint-active {
34 | background: #08f;
35 | color: white;
36 | }
37 |
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/resources/static/plugins/layer/theme/default/icon-ext.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kndopensource/knd-platform/f8121bb82b813943f4509809d28d2e4c7fbe22ac/knd-micro/micro-job/job-admin/src/main/resources/static/plugins/layer/theme/default/icon-ext.png
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/resources/static/plugins/layer/theme/default/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kndopensource/knd-platform/f8121bb82b813943f4509809d28d2e4c7fbe22ac/knd-micro/micro-job/job-admin/src/main/resources/static/plugins/layer/theme/default/icon.png
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/resources/static/plugins/layer/theme/default/loading-0.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kndopensource/knd-platform/f8121bb82b813943f4509809d28d2e4c7fbe22ac/knd-micro/micro-job/job-admin/src/main/resources/static/plugins/layer/theme/default/loading-0.gif
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/resources/static/plugins/layer/theme/default/loading-1.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kndopensource/knd-platform/f8121bb82b813943f4509809d28d2e4c7fbe22ac/knd-micro/micro-job/job-admin/src/main/resources/static/plugins/layer/theme/default/loading-1.gif
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/resources/static/plugins/layer/theme/default/loading-2.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/kndopensource/knd-platform/f8121bb82b813943f4509809d28d2e4c7fbe22ac/knd-micro/micro-job/job-admin/src/main/resources/static/plugins/layer/theme/default/loading-2.gif
--------------------------------------------------------------------------------
/knd-micro/micro-job/job-admin/src/main/resources/templates/common/common.exception.ftl:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Error
6 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
System Error
25 |
${exceptionMsg}
26 |
Back
27 |
28 |
29 |
30 |
31 |