├── .gitignore
├── Dockerfile
├── LICENSE
├── README.md
├── doc
├── data
│ ├── READEM.md
│ ├── bin
│ │ ├── .env
│ │ ├── check.sh
│ │ ├── devops.sh
│ │ ├── initsql.sh
│ │ ├── loadimages.sh
│ │ └── nginx.sh
│ ├── config
│ │ ├── application-prod.yml
│ │ └── smart-job.sql
│ ├── docker-compose
│ │ ├── docker-compose
│ │ └── docker-java.yml
│ ├── docker
│ │ ├── docker-19.03.9.tgz
│ │ └── docker.service
│ └── nginx
│ │ └── conf.d
│ │ └── job.xxx.com.conf
├── image
│ ├── bitbug_favicon.ico
│ ├── pay100.jpeg
│ ├── pay20.jpeg
│ ├── pay50.jpeg
│ ├── smart-job-logo.png
│ ├── smart-job部署架构图.png
│ ├── 任务列表-注册节点.png
│ ├── 任务执行器.png
│ ├── 任务日志.png
│ ├── 任务管理.png
│ ├── 任务编辑.png
│ ├── 告警记录.png
│ ├── 告警配置.png
│ ├── 用户管理.png
│ ├── 登录页面.png
│ ├── 角色管理.png
│ ├── 调度管理.png
│ └── 首页.png
└── sql
│ └── xxl-job.sql
├── docker-entrypoint.sh
├── pom.xml
├── smart-job-common
├── .DS_Store
├── pom.xml
└── src
│ └── main
│ └── java
│ └── cn
│ └── smartcoding
│ └── common
│ ├── annotation
│ ├── DataScope.java
│ ├── DataSource.java
│ ├── Excel.java
│ ├── Excels.java
│ ├── Log.java
│ └── RepeatSubmit.java
│ ├── config
│ └── SmartJobConfig.java
│ ├── constant
│ ├── Constants.java
│ ├── GenConstants.java
│ ├── HttpStatus.java
│ ├── ScheduleConstants.java
│ └── UserConstants.java
│ ├── core
│ ├── captcha
│ │ ├── CaptchaCode.java
│ │ ├── CaptchaCodeEnum.java
│ │ └── CaptchaFactory.java
│ ├── controller
│ │ └── BaseController.java
│ ├── domain
│ │ ├── AccountCreateEnum.java
│ │ ├── AccountStatusEnum.java
│ │ ├── BaseEntity.java
│ │ ├── CommonErrorCode.java
│ │ ├── IErrorCode.java
│ │ ├── ResultModel.java
│ │ ├── TreeEntity.java
│ │ ├── TreeSelect.java
│ │ ├── entity
│ │ │ ├── SysDept.java
│ │ │ ├── SysDictData.java
│ │ │ ├── SysDictType.java
│ │ │ ├── SysMenu.java
│ │ │ ├── SysRole.java
│ │ │ └── SysUser.java
│ │ ├── model
│ │ │ ├── LoginBody.java
│ │ │ └── LoginUser.java
│ │ └── util
│ │ │ └── ResultModelUtils.java
│ ├── page
│ │ ├── PageDomain.java
│ │ ├── TableDataInfo.java
│ │ └── TableSupport.java
│ ├── redis
│ │ └── RedisCache.java
│ └── text
│ │ ├── CharsetKit.java
│ │ ├── Convert.java
│ │ └── StrFormatter.java
│ ├── enums
│ ├── BusinessStatus.java
│ ├── BusinessType.java
│ ├── DataSourceType.java
│ ├── HttpMethod.java
│ ├── OperatorType.java
│ └── UserStatus.java
│ ├── exception
│ ├── BaseException.java
│ ├── CommonException.java
│ ├── CustomException.java
│ ├── DemoModeException.java
│ ├── UtilException.java
│ ├── file
│ │ ├── FileException.java
│ │ ├── FileNameLengthLimitExceededException.java
│ │ ├── FileSizeLimitExceededException.java
│ │ └── InvalidExtensionException.java
│ ├── job
│ │ └── TaskException.java
│ └── user
│ │ ├── UserException.java
│ │ └── UserPasswordNotMatchException.java
│ ├── filter
│ ├── RepeatableFilter.java
│ ├── RepeatedlyRequestWrapper.java
│ ├── XssFilter.java
│ └── XssHttpServletRequestWrapper.java
│ ├── robot
│ ├── enums
│ │ ├── NotifyMsgTypeEnum.java
│ │ └── NotifyRobotEnum.java
│ ├── exception
│ │ ├── WebHookRobotIllegalArgumentException.java
│ │ ├── WebHookRobotResponseException.java
│ │ └── WebHookRobotValidateException.java
│ ├── model
│ │ ├── message
│ │ │ ├── Message.java
│ │ │ ├── dingding
│ │ │ │ ├── DingActionCardMessage.java
│ │ │ │ ├── DingFeedCardMessage.java
│ │ │ │ ├── DingLinkMessage.java
│ │ │ │ ├── DingMarkdownMessage.java
│ │ │ │ ├── DingSingleActionCardMessage.java
│ │ │ │ ├── DingTextMessage.java
│ │ │ │ └── enums
│ │ │ │ │ ├── BtnOrientationTypeEnum.java
│ │ │ │ │ └── HideAvatarTypeEnums.java
│ │ │ └── wx
│ │ │ │ ├── WxImageMessage.java
│ │ │ │ ├── WxMarkdownMessage.java
│ │ │ │ ├── WxTextMessage.java
│ │ │ │ └── news
│ │ │ │ ├── WxNewsArticle.java
│ │ │ │ └── WxNewsMessage.java
│ │ ├── request
│ │ │ ├── ActionCardRequest.java
│ │ │ ├── BaseNotifyRequest.java
│ │ │ ├── CardRequest.java
│ │ │ ├── ImageRequest.java
│ │ │ ├── LinkRequest.java
│ │ │ ├── MarkdownRequest.java
│ │ │ ├── NewsRequest.java
│ │ │ ├── RobotNotifyRequest.java
│ │ │ ├── SingleActionCardRequest.java
│ │ │ └── TextRequest.java
│ │ └── response
│ │ │ ├── RobotNotifyRequestBuilder.java
│ │ │ └── RobotNotifyResponse.java
│ ├── notify
│ │ ├── AbstractRobotNotify.java
│ │ ├── BaseRobotNotify.java
│ │ ├── RobotNotify.java
│ │ ├── corpwechat
│ │ │ ├── WechatMessageCovert.java
│ │ │ └── WechatRobotNotify.java
│ │ └── dingding
│ │ │ ├── DingDingMessageCovert.java
│ │ │ └── DingDingRobotNotify.java
│ └── util
│ │ ├── ErrorStringUtils.java
│ │ ├── HttpUtils.java
│ │ ├── MarkdownMessageUtils.java
│ │ └── ThreadSupport.java
│ └── utils
│ ├── AESUtil.java
│ ├── Arith.java
│ ├── DateUtils.java
│ ├── DictUtils.java
│ ├── ExceptionUtil.java
│ ├── LogUtils.java
│ ├── MessageUtils.java
│ ├── SecurityUtils.java
│ ├── ServletUtils.java
│ ├── StringUtils.java
│ ├── Threads.java
│ ├── VerifyCodeUtils.java
│ ├── bean
│ └── BeanUtils.java
│ ├── file
│ ├── FileUploadUtils.java
│ ├── FileUtils.java
│ └── MimeTypeUtils.java
│ ├── html
│ ├── EscapeUtil.java
│ └── HTMLFilter.java
│ ├── http
│ ├── HttpHelper.java
│ └── HttpUtils.java
│ ├── ip
│ ├── AddressUtils.java
│ └── IpUtils.java
│ ├── poi
│ └── ExcelUtil.java
│ ├── reflect
│ └── ReflectUtils.java
│ ├── sign
│ ├── Base64.java
│ └── Md5Utils.java
│ ├── spring
│ └── SpringUtils.java
│ ├── sql
│ └── SqlUtil.java
│ └── uuid
│ ├── IdUtils.java
│ └── UUID.java
├── smart-job-core
├── .DS_Store
├── pom.xml
└── src
│ └── main
│ └── java
│ └── cn
│ └── smartcoding
│ └── job
│ └── core
│ ├── biz
│ ├── AdminBiz.java
│ ├── ExecutorBiz.java
│ ├── JobBiz.java
│ ├── JobConst.java
│ ├── impl
│ │ └── ExecutorBizImpl.java
│ └── model
│ │ ├── HandleCallbackParam.java
│ │ ├── JobGroupParam.java
│ │ ├── JobInfoParam.java
│ │ ├── LogResult.java
│ │ ├── RegistryParam.java
│ │ ├── ReturnT.java
│ │ └── TriggerParam.java
│ ├── cron
│ ├── CronExpression.java
│ └── ValueSet.java
│ ├── enums
│ ├── ExecutorBlockStrategyEnum.java
│ ├── ExecutorRouteStrategyEnum.java
│ └── RegistryConfig.java
│ ├── executor
│ ├── XxlJobExecutor.java
│ └── impl
│ │ └── XxlJobSpringExecutor.java
│ ├── glue
│ ├── GlueFactory.java
│ ├── GlueTypeEnum.java
│ └── impl
│ │ └── SpringGlueFactory.java
│ ├── handler
│ ├── IJobHandler.java
│ ├── annotation
│ │ ├── Job.java
│ │ ├── JobHandler.java
│ │ └── JobMethodHandler.java
│ └── impl
│ │ ├── GlueJobHandler.java
│ │ ├── MethodJobHandler.java
│ │ └── ScriptJobHandler.java
│ ├── log
│ ├── LogLevel.java
│ ├── XxlJobFileAppender.java
│ └── XxlJobLogger.java
│ ├── thread
│ ├── ExecutorRegistryThread.java
│ ├── JobLogFileCleanThread.java
│ ├── JobRegistryThread.java
│ ├── JobThread.java
│ └── TriggerCallbackThread.java
│ └── util
│ ├── DateUtil.java
│ ├── FileUtil.java
│ ├── ScriptUtil.java
│ ├── ShardingUtil.java
│ ├── UUIDUtils.java
│ └── XxlJobRemotingUtil.java
├── smart-job-framework
├── .DS_Store
├── pom.xml
└── src
│ └── main
│ └── java
│ └── cn
│ └── smartcoding
│ └── framework
│ ├── aspectj
│ ├── DataScopeAspect.java
│ └── DataSourceAspect.java
│ ├── config
│ ├── ApplicationConfig.java
│ ├── CaptchaConfig.java
│ ├── DruidConfig.java
│ ├── FastJson2JsonRedisSerializer.java
│ ├── FilterConfig.java
│ ├── RedisConfig.java
│ ├── ResourcesConfig.java
│ ├── ServerConfig.java
│ ├── ThreadPoolConfig.java
│ └── properties
│ │ ├── CaptchaProperties.java
│ │ └── DruidProperties.java
│ ├── datasource
│ ├── DynamicDataSource.java
│ └── DynamicDataSourceContextHolder.java
│ ├── interceptor
│ ├── RepeatSubmitInterceptor.java
│ └── impl
│ │ └── SameUrlDataInterceptor.java
│ ├── manager
│ ├── AsyncManager.java
│ └── ShutdownManager.java
│ └── web
│ ├── domain
│ ├── Server.java
│ └── server
│ │ ├── Cpu.java
│ │ ├── Jvm.java
│ │ ├── Mem.java
│ │ ├── Sys.java
│ │ └── SysFile.java
│ ├── exception
│ └── GlobalExceptionHandler.java
│ └── service
│ ├── PermissionService.java
│ └── TokenService.java
├── smart-job-generator
├── .DS_Store
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── cn
│ │ └── smartcoding
│ │ └── generator
│ │ ├── config
│ │ └── GenConfig.java
│ │ ├── controller
│ │ └── GenController.java
│ │ ├── domain
│ │ ├── GenTable.java
│ │ └── GenTableColumn.java
│ │ ├── mapper
│ │ ├── GenTableColumnMapper.java
│ │ └── GenTableMapper.java
│ │ ├── service
│ │ ├── GenTableColumnServiceImpl.java
│ │ ├── GenTableServiceImpl.java
│ │ ├── IGenTableColumnService.java
│ │ └── IGenTableService.java
│ │ └── util
│ │ ├── GenUtils.java
│ │ ├── VelocityInitializer.java
│ │ ├── VelocityUtils.java
│ │ └── test.java
│ └── resources
│ ├── generator.yml
│ ├── mapper
│ └── generator
│ │ ├── GenTableColumnMapper.xml
│ │ └── GenTableMapper.xml
│ └── vm
│ ├── java
│ ├── controller.java.vm
│ ├── domain.java.vm
│ ├── mapper.java.vm
│ ├── service.java.vm
│ └── serviceImpl.java.vm
│ ├── js
│ └── api.js.vm
│ ├── sql
│ └── sql.vm
│ ├── vue
│ ├── index-tree.vue.vm
│ └── index.vue.vm
│ └── xml
│ └── mapper.xml.vm
├── smart-job-schedule
├── .DS_Store
├── pom.xml
└── src
│ ├── .DS_Store
│ ├── main
│ ├── java
│ │ └── cn
│ │ │ └── smartcoding
│ │ │ └── schedule
│ │ │ ├── config
│ │ │ └── XxlJobConfig.java
│ │ │ ├── core
│ │ │ ├── alarm
│ │ │ │ ├── AbstractJobAlarm.java
│ │ │ │ ├── AlarmManager.java
│ │ │ │ ├── AlarmParam.java
│ │ │ │ ├── AlarmProviderManager.java
│ │ │ │ ├── AlarmResult.java
│ │ │ │ ├── DefaultAlarmResult.java
│ │ │ │ ├── DefaultFailAlarmResult.java
│ │ │ │ ├── JobAlarm.java
│ │ │ │ ├── JobAlarmEnum.java
│ │ │ │ └── impl
│ │ │ │ │ ├── DingdingJobAlarm.java
│ │ │ │ │ ├── EmailJobAlarm.java
│ │ │ │ │ ├── MobileJobAlarm.java
│ │ │ │ │ ├── SmsJobAlarm.java
│ │ │ │ │ └── WxWechatJobAlarm.java
│ │ │ ├── conf
│ │ │ │ ├── XxlJobAdminConfig.java
│ │ │ │ └── XxlJobScheduler.java
│ │ │ ├── cron
│ │ │ │ └── CronExpression.java
│ │ │ ├── enums
│ │ │ │ ├── AddressOnlineEnum.java
│ │ │ │ ├── AddressTypeEnum.java
│ │ │ │ ├── ExecutorWayTypeEnum.java
│ │ │ │ ├── JobAlarmStatusEnum.java
│ │ │ │ ├── JobCreateWayEnum.java
│ │ │ │ ├── JobGroupAlarmStatusEnum.java
│ │ │ │ ├── JobGroupClusterEnum.java
│ │ │ │ ├── JobStatusEnum.java
│ │ │ │ ├── LoginWayEnum.java
│ │ │ │ ├── ScheduleStatusEnum.java
│ │ │ │ └── ThreadTypeEnum.java
│ │ │ ├── exception
│ │ │ │ ├── AlarmFailException.java
│ │ │ │ └── XxlJobException.java
│ │ │ ├── model
│ │ │ │ ├── XxlAlarmInfo.java
│ │ │ │ ├── XxlJobAlarmLog.java
│ │ │ │ ├── XxlJobGroup.java
│ │ │ │ ├── XxlJobInfo.java
│ │ │ │ ├── XxlJobLock.java
│ │ │ │ ├── XxlJobLog.java
│ │ │ │ ├── XxlJobLogGlue.java
│ │ │ │ ├── XxlJobLogReport.java
│ │ │ │ ├── XxlJobRegistry.java
│ │ │ │ ├── XxlJobScheduleConfig.java
│ │ │ │ ├── XxlJobThread.java
│ │ │ │ ├── bo
│ │ │ │ │ ├── JobDashbordBO.java
│ │ │ │ │ ├── XxlJobAddressBO.java
│ │ │ │ │ ├── XxlJobGroupBO.java
│ │ │ │ │ ├── XxlJobInfoBO.java
│ │ │ │ │ ├── XxlJobLogReportBO.java
│ │ │ │ │ ├── XxlJobStatisticBO.java
│ │ │ │ │ ├── XxlJobUserBO.java
│ │ │ │ │ ├── XxlShortAlarmInfoBO.java
│ │ │ │ │ └── XxlShortJobInfoBO.java
│ │ │ │ └── vo
│ │ │ │ │ ├── JobAddressGroupVO.java
│ │ │ │ │ ├── JobAddressVO.java
│ │ │ │ │ ├── JobGroupVO.java
│ │ │ │ │ ├── NoticeUser.java
│ │ │ │ │ ├── TestAlarmParamVO.java
│ │ │ │ │ ├── Variable.java
│ │ │ │ │ └── XxlJobGroupVO.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
│ │ │ │ │ └── IdleBeat.java
│ │ │ ├── thread
│ │ │ │ ├── JobFailMonitorHelper.java
│ │ │ │ ├── JobRegistryMonitorHelper.java
│ │ │ │ ├── JobScheduleHelper.java
│ │ │ │ └── JobTriggerPoolHelper.java
│ │ │ ├── trigger
│ │ │ │ ├── TriggerConstant.java
│ │ │ │ ├── TriggerMsg.java
│ │ │ │ ├── TriggerReslut.java
│ │ │ │ ├── TriggerStatusEnum.java
│ │ │ │ ├── TriggerTypeEnum.java
│ │ │ │ └── XxlJobTrigger.java
│ │ │ └── util
│ │ │ │ ├── CookieUtil.java
│ │ │ │ ├── I18nUtil.java
│ │ │ │ ├── IpUtils.java
│ │ │ │ ├── JacksonUtil.java
│ │ │ │ ├── LocalCacheUtil.java
│ │ │ │ ├── StringBuilderUtil.java
│ │ │ │ ├── UserPermissionUtil.java
│ │ │ │ └── VO2DOUtils.java
│ │ │ ├── dto
│ │ │ ├── ClearLogDto.java
│ │ │ └── TriggerJobDto.java
│ │ │ ├── job
│ │ │ ├── DeleteJobLogJobHandler.java
│ │ │ ├── DemoJobHandler.java
│ │ │ └── JobLogReportJobHandler.java
│ │ │ ├── mapper
│ │ │ ├── XxlJobAlarmInfoMapper.java
│ │ │ ├── XxlJobAlarmLogMapper.java
│ │ │ ├── XxlJobGroupMapper.java
│ │ │ ├── XxlJobInfoMapper.java
│ │ │ ├── XxlJobLockMapper.java
│ │ │ ├── XxlJobLogGlueMapper.java
│ │ │ ├── XxlJobLogMapper.java
│ │ │ ├── XxlJobLogReportDao.java
│ │ │ ├── XxlJobRegistryMapper.java
│ │ │ ├── XxlJobScheduleConfigMapper.java
│ │ │ └── XxlJobThreadMapper.java
│ │ │ └── service
│ │ │ ├── ApplicationContextUtil.java
│ │ │ ├── IXxlJobAlarmInfoService.java
│ │ │ ├── IXxlJobAlarmLogService.java
│ │ │ ├── IXxlJobScheduleConfigService.java
│ │ │ ├── IXxlJobTreadService.java
│ │ │ ├── XxlJobGroupService.java
│ │ │ ├── XxlJobInitService.java
│ │ │ ├── XxlJobLogService.java
│ │ │ ├── XxlJobService.java
│ │ │ └── impl
│ │ │ ├── AdminBizImpl.java
│ │ │ ├── JobBizImpl.java
│ │ │ ├── XxlJobAlarmInfoServiceImpl.java
│ │ │ ├── XxlJobAlarmLogServiceImpl.java
│ │ │ ├── XxlJobGroupServiceImpl.java
│ │ │ ├── XxlJobInitServiceImpl.java
│ │ │ ├── XxlJobLogServiceImpl.java
│ │ │ ├── XxlJobScheduleConfigServiceImpl.java
│ │ │ ├── XxlJobServiceImpl.java
│ │ │ └── XxlJobTreadServiceImpl.java
│ └── resources
│ │ └── mapper
│ │ ├── XxlJobAlarmInfoMapper.xml
│ │ ├── XxlJobAlarmLogMapper.xml
│ │ ├── XxlJobGroupMapper.xml
│ │ ├── XxlJobInfoMapper.xml
│ │ ├── XxlJobLockMapper.xml
│ │ ├── XxlJobLogGlueMapper.xml
│ │ ├── XxlJobLogMapper.xml
│ │ ├── XxlJobLogReportMapper.xml
│ │ ├── XxlJobRegistryMapper.xml
│ │ ├── XxlJobScheduleConfigMapper.xml
│ │ └── XxlJobThreadMapper.xml
│ └── test
│ └── java
│ └── cn
│ └── smartcoding
│ └── schedule
│ ├── controller
│ └── AbstractSpringMvcTest.java
│ ├── test
│ ├── XxlJobGroupDaoTest.java
│ ├── XxlJobInfoDaoTest.java
│ ├── XxlJobLogDaoTest.java
│ ├── XxlJobLogGlueDaoTest.java
│ └── XxlJobRegistryDaoTest.java
│ └── util
│ ├── CronTest.java
│ └── I18nUtilTest.java
├── smart-job-starter
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── cn
│ │ └── smartcoding
│ │ └── xxl
│ │ └── job
│ │ └── starter
│ │ ├── XxlJobAutoConfiguration.java
│ │ └── XxxJobProperties.java
│ └── resources
│ └── META-INF
│ └── spring.factories
├── smart-job-system
├── .DS_Store
├── pom.xml
└── src
│ └── main
│ ├── java
│ └── cn
│ │ └── smartcoding
│ │ └── system
│ │ ├── aspectj
│ │ └── LogAspect.java
│ │ ├── config
│ │ └── SecurityConfig.java
│ │ ├── domain
│ │ ├── SysConfig.java
│ │ ├── SysLdapConfig.java
│ │ ├── SysLogininfor.java
│ │ ├── SysNotice.java
│ │ ├── SysOperLog.java
│ │ ├── SysPost.java
│ │ ├── SysRoleDept.java
│ │ ├── SysRoleMenu.java
│ │ ├── SysUserOnline.java
│ │ ├── SysUserPost.java
│ │ ├── SysUserRole.java
│ │ └── vo
│ │ │ ├── MetaVo.java
│ │ │ ├── RouterVo.java
│ │ │ └── SysUserVO.java
│ │ ├── dto
│ │ ├── LdapUserDto.java
│ │ ├── SysDeptDto.java
│ │ └── SysUserDto.java
│ │ ├── exception
│ │ ├── LdapAuthenticationException.java
│ │ └── LdapLockAuthenticationException.java
│ │ ├── manager
│ │ └── factory
│ │ │ └── AsyncFactory.java
│ │ ├── mapper
│ │ ├── SysConfigMapper.java
│ │ ├── SysDeptMapper.java
│ │ ├── SysDictDataMapper.java
│ │ ├── SysDictTypeMapper.java
│ │ ├── SysLdapConfigMapper.java
│ │ ├── SysLogininforMapper.java
│ │ ├── SysMenuMapper.java
│ │ ├── SysNoticeMapper.java
│ │ ├── SysOperLogMapper.java
│ │ ├── SysPostMapper.java
│ │ ├── SysRoleDeptMapper.java
│ │ ├── SysRoleMapper.java
│ │ ├── SysRoleMenuMapper.java
│ │ ├── SysUserMapper.java
│ │ ├── SysUserPostMapper.java
│ │ └── SysUserRoleMapper.java
│ │ ├── security
│ │ ├── CaptchaException.java
│ │ ├── CaptchaExpireException.java
│ │ ├── LoginTypeEnum.java
│ │ ├── SecurityConstants.java
│ │ ├── authentication
│ │ │ ├── AbstractPreAuthenticationChecks.java
│ │ │ ├── LdapAuthenticationProvider.java
│ │ │ ├── LdapAuthenticationToken.java
│ │ │ ├── MyAuthenticationFailureHandler.java
│ │ │ ├── MyAuthenticationFilter.java
│ │ │ ├── MyAuthenticationSuccessHandler.java
│ │ │ ├── UsernamePasswordAuthenticationProvider.java
│ │ │ └── UsernamePasswordAuthenticationToken.java
│ │ ├── filter
│ │ │ └── JwtAuthenticationTokenFilter.java
│ │ └── handle
│ │ │ ├── AuthenticationEntryPointImpl.java
│ │ │ └── LogoutSuccessHandlerImpl.java
│ │ ├── service
│ │ ├── ISysConfigService.java
│ │ ├── ISysDeptService.java
│ │ ├── ISysDictDataService.java
│ │ ├── ISysDictTypeService.java
│ │ ├── ISysLdapConfigService.java
│ │ ├── ISysLogininforService.java
│ │ ├── ISysMenuService.java
│ │ ├── ISysNoticeService.java
│ │ ├── ISysOperLogService.java
│ │ ├── ISysPostService.java
│ │ ├── ISysRoleService.java
│ │ ├── ISysUserOnlineService.java
│ │ ├── ISysUserService.java
│ │ ├── LdapUserDetailsService.java
│ │ ├── SysLoginService.java
│ │ ├── SysPermissionService.java
│ │ ├── UserDetailsServiceImpl.java
│ │ └── impl
│ │ │ ├── SysConfigServiceImpl.java
│ │ │ ├── SysDeptServiceImpl.java
│ │ │ ├── SysDictDataServiceImpl.java
│ │ │ ├── SysDictTypeServiceImpl.java
│ │ │ ├── SysLdapConfigServiceImpl.java
│ │ │ ├── SysLogininforServiceImpl.java
│ │ │ ├── SysMenuServiceImpl.java
│ │ │ ├── SysNoticeServiceImpl.java
│ │ │ ├── SysOperLogServiceImpl.java
│ │ │ ├── SysPostServiceImpl.java
│ │ │ ├── SysRoleServiceImpl.java
│ │ │ ├── SysUserOnlineServiceImpl.java
│ │ │ └── SysUserServiceImpl.java
│ │ └── vo
│ │ └── LdapTestVO.java
│ └── resources
│ └── mapper
│ └── system
│ ├── SysConfigMapper.xml
│ ├── SysDeptMapper.xml
│ ├── SysDictDataMapper.xml
│ ├── SysDictTypeMapper.xml
│ ├── SysLdapConfigMapper.xml
│ ├── SysLogininforMapper.xml
│ ├── SysMenuMapper.xml
│ ├── SysNoticeMapper.xml
│ ├── SysOperLogMapper.xml
│ ├── SysPostMapper.xml
│ ├── SysRoleDeptMapper.xml
│ ├── SysRoleMapper.xml
│ ├── SysRoleMenuMapper.xml
│ ├── SysUserMapper.xml
│ ├── SysUserPostMapper.xml
│ └── SysUserRoleMapper.xml
└── smart-job-web
├── .DS_Store
├── pom.xml
└── src
└── main
├── java
└── cn
│ └── smartcoding
│ ├── JobApplication.java
│ └── web
│ ├── common
│ ├── CaptchaController.java
│ └── CommonController.java
│ ├── controller
│ ├── StartCheckController.java
│ ├── job
│ │ ├── IndexController.java
│ │ ├── JobAlarmInfoController.java
│ │ ├── JobAlarmLogController.java
│ │ ├── JobApiController.java
│ │ ├── JobCodeController.java
│ │ ├── JobGroupController.java
│ │ ├── JobInfoController.java
│ │ ├── JobLogController.java
│ │ ├── JobScheduleConfigController.java
│ │ └── JobThreadController.java
│ ├── monitor
│ │ ├── ServerController.java
│ │ ├── SysLogininforController.java
│ │ ├── SysOperlogController.java
│ │ └── SysUserOnlineController.java
│ ├── system
│ │ ├── SysConfigController.java
│ │ ├── SysDeptController.java
│ │ ├── SysDictDataController.java
│ │ ├── SysDictTypeController.java
│ │ ├── SysLoginController.java
│ │ ├── SysMenuController.java
│ │ ├── SysNoticeController.java
│ │ ├── SysPostController.java
│ │ ├── SysProfileController.java
│ │ ├── SysRoleController.java
│ │ ├── SysSettingController.java
│ │ └── SysUserController.java
│ └── tool
│ │ ├── SwaggerController.java
│ │ └── TestController.java
│ └── core
│ └── config
│ └── SwaggerConfig.java
└── resources
├── META-INF
└── spring-devtools.properties
├── application-dev.yml
├── application-prod.yml
├── application-test.yml
├── application.yml
├── banner.txt
├── i18n
├── message.properties
├── message_en.properties
└── messages.properties
└── logback-spring.xml
/.gitignore:
--------------------------------------------------------------------------------
1 | # Compiled class file
2 | *.class
3 |
4 | # Log file
5 | *.log
6 |
7 | # BlueJ files
8 | *.ctxt
9 |
10 | # Mobile Tools for Java (J2ME)
11 | .mtj.tmp/
12 |
13 | # Package Files #
14 | *.jar
15 | *.war
16 | *.nar
17 | *.ear
18 | *.zip
19 | *.tar.gz
20 | *.rar
21 |
22 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
23 | hs_err_pid*
24 |
25 | ######################################################################
26 | # Build Tools
27 |
28 | .gradle
29 | /build/
30 | !gradle/wrapper/gradle-wrapper.jar
31 |
32 | target/
33 | !.mvn/wrapper/maven-wrapper.jar
34 |
35 | ######################################################################
36 | # IDE
37 |
38 | ### STS ###
39 | .apt_generated
40 | .classpath
41 | .factorypath
42 | .project
43 | .settings
44 | .springBeans
45 |
46 | ### IntelliJ IDEA ###
47 | .idea
48 | *.iws
49 | *.iml
50 | *.ipr
51 |
52 | ### NetBeans ###
53 | nbproject/private/
54 | build/*
55 | nbbuild/
56 | logs/
57 | dist/
58 | nbdist/
59 | .nb-gradle/
60 |
61 | ######################################################################
62 | # Others
63 | *.xml.versionsBackup
64 | *.swp
65 |
66 | !*/build/*.java
67 | !*/build/*.html
68 | !*/build/*.xml
69 |
--------------------------------------------------------------------------------
/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM mskj/java8-base
2 |
3 | ENV AppName="smart-job" JARGcLogPath="/data/logs/${AppName}" Target="smart-job-web/target" JarName="smart-job-1.0.0.jar"
4 |
5 | #captcher 字体包
6 | RUN set -xe \
7 | && apk add ttf-dejavu fontconfig
8 |
9 | WORKDIR /data
10 |
11 | COPY docker-entrypoint.sh .
12 |
13 | COPY ${Target}/${JarName} .
14 |
15 | CMD ["sh","+x","docker-entrypoint.sh"]
16 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 smart-coding-team
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/doc/data/bin/.env:
--------------------------------------------------------------------------------
1 | ########## 系统配置项 ############
2 | network_mode=host
3 | restart_mode=always
4 | host_data_dir=../
5 | ########## mysql配置项 ############
6 | mysql_ip=127.0.0.1
7 | mysql_user=root
8 | mysql_password=xwyXNlwVflXHl2pyR1SY
9 | mysql_port=3306
10 |
11 | ########## redis配置项 ############
12 | redis_ip=127.0.0.1
13 | redis_port=6379
14 | redis02_port=6380
15 | redis_password=E0haI233FNsFgekW
16 | #redis 集群模式开关,no:单机模式 yes:集群模式
17 | redis_cluster_status=no
18 |
19 |
20 |
--------------------------------------------------------------------------------
/doc/data/bin/initsql.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | ## sql文件拷贝到容器中
4 | SHHOME=$(pwd)
5 | BASE_DIR=$(cd `dirname $0`/..; pwd)
6 | docker cp ${BASE_DIR}/config/smart-job.sql mysql:/tmp/
7 |
8 |
9 | ## 登录mysql
10 | docker exec -it mysql bash -c 'mysql -uroot -pxwyXNlwVflXHl2pyR1SY'
11 |
12 | ## 执行执行初始化sql
13 | source /tmp/smart-job.sql
14 |
15 |
16 |
--------------------------------------------------------------------------------
/doc/data/bin/nginx.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | #===============================================================================
4 | # SYSTEM REQUIRED: Linux Centos7
5 | # DESCRIPTION: docker 容器部署
6 | # AUTHOR: wuque
7 | #===============================================================================
8 |
9 | stty erase '^H'
10 |
11 | function echoPlus(){
12 | # 增强显示
13 | # @param color (31|91 红 32|92绿 33|93黄 34|94蓝 35|95紫 36|96天蓝)
14 | # @param content
15 | local colorCode=$1
16 | local content=$2
17 |
18 | echo -e "\e[${colorCode}m${content}\e[0m"
19 | }
20 |
21 | function log_error() {
22 | echo -e "\033[31m [ERROR] $@ \033[0m"
23 | }
24 |
25 | function log_info() {
26 | echo -e "\033[32m [INFO] $@ \033[0m"
27 | }
28 |
29 |
30 | function check() {
31 | docker exec -it nginx /bin/bash -c 'cd sbin/ && ./nginx -t'
32 | }
33 |
34 | function load() {
35 |
36 | docker exec -it nginx /bin/bash -c 'cd sbin/ && ./nginx -s reload'
37 | }
38 | case "$1" in
39 |
40 | -t)
41 | (check )
42 | ;;
43 | -s)
44 | (load )
45 | ;;
46 |
47 | esac
48 | if [ $# -eq 0 ]; then
49 | cat << EOF
50 | +-------------------------------------------------+
51 | nginx
52 | nginx 语法检查: -t
53 | nginx 配置重新加载: -s
54 |
55 | +-------------------------------------------------+
56 | EOF
57 | echo -n "请输入:"
58 |
59 |
60 | fi
61 |
62 |
63 |
--------------------------------------------------------------------------------
/doc/data/docker-compose/docker-compose:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/data/docker-compose/docker-compose
--------------------------------------------------------------------------------
/doc/data/docker/docker-19.03.9.tgz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/data/docker/docker-19.03.9.tgz
--------------------------------------------------------------------------------
/doc/data/docker/docker.service:
--------------------------------------------------------------------------------
1 | [Unit]
2 | Description=Docker Application Container Engine
3 | Documentation=https://docs.docker.com
4 | After=network-online.target
5 | Wants=network-online.target
6 |
7 | [Service]
8 | Type=notify
9 | ExecStart=/usr/bin/dockerd
10 | ExecReload=/bin/kill -s HUP $MAINPID
11 | LimitNOFILE=infinity
12 | LimitNPROC=infinity
13 | TimeoutStartSec=0
14 | Delegate=yes
15 | KillMode=process
16 | Restart=on-failure
17 | StartLimitBurst=3
18 | StartLimitInterval=60s
19 |
20 | [Install]
21 | WantedBy=multi-user.target
22 |
--------------------------------------------------------------------------------
/doc/data/nginx/conf.d/job.xxx.com.conf:
--------------------------------------------------------------------------------
1 | server {
2 | listen 80;
3 | server_name smart-job.com;
4 | # ssl_certificate /usr/local/nginx/conf.d/ssl_keys/xxx.cc.pem;
5 | # ssl_certificate_key /usr/local/nginx/conf.d/ssl_keys/xxx.cc.key;
6 | # ssl_session_timeout 5m;
7 | # ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
8 | # ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
9 | # ssl_prefer_server_ciphers on;
10 | proxy_buffering off;
11 | ignore_invalid_headers off;
12 | access_log "pipe:rollback /usr/local/nginx/logs/access_apm.log interval=24h baknum=2 maxsize=2G" access;
13 |
14 | location / {
15 | root /usr/local/html/job-html;
16 | index index.html;
17 | try_files $uri /index.html;
18 | expires 0;
19 | add_header Cache-Control no-cache;
20 | add_header Cache-Control private;
21 | }
22 |
23 | location /api {
24 | proxy_pass http://127.0.0.1:7040;
25 | proxy_set_header Host $host;
26 | proxy_set_header X-Real-IP $remote_addr;
27 | proxy_set_header X-Forwarded-Proto $scheme;
28 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
29 | proxy_http_version 1.1;
30 | proxy_set_header Connection "";
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/doc/image/bitbug_favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/bitbug_favicon.ico
--------------------------------------------------------------------------------
/doc/image/pay100.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/pay100.jpeg
--------------------------------------------------------------------------------
/doc/image/pay20.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/pay20.jpeg
--------------------------------------------------------------------------------
/doc/image/pay50.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/pay50.jpeg
--------------------------------------------------------------------------------
/doc/image/smart-job-logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/smart-job-logo.png
--------------------------------------------------------------------------------
/doc/image/smart-job部署架构图.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/smart-job部署架构图.png
--------------------------------------------------------------------------------
/doc/image/任务列表-注册节点.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/任务列表-注册节点.png
--------------------------------------------------------------------------------
/doc/image/任务执行器.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/任务执行器.png
--------------------------------------------------------------------------------
/doc/image/任务日志.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/任务日志.png
--------------------------------------------------------------------------------
/doc/image/任务管理.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/任务管理.png
--------------------------------------------------------------------------------
/doc/image/任务编辑.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/任务编辑.png
--------------------------------------------------------------------------------
/doc/image/告警记录.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/告警记录.png
--------------------------------------------------------------------------------
/doc/image/告警配置.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/告警配置.png
--------------------------------------------------------------------------------
/doc/image/用户管理.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/用户管理.png
--------------------------------------------------------------------------------
/doc/image/登录页面.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/登录页面.png
--------------------------------------------------------------------------------
/doc/image/角色管理.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/角色管理.png
--------------------------------------------------------------------------------
/doc/image/调度管理.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/调度管理.png
--------------------------------------------------------------------------------
/doc/image/首页.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/doc/image/首页.png
--------------------------------------------------------------------------------
/docker-entrypoint.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | PID=springboot.pid
3 | JAVA_OPTS=" -Duser.timezone=Asia/Shanghai -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8"
4 | JAVA_OPTS="${JAVA_OPTS} -verbose:gc -Xloggc:${GcLogPath}/gc.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:ErrorFile=${GcLogPath}/hs_err_pid_%p.log"
5 | JAVA_MEM_OPTS=" -XX:+UseG1GC -Xms${JAVA_XMX-512m} -Xmx${JAVA_XMX-512m} -Xmn${JAVA_XMN-256m} -XX:+AlwaysPreTouch -XX:-UseBiasedLocking -XX:G1HeapRegionSize=16m"
6 | JAVA_OPTS="$JAVA_OPTS $JAVA_MEM_OPTS"
7 | SPRING_OPTS=" --spring.profiles.active=${ACTIVE_PROFILE-prod}"
8 |
9 | function echoPlus(){
10 | # 增强显示
11 | # @param color (31|91 红 32|92绿 33|93黄 34|94蓝 35|95紫 36|96天蓝)
12 | # @param content
13 | local colorCode=$1
14 | local content=$2
15 |
16 | echo -e "\e[${colorCode}m${content}\e[0m"
17 | }
18 |
19 |
20 | echoPlus 33 "[check] 即将启动Springboot......"
21 |
22 |
23 | java ${JAVA_OPTS} -jar ${JarName} ${SPRING_OPTS}
24 |
--------------------------------------------------------------------------------
/smart-job-common/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/smart-job-common/.DS_Store
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/annotation/DataScope.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.annotation;
2 |
3 | import java.lang.annotation.*;
4 |
5 | /**
6 | * 数据权限过滤注解
7 | *
8 | * @author wuque
9 | */
10 | @Target(ElementType.METHOD)
11 | @Retention(RetentionPolicy.RUNTIME)
12 | @Documented
13 | public @interface DataScope {
14 | /**
15 | * 部门表的别名
16 | */
17 | public String deptAlias() default "";
18 |
19 | /**
20 | * 用户表的别名
21 | */
22 | public String userAlias() default "";
23 | }
24 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/annotation/DataSource.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.annotation;
2 |
3 | import cn.smartcoding.common.enums.DataSourceType;
4 |
5 | import java.lang.annotation.*;
6 |
7 | /**
8 | * 自定义多数据源切换注解
9 | *
10 | * 优先级:先方法,后类,如果方法覆盖了类上的数据源类型,以方法的为准,否则以类上的为准
11 | *
12 | * @author wuque
13 | */
14 | @Target({ElementType.METHOD, ElementType.TYPE})
15 | @Retention(RetentionPolicy.RUNTIME)
16 | @Documented
17 | @Inherited
18 | public @interface DataSource {
19 | /**
20 | * 切换数据源名称
21 | */
22 | public DataSourceType value() default DataSourceType.MASTER;
23 | }
24 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/annotation/Excels.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.annotation;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | /**
9 | * Excel注解集
10 | *
11 | * @author wuque
12 | */
13 | @Target(ElementType.FIELD)
14 | @Retention(RetentionPolicy.RUNTIME)
15 | public @interface Excels {
16 | Excel[] value();
17 | }
18 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/annotation/Log.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.annotation;
2 |
3 | import cn.smartcoding.common.enums.BusinessType;
4 | import cn.smartcoding.common.enums.OperatorType;
5 |
6 | import java.lang.annotation.*;
7 |
8 | /**
9 | * 自定义操作日志记录注解
10 | *
11 | * @author wuque
12 | */
13 | @Target({ElementType.PARAMETER, ElementType.METHOD})
14 | @Retention(RetentionPolicy.RUNTIME)
15 | @Documented
16 | public @interface Log {
17 | /**
18 | * 模块
19 | */
20 | public String title() default "";
21 |
22 | /**
23 | * 功能
24 | */
25 | public BusinessType businessType() default BusinessType.OTHER;
26 |
27 | /**
28 | * 操作人类别
29 | */
30 | public OperatorType operatorType() default OperatorType.MANAGE;
31 |
32 | /**
33 | * 是否保存请求的参数
34 | */
35 | public boolean isSaveRequestData() default true;
36 | }
37 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/annotation/RepeatSubmit.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.annotation;
2 |
3 | import java.lang.annotation.*;
4 |
5 | /**
6 | * 自定义注解防止表单重复提交
7 | *
8 | * @author wuque
9 | */
10 | @Inherited
11 | @Target(ElementType.METHOD)
12 | @Retention(RetentionPolicy.RUNTIME)
13 | @Documented
14 | public @interface RepeatSubmit {
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/constant/ScheduleConstants.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.constant;
2 |
3 | /**
4 | * 任务调度通用常量
5 | *
6 | * @author wuque
7 | */
8 | public class ScheduleConstants {
9 | public static final String TASK_CLASS_NAME = "TASK_CLASS_NAME";
10 |
11 | /**
12 | * 执行目标key
13 | */
14 | public static final String TASK_PROPERTIES = "TASK_PROPERTIES";
15 |
16 | /**
17 | * 默认
18 | */
19 | public static final String MISFIRE_DEFAULT = "0";
20 |
21 | /**
22 | * 立即触发执行
23 | */
24 | public static final String MISFIRE_IGNORE_MISFIRES = "1";
25 |
26 | /**
27 | * 触发一次执行
28 | */
29 | public static final String MISFIRE_FIRE_AND_PROCEED = "2";
30 |
31 | /**
32 | * 不触发立即执行
33 | */
34 | public static final String MISFIRE_DO_NOTHING = "3";
35 |
36 | public enum Status {
37 | /**
38 | * 正常
39 | */
40 | NORMAL("0"),
41 | /**
42 | * 暂停
43 | */
44 | PAUSE("1");
45 |
46 | private String value;
47 |
48 | private Status(String value) {
49 | this.value = value;
50 | }
51 |
52 | public String getValue() {
53 | return value;
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/core/captcha/CaptchaCodeEnum.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2019-2020 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package cn.smartcoding.common.core.captcha;
17 |
18 | /**
19 | * 验证码配置枚举
20 | *
21 | * @author: liaojinlong
22 | * @date: 2020/6/10 17:40
23 | */
24 |
25 | public enum CaptchaCodeEnum {
26 | /**
27 | * 算数
28 | */
29 | arithmetic,
30 | /**
31 | * 中文
32 | */
33 | chinese,
34 | /**
35 | * 中文闪图
36 | */
37 | chinese_gif,
38 | /**
39 | * 闪图
40 | */
41 | gif,
42 | /**
43 | * 数字+字母
44 | */
45 | spec
46 | }
47 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/core/domain/AccountCreateEnum.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.core.domain;
2 |
3 | /**
4 | * 帐号创建类型
5 | */
6 | public enum AccountCreateEnum {
7 | /**
8 | * 系统
9 | */
10 | SYS(0, "系统"),
11 | /**
12 | * ldap
13 | */
14 | LDAP(1, "ldap");
15 |
16 |
17 | AccountCreateEnum(int code, String title) {
18 | this.code = code;
19 | this.title = title;
20 | }
21 |
22 | private int code;
23 | private String title;
24 |
25 | public String getTitle() {
26 | return title;
27 | }
28 |
29 | public int getCode() {
30 | return code;
31 | }
32 |
33 | public static AccountCreateEnum fromCode(Integer code, AccountCreateEnum defaultEnum) {
34 | if (code == null) {
35 | return defaultEnum;
36 | }
37 | AccountCreateEnum[] values = AccountCreateEnum.values();
38 | for (AccountCreateEnum value : values) {
39 | if (value.getCode() == code) {
40 | return value;
41 | }
42 | }
43 | return defaultEnum;
44 | }
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/core/domain/AccountStatusEnum.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.core.domain;
2 |
3 | /**
4 | * 帐号状态
5 | */
6 | public enum AccountStatusEnum {
7 |
8 | /**
9 | * 正常
10 | */
11 | OK(0, "正常"),
12 | /**
13 | * 停用
14 | */
15 | STOP(1, "停用"),
16 | /**
17 | * 锁定
18 | */
19 | LOCK(2, "锁定");
20 |
21 |
22 | AccountStatusEnum(int code, String title) {
23 | this.code = code;
24 | this.title = title;
25 | }
26 |
27 | private int code;
28 | private String title;
29 |
30 | public String getTitle() {
31 | return title;
32 | }
33 |
34 | public int getCode() {
35 | return code;
36 | }
37 |
38 | public static AccountStatusEnum fromCode(Integer code, AccountStatusEnum defaultEnum) {
39 | if (code == null) {
40 | return defaultEnum;
41 | }
42 | AccountStatusEnum[] values = AccountStatusEnum.values();
43 | for (AccountStatusEnum value : values) {
44 | if (value.getCode() == code) {
45 | return value;
46 | }
47 | }
48 | return defaultEnum;
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/core/domain/IErrorCode.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.core.domain;
2 |
3 | /**
4 | * 返回状态码
5 | */
6 | public interface IErrorCode {
7 |
8 | int getCode();
9 |
10 | String getMessage();
11 | }
12 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/core/domain/util/ResultModelUtils.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.core.domain.util;
2 |
3 | import cn.smartcoding.common.core.domain.ResultModel;
4 |
5 | public class ResultModelUtils {
6 |
7 | /**
8 | * 响应返回结果
9 | *
10 | * @param rows 影响行数
11 | * @return 操作结果
12 | */
13 | public static ResultModel toAjax(int rows) {
14 | return rows > 0 ? ResultModel.success() : ResultModel.fail();
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/core/page/TableSupport.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.core.page;
2 |
3 | import cn.smartcoding.common.utils.ServletUtils;
4 |
5 | /**
6 | * 表格数据处理
7 | *
8 | * @author wuque
9 | */
10 | public class TableSupport {
11 | /**
12 | * 当前记录起始索引
13 | */
14 | public static final String PAGE_NUM = "pageNum";
15 |
16 | /**
17 | * 每页显示记录数
18 | */
19 | public static final String PAGE_SIZE = "pageSize";
20 |
21 | /**
22 | * 排序列
23 | */
24 | public static final String ORDER_BY_COLUMN = "orderByColumn";
25 |
26 | /**
27 | * 排序的方向 "desc" 或者 "asc".
28 | */
29 | public static final String IS_ASC = "isAsc";
30 |
31 | /**
32 | * 封装分页对象
33 | */
34 | public static PageDomain getPageDomain() {
35 | PageDomain pageDomain = new PageDomain();
36 | pageDomain.setPageNum(ServletUtils.getParameterToInt(PAGE_NUM));
37 | pageDomain.setPageSize(ServletUtils.getParameterToInt(PAGE_SIZE));
38 | pageDomain.setOrderByColumn(ServletUtils.getParameter(ORDER_BY_COLUMN));
39 | pageDomain.setIsAsc(ServletUtils.getParameter(IS_ASC));
40 | return pageDomain;
41 | }
42 |
43 | public static PageDomain buildPageRequest() {
44 | return getPageDomain();
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/enums/BusinessStatus.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.enums;
2 |
3 | /**
4 | * 操作状态
5 | *
6 | * @author wuque
7 | */
8 | public enum BusinessStatus {
9 | /**
10 | * 成功
11 | */
12 | SUCCESS,
13 |
14 | /**
15 | * 失败
16 | */
17 | FAIL,
18 | }
19 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/enums/BusinessType.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.enums;
2 |
3 | /**
4 | * 业务操作类型
5 | *
6 | * @author wuque
7 | */
8 | public enum BusinessType {
9 | /**
10 | * 其它
11 | */
12 | OTHER,
13 |
14 | /**
15 | * 新增
16 | */
17 | INSERT,
18 |
19 | /**
20 | * 修改
21 | */
22 | UPDATE,
23 |
24 | /**
25 | * 删除
26 | */
27 | DELETE,
28 |
29 | /**
30 | * 授权
31 | */
32 | GRANT,
33 |
34 | /**
35 | * 导出
36 | */
37 | EXPORT,
38 |
39 | /**
40 | * 导入
41 | */
42 | IMPORT,
43 |
44 | /**
45 | * 强退
46 | */
47 | FORCE,
48 |
49 | /**
50 | * 生成代码
51 | */
52 | GENCODE,
53 |
54 | /**
55 | * 清空数据
56 | */
57 | CLEAN,
58 | /**
59 | * 运行
60 | */
61 | RUN,
62 | /**
63 | * 查询
64 | */
65 | QUERY,
66 | }
67 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/enums/DataSourceType.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.enums;
2 |
3 | /**
4 | * 数据源
5 | *
6 | * @author wuque
7 | */
8 | public enum DataSourceType {
9 | /**
10 | * 主库
11 | */
12 | MASTER,
13 |
14 | /**
15 | * 从库
16 | */
17 | SLAVE
18 | }
19 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/enums/HttpMethod.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.enums;
2 |
3 | import org.springframework.lang.Nullable;
4 |
5 | import java.util.HashMap;
6 | import java.util.Map;
7 |
8 | /**
9 | * 请求方式
10 | *
11 | * @author wuque
12 | */
13 | public enum HttpMethod {
14 | GET, HEAD, POST, PUT, PATCH, DELETE, OPTIONS, TRACE;
15 |
16 | private static final Map mappings = new HashMap<>(16);
17 |
18 | static {
19 | for (HttpMethod httpMethod : values()) {
20 | mappings.put(httpMethod.name(), httpMethod);
21 | }
22 | }
23 |
24 | @Nullable
25 | public static HttpMethod resolve(@Nullable String method) {
26 | return (method != null ? mappings.get(method) : null);
27 | }
28 |
29 | public boolean matches(String method) {
30 | return (this == resolve(method));
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/enums/OperatorType.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.enums;
2 |
3 | /**
4 | * 操作人类别
5 | *
6 | * @author wuque
7 | */
8 | public enum OperatorType {
9 | /**
10 | * 其它
11 | */
12 | OTHER,
13 |
14 | /**
15 | * 后台用户
16 | */
17 | MANAGE,
18 |
19 | /**
20 | * 手机端用户
21 | */
22 | MOBILE
23 | }
24 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/enums/UserStatus.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.enums;
2 |
3 | /**
4 | * 用户状态
5 | *
6 | * @author wuque
7 | */
8 | public enum UserStatus {
9 | OK("0", "正常"), DISABLE("1", "停用"), DELETED("2", "删除");
10 |
11 | private final String code;
12 | private final String info;
13 |
14 | UserStatus(String code, String info) {
15 | this.code = code;
16 | this.info = info;
17 | }
18 |
19 | public String getCode() {
20 | return code;
21 | }
22 |
23 | public String getInfo() {
24 | return info;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/exception/CustomException.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.exception;
2 |
3 | /**
4 | * 自定义异常
5 | *
6 | * @author wuque
7 | */
8 | public class CustomException extends RuntimeException {
9 | private static final long serialVersionUID = 1L;
10 |
11 | private Integer code;
12 |
13 | private String message;
14 |
15 | public CustomException(String message) {
16 | this.message = message;
17 | }
18 |
19 | public CustomException(String message, Integer code) {
20 | this.message = message;
21 | this.code = code;
22 | }
23 |
24 | public CustomException(String message, Throwable e) {
25 | super(message, e);
26 | this.message = message;
27 | }
28 |
29 | @Override
30 | public String getMessage() {
31 | return message;
32 | }
33 |
34 | public Integer getCode() {
35 | return code;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/exception/DemoModeException.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.exception;
2 |
3 | /**
4 | * 演示模式异常
5 | *
6 | * @author wuque
7 | */
8 | public class DemoModeException extends RuntimeException {
9 | private static final long serialVersionUID = 1L;
10 |
11 | public DemoModeException() {
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/exception/UtilException.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.exception;
2 |
3 | /**
4 | * 工具类异常
5 | *
6 | * @author wuque
7 | */
8 | public class UtilException extends RuntimeException {
9 | private static final long serialVersionUID = 8247610319171014183L;
10 |
11 | public UtilException(Throwable e) {
12 | super(e.getMessage(), e);
13 | }
14 |
15 | public UtilException(String message) {
16 | super(message);
17 | }
18 |
19 | public UtilException(String message, Throwable throwable) {
20 | super(message, throwable);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/exception/file/FileException.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.exception.file;
2 |
3 | import cn.smartcoding.common.exception.BaseException;
4 |
5 | /**
6 | * 文件信息异常类
7 | *
8 | * @author wuque
9 | */
10 | public class FileException extends BaseException {
11 | private static final long serialVersionUID = 1L;
12 |
13 | public FileException(String code, Object[] args) {
14 | super("file", code, args, null);
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/exception/file/FileNameLengthLimitExceededException.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.exception.file;
2 |
3 | /**
4 | * 文件名称超长限制异常类
5 | *
6 | * @author wuque
7 | */
8 | public class FileNameLengthLimitExceededException extends FileException {
9 | private static final long serialVersionUID = 1L;
10 |
11 | public FileNameLengthLimitExceededException(int defaultFileNameLength) {
12 | super("upload.filename.exceed.length", new Object[]{defaultFileNameLength});
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/exception/file/FileSizeLimitExceededException.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.exception.file;
2 |
3 | /**
4 | * 文件名大小限制异常类
5 | *
6 | * @author wuque
7 | */
8 | public class FileSizeLimitExceededException extends FileException {
9 | private static final long serialVersionUID = 1L;
10 |
11 | public FileSizeLimitExceededException(long defaultMaxSize) {
12 | super("upload.exceed.maxSize", new Object[]{defaultMaxSize});
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/exception/job/TaskException.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.exception.job;
2 |
3 | /**
4 | * 计划策略异常
5 | *
6 | * @author wuque
7 | */
8 | public class TaskException extends Exception {
9 | private static final long serialVersionUID = 1L;
10 |
11 | private Code code;
12 |
13 | public TaskException(String msg, Code code) {
14 | this(msg, code, null);
15 | }
16 |
17 | public TaskException(String msg, Code code, Exception nestedEx) {
18 | super(msg, nestedEx);
19 | this.code = code;
20 | }
21 |
22 | public Code getCode() {
23 | return code;
24 | }
25 |
26 | public enum Code {
27 | TASK_EXISTS, NO_TASK_EXISTS, TASK_ALREADY_STARTED, UNKNOWN, CONFIG_ERROR, TASK_NODE_NOT_AVAILABLE
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/exception/user/UserException.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.exception.user;
2 |
3 | import cn.smartcoding.common.exception.BaseException;
4 |
5 | /**
6 | * 用户信息异常类
7 | *
8 | * @author wuque
9 | */
10 | public class UserException extends BaseException {
11 | private static final long serialVersionUID = 1L;
12 |
13 | public UserException(String code, Object[] args) {
14 | super("user", code, args, null);
15 | }
16 |
17 | public UserException(String code, Object[] args, String message) {
18 | super("user", code, args, message);
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/exception/user/UserPasswordNotMatchException.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.exception.user;
2 |
3 | /**
4 | * 用户密码不正确或不符合规范异常类
5 | *
6 | * @author wuque
7 | */
8 | public class UserPasswordNotMatchException extends UserException {
9 | private static final long serialVersionUID = 1L;
10 |
11 | public UserPasswordNotMatchException() {
12 | super("user.password.not.match", null);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/filter/RepeatableFilter.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.filter;
2 |
3 | import cn.smartcoding.common.utils.StringUtils;
4 | import org.springframework.http.MediaType;
5 |
6 | import javax.servlet.*;
7 | import javax.servlet.http.HttpServletRequest;
8 | import java.io.IOException;
9 |
10 | /**
11 | * Repeatable 过滤器
12 | *
13 | * @author wuque
14 | */
15 | public class RepeatableFilter implements Filter {
16 | @Override
17 | public void init(FilterConfig filterConfig) throws ServletException {
18 |
19 | }
20 |
21 | @Override
22 | public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
23 | throws IOException, ServletException {
24 | ServletRequest requestWrapper = null;
25 | if (request instanceof HttpServletRequest && StringUtils.equalsAnyIgnoreCase(request.getContentType(),
26 | MediaType.APPLICATION_JSON_VALUE, MediaType.APPLICATION_JSON_UTF8_VALUE)) {
27 | requestWrapper = new RepeatedlyRequestWrapper((HttpServletRequest) request, response);
28 | }
29 | if (null == requestWrapper) {
30 | chain.doFilter(request, response);
31 | } else {
32 | chain.doFilter(requestWrapper, response);
33 | }
34 | }
35 |
36 | @Override
37 | public void destroy() {
38 |
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/robot/enums/NotifyMsgTypeEnum.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.robot.enums;
2 |
3 | /**
4 | * 响应的消息类型
5 | *
6 | * @author qingshi
7 | * @email 705029004@qq.com
8 | * @date 2020/02/06- 8:51 下午
9 | */
10 | public enum NotifyMsgTypeEnum {
11 | /**
12 | * text消息
13 | */
14 | TEXT,
15 | /**
16 | * markdown消息
17 | */
18 | MARKDOWN,
19 | /**
20 | * link消息
21 | */
22 | LINK,
23 | /**
24 | * IMAGE图片消息
25 | */
26 | IMAGE,
27 | /**
28 | * news图文消息
29 | */
30 | NEWS,
31 | /**
32 | * feedCard消息
33 | */
34 | FEED_CARD,
35 |
36 | /**
37 | * actionCard 图文消息
38 | */
39 | ACTION_CARD;
40 | }
41 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/robot/enums/NotifyRobotEnum.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.robot.enums;
2 |
3 | import lombok.Getter;
4 |
5 | import java.util.Arrays;
6 | import java.util.List;
7 |
8 | /**
9 | * 发送的服务类型
10 | *
11 | * @author qingshi
12 | * @email 705029004@qq.com
13 | * @date 2020/02/06- 8:49 下午
14 | */
15 | @Getter
16 | public enum NotifyRobotEnum {
17 | /**
18 | * 企业微信机器人
19 | */
20 | CORP_WECHAT(0, "企业微信机器人", Arrays.asList(NotifyMsgTypeEnum.TEXT, NotifyMsgTypeEnum.MARKDOWN, NotifyMsgTypeEnum.LINK, NotifyMsgTypeEnum.NEWS, NotifyMsgTypeEnum.IMAGE)),
21 | /**
22 | * 钉钉机器人
23 | */
24 | DINGDING(1, "钉钉机器人", Arrays.asList(NotifyMsgTypeEnum.TEXT, NotifyMsgTypeEnum.MARKDOWN, NotifyMsgTypeEnum.LINK, NotifyMsgTypeEnum.FEED_CARD, NotifyMsgTypeEnum.ACTION_CARD));
25 |
26 | private int code;
27 | private String desc;
28 | /**
29 | * 支持的通知
30 | */
31 | private List supports;
32 |
33 | NotifyRobotEnum(int code, String desc, List supports) {
34 | this.code = code;
35 | this.desc = desc;
36 | this.supports = supports;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/robot/exception/WebHookRobotIllegalArgumentException.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.robot.exception;
2 |
3 | import lombok.Getter;
4 |
5 | /**
6 | * 通用异常
7 | *
8 | * @author qingshi
9 | * @email 705029004@qq.com
10 | * @date 2020/02/07- 3:15 下午
11 | */
12 | @Getter
13 | public class WebHookRobotIllegalArgumentException extends RuntimeException {
14 | protected int code = 100403;
15 | protected String message;
16 |
17 | public WebHookRobotIllegalArgumentException(String message) {
18 | super(message);
19 | this.message = message;
20 | }
21 |
22 | public WebHookRobotIllegalArgumentException(int code, String message) {
23 | this.code = code;
24 | this.message = message;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/robot/exception/WebHookRobotResponseException.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.robot.exception;
2 |
3 | import lombok.Getter;
4 |
5 | /**
6 | * 通用异常
7 | *
8 | * @author qingshi
9 | * @email 705029004@qq.com
10 | * @date 2020/02/07- 3:15 下午
11 | */
12 | @Getter
13 | public class WebHookRobotResponseException extends RuntimeException {
14 | protected int code = 100402;
15 | protected String message;
16 |
17 | public WebHookRobotResponseException(String message) {
18 | super(message);
19 | this.message = message;
20 | }
21 |
22 | public WebHookRobotResponseException(int code, String message) {
23 | this.code = code;
24 | this.message = message;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/robot/exception/WebHookRobotValidateException.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.robot.exception;
2 |
3 | import lombok.Getter;
4 |
5 | /**
6 | * 通用异常
7 | *
8 | * @author qingshi
9 | * @email 705029004@qq.com
10 | * @date 2020/02/07- 3:15 下午
11 | */
12 | @Getter
13 | public class WebHookRobotValidateException extends RuntimeException {
14 | protected int code = 100401;
15 | protected String message;
16 |
17 | public WebHookRobotValidateException(String message) {
18 | super(message);
19 | this.message = message;
20 | }
21 |
22 | public WebHookRobotValidateException(int code, String message) {
23 | this.code = code;
24 | this.message = message;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/robot/model/message/Message.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.robot.model.message;
2 |
3 | /**
4 | * 消息接口
5 | *
6 | * @author qingshi
7 | * @email 705029004@qq.com
8 | * @date 2020/02/07- 9:40 下午
9 | */
10 | public interface Message {
11 |
12 | /**
13 | * 返回消息的Json格式字符串
14 | *
15 | * @return 消息的Json格式字符串
16 | */
17 | String toJsonString();
18 | }
19 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/robot/model/message/dingding/enums/BtnOrientationTypeEnum.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.robot.model.message.dingding.enums;
2 |
3 | public enum BtnOrientationTypeEnum {
4 | /**
5 | * 0-按钮竖直排列
6 | */
7 | VERTICAL("0"),
8 | /**
9 | * 1-按钮横向排列
10 | */
11 | TRANSVERSE("1");
12 |
13 | private String code;
14 |
15 | BtnOrientationTypeEnum(String code) {
16 | this.code = code;
17 | }
18 |
19 | public static String formCode(String code) {
20 | if (code == null) {
21 | return null;
22 | }
23 | for (BtnOrientationTypeEnum value : BtnOrientationTypeEnum.values()) {
24 | if (value.code.endsWith(code)) {
25 | return code;
26 | }
27 | }
28 | return null;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/robot/model/message/dingding/enums/HideAvatarTypeEnums.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.robot.model.message.dingding.enums;
2 |
3 | public enum HideAvatarTypeEnums {
4 | /**
5 | * 0-正常发消息者头像
6 | */
7 | SHOW("0"),
8 | /**
9 | * 1-隐藏发消息者头像
10 | */
11 | HIDE("1");
12 |
13 | private String code;
14 |
15 | HideAvatarTypeEnums(String code) {
16 | this.code = code;
17 | }
18 |
19 | public static String formCode(String code) {
20 | if (code == null) {
21 | return null;
22 | }
23 | for (HideAvatarTypeEnums value : HideAvatarTypeEnums.values()) {
24 | if (value.code.endsWith(code)) {
25 | return code;
26 | }
27 | }
28 | return null;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/robot/model/message/wx/WxMarkdownMessage.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.robot.model.message.wx;
2 |
3 | import cn.smartcoding.common.robot.model.message.Message;
4 | import com.alibaba.fastjson.JSON;
5 | import lombok.Data;
6 |
7 | import java.util.ArrayList;
8 | import java.util.HashMap;
9 | import java.util.List;
10 | import java.util.Map;
11 |
12 | @Data
13 | public class WxMarkdownMessage implements Message {
14 |
15 | private List items = new ArrayList();
16 |
17 | public void add(String text) {
18 | items.add(text);
19 | }
20 |
21 |
22 | @Override
23 | public String toJsonString() {
24 | Map result = new HashMap();
25 | result.put("msgtype", "markdown");
26 |
27 | Map markdown = new HashMap();
28 |
29 | StringBuilder markdownText = new StringBuilder();
30 | for (String item : items) {
31 | markdownText.append(item).append("\n");
32 | }
33 | markdown.put("content", markdownText.toString());
34 | result.put("markdown", markdown);
35 |
36 | return JSON.toJSONString(result);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/robot/model/message/wx/news/WxNewsArticle.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.robot.model.message.wx.news;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Builder;
5 | import lombok.Data;
6 | import lombok.NoArgsConstructor;
7 |
8 | @Data
9 | @NoArgsConstructor
10 | @AllArgsConstructor
11 | @Builder
12 | public class WxNewsArticle {
13 | private String title;
14 | private String description;
15 | private String picurl;
16 | private String url;
17 | }
18 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/robot/model/request/ActionCardRequest.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.robot.model.request;
2 |
3 | import cn.smartcoding.common.robot.enums.NotifyMsgTypeEnum;
4 | import cn.smartcoding.common.robot.enums.NotifyRobotEnum;
5 | import cn.smartcoding.common.robot.model.message.dingding.DingActionCardMessage;
6 | import lombok.Data;
7 | import lombok.experimental.Accessors;
8 |
9 | import java.util.List;
10 |
11 | @Data
12 | @Accessors(chain = true)
13 | public class ActionCardRequest extends BaseNotifyRequest implements RobotNotifyRequest {
14 |
15 | private String title;
16 | private String text;
17 | private String hideAvatar;
18 | private String btnOrientation;
19 | private List btns;
20 |
21 | public ActionCardRequest(String webHook, NotifyRobotEnum notifyRobotEnum) {
22 | super(webHook, notifyRobotEnum);
23 | }
24 |
25 | @Override
26 | public NotifyMsgTypeEnum getMsgType() {
27 | return NotifyMsgTypeEnum.ACTION_CARD;
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/robot/model/request/BaseNotifyRequest.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.robot.model.request;
2 |
3 | import cn.smartcoding.common.robot.enums.NotifyRobotEnum;
4 | import lombok.Data;
5 |
6 | /**
7 | * 请求的详情请看:
8 | * 钉钉: https://ding-doc.dingtalk.com/doc#/serverapi2/qf2nxq
9 | * 微信: https://work.weixin.qq.com/help?person_id=1&doc_id=13376#markdown%E7%B1%BB%E5%9E%8B
10 | *
11 | * @author qingshi
12 | * @email 705029004@qq.com
13 | * @date 2020/02/06- 8:17 下午
14 | */
15 | @Data
16 | public class BaseNotifyRequest {
17 | private String webHook;
18 |
19 | private NotifyRobotEnum notifyRobotEnum;
20 |
21 |
22 | protected BaseNotifyRequest(String webHook, NotifyRobotEnum notifyRobotEnum) {
23 | this.webHook = webHook;
24 | this.notifyRobotEnum = notifyRobotEnum;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/robot/model/request/CardRequest.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.robot.model.request;
2 |
3 | import cn.smartcoding.common.robot.enums.NotifyMsgTypeEnum;
4 | import cn.smartcoding.common.robot.enums.NotifyRobotEnum;
5 | import cn.smartcoding.common.robot.model.message.dingding.DingFeedCardMessage;
6 | import lombok.Data;
7 | import lombok.experimental.Accessors;
8 |
9 | import java.util.List;
10 |
11 | @Data
12 | @Accessors(chain = true)
13 | public class CardRequest extends BaseNotifyRequest implements RobotNotifyRequest {
14 |
15 | private List links;
16 |
17 | public CardRequest(String webHook, NotifyRobotEnum notifyRobotEnum) {
18 | super(webHook, notifyRobotEnum);
19 | }
20 |
21 | @Override
22 | public NotifyMsgTypeEnum getMsgType() {
23 | return NotifyMsgTypeEnum.FEED_CARD;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/robot/model/request/LinkRequest.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.robot.model.request;
2 |
3 | import cn.smartcoding.common.robot.enums.NotifyMsgTypeEnum;
4 | import cn.smartcoding.common.robot.enums.NotifyRobotEnum;
5 | import lombok.Data;
6 | import lombok.experimental.Accessors;
7 |
8 | /**
9 | * link请求
10 | *
11 | * @author qingshi
12 | * @email 705029004@qq.com
13 | * @date 2020/02/07- 9:39 下午
14 | */
15 | @Data
16 | @Accessors(chain = true)
17 | public class LinkRequest extends BaseNotifyRequest implements RobotNotifyRequest {
18 | private String title;
19 | private String text;
20 | private String picUrl;
21 | private String messageUrl;
22 |
23 | public LinkRequest(String webHook, NotifyRobotEnum notifyRobotEnum) {
24 | super(webHook, notifyRobotEnum);
25 | }
26 |
27 | @Override
28 | public NotifyMsgTypeEnum getMsgType() {
29 | return NotifyMsgTypeEnum.LINK;
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/robot/model/request/MarkdownRequest.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.robot.model.request;
2 |
3 | import cn.smartcoding.common.robot.enums.NotifyMsgTypeEnum;
4 | import cn.smartcoding.common.robot.enums.NotifyRobotEnum;
5 | import lombok.Data;
6 | import lombok.experimental.Accessors;
7 |
8 | import java.util.ArrayList;
9 | import java.util.List;
10 |
11 | /**
12 | * MARKDOWN请求,微信和钉钉使用有差异
13 | *
14 | * @author qingshi
15 | * @email 705029004@qq.com
16 | * @date 2020/02/07- 9:40 下午
17 | */
18 | @Data
19 | @Accessors(chain = true)
20 | public class MarkdownRequest extends BaseNotifyRequest implements RobotNotifyRequest {
21 | //wx只有这个字段
22 | //private List items = new ArrayList();
23 |
24 | /**
25 | * DingDing具有的字段
26 | */
27 | private String title;
28 |
29 | private List items = new ArrayList();
30 | /**
31 | * 被@人的手机号(在text内容里要有@手机号)
32 | */
33 | private List atMobileList = new ArrayList<>();
34 | /**
35 | * (@所有人时:true,否则为:false)
36 | */
37 | private boolean isAtAll = false;
38 |
39 | public MarkdownRequest addItem(String item) {
40 | this.items.add(item);
41 | return this;
42 | }
43 |
44 | public MarkdownRequest(String webHook, NotifyRobotEnum notifyRobotEnum) {
45 | super(webHook, notifyRobotEnum);
46 | }
47 |
48 | @Override
49 | public NotifyMsgTypeEnum getMsgType() {
50 | return NotifyMsgTypeEnum.MARKDOWN;
51 | }
52 | }
53 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/robot/model/request/NewsRequest.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.robot.model.request;
2 |
3 | import cn.smartcoding.common.robot.enums.NotifyMsgTypeEnum;
4 | import cn.smartcoding.common.robot.enums.NotifyRobotEnum;
5 | import cn.smartcoding.common.robot.model.message.wx.news.WxNewsArticle;
6 | import lombok.Data;
7 | import lombok.experimental.Accessors;
8 |
9 | import java.util.ArrayList;
10 | import java.util.List;
11 |
12 | /**
13 | * news图文请求
14 | *
15 | * @author qingshi
16 | * @email 705029004@qq.com
17 | * @date 2020/02/07- 9:41 下午
18 | */
19 | @Data
20 | @Accessors(chain = true)
21 | public class NewsRequest extends BaseNotifyRequest implements RobotNotifyRequest {
22 | private List articles = new ArrayList();
23 |
24 | public NewsRequest addArticle(WxNewsArticle wxNewsArticle) {
25 | this.articles.add(wxNewsArticle);
26 | return this;
27 | }
28 |
29 | public NewsRequest(String webHook, NotifyRobotEnum notifyRobotEnum) {
30 | super(webHook, notifyRobotEnum);
31 | }
32 |
33 | @Override
34 | public NotifyMsgTypeEnum getMsgType() {
35 | return NotifyMsgTypeEnum.NEWS;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/robot/model/request/RobotNotifyRequest.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.robot.model.request;
2 |
3 | import cn.smartcoding.common.robot.enums.NotifyMsgTypeEnum;
4 | import cn.smartcoding.common.robot.enums.NotifyRobotEnum;
5 |
6 | public interface RobotNotifyRequest {
7 |
8 | NotifyMsgTypeEnum getMsgType();
9 |
10 | String getWebHook();
11 |
12 | void setWebHook(String webHook);
13 |
14 | NotifyRobotEnum getNotifyRobotEnum();
15 |
16 | void setNotifyRobotEnum(NotifyRobotEnum notifyRobotEnum);
17 | }
18 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/robot/model/request/SingleActionCardRequest.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.robot.model.request;
2 |
3 | import cn.smartcoding.common.robot.enums.NotifyMsgTypeEnum;
4 | import cn.smartcoding.common.robot.enums.NotifyRobotEnum;
5 | import lombok.Data;
6 | import lombok.experimental.Accessors;
7 |
8 | @Data
9 | @Accessors(chain = true)
10 | public class SingleActionCardRequest extends BaseNotifyRequest implements RobotNotifyRequest {
11 |
12 | private String title;
13 | private String text;
14 | private String singleTitle;
15 | private String singleURL;
16 | private String btnOrientation;
17 | private String hideAvatar;
18 |
19 | public SingleActionCardRequest(String webHook, NotifyRobotEnum notifyRobotEnum) {
20 | super(webHook, notifyRobotEnum);
21 | }
22 |
23 | @Override
24 | public NotifyMsgTypeEnum getMsgType() {
25 | return NotifyMsgTypeEnum.ACTION_CARD;
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/robot/model/request/TextRequest.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.robot.model.request;
2 |
3 | import cn.smartcoding.common.robot.enums.NotifyMsgTypeEnum;
4 | import cn.smartcoding.common.robot.enums.NotifyRobotEnum;
5 | import lombok.Data;
6 | import lombok.experimental.Accessors;
7 |
8 | import java.util.List;
9 |
10 | /**
11 | * 文本请求
12 | *
13 | * @author qingshi
14 | * @email 705029004@qq.com
15 | * @date 2020/02/07- 9:37 下午
16 | */
17 | @Data
18 | @Accessors(chain = true)
19 | public class TextRequest extends BaseNotifyRequest implements RobotNotifyRequest {
20 | /**
21 | * 消息的文本
22 | */
23 | private String text;
24 | /**
25 | * 需要at @ 的人:手机号码
26 | */
27 | private List atMobileList;
28 | /**
29 | * 需要at @ 的人:userid
30 | */
31 | private List atUserIdList;
32 | /**
33 | * @all 所以人
34 | */
35 | private boolean isAtAll;
36 |
37 | public TextRequest(String webHook, NotifyRobotEnum notifyRobotEnum) {
38 | super(webHook, notifyRobotEnum);
39 | }
40 |
41 | @Override
42 | public NotifyMsgTypeEnum getMsgType() {
43 | return NotifyMsgTypeEnum.TEXT;
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/robot/model/response/RobotNotifyResponse.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.robot.model.response;
2 |
3 | import com.alibaba.fastjson.JSON;
4 | import lombok.AllArgsConstructor;
5 | import lombok.Data;
6 | import lombok.NoArgsConstructor;
7 |
8 | import java.util.HashMap;
9 | import java.util.Map;
10 |
11 | /**
12 | * 请求返回信息
13 | *
14 | * @author qingshi
15 | * @email 705029004@qq.com
16 | * @date 2020/02/06- 8:18 下午
17 | */
18 | @Data
19 | @NoArgsConstructor
20 | @AllArgsConstructor
21 | public class RobotNotifyResponse {
22 | private boolean isSuccess = false;
23 | private Integer errorCode;
24 | private String errorMsg;
25 |
26 | @Override
27 | public String toString() {
28 | Map items = new HashMap();
29 | items.put("errorCode", errorCode);
30 | items.put("errorMsg", errorMsg);
31 | items.put("isSuccess", isSuccess);
32 | return JSON.toJSONString(items);
33 | }
34 |
35 | public static RobotNotifyResponse error(String errorMsg) {
36 | RobotNotifyResponse robotNotifyResponse = new RobotNotifyResponse();
37 | robotNotifyResponse.setErrorMsg(errorMsg);
38 | return robotNotifyResponse;
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/robot/util/ErrorStringUtils.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.robot.util;
2 |
3 | /**
4 | * --添加相关注释--
5 | *
6 | * @author qingshi
7 | * @email 705029004@qq.com
8 | * @date 2020/02/07- 12:35 下午
9 | */
10 | public class ErrorStringUtils {
11 | public static String wxError(String msg) {
12 | return "企业微信: " + msg;
13 | }
14 |
15 | public static String dingdingError(String msg) {
16 | return "钉钉: " + msg;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/utils/ExceptionUtil.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.utils;
2 |
3 | import org.apache.commons.lang3.exception.ExceptionUtils;
4 |
5 | import java.io.PrintWriter;
6 | import java.io.StringWriter;
7 |
8 | /**
9 | * 错误信息处理类。
10 | *
11 | * @author wuque
12 | */
13 | public class ExceptionUtil {
14 | /**
15 | * 获取exception的详细错误信息。
16 | */
17 | public static String getExceptionMessage(Throwable e) {
18 | StringWriter sw = new StringWriter();
19 | e.printStackTrace(new PrintWriter(sw, true));
20 | String str = sw.toString();
21 | return str;
22 | }
23 |
24 | public static String getRootErrorMseeage(Exception e) {
25 | Throwable root = ExceptionUtils.getRootCause(e);
26 | root = (root == null ? e : root);
27 | if (root == null) {
28 | return "";
29 | }
30 | String msg = root.getMessage();
31 | if (msg == null) {
32 | return "null";
33 | }
34 | return StringUtils.defaultString(msg);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/utils/LogUtils.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.utils;
2 |
3 | /**
4 | * 处理并记录日志文件
5 | *
6 | * @author wuque
7 | */
8 | public class LogUtils {
9 | public static String getBlock(Object msg) {
10 | if (msg == null) {
11 | msg = "";
12 | }
13 | return "[" + msg.toString() + "]";
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/utils/MessageUtils.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.utils;
2 |
3 | import cn.smartcoding.common.utils.spring.SpringUtils;
4 | import org.springframework.context.MessageSource;
5 | import org.springframework.context.i18n.LocaleContextHolder;
6 |
7 | /**
8 | * 获取i18n资源文件
9 | *
10 | * @author wuque
11 | */
12 | public class MessageUtils {
13 | /**
14 | * 根据消息键和参数 获取消息 委托给spring messageSource
15 | *
16 | * @param code 消息键
17 | * @param args 参数
18 | * @return 获取国际化翻译值
19 | */
20 | public static String message(String code, Object... args) {
21 | MessageSource messageSource = SpringUtils.getBean(MessageSource.class);
22 | return messageSource.getMessage(code, args, LocaleContextHolder.getLocale());
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/utils/http/HttpHelper.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.utils.http;
2 |
3 | import org.apache.commons.lang3.exception.ExceptionUtils;
4 | import org.slf4j.Logger;
5 | import org.slf4j.LoggerFactory;
6 |
7 | import javax.servlet.ServletRequest;
8 | import java.io.BufferedReader;
9 | import java.io.IOException;
10 | import java.io.InputStream;
11 | import java.io.InputStreamReader;
12 | import java.nio.charset.Charset;
13 |
14 | /**
15 | * 通用http工具封装
16 | *
17 | * @author wuque
18 | */
19 | public class HttpHelper {
20 | private static final Logger LOGGER = LoggerFactory.getLogger(HttpHelper.class);
21 |
22 | public static String getBodyString(ServletRequest request) {
23 | StringBuilder sb = new StringBuilder();
24 | BufferedReader reader = null;
25 | try (InputStream inputStream = request.getInputStream()) {
26 | reader = new BufferedReader(new InputStreamReader(inputStream, Charset.forName("UTF-8")));
27 | String line = "";
28 | while ((line = reader.readLine()) != null) {
29 | sb.append(line);
30 | }
31 | } catch (IOException e) {
32 | LOGGER.warn("getBodyString出现问题!");
33 | } finally {
34 | if (reader != null) {
35 | try {
36 | reader.close();
37 | } catch (IOException e) {
38 | LOGGER.error(ExceptionUtils.getMessage(e));
39 | }
40 | }
41 | }
42 | return sb.toString();
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/utils/sql/SqlUtil.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.utils.sql;
2 |
3 | import cn.smartcoding.common.exception.BaseException;
4 | import cn.smartcoding.common.utils.StringUtils;
5 |
6 | /**
7 | * sql操作工具类
8 | *
9 | * @author wuque
10 | */
11 | public class SqlUtil {
12 | /**
13 | * 仅支持字母、数字、下划线、空格、逗号、小数点(支持多个字段排序)
14 | */
15 | public static String SQL_PATTERN = "[a-zA-Z0-9_\\ \\,\\.]+";
16 |
17 | /**
18 | * 检查字符,防止注入绕过
19 | */
20 | public static String escapeOrderBySql(String value) {
21 | if (StringUtils.isNotEmpty(value) && !isValidOrderBySql(value)) {
22 | throw new BaseException("参数不符合规范,不能进行查询");
23 | }
24 | return value;
25 | }
26 |
27 | /**
28 | * 验证 order by 语法是否符合规范
29 | */
30 | public static boolean isValidOrderBySql(String value) {
31 | return value.matches(SQL_PATTERN);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/smart-job-common/src/main/java/cn/smartcoding/common/utils/uuid/IdUtils.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.common.utils.uuid;
2 |
3 | /**
4 | * ID生成器工具类
5 | *
6 | * @author wuque
7 | */
8 | public class IdUtils {
9 | /**
10 | * 获取随机UUID
11 | *
12 | * @return 随机UUID
13 | */
14 | public static String randomUUID() {
15 | return UUID.randomUUID().toString();
16 | }
17 |
18 | /**
19 | * 简化的UUID,去掉了横线
20 | *
21 | * @return 简化的UUID,去掉了横线
22 | */
23 | public static String simpleUUID() {
24 | return UUID.randomUUID().toString(true);
25 | }
26 |
27 | /**
28 | * 获取随机UUID,使用性能更好的ThreadLocalRandom生成UUID
29 | *
30 | * @return 随机UUID
31 | */
32 | public static String fastUUID() {
33 | return UUID.fastUUID().toString();
34 | }
35 |
36 | /**
37 | * 简化的UUID,去掉了横线,使用性能更好的ThreadLocalRandom生成UUID
38 | *
39 | * @return 简化的UUID,去掉了横线
40 | */
41 | public static String fastSimpleUUID() {
42 | return UUID.fastUUID().toString(true);
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/smart-job-core/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/smart-job-core/.DS_Store
--------------------------------------------------------------------------------
/smart-job-core/src/main/java/cn/smartcoding/job/core/biz/AdminBiz.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.job.core.biz;
2 |
3 | import cn.smartcoding.job.core.biz.model.HandleCallbackParam;
4 | import cn.smartcoding.job.core.biz.model.RegistryParam;
5 | import cn.smartcoding.job.core.biz.model.ReturnT;
6 |
7 | import java.util.List;
8 |
9 | /**
10 | * @author xuxueli 2017-07-27 21:52:49
11 | */
12 | public interface AdminBiz {
13 |
14 | String MAPPING = "/api";
15 |
16 |
17 | // ---------------------- callback ----------------------
18 |
19 | /**
20 | * callback
21 | *
22 | * @param callbackParamList
23 | * @return
24 | */
25 | ReturnT callback(List callbackParamList);
26 |
27 |
28 | // ---------------------- registry ----------------------
29 |
30 | /**
31 | * registry
32 | *
33 | * @param registryParam
34 | * @return
35 | */
36 | ReturnT registry(RegistryParam registryParam);
37 |
38 | /**
39 | * registry remove
40 | *
41 | * @param registryParam
42 | * @return
43 | */
44 | ReturnT registryRemove(RegistryParam registryParam);
45 |
46 | }
47 |
--------------------------------------------------------------------------------
/smart-job-core/src/main/java/cn/smartcoding/job/core/biz/ExecutorBiz.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.job.core.biz;
2 |
3 | import cn.smartcoding.job.core.biz.model.LogResult;
4 | import cn.smartcoding.job.core.biz.model.ReturnT;
5 | import cn.smartcoding.job.core.biz.model.TriggerParam;
6 |
7 | /**
8 | * 任务执行器
9 | * Created by xuxueli on 17/3/1.
10 | */
11 | public interface ExecutorBiz {
12 |
13 | /**
14 | * beat
15 | *
16 | * @return result
17 | */
18 | ReturnT beat();
19 |
20 | /**
21 | * idle beat
22 | *
23 | * @param jobId
24 | * @return result
25 | */
26 | ReturnT idleBeat(Long jobId);
27 |
28 | /**
29 | * kill
30 | *
31 | * @param jobId
32 | * @return result
33 | */
34 | ReturnT kill(Long jobId);
35 |
36 | /**
37 | * log
38 | *
39 | * @param logDateTime start time
40 | * @param logId jobLogId
41 | * @param fromLineNum from line num
42 | * @return result
43 | */
44 | ReturnT log(long logDateTime, Long logId, int fromLineNum);
45 |
46 | /**
47 | * run
48 | *
49 | * @param triggerParam trigger
50 | * @return result
51 | */
52 | ReturnT run(TriggerParam triggerParam);
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/smart-job-core/src/main/java/cn/smartcoding/job/core/biz/JobBiz.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.job.core.biz;
2 |
3 | import cn.smartcoding.job.core.biz.model.JobGroupParam;
4 | import cn.smartcoding.job.core.biz.model.JobInfoParam;
5 | import cn.smartcoding.job.core.biz.model.ReturnT;
6 |
7 | /**
8 | * @author xuxueli 2017-07-27 21:52:49
9 | */
10 | public interface JobBiz {
11 |
12 | // ---------------------- registry ----------------------
13 |
14 | /**
15 | * registry
16 | *
17 | * @param jobGroupParam
18 | * @return
19 | */
20 | ReturnT registryJobGroup(JobGroupParam jobGroupParam);
21 |
22 | /**
23 | * registry remove
24 | *
25 | * @param jobInfoParam
26 | * @return
27 | */
28 | ReturnT registryJobInfo(JobInfoParam jobInfoParam);
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/smart-job-core/src/main/java/cn/smartcoding/job/core/biz/JobConst.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.job.core.biz;
2 |
3 | public interface JobConst {
4 |
5 | String CLIENT_VERSION = "2.3.1";
6 | }
7 |
--------------------------------------------------------------------------------
/smart-job-core/src/main/java/cn/smartcoding/job/core/biz/model/LogResult.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.job.core.biz.model;
2 |
3 | import java.io.Serializable;
4 |
5 | /**
6 | * Created by xuxueli on 17/3/23.
7 | */
8 | public class LogResult implements Serializable {
9 | private static final long serialVersionUID = 42L;
10 |
11 | public LogResult(int fromLineNum, int toLineNum, String logContent, boolean isEnd) {
12 | this.fromLineNum = fromLineNum;
13 | this.toLineNum = toLineNum;
14 | this.logContent = logContent;
15 | this.isEnd = isEnd;
16 | }
17 |
18 | private int fromLineNum;
19 | private int toLineNum;
20 | private String logContent;
21 | private boolean isEnd;
22 |
23 | public int getFromLineNum() {
24 | return fromLineNum;
25 | }
26 |
27 | public void setFromLineNum(int fromLineNum) {
28 | this.fromLineNum = fromLineNum;
29 | }
30 |
31 | public int getToLineNum() {
32 | return toLineNum;
33 | }
34 |
35 | public void setToLineNum(int toLineNum) {
36 | this.toLineNum = toLineNum;
37 | }
38 |
39 | public String getLogContent() {
40 | return logContent;
41 | }
42 |
43 | public void setLogContent(String logContent) {
44 | this.logContent = logContent;
45 | }
46 |
47 | public boolean isEnd() {
48 | return isEnd;
49 | }
50 |
51 | public void setEnd(boolean end) {
52 | isEnd = end;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/smart-job-core/src/main/java/cn/smartcoding/job/core/cron/ValueSet.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.job.core.cron;
2 |
3 | class ValueSet {
4 | public int value;
5 |
6 | public int pos;
7 | }
8 |
--------------------------------------------------------------------------------
/smart-job-core/src/main/java/cn/smartcoding/job/core/enums/ExecutorBlockStrategyEnum.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.job.core.enums;
2 |
3 | /**
4 | * Created by xuxueli on 17/5/9.
5 | */
6 | public enum ExecutorBlockStrategyEnum {
7 |
8 | SERIAL_EXECUTION("Serial execution"),
9 | /*CONCURRENT_EXECUTION("并行"),*/
10 | DISCARD_LATER("Discard Later"),
11 | COVER_EARLY("Cover Early");
12 |
13 | private String title;
14 |
15 | private ExecutorBlockStrategyEnum(String title) {
16 | this.title = title;
17 | }
18 |
19 | public void setTitle(String title) {
20 | this.title = title;
21 | }
22 |
23 | public String getTitle() {
24 | return title;
25 | }
26 |
27 | public static ExecutorBlockStrategyEnum match(String name, ExecutorBlockStrategyEnum defaultItem) {
28 | if (name != null) {
29 | for (ExecutorBlockStrategyEnum item : ExecutorBlockStrategyEnum.values()) {
30 | if (item.name().equals(name)) {
31 | return item;
32 | }
33 | }
34 | }
35 | return defaultItem;
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/smart-job-core/src/main/java/cn/smartcoding/job/core/enums/RegistryConfig.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.job.core.enums;
2 |
3 | /**
4 | * Created by xuxueli on 17/5/10.
5 | */
6 | public class RegistryConfig {
7 |
8 | public static final int BEAT_TIMEOUT = 30;
9 | //超时
10 | public static final int DEAD_TIMEOUT = BEAT_TIMEOUT * 3;
11 |
12 | public enum RegistType {EXECUTOR, ADMIN}
13 |
14 | }
15 |
--------------------------------------------------------------------------------
/smart-job-core/src/main/java/cn/smartcoding/job/core/glue/GlueTypeEnum.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.job.core.glue;
2 |
3 | /**
4 | * Created by xuxueli on 17/4/26.
5 | */
6 | public enum GlueTypeEnum {
7 |
8 | BEAN("BEAN", false, null, null),
9 | GLUE_GROOVY("GLUE(Java)", false, null, null),
10 | GLUE_SHELL("GLUE(Shell)", true, "bash", ".sh"),
11 | GLUE_PYTHON("GLUE(Python)", true, "python", ".py"),
12 | GLUE_PHP("GLUE(PHP)", true, "php", ".php"),
13 | GLUE_NODEJS("GLUE(Nodejs)", true, "node", ".js"),
14 | GLUE_POWERSHELL("GLUE(PowerShell)", true, "powershell ", ".ps1");
15 |
16 | private String desc;
17 | private boolean isScript;
18 | private String cmd;
19 | private String suffix;
20 |
21 | private GlueTypeEnum(String desc, boolean isScript, String cmd, String suffix) {
22 | this.desc = desc;
23 | this.isScript = isScript;
24 | this.cmd = cmd;
25 | this.suffix = suffix;
26 | }
27 |
28 | public String getDesc() {
29 | return desc;
30 | }
31 |
32 | public boolean isScript() {
33 | return isScript;
34 | }
35 |
36 | public String getCmd() {
37 | return cmd;
38 | }
39 |
40 | public String getSuffix() {
41 | return suffix;
42 | }
43 |
44 | public static GlueTypeEnum match(String name) {
45 | for (GlueTypeEnum item : GlueTypeEnum.values()) {
46 | if (item.name().equals(name)) {
47 | return item;
48 | }
49 | }
50 | return null;
51 | }
52 |
53 | }
54 |
--------------------------------------------------------------------------------
/smart-job-core/src/main/java/cn/smartcoding/job/core/handler/IJobHandler.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.job.core.handler;
2 |
3 | import cn.smartcoding.job.core.biz.model.ReturnT;
4 |
5 | import java.lang.reflect.InvocationTargetException;
6 |
7 | /**
8 | * job handler
9 | *
10 | * @author xuxueli 2015-12-19 19:06:38
11 | */
12 | public abstract class IJobHandler {
13 |
14 |
15 | /**
16 | * success
17 | */
18 | public static final ReturnT SUCCESS = new ReturnT(200, "success");
19 | /**
20 | * fail
21 | */
22 | public static final ReturnT FAIL = new ReturnT(500, "fail");
23 | /**
24 | * fail timeout
25 | */
26 | public static final ReturnT FAIL_TIMEOUT = new ReturnT(502, "fail timeout");
27 |
28 |
29 | /**
30 | * execute handler, invoked when executor receives a scheduling request
31 | *
32 | * @param param param
33 | * @return execute result
34 | * @throws Exception
35 | */
36 | public abstract ReturnT execute(String param) throws Exception;
37 |
38 | /**
39 | * init handler, invoked when JobThread initJobThread
40 | */
41 | public void init() throws InvocationTargetException, IllegalAccessException {
42 | // do something
43 | }
44 |
45 |
46 | /**
47 | * destroy handler, invoked when JobThread destroy
48 | */
49 | public void destroy() throws InvocationTargetException, IllegalAccessException {
50 | // do something
51 | }
52 |
53 |
54 | }
55 |
--------------------------------------------------------------------------------
/smart-job-core/src/main/java/cn/smartcoding/job/core/handler/annotation/JobHandler.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.job.core.handler.annotation;
2 |
3 |
4 | import java.lang.annotation.*;
5 |
6 | /**
7 | * annotation for job handler
8 | *
9 | * @author 2016-5-17 21:06:49
10 | */
11 | @Target({ElementType.TYPE})
12 | @Retention(RetentionPolicy.RUNTIME)
13 | @Inherited
14 | public @interface JobHandler {
15 |
16 | String value() default "";
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/smart-job-core/src/main/java/cn/smartcoding/job/core/handler/annotation/JobMethodHandler.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.job.core.handler.annotation;
2 |
3 | import java.lang.annotation.*;
4 |
5 | /**
6 | * annotation for method jobhandler
7 | *
8 | * @author xuxueli 2019-12-11 20:50:13
9 | */
10 | @Target({ElementType.METHOD})
11 | @Retention(RetentionPolicy.RUNTIME)
12 | @Inherited
13 | public @interface JobMethodHandler {
14 |
15 | /**
16 | * jobhandler name
17 | */
18 | String value() default "";
19 |
20 | /**
21 | * init handler, invoked when JobThread init
22 | */
23 | String init() default "";
24 |
25 | /**
26 | * destroy handler, invoked when JobThread destroy
27 | */
28 | String destroy() default "";
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/smart-job-core/src/main/java/cn/smartcoding/job/core/handler/impl/GlueJobHandler.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.job.core.handler.impl;
2 |
3 | import cn.smartcoding.job.core.biz.model.ReturnT;
4 | import cn.smartcoding.job.core.handler.IJobHandler;
5 | import cn.smartcoding.job.core.log.XxlJobLogger;
6 |
7 | /**
8 | * glue job handler
9 | *
10 | * @author xuxueli 2016-5-19 21:05:45
11 | */
12 | public class GlueJobHandler extends IJobHandler {
13 |
14 | private Long glueUpdateTime;
15 | private IJobHandler jobHandler;
16 |
17 | public GlueJobHandler(IJobHandler jobHandler, Long glueUpdateTime) {
18 | this.jobHandler = jobHandler;
19 | this.glueUpdateTime = glueUpdateTime;
20 | }
21 |
22 | public Long getGlueUpdateTime() {
23 | return glueUpdateTime;
24 | }
25 |
26 | @Override
27 | public ReturnT execute(String param) throws Exception {
28 | XxlJobLogger.log("----------- glue.version:" + glueUpdateTime + " -----------");
29 | return jobHandler.execute(param);
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/smart-job-core/src/main/java/cn/smartcoding/job/core/log/LogLevel.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.job.core.log;
2 |
3 | /**
4 | * 日志的等级
5 | *
6 | * @author 无缺
7 | * @date 2019-08-04
8 | */
9 | public enum LogLevel {
10 | INFO,
11 | DEBUG,
12 | WARN,
13 | ERROR
14 | }
15 |
--------------------------------------------------------------------------------
/smart-job-core/src/main/java/cn/smartcoding/job/core/util/ShardingUtil.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.job.core.util;
2 |
3 | /**
4 | * sharding vo
5 | *
6 | * @author xuxueli 2017-07-25 21:26:38
7 | */
8 | public class ShardingUtil {
9 |
10 | private static InheritableThreadLocal contextHolder = new InheritableThreadLocal();
11 |
12 | public static class ShardingVO {
13 |
14 | private int index; // sharding index
15 | private int total; // sharding total
16 |
17 | public ShardingVO(int index, int total) {
18 | this.index = index;
19 | this.total = total;
20 | }
21 |
22 | public int getIndex() {
23 | return index;
24 | }
25 |
26 | public void setIndex(int index) {
27 | this.index = index;
28 | }
29 |
30 | public int getTotal() {
31 | return total;
32 | }
33 |
34 | public void setTotal(int total) {
35 | this.total = total;
36 | }
37 | }
38 |
39 | public static void setShardingVo(ShardingVO shardingVo) {
40 | contextHolder.set(shardingVo);
41 | }
42 |
43 | public static ShardingVO getShardingVo() {
44 | return contextHolder.get();
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/smart-job-core/src/main/java/cn/smartcoding/job/core/util/UUIDUtils.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.job.core.util;
2 |
3 | import java.util.UUID;
4 |
5 | /**
6 | * UUID工具类
7 | *
8 | * @author wuque
9 | * @date 04/05/2017
10 | */
11 | public class UUIDUtils {
12 |
13 | public static String generateUUID() {
14 | return UUID.randomUUID().toString().replaceAll("-", "");
15 | }
16 |
17 | /**
18 | * 生成纯数字UUID
19 | *
20 | * @return 8位数UUID
21 | */
22 | public static String generateUUID(int num) {
23 | String uid = generateUUID();
24 | return uid.substring(0, num);
25 | }
26 |
27 | /**
28 | * 生成8位纯数字UUID
29 | *
30 | * @return 8位数UUID
31 | */
32 | public static String generateEightUUID() {
33 | long uid = UUID.randomUUID().getMostSignificantBits();
34 | if (uid < 0) {
35 | uid = -uid;
36 | }
37 | String str = "" + uid;
38 | str = str.substring(0, 8);
39 | return str;
40 | }
41 |
42 | /**
43 | * 生成4位纯数字UUID
44 | *
45 | * @return 8位数UUID
46 | */
47 | public static String generateFourUUID() {
48 | long uid = UUID.randomUUID().getMostSignificantBits();
49 | if (uid < 0) {
50 | uid = -uid;
51 | }
52 | String str = "" + uid;
53 | str = str.substring(0, 4);
54 | return str;
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/smart-job-framework/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/smart-coding-team/smart-job/1b0b29d73421421737f54d2a6df9be8863fced33/smart-job-framework/.DS_Store
--------------------------------------------------------------------------------
/smart-job-framework/src/main/java/cn/smartcoding/framework/config/ApplicationConfig.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.framework.config;
2 |
3 | import org.mybatis.spring.annotation.MapperScan;
4 | import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.context.annotation.Configuration;
7 | import org.springframework.context.annotation.EnableAspectJAutoProxy;
8 |
9 | import java.util.TimeZone;
10 |
11 | /**
12 | * 程序注解配置
13 | *
14 | * @author wuque
15 | */
16 | @Configuration
17 | // 表示通过aop框架暴露该代理对象,AopContext能够访问
18 | @EnableAspectJAutoProxy(exposeProxy = true)
19 | // 指定要扫描的Mapper类的包的路径
20 | @MapperScan("cn.smartcoding.**.mapper")
21 | public class ApplicationConfig {
22 | /**
23 | * 时区配置
24 | */
25 | @Bean
26 | public Jackson2ObjectMapperBuilderCustomizer jacksonObjectMapperCustomization() {
27 | return jacksonObjectMapperBuilder -> jacksonObjectMapperBuilder.timeZone(TimeZone.getDefault());
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/smart-job-framework/src/main/java/cn/smartcoding/framework/config/CaptchaConfig.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.framework.config;
2 |
3 | import cn.smartcoding.framework.config.properties.CaptchaProperties;
4 | import org.springframework.boot.context.properties.ConfigurationProperties;
5 | import org.springframework.context.annotation.Bean;
6 | import org.springframework.context.annotation.Configuration;
7 |
8 | /**
9 | * 验证码配置
10 | *
11 | * @author wuque
12 | */
13 | @Configuration
14 | public class CaptchaConfig {
15 |
16 | @Bean
17 | @ConfigurationProperties(prefix = "login", ignoreUnknownFields = true)
18 | public CaptchaProperties captchaProperties() {
19 | return new CaptchaProperties();
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/smart-job-framework/src/main/java/cn/smartcoding/framework/config/ServerConfig.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.framework.config;
2 |
3 | import cn.smartcoding.common.utils.ServletUtils;
4 | import org.springframework.stereotype.Component;
5 |
6 | import javax.servlet.http.HttpServletRequest;
7 |
8 | /**
9 | * 服务相关配置
10 | *
11 | * @author wuque
12 | */
13 | @Component
14 | public class ServerConfig {
15 | /**
16 | * 获取完整的请求路径,包括:域名,端口,上下文访问路径
17 | *
18 | * @return 服务地址
19 | */
20 | public String getUrl() {
21 | HttpServletRequest request = ServletUtils.getRequest();
22 | return getDomain(request);
23 | }
24 |
25 | public static String getDomain(HttpServletRequest request) {
26 | StringBuffer url = request.getRequestURL();
27 | String contextPath = request.getServletContext().getContextPath();
28 | return url.delete(url.length() - request.getRequestURI().length(), url.length()).append(contextPath).toString();
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/smart-job-framework/src/main/java/cn/smartcoding/framework/datasource/DynamicDataSource.java:
--------------------------------------------------------------------------------
1 | package cn.smartcoding.framework.datasource;
2 |
3 | import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
4 |
5 | import javax.sql.DataSource;
6 | import java.util.Map;
7 |
8 | /**
9 | * 动态数据源
10 | *
11 | * @author wuque
12 | */
13 | public class DynamicDataSource extends AbstractRoutingDataSource {
14 | public DynamicDataSource(DataSource defaultTargetDataSource, Map